blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
083ca68d0066f8f67c25cbf56a40ac7bcd0130f3 | f45597a07713c6aaa20389d7805ffa2082280397 | /day21/src/생성자/마스크공장.java | a5365eb15b794c17aca463761d520cddd3ef3e2a | [] | no_license | hangnew/java_lessons | c1385b84daf56dfee465b62a5097e876afb85bf9 | b0c7c562e40bb4a9d1689947372531a14bab315a | refs/heads/main | 2023-08-29T11:04:09.087688 | 2021-10-13T09:24:56 | 2021-10-13T09:24:56 | 379,206,324 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 408 | java | package 생성자;
public class 마스크공장 {
public static void main(String[] args) {
마스크 m1 = new 마스크("white", 2500);
마스크 m2 = new 마스크("black", 3000);
// System.out.println(m1);
// System.out.println(m2);
// m1.color = "white";
// m1.price = 2500;
// m2.color = "black";
// m2.price = 3000;
System.out.println(m1);
System.out.println(m2);
} // main
} // class
| [
"[email protected]"
] | |
a5e7f00680da8d29dbde7e4428533865b7e4155a | 9149dbe9f391e1f18e0bc63f5c5bfeadaa5dc3ed | /src/main/java/cn/liusk/oldtest/socket/TcpClient.java | 2cdf51d4f4c833eafd1ba0e6d3024164cd7badec | [] | no_license | liusk1992/usual-test | 2aa77d70942817edbe33548e27933990254fba67 | 3c77a431f1296bb9ac4a4544c1464417a7ce0124 | refs/heads/master | 2021-09-15T03:25:27.101276 | 2018-05-25T07:59:03 | 2018-05-25T07:59:03 | 100,592,329 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 158 | java | package cn.liusk.oldtest.socket;
public class TcpClient {
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}
| [
"[email protected]"
] | |
987239e27254f2830fe5dec365e6a545d6e1ad7d | 447520f40e82a060368a0802a391697bc00be96f | /apks/obfuscation_and_logging/com_advantage_RaiffeisenBank/source/com/bumptech/glide/load/resource/transcode/UnitTranscoder.java | bd9710e5cfb2540f91908393c7fb95c9be7a98d8 | [
"Apache-2.0"
] | permissive | iantal/AndroidPermissions | 7f3343a9c29d82dbcd4ecd98b3a50ddf8d179465 | d623b732734243590b5f004d167e542e2e2ae249 | refs/heads/master | 2023-07-19T01:29:26.689186 | 2019-09-30T19:01:42 | 2019-09-30T19:01:42 | 107,239,248 | 0 | 0 | Apache-2.0 | 2023-07-16T07:41:38 | 2017-10-17T08:22:57 | null | UTF-8 | Java | false | false | 523 | java | package com.bumptech.glide.load.resource.transcode;
import com.bumptech.glide.load.engine.Resource;
public class UnitTranscoder<Z>
implements ResourceTranscoder<Z, Z>
{
private static final UnitTranscoder<?> UNIT_TRANSCODER = new UnitTranscoder();
public UnitTranscoder() {}
public static <Z> ResourceTranscoder<Z, Z> get()
{
return UNIT_TRANSCODER;
}
public String getId()
{
return "";
}
public Resource<Z> transcode(Resource<Z> paramResource)
{
return paramResource;
}
}
| [
"[email protected]"
] | |
8a64d8662e1e4ccc628519c9e1032b43b847576a | 784a8f4684692ed9ce8a285c50ff83b58ec86130 | /app/src/main/java/com/vinnypalumbo/vinnysmovies/FetchReviewsTask.java | f866194a41fef12dae7ddf076bba0f04373ae718 | [
"MIT"
] | permissive | vinny-palumbo/PopularMovies | f4e6aedf60b5f7d98f9abea33bceb3dc99a20f94 | 9a8869fac8b3f086e46aadf22e70435fdddafc72 | refs/heads/master | 2021-01-10T01:26:07.744140 | 2017-02-11T19:34:01 | 2017-02-11T19:34:01 | 46,441,522 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,121 | java | /*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.vinnypalumbo.vinnysmovies;
import android.content.Context;
import android.net.Uri;
import android.os.AsyncTask;
import android.util.Log;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
public class FetchReviewsTask extends AsyncTask<String, Void, List<Review>> {
private final String LOG_TAG = FetchReviewsTask.class.getSimpleName();
private ReviewAdapter mReviewAdapter;
private final Context mContext;
public FetchReviewsTask(Context context, ReviewAdapter reviewAdapter) {
mContext = context;
mReviewAdapter = reviewAdapter;
}
private boolean DEBUG = true;
@Override
protected List<Review> doInBackground(String... params) {
Log.d("vinny-debug", "FetchReviewsTask - doInBackground");
// If there's no movieId, there's nothing to look up. Verify size of params.
if (params.length == 0) {
return null;
}
String movieId = params[0];
// These two need to be declared outside the try/catch
// so that they can be closed in the finally block.
HttpURLConnection urlConnection = null;
BufferedReader reader = null;
// Will contain the raw JSON response as a string.
String reviewJsonStr = null;
try {
// Construct the URL for the TheMovieDB query
// Possible parameters are available at TMDB's movie API page
//URL url = new URL("http://api.themoviedb.org/3/movie/281957/reviews?api_key=XXXX");
final String REVIEW_BASE_URL = "http://api.themoviedb.org/3/movie";
final String REVIEW_SEGMENT = "reviews";
final String APIKEY_PARAM = "api_key";
Uri builtUri = Uri.parse(REVIEW_BASE_URL).buildUpon()
.appendPath(movieId)
.appendPath(REVIEW_SEGMENT)
.appendQueryParameter(APIKEY_PARAM, BuildConfig.THE_MOVIE_DB_API_KEY)
.build();
URL url = new URL(builtUri.toString());
// Create the request to TheMovieDB, and open the connection
urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.setRequestMethod("GET");
urlConnection.connect();
// Read the input stream into a String
InputStream inputStream = urlConnection.getInputStream();
StringBuffer buffer = new StringBuffer();
if (inputStream == null) {
// Nothing to do.
return null;
}
reader = new BufferedReader(new InputStreamReader(inputStream));
String line;
while ((line = reader.readLine()) != null) {
// Since it's JSON, adding a newline isn't necessary (it won't affect parsing)
// But it does make debugging a *lot* easier if you print out the completed
// buffer for debugging.
buffer.append(line + "\n");
}
if (buffer.length() == 0) {
// Stream was empty. No point in parsing.
return null;
}
reviewJsonStr = buffer.toString();
} catch (IOException e) {
Log.e(LOG_TAG, "Error ", e);
// If the code didn't successfully get the review data, there's no point in attempting
// to parse it.
return null;
} finally {
if (urlConnection != null) {
urlConnection.disconnect();
}
if (reader != null) {
try {
reader.close();
} catch (final IOException e) {
Log.e(LOG_TAG, "Error closing stream", e);
}
}
}
try {
return getReviewDataFromJson(reviewJsonStr);
} catch (JSONException e) {
Log.e(LOG_TAG, e.getMessage(), e);
e.printStackTrace();
}
// This will only happen if there was an error getting or parsing the forecast.
return null;
}
/**
* Take the String representing the review results in JSON Format and
* pull out the data we need for each review
*
* Fortunately parsing is easy: constructor takes the JSON string and converts it
* into an Object hierarchy for us.
*/
private List<Review> getReviewDataFromJson(String reviewJsonStr) throws JSONException {
Log.d("vinny-debug", "FetchReviewsTask - getReviewDataFromJson");
// These are the names of the JSON objects that need to be extracted.
final String TMDB_RESULTS = "results";
final String TMDB_AUTHOR = "author";
final String TMDB_CONTENT = "content";
try {
JSONObject reviewJson = new JSONObject(reviewJsonStr);
JSONArray reviewArray = reviewJson.getJSONArray(TMDB_RESULTS);
// Insert the review into an ArrayList
List<Review> reviews = new ArrayList<Review>();
for (int i = 0; i < reviewArray.length(); i++) {
String reviewAuthor;
String reviewContent;
// Get the JSON object representing the review
JSONObject review = reviewArray.getJSONObject(i);
// the review author is in a String associated to the key "author"
reviewAuthor = review.getString(TMDB_AUTHOR);
// the review title is in a String associated to the key "content"
reviewContent = review.getString(TMDB_CONTENT);
reviews.add(new Review(reviewAuthor, reviewContent));
}
Log.d(LOG_TAG, "Fetch Reviews Completed");
return reviews;
} catch (JSONException e) {
Log.e(LOG_TAG, e.getMessage(), e);
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(List<Review> result) {
if (result != null && mReviewAdapter != null) {
mReviewAdapter.clear();
for(Review review : result) {
mReviewAdapter.add(review);
}
// New data is back from the server. Hooray!
}
}
} | [
"[email protected]"
] | |
db992aa50b640f6a9af6674d596a4b3b635aa52c | 6ccac19a57ca2c5d5194c93452942b7b11522159 | /Practise/src/src/StringCompressor.java | 3a130b9792963aadb0de518925eb2bea7e302df4 | [] | no_license | abhianni/Practise | 4e6fab3b809b3547ad910c14673c41c4c3117359 | bd6a9c0cb7278c6d5682a5ca7bae727d341fef02 | refs/heads/master | 2021-01-11T17:37:00.706975 | 2017-05-10T10:13:35 | 2017-05-10T10:13:35 | 79,803,253 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 941 | java | package src;
class StringCompressor
{
public static void main(String [] args) throws Exception
{
StringCompressor ts = new StringCompressor();
System.out.println(ts.compress("aabbhjhhhhhhjj"));
}
public String compress(String str)
{
StringBuffer result = new StringBuffer();
char[] character = str.toCharArray();
int count =1;
for(int i=1 ; i<str.length();i++)
{
if(character[i-1]==character[i])
{
count=count+1;
if(i==str.length()-1)
{
result.append(Character.toString(character[i]));
if(!(count==1))
{
result.append(count);
}
}
}
else
{
result.append(Character.toString(character[i-1]));
if(!(count==1))
{
result.append(count);
}
count=1;
if(i==str.length()-1)
{
result.append(Character.toString(character[i]));
}
}
}
return result.toString();
}
} | [
"[email protected]"
] | |
64848a1c163b7348d075d8d93b3b4f86f2e967d0 | f6a7915364ef2202d3a167ea69328b8e23e20ef4 | /src/main/java/indi/sword/performance/test/TestSerializableDifferentSample.java | 391c4118ee48646ed2959b96d71832a13feddc89 | [] | no_license | JebLin/JsonPerformanceVS | cb2fd1565e79f6e14143f86d468c3ac6eefc0320 | 1130b6eda5d41e4107cad14142caa79547911f53 | refs/heads/master | 2020-03-22T23:02:06.327620 | 2018-07-18T08:25:37 | 2018-07-18T08:25:37 | 140,786,004 | 2 | 3 | null | null | null | null | UTF-8 | Java | false | false | 2,292 | java | package indi.sword.performance.test;
import indi.sword.performance.bean.DataBuilder;
import indi.sword.performance.bean.SampleBuilder;
import indi.sword.performance.bean.SampleEntity;
import indi.sword.performance.util.FileUtil;
import indi.sword.performance.util.JsonUtil;
import indi.sword.performance.util.RedisUtil;
import java.util.*;
import java.util.concurrent.*;
/**
* @Description
* 多个样本。序列化性能测试
* @Author jeb_lin
* @Date Created in 5:22 PM 13/07/2018
* @MODIFIED BY
*/
public class TestSerializableDifferentSample {
public static void main(String[] args) throws Exception {
int sampleSize = 10;
int listSize = 10;
int mapKeyNum = 10;
// sampleSize = Integer.valueOf(args[0]);
// listSize = Integer.valueOf(args[1]);
// mapKeyNum = Integer.valueOf(args[2]);
singleThread(sampleSize,listSize,mapKeyNum);
// multiThread();
}
private static void singleThread(int sampleSize, int listSize, int mapKeyNum) throws Exception {
int type = 1 + ThreadLocalRandom.current().nextInt(4);
List<SampleEntity> sampleEntityList = SampleBuilder.buildSamples(sampleSize, listSize, mapKeyNum);
for (int i = 0; i < 4; i++) {
type = (type + 1) % 4;
String outputPath = FileUtil.getSerializableOutputPath(type,
sampleSize, listSize, mapKeyNum,1);
long cost = JsonUtil.calculateJavaBeanToJson(sampleEntityList, type);
FileUtil.writeFile(String.valueOf(cost) + ",", outputPath, true);
}
}
private static void multiThread() throws Exception {
// 会越来越快,被编译成本地代码
ExecutorService pool = Executors.newFixedThreadPool(4);
int threadNum = 4;
for (int i = 0; i < 3; i++) {
pool = Executors.newFixedThreadPool(threadNum);
List<Callable<Long>> partitions = new ArrayList<>(threadNum);
CountDownLatch latch = new CountDownLatch(threadNum);
for (int j = 0; j < threadNum; j++) {
partitions.add(new CalcuteThread(latch));
}
List<Future<Long>> resultFromPart = pool.invokeAll(partitions);
pool.shutdown();
}
}
}
| [
"[email protected]"
] | |
a4675286b01df5abea2ae3cb4e60c9f0742d3ef4 | 4c2101f8e2e034c5314af9801584b650a7348ba4 | /mothership-handle/src/main/java/CreateMothershipCommandHandler.java | 6ec03bbdc9351f4f1ede6f3a59c40b647ecf5f3d | [
"Apache-2.0"
] | permissive | rodolfodpk/mars-bounded-ctx | 7dd965ab67f40f10de1dd73b9ca8dc8a57416598 | 6bc90e092725e52f30272716eac0b6f0057b9308 | refs/heads/master | 2016-09-13T19:30:16.393456 | 2016-04-28T14:55:43 | 2016-04-28T14:55:43 | 57,170,522 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 508 | java | import javaslang.Tuple3;
import javaslang.control.Try;
import keyvent.flows.StateTransitionsTracker;
import keyvent.flows.commands.CommandHandler;
public class CreateMothershipCommandHandler<ID, AR, CMD, EV> implements CommandHandler<ID, AR, CMD, EV> {
@Override
public Try<Tuple3<ID, CMD, StateTransitionsTracker<EV, AR>>> handle(Tuple3<ID, CMD,
StateTransitionsTracker<EV, AR>> commandContext) {
return null;
}
}
| [
"[email protected]"
] | |
4e8f1f4a96dab167bbe4adb67f95c67fb1c665c9 | c6992ce8db7e5aab6fd959c0c448659ab91b16ce | /sdk/mysql/azure-resourcemanager-mysql/src/samples/java/com/azure/resourcemanager/mysql/AdvisorsGetSamples.java | fbe023cfc038adee49ea894c92a14f8b5de721fa | [
"MIT",
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-3-Clause",
"CC0-1.0",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference",
"LGPL-2.1-or-later"
] | permissive | g2vinay/azure-sdk-for-java | ae6d94d583cc2983a5088ec8f6146744ee82cb55 | b88918a2ba0c3b3e88a36c985e6f83fc2bae2af2 | refs/heads/master | 2023-09-01T17:46:08.256214 | 2021-09-23T22:20:20 | 2021-09-23T22:20:20 | 161,234,198 | 3 | 1 | MIT | 2020-01-16T20:22:43 | 2018-12-10T20:44:41 | Java | UTF-8 | Java | false | false | 891 | java | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.mysql;
import com.azure.core.util.Context;
/** Samples for Advisors Get. */
public final class AdvisorsGetSamples {
/**
* Sample code: AdvisorsGet.
*
* @param mySqlManager Entry point to MySqlManager. The Microsoft Azure management API provides create, read,
* update, and delete functionality for Azure MySQL resources including servers, databases, firewall rules, VNET
* rules, log files and configurations with new business model.
*/
public static void advisorsGet(com.azure.resourcemanager.mysql.MySqlManager mySqlManager) {
mySqlManager.advisors().getWithResponse("testResourceGroupName", "testServerName", "Index", Context.NONE);
}
}
| [
"[email protected]"
] | |
34947bd8713f2ccbde32e21f39e9fd60c19ca2ba | d37d42dbe36c39dd259b56482212098b6a2be5c0 | /uitests/plugins/org.jboss.tools.fuse.reddeer/src/org/jboss/tools/fuse/reddeer/wizard/NewFuseTransformationWizard.java | 768b489f030592b2f77f22ca3c6e7b3636f28365 | [] | no_license | rifttech/jbosstools-fuse | f2e4d7d82d7838656ce10fb4ab1714842d66b360 | b830c019ef546bf2ba59b7d3d30c636de893c099 | refs/heads/master | 2020-03-06T16:41:04.752336 | 2018-03-21T12:12:11 | 2018-03-21T18:52:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,222 | java | /*******************************************************************************
* Copyright (c) 2017 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.fuse.reddeer.wizard;
import org.eclipse.reddeer.common.logging.Logger;
import org.eclipse.reddeer.common.matcher.RegexMatcher;
import org.eclipse.reddeer.common.wait.TimePeriod;
import org.eclipse.reddeer.common.wait.WaitUntil;
import org.eclipse.reddeer.common.wait.WaitWhile;
import org.eclipse.reddeer.jface.wizard.WizardDialog;
import org.eclipse.reddeer.swt.condition.ControlIsEnabled;
import org.eclipse.reddeer.swt.condition.ShellIsActive;
import org.eclipse.reddeer.swt.condition.ShellIsAvailable;
import org.eclipse.reddeer.swt.impl.button.PushButton;
import org.eclipse.reddeer.swt.impl.button.RadioButton;
import org.eclipse.reddeer.swt.impl.combo.DefaultCombo;
import org.eclipse.reddeer.swt.impl.shell.DefaultShell;
import org.eclipse.reddeer.swt.impl.table.DefaultTable;
import org.eclipse.reddeer.swt.impl.text.LabeledText;
import org.jboss.tools.fuse.reddeer.condition.TableHasRow;
/**
* Represents 'New Fuse Transformation Wizard'
*
* @author tsedmik
*/
public class NewFuseTransformationWizard extends WizardDialog {
private static final String TITLE = "New Fuse Transformation";
private Logger log = Logger.getLogger(NewFuseTransformationWizard.class);
public NewFuseTransformationWizard() {
super(TITLE);
}
@Override
public NewFuseTransformationWizard next() {
new WaitUntil(new ControlIsEnabled(new PushButton("Next >")));
return (NewFuseTransformationWizard) super.next();
}
public void setTransformationID(String id) {
log.debug("Set 'Transformation ID' to '" + id + "'");
new LabeledText("Transformation ID:").setText(id);
}
public void setSourceType(TransformationType type) {
log.debug("Set 'Source Type' to '" + type + "'");
new DefaultCombo(0).setSelection(type.toString());
}
public void setTargetType(TransformationType type) {
log.debug("Set 'Target Type' to '" + type + "'");
new DefaultCombo(1).setSelection(type.toString());
}
public void setXMLTypeDefinition(TypeDefinition type) {
log.debug("Set 'XML Type Definition' to '" + type + "'");
new RadioButton(type.equals(TypeDefinition.Schema) ? "XML Schema" : "XML Instance Document").toggle(true);
}
public void setXMLSourceFile(String name) {
log.debug("Set 'XML Source File' to '" + name + "'");
new PushButton("...").click();
new WaitUntil(new ShellIsAvailable("Select XSD From Project"));
new DefaultShell("Select XSD From Project");
DefaultTable table = new DefaultTable();
new WaitUntil(new TableHasRow(table, new RegexMatcher(name)));
table.select(name);
new PushButton("OK").click();
new WaitUntil(new ShellIsActive("New Fuse Transformation"));
}
public void setJSONTypeDefinition(TypeDefinition type) {
log.debug("Set 'JSON Type Definiton' to '" + type + "'");
new RadioButton(type.equals(TypeDefinition.Schema) ? "JSON Schema" : "JSON Instance Document").toggle(true);
}
public void setJSONTargetFile(String name) {
log.debug("Set 'JSON Target File' to '" + name + "'");
new PushButton("...").click();
new WaitUntil(new ShellIsAvailable("Select JSON From Project"));
new DefaultShell("Select JSON From Project");
DefaultTable table = new DefaultTable();
new WaitUntil(new TableHasRow(table, new RegexMatcher(name)));
table.select(name);
new PushButton("OK").click();
new WaitUntil(new ShellIsActive("New Fuse Transformation"));
}
@Override
public void finish() {
super.finish();
if (new ShellIsAvailable("New Fuse Transformation").test()) {
new WaitWhile(new ShellIsAvailable("New Fuse Transformation"), TimePeriod.LONG);
}
}
public static enum TransformationType {
Java, XML, JSON, Other
}
public static enum TypeDefinition {
Schema, Document
}
}
| [
"[email protected]"
] | |
29a9a6f4d40b6261efb0fca46c41ed3f7b11b397 | c63dcc19318486035b4191419960889a76721112 | /src/com/application/VUE/Postuler.java | 8146547a9dc8bbef1d2f9d089462c8dd8093a10e | [] | no_license | WiemBEH/gestStage | 946e50e391ce78a2ef0a9313ba45827ec6d9cf13 | 2ecbd8eea2fed65a343ced970397f3dc0d06d846 | refs/heads/master | 2021-01-19T07:09:44.574430 | 2017-04-07T09:19:56 | 2017-04-07T09:19:56 | 87,527,146 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,743 | java | package com.application.VUE;
import javax.swing.JPanel;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JTable;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.JButton;
public class Postuler extends JPanel {
private JTable table;
private JTable table_1;
/**
* Create the panel.
*/
public Postuler() {
table = new JTable();
table_1 = new JTable();
JButton btnPostuler = new JButton("Postuler");
GroupLayout groupLayout = new GroupLayout(this);
groupLayout.setHorizontalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGap(20)
.addComponent(table_1, GroupLayout.PREFERRED_SIZE, 257, GroupLayout.PREFERRED_SIZE)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGap(6)
.addComponent(table, GroupLayout.PREFERRED_SIZE, 96, GroupLayout.PREFERRED_SIZE))
.addGroup(groupLayout.createSequentialGroup()
.addGap(39)
.addComponent(btnPostuler)))
.addContainerGap(40, Short.MAX_VALUE))
);
groupLayout.setVerticalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGap(80)
.addComponent(table, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addGap(38)
.addComponent(btnPostuler)
.addContainerGap(157, Short.MAX_VALUE))
.addGroup(Alignment.TRAILING, groupLayout.createSequentialGroup()
.addContainerGap()
.addComponent(table_1, GroupLayout.DEFAULT_SIZE, 252, Short.MAX_VALUE)
.addGap(36))
);
setLayout(groupLayout);
}
}
| [
"[email protected]"
] | |
73d9544bbfa59f471b259887dbb349b80f570df5 | ba324195f93aa819af7b9969a12efd326bded4b5 | /src/main/java/com/springboot/demo/service/RedisService.java | aeeab212c6e90edade9562055ea47cd150e3a3d1 | [] | no_license | Himehane/SpringBootSample | c4f4e802aa55204b5363616248a0b5b49085b6f9 | 4b882b4f2ae358994b588a7604c625f5d256a1a6 | refs/heads/master | 2022-06-25T09:30:54.893026 | 2020-08-15T15:21:53 | 2020-08-15T15:21:53 | 155,707,238 | 0 | 1 | null | 2020-08-15T15:21:54 | 2018-11-01T11:49:04 | Java | UTF-8 | Java | false | false | 191 | java | package com.springboot.demo.service;
/**
* @author Himehane
* @createDate 11/2/2018
*/
public interface RedisService{
String writerRedis(String id);
String ReadRedis(String id);
} | [
"[email protected]"
] | |
abe17820500c27c45cc972a02f5f2fb359aa2662 | 7b240f4d3d248f089e3228727a2e6dc834ef29b5 | /app/src/main/java/cn/ycbjie/ycaudioplayer/executor/download/AbsDownloadSearchMusic.java | 80a0d627ea2b8cbfd84d8ab5455b38643ae60c82 | [
"Apache-2.0"
] | permissive | MIAO11/YCAudioPlayer | 7c4108d1027aa7db690a569a18205e07f7ae09af | 07256a94b7c021faf71ddaab8ee78671e6d50aeb | refs/heads/master | 2020-03-18T19:06:22.368732 | 2018-04-19T07:43:36 | 2018-04-19T07:43:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,811 | java | package cn.ycbjie.ycaudioplayer.executor.download;
import android.app.Activity;
import com.liulishuo.filedownloader.BaseDownloadTask;
import com.liulishuo.filedownloader.FileDownloadListener;
import com.liulishuo.filedownloader.FileDownloader;
import com.pedaily.yc.ycdialoglib.customToast.ToastUtil;
import java.io.File;
import cn.ycbjie.ycaudioplayer.api.http.OnLineMusicModel;
import cn.ycbjie.ycaudioplayer.model.bean.DownloadInfo;
import cn.ycbjie.ycaudioplayer.model.bean.SearchMusic;
import cn.ycbjie.ycaudioplayer.util.musicUtils.FileMusicUtils;
import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;
/**
* <pre>
* author: yangchong
* blog : www.pedaily.cn
* time : 2018/01/24
* desc : 下载音乐
* revise:
* </pre>
*/
public abstract class AbsDownloadSearchMusic extends AbsDownloadMusic {
private Activity mActivity;
private SearchMusic.Song mSong;
protected AbsDownloadSearchMusic(Activity activity, SearchMusic.Song song) {
super(activity);
mActivity = activity;
this.mSong = song;
}
@Override
protected void download() {
final String artist = mSong.getArtistname();
final String title = mSong.getSongname();
// 下载歌词
String lrcFileName = FileMusicUtils.getLrcFileName(artist, title);
File lrcFile = new File(FileMusicUtils.getLrcDir() + lrcFileName);
if (!lrcFile.exists()) {
downloadLrc(mSong.getSongid(),FileMusicUtils.getLrcDir(), lrcFileName);
}
// 下载封面
String albumFileName = FileMusicUtils.getAlbumFileName(artist, title);
final File albumFile = new File(FileMusicUtils.getAlbumDir(), albumFileName);
// 获取歌曲下载链接
getMusicDownloadInfo(mSong.getSongid(),artist,title,albumFile);
}
private void getMusicDownloadInfo(String songId, final String artist,
final String title, final File albumFile) {
OnLineMusicModel model = OnLineMusicModel.getInstance();
model.getMusicDownloadInfo(OnLineMusicModel.METHOD_DOWNLOAD_MUSIC,songId)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Subscriber<DownloadInfo>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
onExecuteFail(null);
}
@Override
public void onNext(DownloadInfo downloadInfo) {
if (downloadInfo == null || downloadInfo.getBitrate() == null) {
onExecuteFail(null);
return;
}
downloadMusic(downloadInfo.getBitrate().getFile_link(), artist, title, albumFile.getPath());
onExecuteSuccess(null);
}
});
}
private void downloadLrc(String lrclink, String lrcDir, final String lrcFileName) {
FileDownloader.getImpl()
.create(lrclink)
.setPath(lrcDir)
.setListener(new FileDownloadListener() {
@Override
protected void pending(BaseDownloadTask task, int soFarBytes, int totalBytes) {
}
@Override
protected void connected(BaseDownloadTask task, String etag, boolean isContinue, int soFarBytes, int totalBytes) {
}
@Override
protected void progress(BaseDownloadTask task, int soFarBytes, int totalBytes) {
}
@Override
protected void blockComplete(BaseDownloadTask task) {
}
@Override
protected void retry(final BaseDownloadTask task, final Throwable ex, final int retryingTimes, final int soFarBytes) {
}
@Override
protected void completed(BaseDownloadTask task) {
ToastUtil.showToast(mActivity,"下载完成");
}
@Override
protected void paused(BaseDownloadTask task, int soFarBytes, int totalBytes) {
}
@Override
protected void error(BaseDownloadTask task, Throwable e) {
}
@Override
protected void warn(BaseDownloadTask task) {
}
}).start();
}
}
| [
"[email protected]"
] | |
f60dd28fd023894e7711b0d0532369b1369091f4 | e038c9b9761e978e3935e268e7ddfa1b15533341 | /多线程/day23_Pattern/src/decorate/PhoneDemo.java | d293c2739972cb02b9608224df3fb2dc13067a63 | [] | no_license | Scyzin/11.6restart | 600df7635ae599bfebe459bd110f7dc5ee72ec76 | fcbaaf6b5bd460569e837410557d025ce1f30123 | refs/heads/master | 2021-08-29T01:26:35.555266 | 2017-12-13T08:52:19 | 2017-12-13T08:52:19 | 109,783,364 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 1,231 | java | package decorate;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.Scanner;
public class PhoneDemo {
public static void main(String[] args) {
Phone p = new IPhone();
p.call();
System.out.println("------------");
// 需求:我想在接电话前,听彩铃
PhoneDecorate pd = new RingPhoneDecorate(p);
pd.call();
System.out.println("------------");
// 需求:我想在接电话后,听音乐
pd = new MusicPhoneDecorate(p);
pd.call();
System.out.println("------------");
// 需求:我要想手机在接前听彩铃,接后听音乐
// 自己提供装饰类,在打电话前听彩铃,打电话后听音乐
pd = new RingPhoneDecorate(new MusicPhoneDecorate(p));
pd.call();
System.out.println("----------");
// 想想在IO流中的使用
// InputStream is = System.in;
// InputStreamReader isr = new InputStreamReader(is);
// BufferedReader br = new BufferedReader(isr);
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter((new OutputStreamWriter(
System.out)));
Scanner sc = new Scanner(System.in);
}
} | [
"[email protected]"
] | |
4d6ab9ac6e4662642b592dd532cb071871183e60 | a918f562f193b92cc7c1fb5b18f552426b5ecf74 | /trunk/java/src/com/zy/action/sns/InviteAction.java | b3f0983820069339a8919585d53454843a3db4f6 | [] | no_license | fbion/zhiyou-svn-to-git | 4131a6d6cae1d0d034d90ca88eb0a2d9e8eda51c | af99ca5d2191f122fca62c94218f970a7a43bd4a | refs/heads/master | 2021-05-29T09:51:25.572917 | 2015-08-25T15:27:27 | 2015-08-25T15:27:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 690 | java | package com.zy.action.sns;
import com.opensymphony.xwork2.ActionSupport;
public class InviteAction extends ActionSupport{
private String[] emails;
private String[] names;
public String[] getEmails() {
return emails;
}
public String[] getNames() {
return names;
}
public void setEmails(String[] emails) {
this.emails = emails;
}
public void setNames(String[] names) {
this.names = names;
}
public String execute() {
if (emails != null) {
for (int i = 0; i < emails.length; i ++)
if (!"".equals(emails[i])) {
System.out.println("name:" + names[i] + " emails:" + emails[i]);
}
}
return "invite.success";
}
}
| [
"[email protected]"
] | |
ca3059c2a824caece8814208678a1e1bf588a34e | b9a1c043a12e921d63ae88eed5997452acc83b27 | /Basics.java | 5dd8a2f210c4623cd014b76f1563d29461442234 | [] | no_license | sakshivandure/AdditionOfTwoNumbers | 6922d9c44c5c5b00e6306501291ec88204c94441 | 7ef3ca9d3c3587c0130becfdb4657fa69fb4dd1f | refs/heads/master | 2022-11-14T15:13:38.574166 | 2020-07-09T06:47:17 | 2020-07-09T06:47:17 | 278,271,139 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 403 | java | package basics;
import java.util.Scanner;
public class Basics {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Enter two number");
int x = scanner.nextInt();
int y = scanner.nextInt();
System.out.println("addition of "+x+" and "+y+" = "+(x+y));
}
}
| [
"[email protected]"
] | |
3a8e462c175f522da6ab7f8c095e67b02edc8296 | ae78ed986f87b40825c27ce7d4853c3f277c9afc | /ProductsApp/src/main/java/com/example/productsapp/ProductsRepository.java | 00152d24effcc139a750a47ad586c658f8a1033b | [] | no_license | kuppireddigariswetha/ProductsApp | 6db1678f78dd948a294ea7e0ce9b509f2579a350 | 5c0cc6da5b18f091b0a0dc5c65f68742440bd7e1 | refs/heads/master | 2020-09-13T09:53:23.677296 | 2019-11-20T15:26:18 | 2019-11-20T15:26:18 | 222,733,057 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 286 | java | package com.example.productsapp;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface ProductsRepository extends CrudRepository<Products, Integer>{
Products findByName(String name);
}
| [
"[email protected]"
] | |
a96b37e83fad83affe6b70ea4927afbe0da84c8b | 96f50632c678f7a6232e9fdb5ccd9b5de2288279 | /app/src/main/java/com/tshang/peipei/protocol/asn/gogirl/BindAnonymNickInfo.java | 7ba8e86df5799def464898a51b264d5aa2537668 | [] | no_license | iuvei/peipei | 629c17c2f8ddee98d4747d2cbec37b2209e78af4 | 0497dc9389287664e96e9d14381cd6078e114979 | refs/heads/master | 2020-11-26T22:20:32.990823 | 2019-03-16T07:19:40 | 2019-03-16T07:19:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,840 | java | //-----------------------------------------------------------------------------
// NOTE: this is a machine generated file - editing not recommended
//
// File: ./src/com/tshang/peipei/protocol/asn/gogirl/BindAnonymNickInfo.java
//
// Java class for ASN.1 definition BindAnonymNickInfo as defined in
// module GOGIRL.
// This file was generated by Snacc for Java at Tue Jan 26 18:38:19 2016
//-----------------------------------------------------------------------------
package com.tshang.peipei.protocol.asn.gogirl;
// Import PrintStream class for print methods
import java.io.PrintStream;
// Import ASN.1 basic type representations
import com.ibm.util.*;
// Import ASN.1 decoding/encoding classes
import com.ibm.asn1.*;
/** This class represents the ASN.1 SEQUENCE type <tt>BindAnonymNickInfo</tt>.
* For each sequence member, sequence classes contain a
* public member variable of the corresponding Java type.
* @author Snacc for Java
* @version Tue Jan 26 18:38:16 2016
*/
public class BindAnonymNickInfo implements ASN1Type {
/** member variable representing the sequence member uid of type java.math.BigInteger */
public java.math.BigInteger uid;
/** member variable representing the sequence member id of type java.math.BigInteger */
public java.math.BigInteger id;
/** member variable representing the sequence member nick of type byte[] */
public byte[] nick;
/** member variable representing the sequence member createtime of type java.math.BigInteger */
public java.math.BigInteger createtime;
/** member variable representing the sequence member lasttime of type java.math.BigInteger */
public java.math.BigInteger lasttime;
/** member variable representing the sequence member revint0 of type java.math.BigInteger */
public java.math.BigInteger revint0;
/** member variable representing the sequence member revint1 of type java.math.BigInteger */
public java.math.BigInteger revint1;
/** member variable representing the sequence member revint2 of type java.math.BigInteger */
public java.math.BigInteger revint2;
/** member variable representing the sequence member revint3 of type java.math.BigInteger */
public java.math.BigInteger revint3;
/** member variable representing the sequence member revint4 of type java.math.BigInteger */
public java.math.BigInteger revint4;
/** member variable representing the sequence member revstr0 of type byte[] */
public byte[] revstr0;
/** member variable representing the sequence member revstr1 of type byte[] */
public byte[] revstr1;
/** member variable representing the sequence member revstr2 of type byte[] */
public byte[] revstr2;
/** member variable representing the sequence member revstr3 of type byte[] */
public byte[] revstr3;
/** member variable representing the sequence member revstr4 of type byte[] */
public byte[] revstr4;
/** default constructor */
public BindAnonymNickInfo() {}
/** copy constructor */
public BindAnonymNickInfo (BindAnonymNickInfo arg) {
uid = arg.uid;
id = arg.id;
nick = new byte[arg.nick.length];
System.arraycopy(arg.nick,0,nick,0,arg.nick.length);
createtime = arg.createtime;
lasttime = arg.lasttime;
revint0 = arg.revint0;
revint1 = arg.revint1;
revint2 = arg.revint2;
revint3 = arg.revint3;
revint4 = arg.revint4;
revstr0 = new byte[arg.revstr0.length];
System.arraycopy(arg.revstr0,0,revstr0,0,arg.revstr0.length);
revstr1 = new byte[arg.revstr1.length];
System.arraycopy(arg.revstr1,0,revstr1,0,arg.revstr1.length);
revstr2 = new byte[arg.revstr2.length];
System.arraycopy(arg.revstr2,0,revstr2,0,arg.revstr2.length);
revstr3 = new byte[arg.revstr3.length];
System.arraycopy(arg.revstr3,0,revstr3,0,arg.revstr3.length);
revstr4 = new byte[arg.revstr4.length];
System.arraycopy(arg.revstr4,0,revstr4,0,arg.revstr4.length);
}
/** encoding method.
* @param enc
* encoder object derived from com.ibm.asn1.ASN1Encoder
* @exception com.ibm.asn1.ASN1Exception
* encoding error
*/
public void encode (ASN1Encoder enc) throws ASN1Exception {
int seq_nr = enc.encodeSequence();
enc.encodeInteger(uid);
enc.encodeInteger(id);
enc.encodeOctetString(nick);
enc.encodeInteger(createtime);
enc.encodeInteger(lasttime);
enc.encodeInteger(revint0);
enc.encodeInteger(revint1);
enc.encodeInteger(revint2);
enc.encodeInteger(revint3);
enc.encodeInteger(revint4);
enc.encodeOctetString(revstr0);
enc.encodeOctetString(revstr1);
enc.encodeOctetString(revstr2);
enc.encodeOctetString(revstr3);
enc.encodeOctetString(revstr4);
enc.endOf(seq_nr);
}
/** decoding method.
* @param dec
* decoder object derived from com.ibm.asn1.ASN1Decoder
* @exception com.ibm.asn1.ASN1Exception
* decoding error
*/
public void decode (ASN1Decoder dec) throws ASN1Exception {
int seq_nr = dec.decodeSequence();
uid = dec.decodeInteger();
id = dec.decodeInteger();
nick = dec.decodeOctetString();
createtime = dec.decodeInteger();
lasttime = dec.decodeInteger();
revint0 = dec.decodeInteger();
revint1 = dec.decodeInteger();
revint2 = dec.decodeInteger();
revint3 = dec.decodeInteger();
revint4 = dec.decodeInteger();
revstr0 = dec.decodeOctetString();
revstr1 = dec.decodeOctetString();
revstr2 = dec.decodeOctetString();
revstr3 = dec.decodeOctetString();
revstr4 = dec.decodeOctetString();
dec.endOf(seq_nr);
}
/** print method (variable indentation)
* @param os
* PrintStream representing the print destination (file, etc)
* @param indent
* number of blanks that preceed each output line.
*/
public void print (PrintStream os, int indent) {
os.println("{ -- SEQUENCE --");
for(int ii = 0; ii < indent+2; ii++) os.print(' ');
os.print("uid = ");
os.print(uid.toString());
os.println(',');
for(int ii = 0; ii < indent+2; ii++) os.print(' ');
os.print("id = ");
os.print(id.toString());
os.println(',');
for(int ii = 0; ii < indent+2; ii++) os.print(' ');
os.print("nick = ");
os.print(Hex.toString(nick));
os.println(',');
for(int ii = 0; ii < indent+2; ii++) os.print(' ');
os.print("createtime = ");
os.print(createtime.toString());
os.println(',');
for(int ii = 0; ii < indent+2; ii++) os.print(' ');
os.print("lasttime = ");
os.print(lasttime.toString());
os.println(',');
for(int ii = 0; ii < indent+2; ii++) os.print(' ');
os.print("revint0 = ");
os.print(revint0.toString());
os.println(',');
for(int ii = 0; ii < indent+2; ii++) os.print(' ');
os.print("revint1 = ");
os.print(revint1.toString());
os.println(',');
for(int ii = 0; ii < indent+2; ii++) os.print(' ');
os.print("revint2 = ");
os.print(revint2.toString());
os.println(',');
for(int ii = 0; ii < indent+2; ii++) os.print(' ');
os.print("revint3 = ");
os.print(revint3.toString());
os.println(',');
for(int ii = 0; ii < indent+2; ii++) os.print(' ');
os.print("revint4 = ");
os.print(revint4.toString());
os.println(',');
for(int ii = 0; ii < indent+2; ii++) os.print(' ');
os.print("revstr0 = ");
os.print(Hex.toString(revstr0));
os.println(',');
for(int ii = 0; ii < indent+2; ii++) os.print(' ');
os.print("revstr1 = ");
os.print(Hex.toString(revstr1));
os.println(',');
for(int ii = 0; ii < indent+2; ii++) os.print(' ');
os.print("revstr2 = ");
os.print(Hex.toString(revstr2));
os.println(',');
for(int ii = 0; ii < indent+2; ii++) os.print(' ');
os.print("revstr3 = ");
os.print(Hex.toString(revstr3));
os.println(',');
for(int ii = 0; ii < indent+2; ii++) os.print(' ');
os.print("revstr4 = ");
os.print(Hex.toString(revstr4));
os.println();
for(int ii = 0; ii < indent; ii++) os.print(' ');
os.print('}');
}
/** default print method (fixed indentation)
* @param os
* PrintStream representing the print destination (file, etc)
*/
public void print (PrintStream os) {
print(os,0);
}
/** toString method
* @return the output of {@link #print(PrintStream) print} method (fixed indentation) as a string
*/
public String toString () {
java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
print(ps);
ps.close();
return baos.toString();
}
}
| [
"[email protected]"
] | |
da6057ef8f81e87523d901a5d86fb15e7776b224 | 06e6d4c92da5d49bd48bc7489a32d3f459655e50 | /SSH-CRUD/src/com/kyle/ssh/actions/EmployeeAction.java | 9697c9201f8b843ead4faf3bde3839a34531e40c | [] | no_license | Kyle0432/Small_items | 78f3ed4b31a4dbaae90fa2cb8bb3cbd666817ec7 | 4ae1fed8fcf8c29c21f0af644a19e3ce8654d085 | refs/heads/master | 2022-12-27T21:19:45.507128 | 2019-10-28T13:44:01 | 2019-10-28T13:44:01 | 213,136,125 | 0 | 0 | null | 2022-12-16T11:35:43 | 2019-10-06T08:52:43 | Java | GB18030 | Java | false | false | 3,854 | java | package com.kyle.ssh.actions;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.util.Map;
import org.apache.struts2.interceptor.RequestAware;
import com.kyle.ssh.entities.Employee;
import com.kyle.ssh.service.DepartmentService;
import com.kyle.ssh.service.EmployeeService;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
import com.opensymphony.xwork2.Preparable;
public class EmployeeAction extends ActionSupport
implements RequestAware,ModelDriven<Employee>,Preparable{
private static final long serialVersionUID = 1L;
private EmployeeService employeeService;
public void setEmployeeService(EmployeeService employeeService) {
this.employeeService = employeeService;
}
private DepartmentService departmentService;
public void setDepartmentService(DepartmentService departmentService) {
this.departmentService = departmentService;
}
private Integer id;
public void setId(Integer id) {
this.id = id;
}
private Map<String,Object> request;
@Override
public void setRequest(Map<String, Object> arg0) {
this.request = arg0;
}
private Employee model;
@Override
public Employee getModel() {
return model;
}
@Override
public void prepare() throws Exception {
}
// 表示把查询出来的全部的employees放到集合里 然后再从list.jsp页面里去获取集合里面的每一条记录
public String list(){
request.put("employees", employeeService.getAll());
return "list";
}
//表示把查询出来的全部的departments发到集合里去,然后再input.jsp页面获取集合的记录
public String input(){
request.put("departments",departmentService.getAll());
return INPUT;
}
//为input()做准备,如果id不为null就执行if体里面的代码,然后执行完在去执行input()方法
public void prepareInput(){
if(id != null){
//表示从数据库中通过id获取对象,然后放到值栈的栈顶,然后导目标页面自动的回显
model = employeeService.get(id);
}
}
//可以根据是否有id来判断是否新是添加还是修改操作
public String save(){
if(id == null){
model.setCreateTime(new Date());
}
employeeService.saveOrUpdate(model);
return SUCCESS;
}
//可以根据id来判断save方法准备的model是new 的还是从数据库获取的!
public void prepareSave(){
if(id == null){
model = new Employee();
}else{
//表示先从数据库里获取一个对象,然后表单提交时修改获取该对象部分的属性,而有些数据没修改还是数据库里面的
//在进行update就可以了
model = employeeService.get(id);
}
}
//使用ajax操作
private InputStream inputStream;
public InputStream getInputStream(){
return inputStream;
}
public String delete(){
employeeService.delete(id);
try { //这里的1表示删除成功
inputStream = new ByteArrayInputStream("1".getBytes("UTF-8"));
} catch (Exception e) {
e.printStackTrace();
try { //这里的0表示删除失败
inputStream = new ByteArrayInputStream("0".getBytes("UTF-8"));
} catch (UnsupportedEncodingException e1) {
e1.printStackTrace();
}
}
return "ajax-success";
}
//
public String lastName;
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String validateLastName() throws UnsupportedEncodingException{
if(employeeService.lastNamelsValid(lastName)){
inputStream = new ByteArrayInputStream("1".getBytes("UTF-8"));
}else{
inputStream = new ByteArrayInputStream("0".getBytes("UTF-8"));
}
return "ajax-success";
}
}
| [
"[email protected]"
] | |
3868df98847e1f27625614b86359127abe591e8d | 01dbc3a7279a44be7a6e5751988c582f9bc1b920 | /src/no/hvl/dat110/nrf/addressing/Datagram.java | 60db1b766e25d74755bf2c6acde2bb3d5dc62d25 | [] | no_license | lmkr/dat110-nrf | 3967946fd3f9b5d0318674cfe2a5da9d2c5839eb | 3abd7dc3c6da171722d5cb1d84a5d1a0642c9ef7 | refs/heads/master | 2022-05-03T13:44:49.020087 | 2022-03-31T18:53:13 | 2022-03-31T18:53:13 | 248,461,993 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,230 | java | package no.hvl.dat110.nrf.addressing;
public class Datagram {
static int id = 1;
// header
private IPAddress source, destination;
private int identifier;
private DatagramType type;
// payload
private byte[] data;
public Datagram(IPAddress source, IPAddress destination, DatagramType type, byte[] data) {
super();
this.source = source;
this.destination = destination;
this.data = data;
this.type = type;
id++;
}
public Datagram(IPAddress source, IPAddress destination, int id, DatagramType type, byte[] data) {
super();
this.source = source;
this.destination = destination;
this.data = data;
this.type = type;
this.identifier = id;
}
public IPAddress getSource() {
return source;
}
public IPAddress getDestination() {
return destination;
}
public byte[] getData() {
return data;
}
public DatagramType getType() {
return type;
}
@Override
public String toString() {
return "Datagram [source=" + source + ", destination=" + destination + ", id=" + identifier + ", type=" + type + ", data="
+ data.toString() + "]";
}
public Datagram clone () {
return new Datagram(this.source,this.destination,this.identifier, this.type, this.data.clone());
}
}
| [
"[email protected]"
] | |
9478a77273731ce4e89a96b9527ef913b1fa55e2 | 59d56ad52a7e016883b56b73761104a17833a453 | /src/main/java/com/whatever/AllergyService/ProductType.java | 9f4127bfec24f4639c4929de12c5ba74b53c6718 | [] | no_license | zapho/cxf-client-quarkus | 3c330a3a5f370cce21c5cd1477ffbe274d1bba59 | 6e147d44b9ea9cc455d52f0efe234ef787b336c4 | refs/heads/master | 2023-01-22T03:33:27.579072 | 2020-12-08T14:55:27 | 2020-12-08T14:55:27 | 319,641,033 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,148 | java |
package com.whatever.AllergyService;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Classe Java pour ProductType.
*
* <p>Le fragment de schéma suivant indique le contenu attendu figurant dans cette classe.
* <p>
* <pre>
* <simpleType name="ProductType">
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <enumeration value="VIDAL"/>
* <enumeration value="DIETETIC"/>
* <enumeration value="VETERINARY"/>
* <enumeration value="NON_PHARMACEUTICAL"/>
* <enumeration value="ACCESSORY"/>
* <enumeration value="MISCELLANEOUS"/>
* <enumeration value="HOMEOPATHIC"/>
* <enumeration value="BALNEOLOGY"/>
* </restriction>
* </simpleType>
* </pre>
*
*/
@XmlType(name = "ProductType")
@XmlEnum
public enum ProductType {
VIDAL,
DIETETIC,
VETERINARY,
NON_PHARMACEUTICAL,
ACCESSORY,
MISCELLANEOUS,
HOMEOPATHIC,
BALNEOLOGY;
public String value() {
return name();
}
public static ProductType fromValue(String v) {
return valueOf(v);
}
}
| [
"[email protected]"
] | |
53f473c1ae042685882a6de0ba85b84322f85c06 | 3bd6dcf28c1ad127a1b8d579a866c31bc061a239 | /SampleLinearLayout/app/src/androidTest/java/com/speldipn/example/samplelinearlayout/ExampleInstrumentedTest.java | 72e054431c60baa3725377093d214351df158c23 | [] | no_license | speldipn/fc_android | e000a2e758006791c43b7dc01a4a34ae7d405901 | 5fd233517d40a280014ffa799b55227138e5cf3f | refs/heads/master | 2020-03-19T12:49:51.664432 | 2018-06-07T23:48:19 | 2018-06-07T23:48:19 | 136,543,108 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 744 | java | package com.speldipn.example.samplelinearlayout;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.speldipn.example.samplelinearlayout", appContext.getPackageName());
}
}
| [
"[email protected]"
] | |
d6592088150593fbda417e69f2bdf91259b7cdbe | f5e3ff1a7972428d1488e417094f50bfeed505dd | /equManSysForScan/src/main/java/com/ecust/equsys/base/impl/vesseldetail/VesselCheckPager.java | 2216219eef13e0053d8e23bb7ae2d52f1da32cec | [] | no_license | ArexChu/SSEI_KT | 2a7414930b7f971682ed9f88b0711d97a74b3b1f | b4876906c1436746e9795e4687a095ab5b166fe8 | refs/heads/master | 2021-06-12T03:01:36.527576 | 2017-01-14T07:57:43 | 2017-01-14T07:57:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,838 | java | package com.ecust.equsys.base.impl.vesseldetail;
import android.app.Activity;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.view.ViewGroup;
import com.ecust.equsys.MainUI;
import com.ecust.equsys.R;
import com.ecust.equsys.base.MenuDetailBasePager;
import com.ecust.equsys.base.MenuDetailUI;
import com.ecust.equsys.base.impl.vesseldetail.data.VesselCheckData;
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.lidroid.xutils.view.annotation.event.OnClick;
import com.viewpagerindicator.TabPageIndicator;
import java.util.ArrayList;
import java.util.List;
public class VesselCheckPager extends MenuDetailBasePager implements ViewPager.OnPageChangeListener{
@ViewInject(R.id.tpi_pipe_menu_manage_detail)
private TabPageIndicator mIndicator;
@ViewInject(R.id.vp_pipe_menu_manage_detail)
private ViewPager mViewPager;
List<MenuDetailBasePager> pipeTabDetailPagers;// 页签对应的页面
String[] indicatorItem = {"压力容器验收检查记录","资料审查及外观检查记录"};// 页签对应的数据
public VesselCheckPager(Activity activity) {
super(activity);
}
@Override
public View initView() {
View view = View.inflate(mActivity, R.layout.menu_head_detail, null);
ViewUtils.inject(this,view);
return view;
}
@Override
public void initData() {
pipeTabDetailPagers= new ArrayList<MenuDetailBasePager>();
/**
* 添加页签对应的页面
*/
pipeTabDetailPagers.add(new MenuDetailUI(mActivity, VesselCheckData.getTab1Data()));
pipeTabDetailPagers.add(new MenuDetailUI(mActivity, VesselCheckData.getTab2Data()));
/**
*
*/
mViewPager.setAdapter(new PipeBusiAdapter());
// 当把ViewPager设置给Indicator时, 自己的OnPageChangeListener事件不可用了, 会被Indicator来响应.
// mViewPager.setOnPageChangeListener(this) 是不管用的
// 给TabPageIndicator关联ViewPager
// 当mIndicator和ViewPager关联起来之后, mIndicator的数据就由关联上的ViewPager的adapter来提供
mIndicator.setViewPager(mViewPager);
mIndicator.setOnPageChangeListener(this);
}
@OnClick(R.id.btn_pipe_manage_menu_detail_next_tab)
public void nextTab(View v) {
// 向下移动一页
mViewPager.setCurrentItem(mViewPager.getCurrentItem() + 1);
}
class PipeBusiAdapter extends PagerAdapter {
/**
* 此方法是给mIndicator提供的页签数据
*/
@Override
public CharSequence getPageTitle(int position) {
return indicatorItem[position];
}
@Override
public int getCount() {
return pipeTabDetailPagers.size();
}
@Override
public boolean isViewFromObject(View view, Object object) {
return view==object ;
}
@Override
public Object instantiateItem(ViewGroup container, int position) {
MenuDetailBasePager pager = pipeTabDetailPagers.get(position);
container.addView(pager.rootView);
pager.initData(); // 加载数据
return pager.rootView;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
container.removeView((View) object);
}
}
@Override
public void onPageScrolled(int position, float positionOffset,
int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
if(position == 0) {
// 当前是第一个页签, 可以把左侧菜单拖拽出来
((MainUI) mActivity).getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
} else {
// 当前不是第一个页签, 不可以把左侧菜单拖拽出来, 应该响应ViewPager页面切换的事件
((MainUI) mActivity).getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE);
}
}
@Override
public void onPageScrollStateChanged(int state) {
}
}
| [
"[email protected]"
] | |
c327dbed60baef5ae192fb17f31aad6e5492177b | f3cc23590d8bc95fb0f3f5eff0513a63a3bf7e5e | /src/mstergui/ArticleDBForm.java | a7f46935e6ba3fe5a67d1485772e37e5c7a3539c | [] | no_license | Seriivolk/MasterGUI | d3d44f53516c09b43fa71a4f587f4996909bca46 | 7bb3599f9f0c34c28e92f6fa5d095c2a8ba19466 | refs/heads/master | 2021-01-19T09:42:29.031311 | 2015-08-06T09:11:18 | 2015-08-06T09:11:18 | 40,295,288 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,856 | java | package mstergui;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
public class ArticleDBForm extends JFrame{
String[] clases ={"","Politic","Economic","Sport"};
String fromTexField;
String fromComboBox;
String bpath;
String path;
String relativePath;
ArticleDBForm(String str){
if (str.length()>20){
JTextField textField = new JTextField(15);
JComboBox comboBox = new JComboBox(clases);
setTitle("Save form");
add(new JLabel("Set the article title:"));
add(textField);
add(new JLabel("Choose the article class "));
add(comboBox);
JButton but=new JButton();
but.setText("Save the article");
add(but);
but.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e){
fromTexField = textField.getText();
fromComboBox = (String) comboBox.getSelectedItem();
int i=0;
if (fromTexField.length()>4 && fromComboBox!=""){
switch (fromComboBox) {
case "Politic": i=1;
break;
case "Economic": i=2;
break;
case "Sport": i=3;
break;
}
}else JOptionPane.showMessageDialog(null, "article title or article class not filled");
bpath = (fromTexField.replaceAll("\\p{Punct}", "").replaceAll(" ", "_"));
if( bpath.length() > 70 ) {
path = bpath.substring(0,70)+".txt";
} else path = bpath+".txt";
try {
relativePath=saveFile(str,path,i);
} catch (IOException ex) {
Logger.getLogger(ArticleDBForm.class.getName()).log(Level.SEVERE, null, ex);
}
String newPath = relativePath.replaceAll("\\\\", ",");
insertIntoDB1(fromTexField,newPath,i);
/*System.out.println("Article title: " + fromTexField);
System.out.println("Article class " + fromComboBox);
System.out.println("Article bpath " + bpath);
System.out.println("Article path " + path);
System.out.println("Article path " + newPath);*/
dispose();
}
});
setLayout(new FlowLayout());
setSize(300,200);
setResizable(false);
setVisible(true);
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
} else JOptionPane.showMessageDialog(null, "The article is very small");
}
private void insertIntoDB1(String article, String artpath, int clas) {
String articleTitle = article;
String articlePath = artpath;
int i=clas;
Connection connection = null;
Statement stmt = null;
try
{
Class.forName("com.mysql.jdbc.Driver");
connection = DriverManager
.getConnection("jdbc:mysql://localhost:3306/masterdb", "testuser", "test623");
stmt = connection.createStatement();
stmt.execute("INSERT INTO `masterdb`.`articles` (`articlename`, `articlepath`, `articleclass_id`) VALUES ('"+articleTitle+"', '"+articlePath+"', '"+i+"');");
JOptionPane.showMessageDialog(null, articleTitle+"\nSaved in DB");
}
catch (Exception e) {
e.printStackTrace();
}finally {
try {
stmt.close();
connection.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
private String saveFile (String str, String pth, int i) throws IOException{
Files file=null;
String article = str;
String localPath=pth;
int b = i;
Path path=null;
if (b==1){
path = Paths.get("src\\mstergui\\Articles\\Politic\\"+localPath);
}else if(b==2){
path = Paths.get("src\\mstergui\\Articles\\Economic\\"+localPath);
}else if(b==3){
path = Paths.get("src\\mstergui\\Articles\\Sport\\"+localPath);
}
Path inputPath = path;
Path fullPath = inputPath.toAbsolutePath();
file.createFile(path);
PrintWriter writer = new PrintWriter(path.toString(), "UTF-8");
String[] lines = article.split("\n");
for (int j=0; j<lines.length; j++)
writer.println(lines[j]);
writer.close();
JOptionPane.showMessageDialog(null, fullPath+"\ncreated in file system");
return fullPath.toString();
}
}
| [
"[email protected]"
] | |
351d25d65a5894daab3cd1d0b5d20ad92efd6909 | 6c2918442221679fc9bb3895f0a182c3443f947f | /app/src/main/java/com/example/warmcheng/mydemotest/MainActivity.java | a041b9a7f01b13ffefc47a254b58c9001d449d2d | [] | no_license | warmcheng/MyDemoTest | 16a2e2d12a615dce6fd4dab678814a2aa2fdcbcf | e0949048f1b67cddb20c47ce1b4f394a12c77507 | refs/heads/master | 2020-03-18T11:14:39.837398 | 2018-05-24T04:01:50 | 2018-05-24T04:01:50 | 134,648,603 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 345 | java | package com.example.warmcheng.mydemotest;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
| [
"[email protected]"
] | |
a140eeda3468035eec30c01af8ce964bf005cece | 1fdd1ec4d88c7aee27faa924cc63e36eaa6fa318 | /LeetCode/0733/src/Solution.java | 18622942fb6d6ac65ec518dd021fcd44c913ca4a | [] | no_license | oldhooves/Algorithm-Leetcode | 68fc70340bb2bf1290b59e5c2f04e3fc9d692f7a | 85065ab90a1c057fa78fd48fc947347abdd28faf | refs/heads/master | 2020-03-27T00:39:14.537538 | 2019-04-05T06:50:02 | 2019-04-05T06:50:02 | 145,640,511 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 818 | java | /**
* 733. 图像渲染
* https://leetcode-cn.com/problems/flood-fill/description/
* Created by ${laotizi} on 2019-03-07.
*/
class Solution {
public int[][] floodFill(int[][] image, int sr, int sc, int newColor) {
if (image[sr][sc] == newColor) {
return image;
}
fill(image,sr,sc,image[sr][sc],newColor);
return image;
}
private void fill(int[][] image, int sr, int sc, int color, int newColor) {
if (sr < 0 || sr >= image.length || sc < 0 || sc >= image[0].length || image[sr][sc] != color) {
return;
}
image[sr][sc] = newColor;
fill(image,sr + 1,sc,color,newColor);
fill(image,sr - 1,sc,color,newColor);
fill(image,sr,sc + 1,color,newColor);
fill(image,sr,sc - 1,color,newColor);
}
} | [
"[email protected]"
] | |
99cf0b0f1cb2f0be8a2197dc546a3402696b75da | 850dde7b5f842ca01cc8bd8c0a9e92af41589c05 | /src/Lsimulator/server/server/model/map/TextMapReader.java | d7a22b44f8a89edb98f66ab66d2359689795c6e3 | [] | no_license | Brucelivingsource/GitHub | c72fe7edb7769807a0e81a95434633c3aab46ac7 | 393ad4c202b1f0f198b73823d1543696bed44dce | refs/heads/master | 2021-01-11T10:06:41.442237 | 2016-01-11T14:54:41 | 2016-01-11T14:55:33 | 49,363,678 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 33,308 | java | /**
* License
* THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS
* CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE").
* THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW.
* ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR
* COPYRIGHT LAW IS PROHIBITED.
*
* BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND
* AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE
* MAY BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED
* HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS.
*
*/
package Lsimulator.server.server.model.map;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.LineNumberReader;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.logging.Level;
import java.util.logging.Logger;
import Lsimulator.server.server.datatables.MapsTable;
import Lsimulator.server.server.utils.FileUtil;
import Lsimulator.server.server.utils.collections.Lists;
import Lsimulator.server.server.utils.collections.Maps;
/**
* 地圖 (maps/\d*.txt)讀取
*/
public class TextMapReader extends MapReader {
/** 紀錄用 */
private static Logger _log = Logger.getLogger(TextMapReader.class.getName());
/** 地圖的路徑 */
private static final String MAP_DIR = "./maps/";
/** MAP_INFO 中編號的位置 */
public static final int MAPINFO_MAP_NO = 0;
/** MAP_INFO 開始X座標的位置 */
public static final int MAPINFO_START_X = 1;
/** MAP_INFO 結束X座標的位置 */
public static final int MAPINFO_END_X = 2;
/** MAP_INFO 開始Y座標的位置 */
public static final int MAPINFO_START_Y = 3;
/** MAP_INFO 結束Y座標的位置 */
public static final int MAPINFO_END_Y = 4;
/**
* 依照輸入大小讀取指定編號地圖
*
* @param mapId
* 地圖編號
* @param xSize
* X座標大小
* @param ySize
* Y座標大小
* @return byte[][]
* @throws IOException
*/
public byte[][] read(final int mapId, final int xSize, final int ySize)
throws IOException {
byte[][] map = new byte[xSize][ySize];
LineNumberReader in = new LineNumberReader(new BufferedReader(
new FileReader(MAP_DIR + mapId + ".txt")));
int y = 0;
String line;
while ((line = in.readLine()) != null) {
if ((line.trim().length() == 0) || line.charAt(0)=='#' ) {
continue; // 跳過空行與註解
}
int x = 0;
StringTokenizer tok = new StringTokenizer(line, ",");
while (tok.hasMoreTokens()) {
byte tile = Byte.parseByte(tok.nextToken());
map[x][y] = tile;
x++;
}
y++;
}
in.close();
return map;
}
/**
* 讀取指定編號的地圖
*
* @param id
* 地圖編號
* @return LsimulatorMap
* @throws IOException
*/
@Override
public LsimulatorMap read(final int id) throws IOException {
for (int[] info : MAP_INFO) {
int mapId = info[MAPINFO_MAP_NO];
int xSize = info[MAPINFO_END_X] - info[MAPINFO_START_X] + 1;
int ySize = info[MAPINFO_END_Y] - info[MAPINFO_START_Y] + 1;
if (mapId == id) {
LsimulatorV1Map map = new LsimulatorV1Map((short) mapId, this.read(mapId,
xSize, ySize), info[MAPINFO_START_X],
info[MAPINFO_START_Y], MapsTable.getInstance()
.isUnderwater(mapId), MapsTable.getInstance()
.isMarkable(mapId), MapsTable.getInstance()
.isTeleportable(mapId), MapsTable.getInstance()
.isEscapable(mapId), MapsTable.getInstance()
.isUseResurrection(mapId), MapsTable
.getInstance().isUsePainwand(mapId), MapsTable
.getInstance().isEnabledDeathPenalty(mapId),
MapsTable.getInstance().isTakePets(mapId), MapsTable
.getInstance().isRecallPets(mapId), MapsTable
.getInstance().isUsableItem(mapId), MapsTable
.getInstance().isUsableSkill(mapId));
return map;
}
}
throw new FileNotFoundException("地圖編號: " + id);
}
/**
* 取得所有地圖與編號的 Mapping
*
* @return Map
* @throws IOException
*/
@Override
public Map<Integer, LsimulatorMap> read() throws IOException {
Map<Integer, LsimulatorMap> maps = Maps.newMap();
for (int[] info : MAP_INFO) {
int mapId = info[MAPINFO_MAP_NO];
int xSize = info[MAPINFO_END_X] - info[MAPINFO_START_X] + 1;
int ySize = info[MAPINFO_END_Y] - info[MAPINFO_START_Y] + 1;
try {
LsimulatorV1Map map = new LsimulatorV1Map((short) mapId, this.read(mapId,
xSize, ySize), info[MAPINFO_START_X],
info[MAPINFO_START_Y], MapsTable.getInstance()
.isUnderwater(mapId), MapsTable.getInstance()
.isMarkable(mapId), MapsTable.getInstance()
.isTeleportable(mapId), MapsTable.getInstance()
.isEscapable(mapId), MapsTable.getInstance()
.isUseResurrection(mapId), MapsTable
.getInstance().isUsePainwand(mapId), MapsTable
.getInstance().isEnabledDeathPenalty(mapId),
MapsTable.getInstance().isTakePets(mapId), MapsTable
.getInstance().isRecallPets(mapId), MapsTable
.getInstance().isUsableItem(mapId), MapsTable
.getInstance().isUsableSkill(mapId));
maps.put(mapId, map);
} catch (IOException e) {
_log.log(Level.SEVERE, e.getLocalizedMessage(), e);
}
}
return maps;
}
/**
* 傳回所有地圖的編號
*
* @return ArraryList
*/
public static List<Integer> listMapIds() {
List<Integer> ids = Lists.newList();
File mapDir = new File(MAP_DIR);
for (String name : mapDir.list()) {
File mapFile = new File(mapDir, name);
if (!mapFile.exists()) {
continue;
}
if (!FileUtil.getExtension(mapFile).toLowerCase().equals("txt")) {
continue;
}
int id = 0;
try {
String idStr = FileUtil.getNameWithoutExtension(mapFile);
id = Integer.parseInt(idStr);
} catch (NumberFormatException e) {
continue;
}
ids.add(id);
}
return ids;
}
/**
* mapInfo:地圖編號、地圖構成大小. 格式為 {mapNo,StartX,EndX,StartY,EndY}
* 地圖編號與名稱, 請自行參照用戶端 Text.idx與 Text.pak 裡包的zone*.tbl等檔案
*/
private static final int[][] MAP_INFO = {
{ 0, 32256, 32767, 32768, 33279 },
{ 1, 32576, 32831, 32704, 32959 },
{ 2, 32576, 32895, 32704, 32959 },
{ 3, 32576, 32831, 32704, 32959 },
{ 4, 32448, 34303, 32064, 33599 },
{ 5, 32704, 32767, 32768, 32831 },
{ 6, 32704, 32831, 32768, 32831 },
{ 7, 32640, 32895, 32640, 32895 },
{ 8, 32640, 32895, 32640, 32895 },
{ 9, 32640, 32895, 32640, 32895 },
{ 10, 32640, 32831, 32640, 32895 },
{ 11, 32640, 32895, 32640, 32895 },
{ 12, 32640, 32895, 32640, 32895 },
{ 13, 32640, 32895, 32640, 32895 },
{ 14, 32512, 33023, 32704, 32895 },
{ 15, 32704, 32767, 32768, 32831 },
{ 16, 32704, 32831, 32704, 32895 },
{ 17, 32704, 32767, 32768, 32831 },
{ 18, 32704, 32767, 32768, 32831 },
{ 19, 32704, 32895, 32640, 32895 },
{ 20, 32704, 32831, 32704, 32831 },
{ 21, 32640, 32831, 32704, 32895 },
{ 22, 32640, 32895, 32640, 32895 },
{ 23, 32640, 32895, 32640, 32895 },
{ 24, 32640, 32895, 32640, 32895 },
{ 25, 32704, 32895, 32704, 32831 },
{ 26, 32704, 32895, 32640, 32895 },
{ 27, 32640, 32895, 32704, 32895 },
{ 28, 32640, 32895, 32704, 32895 },
{ 29, 32704, 32767, 32768, 32831 },
{ 30, 32640, 32895, 32640, 32895 },
{ 31, 32640, 32895, 32640, 32895 },
{ 32, 32576, 32831, 32704, 32959 },
{ 33, 32576, 32831, 32704, 32959 },
{ 34, 32640, 32831, 32704, 32895 },
{ 35, 32576, 32831, 32704, 32959 },
{ 36, 32576, 32831, 32704, 32959 },
{ 37, 32576, 32831, 32704, 32959 },
{ 38, 32640, 32831, 32704, 32895 },
{ 39, 32640, 32831, 32704, 32895 },
{ 40, 32640, 32831, 32704, 32895 },
{ 41, 32640, 32831, 32704, 32895 },
{ 42, 32512, 32831, 32704, 33023 },
{ 43, 32704, 32831, 32704, 32831 },
{ 44, 32704, 32831, 32704, 32831 },
{ 45, 32704, 32831, 32704, 32831 },
{ 46, 32704, 32831, 32704, 32831 },
{ 47, 32704, 32831, 32704, 32831 },
{ 48, 32704, 32831, 32704, 32831 },
{ 49, 32704, 32831, 32704, 32831 },
{ 50, 32704, 32831, 32704, 32831 },
{ 51, 32640, 32831, 32704, 32895 },
{ 52, 32640, 32767, 32768, 32895 },
{ 53, 32640, 32895, 32640, 32895 },
{ 54, 32640, 32895, 32640, 32895 },
{ 55, 32640, 32831, 32704, 32959 },
{ 56, 32640, 32895, 32640, 32895 },
{ 57, 32576, 33023, 32512, 32959 },
{ 58, 32512, 32831, 32704, 33023 },
{ 59, 32640, 32831, 32768, 32895 },
{ 60, 32640, 32767, 32768, 32959 },
{ 61, 32640, 32767, 32768, 32895 },
{ 62, 32640, 32767, 32768, 32895 },
{ 63, 32576, 32895, 32640, 32959 },
{ 64, 32512, 32639, 32768, 32895 },
{ 65, 32704, 32831, 32768, 32895 },
{ 66, 32704, 32895, 32768, 32959 },
{ 67, 32640, 32831, 32704, 32895 },
{ 68, 32576, 33023, 32512, 32959 },
{ 69, 32512, 32831, 32704, 33023 },
{ 70, 32576, 33023, 32640, 33087 },
{ 72, 32704, 32895, 32768, 32895 },
{ 73, 32704, 32959, 32704, 32959 },
{ 74, 32704, 32895, 32768, 32959 },
{ 75, 32704, 32831, 32768, 32959 },
{ 76, 32704, 32831, 32768, 32895 },
{ 77, 32704, 32831, 32768, 32895 },
{ 78, 32832, 32959, 32704, 32831 },
{ 79, 32704, 32831, 32768, 32895 },
{ 80, 32704, 32831, 32768, 32895 },
{ 81, 32704, 32831, 32768, 32895 },
{ 82, 32640, 32767, 32768, 32895 },
{ 83, 32704, 32831, 32768, 32831 },
{ 84, 32704, 32767, 32768, 32831 },
{ 85, 32512, 32831, 32640, 32959 },
{ 86, 32768, 33023, 32704, 32895 },
{ 87, 32704, 32767, 32768, 32831 },
{ 88, 33472, 33599, 32640, 32767 },
{ 89, 32640, 32767, 32832, 32959 },
{ 90, 32640, 32767, 32832, 32959 },
{ 91, 32640, 32767, 32832, 32959 },
{ 92, 32640, 32767, 32832, 32959 },
{ 93, 32640, 32767, 32832, 32959 },
{ 94, 32640, 32767, 32832, 32959 },
{ 95, 32640, 32767, 32832, 32959 },
{ 96, 32640, 32767, 32832, 32959 },
{ 97, 32640, 32767, 32832, 32959 },
{ 98, 32640, 32767, 32832, 32959 },
{ 99, 32704, 32767, 32768, 32831 },
{ 100, 32704, 32831, 32768, 32895 },
{ 101, 32704, 32895, 32704, 32895 },
{ 102, 32704, 32895, 32704, 32895 },
{ 103, 32704, 32895, 32704, 32895 },
{ 104, 32576, 32767, 32768, 32959 },
{ 105, 32576, 32767, 32768, 32959 },
{ 106, 32576, 33855, 32768, 32959 },
{ 107, 32576, 32767, 32768, 32959 },
{ 108, 32576, 32767, 32768, 32959 },
{ 109, 32576, 32767, 32768, 32959 },
{ 110, 32704, 32895, 32704, 32895 },
{ 111, 32576, 32767, 32768, 32959 },
{ 112, 32704, 32895, 32704, 32895 },
{ 113, 32704, 32895, 32704, 32895 },
{ 114, 32576, 32767, 32768, 32959 },
{ 115, 32576, 32767, 32768, 32959 },
{ 116, 32704, 32831, 32832, 32895 },
{ 117, 32576, 32767, 32768, 32959 },
{ 118, 32576, 32767, 32768, 32959 },
{ 119, 32576, 32767, 32768, 32959 },
{ 120, 32704, 32895, 32704, 32895 },
{ 121, 32576, 32767, 32768, 32959 },
{ 122, 32704, 32895, 32704, 32895 },
{ 123, 32704, 32895, 32704, 32895 },
{ 124, 32576, 32767, 32768, 32959 },
{ 125, 32576, 32767, 32768, 32959 },
{ 126, 32704, 32831, 32832, 32895 },
{ 127, 32576, 32767, 32768, 32959 },
{ 128, 32576, 32767, 32768, 32959 },
{ 129, 32576, 32767, 32768, 32959 },
{ 130, 32704, 32895, 32704, 32895 },
{ 131, 32576, 32767, 32768, 32959 },
{ 132, 32704, 32895, 32704, 32895 },
{ 133, 32704, 32895, 32704, 32895 },
{ 134, 32576, 32767, 32768, 32959 },
{ 135, 32576, 32767, 32768, 32959 },
{ 136, 32704, 32831, 32832, 32895 },
{ 137, 32576, 32767, 32768, 32959 },
{ 138, 32576, 32767, 32768, 32959 },
{ 139, 32576, 32767, 32768, 32959 },
{ 140, 32704, 32895, 32704, 32895 },
{ 141, 32576, 32767, 32768, 32959 },
{ 142, 32704, 32895, 32704, 32895 },
{ 143, 32704, 32895, 32704, 32895 },
{ 144, 32576, 32767, 32768, 32959 },
{ 145, 32576, 32767, 32768, 32959 },
{ 146, 32576, 32831, 32768, 32959 },
{ 147, 32576, 32767, 32768, 32959 },
{ 148, 32576, 32767, 32768, 32959 },
{ 149, 32576, 32767, 32768, 32959 },
{ 150, 32704, 32895, 32704, 32895 },
{ 151, 32576, 32767, 32768, 32959 },
{ 152, 32576, 32767, 32768, 32959 },
{ 153, 32576, 32767, 32768, 32959 },
{ 154, 32704, 32895, 32704, 32895 },
{ 155, 32704, 32895, 32704, 32895 },
{ 156, 32704, 32831, 32768, 32831 },
{ 157, 32576, 32767, 32768, 32959 },
{ 158, 32576, 32767, 32768, 32959 },
{ 159, 32576, 32767, 32768, 32959 },
{ 160, 32576, 32767, 32768, 32959 },
{ 161, 32576, 32767, 32768, 32959 },
{ 162, 32576, 32767, 32768, 32959 },
{ 163, 32576, 32767, 32768, 32959 },
{ 164, 32704, 32895, 32704, 32895 },
{ 165, 32704, 32895, 32704, 32895 },
{ 166, 32704, 32831, 32768, 32831 },
{ 167, 32576, 32767, 32768, 32959 },
{ 168, 32576, 32767, 32768, 32959 },
{ 169, 32576, 32767, 32768, 32959 },
{ 170, 32576, 32767, 32768, 32959 },
{ 171, 32576, 32767, 32768, 32959 },
{ 172, 32576, 32767, 32768, 32959 },
{ 173, 32576, 32767, 32768, 32959 },
{ 174, 32704, 32895, 32704, 32895 },
{ 175, 32704, 32895, 32704, 32895 },
{ 176, 32704, 32831, 32768, 32831 },
{ 177, 32576, 32767, 32768, 32959 },
{ 178, 32576, 32767, 32768, 32959 },
{ 179, 32576, 32767, 32768, 32959 },
{ 180, 32576, 32767, 32768, 32959 },
{ 181, 32576, 32767, 32768, 32959 },
{ 182, 32576, 32767, 32768, 32959 },
{ 183, 32576, 32767, 32768, 32959 },
{ 184, 32704, 32895, 32704, 32895 },
{ 185, 32704, 32895, 32704, 32895 },
{ 186, 32704, 32831, 32768, 32831 },
{ 187, 32576, 32767, 32768, 32959 },
{ 188, 32576, 32767, 32768, 32959 },
{ 189, 32576, 32767, 32768, 32959 },
{ 190, 32576, 32767, 32768, 32959 },
{ 191, 32576, 32767, 32768, 32959 },
{ 192, 32576, 32767, 32768, 32959 },
{ 193, 32576, 32767, 32768, 32959 },
{ 194, 32704, 32895, 32704, 32895 },
{ 195, 32704, 32895, 32704, 32895 },
{ 196, 32704, 32831, 32768, 32831 },
{ 197, 32576, 32767, 32768, 32959 },
{ 198, 32576, 32767, 32768, 32959 },
{ 199, 32576, 32767, 32768, 32959 },
{ 200, 32576, 32831, 32768, 33023 },
{ 201, 32640, 33535, 32704, 32959 },
{ 202, 32640, 33535, 32704, 32895 },
{ 203, 32640, 33535, 32704, 32895 },
{ 204, 32640, 33535, 32704, 32895 },
{ 205, 32640, 33535, 32704, 32895 },
{ 206, 32640, 33535, 32704, 32895 },
{ 207, 32640, 33535, 32704, 32895 },
{ 208, 32640, 33535, 32704, 32895 },
{ 209, 32704, 32767, 32768, 32831 },
{ 210, 32640, 33535, 32704, 32895 },
{ 211, 32640, 33535, 32704, 32895 },
{ 213, 32704, 32767, 32768, 32831 },
{ 217, 32640, 32767, 32768, 32831 },
{ 221, 32640, 32895, 32640, 32895 },
{ 237, 32704, 32767, 32768, 32831 },
{ 240, 32640, 32767, 33024, 33151 },
{ 241, 32704, 32831, 32832, 32959 },
{ 242, 32704, 32831, 32896, 33087 },
{ 243, 32640, 32767, 32832, 33023 },
{ 244, 32704, 33023, 32768, 33087 },
{ 248, 32704, 32831, 32768, 32895 },
{ 249, 32704, 32831, 32832, 32895 },
{ 250, 32704, 32831, 32768, 32895 },
{ 251, 32768, 32831, 32768, 32831 },
{ 252, 32576, 32767, 32832, 32895 },
{ 253, 32704, 32831, 32832, 33023 },
{ 254, 32576, 32767, 32768, 32959 },
{ 255, 32640, 32831, 32768, 32895 },
{ 256, 32640, 32895, 32768, 33023 },
{ 257, 32640, 32831, 32768, 32895 },
{ 258, 32576, 32831, 32768, 33151 },
{ 259, 32704, 32767, 32768, 33023 },
{ 261, 32704, 32895, 32768, 32959 },
{ 262, 32704, 32895, 32768, 32959 },
{ 263, 32704, 32895, 32768, 32959 },
{ 264, 32704, 32895, 32768, 32959 },
{ 265, 32704, 32895, 32768, 32959 },
{ 266, 32704, 32895, 32768, 32959 },
{ 267, 32704, 32895, 32768, 32959 },
{ 268, 32704, 32895, 32768, 32959 },
{ 269, 32704, 32895, 32768, 32959 },
{ 270, 32704, 32767, 32768, 32831 },
{ 271, 32704, 32831, 32768, 32895 },
{ 272, 32704, 32831, 32768, 32895 },
{ 273, 32704, 32831, 32768, 32895 },
{ 274, 32704, 32831, 32768, 32895 },
{ 275, 32704, 32831, 32768, 32895 },
{ 276, 32704, 32831, 32768, 32895 },
{ 277, 32704, 32831, 32768, 32895 },
{ 278, 32704, 32895, 32768, 32895 },
{ 279, 32704, 32895, 32768, 32959 },
{ 280, 32832, 32959, 32704, 32831 },
{ 281, 32704, 32831, 32768, 32895 },
{ 282, 32704, 32831, 32768, 32895 },
{ 283, 32704, 32831, 32768, 32895 },
{ 284, 32640, 32767, 32768, 32895 },
{ 285, 32832, 32959, 32704, 32831 },
{ 286, 32704, 32831, 32768, 32895 },
{ 287, 32704, 32831, 32768, 32895 },
{ 288, 32704, 32831, 32768, 32895 },
{ 289, 32640, 32767, 32768, 32895 },
{ 290, 32704, 32895, 32768, 32959 },
{ 291, 32704, 32895, 32768, 32959 },
{ 300, 32832, 32959, 32448, 32639 },
{ 301, 32576, 32767, 32768, 33023 },
{ 302, 32704, 32767, 32832, 32895 },
{ 303, 32576, 32959, 32512, 32895 },
{ 304, 32576, 32959, 32768, 33023 },
{ 305, 32704, 32767, 32768, 32831 },
{ 306, 32512, 32767, 32768, 32959 },
{ 307, 32704, 32959, 32768, 32959 },
{ 308, 32704, 33023, 32768, 32959 },
{ 309, 32704, 33087, 32768, 32959 },
{ 310, 32640, 32895, 32768, 33023 },
{ 320, 32640, 33087, 32768, 33087 },
{ 330, 32640, 32831, 32768, 33023 },
{ 340, 32640, 32895, 32704, 32959 },
{ 350, 32640, 32767, 32768, 32895 },
{ 360, 32640, 32831, 32704, 32895 },
{ 370, 32640, 32831, 32704, 32895 },
{ 400, 32448, 33087, 32576, 33087 },
{ 401, 32704, 32895, 32768, 32895 },
{ 410, 32640, 32959, 32704, 33087 },
{ 420, 32640, 32831, 32832, 33151 },
{ 430, 32640, 33023, 32704, 33087 },
{ 440, 32256, 32767, 32768, 33279 },
{ 441, 32640, 32895, 32704, 32959 },
{ 442, 32704, 32895, 32704, 32895 },
{ 443, 32640, 32895, 32640, 32959 },
{ 444, 32704, 32767, 32768, 32831 },
{ 445, 32704, 32831, 32832, 32895 },
{ 446, 32704, 32831, 32768, 32831 },
{ 447, 32704, 32767, 32768, 32831 },
{ 450, 32576, 32831, 32768, 32959 },
{ 451, 32704, 32895, 32704, 32895 },
{ 452, 32704, 32831, 32768, 32895 },
{ 453, 32704, 32895, 32704, 32895 },
{ 454, 32704, 32895, 32704, 32895 },
{ 455, 32704, 32895, 32768, 32895 },
{ 456, 32704, 32831, 32768, 32895 },
{ 457, 32640, 32767, 32768, 32895 },
{ 460, 32704, 32895, 32768, 32895 },
{ 461, 32640, 32895, 32768, 32895 },
{ 462, 32640, 32895, 32768, 32895 },
{ 463, 32704, 32831, 32768, 32895 },
{ 464, 32704, 32831, 32768, 32895 },
{ 465, 32704, 32831, 32768, 32895 },
{ 466, 32704, 32831, 32768, 32895 },
{ 467, 32640, 32767, 32768, 32895 },
{ 468, 32576, 32703, 32832, 32959 },
{ 470, 32640, 32895, 32768, 32895 },
{ 471, 32704, 32831, 32768, 32895 },
{ 472, 32640, 32831, 32704, 32895 },
{ 473, 32704, 32959, 32768, 32895 },
{ 474, 32704, 32831, 32768, 32895 },
{ 475, 32640, 32831, 32768, 32895 },
{ 476, 32704, 32831, 32704, 32895 },
{ 477, 32704, 32831, 32768, 32959 },
{ 478, 32640, 32831, 32704, 32895 },
{ 480, 32576, 32895, 32768, 33023 },
{ 481, 32640, 32831, 32768, 32895 },
{ 482, 32576, 32831, 32704, 32895 },
{ 483, 32640, 32895, 32704, 32959 },
{ 484, 32704, 32895, 32704, 32895 },
{ 490, 32640, 32767, 32768, 32895 },
{ 491, 32640, 32767, 32704, 32895 },
{ 492, 32704, 32895, 32768, 32895 },
{ 493, 32704, 32831, 32704, 32831 },
{ 494, 32768, 32895, 32704, 32831 },
{ 495, 32704, 32895, 32704, 32895 },
{ 496, 32768, 32895, 32768, 32895 },
{ 500, 32640, 32831, 32704, 32895 },
{ 501, 32576, 33215, 32512, 32959 },
{ 502, 32576, 33215, 32576, 32959 },
{ 503, 32576, 33215, 32576, 32959 },
{ 504, 32576, 33215, 32576, 32959 },
{ 505, 32576, 33215, 32576, 32959 },
{ 506, 32512, 33215, 32576, 32959 },
{ 507, 32704, 33023, 32768, 32959 },
{ 508, 32768, 32895, 33088, 33215 },
{ 509, 32704, 32767, 32768, 32831 },
{ 511, 32576, 33215, 32576, 32895 },
{ 512, 32576, 33215, 32576, 32895 },
{ 513, 32576, 33215, 32576, 32895 },
{ 514, 32576, 33215, 32576, 32895 },
{ 515, 32576, 33215, 32576, 32895 },
{ 516, 32576, 33215, 32576, 32895 },
{ 518, 32640, 32831, 32704, 32895 },
{ 521, 32576, 32767, 32832, 33023 },
{ 522, 32576, 32831, 32832, 32959 },
{ 523, 32576, 32831, 32832, 32959 },
{ 524, 32576, 32831, 32832, 32959 },
{ 530, 32704, 32959, 32768, 32959 },
{ 531, 32704, 32895, 32704, 32959 },
{ 532, 32704, 32895, 32768, 32895 },
{ 533, 32704, 32895, 32768, 33023 },
{ 534, 32704, 32959, 32768, 32895 },
{ 535, 32576, 32895, 32704, 33023 },
{ 536, 32640, 32831, 32704, 32895 },
{ 541, 32640, 32831, 32768, 32895 },
{ 542, 32640, 32831, 32768, 32895 },
{ 543, 32704, 32895, 32704, 32895 },
{ 550, 32384, 32895, 32640, 33151 },
{ 551, 32640, 32767, 32768, 32895 },
{ 552, 32704, 32767, 32768, 32895 },
{ 553, 32704, 32831, 32768, 32895 },
{ 554, 32704, 32831, 32768, 32895 },
{ 555, 32704, 32767, 32768, 32895 },
{ 556, 32704, 32831, 32768, 32895 },
{ 557, 32704, 32831, 32768, 32895 },
{ 558, 32704, 33215, 32768, 33279 },
{ 600, 32640, 32895, 32704, 32895 },
{ 601, 32640, 32959, 32704, 32959 },
{ 602, 32640, 32767, 32768, 32895 },
{ 603, 32640, 32767, 32768, 32895 },
{ 604, 32768, 32895, 32768, 32895 },
{ 605, 32704, 32959, 32704, 32959 },
{ 606, 32640, 32895, 32704, 32895 },
{ 607, 32640, 32895, 32768, 32959 },
{ 608, 32640, 32767, 32832, 32959 },
{ 610, 32640, 32895, 32704, 32959 },
{ 611, 32640, 32895, 32640, 32831 },
{ 612, 32640, 32895, 32704, 32959 },
{ 613, 32640, 32895, 32768, 33023 },
{ 620, 32768, 32831, 32768, 32831 },
{ 621, 32640, 32895, 32768, 32959 },
{ 630, 32704, 33023, 32768, 33087 },
{ 631, 32704, 33087, 32640, 33023 },
{ 632, 32640, 32959, 32576, 32895 },
{ 666, 32640, 32831, 32704, 32895 },
{ 701, 32576, 33023, 32512, 32959 },
{ 725, 33472, 33663, 32576, 32767 },
{ 726, 32640, 32767, 32832, 32959 },
{ 777, 32448, 32831, 32832, 33151 },
{ 778, 32640, 32959, 32576, 33023 },
{ 779, 32768, 33023, 32704, 32895 },
{ 780, 32576, 32831, 32704, 33087 },
{ 781, 32704, 33023, 32704, 32895 },
{ 782, 32704, 32831, 32768, 32895 },
{ 783, 32704, 33343, 32576, 32959 },
{ 784, 32704, 32831, 32832, 32895 },
{ 785, 32640, 32959, 32576, 32895 },
{ 786, 32640, 32959, 32576, 32895 },
{ 787, 32640, 32959, 32576, 32895 },
{ 800, 32704, 32895, 32832, 33023 },
{ 997, 32704, 32767, 32768, 32831 },
{ 998, 32704, 32767, 32768, 32831 },
{ 1000, 32704, 32895, 32768, 32959 },
{ 1001, 32704, 32895, 32768, 32959 },
{ 1002, 32576, 33087, 32512, 33023 },
{ 1003, 32640, 32895, 32832, 32959 },
{ 1004, 32512, 32959, 32512, 32895 },
{ 1005, 32512, 33023, 32576, 33023 },
{ 1006, 32512, 33023, 32576, 33023 },
{ 1007, 32512, 33023, 32576, 33023 },
{ 1008, 32512, 33023, 32576, 33023 },
{ 1009, 32512, 33023, 32576, 33023 },
{ 1010, 32512, 33023, 32576, 33023 },
{ 1011, 32640, 33151, 32448, 32959 },
{ 1012, 32640, 33151, 32448, 32959 },
{ 1013, 32640, 33151, 32448, 32959 },
{ 1014, 32640, 33151, 32448, 32959 },
{ 1015, 32640, 33151, 32448, 32959 },
{ 1016, 32640, 33151, 32448, 32959 },
{ 1017, 32512, 33023, 32768, 33279 },
{ 1018, 32512, 33023, 32768, 33279 },
{ 1019, 32512, 33023, 32768, 33279 },
{ 1020, 32512, 33023, 32768, 33279 },
{ 1021, 32512, 33023, 32768, 33279 },
{ 1022, 32512, 33023, 32768, 33279 },
{ 1023, 32512, 32959, 32704, 33087 },
{ 2000, 32640, 32959, 32704, 33023 },
{ 2001, 32640, 32959, 32704, 33023 },
{ 2002, 32640, 32959, 32704, 33023 },
{ 2003, 32640, 32959, 32704, 33023 },
{ 2004, 32640, 32895, 32768, 32959 },
{ 2005, 32512, 32895, 32704, 33087 },
{ 2006, 32704, 32895, 32768, 32959 },
{ 2007, 32512, 32703, 32640, 32895 },
{ 2010, 32576, 33087, 32512, 32831 },
{ 2011, 32576, 33087, 32512, 32831 },
{ 2100, 32768, 32831, 32768, 32831 },
{ 2101, 32704, 32895, 32768, 32959 },
{ 2151, 32704, 32895, 32768, 32959 },
{ 2201, 32704, 32895, 32768, 32959 },
{ 2202, 32704, 32895, 32768, 32959 },
{ 2203, 32704, 32895, 32768, 32959 },
{ 4301, 32704, 32959, 32768, 33023 },
{ 4831, 32704, 32831, 32768, 32959 },
{ 4941, 32768, 32895, 32704, 32831 },
{ 5001, 32704, 32831, 32704, 32831 },
{ 5002, 32704, 32831, 32704, 32831 },
{ 5003, 32704, 32831, 32704, 32831 },
{ 5004, 32704, 32831, 32704, 32831 },
{ 5005, 32704, 32831, 32704, 32831 },
{ 5006, 32704, 32831, 32704, 32831 },
{ 5007, 32704, 32831, 32704, 32831 },
{ 5008, 32704, 32831, 32704, 32831 },
{ 5009, 32704, 32831, 32704, 32831 },
{ 5010, 32704, 32831, 32704, 32831 },
{ 5011, 32704, 32831, 32704, 32831 },
{ 5012, 32704, 32831, 32704, 32831 },
{ 5013, 32704, 32831, 32704, 32831 },
{ 5014, 32704, 32831, 32704, 32831 },
{ 5015, 32704, 32831, 32704, 32831 },
{ 5016, 32704, 32831, 32704, 32831 },
{ 5017, 32704, 32831, 32704, 32831 },
{ 5018, 32704, 32831, 32704, 32831 },
{ 5019, 32704, 32831, 32704, 32831 },
{ 5020, 32704, 32831, 32704, 32831 },
{ 5021, 32704, 32831, 32704, 32831 },
{ 5022, 32704, 32831, 32704, 32831 },
{ 5023, 32704, 32831, 32704, 32831 },
{ 5024, 32704, 32831, 32704, 32831 },
{ 5025, 32704, 32831, 32704, 32831 },
{ 5026, 32704, 32831, 32704, 32831 },
{ 5027, 32704, 32831, 32704, 32831 },
{ 5028, 32704, 32831, 32704, 32831 },
{ 5029, 32704, 32831, 32704, 32831 },
{ 5030, 32704, 32831, 32704, 32831 },
{ 5031, 32704, 32831, 32704, 32831 },
{ 5032, 32704, 32831, 32704, 32831 },
{ 5033, 32704, 32831, 32704, 32831 },
{ 5034, 32704, 32831, 32704, 32831 },
{ 5035, 32704, 32831, 32704, 32831 },
{ 5036, 32704, 32831, 32704, 32831 },
{ 5037, 32704, 32831, 32704, 32831 },
{ 5038, 32704, 32831, 32704, 32831 },
{ 5039, 32704, 32831, 32704, 32831 },
{ 5040, 32704, 32831, 32704, 32831 },
{ 5041, 32704, 32831, 32704, 32831 },
{ 5042, 32704, 32831, 32704, 32831 },
{ 5043, 32704, 32831, 32704, 32831 },
{ 5044, 32704, 32831, 32704, 32831 },
{ 5045, 32704, 32831, 32704, 32831 },
{ 5046, 32704, 32831, 32704, 32831 },
{ 5047, 32704, 32831, 32704, 32831 },
{ 5048, 32704, 32831, 32704, 32831 },
{ 5049, 32704, 32831, 32704, 32831 },
{ 5050, 32704, 32831, 32704, 32831 },
{ 5051, 32704, 32831, 32704, 32831 },
{ 5052, 32704, 32831, 32704, 32831 },
{ 5053, 32704, 32831, 32704, 32831 },
{ 5054, 32704, 32831, 32704, 32831 },
{ 5055, 32704, 32831, 32704, 32831 },
{ 5056, 32704, 32831, 32704, 32831 },
{ 5057, 32704, 32831, 32704, 32831 },
{ 5058, 32704, 32831, 32704, 32831 },
{ 5059, 32704, 32831, 32704, 32831 },
{ 5060, 32704, 32831, 32704, 32831 },
{ 5061, 32704, 32831, 32704, 32831 },
{ 5062, 32704, 32831, 32704, 32831 },
{ 5063, 32704, 32831, 32704, 32831 },
{ 5064, 32704, 32831, 32704, 32831 },
{ 5065, 32704, 32831, 32704, 32831 },
{ 5066, 32704, 32831, 32704, 32831 },
{ 5067, 32704, 32831, 32704, 32831 },
{ 5068, 32704, 32831, 32768, 32895 },
{ 5069, 32704, 32831, 32768, 32895 },
{ 5070, 32704, 32831, 32768, 32895 },
{ 5071, 32704, 32831, 32768, 32895 },
{ 5072, 32704, 32831, 32768, 32895 },
{ 5073, 32704, 32831, 32768, 32895 },
{ 5074, 32704, 32831, 32768, 32895 },
{ 5075, 32704, 32831, 32768, 32895 },
{ 5076, 32704, 32831, 32768, 32895 },
{ 5077, 32704, 32831, 32768, 32895 },
{ 5078, 32704, 32831, 32768, 32895 },
{ 5079, 32704, 32831, 32768, 32895 },
{ 5080, 32704, 32831, 32768, 32895 },
{ 5081, 32704, 32831, 32768, 32895 },
{ 5082, 32704, 32831, 32768, 32895 },
{ 5083, 32704, 32831, 32768, 32895 },
{ 5084, 32704, 32831, 32768, 32895 },
{ 5085, 32704, 32831, 32768, 32895 },
{ 5086, 32704, 32831, 32768, 32895 },
{ 5087, 32704, 32831, 32768, 32895 },
{ 5088, 32704, 32831, 32768, 32895 },
{ 5089, 32704, 32831, 32768, 32895 },
{ 5090, 32704, 32831, 32768, 32895 },
{ 5091, 32704, 32831, 32768, 32895 },
{ 5092, 32704, 32831, 32768, 32895 },
{ 5093, 32704, 32831, 32768, 32895 },
{ 5094, 32704, 32831, 32768, 32895 },
{ 5095, 32704, 32831, 32768, 32895 },
{ 5096, 32704, 32831, 32768, 32895 },
{ 5097, 32704, 32831, 32768, 32895 },
{ 5098, 32704, 32831, 32768, 32895 },
{ 5099, 32704, 32831, 32768, 32895 },
{ 5100, 32704, 32831, 32768, 32895 },
{ 5101, 32704, 32831, 32768, 32895 },
{ 5102, 32704, 32831, 32768, 32895 },
{ 5103, 32704, 32831, 32768, 32895 },
{ 5104, 32704, 32831, 32768, 32895 },
{ 5105, 32704, 32831, 32768, 32895 },
{ 5106, 32704, 32831, 32768, 32895 },
{ 5107, 32704, 32831, 32768, 32895 },
{ 5108, 32704, 32831, 32768, 32895 },
{ 5109, 32704, 32831, 32768, 32895 },
{ 5110, 32704, 32831, 32768, 32895 },
{ 5111, 32704, 32831, 32768, 32895 },
{ 5112, 32704, 32831, 32768, 32895 },
{ 5113, 32704, 32831, 32768, 32895 },
{ 5114, 32704, 32831, 32768, 32895 },
{ 5115, 32704, 32831, 32768, 32895 },
{ 5116, 32704, 32831, 32768, 32895 },
{ 5117, 32704, 32831, 32768, 32895 },
{ 5118, 32704, 32831, 32768, 32895 },
{ 5119, 32704, 32831, 32768, 32895 },
{ 5120, 32704, 32831, 32768, 32895 },
{ 5121, 32704, 32831, 32768, 32895 },
{ 5122, 32704, 32831, 32768, 32895 },
{ 5123, 32704, 32831, 32768, 32895 },
{ 5124, 32704, 32895, 32704, 32895 },
{ 5125, 32768, 32895, 32768, 32895 },
{ 5131, 32768, 32831, 32832, 32895 },
{ 5132, 32768, 32831, 32832, 32895 },
{ 5133, 32768, 32831, 32832, 32895 },
{ 5134, 32768, 32831, 32832, 32895 },
{ 5140, 32640, 32959, 32704, 32959 },
{ 5141, 32640, 32959, 32704, 32959 },
{ 5142, 32640, 32959, 32704, 32959 },
{ 5143, 32704, 32831, 32768, 32895 },
{ 5144, 32704, 32831, 32768, 32895 },
{ 5145, 32704, 32831, 32768, 32895 },
{ 5153, 32576, 32703, 32832, 32959 },
{ 5166, 32704, 32831, 32768, 32895 },
{ 5167, 32512, 32767, 32704, 32959 },
{ 5168, 32512, 32767, 32704, 32959 },
{ 5169, 32512, 32767, 32704, 32959 },
{ 5170, 32512, 32767, 32704, 32959 },
{ 5171, 32512, 32767, 32704, 32959 },
{ 5172, 32512, 32767, 32704, 32959 },
{ 5173, 32512, 32767, 32704, 32959 },
{ 5174, 32512, 32767, 32704, 32959 },
{ 5175, 32512, 32767, 32704, 32959 },
{ 5176, 32512, 32767, 32704, 32959 },
{ 5177, 32512, 32767, 32704, 32959 },
{ 5178, 32512, 32767, 32704, 32959 },
{ 5179, 32512, 32767, 32704, 32959 },
{ 5180, 32512, 32767, 32704, 32959 },
{ 5181, 32512, 32767, 32704, 32959 },
{ 5182, 32512, 32767, 32704, 32959 },
{ 5183, 32512, 32767, 32704, 32959 },
{ 5184, 32512, 32767, 32704, 32959 },
{ 5185, 32512, 32767, 32704, 32959 },
{ 5186, 32512, 32767, 32704, 32959 },
{ 5187, 32512, 32767, 32704, 32959 },
{ 5188, 32512, 32767, 32704, 32959 },
{ 5189, 32512, 32767, 32704, 32959 },
{ 5190, 32512, 32767, 32704, 32959 },
{ 5191, 32704, 32895, 32768, 32959 },
{ 5192, 32704, 32895, 32768, 32959 },
{ 5193, 32704, 32895, 32768, 32959 },
{ 5194, 32704, 32895, 32768, 32959 },
{ 5195, 32704, 32895, 32768, 32959 },
{ 5196, 32704, 32895, 32768, 32959 },
{ 5197, 32704, 32895, 32768, 32959 },
{ 5198, 32704, 32895, 32768, 32959 },
{ 5199, 32704, 32895, 32768, 32959 },
{ 5200, 32704, 32895, 32768, 32959 },
{ 5300, 32640, 32895, 32704, 32959 },
{ 5301, 32640, 32895, 32704, 32959 },
{ 5302, 32640, 32895, 32704, 32959 },
{ 5303, 32704, 32895, 32768, 32959 },
{ 5384, 32704, 32895, 32640, 32831 },
{ 5435, 32704, 32959, 32704, 32959 },
{ 5501, 32704, 32959, 32832, 33087 },
{ 5551, 32704, 32959, 32832, 33087 },
{ 5554, 32640, 32895, 32704, 32959 },
{ 5701, 32576, 33023, 32512, 32959 },
{ 5801, 32512, 32831, 32704, 33023 },
{ 5802, 32512, 32831, 32704, 33023 },
{ 5803, 32512, 32831, 32704, 33023 },
{ 5804, 32512, 32831, 32704, 33023 },
{ 5805, 32512, 32831, 32704, 33023 },
{ 6041, 32768, 32895, 32768, 32895 },
{ 6051, 32768, 32895, 32768, 32895 },
{ 6201, 32768, 33151, 32768, 33151 },
{ 6202, 32768, 33151, 32768, 33151 },
{ 6203, 32768, 33151, 32768, 33151 },
{ 6301, 32704, 33023, 32768, 33087 },
{ 6302, 32640, 33023, 32576, 33087 },
{ 6303, 32640, 33023, 32576, 33087 },
{ 6311, 32704, 33023, 32640, 32959 },
{ 6312, 32640, 33023, 32576, 32959 },
{ 6313, 32640, 33023, 32576, 32959 },
{ 6321, 32640, 32959, 32576, 32895 },
{ 6322, 32640, 32959, 32576, 32895 },
{ 6323, 32640, 32959, 32576, 32895 },
{ 6801, 32640, 33023, 32576, 32895 },
{ 6901, 32512, 32831, 32704, 33023 },
{ 7001, 32576, 33023, 32640, 33087 },
{ 7100, 32704, 32959, 32832, 33087 },
{ 9000, 32576, 32895, 32640, 33023 },
{ 9100, 32704, 32767, 32832, 32895 },
{ 9101, 32640, 32831, 32768, 32895 },
{ 9102, 32704, 32831, 32768, 32895 },
{ 9202, 32704, 32767, 32832, 32895 },
{ 9990, 32640, 32959, 32576, 32895 },
{ 9991, 32640, 32959, 32576, 32895 },
{ 9992, 32640, 32959, 32576, 32895 },
{ 9993, 32640, 32959, 32576, 32895 },
{ 9994, 32640, 32959, 32576, 32895 },
{ 9995, 32640, 32959, 32576, 32895 },
{ 9996, 32640, 32959, 32576, 32895 },
{ 9997, 32640, 32959, 32576, 32895 },
{ 9998, 32640, 32959, 32576, 32895 },
{ 9999, 32640, 32959, 32576, 32895 },
{ 16384, 32704, 32767, 32768, 32831 },
{ 16896, 32704, 32767, 32768, 32831 },
{ 17408, 32704, 32767, 32768, 32831 },
{ 17920, 32704, 32767, 32768, 32831 },
{ 18432, 32704, 32767, 32768, 32831 },
{ 18944, 32704, 32767, 32768, 32831 },
{ 19456, 32704, 32767, 32768, 32831 },
{ 19968, 32704, 32767, 32768, 32831 },
{ 20480, 32704, 32767, 32768, 32831 },
{ 20992, 32704, 32767, 32768, 32831 },
{ 21504, 32704, 32767, 32768, 32831 },
{ 22016, 32704, 32767, 32768, 32831 },
{ 22528, 32704, 32767, 32768, 32831 },
{ 23040, 32704, 32767, 32768, 32831 },
{ 23552, 32704, 32767, 32768, 32831 },
{ 24064, 32704, 32767, 32768, 32831 },
{ 24576, 32704, 32767, 32768, 32831 },
{ 25088, 32704, 32767, 32768, 32831 } };
}
| [
"[email protected]"
] | |
629ee18e1bb2c178280a190c1dab2c6252bdc262 | d4134aa41b5734f6c0b68769550debb5c83085ec | /lesson30homework/Project.java | 398e2c81eb01f97315033b1d75e5be02134bc7ff | [] | no_license | RomaMarchenko/Lesson20Homework | 749a4b8d21fa4f0233246b92b5787cfbdcc4526a | a99e290b86bcb2f19e7274af237ee5fb83cb8e8c | refs/heads/master | 2020-07-26T00:54:49.782184 | 2019-10-13T16:45:50 | 2019-10-13T16:45:50 | 208,478,493 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,310 | java | package lesson30homework;
import java.util.Objects;
public class Project {
private String name;
private Customer customer;
private Employee teamLead;
public Project(String name, Customer customer, Employee teamLead) {
this.name = name;
this.customer = customer;
this.teamLead = teamLead;
}
public String getName() {
return name;
}
public Customer getCustomer() {
return customer;
}
public Employee getTeamLead() {
return teamLead;
}
public void setTeamLead(Employee teamLead) {
this.teamLead = teamLead;
}
@Override
public String toString() {
return "Project{" +
"name='" + name + '\'' +
", customer=" + customer +
", projectManager=" + teamLead +
'}';
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Project project = (Project) o;
return name.equals(project.name) &&
customer.equals(project.customer) &&
teamLead.equals(project.teamLead);
}
@Override
public int hashCode() {
return Objects.hash(name, customer, teamLead);
}
}
| [
"[email protected]"
] | |
42b332ce1c26aedc79d60c27b7cf5276a4c4f6be | 4977a770373a0d367e75658b04486b757b7bec4d | /Discrete Sets and Maps/src/de/lennartmeinhardt/math/discrete2d/objectmap/WrapperOperableDiscreteObjectMap2D.java | 3744a449e086402084610a644a5d51b6b617d326 | [] | no_license | lennart-m/superfractals-and-visualizations | 0d85c2c384ace990b05794b7ea27d8b801ef651e | 3c53f7395337bdc2eac229223730e07fe347fcf4 | refs/heads/master | 2021-01-18T04:34:53.757306 | 2019-01-06T21:41:55 | 2019-01-06T21:41:55 | 62,645,900 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,119 | java | package de.lennartmeinhardt.math.discrete2d.objectmap;
import de.lennartmeinhardt.math.discrete2d.set.OperableDiscreteSet2D;
/**
* A basic {@link OperableDiscreteObjectMap2D} implementation that wraps an object map and an operable set.
*
* @author Lennart Meinhardt
* @param <T> the objects' type
* @param <S> the range's type
*/
public class WrapperOperableDiscreteObjectMap2D <T, S extends OperableDiscreteSet2D> implements OperableDiscreteObjectMap2D<T, S> {
// the set that determines values
private final DiscreteObjectMap2D<? extends T> map;
// the operable range of this map
private final S range;
/**
* Create a new {@link WrapperOperableDiscreteObjectMap2D} with given map and range.
*
* @param map the map that has the values
* @param range the bounds to use
*/
public WrapperOperableDiscreteObjectMap2D(DiscreteObjectMap2D<? extends T> map, S range) {
this.map = map;
this.range = range;
}
@Override public T getValueAt(int x, int y) {
return map.getValueAt(x, y);
}
@Override public S getRange() {
return range;
}
}
| [
"[email protected]"
] | |
606073cf8dbcb86312822ab7487f717a5f318d53 | f9069dd45132656458edf35ad1be68bbc3da3fd3 | /src/fr/istic/client/Gae.java | c5c50b29716426c7472a0d045c383640db989c05 | [] | no_license | PaulineLV/gae | d597986e0550a098214595d8fdca2c19b1f96f66 | 009e4d48ffadeb0e55f2ffae5287b00f0cee8d1e | refs/heads/master | 2021-01-19T21:47:35.973159 | 2014-04-25T19:33:13 | 2014-04-26T10:44:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,991 | java | package fr.istic.client;
import java.util.List;
import fr.istic.shared.Home;
import fr.istic.shared.Peripherique;
import fr.istic.shared.Person;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.event.dom.client.KeyUpEvent;
import com.google.gwt.event.dom.client.KeyUpHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;
/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class Gae implements EntryPoint {
/**
* The message displayed to the user when the server cannot be reached or
* returns an error.
*/
private static final String SERVER_ERROR = "An error occurred while "
+ "attempting to contact the server. Please check your network "
+ "connection and try again.";
/**
* Create a remote service proxy to talk to the server-side Greeting service.
*/
private final ConsoServiceAsync consoService = GWT.create(ConsoService.class);
/**
* This is the entry point method.
*/
public void onModuleLoad() {
VerticalPanel v1 = new VerticalPanel();
HorizontalPanel p1 = new HorizontalPanel();
HorizontalPanel p2 = new HorizontalPanel();
HorizontalPanel p3 = new HorizontalPanel();
HorizontalPanel p4 = new HorizontalPanel();
HorizontalPanel p5 = new HorizontalPanel();
HorizontalPanel p6 = new HorizontalPanel();
VerticalPanel v2 = new VerticalPanel();
VerticalPanel v3 = new VerticalPanel();
VerticalPanel v4 = new VerticalPanel();
VerticalPanel v5 = new VerticalPanel();
Label labelNom = new Label("Nom : ");
final TextBox textBoxNom = new TextBox();
p1.add(labelNom);
p1.add(textBoxNom);
v1.add(p1);
Label labelPrenom = new Label("Prenom :");
final TextBox textBoxPrenom = new TextBox();
Label labelGenre = new Label("Genre :");
final TextBox textBoxGenre = new TextBox();
Label labelDateN = new Label("date de naissance : ");
final TextBox textBoxDateN = new TextBox();
Label labelProfilFB = new Label ("Profil facebook :");
final TextBox textBoxProfilFB = new TextBox();
Button b = new Button("create");
Button addHome = new Button ("add home");
final Button createHome = new Button ("create home");
createHome.setVisible(false);
final Label labelAdresse = new Label("Adresse :");
labelAdresse.setVisible(false);
final TextBox textBoxAdresse = new TextBox();
textBoxAdresse.setVisible(false);
final Label labelSuperficie = new Label("Superficie :");
labelSuperficie.setVisible(false);
final TextBox textBoxSuperficie = new TextBox();
textBoxSuperficie.setVisible(false);
final Label labelAdresseIP = new Label("Adresse IP :");
labelAdresseIP.setVisible(false);
final TextBox textBoxAdresseIp = new TextBox();
textBoxAdresseIp.setVisible(false);
final Label labelConso = new Label("Conso :");
labelConso.setVisible(false);
final TextBox textBoxConso = new TextBox();
textBoxConso.setVisible(false);
Button addPeripherique = new Button(" Ajouter un peripherique");
final Button createPeripherique = new Button ("create");
createPeripherique.setVisible(false);
p2.add(labelPrenom);
p2.add(textBoxPrenom);
p3.add( labelGenre);
p3.add(textBoxGenre);
p4.add(labelDateN);
p4.add(textBoxDateN);
p4.add(labelProfilFB);
p4.add(textBoxProfilFB);
p4.add(b);
p5.add(labelAdresse);
p5.add(textBoxAdresse);
p5.add(labelSuperficie);
p5.add(textBoxSuperficie);
p5.add(labelAdresseIP);
p5.add(textBoxAdresseIp);
p5.add(createHome);
p6.add(addPeripherique);
p6.add(labelConso);
p6.add(textBoxConso);
p6.add(createPeripherique);
v2.add(p2);
v2.add(p3);
v2.add(p4);
v4.add(addHome);
v4.add(p5);
v5.add(p6);
Button listAllPerson = new Button("listAllPerson");
v3.add(listAllPerson);
RootPanel.get().add(v1);
RootPanel.get().add(v2);
RootPanel.get().add(v3);
RootPanel.get().add(v4);
RootPanel.get().add(v5);
b.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
consoService.createPerson(textBoxNom.getText(), textBoxPrenom.getText(),textBoxGenre.getText(), textBoxDateN.getText(), textBoxProfilFB.getText(), new AsyncCallback<Person>() {
@Override
public void onSuccess(Person result) {
Window.alert("Ok " + result.getNom() + " " +result.getPrenom() + "est cree");
textBoxNom.setText("");
textBoxPrenom.setText("");
textBoxGenre.setText("");
textBoxDateN.setText("");
textBoxProfilFB.setText("");
}
@Override
public void onFailure(Throwable caught) {
Window.alert("erreur!");
}
});
}
});
addHome.addClickHandler(new ClickHandler(){
@Override
public void onClick(ClickEvent event) {
// TODO Auto-generated method stub
textBoxAdresse.setVisible(true);
textBoxSuperficie.setVisible(true);
textBoxAdresseIp.setVisible(true);
labelAdresse.setVisible(true);
labelAdresseIP.setVisible(true);
labelSuperficie.setVisible(true);
createHome.setVisible(true);
consoService.createHome(null, textBoxAdresse.getText(), Float.valueOf(textBoxSuperficie.getText()), textBoxAdresseIp.getText(), new AsyncCallback<Home>(){
@Override
public void onFailure(Throwable caught) {
// TODO Auto-generated method stub
Window.alert("erreur!");
}
@Override
public void onSuccess(Home result) {
// TODO Auto-generated method stub
Window.alert("ok maison cree "+result.getAdresse() + " ");
}
});
}
});
listAllPerson.addClickHandler(new ClickHandler(){
@Override
public void onClick(ClickEvent event) {
// TODO Auto-generated method stub
consoService.listAllPerson(new AsyncCallback<List<Person>>() {
@Override
public void onFailure(Throwable caught) {
// TODO Auto-generated method stub
}
@Override
public void onSuccess(List<Person> result) {
StringBuffer buf = new StringBuffer();
for (Person p : result){
buf.append("person " + p.getId() + " "+ p.getPrenom() + " " + p.getNom());
}
Window.alert(buf.toString());
}
});
}
});
addPeripherique.addClickHandler(new ClickHandler(){
@Override
public void onClick(ClickEvent event) {
// TODO Auto-generated method stub
labelConso.setVisible(true);
textBoxConso.setVisible(true);
createPeripherique.setVisible(true);
}
});
createPeripherique. addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
// TODO Auto-generated method stub
consoService.createAppareil(home, Long.valueOf(textBoxConso.getText()), new AsyncCallback<Peripherique>(){
@Override
public void onFailure(Throwable caught) {
// TODO Auto-generated method stub
Window.alert("erreur impossible de creer un peripherique");
}
@Override
public void onSuccess(Peripherique result) {
// TODO Auto-generated method stub
Window.alert("ok peripherique cree");
}
});
}
});
}
}
| [
"[email protected]"
] | |
81e5b6ce3e6ec948e06e5ccc2d08c3e79eff23bc | 908323fa65b9b655debfce71ffd1a9a74014ed29 | /app/src/main/java/com/ide/customer/others/NoInternetDialog.java | bd489c40513dac571289f3461a0c664a348afd37 | [] | no_license | PoojaApporio/TESTIDE | 832be350c6d7b79e3e0465193585926be88f194b | 2502881ee213b2610064ccc6b9f740b0c8fb5564 | refs/heads/master | 2021-09-03T09:53:03.690800 | 2018-01-08T05:59:16 | 2018-01-08T05:59:16 | 116,636,100 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,703 | java | package com.ide.customer.others;
import android.app.Dialog;
import android.content.Context;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.widget.LinearLayout;
import com.ide.customer.R;
/**
* Created by lenovo-pc on 9/4/2017.
*/
public class NoInternetDialog {
Context mContext;
NoInternetDialogListener mnoInternetDialogListener ;
public NoInternetDialog(Context context , NoInternetDialogListener noInternetDialogListener){
mContext = context ;
this.mnoInternetDialogListener = noInternetDialogListener;
}
public void showMessageDialog(){
final Dialog dialog = new Dialog(mContext, android.R.style.Theme_Translucent_NoTitleBar);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
Window window = dialog.getWindow();
window.setGravity(Gravity.CENTER);
dialog.setContentView(R.layout.activity_no_internet);
LinearLayout retry = (LinearLayout) dialog.findViewById(R.id.retry);
retry.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mnoInternetDialogListener.onDialogRetry();
dialog.dismiss();
}
});
dialog.findViewById(R.id.close).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mnoInternetDialogListener.onDialogDismiss();
dialog.dismiss();
}
});
dialog.show();
}
public interface NoInternetDialogListener {
void onDialogDismiss();
void onDialogRetry();
}
}
| [
"[email protected]"
] | |
e4b8cec2004b297693b373f1747a92d89566b087 | bef519aa4ff4f381e0674a57cee67a9c14e1ae17 | /app/src/main/java/vip/hengnai/wine/framework/retrofit/RetrofitManager.java | c51af27fa8ed806161980e855927250751f26581 | [] | no_license | plpBeans/crispy-octo-doodle | ad4b22f13af2b7d02bb0dad6f90ded6563db00dd | 2565b9c84dae2a32692e533c525afc2c56377e09 | refs/heads/master | 2022-12-10T10:39:08.518864 | 2020-09-02T06:57:34 | 2020-09-02T06:57:34 | 292,202,613 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,004 | java | package vip.hengnai.wine.framework.retrofit;
import android.content.Context;
import android.util.Log;
import okhttp3.internal.tls.OkHostnameVerifier;
import vip.hengnai.wine.BuildConfig;
import vip.hengnai.wine.Constants;
import vip.hengnai.wine.R;
import vip.hengnai.wine.SellWineApplication;
import vip.hengnai.wine.framework.api.ApiService;
import vip.hengnai.wine.util.AuthUtil;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import javax.net.ssl.SSLContext;
import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import vip.hengnai.wine.util.ssl.HttpsUtils;
import vip.hengnai.wine.util.ssl.TrustDoubleCerts;
import vip.hengnai.wine.util.ssl.TrustHostnameVerifier;
import vip.hengnai.wine.util.ssl.TrustSingleCerts;
/**
*
* @author hua
* @date 2019/7/18
*/
public class RetrofitManager {
private static final String BASE_URL = "http://demo.sqsh365.com:7001/xaclinterface/";
public static OkHttpClient.Builder builder;
private static Context mContext;
public RetrofitManager(Context mContext) {
RetrofitManager.mContext = mContext;
}
public static ApiService getInstance() {
//Okhttp可以放在Application中只创建一次
builder = new OkHttpClient.Builder();
builder.connectTimeout(120, TimeUnit.SECONDS);
builder.readTimeout(30, TimeUnit.SECONDS);
builder.writeTimeout(30, TimeUnit.SECONDS);
if (BuildConfig.DEBUG) {
HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
logging.setLevel(HttpLoggingInterceptor.Level.BODY);
builder.addInterceptor(logging);
}
// builder.sslSocketFactory(HttpsUtils.getSslSocketFactory().sslSocketFactory,HttpsUtils.UnSafeTrustManager);
// builder.sslSocketFactory(null,HttpsUtils.UnSafeTrustManager);
//支持https信任指定服务器的证书---单向认证
// try {
//自签名单项认证方法,ca机构颁发的证书一般不需要配置代码mContext.getResources().openRawResource(R.raw.hengnai)
// SSLContext sslContext = new TrustSingleCerts().setCertificates(mContext.getResources().openRawResource(R.raw.hengnai));
// builder.sslSocketFactory(sslContext.getSocketFactory(),new TrustSingleCerts());
//// HttpsUtils.SSLParams sslParams= HttpsUtils.getSslSocketFactory(mContext.getResources().openRawResource(R.raw.hengnai));
//// builder.sslSocketFactory(sslParams.sSLSocketFactory,sslParams.trustManager);
//// builder.hostnameVerifier(OkHostnameVerifier.INSTANCE);
// } catch (IOException e) {
// e.printStackTrace();
// }
//双向认证
// try {
// SSLContext sslContext = new TrustDoubleCerts().setCertificates(null);
// builder.sslSocketFactory(sslContext.getSocketFactory(),new TrustDoubleCerts());
// } catch (IOException e) {
// e.printStackTrace();
// }
builder.hostnameVerifier(new TrustHostnameVerifier());
builder.addInterceptor(new Interceptor() {
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
Request.Builder builder = request.newBuilder();
Log.e("手机信息","手机型号:"+android.os.Build.MODEL);
Log.e("手机信息","手机品牌:"+android.os.Build.BRAND);
Log.e("手机信息","手机系统版本号 :"+android.os.Build.VERSION.RELEASE);
Log.e("手机信息","UserAgent:"+ System.getProperty("http.agent"));
//默认认证信息
builder.addHeader("Authorization", "eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJoZW5nbmFpLnZpcCIsImlhdCI6MTU3NzA3MjYyNCwiZXhwIjoxNTc3MTU5MDI0LCJzdWIiOiIxODYyMTY5ODkxMSJ9.ou8k5vmz5geh0KtiJKtb3hO5yM5uSLP7P2TrV0UtZvg");
//设备id
builder.addHeader("terminalId", SellWineApplication.decId);
//经纬度
builder.addHeader("geo", SellWineApplication.longitude+","+SellWineApplication.latitude);
builder.addHeader("accessToken", AuthUtil.getAuthUtil(mContext).getToken());
return chain.proceed(builder.build());
}
});
return new Retrofit.Builder().baseUrl(Constants.getBaseUrl())
.addConverterFactory(StringConverterFactory.create())
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.client(builder.build())
.build().create(ApiService.class);
}
}
| [
"[email protected]"
] | |
82ea42a5db69235bc08e89795b3343b3063721fa | 4b0847be6f407aac216513d00f71f76befd16f23 | /src/main/java/com/zfy/component/basic/mvx/mvp/app/MvpDelegate.java | d3fc1064888d986e91d76b7cbac491ced12bcda7 | [
"Apache-2.0"
] | permissive | Android-Modularity/component_basic | f8063ad0edeec3a9e94a647fe5d87469f1e81b9e | d00b97289aa53aa9131334c8b299eb644d2b433d | refs/heads/master | 2020-04-01T22:24:37.561638 | 2019-06-29T17:29:40 | 2019-06-29T17:29:40 | 153,706,809 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,470 | java | package com.zfy.component.basic.mvx.mvp.app;
import android.app.Activity;
import android.app.Service;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.march.common.x.LogX;
import com.zfy.component.basic.ComponentX;
import com.zfy.component.basic.app.AppDelegate;
import com.zfy.component.basic.app.AppFunctionView;
import com.zfy.component.basic.app.view.ViewOpts;
import com.zfy.component.basic.mvx.mvp.IMvpPresenter;
import com.zfy.component.basic.mvx.mvp.IMvpView;
import com.zfy.component.basic.mvx.mvp.presenter.MvpPresenter;
/**
* CreateAt : 2018/9/12
* Describe :
*
* @author chendong
*/
public class MvpDelegate<P extends IMvpPresenter> extends AppDelegate {
public static final String TAG = MvpDelegate.class.getSimpleName();
private P mPresenter;
@Override
public void onAttachHost(Object host) {
MvpV annotation = mHost.getClass().getAnnotation(MvpV.class);
if (annotation != null) {
int layout = annotation.layout();
Class pClazz = annotation.p();
if (layout != 0) {
mViewOpts = ViewOpts.makeMvp(layout, pClazz);
}
}
}
@Override
protected View onBindFragment(android.support.v4.app.Fragment owner, LayoutInflater inflater, ViewGroup container) {
View inflate = inflater.inflate(mViewOpts.getLayout(), container, false);
bindView(mHost, inflate);
init();
return inflate;
}
@Override
public void onBindActivity(Activity owner) {
try {
owner.setContentView(mViewOpts.getLayout());
bindView(mHost, null);
init();
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
protected void onBindService(Service owner) {
init();
}
@Override
public void onBindFunctionView(AppFunctionView view, Object host) {
if (!(view instanceof MvpFunctionView)) {
throw new IllegalArgumentException("view must be AppFunctionView");
}
bindView(mHost, host);
init();
}
@SuppressWarnings("unchecked")
private void init() {
if (mHost instanceof IMvpView) {
Class pClazz = mViewOpts.getpClazz();
try {
if(pClazz !=null) {
mPresenter = (P) pClazz.newInstance();
addObserver(mPresenter);
}
} catch (Exception e) {
e.printStackTrace();
}
if (getPresenter() != null && getPresenter() instanceof MvpPresenter) {
MvpPresenter presenter = (MvpPresenter) getPresenter();
presenter.attachView((IMvpView) mHost);
ComponentX.inject(presenter);
presenter.init();
}
} else {
LogX.e(TAG, "Host not IMvpView");
}
}
@Override
public void onHostInit() {
super.onHostInit();
if (getPresenter() != null) {
getPresenter().onViewInit();
}
}
public P getPresenter() {
return mPresenter;
}
@Override
public void onDestroy() {
super.onDestroy();
if (getPresenter() != null) {
getPresenter().onDestroy();
}
}
public static class NoPresenter extends MvpPresenter {
@Override
public void init() {
}
}
}
| [
"[email protected]"
] | |
8dfb926412153ec2c6bf012587d398ed799d8229 | 9d3b502359c87eceee8743953d186c25a2327602 | /app/src/test/java/DataTest.java | 1967c4ef081d51c5258ff5ab4b1bdc518b1faf0f | [] | no_license | haminhas/europe | fd0635339cd428ca0978b5e0fe1c547b2a22d34f | f3813cc13f0d1b8edf4fb3a3e251863f9b92f1ce | refs/heads/master | 2021-01-10T11:33:37.130835 | 2015-12-11T19:58:08 | 2015-12-11T19:58:08 | 49,675,773 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,612 | java | import android.content.Context;
import junit.framework.Assert;
import junit.framework.TestCase;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import boysenberry.europe.Countries;
import boysenberry.europe.Data;
import boysenberry.europe.MapsActivity;
/**
* JUnit test for the Data class
* Created by Tamara on 23/11/2015.
*/
public class DataTest extends TestCase {
MapsActivity activity = new MapsActivity();
Context context = activity.getAppContext();
private static final ArrayList<String> names = new ArrayList<>(Arrays.asList("Albania", "Andorra", "Armenia", "Austria",
"Azerbaijan", "Belgium", "Bulgaria", "Bosnia and Herzegovina", "Belarus", "Switzerland", "Cyprus",
"Czech Republic", "Germany", "Denmark", "Spain", "Estonia", "Finland", "France", "United Kingdom",
"Georgia", "Greece", "Croatia", "Hungary", "Ireland", "Iceland", "Italy", "Kosovo", "Liechtenstein",
"Lithuania", "Luxembourg", "Latvia", "Monaco", "Moldova", "Macedonia, FYR", "Malta", "Montenegro",
"Netherlands", "Norway", "Poland", "Portugal", "Romania", "Russian Federation", "San Marino", "Serbia",
"Slovak Republic", "Slovenia", "Sweden", "Turkey", "Ukraine"));
public void testSaveData() throws Exception {
for(String country: names){
Data.saveData(context, country, "Executing Data Test Now!");
}
Countries c = Data.getAllData(context);
String austria = c.getCountry("Austria").getName();
Assert.assertEquals("Executing Data Test Now!", austria);
}
}
| [
"[email protected]"
] | |
83ce3f7448ee80b32e120652a158159dd95d9991 | 8f8271407b807ffc4c58b5555df30aea27b0f199 | /MAS4.0/app/src/main/java/com/example/jarvis/mas/Excelclassroom.java | 259b78e026b2bd28608b4dbb948fa0c9deb6683d | [] | no_license | patelayush/Mobile-Attendance-System | 5283e92e62a5e912d0353699270f7a187bbdaaec | 754c663b4fed10fe7401331f377461afc45c2134 | refs/heads/master | 2020-04-25T14:22:41.599362 | 2019-02-27T04:05:20 | 2019-02-27T04:05:20 | 172,839,697 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,006 | java | package com.example.jarvis.mas;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.NavigationView;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
/**
* Created by jarvis on 19/4/16.
*/
public class Excelclassroom extends AppCompatActivity implements
NavigationView.OnNavigationItemSelectedListener
{ private int cid;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.pastclassroomslayout);
ListView listView=(ListView) findViewById(R.id.editlv);
/*ArrayAdapter<String> arrayAdapter= new ArrayAdapter<String>(getApplicationContext(),
R.layout.rowlayout,R.id.tlv1,Navigation_activity.getInstance().clist);
*/
ListviewAdapter arrayAdapter=new ListviewAdapter(getApplicationContext(),
Navigation_activity.getInstance().clist);
listView.setAdapter(arrayAdapter);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.setDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent intent=new Intent(getApplicationContext(),Excelclass.class);
DatabaseManager databaseManager=new DatabaseManager(getApplicationContext());
cid=databaseManager.getcid(String.valueOf(parent.getItemAtPosition(position)));
intent.putExtra("cid",cid);
startActivity(intent);
finish();
}
});
}
Intent navintent;
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
// Handle navigation view item clicks here.
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
int id = item.getItemId();
if (id == R.id.nav_attendance) {
navintent=new Intent(getApplicationContext(),Navigation_activity.class);
startActivity(navintent);
} else if (id == R.id.past_attendance) {
navintent=new Intent(getApplicationContext(),Pastclassrooms.class);
startActivity(navintent);
} else if (id == R.id.nav_stats) {
navintent=new Intent(getApplicationContext(),Statsclassroom.class);
startActivity(navintent);
finish();
}
else if (id==R.id.nav_excel)
{
drawer.closeDrawer(GravityCompat.START);
}
else if (id == R.id.nav_edit) {
navintent=new Intent(getApplicationContext(),Editclassroom.class);
startActivity(navintent);
} else if (id == R.id.nav_delete) {
navintent=new Intent(getApplicationContext(),Delete.class);
startActivity(navintent);
} else if (id == R.id.nav_about) {
navintent=new Intent(getApplicationContext(),About.class);
startActivity(navintent);
}
drawer.closeDrawer(GravityCompat.START);
return true;
}
}
| [
"[email protected]"
] | |
83f9b99c660a1b1bb289165cf065d25f07e2fa5c | 344bcf705ef218a168ceae7c373c7781ffa6cce0 | /src/main/java/com/instructorrob/beltreviewer/models/Group.java | ebfbce9c9e21d0707ad46ef5e9a9633809dab74e | [] | no_license | sdahal1/javabeltreviewer | fe5f401ca7a239afa50a617a18c9dfad9790e390 | 4f8110fea38694b08df122c464e692ffa13b0d0e | refs/heads/main | 2023-04-13T12:45:25.698417 | 2021-04-23T14:29:51 | 2021-04-23T14:29:51 | 360,586,979 | 1 | 3 | null | null | null | null | UTF-8 | Java | false | false | 2,866 | java | package com.instructorrob.beltreviewer.models;
import java.util.Date;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;
import javax.persistence.Table;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Size;
@Entity
@Table(name="groupz")
public class Group {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@NotEmpty(message="Group name cannot be empty")
@Size(min=2, message ="Group name must be at least 2 char")
private String name;
@NotEmpty(message="Group description cannot be empty")
@Size(min=10, max=1000, message ="Group description must be at least 10 char and less than 1000")
private String description;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name="creator_id")
private User creator;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name="vp_id")
private User vp;
@ManyToMany(fetch = FetchType.LAZY)
@JoinTable(
name = "users_groups_members",
joinColumns = @JoinColumn(name = "group_id"),
inverseJoinColumns = @JoinColumn(name = "user_id")
)
private List<User> members;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public User getCreator() {
return creator;
}
public void setCreator(User creator) {
this.creator = creator;
}
public User getVp() {
return vp;
}
public void setVp(User vp) {
this.vp = vp;
}
public List<User> getMembers() {
return members;
}
public void setMembers(List<User> members) {
this.members = members;
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public Date getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
@Column(updatable=false)
private Date createdAt;
private Date updatedAt;
public Group() {
}
@PrePersist
protected void onCreate(){
this.createdAt = new Date();
}
@PreUpdate
protected void onUpdate(){
this.updatedAt = new Date();
}
}
| [
"[email protected]"
] | |
9012573b16f43784e36abb838eb6770499d611aa | 891959f335ed3047b8b0c9c0e1252f432e3876b4 | /src/main/java/com/jamie/rms/service/WeightProfileService.java | 1a3579a90b007393f3fc3077df67254eeb94cd64 | [] | no_license | wingsum93/RMS_Serve | a4c4264646d54d70e3dbb7b8a02a7f1a5d7bbae8 | eb95e4ef3976ef8c18c03dcf91b25c44835dcb83 | refs/heads/master | 2020-04-17T01:07:05.282959 | 2017-08-23T15:34:47 | 2017-08-23T15:34:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 376 | java | package com.jamie.rms.service;
import java.util.List;
import com.jamie.rms.model.ResponseMessage;
import com.jamie.rms.model.WeightProfile;
public interface WeightProfileService {
List<WeightProfile> findAll ();
List<WeightProfile> findByPartyId (String partyId);
ResponseMessage delete(WeightProfile weightProfile);
WeightProfile save (WeightProfile weightProfile);
}
| [
"[email protected]"
] | |
be7650c0e32281df545f74448f52a75bad227c04 | d47686f03efcd02d6b2922afacf222a20368b357 | /src/test/java/tests/gui/SeleniumSearchTest.java | 4475e8284b427068144f9960c2698da29ac03403 | [] | no_license | gusmiguens/example | d835dae84041813b614898b8ebff58423dd6e0d3 | 828565f9ec62574f51a1f90e64e278aa2f4f6cc7 | refs/heads/master | 2021-07-23T00:14:57.220659 | 2017-11-02T21:11:20 | 2017-11-02T21:11:20 | 109,601,282 | 1 | 0 | null | 2017-11-05T17:39:49 | 2017-11-05T17:39:49 | null | UTF-8 | Java | false | false | 2,304 | java | /**
*
*/
/**
* @author Damian
*
*/
package tests.gui;
import org.testng.Assert;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
import controllers.GoogleHomePageController;
import controllers.GoogleResultPageController;
import controllers.SeleniumHomePageController;
import tests.configuration.GuiConfigLoader;
public class SeleniumSearchTest extends GuiConfigLoader {
private int timeout = 10; // default 10 seconds
GoogleHomePageController googleHomePageController;;
GoogleResultPageController googleResultPageController;
SeleniumHomePageController seleniumHomePageController;
private Integer linkContainerIndex;
private String expectedSeleniumURL;
private String expectedSeleniumTitle;
// this tests search for "Seleniumhq" page on google and verifies that the user is correctly leaded to SeleniumHQ official site
@Parameters({ "textToSearch" })
@Test
private void seleniumSearch(String textToSearch) {
this.logger.info("****** Test initialized: Search for " + textToSearch + " Web ******");
// test specific variables initialized
this.timeout = Integer.parseInt(this.testDataProperties.getProperty("timeout"));
this.linkContainerIndex = Integer.parseInt(this.testDataProperties.getProperty("linkContainerIndex"));
this.expectedSeleniumURL = this.testDataProperties.getProperty("expectedSeleniumURL");
this.expectedSeleniumTitle = this.testDataProperties.getProperty("expectedSeleniumTitle");
// start google home page controller
this.googleHomePageController = new GoogleHomePageController(this.driver, this.timeout);
this.googleHomePageController.sendTextToInputField(textToSearch);
this.googleHomePageController.startSearch();
// start google result page controller
this.googleResultPageController = new GoogleResultPageController(this.driver, this.timeout);
this.googleResultPageController.clickOnLink(this.linkContainerIndex);
// start Selenium home page controller
this.seleniumHomePageController = new SeleniumHomePageController(this.driver, this.timeout,
this.expectedSeleniumURL);
// verify that URL and Title are correct
Assert.assertTrue(this.driver.getTitle().contains(this.expectedSeleniumTitle));
Assert.assertTrue(this.driver.getCurrentUrl().contains(this.expectedSeleniumURL));
}
}
| [
"[email protected]"
] | |
44a918eb2a6879052359530e61ca61b4eabc2a9e | 2ccf1b3ba1bce9d54232c76a45448d5361c645b4 | /src/test/java/com/qatools/utils/DbUtils.java | 9996860ff44b9c5db0ede5e37c674bba72240427 | [] | no_license | basarbatur/myframeworksample | dcb9b7d3ff0307b47f09892fcfb97394a8953b50 | 348993d9af3cfaf25bc2c57b53ff89cbe213b2d4 | refs/heads/master | 2022-06-02T21:18:11.800962 | 2020-04-16T13:21:01 | 2020-04-16T13:21:01 | 229,681,857 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,795 | java | package com.qatools.utils;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
public class DbUtils {
private static Connection conn;
private static Statement statement;
private static ResultSet rs;
/**
* Method will establish connection with Database
*/
public static void createConnection() {
ConfigsReader.readProperties(Constants.CREDENTIALS_FILEPATH);
try {
conn = DriverManager.getConnection(ConfigsReader.getProperty("dbUrl"),
ConfigsReader.getProperty("dbUsername"),ConfigsReader.getProperty("dbPassword"));
} catch (SQLException e) {
e.printStackTrace();
}
}
/**
* Method will return data from database in List<Map>
*/
public static List<Map<String, String>> getResultSetData (String sqlQuery){
List<Map<String, String>> rsList=new ArrayList<>();
try {
statement=conn.createStatement();
rs=statement.executeQuery(sqlQuery);
ResultSetMetaData rsMetaData=rs.getMetaData();
while (rs.next()) {
Map<String, String> rsMap=new LinkedHashMap<>();
for (int i=1; i <=rsMetaData.getColumnCount(); i++) {
rsMap.put(rsMetaData.getColumnName(i), rs.getObject(i).toString());
}
rsList.add(rsMap);
}
} catch (SQLException e) {
e.printStackTrace();
}
return rsList;
}
/**
* Method will close all db connections/resources
*/
public static void closeConnection() {
try {
if (rs !=null) {
rs.close();
}
if (statement !=null) {
statement.close();
}
if (conn !=null) {
conn.close();
}
}
catch (SQLException e) {
e.printStackTrace();
}
}
}
| [
"[email protected]"
] | |
89c1b65d3ebe41681ee894d29533050e2a332334 | c54df515fbeeaa8792524fdf1a02e416fff73353 | /szcshl-web/src/main/java/cs/domain/book/BorrowBookInfo.java | fbd1971234175d3e9b15822a0f7c7032999f5bc5 | [] | no_license | 17688971686/test-dome | 862e296ea6ba8b124e205a68d6cb3bd82392f510 | 7e1ad95b530538ddfc7bdc701aa29863ccf3fea7 | refs/heads/develop | 2022-12-24T17:07:37.966376 | 2019-07-01T11:36:54 | 2019-07-01T11:36:54 | 214,125,545 | 0 | 0 | null | 2022-12-16T11:09:28 | 2019-10-10T08:15:02 | FreeMarker | UTF-8 | Java | false | false | 2,881 | java | package cs.domain.book;
import cs.domain.DomainBase;
import javax.persistence.*;
import java.util.Date;
/**
* Created by zsl on 2017-09-04.
*/
@Entity
@Table(name = "cs_borrow_info")
public class BorrowBookInfo extends DomainBase {
@Id
private String id;//
//图书编号(图书分类号+顺序号)
@Column(columnDefinition = "varchar(64) ")
private String booksCode;
//书号/刊号
@Column(columnDefinition="varchar(128)")
private String bookNo;
//图书名称
@Column(columnDefinition = "varchar(255) ")
private String booksName;
//借书人
@Column(columnDefinition="varchar(100)")
private String bookBorrower;
//借书数量
@Column(columnDefinition = "INTEGER")
private Integer borrowNum;
/**
* 借书日期
*/
@Temporal(TemporalType.DATE)
@Column
private Date borrowDate;
/**
* 应还日期
*/
@Temporal(TemporalType.DATE)
@Column
private Date returnDate;
/**
* 实际还书日期
*/
@Temporal(TemporalType.DATE)
@Column
private Date realReturnDate;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "businessId")
private BookBuyBusiness bookBuyBusiness;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getBooksCode() {
return booksCode;
}
public void setBooksCode(String booksCode) {
this.booksCode = booksCode;
}
public String getBooksName() {
return booksName;
}
public void setBooksName(String booksName) {
this.booksName = booksName;
}
public String getBookBorrower() {
return bookBorrower;
}
public void setBookBorrower(String bookBorrower) {
this.bookBorrower = bookBorrower;
}
public Date getBorrowDate() {
return borrowDate;
}
public void setBorrowDate(Date borrowDate) {
this.borrowDate = borrowDate;
}
public Date getReturnDate() {
return returnDate;
}
public void setReturnDate(Date returnDate) {
this.returnDate = returnDate;
}
public Date getRealReturnDate() {
return realReturnDate;
}
public void setRealReturnDate(Date realReturnDate) {
this.realReturnDate = realReturnDate;
}
public Integer getBorrowNum() {
return borrowNum;
}
public void setBorrowNum(Integer borrowNum) {
this.borrowNum = borrowNum;
}
public BookBuyBusiness getBookBuyBusiness() {
return bookBuyBusiness;
}
public void setBookBuyBusiness(BookBuyBusiness bookBuyBusiness) {
this.bookBuyBusiness = bookBuyBusiness;
}
public String getBookNo() {
return bookNo;
}
public void setBookNo(String bookNo) {
this.bookNo = bookNo;
}
}
| [
"[email protected]"
] | |
3a7311c3de0842e35374b499882c78af0ab282ca | 9a3772dc25ee51c48478c99110f112e84bd9ac75 | /src/main/java/com/redapp/eclo/security/SecurityConfig.java | 212aef341b357b7eaf537b672bf71f2096d22b33 | [] | no_license | redapp88/eclo_backend | adaa3eccb6ba1afc254e817f47fd1ef7d7c07c5e | ef7675a1291bc081cf56586228b45ed39304dd8e | refs/heads/main | 2022-12-30T15:10:48.843880 | 2020-10-20T12:32:16 | 2020-10-20T12:32:16 | 305,665,030 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,026 | java | package com.redapp.eclo.security;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
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.configuration.EnableWebSecurity;
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.web.authentication.UsernamePasswordAuthenticationFilter;
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private UserDetailsService userDetailsService;
@Autowired
private BCryptPasswordEncoder bCryptPasswordEncoder;
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(userDetailsService).passwordEncoder(bCryptPasswordEncoder);
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable();
http.cors().disable();
http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS);
http.authorizeRequests().antMatchers("/login/**","/exportProgram/**","/downloadFile**").permitAll().and()
.authorizeRequests().antMatchers("/admin/**").hasAuthority("MANAGER").and()
.authorizeRequests().antMatchers("/users/**").authenticated().and()
.addFilter(new JWTAuthntificationFilter(authenticationManager()))
.addFilterBefore(new JWTAutorizationFilter(), UsernamePasswordAuthenticationFilter.class);
}
} | [
"reda.elidrissi88pgmail.com"
] | reda.elidrissi88pgmail.com |
f0844a40fc154b36ad6cea37b5221a39c049d8db | d9cf0f36a822d14b0fecb81da91f588f65118eb8 | /app/src/androidTest/java/com/skooby/coolweather/ApplicationTest.java | e95e72687b827f4a612ce4fd000897e12c2dac34 | [
"Apache-2.0"
] | permissive | skooby2015/coolweather | fd078c75d0741cafbb48a932542c6f2dbd5b79de | 60a1bc4efebceef194987e91c5c310d297deeedc | refs/heads/master | 2021-01-17T08:16:27.777995 | 2016-05-20T00:03:42 | 2016-05-20T00:03:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 353 | java | package com.skooby.coolweather;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"[email protected]"
] | |
033a55c7591f626f2971164a6df6b90e6c19a30b | a388e3ef2fe0652eb4a19f8db41bd7badd96dd8c | /TU de um sistema de locadora/Projeto locadora TU - Versão 2.3/src/test/java/br/ce/wcaquino/servicos/LocacaoServiceTest.java | 815d3d5445d59cf8c2e6509987c8d2a673e5631c | [] | no_license | LucasTrevizanbr/TUEmJava | d6886a20c3c7106e22986e5fa72a1b537617624b | b13a58538aa4094299994a35ad5aaf208c12e324 | refs/heads/master | 2023-06-26T02:15:33.537695 | 2021-07-31T15:15:08 | 2021-07-31T15:15:08 | 386,999,383 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 4,423 | java | package br.ce.wcaquino.servicos;
import static br.ce.wcaquino.utils.DataUtils.isMesmaData;
import static br.ce.wcaquino.utils.DataUtils.obterDataComDiferencaDias;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import org.hamcrest.CoreMatchers;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ErrorCollector;
import org.junit.rules.ExpectedException;
import br.ce.wcaquino.entidades.Filme;
import br.ce.wcaquino.entidades.Locacao;
import br.ce.wcaquino.entidades.Usuario;
import br.ce.wcaquino.exceptions.FilmeSemEstoqueException;
import br.ce.wcaquino.exceptions.LocadoraException;
import br.ce.wcaquino.matchers.DiaSemanaMatcher;
import br.ce.wcaquino.matchers.MatchersProprios;
import br.ce.wcaquino.utils.DataUtils;
public class LocacaoServiceTest {
//GIVEN/DADO QUE
private LocacaoService servicoDeLocacao;
@Rule
public ErrorCollector erro = new ErrorCollector();
@Rule
public ExpectedException excecao = ExpectedException.none();
@Before
public void setUp() {
servicoDeLocacao = new LocacaoService();
}
@Test
public void deveAlugarFilme() throws Exception {
Assume.assumeFalse(DataUtils.verificarDiaSemana(new Date(), Calendar.SATURDAY));
//GIVEN/ DADO QUE
Usuario caraQueAlugou = new Usuario("Lucas");
Filme filmeAlugado = new Filme("Seu jorge",4,30.00);
Filme filmeAlugado2 = new Filme("Parque dos dinos",2,20.00);
List<Filme> listaDeFilmes = new ArrayList();
listaDeFilmes.add(filmeAlugado);
listaDeFilmes.add(filmeAlugado2);
//WHEN/QUANDO
Locacao objetoLocacao = servicoDeLocacao.alugarFilme(caraQueAlugou, listaDeFilmes);
//THEN/ENTÃO
erro.checkThat(objetoLocacao.getValor(), is(50.00));
erro.checkThat(isMesmaData(objetoLocacao.getDataLocacao(), new Date()), is(true));
erro.checkThat(isMesmaData(objetoLocacao.getDataRetorno(), obterDataComDiferencaDias(1)), is(true));
}
@Test(expected = FilmeSemEstoqueException.class)
public void deveLancarUmaExcecaoEmFilmeSemEstoquqe() throws Exception {
//GIVEN/DADO QUE
Usuario caraQueAlugou = new Usuario("Lucas");
Filme filmeAlugado = new Filme("Seu jorge",0,30.00);
Filme filmeAlugado2 = new Filme("Parque dos dinos",2,20.00);
List<Filme> listaDeFilmes = new ArrayList();
listaDeFilmes.add(filmeAlugado);
listaDeFilmes.add(filmeAlugado2);
//WHEN/QUANDO
Locacao objetoLocacao = servicoDeLocacao.alugarFilme(caraQueAlugou, listaDeFilmes);
}
@Test
public void deveLancarUmaExcecaoDeUsuarioVazio() throws FilmeSemEstoqueException {
// GIVEN/DADO QUE
Filme filmeAlugado = new Filme("Seu jorge",4,30.00);
Filme filmeAlugado2 = new Filme("Parque dos dinos",2,20.00);
List<Filme> listaDeFilmes = new ArrayList();
listaDeFilmes.add(filmeAlugado);
listaDeFilmes.add(filmeAlugado2);
// WHEN/QUANDO
try {
Locacao objetoLocacao = servicoDeLocacao.alugarFilme(null, listaDeFilmes);
Assert.fail();
} catch (LocadoraException e) {
Assert.assertThat(e.getMessage(), is("Usuario está vazio"));
}
}
@Test
public void deveLancarUmaExcecaoDeFilmeVazio() throws FilmeSemEstoqueException, LocadoraException{
// GIVEN/DADO QUE
Usuario caraQueAlugou = new Usuario("Lucas");
excecao.expect(LocadoraException.class);
excecao.expectMessage("Lista de filmes está vazia");
// WHEN/QUANDO
Locacao objetoLocacao = servicoDeLocacao.alugarFilme(caraQueAlugou, null);
}
@Test
public void deveDevolverNaSegundaAoAlugarNoSabado() throws FilmeSemEstoqueException, LocadoraException {
Assume.assumeTrue(DataUtils.verificarDiaSemana(new Date(), Calendar.SATURDAY));
//GIVEN/DADO QUE
Usuario caraQueAlugou = new Usuario("Lucas");
List<Filme> listaDeFilmes = Arrays.asList(
new Filme("Seu jorge",2,12.00),
new Filme("Parque dos dinos",2,12.00));
//WHEN/QUANDO
Locacao retorno = servicoDeLocacao.alugarFilme(caraQueAlugou, listaDeFilmes);
//THEN/ENTÃO
Assert.assertThat(retorno.getDataRetorno(), MatchersProprios.caiNumaSegunda());
}
}
| [
"[email protected]"
] | |
88f27323e921291ea9ac06c6b751da263799dfe6 | 5e2f2775270e78f915715a245af70bba6a62b8ec | /app/src/androidTest/java/com/susancagle/roomwordssample/ExampleInstrumentedTest.java | 7efdce08268f47a2a511a3f805720d0676a8913b | [] | no_license | BubblyRobot/CSC210F18-Asgn09-Cagles | c7360e5db3190251239419c68690271e98d5a002 | c329c8dc7fc6e81e5443e4b73d2eb4b46bb579fa | refs/heads/master | 2020-04-10T14:54:11.790883 | 2018-12-09T23:21:45 | 2018-12-09T23:21:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 744 | java | package com.susancagle.roomwordssample;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.susancagle.roomwordssample", appContext.getPackageName());
}
}
| [
"[email protected]"
] | |
81cc5e7bd9c1149135b59974bd4a088537b0cc52 | f7c939766f9a6a3ed72750c0ed43251afe50b619 | /app/src/main/java/com/example/keteringapp/ui/pesan/Sub_pes_vegetarian.java | a318286efe9d94a3b1212db821abe5874d6a0fbc | [] | no_license | iifkhofifah/Katering-App | e3c3a328021fb0b0e7bc9e928379287df4298cdd | 0f09cba9a51640c7402831750942a314f533a14f | refs/heads/master | 2022-11-13T09:49:35.596681 | 2020-07-05T13:53:55 | 2020-07-05T13:53:55 | 277,305,703 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,392 | java | package com.example.keteringapp.ui.pesan;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.NotificationCompat;
import android.app.DatePickerDialog;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import com.example.keteringapp.R;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import java.util.Calendar;
public class Sub_pes_vegetarian extends AppCompatActivity {
TextView tvtgl;
EditText etnama,etnohp,etalamat,ettgl;
Button btn_plus;
Button btn_min;
Button btnsimpan ;
Integer valuejumlah = 0;
Spinner sp1;
TextView tv_angka;
private DatabaseReference databasegetpesveg;
DatePickerDialog.OnDateSetListener setListener;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sub_pes_vegetarian);
databasegetpesveg = FirebaseDatabase.getInstance().getReference("pemveg");
tvtgl = findViewById(R.id.tv_tanggal);
ettgl = findViewById(R.id.et_tanggal);
etnama = findViewById(R.id.et_nama);
etalamat = findViewById(R.id.et_alamat);
etnohp = findViewById(R.id.et_wa);
btn_plus = findViewById(R.id.plus);
btn_min = findViewById(R.id.min);
btnsimpan = findViewById(R.id.simpannotif);
tv_angka = findViewById(R.id.angka);
sp1 = findViewById(R.id.pil_amblantar);
if (savedInstanceState != null) {
String nilaiSaved = savedInstanceState.getString("nilai");
tv_angka.setText(nilaiSaved);
}
Calendar calendar = Calendar.getInstance();
final int year = calendar.get(Calendar.YEAR);
final int month = calendar.get(Calendar.MONTH);
final int day = calendar.get(Calendar.DAY_OF_MONTH);
tvtgl.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
DatePickerDialog datePickerDialog = new DatePickerDialog(
Sub_pes_vegetarian.this, android.R.style.Theme_Holo_Light_Dialog_MinWidth
, setListener, year, month, day);
datePickerDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
datePickerDialog.show();
}
});
setListener = new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
month = month + 1;
String date = day + "/" + month + "/" + year;
tvtgl.setText(date);
}
};
ettgl.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
DatePickerDialog datePickerDialog = new DatePickerDialog(
Sub_pes_vegetarian.this, new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int month, int day) {
month = month + 1;
String date = day + "/" + month + "/" + year;
ettgl.setText(date);
}
}, year, month, day);
datePickerDialog.show();
}
});
btn_plus.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
valuejumlah += 1;
tv_angka.setText(valuejumlah.toString());
}
});
btn_min.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (valuejumlah > 1){
valuejumlah -= 1;
tv_angka.setText(valuejumlah.toString());
}
}
});
btnsimpan.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getpesveg();
String vNama = etnama.getText().toString();
String vNohp = etnohp.getText().toString();
String vAlamat = etalamat.getText().toString();
String firtsItem = String.valueOf(sp1.getSelectedItem());
String vTanggal = ettgl.getText().toString();
String vPorsi = tv_angka.getText().toString();
Intent veg = new Intent(Sub_pes_vegetarian.this, ValueVegetarianActivity.class);
veg.putExtra("extraNama", vNama);
veg.putExtra("extraNohp", vNohp);
veg.putExtra("extraAlamat", vAlamat);
veg.putExtra("extraSp1", firtsItem);
veg.putExtra("extraTanggal", vTanggal);
veg.putExtra("extraPorsi", vPorsi);
startActivity(veg);
}
});
}
private void getpesveg(){
String Nama = etnama.getText().toString().trim();
String Nohp = etnohp.getText().toString().trim();
String Alamat = etalamat.getText().toString().trim();
String Spinnerveg = sp1.getSelectedItem().toString();
String Tanggal = ettgl.getText().toString().trim();
String Porsi = tv_angka.getText().toString().trim();
if(!TextUtils.isEmpty(Nama)){
String id = databasegetpesveg.push().getKey();
getpesveg pesveg = new getpesveg(id,Nama,Nohp,Alamat,Spinnerveg,Tanggal,Porsi);
databasegetpesveg.child(id).setValue(pesveg);
Toast.makeText(this, "Pemesanan Vegetarian", Toast.LENGTH_LONG).show();
}else {
Toast.makeText(this,"Anda Belum Mengisi Pemesanan", Toast.LENGTH_LONG).show();
}
}
}
| [
"[email protected]"
] | |
4a85d6306f7ee6784ac2c8191aa1c51111cb6587 | 57cf2b17ad01b78b9f7f4c7e4e229c48dcd3b2f3 | /inst/java/ConvertFE.java | a61e7a6bd4229cba95901c46eec0b3fa98619856 | [] | no_license | tf2/CNsolidate | b5c62014f4c06751697d2332df7e7787bdf3faa7 | c856aa54604d5a0e8cfcd4eb9790bef70cc8c7f4 | refs/heads/master | 2021-01-22T09:16:50.336608 | 2015-06-24T07:57:56 | 2015-06-24T07:57:56 | 9,937,180 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,923 | java | import java.util.regex.*;
import java.io.*;
import java.io.FileNotFoundException;
public class ConvertFE {
public static void FEtoBED(String file, String filename) {
PrintWriter pw = null; File output = new File(filename);
if (output.exists()) System.out.println("File already exists - overwriting!!!");
DataInputStream dis = null; String record = null;
int recCount = 0; int loc_int =0; int rat_int =0; int raterr_int =0; int pin =0;
Pattern p = Pattern.compile("chr\\w\\w?:\\d+-\\d");
try {
File f = new File(file); FileInputStream fis = new FileInputStream(f); BufferedInputStream bis = new BufferedInputStream(fis);
dis = new DataInputStream(bis); pw = new PrintWriter(new FileOutputStream(output), true);
while ( (record=dis.readLine()) != null ) {
recCount++;
if (recCount == 10){
String[] seq = record.split("\t");
for (int i =0; i<seq.length; i++ ) {
String temp = seq[i];
if (temp.equals("SystematicName")) loc_int = i;
else if (temp.equals("LogRatio")) rat_int = i;
else if (temp.equals("LogRatioError")) raterr_int = i;
}
} else if (recCount > 10) {
String[] data = record.split("\t"); Matcher matc = p.matcher(record);
if (matc.find()) {
StringBuilder sb = new StringBuilder(512); String SyName = data[loc_int];
String[] SyArray = SyName.split(":"); String SyTemp = SyArray[1]; String[] SyLocat = SyTemp.split("-");
String chr = SyArray[0].substring(3);
if (chr.equals("X")) chr = "23";
else if (chr.equals("Y")) chr = "24";
else if (chr.equals("XD")) chr = "25";
else if (chr.equals("2L")) chr = "26";
int start = Integer.parseInt(SyLocat[0]); int end = Integer.parseInt(SyLocat[1]);
double logR = Double.parseDouble(data[rat_int]); double logRerr = Double.parseDouble(data[raterr_int]);
logR = Math.log(Math.pow(10, logR)) / Math.log(2);
sb.append(chr + "\t" + start + "\t" + end + "\t" + logR + "\t" + logRerr+ "\n"); pw.print(sb); pin++;
}
}
}
} catch (IOException e) { System.out.println("Uh oh, got an IOException error!" + e.getMessage());
} finally { if (dis != null) { try { pw.close(); dis.close(); } catch (IOException ioe) {}
}
}
}
public static void main(String[] args) {
String file = ""; String out="";
for (int u=0;u<args.length; u++) {
int pin = u+1; String s = args[u];
if (s.equals("-f")) file = args[pin];
if (s.equals("-o")) out = args[pin];
}
FEtoBED(file, out);
}
} | [
"[email protected]"
] | |
c57f520df4e4392463764afe337cf7f009da6c65 | a8bce391495342c11e568dcc818f9d734745e7a1 | /task1/src/ee/ut/math/tvt/salessystem/ui/model/PurchaseInfoTableModel.java | e1fce896f0d4c51e71c277af38059aa37af8f7ae | [] | no_license | dianx93/Default | e42afaca9fc19292b68a582348aab127523e7579 | b2a34aa540825d3af7f9263fc5fb34fc8b75864d | refs/heads/master | 2021-01-18T05:47:08.081341 | 2014-11-27T11:14:47 | 2014-11-27T11:14:47 | 23,912,189 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,366 | java | package ee.ut.math.tvt.salessystem.ui.model;
import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
import ee.ut.math.tvt.salessystem.domain.data.SoldItem;
/**
* Purchase history details model.
*/
public class PurchaseInfoTableModel extends SalesSystemTableModel<SoldItem> {
private static final long serialVersionUID = 1L;
private static final Logger log = Logger.getLogger(PurchaseInfoTableModel.class);
public PurchaseInfoTableModel() {
super(new String[] { "Id", "Name", "Price", "Quantity", "Sum"});
}
@Override
protected Object getColumnValue(SoldItem item, int columnIndex) {
switch (columnIndex) {
case 0:
return item.getId();
case 1:
return item.getName();
case 2:
return item.getPrice();
case 3:
return item.getQuantity();
case 4:
return item.getSum();
}
throw new IllegalArgumentException("Column index out of range");
}
@Override
public String toString() {
final StringBuffer buffer = new StringBuffer();
for (int i = 0; i < headers.length; i++)
buffer.append(headers[i] + "\t");
buffer.append("\n");
for (final SoldItem item : rows) {
buffer.append(item.getId() + "\t");
buffer.append(item.getName() + "\t");
buffer.append(item.getPrice() + "\t");
buffer.append(item.getQuantity() + "\t");
buffer.append(item.getSum() + "\t");
buffer.append("\n");
}
return buffer.toString();
}
/**
* Add new StockItem to table.
*/
public void addItem(SoldItem item) {
boolean exists = false;
for (final SoldItem soldItem : rows) {
if (soldItem.getStockitemid() == item.getStockitemid())
exists = true;
}
if(!exists){
rows.add(item);
}
else {
for (final SoldItem soldItem : rows) {
if (soldItem.getStockitemid() == item.getStockitemid())
soldItem.setQuantity(soldItem.getQuantity()+item.getQuantity());
exists = false;
}
}
log.debug("Added " + item.getName() + " quantity of " + item.getQuantity());
fireTableDataChanged();
}
public List<SoldItem> getSoldItems() {
List<SoldItem> solditems = new ArrayList<SoldItem>();
for (SoldItem soldItem : rows){
solditems.add(soldItem);
}
return solditems;
}
}
| [
"[email protected]"
] | |
378513d3d0f35be6b6ef2d90712d33288af69e5d | 65c642cdff715e74d166936ff6da8490ce369651 | /src/testRecap_E_H_J/Vetement.java | f48d33b2bd1e5224fc3713ab305ba650972053a2 | [] | no_license | JFumba/moduleGit | d3edb16feb8c52f4b4f21f00dc34dc25d7c3cffb | 7fe00a746cffb6a064f1804f39e83e00815b896d | refs/heads/master | 2022-11-16T23:01:15.128836 | 2020-07-08T14:58:06 | 2020-07-08T14:58:06 | 278,032,776 | 0 | 0 | null | 2020-07-08T12:18:59 | 2020-07-08T08:24:34 | Java | UTF-8 | Java | false | false | 668 | java | package testRecap_E_H_J;
public class Vetement extends Bien{
private String taille;
public Vetement(double prix,String taille) {
super(prix);
setTaille(taille);
}
public String getTaille() {
return taille;
}
public void setTaille(String taille) {
if (taille.equals("XS") || taille.equals("S") || taille.equals("M") || taille.equals("L") || taille.equals("XL")) {
this.taille = taille;
} else {
System.out.println("Taille invalide");
}
}
@Override
public String toString() {
return "Vetement à " + getPrix() + " Taille : " + getTaille();
}
}
| [
"[email protected]"
] | |
c7490c239b322c3b716507ac452ae47b8942e962 | 38e10a273c41f08f1b84c7b9f66e4197493d2e9a | /timesheetapp5/src/main/java/com/fastcode/timesheetapp5/addons/reporting/domain/dashboardversion/DashboardversionId.java | 2ed036094903c374de882ccc014631d597f9b95e | [] | no_license | fastcode-inc/timesheetapp5 | 12e932419621e6158cda2492874f2f8d81cc0261 | 98f7cec56c4aa30f90b9eac8b025ea058c68c72e | refs/heads/master | 2023-01-31T08:32:34.694820 | 2020-12-13T19:37:43 | 2020-12-13T19:37:43 | 321,144,949 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 659 | java | package com.fastcode.timesheetapp5.addons.reporting.domain.dashboardversion;
import java.io.Serializable;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
public class DashboardversionId implements Serializable {
private static final long serialVersionUID = 1L;
private Long dashboardId;
private Long userId;
private String dashboardVersion;
public DashboardversionId(Long userId, Long dashboardId, String dashboardVersion) {
super();
this.dashboardId = dashboardId;
this.userId = userId;
this.dashboardVersion = dashboardVersion;
}
}
| [
"[email protected]"
] | |
f9ee1b45f36090322b722f5721c090f55df21414 | ecb0e8d584711535c35d7aa79faf38130131f5a0 | /src/main/java/hk/siggi/bungeecord/bungeechat/notifications/MineWatchAlert.java | cb57e8e92a949036cc8b53be9b6945be1e8a90e1 | [] | no_license | CubeBuilders/BungeeChat | f6afe1c958a4e91dadbc10c36037ab8ef63e9dc9 | 1c7d14822e1b2ffefa89790a2c624e558916088d | refs/heads/main | 2023-04-26T21:10:26.189035 | 2023-04-24T11:16:51 | 2023-04-24T11:16:51 | 178,697,247 | 2 | 1 | null | 2023-04-14T14:54:29 | 2019-03-31T14:14:12 | Java | UTF-8 | Java | false | false | 3,906 | java | package hk.siggi.bungeecord.bungeechat.notifications;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import hk.siggi.bungeecord.bungeechat.UUIDCache;
import hk.siggi.bungeecord.bungeechat.event.MineWatchEvent;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.UUID;
public class MineWatchAlert extends NotificationTrigger<MineWatchEvent, String> {
public static final List<String> allOres;
static {
allOres = new ArrayList<>();
allOres.addAll(Arrays.asList(new String[]{
"iron",
"gold",
"coal",
"lapis",
"diamond",
"redstone",
"emerald",
"quartz"
}));
}
private final String server;
private String[] ores = null;
public MineWatchAlert(Notifications notifications, JsonObject trigger) {
super(notifications, trigger);
JsonElement serverElement = trigger.get("server");
JsonElement oresElement = trigger.get("ores");
String serverStr;
try {
serverStr = serverElement.getAsString();
} catch (Exception e) {
serverStr = null;
}
if (serverStr == null) {
this.server = null;
} else {
this.server = serverStr;
}
try {
if (oresElement != null && oresElement.isJsonArray()) {
List<String> theOres = new LinkedList<>();
JsonArray oresArray = oresElement.getAsJsonArray();
for (JsonElement element : oresArray) {
if (element != null) {
theOres.add(element.getAsString());
}
}
if (!theOres.isEmpty()) {
ores = theOres.toArray(new String[theOres.size()]);
}
}
} catch (Exception e) {
}
}
public MineWatchAlert(Notifications notifications, UUID triggerID, boolean sendSMS, boolean sendProwl, UUID notifyee, int activations, int maxActivations, String server) {
super(notifications, triggerID, sendSMS, sendProwl, notifyee, activations, maxActivations);
this.server = server;
}
public void setOres(String[] ores) {
this.ores = ores;
notifications.saveData();
}
@Override
public String getTrigger() {
return server;
}
@Override
public void performAction(MineWatchEvent event) {
check:
if (ores != null && ores.length > 0) {
String oreToMatch = event.getOre();
for (String ore : ores) {
if (ore.equalsIgnoreCase(oreToMatch)) {
break check;
}
}
return;
}
UUIDCache uuidCache = notifications.getPlugin().getUUIDCache();
int count = event.getCount();
String countStr = count >= 100000 ? "100000+" : (count + "x");
send("MineWatch", uuidCache.getNameFromUUID(event.getPlayer().getUniqueId())
+ "\n"
+ countStr + " " + event.getOre()
+ "\n"
+ "light level: " + event.getLightLevel()
+ "\n"
+ "("
+ event.getServer().getName()
+ ":" + event.getWorld()
+ ", " + event.getX()
+ ", " + event.getY()
+ ", " + event.getZ()
+ ")");
}
@Override
public boolean matchesTrigger(String server) {
if (this.server == null) {
return true;
}
if (server == null) {
return false;
}
return this.server.equals(server);
}
@Override
public JsonObject serialize() {
JsonObject object = super.serialize();
if (server != null) {
object.addProperty("server", server);
}
if (ores != null && ores.length > 0) {
JsonArray oresList = new JsonArray();
for (String ore : ores) {
oresList.add(new JsonPrimitive(ore));
}
object.add("ores", oresList);
}
return object;
}
@Override
public String toString() {
String serverStr = (server == null ? "<any>" : server);
String oresStr = "";
if (ores != null) {
for (String ore : ores) {
oresStr += ", " + ore;
}
}
return "MineWatchAlert: " + serverStr + oresStr + (getSendSMS() ? ", sms" : "") + (getSendProwl() ? ", prowl" : "") + (", activations=" + getActivations()) + (maxActivations > 0 ? ("/" + maxActivations) : "");
}
}
| [
"[email protected]"
] | |
7c8a4f215ffad97a072c299f8cc6c13887ce8fbb | ec24ee1e2850b2d2baf22cf62b1d07d69bc19b68 | /src/edu/cibertec/services/CategoriaService.java | 3aedea096ebc11ab289df2e2d868f71f0d27a700 | [] | no_license | GiusseppeMorote/FurnitureApi | ac1d9dce1f893feb56bd2667dd2e6721a92787e0 | efcc13a361896a56b62b92476d14185c3f95befa | refs/heads/master | 2021-05-07T07:07:13.678528 | 2017-11-01T16:50:45 | 2017-11-01T16:50:45 | 109,084,067 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,821 | java | package edu.cibertec.services;
import java.util.ArrayList;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.json.JSONObject;
import edu.cibertec.beans.CategoriaBean;
import edu.cibertec.dao.CategoriaDAO;
import edu.cibertec.dao.DAOFactory;
import edu.cibertec.parameter.MyJaxBean;
@Path("/categoria")
public class CategoriaService {
DAOFactory factory = DAOFactory.getDAOFactory(DAOFactory.MYSQL);
CategoriaDAO categoriaService = factory.getCategoria();
// http://localhost:8080/ApiRestFurniture/categoria/getCategoria
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("getCategoria")
public ArrayList<CategoriaBean> getCategoria() {
ArrayList<CategoriaBean> lista = null;
try {
lista = categoriaService.getCategoria();
} catch (Exception e) {
e.printStackTrace();
System.err.println("Error en CategoriaService() - getCategoria()" + e.getMessage());
e.getLocalizedMessage();
}
return lista;
}
// http://localhost:8080/ApiRestFurniture/categoria/getCategoriaEspecifica
@POST
@Produces(MediaType.APPLICATION_JSON)
@Path("getCategoriaEspecifica")
public ArrayList<CategoriaBean> getCategoriaEspecifica(final MyJaxBean input) {
System.out.println("param1 = " + input.param1);
// System.out.println("param2 = " + input.param2);
ArrayList<CategoriaBean> lista = null;
// try {
//
// lista = categoriaService.getCategoriaEspecifica(idCategoria);
// System.out.println("idCategoria==>" + idCategoria);
// } catch (Exception e) {
// e.printStackTrace();
// System.err.println("Error en CategoriaService() - getCategoriaEspecifica()" + e.getMessage());
// e.getLocalizedMessage();
// }
return lista;
}
}
| [
"[email protected]"
] | |
e2e49022993ba9694b05c7a2bc9bbac03f85e7cb | 0ea62d07e006deadafb02fea1b01ef68037a3499 | /app/src/androidTest/java/com/example/user/myapplication133/ApplicationTest.java | f427bb370c0b8f46c22fb7643cf40ba3c271184f | [] | no_license | guptaabhishek380/Android_Session_13.3_Assignment | 5c007e84333ddfad6104c3b219cf4cd96ddbde95 | 3a75de85091b1f95c1a2441ddec7b4287d168fef | refs/heads/master | 2021-01-19T07:55:04.869590 | 2017-02-15T13:58:36 | 2017-02-15T13:58:36 | 82,065,030 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 364 | java | package com.example.user.myapplication133;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"[email protected]"
] | |
d50d48c476b45025769182948245db6531f37b07 | a70af3ed770c05767d4325891694d7265dbb7020 | /src/main/java/com/eureka/main/controller/ClientMessages.java | 172a7313d1006a1dde1e30e0e8976878b5e70bf8 | [] | no_license | HarsheshShah08/ServiceDiscovery-ClientApp | 06cc2ee9a6be18c03783e3f887efecd5f436d45b | 628ba82f31af5d1e21f934d88f6bd5428e79fc33 | refs/heads/master | 2022-11-14T09:47:30.031242 | 2020-06-24T13:27:08 | 2020-06-24T13:27:08 | 274,675,247 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,287 | java | package com.eureka.main.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import com.netflix.appinfo.InstanceInfo;
import com.netflix.discovery.EurekaClient;
@RestController
public class ClientMessages {
@Autowired
private EurekaClient applicationService;
@Autowired
private RestTemplateBuilder restTemplateBuilder;
@RequestMapping("/")
public String callService() {
RestTemplate restTemplate = restTemplateBuilder.build();
InstanceInfo instanceInfo = applicationService.getNextServerFromEureka("applicationService", false);
String baseUrl = instanceInfo.getHomePageUrl();
ResponseEntity<String> response =
restTemplate.exchange(baseUrl, HttpMethod.GET, null, String.class);
return response.getBody();
}
}
| [
"[email protected]"
] | |
0e1c4666c20126b7a52ee63720c3371e2f24e119 | 293b4101b7955a5fda2865dfa8c6958244c0d6c4 | /JSPandServlet/FirstServletDemo/src/mum/cs472/StateServlet.java | 1172e4fad632e2ef9e44897490d30ab21afcc9ae | [] | no_license | JuliaChenJing/Web_Application_Dictionary | 62ca0e599c40a9c60ce5682b4de5219511314c20 | f77ec53a545096f04a7238a27a682fd78b6d999e | refs/heads/master | 2021-01-20T12:16:24.475486 | 2018-03-14T15:50:50 | 2018-03-14T15:50:50 | 101,707,272 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,908 | java | package mum.cs472;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.annotation.WebServlet;
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/StateServlet")
public class StateServlet extends HttpServlet {// 建立一个类,扩展HttpServlet接口
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// how to set request attribute
request.setAttribute("requestState", "requestState");
// how to set sesson attribute
request.getSession().setAttribute("sessionState", "sessionState");
// how to set context attribute
this.getServletContext().setAttribute("applicationState", "applicationState");
// cookies
Cookie c = new Cookie("cookiePermanentState", "cookiePermanentState");
// set cookie age
c.setMaxAge(3600);
response.addCookie(c);
c = new Cookie("cookieTemporaryState", "cookieTemporaryState");
response.addCookie(c);
// out put html form
PrintWriter out = response.getWriter();
out.print("<html><head><title>Test</title></head><body>");
// after submit, this form will be submited to doPost method
out.print("<form method='post'>");
out.print("<p>Please click the button,<br>this is from doGet method</p>");
// hidden fields
out.print("<input type='hidden' name='hiddenState' value='hiddenState'>");
out.print("<input type='submit' value='Click me'/>");
out.print("</form>");
out.print("</body></html>");
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
PrintWriter out = response.getWriter();
out.print(
"<html><head><title>Maintain State Demo </title></head><body><p>This is from the doPost method: <br> See the Bundled Tomcat(5.5.17)window</p></body></html>");
// output the attribute got in doGet method
System.out.format("requestState: %s\r\n", request.getAttribute("requestState"));
System.out.format("sessionState: %s\r\n", request.getSession().getAttribute("sessionState"));
System.out.format("applicationState: %s\r\n", this.getServletContext().getAttribute("applicationState"));
// cookie :Name/value pair of strings sent as message header between
// client and server
Cookie[] cookies = request.getCookies();
int cnt = 0;
if (cookies != null) {
for (Cookie cookie : cookies) {
if (cookie.getName().equals("cookiePermanentState"))
System.out.format("cookiePermanentState: %s\r\n", cookie.getValue());
else if (cookie.getName().equals("cookieTemporaryState"))
System.out.format("cookieTemporaryState: %s\r\n", cookie.getValue());
}
}
System.out.format("hiddenState: %s\r\n", request.getParameter("hiddenState"));
}
}
| [
"[email protected]"
] | |
77ec98b974badbf44a60dea98ca37624523af390 | a1796b4b16f9ee4172c4869be719b951a95e7e1e | /src/main/java/F_L/filter/filterDemo.java | 53d79c0a9cd58d1cb1632c81a842cb3f66431ae5 | [] | no_license | syyymq0602/JavaWeb | 37b7d64cf0b8944f47a64c6ef9ec464a4ea21719 | 643f7a3710e8aeda6bfb38a4c3811d1678cb1e89 | refs/heads/main | 2023-08-20T17:08:50.192281 | 2021-10-17T13:01:30 | 2021-10-17T13:01:30 | 349,434,888 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 599 | java | package F_L.filter;
import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;
public class filterDemo implements Filter {
@Override
public void init(FilterConfig filterConfig) throws ServletException {
}
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
System.out.println("Filter is working.....");
filterChain.doFilter(servletRequest,servletResponse);
}
@Override
public void destroy() {
}
}
| [
"[email protected]"
] | |
e1aea4d09033688fa0437102ac3a4b983367742e | ede26f41b4fddb812cf29562d975fec971396c6d | /11-Union-Find/src/_02_Quick_Find/UnionFind1.java | afe21fc26227a1a33117d7bf4ca3cb221dd0b54a | [] | no_license | zchengi/Data-Structures | ca5d8a157aec38f195323756af0310a20de4d40d | 7cb7939b28afa9c838c3b2b0c71126cc84d90ced | refs/heads/master | 2020-03-16T08:01:43.309007 | 2018-08-03T08:15:32 | 2018-08-03T08:15:32 | 132,588,855 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,319 | java | package _02_Quick_Find;
import utils.UF;
/**
* Quick Find
*
* @author cheng
* 2018/5/17 14:00
*/
public class UnionFind1 implements UF {
private int[] id;
public UnionFind1(int size) {
id = new int[size];
for (int i = 0; i < id.length; i++) {
id[i] = i;
}
}
/**
* 合并元素p和元素q所属的集合
*
* @param p
* @param q
*/
@Override
public void unionElements(int p, int q) {
int pId = find(p);
int qId = find(q);
if (pId == qId) {
return;
}
for (int i = 0; i < id.length; i++) {
if (id[i] == pId) {
id[i] = qId;
}
}
}
/**
* 查看元素p和元素q是否所属一个集合
*
* @param p
* @param q
* @return
*/
@Override
public boolean isConnected(int p, int q) {
return find(p) == find(q);
}
/**
* 查找元素p所对应的集合编号
*
* @param p
* @return
*/
private int find(int p) {
if (p < 0 || p >= id.length) {
throw new IllegalArgumentException("p is not of bound.");
}
return id[p];
}
@Override
public int getSize() {
return id.length;
}
}
| [
"[email protected]"
] | |
769f0ef3b385a78d4e21943a6d4552985faccf8c | ed5159d056e98d6715357d0d14a9b3f20b764f89 | /test/irvine/oeis/a045/A045169Test.java | 5843b610984671753c1f4e8a07bf01b90442842c | [] | no_license | flywind2/joeis | c5753169cf562939b04dd246f8a2958e97f74558 | e5efd6971a0062ac99f4fae21a7c78c9f9e74fea | refs/heads/master | 2020-09-13T18:34:35.080552 | 2019-11-19T05:40:55 | 2019-11-19T05:40:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 195 | java | package irvine.oeis.a045;
import irvine.oeis.AbstractSequenceTest;
/**
* Tests the corresponding class.
* @author Sean A. Irvine
*/
public class A045169Test extends AbstractSequenceTest {
}
| [
"[email protected]"
] | |
dd8c60bab3f69c37aa4c9bd54bf85b3d41343eb6 | 399dacae69c831ccfbfe8cd87685388c6396fffd | /src/main/java/com/doraliz/ecommerce/domain/enumeration/EstadoPedido.java | 46ad2a3a8bada01a690b487756a1846eae552e43 | [] | no_license | fesquivelc/ecommerce | a0336466b585dd3a44b75b06baaaf3b6fad933f7 | 26cddd3c93ee8cfbe8d7b22e989416394a052df2 | refs/heads/master | 2021-07-13T05:43:59.746713 | 2017-10-18T11:56:58 | 2017-10-18T11:56:58 | 107,401,653 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 163 | java | package com.doraliz.ecommerce.domain.enumeration;
/**
* The EstadoPedido enumeration.
*/
public enum EstadoPedido {
GENERADO, ACEPTADO, ENVIADO, RECIBIDO
}
| [
"[email protected]"
] | |
d3a505d9e8602484e2a28be463f9afe6d0726aa5 | 9ab91b074703bcfe9c9407e1123e2b551784a680 | /plugins/org.eclipse.osee.account.admin/src/org/eclipse/osee/account/admin/internal/validator/UuidValidator.java | 72b3f85b2312cb8eda84b671cf02a35643b6285a | [] | no_license | pkdevbox/osee | 7ad9c083c3df8a7e9ef6185a419680cc08e21769 | 7e31f80f43d6d0b661af521fdd93b139cb694001 | refs/heads/master | 2021-01-22T00:30:05.686402 | 2015-06-08T21:19:57 | 2015-06-09T18:42:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 955 | java | /*******************************************************************************
* Copyright (c) 2013 Boeing.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
package org.eclipse.osee.account.admin.internal.validator;
import org.eclipse.osee.account.admin.AccountField;
import org.eclipse.osee.framework.jdk.core.util.GUID;
/**
* @author Roberto E. Escobar
*/
public class UuidValidator extends AbstractValidator {
@Override
public AccountField getFieldType() {
return AccountField.UUID;
}
@Override
public boolean isValid(String value) {
return GUID.isValid(value);
}
}
| [
"[email protected]"
] | |
44f2f26711c959babd2511374fe780f13624527a | 6ac07128b3e1a37628ff29363cdc176762ce3ace | /quarkc/test/emit/expected/java/quark/src/main/java/quark_md/quark_concurrent_CollectorExecutor__start_Method.java | 0038b4df63e9cc390a0cf8cbf68abf210cfea1cc | [
"Apache-2.0"
] | permissive | bozzzzo/quark | b735f30c30362bb4b1c93babb84f68caeb202cc7 | f569642eb618848c4168d864c6abb3462d033459 | refs/heads/master | 2021-01-22T00:13:36.933589 | 2016-04-21T17:57:17 | 2016-04-21T17:57:17 | 44,208,481 | 1 | 0 | null | 2015-10-13T22:10:00 | 2015-10-13T22:09:59 | null | UTF-8 | Java | false | false | 753 | java | package quark_md;
public class quark_concurrent_CollectorExecutor__start_Method extends quark.reflect.Method implements io.datawire.quark.runtime.QObject {
public quark_concurrent_CollectorExecutor__start_Method() {
super("quark.void", "_start", new java.util.ArrayList(java.util.Arrays.asList(new Object[]{})));
}
public Object invoke(Object object, java.util.ArrayList<Object> args) {
quark.concurrent.CollectorExecutor obj = (quark.concurrent.CollectorExecutor) (object);
(obj)._start();
return null;
}
public String _getClass() {
return (String) (null);
}
public Object _getField(String name) {
return null;
}
public void _setField(String name, Object value) {}
}
| [
"[email protected]"
] | |
6a78401c601f86e259f05763b86355459c254004 | c7194bd36d8fb73d9db3db909c9643bfb9d326f8 | /springCloudConfigClient/src/main/java/me/helllp/demo/springbootConfigClient/ConfigController.java | 594c0a8be39369ef35c88500d3fc02460dd99629 | [
"Apache-2.0"
] | permissive | xiaofengjingbo/miscroServiceHello | 783a808d31d8ffc657234067417899ea6c245515 | 2a621bb3fc7b808304723e9bb96c3bbe9971ef27 | refs/heads/master | 2020-03-26T18:54:27.918360 | 2017-07-19T13:43:09 | 2017-07-19T13:43:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 502 | java | package me.helllp.demo.springbootConfigClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RefreshScope
@RestController
public class ConfigController {
@Value("${myenv}")
private String env;
@RequestMapping("/config")
public String config(){
return env;
}
}
| [
"[email protected]"
] | |
ea899a77dad732f38598d7708ae6c20952c0e95b | f6bd366b0065bece0947e359ca0ff3af04a0ea9c | /gulimall-coupon/src/main/java/com/ggs/gulimall/coupon/entity/HomeAdvEntity.java | 7449b898a628449d3e3bda9196087136518e93a6 | [] | no_license | startbug/gulimall | 9ea3e9c0ce2df1027010783411b71738446c72f7 | 4ccfb1675ff8a4f21681f90fe54efc1057dab12b | refs/heads/master | 2023-01-24T05:31:05.775630 | 2020-12-19T12:04:13 | 2020-12-19T12:04:13 | 320,814,564 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,056 | java | package com.ggs.gulimall.coupon.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 首页轮播广告
*
* @author starbug
* @email [email protected]
* @date 2020-12-14 13:08:12
*/
@Data
@TableName("sms_home_adv")
public class HomeAdvEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
@TableId
private Long id;
/**
* 名字
*/
private String name;
/**
* 图片地址
*/
private String pic;
/**
* 开始时间
*/
private Date startTime;
/**
* 结束时间
*/
private Date endTime;
/**
* 状态
*/
private Integer status;
/**
* 点击数
*/
private Integer clickCount;
/**
* 广告详情连接地址
*/
private String url;
/**
* 备注
*/
private String note;
/**
* 排序
*/
private Integer sort;
/**
* 发布者
*/
private Long publisherId;
/**
* 审核者
*/
private Long authId;
}
| [
"[email protected]"
] | |
01c09ffbaa9c8a85c0054a6d1556240aed389d3f | 8191bea395f0e97835735d1ab6e859db3a7f8a99 | /f737922a0ddc9335bb0fc2f3ae5ffe93_source_from_JADX/java_files/ant$1.java | 018567582d75f70399f13ab598f307f868a1ace0 | [] | no_license | msmtmsmt123/jadx-1 | 5e5aea319e094b5d09c66e0fdb31f10a3238346c | b9458bb1a49a8a7fba8b9f9a6fb6f54438ce03a2 | refs/heads/master | 2021-05-08T19:21:27.870459 | 2017-01-28T04:19:54 | 2017-01-28T04:19:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,384 | java | import java.util.Iterator;
import java.util.NoSuchElementException;
class ant$1 implements Iterator<V> {
private int DW;
private int FH;
private int Hw;
final /* synthetic */ ant j6;
private V v5;
ant$1(ant ant) {
this.j6 = ant;
}
public /* synthetic */ Object next() {
return j6();
}
public boolean hasNext() {
return this.DW < this.j6.DW;
}
public V j6() {
if (this.v5 != null) {
return j6(this.v5);
}
while (true) {
ant$a[] ant_aArr = this.j6.j6[this.FH];
if (this.Hw == ant_aArr.length) {
int i = this.FH + 1;
this.FH = i;
if (i >= (1 << this.j6.Hw)) {
break;
}
ant_aArr = this.j6.j6[this.FH];
this.Hw = 0;
}
while (this.Hw < ant_aArr.length) {
int i2 = this.Hw;
this.Hw = i2 + 1;
ant$a ant_a = ant_aArr[i2];
if (ant_a != null) {
return j6(ant_a);
}
}
}
throw new NoSuchElementException();
}
private V j6(V v) {
this.DW++;
this.v5 = v.Zo;
return v;
}
public void remove() {
throw new UnsupportedOperationException();
}
}
| [
"[email protected]"
] | |
6cc060b736572a4d565e3c7ef9935e5ac8a8454f | a362bf811acfa93b8b8ec2837fcbbb83288ff4ab | /src/com/java/algorithm/dp/TextPlacement.java | 7c8fd5e4fb337147647fe7c92b3518d1e87e94ff | [] | no_license | mirdesai81/JavaDesginPatterns | 247c76a9a3538b228c8855d2c95c3470ba76a780 | f17a5aa701e0226e5dae20376f1223aa4883bc06 | refs/heads/master | 2021-09-23T16:13:02.139132 | 2021-09-22T22:53:01 | 2021-09-22T22:53:01 | 78,155,262 | 1 | 0 | null | 2020-11-02T02:23:16 | 2017-01-05T23:01:48 | Java | UTF-8 | Java | false | false | 1,559 | java | package com.java.algorithm.dp;
import com.java.stdlib.StdOut;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class TextPlacement {
public static int minimumMessiness(List<String> words, int lineLength) {
int[] minimumMessiness = new int[words.size()];
Arrays.fill(minimumMessiness,Integer.MAX_VALUE);
int numRemainingBlanks = lineLength - words.get(0).length();
minimumMessiness[0] = numRemainingBlanks * numRemainingBlanks;
for(int i = 1; i < words.size(); i++) {
numRemainingBlanks = lineLength - words.get(i).length();
minimumMessiness[i] = minimumMessiness[i - 1] + numRemainingBlanks * numRemainingBlanks;
// try adding words i - 1, i -2 ...
for(int j = i - 1; j >= 0; j--) {
numRemainingBlanks = numRemainingBlanks - (words.get(j).length() + 1);
if(numRemainingBlanks < 0) {
break;
}
int firstJMessiness = j - 1 < 0 ? 0 : minimumMessiness[j - 1];
int currentLineMessiness = numRemainingBlanks * numRemainingBlanks;
minimumMessiness[i] = Math.min(minimumMessiness[i] , firstJMessiness + currentLineMessiness);
}
}
return minimumMessiness[words.size() - 1];
}
public static void main(String[] args) {
List<String> words = new ArrayList<>(Arrays.asList("aaa","bbb","c","d","ee","ff","ggggggg"));
StdOut.println(minimumMessiness(words,11));
}
}
| [
"[email protected]"
] | |
bfcdfab2ecc9bc17f80281e679ffe3f932914e19 | dd5874dc1a4d1813825467a2dea7bcc3b79b48be | /hm-crm/src/main/java/com/crm/service/DingAppService.java | 23e564071c4b20a53b788348b6295ed78480fc08 | [] | no_license | Whisky-Xo/hm_work | 93b7c3a45c30ade4e6ce1b987f369d9ec2828a49 | 02848084ad7bc783586cc851efec998af3ff2bc1 | refs/heads/master | 2021-01-19T20:31:09.559028 | 2017-04-17T14:52:59 | 2017-04-17T14:52:59 | 88,515,230 | 1 | 3 | null | null | null | null | UTF-8 | Java | false | false | 707 | java | package com.crm.service;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.crm.model.Company_dingApp;
import com.crm.model.DingApp;
public interface DingAppService {
public int createDingApp(DingApp app);
public int updateDingApp(DingApp app);
public DingApp getDingAppById(@Param("id") int id);
public List<DingApp> listDingAppByCompanyId(Integer companyId);
public List<DingApp> getDingApps();
public List<DingApp> getDingAppsByComaonyId(int companyId);
public Company_dingApp getCompanyDingApp(int companyId, int appId);
public int updateCompanyDingApp(Company_dingApp companyDingApp);
public int createCompanyDingApp(Company_dingApp companyDingApp);
}
| [
"[email protected]"
] | |
5374692bd3acd30d6e17b87c30f6c3aeebac0c17 | e2041faabc9f4d50e5e0db271f3f1c9ea2247dbd | /app/src/main/java/com/senmass/bayuejiu/MainActivity.java | 6b33cf753ad3e34c1663552087911c74a3ae6c0f | [] | no_license | LiHangKun/bayuejiu | 94f4ca091eeac28b1c3be23230904e623c3ee7a4 | aa141257df60c808dd510a0adfb8db12ed444d32 | refs/heads/master | 2022-11-30T00:02:14.936172 | 2020-08-10T05:50:06 | 2020-08-10T05:50:06 | 286,386,525 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,415 | java | package com.senmass.bayuejiu;
import androidx.appcompat.app.AppCompatActivity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import com.senmass.bayuejiu.Utils.RequestCodeInfo;
public class MainActivity extends AppCompatActivity {
private Button main_choose_city;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
main_choose_city = findViewById(R.id.main_choose_city);
main_choose_city.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivityForResult(new Intent(MainActivity.this,CityPickerActivity.class), RequestCodeInfo.GETCITY);
}
});
}
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == Activity.RESULT_OK) {
switch (requestCode) {
case RequestCodeInfo.GETCITY:
String city=data.getExtras().getString("city");
if(city!= null) {
main_choose_city.setText(city);
}
break;
}
}
}
}
| [
"[email protected]"
] | |
badf0dc2de72ef6fc4573ef50572296f06daea74 | fe9fb0a5a7e0a3cf5acf80195a90bdf73560370a | /as5-core/src/main/java/org/vanilladb/core/remote/jdbc/ResultSetMetaDataAdapter.java | 311106381d36a2f8e3451c2859071fd2fd5fdd51 | [] | no_license | okrtjhel/NTHU-106DB-FinalProject | f3d10d3d3bd1886010bb9b51ed1e0a4a0b4aeed8 | 6c7f2ff9b8ec63c354da841f6a06200b6b0b2fac | refs/heads/master | 2022-12-05T20:23:05.354881 | 2020-08-07T05:01:39 | 2020-08-07T05:01:39 | 285,740,833 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,212 | java | /*******************************************************************************
* Copyright 2017 vanilladb.org
*
* 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.vanilladb.core.remote.jdbc;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
/**
* This class implements all of the methods of the ResultSetMetaData interface,
* by throwing an exception for each one. Subclasses (such as
* {@link JdbcMetaData}) can override those methods that it want to implement.
*/
public abstract class ResultSetMetaDataAdapter implements ResultSetMetaData {
@Override
public String getCatalogName(int column) throws SQLException {
throw new SQLException("operation not implemented");
}
@Override
public String getColumnClassName(int column) throws SQLException {
throw new SQLException("operation not implemented");
}
@Override
public int getColumnCount() throws SQLException {
throw new SQLException("operation not implemented");
}
@Override
public int getColumnDisplaySize(int column) throws SQLException {
throw new SQLException("operation not implemented");
}
@Override
public String getColumnLabel(int column) throws SQLException {
throw new SQLException("operation not implemented");
}
@Override
public String getColumnName(int column) throws SQLException {
throw new SQLException("operation not implemented");
}
@Override
public int getColumnType(int column) throws SQLException {
throw new SQLException("operation not implemented");
}
@Override
public String getColumnTypeName(int column) throws SQLException {
throw new SQLException("operation not implemented");
}
@Override
public int getPrecision(int column) throws SQLException {
throw new SQLException("operation not implemented");
}
@Override
public int getScale(int column) throws SQLException {
throw new SQLException("operation not implemented");
}
@Override
public String getSchemaName(int column) throws SQLException {
throw new SQLException("operation not implemented");
}
@Override
public String getTableName(int column) throws SQLException {
throw new SQLException("operation not implemented");
}
@Override
public boolean isAutoIncrement(int column) throws SQLException {
throw new SQLException("operation not implemented");
}
@Override
public boolean isCaseSensitive(int column) throws SQLException {
throw new SQLException("operation not implemented");
}
@Override
public boolean isCurrency(int column) throws SQLException {
throw new SQLException("operation not implemented");
}
@Override
public boolean isDefinitelyWritable(int column) throws SQLException {
throw new SQLException("operation not implemented");
}
@Override
public int isNullable(int column) throws SQLException {
throw new SQLException("operation not implemented");
}
@Override
public boolean isReadOnly(int column) throws SQLException {
throw new SQLException("operation not implemented");
}
@Override
public boolean isSearchable(int column) throws SQLException {
throw new SQLException("operation not implemented");
}
@Override
public boolean isSigned(int column) throws SQLException {
throw new SQLException("operation not implemented");
}
@Override
public boolean isWritable(int column) throws SQLException {
throw new SQLException("operation not implemented");
}
@Override
public boolean isWrapperFor(Class<?> iface) throws SQLException {
throw new SQLException("operation not implemented");
}
@Override
public <T> T unwrap(Class<T> iface) throws SQLException {
throw new SQLException("operation not implemented");
}
}
| [
"[email protected]"
] | |
4cf02661eed49676bfcaccb178ab91b81082e8ef | 43a050e1a7175eb772acfbc72da543106a79e30b | /src/main/java/zjh/codecraft/ioc/beans/AbstractBeanDefinitionReader.java | 923697170ca8f3be6f20a1fa7cb0a2a5c56813e5 | [] | no_license | zhengjianhui/simple-spring | b7e43d27ea4554c541b6faa287bd8d2d3abc7f9f | a1320bf3dc5f5d11d515c801b8510bfb16e003df | refs/heads/master | 2020-04-03T09:45:58.632140 | 2018-11-05T03:13:49 | 2018-11-05T03:13:49 | 155,175,347 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 771 | java | package zjh.codecraft.ioc.beans;
import java.util.HashMap;
import java.util.Map;
import zjh.codecraft.ioc.beans.io.ResourceLoader;
/**
* 从配置中读取BeanDefinitionReader
*
* @author [email protected]
*/
public abstract class AbstractBeanDefinitionReader implements BeanDefinitionReader {
private Map<String, BeanDefinition> registry;
private ResourceLoader resourceLoader;
protected AbstractBeanDefinitionReader(ResourceLoader resourceLoader) {
this.registry = new HashMap<String, BeanDefinition>();
this.resourceLoader = resourceLoader;
}
public Map<String, BeanDefinition> getRegistry() {
return registry;
}
public ResourceLoader getResourceLoader() {
return resourceLoader;
}
}
| [
"[email protected]"
] | |
d88d3672c522af18f38455bcb0975e4bec2bda50 | 0746ea4d30db5ae053bf334ff66e1c2fd22beec8 | /xbol/maf/server/XxgamMaTicketP2EOImpl.java | 90e86fb04d106690c1fcc62d98fe2a8fece61e28 | [] | no_license | ernesto-na/apps | d857b31ac41065188f3b3da779f87fc11a45cbdd | c73326559c74188701a17cbad5a5fe78a1fb03ff | refs/heads/master | 2020-03-18T09:50:32.922779 | 2018-08-09T23:44:42 | 2018-08-09T23:44:42 | 134,582,784 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,622 | java | package xxgam.oracle.apps.xbol.maf.server;
import oracle.apps.fnd.framework.server.OAEntityDefImpl;
import oracle.apps.fnd.framework.server.OAEntityImpl;
import oracle.jbo.domain.Date;
import oracle.jbo.domain.Number;
import oracle.jbo.domain.RowID;
import oracle.jbo.server.AttributeDefImpl;
import oracle.jbo.server.EntityDefImpl;
// ---------------------------------------------------------------------
// --- File generated by Oracle ADF Business Components Design Time.
// --- Custom code may be added to this class.
// --- Warning: Do not modify method signatures of generated methods.
// ---------------------------------------------------------------------
public class XxgamMaTicketP2EOImpl extends OAEntityImpl {
public static final int ID = 0;
public static final int PAYMENTREQID = 1;
public static final int PNR = 2;
public static final int TICKETOFFICE = 3;
public static final int CONTACTPHONE = 4;
public static final int EMAIL = 5;
public static final int TYPEEMISSION = 6;
public static final int FOLIO = 7;
public static final int CREATIONDATE = 8;
public static final int CREATEDBY = 9;
public static final int LASTUPDATEDATE = 10;
public static final int LASTUPDATELOGIN = 11;
public static final int ROWID = 12;
public static final int GENERALREQID = 13;
public static final int BENEFICIARY = 14;
public static final int RELATIONSHIP = 15;
public static final int BENEFITS = 16;
public static final int COMPANY = 17;
public static final int LASTUPDATEDBY = 18;
public static final int XXGAMMAPAYMENTREQEO = 20;
private static OAEntityDefImpl mDefinitionObject;
/**This is the default constructor (do not remove)
*/
public XxgamMaTicketP2EOImpl() {
}
/**Retrieves the definition object for this instance class.
*/
public static synchronized EntityDefImpl getDefinitionObject() {
if (mDefinitionObject == null) {
mDefinitionObject =
(OAEntityDefImpl)EntityDefImpl.findDefObject("xxgam.oracle.apps.xbol.maf.server.XxgamMaTicketP2EO");
}
return mDefinitionObject;
}
/**Gets the attribute value for Id, using the alias name Id
*/
public Number getId() {
return (Number)getAttributeInternal(ID);
}
/**Sets <code>value</code> as the attribute value for Id
*/
public void setId(Number value) {
setAttributeInternal(ID, value);
}
/**Gets the attribute value for PaymentReqId, using the alias name PaymentReqId
*/
public Number getPaymentReqId() {
return (Number)getAttributeInternal(PAYMENTREQID);
}
/**Sets <code>value</code> as the attribute value for PaymentReqId
*/
public void setPaymentReqId(Number value) {
setAttributeInternal(PAYMENTREQID, value);
}
/**Gets the attribute value for Pnr, using the alias name Pnr
*/
public String getPnr() {
return (String)getAttributeInternal(PNR);
}
/**Sets <code>value</code> as the attribute value for Pnr
*/
public void setPnr(String value) {
setAttributeInternal(PNR, value);
}
/**Gets the attribute value for TicketOffice, using the alias name TicketOffice
*/
public String getTicketOffice() {
return (String)getAttributeInternal(TICKETOFFICE);
}
/**Sets <code>value</code> as the attribute value for TicketOffice
*/
public void setTicketOffice(String value) {
setAttributeInternal(TICKETOFFICE, value);
}
/**Gets the attribute value for ContactPhone, using the alias name ContactPhone
*/
public String getContactPhone() {
return (String)getAttributeInternal(CONTACTPHONE);
}
/**Sets <code>value</code> as the attribute value for ContactPhone
*/
public void setContactPhone(String value) {
setAttributeInternal(CONTACTPHONE, value);
}
/**Gets the attribute value for Email, using the alias name Email
*/
public String getEmail() {
return (String)getAttributeInternal(EMAIL);
}
/**Sets <code>value</code> as the attribute value for Email
*/
public void setEmail(String value) {
setAttributeInternal(EMAIL, value);
}
/**Gets the attribute value for TypeEmission, using the alias name TypeEmission
*/
public String getTypeEmission() {
return (String)getAttributeInternal(TYPEEMISSION);
}
/**Sets <code>value</code> as the attribute value for TypeEmission
*/
public void setTypeEmission(String value) {
setAttributeInternal(TYPEEMISSION, value);
}
/**Gets the attribute value for Folio, using the alias name Folio
*/
public String getFolio() {
return (String)getAttributeInternal(FOLIO);
}
/**Sets <code>value</code> as the attribute value for Folio
*/
public void setFolio(String value) {
setAttributeInternal(FOLIO, value);
}
/**Gets the attribute value for CreationDate, using the alias name CreationDate
*/
public Date getCreationDate() {
return (Date)getAttributeInternal(CREATIONDATE);
}
/**Sets <code>value</code> as the attribute value for CreationDate
*/
public void setCreationDate(Date value) {
setAttributeInternal(CREATIONDATE, value);
}
/**Gets the attribute value for CreatedBy, using the alias name CreatedBy
*/
public Number getCreatedBy() {
return (Number)getAttributeInternal(CREATEDBY);
}
/**Sets <code>value</code> as the attribute value for CreatedBy
*/
public void setCreatedBy(Number value) {
setAttributeInternal(CREATEDBY, value);
}
/**Gets the attribute value for LastUpdateDate, using the alias name LastUpdateDate
*/
public Date getLastUpdateDate() {
return (Date)getAttributeInternal(LASTUPDATEDATE);
}
/**Sets <code>value</code> as the attribute value for LastUpdateDate
*/
public void setLastUpdateDate(Date value) {
setAttributeInternal(LASTUPDATEDATE, value);
}
/**Gets the attribute value for LastUpdateLogin, using the alias name LastUpdateLogin
*/
public Number getLastUpdateLogin() {
return (Number)getAttributeInternal(LASTUPDATELOGIN);
}
/**Sets <code>value</code> as the attribute value for LastUpdateLogin
*/
public void setLastUpdateLogin(Number value) {
setAttributeInternal(LASTUPDATELOGIN, value);
}
/**Gets the attribute value for RowID, using the alias name RowID
*/
public RowID getRowID() {
return (RowID)getAttributeInternal(ROWID);
}
/**getAttrInvokeAccessor: generated method. Do not modify.
*/
protected Object getAttrInvokeAccessor(int index,
AttributeDefImpl attrDef) throws Exception {
switch (index) {
case ID:
return getId();
case PAYMENTREQID:
return getPaymentReqId();
case PNR:
return getPnr();
case TICKETOFFICE:
return getTicketOffice();
case CONTACTPHONE:
return getContactPhone();
case EMAIL:
return getEmail();
case TYPEEMISSION:
return getTypeEmission();
case FOLIO:
return getFolio();
case CREATIONDATE:
return getCreationDate();
case CREATEDBY:
return getCreatedBy();
case LASTUPDATEDATE:
return getLastUpdateDate();
case LASTUPDATELOGIN:
return getLastUpdateLogin();
case ROWID:
return getRowID();
case GENERALREQID:
return getGeneralReqId();
case BENEFICIARY:
return getBeneficiary();
case RELATIONSHIP:
return getRelationship();
case BENEFITS:
return getBenefits();
case COMPANY:
return getCompany();
case LASTUPDATEDBY:
return getLastUpdatedBy();
default:
return super.getAttrInvokeAccessor(index, attrDef);
}
}
/**setAttrInvokeAccessor: generated method. Do not modify.
*/
protected void setAttrInvokeAccessor(int index, Object value,
AttributeDefImpl attrDef) throws Exception {
switch (index) {
case ID:
setId((Number)value);
return;
case PAYMENTREQID:
setPaymentReqId((Number)value);
return;
case PNR:
setPnr((String)value);
return;
case TICKETOFFICE:
setTicketOffice((String)value);
return;
case CONTACTPHONE:
setContactPhone((String)value);
return;
case EMAIL:
setEmail((String)value);
return;
case TYPEEMISSION:
setTypeEmission((String)value);
return;
case FOLIO:
setFolio((String)value);
return;
case CREATIONDATE:
setCreationDate((Date)value);
return;
case CREATEDBY:
setCreatedBy((Number)value);
return;
case LASTUPDATEDATE:
setLastUpdateDate((Date)value);
return;
case LASTUPDATELOGIN:
setLastUpdateLogin((Number)value);
return;
case GENERALREQID:
setGeneralReqId((Number)value);
return;
case BENEFICIARY:
setBeneficiary((String)value);
return;
case RELATIONSHIP:
setRelationship((String)value);
return;
case BENEFITS:
setBenefits((String)value);
return;
case COMPANY:
setCompany((String)value);
return;
case LASTUPDATEDBY:
setLastUpdatedBy((Number)value);
return;
default:
super.setAttrInvokeAccessor(index, value, attrDef);
return;
}
}
/**Gets the associated entity XxGamMaPaymentReqEOImpl
*/
public XxGamMaPaymentReqEOImpl getXxGamMaPaymentReqEO() {
return (XxGamMaPaymentReqEOImpl)getAttributeInternal(XXGAMMAPAYMENTREQEO);
}
/**Sets <code>value</code> as the associated entity XxGamMaPaymentReqEOImpl
*/
public void setXxGamMaPaymentReqEO(XxGamMaPaymentReqEOImpl value) {
setAttributeInternal(XXGAMMAPAYMENTREQEO, value);
}
public void setLastUpdatedBy(Number number) {
}
/**Gets the attribute value for GeneralReqId, using the alias name GeneralReqId
*/
public Number getGeneralReqId() {
return (Number)getAttributeInternal(GENERALREQID);
}
/**Sets <code>value</code> as the attribute value for GeneralReqId
*/
public void setGeneralReqId(Number value) {
setAttributeInternal(GENERALREQID, value);
}
/**Gets the attribute value for Beneficiary, using the alias name Beneficiary
*/
public String getBeneficiary() {
return (String)getAttributeInternal(BENEFICIARY);
}
/**Sets <code>value</code> as the attribute value for Beneficiary
*/
public void setBeneficiary(String value) {
setAttributeInternal(BENEFICIARY, value);
}
/**Gets the attribute value for Relationship, using the alias name Relationship
*/
public String getRelationship() {
return (String)getAttributeInternal(RELATIONSHIP);
}
/**Sets <code>value</code> as the attribute value for Relationship
*/
public void setRelationship(String value) {
setAttributeInternal(RELATIONSHIP, value);
}
/**Gets the attribute value for Benefits, using the alias name Benefits
*/
public String getBenefits() {
return (String)getAttributeInternal(BENEFITS);
}
/**Sets <code>value</code> as the attribute value for Benefits
*/
public void setBenefits(String value) {
setAttributeInternal(BENEFITS, value);
}
/**Gets the attribute value for Company, using the alias name Company
*/
public String getCompany() {
return (String)getAttributeInternal(COMPANY);
}
/**Sets <code>value</code> as the attribute value for Company
*/
public void setCompany(String value) {
setAttributeInternal(COMPANY, value);
}
/**Gets the attribute value for LastUpdatedBy, using the alias name LastUpdatedBy
*/
public Number getLastUpdatedBy() {
return (Number)getAttributeInternal(LASTUPDATEDBY);
}
}
| [
"[email protected]"
] | |
38327bbd92e6b5ad5531e30fe26c03fef0a6d99b | 9401ec0397c7b7a975a6fc2b1416babfae8be521 | /app/src/main/java/com/example/wen/tutorwithparse/SignupActivity.java | 17470c28f0e84947125f5a1e983b19759738337e | [] | no_license | hewen852369/FinalTutor | 5d99e37bcb9e0edce77ffbf12093d6eb7890c72e | 3a7fee874f67805828f303d7bf778c31cd66f62e | refs/heads/master | 2021-01-17T14:52:26.341606 | 2016-06-20T02:10:01 | 2016-06-20T02:10:01 | 55,810,998 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,868 | java | package com.example.wen.tutorwithparse;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;
import com.parse.FindCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import java.util.List;
public class SignupActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_signup);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setTitle("Sign Up");
}
public void signupClick(View v)
{
if(v.getId()==R.id.Bsignup)
{
EditText name = (EditText)findViewById(R.id.TFname);
EditText email = (EditText)findViewById(R.id.TFemail);
EditText uname = (EditText)findViewById(R.id.TFusername);
EditText pass1 = (EditText)findViewById(R.id.TFpassword);
EditText pass2 = (EditText)findViewById(R.id.TFpassword1);
String namestr = name.getText().toString();
String emailstr = email.getText().toString();
String unamestr = uname.getText().toString();
String pass1str = pass1.getText().toString();
String pass2str = pass2.getText().toString();
if(namestr.isEmpty())
{
Toast name_check = Toast.makeText(SignupActivity.this,"Please enter your name.",Toast.LENGTH_SHORT);
name_check.show();
}
else if(!emailstr.contains("@"))
{
Toast email_check = Toast.makeText(SignupActivity.this,"Invalid email address.",Toast.LENGTH_SHORT);
email_check.show();
}
else if(unamestr.length()<8)
{
Toast uname_check = Toast.makeText(SignupActivity.this,"User name length must be more than 8.",Toast.LENGTH_SHORT);
uname_check.show();
}
else if(pass1str.length()<8)
{
Toast pass_check = Toast.makeText(SignupActivity.this,"Password length must be more than 8",Toast.LENGTH_SHORT);
pass_check.show();
}
else if(pass1str.equals(unamestr))
{
Toast passw_check = Toast.makeText(SignupActivity.this,"Password can't be same as username",Toast.LENGTH_SHORT);
passw_check.show();
}
else if(!pass1str.equals(pass2str))
{
//poptp message
Toast pass_check = Toast.makeText(SignupActivity.this,"Passwords don't match.",Toast.LENGTH_SHORT);
pass_check.show();
}
else
{
ParseQuery<ParseObject> query = ParseQuery.getQuery("Members");
query.whereEqualTo("MemberID", unamestr);
query.findInBackground(new FindCallback<ParseObject>() {
@Override
public void done(List<ParseObject> list, ParseException e) {
if (e == null)
{
if (list.size() > 0)
{
Toast username_check = Toast.makeText(SignupActivity.this, "Username already exist", Toast.LENGTH_SHORT);
username_check.show();
}
else
{
EditText name = (EditText)findViewById(R.id.TFname);
EditText email = (EditText)findViewById(R.id.TFemail);
EditText uname = (EditText)findViewById(R.id.TFusername);
EditText pass1 = (EditText)findViewById(R.id.TFpassword);
String namestr = name.getText().toString();
String emailstr = email.getText().toString();
String unamestr = uname.getText().toString();
String pass1str = pass1.getText().toString();
Intent i = new Intent(SignupActivity.this, StudentSignUpActivity.class);
i.putExtra("username", unamestr);
i.putExtra("email", emailstr);
i.putExtra("name", namestr);
i.putExtra("password", pass1str);
startActivity(i);
}
}
else
{
Toast Signup_check = Toast.makeText(SignupActivity.this, "Sign fail.", Toast.LENGTH_SHORT);
Signup_check.show();
}
}
});
}
}
}
public void TutorClick(View v)
{
if(v.getId()==R.id.Btutorsignup)
{
EditText name = (EditText)findViewById(R.id.TFname);
EditText email = (EditText)findViewById(R.id.TFemail);
EditText uname = (EditText)findViewById(R.id.TFusername);
EditText pass1 = (EditText)findViewById(R.id.TFpassword);
EditText pass2 = (EditText)findViewById(R.id.TFpassword1);
String namestr = name.getText().toString();
String emailstr = email.getText().toString();
String unamestr = uname.getText().toString();
String pass1str = pass1.getText().toString();
String pass2str = pass2.getText().toString();
if(namestr.isEmpty())
{
Toast name_check = Toast.makeText(SignupActivity.this,"Please enter your name.",Toast.LENGTH_SHORT);
name_check.show();
}
else if(!emailstr.contains("@"))
{
Toast email_check = Toast.makeText(SignupActivity.this,"Invalid email address.",Toast.LENGTH_SHORT);
email_check.show();
}
else if(unamestr.length()<8)
{
Toast uname_check = Toast.makeText(SignupActivity.this,"User name length must be more than 8.",Toast.LENGTH_SHORT);
uname_check.show();
}
else if(pass1str.length()<8)
{
Toast pass_check = Toast.makeText(SignupActivity.this,"Password length must be more than 8",Toast.LENGTH_SHORT);
pass_check.show();
}
else if(pass1str.equals(unamestr))
{
Toast passw_check = Toast.makeText(SignupActivity.this,"Password can't be same as username",Toast.LENGTH_SHORT);
passw_check.show();
}
else if(!pass1str.equals(pass2str))
{
//poptp message
Toast pass_check = Toast.makeText(SignupActivity.this,"Passwords don't match.",Toast.LENGTH_SHORT);
pass_check.show();
}
else
{
ParseQuery<ParseObject> query = ParseQuery.getQuery("Members");
query.whereEqualTo("MemberID", unamestr);
query.findInBackground(new FindCallback<ParseObject>() {
@Override
public void done(List<ParseObject> list, ParseException e) {
if (e == null)
{
if (list.size() > 0)
{
Toast username_check = Toast.makeText(SignupActivity.this, "Username already exist", Toast.LENGTH_SHORT);
username_check.show();
}
else
{
EditText name = (EditText)findViewById(R.id.TFname);
EditText email = (EditText)findViewById(R.id.TFemail);
EditText uname = (EditText)findViewById(R.id.TFusername);
EditText pass1 = (EditText)findViewById(R.id.TFpassword);
String namestr = name.getText().toString();
String emailstr = email.getText().toString();
String unamestr = uname.getText().toString();
String pass1str = pass1.getText().toString();
Intent i = new Intent(SignupActivity.this, TutorSignUpActivity.class);
i.putExtra("username", unamestr);
i.putExtra("email", emailstr);
i.putExtra("name", namestr);
i.putExtra("password", pass1str);
startActivity(i);
}
}
else
{
Toast Signup_check = Toast.makeText(SignupActivity.this, "Sign fail.", Toast.LENGTH_SHORT);
Signup_check.show();
}
}
});
}
}
}
}
| [
"[email protected]"
] | |
404cd571c14368f6107140228b2854de5c4a6032 | 350504322e9920c5ee140a78db84dba71f101cd3 | /AppliSimu/ProtoSimu.java | 06f6521c0981ca013166e527d261ff92e02c1313 | [] | no_license | UniversityWork/MA-Voiture | 9ee86bf214d1b750785a62d411fa9ee20b794bf0 | 1888f3e54e54f82d7dc3b890d0a54258ff0ac027 | refs/heads/master | 2021-01-17T08:09:42.063681 | 2015-04-09T14:12:37 | 2015-04-09T14:12:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 671 | java | package AppliSimu;
import GUI.IHMVoiture;
import metier.Voiture;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Timer;
public class ProtoSimu {
public static final int dureeUneSecondeEnMilliSecondes = 1000;
public static void main(String[] args) {
final Voiture maVoiture = new Voiture (100, 0, 10);
IHMVoiture monTriangle = new IHMVoiture(maVoiture);
Timer timerAvancer = new Timer(dureeUneSecondeEnMilliSecondes, new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
maVoiture.miseAJourPosition();
}
});
timerAvancer.start();
while(true){
}
}
}
| [
"[email protected]"
] | |
a0da912e5360ba641956f36eb9396ee70326f354 | 847989a47e27c7bea7467d1b82a56fdc6f236430 | /java06_collections/src/HashSetTest.java | e2dbc82bd5ee9d4f4814ab0f0904060c2ba22d3c | [] | no_license | bisnin0/Bitcamp1 | 2b59cf003ef85dbfc86fcb3612b638265323c6a7 | 0293253c1c6e79cd8747235be4a2d6b9bb3a82e9 | refs/heads/main | 2023-02-04T05:14:04.024716 | 2020-12-24T10:22:43 | 2020-12-24T10:22:43 | 324,128,483 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 882 | java |
import java.util.HashSet;
import java.util.Iterator;
public class HashSetTest {
public HashSetTest() {
//Set interface : 입력순서를 유지하지 않다.
// 중복객체를 허용하지 않는다.
}
public void start() {
// - - - -
Double[] data = {23.6, 52.8, 85.6, 84.7, 12.8, 52.8, 85.6, 56.5};
HashSet<Double> hs = new HashSet<Double>();
for(Double d : data ) {
hs.add(d);
}
System.out.println("size="+ hs.size());
// HashSet은 get()메소드가 없다.
// Iterator인터페이스를 이용하여 데이터를 출력할수 있다.
Iterator<Double> iter = hs.iterator();
while(iter.hasNext()) {//객체가 있는 확인
double d = iter.next();
System.out.println(d);
}
}
public static void main(String[] args) {
new HashSetTest().start();
}
}
| [
"[email protected]"
] | |
1bf277992a2dbbb3e950bab98e3f36e26637f513 | c630074e1cd0303cb8d2bece08f30761aad8d599 | /Ch8_Exception_FileIO/src/com/examples/ex15_SuppressedExceptions/SuppressedExceptionDemo.java | b1fa0097da3811d0a2f6e2c6c86ba9c77dbfc987 | [] | no_license | Lubright/training-java-basic | 673bca9d29804a9e31ee867b374bad1c3477cd0b | 1b4a3e9699fdebfa359ee41ccf5b31db70165af7 | refs/heads/master | 2021-04-05T12:03:05.655916 | 2020-08-27T18:46:01 | 2020-08-27T18:46:01 | 248,555,273 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,430 | java | package com.examples.ex15_SuppressedExceptions;
class Exception1 extends Exception{
}
class Exception2 extends Exception{
}
public class SuppressedExceptionDemo {
public static void main(String[] args) {
after7();
}
private static void before7(){
try{
try{
throw new Exception1();
}
finally {
throw new Exception2();
}
}
catch(Exception e){
System.out.println("before7: " + e.getClass());
}
}
private static void after7(){
try{
Throwable t = null;
try{
throw new Exception1();
}
catch(Exception e){
t = e;
System.out.println("test1");
}
finally{
Exception2 fe = new Exception2();
if(t!=null){
System.out.println("test2");
t.addSuppressed(fe);
throw t;
}
else{
System.out.println("test3");
throw fe;
}
}
}
catch(Throwable e){
System.out.println("after7_1: " + e.getClass());
for(Throwable t : e.getSuppressed()){
System.out.println("after7_2: " + t.getClass());
}
}
}
}
| [
"[email protected]"
] | |
cf1a73e4a8ecc16b70cc1de9531efdeac11a1152 | 2b3ae8542c2be7751f53a85ab13d27f654c038ec | /src/main/java/com/dxc/ddc/springboot/web/DictionaryController.java | c6de74512b86bfdd32a0c734f7a3f4dc5a3ff2c7 | [] | no_license | spring-boot-2/rest-service | 73fcfc5bea8c8ad97881283d9c936040540834ad | aff60f0781fbde4aa5be020b955d82d888f3f5cc | refs/heads/master | 2020-03-25T07:58:33.887587 | 2018-08-20T05:40:01 | 2018-08-20T05:40:01 | 143,591,510 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,152 | java | package com.dxc.ddc.springboot.web;
import java.util.List;
import org.javatuples.KeyValue;
import org.springframework.beans.factory.annotation.Autowired;
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.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.dxc.ddc.springboot.data.GeneralContentResult;
import com.dxc.ddc.springboot.data.dto.DictionaryInfo;
import com.dxc.ddc.springboot.service.DictionaryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
/**
*
* @author Huanfeng, cai
* @since JDK 1.8
*/
@RestController
@RequestMapping(value = "/dictionary")
@Api(tags = {"字典管理"})
public class DictionaryController {
@Autowired
private DictionaryService dictionaryService;
@ApiOperation(value = "字典列表", notes = "字典列表")
@RequestMapping(value = "/all", method = RequestMethod.GET)
@ResponseBody
public GeneralContentResult<List<DictionaryInfo>> findAll() {
return dictionaryService.findAll();
}
@ApiOperation(value = "字典列表(具体字段)", notes = "根据输入的字段查询字典列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "field", value = "关键字", required = true, dataType = "String", paramType = "path") })
@RequestMapping(value = "/field/{field}", method = RequestMethod.GET)
@ResponseBody
public GeneralContentResult<List<KeyValue<String, String>>> findByField(@PathVariable("field") String field) {
return dictionaryService.findByField(field);
}
@ApiOperation(value = "字典列表(属性(不包含类别))")
@RequestMapping(value = "/attributes", method = RequestMethod.GET)
@ResponseBody
public GeneralContentResult<List<KeyValue<String, String>>> findByAttributes() {
return dictionaryService.findByAttributes();
}
}
| [
"[email protected]"
] | |
67ceb82ba3f79a6eed433da458c40b11581e41d6 | 35afaf897039de82bce3f90b386a9e54f1e1803f | /src/com/valadian/bergecraft/interfaces/IDisabler.java | ee34fcd3749ad49a1378823e7d7de921bb90ce6a | [] | no_license | TeaJizzle/Bergecraft | 90133d5dcb8852fbd47f1f86f780ce90d7f1b9e7 | 4563be025e91649402a245fdd6471337c08dfa5a | refs/heads/master | 2021-01-17T20:01:44.603951 | 2014-05-07T17:16:39 | 2014-05-07T17:17:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 184 | java | package com.valadian.bergecraft.interfaces;
import org.bukkit.entity.Player;
public interface IDisabler extends ICompat
{
public boolean isBergecraftDisabledFor(Player player);
}
| [
"[email protected]"
] | |
0b843ae0437833b5a0f94573d2ac4ba17036e48a | 985753cf5bb69d2632dd0a8bb4cbc22047882a3b | /src/qiuzhao/jiritoutiao/biancheng1.java | cae63119ace22e032b624c6a187e8fb2335d27c1 | [] | no_license | lurenbing231/Leetcode | 0171ffb3686ee62e4e630419858fcdff6c6abbc0 | 5e9563e4ac17d515d04f6c2e16ccc3ec63f7a851 | refs/heads/master | 2021-10-10T06:23:09.850479 | 2019-01-07T13:50:17 | 2019-01-07T13:50:17 | 108,837,657 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,485 | java | package qiuzhao.jiritoutiao;
import java.util.*;
public class biancheng1 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
Map<Integer, List<Integer>> s = new HashMap<>();
for (int i = 0; i < n; i++) {
List<Integer> tmp = new ArrayList<>();
List<Integer> flag = new ArrayList<>();
while (true) {
int t = sc.nextInt();
if (t != 0) {
tmp.add(t);
for (Integer ss : s.keySet()) {
if (s.get(ss).contains(t)&&!flag.contains(ss)){
flag.add(ss);
}
}
} else {
t = i+1;
tmp.add(t);
for (Integer ss : s.keySet()) {
if (s.get(ss).contains(t)&&!flag.contains(ss)){
flag.add(ss);
}
}
s.put(i, tmp);
flag.add(i);
break;
}
}
List<Integer> con = new ArrayList<>();
for (Integer integer : flag) {
con.addAll(s.remove(integer));
}
s.put(i,con);
}
int res = 0;
for (Integer i : s.keySet()) {
res ++;
}
System.out.println(res);
}
}
| [
"[email protected]"
] | |
ec7bea6f43f37eb122b73f5f9b07d32c134ad434 | 8a462223566170688d04686ad5de16fce7e2cb3a | /src/argouml-core-model-euml/src/org/argouml/model/euml/UMLUtil.java | 0e1a29b7569ad08a3e4349d117de9ab2ec9355aa | [] | no_license | flcs/argouml-spl | 4bc95e85769f261c58f24d63aa3fdbe460193bfa | 94a50b2c620fd9972f6fddcf216a4d47e33d0351 | refs/heads/master | 2022-10-22T02:40:52.413226 | 2014-06-28T07:50:14 | 2014-06-28T07:50:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,701 | java | // $Id$
// Copyright (c) 2007,2008 Bogdan Pistol and other contributors
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of the ArgoUML Project nor the
// names of its contributors may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE ArgoUML PROJECT ``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 ArgoUML PROJECT 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 org.argouml.model.euml;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.command.StrictCompoundCommand;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.edit.command.CopyToClipboardCommand;
import org.eclipse.emf.edit.command.PasteFromClipboardCommand;
import org.eclipse.uml2.uml.Association;
import org.eclipse.uml2.uml.AssociationClass;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.NamedElement;
import org.eclipse.uml2.uml.Operation;
import org.eclipse.uml2.uml.Property;
import org.eclipse.uml2.uml.Type;
/**
* This class exposes protected methods from
* {@link org.eclipse.uml2.uml.UMLUtil} and adds additional util methods
*
* @author Bogdan Pistol
*/
public class UMLUtil extends org.eclipse.uml2.uml.util.UMLUtil {
/**
* The default URI used for eUML
*/
public static final URI DEFAULT_URI = URI.createURI("http://argouml.tigris.org/euml/resource/default_uri.xmi"); //$NON-NLS-1$
/**
* Getter for the attributes of a Type
*
* @param type
* The Type that owns the attributes
* @return the attributes or null
*/
public static EList<Property> getOwnedAttributes(Type type) {
if (type instanceof AssociationClass) {
return ((AssociationClass) type).getOwnedAttributes();
} else if (type instanceof Association) {
return ((Association) type).getOwnedEnds();
} else {
return org.eclipse.uml2.uml.util.UMLUtil.getOwnedAttributes(type);
}
}
/**
* Getter for the operations of a Type
*
* @param type
* The Type that owns the operations
* @return the operations or null
*/
public static EList<Operation> getOwnedOperations(Type type) {
return org.eclipse.uml2.uml.util.UMLUtil.getOwnedOperations(type);
}
/**
* Copy a tree of UML elements into a destination location
*
* @param modelImplementation
* the eUML model implementation
* @param source
* the tree of UML elements to be copied
* @param destination
* the destination container
* @return the root of the newly copied tree of UML elements or null
*/
public static Element copy(EUMLModelImplementation modelImplementation,
Element source, Element destination) {
Command copyToClipboard = CopyToClipboardCommand.create(
modelImplementation.getEditingDomain(), source);
Command pasteFromClipboard = PasteFromClipboardCommand.create(
modelImplementation.getEditingDomain(), destination, null);
StrictCompoundCommand copyCommand = new StrictCompoundCommand() {
{
isPessimistic = true;
}
};
copyCommand.append(copyToClipboard);
copyCommand.append(pasteFromClipboard);
copyCommand.setLabel("Copy a tree of UML elements to a destination");
if (copyCommand.canExecute()) {
modelImplementation.getModelEventPump().getRootContainer().setHoldEvents(
true);
modelImplementation.getEditingDomain().getCommandStack().execute(
copyCommand);
if (modelImplementation.getEditingDomain().getCommandStack().getMostRecentCommand().getAffectedObjects().size() == 1) {
modelImplementation.getModelEventPump().getRootContainer().setHoldEvents(
false);
return (Element) modelImplementation.getEditingDomain().getCommandStack().getMostRecentCommand().getAffectedObjects().iterator().next();
} else {
modelImplementation.getEditingDomain().getCommandStack().undo();
modelImplementation.getModelEventPump().getRootContainer().clearHeldEvents();
modelImplementation.getModelEventPump().getRootContainer().setHoldEvents(
false);
}
}
return null;
}
/**
* Returns information about an Object.
* <p>
* If it's an Element it returns its metaclass name, and if it's a
* NamedElement it appends its name.
*
* @param o
* The object
* @return the String description
*/
public static String toString(Object o) {
if (o == null) {
return "null"; //$NON-NLS-1$
}
if (!(o instanceof Element)) {
return o.toString();
}
StringBuilder sb = new StringBuilder("'"); //$NON-NLS-1$
boolean named = false;
if (o instanceof NamedElement && ((NamedElement) o).getName() != null
&& !((NamedElement) o).getName().equals("")) { //$NON-NLS-1$
named = true;
sb.append(((NamedElement) o).getName() + " ["); //$NON-NLS-1$
}
sb.append(((Element) o).eClass().getName());
if (named) {
sb.append("]"); //$NON-NLS-1$
}
sb.append("'"); //$NON-NLS-1$
return sb.toString();
}
/**
* Returns the Resource associated with an URI or creates the resource if it
* does not exist
*
* @param modelImplementation
* the eUML implementation
* @param uri
* the URI which identifies the resource
* @return the retrieved or created resource
*/
static Resource getResource(
EUMLModelImplementation modelImplementation, URI uri,
boolean readOnly) {
Resource r = modelImplementation.getEditingDomain().getResourceSet()
.getResource(uri, false);
if (r == null) {
r = modelImplementation.getEditingDomain().getResourceSet()
.createResource(uri);
}
modelImplementation.getReadOnlyMap().put(r, Boolean.valueOf(readOnly));
return r;
}
}
| [
"[email protected]"
] | |
d0789378a039e5396f88f9d2effc8db071a73ab6 | 2aa54432f418333928e0aa24776b2a8124ccb59f | /websocket-demo/src/main/java/com/example/websocketdemo/controller/DrawController.java | f9dac14301df3412ff099d8a24599104a9ac6a8f | [] | no_license | arist1213/spring-boot-starter-demo | 0dd1fd572cc7d05df46cba3cd00e8ec0b7d92007 | 4cf4a2f26cf495075fd31b91e1f71f6bc211e843 | refs/heads/master | 2020-03-25T06:24:24.355722 | 2018-09-04T03:18:56 | 2018-09-04T03:18:56 | 143,499,341 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 906 | java | package com.example.websocketdemo.controller;
import com.example.websocketdemo.model.DrawMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.stereotype.Controller;
/**
* created by yanming on 2018/8/11
*/
@Controller
public class DrawController {
private final static Logger log = LoggerFactory.getLogger(DrawController.class);
@MessageMapping("/draw.bunny") // 接收 /app/draw.bunny 的客户端消息
@SendTo("/topic/bunny") // 把消息转发给订阅 /topic/bunny的客户端
public DrawMessage sendMessage(@Payload DrawMessage message) {
log.info("received message "+message.toString());
return message;
}
}
| [
"[email protected]"
] | |
4900b04627f0cc43d053ef1085431c5c1146272c | 3b91ed788572b6d5ac4db1bee814a74560603578 | /com/tencent/mm/plugin/appbrand/jsapi/a/d$1.java | 88ba53392aededb454c8755d1a61c86b766e195d | [] | no_license | linsir6/WeChat_java | a1deee3035b555fb35a423f367eb5e3e58a17cb0 | 32e52b88c012051100315af6751111bfb6697a29 | refs/heads/master | 2020-05-31T05:40:17.161282 | 2018-08-28T02:07:02 | 2018-08-28T02:07:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,462 | java | package com.tencent.mm.plugin.appbrand.jsapi.a;
import android.text.TextUtils;
import com.tencent.mm.ab.b;
import com.tencent.mm.ipcinvoker.wx_extension.b.a;
import com.tencent.mm.plugin.appbrand.page.p;
import com.tencent.mm.protocal.c.ajb;
import com.tencent.mm.sdk.platformtools.x;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONArray;
class d$1 implements a {
final /* synthetic */ int doP;
final /* synthetic */ p fJO;
final /* synthetic */ d fKu;
d$1(d dVar, p pVar, int i) {
this.fKu = dVar;
this.fJO = pVar;
this.doP = i;
}
public final void a(int i, int i2, String str, b bVar) {
Map hashMap = new HashMap();
if (i == 0 && i2 == 0 && bVar.dIE.dIL != null) {
ajb ajb = (ajb) bVar.dIE.dIL;
x.i("MicroMsg.JsApiGetUserAutoFillData", "getUserAutoFillData success");
Object obj = "";
if (!TextUtils.isEmpty(ajb.rLM)) {
obj = ajb.rLM;
}
Object obj2 = "";
if (!TextUtils.isEmpty(ajb.rLN)) {
obj2 = ajb.rLN;
}
int i3 = ajb.reL;
Collection collection = ajb.rLO;
x.i("MicroMsg.JsApiGetUserAutoFillData", "auth_info:%s, auth_status:%d", new Object[]{obj2, Integer.valueOf(i3)});
x.i("MicroMsg.JsApiGetUserAutoFillData", "user_info_json:%s", new Object[]{obj});
hashMap.put("userData", obj);
hashMap.put("authStatus", Integer.valueOf(i3));
hashMap.put("authInfo", obj2);
if (collection != null && collection.size() > 0) {
hashMap.put("authGroupList", new JSONArray(collection));
x.i("MicroMsg.JsApiGetUserAutoFillData", "authGroupList:%s", new Object[]{new JSONArray(collection).toString()});
}
this.fJO.E(this.doP, this.fKu.f("ok", hashMap));
return;
}
x.e("MicroMsg.JsApiGetUserAutoFillData", "getUserAutoFillData cgi failed, errType = %d, errCode = %d, errMsg = %s, rr.resp = %s", new Object[]{Integer.valueOf(i), Integer.valueOf(i2), str, bVar.dIE.dIL});
hashMap.put("ret", Integer.valueOf(i2));
if (TextUtils.isEmpty(str)) {
this.fJO.E(this.doP, this.fKu.f("fail: ErrMsg: cgi fail", hashMap));
} else {
this.fJO.E(this.doP, this.fKu.f("fail: ErrMsg:" + str, hashMap));
}
}
}
| [
"[email protected]"
] | |
6f21be0a5c8eccec1aa15a77b88ee6e028f0c424 | 13f7d60639335f22feba8a2d8c4f420c89e440f2 | /step1_7/src/main/java/com/bloodcrown/step1_7/ui/NewsButton.java | 25ea8efb211f23cfcd3ab7224c11808743aed9be | [] | no_license | zb25810045/BW-MVPDemo | ea0fd6c36786c9d79a445f6c4f743574bf8612a1 | 4f5aeb6188d59a70067b593619359f9978da768c | refs/heads/master | 2021-08-30T22:51:43.168625 | 2017-12-19T18:09:55 | 2017-12-19T18:09:55 | 113,135,095 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,283 | java | package com.bloodcrown.step1_7.ui;
import android.content.Context;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.Toast;
import com.bloodcrown.step1_7.base.BaseCustomeView;
import com.bloodcrown.step1_7.persenter.NewsPersenter;
/**
* Created by zbzbgo on 2017/12/3.
*/
public class NewsButton extends BaseCustomeView<INewsView, NewsPersenter> implements INewsView {
public NewsButton(Context context) {
super(context);
}
public NewsButton(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
}
public NewsButton(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
public void showNewsList() {
}
@Override
protected NewsPersenter createPersenter() {
return new NewsPersenter();
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(NewsButton.this.getContext(), "自定义 view 激活", Toast.LENGTH_SHORT).show();
}
});
}
}
| [
"[email protected]"
] | |
bdc48c5393dfda41bdee2993bd90fe13b2d30aff | 4fc2ece47f67fb6981c3f8f7af193e6b717e3b71 | /2Liners/app/src/main/java/facebook/android/Facebook.java | 7dee5e877dd7974e2b1169565ee90db4f68938f8 | [] | no_license | vir474/2Liners | 3c1afc06ffbff37de4d7fa380bdd99b403a4ea41 | 88dac032fcc8b01cbf574714dcc3912504b3c814 | refs/heads/master | 2021-01-10T01:26:03.769194 | 2016-04-06T22:24:21 | 2016-04-06T22:24:21 | 55,645,440 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 30,284 | java | /*
* Copyright 2010 Facebook, 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 facebook.android;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.MalformedURLException;
import android.Manifest;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ResolveInfo;
import android.content.pm.Signature;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.webkit.CookieSyncManager;
/**
* Main Facebook object for interacting with the Facebook developer API.
* Provides methods to log in and log out a user, make requests using the REST
* and Graph APIs, and start user interface interactions with the API (such as
* pop-ups promoting for credentials, permissions, stream posts, etc.)
*
* @author Jim Brusstar ([email protected]),
* Yariv Sadan ([email protected]),
* Luke Shepard ([email protected])
*/
public class Facebook {
// Strings used in the authorization flow
public static final String REDIRECT_URI = "fbconnect://success";
public static final String CANCEL_URI = "fbconnect://cancel";
public static final String TOKEN = "access_token";
public static final String EXPIRES = "expires_in";
public static final String SINGLE_SIGN_ON_DISABLED = "service_disabled";
public static final int FORCE_DIALOG_AUTH = -1;
private static final String LOGIN = "oauth";
// Used as default activityCode by authorize(). See authorize() below.
private static final int DEFAULT_AUTH_ACTIVITY_CODE = 32665;
// Facebook server endpoints: may be modified in a subclass for testing
protected static String DIALOG_BASE_URL =
"https://m.facebook.com/dialog/";
protected static String GRAPH_BASE_URL =
"https://graph.facebook.com/";
protected static String RESTSERVER_URL =
"https://api.facebook.com/restserver.php";
private String mAccessToken = null;
private long mAccessExpires = 0;
private String mAppId;
private Activity mAuthActivity;
private String[] mAuthPermissions;
private int mAuthActivityCode;
private DialogListener mAuthDialogListener;
/**
* Constructor for Facebook object.
*
* @param appId
* Your Facebook application ID. Found at
* www.facebook.com/developers/apps.php.
*/
public Facebook(String appId) {
if (appId == null) {
throw new IllegalArgumentException(
"You must specify your application ID when instantiating " +
"a Facebook object. See README for details.");
}
mAppId = appId;
}
/**
* Default authorize method. Grants only basic permissions.
*
* See authorize() below for @params.
*/
public void authorize(Activity activity, final DialogListener listener) {
authorize(activity, new String[] {}, DEFAULT_AUTH_ACTIVITY_CODE,
listener);
}
/**
* Authorize method that grants custom permissions.
*
* See authorize() below for @params.
*/
public void authorize(Activity activity, String[] permissions,
final DialogListener listener) {
authorize(activity, permissions, DEFAULT_AUTH_ACTIVITY_CODE, listener);
}
/**
* Full authorize method.
*
* Starts either an Activity or a dialog which prompts the user to log in to
* Facebook and grant the requested permissions to the given application.
*
* This method will, when possible, use Facebook's single sign-on for
* Android to obtain an access token. This involves proxying a call through
* the Facebook for Android stand-alone application, which will handle the
* authentication flow, and return an OAuth access token for making API
* calls.
*
* Because this process will not be available for all users, if single
* sign-on is not possible, this method will automatically fall back to the
* OAuth 2.0 User-Agent flow. In this flow, the user credentials are handled
* by Facebook in an embedded WebView, not by the client application. As
* such, the dialog makes a network request and renders HTML content rather
* than a native UI. The access token is retrieved from a redirect to a
* special URL that the WebView handles.
*
* Note that User credentials could be handled natively using the OAuth 2.0
* Username and Password Flow, but this is not supported by this SDK.
*
* See http://developers.facebook.com/docs/authentication/ and
* http://wiki.oauth.net/OAuth-2 for more details.
*
* Note that this method is asynchronous and the callback will be invoked in
* the original calling thread (not in a background thread).
*
* Also note that requests may be made to the API without calling authorize
* first, in which case only public information is returned.
*
* IMPORTANT: Note that single sign-on authentication will not function
* correctly if you do not include a call to the authorizeCallback() method
* in your onActivityResult() function! Please see below for more
* information. single sign-on may be disabled by passing FORCE_DIALOG_AUTH
* as the activityCode parameter in your call to authorize().
*
* @param activity
* The Android activity in which we want to display the
* authorization dialog.
* @param applicationId
* The Facebook application identifier e.g. "350685531728"
* @param permissions
* A list of permissions required for this application: e.g.
* "read_stream", "publish_stream", "offline_access", etc. see
* http://developers.facebook.com/docs/authentication/permissions
* This parameter should not be null -- if you do not require any
* permissions, then pass in an empty String array.
* @param activityCode
* Single sign-on requires an activity result to be called back
* to the client application -- if you are waiting on other
* activities to return data, pass a custom activity code here to
* avoid collisions. If you would like to force the use of legacy
* dialog-based authorization, pass FORCE_DIALOG_AUTH for this
* parameter. Otherwise just omit this parameter and Facebook
* will use a suitable default. See
* http://developer.android.com/reference/android/
* app/Activity.html for more information.
* @param listener
* Callback interface for notifying the calling application when
* the authentication dialog has completed, failed, or been
* canceled.
*/
public void authorize(Activity activity, String[] permissions,
int activityCode, final DialogListener listener) {
boolean singleSignOnStarted = false;
mAuthDialogListener = listener;
// Prefer single sign-on, where available.
if (activityCode >= 0) {
singleSignOnStarted = startSingleSignOn(activity, mAppId,
permissions, activityCode);
}
// Otherwise fall back to traditional dialog.
if (!singleSignOnStarted) {
startDialogAuth(activity, permissions);
}
}
/**
* Internal method to handle single sign-on backend for authorize().
*
* @param activity
* The Android Activity that will parent the ProxyAuth Activity.
* @param applicationId
* The Facebook application identifier.
* @param permissions
* A list of permissions required for this application. If you do
* not require any permissions, pass an empty String array.
* @param activityCode
* Activity code to uniquely identify the result Intent in the
* callback.
*/
private boolean startSingleSignOn(Activity activity, String applicationId,
String[] permissions, int activityCode) {
boolean didSucceed = true;
Intent intent = new Intent();
intent.setClassName("com.facebook.katana",
"com.facebook.katana.ProxyAuth");
intent.putExtra("client_id", applicationId);
if (permissions.length > 0) {
intent.putExtra("scope", TextUtils.join(",", permissions));
}
// Verify that the application whose package name is
// com.facebook.katana.ProxyAuth
// has the expected FB app signature.
if (!validateAppSignatureForIntent(activity, intent)) {
return false;
}
mAuthActivity = activity;
mAuthPermissions = permissions;
mAuthActivityCode = activityCode;
try {
activity.startActivityForResult(intent, activityCode);
} catch (ActivityNotFoundException e) {
didSucceed = false;
}
return didSucceed;
}
/**
* Query the signature for the application that would be invoked by the
* given intent and verify that it matches the FB application's signature.
*
* @param activity
* @param intent
* @param validSignature
* @return true if the app's signature matches the expected signature.
*/
private boolean validateAppSignatureForIntent(Activity activity,
Intent intent) {
ResolveInfo resolveInfo =
activity.getPackageManager().resolveActivity(intent, 0);
if (resolveInfo == null) {
return false;
}
String packageName = resolveInfo.activityInfo.packageName;
PackageInfo packageInfo;
try {
packageInfo = activity.getPackageManager().getPackageInfo(
packageName, PackageManager.GET_SIGNATURES);
} catch (NameNotFoundException e) {
return false;
}
for (Signature signature : packageInfo.signatures) {
if (signature.toCharsString().equals(FB_APP_SIGNATURE)) {
return true;
}
}
return false;
}
/**
* Internal method to handle dialog-based authentication backend for
* authorize().
*
* @param activity
* The Android Activity that will parent the auth dialog.
* @param applicationId
* The Facebook application identifier.
* @param permissions
* A list of permissions required for this application. If you do
* not require any permissions, pass an empty String array.
*/
private void startDialogAuth(Activity activity, String[] permissions) {
Bundle params = new Bundle();
if (permissions.length > 0) {
params.putString("scope", TextUtils.join(",", permissions));
}
CookieSyncManager.createInstance(activity);
dialog(activity, LOGIN, params, new DialogListener() {
public void onComplete(Bundle values) {
// ensure any cookies set by the dialog are saved
CookieSyncManager.getInstance().sync();
setAccessToken(values.getString(TOKEN));
setAccessExpiresIn(values.getString(EXPIRES));
if (isSessionValid()) {
Log.d("Facebook-authorize", "Login Success! access_token="
+ getAccessToken() + " expires="
+ getAccessExpires());
mAuthDialogListener.onComplete(values);
} else {
mAuthDialogListener.onFacebookError(new FacebookError(
"Failed to receive access token."));
}
}
public void onError(DialogError error) {
Log.d("Facebook-authorize", "Login failed: " + error);
mAuthDialogListener.onError(error);
}
public void onFacebookError(FacebookError error) {
Log.d("Facebook-authorize", "Login failed: " + error);
mAuthDialogListener.onFacebookError(error);
}
public void onCancel() {
Log.d("Facebook-authorize", "Login canceled");
mAuthDialogListener.onCancel();
}
});
}
/**
* IMPORTANT: This method must be invoked at the top of the calling
* activity's onActivityResult() function or Facebook authentication will
* not function properly!
*
* If your calling activity does not currently implement onActivityResult(),
* you must implement it and include a call to this method if you intend to
* use the authorize() method in this SDK.
*
* For more information, see
* http://developer.android.com/reference/android/app/
* Activity.html#onActivityResult(int, int, android.content.Intent)
*/
public void authorizeCallback(int requestCode, int resultCode, Intent data) {
if (requestCode == mAuthActivityCode) {
// Successfully redirected.
if (resultCode == Activity.RESULT_OK) {
// Check OAuth 2.0/2.10 error code.
String error = data.getStringExtra("error");
if (error == null) {
error = data.getStringExtra("error_type");
}
// A Facebook error occurred.
if (error != null) {
if (error.equals(SINGLE_SIGN_ON_DISABLED)
|| error.equals("AndroidAuthKillSwitchException")) {
Log.d("Facebook-authorize", "Hosted auth currently "
+ "disabled. Retrying dialog auth...");
startDialogAuth(mAuthActivity, mAuthPermissions);
} else if (error.equals("access_denied")
|| error.equals("OAuthAccessDeniedException")) {
Log.d("Facebook-authorize", "Login canceled by user.");
mAuthDialogListener.onCancel();
} else {
Log.d("Facebook-authorize", "Login failed: " + error);
mAuthDialogListener.onFacebookError(
new FacebookError(error));
}
// No errors.
} else {
setAccessToken(data.getStringExtra(TOKEN));
setAccessExpiresIn(data.getStringExtra(EXPIRES));
if (isSessionValid()) {
Log.d("Facebook-authorize",
"Login Success! access_token="
+ getAccessToken() + " expires="
+ getAccessExpires());
mAuthDialogListener.onComplete(data.getExtras());
} else {
mAuthDialogListener.onFacebookError(new FacebookError(
"Failed to receive access token."));
}
}
// An error occurred before we could be redirected.
} else if (resultCode == Activity.RESULT_CANCELED) {
// An Android error occured.
if (data != null) {
Log.d("Facebook-authorize",
"Login failed: " + data.getStringExtra("error"));
mAuthDialogListener.onError(
new DialogError(
data.getStringExtra("error"),
data.getIntExtra("error_code", -1),
data.getStringExtra("failing_url")));
// User pressed the 'back' button.
} else {
Log.d("Facebook-authorize", "Login canceled by user.");
mAuthDialogListener.onCancel();
}
}
}
}
/**
* Invalidate the current user session by removing the access token in
* memory, clearing the browser cookie, and calling auth.expireSession
* through the API.
*
* Note that this method blocks waiting for a network response, so do not
* call it in a UI thread.
*
* @param context
* The Android context in which the logout should be called: it
* should be the same context in which the login occurred in
* order to clear any stored cookies
* @throws java.io.IOException
* @throws java.net.MalformedURLException
* @return JSON string representation of the auth.expireSession response
* ("true" if successful)
*/
public String logout(Context context)
throws MalformedURLException, IOException {
Util.clearCookies(context);
Bundle b = new Bundle();
b.putString("method", "auth.expireSession");
String response = request(b);
setAccessToken(null);
setAccessExpires(0);
return response;
}
/**
* Make a request to Facebook's old (pre-graph) API with the given
* parameters. One of the parameter keys must be "method" and its value
* should be a valid REST server API method.
*
* See http://developers.facebook.com/docs/reference/rest/
*
* Note that this method blocks waiting for a network response, so do not
* call it in a UI thread.
*
* Example:
* <code>
* Bundle parameters = new Bundle();
* parameters.putString("method", "auth.expireSession");
* String response = request(parameters);
* </code>
*
* @param parameters
* Key-value pairs of parameters to the request. Refer to the
* documentation: one of the parameters must be "method".
* @throws java.io.IOException
* if a network error occurs
* @throws java.net.MalformedURLException
* if accessing an invalid endpoint
* @throws IllegalArgumentException
* if one of the parameters is not "method"
* @return JSON string representation of the response
*/
public String request(Bundle parameters)
throws MalformedURLException, IOException {
if (!parameters.containsKey("method")) {
throw new IllegalArgumentException("API method must be specified. "
+ "(parameters must contain key \"method\" and value). See"
+ " http://developers.facebook.com/docs/reference/rest/");
}
return request(null, parameters, "GET");
}
/**
* Make a request to the Facebook Graph API without any parameters.
*
* See http://developers.facebook.com/docs/api
*
* Note that this method blocks waiting for a network response, so do not
* call it in a UI thread.
*
* @param graphPath
* Path to resource in the Facebook graph, e.g., to fetch data
* about the currently logged authenticated user, provide "me",
* which will fetch http://graph.facebook.com/me
* @throws java.io.IOException
* @throws java.net.MalformedURLException
* @return JSON string representation of the response
*/
public String request(String graphPath)
throws MalformedURLException, IOException {
return request(graphPath, new Bundle(), "GET");
}
/**
* Make a request to the Facebook Graph API with the given string parameters
* using an HTTP GET (default method).
*
* See http://developers.facebook.com/docs/api
*
* Note that this method blocks waiting for a network response, so do not
* call it in a UI thread.
*
* @param graphPath
* Path to resource in the Facebook graph, e.g., to fetch data
* about the currently logged authenticated user, provide "me",
* which will fetch http://graph.facebook.com/me
* @param parameters
* key-value string parameters, e.g. the path "search" with
* parameters "q" : "facebook" would produce a query for the
* following graph resource:
* https://graph.facebook.com/search?q=facebook
* @throws java.io.IOException
* @throws java.net.MalformedURLException
* @return JSON string representation of the response
*/
public String request(String graphPath, Bundle parameters)
throws MalformedURLException, IOException {
return request(graphPath, parameters, "GET");
}
/**
* Synchronously make a request to the Facebook Graph API with the given
* HTTP method and string parameters. Note that binary data parameters
* (e.g. pictures) are not yet supported by this helper function.
*
* See http://developers.facebook.com/docs/api
*
* Note that this method blocks waiting for a network response, so do not
* call it in a UI thread.
*
* @param graphPath
* Path to resource in the Facebook graph, e.g., to fetch data
* about the currently logged authenticated user, provide "me",
* which will fetch http://graph.facebook.com/me
* @param params
* Key-value string parameters, e.g. the path "search" with
* parameters {"q" : "facebook"} would produce a query for the
* following graph resource:
* https://graph.facebook.com/search?q=facebook
* @param httpMethod
* http verb, e.g. "GET", "POST", "DELETE"
* @throws java.io.IOException
* @throws java.net.MalformedURLException
* @return JSON string representation of the response
*/
public String request(String graphPath, Bundle params, String httpMethod)
throws FileNotFoundException, MalformedURLException, IOException {
params.putString("format", "json");
if (isSessionValid()) {
params.putString(TOKEN, getAccessToken());
}
String url = (graphPath != null) ? GRAPH_BASE_URL + graphPath
: RESTSERVER_URL;
return Util.openUrl(url, httpMethod, params);
}
/**
* Generate a UI dialog for the request action in the given Android context.
*
* Note that this method is asynchronous and the callback will be invoked in
* the original calling thread (not in a background thread).
*
* @param context
* The Android context in which we will generate this dialog.
* @param action
* String representation of the desired method: e.g. "login",
* "stream.publish", ...
* @param listener
* Callback interface to notify the application when the dialog
* has completed.
*/
public void dialog(Context context, String action,
DialogListener listener) {
dialog(context, action, new Bundle(), listener);
}
/**
* Generate a UI dialog for the request action in the given Android context
* with the provided parameters.
*
* Note that this method is asynchronous and the callback will be invoked in
* the original calling thread (not in a background thread).
*
* @param context
* The Android context in which we will generate this dialog.
* @param action
* String representation of the desired method: e.g. "feed" ...
* @param parameters
* String key-value pairs to be passed as URL parameters.
* @param listener
* Callback interface to notify the application when the dialog
* has completed.
*/
public void dialog(Context context, String action, Bundle parameters,
final DialogListener listener) {
String endpoint = DIALOG_BASE_URL + action;
parameters.putString("display", "touch");
parameters.putString("redirect_uri", REDIRECT_URI);
if (action.equals(LOGIN)) {
parameters.putString("type", "user_agent");
parameters.putString("client_id", mAppId);
} else {
parameters.putString("app_id", mAppId);
}
if (isSessionValid()) {
parameters.putString(TOKEN, getAccessToken());
}
String url = endpoint + "?" + Util.encodeUrl(parameters);
Log.e("URL:",url);
if (context.checkCallingOrSelfPermission(Manifest.permission.INTERNET)
!= PackageManager.PERMISSION_GRANTED) {
Util.showAlert(context, "Error",
"Application requires permission to access the Internet");
} else {
new FbDialog(context, url, listener).show();
}
}
/**
* @return boolean - whether this object has an non-expired session token
*/
public boolean isSessionValid() {
return (getAccessToken() != null) &&
((getAccessExpires() == 0) ||
(System.currentTimeMillis() < getAccessExpires()));
}
/**
* Retrieve the OAuth 2.0 access token for API access: treat with care.
* Returns null if no session exists.
*
* @return String - access token
*/
public String getAccessToken() {
return mAccessToken;
}
/**
* Retrieve the current session's expiration time (in milliseconds since
* Unix epoch), or 0 if the session doesn't expire or doesn't exist.
*
* @return long - session expiration time
*/
public long getAccessExpires() {
return mAccessExpires;
}
/**
* Set the OAuth 2.0 access token for API access.
*
* @param token
* - access token
*/
public void setAccessToken(String token) {
mAccessToken = token;
}
/**
* Set the current session's expiration time (in milliseconds since Unix
* epoch), or 0 if the session doesn't expire.
*
* @param time
* - timestamp in milliseconds
*/
public void setAccessExpires(long time) {
mAccessExpires = time;
}
/**
* Set the current session's duration (in seconds since Unix epoch).
*
* @param expiresIn
* - duration in seconds
*/
public void setAccessExpiresIn(String expiresIn) {
if (expiresIn != null && !expiresIn.equals("0")) {
setAccessExpires(System.currentTimeMillis()
+ Integer.parseInt(expiresIn) * 1000);
}
}
public String getAppId() {
return mAppId;
}
public void setAppId(String appId) {
mAppId = appId;
}
/**
* Callback interface for dialog requests.
*
*/
public static interface DialogListener {
/**
* Called when a dialog completes.
*
* Executed by the thread that initiated the dialog.
*
* @param values
* Key-value string pairs extracted from the response.
*/
public void onComplete(Bundle values);
/**
* Called when a Facebook responds to a dialog with an error.
*
* Executed by the thread that initiated the dialog.
*
*/
public void onFacebookError(FacebookError e);
/**
* Called when a dialog has an error.
*
* Executed by the thread that initiated the dialog.
*
*/
public void onError(DialogError e);
/**
* Called when a dialog is canceled by the user.
*
* Executed by the thread that initiated the dialog.
*
*/
public void onCancel();
}
public static final String FB_APP_SIGNATURE =
"30820268308201d102044a9c4610300d06092a864886f70d0101040500307a310"
+ "b3009060355040613025553310b30090603550408130243413112301006035504"
+ "07130950616c6f20416c746f31183016060355040a130f46616365626f6f6b204"
+ "d6f62696c653111300f060355040b130846616365626f6f6b311d301b06035504"
+ "03131446616365626f6f6b20436f72706f726174696f6e3020170d30393038333"
+ "13231353231365a180f32303530303932353231353231365a307a310b30090603"
+ "55040613025553310b30090603550408130243413112301006035504071309506"
+ "16c6f20416c746f31183016060355040a130f46616365626f6f6b204d6f62696c"
+ "653111300f060355040b130846616365626f6f6b311d301b06035504031314466"
+ "16365626f6f6b20436f72706f726174696f6e30819f300d06092a864886f70d01"
+ "0101050003818d0030818902818100c207d51df8eb8c97d93ba0c8c1002c928fa"
+ "b00dc1b42fca5e66e99cc3023ed2d214d822bc59e8e35ddcf5f44c7ae8ade50d7"
+ "e0c434f500e6c131f4a2834f987fc46406115de2018ebbb0d5a3c261bd97581cc"
+ "fef76afc7135a6d59e8855ecd7eacc8f8737e794c60a761c536b72b11fac8e603"
+ "f5da1a2d54aa103b8a13c0dbc10203010001300d06092a864886f70d010104050"
+ "0038181005ee9be8bcbb250648d3b741290a82a1c9dc2e76a0af2f2228f1d9f9c"
+ "4007529c446a70175c5a900d5141812866db46be6559e2141616483998211f4a6"
+ "73149fb2232a10d247663b26a9031e15f84bc1c74d141ff98a02d76f85b2c8ab2"
+ "571b6469b232d8e768a7f7ca04f7abe4a775615916c07940656b58717457b42bd"
+ "928a2";
}
| [
"[email protected]"
] | |
6b919a394bd37332374364a92ff0e1d487074064 | 0c48c9a0ac5890c1e3c81bf11d5b261d30ceb20a | /app/src/main/java/com/rb/eliterl/profile/ProfileFragment.java | 1418d6c42173c594c318181a6cf7923083af812c | [] | no_license | rahulrchaurasia/EliteCustomerReliance | 913b2c489f8a9e2e7580dab397b74af5f50f1d74 | 9b63cf981fa35d2f36d262a7ef1057970fcc438a | refs/heads/master | 2020-06-30T11:53:29.273237 | 2019-08-06T10:59:56 | 2019-08-06T10:59:56 | 200,818,160 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,139 | java | package com.rb.eliterl.profile;
import android.os.Bundle;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.rb.eliterl.BaseFragment;
import com.rb.eliterl.R;
import com.rb.eliterl.core.APIResponse;
import com.rb.eliterl.core.IResponseSubcriber;
import com.rb.eliterl.core.controller.register.RegisterController;
import com.rb.eliterl.core.model.PincodeEntity;
import com.rb.eliterl.core.model.UserEntity;
import com.rb.eliterl.core.requestmodel.UpdateUserRequestEntity;
import com.rb.eliterl.core.response.PincodeResponse;
import com.rb.eliterl.core.response.UpdateUserResponse;
import com.rb.eliterl.database.DataBaseController;
import com.rb.eliterl.splash.PrefManager;
import com.rb.eliterl.utility.Constants;
/**
* Created by Rajeev Ranjan on 05/02/2018.
*/
public class ProfileFragment extends BaseFragment implements View.OnClickListener, IResponseSubcriber {
EditText etelite_card_no, etpolicy_no, etEmail, etPassword, etconfirmPassword;
Button btnUpdate, btnSubmit;
EditText etFullName, etMobile, etPincode, etArea, etCity, etState;
FloatingActionButton fab;
PincodeEntity pincodeEntity;
UserEntity loginEntity;
DataBaseController dataBaseController;
UpdateUserRequestEntity updateUserRequestEntity;
PrefManager prefManager;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
//return inflater.inflate(R.layout.fragment_product, container, false);
View view = inflater.inflate(R.layout.content_profile, container, false);
dataBaseController = new DataBaseController(getActivity());
prefManager = new PrefManager(getActivity());
loginEntity = prefManager.getUserData();
updateUserRequestEntity = new UpdateUserRequestEntity();
init_widets(view);
setListener();
if (loginEntity != null) {
Constants.hideKeyBoard(etEmail, getActivity());
bindUserDatas();
} else {
setAllEditable();
}
return view;
}
private void bindUserDatas() {
btnUpdate.setVisibility(View.GONE);
etFullName.setText("" + loginEntity.getName());
etEmail.setText("" + loginEntity.getEmail());
etMobile.setText("" + loginEntity.getMobile());
etpolicy_no.setText("" + loginEntity.getPolicy_no());
etelite_card_no.setText("" + loginEntity.getCard_no());
etPincode.setText("" + loginEntity.getPincode());
etState.setText("" + loginEntity.getState_name());
etCity.setText("" + loginEntity.getCityname());
etArea.setText("" + loginEntity.getArea());
}
private void setListener() {
fab.setOnClickListener(this);
btnUpdate.setOnClickListener(this);
}
private void init_widets(View view) {
fab = (FloatingActionButton) view.findViewById(R.id.fab);
etelite_card_no = (EditText) view.findViewById(R.id.etelite_card_no);
etpolicy_no = (EditText) view.findViewById(R.id.etpolicy_no);
etEmail = (EditText) view.findViewById(R.id.etEmail);
etPassword = (EditText) view.findViewById(R.id.etPassword);
etconfirmPassword = (EditText) view.findViewById(R.id.etconfirmPassword);
btnUpdate = (Button) view.findViewById(R.id.btnUpdate);
btnSubmit = (Button) view.findViewById(R.id.btnSubmit);
etFullName = (EditText) view.findViewById(R.id.etFullName);
etMobile = (EditText) view.findViewById(R.id.etMobile);
etPincode = (EditText) view.findViewById(R.id.etPincode);
etArea = (EditText) view.findViewById(R.id.etArea);
etCity = (EditText) view.findViewById(R.id.etCity);
etState = (EditText) view.findViewById(R.id.etState);
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.fab:
setAllEditable();
break;
case R.id.btnUpdate:
if (!isEmpty(etelite_card_no)) {
etelite_card_no.requestFocus();
etelite_card_no.setError("Enter Card Number");
return;
}
if (!isEmpty(etpolicy_no)) {
etpolicy_no.requestFocus();
etpolicy_no.setError("Enter Policy number");
return;
}
if (!isValidePhoneNumber(etMobile)) {
etMobile.requestFocus();
etMobile.setError("Enter Mobile");
return;
}
if (!isValideEmailID(etEmail)) {
etEmail.requestFocus();
etEmail.setError("Enter Email");
return;
}
if (!isEmpty(etFullName)) {
etFullName.requestFocus();
etFullName.setError("Enter Name");
return;
}
if (!isEmpty(etPincode) && etPincode.getText().toString().length() != 6) {
etPincode.requestFocus();
etPincode.setError("Enter Pincode");
return;
}
updateUserRequestEntity.setOtp(0);
updateUserRequestEntity.setName(etFullName.getText().toString());
updateUserRequestEntity.setEmail(etEmail.getText().toString());
updateUserRequestEntity.setMobile(etMobile.getText().toString());
updateUserRequestEntity.setPincode(etPincode.getText().toString());
if (pincodeEntity != null) {
updateUserRequestEntity.setState("" + pincodeEntity.getState_id());
updateUserRequestEntity.setCity("" + pincodeEntity.getCity_id());
updateUserRequestEntity.setArea("" + pincodeEntity.getPostname());
updateUserRequestEntity.setAddress("" + pincodeEntity.getState_name());
} else {
updateUserRequestEntity.setState("" + loginEntity.getState_id());
updateUserRequestEntity.setCity("" + loginEntity.getCity_id());
updateUserRequestEntity.setArea("" + loginEntity.getArea());
updateUserRequestEntity.setAddress("" + loginEntity.getState_name());
}
updateUserRequestEntity.setRto("1");
showDialog();
new RegisterController(getActivity()).updateUser(updateUserRequestEntity, this);
break;
}
}
private void setAllEditable() {
etPincode.addTextChangedListener(pincodeTextWatcher);
btnUpdate.setVisibility(View.VISIBLE);
etelite_card_no.setEnabled(true);
etpolicy_no.setEnabled(true);
etMobile.setEnabled(true);
etEmail.setEnabled(true);
etPincode.setEnabled(true);
etFullName.setEnabled(true);
etPincode.setEnabled(true);
}
@Override
public void OnSuccess(APIResponse response, String message) {
if (response instanceof UpdateUserResponse) {
cancelDialog();
if (response.getStatus_code() == 0) {
Toast.makeText(getActivity(), "" + response.getMessage(), Toast.LENGTH_SHORT).show();
}
} else if (response instanceof PincodeResponse) {
cancelDialog();
if (response.getStatus_code() == 0) {
pincodeEntity = ((PincodeResponse) response).getData().get(0);
if (pincodeEntity != null) {
etArea.setText("" + pincodeEntity.getPostname());
etCity.setText("" + pincodeEntity.getCityname());
etState.setText("" + pincodeEntity.getState_name());
}
}
}
}
@Override
public void OnFailure(Throwable t) {
cancelDialog();
Toast.makeText(getActivity(), "" + t.getMessage(), Toast.LENGTH_SHORT).show();
}
//region textwatcher
TextWatcher pincodeTextWatcher = new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
if (start == 5) {
etCity.setText("");
etState.setText("");
}
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (s.length() == 6) {
showDialog("Fetching City...");
new RegisterController(getActivity()).getCityState(etPincode.getText().toString(), ProfileFragment.this);
}
}
@Override
public void afterTextChanged(Editable s) {
}
};
//endregion
}
| [
"[email protected]"
] | |
0f955b8ee7deedaf0b9c59792221b812bcfae815 | 940a510f4acb7604603c90a94339b0832f55e1ee | /src/com/creation/patterns/abstractFactory/ElementsOfSmartphone.java | 5b5705fa4da739550b1e9c90f4524dd52dca4633 | [] | no_license | krestyanov/PatternsFlex | f5020a2c5d98edbe608bec5c91792c999a0648d6 | 9ff0afdd724067020407341b2b671605d395e93c | refs/heads/master | 2020-05-04T16:24:15.567163 | 2019-04-18T20:51:14 | 2019-04-18T20:51:14 | 179,277,656 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 167 | java | package com.creation.patterns.abstractFactory;
public interface ElementsOfSmartphone {
Battery getBattery();
Camera getCamera();
Display getDisplay();
}
| [
"[email protected]"
] | |
be3534a72cc521f85be3e8f6a1adb1427c4c4271 | c8f72e2f9d15ec2135bf6af9d3957953b3770d3d | /flexmark-util/src/test/java/com/vladsch/flexmark/util/sequence/BasedSequenceImplTest.java | 74834167cdc0ec9e7c33ed9fa6f322234464e68e | [
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | jiutiandiwang/flexmark-java | 278c39b94c6f4bc6fa2166268cc6929cca1e9f22 | 849bb88fcd2ebe4f4d0ca8aab57ff7e4edd9ca27 | refs/heads/master | 2021-01-19T13:56:10.925954 | 2017-02-19T00:46:15 | 2017-02-19T00:46:15 | 82,435,262 | 1 | 0 | null | 2017-02-19T04:34:12 | 2017-02-19T04:34:12 | null | UTF-8 | Java | false | false | 13,100 | java | package com.vladsch.flexmark.util.sequence;
import org.junit.Test;
import java.util.ArrayList;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
public class BasedSequenceImplTest {
// TODO: need complete tests here
@Test
public void test_indexOf() throws Exception {
final String s1 = "01234567890123456789";
BasedSequence s = BasedSequenceImpl.of(s1);
int iMax = s.length();
assertEquals(s1.indexOf(' '), s.indexOf(' '));
for (int i = 0; i < iMax; i++) {
final char c = (char) ('0' + (i % 10));
assertEquals("indexOf('" + c + "')", s1.indexOf(c), s.indexOf(c));
for (int j = i; j < iMax; j++) {
assertEquals("indexOf('" + c + "', " + j + ")", s1.indexOf(c, j), s.indexOf(c, j));
for (int k = iMax; k-- > j; ) {
assertEquals("indexOf('" + c + "', " + j + ", " + k + ")", s1.substring(0, k).indexOf(c, j), s.indexOf(c, j, k));
}
}
}
}
@Test
public void test_lastIndexOf() throws Exception {
final String s1 = "01234567890123456789";
BasedSequence s = BasedSequenceImpl.of(s1);
int iMax = s.length();
assertEquals(s1.lastIndexOf(' '), s.lastIndexOf(' '));
for (int i = 0; i < iMax; i++) {
final char c = (char) ('0' + (i % 10));
assertEquals("lastIndexOf('" + c + "')", s1.lastIndexOf(c), s.lastIndexOf(c));
for (int j = i; j < iMax; j++) {
assertEquals("lastIndexOf('" + c + "', " + j + ")", s1.lastIndexOf(c, j), s.lastIndexOf(c, j));
for (int k = iMax; k-- > j; ) {
final int lastIndexOf = s1.lastIndexOf(c, k);
assertEquals("lastIndexOf('" + c + "', " + j + ", " + k + ")", lastIndexOf < j ? -1 : lastIndexOf, s.lastIndexOf(c, j, k));
}
}
}
}
@Test
public void test_countLeading() throws Exception {
assertEquals(" ".length(), BasedSequenceImpl.of(" ").countLeading(" "));
assertEquals(" ".length(), BasedSequenceImpl.of(" abcdef ").countLeading(" "));
assertEquals(" ".length(), BasedSequenceImpl.of(" abcdef ").countLeading(" "));
assertEquals(" ".length(), BasedSequenceImpl.of(" abcdef").countLeading(" "));
assertEquals(" ".length(), BasedSequenceImpl.of(" abcdef ").countLeading(" "));
assertEquals(" ".length(), BasedSequenceImpl.of(" abcdef ").countLeading(" "));
assertEquals(" ".length(), BasedSequenceImpl.of(" abcdef").countLeading(" "));
assertEquals("".length(), BasedSequenceImpl.of("abcdef ").countLeading(" "));
assertEquals("".length(), BasedSequenceImpl.of("abcdef ").countLeading(" "));
assertEquals("".length(), BasedSequenceImpl.of("abcdef").countLeading(" "));
}
@Test
public void test_countTrailing() throws Exception {
assertEquals(" ".length(), BasedSequenceImpl.of(" ").countTrailing(" "));
assertEquals(" ".length(), BasedSequenceImpl.of(" abcdef ").countTrailing(" "));
assertEquals(" ".length(), BasedSequenceImpl.of(" abcdef ").countTrailing(" "));
assertEquals("".length(), BasedSequenceImpl.of(" abcdef").countTrailing(" "));
assertEquals(" ".length(), BasedSequenceImpl.of(" abcdef ").countTrailing(" "));
assertEquals(" ".length(), BasedSequenceImpl.of(" abcdef ").countTrailing(" "));
assertEquals("".length(), BasedSequenceImpl.of(" abcdef").countTrailing(" "));
assertEquals(" ".length(), BasedSequenceImpl.of("abcdef ").countTrailing(" "));
assertEquals(" ".length(), BasedSequenceImpl.of("abcdef ").countTrailing(" "));
assertEquals("".length(), BasedSequenceImpl.of("abcdef").countTrailing(" "));
}
@Test
public void test_trim() throws Exception {
assertEquals("", BasedSequenceImpl.of(" ").trim().toString());
assertEquals("abcdef", BasedSequenceImpl.of(" abcdef ").trim().toString());
assertEquals("abcdef", BasedSequenceImpl.of(" abcdef ").trim().toString());
assertEquals("abcdef", BasedSequenceImpl.of(" abcdef").trim().toString());
assertEquals("abcdef", BasedSequenceImpl.of(" abcdef ").trim().toString());
assertEquals("abcdef", BasedSequenceImpl.of(" abcdef ").trim().toString());
assertEquals("abcdef", BasedSequenceImpl.of(" abcdef").trim().toString());
assertEquals("abcdef", BasedSequenceImpl.of("abcdef ").trim().toString());
assertEquals("abcdef", BasedSequenceImpl.of("abcdef ").trim().toString());
assertEquals("abcdef", BasedSequenceImpl.of("abcdef").trim().toString());
}
@Test
public void test_trimStart() throws Exception {
assertEquals("", BasedSequenceImpl.of(" ").trimStart().toString());
assertEquals("abcdef ", BasedSequenceImpl.of(" abcdef ").trimStart().toString());
assertEquals("abcdef ", BasedSequenceImpl.of(" abcdef ").trimStart().toString());
assertEquals("abcdef", BasedSequenceImpl.of(" abcdef").trimStart().toString());
assertEquals("abcdef ", BasedSequenceImpl.of(" abcdef ").trimStart().toString());
assertEquals("abcdef ", BasedSequenceImpl.of(" abcdef ").trimStart().toString());
assertEquals("abcdef", BasedSequenceImpl.of(" abcdef").trimStart().toString());
assertEquals("abcdef ", BasedSequenceImpl.of("abcdef ").trimStart().toString());
assertEquals("abcdef ", BasedSequenceImpl.of("abcdef ").trimStart().toString());
assertEquals("abcdef", BasedSequenceImpl.of("abcdef").trimStart().toString());
}
@Test
public void test_trimEnd() throws Exception {
assertEquals("", BasedSequenceImpl.of(" ").trimEnd().toString());
assertEquals(" abcdef", BasedSequenceImpl.of(" abcdef ").trimEnd().toString());
assertEquals(" abcdef", BasedSequenceImpl.of(" abcdef ").trimEnd().toString());
assertEquals(" abcdef", BasedSequenceImpl.of(" abcdef").trimEnd().toString());
assertEquals(" abcdef", BasedSequenceImpl.of(" abcdef ").trimEnd().toString());
assertEquals(" abcdef", BasedSequenceImpl.of(" abcdef ").trimEnd().toString());
assertEquals(" abcdef", BasedSequenceImpl.of(" abcdef").trimEnd().toString());
assertEquals("abcdef", BasedSequenceImpl.of("abcdef ").trimEnd().toString());
assertEquals("abcdef", BasedSequenceImpl.of("abcdef ").trimEnd().toString());
assertEquals("abcdef", BasedSequenceImpl.of("abcdef").trimEnd().toString());
}
@Test
public void test_startOfDelimitedBy() throws Exception {
assertEquals(0, BasedSequenceImpl.of("0,23,567,9012").startOfDelimitedBy(",", 0));
assertEquals(0, BasedSequenceImpl.of("0,23,567,9012").startOfDelimitedBy(",", 1));
assertEquals(2, BasedSequenceImpl.of("0,23,567,9012").startOfDelimitedBy(",", 2));
assertEquals(2, BasedSequenceImpl.of("0,23,567,9012").startOfDelimitedBy(",", 3));
assertEquals(2, BasedSequenceImpl.of("0,23,567,9012").startOfDelimitedBy(",", 4));
assertEquals(5, BasedSequenceImpl.of("0,23,567,9012").startOfDelimitedBy(",", 5));
assertEquals(5, BasedSequenceImpl.of("0,23,567,9012").startOfDelimitedBy(",", 6));
assertEquals(5, BasedSequenceImpl.of("0,23,567,9012").startOfDelimitedBy(",", 7));
assertEquals(5, BasedSequenceImpl.of("0,23,567,9012").startOfDelimitedBy(",", 8));
assertEquals(9, BasedSequenceImpl.of("0,23,567,9012").startOfDelimitedBy(",", 9));
assertEquals(9, BasedSequenceImpl.of("0,23,567,9012").startOfDelimitedBy(",", 10));
assertEquals(9, BasedSequenceImpl.of("0,23,567,9012").startOfDelimitedBy(",", 11));
assertEquals(9, BasedSequenceImpl.of("0,23,567,9012").startOfDelimitedBy(",", 12));
assertEquals(9, BasedSequenceImpl.of("0,23,567,9012").startOfDelimitedBy(",", 13));
assertEquals(9, BasedSequenceImpl.of("0,23,567,9012").startOfDelimitedBy(",", 14));
}
@Test
public void test_startOfDelimitedByAny() throws Exception {
assertEquals(0, BasedSequenceImpl.of("0,23,567,9012").startOfDelimitedByAny(",", 0));
assertEquals(0, BasedSequenceImpl.of("0,23,567,9012").startOfDelimitedByAny(",", 1));
assertEquals(2, BasedSequenceImpl.of("0,23,567,9012").startOfDelimitedByAny(",", 2));
assertEquals(2, BasedSequenceImpl.of("0,23,567,9012").startOfDelimitedByAny(",", 3));
assertEquals(2, BasedSequenceImpl.of("0,23,567,9012").startOfDelimitedByAny(",", 4));
assertEquals(5, BasedSequenceImpl.of("0,23,567,9012").startOfDelimitedByAny(",", 5));
assertEquals(5, BasedSequenceImpl.of("0,23,567,9012").startOfDelimitedByAny(",", 6));
assertEquals(5, BasedSequenceImpl.of("0,23,567,9012").startOfDelimitedByAny(",", 7));
assertEquals(5, BasedSequenceImpl.of("0,23,567,9012").startOfDelimitedByAny(",", 8));
assertEquals(9, BasedSequenceImpl.of("0,23,567,9012").startOfDelimitedByAny(",", 9));
assertEquals(9, BasedSequenceImpl.of("0,23,567,9012").startOfDelimitedByAny(",", 10));
assertEquals(9, BasedSequenceImpl.of("0,23,567,9012").startOfDelimitedByAny(",", 11));
assertEquals(9, BasedSequenceImpl.of("0,23,567,9012").startOfDelimitedByAny(",", 12));
assertEquals(9, BasedSequenceImpl.of("0,23,567,9012").startOfDelimitedByAny(",", 13));
assertEquals(9, BasedSequenceImpl.of("0,23,567,9012").startOfDelimitedByAny(",", 14));
}
@Test
public void test_endOfDelimitedBy() throws Exception {
assertEquals(1, BasedSequenceImpl.of("0,23,567,9012").endOfDelimitedBy(",", 0));
assertEquals(1, BasedSequenceImpl.of("0,23,567,9012").endOfDelimitedBy(",", 1));
assertEquals(4, BasedSequenceImpl.of("0,23,567,9012").endOfDelimitedBy(",", 2));
assertEquals(4, BasedSequenceImpl.of("0,23,567,9012").endOfDelimitedBy(",", 3));
assertEquals(4, BasedSequenceImpl.of("0,23,567,9012").endOfDelimitedBy(",", 4));
assertEquals(8, BasedSequenceImpl.of("0,23,567,9012").endOfDelimitedBy(",", 5));
assertEquals(8, BasedSequenceImpl.of("0,23,567,9012").endOfDelimitedBy(",", 6));
assertEquals(8, BasedSequenceImpl.of("0,23,567,9012").endOfDelimitedBy(",", 7));
assertEquals(8, BasedSequenceImpl.of("0,23,567,9012").endOfDelimitedBy(",", 8));
assertEquals(13, BasedSequenceImpl.of("0,23,567,9012").endOfDelimitedBy(",", 9));
assertEquals(13, BasedSequenceImpl.of("0,23,567,9012").endOfDelimitedBy(",", 10));
assertEquals(13, BasedSequenceImpl.of("0,23,567,9012").endOfDelimitedBy(",", 11));
assertEquals(13, BasedSequenceImpl.of("0,23,567,9012").endOfDelimitedBy(",", 12));
assertEquals(13, BasedSequenceImpl.of("0,23,567,9012").endOfDelimitedBy(",", 13));
assertEquals(13, BasedSequenceImpl.of("0,23,567,9012").endOfDelimitedBy(",", 14));
}
@Test
public void test_endOfDelimitedByAny() throws Exception {
assertEquals(1, BasedSequenceImpl.of("0,23,567,9012").endOfDelimitedByAny(",", 0));
assertEquals(1, BasedSequenceImpl.of("0,23,567,9012").endOfDelimitedByAny(",", 1));
assertEquals(4, BasedSequenceImpl.of("0,23,567,9012").endOfDelimitedByAny(",", 2));
assertEquals(4, BasedSequenceImpl.of("0,23,567,9012").endOfDelimitedByAny(",", 3));
assertEquals(4, BasedSequenceImpl.of("0,23,567,9012").endOfDelimitedByAny(",", 4));
assertEquals(8, BasedSequenceImpl.of("0,23,567,9012").endOfDelimitedByAny(",", 5));
assertEquals(8, BasedSequenceImpl.of("0,23,567,9012").endOfDelimitedByAny(",", 6));
assertEquals(8, BasedSequenceImpl.of("0,23,567,9012").endOfDelimitedByAny(",", 7));
assertEquals(8, BasedSequenceImpl.of("0,23,567,9012").endOfDelimitedByAny(",", 8));
assertEquals(13, BasedSequenceImpl.of("0,23,567,9012").endOfDelimitedByAny(",", 9));
assertEquals(13, BasedSequenceImpl.of("0,23,567,9012").endOfDelimitedByAny(",", 10));
assertEquals(13, BasedSequenceImpl.of("0,23,567,9012").endOfDelimitedByAny(",", 11));
assertEquals(13, BasedSequenceImpl.of("0,23,567,9012").endOfDelimitedByAny(",", 12));
assertEquals(13, BasedSequenceImpl.of("0,23,567,9012").endOfDelimitedByAny(",", 13));
assertEquals(13, BasedSequenceImpl.of("0,23,567,9012").endOfDelimitedByAny(",", 14));
}
@Test
public void testSplitBasic() throws Exception {
BasedSequence sequence = SubSequence.of(" 1,2 , 3 ,4,5, ");
BasedSequence[] list = sequence.split(',', 0, BasedSequence.SPLIT_TRIM_PARTS | BasedSequence.SPLIT_SKIP_EMPTY);
ArrayList<String> sl = new ArrayList<>(list.length);
for (BasedSequence basedSequence : list) sl.add(basedSequence.toString());
assertArrayEquals(new String[] { "1", "2", "3", "4", "5" }, sl.toArray(new String[0]));
}
}
| [
"[email protected]"
] | |
db1892464df1d52aab5f1e4f6b24bb3106a72a19 | 130db18098c6a7e8f1cebe1dca47655a7205a7e6 | /src/ru/fizteh/fivt/students/kinanAlsarmini/multifilemap/DistributedLoader.java | dbc1f36978511925ca05d4455c50fec91be9acc2 | [] | no_license | mbeider/fizteh-java-2014 | 99051d5252b80bffa5cab3193802691e96dcecfb | 0ebbaff4f1a4b774de7ee785584fba65807fb1f7 | refs/heads/master | 2021-01-21T08:05:50.628038 | 2015-03-30T09:08:44 | 2015-03-30T09:08:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 989 | java | package ru.fizteh.fivt.students.kinanAlsarmini.multifilemap;
import ru.fizteh.fivt.students.kinanAlsarmini.filemap.base.FilemapReader;
import ru.fizteh.fivt.students.kinanAlsarmini.filemap.base.TableBuilder;
import java.io.File;
import java.io.IOException;
public class DistributedLoader {
public static void load(TableBuilder builder) throws IOException {
File tableDirectory = builder.getTableDirectory();
if (tableDirectory.listFiles() == null) {
return;
}
for (final File bucket : tableDirectory.listFiles()) {
if (bucket.isFile()) {
continue;
}
if (bucket.listFiles().length == 0) {
throw new IllegalArgumentException("empty bucket");
}
for (final File file : bucket.listFiles()) {
builder.setCurrentFile(file);
FilemapReader.loadFromFile(file.getAbsolutePath(), builder);
}
}
}
}
| [
"[email protected]"
] | |
a510f2e3a18bb8867300aa7e19ed1986dff24bbb | 92a5d0e9f91a85bdeace182e2af425b46178e39a | /oh-my-scheduler-worker/src/main/java/com/github/kfcfans/oms/worker/core/processor/sdk/MapProcessor.java | 4e7cafcab6e19473a5fbcca23b345900de0b0de5 | [
"Apache-2.0"
] | permissive | ColaFans/OhMyScheduler | fd0f1efe9f9f2f1386ef34728fe53ea609e1ec6d | 53cbe060b65df78730b2f576c27b6f143de78ffb | refs/heads/master | 2022-10-13T14:22:03.678873 | 2020-06-09T03:00:23 | 2020-06-09T03:00:23 | 270,890,471 | 2 | 1 | Apache-2.0 | 2020-06-09T03:06:58 | 2020-06-09T03:06:58 | null | UTF-8 | Java | false | false | 3,269 | java | package com.github.kfcfans.oms.worker.core.processor.sdk;
import akka.actor.ActorSelection;
import akka.pattern.Patterns;
import com.github.kfcfans.oms.common.RemoteConstant;
import com.github.kfcfans.oms.common.response.AskResponse;
import com.github.kfcfans.oms.worker.OhMyWorker;
import com.github.kfcfans.oms.worker.common.ThreadLocalStore;
import com.github.kfcfans.oms.worker.common.constants.TaskConstant;
import com.github.kfcfans.oms.worker.common.utils.AkkaUtils;
import com.github.kfcfans.oms.worker.core.processor.ProcessResult;
import com.github.kfcfans.oms.worker.persistence.TaskDO;
import com.github.kfcfans.oms.worker.pojo.request.ProcessorMapTaskRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.CollectionUtils;
import java.time.Duration;
import java.util.List;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.TimeUnit;
/**
* Map 处理器,允许开发者自定义拆分任务进行分布式执行
*
* @author tjq
* @since 2020/4/17
*/
@Slf4j
public abstract class MapProcessor implements BasicProcessor {
private static final int RECOMMEND_BATCH_SIZE = 200;
private static final int REQUEST_TIMEOUT_MS = 5000;
/**
* 分发子任务
* @param taskList 子任务,再次执行时可通过 TaskContext#getSubTask 获取
* @param taskName 子任务名称,即子任务处理器中 TaskContext#getTaskName 获取到的值
* @return map结果
*/
public ProcessResult map(List<?> taskList, String taskName) {
if (CollectionUtils.isEmpty(taskList)) {
return new ProcessResult(false, "taskList can't be null");
}
if (taskList.size() > RECOMMEND_BATCH_SIZE) {
log.warn("[MapProcessor] map task size is too large, network maybe overload... please try to split the tasks.");
}
TaskDO task = ThreadLocalStore.getTask();
// 1. 构造请求
ProcessorMapTaskRequest req = new ProcessorMapTaskRequest(task, taskList, taskName);
// 2. 可靠发送请求(任务不允许丢失,需要使用 ask 方法,失败抛异常)
boolean requestSucceed = false;
try {
String akkaRemotePath = AkkaUtils.getAkkaWorkerPath(task.getAddress(), RemoteConstant.Task_TRACKER_ACTOR_NAME);
ActorSelection actorSelection = OhMyWorker.actorSystem.actorSelection(akkaRemotePath);
CompletionStage<Object> requestCS = Patterns.ask(actorSelection, req, Duration.ofMillis(REQUEST_TIMEOUT_MS));
AskResponse respObj = (AskResponse) requestCS.toCompletableFuture().get(REQUEST_TIMEOUT_MS, TimeUnit.MILLISECONDS);
requestSucceed = respObj.isSuccess();
}catch (Exception e) {
log.warn("[MapProcessor] map failed, exception is {}.", e.toString());
}
if (requestSucceed) {
return new ProcessResult(true, "MAP_SUCCESS");
}else {
return new ProcessResult(false, "MAP_FAILED");
}
}
/**
* 是否为根任务
* @return true -> 根任务 / false -> 非根任务
*/
public boolean isRootTask() {
TaskDO task = ThreadLocalStore.getTask();
return TaskConstant.ROOT_TASK_NAME.equals(task.getTaskName());
}
}
| [
"[email protected]"
] | |
b6f4e016120010d13418a45de134c4705f92937c | e1081211081f7039693b54897dbf8eefa31a1d93 | /SuperUsage.java | b23a9c1be47d20d343fca6dd18a77f345d1d3603 | [] | no_license | nitinchauhan235/GitHubBasics | 5fbe55095b812fc697ffc621e068e025b370ee90 | ec096e405585b95b76039660df748f9a7a11b9da | refs/heads/master | 2023-06-23T18:43:58.340547 | 2021-07-25T07:34:56 | 2021-07-25T07:34:56 | 387,152,894 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 496 | java | class Person
{
String name;
int id;
public Person(int id,String name)
{
this.name=name;
this.id=id;
}
}
class Emp extends Person
{
int salary;
public Emp(int id, String name,int salary)
{
super(id,name);
this.salary = salary;
}
public void display()
{
System.out.println(id + name + salary);
}
}
public class SuperUsage {
public static void main(String[] args) {
// TODO Auto-generated method stub
Emp e1 = new Emp(1,"Nitin",100000);
e1.display();
}
}
| [
"[email protected]"
] | |
0b8cddff0948537f8dc3832076aa82bfac22a649 | cd9447b2041f51b960e3c6128b8fd3333304d0e3 | /SchoolHealth/src/main/java/com/health/SchoolHealth/controlers/ImunisationsController.java | e85c5397294879a7f9ba3cf9e1cbefc0cb2a21a9 | [] | no_license | Mihael01/diplomaProject | 8eeedd0f1de36db7c28e458ff2fa8b42bc831009 | 7948c6154a5fea4c8b08d57857607fd03b6e25d5 | refs/heads/main | 2023-05-14T01:37:38.868634 | 2021-06-06T04:34:49 | 2021-06-06T04:34:49 | 334,691,990 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,294 | java | package com.health.SchoolHealth.controlers;
import com.health.SchoolHealth.controlers.formPOJOs.AddressForm;
import com.health.SchoolHealth.controlers.formPOJOs.SchoolForm;
import com.health.SchoolHealth.model.DAOs.SchoolDao;
import com.health.SchoolHealth.model.entities.School;
import com.health.SchoolHealth.services.AddressService;
import com.health.SchoolHealth.services.SchoolService;
import com.health.SchoolHealth.controlers.formPOJOs.SettlementType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import java.util.ArrayList;
import java.util.List;
import static com.health.SchoolHealth.util.RepositoryUtil.iterableToList;
@RestController
public class ImunisationsController {
@Autowired
private SchoolService schoolService;
@Autowired
private AddressService addressService;
@Autowired
private SchoolDao schoolDao;
ModelAndView modelAndView;
ModelAndView newModelAndView;
List<SettlementType> allSettlementPlaceType;
@GetMapping
@RequestMapping(value = {"/imunisations"})
public ModelAndView getImunisationsData() {
System.out.println("in imunisations");
return modelAndView;
}
}
| [
"[email protected]"
] | |
0d356bbdccd9e284c38c4ffec6c77eb6fe6bc257 | a46ca78826807f241507cff88c1f331d6a317c62 | /app/src/main/java/com/example/tele/custombleservice/CustomSurfaceView.java | 45315d07c1e4d4ee2cc209b2483b4158b4699d79 | [] | no_license | teleger/CustomViewTest | 0d6e8276176e4ceffac38ce3a144dbe397301ec8 | 47a82e44beff2b1282d33a1dc4595e9c20988714 | refs/heads/master | 2020-07-29T19:49:00.283341 | 2019-09-21T09:30:29 | 2019-09-21T09:30:29 | 209,938,676 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 509 | java | package com.example.tele.custombleservice;
import android.content.Context;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.view.SurfaceView;
public class CustomSurfaceView extends SurfaceView {
public CustomSurfaceView(Context context) {
super(context);
}
public CustomSurfaceView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
}
}
| [
"[email protected]"
] | |
e875f1de275aa1803a3501542881b5b743043c2a | 78f042d42be9d282c2b90430e3c385c8c5b027b6 | /src/main/java/com/test/sharding/security/package-info.java | 56b8ffd7c417c46f2da374cf652f664de4b6742f | [] | no_license | TonyLuo/test-shardingsphere | 0e7189982a1ba9ac5b83f8a4909c55a2429a5a92 | 446052c0ea4ddffdd68148403306b2ef8f1e7183 | refs/heads/master | 2022-12-21T23:30:34.836611 | 2019-12-24T02:13:45 | 2019-12-24T02:13:45 | 229,847,990 | 0 | 0 | null | 2022-12-16T04:42:35 | 2019-12-24T01:26:59 | Java | UTF-8 | Java | false | false | 78 | java | /**
* Spring Security configuration.
*/
package com.test.sharding.security;
| [
"[email protected]"
] | |
e257a197807ca2ca636f87a3538188c67688e335 | 7047beedf93589c18aded4abb59b8ae4b42ef6c4 | /test/java/com/theatro/api/controller/EmployeeServiceTest.java | d22b1146a62968031d8d24ee5e879ec4ba270d47 | [] | no_license | vignesh-space/hdcconnect | b4bd132c5f9b664f8ecf428f889dc2d42d8aee49 | f7424f961adbf97236ad626d2700fc8a5790dd0e | refs/heads/master | 2020-03-23T07:27:16.589360 | 2018-07-17T16:08:27 | 2018-07-17T16:08:27 | 141,272,189 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,353 | java | package com.theatro.api.controller;
import com.theatro.api.response.Employee;
import com.theatro.api.service.EmployeeService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import static org.junit.Assert.assertEquals;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.when;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = EmployeeServiceTest.class)
public class EmployeeServiceTest {
@MockBean
private EmployeeService employeeService;
@Test
public void getEmployee() {
Employee employee = new Employee();
employee.setFirstName("JUnit");
employee.setLastName("TestCase");
employee.setEmployeeId("10");
try {
when(employeeService.getEmployee(employee.getEmployeeId(),employee.getFirstName())).thenReturn(employee);
} catch (Exception e) {
e.printStackTrace();
}
assertEquals("JUnit",employee.getFirstName());
}
}
| [
"[email protected]"
] | |
83d97c1362fdf94fc5d15335409758df4abb405a | d8f2f04136c7515823249b75c56db45da76c64eb | /core/src/com/drem/games/ggs/game/state/MainMenuState.java | c85b6d758e0e95f903a594e0ad384b4706ae9909 | [] | no_license | drem-darios/GunGunShoot-libgdx | 1be58ab648c70e2247043ad2d3590d836c40249a | 4e67d1d09df390111b8cf213db90f5ac314fc1f4 | refs/heads/master | 2021-01-10T20:18:12.825982 | 2015-09-01T18:08:14 | 2015-09-01T18:08:14 | 32,798,281 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,203 | java | package com.drem.games.ggs.game.state;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator;
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeFontParameter;
import com.drem.games.ggs.Application;
import com.drem.games.ggs.game.manager.GameStateManager;
/**
* Created by drem on 3/23/15.
*/
public class MainMenuState extends GameState {
private SpriteBatch sb;
private BitmapFont titleFont;
private BitmapFont font;
private final String title = "Gun Gun Shoot"; // Get this from properties
private int currentItem;
private String[] menuItems;
public MainMenuState(GameStateManager gsm) {
super(gsm);
}
@Override
public void init() {
sb = new SpriteBatch();
FreeTypeFontGenerator gen = new FreeTypeFontGenerator(Gdx.files.internal("fonts/Hyperspace-Bold.ttf"));
FreeTypeFontParameter parameter = new FreeTypeFontParameter();
parameter.size = 56;
parameter.color = Color.WHITE;
titleFont = gen.generateFont(parameter);
parameter.size = 36;
font = gen.generateFont(parameter);
menuItems = new String[]{"Single Player", "Multi-Player", "Exit"};
gen.dispose();
// Jukebox.playMusic(name);
}
@Override
public void update(float dt) {
handleInput();
}
@Override
public void draw() {
sb.setProjectionMatrix(Application.camera.combined);
sb.begin();
// get size of title to center
float width = titleFont.getBounds(title).width;
// draw title
titleFont.draw(sb, title, (Application.WIDTH - width )/ 2, 300);
// draw menu
for (int i = 0; i < menuItems.length; i++) {
// get size of item to center
width = font.getBounds(menuItems[i]).width;
if (currentItem == i) {
font.setColor(Color.BLUE);
} else {
font.setColor(Color.WHITE);
}
// draw item
font.draw(sb, menuItems[i], (Application.WIDTH - width) / 2, 180 - 35 * i);
}
sb.end();
}
@Override
public void handleInput() {
if (Gdx.input.isKeyJustPressed(Input.Keys.UP)) {
if (currentItem > 0) {
currentItem --;
}
}
if (Gdx.input.isKeyJustPressed(Input.Keys.DOWN)) {
if (currentItem < menuItems.length - 1) {
currentItem ++;
}
}
if (Gdx.input.isKeyJustPressed(Input.Keys.ENTER)) {
select();
}
}
private void select() {
if (currentItem == 0) {
gameStateManager.setState(GameStateManager.SINGLE_PLAYER_MENU);
}
if (currentItem == 1) {
gameStateManager.setState(GameStateManager.MULTIPLAYER_MENU);
}
if (currentItem == 2) {
Gdx.app.exit();
}
}
@Override
public void dispose() {
}
}
| [
"[email protected]"
] | |
1d838ac74d28b7b5fe9da70aacad946efc367cff | 762c74c43ec0e3705b17ea8b5a5eb1172dd17f83 | /app/src/main/java/view/zbea/com/tcustomview/utils/NetUtils.java | 5af8e28a6d629c22b58967e3b8859fc46822c8bc | [] | no_license | Zbea/TCustomView | db39eecd13cfbf551a017d517bd5761990a94270 | 79b1a1eb472def14fc19439c8bbd9f9cf09204e2 | refs/heads/master | 2021-05-04T10:44:33.850829 | 2017-06-14T09:10:45 | 2017-06-14T09:10:45 | 54,606,391 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,613 | java | package view.zbea.com.tcustomview.utils;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
/**
* 跟网络相关的工具类
*/
public class NetUtils {
private NetUtils() {
/* cannot be instantiated */
throw new UnsupportedOperationException("cannot be instantiated");
}
/**
* 判断网络是否连接
*
* @param context
* @return
*/
public static boolean isNetStatus(Context context) {
ConnectivityManager connectivity = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
if (null != connectivity) {
NetworkInfo info = connectivity.getActiveNetworkInfo();
if (null != info && info.isConnected()) {
if (info.getState() == NetworkInfo.State.CONNECTED) {
return true;
}
}
}
return false;
}
/**
* 判断是否是wifi连接
*/
public static boolean isWifi(Context context) {
ConnectivityManager cm = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
if (cm == null)
return false;
return cm.getActiveNetworkInfo().getType() == ConnectivityManager.TYPE_WIFI;
}
/**
* 打开网络设置界面
*/
public static void openSetting(Activity activity) {
Intent intent = new Intent("/");
ComponentName cm = new ComponentName("com.android.settings",
"com.android.settings.WirelessSettings");
intent.setComponent(cm);
intent.setAction("android.intent.action.VIEW");
activity.startActivityForResult(intent, 0);
}
}
| [
"[email protected]"
] | |
3d362ae3f078845d2b60db8ff5d4e5a59e2607fa | c5f031d29665dc938a0c6de0bbb13961003bbb44 | /tddcalculator/src/tddcalculator/TestAll.java | d15eadae7228a441bb1a570209931277f98fde8f | [] | no_license | SunitBhopal94/tddcalculator | 430aa6fafcadfcbc96f6ae4d0bee7b067d6f374d | 52d43fa98bc5eadeef00b52a3d31cde4e26c925f | refs/heads/master | 2020-08-30T16:13:14.688345 | 2019-10-30T02:50:47 | 2019-10-30T02:50:47 | 218,429,995 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 225 | java | package tddcalculator;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
import org.junit.runner.RunWith;
@RunWith(Suite.class)
@SuiteClasses(testcal.class)
public class TestAll {
}
| [
"[email protected]"
] | |
30af86697814af6a33488e1e69562d48ccbaf59a | 303e3a5b27856f232033e38d4c8c38a4f2e44b31 | /刷题笔记/LeetCode/LeetCode代码/120.三角形最小路径和.java | 0f00f649c4a7b4a1d22bc82ea4080b096a263af2 | [] | no_license | zcx-xxx/DailyNotes | da74eda079c7dfdbad8c7a2b760fbd1518f4b6d9 | 215f636213fd9d424d5bd02892fba4c67a374cc3 | refs/heads/master | 2022-05-30T19:33:40.349697 | 2020-05-01T13:30:49 | 2020-05-01T13:30:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,119 | java | import java.util.*;
/*
* @lc app=leetcode.cn id=120 lang=java
*
* [120] 三角形最小路径和
*/
class Solution {
public int minimumTotal(List<List<Integer>> triangle) {
int len = triangle.size();
if(len == 0){
return 0;
} else if (len == 1) {
return triangle.get(0).get(0);
}
int[] arr = new int[len];
arr[0] = triangle.get(0).get(0);
for(int i = 1; i < len; ++i){
int cnt = triangle.get(i).size();
for(int j = cnt - 1; j >= 0; --j){
if(j == cnt - 1){
arr[j] = triangle.get(i).get(j) + arr[j - 1];
} else if(j == 0){
arr[j] += triangle.get(i).get(j);
} else {
arr[j] = Math.min(arr[j], arr[j - 1]) + triangle.get(i).get(j);
}
}
}
//遍历数组,找最大值
int res = Integer.MAX_VALUE;
for(int i = 0; i < len; ++i){
if(arr[i] < res){
res = arr[i];
}
}
return res;
}
}
| [
"[email protected]"
] | |
c1cff51dc1a498d98e31b63f05d181423e36c5c0 | 8191bea395f0e97835735d1ab6e859db3a7f8a99 | /f737922a0ddc9335bb0fc2f3ae5ffe93_source_from_JADX/java_files/axj$a.java | 9b67dd1b6845cb9389e9eee095134b2e1a2bb8f7 | [] | no_license | msmtmsmt123/jadx-1 | 5e5aea319e094b5d09c66e0fdb31f10a3238346c | b9458bb1a49a8a7fba8b9f9a6fb6f54438ce03a2 | refs/heads/master | 2021-05-08T19:21:27.870459 | 2017-01-28T04:19:54 | 2017-01-28T04:19:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 229 | java | class axj$a {
int DW;
final byte[] j6;
axj$a() {
this.j6 = new byte[8192];
}
axj$a(int i) {
this.j6 = new byte[i];
}
boolean j6() {
return this.DW == this.j6.length;
}
}
| [
"[email protected]"
] | |
6473c757ca05bf0f669f2bbed386874fa2ab53d5 | ab0aa5bb61102becc22a11c128736a47270848d8 | /set1/H.java | 7e4def9324fe84df5b240d6bf2403465568aad3f | [] | no_license | bhartipriyadarshini/JavaSrc | 93445c492c9fbc55146829dbc8f8ccf77bfcec7b | 6380a1155cb057b797987db4c09220cc63b61b09 | refs/heads/master | 2021-01-10T14:09:30.465337 | 2015-12-24T11:54:11 | 2015-12-24T11:54:11 | 48,292,674 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 136 | java | class H
{
public static void main(String args[])
{
int i=0;
int j=i++ +i-- +i++ +i--;
System.out.print(i);
System.out.print(j);
}
} | [
"[email protected]"
] | |
73ac29f799eb0f79e89a8e98dbdd99af02c8e1ca | 1fd0a459922a9c4355daabb816840a8e4f378eb4 | /Chapter 6/HypotenuseCalculations.java | 67a72553ec659f94459178bc2cf99820c8cc801a | [
"MIT"
] | permissive | eraldoforgoli/JavaHowToProgramExercises | 291df5855017d11939c60fe1c7af073f78012890 | 75e357f9b0a2733a8b039d0862285b09bea295ef | refs/heads/master | 2020-04-23T12:14:19.299366 | 2019-03-03T21:29:10 | 2019-03-03T21:29:10 | 171,161,699 | 0 | 0 | null | 2019-03-03T21:29:11 | 2019-02-17T19:17:54 | Java | UTF-8 | Java | false | false | 899 | java |
/*
6.15 (Hypotenuse Calculations) Define a method hypotenuse that calculates the hypotenuse of
a right triangle when the lengths of the other two sides are given. The method should take two arguments
of type double and return the hypotenuse as a double. Incorporate this method into an
application that reads values for side1 and side2 and performs the calculation with the hypotenuse method.
*/
import java.util.Scanner;
public class HypotenuseCalculations {
public static void main(String[] args) {
double katet1, katet2;
Scanner input = new Scanner(System.in);
System.out.println("Enter sides :");
katet1 = input.nextDouble();
katet2 = input.nextDouble();
System.out.println("Hypotenuse : " + hypotenuse(katet1, katet2));
input.close();
}
public static double hypotenuse(double katet1, double katet2) {
return Math.sqrt((Math.pow(katet1, 2) + Math.pow(katet2, 2)));
}
}
| [
"[email protected]"
] | |
d6794966cbc561223913e4f722617a360f9e4b08 | b552d3e79f66f6287182d86b7c3188e7a7197345 | /plain/semester_1/erg10_ask2/Ypallhlos.java | bc6f3bb25581debdb8fd008a471fb7afbb3e5969 | [
"BSD-2-Clause"
] | permissive | insanitywholesale/yavvar | 2cf7d97718d6c868d0904841cb12d132361a796b | 35479ceeff7b4fa4eafd0e949aa351f0ac846ec5 | refs/heads/master | 2022-05-05T07:55:07.670240 | 2022-04-29T20:47:07 | 2022-04-29T20:47:07 | 162,904,325 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,051 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package erg10_ask2;
/**
*
* @author angle
*/
public class Ypallhlos {
private int kodikosEpixeirhshs, arithmosMitrwou, oresYperorias, eidosPtyxiou;
private double basikosMisthos;
Ypallhlos() {
//intentionally left blank
}
Ypallhlos(int kE, int aM, int oY, int eP, double bM) {
kodikosEpixeirhshs = kE;
arithmosMitrwou = aM;
oresYperorias = oY;
eidosPtyxiou = eP;
basikosMisthos = bM;
}
//get
int getkodikosEpixeirhshs() {
return kodikosEpixeirhshs;
}
int getarithmosMitrwou() {
return arithmosMitrwou;
}
int getoresYperorias() {
return oresYperorias;
}
int geteidosPtyxiou() {
return eidosPtyxiou;
}
double getbasikosMisthos() {
return basikosMisthos;
}
//set
void setkodikosEpixeirhshs(int kE) {
kodikosEpixeirhshs = kE;
}
void setarithmosMitrwou(int aM) {
arithmosMitrwou = aM;
}
void setoresYperorias(int oY) {
oresYperorias = oY;
}
void seteidosPtyxiou(int eP) {
eidosPtyxiou = eP;
}
void setbasikosMisthos(double bM) {
basikosMisthos = bM;
}
//methods
void showTelikosMisthos() {
int timhYperorias = oresYperorias * 20;
int epidomaPtyxiou = 0;
double telikosMisthos;
switch (epidomaPtyxiou) {
case 1: epidomaPtyxiou = 300;
break;
case 2: epidomaPtyxiou = 150;
break;
case 3: epidomaPtyxiou = 100;
break;
case 4: epidomaPtyxiou = 50;
break;
default: epidomaPtyxiou = 0;
}
System.out.println("final income amount: " + (telikosMisthos = basikosMisthos + timhYperorias + epidomaPtyxiou) + "\n");
}
double returnTelikosMisthos() {
int timhYperorias = oresYperorias * 20;
int epidomaPtyxiou = 0;
double telikosMisthos;
switch (epidomaPtyxiou) {
case 1: epidomaPtyxiou = 300;
break;
case 2: epidomaPtyxiou = 150;
break;
case 3: epidomaPtyxiou = 100;
break;
case 4: epidomaPtyxiou = 50;
break;
default: epidomaPtyxiou = 0;
}
return telikosMisthos = basikosMisthos + timhYperorias + epidomaPtyxiou;
}
@Override //the following method overrides the default behaviour
public String toString() {
String s = "\nbusiness serial number: " + kodikosEpixeirhshs + "\nperson serial number: " + arithmosMitrwou + "\nbase income amount: ";
s += basikosMisthos + "\novertime hours: " + oresYperorias + "\ndegree type: " + eidosPtyxiou;
return s;
}
}
| [
"[email protected]"
] | |
c9ff43926796138a8ed76b642a7ba9bcf6d7bc8e | d1bd1246f161b77efb418a9c24ee544d59fd1d20 | /java/Common/src/org/javenstudio/common/indexdb/codec/IFieldsFormat.java | b41b6e096568f9e7278f7daf4f4bc198ae3e329c | [] | no_license | navychen2003/javen | f9a94b2e69443291d4b5c3db5a0fc0d1206d2d4a | a3c2312bc24356b1c58b1664543364bfc80e816d | refs/heads/master | 2021-01-20T12:12:46.040953 | 2015-03-03T06:14:46 | 2015-03-03T06:14:46 | 30,912,222 | 0 | 1 | null | 2023-03-20T11:55:50 | 2015-02-17T10:24:28 | Java | UTF-8 | Java | false | false | 3,032 | java | package org.javenstudio.common.indexdb.codec;
import java.io.Closeable;
import java.io.IOException;
import org.javenstudio.common.indexdb.CorruptIndexException;
import org.javenstudio.common.indexdb.IIndexContext;
import org.javenstudio.common.indexdb.IDirectory;
import org.javenstudio.common.indexdb.IField;
import org.javenstudio.common.indexdb.IFieldInfo;
import org.javenstudio.common.indexdb.IFieldInfos;
import org.javenstudio.common.indexdb.IFieldVisitor;
import org.javenstudio.common.indexdb.IMergeState;
import org.javenstudio.common.indexdb.ISegmentInfo;
/** Controls the format of stored fields */
public interface IFieldsFormat {
public static interface Reader extends Cloneable, Closeable {
/** Visit the stored fields for document <code>n</code> */
public void visitDocument(int n, IFieldVisitor visitor)
throws CorruptIndexException, IOException;
public Reader clone();
}
public static interface Writer extends Closeable {
/**
* Called before writing the stored fields of the document.
* {@link #writeField(FieldInfo, IndexableField)} will be called
* <code>numStoredFields</code> times. Note that this is
* called even if the document has no stored fields, in
* this case <code>numStoredFields</code> will be zero.
*/
public void startDocument(int numStoredFields) throws IOException;
/** Writes a single stored field. */
public void writeField(IFieldInfo info, IField field) throws IOException;
/**
* Aborts writing entirely, implementation should remove
* any partially-written files, etc.
*/
public void abort();
/**
* Called before {@link #close()}, passing in the number
* of documents that were written. Note that this is
* intentionally redundant (equivalent to the number of
* calls to {@link #startDocument(int)}, but a Codec should
* check that this is the case to detect the JRE bug described
* in LUCENE-1282.
*/
public void finish(IFieldInfos fis, int numDocs) throws IOException;
/**
* Merges in the stored fields from the readers in
* <code>mergeState</code>. The default implementation skips
* over deleted documents, and uses {@link #startDocument(int)},
* {@link #writeField(FieldInfo, IndexableField)}, and {@link #finish(FieldInfos, int)},
* returning the number of documents that were written.
* Implementations can override this method for more sophisticated
* merging (bulk-byte copying, etc).
*/
public int merge(IMergeState mergeState) throws IOException;
}
public IIndexContext getContext();
public IIndexFormat getIndexFormat();
public String getIndexCodecName();
public String getDataCodecName();
public String getFieldsFileName(String segment);
public String getFieldsIndexFileName(String segment);
public Reader createReader(IDirectory dir, String segment,
ISegmentInfo si, IFieldInfos fn) throws IOException;
public Writer createWriter(IDirectory dir, String segment)
throws IOException;
}
| [
"[email protected]"
] | |
4fcead6bd7e1827adea9974eaa1b9dfcd4aa0b72 | 6582b908a9a497bc401e7d3f3cd1117157b77e6e | /app/src/main/java/com/jdashdemo/user/constants/VersionChecker.java | 50eb6b2b5a782533a535d01f1102e070b294e71f | [] | no_license | tudechristian3/jogxpress | f4b1f3380ae98e3c24b3a52553936e45f97db3a2 | 2c42ff3a37e041dc5d57b1dfc3de3062a99ae66d | refs/heads/master | 2023-05-22T13:12:58.601229 | 2021-06-14T07:30:44 | 2021-06-14T07:30:44 | 358,480,736 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,989 | java | package com.jdashdemo.user.constants;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.AsyncTask;
import com.jdashdemo.user.R;
import com.jdashdemo.user.utils.Log;
import org.jsoup.Jsoup;
import java.io.IOException;
import java.util.Objects;
/**
* Created by jdashdemo on 12/4/2018.
*/
public class VersionChecker extends AsyncTask<String, String, String> {
private String newVersion;
@SuppressLint("StaticFieldLeak")
private Activity context;
public VersionChecker(Activity context) {
this.context = context;
}
@Override
protected String doInBackground(String... params) {
try {
newVersion = Jsoup.connect("https://play.google.com/store/apps/details?id=" + context.getPackageName() + "&hl=en")
.timeout(30000)
.userAgent("Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6")
.referrer("http://www.google.com")
.get()
.select(".IQ1z0d .htlgb")
.get(7)
.ownText();
} catch (IOException e) {
e.printStackTrace();
}
return newVersion;
}
@Override
protected void onPostExecute(String s) {
super.onPostExecute(s);
PackageInfo pInfo = null;
try {
pInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
if (newVersion != null) {
int latestVersion = Integer.parseInt(newVersion.replace(".", ""));
int versionCode = Integer.parseInt(Objects.requireNonNull(pInfo).versionName.replace(".", ""));
Log.e("", newVersion);
if (versionCode < latestVersion) {
AlertDialog.Builder alert = new AlertDialog.Builder(context, R.style.DialogStyle);
alert.setTitle(R.string.app_name)
.setIcon(R.mipmap.ic_launcher)
.setMessage("Please update" + " " + context.getString(R.string.app_name) + " " + "app. you have an old version.")
.setNegativeButton("Update", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + context.getPackageName())));
context.finish();
}
});
alert.setCancelable(false);
alert.show();
}
}
}
} | [
"[email protected]"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.