blob_id
stringlengths
40
40
__id__
int64
225
39,780B
directory_id
stringlengths
40
40
path
stringlengths
6
313
content_id
stringlengths
40
40
detected_licenses
list
license_type
stringclasses
2 values
repo_name
stringlengths
6
132
repo_url
stringlengths
25
151
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
70
visit_date
timestamp[ns]
revision_date
timestamp[ns]
committer_date
timestamp[ns]
github_id
int64
7.28k
689M
star_events_count
int64
0
131k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
23 values
gha_fork
bool
2 classes
gha_event_created_at
timestamp[ns]
gha_created_at
timestamp[ns]
gha_updated_at
timestamp[ns]
gha_pushed_at
timestamp[ns]
gha_size
int64
0
40.4M
gha_stargazers_count
int32
0
112k
gha_forks_count
int32
0
39.4k
gha_open_issues_count
int32
0
11k
gha_language
stringlengths
1
21
gha_archived
bool
2 classes
gha_disabled
bool
1 class
content
stringlengths
7
4.37M
src_encoding
stringlengths
3
16
language
stringclasses
1 value
length_bytes
int64
7
4.37M
extension
stringclasses
24 values
filename
stringlengths
4
174
language_id
stringclasses
1 value
entities
list
contaminating_dataset
stringclasses
0 values
malware_signatures
list
redacted_content
stringlengths
7
4.37M
redacted_length_bytes
int64
7
4.37M
alphanum_fraction
float32
0.25
0.94
alpha_fraction
float32
0.25
0.94
num_lines
int32
1
84k
avg_line_length
float32
0.76
99.9
std_line_length
float32
0
220
max_line_length
int32
5
998
is_vendor
bool
2 classes
is_generated
bool
1 class
max_hex_length
int32
0
319
hex_fraction
float32
0
0.38
max_unicode_length
int32
0
408
unicode_fraction
float32
0
0.36
max_base64_length
int32
0
506
base64_fraction
float32
0
0.5
avg_csv_sep_count
float32
0
4
is_autogen_header
bool
1 class
is_empty_html
bool
1 class
shard
stringclasses
16 values
af7ee154938be462e9871453be65a564997ba8bd
9,363,028,712,726
9603243d9093225f024f36c69305b8e70bbc5ac0
/de.moerker.android.staticfragments/src/de/moerker/android/staticfragments/DetailFragment.java
702c0b176b60539dcdbed8a3d6d8d188cc50cf91
[]
no_license
moerker/android
https://github.com/moerker/android
15ab093715a2fcf1b5f9b095786ace073320eb01
a55582d4d311c8b89f0a7397a847fc6d177f004d
refs/heads/master
2016-09-06T00:01:24.675000
2013-06-19T09:20:19
2013-06-19T09:20:19
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package de.moerker.android.staticfragments; import android.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import de.moerker.android.staticfragaments.R; public class DetailFragment extends Fragment { /* * (non-Javadoc) * * @see android.app.Fragment#onCreateView(android.view.LayoutInflater, * android.view.ViewGroup, android.os.Bundle) */ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_detail, container, false); return view; } /* * */ public void setText(String item) { TextView view = (TextView) getView().findViewById(R.id.detailsText); view.setText(item); } }
UTF-8
Java
858
java
DetailFragment.java
Java
[]
null
[]
package de.moerker.android.staticfragments; import android.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import de.moerker.android.staticfragaments.R; public class DetailFragment extends Fragment { /* * (non-Javadoc) * * @see android.app.Fragment#onCreateView(android.view.LayoutInflater, * android.view.ViewGroup, android.os.Bundle) */ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_detail, container, false); return view; } /* * */ public void setText(String item) { TextView view = (TextView) getView().findViewById(R.id.detailsText); view.setText(item); } }
858
0.730769
0.730769
32
24.8125
25.880056
100
false
false
0
0
0
0
0
0
1.25
false
false
13
0bd8760934541e0388cdabbccfe2b2273452cdfb
11,141,145,229,558
9705c23f467781085feac73b063be578adba0d98
/src/main/java/com/datadog/task/controller/LogReader.java
60e75036851a29716aeafa7df5abf6bce0cd1b70
[]
no_license
jadetang/DataDogTask
https://github.com/jadetang/DataDogTask
992917d719110c2e197ab1899115691459151fe1
0be04fc53b79137f594f0e85107faf460da295da
refs/heads/master
2023-06-08T06:51:19.598000
2020-10-20T14:09:32
2020-10-20T14:09:32
305,175,597
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.datadog.task.controller; import com.datadog.task.model.LogRecord; import com.datadog.task.model.NewLogReceivedEvent; import com.datadog.task.storage.StatisticsRepository; import com.datadog.task.util.LogParser; import com.google.common.eventbus.EventBus; import java.io.File; import java.time.Instant; import java.util.Optional; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import org.apache.commons.io.input.Tailer; import org.apache.commons.io.input.TailerListenerAdapter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class LogReader extends LifeCycle { private static final Logger log = LoggerFactory.getLogger(LogReader.class); private final String filePath; private final StatisticsRepository statisticsRepository; private final ExecutorService executorService; private final EventBus eventBus; private Tailer tailer; public LogReader(String filePath, StatisticsRepository statisticsRepository, EventBus eventBus) { this.filePath = filePath; this.statisticsRepository = statisticsRepository; this.executorService = Executors.newSingleThreadExecutor(); this.eventBus = eventBus; } @Override void doInitialize() { log.info("Create log tailer for file {}", filePath); final File file = new File(filePath); tailer = new Tailer(file, new LogTailerListener(statisticsRepository, eventBus), 5L); executorService.execute(tailer); } @Override void doClose() { tailer.stop(); executorService.shutdown(); try { executorService.awaitTermination(10, TimeUnit.SECONDS); } catch (final InterruptedException e) { log.error("Error while stopping the scheduler thread pool"); Thread.currentThread().interrupt(); } } public static class LogTailerListener extends TailerListenerAdapter { private final StatisticsRepository statisticsRepository; private final EventBus eventBus; public LogTailerListener(StatisticsRepository statisticsRepository, EventBus eventBus) { this.statisticsRepository = statisticsRepository; this.eventBus = eventBus; } @Override public void handle(String logLine) { final Optional<LogRecord> logRecord = LogParser.parse(logLine); logRecord.ifPresent(l -> { log.debug("Latest log time {}", Instant.ofEpochSecond(l.getTimestamp())); eventBus.post(new NewLogReceivedEvent()); statisticsRepository.addRecord(l); }); } } }
UTF-8
Java
2,722
java
LogReader.java
Java
[]
null
[]
package com.datadog.task.controller; import com.datadog.task.model.LogRecord; import com.datadog.task.model.NewLogReceivedEvent; import com.datadog.task.storage.StatisticsRepository; import com.datadog.task.util.LogParser; import com.google.common.eventbus.EventBus; import java.io.File; import java.time.Instant; import java.util.Optional; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import org.apache.commons.io.input.Tailer; import org.apache.commons.io.input.TailerListenerAdapter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class LogReader extends LifeCycle { private static final Logger log = LoggerFactory.getLogger(LogReader.class); private final String filePath; private final StatisticsRepository statisticsRepository; private final ExecutorService executorService; private final EventBus eventBus; private Tailer tailer; public LogReader(String filePath, StatisticsRepository statisticsRepository, EventBus eventBus) { this.filePath = filePath; this.statisticsRepository = statisticsRepository; this.executorService = Executors.newSingleThreadExecutor(); this.eventBus = eventBus; } @Override void doInitialize() { log.info("Create log tailer for file {}", filePath); final File file = new File(filePath); tailer = new Tailer(file, new LogTailerListener(statisticsRepository, eventBus), 5L); executorService.execute(tailer); } @Override void doClose() { tailer.stop(); executorService.shutdown(); try { executorService.awaitTermination(10, TimeUnit.SECONDS); } catch (final InterruptedException e) { log.error("Error while stopping the scheduler thread pool"); Thread.currentThread().interrupt(); } } public static class LogTailerListener extends TailerListenerAdapter { private final StatisticsRepository statisticsRepository; private final EventBus eventBus; public LogTailerListener(StatisticsRepository statisticsRepository, EventBus eventBus) { this.statisticsRepository = statisticsRepository; this.eventBus = eventBus; } @Override public void handle(String logLine) { final Optional<LogRecord> logRecord = LogParser.parse(logLine); logRecord.ifPresent(l -> { log.debug("Latest log time {}", Instant.ofEpochSecond(l.getTimestamp())); eventBus.post(new NewLogReceivedEvent()); statisticsRepository.addRecord(l); }); } } }
2,722
0.703159
0.701323
82
32.195122
26.845284
101
false
false
0
0
0
0
0
0
0.646341
false
false
9
6c27ad6f6b2121e698440f2730501c7e2ffc33dc
11,141,145,231,335
5b2da9a91cb11b99f78323b036eae000fe5fdb11
/src/main/java/com/epam/likhanau/data/NearAirportSearchData.java
98853dfd3f2df9ea784e0fa7c201a3f1f41d2cf9
[]
no_license
Likhanau/automated-testing-bookingcom
https://github.com/Likhanau/automated-testing-bookingcom
fc440275ddf74056f48837fc7c204c01b05f412f
cd09b1c88c1a3a4d6b1f2e6c853368baa19f8efa
refs/heads/master
2020-03-10T23:57:44.589000
2018-04-17T22:24:19
2018-04-17T22:24:19
129,651,443
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.epam.likhanau.data; import java.util.Objects; public class NearAirportSearchData { private Integer minResultList; private Long checkIn; public NearAirportSearchData() { } public Integer getMinResultList() { return minResultList; } public void setMinResultList(Integer minResultList) { this.minResultList = minResultList; } public Long getCheckIn() { return checkIn; } public void setCheckIn(Long checkIn) { this.checkIn = checkIn; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; NearAirportSearchData that = (NearAirportSearchData) o; return Objects.equals(minResultList, that.minResultList) && Objects.equals(checkIn, that.checkIn); } @Override public int hashCode() { return Objects.hash(minResultList, checkIn); } @Override public String toString() { return "NearAirportSearchData{" + "minResultList=" + minResultList + ", checkIn=" + checkIn + '}'; } }
UTF-8
Java
1,193
java
NearAirportSearchData.java
Java
[]
null
[]
package com.epam.likhanau.data; import java.util.Objects; public class NearAirportSearchData { private Integer minResultList; private Long checkIn; public NearAirportSearchData() { } public Integer getMinResultList() { return minResultList; } public void setMinResultList(Integer minResultList) { this.minResultList = minResultList; } public Long getCheckIn() { return checkIn; } public void setCheckIn(Long checkIn) { this.checkIn = checkIn; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; NearAirportSearchData that = (NearAirportSearchData) o; return Objects.equals(minResultList, that.minResultList) && Objects.equals(checkIn, that.checkIn); } @Override public int hashCode() { return Objects.hash(minResultList, checkIn); } @Override public String toString() { return "NearAirportSearchData{" + "minResultList=" + minResultList + ", checkIn=" + checkIn + '}'; } }
1,193
0.609388
0.609388
50
22.860001
20.489031
67
false
false
0
0
0
0
0
0
0.4
false
false
9
2c0c005c3e3f48d384cfac0fa676e53b8360bc36
25,761,213,890,460
b9aec0a298087c92faca8d56bf541003c31da722
/src/main/java/com/wenzhan/zwz/time/domain/repository/TodoItemRepository.java
82673b595f90985eca2b6187be9307b7460ad362
[]
no_license
zhengwenzhan/todoList
https://github.com/zhengwenzhan/todoList
f38bcdac45441f5b27ceea21dc6aa64ce275fcee
27f31e35144fead35e0a8c79d3538c6c225e02ba
refs/heads/master
2022-06-30T00:40:31.699000
2019-08-27T12:44:25
2019-08-27T12:44:25
203,482,386
0
0
null
false
2022-05-20T21:07:07
2019-08-21T01:31:57
2019-08-27T12:44:37
2022-05-20T21:07:06
75
0
0
1
Java
false
false
package com.wenzhan.zwz.time.domain.repository; import com.wenzhan.zwz.time.domain.model.TodoItem; import java.util.List; /** * Created by zhengwenzhan on 2019-08-13 */ public interface TodoItemRepository { /** * 添加保存事项 * * @param todoItem */ public void save(TodoItem todoItem); /** * 获取某个事项id * * @param id * @return */ public TodoItem get(Integer id); /** * 根据openid查询所有事项 * * @param openId * @return */ public List<TodoItem> query(String openId); /** * 更新事项 * * @param todoItem */ public void update(TodoItem todoItem); /** * 删除事项 * * @param id */ public void delete(Integer id); }
UTF-8
Java
801
java
TodoItemRepository.java
Java
[ { "context": "doItem;\n\nimport java.util.List;\n\n/**\n * Created by zhengwenzhan on 2019-08-13\n */\npublic interface TodoItemReposi", "end": 155, "score": 0.9997199773788452, "start": 143, "tag": "USERNAME", "value": "zhengwenzhan" } ]
null
[]
package com.wenzhan.zwz.time.domain.repository; import com.wenzhan.zwz.time.domain.model.TodoItem; import java.util.List; /** * Created by zhengwenzhan on 2019-08-13 */ public interface TodoItemRepository { /** * 添加保存事项 * * @param todoItem */ public void save(TodoItem todoItem); /** * 获取某个事项id * * @param id * @return */ public TodoItem get(Integer id); /** * 根据openid查询所有事项 * * @param openId * @return */ public List<TodoItem> query(String openId); /** * 更新事项 * * @param todoItem */ public void update(TodoItem todoItem); /** * 删除事项 * * @param id */ public void delete(Integer id); }
801
0.551678
0.54094
47
14.851064
14.533862
50
false
false
0
0
0
0
0
0
0.170213
false
false
9
877e8bc069917efde7065036406a2922a2977090
34,754,875,403,605
2ac35f6a5b6d3931d0f843edd7471b3be48e3860
/lectures/bytes/BytesToInt.java
3d017976c50251e9652464a1f6022b659f95b434
[]
no_license
jrrpanix/CMP-129
https://github.com/jrrpanix/CMP-129
252f775f58aa0644f9813aa9f0db6bb05bc145fa
e881ff84a3d46c175f2dcb1e04c6230fcea1b669
refs/heads/master
2020-12-13T18:44:39.795000
2019-05-24T11:54:27
2019-05-24T11:54:27
28,812,911
3
3
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.nio.ByteBuffer; import java.nio.ByteOrder; public class BytesToInt { public static String asString( byte [] ba) { if ( ba.length == 0) return ""; String s = Integer.toString(ba[0]); for( int i =1; i < ba.length; i++) { s += String.format(" %3d", ba[i]); } return s; } /* * Get the Bytes that Make up and Integer * */ public static byte [] getBytes( int value , ByteOrder order) { byte [] ba = new byte[Integer.BYTES]; ByteBuffer bb = ByteBuffer.wrap(ba); bb.order(order); bb.putInt(value); return ba; } /* * Convert an array of Bytes to an Integer * */ public static int getInt( byte [] ba, ByteOrder order) { ByteBuffer bb = ByteBuffer.wrap(ba); bb.order(order); return bb.getInt(); } public static byte [] ba( int ...bytes ){ byte [] b = new byte[bytes.length]; for( int i =0; i < bytes.length;i++)b[i]=(byte)bytes[i]; return b; } public static void clear(byte [] bytes) { for( int i= 0; i < bytes.length ; i++) bytes[i]=0; } public static void set( byte [] ba , String bins) { clear(ba); for( int i =0; i < bins.length();i++) { ba[i] = (byte)(bins.charAt(i) == '0' ? 0 : 1); } } public static void print( byte [] ba) { String bstr = asString(ba); int valBE = getInt( ba , ByteOrder.BIG_ENDIAN); int valLE = getInt( ba , ByteOrder.LITTLE_ENDIAN); System.out.format("%14s %14d %14d\n", bstr, valBE,valLE); } public static void example0(){ print( ba(0,0,0,1)); print( ba(0,1,1,0)); print( ba(1,0,0,1)); print( ba(0,1,1,1)); print( ba(1,1,1,1)); print( ba(127,0,0,0)); print( ba(0,0,0,-127)); print( ba(0,0,0,-1)); print( ba(-128,0,0,0)); } public static void example1(){ for( byte b = -128 ; b < 127; b++) { print(ba(0,0,0,b)); } } public static void example(){ for( int i = -255 ; i <= 255 ; i++) { byte [] ba = getBytes(i,ByteOrder.BIG_ENDIAN); String bstr = asString(ba); int vBE = getInt(ba,ByteOrder.BIG_ENDIAN); int vLE = getInt(ba,ByteOrder.LITTLE_ENDIAN); System.out.format("%14d %14s %14d %14d\n", i,bstr,vBE,vLE); } } public static void main(String [] args ) { example(); } }
UTF-8
Java
2,277
java
BytesToInt.java
Java
[]
null
[]
import java.nio.ByteBuffer; import java.nio.ByteOrder; public class BytesToInt { public static String asString( byte [] ba) { if ( ba.length == 0) return ""; String s = Integer.toString(ba[0]); for( int i =1; i < ba.length; i++) { s += String.format(" %3d", ba[i]); } return s; } /* * Get the Bytes that Make up and Integer * */ public static byte [] getBytes( int value , ByteOrder order) { byte [] ba = new byte[Integer.BYTES]; ByteBuffer bb = ByteBuffer.wrap(ba); bb.order(order); bb.putInt(value); return ba; } /* * Convert an array of Bytes to an Integer * */ public static int getInt( byte [] ba, ByteOrder order) { ByteBuffer bb = ByteBuffer.wrap(ba); bb.order(order); return bb.getInt(); } public static byte [] ba( int ...bytes ){ byte [] b = new byte[bytes.length]; for( int i =0; i < bytes.length;i++)b[i]=(byte)bytes[i]; return b; } public static void clear(byte [] bytes) { for( int i= 0; i < bytes.length ; i++) bytes[i]=0; } public static void set( byte [] ba , String bins) { clear(ba); for( int i =0; i < bins.length();i++) { ba[i] = (byte)(bins.charAt(i) == '0' ? 0 : 1); } } public static void print( byte [] ba) { String bstr = asString(ba); int valBE = getInt( ba , ByteOrder.BIG_ENDIAN); int valLE = getInt( ba , ByteOrder.LITTLE_ENDIAN); System.out.format("%14s %14d %14d\n", bstr, valBE,valLE); } public static void example0(){ print( ba(0,0,0,1)); print( ba(0,1,1,0)); print( ba(1,0,0,1)); print( ba(0,1,1,1)); print( ba(1,1,1,1)); print( ba(127,0,0,0)); print( ba(0,0,0,-127)); print( ba(0,0,0,-1)); print( ba(-128,0,0,0)); } public static void example1(){ for( byte b = -128 ; b < 127; b++) { print(ba(0,0,0,b)); } } public static void example(){ for( int i = -255 ; i <= 255 ; i++) { byte [] ba = getBytes(i,ByteOrder.BIG_ENDIAN); String bstr = asString(ba); int vBE = getInt(ba,ByteOrder.BIG_ENDIAN); int vLE = getInt(ba,ByteOrder.LITTLE_ENDIAN); System.out.format("%14d %14s %14d %14d\n", i,bstr,vBE,vLE); } } public static void main(String [] args ) { example(); } }
2,277
0.559508
0.522617
96
22.697916
18.852564
66
false
false
0
0
0
0
0
0
1.520833
false
false
9
45adf191e1c7a712d289f26fe578706ae36ada3b
38,113,539,801,810
4d685440980b40d39a9d11637c9360ada7fca9c3
/app/src/main/java/cn/edu/hqu/cst/myapplication_one/Main4Activity.java
236fcf9062c1d5f8002760d06c60dacd2630071f
[]
no_license
PigPigBoy/MyApplication_one
https://github.com/PigPigBoy/MyApplication_one
eee7059dadcdf560b6f42bb5497cf84e7907d461
5dc32da09277f47206a0618889e226d30f55297d
refs/heads/master
2020-03-17T03:43:28.975000
2018-05-11T04:47:11
2018-05-11T04:47:11
132,990,573
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.edu.hqu.cst.myapplication_one; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.Toast; import java.sql.Time; import java.util.Timer; import java.util.TimerTask; public class Main4Activity extends AppCompatActivity { final int n = 5; //n张图片轮播 int i = 1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main4); Button button_Main4Activity_return = (Button)findViewById(R.id.button10); button_Main4Activity_return.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); Timer PictureRotation = new Timer(); PictureRotation.schedule(new TimerTask() { @Override public void run() { if (i == 0 || i ==1){ ImageView img_above = (ImageView)findViewById(R.id.imageView1); img_above.setVisibility(View.VISIBLE); i++; } else if (i > 1 && i < n){ ImageView img_above = (ImageView)findViewById(R.id.imageView+n); ImageView img_below = (ImageView)findViewById(R.id.imageView+n-1); img_above.setVisibility(View.VISIBLE); img_below.setVisibility(View.INVISIBLE); i ++; } else { ImageView img_above = (ImageView) findViewById(R.id.imageView + n); ImageView img_below = (ImageView) findViewById(R.id.imageView + n - 1); img_above.setVisibility(View.VISIBLE); img_below.setVisibility(View.INVISIBLE); i = 1; } } },2000,0); } }
UTF-8
Java
2,075
java
Main4Activity.java
Java
[]
null
[]
package cn.edu.hqu.cst.myapplication_one; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.Toast; import java.sql.Time; import java.util.Timer; import java.util.TimerTask; public class Main4Activity extends AppCompatActivity { final int n = 5; //n张图片轮播 int i = 1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main4); Button button_Main4Activity_return = (Button)findViewById(R.id.button10); button_Main4Activity_return.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); Timer PictureRotation = new Timer(); PictureRotation.schedule(new TimerTask() { @Override public void run() { if (i == 0 || i ==1){ ImageView img_above = (ImageView)findViewById(R.id.imageView1); img_above.setVisibility(View.VISIBLE); i++; } else if (i > 1 && i < n){ ImageView img_above = (ImageView)findViewById(R.id.imageView+n); ImageView img_below = (ImageView)findViewById(R.id.imageView+n-1); img_above.setVisibility(View.VISIBLE); img_below.setVisibility(View.INVISIBLE); i ++; } else { ImageView img_above = (ImageView) findViewById(R.id.imageView + n); ImageView img_below = (ImageView) findViewById(R.id.imageView + n - 1); img_above.setVisibility(View.VISIBLE); img_below.setVisibility(View.INVISIBLE); i = 1; } } },2000,0); } }
2,075
0.550121
0.539952
55
36.545456
25.066326
95
false
false
0
0
0
0
0
0
0.654545
false
false
9
53bec27e85db80d69f04b599e54d30eca257af7a
32,384,053,459,816
efb41d0cf3d02c897fbee0fe6e6ed20f3619a16d
/fortran77/parser/TokenAST.java
b8c06ae0cbdc38b2fc0975fb3c68bc364c3aad7e
[ "BSD-3-Clause" ]
permissive
dacmot/RevEngTools
https://github.com/dacmot/RevEngTools
2ada023184bfa335d9655bd669ff4edbfdc33500
2407c5d866e9fef5cc5af466e23332bf8ddc32ef
refs/heads/master
2021-01-22T14:55:15.519000
2017-08-18T14:42:47
2017-08-18T14:42:47
100,718,205
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Created on 20-Sep-2005 */ package fortran77.parser; import antlr.BaseAST; import antlr.Token; import antlr.CommonToken; import antlr.collections.AST; /** * <p>This class is used to replaced the ANTLR class CommonAST used by * default when building trees. It provides an implementation to the abstract * class BaseAST. * </p> * * <p>Its secret, just like CommonAST, is how a tree node is constructed from * a lexical token, and how the token information is stored. * </p> * * @author Olivier Dragon <dragonoe@mcmaster.ca> */ public class TokenAST extends BaseAST implements Cloneable { protected Token myToken; /* * The constructors must ensure that myToken is never null. */ public TokenAST() { myToken = new CommonToken(); } public TokenAST(Token t) { this(); initialize(t); } public TokenAST(TokenAST node) { this(); initialize(node); } public void initialize(Token t) { // for safety, ensure that myToken is never null. if (t != null) { myToken.setText(t.getText()); myToken.setType(t.getType()); myToken.setColumn(t.getColumn()); myToken.setLine(t.getLine()); } } public void initialize(int type, String txt) { myToken.setType(type); myToken.setText(txt); } public void initialize(AST node) { myToken.setText(node.getText()); myToken.setType(node.getType()); myToken.setColumn(node.getColumn()); myToken.setLine(node.getLine()); } public void initialize(TokenAST node) { initialize((AST) node); myToken.setFilename(node.getFilename()); } public void setText(String txt) { myToken.setText(txt); } public String getText() { return myToken.getText(); } public void setType(int type) { myToken.setType(type); } public int getType() { return myToken.getType(); } public String getFilename() { return myToken.getFilename(); } public int getLine() { return myToken.getLine(); } public void setLine(int line) { myToken.setLine(line); } public int getColumn() { return myToken.getColumn(); } public void setColumn(int column) { myToken.setColumn(column); } public TokenAST clone() { return new TokenAST(this); } }
UTF-8
Java
2,616
java
TokenAST.java
Java
[ { "context": "oken information is stored.\n * </p>\n * \n * @author Olivier Dragon <dragonoe@mcmaster.ca>\n */\npublic class TokenAST ", "end": 519, "score": 0.9998695254325867, "start": 505, "tag": "NAME", "value": "Olivier Dragon" }, { "context": "is stored.\n * </p>\n * \n * @auth...
null
[]
/* * Created on 20-Sep-2005 */ package fortran77.parser; import antlr.BaseAST; import antlr.Token; import antlr.CommonToken; import antlr.collections.AST; /** * <p>This class is used to replaced the ANTLR class CommonAST used by * default when building trees. It provides an implementation to the abstract * class BaseAST. * </p> * * <p>Its secret, just like CommonAST, is how a tree node is constructed from * a lexical token, and how the token information is stored. * </p> * * @author <NAME> <<EMAIL>> */ public class TokenAST extends BaseAST implements Cloneable { protected Token myToken; /* * The constructors must ensure that myToken is never null. */ public TokenAST() { myToken = new CommonToken(); } public TokenAST(Token t) { this(); initialize(t); } public TokenAST(TokenAST node) { this(); initialize(node); } public void initialize(Token t) { // for safety, ensure that myToken is never null. if (t != null) { myToken.setText(t.getText()); myToken.setType(t.getType()); myToken.setColumn(t.getColumn()); myToken.setLine(t.getLine()); } } public void initialize(int type, String txt) { myToken.setType(type); myToken.setText(txt); } public void initialize(AST node) { myToken.setText(node.getText()); myToken.setType(node.getType()); myToken.setColumn(node.getColumn()); myToken.setLine(node.getLine()); } public void initialize(TokenAST node) { initialize((AST) node); myToken.setFilename(node.getFilename()); } public void setText(String txt) { myToken.setText(txt); } public String getText() { return myToken.getText(); } public void setType(int type) { myToken.setType(type); } public int getType() { return myToken.getType(); } public String getFilename() { return myToken.getFilename(); } public int getLine() { return myToken.getLine(); } public void setLine(int line) { myToken.setLine(line); } public int getColumn() { return myToken.getColumn(); } public void setColumn(int column) { myToken.setColumn(column); } public TokenAST clone() { return new TokenAST(this); } }
2,595
0.568807
0.565749
129
19.27907
18.144543
77
false
false
0
0
0
0
0
0
0.294574
false
false
9
4d64ef9c15621e19b2e3f0ec09921db2b650caed
4,973,572,194,033
2abd5f16783c17b9502bd08ca0bdd0ccae5f7fec
/json-smart/src/main/java/net/minidev/json/writer/CompessorMapper.java
4c882788c60fcc4f3bb646725e86a88f8b780918
[ "Apache-2.0" ]
permissive
netplex/json-smart-v2
https://github.com/netplex/json-smart-v2
54449dbd9e4ee1adf7b482916b66feb8ac1a8c5e
f20a32d7853db979e461bb18786ee6925d4c2763
refs/heads/master
2023-08-16T19:56:37.033000
2023-07-24T00:55:46
2023-07-24T00:55:46
20,321,688
131
75
Apache-2.0
false
2023-07-24T00:55:47
2014-05-30T08:01:55
2023-07-13T11:00:20
2023-07-24T00:55:46
627
137
63
4
Java
false
false
package net.minidev.json.writer; /* * Copyright 2011-2023 JSON-SMART 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. */ import java.io.IOException; import net.minidev.json.JSONStyle; import net.minidev.json.JSONValue; public class CompessorMapper extends JsonReaderI<CompessorMapper> { private Appendable out; private JSONStyle compression; private Boolean _isObj; private boolean needSep = false; private boolean isOpen = false; private boolean isClosed = false; // private boolean isRoot = false; private boolean isArray() { return _isObj == Boolean.FALSE; } private boolean isObject() { return _isObj == Boolean.TRUE; } private boolean isCompressor(Object obj) { return obj instanceof CompessorMapper; } public CompessorMapper(JsonReader base, Appendable out, JSONStyle compression) { this(base, out, compression, null); // isRoot = true; } public CompessorMapper(JsonReader base, Appendable out, JSONStyle compression, Boolean isObj) { super(base); this.out = out; this.compression = compression; this._isObj = isObj; // System.out.println("new CompressorMapper isObj:" + isObj); } @Override public JsonReaderI<?> startObject(String key) throws IOException { open(this); startKey(key); // System.out.println("startObject " + key); CompessorMapper r = new CompessorMapper(base, out, compression, true); open(r); return r; } @Override public JsonReaderI<?> startArray(String key) throws IOException { open(this); startKey(key); // System.out.println("startArray " + key); CompessorMapper r = new CompessorMapper(base, out, compression, false); open(r); return r; } private void startKey(String key) throws IOException { addComma(); // if (key == null) // return; if (isArray()) return; if (!compression.mustProtectKey(key)) out.append(key); else { out.append('"'); JSONValue.escape(key, out, compression); out.append('"'); } out.append(':'); } @Override public void setValue(Object current, String key, Object value) throws IOException { // System.out.println("setValue(" + key + "," + value + ")"); // if compressor => data already be written if (isCompressor(value)) { addComma(); return; } startKey(key); writeValue(value); } @Override public void addValue(Object current, Object value) throws IOException { // System.out.println("add value" + value); // if (!isCompressor(value)) addComma(); writeValue(value); } private void addComma() throws IOException { if (needSep) { out.append(','); // needSep = false; } else { needSep = true; } } private void writeValue(Object value) throws IOException { if (value instanceof String) { compression.writeString(out, (String) value); // // if (!compression.mustProtectValue((String) value)) // out.append((String) value); // else { // out.append('"'); // JSONValue.escape((String) value, out, compression); // out.append('"'); // } // needSep = true; } else { if (isCompressor(value)) { close(value); // needSep = true; } else { JSONValue.writeJSONString(value, out, compression); // needSep = true; } } } @Override public Object createObject() { // System.out.println("createObject"); this._isObj = true; try { open(this); } catch (Exception e) { } // if (this.isUnknow() && isRoot) { // && isRoot // this._isObj = true; // try { // out.append('{'); // 1 // } catch (Exception e) { // } // } return this; } @Override public Object createArray() { // System.out.println("createArray"); this._isObj = false; try { open(this); } catch (Exception e) { } return this; } public CompessorMapper convert(Object current) { try { close(current); return this; } catch (Exception e) { return this; } } private void close(Object obj) throws IOException { if (!isCompressor(obj)) return; if (((CompessorMapper) obj).isClosed) return; ((CompessorMapper) obj).isClosed = true; if (((CompessorMapper) obj).isObject()) { // System.out.println("convert }"); out.append('}'); needSep = true; } else if (((CompessorMapper) obj).isArray()) { // System.out.println("convert ]"); out.append(']'); needSep = true; } } private void open(Object obj) throws IOException { if (!isCompressor(obj)) return; if (((CompessorMapper) obj).isOpen) return; ((CompessorMapper) obj).isOpen = true; if (((CompessorMapper) obj).isObject()) { // System.out.println("open {"); out.append('{'); needSep = false; } else if (((CompessorMapper) obj).isArray()) { // System.out.println("open ["); out.append('['); needSep = false; } } }
UTF-8
Java
5,227
java
CompessorMapper.java
Java
[]
null
[]
package net.minidev.json.writer; /* * Copyright 2011-2023 JSON-SMART 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. */ import java.io.IOException; import net.minidev.json.JSONStyle; import net.minidev.json.JSONValue; public class CompessorMapper extends JsonReaderI<CompessorMapper> { private Appendable out; private JSONStyle compression; private Boolean _isObj; private boolean needSep = false; private boolean isOpen = false; private boolean isClosed = false; // private boolean isRoot = false; private boolean isArray() { return _isObj == Boolean.FALSE; } private boolean isObject() { return _isObj == Boolean.TRUE; } private boolean isCompressor(Object obj) { return obj instanceof CompessorMapper; } public CompessorMapper(JsonReader base, Appendable out, JSONStyle compression) { this(base, out, compression, null); // isRoot = true; } public CompessorMapper(JsonReader base, Appendable out, JSONStyle compression, Boolean isObj) { super(base); this.out = out; this.compression = compression; this._isObj = isObj; // System.out.println("new CompressorMapper isObj:" + isObj); } @Override public JsonReaderI<?> startObject(String key) throws IOException { open(this); startKey(key); // System.out.println("startObject " + key); CompessorMapper r = new CompessorMapper(base, out, compression, true); open(r); return r; } @Override public JsonReaderI<?> startArray(String key) throws IOException { open(this); startKey(key); // System.out.println("startArray " + key); CompessorMapper r = new CompessorMapper(base, out, compression, false); open(r); return r; } private void startKey(String key) throws IOException { addComma(); // if (key == null) // return; if (isArray()) return; if (!compression.mustProtectKey(key)) out.append(key); else { out.append('"'); JSONValue.escape(key, out, compression); out.append('"'); } out.append(':'); } @Override public void setValue(Object current, String key, Object value) throws IOException { // System.out.println("setValue(" + key + "," + value + ")"); // if compressor => data already be written if (isCompressor(value)) { addComma(); return; } startKey(key); writeValue(value); } @Override public void addValue(Object current, Object value) throws IOException { // System.out.println("add value" + value); // if (!isCompressor(value)) addComma(); writeValue(value); } private void addComma() throws IOException { if (needSep) { out.append(','); // needSep = false; } else { needSep = true; } } private void writeValue(Object value) throws IOException { if (value instanceof String) { compression.writeString(out, (String) value); // // if (!compression.mustProtectValue((String) value)) // out.append((String) value); // else { // out.append('"'); // JSONValue.escape((String) value, out, compression); // out.append('"'); // } // needSep = true; } else { if (isCompressor(value)) { close(value); // needSep = true; } else { JSONValue.writeJSONString(value, out, compression); // needSep = true; } } } @Override public Object createObject() { // System.out.println("createObject"); this._isObj = true; try { open(this); } catch (Exception e) { } // if (this.isUnknow() && isRoot) { // && isRoot // this._isObj = true; // try { // out.append('{'); // 1 // } catch (Exception e) { // } // } return this; } @Override public Object createArray() { // System.out.println("createArray"); this._isObj = false; try { open(this); } catch (Exception e) { } return this; } public CompessorMapper convert(Object current) { try { close(current); return this; } catch (Exception e) { return this; } } private void close(Object obj) throws IOException { if (!isCompressor(obj)) return; if (((CompessorMapper) obj).isClosed) return; ((CompessorMapper) obj).isClosed = true; if (((CompessorMapper) obj).isObject()) { // System.out.println("convert }"); out.append('}'); needSep = true; } else if (((CompessorMapper) obj).isArray()) { // System.out.println("convert ]"); out.append(']'); needSep = true; } } private void open(Object obj) throws IOException { if (!isCompressor(obj)) return; if (((CompessorMapper) obj).isOpen) return; ((CompessorMapper) obj).isOpen = true; if (((CompessorMapper) obj).isObject()) { // System.out.println("open {"); out.append('{'); needSep = false; } else if (((CompessorMapper) obj).isArray()) { // System.out.println("open ["); out.append('['); needSep = false; } } }
5,227
0.660034
0.657547
218
22.977064
20.94257
96
false
false
0
0
0
0
0
0
2.201835
false
false
9
a76331a4a755e3c9323b2d2bf670656c940c71ac
4,973,572,195,668
e14905e1a8f62800ab78e015403b39102db5cc47
/Patterns/src/de/steve72/java/patterns/abstraktefabrik/TabellenClient.java
4d9a0c725ee648c93c73059dcaa85e3bc7bded65
[]
no_license
schlupp2014/java-grundlagen
https://github.com/schlupp2014/java-grundlagen
db08bd22cb1c4cef9e3bd48ba55a6d40f3dc98c3
cb0cbac45f2903bbc80b779f66a746f71ff701f9
refs/heads/master
2015-07-24T11:55:43
2014-11-04T14:54:44
2014-11-04T14:54:44
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * 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 de.steve72.java.patterns.abstraktefabrik; /** * * @author Steffen Bauer <schlupp2014@gmail.com> */ public class TabellenClient { private TableFactory factory = null; /** * Konstruktor bekommt die zu verwendende Ausgabefabrik injiziert * * @param t */ public TabellenClient(TableFactory t) { this.factory = t; } public void showData(String[][] data) { // es soll eine Tabelle ausgegeben werden, also brauchen wir die Tabelle // zum Erzeugen der Tabelle benutzen wir die abstrakten Methoden // der abstrakten Fabrik ... erst zur Laufzeit des Programms // steht fest, was es dann für eine Tabelle sein soll Table t = this.factory.createTable(); // jetzt analysieren wir die übergebenen Daten des zweidimensionalen Felds // und erzeugen aus der 1. Dimension des Felds die Zeilen, aus der 2. Dimension // die Zellen der Tabelle for (int i = 0; i < data.length; i++) { // wir erzeugen eine neue Tabellezeile Row r = this.factory.createRow(); // .. und fügen diese zur Tabelle hinzu t.addRow(r); // wir lesen die Zellen der Zeile ein for (int j = 0; j < data[i].length; j++) { // die neue Zelle mit dem Wert aus dem Datenfeld füttern Cell c = this.factory.createCell(data[i][j]); // ... und zur Zeile hinzufügen r.addCell(c); } } // die Daten sind vollständig verarbeitet worden -> die Tabelle ist fertig // und kann ausgegeben werden t.display(); } }
UTF-8
Java
1,925
java
TabellenClient.java
Java
[ { "context": "a.patterns.abstraktefabrik;\r\n\r\n/**\r\n *\r\n * @author Steffen Bauer <schlupp2014@gmail.com>\r\n */\r\npublic class Tabell", "end": 276, "score": 0.9998815655708313, "start": 263, "tag": "NAME", "value": "Steffen Bauer" }, { "context": "aktefabrik;\r\n\r\n/**\r\n *\...
null
[]
/* * 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 de.steve72.java.patterns.abstraktefabrik; /** * * @author <NAME> <<EMAIL>> */ public class TabellenClient { private TableFactory factory = null; /** * Konstruktor bekommt die zu verwendende Ausgabefabrik injiziert * * @param t */ public TabellenClient(TableFactory t) { this.factory = t; } public void showData(String[][] data) { // es soll eine Tabelle ausgegeben werden, also brauchen wir die Tabelle // zum Erzeugen der Tabelle benutzen wir die abstrakten Methoden // der abstrakten Fabrik ... erst zur Laufzeit des Programms // steht fest, was es dann für eine Tabelle sein soll Table t = this.factory.createTable(); // jetzt analysieren wir die übergebenen Daten des zweidimensionalen Felds // und erzeugen aus der 1. Dimension des Felds die Zeilen, aus der 2. Dimension // die Zellen der Tabelle for (int i = 0; i < data.length; i++) { // wir erzeugen eine neue Tabellezeile Row r = this.factory.createRow(); // .. und fügen diese zur Tabelle hinzu t.addRow(r); // wir lesen die Zellen der Zeile ein for (int j = 0; j < data[i].length; j++) { // die neue Zelle mit dem Wert aus dem Datenfeld füttern Cell c = this.factory.createCell(data[i][j]); // ... und zur Zeile hinzufügen r.addCell(c); } } // die Daten sind vollständig verarbeitet worden -> die Tabelle ist fertig // und kann ausgegeben werden t.display(); } }
1,904
0.588848
0.583637
60
29.983334
28.042522
88
false
false
0
0
0
0
0
0
0.316667
false
false
9
292a4c16ae1bddab3a80f76537bd4f58736ae083
31,026,843,788,163
5e9e796b47105ff4c22385bd18394fc3cdf0b13f
/ESLRecom/app/src/main/java/com/hedspi/hoangviet/eslrecom/models/KanseiKeyword.java
fde49a68a0ac41b8db5aab0924d6750dec3b3e1d
[]
no_license
WhiteWingedSoul/GR
https://github.com/WhiteWingedSoul/GR
95ee652eedb40dbb51a5081954a946b208cd028d
2709291cfd69a8ca63ca6d45fb92bf52af0c05b2
refs/heads/master
2021-01-12T05:07:41.546000
2017-06-05T17:41:52
2017-06-05T17:41:52
77,844,972
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.hedspi.hoangviet.eslrecom.models; /** * Created by viet on 4/27/17. */ public class KanseiKeyword { private String name; private double value = 0; private int totalTimeRated; private double goodScore = 0; private int totalGoodRated = 0; private double badScore = 0; private int totalBadRated = 0; private static final int CURVE_RATE = 1; public int getTotalGoodRated() { return totalGoodRated; } public void setTotalGoodRated(int totalGoodRated) { this.totalGoodRated = totalGoodRated; } public int getTotalBadRated() { return totalBadRated; } public void setTotalBadRated(int totalBadRated) { this.totalBadRated = totalBadRated; } public String getName() { return name; } public void setName(String name) { this.name = name; } public double getValue() { return value; } public void setValue(double value) { this.value = value; } public int getTotalTimeRated() { return totalTimeRated; } public void addValue(double value){ this.value += value; totalTimeRated ++; } public void addGoodScore(double value){ this.goodScore += value; totalGoodRated ++; } public void addBadScore(double value){ this.badScore += value; totalBadRated ++; } public Double retrieveGoodScore(){ if (totalGoodRated != 0) return (goodScore/totalGoodRated)* (1/(1+CURVE_RATE*Math.exp(-totalGoodRated))); else return 0.0; } public Double retrieveBadScore(){ if (totalBadRated != 0) return (badScore/totalBadRated)* (1/(1+CURVE_RATE*Math.exp(-totalBadRated))); else return 0.0; } public Double retrieveValue(){ //TODO TESTING if (Math.abs(retrieveGoodScore()*totalGoodRated)>=Math.abs(retrieveBadScore()*totalBadRated)) return retrieveGoodScore(); else return retrieveBadScore(); // GOOD CODE // if (totalTimeRated != 0) // return (value/totalTimeRated)* (1/(1+CURVE_RATE*Math.exp(-totalTimeRated))); // else return 0.0; } public int retrieveTotalTimeRated() { return totalBadRated+totalGoodRated; } }
UTF-8
Java
2,335
java
KanseiKeyword.java
Java
[ { "context": "dspi.hoangviet.eslrecom.models;\n\n/**\n * Created by viet on 4/27/17.\n */\n\npublic class KanseiKeyword {\n ", "end": 69, "score": 0.9570314884185791, "start": 65, "tag": "USERNAME", "value": "viet" } ]
null
[]
package com.hedspi.hoangviet.eslrecom.models; /** * Created by viet on 4/27/17. */ public class KanseiKeyword { private String name; private double value = 0; private int totalTimeRated; private double goodScore = 0; private int totalGoodRated = 0; private double badScore = 0; private int totalBadRated = 0; private static final int CURVE_RATE = 1; public int getTotalGoodRated() { return totalGoodRated; } public void setTotalGoodRated(int totalGoodRated) { this.totalGoodRated = totalGoodRated; } public int getTotalBadRated() { return totalBadRated; } public void setTotalBadRated(int totalBadRated) { this.totalBadRated = totalBadRated; } public String getName() { return name; } public void setName(String name) { this.name = name; } public double getValue() { return value; } public void setValue(double value) { this.value = value; } public int getTotalTimeRated() { return totalTimeRated; } public void addValue(double value){ this.value += value; totalTimeRated ++; } public void addGoodScore(double value){ this.goodScore += value; totalGoodRated ++; } public void addBadScore(double value){ this.badScore += value; totalBadRated ++; } public Double retrieveGoodScore(){ if (totalGoodRated != 0) return (goodScore/totalGoodRated)* (1/(1+CURVE_RATE*Math.exp(-totalGoodRated))); else return 0.0; } public Double retrieveBadScore(){ if (totalBadRated != 0) return (badScore/totalBadRated)* (1/(1+CURVE_RATE*Math.exp(-totalBadRated))); else return 0.0; } public Double retrieveValue(){ //TODO TESTING if (Math.abs(retrieveGoodScore()*totalGoodRated)>=Math.abs(retrieveBadScore()*totalBadRated)) return retrieveGoodScore(); else return retrieveBadScore(); // GOOD CODE // if (totalTimeRated != 0) // return (value/totalTimeRated)* (1/(1+CURVE_RATE*Math.exp(-totalTimeRated))); // else return 0.0; } public int retrieveTotalTimeRated() { return totalBadRated+totalGoodRated; } }
2,335
0.61242
0.601285
101
22.118813
21.750742
101
false
false
0
0
0
0
0
0
0.326733
false
false
9
4571cc5c0e55b388c7328a22351638effc5dc3bd
20,512,763,820,422
393390e67eb3473bbe62396322b45413c9f2e85e
/src/main/java/com/mofangyouxuan/model/Collection.java
4e30ccbd57bceff41b7d2b1ced995c3de71ba7b7
[]
no_license
jeezhau/mfyx-server
https://github.com/jeezhau/mfyx-server
1551b0ba498d72e96eabfe7ce33461666091bfc1
ca3179b4bc75dc661d0502301ac65c0039d8918f
refs/heads/master
2018-10-19T11:38:33.571000
2018-08-17T14:07:44
2018-08-17T14:07:44
130,084,367
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.mofangyouxuan.model; import java.text.SimpleDateFormat; import java.util.Date; import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; public class Collection { @NotNull(message=" 用户ID:不可为空!") private Integer userId; @NotNull(message=" 收藏类型:不可为空!") @Pattern(regexp="[12]",message=" 收藏类型:取值只可为【1-商家,2-商品】!") private String collType; @NotNull(message=" 收藏目标ID:不可为空!") private Integer relId; private Date createTime; //便于显示的商品信息 private Integer goodsVipId; private Integer goodsPartnerId; private String goodsMainImg; private String goodsName; private String partnerIntroduce; private String partnerBusiName; public Integer getUserId() { return userId; } public void setUserId(Integer userId) { this.userId = userId; } public String getCollType() { return collType; } public void setCollType(String collType) { this.collType = collType == null ? null : collType.trim(); } public Integer getRelId() { return relId; } public void setRelId(Integer relId) { this.relId = relId; } public String getCreateTime() { if(this.createTime == null) { return null; } return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(createTime); } public void setCreateTime(Date createTime) { this.createTime = createTime; } public Integer getGoodsVipId() { return goodsVipId; } public void setGoodsVipId(Integer goodsVipId) { this.goodsVipId = goodsVipId; } public Integer getGoodsPartnerId() { return goodsPartnerId; } public void setGoodsPartnerId(Integer goodsPartnerId) { this.goodsPartnerId = goodsPartnerId; } public String getGoodsMainImg() { return goodsMainImg; } public void setGoodsMainImg(String goodsMainImg) { this.goodsMainImg = goodsMainImg; } public String getGoodsName() { return goodsName; } public void setGoodsName(String goodsName) { this.goodsName = goodsName; } public String getPartnerIntroduce() { return partnerIntroduce; } public void setPartnerIntroduce(String partnerIntroduce) { this.partnerIntroduce = partnerIntroduce; } public String getPartnerBusiName() { return partnerBusiName; } public void setPartnerBusiName(String partnerBusiName) { this.partnerBusiName = partnerBusiName; } }
UTF-8
Java
2,558
java
Collection.java
Java
[]
null
[]
package com.mofangyouxuan.model; import java.text.SimpleDateFormat; import java.util.Date; import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; public class Collection { @NotNull(message=" 用户ID:不可为空!") private Integer userId; @NotNull(message=" 收藏类型:不可为空!") @Pattern(regexp="[12]",message=" 收藏类型:取值只可为【1-商家,2-商品】!") private String collType; @NotNull(message=" 收藏目标ID:不可为空!") private Integer relId; private Date createTime; //便于显示的商品信息 private Integer goodsVipId; private Integer goodsPartnerId; private String goodsMainImg; private String goodsName; private String partnerIntroduce; private String partnerBusiName; public Integer getUserId() { return userId; } public void setUserId(Integer userId) { this.userId = userId; } public String getCollType() { return collType; } public void setCollType(String collType) { this.collType = collType == null ? null : collType.trim(); } public Integer getRelId() { return relId; } public void setRelId(Integer relId) { this.relId = relId; } public String getCreateTime() { if(this.createTime == null) { return null; } return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(createTime); } public void setCreateTime(Date createTime) { this.createTime = createTime; } public Integer getGoodsVipId() { return goodsVipId; } public void setGoodsVipId(Integer goodsVipId) { this.goodsVipId = goodsVipId; } public Integer getGoodsPartnerId() { return goodsPartnerId; } public void setGoodsPartnerId(Integer goodsPartnerId) { this.goodsPartnerId = goodsPartnerId; } public String getGoodsMainImg() { return goodsMainImg; } public void setGoodsMainImg(String goodsMainImg) { this.goodsMainImg = goodsMainImg; } public String getGoodsName() { return goodsName; } public void setGoodsName(String goodsName) { this.goodsName = goodsName; } public String getPartnerIntroduce() { return partnerIntroduce; } public void setPartnerIntroduce(String partnerIntroduce) { this.partnerIntroduce = partnerIntroduce; } public String getPartnerBusiName() { return partnerBusiName; } public void setPartnerBusiName(String partnerBusiName) { this.partnerBusiName = partnerBusiName; } }
2,558
0.690768
0.689134
120
19.408333
18.887604
78
false
false
0
0
0
0
0
0
0.825
false
false
9
41ec7c104196af8affc674c1e7ebb169d11103fa
23,029,614,647,828
f32132fcbdb7a87f569e93d99236be5431f7d48d
/src/main/java/com/gzjy/quotation/service/impl/QuotationServiceImpl.java
a196361ef898542eb5348f84f5292460bcc7f663
[]
no_license
xue418397281/gzjy
https://github.com/xue418397281/gzjy
b24dcba9d7cb2dc0ab5bf43aa3a4b0f77ada9e47
ce55018e45825902f0ac62b46f1d5fd26c35f571
refs/heads/master
2019-01-29T16:03:25.747000
2018-11-07T10:22:10
2018-11-07T10:22:10
98,526,302
0
2
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.gzjy.quotation.service.impl; import com.gzjy.common.util.UUID; import com.gzjy.quotation.mapper.QuotationMapper; import com.gzjy.quotation.mapper.QuotationProjectMapper; import com.gzjy.quotation.modle.Quotation; import com.gzjy.quotation.modle.QuotationProject; import com.gzjy.quotation.service.QuotationService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; /* * ---------------------------------------------------------------------- * Copyright © 2014-2018 China Mobile (SuZhou) Software Technology Co.,Ltd. * * The programs can not be copied and/or distributed without the express * permission of China Mobile (SuZhou) Software Technology Co.,Ltd. * * @program: gzjy-app * Package name: com.gzjy.quotation.service.impl * @description: * * @author: wuyongfa@cmss.chinamobile.com * @create: 2018/11/7 4:19 PM * * ---------------------------------------------------------------------- */ @Service @Transactional public class QuotationServiceImpl implements QuotationService { private static final Logger LOGGER = LoggerFactory.getLogger(QuotationServiceImpl.class); @Autowired private QuotationMapper quotationMapper; @Autowired private QuotationProjectMapper quotationProjectMapper; @Override public int addQuotation(Quotation quotation) { String quotationId = UUID.random(); quotation.setId(quotationId); int num = quotationMapper.insertSelective(quotation); List<QuotationProject> projects = quotation.getQuotationProjects(); for (QuotationProject quotationProject : projects) { quotationProject.setId(UUID.random()); quotationProject.setQuotationId(quotationId); } quotationProjectMapper.insertList(projects); return num; } @Override public Quotation selectById(String id) { Quotation quotation = quotationMapper.selectById(id); if (quotation != null) { List<QuotationProject> projects = quotationProjectMapper.selectByQuotationId(id); quotation.setQuotationProjects(projects); } return quotation; } @Override public int deleteById(String id) { quotationProjectMapper.deleteByQuotationId(id); quotationMapper.deleteById(id); return 0; } }
UTF-8
Java
2,523
java
QuotationServiceImpl.java
Java
[ { "context": "ation.service.impl\n * @description:\n *\n * @author: wuyongfa@cmss.chinamobile.com\n * @create: 2018/11/7 4:19 PM\n *\n * -------------", "end": 1017, "score": 0.9999254941940308, "start": 988, "tag": "EMAIL", "value": "wuyongfa@cmss.chinamobile.com" } ]
null
[]
package com.gzjy.quotation.service.impl; import com.gzjy.common.util.UUID; import com.gzjy.quotation.mapper.QuotationMapper; import com.gzjy.quotation.mapper.QuotationProjectMapper; import com.gzjy.quotation.modle.Quotation; import com.gzjy.quotation.modle.QuotationProject; import com.gzjy.quotation.service.QuotationService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; /* * ---------------------------------------------------------------------- * Copyright © 2014-2018 China Mobile (SuZhou) Software Technology Co.,Ltd. * * The programs can not be copied and/or distributed without the express * permission of China Mobile (SuZhou) Software Technology Co.,Ltd. * * @program: gzjy-app * Package name: com.gzjy.quotation.service.impl * @description: * * @author: <EMAIL> * @create: 2018/11/7 4:19 PM * * ---------------------------------------------------------------------- */ @Service @Transactional public class QuotationServiceImpl implements QuotationService { private static final Logger LOGGER = LoggerFactory.getLogger(QuotationServiceImpl.class); @Autowired private QuotationMapper quotationMapper; @Autowired private QuotationProjectMapper quotationProjectMapper; @Override public int addQuotation(Quotation quotation) { String quotationId = UUID.random(); quotation.setId(quotationId); int num = quotationMapper.insertSelective(quotation); List<QuotationProject> projects = quotation.getQuotationProjects(); for (QuotationProject quotationProject : projects) { quotationProject.setId(UUID.random()); quotationProject.setQuotationId(quotationId); } quotationProjectMapper.insertList(projects); return num; } @Override public Quotation selectById(String id) { Quotation quotation = quotationMapper.selectById(id); if (quotation != null) { List<QuotationProject> projects = quotationProjectMapper.selectByQuotationId(id); quotation.setQuotationProjects(projects); } return quotation; } @Override public int deleteById(String id) { quotationProjectMapper.deleteByQuotationId(id); quotationMapper.deleteById(id); return 0; } }
2,501
0.689136
0.680809
83
29.385542
26.603212
93
false
false
0
0
0
0
0
0
0.39759
false
false
9
df4b680aa64739edd1cf0b7c1d935afd4e332731
27,719,718,942,253
bfa75c0af35d2ff32142b62cae6f827b0bb02884
/src/CreateMultipleChoiceGUI.java
16ab7f9976ce01902666d32dd8e9b9ba9f4e3922
[ "MIT" ]
permissive
pijusk/QGS
https://github.com/pijusk/QGS
852ba3e57456cfa12eb1f7a673495102668c9a53
5d24c0e72aa9a6969d85cd2715afa83c74b80c08
refs/heads/master
2018-01-07T17:45:57.547000
2015-07-12T21:43:05
2015-07-12T21:43:05
38,978,154
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.awt.Color; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.WindowEvent; import javax.swing.ButtonGroup; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.SwingConstants; import javax.swing.border.EmptyBorder; import java.awt.FlowLayout; import javax.swing.JTextField; import javax.swing.BoxLayout; import javax.swing.border.EtchedBorder; import javax.swing.JRadioButton; import java.awt.GridBagLayout; import java.awt.GridBagConstraints; import java.awt.Insets; import java.util.ArrayList; public class CreateMultipleChoiceGUI extends JFrame { /** * */ private static final long serialVersionUID = 17L; private JPanel contentPane; private User user; private DatabaseSingleton database; private JTextField questionField; private JLabel errQuestionRequired; private final static String questionRequired = "The question must be specified!"; private JTextField textOptionA; private JTextField textOptionB; private JTextField textOptionC; private JTextField textOptionD; private JLabel errPleaseSelectWhich; private MultipleChoiceQuestion q; JRadioButton radioButton_A; JRadioButton radioButton_B; JRadioButton radioButton_C; JRadioButton radioButton_D; public void doReturn() { this.processWindowEvent( new WindowEvent( this, WindowEvent.WINDOW_CLOSING )); EventQueue.invokeLater(new Runnable() { public void run() { try { CreateQuizGUI mm = new CreateQuizGUI( database, user ); mm.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } public void doAddQuestion() { if ( questionField.getText().isEmpty() ) { errQuestionRequired.setVisible( true ); return; } if ( radioButton_A.isSelected() || radioButton_B.isSelected() || radioButton_C.isSelected() || radioButton_D.isSelected() ) { ArrayList<String> options = new ArrayList<String>(); String answer = "4"; if ( radioButton_A.isSelected()) answer = "1"; else if ( radioButton_B.isSelected()) answer = "2"; else if ( radioButton_C.isSelected()) answer = "3"; if ( !textOptionA.getText().isEmpty() ) options.add( textOptionA.getText() ); if ( !textOptionB.getText().isEmpty() ) options.add( textOptionB.getText() ); if ( !textOptionC.getText().isEmpty() ) options.add( textOptionC.getText() ); if ( !textOptionD.getText().isEmpty() ) options.add( textOptionD.getText() ); q = new MultipleChoiceQuestion( questionField.getText(), answer, options ); this.processWindowEvent( new WindowEvent( this, WindowEvent.WINDOW_CLOSING )); EventQueue.invokeLater(new Runnable() { public void run() { try { AddQuestionGUI window = new AddQuestionGUI( database, user, q ); window.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } errPleaseSelectWhich.setVisible( true ); } /** * Create the frame. */ public CreateMultipleChoiceGUI( DatabaseSingleton db, User u ) { user = u; database = db; setTitle("Quiz Game System"); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setMinimumSize( new Dimension(450, 400)); setLocation( 100, 100 ); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JPanel panel_1 = new JPanel(); panel_1.setBounds(5, 5, 440, 30); getContentPane().add(panel_1); JLabel lblMainMenu = new JLabel("Create Multiple Choice Question"); lblMainMenu.setVerticalAlignment(SwingConstants.TOP); lblMainMenu.setHorizontalAlignment(SwingConstants.CENTER); lblMainMenu.setFont(new Font("Lucida Grande", Font.ITALIC, 17)); panel_1.add(lblMainMenu); JPanel panel_2 = new JPanel(); panel_2.setBounds(5, 35, 440, 30); contentPane.add(panel_2); JLabel lblUserLabel = new JLabel( user.getRole() + ": " + user.getName() ); lblUserLabel.setFont(new Font("Lucida Grande", Font.PLAIN, 10)); lblUserLabel.setVerticalAlignment(SwingConstants.BOTTOM); lblUserLabel.setHorizontalAlignment(SwingConstants.TRAILING); panel_2.add(lblUserLabel); /* * */ JPanel panel_3 = new JPanel(); panel_3.setBounds(5, 65, 440, 30); contentPane.add(panel_3); panel_3.setLayout(new BoxLayout(panel_3, BoxLayout.X_AXIS)); JLabel lblQuestion = new JLabel("Question:"); lblQuestion.setHorizontalAlignment(SwingConstants.LEFT); panel_3.add(lblQuestion); JPanel panel_3A = new JPanel(); FlowLayout flowLayout_1 = (FlowLayout) panel_3A.getLayout(); flowLayout_1.setAlignment(FlowLayout.RIGHT); panel_3.add(panel_3A); errQuestionRequired = new JLabel( questionRequired ); errQuestionRequired.setVerticalAlignment(SwingConstants.TOP); errQuestionRequired.setHorizontalAlignment(SwingConstants.RIGHT); errQuestionRequired.setLabelFor(errQuestionRequired); errQuestionRequired.setFont(new Font("Lucida Grande", Font.ITALIC, 12)); errQuestionRequired.setForeground(Color.RED); errQuestionRequired.setVisible( false ); panel_3A.add(errQuestionRequired); JPanel panel_4 = new JPanel(); panel_4.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null)); panel_4.setBounds(5, 95, 440, 40); contentPane.add(panel_4); panel_4.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); questionField = new JTextField(); questionField.setHorizontalAlignment(SwingConstants.LEFT); questionField.setColumns(35); panel_4.add(questionField); questionField.addKeyListener(new KeyListener() { public void keyPressed(KeyEvent e) {} public void keyTyped( KeyEvent e ) { errQuestionRequired.setVisible(false); } public void keyReleased( KeyEvent e ) {} }); JPanel panel_6 = new JPanel(); panel_6.setBounds(5, 135, 440, 190); contentPane.add(panel_6); GridBagLayout gbl_panel_6 = new GridBagLayout(); gbl_panel_6.columnWidths = new int[]{0, 0, 0, 0, 0}; gbl_panel_6.rowHeights = new int[]{0, 0, 0, 0, 0, 0, 0}; gbl_panel_6.columnWeights = new double[]{0.0, 0.0, 0.0, 1.0, Double.MIN_VALUE}; gbl_panel_6.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 1.0, Double.MIN_VALUE}; panel_6.setLayout(gbl_panel_6); ButtonGroup optionButtons = new ButtonGroup(); radioButton_A = new JRadioButton(""); radioButton_A.setFocusable(false); GridBagConstraints gbc_radioButton_A = new GridBagConstraints(); gbc_radioButton_A.insets = new Insets(0, 0, 5, 5); gbc_radioButton_A.gridx = 0; gbc_radioButton_A.gridy = 1; panel_6.add(radioButton_A, gbc_radioButton_A); optionButtons.add( radioButton_A ); JLabel lblOption_A = new JLabel("A"); GridBagConstraints gbc_lblOption_A = new GridBagConstraints(); gbc_lblOption_A.insets = new Insets(0, 0, 5, 5); gbc_lblOption_A.gridx = 1; gbc_lblOption_A.gridy = 1; panel_6.add(lblOption_A, gbc_lblOption_A); textOptionA = new JTextField(); GridBagConstraints gbc_textOptionA = new GridBagConstraints(); gbc_textOptionA.insets = new Insets(0, 0, 5, 0); gbc_textOptionA.fill = GridBagConstraints.HORIZONTAL; gbc_textOptionA.gridx = 3; gbc_textOptionA.gridy = 1; panel_6.add(textOptionA, gbc_textOptionA); textOptionA.setColumns(10); radioButton_B = new JRadioButton(""); radioButton_B.setFocusable(false); GridBagConstraints gbc_radioButton_B = new GridBagConstraints(); gbc_radioButton_B.insets = new Insets(0, 0, 5, 5); gbc_radioButton_B.gridx = 0; gbc_radioButton_B.gridy = 2; panel_6.add(radioButton_B, gbc_radioButton_B); optionButtons.add( radioButton_B ); JLabel lblOption_B = new JLabel("B"); GridBagConstraints gbc_lblOption_B = new GridBagConstraints(); gbc_lblOption_B.insets = new Insets(0, 0, 5, 5); gbc_lblOption_B.gridx = 1; gbc_lblOption_B.gridy = 2; panel_6.add(lblOption_B, gbc_lblOption_B); textOptionB = new JTextField(); GridBagConstraints gbc_textOptionB = new GridBagConstraints(); gbc_textOptionB.insets = new Insets(0, 0, 5, 0); gbc_textOptionB.fill = GridBagConstraints.HORIZONTAL; gbc_textOptionB.gridx = 3; gbc_textOptionB.gridy = 2; panel_6.add(textOptionB, gbc_textOptionB); textOptionB.setColumns(10); radioButton_C = new JRadioButton(""); radioButton_C.setFocusable(false); GridBagConstraints gbc_radioButton_C = new GridBagConstraints(); gbc_radioButton_C.insets = new Insets(0, 0, 5, 5); gbc_radioButton_C.gridx = 0; gbc_radioButton_C.gridy = 3; panel_6.add(radioButton_C, gbc_radioButton_C); optionButtons.add( radioButton_C ); JLabel lblOption_C = new JLabel("C"); GridBagConstraints gbc_lblOption_C = new GridBagConstraints(); gbc_lblOption_C.insets = new Insets(0, 0, 5, 5); gbc_lblOption_C.gridx = 1; gbc_lblOption_C.gridy = 3; panel_6.add(lblOption_C, gbc_lblOption_C); textOptionC = new JTextField(); GridBagConstraints gbc_textOptionC = new GridBagConstraints(); gbc_textOptionC.insets = new Insets(0, 0, 5, 0); gbc_textOptionC.fill = GridBagConstraints.HORIZONTAL; gbc_textOptionC.gridx = 3; gbc_textOptionC.gridy = 3; panel_6.add(textOptionC, gbc_textOptionC); textOptionC.setColumns(10); radioButton_D = new JRadioButton(""); radioButton_D.setFocusable(false); GridBagConstraints gbc_radioButton_D = new GridBagConstraints(); gbc_radioButton_D.insets = new Insets(0, 0, 5, 5); gbc_radioButton_D.gridx = 0; gbc_radioButton_D.gridy = 4; panel_6.add(radioButton_D, gbc_radioButton_D); optionButtons.add( radioButton_D ); JLabel lblOption_D = new JLabel("D"); GridBagConstraints gbc_lblOption_D = new GridBagConstraints(); gbc_lblOption_D.insets = new Insets(0, 0, 5, 5); gbc_lblOption_D.gridx = 1; gbc_lblOption_D.gridy = 4; panel_6.add(lblOption_D, gbc_lblOption_D); textOptionD = new JTextField(); GridBagConstraints gbc_textOptionD = new GridBagConstraints(); gbc_textOptionD.insets = new Insets(0, 0, 5, 0); gbc_textOptionD.fill = GridBagConstraints.HORIZONTAL; gbc_textOptionD.gridx = 3; gbc_textOptionD.gridy = 4; panel_6.add(textOptionD, gbc_textOptionD); textOptionD.setColumns(10); JPanel panel = new JPanel(); GridBagConstraints gbc_panel = new GridBagConstraints(); gbc_panel.fill = GridBagConstraints.BOTH; gbc_panel.gridx = 3; gbc_panel.gridy = 5; panel_6.add(panel, gbc_panel); errPleaseSelectWhich = new JLabel("Please select which answer is the correct one."); errPleaseSelectWhich.setVisible(false); errPleaseSelectWhich.setForeground(Color.RED); errPleaseSelectWhich.setFont(new Font("Lucida Grande", Font.ITALIC, 12)); panel.add(errPleaseSelectWhich); /* * */ JPanel panel_7 = new JPanel(); panel_7.setBounds( 5, 332, 440, 40 ); contentPane.add(panel_7); JButton btnReturn = new JButton("Cancel"); btnReturn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doReturn(); } }); btnReturn.addKeyListener(new KeyListener() { public void keyPressed(KeyEvent e) { if (e.getKeyCode()==KeyEvent.VK_ENTER) doReturn(); } public void keyTyped( KeyEvent e ) {} public void keyReleased( KeyEvent e ) {} }); JButton btnAddQuestion = new JButton("Add"); btnAddQuestion.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doAddQuestion(); } }); btnAddQuestion.addKeyListener(new KeyListener() { public void keyPressed(KeyEvent e) { if (e.getKeyCode()==KeyEvent.VK_ENTER) doAddQuestion(); } public void keyTyped( KeyEvent e ) {} public void keyReleased( KeyEvent e ) {} }); panel_7.add( btnAddQuestion ); panel_7.add( btnReturn ); pack(); } }
UTF-8
Java
12,779
java
CreateMultipleChoiceGUI.java
Java
[]
null
[]
import java.awt.Color; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.WindowEvent; import javax.swing.ButtonGroup; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.SwingConstants; import javax.swing.border.EmptyBorder; import java.awt.FlowLayout; import javax.swing.JTextField; import javax.swing.BoxLayout; import javax.swing.border.EtchedBorder; import javax.swing.JRadioButton; import java.awt.GridBagLayout; import java.awt.GridBagConstraints; import java.awt.Insets; import java.util.ArrayList; public class CreateMultipleChoiceGUI extends JFrame { /** * */ private static final long serialVersionUID = 17L; private JPanel contentPane; private User user; private DatabaseSingleton database; private JTextField questionField; private JLabel errQuestionRequired; private final static String questionRequired = "The question must be specified!"; private JTextField textOptionA; private JTextField textOptionB; private JTextField textOptionC; private JTextField textOptionD; private JLabel errPleaseSelectWhich; private MultipleChoiceQuestion q; JRadioButton radioButton_A; JRadioButton radioButton_B; JRadioButton radioButton_C; JRadioButton radioButton_D; public void doReturn() { this.processWindowEvent( new WindowEvent( this, WindowEvent.WINDOW_CLOSING )); EventQueue.invokeLater(new Runnable() { public void run() { try { CreateQuizGUI mm = new CreateQuizGUI( database, user ); mm.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } public void doAddQuestion() { if ( questionField.getText().isEmpty() ) { errQuestionRequired.setVisible( true ); return; } if ( radioButton_A.isSelected() || radioButton_B.isSelected() || radioButton_C.isSelected() || radioButton_D.isSelected() ) { ArrayList<String> options = new ArrayList<String>(); String answer = "4"; if ( radioButton_A.isSelected()) answer = "1"; else if ( radioButton_B.isSelected()) answer = "2"; else if ( radioButton_C.isSelected()) answer = "3"; if ( !textOptionA.getText().isEmpty() ) options.add( textOptionA.getText() ); if ( !textOptionB.getText().isEmpty() ) options.add( textOptionB.getText() ); if ( !textOptionC.getText().isEmpty() ) options.add( textOptionC.getText() ); if ( !textOptionD.getText().isEmpty() ) options.add( textOptionD.getText() ); q = new MultipleChoiceQuestion( questionField.getText(), answer, options ); this.processWindowEvent( new WindowEvent( this, WindowEvent.WINDOW_CLOSING )); EventQueue.invokeLater(new Runnable() { public void run() { try { AddQuestionGUI window = new AddQuestionGUI( database, user, q ); window.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } errPleaseSelectWhich.setVisible( true ); } /** * Create the frame. */ public CreateMultipleChoiceGUI( DatabaseSingleton db, User u ) { user = u; database = db; setTitle("Quiz Game System"); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setMinimumSize( new Dimension(450, 400)); setLocation( 100, 100 ); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JPanel panel_1 = new JPanel(); panel_1.setBounds(5, 5, 440, 30); getContentPane().add(panel_1); JLabel lblMainMenu = new JLabel("Create Multiple Choice Question"); lblMainMenu.setVerticalAlignment(SwingConstants.TOP); lblMainMenu.setHorizontalAlignment(SwingConstants.CENTER); lblMainMenu.setFont(new Font("Lucida Grande", Font.ITALIC, 17)); panel_1.add(lblMainMenu); JPanel panel_2 = new JPanel(); panel_2.setBounds(5, 35, 440, 30); contentPane.add(panel_2); JLabel lblUserLabel = new JLabel( user.getRole() + ": " + user.getName() ); lblUserLabel.setFont(new Font("Lucida Grande", Font.PLAIN, 10)); lblUserLabel.setVerticalAlignment(SwingConstants.BOTTOM); lblUserLabel.setHorizontalAlignment(SwingConstants.TRAILING); panel_2.add(lblUserLabel); /* * */ JPanel panel_3 = new JPanel(); panel_3.setBounds(5, 65, 440, 30); contentPane.add(panel_3); panel_3.setLayout(new BoxLayout(panel_3, BoxLayout.X_AXIS)); JLabel lblQuestion = new JLabel("Question:"); lblQuestion.setHorizontalAlignment(SwingConstants.LEFT); panel_3.add(lblQuestion); JPanel panel_3A = new JPanel(); FlowLayout flowLayout_1 = (FlowLayout) panel_3A.getLayout(); flowLayout_1.setAlignment(FlowLayout.RIGHT); panel_3.add(panel_3A); errQuestionRequired = new JLabel( questionRequired ); errQuestionRequired.setVerticalAlignment(SwingConstants.TOP); errQuestionRequired.setHorizontalAlignment(SwingConstants.RIGHT); errQuestionRequired.setLabelFor(errQuestionRequired); errQuestionRequired.setFont(new Font("Lucida Grande", Font.ITALIC, 12)); errQuestionRequired.setForeground(Color.RED); errQuestionRequired.setVisible( false ); panel_3A.add(errQuestionRequired); JPanel panel_4 = new JPanel(); panel_4.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null)); panel_4.setBounds(5, 95, 440, 40); contentPane.add(panel_4); panel_4.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); questionField = new JTextField(); questionField.setHorizontalAlignment(SwingConstants.LEFT); questionField.setColumns(35); panel_4.add(questionField); questionField.addKeyListener(new KeyListener() { public void keyPressed(KeyEvent e) {} public void keyTyped( KeyEvent e ) { errQuestionRequired.setVisible(false); } public void keyReleased( KeyEvent e ) {} }); JPanel panel_6 = new JPanel(); panel_6.setBounds(5, 135, 440, 190); contentPane.add(panel_6); GridBagLayout gbl_panel_6 = new GridBagLayout(); gbl_panel_6.columnWidths = new int[]{0, 0, 0, 0, 0}; gbl_panel_6.rowHeights = new int[]{0, 0, 0, 0, 0, 0, 0}; gbl_panel_6.columnWeights = new double[]{0.0, 0.0, 0.0, 1.0, Double.MIN_VALUE}; gbl_panel_6.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 1.0, Double.MIN_VALUE}; panel_6.setLayout(gbl_panel_6); ButtonGroup optionButtons = new ButtonGroup(); radioButton_A = new JRadioButton(""); radioButton_A.setFocusable(false); GridBagConstraints gbc_radioButton_A = new GridBagConstraints(); gbc_radioButton_A.insets = new Insets(0, 0, 5, 5); gbc_radioButton_A.gridx = 0; gbc_radioButton_A.gridy = 1; panel_6.add(radioButton_A, gbc_radioButton_A); optionButtons.add( radioButton_A ); JLabel lblOption_A = new JLabel("A"); GridBagConstraints gbc_lblOption_A = new GridBagConstraints(); gbc_lblOption_A.insets = new Insets(0, 0, 5, 5); gbc_lblOption_A.gridx = 1; gbc_lblOption_A.gridy = 1; panel_6.add(lblOption_A, gbc_lblOption_A); textOptionA = new JTextField(); GridBagConstraints gbc_textOptionA = new GridBagConstraints(); gbc_textOptionA.insets = new Insets(0, 0, 5, 0); gbc_textOptionA.fill = GridBagConstraints.HORIZONTAL; gbc_textOptionA.gridx = 3; gbc_textOptionA.gridy = 1; panel_6.add(textOptionA, gbc_textOptionA); textOptionA.setColumns(10); radioButton_B = new JRadioButton(""); radioButton_B.setFocusable(false); GridBagConstraints gbc_radioButton_B = new GridBagConstraints(); gbc_radioButton_B.insets = new Insets(0, 0, 5, 5); gbc_radioButton_B.gridx = 0; gbc_radioButton_B.gridy = 2; panel_6.add(radioButton_B, gbc_radioButton_B); optionButtons.add( radioButton_B ); JLabel lblOption_B = new JLabel("B"); GridBagConstraints gbc_lblOption_B = new GridBagConstraints(); gbc_lblOption_B.insets = new Insets(0, 0, 5, 5); gbc_lblOption_B.gridx = 1; gbc_lblOption_B.gridy = 2; panel_6.add(lblOption_B, gbc_lblOption_B); textOptionB = new JTextField(); GridBagConstraints gbc_textOptionB = new GridBagConstraints(); gbc_textOptionB.insets = new Insets(0, 0, 5, 0); gbc_textOptionB.fill = GridBagConstraints.HORIZONTAL; gbc_textOptionB.gridx = 3; gbc_textOptionB.gridy = 2; panel_6.add(textOptionB, gbc_textOptionB); textOptionB.setColumns(10); radioButton_C = new JRadioButton(""); radioButton_C.setFocusable(false); GridBagConstraints gbc_radioButton_C = new GridBagConstraints(); gbc_radioButton_C.insets = new Insets(0, 0, 5, 5); gbc_radioButton_C.gridx = 0; gbc_radioButton_C.gridy = 3; panel_6.add(radioButton_C, gbc_radioButton_C); optionButtons.add( radioButton_C ); JLabel lblOption_C = new JLabel("C"); GridBagConstraints gbc_lblOption_C = new GridBagConstraints(); gbc_lblOption_C.insets = new Insets(0, 0, 5, 5); gbc_lblOption_C.gridx = 1; gbc_lblOption_C.gridy = 3; panel_6.add(lblOption_C, gbc_lblOption_C); textOptionC = new JTextField(); GridBagConstraints gbc_textOptionC = new GridBagConstraints(); gbc_textOptionC.insets = new Insets(0, 0, 5, 0); gbc_textOptionC.fill = GridBagConstraints.HORIZONTAL; gbc_textOptionC.gridx = 3; gbc_textOptionC.gridy = 3; panel_6.add(textOptionC, gbc_textOptionC); textOptionC.setColumns(10); radioButton_D = new JRadioButton(""); radioButton_D.setFocusable(false); GridBagConstraints gbc_radioButton_D = new GridBagConstraints(); gbc_radioButton_D.insets = new Insets(0, 0, 5, 5); gbc_radioButton_D.gridx = 0; gbc_radioButton_D.gridy = 4; panel_6.add(radioButton_D, gbc_radioButton_D); optionButtons.add( radioButton_D ); JLabel lblOption_D = new JLabel("D"); GridBagConstraints gbc_lblOption_D = new GridBagConstraints(); gbc_lblOption_D.insets = new Insets(0, 0, 5, 5); gbc_lblOption_D.gridx = 1; gbc_lblOption_D.gridy = 4; panel_6.add(lblOption_D, gbc_lblOption_D); textOptionD = new JTextField(); GridBagConstraints gbc_textOptionD = new GridBagConstraints(); gbc_textOptionD.insets = new Insets(0, 0, 5, 0); gbc_textOptionD.fill = GridBagConstraints.HORIZONTAL; gbc_textOptionD.gridx = 3; gbc_textOptionD.gridy = 4; panel_6.add(textOptionD, gbc_textOptionD); textOptionD.setColumns(10); JPanel panel = new JPanel(); GridBagConstraints gbc_panel = new GridBagConstraints(); gbc_panel.fill = GridBagConstraints.BOTH; gbc_panel.gridx = 3; gbc_panel.gridy = 5; panel_6.add(panel, gbc_panel); errPleaseSelectWhich = new JLabel("Please select which answer is the correct one."); errPleaseSelectWhich.setVisible(false); errPleaseSelectWhich.setForeground(Color.RED); errPleaseSelectWhich.setFont(new Font("Lucida Grande", Font.ITALIC, 12)); panel.add(errPleaseSelectWhich); /* * */ JPanel panel_7 = new JPanel(); panel_7.setBounds( 5, 332, 440, 40 ); contentPane.add(panel_7); JButton btnReturn = new JButton("Cancel"); btnReturn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doReturn(); } }); btnReturn.addKeyListener(new KeyListener() { public void keyPressed(KeyEvent e) { if (e.getKeyCode()==KeyEvent.VK_ENTER) doReturn(); } public void keyTyped( KeyEvent e ) {} public void keyReleased( KeyEvent e ) {} }); JButton btnAddQuestion = new JButton("Add"); btnAddQuestion.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doAddQuestion(); } }); btnAddQuestion.addKeyListener(new KeyListener() { public void keyPressed(KeyEvent e) { if (e.getKeyCode()==KeyEvent.VK_ENTER) doAddQuestion(); } public void keyTyped( KeyEvent e ) {} public void keyReleased( KeyEvent e ) {} }); panel_7.add( btnAddQuestion ); panel_7.add( btnReturn ); pack(); } }
12,779
0.662337
0.642539
401
30.86783
21.512276
91
false
false
0
0
0
0
0
0
2.261845
false
false
9
e2ec66a3ec7affc2ac5cbf10d8bc126f2a8d3f26
26,525,718,085,794
64f5437f2f64ee2cf85bdf8c59fce948457a6db3
/src/main/java/InteretsDebiteursMain.java
318bcc73dcb247aa1e5f6cda9aa8ada68a8afa2d
[]
no_license
bcoquard/mdf2019
https://github.com/bcoquard/mdf2019
c1586aedfd73f3b6aeb9df159d71cbb00cc46988
d9b9288cd8c8002a731e8fdd78ee358655b902f5
refs/heads/master
2020-08-08T06:32:52.120000
2019-10-15T11:32:20
2019-10-15T11:32:20
213,757,564
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.io.File; import java.io.FileInputStream; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class InteretsDebiteursMain { public static void main(String[] argv) throws Exception { FileInputStream is = new FileInputStream(new File("interets-debiteurs/input6.txt")); System.setIn(is); String line; Scanner sc = new Scanner(System.in); List<String> stringList = new ArrayList<String>(); while (sc.hasNextLine()) { line = sc.nextLine(); stringList.add(line); } float interestNew = 0f; float interestOld = 0f; int balance = Integer.parseInt(stringList.get(1)); int nbDaysNeg = 0; for (int i = 0; i < Integer.parseInt(stringList.get(0)); i++) { balance += Integer.parseInt(stringList.get(i + 2)); if (balance < 0) { nbDaysNeg++; } else { nbDaysNeg = 0; } if (nbDaysNeg > 0 && nbDaysNeg < 3) { interestNew += Math.abs(balance) * 0.2; } else if (nbDaysNeg == 3) { interestOld += Math.abs(balance) * 0.1; interestNew += Math.abs(balance) * 0.2; } else if (nbDaysNeg > 3) { interestOld += Math.abs(balance) * 0.1; interestNew += Math.abs(balance) * 0.3; } } System.out.println(Math.round(interestNew - interestOld)); } }
UTF-8
Java
1,566
java
InteretsDebiteursMain.java
Java
[]
null
[]
import java.io.File; import java.io.FileInputStream; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class InteretsDebiteursMain { public static void main(String[] argv) throws Exception { FileInputStream is = new FileInputStream(new File("interets-debiteurs/input6.txt")); System.setIn(is); String line; Scanner sc = new Scanner(System.in); List<String> stringList = new ArrayList<String>(); while (sc.hasNextLine()) { line = sc.nextLine(); stringList.add(line); } float interestNew = 0f; float interestOld = 0f; int balance = Integer.parseInt(stringList.get(1)); int nbDaysNeg = 0; for (int i = 0; i < Integer.parseInt(stringList.get(0)); i++) { balance += Integer.parseInt(stringList.get(i + 2)); if (balance < 0) { nbDaysNeg++; } else { nbDaysNeg = 0; } if (nbDaysNeg > 0 && nbDaysNeg < 3) { interestNew += Math.abs(balance) * 0.2; } else if (nbDaysNeg == 3) { interestOld += Math.abs(balance) * 0.1; interestNew += Math.abs(balance) * 0.2; } else if (nbDaysNeg > 3) { interestOld += Math.abs(balance) * 0.1; interestNew += Math.abs(balance) * 0.3; } } System.out.println(Math.round(interestNew - interestOld)); } }
1,566
0.523627
0.508301
49
29.959183
22.965776
92
false
false
0
0
0
0
0
0
0.55102
false
false
9
0be853c80eb833de71a888526d9b291915fee88b
28,673,201,728,269
a8aaf70ccc615d51f9127c2cc3eed79cf59db954
/src/ast/Leaf.java
b2b0a18919f6c88ecac101808a53124d85b17d36
[ "Unlicense" ]
permissive
ofrank123/Zarodenk_Lisp
https://github.com/ofrank123/Zarodenk_Lisp
f445066c3753ab162343751900dc93c4dd0109d3
fa3acdcf1d106fc0ae76146bef8c90006e8fd3e9
refs/heads/master
2020-03-18T05:22:16.990000
2018-06-08T06:49:17
2018-06-08T06:49:17
134,339,240
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ast; /******************************* * abstract class Leaf * used to classify all of its subclasses * as leaves to the AST * * @author Thet Htay Zaw *******************************/ public abstract class Leaf extends Node { /******************************** * returns true because the value * of the leaves will be atomic * * @author Oliver Frank ********************************/ public boolean isAtomic() { return true; } public void add(Node node) { System.out.println("Item atomic"); } public Node get(int i) { System.out.println("Item atomic"); return null; } }
UTF-8
Java
651
java
Leaf.java
Java
[ { "context": "s subclasses\n * as leaves to the AST\n *\n * @author Thet Htay Zaw\n *******************************/\npublic abstract", "end": 163, "score": 0.9998903274536133, "start": 150, "tag": "NAME", "value": "Thet Htay Zaw" }, { "context": "of the leaves will be atomic\n *...
null
[]
package ast; /******************************* * abstract class Leaf * used to classify all of its subclasses * as leaves to the AST * * @author <NAME> *******************************/ public abstract class Leaf extends Node { /******************************** * returns true because the value * of the leaves will be atomic * * @author <NAME> ********************************/ public boolean isAtomic() { return true; } public void add(Node node) { System.out.println("Item atomic"); } public Node get(int i) { System.out.println("Item atomic"); return null; } }
638
0.49616
0.49616
30
20.666666
14.645439
41
false
false
0
0
0
0
0
0
0.266667
false
false
9
e22bdbe83fef047d38e407061349ca45e6dde2c2
24,541,443,166,813
c97b4cac1c8017198cb7d1bae9978220b2fc29f5
/src/main/java/io/github/caojohnny/databenchmark/storage/SqliteUnsafeStorage.java
4b87b933283409cf7b345a3ddab49439f0605c68
[ "Apache-2.0" ]
permissive
AgentTroll/data-benchmark
https://github.com/AgentTroll/data-benchmark
efa3a6e2e95f421b5e3adabce0aa24dbca2ce475
b5cf5748938b714b30dad101bf1aa6974f0719b5
refs/heads/master
2023-02-10T04:20:36.472000
2021-05-24T21:07:17
2021-05-24T21:07:17
282,563,821
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package io.github.caojohnny.databenchmark.storage; import org.checkerframework.checker.nullness.qual.NonNull; import org.sqlite.SQLiteConfig; import org.sqlite.SQLiteDataSource; /** * Hypothetical SQLite database using transactions and indexing to improve write * and read performance but also turns off journaling and synchronous pragma * modes to trade reliability for speeed. */ public class SqliteUnsafeStorage extends SqliteTransactionStorage { public SqliteUnsafeStorage() { SQLiteConfig config = new SQLiteConfig(); config.setPragma(SQLiteConfig.Pragma.JOURNAL_MODE, "OFF"); config.setPragma(SQLiteConfig.Pragma.SYNCHRONOUS, "OFF"); this.dataSource = new SQLiteDataSource(config); } @Override public @NonNull String getName() { return "SQLite Unsafe"; } }
UTF-8
Java
831
java
SqliteUnsafeStorage.java
Java
[ { "context": "package io.github.caojohnny.databenchmark.storage;\n\nimport org.checkerframewo", "end": 27, "score": 0.9990488290786743, "start": 18, "tag": "USERNAME", "value": "caojohnny" } ]
null
[]
package io.github.caojohnny.databenchmark.storage; import org.checkerframework.checker.nullness.qual.NonNull; import org.sqlite.SQLiteConfig; import org.sqlite.SQLiteDataSource; /** * Hypothetical SQLite database using transactions and indexing to improve write * and read performance but also turns off journaling and synchronous pragma * modes to trade reliability for speeed. */ public class SqliteUnsafeStorage extends SqliteTransactionStorage { public SqliteUnsafeStorage() { SQLiteConfig config = new SQLiteConfig(); config.setPragma(SQLiteConfig.Pragma.JOURNAL_MODE, "OFF"); config.setPragma(SQLiteConfig.Pragma.SYNCHRONOUS, "OFF"); this.dataSource = new SQLiteDataSource(config); } @Override public @NonNull String getName() { return "SQLite Unsafe"; } }
831
0.746089
0.746089
25
32.240002
26.993748
80
false
false
0
0
0
0
0
0
0.44
false
false
9
bb3843548c00345f5eea90adff95e753b38f856d
14,113,262,546,598
906a3f4f8b44685b21e650f2976f8703b7c1f9d8
/src/scene/IntroScene.java
0d768310fc84b23f67b8ba8f20a993d86786383a
[]
no_license
chung3011/feed-me
https://github.com/chung3011/feed-me
5e8c876838bf29385fc6559f80737eb9977ca71e
b37e5d45ba02e2a9124b7c18eef739ed6e5de63c
refs/heads/master
2020-03-19T16:52:14.260000
2018-07-04T10:49:22
2018-07-04T10:49:22
136,734,002
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package scene; import Base.GameObjectManager; import Game.Background.CharactersBackground; import Game.Background.WhiteBackground; public class IntroScene implements Scene{ @Override public void init() { GameObjectManager.instance.recycle(WhiteBackground.class); GameObjectManager.instance.recycle(CharactersBackground.class); } @Override public void deinit() { GameObjectManager.instance.clear(); // System.out.println("start scene cleared"); } }
UTF-8
Java
506
java
IntroScene.java
Java
[]
null
[]
package scene; import Base.GameObjectManager; import Game.Background.CharactersBackground; import Game.Background.WhiteBackground; public class IntroScene implements Scene{ @Override public void init() { GameObjectManager.instance.recycle(WhiteBackground.class); GameObjectManager.instance.recycle(CharactersBackground.class); } @Override public void deinit() { GameObjectManager.instance.clear(); // System.out.println("start scene cleared"); } }
506
0.727273
0.727273
19
25.631578
22.174454
71
false
false
0
0
0
0
0
0
0.421053
false
false
9
4b9ed64b9358b29989c276a5e5747cc99a5ea971
14,113,262,544,539
faa10fe6c3b597fd015940b47f9deed009c0e865
/src/LOSearch/ConceptVectorization.java
0627c63f2bf60f7489a6c6a651c95cd495e8029d
[]
no_license
aiTheFirst/Hybrid-Search-and-Delivery-of-Learning-Objects
https://github.com/aiTheFirst/Hybrid-Search-and-Delivery-of-Learning-Objects
a7722a43a9b9530172c396234b3d0077a5d5e4ac
4c3e7b7249a9ecad1db8018a1f3752d77284ada8
refs/heads/master
2021-05-26T12:23:52.280000
2013-01-21T03:11:48
2013-01-21T03:11:48
926,077
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package LOSearch; import java.io.FileWriter; import edu.udo.cs.wvtool.config.WVTConfiguration; import edu.udo.cs.wvtool.config.WVTConfigurationFact; import edu.udo.cs.wvtool.config.WVTConfigurationRule; import edu.udo.cs.wvtool.generic.output.WordVectorWriter; import edu.udo.cs.wvtool.generic.stemmer.DummyStemmer; import edu.udo.cs.wvtool.generic.stemmer.LovinsStemmerWrapper; import edu.udo.cs.wvtool.generic.stemmer.PorterStemmerWrapper; import edu.udo.cs.wvtool.generic.stemmer.ToLowerCaseConverter; import edu.udo.cs.wvtool.generic.stemmer.WVTStemmer; import edu.udo.cs.wvtool.generic.stemmer.WordNetSynonymStemmer; import edu.udo.cs.wvtool.generic.vectorcreation.TFIDF; import edu.udo.cs.wvtool.main.WVTDocumentInfo; import edu.udo.cs.wvtool.main.WVTFileInputList; import edu.udo.cs.wvtool.main.WVTWordVector; import edu.udo.cs.wvtool.main.WVTool; import edu.udo.cs.wvtool.wordlist.WVTWordList; public class ConceptVectorization { public static volatile boolean stopThread = false; public static double[] start(String[] docs, String query) throws Exception { // Initialize the WVTool // WVTool wvt = new WVTool(false); WVTool wvt = new MyWVTool(false); // Initialize the configuration WVTConfiguration config = new WVTConfiguration(); // WVTStemmer stemmer = new SynsetStemmer(); WVTStemmer stemmer = new DummyStemmer(); config.setConfigurationRule(WVTConfiguration.STEP_STEMMER, new WVTConfigurationFact(stemmer)); // Initialize the input list with two classes WVTFileInputList list = new WVTFileInputList(5); /* Jarrett G. Steele * * WVTDocumentInfo takes the query as a file. The GUI program will take the query as input, and write it to a file named query.txt. */ // Add entries int i = 0; list.addEntry(new WVTDocumentInfo("query.txt", "txt", "", "english", i++)); for ( String doc : docs ) list.addEntry(new WVTDocumentInfo(doc, "txt", "", "english", i++)); /* threading control * Jarrett G. Steele */ if(stopThread) return null; // Generate the word list WVTWordList wordList = wvt.createWordList(list, config); // Prune the word list // wordList.pruneByFrequency(2, 5); // Alternativ I: read an already created word list from a file // WVTWordList wordList2 = // new WVTWordList(new FileReader("/home/wurst/tmp/wordlisttest.txt")); // Alternative II: Use predifined dimensions // List dimensions = new Vector(); // dimensions.add("atheist"); // dimensions.add("christian"); // wordList = // wvt.createWordList(list, config, dimensions, false); // Store the word list in a file // wordList. wordList.store(new FileWriter("wordlist.txt")); // Create the word vectors // Set up an output filter (write sparse vectors to a file) WordVectorMemoryWriter wvw = new WordVectorMemoryWriter(); config.setConfigurationRule(WVTConfiguration.STEP_OUTPUT, new WVTConfigurationFact(wvw)); config.setConfigurationRule(WVTConfiguration.STEP_VECTOR_CREATION, new WVTConfigurationFact(new TFIDF())); // Create the vectors wvt.createVectors(list, config, wordList); // Alternatively: create word list and vectors together // wvt.createVectors(list, config); // Close the output file // Just for demonstration: Create a vector from a String WVTWordVector q = wvt.createVector(query, wordList); /* threading control * Jarrett G. Steele */ if(stopThread) return null; double[] relevancies = new double[docs.length]; for ( int j = 0 ; j < docs.length ; ++j ){ relevancies[j] = Untilities.dotproduct(wvw.getList().get(0), wvw.getList().get(j+1)); /* threading control * Jarrett G. Steele */ if(stopThread) return null; } System.out.println("query"); for ( double d : q.getValues() ){ System.out.print(d+" "); /* threading control * Jarrett G. Steele */ if(stopThread) return null; } System.out.println(); return relevancies; } public static void main(String args[]) { System.setProperty("wordnet.database.dir", "./data/dict"); try { // start(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
UTF-8
Java
4,870
java
ConceptVectorization.java
Java
[ { "context": "= new WVTFileInputList(5);\r\n\r\n \r\n /* Jarrett G. Steele\r\n * \r\n * WVTDocumentInfo takes th", "end": 1704, "score": 0.9998717904090881, "start": 1687, "tag": "NAME", "value": "Jarrett G. Steele" }, { "context": "+));\r\n\r\n\r\n ...
null
[]
package LOSearch; import java.io.FileWriter; import edu.udo.cs.wvtool.config.WVTConfiguration; import edu.udo.cs.wvtool.config.WVTConfigurationFact; import edu.udo.cs.wvtool.config.WVTConfigurationRule; import edu.udo.cs.wvtool.generic.output.WordVectorWriter; import edu.udo.cs.wvtool.generic.stemmer.DummyStemmer; import edu.udo.cs.wvtool.generic.stemmer.LovinsStemmerWrapper; import edu.udo.cs.wvtool.generic.stemmer.PorterStemmerWrapper; import edu.udo.cs.wvtool.generic.stemmer.ToLowerCaseConverter; import edu.udo.cs.wvtool.generic.stemmer.WVTStemmer; import edu.udo.cs.wvtool.generic.stemmer.WordNetSynonymStemmer; import edu.udo.cs.wvtool.generic.vectorcreation.TFIDF; import edu.udo.cs.wvtool.main.WVTDocumentInfo; import edu.udo.cs.wvtool.main.WVTFileInputList; import edu.udo.cs.wvtool.main.WVTWordVector; import edu.udo.cs.wvtool.main.WVTool; import edu.udo.cs.wvtool.wordlist.WVTWordList; public class ConceptVectorization { public static volatile boolean stopThread = false; public static double[] start(String[] docs, String query) throws Exception { // Initialize the WVTool // WVTool wvt = new WVTool(false); WVTool wvt = new MyWVTool(false); // Initialize the configuration WVTConfiguration config = new WVTConfiguration(); // WVTStemmer stemmer = new SynsetStemmer(); WVTStemmer stemmer = new DummyStemmer(); config.setConfigurationRule(WVTConfiguration.STEP_STEMMER, new WVTConfigurationFact(stemmer)); // Initialize the input list with two classes WVTFileInputList list = new WVTFileInputList(5); /* <NAME> * * WVTDocumentInfo takes the query as a file. The GUI program will take the query as input, and write it to a file named query.txt. */ // Add entries int i = 0; list.addEntry(new WVTDocumentInfo("query.txt", "txt", "", "english", i++)); for ( String doc : docs ) list.addEntry(new WVTDocumentInfo(doc, "txt", "", "english", i++)); /* threading control * <NAME> */ if(stopThread) return null; // Generate the word list WVTWordList wordList = wvt.createWordList(list, config); // Prune the word list // wordList.pruneByFrequency(2, 5); // Alternativ I: read an already created word list from a file // WVTWordList wordList2 = // new WVTWordList(new FileReader("/home/wurst/tmp/wordlisttest.txt")); // Alternative II: Use predifined dimensions // List dimensions = new Vector(); // dimensions.add("atheist"); // dimensions.add("christian"); // wordList = // wvt.createWordList(list, config, dimensions, false); // Store the word list in a file // wordList. wordList.store(new FileWriter("wordlist.txt")); // Create the word vectors // Set up an output filter (write sparse vectors to a file) WordVectorMemoryWriter wvw = new WordVectorMemoryWriter(); config.setConfigurationRule(WVTConfiguration.STEP_OUTPUT, new WVTConfigurationFact(wvw)); config.setConfigurationRule(WVTConfiguration.STEP_VECTOR_CREATION, new WVTConfigurationFact(new TFIDF())); // Create the vectors wvt.createVectors(list, config, wordList); // Alternatively: create word list and vectors together // wvt.createVectors(list, config); // Close the output file // Just for demonstration: Create a vector from a String WVTWordVector q = wvt.createVector(query, wordList); /* threading control * <NAME>ele */ if(stopThread) return null; double[] relevancies = new double[docs.length]; for ( int j = 0 ; j < docs.length ; ++j ){ relevancies[j] = Untilities.dotproduct(wvw.getList().get(0), wvw.getList().get(j+1)); /* threading control * <NAME> */ if(stopThread) return null; } System.out.println("query"); for ( double d : q.getValues() ){ System.out.print(d+" "); /* threading control * <NAME> */ if(stopThread) return null; } System.out.println(); return relevancies; } public static void main(String args[]) { System.setProperty("wordnet.database.dir", "./data/dict"); try { // start(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
4,818
0.615195
0.613552
147
31.115646
27.613344
139
false
false
0
0
0
0
0
0
0.802721
false
false
9
2bf422cc452ef26a92b70825596eff317d3237d3
2,877,628,144,961
3ae42ba7660aeff1733845bbe8d69f453273f5cf
/src/main/java/org/rcsb/mmtf/spark/data/Atom.java
edb3fc5498f7a9a9321dacab1e77fab6df7d386b
[ "Apache-2.0" ]
permissive
rcsb/mmtf-spark
https://github.com/rcsb/mmtf-spark
e9b12997478f5e36aafb5a2a91fd959ae7e655a2
dfad7f962d0571296453782559c62d3c1848048c
refs/heads/master
2017-04-23T05:08:15.377000
2016-08-20T00:56:47
2016-08-20T00:56:47
58,480,265
1
2
null
false
2016-08-20T00:56:47
2016-05-10T17:20:16
2016-05-10T18:39:02
2016-08-20T00:56:47
196
0
2
0
Java
null
null
package org.rcsb.mmtf.spark.data; /** * Class to enclose Atom level information. * @author Anthony Bradley * */ public class Atom { /** Snake cased for SQL. */ private String chain_id; private String pdb_id; private String name; private String element; private String group_name; private int group_number; private int atom_number; private short charge; private float x; private float y; private float z; /** * @return the chain_id */ public String getChain_id() { return chain_id; } /** * @param chain_id the chain_id to set */ public void setChain_id(String chain_id) { this.chain_id = chain_id; } /** * @return the pdb_id */ public String getPdb_id() { return pdb_id; } /** * @param pdb_id the pdb_id to set */ public void setPdb_id(String pdb_id) { this.pdb_id = pdb_id; } /** * @return the group_name */ public String getGroup_name() { return group_name; } /** * @param group_name the group_name to set */ public void setGroup_name(String group_name) { this.group_name = group_name; } /** * @return the group_number */ public int getGroup_number() { return group_number; } /** * @param group_number the group_number to set */ public void setGroup_number(int group_number) { this.group_number = group_number; } /** * @return the atom_number */ public int getAtom_number() { return atom_number; } /** * @param atom_number the atom_number to set */ public void setAtom_number(int atom_number) { this.atom_number = atom_number; } /** * @return the x */ public float getX() { return x; } /** * @param x the x to set */ public void setX(float x) { this.x = x; } /** * @return the y */ public float getY() { return y; } /** * @param y the y to set */ public void setY(float y) { this.y = y; } /** * @return the z */ public float getZ() { return z; } /** * @param z the z to set */ public void setZ(float z) { this.z = z; } /** * @return the name */ public String getName() { return name; } /** * @param name the name to set */ public void setName(String name) { this.name = name; } /** * @return the element */ public String getElement() { return element; } /** * @param element the element to set */ public void setElement(String element) { this.element = element; } /** * @return the charge */ public short getCharge() { return charge; } /** * @param charge the charge to set */ public void setCharge(short charge) { this.charge = charge; } }
UTF-8
Java
2,562
java
Atom.java
Java
[ { "context": "lass to enclose Atom level information.\n * @author Anthony Bradley\n *\n */\npublic class Atom {\n\n\t/** Snake cased for ", "end": 109, "score": 0.9998714327812195, "start": 94, "tag": "NAME", "value": "Anthony Bradley" } ]
null
[]
package org.rcsb.mmtf.spark.data; /** * Class to enclose Atom level information. * @author <NAME> * */ public class Atom { /** Snake cased for SQL. */ private String chain_id; private String pdb_id; private String name; private String element; private String group_name; private int group_number; private int atom_number; private short charge; private float x; private float y; private float z; /** * @return the chain_id */ public String getChain_id() { return chain_id; } /** * @param chain_id the chain_id to set */ public void setChain_id(String chain_id) { this.chain_id = chain_id; } /** * @return the pdb_id */ public String getPdb_id() { return pdb_id; } /** * @param pdb_id the pdb_id to set */ public void setPdb_id(String pdb_id) { this.pdb_id = pdb_id; } /** * @return the group_name */ public String getGroup_name() { return group_name; } /** * @param group_name the group_name to set */ public void setGroup_name(String group_name) { this.group_name = group_name; } /** * @return the group_number */ public int getGroup_number() { return group_number; } /** * @param group_number the group_number to set */ public void setGroup_number(int group_number) { this.group_number = group_number; } /** * @return the atom_number */ public int getAtom_number() { return atom_number; } /** * @param atom_number the atom_number to set */ public void setAtom_number(int atom_number) { this.atom_number = atom_number; } /** * @return the x */ public float getX() { return x; } /** * @param x the x to set */ public void setX(float x) { this.x = x; } /** * @return the y */ public float getY() { return y; } /** * @param y the y to set */ public void setY(float y) { this.y = y; } /** * @return the z */ public float getZ() { return z; } /** * @param z the z to set */ public void setZ(float z) { this.z = z; } /** * @return the name */ public String getName() { return name; } /** * @param name the name to set */ public void setName(String name) { this.name = name; } /** * @return the element */ public String getElement() { return element; } /** * @param element the element to set */ public void setElement(String element) { this.element = element; } /** * @return the charge */ public short getCharge() { return charge; } /** * @param charge the charge to set */ public void setCharge(short charge) { this.charge = charge; } }
2,553
0.613193
0.613193
156
15.423077
13.503104
48
false
false
0
0
0
0
0
0
1.282051
false
false
9
9ef560ea4ade90942c2641b783fee24158ac1315
15,444,702,410,253
d8ff72f9e54b5fba2dd85069f4193d8cd9aee910
/src_java/service/bco/Bco_AlineaService.java
a7e296a2b6e095f37dde3344a74c93862acc937c
[]
no_license
bmborges/ctpp
https://github.com/bmborges/ctpp
48f9a944f8741763be893296414144a04f0a7082
c675d0aa6ee72f54b1562681b5c52c8e3181a745
refs/heads/master
2020-05-21T12:50:04.907000
2014-11-03T21:01:46
2014-11-03T21:01:46
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package service.bco; import service.AbstractService; import valueObjects.bco.Bco_AlineaVO; public class Bco_AlineaService extends AbstractService<Bco_AlineaVO>{ public Bco_AlineaService() throws Exception { super(); // TODO Auto-generated constructor stub } }
UTF-8
Java
283
java
Bco_AlineaService.java
Java
[]
null
[]
package service.bco; import service.AbstractService; import valueObjects.bco.Bco_AlineaVO; public class Bco_AlineaService extends AbstractService<Bco_AlineaVO>{ public Bco_AlineaService() throws Exception { super(); // TODO Auto-generated constructor stub } }
283
0.745583
0.745583
13
19.76923
22.035475
69
false
false
0
0
0
0
0
0
0.769231
false
false
9
ef981ef17ba3ea35b3d0dde3e762469e6565ee16
15,444,702,411,771
500d7abbf5df46c68b3d4f1d4d496164e6b149b0
/app/src/main/java/com/yaronwe/msbgweather/Forecast.java
57a731386748a9eda95393da866e929855d4592e
[]
no_license
yaronwe/MSBGWeather
https://github.com/yaronwe/MSBGWeather
6cb3b39c68bb712576dc195bcbc189eef02226d0
ef3ea5d4e52b06f5bc18cd4252f8aa667b6e4c40
refs/heads/master
2016-08-08T19:51:42.129000
2016-01-09T09:13:11
2016-01-09T09:13:11
49,317,992
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.yaronwe.msbgweather; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.URL; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.AsyncTask; public class Forecast { private String forecastText, imgUrl, imgName; private Bitmap image; private ForecastAdapter fca; FileCache filecache; public Forecast(String text, String url, String name, FileCache cacheDir) { this.forecastText = text; this.imgUrl = url; this.imgName = name; this.image = null; this.filecache = cacheDir; } public String getForecastText() { return forecastText; } public void setForecastText(String text) { this.forecastText = text; } public String getImgUrl() { return imgUrl; } public void setImgUrl(String imgUrl) { this.imgUrl = imgUrl; } public String getImgName() { return imgName; } public void setImgName(String name) { this.imgName = name; } public Bitmap getImage() { return image; } public ForecastAdapter getAdapter() { return fca; } public void setAdapter(ForecastAdapter fca) { this.fca = fca; } public void loadImage(ForecastAdapter fadapter, String gifName) { // HOLD A REFERENCE TO THE ADAPTER this.fca = fadapter; File f=filecache.getFile(gifName); if(f.exists()){ //Get image from directory cache image = decodeFile(f); if ((fca != null) && (image != null)) { // WHEN IMAGE IS LOADED NOTIFY THE ADAPTER fca.notifyDataSetChanged(); } } //Get image from URL else if (imgUrl != null && !imgUrl.equals("")){ new ImageLoadTask().execute(imgUrl); } } //decodes image and scales it to reduce memory consumption private Bitmap decodeFile(File f){ try { //decode image size BitmapFactory.Options o = new BitmapFactory.Options(); o.inJustDecodeBounds = true; FileInputStream stream1=new FileInputStream(f); BitmapFactory.decodeStream(stream1,null,o); stream1.close(); //Find the correct scale value. It should be the power of 2. final int REQUIRED_SIZE=70; int width_tmp=o.outWidth, height_tmp=o.outHeight; int scale=1; while(true){ if(width_tmp/2<REQUIRED_SIZE || height_tmp/2<REQUIRED_SIZE) break; width_tmp/=2; height_tmp/=2; scale*=2; } //decode with inSampleSize BitmapFactory.Options o2 = new BitmapFactory.Options(); o2.inSampleSize=scale; FileInputStream stream2=new FileInputStream(f); Bitmap bitmap=BitmapFactory.decodeStream(stream2, null, o2); stream2.close(); return bitmap; } catch (FileNotFoundException e) { } catch (IOException e) { e.printStackTrace(); } return null; } // ASYNC TASK TO AVOID CHOKING UP UI THREAD private class ImageLoadTask extends AsyncTask<String, String, Bitmap> { @Override protected void onPreExecute() { // NO OP } // param[0] is img url protected Bitmap doInBackground(String... param) { //Attempting to load image from URL try { Bitmap b = getBitmapFromURL(param[0]); return b; } catch (Exception e) { e.printStackTrace(); return null; } } protected void onProgressUpdate(String... progress) { // NO OP } protected void onPostExecute(Bitmap ret) { if (ret != null) { //Successfully loaded image image = ret; if (fca != null) { // WHEN IMAGE IS LOADED NOTIFY THE ADAPTER fca.notifyDataSetChanged(); } //Save Bitmap to file cache OutputStream outStream = null; File file = new File(filecache.getDir(), imgName); try { outStream = new FileOutputStream(file); ret.compress(Bitmap.CompressFormat.PNG, 100, outStream); outStream.flush(); outStream.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } } } private static Bitmap getBitmapFromURL(String src) { try { URL url = new URL(src); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setDoInput(true); connection.connect(); InputStream input = connection.getInputStream(); Bitmap myBitmap = BitmapFactory.decodeStream(input); return myBitmap; } catch (IOException e) { e.printStackTrace(); return null; } } }
UTF-8
Java
4,908
java
Forecast.java
Java
[]
null
[]
package com.yaronwe.msbgweather; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.URL; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.AsyncTask; public class Forecast { private String forecastText, imgUrl, imgName; private Bitmap image; private ForecastAdapter fca; FileCache filecache; public Forecast(String text, String url, String name, FileCache cacheDir) { this.forecastText = text; this.imgUrl = url; this.imgName = name; this.image = null; this.filecache = cacheDir; } public String getForecastText() { return forecastText; } public void setForecastText(String text) { this.forecastText = text; } public String getImgUrl() { return imgUrl; } public void setImgUrl(String imgUrl) { this.imgUrl = imgUrl; } public String getImgName() { return imgName; } public void setImgName(String name) { this.imgName = name; } public Bitmap getImage() { return image; } public ForecastAdapter getAdapter() { return fca; } public void setAdapter(ForecastAdapter fca) { this.fca = fca; } public void loadImage(ForecastAdapter fadapter, String gifName) { // HOLD A REFERENCE TO THE ADAPTER this.fca = fadapter; File f=filecache.getFile(gifName); if(f.exists()){ //Get image from directory cache image = decodeFile(f); if ((fca != null) && (image != null)) { // WHEN IMAGE IS LOADED NOTIFY THE ADAPTER fca.notifyDataSetChanged(); } } //Get image from URL else if (imgUrl != null && !imgUrl.equals("")){ new ImageLoadTask().execute(imgUrl); } } //decodes image and scales it to reduce memory consumption private Bitmap decodeFile(File f){ try { //decode image size BitmapFactory.Options o = new BitmapFactory.Options(); o.inJustDecodeBounds = true; FileInputStream stream1=new FileInputStream(f); BitmapFactory.decodeStream(stream1,null,o); stream1.close(); //Find the correct scale value. It should be the power of 2. final int REQUIRED_SIZE=70; int width_tmp=o.outWidth, height_tmp=o.outHeight; int scale=1; while(true){ if(width_tmp/2<REQUIRED_SIZE || height_tmp/2<REQUIRED_SIZE) break; width_tmp/=2; height_tmp/=2; scale*=2; } //decode with inSampleSize BitmapFactory.Options o2 = new BitmapFactory.Options(); o2.inSampleSize=scale; FileInputStream stream2=new FileInputStream(f); Bitmap bitmap=BitmapFactory.decodeStream(stream2, null, o2); stream2.close(); return bitmap; } catch (FileNotFoundException e) { } catch (IOException e) { e.printStackTrace(); } return null; } // ASYNC TASK TO AVOID CHOKING UP UI THREAD private class ImageLoadTask extends AsyncTask<String, String, Bitmap> { @Override protected void onPreExecute() { // NO OP } // param[0] is img url protected Bitmap doInBackground(String... param) { //Attempting to load image from URL try { Bitmap b = getBitmapFromURL(param[0]); return b; } catch (Exception e) { e.printStackTrace(); return null; } } protected void onProgressUpdate(String... progress) { // NO OP } protected void onPostExecute(Bitmap ret) { if (ret != null) { //Successfully loaded image image = ret; if (fca != null) { // WHEN IMAGE IS LOADED NOTIFY THE ADAPTER fca.notifyDataSetChanged(); } //Save Bitmap to file cache OutputStream outStream = null; File file = new File(filecache.getDir(), imgName); try { outStream = new FileOutputStream(file); ret.compress(Bitmap.CompressFormat.PNG, 100, outStream); outStream.flush(); outStream.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } } } private static Bitmap getBitmapFromURL(String src) { try { URL url = new URL(src); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setDoInput(true); connection.connect(); InputStream input = connection.getInputStream(); Bitmap myBitmap = BitmapFactory.decodeStream(input); return myBitmap; } catch (IOException e) { e.printStackTrace(); return null; } } }
4,908
0.624491
0.619804
188
25.106382
19.853167
81
false
false
0
0
0
0
0
0
1.904255
false
false
9
005c26ec9c85dfaacc59b5010ab3b3003d13964d
6,244,882,452,509
4e78afd68caac8437f30b01ca6f2f9c836a90629
/src/main/java/viewController/SanasaController.java
ba4f3ce32edae587598a69cc521f750f7fe1fe7a
[]
no_license
RisithPerera/sanasaBankSystem
https://github.com/RisithPerera/sanasaBankSystem
f8f9e4c0e6db9f0c4f3e8446a7f64c50bc0bdd03
bf96ed9129299c6cb79c31e4765a5a616abf4e37
refs/heads/master
2023-03-09T09:38:39.850000
2023-02-26T10:58:49
2023-02-26T10:58:49
153,658,207
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package viewController; import animation.FadeUp; import help.ResizeHelper; import help.myHelp; import javafx.application.Platform; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.ListView; import javafx.scene.control.SelectionMode; import javafx.scene.input.MouseEvent; import javafx.scene.layout.AnchorPane; import javafx.scene.layout.Pane; import javafx.stage.Stage; import javafx.stage.StageStyle; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; public class SanasaController { @FXML private AnchorPane paneBar; @FXML private Button fullscreenBtn; @FXML private Button logout; @FXML private Label temp; @FXML private AnchorPane daddy; @FXML private AnchorPane contentPane; @FXML private ListView<String> listView; @FXML private Button minimizeBtn; @FXML private Button closeBtn; private Stage stage; private Pane pane; public static int userType; private static Stage primaryStage; public static AnchorPane mainPane; public SanasaController() {} public void initialize() { mainPane = contentPane; Platform.runLater(()->{ switch(userType){ case 0: listView.getItems().addAll("Dashboard","Clients","Loans","Deposits","Shares","Attendance","Graphs","Reports","Users","Settings"); break; case 1: listView.getItems().addAll("Dashboard","Clients","Loans","Deposits","Shares","Attendance","Graphs","Reports","Settings"); break; case 2: listView.getItems().addAll("Graphs","Reports"); break; } listView.getSelectionModel().setSelectionMode(SelectionMode.SINGLE); try { primaryStage = (Stage) temp.getScene().getWindow(); if(userType==2){ contentPane.getChildren().setAll(getContent("graphs.fxml")); }else{ contentPane.getChildren().setAll(getContent("dashboard.fxml")); } ResizeHelper.addResizeListener(primaryStage); }catch (IOException ex) { Logger.getLogger(SanasaController.class.getName()).log(Level.SEVERE, null, ex); } }); } @FXML public void listViewEvent(MouseEvent event) { try{ switch(listView.getSelectionModel().getSelectedItem()){ case "Dashboard" : contentPane.getChildren().setAll(getContent("dashboard.fxml")); break; case "Clients" : contentPane.getChildren().setAll(getContent("member.fxml")); break; case "Loans" : contentPane.getChildren().setAll(getContent("loans.fxml")); break; case "Deposits" : DepositsController.selectedMemId = -1; contentPane.getChildren().setAll(getContent("deposits.fxml")); break; case "Shares" : SharesController.selectedMemId = -1; contentPane.getChildren().setAll(getContent("shares.fxml")); break; case "Attendance" : contentPane.getChildren().setAll(getContent("attendance.fxml")); break; case "Graphs" : contentPane.getChildren().setAll(getContent("graphs.fxml")); break; case "Reports": contentPane.getChildren().setAll(getContent("reports.fxml")); new FadeUp(contentPane, 20, 0); break; case "Users": contentPane.getChildren().setAll(getContent("users.fxml")); new FadeUp(contentPane, 20, 0); break; case "Settings": contentPane.getChildren().setAll(getContent("settings.fxml")); } } catch (IOException ex) { Logger.getLogger(SanasaController.class.getName()).log(Level.SEVERE, null, ex); } } public void logoutEvent(){ myHelp help2 = new myHelp(); help2.makeStage(stage, temp, "/view/login.fxml", "Sanasa Bank", false, StageStyle.UNDECORATED, false,0); } @FXML public void fullscreenBtnEvent(ActionEvent event) { if (primaryStage.isFullScreen()) { primaryStage.setFullScreen(false); }else{ primaryStage.setFullScreen(true); } } @FXML public void minimizeBtnEvent(ActionEvent event) { primaryStage.setIconified(true); } @FXML public void closeBtnEvent(ActionEvent event){ Platform.exit(); System.exit(0); } public Pane getContent(String a) throws IOException{ pane = FXMLLoader.load(getClass().getResource("/view/" + a)); AnchorPane.setBottomAnchor(pane, 0.0); AnchorPane.setLeftAnchor(pane, 0.0); AnchorPane.setRightAnchor(pane, 0.0); AnchorPane.setTopAnchor(pane, 0.0); return pane; } public static class Distance{ static double deltaX,deltaY; } public void getDelta(MouseEvent event){ Distance.deltaX = - event.getX()+(-200); Distance.deltaY = - event.getY(); } public void setStage(MouseEvent event){ primaryStage.setX(event.getScreenX()+ Distance.deltaX); primaryStage.setY(event.getScreenY()+ Distance.deltaY); } }
UTF-8
Java
5,987
java
SanasaController.java
Java
[]
null
[]
package viewController; import animation.FadeUp; import help.ResizeHelper; import help.myHelp; import javafx.application.Platform; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.ListView; import javafx.scene.control.SelectionMode; import javafx.scene.input.MouseEvent; import javafx.scene.layout.AnchorPane; import javafx.scene.layout.Pane; import javafx.stage.Stage; import javafx.stage.StageStyle; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; public class SanasaController { @FXML private AnchorPane paneBar; @FXML private Button fullscreenBtn; @FXML private Button logout; @FXML private Label temp; @FXML private AnchorPane daddy; @FXML private AnchorPane contentPane; @FXML private ListView<String> listView; @FXML private Button minimizeBtn; @FXML private Button closeBtn; private Stage stage; private Pane pane; public static int userType; private static Stage primaryStage; public static AnchorPane mainPane; public SanasaController() {} public void initialize() { mainPane = contentPane; Platform.runLater(()->{ switch(userType){ case 0: listView.getItems().addAll("Dashboard","Clients","Loans","Deposits","Shares","Attendance","Graphs","Reports","Users","Settings"); break; case 1: listView.getItems().addAll("Dashboard","Clients","Loans","Deposits","Shares","Attendance","Graphs","Reports","Settings"); break; case 2: listView.getItems().addAll("Graphs","Reports"); break; } listView.getSelectionModel().setSelectionMode(SelectionMode.SINGLE); try { primaryStage = (Stage) temp.getScene().getWindow(); if(userType==2){ contentPane.getChildren().setAll(getContent("graphs.fxml")); }else{ contentPane.getChildren().setAll(getContent("dashboard.fxml")); } ResizeHelper.addResizeListener(primaryStage); }catch (IOException ex) { Logger.getLogger(SanasaController.class.getName()).log(Level.SEVERE, null, ex); } }); } @FXML public void listViewEvent(MouseEvent event) { try{ switch(listView.getSelectionModel().getSelectedItem()){ case "Dashboard" : contentPane.getChildren().setAll(getContent("dashboard.fxml")); break; case "Clients" : contentPane.getChildren().setAll(getContent("member.fxml")); break; case "Loans" : contentPane.getChildren().setAll(getContent("loans.fxml")); break; case "Deposits" : DepositsController.selectedMemId = -1; contentPane.getChildren().setAll(getContent("deposits.fxml")); break; case "Shares" : SharesController.selectedMemId = -1; contentPane.getChildren().setAll(getContent("shares.fxml")); break; case "Attendance" : contentPane.getChildren().setAll(getContent("attendance.fxml")); break; case "Graphs" : contentPane.getChildren().setAll(getContent("graphs.fxml")); break; case "Reports": contentPane.getChildren().setAll(getContent("reports.fxml")); new FadeUp(contentPane, 20, 0); break; case "Users": contentPane.getChildren().setAll(getContent("users.fxml")); new FadeUp(contentPane, 20, 0); break; case "Settings": contentPane.getChildren().setAll(getContent("settings.fxml")); } } catch (IOException ex) { Logger.getLogger(SanasaController.class.getName()).log(Level.SEVERE, null, ex); } } public void logoutEvent(){ myHelp help2 = new myHelp(); help2.makeStage(stage, temp, "/view/login.fxml", "Sanasa Bank", false, StageStyle.UNDECORATED, false,0); } @FXML public void fullscreenBtnEvent(ActionEvent event) { if (primaryStage.isFullScreen()) { primaryStage.setFullScreen(false); }else{ primaryStage.setFullScreen(true); } } @FXML public void minimizeBtnEvent(ActionEvent event) { primaryStage.setIconified(true); } @FXML public void closeBtnEvent(ActionEvent event){ Platform.exit(); System.exit(0); } public Pane getContent(String a) throws IOException{ pane = FXMLLoader.load(getClass().getResource("/view/" + a)); AnchorPane.setBottomAnchor(pane, 0.0); AnchorPane.setLeftAnchor(pane, 0.0); AnchorPane.setRightAnchor(pane, 0.0); AnchorPane.setTopAnchor(pane, 0.0); return pane; } public static class Distance{ static double deltaX,deltaY; } public void getDelta(MouseEvent event){ Distance.deltaX = - event.getX()+(-200); Distance.deltaY = - event.getY(); } public void setStage(MouseEvent event){ primaryStage.setX(event.getScreenX()+ Distance.deltaX); primaryStage.setY(event.getScreenY()+ Distance.deltaY); } }
5,987
0.564724
0.560214
178
32.629215
26.929947
149
false
false
0
0
0
0
0
0
0.719101
false
false
9
d4c7e54fb339102f3f546d2eefd40a21765b3793
13,580,686,626,353
1338bc08cf55d1818d9525f05f87bae182bcdaa5
/PosManager/src/main/java/com/jc/pico/mapper/SvcMailAccountMapper.java
62bcf71d73fcfc48703d3cf88c867b98d2110803
[]
no_license
JamesAreuming/PosManager
https://github.com/JamesAreuming/PosManager
83ebf1615666cdaf8530e3e037522966d66449ef
0dae16f2efccfffeee09da16a2cdd5d0d939766a
refs/heads/master
2023-03-23T12:12:28.227000
2021-03-15T07:37:01
2021-03-15T07:37:01
313,203,570
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.jc.pico.mapper; import com.jc.pico.bean.SvcMailAccount; import com.jc.pico.bean.SvcMailAccountExample; import java.util.List; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.session.RowBounds; public interface SvcMailAccountMapper { /** * This method was generated by MyBatis Generator. * This method corresponds to the database table TB_SVC_MAIL_ACCOUNT * * @mbggenerated Mon Jul 04 21:07:11 KST 2016 */ int countByExample(SvcMailAccountExample example); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table TB_SVC_MAIL_ACCOUNT * * @mbggenerated Mon Jul 04 21:07:11 KST 2016 */ int deleteByExample(SvcMailAccountExample example); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table TB_SVC_MAIL_ACCOUNT * * @mbggenerated Mon Jul 04 21:07:11 KST 2016 */ int deleteByPrimaryKey(Long id); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table TB_SVC_MAIL_ACCOUNT * * @mbggenerated Mon Jul 04 21:07:11 KST 2016 */ int insert(SvcMailAccount record); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table TB_SVC_MAIL_ACCOUNT * * @mbggenerated Mon Jul 04 21:07:11 KST 2016 */ int insertSelective(SvcMailAccount record); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table TB_SVC_MAIL_ACCOUNT * * @mbggenerated Mon Jul 04 21:07:11 KST 2016 */ List<SvcMailAccount> selectByExampleWithRowbounds(SvcMailAccountExample example, RowBounds rowBounds); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table TB_SVC_MAIL_ACCOUNT * * @mbggenerated Mon Jul 04 21:07:11 KST 2016 */ List<SvcMailAccount> selectByExample(SvcMailAccountExample example); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table TB_SVC_MAIL_ACCOUNT * * @mbggenerated Mon Jul 04 21:07:11 KST 2016 */ SvcMailAccount selectByPrimaryKey(Long id); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table TB_SVC_MAIL_ACCOUNT * * @mbggenerated Mon Jul 04 21:07:11 KST 2016 */ int updateByExampleSelective(@Param("record") SvcMailAccount record, @Param("example") SvcMailAccountExample example); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table TB_SVC_MAIL_ACCOUNT * * @mbggenerated Mon Jul 04 21:07:11 KST 2016 */ int updateByExample(@Param("record") SvcMailAccount record, @Param("example") SvcMailAccountExample example); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table TB_SVC_MAIL_ACCOUNT * * @mbggenerated Mon Jul 04 21:07:11 KST 2016 */ int updateByPrimaryKeySelective(SvcMailAccount record); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table TB_SVC_MAIL_ACCOUNT * * @mbggenerated Mon Jul 04 21:07:11 KST 2016 */ int updateByPrimaryKey(SvcMailAccount record); }
UTF-8
Java
3,607
java
SvcMailAccountMapper.java
Java
[]
null
[]
package com.jc.pico.mapper; import com.jc.pico.bean.SvcMailAccount; import com.jc.pico.bean.SvcMailAccountExample; import java.util.List; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.session.RowBounds; public interface SvcMailAccountMapper { /** * This method was generated by MyBatis Generator. * This method corresponds to the database table TB_SVC_MAIL_ACCOUNT * * @mbggenerated Mon Jul 04 21:07:11 KST 2016 */ int countByExample(SvcMailAccountExample example); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table TB_SVC_MAIL_ACCOUNT * * @mbggenerated Mon Jul 04 21:07:11 KST 2016 */ int deleteByExample(SvcMailAccountExample example); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table TB_SVC_MAIL_ACCOUNT * * @mbggenerated Mon Jul 04 21:07:11 KST 2016 */ int deleteByPrimaryKey(Long id); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table TB_SVC_MAIL_ACCOUNT * * @mbggenerated Mon Jul 04 21:07:11 KST 2016 */ int insert(SvcMailAccount record); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table TB_SVC_MAIL_ACCOUNT * * @mbggenerated Mon Jul 04 21:07:11 KST 2016 */ int insertSelective(SvcMailAccount record); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table TB_SVC_MAIL_ACCOUNT * * @mbggenerated Mon Jul 04 21:07:11 KST 2016 */ List<SvcMailAccount> selectByExampleWithRowbounds(SvcMailAccountExample example, RowBounds rowBounds); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table TB_SVC_MAIL_ACCOUNT * * @mbggenerated Mon Jul 04 21:07:11 KST 2016 */ List<SvcMailAccount> selectByExample(SvcMailAccountExample example); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table TB_SVC_MAIL_ACCOUNT * * @mbggenerated Mon Jul 04 21:07:11 KST 2016 */ SvcMailAccount selectByPrimaryKey(Long id); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table TB_SVC_MAIL_ACCOUNT * * @mbggenerated Mon Jul 04 21:07:11 KST 2016 */ int updateByExampleSelective(@Param("record") SvcMailAccount record, @Param("example") SvcMailAccountExample example); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table TB_SVC_MAIL_ACCOUNT * * @mbggenerated Mon Jul 04 21:07:11 KST 2016 */ int updateByExample(@Param("record") SvcMailAccount record, @Param("example") SvcMailAccountExample example); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table TB_SVC_MAIL_ACCOUNT * * @mbggenerated Mon Jul 04 21:07:11 KST 2016 */ int updateByPrimaryKeySelective(SvcMailAccount record); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table TB_SVC_MAIL_ACCOUNT * * @mbggenerated Mon Jul 04 21:07:11 KST 2016 */ int updateByPrimaryKey(SvcMailAccount record); }
3,607
0.6687
0.628777
105
32.371429
29.408861
122
false
false
0
0
0
0
0
0
0.2
false
false
9
9a8031f60835e68b148d26d7dc5ea705f4ced796
21,148,418,981,725
e38c98f516c85297f731b014f108637cbbeaa909
/src/main/java/com/ifp/api/resultModel/user/UserInfo.java
9df4f52723c71fb3e0b542b714862082ef9f0765
[]
no_license
nibnait/internet-finacial
https://github.com/nibnait/internet-finacial
48c90e3fe05b29204ddf042c7496fc6e58ff81cc
2731489c1f3609deb9e23eac6bc6348b6c660b75
refs/heads/master
2021-01-21T09:55:52.569000
2017-05-02T05:58:50
2017-05-02T05:58:50
83,353,415
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ifp.api.resultModel.user; public class UserInfo { private String userId; private String address; private String birthday; private String email; private String idnum; private String image; private String nickname; private String phone; private String realname; private String registertime; private Integer role; private String province; private String city; private String town; private String job; private String sex; private double balance; public double getBalance() { return balance; } public void setBalance(double balance) { this.balance = balance; } public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getBirthday() { return birthday; } public void setBirthday(String birthday) { this.birthday = birthday; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getIdnum() { return idnum; } public void setIdnum(String idnum) { this.idnum = idnum; } public String getImage() { return image; } public void setImage(String image) { this.image = image; } public String getNickname() { return nickname; } public void setNickname(String nickname) { this.nickname = nickname; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public String getRealname() { return realname; } public void setRealname(String realname) { this.realname = realname; } public String getRegistertime() { return registertime; } public void setRegistertime(String registertime) { this.registertime = registertime; } public Integer getRole() { return role; } public void setRole(Integer role) { this.role = role; } public String getProvince() { return province; } public void setProvince(String province) { this.province = province; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public String getTown() { return town; } public void setTown(String town) { this.town = town; } public String getJob() { return job; } public void setJob(String job) { this.job = job; } public String getSex() { return sex; } public void setSex(String sex) { this.sex = sex; } }
UTF-8
Java
2,941
java
UserInfo.java
Java
[]
null
[]
package com.ifp.api.resultModel.user; public class UserInfo { private String userId; private String address; private String birthday; private String email; private String idnum; private String image; private String nickname; private String phone; private String realname; private String registertime; private Integer role; private String province; private String city; private String town; private String job; private String sex; private double balance; public double getBalance() { return balance; } public void setBalance(double balance) { this.balance = balance; } public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getBirthday() { return birthday; } public void setBirthday(String birthday) { this.birthday = birthday; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getIdnum() { return idnum; } public void setIdnum(String idnum) { this.idnum = idnum; } public String getImage() { return image; } public void setImage(String image) { this.image = image; } public String getNickname() { return nickname; } public void setNickname(String nickname) { this.nickname = nickname; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public String getRealname() { return realname; } public void setRealname(String realname) { this.realname = realname; } public String getRegistertime() { return registertime; } public void setRegistertime(String registertime) { this.registertime = registertime; } public Integer getRole() { return role; } public void setRole(Integer role) { this.role = role; } public String getProvince() { return province; } public void setProvince(String province) { this.province = province; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public String getTown() { return town; } public void setTown(String town) { this.town = town; } public String getJob() { return job; } public void setJob(String job) { this.job = job; } public String getSex() { return sex; } public void setSex(String sex) { this.sex = sex; } }
2,941
0.590275
0.590275
157
17.732485
14.90453
54
false
false
0
0
0
0
0
0
0.33121
false
false
9
9f6a82d44ee4359e62bbee9bdc59211937330b0b
6,322,191,871,702
7617e5efd24d6b54aaff17923389d519f47fd7d6
/FactoryPattern/src/my/factory/impl/Permenant.java
4c71c7654a4e3a92cdf510941f3043b2839e5ac5
[]
no_license
katkarshital/PersistantProjects
https://github.com/katkarshital/PersistantProjects
da437fcc7cf6b24d5cc05bad86e19df3fd940d49
0266e39fdc26364dffc81837cf37a5acfe0d84a4
refs/heads/master
2021-01-10T09:39:34.287000
2016-01-19T00:38:18
2016-01-19T00:38:18
49,601,352
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package my.factory.impl; public class Permenant extends Employee{ private int bonus; Permenant(int id, String name, int sal,int bonus) { super(id, name, sal); this.bonus = bonus; } public int getBonus() { return bonus; } public void setBonus(int bonus) { this.bonus = bonus; } }
UTF-8
Java
298
java
Permenant.java
Java
[]
null
[]
package my.factory.impl; public class Permenant extends Employee{ private int bonus; Permenant(int id, String name, int sal,int bonus) { super(id, name, sal); this.bonus = bonus; } public int getBonus() { return bonus; } public void setBonus(int bonus) { this.bonus = bonus; } }
298
0.684564
0.684564
17
16.529411
15.297511
52
false
false
0
0
0
0
0
0
1.588235
false
false
9
9e0083872e665065c3b29e76692a470b7493ba72
16,793,322,172,576
5d45546fd392b5bef19d2970fd1c9820236026e2
/core/src/test/java/com/hivemq/testcontainer/core/HiveMQTestContainerCoreTest.java
f1e4ff9a0824ced9958bb890089da66c38b82cf7
[ "Apache-2.0" ]
permissive
maryg-lab/hivemq-testcontainer
https://github.com/maryg-lab/hivemq-testcontainer
733b595e589cdd862c788ea5bf72e094ac0d0248
05fcec1ee8e107a828b63a7503d3979d6cfd93ad
refs/heads/master
2023-08-15T05:13:23.373000
2021-09-16T10:44:57
2021-10-06T08:19:38
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright 2020 HiveMQ and the HiveMQ Community * * 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.hivemq.testcontainer.core; import org.jetbrains.annotations.NotNull; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; import org.testcontainers.containers.ContainerLaunchException; import org.testcontainers.utility.MountableFile; import java.io.File; import java.io.IOException; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; /** * @author Yannick Weber */ @SuppressWarnings("rawtypes") class HiveMQTestContainerCoreTest { final @NotNull HiveMQTestContainerCore container = new HiveMQTestContainerCore(); @TempDir File tempDir; @Test void withExtension_fileDoesNotExist_Exception() { final MountableFile mountableFile = MountableFile.forHostPath("/this/does/not/exist"); assertThrows(ContainerLaunchException.class, () -> container.withExtension(mountableFile)); } @Test void withExtension_fileNoDirectory_Exception() throws IOException { final File extension = new File(tempDir, "extension"); assertTrue(extension.createNewFile()); final MountableFile mountableFile = MountableFile.forHostPath(extension.getAbsolutePath()); assertThrows(ContainerLaunchException.class, () -> container.withExtension(mountableFile)); } @Test void withLicense_fileDoesNotExist_Exception() { final MountableFile mountableFile = MountableFile.forHostPath("/this/does/not/exist"); assertThrows(ContainerLaunchException.class, () -> container.withLicense(mountableFile)); } @Test void withExtension_fileEndingWrong_Exception() throws IOException { final File extension = new File(tempDir, "extension.wrong"); assertTrue(extension.createNewFile()); final MountableFile mountableFile = MountableFile.forHostPath(extension.getAbsolutePath()); assertThrows(ContainerLaunchException.class, () -> container.withLicense(mountableFile)); } @Test void withHiveMQConfig_fileDoesNotExist_Exception() { final MountableFile mountableFile = MountableFile.forHostPath("/this/does/not/exist"); assertThrows(ContainerLaunchException.class, () -> container.withHiveMQConfig(mountableFile)); } @Test void withFileInHomeFolder_withPath_fileDoesNotExist_Exception() { final MountableFile mountableFile = MountableFile.forHostPath("/this/does/not/exist"); assertThrows(ContainerLaunchException.class, () -> container.withFileInHomeFolder(mountableFile, "some/path")); } @Test void withFileInHomeFolder_fileDoesNotExist_Exception() { final MountableFile mountableFile = MountableFile.forHostPath("/this/does/not/exist"); assertThrows(ContainerLaunchException.class, () -> container.withFileInHomeFolder(mountableFile)); } @Test void withFileInExtensionHomeFolder_withPath_fileDoesNotExist_Exception() { final MountableFile mountableFile = MountableFile.forHostPath("/this/does/not/exist"); assertThrows(ContainerLaunchException.class, () -> container.withFileInExtensionHomeFolder(mountableFile, "my-extension", "some/path")); } @Test void withFileInExtensionHomeFolder_fileDoesNotExist_Exception() { final MountableFile mountableFile = MountableFile.forHostPath("/this/does/not/exist"); assertThrows(ContainerLaunchException.class, () -> container.withFileInExtensionHomeFolder(mountableFile, "my-extension")); } }
UTF-8
Java
4,110
java
HiveMQTestContainerCoreTest.java
Java
[ { "context": "jupiter.api.Assertions.assertTrue;\n\n/**\n * @author Yannick Weber\n */\n@SuppressWarnings(\"rawtypes\")\nclass HiveMQTes", "end": 1085, "score": 0.999812126159668, "start": 1072, "tag": "NAME", "value": "Yannick Weber" } ]
null
[]
/* * Copyright 2020 HiveMQ and the HiveMQ Community * * 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.hivemq.testcontainer.core; import org.jetbrains.annotations.NotNull; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; import org.testcontainers.containers.ContainerLaunchException; import org.testcontainers.utility.MountableFile; import java.io.File; import java.io.IOException; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; /** * @author <NAME> */ @SuppressWarnings("rawtypes") class HiveMQTestContainerCoreTest { final @NotNull HiveMQTestContainerCore container = new HiveMQTestContainerCore(); @TempDir File tempDir; @Test void withExtension_fileDoesNotExist_Exception() { final MountableFile mountableFile = MountableFile.forHostPath("/this/does/not/exist"); assertThrows(ContainerLaunchException.class, () -> container.withExtension(mountableFile)); } @Test void withExtension_fileNoDirectory_Exception() throws IOException { final File extension = new File(tempDir, "extension"); assertTrue(extension.createNewFile()); final MountableFile mountableFile = MountableFile.forHostPath(extension.getAbsolutePath()); assertThrows(ContainerLaunchException.class, () -> container.withExtension(mountableFile)); } @Test void withLicense_fileDoesNotExist_Exception() { final MountableFile mountableFile = MountableFile.forHostPath("/this/does/not/exist"); assertThrows(ContainerLaunchException.class, () -> container.withLicense(mountableFile)); } @Test void withExtension_fileEndingWrong_Exception() throws IOException { final File extension = new File(tempDir, "extension.wrong"); assertTrue(extension.createNewFile()); final MountableFile mountableFile = MountableFile.forHostPath(extension.getAbsolutePath()); assertThrows(ContainerLaunchException.class, () -> container.withLicense(mountableFile)); } @Test void withHiveMQConfig_fileDoesNotExist_Exception() { final MountableFile mountableFile = MountableFile.forHostPath("/this/does/not/exist"); assertThrows(ContainerLaunchException.class, () -> container.withHiveMQConfig(mountableFile)); } @Test void withFileInHomeFolder_withPath_fileDoesNotExist_Exception() { final MountableFile mountableFile = MountableFile.forHostPath("/this/does/not/exist"); assertThrows(ContainerLaunchException.class, () -> container.withFileInHomeFolder(mountableFile, "some/path")); } @Test void withFileInHomeFolder_fileDoesNotExist_Exception() { final MountableFile mountableFile = MountableFile.forHostPath("/this/does/not/exist"); assertThrows(ContainerLaunchException.class, () -> container.withFileInHomeFolder(mountableFile)); } @Test void withFileInExtensionHomeFolder_withPath_fileDoesNotExist_Exception() { final MountableFile mountableFile = MountableFile.forHostPath("/this/does/not/exist"); assertThrows(ContainerLaunchException.class, () -> container.withFileInExtensionHomeFolder(mountableFile, "my-extension", "some/path")); } @Test void withFileInExtensionHomeFolder_fileDoesNotExist_Exception() { final MountableFile mountableFile = MountableFile.forHostPath("/this/does/not/exist"); assertThrows(ContainerLaunchException.class, () -> container.withFileInExtensionHomeFolder(mountableFile, "my-extension")); } }
4,103
0.747202
0.745255
98
40.948978
38.828079
144
false
false
0
0
0
0
0
0
0.55102
false
false
9
02533a445ccc268c613569e127b7329af275c300
4,587,025,119,772
7b7e7ded4b77b031836ed0e80f3ed3938133db31
/5333-WebUI/src/main/java/frc/team5333/webui/websockets/SocketReadout.java
b60b319e429362dec196fdcececa5c85896ef70a
[ "MIT" ]
permissive
Chuckinator2020/2016-Stronghold
https://github.com/Chuckinator2020/2016-Stronghold
069928ba495a88d671156b4a501ff8892aa291f4
15dbab7066cccda842b47e6f3ec15ea5e1a106d5
refs/heads/master
2020-12-03T21:41:58.786000
2016-03-23T03:54:03
2016-03-23T03:54:03
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package frc.team5333.webui.websockets; import com.grack.nanojson.JsonObject; import frc.team5333.core.control.strategy.StrategyController; import frc.team5333.core.hardware.IO; import frc.team5333.core.systems.Systems; import frc.team5333.core.vision.VisionNetwork; import frc.team5333.webui.WebHandler; import org.eclipse.jetty.websocket.api.Session; import org.eclipse.jetty.websocket.api.annotations.OnWebSocketClose; import org.eclipse.jetty.websocket.api.annotations.OnWebSocketConnect; import org.eclipse.jetty.websocket.api.annotations.OnWebSocketMessage; import org.eclipse.jetty.websocket.api.annotations.WebSocket; import java.io.IOException; import java.util.Queue; import java.util.concurrent.ConcurrentLinkedQueue; @WebSocket public class SocketReadout { private static final Queue<Session> sessions = new ConcurrentLinkedQueue<>(); @OnWebSocketConnect public void connected(Session session) { sessions.add(session); } @OnWebSocketClose public void closed(Session session, int statusCode, String reason) { sessions.remove(session); } @OnWebSocketMessage public void message(Session session, String message) throws IOException { } public static void tick() { JsonObject obj = new JsonObject(); obj.put("Left Throttle", p(IO.motor_master_left.get() * 100)); obj.put("Right Throttle", p(IO.motor_master_right.get() * 100)); obj.put("Flywheel Top", p(IO.motor_flywheel_top.get() * 100)); obj.put("Flywheel Bottom", p(IO.motor_flywheel_bottom.get() * 100)); obj.put("Strategy", StrategyController.INSTANCE.getStrategy().getName()); obj.put("Throttle Scale", p(Systems.drive.getThrottleScale() * 100)); obj.put("Left Encoder", IO.motor_master_left.getEncPosition()); obj.put("Right Encoder", IO.motor_master_right.getEncPosition()); obj.put("Vision Frame", VisionNetwork.INSTANCE.getActive() != null); obj.put("Passive Spinup?", Systems.shooter.getPassiveSpinup()); sessions.forEach(session -> { try { session.getRemote().sendString(WebHandler.jsonToString(obj)); } catch (Exception e) { } }); } public static String p(double d) { return String.format("%.2f%%", d); } }
UTF-8
Java
2,312
java
SocketReadout.java
Java
[]
null
[]
package frc.team5333.webui.websockets; import com.grack.nanojson.JsonObject; import frc.team5333.core.control.strategy.StrategyController; import frc.team5333.core.hardware.IO; import frc.team5333.core.systems.Systems; import frc.team5333.core.vision.VisionNetwork; import frc.team5333.webui.WebHandler; import org.eclipse.jetty.websocket.api.Session; import org.eclipse.jetty.websocket.api.annotations.OnWebSocketClose; import org.eclipse.jetty.websocket.api.annotations.OnWebSocketConnect; import org.eclipse.jetty.websocket.api.annotations.OnWebSocketMessage; import org.eclipse.jetty.websocket.api.annotations.WebSocket; import java.io.IOException; import java.util.Queue; import java.util.concurrent.ConcurrentLinkedQueue; @WebSocket public class SocketReadout { private static final Queue<Session> sessions = new ConcurrentLinkedQueue<>(); @OnWebSocketConnect public void connected(Session session) { sessions.add(session); } @OnWebSocketClose public void closed(Session session, int statusCode, String reason) { sessions.remove(session); } @OnWebSocketMessage public void message(Session session, String message) throws IOException { } public static void tick() { JsonObject obj = new JsonObject(); obj.put("Left Throttle", p(IO.motor_master_left.get() * 100)); obj.put("Right Throttle", p(IO.motor_master_right.get() * 100)); obj.put("Flywheel Top", p(IO.motor_flywheel_top.get() * 100)); obj.put("Flywheel Bottom", p(IO.motor_flywheel_bottom.get() * 100)); obj.put("Strategy", StrategyController.INSTANCE.getStrategy().getName()); obj.put("Throttle Scale", p(Systems.drive.getThrottleScale() * 100)); obj.put("Left Encoder", IO.motor_master_left.getEncPosition()); obj.put("Right Encoder", IO.motor_master_right.getEncPosition()); obj.put("Vision Frame", VisionNetwork.INSTANCE.getActive() != null); obj.put("Passive Spinup?", Systems.shooter.getPassiveSpinup()); sessions.forEach(session -> { try { session.getRemote().sendString(WebHandler.jsonToString(obj)); } catch (Exception e) { } }); } public static String p(double d) { return String.format("%.2f%%", d); } }
2,312
0.70199
0.684689
65
34.569229
28.64798
81
false
false
0
0
0
0
0
0
0.707692
false
false
9
dc707d4f8d236b3acf601c98daf6b11c6d4cb9fa
6,047,313,957,613
2e25a7df9cb2efef2094590550a789c307b58e76
/twoDimension/Circle.java
d46cb0f2a12bdba21d5444ef0398877c4c7073ba
[]
no_license
katyamoroz1/Java-GUI
https://github.com/katyamoroz1/Java-GUI
15b16e3740a4ff117f66a98e37423b06cd9988a8
fd6f77ed2eb257871d1fdf2877602ed28d0c98fa
refs/heads/master
2020-08-17T06:59:37.413000
2019-10-22T15:50:41
2019-10-22T15:50:41
215,628,816
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.company.twoDimension; import com.company.twoDimension.Figure; public class Circle extends Figure { public double r; public Circle (double r) { super(Math.PI * Math.pow(r, 2)); this.r = r; } }
UTF-8
Java
237
java
Circle.java
Java
[]
null
[]
package com.company.twoDimension; import com.company.twoDimension.Figure; public class Circle extends Figure { public double r; public Circle (double r) { super(Math.PI * Math.pow(r, 2)); this.r = r; } }
237
0.637131
0.632911
13
17.23077
16.187145
40
false
false
0
0
0
0
0
0
0.461538
false
false
9
c1f744bfd315872a562b92c60c8fb55f033de387
6,047,313,957,157
1cc1f8d9d640550a5264878c150617177ab535b8
/spring_basic/src/test/java/spring_basic/cache/test/TestCache.java
2f9a27309dc4ca955c1c3f9fc6c9f099a175585f
[]
no_license
pugwoo/j2ee_v2
https://github.com/pugwoo/j2ee_v2
6753b29a01a1fff114e9009cf17bcfaf9a0a76f9
9aa7cef140a6d33561df39150177cddd00f2bb74
refs/heads/master
2018-12-29T11:52:58.021000
2018-11-17T14:32:38
2018-11-17T14:32:38
19,840,836
2
4
null
null
null
null
null
null
null
null
null
null
null
null
null
package spring_basic.cache.test; import java.util.Map; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import spring_basic.cache.MyCacheClass; @ContextConfiguration(locations = "classpath:applicationContext-cache.xml") @RunWith(SpringJUnit4ClassRunner.class) public class TestCache { @Autowired private MyCacheClass myCacheClass; @Test public void test() { Map<String, Object> map = myCacheClass.getById("3"); System.out.println(map); map = myCacheClass.getById("3"); System.out.println(map); } }
UTF-8
Java
724
java
TestCache.java
Java
[]
null
[]
package spring_basic.cache.test; import java.util.Map; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import spring_basic.cache.MyCacheClass; @ContextConfiguration(locations = "classpath:applicationContext-cache.xml") @RunWith(SpringJUnit4ClassRunner.class) public class TestCache { @Autowired private MyCacheClass myCacheClass; @Test public void test() { Map<String, Object> map = myCacheClass.getById("3"); System.out.println(map); map = myCacheClass.getById("3"); System.out.println(map); } }
724
0.791436
0.78453
28
24.857143
22.971588
75
true
false
0
0
0
0
0
0
1.035714
false
false
9
a69b8a0201fff608713c875506d98be7d5e10ccb
23,124,103,957,987
1440b56c63166c76818d7dacf4a620b005f7bd41
/src/main/java/fr/nantes/web/quizz/servlets/AjoutScoreSecure.java
c96faee523639e704640c6c18084cf1e92542cb4
[ "MIT" ]
permissive
BerliozLeChat/movies-game-project
https://github.com/BerliozLeChat/movies-game-project
fed5d1552c18cb09ec21a9e1df0a7b4b7b658e12
0db3f59728e1150914af8918482848bc25d9de87
refs/heads/master
2020-12-24T11:07:37.632000
2016-12-20T21:32:44
2016-12-20T21:32:44
73,190,411
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package fr.nantes.web.quizz.servlets; import com.google.appengine.api.datastore.EntityNotFoundException; import com.google.appengine.api.users.User; import com.google.appengine.api.users.UserServiceFactory; import fr.nantes.web.quizz.data.Requetesdatastore; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; /** * Created by Sébastien on 13/12/2016. */ public class AjoutScoreSecure extends HttpServlet { @Override public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { User user = UserServiceFactory.getUserService().getCurrentUser(); if(user != null){ if(Requetesdatastore.existScoreUser(user.getUserId())) try { if (Requetesdatastore.updateExistingScore(user.getUserId(), Integer.parseInt(request.getParameter("score")))) response.setStatus(251); // Félicitation, vous avez battu votre meilleur score else response.setStatus(250 );// Vous n'avez pas battu votre meilleur score, essayez encore }catch (EntityNotFoundException e){ response.sendError(500, "erreur de fonctionnement interne"); } else{ Requetesdatastore.insertNewScore(user.getUserId(),user.getNickname(),Integer.parseInt(request.getParameter("score"))); response.setStatus(201);// Merci d'avoir jouer, votre score est enregistré. Vous pouvez continuer à vous amuser :) } } } }
UTF-8
Java
1,761
java
AjoutScoreSecure.java
Java
[ { "context": "se;\nimport java.io.IOException;\n\n/**\n * Created by Sébastien on 13/12/2016.\n */\npublic class AjoutScoreSecure ", "end": 487, "score": 0.9976798892021179, "start": 478, "tag": "NAME", "value": "Sébastien" } ]
null
[]
package fr.nantes.web.quizz.servlets; import com.google.appengine.api.datastore.EntityNotFoundException; import com.google.appengine.api.users.User; import com.google.appengine.api.users.UserServiceFactory; import fr.nantes.web.quizz.data.Requetesdatastore; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; /** * Created by Sébastien on 13/12/2016. */ public class AjoutScoreSecure extends HttpServlet { @Override public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { User user = UserServiceFactory.getUserService().getCurrentUser(); if(user != null){ if(Requetesdatastore.existScoreUser(user.getUserId())) try { if (Requetesdatastore.updateExistingScore(user.getUserId(), Integer.parseInt(request.getParameter("score")))) response.setStatus(251); // Félicitation, vous avez battu votre meilleur score else response.setStatus(250 );// Vous n'avez pas battu votre meilleur score, essayez encore }catch (EntityNotFoundException e){ response.sendError(500, "erreur de fonctionnement interne"); } else{ Requetesdatastore.insertNewScore(user.getUserId(),user.getNickname(),Integer.parseInt(request.getParameter("score"))); response.setStatus(201);// Merci d'avoir jouer, votre score est enregistré. Vous pouvez continuer à vous amuser :) } } } }
1,761
0.67103
0.659647
49
34.857143
38.609505
138
false
false
0
0
0
0
0
0
0.510204
false
false
9
37b303707d374316ddbe1e6b87312b29b4638bc9
17,085,379,962,724
b9195ab493c1f869cbfff48df8e73ab73002a2db
/src/java/beans/Orders.java
9bba864441f020405292f3dce90905e2a8c9aeea
[]
no_license
namle23/Pie
https://github.com/namle23/Pie
d61b85ee78cff218e88cab54e38e7cdd1887243b
46fb06cd39b332139694eeb3cff9476aec0b4f3b
refs/heads/master
2021-01-01T15:32:20.672000
2019-09-04T10:05:04
2019-09-04T10:05:04
97,635,952
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package beans; import java.io.Serializable; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.Table; import javax.xml.bind.annotation.XmlRootElement; @Entity @Table(name = "order") @XmlRootElement @NamedQueries({ @NamedQuery(name = "Orders.findAll", query = "SELECT o FROM Orders o") , @NamedQuery(name = "Orders.findById", query = "SELECT o FROM Orders o WHERE o.id = :id") , @NamedQuery(name = "Orders.findByUserId", query = "SELECT o FROM Orders o WHERE o.userId = :userId") , @NamedQuery(name = "Orders.findByFullName", query = "SELECT o FROM Orders o WHERE o.fullName = :fullName") , @NamedQuery(name = "Orders.findByAddress", query = "SELECT o FROM Orders o WHERE o.address = :address") , @NamedQuery(name = "Orders.findByPhone", query = "SELECT o FROM Orders o WHERE o.phone = :phone") , @NamedQuery(name = "Orders.findByPrdId", query = "SELECT o FROM Orders o WHERE o.prdId = :prdId") , @NamedQuery(name = "Orders.findByPrdName", query = "SELECT o FROM Orders o WHERE o.prdName = :prdName") , @NamedQuery(name = "Orders.findByPrdQuan", query = "SELECT o FROM Orders o WHERE o.prdQuan = :prdQuan") , @NamedQuery(name = "Orders.findByPrdCost", query = "SELECT o FROM Orders o WHERE o.prdCost = :prdCost") , @NamedQuery(name = "Orders.findByStatus", query = "SELECT o FROM Orders o WHERE o.status = :status")}) public class Orders implements Serializable { private static final long serialVersionUID = 1L; @Id @Basic(optional = false) @Column(name = "id") private Integer id; @Basic(optional = false) @Column(name = "user_id") private String userId; @Basic(optional = false) @Column(name = "full_name") private String fullName; @Basic(optional = false) @Column(name = "address") private String address; @Basic(optional = false) @Column(name = "phone") private String phone; @Basic(optional = false) @Column(name = "prd_id") private String prdId; @Basic(optional = false) @Column(name = "prd_name") private String prdName; @Column(name = "prd_quan") private Integer prdQuan; @Column(name = "prd_cost") private Integer prdCost; @Basic(optional = false) @Column(name = "status") private int status; private Products product; //get product object public Orders() { } public Orders(Integer id) { this.id = id; } public Orders(Integer id, String userId, String fullName, String address, String phone, String prdId, String prdName, int status) { this.id = id; this.userId = userId; this.fullName = fullName; this.address = address; this.phone = phone; this.prdId = prdId; this.prdName = prdName; this.status = status; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public String getFullName() { return fullName; } public void setFullName(String fullName) { this.fullName = fullName; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public String getPrdId() { return prdId; } public void setPrdId(String prdId) { this.prdId = prdId; } public String getPrdName() { return prdName; } public void setPrdName(String prdName) { this.prdName = prdName; } public Integer getPrdQuan() { return prdQuan; } public void setPrdQuan(Integer prdQuan) { this.prdQuan = prdQuan; } public Integer getPrdCost() { Integer prdCost = product.getPrice() * prdQuan; return prdCost; } public void setPrdCost(Integer prdCost) { this.prdCost = prdCost; } public int getStatus() { return status; } public void setStatus(int status) { this.status = status; } public void setProduct(Products product) { this.product = product; } public Products getProduct() { return product; } @Override public int hashCode() { int hash = 0; hash += (id != null ? id.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Orders)) { return false; } Orders other = (Orders) object; if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { return false; } return true; } @Override public String toString() { return "beans.Orders[ id=" + id + " ]"; } }
UTF-8
Java
5,271
java
Orders.java
Java
[]
null
[]
package beans; import java.io.Serializable; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.Table; import javax.xml.bind.annotation.XmlRootElement; @Entity @Table(name = "order") @XmlRootElement @NamedQueries({ @NamedQuery(name = "Orders.findAll", query = "SELECT o FROM Orders o") , @NamedQuery(name = "Orders.findById", query = "SELECT o FROM Orders o WHERE o.id = :id") , @NamedQuery(name = "Orders.findByUserId", query = "SELECT o FROM Orders o WHERE o.userId = :userId") , @NamedQuery(name = "Orders.findByFullName", query = "SELECT o FROM Orders o WHERE o.fullName = :fullName") , @NamedQuery(name = "Orders.findByAddress", query = "SELECT o FROM Orders o WHERE o.address = :address") , @NamedQuery(name = "Orders.findByPhone", query = "SELECT o FROM Orders o WHERE o.phone = :phone") , @NamedQuery(name = "Orders.findByPrdId", query = "SELECT o FROM Orders o WHERE o.prdId = :prdId") , @NamedQuery(name = "Orders.findByPrdName", query = "SELECT o FROM Orders o WHERE o.prdName = :prdName") , @NamedQuery(name = "Orders.findByPrdQuan", query = "SELECT o FROM Orders o WHERE o.prdQuan = :prdQuan") , @NamedQuery(name = "Orders.findByPrdCost", query = "SELECT o FROM Orders o WHERE o.prdCost = :prdCost") , @NamedQuery(name = "Orders.findByStatus", query = "SELECT o FROM Orders o WHERE o.status = :status")}) public class Orders implements Serializable { private static final long serialVersionUID = 1L; @Id @Basic(optional = false) @Column(name = "id") private Integer id; @Basic(optional = false) @Column(name = "user_id") private String userId; @Basic(optional = false) @Column(name = "full_name") private String fullName; @Basic(optional = false) @Column(name = "address") private String address; @Basic(optional = false) @Column(name = "phone") private String phone; @Basic(optional = false) @Column(name = "prd_id") private String prdId; @Basic(optional = false) @Column(name = "prd_name") private String prdName; @Column(name = "prd_quan") private Integer prdQuan; @Column(name = "prd_cost") private Integer prdCost; @Basic(optional = false) @Column(name = "status") private int status; private Products product; //get product object public Orders() { } public Orders(Integer id) { this.id = id; } public Orders(Integer id, String userId, String fullName, String address, String phone, String prdId, String prdName, int status) { this.id = id; this.userId = userId; this.fullName = fullName; this.address = address; this.phone = phone; this.prdId = prdId; this.prdName = prdName; this.status = status; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public String getFullName() { return fullName; } public void setFullName(String fullName) { this.fullName = fullName; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public String getPrdId() { return prdId; } public void setPrdId(String prdId) { this.prdId = prdId; } public String getPrdName() { return prdName; } public void setPrdName(String prdName) { this.prdName = prdName; } public Integer getPrdQuan() { return prdQuan; } public void setPrdQuan(Integer prdQuan) { this.prdQuan = prdQuan; } public Integer getPrdCost() { Integer prdCost = product.getPrice() * prdQuan; return prdCost; } public void setPrdCost(Integer prdCost) { this.prdCost = prdCost; } public int getStatus() { return status; } public void setStatus(int status) { this.status = status; } public void setProduct(Products product) { this.product = product; } public Products getProduct() { return product; } @Override public int hashCode() { int hash = 0; hash += (id != null ? id.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Orders)) { return false; } Orders other = (Orders) object; if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { return false; } return true; } @Override public String toString() { return "beans.Orders[ id=" + id + " ]"; } }
5,271
0.61715
0.616581
195
26.030769
26.314451
135
false
false
0
0
0
0
0
0
0.471795
false
false
9
306252e08681db6be152ca8c52c4b1fde62ae31b
29,789,893,222,471
02d0f23ba02ef07f760b7d8ae72ca97f8fac711e
/app/src/main/java/com/example/bistubbs/community/CommunityHomeAdapter.java
0b0731ad7159f35c64a588c14cba13154f73c94c
[]
no_license
JoeMob/BISTU-BBS-Android
https://github.com/JoeMob/BISTU-BBS-Android
eb702636488833030cb3e96779bc3628275cabc1
2ef65a0ec3ddf5d2fc5d2b83157b86112a07727e
refs/heads/master
2020-08-07T16:05:14.515000
2019-11-18T07:26:59
2019-11-18T07:26:59
213,518,334
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.bistubbs.community; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.example.bistubbs.R; import java.util.List; public class CommunityHomeAdapter extends RecyclerView.Adapter<CommunityHomeAdapter.ViewHolder> { private List mList;//数据源 private List<Community> communityList; private Integer type; static final int BIG_COMMUNITY=1; static final int SMALL_COMMUNITY=2; CommunityHomeAdapter(){} CommunityHomeAdapter(List list, List<Community> commList, Integer type) { mList = list; communityList = commList; this.type = type; } //创建ViewHolder并返回,后续item布局里控件都是从ViewHolder中取出 //实现监听步骤2 @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { //将我们自定义的item布局R.layout.item_one转换为View View view = LayoutInflater.from(parent.getContext()) .inflate(R.layout.item_comm_home_big, parent, false); //将view传递给我们自定义的ViewHolder final ViewHolder holder = new ViewHolder(view); //返回这个MyHolder实体 return holder; } //通过方法提供的ViewHolder,将数据绑定到ViewHolder中 @Override public void onBindViewHolder(final ViewHolder holder, final int position) { holder.textView.setText(mList.get(position).toString()); holder.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (listener != null) { if(type == BIG_COMMUNITY){ listener.onClick(position,type); }else if(type == SMALL_COMMUNITY){ if(mList.get(position).equals("")){ listener.onClick(position,0); }else{ listener.onClick(position,1); } } } } }); holder.itemView.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { if (longClickListener != null) { longClickListener.onClick(position); } return true; } }); } //获取数据源总的条数 @Override public int getItemCount() { return mList.size(); } /** * 自定义的ViewHolder */ class ViewHolder extends RecyclerView.ViewHolder { TextView textView; public ViewHolder(View itemView) { super(itemView); textView = itemView.findViewById(R.id.tv_content); } } //实现监听步骤1: //第一步 定义接口 public interface OnItemClickListener { void onClick(int position,int type); } private OnItemClickListener listener; //第二步, 写一个公共的方法 public void setOnItemClickListener(OnItemClickListener listener) { this.listener = listener; } /* * 长按 * */ public interface OnItemLongClickListener { void onClick(int position); } private OnItemLongClickListener longClickListener; public void setOnItemLongClickListener(OnItemLongClickListener longClickListener) { this.longClickListener = longClickListener; } }
UTF-8
Java
3,609
java
CommunityHomeAdapter.java
Java
[]
null
[]
package com.example.bistubbs.community; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.example.bistubbs.R; import java.util.List; public class CommunityHomeAdapter extends RecyclerView.Adapter<CommunityHomeAdapter.ViewHolder> { private List mList;//数据源 private List<Community> communityList; private Integer type; static final int BIG_COMMUNITY=1; static final int SMALL_COMMUNITY=2; CommunityHomeAdapter(){} CommunityHomeAdapter(List list, List<Community> commList, Integer type) { mList = list; communityList = commList; this.type = type; } //创建ViewHolder并返回,后续item布局里控件都是从ViewHolder中取出 //实现监听步骤2 @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { //将我们自定义的item布局R.layout.item_one转换为View View view = LayoutInflater.from(parent.getContext()) .inflate(R.layout.item_comm_home_big, parent, false); //将view传递给我们自定义的ViewHolder final ViewHolder holder = new ViewHolder(view); //返回这个MyHolder实体 return holder; } //通过方法提供的ViewHolder,将数据绑定到ViewHolder中 @Override public void onBindViewHolder(final ViewHolder holder, final int position) { holder.textView.setText(mList.get(position).toString()); holder.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (listener != null) { if(type == BIG_COMMUNITY){ listener.onClick(position,type); }else if(type == SMALL_COMMUNITY){ if(mList.get(position).equals("")){ listener.onClick(position,0); }else{ listener.onClick(position,1); } } } } }); holder.itemView.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { if (longClickListener != null) { longClickListener.onClick(position); } return true; } }); } //获取数据源总的条数 @Override public int getItemCount() { return mList.size(); } /** * 自定义的ViewHolder */ class ViewHolder extends RecyclerView.ViewHolder { TextView textView; public ViewHolder(View itemView) { super(itemView); textView = itemView.findViewById(R.id.tv_content); } } //实现监听步骤1: //第一步 定义接口 public interface OnItemClickListener { void onClick(int position,int type); } private OnItemClickListener listener; //第二步, 写一个公共的方法 public void setOnItemClickListener(OnItemClickListener listener) { this.listener = listener; } /* * 长按 * */ public interface OnItemLongClickListener { void onClick(int position); } private OnItemLongClickListener longClickListener; public void setOnItemLongClickListener(OnItemLongClickListener longClickListener) { this.longClickListener = longClickListener; } }
3,609
0.610635
0.608567
117
27.931623
23.578829
98
false
false
0
0
0
0
0
0
0.401709
false
false
9
0d1db5a9912f6839a8e14e09a29d0155986682ae
29,583,734,762,558
f0ff5c414454c97ef981fbd6fa71468d0101e397
/src/com/company/SumaDoI.java
7ae2a897127cc7d4af2340998097c3125f1058c2
[]
no_license
Kanakerii/JavaProgramowanie
https://github.com/Kanakerii/JavaProgramowanie
093e28dc1738d02fcfe399462289f27bbf3b3c8b
0cbd397957f06f5dafdef8ae435065918fab394c
refs/heads/master
2023-01-06T22:33:19.966000
2020-10-31T09:18:47
2020-10-31T09:18:47
308,843,030
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.company; import java.util.Scanner; public class SumaDoI { public static double Suma(int a) { double wynik = 0; for (double i = 1; i <=a; i++) { wynik= wynik+(1/i); } return wynik; } public static void main(String[] args) { Scanner scan=new Scanner(System.in); System.out.println("Podaj liczbę szeregów:"); int a= scan.nextInt(); System.out.println(Suma(a)); } }
UTF-8
Java
476
java
SumaDoI.java
Java
[]
null
[]
package com.company; import java.util.Scanner; public class SumaDoI { public static double Suma(int a) { double wynik = 0; for (double i = 1; i <=a; i++) { wynik= wynik+(1/i); } return wynik; } public static void main(String[] args) { Scanner scan=new Scanner(System.in); System.out.println("Podaj liczbę szeregów:"); int a= scan.nextInt(); System.out.println(Suma(a)); } }
476
0.550633
0.544304
22
20.545454
16.759604
53
false
false
0
0
0
0
0
0
0.5
false
false
9
6ca501016e14af28ac191d04f13fab59039b6299
19,052,474,947,418
afba1609f90a1e4efb5d58d1bd5213790e139b7d
/src/concordia/dems/helpers/ManagerAndClientInfo.java
d217f60fe4ffcc668e5d7caf0a58409dc1c508ec
[]
no_license
MayankJariwala/comp6231-webservices
https://github.com/MayankJariwala/comp6231-webservices
9e8c2edef77af41e586e513046ae16354a6fb4c6
3afc53a225626802f7caf8927dd7f8b6813ce882
refs/heads/master
2020-06-22T11:00:05.076000
2019-07-19T05:09:21
2019-07-19T05:09:21
197,703,120
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package concordia.dems.helpers; import java.util.Arrays; import java.util.List; /** * This Class is having dummy information which is use for running an * application * * @author Mayank Jariwala * @version 1.0.0 */ public class ManagerAndClientInfo { // Dummy Manager Ids public static final List<String> managersId = Arrays.asList("TORM2345", "MTLM1234", "OTWM1243", "TORM1123"); // Dummy Client Ids public static final List<String> clientsId = Arrays.asList("TORC2345", "MTLC1234", "OTWC1243", "TORC1123"); // Operations Clients can perform public static final List<String> clientOperations = Arrays.asList(EventOperation.BOOK_EVENT, EventOperation.GET_BOOKING_SCHEDULE, EventOperation.CANCEL_EVENT, EventOperation.SWAP_EVENT); // Operations Manager can perform public static final List<String> managerOperations = Arrays.asList(EventOperation.ADD_EVENT, EventOperation.REMOVE_EVENT, EventOperation.LIST_AVAILABILITY, EventOperation.BOOK_EVENT, EventOperation.GET_BOOKING_SCHEDULE, EventOperation.CANCEL_EVENT,EventOperation.SWAP_EVENT); }
UTF-8
Java
1,070
java
ManagerAndClientInfo.java
Java
[ { "context": "is use for running an\n * application\n *\n * @author Mayank Jariwala\n * @version 1.0.0\n */\npublic class ManagerAndClie", "end": 200, "score": 0.9998843669891357, "start": 185, "tag": "NAME", "value": "Mayank Jariwala" } ]
null
[]
package concordia.dems.helpers; import java.util.Arrays; import java.util.List; /** * This Class is having dummy information which is use for running an * application * * @author <NAME> * @version 1.0.0 */ public class ManagerAndClientInfo { // Dummy Manager Ids public static final List<String> managersId = Arrays.asList("TORM2345", "MTLM1234", "OTWM1243", "TORM1123"); // Dummy Client Ids public static final List<String> clientsId = Arrays.asList("TORC2345", "MTLC1234", "OTWC1243", "TORC1123"); // Operations Clients can perform public static final List<String> clientOperations = Arrays.asList(EventOperation.BOOK_EVENT, EventOperation.GET_BOOKING_SCHEDULE, EventOperation.CANCEL_EVENT, EventOperation.SWAP_EVENT); // Operations Manager can perform public static final List<String> managerOperations = Arrays.asList(EventOperation.ADD_EVENT, EventOperation.REMOVE_EVENT, EventOperation.LIST_AVAILABILITY, EventOperation.BOOK_EVENT, EventOperation.GET_BOOKING_SCHEDULE, EventOperation.CANCEL_EVENT,EventOperation.SWAP_EVENT); }
1,061
0.775701
0.742991
28
37.214287
38.319481
109
false
false
0
0
0
0
0
0
1.392857
false
false
9
f5f9e8ebcd7049deb938e67cc2713921f82ecbc0
16,217,796,510,143
78c95394af1a304f1f299afbd512bcaad5c31ddb
/study-springboot-jpa/src/main/java/com/study/springboot/jpa/service/impl/UserServiceImpl.java
2324365cada329b70009317715c3884602f39dcc
[]
no_license
zhouyuan-dev/study-springboot-parent
https://github.com/zhouyuan-dev/study-springboot-parent
db1ca72c1dbfac549758998d2cef2dd276716c1f
40191c3b2c8a12b99d628bf2b69c4ef834c088f0
refs/heads/master
2022-07-27T18:33:10.228000
2018-09-02T11:13:22
2018-09-02T11:13:22
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.study.springboot.jpa.service.impl; import com.study.springboot.jpa.dao.AccountResponsity; import com.study.springboot.jpa.dao.UserResponsity; import com.study.springboot.jpa.domin.Account; import com.study.springboot.jpa.domin.UserDO; import com.study.springboot.jpa.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; /** * @Author Andy * @Description TODO * @Date 2018/6/30 16:16 */ @Service("userService") public class UserServiceImpl implements UserService { @Autowired private UserResponsity userResponsity; @Autowired private AccountResponsity accountResponsity; @Override public void insertUser(UserDO userDo) { userResponsity.save(userDo); } @Override public UserDO queryUserById(Long id) { Account account = accountResponsity.queryById(id); return userResponsity.queryById(id); } @Transactional @Override public Integer updateUserById(Long id, String userName) { return userResponsity.updateUserById(id, userName); } @Override public List<UserDO> queryByUserName(String name, Pageable pageable) { return userResponsity.queryByUserName(name, pageable); } @Override public Long countUser() { return userResponsity.count(); } @Override public void deleteUserById(Long id) { userResponsity.deleteById(id); } }
UTF-8
Java
1,605
java
UserServiceImpl.java
Java
[ { "context": "sactional;\n\nimport java.util.List;\n\n/**\n * @Author Andy\n * @Description TODO\n * @Date 2018/6/30 16:16\n */", "end": 569, "score": 0.9937107563018799, "start": 565, "tag": "NAME", "value": "Andy" } ]
null
[]
package com.study.springboot.jpa.service.impl; import com.study.springboot.jpa.dao.AccountResponsity; import com.study.springboot.jpa.dao.UserResponsity; import com.study.springboot.jpa.domin.Account; import com.study.springboot.jpa.domin.UserDO; import com.study.springboot.jpa.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; /** * @Author Andy * @Description TODO * @Date 2018/6/30 16:16 */ @Service("userService") public class UserServiceImpl implements UserService { @Autowired private UserResponsity userResponsity; @Autowired private AccountResponsity accountResponsity; @Override public void insertUser(UserDO userDo) { userResponsity.save(userDo); } @Override public UserDO queryUserById(Long id) { Account account = accountResponsity.queryById(id); return userResponsity.queryById(id); } @Transactional @Override public Integer updateUserById(Long id, String userName) { return userResponsity.updateUserById(id, userName); } @Override public List<UserDO> queryByUserName(String name, Pageable pageable) { return userResponsity.queryByUserName(name, pageable); } @Override public Long countUser() { return userResponsity.count(); } @Override public void deleteUserById(Long id) { userResponsity.deleteById(id); } }
1,605
0.735826
0.728972
59
26.20339
22.289146
73
false
false
0
0
0
0
0
0
0.40678
false
false
9
90d6841c8d0152972a6d6e507ce3468bb3bd1807
30,940,944,469,643
cd5f9c315b1b3bb556a5c691579b5b80dfa39ca7
/app/src/main/java/au/com/gridstone/training/ImageResponse.java
68fc49636b18e479347c055f2a867d59981b04e7
[]
no_license
robynvd/Android-Training
https://github.com/robynvd/Android-Training
b2f7ebe2ec4a17743a014ef67acdcfa29ec764e6
4dbc17d47cd126b988563eb68475e18924427042
refs/heads/master
2020-12-07T02:25:39.747000
2016-08-01T03:59:07
2016-08-01T03:59:07
63,377,895
0
0
null
true
2016-07-15T00:05:35
2016-07-15T00:05:35
2016-05-10T00:31:28
2016-05-09T23:46:09
1,694
0
0
0
null
null
null
package au.com.gridstone.training; import java.util.ArrayList; /** * Created by Robyn on 20/07/2016. */ public class ImageResponse { ArrayList<Image> data; Boolean success; Integer status; }
UTF-8
Java
202
java
ImageResponse.java
Java
[ { "context": "g;\n\nimport java.util.ArrayList;\n\n/**\n * Created by Robyn on 20/07/2016.\n */\npublic class ImageResponse {\n\n", "end": 88, "score": 0.9568614959716797, "start": 83, "tag": "NAME", "value": "Robyn" } ]
null
[]
package au.com.gridstone.training; import java.util.ArrayList; /** * Created by Robyn on 20/07/2016. */ public class ImageResponse { ArrayList<Image> data; Boolean success; Integer status; }
202
0.717822
0.678218
13
14.538462
13.258469
34
false
false
0
0
0
0
0
0
0.384615
false
false
9
9a430183b91469b408c137cdfb04716a984a7ac7
9,440,338,178,254
6b20e8763f44172b476257feabcdfcb393907a0d
/tosp-web/src/main/java/com/web/rest/client/RESTAuthBean.java
4668ee480e767987fcde58ea7df50f8599c757cb
[]
no_license
armdev/tosptube
https://github.com/armdev/tosptube
2b677d3ef17868bf79816215ecd397cd4761b2ab
7c7fec2db01dde32b3f41147ac87eedd1be123f5
refs/heads/master
2022-11-19T11:46:45.961000
2019-06-02T14:38:25
2019-06-02T14:38:25
90,982,145
4
4
null
false
2022-11-16T07:29:54
2017-05-11T13:26:40
2020-07-23T06:28:22
2022-11-16T07:29:51
235,682
4
4
5
JavaScript
false
false
package com.web.rest.client; import com.web.jsf.dto.UserModel; import java.io.IOException; import java.io.Serializable; import java.util.logging.Level; import javax.annotation.PostConstruct; import javax.faces.bean.ApplicationScoped; import javax.faces.bean.ManagedBean; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.ParseException; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; import org.codehaus.jackson.map.ObjectMapper; import org.json.simple.JSONObject; @ManagedBean(eager = true, name = "restAuthBean") @ApplicationScoped public class RESTAuthBean implements Serializable { private static final long serialVersionUID = 1L; private final String SERVICE_PATH = "http://localhost:9900/auth/user/"; public RESTAuthBean() { } @PostConstruct public void init() { // System.out.println("RESTAuthBean called"); } public static void main(String args[]) { RESTAuthBean obj = new RESTAuthBean(); UserModel model = new UserModel(); model.setPassword("aaaaaa"); model.setUsername("cdawefrkkyyegelos"); model.setEmail("carlodswefgeyyrk@mail.ru"); model.setFirstname("Hdafrloks"); model.setLastname("HarlfweoskLastname"); UserModel userId = obj.saveUser(model); // System.out.println("userId.getUserId() " + userId.getUserId()); UserModel newModel = obj.getUserById(userId.getUserId()); // System.out.println("newModel " + newModel.toString()); UserModel newModel1 = obj.getUserByEmail(newModel.getEmail()); obj.userLogin(newModel1); } public UserModel saveUser(UserModel model) { CloseableHttpClient CLIENT = HttpClients.createDefault(); // String userId = null; try { HttpPost request = new HttpPost(SERVICE_PATH + "register"); JSONObject json = new JSONObject(); json.put("firstname", model.getFirstname()); json.put("lastname", model.getLastname()); json.put("email", model.getEmail()); json.put("password", model.getPassword()); json.put("username", model.getUsername()); StringEntity params = new StringEntity(json.toString(), "UTF-8"); request.addHeader("content-type", "application/json;charset=UTF-8"); request.addHeader("charset", "UTF-8"); request.setEntity(params); HttpResponse response = (HttpResponse) CLIENT.execute(request); HttpEntity entity = response.getEntity(); // userId = (EntityUtils.toString(entity)); ObjectMapper mapper = new ObjectMapper(); model = mapper.readValue((EntityUtils.toString(entity)), UserModel.class); } catch (IOException | ParseException ex) { try { CLIENT.close(); } catch (IOException ex1) { java.util.logging.Logger.getLogger(RESTAuthBean.class.getName()).log(Level.SEVERE, null, ex1); } } finally { try { CLIENT.close(); } catch (IOException ex1) { java.util.logging.Logger.getLogger(RESTAuthBean.class.getName()).log(Level.SEVERE, null, ex1); } } return model; } public UserModel getUserById(String userId) { UserModel userModel = new UserModel(); CloseableHttpClient CLIENT = HttpClients.createDefault(); try { HttpGet request = new HttpGet(SERVICE_PATH + "find/" + userId); request.addHeader("charset", "UTF-8"); HttpResponse response = CLIENT.execute(request); response.addHeader("content-type", "application/json;charset=UTF-8"); HttpEntity entity = response.getEntity(); ObjectMapper mapper = new ObjectMapper(); userModel = mapper.readValue((EntityUtils.toString(entity)), UserModel.class); } catch (IOException | ParseException ex) { try { CLIENT.close(); } catch (IOException ex1) { java.util.logging.Logger.getLogger(RESTAuthBean.class.getName()).log(Level.SEVERE, null, ex1); } } finally { try { CLIENT.close(); } catch (IOException ex1) { java.util.logging.Logger.getLogger(RESTAuthBean.class.getName()).log(Level.SEVERE, null, ex1); } } return userModel; } public UserModel getUserByEmail(String email) { UserModel userModel = null; CloseableHttpClient CLIENT = HttpClients.createDefault(); try { HttpGet request = new HttpGet(SERVICE_PATH + "find/email/" + email); request.addHeader("charset", "UTF-8"); HttpResponse response = CLIENT.execute(request); response.addHeader("content-type", "application/json;charset=UTF-8"); HttpEntity entity = response.getEntity(); ObjectMapper mapper = new ObjectMapper(); userModel = mapper.readValue((EntityUtils.toString(entity)), UserModel.class); } catch (IOException | ParseException ex) { try { CLIENT.close(); } catch (IOException ex1) { java.util.logging.Logger.getLogger(RESTAuthBean.class.getName()).log(Level.SEVERE, null, ex1); } } finally { try { CLIENT.close(); } catch (IOException ex1) { java.util.logging.Logger.getLogger(RESTAuthBean.class.getName()).log(Level.SEVERE, null, ex1); } } return userModel; } public UserModel getUserByUsername(String username) { UserModel userModel = new UserModel(); CloseableHttpClient CLIENT = HttpClients.createDefault(); try { HttpGet request = new HttpGet(SERVICE_PATH + "find/username/" + username); request.addHeader("charset", "UTF-8"); HttpResponse response = CLIENT.execute(request); response.addHeader("content-type", "application/json;charset=UTF-8"); HttpEntity entity = response.getEntity(); ObjectMapper mapper = new ObjectMapper(); userModel = mapper.readValue((EntityUtils.toString(entity)), UserModel.class); } catch (IOException | ParseException ex) { try { CLIENT.close(); } catch (IOException ex1) { java.util.logging.Logger.getLogger(RESTAuthBean.class.getName()).log(Level.SEVERE, null, ex1); } } finally { try { CLIENT.close(); } catch (IOException ex1) { java.util.logging.Logger.getLogger(RESTAuthBean.class.getName()).log(Level.SEVERE, null, ex1); } } return userModel; } public UserModel userLogin(UserModel model) { CloseableHttpClient CLIENT = HttpClients.createDefault(); UserModel userModel = null; try { HttpPost request = new HttpPost(SERVICE_PATH + "login"); JSONObject json = new JSONObject(); json.put("password", model.getPassword()); json.put("email", model.getEmail()); StringEntity params = new StringEntity(json.toString(), "UTF-8"); request.addHeader("content-type", "application/json"); request.addHeader("charset", "UTF-8"); request.setEntity(params); HttpResponse response = (HttpResponse) CLIENT.execute(request); HttpEntity entity = response.getEntity(); ObjectMapper mapper = new ObjectMapper(); userModel = mapper.readValue((EntityUtils.toString(entity)), UserModel.class); System.out.println("userModel after login " + userModel.toString()); } catch (IOException | ParseException ex) { try { CLIENT.close(); } catch (IOException ex1) { java.util.logging.Logger.getLogger(RESTAuthBean.class.getName()).log(Level.SEVERE, null, ex1); } } finally { try { CLIENT.close(); } catch (IOException ex1) { java.util.logging.Logger.getLogger(RESTAuthBean.class.getName()).log(Level.SEVERE, null, ex1); } } return userModel; } }
UTF-8
Java
8,669
java
RESTAuthBean.java
Java
[ { "context": "del = new UserModel();\n model.setPassword(\"aaaaaa\");\n model.setUsername(\"cdawefrkkyyegelos\")", "end": 1311, "score": 0.9992084503173828, "start": 1305, "tag": "PASSWORD", "value": "aaaaaa" }, { "context": "setPassword(\"aaaaaa\");\n model.setU...
null
[]
package com.web.rest.client; import com.web.jsf.dto.UserModel; import java.io.IOException; import java.io.Serializable; import java.util.logging.Level; import javax.annotation.PostConstruct; import javax.faces.bean.ApplicationScoped; import javax.faces.bean.ManagedBean; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.ParseException; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; import org.codehaus.jackson.map.ObjectMapper; import org.json.simple.JSONObject; @ManagedBean(eager = true, name = "restAuthBean") @ApplicationScoped public class RESTAuthBean implements Serializable { private static final long serialVersionUID = 1L; private final String SERVICE_PATH = "http://localhost:9900/auth/user/"; public RESTAuthBean() { } @PostConstruct public void init() { // System.out.println("RESTAuthBean called"); } public static void main(String args[]) { RESTAuthBean obj = new RESTAuthBean(); UserModel model = new UserModel(); model.setPassword("<PASSWORD>"); model.setUsername("cdawefrkkyyegelos"); model.setEmail("<EMAIL>"); model.setFirstname("Hdafrloks"); model.setLastname("HarlfweoskLastname"); UserModel userId = obj.saveUser(model); // System.out.println("userId.getUserId() " + userId.getUserId()); UserModel newModel = obj.getUserById(userId.getUserId()); // System.out.println("newModel " + newModel.toString()); UserModel newModel1 = obj.getUserByEmail(newModel.getEmail()); obj.userLogin(newModel1); } public UserModel saveUser(UserModel model) { CloseableHttpClient CLIENT = HttpClients.createDefault(); // String userId = null; try { HttpPost request = new HttpPost(SERVICE_PATH + "register"); JSONObject json = new JSONObject(); json.put("firstname", model.getFirstname()); json.put("lastname", model.getLastname()); json.put("email", model.getEmail()); json.put("password", model.<PASSWORD>()); json.put("username", model.getUsername()); StringEntity params = new StringEntity(json.toString(), "UTF-8"); request.addHeader("content-type", "application/json;charset=UTF-8"); request.addHeader("charset", "UTF-8"); request.setEntity(params); HttpResponse response = (HttpResponse) CLIENT.execute(request); HttpEntity entity = response.getEntity(); // userId = (EntityUtils.toString(entity)); ObjectMapper mapper = new ObjectMapper(); model = mapper.readValue((EntityUtils.toString(entity)), UserModel.class); } catch (IOException | ParseException ex) { try { CLIENT.close(); } catch (IOException ex1) { java.util.logging.Logger.getLogger(RESTAuthBean.class.getName()).log(Level.SEVERE, null, ex1); } } finally { try { CLIENT.close(); } catch (IOException ex1) { java.util.logging.Logger.getLogger(RESTAuthBean.class.getName()).log(Level.SEVERE, null, ex1); } } return model; } public UserModel getUserById(String userId) { UserModel userModel = new UserModel(); CloseableHttpClient CLIENT = HttpClients.createDefault(); try { HttpGet request = new HttpGet(SERVICE_PATH + "find/" + userId); request.addHeader("charset", "UTF-8"); HttpResponse response = CLIENT.execute(request); response.addHeader("content-type", "application/json;charset=UTF-8"); HttpEntity entity = response.getEntity(); ObjectMapper mapper = new ObjectMapper(); userModel = mapper.readValue((EntityUtils.toString(entity)), UserModel.class); } catch (IOException | ParseException ex) { try { CLIENT.close(); } catch (IOException ex1) { java.util.logging.Logger.getLogger(RESTAuthBean.class.getName()).log(Level.SEVERE, null, ex1); } } finally { try { CLIENT.close(); } catch (IOException ex1) { java.util.logging.Logger.getLogger(RESTAuthBean.class.getName()).log(Level.SEVERE, null, ex1); } } return userModel; } public UserModel getUserByEmail(String email) { UserModel userModel = null; CloseableHttpClient CLIENT = HttpClients.createDefault(); try { HttpGet request = new HttpGet(SERVICE_PATH + "find/email/" + email); request.addHeader("charset", "UTF-8"); HttpResponse response = CLIENT.execute(request); response.addHeader("content-type", "application/json;charset=UTF-8"); HttpEntity entity = response.getEntity(); ObjectMapper mapper = new ObjectMapper(); userModel = mapper.readValue((EntityUtils.toString(entity)), UserModel.class); } catch (IOException | ParseException ex) { try { CLIENT.close(); } catch (IOException ex1) { java.util.logging.Logger.getLogger(RESTAuthBean.class.getName()).log(Level.SEVERE, null, ex1); } } finally { try { CLIENT.close(); } catch (IOException ex1) { java.util.logging.Logger.getLogger(RESTAuthBean.class.getName()).log(Level.SEVERE, null, ex1); } } return userModel; } public UserModel getUserByUsername(String username) { UserModel userModel = new UserModel(); CloseableHttpClient CLIENT = HttpClients.createDefault(); try { HttpGet request = new HttpGet(SERVICE_PATH + "find/username/" + username); request.addHeader("charset", "UTF-8"); HttpResponse response = CLIENT.execute(request); response.addHeader("content-type", "application/json;charset=UTF-8"); HttpEntity entity = response.getEntity(); ObjectMapper mapper = new ObjectMapper(); userModel = mapper.readValue((EntityUtils.toString(entity)), UserModel.class); } catch (IOException | ParseException ex) { try { CLIENT.close(); } catch (IOException ex1) { java.util.logging.Logger.getLogger(RESTAuthBean.class.getName()).log(Level.SEVERE, null, ex1); } } finally { try { CLIENT.close(); } catch (IOException ex1) { java.util.logging.Logger.getLogger(RESTAuthBean.class.getName()).log(Level.SEVERE, null, ex1); } } return userModel; } public UserModel userLogin(UserModel model) { CloseableHttpClient CLIENT = HttpClients.createDefault(); UserModel userModel = null; try { HttpPost request = new HttpPost(SERVICE_PATH + "login"); JSONObject json = new JSONObject(); json.put("password", <PASSWORD>()); json.put("email", model.getEmail()); StringEntity params = new StringEntity(json.toString(), "UTF-8"); request.addHeader("content-type", "application/json"); request.addHeader("charset", "UTF-8"); request.setEntity(params); HttpResponse response = (HttpResponse) CLIENT.execute(request); HttpEntity entity = response.getEntity(); ObjectMapper mapper = new ObjectMapper(); userModel = mapper.readValue((EntityUtils.toString(entity)), UserModel.class); System.out.println("userModel after login " + userModel.toString()); } catch (IOException | ParseException ex) { try { CLIENT.close(); } catch (IOException ex1) { java.util.logging.Logger.getLogger(RESTAuthBean.class.getName()).log(Level.SEVERE, null, ex1); } } finally { try { CLIENT.close(); } catch (IOException ex1) { java.util.logging.Logger.getLogger(RESTAuthBean.class.getName()).log(Level.SEVERE, null, ex1); } } return userModel; } }
8,648
0.607913
0.60353
217
38.94931
28.582684
110
false
false
0
0
0
0
0
0
0.801843
false
false
9
e8fce9efe004bc5cc40c0e48e3898d8ff2f33fd1
18,038,862,671,065
bb0fe42a60a829083e37414579ab5716ae20c840
/src/br/com/battlebits/commons/util/string/AnimatedString.java
17d613bab12c4fc493083b1a98202c99480f2156
[]
no_license
peytondodd/Commons
https://github.com/peytondodd/Commons
cab26e0e476e1013023a072c6fcf6830cb3c4278
d230df5c9f52f3a5bf7d382a74f351a1259bbef1
refs/heads/master
2020-04-04T21:47:44.156000
2017-05-27T06:28:05
2017-05-27T06:28:05
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.com.battlebits.commons.util.string; import java.util.ArrayList; import java.util.List; /** * Arquivo criado em 29/03/2017. * Desenvolvido por: * * @author Luăn Pereira. */ public class AnimatedString { private String text; private List<String> frames; private int position; public AnimatedString(String text, String c1, String c2, String c3) { this(text, c1, c2, c3, 12); } public AnimatedString(String text, String c1, String c2, String c3, int p) { this.text = text; this.frames = new ArrayList<>(); createFrames(c1, c2, c3, p); } public void createFrames(String c1, String c2, String c3, int p) { if (text != null && !text.isEmpty()) { for (int i = 0; i < text.length(); i++) if (text.charAt(i) != ' ') frames.add(c1 + text.substring(0,i) + c2 + text.charAt(i) + c3 + text.substring(i+1)); for (int i = 0; i < p; i++) frames.add(c1 + text); for (int i = 0; i < text.length(); i++) if (text.charAt(i) != ' ') frames.add(c3 + text.substring(0,i) + c2 + text.charAt(i) + c1 + text.substring(i+1)); for (int i = 0; i < p; i++) frames.add(c3 + text); } } private boolean finished; public String next() { if (frames.isEmpty()) return ""; if (finished) { position--; if (position <= 0) finished = false; } else { position++; if (position >= frames.size()) { finished = true; return next(); } } return frames.get(position); } }
WINDOWS-1250
Java
1,815
java
AnimatedString.java
Java
[ { "context": " 29/03/2017.\r\n * Desenvolvido por:\r\n *\r\n * @author Luăn Pereira.\r\n */\r\npublic class AnimatedString {\r\n\r\n priva", "end": 193, "score": 0.9998867511749268, "start": 181, "tag": "NAME", "value": "Luăn Pereira" } ]
null
[]
package br.com.battlebits.commons.util.string; import java.util.ArrayList; import java.util.List; /** * Arquivo criado em 29/03/2017. * Desenvolvido por: * * @author <NAME>. */ public class AnimatedString { private String text; private List<String> frames; private int position; public AnimatedString(String text, String c1, String c2, String c3) { this(text, c1, c2, c3, 12); } public AnimatedString(String text, String c1, String c2, String c3, int p) { this.text = text; this.frames = new ArrayList<>(); createFrames(c1, c2, c3, p); } public void createFrames(String c1, String c2, String c3, int p) { if (text != null && !text.isEmpty()) { for (int i = 0; i < text.length(); i++) if (text.charAt(i) != ' ') frames.add(c1 + text.substring(0,i) + c2 + text.charAt(i) + c3 + text.substring(i+1)); for (int i = 0; i < p; i++) frames.add(c1 + text); for (int i = 0; i < text.length(); i++) if (text.charAt(i) != ' ') frames.add(c3 + text.substring(0,i) + c2 + text.charAt(i) + c1 + text.substring(i+1)); for (int i = 0; i < p; i++) frames.add(c3 + text); } } private boolean finished; public String next() { if (frames.isEmpty()) return ""; if (finished) { position--; if (position <= 0) finished = false; } else { position++; if (position >= frames.size()) { finished = true; return next(); } } return frames.get(position); } }
1,808
0.484013
0.46086
66
25.484848
23.739904
106
false
false
0
0
0
0
0
0
0.863636
false
false
9
64238c00b112df386cbd839aa39b13b3374e9bf0
25,520,695,703,651
caa7080f5df142d8dd48c29ff3db10b2fa98bb48
/src/gen/java/com/amartus/yang/sdwan/model/tapi/path/computation/PathOptimizationConstraint.java
ffadd46ab291ffde0a8a2e7f0834ac6bc92e061d
[ "Apache-2.0" ]
permissive
bartoszm/sd-wan-presto-server-stub-example
https://github.com/bartoszm/sd-wan-presto-server-stub-example
4b2f0a13d32f9d1527fe47bfead38c5e3c007c8c
d30effea27790edd03633a6784d79acf97cc45be
refs/heads/master
2020-04-03T17:00:14.752000
2018-10-30T17:25:03
2018-10-30T17:27:53
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.amartus.yang.sdwan.model.tapi.path.computation; import java.util.Objects; import com.amartus.yang.sdwan.model.tapi.common.DirectiveValue; import com.amartus.yang.sdwan.model.tapi.common.LocalClass; import com.amartus.yang.sdwan.model.tapi.common.NameAndValue; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; /** * PathOptimizationConstraint */ @javax.annotation.Generated(value = "class com.mrv.yangutils.codegen.JerseyServerCodegen", date = "2018-10-26T16:19:33.232+02:00") public class PathOptimizationConstraint extends com.amartus.yang.sdwan.model.tapi.common.LocalClass { private DirectiveValue trafficInterruption = null; public PathOptimizationConstraint trafficInterruption(DirectiveValue trafficInterruption) { this.trafficInterruption = trafficInterruption; return this; } /** * none * @return trafficInterruption **/ @ApiModelProperty(value = "none") @JsonProperty("traffic-interruption") public DirectiveValue getTrafficInterruption() { return trafficInterruption; } public void setTrafficInterruption(DirectiveValue trafficInterruption) { this.trafficInterruption = trafficInterruption; } @Override public boolean equals(java.lang.Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PathOptimizationConstraint tapiPathComputationPathOptimizationConstraint = (PathOptimizationConstraint) o; return Objects.equals(this.trafficInterruption, tapiPathComputationPathOptimizationConstraint.trafficInterruption) && super.equals(o); } @Override public int hashCode() { return Objects.hash(trafficInterruption, super.hashCode()); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class PathOptimizationConstraint {\n"); sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" trafficInterruption: ").append(toIndentedString(trafficInterruption)).append("\n"); sb.append("}"); return sb.toString(); } /** * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } }
UTF-8
Java
2,572
java
PathOptimizationConstraint.java
Java
[]
null
[]
package com.amartus.yang.sdwan.model.tapi.path.computation; import java.util.Objects; import com.amartus.yang.sdwan.model.tapi.common.DirectiveValue; import com.amartus.yang.sdwan.model.tapi.common.LocalClass; import com.amartus.yang.sdwan.model.tapi.common.NameAndValue; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; /** * PathOptimizationConstraint */ @javax.annotation.Generated(value = "class com.mrv.yangutils.codegen.JerseyServerCodegen", date = "2018-10-26T16:19:33.232+02:00") public class PathOptimizationConstraint extends com.amartus.yang.sdwan.model.tapi.common.LocalClass { private DirectiveValue trafficInterruption = null; public PathOptimizationConstraint trafficInterruption(DirectiveValue trafficInterruption) { this.trafficInterruption = trafficInterruption; return this; } /** * none * @return trafficInterruption **/ @ApiModelProperty(value = "none") @JsonProperty("traffic-interruption") public DirectiveValue getTrafficInterruption() { return trafficInterruption; } public void setTrafficInterruption(DirectiveValue trafficInterruption) { this.trafficInterruption = trafficInterruption; } @Override public boolean equals(java.lang.Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PathOptimizationConstraint tapiPathComputationPathOptimizationConstraint = (PathOptimizationConstraint) o; return Objects.equals(this.trafficInterruption, tapiPathComputationPathOptimizationConstraint.trafficInterruption) && super.equals(o); } @Override public int hashCode() { return Objects.hash(trafficInterruption, super.hashCode()); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class PathOptimizationConstraint {\n"); sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" trafficInterruption: ").append(toIndentedString(trafficInterruption)).append("\n"); sb.append("}"); return sb.toString(); } /** * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } }
2,572
0.732504
0.72395
82
30.353659
31.564247
130
false
false
0
0
0
0
0
0
0.426829
false
false
9
3de222516e8763cffec42b8cceba2ec1d1a0753a
9,079,560,913,283
ca21aced7412ba5fe94032dc260844035396b31b
/src/main/java/agent/behaviour/energyconstrained/subbehaviours/behaviours/MoveToDestination.java
0cbcd18101f1c12e867687648b9eb75a6a0b012e
[]
no_license
jessegeens/mas-project1
https://github.com/jessegeens/mas-project1
6d45e665165c3c7b919b2827e8c84be23d94d4e7
3097ac376b3299a0b7f1d527be8ab10cdc818b48
refs/heads/master
2023-04-19T22:43:25.279000
2021-05-05T20:59:13
2021-05-05T20:59:13
347,040,333
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package agent.behaviour.energyconstrained.subbehaviours.behaviours; import agent.AgentImp; import agent.behaviour.LTDBehaviour; import environment.Coordinate; import environment.Perception; import agent.behaviour.energyconstrained.CommunicateDropoff; import java.util.*; import java.util.List; /** * This behaviour makes an agent move to a destination that is set in memory. He uses a simple path-finding algorithm * that always takes the cell closest to the destination. This works as there are no "obstacles" so cells in a path * always have a monotonically decreasing distance to the destination (unless there are packets in the way, and in this * case we use "loop detection": if the agent oscillates between two positions, we make him move randomly. */ public class MoveToDestination extends LTDBehaviour { @Override public void act(AgentImp agent) { moveTo(agent, Coordinate.fromString(agent.getMemoryFragment(AgentImp.DESTINATION_KEY))); } @Override public void communicate(AgentImp agent) { CommunicateDropoff.communicateDropOff(agent); } private final static List<Coordinate> POSSIBLE_MOVES = new ArrayList<Coordinate>(List.of( new Coordinate(1, 1), new Coordinate(-1, -1), new Coordinate(1, 0), new Coordinate(-1, 0), new Coordinate(0, 1), new Coordinate(0, -1), new Coordinate(1, -1), new Coordinate(-1, 1) )); /** * This is the main method of this behaviour. * First, a "best move" is calculated. This is the move that makes the agent move to a walkable cell with the lowest * distance to the destination of the options. Then, if there is a "best move", the agent moves there. * Finally, there is a "loop detection" check, where we check that an agent does not keep moving back and forth. * If it is true, a boolean is set in memory that will make the agent move randomly */ private void moveTo(AgentImp agent, Coordinate destination) { var perception = agent.getPerception(); Coordinate agentCoord = new Coordinate(agent.getX(), agent.getY()); Coordinate currentBestMove = null; for (var move : POSSIBLE_MOVES) { int x = move.getX(); int y = move.getY(); if (perception.getCellPerceptionOnRelPos(x, y) != null && perception.getCellPerceptionOnRelPos(x, y).isWalkable()) { if (currentBestMove == null) currentBestMove = move; else if (isCloser(Coordinate.getSum(agentCoord, move), Coordinate.getSum(agentCoord, currentBestMove), destination)) currentBestMove = move; } } if (currentBestMove == null) agent.skip(); else { Coordinate newCoord = new Coordinate(agent.getX() + currentBestMove.getX(), agent.getY() + currentBestMove.getY()); if (agent.getLastArea() != null && newCoord.equalsCoordinate(new Coordinate(agent.getLastArea().getX(), agent.getLastArea().getY()))) { agent.addMemoryFragment(AgentImp.LOOP_DETECTION_KEY, "true"); } agent.step(agent.getX() + currentBestMove.getX(), agent.getY() + currentBestMove.getY()); } } /** * @return true iff `first` is closer to `dest` than `second` */ private boolean isCloser(Coordinate first, Coordinate second, Coordinate dest) { if (first == null) return false; else if (second == null) return true; else { int distDestToFirst = Perception.distance(dest.getX(), dest.getY(), first.getX(), first.getY()); int distDestToSecond = Perception.distance(dest.getX(), dest.getY(), second.getX(), second.getY()); return distDestToFirst < distDestToSecond; } } }
UTF-8
Java
3,786
java
MoveToDestination.java
Java
[]
null
[]
package agent.behaviour.energyconstrained.subbehaviours.behaviours; import agent.AgentImp; import agent.behaviour.LTDBehaviour; import environment.Coordinate; import environment.Perception; import agent.behaviour.energyconstrained.CommunicateDropoff; import java.util.*; import java.util.List; /** * This behaviour makes an agent move to a destination that is set in memory. He uses a simple path-finding algorithm * that always takes the cell closest to the destination. This works as there are no "obstacles" so cells in a path * always have a monotonically decreasing distance to the destination (unless there are packets in the way, and in this * case we use "loop detection": if the agent oscillates between two positions, we make him move randomly. */ public class MoveToDestination extends LTDBehaviour { @Override public void act(AgentImp agent) { moveTo(agent, Coordinate.fromString(agent.getMemoryFragment(AgentImp.DESTINATION_KEY))); } @Override public void communicate(AgentImp agent) { CommunicateDropoff.communicateDropOff(agent); } private final static List<Coordinate> POSSIBLE_MOVES = new ArrayList<Coordinate>(List.of( new Coordinate(1, 1), new Coordinate(-1, -1), new Coordinate(1, 0), new Coordinate(-1, 0), new Coordinate(0, 1), new Coordinate(0, -1), new Coordinate(1, -1), new Coordinate(-1, 1) )); /** * This is the main method of this behaviour. * First, a "best move" is calculated. This is the move that makes the agent move to a walkable cell with the lowest * distance to the destination of the options. Then, if there is a "best move", the agent moves there. * Finally, there is a "loop detection" check, where we check that an agent does not keep moving back and forth. * If it is true, a boolean is set in memory that will make the agent move randomly */ private void moveTo(AgentImp agent, Coordinate destination) { var perception = agent.getPerception(); Coordinate agentCoord = new Coordinate(agent.getX(), agent.getY()); Coordinate currentBestMove = null; for (var move : POSSIBLE_MOVES) { int x = move.getX(); int y = move.getY(); if (perception.getCellPerceptionOnRelPos(x, y) != null && perception.getCellPerceptionOnRelPos(x, y).isWalkable()) { if (currentBestMove == null) currentBestMove = move; else if (isCloser(Coordinate.getSum(agentCoord, move), Coordinate.getSum(agentCoord, currentBestMove), destination)) currentBestMove = move; } } if (currentBestMove == null) agent.skip(); else { Coordinate newCoord = new Coordinate(agent.getX() + currentBestMove.getX(), agent.getY() + currentBestMove.getY()); if (agent.getLastArea() != null && newCoord.equalsCoordinate(new Coordinate(agent.getLastArea().getX(), agent.getLastArea().getY()))) { agent.addMemoryFragment(AgentImp.LOOP_DETECTION_KEY, "true"); } agent.step(agent.getX() + currentBestMove.getX(), agent.getY() + currentBestMove.getY()); } } /** * @return true iff `first` is closer to `dest` than `second` */ private boolean isCloser(Coordinate first, Coordinate second, Coordinate dest) { if (first == null) return false; else if (second == null) return true; else { int distDestToFirst = Perception.distance(dest.getX(), dest.getY(), first.getX(), first.getY()); int distDestToSecond = Perception.distance(dest.getX(), dest.getY(), second.getX(), second.getY()); return distDestToFirst < distDestToSecond; } } }
3,786
0.665874
0.661648
81
45.753086
41.802456
147
false
false
0
0
0
0
0
0
0.876543
false
false
9
07012cfc1023ddff4c5eae2a30947a0425a99ea0
13,383,118,112,672
5aabc84ca07eada784bb7216b18b2e215a78ed1f
/src/main/java/l2/gameserver/network/l2/c2s/RequestExMPCCAcceptJoin.java
5a333c3105809acb32da3fb408ac5a69cbe9f153
[]
no_license
nikolajjakubets/interlude
https://github.com/nikolajjakubets/interlude
b0995a50f9846c29fbf2425022754c68daef672c
f481acf5aa2abcb733350ed61d6f0e81d1dcca00
refs/heads/master
2020-12-06T11:33:55.308000
2020-06-05T23:35:05
2020-06-05T23:35:05
232,452,482
0
0
null
true
2020-01-08T01:37:47
2020-01-08T01:37:46
2019-12-25T11:35:25
2019-12-29T00:15:05
194,028
0
0
0
null
false
false
// // Source code recreated from a .class file by IntelliJ IDEA // (powered by Fernflower decompiler) // package l2.gameserver.network.l2.c2s; import l2.gameserver.cache.Msg; import l2.gameserver.model.CommandChannel; import l2.gameserver.model.Player; import l2.gameserver.model.Request; import l2.gameserver.model.Request.L2RequestType; import l2.gameserver.network.l2.GameClient; import l2.gameserver.network.l2.s2c.SystemMessage; import l2.gameserver.network.l2.s2c.SystemMessage2; public class RequestExMPCCAcceptJoin extends L2GameClientPacket { private int _response; private int _unk; public RequestExMPCCAcceptJoin() { } protected void readImpl() { this._response = this._buf.hasRemaining() ? this.readD() : 0; this._unk = this._buf.hasRemaining() ? this.readD() : 0; } protected void runImpl() { Player activeChar = ((GameClient)this.getClient()).getActiveChar(); if (activeChar != null) { Request request = activeChar.getRequest(); if (request != null && request.isTypeOf(L2RequestType.CHANNEL)) { if (!request.isInProgress()) { request.cancel(); activeChar.sendActionFailed(); } else if (activeChar.isOutOfControl()) { request.cancel(); activeChar.sendActionFailed(); } else { Player requestor = request.getRequestor(); if (requestor == null) { request.cancel(); activeChar.sendPacket(Msg.THAT_PLAYER_IS_NOT_ONLINE); activeChar.sendActionFailed(); } else if (requestor.getRequest() != request) { request.cancel(); activeChar.sendActionFailed(); } else if (this._response == 0) { request.cancel(); requestor.sendPacket((new SystemMessage(1680)).addString(activeChar.getName())); } else if (requestor.isInParty() && activeChar.isInParty() && !activeChar.getParty().isInCommandChannel()) { if (activeChar.isTeleporting()) { request.cancel(); activeChar.sendPacket(Msg.YOU_CANNOT_JOIN_A_COMMAND_CHANNEL_WHILE_TELEPORTING); requestor.sendPacket(Msg.NO_USER_HAS_BEEN_INVITED_TO_THE_COMMAND_CHANNEL); } else { try { if (requestor.getParty().isInCommandChannel()) { requestor.getParty().getCommandChannel().addParty(activeChar.getParty()); return; } if (!CommandChannel.checkAuthority(requestor)) { return; } boolean haveSkill = requestor.getSkillLevel(391) > 0; boolean haveItem = false; if (!haveSkill && (haveItem = requestor.getInventory().destroyItemByItemId(8871, 1L))) { requestor.sendPacket(SystemMessage2.removeItems(8871, 1L)); } if (haveSkill || haveItem) { CommandChannel channel = new CommandChannel(requestor); requestor.sendPacket(Msg.THE_COMMAND_CHANNEL_HAS_BEEN_FORMED); channel.addParty(activeChar.getParty()); return; } } finally { request.done(); } } } else { request.cancel(); requestor.sendPacket(Msg.NO_USER_HAS_BEEN_INVITED_TO_THE_COMMAND_CHANNEL); } } } } } }
UTF-8
Java
3,443
java
RequestExMPCCAcceptJoin.java
Java
[]
null
[]
// // Source code recreated from a .class file by IntelliJ IDEA // (powered by Fernflower decompiler) // package l2.gameserver.network.l2.c2s; import l2.gameserver.cache.Msg; import l2.gameserver.model.CommandChannel; import l2.gameserver.model.Player; import l2.gameserver.model.Request; import l2.gameserver.model.Request.L2RequestType; import l2.gameserver.network.l2.GameClient; import l2.gameserver.network.l2.s2c.SystemMessage; import l2.gameserver.network.l2.s2c.SystemMessage2; public class RequestExMPCCAcceptJoin extends L2GameClientPacket { private int _response; private int _unk; public RequestExMPCCAcceptJoin() { } protected void readImpl() { this._response = this._buf.hasRemaining() ? this.readD() : 0; this._unk = this._buf.hasRemaining() ? this.readD() : 0; } protected void runImpl() { Player activeChar = ((GameClient)this.getClient()).getActiveChar(); if (activeChar != null) { Request request = activeChar.getRequest(); if (request != null && request.isTypeOf(L2RequestType.CHANNEL)) { if (!request.isInProgress()) { request.cancel(); activeChar.sendActionFailed(); } else if (activeChar.isOutOfControl()) { request.cancel(); activeChar.sendActionFailed(); } else { Player requestor = request.getRequestor(); if (requestor == null) { request.cancel(); activeChar.sendPacket(Msg.THAT_PLAYER_IS_NOT_ONLINE); activeChar.sendActionFailed(); } else if (requestor.getRequest() != request) { request.cancel(); activeChar.sendActionFailed(); } else if (this._response == 0) { request.cancel(); requestor.sendPacket((new SystemMessage(1680)).addString(activeChar.getName())); } else if (requestor.isInParty() && activeChar.isInParty() && !activeChar.getParty().isInCommandChannel()) { if (activeChar.isTeleporting()) { request.cancel(); activeChar.sendPacket(Msg.YOU_CANNOT_JOIN_A_COMMAND_CHANNEL_WHILE_TELEPORTING); requestor.sendPacket(Msg.NO_USER_HAS_BEEN_INVITED_TO_THE_COMMAND_CHANNEL); } else { try { if (requestor.getParty().isInCommandChannel()) { requestor.getParty().getCommandChannel().addParty(activeChar.getParty()); return; } if (!CommandChannel.checkAuthority(requestor)) { return; } boolean haveSkill = requestor.getSkillLevel(391) > 0; boolean haveItem = false; if (!haveSkill && (haveItem = requestor.getInventory().destroyItemByItemId(8871, 1L))) { requestor.sendPacket(SystemMessage2.removeItems(8871, 1L)); } if (haveSkill || haveItem) { CommandChannel channel = new CommandChannel(requestor); requestor.sendPacket(Msg.THE_COMMAND_CHANNEL_HAS_BEEN_FORMED); channel.addParty(activeChar.getParty()); return; } } finally { request.done(); } } } else { request.cancel(); requestor.sendPacket(Msg.NO_USER_HAS_BEEN_INVITED_TO_THE_COMMAND_CHANNEL); } } } } } }
3,443
0.594249
0.582051
93
36.021507
27.504047
118
false
false
0
0
0
0
0
0
0.505376
false
false
9
14f2763b4105bb4474bee97eead28dc236681cca
12,266,426,615,845
e6ee845cfcc072cc178e1e3f29c2218dda421ac7
/surrounded_regions/Solution.java
322a8f577296590a6ae037b81c97e07733d728ad
[]
no_license
river06/leetcode2
https://github.com/river06/leetcode2
184643124944bcd35d6ba6bbab1199eeee043136
ad6d69ae3968b049f1b17f1b465533a24183e885
refs/heads/master
2021-01-21T02:11:13.199000
2018-02-02T05:21:40
2018-02-02T05:21:40
30,609,007
1
2
null
null
null
null
null
null
null
null
null
null
null
null
null
class Solution { public void solve(char[][] board) { if (board == null || board.length == 0 || board[0].length == 0) { return; } int m = board.length; int n = board[0].length; int[][] dir = {{1, 0}, {0, 1}}; UnionFind uf = new UnionFind(m, n); for (int i=0; i<m; i++) { for (int j=0; j<n; j++) { uf.makeSet(i, j); } } for (int i=0; i<m; i++) { for (int j=0; j<n; j++) { if (board[i][j] == 'O') { for (int[] d: dir) { int ni = i+d[0]; int nj = j+d[1]; if (ni >= 0 && ni < m && nj >= 0 && nj < n && board[ni][nj] == 'O') { uf.union(i, j, ni, nj); } } } } } for (int i=0; i<m; i++) { for (int j=0; j<n; j++) { if (board[i][j] == 'O') { if (uf.getIsSurrounded(i, j)) { board[i][j] = 'X'; } } } } } class UnionFind { int[] parent; boolean[] isSurrounded; int m; int n; UnionFind (int m, int n) { this.m = m; this.n = n; this.parent = new int[m*n]; this.isSurrounded = new boolean[m*n]; } boolean getIsSurrounded(int i, int j) { int r = find(getIdx(i, j)); return this.isSurrounded[r]; } int find(int r) { if (this.parent[r] == r) { return r; } this.parent[r] = find(this.parent[r]); return this.parent[r]; } void union(int i1, int j1, int i2, int j2) { int idx1 = getIdx(i1, j1); int idx2 = getIdx(i2, j2); int r1 = find(idx1); int r2 = find(idx2); if (r1 != r2) { this.parent[r1] = r2; this.isSurrounded[r2] = this.isSurrounded[r2] && this.isSurrounded[r1]; } } void makeSet(int i, int j) { int idx = getIdx(i, j); this.parent[idx] = idx; this.isSurrounded[idx] = (i==0 || i==m-1 || j==0 || j==n-1) ? false : true; } int getIdx(int i, int j) { return i*this.n + j; } } }
UTF-8
Java
1,835
java
Solution.java
Java
[]
null
[]
class Solution { public void solve(char[][] board) { if (board == null || board.length == 0 || board[0].length == 0) { return; } int m = board.length; int n = board[0].length; int[][] dir = {{1, 0}, {0, 1}}; UnionFind uf = new UnionFind(m, n); for (int i=0; i<m; i++) { for (int j=0; j<n; j++) { uf.makeSet(i, j); } } for (int i=0; i<m; i++) { for (int j=0; j<n; j++) { if (board[i][j] == 'O') { for (int[] d: dir) { int ni = i+d[0]; int nj = j+d[1]; if (ni >= 0 && ni < m && nj >= 0 && nj < n && board[ni][nj] == 'O') { uf.union(i, j, ni, nj); } } } } } for (int i=0; i<m; i++) { for (int j=0; j<n; j++) { if (board[i][j] == 'O') { if (uf.getIsSurrounded(i, j)) { board[i][j] = 'X'; } } } } } class UnionFind { int[] parent; boolean[] isSurrounded; int m; int n; UnionFind (int m, int n) { this.m = m; this.n = n; this.parent = new int[m*n]; this.isSurrounded = new boolean[m*n]; } boolean getIsSurrounded(int i, int j) { int r = find(getIdx(i, j)); return this.isSurrounded[r]; } int find(int r) { if (this.parent[r] == r) { return r; } this.parent[r] = find(this.parent[r]); return this.parent[r]; } void union(int i1, int j1, int i2, int j2) { int idx1 = getIdx(i1, j1); int idx2 = getIdx(i2, j2); int r1 = find(idx1); int r2 = find(idx2); if (r1 != r2) { this.parent[r1] = r2; this.isSurrounded[r2] = this.isSurrounded[r2] && this.isSurrounded[r1]; } } void makeSet(int i, int j) { int idx = getIdx(i, j); this.parent[idx] = idx; this.isSurrounded[idx] = (i==0 || i==m-1 || j==0 || j==n-1) ? false : true; } int getIdx(int i, int j) { return i*this.n + j; } } }
1,835
0.481199
0.457766
93
18.731182
16.859406
78
false
false
0
0
0
0
0
0
3.376344
false
false
9
a61b4218f59e77c82e5c0247aaa23f8deb24e5dd
2,972,117,418,604
a676451517e40a7a102ef2721b0f87fb7f4ae6a6
/src/main/java/com/kafkatool/demo/vo/ids/V1FeatureDetec.java
cfb9fc187fdb3e781b53a58137ad34189d370ecb
[]
no_license
GitHubWuDi/kafka
https://github.com/GitHubWuDi/kafka
a5ebf9c0f648c478208082118e0b5c542be0037d
148ee75f0a55b7c7f22515b4cb676be17b2087f4
refs/heads/master
2022-06-08T08:28:36.722000
2020-08-24T08:48:52
2020-08-24T08:48:52
143,414,351
0
0
null
false
2022-05-20T20:51:49
2018-08-03T10:34:48
2020-08-24T08:49:28
2022-05-20T20:51:49
119
0
0
1
Java
false
false
package com.kafkatool.demo.vo.ids; import java.io.Serializable; import java.sql.Timestamp; import com.kafkatool.demo.vo.FieldDesc; import com.kafkatool.demo.vo.LogDesc; import lombok.Data; /** *  * @author wudi  * E‐mail:wudi@vrvmail.com.cn * @version 创建时间:2018年12月29日 上午9:48:36 * 类说明 IDS日志-V1FeatureDetec */ @LogDesc("IDS日志-V1FeatureDetec") @Data public class V1FeatureDetec implements Serializable { /** * */ private static final long serialVersionUID = 1L; @FieldDesc("DT版本") private String dt_version; @FieldDesc("等级") private Long level; @FieldDesc("ID") private String id; @FieldDesc("类型") private String type; @FieldDesc("TM") private String tm; @FieldDesc("目的IP") private String src_ip; @FieldDesc("目的端口") private Long src_port; @FieldDesc("目的MAC") private String src_mac; @FieldDesc("目的IP") private String dst_ip; @FieldDesc("目的端口") private Long dst_port; @FieldDesc("目的MAC") private String dst_mac; @FieldDesc("数量") private Long counts; @FieldDesc("协议") private String protocol; @FieldDesc("主题") private String subject; @FieldDesc("安全ID") private String security_id; @FieldDesc("攻击ID") private String attack_id; @FieldDesc("信息") private String message; @FieldDesc("AJB生产者") private String ajb_producer; @FieldDesc("AJB主机") private String ajb_host; @FieldDesc("VRV接收时间") private String vrv_receive_time; @FieldDesc("DT") private String dt; @FieldDesc("省份") private String province; @FieldDesc("处理时间") private Timestamp triggerTime; }
UTF-8
Java
1,722
java
V1FeatureDetec.java
Java
[ { "context": "gDesc;\r\n\r\nimport lombok.Data;\r\n\r\n/** * \r\n* @author wudi \r\n* E‐mail:wudi@vrvmail.com.cn \r\n* @version 创建时间:", "end": 225, "score": 0.9994386434555054, "start": 221, "tag": "USERNAME", "value": "wudi" }, { "context": "lombok.Data;\r\n\r\n/** * \r\n* @author w...
null
[]
package com.kafkatool.demo.vo.ids; import java.io.Serializable; import java.sql.Timestamp; import com.kafkatool.demo.vo.FieldDesc; import com.kafkatool.demo.vo.LogDesc; import lombok.Data; /** *  * @author wudi  * E‐mail:<EMAIL> * @version 创建时间:2018年12月29日 上午9:48:36 * 类说明 IDS日志-V1FeatureDetec */ @LogDesc("IDS日志-V1FeatureDetec") @Data public class V1FeatureDetec implements Serializable { /** * */ private static final long serialVersionUID = 1L; @FieldDesc("DT版本") private String dt_version; @FieldDesc("等级") private Long level; @FieldDesc("ID") private String id; @FieldDesc("类型") private String type; @FieldDesc("TM") private String tm; @FieldDesc("目的IP") private String src_ip; @FieldDesc("目的端口") private Long src_port; @FieldDesc("目的MAC") private String src_mac; @FieldDesc("目的IP") private String dst_ip; @FieldDesc("目的端口") private Long dst_port; @FieldDesc("目的MAC") private String dst_mac; @FieldDesc("数量") private Long counts; @FieldDesc("协议") private String protocol; @FieldDesc("主题") private String subject; @FieldDesc("安全ID") private String security_id; @FieldDesc("攻击ID") private String attack_id; @FieldDesc("信息") private String message; @FieldDesc("AJB生产者") private String ajb_producer; @FieldDesc("AJB主机") private String ajb_host; @FieldDesc("VRV接收时间") private String vrv_receive_time; @FieldDesc("DT") private String dt; @FieldDesc("省份") private String province; @FieldDesc("处理时间") private Timestamp triggerTime; }
1,710
0.69007
0.679317
72
19.958334
10.923265
53
false
false
0
0
0
0
0
0
1.111111
false
false
9
8b984b92e58a6297caf91fbe42631204886bf334
13,700,945,681,817
0cb6b06a5a497728f614ac1eb8c9550f87630275
/project/code/SecondBoardStyle.java
448ecf8b96c0c62ae7a38b57fe92554f309f3eee
[]
no_license
sairabbas/TicTacToe
https://github.com/sairabbas/TicTacToe
cd0d443856117177fbb033110338fa121ee535ac
c81ceeb715dad0a18518d19bda720f86cca22f5b
refs/heads/master
2022-06-16T19:53:26.391000
2020-05-11T19:33:36
2020-05-11T19:33:36
259,993,240
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package tictactoe; import java.awt.Color; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.plaf.metal.DefaultMetalTheme; import javax.swing.plaf.metal.MetalLookAndFeel; /** * This is strategy concrete class implementing strategy interface * BoardStyle.java Methods defined in the BoardStyle strategy interface are * implemented in this class * * @author Admin * */ public class SecondBoardStyle implements BoardStyle { public Color btnBgColor = Color.ORANGE; /** * This method will be implemented as part of MVC mode. The main goal of this * method is to capture user events on gui After capturing the events on gui * this method is responsible to repaint with the required changes. The * doOperation invoked from TicTacToeBoard context dynamically during runtime.. */ @Override public void doOperation() { // TODO Auto-generated method stub } /** * The style of this board is chosen to be Orange as defined above in btnBgColor * The getBtnColoris invoked from TicTacToeBoard context dynamically during * runtime.. * */ @Override public Color getBtnColor() { return btnBgColor; } /** * SecondBoardStyle has chosen to use DefaultMetalTheme The below method sets * the DefaultMetalTheme in UIManager. When the board is created the board uses * DefaultMetalTheme style. The setBoardTheme invoked from TicTacToeBoard * context dynamically during runtime. */ @Override public void setBoardTheme() { MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme()); try { // UIMan16kd9sager.setLookAndFeel(new MetalLookAndFeel()); UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); } catch (UnsupportedLookAndFeelException | ClassNotFoundException | InstantiationException | IllegalAccessException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } }
UTF-8
Java
2,086
java
SecondBoardStyle.java
Java
[ { "context": "ace are\n * implemented in this class\n *\n * @author Admin\n *\n */\npublic class SecondBoardStyle implements B", "end": 418, "score": 0.8561844825744629, "start": 413, "tag": "USERNAME", "value": "Admin" } ]
null
[]
package tictactoe; import java.awt.Color; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.plaf.metal.DefaultMetalTheme; import javax.swing.plaf.metal.MetalLookAndFeel; /** * This is strategy concrete class implementing strategy interface * BoardStyle.java Methods defined in the BoardStyle strategy interface are * implemented in this class * * @author Admin * */ public class SecondBoardStyle implements BoardStyle { public Color btnBgColor = Color.ORANGE; /** * This method will be implemented as part of MVC mode. The main goal of this * method is to capture user events on gui After capturing the events on gui * this method is responsible to repaint with the required changes. The * doOperation invoked from TicTacToeBoard context dynamically during runtime.. */ @Override public void doOperation() { // TODO Auto-generated method stub } /** * The style of this board is chosen to be Orange as defined above in btnBgColor * The getBtnColoris invoked from TicTacToeBoard context dynamically during * runtime.. * */ @Override public Color getBtnColor() { return btnBgColor; } /** * SecondBoardStyle has chosen to use DefaultMetalTheme The below method sets * the DefaultMetalTheme in UIManager. When the board is created the board uses * DefaultMetalTheme style. The setBoardTheme invoked from TicTacToeBoard * context dynamically during runtime. */ @Override public void setBoardTheme() { MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme()); try { // UIMan16kd9sager.setLookAndFeel(new MetalLookAndFeel()); UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); } catch (UnsupportedLookAndFeelException | ClassNotFoundException | InstantiationException | IllegalAccessException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } }
2,086
0.705657
0.70326
65
31.107693
30.424242
98
false
false
0
0
0
0
0
0
0.230769
false
false
9
51a7fad0a5f017babd0a12e3ea9cbc650b0de53e
2,826,088,506,515
8534ea766585cfbd6986fd845e59a68877ecb15b
/com/google/ads/mediation/customevent/CustomEventAdapter.java
e4cd3109ff053168d36dcdc84d9c94a41ece6e39
[]
no_license
Shanzid01/NanoTouch
https://github.com/Shanzid01/NanoTouch
d7af94f2de686f76c2934b9777a92b9949b48e10
6d51a44ff8f719f36b880dd8d1112b31ba75bfb4
refs/heads/master
2020-04-26T17:39:53.196000
2019-03-04T10:23:51
2019-03-04T10:23:51
173,720,526
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.google.ads.mediation.customevent; import android.app.Activity; import android.view.View; import com.google.ads.AdRequest.ErrorCode; import com.google.ads.AdSize; import com.google.ads.mediation.MediationAdRequest; import com.google.ads.mediation.MediationBannerAdapter; import com.google.ads.mediation.MediationBannerListener; import com.google.ads.mediation.MediationInterstitialAdapter; import com.google.ads.mediation.MediationInterstitialListener; import com.google.android.gms.ads.mediation.customevent.CustomEventExtras; import com.google.android.gms.internal.zzhx; public final class CustomEventAdapter implements MediationBannerAdapter<CustomEventExtras, CustomEventServerParameters>, MediationInterstitialAdapter<CustomEventExtras, CustomEventServerParameters> { CustomEventBanner f1958a; CustomEventInterstitial f1959b; private View f1960c; final class zza implements CustomEventBannerListener { private final CustomEventAdapter f1953a; private final MediationBannerListener f1954b; public zza(CustomEventAdapter customEventAdapter, MediationBannerListener mediationBannerListener) { this.f1953a = customEventAdapter; this.f1954b = mediationBannerListener; } } class zzb implements CustomEventInterstitialListener { final /* synthetic */ CustomEventAdapter f1955a; private final CustomEventAdapter f1956b; private final MediationInterstitialListener f1957c; public zzb(CustomEventAdapter customEventAdapter, CustomEventAdapter customEventAdapter2, MediationInterstitialListener mediationInterstitialListener) { this.f1955a = customEventAdapter; this.f1956b = customEventAdapter2; this.f1957c = mediationInterstitialListener; } } private static <T> T m3728a(String str) { try { return Class.forName(str).newInstance(); } catch (Throwable th) { zzhx.zzac("Could not instantiate custom event adapter: " + str + ". " + th.getMessage()); return null; } } zzb m3729a(MediationInterstitialListener mediationInterstitialListener) { return new zzb(this, this, mediationInterstitialListener); } public void mo1174a() { if (this.f1958a != null) { this.f1958a.m3727a(); } if (this.f1959b != null) { this.f1959b.m3727a(); } } public void m3732a(MediationBannerListener mediationBannerListener, Activity activity, CustomEventServerParameters customEventServerParameters, AdSize adSize, MediationAdRequest mediationAdRequest, CustomEventExtras customEventExtras) { this.f1958a = (CustomEventBanner) m3728a(customEventServerParameters.f1962b); if (this.f1958a == null) { mediationBannerListener.onFailedToReceiveAd(this, ErrorCode.INTERNAL_ERROR); } else { this.f1958a.m3739a(new zza(this, mediationBannerListener), activity, customEventServerParameters.f1961a, customEventServerParameters.f1963c, adSize, mediationAdRequest, customEventExtras == null ? null : customEventExtras.getExtra(customEventServerParameters.f1961a)); } } public void m3734a(MediationInterstitialListener mediationInterstitialListener, Activity activity, CustomEventServerParameters customEventServerParameters, MediationAdRequest mediationAdRequest, CustomEventExtras customEventExtras) { this.f1959b = (CustomEventInterstitial) m3728a(customEventServerParameters.f1962b); if (this.f1959b == null) { mediationInterstitialListener.onFailedToReceiveAd(this, ErrorCode.INTERNAL_ERROR); } else { this.f1959b.m3740a(m3729a(mediationInterstitialListener), activity, customEventServerParameters.f1961a, customEventServerParameters.f1963c, mediationAdRequest, customEventExtras == null ? null : customEventExtras.getExtra(customEventServerParameters.f1961a)); } } public Class<CustomEventExtras> mo1177b() { return CustomEventExtras.class; } public Class<CustomEventServerParameters> mo1178c() { return CustomEventServerParameters.class; } public View mo1179d() { return this.f1960c; } public void mo1180e() { this.f1959b.m3741b(); } }
UTF-8
Java
4,324
java
CustomEventAdapter.java
Java
[]
null
[]
package com.google.ads.mediation.customevent; import android.app.Activity; import android.view.View; import com.google.ads.AdRequest.ErrorCode; import com.google.ads.AdSize; import com.google.ads.mediation.MediationAdRequest; import com.google.ads.mediation.MediationBannerAdapter; import com.google.ads.mediation.MediationBannerListener; import com.google.ads.mediation.MediationInterstitialAdapter; import com.google.ads.mediation.MediationInterstitialListener; import com.google.android.gms.ads.mediation.customevent.CustomEventExtras; import com.google.android.gms.internal.zzhx; public final class CustomEventAdapter implements MediationBannerAdapter<CustomEventExtras, CustomEventServerParameters>, MediationInterstitialAdapter<CustomEventExtras, CustomEventServerParameters> { CustomEventBanner f1958a; CustomEventInterstitial f1959b; private View f1960c; final class zza implements CustomEventBannerListener { private final CustomEventAdapter f1953a; private final MediationBannerListener f1954b; public zza(CustomEventAdapter customEventAdapter, MediationBannerListener mediationBannerListener) { this.f1953a = customEventAdapter; this.f1954b = mediationBannerListener; } } class zzb implements CustomEventInterstitialListener { final /* synthetic */ CustomEventAdapter f1955a; private final CustomEventAdapter f1956b; private final MediationInterstitialListener f1957c; public zzb(CustomEventAdapter customEventAdapter, CustomEventAdapter customEventAdapter2, MediationInterstitialListener mediationInterstitialListener) { this.f1955a = customEventAdapter; this.f1956b = customEventAdapter2; this.f1957c = mediationInterstitialListener; } } private static <T> T m3728a(String str) { try { return Class.forName(str).newInstance(); } catch (Throwable th) { zzhx.zzac("Could not instantiate custom event adapter: " + str + ". " + th.getMessage()); return null; } } zzb m3729a(MediationInterstitialListener mediationInterstitialListener) { return new zzb(this, this, mediationInterstitialListener); } public void mo1174a() { if (this.f1958a != null) { this.f1958a.m3727a(); } if (this.f1959b != null) { this.f1959b.m3727a(); } } public void m3732a(MediationBannerListener mediationBannerListener, Activity activity, CustomEventServerParameters customEventServerParameters, AdSize adSize, MediationAdRequest mediationAdRequest, CustomEventExtras customEventExtras) { this.f1958a = (CustomEventBanner) m3728a(customEventServerParameters.f1962b); if (this.f1958a == null) { mediationBannerListener.onFailedToReceiveAd(this, ErrorCode.INTERNAL_ERROR); } else { this.f1958a.m3739a(new zza(this, mediationBannerListener), activity, customEventServerParameters.f1961a, customEventServerParameters.f1963c, adSize, mediationAdRequest, customEventExtras == null ? null : customEventExtras.getExtra(customEventServerParameters.f1961a)); } } public void m3734a(MediationInterstitialListener mediationInterstitialListener, Activity activity, CustomEventServerParameters customEventServerParameters, MediationAdRequest mediationAdRequest, CustomEventExtras customEventExtras) { this.f1959b = (CustomEventInterstitial) m3728a(customEventServerParameters.f1962b); if (this.f1959b == null) { mediationInterstitialListener.onFailedToReceiveAd(this, ErrorCode.INTERNAL_ERROR); } else { this.f1959b.m3740a(m3729a(mediationInterstitialListener), activity, customEventServerParameters.f1961a, customEventServerParameters.f1963c, mediationAdRequest, customEventExtras == null ? null : customEventExtras.getExtra(customEventServerParameters.f1961a)); } } public Class<CustomEventExtras> mo1177b() { return CustomEventExtras.class; } public Class<CustomEventServerParameters> mo1178c() { return CustomEventServerParameters.class; } public View mo1179d() { return this.f1960c; } public void mo1180e() { this.f1959b.m3741b(); } }
4,324
0.739824
0.693108
97
43.57732
55.947479
280
false
false
0
0
0
0
0
0
0.742268
false
false
9
957b4df7661bbd92ba6b46f49d4da101283c5578
23,502,061,090,255
c72a4256a7b606af7139e2cc148d0fb95615dde1
/src/main/java/com/dcs/parking/interfaces/services/IServiceEntity.java
4d89378c33122e6f5b9e81767f3caa7c5ede8886
[]
no_license
djeisoncs/parking-java
https://github.com/djeisoncs/parking-java
8a05b1504f00958f6fee890e282b397ccfb5cd01
b9b97deab22686f7e5b4bc09429ce366a8238a0d
refs/heads/master
2021-01-05T02:03:28.566000
2020-02-16T20:01:11
2020-02-16T20:01:11
240,839,193
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * */ package com.dcs.parking.interfaces.services; import java.util.List; import java.util.Optional; import org.springframework.data.jpa.repository.JpaRepository; import com.dcs.parking.entidades.Auditoria; import com.dcs.parking.excessao.NegocioException; /** * Classe responsável por conter metodos comuns as classes filhas de negócio * * @author Djeison 12 de fev de 2020 */ public interface IServiceEntity<T extends Auditoria> extends IService<T> { /** * Método responsável por retornar a instancia de repositorio da classe * manipulada * * @author Djeison 12 de fev de 2020 * @return repository */ public abstract JpaRepository<T, Long> getRepository(); /** * Método responsável por salvar e validar as regras de negocio da entidade * passada * * @author Djeison 12 de fev de 2020 * @param entidade * @return entidade * @throws NegocioException */ public abstract T salvar(T entidade) throws NegocioException; /** * Método responsável por salvar e validar as regras de negocio da entidade * passada * * @author Djeison 12 de fev de 2020 * @param entidades * @return entidades * @throws NegocioException */ public abstract List<T> salvar(List<T> entidades) throws NegocioException; /** * Método responsável por excluir e validar as regras de exclusão da entidade de * manupulação * * @author Djeison 12 de fev de 2020 * @param id * @throws NegocioException */ public abstract void excluir(Long id) throws NegocioException; /** * Método responsável por excluir e validar as regras de exclusão da entidade de * manupulação * * @author Djeison 12 de fev de 2020 * @param entidade * @throws NegocioException */ public abstract void excluir(T entidade) throws NegocioException; /** * Método responsável por excluir e validar as regras de exclusão da entidade de * manupulação * * @author Djeison 12 de fev de 2020 * @param entidades * @throws NegocioException */ public abstract void excluir(List<T> entidades) throws NegocioException; /** * Método responsável por excluir e validar as regras de exclusão da entidade de * manupulação * * @author Djeison 12 de fev de 2020 * @throws NegocioException */ public abstract void excluir() throws NegocioException; /** * Método responsável por listar todos os registros da entidade de manipulação * * @author Djeison 12 de fev de 2020 * @return entidades */ public abstract List<T> listarTodos(); /** * Método responsável por consultar a entidade por id * * @author Djeison 12 de fev de 2020 * @param id * @return entidade * @throws NegocioException */ public abstract Optional<T> consultarPorId(Long id) throws NegocioException; /** * Método responsável por validar se os dados obrigatorios para salvar a * entidade estão preenchidos * * @author Djeison 12 de fev de 2020 * @param entidade * @return boolean * @throws NegocioException */ public abstract boolean dadosObrigatoriosPreenchidos(T entidade) throws NegocioException; /** * Método responsável por validar se os dados obrigatorios para salvar a * entidade estão preenchidos * * @author Djeison 12 de fev de 2020 * @param entidades * @return boolean * @throws NegocioException */ public abstract boolean dadosObrigatoriosPreenchidos(List<T> entidades) throws NegocioException; /** * Método responsável por montar os dados para salvar a entidade passada por * parametro * * @author Djeison 12 de fev de 2020 * @param entidade * @return entidade * @throws NegocioException */ public abstract T montarDados(T entidade) throws NegocioException; /** * Método responsável por montar os dados para salvar a entidades passada por * parametro * * @author Djeison 12 de fev de 2020 * @param entidades * @return entidades * @throws NegocioException */ public abstract List<T> montarDados(List<T> entidades) throws NegocioException; /** * Método responsável por validar se a entidade que está prestes a ser salva já * não está cadastrada * * @author Djeison 12 de fev de 2020 * @param entidade * @return boolean * @throws NegocioException */ public abstract boolean naoExisteCadastro(T entidade) throws NegocioException; /** * Método responsável por validar se a entidade que está prestes a ser salva já * não está cadastrada * * @author Djeison 12 de fev de 2020 * @param entidades * @return boolean * @throws NegocioException */ public abstract boolean naoExisteCadastro(List<T> entidades) throws NegocioException; }
UTF-8
Java
4,657
java
IServiceEntity.java
Java
[ { "context": "comuns as classes filhas de negócio\n * \n * @author Djeison 12 de fev de 2020\n */\npublic interface IServiceEn", "end": 370, "score": 0.9996935725212097, "start": 363, "tag": "NAME", "value": "Djeison" }, { "context": "ositorio da classe\n\t * manipulada\n\t * \n\t * ...
null
[]
/** * */ package com.dcs.parking.interfaces.services; import java.util.List; import java.util.Optional; import org.springframework.data.jpa.repository.JpaRepository; import com.dcs.parking.entidades.Auditoria; import com.dcs.parking.excessao.NegocioException; /** * Classe responsável por conter metodos comuns as classes filhas de negócio * * @author Djeison 12 de fev de 2020 */ public interface IServiceEntity<T extends Auditoria> extends IService<T> { /** * Método responsável por retornar a instancia de repositorio da classe * manipulada * * @author Djeison 12 de fev de 2020 * @return repository */ public abstract JpaRepository<T, Long> getRepository(); /** * Método responsável por salvar e validar as regras de negocio da entidade * passada * * @author Djeison 12 de fev de 2020 * @param entidade * @return entidade * @throws NegocioException */ public abstract T salvar(T entidade) throws NegocioException; /** * Método responsável por salvar e validar as regras de negocio da entidade * passada * * @author Djeison 12 de fev de 2020 * @param entidades * @return entidades * @throws NegocioException */ public abstract List<T> salvar(List<T> entidades) throws NegocioException; /** * Método responsável por excluir e validar as regras de exclusão da entidade de * manupulação * * @author Djeison 12 de fev de 2020 * @param id * @throws NegocioException */ public abstract void excluir(Long id) throws NegocioException; /** * Método responsável por excluir e validar as regras de exclusão da entidade de * manupulação * * @author Djeison 12 de fev de 2020 * @param entidade * @throws NegocioException */ public abstract void excluir(T entidade) throws NegocioException; /** * Método responsável por excluir e validar as regras de exclusão da entidade de * manupulação * * @author Djeison 12 de fev de 2020 * @param entidades * @throws NegocioException */ public abstract void excluir(List<T> entidades) throws NegocioException; /** * Método responsável por excluir e validar as regras de exclusão da entidade de * manupulação * * @author Djeison 12 de fev de 2020 * @throws NegocioException */ public abstract void excluir() throws NegocioException; /** * Método responsável por listar todos os registros da entidade de manipulação * * @author Djeison 12 de fev de 2020 * @return entidades */ public abstract List<T> listarTodos(); /** * Método responsável por consultar a entidade por id * * @author Djeison 12 de fev de 2020 * @param id * @return entidade * @throws NegocioException */ public abstract Optional<T> consultarPorId(Long id) throws NegocioException; /** * Método responsável por validar se os dados obrigatorios para salvar a * entidade estão preenchidos * * @author Djeison 12 de fev de 2020 * @param entidade * @return boolean * @throws NegocioException */ public abstract boolean dadosObrigatoriosPreenchidos(T entidade) throws NegocioException; /** * Método responsável por validar se os dados obrigatorios para salvar a * entidade estão preenchidos * * @author Djeison 12 de fev de 2020 * @param entidades * @return boolean * @throws NegocioException */ public abstract boolean dadosObrigatoriosPreenchidos(List<T> entidades) throws NegocioException; /** * Método responsável por montar os dados para salvar a entidade passada por * parametro * * @author Djeison 12 de fev de 2020 * @param entidade * @return entidade * @throws NegocioException */ public abstract T montarDados(T entidade) throws NegocioException; /** * Método responsável por montar os dados para salvar a entidades passada por * parametro * * @author Djeison 12 de fev de 2020 * @param entidades * @return entidades * @throws NegocioException */ public abstract List<T> montarDados(List<T> entidades) throws NegocioException; /** * Método responsável por validar se a entidade que está prestes a ser salva já * não está cadastrada * * @author Djeison 12 de fev de 2020 * @param entidade * @return boolean * @throws NegocioException */ public abstract boolean naoExisteCadastro(T entidade) throws NegocioException; /** * Método responsável por validar se a entidade que está prestes a ser salva já * não está cadastrada * * @author Djeison 12 de fev de 2020 * @param entidades * @return boolean * @throws NegocioException */ public abstract boolean naoExisteCadastro(List<T> entidades) throws NegocioException; }
4,657
0.723756
0.702891
174
25.44253
26.48996
97
false
false
0
0
0
0
0
0
0.925287
false
false
9
b877dabae43599cb1dfb8668f3461bf5c600cccb
33,732,673,173,588
22346b9427d068c4d470b0faf325b287792f2f1b
/app/src/main/java/com/parm/helper/service/ApiClient.java
93c54dbec59823b519b72d8238da54f466065d2f
[]
no_license
changulpaye/Helper
https://github.com/changulpaye/Helper
7097ebb02088e0a747024163ae8d9bec718535bc
adf53fbeb7b8b1eca84b82d6c9739ec144d480e2
refs/heads/master
2021-01-19T01:33:09.106000
2018-08-23T06:45:52
2018-08-23T06:45:52
63,953,670
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.parm.helper.service; import com.parm.helper.model.ApiResponse; import com.parm.helper.model.SignupResponse; import java.util.List; import retrofit2.http.GET; import rx.Observable; /** * Created by pchangul on 7/18/2016. */ public interface ApiClient { /** * TODO Write info about method * @return */ @GET("/feeds/login.json") Observable<List<ApiResponse>> authenticateUser(); @GET("/feeds/signup.json") Observable<SignupResponse> signUpUser(); }
UTF-8
Java
499
java
ApiClient.java
Java
[ { "context": "http.GET;\nimport rx.Observable;\n\n/**\n * Created by pchangul on 7/18/2016.\n */\npublic interface ApiClient {\n\n ", "end": 220, "score": 0.9996855854988098, "start": 212, "tag": "USERNAME", "value": "pchangul" } ]
null
[]
package com.parm.helper.service; import com.parm.helper.model.ApiResponse; import com.parm.helper.model.SignupResponse; import java.util.List; import retrofit2.http.GET; import rx.Observable; /** * Created by pchangul on 7/18/2016. */ public interface ApiClient { /** * TODO Write info about method * @return */ @GET("/feeds/login.json") Observable<List<ApiResponse>> authenticateUser(); @GET("/feeds/signup.json") Observable<SignupResponse> signUpUser(); }
499
0.697395
0.681363
23
20.695652
16.804335
53
false
false
0
0
0
0
0
0
0.347826
false
false
9
8444eda874afded453cb654708e6ca9aed8cbc01
9,612,136,840,748
e5ff2cda0c1f57c7df50fcb6e048bb58cb34e86a
/src/test/java/org/iata/selenium/web/SeleniumPage.java
9b60837d8cb9656e5841b936e63ece65594eca06
[]
no_license
rock2015/imx-autotest-poc
https://github.com/rock2015/imx-autotest-poc
0d7924b9d08683598ab6a1ae62b1e5770a133aee
c4dbeca9dcc82113b37046c6635b2dec7594d023
refs/heads/master
2020-02-26T15:43:04.137000
2016-09-19T06:30:57
2016-09-19T06:30:57
70,765,418
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.iata.selenium.web; import org.iata.selenium.BrowserHandler; import org.openqa.selenium.WebDriver; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public abstract class SeleniumPage { protected BrowserHandler handler; protected final Logger logger = LoggerFactory.getLogger(getClass()); public SeleniumPage(WebDriver driver) { this.handler = new BrowserHandler(driver); } protected AjaxEvent buildAjax() { return new AjaxEvent(handler); } }
UTF-8
Java
521
java
SeleniumPage.java
Java
[]
null
[]
package org.iata.selenium.web; import org.iata.selenium.BrowserHandler; import org.openqa.selenium.WebDriver; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public abstract class SeleniumPage { protected BrowserHandler handler; protected final Logger logger = LoggerFactory.getLogger(getClass()); public SeleniumPage(WebDriver driver) { this.handler = new BrowserHandler(driver); } protected AjaxEvent buildAjax() { return new AjaxEvent(handler); } }
521
0.71977
0.715931
29
15.965517
19.563307
70
false
false
0
0
0
0
0
0
0.862069
false
false
9
d598bae21a8cd699c2e5eab37c5ac9ace02305c0
22,393,959,519,573
b8dab5cc3f7028a045f0a361d4f9acd4f3c1054a
/src/main/java/ru/elgin/SerialsAggregator/Config/WebConfig.java
a54883b938d4c2415c39957b023daf4f34cad226
[]
no_license
ElginYuriy/serials_aggregator
https://github.com/ElginYuriy/serials_aggregator
f2aed959c6339320a5cba16fc6db5548d540fdb7
70a12116b0575f37c9730a8ae05f4d101f2cab2a
refs/heads/master
2021-08-27T23:15:36.527000
2017-12-10T17:46:59
2017-12-10T17:46:59
113,765,875
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ru.elgin.SerialsAggregator.Config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.springframework.web.servlet.view.InternalResourceViewResolver; @Configuration @EnableWebMvc @Import(DataConfig.class) @ComponentScan("ru.elgin.SerialsAggregator") public class WebConfig extends WebMvcConfigurerAdapter { @Bean public InternalResourceViewResolver viewResolver() { InternalResourceViewResolver resolver = new InternalResourceViewResolver(); resolver.setPrefix("/WEB-INF/view/"); resolver.setPrefix(".jsp"); return resolver; } }
UTF-8
Java
926
java
WebConfig.java
Java
[]
null
[]
package ru.elgin.SerialsAggregator.Config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.springframework.web.servlet.view.InternalResourceViewResolver; @Configuration @EnableWebMvc @Import(DataConfig.class) @ComponentScan("ru.elgin.SerialsAggregator") public class WebConfig extends WebMvcConfigurerAdapter { @Bean public InternalResourceViewResolver viewResolver() { InternalResourceViewResolver resolver = new InternalResourceViewResolver(); resolver.setPrefix("/WEB-INF/view/"); resolver.setPrefix(".jsp"); return resolver; } }
926
0.808855
0.808855
26
34.615383
27.755909
83
false
false
0
0
0
0
0
0
0.461538
false
false
9
d41083333098031ad1f8327f2dfa7a422c57102d
6,382,321,429,079
ad3ae22791a131b7003d924fc614c5b1a1f275da
/QA_Java_Sessions_Jul19/BasicOops/src/abstractintf/Circle.java
74362d6235c62c228a97d693541b7296bac3e56b
[]
no_license
PreetiKamble24/Personal_Projects
https://github.com/PreetiKamble24/Personal_Projects
573d26dc56cf2269cbc36c24b3ec85be1bc5aa8e
4927489dd5fa2d94261329814455a8355589fab1
refs/heads/master
2021-07-10T19:01:56.131000
2019-09-03T13:35:35
2019-09-03T13:35:35
206,055,355
0
0
null
false
2020-10-13T15:46:29
2019-09-03T10:53:52
2019-09-03T13:38:27
2020-10-13T15:46:27
49,794
0
0
1
Java
false
false
package abstractintf; public class Circle extends Shape { int rad; public Circle(int r) { this.rad=r; } @Override public float findArea() { return (3.14f)*rad*rad; } /*public void implementedMethod(){ System.out.println("Circle implementation.."); }*/ }
UTF-8
Java
280
java
Circle.java
Java
[]
null
[]
package abstractintf; public class Circle extends Shape { int rad; public Circle(int r) { this.rad=r; } @Override public float findArea() { return (3.14f)*rad*rad; } /*public void implementedMethod(){ System.out.println("Circle implementation.."); }*/ }
280
0.657143
0.646429
21
12.333333
14.126413
48
false
false
0
0
0
0
0
0
1.142857
false
false
9
b325535f40dcab294a8aabd59cc35f2b879d52e1
11,656,541,305,539
72960a3e2bdbb01b16245a1ad4cccbdfa0553b93
/src/SS-SIGES-ejb/src/main/java/com/sofis/business/utils/SaldoUtils.java
9cf8ff0cd2ee4a48f2869ed4ada0d93b48db9445
[]
no_license
AGESIC-UY/siges
https://github.com/AGESIC-UY/siges
0629afbc42f35add7db4dc10a7189cac79073ce5
d809ced53759dd82314a3a481a79b731a3e15bc4
refs/heads/master
2023-08-04T04:00:56.709000
2023-07-20T18:21:51
2023-07-20T18:21:51
224,908,836
2
4
null
false
2020-07-02T01:27:26
2019-11-29T19:05:15
2020-06-22T18:21:38
2020-07-02T01:27:24
304,395
0
1
6
Java
false
false
package com.sofis.business.utils; import com.sofis.entities.tipos.SaldoTO; import java.util.Collections; import java.util.Comparator; import java.util.List; public abstract class SaldoUtils { private static final Comparator<SaldoTO> MONEDA_COMPARATOR = new Comparator<SaldoTO>() { @Override public int compare(SaldoTO o1, SaldoTO o2) { if (o1.getMoneda() != null && o2.getMoneda() != null) { return o1.getMoneda().getId().compareTo(o2.getMoneda().getId()); } return 0; } }; public static void ordenarPorMoneda(List<SaldoTO> saldos) { Collections.sort(saldos, MONEDA_COMPARATOR); } }
UTF-8
Java
617
java
SaldoUtils.java
Java
[]
null
[]
package com.sofis.business.utils; import com.sofis.entities.tipos.SaldoTO; import java.util.Collections; import java.util.Comparator; import java.util.List; public abstract class SaldoUtils { private static final Comparator<SaldoTO> MONEDA_COMPARATOR = new Comparator<SaldoTO>() { @Override public int compare(SaldoTO o1, SaldoTO o2) { if (o1.getMoneda() != null && o2.getMoneda() != null) { return o1.getMoneda().getId().compareTo(o2.getMoneda().getId()); } return 0; } }; public static void ordenarPorMoneda(List<SaldoTO> saldos) { Collections.sort(saldos, MONEDA_COMPARATOR); } }
617
0.71799
0.706645
26
22.73077
25.24428
89
false
false
0
0
0
0
0
0
1.461538
false
false
9
dbee201e1fdd3e50633c634ecc42a477bd7dd889
32,598,801,792,330
add90aea1bd8b3acf8adb38f4cabf8d218243e8d
/tdh-platform-export-service/src/main/java/tdh/platform/export/utils/ExportErrorCode.java
55e48c9348b4f32e426169f65375665818bcef11
[]
no_license
Hurdmmmer/tdh-plateform-export-parent
https://github.com/Hurdmmmer/tdh-plateform-export-parent
254a25fc25474cd5f5710afc1c50369a1166b79b
8b49b5720183f34bb9ee283eee213bc64a0df1b8
refs/heads/master
2020-04-29T23:44:49.973000
2019-03-19T10:28:18
2019-03-19T10:28:18
176,486,254
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package tdh.platform.export.utils; /** * Created by eric on 16/8/21. */ public interface ExportErrorCode { int UNKNOWN = -9999; // 负数为不期望会发生的错误 /** * 通用的参数无效 */ String INVALID_ARGUMENT = "分页导出失败"; /** * 系统内部错误,可能由环境或配置导致的 */ int SYSTEM_FAILURE = -1001; /** * 重复提交 */ int RESUBMIT = -1002; int RECORD_NOT_FOUND = -1003; /** * 账户校验失败 */ int SUBJECT_AUTH_FAILED = 1000; /** * 数据校验失败,一般是指在逻辑处理中发现不符合条件的数据 */ int VERIFY_FAILED = 1001; /** * 操作不允许,一般是因为提交的数据已经发生变更,比如状态改变了,不能再执行原状态下的操作 */ int OPERATION_NOT_ALLOWED = 1002; }
UTF-8
Java
810
java
ExportErrorCode.java
Java
[ { "context": "age tdh.platform.export.utils;\n\n/**\n * Created by eric on 16/8/21.\n */\npublic interface ExportErrorCode ", "end": 58, "score": 0.9926366806030273, "start": 54, "tag": "USERNAME", "value": "eric" } ]
null
[]
package tdh.platform.export.utils; /** * Created by eric on 16/8/21. */ public interface ExportErrorCode { int UNKNOWN = -9999; // 负数为不期望会发生的错误 /** * 通用的参数无效 */ String INVALID_ARGUMENT = "分页导出失败"; /** * 系统内部错误,可能由环境或配置导致的 */ int SYSTEM_FAILURE = -1001; /** * 重复提交 */ int RESUBMIT = -1002; int RECORD_NOT_FOUND = -1003; /** * 账户校验失败 */ int SUBJECT_AUTH_FAILED = 1000; /** * 数据校验失败,一般是指在逻辑处理中发现不符合条件的数据 */ int VERIFY_FAILED = 1001; /** * 操作不允许,一般是因为提交的数据已经发生变更,比如状态改变了,不能再执行原状态下的操作 */ int OPERATION_NOT_ALLOWED = 1002; }
810
0.624126
0.566434
45
11.711111
13.504932
47
false
false
0
0
0
0
0
0
0.888889
false
false
9
04ee60fb7739c48308057723469c02d9c19d1626
4,604,204,954,169
1fb18c21e232a327d4856c0cb978fc9195534d80
/design-pattern/src/com/simon/learn/designpattern/decorator/general/Component.java
e79ca0a711aebf892289f28d8e2c292575c53288
[]
no_license
haibotvr/learn-java
https://github.com/haibotvr/learn-java
08cf5e26f7ec5de4bef893637f152c1aae52b58e
e15740ab5eb6c1e7484d39f06b1ffb4f51a45be0
refs/heads/master
2021-12-04T05:09:17.510000
2021-11-30T07:14:49
2021-11-30T07:14:49
154,817,392
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.simon.learn.designpattern.decorator.general; /** * @author simon.wei */ public abstract class Component { public abstract void operation(); }
UTF-8
Java
163
java
Component.java
Java
[ { "context": "n.designpattern.decorator.general;\n\n/**\n * @author simon.wei\n */\npublic abstract class Component {\n\n public", "end": 82, "score": 0.9894407391548157, "start": 73, "tag": "NAME", "value": "simon.wei" } ]
null
[]
package com.simon.learn.designpattern.decorator.general; /** * @author simon.wei */ public abstract class Component { public abstract void operation(); }
163
0.723926
0.723926
10
15.3
19.162724
56
false
false
0
0
0
0
0
0
0.2
false
false
9
7456676c502fef804ca666070ef75522bbdebc53
29,626,684,424,159
c31ef2ad77f6df941061a862206ef6422291c718
/src/main/java/com/rules/Sympol.java
cac75b3ef3b898083b9abad479344314de177399
[]
no_license
shiyamalan/RemoveLineNumber
https://github.com/shiyamalan/RemoveLineNumber
50f58fcd9cd8d089435b5dbf121f94c66d0ec35e
70de99fc31dbff561726272651e65480a93c887d
refs/heads/master
2021-01-22T02:39:26.574000
2017-02-06T10:34:26
2017-02-06T10:34:26
81,062,313
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.rules; public class Sympol { }
UTF-8
Java
45
java
Sympol.java
Java
[]
null
[]
package com.rules; public class Sympol { }
45
0.711111
0.711111
6
6.5
8.5
19
false
false
0
0
0
0
0
0
0.166667
false
false
9
05bbb507a1dc8a6df20302fff2e6560d9072052d
29,626,684,422,092
d82f15a72a9bea3814bd64ff984a34fe86297aed
/app/src/main/java/com/sianwa/cabletv/DisplayListView.java
dbf6934f0681f7c93c6739bd3cdf5e36f16e2b67
[]
no_license
sianwa11/CableTV
https://github.com/sianwa11/CableTV
0c80ec0045e0afc3d032530293ef11faf4a6575d
f78c68048c662abc40738a7a5a61cf622ab0318b
refs/heads/master
2020-08-07T09:51:18.039000
2019-10-07T14:06:03
2019-10-07T14:06:03
213,395,686
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.sianwa.cabletv; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import android.Manifest; import android.content.ClipData; import android.content.pm.PackageManager; import android.os.Build; import android.os.Bundle; import android.os.Environment; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.Toast; import com.itextpdf.text.Document; import com.itextpdf.text.List; import com.itextpdf.text.ListItem; import com.itextpdf.text.Paragraph; import com.itextpdf.text.pdf.PdfWriter; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.io.FileOutputStream; import java.text.SimpleDateFormat; import java.util.Locale; /* This class gets the jsonn string and converts it to a readable format in a listview */ public class DisplayListView extends AppCompatActivity { private static final int STORAGE_CODE = 1000 ; String json_string; JSONObject jsonObject; JSONArray jsonArray; DetailsAdapter detailsAdapter; ListView listView; String selected; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_display_list_view); listView = (ListView) findViewById(R.id.listview); detailsAdapter = new DetailsAdapter(this, R.layout.row_layout); listView.setAdapter(detailsAdapter); //get the json string json_string = getIntent().getExtras().getString("json_data"); try { jsonObject = new JSONObject(json_string); //get the array name of the json string jsonArray = jsonObject.getJSONArray("server response"); int count = 0; String number, packageName, price; while (count < jsonArray.length()) { //get the objects in the array and pass them to the //Details class JSONObject JO = jsonArray.getJSONObject(count); number = JO.getString("id"); packageName = JO.getString("package"); price = JO.getString("price"); Details details = new Details(number, packageName, price); detailsAdapter.add(details); count++; } } catch (JSONException e) { e.printStackTrace(); } listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { //get item that has been clicked selected = parent.getItemAtPosition(position).toString(); //handling runtime permissions if(Build.VERSION.SDK_INT > Build.VERSION_CODES.M) { //check if permissions is enabled if(checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_DENIED) { //permission not granted request it String[] permissions = {Manifest.permission.WRITE_EXTERNAL_STORAGE}; requestPermissions(permissions, STORAGE_CODE); } else { //permission already granted call savePDF Method savePdf(); } } else { //system < marshmallow call save pdf savePdf(); } } }); } //save the selected item in the ListView as a pdf private void savePdf() { //object of document class Document mDoc = new Document(); //pdf file name String mFileName = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.getDefault()).format(System.currentTimeMillis()); //pdf file path String mFilePath = Environment.getExternalStorageDirectory() + "/" + mFileName + ".pdf"; try { //create instance of pdfwriter class PdfWriter.getInstance(mDoc, new FileOutputStream(mFilePath)); //open the document for writing mDoc.open(); //get details from listview //DetailsAdapter detailsAdapter = new DetailsAdapter(this, R.layout.row_layout); //add author of the document mDoc.addAuthor("Sianwa Atemi"); //add paragraph to the document mDoc.add(new ListItem(selected)); //close the document mDoc.close(); //show message that file is saved, shows file name and file path Toast.makeText(this,mFileName + ".pdf\nis saved to \n" + mFilePath,Toast.LENGTH_LONG).show(); }catch (Exception e) { //if anything goes wrong show message Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show(); } } @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { switch (requestCode) { case STORAGE_CODE: { if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { //permission was granted from popup, call save pdf method savePdf(); } else { //permission was denied from popup Toast.makeText(this, "Permission denied", Toast.LENGTH_LONG).show(); } } } } }
UTF-8
Java
5,694
java
DisplayListView.java
Java
[ { "context": "uthor of the document\n mDoc.addAuthor(\"Sianwa Atemi\");\n\n //add paragraph to the document\n ", "end": 4550, "score": 0.9998435974121094, "start": 4538, "tag": "NAME", "value": "Sianwa Atemi" } ]
null
[]
package com.sianwa.cabletv; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import android.Manifest; import android.content.ClipData; import android.content.pm.PackageManager; import android.os.Build; import android.os.Bundle; import android.os.Environment; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.Toast; import com.itextpdf.text.Document; import com.itextpdf.text.List; import com.itextpdf.text.ListItem; import com.itextpdf.text.Paragraph; import com.itextpdf.text.pdf.PdfWriter; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.io.FileOutputStream; import java.text.SimpleDateFormat; import java.util.Locale; /* This class gets the jsonn string and converts it to a readable format in a listview */ public class DisplayListView extends AppCompatActivity { private static final int STORAGE_CODE = 1000 ; String json_string; JSONObject jsonObject; JSONArray jsonArray; DetailsAdapter detailsAdapter; ListView listView; String selected; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_display_list_view); listView = (ListView) findViewById(R.id.listview); detailsAdapter = new DetailsAdapter(this, R.layout.row_layout); listView.setAdapter(detailsAdapter); //get the json string json_string = getIntent().getExtras().getString("json_data"); try { jsonObject = new JSONObject(json_string); //get the array name of the json string jsonArray = jsonObject.getJSONArray("server response"); int count = 0; String number, packageName, price; while (count < jsonArray.length()) { //get the objects in the array and pass them to the //Details class JSONObject JO = jsonArray.getJSONObject(count); number = JO.getString("id"); packageName = JO.getString("package"); price = JO.getString("price"); Details details = new Details(number, packageName, price); detailsAdapter.add(details); count++; } } catch (JSONException e) { e.printStackTrace(); } listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { //get item that has been clicked selected = parent.getItemAtPosition(position).toString(); //handling runtime permissions if(Build.VERSION.SDK_INT > Build.VERSION_CODES.M) { //check if permissions is enabled if(checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_DENIED) { //permission not granted request it String[] permissions = {Manifest.permission.WRITE_EXTERNAL_STORAGE}; requestPermissions(permissions, STORAGE_CODE); } else { //permission already granted call savePDF Method savePdf(); } } else { //system < marshmallow call save pdf savePdf(); } } }); } //save the selected item in the ListView as a pdf private void savePdf() { //object of document class Document mDoc = new Document(); //pdf file name String mFileName = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.getDefault()).format(System.currentTimeMillis()); //pdf file path String mFilePath = Environment.getExternalStorageDirectory() + "/" + mFileName + ".pdf"; try { //create instance of pdfwriter class PdfWriter.getInstance(mDoc, new FileOutputStream(mFilePath)); //open the document for writing mDoc.open(); //get details from listview //DetailsAdapter detailsAdapter = new DetailsAdapter(this, R.layout.row_layout); //add author of the document mDoc.addAuthor("<NAME>"); //add paragraph to the document mDoc.add(new ListItem(selected)); //close the document mDoc.close(); //show message that file is saved, shows file name and file path Toast.makeText(this,mFileName + ".pdf\nis saved to \n" + mFilePath,Toast.LENGTH_LONG).show(); }catch (Exception e) { //if anything goes wrong show message Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show(); } } @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { switch (requestCode) { case STORAGE_CODE: { if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { //permission was granted from popup, call save pdf method savePdf(); } else { //permission was denied from popup Toast.makeText(this, "Permission denied", Toast.LENGTH_LONG).show(); } } } } }
5,688
0.606252
0.605023
161
34.366459
26.918255
121
false
false
0
0
0
0
0
0
0.565217
false
false
9
396f37920f17be5430b8b4bdc1e7594333463c41
28,269,474,770,771
54aa60a9dc0fc191535c94bc85ad0401d81eddc2
/greeter-library/src/main/java/org/manu/greeter/GreeterConfig.java
ea9bc01fd7e837062b1596189d798f4eefd101d6
[]
no_license
kmmanu/spring-boot-custom-starter
https://github.com/kmmanu/spring-boot-custom-starter
930cb8318f16ef204de9828d7069211ba266e646
53750b001140b2c5c20a83758a2da879d5124db7
refs/heads/master
2020-03-31T05:18:20.717000
2018-10-11T13:15:32
2018-10-11T13:15:32
151,940,836
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.manu.greeter; import lombok.Builder; import lombok.Getter; @Builder @Getter public class GreeterConfig { private final String userName; private final String morningGreeting; private final String afternoonGreeting; private final String eveningGreeting; private final String nightGreeting; }
UTF-8
Java
324
java
GreeterConfig.java
Java
[ { "context": "lic class GreeterConfig {\n private final String userName;\n private final String morningGreeting;\n pr", "end": 152, "score": 0.9645922183990479, "start": 144, "tag": "USERNAME", "value": "userName" } ]
null
[]
package org.manu.greeter; import lombok.Builder; import lombok.Getter; @Builder @Getter public class GreeterConfig { private final String userName; private final String morningGreeting; private final String afternoonGreeting; private final String eveningGreeting; private final String nightGreeting; }
324
0.780864
0.780864
14
22.142857
15.747368
43
false
false
0
0
0
0
0
0
0.571429
false
false
9
dd46017d3154cb5bde90e9d5bb80a83c54808f2b
13,589,276,565,387
9588d8b1e683e4904f785748a685b97f2d92cae6
/trunk/zmis/src/com/zmis/core/logger/service/LoggerService.java
b56978f63521033b9b175ef34a6c239ac66feca7
[]
no_license
BGCX261/zproject-svn-to-git
https://github.com/BGCX261/zproject-svn-to-git
7839e86b6de9aaaf4b15b0fb439ad9cf16b07c9f
41e1fb64c0a95fc518267a9e893e4d881ec9b472
refs/heads/master
2021-01-25T05:23:03.046000
2015-08-25T15:23:16
2015-08-25T15:23:16
41,437,526
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.zmis.core.logger.service; import org.apache.log4j.Logger; import com.zmis.core.logger.bean.LoggerBean; /** * <ul> * <li>增强日志处理</li> * <li>在log4j的基础上增加自定义的数据库日志保存, (通过一个)</li> * 2013-1-3 下午05:29:23 * @author ricker.zlj[271218983@qq.com] * </ul> */ public class LoggerService { private LoggerBean log; public LoggerService(Class<?> clazz) { persistent(clazz, false); } /** * * @param clazz 类字节码 * @param isSave 是否保存到数据库 */ public LoggerService(Class<?> clazz, boolean isSave) { persistent(clazz, isSave); } /** * 写操作(可阻塞队列) */ public void persistent(Class<?> clazz,boolean isSave) { } }
UTF-8
Java
780
java
LoggerService.java
Java
[ { "context": "存, (通过一个)</li>\r\n * 2013-1-3 下午05:29:23\r\n * @author ricker.zlj[271218983@qq.com]\r\n * </ul>\r\n */\r\npublic class Lo", "end": 252, "score": 0.9995412826538086, "start": 242, "tag": "USERNAME", "value": "ricker.zlj" }, { "context": "i>\r\n * 2013-1-3 下午05:29:23\r\n ...
null
[]
package com.zmis.core.logger.service; import org.apache.log4j.Logger; import com.zmis.core.logger.bean.LoggerBean; /** * <ul> * <li>增强日志处理</li> * <li>在log4j的基础上增加自定义的数据库日志保存, (通过一个)</li> * 2013-1-3 下午05:29:23 * @author ricker.zlj[<EMAIL>] * </ul> */ public class LoggerService { private LoggerBean log; public LoggerService(Class<?> clazz) { persistent(clazz, false); } /** * * @param clazz 类字节码 * @param isSave 是否保存到数据库 */ public LoggerService(Class<?> clazz, boolean isSave) { persistent(clazz, isSave); } /** * 写操作(可阻塞队列) */ public void persistent(Class<?> clazz,boolean isSave) { } }
771
0.620588
0.586765
37
16.378378
17.037878
56
false
false
0
0
0
0
0
0
0.972973
false
false
9
cce5befd861b9c29ad71f9cb17a3ba749bfb953c
13,589,276,565,078
7645a923a96ed94eaf0e64c77cd53d438ed0c992
/omod/src/main/java/org/openmrs/module/vcttrac/web/controller/VCTAutoCompleteListController.java
3d6a801435c9d757a3a78808f53daa39b87ab83b
[]
no_license
k-joseph/openmrs-module-vcttrac
https://github.com/k-joseph/openmrs-module-vcttrac
56a943e30e2d0ac27330a05cefdb6ad0d3d7b796
6b62cc4388cab372433d6f7689908679bee1e08e
refs/heads/master
2021-01-10T09:34:17.099000
2015-12-21T22:40:12
2015-12-21T22:40:12
48,397,963
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * The contents of this file are subject to the OpenMRS Public License * Version 1.0 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * http://license.openmrs.org * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the * License for the specific language governing rights and limitations * under the License. * * Copyright (C) OpenMRS, LLC. All Rights Reserved. */ package org.openmrs.module.vcttrac.web.controller; import java.util.Date; import java.util.HashMap; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.openmrs.Location; import org.openmrs.Obs; import org.openmrs.User; import org.openmrs.api.context.Context; import org.openmrs.api.context.ServiceContext; import org.openmrs.module.vcttrac.VCTClient; import org.openmrs.module.vcttrac.VCTClientResult; import org.openmrs.module.vcttrac.service.VCTModuleService; import org.openmrs.module.vcttrac.util.VCTConfigurationUtil; import org.openmrs.module.vcttrac.util.VCTTracUtil; import org.openmrs.propertyeditor.LocationEditor; import org.openmrs.propertyeditor.UserEditor; import org.openmrs.util.OpenmrsUtil; import org.openmrs.web.WebConstants; import org.springframework.beans.propertyeditors.CustomDateEditor; import org.springframework.validation.BindException; import org.springframework.validation.Errors; import org.springframework.web.bind.ServletRequestDataBinder; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.SimpleFormController; import org.springframework.web.servlet.view.RedirectView; /** * @author Yves GAKUBA */ public class VCTAutoCompleteListController extends SimpleFormController { private Log log = LogFactory.getLog(getClass()); /** * @see org.springframework.web.servlet.mvc.BaseCommandController#initBinder(javax.servlet.http.HttpServletRequest, * org.springframework.web.bind.ServletRequestDataBinder) */ @Override protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception { binder.registerCustomEditor(Location.class, new LocationEditor()); binder.registerCustomEditor(User.class, new UserEditor()); binder.registerCustomEditor(java.util.Date.class, new CustomDateEditor(OpenmrsUtil.getDateFormat(), true)); } /** * @see org.springframework.web.servlet.mvc.AbstractFormController#formBackingObject(javax.servlet.http.HttpServletRequest) */ @Override protected Object formBackingObject(HttpServletRequest request) throws Exception { VCTModuleService service = (VCTModuleService) ServiceContext.getInstance().getService(VCTModuleService.class); VCTClient client = null; VCTClientResult result = null; if (request.getParameter("testCode") != null) { client = service.getClientByCodeTest(request.getParameter("testCode")); result = getClientResultFromVCTClientObject(client, request); } else { result = new VCTClientResult(); result.setLocation(Context.getLocationService().getLocation( Integer.valueOf(VCTConfigurationUtil.getDefaultLocationId()))); result.setDateOfResult(new Date()); if (request.getParameter("tcode") != null) result.setCodeTest(request.getParameter("tcode")); } request.setAttribute("hivTestResultObsId", result.getHivTestResultObsId()); result.setClient(client); return result; } /** * Auto generated method comment * * @param client * @return */ private VCTClientResult getClientResultFromVCTClientObject(VCTClient client,HttpServletRequest request) throws Exception{ VCTClientResult result = null; if (null == client) result = new VCTClientResult(); else { result = new VCTClientResult(); result.setCodeTest(client.getCodeTest()); if (client.getResultObs() != null) { Obs ob = client.getResultObs(); for (Obs o : ob.getGroupMembers()) { if (o.getConcept().getConceptId() == VCTConfigurationUtil.getResultOfHivTestConceptId()) { result.setHivTestResult(o.getValueCoded().getConceptId()); result.setCreatedBy(o.getCreator()); result.setDateCreated(o.getDateCreated()); result.setDateOfResult(o.getObsDatetime()); result.setLocation(o.getLocation()); result.setHivTestResultObsId(o.getObsId()); } else if (o.getConcept().getConceptId() == VCTConfigurationUtil.getHivTestDateConceptId()) { result.setHivTestDateObsId(o.getObsId()); } // else if(o.getConcept().getConceptId() == VCTConfigurationUtil.getDateResultOfHivTestReceivedConceptId()) { // request.setAttribute("resultReceived", true); // } } }else{ result.setLocation(Context.getLocationService().getLocation( Integer.valueOf(VCTConfigurationUtil.getDefaultLocationId()))); // result.setDateOfResult(new Date()); result.setDateOfResult(client.getDateOfRegistration()); } } return result; } /** * @see org.springframework.web.servlet.mvc.SimpleFormController#referenceData(javax.servlet.http.HttpServletRequest, * java.lang.Object, org.springframework.validation.Errors) */ protected Map<String, Object> referenceData(HttpServletRequest request, Object command, Errors errors) throws Exception { HashMap<String, Object> map = new HashMap<String, Object>(); VCTModuleService service = (VCTModuleService) ServiceContext.getInstance().getService(VCTModuleService.class); try { map.put("resultOfHivTestOptions", VCTTracUtil.createResultOfHivTestOptions()); map.put("clientCodes", service.getAllClientCodeWithoutHivTestResult()); } catch (Exception ex) { request.getSession().setAttribute(WebConstants.OPENMRS_ERROR_ATTR, "An error occured when trying to load data. Find the error in the log file."); ex.printStackTrace(); } return map; } /** * @see org.springframework.web.servlet.mvc.SimpleFormController#onSubmit(javax.servlet.http.HttpServletRequest, * javax.servlet.http.HttpServletResponse, java.lang.Object, * org.springframework.validation.BindException) */ protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception { ModelAndView mav = new ModelAndView(new RedirectView(request.getContextPath() + getSuccessView())); if (request.getParameter("edit") == null) saveClientHivTestResultObs(request, command); else { mav = editTestCode(request); } return mav; } private ModelAndView editTestCode(HttpServletRequest request) { VCTModuleService service = (VCTModuleService) ServiceContext.getInstance().getService(VCTModuleService.class); // if(request.getParameter("edit")!=null){ VCTClient client = service.getClientByCodeTest(request.getParameter("testCode")); client.setCodeTest(request.getParameter("editedTestCode")); service.saveVCTClient(client); // client = null; // client = service.getClientByCodeTest(request.getParameter("editedTestCode")); // } ModelAndView mav = new ModelAndView(new RedirectView(request.getContextPath() + getSuccessView() + "?testCode=" + request.getParameter("editedTestCode"))); return mav; } /** * Auto generated method comment * * @param request */ private void saveClientHivTestResultObs(HttpServletRequest request, Object command) { VCTModuleService service = (VCTModuleService) ServiceContext.getInstance().getService(VCTModuleService.class); VCTClientResult result = (VCTClientResult) command; VCTClient client = (result.getClient() != null) ? result.getClient() : service.getClientByCodeTest(result .getCodeTest()); Obs hivTestConstruct = new Obs(); Obs dateOfHivTest = new Obs(); Obs resultOfHivTest = new Obs(); // Obs dateResultOfHivTestReceived = new Obs(); User creator = Context.getAuthenticatedUser(); Date createdOn = (result.getClient() != null) ? result.getDateCreated() : new Date(); Date obsDatetime = result.getDateOfResult(); Location location = result.getLocation(); try { if (client.getResultObs() != null) { hivTestConstruct = Context.getObsService().getObs(client.getResultObs().getObsId()); } hivTestConstruct.setCreator(creator); hivTestConstruct.setDateCreated(createdOn); hivTestConstruct.setLocation(location); hivTestConstruct.setPerson(client.getClient()); hivTestConstruct.setConcept(Context.getConceptService().getConcept( VCTConfigurationUtil.getVctHivTestConstructConceptId())); hivTestConstruct.setObsDatetime(obsDatetime); if (client.getResultObs() != null) { dateOfHivTest = Context.getObsService().getObs(result.getHivTestDateObsId()); } dateOfHivTest.setCreator(creator); dateOfHivTest.setDateCreated(createdOn); dateOfHivTest.setLocation(location); dateOfHivTest.setPerson(client.getClient()); dateOfHivTest.setConcept(Context.getConceptService().getConcept(VCTConfigurationUtil.getHivTestDateConceptId())); dateOfHivTest.setValueDatetime(client.getCounselingObs().getObsDatetime()); dateOfHivTest.setObsDatetime(obsDatetime); if (client.getResultObs() != null) { resultOfHivTest = Context.getObsService().getObs(result.getHivTestResultObsId()); } resultOfHivTest.setCreator(creator); resultOfHivTest.setDateCreated(createdOn); resultOfHivTest.setLocation(location); resultOfHivTest.setPerson(client.getClient()); resultOfHivTest.setConcept(Context.getConceptService().getConcept( VCTConfigurationUtil.getResultOfHivTestConceptId())); resultOfHivTest.setValueCoded(Context.getConceptService().getConcept(result.getHivTestResult())); resultOfHivTest.setObsDatetime(obsDatetime); //update if (client.getResultObs() != null) { log.info("--------------------------------------->> Trying to update the dateOfHivTest...." + result.getHivTestDateObsId()); dateOfHivTest.setObsId(result.getHivTestDateObsId()); Context.getObsService().saveObs(dateOfHivTest, "Update"); log.info("--------------------------------------->> dateOfHivTest updated!"); } if (client.getResultObs() != null) { log.info("--------------------------------------->> Trying to update the resultOfHivTest...." + result.getHivTestResultObsId()); resultOfHivTest.setObsId(result.getHivTestResultObsId()); Context.getObsService().saveObs(resultOfHivTest, "Update"); log.info("--------------------------------------->> resultOfHivTest updated!"); } if (client.getResultObs() != null) { log.info("--------------------------------------->> Trying to update the hivTestConstruct...." + client.getResultObs().getObsId()); hivTestConstruct.setObsId(client.getResultObs().getObsId()); Context.getObsService().saveObs(hivTestConstruct, "Update"); log.info("--------------------------------------->> hivTestConstruct updated!" + hivTestConstruct.getObsDatetime()); } /* end of update*/ if (client.getResultObs() == null) { log.info("--------------------------------------->> Trying to save new obs...."); hivTestConstruct.addGroupMember(dateOfHivTest); hivTestConstruct.addGroupMember(resultOfHivTest); Context.getObsService().saveObs(hivTestConstruct, null); log.info("--------------------------------------->> obs saved"); log.info("--------------------------------------->> Trying to save new obs...."); client.setResultObs(hivTestConstruct); service.saveVCTClient(client); log.info("--------------------------------------->> obs saved"); log.info("--------------------------------------->> Trying to save Sample Test"); // MohTracPortalService serv = Context.getService(MohTracPortalService.class); // SampleCode sc=serv.getSampleTestBySampleCode(result.getCodeTest()); // sc.setTestTaken(resultOfHivTest); // serv.saveSampleTest(sc); VCTTracUtil.updateSampleCodeResult(resultOfHivTest, result.getCodeTest()); log.info("--------------------------------------->> Sample Test saved"); } String msg = getMessageSourceAccessor().getMessage("Form.saved"); request.getSession().setAttribute(WebConstants.OPENMRS_MSG_ATTR, msg); } catch (Exception e) { e.printStackTrace(); String msg = getMessageSourceAccessor().getMessage("Form.not.saved"); request.getSession().setAttribute(WebConstants.OPENMRS_ERROR_ATTR, msg); } } }
UTF-8
Java
13,028
java
VCTAutoCompleteListController.java
Java
[ { "context": ".web.servlet.view.RedirectView;\r\n\r\n/**\r\n * @author Yves GAKUBA\r\n */\r\npublic class VCTAutoCompleteListController ", "end": 1931, "score": 0.9997673630714417, "start": 1920, "tag": "NAME", "value": "Yves GAKUBA" } ]
null
[]
/** * The contents of this file are subject to the OpenMRS Public License * Version 1.0 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * http://license.openmrs.org * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the * License for the specific language governing rights and limitations * under the License. * * Copyright (C) OpenMRS, LLC. All Rights Reserved. */ package org.openmrs.module.vcttrac.web.controller; import java.util.Date; import java.util.HashMap; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.openmrs.Location; import org.openmrs.Obs; import org.openmrs.User; import org.openmrs.api.context.Context; import org.openmrs.api.context.ServiceContext; import org.openmrs.module.vcttrac.VCTClient; import org.openmrs.module.vcttrac.VCTClientResult; import org.openmrs.module.vcttrac.service.VCTModuleService; import org.openmrs.module.vcttrac.util.VCTConfigurationUtil; import org.openmrs.module.vcttrac.util.VCTTracUtil; import org.openmrs.propertyeditor.LocationEditor; import org.openmrs.propertyeditor.UserEditor; import org.openmrs.util.OpenmrsUtil; import org.openmrs.web.WebConstants; import org.springframework.beans.propertyeditors.CustomDateEditor; import org.springframework.validation.BindException; import org.springframework.validation.Errors; import org.springframework.web.bind.ServletRequestDataBinder; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.SimpleFormController; import org.springframework.web.servlet.view.RedirectView; /** * @author <NAME> */ public class VCTAutoCompleteListController extends SimpleFormController { private Log log = LogFactory.getLog(getClass()); /** * @see org.springframework.web.servlet.mvc.BaseCommandController#initBinder(javax.servlet.http.HttpServletRequest, * org.springframework.web.bind.ServletRequestDataBinder) */ @Override protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception { binder.registerCustomEditor(Location.class, new LocationEditor()); binder.registerCustomEditor(User.class, new UserEditor()); binder.registerCustomEditor(java.util.Date.class, new CustomDateEditor(OpenmrsUtil.getDateFormat(), true)); } /** * @see org.springframework.web.servlet.mvc.AbstractFormController#formBackingObject(javax.servlet.http.HttpServletRequest) */ @Override protected Object formBackingObject(HttpServletRequest request) throws Exception { VCTModuleService service = (VCTModuleService) ServiceContext.getInstance().getService(VCTModuleService.class); VCTClient client = null; VCTClientResult result = null; if (request.getParameter("testCode") != null) { client = service.getClientByCodeTest(request.getParameter("testCode")); result = getClientResultFromVCTClientObject(client, request); } else { result = new VCTClientResult(); result.setLocation(Context.getLocationService().getLocation( Integer.valueOf(VCTConfigurationUtil.getDefaultLocationId()))); result.setDateOfResult(new Date()); if (request.getParameter("tcode") != null) result.setCodeTest(request.getParameter("tcode")); } request.setAttribute("hivTestResultObsId", result.getHivTestResultObsId()); result.setClient(client); return result; } /** * Auto generated method comment * * @param client * @return */ private VCTClientResult getClientResultFromVCTClientObject(VCTClient client,HttpServletRequest request) throws Exception{ VCTClientResult result = null; if (null == client) result = new VCTClientResult(); else { result = new VCTClientResult(); result.setCodeTest(client.getCodeTest()); if (client.getResultObs() != null) { Obs ob = client.getResultObs(); for (Obs o : ob.getGroupMembers()) { if (o.getConcept().getConceptId() == VCTConfigurationUtil.getResultOfHivTestConceptId()) { result.setHivTestResult(o.getValueCoded().getConceptId()); result.setCreatedBy(o.getCreator()); result.setDateCreated(o.getDateCreated()); result.setDateOfResult(o.getObsDatetime()); result.setLocation(o.getLocation()); result.setHivTestResultObsId(o.getObsId()); } else if (o.getConcept().getConceptId() == VCTConfigurationUtil.getHivTestDateConceptId()) { result.setHivTestDateObsId(o.getObsId()); } // else if(o.getConcept().getConceptId() == VCTConfigurationUtil.getDateResultOfHivTestReceivedConceptId()) { // request.setAttribute("resultReceived", true); // } } }else{ result.setLocation(Context.getLocationService().getLocation( Integer.valueOf(VCTConfigurationUtil.getDefaultLocationId()))); // result.setDateOfResult(new Date()); result.setDateOfResult(client.getDateOfRegistration()); } } return result; } /** * @see org.springframework.web.servlet.mvc.SimpleFormController#referenceData(javax.servlet.http.HttpServletRequest, * java.lang.Object, org.springframework.validation.Errors) */ protected Map<String, Object> referenceData(HttpServletRequest request, Object command, Errors errors) throws Exception { HashMap<String, Object> map = new HashMap<String, Object>(); VCTModuleService service = (VCTModuleService) ServiceContext.getInstance().getService(VCTModuleService.class); try { map.put("resultOfHivTestOptions", VCTTracUtil.createResultOfHivTestOptions()); map.put("clientCodes", service.getAllClientCodeWithoutHivTestResult()); } catch (Exception ex) { request.getSession().setAttribute(WebConstants.OPENMRS_ERROR_ATTR, "An error occured when trying to load data. Find the error in the log file."); ex.printStackTrace(); } return map; } /** * @see org.springframework.web.servlet.mvc.SimpleFormController#onSubmit(javax.servlet.http.HttpServletRequest, * javax.servlet.http.HttpServletResponse, java.lang.Object, * org.springframework.validation.BindException) */ protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception { ModelAndView mav = new ModelAndView(new RedirectView(request.getContextPath() + getSuccessView())); if (request.getParameter("edit") == null) saveClientHivTestResultObs(request, command); else { mav = editTestCode(request); } return mav; } private ModelAndView editTestCode(HttpServletRequest request) { VCTModuleService service = (VCTModuleService) ServiceContext.getInstance().getService(VCTModuleService.class); // if(request.getParameter("edit")!=null){ VCTClient client = service.getClientByCodeTest(request.getParameter("testCode")); client.setCodeTest(request.getParameter("editedTestCode")); service.saveVCTClient(client); // client = null; // client = service.getClientByCodeTest(request.getParameter("editedTestCode")); // } ModelAndView mav = new ModelAndView(new RedirectView(request.getContextPath() + getSuccessView() + "?testCode=" + request.getParameter("editedTestCode"))); return mav; } /** * Auto generated method comment * * @param request */ private void saveClientHivTestResultObs(HttpServletRequest request, Object command) { VCTModuleService service = (VCTModuleService) ServiceContext.getInstance().getService(VCTModuleService.class); VCTClientResult result = (VCTClientResult) command; VCTClient client = (result.getClient() != null) ? result.getClient() : service.getClientByCodeTest(result .getCodeTest()); Obs hivTestConstruct = new Obs(); Obs dateOfHivTest = new Obs(); Obs resultOfHivTest = new Obs(); // Obs dateResultOfHivTestReceived = new Obs(); User creator = Context.getAuthenticatedUser(); Date createdOn = (result.getClient() != null) ? result.getDateCreated() : new Date(); Date obsDatetime = result.getDateOfResult(); Location location = result.getLocation(); try { if (client.getResultObs() != null) { hivTestConstruct = Context.getObsService().getObs(client.getResultObs().getObsId()); } hivTestConstruct.setCreator(creator); hivTestConstruct.setDateCreated(createdOn); hivTestConstruct.setLocation(location); hivTestConstruct.setPerson(client.getClient()); hivTestConstruct.setConcept(Context.getConceptService().getConcept( VCTConfigurationUtil.getVctHivTestConstructConceptId())); hivTestConstruct.setObsDatetime(obsDatetime); if (client.getResultObs() != null) { dateOfHivTest = Context.getObsService().getObs(result.getHivTestDateObsId()); } dateOfHivTest.setCreator(creator); dateOfHivTest.setDateCreated(createdOn); dateOfHivTest.setLocation(location); dateOfHivTest.setPerson(client.getClient()); dateOfHivTest.setConcept(Context.getConceptService().getConcept(VCTConfigurationUtil.getHivTestDateConceptId())); dateOfHivTest.setValueDatetime(client.getCounselingObs().getObsDatetime()); dateOfHivTest.setObsDatetime(obsDatetime); if (client.getResultObs() != null) { resultOfHivTest = Context.getObsService().getObs(result.getHivTestResultObsId()); } resultOfHivTest.setCreator(creator); resultOfHivTest.setDateCreated(createdOn); resultOfHivTest.setLocation(location); resultOfHivTest.setPerson(client.getClient()); resultOfHivTest.setConcept(Context.getConceptService().getConcept( VCTConfigurationUtil.getResultOfHivTestConceptId())); resultOfHivTest.setValueCoded(Context.getConceptService().getConcept(result.getHivTestResult())); resultOfHivTest.setObsDatetime(obsDatetime); //update if (client.getResultObs() != null) { log.info("--------------------------------------->> Trying to update the dateOfHivTest...." + result.getHivTestDateObsId()); dateOfHivTest.setObsId(result.getHivTestDateObsId()); Context.getObsService().saveObs(dateOfHivTest, "Update"); log.info("--------------------------------------->> dateOfHivTest updated!"); } if (client.getResultObs() != null) { log.info("--------------------------------------->> Trying to update the resultOfHivTest...." + result.getHivTestResultObsId()); resultOfHivTest.setObsId(result.getHivTestResultObsId()); Context.getObsService().saveObs(resultOfHivTest, "Update"); log.info("--------------------------------------->> resultOfHivTest updated!"); } if (client.getResultObs() != null) { log.info("--------------------------------------->> Trying to update the hivTestConstruct...." + client.getResultObs().getObsId()); hivTestConstruct.setObsId(client.getResultObs().getObsId()); Context.getObsService().saveObs(hivTestConstruct, "Update"); log.info("--------------------------------------->> hivTestConstruct updated!" + hivTestConstruct.getObsDatetime()); } /* end of update*/ if (client.getResultObs() == null) { log.info("--------------------------------------->> Trying to save new obs...."); hivTestConstruct.addGroupMember(dateOfHivTest); hivTestConstruct.addGroupMember(resultOfHivTest); Context.getObsService().saveObs(hivTestConstruct, null); log.info("--------------------------------------->> obs saved"); log.info("--------------------------------------->> Trying to save new obs...."); client.setResultObs(hivTestConstruct); service.saveVCTClient(client); log.info("--------------------------------------->> obs saved"); log.info("--------------------------------------->> Trying to save Sample Test"); // MohTracPortalService serv = Context.getService(MohTracPortalService.class); // SampleCode sc=serv.getSampleTestBySampleCode(result.getCodeTest()); // sc.setTestTaken(resultOfHivTest); // serv.saveSampleTest(sc); VCTTracUtil.updateSampleCodeResult(resultOfHivTest, result.getCodeTest()); log.info("--------------------------------------->> Sample Test saved"); } String msg = getMessageSourceAccessor().getMessage("Form.saved"); request.getSession().setAttribute(WebConstants.OPENMRS_MSG_ATTR, msg); } catch (Exception e) { e.printStackTrace(); String msg = getMessageSourceAccessor().getMessage("Form.not.saved"); request.getSession().setAttribute(WebConstants.OPENMRS_ERROR_ATTR, msg); } } }
13,023
0.697344
0.697191
310
40.025806
33.023346
124
false
false
0
0
0
0
0
0
2.893548
false
false
9
1d5f8524eeac2d16068d76e9fac2bfa440c9ef86
11,450,382,866,291
48cf74086ca1141788cfa914caeda20dc63d8f85
/src/main/java/essentials/special/PingServer.java
3d6d1d5af96d0292765d6e830434ad2e6b35bf76
[]
no_license
Liujiaren-132/Essentials
https://github.com/Liujiaren-132/Essentials
90235fb0e3bf0636fff0989dc57ff1a886068939
c344ad7bd13eadd00f00edcdb8272589f730acf0
refs/heads/master
2021-05-21T09:04:29.872000
2020-04-02T14:22:18
2020-04-02T14:22:18
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package essentials.special; import arc.util.Strings; import mindustry.net.Host; import mindustry.net.NetworkIO; import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.InetAddress; import java.nio.ByteBuffer; import java.util.function.Consumer; public class PingServer { public static void pingServer(String ip, Consumer<Host> listener) { try { String resultIP = ip; int port = 6567; if(ip.contains(":") && Strings.canParsePostiveInt(ip.split(":")[1])){ resultIP = ip.split(":")[0]; port = Strings.parseInt(ip.split(":")[1]); } DatagramSocket socket = new DatagramSocket(); socket.setSoTimeout(1000); socket.send(new DatagramPacket(new byte[]{-2, 1}, 2, InetAddress.getByName(resultIP), port)); DatagramPacket packet = new DatagramPacket(new byte[256], 256); long start = System.currentTimeMillis(); socket.receive(packet); ByteBuffer buffer = ByteBuffer.wrap(packet.getData()); listener.accept(readServerData(buffer, ip, System.currentTimeMillis() - start)); socket.disconnect(); socket.close(); } catch (Exception e) { listener.accept(new Host(null, ip, null, 0, 0, 0, null, null, 0, null)); } } private static Host readServerData(ByteBuffer buffer, String ip, long ping){ Host host = NetworkIO.readServerData(ip, buffer); host.ping = (int)ping; return host; } }
UTF-8
Java
1,574
java
PingServer.java
Java
[]
null
[]
package essentials.special; import arc.util.Strings; import mindustry.net.Host; import mindustry.net.NetworkIO; import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.InetAddress; import java.nio.ByteBuffer; import java.util.function.Consumer; public class PingServer { public static void pingServer(String ip, Consumer<Host> listener) { try { String resultIP = ip; int port = 6567; if(ip.contains(":") && Strings.canParsePostiveInt(ip.split(":")[1])){ resultIP = ip.split(":")[0]; port = Strings.parseInt(ip.split(":")[1]); } DatagramSocket socket = new DatagramSocket(); socket.setSoTimeout(1000); socket.send(new DatagramPacket(new byte[]{-2, 1}, 2, InetAddress.getByName(resultIP), port)); DatagramPacket packet = new DatagramPacket(new byte[256], 256); long start = System.currentTimeMillis(); socket.receive(packet); ByteBuffer buffer = ByteBuffer.wrap(packet.getData()); listener.accept(readServerData(buffer, ip, System.currentTimeMillis() - start)); socket.disconnect(); socket.close(); } catch (Exception e) { listener.accept(new Host(null, ip, null, 0, 0, 0, null, null, 0, null)); } } private static Host readServerData(ByteBuffer buffer, String ip, long ping){ Host host = NetworkIO.readServerData(ip, buffer); host.ping = (int)ping; return host; } }
1,574
0.615629
0.600381
47
32.489361
27.932953
105
false
false
0
0
0
0
0
0
1
false
false
9
f54d69bb854b29767e5045a9766490ffb0bc9f08
4,724,464,077,495
739c2246c26eb44042bf100f1a8c35877b604549
/lib/src/main/java/com/flannery/lib/other/blokingQueue/A005_TryFinallyReturn.java
1fef99a0ea0e1ed36ce64eb96d5d5d79e8b8f928
[]
no_license
AdrianAndroid/JavaDemo
https://github.com/AdrianAndroid/JavaDemo
4e2e664ec3c7a3859293c3e395ea5654fb910e79
7a0b77042c46eac9913744c5e7d94df763aa620f
refs/heads/master
2023-03-11T11:46:43.758000
2021-02-21T04:02:13
2021-02-21T04:02:13
338,790,410
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.kuwo.javalib.blokingQueue; import java.security.PublicKey; public class A005_TryFinallyReturn { public static void main(String[] args) { System.out.println(test()); } public static String test() { try { System.out.println("这里是try"); return test2();//x"try的返回值"; } finally { System.out.println("这里是Finllay"); } } public static String test2() { System.out.println("return调用的内容"); return "test2的返回值"; } }
UTF-8
Java
566
java
A005_TryFinallyReturn.java
Java
[]
null
[]
package cn.kuwo.javalib.blokingQueue; import java.security.PublicKey; public class A005_TryFinallyReturn { public static void main(String[] args) { System.out.println(test()); } public static String test() { try { System.out.println("这里是try"); return test2();//x"try的返回值"; } finally { System.out.println("这里是Finllay"); } } public static String test2() { System.out.println("return调用的内容"); return "test2的返回值"; } }
566
0.575758
0.564394
26
19.307692
17.348841
45
false
false
0
0
0
0
0
0
0.346154
false
false
9
8a5b50a16b22586a258b05c149120870ecf11733
26,774,826,146,726
fa1fd0dde73930d8bbcf8c7cf46a4975cfe5fd2a
/src/main/java/com/simon/credit/toolkit/lang/wrapper/LongWrapper.java
0104ec1bfa8df1af1f681f08bc5dcd84f0c50b6c
[ "Apache-2.0" ]
permissive
xuziming/common-toolkit-core
https://github.com/xuziming/common-toolkit-core
3356ed067661ae0b88d528cd9c79c5cb636efbcd
d3a7583a295f0b1c60f367bc262a8b3f4965855a
refs/heads/master
2021-10-29T12:25:18.421000
2021-10-04T09:33:49
2021-10-04T09:33:49
162,023,565
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.simon.credit.toolkit.lang.wrapper; public class LongWrapper extends Number implements Comparable<Long> { private static final long serialVersionUID = -1758205070089085006L; private Long delegate; public LongWrapper(Long delegate) { this.delegate = delegate; } // Requires positive x public static int stringSize(long x) { long p = 10; for (int i = 1; i < 19; i++) { if (x < p) { return i; } p = 10 * p; } return 19; } public static void getChars(long i, int index, char[] buf) { long q; int r; int charPos = index; char sign = 0; if (i < 0) { sign = '-'; i = -i; } // Get 2 digits/iteration using longs until quotient fits into an int while (i > Integer.MAX_VALUE) { q = i / 100; // really: r = i - (q * 100); r = (int) (i - ((q << 6) + (q << 5) + (q << 2))); i = q; buf[--charPos] = IntegerWrapper.DigitOnes[r]; buf[--charPos] = IntegerWrapper.DigitTens[r]; } // Get 2 digits/iteration using ints int q2; int i2 = (int) i; while (i2 >= 65536) { q2 = i2 / 100; // really: r = i2 - (q * 100); r = i2 - ((q2 << 6) + (q2 << 5) + (q2 << 2)); i2 = q2; buf[--charPos] = IntegerWrapper.DigitOnes[r]; buf[--charPos] = IntegerWrapper.DigitTens[r]; } // Fall thru to fast mode for smaller numbers // assert(i2 <= 65536, i2); for (;;) { q2 = (i2 * 52429) >>> (16 + 3); r = i2 - ((q2 << 3) + (q2 << 1)); // r = i2-(q2*10) ... buf[--charPos] = IntegerWrapper.digits[r]; i2 = q2; if (i2 == 0) break; } if (sign != 0) { buf[--charPos] = sign; } } public int compareTo(Long anotherLong) { return compare(delegate.longValue(), anotherLong.longValue()); } public static int compare(long x, long y) { return (x < y) ? -1 : ((x == y) ? 0 : 1); } @Override public int intValue() { return delegate.intValue(); } @Override public long longValue() { return delegate.longValue(); } @Override public float floatValue() { return delegate.floatValue(); } @Override public double doubleValue() { return delegate.doubleValue(); } }
UTF-8
Java
2,093
java
LongWrapper.java
Java
[]
null
[]
package com.simon.credit.toolkit.lang.wrapper; public class LongWrapper extends Number implements Comparable<Long> { private static final long serialVersionUID = -1758205070089085006L; private Long delegate; public LongWrapper(Long delegate) { this.delegate = delegate; } // Requires positive x public static int stringSize(long x) { long p = 10; for (int i = 1; i < 19; i++) { if (x < p) { return i; } p = 10 * p; } return 19; } public static void getChars(long i, int index, char[] buf) { long q; int r; int charPos = index; char sign = 0; if (i < 0) { sign = '-'; i = -i; } // Get 2 digits/iteration using longs until quotient fits into an int while (i > Integer.MAX_VALUE) { q = i / 100; // really: r = i - (q * 100); r = (int) (i - ((q << 6) + (q << 5) + (q << 2))); i = q; buf[--charPos] = IntegerWrapper.DigitOnes[r]; buf[--charPos] = IntegerWrapper.DigitTens[r]; } // Get 2 digits/iteration using ints int q2; int i2 = (int) i; while (i2 >= 65536) { q2 = i2 / 100; // really: r = i2 - (q * 100); r = i2 - ((q2 << 6) + (q2 << 5) + (q2 << 2)); i2 = q2; buf[--charPos] = IntegerWrapper.DigitOnes[r]; buf[--charPos] = IntegerWrapper.DigitTens[r]; } // Fall thru to fast mode for smaller numbers // assert(i2 <= 65536, i2); for (;;) { q2 = (i2 * 52429) >>> (16 + 3); r = i2 - ((q2 << 3) + (q2 << 1)); // r = i2-(q2*10) ... buf[--charPos] = IntegerWrapper.digits[r]; i2 = q2; if (i2 == 0) break; } if (sign != 0) { buf[--charPos] = sign; } } public int compareTo(Long anotherLong) { return compare(delegate.longValue(), anotherLong.longValue()); } public static int compare(long x, long y) { return (x < y) ? -1 : ((x == y) ? 0 : 1); } @Override public int intValue() { return delegate.intValue(); } @Override public long longValue() { return delegate.longValue(); } @Override public float floatValue() { return delegate.floatValue(); } @Override public double doubleValue() { return delegate.doubleValue(); } }
2,093
0.579551
0.531295
100
19.940001
19.198864
71
false
false
0
0
0
0
0
0
2.14
false
false
9
31e10dc83145b05c69baf12b33492861f31de399
4,269,197,492,410
6601fcd1cdf98e4e35e241be3506a3d946aa8a7d
/app/src/main/java/com/kotkovets/fines/modules/launcher/assembly/LaunchModule.java
5889e4e7fe6b5071b86cb27fee9acf560f5cc1a9
[ "MIT" ]
permissive
iharkatkavets/android-auto-fines
https://github.com/iharkatkavets/android-auto-fines
70bedfc4dbbaefe33f53cb29b63656bdc420e79f
438646c2d9281c5c47dfd0638b39973e484b8cc8
refs/heads/master
2021-10-10T08:12:22.892000
2016-11-28T21:13:14
2016-11-28T21:13:14
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.kotkovets.fines.modules.launcher.assembly; import android.content.Context; import com.kotkovets.fines.modules.launcher.presenter.LauncherModuleInput; import com.kotkovets.fines.modules.launcher.presenter.LauncherPresenter; import com.kotkovets.fines.modules.launcher.router.LauncherRouter; import com.kotkovets.fines.modules.launcher.view.LauncherViewInput; import dagger.Module; import dagger.Provides; /** * Created by igork on 7/22/16. */ @Module public class LaunchModule { LauncherViewInput mView; public LaunchModule(LauncherViewInput view) { mView = view; } @Provides LauncherModuleInput providesLauncherPresenter() { LauncherRouter router = new LauncherRouter(); router.setContext((Context) mView); LauncherPresenter presenter = new LauncherPresenter(); presenter.setView(mView); presenter.setRouter(router); return presenter; } }
UTF-8
Java
943
java
LaunchModule.java
Java
[ { "context": "Module;\nimport dagger.Provides;\n\n/**\n * Created by igork on 7/22/16.\n */\n\n@Module\npublic class LaunchModul", "end": 443, "score": 0.9996541738510132, "start": 438, "tag": "USERNAME", "value": "igork" } ]
null
[]
package com.kotkovets.fines.modules.launcher.assembly; import android.content.Context; import com.kotkovets.fines.modules.launcher.presenter.LauncherModuleInput; import com.kotkovets.fines.modules.launcher.presenter.LauncherPresenter; import com.kotkovets.fines.modules.launcher.router.LauncherRouter; import com.kotkovets.fines.modules.launcher.view.LauncherViewInput; import dagger.Module; import dagger.Provides; /** * Created by igork on 7/22/16. */ @Module public class LaunchModule { LauncherViewInput mView; public LaunchModule(LauncherViewInput view) { mView = view; } @Provides LauncherModuleInput providesLauncherPresenter() { LauncherRouter router = new LauncherRouter(); router.setContext((Context) mView); LauncherPresenter presenter = new LauncherPresenter(); presenter.setView(mView); presenter.setRouter(router); return presenter; } }
943
0.744433
0.73913
36
25.194445
24.456104
74
false
false
0
0
0
0
0
0
0.444444
false
false
9
787e9339ed6cfe6d61ff93f2b7899421c6944714
23,794,118,870,694
c9be465db7fccf8744379da3bf4cbe19b2548286
/app/src/main/java/com/example/samsung/multimemoapplication/manager/PropertyManager.java
81d47e250d70a6d1bc8d9603a70a4de698344153
[]
no_license
tak8997/MultiM
https://github.com/tak8997/MultiM
8c090eb693179af3914c293ef505db943d6f0f12
dbdb50cc14a864351bb73de50f27a1019cc19cb3
refs/heads/master
2020-05-23T10:21:49.618000
2017-03-18T11:02:53
2017-03-18T11:02:53
80,425,257
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.samsung.multimemoapplication.manager; import android.content.SharedPreferences; import android.preference.PreferenceManager; import com.example.samsung.multimemoapplication.common.MyApplication; import com.example.samsung.multimemoapplication.model.User; import com.facebook.login.LoginManager; /** * Created by Tak on 2017. 2. 21.. */ public class PropertyManager { private static PropertyManager instance; public static PropertyManager getInstance() { if (instance == null) instance = new PropertyManager(); return instance; } private SharedPreferences mPrefs; private SharedPreferences.Editor mEditor; // public interface OnResultListener<T> { // public void onSuccess(T result); // public void onFail(int code); // } // // private OnResultListener listener; private PropertyManager() { mPrefs = PreferenceManager.getDefaultSharedPreferences(MyApplication.getContext()); mEditor = mPrefs.edit(); } // public void setOnResultListener(OnResultListener listener) { // this.listener = listener; // } public static final String USER_EMAIL = "email"; public static final String USER_PASSWORD = "password"; public static final String USER_FACEBOOK_TOKEN = "facebookToken"; public void setEmail(String email) { mEditor.putString(USER_EMAIL, email); mEditor.commit(); } public String getEmail() { return mPrefs.getString(USER_EMAIL, ""); } public void setPassword(String password) { mEditor.putString(USER_PASSWORD, password); mEditor.commit(); } public String getPassword() { return mPrefs.getString(USER_PASSWORD, ""); } public void setUserFacebookToken(String userFacebookToken) { mEditor.putString(USER_FACEBOOK_TOKEN, userFacebookToken); mEditor.commit(); } public String getUserFacebookToken() { return mPrefs.getString(USER_FACEBOOK_TOKEN, ""); } public void userClear() { if(getUserFacebookToken() != null) { LoginManager.getInstance().logOut(); } else { mEditor.clear(); mEditor.commit(); } } // public void getAuthWithIdPassword(String id, String password, OnResultListener<User> listener) { // setOnResultListener(listener); // getIdPassword(id, password); // } // // private void getIdPassword(String id, String password) { // if(listener != null && id == getId() && password == getPassword()) { // User user = new User(id, password); // // listener.onSuccess(user); // } // } public boolean isBackupSync() { return mPrefs.getBoolean("perf_sync", false); } }
UTF-8
Java
2,796
java
PropertyManager.java
Java
[ { "context": "om.facebook.login.LoginManager;\n\n/**\n * Created by Tak on 2017. 2. 21..\n */\n\npublic class PropertyManage", "end": 339, "score": 0.4590660333633423, "start": 336, "tag": "NAME", "value": "Tak" }, { "context": ";\n public static final String USER_PASSWORD = \"pas...
null
[]
package com.example.samsung.multimemoapplication.manager; import android.content.SharedPreferences; import android.preference.PreferenceManager; import com.example.samsung.multimemoapplication.common.MyApplication; import com.example.samsung.multimemoapplication.model.User; import com.facebook.login.LoginManager; /** * Created by Tak on 2017. 2. 21.. */ public class PropertyManager { private static PropertyManager instance; public static PropertyManager getInstance() { if (instance == null) instance = new PropertyManager(); return instance; } private SharedPreferences mPrefs; private SharedPreferences.Editor mEditor; // public interface OnResultListener<T> { // public void onSuccess(T result); // public void onFail(int code); // } // // private OnResultListener listener; private PropertyManager() { mPrefs = PreferenceManager.getDefaultSharedPreferences(MyApplication.getContext()); mEditor = mPrefs.edit(); } // public void setOnResultListener(OnResultListener listener) { // this.listener = listener; // } public static final String USER_EMAIL = "email"; public static final String USER_PASSWORD = "<PASSWORD>"; public static final String USER_FACEBOOK_TOKEN = "facebookToken"; public void setEmail(String email) { mEditor.putString(USER_EMAIL, email); mEditor.commit(); } public String getEmail() { return mPrefs.getString(USER_EMAIL, ""); } public void setPassword(String password) { mEditor.putString(USER_PASSWORD, password); mEditor.commit(); } public String getPassword() { return mPrefs.getString(USER_PASSWORD, ""); } public void setUserFacebookToken(String userFacebookToken) { mEditor.putString(USER_FACEBOOK_TOKEN, userFacebookToken); mEditor.commit(); } public String getUserFacebookToken() { return mPrefs.getString(USER_FACEBOOK_TOKEN, ""); } public void userClear() { if(getUserFacebookToken() != null) { LoginManager.getInstance().logOut(); } else { mEditor.clear(); mEditor.commit(); } } // public void getAuthWithIdPassword(String id, String password, OnResultListener<User> listener) { // setOnResultListener(listener); // getIdPassword(id, password); // } // // private void getIdPassword(String id, String password) { // if(listener != null && id == getId() && password == getPassword()) { // User user = new User(id, password); // // listener.onSuccess(user); // } // } public boolean isBackupSync() { return mPrefs.getBoolean("perf_sync", false); } }
2,798
0.651645
0.649142
98
27.530613
24.631655
106
false
false
0
0
0
0
0
0
0.5
false
false
9
34e653068d16f19237f32fe85978ed0377edafa8
19,602,230,806,538
e39455578162c368593d04f25774844d2a905a25
/src/material/io/FindRepController.java
3976497046e0627e16fb864fd6d61a6721f8da65
[]
no_license
Anupchandra/Quark
https://github.com/Anupchandra/Quark
2bac0dfbf36f6eac72f8ad554a9af7bfb5de9012
7e1012a760e624f9ee47c02a7149980e67be5b37
refs/heads/master
2020-03-18T01:04:02.642000
2018-05-30T13:52:18
2018-05-30T13:52:18
134,125,777
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * 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 material.io; import java.io.IOException; import java.net.URL; import java.util.ResourceBundle; import java.util.logging.Level; import java.util.logging.Logger; import java.util.regex.Matcher; import java.util.regex.Pattern; import javafx.application.Platform; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.fxml.Initializable; import javafx.scene.Parent; import javafx.scene.control.TextArea; import javafx.stage.Stage; /** * FXML Controller class * * @author ANANTHANUP */ public class FindRepController implements Initializable { /** * Initializes the controller class. */ @FXML public javafx.scene.control.TextArea tffile; @FXML public javafx.scene.control.Button btfind; @FXML public javafx.scene.control.Button button; @FXML public javafx.scene.control.Button btreplace; @FXML public javafx.scene.control.TextField tfind; @FXML public javafx.scene.control.TextField tfreplace; @FXML public javafx.scene.control.Label lbnotfound; @FXML public javafx.scene.control.Label lblreplace; String text; public String getText2() { return text; } @FXML public void Find(ActionEvent event) throws IOException { tffile.setStyle("-fx-highlight-fill: lightgray; -fx-highlight-text-fill: firebrick; -fx-font-size: 12px;"); String find = tfind.getText(); String text = tffile.getText(); Pattern word = Pattern.compile(find); Matcher match = word.matcher(text); if(!match.find()) { lbnotfound.setVisible(true); } else { lbnotfound.setVisible(false); Platform.runLater(new Runnable() { @Override public void run() { tffile.selectRange(match.start(),match.end()); } }); } } @FXML private void Replace(ActionEvent event) { tffile.setStyle("-fx-highlight-fill: lightgray; -fx-highlight-text-fill: firebrick; -fx-font-size: 12px;"); String find = tfind.getText(); String text = tffile.getText(); String replace = tfreplace.getText(); Pattern word = Pattern.compile(find); Matcher match = word.matcher(text); if(!match.find()) { lbnotfound.setVisible(true); } else { if(replace.equals("")) { lblreplace.setVisible(true); } else { lblreplace.setVisible(false); Platform.runLater(new Runnable() { @Override public void run() { tffile.selectRange(match.start(),match.end()); tffile.replaceSelection(replace); } }); } } } @FXML private void handleButtonAction(ActionEvent event) { text = tffile.getText(); // close this window... button.getScene().getWindow().hide(); /*Stage stage = (Stage) button.getScene().getWindow(); stage.close();*/ } @Override public void initialize(URL url, ResourceBundle rb) { // TODO } }
UTF-8
Java
3,459
java
FindRepController.java
Java
[ { "context": "Stage;\n\n/**\n * FXML Controller class\n *\n * @author ANANTHANUP\n */\npublic class FindRepController implements I", "end": 722, "score": 0.607643723487854, "start": 714, "tag": "USERNAME", "value": "ANANTHAN" }, { "context": "**\n * FXML Controller class\n *\n * @aut...
null
[]
/* * 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 material.io; import java.io.IOException; import java.net.URL; import java.util.ResourceBundle; import java.util.logging.Level; import java.util.logging.Logger; import java.util.regex.Matcher; import java.util.regex.Pattern; import javafx.application.Platform; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.fxml.Initializable; import javafx.scene.Parent; import javafx.scene.control.TextArea; import javafx.stage.Stage; /** * FXML Controller class * * @author ANANTHANUP */ public class FindRepController implements Initializable { /** * Initializes the controller class. */ @FXML public javafx.scene.control.TextArea tffile; @FXML public javafx.scene.control.Button btfind; @FXML public javafx.scene.control.Button button; @FXML public javafx.scene.control.Button btreplace; @FXML public javafx.scene.control.TextField tfind; @FXML public javafx.scene.control.TextField tfreplace; @FXML public javafx.scene.control.Label lbnotfound; @FXML public javafx.scene.control.Label lblreplace; String text; public String getText2() { return text; } @FXML public void Find(ActionEvent event) throws IOException { tffile.setStyle("-fx-highlight-fill: lightgray; -fx-highlight-text-fill: firebrick; -fx-font-size: 12px;"); String find = tfind.getText(); String text = tffile.getText(); Pattern word = Pattern.compile(find); Matcher match = word.matcher(text); if(!match.find()) { lbnotfound.setVisible(true); } else { lbnotfound.setVisible(false); Platform.runLater(new Runnable() { @Override public void run() { tffile.selectRange(match.start(),match.end()); } }); } } @FXML private void Replace(ActionEvent event) { tffile.setStyle("-fx-highlight-fill: lightgray; -fx-highlight-text-fill: firebrick; -fx-font-size: 12px;"); String find = tfind.getText(); String text = tffile.getText(); String replace = tfreplace.getText(); Pattern word = Pattern.compile(find); Matcher match = word.matcher(text); if(!match.find()) { lbnotfound.setVisible(true); } else { if(replace.equals("")) { lblreplace.setVisible(true); } else { lblreplace.setVisible(false); Platform.runLater(new Runnable() { @Override public void run() { tffile.selectRange(match.start(),match.end()); tffile.replaceSelection(replace); } }); } } } @FXML private void handleButtonAction(ActionEvent event) { text = tffile.getText(); // close this window... button.getScene().getWindow().hide(); /*Stage stage = (Stage) button.getScene().getWindow(); stage.close();*/ } @Override public void initialize(URL url, ResourceBundle rb) { // TODO } }
3,459
0.603354
0.601908
117
28.564102
22.126438
115
false
false
0
0
0
0
0
0
0.538462
false
false
9
828f4e6633bf74887a8c7b4f60c2ad2494a0239c
21,457,656,675,750
c9c66117a16dbb8bf9acea2443ed369238b456cf
/src/main/java/com/arun/SpringawsApplication.java
33fcc296742f43c7ff076800bc8807a726d2544f
[]
no_license
arun786/springaws
https://github.com/arun786/springaws
ceca3954656194f7ece3a6da5ffca92c55909467
456ecb6fc3e6c884b8871cb83e9f090f8af340fb
refs/heads/master
2020-04-27T16:11:08.469000
2019-04-14T07:26:34
2019-04-14T07:26:34
174,475,129
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.arun; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; @SpringBootApplication public class SpringawsApplication extends SpringBootServletInitializer { /* * To create a war file * step 1 Extends SpringBootServletInitializer * step 2 override the configure method * step 3 change the jar file to war file in pom */ @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { return builder.sources(SpringawsApplication.class); } public static void main(String[] args) { SpringApplication.run(SpringawsApplication.class, args); } }
UTF-8
Java
862
java
SpringawsApplication.java
Java
[]
null
[]
package com.arun; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; @SpringBootApplication public class SpringawsApplication extends SpringBootServletInitializer { /* * To create a war file * step 1 Extends SpringBootServletInitializer * step 2 override the configure method * step 3 change the jar file to war file in pom */ @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { return builder.sources(SpringawsApplication.class); } public static void main(String[] args) { SpringApplication.run(SpringawsApplication.class, args); } }
862
0.773782
0.770302
27
30.925926
28.995436
84
false
false
0
0
0
0
0
0
0.296296
false
false
9
0574604c54f97e68afa1e45459aef09aa12fcc9f
35,287,451,357,051
0eedd119253cfd1d74716630bc7bc347bab8c5ef
/coursepr/src/main/java/com/example/demo/DB/GetData.java
e1f9c67f18a548272261c187f24ed087ff090e7e
[]
no_license
beatusapril/reportgenerator
https://github.com/beatusapril/reportgenerator
96e5940b830a4bb5c3b5360301726a9b4cb804f3
034566efc1db325d1a44529838e8ce4e89962d75
refs/heads/master
2020-04-26T13:01:57.383000
2019-03-12T22:22:55
2019-03-12T22:22:55
173,568,071
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.demo.DB; import org.springframework.beans.factory.annotation.Value; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; public class GetData { @Value("${spring.datasource.username}") private String user; @Value("${spring.datasource.password}") private String password; @Value("${spring.datasource.url = jdbc:postgresql://localhost/springdb}") private String url; public String getNameTables() throws SQLException { Connection con = DriverManager.getConnection(url, user, password); ResultSet rs = con.getMetaData().getCatalogs(); String s = ""; while (rs.next()) { s += "TABLE_CAT = " + rs.getString("TABLE_CAT"); } return s; } }
UTF-8
Java
811
java
GetData.java
Java
[]
null
[]
package com.example.demo.DB; import org.springframework.beans.factory.annotation.Value; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; public class GetData { @Value("${spring.datasource.username}") private String user; @Value("${spring.datasource.password}") private String password; @Value("${spring.datasource.url = jdbc:postgresql://localhost/springdb}") private String url; public String getNameTables() throws SQLException { Connection con = DriverManager.getConnection(url, user, password); ResultSet rs = con.getMetaData().getCatalogs(); String s = ""; while (rs.next()) { s += "TABLE_CAT = " + rs.getString("TABLE_CAT"); } return s; } }
811
0.667078
0.667078
28
27.964285
22.466614
77
false
false
0
0
0
0
0
0
0.571429
false
false
9
6d05cd96402b4b068c8d650d760857564c21d93c
31,421,980,772,894
9396cf565634d234e06971c28ca78884b7064565
/模拟银行存取款系统/src/bank/Bank.java
5b1d7ea167a90c4c7a40db2519c11b9fd96ce7d3
[]
no_license
chenzj-tanpp/study
https://github.com/chenzj-tanpp/study
f8fd2973d6c2fb0d4af56bc53ffdb03c751723c0
c37d5d44c81b11041d6461da85edd28b624e48b9
refs/heads/master
2020-07-23T03:02:25.687000
2020-01-03T03:46:47
2020-01-03T03:46:47
207,427,413
0
0
null
false
2019-11-26T08:54:29
2019-09-10T00:06:29
2019-11-26T08:51:13
2019-11-26T08:54:28
119
0
0
0
Java
false
false
package bank; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.Scanner; import user.*; import dbutils.*; public class Bank { int account; private static User user; public static void main(String[] args) throws Exception { Bank bank = new Bank(); bank.login(); bank.operate(); } // 金额存入、取出、查询 public void operate() throws Exception { Bank bank = new Bank(); int n; Scanner sc = new Scanner(System.in); while (true) { System.out.println("请选择你要进行的操作:"); System.out.println("1: 存入\t 2:取出\t 3:查询\t0:退出"); n = sc.nextInt(); if (n == 1 || n == 2) { int num = 0; try { System.out.println("请输入您的存取款数:"); num = sc.nextInt(); } catch (Exception e) { System.out.println("输入金额错误"); continue; } switch (n) { case 1: bank.income(num); break; case 2: bank.takeout(num); break; default: break; } } else if (n == 3) { show(); } else if (n == 0) { DBUtils dt = DBUtils.getInstance(); dt.flash(); // System.exit(0); break; } else { System.out.println("请输入0~3之间的数字选择操作"); } } } public void login() throws Exception { DBUtils dt = DBUtils.getInstance(); Scanner sc = new Scanner(System.in); while (true) { System.out.println("请输入您的卡号:"); String cardID = sc.nextLine(); System.out.println("请输入密码:"); String cardPwd = sc.nextLine(); user = dt.getUser(cardID); if (dt.getUsers().containsKey(cardID) && user.getCardPwd().equals(cardPwd)) { System.out.println("登陆成功");// 登陆成功 break; } else { System.out.println("密码或账号错误,请重新输入!");// 失败 continue; } } } public void income(int num) { account = user.getAccount() + num; user.setAccount(account); System.out.println("已成功存入,请继续您的操作。");// 存入成功 } public void takeout(int num) { if (user.getAccount() >= num) { account = user.getAccount() - num; user.setAccount(account); System.out.println("已取出");// 成功 } else { System.out.println("您的余额不足:请重新选择您的操作");// 失败 } } public void show() { account = user.getAccount(); System.out.println("您的余额为" + account + "元");// 输出 } }
GB18030
Java
2,541
java
Bank.java
Java
[]
null
[]
package bank; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.Scanner; import user.*; import dbutils.*; public class Bank { int account; private static User user; public static void main(String[] args) throws Exception { Bank bank = new Bank(); bank.login(); bank.operate(); } // 金额存入、取出、查询 public void operate() throws Exception { Bank bank = new Bank(); int n; Scanner sc = new Scanner(System.in); while (true) { System.out.println("请选择你要进行的操作:"); System.out.println("1: 存入\t 2:取出\t 3:查询\t0:退出"); n = sc.nextInt(); if (n == 1 || n == 2) { int num = 0; try { System.out.println("请输入您的存取款数:"); num = sc.nextInt(); } catch (Exception e) { System.out.println("输入金额错误"); continue; } switch (n) { case 1: bank.income(num); break; case 2: bank.takeout(num); break; default: break; } } else if (n == 3) { show(); } else if (n == 0) { DBUtils dt = DBUtils.getInstance(); dt.flash(); // System.exit(0); break; } else { System.out.println("请输入0~3之间的数字选择操作"); } } } public void login() throws Exception { DBUtils dt = DBUtils.getInstance(); Scanner sc = new Scanner(System.in); while (true) { System.out.println("请输入您的卡号:"); String cardID = sc.nextLine(); System.out.println("请输入密码:"); String cardPwd = sc.nextLine(); user = dt.getUser(cardID); if (dt.getUsers().containsKey(cardID) && user.getCardPwd().equals(cardPwd)) { System.out.println("登陆成功");// 登陆成功 break; } else { System.out.println("密码或账号错误,请重新输入!");// 失败 continue; } } } public void income(int num) { account = user.getAccount() + num; user.setAccount(account); System.out.println("已成功存入,请继续您的操作。");// 存入成功 } public void takeout(int num) { if (user.getAccount() >= num) { account = user.getAccount() - num; user.setAccount(account); System.out.println("已取出");// 成功 } else { System.out.println("您的余额不足:请重新选择您的操作");// 失败 } } public void show() { account = user.getAccount(); System.out.println("您的余额为" + account + "元");// 输出 } }
2,541
0.612073
0.605859
108
19.861111
15.86077
80
false
false
0
0
0
0
0
0
2.722222
false
false
9
fc70a0e30b628105f7d70cc6abfd33f937381573
26,362,509,324,138
706d9cffeed5fd314b7fec19589e599888526847
/app/src/main/java/com/example/romulo/appmae/Receita.java
75d08b2a0dd8bb57609f3d39a01795d58aa44d83
[]
no_license
romulooliveirasousa/HelpCheff
https://github.com/romulooliveirasousa/HelpCheff
56831442b9bb35961d263c76ffe5c7786e42ad74
df416a7e5263c4426b69ee88caf0ef116d74e779
refs/heads/master
2021-06-16T11:46:55.596000
2017-05-28T16:50:14
2017-05-28T16:50:14
92,673,492
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.romulo.appmae; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.TextView; import android.widget.Toast; import com.squareup.moshi.Moshi; import java.util.ArrayList; import java.util.Arrays; public class Receita extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_receita); Intent intent = getIntent(); String recei = (String) intent.getSerializableExtra("nome"); // ArrayList<String> listItems = new ArrayList<String>(); // listItems = new HomeActivity(); String texto = recei; int inicio1 = texto.indexOf("NOME\":\"")+7; int fim1 = texto.indexOf("\",\"", inicio1); // System.out.println(texto.substring(inicio, fim)); int inicio2 = texto.indexOf("CEITA\":\"")+7; int fim2 = texto.indexOf("\"}", inicio2); TextView textView = (TextView) findViewById(R.id.textRec); TextView textView1= (TextView) findViewById(R.id.textRec2); String Receita = texto.substring(inicio1,fim1)+" \n"; String Descricao = texto.substring(inicio2,fim2)+" \n"; textView.setText(Receita); textView.setVisibility(View.VISIBLE); textView1.setText(Descricao); textView1.setVisibility(View.VISIBLE); // ajustar(recei); } }
UTF-8
Java
1,514
java
Receita.java
Java
[ { "context": "package com.example.romulo.appmae;\n\nimport android.content.Intent;\nimport an", "end": 26, "score": 0.6813718676567078, "start": 23, "tag": "USERNAME", "value": "ulo" } ]
null
[]
package com.example.romulo.appmae; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.TextView; import android.widget.Toast; import com.squareup.moshi.Moshi; import java.util.ArrayList; import java.util.Arrays; public class Receita extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_receita); Intent intent = getIntent(); String recei = (String) intent.getSerializableExtra("nome"); // ArrayList<String> listItems = new ArrayList<String>(); // listItems = new HomeActivity(); String texto = recei; int inicio1 = texto.indexOf("NOME\":\"")+7; int fim1 = texto.indexOf("\",\"", inicio1); // System.out.println(texto.substring(inicio, fim)); int inicio2 = texto.indexOf("CEITA\":\"")+7; int fim2 = texto.indexOf("\"}", inicio2); TextView textView = (TextView) findViewById(R.id.textRec); TextView textView1= (TextView) findViewById(R.id.textRec2); String Receita = texto.substring(inicio1,fim1)+" \n"; String Descricao = texto.substring(inicio2,fim2)+" \n"; textView.setText(Receita); textView.setVisibility(View.VISIBLE); textView1.setText(Descricao); textView1.setVisibility(View.VISIBLE); // ajustar(recei); } }
1,514
0.67107
0.659841
48
30.520834
22.893766
68
false
false
0
0
0
0
0
0
0.770833
false
false
9
a76101306de7cc2bb870cf40c9dac7478d0544fc
32,830,730,068,577
9d50aca954e72cf788475d57a4ec16cb8db9f6b9
/app/src/main/java/com/tecmanic/toketani/modelclass/GoogleMapDataModel.java
b9c21ec3f9948f6df622cf7d22993909e54ffe46
[]
no_license
mrliputo/ToketAni
https://github.com/mrliputo/ToketAni
d945c2c52fc5f78a5643df3aaa48ea65e90d8049
b926a83455c001131f57149c1734387f5605f5d6
refs/heads/master
2023-02-28T08:10:59.597000
2021-02-04T07:14:00
2021-02-04T07:14:00
329,860,430
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.tecmanic.toketani.modelclass; import com.google.gson.annotations.SerializedName; import java.io.Serializable; public class GoogleMapDataModel implements Serializable { @SerializedName("id") private String id; @SerializedName("map_api_key") private String mapApiKey; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getMapApiKey() { return mapApiKey; } public void setMapApiKey(String mapApiKey) { this.mapApiKey = mapApiKey; } }
UTF-8
Java
577
java
GoogleMapDataModel.java
Java
[]
null
[]
package com.tecmanic.toketani.modelclass; import com.google.gson.annotations.SerializedName; import java.io.Serializable; public class GoogleMapDataModel implements Serializable { @SerializedName("id") private String id; @SerializedName("map_api_key") private String mapApiKey; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getMapApiKey() { return mapApiKey; } public void setMapApiKey(String mapApiKey) { this.mapApiKey = mapApiKey; } }
577
0.667244
0.667244
28
19.607143
17.542477
57
false
false
0
0
0
0
0
0
0.321429
false
false
9
ecef2c78b31a88d9a5006b35eed1f904bce59b90
8,229,157,347,276
5310b4ca8b3fa6dc4508e456761a590fca561470
/Grade.java
c2b50faed1575af3e0ad8819f81098a1f774f3b3
[]
no_license
pos1017/java_subject1
https://github.com/pos1017/java_subject1
df580a595af0ea8e4717dc3d814b1194775e5301
46a9a4ee0a351df6a40dec9cf357c5263ebcbe94
refs/heads/master
2018-04-22T17:25:48.208000
2017-05-14T08:42:04
2017-05-14T08:42:04
91,228,215
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Created by hyeonwoo on 2017-05-12. */ public class Grade { public void yourGrade(){ int yourPoint = 76; if( yourPoint >= 90 ) { System.out.println("A"); }else if( yourPoint >= 80 ){ System.out.println("B"); }else if( yourPoint >= 70 ){ System.out.println("C"); }else{ System.out.println("F"); } System.out.println("-----------------------------"); } }
UTF-8
Java
495
java
Grade.java
Java
[ { "context": "/**\r\n * Created by hyeonwoo on 2017-05-12.\r\n */\r\npublic class Grade {\r\n pu", "end": 27, "score": 0.9994782209396362, "start": 19, "tag": "USERNAME", "value": "hyeonwoo" } ]
null
[]
/** * Created by hyeonwoo on 2017-05-12. */ public class Grade { public void yourGrade(){ int yourPoint = 76; if( yourPoint >= 90 ) { System.out.println("A"); }else if( yourPoint >= 80 ){ System.out.println("B"); }else if( yourPoint >= 70 ){ System.out.println("C"); }else{ System.out.println("F"); } System.out.println("-----------------------------"); } }
495
0.426263
0.393939
20
22.75
16.810339
60
false
false
0
0
0
0
0
0
0.3
false
false
9
1f6e5456ab71639fcd192ae5df7e38c49a90e919
28,140,625,769,490
f8163720571aff5f18edc7bfd895251d9e5c7558
/server/src/main/java/com/ch3oh/portfolio/persistence/RoleTypeEnum.java
a9ae5222ad4036b83106cdcd0f15c22655a7e8a1
[]
no_license
yoonyok/PortfolioManagement
https://github.com/yoonyok/PortfolioManagement
aa7d71d341526bfe2dd8d3f7a1a692d9572be8aa
65919bfa484cb40f02b915dc70e88444caebe6c8
refs/heads/master
2020-03-14T21:08:12.066000
2018-04-04T17:43:45
2018-04-04T17:43:45
131,790,025
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ch3oh.portfolio.persistence; public enum RoleTypeEnum { SUPER_ADMIN(10), PORTFOLIO_MANAGER(8), PROJECT_MANAGER(6), RESOURCE_MANAGER(4), RESOURCE(2); private int value; RoleTypeEnum(int value) { this.value = value; } public int getValue() { return value; } }
UTF-8
Java
330
java
RoleTypeEnum.java
Java
[]
null
[]
package com.ch3oh.portfolio.persistence; public enum RoleTypeEnum { SUPER_ADMIN(10), PORTFOLIO_MANAGER(8), PROJECT_MANAGER(6), RESOURCE_MANAGER(4), RESOURCE(2); private int value; RoleTypeEnum(int value) { this.value = value; } public int getValue() { return value; } }
330
0.615152
0.593939
19
16.368422
12.239757
40
false
false
0
0
0
0
0
0
0.473684
false
false
9
a3384d7c041b104b9da1958aace4ec498e0a2b15
22,050,362,167,611
2439e55e4a4ad9da7e0665d787475bde5468fe77
/src/main/com/zetcode/game_tiles/Egg.java
58376bef52f8090eea2bc1c350d06b014344613e
[]
no_license
Drachenbauer/AngryBirdsSokoban
https://github.com/Drachenbauer/AngryBirdsSokoban
d470d03a59cb032fecf4f45aadb175c5e31d46aa
af17ed8736d8f4ebbdbd1a1d922ce37e6eb23b9c
refs/heads/master
2021-06-29T03:57:46.113000
2020-10-31T21:41:41
2020-10-31T21:41:41
184,475,795
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package main.com.zetcode.game_tiles; import javax.swing.ImageIcon; public class Egg extends Movable { public ImageIcon iicon_egg_1 = new ImageIcon("src/main/resources/egg_1.png"); public ImageIcon iicon_egg_2 = new ImageIcon("src/main/resources/egg_2.png"); public Egg(int x, int y) { super(x, y); setImage(iicon_egg_1); } }
UTF-8
Java
377
java
Egg.java
Java
[]
null
[]
package main.com.zetcode.game_tiles; import javax.swing.ImageIcon; public class Egg extends Movable { public ImageIcon iicon_egg_1 = new ImageIcon("src/main/resources/egg_1.png"); public ImageIcon iicon_egg_2 = new ImageIcon("src/main/resources/egg_2.png"); public Egg(int x, int y) { super(x, y); setImage(iicon_egg_1); } }
377
0.64191
0.628647
16
22.5625
25.438576
81
false
false
0
0
0
0
0
0
0.5
false
false
9
b290e163574e6a3dc10bd65086e94231fff210cd
24,618,752,557,558
ea011f5ec5ea7bdaf35bb5e17f88a67cff124440
/app/src/main/java/com/example/tinni/adapters/AddAnswersAdapter.java
a1ffbcdd32025de3b7a0653109f22aa68ce12884
[]
no_license
Taledrops/Tinni
https://github.com/Taledrops/Tinni
a46a6214ed254b17b9573761a4c472e8155e217c
db0182a8610ea847f8ce8cc897f7095362edc22d
refs/heads/master
2022-11-16T19:11:53.721000
2020-07-18T08:54:25
2020-07-18T08:54:25
273,188,569
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.tinni.adapters; import android.view.LayoutInflater; import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import com.example.tinni.databinding.AddAnswerItemBinding; import com.example.tinni.helpers.ItemMoveCallback; import com.example.tinni.models.Answer; import java.util.Collections; import java.util.List; /** * <h1>Add Answers Adapter</h1> * Adapter for Answer items in the add form * * Variables: * List<Answer> answerList: A list of Answer objects to display * * Source: * https://stackoverflow.com/a/48941212/2700965 * * @author Nassim Amar * @version 1.0 * @since 29.06.2020 */ public class AddAnswersAdapter extends RecyclerView.Adapter<AddAnswersAdapter.AnswerViewHolder> implements ItemMoveCallback.ItemTouchHelperContract { public List<Answer> answerList; public AddAnswersAdapter(List<Answer> answerList) { this.answerList = answerList; } /** * <h2>On Create View Holder</h2> * Overriding and creating the view holder */ @NonNull @Override public AnswerViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext()); AddAnswerItemBinding itemBinding = AddAnswerItemBinding.inflate(layoutInflater, parent, false); return new AnswerViewHolder(itemBinding); } /** * <h2>On Bind View Holder</h2> * Overriding and binding the view holder */ @Override public void onBindViewHolder(@NonNull AnswerViewHolder holder, int position) { Answer answer = answerList.get(position); holder.bind(answer); } /** * <h2>Get Item Count</h2> * Returns the sound_item_horizontal count of the answerList */ @Override public int getItemCount() { return answerList != null ? answerList.size() : 0; } public static class AnswerViewHolder extends RecyclerView.ViewHolder { private AddAnswerItemBinding binding; public AnswerViewHolder(AddAnswerItemBinding binding) { super(binding.getRoot()); this.binding = binding; } public void bind(Answer program) { binding.setModel(program); binding.executePendingBindings(); } } /** * <h2>Get Item</h2> * Get sound_item_horizontal inside the answerList by its index */ public Answer getItem(int position) { if (answerList != null && getItemCount() > position) { return answerList.get(position); } else { return null; } } /** * <h2>Reload List</h2> * Reload the list and update the ui */ public void reloadList() { this.notifyDataSetChanged(); } /** * <h2>Remove Item</h2> * Remove sound_item_horizontal from the answerList */ public void removeItem(Answer answer) { if (answerList != null) { int position = answerList.indexOf(answer); answerList.remove(answer); notifyItemRemoved(position); } } /** * <h2>Add Item</h2> * Add sound_item_horizontal to the answerList with its new index */ public void addItem(Answer answer) { if (answerList != null) { answerList.add(answer); notifyItemInserted(answerList.size() - 1); } } @Override public void onBindViewHolderSession(SelectedSessionAdapter.SessionViewHolder holder, int position) { } @Override public void onRowMovedSession(int fromPosition, int toPosition) { } @Override public void onRowSelectedSession(SelectedSessionAdapter.SessionViewHolder myViewHolder) { } @Override public void onRowClearSession(SelectedSessionAdapter.SessionViewHolder myViewHolder) { } @Override public void onBindViewHolderQuestions(AddQuestionsAdapter.QuestionViewHolder holder, int position) { } @Override public void onRowMovedQuestions(int fromPosition, int toPosition) { } @Override public void onRowSelectedQuestions(AddQuestionsAdapter.QuestionViewHolder myViewHolder) { } @Override public void onRowClearQuestions(AddQuestionsAdapter.QuestionViewHolder myViewHolder) { } @Override public void onBindViewHolderAnswers(AnswerViewHolder holder, int position) { } @Override public void onRowMovedAnswers(int fromPosition, int toPosition) { if (fromPosition < toPosition) { for (int i = fromPosition; i < toPosition; i++) { Collections.swap(answerList, i, i + 1); } } else { for (int i = fromPosition; i > toPosition; i--) { Collections.swap(answerList, i, i - 1); } } notifyItemMoved(fromPosition, toPosition); } @Override public void onRowSelectedAnswers(AnswerViewHolder myViewHolder) { } @Override public void onRowClearAnswers(AnswerViewHolder myViewHolder) { } }
UTF-8
Java
5,313
java
AddAnswersAdapter.java
Java
[ { "context": "stackoverflow.com/a/48941212/2700965\n *\n * @author Nassim Amar\n * @version 1.0\n * @since 29.06.2020\n */\n\npubli", "end": 645, "score": 0.9998523592948914, "start": 634, "tag": "NAME", "value": "Nassim Amar" } ]
null
[]
package com.example.tinni.adapters; import android.view.LayoutInflater; import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import com.example.tinni.databinding.AddAnswerItemBinding; import com.example.tinni.helpers.ItemMoveCallback; import com.example.tinni.models.Answer; import java.util.Collections; import java.util.List; /** * <h1>Add Answers Adapter</h1> * Adapter for Answer items in the add form * * Variables: * List<Answer> answerList: A list of Answer objects to display * * Source: * https://stackoverflow.com/a/48941212/2700965 * * @author <NAME> * @version 1.0 * @since 29.06.2020 */ public class AddAnswersAdapter extends RecyclerView.Adapter<AddAnswersAdapter.AnswerViewHolder> implements ItemMoveCallback.ItemTouchHelperContract { public List<Answer> answerList; public AddAnswersAdapter(List<Answer> answerList) { this.answerList = answerList; } /** * <h2>On Create View Holder</h2> * Overriding and creating the view holder */ @NonNull @Override public AnswerViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext()); AddAnswerItemBinding itemBinding = AddAnswerItemBinding.inflate(layoutInflater, parent, false); return new AnswerViewHolder(itemBinding); } /** * <h2>On Bind View Holder</h2> * Overriding and binding the view holder */ @Override public void onBindViewHolder(@NonNull AnswerViewHolder holder, int position) { Answer answer = answerList.get(position); holder.bind(answer); } /** * <h2>Get Item Count</h2> * Returns the sound_item_horizontal count of the answerList */ @Override public int getItemCount() { return answerList != null ? answerList.size() : 0; } public static class AnswerViewHolder extends RecyclerView.ViewHolder { private AddAnswerItemBinding binding; public AnswerViewHolder(AddAnswerItemBinding binding) { super(binding.getRoot()); this.binding = binding; } public void bind(Answer program) { binding.setModel(program); binding.executePendingBindings(); } } /** * <h2>Get Item</h2> * Get sound_item_horizontal inside the answerList by its index */ public Answer getItem(int position) { if (answerList != null && getItemCount() > position) { return answerList.get(position); } else { return null; } } /** * <h2>Reload List</h2> * Reload the list and update the ui */ public void reloadList() { this.notifyDataSetChanged(); } /** * <h2>Remove Item</h2> * Remove sound_item_horizontal from the answerList */ public void removeItem(Answer answer) { if (answerList != null) { int position = answerList.indexOf(answer); answerList.remove(answer); notifyItemRemoved(position); } } /** * <h2>Add Item</h2> * Add sound_item_horizontal to the answerList with its new index */ public void addItem(Answer answer) { if (answerList != null) { answerList.add(answer); notifyItemInserted(answerList.size() - 1); } } @Override public void onBindViewHolderSession(SelectedSessionAdapter.SessionViewHolder holder, int position) { } @Override public void onRowMovedSession(int fromPosition, int toPosition) { } @Override public void onRowSelectedSession(SelectedSessionAdapter.SessionViewHolder myViewHolder) { } @Override public void onRowClearSession(SelectedSessionAdapter.SessionViewHolder myViewHolder) { } @Override public void onBindViewHolderQuestions(AddQuestionsAdapter.QuestionViewHolder holder, int position) { } @Override public void onRowMovedQuestions(int fromPosition, int toPosition) { } @Override public void onRowSelectedQuestions(AddQuestionsAdapter.QuestionViewHolder myViewHolder) { } @Override public void onRowClearQuestions(AddQuestionsAdapter.QuestionViewHolder myViewHolder) { } @Override public void onBindViewHolderAnswers(AnswerViewHolder holder, int position) { } @Override public void onRowMovedAnswers(int fromPosition, int toPosition) { if (fromPosition < toPosition) { for (int i = fromPosition; i < toPosition; i++) { Collections.swap(answerList, i, i + 1); } } else { for (int i = fromPosition; i > toPosition; i--) { Collections.swap(answerList, i, i - 1); } } notifyItemMoved(fromPosition, toPosition); } @Override public void onRowSelectedAnswers(AnswerViewHolder myViewHolder) { } @Override public void onRowClearAnswers(AnswerViewHolder myViewHolder) { } }
5,308
0.63354
0.625071
235
21.612766
26.166876
147
false
false
0
0
0
0
0
0
0.225532
false
false
9
410d8ca04723e52cfcf9ceed02b351d4c8bf4c2e
21,895,743,296,209
9b061cd79c90a79f776edc0c1f723eb5bb792624
/SiardApi_Source/src/ch/admin/bar/siard2/api/generated/AttributesType.java
ecf9b26d34acfa339448c9f991ba8e84d35719b0
[]
no_license
nakdataset/NAKDATASET
https://github.com/nakdataset/NAKDATASET
9c80508b1032540f6cbe0de1ac3dc59a9076d515
516dc59433ff163498634c1a0b48c535ab643268
refs/heads/master
2022-04-13T02:43:42.803000
2019-12-31T06:44:28
2019-12-31T06:44:28
230,854,962
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
// // Decompiled by Procyon v0.5.36 // package ch.admin.bar.siard2.api.generated; import java.util.ArrayList; import javax.xml.bind.annotation.XmlElement; import java.util.List; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "attributesType", namespace = "http://www.bar.admin.ch/xmlns/siard/2/metadata.xsd", propOrder = { "attribute" }) public class AttributesType { @XmlElement(namespace = "http://www.bar.admin.ch/xmlns/siard/2/metadata.xsd", required = true) protected List<AttributeType> attribute; public List<AttributeType> getAttribute() { if (this.attribute == null) { this.attribute = new ArrayList<AttributeType>(); } return this.attribute; } }
UTF-8
Java
865
java
AttributesType.java
Java
[]
null
[]
// // Decompiled by Procyon v0.5.36 // package ch.admin.bar.siard2.api.generated; import java.util.ArrayList; import javax.xml.bind.annotation.XmlElement; import java.util.List; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "attributesType", namespace = "http://www.bar.admin.ch/xmlns/siard/2/metadata.xsd", propOrder = { "attribute" }) public class AttributesType { @XmlElement(namespace = "http://www.bar.admin.ch/xmlns/siard/2/metadata.xsd", required = true) protected List<AttributeType> attribute; public List<AttributeType> getAttribute() { if (this.attribute == null) { this.attribute = new ArrayList<AttributeType>(); } return this.attribute; } }
865
0.719075
0.710983
27
31.037037
30.099195
128
false
false
0
0
0
0
0
0
0.481481
false
false
9
7c21e466ea48bd1b81505c41425e79fc7cce159c
21,895,743,297,301
a2e78f31befc28d57c86778be34ec98a3bafe5cb
/ProjetWebam/ProjetP2I/src/affichage/PanneauDessin.java
5e29d647a5f02c8b1b62b5b37e1b200f1c2f1c04
[ "MIT" ]
permissive
AlexDum-dev/webcam
https://github.com/AlexDum-dev/webcam
d2f6f053889c251526e1fe60dfdd017843f27fe1
f9686c3350882a0db5990413679c9839c31853b9
refs/heads/master
2021-05-21T18:57:14.736000
2020-06-05T15:26:00
2020-06-05T15:26:00
252,760,892
0
1
MIT
false
2020-05-11T12:53:51
2020-04-03T14:47:40
2020-05-11T12:45:52
2020-05-11T12:45:50
2,185
0
0
3
Java
false
false
package affichage; import java.awt.Color; import java.awt.Font; import java.awt.FontFormatException; import java.awt.Graphics; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import Global.Global; import javax.imageio.stream.FileImageInputStream; import javax.swing.JPanel; public class PanneauDessin extends JPanel{ private Font f1; private Font f2; private Font f3; public void paintComponent(Graphics g){ g.setColor(Color.orange); g.fillRect(0,0,this.getWidth(),this.getHeight()); creationPoliceEcriture(g); creationTexte(g); creationImage(g); affichageValeurs(g); } public void creationPoliceEcriture(Graphics g) { f1 = new Font("arial", Font.BOLD, 50); try { f2 = Font.createFont(Font.TRUETYPE_FONT, new FileInputStream(new File("src/affichage/police/digital-7-mono.ttf"))).deriveFont(Font.PLAIN,200); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (FontFormatException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public void creationTexte(Graphics g) { g.setFont(f1); g.setColor(Global.couleurTexte); g.drawString("StationMeteo", Global.positionXTitre, Global.positionYTitre); g.drawString("Date et heure", Global.positionDate.x, Global.positionDate.y); g.drawString("Température", Global.positionTemperature.x, Global.positionTemperature.y); g.drawString("Vent", Global.positionVent.x, Global.positionVent.y); g.drawString("Humidite", Global.positionHumidite.x, Global.positionHumidite.y); } public void creationImage(Graphics g) { for(int i = 0; i< Global.tabImage.length;i++) { g.drawImage(Global.tabImage[i], Global.tabCoordonnee[i].x, Global.tabCoordonnee[i].y, this); } } public void affichageValeurs(Graphics g) { g.setFont(f2); g.drawString(""+Global.valeurJour+"/"+Global.valeurMois+"/"+Global.valeurAnnee+ ":"+Global.valeurHeure+" H", Global.positionValeurDate.x, Global.positionValeurDate.y); g.drawString(""+Global.valeurTemperature+" C",Global.positionValeurTemperature.x,Global.positionValeurTemperature.y); g.drawString(""+Global.valeurVent+" km/h",Global.positionValeurVent.x,Global.positionValeurVent.y); g.drawString(""+Global.valeurHumidite+" %",Global.positionValeurHumidite.x,Global.positionValeurHumidite.y); } }
ISO-8859-2
Java
2,616
java
PanneauDessin.java
Java
[]
null
[]
package affichage; import java.awt.Color; import java.awt.Font; import java.awt.FontFormatException; import java.awt.Graphics; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import Global.Global; import javax.imageio.stream.FileImageInputStream; import javax.swing.JPanel; public class PanneauDessin extends JPanel{ private Font f1; private Font f2; private Font f3; public void paintComponent(Graphics g){ g.setColor(Color.orange); g.fillRect(0,0,this.getWidth(),this.getHeight()); creationPoliceEcriture(g); creationTexte(g); creationImage(g); affichageValeurs(g); } public void creationPoliceEcriture(Graphics g) { f1 = new Font("arial", Font.BOLD, 50); try { f2 = Font.createFont(Font.TRUETYPE_FONT, new FileInputStream(new File("src/affichage/police/digital-7-mono.ttf"))).deriveFont(Font.PLAIN,200); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (FontFormatException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public void creationTexte(Graphics g) { g.setFont(f1); g.setColor(Global.couleurTexte); g.drawString("StationMeteo", Global.positionXTitre, Global.positionYTitre); g.drawString("Date et heure", Global.positionDate.x, Global.positionDate.y); g.drawString("Température", Global.positionTemperature.x, Global.positionTemperature.y); g.drawString("Vent", Global.positionVent.x, Global.positionVent.y); g.drawString("Humidite", Global.positionHumidite.x, Global.positionHumidite.y); } public void creationImage(Graphics g) { for(int i = 0; i< Global.tabImage.length;i++) { g.drawImage(Global.tabImage[i], Global.tabCoordonnee[i].x, Global.tabCoordonnee[i].y, this); } } public void affichageValeurs(Graphics g) { g.setFont(f2); g.drawString(""+Global.valeurJour+"/"+Global.valeurMois+"/"+Global.valeurAnnee+ ":"+Global.valeurHeure+" H", Global.positionValeurDate.x, Global.positionValeurDate.y); g.drawString(""+Global.valeurTemperature+" C",Global.positionValeurTemperature.x,Global.positionValeurTemperature.y); g.drawString(""+Global.valeurVent+" km/h",Global.positionValeurVent.x,Global.positionValeurVent.y); g.drawString(""+Global.valeurHumidite+" %",Global.positionValeurHumidite.x,Global.positionValeurHumidite.y); } }
2,616
0.718547
0.712428
69
35.898552
35.879486
170
false
false
0
0
0
0
0
0
2.246377
false
false
9
3e41772d8dc9ca1e61cec37d4f78c0d6604c6d87
18,245,021,110,286
d52c2e2eeeb862e9199d648d7e36c3b7b34edea4
/kaypher-engine/src/test/java/com/treutec/kaypher/statement/ConfiguredStatementTest.java
e845df827163d20c9dda6c4d8aaa989a5162616c
[ "Apache-2.0" ]
permissive
uurl/kaypher
https://github.com/uurl/kaypher
396138164776b77ab791b7f868d3f6efbec12fdc
400a26237df96c869154fa60622d3f258b6aaeb4
refs/heads/master
2022-11-05T15:20:33.259000
2022-10-12T03:54:04
2022-10-12T03:54:04
176,448,063
3
2
Apache-2.0
false
2023-04-18T22:24:10
2019-03-19T07:13:15
2022-04-11T09:03:31
2023-04-18T22:24:09
2,047
2
2
1
Java
false
false
/* * Copyright 2019 Treu Techologies * * See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.treutec.kaypher.statement; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.is; import com.google.common.collect.ImmutableMap; import com.treutec.kaypher.parser.KaypherParser.PreparedStatement; import com.treutec.kaypher.parser.tree.Statement; import com.treutec.kaypher.util.KaypherConfig; import java.util.HashMap; import java.util.Map; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class ConfiguredStatementTest { private static final KaypherConfig CONFIG = new KaypherConfig(ImmutableMap.of()); @Mock private PreparedStatement<? extends Statement> prepared; @Test public void shouldTakeDefensiveCopyOfProperties() { // Given: final Map<String, Object> props = new HashMap<>(); props.put("this", "that"); final ConfiguredStatement<? extends Statement> statement = ConfiguredStatement .of(prepared, props, CONFIG); // When: props.put("other", "thing"); // Then: assertThat(statement.getOverrides(), is(ImmutableMap.of("this", "that"))); } @Test public void shouldReturnImmutableProperties() { // Given: final ConfiguredStatement<? extends Statement> statement = ConfiguredStatement .of(prepared, new HashMap<>(), CONFIG); // Then: assertThat(statement.getOverrides(), is(instanceOf(ImmutableMap.class))); } }
UTF-8
Java
2,262
java
ConfiguredStatementTest.java
Java
[ { "context": "/*\n * Copyright 2019 Treu Techologies\n *\n * See the NOTICE file distributed with\n * thi", "end": 37, "score": 0.9985004663467407, "start": 21, "tag": "NAME", "value": "Treu Techologies" } ]
null
[]
/* * Copyright 2019 <NAME> * * See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.treutec.kaypher.statement; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.is; import com.google.common.collect.ImmutableMap; import com.treutec.kaypher.parser.KaypherParser.PreparedStatement; import com.treutec.kaypher.parser.tree.Statement; import com.treutec.kaypher.util.KaypherConfig; import java.util.HashMap; import java.util.Map; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class ConfiguredStatementTest { private static final KaypherConfig CONFIG = new KaypherConfig(ImmutableMap.of()); @Mock private PreparedStatement<? extends Statement> prepared; @Test public void shouldTakeDefensiveCopyOfProperties() { // Given: final Map<String, Object> props = new HashMap<>(); props.put("this", "that"); final ConfiguredStatement<? extends Statement> statement = ConfiguredStatement .of(prepared, props, CONFIG); // When: props.put("other", "thing"); // Then: assertThat(statement.getOverrides(), is(ImmutableMap.of("this", "that"))); } @Test public void shouldReturnImmutableProperties() { // Given: final ConfiguredStatement<? extends Statement> statement = ConfiguredStatement .of(prepared, new HashMap<>(), CONFIG); // Then: assertThat(statement.getOverrides(), is(instanceOf(ImmutableMap.class))); } }
2,252
0.749337
0.7458
67
32.776119
27.248892
83
false
false
0
0
0
0
0
0
0.567164
false
false
9
833bcad0edcef013d70f29ea103cc6d85e421cc8
7,567,732,403,646
d89ddc575b99b89017c0bc4f9651c534e957a014
/Q3/Teste03.java
04279416840bdf08d76712d1c3e7de28377a1660
[]
no_license
Lissia/MLPIII_CC__2016_1_LISTA2
https://github.com/Lissia/MLPIII_CC__2016_1_LISTA2
e855efe0640c16a55f8d8cf873d66dbcad0ef6f2
15c7d5627f4978e7db06285207903236ec7aac51
refs/heads/master
2018-01-08T02:43:59.067000
2016-03-08T17:54:36
2016-03-08T17:54:36
53,412,411
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.unipe.mlpIII.data.ui; import br.unipe.mlpIII.data.modelo.Pessoa; import br.unipe.mlpIII.data.modelo.VeiculoDeCarga; import br.unipe.mlpIII.data.modelo.VeiculoDePasseio; public class Teste03 { public static void main(String[] args) { VeiculoDeCarga v1 = new VeiculoDeCarga(); VeiculoDePasseio v2 = new VeiculoDePasseio(); Pessoa p1 = new Pessoa(); p1.setNome("Lissia Oliveira"); p1.setCpf(10101); v1.setAno(2016); v1.setCapacidadeCarga(5000); v1.setKmInicial(0000); v1.setKmFinal(10000); v1.setChassi("CC58AS577A0S130MDAS0312L"); v1.setMarca("LAND ROUVER"); v1.setPlaca("PRI0409"); v1.setModelo("DISCOVERY"); v1.setValorKmRodado(500); v1.setDono(p1); v1.calculalValorLocacao(); System.out.println(v1); System.out.println(v2); } }
UTF-8
Java
820
java
Teste03.java
Java
[ { "context": ";\r\n\t\tPessoa p1 = new Pessoa();\r\n\t\t\r\n\t\tp1.setNome(\"Lissia Oliveira\");\r\n\t\tp1.setCpf(10101);\r\n\t\t\r\n\t\tv1.setAno(2016);\r\n", "end": 413, "score": 0.999864399433136, "start": 398, "tag": "NAME", "value": "Lissia Oliveira" } ]
null
[]
package br.unipe.mlpIII.data.ui; import br.unipe.mlpIII.data.modelo.Pessoa; import br.unipe.mlpIII.data.modelo.VeiculoDeCarga; import br.unipe.mlpIII.data.modelo.VeiculoDePasseio; public class Teste03 { public static void main(String[] args) { VeiculoDeCarga v1 = new VeiculoDeCarga(); VeiculoDePasseio v2 = new VeiculoDePasseio(); Pessoa p1 = new Pessoa(); p1.setNome("<NAME>"); p1.setCpf(10101); v1.setAno(2016); v1.setCapacidadeCarga(5000); v1.setKmInicial(0000); v1.setKmFinal(10000); v1.setChassi("CC58AS577A0S130MDAS0312L"); v1.setMarca("LAND ROUVER"); v1.setPlaca("PRI0409"); v1.setModelo("DISCOVERY"); v1.setValorKmRodado(500); v1.setDono(p1); v1.calculalValorLocacao(); System.out.println(v1); System.out.println(v2); } }
811
0.69878
0.621951
32
23.6875
15.683267
52
false
false
0
0
0
0
0
0
2.0625
false
false
9
d6be4a7780dfdcff82029ddc5bd93327d60052e4
31,147,102,853,091
57a04f3978a1a12f5263b6a3a76e6b9029fca18b
/src/main/java/com/rainbow/taskd/TaskExecutor.java
92f91af87cb3e390b675621ebe3c78f0c55267a8
[]
no_license
yungoo/task-dealer
https://github.com/yungoo/task-dealer
13d3be11218e6df1af16d0fa972561fb3f15b6bd
66b8d9dc91d6bc1ae6f23fedce524be844e99834
refs/heads/master
2021-01-16T21:37:18.185000
2016-08-01T02:39:05
2016-08-01T02:39:05
63,205,621
4
2
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.rainbow.taskd; import com.rainbow.taskd.exception.TaskException; import com.rainbow.taskd.model.Task; /** * 任务执行器 */ public interface TaskExecutor { void run(Task task) throws TaskException; }
UTF-8
Java
225
java
TaskExecutor.java
Java
[]
null
[]
package com.rainbow.taskd; import com.rainbow.taskd.exception.TaskException; import com.rainbow.taskd.model.Task; /** * 任务执行器 */ public interface TaskExecutor { void run(Task task) throws TaskException; }
225
0.748837
0.748837
13
15.538462
18.193893
49
false
false
0
0
0
0
0
0
0.307692
false
false
9
d7d9f03c4a6ed576a0b809957cc98bf1ffe83c12
2,027,224,564,200
3764c2d92193b51d304564fd8bf037926abcf7b9
/core/src/com/boomer/imperium/game/RunningGame.java
708fbacc7dcc99ba960aee85388fa19edf1a28e8
[]
no_license
OmerUygurOzer/Imperium
https://github.com/OmerUygurOzer/Imperium
a35bc7b941591f617bd76b57368e0eca65204076
db1ef59eb2e112045af20902f85a9885972f0462
refs/heads/master
2020-05-17T07:08:23.547000
2020-05-11T00:56:48
2020-05-11T00:56:48
183,572,918
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.boomer.imperium.game; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Input; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import com.badlogic.gdx.utils.Pool; import com.badlogic.gdx.utils.viewport.FitViewport; import com.badlogic.gdx.utils.viewport.Viewport; import com.boomer.imperium.core.GameState; import com.boomer.imperium.game.configs.GameConfigs; import com.boomer.imperium.game.configs.GameContext; import com.boomer.imperium.game.events.*; import com.boomer.imperium.game.events.defaults.DefaultActions; import com.boomer.imperium.game.gui.GuiHolder; import com.boomer.imperium.game.map.Map; import javax.script.Invocable; public final class RunningGame extends GameState { private static final int SCREEN_WIDTH_IN_TILES = 20; private static final int SCREEN_HEIGHT_IN_TILES = 18; private GameContext gameContext; private ShapeRenderer shapeRenderer; private final GameConfigs configs; private float scale; private final OrthographicCamera camera; private final Viewport viewPort; private final EventManager eventManager; private final GameWorld gameWorld; private final GuiHolder guiHolder; private float camX, camY; public RunningGame(SpriteBatch spriteBatch, ShapeRenderer shapeRenderer, GameConfigs gameConfigs) { this.shapeRenderer = shapeRenderer; this.configs = gameConfigs; this.camera = new OrthographicCamera(); this.viewPort = new FitViewport(SCREEN_WIDTH_IN_TILES * 64, SCREEN_HEIGHT_IN_TILES * 64, camera); this.camera.position.x = viewPort.getWorldWidth() / 2f; this.camera.position.y = viewPort.getWorldHeight() / 2f; this.gameContext = new GameContext(); this.gameContext.setGameResources(new Resources()); this.gameContext.setGameConfigs(gameConfigs); this.eventManager = new EventManager(gameContext, new Pool<Event>(gameConfigs.eventsInitialCapacity) { @Override protected Event newObject() { return new Event(gameContext); } }, new Pool<Trigger>(gameConfigs.eventsInitialCapacity) { @Override protected Trigger newObject() { return new Trigger(); } }); this.guiHolder = new GuiHolder(gameContext,viewPort, spriteBatch); this.gameContext.setGameGui(guiHolder.getGUI()); this.gameContext.setGameCursor(guiHolder.getCursor()); this.gameWorld = new GameWorld(gameContext); this.eventManager.registerTrigger(EventType.MOUSE_LEFT_CLICK) .addResult(DefaultActions.MOUSE_LEFT_CLICK_IN_GAME_WORLD) .setCondition(Map.IS_POINT_WITHIN_MAP); this.eventManager.registerTrigger(EventType.MOUSE_RIGHT_CLICK) .addResult(DefaultActions.RESET_CURSOR_TO_STANDARD) .setCondition(GameWorld.IS_BUILDING); this.eventManager.registerTrigger(EventType.MOUSE_RIGHT_CLICK) .addResult(DefaultActions.MOUSE_RIGHT_CLICK_IN_GAME_WORLD) .setCondition(Map.IS_POINT_WITHIN_MAP); this.eventManager.registerTrigger(EventType.MOUSE_DRAG) .addResult(DefaultActions.MOUSE_DRAG_IN_GAME_WORLD) .setCondition(Map.IS_RECTANGLE_WITHIN_MAP); this.eventManager.registerTrigger(EventType.MOUSE_MOVE) .addResult(DefaultActions.MOUSE_HOVER_IN_GAME_WORLD) .setCondition(Map.IS_POINT_WITHIN_MAP); this.eventManager.registerTrigger(EventType.ENTITY_HOVERED_OVER) .addResult(DefaultActions.ADJUST_CURSOR_IN_GUI) .setCondition(Trigger.ALWAYS_RUN); this.eventManager.registerTrigger(EventType.ENTITY_HOVERED_OFF) .addResult(DefaultActions.RESET_CURSOR_TO_STANDARD) .setCondition(Trigger.ALWAYS_RUN); this.eventManager.registerTrigger(EventType.ENTITIES_SELECTED) .addResult(DefaultActions.SELECT_ENTITIES_IN_GUI) .setCondition(Trigger.ALWAYS_RUN); this.eventManager.registerTrigger(EventType.ENTITIES_DESELECTED) .addResult(DefaultActions.DESELECTED_ENTITIES_IN_GUI) .setCondition(Trigger.ALWAYS_RUN); this.eventManager.registerTrigger(EventType.BUILDABLE_PICKED) .addResult(DefaultActions.PICK_BUILDABLE_IN_GAME_WORLD) .addResult(DefaultActions.ADJUST_CURSOR_FOR_BUILDING) .setCondition(Trigger.ALWAYS_RUN); this.eventManager.registerTrigger(EventType.UNIT_BUILD_ORDER_GIVEN) .addResult(DefaultActions.RESET_CURSOR_TO_STANDARD) .setCondition(Trigger.ALWAYS_RUN); this.eventManager.registerTrigger(EventType.DAY_PASSED) .addResult(DefaultActions.DAYS_PASSED) .setCondition(Trigger.ALWAYS_RUN); this.eventManager.registerTrigger(EventType.WEEK_PASSED) .addResult(DefaultActions.WEEKS_PASSED) .setCondition(Trigger.ALWAYS_RUN); this.eventManager.registerTrigger(EventType.MONTH_PASSED) .addResult(DefaultActions.MONTH_PASSED) .setCondition(Trigger.ALWAYS_RUN); this.eventManager.registerTrigger(EventType.YEAR_PASSED) .addResult(DefaultActions.YEARS_PASSED) .setCondition(Trigger.ALWAYS_RUN); this.eventManager.registerTrigger(EventType.SCREEN_RESIZE) .addResult(DefaultActions.ADJUST_GAMEWORLD_MINIMAP) .setCondition(Trigger.ALWAYS_RUN); addProcessor(guiHolder.getGUI()); addProcessor(guiHolder.getCursor()); } @Override public void update() { if (Gdx.input.isKeyPressed(Input.Keys.W)) { camY = 4f; } if (Gdx.input.isKeyPressed(Input.Keys.S)) { camY = -4f; } if (Gdx.input.isKeyPressed(Input.Keys.A)) { camX = -4f; } if (Gdx.input.isKeyPressed(Input.Keys.D)) { camX = 4f; } camera.translate(camX, camY); camera.update(); float delta = Gdx.graphics.getDeltaTime(); gameWorld.update(delta); guiHolder.update(delta); eventManager.update(delta); } @Override public void render(SpriteBatch spriteBatch, ShapeRenderer shapeRenderer) { Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); spriteBatch.begin(); spriteBatch.setProjectionMatrix(camera.combined); shapeRenderer.setProjectionMatrix(camera.combined); viewPort.apply(); gameWorld.render(spriteBatch,shapeRenderer); spriteBatch.end(); guiHolder.render(spriteBatch,shapeRenderer); } @Override public void resize(int width, int height) { viewPort.update(width, height); guiHolder.resize(width, height); scale = (float) width / (gameContext.getGameConfigs().worldSize.getRadius(configs) * 2f); // System.out.println(width); // System.out.println(height); // System.out.println(worldSize.getRadius(configs) * 2f); // System.out.println(scale); eventManager.raiseEvent(EventType.SCREEN_RESIZE) .getParams() .putParameter(Parameters.Key.WIDTH,width) .putParameter(Parameters.Key.HEIGHT,height); } @Override public void dispose() { gameContext.getGameResources().dispose(); } @Override public boolean isOverLay() { return false; } @Override public boolean keyDown(int keycode) { return false; } @Override public boolean keyUp(int keycode) { if (keycode == Input.Keys.W || keycode == Input.Keys.S) { camY = 0f; } if (keycode == Input.Keys.A || keycode == Input.Keys.D) { camX = 0f; } return false; } }
UTF-8
Java
8,230
java
RunningGame.java
Java
[]
null
[]
package com.boomer.imperium.game; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Input; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import com.badlogic.gdx.utils.Pool; import com.badlogic.gdx.utils.viewport.FitViewport; import com.badlogic.gdx.utils.viewport.Viewport; import com.boomer.imperium.core.GameState; import com.boomer.imperium.game.configs.GameConfigs; import com.boomer.imperium.game.configs.GameContext; import com.boomer.imperium.game.events.*; import com.boomer.imperium.game.events.defaults.DefaultActions; import com.boomer.imperium.game.gui.GuiHolder; import com.boomer.imperium.game.map.Map; import javax.script.Invocable; public final class RunningGame extends GameState { private static final int SCREEN_WIDTH_IN_TILES = 20; private static final int SCREEN_HEIGHT_IN_TILES = 18; private GameContext gameContext; private ShapeRenderer shapeRenderer; private final GameConfigs configs; private float scale; private final OrthographicCamera camera; private final Viewport viewPort; private final EventManager eventManager; private final GameWorld gameWorld; private final GuiHolder guiHolder; private float camX, camY; public RunningGame(SpriteBatch spriteBatch, ShapeRenderer shapeRenderer, GameConfigs gameConfigs) { this.shapeRenderer = shapeRenderer; this.configs = gameConfigs; this.camera = new OrthographicCamera(); this.viewPort = new FitViewport(SCREEN_WIDTH_IN_TILES * 64, SCREEN_HEIGHT_IN_TILES * 64, camera); this.camera.position.x = viewPort.getWorldWidth() / 2f; this.camera.position.y = viewPort.getWorldHeight() / 2f; this.gameContext = new GameContext(); this.gameContext.setGameResources(new Resources()); this.gameContext.setGameConfigs(gameConfigs); this.eventManager = new EventManager(gameContext, new Pool<Event>(gameConfigs.eventsInitialCapacity) { @Override protected Event newObject() { return new Event(gameContext); } }, new Pool<Trigger>(gameConfigs.eventsInitialCapacity) { @Override protected Trigger newObject() { return new Trigger(); } }); this.guiHolder = new GuiHolder(gameContext,viewPort, spriteBatch); this.gameContext.setGameGui(guiHolder.getGUI()); this.gameContext.setGameCursor(guiHolder.getCursor()); this.gameWorld = new GameWorld(gameContext); this.eventManager.registerTrigger(EventType.MOUSE_LEFT_CLICK) .addResult(DefaultActions.MOUSE_LEFT_CLICK_IN_GAME_WORLD) .setCondition(Map.IS_POINT_WITHIN_MAP); this.eventManager.registerTrigger(EventType.MOUSE_RIGHT_CLICK) .addResult(DefaultActions.RESET_CURSOR_TO_STANDARD) .setCondition(GameWorld.IS_BUILDING); this.eventManager.registerTrigger(EventType.MOUSE_RIGHT_CLICK) .addResult(DefaultActions.MOUSE_RIGHT_CLICK_IN_GAME_WORLD) .setCondition(Map.IS_POINT_WITHIN_MAP); this.eventManager.registerTrigger(EventType.MOUSE_DRAG) .addResult(DefaultActions.MOUSE_DRAG_IN_GAME_WORLD) .setCondition(Map.IS_RECTANGLE_WITHIN_MAP); this.eventManager.registerTrigger(EventType.MOUSE_MOVE) .addResult(DefaultActions.MOUSE_HOVER_IN_GAME_WORLD) .setCondition(Map.IS_POINT_WITHIN_MAP); this.eventManager.registerTrigger(EventType.ENTITY_HOVERED_OVER) .addResult(DefaultActions.ADJUST_CURSOR_IN_GUI) .setCondition(Trigger.ALWAYS_RUN); this.eventManager.registerTrigger(EventType.ENTITY_HOVERED_OFF) .addResult(DefaultActions.RESET_CURSOR_TO_STANDARD) .setCondition(Trigger.ALWAYS_RUN); this.eventManager.registerTrigger(EventType.ENTITIES_SELECTED) .addResult(DefaultActions.SELECT_ENTITIES_IN_GUI) .setCondition(Trigger.ALWAYS_RUN); this.eventManager.registerTrigger(EventType.ENTITIES_DESELECTED) .addResult(DefaultActions.DESELECTED_ENTITIES_IN_GUI) .setCondition(Trigger.ALWAYS_RUN); this.eventManager.registerTrigger(EventType.BUILDABLE_PICKED) .addResult(DefaultActions.PICK_BUILDABLE_IN_GAME_WORLD) .addResult(DefaultActions.ADJUST_CURSOR_FOR_BUILDING) .setCondition(Trigger.ALWAYS_RUN); this.eventManager.registerTrigger(EventType.UNIT_BUILD_ORDER_GIVEN) .addResult(DefaultActions.RESET_CURSOR_TO_STANDARD) .setCondition(Trigger.ALWAYS_RUN); this.eventManager.registerTrigger(EventType.DAY_PASSED) .addResult(DefaultActions.DAYS_PASSED) .setCondition(Trigger.ALWAYS_RUN); this.eventManager.registerTrigger(EventType.WEEK_PASSED) .addResult(DefaultActions.WEEKS_PASSED) .setCondition(Trigger.ALWAYS_RUN); this.eventManager.registerTrigger(EventType.MONTH_PASSED) .addResult(DefaultActions.MONTH_PASSED) .setCondition(Trigger.ALWAYS_RUN); this.eventManager.registerTrigger(EventType.YEAR_PASSED) .addResult(DefaultActions.YEARS_PASSED) .setCondition(Trigger.ALWAYS_RUN); this.eventManager.registerTrigger(EventType.SCREEN_RESIZE) .addResult(DefaultActions.ADJUST_GAMEWORLD_MINIMAP) .setCondition(Trigger.ALWAYS_RUN); addProcessor(guiHolder.getGUI()); addProcessor(guiHolder.getCursor()); } @Override public void update() { if (Gdx.input.isKeyPressed(Input.Keys.W)) { camY = 4f; } if (Gdx.input.isKeyPressed(Input.Keys.S)) { camY = -4f; } if (Gdx.input.isKeyPressed(Input.Keys.A)) { camX = -4f; } if (Gdx.input.isKeyPressed(Input.Keys.D)) { camX = 4f; } camera.translate(camX, camY); camera.update(); float delta = Gdx.graphics.getDeltaTime(); gameWorld.update(delta); guiHolder.update(delta); eventManager.update(delta); } @Override public void render(SpriteBatch spriteBatch, ShapeRenderer shapeRenderer) { Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); spriteBatch.begin(); spriteBatch.setProjectionMatrix(camera.combined); shapeRenderer.setProjectionMatrix(camera.combined); viewPort.apply(); gameWorld.render(spriteBatch,shapeRenderer); spriteBatch.end(); guiHolder.render(spriteBatch,shapeRenderer); } @Override public void resize(int width, int height) { viewPort.update(width, height); guiHolder.resize(width, height); scale = (float) width / (gameContext.getGameConfigs().worldSize.getRadius(configs) * 2f); // System.out.println(width); // System.out.println(height); // System.out.println(worldSize.getRadius(configs) * 2f); // System.out.println(scale); eventManager.raiseEvent(EventType.SCREEN_RESIZE) .getParams() .putParameter(Parameters.Key.WIDTH,width) .putParameter(Parameters.Key.HEIGHT,height); } @Override public void dispose() { gameContext.getGameResources().dispose(); } @Override public boolean isOverLay() { return false; } @Override public boolean keyDown(int keycode) { return false; } @Override public boolean keyUp(int keycode) { if (keycode == Input.Keys.W || keycode == Input.Keys.S) { camY = 0f; } if (keycode == Input.Keys.A || keycode == Input.Keys.D) { camX = 0f; } return false; } }
8,230
0.649818
0.646537
215
37.279068
25.14583
105
false
false
0
0
0
0
0
0
0.567442
false
false
9
c09df2cca9d625696ce51bac223f7639998e4c5e
2,027,224,563,757
bc80e82741cdf79cd12890fe5e79507a568018f9
/src/main/java/be/ipl/pae/business/Programme.java
7ed09d11ac3a9eac493369d3eea94361503b733e
[]
no_license
Romarich/ProjetApplicationEntreprise-PAE-
https://github.com/Romarich/ProjetApplicationEntreprise-PAE-
b0b3398bef0b912c7216c24f55919564b04a8713
b64a68ef5f81b98e149f738be799f5aee84c2b9f
refs/heads/master
2022-09-30T02:10:05.808000
2020-02-29T10:02:43
2020-02-29T10:02:43
243,944,434
0
0
null
false
2022-07-07T22:12:21
2020-02-29T09:59:28
2020-02-29T10:03:02
2022-07-07T22:12:19
1,151
0
0
4
JavaScript
false
false
package be.ipl.pae.business; public enum Programme { ERASMUS("Erasmus+"), ERABEL("Erabel"), FAME("FAME"), SUISSE("Suisse"); private String nom; Programme(String nom) { this.nom = nom; } public String getNom() { return nom; } public void setNom(String nom) { this.nom = nom; } }
UTF-8
Java
317
java
Programme.java
Java
[ { "context": "enum Programme {\n ERASMUS(\"Erasmus+\"),\n ERABEL(\"Erabel\"),\n FAME(\"FAME\"),\n SUISSE(\"Suisse\");\n\n private", "end": 93, "score": 0.9383788108825684, "start": 87, "tag": "NAME", "value": "Erabel" }, { "context": " ERASMUS(\"Erasmus+\"),\n ERABEL(\"Erabel\"...
null
[]
package be.ipl.pae.business; public enum Programme { ERASMUS("Erasmus+"), ERABEL("Erabel"), FAME("FAME"), SUISSE("Suisse"); private String nom; Programme(String nom) { this.nom = nom; } public String getNom() { return nom; } public void setNom(String nom) { this.nom = nom; } }
317
0.611987
0.611987
22
13.409091
10.998591
34
false
false
0
0
0
0
0
0
0.409091
false
false
9
8ea275df33c2930d0a587b37a12e084a10941321
33,208,687,168,072
0ed92696389e017efc00191f386748d49f0f3074
/src/main/java/com/example/demo/entitis/Component.java
cdad69536affd7ad0e0c12a563c738fc7bfc026f
[]
no_license
millionkn/word-back-springboot
https://github.com/millionkn/word-back-springboot
1dbf3f619f94edb160a4dc752552b124d8e56f84
1de6eb56cf8678e7bc2221e8506da82d64b33adb
refs/heads/master
2022-06-22T20:01:31.525000
2020-03-11T10:54:21
2020-03-11T10:54:21
206,689,717
0
0
null
false
2022-06-17T02:30:02
2019-09-06T01:42:10
2020-03-11T10:54:24
2022-06-17T02:30:01
150
0
0
2
TSQL
false
false
package com.example.demo.entitis; import com.alibaba.fastjson.JSONObject; import lombok.Data; @Data public class Component { String id; String uploader; JSONObject info; }
UTF-8
Java
180
java
Component.java
Java
[]
null
[]
package com.example.demo.entitis; import com.alibaba.fastjson.JSONObject; import lombok.Data; @Data public class Component { String id; String uploader; JSONObject info; }
180
0.766667
0.766667
12
14.083333
12.861171
39
false
false
0
0
0
0
0
0
0.5
false
false
9
e1fc22a28a7c3add5fdeecdadc5ce43e721892ce
29,076,928,630,279
1f6a41b03c5ccfd5f27c09f49dc28bc2d9d19e95
/src/com/iframe/source/publics/model/AppInfoBean.java
4247c0a89eb57eb38e9e2ea867057a518ad3bd0c
[]
no_license
yangmingguang/iframe
https://github.com/yangmingguang/iframe
dcf485d078dbd1e2242b1997406725d3b0a4275d
9aac03662905f3be0f3a1c28555def10dc24c382
refs/heads/master
2019-06-14T18:06:33.686000
2015-07-24T17:23:48
2015-07-24T17:23:48
31,899,310
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * @Title: AppInfoBean.java * @Package com.iframe.source.publics.model * @Description: TODO(用一句话描述该文件做什么) * @author mingguang.yang * @date 2015年1月29日 下午2:12:40 * @version V1.0 */ package com.iframe.source.publics.model; import android.os.Parcel; import android.os.Parcelable; /** * @ClassName: AppInfoBean * @Description: TODO(这里用一句话描述这个类的作用) * @author mingguang.yang * @date 2015年1月29日 下午2:12:40 * */ public class AppInfoBean implements Parcelable { private int appId; private String name; private String brief; private int starLevel; private long fileSize; private String appUrl; private String logoUrl; private int versionCode; private String versionName; private String packageName; public AppInfoBean() { // TODO Auto-generated constructor stub } public AppInfoBean(Parcel source) { appId = source.readInt(); name = source.readString(); brief = source.readString(); starLevel = source.readInt(); fileSize = source.readLong(); appUrl = source.readString(); logoUrl = source.readString(); versionCode = source.readInt(); versionName = source.readString(); packageName = source.readString(); } public int getAppId() { return appId; } public void setAppId(int appId) { this.appId = appId; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getBrief() { return brief; } public void setBrief(String brief) { this.brief = brief; } public int getStarLevel() { return starLevel; } public void setStarLevel(int starLevel) { this.starLevel = starLevel; } public long getFileSize() { return fileSize; } public void setFileSize(long fileSize) { this.fileSize = fileSize; } public String getAppUrl() { return appUrl; } public void setAppUrl(String appUrl) { this.appUrl = appUrl; } public String getLogoUrl() { return logoUrl; } public void setLogoUrl(String logoUrl) { this.logoUrl = logoUrl; } public int getVersionCode() { return versionCode; } public void setVersionCode(int versionCode) { this.versionCode = versionCode; } public String getVersionName() { return versionName; } public void setVersionName(String versionName) { this.versionName = versionName; } public String getPackageName() { return packageName; } public void setPackageName(String packageName) { this.packageName = packageName; } @Override public int describeContents() { // TODO Auto-generated method stub return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeInt(appId); dest.writeString(name); dest.writeString(brief); dest.writeInt(starLevel); dest.writeLong(fileSize); dest.writeString(appUrl); dest.writeString(logoUrl); dest.writeInt(versionCode); dest.writeString(versionName); dest.writeString(packageName); } public static final Creator<AppInfoBean> CREATOR = new Creator<AppInfoBean>() { @Override public AppInfoBean createFromParcel(Parcel source) { return new AppInfoBean(source); } @Override public AppInfoBean[] newArray(int size) { return new AppInfoBean[size]; } }; }
UTF-8
Java
3,391
java
AppInfoBean.java
Java
[ { "context": "del\r\n* @Description: TODO(用一句话描述该文件做什么)\r\n* @author mingguang.yang \r\n* @date 2015年1月29日 下午2:12:40\r\n* @vers", "end": 132, "score": 0.6685200333595276, "start": 126, "tag": "NAME", "value": "minggu" }, { "context": "@Description: TODO(用一句话描述该文件做什么)\r\n* @author m...
null
[]
/** * @Title: AppInfoBean.java * @Package com.iframe.source.publics.model * @Description: TODO(用一句话描述该文件做什么) * @author mingguang.yang * @date 2015年1月29日 下午2:12:40 * @version V1.0 */ package com.iframe.source.publics.model; import android.os.Parcel; import android.os.Parcelable; /** * @ClassName: AppInfoBean * @Description: TODO(这里用一句话描述这个类的作用) * @author mingguang.yang * @date 2015年1月29日 下午2:12:40 * */ public class AppInfoBean implements Parcelable { private int appId; private String name; private String brief; private int starLevel; private long fileSize; private String appUrl; private String logoUrl; private int versionCode; private String versionName; private String packageName; public AppInfoBean() { // TODO Auto-generated constructor stub } public AppInfoBean(Parcel source) { appId = source.readInt(); name = source.readString(); brief = source.readString(); starLevel = source.readInt(); fileSize = source.readLong(); appUrl = source.readString(); logoUrl = source.readString(); versionCode = source.readInt(); versionName = source.readString(); packageName = source.readString(); } public int getAppId() { return appId; } public void setAppId(int appId) { this.appId = appId; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getBrief() { return brief; } public void setBrief(String brief) { this.brief = brief; } public int getStarLevel() { return starLevel; } public void setStarLevel(int starLevel) { this.starLevel = starLevel; } public long getFileSize() { return fileSize; } public void setFileSize(long fileSize) { this.fileSize = fileSize; } public String getAppUrl() { return appUrl; } public void setAppUrl(String appUrl) { this.appUrl = appUrl; } public String getLogoUrl() { return logoUrl; } public void setLogoUrl(String logoUrl) { this.logoUrl = logoUrl; } public int getVersionCode() { return versionCode; } public void setVersionCode(int versionCode) { this.versionCode = versionCode; } public String getVersionName() { return versionName; } public void setVersionName(String versionName) { this.versionName = versionName; } public String getPackageName() { return packageName; } public void setPackageName(String packageName) { this.packageName = packageName; } @Override public int describeContents() { // TODO Auto-generated method stub return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeInt(appId); dest.writeString(name); dest.writeString(brief); dest.writeInt(starLevel); dest.writeLong(fileSize); dest.writeString(appUrl); dest.writeString(logoUrl); dest.writeInt(versionCode); dest.writeString(versionName); dest.writeString(packageName); } public static final Creator<AppInfoBean> CREATOR = new Creator<AppInfoBean>() { @Override public AppInfoBean createFromParcel(Parcel source) { return new AppInfoBean(source); } @Override public AppInfoBean[] newArray(int size) { return new AppInfoBean[size]; } }; }
3,391
0.680928
0.672793
166
17.993977
15.971547
80
false
false
0
0
0
0
0
0
1.349398
false
false
9
6941a126ed0a89b98df36b85d12afd38a207141c
2,723,009,285,339
9919663304937f237eedb9fa997e531cd9da2346
/src/test/java/cl/empresa/qa/pages/falabella/InicialPage.java
de95fce53ceb2578406a1204d484bbe362990e80
[]
no_license
ErnestoUrbinaFigueroa/THINK_TANK
https://github.com/ErnestoUrbinaFigueroa/THINK_TANK
5f63aa14246628d0bb2f19f33551be60fd664436
f1581baf3c3494109bae86038b08285013e58ce0
refs/heads/master
2020-04-09T08:27:42.202000
2018-12-10T20:02:49
2018-12-10T20:02:49
160,194,891
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cl.empresa.qa.pages.falabella; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import com.relevantcodes.extentreports.ExtentTest; public class InicialPage { private WebDriver driver; private ExtentTest test; private Boolean TAKE_SS; private By buscador; private By inicioSesion; private By menuPrincipal; private By subMenu; public InicialPage(WebDriver driver, ExtentTest test, Boolean TAKE_SS) { this.driver = driver; this.test = test; this.TAKE_SS = TAKE_SS; this.buscador = null; this.inicioSesion = null; } public void iniciarSesion() { // TODO construir } public void realizarBusqueda(String objeto) { // TODO construir } public void seleccionarMenu(String menuPpal, String menuSec) { // TODO construir } }
UTF-8
Java
823
java
InicialPage.java
Java
[]
null
[]
package cl.empresa.qa.pages.falabella; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import com.relevantcodes.extentreports.ExtentTest; public class InicialPage { private WebDriver driver; private ExtentTest test; private Boolean TAKE_SS; private By buscador; private By inicioSesion; private By menuPrincipal; private By subMenu; public InicialPage(WebDriver driver, ExtentTest test, Boolean TAKE_SS) { this.driver = driver; this.test = test; this.TAKE_SS = TAKE_SS; this.buscador = null; this.inicioSesion = null; } public void iniciarSesion() { // TODO construir } public void realizarBusqueda(String objeto) { // TODO construir } public void seleccionarMenu(String menuPpal, String menuSec) { // TODO construir } }
823
0.712029
0.712029
39
19.102564
18.250107
73
false
false
0
0
0
0
0
0
1.282051
false
false
9
09bff6e0749ca9abc901d454cfd8991110f5678c
24,292,335,066,452
a460cc53302944a13e77ce1a56d5d08eeec39a76
/NewTraingLog/app/src/main/java/com/eiralv/newtrainglog/Log/LogWorkout.java
8225082623f27eaee1ef5f03ec547b04905e070b
[]
no_license
EirikAlv/TrainingLog
https://github.com/EirikAlv/TrainingLog
52aefbf9c2831f7238c3de9d97ae5e29c1391cd8
b5ca22ae55ce1cfa17a1eb9fea3a06bacda74027
refs/heads/master
2021-12-26T13:47:24.612000
2021-12-12T14:34:06
2021-12-12T14:34:06
190,182,353
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.eiralv.newtrainglog.Log; import android.app.Fragment; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; import android.widget.ImageButton; import android.widget.ListView; import android.widget.TextView; import com.eiralv.newtrainglog.Adapter.ListAdapterItem; import com.eiralv.newtrainglog.Adapter.LoggingListAdapter; import com.eiralv.newtrainglog.MainActivity; import com.eiralv.newtrainglog.MyBottomNavigationView; import com.eiralv.newtrainglog.R; import java.util.ArrayList; public class LogWorkout extends Fragment { private EditText weightET; private EditText repsET; private Button addButton; private ListView log_workout_listView; private TextView tittelTV; private LoggingListAdapter loggingListAdapter; private ArrayList<ListAdapterItem> list; private LogWorkout thisFragment = this; private String exerciseTittel; private String programTittel; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) { final View view = inflater.inflate(R.layout.log_workout_fragment, container, false); //bottom navigation new MyBottomNavigationView(thisFragment, view).selectedTab("Log"); Bundle bundle = getArguments(); this.exerciseTittel = bundle.getString("exerciseTittel"); this.programTittel = bundle.getString("programTittel"); tittelTV = view.findViewById(R.id.tittelTV); tittelTV.setText(exerciseTittel); //handling listview log_workout_listView = view.findViewById(R.id.log_workout_listView); list = new ArrayList<>(); readItems(); loggingListAdapter = new LoggingListAdapter(getActivity(), list, this, exerciseTittel, programTittel); log_workout_listView.setAdapter(loggingListAdapter); //EDIT TEXT HANDLING weightET = view.findViewById(R.id.weightET); repsET = view.findViewById(R.id.repsET); //((InputMethodManager)getActivity().getSystemService(Context.INPUT_METHOD_SERVICE)).toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY); weightET.setOnKeyListener(new View.OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_ENTER && event.getAction() == KeyEvent.ACTION_UP) { repsET.requestFocus(); return true; } return false; } }); repsET.setOnKeyListener(new View.OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_ENTER && event.getAction() == KeyEvent.ACTION_UP) { addButton.callOnClick(); weightET.requestFocus(); return true; } return false; } }); //ADD BUTTON HANDLING addButton = view.findViewById(R.id.addButton); addButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (weightET.getText().toString().equals("")) { weightET.setText("0"); } if (repsET.getText().toString().equals("")) { repsET.setText("0"); } ((MainActivity) getActivity()).dbHandler.saveToLogging(new Logging(programTittel, tittelTV.getText().toString(), weightET.getText().toString(), repsET.getText().toString(), ((MainActivity) getActivity()).getMesurement())); ListAdapterItem item = new ListAdapterItem(weightET.getText().toString(), repsET.getText().toString()); list.add(0, item); weightET.setText(""); repsET.setText(""); loggingListAdapter.notifyDataSetChanged(); } }); //BACK BUTTON HANDLING ImageButton backButton = view.findViewById(R.id.backButton); backButton.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View view) { getActivity().onBackPressed(); } }); //TESTINGPURPOSES //saveForTesting(); return view; } public void deleteLogLine(ListAdapterItem line) { ((MainActivity) getActivity()).dbHandler.deleteLogLine(programTittel, exerciseTittel, line); } private void readItems() { ArrayList<ListAdapterItem> logging = ((MainActivity) getActivity()).dbHandler.getLogginPerExerciseDate(exerciseTittel, programTittel); if (!logging.isEmpty()) { for (ListAdapterItem s : logging) { list.add(0, s); } } } //method to add logs for different dates for testing purposes /* private void saveForTesting() { Logging log1 = new Logging(programTittel, tittelTV.getText().toString(), "35", "4", "kg"); Logging log2 = new Logging(programTittel, tittelTV.getText().toString(), "50", "66", "kg"); Logging log3 = new Logging(programTittel, tittelTV.getText().toString(), "222", "78", "kg"); Logging log4 = new Logging(programTittel, tittelTV.getText().toString(), "745", "32", "kg"); log1.setDato("2019-08-01"); log2.setDato("2019-08-02"); log3.setDato("2019-08-03"); log4.setDato("2019-08-05"); ((MainActivity) getActivity()).dbHandler.saveToLogging(log1); ((MainActivity) getActivity()).dbHandler.saveToLogging(log2); ((MainActivity) getActivity()).dbHandler.saveToLogging(log3); ((MainActivity) getActivity()).dbHandler.saveToLogging(log4); } */ }
UTF-8
Java
6,094
java
LogWorkout.java
Java
[]
null
[]
package com.eiralv.newtrainglog.Log; import android.app.Fragment; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; import android.widget.ImageButton; import android.widget.ListView; import android.widget.TextView; import com.eiralv.newtrainglog.Adapter.ListAdapterItem; import com.eiralv.newtrainglog.Adapter.LoggingListAdapter; import com.eiralv.newtrainglog.MainActivity; import com.eiralv.newtrainglog.MyBottomNavigationView; import com.eiralv.newtrainglog.R; import java.util.ArrayList; public class LogWorkout extends Fragment { private EditText weightET; private EditText repsET; private Button addButton; private ListView log_workout_listView; private TextView tittelTV; private LoggingListAdapter loggingListAdapter; private ArrayList<ListAdapterItem> list; private LogWorkout thisFragment = this; private String exerciseTittel; private String programTittel; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) { final View view = inflater.inflate(R.layout.log_workout_fragment, container, false); //bottom navigation new MyBottomNavigationView(thisFragment, view).selectedTab("Log"); Bundle bundle = getArguments(); this.exerciseTittel = bundle.getString("exerciseTittel"); this.programTittel = bundle.getString("programTittel"); tittelTV = view.findViewById(R.id.tittelTV); tittelTV.setText(exerciseTittel); //handling listview log_workout_listView = view.findViewById(R.id.log_workout_listView); list = new ArrayList<>(); readItems(); loggingListAdapter = new LoggingListAdapter(getActivity(), list, this, exerciseTittel, programTittel); log_workout_listView.setAdapter(loggingListAdapter); //EDIT TEXT HANDLING weightET = view.findViewById(R.id.weightET); repsET = view.findViewById(R.id.repsET); //((InputMethodManager)getActivity().getSystemService(Context.INPUT_METHOD_SERVICE)).toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY); weightET.setOnKeyListener(new View.OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_ENTER && event.getAction() == KeyEvent.ACTION_UP) { repsET.requestFocus(); return true; } return false; } }); repsET.setOnKeyListener(new View.OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_ENTER && event.getAction() == KeyEvent.ACTION_UP) { addButton.callOnClick(); weightET.requestFocus(); return true; } return false; } }); //ADD BUTTON HANDLING addButton = view.findViewById(R.id.addButton); addButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (weightET.getText().toString().equals("")) { weightET.setText("0"); } if (repsET.getText().toString().equals("")) { repsET.setText("0"); } ((MainActivity) getActivity()).dbHandler.saveToLogging(new Logging(programTittel, tittelTV.getText().toString(), weightET.getText().toString(), repsET.getText().toString(), ((MainActivity) getActivity()).getMesurement())); ListAdapterItem item = new ListAdapterItem(weightET.getText().toString(), repsET.getText().toString()); list.add(0, item); weightET.setText(""); repsET.setText(""); loggingListAdapter.notifyDataSetChanged(); } }); //BACK BUTTON HANDLING ImageButton backButton = view.findViewById(R.id.backButton); backButton.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View view) { getActivity().onBackPressed(); } }); //TESTINGPURPOSES //saveForTesting(); return view; } public void deleteLogLine(ListAdapterItem line) { ((MainActivity) getActivity()).dbHandler.deleteLogLine(programTittel, exerciseTittel, line); } private void readItems() { ArrayList<ListAdapterItem> logging = ((MainActivity) getActivity()).dbHandler.getLogginPerExerciseDate(exerciseTittel, programTittel); if (!logging.isEmpty()) { for (ListAdapterItem s : logging) { list.add(0, s); } } } //method to add logs for different dates for testing purposes /* private void saveForTesting() { Logging log1 = new Logging(programTittel, tittelTV.getText().toString(), "35", "4", "kg"); Logging log2 = new Logging(programTittel, tittelTV.getText().toString(), "50", "66", "kg"); Logging log3 = new Logging(programTittel, tittelTV.getText().toString(), "222", "78", "kg"); Logging log4 = new Logging(programTittel, tittelTV.getText().toString(), "745", "32", "kg"); log1.setDato("2019-08-01"); log2.setDato("2019-08-02"); log3.setDato("2019-08-03"); log4.setDato("2019-08-05"); ((MainActivity) getActivity()).dbHandler.saveToLogging(log1); ((MainActivity) getActivity()).dbHandler.saveToLogging(log2); ((MainActivity) getActivity()).dbHandler.saveToLogging(log3); ((MainActivity) getActivity()).dbHandler.saveToLogging(log4); } */ }
6,094
0.637348
0.626682
164
36.158535
33.144905
180
false
false
0
0
0
0
0
0
0.75
false
false
9
1acf007835d7838ad758162c7f31ff41956fcf7b
26,852,135,576,474
30ae7f9fc23024642b97164c05579fd529708736
/src/main/java/com/ggtest/classes/Connect4.java
cb328543d3340256a5c439e9b0644998d8752532
[]
no_license
tsapata/GameBackend
https://github.com/tsapata/GameBackend
ded71804762f8072dc8ce546568928a3abd3e2ce
212ee84f640d531af145e8c91fbe630bf3d89120
refs/heads/master
2021-05-04T06:36:53.299000
2016-10-10T14:32:22
2016-10-10T14:32:22
70,495,689
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ggtest.classes; import java.io.Serializable; public class Connect4 implements Serializable { /** * */ private static final long serialVersionUID = 2376885650841489190L; private final int EMPTY = 0; private int gameID; //Game ID number private int[][] state; /*Matrix holding the game board state (0 - empty space; 1 - player 1 piece; 2 - player 2 piece) Board coordinates start at 0 from top left: 0 ---> columns-1 0 | | | | | | | | | | | | | | | | | V | | | | | rows-1 | | | | | */ private int rows; //Number of rows of game board private int columns; //Number of columns of game board private int nextPlayerPlaying; private int status; //this var is 0 if action by the user is successful (start new game, make a move, etc); -1 otherwise private String statusMessage; //this string holds a message according to 'status' variable (for example: "Move not permitted" when status==-1 or "Game started" when initializing new game and status==0) public Connect4(int gameID, int rows, int columns) { this.gameID = gameID; this.nextPlayerPlaying = 1; //Player 1 plays first this.rows = rows; this.columns = columns; this.state = new int[this.rows][this.columns]; //matrix is initialized with all zeros this.status = 0; } // Empty constructor public Connect4() { } public boolean makeMove(int i, int j) { if ( isMoveAllowed(i,j) ) { this.state[i][j] = this.nextPlayerPlaying; this.nextPlayerPlaying = this.nextPlayerPlaying==1 ? 2 : 1; //Update nextPlayerPlaying (oscillates between 1 and 2) return true; } else { return false; } } public boolean isMoveAllowed(int i, int j) { return (i>=0 && i<this.rows) //row is inside limits && (j>=0 && j<this.columns) //column is inside limits && (this.state[i][j]==this.EMPTY) //space is empty && (i==this.rows-1 || this.state[i+1][j]!=this.EMPTY); //intended move is at the bottom of the board OR place under is not empty (contains a piece) } public int[][] getState() { return state; } public void setState(int[][] state) { this.state = state.clone(); } public int getGameID() { return gameID; } public void setGameID(int gameID) { this.gameID = gameID; } public int getStatus() { return status; } public void setStatus(int status) { this.status = status; } public String getStatusMessage() { return statusMessage; } public void setStatusMessage(String statusMessage) { this.statusMessage = statusMessage; } @Override public String toString() { String str = "Game [gameID=" + gameID + "]\n\nGame board ("+this.rows+" by "+this.columns+"):\n"; for (int i=0; i<this.rows; i++) { for (int j=0; j<this.rows; j++) { str = str + this.state[i][j] + " "; } str = str + "\n"; } return str; } }
UTF-8
Java
2,945
java
Connect4.java
Java
[]
null
[]
package com.ggtest.classes; import java.io.Serializable; public class Connect4 implements Serializable { /** * */ private static final long serialVersionUID = 2376885650841489190L; private final int EMPTY = 0; private int gameID; //Game ID number private int[][] state; /*Matrix holding the game board state (0 - empty space; 1 - player 1 piece; 2 - player 2 piece) Board coordinates start at 0 from top left: 0 ---> columns-1 0 | | | | | | | | | | | | | | | | | V | | | | | rows-1 | | | | | */ private int rows; //Number of rows of game board private int columns; //Number of columns of game board private int nextPlayerPlaying; private int status; //this var is 0 if action by the user is successful (start new game, make a move, etc); -1 otherwise private String statusMessage; //this string holds a message according to 'status' variable (for example: "Move not permitted" when status==-1 or "Game started" when initializing new game and status==0) public Connect4(int gameID, int rows, int columns) { this.gameID = gameID; this.nextPlayerPlaying = 1; //Player 1 plays first this.rows = rows; this.columns = columns; this.state = new int[this.rows][this.columns]; //matrix is initialized with all zeros this.status = 0; } // Empty constructor public Connect4() { } public boolean makeMove(int i, int j) { if ( isMoveAllowed(i,j) ) { this.state[i][j] = this.nextPlayerPlaying; this.nextPlayerPlaying = this.nextPlayerPlaying==1 ? 2 : 1; //Update nextPlayerPlaying (oscillates between 1 and 2) return true; } else { return false; } } public boolean isMoveAllowed(int i, int j) { return (i>=0 && i<this.rows) //row is inside limits && (j>=0 && j<this.columns) //column is inside limits && (this.state[i][j]==this.EMPTY) //space is empty && (i==this.rows-1 || this.state[i+1][j]!=this.EMPTY); //intended move is at the bottom of the board OR place under is not empty (contains a piece) } public int[][] getState() { return state; } public void setState(int[][] state) { this.state = state.clone(); } public int getGameID() { return gameID; } public void setGameID(int gameID) { this.gameID = gameID; } public int getStatus() { return status; } public void setStatus(int status) { this.status = status; } public String getStatusMessage() { return statusMessage; } public void setStatusMessage(String statusMessage) { this.statusMessage = statusMessage; } @Override public String toString() { String str = "Game [gameID=" + gameID + "]\n\nGame board ("+this.rows+" by "+this.columns+"):\n"; for (int i=0; i<this.rows; i++) { for (int j=0; j<this.rows; j++) { str = str + this.state[i][j] + " "; } str = str + "\n"; } return str; } }
2,945
0.624448
0.607131
114
24.833334
33.307423
204
false
false
0
0
0
0
0
0
3.298246
false
false
9
b48a62cd6dcc3d11c6ff2f234fa44b5fa010f6c3
8,641,474,227,286
032eb988c89c01893ed26a973d1bf2c9dff04be7
/src/main/java/dev/service/PlatServiceVersion1.java
895b5a530d9d5d5eb401df625a0519e276bec961
[]
no_license
btoulemonde/restaurant-console-app
https://github.com/btoulemonde/restaurant-console-app
5bf4bb99ba1adc6afd1f9b6ea958b48307ed0f02
d068c7af09d51058337ab978fe26fbb29900e53b
refs/heads/master
2020-12-13T02:18:25.908000
2020-01-19T11:44:47
2020-01-19T11:44:47
234,286,888
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package dev.service; import dev.dao.IPlatDao; import dev.entite.Plat; import dev.exception.PlatException; import java.util.List; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.ComponentScan; import org.springframework.stereotype.Component; import org.springframework.stereotype.Service; @Service public class PlatServiceVersion1 implements IPlatService { private IPlatDao dao; public PlatServiceVersion1(IPlatDao dao) { this.dao = dao; } @Override public List<Plat> listerPlats() { return dao.listerPlats(); } @Override public Plat afficherPlatId(int id){ return dao.rechercherParId(id); } @Override public void ajouterPlat(String nomPlat, Integer prixPlat) { // règle métier if (nomPlat.length() <= 3) { throw new PlatException("un plat doit avoir un nom de plus de 3 caractères"); } if (prixPlat <= 500) { throw new PlatException("le prix d'un plat doit être supérieur à 5 €"); } // persistance uniquement si les règles métiers sont respectées dao.ajouterPlat(nomPlat, prixPlat); } @Override public Plat afficherPlatNom(String nom) { return dao.rechercherParNom(nom); } @Override public void mettreAjour(String nom, int id) { dao.update(nom, id); } @Override public void delet(int id) { dao.delete(id); } }
UTF-8
Java
1,487
java
PlatServiceVersion1.java
Java
[]
null
[]
package dev.service; import dev.dao.IPlatDao; import dev.entite.Plat; import dev.exception.PlatException; import java.util.List; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.ComponentScan; import org.springframework.stereotype.Component; import org.springframework.stereotype.Service; @Service public class PlatServiceVersion1 implements IPlatService { private IPlatDao dao; public PlatServiceVersion1(IPlatDao dao) { this.dao = dao; } @Override public List<Plat> listerPlats() { return dao.listerPlats(); } @Override public Plat afficherPlatId(int id){ return dao.rechercherParId(id); } @Override public void ajouterPlat(String nomPlat, Integer prixPlat) { // règle métier if (nomPlat.length() <= 3) { throw new PlatException("un plat doit avoir un nom de plus de 3 caractères"); } if (prixPlat <= 500) { throw new PlatException("le prix d'un plat doit être supérieur à 5 €"); } // persistance uniquement si les règles métiers sont respectées dao.ajouterPlat(nomPlat, prixPlat); } @Override public Plat afficherPlatNom(String nom) { return dao.rechercherParNom(nom); } @Override public void mettreAjour(String nom, int id) { dao.update(nom, id); } @Override public void delet(int id) { dao.delete(id); } }
1,487
0.674119
0.668699
71
19.788733
22.342352
89
false
false
0
0
0
0
0
0
0.633803
false
false
9
199b1637450a654bc648ce7b237d7320ef425249
27,530,740,385,977
f2068733df298d5aedf05a114a7613e93aa0771a
/Java SE/Modules in JDK 9/03_Packaging/src/com.greetings/module-info.java
37376c602c858bf1d4c09de6b3e206935bda3899
[]
no_license
BriceMetthey/BriceMetthey.github.io
https://github.com/BriceMetthey/BriceMetthey.github.io
300f3fcb7b0c1131c6bbfcdb44e96892052a8ff7
c59b3f0c95b6e7c41d082d8c16d78cd36434740d
refs/heads/master
2018-08-29T01:15:10.064000
2018-08-26T08:17:54
2018-08-26T08:17:54
79,641,810
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
// Declare a dependency on module org.astro. module com.greetings { requires org.astro; }
UTF-8
Java
96
java
module-info.java
Java
[]
null
[]
// Declare a dependency on module org.astro. module com.greetings { requires org.astro; }
96
0.708333
0.708333
4
22.75
15.562374
45
false
false
0
0
0
0
0
0
0.25
false
false
9
3e07e03316b235c2fe847cc0995f524920dbdd48
35,862,976,925,273
cc1d007f52ba8ab7b8221f3a1b8dfd0e2e9d1f0c
/Lab07/Lab07/src/l7p5/TestMain.java
8b6f329f3d95195f038e47fde363321c6c2d0410
[]
no_license
WowSuchRicky/CS235
https://github.com/WowSuchRicky/CS235
3b7907931795fea7c570cf8d2ca093affa1780cd
180617db68e6c8a1a2a9c0c096dee06665ba785a
refs/heads/master
2021-05-28T01:57:45.780000
2013-09-08T01:36:51
2013-09-08T01:36:51
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package l7p5; import l7p3.CombinationLockTest; /** * Title: TestMain class for CSIS 235 Lab #7 * Description: CS 235 Lab #7 - TestMain * This class has a main method and is the * client of the CombinationLockTest class. * @author Ricky Mutschlechner, Tim Olmstead and Noah Muth * @email riccardo.mutschlechner@my.uwrf.edu, timothy.olmstead@my.uwrf.edu and noah.muth@my.uwrf.edu * @date October 23rd, 2012 */ public class TestMain { /** * main method - this is where this test program starts. * @param args */ public static void main(String[] args) { NewerCombinationLock lock1 = new NewerCombinationLock(123); System.out.println("Made new lock lock1, with combination 123."); lock1.close(); System.out.println("Is the lock open? " + lock1.isOpen()); System.out.println("Entering the number 1..."); lock1.enter(1); System.out.println("Entering the number 2..."); lock1.enter(2); System.out.println("Entering the number 3..."); lock1.enter(3); System.out.println("Did the lock open after inputting 123? " + lock1.isOpen()); } }
UTF-8
Java
1,105
java
TestMain.java
Java
[ { "context": "lient of the CombinationLockTest class.\n * @author Ricky Mutschlechner, Tim Olmstead and Noah Muth\n * @email riccardo.m", "end": 282, "score": 0.9998717308044434, "start": 263, "tag": "NAME", "value": "Ricky Mutschlechner" }, { "context": "ionLockTest class.\n * @aut...
null
[]
package l7p5; import l7p3.CombinationLockTest; /** * Title: TestMain class for CSIS 235 Lab #7 * Description: CS 235 Lab #7 - TestMain * This class has a main method and is the * client of the CombinationLockTest class. * @author <NAME>, <NAME> and <NAME> * @email <EMAIL>, <EMAIL> and <EMAIL> * @date October 23rd, 2012 */ public class TestMain { /** * main method - this is where this test program starts. * @param args */ public static void main(String[] args) { NewerCombinationLock lock1 = new NewerCombinationLock(123); System.out.println("Made new lock lock1, with combination 123."); lock1.close(); System.out.println("Is the lock open? " + lock1.isOpen()); System.out.println("Entering the number 1..."); lock1.enter(1); System.out.println("Entering the number 2..."); lock1.enter(2); System.out.println("Entering the number 3..."); lock1.enter(3); System.out.println("Did the lock open after inputting 123? " + lock1.isOpen()); } }
1,021
0.682353
0.645249
38
28.078947
25.924366
101
false
false
0
0
0
0
0
0
1.289474
false
false
9
896669a668a4f383d2e06b599a2e86346b582a00
7,619,272,042,278
b5bcf403fc2c0046921345631012b077ea6584a4
/src/com/cwa/simuiationimpl/Player.java
403b2da6a78be975fd6634b456b8e45d356f070d
[]
no_license
mmgame/cwa2_2101wow_battle_server
https://github.com/mmgame/cwa2_2101wow_battle_server
f3900f8842dd3aeaa16d0631f8ed192df6c0a4fd
788e7db9d5ddcbcbd35fe6d2a0322804be827f72
refs/heads/master
2021-01-22T04:40:17.085000
2015-08-06T03:14:21
2015-08-06T03:14:21
40,281,761
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.cwa.simuiationimpl; import com.cwa.component.event.ILocalEvent; import com.cwa.simuiation.IPlayer; import com.cwa.simuiation.event.ISEvent; public class Player extends ClientSimuiation implements IPlayer { private int troopType; public Player(long id) { super(String.valueOf(id)); } public int getTroopType() { return troopType; } @Override public void sendEvent(ISEvent event) { simuiation.sendEvent(event); } @Override public void sendEvent(Object listenerType, ILocalEvent event) { simuiation.sendEvent(listenerType, event); } // -------------------------------------- public void setTroopType(int troopType) { this.troopType = troopType; } }
UTF-8
Java
723
java
Player.java
Java
[]
null
[]
package com.cwa.simuiationimpl; import com.cwa.component.event.ILocalEvent; import com.cwa.simuiation.IPlayer; import com.cwa.simuiation.event.ISEvent; public class Player extends ClientSimuiation implements IPlayer { private int troopType; public Player(long id) { super(String.valueOf(id)); } public int getTroopType() { return troopType; } @Override public void sendEvent(ISEvent event) { simuiation.sendEvent(event); } @Override public void sendEvent(Object listenerType, ILocalEvent event) { simuiation.sendEvent(listenerType, event); } // -------------------------------------- public void setTroopType(int troopType) { this.troopType = troopType; } }
723
0.681881
0.681881
33
19.90909
19.722874
65
false
false
0
0
0
0
0
0
1.090909
false
false
9
a25e5b1da0cd683aea35896ee9ed903018f3e03b
13,855,564,553,908
b1e5b04d9b752e7c29a19bfdac34cbae9728fdfd
/app/src/main/java/kr/co/mash_up/crema/CremaApplication.java
b6b89481773073f615359c2b6fecef979feee774
[]
no_license
mash-up-kr/Crema-android
https://github.com/mash-up-kr/Crema-android
92060d01c90b7bc350e25f29227c68aaa67f6873
d081d45b63a6e58e9d656583d1021ba9cdd9f241
refs/heads/master
2021-01-11T18:54:23.247000
2017-02-08T11:14:34
2017-02-08T11:14:34
79,652,812
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package kr.co.mash_up.crema; import android.app.Application; /** * Created by bigstark on 2017. 2. 3.. */ public class CremaApplication extends Application { private static CremaApplication instance; public static CremaApplication getInstance() { return instance; } @Override public void onCreate() { super.onCreate(); instance = this; } }
UTF-8
Java
398
java
CremaApplication.java
Java
[ { "context": "import android.app.Application;\n\n/**\n * Created by bigstark on 2017. 2. 3..\n */\n\npublic class CremaApplicatio", "end": 89, "score": 0.9997068047523499, "start": 81, "tag": "USERNAME", "value": "bigstark" } ]
null
[]
package kr.co.mash_up.crema; import android.app.Application; /** * Created by bigstark on 2017. 2. 3.. */ public class CremaApplication extends Application { private static CremaApplication instance; public static CremaApplication getInstance() { return instance; } @Override public void onCreate() { super.onCreate(); instance = this; } }
398
0.653266
0.638191
24
15.583333
17.423443
51
false
false
0
0
0
0
0
0
0.25
false
false
9
b16dd0e2cf6d0dc90071ba4c156cb4f0ad379a06
33,131,377,787,726
fe1ac3a474ac21379583521fdadb7ddb27c10c44
/client/src/main/java/com/example/demo/model/TaskDTO.java
f25ab1e4b68e49658828c323386698a995c0e813
[]
no_license
bobosui/urule-demo
https://github.com/bobosui/urule-demo
a82792392ffbdbbd19d71d1977de9858ea0678f3
6fe1a7c01762e32145f9aa9bf575a0e92855d9ed
refs/heads/master
2023-03-28T10:11:09.104000
2020-08-04T10:31:25
2020-08-04T10:31:25
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.demo.model; import com.bstek.urule.model.Label; import lombok.Data; import java.util.List; import java.util.Set; import java.util.UUID; /** * TaskDTO class * * @author ZF * @date 2018/10/17 */ @Data public class TaskDTO { @Label("ID") protected String id =UUID.randomUUID().toString().replace("-", ""); @Label("标题") protected String taskTitle; @Label("来源") protected String soc; @Label("计划截止时间") protected Long planingEndDate; @Label("实际处理时间") protected Long hendlingDate; @Label("URL") protected String taskUrl; @Label("状态") protected String taskStatus; @Label("预警时间") protected Long alertDate; @Label("处理人") protected List<String> dealName; }
UTF-8
Java
814
java
TaskDTO.java
Java
[ { "context": "ava.util.UUID;\n\n/**\n * TaskDTO class\n *\n * @author ZF\n * @date 2018/10/17\n */\n@Data\npublic class TaskDT", "end": 196, "score": 0.9831746220588684, "start": 194, "tag": "USERNAME", "value": "ZF" } ]
null
[]
package com.example.demo.model; import com.bstek.urule.model.Label; import lombok.Data; import java.util.List; import java.util.Set; import java.util.UUID; /** * TaskDTO class * * @author ZF * @date 2018/10/17 */ @Data public class TaskDTO { @Label("ID") protected String id =UUID.randomUUID().toString().replace("-", ""); @Label("标题") protected String taskTitle; @Label("来源") protected String soc; @Label("计划截止时间") protected Long planingEndDate; @Label("实际处理时间") protected Long hendlingDate; @Label("URL") protected String taskUrl; @Label("状态") protected String taskStatus; @Label("预警时间") protected Long alertDate; @Label("处理人") protected List<String> dealName; }
814
0.640052
0.629581
53
13.415094
14.658933
71
false
false
0
0
0
0
0
0
0.301887
false
false
9
9181e2b5f54cc9bbd62d74fa5b8c0c49c687662a
35,338,990,926,010
5729b929ab474320c8b215cbc5020732f4551cce
/src/Char1Duck/FlyWithRocketPower.java
c4979d3fb9e8c600db797d1187f01cca13b307dc
[ "Apache-2.0" ]
permissive
concaoccc/Design-pattern
https://github.com/concaoccc/Design-pattern
82226e14275b8a2f61cf6a14232ddee0d21b407a
a42a67746246faf5cf34fdc3d9d55027f5dc3004
refs/heads/master
2022-05-30T06:49:10.470000
2018-12-03T13:14:52
2018-12-03T13:14:52
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Char1Duck; public class FlyWithRocketPower implements FlyBehavior { @Override public void fly() { System.out.println("我使用火箭飞行"); } }
UTF-8
Java
176
java
FlyWithRocketPower.java
Java
[]
null
[]
package Char1Duck; public class FlyWithRocketPower implements FlyBehavior { @Override public void fly() { System.out.println("我使用火箭飞行"); } }
176
0.679012
0.67284
8
19.25
18.246574
56
false
false
0
0
0
0
0
0
0.25
false
false
9
18901e2a0fb028fa50e636e59d6558299721f0d1
16,381,005,330,644
e440f05d31e565dedef071bb723e404c4b050799
/app/src/main/java/com/gdin/analyse/info/HttpInfo.java
ff03a903718305fb5abc4ce3f6f705e54246a36c
[]
no_license
lhbd/ScoreAnalysisSys
https://github.com/lhbd/ScoreAnalysisSys
aaf175ff7622cf88efa2484f14d7dc5d2be103fb
e645b1b5cb99788b139ce91d477c5b7fa33c7e94
refs/heads/master
2021-01-19T13:12:36.346000
2017-05-23T13:18:36
2017-05-23T13:18:36
88,073,156
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.gdin.analyse.info; import com.gdin.analyse.entity.ClassResultEntity; import com.gdin.analyse.entity.ExamDataEntity; import com.gdin.analyse.entity.HttpResult; import com.gdin.analyse.entity.LoginDataEntity; import com.gdin.analyse.entity.StudentRankResultEntity; import com.gdin.analyse.entity.StudentRollRequestEntity; import com.gdin.analyse.entity.StudentDetailRequestEntity; import com.gdin.analyse.entity.ResetPwdEntity; import com.gdin.analyse.entity.SchoolEntity; import com.gdin.analyse.entity.StudentRollSortRequestEntity; import com.gdin.analyse.entity.StudentRollSortResultEntity; import com.gdin.analyse.entity.StudentScoreResultEntity; import java.util.List; import retrofit2.http.Body; import retrofit2.http.GET; import retrofit2.http.POST; import rx.Observable; public interface HttpInfo { @GET("user/info/getSchoolInfo") Observable<HttpResult<List<SchoolEntity>>> getSchoolData(); @POST("user/info/login") Observable<HttpResult<LoginDataEntity>> checkLogin(@Body LoginDataEntity entity); @POST("user/info/alterPwd") Observable<HttpResult> resetPwd(@Body ResetPwdEntity entity); @POST("exam/getExamInfo") Observable<HttpResult<List<ExamDataEntity>>> getExam(@Body ExamDataEntity entity); @POST("score/getAnaInfo") Observable<HttpResult<ClassResultEntity>> getClassScore(@Body ClassResultEntity entity); @POST("score/getAllScoreInfo") Observable<HttpResult<List<StudentScoreResultEntity>>> getStudentRoll(@Body StudentRollRequestEntity entity); @POST("score/getIndivScoreInfo") Observable<HttpResult<StudentScoreResultEntity>> getStudentScore(@Body StudentDetailRequestEntity entity); @POST("rank/getIndivRankinfo") Observable<HttpResult<StudentRankResultEntity>> getStudentRank(@Body StudentDetailRequestEntity entity); @POST("rank/getSpecifyRank") Observable<HttpResult<List<StudentRollSortResultEntity>>> getStudentRollSort(@Body StudentRollSortRequestEntity entity); }
UTF-8
Java
1,976
java
HttpInfo.java
Java
[]
null
[]
package com.gdin.analyse.info; import com.gdin.analyse.entity.ClassResultEntity; import com.gdin.analyse.entity.ExamDataEntity; import com.gdin.analyse.entity.HttpResult; import com.gdin.analyse.entity.LoginDataEntity; import com.gdin.analyse.entity.StudentRankResultEntity; import com.gdin.analyse.entity.StudentRollRequestEntity; import com.gdin.analyse.entity.StudentDetailRequestEntity; import com.gdin.analyse.entity.ResetPwdEntity; import com.gdin.analyse.entity.SchoolEntity; import com.gdin.analyse.entity.StudentRollSortRequestEntity; import com.gdin.analyse.entity.StudentRollSortResultEntity; import com.gdin.analyse.entity.StudentScoreResultEntity; import java.util.List; import retrofit2.http.Body; import retrofit2.http.GET; import retrofit2.http.POST; import rx.Observable; public interface HttpInfo { @GET("user/info/getSchoolInfo") Observable<HttpResult<List<SchoolEntity>>> getSchoolData(); @POST("user/info/login") Observable<HttpResult<LoginDataEntity>> checkLogin(@Body LoginDataEntity entity); @POST("user/info/alterPwd") Observable<HttpResult> resetPwd(@Body ResetPwdEntity entity); @POST("exam/getExamInfo") Observable<HttpResult<List<ExamDataEntity>>> getExam(@Body ExamDataEntity entity); @POST("score/getAnaInfo") Observable<HttpResult<ClassResultEntity>> getClassScore(@Body ClassResultEntity entity); @POST("score/getAllScoreInfo") Observable<HttpResult<List<StudentScoreResultEntity>>> getStudentRoll(@Body StudentRollRequestEntity entity); @POST("score/getIndivScoreInfo") Observable<HttpResult<StudentScoreResultEntity>> getStudentScore(@Body StudentDetailRequestEntity entity); @POST("rank/getIndivRankinfo") Observable<HttpResult<StudentRankResultEntity>> getStudentRank(@Body StudentDetailRequestEntity entity); @POST("rank/getSpecifyRank") Observable<HttpResult<List<StudentRollSortResultEntity>>> getStudentRollSort(@Body StudentRollSortRequestEntity entity); }
1,976
0.810223
0.808704
43
44.953487
31.456839
124
false
false
0
0
0
0
0
0
0.627907
false
false
9
376bda057366680372cc783a66e166abb53f90ed
7,224,135,038,717
d9a2d9041f2875076ac805fc1b786327fbe9ab53
/backend/src/main/java/com/bsuir/tkondratyev/backend/service/ContentService.java
815e962070ba14a4599e19d227a2d34423114f9a
[]
no_license
svetaukiyo/NC-Charging-Service
https://github.com/svetaukiyo/NC-Charging-Service
4e659cfc77beb6e612104491c9c80c60509063c7
9ad62ce5435f897c649c0ebfc471db0884c3892c
refs/heads/master
2020-09-23T00:01:48.087000
2019-11-07T18:46:52
2019-11-07T18:46:52
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.bsuir.tkondratyev.backend.service; import com.bsuir.tkondratyev.backend.entity.ContentEntity; import com.bsuir.tkondratyev.backend.entity.UserProfileEntity; import java.util.List; public interface ContentService { List<ContentEntity> findAll(); ContentEntity findByItemName(String itemName); ContentEntity saveContent(ContentEntity content); void deleteContent(Long id); List<ContentEntity> findAllByUserProfile(UserProfileEntity userProfile); }
UTF-8
Java
481
java
ContentService.java
Java
[]
null
[]
package com.bsuir.tkondratyev.backend.service; import com.bsuir.tkondratyev.backend.entity.ContentEntity; import com.bsuir.tkondratyev.backend.entity.UserProfileEntity; import java.util.List; public interface ContentService { List<ContentEntity> findAll(); ContentEntity findByItemName(String itemName); ContentEntity saveContent(ContentEntity content); void deleteContent(Long id); List<ContentEntity> findAllByUserProfile(UserProfileEntity userProfile); }
481
0.810811
0.810811
14
33.357143
24.763474
76
false
false
0
0
0
0
0
0
0.642857
false
false
9
3f5e027d46b1c154d6a31d45b2a2393d92c2a630
7,224,135,038,862
065449dff9b258bbc6180a1a1d4c084c70b06a94
/SpeedConverter/src/Main.java
60a95c77fd34d604879bd1830ba985d0839d488d
[]
no_license
qulqula/javaEx
https://github.com/qulqula/javaEx
f7721d28ffb029c8ffa018ccd59cec2c76704b61
343d20df02c93ebdf72554a325d289651deb7985
refs/heads/master
2020-07-29T11:18:38.540000
2019-09-29T09:28:32
2019-09-29T09:28:32
209,778,995
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class Main { public static void main (String[] args) { SpeedConverter.printConversion(9.3); } }
UTF-8
Java
119
java
Main.java
Java
[]
null
[]
public class Main { public static void main (String[] args) { SpeedConverter.printConversion(9.3); } }
119
0.638655
0.621849
5
22.799999
18.701872
45
false
false
0
0
0
0
0
0
0.2
false
false
9
fb098ea58889259fbafc8a103f8e9575e2104134
20,718,922,298,974
8d03d8b36d5cf44be5733c91d071695d9eb2259a
/Merge of AT_latestCode/src/main/java/com/alliancetech/objectrepository/NarrowYourResultsOR.java
08fcee7a34882425dbaa1033dfae757267792785
[]
no_license
chsreenivas/test2
https://github.com/chsreenivas/test2
aa80b8468d9bd09f35fdf33edd3ed8de799da211
9465944bafdec29da597d321b83341c2ff444322
refs/heads/master
2020-03-16T15:13:49.346000
2018-05-09T09:42:42
2018-05-09T09:42:42
132,733,983
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.alliancetech.objectrepository; import org.openqa.selenium.By; import com.cigniti.automation.accelerators.Actiondriver; public class NarrowYourResultsOR extends Actiondriver{ public static By lnkNarrowYourResultsOption=By.xpath("//*[@id='sub-narrow-3-0']/li[1]/a"); public static By lstSession=By.xpath("//div[@id='sess-results']"); }
UTF-8
Java
360
java
NarrowYourResultsOR.java
Java
[]
null
[]
package com.alliancetech.objectrepository; import org.openqa.selenium.By; import com.cigniti.automation.accelerators.Actiondriver; public class NarrowYourResultsOR extends Actiondriver{ public static By lnkNarrowYourResultsOption=By.xpath("//*[@id='sub-narrow-3-0']/li[1]/a"); public static By lstSession=By.xpath("//div[@id='sess-results']"); }
360
0.758333
0.75
14
24.714285
30.405424
91
false
false
0
0
0
0
0
0
0.714286
false
false
9
ac7524eadd1af9196fe0d6d08c2e4b64c0c2cc43
38,603,166,056,565
3e15547613ca0c4822754a60f808f078e4ffca34
/WeChatService/EX02-CSTSv3-ClientAPI/src/jedi/ex01/CSTS3/comm/ipop/OP_TRADESERV5024.java
c6b1b39921b5645af657f7a6565b31bdee1ae075
[]
no_license
LayZhangGitHub/MyCodeRepository
https://github.com/LayZhangGitHub/MyCodeRepository
f897b7c78eb4d5faddfeb49d1d6923b0e4f5b179
8c56080805271da43fca461477fcfecd8b4a0cb4
refs/heads/master
2018-04-24T05:19:52.523000
2018-01-26T02:47:07
2018-01-26T02:47:07
91,558,820
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package jedi.ex01.CSTS3.comm.ipop; import jedi.ex01.CSTS3.comm.struct.TTrade4CFD; public class OP_TRADESERV5024 extends jedi.ex01.CSTS3.comm.ipop.OPFather { public static final String jsonId = "OP_TRADESERV5024"; public static final String trade4CFDVec = "1"; public OP_TRADESERV5024(){ super(); setEntry("jsonId", jsonId); } public TTrade4CFD[] getTrade4CFDVec() { try { TTrade4CFD[] data=getEntryObjectVec(OP_TRADESERV5024.trade4CFDVec,new TTrade4CFD[0]); return data; } catch (RuntimeException e) { return null; } } public void setTrade4CFDVec(TTrade4CFD[] trade4CFDVec) { setEntry(OP_TRADESERV5024.trade4CFDVec, trade4CFDVec); } }
UTF-8
Java
703
java
OP_TRADESERV5024.java
Java
[]
null
[]
package jedi.ex01.CSTS3.comm.ipop; import jedi.ex01.CSTS3.comm.struct.TTrade4CFD; public class OP_TRADESERV5024 extends jedi.ex01.CSTS3.comm.ipop.OPFather { public static final String jsonId = "OP_TRADESERV5024"; public static final String trade4CFDVec = "1"; public OP_TRADESERV5024(){ super(); setEntry("jsonId", jsonId); } public TTrade4CFD[] getTrade4CFDVec() { try { TTrade4CFD[] data=getEntryObjectVec(OP_TRADESERV5024.trade4CFDVec,new TTrade4CFD[0]); return data; } catch (RuntimeException e) { return null; } } public void setTrade4CFDVec(TTrade4CFD[] trade4CFDVec) { setEntry(OP_TRADESERV5024.trade4CFDVec, trade4CFDVec); } }
703
0.70697
0.645804
31
20.741936
25.208765
88
false
false
0
0
0
0
0
0
1.354839
false
false
9
ab15eac59dd249096455cccae4d7b95b05cd0159
60,129,575,064
c16392f0a2187b94ba91fd0e46113a0b90cadc34
/thinks-tools/src/main/java/com/xiao/tools/db/structure/AnnotationBuilder.java
a576cadab764b3ae21e830a1091d518e3ddecb62
[]
no_license
xiaojinrong/thinks
https://github.com/xiaojinrong/thinks
fccdfa01d3093d6d4e1d584d6dac21a823e15b6c
d36663567542e9057effca8bbd7ed7a8c993451a
refs/heads/master
2020-04-08T11:07:51.858000
2018-12-18T10:14:25
2018-12-18T10:14:25
159,294,491
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.xiao.tools.db.structure; import java.util.LinkedHashMap; import java.util.Map; import java.util.Map.Entry; import com.xiao.tools.string.StringUtil; /** * 注解构建 * @author XiaoJinRong * @times 2018年8月13日 上午9:55:03 * @version 1.0 */ public class AnnotationBuilder { /** 注解名称 */ private String name; /** 注解默认值 */ private String defaultValue; /** 注解属性值 */ private Map<String,String> paramMap = new LinkedHashMap<>(); public AnnotationBuilder() { } public AnnotationBuilder(String name) { this.name = name; } public AnnotationBuilder(String name, String defaultValue) { this.name = name; this.defaultValue = defaultValue; } public AnnotationBuilder(String name, Map<String, String> paramMap) { this.name = name; this.paramMap = paramMap; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDefaultValue() { return defaultValue; } public void setDefaultValue(String defaultValue) { this.defaultValue = defaultValue; } public Map<String, String> getParamMap() { return paramMap; } public void setParamMap(Map<String, String> paramMap) { this.paramMap = paramMap; } @Override public String toString() { StringBuffer sb = new StringBuffer(); sb.append(StringUtil.SPACE_FOUR).append("@").append(this.name); if(StringUtil.isEmpty(this.defaultValue)) { if(this.paramMap!=null&&this.paramMap.size()>0) { sb.append("("); String paramString = ""; for (Entry<String, String> map : this.getParamMap().entrySet()) { paramString+=map.getKey()+"=\""+map.getValue()+"\","; } paramString=paramString!=""?paramString.trim().substring(0,paramString.length()-1):paramString; sb.append(paramString).append(")"); } }else { sb.append("(").append("\"").append(this.defaultValue).append("\"").append(")"); } return sb.toString(); } public static void main(String[] args) { Map<String,String> param = new LinkedHashMap<>(); param.put("key", "1"); param.put("value", "2"); AnnotationBuilder builder = new AnnotationBuilder("Service",param); System.out.println(builder); } }
UTF-8
Java
2,301
java
AnnotationBuilder.java
Java
[ { "context": "ols.string.StringUtil;\r\n\r\n/**\r\n * 注解构建\r\n * @author XiaoJinRong\r\n * @times 2018年8月13日 上午9:55:03 \r\n * @version 1.0", "end": 207, "score": 0.9998511672019958, "start": 196, "tag": "NAME", "value": "XiaoJinRong" } ]
null
[]
package com.xiao.tools.db.structure; import java.util.LinkedHashMap; import java.util.Map; import java.util.Map.Entry; import com.xiao.tools.string.StringUtil; /** * 注解构建 * @author XiaoJinRong * @times 2018年8月13日 上午9:55:03 * @version 1.0 */ public class AnnotationBuilder { /** 注解名称 */ private String name; /** 注解默认值 */ private String defaultValue; /** 注解属性值 */ private Map<String,String> paramMap = new LinkedHashMap<>(); public AnnotationBuilder() { } public AnnotationBuilder(String name) { this.name = name; } public AnnotationBuilder(String name, String defaultValue) { this.name = name; this.defaultValue = defaultValue; } public AnnotationBuilder(String name, Map<String, String> paramMap) { this.name = name; this.paramMap = paramMap; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDefaultValue() { return defaultValue; } public void setDefaultValue(String defaultValue) { this.defaultValue = defaultValue; } public Map<String, String> getParamMap() { return paramMap; } public void setParamMap(Map<String, String> paramMap) { this.paramMap = paramMap; } @Override public String toString() { StringBuffer sb = new StringBuffer(); sb.append(StringUtil.SPACE_FOUR).append("@").append(this.name); if(StringUtil.isEmpty(this.defaultValue)) { if(this.paramMap!=null&&this.paramMap.size()>0) { sb.append("("); String paramString = ""; for (Entry<String, String> map : this.getParamMap().entrySet()) { paramString+=map.getKey()+"=\""+map.getValue()+"\","; } paramString=paramString!=""?paramString.trim().substring(0,paramString.length()-1):paramString; sb.append(paramString).append(")"); } }else { sb.append("(").append("\"").append(this.defaultValue).append("\"").append(")"); } return sb.toString(); } public static void main(String[] args) { Map<String,String> param = new LinkedHashMap<>(); param.put("key", "1"); param.put("value", "2"); AnnotationBuilder builder = new AnnotationBuilder("Service",param); System.out.println(builder); } }
2,301
0.651441
0.643016
95
21.736841
22.249405
99
false
false
0
0
0
0
0
0
1.726316
false
false
9
50717b6c90c17d01a1f64e05716f911354357ac5
7,224,135,043,954
d44cf3aa75111ca5bd630aeca5f84caadd35c70b
/ServiceT/src/main/java/test/z/serviceimpl/CommentService.java
0ba573d48bdb3a70a30fd0e87c0af75a7ce0b334
[]
no_license
EpLLI/TaskTrack
https://github.com/EpLLI/TaskTrack
c3a096c1f1314cc8a6c36924f4306273d55b82f1
0d873bf71d253cf05aa06f053a6edd154a831e91
refs/heads/master
2021-01-17T20:45:49.260000
2016-07-12T07:31:16
2016-07-12T07:31:16
63,134,343
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package test.z.serviceimpl; import java.util.List; import org.apache.log4j.Logger; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import test.z.Exception.DaoException; import test.z.dao.dao.CommentDao; import test.z.pojos.Comment; import test.z.pojos.Project; import test.z.service.ICommentService; import test.z.serviceException.ServiceException; @Repository() public class CommentService extends BaseService<Comment>implements ICommentService { private static Logger log = Logger.getLogger(ProjectService.class); @Autowired private CommentDao CommentDaoImpl; public CommentService() { } @Override public void addComment(Comment comm) throws ServiceException { try { CommentDaoImpl.saveOrUpdate(comm); } catch (DaoException e) { log.error("Error in addRace process --- " + e); throw new ServiceException(e); } } @Override public List<Comment> getAllComment() throws ServiceException { List<Comment> comm = null; try { comm = CommentDaoImpl.getAllComment(); } catch (DaoException e) { log.error("Error in getAllCoefficiet process --- " + e); throw new ServiceException(e); } return comm; } @Override public List<Comment> getCommentTask(String task) throws ServiceException { List<Comment> comm = null; try { comm = CommentDaoImpl.getCommentTask(task); } catch (DaoException e) { log.error("Error in getAllCoefficiet process --- " + e); throw new ServiceException(e); } return comm; } @Override public void delete(int id) throws ServiceException { try { CommentDaoImpl.delete(id); ; } catch (DaoException e) { log.error("Error in addRace process --- " + e); throw new ServiceException(e); } } @Override public boolean updateComm(Comment comm) throws ServiceException { try { CommentDaoImpl.updateComm(comm); } catch (DaoException e) { log.error("Error in addCoefficient process --- " + e); throw new ServiceException(e); } return false; } }
UTF-8
Java
2,072
java
CommentService.java
Java
[]
null
[]
package test.z.serviceimpl; import java.util.List; import org.apache.log4j.Logger; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import test.z.Exception.DaoException; import test.z.dao.dao.CommentDao; import test.z.pojos.Comment; import test.z.pojos.Project; import test.z.service.ICommentService; import test.z.serviceException.ServiceException; @Repository() public class CommentService extends BaseService<Comment>implements ICommentService { private static Logger log = Logger.getLogger(ProjectService.class); @Autowired private CommentDao CommentDaoImpl; public CommentService() { } @Override public void addComment(Comment comm) throws ServiceException { try { CommentDaoImpl.saveOrUpdate(comm); } catch (DaoException e) { log.error("Error in addRace process --- " + e); throw new ServiceException(e); } } @Override public List<Comment> getAllComment() throws ServiceException { List<Comment> comm = null; try { comm = CommentDaoImpl.getAllComment(); } catch (DaoException e) { log.error("Error in getAllCoefficiet process --- " + e); throw new ServiceException(e); } return comm; } @Override public List<Comment> getCommentTask(String task) throws ServiceException { List<Comment> comm = null; try { comm = CommentDaoImpl.getCommentTask(task); } catch (DaoException e) { log.error("Error in getAllCoefficiet process --- " + e); throw new ServiceException(e); } return comm; } @Override public void delete(int id) throws ServiceException { try { CommentDaoImpl.delete(id); ; } catch (DaoException e) { log.error("Error in addRace process --- " + e); throw new ServiceException(e); } } @Override public boolean updateComm(Comment comm) throws ServiceException { try { CommentDaoImpl.updateComm(comm); } catch (DaoException e) { log.error("Error in addCoefficient process --- " + e); throw new ServiceException(e); } return false; } }
2,072
0.727799
0.727317
92
21.52174
21.943346
84
false
false
0
0
0
0
0
0
1.554348
false
false
9
33e28326e40563942353631ec99e5cf34add428f
38,070,590,112,279
a43edc8a2141f525f0683260d63cf650b7a45da0
/src/script/npc/NPCTalk.java
4661b63d16f1107690d096dc608aeef622595b75
[]
no_license
MapleSilver/Mushy
https://github.com/MapleSilver/Mushy
040fb25528fb31af582307a059425c9bf468e40d
141dc5d5e28b9461ae62211a46f42c50f182ed9f
refs/heads/master
2021-01-16T23:10:20.582000
2016-08-27T01:38:13
2016-08-27T01:38:13
66,689,916
3
2
null
true
2016-08-27T01:47:05
2016-08-27T01:47:05
2016-08-26T17:10:38
2016-08-27T01:38:16
5,739
0
0
0
null
null
null
/** * @author Maxcloud * */ package script.npc; public class NPCTalk { private byte type, msg, param, color; private int npcid, npcidd, seconds, amount, min, max; private boolean prev, next; private String text, def, hint; private Object[] args; public NPCTalk(byte type, int npcid, byte msg) { this(type, npcid, msg, (byte) 0, (byte) 0); } public NPCTalk(byte type, int npcid, byte msg, byte param, byte color) { this.type = type; this.npcid = npcid; this.msg = msg; this.param = param; this.color = color; } /** * Get the type. * @return */ public byte getType() { return type; } /** * Set the type. * @param type */ public void setType(byte type) { this.type = type; } /** * Get the message modifier. * @return */ public byte getMsg() { return msg; } /** * Set the message modifier. * @param msg */ public void setMsg(byte msg) { this.msg = msg; } /** * Get the parameter. * @return */ public byte getParam() { return param; } /** * Set the parameter. * @param param */ public void setParam(byte param) { this.param = param; } /** * Get the color type. * @return */ public byte getColor() { return color; } /** * Set the color of the dialog box. * @param color */ public void setColor(byte color) { this.color = color; } /** * Get the NPC ID. * @return */ public int getNpcID() { return npcid; } /** * Set the NPC ID. * @param npcid */ public void setNpcID(int npcid) { this.npcid = npcid; } /** * Get the second NPC ID * @return */ public int getNpcIDD() { return npcidd; } /** * Set the second NPC ID * @param npcidd */ public void setNpcIDD(int npcidd) { this.npcidd = npcidd; } /** * Get the amount of seconds to wait. * @return */ public int getSeconds() { return seconds; } /** * Set the amount of seconds to wait. * @param wait */ public void setSeconds(int seconds) { this.seconds = seconds; } /** * Get the amount. * @return */ public int getAmount() { return amount; } /** * Set the amount. * @param wait */ public void setAmount(int amount) { this.amount = amount; } /** * Get the minimum amount of character/numerical values. * @param min */ public int getMin() { return min; } /** * Set the minimum amount of character/numerical values. * @param min */ public void setMin(int min) { this.min = min; } /** * Get the maximum amount of character/numerical values. * @param max */ public int getMax() { return max; } /** * Set the maximum amount of character/numerical values. * @param max */ public void setMax(int max) { this.max = max; } /** * Get the text to be displayed in the dialog box. * @param text */ public String getText() { return text; } /** * Set the text to be displayed in the dialog box. * @param text */ public void setText(String text) { this.text = text; } /** * Add text to the current text string. * @param text */ public void addText(String text) { this.text += text; } /** * Get the default text to be displayed in the dialog box. * @param def */ public String getDef() { return def; } /** * Set the default text to be displayed in the dialog box. * @param def */ public void setDef(String def) { this.def = def; } /** * Get the hint. * @param hint */ public String getHint() { return hint; } /** * Set the hint. * @param hint */ public void setHint(String hint) { this.hint = hint; } /** * Get the status of the previous button. * @param prev */ public boolean getPrev() { return prev; } /** * Toggle the status of the previous button. * @param prev */ public void setPrev(boolean prev) { this.prev = prev; } /** * Get the status of the next button. * @param next */ public boolean getNext() { return next; } /** * Toggle the status of the next button. * @param next */ public void setNext(boolean next) { this.next = next; } /** * Get the list of objects. * @param args */ public Object[] getArgs() { return args; } /** * Set the list of objects. * @param args */ public void setArgs(Object... args) { this.args = args; } }
UTF-8
Java
4,323
java
NPCTalk.java
Java
[ { "context": "/**\n * @author Maxcloud\n * \n */\n\npackage script.npc;\n\npublic class NPCTal", "end": 23, "score": 0.9548287391662598, "start": 15, "tag": "USERNAME", "value": "Maxcloud" } ]
null
[]
/** * @author Maxcloud * */ package script.npc; public class NPCTalk { private byte type, msg, param, color; private int npcid, npcidd, seconds, amount, min, max; private boolean prev, next; private String text, def, hint; private Object[] args; public NPCTalk(byte type, int npcid, byte msg) { this(type, npcid, msg, (byte) 0, (byte) 0); } public NPCTalk(byte type, int npcid, byte msg, byte param, byte color) { this.type = type; this.npcid = npcid; this.msg = msg; this.param = param; this.color = color; } /** * Get the type. * @return */ public byte getType() { return type; } /** * Set the type. * @param type */ public void setType(byte type) { this.type = type; } /** * Get the message modifier. * @return */ public byte getMsg() { return msg; } /** * Set the message modifier. * @param msg */ public void setMsg(byte msg) { this.msg = msg; } /** * Get the parameter. * @return */ public byte getParam() { return param; } /** * Set the parameter. * @param param */ public void setParam(byte param) { this.param = param; } /** * Get the color type. * @return */ public byte getColor() { return color; } /** * Set the color of the dialog box. * @param color */ public void setColor(byte color) { this.color = color; } /** * Get the NPC ID. * @return */ public int getNpcID() { return npcid; } /** * Set the NPC ID. * @param npcid */ public void setNpcID(int npcid) { this.npcid = npcid; } /** * Get the second NPC ID * @return */ public int getNpcIDD() { return npcidd; } /** * Set the second NPC ID * @param npcidd */ public void setNpcIDD(int npcidd) { this.npcidd = npcidd; } /** * Get the amount of seconds to wait. * @return */ public int getSeconds() { return seconds; } /** * Set the amount of seconds to wait. * @param wait */ public void setSeconds(int seconds) { this.seconds = seconds; } /** * Get the amount. * @return */ public int getAmount() { return amount; } /** * Set the amount. * @param wait */ public void setAmount(int amount) { this.amount = amount; } /** * Get the minimum amount of character/numerical values. * @param min */ public int getMin() { return min; } /** * Set the minimum amount of character/numerical values. * @param min */ public void setMin(int min) { this.min = min; } /** * Get the maximum amount of character/numerical values. * @param max */ public int getMax() { return max; } /** * Set the maximum amount of character/numerical values. * @param max */ public void setMax(int max) { this.max = max; } /** * Get the text to be displayed in the dialog box. * @param text */ public String getText() { return text; } /** * Set the text to be displayed in the dialog box. * @param text */ public void setText(String text) { this.text = text; } /** * Add text to the current text string. * @param text */ public void addText(String text) { this.text += text; } /** * Get the default text to be displayed in the dialog box. * @param def */ public String getDef() { return def; } /** * Set the default text to be displayed in the dialog box. * @param def */ public void setDef(String def) { this.def = def; } /** * Get the hint. * @param hint */ public String getHint() { return hint; } /** * Set the hint. * @param hint */ public void setHint(String hint) { this.hint = hint; } /** * Get the status of the previous button. * @param prev */ public boolean getPrev() { return prev; } /** * Toggle the status of the previous button. * @param prev */ public void setPrev(boolean prev) { this.prev = prev; } /** * Get the status of the next button. * @param next */ public boolean getNext() { return next; } /** * Toggle the status of the next button. * @param next */ public void setNext(boolean next) { this.next = next; } /** * Get the list of objects. * @param args */ public Object[] getArgs() { return args; } /** * Set the list of objects. * @param args */ public void setArgs(Object... args) { this.args = args; } }
4,323
0.592644
0.592181
291
13.85567
14.168347
73
false
false
0
0
0
0
0
0
1.319588
false
false
9