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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
29791511ad6a1f1d5c1589f789f729c802a488c5 | 12,386,685,694,637 | 860794735fe561dee62eb91ad239e6346ad9bb4e | /components/common/test/loci/common/utests/providers/IRandomAccessProviderFactory.java | a45de2d7e3ad4075bb5ed9a1b8c165f223aed3cb | []
| no_license | mhl/libbio-formats-java | https://github.com/mhl/libbio-formats-java | 30de58c312480420169926742c88f19483f362f0 | 2dfc50e24babd86fac30d503472d0a86e62abc60 | refs/heads/master | 2021-01-10T19:09:35.621000 | 2012-01-07T11:13:19 | 2012-01-07T11:13:19 | 3,123,938 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | //
// IRandomAccessProviderFactory.java
//
/*
LOCI Common package: utilities for I/O, reflection and miscellaneous tasks.
Copyright (C) 2005-@year@ Melissa Linkert and Curtis Rueden.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package loci.common.utests.providers;
import java.util.HashMap;
import java.util.Map;
/**
* Factory for providing instances of IRandomAccessProvider.
*
* <dl><dt><b>Source code:</b></dt>
* <dd><a href="http://trac.openmicroscopy.org.uk/ome/browser/bioformats.git/components/common/test/loci/common/utests/providers/IRandomAccessProviderFactory.java">Trac</a>,
* <a href="http://git.openmicroscopy.org/?p=bioformats.git;a=blob;f=components/common/test/loci/common/utests/providers/IRandomAccessProviderFactory.java;hb=HEAD">Gitweb</a></dd></dl>
*
* @see IRandomAccessProvider
*/
public class IRandomAccessProviderFactory {
private static final Map<String, IRandomAccessProvider> providers =
new HashMap<String, IRandomAccessProvider>();
static {
providers.put("NewByteArrayHandle", new NewByteArrayHandleProvider());
providers.put("ExistingByteArrayHandle",
new ExistingByteArrayHandleProvider());
providers.put("ByteArrayHandle", new ByteArrayHandleProvider());
providers.put("BZip2Handle", new BZip2HandleProvider());
providers.put("GZipHandle", new GZipHandleProvider());
providers.put("NIOFileHandle", new NIOFileHandleProvider());
providers.put("URLHandle", new URLHandleProvider());
providers.put("ZipHandle", new ZipHandleProvider());
}
public IRandomAccessProvider getInstance(String provider) {
return providers.get(provider);
}
}
| UTF-8 | Java | 2,274 | java | IRandomAccessProviderFactory.java | Java | [
{
"context": "and miscellaneous tasks.\nCopyright (C) 2005-@year@ Melissa Linkert and Curtis Rueden.\n\nThis program is free software",
"end": 164,
"score": 0.9998594522476196,
"start": 149,
"tag": "NAME",
"value": "Melissa Linkert"
},
{
"context": "sks.\nCopyright (C) 2005-@year@ Melissa Linkert and Curtis Rueden.\n\nThis program is free software; you can redistri",
"end": 182,
"score": 0.9998584985733032,
"start": 169,
"tag": "NAME",
"value": "Curtis Rueden"
}
]
| null | []
| //
// IRandomAccessProviderFactory.java
//
/*
LOCI Common package: utilities for I/O, reflection and miscellaneous tasks.
Copyright (C) 2005-@year@ <NAME> and <NAME>.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package loci.common.utests.providers;
import java.util.HashMap;
import java.util.Map;
/**
* Factory for providing instances of IRandomAccessProvider.
*
* <dl><dt><b>Source code:</b></dt>
* <dd><a href="http://trac.openmicroscopy.org.uk/ome/browser/bioformats.git/components/common/test/loci/common/utests/providers/IRandomAccessProviderFactory.java">Trac</a>,
* <a href="http://git.openmicroscopy.org/?p=bioformats.git;a=blob;f=components/common/test/loci/common/utests/providers/IRandomAccessProviderFactory.java;hb=HEAD">Gitweb</a></dd></dl>
*
* @see IRandomAccessProvider
*/
public class IRandomAccessProviderFactory {
private static final Map<String, IRandomAccessProvider> providers =
new HashMap<String, IRandomAccessProvider>();
static {
providers.put("NewByteArrayHandle", new NewByteArrayHandleProvider());
providers.put("ExistingByteArrayHandle",
new ExistingByteArrayHandleProvider());
providers.put("ByteArrayHandle", new ByteArrayHandleProvider());
providers.put("BZip2Handle", new BZip2HandleProvider());
providers.put("GZipHandle", new GZipHandleProvider());
providers.put("NIOFileHandle", new NIOFileHandleProvider());
providers.put("URLHandle", new URLHandleProvider());
providers.put("ZipHandle", new ZipHandleProvider());
}
public IRandomAccessProvider getInstance(String provider) {
return providers.get(provider);
}
}
| 2,258 | 0.765611 | 0.756376 | 59 | 37.542374 | 38.171036 | 184 | false | false | 0 | 0 | 0 | 0 | 84 | 0.072999 | 0.677966 | false | false | 4 |
bf73be05ef1a588911223af26794dc0379011be3 | 29,205,777,631,173 | c662422c4778f405ab0c162b946326298609d452 | /HelloMart/src/main/java/com/hellomart/util/TodayViewUtils.java | a14d8732cacfbd3833a7239172ae89f0f47777d5 | []
| no_license | oJJW111/HelloMart | https://github.com/oJJW111/HelloMart | 2db65c75bfb022d6bf6fefbff2573b7d993086c6 | 17b4ee4ace295751447cd55419a2724cb4df818a | refs/heads/master | 2020-03-19T06:02:11.120000 | 2018-07-19T06:26:12 | 2018-07-19T06:26:12 | 135,985,067 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.hellomart.util;
import java.util.Vector;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class TodayViewUtils {
public static final String KEYWORD = "TodayView";
public static final int ONEDAY = 60*60*24;
private CookieUtils cookieUtils;
public TodayViewUtils(HttpServletRequest request, HttpServletResponse response) {
cookieUtils = new CookieUtils(request, response);
}
public void addTodayView(String no) {
cookieUtils.creatCookie(KEYWORD + no, no, ONEDAY);
}
public Vector<String> getAllValue() {
return cookieUtils.getAllValueWithKeyWord(KEYWORD);
}
public Vector<String> getAllValue(int size) {
int over = cookieUtils.length(KEYWORD) - size;
if(over > 0) {
cookieUtils.remove(over, KEYWORD);
}
return cookieUtils.getAllValueWithKeyWord(KEYWORD);
}
}
| UTF-8 | Java | 899 | java | TodayViewUtils.java | Java | []
| null | []
| package com.hellomart.util;
import java.util.Vector;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class TodayViewUtils {
public static final String KEYWORD = "TodayView";
public static final int ONEDAY = 60*60*24;
private CookieUtils cookieUtils;
public TodayViewUtils(HttpServletRequest request, HttpServletResponse response) {
cookieUtils = new CookieUtils(request, response);
}
public void addTodayView(String no) {
cookieUtils.creatCookie(KEYWORD + no, no, ONEDAY);
}
public Vector<String> getAllValue() {
return cookieUtils.getAllValueWithKeyWord(KEYWORD);
}
public Vector<String> getAllValue(int size) {
int over = cookieUtils.length(KEYWORD) - size;
if(over > 0) {
cookieUtils.remove(over, KEYWORD);
}
return cookieUtils.getAllValueWithKeyWord(KEYWORD);
}
}
| 899 | 0.730812 | 0.723026 | 35 | 23.685715 | 23.115574 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.485714 | false | false | 4 |
01421ae87435b4955bde03f5fd16076bdccfc01f | 27,582,279,984,162 | 20ea66ea07654902c58541a57ece2b21cffe0d62 | /src/com/uniqgroup/application/DailyAlarmReceiver.java | bab7bf02b807e73b545b25c87873010fabce8d7c | []
| no_license | durdanto-rafi/CalendarApp | https://github.com/durdanto-rafi/CalendarApp | 11a64279e5729a43ebf9a225163871725f2bd3ac | 407d27ecd10ebb4db4228147e585b8affbaef511 | refs/heads/master | 2021-05-04T11:26:22.883000 | 2016-02-29T05:01:39 | 2016-02-29T05:01:39 | 48,940,317 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.uniqgroup.application;
import com.uniqgroup.utility.CalendarViews;
import android.app.KeyguardManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.media.Ringtone;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.widget.Toast;
public class DailyAlarmReceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent)
{
/*playRingtone(context);
unlockScreen(context);
powerUpDevice(context);*/
//Toast.makeText(context, String.valueOf(intent.getIntExtra("userId",-1)),Toast.LENGTH_SHORT).show();
Intent in = new Intent(context, AlarmActivity.class);
in.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
in.putExtra("event_id", intent.getIntExtra("eventId", -1));
in.putExtra("user_id", intent.getIntExtra("userId", -1));
in.putExtra("imagePath", intent.getExtras().getString("imagePath"));
in.putExtra("returnView", CalendarViews.dayView);
in.putExtra("flag", "Update");
in.putExtra("returnPath", "com.uniqgroup.application.AlarmActivity");
context.startActivity(in);
/*i.setClassName("com.test", "com.test.MainActivity");
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);*/
}
private void playRingtone(Context context)
{
Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM);
Ringtone r = RingtoneManager.getRingtone(context.getApplicationContext(), notification);
r.play();
}
private void unlockScreen(Context context)
{
KeyguardManager km = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
final KeyguardManager.KeyguardLock kl = km .newKeyguardLock("MyKeyguardLock");
kl.disableKeyguard();
}
private void powerUpDevice(Context context)
{
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
WakeLock wakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK
| PowerManager.ACQUIRE_CAUSES_WAKEUP
| PowerManager.ON_AFTER_RELEASE, "MyWakeLock");
wakeLock.acquire();
}
}
| UTF-8 | Java | 2,206 | java | DailyAlarmReceiver.java | Java | []
| null | []
| package com.uniqgroup.application;
import com.uniqgroup.utility.CalendarViews;
import android.app.KeyguardManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.media.Ringtone;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.widget.Toast;
public class DailyAlarmReceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent)
{
/*playRingtone(context);
unlockScreen(context);
powerUpDevice(context);*/
//Toast.makeText(context, String.valueOf(intent.getIntExtra("userId",-1)),Toast.LENGTH_SHORT).show();
Intent in = new Intent(context, AlarmActivity.class);
in.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
in.putExtra("event_id", intent.getIntExtra("eventId", -1));
in.putExtra("user_id", intent.getIntExtra("userId", -1));
in.putExtra("imagePath", intent.getExtras().getString("imagePath"));
in.putExtra("returnView", CalendarViews.dayView);
in.putExtra("flag", "Update");
in.putExtra("returnPath", "com.uniqgroup.application.AlarmActivity");
context.startActivity(in);
/*i.setClassName("com.test", "com.test.MainActivity");
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);*/
}
private void playRingtone(Context context)
{
Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM);
Ringtone r = RingtoneManager.getRingtone(context.getApplicationContext(), notification);
r.play();
}
private void unlockScreen(Context context)
{
KeyguardManager km = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
final KeyguardManager.KeyguardLock kl = km .newKeyguardLock("MyKeyguardLock");
kl.disableKeyguard();
}
private void powerUpDevice(Context context)
{
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
WakeLock wakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK
| PowerManager.ACQUIRE_CAUSES_WAKEUP
| PowerManager.ON_AFTER_RELEASE, "MyWakeLock");
wakeLock.acquire();
}
}
| 2,206 | 0.742067 | 0.740707 | 64 | 33.46875 | 28.786373 | 103 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.96875 | false | false | 4 |
b2211c998aa684735ddbb8efa1291f51b37e39f5 | 18,030,272,721,213 | cb6b6425b6febd1b159027be16d98e95bb640a35 | /my_project/src/main/java/uni/system/webapp/security/BlockController.java | 7a2b80bd40441263629a6c585b706a89d9394730 | []
| no_license | JemCairns/UNI_SYSTEM | https://github.com/JemCairns/UNI_SYSTEM | 5074fbc8171e31b8f150a2502f6b5324e7f749f4 | 26d5a579af99ff5204bd8310e4b049f895ab72c5 | refs/heads/master | 2022-07-12T15:24:34.869000 | 2020-05-15T16:36:13 | 2020-05-15T16:36:13 | 238,929,761 | 0 | 0 | null | false | 2020-05-06T15:42:31 | 2020-02-07T13:27:09 | 2020-03-09T17:08:18 | 2020-05-06T14:07:10 | 305 | 0 | 0 | 0 | Java | false | false | package uni.system.webapp.security;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
@Controller
@RequestMapping(value = "/block")
public class BlockController {
@GetMapping()
public String showBlockPage() {
return "block";
}
} | UTF-8 | Java | 341 | java | BlockController.java | Java | []
| null | []
| package uni.system.webapp.security;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
@Controller
@RequestMapping(value = "/block")
public class BlockController {
@GetMapping()
public String showBlockPage() {
return "block";
}
} | 341 | 0.747801 | 0.747801 | 15 | 21.799999 | 17.508856 | 49 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false | 4 |
011b8a13dcfa1ee92379c01b1890eb1c700ae540 | 26,792,006,004,639 | 84867ab274c394ff029934f72f55c93e2a233fd3 | /sample-target-microservices/sample-target-system-ls3/spring-boot-microservice-patient-service/src/main/java/com/springboot/microservice/example/patient/EngineCommunication.java | 21ca624bd8ec01b7ef7ab0e5bf295391c72f4035 | []
| no_license | sepehram/logging-microservices | https://github.com/sepehram/logging-microservices | 97118c669f706316dea5d0b022c61dc08bfa2187 | fce47eff2d85a311b3ca5ad5e143509813730194 | refs/heads/master | 2022-11-14T10:04:19.818000 | 2020-06-27T20:47:42 | 2020-06-27T20:47:42 | 261,939,869 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.springboot.microservice.example.patient;
import java.util.ArrayList;
import com.declarativa.interprolog.SWISubprocessEngine;
public class EngineCommunication implements Runnable{
private String G;
private String T;
private String GG;
private Object[] solutions = new Object [100];
private static SWISubprocessEngine engine;
private String queryResult;
private int assertionCount = 0;
public EngineCommunication() {
engine = new SWISubprocessEngine("/usr/bin");
new Thread(this, "EngineT").start();
}
public void turnOff() {
engine.shutdown();
}
public void run() {
}
public int query(String queryMsg, String queryResponseFormat)
throws Throwable{
setGoal(queryMsg, queryResponseFormat);
return resolve();
}
public void addFact(String assertion) {
engine.command(assertion);
updateAssertionCount(assertion);
}
public String getQueryResult() {
return queryResult;
}
private int resolve() throws Throwable{
solutions = (Object[]) engine.deterministicGoal(GG,"[LM]")[0];
ArrayList<Object> solutionList = new ArrayList<Object>();
String queryResult = "Solution length: " + solutions.length
+ ".\n\n";
for(int i=0; i < solutions.length; i++) {
if (!solutionList.contains(solutions[i])) {
solutionList.add(solutions[i]);
queryResult += "(" + solutions[i] + ")\n\n";
}
}
this.queryResult = queryResult;
return solutions.length;
}
private void updateAssertionCount(String assertion) {
if (assertion.startsWith("assert")) {
assertionCount++;
}
if (assertion.startsWith("retract")) {
assertionCount--;
}
return;
}
public int getAssertionCount(){
return assertionCount;
}
private void setGoal(String goal, String queryResponseFormat) {
this.G = goal;
this.T = queryResponseFormat;
this.GG = "findall(TM, ("+G+",buildTermModel("+T+",TM)), L), "
+ "ipObjectSpec('ArrayOfObject',L,LM)";
return;
}
}
| UTF-8 | Java | 1,949 | java | EngineCommunication.java | Java | []
| null | []
| package com.springboot.microservice.example.patient;
import java.util.ArrayList;
import com.declarativa.interprolog.SWISubprocessEngine;
public class EngineCommunication implements Runnable{
private String G;
private String T;
private String GG;
private Object[] solutions = new Object [100];
private static SWISubprocessEngine engine;
private String queryResult;
private int assertionCount = 0;
public EngineCommunication() {
engine = new SWISubprocessEngine("/usr/bin");
new Thread(this, "EngineT").start();
}
public void turnOff() {
engine.shutdown();
}
public void run() {
}
public int query(String queryMsg, String queryResponseFormat)
throws Throwable{
setGoal(queryMsg, queryResponseFormat);
return resolve();
}
public void addFact(String assertion) {
engine.command(assertion);
updateAssertionCount(assertion);
}
public String getQueryResult() {
return queryResult;
}
private int resolve() throws Throwable{
solutions = (Object[]) engine.deterministicGoal(GG,"[LM]")[0];
ArrayList<Object> solutionList = new ArrayList<Object>();
String queryResult = "Solution length: " + solutions.length
+ ".\n\n";
for(int i=0; i < solutions.length; i++) {
if (!solutionList.contains(solutions[i])) {
solutionList.add(solutions[i]);
queryResult += "(" + solutions[i] + ")\n\n";
}
}
this.queryResult = queryResult;
return solutions.length;
}
private void updateAssertionCount(String assertion) {
if (assertion.startsWith("assert")) {
assertionCount++;
}
if (assertion.startsWith("retract")) {
assertionCount--;
}
return;
}
public int getAssertionCount(){
return assertionCount;
}
private void setGoal(String goal, String queryResponseFormat) {
this.G = goal;
this.T = queryResponseFormat;
this.GG = "findall(TM, ("+G+",buildTermModel("+T+",TM)), L), "
+ "ipObjectSpec('ArrayOfObject',L,LM)";
return;
}
}
| 1,949 | 0.695228 | 0.69215 | 86 | 21.651163 | 20.472765 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.965116 | false | false | 4 |
cd13e039fb8855aec6453646c46ba6e8a403fae8 | 23,210,003,280,696 | 6a1bb1647745a4a4c6ca17acff37867b1e4224f9 | /java/Test/src/Community/license.java | 00d8dd399104525948693fb561af845128d3cb12 | []
| no_license | ByunSoYun/backup | https://github.com/ByunSoYun/backup | ffaecc818920af3b5e5a88d99b00ef23f12ce525 | 1ebf8c7fb292a2350a5e371ce203e4e38925f0e5 | refs/heads/main | 2023-07-03T23:25:55.966000 | 2021-08-11T00:12:11 | 2021-08-11T00:12:11 | 376,705,035 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Community;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.util.Random;
public class license {
public static void main(String[] args) {
Random rnd = new Random();
String[] title = {
"2021 정보처리기사 1회 시험 정보",
"2021 정보처리기사 2회 시험 정보",
"2021 정보처리기사 3회 시험 정보",
"2021 정보보안기사 1회 시험 정보",
"2021 정보보안기사 2회 시험 정보",
"2021 리눅스마스터 1급 2101회 시험 정보",
"2021 리눅스마스터 1급 2102회 시험 정보",
"2021 리눅스마스터 2급 2101회 시험 정보",
"2021 리눅스마스터 2급 2102회 시험 정보",
"2021 리눅스마스터 2급 2103회 시험 정보",
"2021 리눅스마스터 2급 2104회 시험 정보",
"2021 빅데이터 분석 기사 2회 시험정보",
"2021 빅데이터 분석 기사 3회 시험정보"
};
String[] regdate = {
"2021-07-01",
"2021-07-02",
"2021-07-03",
"2021-07-04",
"2021-07-05",
"2021-07-06",
"2021-07-07",
"2021-07-08",
"2021-07-09",
"2021-07-10",
"2021-07-11",
"2021-07-12",
"2021-07-13",
"2021-07-14",
"2021-07-15",
"2021-07-16",
"2021-07-17",
"2021-07-18",
"2021-07-19",
"2021-07-20",
"2021-07-21",
"2021-07-22",
"2021-07-23",
"2021-07-24"
};
String[] content = {
"2021 정보처리기사 1회 시험 정보 \r\n"
+ "\r\n"
+ "필기원서접수(인터넷)(휴일제외) 2021.01.25.(월) ~ 2021.01.28.(목) \r\n"
+ "\r\n"
+ "필기시험 2021.03.07.(일)\r\n"
+ "\r\n"
+ "필기합격(예정자)발표 2021.03.19.(금)\r\n"
+ "\r\n"
+ "응시자격 서류 제출 2021.03.08.(월) ~ 2021.03.30.(화) \r\n"
+ "\r\n"
+ "실기원서접수(휴일제외) 2021.03.31.(수) ~ 2021.04.05.(월) \r\n"
+ "\r\n"
+ "실기시험 2021.04.24.(토) ~ 2021.05.07.(금) \r\n"
+ "\r\n"
+ "최종합격자 발표일 2021.05.21.(금) ~ 2021.07.21.(수) \r\n"
+ "\r\n"
+ "\r\n"
+ "정보처리기사 기본 정보 \r\n"
+ "\r\n"
+ "1. 개요\r\n"
+ "\r\n"
+ " - 컴퓨터를 효과적으로 활용하기 위해서 하드웨어뿐만 아니라 정교한 소프트웨어가 필요하다. 이에 따라 우수한 프로그램을 개발하여 업무의 효율성을 높이고, 궁극적으로 국가발전에 이바지하기 위해서 컴퓨터에 관한 전문적인 지식과 기술을 갖춘 사람을 양성할 목적으로 제정됨.\r\n"
+ "\r\n"
+ "실시기관 홈페이지\r\n"
+ "\r\n"
+ "2. 실시기관 홈페이지\r\n"
+ " - http://www.q-net.or.kr\r\n"
+ "\r\n"
+ "3. 진로 및 전망\r\n"
+ "\r\n"
+ " - 기업체 전산실, 소프트웨어 개발업체, SI(system integrated)업체(정보통신, 시스템 구축회사 등), 정부기관, 언론기관, 교육 및 연구기관, 금융기관, 보험업, 병원 등 컴퓨터 시스템을 개발 및 운용하거나, 데이터 통신을 이용하여 정보처리를 시행하는 업체에서 활동하고 있다. 품질검사 전문기관 기술인력과 감리원 자격을 취득하여 감리 전문회사의 감리원으로 진출할 수 있다.\r\n"
+ "\r\n"
+ " - 정보화사회로 이행함에 따라 지식과 정보의 양이 증대되어 작업량과 업무량이 급속하게 증가했다. 또한 각종 업무의 전산화 요구가 더욱 증대되어 사회 전문분야로 컴퓨터 사용이 보편화되면서 컴퓨터산업은 급속도로 확대되었다. 컴퓨터산업의 확대는 곧 이 분야의 전문인력에 대한 수요 증가로 이어졌다.",
"2021 정보처리기사 2회 시험 정보 \r\n"
+ "\r\n"
+ "필기원서접수(인터넷)(휴일제외) 2021.04.12.(월) ~ 2021.04.15.(목)\r\n"
+ "\r\n"
+ "필기시험 2021.05.15.(토)\r\n"
+ "\r\n"
+ "필기합격(예정자)발표 2021.06.02.(수)\r\n"
+ "\r\n"
+ "응시자격 서류 제출 2021.05.17.(월) ~ 2021.06.11.(금)\r\n"
+ "\r\n"
+ "실기원서접수(휴일제외) 2021.06.14.(월) ~ 2021.06.17.(목)\r\n"
+ "\r\n"
+ "실기시험 2021.07.10.(토) ~ 2021.07.24.(토) \r\n"
+ "\r\n"
+ "최종합격자 발표일 2021.08.06.(금) ~ 2021.10.06.(수)\r\n"
+ "\r\n"
+ "\r\n"
+ "정보처리기사 기본 정보 \r\n"
+ "\r\n"
+ "1. 개요\r\n"
+ "\r\n"
+ " - 컴퓨터를 효과적으로 활용하기 위해서 하드웨어뿐만 아니라 정교한 소프트웨어가 필요하다. 이에 따라 우수한 프로그램을 개발하여 업무의 효율성을 높이고, 궁극적으로 국가발전에 이바지하기 위해서 컴퓨터에 관한 전문적인 지식과 기술을 갖춘 사람을 양성할 목적으로 제정됨.\r\n"
+ "\r\n"
+ "실시기관 홈페이지\r\n"
+ "\r\n"
+ "2. 실시기관 홈페이지\r\n"
+ " - http://www.q-net.or.kr\r\n"
+ "\r\n"
+ "3. 진로 및 전망\r\n"
+ "\r\n"
+ " - 기업체 전산실, 소프트웨어 개발업체, SI(system integrated)업체(정보통신, 시스템 구축회사 등), 정부기관, 언론기관, 교육 및 연구기관, 금융기관, 보험업, 병원 등 컴퓨터 시스템을 개발 및 운용하거나, 데이터 통신을 이용하여 정보처리를 시행하는 업체에서 활동하고 있다. 품질검사 전문기관 기술인력과 감리원 자격을 취득하여 감리 전문회사의 감리원으로 진출할 수 있다.\r\n"
+ "\r\n"
+ " - 정보화사회로 이행함에 따라 지식과 정보의 양이 증대되어 작업량과 업무량이 급속하게 증가했다. 또한 각종 업무의 전산화 요구가 더욱 증대되어 사회 전문분야로 컴퓨터 사용이 보편화되면서 컴퓨터산업은 급속도로 확대되었다. 컴퓨터산업의 확대는 곧 이 분야의 전문인력에 대한 수요 증가로 이어졌다.",
"2021 정보처리기사 3회 시험 정보 \r\n"
+ "\r\n"
+ "필기원서접수(인터넷)(휴일제외) 2021.07.12.(월) ~ 2021.07.15.(목) \r\n"
+ "\r\n"
+ "필기시험 2021.08.14.(토) \r\n"
+ "\r\n"
+ "필기합격(예정자)발표 2021.09.01.(수) \r\n"
+ "\r\n"
+ "응시자격 서류 제출 2021.08.16.(월) ~ 2021.09.10.(금) \r\n"
+ "\r\n"
+ "실기원서접수(휴일제외) 2021.09.13.(월) ~ 2021.09.16.(목) \r\n"
+ "\r\n"
+ "실기시험 2021.10.16.(토) ~ 2021.10.29.(금) \r\n"
+ "\r\n"
+ "최종합격자 발표일 2021.11.12.(금) ~ 2022.01.12.(수) \r\n"
+ "\r\n"
+ "\r\n"
+ "정보처리기사 기본 정보 \r\n"
+ "\r\n"
+ "1. 개요\r\n"
+ "\r\n"
+ " - 컴퓨터를 효과적으로 활용하기 위해서 하드웨어뿐만 아니라 정교한 소프트웨어가 필요하다. 이에 따라 우수한 프로그램을 개발하여 업무의 효율성을 높이고, 궁극적으로 국가발전에 이바지하기 위해서 컴퓨터에 관한 전문적인 지식과 기술을 갖춘 사람을 양성할 목적으로 제정됨.\r\n"
+ "\r\n"
+ "실시기관 홈페이지\r\n"
+ "\r\n"
+ "2. 실시기관 홈페이지\r\n"
+ " - http://www.q-net.or.kr\r\n"
+ "\r\n"
+ "3. 진로 및 전망\r\n"
+ "\r\n"
+ " - 기업체 전산실, 소프트웨어 개발업체, SI(system integrated)업체(정보통신, 시스템 구축회사 등), 정부기관, 언론기관, 교육 및 연구기관, 금융기관, 보험업, 병원 등 컴퓨터 시스템을 개발 및 운용하거나, 데이터 통신을 이용하여 정보처리를 시행하는 업체에서 활동하고 있다. 품질검사 전문기관 기술인력과 감리원 자격을 취득하여 감리 전문회사의 감리원으로 진출할 수 있다.\r\n"
+ "\r\n"
+ " - 정보화사회로 이행함에 따라 지식과 정보의 양이 증대되어 작업량과 업무량이 급속하게 증가했다. 또한 각종 업무의 전산화 요구가 더욱 증대되어 사회 전문분야로 컴퓨터 사용이 보편화되면서 컴퓨터산업은 급속도로 확대되었다. 컴퓨터산업의 확대는 곧 이 분야의 전문인력에 대한 수요 증가로 이어졌다.",
"2021 정보보안기사 시험일정 \r\n"
+ "\r\n"
+ "회별 : 제 17회(2021년도 1회)\r\n"
+ "\r\n"
+ "필기시험 원서접수 : 2021.02.22 ~ 2021.02.26\r\n"
+ "\r\n"
+ "필기시험 : 2021.03.27 \r\n"
+ "\r\n"
+ "필기합격 예정발표 : 2021.04.09\r\n"
+ "\r\n"
+ "응시자격 서류 제출 : 2021.04.12 ~ 2021.04.16\r\n"
+ "\r\n"
+ "실기시험 원서접수 :2021.04.12 ~ 2021.04.16\r\n"
+ "\r\n"
+ "실기시험 : 2021.05.29\r\n"
+ "\r\n"
+ "합격자 발표 : 2021.06.25 \r\n"
+ "\r\n"
+ "\r\n"
+ "자격검정안내\r\n"
+ "\r\n"
+ "1. 검정 형태 : 정기검정 \r\n"
+ "2. 검정 종목 : 정보보안기사, 정보보안산업기사 \r\n"
+ "3. 검정 지역: 전국 5개 지역 (서울,부산,대전,대구,광주) 수검장* 당회 시험 접수인원이 현저히 적은 경우 시행지역 축소 조정\r\n"
+ "4. 수행직무 \r\n"
+ "- 정보보안기사 : 시스템 및 솔루션 개발, 운영 및 관리, 컨설팅 등의 전문 이론과 실무능력을 기반으로 IT 기반시설 및 정보에 대한 체계적인 보안업무 수행\r\n"
+ "- 정보보안산업기사 : 정보보안 기사의 업무를 보조할 수 있는 기초 이론과 실무 능력 수행",
"2021 정보보안기사 시험일정 \r\n"
+ "\r\n"
+ "회별 : 제 17회(2021년도 1회)\r\n"
+ "\r\n"
+ "필기시험 원서접수 : 2021.08.02 ~ 2021.08.06\r\n"
+ "\r\n"
+ "필기시험 : 2021.09.04\r\n"
+ "\r\n"
+ "필기합격 예정발표 : 2021.09.24\r\n"
+ "\r\n"
+ "응시자격 서류 제출 : 2021.09.27 ~ 2021.10.01\r\n"
+ "\r\n"
+ "실기시험 원서접수 : 2021.09.27 ~ 2021.10.01\r\n"
+ "\r\n"
+ "실기시험 : 2021.10.30\r\n"
+ "\r\n"
+ "합격자 발표 : 2021.11.26 \r\n"
+ "\r\n"
+ "\r\n"
+ "자격검정안내\r\n"
+ "\r\n"
+ "1. 검정 형태 : 정기검정 \r\n"
+ "2. 검정 종목 : 정보보안기사, 정보보안산업기사 \r\n"
+ "3. 검정 지역: 전국 5개 지역 (서울,부산,대전,대구,광주) 수검장* 당회 시험 접수인원이 현저히 적은 경우 시행지역 축소 조정\r\n"
+ "4. 수행직무 \r\n"
+ "- 정보보안기사 : 시스템 및 솔루션 개발, 운영 및 관리, 컨설팅 등의 전문 이론과 실무능력을 기반으로 IT 기반시설 및 정보에 대한 체계적인 보안업무 수행\r\n"
+ "- 정보보안산업기사 : 정보보안 기사의 업무를 보조할 수 있는 기초 이론과 실무 능력 수행",
"2021 리눅스마스터 1급 2101회 시험 정보\r\n"
+ "\r\n"
+ "리눅스 마스터 1급 \r\n"
+ "\r\n"
+ " 2101회차 1차 \r\n"
+ "\r\n"
+ " - 접수일자 : 2021.01.26(화) ~ 2021.02.05(금)\r\n"
+ " - 시험일자 : 2021.03.13(토)\r\n"
+ " - 합격자 발표 : 2021.04.02(금)\r\n"
+ "\r\n"
+ " 2101회 2차 \r\n"
+ "\r\n"
+ " - 접수일자 : 2021.07.26(월) ~ 2021.08.06(금)\r\n"
+ " - 시험일자 : 2021.05.08(토)\r\n"
+ " - 합격자 발표 : 2021.05.28(금)\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "리눅스마스터 종목 소개\r\n"
+ " \r\n"
+ "1. 리눅스마스터\r\n"
+ "리눅스로 운영되는 전세계 80%이상의 스마트폰, 70%이상의 클라우드 서버, 세계 상위의 500대 슈퍼컴퓨터를 비롯해서 5세대 이동통신(5G), 사물인터넷(IoT), 드론, 자율주행차 등 미래성장동력 분야에서 다양한 응용기반기술에 토대가 되는 자격종목\r\n"
+ "리눅스 기반 시스템의 관리능력을 평가하는 1급 자격과 리눅스 운영시스템의 프로그램 사용능력을 평가하는 2급 자격으로 구분\r\n"
+ "리눅스마스터 1, 2급은 NCS(국가직무능력표준) 등을 바탕으로 SW기술자의 체계적 역량 가이드라인 ITSQF(IT분야역량체계)의 IT시스템관리자(L5, L3)로 인정\r\n"
+ "\r\n"
+ "2. 필요성\r\n"
+ "리눅스 시스템 관리자에게 요구되는 리눅스 OS의 기본 지식 및 리눅스 기반의 서버 ·네트워크 관리 실무능력 인증\r\n"
+ "리눅스 기반의 Desktop 활용 및 서버운영, 시스템의 설계개발 및 관리, 네트워크 구축 및 서비스 운영 등\r\n"
+ "\r\n"
+ "3. 자격종류\r\n"
+ "자격구분 : 공인민간자격\r\n"
+ "등록번호 : 2008-0268\r\n"
+ "공인번호 : 과학기술정보통신부 제2018-10호",
"2021 리눅스마스터 1급 2102회 시험 정보\r\n"
+ "\r\n"
+ "리눅스 마스터 1급 \r\n"
+ "\r\n"
+ " 2102회차 1차 \r\n"
+ "\r\n"
+ " - 접수일자 : 2021.07.26.(월) ~ 2021.08.06.(금)\r\n"
+ " - 시험일자 : 2021.09.11.(토)\r\n"
+ " - 합격자 발표 : 2021.10.01.(금)\r\n"
+ "\r\n"
+ " 2102회 2차 \r\n"
+ "\r\n"
+ " - 접수일자 : 2021.10.04.(월) ~ 2021.10.15.(금)\r\n"
+ " - 시험일자 : 2021.11.13.(토)\r\n"
+ " - 합격자 발표 : 2021.12.03.(금)\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "리눅스마스터 종목 소개\r\n"
+ " \r\n"
+ "1. 리눅스마스터\r\n"
+ "리눅스로 운영되는 전세계 80%이상의 스마트폰, 70%이상의 클라우드 서버, 세계 상위의 500대 슈퍼컴퓨터를 비롯해서 5세대 이동통신(5G), 사물인터넷(IoT), 드론, 자율주행차 등 미래성장동력 분야에서 다양한 응용기반기술에 토대가 되는 자격종목\r\n"
+ "리눅스 기반 시스템의 관리능력을 평가하는 1급 자격과 리눅스 운영시스템의 프로그램 사용능력을 평가하는 2급 자격으로 구분\r\n"
+ "리눅스마스터 1, 2급은 NCS(국가직무능력표준) 등을 바탕으로 SW기술자의 체계적 역량 가이드라인 ITSQF(IT분야역량체계)의 IT시스템관리자(L5, L3)로 인정\r\n"
+ "\r\n"
+ "2. 필요성\r\n"
+ "리눅스 시스템 관리자에게 요구되는 리눅스 OS의 기본 지식 및 리눅스 기반의 서버 ·네트워크 관리 실무능력 인증\r\n"
+ "리눅스 기반의 Desktop 활용 및 서버운영, 시스템의 설계개발 및 관리, 네트워크 구축 및 서비스 운영 등\r\n"
+ "\r\n"
+ "3. 자격종류\r\n"
+ "자격구분 : 공인민간자격\r\n"
+ "등록번호 : 2008-0268\r\n"
+ "공인번호 : 과학기술정보통신부 제2018-10호",
"2021 리눅스마스터 2급 2101회 시험 정보\r\n"
+ "\r\n"
+ "리눅스 마스터 2급 \r\n"
+ "\r\n"
+ " 2101회차 1차 \r\n"
+ "\r\n"
+ " - 접수일자 : 2021.01.25(월) ~ 2021.02.03(수)\r\n"
+ " - 시험일자 : 2021.01.26(화) ~ 2021.02.04(목)\r\n"
+ " - 합격자 발표 : 시험종료 즉시\r\n"
+ "\r\n"
+ " 2101회 2차 \r\n"
+ "\r\n"
+ " - 접수일자 : 2021.01.26(화) ~ 2021.02.05(금) \r\n"
+ " - 시험일자 : 2021.03.13(토)\r\n"
+ " - 합격자 발표 : 2021.04.02(금)\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "리눅스마스터 종목 소개\r\n"
+ " \r\n"
+ "1. 리눅스마스터\r\n"
+ "리눅스로 운영되는 전세계 80%이상의 스마트폰, 70%이상의 클라우드 서버, 세계 상위의 500대 슈퍼컴퓨터를 비롯해서 5세대 이동통신(5G), 사물인터넷(IoT), 드론, 자율주행차 등 미래성장동력 분야에서 다양한 응용기반기술에 토대가 되는 자격종목\r\n"
+ "리눅스 기반 시스템의 관리능력을 평가하는 1급 자격과 리눅스 운영시스템의 프로그램 사용능력을 평가하는 2급 자격으로 구분\r\n"
+ "리눅스마스터 1, 2급은 NCS(국가직무능력표준) 등을 바탕으로 SW기술자의 체계적 역량 가이드라인 ITSQF(IT분야역량체계)의 IT시스템관리자(L5, L3)로 인정\r\n"
+ "\r\n"
+ "2. 필요성\r\n"
+ "리눅스 시스템 관리자에게 요구되는 리눅스 OS의 기본 지식 및 리눅스 기반의 서버 ·네트워크 관리 실무능력 인증\r\n"
+ "리눅스 기반의 Desktop 활용 및 서버운영, 시스템의 설계개발 및 관리, 네트워크 구축 및 서비스 운영 등\r\n"
+ "\r\n"
+ "3. 자격종류\r\n"
+ "자격구분 : 공인민간자격\r\n"
+ "등록번호 : 2008-0268\r\n"
+ "공인번호 : 과학기술정보통신부 제2018-10호",
"2021 리눅스마스터 2급 2102회 시험 정보\r\n"
+ "\r\n"
+ "리눅스 마스터 2급 \r\n"
+ "\r\n"
+ " 2102회차 1차 \r\n"
+ "\r\n"
+ " - 접수일자 : 2021.04.26(월) ~ 2021.05.05(수)\r\n"
+ " - 시험일자 : 2021.04.27(화) ~ 2021.05.06(목)\r\n"
+ " - 합격자 발표 : 시험종료 즉시\r\n"
+ "\r\n"
+ " 2102회 2차 \r\n"
+ "\r\n"
+ " - 접수일자 : 2021.04.27(화) ~ 2021.05.07(금)\r\n"
+ " - 시험일자 : 2021.06.12(토)\r\n"
+ " - 합격자 발표 : 2021.07.02(금)\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "리눅스마스터 종목 소개\r\n"
+ " \r\n"
+ "1. 리눅스마스터\r\n"
+ "리눅스로 운영되는 전세계 80%이상의 스마트폰, 70%이상의 클라우드 서버, 세계 상위의 500대 슈퍼컴퓨터를 비롯해서 5세대 이동통신(5G), 사물인터넷(IoT), 드론, 자율주행차 등 미래성장동력 분야에서 다양한 응용기반기술에 토대가 되는 자격종목\r\n"
+ "리눅스 기반 시스템의 관리능력을 평가하는 1급 자격과 리눅스 운영시스템의 프로그램 사용능력을 평가하는 2급 자격으로 구분\r\n"
+ "리눅스마스터 1, 2급은 NCS(국가직무능력표준) 등을 바탕으로 SW기술자의 체계적 역량 가이드라인 ITSQF(IT분야역량체계)의 IT시스템관리자(L5, L3)로 인정\r\n"
+ "\r\n"
+ "2. 필요성\r\n"
+ "리눅스 시스템 관리자에게 요구되는 리눅스 OS의 기본 지식 및 리눅스 기반의 서버 ·네트워크 관리 실무능력 인증\r\n"
+ "리눅스 기반의 Desktop 활용 및 서버운영, 시스템의 설계개발 및 관리, 네트워크 구축 및 서비스 운영 등\r\n"
+ "\r\n"
+ "3. 자격종류\r\n"
+ "자격구분 : 공인민간자격\r\n"
+ "등록번호 : 2008-0268\r\n"
+ "공인번호 : 과학기술정보통신부 제2018-10호",
"2021 리눅스마스터 2급 2103회 시험 정보\r\n"
+ "\r\n"
+ "리눅스 마스터 2급 \r\n"
+ "\r\n"
+ " 2103회차 1차 \r\n"
+ "\r\n"
+ " - 접수일자 : 2021.07.26.(월) ~ 2021.08.04.(수)\r\n"
+ " - 시험일자 : 2021.07.27.(화) ~ 2021.08.05.(목)\r\n"
+ " - 합격자 발표 : 시험종료 즉시\r\n"
+ "\r\n"
+ " 2103회 2차 \r\n"
+ "\r\n"
+ " - 접수일자 : 2021.07.27(화) ~ 2021.08.06(금) \r\n"
+ " - 시험일자 : 2021.09.11(토)\r\n"
+ " - 합격자 발표 : 2021.10.01.(금)\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "리눅스마스터 종목 소개\r\n"
+ " \r\n"
+ "1. 리눅스마스터\r\n"
+ "리눅스로 운영되는 전세계 80%이상의 스마트폰, 70%이상의 클라우드 서버, 세계 상위의 500대 슈퍼컴퓨터를 비롯해서 5세대 이동통신(5G), 사물인터넷(IoT), 드론, 자율주행차 등 미래성장동력 분야에서 다양한 응용기반기술에 토대가 되는 자격종목\r\n"
+ "리눅스 기반 시스템의 관리능력을 평가하는 1급 자격과 리눅스 운영시스템의 프로그램 사용능력을 평가하는 2급 자격으로 구분\r\n"
+ "리눅스마스터 1, 2급은 NCS(국가직무능력표준) 등을 바탕으로 SW기술자의 체계적 역량 가이드라인 ITSQF(IT분야역량체계)의 IT시스템관리자(L5, L3)로 인정\r\n"
+ "\r\n"
+ "2. 필요성\r\n"
+ "리눅스 시스템 관리자에게 요구되는 리눅스 OS의 기본 지식 및 리눅스 기반의 서버 ·네트워크 관리 실무능력 인증\r\n"
+ "리눅스 기반의 Desktop 활용 및 서버운영, 시스템의 설계개발 및 관리, 네트워크 구축 및 서비스 운영 등\r\n"
+ "\r\n"
+ "3. 자격종류\r\n"
+ "자격구분 : 공인민간자격\r\n"
+ "등록번호 : 2008-0268\r\n"
+ "공인번호 : 과학기술정보통신부 제2018-10호",
"2021 리눅스마스터 2급 2104회 시험 정보\r\n"
+ "\r\n"
+ "리눅스 마스터 2급 \r\n"
+ "\r\n"
+ " 2104회차 1차 \r\n"
+ "\r\n"
+ " - 접수일자 : 2021.10.25(월) ~ 2021.11.03(수)\r\n"
+ " - 시험일자 : 2021.10.26(화) ~ 2021.11.04(목)\r\n"
+ " - 합격자 발표 : 시험종료 즉시\r\n"
+ "\r\n"
+ " 2104회 2차 \r\n"
+ "\r\n"
+ " - 접수일자 : 2021.10.26(화) ~ 2021.11.05(금) \r\n"
+ " - 시험일자 : 2021.12.11(토)\r\n"
+ " - 합격자 발표 : 2021.12.31(금)\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "리눅스마스터 종목 소개\r\n"
+ " \r\n"
+ "1. 리눅스마스터\r\n"
+ "리눅스로 운영되는 전세계 80%이상의 스마트폰, 70%이상의 클라우드 서버, 세계 상위의 500대 슈퍼컴퓨터를 비롯해서 5세대 이동통신(5G), 사물인터넷(IoT), 드론, 자율주행차 등 미래성장동력 분야에서 다양한 응용기반기술에 토대가 되는 자격종목\r\n"
+ "리눅스 기반 시스템의 관리능력을 평가하는 1급 자격과 리눅스 운영시스템의 프로그램 사용능력을 평가하는 2급 자격으로 구분\r\n"
+ "리눅스마스터 1, 2급은 NCS(국가직무능력표준) 등을 바탕으로 SW기술자의 체계적 역량 가이드라인 ITSQF(IT분야역량체계)의 IT시스템관리자(L5, L3)로 인정\r\n"
+ "\r\n"
+ "2. 필요성\r\n"
+ "리눅스 시스템 관리자에게 요구되는 리눅스 OS의 기본 지식 및 리눅스 기반의 서버 ·네트워크 관리 실무능력 인증\r\n"
+ "리눅스 기반의 Desktop 활용 및 서버운영, 시스템의 설계개발 및 관리, 네트워크 구축 및 서비스 운영 등\r\n"
+ "\r\n"
+ "3. 자격종류\r\n"
+ "자격구분 : 공인민간자격\r\n"
+ "등록번호 : 2008-0268\r\n"
+ "공인번호 : 과학기술정보통신부 제2018-10호",
"2021 빅데이터 분석 기사 \r\n"
+ "\r\n"
+ "\r\n"
+ " 제 2회 빅데이터분석기사(필기) \r\n"
+ " - 접수기간: 2021.03.02 ~ 2021.03.05\r\n"
+ " - 수험표 발급 : 2021.04.02\r\n"
+ " - 시험일 : 2021.04.17(토)\r\n"
+ " - 결과 발표 : 2021.05.07\r\n"
+ " - 증빙서류 제출 기간 : 2021.05.10 ~ 2021.05.20 \r\n"
+ "\r\n"
+ " 제 2회 빅데이터분석기사(실기)\r\n"
+ " - 접수기간: 2021.05.24 ~ 2021.05.28\r\n"
+ " - 수험표 발급 : 2021.06.04\r\n"
+ " - 시험일 : 2021.06.19(토)\r\n"
+ " - 결과 발표 : 2021.07.16\r\n"
+ " \r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "빅데이터자격 소개\r\n"
+ "\r\n"
+ "관련 근거\r\n"
+ "\r\n"
+ "국가기술자격법 및 동법 시행령\r\n"
+ "\r\n"
+ "- 빅데이터분석기사 정의\r\n"
+ "빅데이터 이해를 기반으로 빅데이터 분석 기획, 빅데이터 수집·저장·처리, 빅데이터 분석 및 시각화를 수행하는 실무자를 말한다.\r\n"
+ "\r\n"
+ "- 빅데이터분석기사의 필요성\r\n"
+ "전 세계적으로 빅데이터가 미래성장동력으로 인식돼, 각국 정부에서는 관련 기업투자를 끌어내는 등 국가·기업의 주요 전략분야로 부상하고 있다.\r\n"
+ "\r\n"
+ "국가와 기업의 경쟁력 확보를 위해 빅데이터 분석 전문가의 수요는 증가하고 있으나, 수요 대비 공급 부족으로 인력 확보에 어려움이 높은 실정이다.\r\n"
+ "\r\n"
+ "이에 정부차원에서 빅데이터 분석 전문가 양성과 함께 체계적으로 역량을 검증할 수 있는 국가기술자격 수요가 높은 편이다.\r\n"
+ "\r\n"
+ "- 빅데이터분석기사의 직무\r\n"
+ "대용량의 데이터 집합으로부터 유용한 정보를 찾고 결과를 예측하기 위해 목적에 따라 분석기술과 방법론을 기반으로 정형/비정형 대용량 데이터를 구축, 탐색, 분석하고 시각화를 수행하는 업무를 수행한다.ㅋ워크 관리 실무능력 인증\r\n"
+ "리눅스 기반의 Desktop 활용 및 서버운영, 시스템의 설계개발 및 관리, 네트워크 구축 및 서비스 운영 등\r\n"
+ "\r\n"
+ "- 응시자격\r\n"
+ "다음 중 하나에 해당하는 사람\r\n"
+ "1. 대학졸업자등 또는 졸업예정자 (전공 무관)\r\n"
+ "2. 3년제 전문대학 졸업자등으로서 졸업 후 1년 이상 직장경력이 있는 사람 (전공, 직무분야 무관)\r\n"
+ "3. 2년제 전문대학 졸업자등으로서 졸업 후 2년 이상 직장경력이 있는 사람 (전공, 직무분야 무관)\r\n"
+ "4. 기사 등급 이상의 자격을 취득한 사람 (종목 무관)\r\n"
+ "5. 기사 수준 기술훈련과정 이수자 또는 그 이수예정자 (종목 무관)\r\n"
+ "6. 산업기사 등급 이상의 자격을 취득한 후 1년 이상 직장경력이 있는 사람 (종목, 직무분야 무관)\r\n"
+ "7. 산업기사 수준 기술훈련과정 이수자로서 이수 후 2년 이상 직장경력이 있는 사람 (종목, 직무분야 무관)\r\n"
+ "8. 기능사 등급 이상의 자격을 취득한 후 3년 이상 직장경력이 있는 사람 (종목, 직무분야 무관)\r\n"
+ "9. 4년 이상 직장경력이 있는 사람 (직무분야 무관)\r\n"
+ "※ 졸업증명서 및 경력증명서 제출 필요",
"2021 빅데이터 분석 기사 \r\n"
+ "\r\n"
+ " 제 3회 빅데이터분석기사(필기) \r\n"
+ " - 접수기간: 2021.09.06 ~ 2021.09.10\r\n"
+ " - 수험표 발급 : 2021.09.24\r\n"
+ " - 시험일 : 2021.10.02(토)\r\n"
+ " - 결과 발표 : 2021.10.22\r\n"
+ " - 증빙서류 제출 기간 : 2021.10.25 ~ 2021.11.03\r\n"
+ "\r\n"
+ " 제 3회 빅데이터분석기사(실기)\r\n"
+ " - 접수기간: 2021.11.08 ~ 2021.11.12\r\n"
+ " - 수험표 발급 : 2021.11.19\r\n"
+ " - 시험일 : 2021.12.04(토)\r\n"
+ " - 결과 발표 : 2021.12.31\r\n"
+ " \r\n"
+ "\r\n"
+ "\r\n"
+ "빅데이터자격 소개\r\n"
+ "\r\n"
+ "관련 근거\r\n"
+ "\r\n"
+ "국가기술자격법 및 동법 시행령\r\n"
+ "\r\n"
+ "- 빅데이터분석기사 정의\r\n"
+ "빅데이터 이해를 기반으로 빅데이터 분석 기획, 빅데이터 수집·저장·처리, 빅데이터 분석 및 시각화를 수행하는 실무자를 말한다.\r\n"
+ "\r\n"
+ "- 빅데이터분석기사의 필요성\r\n"
+ "전 세계적으로 빅데이터가 미래성장동력으로 인식돼, 각국 정부에서는 관련 기업투자를 끌어내는 등 국가·기업의 주요 전략분야로 부상하고 있다.\r\n"
+ "\r\n"
+ "국가와 기업의 경쟁력 확보를 위해 빅데이터 분석 전문가의 수요는 증가하고 있으나, 수요 대비 공급 부족으로 인력 확보에 어려움이 높은 실정이다.\r\n"
+ "\r\n"
+ "이에 정부차원에서 빅데이터 분석 전문가 양성과 함께 체계적으로 역량을 검증할 수 있는 국가기술자격 수요가 높은 편이다.\r\n"
+ "\r\n"
+ "- 빅데이터분석기사의 직무\r\n"
+ "대용량의 데이터 집합으로부터 유용한 정보를 찾고 결과를 예측하기 위해 목적에 따라 분석기술과 방법론을 기반으로 정형/비정형 대용량 데이터를 구축, 탐색, 분석하고 시각화를 수행하는 업무를 수행한다.ㅋ워크 관리 실무능력 인증\r\n"
+ "리눅스 기반의 Desktop 활용 및 서버운영, 시스템의 설계개발 및 관리, 네트워크 구축 및 서비스 운영 등\r\n"
+ "\r\n"
+ "- 응시자격\r\n"
+ "다음 중 하나에 해당하는 사람\r\n"
+ "1. 대학졸업자등 또는 졸업예정자 (전공 무관)\r\n"
+ "2. 3년제 전문대학 졸업자등으로서 졸업 후 1년 이상 직장경력이 있는 사람 (전공, 직무분야 무관)\r\n"
+ "3. 2년제 전문대학 졸업자등으로서 졸업 후 2년 이상 직장경력이 있는 사람 (전공, 직무분야 무관)\r\n"
+ "4. 기사 등급 이상의 자격을 취득한 사람 (종목 무관)\r\n"
+ "5. 기사 수준 기술훈련과정 이수자 또는 그 이수예정자 (종목 무관)\r\n"
+ "6. 산업기사 등급 이상의 자격을 취득한 후 1년 이상 직장경력이 있는 사람 (종목, 직무분야 무관)\r\n"
+ "7. 산업기사 수준 기술훈련과정 이수자로서 이수 후 2년 이상 직장경력이 있는 사람 (종목, 직무분야 무관)\r\n"
+ "8. 기능사 등급 이상의 자격을 취득한 후 3년 이상 직장경력이 있는 사람 (종목, 직무분야 무관)\r\n"
+ "9. 4년 이상 직장경력이 있는 사람 (직무분야 무관)\r\n"
+ "※ 졸업증명서 및 경력증명서 제출 필요"
};
// Connection conn = null;
// PreparedStatement pstat = null;
//
// try {
//
// String sql = "insert into tblTechQna (techQnaSeq, memberSeq, title, content, regdate, readCount) values (techQnaSeq.nextVal, ?, ?, ?, default, default)";
//
// conn = DBUtil.open();
//
// pstat = conn.prepareStatement(sql);
//
// for (int i=0; i<100; i++) {
//
// pstat.setInt(1, memberSeq);
// pstat.setString(2, title[rnd.nextInt(title.length)]);
// pstat.setString(3, content[rnd.nextInt(content.length)]);
//
// pstat.executeUpdate();
//
// }
//
// pstat.close();
// conn.close();
//
// } catch (Exception e) {
// e.printStackTrace();
// }
int n = 0;
for (int i=0; i<100; i++) {
int memberSeq = (int)rnd.nextInt(100) + 1;
int commentSeq =(int)rnd.nextInt(100) + 1;
System.out.printf("INSERT INTO TBLCOMMUNITY (communitySeq ,memberSeq , category , title, content,regdate ,readCount) values (communitySeq.nextVal, %d ,'자격증 정보','%s', '%s', '%s', 0);\r\n", memberSeq, title[n], content[n], regdate[n]);
n++;
if (n > 12) {
n = 0;
}
}
}
} | UTF-8 | Java | 35,509 | java | license.java | Java | []
| null | []
| package Community;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.util.Random;
public class license {
public static void main(String[] args) {
Random rnd = new Random();
String[] title = {
"2021 정보처리기사 1회 시험 정보",
"2021 정보처리기사 2회 시험 정보",
"2021 정보처리기사 3회 시험 정보",
"2021 정보보안기사 1회 시험 정보",
"2021 정보보안기사 2회 시험 정보",
"2021 리눅스마스터 1급 2101회 시험 정보",
"2021 리눅스마스터 1급 2102회 시험 정보",
"2021 리눅스마스터 2급 2101회 시험 정보",
"2021 리눅스마스터 2급 2102회 시험 정보",
"2021 리눅스마스터 2급 2103회 시험 정보",
"2021 리눅스마스터 2급 2104회 시험 정보",
"2021 빅데이터 분석 기사 2회 시험정보",
"2021 빅데이터 분석 기사 3회 시험정보"
};
String[] regdate = {
"2021-07-01",
"2021-07-02",
"2021-07-03",
"2021-07-04",
"2021-07-05",
"2021-07-06",
"2021-07-07",
"2021-07-08",
"2021-07-09",
"2021-07-10",
"2021-07-11",
"2021-07-12",
"2021-07-13",
"2021-07-14",
"2021-07-15",
"2021-07-16",
"2021-07-17",
"2021-07-18",
"2021-07-19",
"2021-07-20",
"2021-07-21",
"2021-07-22",
"2021-07-23",
"2021-07-24"
};
String[] content = {
"2021 정보처리기사 1회 시험 정보 \r\n"
+ "\r\n"
+ "필기원서접수(인터넷)(휴일제외) 2021.01.25.(월) ~ 2021.01.28.(목) \r\n"
+ "\r\n"
+ "필기시험 2021.03.07.(일)\r\n"
+ "\r\n"
+ "필기합격(예정자)발표 2021.03.19.(금)\r\n"
+ "\r\n"
+ "응시자격 서류 제출 2021.03.08.(월) ~ 2021.03.30.(화) \r\n"
+ "\r\n"
+ "실기원서접수(휴일제외) 2021.03.31.(수) ~ 2021.04.05.(월) \r\n"
+ "\r\n"
+ "실기시험 2021.04.24.(토) ~ 2021.05.07.(금) \r\n"
+ "\r\n"
+ "최종합격자 발표일 2021.05.21.(금) ~ 2021.07.21.(수) \r\n"
+ "\r\n"
+ "\r\n"
+ "정보처리기사 기본 정보 \r\n"
+ "\r\n"
+ "1. 개요\r\n"
+ "\r\n"
+ " - 컴퓨터를 효과적으로 활용하기 위해서 하드웨어뿐만 아니라 정교한 소프트웨어가 필요하다. 이에 따라 우수한 프로그램을 개발하여 업무의 효율성을 높이고, 궁극적으로 국가발전에 이바지하기 위해서 컴퓨터에 관한 전문적인 지식과 기술을 갖춘 사람을 양성할 목적으로 제정됨.\r\n"
+ "\r\n"
+ "실시기관 홈페이지\r\n"
+ "\r\n"
+ "2. 실시기관 홈페이지\r\n"
+ " - http://www.q-net.or.kr\r\n"
+ "\r\n"
+ "3. 진로 및 전망\r\n"
+ "\r\n"
+ " - 기업체 전산실, 소프트웨어 개발업체, SI(system integrated)업체(정보통신, 시스템 구축회사 등), 정부기관, 언론기관, 교육 및 연구기관, 금융기관, 보험업, 병원 등 컴퓨터 시스템을 개발 및 운용하거나, 데이터 통신을 이용하여 정보처리를 시행하는 업체에서 활동하고 있다. 품질검사 전문기관 기술인력과 감리원 자격을 취득하여 감리 전문회사의 감리원으로 진출할 수 있다.\r\n"
+ "\r\n"
+ " - 정보화사회로 이행함에 따라 지식과 정보의 양이 증대되어 작업량과 업무량이 급속하게 증가했다. 또한 각종 업무의 전산화 요구가 더욱 증대되어 사회 전문분야로 컴퓨터 사용이 보편화되면서 컴퓨터산업은 급속도로 확대되었다. 컴퓨터산업의 확대는 곧 이 분야의 전문인력에 대한 수요 증가로 이어졌다.",
"2021 정보처리기사 2회 시험 정보 \r\n"
+ "\r\n"
+ "필기원서접수(인터넷)(휴일제외) 2021.04.12.(월) ~ 2021.04.15.(목)\r\n"
+ "\r\n"
+ "필기시험 2021.05.15.(토)\r\n"
+ "\r\n"
+ "필기합격(예정자)발표 2021.06.02.(수)\r\n"
+ "\r\n"
+ "응시자격 서류 제출 2021.05.17.(월) ~ 2021.06.11.(금)\r\n"
+ "\r\n"
+ "실기원서접수(휴일제외) 2021.06.14.(월) ~ 2021.06.17.(목)\r\n"
+ "\r\n"
+ "실기시험 2021.07.10.(토) ~ 2021.07.24.(토) \r\n"
+ "\r\n"
+ "최종합격자 발표일 2021.08.06.(금) ~ 2021.10.06.(수)\r\n"
+ "\r\n"
+ "\r\n"
+ "정보처리기사 기본 정보 \r\n"
+ "\r\n"
+ "1. 개요\r\n"
+ "\r\n"
+ " - 컴퓨터를 효과적으로 활용하기 위해서 하드웨어뿐만 아니라 정교한 소프트웨어가 필요하다. 이에 따라 우수한 프로그램을 개발하여 업무의 효율성을 높이고, 궁극적으로 국가발전에 이바지하기 위해서 컴퓨터에 관한 전문적인 지식과 기술을 갖춘 사람을 양성할 목적으로 제정됨.\r\n"
+ "\r\n"
+ "실시기관 홈페이지\r\n"
+ "\r\n"
+ "2. 실시기관 홈페이지\r\n"
+ " - http://www.q-net.or.kr\r\n"
+ "\r\n"
+ "3. 진로 및 전망\r\n"
+ "\r\n"
+ " - 기업체 전산실, 소프트웨어 개발업체, SI(system integrated)업체(정보통신, 시스템 구축회사 등), 정부기관, 언론기관, 교육 및 연구기관, 금융기관, 보험업, 병원 등 컴퓨터 시스템을 개발 및 운용하거나, 데이터 통신을 이용하여 정보처리를 시행하는 업체에서 활동하고 있다. 품질검사 전문기관 기술인력과 감리원 자격을 취득하여 감리 전문회사의 감리원으로 진출할 수 있다.\r\n"
+ "\r\n"
+ " - 정보화사회로 이행함에 따라 지식과 정보의 양이 증대되어 작업량과 업무량이 급속하게 증가했다. 또한 각종 업무의 전산화 요구가 더욱 증대되어 사회 전문분야로 컴퓨터 사용이 보편화되면서 컴퓨터산업은 급속도로 확대되었다. 컴퓨터산업의 확대는 곧 이 분야의 전문인력에 대한 수요 증가로 이어졌다.",
"2021 정보처리기사 3회 시험 정보 \r\n"
+ "\r\n"
+ "필기원서접수(인터넷)(휴일제외) 2021.07.12.(월) ~ 2021.07.15.(목) \r\n"
+ "\r\n"
+ "필기시험 2021.08.14.(토) \r\n"
+ "\r\n"
+ "필기합격(예정자)발표 2021.09.01.(수) \r\n"
+ "\r\n"
+ "응시자격 서류 제출 2021.08.16.(월) ~ 2021.09.10.(금) \r\n"
+ "\r\n"
+ "실기원서접수(휴일제외) 2021.09.13.(월) ~ 2021.09.16.(목) \r\n"
+ "\r\n"
+ "실기시험 2021.10.16.(토) ~ 2021.10.29.(금) \r\n"
+ "\r\n"
+ "최종합격자 발표일 2021.11.12.(금) ~ 2022.01.12.(수) \r\n"
+ "\r\n"
+ "\r\n"
+ "정보처리기사 기본 정보 \r\n"
+ "\r\n"
+ "1. 개요\r\n"
+ "\r\n"
+ " - 컴퓨터를 효과적으로 활용하기 위해서 하드웨어뿐만 아니라 정교한 소프트웨어가 필요하다. 이에 따라 우수한 프로그램을 개발하여 업무의 효율성을 높이고, 궁극적으로 국가발전에 이바지하기 위해서 컴퓨터에 관한 전문적인 지식과 기술을 갖춘 사람을 양성할 목적으로 제정됨.\r\n"
+ "\r\n"
+ "실시기관 홈페이지\r\n"
+ "\r\n"
+ "2. 실시기관 홈페이지\r\n"
+ " - http://www.q-net.or.kr\r\n"
+ "\r\n"
+ "3. 진로 및 전망\r\n"
+ "\r\n"
+ " - 기업체 전산실, 소프트웨어 개발업체, SI(system integrated)업체(정보통신, 시스템 구축회사 등), 정부기관, 언론기관, 교육 및 연구기관, 금융기관, 보험업, 병원 등 컴퓨터 시스템을 개발 및 운용하거나, 데이터 통신을 이용하여 정보처리를 시행하는 업체에서 활동하고 있다. 품질검사 전문기관 기술인력과 감리원 자격을 취득하여 감리 전문회사의 감리원으로 진출할 수 있다.\r\n"
+ "\r\n"
+ " - 정보화사회로 이행함에 따라 지식과 정보의 양이 증대되어 작업량과 업무량이 급속하게 증가했다. 또한 각종 업무의 전산화 요구가 더욱 증대되어 사회 전문분야로 컴퓨터 사용이 보편화되면서 컴퓨터산업은 급속도로 확대되었다. 컴퓨터산업의 확대는 곧 이 분야의 전문인력에 대한 수요 증가로 이어졌다.",
"2021 정보보안기사 시험일정 \r\n"
+ "\r\n"
+ "회별 : 제 17회(2021년도 1회)\r\n"
+ "\r\n"
+ "필기시험 원서접수 : 2021.02.22 ~ 2021.02.26\r\n"
+ "\r\n"
+ "필기시험 : 2021.03.27 \r\n"
+ "\r\n"
+ "필기합격 예정발표 : 2021.04.09\r\n"
+ "\r\n"
+ "응시자격 서류 제출 : 2021.04.12 ~ 2021.04.16\r\n"
+ "\r\n"
+ "실기시험 원서접수 :2021.04.12 ~ 2021.04.16\r\n"
+ "\r\n"
+ "실기시험 : 2021.05.29\r\n"
+ "\r\n"
+ "합격자 발표 : 2021.06.25 \r\n"
+ "\r\n"
+ "\r\n"
+ "자격검정안내\r\n"
+ "\r\n"
+ "1. 검정 형태 : 정기검정 \r\n"
+ "2. 검정 종목 : 정보보안기사, 정보보안산업기사 \r\n"
+ "3. 검정 지역: 전국 5개 지역 (서울,부산,대전,대구,광주) 수검장* 당회 시험 접수인원이 현저히 적은 경우 시행지역 축소 조정\r\n"
+ "4. 수행직무 \r\n"
+ "- 정보보안기사 : 시스템 및 솔루션 개발, 운영 및 관리, 컨설팅 등의 전문 이론과 실무능력을 기반으로 IT 기반시설 및 정보에 대한 체계적인 보안업무 수행\r\n"
+ "- 정보보안산업기사 : 정보보안 기사의 업무를 보조할 수 있는 기초 이론과 실무 능력 수행",
"2021 정보보안기사 시험일정 \r\n"
+ "\r\n"
+ "회별 : 제 17회(2021년도 1회)\r\n"
+ "\r\n"
+ "필기시험 원서접수 : 2021.08.02 ~ 2021.08.06\r\n"
+ "\r\n"
+ "필기시험 : 2021.09.04\r\n"
+ "\r\n"
+ "필기합격 예정발표 : 2021.09.24\r\n"
+ "\r\n"
+ "응시자격 서류 제출 : 2021.09.27 ~ 2021.10.01\r\n"
+ "\r\n"
+ "실기시험 원서접수 : 2021.09.27 ~ 2021.10.01\r\n"
+ "\r\n"
+ "실기시험 : 2021.10.30\r\n"
+ "\r\n"
+ "합격자 발표 : 2021.11.26 \r\n"
+ "\r\n"
+ "\r\n"
+ "자격검정안내\r\n"
+ "\r\n"
+ "1. 검정 형태 : 정기검정 \r\n"
+ "2. 검정 종목 : 정보보안기사, 정보보안산업기사 \r\n"
+ "3. 검정 지역: 전국 5개 지역 (서울,부산,대전,대구,광주) 수검장* 당회 시험 접수인원이 현저히 적은 경우 시행지역 축소 조정\r\n"
+ "4. 수행직무 \r\n"
+ "- 정보보안기사 : 시스템 및 솔루션 개발, 운영 및 관리, 컨설팅 등의 전문 이론과 실무능력을 기반으로 IT 기반시설 및 정보에 대한 체계적인 보안업무 수행\r\n"
+ "- 정보보안산업기사 : 정보보안 기사의 업무를 보조할 수 있는 기초 이론과 실무 능력 수행",
"2021 리눅스마스터 1급 2101회 시험 정보\r\n"
+ "\r\n"
+ "리눅스 마스터 1급 \r\n"
+ "\r\n"
+ " 2101회차 1차 \r\n"
+ "\r\n"
+ " - 접수일자 : 2021.01.26(화) ~ 2021.02.05(금)\r\n"
+ " - 시험일자 : 2021.03.13(토)\r\n"
+ " - 합격자 발표 : 2021.04.02(금)\r\n"
+ "\r\n"
+ " 2101회 2차 \r\n"
+ "\r\n"
+ " - 접수일자 : 2021.07.26(월) ~ 2021.08.06(금)\r\n"
+ " - 시험일자 : 2021.05.08(토)\r\n"
+ " - 합격자 발표 : 2021.05.28(금)\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "리눅스마스터 종목 소개\r\n"
+ " \r\n"
+ "1. 리눅스마스터\r\n"
+ "리눅스로 운영되는 전세계 80%이상의 스마트폰, 70%이상의 클라우드 서버, 세계 상위의 500대 슈퍼컴퓨터를 비롯해서 5세대 이동통신(5G), 사물인터넷(IoT), 드론, 자율주행차 등 미래성장동력 분야에서 다양한 응용기반기술에 토대가 되는 자격종목\r\n"
+ "리눅스 기반 시스템의 관리능력을 평가하는 1급 자격과 리눅스 운영시스템의 프로그램 사용능력을 평가하는 2급 자격으로 구분\r\n"
+ "리눅스마스터 1, 2급은 NCS(국가직무능력표준) 등을 바탕으로 SW기술자의 체계적 역량 가이드라인 ITSQF(IT분야역량체계)의 IT시스템관리자(L5, L3)로 인정\r\n"
+ "\r\n"
+ "2. 필요성\r\n"
+ "리눅스 시스템 관리자에게 요구되는 리눅스 OS의 기본 지식 및 리눅스 기반의 서버 ·네트워크 관리 실무능력 인증\r\n"
+ "리눅스 기반의 Desktop 활용 및 서버운영, 시스템의 설계개발 및 관리, 네트워크 구축 및 서비스 운영 등\r\n"
+ "\r\n"
+ "3. 자격종류\r\n"
+ "자격구분 : 공인민간자격\r\n"
+ "등록번호 : 2008-0268\r\n"
+ "공인번호 : 과학기술정보통신부 제2018-10호",
"2021 리눅스마스터 1급 2102회 시험 정보\r\n"
+ "\r\n"
+ "리눅스 마스터 1급 \r\n"
+ "\r\n"
+ " 2102회차 1차 \r\n"
+ "\r\n"
+ " - 접수일자 : 2021.07.26.(월) ~ 2021.08.06.(금)\r\n"
+ " - 시험일자 : 2021.09.11.(토)\r\n"
+ " - 합격자 발표 : 2021.10.01.(금)\r\n"
+ "\r\n"
+ " 2102회 2차 \r\n"
+ "\r\n"
+ " - 접수일자 : 2021.10.04.(월) ~ 2021.10.15.(금)\r\n"
+ " - 시험일자 : 2021.11.13.(토)\r\n"
+ " - 합격자 발표 : 2021.12.03.(금)\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "리눅스마스터 종목 소개\r\n"
+ " \r\n"
+ "1. 리눅스마스터\r\n"
+ "리눅스로 운영되는 전세계 80%이상의 스마트폰, 70%이상의 클라우드 서버, 세계 상위의 500대 슈퍼컴퓨터를 비롯해서 5세대 이동통신(5G), 사물인터넷(IoT), 드론, 자율주행차 등 미래성장동력 분야에서 다양한 응용기반기술에 토대가 되는 자격종목\r\n"
+ "리눅스 기반 시스템의 관리능력을 평가하는 1급 자격과 리눅스 운영시스템의 프로그램 사용능력을 평가하는 2급 자격으로 구분\r\n"
+ "리눅스마스터 1, 2급은 NCS(국가직무능력표준) 등을 바탕으로 SW기술자의 체계적 역량 가이드라인 ITSQF(IT분야역량체계)의 IT시스템관리자(L5, L3)로 인정\r\n"
+ "\r\n"
+ "2. 필요성\r\n"
+ "리눅스 시스템 관리자에게 요구되는 리눅스 OS의 기본 지식 및 리눅스 기반의 서버 ·네트워크 관리 실무능력 인증\r\n"
+ "리눅스 기반의 Desktop 활용 및 서버운영, 시스템의 설계개발 및 관리, 네트워크 구축 및 서비스 운영 등\r\n"
+ "\r\n"
+ "3. 자격종류\r\n"
+ "자격구분 : 공인민간자격\r\n"
+ "등록번호 : 2008-0268\r\n"
+ "공인번호 : 과학기술정보통신부 제2018-10호",
"2021 리눅스마스터 2급 2101회 시험 정보\r\n"
+ "\r\n"
+ "리눅스 마스터 2급 \r\n"
+ "\r\n"
+ " 2101회차 1차 \r\n"
+ "\r\n"
+ " - 접수일자 : 2021.01.25(월) ~ 2021.02.03(수)\r\n"
+ " - 시험일자 : 2021.01.26(화) ~ 2021.02.04(목)\r\n"
+ " - 합격자 발표 : 시험종료 즉시\r\n"
+ "\r\n"
+ " 2101회 2차 \r\n"
+ "\r\n"
+ " - 접수일자 : 2021.01.26(화) ~ 2021.02.05(금) \r\n"
+ " - 시험일자 : 2021.03.13(토)\r\n"
+ " - 합격자 발표 : 2021.04.02(금)\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "리눅스마스터 종목 소개\r\n"
+ " \r\n"
+ "1. 리눅스마스터\r\n"
+ "리눅스로 운영되는 전세계 80%이상의 스마트폰, 70%이상의 클라우드 서버, 세계 상위의 500대 슈퍼컴퓨터를 비롯해서 5세대 이동통신(5G), 사물인터넷(IoT), 드론, 자율주행차 등 미래성장동력 분야에서 다양한 응용기반기술에 토대가 되는 자격종목\r\n"
+ "리눅스 기반 시스템의 관리능력을 평가하는 1급 자격과 리눅스 운영시스템의 프로그램 사용능력을 평가하는 2급 자격으로 구분\r\n"
+ "리눅스마스터 1, 2급은 NCS(국가직무능력표준) 등을 바탕으로 SW기술자의 체계적 역량 가이드라인 ITSQF(IT분야역량체계)의 IT시스템관리자(L5, L3)로 인정\r\n"
+ "\r\n"
+ "2. 필요성\r\n"
+ "리눅스 시스템 관리자에게 요구되는 리눅스 OS의 기본 지식 및 리눅스 기반의 서버 ·네트워크 관리 실무능력 인증\r\n"
+ "리눅스 기반의 Desktop 활용 및 서버운영, 시스템의 설계개발 및 관리, 네트워크 구축 및 서비스 운영 등\r\n"
+ "\r\n"
+ "3. 자격종류\r\n"
+ "자격구분 : 공인민간자격\r\n"
+ "등록번호 : 2008-0268\r\n"
+ "공인번호 : 과학기술정보통신부 제2018-10호",
"2021 리눅스마스터 2급 2102회 시험 정보\r\n"
+ "\r\n"
+ "리눅스 마스터 2급 \r\n"
+ "\r\n"
+ " 2102회차 1차 \r\n"
+ "\r\n"
+ " - 접수일자 : 2021.04.26(월) ~ 2021.05.05(수)\r\n"
+ " - 시험일자 : 2021.04.27(화) ~ 2021.05.06(목)\r\n"
+ " - 합격자 발표 : 시험종료 즉시\r\n"
+ "\r\n"
+ " 2102회 2차 \r\n"
+ "\r\n"
+ " - 접수일자 : 2021.04.27(화) ~ 2021.05.07(금)\r\n"
+ " - 시험일자 : 2021.06.12(토)\r\n"
+ " - 합격자 발표 : 2021.07.02(금)\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "리눅스마스터 종목 소개\r\n"
+ " \r\n"
+ "1. 리눅스마스터\r\n"
+ "리눅스로 운영되는 전세계 80%이상의 스마트폰, 70%이상의 클라우드 서버, 세계 상위의 500대 슈퍼컴퓨터를 비롯해서 5세대 이동통신(5G), 사물인터넷(IoT), 드론, 자율주행차 등 미래성장동력 분야에서 다양한 응용기반기술에 토대가 되는 자격종목\r\n"
+ "리눅스 기반 시스템의 관리능력을 평가하는 1급 자격과 리눅스 운영시스템의 프로그램 사용능력을 평가하는 2급 자격으로 구분\r\n"
+ "리눅스마스터 1, 2급은 NCS(국가직무능력표준) 등을 바탕으로 SW기술자의 체계적 역량 가이드라인 ITSQF(IT분야역량체계)의 IT시스템관리자(L5, L3)로 인정\r\n"
+ "\r\n"
+ "2. 필요성\r\n"
+ "리눅스 시스템 관리자에게 요구되는 리눅스 OS의 기본 지식 및 리눅스 기반의 서버 ·네트워크 관리 실무능력 인증\r\n"
+ "리눅스 기반의 Desktop 활용 및 서버운영, 시스템의 설계개발 및 관리, 네트워크 구축 및 서비스 운영 등\r\n"
+ "\r\n"
+ "3. 자격종류\r\n"
+ "자격구분 : 공인민간자격\r\n"
+ "등록번호 : 2008-0268\r\n"
+ "공인번호 : 과학기술정보통신부 제2018-10호",
"2021 리눅스마스터 2급 2103회 시험 정보\r\n"
+ "\r\n"
+ "리눅스 마스터 2급 \r\n"
+ "\r\n"
+ " 2103회차 1차 \r\n"
+ "\r\n"
+ " - 접수일자 : 2021.07.26.(월) ~ 2021.08.04.(수)\r\n"
+ " - 시험일자 : 2021.07.27.(화) ~ 2021.08.05.(목)\r\n"
+ " - 합격자 발표 : 시험종료 즉시\r\n"
+ "\r\n"
+ " 2103회 2차 \r\n"
+ "\r\n"
+ " - 접수일자 : 2021.07.27(화) ~ 2021.08.06(금) \r\n"
+ " - 시험일자 : 2021.09.11(토)\r\n"
+ " - 합격자 발표 : 2021.10.01.(금)\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "리눅스마스터 종목 소개\r\n"
+ " \r\n"
+ "1. 리눅스마스터\r\n"
+ "리눅스로 운영되는 전세계 80%이상의 스마트폰, 70%이상의 클라우드 서버, 세계 상위의 500대 슈퍼컴퓨터를 비롯해서 5세대 이동통신(5G), 사물인터넷(IoT), 드론, 자율주행차 등 미래성장동력 분야에서 다양한 응용기반기술에 토대가 되는 자격종목\r\n"
+ "리눅스 기반 시스템의 관리능력을 평가하는 1급 자격과 리눅스 운영시스템의 프로그램 사용능력을 평가하는 2급 자격으로 구분\r\n"
+ "리눅스마스터 1, 2급은 NCS(국가직무능력표준) 등을 바탕으로 SW기술자의 체계적 역량 가이드라인 ITSQF(IT분야역량체계)의 IT시스템관리자(L5, L3)로 인정\r\n"
+ "\r\n"
+ "2. 필요성\r\n"
+ "리눅스 시스템 관리자에게 요구되는 리눅스 OS의 기본 지식 및 리눅스 기반의 서버 ·네트워크 관리 실무능력 인증\r\n"
+ "리눅스 기반의 Desktop 활용 및 서버운영, 시스템의 설계개발 및 관리, 네트워크 구축 및 서비스 운영 등\r\n"
+ "\r\n"
+ "3. 자격종류\r\n"
+ "자격구분 : 공인민간자격\r\n"
+ "등록번호 : 2008-0268\r\n"
+ "공인번호 : 과학기술정보통신부 제2018-10호",
"2021 리눅스마스터 2급 2104회 시험 정보\r\n"
+ "\r\n"
+ "리눅스 마스터 2급 \r\n"
+ "\r\n"
+ " 2104회차 1차 \r\n"
+ "\r\n"
+ " - 접수일자 : 2021.10.25(월) ~ 2021.11.03(수)\r\n"
+ " - 시험일자 : 2021.10.26(화) ~ 2021.11.04(목)\r\n"
+ " - 합격자 발표 : 시험종료 즉시\r\n"
+ "\r\n"
+ " 2104회 2차 \r\n"
+ "\r\n"
+ " - 접수일자 : 2021.10.26(화) ~ 2021.11.05(금) \r\n"
+ " - 시험일자 : 2021.12.11(토)\r\n"
+ " - 합격자 발표 : 2021.12.31(금)\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "리눅스마스터 종목 소개\r\n"
+ " \r\n"
+ "1. 리눅스마스터\r\n"
+ "리눅스로 운영되는 전세계 80%이상의 스마트폰, 70%이상의 클라우드 서버, 세계 상위의 500대 슈퍼컴퓨터를 비롯해서 5세대 이동통신(5G), 사물인터넷(IoT), 드론, 자율주행차 등 미래성장동력 분야에서 다양한 응용기반기술에 토대가 되는 자격종목\r\n"
+ "리눅스 기반 시스템의 관리능력을 평가하는 1급 자격과 리눅스 운영시스템의 프로그램 사용능력을 평가하는 2급 자격으로 구분\r\n"
+ "리눅스마스터 1, 2급은 NCS(국가직무능력표준) 등을 바탕으로 SW기술자의 체계적 역량 가이드라인 ITSQF(IT분야역량체계)의 IT시스템관리자(L5, L3)로 인정\r\n"
+ "\r\n"
+ "2. 필요성\r\n"
+ "리눅스 시스템 관리자에게 요구되는 리눅스 OS의 기본 지식 및 리눅스 기반의 서버 ·네트워크 관리 실무능력 인증\r\n"
+ "리눅스 기반의 Desktop 활용 및 서버운영, 시스템의 설계개발 및 관리, 네트워크 구축 및 서비스 운영 등\r\n"
+ "\r\n"
+ "3. 자격종류\r\n"
+ "자격구분 : 공인민간자격\r\n"
+ "등록번호 : 2008-0268\r\n"
+ "공인번호 : 과학기술정보통신부 제2018-10호",
"2021 빅데이터 분석 기사 \r\n"
+ "\r\n"
+ "\r\n"
+ " 제 2회 빅데이터분석기사(필기) \r\n"
+ " - 접수기간: 2021.03.02 ~ 2021.03.05\r\n"
+ " - 수험표 발급 : 2021.04.02\r\n"
+ " - 시험일 : 2021.04.17(토)\r\n"
+ " - 결과 발표 : 2021.05.07\r\n"
+ " - 증빙서류 제출 기간 : 2021.05.10 ~ 2021.05.20 \r\n"
+ "\r\n"
+ " 제 2회 빅데이터분석기사(실기)\r\n"
+ " - 접수기간: 2021.05.24 ~ 2021.05.28\r\n"
+ " - 수험표 발급 : 2021.06.04\r\n"
+ " - 시험일 : 2021.06.19(토)\r\n"
+ " - 결과 발표 : 2021.07.16\r\n"
+ " \r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "\r\n"
+ "빅데이터자격 소개\r\n"
+ "\r\n"
+ "관련 근거\r\n"
+ "\r\n"
+ "국가기술자격법 및 동법 시행령\r\n"
+ "\r\n"
+ "- 빅데이터분석기사 정의\r\n"
+ "빅데이터 이해를 기반으로 빅데이터 분석 기획, 빅데이터 수집·저장·처리, 빅데이터 분석 및 시각화를 수행하는 실무자를 말한다.\r\n"
+ "\r\n"
+ "- 빅데이터분석기사의 필요성\r\n"
+ "전 세계적으로 빅데이터가 미래성장동력으로 인식돼, 각국 정부에서는 관련 기업투자를 끌어내는 등 국가·기업의 주요 전략분야로 부상하고 있다.\r\n"
+ "\r\n"
+ "국가와 기업의 경쟁력 확보를 위해 빅데이터 분석 전문가의 수요는 증가하고 있으나, 수요 대비 공급 부족으로 인력 확보에 어려움이 높은 실정이다.\r\n"
+ "\r\n"
+ "이에 정부차원에서 빅데이터 분석 전문가 양성과 함께 체계적으로 역량을 검증할 수 있는 국가기술자격 수요가 높은 편이다.\r\n"
+ "\r\n"
+ "- 빅데이터분석기사의 직무\r\n"
+ "대용량의 데이터 집합으로부터 유용한 정보를 찾고 결과를 예측하기 위해 목적에 따라 분석기술과 방법론을 기반으로 정형/비정형 대용량 데이터를 구축, 탐색, 분석하고 시각화를 수행하는 업무를 수행한다.ㅋ워크 관리 실무능력 인증\r\n"
+ "리눅스 기반의 Desktop 활용 및 서버운영, 시스템의 설계개발 및 관리, 네트워크 구축 및 서비스 운영 등\r\n"
+ "\r\n"
+ "- 응시자격\r\n"
+ "다음 중 하나에 해당하는 사람\r\n"
+ "1. 대학졸업자등 또는 졸업예정자 (전공 무관)\r\n"
+ "2. 3년제 전문대학 졸업자등으로서 졸업 후 1년 이상 직장경력이 있는 사람 (전공, 직무분야 무관)\r\n"
+ "3. 2년제 전문대학 졸업자등으로서 졸업 후 2년 이상 직장경력이 있는 사람 (전공, 직무분야 무관)\r\n"
+ "4. 기사 등급 이상의 자격을 취득한 사람 (종목 무관)\r\n"
+ "5. 기사 수준 기술훈련과정 이수자 또는 그 이수예정자 (종목 무관)\r\n"
+ "6. 산업기사 등급 이상의 자격을 취득한 후 1년 이상 직장경력이 있는 사람 (종목, 직무분야 무관)\r\n"
+ "7. 산업기사 수준 기술훈련과정 이수자로서 이수 후 2년 이상 직장경력이 있는 사람 (종목, 직무분야 무관)\r\n"
+ "8. 기능사 등급 이상의 자격을 취득한 후 3년 이상 직장경력이 있는 사람 (종목, 직무분야 무관)\r\n"
+ "9. 4년 이상 직장경력이 있는 사람 (직무분야 무관)\r\n"
+ "※ 졸업증명서 및 경력증명서 제출 필요",
"2021 빅데이터 분석 기사 \r\n"
+ "\r\n"
+ " 제 3회 빅데이터분석기사(필기) \r\n"
+ " - 접수기간: 2021.09.06 ~ 2021.09.10\r\n"
+ " - 수험표 발급 : 2021.09.24\r\n"
+ " - 시험일 : 2021.10.02(토)\r\n"
+ " - 결과 발표 : 2021.10.22\r\n"
+ " - 증빙서류 제출 기간 : 2021.10.25 ~ 2021.11.03\r\n"
+ "\r\n"
+ " 제 3회 빅데이터분석기사(실기)\r\n"
+ " - 접수기간: 2021.11.08 ~ 2021.11.12\r\n"
+ " - 수험표 발급 : 2021.11.19\r\n"
+ " - 시험일 : 2021.12.04(토)\r\n"
+ " - 결과 발표 : 2021.12.31\r\n"
+ " \r\n"
+ "\r\n"
+ "\r\n"
+ "빅데이터자격 소개\r\n"
+ "\r\n"
+ "관련 근거\r\n"
+ "\r\n"
+ "국가기술자격법 및 동법 시행령\r\n"
+ "\r\n"
+ "- 빅데이터분석기사 정의\r\n"
+ "빅데이터 이해를 기반으로 빅데이터 분석 기획, 빅데이터 수집·저장·처리, 빅데이터 분석 및 시각화를 수행하는 실무자를 말한다.\r\n"
+ "\r\n"
+ "- 빅데이터분석기사의 필요성\r\n"
+ "전 세계적으로 빅데이터가 미래성장동력으로 인식돼, 각국 정부에서는 관련 기업투자를 끌어내는 등 국가·기업의 주요 전략분야로 부상하고 있다.\r\n"
+ "\r\n"
+ "국가와 기업의 경쟁력 확보를 위해 빅데이터 분석 전문가의 수요는 증가하고 있으나, 수요 대비 공급 부족으로 인력 확보에 어려움이 높은 실정이다.\r\n"
+ "\r\n"
+ "이에 정부차원에서 빅데이터 분석 전문가 양성과 함께 체계적으로 역량을 검증할 수 있는 국가기술자격 수요가 높은 편이다.\r\n"
+ "\r\n"
+ "- 빅데이터분석기사의 직무\r\n"
+ "대용량의 데이터 집합으로부터 유용한 정보를 찾고 결과를 예측하기 위해 목적에 따라 분석기술과 방법론을 기반으로 정형/비정형 대용량 데이터를 구축, 탐색, 분석하고 시각화를 수행하는 업무를 수행한다.ㅋ워크 관리 실무능력 인증\r\n"
+ "리눅스 기반의 Desktop 활용 및 서버운영, 시스템의 설계개발 및 관리, 네트워크 구축 및 서비스 운영 등\r\n"
+ "\r\n"
+ "- 응시자격\r\n"
+ "다음 중 하나에 해당하는 사람\r\n"
+ "1. 대학졸업자등 또는 졸업예정자 (전공 무관)\r\n"
+ "2. 3년제 전문대학 졸업자등으로서 졸업 후 1년 이상 직장경력이 있는 사람 (전공, 직무분야 무관)\r\n"
+ "3. 2년제 전문대학 졸업자등으로서 졸업 후 2년 이상 직장경력이 있는 사람 (전공, 직무분야 무관)\r\n"
+ "4. 기사 등급 이상의 자격을 취득한 사람 (종목 무관)\r\n"
+ "5. 기사 수준 기술훈련과정 이수자 또는 그 이수예정자 (종목 무관)\r\n"
+ "6. 산업기사 등급 이상의 자격을 취득한 후 1년 이상 직장경력이 있는 사람 (종목, 직무분야 무관)\r\n"
+ "7. 산업기사 수준 기술훈련과정 이수자로서 이수 후 2년 이상 직장경력이 있는 사람 (종목, 직무분야 무관)\r\n"
+ "8. 기능사 등급 이상의 자격을 취득한 후 3년 이상 직장경력이 있는 사람 (종목, 직무분야 무관)\r\n"
+ "9. 4년 이상 직장경력이 있는 사람 (직무분야 무관)\r\n"
+ "※ 졸업증명서 및 경력증명서 제출 필요"
};
// Connection conn = null;
// PreparedStatement pstat = null;
//
// try {
//
// String sql = "insert into tblTechQna (techQnaSeq, memberSeq, title, content, regdate, readCount) values (techQnaSeq.nextVal, ?, ?, ?, default, default)";
//
// conn = DBUtil.open();
//
// pstat = conn.prepareStatement(sql);
//
// for (int i=0; i<100; i++) {
//
// pstat.setInt(1, memberSeq);
// pstat.setString(2, title[rnd.nextInt(title.length)]);
// pstat.setString(3, content[rnd.nextInt(content.length)]);
//
// pstat.executeUpdate();
//
// }
//
// pstat.close();
// conn.close();
//
// } catch (Exception e) {
// e.printStackTrace();
// }
int n = 0;
for (int i=0; i<100; i++) {
int memberSeq = (int)rnd.nextInt(100) + 1;
int commentSeq =(int)rnd.nextInt(100) + 1;
System.out.printf("INSERT INTO TBLCOMMUNITY (communitySeq ,memberSeq , category , title, content,regdate ,readCount) values (communitySeq.nextVal, %d ,'자격증 정보','%s', '%s', '%s', 0);\r\n", memberSeq, title[n], content[n], regdate[n]);
n++;
if (n > 12) {
n = 0;
}
}
}
} | 35,509 | 0.413299 | 0.339239 | 592 | 38.756756 | 33.808456 | 242 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.54223 | false | false | 4 |
b69c5914a9fba37faed874307adf04abe3345898 | 23,974,507,452,966 | 48300330ea7b3beaebecc5d091e0d0a2bfad4410 | /play/net/ooici/util/msgpack/DecodeFile.java | bc9a462206d221d1af5031144640e69246dcb31d | []
| no_license | brianfox/ioncore-java-fox | https://github.com/brianfox/ioncore-java-fox | d4a68ea373399bfdaa23af9ed1ea89f45b75baba | 9174b279398deefb82438e8355b2c2f33dea4e41 | refs/heads/master | 2020-06-03T22:27:51.136000 | 2018-07-24T22:48:31 | 2018-07-24T22:48:31 | 1,681,799 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package net.ooici.util.msgpack;
/**
* Our serialization sucks. Attemps to reverse engineer it are below.
* Note that this code isn't meant to be pretty.
*
*/
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import net.ooici.util.msgpack.MessagePack;
import net.ooici.util.msgpack.MessagePackException;
import net.ooici.util.msgpack.elements.MPElement;
public class DecodeFile {
public static void main(String[] args) throws IOException, MessagePackException {
FileInputStream fis = new FileInputStream("/Users/brianfox/test.out");
DataInputStream dis = new DataInputStream(fis);
int count = 0;
while (true) {
MPElement e = MessagePack.decodeFrom(dis);
if (e == null)
break;
System.out.println(e.getClass().getSimpleName() + " " + e.toString()) ;
count++;
}
System.out.println("COUNT: " + count);
}
}
| UTF-8 | Java | 934 | java | DecodeFile.java | Java | [
{
"context": "FileInputStream fis = new FileInputStream(\"/Users/brianfox/test.out\");\n \tDataInputStream dis = new DataIn",
"end": 583,
"score": 0.9986417293548584,
"start": 575,
"tag": "USERNAME",
"value": "brianfox"
}
]
| null | []
| package net.ooici.util.msgpack;
/**
* Our serialization sucks. Attemps to reverse engineer it are below.
* Note that this code isn't meant to be pretty.
*
*/
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import net.ooici.util.msgpack.MessagePack;
import net.ooici.util.msgpack.MessagePackException;
import net.ooici.util.msgpack.elements.MPElement;
public class DecodeFile {
public static void main(String[] args) throws IOException, MessagePackException {
FileInputStream fis = new FileInputStream("/Users/brianfox/test.out");
DataInputStream dis = new DataInputStream(fis);
int count = 0;
while (true) {
MPElement e = MessagePack.decodeFrom(dis);
if (e == null)
break;
System.out.println(e.getClass().getSimpleName() + " " + e.toString()) ;
count++;
}
System.out.println("COUNT: " + count);
}
}
| 934 | 0.686296 | 0.685225 | 34 | 26.441177 | 25.429478 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.088235 | false | false | 4 |
011962c03c55f2ebd088b7af6ff75e30c6466559 | 32,238,024,536,740 | c9ec89bb04fb18d5929ba79fc03a35f67875a3e0 | /src/main/java/com/mmall/service/IFileService.java | d7b1f85ddaf54818b16028e01be1ebce5785ba25 | []
| no_license | engjose/mmall_shopping | https://github.com/engjose/mmall_shopping | fea28882c69b7c83c34add29b4a76dfb041e4b83 | 6e13bde255dfbeee7655ccfd23264805caaf6912 | refs/heads/master | 2021-01-01T06:08:23.363000 | 2017-09-30T14:18:46 | 2017-09-30T14:18:46 | 97,365,816 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.mmall.service;
import com.mmall.common.ResultMap;
import org.springframework.web.multipart.MultipartFile;
/**
* Created by panyuanyuan on 2017/7/1.
*/
public interface IFileService {
/**
* 上传文件
*
* @param file
* @param path
* @return
*/
String uploadFile(MultipartFile file, String path);
}
| UTF-8 | Java | 354 | java | IFileService.java | Java | [
{
"context": "rk.web.multipart.MultipartFile;\n\n/**\n * Created by panyuanyuan on 2017/7/1.\n */\npublic interface IFileService {\n",
"end": 149,
"score": 0.9995222091674805,
"start": 138,
"tag": "USERNAME",
"value": "panyuanyuan"
}
]
| null | []
| package com.mmall.service;
import com.mmall.common.ResultMap;
import org.springframework.web.multipart.MultipartFile;
/**
* Created by panyuanyuan on 2017/7/1.
*/
public interface IFileService {
/**
* 上传文件
*
* @param file
* @param path
* @return
*/
String uploadFile(MultipartFile file, String path);
}
| 354 | 0.653179 | 0.635838 | 19 | 17.210526 | 17.437344 | 55 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.263158 | false | false | 4 |
0e27fde828417380a5300ea06d7d07362189eacd | 15,178,414,438,281 | d6ab38714f7a5f0dc6d7446ec20626f8f539406a | /backend/collecting/dsfj/Java/edited/nio.CharToByteBufferAdapter.java | 7cff99479551ad979d96aae5f517bcd93e8605f4 | []
| no_license | haditabatabaei/webproject | https://github.com/haditabatabaei/webproject | 8db7178affaca835b5d66daa7d47c28443b53c3d | 86b3f253e894f4368a517711bbfbe257be0259fd | refs/heads/master | 2020-04-10T09:26:25.819000 | 2018-12-08T12:21:52 | 2018-12-08T12:21:52 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package java.nio;
final class CharToByteBufferAdapter extends CharBuffer {
static CharBuffer wrap (ByteBuffer byteBuffer) {
return new CharToByteBufferAdapter(byteBuffer.slice());
}
private final ByteBuffer byteBuffer;
CharToByteBufferAdapter (ByteBuffer byteBuffer) {
super((byteBuffer.capacity() >> 1));
this.byteBuffer = byteBuffer;
this.byteBuffer.clear();
}
@Override
public CharBuffer asReadOnlyBuffer () {
CharToByteBufferAdapter buf = new CharToByteBufferAdapter(byteBuffer.asReadOnlyBuffer());
buf.limit = limit;
buf.position = position;
buf.mark = mark;
return buf;
}
@Override
public CharBuffer compact () {
if (byteBuffer.isReadOnly()) {
throw new ReadOnlyBufferException();
}
byteBuffer.limit(limit << 1);
byteBuffer.position(position << 1);
byteBuffer.compact();
byteBuffer.clear();
position = limit - position;
limit = capacity;
mark = UNSET_MARK;
return this;
}
@Override
public CharBuffer duplicate () {
CharToByteBufferAdapter buf = new CharToByteBufferAdapter(byteBuffer.duplicate());
buf.limit = limit;
buf.position = position;
buf.mark = mark;
return buf;
}
@Override
public char get () {
if (position == limit) {
throw new BufferUnderflowException();
}
return byteBuffer.getChar(position++ << 1);
}
@Override
public char get (int index) {
if (index < 0 || index >= limit) {
throw new IndexOutOfBoundsException();
}
return byteBuffer.getChar(index << 1);
}
@Override
public boolean isDirect () {
return byteBuffer.isDirect();
}
@Override
public boolean isReadOnly () {
return byteBuffer.isReadOnly();
}
@Override
public ByteOrder order () {
return byteBuffer.order();
}
@Override
protected char[] protectedArray () {
throw new UnsupportedOperationException();
}
@Override
protected int protectedArrayOffset () {
throw new UnsupportedOperationException();
}
@Override
protected boolean protectedHasArray () {
return false;
}
@Override
public CharBuffer put (char c) {
if (position == limit) {
throw new BufferOverflowException();
}
byteBuffer.putChar(position++ << 1, c);
return this;
}
@Override
public CharBuffer put (int index, char c) {
if (index < 0 || index >= limit) {
throw new IndexOutOfBoundsException();
}
byteBuffer.putChar(index << 1, c);
return this;
}
@Override
public CharBuffer slice () {
byteBuffer.limit(limit << 1);
byteBuffer.position(position << 1);
CharBuffer result = new CharToByteBufferAdapter(byteBuffer.slice());
byteBuffer.clear();
return result;
}
@Override
public CharSequence subSequence (int start, int end) {
if (start < 0 || end < start || end > remaining()) {
throw new IndexOutOfBoundsException();
}
CharBuffer result = duplicate();
result.limit(position + end);
result.position(position + start);
return result;
}
}
| UTF-8 | Java | 2,877 | java | nio.CharToByteBufferAdapter.java | Java | []
| null | []
|
package java.nio;
final class CharToByteBufferAdapter extends CharBuffer {
static CharBuffer wrap (ByteBuffer byteBuffer) {
return new CharToByteBufferAdapter(byteBuffer.slice());
}
private final ByteBuffer byteBuffer;
CharToByteBufferAdapter (ByteBuffer byteBuffer) {
super((byteBuffer.capacity() >> 1));
this.byteBuffer = byteBuffer;
this.byteBuffer.clear();
}
@Override
public CharBuffer asReadOnlyBuffer () {
CharToByteBufferAdapter buf = new CharToByteBufferAdapter(byteBuffer.asReadOnlyBuffer());
buf.limit = limit;
buf.position = position;
buf.mark = mark;
return buf;
}
@Override
public CharBuffer compact () {
if (byteBuffer.isReadOnly()) {
throw new ReadOnlyBufferException();
}
byteBuffer.limit(limit << 1);
byteBuffer.position(position << 1);
byteBuffer.compact();
byteBuffer.clear();
position = limit - position;
limit = capacity;
mark = UNSET_MARK;
return this;
}
@Override
public CharBuffer duplicate () {
CharToByteBufferAdapter buf = new CharToByteBufferAdapter(byteBuffer.duplicate());
buf.limit = limit;
buf.position = position;
buf.mark = mark;
return buf;
}
@Override
public char get () {
if (position == limit) {
throw new BufferUnderflowException();
}
return byteBuffer.getChar(position++ << 1);
}
@Override
public char get (int index) {
if (index < 0 || index >= limit) {
throw new IndexOutOfBoundsException();
}
return byteBuffer.getChar(index << 1);
}
@Override
public boolean isDirect () {
return byteBuffer.isDirect();
}
@Override
public boolean isReadOnly () {
return byteBuffer.isReadOnly();
}
@Override
public ByteOrder order () {
return byteBuffer.order();
}
@Override
protected char[] protectedArray () {
throw new UnsupportedOperationException();
}
@Override
protected int protectedArrayOffset () {
throw new UnsupportedOperationException();
}
@Override
protected boolean protectedHasArray () {
return false;
}
@Override
public CharBuffer put (char c) {
if (position == limit) {
throw new BufferOverflowException();
}
byteBuffer.putChar(position++ << 1, c);
return this;
}
@Override
public CharBuffer put (int index, char c) {
if (index < 0 || index >= limit) {
throw new IndexOutOfBoundsException();
}
byteBuffer.putChar(index << 1, c);
return this;
}
@Override
public CharBuffer slice () {
byteBuffer.limit(limit << 1);
byteBuffer.position(position << 1);
CharBuffer result = new CharToByteBufferAdapter(byteBuffer.slice());
byteBuffer.clear();
return result;
}
@Override
public CharSequence subSequence (int start, int end) {
if (start < 0 || end < start || end > remaining()) {
throw new IndexOutOfBoundsException();
}
CharBuffer result = duplicate();
result.limit(position + end);
result.position(position + start);
return result;
}
}
| 2,877 | 0.697949 | 0.693778 | 136 | 20.139706 | 18.872316 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.772059 | false | false | 4 |
04df328e87d7e67813e14d41260bf8f272465711 | 15,539,191,695,144 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/6/6_c227b03101b07ce637e8ea3ae51ba9322e070e8d/CommandButton/6_c227b03101b07ce637e8ea3ae51ba9322e070e8d_CommandButton_s.java | e4650d8ac89cc09d45753a51180f2b3152a30b3e | []
| no_license | zhongxingyu/Seer | https://github.com/zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516000 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | false | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | 2023-06-21T00:53:27 | 2023-06-22T07:55:57 | 2,849,868 | 2 | 2 | 0 | null | false | false | package de.juwimm.cms.gui.ribbon;
import javax.swing.UIManager;
import org.jvnet.flamingo.common.JCommandButton;
import org.jvnet.flamingo.common.RichToolTipManager;
import org.jvnet.flamingo.common.RichTooltip;
import org.jvnet.flamingo.common.icon.ResizableIcon;
/**
* @author <a href="florin.zalum@juwimm.com">Florin Zalum</a>
* @version $Id$
*/
public class CommandButton extends JCommandButton{
private static final long serialVersionUID = 1750079748505618927L;
/**
* Stores the tooltip for when the button is enabled
*/
private RichTooltip enabledToolTip = null;
public CommandButton(String title, ResizableIcon icon) {
super(title, icon);
}
@Override
public void updateUI() {
if (UIManager.get(getUIClassID()) != null) {
setUI((CommandButtonUI) UIManager.getUI(this));
} else {
setUI(CommandButtonUI.createUI(this));
}
}
@Override
public void setEnabled(boolean state) {
if(enabledToolTip != null){
if(state == false){
//remove tooltip if button is disabled
RichToolTipManager richToolTipManager = RichToolTipManager.sharedInstance();
richToolTipManager.unregisterComponent(this);
}else{
this.setActionRichTooltip(enabledToolTip);
}
}
super.setEnabled(state);
}
@Override
public void setActionRichTooltip(RichTooltip richTooltip) {
enabledToolTip = richTooltip;
super.setActionRichTooltip(richTooltip);
}
}
| UTF-8 | Java | 1,519 | java | 6_c227b03101b07ce637e8ea3ae51ba9322e070e8d_CommandButton_s.java | Java | [
{
"context": ".ResizableIcon;\r\n \r\n \r\n /**\r\n * @author <a href=\"florin.zalum@juwimm.com\">Florin Zalum</a>\r\n * @version $Id$\r\n */\r\n publ",
"end": 339,
"score": 0.9999223947525024,
"start": 316,
"tag": "EMAIL",
"value": "florin.zalum@juwimm.com"
},
{
"context": "**\r\n * @author <a href=\"florin.zalum@juwimm.com\">Florin Zalum</a>\r\n * @version $Id$\r\n */\r\n public class Comma",
"end": 353,
"score": 0.9998776316642761,
"start": 341,
"tag": "NAME",
"value": "Florin Zalum"
}
]
| null | []
| package de.juwimm.cms.gui.ribbon;
import javax.swing.UIManager;
import org.jvnet.flamingo.common.JCommandButton;
import org.jvnet.flamingo.common.RichToolTipManager;
import org.jvnet.flamingo.common.RichTooltip;
import org.jvnet.flamingo.common.icon.ResizableIcon;
/**
* @author <a href="<EMAIL>"><NAME></a>
* @version $Id$
*/
public class CommandButton extends JCommandButton{
private static final long serialVersionUID = 1750079748505618927L;
/**
* Stores the tooltip for when the button is enabled
*/
private RichTooltip enabledToolTip = null;
public CommandButton(String title, ResizableIcon icon) {
super(title, icon);
}
@Override
public void updateUI() {
if (UIManager.get(getUIClassID()) != null) {
setUI((CommandButtonUI) UIManager.getUI(this));
} else {
setUI(CommandButtonUI.createUI(this));
}
}
@Override
public void setEnabled(boolean state) {
if(enabledToolTip != null){
if(state == false){
//remove tooltip if button is disabled
RichToolTipManager richToolTipManager = RichToolTipManager.sharedInstance();
richToolTipManager.unregisterComponent(this);
}else{
this.setActionRichTooltip(enabledToolTip);
}
}
super.setEnabled(state);
}
@Override
public void setActionRichTooltip(RichTooltip richTooltip) {
enabledToolTip = richTooltip;
super.setActionRichTooltip(richTooltip);
}
}
| 1,497 | 0.685978 | 0.673469 | 58 | 24.189655 | 22.674957 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.62069 | false | false | 4 |
d1b58e161d9a4917055236a33dd255788b9a8ee9 | 16,527,034,174,549 | 089a400b1d21a445f11e3ab5377534703b3be601 | /front end/Project1/app/src/main/java/com/example/project1/model/prueba.java | 26187117f85e5fc5eb2ea77af342600e83bc834a | []
| no_license | lsraul/mobile | https://github.com/lsraul/mobile | a030a4fcc99a8f195e3cf29927c93d75e3bc48cd | be2d64d826cc07e70f3d558a3231487f9a9622fc | refs/heads/master | 2020-05-18T18:33:03.740000 | 2019-07-19T14:58:05 | 2019-07-19T14:58:05 | 184,588,325 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.project1.model;
import android.os.AsyncTask;
import android.util.Log;
import android.widget.TextView;
import com.example.project1.R;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
public class prueba extends AsyncTask<String, Void, String> {
public static String texto="";
private double latFrom;
private double latTo;
private double lngFrom;
private double lngTo;
@Override
protected String doInBackground(String... strings) {
latFrom=63.11147512251782;
lngFrom=21.603103497305284;
latTo=63.10378111708289;
lngTo=21.623749452749507;
try {
URL url=new URL("https://maps.googleapis.com/maps/api/distancematrix/json?units=imperial&origins=Washington,DC&destinations=New+York+City,NY&key=AIzaSyBVZ9jPtjPpnDWwPYzKNTCYnQP8zx5niJ0");
//URL url=new URL("http://maps.googleapis.com/maps/api/directions/json?origin=" + latFrom + "," + lngFrom + "&destination=" + latTo + "," + lngTo + "&mode=driving&sensor=false");
HttpURLConnection con= (HttpURLConnection) url.openConnection();
con.setRequestMethod("GET");
con.connect();
int statuscode=con.getResponseCode();
if(statuscode==HttpURLConnection.HTTP_OK)
{
BufferedReader br=new BufferedReader(new InputStreamReader(con.getInputStream()));
StringBuilder sb=new StringBuilder();
String line=br.readLine();
while(line!=null)
{
sb.append(line);
line=br.readLine();
}
String json=sb.toString();
Log.d("JSON",json);
JSONObject root=new JSONObject(json);
JSONArray array_rows=root.getJSONArray("rows");
Log.d("JSON","array_rows:"+array_rows);
JSONObject object_rows=array_rows.getJSONObject(0);
Log.d("JSON","object_rows:"+object_rows);
JSONArray array_elements=object_rows.getJSONArray("elements");
Log.d("JSON","array_elements:"+array_elements);
JSONObject object_elements=array_elements.getJSONObject(0);
Log.d("JSON","object_elements:"+object_elements);
JSONObject object_duration=object_elements.getJSONObject("duration");
JSONObject object_distance=object_elements.getJSONObject("distance");
Log.d("JSON","object_duration:"+object_duration);
texto = object_duration.getString("value")+","+object_distance.getString("value");
return object_duration.getString("value")+","+object_distance.getString("value");
/*
JSONObject jsonObject = new JSONObject(sb.toString());
JSONArray array = jsonObject.getJSONArray("routes");
JSONObject routes = array.getJSONObject(0);
JSONArray legs = routes.getJSONArray("legs");
JSONObject steps = legs.getJSONObject(0);
JSONObject distance = steps.getJSONObject("distance");
Log.d("Distance", distance.toString());
texto = distance.getString("text").replaceAll("[^\\.0123456789]","") ;
return texto;
*/
}
} catch (MalformedURLException e) {
Log.d("error", "error1");
} catch (IOException e) {
Log.d("error", "error2");
} catch (JSONException e) {
Log.d("error","error3");
}
return null;
}
}
| UTF-8 | Java | 3,818 | java | prueba.java | Java | [
{
"context": "s=Washington,DC&destinations=New+York+City,NY&key=AIzaSyBVZ9jPtjPpnDWwPYzKNTCYnQP8zx5niJ0\");\n //URL url=new URL(\"http://maps.goo",
"end": 1059,
"score": 0.9994136095046997,
"start": 1020,
"tag": "KEY",
"value": "AIzaSyBVZ9jPtjPpnDWwPYzKNTCYnQP8zx5niJ0"
}
]
| null | []
| package com.example.project1.model;
import android.os.AsyncTask;
import android.util.Log;
import android.widget.TextView;
import com.example.project1.R;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
public class prueba extends AsyncTask<String, Void, String> {
public static String texto="";
private double latFrom;
private double latTo;
private double lngFrom;
private double lngTo;
@Override
protected String doInBackground(String... strings) {
latFrom=63.11147512251782;
lngFrom=21.603103497305284;
latTo=63.10378111708289;
lngTo=21.623749452749507;
try {
URL url=new URL("https://maps.googleapis.com/maps/api/distancematrix/json?units=imperial&origins=Washington,DC&destinations=New+York+City,NY&key=<KEY>");
//URL url=new URL("http://maps.googleapis.com/maps/api/directions/json?origin=" + latFrom + "," + lngFrom + "&destination=" + latTo + "," + lngTo + "&mode=driving&sensor=false");
HttpURLConnection con= (HttpURLConnection) url.openConnection();
con.setRequestMethod("GET");
con.connect();
int statuscode=con.getResponseCode();
if(statuscode==HttpURLConnection.HTTP_OK)
{
BufferedReader br=new BufferedReader(new InputStreamReader(con.getInputStream()));
StringBuilder sb=new StringBuilder();
String line=br.readLine();
while(line!=null)
{
sb.append(line);
line=br.readLine();
}
String json=sb.toString();
Log.d("JSON",json);
JSONObject root=new JSONObject(json);
JSONArray array_rows=root.getJSONArray("rows");
Log.d("JSON","array_rows:"+array_rows);
JSONObject object_rows=array_rows.getJSONObject(0);
Log.d("JSON","object_rows:"+object_rows);
JSONArray array_elements=object_rows.getJSONArray("elements");
Log.d("JSON","array_elements:"+array_elements);
JSONObject object_elements=array_elements.getJSONObject(0);
Log.d("JSON","object_elements:"+object_elements);
JSONObject object_duration=object_elements.getJSONObject("duration");
JSONObject object_distance=object_elements.getJSONObject("distance");
Log.d("JSON","object_duration:"+object_duration);
texto = object_duration.getString("value")+","+object_distance.getString("value");
return object_duration.getString("value")+","+object_distance.getString("value");
/*
JSONObject jsonObject = new JSONObject(sb.toString());
JSONArray array = jsonObject.getJSONArray("routes");
JSONObject routes = array.getJSONObject(0);
JSONArray legs = routes.getJSONArray("legs");
JSONObject steps = legs.getJSONObject(0);
JSONObject distance = steps.getJSONObject("distance");
Log.d("Distance", distance.toString());
texto = distance.getString("text").replaceAll("[^\\.0123456789]","") ;
return texto;
*/
}
} catch (MalformedURLException e) {
Log.d("error", "error1");
} catch (IOException e) {
Log.d("error", "error2");
} catch (JSONException e) {
Log.d("error","error3");
}
return null;
}
}
| 3,784 | 0.6066 | 0.58329 | 97 | 38.360825 | 34.635715 | 199 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.845361 | false | false | 4 |
1727e7ebfeb189f31765c91cef6a19532d9b4fae | 19,542,101,248,145 | eed41451a0fa1cd046bb0596d4d8911a75bc04e4 | /app/src/main/java/com/example/farm_elp/Activity_Starting/Splash_Screen_Activity.java | ab581471c187114e65cedce1309cd2aad8d69592 | []
| no_license | magiccruiser/Farm-elp | https://github.com/magiccruiser/Farm-elp | c9399877f67420cbf6780789d1392e303dac6cce | d8216bd920c9fed553e3b35fb4a8d95c40a8d49a | refs/heads/master | 2023-07-01T20:29:32.798000 | 2021-08-10T11:37:24 | 2021-08-10T11:37:24 | 370,441,992 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.farm_elp.Activity_Starting;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.WindowManager;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.farm_elp.R;
public class Splash_Screen_Activity extends AppCompatActivity {
Animation topAnim, bottomAnim;
ImageView splashImg;
TextView textView;
private static int SPLASH_SCREEN=5000;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash__screen_);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
////////////Animations//////////////
topAnim= AnimationUtils.loadAnimation(this,R.anim.top_animation);
bottomAnim=AnimationUtils.loadAnimation(this,R.anim.bottom_animation);
splashImg=findViewById(R.id.splash_img);
textView=findViewById(R.id.splash_textView);
///////////////Assigning Animation////////////
splashImg.setAnimation(topAnim);
textView.setAnimation(bottomAnim);
//////////////CALLING NEXT ACTIVITY AFTER THIS SCREEN//////////////////
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent intent=new Intent(Splash_Screen_Activity.this,StartingActivity.class);
startActivity(intent);
finish();
}
}, SPLASH_SCREEN);
}
} | UTF-8 | Java | 1,724 | java | Splash_Screen_Activity.java | Java | []
| null | []
| package com.example.farm_elp.Activity_Starting;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.WindowManager;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.farm_elp.R;
public class Splash_Screen_Activity extends AppCompatActivity {
Animation topAnim, bottomAnim;
ImageView splashImg;
TextView textView;
private static int SPLASH_SCREEN=5000;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash__screen_);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
////////////Animations//////////////
topAnim= AnimationUtils.loadAnimation(this,R.anim.top_animation);
bottomAnim=AnimationUtils.loadAnimation(this,R.anim.bottom_animation);
splashImg=findViewById(R.id.splash_img);
textView=findViewById(R.id.splash_textView);
///////////////Assigning Animation////////////
splashImg.setAnimation(topAnim);
textView.setAnimation(bottomAnim);
//////////////CALLING NEXT ACTIVITY AFTER THIS SCREEN//////////////////
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent intent=new Intent(Splash_Screen_Activity.this,StartingActivity.class);
startActivity(intent);
finish();
}
}, SPLASH_SCREEN);
}
} | 1,724 | 0.675754 | 0.673434 | 53 | 31.547171 | 26.750113 | 116 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.641509 | false | false | 4 |
651d0a14c872929ee6323684f4ff838735c4dfbb | 29,257,317,264,995 | 49f3f49ce64e0731a46493ad1cb1b705d3749d6c | /q14232772389.java | f7eb85579b111c2e6c6b8263e9159b56145f9466 | []
| no_license | rp0005sh/tiebukuro | https://github.com/rp0005sh/tiebukuro | 16074a8ca70658efe1f5ad640f84d8491c36e12c | 2e948323d7604531caeb32c6119f8625507c6fe6 | refs/heads/master | 2023-04-13T00:43:46.893000 | 2023-04-07T15:56:42 | 2023-04-07T15:56:42 | 126,578,926 | 4 | 3 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* MainActivity側の実装
*/
public class MainActivity extends AppCompatActivity implements View.OnLongClickListener, View.OnDragListener {
/** ドラッグされたView */
private View mDragView;
/** レイアウト */
private GridLayout mParent;
/**
* アプリ起動時の最初に呼ばれるイベント
* @param savedInstanceState
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// 各Viewに、ボタン長押し・ドラッグのイベントを設定していく
mParent = findViewById(R.id.grid_layout);
for (int i = 0; i < mParent.getChildCount(); i++) {
View v = mParent.getChildAt(i);
v.setOnLongClickListener(this);
v.setOnDragListener(this);
}
}
/**
* Viewを長押ししたとき通知されるイベント
* @param v 対象のView
* @return イベント有効有無
*/
@Override
public boolean onLongClick(View v) {
// 長押ししているViewをドラッグ状態にする。
v.startDragAndDrop(null, new View.DragShadowBuilder(v), v, 0);
mDragView = v;
// 図(b, c)から、ドラッグ中のViewは見えなくなる必要があるので、透過値調整して消す。
// Visibilityで消すこともできるが、ドラッグ終了時のアニメーションが入るので、透過値で非表示を表現
mDragView.setAlpha(0);
return true;
}
/**
* ドラッグされたとき通知されるイベント
* @param v 通知を受信したView
* @param event イベント(使用するのは、ドラッグ終了、ドラッグしたまま他のViewの上にカーソルが合う)
* @return イベント有効有無(必ずTrueにする)
*/
@Override
public boolean onDrag(View v, DragEvent event) {
switch (event.getAction()) {
// 手を放し、ドラッグが終了した時の処理。ドラッグしているViewを表示させる。
case DragEvent.ACTION_DRAG_ENDED:
getMainExecutor().execute(() -> mDragView.setAlpha(1));
break;
// ドラッグ中他のViewの上に乗る時の処理。Viewの位置を入れ替える
case DragEvent.ACTION_DRAG_LOCATION:
getMainExecutor().execute(() -> swap(v, mDragView));
break;
}
return true;
}
/**
* Viewの位置を入れ替える
* @param v1 入れ替え対象1
* @param v2 入れ替え対象2
*/
private void swap(View v1, View v2) {
// 同じViewなら入れ替える必要なし
if (v1 == v2) return;
// レイアウトパラメータを抜き出して、入れ替えを行う
GridLayout.LayoutParams p1 = (GridLayout.LayoutParams) v1.getLayoutParams();
GridLayout.LayoutParams p2 = (GridLayout.LayoutParams) v2.getLayoutParams();
mParent.removeView(v1);
mParent.removeView(v2);
mParent.addView(v1, p2);
mParent.addView(v2, p1);
}
}
// ---------------------------------------------------------------------------------------------
/**
* activity_main.xmlの中身
*/
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<GridLayout
android:id="@+id/grid_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:context=".MainActivity">
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_row="0"
android:layout_column="0"
app:srcCompat="@android:drawable/ic_menu_add" />
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_row="0"
android:layout_column="1"
app:srcCompat="@android:drawable/ic_menu_always_landscape_portrait" />
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_row="0"
android:layout_column="2"
app:srcCompat="@android:drawable/ic_menu_call" />
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_row="0"
android:layout_column="3"
app:srcCompat="@android:drawable/ic_menu_camera" />
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_row="1"
android:layout_column="0"
app:srcCompat="@android:drawable/ic_menu_close_clear_cancel" />
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_row="1"
android:layout_column="1"
app:srcCompat="@android:drawable/ic_menu_compass" />
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_row="1"
android:layout_column="2"
app:srcCompat="@android:drawable/ic_menu_crop" />
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_row="1"
android:layout_column="3"
app:srcCompat="@android:drawable/ic_menu_delete" />
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_row="2"
android:layout_column="0"
app:srcCompat="@android:drawable/ic_menu_directions" />
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_row="2"
android:layout_column="1"
app:srcCompat="@android:drawable/ic_menu_directions" />
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_row="2"
android:layout_column="2"
app:srcCompat="@android:drawable/ic_menu_edit" />
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_row="2"
android:layout_column="3"
app:srcCompat="@android:drawable/ic_menu_gallery" />
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_row="3"
android:layout_column="0"
app:srcCompat="@android:drawable/ic_menu_help" />
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_row="3"
android:layout_column="1"
app:srcCompat="@android:drawable/ic_menu_info_details" />
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_row="3"
android:layout_column="2"
app:srcCompat="@android:drawable/ic_menu_manage" />
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_row="3"
android:layout_column="3"
app:srcCompat="@android:drawable/ic_menu_recent_history" />
</GridLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
| UTF-8 | Java | 8,051 | java | q14232772389.java | Java | []
| null | []
| /**
* MainActivity側の実装
*/
public class MainActivity extends AppCompatActivity implements View.OnLongClickListener, View.OnDragListener {
/** ドラッグされたView */
private View mDragView;
/** レイアウト */
private GridLayout mParent;
/**
* アプリ起動時の最初に呼ばれるイベント
* @param savedInstanceState
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// 各Viewに、ボタン長押し・ドラッグのイベントを設定していく
mParent = findViewById(R.id.grid_layout);
for (int i = 0; i < mParent.getChildCount(); i++) {
View v = mParent.getChildAt(i);
v.setOnLongClickListener(this);
v.setOnDragListener(this);
}
}
/**
* Viewを長押ししたとき通知されるイベント
* @param v 対象のView
* @return イベント有効有無
*/
@Override
public boolean onLongClick(View v) {
// 長押ししているViewをドラッグ状態にする。
v.startDragAndDrop(null, new View.DragShadowBuilder(v), v, 0);
mDragView = v;
// 図(b, c)から、ドラッグ中のViewは見えなくなる必要があるので、透過値調整して消す。
// Visibilityで消すこともできるが、ドラッグ終了時のアニメーションが入るので、透過値で非表示を表現
mDragView.setAlpha(0);
return true;
}
/**
* ドラッグされたとき通知されるイベント
* @param v 通知を受信したView
* @param event イベント(使用するのは、ドラッグ終了、ドラッグしたまま他のViewの上にカーソルが合う)
* @return イベント有効有無(必ずTrueにする)
*/
@Override
public boolean onDrag(View v, DragEvent event) {
switch (event.getAction()) {
// 手を放し、ドラッグが終了した時の処理。ドラッグしているViewを表示させる。
case DragEvent.ACTION_DRAG_ENDED:
getMainExecutor().execute(() -> mDragView.setAlpha(1));
break;
// ドラッグ中他のViewの上に乗る時の処理。Viewの位置を入れ替える
case DragEvent.ACTION_DRAG_LOCATION:
getMainExecutor().execute(() -> swap(v, mDragView));
break;
}
return true;
}
/**
* Viewの位置を入れ替える
* @param v1 入れ替え対象1
* @param v2 入れ替え対象2
*/
private void swap(View v1, View v2) {
// 同じViewなら入れ替える必要なし
if (v1 == v2) return;
// レイアウトパラメータを抜き出して、入れ替えを行う
GridLayout.LayoutParams p1 = (GridLayout.LayoutParams) v1.getLayoutParams();
GridLayout.LayoutParams p2 = (GridLayout.LayoutParams) v2.getLayoutParams();
mParent.removeView(v1);
mParent.removeView(v2);
mParent.addView(v1, p2);
mParent.addView(v2, p1);
}
}
// ---------------------------------------------------------------------------------------------
/**
* activity_main.xmlの中身
*/
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<GridLayout
android:id="@+id/grid_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:context=".MainActivity">
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_row="0"
android:layout_column="0"
app:srcCompat="@android:drawable/ic_menu_add" />
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_row="0"
android:layout_column="1"
app:srcCompat="@android:drawable/ic_menu_always_landscape_portrait" />
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_row="0"
android:layout_column="2"
app:srcCompat="@android:drawable/ic_menu_call" />
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_row="0"
android:layout_column="3"
app:srcCompat="@android:drawable/ic_menu_camera" />
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_row="1"
android:layout_column="0"
app:srcCompat="@android:drawable/ic_menu_close_clear_cancel" />
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_row="1"
android:layout_column="1"
app:srcCompat="@android:drawable/ic_menu_compass" />
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_row="1"
android:layout_column="2"
app:srcCompat="@android:drawable/ic_menu_crop" />
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_row="1"
android:layout_column="3"
app:srcCompat="@android:drawable/ic_menu_delete" />
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_row="2"
android:layout_column="0"
app:srcCompat="@android:drawable/ic_menu_directions" />
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_row="2"
android:layout_column="1"
app:srcCompat="@android:drawable/ic_menu_directions" />
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_row="2"
android:layout_column="2"
app:srcCompat="@android:drawable/ic_menu_edit" />
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_row="2"
android:layout_column="3"
app:srcCompat="@android:drawable/ic_menu_gallery" />
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_row="3"
android:layout_column="0"
app:srcCompat="@android:drawable/ic_menu_help" />
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_row="3"
android:layout_column="1"
app:srcCompat="@android:drawable/ic_menu_info_details" />
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_row="3"
android:layout_column="2"
app:srcCompat="@android:drawable/ic_menu_manage" />
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_row="3"
android:layout_column="3"
app:srcCompat="@android:drawable/ic_menu_recent_history" />
</GridLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
| 8,051 | 0.579157 | 0.562543 | 222 | 31.806307 | 21.767679 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.162162 | false | false | 4 |
cd5b9e2b11e893c7bab1c27aea28e2c778885b3a | 7,997,229,145,433 | b76dd5b2d0c459c01f2b9250ce29fecd02160b77 | /src/main/java/com/common/exception/BaseForbiddenException.java | b718292d83c520b9bca9738ea43345ee30f74430 | []
| no_license | oguzhanonder91/caborya | https://github.com/oguzhanonder91/caborya | dff6ffad36f27dd662e62c5f3df0915615f832f6 | 8b91fd63a519c80d068be1b69fc6fdea92e871c3 | refs/heads/master | 2020-04-01T14:02:00.267000 | 2019-12-10T14:37:10 | 2019-12-10T14:37:10 | 153,277,637 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.common.exception;
/**
* Created by oguzhanonder - 12.10.2018
*/
public class BaseForbiddenException extends BaseException {
public BaseForbiddenException(String exception) {
super(exception);
}
public BaseForbiddenException() {
}
public BaseForbiddenException(String message, Throwable cause) {
super(message, cause);
}
}
| UTF-8 | Java | 380 | java | BaseForbiddenException.java | Java | [
{
"context": "package com.common.exception;\n\n/**\n * Created by oguzhanonder - 12.10.2018\n */\npublic class BaseForbiddenExcept",
"end": 61,
"score": 0.9996833801269531,
"start": 49,
"tag": "USERNAME",
"value": "oguzhanonder"
}
]
| null | []
| package com.common.exception;
/**
* Created by oguzhanonder - 12.10.2018
*/
public class BaseForbiddenException extends BaseException {
public BaseForbiddenException(String exception) {
super(exception);
}
public BaseForbiddenException() {
}
public BaseForbiddenException(String message, Throwable cause) {
super(message, cause);
}
}
| 380 | 0.694737 | 0.673684 | 18 | 20.111111 | 22.340519 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.277778 | false | false | 4 |
f27288db207952249089134d1495330ce7f519ed | 35,579,509,085,547 | 845553e65f5a4e5a6026c94ec9107684735a42df | /L_38.java | 9eda6b5e967b64e1d310f8cf2d57e9f9d2542b29 | []
| no_license | himanshudhawale/Leetcode-Easy | https://github.com/himanshudhawale/Leetcode-Easy | 054aa4e8509332b787fe2929069de9b2b1a91bbc | de274063e30dad5aff2b420d8305546b9c69ba43 | refs/heads/master | 2020-07-02T19:59:21.774000 | 2019-12-11T20:20:00 | 2019-12-11T20:20:00 | 201,647,406 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | class Solution {
public String countAndSay(int n) {
if(n<1)
return "";
else if(n==1)
return "1";
else if(n==2)
return "11";
else{
String ans = "11";
for(int i=3; i<=n;i++)
{
ans=getString(ans);
}
return ans;
}
}
public String getString(String ans){
StringBuilder sb = new StringBuilder();
int i=1, count=1;
char[] c = ans.toCharArray();
char current = c[0];
for(i=1;i<c.length;i++)
{
if(c[i]==current)
count++;
else{
sb.append(count);
sb.append(current);
count=1;
current=c[i];
}
}
sb.append(count);
sb.append(current);
return sb.toString();
}
} | UTF-8 | Java | 939 | java | L_38.java | Java | []
| null | []
| class Solution {
public String countAndSay(int n) {
if(n<1)
return "";
else if(n==1)
return "1";
else if(n==2)
return "11";
else{
String ans = "11";
for(int i=3; i<=n;i++)
{
ans=getString(ans);
}
return ans;
}
}
public String getString(String ans){
StringBuilder sb = new StringBuilder();
int i=1, count=1;
char[] c = ans.toCharArray();
char current = c[0];
for(i=1;i<c.length;i++)
{
if(c[i]==current)
count++;
else{
sb.append(count);
sb.append(current);
count=1;
current=c[i];
}
}
sb.append(count);
sb.append(current);
return sb.toString();
}
} | 939 | 0.379127 | 0.364217 | 42 | 21.380953 | 11.292543 | 47 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.547619 | false | false | 4 |
01215127b807533b3b3b6204c0b18913d23e27cc | 21,792,664,097,561 | bad9d2795150e749290afb1940b94f50236a26eb | /TontapatBusiness/src/main/java/fr/eql/ai109/tontapat/business/TerrainTypeAbriBusiness.java | 8901796541447116c9400473931972bee751532d | []
| no_license | NajwaLahly/Tontapat2-jee | https://github.com/NajwaLahly/Tontapat2-jee | 762291e34ef15f1aaafaa121ae15d9ba8b5de935 | 75c9b72b0845cd20091bf51569d9d1eb5ada3809 | refs/heads/master | 2023-07-13T04:53:07.369000 | 2021-08-18T18:20:38 | 2021-08-18T18:20:38 | 392,955,768 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package fr.eql.ai109.tontapat.business;
import javax.ejb.EJB;
import javax.ejb.Remote;
import javax.ejb.Stateless;
import fr.eql.ai109.tontapat.entity.TerrainTypeAbri;
import fr.eql.ai109.tontapat.ibusiness.TerrainTypeAbriIBusiness;
import fr.eql.ai109.tontapat.idao.TerrainTypeAbriIDAO;
@Remote(TerrainTypeAbriIBusiness.class)
@Stateless
public class TerrainTypeAbriBusiness implements TerrainTypeAbriIBusiness {
@EJB
private TerrainTypeAbriIDAO terrainTypeAbriIDAO;
@Override
public TerrainTypeAbri addNewTerrainTypeAbri(TerrainTypeAbri terrainTypeAbri) {
return terrainTypeAbriIDAO.ajoutNouveauTerrainTypeAbri(terrainTypeAbri);
}
}
| UTF-8 | Java | 649 | java | TerrainTypeAbriBusiness.java | Java | []
| null | []
| package fr.eql.ai109.tontapat.business;
import javax.ejb.EJB;
import javax.ejb.Remote;
import javax.ejb.Stateless;
import fr.eql.ai109.tontapat.entity.TerrainTypeAbri;
import fr.eql.ai109.tontapat.ibusiness.TerrainTypeAbriIBusiness;
import fr.eql.ai109.tontapat.idao.TerrainTypeAbriIDAO;
@Remote(TerrainTypeAbriIBusiness.class)
@Stateless
public class TerrainTypeAbriBusiness implements TerrainTypeAbriIBusiness {
@EJB
private TerrainTypeAbriIDAO terrainTypeAbriIDAO;
@Override
public TerrainTypeAbri addNewTerrainTypeAbri(TerrainTypeAbri terrainTypeAbri) {
return terrainTypeAbriIDAO.ajoutNouveauTerrainTypeAbri(terrainTypeAbri);
}
}
| 649 | 0.845917 | 0.827427 | 23 | 27.217392 | 27.544361 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.73913 | false | false | 4 |
f6734b9c3133779ae77a301f5fb05c65af416a50 | 7,645,041,854,537 | a285c7b89df1f64377ccda6e73554275c9aed2ca | /web-server/src/main/java/com/yujian/wq/script/创建训练类型.java | 3ab2032ce94842413b74f724173e9738b95cc7e3 | []
| no_license | zhishan332/yujian | https://github.com/zhishan332/yujian | 5393021bd3012b9c085e92f2049ca093de690bfc | 1fa8c34bee325ddc036ae44d430a0e6abb4f3627 | refs/heads/master | 2021-05-14T00:24:13.640000 | 2018-01-29T15:43:11 | 2018-01-29T15:43:11 | 116,540,648 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.yujian.wq.script;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.io.IOException;
import java.util.List;
/**
* 添加描述
*
* @author wangqing
* @since 2018/1/11
*/
public class 创建训练类型 {
public static void main(String[] args) throws IOException {
List<String> list = FileUtils.readLines(new File("I:\\code\\wechat\\yujianserver\\web-server\\src\\main\\resources\\tag_id"));
int i = 1;
for (String str : list) {
}
}
}
| UTF-8 | Java | 522 | java | 创建训练类型.java | Java | [
{
"context": "\nimport java.util.List;\n\n/**\n * 添加描述\n *\n * @author wangqing\n * @since 2018/1/11\n */\npublic class 创建训练类型 {\n\n ",
"end": 179,
"score": 0.9974172711372375,
"start": 171,
"tag": "USERNAME",
"value": "wangqing"
}
]
| null | []
| package com.yujian.wq.script;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.io.IOException;
import java.util.List;
/**
* 添加描述
*
* @author wangqing
* @since 2018/1/11
*/
public class 创建训练类型 {
public static void main(String[] args) throws IOException {
List<String> list = FileUtils.readLines(new File("I:\\code\\wechat\\yujianserver\\web-server\\src\\main\\resources\\tag_id"));
int i = 1;
for (String str : list) {
}
}
}
| 522 | 0.639442 | 0.623506 | 28 | 16.928572 | 27.143703 | 134 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false | 4 |
3c84151fdcf7de091a0521c3ac0b2829a61b5ad9 | 34,617,436,415,636 | 079ace24178e12604ea4dd8a590b60d9c2c12a1d | /MedicalEcoSystem/src/main/java/neu/ying/entities/User.java | ba5aeac910f2cc38a952905720ff6af900fb3f0a | []
| no_license | yinking/MedicalEcoSystem_Web | https://github.com/yinking/MedicalEcoSystem_Web | 5b27f20c71b1a5402f1dab114337a8e3257bef87 | 0d0b17118e30d53b62289cc24cfe4eb8c9d7e66c | refs/heads/master | 2021-01-19T07:36:15.996000 | 2017-04-26T06:08:20 | 2017-04-26T06:08:20 | 87,557,243 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package neu.ying.entities;
// Generated Apr 7, 2017 12:12:31 PM by Hibernate Tools 5.0.4.Final
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
/**
* User generated by hbm2java
*/
@Entity
@Table(name = "User", catalog = "MedicalEcoSystem", uniqueConstraints = @UniqueConstraint(columnNames = "username"))
public class User implements java.io.Serializable {
private Integer idUser;
private String firstName;
private String lastName;
private String email;
private String phone;
private Boolean active;
private String username;
private String password;
private int idEnterprise;
private String role;
public User() {
}
public User(String username, int idEnterprise, String role) {
this.username = username;
this.idEnterprise = idEnterprise;
this.role = role;
}
public User(String firstName, String lastName, String email, String phone, Boolean active, String username,
String password, int idEnterprise, String role) {
this.firstName = firstName;
this.lastName = lastName;
this.email = email;
this.phone = phone;
this.active = active;
this.username = username;
this.password = password;
this.idEnterprise = idEnterprise;
this.role = role;
}
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "idUser", unique = true, nullable = false)
public Integer getIdUser() {
return this.idUser;
}
public void setIdUser(Integer idUser) {
this.idUser = idUser;
}
@Column(name = "firstName", length = 45)
public String getFirstName() {
return this.firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
@Column(name = "lastName", length = 45)
public String getLastName() {
return this.lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
@Column(name = "email", length = 45)
public String getEmail() {
return this.email;
}
public void setEmail(String email) {
this.email = email;
}
@Column(name = "phone", length = 45)
public String getPhone() {
return this.phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
@Column(name = "active")
public Boolean getActive() {
return this.active;
}
public void setActive(Boolean active) {
this.active = active;
}
@Column(name = "username", unique = true, nullable = false, length = 45)
public String getUsername() {
return this.username;
}
public void setUsername(String username) {
this.username = username;
}
@Column(name = "password", length = 45)
public String getPassword() {
return this.password;
}
public void setPassword(String password) {
this.password = password;
}
@Column(name = "idEnterprise", nullable = false)
public int getIdEnterprise() {
return this.idEnterprise;
}
public void setIdEnterprise(int idEnterprise) {
this.idEnterprise = idEnterprise;
}
@Column(name = "role", nullable = false, length = 12)
public String getRole() {
return this.role;
}
public void setRole(String role) {
this.role = role;
}
}
| UTF-8 | Java | 3,212 | java | User.java | Java | [
{
"context": "int idEnterprise, String role) {\n\t\tthis.username = username;\n\t\tthis.idEnterprise = idEnterprise;\n\t\tthis.role ",
"end": 942,
"score": 0.9956278204917908,
"start": 934,
"tag": "USERNAME",
"value": "username"
},
{
"context": " = role;\n\t}\n\n\tpublic User(String firstName, String lastName, String email, String phone, Boolean active, Stri",
"end": 1050,
"score": 0.5603853464126587,
"start": 1042,
"tag": "NAME",
"value": "lastName"
},
{
"context": "nt idEnterprise, String role) {\n\t\tthis.firstName = firstName;\n\t\tthis.lastName = lastName;\n\t\tthis.email = email",
"end": 1194,
"score": 0.7532469034194946,
"start": 1185,
"tag": "NAME",
"value": "firstName"
},
{
"context": " {\n\t\tthis.firstName = firstName;\n\t\tthis.lastName = lastName;\n\t\tthis.email = email;\n\t\tthis.phone = phone;\n\t\tth",
"end": 1222,
"score": 0.9635738730430603,
"start": 1214,
"tag": "NAME",
"value": "lastName"
},
{
"context": "= phone;\n\t\tthis.active = active;\n\t\tthis.username = username;\n\t\tthis.password = password;\n\t\tthis.idEnterprise ",
"end": 1318,
"score": 0.997855007648468,
"start": 1310,
"tag": "USERNAME",
"value": "username"
},
{
"context": "ive;\n\t\tthis.username = username;\n\t\tthis.password = password;\n\t\tthis.idEnterprise = idEnterprise;\n\t\tthis.role ",
"end": 1346,
"score": 0.9986999034881592,
"start": 1338,
"tag": "PASSWORD",
"value": "password"
},
{
"context": "etFirstName(String firstName) {\n\t\tthis.firstName = firstName;\n\t}\n\n\t@Column(name = \"lastName\", length = 45)\n\tpu",
"end": 1813,
"score": 0.9235347509384155,
"start": 1804,
"tag": "NAME",
"value": "firstName"
},
{
"context": "e) {\n\t\tthis.active = active;\n\t}\n\n\t@Column(name = \"username\", unique = true, nullable = false, length = 45)\n\t",
"end": 2481,
"score": 0.6137310862541199,
"start": 2473,
"tag": "USERNAME",
"value": "username"
}
]
| null | []
| package neu.ying.entities;
// Generated Apr 7, 2017 12:12:31 PM by Hibernate Tools 5.0.4.Final
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
/**
* User generated by hbm2java
*/
@Entity
@Table(name = "User", catalog = "MedicalEcoSystem", uniqueConstraints = @UniqueConstraint(columnNames = "username"))
public class User implements java.io.Serializable {
private Integer idUser;
private String firstName;
private String lastName;
private String email;
private String phone;
private Boolean active;
private String username;
private String password;
private int idEnterprise;
private String role;
public User() {
}
public User(String username, int idEnterprise, String role) {
this.username = username;
this.idEnterprise = idEnterprise;
this.role = role;
}
public User(String firstName, String lastName, String email, String phone, Boolean active, String username,
String password, int idEnterprise, String role) {
this.firstName = firstName;
this.lastName = lastName;
this.email = email;
this.phone = phone;
this.active = active;
this.username = username;
this.password = <PASSWORD>;
this.idEnterprise = idEnterprise;
this.role = role;
}
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "idUser", unique = true, nullable = false)
public Integer getIdUser() {
return this.idUser;
}
public void setIdUser(Integer idUser) {
this.idUser = idUser;
}
@Column(name = "firstName", length = 45)
public String getFirstName() {
return this.firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
@Column(name = "lastName", length = 45)
public String getLastName() {
return this.lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
@Column(name = "email", length = 45)
public String getEmail() {
return this.email;
}
public void setEmail(String email) {
this.email = email;
}
@Column(name = "phone", length = 45)
public String getPhone() {
return this.phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
@Column(name = "active")
public Boolean getActive() {
return this.active;
}
public void setActive(Boolean active) {
this.active = active;
}
@Column(name = "username", unique = true, nullable = false, length = 45)
public String getUsername() {
return this.username;
}
public void setUsername(String username) {
this.username = username;
}
@Column(name = "password", length = 45)
public String getPassword() {
return this.password;
}
public void setPassword(String password) {
this.password = password;
}
@Column(name = "idEnterprise", nullable = false)
public int getIdEnterprise() {
return this.idEnterprise;
}
public void setIdEnterprise(int idEnterprise) {
this.idEnterprise = idEnterprise;
}
@Column(name = "role", nullable = false, length = 12)
public String getRole() {
return this.role;
}
public void setRole(String role) {
this.role = role;
}
}
| 3,214 | 0.718867 | 0.709838 | 145 | 21.151724 | 20.484589 | 116 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.455172 | false | false | 4 |
d9620373ad31a36e2709a019e17d94c2e7e715b2 | 17,489,106,875,483 | 3e76cf1624b832742a93804ab70f88acb1c3bcc1 | /src/main/java/io/blocko/myrealtutor/domain/package-info.java | 2142c255b77de026ca508ee3c18b098834f1b103 | []
| no_license | whlee21/MyRealTutor | https://github.com/whlee21/MyRealTutor | 8b9c99725734aa3d6e709357b0b8221cb9617622 | 4cc3b323d0b5e6adb998ee1b12d17410b5c27509 | refs/heads/master | 2020-03-31T11:26:22.796000 | 2018-10-09T01:51:32 | 2018-10-09T01:51:32 | 152,176,675 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* JPA domain objects.
*/
package io.blocko.myrealtutor.domain;
| UTF-8 | Java | 69 | java | package-info.java | Java | []
| null | []
| /**
* JPA domain objects.
*/
package io.blocko.myrealtutor.domain;
| 69 | 0.695652 | 0.695652 | 4 | 16.25 | 14.271913 | 37 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false | 4 |
a42a4933ac11b8e733240d45317279dcaf859aba | 30,605,937,009,947 | 9bca0e8a7523802bea16b535c6d4617e2bb11ee3 | /src/org/bds/cluster/host/Resources.java | 9d46559bfa0cc0b042808b6406624d7b1b1d50b9 | [
"Apache-2.0"
]
| permissive | landswellsong/bds | https://github.com/landswellsong/bds | b5f65f2453a66e3848bd9a76258024a1ada7005e | f7c12d591d119539b0722edb64457b1859cfae8b | refs/heads/main | 2023-08-15T07:31:04.841000 | 2021-09-18T20:32:36 | 2021-09-18T20:32:36 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.bds.cluster.host;
import org.bds.BdsLog;
import org.bds.util.Gpr;
import org.bds.util.Timer;
import java.io.Serializable;
import java.util.*;
/**
* Represents the resources in a host or resources consumed by a task (e.g. cpus, memory, etc.)
* <p>
* Can be either a host's resources (how many CPU it has) or a job resources (how much time it needs)
* <p>
* Custom resources allow for adding non-standard resources (e.g. GPUs, TPUs, FFPGA and other special devices). The counters
* are indexed by names ('gpu', 'ffpga', etc.).
* <p>
* Any negative number means "information not available"
*
* @author pcingola
*/
public class Resources implements Comparable<Resources>, Cloneable, Serializable, BdsLog {
private static final long serialVersionUID = 764782969174543552L;
private static int hostResourcesNum = 0;
protected int id;
protected int cpus; // Number of CPUs
protected long mem; // Total memory (in Bytes)
protected long timeout; // Time before the process is killed (in seconds). Only processing time, it does not include the time the process is queued for execution by the cluster scheduler.
protected long wallTimeout; // Real time (wall time) before the process is killed (in seconds). This includes the time the process is waiting to be executed.
protected Map<String, Long> customResources;
public Resources() {
cpus = 1; // One CPU
mem = -1; // No memory info
timeout = 0; // No timeout
wallTimeout = 0; // No timeout
customResources = new HashMap<>();
id = nextId();
}
public Resources(Resources hr) {
id = nextId();
set(hr);
}
protected static int nextId() {
return ++hostResourcesNum;
}
/**
* Add resources
*/
public void add(Resources hr) {
if (hr == null) return;
addCpus(hr.cpus);
addMem(hr.mem);
for (String rname : hr.getCustomResources().keySet()) {
setCustomResource(rname, hr.getCustomResource(rname));
}
}
public void addCpus(int cpus) {
if (this.cpus <= 0) this.cpus = cpus;
else this.cpus += cpus;
}
public void addMem(long mem) {
if (this.mem <= 0) this.mem = mem;
else this.mem += mem;
}
@Override
public Resources clone() {
try {
var clonedResources = (Resources) super.clone();
clonedResources.set(this);
return clonedResources;
} catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
}
}
@Override
public int compareTo(Resources hr) {
int cmpCpu = 0;
if (cpus >= 0) {
cmpCpu = cpus - hr.cpus;
if (cmpCpu < 0) return -1;
if (cmpCpu > 0) return 1;
}
long cmpMem = 0;
if (mem >= 0) {
cmpMem = mem - hr.mem;
if (cmpMem < 0) return -1;
if (cmpMem > 0) return 1;
}
// Compare custom resources
if (!customResources.isEmpty()) {
// Compare all resources (sorted by name)
for (String rname : getCustomResourcesNames()) {
if (!hr.hasCustomResource(rname)) return 1;
var rdiff = getCustomResource(rname) - hr.getCustomResource(rname);
if (rdiff > 0) return 1;
if (rdiff < 0) return -1;
}
// Does 'hr' have more resources?
if (customResources.size() < hr.customResources.size()) return -1;
}
return 0;
}
/**
* Consume resources (subtract resources)
*/
public void consume(Resources hr) {
if (hr == null) return;
if ((cpus >= 0) && (hr.cpus >= 0)) cpus = Math.max(0, cpus - hr.cpus);
if ((mem >= 0) && (hr.mem >= 0)) mem = Math.max(0, mem - hr.mem);
// Consume all custom resources
for (String rname : hr.customResources.keySet()) {
consumeCustomResource(rname, hr.getCustomResource(rname));
}
}
/**
* Consume a custom resource 'name'
*
* @return true on success, false on error
*/
protected boolean consumeCustomResource(String name, long quantity) {
var count = getCustomResource(name);
if (count <= 0) return false; // We cannot consume a resource we don't have
var newCount = Math.max(0, count - quantity);
setCustomResource(name, newCount);
return true;
}
public int getCpus() {
return cpus;
}
public void setCpus(int cpus) {
this.cpus = cpus;
}
public Map<String, Long> getCustomResources() {
return customResources;
}
public long getCustomResource(String name) {
var count = customResources.get(name);
return count != null ? count : -1;
}
public void setCustomResource(String name, long count) {
customResources.put(name, count);
}
public Collection<String> getCustomResourcesNames() {
// Note: We sort resources names to ensure comparisons are stable and predictable (i.e. not changing according to how names are hashed)
var shouldSort = customResources.size() > 1; // If there is only one item, there is no need to sort
Collection<String> resourceNames;
if (!shouldSort) return customResources.keySet();
// Create a list and sort it
List<String> names = new ArrayList<>();
names.addAll(customResources.keySet());
Collections.sort(names);
return names;
}
public long getMem() {
return mem;
}
public void setMem(long mem) {
this.mem = mem;
}
public long getTimeout() {
return timeout;
}
public void setTimeout(long timeout) {
this.timeout = timeout;
// Wall-timeout cannot be shorter than timeout
if (wallTimeout > 0 && timeout > wallTimeout) wallTimeout = timeout;
}
public long getWallTimeout() {
return wallTimeout;
}
public void setWallTimeout(long walltimeout) {
wallTimeout = walltimeout;
}
public boolean hasCustomResource(String name) {
return customResources.containsKey(name);
}
/**
* Does this resource have at least 'hr' resources?
*/
public boolean hasResources(Resources r) {
if (cpus >= 0 && r.cpus > 0 && (cpus - r.cpus) < 0) return false;
if ((mem >= 0) && r.mem > 0 && (mem - r.mem) < 0) return false;
// Compare custom resources
var hrCustomResources = r.getCustomResources();
if (!hrCustomResources.isEmpty()) {
// Compare all resources (sorted by name)
for (String rname : r.getCustomResourcesNames()) {
if (!hasCustomResource(rname)) return false;
if (getCustomResource(rname) - r.getCustomResource(rname) < 0) return false;
}
}
return true;
}
/**
* Are all resources consumed?
*/
public boolean isConsumed() {
return (cpus <= 0) && (mem <= 0);
}
public boolean isValid() {
if (cpus == 0) return false;
return mem != 0;
}
public void set(Resources r) {
cpus = r.cpus;
mem = r.mem;
timeout = r.timeout;
wallTimeout = r.wallTimeout;
// Copy all custom resources
customResources = new HashMap<>();
for (Map.Entry<String, Long> e : r.customResources.entrySet()) {
setCustomResource(e.getKey(), e.getValue());
}
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("cpus: " + cpus);
sb.append("\tmem: " + Gpr.toStringMem(mem));
if (timeout > 0) sb.append("\ttimeout: " + timeout);
if (wallTimeout > 0) sb.append("\twall-timeout: " + wallTimeout);
if (!customResources.isEmpty()) {
for (String rname : getCustomResourcesNames()) {
sb.append("\t" + rname + ": " + getCustomResource(rname));
}
}
return sb.toString();
}
public String toStringMultiline() {
StringBuilder sb = new StringBuilder();
if (cpus > 0) sb.append("cpus: " + cpus + ", ");
if (mem > 0) sb.append((sb.length() > 0 ? ", " : "") + "mem: " + Gpr.toStringMem(mem));
if (timeout > 0) sb.append((sb.length() > 0 ? ", " : "") + "timeout: " + Timer.toDDHHMMSS(timeout * 1000));
if (wallTimeout > 0)
sb.append((sb.length() > 0 ? ", " : "") + "walltimeout: " + Timer.toDDHHMMSS(wallTimeout * 1000));
if (!customResources.isEmpty()) {
for (String rname : getCustomResourcesNames()) {
sb.append(rname + ": " + getCustomResource(rname) + "\n");
}
}
return sb.toString();
}
}
| UTF-8 | Java | 8,887 | java | Resources.java | Java | [
{
"context": "er means \"information not available\"\n *\n * @author pcingola\n */\npublic class Resources implements Comparable<",
"end": 632,
"score": 0.999628484249115,
"start": 624,
"tag": "USERNAME",
"value": "pcingola"
}
]
| null | []
| package org.bds.cluster.host;
import org.bds.BdsLog;
import org.bds.util.Gpr;
import org.bds.util.Timer;
import java.io.Serializable;
import java.util.*;
/**
* Represents the resources in a host or resources consumed by a task (e.g. cpus, memory, etc.)
* <p>
* Can be either a host's resources (how many CPU it has) or a job resources (how much time it needs)
* <p>
* Custom resources allow for adding non-standard resources (e.g. GPUs, TPUs, FFPGA and other special devices). The counters
* are indexed by names ('gpu', 'ffpga', etc.).
* <p>
* Any negative number means "information not available"
*
* @author pcingola
*/
public class Resources implements Comparable<Resources>, Cloneable, Serializable, BdsLog {
private static final long serialVersionUID = 764782969174543552L;
private static int hostResourcesNum = 0;
protected int id;
protected int cpus; // Number of CPUs
protected long mem; // Total memory (in Bytes)
protected long timeout; // Time before the process is killed (in seconds). Only processing time, it does not include the time the process is queued for execution by the cluster scheduler.
protected long wallTimeout; // Real time (wall time) before the process is killed (in seconds). This includes the time the process is waiting to be executed.
protected Map<String, Long> customResources;
public Resources() {
cpus = 1; // One CPU
mem = -1; // No memory info
timeout = 0; // No timeout
wallTimeout = 0; // No timeout
customResources = new HashMap<>();
id = nextId();
}
public Resources(Resources hr) {
id = nextId();
set(hr);
}
protected static int nextId() {
return ++hostResourcesNum;
}
/**
* Add resources
*/
public void add(Resources hr) {
if (hr == null) return;
addCpus(hr.cpus);
addMem(hr.mem);
for (String rname : hr.getCustomResources().keySet()) {
setCustomResource(rname, hr.getCustomResource(rname));
}
}
public void addCpus(int cpus) {
if (this.cpus <= 0) this.cpus = cpus;
else this.cpus += cpus;
}
public void addMem(long mem) {
if (this.mem <= 0) this.mem = mem;
else this.mem += mem;
}
@Override
public Resources clone() {
try {
var clonedResources = (Resources) super.clone();
clonedResources.set(this);
return clonedResources;
} catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
}
}
@Override
public int compareTo(Resources hr) {
int cmpCpu = 0;
if (cpus >= 0) {
cmpCpu = cpus - hr.cpus;
if (cmpCpu < 0) return -1;
if (cmpCpu > 0) return 1;
}
long cmpMem = 0;
if (mem >= 0) {
cmpMem = mem - hr.mem;
if (cmpMem < 0) return -1;
if (cmpMem > 0) return 1;
}
// Compare custom resources
if (!customResources.isEmpty()) {
// Compare all resources (sorted by name)
for (String rname : getCustomResourcesNames()) {
if (!hr.hasCustomResource(rname)) return 1;
var rdiff = getCustomResource(rname) - hr.getCustomResource(rname);
if (rdiff > 0) return 1;
if (rdiff < 0) return -1;
}
// Does 'hr' have more resources?
if (customResources.size() < hr.customResources.size()) return -1;
}
return 0;
}
/**
* Consume resources (subtract resources)
*/
public void consume(Resources hr) {
if (hr == null) return;
if ((cpus >= 0) && (hr.cpus >= 0)) cpus = Math.max(0, cpus - hr.cpus);
if ((mem >= 0) && (hr.mem >= 0)) mem = Math.max(0, mem - hr.mem);
// Consume all custom resources
for (String rname : hr.customResources.keySet()) {
consumeCustomResource(rname, hr.getCustomResource(rname));
}
}
/**
* Consume a custom resource 'name'
*
* @return true on success, false on error
*/
protected boolean consumeCustomResource(String name, long quantity) {
var count = getCustomResource(name);
if (count <= 0) return false; // We cannot consume a resource we don't have
var newCount = Math.max(0, count - quantity);
setCustomResource(name, newCount);
return true;
}
public int getCpus() {
return cpus;
}
public void setCpus(int cpus) {
this.cpus = cpus;
}
public Map<String, Long> getCustomResources() {
return customResources;
}
public long getCustomResource(String name) {
var count = customResources.get(name);
return count != null ? count : -1;
}
public void setCustomResource(String name, long count) {
customResources.put(name, count);
}
public Collection<String> getCustomResourcesNames() {
// Note: We sort resources names to ensure comparisons are stable and predictable (i.e. not changing according to how names are hashed)
var shouldSort = customResources.size() > 1; // If there is only one item, there is no need to sort
Collection<String> resourceNames;
if (!shouldSort) return customResources.keySet();
// Create a list and sort it
List<String> names = new ArrayList<>();
names.addAll(customResources.keySet());
Collections.sort(names);
return names;
}
public long getMem() {
return mem;
}
public void setMem(long mem) {
this.mem = mem;
}
public long getTimeout() {
return timeout;
}
public void setTimeout(long timeout) {
this.timeout = timeout;
// Wall-timeout cannot be shorter than timeout
if (wallTimeout > 0 && timeout > wallTimeout) wallTimeout = timeout;
}
public long getWallTimeout() {
return wallTimeout;
}
public void setWallTimeout(long walltimeout) {
wallTimeout = walltimeout;
}
public boolean hasCustomResource(String name) {
return customResources.containsKey(name);
}
/**
* Does this resource have at least 'hr' resources?
*/
public boolean hasResources(Resources r) {
if (cpus >= 0 && r.cpus > 0 && (cpus - r.cpus) < 0) return false;
if ((mem >= 0) && r.mem > 0 && (mem - r.mem) < 0) return false;
// Compare custom resources
var hrCustomResources = r.getCustomResources();
if (!hrCustomResources.isEmpty()) {
// Compare all resources (sorted by name)
for (String rname : r.getCustomResourcesNames()) {
if (!hasCustomResource(rname)) return false;
if (getCustomResource(rname) - r.getCustomResource(rname) < 0) return false;
}
}
return true;
}
/**
* Are all resources consumed?
*/
public boolean isConsumed() {
return (cpus <= 0) && (mem <= 0);
}
public boolean isValid() {
if (cpus == 0) return false;
return mem != 0;
}
public void set(Resources r) {
cpus = r.cpus;
mem = r.mem;
timeout = r.timeout;
wallTimeout = r.wallTimeout;
// Copy all custom resources
customResources = new HashMap<>();
for (Map.Entry<String, Long> e : r.customResources.entrySet()) {
setCustomResource(e.getKey(), e.getValue());
}
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("cpus: " + cpus);
sb.append("\tmem: " + Gpr.toStringMem(mem));
if (timeout > 0) sb.append("\ttimeout: " + timeout);
if (wallTimeout > 0) sb.append("\twall-timeout: " + wallTimeout);
if (!customResources.isEmpty()) {
for (String rname : getCustomResourcesNames()) {
sb.append("\t" + rname + ": " + getCustomResource(rname));
}
}
return sb.toString();
}
public String toStringMultiline() {
StringBuilder sb = new StringBuilder();
if (cpus > 0) sb.append("cpus: " + cpus + ", ");
if (mem > 0) sb.append((sb.length() > 0 ? ", " : "") + "mem: " + Gpr.toStringMem(mem));
if (timeout > 0) sb.append((sb.length() > 0 ? ", " : "") + "timeout: " + Timer.toDDHHMMSS(timeout * 1000));
if (wallTimeout > 0)
sb.append((sb.length() > 0 ? ", " : "") + "walltimeout: " + Timer.toDDHHMMSS(wallTimeout * 1000));
if (!customResources.isEmpty()) {
for (String rname : getCustomResourcesNames()) {
sb.append(rname + ": " + getCustomResource(rname) + "\n");
}
}
return sb.toString();
}
}
| 8,887 | 0.574885 | 0.565545 | 283 | 30.402826 | 29.143612 | 191 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.484099 | false | false | 4 |
d379efaf63516e8ec33f02561e7c42a63e2fc75c | 12,884,901,952,904 | c99eaec384cd16142ef8c9204434051206f7f388 | /OOP Quiz/Question.java | 58607d2dd235de0e083820dc7794b577b58168d5 | []
| no_license | mdiaz10/Diaz_Matthew_cpsc24500 | https://github.com/mdiaz10/Diaz_Matthew_cpsc24500 | 3263a3fea991f1c9f778a07aa0fd2c0d9ada1cd0 | c15aad5403e65a2195865b0a02e2050283b76175 | refs/heads/master | 2023-01-27T19:44:02.380000 | 2020-12-10T01:31:33 | 2020-12-10T01:31:33 | 296,384,280 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
* Implements different question choices
*
*/
public class Question {
// public class Article {
// private String title;
// private String author;
// private String text;
// public String getTitle() {
// return title;
// }
// public void setTitle(String title) {
// this.title = title;
// }
// public String getAuthor() {
// return author;
// }
// public void setAuthor(String author) {
// this.author = author;
// }
// public String getText() {
// return text;
// }
// public void setText(String text) {
// this.text = text;
// }
// public Article(String title, String author, String text) {
// setTitle(title);
// setAuthor(author);
// setText(text);
// }
// @Override
// public String toString() {
// return String.format("%s\n%s\n%s",title,author,text);
// }
// }
public Question(String question,String choice1,String choice2,String choice3,String choice4,String answer) {
setQuestion(question);
setChoice1(choice1);
setChoice2(choice2);
setChoice3(choice3);
setChoice4(choice4);
setAnswer(answer);
}
private String question;
private String choice1;
private String choice2;
private String choice3;
private String choice4;
private String answer;
public void setQuestion(String ques) {
question=ques;
}
public String getQuestion() {
return question;
}
public void setAnswer(String ans) {
answer=ans;
}
public String getAnswer() {
return answer;
}
public void setChoice1(String ch) {
choice1=ch;
}
public String getChoice1() {
return choice1;
}
public void setChoice2(String ch) {
choice2=ch;
}
public String getChoice2() {
return choice2;
}
public void setChoice3(String ch) {
choice3=ch;
}
public String getChoice3() {
return choice3;
}
public void setChoice4(String ch) {
choice4=ch;
}
public String getChoice4() {
return choice4;
}
@Override
public String toString() {
return String.format("%s %s\n",answer,question);
}
}
| UTF-8 | Java | 1,969 | java | Question.java | Java | []
| null | []
|
/**
* Implements different question choices
*
*/
public class Question {
// public class Article {
// private String title;
// private String author;
// private String text;
// public String getTitle() {
// return title;
// }
// public void setTitle(String title) {
// this.title = title;
// }
// public String getAuthor() {
// return author;
// }
// public void setAuthor(String author) {
// this.author = author;
// }
// public String getText() {
// return text;
// }
// public void setText(String text) {
// this.text = text;
// }
// public Article(String title, String author, String text) {
// setTitle(title);
// setAuthor(author);
// setText(text);
// }
// @Override
// public String toString() {
// return String.format("%s\n%s\n%s",title,author,text);
// }
// }
public Question(String question,String choice1,String choice2,String choice3,String choice4,String answer) {
setQuestion(question);
setChoice1(choice1);
setChoice2(choice2);
setChoice3(choice3);
setChoice4(choice4);
setAnswer(answer);
}
private String question;
private String choice1;
private String choice2;
private String choice3;
private String choice4;
private String answer;
public void setQuestion(String ques) {
question=ques;
}
public String getQuestion() {
return question;
}
public void setAnswer(String ans) {
answer=ans;
}
public String getAnswer() {
return answer;
}
public void setChoice1(String ch) {
choice1=ch;
}
public String getChoice1() {
return choice1;
}
public void setChoice2(String ch) {
choice2=ch;
}
public String getChoice2() {
return choice2;
}
public void setChoice3(String ch) {
choice3=ch;
}
public String getChoice3() {
return choice3;
}
public void setChoice4(String ch) {
choice4=ch;
}
public String getChoice4() {
return choice4;
}
@Override
public String toString() {
return String.format("%s %s\n",answer,question);
}
}
| 1,969 | 0.666836 | 0.650584 | 102 | 18.294117 | 16.664267 | 109 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2 | false | false | 4 |
119f7a83666ed54d2d696835a7de63e54dac6cc8 | 16,827,681,898,542 | 998e20c7dec3103368674e51651d43713e441766 | /src/main/java/io/github/kuyer/jbase/design/factory/SendByMail.java | 33d546cde4fa1b8d6ece46cb932124f46abb6f43 | [
"Apache-2.0"
]
| permissive | kuyer/kuyer-jbase | https://github.com/kuyer/kuyer-jbase | 7bc7c5d0f946b9e4c07f8a3a59ade62ad342b052 | d307de4893265de70374065d95bba95ea9687c27 | refs/heads/master | 2021-04-18T23:18:12.435000 | 2017-06-29T12:23:12 | 2017-06-29T12:23:12 | 59,338,718 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package io.github.kuyer.jbase.design.factory;
public class SendByMail implements SendApi {
@Override
public void send() {
System.out.println("send by email.");
}
}
| UTF-8 | Java | 172 | java | SendByMail.java | Java | [
{
"context": "package io.github.kuyer.jbase.design.factory;\n\npublic class SendByMail im",
"end": 23,
"score": 0.707648754119873,
"start": 18,
"tag": "USERNAME",
"value": "kuyer"
}
]
| null | []
| package io.github.kuyer.jbase.design.factory;
public class SendByMail implements SendApi {
@Override
public void send() {
System.out.println("send by email.");
}
}
| 172 | 0.726744 | 0.726744 | 10 | 16.200001 | 18.448849 | 45 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.7 | false | false | 4 |
fc6bdfdfc414faa79e4d772368a964aec32b917e | 12,068,858,154,778 | 4284e465d232690d8300bbe8e7565e654c989463 | /app/src/main/java/org/techtown/android_project/Chatroom.java | af4cf9df2839a929a708ffaa14c31e0a6e787c17 | []
| no_license | alicehan1734/Android_Service_RentApp | https://github.com/alicehan1734/Android_Service_RentApp | fb53a6205d47ef5ea68c2f738c65fa8096d62ebe | c4a7fd5f2eee5d9b6e8b5e8693a59ce9deb0349e | refs/heads/master | 2023-03-09T00:37:24.852000 | 2021-02-24T16:05:47 | 2021-02-24T16:05:47 | 304,376,035 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.techtown.android_project;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.firestore.FirebaseFirestore;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.StorageReference;
import java.util.HashMap;
public class Chatroom extends AppCompatActivity {
TextView TextView_nickname;
ImageView ImageView_back;
ImageView ImageView_chat;
ImageView btn_send;
EditText text_send;
FirebaseUser fuser;
private FirebaseAuth mAuth = FirebaseAuth.getInstance(); //사용자 가져오기
private StorageReference mStorageRef;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_chatroom);
ImageView_back = findViewById(R.id.ImageView_back);
ImageView_chat = findViewById(R.id.ImageView_chat);
TextView_nickname = findViewById(R.id.TextView_nickname);
text_send= findViewById(R.id.EditText_chatbar);
btn_send = findViewById(R.id.send);
Intent intent = getIntent();
TextView_nickname.setText(intent.getStringExtra("nickname"));
ImageView_back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
ImageView_chat.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Chatroom.this, activity_main_favorite.class);
startActivity(intent);
finish();
}
});
mStorageRef = FirebaseStorage.getInstance().getReference("Users").child(mAuth.getCurrentUser().getUid());
}
private void sendMessage(String sender, String receiver, String message) {
mStorageRef = FirebaseStorage.getInstance().getReference("uploads"); //저장소에 관해 정의 해주기
HashMap<String, Object> hashMap = new HashMap<>();
hashMap.put("sender", sender);
hashMap.put("receiver",receiver);
hashMap.put("message",message);
// mStorageRef.child("chats").push().setValue(hashMap);
}
} | UTF-8 | Java | 2,536 | java | Chatroom.java | Java | []
| null | []
| package org.techtown.android_project;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.firestore.FirebaseFirestore;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.StorageReference;
import java.util.HashMap;
public class Chatroom extends AppCompatActivity {
TextView TextView_nickname;
ImageView ImageView_back;
ImageView ImageView_chat;
ImageView btn_send;
EditText text_send;
FirebaseUser fuser;
private FirebaseAuth mAuth = FirebaseAuth.getInstance(); //사용자 가져오기
private StorageReference mStorageRef;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_chatroom);
ImageView_back = findViewById(R.id.ImageView_back);
ImageView_chat = findViewById(R.id.ImageView_chat);
TextView_nickname = findViewById(R.id.TextView_nickname);
text_send= findViewById(R.id.EditText_chatbar);
btn_send = findViewById(R.id.send);
Intent intent = getIntent();
TextView_nickname.setText(intent.getStringExtra("nickname"));
ImageView_back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
ImageView_chat.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Chatroom.this, activity_main_favorite.class);
startActivity(intent);
finish();
}
});
mStorageRef = FirebaseStorage.getInstance().getReference("Users").child(mAuth.getCurrentUser().getUid());
}
private void sendMessage(String sender, String receiver, String message) {
mStorageRef = FirebaseStorage.getInstance().getReference("uploads"); //저장소에 관해 정의 해주기
HashMap<String, Object> hashMap = new HashMap<>();
hashMap.put("sender", sender);
hashMap.put("receiver",receiver);
hashMap.put("message",message);
// mStorageRef.child("chats").push().setValue(hashMap);
}
} | 2,536 | 0.6852 | 0.6852 | 80 | 30.262501 | 26.505539 | 113 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6375 | false | false | 4 |
ed281d328f8539bebb760ebda480614631eb4621 | 29,892,972,417,244 | 09cf01fce647dbc12101952fd4da8a301e6c6166 | /NameServerFrame/src/nameServerFrame/ServerBox.java | bf779f51c6dde3fd8b5cfd2cfdae49f15c116ac2 | []
| no_license | penghao1023/NameServer | https://github.com/penghao1023/NameServer | c0b50199d5375ceec6ad3af3b045a1018cf70e92 | 27510666638e37ea0cf0cd86f5ceb6c36bce0592 | refs/heads/master | 2021-06-12T17:32:37.811000 | 2017-03-01T16:48:00 | 2017-03-01T16:48:00 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package nameServerFrame;
import java.util.concurrent.ConcurrentHashMap;
import nameServerInterface.IServer;
/**
* 服务盒子
* 一个盒子一个中间代理,一个中间代理启动一个接收
* @author jinyu
*
*/
public class ServerBox {
public ServerBox(Sever_BindsInfo proxyInfo)
{
if(serverProxy==null)
{
serverProxy=new ServerPorxy(proxyInfo.address,proxyInfo.port,proxyInfo.t_type);
ProxyInfo=proxyInfo;
}
}
private ConcurrentHashMap<String,IServer> serverBox=new ConcurrentHashMap<String,IServer>();
/**
* 服务通讯代理
*/
public ServerPorxy serverProxy=null;
/**
* 服务端代理信息(IP,Port,传输)
*/
public Sever_BindsInfo ProxyInfo=null;
/**
*
* @Name: AddServer
* @Description: 添加服务到服务盒子
* @param serverName 服务名称
* @param server 服务
* @return void 返回类型
* @throws
*/
public void AddServer(String serverName,IServer server)
{
serverBox.put(serverName, server);
serverProxy.InitServerThread(serverName, server);
}
/**
*
* @Name: GetServer
* @Description: 获取服务
* @param serverName 服务名称
* @return 服务实例
* @return IServer 服务实例
* @throws
*/
public IServer GetServer(String serverName)
{
return serverBox.get(serverName);
}
}
| GB18030 | Java | 1,348 | java | ServerBox.java | Java | [
{
"context": "\n/**\n * 服务盒子\n * 一个盒子一个中间代理,一个中间代理启动一个接收\n * @author jinyu\n *\n */\npublic class ServerBox {\n\tpublic ServerBox",
"end": 168,
"score": 0.9980978965759277,
"start": 163,
"tag": "USERNAME",
"value": "jinyu"
}
]
| null | []
| package nameServerFrame;
import java.util.concurrent.ConcurrentHashMap;
import nameServerInterface.IServer;
/**
* 服务盒子
* 一个盒子一个中间代理,一个中间代理启动一个接收
* @author jinyu
*
*/
public class ServerBox {
public ServerBox(Sever_BindsInfo proxyInfo)
{
if(serverProxy==null)
{
serverProxy=new ServerPorxy(proxyInfo.address,proxyInfo.port,proxyInfo.t_type);
ProxyInfo=proxyInfo;
}
}
private ConcurrentHashMap<String,IServer> serverBox=new ConcurrentHashMap<String,IServer>();
/**
* 服务通讯代理
*/
public ServerPorxy serverProxy=null;
/**
* 服务端代理信息(IP,Port,传输)
*/
public Sever_BindsInfo ProxyInfo=null;
/**
*
* @Name: AddServer
* @Description: 添加服务到服务盒子
* @param serverName 服务名称
* @param server 服务
* @return void 返回类型
* @throws
*/
public void AddServer(String serverName,IServer server)
{
serverBox.put(serverName, server);
serverProxy.InitServerThread(serverName, server);
}
/**
*
* @Name: GetServer
* @Description: 获取服务
* @param serverName 服务名称
* @return 服务实例
* @return IServer 服务实例
* @throws
*/
public IServer GetServer(String serverName)
{
return serverBox.get(serverName);
}
}
| 1,348 | 0.678992 | 0.678992 | 63 | 17.888889 | 19.702639 | 94 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.936508 | false | false | 4 |
4ab64538612fd83273bf4a5fca8046cbee4e407e | 28,467,043,275,159 | 40944b63e0ac81a93fa040110fb74b3ac2b83026 | /src/main/java/com/pangio/magazine/api/exception/ArticleNotFoundException.java | 7adef4b3f89f74ff31bb7ed02c1dcd4f9a7bb715 | []
| no_license | pangio/java-spring-boot-restful-api | https://github.com/pangio/java-spring-boot-restful-api | a56b062c66de332589a4d3e7c43557db92ecd4df | 073285b3a1d90bdab5a3943cd0fe00afc1100e41 | refs/heads/master | 2016-09-06T18:55:00.559000 | 2015-03-22T00:19:38 | 2015-03-22T00:19:38 | 31,178,250 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.pangio.magazine.api.exception;
import com.pangio.magazine.api.domain.Article;
/**
* This exception is thrown when an {@link Article}is not found.
* @author pangio
*/
public class ArticleNotFoundException extends RuntimeException{
/**
* Unique ID for Serialized object
*/
private static final long serialVersionUID = 4268181103917531067L;
/**
* Constructor of the exception
* @param articleId
*/
public ArticleNotFoundException(Long articleId) {
super("The Article with id " + articleId + " doesn't exist");
}
}
| UTF-8 | Java | 547 | java | ArticleNotFoundException.java | Java | [
{
"context": "wn when an {@link Article}is not found.\n * @author pangio\n */\npublic class ArticleNotFoundException extends",
"end": 178,
"score": 0.9992475509643555,
"start": 172,
"tag": "USERNAME",
"value": "pangio"
}
]
| null | []
| package com.pangio.magazine.api.exception;
import com.pangio.magazine.api.domain.Article;
/**
* This exception is thrown when an {@link Article}is not found.
* @author pangio
*/
public class ArticleNotFoundException extends RuntimeException{
/**
* Unique ID for Serialized object
*/
private static final long serialVersionUID = 4268181103917531067L;
/**
* Constructor of the exception
* @param articleId
*/
public ArticleNotFoundException(Long articleId) {
super("The Article with id " + articleId + " doesn't exist");
}
}
| 547 | 0.73309 | 0.698355 | 23 | 22.782608 | 24.662868 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.695652 | false | false | 4 |
1b3390e9e4f63885acb47e1eb88a9b4ed8497a7a | 10,058,813,436,007 | 5c900bde5d09a6f5fc43eff173a165dc56921434 | /src/test/java/pl/example/spring/Teczka/studentServiceTest.java | 861e6cda83325de12caa7fc0fc743c813842564a | []
| no_license | Ossj400/Teczka | https://github.com/Ossj400/Teczka | 0bde6abf4c48f04a3a064a6a7b8907984ad13a14 | f4957def2bfba6d471f4d65126141742866b60b7 | refs/heads/master | 2020-08-14T11:58:37.722000 | 2019-12-12T21:45:12 | 2019-12-12T21:45:12 | 215,164,654 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package pl.example.spring.Teczka;
import org.junit.After;
import org.junit.Test;
import io.vavr.collection.List;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import pl.example.spring.Teczka.db.ScoreRepository;
import pl.example.spring.Teczka.db.ScoreRow;
import pl.example.spring.Teczka.db.StudentRepository;
import static org.junit.Assert.*;
@RunWith(SpringRunner.class)
@SpringBootTest
public class studentServiceTest
{
@After
public void cleanAfterTest()
{
this.repository.deleteAll();
}
@Autowired
private StudentRepository repository;
@Autowired
private ScoreRepository scoreRepository;
@Test
public void getEmptyList() {
final StudentService service = new StudentService(repository, scoreRepository);
List<Student> students = service.getStudents();
assertTrue(students.isEmpty());
}
@Test
public void addStudent() {
final StudentService service = new StudentService(repository, scoreRepository);
final Student created = service.addStudent(new NewStudent(1, "Student1", "IP", "1"));
assertNotNull(created);
}
@Test
public void addStudentIsReturned()
{
final StudentService controller = new StudentService(repository, scoreRepository);
final Student student = controller.addStudent(new NewStudent(1, "TEst", "T", "1"));
final List<Student> all = controller.getStudents();
assertEquals(1, all.length());
assertEquals(all.get().id, student.id);
assertEquals(all.get().name, student.name);
assertEquals(all.get().number, student.number);
assertEquals(all.get().stud_group, student.stud_group);
}
@Test
public void addStudentHasNewId() // Double test
{
final StudentService service = new StudentService(repository, scoreRepository);
service.addStudent(new NewStudent(1, "a", "b", "c"));
service.addStudent(new NewStudent(1, "b", "b", "c"));
final List<Student> all = service.getStudents();
assertEquals(2,service.getStudents().size());
assertNotEquals(all.get(0).id,all.get(1).id);
}
} | UTF-8 | Java | 2,328 | java | studentServiceTest.java | Java | []
| null | []
| package pl.example.spring.Teczka;
import org.junit.After;
import org.junit.Test;
import io.vavr.collection.List;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import pl.example.spring.Teczka.db.ScoreRepository;
import pl.example.spring.Teczka.db.ScoreRow;
import pl.example.spring.Teczka.db.StudentRepository;
import static org.junit.Assert.*;
@RunWith(SpringRunner.class)
@SpringBootTest
public class studentServiceTest
{
@After
public void cleanAfterTest()
{
this.repository.deleteAll();
}
@Autowired
private StudentRepository repository;
@Autowired
private ScoreRepository scoreRepository;
@Test
public void getEmptyList() {
final StudentService service = new StudentService(repository, scoreRepository);
List<Student> students = service.getStudents();
assertTrue(students.isEmpty());
}
@Test
public void addStudent() {
final StudentService service = new StudentService(repository, scoreRepository);
final Student created = service.addStudent(new NewStudent(1, "Student1", "IP", "1"));
assertNotNull(created);
}
@Test
public void addStudentIsReturned()
{
final StudentService controller = new StudentService(repository, scoreRepository);
final Student student = controller.addStudent(new NewStudent(1, "TEst", "T", "1"));
final List<Student> all = controller.getStudents();
assertEquals(1, all.length());
assertEquals(all.get().id, student.id);
assertEquals(all.get().name, student.name);
assertEquals(all.get().number, student.number);
assertEquals(all.get().stud_group, student.stud_group);
}
@Test
public void addStudentHasNewId() // Double test
{
final StudentService service = new StudentService(repository, scoreRepository);
service.addStudent(new NewStudent(1, "a", "b", "c"));
service.addStudent(new NewStudent(1, "b", "b", "c"));
final List<Student> all = service.getStudents();
assertEquals(2,service.getStudents().size());
assertNotEquals(all.get(0).id,all.get(1).id);
}
} | 2,328 | 0.695876 | 0.690722 | 69 | 32.753624 | 27.224459 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.84058 | false | false | 4 |
c46d4b025d8474adb8d738b9a7989f24adb6990b | 21,474,836,521,256 | 67d0c4a542cc27bb10e0ceca1f07a9f478cc2317 | /src/com/xjgc/wind/datastatistics/web/action/MeastypeDataAction.java | 032f944a878d98cda2269badd94c7dd5c849774b | []
| no_license | willingox/DWE8000-REPORT | https://github.com/willingox/DWE8000-REPORT | 6b8ed454a47e36004a5660438d7ed1a6eae27cbd | 492a4aa34aff08dee468a6d2fc4a029dd2f704cf | refs/heads/master | 2023-07-20T20:36:51.001000 | 2021-09-08T08:21:58 | 2021-09-08T08:21:58 | 404,266,299 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.xjgc.wind.datastatistics.web.action;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.Iterator;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionServlet;
import org.apache.struts.actions.DispatchAction;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import com.xjgc.wind.datastatistics.service.IMeastypeService;
import com.xjgc.wind.datastatistics.vo.DataStatisticsDataVo;
public class MeastypeDataAction extends DispatchAction {
private static final Log log = LogFactory.getLog(MeastypeDataAction.class);
IMeastypeService meastypeService;
public void setServlet(ActionServlet servlet) {
super.setServlet(servlet);
WebApplicationContext wac = WebApplicationContextUtils
.getRequiredWebApplicationContext(servlet.getServletContext());
meastypeService = (IMeastypeService) wac.getBean("meastypeService");
}
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
if (log.isDebugEnabled())
log.debug("entering 'execute' method ...");
String method = request.getParameter("method");
if (StringUtils.isBlank(method))
return show(mapping, form, request, response);
else
return super.execute(mapping, form, request, response);
}
//
public ActionForward show(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
if (log.isDebugEnabled())
log.debug("entering 'show' method ...");
//
return mapping.findForward("show");
}
}
| UTF-8 | Java | 2,207 | java | MeastypeDataAction.java | Java | []
| null | []
| package com.xjgc.wind.datastatistics.web.action;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.Iterator;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionServlet;
import org.apache.struts.actions.DispatchAction;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import com.xjgc.wind.datastatistics.service.IMeastypeService;
import com.xjgc.wind.datastatistics.vo.DataStatisticsDataVo;
public class MeastypeDataAction extends DispatchAction {
private static final Log log = LogFactory.getLog(MeastypeDataAction.class);
IMeastypeService meastypeService;
public void setServlet(ActionServlet servlet) {
super.setServlet(servlet);
WebApplicationContext wac = WebApplicationContextUtils
.getRequiredWebApplicationContext(servlet.getServletContext());
meastypeService = (IMeastypeService) wac.getBean("meastypeService");
}
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
if (log.isDebugEnabled())
log.debug("entering 'execute' method ...");
String method = request.getParameter("method");
if (StringUtils.isBlank(method))
return show(mapping, form, request, response);
else
return super.execute(mapping, form, request, response);
}
//
public ActionForward show(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
if (log.isDebugEnabled())
log.debug("entering 'show' method ...");
//
return mapping.findForward("show");
}
}
| 2,207 | 0.78976 | 0.78976 | 69 | 30.884058 | 25.145107 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.913043 | false | false | 4 |
e7f8c4c1ac5f0100b64a6f5342ad965177752fcb | 841,813,627,412 | c1d1107bd123e86794e3663093013aa56d46a7c6 | /j2se_basic/src/com/jing/io/GetFilesName.java | 60595491f5057ce3e0b385e5076473567f190faa | []
| no_license | PreacherJing/JavaSE | https://github.com/PreacherJing/JavaSE | 06cde3d69e6b578865458a3f0bcc0dcac050dc58 | 417b1489e9b30d2a423b541c2f8e9fe734bb6aae | refs/heads/master | 2016-09-07T00:23:15.679000 | 2015-05-21T02:20:13 | 2015-05-21T02:20:13 | 18,625,197 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.jing.io;
import java.io.File;
import java.io.IOException;
/**
* 获取文件列表,查找重复文件
* @author Administrator
*
*/
public class GetFilesName {
public static String space = "";
public static void main(String[] args) throws IOException {
fileList(new File("E:\\个人文件夹"));
}
private static void fileList(File file) {
if(file.isDirectory()){
// System.out.println("parent:"+file.getParent());
System.out.println(space + "Dir:"+file.getPath());
space += " ";
File files[] = file.listFiles();
for(int i=0;i<files.length;i++){
fileList(files[i]);
}
space = space.substring(0,space.length()-4<0?0:space.length()-4);
} else {
// System.out.println(file.getName().endsWith(".java"));
// System.out.println(space + "File:"+file.getName());
// System.out.println("fileName:" + file.getAbsolutePath()+
// "--parent:"+file.getParent());
}
}
}
| UTF-8 | Java | 963 | java | GetFilesName.java | Java | [
{
"context": "io.IOException;\r\n/**\r\n * 获取文件列表,查找重复文件\r\n * @author Administrator\r\n *\r\n */\r\npublic class GetFilesName {\r\n\r\n\tpublic ",
"end": 120,
"score": 0.9619114995002747,
"start": 107,
"tag": "NAME",
"value": "Administrator"
}
]
| null | []
| package com.jing.io;
import java.io.File;
import java.io.IOException;
/**
* 获取文件列表,查找重复文件
* @author Administrator
*
*/
public class GetFilesName {
public static String space = "";
public static void main(String[] args) throws IOException {
fileList(new File("E:\\个人文件夹"));
}
private static void fileList(File file) {
if(file.isDirectory()){
// System.out.println("parent:"+file.getParent());
System.out.println(space + "Dir:"+file.getPath());
space += " ";
File files[] = file.listFiles();
for(int i=0;i<files.length;i++){
fileList(files[i]);
}
space = space.substring(0,space.length()-4<0?0:space.length()-4);
} else {
// System.out.println(file.getName().endsWith(".java"));
// System.out.println(space + "File:"+file.getName());
// System.out.println("fileName:" + file.getAbsolutePath()+
// "--parent:"+file.getParent());
}
}
}
| 963 | 0.613808 | 0.607336 | 34 | 25.264706 | 21.045202 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.029412 | false | false | 4 |
99d44fc42e5836f873ee1de16648148c9781e003 | 28,389,733,857,812 | 77baaae93f2b8ebf39ccca5ca9f117620bc106f6 | /src/main/java/com/skovalenko/geocoder/address_parser/us/ParserUtilities.java | 3d6357b3f73c0e892c74c3c9f61ba19121600865 | [
"MIT"
]
| permissive | bkm71A/us_address_parser | https://github.com/bkm71A/us_address_parser | a3ef6e26b5e946ae087f67b5b0e1707d1f1151e8 | e115494b20d1a0a440e040886f80da30254d18c7 | refs/heads/master | 2021-01-13T03:54:41.684000 | 2017-01-09T12:16:09 | 2017-01-09T12:16:09 | 78,225,610 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.skovalenko.geocoder.address_parser.us;
import com.skovalenko.geocoder.address_parser.us.AddressToken.HintTypes;
public class ParserUtilities {
private static final char NOISE_CHARS[] = { '~', '!', '@', '$', '%', '^', '&', '*', '_', '+', '=', '|', '<', '>', '?', '/', '-', '.', '(', ')', '{', '}',
'[', ']', '|', '\'', '"', ',' }; // '#'
/**
* Checks if a supplied string contains only digits. A character is
* considered to be a digit if it is not in the range '\u2000' <= ch <=
* '\u2FFF' and its Unicode name contains the word "DIGIT".
*
* @param checkString
* The String to be checked
* @return true if the String contains only digits, false otherwise
*/
public static boolean isNumeric(String checkString) {
if (checkString == null || checkString.length() == 0) {
return false;
}
for (int i = 0; i < checkString.length(); i++) {
boolean check = Character.isDigit(checkString.charAt(i));
if (!check) {
return false;
}
}
return true;
}
private static String removeNoiseCharacters(String src) {
String retVal = src;
for (int j = 0; j < NOISE_CHARS.length; j++) {
retVal = retVal.replace(NOISE_CHARS[j], ' ');
}
return retVal;
}
private static String collapseSpaces(String newString) {
StringBuffer sb = new StringBuffer();
boolean lastCharWasSpace = false;
for (int i = 0; i < newString.length(); i++) {
if (!lastCharWasSpace || newString.charAt(i) != ' ') {
sb.append(newString.charAt(i));
}
lastCharWasSpace = (newString.charAt(i) == ' ');
}
return sb.toString().trim();
}
public static String normalizeString(String str) {
if (str == null) return null;
return collapseSpaces(removeNoiseCharacters(str.trim().toUpperCase()));
}
public static String parseZip(String zip) {
if (zip == null) return null;
String _zip = normalizeString(zip);
if (_zip.length() < 5 && _zip.length() > 1) {
_zip = "00000".substring(5 - zip.length()) + zip;
}
if (!isNumeric(_zip) || _zip.length() != 5) {
return null;
}
return _zip;
}
public static String parseCity(String city) {
return normalizeString(city);
}
public static String normalizeAddressLine(String address) {
return normalizeString(address.replaceAll("#", "# "));
}
public static int findFirstHintPosition(AddressToken[] addressTokens, HintTypes hint) {
for (int x = 0; x < addressTokens.length; x++) {
if (addressTokens[x].getHint() == hint) return x;
}
return -1;
}
public static int findLastHintPosition(AddressToken[] addressTokens, HintTypes hint) {
for (int x = addressTokens.length - 1; x > -1; x--) {
if (addressTokens[x].getHint() == hint) return x;
}
return -1;
}
public static String getValueFromTokens(AddressToken[] addressTokens, HintTypes hint) {
for (int x = 0; x < addressTokens.length; x++) {
if (addressTokens[x].getHint() == hint) return addressTokens[x].getToken();
}
return "";
}
public static String nullSafeUpperCase(String text) {
return (text == null) ? "" : text.toUpperCase();
}
}
| UTF-8 | Java | 3,507 | java | ParserUtilities.java | Java | []
| null | []
| package com.skovalenko.geocoder.address_parser.us;
import com.skovalenko.geocoder.address_parser.us.AddressToken.HintTypes;
public class ParserUtilities {
private static final char NOISE_CHARS[] = { '~', '!', '@', '$', '%', '^', '&', '*', '_', '+', '=', '|', '<', '>', '?', '/', '-', '.', '(', ')', '{', '}',
'[', ']', '|', '\'', '"', ',' }; // '#'
/**
* Checks if a supplied string contains only digits. A character is
* considered to be a digit if it is not in the range '\u2000' <= ch <=
* '\u2FFF' and its Unicode name contains the word "DIGIT".
*
* @param checkString
* The String to be checked
* @return true if the String contains only digits, false otherwise
*/
public static boolean isNumeric(String checkString) {
if (checkString == null || checkString.length() == 0) {
return false;
}
for (int i = 0; i < checkString.length(); i++) {
boolean check = Character.isDigit(checkString.charAt(i));
if (!check) {
return false;
}
}
return true;
}
private static String removeNoiseCharacters(String src) {
String retVal = src;
for (int j = 0; j < NOISE_CHARS.length; j++) {
retVal = retVal.replace(NOISE_CHARS[j], ' ');
}
return retVal;
}
private static String collapseSpaces(String newString) {
StringBuffer sb = new StringBuffer();
boolean lastCharWasSpace = false;
for (int i = 0; i < newString.length(); i++) {
if (!lastCharWasSpace || newString.charAt(i) != ' ') {
sb.append(newString.charAt(i));
}
lastCharWasSpace = (newString.charAt(i) == ' ');
}
return sb.toString().trim();
}
public static String normalizeString(String str) {
if (str == null) return null;
return collapseSpaces(removeNoiseCharacters(str.trim().toUpperCase()));
}
public static String parseZip(String zip) {
if (zip == null) return null;
String _zip = normalizeString(zip);
if (_zip.length() < 5 && _zip.length() > 1) {
_zip = "00000".substring(5 - zip.length()) + zip;
}
if (!isNumeric(_zip) || _zip.length() != 5) {
return null;
}
return _zip;
}
public static String parseCity(String city) {
return normalizeString(city);
}
public static String normalizeAddressLine(String address) {
return normalizeString(address.replaceAll("#", "# "));
}
public static int findFirstHintPosition(AddressToken[] addressTokens, HintTypes hint) {
for (int x = 0; x < addressTokens.length; x++) {
if (addressTokens[x].getHint() == hint) return x;
}
return -1;
}
public static int findLastHintPosition(AddressToken[] addressTokens, HintTypes hint) {
for (int x = addressTokens.length - 1; x > -1; x--) {
if (addressTokens[x].getHint() == hint) return x;
}
return -1;
}
public static String getValueFromTokens(AddressToken[] addressTokens, HintTypes hint) {
for (int x = 0; x < addressTokens.length; x++) {
if (addressTokens[x].getHint() == hint) return addressTokens[x].getToken();
}
return "";
}
public static String nullSafeUpperCase(String text) {
return (text == null) ? "" : text.toUpperCase();
}
}
| 3,507 | 0.550613 | 0.54377 | 101 | 33.722771 | 29.825605 | 157 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.841584 | false | false | 4 |
44af9cb00784e95d283178dd8ec4d81f0e48810e | 738,734,413,975 | 5d5ec7756cbdb46d3e5e4e69ac7d02751eac1031 | /Sunday19/src/main/java/sunday/Google.java | a089a26be2b4406b551b6600f9797531bcfbe84e | []
| no_license | srenevasanks/Sunday19 | https://github.com/srenevasanks/Sunday19 | 193d81cd21934cb483f59e946e38d9c65ad594c1 | a9e86caeddf75424359c3c98f86014548c518a5c | refs/heads/master | 2023-05-11T09:00:29.836000 | 2020-01-19T11:13:54 | 2020-01-19T11:13:54 | 234,886,094 | 0 | 0 | null | false | 2023-05-09T18:39:00 | 2020-01-19T11:06:50 | 2020-01-19T11:14:40 | 2023-05-09T18:38:57 | 4,170 | 0 | 0 | 2 | Java | false | false | package sunday;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.Test;
public class Google {
@Test
public void google() throws InterruptedException {
System.setProperty("webdriver.chrome.driver", "./drivers/chromedriver.exe");
ChromeDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get("https://www.gmail.com/");
Thread.sleep(2000);
driver.close();
}
}
| UTF-8 | Java | 432 | java | Google.java | Java | []
| null | []
| package sunday;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.Test;
public class Google {
@Test
public void google() throws InterruptedException {
System.setProperty("webdriver.chrome.driver", "./drivers/chromedriver.exe");
ChromeDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get("https://www.gmail.com/");
Thread.sleep(2000);
driver.close();
}
}
| 432 | 0.733796 | 0.724537 | 17 | 24.411764 | 22.152039 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.470588 | false | false | 4 |
4bc428703da3c34867ebd8755557102e4b6fc685 | 38,319,698,220,316 | 7db9a483f4331ae63f4ed1586690672e79cdcabb | /01_ExoJava/src/dtfraca/Exo01_Print/DemoPrint.java | ef5ac557efa4208aabf2685038a9ae820966e4c5 | []
| no_license | dtFraca/Javamatik | https://github.com/dtFraca/Javamatik | e7ba7e0b8c5dad417fd2a82eafef24e943616d9f | fa624f3def19a9aaa7ecf65602222eb5342897e4 | refs/heads/master | 2020-06-02T09:06:02.085000 | 2015-04-22T04:04:11 | 2015-04-22T04:04:11 | 8,131,669 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package dtfraca.Exo01_Print;
public class DemoPrint {
/**
* Jouer avec System.out.print
* 2013-01-27 - David
*/
public static void main(String[] args) {
//print(): affiche SANS descendre à la ligne
System.out.print("123456");
System.out.print("#");
//println(): afficher le texte ET descendre à la ligne
System.out.println(); // println() sans texte = afficher une ligne vide
System.out.println("Voici la deuxième ligne");
System.out.println("Nombres non alignés (pas de formatage)");
System.out.println(5);
System.out.println(25);
System.out.println(235 + " - NOTE: les nombres sont justifies a gauche");
System.out.println();
System.out.println("Nombres Alignés par printf()");
System.out.printf("%5d - FORMAT: %%5d = longueur 5, completer a gauche par des espaces \n", 5);
System.out.printf("%5d - FORMAT: %%5d\n", 25);
System.out.printf("%05d - FORMAT: %%05d = longueur 5, completer a gauche par des 0\n", 250);
// formatage de valeur decimale
double prixPaquetde3 = 100.0;
System.out.println();
System.out.printf("Test1 - decimal non formaté........: %f / 3.0 = %f\n", prixPaquetde3, prixPaquetde3 / 3); //%f = resultat valeure flottante
System.out.printf("Test2 - decimal limité à 2 chiffres: %.2f / 3.0 = %.2f\n\n", prixPaquetde3, prixPaquetde3 / 3); //2 chiffres apres virgule
// Pouquoi printf est plus pratique
int monAge = 13;
String monNom = "David";
String debutTexte = "Je m'apelle";
System.out.println(debutTexte + " " + monNom + ", j'ai " + monAge + " ans, qui fait " + monAge * 365 + " jours");
System.out.printf("%s %s, j'ai %d ans, qui fait %d jours\n", debutTexte, monNom, monAge, monAge * 365);
// autre format special de printf()
System.out.printf("\tUn TAB avant d'afficher...\tVoici un autre TAB\tEt Re-TAB\n");
System.out.printf("ABC\ta\tb\tC\t1\t2\t3\t€\t$\n");
}
}
| UTF-8 | Java | 1,879 | java | DemoPrint.java | Java | [
{
"context": "*\n\t * Jouer avec System.out.print\n\t * 2013-01-27 - David\n\t */\n\tpublic static void main(String[] args) {\n\t\t",
"end": 115,
"score": 0.9996098875999451,
"start": 110,
"tag": "NAME",
"value": "David"
},
{
"context": "us pratique\n\t\tint monAge = 13;\n\t\tString monNom = \"David\";\n\t\tString debutTexte = \"Je m'apelle\";\n\t\tSystem.o",
"end": 1422,
"score": 0.9998397827148438,
"start": 1417,
"tag": "NAME",
"value": "David"
}
]
| null | []
| package dtfraca.Exo01_Print;
public class DemoPrint {
/**
* Jouer avec System.out.print
* 2013-01-27 - David
*/
public static void main(String[] args) {
//print(): affiche SANS descendre à la ligne
System.out.print("123456");
System.out.print("#");
//println(): afficher le texte ET descendre à la ligne
System.out.println(); // println() sans texte = afficher une ligne vide
System.out.println("Voici la deuxième ligne");
System.out.println("Nombres non alignés (pas de formatage)");
System.out.println(5);
System.out.println(25);
System.out.println(235 + " - NOTE: les nombres sont justifies a gauche");
System.out.println();
System.out.println("Nombres Alignés par printf()");
System.out.printf("%5d - FORMAT: %%5d = longueur 5, completer a gauche par des espaces \n", 5);
System.out.printf("%5d - FORMAT: %%5d\n", 25);
System.out.printf("%05d - FORMAT: %%05d = longueur 5, completer a gauche par des 0\n", 250);
// formatage de valeur decimale
double prixPaquetde3 = 100.0;
System.out.println();
System.out.printf("Test1 - decimal non formaté........: %f / 3.0 = %f\n", prixPaquetde3, prixPaquetde3 / 3); //%f = resultat valeure flottante
System.out.printf("Test2 - decimal limité à 2 chiffres: %.2f / 3.0 = %.2f\n\n", prixPaquetde3, prixPaquetde3 / 3); //2 chiffres apres virgule
// Pouquoi printf est plus pratique
int monAge = 13;
String monNom = "David";
String debutTexte = "Je m'apelle";
System.out.println(debutTexte + " " + monNom + ", j'ai " + monAge + " ans, qui fait " + monAge * 365 + " jours");
System.out.printf("%s %s, j'ai %d ans, qui fait %d jours\n", debutTexte, monNom, monAge, monAge * 365);
// autre format special de printf()
System.out.printf("\tUn TAB avant d'afficher...\tVoici un autre TAB\tEt Re-TAB\n");
System.out.printf("ABC\ta\tb\tC\t1\t2\t3\t€\t$\n");
}
}
| 1,879 | 0.665062 | 0.627073 | 47 | 38.765957 | 37.543285 | 145 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.255319 | false | false | 4 |
cafd3f1ee5fc9f5baad78aacfa48370373ff26dc | 34,488,587,428,517 | a0980e4a6c108e796a1d99c66367f740e4ce5ab2 | /app/src/main/java/com/example/joel_mora/joelmorauala/Utiles/PicassoImageLoader.java | 4b0bdbb69b008d8d9013c8f98d33051c89e96405 | []
| no_license | joelmora9618/UALA | https://github.com/joelmora9618/UALA | afcdaa8a0b02d3d5aa06ec05bd3e24dc3a054647 | a15fa867ef57a7df4be64e45de46b5fc8778e105 | refs/heads/master | 2020-03-30T01:58:39.125000 | 2018-10-03T13:01:01 | 2018-10-03T13:01:01 | 150,605,509 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.joel_mora.joelmorauala.Utiles;
import android.content.Context;
import android.widget.ImageView;
import com.squareup.picasso.Callback;
import com.squareup.picasso.Downloader;
import com.squareup.picasso.OkHttpDownloader;
import com.squareup.picasso.Picasso;
public class PicassoImageLoader implements ImageLoader {
private Picasso picasso;
private Context mContext;
public PicassoImageLoader(Context context) {
mContext = context;
Downloader downloader = new OkHttpDownloader(mContext, Integer.MAX_VALUE);
Picasso.Builder builder = new Picasso.Builder(mContext);
builder.downloader(downloader);
picasso = builder.build();
}
@Override
public void loadImage(String url, ImageView imageView){
picasso.with(mContext).load(url).into(imageView);
}
@Override
public void loadImage(String url, ImageView imageView, final ImageLoaderCallBack imageLoaderCallBack){
picasso.with(mContext).load(url).into(imageView, new Callback() {
@Override
public void onSuccess() {
imageLoaderCallBack.onSuccess();
}
@Override
public void onError() {
imageLoaderCallBack.onError();
}
});
}
}
| UTF-8 | Java | 1,304 | java | PicassoImageLoader.java | Java | [
{
"context": "package com.example.joel_mora.joelmorauala.Utiles;\n\nimport android.content.Cont",
"end": 29,
"score": 0.9983742833137512,
"start": 20,
"tag": "USERNAME",
"value": "joel_mora"
}
]
| null | []
| package com.example.joel_mora.joelmorauala.Utiles;
import android.content.Context;
import android.widget.ImageView;
import com.squareup.picasso.Callback;
import com.squareup.picasso.Downloader;
import com.squareup.picasso.OkHttpDownloader;
import com.squareup.picasso.Picasso;
public class PicassoImageLoader implements ImageLoader {
private Picasso picasso;
private Context mContext;
public PicassoImageLoader(Context context) {
mContext = context;
Downloader downloader = new OkHttpDownloader(mContext, Integer.MAX_VALUE);
Picasso.Builder builder = new Picasso.Builder(mContext);
builder.downloader(downloader);
picasso = builder.build();
}
@Override
public void loadImage(String url, ImageView imageView){
picasso.with(mContext).load(url).into(imageView);
}
@Override
public void loadImage(String url, ImageView imageView, final ImageLoaderCallBack imageLoaderCallBack){
picasso.with(mContext).load(url).into(imageView, new Callback() {
@Override
public void onSuccess() {
imageLoaderCallBack.onSuccess();
}
@Override
public void onError() {
imageLoaderCallBack.onError();
}
});
}
}
| 1,304 | 0.675614 | 0.675614 | 43 | 29.325581 | 25.244591 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.534884 | false | false | 4 |
1c37acfbe4c5b14f3983aff2eb7b59753eef9e8e | 6,897,717,534,649 | febb90ac13781fd4b21adf2484f2d57ee5a6e736 | /TPSIT/JAVA/Esercizi/java_04ver/src/ver2/java_ver2.java | bb85794eaeda39f6a13a4ba3517e75acbd0a5d67 | []
| no_license | Viktya/Appunti-Inf4 | https://github.com/Viktya/Appunti-Inf4 | 1d8f1162966780285df114493e0c1e9617611715 | ebbafe4548afa80098315378a0cfdbf3a8546eaa | refs/heads/master | 2020-07-27T07:35:23.054000 | 2020-05-07T10:33:33 | 2020-05-07T10:33:33 | 209,015,986 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ver2;
import java.util.Scanner;
//2. Realizzare un'applicazione che letta una frase ne individui le parole e le disponga e stampi in ordine casuale.
public class java_ver2 {
public static void main(String[] args) {
String frase;
int nlet, pos, count = 0;
Scanner sc = new Scanner(System.in);
System.out.println("Inserisci una frase.");
frase = sc.nextLine();
nlet = frase.length();
String[] parole = new String[40];
for (int i=0; i<nlet; i++) {
pos = frase.indexOf(' ');
parole[i] = frase.substring(count, pos);
System.out.println(parole[i]);
}
//Math.random();
sc.close();
}
} | UTF-8 | Java | 730 | java | java_ver2.java | Java | []
| null | []
| package ver2;
import java.util.Scanner;
//2. Realizzare un'applicazione che letta una frase ne individui le parole e le disponga e stampi in ordine casuale.
public class java_ver2 {
public static void main(String[] args) {
String frase;
int nlet, pos, count = 0;
Scanner sc = new Scanner(System.in);
System.out.println("Inserisci una frase.");
frase = sc.nextLine();
nlet = frase.length();
String[] parole = new String[40];
for (int i=0; i<nlet; i++) {
pos = frase.indexOf(' ');
parole[i] = frase.substring(count, pos);
System.out.println(parole[i]);
}
//Math.random();
sc.close();
}
} | 730 | 0.564384 | 0.554795 | 34 | 20.5 | 24.373623 | 116 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.558824 | false | false | 4 |
3428cd54fddf531759076bc6483425eda06ce848 | 38,938,173,530,441 | 27d9e909c3fe0a1d877e9f67df5d496522be68a7 | /app/src/main/java/com/example/demoapp/CreatePost.java | 0f1c1456728d38cd5a58ab1200701f9d070c9fe6 | []
| no_license | malhotra700/DemoApp | https://github.com/malhotra700/DemoApp | 27c84cbd0cc90ccf920a1cee7c93090906c53049 | 9e53f77a4b3e54fd731d6ce1b3f130bae31a27d6 | refs/heads/master | 2022-04-04T06:05:06.925000 | 2019-10-07T13:18:08 | 2019-10-07T13:18:08 | 231,239,051 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.demoapp;
import android.app.Activity;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
//import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.auth.api.signin.GoogleSignIn;
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.squareup.picasso.Picasso;
import java.util.Calendar;
import java.util.Date;
/**
* A simple {@link Fragment} subclass.
* Activities that contain this fragment must implement the
* {@link CreatePost.OnFragmentInteractionListener} interface
* to handle interaction events.
* Use the {@link CreatePost#newInstance} factory method to
* create an instance of this fragment.
*/
public class CreatePost extends Fragment implements View.OnClickListener {
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;
EditText editTextCreatePost;
TextView usernameCreatePost;
ImageView profilePicCreatePost;
Button postButtonCreatePost;
FirebaseDatabase database;
DatabaseReference ref;
Profile profile;
Uri imgPath=Uri.parse("android.resource://com.example.demoapp/"+R.drawable.pic);
GoogleSignInAccount acct;
Date currentTime;
private Context mContext;
private AppCompatActivity mActivity;
private OnFragmentInteractionListener mListener;
public CreatePost() {
// Required empty public constructor
}
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment CreatePost.
*/
// TODO: Rename and change types and number of parameters
public static CreatePost newInstance(String param1, String param2) {
CreatePost fragment = new CreatePost();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view=inflater.inflate(R.layout.fragment_create_post, container, false);
editTextCreatePost=(EditText)view.findViewById(R.id.editext_createpost);
usernameCreatePost=(TextView)view.findViewById(R.id.username_createpost);
profilePicCreatePost=(ImageView)view.findViewById(R.id.profile_picture_createpost);
postButtonCreatePost=(Button)view.findViewById(R.id.post_button_createpost);
postButtonCreatePost.setOnClickListener(this);
acct = GoogleSignIn.getLastSignedInAccount(getActivity());
if (acct != null) {
usernameCreatePost.setText(acct.getDisplayName());
imgPath=acct.getPhotoUrl();
Picasso.get().load(imgPath.toString()).into(profilePicCreatePost);
}
database=FirebaseDatabase.getInstance();
ref=database.getReference("Profiles");
profile=new Profile();
return view;
}
private void getValues(){
profile.setContent(editTextCreatePost.getText().toString());
profile.setUsername(usernameCreatePost.getText().toString());
profile.setProfilepic(imgPath.toString());
}
@Override
public void onClick(View v) {
getValues();
currentTime=Calendar.getInstance().getTime();
ref.child(acct.getId()+currentTime).setValue(profile);
Toast.makeText(mContext,"Posted",Toast.LENGTH_LONG).show();
mActivity.getSupportFragmentManager().beginTransaction().replace(R.id.l_layout,new HomeFragment()).commit();
}
// TODO: Rename method, update argument and hook method into UI event
public void onButtonPressed(Uri uri) {
if (mListener != null) {
mListener.onFragmentInteraction(uri);
}
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
mContext=context;
mActivity=(AppCompatActivity)mContext;
}
@Override
public void onDetach() {
super.onDetach();
mListener = null;
}
/**
* This interface must be implemented by activities that contain this
* fragment to allow an interaction in this fragment to be communicated
* to the activity and potentially other fragments contained in that
* activity.
* <p>
* See the Android Training lesson <a href=
* "http://developer.android.com/training/basics/fragments/communicating.html"
* >Communicating with Other Fragments</a> for more information.
*/
public interface OnFragmentInteractionListener {
// TODO: Update argument type and name
void onFragmentInteraction(Uri uri);
}
}
| UTF-8 | Java | 6,082 | java | CreatePost.java | Java | [
{
"context": "etText().toString());\n profile.setUsername(usernameCreatePost.getText().toString());\n profile.",
"end": 4501,
"score": 0.8294435143470764,
"start": 4493,
"tag": "USERNAME",
"value": "username"
}
]
| null | []
| package com.example.demoapp;
import android.app.Activity;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
//import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.auth.api.signin.GoogleSignIn;
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.squareup.picasso.Picasso;
import java.util.Calendar;
import java.util.Date;
/**
* A simple {@link Fragment} subclass.
* Activities that contain this fragment must implement the
* {@link CreatePost.OnFragmentInteractionListener} interface
* to handle interaction events.
* Use the {@link CreatePost#newInstance} factory method to
* create an instance of this fragment.
*/
public class CreatePost extends Fragment implements View.OnClickListener {
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;
EditText editTextCreatePost;
TextView usernameCreatePost;
ImageView profilePicCreatePost;
Button postButtonCreatePost;
FirebaseDatabase database;
DatabaseReference ref;
Profile profile;
Uri imgPath=Uri.parse("android.resource://com.example.demoapp/"+R.drawable.pic);
GoogleSignInAccount acct;
Date currentTime;
private Context mContext;
private AppCompatActivity mActivity;
private OnFragmentInteractionListener mListener;
public CreatePost() {
// Required empty public constructor
}
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment CreatePost.
*/
// TODO: Rename and change types and number of parameters
public static CreatePost newInstance(String param1, String param2) {
CreatePost fragment = new CreatePost();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view=inflater.inflate(R.layout.fragment_create_post, container, false);
editTextCreatePost=(EditText)view.findViewById(R.id.editext_createpost);
usernameCreatePost=(TextView)view.findViewById(R.id.username_createpost);
profilePicCreatePost=(ImageView)view.findViewById(R.id.profile_picture_createpost);
postButtonCreatePost=(Button)view.findViewById(R.id.post_button_createpost);
postButtonCreatePost.setOnClickListener(this);
acct = GoogleSignIn.getLastSignedInAccount(getActivity());
if (acct != null) {
usernameCreatePost.setText(acct.getDisplayName());
imgPath=acct.getPhotoUrl();
Picasso.get().load(imgPath.toString()).into(profilePicCreatePost);
}
database=FirebaseDatabase.getInstance();
ref=database.getReference("Profiles");
profile=new Profile();
return view;
}
private void getValues(){
profile.setContent(editTextCreatePost.getText().toString());
profile.setUsername(usernameCreatePost.getText().toString());
profile.setProfilepic(imgPath.toString());
}
@Override
public void onClick(View v) {
getValues();
currentTime=Calendar.getInstance().getTime();
ref.child(acct.getId()+currentTime).setValue(profile);
Toast.makeText(mContext,"Posted",Toast.LENGTH_LONG).show();
mActivity.getSupportFragmentManager().beginTransaction().replace(R.id.l_layout,new HomeFragment()).commit();
}
// TODO: Rename method, update argument and hook method into UI event
public void onButtonPressed(Uri uri) {
if (mListener != null) {
mListener.onFragmentInteraction(uri);
}
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
mContext=context;
mActivity=(AppCompatActivity)mContext;
}
@Override
public void onDetach() {
super.onDetach();
mListener = null;
}
/**
* This interface must be implemented by activities that contain this
* fragment to allow an interaction in this fragment to be communicated
* to the activity and potentially other fragments contained in that
* activity.
* <p>
* See the Android Training lesson <a href=
* "http://developer.android.com/training/basics/fragments/communicating.html"
* >Communicating with Other Fragments</a> for more information.
*/
public interface OnFragmentInteractionListener {
// TODO: Update argument type and name
void onFragmentInteraction(Uri uri);
}
}
| 6,082 | 0.707333 | 0.70388 | 175 | 33.754284 | 25.268663 | 116 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.542857 | false | false | 4 |
47481f8b36dba78339d3a641927531a415303499 | 36,189,394,469,154 | 53d7643ad05b34c7978912430b1e829810997e2d | /src/main/java/Task7.java | f9ee761cbf397fe3f80abf8ca27b1edf3fa9d657 | []
| no_license | maciekkacz/Zadania | https://github.com/maciekkacz/Zadania | d1db1d3a352c5a58a9b021bc9a0e9c51aee962e9 | 883b04e17206ca0e635d364c30032ae71f5e8a06 | refs/heads/master | 2023-08-17T14:10:11.002000 | 2021-09-13T16:59:07 | 2021-09-13T16:59:07 | 400,268,786 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.Scanner;
public class Task7 {
//Napisać program, który pobiera od użytkownika liczbę całkowitą dodatnią, a następnie wyświetla na ekranie kolejno wszystkie liczby niepatrzyste nie większe od
//podanej liczby. Przykład, dla 15 program powinien wyświetlić 1, 3, 5, 7, 9, 11, 13,
//15.
private static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
System.out.println("give me a number");
int number = sc.nextInt();
int start = 0;
while ((start++) < number) {
if (start % 2 != 0) {
System.out.println(start);
}
}
}
}
| UTF-8 | Java | 683 | java | Task7.java | Java | []
| null | []
| import java.util.Scanner;
public class Task7 {
//Napisać program, który pobiera od użytkownika liczbę całkowitą dodatnią, a następnie wyświetla na ekranie kolejno wszystkie liczby niepatrzyste nie większe od
//podanej liczby. Przykład, dla 15 program powinien wyświetlić 1, 3, 5, 7, 9, 11, 13,
//15.
private static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
System.out.println("give me a number");
int number = sc.nextInt();
int start = 0;
while ((start++) < number) {
if (start % 2 != 0) {
System.out.println(start);
}
}
}
}
| 683 | 0.607463 | 0.58209 | 22 | 29.454546 | 36.971397 | 164 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.727273 | false | false | 4 |
70d12ad9ab770296074e64fa46fb76e2ec4fd323 | 36,756,330,142,258 | 525441bc318018424cfb0d0387a888bc620d9972 | /BiLab/bilab_working/BiLab/src/bilab/notebook/parts/DiagramEditPart.java | 5b0004f276cd4ee600c01a09da2f9b0ac1d48bfa | []
| no_license | argodev/BiLab | https://github.com/argodev/BiLab | 4fcc515ac04aaaee4a0bbed949ba586da8e72df3 | 5cb8cdf232b23f6564b489b9dd6a4ceea112e22f | refs/heads/master | 2016-09-06T14:14:34.051000 | 2011-06-30T21:04:17 | 2011-06-30T21:04:17 | 1,378,079 | 3 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* This document is a part of the source code and related artifacts for BiLab,
* an open source interactive workbench for computational biologists.
*
* http://computing.ornl.gov/
*
* Copyright © 2011 Oak Ridge National Laboratory
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package bilab.notebook.parts;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.List;
import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.FreeformLayout;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.XYLayout;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPolicy;
import org.eclipse.gef.Request;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
import org.eclipse.gef.editpolicies.RootComponentEditPolicy;
import org.eclipse.gef.editpolicies.XYLayoutEditPolicy;
import org.eclipse.gef.requests.ChangeBoundsRequest;
import org.eclipse.gef.requests.CreateRequest;
import bilab.Notify;
import bilab.notebook.model.EllipticalGraphic;
import bilab.notebook.model.Graphic;
import bilab.notebook.model.GraphicsDiagram;
import bilab.notebook.model.ModelElement;
import bilab.notebook.model.RectangularGraphic;
import bilab.notebook.model.commands.GraphicCreateCommand;
import bilab.notebook.model.commands.GraphicSetConstraintCommand;
/**
* EditPart for the a ShapesDiagram instance.
* <p>
* This edit part server as the main diagram container, the white area where
* everything else is in. Also responsible for the container's layout (the way
* the container rearanges is contents) and the container's capabilities (edit
* policies).
* </p>
* <p>
* This edit part must implement the PropertyChangeListener interface, so it can
* be notified of property changes in the corresponding model element.
* </p>
*
* @author Elias Volanakis
*/
class DiagramEditPart extends AbstractGraphicalEditPart implements
PropertyChangeListener {
/**
* EditPolicy for the Figure used by this edit part. Children of
* XYLayoutEditPolicy can be used in Figures with XYLayout.
*
* @author Elias Volanakis
*/
private class ShapesXYLayoutEditPolicy extends XYLayoutEditPolicy {
/**
* Create a new instance of this edit policy.
*
* @param layout
* a non-null XYLayout instance. This should be the layout of
* the editpart's figure where this instance is installed.
* @throws IllegalArgumentException
* if layout is null
* @see DiagramEditPart#createEditPolicies()
*/
ShapesXYLayoutEditPolicy(final XYLayout layout) {
if (layout == null) {
throw new IllegalArgumentException();
}
setXyLayout(layout);
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.gef.editpolicies.ConstrainedLayoutEditPolicy#createAddCommand
* (org.eclipse.gef.EditPart, java.lang.Object)
*/
@Override
protected Command createAddCommand(final EditPart child,
final Object constraint) {
Notify.unimplemented(this);
// not used in this example
return null;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.editpolicies.ConstrainedLayoutEditPolicy#
* createChangeConstraintCommand
* (org.eclipse.gef.requests.ChangeBoundsRequest,
* org.eclipse.gef.EditPart, java.lang.Object)
*/
@Override
protected Command createChangeConstraintCommand(
final ChangeBoundsRequest request, final EditPart child,
final Object constraint) {
if (child instanceof GraphicEditPart
&& constraint instanceof Rectangle) {
// return a command that can move and/or resize a Shape
return new GraphicSetConstraintCommand(
(Graphic) child.getModel(), request,
(Rectangle) constraint);
}
return super.createChangeConstraintCommand(request, child,
constraint);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.editpolicies.ConstrainedLayoutEditPolicy#
* createChangeConstraintCommand(org.eclipse.gef.EditPart,
* java.lang.Object)
*/
@Override
protected Command createChangeConstraintCommand(final EditPart child,
final Object constraint) {
Notify.unimplemented(this);
// not used in this example
return null;
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.gef.editpolicies.LayoutEditPolicy#getCreateCommand(org
* .eclipse.gef.requests.CreateRequest)
*/
@Override
protected Command getCreateCommand(final CreateRequest request) {
final Object childClass = request.getNewObjectType();
if (childClass == EllipticalGraphic.class
|| childClass == RectangularGraphic.class) {
// return a command that can add a Shape to a ShapesDiagram
return new GraphicCreateCommand(
DiagramEditPart.this.getCastedModel(), request);
}
return null;
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.gef.editpolicies.LayoutEditPolicy#getDeleteDependantCommand
* (org.eclipse.gef.Request)
*/
@Override
protected Command getDeleteDependantCommand(final Request request) {
// not used in this example
return null;
}
}
/**
* Upon activation, attach to the model element as a property change
* listener.
*/
@Override
public void activate() {
if (!isActive()) {
super.activate();
((ModelElement) getModel()).addPropertyChangeListener(this);
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.editparts.AbstractEditPart#createEditPolicies()
*/
@Override
protected void createEditPolicies() {
// disallows the removal of this edit part from its parent
installEditPolicy(EditPolicy.COMPONENT_ROLE,
new RootComponentEditPolicy());
// handles constraint changes (e.g. moving and/or resizing) of model
// elements
// and creation of new model elements
final XYLayout layout = (XYLayout) getContentPane().getLayoutManager();
installEditPolicy(EditPolicy.LAYOUT_ROLE, new ShapesXYLayoutEditPolicy(
layout));
// disable selection feedback for this edit part
installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, null);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#createFigure()
*/
@Override
protected IFigure createFigure() {
final Figure f = new Figure();
f.setLayoutManager(new FreeformLayout());
return f;
}
/**
* Upon deactivation, detach from the model element as a property change
* listener.
*/
@Override
public void deactivate() {
if (isActive()) {
super.deactivate();
((ModelElement) getModel()).removePropertyChangeListener(this);
}
}
private GraphicsDiagram getCastedModel() {
return (GraphicsDiagram) getModel();
}
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.editparts.AbstractEditPart#getModelChildren()
*/
@Override
protected List getModelChildren() {
return getCastedModel().getChildren(); // return a list of shapes
}
/*
* (non-Javadoc)
*
* @see java.beans.PropertyChangeListener#propertyChange(java.beans.
* PropertyChangeEvent)
*/
@Override
public void propertyChange(final PropertyChangeEvent evt) {
final String prop = evt.getPropertyName();
// these properties are fired when Shapes are added into or removed from
// the ShapeDiagram instance and must cause a call of refreshChildren()
// to update the diagram's contents.
if (GraphicsDiagram.CHILD_ADDED_PROP.equals(prop)
|| GraphicsDiagram.CHILD_REMOVED_PROP.equals(prop)) {
refreshChildren();
}
}
} | UTF-8 | Java | 9,911 | java | DiagramEditPart.java | Java | [
{
"context": "esponding model element.\r\n * </p>\r\n * \r\n * @author Elias Volanakis\r\n */\r\nclass DiagramEditPart extends AbstractGraph",
"end": 3019,
"score": 0.9998868703842163,
"start": 3004,
"tag": "NAME",
"value": "Elias Volanakis"
},
{
"context": "in Figures with XYLayout.\r\n * \r\n * @author Elias Volanakis\r\n */\r\n private class ShapesXYLayoutEditPol",
"end": 3313,
"score": 0.999874472618103,
"start": 3298,
"tag": "NAME",
"value": "Elias Volanakis"
}
]
| null | []
| /**
* This document is a part of the source code and related artifacts for BiLab,
* an open source interactive workbench for computational biologists.
*
* http://computing.ornl.gov/
*
* Copyright © 2011 Oak Ridge National Laboratory
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package bilab.notebook.parts;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.List;
import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.FreeformLayout;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.XYLayout;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPolicy;
import org.eclipse.gef.Request;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
import org.eclipse.gef.editpolicies.RootComponentEditPolicy;
import org.eclipse.gef.editpolicies.XYLayoutEditPolicy;
import org.eclipse.gef.requests.ChangeBoundsRequest;
import org.eclipse.gef.requests.CreateRequest;
import bilab.Notify;
import bilab.notebook.model.EllipticalGraphic;
import bilab.notebook.model.Graphic;
import bilab.notebook.model.GraphicsDiagram;
import bilab.notebook.model.ModelElement;
import bilab.notebook.model.RectangularGraphic;
import bilab.notebook.model.commands.GraphicCreateCommand;
import bilab.notebook.model.commands.GraphicSetConstraintCommand;
/**
* EditPart for the a ShapesDiagram instance.
* <p>
* This edit part server as the main diagram container, the white area where
* everything else is in. Also responsible for the container's layout (the way
* the container rearanges is contents) and the container's capabilities (edit
* policies).
* </p>
* <p>
* This edit part must implement the PropertyChangeListener interface, so it can
* be notified of property changes in the corresponding model element.
* </p>
*
* @author <NAME>
*/
class DiagramEditPart extends AbstractGraphicalEditPart implements
PropertyChangeListener {
/**
* EditPolicy for the Figure used by this edit part. Children of
* XYLayoutEditPolicy can be used in Figures with XYLayout.
*
* @author <NAME>
*/
private class ShapesXYLayoutEditPolicy extends XYLayoutEditPolicy {
/**
* Create a new instance of this edit policy.
*
* @param layout
* a non-null XYLayout instance. This should be the layout of
* the editpart's figure where this instance is installed.
* @throws IllegalArgumentException
* if layout is null
* @see DiagramEditPart#createEditPolicies()
*/
ShapesXYLayoutEditPolicy(final XYLayout layout) {
if (layout == null) {
throw new IllegalArgumentException();
}
setXyLayout(layout);
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.gef.editpolicies.ConstrainedLayoutEditPolicy#createAddCommand
* (org.eclipse.gef.EditPart, java.lang.Object)
*/
@Override
protected Command createAddCommand(final EditPart child,
final Object constraint) {
Notify.unimplemented(this);
// not used in this example
return null;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.editpolicies.ConstrainedLayoutEditPolicy#
* createChangeConstraintCommand
* (org.eclipse.gef.requests.ChangeBoundsRequest,
* org.eclipse.gef.EditPart, java.lang.Object)
*/
@Override
protected Command createChangeConstraintCommand(
final ChangeBoundsRequest request, final EditPart child,
final Object constraint) {
if (child instanceof GraphicEditPart
&& constraint instanceof Rectangle) {
// return a command that can move and/or resize a Shape
return new GraphicSetConstraintCommand(
(Graphic) child.getModel(), request,
(Rectangle) constraint);
}
return super.createChangeConstraintCommand(request, child,
constraint);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.editpolicies.ConstrainedLayoutEditPolicy#
* createChangeConstraintCommand(org.eclipse.gef.EditPart,
* java.lang.Object)
*/
@Override
protected Command createChangeConstraintCommand(final EditPart child,
final Object constraint) {
Notify.unimplemented(this);
// not used in this example
return null;
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.gef.editpolicies.LayoutEditPolicy#getCreateCommand(org
* .eclipse.gef.requests.CreateRequest)
*/
@Override
protected Command getCreateCommand(final CreateRequest request) {
final Object childClass = request.getNewObjectType();
if (childClass == EllipticalGraphic.class
|| childClass == RectangularGraphic.class) {
// return a command that can add a Shape to a ShapesDiagram
return new GraphicCreateCommand(
DiagramEditPart.this.getCastedModel(), request);
}
return null;
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.gef.editpolicies.LayoutEditPolicy#getDeleteDependantCommand
* (org.eclipse.gef.Request)
*/
@Override
protected Command getDeleteDependantCommand(final Request request) {
// not used in this example
return null;
}
}
/**
* Upon activation, attach to the model element as a property change
* listener.
*/
@Override
public void activate() {
if (!isActive()) {
super.activate();
((ModelElement) getModel()).addPropertyChangeListener(this);
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.editparts.AbstractEditPart#createEditPolicies()
*/
@Override
protected void createEditPolicies() {
// disallows the removal of this edit part from its parent
installEditPolicy(EditPolicy.COMPONENT_ROLE,
new RootComponentEditPolicy());
// handles constraint changes (e.g. moving and/or resizing) of model
// elements
// and creation of new model elements
final XYLayout layout = (XYLayout) getContentPane().getLayoutManager();
installEditPolicy(EditPolicy.LAYOUT_ROLE, new ShapesXYLayoutEditPolicy(
layout));
// disable selection feedback for this edit part
installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, null);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#createFigure()
*/
@Override
protected IFigure createFigure() {
final Figure f = new Figure();
f.setLayoutManager(new FreeformLayout());
return f;
}
/**
* Upon deactivation, detach from the model element as a property change
* listener.
*/
@Override
public void deactivate() {
if (isActive()) {
super.deactivate();
((ModelElement) getModel()).removePropertyChangeListener(this);
}
}
private GraphicsDiagram getCastedModel() {
return (GraphicsDiagram) getModel();
}
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.editparts.AbstractEditPart#getModelChildren()
*/
@Override
protected List getModelChildren() {
return getCastedModel().getChildren(); // return a list of shapes
}
/*
* (non-Javadoc)
*
* @see java.beans.PropertyChangeListener#propertyChange(java.beans.
* PropertyChangeEvent)
*/
@Override
public void propertyChange(final PropertyChangeEvent evt) {
final String prop = evt.getPropertyName();
// these properties are fired when Shapes are added into or removed from
// the ShapeDiagram instance and must cause a call of refreshChildren()
// to update the diagram's contents.
if (GraphicsDiagram.CHILD_ADDED_PROP.equals(prop)
|| GraphicsDiagram.CHILD_REMOVED_PROP.equals(prop)) {
refreshChildren();
}
}
} | 9,893 | 0.629869 | 0.628961 | 275 | 34.043636 | 26.75651 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.363636 | false | false | 4 |
0faeea540f5aec55172b79276753bdef395b387d | 36,756,330,140,524 | 364b040e06691359b5b7d645744104b7128bef3c | /pglp3_4/src/test/java/pglp/pglp3_4/AppTest.java | c4f52ba045a744252a8ba6334a7b68773e103481 | []
| no_license | billalzemmoura/pglp_3.4 | https://github.com/billalzemmoura/pglp_3.4 | ec2f306be49cb15f7dfe926b1bed5d3f8f36014f | e9e8254aaddd070e1e40fcda3e02bef4d1c3f3b1 | refs/heads/master | 2021-03-01T22:55:07.467000 | 2020-03-17T20:17:37 | 2020-03-17T20:17:37 | 245,818,985 | 0 | 0 | null | false | 2020-10-13T20:10:38 | 2020-03-08T13:24:54 | 2020-03-17T20:17:40 | 2020-10-13T20:10:36 | 9 | 0 | 0 | 1 | Java | false | false | package pglp.pglp3_4;
import org.junit.Test;
/**
* classe de test de SimplePrinter.
*/
public class AppTest
{
/**
* test de la méthode print
*/
@Test
public void Test( )
{
SimplePrinter s=new SimplePrinter();
s.print();
}
}
| UTF-8 | Java | 277 | java | AppTest.java | Java | []
| null | []
| package pglp.pglp3_4;
import org.junit.Test;
/**
* classe de test de SimplePrinter.
*/
public class AppTest
{
/**
* test de la méthode print
*/
@Test
public void Test( )
{
SimplePrinter s=new SimplePrinter();
s.print();
}
}
| 277 | 0.557971 | 0.550725 | 22 | 11.545455 | 12.059426 | 41 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.318182 | false | false | 4 |
25182ea4d42dba5f7e32a21dde02c3812529e72d | 37,864,431,692,182 | 4d307bc6f771b28d8a2472ccf158fb85186e4a52 | /TBlog/src/main/java/cn/betterts/blog/controller/admin/AdminCategoryController.java | 05831e20a225c71cf1cb3da2f3e686d364451f58 | []
| no_license | TangShaoquan/TBlog | https://github.com/TangShaoquan/TBlog | 7fac1ab1cd71f02b229a3c81b2de64d3df8821ae | 6d783a8a07f20ea4c4f7a29d83049bff3c37dd1a | refs/heads/master | 2022-12-26T13:12:53.541000 | 2020-08-15T08:33:15 | 2020-08-15T08:33:15 | 252,441,915 | 0 | 0 | null | false | 2022-12-16T15:26:11 | 2020-04-02T11:56:08 | 2020-08-15T08:33:19 | 2022-12-16T15:26:07 | 5,206 | 0 | 0 | 14 | JavaScript | false | false | package cn.betterts.blog.controller.admin;
import cn.betterts.blog.domain.Category;
import cn.betterts.blog.service.ArticleService;
import cn.betterts.blog.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import java.util.List;
@Controller
@RequestMapping("/admin/category")
public class AdminCategoryController {
@Autowired
private ArticleService articleService;
@Autowired
private CategoryService categoryService;
/**
* @Description: 首页以及转发页面
* @Param: []
* @return: org.springframework.web.servlet.ModelAndView
*/
@RequestMapping(value = "")
public ModelAndView categoryList() {
ModelAndView modelandview = new ModelAndView();
List<Category> categoryList = categoryService.listCategoryWithCount();
modelandview.addObject("categoryList",categoryList);
modelandview.setViewName("Admin/Category/index");
return modelandview;
}
/**
* @Description: 添加分类
* @Param: [category]
* @return: java.lang.String
*/
@RequestMapping(value = "/insertSubmit",method = RequestMethod.POST)
public String insertCategorySubmit(Category category) {
categoryService.insert(category);
return "redirect:/admin/category";
}
/**
* @Description: 删除分类
* @Param: [id]
* @return: java.lang.String
*/
@RequestMapping(value = "/delete/{id}")
public String deleteCategory(@PathVariable("id") Integer id) {
//禁止删除有文章的分类
int count = articleService.countArticleByCategoryId(id);
if (count == 0) {
categoryService.deleteCategory(id);
}
return "redirect:/admin/category";
}
/**
* @Description: 编辑页面转发
* @Param: [id]
* @return: org.springframework.web.servlet.ModelAndView
*/
@RequestMapping(value = "/edit/{id}")
public ModelAndView editCategoryView(@PathVariable("id") Integer id) {
ModelAndView modelAndView = new ModelAndView();
Category category = categoryService.getCategoryById(id);
modelAndView.addObject("category",category);
List<Category> categoryList = categoryService.listCategoryWithCount();
modelAndView.addObject("categoryList",categoryList);
modelAndView.setViewName("Admin/Category/edit");
return modelAndView;
}
/**
* @Description: 提交
* @Param: [category]
* @return: java.lang.String
*/
@RequestMapping(value = "/editSubmit",method = RequestMethod.POST)
public String editCategorySubmit(Category category) {
categoryService.update(category);
return "redirect:/admin/category";
}
}
| UTF-8 | Java | 3,035 | java | AdminCategoryController.java | Java | []
| null | []
| package cn.betterts.blog.controller.admin;
import cn.betterts.blog.domain.Category;
import cn.betterts.blog.service.ArticleService;
import cn.betterts.blog.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import java.util.List;
@Controller
@RequestMapping("/admin/category")
public class AdminCategoryController {
@Autowired
private ArticleService articleService;
@Autowired
private CategoryService categoryService;
/**
* @Description: 首页以及转发页面
* @Param: []
* @return: org.springframework.web.servlet.ModelAndView
*/
@RequestMapping(value = "")
public ModelAndView categoryList() {
ModelAndView modelandview = new ModelAndView();
List<Category> categoryList = categoryService.listCategoryWithCount();
modelandview.addObject("categoryList",categoryList);
modelandview.setViewName("Admin/Category/index");
return modelandview;
}
/**
* @Description: 添加分类
* @Param: [category]
* @return: java.lang.String
*/
@RequestMapping(value = "/insertSubmit",method = RequestMethod.POST)
public String insertCategorySubmit(Category category) {
categoryService.insert(category);
return "redirect:/admin/category";
}
/**
* @Description: 删除分类
* @Param: [id]
* @return: java.lang.String
*/
@RequestMapping(value = "/delete/{id}")
public String deleteCategory(@PathVariable("id") Integer id) {
//禁止删除有文章的分类
int count = articleService.countArticleByCategoryId(id);
if (count == 0) {
categoryService.deleteCategory(id);
}
return "redirect:/admin/category";
}
/**
* @Description: 编辑页面转发
* @Param: [id]
* @return: org.springframework.web.servlet.ModelAndView
*/
@RequestMapping(value = "/edit/{id}")
public ModelAndView editCategoryView(@PathVariable("id") Integer id) {
ModelAndView modelAndView = new ModelAndView();
Category category = categoryService.getCategoryById(id);
modelAndView.addObject("category",category);
List<Category> categoryList = categoryService.listCategoryWithCount();
modelAndView.addObject("categoryList",categoryList);
modelAndView.setViewName("Admin/Category/edit");
return modelAndView;
}
/**
* @Description: 提交
* @Param: [category]
* @return: java.lang.String
*/
@RequestMapping(value = "/editSubmit",method = RequestMethod.POST)
public String editCategorySubmit(Category category) {
categoryService.update(category);
return "redirect:/admin/category";
}
}
| 3,035 | 0.69026 | 0.689922 | 96 | 29.90625 | 23.86467 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.385417 | false | false | 4 |
f1705cfa8e9858715e703bdf9488e9345206ec56 | 37,984,690,781,775 | e9b9eaa6532cbf4f8d6b5d037ed8453cc5637166 | /A3/MorseCodeConvert.java | 36e8ef579f63b6583f75be7e131b5725e5686758 | []
| no_license | VictoriaXY6/CSC22100-Projects | https://github.com/VictoriaXY6/CSC22100-Projects | dfc010a6e0288f7b1b339de50caa3def2e271406 | 612670cf9dc91208cb79b68589dc6efc16d399ba | refs/heads/master | 2022-11-08T06:34:00.753000 | 2020-06-24T16:12:11 | 2020-06-24T16:12:11 | 274,574,159 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | //use to open file
import java.io.File;
import java.io.FileInputStream;
//the exception type when file not found
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Scanner;
public class MorseCodeConvert{
//list to store character and its corresponding morse code
private final ArrayList<MorseCode> listCodes;
//non-default constructor
public MorseCodeConvert(String fileName){
listCodes = new ArrayList<MorseCode>();
//declare a Scanner class instance and initialize it as null
Scanner file = null;
try {
file = new Scanner(new FileInputStream(new File(fileName)));
//read all the lines from the file
while(file.hasNext()) {
//split method separates the line by a tab
String[] line = file.nextLine().split("\t");
//check if the array s contains two elements:the character and its corresponding morse code
if(line.length == 2) {
try {
//convert the datatype of character from String to char
char character = line[0].charAt(0);
//create an instance of MorseCode class that contains the character and corresponding more code
MorseCode obj = new MorseCode(character,line[1]);
//add each valid line to array list
listCodes.add(obj);
}
//When there is a invalid character, the MorseCode will throw an exception which catch by this block
catch(Exception ex) {
//print the error message
System.err.println(ex.toString());
}
}
//if there is only one entry in the line and the line is not empty
else if(line[0].length() != 0) {
//print out the invalid line
System.out.println("Invalid line: " + line[0]);
}
}
}
//if the file not found, throw an exception which catch by this block
catch(FileNotFoundException fe){
System.err.println("Failed to open file: " + fileName);
}
//finally block will run no matter whether there is an exception in try catch block or not
finally{
//close the file if not null
if (file != null) {
file.close();
}
}
}
//print the character and its corresponding morse code in the array list
public void printEncodingList() {
//iterate each element in the array list
for(MorseCode obj:listCodes) {
System.out.println(obj.getCharacter() + "\t" + obj.getEncoding());
}
}
//convert a random character to morse code
private String convert(char character) {
//if the character is space, return empty line
if(character == ' ') {
return "";
}
for(MorseCode obj:listCodes) {
//check if the input can convert to the valid morse code
if(obj.getCharacter() == character) {
//return the corresponding morse code
return obj.getEncoding() + " ";
}
}
//otherwise,return the question mark
return "? ";
}
//convert a string to its corresponding morse code
public void encodeString(String line) {
//if the input is either null or an empty string,print next line
if(line == "" || line == null) {
System.out.println("");
}
else {
for(int i = 0; i < line.length(); i++) {
//convert the character to datatype char and upper case
char character = Character.toUpperCase(line.charAt(i));
//convert the character to its corresponding morse code
String encoding = convert(character);
System.out.print(encoding);
}
System.out.println("");
}
}
//convert the contents of the file to morse code
public void encodeFile(String fileName) throws Exception{
Scanner file = null;
try {
file = new Scanner(new FileInputStream(new File(fileName)));
while(file.hasNext()) {
//use the encodeString method to convert each line of the file to morse code
encodeString(file.nextLine());
}
}
//if the file not found,throw an exception
catch(FileNotFoundException fe) {
throw new Exception("Failed to open file: " + fileName);
}
finally{
if(file != null) {
file.close();
}
}
}
}
| UTF-8 | Java | 4,005 | java | MorseCodeConvert.java | Java | []
| null | []
| //use to open file
import java.io.File;
import java.io.FileInputStream;
//the exception type when file not found
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Scanner;
public class MorseCodeConvert{
//list to store character and its corresponding morse code
private final ArrayList<MorseCode> listCodes;
//non-default constructor
public MorseCodeConvert(String fileName){
listCodes = new ArrayList<MorseCode>();
//declare a Scanner class instance and initialize it as null
Scanner file = null;
try {
file = new Scanner(new FileInputStream(new File(fileName)));
//read all the lines from the file
while(file.hasNext()) {
//split method separates the line by a tab
String[] line = file.nextLine().split("\t");
//check if the array s contains two elements:the character and its corresponding morse code
if(line.length == 2) {
try {
//convert the datatype of character from String to char
char character = line[0].charAt(0);
//create an instance of MorseCode class that contains the character and corresponding more code
MorseCode obj = new MorseCode(character,line[1]);
//add each valid line to array list
listCodes.add(obj);
}
//When there is a invalid character, the MorseCode will throw an exception which catch by this block
catch(Exception ex) {
//print the error message
System.err.println(ex.toString());
}
}
//if there is only one entry in the line and the line is not empty
else if(line[0].length() != 0) {
//print out the invalid line
System.out.println("Invalid line: " + line[0]);
}
}
}
//if the file not found, throw an exception which catch by this block
catch(FileNotFoundException fe){
System.err.println("Failed to open file: " + fileName);
}
//finally block will run no matter whether there is an exception in try catch block or not
finally{
//close the file if not null
if (file != null) {
file.close();
}
}
}
//print the character and its corresponding morse code in the array list
public void printEncodingList() {
//iterate each element in the array list
for(MorseCode obj:listCodes) {
System.out.println(obj.getCharacter() + "\t" + obj.getEncoding());
}
}
//convert a random character to morse code
private String convert(char character) {
//if the character is space, return empty line
if(character == ' ') {
return "";
}
for(MorseCode obj:listCodes) {
//check if the input can convert to the valid morse code
if(obj.getCharacter() == character) {
//return the corresponding morse code
return obj.getEncoding() + " ";
}
}
//otherwise,return the question mark
return "? ";
}
//convert a string to its corresponding morse code
public void encodeString(String line) {
//if the input is either null or an empty string,print next line
if(line == "" || line == null) {
System.out.println("");
}
else {
for(int i = 0; i < line.length(); i++) {
//convert the character to datatype char and upper case
char character = Character.toUpperCase(line.charAt(i));
//convert the character to its corresponding morse code
String encoding = convert(character);
System.out.print(encoding);
}
System.out.println("");
}
}
//convert the contents of the file to morse code
public void encodeFile(String fileName) throws Exception{
Scanner file = null;
try {
file = new Scanner(new FileInputStream(new File(fileName)));
while(file.hasNext()) {
//use the encodeString method to convert each line of the file to morse code
encodeString(file.nextLine());
}
}
//if the file not found,throw an exception
catch(FileNotFoundException fe) {
throw new Exception("Failed to open file: " + fileName);
}
finally{
if(file != null) {
file.close();
}
}
}
}
| 4,005 | 0.66417 | 0.662172 | 126 | 30.603174 | 24.882288 | 108 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.738095 | false | false | 4 |
b305bba6dc62ef625f526f572179dc39e8a2832b | 37,984,690,780,584 | e405356386fb5c3e35b99d1c7ad2bec043e094fe | /ArrarListDemo.java | 453caaeb8a67bf0ca1f326c493282db59e13ca1a | []
| no_license | Hariharan-0015/Internship | https://github.com/Hariharan-0015/Internship | 8e54bd0b9bfb925c165d4df9071193dff5b54877 | 392545c7de19a70461a8c3bd42e09280b1d580eb | refs/heads/master | 2021-01-16T03:56:13.167000 | 2020-02-25T13:03:19 | 2020-02-25T13:03:19 | 242,969,447 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package intern;
import java.util.*;
//Sample Program of ArrayList
public class ArrarListDemo {
public static void main(String[] args) {
ArrayList<Object> al=new ArrayList<Object>();
al.add("Hariharan");
al.add(15);
al.add(null);
System.out.println(al);
al.remove(1);
System.out.println(al);
al.add(1,1999);
al.add("M");
System.out.println(al);
}
}
| UTF-8 | Java | 374 | java | ArrarListDemo.java | Java | [
{
"context": "ist<Object> al=new ArrayList<Object>();\n\t\tal.add(\"Hariharan\");\n\t\tal.add(15);\n\t\tal.add(null);\n\t\tSystem.out.pri",
"end": 207,
"score": 0.9998313188552856,
"start": 198,
"tag": "NAME",
"value": "Hariharan"
}
]
| null | []
| package intern;
import java.util.*;
//Sample Program of ArrayList
public class ArrarListDemo {
public static void main(String[] args) {
ArrayList<Object> al=new ArrayList<Object>();
al.add("Hariharan");
al.add(15);
al.add(null);
System.out.println(al);
al.remove(1);
System.out.println(al);
al.add(1,1999);
al.add("M");
System.out.println(al);
}
}
| 374 | 0.665775 | 0.644385 | 20 | 17.700001 | 12.853404 | 47 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.8 | false | false | 4 |
2abb20e0a13b09a9b88c83b2922d11c371b9d9d3 | 37,443,524,898,806 | ba7fd878abb8e6b7a99a0d3d3f46896ab11dd47a | /WEB-INF/src/mmb/buy/order/BuyService.java | d4a9e67ab177e2a29db7b75e081773bf5af7b58e | []
| no_license | likgjava/m_a | https://github.com/likgjava/m_a | aacf55fe3327eb6699c7dbf5e9c91fd91c8acd99 | 3ca118a051319533cf59af259ea3cde2fc37fabf | refs/heads/master | 2018-05-14T01:06:55.918000 | 2015-12-24T09:35:24 | 2015-12-24T09:35:24 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
* 文件名:BuyService.java
*
* 版本信息:
* 日期:2013-4-12
* Copyright 买卖宝 Corporation 2013
* 版权所有
*
*/
package mmb.buy.order;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.HashMap;
import java.util.Map;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFDataFormat;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import adultadmin.service.impl.BaseServiceImpl;
import adultadmin.util.Arith;
import adultadmin.util.db.DbOperation;
/**
* 此方法描述的是: 导出采购订单结算信息,支持同时导出多个采购订单,回车换行分割
* @author: liubo
* @version: 2013-4-10 下午02:29:58
* @throws Exception
*/
public class BuyService extends BaseServiceImpl {
public BuyService(int useConnType, DbOperation dbOp){
this.useConnType = useConnType;
this.dbOp = dbOp;
}
public BuyService(){
this.useConnType = CONN_IN_METHOD;
}
public HSSFWorkbook exportBuyOrderInfo(String buyOrderCode) throws Exception {
String[] codeValue = buyOrderCode.split("\r\n");
StringBuilder codeBuilder = new StringBuilder();
for(String code : codeValue){
if(codeBuilder.length()>0){
codeBuilder.append(",");
}
codeBuilder.append("'"+code+"'");
}
//封装采购信息,key为code+productId,内部map为具体信息,key为字段名称,value为字段值
Map<String, Map<String, String>> buyInfoMap = new HashMap<String, Map<String, String>>();
//封装退货信息,key为code+productId
Map<String, Map<String, String>> returnInfoMap = new HashMap<String, Map<String, String>>();
PreparedStatement ps = null;
ResultSet rs = null;
PreparedStatement supplierPs = null;
ResultSet supplierRs = null;
try{
StringBuilder buyInfoSqlBuilder = new StringBuilder(
"select bo.code boCode, bo.proxy_id, p.code pcode, p.id pid, p.oriname, p.name pname, bop.stockin_count_bj+bop.stockin_count_gd incount,");
buyInfoSqlBuilder.append("bop.purchase_price*(1+bo.tax_point) price");
buyInfoSqlBuilder.append(
" from buy_order bo join buy_order_product bop on bo.id = bop.buy_order_id");
buyInfoSqlBuilder.append(" join product p on bop.product_id = p.id");
buyInfoSqlBuilder.append(" where bo.code in(");
buyInfoSqlBuilder.append(codeBuilder.toString());
buyInfoSqlBuilder.append(") order by bo.code asc, bop.id asc");
this.dbOp.prepareStatement(buyInfoSqlBuilder.toString());
ps = this.dbOp.getPStmt();
rs = ps.executeQuery();
Map<String, String> infoMap = null;
while(rs.next()){
infoMap = new HashMap<String, String>();
infoMap.put("boCode", rs.getString("boCode"));
infoMap.put("pcode", rs.getString("pcode"));
infoMap.put("oriname", rs.getString("oriname"));
infoMap.put("pname", rs.getString("pname"));
this.dbOp.prepareStatement("select name from supplier_standard_info where id="+rs.getInt("proxy_id"));
supplierPs = this.getDbOp().getPStmt();
supplierRs = supplierPs.executeQuery();
supplierRs.next();
infoMap.put("proxyName", supplierRs.getString("name"));
if(rs.getString("incount") == null){
infoMap.put("incount", "0");
}else{
infoMap.put("incount", rs.getString("incount"));
}
if(rs.getString("price") == null){
infoMap.put("price", "0");
}else{
infoMap.put("price", rs.getString("price"));
}
buyInfoMap.put(rs.getString("boCode")+rs.getString("pid"), infoMap);
}
ps.close();
rs.close();
buyInfoSqlBuilder = new StringBuilder();
buyInfoSqlBuilder.append("select bo.code boCode, bop.product_id pid, t.b1, t.b2, t.b3, t.b4 from buy_order bo join buy_order_product bop");
buyInfoSqlBuilder.append(" on bo.id = bop.buy_order_id");
buyInfoSqlBuilder.append(" left join (select br.buy_order_id brbid,brp.product_id bpid, if(br.return_type=1,brp.return_count,0) b1,");
buyInfoSqlBuilder.append(" if(br.return_type=1,brp.return_price,0) b2, if(br.return_type=2,brp.return_count,0) b3, "
+ "if(br.return_type=2,brp.return_price,0) b4 from buy_return br join buy_return_product brp on br.id = brp.buy_return_id");
buyInfoSqlBuilder.append(" group by br.buy_order_id,brp.product_id) t");
buyInfoSqlBuilder.append(" on bop.buy_order_id = t.brbid and bop.product_id = t.bpid");
buyInfoSqlBuilder.append(" where bo.code in (");
buyInfoSqlBuilder.append(codeBuilder.toString());
buyInfoSqlBuilder.append(") order by bo.code asc, bop.id asc");
this.dbOp.prepareStatement(buyInfoSqlBuilder.toString());
ps = this.dbOp.getPStmt();
rs = ps.executeQuery();
while(rs.next()){
infoMap = new HashMap<String, String>();
if(rs.getString("b1") == null){
infoMap.put("b1", "0");
}else{
infoMap.put("b1", rs.getString("b1"));
}
if(rs.getString("b2") == null){
infoMap.put("b2", "0");
}else{
infoMap.put("b2", rs.getString("b2"));
}
if(rs.getString("b3") == null){
infoMap.put("b3", "0");
}else{
infoMap.put("b3", rs.getString("b3"));
}
if(rs.getString("b4") == null){
infoMap.put("b4", "0");
}else{
infoMap.put("b4", rs.getString("b4"));
}
returnInfoMap.put(rs.getString("boCode")+rs.getString("pid"), infoMap);
}
ps.close();
rs.close();
return createExcel(buyInfoMap, returnInfoMap);
}finally{
if(ps != null){
ps.close();
}
if(rs != null){
rs.close();
}
}
}
private HSSFWorkbook createExcel(Map<String, Map<String, String>> buyInfoMap,
Map<String, Map<String, String>> returnInfoMap) {
HSSFWorkbook workbook = new HSSFWorkbook();
// 在Excel 工作簿中建一工作表
HSSFSheet sheet = workbook.createSheet("采购订单结算信息");
sheet.setColumnWidth(0, 15 * 256);
sheet.setColumnWidth(1, 15 * 256);
sheet.setColumnWidth(2, 15 * 256);
sheet.setColumnWidth(3, 15 * 256);
sheet.setColumnWidth(4, 15 * 256);
sheet.setColumnWidth(5, 15 * 256);
sheet.setColumnWidth(6, 15 * 256);
sheet.setColumnWidth(7, 15 * 256);
sheet.setColumnWidth(8, 15 * 256);
sheet.setColumnWidth(9, 15 * 256);
sheet.setColumnWidth(10, 15 * 256);
sheet.setColumnWidth(11, 15 * 256);
sheet.setColumnWidth(12, 15 * 256);
sheet.setColumnWidth(13, 15 * 256);
// 设置单元格格式(文本)
HSSFCellStyle cellStyle = workbook.createCellStyle();
cellStyle.setDataFormat(HSSFDataFormat.getBuiltinFormat("@"));
// 在索引0的位置创建行(第一行)
HSSFRow row = sheet.createRow((short) 0);
HSSFCell cell1 = row.createCell(0);// 第一列
HSSFCell cell2 = row.createCell(1);
HSSFCell cell3 = row.createCell(2);
HSSFCell cell4 = row.createCell(3);
HSSFCell cell5 = row.createCell(4);
HSSFCell cell6 = row.createCell(5);
HSSFCell cell7 = row.createCell(6);
HSSFCell cell8 = row.createCell(7);
HSSFCell cell9 = row.createCell(8);
HSSFCell cell10 = row.createCell(9);
HSSFCell cell11 = row.createCell(10);
HSSFCell cell12 = row.createCell(11);
HSSFCell cell13 = row.createCell(12);
HSSFCell cell14 = row.createCell(13);
// 定义单元格为字符串类型
cell1.setCellType(HSSFCell.CELL_TYPE_STRING);
cell2.setCellType(HSSFCell.CELL_TYPE_STRING);
cell3.setCellType(HSSFCell.CELL_TYPE_STRING);
cell4.setCellType(HSSFCell.CELL_TYPE_STRING);
cell5.setCellType(HSSFCell.CELL_TYPE_STRING);
cell6.setCellType(HSSFCell.CELL_TYPE_STRING);
cell7.setCellType(HSSFCell.CELL_TYPE_STRING);
cell8.setCellType(HSSFCell.CELL_TYPE_STRING);
cell9.setCellType(HSSFCell.CELL_TYPE_STRING);
cell10.setCellType(HSSFCell.CELL_TYPE_STRING);
cell11.setCellType(HSSFCell.CELL_TYPE_STRING);
cell12.setCellType(HSSFCell.CELL_TYPE_STRING);
cell13.setCellType(HSSFCell.CELL_TYPE_STRING);
cell14.setCellType(HSSFCell.CELL_TYPE_STRING);
// 在单元格中输入数据
cell1.setCellValue("供应商名称");
cell2.setCellValue("订单编号");
cell3.setCellValue("商品编号");
cell4.setCellValue("小店名称");
cell5.setCellValue("商品原名称");
cell6.setCellValue("入库数量");
cell7.setCellValue("税后单价");
cell8.setCellValue("税后总额");
cell9.setCellValue("退货数量(T)");
cell10.setCellValue("退货价格税后(T)");
cell11.setCellValue("退货金额税后(T)");
cell12.setCellValue("退货数量(TH)");
cell13.setCellValue("退货价格税后(TH)");
cell14.setCellValue("退货金额税后(TH)");
int i=0;
Map<String, String> infoMap = null;
Map<String, String> retMap = null;
for(String key : buyInfoMap.keySet()) {
row = sheet.createRow((short) i + 1);
infoMap = buyInfoMap.get(key);
retMap = returnInfoMap.get(key);
//供应商名称
HSSFCell cellc1 = row.createCell(0);
cellc1.setCellStyle(cellStyle);
cellc1.setCellType(HSSFCell.CELL_TYPE_STRING);
cellc1.setCellValue(infoMap.get("proxyName"));
// 2 订单编号
HSSFCell cellc2 = row.createCell(1);
cellc2.setCellStyle(cellStyle);
cellc2.setCellType(HSSFCell.CELL_TYPE_STRING);
cellc2.setCellValue(infoMap.get("boCode"));
//3商品编号
HSSFCell cellc3 = row.createCell(2);
cellc3.setCellStyle(cellStyle);
cellc3.setCellType(HSSFCell.CELL_TYPE_STRING);
cellc3.setCellValue(infoMap.get("pcode"));
//4小店名称
HSSFCell cellc4 = row.createCell(3);
cellc4.setCellStyle(cellStyle);
cellc4.setCellType(HSSFCell.CELL_TYPE_STRING);
cellc4.setCellValue(infoMap.get("pname"));
// 4商品原名称
HSSFCell cellc5 = row.createCell(4);
cellc5.setCellStyle(cellStyle);
cellc5.setCellType(HSSFCell.CELL_TYPE_STRING);
cellc5.setCellValue(infoMap.get("oriname"));
// 5入库数量
HSSFCell cellc6 = row.createCell(5);
cellc6.setCellStyle(cellStyle);
cellc6.setCellType(HSSFCell.CELL_TYPE_STRING);
cellc6.setCellValue(infoMap.get("incount"));
// 6税后单价
HSSFCell cellc7 = row.createCell(6);
cellc7.setCellStyle(cellStyle);
cellc7.setCellType(HSSFCell.CELL_TYPE_STRING);
cellc7.setCellValue(infoMap.get("price"));
// 7 税后金额
HSSFCell cellc8 = row.createCell(7);
cellc8.setCellStyle(cellStyle);
cellc8.setCellType(HSSFCell.CELL_TYPE_STRING);
cellc8.setCellValue(Arith.mul(
Float.parseFloat(infoMap.get("incount")+""), Float.parseFloat(infoMap.get("price")+""))+"");
// 8退货数量(T)
HSSFCell cellc9 = row.createCell(8);
cellc9.setCellStyle(cellStyle);
cellc9.setCellType(HSSFCell.CELL_TYPE_STRING);
cellc9.setCellValue(retMap.get("b3"));
//9 退货价格税后(T)
HSSFCell cellc10 = row.createCell(9);
cellc10.setCellStyle(cellStyle);
cellc10.setCellType(HSSFCell.CELL_TYPE_STRING);
cellc10.setCellValue(retMap.get("b4"));
// 10退货金额税后(T)
HSSFCell cellc11 = row.createCell(10);
cellc11.setCellStyle(cellStyle);
cellc11.setCellType(HSSFCell.CELL_TYPE_STRING);
cellc11.setCellValue(Arith.mul(
Float.parseFloat(retMap.get("b3")+""), Float.parseFloat(retMap.get("b4")+""))+"");
// 11退货数量(TH)
HSSFCell cellc12 = row.createCell(11);
cellc12.setCellStyle(cellStyle);
cellc12.setCellType(HSSFCell.CELL_TYPE_STRING);
cellc12.setCellValue(retMap.get("b1"));
//12 退货价格税后(TH)
HSSFCell cellc13 = row.createCell(12);
cellc13.setCellStyle(cellStyle);
cellc13.setCellType(HSSFCell.CELL_TYPE_STRING);
cellc13.setCellValue(retMap.get("b2"));
// 13退货金额税后(TH)
HSSFCell cellc14 = row.createCell(13);
cellc14.setCellStyle(cellStyle);
cellc14.setCellType(HSSFCell.CELL_TYPE_STRING);
cellc14.setCellValue(Arith.mul(
Float.parseFloat(retMap.get("b1")+""), Float.parseFloat(retMap.get("b2")+""))+"");
i++;
}
return workbook;
}
}
| UTF-8 | Java | 12,502 | java | BuyService.java | Java | [
{
"context": "描述的是: 导出采购订单结算信息,支持同时导出多个采购订单,回车换行分割\r\n * @author: liubo \r\n * @version: 2013-4-10 下午02:29:58 \r\n * @throw",
"end": 816,
"score": 0.9872042536735535,
"start": 811,
"tag": "USERNAME",
"value": "liubo"
}
]
| null | []
|
/**
* 文件名:BuyService.java
*
* 版本信息:
* 日期:2013-4-12
* Copyright 买卖宝 Corporation 2013
* 版权所有
*
*/
package mmb.buy.order;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.HashMap;
import java.util.Map;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFDataFormat;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import adultadmin.service.impl.BaseServiceImpl;
import adultadmin.util.Arith;
import adultadmin.util.db.DbOperation;
/**
* 此方法描述的是: 导出采购订单结算信息,支持同时导出多个采购订单,回车换行分割
* @author: liubo
* @version: 2013-4-10 下午02:29:58
* @throws Exception
*/
public class BuyService extends BaseServiceImpl {
public BuyService(int useConnType, DbOperation dbOp){
this.useConnType = useConnType;
this.dbOp = dbOp;
}
public BuyService(){
this.useConnType = CONN_IN_METHOD;
}
public HSSFWorkbook exportBuyOrderInfo(String buyOrderCode) throws Exception {
String[] codeValue = buyOrderCode.split("\r\n");
StringBuilder codeBuilder = new StringBuilder();
for(String code : codeValue){
if(codeBuilder.length()>0){
codeBuilder.append(",");
}
codeBuilder.append("'"+code+"'");
}
//封装采购信息,key为code+productId,内部map为具体信息,key为字段名称,value为字段值
Map<String, Map<String, String>> buyInfoMap = new HashMap<String, Map<String, String>>();
//封装退货信息,key为code+productId
Map<String, Map<String, String>> returnInfoMap = new HashMap<String, Map<String, String>>();
PreparedStatement ps = null;
ResultSet rs = null;
PreparedStatement supplierPs = null;
ResultSet supplierRs = null;
try{
StringBuilder buyInfoSqlBuilder = new StringBuilder(
"select bo.code boCode, bo.proxy_id, p.code pcode, p.id pid, p.oriname, p.name pname, bop.stockin_count_bj+bop.stockin_count_gd incount,");
buyInfoSqlBuilder.append("bop.purchase_price*(1+bo.tax_point) price");
buyInfoSqlBuilder.append(
" from buy_order bo join buy_order_product bop on bo.id = bop.buy_order_id");
buyInfoSqlBuilder.append(" join product p on bop.product_id = p.id");
buyInfoSqlBuilder.append(" where bo.code in(");
buyInfoSqlBuilder.append(codeBuilder.toString());
buyInfoSqlBuilder.append(") order by bo.code asc, bop.id asc");
this.dbOp.prepareStatement(buyInfoSqlBuilder.toString());
ps = this.dbOp.getPStmt();
rs = ps.executeQuery();
Map<String, String> infoMap = null;
while(rs.next()){
infoMap = new HashMap<String, String>();
infoMap.put("boCode", rs.getString("boCode"));
infoMap.put("pcode", rs.getString("pcode"));
infoMap.put("oriname", rs.getString("oriname"));
infoMap.put("pname", rs.getString("pname"));
this.dbOp.prepareStatement("select name from supplier_standard_info where id="+rs.getInt("proxy_id"));
supplierPs = this.getDbOp().getPStmt();
supplierRs = supplierPs.executeQuery();
supplierRs.next();
infoMap.put("proxyName", supplierRs.getString("name"));
if(rs.getString("incount") == null){
infoMap.put("incount", "0");
}else{
infoMap.put("incount", rs.getString("incount"));
}
if(rs.getString("price") == null){
infoMap.put("price", "0");
}else{
infoMap.put("price", rs.getString("price"));
}
buyInfoMap.put(rs.getString("boCode")+rs.getString("pid"), infoMap);
}
ps.close();
rs.close();
buyInfoSqlBuilder = new StringBuilder();
buyInfoSqlBuilder.append("select bo.code boCode, bop.product_id pid, t.b1, t.b2, t.b3, t.b4 from buy_order bo join buy_order_product bop");
buyInfoSqlBuilder.append(" on bo.id = bop.buy_order_id");
buyInfoSqlBuilder.append(" left join (select br.buy_order_id brbid,brp.product_id bpid, if(br.return_type=1,brp.return_count,0) b1,");
buyInfoSqlBuilder.append(" if(br.return_type=1,brp.return_price,0) b2, if(br.return_type=2,brp.return_count,0) b3, "
+ "if(br.return_type=2,brp.return_price,0) b4 from buy_return br join buy_return_product brp on br.id = brp.buy_return_id");
buyInfoSqlBuilder.append(" group by br.buy_order_id,brp.product_id) t");
buyInfoSqlBuilder.append(" on bop.buy_order_id = t.brbid and bop.product_id = t.bpid");
buyInfoSqlBuilder.append(" where bo.code in (");
buyInfoSqlBuilder.append(codeBuilder.toString());
buyInfoSqlBuilder.append(") order by bo.code asc, bop.id asc");
this.dbOp.prepareStatement(buyInfoSqlBuilder.toString());
ps = this.dbOp.getPStmt();
rs = ps.executeQuery();
while(rs.next()){
infoMap = new HashMap<String, String>();
if(rs.getString("b1") == null){
infoMap.put("b1", "0");
}else{
infoMap.put("b1", rs.getString("b1"));
}
if(rs.getString("b2") == null){
infoMap.put("b2", "0");
}else{
infoMap.put("b2", rs.getString("b2"));
}
if(rs.getString("b3") == null){
infoMap.put("b3", "0");
}else{
infoMap.put("b3", rs.getString("b3"));
}
if(rs.getString("b4") == null){
infoMap.put("b4", "0");
}else{
infoMap.put("b4", rs.getString("b4"));
}
returnInfoMap.put(rs.getString("boCode")+rs.getString("pid"), infoMap);
}
ps.close();
rs.close();
return createExcel(buyInfoMap, returnInfoMap);
}finally{
if(ps != null){
ps.close();
}
if(rs != null){
rs.close();
}
}
}
private HSSFWorkbook createExcel(Map<String, Map<String, String>> buyInfoMap,
Map<String, Map<String, String>> returnInfoMap) {
HSSFWorkbook workbook = new HSSFWorkbook();
// 在Excel 工作簿中建一工作表
HSSFSheet sheet = workbook.createSheet("采购订单结算信息");
sheet.setColumnWidth(0, 15 * 256);
sheet.setColumnWidth(1, 15 * 256);
sheet.setColumnWidth(2, 15 * 256);
sheet.setColumnWidth(3, 15 * 256);
sheet.setColumnWidth(4, 15 * 256);
sheet.setColumnWidth(5, 15 * 256);
sheet.setColumnWidth(6, 15 * 256);
sheet.setColumnWidth(7, 15 * 256);
sheet.setColumnWidth(8, 15 * 256);
sheet.setColumnWidth(9, 15 * 256);
sheet.setColumnWidth(10, 15 * 256);
sheet.setColumnWidth(11, 15 * 256);
sheet.setColumnWidth(12, 15 * 256);
sheet.setColumnWidth(13, 15 * 256);
// 设置单元格格式(文本)
HSSFCellStyle cellStyle = workbook.createCellStyle();
cellStyle.setDataFormat(HSSFDataFormat.getBuiltinFormat("@"));
// 在索引0的位置创建行(第一行)
HSSFRow row = sheet.createRow((short) 0);
HSSFCell cell1 = row.createCell(0);// 第一列
HSSFCell cell2 = row.createCell(1);
HSSFCell cell3 = row.createCell(2);
HSSFCell cell4 = row.createCell(3);
HSSFCell cell5 = row.createCell(4);
HSSFCell cell6 = row.createCell(5);
HSSFCell cell7 = row.createCell(6);
HSSFCell cell8 = row.createCell(7);
HSSFCell cell9 = row.createCell(8);
HSSFCell cell10 = row.createCell(9);
HSSFCell cell11 = row.createCell(10);
HSSFCell cell12 = row.createCell(11);
HSSFCell cell13 = row.createCell(12);
HSSFCell cell14 = row.createCell(13);
// 定义单元格为字符串类型
cell1.setCellType(HSSFCell.CELL_TYPE_STRING);
cell2.setCellType(HSSFCell.CELL_TYPE_STRING);
cell3.setCellType(HSSFCell.CELL_TYPE_STRING);
cell4.setCellType(HSSFCell.CELL_TYPE_STRING);
cell5.setCellType(HSSFCell.CELL_TYPE_STRING);
cell6.setCellType(HSSFCell.CELL_TYPE_STRING);
cell7.setCellType(HSSFCell.CELL_TYPE_STRING);
cell8.setCellType(HSSFCell.CELL_TYPE_STRING);
cell9.setCellType(HSSFCell.CELL_TYPE_STRING);
cell10.setCellType(HSSFCell.CELL_TYPE_STRING);
cell11.setCellType(HSSFCell.CELL_TYPE_STRING);
cell12.setCellType(HSSFCell.CELL_TYPE_STRING);
cell13.setCellType(HSSFCell.CELL_TYPE_STRING);
cell14.setCellType(HSSFCell.CELL_TYPE_STRING);
// 在单元格中输入数据
cell1.setCellValue("供应商名称");
cell2.setCellValue("订单编号");
cell3.setCellValue("商品编号");
cell4.setCellValue("小店名称");
cell5.setCellValue("商品原名称");
cell6.setCellValue("入库数量");
cell7.setCellValue("税后单价");
cell8.setCellValue("税后总额");
cell9.setCellValue("退货数量(T)");
cell10.setCellValue("退货价格税后(T)");
cell11.setCellValue("退货金额税后(T)");
cell12.setCellValue("退货数量(TH)");
cell13.setCellValue("退货价格税后(TH)");
cell14.setCellValue("退货金额税后(TH)");
int i=0;
Map<String, String> infoMap = null;
Map<String, String> retMap = null;
for(String key : buyInfoMap.keySet()) {
row = sheet.createRow((short) i + 1);
infoMap = buyInfoMap.get(key);
retMap = returnInfoMap.get(key);
//供应商名称
HSSFCell cellc1 = row.createCell(0);
cellc1.setCellStyle(cellStyle);
cellc1.setCellType(HSSFCell.CELL_TYPE_STRING);
cellc1.setCellValue(infoMap.get("proxyName"));
// 2 订单编号
HSSFCell cellc2 = row.createCell(1);
cellc2.setCellStyle(cellStyle);
cellc2.setCellType(HSSFCell.CELL_TYPE_STRING);
cellc2.setCellValue(infoMap.get("boCode"));
//3商品编号
HSSFCell cellc3 = row.createCell(2);
cellc3.setCellStyle(cellStyle);
cellc3.setCellType(HSSFCell.CELL_TYPE_STRING);
cellc3.setCellValue(infoMap.get("pcode"));
//4小店名称
HSSFCell cellc4 = row.createCell(3);
cellc4.setCellStyle(cellStyle);
cellc4.setCellType(HSSFCell.CELL_TYPE_STRING);
cellc4.setCellValue(infoMap.get("pname"));
// 4商品原名称
HSSFCell cellc5 = row.createCell(4);
cellc5.setCellStyle(cellStyle);
cellc5.setCellType(HSSFCell.CELL_TYPE_STRING);
cellc5.setCellValue(infoMap.get("oriname"));
// 5入库数量
HSSFCell cellc6 = row.createCell(5);
cellc6.setCellStyle(cellStyle);
cellc6.setCellType(HSSFCell.CELL_TYPE_STRING);
cellc6.setCellValue(infoMap.get("incount"));
// 6税后单价
HSSFCell cellc7 = row.createCell(6);
cellc7.setCellStyle(cellStyle);
cellc7.setCellType(HSSFCell.CELL_TYPE_STRING);
cellc7.setCellValue(infoMap.get("price"));
// 7 税后金额
HSSFCell cellc8 = row.createCell(7);
cellc8.setCellStyle(cellStyle);
cellc8.setCellType(HSSFCell.CELL_TYPE_STRING);
cellc8.setCellValue(Arith.mul(
Float.parseFloat(infoMap.get("incount")+""), Float.parseFloat(infoMap.get("price")+""))+"");
// 8退货数量(T)
HSSFCell cellc9 = row.createCell(8);
cellc9.setCellStyle(cellStyle);
cellc9.setCellType(HSSFCell.CELL_TYPE_STRING);
cellc9.setCellValue(retMap.get("b3"));
//9 退货价格税后(T)
HSSFCell cellc10 = row.createCell(9);
cellc10.setCellStyle(cellStyle);
cellc10.setCellType(HSSFCell.CELL_TYPE_STRING);
cellc10.setCellValue(retMap.get("b4"));
// 10退货金额税后(T)
HSSFCell cellc11 = row.createCell(10);
cellc11.setCellStyle(cellStyle);
cellc11.setCellType(HSSFCell.CELL_TYPE_STRING);
cellc11.setCellValue(Arith.mul(
Float.parseFloat(retMap.get("b3")+""), Float.parseFloat(retMap.get("b4")+""))+"");
// 11退货数量(TH)
HSSFCell cellc12 = row.createCell(11);
cellc12.setCellStyle(cellStyle);
cellc12.setCellType(HSSFCell.CELL_TYPE_STRING);
cellc12.setCellValue(retMap.get("b1"));
//12 退货价格税后(TH)
HSSFCell cellc13 = row.createCell(12);
cellc13.setCellStyle(cellStyle);
cellc13.setCellType(HSSFCell.CELL_TYPE_STRING);
cellc13.setCellValue(retMap.get("b2"));
// 13退货金额税后(TH)
HSSFCell cellc14 = row.createCell(13);
cellc14.setCellStyle(cellStyle);
cellc14.setCellType(HSSFCell.CELL_TYPE_STRING);
cellc14.setCellValue(Arith.mul(
Float.parseFloat(retMap.get("b1")+""), Float.parseFloat(retMap.get("b2")+""))+"");
i++;
}
return workbook;
}
}
| 12,502 | 0.655936 | 0.626593 | 344 | 32.656979 | 24.354666 | 144 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.151163 | false | false | 4 |
2047cf9c7d76ece4263939c02e1b10b7417b8fb9 | 38,989,713,142,822 | d803e2198fdf489d545ca1cd62e8f43b528204ba | /src/TestScoresTest.java | 45173928dfcd7b5b7fc937810d9e438c620428a0 | []
| no_license | aznthanh23/JavaEarlyObjects | https://github.com/aznthanh23/JavaEarlyObjects | 41f8ece9f761c410d19ac190548148edfd765548 | 0c62e27ca75b2167e43f77aeae729ae932bb3b58 | refs/heads/master | 2016-09-07T04:11:09.554000 | 2015-06-29T06:15:38 | 2015-06-29T06:15:38 | 37,782,151 | 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.
*/
import java.util.Scanner;
/**
*
* @author nhan-admin
*/
public class TestScoresTest {
public static void main(String[]args){
TestScores ts = new TestScores(99.0, 99.5, 99.4);
System.out.println("Test score #1: ");
System.out.println(ts.getT1() + "%");
System.out.println("Test score #2: ");
System.out.println(ts.getT2() + "%");
System.out.println("Test score #3: ");
System.out.println(ts.getT3() + "%");
}
}
| UTF-8 | Java | 668 | java | TestScoresTest.java | Java | [
{
"context": "\n */\n\nimport java.util.Scanner;\n\n/**\n *\n * @author nhan-admin\n */\npublic class TestScoresTest {\n public stat",
"end": 241,
"score": 0.9995137453079224,
"start": 231,
"tag": "USERNAME",
"value": "nhan-admin"
}
]
| 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.
*/
import java.util.Scanner;
/**
*
* @author nhan-admin
*/
public class TestScoresTest {
public static void main(String[]args){
TestScores ts = new TestScores(99.0, 99.5, 99.4);
System.out.println("Test score #1: ");
System.out.println(ts.getT1() + "%");
System.out.println("Test score #2: ");
System.out.println(ts.getT2() + "%");
System.out.println("Test score #3: ");
System.out.println(ts.getT3() + "%");
}
}
| 668 | 0.612275 | 0.58982 | 27 | 23.74074 | 23.724644 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.481481 | false | false | 4 |
7acda00c6e8a684908dd8e9dba57209e455c4e31 | 36,653,250,926,480 | af9983f8f1ef3f72a12bc34eba76f929f2546100 | /samples/src/main/java/org/daniels/springboot/samples/configurationproperties/ConfigurationPropertiesApplication.java | 02a5baf90acf825004b86c18274b425fe0278142 | []
| no_license | daniels75/SpringFrameworkSamples | https://github.com/daniels75/SpringFrameworkSamples | 67c71a5ea2981f4a97cbccfce8d24c30c98fd0db | c7ab8d7396e2afd05a85ee1f3e38fcee0dffe0ad | refs/heads/master | 2021-07-01T19:10:17.915000 | 2021-03-09T20:54:32 | 2021-03-09T20:54:32 | 219,283,313 | 0 | 0 | null | false | 2021-03-04T19:29:52 | 2019-11-03T10:23:14 | 2021-03-04T19:28:57 | 2021-03-04T19:29:50 | 2,978 | 0 | 0 | 5 | HTML | false | false | package org.daniels.springboot.samples.configurationproperties;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
@SpringBootApplication
public class ConfigurationPropertiesApplication {
public static void main(String[] args) {
ApplicationContext context = SpringApplication.run(ConfigurationPropertiesApplication.class, args);
ConfigProperties configProperties = (ConfigProperties)context.getBean("configProperties");
System.out.println(configProperties.getHostName());
}
}
| UTF-8 | Java | 639 | java | ConfigurationPropertiesApplication.java | Java | []
| null | []
| package org.daniels.springboot.samples.configurationproperties;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
@SpringBootApplication
public class ConfigurationPropertiesApplication {
public static void main(String[] args) {
ApplicationContext context = SpringApplication.run(ConfigurationPropertiesApplication.class, args);
ConfigProperties configProperties = (ConfigProperties)context.getBean("configProperties");
System.out.println(configProperties.getHostName());
}
}
| 639 | 0.810642 | 0.810642 | 19 | 32.63158 | 34.912235 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.421053 | false | false | 4 |
961051fb191efa04dc0b5d7265c2e3145eff9d35 | 35,476,429,902,125 | 3cba5d6c2149b455453103a53a8f1e836fe58657 | /eclipse-workspace/practice11_Q/src/practice11_Q/Practice11_12.java | 5df91cb9021a1aa7e6cf3239ebb4ecbd6b7d96d6 | [
"MIT"
]
| permissive | gugucon-hwan/All_Subject | https://github.com/gugucon-hwan/All_Subject | 203cac88187bd3913acb6c0e24c0bda9c171fbc8 | 9c0d378b98a417cdfbea834502dc0e3b41b3ab22 | refs/heads/master | 2022-12-25T00:17:31.691000 | 2020-10-04T13:03:13 | 2020-10-04T13:03:13 | 297,344,761 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package practice11_Q;
import java.util.HashMap;
/*
* [11-12] 다음은 섯다게임에서 카드의 순위를 결정하는 등급목록(족보)이다.
* HashMap에등급과 점수를 저장하는 registerJokbo()와 게임참가자의 점수를 계산해서 반환하는 getPoint()를 완성하시오.
* [참고] 섯다게임은 두 장의 카드의 숫자를 더한 값을 10으로 나눈 나머지가 높은 쪽이 이기는 게임이다.
* 그 외에도 특정 숫자로 구성된 카드로 이루어진 등급(족보)이 있어서 높은 등급의 카드가 이긴다.
*
*
* [실행결과]
[타짜]5,9 1004
[고수]1,1K 3010
*/
class SutdaDeck2 {
final int CARD_NUM = 20;
SutdaCard2[] cards = new SutdaCard2[CARD_NUM];
int pos = 0; // 다음에 가져올 카드의 위치
HashMap jokbo = new HashMap(); // 족보를 저장할 HashMap
SutdaDeck2() {
for (int i = 0; i < cards.length; i++) {
int num = i % 10 + 1;
boolean isKwang = i < 10 && (num == 1 || num == 3 || num == 8);
cards[i] = new SutdaCard2(num, isKwang);
}
registerJokbo(); // 족보를 등록한다.
}
SutdaCard2 pick() throws Exception {
SutdaCard2 c = null;
if (0 <= pos && pos < CARD_NUM) {
c = cards[pos];
cards[pos++] = null;
} else {
throw new Exception("남아있는 카드가 없습니다.");
}
return c;
}
void shuffle() {
for (int x = 0; x < CARD_NUM * 2; x++) {
int i = (int) (Math.random() * CARD_NUM);
int j = (int) (Math.random() * CARD_NUM);
SutdaCard2 tmp = cards[i];
cards[i] = cards[j];
cards[j] = tmp;
}
registerJokbo(); // 족보를 등록한다.
}
void registerJokbo(){
/*
(1) 아래의 로직에 맞게 코드를 작성하시오.
1. jokbo(HashMap)에 족보를 저장한다.
두 카드의 값을 문자열로 붙여서 key로, 점수를 value로 저장한다.
*/
jokbo.put("KK", 4000);
jokbo.put("1010",3100);
jokbo.put("99",3090);
jokbo.put("88",3080);
jokbo.put("77",3070);
jokbo.put("66",3060);
jokbo.put("55",3050);
jokbo.put("44",3040);
jokbo.put("33",3030);
jokbo.put("22",3020);
jokbo.put("11",3010);
jokbo.put("12",2060);
jokbo.put("21",2060);
jokbo.put("14",2050);
jokbo.put("41",2050);
jokbo.put("19",2040);
jokbo.put("91",2040);
jokbo.put("110",2030);
jokbo.put("101",2030);
jokbo.put("410",2020);
jokbo.put("104",2020);
jokbo.put("46",2010);
jokbo.put("64",2010);
}
int getPoint(Player p){
if(p==null)
return 0;
SutdaCard2 c1=p.c1;
SutdaCard2 c2=p.c2;
Integer result=0;
/*
(2) 아래의 로직에 맞게 코드를 작성하시오.
1. 카드 두 장이 모두 광이면, jokbo에서 키를 "KK"로 해서 점수를 조회한다.
*/
if(c1.isKwang&&c2.isKwang) {
result=(Integer)jokbo.get("KK");
}else {
/*
2. 두 카드의 숫자(num)로 jokbo에서 등급을 조회한다.
*/
result=(Integer)jokbo.get(""+c1.num+c2.num);
/*
3. 해당하는 등급이 없으면, 아래의 공식으로 점수를 계산한다.
(c1.num + c2.num) % 10 + 1000
*/
if(result==null) {
result=new Integer((c1.num+c2.num)%10+1000);
}
}
/*
4. Player의 점수(point)에 계산한 값을 저장한다.
*/
p.point=result.intValue();
return result.intValue();
}
} // SutdaDeck2
class Player {
String name;
SutdaCard2 c1;
SutdaCard2 c2;
int point; // 카드의 등급에 따른 점수 - 새로 추가
Player(String name, SutdaCard2 c1, SutdaCard2 c2) {
this.name = name;
this.c1 = c1;
this.c2 = c2;
}
public String toString() {
return "[" + name + "]" + c1.toString() + "," + c2.toString();
}
} // class Player
class SutdaCard2 {
int num;
boolean isKwang;
SutdaCard2() {
this(1, true);
}
SutdaCard2(int num, boolean isKwang) {
this.num = num;
this.isKwang = isKwang;
}
public String toString() {
return num + (isKwang ? "K" : "");
}
}
public class Practice11_12 {
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
SutdaDeck2 deck = new SutdaDeck2();
deck.shuffle();
Player p1 = new Player("타짜", deck.pick(), deck.pick());
Player p2 = new Player("고수", deck.pick(), deck.pick());
System.out.println(p1+" "+deck.getPoint(p1));
System.out.println(p2+" "+deck.getPoint(p2));
}
}
| UHC | Java | 4,278 | java | Practice11_12.java | Java | [
{
"context": "k2();\n\t\tdeck.shuffle();\n\t\tPlayer p1 = new Player(\"타짜\", deck.pick(), deck.pick());\n\t\tPlayer p2 = new Pl",
"end": 3396,
"score": 0.785698413848877,
"start": 3394,
"tag": "NAME",
"value": "타짜"
},
{
"context": "k.pick(), deck.pick());\n\t\tPlayer p2 = new Player(\"고수\", deck.pick(), deck.pick());\n\t\tSystem.out.println",
"end": 3454,
"score": 0.7566425800323486,
"start": 3452,
"tag": "NAME",
"value": "고수"
}
]
| null | []
| package practice11_Q;
import java.util.HashMap;
/*
* [11-12] 다음은 섯다게임에서 카드의 순위를 결정하는 등급목록(족보)이다.
* HashMap에등급과 점수를 저장하는 registerJokbo()와 게임참가자의 점수를 계산해서 반환하는 getPoint()를 완성하시오.
* [참고] 섯다게임은 두 장의 카드의 숫자를 더한 값을 10으로 나눈 나머지가 높은 쪽이 이기는 게임이다.
* 그 외에도 특정 숫자로 구성된 카드로 이루어진 등급(족보)이 있어서 높은 등급의 카드가 이긴다.
*
*
* [실행결과]
[타짜]5,9 1004
[고수]1,1K 3010
*/
class SutdaDeck2 {
final int CARD_NUM = 20;
SutdaCard2[] cards = new SutdaCard2[CARD_NUM];
int pos = 0; // 다음에 가져올 카드의 위치
HashMap jokbo = new HashMap(); // 족보를 저장할 HashMap
SutdaDeck2() {
for (int i = 0; i < cards.length; i++) {
int num = i % 10 + 1;
boolean isKwang = i < 10 && (num == 1 || num == 3 || num == 8);
cards[i] = new SutdaCard2(num, isKwang);
}
registerJokbo(); // 족보를 등록한다.
}
SutdaCard2 pick() throws Exception {
SutdaCard2 c = null;
if (0 <= pos && pos < CARD_NUM) {
c = cards[pos];
cards[pos++] = null;
} else {
throw new Exception("남아있는 카드가 없습니다.");
}
return c;
}
void shuffle() {
for (int x = 0; x < CARD_NUM * 2; x++) {
int i = (int) (Math.random() * CARD_NUM);
int j = (int) (Math.random() * CARD_NUM);
SutdaCard2 tmp = cards[i];
cards[i] = cards[j];
cards[j] = tmp;
}
registerJokbo(); // 족보를 등록한다.
}
void registerJokbo(){
/*
(1) 아래의 로직에 맞게 코드를 작성하시오.
1. jokbo(HashMap)에 족보를 저장한다.
두 카드의 값을 문자열로 붙여서 key로, 점수를 value로 저장한다.
*/
jokbo.put("KK", 4000);
jokbo.put("1010",3100);
jokbo.put("99",3090);
jokbo.put("88",3080);
jokbo.put("77",3070);
jokbo.put("66",3060);
jokbo.put("55",3050);
jokbo.put("44",3040);
jokbo.put("33",3030);
jokbo.put("22",3020);
jokbo.put("11",3010);
jokbo.put("12",2060);
jokbo.put("21",2060);
jokbo.put("14",2050);
jokbo.put("41",2050);
jokbo.put("19",2040);
jokbo.put("91",2040);
jokbo.put("110",2030);
jokbo.put("101",2030);
jokbo.put("410",2020);
jokbo.put("104",2020);
jokbo.put("46",2010);
jokbo.put("64",2010);
}
int getPoint(Player p){
if(p==null)
return 0;
SutdaCard2 c1=p.c1;
SutdaCard2 c2=p.c2;
Integer result=0;
/*
(2) 아래의 로직에 맞게 코드를 작성하시오.
1. 카드 두 장이 모두 광이면, jokbo에서 키를 "KK"로 해서 점수를 조회한다.
*/
if(c1.isKwang&&c2.isKwang) {
result=(Integer)jokbo.get("KK");
}else {
/*
2. 두 카드의 숫자(num)로 jokbo에서 등급을 조회한다.
*/
result=(Integer)jokbo.get(""+c1.num+c2.num);
/*
3. 해당하는 등급이 없으면, 아래의 공식으로 점수를 계산한다.
(c1.num + c2.num) % 10 + 1000
*/
if(result==null) {
result=new Integer((c1.num+c2.num)%10+1000);
}
}
/*
4. Player의 점수(point)에 계산한 값을 저장한다.
*/
p.point=result.intValue();
return result.intValue();
}
} // SutdaDeck2
class Player {
String name;
SutdaCard2 c1;
SutdaCard2 c2;
int point; // 카드의 등급에 따른 점수 - 새로 추가
Player(String name, SutdaCard2 c1, SutdaCard2 c2) {
this.name = name;
this.c1 = c1;
this.c2 = c2;
}
public String toString() {
return "[" + name + "]" + c1.toString() + "," + c2.toString();
}
} // class Player
class SutdaCard2 {
int num;
boolean isKwang;
SutdaCard2() {
this(1, true);
}
SutdaCard2(int num, boolean isKwang) {
this.num = num;
this.isKwang = isKwang;
}
public String toString() {
return num + (isKwang ? "K" : "");
}
}
public class Practice11_12 {
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
SutdaDeck2 deck = new SutdaDeck2();
deck.shuffle();
Player p1 = new Player("타짜", deck.pick(), deck.pick());
Player p2 = new Player("고수", deck.pick(), deck.pick());
System.out.println(p1+" "+deck.getPoint(p1));
System.out.println(p2+" "+deck.getPoint(p2));
}
}
| 4,278 | 0.597323 | 0.527328 | 173 | 19.728323 | 17.087032 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.121387 | false | false | 4 |
947429b9add69dc7b4e23a0ec99da6ff1fabc68a | 15,101,105,038,602 | 935ed0cc8ba3ecbbdfac39293bf9233c43d42f01 | /app/src/main/java/com/epicodus/breakthecode/ui/NonProfitActivity.java | 47f3b44b84ae1df1ab800736f11e110b0ca62ef2 | [
"MIT"
]
| permissive | theholla/break-the-code | https://github.com/theholla/break-the-code | 9457bb073495ce99a0600ea275a92f1eb399c377 | e439a08ef6059cd1dd869aa2d88921f97f01adf7 | refs/heads/master | 2021-01-10T02:30:46.609000 | 2015-10-28T00:47:08 | 2015-10-28T00:47:08 | 44,551,612 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.epicodus.breakthecode.ui;
import android.content.Intent;
import android.media.Image;
import android.net.Uri;
import android.provider.Telephony;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
import android.widget.ImageView;
import android.widget.Button;
import android.view.View.OnClickListener;
import com.epicodus.breakthecode.models.Partner;
import com.epicodus.breakthecode.R;
import com.epicodus.breakthecode.models.PartnerLib;
import org.w3c.dom.Text;
public class NonProfitActivity extends AppCompatActivity {
private TextView mNameLabel;
private TextView mDescriptionLabel;
private ImageView mPartnerImage;
private Button mNextButton;
private PartnerLib mPartnerLib;
private Partner mCurrentPartner;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_non_profit);
mNameLabel = (TextView) findViewById(R.id.nameLabel);
mDescriptionLabel = (TextView) findViewById(R.id.descriptionLabel);
mPartnerImage = (ImageView) findViewById(R.id.partnerImage);
mNextButton = (Button) findViewById(R.id.nextButton);
mPartnerLib = new PartnerLib();
mCurrentPartner = mPartnerLib.getPartners().get(0);
setLayoutContent();
mNextButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mCurrentPartner = mPartnerLib.nextPartner(mCurrentPartner);
setLayoutContent();
}
});
mPartnerImage.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(mCurrentPartner.getWebsite()));
startActivity(intent);
}
});
}
private void setLayoutContent() {
mNameLabel.setText(mCurrentPartner.getName());
mDescriptionLabel.setText(mCurrentPartner.getDescription());
mPartnerImage.setImageResource(mCurrentPartner.getImage());
}
}
| UTF-8 | Java | 2,279 | java | NonProfitActivity.java | Java | []
| null | []
| package com.epicodus.breakthecode.ui;
import android.content.Intent;
import android.media.Image;
import android.net.Uri;
import android.provider.Telephony;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
import android.widget.ImageView;
import android.widget.Button;
import android.view.View.OnClickListener;
import com.epicodus.breakthecode.models.Partner;
import com.epicodus.breakthecode.R;
import com.epicodus.breakthecode.models.PartnerLib;
import org.w3c.dom.Text;
public class NonProfitActivity extends AppCompatActivity {
private TextView mNameLabel;
private TextView mDescriptionLabel;
private ImageView mPartnerImage;
private Button mNextButton;
private PartnerLib mPartnerLib;
private Partner mCurrentPartner;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_non_profit);
mNameLabel = (TextView) findViewById(R.id.nameLabel);
mDescriptionLabel = (TextView) findViewById(R.id.descriptionLabel);
mPartnerImage = (ImageView) findViewById(R.id.partnerImage);
mNextButton = (Button) findViewById(R.id.nextButton);
mPartnerLib = new PartnerLib();
mCurrentPartner = mPartnerLib.getPartners().get(0);
setLayoutContent();
mNextButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mCurrentPartner = mPartnerLib.nextPartner(mCurrentPartner);
setLayoutContent();
}
});
mPartnerImage.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(mCurrentPartner.getWebsite()));
startActivity(intent);
}
});
}
private void setLayoutContent() {
mNameLabel.setText(mCurrentPartner.getName());
mDescriptionLabel.setText(mCurrentPartner.getDescription());
mPartnerImage.setImageResource(mCurrentPartner.getImage());
}
}
| 2,279 | 0.708644 | 0.707328 | 68 | 32.514706 | 23.487476 | 104 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.632353 | false | false | 4 |
a3c0299a255a82da8aff21a493d41bb633781af0 | 10,608,569,239,854 | 2a1333a53f64074fcd89978a4517f76eda1851da | /src/com/leetcode/solutions/array/Q287_FindTheDuplicateNumber.java | a70025584fcb64107816af7be80f16e1fb822cee | []
| no_license | UserCr/LeetCode | https://github.com/UserCr/LeetCode | 5aab4834475245735cd6ba21f9148bcb0c5286ca | 73e2f916be5eb7098d92e6d3e33f08b3225a7c52 | refs/heads/master | 2020-07-21T22:46:18.748000 | 2020-01-01T11:50:43 | 2020-01-01T11:50:43 | 206,991,195 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.leetcode.solutions.array;
import com.leetcode.solutions.SolutionInterface;
public class Q287_FindTheDuplicateNumber implements SolutionInterface {
@Override
public void run() {
}
/***
* 以下解法非常难想到,难点在于将问题和链表联系起来。
* 可以将数组看成是数组链表,因为有重复的数,所以会有多个结点指向同一个结点,也就是说,数组链表中有环。
* 问题至此转化为链表中确定环的起点问题。
*/
public int findDuplicate(int[] nums) {
int fast = nums[nums[0]], slow = nums[0];
while (fast != slow) {
fast = nums[nums[fast]];
slow = nums[slow];
}
slow = 0;
while (fast != slow) {
fast = nums[fast];
slow = nums[slow];
}
return fast;
}
}
| UTF-8 | Java | 882 | java | Q287_FindTheDuplicateNumber.java | Java | []
| null | []
| package com.leetcode.solutions.array;
import com.leetcode.solutions.SolutionInterface;
public class Q287_FindTheDuplicateNumber implements SolutionInterface {
@Override
public void run() {
}
/***
* 以下解法非常难想到,难点在于将问题和链表联系起来。
* 可以将数组看成是数组链表,因为有重复的数,所以会有多个结点指向同一个结点,也就是说,数组链表中有环。
* 问题至此转化为链表中确定环的起点问题。
*/
public int findDuplicate(int[] nums) {
int fast = nums[nums[0]], slow = nums[0];
while (fast != slow) {
fast = nums[nums[fast]];
slow = nums[slow];
}
slow = 0;
while (fast != slow) {
fast = nums[fast];
slow = nums[slow];
}
return fast;
}
}
| 882 | 0.566282 | 0.557637 | 29 | 22.931034 | 18.650934 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.344828 | false | false | 4 |
c1db87003a1a134549a81077d2ac5b349346d417 | 10,608,569,240,402 | 69a4f2d51ebeea36c4d8192e25cfb5f3f77bef5e | /methods/Method_20617.java | 34452737c861d08bc682bca6a3f2ba89ecdc7664 | []
| no_license | P79N6A/icse_20_user_study | https://github.com/P79N6A/icse_20_user_study | 5b9c42c6384502fdc9588430899f257761f1f506 | 8a3676bc96059ea2c4f6d209016f5088a5628f3c | refs/heads/master | 2020-06-24T08:25:22.606000 | 2019-07-25T15:31:16 | 2019-07-25T15:31:16 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | public void trackViewedCreatorBioModal(final @NonNull Project project){
final User loggedInUser=this.client.loggedInUser();
final Map<String,Object> props=KoalaUtils.projectProperties(project,loggedInUser);
props.put("modal_title","creatorBioModal");
this.client.track(KoalaEvent.MODAL_DIALOG_VIEW,props);
}
| UTF-8 | Java | 316 | java | Method_20617.java | Java | []
| null | []
| public void trackViewedCreatorBioModal(final @NonNull Project project){
final User loggedInUser=this.client.loggedInUser();
final Map<String,Object> props=KoalaUtils.projectProperties(project,loggedInUser);
props.put("modal_title","creatorBioModal");
this.client.track(KoalaEvent.MODAL_DIALOG_VIEW,props);
}
| 316 | 0.803797 | 0.803797 | 6 | 51.666668 | 25.985039 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.333333 | false | false | 4 |
6a4771484a7bc94d918fb64f6744876bab61b3cc | 36,034,775,625,975 | b883581fc9e1a62eb518bf728e898a1576cb4397 | /base/src/main/java/com/doomsday/base/ui/BaseActivity.java | ca3f62e7718220b1946a18b31988ad4f001f0207 | [
"Apache-2.0"
]
| permissive | shabic/BaseDevelopment | https://github.com/shabic/BaseDevelopment | 35b0c5a041cacb6a60215cbedb8886a5c5ba76c8 | b3a840dfa23690140cbb12762339da55835109b2 | refs/heads/master | 2021-09-02T09:13:16.498000 | 2018-01-01T09:47:58 | 2018-01-01T09:47:58 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.doomsday.base.ui;
import android.app.Activity;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.util.SparseArray;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.view.inputmethod.InputMethodManager;
import android.widget.TextView;
import com.doomsday.base.utils.PresenterUtils;
import com.qmuiteam.qmui.util.QMUIStatusBarHelper;
import org.greenrobot.eventbus.EventBus;
/**
* Created by Administrator on 2016/12/22.
*/
public abstract class BaseActivity<P extends BasePresenter> extends AppCompatActivity implements BaseUi {
public Context mContext;
public Activity mActivity;
public P mPresenter;
protected SparseArray<View> mViews = new SparseArray<View>();
private View.OnClickListener clickListener;
private InputMethodManager inputMethodManager;
private boolean hide = false;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
super.onCreate(savedInstanceState);
int layoutId = PresenterUtils.getLayoutId(this);
if (layoutId > 0)
setContentView(layoutId);
if (useEventBus()) EventBus.getDefault().register(this);
if (autoHideInputMethodWindow() && inputMethodManager == null) {
inputMethodManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
hide = true;
}
mContext = mActivity = this;
initPresenter();
clickListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
BaseActivity.this.onClick(view);
}
};
if (isDestroyed()) return;
initView();
}
public void onClick(View view) {
}
//如果需要自动隐藏输入框在子类返回true
protected boolean autoHideInputMethodWindow() {
return false;
}
protected boolean useEventBus() {
return false;
}
public void setOnClickListener(View.OnClickListener listener, int... ids) {
if (ids == null) return;
for (int id : ids)
get(id).setOnClickListener(listener == null ? clickListener : listener);
}
public <V extends View> V get(int id) {
if (mViews != null) {
V view = (V) mViews.get(id);
if (view == null) {
view = findViewById(id);
mViews.put(id, view);
}
return view;
}
return null;
}
public void setText(int id, String str) {
((TextView) get(id)).setText(str == null ? "" : str);
}
@Override
protected void onDestroy() {
if (useEventBus() && EventBus.getDefault().isRegistered(this))
EventBus.getDefault().unregister(this);
if (mPresenter != null) mPresenter.destroy();
mPresenter = null;
mViews.clear();
mViews = null;
if (hide) hideInputMethodWindow();
super.onDestroy();
}
@Override
protected void onResume() {
super.onResume();
QMUIStatusBarHelper.translucent(this);
QMUIStatusBarHelper.setStatusBarLightMode(this);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if (hide && event.getAction() == MotionEvent.ACTION_DOWN)
hideInputMethodWindow();
return super.onTouchEvent(event);
}
public void hideInputMethodWindow() {
if (inputMethodManager != null && getCurrentFocus() != null && getCurrentFocus().getWindowToken() != null)
inputMethodManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
}
@Override
public final void initPresenter() {
mPresenter = PresenterUtils.initPresenter(this);
if (mPresenter != null)
mPresenter.mView = this;
}
} | UTF-8 | Java | 4,163 | java | BaseActivity.java | Java | [
{
"context": "g.greenrobot.eventbus.EventBus;\n\n/**\n * Created by Administrator on 2016/12/22.\n */\n\npublic abstract class BaseAct",
"end": 684,
"score": 0.7676429748535156,
"start": 671,
"tag": "NAME",
"value": "Administrator"
}
]
| null | []
| package com.doomsday.base.ui;
import android.app.Activity;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.util.SparseArray;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.view.inputmethod.InputMethodManager;
import android.widget.TextView;
import com.doomsday.base.utils.PresenterUtils;
import com.qmuiteam.qmui.util.QMUIStatusBarHelper;
import org.greenrobot.eventbus.EventBus;
/**
* Created by Administrator on 2016/12/22.
*/
public abstract class BaseActivity<P extends BasePresenter> extends AppCompatActivity implements BaseUi {
public Context mContext;
public Activity mActivity;
public P mPresenter;
protected SparseArray<View> mViews = new SparseArray<View>();
private View.OnClickListener clickListener;
private InputMethodManager inputMethodManager;
private boolean hide = false;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
super.onCreate(savedInstanceState);
int layoutId = PresenterUtils.getLayoutId(this);
if (layoutId > 0)
setContentView(layoutId);
if (useEventBus()) EventBus.getDefault().register(this);
if (autoHideInputMethodWindow() && inputMethodManager == null) {
inputMethodManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
hide = true;
}
mContext = mActivity = this;
initPresenter();
clickListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
BaseActivity.this.onClick(view);
}
};
if (isDestroyed()) return;
initView();
}
public void onClick(View view) {
}
//如果需要自动隐藏输入框在子类返回true
protected boolean autoHideInputMethodWindow() {
return false;
}
protected boolean useEventBus() {
return false;
}
public void setOnClickListener(View.OnClickListener listener, int... ids) {
if (ids == null) return;
for (int id : ids)
get(id).setOnClickListener(listener == null ? clickListener : listener);
}
public <V extends View> V get(int id) {
if (mViews != null) {
V view = (V) mViews.get(id);
if (view == null) {
view = findViewById(id);
mViews.put(id, view);
}
return view;
}
return null;
}
public void setText(int id, String str) {
((TextView) get(id)).setText(str == null ? "" : str);
}
@Override
protected void onDestroy() {
if (useEventBus() && EventBus.getDefault().isRegistered(this))
EventBus.getDefault().unregister(this);
if (mPresenter != null) mPresenter.destroy();
mPresenter = null;
mViews.clear();
mViews = null;
if (hide) hideInputMethodWindow();
super.onDestroy();
}
@Override
protected void onResume() {
super.onResume();
QMUIStatusBarHelper.translucent(this);
QMUIStatusBarHelper.setStatusBarLightMode(this);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if (hide && event.getAction() == MotionEvent.ACTION_DOWN)
hideInputMethodWindow();
return super.onTouchEvent(event);
}
public void hideInputMethodWindow() {
if (inputMethodManager != null && getCurrentFocus() != null && getCurrentFocus().getWindowToken() != null)
inputMethodManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
}
@Override
public final void initPresenter() {
mPresenter = PresenterUtils.initPresenter(this);
if (mPresenter != null)
mPresenter.mView = this;
}
} | 4,163 | 0.651658 | 0.649237 | 135 | 29.607407 | 25.065277 | 127 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.496296 | false | false | 4 |
db3a521318f78f7bc3988da37d59c093dd7b9814 | 36,034,775,628,102 | 211718dd0b859f84f5113de2e15022026e009534 | /example_project/src/ty_gagon_name_classes_example_project/Exceptional_parsing.java | ec58b8112fbb415189957f40a3db3dcd749d5250 | []
| no_license | tydant/java-projects-2020 | https://github.com/tydant/java-projects-2020 | 021e21e59ceb26bf90435abf4c611af0c81460fd | 09662d1783e40874395dd55c6310d31f966586f4 | refs/heads/master | 2020-07-19T07:46:24.349000 | 2019-11-18T20:00:55 | 2019-11-18T20:00:55 | 206,404,884 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ty_gagon_name_classes_example_project;
public class Exceptional_parsing {
public Exceptional_parsing() {
// TODO Auto-generated constructor stub
}
public static void main(String[] args) {
new Exceptional_parsing();
String myAge = "17";
String myCost = "12.95";
String myBool = "false";
String myByte = "twelve";
// Convert myAge to an integer
int age = Integer.parseInt(myAge);
System.out.println(age);
// Convert myCost to a float
float cost = Float.parseFloat(myCost);
System.out.println(cost);
// convert MyBool to a boolean
boolean answer = Boolean.parseBoolean(myBool);
System.out.println(answer);
// convert myByte to a byte
byte oops = Byte.parseByte(myByte);
// only contains numbers between -128 and 127
System.out.println(oops);
}
}
| UTF-8 | Java | 805 | java | Exceptional_parsing.java | Java | []
| null | []
| package ty_gagon_name_classes_example_project;
public class Exceptional_parsing {
public Exceptional_parsing() {
// TODO Auto-generated constructor stub
}
public static void main(String[] args) {
new Exceptional_parsing();
String myAge = "17";
String myCost = "12.95";
String myBool = "false";
String myByte = "twelve";
// Convert myAge to an integer
int age = Integer.parseInt(myAge);
System.out.println(age);
// Convert myCost to a float
float cost = Float.parseFloat(myCost);
System.out.println(cost);
// convert MyBool to a boolean
boolean answer = Boolean.parseBoolean(myBool);
System.out.println(answer);
// convert myByte to a byte
byte oops = Byte.parseByte(myByte);
// only contains numbers between -128 and 127
System.out.println(oops);
}
}
| 805 | 0.699379 | 0.684472 | 33 | 23.39394 | 16.066036 | 48 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.818182 | false | false | 4 |
db262a8652e2533cb3fd6cb8e8cf8c632f8c1818 | 35,021,163,343,549 | e1e34b6365cf54afdc8fb77207f193f9eedab882 | /src/main/java/com/hardware/store/repositories/UserRepository.java | d2e2638dd6927f7776dba62b97b776fc04222310 | []
| no_license | Frostetsky/MSUCE_store_diplom | https://github.com/Frostetsky/MSUCE_store_diplom | 1cb03eff14cabfd7aa8c4783b3129ee636332d52 | 6314712676e57b256ad2fd41efd4516c0929448a | refs/heads/master | 2023-06-10T22:50:25.678000 | 2021-07-05T09:00:08 | 2021-07-05T09:00:08 | 368,351,792 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.hardware.store.repositories;
import com.hardware.store.entities.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import java.util.List;
public interface UserRepository extends JpaRepository<User, Long> {
User findByUsername(String username);
@Query(value = "SELECT company_name FROM users Group by company_name", nativeQuery = true)
public List<String> findAllCompaniesNames();
} | UTF-8 | Java | 482 | java | UserRepository.java | Java | []
| null | []
| package com.hardware.store.repositories;
import com.hardware.store.entities.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import java.util.List;
public interface UserRepository extends JpaRepository<User, Long> {
User findByUsername(String username);
@Query(value = "SELECT company_name FROM users Group by company_name", nativeQuery = true)
public List<String> findAllCompaniesNames();
} | 482 | 0.792531 | 0.792531 | 16 | 29.1875 | 29.468668 | 94 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5625 | false | false | 4 |
104deab7b08eb3c83d4d22a491cb102fcab6f6c7 | 35,364,760,730,170 | 739a9e9b3a74c67bf00d9df13e933d3f2941c90c | /src/org/usfirst/frc/team4418/robot/subsystems/PhotoElectricSubsystem2.java | 1488671ffca6687e90e3dd214761314cffeedf43 | []
| no_license | FRC4418/2018-Java | https://github.com/FRC4418/2018-Java | 911019b31e4ad14bbf1e4bc3a5ae68bf3e0f9706 | 1d8582cfc436b47753b9eb99f343f288531c606a | refs/heads/master | 2021-09-10T09:41:28.691000 | 2018-02-20T23:16:19 | 2018-02-20T23:16:19 | 116,984,401 | 1 | 0 | null | false | 2018-02-20T23:16:20 | 2018-01-10T16:46:49 | 2018-01-13T19:09:36 | 2018-02-20T23:16:20 | 1,682 | 0 | 0 | 0 | Java | false | null | package org.usfirst.frc.team4418.robot.subsystems;
import org.usfirst.frc.team4418.robot.RobotMap;
import org.usfirst.frc.team4418.robot.commands.PhotoElectricDisplay2;
import edu.wpi.first.wpilibj.AnalogInput;
import edu.wpi.first.wpilibj.command.Subsystem;
public class PhotoElectricSubsystem2 extends Subsystem {
public PhotoElectricSubsystem2() {
super();
}
AnalogInput photoElectric = new AnalogInput(RobotMap.photoElectric2_analog_ID);
public double getVoltage () {
return (photoElectric.getVoltage());
}
// Put methods for controlling this subsystem
// here. Call these from Commands.
public void initDefaultCommand() {
setDefaultCommand(new PhotoElectricDisplay2());
// Set the default command for a subsystem here.
//setDefaultCommand(new MySpecialCommand());
}
}
| UTF-8 | Java | 821 | java | PhotoElectricSubsystem2.java | Java | []
| null | []
| package org.usfirst.frc.team4418.robot.subsystems;
import org.usfirst.frc.team4418.robot.RobotMap;
import org.usfirst.frc.team4418.robot.commands.PhotoElectricDisplay2;
import edu.wpi.first.wpilibj.AnalogInput;
import edu.wpi.first.wpilibj.command.Subsystem;
public class PhotoElectricSubsystem2 extends Subsystem {
public PhotoElectricSubsystem2() {
super();
}
AnalogInput photoElectric = new AnalogInput(RobotMap.photoElectric2_analog_ID);
public double getVoltage () {
return (photoElectric.getVoltage());
}
// Put methods for controlling this subsystem
// here. Call these from Commands.
public void initDefaultCommand() {
setDefaultCommand(new PhotoElectricDisplay2());
// Set the default command for a subsystem here.
//setDefaultCommand(new MySpecialCommand());
}
}
| 821 | 0.762485 | 0.741778 | 24 | 33.166668 | 23.900255 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.916667 | false | false | 4 |
f2a8633b813ce3f338f73cca4d4efe847125a445 | 36,696,200,583,519 | 9424c9fc10b7934a87190532565e31295f68b390 | /Java/src/harmless/model/Slice.java | c8a8834d6880661430c1ec1ded00b3342cd83d90 | []
| no_license | jaunis/Harmless | https://github.com/jaunis/Harmless | 3b7d4300db00855eb0bd311ada84e816f6feacf6 | f72e78a71d3889cfd108abecf6daa6c41f956eea | refs/heads/master | 2021-01-22T22:49:06.824000 | 2012-03-23T11:47:10 | 2012-03-23T11:47:10 | 3,254,969 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
*
*/
package harmless.model;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
/**
* @author Jean AUNIS
*
*/
public class Slice extends BitManager{
private String id;
private String description;
private boolean readOnly;
private List<Range> listeRanges;
private Register registre;
private List<Item> listeItem;
public Slice(String id, String description, Register registre)
{
super(1);
this.id = id;
this.description = description;
this.registre = registre;
readOnly = false;
listeItem = new ArrayList<Item>();
listeRanges = new ArrayList<Range>();
}
/**
* @return the id
*/
public String getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(String id) {
this.id = id;
}
/**
* @return the description
*/
public String getDescription() {
return description;
}
/**
* @param description the description to set
*/
public void setDescription(String description) {
this.description = description;
}
/**
* @return the readOnly
*/
public boolean isReadOnly() {
return readOnly;
}
/**
* @param readOnly the readOnly to set
*/
public void setReadOnly(boolean readOnly) {
this.readOnly = readOnly;
}
/**
* @return the listeRanges
*/
public List<Range> getListeRanges() {
return listeRanges;
}
/**
* @param listeRanges the listeRanges to set
*/
public void setListeRanges(List<Range> listeRanges) {
this.listeRanges = listeRanges;
}
/**
* @return the registre
*/
public Register getRegistre() {
return registre;
}
/**
* @param registre the registre to set
*/
public void setRegistre(Register registre) {
this.registre = registre;
}
/**
* @return the valeurs
* @throws Exception
*/
public Item getItem(int valeur) throws Exception{
//on parcourt la liste d'item
if(listeItem.size() == 0)
throw new Exception("liste vide");
for(Item i: listeItem)
{
if(i.getValeur() == valeur)
return i;
}
throw new Exception("valeur non trouvée");
}
/**
* @param valeurs the valeurs to set
*/
public void setItem(ArrayList<Item> item){
this.listeItem = item;
}
public void addItem(Item item){
listeItem.add(item);
}
public List<Item> getListeItem(){
return this.listeItem;
}
//public void addItem(Integer valeur, String sens)
//{
//items.put(valeur, sens);
//}
public void addRange(Range r)
{
List<Bit> aInserer = null;
try
{
aInserer = registre.getListeBits().subList(r.getTo(), r.getFrom()+1);
}
catch(IndexOutOfBoundsException e)
{
System.err.println("liste de bits du registre " + registre.getId() +
" mal initialisée.\n");
e.printStackTrace();
}
Bit premier = aInserer.get(0);
Comparator<Bit> comp = new Comparator<Bit>(){
@Override
public int compare(Bit o1, Bit o2) {
List<Bit> listeBits = Slice.this.registre.getListeBits();
int i1 = listeBits.indexOf(o1);
int i2 = listeBits.indexOf(o2);
if(i1 < i2) return -1;
else if (i1 > i2) return 1;
else return 0;
}
};
if(listeBits.size()>0)
{
//on cherche à quel indice insérer dans la liste de bits
int indiceInsertion = 0;
Bit bitCourant = listeBits.get(indiceInsertion);
while(comp.compare(premier, bitCourant) > 0)
{
indiceInsertion++;
try
{
bitCourant = listeBits.get(indiceInsertion);
}
catch(IndexOutOfBoundsException e)
{
System.err.println("liste de bits du registre " + registre.getId() +
" mal initialisée.\n");
e.printStackTrace();
}
}
/*
* Pour insérer il faut tout décaler.
* on recopie listeBits à partir de indiceInsertion jusqu'à la fin
* puis on insère les nouveaux bits à indiceInsertion
* puis on remet au bout les bits recopiés
*/
List<Bit> finListeBits = listeBits.subList(indiceInsertion, listeBits.size()-1);
listeBits.addAll(indiceInsertion, aInserer);
listeBits.addAll(indiceInsertion + aInserer.size(), finListeBits);
}
else
{
listeBits.addAll(aInserer);
}
listeRanges.add(r);
}
public String toString()
{
return id + ": " + description
+ "\t" + Integer.toHexString(getValeur());
}
}
| UTF-8 | Java | 4,413 | java | Slice.java | Java | [
{
"context": "arator;\r\nimport java.util.List;\r\n\r\n/**\r\n * @author Jean AUNIS\r\n *\r\n */\r\npublic class Slice extends BitManager{\r",
"end": 153,
"score": 0.9998019337654114,
"start": 143,
"tag": "NAME",
"value": "Jean AUNIS"
}
]
| null | []
| /**
*
*/
package harmless.model;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
/**
* @author <NAME>
*
*/
public class Slice extends BitManager{
private String id;
private String description;
private boolean readOnly;
private List<Range> listeRanges;
private Register registre;
private List<Item> listeItem;
public Slice(String id, String description, Register registre)
{
super(1);
this.id = id;
this.description = description;
this.registre = registre;
readOnly = false;
listeItem = new ArrayList<Item>();
listeRanges = new ArrayList<Range>();
}
/**
* @return the id
*/
public String getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(String id) {
this.id = id;
}
/**
* @return the description
*/
public String getDescription() {
return description;
}
/**
* @param description the description to set
*/
public void setDescription(String description) {
this.description = description;
}
/**
* @return the readOnly
*/
public boolean isReadOnly() {
return readOnly;
}
/**
* @param readOnly the readOnly to set
*/
public void setReadOnly(boolean readOnly) {
this.readOnly = readOnly;
}
/**
* @return the listeRanges
*/
public List<Range> getListeRanges() {
return listeRanges;
}
/**
* @param listeRanges the listeRanges to set
*/
public void setListeRanges(List<Range> listeRanges) {
this.listeRanges = listeRanges;
}
/**
* @return the registre
*/
public Register getRegistre() {
return registre;
}
/**
* @param registre the registre to set
*/
public void setRegistre(Register registre) {
this.registre = registre;
}
/**
* @return the valeurs
* @throws Exception
*/
public Item getItem(int valeur) throws Exception{
//on parcourt la liste d'item
if(listeItem.size() == 0)
throw new Exception("liste vide");
for(Item i: listeItem)
{
if(i.getValeur() == valeur)
return i;
}
throw new Exception("valeur non trouvée");
}
/**
* @param valeurs the valeurs to set
*/
public void setItem(ArrayList<Item> item){
this.listeItem = item;
}
public void addItem(Item item){
listeItem.add(item);
}
public List<Item> getListeItem(){
return this.listeItem;
}
//public void addItem(Integer valeur, String sens)
//{
//items.put(valeur, sens);
//}
public void addRange(Range r)
{
List<Bit> aInserer = null;
try
{
aInserer = registre.getListeBits().subList(r.getTo(), r.getFrom()+1);
}
catch(IndexOutOfBoundsException e)
{
System.err.println("liste de bits du registre " + registre.getId() +
" mal initialisée.\n");
e.printStackTrace();
}
Bit premier = aInserer.get(0);
Comparator<Bit> comp = new Comparator<Bit>(){
@Override
public int compare(Bit o1, Bit o2) {
List<Bit> listeBits = Slice.this.registre.getListeBits();
int i1 = listeBits.indexOf(o1);
int i2 = listeBits.indexOf(o2);
if(i1 < i2) return -1;
else if (i1 > i2) return 1;
else return 0;
}
};
if(listeBits.size()>0)
{
//on cherche à quel indice insérer dans la liste de bits
int indiceInsertion = 0;
Bit bitCourant = listeBits.get(indiceInsertion);
while(comp.compare(premier, bitCourant) > 0)
{
indiceInsertion++;
try
{
bitCourant = listeBits.get(indiceInsertion);
}
catch(IndexOutOfBoundsException e)
{
System.err.println("liste de bits du registre " + registre.getId() +
" mal initialisée.\n");
e.printStackTrace();
}
}
/*
* Pour insérer il faut tout décaler.
* on recopie listeBits à partir de indiceInsertion jusqu'à la fin
* puis on insère les nouveaux bits à indiceInsertion
* puis on remet au bout les bits recopiés
*/
List<Bit> finListeBits = listeBits.subList(indiceInsertion, listeBits.size()-1);
listeBits.addAll(indiceInsertion, aInserer);
listeBits.addAll(indiceInsertion + aInserer.size(), finListeBits);
}
else
{
listeBits.addAll(aInserer);
}
listeRanges.add(r);
}
public String toString()
{
return id + ": " + description
+ "\t" + Integer.toHexString(getValeur());
}
}
| 4,409 | 0.624858 | 0.620086 | 204 | 19.583334 | 18.858553 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.068627 | false | false | 4 |
b99563cf1b83b2552e8de085132f6de814c1ba48 | 22,780,506,544,942 | 208924523aaba7baa60118f20d2da395fa34ec73 | /api/portal/src/main/java/store/tacomall/apiportal/strategy/impl/PageSearchStrategyImpl.java | 459f22ab1b0bd4bb8715f1a2eed6e25df7a0d834 | [
"Apache-2.0"
]
| permissive | nowanys/tacomall-springboot | https://github.com/nowanys/tacomall-springboot | 3b6cef50236e2af9f47bebe538890e1664f9a5b3 | ecc7d9feb79b7a311421da0efde695e91528748a | refs/heads/master | 2023-02-24T19:10:35.547000 | 2021-01-25T01:03:17 | 2021-01-25T01:03:55 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /***
* @Author: 码上talk|RC
* @Date: 2020-07-10 17:00:09
* @LastEditTime: 2020-12-23 15:30:26
* @LastEditors: 码上talk|RC
* @Description:
* @FilePath: /tacomall-springboot/api/portal/src/main/java/store/tacomall/apiportal/strategy/impl/PageSearchStrategyImpl.java
* @Just do what I think it is right
*/
package store.tacomall.apiportal.strategy.impl;
import java.util.List;
import java.util.Map;
import java.util.ArrayList;
import java.util.HashMap;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Component;
import org.springframework.beans.factory.annotation.Autowired;
import store.tacomall.common.vo.ResponseVo;
import store.tacomall.apiportal.strategy.PageStrategy;
import store.tacomall.apiportal.service.GoodsService;
@Component("pageSearch")
public class PageSearchStrategyImpl implements PageStrategy {
@Autowired
private GoodsService goodsService;
@Override
public ResponseVo<Map<String, Object>> buildPage(JSONObject json) {
ResponseVo<Map<String, Object>> responseVo = new ResponseVo<>();
Map<String, Object> map = new HashMap<>();
List<String> hot = new ArrayList<>();
hot.add("小米 10");
hot.add("格力");
map.put("hot", hot);
map.put("recommend", goodsService.getGoodsPage(1, 10, new JSONObject()).getData());
map.put("most", goodsService.getGoodsPage(1, 10, new JSONObject()).getData());
responseVo.setData(map);
return responseVo;
}
}
| UTF-8 | Java | 1,504 | java | PageSearchStrategyImpl.java | Java | [
{
"context": "/***\n * @Author: 码上talk|RC\n * @Date: 2020-07-10 17:00:09\n * @LastEditTime",
"end": 23,
"score": 0.907954216003418,
"start": 17,
"tag": "USERNAME",
"value": "码上talk"
},
{
"context": "astEditTime: 2020-12-23 15:30:26\n * @LastEditors: 码上talk|RC\n * @Description: \n * @FilePath: /tacomall-spri",
"end": 118,
"score": 0.8681950569152832,
"start": 112,
"tag": "USERNAME",
"value": "码上talk"
}
]
| null | []
| /***
* @Author: 码上talk|RC
* @Date: 2020-07-10 17:00:09
* @LastEditTime: 2020-12-23 15:30:26
* @LastEditors: 码上talk|RC
* @Description:
* @FilePath: /tacomall-springboot/api/portal/src/main/java/store/tacomall/apiportal/strategy/impl/PageSearchStrategyImpl.java
* @Just do what I think it is right
*/
package store.tacomall.apiportal.strategy.impl;
import java.util.List;
import java.util.Map;
import java.util.ArrayList;
import java.util.HashMap;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Component;
import org.springframework.beans.factory.annotation.Autowired;
import store.tacomall.common.vo.ResponseVo;
import store.tacomall.apiportal.strategy.PageStrategy;
import store.tacomall.apiportal.service.GoodsService;
@Component("pageSearch")
public class PageSearchStrategyImpl implements PageStrategy {
@Autowired
private GoodsService goodsService;
@Override
public ResponseVo<Map<String, Object>> buildPage(JSONObject json) {
ResponseVo<Map<String, Object>> responseVo = new ResponseVo<>();
Map<String, Object> map = new HashMap<>();
List<String> hot = new ArrayList<>();
hot.add("小米 10");
hot.add("格力");
map.put("hot", hot);
map.put("recommend", goodsService.getGoodsPage(1, 10, new JSONObject()).getData());
map.put("most", goodsService.getGoodsPage(1, 10, new JSONObject()).getData());
responseVo.setData(map);
return responseVo;
}
}
| 1,504 | 0.715726 | 0.691532 | 44 | 32.81818 | 27.513033 | 126 | false | false | 0 | 0 | 0 | 0 | 97 | 0.065188 | 0.772727 | false | false | 4 |
6a941363190f92b9606220df41d5fa144cce4c10 | 10,050,223,521,992 | 3fec775ec5a673e72568707d493ca9c8a4eeac6e | /src/main/java/com/wyz/lucene/compress/common/AbstractByteRangeCodes.java | a1f41c43b7f038cfd229a8fd35195a6969808cf9 | []
| no_license | minggushen/lucene-opti | https://github.com/minggushen/lucene-opti | 3a6a5ad0217e35d8950c63f86ca35f25b2b34b96 | ece858b7fe0c0154f1e3bbabb3854d2f6012ac68 | refs/heads/master | 2022-07-09T09:51:48.689000 | 2019-05-28T11:54:28 | 2019-05-28T11:54:28 | 153,246,562 | 1 | 0 | null | false | 2022-06-29T17:02:26 | 2018-10-16T08:03:57 | 2019-05-28T11:54:48 | 2022-06-29T17:02:24 | 43,270 | 1 | 0 | 3 | Java | false | false | package com.wyz.lucene.compress.common;
import java.util.Arrays;
public abstract class AbstractByteRangeCodes {
public byte[] encode( int[] numbers, boolean useArraySorte, boolean useGapList){
if(useArraySorte)
Arrays.sort( numbers );
if(useGapList)
numbers = toGapArray( numbers );
return innerEncode(numbers);
}
protected static int[] toGapArray( int[] numbers ){
int prev = numbers[0];
for( int i =1 ; i < numbers.length ; i++ ){
int tmp = numbers[i];
numbers[i] = numbers[i] - prev;
prev = tmp;
}
return numbers;
}
protected abstract byte[] innerEncode( int[] gappedNumbers );
public abstract int[] decode ( byte[] encodedValue , boolean useGapList );
}
| UTF-8 | Java | 710 | java | AbstractByteRangeCodes.java | Java | []
| null | []
| package com.wyz.lucene.compress.common;
import java.util.Arrays;
public abstract class AbstractByteRangeCodes {
public byte[] encode( int[] numbers, boolean useArraySorte, boolean useGapList){
if(useArraySorte)
Arrays.sort( numbers );
if(useGapList)
numbers = toGapArray( numbers );
return innerEncode(numbers);
}
protected static int[] toGapArray( int[] numbers ){
int prev = numbers[0];
for( int i =1 ; i < numbers.length ; i++ ){
int tmp = numbers[i];
numbers[i] = numbers[i] - prev;
prev = tmp;
}
return numbers;
}
protected abstract byte[] innerEncode( int[] gappedNumbers );
public abstract int[] decode ( byte[] encodedValue , boolean useGapList );
}
| 710 | 0.680282 | 0.677465 | 37 | 18.18919 | 22.755857 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.405405 | false | false | 4 |
6d203950355d40352d1882745c6a2d54a05123f4 | 18,305,150,669,812 | 87cbf09da4634a81dd7166d3e55e7982d48dc8ea | /src/main/java/com/hulu/ftl/formats/Parser.java | 60c74f577ab240a9b7ed07db20a6934c222c7d87 | []
| no_license | trevorgrayson/ftl | https://github.com/trevorgrayson/ftl | 8c9e35567f911e834d0fdd6c0d6eeb83a5714ec5 | 4be46e29e7cc31a630bd65d6f2cce2ae93ceb232 | refs/heads/master | 2020-03-30T18:54:14.139000 | 2019-01-24T21:53:40 | 2019-01-24T21:53:40 | 151,519,625 | 1 | 3 | null | false | 2018-11-12T05:08:31 | 2018-10-04T04:44:10 | 2018-10-24T22:37:45 | 2018-11-12T05:06:05 | 112 | 0 | 1 | 2 | Java | false | null | package com.hulu.ftl.formats;
import com.hulu.ftl.FTLField;
import com.hulu.ftl.annotations.Annotation;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public abstract class Parser {
/*
Iterates over FTLFields and gets values back in a Map
*/
public Map extract(ArrayList<FTLField> fields) {
Map map = new HashMap<>();
for(FTLField field : fields) {
addToMap(map, field);
}
return postprocess(map, fields);
}
public Map postprocess(Map map, ArrayList<FTLField> fields) {
for(FTLField field : fields) {
Object result = postprocess(map.get(field.key), map, false);
map.put(field.key, result);
}
for(FTLField field : fields) {
Object result = postprocess(map.get(field.key), map, true);
map.put(field.key, result);
if (field.key.startsWith("$"))
map.remove(field.key);
}
return map;
}
public Object getValue(FTLField field) {
throw new UnsupportedOperationException("getValue method not implemented for this format!");
}
public List<Object> getValues(FTLField field) {
ArrayList<Object> list = new ArrayList<>();
list.add(getValue(field));
return list;
}
protected Object postprocess(Object value, Map localContext, boolean removeTemp) {
if (value instanceof Annotation) {
return ((Annotation)value).getValue(localContext);
} else if (value instanceof List) {
List list = (List)value;
for (int index = 0; index < list.size(); ++index) {
list.set(index, postprocess(list.get(index), localContext, removeTemp));
}
return list;
} else if (value instanceof Map) {
Map valueMap = (Map)value;
for (Object item : valueMap.entrySet()) {
Map.Entry entry = (Map.Entry)item;
valueMap.put(entry.getKey(), postprocess(entry.getValue(), valueMap, removeTemp));
if (removeTemp && entry.getKey().toString().startsWith("$")) {
valueMap.remove(entry.getKey());
}
}
return valueMap;
}
return value;
}
private void addToMap(Map map, FTLField field) {
if (field.isMultiValue) {
List values = (List)map.get(field.key);
if (values != null) {
values.addAll(getValues(field));
} else {
values = getValues(field);
}
map.put(field.key, values);
} else {
map.put(field.key, getValue(field));
}
}
boolean isSpecialValue(FTLField field) {
return field.annotation != null;
}
}
| UTF-8 | Java | 2,860 | java | Parser.java | Java | []
| null | []
| package com.hulu.ftl.formats;
import com.hulu.ftl.FTLField;
import com.hulu.ftl.annotations.Annotation;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public abstract class Parser {
/*
Iterates over FTLFields and gets values back in a Map
*/
public Map extract(ArrayList<FTLField> fields) {
Map map = new HashMap<>();
for(FTLField field : fields) {
addToMap(map, field);
}
return postprocess(map, fields);
}
public Map postprocess(Map map, ArrayList<FTLField> fields) {
for(FTLField field : fields) {
Object result = postprocess(map.get(field.key), map, false);
map.put(field.key, result);
}
for(FTLField field : fields) {
Object result = postprocess(map.get(field.key), map, true);
map.put(field.key, result);
if (field.key.startsWith("$"))
map.remove(field.key);
}
return map;
}
public Object getValue(FTLField field) {
throw new UnsupportedOperationException("getValue method not implemented for this format!");
}
public List<Object> getValues(FTLField field) {
ArrayList<Object> list = new ArrayList<>();
list.add(getValue(field));
return list;
}
protected Object postprocess(Object value, Map localContext, boolean removeTemp) {
if (value instanceof Annotation) {
return ((Annotation)value).getValue(localContext);
} else if (value instanceof List) {
List list = (List)value;
for (int index = 0; index < list.size(); ++index) {
list.set(index, postprocess(list.get(index), localContext, removeTemp));
}
return list;
} else if (value instanceof Map) {
Map valueMap = (Map)value;
for (Object item : valueMap.entrySet()) {
Map.Entry entry = (Map.Entry)item;
valueMap.put(entry.getKey(), postprocess(entry.getValue(), valueMap, removeTemp));
if (removeTemp && entry.getKey().toString().startsWith("$")) {
valueMap.remove(entry.getKey());
}
}
return valueMap;
}
return value;
}
private void addToMap(Map map, FTLField field) {
if (field.isMultiValue) {
List values = (List)map.get(field.key);
if (values != null) {
values.addAll(getValues(field));
} else {
values = getValues(field);
}
map.put(field.key, values);
} else {
map.put(field.key, getValue(field));
}
}
boolean isSpecialValue(FTLField field) {
return field.annotation != null;
}
}
| 2,860 | 0.564685 | 0.564336 | 95 | 29.105263 | 24.749895 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.610526 | false | false | 4 |
7320cfe368f8227e3e1ff59d047c0d563bce2637 | 28,097,676,103,987 | f941716de6821addf4c78aad7be33ed9959b281b | /spring-boot-demo-redis/src/main/java/com/xzj/stu/redis/common/config/RedisSubListenerConfig.java | 611ecec4e26906aa208bde4cbc6d928838e99c0d | []
| no_license | flintXZJ/spring-boot-demo | https://github.com/flintXZJ/spring-boot-demo | 1b275c3bb719d285086bd5afcd8fb5b2391ae5d9 | 810d871a1e94297067872cd7aa40896712931647 | refs/heads/master | 2022-11-22T08:46:54.315000 | 2020-09-09T03:03:53 | 2020-09-09T03:03:53 | 210,843,776 | 0 | 0 | null | false | 2022-11-16T12:44:14 | 2019-09-25T12:49:33 | 2020-09-09T03:04:28 | 2022-11-16T12:44:11 | 62 | 0 | 0 | 4 | Java | false | false | package com.xzj.stu.redis.common.config;
import com.xzj.stu.redis.service.RedisConsumer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.listener.PatternTopic;
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
import org.springframework.data.redis.listener.adapter.MessageListenerAdapter;
/**
* 消息监听器
*
* 订阅者(sub)接收消息
* @author zhijunxie
* @date 2019/10/24 17:34
*/
@Configuration
public class RedisSubListenerConfig {
/**
* redis消息监听器容器
* 可以添加多个监听不同话题的redis监听器,只需要把消息监听器和相应的消息订阅处理器绑定,该消息监听器
* 通过反射技术调用消息订阅处理器的相关方法进行一些业务处理
* @param connectionFactory
* @param listenerAdapter
* @return
*/
@Bean
RedisMessageListenerContainer container(RedisConnectionFactory connectionFactory,
MessageListenerAdapter listenerAdapter) {
RedisMessageListenerContainer container = new RedisMessageListenerContainer();
container.setConnectionFactory(connectionFactory);
//订阅了一个叫pubSubChannel的通道
container.addMessageListener(listenerAdapter, new PatternTopic("pubSubChannel"));
//这个container 可以添加多个 messageListener
return container;
}
/**
* 利用反射来创建监听到消息之后的执行方法
*
* @param redisReceiver
* @return
*/
@Bean
MessageListenerAdapter listenerAdapter(RedisConsumer redisReceiver) {
//这个地方 是给messageListenerAdapter 传入一个消息接受的处理器,利用反射的方法调用“receiveMessage”
//也有好几个重载方法,这边默认调用处理器的方法 叫handleMessage 可以自己到源码里面看
return new MessageListenerAdapter(redisReceiver, "receiveMessage");
}
}
| UTF-8 | Java | 2,153 | java | RedisSubListenerConfig.java | Java | [
{
"context": "apter;\n\n/**\n * 消息监听器\n *\n * 订阅者(sub)接收消息\n * @author zhijunxie\n * @date 2019/10/24 17:34\n */\n@Configuration\npubl",
"end": 547,
"score": 0.9996401071548462,
"start": 538,
"tag": "USERNAME",
"value": "zhijunxie"
}
]
| null | []
| package com.xzj.stu.redis.common.config;
import com.xzj.stu.redis.service.RedisConsumer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.listener.PatternTopic;
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
import org.springframework.data.redis.listener.adapter.MessageListenerAdapter;
/**
* 消息监听器
*
* 订阅者(sub)接收消息
* @author zhijunxie
* @date 2019/10/24 17:34
*/
@Configuration
public class RedisSubListenerConfig {
/**
* redis消息监听器容器
* 可以添加多个监听不同话题的redis监听器,只需要把消息监听器和相应的消息订阅处理器绑定,该消息监听器
* 通过反射技术调用消息订阅处理器的相关方法进行一些业务处理
* @param connectionFactory
* @param listenerAdapter
* @return
*/
@Bean
RedisMessageListenerContainer container(RedisConnectionFactory connectionFactory,
MessageListenerAdapter listenerAdapter) {
RedisMessageListenerContainer container = new RedisMessageListenerContainer();
container.setConnectionFactory(connectionFactory);
//订阅了一个叫pubSubChannel的通道
container.addMessageListener(listenerAdapter, new PatternTopic("pubSubChannel"));
//这个container 可以添加多个 messageListener
return container;
}
/**
* 利用反射来创建监听到消息之后的执行方法
*
* @param redisReceiver
* @return
*/
@Bean
MessageListenerAdapter listenerAdapter(RedisConsumer redisReceiver) {
//这个地方 是给messageListenerAdapter 传入一个消息接受的处理器,利用反射的方法调用“receiveMessage”
//也有好几个重载方法,这边默认调用处理器的方法 叫handleMessage 可以自己到源码里面看
return new MessageListenerAdapter(redisReceiver, "receiveMessage");
}
}
| 2,153 | 0.739401 | 0.732617 | 53 | 32.377357 | 28.898148 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.301887 | false | false | 4 |
ea03fe55474df8092030e1472909ac2f96796254 | 14,783,277,503,017 | 827381d82319f5c34b94a43eddfa2b21ce46cd41 | /DemineurRessources/src/vgqd/demineur/vAlpha/ressources/RessourceBuilderManager.java | 15194a712d1dd7a2ffc86c6ce68bb0de9aeb56a9 | []
| no_license | VgQD/DraftTrash | https://github.com/VgQD/DraftTrash | 7584c40f37d088e82714da63396079c7e70c88a1 | 49cd47a748b3766080dae9265dbbbf7adb3960a5 | refs/heads/master | 2016-08-04T04:35:07.079000 | 2012-12-03T07:12:20 | 2012-12-03T07:12:20 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package vgqd.demineur.vAlpha.ressources;
public class RessourceBuilderManager {
}
| UTF-8 | Java | 84 | java | RessourceBuilderManager.java | Java | []
| null | []
| package vgqd.demineur.vAlpha.ressources;
public class RessourceBuilderManager {
}
| 84 | 0.821429 | 0.821429 | 5 | 15.8 | 18.956793 | 40 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | false | false | 4 |
00bfe32604075d8a1fb2f7840496d41c6b9e4990 | 21,010,980,016,721 | cd9ab7924c8d1cb1da35cd0ac8fa9c2acdc7daea | /src/main/java/org/springframework/samples/petclinic/model/Genre.java | 5a514db419c5d3b63f67972b7eb95147e8dd8e04 | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla"
]
| permissive | carloscabello/spring-alexandria | https://github.com/carloscabello/spring-alexandria | 5f7190d72158cff0eb962388399b86371e38bb56 | 5e7dae280bc468a1efd09ccde242e6ed1fc12dba | refs/heads/master | 2023-03-11T09:57:25.368000 | 2021-03-03T13:17:31 | 2021-03-03T13:17:31 | 344,078,230 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.springframework.samples.petclinic.model;
public enum Genre {
SCRIPT,
TALE,
NOVEL,
CHRONICLE,
CHILDREN_STORY,
POETRY
}
| UTF-8 | Java | 137 | java | Genre.java | Java | []
| null | []
| package org.springframework.samples.petclinic.model;
public enum Genre {
SCRIPT,
TALE,
NOVEL,
CHRONICLE,
CHILDREN_STORY,
POETRY
}
| 137 | 0.759124 | 0.759124 | 10 | 12.7 | 14.241138 | 52 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.2 | false | false | 4 |
16e2afc29b61cde7ddb661d4d24d0fa20bcd17bb | 20,968,030,400,793 | 1164c6cda4f43835ca39026809bc1f68bafcb36d | /Project/Source code/src/fq.java | a8949ece1e110a42193b089f469cf904ca9b3d34 | []
| no_license | Saadkord/Mobile-Battery-Power-Consumption-app | https://github.com/Saadkord/Mobile-Battery-Power-Consumption-app | 14d3472a21028c1f8c1bbdc4b09726b729e339ba | 272e267dd7596de06b40ff3f02875a821d81e99b | refs/heads/master | 2023-03-22T13:13:00.626000 | 2015-10-25T10:20:55 | 2015-10-25T10:20:55 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | // Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: braces fieldsfirst space lnc
public class fq
{
static final fr b;
Object a;
public void a(int i, int j, int k, int l, int i1)
{
b.a(a, i, j, k, l, i1);
}
public boolean a()
{
return b.a(a);
}
public int b()
{
return b.b(a);
}
public int c()
{
return b.c(a);
}
public int d()
{
return b.f(a);
}
public int e()
{
return b.g(a);
}
public boolean f()
{
return b.d(a);
}
public void g()
{
b.e(a);
}
static
{
int i = android.os.Build.VERSION.SDK_INT;
if (i >= 14)
{
b = new fu();
} else
if (i >= 9)
{
b = new ft();
} else
{
b = new fs();
}
}
}
| UTF-8 | Java | 984 | java | fq.java | Java | [
{
"context": "// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.\n// Jad home page: http://www.geocities.com/kpdus",
"end": 61,
"score": 0.99970543384552,
"start": 45,
"tag": "NAME",
"value": "Pavel Kouznetsov"
}
]
| null | []
| // Decompiled by Jad v1.5.8e. Copyright 2001 <NAME>.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: braces fieldsfirst space lnc
public class fq
{
static final fr b;
Object a;
public void a(int i, int j, int k, int l, int i1)
{
b.a(a, i, j, k, l, i1);
}
public boolean a()
{
return b.a(a);
}
public int b()
{
return b.b(a);
}
public int c()
{
return b.c(a);
}
public int d()
{
return b.f(a);
}
public int e()
{
return b.g(a);
}
public boolean f()
{
return b.d(a);
}
public void g()
{
b.e(a);
}
static
{
int i = android.os.Build.VERSION.SDK_INT;
if (i >= 14)
{
b = new fu();
} else
if (i >= 9)
{
b = new ft();
} else
{
b = new fs();
}
}
}
| 974 | 0.421748 | 0.409553 | 67 | 13.686567 | 14.442071 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.343284 | false | false | 4 |
5af4b358a15de184066bf0a73c993306f10e966c | 6,227,702,642,316 | e9719b29b8f50c5d8b30aaa5328c73f0f2b38e76 | /blog/src/com/jing/blog/model/MappingKit.java | d1b395edc3e5d7cefe0f8bb72ab6249f207f9920 | []
| no_license | Crazy-L/xblog | https://github.com/Crazy-L/xblog | 148529a418b38aee0b0e5b457b43e4fa7678a499 | c8db6216fd2a6ab94e9038341ef73de29402f254 | refs/heads/master | 2020-12-30T14:44:37.141000 | 2017-05-17T09:10:25 | 2017-05-17T09:10:25 | 91,079,277 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.jing.blog.model;
import com.jfinal.plugin.activerecord.ActiveRecordPlugin;
/**
* @author Jing
* @create 2017-05-10 18:03
* @desc
**/
public class MappingKit {
public static void mapping(ActiveRecordPlugin arp) {
arp.addMapping("blog", "id", Blog.class);
}
}
| UTF-8 | Java | 294 | java | MappingKit.java | Java | [
{
"context": "n.activerecord.ActiveRecordPlugin;\n\n/**\n * @author Jing\n * @create 2017-05-10 18:03\n * @desc\n **/\npublic ",
"end": 108,
"score": 0.9945995807647705,
"start": 104,
"tag": "NAME",
"value": "Jing"
}
]
| null | []
| package com.jing.blog.model;
import com.jfinal.plugin.activerecord.ActiveRecordPlugin;
/**
* @author Jing
* @create 2017-05-10 18:03
* @desc
**/
public class MappingKit {
public static void mapping(ActiveRecordPlugin arp) {
arp.addMapping("blog", "id", Blog.class);
}
}
| 294 | 0.676871 | 0.636054 | 16 | 17.375 | 20.052666 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.3125 | false | false | 4 |
2f3bdecfc2658e43d7f741da5f72aac5bf3ddc8b | 33,285,996,601,477 | b002e74255eb28389ac50fe45685a3aa0ff07af6 | /java/client/src/org/openqa/selenium/android/library/WebDriverViewClient.java | 05b9c2af43439d81481601eae0f1d7db352eb07b | [
"Apache-2.0"
]
| permissive | alisaifee/selenium | https://github.com/alisaifee/selenium | 5353ec4862f909e708488dfd2bddc477854573a9 | 25c7229888fa8d49005a3f49580dcb4490f0acfb | refs/heads/master | 2021-07-04T08:34:14.326000 | 2013-12-10T23:56:54 | 2013-12-11T01:00:48 | 15,093,194 | 0 | 0 | Apache-2.0 | true | 2021-06-04T02:47:25 | 2013-12-10T23:52:54 | 2013-12-11T13:06:07 | 2021-06-04T02:47:22 | 968,353 | 0 | 0 | 3 | JavaScript | false | false | /*
Copyright 2011 Software Freedom Conservatory.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.openqa.selenium.android.library;
import android.net.http.SslError;
import android.webkit.SslErrorHandler;
import android.webkit.WebView;
import java.util.logging.Level;
/**
* This class provides methods that must be called by a custom view client
* if you decide not to use the DefaultViewClient.
*
* If you are using this class you should really know what you are doing.
*/
public class WebDriverViewClient {
private final AndroidWebDriver driver;
private final String LOG_TAG = WebDriverViewClient.class.getName();
private String tmpUrl;
public WebDriverViewClient(AndroidWebDriver driver) {
this.driver = driver;
}
public void onReceivedError(WebView view, int errorCode, String description,
String failingUrl) {
Logger.log(Level.WARNING, LOG_TAG, "onReceiveError", description
+ ", error code: " + errorCode);
}
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
boolean shouldAcceptSslCerts = driver.getAcceptSslCerts();
Logger.log(Level.WARNING, LOG_TAG, "onReceivedSslError", error.toString()
+ ", shouldAcceptSslCerts: " + shouldAcceptSslCerts);
if (shouldAcceptSslCerts) {
handler.proceed();
}
}
public void onPageStarted(WebView view, String url) {
// To avoid blocking on background windows
if (driver.getWebView().equals(view)) {
driver.setLastUrlLoaded(url);
tmpUrl = url;
driver.notifyPageStartedLoading();
}
}
public void onPageFinished(WebView view, String url) {
// To avoid blocking on background windows
if (driver.getWebView().equals(view)) {
driver.setLastUrlLoaded(url);
// If it is a html fragment or the current url loaded, the page is
// not reloaded and the onProgessChanged function is not called.
if (url != null && tmpUrl != null && url.contains("#") && tmpUrl.equals(url.split("#")[0])) {
driver.notifyPageDoneLoading();
}
}
}
}
| UTF-8 | Java | 2,608 | java | WebDriverViewClient.java | Java | []
| null | []
| /*
Copyright 2011 Software Freedom Conservatory.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.openqa.selenium.android.library;
import android.net.http.SslError;
import android.webkit.SslErrorHandler;
import android.webkit.WebView;
import java.util.logging.Level;
/**
* This class provides methods that must be called by a custom view client
* if you decide not to use the DefaultViewClient.
*
* If you are using this class you should really know what you are doing.
*/
public class WebDriverViewClient {
private final AndroidWebDriver driver;
private final String LOG_TAG = WebDriverViewClient.class.getName();
private String tmpUrl;
public WebDriverViewClient(AndroidWebDriver driver) {
this.driver = driver;
}
public void onReceivedError(WebView view, int errorCode, String description,
String failingUrl) {
Logger.log(Level.WARNING, LOG_TAG, "onReceiveError", description
+ ", error code: " + errorCode);
}
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
boolean shouldAcceptSslCerts = driver.getAcceptSslCerts();
Logger.log(Level.WARNING, LOG_TAG, "onReceivedSslError", error.toString()
+ ", shouldAcceptSslCerts: " + shouldAcceptSslCerts);
if (shouldAcceptSslCerts) {
handler.proceed();
}
}
public void onPageStarted(WebView view, String url) {
// To avoid blocking on background windows
if (driver.getWebView().equals(view)) {
driver.setLastUrlLoaded(url);
tmpUrl = url;
driver.notifyPageStartedLoading();
}
}
public void onPageFinished(WebView view, String url) {
// To avoid blocking on background windows
if (driver.getWebView().equals(view)) {
driver.setLastUrlLoaded(url);
// If it is a html fragment or the current url loaded, the page is
// not reloaded and the onProgessChanged function is not called.
if (url != null && tmpUrl != null && url.contains("#") && tmpUrl.equals(url.split("#")[0])) {
driver.notifyPageDoneLoading();
}
}
}
}
| 2,608 | 0.709739 | 0.706288 | 78 | 32.435898 | 28.780153 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 4 |
c64adba9d6d0e534c8d87673caf31cbd52c2c11e | 30,142,080,532,100 | 34c046025e6a0e22c6967a30aac0fab0e94215c0 | /CircleTheDot.java | 0a4972db8d88d5a2e1bcb18e13b958bf1e23e113 | []
| no_license | Prithviraj-K/CircleTheDot | https://github.com/Prithviraj-K/CircleTheDot | bc830654d5963fab468663f281729653a8428632 | 4bb709a978f7a5a9a8f202d8ee5df02ef5d1dd19 | refs/heads/master | 2020-07-27T07:09:49.658000 | 2016-11-15T22:01:55 | 2016-11-15T22:01:55 | 73,856,221 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
import java.awt.*;
public class CircleTheDot{
public static void main (String[] args){
int size = 9;
if (args.length==1){
try{
size=Integer.parseInt(args[0]);
if(size<4){
System.out.println ("Invalid argument, using default...");
size=9;
}
}
catch (NumberFormatException e){
System.out.println ("Invalid argument, using default");
}
}
StudentInfo info = new StudentInfo();
info.display();
GameController game = new GameController (size);
game.start();
}
} | UTF-8 | Java | 604 | java | CircleTheDot.java | Java | []
| null | []
| import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
import java.awt.*;
public class CircleTheDot{
public static void main (String[] args){
int size = 9;
if (args.length==1){
try{
size=Integer.parseInt(args[0]);
if(size<4){
System.out.println ("Invalid argument, using default...");
size=9;
}
}
catch (NumberFormatException e){
System.out.println ("Invalid argument, using default");
}
}
StudentInfo info = new StudentInfo();
info.display();
GameController game = new GameController (size);
game.start();
}
} | 604 | 0.668874 | 0.660596 | 25 | 23.200001 | 17.690676 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.76 | false | false | 4 |
d6017105c42813baeb152555d0485b20b963fed4 | 14,267,881,427,569 | 1fbb0dd53648fd4e4c354d08952302917c0c7d5f | /background/info-bg/src/main/java/com/sinochem/crude/trade/commons/JKXLayoutContants.java | 689651d5695a0241e0f4e49726e258f29c574699 | []
| no_license | wang-shun/transaction | https://github.com/wang-shun/transaction | 2a68d96e4197bbdd71d05f0e6e91b1914e395ebc | 8a3bd4af7180d9fbafbb01ab1739702798430441 | refs/heads/master | 2020-04-04T18:10:33.235000 | 2018-11-05T02:27:57 | 2018-11-05T02:27:57 | 156,152,857 | 0 | 1 | null | true | 2018-11-05T03:03:30 | 2018-11-05T03:03:29 | 2018-11-05T02:33:15 | 2018-11-05T02:32:38 | 0 | 0 | 0 | 0 | null | false | null | package com.sinochem.crude.trade.commons;
public class JKXLayoutContants {
public enum JKX_LAYOUT_TYPE{
TYPE_XFJBFL1("西非装船基本费率1","XFJBFL1","YLSC","untime","zh")
,TYPE_XFJBFL2("西非装船基本费率2","XFJBFL2","YLSC","untime","zh")
,TYPE_ALJBFL1("阿拉伯港基本费率1","ALJBFL1","YLSC","untime","zh")
,TYPE_ALJBFL2("阿拉伯港基本费率2","ALJBFL2","YLSC","untime","zh")
,TYPE_ALJBFL3("阿拉伯港基本费率3","ALJBFL3","YLSC","untime","zh")
,TYPE_XFJBFL1EN("West Africa Basic Shipping rate 1","XFJBFL1EN","YLSC_EN","untime","en")
,TYPE_XFJBFL2EN("West Africa Basic Shipping rate 2","XFJBFL2EN","YLSC_EN","untime","en")
,TYPE_ALJBFL1EN("Arabian Gulf Basic rate 1","ALJBFL1EN","YLSC_EN","untime","en")
,TYPE_ALJBFL2EN("Arabian Gulf Basic rate 2","ALJBFL2EN","YLSC_EN","untime","en")
,TYPE_ALJBFL3EN("Arabian Gulf Basic rate 3","ALJBFL3EN","YLSC_EN","untime","en")
;
JKX_LAYOUT_TYPE(String jkxType,String jkxCode,String channelCode,String typeTime,String langVer){
this.jkxType = jkxType;
this.jkxCode = jkxCode;
this.channelCode = channelCode;
this.typeTime = typeTime;
this.langVer = langVer;
}
private String jkxType; //金凯讯 资讯类型
private String jkxCode; //金凯讯类型编码
private String channelCode; //对应的频道代码
private String typeTime;//对应的日报、周报、月报
private String langVer;//语言类型
public String getJkxType() {
return jkxType;
}
public String getJkxCode() {
return jkxCode;
}
public String getChannelCode() {
return channelCode;
}
public String getTypeTime() {
return typeTime;
}
public String getLangVer() {
return langVer;
}
}
}
| UTF-8 | Java | 1,762 | java | JKXLayoutContants.java | Java | []
| null | []
| package com.sinochem.crude.trade.commons;
public class JKXLayoutContants {
public enum JKX_LAYOUT_TYPE{
TYPE_XFJBFL1("西非装船基本费率1","XFJBFL1","YLSC","untime","zh")
,TYPE_XFJBFL2("西非装船基本费率2","XFJBFL2","YLSC","untime","zh")
,TYPE_ALJBFL1("阿拉伯港基本费率1","ALJBFL1","YLSC","untime","zh")
,TYPE_ALJBFL2("阿拉伯港基本费率2","ALJBFL2","YLSC","untime","zh")
,TYPE_ALJBFL3("阿拉伯港基本费率3","ALJBFL3","YLSC","untime","zh")
,TYPE_XFJBFL1EN("West Africa Basic Shipping rate 1","XFJBFL1EN","YLSC_EN","untime","en")
,TYPE_XFJBFL2EN("West Africa Basic Shipping rate 2","XFJBFL2EN","YLSC_EN","untime","en")
,TYPE_ALJBFL1EN("Arabian Gulf Basic rate 1","ALJBFL1EN","YLSC_EN","untime","en")
,TYPE_ALJBFL2EN("Arabian Gulf Basic rate 2","ALJBFL2EN","YLSC_EN","untime","en")
,TYPE_ALJBFL3EN("Arabian Gulf Basic rate 3","ALJBFL3EN","YLSC_EN","untime","en")
;
JKX_LAYOUT_TYPE(String jkxType,String jkxCode,String channelCode,String typeTime,String langVer){
this.jkxType = jkxType;
this.jkxCode = jkxCode;
this.channelCode = channelCode;
this.typeTime = typeTime;
this.langVer = langVer;
}
private String jkxType; //金凯讯 资讯类型
private String jkxCode; //金凯讯类型编码
private String channelCode; //对应的频道代码
private String typeTime;//对应的日报、周报、月报
private String langVer;//语言类型
public String getJkxType() {
return jkxType;
}
public String getJkxCode() {
return jkxCode;
}
public String getChannelCode() {
return channelCode;
}
public String getTypeTime() {
return typeTime;
}
public String getLangVer() {
return langVer;
}
}
}
| 1,762 | 0.675155 | 0.656522 | 53 | 29.377359 | 27.653671 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.867924 | false | false | 4 |
501fb1e6080f58ca41ad1232f1f2a2853db5e39a | 27,891,517,636,059 | c0be39bb156b746f0edb5526f63456bda89b0f5e | /app/src/main/java/ca/uottawa/eecs/seg2505/benevolapp/offresDisponibles/OffreAdapter.java | b09c0d5831dd8ac8cfbf9c3fba33e1898da4d673 | []
| no_license | laganiere/BenevolApp | https://github.com/laganiere/BenevolApp | 296a4ea9dd6933b3f8de9da9c4e072e3198d9b3e | daebb6828d8c2f882bfe37c1cd43dfeedc26f69b | refs/heads/master | 2021-01-10T08:03:36.543000 | 2015-12-19T21:26:25 | 2015-12-19T21:26:25 | 43,926,294 | 2 | 29 | null | false | 2015-12-19T21:26:25 | 2015-10-09T01:41:12 | 2015-12-03T01:13:51 | 2015-12-19T21:26:25 | 458 | 2 | 17 | 0 | Java | null | null | package ca.uottawa.eecs.seg2505.benevolapp.offresDisponibles;
import android.app.Activity;
import android.content.Context;
import android.graphics.Typeface;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TableRow;
import android.widget.TextView;
import java.util.Calendar;
import java.util.List;
import ca.uottawa.eecs.seg2505.benevolapp.R;
import ca.uottawa.eecs.seg2505.benevolapp.model.Disponibilite;
import ca.uottawa.eecs.seg2505.benevolapp.model.Mois;
import ca.uottawa.eecs.seg2505.benevolapp.model.offre.Duree;
import ca.uottawa.eecs.seg2505.benevolapp.model.offre.Lieu;
import ca.uottawa.eecs.seg2505.benevolapp.model.offre.Offre;
import ca.uottawa.eecs.seg2505.benevolapp.model.offre.PersonneContact;
public class OffreAdapter extends ArrayAdapter<Offre> {
private Typeface indiatorFont;
private Context context;
private int viewID;
public OffreAdapter(Context context, int viewID, List<Offre> offres) {
super(context, viewID, offres);
this.viewID = viewID;
this.context = context;
this.indiatorFont = Typeface.createFromAsset(context.getAssets(), "KaushanScript-Regular.otf");
}
public View getView(int position, View convertView, ViewGroup parent){
// Inflate le layout de l'offre si nécessaire
if (convertView == null) {
LayoutInflater inflater = ((Activity) context).getLayoutInflater();
convertView = inflater.inflate(viewID, parent, false);
}
Offre offre = getItem(position);
if (offre != null) {
// Set le font des indicateurs qui apparaissent sur les offres.
((TextView) convertView.findViewById(R.id.item_apply_indicator)).setTypeface(indiatorFont);
((TextView) convertView.findViewById(R.id.item_ignore_indicator)).setTypeface(indiatorFont);
// Les valeurs venant de l'offre à mettre dans le layout
String titre = offre.getTitre();
String description = offre.getDescription();
String organisme = offre.getOrganismeName();
PersonneContact personne = offre.getPersonneContact();
Lieu lieu = offre.getLieu();
Disponibilite horaire = offre.getDisponibilite();
Duree duree = offre.getDuree();
Calendar dateDebut = offre.getDateDebut();
Calendar dateFin = offre.getDateFin();
int ageMin = offre.getAgeMinimum();
int places = offre.getNombrePlaces();
List<String> competences = offre.getCompetences();
String typeActivite = offre.getType();
// Les views à changer dans le layout offre
TextView titreView = (TextView) convertView.findViewById(R.id.lbl_titleValue);
TextView descriptionView = (TextView) convertView.findViewById(R.id.lbl_descriptionValue);
TextView organismeView = (TextView) convertView.findViewById(R.id.lbl_organismeName);
TextView personneNameView = (TextView) convertView.findViewById(R.id.lbl_personneName);
TextView personneEmailView = (TextView) convertView.findViewById(R.id.lbl_personneEmail);
TableRow lieuView = (TableRow) convertView.findViewById(R.id.row_lieu);
TableRow horaireView = (TableRow) convertView.findViewById(R.id.row_horaire);
TableRow dureeView = (TableRow) convertView.findViewById(R.id.row_duree);
TableRow dateDebutView = (TableRow) convertView.findViewById(R.id.row_dateDebut);
TableRow dateFinView = (TableRow) convertView.findViewById(R.id.row_dateFin);
TableRow ageMinView = (TableRow) convertView.findViewById(R.id.row_ageMin);
TableRow placesView = (TableRow) convertView.findViewById(R.id.row_places);
TableRow competencesView = (TableRow) convertView.findViewById(R.id.row_competences);
TableRow typeActiviteView = (TableRow) convertView.findViewById(R.id.row_typeActivite);
// Changement des valeurs du layout
titreView.setText(titre);
if (description != null) descriptionView.setText(description);
else descriptionView.setHeight(0);
organismeView.setText(organisme);
if (personne != null) {
personneNameView.setText(personne.getFullName());
personneEmailView.setText(personne.getEmail());
} else {
personneNameView.setText(offre.getOrganismeName());
personneEmailView.setVisibility(View.GONE);
}
if (lieu != null) ((TextView) lieuView.getChildAt(1)).setText(lieu.toString());
else lieuView.setVisibility(View.GONE);
if (horaire != null) ((TextView) horaireView.getChildAt(1)).setText(horaire.toString());
else horaireView.setVisibility(View.GONE);
if (duree != null) ((TextView) dureeView.getChildAt(1)).setText(duree.toString());
else dureeView.setVisibility(View.GONE);
if (dateDebut != null) ((TextView) dateDebutView.getChildAt(1)).setText(dateDebut.get(Calendar.DAY_OF_MONTH) + " " + Mois.get(dateDebut.get(Calendar.MONTH)) + " " + dateDebut.get(Calendar.YEAR));
else dateDebutView.setVisibility(View.GONE);
if (dateFin != null) ((TextView) dateFinView.getChildAt(1)).setText(dateFin.get(Calendar.DAY_OF_MONTH) + " " + Mois.get(dateFin.get(Calendar.MONTH)) + " " + dateFin.get(Calendar.YEAR));
else dateFinView.setVisibility(View.GONE);
if (ageMin > 0) ((TextView) ageMinView.getChildAt(1)).setText(ageMin + " an" + ((ageMin > 1) ? "s" : ""));
else ageMinView.setVisibility(View.GONE);
if (places > 0) ((TextView) placesView.getChildAt(1)).setText(places + " place" + ((places > 1) ? "s" : ""));
else placesView.setVisibility(View.GONE);
if (competences.size() > 0) {
String competencesString = competences.get(0);
for (int i = 1; i < competences.size(); i++) competencesString += ", " + competences.get(i);
((TextView) competencesView.getChildAt(1)).setText(competencesString);
} else competencesView.setVisibility(View.GONE);
if (typeActivite != null) ((TextView) typeActiviteView.getChildAt(1)).setText(typeActivite);
else typeActiviteView.setVisibility(View.GONE);
}
// Retourne le view pour l'offre courante
return convertView;
}
}
| UTF-8 | Java | 6,594 | java | OffreAdapter.java | Java | []
| null | []
| package ca.uottawa.eecs.seg2505.benevolapp.offresDisponibles;
import android.app.Activity;
import android.content.Context;
import android.graphics.Typeface;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TableRow;
import android.widget.TextView;
import java.util.Calendar;
import java.util.List;
import ca.uottawa.eecs.seg2505.benevolapp.R;
import ca.uottawa.eecs.seg2505.benevolapp.model.Disponibilite;
import ca.uottawa.eecs.seg2505.benevolapp.model.Mois;
import ca.uottawa.eecs.seg2505.benevolapp.model.offre.Duree;
import ca.uottawa.eecs.seg2505.benevolapp.model.offre.Lieu;
import ca.uottawa.eecs.seg2505.benevolapp.model.offre.Offre;
import ca.uottawa.eecs.seg2505.benevolapp.model.offre.PersonneContact;
public class OffreAdapter extends ArrayAdapter<Offre> {
private Typeface indiatorFont;
private Context context;
private int viewID;
public OffreAdapter(Context context, int viewID, List<Offre> offres) {
super(context, viewID, offres);
this.viewID = viewID;
this.context = context;
this.indiatorFont = Typeface.createFromAsset(context.getAssets(), "KaushanScript-Regular.otf");
}
public View getView(int position, View convertView, ViewGroup parent){
// Inflate le layout de l'offre si nécessaire
if (convertView == null) {
LayoutInflater inflater = ((Activity) context).getLayoutInflater();
convertView = inflater.inflate(viewID, parent, false);
}
Offre offre = getItem(position);
if (offre != null) {
// Set le font des indicateurs qui apparaissent sur les offres.
((TextView) convertView.findViewById(R.id.item_apply_indicator)).setTypeface(indiatorFont);
((TextView) convertView.findViewById(R.id.item_ignore_indicator)).setTypeface(indiatorFont);
// Les valeurs venant de l'offre à mettre dans le layout
String titre = offre.getTitre();
String description = offre.getDescription();
String organisme = offre.getOrganismeName();
PersonneContact personne = offre.getPersonneContact();
Lieu lieu = offre.getLieu();
Disponibilite horaire = offre.getDisponibilite();
Duree duree = offre.getDuree();
Calendar dateDebut = offre.getDateDebut();
Calendar dateFin = offre.getDateFin();
int ageMin = offre.getAgeMinimum();
int places = offre.getNombrePlaces();
List<String> competences = offre.getCompetences();
String typeActivite = offre.getType();
// Les views à changer dans le layout offre
TextView titreView = (TextView) convertView.findViewById(R.id.lbl_titleValue);
TextView descriptionView = (TextView) convertView.findViewById(R.id.lbl_descriptionValue);
TextView organismeView = (TextView) convertView.findViewById(R.id.lbl_organismeName);
TextView personneNameView = (TextView) convertView.findViewById(R.id.lbl_personneName);
TextView personneEmailView = (TextView) convertView.findViewById(R.id.lbl_personneEmail);
TableRow lieuView = (TableRow) convertView.findViewById(R.id.row_lieu);
TableRow horaireView = (TableRow) convertView.findViewById(R.id.row_horaire);
TableRow dureeView = (TableRow) convertView.findViewById(R.id.row_duree);
TableRow dateDebutView = (TableRow) convertView.findViewById(R.id.row_dateDebut);
TableRow dateFinView = (TableRow) convertView.findViewById(R.id.row_dateFin);
TableRow ageMinView = (TableRow) convertView.findViewById(R.id.row_ageMin);
TableRow placesView = (TableRow) convertView.findViewById(R.id.row_places);
TableRow competencesView = (TableRow) convertView.findViewById(R.id.row_competences);
TableRow typeActiviteView = (TableRow) convertView.findViewById(R.id.row_typeActivite);
// Changement des valeurs du layout
titreView.setText(titre);
if (description != null) descriptionView.setText(description);
else descriptionView.setHeight(0);
organismeView.setText(organisme);
if (personne != null) {
personneNameView.setText(personne.getFullName());
personneEmailView.setText(personne.getEmail());
} else {
personneNameView.setText(offre.getOrganismeName());
personneEmailView.setVisibility(View.GONE);
}
if (lieu != null) ((TextView) lieuView.getChildAt(1)).setText(lieu.toString());
else lieuView.setVisibility(View.GONE);
if (horaire != null) ((TextView) horaireView.getChildAt(1)).setText(horaire.toString());
else horaireView.setVisibility(View.GONE);
if (duree != null) ((TextView) dureeView.getChildAt(1)).setText(duree.toString());
else dureeView.setVisibility(View.GONE);
if (dateDebut != null) ((TextView) dateDebutView.getChildAt(1)).setText(dateDebut.get(Calendar.DAY_OF_MONTH) + " " + Mois.get(dateDebut.get(Calendar.MONTH)) + " " + dateDebut.get(Calendar.YEAR));
else dateDebutView.setVisibility(View.GONE);
if (dateFin != null) ((TextView) dateFinView.getChildAt(1)).setText(dateFin.get(Calendar.DAY_OF_MONTH) + " " + Mois.get(dateFin.get(Calendar.MONTH)) + " " + dateFin.get(Calendar.YEAR));
else dateFinView.setVisibility(View.GONE);
if (ageMin > 0) ((TextView) ageMinView.getChildAt(1)).setText(ageMin + " an" + ((ageMin > 1) ? "s" : ""));
else ageMinView.setVisibility(View.GONE);
if (places > 0) ((TextView) placesView.getChildAt(1)).setText(places + " place" + ((places > 1) ? "s" : ""));
else placesView.setVisibility(View.GONE);
if (competences.size() > 0) {
String competencesString = competences.get(0);
for (int i = 1; i < competences.size(); i++) competencesString += ", " + competences.get(i);
((TextView) competencesView.getChildAt(1)).setText(competencesString);
} else competencesView.setVisibility(View.GONE);
if (typeActivite != null) ((TextView) typeActiviteView.getChildAt(1)).setText(typeActivite);
else typeActiviteView.setVisibility(View.GONE);
}
// Retourne le view pour l'offre courante
return convertView;
}
}
| 6,594 | 0.666515 | 0.659081 | 127 | 50.897636 | 37.854225 | 207 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.779528 | false | false | 4 |
a2901098e6fa00a836f8b9dd5009d91aab8305fe | 10,393,820,906,834 | 09c842533057a049370aa2ef98cc1cec9dbbdecb | /src/main/java/jobsity/bowling/service/LineService.java | cf3872a93875abdf16c1dbfe0244fa4b5ab3054c | []
| no_license | cristianchaparroa/bowling | https://github.com/cristianchaparroa/bowling | cad5d5e263edaf3ba585f1f123748fe08da8b56d | 43d6e4da2c142b5dc895e0a214d1297fb4825b90 | refs/heads/master | 2020-03-24T12:57:06.285000 | 2018-07-29T04:33:28 | 2018-07-29T04:33:28 | 142,729,879 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package jobsity.bowling.service;
import java.util.Map;
import jobsity.bowling.service.dto.LineDTO;
import java.util.List;
public interface LineService {
/**
* It parses the throws grouped by player
* @param throws, it is a map where key is the player name and list is the socores releted to it.
* @return a list of lines
*/
public List<LineDTO> parse(Map<String,List<String>> trows);
}
| UTF-8 | Java | 402 | java | LineService.java | Java | []
| null | []
| package jobsity.bowling.service;
import java.util.Map;
import jobsity.bowling.service.dto.LineDTO;
import java.util.List;
public interface LineService {
/**
* It parses the throws grouped by player
* @param throws, it is a map where key is the player name and list is the socores releted to it.
* @return a list of lines
*/
public List<LineDTO> parse(Map<String,List<String>> trows);
}
| 402 | 0.731343 | 0.731343 | 16 | 24.125 | 26.511496 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4375 | false | false | 4 |
b760dc20eca4b19905ae1f9c6e90ab8e49be04f6 | 11,544,872,118,348 | 2a231142a4944aa018ee854bdeef279815c416b4 | /sso-server/src/main/java/cn/merryyou/sso/server/SsoSecurityConfig.java | 361a7dfb6bd9e0ac582832aad987cf8ab6283530 | []
| no_license | FengChueng/sso-merryyou | https://github.com/FengChueng/sso-merryyou | 6546b04f2e347801f10e024f2e00b3347ef56a57 | 6e13b8fbc0a5c58cb9e3ea4158b7ba99858cbe3b | refs/heads/master | 2020-04-18T11:54:22.868000 | 2019-01-25T09:22:02 | 2019-01-25T09:22:02 | 167,516,929 | 0 | 0 | null | true | 2019-01-25T08:58:35 | 2019-01-25T08:58:34 | 2019-01-23T08:22:17 | 2018-05-09T12:11:07 | 2,985 | 0 | 0 | 0 | null | false | null | package cn.merryyou.sso.server;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter;
/**
* spring Security配置
* Created on 2017/12/26.
*
* @author zlf
* @since 1.0
*/
@Configuration
public class SsoSecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private UserDetailsService userDetailsService;
@Bean
public PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
@Override
public void configure(WebSecurity web) throws Exception {
// super.configure(web);
web.ignoring().antMatchers("/test1");
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.formLogin().loginPage("/authentication/require")
.loginProcessingUrl("/authentication/form")
.and().authorizeRequests()
.antMatchers("/authentication/require",
"/authentication/form",
"/**/*.js",
"/**/*.css",
"/**/*.jpg",
"/**/*.png",
"/**/*.woff2"
)
.permitAll()
.antMatchers("/test2")
.permitAll()
.anyRequest().authenticated()
.and()
.csrf().disable();
// .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS);
// http.formLogin().and().authorizeRequests().anyRequest().authenticated();
// http.authenticationProvider()
http.addFilterBefore(wechatLoginFilter(), AbstractPreAuthenticatedProcessingFilter.class);
}
public WechatLoginFilter wechatLoginFilter() throws Exception {
WechatLoginFilter wechatLoginFilter = new WechatLoginFilter();
wechatLoginFilter.setAuthenticationManager(authenticationManager());
return wechatLoginFilter;
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder());
}
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
return super.authenticationManagerBean();
}
// @Bean
// protected UserDetailsService userDetailsService(){
// InMemoryUserDetailsManager manager = new InMemoryUserDetailsManager();
// manager.createUser(User.withUsername("user_1").password("123456").authorities("USER").build());
// manager.createUser(User.withUsername("user_2").password("123456").authorities("USER").build());
// return manager;
// }
}
| UTF-8 | Java | 3,633 | java | SsoSecurityConfig.java | Java | [
{
"context": "Security配置\n * Created on 2017/12/26.\n *\n * @author zlf\n * @since 1.0\n */\n@Configuration\npublic class Sso",
"end": 1114,
"score": 0.9997024536132812,
"start": 1111,
"tag": "USERNAME",
"value": "zlf"
},
{
"context": ";\n// manager.createUser(User.withUsername(\"user_1\").password(\"123456\").authorities(\"USER\").build())",
"end": 3433,
"score": 0.9995133280754089,
"start": 3427,
"tag": "USERNAME",
"value": "user_1"
},
{
"context": ".createUser(User.withUsername(\"user_1\").password(\"123456\").authorities(\"USER\").build());\n// manager",
"end": 3452,
"score": 0.999328076839447,
"start": 3446,
"tag": "PASSWORD",
"value": "123456"
},
{
"context": ";\n// manager.createUser(User.withUsername(\"user_2\").password(\"123456\").authorities(\"USER\").build())",
"end": 3539,
"score": 0.9995220303535461,
"start": 3533,
"tag": "USERNAME",
"value": "user_2"
},
{
"context": ".createUser(User.withUsername(\"user_2\").password(\"123456\").authorities(\"USER\").build());\n// return ",
"end": 3558,
"score": 0.999337911605835,
"start": 3552,
"tag": "PASSWORD",
"value": "123456"
}
]
| null | []
| package cn.merryyou.sso.server;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter;
/**
* spring Security配置
* Created on 2017/12/26.
*
* @author zlf
* @since 1.0
*/
@Configuration
public class SsoSecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private UserDetailsService userDetailsService;
@Bean
public PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
@Override
public void configure(WebSecurity web) throws Exception {
// super.configure(web);
web.ignoring().antMatchers("/test1");
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.formLogin().loginPage("/authentication/require")
.loginProcessingUrl("/authentication/form")
.and().authorizeRequests()
.antMatchers("/authentication/require",
"/authentication/form",
"/**/*.js",
"/**/*.css",
"/**/*.jpg",
"/**/*.png",
"/**/*.woff2"
)
.permitAll()
.antMatchers("/test2")
.permitAll()
.anyRequest().authenticated()
.and()
.csrf().disable();
// .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS);
// http.formLogin().and().authorizeRequests().anyRequest().authenticated();
// http.authenticationProvider()
http.addFilterBefore(wechatLoginFilter(), AbstractPreAuthenticatedProcessingFilter.class);
}
public WechatLoginFilter wechatLoginFilter() throws Exception {
WechatLoginFilter wechatLoginFilter = new WechatLoginFilter();
wechatLoginFilter.setAuthenticationManager(authenticationManager());
return wechatLoginFilter;
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder());
}
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
return super.authenticationManagerBean();
}
// @Bean
// protected UserDetailsService userDetailsService(){
// InMemoryUserDetailsManager manager = new InMemoryUserDetailsManager();
// manager.createUser(User.withUsername("user_1").password("<PASSWORD>").authorities("USER").build());
// manager.createUser(User.withUsername("user_2").password("<PASSWORD>").authorities("USER").build());
// return manager;
// }
}
| 3,641 | 0.695233 | 0.687793 | 91 | 38.87912 | 32.130856 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.417582 | false | false | 4 |
f7675e149d4ce115acaef8876f71d8bf95032ade | 28,329,604,346,667 | 91a2fa0d42966847fe5ced85a58ef6395de03f67 | /src/main/java/loader/FileChooserSave.java | d84cfcdda66ecb1a342ff383d2df6120a69c73a4 | []
| no_license | Navodar22/Diplomovka | https://github.com/Navodar22/Diplomovka | e176908183318c492a486523902306a59ed01d8e | 27bfcc4a709859435fcbb9919a629e21f2b82899 | HEAD | 2016-09-05T12:22:05.315000 | 2015-02-27T23:01:15 | 2015-02-27T23:01:15 | 19,873,627 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package loader;
import java.io.File;
import java.util.prefs.Preferences;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import design.MainFrame;
import actions.ExampleFileFilterAction;
import actions.LoadDataAction;
public class FileChooserSave {
JFileChooser chooser;
MainFrame mainFrame;
public FileChooserSave(MainFrame mainframe){
this.mainFrame = mainframe;
Preferences preferences = Preferences
.userNodeForPackage(LoadDataAction.class);
String dir = preferences.get("adresar", ".");
File currentDirectory = new File(dir);
chooser = new JFileChooser(currentDirectory);
chooser.setMultiSelectionEnabled(false);
ExampleFileFilterAction filter = new ExampleFileFilterAction();
filter.addExtension("ptfs");
filter.setDescription("LPO's XML's");
chooser.setFileFilter(filter);
}
public File getFileFromChooser() {
int rVal = chooser.showSaveDialog(chooser);
if (rVal == JFileChooser.APPROVE_OPTION) {
File file = chooser.getSelectedFile();
if(!file.getAbsolutePath().toLowerCase().endsWith(".ptfs"))
{
file = new File(file.getAbsolutePath() + ".ptfs");
}
if (file.exists()) {
int reply = JOptionPane.showConfirmDialog(null,
"The file exists, overwrite?", "Existing file",
JOptionPane.YES_NO_OPTION);
switch (reply) {
case JOptionPane.YES_OPTION:
break;
case JOptionPane.NO_OPTION:
getFileFromChooser();
break;
case JOptionPane.CLOSED_OPTION:
return null;
case JOptionPane.CANCEL_OPTION:
return null;
}
}
if( mainFrame.isFileInLoadedLpos(file) ){
JOptionPane.showMessageDialog(null, "This file is already open", "Error", JOptionPane.ERROR_MESSAGE);
getFileFromChooser();
}
return file;
}
return null;
}
}
| UTF-8 | Java | 1,801 | java | FileChooserSave.java | Java | []
| null | []
| package loader;
import java.io.File;
import java.util.prefs.Preferences;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import design.MainFrame;
import actions.ExampleFileFilterAction;
import actions.LoadDataAction;
public class FileChooserSave {
JFileChooser chooser;
MainFrame mainFrame;
public FileChooserSave(MainFrame mainframe){
this.mainFrame = mainframe;
Preferences preferences = Preferences
.userNodeForPackage(LoadDataAction.class);
String dir = preferences.get("adresar", ".");
File currentDirectory = new File(dir);
chooser = new JFileChooser(currentDirectory);
chooser.setMultiSelectionEnabled(false);
ExampleFileFilterAction filter = new ExampleFileFilterAction();
filter.addExtension("ptfs");
filter.setDescription("LPO's XML's");
chooser.setFileFilter(filter);
}
public File getFileFromChooser() {
int rVal = chooser.showSaveDialog(chooser);
if (rVal == JFileChooser.APPROVE_OPTION) {
File file = chooser.getSelectedFile();
if(!file.getAbsolutePath().toLowerCase().endsWith(".ptfs"))
{
file = new File(file.getAbsolutePath() + ".ptfs");
}
if (file.exists()) {
int reply = JOptionPane.showConfirmDialog(null,
"The file exists, overwrite?", "Existing file",
JOptionPane.YES_NO_OPTION);
switch (reply) {
case JOptionPane.YES_OPTION:
break;
case JOptionPane.NO_OPTION:
getFileFromChooser();
break;
case JOptionPane.CLOSED_OPTION:
return null;
case JOptionPane.CANCEL_OPTION:
return null;
}
}
if( mainFrame.isFileInLoadedLpos(file) ){
JOptionPane.showMessageDialog(null, "This file is already open", "Error", JOptionPane.ERROR_MESSAGE);
getFileFromChooser();
}
return file;
}
return null;
}
}
| 1,801 | 0.710161 | 0.710161 | 76 | 22.697369 | 20.711693 | 105 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.631579 | false | false | 4 |
69792282b960009f5cc929cf80237365d59a531f | 26,499,948,242,679 | 241585e634759134a43c287c28e2e48186c0a3b1 | /src/main/java/com/hbase/examples/HBaseCreateTable.java | 86115ef6d94031e2c1e27150b4db7b3d2e835d98 | []
| no_license | ShobhaEndigeri/HBaseClientAPIs | https://github.com/ShobhaEndigeri/HBaseClientAPIs | 090ca402c1b4b318d46633f295cb903bb30a91da | 09efe3495180ffa10b63e5c8c2c8a238951b2bb2 | refs/heads/master | 2021-01-23T19:33:45.977000 | 2018-02-28T11:15:17 | 2018-02-28T11:15:17 | 102,828,118 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.hbase.examples;
import java.io.IOException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.HBaseAdmin;
/**
*
* @author Shobha
*
*/
public class HBaseCreateTable {
public static void main(String args[]) {
HBaseAdmin admin = null;
Configuration conf = null;
try {
conf = HBaseConfiguration.create();
admin = new HBaseAdmin( conf );
String table ="testtable";
String[] colfams = {"colFam1"};
TableName tableName = TableName.valueOf(table);
if(admin.tableExists( tableName )) {
admin.disableTable( tableName );
admin.deleteTable(tableName);
}
HTableDescriptor desc = new HTableDescriptor( table );
for( String cf : colfams )
{
HColumnDescriptor coldef = new HColumnDescriptor( cf );
desc.addFamily( coldef );
}
admin.createTable( desc );
} catch (IOException e) {
e.printStackTrace();
} finally {
if(admin != null) {
try {
admin.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
| UTF-8 | Java | 1,315 | java | HBaseCreateTable.java | Java | [
{
"context": "p.hbase.client.HBaseAdmin;\r\n\r\n/**\r\n * \r\n * @author Shobha\r\n * \r\n */\r\n\r\npublic class HBaseCreateTable {\r\n\t\r\n",
"end": 384,
"score": 0.8745532631874084,
"start": 378,
"tag": "USERNAME",
"value": "Shobha"
}
]
| null | []
| package com.hbase.examples;
import java.io.IOException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.HBaseAdmin;
/**
*
* @author Shobha
*
*/
public class HBaseCreateTable {
public static void main(String args[]) {
HBaseAdmin admin = null;
Configuration conf = null;
try {
conf = HBaseConfiguration.create();
admin = new HBaseAdmin( conf );
String table ="testtable";
String[] colfams = {"colFam1"};
TableName tableName = TableName.valueOf(table);
if(admin.tableExists( tableName )) {
admin.disableTable( tableName );
admin.deleteTable(tableName);
}
HTableDescriptor desc = new HTableDescriptor( table );
for( String cf : colfams )
{
HColumnDescriptor coldef = new HColumnDescriptor( cf );
desc.addFamily( coldef );
}
admin.createTable( desc );
} catch (IOException e) {
e.printStackTrace();
} finally {
if(admin != null) {
try {
admin.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
| 1,315 | 0.647909 | 0.647148 | 59 | 20.288136 | 18.109882 | 59 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.101695 | false | false | 4 |
9549d9628f95d4c4dd855f3ca47584740d52ee4b | 18,287,970,789,417 | 91e026864a6fd2f0c2cc6b3d2f303635560db5e7 | /src/main/java/org/kritikal/fabric/metrics/Result.java | fe295fc3c41b03837ec162d3aaa111b04b565075 | [
"Apache-2.0",
"LicenseRef-scancode-public-domain"
]
| permissive | KritikalFabric/corefabric.io | https://github.com/KritikalFabric/corefabric.io | ec9173ab58b482cb2dd74a132140ff3f012f0ff0 | e78842e610937a5720bb4822351df76e377ced6b | refs/heads/master | 2022-04-19T18:57:03.194000 | 2018-12-22T14:15:53 | 2018-12-22T14:15:53 | 75,288,267 | 3 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.kritikal.fabric.metrics;
/**
* Created by ben on 23/02/15.
*/
public interface Result<T extends DbBuilder> {
public T getResult();
}
| UTF-8 | Java | 154 | java | Result.java | Java | [
{
"context": "ge org.kritikal.fabric.metrics;\n\n/**\n * Created by ben on 23/02/15.\n */\npublic interface Result<T extend",
"end": 59,
"score": 0.9954961538314819,
"start": 56,
"tag": "USERNAME",
"value": "ben"
}
]
| null | []
| package org.kritikal.fabric.metrics;
/**
* Created by ben on 23/02/15.
*/
public interface Result<T extends DbBuilder> {
public T getResult();
}
| 154 | 0.681818 | 0.642857 | 10 | 14.4 | 16.977633 | 46 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | false | false | 4 |
8910ee0564eebcdea78c8e3eb6d71e2e6a73487b | 3,573,412,815,746 | 17986435912a028150de9aa695982e1ef7ef0795 | /src/Aula5/Ex3.java | 0b79518af52a82320ac319ad7f5e84f95a0a217c | []
| no_license | LucielVitorBS/ED1 | https://github.com/LucielVitorBS/ED1 | f7364872981c1025334bb8f156a3fb626a614465 | d12e6982f2cbd68376292ea0b16c0288b36588f7 | refs/heads/master | 2020-03-30T18:27:33.140000 | 2018-11-20T22:56:51 | 2018-11-20T22:56:51 | 151,500,818 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Aula5;
import java.util.Scanner;
public class Ex3 {
public static void main(String[] args) {
Scanner read= new Scanner(System.in);
System.out.print("Número: ");
double resposta= imparPar(read.nextDouble());
if (resposta == 0){
System.out.println("0");
}else {
System.out.println("1");
}
}
public static double imparPar(double numero){
double n=0;
n= numero % 2;
return n;
}
}
| UTF-8 | Java | 504 | java | Ex3.java | Java | []
| null | []
| package Aula5;
import java.util.Scanner;
public class Ex3 {
public static void main(String[] args) {
Scanner read= new Scanner(System.in);
System.out.print("Número: ");
double resposta= imparPar(read.nextDouble());
if (resposta == 0){
System.out.println("0");
}else {
System.out.println("1");
}
}
public static double imparPar(double numero){
double n=0;
n= numero % 2;
return n;
}
}
| 504 | 0.540755 | 0.526839 | 24 | 19.958334 | 17.135439 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.416667 | false | false | 4 |
d031f12d42c091cb446d15d353641610261f26af | 12,962,211,318,761 | 5aaa74f4f5cca26e80985a01f3b97c73b8f1d42e | /datastore/src/main/java/io/spine/server/storage/datastore/query/QueryWithFilter.java | bb00e0c833bf037d4488d6876428421d56a4195f | [
"LicenseRef-scancode-proprietary-license",
"LGPL-2.1-only",
"LicenseRef-scancode-unknown-license-reference",
"LGPL-2.0-or-later",
"MPL-2.0",
"EPL-1.0",
"Classpath-exception-2.0",
"BSD-3-Clause",
"CDDL-1.1",
"MPL-1.1",
"GPL-2.0-only",
"Apache-2.0",
"MPL-1.0",
"WTFPL",
"EPL-2.0",
"CDDL-1.0",
"MIT",
"LGPL-2.1-or-later"
]
| permissive | SpineEventEngine/gcloud-java | https://github.com/SpineEventEngine/gcloud-java | 4bf86857cbe887530db3887764c03246b9deaf97 | 004294b066d06ec0f0d75e615827c33389f5c2c1 | refs/heads/master | 2023-06-28T02:45:10.963000 | 2022-04-11T11:50:27 | 2022-04-11T11:50:27 | 46,358,716 | 2 | 0 | Apache-2.0 | false | 2023-08-28T14:46:38 | 2015-11-17T16:08:56 | 2022-11-14T16:49:11 | 2023-08-28T14:46:36 | 4,853 | 3 | 0 | 15 | Java | false | false | /*
* Copyright 2022, TeamDev. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Redistribution and use in source and/or binary forms, with or without
* modification, must retain the above copyright notice and the following
* disclaimer.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package io.spine.server.storage.datastore.query;
import com.google.cloud.datastore.Entity;
import com.google.cloud.datastore.Query;
import com.google.cloud.datastore.StructuredQuery;
import com.google.common.collect.ImmutableList;
import io.spine.query.RecordQuery;
import io.spine.query.SortBy;
import io.spine.server.storage.datastore.Kind;
import java.util.function.Function;
import static com.google.cloud.datastore.StructuredQuery.OrderBy.asc;
import static com.google.cloud.datastore.StructuredQuery.OrderBy.desc;
import static com.google.common.base.Preconditions.checkNotNull;
import static io.spine.query.Direction.ASC;
/**
* A template of a Datastore's {@code Query} built upon some generic properties of the passed
* {@code RecordQuery} (such as sorting and limit) and awaiting a Datastore's native {@code Filter}
* — supplied by other routines — to produce an instance of {@code StructuredQuery} ready
* for execution against Datastore.
*
* <p>The transformation of {@code RecordQuery} into one or more {@code StructuredQuery}
* instances is a complex process. Several different parties are involved into it, including
* {@linkplain DsFilters utility} producing the Datastore {@code Filters}.
*
* <p>This type serves a "staging area" by accumulating the pieces required
* to build a proper {@code StructuredQuery}.
*/
final class QueryWithFilter implements Function<StructuredQuery.Filter, StructuredQuery<Entity>> {
private final StructuredQuery.Builder<Entity> builder;
QueryWithFilter(RecordQuery<?, ?> query, Kind kind) {
checkNotNull(query);
checkNotNull(kind);
this.builder = Query.newEntityQueryBuilder()
.setKind(kind.value());
ImmutableList<? extends SortBy<?, ?>> sorting = query.sorting();
if (!sorting.isEmpty()) {
for (SortBy<?, ?> sortBy : sorting) {
var orderBy = translateSortBy(sortBy);
builder.addOrderBy(orderBy);
}
}
var limit = query.limit();
if (limit != null && limit > 0) {
this.builder.setLimit(limit);
}
}
private static StructuredQuery.OrderBy translateSortBy(SortBy<?, ?> sortBy) {
var column = sortBy.column();
var columnName = column.name()
.value();
return sortBy.direction() == ASC
? asc(columnName)
: desc(columnName);
}
@Override
public StructuredQuery<Entity> apply(StructuredQuery.Filter filter) {
checkNotNull(filter);
var query = builder.setFilter(filter)
.build();
return query;
}
/**
* Creates a new {@code StructuredQuery} without filters.
*/
StructuredQuery<Entity> withNoFilter() {
var result = builder.build();
return result;
}
}
| UTF-8 | Java | 4,129 | java | QueryWithFilter.java | Java | [
{
"context": "/*\n * Copyright 2022, TeamDev. All rights reserved.\n *\n * Licensed under the Ap",
"end": 29,
"score": 0.9990216493606567,
"start": 22,
"tag": "USERNAME",
"value": "TeamDev"
}
]
| null | []
| /*
* Copyright 2022, TeamDev. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Redistribution and use in source and/or binary forms, with or without
* modification, must retain the above copyright notice and the following
* disclaimer.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package io.spine.server.storage.datastore.query;
import com.google.cloud.datastore.Entity;
import com.google.cloud.datastore.Query;
import com.google.cloud.datastore.StructuredQuery;
import com.google.common.collect.ImmutableList;
import io.spine.query.RecordQuery;
import io.spine.query.SortBy;
import io.spine.server.storage.datastore.Kind;
import java.util.function.Function;
import static com.google.cloud.datastore.StructuredQuery.OrderBy.asc;
import static com.google.cloud.datastore.StructuredQuery.OrderBy.desc;
import static com.google.common.base.Preconditions.checkNotNull;
import static io.spine.query.Direction.ASC;
/**
* A template of a Datastore's {@code Query} built upon some generic properties of the passed
* {@code RecordQuery} (such as sorting and limit) and awaiting a Datastore's native {@code Filter}
* — supplied by other routines — to produce an instance of {@code StructuredQuery} ready
* for execution against Datastore.
*
* <p>The transformation of {@code RecordQuery} into one or more {@code StructuredQuery}
* instances is a complex process. Several different parties are involved into it, including
* {@linkplain DsFilters utility} producing the Datastore {@code Filters}.
*
* <p>This type serves a "staging area" by accumulating the pieces required
* to build a proper {@code StructuredQuery}.
*/
final class QueryWithFilter implements Function<StructuredQuery.Filter, StructuredQuery<Entity>> {
private final StructuredQuery.Builder<Entity> builder;
QueryWithFilter(RecordQuery<?, ?> query, Kind kind) {
checkNotNull(query);
checkNotNull(kind);
this.builder = Query.newEntityQueryBuilder()
.setKind(kind.value());
ImmutableList<? extends SortBy<?, ?>> sorting = query.sorting();
if (!sorting.isEmpty()) {
for (SortBy<?, ?> sortBy : sorting) {
var orderBy = translateSortBy(sortBy);
builder.addOrderBy(orderBy);
}
}
var limit = query.limit();
if (limit != null && limit > 0) {
this.builder.setLimit(limit);
}
}
private static StructuredQuery.OrderBy translateSortBy(SortBy<?, ?> sortBy) {
var column = sortBy.column();
var columnName = column.name()
.value();
return sortBy.direction() == ASC
? asc(columnName)
: desc(columnName);
}
@Override
public StructuredQuery<Entity> apply(StructuredQuery.Filter filter) {
checkNotNull(filter);
var query = builder.setFilter(filter)
.build();
return query;
}
/**
* Creates a new {@code StructuredQuery} without filters.
*/
StructuredQuery<Entity> withNoFilter() {
var result = builder.build();
return result;
}
}
| 4,129 | 0.693333 | 0.691151 | 104 | 38.66346 | 28.971674 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.576923 | false | false | 4 |
05d7ac4eb2da8027a606b0e05381d2dba27bcd68 | 37,623,913,530,496 | 1272e0af6c6ab10523dfe21f21bd5df85f964116 | /com.zutubi.tove.ui/src/java/com/zutubi/tove/ui/forms/FieldScriptAnnotationHandler.java | 8d9f4a84f009fb00ad86fc77d72963f2a1121c97 | [
"Apache-2.0"
]
| permissive | ppsravan/pulse | https://github.com/ppsravan/pulse | 083e57932423ea6360e3642f3934e17ea450be75 | 6a41105ae8438018b055611268c20dac5585f890 | refs/heads/master | 2022-03-10T23:17:58.540000 | 2017-04-14T12:00:02 | 2017-04-14T12:00:02 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /* Copyright 2017 Zutubi Pty Ltd
*
* 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.zutubi.tove.ui.forms;
import com.zutubi.tove.annotations.FieldScript;
import com.zutubi.tove.type.CompositeType;
import com.zutubi.tove.type.TypeProperty;
import com.zutubi.tove.ui.model.forms.FieldModel;
import com.zutubi.util.StringUtils;
import com.zutubi.util.SystemUtils;
import freemarker.cache.ClassTemplateLoader;
import freemarker.cache.MultiTemplateLoader;
import freemarker.cache.TemplateLoader;
import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.TemplateException;
import java.io.IOException;
import java.io.StringWriter;
import java.lang.annotation.Annotation;
import java.util.HashMap;
import java.util.Map;
/**
* Handler for the {@link @com.zutubi.tove.annotations.FieldScript} annotation.
*/
public class FieldScriptAnnotationHandler implements AnnotationHandler
{
private Configuration freemarkerConfiguration;
public static void loadTemplate(Class clazz, FieldModel field, String templateName, Configuration freemarkerConfiguration) throws IOException, TemplateException
{
if (StringUtils.stringSet(templateName))
{
Map<String, Object> freemarkerContext = new HashMap<>();
freemarkerContext.put("field", field);
freemarkerContext.put("isWindows", Boolean.toString(SystemUtils.IS_WINDOWS));
freemarker.template.Configuration config = addClassTemplateLoader(clazz, freemarkerConfiguration);
Template template = config.getTemplate(templateName + ".ftl");
StringWriter out = new StringWriter();
template.process(freemarkerContext, out);
field.addScript(out.toString());
}
}
private static Configuration addClassTemplateLoader(Class clazz, Configuration configuration)
{
Configuration newConfig = (Configuration) configuration.clone();
TemplateLoader currentLoader = configuration.getTemplateLoader();
TemplateLoader classLoader = new ClassTemplateLoader(clazz, "");
MultiTemplateLoader loader = new MultiTemplateLoader(new TemplateLoader[]{ classLoader, currentLoader });
newConfig.setTemplateLoader(loader);
return newConfig;
}
@Override
public boolean requiresContext(Annotation annotation)
{
return false;
}
@Override
public void process(CompositeType annotatedType, TypeProperty property, Annotation annotation, FieldModel field, FormContext context) throws Exception
{
FieldScript fieldScript = (FieldScript) annotation;
String template = fieldScript.template();
if(!StringUtils.stringSet(template))
{
template = annotatedType.getClazz().getSimpleName() + "." + field.getName();
}
loadTemplate(annotatedType.getClazz(), field, template, freemarkerConfiguration);
}
public void setFreemarkerConfiguration(Configuration freemarkerConfiguration)
{
this.freemarkerConfiguration = freemarkerConfiguration;
}
}
| UTF-8 | Java | 3,613 | java | FieldScriptAnnotationHandler.java | Java | []
| null | []
| /* Copyright 2017 Zutubi Pty Ltd
*
* 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.zutubi.tove.ui.forms;
import com.zutubi.tove.annotations.FieldScript;
import com.zutubi.tove.type.CompositeType;
import com.zutubi.tove.type.TypeProperty;
import com.zutubi.tove.ui.model.forms.FieldModel;
import com.zutubi.util.StringUtils;
import com.zutubi.util.SystemUtils;
import freemarker.cache.ClassTemplateLoader;
import freemarker.cache.MultiTemplateLoader;
import freemarker.cache.TemplateLoader;
import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.TemplateException;
import java.io.IOException;
import java.io.StringWriter;
import java.lang.annotation.Annotation;
import java.util.HashMap;
import java.util.Map;
/**
* Handler for the {@link @com.zutubi.tove.annotations.FieldScript} annotation.
*/
public class FieldScriptAnnotationHandler implements AnnotationHandler
{
private Configuration freemarkerConfiguration;
public static void loadTemplate(Class clazz, FieldModel field, String templateName, Configuration freemarkerConfiguration) throws IOException, TemplateException
{
if (StringUtils.stringSet(templateName))
{
Map<String, Object> freemarkerContext = new HashMap<>();
freemarkerContext.put("field", field);
freemarkerContext.put("isWindows", Boolean.toString(SystemUtils.IS_WINDOWS));
freemarker.template.Configuration config = addClassTemplateLoader(clazz, freemarkerConfiguration);
Template template = config.getTemplate(templateName + ".ftl");
StringWriter out = new StringWriter();
template.process(freemarkerContext, out);
field.addScript(out.toString());
}
}
private static Configuration addClassTemplateLoader(Class clazz, Configuration configuration)
{
Configuration newConfig = (Configuration) configuration.clone();
TemplateLoader currentLoader = configuration.getTemplateLoader();
TemplateLoader classLoader = new ClassTemplateLoader(clazz, "");
MultiTemplateLoader loader = new MultiTemplateLoader(new TemplateLoader[]{ classLoader, currentLoader });
newConfig.setTemplateLoader(loader);
return newConfig;
}
@Override
public boolean requiresContext(Annotation annotation)
{
return false;
}
@Override
public void process(CompositeType annotatedType, TypeProperty property, Annotation annotation, FieldModel field, FormContext context) throws Exception
{
FieldScript fieldScript = (FieldScript) annotation;
String template = fieldScript.template();
if(!StringUtils.stringSet(template))
{
template = annotatedType.getClazz().getSimpleName() + "." + field.getName();
}
loadTemplate(annotatedType.getClazz(), field, template, freemarkerConfiguration);
}
public void setFreemarkerConfiguration(Configuration freemarkerConfiguration)
{
this.freemarkerConfiguration = freemarkerConfiguration;
}
}
| 3,613 | 0.738998 | 0.736784 | 93 | 37.849461 | 34.912163 | 164 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.677419 | false | false | 4 |
9ede4a80c0bdcb6487e004df68f0c1bbf73341f4 | 32,220,844,713,723 | ab52bb58aab8104c26db2a6690ec1986ac37dd62 | /main6/ling/com/globalsight/ling/tm/LeverageProperties.java | 765f030406d6973776718af664059c31ab4d863d | []
| no_license | tingley/globalsight | https://github.com/tingley/globalsight | 32ae49ac08c671d9166bd0d6cdaa349d9e6b4438 | 47d95929f4e9939ba8bbbcb5544de357fef9aa8c | refs/heads/master | 2021-01-19T07:23:33.073000 | 2020-10-19T19:42:22 | 2020-10-19T19:42:22 | 14,053,692 | 7 | 6 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* Copyright 2009 Welocalize, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.globalsight.ling.tm;
import java.io.Serializable;
/**
* The LeverageProperties class defines the matching constraints for
* the Leverager.
*/
public class LeverageProperties
implements Serializable
{
private float m_fuzzyThreshold = LeverageType.DEFAULT_FUZZY_THRESHOLD;
private int m_maximumReturnedHits = 3;
private int m_matchType = LeverageType.FUZZY;
public float getFuzzyThreshold()
{
return m_fuzzyThreshold;
}
public int getMatchType()
{
return m_matchType;
}
public int getMaximumReturnedHits()
{
return m_maximumReturnedHits;
}
public void setFuzzyThreshold(float p_fuzzyThreshold)
{
m_fuzzyThreshold = p_fuzzyThreshold;
}
public void setMatchType(int p_matchType)
{
m_matchType = p_matchType;
}
public void setMaximumReturnedHits(int p_maximumReturnedHits)
{
m_maximumReturnedHits = p_maximumReturnedHits;
}
}
| UTF-8 | Java | 1,600 | java | LeverageProperties.java | Java | []
| null | []
| /**
* Copyright 2009 Welocalize, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.globalsight.ling.tm;
import java.io.Serializable;
/**
* The LeverageProperties class defines the matching constraints for
* the Leverager.
*/
public class LeverageProperties
implements Serializable
{
private float m_fuzzyThreshold = LeverageType.DEFAULT_FUZZY_THRESHOLD;
private int m_maximumReturnedHits = 3;
private int m_matchType = LeverageType.FUZZY;
public float getFuzzyThreshold()
{
return m_fuzzyThreshold;
}
public int getMatchType()
{
return m_matchType;
}
public int getMaximumReturnedHits()
{
return m_maximumReturnedHits;
}
public void setFuzzyThreshold(float p_fuzzyThreshold)
{
m_fuzzyThreshold = p_fuzzyThreshold;
}
public void setMatchType(int p_matchType)
{
m_matchType = p_matchType;
}
public void setMaximumReturnedHits(int p_maximumReturnedHits)
{
m_maximumReturnedHits = p_maximumReturnedHits;
}
}
| 1,600 | 0.695 | 0.689375 | 61 | 25.229507 | 25.007797 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.278689 | false | false | 4 |
8a0a48cea54c10e19312e6b83e8312d86a68adbb | 29,755,533,470,802 | aef1c2e859aae7ec37139743647591386361902b | /Java/Homework/01/ru/spbau/sorokin/task1/ConsoleMessageWriter.java | d528f96bb4b02fda1798d5a21198917b4da68fb5 | []
| no_license | griver/spbau | https://github.com/griver/spbau | 29adb6270cb76d1bab2f083d9016b23be2758087 | ffb41e78965005933c4fe221b05dc7ec1878e4a6 | refs/heads/master | 2021-01-22T05:10:42.071000 | 2012-08-23T22:29:09 | 2012-08-23T22:29:09 | 2,860,724 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ru.spbau.sorokin.task1;
import java.util.List;
public class ConsoleMessageWriter implements MessageWriter {
private int messageCount = 1;
public void writeMessage(Message message) {
List<String> stringList = message.getLines();
System.out.printf("Message %d%n", messageCount);
for(int i = 0; i < stringList.size(); i++) {
System.out.printf("%d.%d ", messageCount, i+1);
System.out.println(stringList.get(i));
}
messageCount++;
}
public void close() {
//just do nothing
}
}
| UTF-8 | Java | 600 | java | ConsoleMessageWriter.java | Java | []
| null | []
| package ru.spbau.sorokin.task1;
import java.util.List;
public class ConsoleMessageWriter implements MessageWriter {
private int messageCount = 1;
public void writeMessage(Message message) {
List<String> stringList = message.getLines();
System.out.printf("Message %d%n", messageCount);
for(int i = 0; i < stringList.size(); i++) {
System.out.printf("%d.%d ", messageCount, i+1);
System.out.println(stringList.get(i));
}
messageCount++;
}
public void close() {
//just do nothing
}
}
| 600 | 0.588333 | 0.581667 | 26 | 22.076923 | 22.528482 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 4 |
2217929eee8e21e5b54f26c6a150f33de7287ad4 | 28,664,611,801,997 | 6a10b0a59daa4e779282eeecc3d1105473f200dd | /src/main/java/com/thebuzzmedia/exiftool/logs/LoggerSlf4j.java | b8371b059026b9c6761f4c2e4d442eb4f7ba212d | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
]
| permissive | rmarmier/exiftool | https://github.com/rmarmier/exiftool | acab7030616ceee393c826d848decc6ba637c571 | 76a5a92050965e25f2786875c46993b88c8acd09 | refs/heads/master | 2021-01-22T16:53:10.254000 | 2017-05-14T21:32:32 | 2017-05-14T21:32:32 | 53,200,896 | 0 | 0 | null | true | 2016-03-05T12:43:57 | 2016-03-05T12:43:57 | 2016-01-19T11:04:42 | 2016-01-30T17:05:18 | 33,124 | 0 | 0 | 0 | null | null | null | /**
* Copyright 2011 The Buzz Media, LLC
* Copyright 2015 Mickael Jeanroy <mickael.jeanroy@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.thebuzzmedia.exiftool.logs;
/**
* Implementation of logger using slf4j as
* internal implementation.
*/
class LoggerSlf4j implements Logger {
/**
* Internal Logger.
*/
private final org.slf4j.Logger log;
/**
* Create logger.
* This constructor should be called by {@link com.thebuzzmedia.exiftool.logs.LoggerFactory} only.
*
* @param log Internal Logger.
*/
LoggerSlf4j(org.slf4j.Logger log) {
this.log = log;
}
@Override
public void trace(CharSequence message, Object... params) {
print(Level.TRACE, message, params);
}
@Override
public void info(CharSequence message, Object... params) {
print(Level.INFO, message, params);
}
@Override
public void debug(CharSequence message, Object... params) {
print(Level.DEBUG, message, params);
}
@Override
public void warn(CharSequence message, Object... params) {
print(Level.WARN, message, params);
}
@Override
public void error(CharSequence message, Object... params) {
print(Level.ERROR, message, params);
}
@Override
public void error(CharSequence message, Throwable ex) {
String msg = message == null ? null : message.toString();
log.error(msg, ex);
}
@Override
public boolean isDebugEnabled() {
return log.isDebugEnabled();
}
private void print(Level level, CharSequence message, Object... params) {
if (level.isEnabled(log)) {
String str = message == null ? null : message.toString();
if (str != null && params.length > 0) {
str = str.replaceAll("%s", "{}");
}
level.log(log, str, params);
}
}
private static enum Level {
TRACE {
@Override
boolean isEnabled(org.slf4j.Logger log) {
return log.isTraceEnabled();
}
@Override
void log(org.slf4j.Logger log, String str, Object... params) {
log.trace(str, params);
}
},
DEBUG {
@Override
boolean isEnabled(org.slf4j.Logger log) {
return log.isDebugEnabled();
}
@Override
void log(org.slf4j.Logger log, String str, Object... params) {
log.debug(str, params);
}
},
INFO {
@Override
boolean isEnabled(org.slf4j.Logger log) {
return log.isInfoEnabled();
}
@Override
void log(org.slf4j.Logger log, String str, Object... params) {
log.info(str, params);
}
},
WARN {
@Override
boolean isEnabled(org.slf4j.Logger log) {
return log.isWarnEnabled();
}
@Override
void log(org.slf4j.Logger log, String str, Object... params) {
log.warn(str, params);
}
},
ERROR {
@Override
boolean isEnabled(org.slf4j.Logger log) {
return log.isErrorEnabled();
}
@Override
void log(org.slf4j.Logger log, String str, Object... params) {
log.error(str, params);
}
};
abstract boolean isEnabled(org.slf4j.Logger log);
abstract void log(org.slf4j.Logger log, String str, Object... params);
}
}
| UTF-8 | Java | 3,495 | java | LoggerSlf4j.java | Java | [
{
"context": "pyright 2011 The Buzz Media, LLC\n * Copyright 2015 Mickael Jeanroy <mickael.jeanroy@gmail.com>\n *\n * Licensed under ",
"end": 75,
"score": 0.9998865127563477,
"start": 60,
"tag": "NAME",
"value": "Mickael Jeanroy"
},
{
"context": "uzz Media, LLC\n * Copyright 2015 Mickael Jeanroy <mickael.jeanroy@gmail.com>\n *\n * Licensed under the Apache License, Version",
"end": 102,
"score": 0.9999303817749023,
"start": 77,
"tag": "EMAIL",
"value": "mickael.jeanroy@gmail.com"
}
]
| null | []
| /**
* Copyright 2011 The Buzz Media, LLC
* Copyright 2015 <NAME> <<EMAIL>>
*
* 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.thebuzzmedia.exiftool.logs;
/**
* Implementation of logger using slf4j as
* internal implementation.
*/
class LoggerSlf4j implements Logger {
/**
* Internal Logger.
*/
private final org.slf4j.Logger log;
/**
* Create logger.
* This constructor should be called by {@link com.thebuzzmedia.exiftool.logs.LoggerFactory} only.
*
* @param log Internal Logger.
*/
LoggerSlf4j(org.slf4j.Logger log) {
this.log = log;
}
@Override
public void trace(CharSequence message, Object... params) {
print(Level.TRACE, message, params);
}
@Override
public void info(CharSequence message, Object... params) {
print(Level.INFO, message, params);
}
@Override
public void debug(CharSequence message, Object... params) {
print(Level.DEBUG, message, params);
}
@Override
public void warn(CharSequence message, Object... params) {
print(Level.WARN, message, params);
}
@Override
public void error(CharSequence message, Object... params) {
print(Level.ERROR, message, params);
}
@Override
public void error(CharSequence message, Throwable ex) {
String msg = message == null ? null : message.toString();
log.error(msg, ex);
}
@Override
public boolean isDebugEnabled() {
return log.isDebugEnabled();
}
private void print(Level level, CharSequence message, Object... params) {
if (level.isEnabled(log)) {
String str = message == null ? null : message.toString();
if (str != null && params.length > 0) {
str = str.replaceAll("%s", "{}");
}
level.log(log, str, params);
}
}
private static enum Level {
TRACE {
@Override
boolean isEnabled(org.slf4j.Logger log) {
return log.isTraceEnabled();
}
@Override
void log(org.slf4j.Logger log, String str, Object... params) {
log.trace(str, params);
}
},
DEBUG {
@Override
boolean isEnabled(org.slf4j.Logger log) {
return log.isDebugEnabled();
}
@Override
void log(org.slf4j.Logger log, String str, Object... params) {
log.debug(str, params);
}
},
INFO {
@Override
boolean isEnabled(org.slf4j.Logger log) {
return log.isInfoEnabled();
}
@Override
void log(org.slf4j.Logger log, String str, Object... params) {
log.info(str, params);
}
},
WARN {
@Override
boolean isEnabled(org.slf4j.Logger log) {
return log.isWarnEnabled();
}
@Override
void log(org.slf4j.Logger log, String str, Object... params) {
log.warn(str, params);
}
},
ERROR {
@Override
boolean isEnabled(org.slf4j.Logger log) {
return log.isErrorEnabled();
}
@Override
void log(org.slf4j.Logger log, String str, Object... params) {
log.error(str, params);
}
};
abstract boolean isEnabled(org.slf4j.Logger log);
abstract void log(org.slf4j.Logger log, String str, Object... params);
}
}
| 3,468 | 0.674392 | 0.665808 | 153 | 21.843138 | 23.514456 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.993464 | false | false | 4 |
6ba736816724712e34cde33421fabd5212ae5b5f | 8,873,402,435,582 | 854713e6a0550fe5f2fe09576b656013cf56af4d | /src/com/nompor/gtk/awt/animation/FadeFillRectDrawAnimation.java | ea5538ed0288078d5532ce0fdcb438d0de386beb | [
"MIT"
]
| permissive | midwinter1111/java-nompor-lib | https://github.com/midwinter1111/java-nompor-lib | 178c6ef58d2cdf8316c5fcee0bebb8f9a28cc8e6 | 66bce811c6a21acd8756368dfaf8f3ca527eb870 | refs/heads/master | 2020-12-18T09:28:04.579000 | 2019-01-20T12:10:16 | 2019-01-20T12:10:16 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.nompor.gtk.awt.animation;
import java.awt.Color;
import com.nompor.gtk.animation.FadeAnimation;
import com.nompor.gtk.awt.draw.FillRect;
public class FadeFillRectDrawAnimation extends FillRect implements DrawAnimation {
private FadeAnimation anime;
public FadeFillRectDrawAnimation(double x, double y, double width, double height, Color color, float alpha) {
super(x, y, width, height, color);
anime = new FadeAnimation(this, alpha);
}
@Override
public void update() {
anime.update();
}
@Override
public boolean isEnd() {
return anime.isEnd();
}
}
| UTF-8 | Java | 584 | java | FadeFillRectDrawAnimation.java | Java | []
| null | []
| package com.nompor.gtk.awt.animation;
import java.awt.Color;
import com.nompor.gtk.animation.FadeAnimation;
import com.nompor.gtk.awt.draw.FillRect;
public class FadeFillRectDrawAnimation extends FillRect implements DrawAnimation {
private FadeAnimation anime;
public FadeFillRectDrawAnimation(double x, double y, double width, double height, Color color, float alpha) {
super(x, y, width, height, color);
anime = new FadeAnimation(this, alpha);
}
@Override
public void update() {
anime.update();
}
@Override
public boolean isEnd() {
return anime.isEnd();
}
}
| 584 | 0.751712 | 0.751712 | 26 | 21.461538 | 26.617273 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.384615 | false | false | 4 |
c62032846f9fb78029d41eb10d54cbbf9d4ab03b | 30,133,490,595,678 | 9519b174328b1ef187c1e46d16a15e1dc3eae84a | /MovieClient/src/java/youTubeShow/YouTubeClient.java | 771fed80ea4bb5b141efab00ad4a99e55c4714e6 | []
| no_license | seuwan/RestfulSearchService | https://github.com/seuwan/RestfulSearchService | 0863283894d52336af766bb31bc82374396ecce3 | be981a16267d13e9a0f30169b12cb522970df68e | refs/heads/master | 2021-01-24T09:37:17.705000 | 2016-09-27T01:43:04 | 2016-09-27T01:43:04 | 69,307,556 | 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 youTubeShow;
import com.google.api.client.http.HttpRequest;
import com.google.api.client.http.HttpRequestInitializer;
import com.google.api.client.http.javanet.NetHttpTransport;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.services.youtube.YouTube;
import com.google.api.services.youtube.model.ResourceId;
import com.google.api.services.youtube.model.SearchListResponse;
import com.google.api.services.youtube.model.SearchResult;
import com.google.api.services.youtube.model.Thumbnail;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
public class YouTubeClient {
public YouTube youtube = new YouTube.Builder(new NetHttpTransport(), new JacksonFactory(), new HttpRequestInitializer() {
@Override
public void initialize(HttpRequest hr) throws IOException {
}
}).setApplicationName("youTubeSearchSample").build();
public List<SearchResult> getSearchResult(String keywords) {
try {
YouTube.Search.List search = youtube.search().list("id,snippet");
String apiKey = "AIzaSyDhU5wTOIYidvY8DXIY3ODLU93CpHGjkGs";
search.setKey(apiKey);
search.setQ(keywords);
search.setType("video");
search.setFields("items(id/kind,id/videoId,snippet/title,snippet/thumbnails/default/url)");
// search.setFields("items(id/videoId,snippet/title,snippet/thumbnails/default/url)");
search.setMaxResults((long) 12);
SearchListResponse searchResponse = search.execute();
List<SearchResult> searchResultList = searchResponse.getItems();
System.out.print(searchResultList);
// if (searchResultList != null) {
// Iterator<SearchResult> iteratorSearchResults = searchResultList.iterator();
// if (!iteratorSearchResults.hasNext()) {
// System.out.println(" There aren't any results for your query.");
// }
//
// while (iteratorSearchResults.hasNext()) {
//
// SearchResult singleVideo = iteratorSearchResults.next();
// ResourceId rId = singleVideo.getId();
//
// if (rId.getKind().equals("youtube#video")) {
// Thumbnail thumbnail = singleVideo.getSnippet().getThumbnails().getDefault();
//
// System.out.println(" Video Id" + rId.getVideoId());
// System.out.println(" Title: " + singleVideo.getSnippet().getTitle());
// System.out.println(" Thumbnail: " + thumbnail.getUrl());
// System.out.println("\n-------------------------------------------------------------\n");
// }
// }
// }
// System.out.print(search.execute());
return searchResultList;
} catch (IOException ex) {
Logger.getLogger(YouTubeClient.class.getName()).log(Level.SEVERE, null, ex);
}
return null;
}
// public static void prettyPrint(Iterator<SearchResult> iteratorSearchResults, String query) {
//
// if (!iteratorSearchResults.hasNext()) {
// System.out.println(" There aren't any results for your query.");
// }
//
// while (iteratorSearchResults.hasNext()) {
//
// SearchResult singleVideo = iteratorSearchResults.next();
// ResourceId rId = singleVideo.getId();
//
// if (rId.getKind().equals("youtube#video")) {
// Thumbnail thumbnail = singleVideo.getSnippet().getThumbnails().getDefault();
//
// System.out.println(" Video Id" + rId.getVideoId());
// System.out.println(" Title: " + singleVideo.getSnippet().getTitle());
// System.out.println(" Thumbnail: " + thumbnail.getUrl());
// System.out.println("\n-------------------------------------------------------------\n");
// }
// }
// }
}
| UTF-8 | Java | 4,293 | java | YouTubeClient.java | Java | [
{
"context": ".list(\"id,snippet\");\n String apiKey = \"AIzaSyDhU5wTOIYidvY8DXIY3ODLU93CpHGjkGs\";\n search.setKey(apiKey);\n ",
"end": 1398,
"score": 0.9997596740722656,
"start": 1359,
"tag": "KEY",
"value": "AIzaSyDhU5wTOIYidvY8DXIY3ODLU93CpHGjkGs"
}
]
| 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 youTubeShow;
import com.google.api.client.http.HttpRequest;
import com.google.api.client.http.HttpRequestInitializer;
import com.google.api.client.http.javanet.NetHttpTransport;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.services.youtube.YouTube;
import com.google.api.services.youtube.model.ResourceId;
import com.google.api.services.youtube.model.SearchListResponse;
import com.google.api.services.youtube.model.SearchResult;
import com.google.api.services.youtube.model.Thumbnail;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
public class YouTubeClient {
public YouTube youtube = new YouTube.Builder(new NetHttpTransport(), new JacksonFactory(), new HttpRequestInitializer() {
@Override
public void initialize(HttpRequest hr) throws IOException {
}
}).setApplicationName("youTubeSearchSample").build();
public List<SearchResult> getSearchResult(String keywords) {
try {
YouTube.Search.List search = youtube.search().list("id,snippet");
String apiKey = "<KEY>";
search.setKey(apiKey);
search.setQ(keywords);
search.setType("video");
search.setFields("items(id/kind,id/videoId,snippet/title,snippet/thumbnails/default/url)");
// search.setFields("items(id/videoId,snippet/title,snippet/thumbnails/default/url)");
search.setMaxResults((long) 12);
SearchListResponse searchResponse = search.execute();
List<SearchResult> searchResultList = searchResponse.getItems();
System.out.print(searchResultList);
// if (searchResultList != null) {
// Iterator<SearchResult> iteratorSearchResults = searchResultList.iterator();
// if (!iteratorSearchResults.hasNext()) {
// System.out.println(" There aren't any results for your query.");
// }
//
// while (iteratorSearchResults.hasNext()) {
//
// SearchResult singleVideo = iteratorSearchResults.next();
// ResourceId rId = singleVideo.getId();
//
// if (rId.getKind().equals("youtube#video")) {
// Thumbnail thumbnail = singleVideo.getSnippet().getThumbnails().getDefault();
//
// System.out.println(" Video Id" + rId.getVideoId());
// System.out.println(" Title: " + singleVideo.getSnippet().getTitle());
// System.out.println(" Thumbnail: " + thumbnail.getUrl());
// System.out.println("\n-------------------------------------------------------------\n");
// }
// }
// }
// System.out.print(search.execute());
return searchResultList;
} catch (IOException ex) {
Logger.getLogger(YouTubeClient.class.getName()).log(Level.SEVERE, null, ex);
}
return null;
}
// public static void prettyPrint(Iterator<SearchResult> iteratorSearchResults, String query) {
//
// if (!iteratorSearchResults.hasNext()) {
// System.out.println(" There aren't any results for your query.");
// }
//
// while (iteratorSearchResults.hasNext()) {
//
// SearchResult singleVideo = iteratorSearchResults.next();
// ResourceId rId = singleVideo.getId();
//
// if (rId.getKind().equals("youtube#video")) {
// Thumbnail thumbnail = singleVideo.getSnippet().getThumbnails().getDefault();
//
// System.out.println(" Video Id" + rId.getVideoId());
// System.out.println(" Title: " + singleVideo.getSnippet().getTitle());
// System.out.println(" Thumbnail: " + thumbnail.getUrl());
// System.out.println("\n-------------------------------------------------------------\n");
// }
// }
// }
}
| 4,259 | 0.600745 | 0.598882 | 102 | 41.088234 | 33.872337 | 125 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.607843 | false | false | 4 |
491e97cd97e92edeb0dd13d279e66f835bfa8041 | 19,490,561,629,709 | 43a41d30ef93b05874a9b96a480b013b1d3a2de4 | /app/src/main/java/com/mcdull/cert/activity/ECardActivity.java | 0a0c815a5e60a8814fe50b9cb11c9629fa5801ce | []
| no_license | BeginLjm/ecjtu_CERT_xyt | https://github.com/BeginLjm/ecjtu_CERT_xyt | b89122df461fd69bcc6f0b4fcf880769fac570e8 | 05783d61f2ede54e32a535a949b6dcc1b3542e4b | refs/heads/master | 2020-12-05T19:46:04.559000 | 2016-08-20T07:37:01 | 2016-08-20T07:37:01 | 66,133,207 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.mcdull.cert.activity;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import android.app.NotificationManager;
import android.content.Context;
import android.os.Bundle;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import com.avos.avoscloud.AVUser;
import com.mcdull.cert.ActivityMode.MyTitleActivity;
import com.mcdull.cert.R;
import com.mcdull.cert.adapter.ECardAdapter;
import com.mcdull.cert.json.AbsJsonUtil;
public class ECardActivity extends MyTitleActivity {
private TextView tvStudentName;
private TextView tvStudentId;
private TextView tvECardId;
private TextView tvBalance;
private TextView tvTotal;
private ListView lvECard;
private TextView tvQueryTitle;
@Override
protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_ecard);
super.onCreate(savedInstanceState);
((NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE)).cancel(1);
initView();
init();
}
private void init() {
String eCardJson = getIntent().getStringExtra("eCardJson");
tvQueryTitle.setText("一卡通查询");
Map<String, Object> map = new HashMap<>();
try {
map = AbsJsonUtil.getJsonUtil(this).eCardParseJson(eCardJson);
} catch (Exception e) {
e.printStackTrace();
Toast.makeText(this, "查询失败,请稍候再试.", Toast.LENGTH_SHORT).show();
finish();
}
List<Map<String, String>> list = (List<Map<String, String>>) map.get("list");
if (map != null) {
tvStudentName.setText("姓名:" + map.get("name"));
tvStudentId.setText("学号:" + AVUser.getCurrentUser().getString("StudentId"));
tvECardId.setText("卡号:" + map.get("ecardid"));
tvBalance.setText("余额:" + map.get("balance"));
tvTotal.setText("今日" + map.get("total"));
}
if (list != null) {
ECardAdapter ECardAdapter = new ECardAdapter(this, list);
lvECard.setAdapter(ECardAdapter);
}
}
private void initView() {
tvStudentName = (TextView) findViewById(R.id.tv_student_name);
tvStudentId = (TextView) findViewById(R.id.tv_student_id);
tvECardId = (TextView) findViewById(R.id.tv_ecard_id);
tvBalance = (TextView) findViewById(R.id.tv_balance);
tvTotal = (TextView) findViewById(R.id.tv_total);
lvECard = (ListView) findViewById(R.id.lv_ecard);
tvQueryTitle = (TextView) findViewById(R.id.tv_title);
}
}
| UTF-8 | Java | 2,673 | java | ECardActivity.java | Java | []
| null | []
| package com.mcdull.cert.activity;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import android.app.NotificationManager;
import android.content.Context;
import android.os.Bundle;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import com.avos.avoscloud.AVUser;
import com.mcdull.cert.ActivityMode.MyTitleActivity;
import com.mcdull.cert.R;
import com.mcdull.cert.adapter.ECardAdapter;
import com.mcdull.cert.json.AbsJsonUtil;
public class ECardActivity extends MyTitleActivity {
private TextView tvStudentName;
private TextView tvStudentId;
private TextView tvECardId;
private TextView tvBalance;
private TextView tvTotal;
private ListView lvECard;
private TextView tvQueryTitle;
@Override
protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_ecard);
super.onCreate(savedInstanceState);
((NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE)).cancel(1);
initView();
init();
}
private void init() {
String eCardJson = getIntent().getStringExtra("eCardJson");
tvQueryTitle.setText("一卡通查询");
Map<String, Object> map = new HashMap<>();
try {
map = AbsJsonUtil.getJsonUtil(this).eCardParseJson(eCardJson);
} catch (Exception e) {
e.printStackTrace();
Toast.makeText(this, "查询失败,请稍候再试.", Toast.LENGTH_SHORT).show();
finish();
}
List<Map<String, String>> list = (List<Map<String, String>>) map.get("list");
if (map != null) {
tvStudentName.setText("姓名:" + map.get("name"));
tvStudentId.setText("学号:" + AVUser.getCurrentUser().getString("StudentId"));
tvECardId.setText("卡号:" + map.get("ecardid"));
tvBalance.setText("余额:" + map.get("balance"));
tvTotal.setText("今日" + map.get("total"));
}
if (list != null) {
ECardAdapter ECardAdapter = new ECardAdapter(this, list);
lvECard.setAdapter(ECardAdapter);
}
}
private void initView() {
tvStudentName = (TextView) findViewById(R.id.tv_student_name);
tvStudentId = (TextView) findViewById(R.id.tv_student_id);
tvECardId = (TextView) findViewById(R.id.tv_ecard_id);
tvBalance = (TextView) findViewById(R.id.tv_balance);
tvTotal = (TextView) findViewById(R.id.tv_total);
lvECard = (ListView) findViewById(R.id.lv_ecard);
tvQueryTitle = (TextView) findViewById(R.id.tv_title);
}
}
| 2,673 | 0.656095 | 0.655713 | 79 | 32.126583 | 24.6152 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.708861 | false | false | 4 |
10fb9855d614005c0eeb37248dbb82752d6a903a | 28,192,165,380,213 | b1d46d20de3352b7ab145b11374a0b32a9d53b20 | /chapter05_day01/src/main/java/chapter05_day01/demo1/show2/Teacher.java | 77cf6ee886a6d6df51a89cf087c82f80b7d8b486 | []
| no_license | KnewHow/studyDesignPatterns | https://github.com/KnewHow/studyDesignPatterns | 5f6cd3561b7263b04e3c407e94cd4b84d8a4b19c | c7254b1172019494a8de9f70c2af23cb5fedba2a | refs/heads/master | 2021-01-01T04:28:34.693000 | 2017-08-17T11:32:19 | 2017-08-17T11:32:19 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package chapter05_day01.demo1.show2;
public class Teacher {
public void command(GroupLeader groupLeader) {
groupLeader.counterGirls();
}
}
| UTF-8 | Java | 147 | java | Teacher.java | Java | []
| null | []
| package chapter05_day01.demo1.show2;
public class Teacher {
public void command(GroupLeader groupLeader) {
groupLeader.counterGirls();
}
}
| 147 | 0.755102 | 0.714286 | 8 | 17.375 | 17.406446 | 47 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false | 4 |
5c8d3834944db67d3aabeae4e9d79e7f9bc797c4 | 3,633,542,372,342 | 29deba09b0c22d614525137a1d73a8818e00d739 | /src/test/java/us/physion/ovation/integration/AnnotationRoundTripTest.java | 33170983839431d87f695b71668689fab712249b | []
| no_license | physion-archive/ovation-integration-test | https://github.com/physion-archive/ovation-integration-test | 86896ff7f9a6fc3cede85b32818dd2a98ceb7308 | 11d0e07a63f74d5dbfb1b77cb83f1c0a0bf90a05 | refs/heads/master | 2021-10-07T22:37:01.963000 | 2013-02-04T02:49:38 | 2013-02-04T02:49:38 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package us.physion.ovation.integration;
import org.joda.time.DateTime;
import org.jukito.JukitoModule;
import org.jukito.JukitoRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import us.physion.ovation.DataContext;
import us.physion.ovation.api.OvationApiModule;
import us.physion.ovation.domain.Project;
import us.physion.ovation.values.Resource;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.UUID;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import static org.junit.matchers.JUnitMatchers.hasItem;
@RunWith(JukitoRunner.class)
public class AnnotationRoundTripTest extends IntegrationTestBase
{
public static class Module extends JukitoModule
{
@Override
protected void configureTest()
{
new OvationApiModule().configure(binder());
}
}
/**
* As an authenticated user, given an annotatable entity, when I add a tag, the tag should be persisted,
* and retrievable by my user.
*/
@Test
public void should_add_tags() throws InterruptedException
{
DataContext ctx = dsc.getContext(USER_UUID, PASSWORD);
String name = "name";
String purpose = "purpose";
DateTime start = new DateTime();
Project p = ctx.insertProject(name, purpose, start);
String tag1 = "MYTAG";
p.addTag(tag1);
UUID projectUuid = p.getUuid();
DataContext verifyContext = dsc.getContext(USER_UUID, PASSWORD);
Project actual = (Project) verifyContext.getObjectWithUuid(projectUuid);
assertThat(actual.getUserTags(verifyContext.getAuthenticatedUser()), hasItem(tag1));
}
/**
* As an authenticated user, given an annotatable entity, when I add a property, the property should be
* persisted, and retrievable by my user.
*/
@Test
public void should_add_properties() throws InterruptedException
{
DataContext ctx = dsc.getContext(USER_UUID, PASSWORD);
String name = "name";
String purpose = "purpose";
DateTime start = new DateTime();
Project p = ctx.insertProject(name, purpose, start);
String key = "key";
String value = "value";
p.addProperty(key, value);
UUID projectUuid = p.getUuid();
DataContext verifyContext = dsc.getContext(USER_UUID, PASSWORD);
Project actual = (Project) verifyContext.getObjectWithUuid(projectUuid);
assertEquals(value, actual.getUserProperty(verifyContext.getAuthenticatedUser(), key));
assertEquals(value, actual.getProperty(key).get(verifyContext.getAuthenticatedUser()));
}
/**
* As an authenticated user, given multiple annotatable entities, when I add a property, the property should be
* persisted, and retrievable by my user.
*/
@Test
public void should_add_properties_distinguishing_entities() throws InterruptedException
{
DataContext ctx = dsc.getContext();
ctx.authenticateUser(USER_NAME, PASSWORD);
String name = "name";
String purpose = "purpose";
DateTime start = new DateTime();
Project p = ctx.insertProject(name, purpose, start);
Project p2 = ctx.insertProject(name, purpose, start);
String key1 = "key";
String value1 = "value";
String key2 = "key2";
int value2 = 10;
p.addProperty(key1, value1);
p2.addProperty(key2, value2);
UUID projectUuid = p.getUuid();
UUID project2Uuid = p2.getUuid();
DataContext verifyContext = dsc.getContext(USER_UUID, PASSWORD);
Project actual1 = (Project) verifyContext.getObjectWithUuid(projectUuid);
assertEquals(value1, actual1.getUserProperty(verifyContext.getAuthenticatedUser(), key1));
assertEquals(value1, actual1.getProperty(key1).get(ctx.getAuthenticatedUser()));
Project actual2 = (Project) verifyContext.getObjectWithUuid(project2Uuid);
assertEquals(value2, actual2.getUserProperty(verifyContext.getAuthenticatedUser(), key2));
assertEquals(value2, actual2.getProperty(key2).get(ctx.getAuthenticatedUser()));
}
/**
* As an authenticated user, given an annotatable entity, when I add a Resource, it should be persited,
* and retrievable by name.
*/
@Test
public void should_add_resource() throws URISyntaxException
{
DataContext ctx = dsc.getContext(USER_UUID, PASSWORD);
String name = "name";
String purpose = "purpose";
DateTime start = new DateTime();
Project p = ctx.insertProject(name, purpose, start);
String rsrcName = "RESOURCE";
URI rsrcUri = new URI("http://ovation.io/resource1");
String uti = "public.anything";
p.addResource(rsrcName, rsrcUri, uti);
UUID projectUuid = p.getUuid();
DataContext verifyContext = dsc.getContext(USER_UUID, PASSWORD);
Project actual = (Project) verifyContext.getObjectWithUuid(projectUuid);
Resource r = actual.getResource(rsrcName);
assertThat(actual.getResourceNames(), hasItem(rsrcName));
assertEquals(rsrcUri, r.getBaseUri());
assertEquals(uti, r.getUti());
}
}
| UTF-8 | Java | 5,271 | java | AnnotationRoundTripTest.java | Java | [
{
"context": "ext(USER_UUID, PASSWORD);\n\n String name = \"name\";\n String purpose = \"purpose\";\n Dat",
"end": 2054,
"score": 0.6010885834693909,
"start": 2050,
"tag": "NAME",
"value": "name"
},
{
"context": "ser(USER_NAME, PASSWORD);\n\n String name = \"name\";\n String purpose = \"purpose\";\n Dat",
"end": 3097,
"score": 0.7274126410484314,
"start": 3093,
"tag": "NAME",
"value": "name"
}
]
| null | []
| package us.physion.ovation.integration;
import org.joda.time.DateTime;
import org.jukito.JukitoModule;
import org.jukito.JukitoRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import us.physion.ovation.DataContext;
import us.physion.ovation.api.OvationApiModule;
import us.physion.ovation.domain.Project;
import us.physion.ovation.values.Resource;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.UUID;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import static org.junit.matchers.JUnitMatchers.hasItem;
@RunWith(JukitoRunner.class)
public class AnnotationRoundTripTest extends IntegrationTestBase
{
public static class Module extends JukitoModule
{
@Override
protected void configureTest()
{
new OvationApiModule().configure(binder());
}
}
/**
* As an authenticated user, given an annotatable entity, when I add a tag, the tag should be persisted,
* and retrievable by my user.
*/
@Test
public void should_add_tags() throws InterruptedException
{
DataContext ctx = dsc.getContext(USER_UUID, PASSWORD);
String name = "name";
String purpose = "purpose";
DateTime start = new DateTime();
Project p = ctx.insertProject(name, purpose, start);
String tag1 = "MYTAG";
p.addTag(tag1);
UUID projectUuid = p.getUuid();
DataContext verifyContext = dsc.getContext(USER_UUID, PASSWORD);
Project actual = (Project) verifyContext.getObjectWithUuid(projectUuid);
assertThat(actual.getUserTags(verifyContext.getAuthenticatedUser()), hasItem(tag1));
}
/**
* As an authenticated user, given an annotatable entity, when I add a property, the property should be
* persisted, and retrievable by my user.
*/
@Test
public void should_add_properties() throws InterruptedException
{
DataContext ctx = dsc.getContext(USER_UUID, PASSWORD);
String name = "name";
String purpose = "purpose";
DateTime start = new DateTime();
Project p = ctx.insertProject(name, purpose, start);
String key = "key";
String value = "value";
p.addProperty(key, value);
UUID projectUuid = p.getUuid();
DataContext verifyContext = dsc.getContext(USER_UUID, PASSWORD);
Project actual = (Project) verifyContext.getObjectWithUuid(projectUuid);
assertEquals(value, actual.getUserProperty(verifyContext.getAuthenticatedUser(), key));
assertEquals(value, actual.getProperty(key).get(verifyContext.getAuthenticatedUser()));
}
/**
* As an authenticated user, given multiple annotatable entities, when I add a property, the property should be
* persisted, and retrievable by my user.
*/
@Test
public void should_add_properties_distinguishing_entities() throws InterruptedException
{
DataContext ctx = dsc.getContext();
ctx.authenticateUser(USER_NAME, PASSWORD);
String name = "name";
String purpose = "purpose";
DateTime start = new DateTime();
Project p = ctx.insertProject(name, purpose, start);
Project p2 = ctx.insertProject(name, purpose, start);
String key1 = "key";
String value1 = "value";
String key2 = "key2";
int value2 = 10;
p.addProperty(key1, value1);
p2.addProperty(key2, value2);
UUID projectUuid = p.getUuid();
UUID project2Uuid = p2.getUuid();
DataContext verifyContext = dsc.getContext(USER_UUID, PASSWORD);
Project actual1 = (Project) verifyContext.getObjectWithUuid(projectUuid);
assertEquals(value1, actual1.getUserProperty(verifyContext.getAuthenticatedUser(), key1));
assertEquals(value1, actual1.getProperty(key1).get(ctx.getAuthenticatedUser()));
Project actual2 = (Project) verifyContext.getObjectWithUuid(project2Uuid);
assertEquals(value2, actual2.getUserProperty(verifyContext.getAuthenticatedUser(), key2));
assertEquals(value2, actual2.getProperty(key2).get(ctx.getAuthenticatedUser()));
}
/**
* As an authenticated user, given an annotatable entity, when I add a Resource, it should be persited,
* and retrievable by name.
*/
@Test
public void should_add_resource() throws URISyntaxException
{
DataContext ctx = dsc.getContext(USER_UUID, PASSWORD);
String name = "name";
String purpose = "purpose";
DateTime start = new DateTime();
Project p = ctx.insertProject(name, purpose, start);
String rsrcName = "RESOURCE";
URI rsrcUri = new URI("http://ovation.io/resource1");
String uti = "public.anything";
p.addResource(rsrcName, rsrcUri, uti);
UUID projectUuid = p.getUuid();
DataContext verifyContext = dsc.getContext(USER_UUID, PASSWORD);
Project actual = (Project) verifyContext.getObjectWithUuid(projectUuid);
Resource r = actual.getResource(rsrcName);
assertThat(actual.getResourceNames(), hasItem(rsrcName));
assertEquals(rsrcUri, r.getBaseUri());
assertEquals(uti, r.getUti());
}
}
| 5,271 | 0.673686 | 0.667236 | 160 | 31.94375 | 30.242819 | 115 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.81875 | false | false | 4 |
639460ba35e732f6a8fd8860d4b19411d0fe8257 | 6,442,450,984,075 | 8192e3f378e2da24e49d90449fec6446228e448b | /src/main/java/br/com/frasesInspiracoes/service/FrasesService.java | cf240d319f8e09bd123284850f32adaed0aa8402 | []
| no_license | demcruz/fraseInspira-oRest | https://github.com/demcruz/fraseInspira-oRest | 6facbb52475ea865a68354a7dd06dc569a61abee | 30a6c2af236ded96250eafcbfc1755a4c3a74f80 | refs/heads/master | 2023-02-25T23:29:15.963000 | 2021-02-03T00:56:04 | 2021-02-03T00:56:04 | 335,465,890 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package br.com.frasesInspiracoes.service;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import br.com.frasesInspiracoes.POJO.FrasesPOJO;
import br.com.frasesInspiracoes.entity.Frases;
import br.com.frasesInspiracoes.exception.ResourceNotFoundException;
import br.com.frasesInspiracoes.repository.FrasesRepository;
@Service
public class FrasesService {
private final FrasesRepository frasesRepository;
@Autowired
public FrasesService(FrasesRepository frasesRepository) {
this.frasesRepository = frasesRepository;
}
private FrasesPOJO convertToFrasesPOJO(Frases frases ){
return FrasesPOJO.create(frases);
}
public FrasesPOJO create (FrasesPOJO frasesPOJO) {
FrasesPOJO frasPOJO = FrasesPOJO.create(frasesRepository.save(Frases.create(frasesPOJO)));
return frasPOJO;
}
public Page<FrasesPOJO> findAll(Pageable pageable){
var page = frasesRepository.findAll(pageable);
return page.map(this::convertToFrasesPOJO);
}
public FrasesPOJO findById(Long id) {
var entity = frasesRepository.findById(id)
.orElseThrow(() -> new ResourceNotFoundException("Não a frases com esse ID"));
return FrasesPOJO.create(entity);
}
public FrasesPOJO update(FrasesPOJO frasesPOJO) {
final Optional<Frases> optionalFrases = frasesRepository.findById(frasesPOJO.getId());
if(!optionalFrases.isPresent()) {
new ResourceNotFoundException("Não encontrado");
}
return FrasesPOJO.create(frasesRepository.save(Frases.create(frasesPOJO)));
}
public void Delete (Long id) {
var entity = frasesRepository.findById(id)
.orElseThrow(() -> new ResourceNotFoundException("Não encontrado"));
frasesRepository.delete(entity);
}
}
| UTF-8 | Java | 1,863 | java | FrasesService.java | Java | []
| null | []
| package br.com.frasesInspiracoes.service;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import br.com.frasesInspiracoes.POJO.FrasesPOJO;
import br.com.frasesInspiracoes.entity.Frases;
import br.com.frasesInspiracoes.exception.ResourceNotFoundException;
import br.com.frasesInspiracoes.repository.FrasesRepository;
@Service
public class FrasesService {
private final FrasesRepository frasesRepository;
@Autowired
public FrasesService(FrasesRepository frasesRepository) {
this.frasesRepository = frasesRepository;
}
private FrasesPOJO convertToFrasesPOJO(Frases frases ){
return FrasesPOJO.create(frases);
}
public FrasesPOJO create (FrasesPOJO frasesPOJO) {
FrasesPOJO frasPOJO = FrasesPOJO.create(frasesRepository.save(Frases.create(frasesPOJO)));
return frasPOJO;
}
public Page<FrasesPOJO> findAll(Pageable pageable){
var page = frasesRepository.findAll(pageable);
return page.map(this::convertToFrasesPOJO);
}
public FrasesPOJO findById(Long id) {
var entity = frasesRepository.findById(id)
.orElseThrow(() -> new ResourceNotFoundException("Não a frases com esse ID"));
return FrasesPOJO.create(entity);
}
public FrasesPOJO update(FrasesPOJO frasesPOJO) {
final Optional<Frases> optionalFrases = frasesRepository.findById(frasesPOJO.getId());
if(!optionalFrases.isPresent()) {
new ResourceNotFoundException("Não encontrado");
}
return FrasesPOJO.create(frasesRepository.save(Frases.create(frasesPOJO)));
}
public void Delete (Long id) {
var entity = frasesRepository.findById(id)
.orElseThrow(() -> new ResourceNotFoundException("Não encontrado"));
frasesRepository.delete(entity);
}
}
| 1,863 | 0.784946 | 0.784946 | 62 | 29 | 27.063248 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.532258 | false | false | 4 |
01aaa627e3c87f9a7273dfdf15fb9da266b98aa0 | 20,014,547,650,539 | 796fcceff6d03d704b8d0de987498ab0bdde279f | /cording_test/src/test/n2698_hanoi_top.java | 411b844d7e34231875d73c84972abb2f5837b7c1 | []
| no_license | thdus3009/Coding_Test | https://github.com/thdus3009/Coding_Test | 2d5d9b1ba89d2803d5cde5b2d77737f285b13431 | fb0161d3db496205c0d0b886c17f7f1f9c58d149 | refs/heads/master | 2023-01-04T00:31:30.847000 | 2020-10-29T00:26:39 | 2020-10-29T00:26:39 | 293,898,190 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package test;
import java.util.*;
public class n2698_hanoi_top {
static Scanner sc = new Scanner(System.in);
static int n=0;
static char[] arr = {'A','B','C'};
static int count=0;
public static void main(String[] args) {
n = sc.nextInt();
hanoi(n,0,2); // hanoi(원판갯수,시작위치(arr[0]),마지막위치(arr[2]))
System.out.println(count);
}
public static void hanoi(int n, int start, int finish) {
int mid = 1;
if(n==1) { // 피보나치 수열처럼 1개였을 때의 값을 고정시켜준다.
System.out.println("1 : "+arr[start]+"->"+arr[mid]);
count++;
System.out.println("1 : "+arr[mid]+"->"+arr[finish]);
count++;
return; //함수 종료
}
hanoi(n-1,start,finish);
System.out.println(n+" : "+arr[start]+"->"+arr[mid]);
count++;
hanoi(n-1,finish,start);
System.out.println(n+" : "+arr[mid]+"->"+arr[finish]);
count++;
hanoi(n-1,start,finish);
}
}
| UHC | Java | 922 | java | n2698_hanoi_top.java | Java | []
| null | []
| package test;
import java.util.*;
public class n2698_hanoi_top {
static Scanner sc = new Scanner(System.in);
static int n=0;
static char[] arr = {'A','B','C'};
static int count=0;
public static void main(String[] args) {
n = sc.nextInt();
hanoi(n,0,2); // hanoi(원판갯수,시작위치(arr[0]),마지막위치(arr[2]))
System.out.println(count);
}
public static void hanoi(int n, int start, int finish) {
int mid = 1;
if(n==1) { // 피보나치 수열처럼 1개였을 때의 값을 고정시켜준다.
System.out.println("1 : "+arr[start]+"->"+arr[mid]);
count++;
System.out.println("1 : "+arr[mid]+"->"+arr[finish]);
count++;
return; //함수 종료
}
hanoi(n-1,start,finish);
System.out.println(n+" : "+arr[start]+"->"+arr[mid]);
count++;
hanoi(n-1,finish,start);
System.out.println(n+" : "+arr[mid]+"->"+arr[finish]);
count++;
hanoi(n-1,start,finish);
}
}
| 922 | 0.595745 | 0.574468 | 37 | 21.864864 | 19.558868 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.405406 | false | false | 4 |
56ba5fef948478750e4ffd63f9a250c1dc1a0878 | 33,019,708,639,558 | 0db9402b44fb19a69f337f62faa52a0be876a77f | /msg-service-two/src/main/java/com/kuzyayo/pong/service/channels/PingInputChannel.java | b7b176e2048bef7cbdf97683eec3d7109d434599 | []
| no_license | SvetJul/ping-pong | https://github.com/SvetJul/ping-pong | 4df3a85f14fff9500d550e196f0bb252fe781259 | cfff896b1b40140fbc56308f35b094fa9cded820 | refs/heads/master | 2021-01-01T18:52:33.948000 | 2017-07-27T18:15:25 | 2017-07-27T18:15:25 | 98,457,523 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.kuzyayo.pong.service.channels;
import org.springframework.cloud.stream.annotation.Input;
import org.springframework.messaging.SubscribableChannel;
/**
* Created by Iulia on 27.07.2017.
*/
public interface PingInputChannel {
String PING_CHANNEL = "ping";
@Input(PING_CHANNEL)
SubscribableChannel ping();
}
| UTF-8 | Java | 336 | java | PingInputChannel.java | Java | [
{
"context": ".messaging.SubscribableChannel;\n\n/**\n * Created by Iulia on 27.07.2017.\n */\npublic interface PingInputChan",
"end": 184,
"score": 0.9447658061981201,
"start": 179,
"tag": "USERNAME",
"value": "Iulia"
}
]
| null | []
| package com.kuzyayo.pong.service.channels;
import org.springframework.cloud.stream.annotation.Input;
import org.springframework.messaging.SubscribableChannel;
/**
* Created by Iulia on 27.07.2017.
*/
public interface PingInputChannel {
String PING_CHANNEL = "ping";
@Input(PING_CHANNEL)
SubscribableChannel ping();
}
| 336 | 0.752976 | 0.729167 | 16 | 20 | 20.748493 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.3125 | false | false | 4 |
fdb40d511336b1915ee0ddf41675cb3304598396 | 11,836,929,871,801 | cb1253e54673a28966f662ee9a5e48c0b686b588 | /core/src/com/unicornstudio/lanball/core/GlobalActions.java | f07e30033cb469904b6e3330fb60c93416fb9ed1 | []
| no_license | MateRh/LanBall | https://github.com/MateRh/LanBall | bb25b2a904a223b834fafe66cae79ca089e02bc7 | 55f463f83bf35bee0d795415ec944409c4cf3242 | refs/heads/master | 2022-04-30T18:58:20.922000 | 2022-04-24T11:46:10 | 2022-04-24T11:46:10 | 140,630,748 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.unicornstudio.lanball.core;
import com.badlogic.gdx.Gdx;
import com.github.czyzby.lml.annotation.LmlAction;
import com.github.czyzby.lml.parser.action.ActionContainer;
import com.unicornstudio.lanball.LanBallGame;
import com.unicornstudio.lanball.views.Menu;
public class GlobalActions implements ActionContainer {
@LmlAction("toMenu")
void setViewToMenu() {
((LanBallGame) Gdx.app.getApplicationListener()).setView(Menu.class);
}
}
| UTF-8 | Java | 468 | java | GlobalActions.java | Java | [
{
"context": ";\n\nimport com.badlogic.gdx.Gdx;\nimport com.github.czyzby.lml.annotation.LmlAction;\nimport com.github.czyzb",
"end": 94,
"score": 0.8976783752441406,
"start": 88,
"tag": "USERNAME",
"value": "czyzby"
},
{
"context": "zyzby.lml.annotation.LmlAction;\nimport com.github.czyzby.lml.parser.action.ActionContainer;\nimport com.uni",
"end": 145,
"score": 0.8997501730918884,
"start": 139,
"tag": "USERNAME",
"value": "czyzby"
}
]
| null | []
| package com.unicornstudio.lanball.core;
import com.badlogic.gdx.Gdx;
import com.github.czyzby.lml.annotation.LmlAction;
import com.github.czyzby.lml.parser.action.ActionContainer;
import com.unicornstudio.lanball.LanBallGame;
import com.unicornstudio.lanball.views.Menu;
public class GlobalActions implements ActionContainer {
@LmlAction("toMenu")
void setViewToMenu() {
((LanBallGame) Gdx.app.getApplicationListener()).setView(Menu.class);
}
}
| 468 | 0.779915 | 0.779915 | 15 | 30.200001 | 24.219 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.466667 | false | false | 4 |
3b08273069e4fa82c2a6c48249e8571e637035bd | 11,836,929,868,226 | 4a97bc903876dec522874e507523c991615abe63 | /app/src/main/java/com/gjdev/hugo/gjant/interactor/OrderFormInteractor.java | e9202d1b517a1a7cc20bcb0ed899f06af5ecadba | [
"MIT"
]
| permissive | hag8194/GjAnt | https://github.com/hag8194/GjAnt | 4e09e2ffad0ea40a7d174b397feab5776cbdcd1a | 52f246db9895fc866b380fe1e27354d5a46ea551 | refs/heads/master | 2020-04-02T17:36:40.043000 | 2018-10-25T13:10:07 | 2018-10-25T13:10:07 | 154,664,423 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.gjdev.hugo.gjant.interactor;
public interface OrderFormInteractor extends BaseInteractor {
} | UTF-8 | Java | 106 | java | OrderFormInteractor.java | Java | []
| null | []
| package com.gjdev.hugo.gjant.interactor;
public interface OrderFormInteractor extends BaseInteractor {
} | 106 | 0.839623 | 0.839623 | 5 | 20.4 | 25.460558 | 61 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | false | false | 4 |
28c6091803a5e365c8920fd2a99c9d348d578358 | 15,719,580,351,313 | dd9e3fb46aad6fa16ec3ae16c3e57314a3bca225 | /app/src/main/java/com/example/hoyoung/eyeload/MeetingInfoActivity.java | 2facbc73cb219a4175d9d394c9a1e7b7cb7eb4a3 | []
| no_license | terryaa/Eyeroad | https://github.com/terryaa/Eyeroad | 6684fb227689e71829dade3b87205f9deadce261 | 13aa601481daaece2b118a7dd33f2c3b11a746fd | refs/heads/master | 2020-12-24T06:21:23.446000 | 2016-11-27T13:04:32 | 2016-11-27T13:04:32 | 73,160,535 | 0 | 0 | null | true | 2016-11-08T07:28:04 | 2016-11-08T07:28:04 | 2016-11-08T04:29:08 | 2016-11-08T07:24:53 | 0 | 0 | 0 | 0 | null | null | null | package kr.soen.mypart;
import android.content.Intent;
import android.os.AsyncTask;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
/**
* Created by Jin on 2016-11-5.
*/
public class MeetingInfoActivity extends AppCompatActivity implements View.OnClickListener {
private int key;
MeetingControl control = MeetingControl.getInstance();
public MeetingInfoActivity()
{
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = new Intent(this.getIntent());
String meetingKey = intent.getStringExtra("meetingKey");
key = Integer.valueOf(meetingKey);
control.getMeeting(key);
String ti= control.getMeetingTest().getTitle();
setContentView(R.layout.activity_meeting_info);
findViewById(R.id.meetingInfoDelete).setOnClickListener(this);
TextView textView=(TextView)findViewById(R.id.meetingInfoTextView);
try{ Thread.sleep(2);}catch(Exception e){}
Log.d("TESTING","MeetingInfoActivity getMeeting before");
textView.setText(ti);
}
public void onClick(View v) { // 메뉴의 버튼 선택 시 activity 이동
switch (v.getId()) {
case R.id.meetingInfoDelete:
deleteMeeting();
}
}
public void navigateMeeting()
{
//showMapActivity를 호출하여 길을 안내하면 됨
}
public void deleteMeeting()
{
Toast.makeText(MeetingInfoActivity.this, key + " is deleted.", Toast.LENGTH_SHORT).show();
control.deleteInfo(key);
}
}
| UTF-8 | Java | 1,934 | java | MeetingInfoActivity.java | Java | [
{
"context": "on;\nimport java.net.URLEncoder;\n\n/**\n * Created by Jin on 2016-11-5.\n */\n\npublic class MeetingInfoActivi",
"end": 475,
"score": 0.7161422371864319,
"start": 472,
"tag": "USERNAME",
"value": "Jin"
},
{
"context": "intent.getStringExtra(\"meetingKey\");\n key = Integer.valueOf(meetingKey);\n control.getMeeting(key);\n ",
"end": 980,
"score": 0.7452564835548401,
"start": 965,
"tag": "KEY",
"value": "Integer.valueOf"
}
]
| null | []
| package kr.soen.mypart;
import android.content.Intent;
import android.os.AsyncTask;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
/**
* Created by Jin on 2016-11-5.
*/
public class MeetingInfoActivity extends AppCompatActivity implements View.OnClickListener {
private int key;
MeetingControl control = MeetingControl.getInstance();
public MeetingInfoActivity()
{
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = new Intent(this.getIntent());
String meetingKey = intent.getStringExtra("meetingKey");
key = Integer.valueOf(meetingKey);
control.getMeeting(key);
String ti= control.getMeetingTest().getTitle();
setContentView(R.layout.activity_meeting_info);
findViewById(R.id.meetingInfoDelete).setOnClickListener(this);
TextView textView=(TextView)findViewById(R.id.meetingInfoTextView);
try{ Thread.sleep(2);}catch(Exception e){}
Log.d("TESTING","MeetingInfoActivity getMeeting before");
textView.setText(ti);
}
public void onClick(View v) { // 메뉴의 버튼 선택 시 activity 이동
switch (v.getId()) {
case R.id.meetingInfoDelete:
deleteMeeting();
}
}
public void navigateMeeting()
{
//showMapActivity를 호출하여 길을 안내하면 됨
}
public void deleteMeeting()
{
Toast.makeText(MeetingInfoActivity.this, key + " is deleted.", Toast.LENGTH_SHORT).show();
control.deleteInfo(key);
}
}
| 1,934 | 0.691534 | 0.686772 | 68 | 26.794117 | 24.043808 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.514706 | false | false | 4 |
cb6c7b8c9cfe6081a6fe5890ef0a860bdb6d4752 | 18,339,510,380,463 | 6b74b74960487f4af73fd992f18d4c171032ec3b | /Z-Queen/src/main/java/com/isahl/chess/queen/io/core/net/socket/AioPacket.java | f76c5e1937d6eaa308f71101df8d1c77954c5730 | [
"MIT"
]
| permissive | William-d-zk/Z-Chess | https://github.com/William-d-zk/Z-Chess | 266940045968761b21faa36e3ca5a95d46bb85bb | 6cb2cf7bf5889adb65ebb9d7ee4b9d91615fdcd9 | refs/heads/master | 2023-05-28T09:46:33.301000 | 2022-09-13T13:34:33 | 2022-09-13T13:34:33 | 146,628,374 | 3 | 2 | NOASSERTION | false | 2023-05-23T20:16:13 | 2018-08-29T16:30:53 | 2022-09-13T13:51:40 | 2023-05-23T20:16:12 | 11,410 | 3 | 2 | 4 | Java | false | false | /*
* MIT License
*
* Copyright (c) 2016~2021. Z-Chess
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.isahl.chess.queen.io.core.net.socket;
import com.isahl.chess.board.annotation.ISerialGenerator;
import com.isahl.chess.board.base.ISerial;
import com.isahl.chess.king.base.content.ByteBuf;
import com.isahl.chess.king.base.exception.ZException;
import com.isahl.chess.queen.io.core.features.model.content.IPacket;
import static com.isahl.chess.king.base.content.ByteBuf.vSizeOf;
/**
* @author William.d.zk
*/
@ISerialGenerator(parent = ISerial.IO_QUEEN_PACKET_SERIAL)
public class AioPacket
implements IPacket
{
private Status mStatus = Status.No_Send;
private int mRightIdempotentBit;
private int mLeftIdempotentBit;
private ByteBuf mBuffer;
public AioPacket(int size)
{
mBuffer = ByteBuf.allocate(size);
}
public AioPacket(ByteBuf exist)
{
mBuffer = exist;
}
@Override
public ByteBuf getBuffer()
{
return mBuffer;
}
@Override
public boolean isSending()
{
return mStatus.equals(Status.Sending);
}
@Override
public boolean isSent()
{
return mStatus.equals(Status.Sent);
}
@Override
public IPacket send()
{
mStatus = Status.Sending;
return this;
}
@Override
public IPacket waitSend()
{
mStatus = Status.To_Send;
return this;
}
@Override
public IPacket noSend()
{
mStatus = Status.No_Send;
return this;
}
@Override
public IPacket sent()
{
mStatus = Status.Sent;
return this;
}
@Override
public Status getStatus()
{
return mStatus;
}
@Override
public void setAbandon()
{
mStatus = Status.Abandon;
}
@Override
public int length()
{
return 1 + mBuffer.capacity();
}
@Override
public boolean inIdempotent(int bit)
{
boolean todo = (bit & mRightIdempotentBit) == 0;
mRightIdempotentBit |= bit;
return todo;
}
@Override
public boolean outIdempotent(int bit)
{
boolean todo = (bit & mLeftIdempotentBit) == 0;
mLeftIdempotentBit |= bit;
return todo;
}
@Override
public int prefix(ByteBuf input)
{
int length = input.vLength();
int serial = input.get();
if(serial != serial()) {
throw new ZException("serial[%d vs %d] no expected", serial, serial());
}
return length - 1;
}
@Override
public void fold(ByteBuf input, int remain)
{
if(remain > 0) {
byte[] array = new byte[remain];
input.get(array);
mBuffer = ByteBuf.wrap(array);
}
}
@Override
public int sizeOf()
{
return vSizeOf(length());
}
@Override
public ByteBuf suffix(ByteBuf output)
{
return output.vPutLength(length())
.put(serial())
.put(payload());
}
@Override
public byte[] payload()
{
if(mBuffer.readerIdx() == 0 && mBuffer.writerIdx() == mBuffer.capacity()) {
return mBuffer.array();
}
else {
return mBuffer.peekAll();
}
}
}
| UTF-8 | Java | 4,371 | java | AioPacket.java | Java | [
{
"context": "king.base.content.ByteBuf.vSizeOf;\n\n/**\n * @author William.d.zk\n */\n@ISerialGenerator(parent = ISerial.IO_QUEEN_P",
"end": 1554,
"score": 0.9995120167732239,
"start": 1542,
"tag": "NAME",
"value": "William.d.zk"
}
]
| null | []
| /*
* MIT License
*
* Copyright (c) 2016~2021. Z-Chess
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.isahl.chess.queen.io.core.net.socket;
import com.isahl.chess.board.annotation.ISerialGenerator;
import com.isahl.chess.board.base.ISerial;
import com.isahl.chess.king.base.content.ByteBuf;
import com.isahl.chess.king.base.exception.ZException;
import com.isahl.chess.queen.io.core.features.model.content.IPacket;
import static com.isahl.chess.king.base.content.ByteBuf.vSizeOf;
/**
* @author William.d.zk
*/
@ISerialGenerator(parent = ISerial.IO_QUEEN_PACKET_SERIAL)
public class AioPacket
implements IPacket
{
private Status mStatus = Status.No_Send;
private int mRightIdempotentBit;
private int mLeftIdempotentBit;
private ByteBuf mBuffer;
public AioPacket(int size)
{
mBuffer = ByteBuf.allocate(size);
}
public AioPacket(ByteBuf exist)
{
mBuffer = exist;
}
@Override
public ByteBuf getBuffer()
{
return mBuffer;
}
@Override
public boolean isSending()
{
return mStatus.equals(Status.Sending);
}
@Override
public boolean isSent()
{
return mStatus.equals(Status.Sent);
}
@Override
public IPacket send()
{
mStatus = Status.Sending;
return this;
}
@Override
public IPacket waitSend()
{
mStatus = Status.To_Send;
return this;
}
@Override
public IPacket noSend()
{
mStatus = Status.No_Send;
return this;
}
@Override
public IPacket sent()
{
mStatus = Status.Sent;
return this;
}
@Override
public Status getStatus()
{
return mStatus;
}
@Override
public void setAbandon()
{
mStatus = Status.Abandon;
}
@Override
public int length()
{
return 1 + mBuffer.capacity();
}
@Override
public boolean inIdempotent(int bit)
{
boolean todo = (bit & mRightIdempotentBit) == 0;
mRightIdempotentBit |= bit;
return todo;
}
@Override
public boolean outIdempotent(int bit)
{
boolean todo = (bit & mLeftIdempotentBit) == 0;
mLeftIdempotentBit |= bit;
return todo;
}
@Override
public int prefix(ByteBuf input)
{
int length = input.vLength();
int serial = input.get();
if(serial != serial()) {
throw new ZException("serial[%d vs %d] no expected", serial, serial());
}
return length - 1;
}
@Override
public void fold(ByteBuf input, int remain)
{
if(remain > 0) {
byte[] array = new byte[remain];
input.get(array);
mBuffer = ByteBuf.wrap(array);
}
}
@Override
public int sizeOf()
{
return vSizeOf(length());
}
@Override
public ByteBuf suffix(ByteBuf output)
{
return output.vPutLength(length())
.put(serial())
.put(payload());
}
@Override
public byte[] payload()
{
if(mBuffer.readerIdx() == 0 && mBuffer.writerIdx() == mBuffer.capacity()) {
return mBuffer.array();
}
else {
return mBuffer.peekAll();
}
}
}
| 4,371 | 0.620682 | 0.617479 | 181 | 23.149172 | 23.231833 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.392265 | false | false | 4 |
f1521459b39cdf49fa9db0ae773f68efb02eb3ea | 24,498,493,512,657 | 9ff7f266250e0b9ab7a8809f85747a6eebc0ba83 | /View/Code/src/main/java/com/view/resource/dao/ResourceManagerRoleDao.java | e1d0a207ea38e03ebf2fc1b8a5bcac8b14834cb2 | []
| no_license | Ravi-Rsankar/GitRepo | https://github.com/Ravi-Rsankar/GitRepo | ade1d5b350dd25be23d214f68449575dbb83375f | 72db5a44630802ed271780ad6f99612242eb04a1 | refs/heads/master | 2017-11-02T08:16:16.356000 | 2017-08-09T10:06:36 | 2017-08-09T10:06:36 | 64,459,314 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.view.resource.dao;
import java.util.List;
import com.view.resource.exceptions.DuplicateRoleException;
import com.view.resource.exceptions.RoleNotFoundException;
public interface ResourceManagerRoleDao {
public boolean addRoleInfo(String roleId, int rolePriority, String roleProfile, String realmName)throws DuplicateRoleException;
public String getRoleInfo(String roleId, String realm) throws RoleNotFoundException;
public boolean updateRoleInfo(String roleId, int rolePosition, String roleProfile, String realmName) throws RoleNotFoundException;
public boolean deleteRoleInfo(String roleId, String realmName) throws RoleNotFoundException;
public String getAllRoles(String realm);
public List<String> getRoles(String role, String realm);
public int getRolePriority(String roleId, String realm) throws RoleNotFoundException;
}
| UTF-8 | Java | 851 | java | ResourceManagerRoleDao.java | Java | []
| null | []
| package com.view.resource.dao;
import java.util.List;
import com.view.resource.exceptions.DuplicateRoleException;
import com.view.resource.exceptions.RoleNotFoundException;
public interface ResourceManagerRoleDao {
public boolean addRoleInfo(String roleId, int rolePriority, String roleProfile, String realmName)throws DuplicateRoleException;
public String getRoleInfo(String roleId, String realm) throws RoleNotFoundException;
public boolean updateRoleInfo(String roleId, int rolePosition, String roleProfile, String realmName) throws RoleNotFoundException;
public boolean deleteRoleInfo(String roleId, String realmName) throws RoleNotFoundException;
public String getAllRoles(String realm);
public List<String> getRoles(String role, String realm);
public int getRolePriority(String roleId, String realm) throws RoleNotFoundException;
}
| 851 | 0.841363 | 0.841363 | 18 | 46.277779 | 42.887199 | 131 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.611111 | false | false | 4 |
47854f4e905f87124421b6532852a73e3fd2f32f | 1,159,641,200,343 | 79595075622ded0bf43023f716389f61d8e96e94 | /app/src/main/java/com/android/server/wifi/hotspot2/DomainMatcher.java | 40e39c060f05bcf840b65eb8c11c8e380bb654de | []
| no_license | dstmath/OppoR15 | https://github.com/dstmath/OppoR15 | 96f1f7bb4d9cfad47609316debc55095edcd6b56 | b9a4da845af251213d7b4c1b35db3e2415290c96 | refs/heads/master | 2020-03-24T16:52:14.198000 | 2019-05-27T02:24:53 | 2019-05-27T02:24:53 | 142,840,716 | 7 | 4 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.android.server.wifi.hotspot2;
import android.text.TextUtils;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
public class DomainMatcher {
public static final int MATCH_NONE = 0;
public static final int MATCH_PRIMARY = 1;
public static final int MATCH_SECONDARY = 2;
private final Label mRoot = new Label(0);
private static class Label {
private int mMatch;
private final Map<String, Label> mSubDomains = new HashMap();
Label(int match) {
this.mMatch = match;
}
public void addDomain(Iterator<String> labels, int match) {
String labelName = (String) labels.next();
Label subLabel = (Label) this.mSubDomains.get(labelName);
if (subLabel == null) {
subLabel = new Label(0);
this.mSubDomains.put(labelName, subLabel);
}
if (labels.hasNext()) {
subLabel.addDomain(labels, match);
} else {
subLabel.mMatch = match;
}
}
public Label getSubLabel(String labelString) {
return (Label) this.mSubDomains.get(labelString);
}
public int getMatch() {
return this.mMatch;
}
private void toString(StringBuilder sb) {
if (this.mSubDomains != null) {
sb.append(".{");
for (Entry<String, Label> entry : this.mSubDomains.entrySet()) {
sb.append((String) entry.getKey());
((Label) entry.getValue()).toString(sb);
}
sb.append('}');
return;
}
sb.append('=').append(this.mMatch);
}
public String toString() {
StringBuilder sb = new StringBuilder();
toString(sb);
return sb.toString();
}
}
public DomainMatcher(String primaryDomain, List<String> secondaryDomains) {
if (secondaryDomains != null) {
for (String domain : secondaryDomains) {
if (!TextUtils.isEmpty(domain)) {
this.mRoot.addDomain(Utils.splitDomain(domain).iterator(), 2);
}
}
}
if (!TextUtils.isEmpty(primaryDomain)) {
this.mRoot.addDomain(Utils.splitDomain(primaryDomain).iterator(), 1);
}
}
public int isSubDomain(String domainName) {
if (TextUtils.isEmpty(domainName)) {
return 0;
}
List<String> domainLabels = Utils.splitDomain(domainName);
Label label = this.mRoot;
int match = 0;
for (String labelString : domainLabels) {
label = label.getSubLabel(labelString);
if (label == null) {
break;
} else if (label.getMatch() != 0) {
match = label.getMatch();
if (match == 1) {
break;
}
}
}
return match;
}
public static boolean arg2SubdomainOfArg1(String domain1, String domain2) {
if (TextUtils.isEmpty(domain1) || TextUtils.isEmpty(domain2)) {
return false;
}
List<String> labels1 = Utils.splitDomain(domain1);
List<String> labels2 = Utils.splitDomain(domain2);
if (labels2.size() < labels1.size()) {
return false;
}
Iterator<String> l2 = labels2.iterator();
for (CharSequence equals : labels1) {
if (!TextUtils.equals(equals, (CharSequence) l2.next())) {
return false;
}
}
return true;
}
public String toString() {
return "Domain matcher " + this.mRoot;
}
}
| UTF-8 | Java | 3,825 | java | DomainMatcher.java | Java | []
| null | []
| package com.android.server.wifi.hotspot2;
import android.text.TextUtils;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
public class DomainMatcher {
public static final int MATCH_NONE = 0;
public static final int MATCH_PRIMARY = 1;
public static final int MATCH_SECONDARY = 2;
private final Label mRoot = new Label(0);
private static class Label {
private int mMatch;
private final Map<String, Label> mSubDomains = new HashMap();
Label(int match) {
this.mMatch = match;
}
public void addDomain(Iterator<String> labels, int match) {
String labelName = (String) labels.next();
Label subLabel = (Label) this.mSubDomains.get(labelName);
if (subLabel == null) {
subLabel = new Label(0);
this.mSubDomains.put(labelName, subLabel);
}
if (labels.hasNext()) {
subLabel.addDomain(labels, match);
} else {
subLabel.mMatch = match;
}
}
public Label getSubLabel(String labelString) {
return (Label) this.mSubDomains.get(labelString);
}
public int getMatch() {
return this.mMatch;
}
private void toString(StringBuilder sb) {
if (this.mSubDomains != null) {
sb.append(".{");
for (Entry<String, Label> entry : this.mSubDomains.entrySet()) {
sb.append((String) entry.getKey());
((Label) entry.getValue()).toString(sb);
}
sb.append('}');
return;
}
sb.append('=').append(this.mMatch);
}
public String toString() {
StringBuilder sb = new StringBuilder();
toString(sb);
return sb.toString();
}
}
public DomainMatcher(String primaryDomain, List<String> secondaryDomains) {
if (secondaryDomains != null) {
for (String domain : secondaryDomains) {
if (!TextUtils.isEmpty(domain)) {
this.mRoot.addDomain(Utils.splitDomain(domain).iterator(), 2);
}
}
}
if (!TextUtils.isEmpty(primaryDomain)) {
this.mRoot.addDomain(Utils.splitDomain(primaryDomain).iterator(), 1);
}
}
public int isSubDomain(String domainName) {
if (TextUtils.isEmpty(domainName)) {
return 0;
}
List<String> domainLabels = Utils.splitDomain(domainName);
Label label = this.mRoot;
int match = 0;
for (String labelString : domainLabels) {
label = label.getSubLabel(labelString);
if (label == null) {
break;
} else if (label.getMatch() != 0) {
match = label.getMatch();
if (match == 1) {
break;
}
}
}
return match;
}
public static boolean arg2SubdomainOfArg1(String domain1, String domain2) {
if (TextUtils.isEmpty(domain1) || TextUtils.isEmpty(domain2)) {
return false;
}
List<String> labels1 = Utils.splitDomain(domain1);
List<String> labels2 = Utils.splitDomain(domain2);
if (labels2.size() < labels1.size()) {
return false;
}
Iterator<String> l2 = labels2.iterator();
for (CharSequence equals : labels1) {
if (!TextUtils.equals(equals, (CharSequence) l2.next())) {
return false;
}
}
return true;
}
public String toString() {
return "Domain matcher " + this.mRoot;
}
}
| 3,825 | 0.534902 | 0.527582 | 121 | 30.61157 | 22.109184 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.512397 | false | false | 4 |
5e6f761b71f0c229e9e82cb6815bfcffc8915add | 1,159,641,200,788 | 4798392958bfea53b23f322b3d6079b943a528ba | /app/src/main/java/com/holidayme/adapter/FilterThemeAdapter.java | 414c02cb097859e1b20c0a52f312fc6cd1ab409a | []
| no_license | devrath123/HolidayMe | https://github.com/devrath123/HolidayMe | 04923998d3e5014de9fc9596e14cc4acfe8172ae | 2c1e1aa2c2ba94ff23568dc000cfc7aeb44ba8e9 | refs/heads/master | 2020-12-02T17:46:47.697000 | 2017-07-06T13:00:43 | 2017-07-06T13:00:43 | 96,424,902 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.holidayme.adapter;
/**
* Created by supriya.sakore on 31-08-2015.
*/
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.os.Message;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.holidayme.Constants.Constant;
import com.holidayme.activities.R;
import com.holidayme.data.CatDto;
import com.holidayme.fragments.FilterFragment;
import java.util.ArrayList;
public class FilterThemeAdapter extends RecyclerView.Adapter< FilterThemeAdapter.ViewHolder> {
private ArrayList<CatDto> themeArrayList;
public FilterThemeAdapter(ArrayList<CatDto>themeArrayList) {
this.themeArrayList = themeArrayList;
}
// Create new views
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View itemLayoutView = LayoutInflater.from(parent.getContext()).inflate(
R.layout.item_list_filter_row, null);
ViewHolder viewHolder = new ViewHolder(itemLayoutView);
return viewHolder;
}
@SuppressLint("SetTextI18n")
@Override
public void onBindViewHolder(final ViewHolder viewHolder, final int position) {
viewHolder.themeTitleTextView.setText(themeArrayList.get(position).getTtl());
viewHolder.themeCountTextView.setText("("+ themeArrayList.get(position).getCnt()+")");
viewHolder.themeCheckBox.setChecked(themeArrayList.get(position).isCheck());
viewHolder.themeCheckBox.setChecked(themeArrayList.get(position).isCheck());
viewHolder.themeCheckBox.setTag(position);
viewHolder.themeRelativeLayout.setTag(position);
viewHolder.themeRelativeLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Constant.filterFlag=true;
boolean themeCheck = false;
int pos = (Integer) v.getTag();
if (themeArrayList.get(pos).isCheck()) {
themeArrayList.get(pos).setCheck(false);
} else {
themeArrayList.get(pos).setCheck(true);
}
for (int i = 0; i < themeArrayList.size(); i++) {
if (themeArrayList.get(i).isCheck()) {
themeCheck = true;
break;
}
}
Message message = new Message();
Bundle bundle = new Bundle();
bundle.putInt(Constant.FILTER_TYPE, 4);
bundle.putBoolean("ISCHECK", themeCheck);
bundle.putParcelableArrayList("FilterThem", themeArrayList);
message.setData(bundle);
FilterFragment.filterUpdate.sendMessage(message);
viewHolder.themeCheckBox.setChecked(themeArrayList.get(pos).isCheck());
}
});
}
// Return the size arrayList
@Override
public int getItemCount() {
return themeArrayList.size();
}
public static class ViewHolder extends RecyclerView.ViewHolder {
private TextView themeTitleTextView,themeCountTextView;
private CheckBox themeCheckBox;
private RelativeLayout themeRelativeLayout;
public ViewHolder(View itemLayoutView) {
super(itemLayoutView);
themeTitleTextView=(TextView) itemLayoutView.findViewById(R.id.hotelTitleTextView);
themeCheckBox=(CheckBox) itemLayoutView.findViewById(R.id.filterCheckBox);
themeCountTextView=(TextView) itemLayoutView.findViewById(R.id.filterCountTextView);
themeRelativeLayout=(RelativeLayout)itemLayoutView.findViewById(R.id.locationRelativeLayout);
}
}
}
| UTF-8 | Java | 3,911 | java | FilterThemeAdapter.java | Java | [
{
"context": "package com.holidayme.adapter;\n\n/**\n * Created by supriya.sakore on 31-08-2015.\n */\n\nimport android.ann",
"end": 53,
"score": 0.891106367111206,
"start": 50,
"tag": "NAME",
"value": "sup"
},
{
"context": "kage com.holidayme.adapter;\n\n/**\n * Created by supriya.sakore on 31-08-2015.\n */\n\nimport android.annotation.Sup",
"end": 64,
"score": 0.7418118715286255,
"start": 53,
"tag": "USERNAME",
"value": "riya.sakore"
}
]
| null | []
| package com.holidayme.adapter;
/**
* Created by supriya.sakore on 31-08-2015.
*/
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.os.Message;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.holidayme.Constants.Constant;
import com.holidayme.activities.R;
import com.holidayme.data.CatDto;
import com.holidayme.fragments.FilterFragment;
import java.util.ArrayList;
public class FilterThemeAdapter extends RecyclerView.Adapter< FilterThemeAdapter.ViewHolder> {
private ArrayList<CatDto> themeArrayList;
public FilterThemeAdapter(ArrayList<CatDto>themeArrayList) {
this.themeArrayList = themeArrayList;
}
// Create new views
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View itemLayoutView = LayoutInflater.from(parent.getContext()).inflate(
R.layout.item_list_filter_row, null);
ViewHolder viewHolder = new ViewHolder(itemLayoutView);
return viewHolder;
}
@SuppressLint("SetTextI18n")
@Override
public void onBindViewHolder(final ViewHolder viewHolder, final int position) {
viewHolder.themeTitleTextView.setText(themeArrayList.get(position).getTtl());
viewHolder.themeCountTextView.setText("("+ themeArrayList.get(position).getCnt()+")");
viewHolder.themeCheckBox.setChecked(themeArrayList.get(position).isCheck());
viewHolder.themeCheckBox.setChecked(themeArrayList.get(position).isCheck());
viewHolder.themeCheckBox.setTag(position);
viewHolder.themeRelativeLayout.setTag(position);
viewHolder.themeRelativeLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Constant.filterFlag=true;
boolean themeCheck = false;
int pos = (Integer) v.getTag();
if (themeArrayList.get(pos).isCheck()) {
themeArrayList.get(pos).setCheck(false);
} else {
themeArrayList.get(pos).setCheck(true);
}
for (int i = 0; i < themeArrayList.size(); i++) {
if (themeArrayList.get(i).isCheck()) {
themeCheck = true;
break;
}
}
Message message = new Message();
Bundle bundle = new Bundle();
bundle.putInt(Constant.FILTER_TYPE, 4);
bundle.putBoolean("ISCHECK", themeCheck);
bundle.putParcelableArrayList("FilterThem", themeArrayList);
message.setData(bundle);
FilterFragment.filterUpdate.sendMessage(message);
viewHolder.themeCheckBox.setChecked(themeArrayList.get(pos).isCheck());
}
});
}
// Return the size arrayList
@Override
public int getItemCount() {
return themeArrayList.size();
}
public static class ViewHolder extends RecyclerView.ViewHolder {
private TextView themeTitleTextView,themeCountTextView;
private CheckBox themeCheckBox;
private RelativeLayout themeRelativeLayout;
public ViewHolder(View itemLayoutView) {
super(itemLayoutView);
themeTitleTextView=(TextView) itemLayoutView.findViewById(R.id.hotelTitleTextView);
themeCheckBox=(CheckBox) itemLayoutView.findViewById(R.id.filterCheckBox);
themeCountTextView=(TextView) itemLayoutView.findViewById(R.id.filterCountTextView);
themeRelativeLayout=(RelativeLayout)itemLayoutView.findViewById(R.id.locationRelativeLayout);
}
}
}
| 3,911 | 0.66249 | 0.659166 | 108 | 35.212963 | 29.082275 | 105 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.564815 | false | false | 4 |
0075fb0f422e2b84d1fb59949f84c23530f78c5b | 137,438,996,966 | e142730ea003f8e83301ca97c51f0cd4b468b500 | /LinkedListVsArrayList.java | bb53f91b082a37281e38b5f9ca62de7937ce96a3 | []
| no_license | flippantgriffin/HomeWork4 | https://github.com/flippantgriffin/HomeWork4 | 37d1bdc9511c08be9402c4319115ae2999a74438 | 59ba79b95abcb1de31f53bae7a5496b13b279f7b | refs/heads/master | 2022-12-28T10:27:20.993000 | 2020-10-02T23:16:36 | 2020-10-02T23:16:36 | 265,981,772 | 0 | 2 | null | false | 2020-10-02T23:16:37 | 2020-05-22T00:31:18 | 2020-05-22T00:33:25 | 2020-10-02T23:16:36 | 2 | 0 | 2 | 0 | null | false | false | package jPractice;
import org.testng.annotations.Test;
import java.util.ArrayList;
import java.util.LinkedList;
public class LinkedListVsArrayList {
@Test
public void checkArrayList(){
ArrayList<Integer> link=new ArrayList<>();
long startTime=System.currentTimeMillis();
for(int i=0;i<=1000000;i++){
link.add(i);
}
long endTime=System.currentTimeMillis();
System.out.println(endTime-startTime);
System.out.println(link.size());
}
@Test
public void checkLinkedList(){
LinkedList<Integer> link=new LinkedList<Integer>();
long startTime=System.currentTimeMillis();
for(int i=0;i<=1000000000;i++){
link.add(i);
}
long endTime=System.currentTimeMillis();
System.out.println(endTime-startTime);
System.out.println(link.size());
}
}
| UTF-8 | Java | 922 | java | LinkedListVsArrayList.java | Java | []
| null | []
| package jPractice;
import org.testng.annotations.Test;
import java.util.ArrayList;
import java.util.LinkedList;
public class LinkedListVsArrayList {
@Test
public void checkArrayList(){
ArrayList<Integer> link=new ArrayList<>();
long startTime=System.currentTimeMillis();
for(int i=0;i<=1000000;i++){
link.add(i);
}
long endTime=System.currentTimeMillis();
System.out.println(endTime-startTime);
System.out.println(link.size());
}
@Test
public void checkLinkedList(){
LinkedList<Integer> link=new LinkedList<Integer>();
long startTime=System.currentTimeMillis();
for(int i=0;i<=1000000000;i++){
link.add(i);
}
long endTime=System.currentTimeMillis();
System.out.println(endTime-startTime);
System.out.println(link.size());
}
}
| 922 | 0.607375 | 0.586768 | 32 | 26.8125 | 18.509182 | 59 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.625 | false | false | 4 |
06f62d4616f89a5adc4a42019b034d4de021aa71 | 2,972,117,425,125 | 4fa467f123575e7b212cba3138189a60b7c08d5c | /jebnf-core/src/main/java/de/weltraumschaf/jebnf/gfx/shapes/Shape.java | 7488a4e5e97898b9c377e8a5e6cd70b321675b9e | [
"Beerware"
]
| permissive | Weltraumschaf/jebnf | https://github.com/Weltraumschaf/jebnf | decdd015e72cb195593687ca9703ef3323dc61c2 | 112a1192b6de79f7bc6f8c44ea34609d5e086cd4 | refs/heads/master | 2021-03-12T20:00:23.055000 | 2014-03-29T11:42:20 | 2014-03-29T11:42:20 | 4,826,801 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* LICENSE
*
* "THE BEER-WARE LICENSE" (Revision 43):
* "Sven Strittmatter" <weltraumschaf(at)googlemail(dot)com> wrote this file.
* As long as you retain this notice you can do whatever you want with
* this stuff. If we meet some day, and you think this stuff is worth it,
* you can buy me a non alcohol free beer in return.
*
* Copyright (C) 2012 "Sven Strittmatter" <weltraumschaf(at)googlemail(dot)com>
*/
package de.weltraumschaf.jebnf.gfx.shapes;
import de.weltraumschaf.jebnf.gfx.Point;
import de.weltraumschaf.jebnf.gfx.Size;
/**
* Defines the interface for railroad shapes.
*
* @author Sven Strittmatter <weltraumschaf@googlemail.com>
*/
public interface Shape extends Paintable {
/**
* Returns the position of the shape.
*
* @return Position object.
*/
Point getPosition();
/**
* Sets the shapes position.
*
* @param pos The position the shape is painted.
*/
void setPosition(Point pos);
/**
* Returns the size of the shape.
*
* @return The shapes size.
*/
Size getSize();
/**
* Sets the size of the shape.
*
* @param size NEw size.
*/
void setSize(Size size);
/**
* Enables/disable debug paintings.
*
* By default debugging should be off. Debug painting means that the shape paints some
* additional helper pixels for debugging.
*
* @param onnOff Whether to set debug painting on or off.
*/
void setDebug(boolean onnOff);
}
| UTF-8 | Java | 1,514 | java | Shape.java | Java | [
{
"context": "\n *\n * \"THE BEER-WARE LICENSE\" (Revision 43):\n * \"Sven Strittmatter\" <weltraumschaf(at)googlemail(dot)com> wrote this",
"end": 80,
"score": 0.9999006390571594,
"start": 63,
"tag": "NAME",
"value": "Sven Strittmatter"
},
{
"context": "ol free beer in return.\n *\n * Copyright (C) 2012 \"Sven Strittmatter\" <weltraumschaf(at)googlemail(dot)com>\n */\npackag",
"end": 378,
"score": 0.9999042749404907,
"start": 361,
"tag": "NAME",
"value": "Sven Strittmatter"
},
{
"context": "s the interface for railroad shapes.\n *\n * @author Sven Strittmatter <weltraumschaf@googlemail.com>\n */\npublic interfa",
"end": 629,
"score": 0.9999037981033325,
"start": 612,
"tag": "NAME",
"value": "Sven Strittmatter"
},
{
"context": "railroad shapes.\n *\n * @author Sven Strittmatter <weltraumschaf@googlemail.com>\n */\npublic interface Shape extends Paintable {\n\n",
"end": 659,
"score": 0.9999321103096008,
"start": 631,
"tag": "EMAIL",
"value": "weltraumschaf@googlemail.com"
}
]
| null | []
| /*
* LICENSE
*
* "THE BEER-WARE LICENSE" (Revision 43):
* "<NAME>" <weltraumschaf(at)googlemail(dot)com> wrote this file.
* As long as you retain this notice you can do whatever you want with
* this stuff. If we meet some day, and you think this stuff is worth it,
* you can buy me a non alcohol free beer in return.
*
* Copyright (C) 2012 "<NAME>" <weltraumschaf(at)googlemail(dot)com>
*/
package de.weltraumschaf.jebnf.gfx.shapes;
import de.weltraumschaf.jebnf.gfx.Point;
import de.weltraumschaf.jebnf.gfx.Size;
/**
* Defines the interface for railroad shapes.
*
* @author <NAME> <<EMAIL>>
*/
public interface Shape extends Paintable {
/**
* Returns the position of the shape.
*
* @return Position object.
*/
Point getPosition();
/**
* Sets the shapes position.
*
* @param pos The position the shape is painted.
*/
void setPosition(Point pos);
/**
* Returns the size of the shape.
*
* @return The shapes size.
*/
Size getSize();
/**
* Sets the size of the shape.
*
* @param size NEw size.
*/
void setSize(Size size);
/**
* Enables/disable debug paintings.
*
* By default debugging should be off. Debug painting means that the shape paints some
* additional helper pixels for debugging.
*
* @param onnOff Whether to set debug painting on or off.
*/
void setDebug(boolean onnOff);
}
| 1,460 | 0.64531 | 0.641347 | 62 | 23.419355 | 24.023878 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.16129 | false | false | 4 |
d32c98cf3ff15eb5fb7ec8cdd71b3201e38a049c | 19,980,187,912,347 | e29a1a1c6d5d4a6adc4c914f1b7cd5414510b012 | /RefDroid/src/main/java/com/arbixal/refphone/GameTimeDialogFragment.java | 1cab00428575eeb4852b9cec85c5fecb6d2f3787 | []
| no_license | Arbixal/RefDroid | https://github.com/Arbixal/RefDroid | b4f352b5bd5101dcca8419bd95aa69d2431effb5 | 33b5bc55246de6caf1cd173a724826d04d88d61c | refs/heads/master | 2021-01-10T19:44:52.226000 | 2013-09-20T14:42:31 | 2013-09-20T14:42:31 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.arbixal.refphone;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.NumberPicker;
/**
* Created by Caleb on 16/09/13.
*/
public class GameTimeDialogFragment extends DialogFragment
{
public enum TimeType
{
GameTime,
ExtraTime
};
public interface GameTimeDialogListener
{
public void onDialogPositiveClick(int pTime, TimeType pTimeType);
}
GameTimeDialogListener mListener;
NumberPicker npGameTime;
TimeType mTimeType;
int mDefaultValue;
GameTimeDialogFragment(TimeType pTimeType, int pDefault)
{
this.mTimeType = pTimeType;
this.mDefaultValue = pDefault;
}
@Override
public void onAttach(Activity pActivity)
{
super.onAttach(pActivity);
try
{
this.mListener = (GameTimeDialogListener) pActivity;
}
catch (ClassCastException ex)
{
throw new ClassCastException(pActivity.toString() + " must implement GameTimeDialogListener");
}
}
@Override
public Dialog onCreateDialog(Bundle pSavedInstanceState)
{
AlertDialog.Builder builder = new AlertDialog.Builder(this.getActivity());
if (this.mTimeType == TimeType.GameTime)
{
builder.setTitle("Period Time");
builder.setMessage("Set length of regular half:");
}
else
{
builder.setTitle("Extra Time");
builder.setMessage("Set length of extra time:");
}
LayoutInflater inflater = this.getActivity().getLayoutInflater();
View dialogView = inflater.inflate(R.layout.dialog_gametime, null);
builder.setView(dialogView);
this.npGameTime = (NumberPicker)dialogView.findViewById(R.id.npTimePicker);
this.npGameTime.setMaxValue(59);
this.npGameTime.setMinValue(1);
this.npGameTime.setWrapSelectorWheel(false);
this.npGameTime.setValue(this.mDefaultValue);
String[] displayValues = new String[59];
for(int i = 1; i <= 59; ++i) displayValues[i-1] = String.format("%d mins", i);
this.npGameTime.setDisplayedValues(displayValues);
builder.setPositiveButton("Set", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i)
{
mListener.onDialogPositiveClick(GameTimeDialogFragment.this.npGameTime.getValue(), GameTimeDialogFragment.this.mTimeType);
}
});
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i)
{
GameTimeDialogFragment.this.getDialog().cancel();
}
});
return (builder.create());
}
}
| UTF-8 | Java | 3,036 | java | GameTimeDialogFragment.java | Java | [
{
"context": "rt android.widget.NumberPicker;\n\n/**\n * Created by Caleb on 16/09/13.\n */\npublic class GameTimeDialogFragm",
"end": 342,
"score": 0.990492045879364,
"start": 337,
"tag": "USERNAME",
"value": "Caleb"
}
]
| null | []
| package com.arbixal.refphone;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.NumberPicker;
/**
* Created by Caleb on 16/09/13.
*/
public class GameTimeDialogFragment extends DialogFragment
{
public enum TimeType
{
GameTime,
ExtraTime
};
public interface GameTimeDialogListener
{
public void onDialogPositiveClick(int pTime, TimeType pTimeType);
}
GameTimeDialogListener mListener;
NumberPicker npGameTime;
TimeType mTimeType;
int mDefaultValue;
GameTimeDialogFragment(TimeType pTimeType, int pDefault)
{
this.mTimeType = pTimeType;
this.mDefaultValue = pDefault;
}
@Override
public void onAttach(Activity pActivity)
{
super.onAttach(pActivity);
try
{
this.mListener = (GameTimeDialogListener) pActivity;
}
catch (ClassCastException ex)
{
throw new ClassCastException(pActivity.toString() + " must implement GameTimeDialogListener");
}
}
@Override
public Dialog onCreateDialog(Bundle pSavedInstanceState)
{
AlertDialog.Builder builder = new AlertDialog.Builder(this.getActivity());
if (this.mTimeType == TimeType.GameTime)
{
builder.setTitle("Period Time");
builder.setMessage("Set length of regular half:");
}
else
{
builder.setTitle("Extra Time");
builder.setMessage("Set length of extra time:");
}
LayoutInflater inflater = this.getActivity().getLayoutInflater();
View dialogView = inflater.inflate(R.layout.dialog_gametime, null);
builder.setView(dialogView);
this.npGameTime = (NumberPicker)dialogView.findViewById(R.id.npTimePicker);
this.npGameTime.setMaxValue(59);
this.npGameTime.setMinValue(1);
this.npGameTime.setWrapSelectorWheel(false);
this.npGameTime.setValue(this.mDefaultValue);
String[] displayValues = new String[59];
for(int i = 1; i <= 59; ++i) displayValues[i-1] = String.format("%d mins", i);
this.npGameTime.setDisplayedValues(displayValues);
builder.setPositiveButton("Set", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i)
{
mListener.onDialogPositiveClick(GameTimeDialogFragment.this.npGameTime.getValue(), GameTimeDialogFragment.this.mTimeType);
}
});
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i)
{
GameTimeDialogFragment.this.getDialog().cancel();
}
});
return (builder.create());
}
}
| 3,036 | 0.660408 | 0.655468 | 101 | 29.059406 | 27.805485 | 138 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.534653 | false | false | 4 |
2577f97441d378690989048b7dfd6fff28451e8e | 9,363,028,747,690 | a34a2a0e51a8829c40669466665ba7b688172eed | /Steps.java | 8e42bc5aeca5de946f827bdc39b8dfe6c7eaf543 | []
| no_license | yogeshn/C--Users-user-Documents-NetBeansProjects-Myexplorations | https://github.com/yogeshn/C--Users-user-Documents-NetBeansProjects-Myexplorations | 8bf3d1ec48b1906d9332ac89b8ee4a215efd1f77 | 60960da5f3addac21fb464524fead80a87833836 | refs/heads/master | 2020-08-03T19:46:24.211000 | 2016-04-14T15:14:49 | 2016-04-14T15:14:49 | 73,537,425 | 1 | 0 | null | true | 2016-11-12T07:04:09 | 2016-11-12T07:04:09 | 2016-04-14T14:56:33 | 2016-04-14T15:23:55 | 13,300 | 0 | 0 | 0 | null | null | null | package Practice;
public class Steps {
public static int dyanamic(int n)
{
int[]ar=new int[n];
ar[0]=1;
ar[1]=2;
ar[2]=ar[0]+ar[1];
ar[3]=ar[1]+ar[2];
if(n<=1)
{
return ar[n-1];
}
for(int i=4;i<n;i++)
{
ar[n-1]=ar[i-1]+ar[i-2]+ar[i-3]+ar[i-4];
}
return ar[n-1];
}
public static int r(int n,int m)
{
if(n==1||n==2)
{
return n ;
}
else
{
System.out.println(n);
} return r(n-1,m)+ r(n-2,m)+r(n-3,m) ;
}
public static void main(String args[])
{
System.out.println(r(4,3));
System.out.println(dyanamic(4));
}
}
| UTF-8 | Java | 722 | java | Steps.java | Java | []
| null | []
| package Practice;
public class Steps {
public static int dyanamic(int n)
{
int[]ar=new int[n];
ar[0]=1;
ar[1]=2;
ar[2]=ar[0]+ar[1];
ar[3]=ar[1]+ar[2];
if(n<=1)
{
return ar[n-1];
}
for(int i=4;i<n;i++)
{
ar[n-1]=ar[i-1]+ar[i-2]+ar[i-3]+ar[i-4];
}
return ar[n-1];
}
public static int r(int n,int m)
{
if(n==1||n==2)
{
return n ;
}
else
{
System.out.println(n);
} return r(n-1,m)+ r(n-2,m)+r(n-3,m) ;
}
public static void main(String args[])
{
System.out.println(r(4,3));
System.out.println(dyanamic(4));
}
}
| 722 | 0.416898 | 0.379501 | 60 | 9.933333 | 11.724428 | 43 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.466667 | false | false | 4 |
f43794fbf068ef05b784605394fa4fb8dcfae928 | 10,256,381,927,601 | 60231321ae07d564d4245ba7182b5ffd455da7a5 | /JavaProgramming/src/ch06/homework04/confirm06/Printer.java | ae16fcbe4304cc4085742f416b5628eca68ee44f | []
| no_license | JeongSemi/TestRepository | https://github.com/JeongSemi/TestRepository | 1fc7b1b86e75adcf72f5584389bde2311b5c647f | 3e16625c5802302f505a507f89bf187265269061 | refs/heads/master | 2021-01-20T00:45:51.856000 | 2017-08-29T05:26:45 | 2017-08-29T05:26:45 | 89,182,167 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ch06.homework04.confirm06;
public class Printer {
static void println(int intValue){
System.out.println(intValue);
}
static void println(boolean booleanValue){
System.out.println(booleanValue);
}
static void println(double doubleValue){
System.out.println(doubleValue);
}
static void println(String stringValue){
System.out.println(stringValue);
}
}
| UTF-8 | Java | 381 | java | Printer.java | Java | []
| null | []
| package ch06.homework04.confirm06;
public class Printer {
static void println(int intValue){
System.out.println(intValue);
}
static void println(boolean booleanValue){
System.out.println(booleanValue);
}
static void println(double doubleValue){
System.out.println(doubleValue);
}
static void println(String stringValue){
System.out.println(stringValue);
}
}
| 381 | 0.750656 | 0.734908 | 19 | 19.052631 | 17.31587 | 43 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.263158 | false | false | 4 |
5eb5a763a707028785b7a22d289588bb9a47fb7b | 22,514,218,567,343 | 4f3e904047fa1b1b03502354dc2e5d9923debe43 | /Task1/src/test/java/tests/Task1.java | a19af7a5533a97806d1f8f9735e57cd4d3b13f35 | []
| no_license | VolhaG/ProjectNext | https://github.com/VolhaG/ProjectNext | 8afc5aa7f886d7fe4a2abc22a091708c6a1e5d4b | 4eaf9210306d96f60d00f882d12f56042d0c426f | refs/heads/master | 2020-05-27T17:48:20.216000 | 2019-06-04T19:52:07 | 2019-06-04T19:52:07 | 188,729,600 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package tests;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
import com.gargoylesoftware.htmlunit.html.HtmlTextInput;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.Assert;
import org.testng.annotations.*;
import tutby.pages.FirstPage;
import tutby.pages.ResultPage;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
public class Task1 {
private static final Logger logger = LogManager.getLogger(Task1.class);
private WebDriver webDriver;
@BeforeTest
@Parameters({"browser"})
public void setupTest(@Optional String browser) {
// System.setProperty("webdriver.chrome.driver", "/Users/Olya/Applications/chromedriver");
// System.setProperty("webdriver.gecko.driver", "/Users/Olya/Applications/geckodriver");
if (browser != null && browser.equals("firefox")) {
webDriver = new FirefoxDriver();
} else {
webDriver = new ChromeDriver();
}
webDriver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
}
@Test(description = "Task 1: to compare results of searching on tut.by with selenium and without")
public void test1() throws Exception {
logger.info("Task 1");
String search2 = getTextSearch2();
String search1 = getTextSearch1();
if (search1.equals(search2)) {
logger.info("Results with found first elements are the same. Result is: "+ search1 );
}
else
{
logger.info("Results with found first elements are different.\n First result is: " + search1 + "\n Second result is: " +search2);
}
// Steps for searching without selenium is realized in opentutby.js in current folder(you need to run 3 steps there on 3 pages consequently with console).
//The results of searching is the same in both cases.
}
private String getTextSearch1() {
/*
1.осуществить переход (используя интерфейс страницы***):
"Компьютеры и сети"->"Комплектующие"->"Видеокарты"
*/
logger.info("1) Implementation with Selenium");
webDriver.get("https://tut.by/");
logger.info("Navigate to tut.by");
FirstPage firstPage = new FirstPage(webDriver);
firstPage.enterWordForSearch("лукашенко");
ResultPage resultPage = firstPage.navigateToResultPage();
String textSearch1 = resultPage.getNameOfFirstResult();
logger.info("First result of searching with selenium: " + textSearch1);
return textSearch1;
}
private String getTextSearch2() throws Exception {
try (final WebClient webClient = new WebClient()) {
final HtmlPage page = webClient.getPage("https://tut.by");
logger.debug(page.getTitleText());
HtmlTextInput textField = (HtmlTextInput) page.getElementById("search_from_str");
textField.type("лукашенко");
HtmlSubmitInput button = page.getElementByName("search");
HtmlPage page2 = button.click();
HtmlElement el = (HtmlElement) page2.getByXPath("//li[@class =\"b-results__li m-market\"]/h3/a/b").get(0);
String foundElement = el.getTextContent();
return foundElement;
}
}
@AfterMethod
public void afterTest() {
webDriver.quit();
}
}
| UTF-8 | Java | 3,772 | java | Task1.java | Java | [
{
"context": "webDriver);\n firstPage.enterWordForSearch(\"лукашенко\");\n\n ResultPage resultPage = firstPage.nav",
"end": 2630,
"score": 0.9967801570892334,
"start": 2621,
"tag": "NAME",
"value": "лукашенко"
},
{
"context": "d(\"search_from_str\");\n textField.type(\"лукашенко\");\n\n HtmlSubmitInput button = page.get",
"end": 3245,
"score": 0.9964483380317688,
"start": 3236,
"tag": "NAME",
"value": "лукашенко"
}
]
| null | []
| package tests;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
import com.gargoylesoftware.htmlunit.html.HtmlTextInput;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.Assert;
import org.testng.annotations.*;
import tutby.pages.FirstPage;
import tutby.pages.ResultPage;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
public class Task1 {
private static final Logger logger = LogManager.getLogger(Task1.class);
private WebDriver webDriver;
@BeforeTest
@Parameters({"browser"})
public void setupTest(@Optional String browser) {
// System.setProperty("webdriver.chrome.driver", "/Users/Olya/Applications/chromedriver");
// System.setProperty("webdriver.gecko.driver", "/Users/Olya/Applications/geckodriver");
if (browser != null && browser.equals("firefox")) {
webDriver = new FirefoxDriver();
} else {
webDriver = new ChromeDriver();
}
webDriver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
}
@Test(description = "Task 1: to compare results of searching on tut.by with selenium and without")
public void test1() throws Exception {
logger.info("Task 1");
String search2 = getTextSearch2();
String search1 = getTextSearch1();
if (search1.equals(search2)) {
logger.info("Results with found first elements are the same. Result is: "+ search1 );
}
else
{
logger.info("Results with found first elements are different.\n First result is: " + search1 + "\n Second result is: " +search2);
}
// Steps for searching without selenium is realized in opentutby.js in current folder(you need to run 3 steps there on 3 pages consequently with console).
//The results of searching is the same in both cases.
}
private String getTextSearch1() {
/*
1.осуществить переход (используя интерфейс страницы***):
"Компьютеры и сети"->"Комплектующие"->"Видеокарты"
*/
logger.info("1) Implementation with Selenium");
webDriver.get("https://tut.by/");
logger.info("Navigate to tut.by");
FirstPage firstPage = new FirstPage(webDriver);
firstPage.enterWordForSearch("лукашенко");
ResultPage resultPage = firstPage.navigateToResultPage();
String textSearch1 = resultPage.getNameOfFirstResult();
logger.info("First result of searching with selenium: " + textSearch1);
return textSearch1;
}
private String getTextSearch2() throws Exception {
try (final WebClient webClient = new WebClient()) {
final HtmlPage page = webClient.getPage("https://tut.by");
logger.debug(page.getTitleText());
HtmlTextInput textField = (HtmlTextInput) page.getElementById("search_from_str");
textField.type("лукашенко");
HtmlSubmitInput button = page.getElementByName("search");
HtmlPage page2 = button.click();
HtmlElement el = (HtmlElement) page2.getByXPath("//li[@class =\"b-results__li m-market\"]/h3/a/b").get(0);
String foundElement = el.getTextContent();
return foundElement;
}
}
@AfterMethod
public void afterTest() {
webDriver.quit();
}
}
| 3,772 | 0.672658 | 0.664488 | 101 | 35.356434 | 32.911999 | 162 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.504951 | false | false | 4 |
736db6146b6e470d38f8065150663cec0ca5cf19 | 32,710,470,977,358 | fee1c352ef70720921030284c827a8c669dfb265 | /src/file_operate/DownloadFile.java | 18d3e6bf4c539e9e1d8d44ec3da0cb3c2a3b6d00 | []
| no_license | crazysheep1992/CloudFile_Operation | https://github.com/crazysheep1992/CloudFile_Operation | 2f85e6f3d3feaf13ee7ae7fa0f4f30c3336e76c1 | 96068ceb97a1e05b1623eaa5402e48fe86538255 | refs/heads/master | 2021-04-26T23:52:31.896000 | 2018-03-05T16:19:05 | 2018-03-05T16:19:05 | 123,872,489 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package file_operate;
import java.io.File;
import com.netease.cloud.services.nos.NosClient;
import com.netease.cloud.services.nos.model.GetObjectRequest;
import com.netease.cloud.services.nos.model.ObjectMetadata;
public class DownloadFile {
public void downloadFile(String destinationFile,String bucketName,String objectName,NosClient nosClient) {
GetObjectRequest getObjectRequest = new GetObjectRequest(bucketName,objectName);
ObjectMetadata objectMetadata = nosClient.getObject(getObjectRequest, new File(destinationFile));
}
}
| UTF-8 | Java | 561 | java | DownloadFile.java | Java | []
| null | []
| package file_operate;
import java.io.File;
import com.netease.cloud.services.nos.NosClient;
import com.netease.cloud.services.nos.model.GetObjectRequest;
import com.netease.cloud.services.nos.model.ObjectMetadata;
public class DownloadFile {
public void downloadFile(String destinationFile,String bucketName,String objectName,NosClient nosClient) {
GetObjectRequest getObjectRequest = new GetObjectRequest(bucketName,objectName);
ObjectMetadata objectMetadata = nosClient.getObject(getObjectRequest, new File(destinationFile));
}
}
| 561 | 0.802139 | 0.802139 | 16 | 33.0625 | 36.715916 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.25 | false | false | 4 |
0b2deb5f7f4b06cd0d1ddc5d2b3116160b1c4dee | 14,585,708,958,273 | 9dde00bafda43b1af9e7dbd8a74f2f2b8811140e | /src/main/java/com/zhi/hibernate/main/HibernateTest1.java | 1e46ce3bafebbc38aea1877dabb7d2c7245aebcd | []
| no_license | ZhiLiGod/Hibernate | https://github.com/ZhiLiGod/Hibernate | 879e850e8ab637c0ebbce1e345dd1561bc6acb44 | e5b86623bf42e7db6afbb41e1e7bc6beaca6015d | refs/heads/master | 2021-08-11T08:42:47.203000 | 2017-11-13T12:34:53 | 2017-11-13T12:34:53 | 110,546,157 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.zhi.hibernate.main;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import com.zhi.hibernate.pojo.UserDetail;
import com.zhi.hibernate.pojo.Vehicle;
import com.zhi.hibernate.pojo.Vehicle1;
public class HibernateTest1 {
public static void main(String[] args) {
UserDetail user = new UserDetail();
Vehicle vehicle = new Vehicle();
Vehicle1 vehicle1 = new Vehicle1();
vehicle1.setVehicleName("haha1");
vehicle1.setUser(user);
user.setUserName("lizhi1");
vehicle.setVehicleName("car1");
user.setVehicle(vehicle);
user.getVehicle1().add(vehicle1);
SessionFactory sessionFactory = new Configuration()
.configure().buildSessionFactory();
Session session = sessionFactory.openSession();
session.beginTransaction();
session.save(user);
session.save(vehicle);
session.save(vehicle1);
session.getTransaction().commit();
session.close();
}
}
| UTF-8 | Java | 950 | java | HibernateTest1.java | Java | [
{
"context": "\");\n\t\tvehicle1.setUser(user);\n\t\tuser.setUserName(\"lizhi1\");\n\t\tvehicle.setVehicleName(\"car1\");\n\t\tuser.setVe",
"end": 537,
"score": 0.9996821284294128,
"start": 531,
"tag": "USERNAME",
"value": "lizhi1"
}
]
| null | []
| package com.zhi.hibernate.main;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import com.zhi.hibernate.pojo.UserDetail;
import com.zhi.hibernate.pojo.Vehicle;
import com.zhi.hibernate.pojo.Vehicle1;
public class HibernateTest1 {
public static void main(String[] args) {
UserDetail user = new UserDetail();
Vehicle vehicle = new Vehicle();
Vehicle1 vehicle1 = new Vehicle1();
vehicle1.setVehicleName("haha1");
vehicle1.setUser(user);
user.setUserName("lizhi1");
vehicle.setVehicleName("car1");
user.setVehicle(vehicle);
user.getVehicle1().add(vehicle1);
SessionFactory sessionFactory = new Configuration()
.configure().buildSessionFactory();
Session session = sessionFactory.openSession();
session.beginTransaction();
session.save(user);
session.save(vehicle);
session.save(vehicle1);
session.getTransaction().commit();
session.close();
}
}
| 950 | 0.751579 | 0.737895 | 33 | 27.787878 | 14.584669 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.090909 | false | false | 4 |
4221f7d0d1fa47194f7d93c96c80e1997dcb7d7d | 27,693,949,182,925 | 32f38cd53372ba374c6dab6cc27af78f0a1b0190 | /app/src/main/java/defpackage/akd.java | a36d1c2e23e8f8f149d366c20b8aae94a1cdefe3 | [
"BSD-3-Clause"
]
| permissive | shuixi2013/AmapCode | https://github.com/shuixi2013/AmapCode | 9ea7aefb42e0413f348f238f0721c93245f4eac6 | 1a3a8d4dddfcc5439df8df570000cca12b15186a | refs/heads/master | 2023-06-06T23:08:57.391000 | 2019-08-29T04:36:02 | 2019-08-29T04:36:02 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package defpackage;
import java.util.ArrayList;
/* renamed from: akd reason: default package */
/* compiled from: IPageFramework */
public interface akd {
Class<?> a();
void a(akg akg, int i, akh akh);
void a(akg akg, ake ake);
void a(Class<? extends akc> cls, int i, akh akh, aki aki, ake ake);
akc b();
ArrayList<akc> c();
}
| UTF-8 | Java | 358 | java | akd.java | Java | []
| null | []
| package defpackage;
import java.util.ArrayList;
/* renamed from: akd reason: default package */
/* compiled from: IPageFramework */
public interface akd {
Class<?> a();
void a(akg akg, int i, akh akh);
void a(akg akg, ake ake);
void a(Class<? extends akc> cls, int i, akh akh, aki aki, ake ake);
akc b();
ArrayList<akc> c();
}
| 358 | 0.625698 | 0.625698 | 19 | 17.842106 | 19.331631 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.789474 | false | false | 4 |
9aae02e81d7936774ee36de9e1e1c63542515b80 | 31,224,412,293,283 | 7d8f0ecac798bb408ca856d4f3135db437018291 | /src/com/syntax/class05/Task1.java | a4e7cff0eccd01cef8eba26de33f052366ef5a11 | []
| no_license | SelmaKarapicak/SeleniumJavaBatch6 | https://github.com/SelmaKarapicak/SeleniumJavaBatch6 | 046527dd2be865e879ea166803a1d92ff6498936 | 1936a9f45fbfb35ba98de57d901aa124d20b7431 | refs/heads/master | 2022-09-07T12:40:08.721000 | 2020-05-30T19:26:40 | 2020-05-30T19:26:40 | 268,145,535 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.syntax.class05;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.Select;
import com.syntax.utils.BaseClass;
//TC 1: Amazon Department List Verification
//Open chrome browser
//Go to “http://amazon.com/”
//Verify how many department options available.
//Print each department
//Select Computers
//Quit browser
public class Task1 extends BaseClass {
public static void main(String[] args) {
setUp();
WebElement category=driver.findElement(By.id("searchDropdownBox"));
category.click();
Select select=new Select(category);
List<WebElement> options=select.getOptions();
int size=options.size();
System.out.println("Department size is "+size);
for(WebElement option:options) {
String text=option.getText();
System.out.println("Department options: "+text);
wait(2);
select.selectByValue("search-alias=computers");
if(text.contentEquals("Computers")) {
option.click();
if(option.isSelected()) {
System.out.println("Test Case Successful ");
}else {
System.out.println("Test Case is failed");
}
}
}
driver.quit();
}
}
| WINDOWS-1252 | Java | 1,230 | java | Task1.java | Java | []
| null | []
| package com.syntax.class05;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.Select;
import com.syntax.utils.BaseClass;
//TC 1: Amazon Department List Verification
//Open chrome browser
//Go to “http://amazon.com/”
//Verify how many department options available.
//Print each department
//Select Computers
//Quit browser
public class Task1 extends BaseClass {
public static void main(String[] args) {
setUp();
WebElement category=driver.findElement(By.id("searchDropdownBox"));
category.click();
Select select=new Select(category);
List<WebElement> options=select.getOptions();
int size=options.size();
System.out.println("Department size is "+size);
for(WebElement option:options) {
String text=option.getText();
System.out.println("Department options: "+text);
wait(2);
select.selectByValue("search-alias=computers");
if(text.contentEquals("Computers")) {
option.click();
if(option.isSelected()) {
System.out.println("Test Case Successful ");
}else {
System.out.println("Test Case is failed");
}
}
}
driver.quit();
}
}
| 1,230 | 0.686786 | 0.682708 | 62 | 18.774193 | 18.659443 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.935484 | false | false | 4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.