blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 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 684M ⌀ | 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 132 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 28 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1cc5e52dd4e235a95d733d8db787588121950f59 | 5b3ffc791cbd4e7d1d7640ff5efb56ecfe46dcf6 | /src/main/java/dev/klepto/lazyvoids/When.java | ced09ec53c6360f43745ce5243e6a709c6a278f0 | [
"Unlicense"
] | permissive | klepto/lazy-voids | cea30393fc32616791d113d762ef7ea626e211b8 | 9444db27f20c8f08a3acd6a1aa43d1085dd46af3 | refs/heads/master | 2022-08-19T13:57:19.489332 | 2020-05-21T17:22:22 | 2020-05-21T17:22:22 | 265,895,878 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,967 | java | package dev.klepto.lazyvoids;
import lombok.AccessLevel;
import lombok.EqualsAndHashCode;
import lombok.RequiredArgsConstructor;
import java.util.function.Consumer;
import java.util.function.Supplier;
/**
* A key-value pair container object which may or may not contain a non-null value. When enables simplified key-value
* mapping while preserving some of the compile-time type safety provided by more verbose patterns such as using
* {@link java.util.Map}.
*
* <p>If a value is non-null, {@code isPresent()} will return {@code true} and {@code get()} will return the value.
* <p>If a value is null, {@code isEmpty()} will return {@code true} and {@code orElse()} will return the given
* default value.
* <p>Additional methods are included to somewhat resemble functionality of {@link java.util.Optional}.
*
* @author <a href="https://klepto.dev/">Augustinas R.</a>
* @since 0.1
*/
@EqualsAndHashCode
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
public final class When<K, V> {
private final K key;
private final V result;
/**
* Creates a new when mapper for a given key with an empty result.
*
* @param key the key object
* @param <K> the key type for compile-time type safety
* @param <V> the value type for compile-time type safety, ({@link Object} until the first call of
* {@link When#map(Object, Object)}.
* @return a new when mapper for a given key
*/
public static <K, V> When<K, V> when(K key) {
return new When<>(key, null);
}
/**
* Creates a new mapping for key-value pair, if given key equals to key of this container, a new when container
* will be created with given value as the result. Otherwise {@code this} is returned. Using polymorphic value
* types should be avoided, due to how compile time type-inference works, each subsequent call of this method may
* alter the result type when using polymorphic values. If you absolutely need to use polymorphic values you have to
* make sure your last call of this method is done with the super type.
*
* @param key the mapping key
* @param value the mapping value
* @param <T> generic type to infer value type for future calls of this method
* @return this or new when object if key matched the key of this container
*/
@SuppressWarnings("unchecked")
public <T extends V> When<K, T> map(K key, T value) {
if (this.key.equals(key)) {
return new When<>(key, value);
}
return (When<K, T>) this;
}
/**
* Returns true if result value is present, otherwise false.
*
* @return true if result has a non-null value, otherwise false
*/
public boolean isPresent() {
return result != null;
}
/**
* Returns true if result value is not present, otherwise false.
*
* @return true if result has a null value, otherwise false
*/
public boolean isEmpty() {
return !isPresent();
}
/**
* Returns the result value (if key didn't match any mappings, value will be {@code null}).
*
* @return the result value
*/
public V get() {
return result;
}
/**
* If a value is present, performs the given action with the value, otherwise does nothing.
*
* @param action the action to be performed, if a value is present
*/
public void ifPresent(Consumer<? super V> action) {
if (isPresent()) {
action.accept(result);
}
}
/**
* If a value is present, returns the value, otherwise returns other.
*
* @param other the value to be returned, if no value is present (may be {@code null})
* @return the value, if present, otherwise other
*/
public V orElse(V other) {
return isPresent() ? result : other;
}
/**
* If a value is present, returns the value, otherwise returns the result produced by the supplying function.
*
* @param supplier the supplying function that produces a value to be returned
* @return the value, if present, otherwise the result produced by the supplying function
*/
public V orElseGet(Supplier<? extends V> supplier) {
// we don't call orElse because we want supplier to be evaluated lazily
return isPresent() ? result : supplier.get();
}
/**
* If a value is present, returns the value, otherwise throws an throwable produced by the throwable supplying function.
* @param throwableSupplier the supplying function that produces an throwable to be thrown
* @param <X> type of the exception to be thrown
* @return the value, if present
* @throws X if no value is present
*/
public <X extends Throwable> V orElseThrow(Supplier<? extends X> throwableSupplier) throws X {
if (isEmpty()) {
throw throwableSupplier.get();
}
return result;
}
}
| [
"klepto@inbox.lt"
] | klepto@inbox.lt |
b06fd9cfa9a1d1c087be75b46a4252044e3619b3 | 65e17c4f2111559ce06bc9c561824a2af67820bc | /RestGen/examples/Axis1x/CustService/generated/gov/nih/nci/restgen/generated/client/ObjectFactory.java | c6527ebc64c376292eebf8842d0a131df6f0b0ee | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | GothamGeneral/cacore-sdk | 82cac4ccb40ed4d025e4013998c80c56426b3870 | 86f04f3c043f1384af71ad943b0801ff7094aba4 | refs/heads/master | 2021-01-12T14:24:13.593850 | 2016-03-09T18:27:20 | 2016-03-09T18:27:20 | 69,933,063 | 1 | 1 | null | 2016-10-04T04:01:43 | 2016-10-04T04:01:43 | null | UTF-8 | Java | false | false | 4,560 | java | /*L
* Copyright Ekagra Software Technologies Ltd.
* Copyright SAIC, SAIC-Frederick
*
* Distributed under the OSI-approved BSD 3-Clause License.
* See http://ncip.github.com/cacore-sdk/LICENSE.txt for details.
*/
package gov.nih.nci.restgen.generated.client;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlElementDecl;
import javax.xml.bind.annotation.XmlRegistry;
import javax.xml.namespace.QName;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the gov.nih.nci.restgen.generated.client package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
* content can consist of schema derived interfaces
* and classes representing the binding of schema
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*
*/
@XmlRegistry
public class ObjectFactory {
private final static QName _NoSuchCustomer_QNAME = new QName("http://customerservice.example.com/", "NoSuchCustomer");
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: gov.nih.nci.restgen.generated.client
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link DeleteCustomerByIdResponse }
*
*/
public DeleteCustomerByIdResponse createDeleteCustomerByIdResponse() {
return new DeleteCustomerByIdResponse();
}
/**
* Create an instance of {@link AddCustomerResponse }
*
*/
public AddCustomerResponse createAddCustomerResponse() {
return new AddCustomerResponse();
}
/**
* Create an instance of {@link GetCustomerByName }
*
*/
public GetCustomerByName createGetCustomerByName() {
return new GetCustomerByName();
}
/**
* Create an instance of {@link UpdateCustomer }
*
*/
public UpdateCustomer createUpdateCustomer() {
return new UpdateCustomer();
}
/**
* Create an instance of {@link Customer }
*
*/
public Customer createCustomer() {
return new Customer();
}
/**
* Create an instance of {@link GetCustomerByNameResponse }
*
*/
public GetCustomerByNameResponse createGetCustomerByNameResponse() {
return new GetCustomerByNameResponse();
}
/**
* Create an instance of {@link NoSuchCustomer }
*
*/
public NoSuchCustomer createNoSuchCustomer() {
return new NoSuchCustomer();
}
/**
* Create an instance of {@link DeleteCustomerById }
*
*/
public DeleteCustomerById createDeleteCustomerById() {
return new DeleteCustomerById();
}
/**
* Create an instance of {@link GetCustomersResponse }
*
*/
public GetCustomersResponse createGetCustomersResponse() {
return new GetCustomersResponse();
}
/**
* Create an instance of {@link GetCustomers }
*
*/
public GetCustomers createGetCustomers() {
return new GetCustomers();
}
/**
* Create an instance of {@link UpdateCustomerResponse }
*
*/
public UpdateCustomerResponse createUpdateCustomerResponse() {
return new UpdateCustomerResponse();
}
/**
* Create an instance of {@link DeleteCustomerResponse }
*
*/
public DeleteCustomerResponse createDeleteCustomerResponse() {
return new DeleteCustomerResponse();
}
/**
* Create an instance of {@link AddCustomer }
*
*/
public AddCustomer createAddCustomer() {
return new AddCustomer();
}
/**
* Create an instance of {@link DeleteCustomer }
*
*/
public DeleteCustomer createDeleteCustomer() {
return new DeleteCustomer();
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link NoSuchCustomer }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://customerservice.example.com/", name = "NoSuchCustomer")
public JAXBElement<NoSuchCustomer> createNoSuchCustomer(NoSuchCustomer value) {
return new JAXBElement<NoSuchCustomer>(_NoSuchCustomer_QNAME, NoSuchCustomer.class, null, value);
}
}
| [
"prasad.konka@nih.gov"
] | prasad.konka@nih.gov |
0e2bf05124cf5db23f69dadee846d011d355add0 | 569c073d5468431b3dba510bbee60578e020a427 | /app/src/main/java/org/piwigo/internal/di/module/ApiModule.java | 3fac0f282bbe2aa648e2aa2848fc2a5b52632cf6 | [] | no_license | jeff-amn/Piwigo-Android-JCAWork | e43853fa2c7058386ad5d45210ccd9337e932f9f | 1ef2879f10fa767e0cbfc2530f0d81ee27e3f70d | refs/heads/master | 2021-09-24T18:54:47.199656 | 2017-10-01T19:38:57 | 2017-10-01T19:38:57 | 104,969,642 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,000 | java | /*
* Copyright 2015 Phil Bayfield https://philio.me
* Copyright 2015 Piwigo Team http://piwigo.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.piwigo.internal.di.module;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.squareup.okhttp.OkHttpClient;
import org.piwigo.BuildConfig;
import org.piwigo.io.DynamicEndpoint;
import org.piwigo.io.RestService;
import org.piwigo.io.Session;
import javax.inject.Named;
import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides;
import retrofit.RequestInterceptor;
import retrofit.RestAdapter;
import retrofit.client.OkClient;
import retrofit.converter.GsonConverter;
import rx.Scheduler;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;
import static retrofit.RestAdapter.LogLevel.FULL;
import static retrofit.RestAdapter.LogLevel.NONE;
@Module
public class ApiModule {
@Provides @Singleton Session provideSession() {
return new Session();
}
@Provides @Singleton DynamicEndpoint provideDynamicEndpoint() {
return new DynamicEndpoint();
}
@Provides @Singleton RequestInterceptor provideRequestInterceptor(Session session) {
return request -> {
request.addQueryParam("format", "json");
if (session.getCookie() != null) {
request.addHeader("Cookie", "pwg_id=" + session.getCookie());
}
};
}
@Provides @Singleton Gson provideGson() {
return new GsonBuilder()
.setDateFormat("yyyy-MM-dd HH:mm:ss")
.create();
}
@Provides @Singleton RestAdapter provideRestAdapter(OkHttpClient client, DynamicEndpoint endpoint, RequestInterceptor interceptor, Gson gson) {
return new RestAdapter.Builder()
.setClient(new OkClient(client))
.setLogLevel(BuildConfig.DEBUG ? FULL : NONE)
.setEndpoint(endpoint)
.setRequestInterceptor(interceptor)
.setConverter(new GsonConverter(gson))
.build();
}
@Provides @Singleton RestService provideRestService(RestAdapter restAdapter) {
return restAdapter.create(RestService.class);
}
@Provides @Singleton @Named("IoScheduler") Scheduler provideIoScheduler() {
return Schedulers.io();
}
@Provides @Singleton @Named("UiScheduler") Scheduler provideUiScheduler() {
return AndroidSchedulers.mainThread();
}
} | [
"jeff-amn@users.noreply.github.com"
] | jeff-amn@users.noreply.github.com |
ec732e873e91497266db55b6688e79dbe29b5b12 | 0b1f4a47230ca0eb36c5f6970648cbd0e8fadba4 | /WS11bSwapping.java | b8b3b50b692e4010dcc23efcaaaf46e251ba556b | [
"MIT"
] | permissive | Guama1239/JavaInputValidation | 1a87f0c6c13b1683423ea3ac998d8b79c838cc43 | 46e38b6997be9f51c427a01a10e0ff5c0014af1d | refs/heads/master | 2020-07-14T02:49:33.044857 | 2019-12-12T18:01:20 | 2019-12-12T18:01:20 | 205,217,883 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 851 | java | //CS 200
//FALL 2019
//LUIS ROSALES
//INSTRUCTOR: Y. GUTSTEIN
//WS 11B
//DUE 12-04-2019
//FILE NAME: WS11bSwapping.java
import java.util.Scanner;
public class WS11bSwapping
{
public static void main (String[] args)
{
Scanner kbd = new Scanner(System.in);
System.out.print("Total numbers to input? ");
int total = kbd.nextInt();
System.out.print("Enter numbers: ");
int[] array = new int[total];
for (int i=0; i < array.length; i++)
array[i] = kbd.nextInt();
array = swapEnds(array);
for (int i = 0; i < array.length; i++)
System.out.print(array[i] + " ");
System.out.println();
}
public static int[] swapEnds(int[]nums)
{
int temp = nums[0];
nums[0] = nums[nums.length-1];
nums[nums.length-1] = temp;
return nums;
}
} | [
"guama1239@gmail.com"
] | guama1239@gmail.com |
2c153252d20f3794bc2e7f1e49e6af016ab4f704 | 77a4eed4b2c4866bfd3956b4e0c420ade50f9351 | /app/src/main/java/com/rha/app/rha/view/activity/IntroActivity.java | c4b4f953b971ac20cfe7f17e5928e4e8a11d33f1 | [] | no_license | manishaprasad38/RHA1 | 9495977e1275f76b7e44557f8f97676399d8c188 | 21f23fd08ddf55840e64dfe4cb76c708fb08defa | refs/heads/master | 2020-04-01T05:10:44.133624 | 2018-12-08T05:40:49 | 2018-12-08T05:40:49 | 152,893,210 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,532 | java | package com.rha.app.rha.view.activity;
import android.app.Activity;
import android.content.Intent;
import android.os.Handler;
import android.support.v4.view.ViewPager;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.LinearLayout;
import com.rha.app.rha.R;
import com.rha.app.rha.view.adapters.ViewPagerAdapter;
import java.util.Timer;
import java.util.TimerTask;
import me.relex.circleindicator.CircleIndicator;
public class IntroActivity extends Activity {
ViewPager viewPager;
ViewPagerAdapter viewPagerAdapter;
private int[] txtHeaders = {R.string.action_headers1,R.string.action_headers2,R.string.action_headers3,
R.string.action_headers4,R.string.action_headers5};
private int[] txtHeadersDesc1 = {R.string.action_headers1_desc1,R.string.action_headers2_desc1,R.string.action_headers3_desc1
,R.string.action_headers4_desc1,R.string.action_headers5_desc1};
private int[] txtHeadersDesc2 = {R.string.action_headers1_desc2,R.string.action_headers2_desc2,R.string.action_headers3_desc2
,R.string.action_headers4_desc2,R.string.action_headers5_desc2};
private int[] txtHeadersDesc3 = {R.string.action_headers1_desc3,R.string.action_headers2_desc3,R.string.action_headers3_desc3
,R.string.action_headers4_desc3,R.string.action_headers5_desc3};
private int[] txtHeadersDesc4 = {R.string.action_headers1_desc4,R.string.action_headers2_desc4,R.string.action_headers4_desc4
,R.string.action_headers4_desc4,R.string.action_headers5_desc4};
private static int currentPage = 0;
private static int NUM_PAGES = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_intro);
viewPager = (ViewPager)findViewById(R.id.pager);
viewPagerAdapter = new ViewPagerAdapter(IntroActivity.this,txtHeaders,txtHeadersDesc1,
txtHeadersDesc2,txtHeadersDesc3,txtHeadersDesc4);
viewPager.setAdapter(viewPagerAdapter);
CircleIndicator indicator = (CircleIndicator) findViewById(R.id.indicator);
indicator.setViewPager(viewPager);
viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageSelected(int position) {
currentPage = position;
}
@Override
public void onPageScrolled(int arg0, float arg1, int arg2) {
// TODO Auto-generated method stub
}
@Override
public void onPageScrollStateChanged(int state) {
if (state == ViewPager.SCROLL_STATE_IDLE) {
int pageCount = txtHeaders.length;
if (currentPage == 0) {
viewPager.setCurrentItem(pageCount - 1, false);
} else if (currentPage == pageCount - 1) {
Intent i = new Intent(getApplicationContext(),LoginActivity.class);
startActivity(i);
finish();
// viewPager.setCurrentItem(0, false);
}
}
}
});
// final Handler handler = new Handler();
// final Runnable update = new Runnable() {
// @Override
// public void run() {
// if (currentPage == NUM_PAGES) {
// currentPage = 0;
// }
// viewPager.setCurrentItem(currentPage++, true);
// }
// };
// Timer swipeTimer = new Timer();
// swipeTimer.schedule(new TimerTask() {
//
// @Override
// public void run() {
// handler.post(update);
// }
// }, 3000, 3000);
indicator.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageSelected(int position) {
currentPage = position;
}
@Override
public void onPageScrolled(int pos, float arg1, int arg2) {
}
@Override
public void onPageScrollStateChanged(int pos) {
}
});
}
} | [
"listen2priya@gmail.com"
] | listen2priya@gmail.com |
f7f53542a11bb4e3c8cb328dc87adea56475cc33 | c4d54f1a461c40811d3f0874959a4971dec5bf4c | /app/src/main/java/com/ruslan_hlushen/cleanroom/receivers/BadAnswerReceiver.java | af4f773cf569f129833b395280efe0501ce90a80 | [] | no_license | ruslanHlushen/CleanRoom | 1260bcd4393038bbc95cdb63a568e6154f545d31 | 4d289600a31283696cee347040e19a39ebc72794 | refs/heads/master | 2021-01-11T22:10:24.027479 | 2017-02-24T22:27:24 | 2017-02-24T22:27:24 | 78,931,743 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 354 | java | package com.ruslan_hlushen.cleanroom.receivers;
import android.content.Context;
import android.content.Intent;
/**
* Created by Руслан on 27.11.2016.
*/
public class BadAnswerReceiver extends ParentAnswerReceiver {
@Override
public void onReceive(Context context, Intent intent) {
myOnReceive(context, intent, false);
}
}
| [
"ruslan_hlushen@mail.ru"
] | ruslan_hlushen@mail.ru |
6376af833347154c6e863ecb5ac47efc46a6991f | 5ca2c8a9e3f334aa70c25c82da55d22cf2bf4caf | /src/main/java/com/tom/util/UrlToImgUtil.java | 00a09719f4b146036fc01cbf7b7fd3f8ccbb0df2 | [] | no_license | RemcoG/TomZnFilmWebsite | 5f95a98615364b4803c0e51c7f530107cf37ebff | 926bab427b899360df2303ca94388939d8b376c0 | refs/heads/master | 2021-01-17T03:08:44.651210 | 2015-09-16T12:33:04 | 2015-09-16T12:33:04 | 42,585,760 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 501 | java | package com.tom.util;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.net.URL;
/**
* Created by Tom on 9-9-2015.
*/
public class UrlToImgUtil {
public static BufferedImage urlToImage(String url){
try {
URL urlImage = new URL(url);
BufferedImage image = ImageIO.read(urlImage);
return image;
} catch (Exception ex) {
ex.printStackTrace();
}
return null;
}
}
| [
"Ih1haNV!"
] | Ih1haNV! |
4d4ff8489f913d70b906c6c91d79f5081e2300d6 | 47070c01274f0133acc48f22a40819b943f828dc | /app/src/main/java/com/example/tianjun/projecttest/SQLite/Baskbar/BaskbarDaoMaster.java | 57247f8c1f88f9e72aa060c55c07bcb44145d1ab | [] | no_license | Summ1995/ProjectTest | d88cd75233ef601caa244ee930b7fd27c6794bb2 | 04f3670374dfc22ef232ae26ebfac0f5937324ba | refs/heads/master | 2020-12-07T10:59:54.256159 | 2016-09-19T02:29:23 | 2016-09-19T02:29:23 | 67,221,580 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,334 | java | package com.example.tianjun.projecttest.SQLite.Baskbar;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.util.Log;
import org.greenrobot.greendao.AbstractDaoMaster;
import org.greenrobot.greendao.database.StandardDatabase;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.database.DatabaseOpenHelper;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* Master of DAO (schema version 1): knows all DAOs.
*/
public class BaskbarDaoMaster extends AbstractDaoMaster {
public static final int SCHEMA_VERSION = 1;
/** Creates underlying database table using DAOs. */
public static void createAllTables(Database db, boolean ifNotExists) {
BaskbarDao.createTable(db, ifNotExists);
}
/** Drops underlying database table using DAOs. */
public static void dropAllTables(Database db, boolean ifExists) {
BaskbarDao.dropTable(db, ifExists);
}
/**
* WARNING: Drops all table on Upgrade! Use only during development.
* Convenience method using a {@link DevOpenHelper}.
*/
public static BaskbarDaoSession newDevSession(Context context, String name) {
Database db = new DevOpenHelper(context, name).getWritableDb();
BaskbarDaoMaster daoMaster = new BaskbarDaoMaster(db);
return daoMaster.newSession();
}
public BaskbarDaoMaster(SQLiteDatabase db) {
this(new StandardDatabase(db));
}
public BaskbarDaoMaster(Database db) {
super(db, SCHEMA_VERSION);
registerDaoClass(BaskbarDao.class);
}
public BaskbarDaoSession newSession() {
return new BaskbarDaoSession(db, IdentityScopeType.Session, daoConfigMap);
}
public BaskbarDaoSession newSession(IdentityScopeType type) {
return new BaskbarDaoSession(db, type, daoConfigMap);
}
/**
* Calls {@link #createAllTables(Database, boolean)} in {@link #onCreate(Database)} -
*/
public static abstract class OpenHelper extends DatabaseOpenHelper {
public OpenHelper(Context context, String name) {
super(context, name, SCHEMA_VERSION);
}
public OpenHelper(Context context, String name, CursorFactory factory) {
super(context, name, factory, SCHEMA_VERSION);
}
@Override
public void onCreate(Database db) {
Log.i("greenDAO", "Creating tables for schema version " + SCHEMA_VERSION);
createAllTables(db, false);
}
}
/** WARNING: Drops all table on Upgrade! Use only during development. */
public static class DevOpenHelper extends OpenHelper {
public DevOpenHelper(Context context, String name) {
super(context, name);
}
public DevOpenHelper(Context context, String name, CursorFactory factory) {
super(context, name, factory);
}
@Override
public void onUpgrade(Database db, int oldVersion, int newVersion) {
Log.i("greenDAO", "Upgrading schema from version " + oldVersion + " to " + newVersion + " by dropping all tables");
dropAllTables(db, true);
onCreate(db);
}
}
}
| [
"1943979275@qq.com"
] | 1943979275@qq.com |
5b42706cebc7f18b824a8f7ab36326c2003a1ada | ecf06a6fc1d7a6557442c807673cbd546bf491a7 | /src/java/jdbc/GenerateReport.java | ae3c3c5ee90e1ffd429d1c564a36fbb41755810f | [] | no_license | praveen7523/Fire_Fitness | c6bd1271a96f085902038242d60ea08cd335a499 | e074533b477cdc52dbcad065aa3c97785e9c5b79 | refs/heads/master | 2023-06-01T17:38:09.749966 | 2020-04-25T15:19:47 | 2020-04-25T15:19:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,806 | java | package jdbc;
import java.sql.*;
import java.util.ArrayList;
import java.util.Date;
public class GenerateReport {
private java.sql.Date date;
private String activity;
private DBConnection db = new DBConnection();
private Connection newCon = null;
//private ArrayList timetable = new ArrayList<>();
private ResultSet result = null;
public GenerateReport() {}
public GenerateReport(java.sql.Date d, String activity) {
this.date = d;
this.activity = activity;
}
public String generateDay() throws ClassNotFoundException, SQLException {
String dayInString = null;
String query = null;
if (db.isConnected()) {
newCon = DBConnection.getCon();
int day = date.getDay();
switch (day) {
case 0 : dayInString = "Sunday";
break;
case 1 : dayInString = "Monday";
break;
case 2 : dayInString = "Tuesday";
break;
case 3 : dayInString = "Wednesday";
break;
case 4 : dayInString = "Thursday";
break;
case 5 : dayInString = "Friday";
break;
case 6 : dayInString = "Saturday";
break;
}
Statement stmt = newCon.createStatement();
if (activity.equalsIgnoreCase("Sport")) {
query = "select * from sports_trainer_schedule where day = '" +dayInString+ "'";
}
else if (activity.equalsIgnoreCase("Gym")) {
query = "select * from trainer_schedule where day = '" +dayInString+ "'";
}
ResultSet rs = stmt.executeQuery(query);
if (rs.next())
return dayInString;
else
return null;
}
else
return null;
}
public ResultSet getTimeTable() throws ClassNotFoundException, SQLException, NoRecordFoundException {
String day = generateDay();
String query = null;
if (db.isConnected()) {
newCon = DBConnection.getCon();
Statement stmt = newCon.createStatement();
if (activity.equalsIgnoreCase("Gym"))
query = "SELECT s.Name, sp.workout_name, sc.start_time, sc.end_time FROM trainer s, trainer_schedule sts, workout sp, schedule sc where s.Trainer_ID = sts.trainer_ID AND sp.workout_ID = s.Specialization AND sts.schedule_ID = sc.schedule_ID AND sts.day = '" +day+ "'";
else if (activity.equalsIgnoreCase("Sport"))
query = "SELECT s.trainer_name, sp.sport_name, sc.start_time, sc.end_time FROM sports_trainer s, sports_trainer_schedule sts, sports sp, schedule sc where s.trainer_ID = sts.trainer_ID AND sp.sport_ID = s.sport AND sts.schedule_ID = sc.schedule_ID AND sts.day = '" +day+ "'";
result = stmt.executeQuery(query);
if (result != null)
return result;
else
throw new NoRecordFoundException();
}
else
return null;
}
public java.sql.Date getSearchDate() {
return this.date;
}
public String getActivity() {
return this.activity;
}
}
| [
"ishanksen@gmail.com"
] | ishanksen@gmail.com |
be0eb6507ef433716791f58cbe119876f7872ad8 | 40619e3443cee989d262011b16d0103058218806 | /heavycenter/src/main/java/com/siweisoft/heavycenter/module/acct/role/RoleFrag.java | 4f949775134462faa4079df49a538c82fb21f959 | [] | no_license | summerviwox/ZX | 227b75a2178bdfef9b97786af4f0fc7db7822591 | fe5bbe8b11f90ac0b154324eef3542ea84784df0 | refs/heads/master | 2020-12-05T10:17:45.665391 | 2020-01-06T10:57:40 | 2020-01-06T10:57:40 | 232,078,243 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,535 | java | package com.siweisoft.heavycenter.module.acct.role;
//by summer on 2017-12-18.
import android.os.Bundle;
import android.view.View;
import com.android.lib.network.news.UINetAdapter;
import com.android.lib.util.IntentUtil;
import com.android.lib.util.ToastUtil;
import com.android.lib.util.fragment.two.FragManager2;
import com.siweisoft.heavycenter.R;
import com.siweisoft.heavycenter.base.AppFrag;
import com.siweisoft.heavycenter.data.locd.LocalValue;
import com.siweisoft.heavycenter.data.netd.acct.login.LoginResBean;
import com.siweisoft.heavycenter.data.netd.user.usertype.UserTypeReqBean;
import com.siweisoft.heavycenter.data.netd.user.usertype.UserTypeResBean;
import com.siweisoft.heavycenter.module.acct.acct.AcctAct;
import com.siweisoft.heavycenter.module.main.main.MainAct;
import butterknife.OnClick;
public class RoleFrag extends AppFrag<RoleUIOpe,RoleDAOpe>{
public static String 直接登录 = "直接登录";
public static RoleFrag getInstance(boolean login){
RoleFrag roleFrag = new RoleFrag();
roleFrag.setArguments(new Bundle());
roleFrag.getArguments().putBoolean(直接登录,login);
return roleFrag;
}
@OnClick({R.id.tv_notdriver,R.id.tv_driver})
public void onClick(final View vv){
super.onClick(vv);
getUI().showTip(R.id.tv_driver==vv.getId(),new View.OnClickListener() {
@Override
public void onClick(final View v) {
switch (v.getId()){
case R.id.tv_sure:
getDE().login(LocalValue.get登录参数(), new UINetAdapter<LoginResBean>(RoleFrag.this,UINetAdapter.Loading) {
@Override
public void onSuccess(LoginResBean o) {
getUI().getUserTypeReqBean().setId(o.getUserId());
getUI().getUserTypeReqBean().setUserType((R.id.tv_driver==vv.getId())?UserTypeReqBean.驾驶员 :UserTypeReqBean.非驾驶员);
LocalValue.save登录返回信息(o);
getDE().setUserType(getUI().getUserTypeReqBean(), new UINetAdapter<UserTypeResBean>(RoleFrag.this,UINetAdapter.Loading) {
@Override
public void onSuccess(UserTypeResBean o) {
ToastUtil.getInstance().showShort(getContext(),"设置用户角色成功");
if(getArguments().getBoolean(直接登录,false)){
LoginResBean resBean = LocalValue.get登录返回信息();
resBean.setUserType((R.id.tv_driver==vv.getId())?UserTypeReqBean.驾驶员 :UserTypeReqBean.非驾驶员);
LocalValue.save登录返回信息(resBean);
IntentUtil.startActivityWithFinish(getBaseUIAct(), MainAct.class,null);
}else{
getBaseUIAct().onBackPressed();
}
}
});
}
});
break;
}
FragManager2.getInstance().setFinishAnim(R.anim.fade_in,R.anim.fade_out).finish(getBaseUIAct(), AcctAct.账号,true);
}
});
}
}
| [
"summernecro@gmail.com"
] | summernecro@gmail.com |
e713369703d13e8150509774d9bb738cba1f8ab3 | 8dcdf1748ac6a0466b933d6f1469a938aab6df54 | /kodilla-good-patterns/src/main/java/com/kodilla/good/patterns/challenges/food2door/HealthyShop.java | 844f3fb35a159d205fd505cc44ac56d75b9fd937 | [] | no_license | brzezyn/modul-6.1 | 600b8e18124bb5e76d03b2d835a360bb10900d6f | fc55458d3167187903c3366d7f159fdcef778dbd | refs/heads/master | 2023-05-04T22:53:22.381410 | 2021-05-25T08:31:52 | 2021-05-25T08:31:52 | 302,575,913 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 297 | java | package com.kodilla.good.patterns.challenges.food2door;
import java.util.Map;
public class HealthyShop implements OrderService {
public boolean process(OrderRequest orderRequest, Map<String, Integer> productsAvailable) {
System.out.println("Process 1");
return true;
}
} | [
"arturitu.xdd@gmail.com"
] | arturitu.xdd@gmail.com |
aaf1ef8f969d2bc2873c16f4b89a411a1ad328b6 | 28b7651affdf2f1c2cacf7e0f7e0f95e514a3de5 | /src/main/java/com/tomgibara/coding/CodedReader.java | c757545c0146b315b668c2fb064212d3b4e84fa4 | [
"Apache-2.0"
] | permissive | lequietriot/coding | c0e640b6f72746ea359e5669fabbbe0c389c1610 | 1ba3b05c7b226f258974af2b931266c7e67fa831 | refs/heads/master | 2022-12-31T21:29:47.397823 | 2016-11-19T12:25:36 | 2016-11-19T12:25:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,205 | java | /*
* Copyright 2011 Tom Gibara
*
* 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.tomgibara.coding;
import java.io.Reader;
import java.math.BigDecimal;
import java.math.BigInteger;
import com.tomgibara.bits.BitReader;
import com.tomgibara.bits.BitStreamException;
/**
* Pairs a {@link Reader} with an {@link ExtendedCoding} to provide a convenient
* way of reading coded data.
*
* @author Tom Gibara
*
*/
public class CodedReader {
// fields
private final BitReader reader;
private final ExtendedCoding coding;
// constructors
/**
* Creates a coded reader.
*
* @param reader
* the reader from which bits will be read
* @param coding
* used to decode the bits into values
*/
public CodedReader(BitReader reader, ExtendedCoding coding) {
if (reader == null) throw new IllegalArgumentException("null reader");
if (coding == null) throw new IllegalArgumentException("null coding");
this.reader = reader;
this.coding = coding;
}
// accessors
/**
* The reader that supplies the bits for the coding.
*
* @return the bit reader
*/
public BitReader getReader() {
return reader;
}
/**
* The coding that decodes the bits.
*
* @return the coding
*/
public ExtendedCoding getCoding() {
return coding;
}
// methods
/**
* Decodes a positive integer from the reader.
*
* @return an integer greater than or equal to zero
* @throws BitStreamException
* if there was a problem reading bits from the stream
*/
public int readPositiveInt() {
return coding.decodePositiveInt(reader);
}
/**
* Decodes a positive long from the reader.
*
* @return a long greater than or equal to zero
* @throws BitStreamException
* if there was a problem reading bits from the stream
*/
public long readPositiveLong() {
return coding.decodePositiveLong(reader);
}
/**
* Decodes a positive BigInteger from the reader.
*
* @return a BigInteger greater than or equal to zero
* @throws BitStreamException
* if there was a problem reading bits from the stream
*/
public BigInteger readPositiveBigInt() {
return coding.decodePositiveBigInt(reader);
}
/**
* Decodes an integer from the reader.
*
* @return an integer
* @throws BitStreamException
* if there was a problem reading bits from the stream
*/
public int readInt() {
return coding.decodeInt(reader);
}
/**
* Decodes a long from the reader.
*
* @return a long
* @throws BitStreamException
* if there was a problem reading bits from the stream
*/
public long readLong() {
return coding.decodeLong(reader);
}
/**
* Decodes a BigInteger from the reader.
*
* @return a BigInteger
* @throws BitStreamException
* if there was a problem reading bits from the stream
*/
public BigInteger readBigInt() {
return coding.decodeBigInt(reader);
}
/**
* Decodes a float from the reader.
*
* @return a float
* @throws BitStreamException
* if there was a problem reading bits from the stream
*/
public float readFloat() {
return coding.decodeFloat(reader);
}
/**
* Decodes a double from the reader.
*
* @return a double
* @throws BitStreamException
* if there was a problem reading bits from the stream
*/
public double readDouble() {
return coding.decodeDouble(reader);
}
/**
* Decodes a BigDecimal from the reader.
*
* @return a BigDecimal
* @throws BitStreamException
* if there was a problem reading bits from the stream
*/
public BigDecimal readDecimal() {
return coding.decodeDecimal(reader);
}
}
| [
"me@tomgibara.com"
] | me@tomgibara.com |
1a49491f79f27534e1e4b85a35bdcd6e6d6a1616 | 34f8d4ba30242a7045c689768c3472b7af80909c | /JDK10-Java SE Development Kit 10/src/jdk.internal.vm.compiler/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotLoweringProvider.java | faf15014b895cf3cd34ccbb6a39e10b94c83f134 | [
"Apache-2.0"
] | permissive | lovelycheng/JDK | 5b4cc07546f0dbfad15c46d427cae06ef282ef79 | 19a6c71e52f3ecd74e4a66be5d0d552ce7175531 | refs/heads/master | 2023-04-08T11:36:22.073953 | 2022-09-04T01:53:09 | 2022-09-04T01:53:09 | 227,544,567 | 0 | 0 | null | 2019-12-12T07:18:30 | 2019-12-12T07:18:29 | null | UTF-8 | Java | false | false | 751 | java | /*
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package org.graalvm.compiler.hotspot.meta;
import org.graalvm.compiler.debug.DebugHandlersFactory;
import org.graalvm.compiler.hotspot.GraalHotSpotVMConfig;
import org.graalvm.compiler.nodes.spi.LoweringProvider;
import org.graalvm.compiler.options.OptionValues;
/**
* HotSpot implementation of {@link LoweringProvider}.
*/
public interface HotSpotLoweringProvider extends LoweringProvider {
void initialize(OptionValues options, Iterable<DebugHandlersFactory> factories, HotSpotProviders providers, GraalHotSpotVMConfig config);
}
| [
"zeng-dream@live.com"
] | zeng-dream@live.com |
cbf1fc76baab6afb829970f289c99a98dc66d5ae | 6c4b3ce3e12c5a8ceda91006dfaceddbcd5908aa | /com/afrisoftech/hospital/CreditFinalInPatientlnvPdf.java | 96f032532cda0b387a442ebbf6a454466604d7de | [] | no_license | josefloso/FunsoftHMIS | a34bcc6f88c15e85069804814ecef1f9738d7576 | 0ba481260737382e57ac2c674acd03e00e9dde90 | refs/heads/master | 2021-01-15T22:20:32.504511 | 2015-12-01T07:02:42 | 2015-12-01T07:02:42 | 50,920,224 | 1 | 0 | null | 2016-02-02T12:49:53 | 2016-02-02T12:49:53 | null | UTF-8 | Java | false | false | 42,538 | java |
//Author Charles Waweru
//Made to test Java support for Threads.
//Revision : Ver 1.0a
//import java.lang.*;
package com.afrisoftech.hospital;
import java.awt.Point;
import java.awt.Color;
import java.io.FileOutputStream;
import java.io.IOException;
import com.lowagie.text.*;
import com.lowagie.text.pdf.PdfWriter;
import com.lowagie.text.pdf.*;
public class CreditFinalInPatientlnvPdf implements java.lang.Runnable {
java.lang.String MNo = null;
com.afrisoftech.lib.DBObject dbObject;
java.util.Date beginDate = null;
java.lang.String endDate = null;
double osBalance = 0.00;
double osBalance1 = 0.00;
double current = 0.00;
public static java.sql.Connection connectDB = null;
public java.lang.String dbUserName = null;
org.netbeans.lib.sql.pool.PooledConnectionSource pConnDB = null;
boolean threadCheck = true;
// java.lang.String memNo2Use = null;
java.lang.Thread threadSample;
com.lowagie.text.Font pFontHeader = FontFactory.getFont(FontFactory.HELVETICA, 8, Font.NORMAL);
com.lowagie.text.Font pFontHeader1 = FontFactory.getFont(FontFactory.HELVETICA, 9, Font.BOLD);
// com.lowagie.text.ParagraphFont pgraph = Paragraph();
com.lowagie.text.Font pFontHeader11 = FontFactory.getFont(FontFactory.HELVETICA, 10, Font.BOLD);
java.lang.Runtime rtThreadSample = java.lang.Runtime.getRuntime();
java.lang.Process prThread;
public void CreditFinalInPatientInvPdf(java.sql.Connection connDb, java.lang.String combox) {
MNo = combox;
//beginDate = begindate;
connectDB = connDb;
dbObject = new com.afrisoftech.lib.DBObject();
// beginDate = begindate;
// endDate = endate;
threadSample = new java.lang.Thread(this,"SampleThread");
System.out.println("threadSample created");
threadSample.start();
System.out.println("threadSample fired");
}
public static void main(java.lang.String[] args) {
// new MemberStatementPdf().MemberStatementPdf(args[0]);
}
public void run() {
System.out.println("System has entered running mode");
while (threadCheck) {
System.out.println("O.K. see how we execute target program");
this.generatePdf(MNo);
try {
System.out.println("Right, let's wait for task to complete of fail");
java.lang.Thread.currentThread().sleep(100);
System.out.println("It's time for us threads to get back to work after the nap");
} catch(java.lang.InterruptedException IntExec) {
System.out.println(IntExec.getMessage());
}
threadCheck = false;
System.out.println("We shall be lucky to get back to start in one piece");
}
if (!threadCheck) {
Thread.currentThread().stop();
}
}
public java.lang.String getDateLable() {
java.lang.String date_label = null;
java.lang.String month_now_strs = null;
java.lang.String date_now_strs = null;
java.lang.String year_now_strs = null;
java.lang.String minute_now_strs = null;
java.lang.String hour_now_strs = null;
java.lang.Runtime rt = java.lang.Runtime.getRuntime();
java.util.Calendar calinst = java.util.Calendar.getInstance();
java.util.Date date_now = calinst.getTime();
int date_now_str = date_now.getDate();
int month_now_str = date_now.getMonth();
int year_now_str = date_now.getYear();
int hour_now_str = date_now.getHours();
int minute_now_str = date_now.getMinutes();
int year_now_abs = year_now_str - 100;
if (year_now_abs < 10) {
year_now_strs = "200"+year_now_abs;
} else {
year_now_strs = "20"+year_now_abs;
}
switch (month_now_str) {
case 0 : month_now_strs = "JAN";
break;
case 1 : month_now_strs = "FEB";
break;
case 2 : month_now_strs = "MAR";
break;
case 3 : month_now_strs = "APR";
break;
case 4 : month_now_strs = "MAY";
break;
case 5 : month_now_strs = "JUN";
break;
case 6 : month_now_strs = "JUL";
break;
case 7 : month_now_strs = "AUG";
break;
case 8 : month_now_strs = "SEP";
break;
case 9 : month_now_strs = "OCT";
break;
case 10 : month_now_strs = "NOV";
break;
case 11 : month_now_strs = "DEC";
break;
default : if (month_now_str < 10){
month_now_strs = "0"+month_now_str;
} else {
month_now_strs = ""+month_now_str;
}
}
if (date_now_str < 10) {
date_now_strs = "0"+date_now_str;
} else {
date_now_strs = ""+date_now_str;
}
if (minute_now_str < 10) {
minute_now_strs = "0"+minute_now_str;
} else {
minute_now_strs = ""+minute_now_str;
}
if (hour_now_str < 10) {
hour_now_strs = "0"+hour_now_str;
} else {
hour_now_strs = ""+hour_now_str;
}
date_label = date_now_strs+month_now_strs+year_now_strs+"@"+hour_now_strs+minute_now_strs;
return date_label;
}
public void generatePdf(java.lang.String memNo) {
java.lang.Process wait_for_Pdf2Show;
java.util.Calendar cal = java.util.Calendar.getInstance();
java.util.Date dateStampPdf = cal.getTime();
java.lang.String pdfDateStamp = dateStampPdf.toString();
try {
java.io.File tempFile = java.io.File.createTempFile("REP"+this.getDateLable()+"_", ".pdf");
tempFile.deleteOnExit();
java.lang.Runtime rt = java.lang.Runtime.getRuntime();
java.lang.String debitTotal = null;
java.lang.String creditTotal = null;
com.lowagie.text.Document docPdf = new com.lowagie.text.Document();
try {
try {
com.lowagie.text.pdf.PdfWriter.getInstance(docPdf, new java.io.FileOutputStream(tempFile));
String compName = null;
String date = null;
String Messg = null;
try {
java.sql.Statement st31 = connectDB.createStatement();
// java.sql.Statement st4 = connectDB.createStatement();
java.sql.ResultSet rset2 = st31.executeQuery("select name from pb_notice");
// java.sql.ResultSet rset2 = st3.executeQuery("SELECT hospital_name from pb_hospitalprofile");
// java.sql.ResultSet rset4 = st4.executeQuery("SELECT date('now') as Date");
while(rset2.next()){
Messg = rset2.getString(1);
}
com.lowagie.text.HeaderFooter footer = new com.lowagie.text.HeaderFooter(new Phrase(""+Messg+""),false);// FontFactory.getFont(com.lowagie.text.FontFactory.HELVETICA, 14, Font.BOLDITALIC,java.awt.Color.blue)));
// com.lowagie.text.HeaderFooter headerFoter = new com.lowagie.text.HeaderFooter(new Phrase(""+compName+""),false);// FontFactory.getFont(com.lowagie.text.FontFactory.HELVETICA, 14, Font.BOLDITALIC,java.awt.Color.blue)));
// headerFoter.ALIGN_CENTER;
// headerFoter.setRight(5);
docPdf.setFooter(footer);
} catch(java.sql.SQLException SqlExec) {
javax.swing.JOptionPane.showMessageDialog(new javax.swing.JFrame(), SqlExec.getMessage());
}
docPdf.open();
try {
java.util.Calendar calendar = java.util.Calendar.getInstance();
long dateNow = calendar.getTimeInMillis();
java.sql.Date datenowSql= new java.sql.Date(dateNow);
System.out.println(datenowSql.toString());
// java.lang.Object listofStaffNos[] = this.getListofStaffNos();
com.lowagie.text.pdf.PdfPTable table1 = new com.lowagie.text.pdf.PdfPTable(6);
// com.lowagie.text.Table table = new com.lowagie.text.Table(7);
// table.endHeaders();
int headerwidths[] = {15,15,30,15,15,15};
table1.setWidths(headerwidths);
// if (docPdf.getPageNumber() > 1) {
// table1.setHeaderRows(4);
// }
table1.setWidthPercentage((100));
table1.getDefaultCell().setBorder(Rectangle.BOTTOM);
table1.getDefaultCell().setColspan(6);
Phrase phrase = new Phrase();
Phrase phrase1 = new Phrase();
Phrase phrase2 = new Phrase();
Phrase phrase3 = new Phrase();
Phrase phrase4 = new Phrase();
Phrase phrase5 = new Phrase();
Phrase phrase6 = new Phrase();
Phrase phrase7 = new Phrase();
Phrase phrase8 = new Phrase();
Phrase phrase9 = new Phrase();
Phrase phrase10 = new Phrase();
Phrase phrase11 = new Phrase();
// table.addCell(phrase);
//table1.getDefaultCell().setColspan(1);
//table1.getDefaultCell().setBackgroundColor(java.awt.Color.WHITE);
//table1.getDefaultCell().setBorderColor(java.awt.Color.WHITE);
table1.getDefaultCell().setBorderColor(java.awt.Color.BLACK);
try {
java.sql.Statement stc = connectDB.createStatement();
java.sql.Statement stb = connectDB.createStatement();
java.sql.Statement sta = connectDB.createStatement();
java.sql.Statement st3 = connectDB.createStatement();
java.sql.Statement st22 = connectDB.createStatement();
java.sql.Statement st = connectDB.createStatement();
java.sql.Statement st32 = connectDB.createStatement();
java.sql.Statement std = connectDB.createStatement();
java.sql.Statement st321 = connectDB.createStatement();
java.sql.ResultSet rset3 = st321.executeQuery("select header_name from pb_header");
while (rset3.next()){
table1.getDefaultCell().setColspan(6);
table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_CENTER);
phrase = new Phrase(rset3.getObject(1).toString(), pFontHeader11);
table1.addCell(phrase);
}
java.sql.ResultSet rsetc = stc.executeQuery("select distinct adm_date from hp_inpatient_register hr,hp_patient_card pc where pc.patient_no = hr.patient_no and pc.reference = '"+memNo+"'");
java.sql.ResultSet rsetb = stb.executeQuery("select distinct (hr.discharge_date - hr.adm_date),hr.account_no, hr.discharge_date from hp_inpatient_register hr,hp_patient_card pc where pc.patient_no = hr.patient_no and pc.reference = '"+memNo+"'");
java.sql.ResultSet rseta = sta.executeQuery("select distinct ad.ward,ad.bed_no,ad.doctor from hp_admission ad,hp_patient_card pr where pr.reference = '"+memNo+"' and pr.patient_no = ad.patient_no");
java.sql.ResultSet rset = st.executeQuery("select distinct pr.patient_no,initcap(pr.first_name||' '||pr.second_name||' '||pr.last_name),pr.address,pr.residence,pr.tel_no,pr.payer,pr.description,pr.category from hp_inpatient_register pr,hp_patient_card ac where ac.reference = '"+memNo+"' and ac.patient_no = pr.patient_no");
table1.getDefaultCell().setBorderColor(java.awt.Color.WHITE);
table1.getDefaultCell().setColspan(6);
table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_CENTER);
phrase = new Phrase("CREDIT NOTE", pFontHeader1);
table1.addCell(phrase);
table1.getDefaultCell().setBorder(Rectangle.BOTTOM);
table1.getDefaultCell().setBorderColor(java.awt.Color.WHITE);
while (rset.next()){
table1.getDefaultCell().setColspan(3);
table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
phrase = new Phrase("Payer : "+dbObject.getDBObject(rset.getObject(6), "-"), pFontHeader1);
table1.addCell(phrase);
table1.getDefaultCell().setColspan(3);
table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
phrase1 = new Phrase("Scheme Name : "+dbObject.getDBObject(rset.getObject(7), "-"), pFontHeader1);
//table1.addCell(phrase);
table1.getDefaultCell().setColspan(3);
table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
phrase2 = new Phrase("Patient No: "+dbObject.getDBObject(rset.getObject(1), "-"), pFontHeader1);
//table1.addCell(phrase);
table1.getDefaultCell().setColspan(3);
table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
phrase3 = new Phrase("Patient Name: "+dbObject.getDBObject(rset.getObject(2), "-"), pFontHeader1);
//table1.addCell(phrase);
}
while (rseta.next()){
table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
phrase = new Phrase("CR Note No.: "+memNo, pFontHeader1);
table1.addCell(phrase);
table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
phrase4 = new Phrase("Member Name: " , pFontHeader1);
//table1.addCell(phrase);
// while (rseta.next())
table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
phrase5 = new Phrase("Ward: "+dbObject.getDBObject(rseta.getObject(1), "-"), pFontHeader1);
//table1.addCell(phrase);
//while (rseta.next())
table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
phrase6 = new Phrase("Bed No: "+dbObject.getDBObject(rseta.getObject(2), "-"), pFontHeader1);
// table1.addCell(phrase);
table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
phrase9 = new Phrase("Doctor: "+dbObject.getDBObject(rseta.getObject(3), "-"), pFontHeader1);
// table1.addCell(phrase);
}
// while (rseta.next())
// table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
// phrase = new Phrase("Doctor: "+dbObject.getDBObject(rseta.getObject(3), "-"), pFontHeader1);
// table1.addCell(phrase);
table1.getDefaultCell().setColspan(3);
table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
// phrase = new Phrase("Scheme Name : "+dbObject.getDBObject(rset.getObject(7), "-"), pFontHeader1);
table1.addCell(phrase1);
table1.getDefaultCell().setColspan(3);
table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
// phrase = new Phrase("Patient No: "+dbObject.getDBObject(rset.getObject(1), "-"), pFontHeader1);
table1.addCell(phrase2);
while (rsetb.next()){
table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
phrase = new Phrase("Member No.: "+dbObject.getDBObject(rsetb.getObject(2), "-"), pFontHeader1);
table1.addCell(phrase);
table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
phrase7 = new Phrase("Discharge Date: "+dbObject.getDBObject(rsetb.getObject(3), "-"), pFontHeader1);
// table1.addCell(phrase);
// if(rsetc.getBoolean(1) == true){
table1.getDefaultCell().setColspan(6);
// while (rsetb.next()){
table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
phrase8 = new Phrase("No.of Days : "+dbObject.getDBObject(rsetb.getObject(1), "-"), pFontHeader1);
// table1.addCell(phrase);
}
// while (rset.next()){
table1.getDefaultCell().setColspan(3);
table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
// phrase = new Phrase("Patient Name: "+dbObject.getDBObject(rset.getObject(2), "-"), pFontHeader1);
table1.addCell(phrase3);
// }
// while (rseta.next()){
// while (rseta.next())
table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
// phrase = new Phrase("Ward: "+dbObject.getDBObject(rseta.getObject(1), "-"), pFontHeader1);
table1.addCell(phrase4);
//while (rseta.next())
table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
// phrase = new Phrase("Bed No: "+dbObject.getDBObject(rseta.getObject(2), "-"), pFontHeader1);
table1.addCell(phrase5);
// while (rseta.next())
table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
//phrase = new Phrase("Doctor: "+dbObject.getDBObject(rseta.getObject(3), "-"), pFontHeader1);
table1.addCell(phrase6);
table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
//phrase = new Phrase("Doctor: "+dbObject.getDBObject(rseta.getObject(3), "-"), pFontHeader1);
table1.addCell(phrase9);
while (rsetc.next()){
table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
phrase = new Phrase("Adm Date: "+dbObject.getDBObject(rsetc.getObject(1), "-"), pFontHeader1);
table1.addCell(phrase);
}
// while (rsetb.next()){
table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
// phrase = new Phrase("Discharge Date: "+dbObject.getDBObject(rsetb.getObject(3), "-"), pFontHeader1);
table1.addCell(phrase7);
// if(rsetc.getBoolean(1) == true){
table1.getDefaultCell().setColspan(6);
// while (rsetb.next()){
table1.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
// phrase = new Phrase("No.of Days : "+dbObject.getDBObject(rsetb.getObject(1), "-"), pFontHeader1);
table1.addCell(phrase8);
//}
} catch(java.sql.SQLException SqlExec) {
javax.swing.JOptionPane.showMessageDialog(new javax.swing.JFrame(), SqlExec.getMessage());
}
docPdf.add(table1);
} catch(com.lowagie.text.BadElementException BadElExec) {
javax.swing.JOptionPane.showMessageDialog(new javax.swing.JFrame(), BadElExec.getMessage());
}
try {
com.lowagie.text.pdf.PdfPTable table = new com.lowagie.text.pdf.PdfPTable(6);
int headerwidths[] = {25,25,20,15,15,15};
table.setWidths(headerwidths);
table.setHeaderRows(1);
table.setWidthPercentage((100));
table.getDefaultCell().setBorder(Rectangle.BOTTOM);
table.getDefaultCell().setColspan(6);
Phrase phrase = new Phrase();
// table.addCell(phrase);
table.getDefaultCell().setColspan(1);
table.getDefaultCell().setBackgroundColor(java.awt.Color.WHITE);
table.getDefaultCell().setBorderColor(java.awt.Color.WHITE);
try {
java.sql.Statement st11 = connectDB.createStatement();
java.sql.Statement st21 = connectDB.createStatement();
java.sql.Statement st1 = connectDB.createStatement();
java.sql.Statement st2 = connectDB.createStatement();
// }
java.sql.ResultSet rset1 = st1.executeQuery(" select date::date,initcap(service) as service,dosage,invoice_no,credit-debit from hp_patient_card where reference = '"+memNo+"' and paid = 'true' and service != 'N.H.I.F' AND service not ilike 'Receipt' AND service != 'Invoice' order by date::date");// union select date::date,initcap(service) as service,dosage,reference,credit from hp_patient_card where patient_no = '"+memNo+"' and credit > 0 order by date");
java.sql.ResultSet rsetTotals = st2.executeQuery("select sum(credit) from hp_patient_card where reference = '"+memNo+"' and service != 'N.H.I.F' and service not ilike 'Receipt' and paid = 'true' and service != 'Invoice'");
java.sql.ResultSet rset11 = st11.executeQuery(" select date::date,initcap(service) as service,dosage,invoice_no,credit from hp_patient_card where reference = '"+memNo+"' AND (service = 'N.H.I.F' OR service ilike 'Receipt') order by date::date");// union select date::date,initcap(service) as service,dosage,reference,credit from hp_patient_card where patient_no = '"+memNo+"' and credit > 0 order by date");
java.sql.ResultSet rsetTotals1 = st21.executeQuery("select sum(credit) from hp_patient_card where reference = '"+memNo+"' and (service = 'N.H.I.F' OR service ilike 'Receipt')");
table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
table.getDefaultCell().setBorderColor(java.awt.Color.BLACK);
table.getDefaultCell().setBorderWidth(Rectangle.TOP);
table.getDefaultCell().setColspan(1);
phrase = new Phrase("Date",pFontHeader1);
table.addCell(phrase);
table.getDefaultCell().setColspan(1);
phrase = new Phrase("Description",pFontHeader1);
table.addCell(phrase);
table.getDefaultCell().setColspan(1);
phrase = new Phrase("Qty",pFontHeader1);
table.addCell(phrase);
table.getDefaultCell().setColspan(1);
phrase = new Phrase("Ref",pFontHeader1);
table.addCell(phrase);
table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_RIGHT);
table.getDefaultCell().setColspan(1);
phrase = new Phrase("Amt. KShs",pFontHeader1);
table.addCell(phrase);
phrase = new Phrase("Bal. KShs",pFontHeader1);
table.addCell(phrase);
while (rset1.next()){
table.getDefaultCell().setColspan(1);
table.getDefaultCell().setBorderColor(java.awt.Color.WHITE);
table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
phrase = new Phrase(dbObject.getDBObject(rset1.getObject(1), "-"), pFontHeader);
table.addCell(phrase);
table.getDefaultCell().setColspan(1);
table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
phrase = new Phrase(dbObject.getDBObject(rset1.getObject(2), "-"), pFontHeader);
table.addCell(phrase);
table.getDefaultCell().setColspan(1);
table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
phrase = new Phrase(dbObject.getDBObject(rset1.getObject(3), "-"), pFontHeader);
table.addCell(phrase);
table.getDefaultCell().setColspan(1);
table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
phrase = new Phrase(dbObject.getDBObject(rset1.getObject(4), "-"), pFontHeader);
table.addCell(phrase);
table.getDefaultCell().setColspan(1);
table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_RIGHT);
phrase = new Phrase(new com.afrisoftech.sys.Format2Currency().Format2Currency(rset1.getString(5)),pFontHeader);
table.addCell(phrase);
osBalance = osBalance + rset1.getDouble(5);
phrase = new Phrase(new com.afrisoftech.sys.Format2Currency().Format2Currency(java.lang.String.valueOf(osBalance)), pFontHeader);
// current = current + osBalance;
table.addCell(phrase);
}
table.getDefaultCell().setBorderColor(java.awt.Color.BLACK);
table.getDefaultCell().setBorder(Rectangle.BOTTOM | Rectangle.TOP);
while (rsetTotals.next()) {
table.getDefaultCell().setColspan(3);
table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
phrase = new Phrase("Total", pFontHeader1);
table.addCell(phrase);
table.getDefaultCell().setColspan(3);
table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_RIGHT);
phrase = new Phrase(new com.afrisoftech.sys.Format2Currency().Format2Currency(rsetTotals.getString(1)),pFontHeader);
// table.addCell(phrase);
phrase = new Phrase(new com.afrisoftech.sys.Format2Currency().Format2Currency(java.lang.String.valueOf(osBalance)), pFontHeader1);
table.addCell(phrase);
//phrase = new Phrase(" ");
}
while (rset11.next()){
table.getDefaultCell().setColspan(1);
table.getDefaultCell().setBorderColor(java.awt.Color.WHITE);
table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
phrase = new Phrase(dbObject.getDBObject(rset11.getObject(1), "-"), pFontHeader);
table.addCell(phrase);
table.getDefaultCell().setColspan(1);
table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
phrase = new Phrase(dbObject.getDBObject(rset11.getObject(2), "-"), pFontHeader);
table.addCell(phrase);
table.getDefaultCell().setColspan(1);
table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
phrase = new Phrase(" ", pFontHeader);
table.addCell(phrase);
table.getDefaultCell().setColspan(1);
table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
phrase = new Phrase(dbObject.getDBObject(rset11.getObject(4), "-"), pFontHeader);
table.addCell(phrase);
table.getDefaultCell().setColspan(1);
table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_RIGHT);
phrase = new Phrase(new com.afrisoftech.sys.Format2Currency().Format2Currency(rset11.getString(5)),pFontHeader);
table.addCell(phrase);
osBalance1 = osBalance1 + rset11.getDouble(5);
phrase = new Phrase(new com.afrisoftech.sys.Format2Currency().Format2Currency(java.lang.String.valueOf(osBalance1)), pFontHeader);
// current = current + osBalance;
table.addCell(phrase);
}
table.getDefaultCell().setBorderColor(java.awt.Color.BLACK);
table.getDefaultCell().setBorder(Rectangle.BOTTOM | Rectangle.TOP);
/* while (rsetTotals1.next()) {
table.getDefaultCell().setColspan(2);
table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
phrase = new Phrase(" ", pFontHeader);
table.addCell(phrase);
table.getDefaultCell().setColspan(2);
table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
phrase = new Phrase("Total Receipts", pFontHeader1);
table.addCell(phrase);
table.getDefaultCell().setColspan(2);
table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_RIGHT);
phrase = new Phrase(new com.afrisoftech.sys.Format2Currency().Format2Currency(rsetTotals1.getString(1)),pFontHeader);
//table.addCell(phrase);
phrase = new Phrase(new com.afrisoftech.sys.Format2Currency().Format2Currency(java.lang.String.valueOf(osBalance1)), pFontHeader1);
table.addCell(phrase);
//phrase = new Phrase(" ");
}
// while (rsetTotals.next()) {
table.getDefaultCell().setBorderColor(java.awt.Color.BLACK);
table.getDefaultCell().setBorder(Rectangle.BOTTOM | Rectangle.TOP);
table.getDefaultCell().setColspan(2);
table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
phrase = new Phrase(" ", pFontHeader);
table.addCell(phrase);
table.getDefaultCell().setColspan(2);
table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
phrase = new Phrase("Net Amount", pFontHeader1);
table.addCell(phrase);
table.getDefaultCell().setColspan(2);
table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_RIGHT);
// phrase = new Phrase(new com.afrisoftech.sys.Format2Currency().Format2Currency(rsetTotals.getString(1)),pFontHeader);
// table.addCell(phrase);
phrase = new Phrase(new com.afrisoftech.sys.Format2Currency().Format2Currency(java.lang.String.valueOf(osBalance - osBalance1)), pFontHeader1);
table.addCell(phrase);
//phrase = new Phrase(" ");
*/
// }
docPdf.add(table);
} catch(java.sql.SQLException SqlExec) {
javax.swing.JOptionPane.showMessageDialog(new javax.swing.JFrame(), SqlExec.getMessage());
}
// }
} catch(com.lowagie.text.BadElementException BadElExec) {
javax.swing.JOptionPane.showMessageDialog(new javax.swing.JFrame(), BadElExec.getMessage());
}
} catch(java.io.FileNotFoundException fnfExec) {
javax.swing.JOptionPane.showMessageDialog(new javax.swing.JFrame(), fnfExec.getMessage());
}
} catch(com.lowagie.text.DocumentException lwDocexec) {
javax.swing.JOptionPane.showMessageDialog(new javax.swing.JFrame(), lwDocexec.getMessage());
}
docPdf.close(); com.afrisoftech.lib.PDFRenderer.renderPDF(tempFile);
} catch(java.io.IOException IOexec) {
javax.swing.JOptionPane.showMessageDialog(new javax.swing.JFrame(), IOexec.getMessage());
}
}
}
| [
"Charles@Funsoft"
] | Charles@Funsoft |
5e799ddc2fb9993b4cb9db98576076f3ce27f28a | 1067224e87046fe0d0138ec24ad210c4d0338cb8 | /InterviewQuestions/HashMap/src/hashmap/HashTable.java | 55ec2c4b6a09afcfcd998786172a0fdbaec7d9ea | [] | no_license | lovelylavs/InterviewQuestions | f021339dd0338bbad3cb82bb90e34877f6086dee | aa932f85d82e387707f8d3d22892ba5efa52124c | refs/heads/master | 2021-01-10T07:38:04.005810 | 2020-05-15T06:50:28 | 2020-05-15T06:50:28 | 45,262,671 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,263 | 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 hashmap;
/**
*
* @author Lavanya
*/
public class HashTable
{
private Item[] data;
private int capacity;
private int size;
private static final Item AVAILABLE = new Item("Available",null);
public HashTable(int capacity)
{
this.capacity = capacity;
data = new Item[capacity];
for(int i=0;i<data.length;i++)
{
data[i]=AVAILABLE;
}
size = 0;
}
public int size()
{
return size;
}
public int hashThis(String key)
{
return key.hashCode() % capacity;//hashCode returns a hash code for this string
}
public Object get(String key)
{
int hash = hashThis(key);
while(data[hash] != AVAILABLE && (!data[hash].getKey().equals(key)))
{
hash = (hash +1) % capacity;
}
return data[hash].getElement();
}
public void put(String key,Object element)
{
if(key!= null)
{
size++;
int hash = hashThis(key);
while(data[hash] != AVAILABLE && (!data[hash].getKey().equals(key)))
{
hash = (hash +1) % capacity;
}
data[hash] = new Item(key,element);
}
}
public Object remove(String key)
{
throw new UnsupportedOperationException("Can't remove");
}
public String toString()
{
String s = "<HashTable[";
for(int i =0;i<this.capacity ; i++)
{
if(data[i].getElement() != null)
{
s += data[i].toString();
if(i<this.size -1)
{
s+=",";
}
}
}
s += "]>";
return s;
}
public static void main(String args[])
{
HashTable hm = new HashTable(5);
hm.put("1", "a");
String x = hm.toString();
System.out.println(x);
hm.put("2","b");
String y = hm.toString();
System.out.println(y);
}
}
| [
"lxn130730@utdallas.edu"
] | lxn130730@utdallas.edu |
ae851313f440ce57fc1911b2647a5ebec53bc4bb | 5336396efa4e9fa77e8052ec5dc98ab9af85b783 | /app/src/main/java/me/uptop/mvpgoodpractice/data/network/RestService.java | f7e45cd42fa87e13195d860102c6f76b6f740120 | [] | no_license | posix-dev/Shop | 948a0d6b01feba1a8ecaf4a6af29224cdb22f404 | d35e0df1208ed4f17d6aa9ef1328c6296580c0d0 | refs/heads/master | 2021-06-15T02:37:11.397841 | 2017-04-01T08:10:26 | 2017-04-01T08:10:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,366 | java | package me.uptop.mvpgoodpractice.data.network;
import java.util.List;
import me.uptop.mvpgoodpractice.data.network.req.UserLoginReq;
import me.uptop.mvpgoodpractice.data.network.res.AvatarUrlRes;
import me.uptop.mvpgoodpractice.data.network.res.ProductRes;
import me.uptop.mvpgoodpractice.data.network.res.UserRes;
import me.uptop.mvpgoodpractice.data.network.res.models.AddCommentRes;
import me.uptop.mvpgoodpractice.data.network.res.models.Comments;
import me.uptop.mvpgoodpractice.utils.ConstantManager;
import okhttp3.MultipartBody;
import retrofit2.Response;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.Path;
import rx.Observable;
public interface RestService {
@GET("products")
Observable<Response<List<ProductRes>>> getProductResObs (@Header(ConstantManager.IF_MODIFIED_SINCE_HEADER) String lastEntityUpdate);
@POST("products/{id}/comments")
Observable<Comments> sendCommentToServer(@Path("id") String id,
@Body AddCommentRes post);
@Multipart
@POST("avatar")
Observable<AvatarUrlRes> uploadUserAvatar(@Part MultipartBody.Part file);
@POST("login")
Observable<Response<UserRes>> loginUser(@Body UserLoginReq userLoginReq);
}
| [
"pashko00710@yandex.ru"
] | pashko00710@yandex.ru |
747babff889b5e795f060f694bd56218e7cfa790 | 88889ec386935f4c60369b25ca2c2e0b295e60a1 | /movie_review_API/src/main/java/com/company/movie_review/movie_review/movie_review/cast/generated/GeneratedCastCacheHolder.java | 46986b85fcc8334954236f81a02f21bca62f87f2 | [] | no_license | nameless2708/Greenwich-final | d347397d57fca64b0124a4c67b26d0d2c7efcf96 | cdd3b0e12d249f9ea9e6da134a455b009c49827e | refs/heads/master | 2022-03-19T01:18:47.339992 | 2019-11-22T16:07:45 | 2019-11-22T16:07:45 | 214,947,590 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,137 | java | package com.company.movie_review.movie_review.movie_review.cast.generated;
import com.company.movie_review.movie_review.movie_review.cast.Cast;
import com.company.movie_review.movie_review.movie_review.cast.CastEntityStoreSerializerImpl;
import com.company.movie_review.movie_review.movie_review.cast.CastManager;
import com.speedment.common.annotation.GeneratedCode;
import com.speedment.common.tuple.Tuple2;
import com.speedment.common.tuple.Tuples;
import com.speedment.enterprise.datastore.runtime.entitystore.EntityStore;
import com.speedment.enterprise.datastore.runtime.entitystore.EntityStoreHolder;
import com.speedment.enterprise.datastore.runtime.fieldcache.FieldCache.OfComparable;
import com.speedment.enterprise.datastore.runtime.fieldcache.FieldCache.OfInt;
import com.speedment.enterprise.datastore.runtime.fieldcache.FieldCache.OfString;
import com.speedment.enterprise.datastore.runtime.fieldcache.FieldCache;
import com.speedment.enterprise.datastore.runtime.fieldcache.MultiFieldCache;
import com.speedment.enterprise.datastore.runtime.statistic.Statistics;
import com.speedment.enterprise.datastore.runtime.util.DataStoreHolderUtil;
import com.speedment.enterprise.datastore.runtime.util.StatisticsUtil;
import com.speedment.runtime.bulk.PersistOperation;
import com.speedment.runtime.bulk.RemoveOperation;
import com.speedment.runtime.bulk.UpdateOperation;
import com.speedment.runtime.config.identifier.ColumnIdentifier;
import com.speedment.runtime.config.identifier.ColumnLabel;
import com.speedment.runtime.config.identifier.TableIdentifier;
import com.speedment.runtime.core.component.StreamSupplierComponent;
import com.speedment.runtime.field.Field;
import com.speedment.runtime.field.trait.HasIdentifier;
import java.sql.Date;
import java.util.Arrays;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.stream.Stream;
import static java.util.Objects.requireNonNull;
import static java.util.stream.Collectors.toMap;
import static java.util.stream.Collectors.toSet;
/**
* A holder class for the various caches that are used to speed up the {@link
* CastManager}.
*
* Generated by
* com.speedment.enterprise.datastore.generator.internal.code.GeneratedEntityCacheHolderTranslator
* <p>
* This file has been automatically generated by Speedment. Any changes made to
* it will be overwritten.
*
* @author Speedment
*/
@GeneratedCode("Speedment")
public final class GeneratedCastCacheHolder implements EntityStoreHolder<Cast> {
private final EntityStore<Cast> entityStore;
private final OfInt fieldIdCache;
private final OfString fieldCastNameCache;
private final OfInt fieldCastGenderCache;
private final OfString fieldCastImageCache;
private final OfString fieldCastDescriptionCache;
private final OfComparable<Date> fieldCastBirthdayCache;
public GeneratedCastCacheHolder(
EntityStore<Cast> entityStore,
OfInt fieldIdCache,
OfString fieldCastNameCache,
OfInt fieldCastGenderCache,
OfString fieldCastImageCache,
OfString fieldCastDescriptionCache,
OfComparable<Date> fieldCastBirthdayCache) {
this.entityStore = requireNonNull(entityStore);
this.fieldIdCache = requireNonNull(fieldIdCache);
this.fieldCastNameCache = requireNonNull(fieldCastNameCache);
this.fieldCastGenderCache = requireNonNull(fieldCastGenderCache);
this.fieldCastImageCache = requireNonNull(fieldCastImageCache);
this.fieldCastDescriptionCache = requireNonNull(fieldCastDescriptionCache);
this.fieldCastBirthdayCache = requireNonNull(fieldCastBirthdayCache);
}
@Override
public EntityStore<Cast> getEntityStore() {
return entityStore;
}
@Override
@SuppressWarnings("unchecked")
public <CACHE extends FieldCache<CACHE>> CACHE getFieldCache(ColumnIdentifier<Cast> columnId) {
if (columnId instanceof Cast.Identifier) {
final Cast.Identifier _id = (Cast.Identifier) columnId;
switch (_id) {
case ID : return (CACHE) fieldIdCache;
case CAST_NAME : return (CACHE) fieldCastNameCache;
case CAST_GENDER : return (CACHE) fieldCastGenderCache;
case CAST_IMAGE : return (CACHE) fieldCastImageCache;
case CAST_DESCRIPTION : return (CACHE) fieldCastDescriptionCache;
case CAST_BIRTHDAY : return (CACHE) fieldCastBirthdayCache;
default : {
throw new UnsupportedOperationException(
String.format("Unknown enum constant '%s'.", _id)
);
}
}
} else {
final String _colName = columnId.getColumnId();
switch (_colName) {
case "ID" : return (CACHE) fieldIdCache;
case "Cast_name" : return (CACHE) fieldCastNameCache;
case "Cast_gender" : return (CACHE) fieldCastGenderCache;
case "Cast_image" : return (CACHE) fieldCastImageCache;
case "Cast_description" : return (CACHE) fieldCastDescriptionCache;
case "Cast_birthday" : return (CACHE) fieldCastBirthdayCache;
default : {
throw new UnsupportedOperationException(
String.format("Unknown column name '%s'.", _colName)
);
}
}
}
}
@Override
public boolean isHavingMultiFieldCache(ColumnIdentifier<Cast> columnId) {
return false;
}
public static CompletableFuture<GeneratedCastCacheHolder> reload(StreamSupplierComponent streamSupplier, ExecutorService executor) {
return reload(DataStoreHolderUtil.buildEntityStore(
streamSupplier,
executor,
CastEntityStoreSerializerImpl::new,
TableIdentifier.of("movie_review", "movie_review", "cast")
), executor);
}
@Override
public EntityStoreHolder<Cast> recycleAndPersist(PersistOperation<Cast> persistOperation) {
return wrapped().recycleAndPersist(persistOperation);
}
@Override
public EntityStoreHolder<Cast> recycleAndRemove(RemoveOperation<Cast> removeOperation) {
return wrapped().recycleAndRemove(removeOperation);
}
@Override
public EntityStoreHolder<Cast> recycleAndUpdate(UpdateOperation<Cast> updateOperation) {
return wrapped().recycleAndUpdate(updateOperation);
}
private EntityStoreHolder<Cast> wrapped() {
// Use explicit type for Stream to improve compilation time.
final Map<ColumnLabel, FieldCache<?>> fieldCaches = Stream.<Tuple2<HasIdentifier<Cast>, FieldCache<?>>>of(
Tuples.of(Cast.ID, fieldIdCache),
Tuples.of(Cast.CAST_NAME, fieldCastNameCache),
Tuples.of(Cast.CAST_GENDER, fieldCastGenderCache),
Tuples.of(Cast.CAST_IMAGE, fieldCastImageCache),
Tuples.of(Cast.CAST_DESCRIPTION,fieldCastDescriptionCache),
Tuples.of(Cast.CAST_BIRTHDAY, fieldCastBirthdayCache)
)
.collect(toMap(t2 -> t2.get0().identifier().label(), Tuple2::get1));
final Map<ColumnLabel, Map<ColumnLabel, MultiFieldCache<?, ?, ?>>> multiFieldCaches = createMultiCacheMap();
final Set<ColumnIdentifier<Cast>> columnIdentifiers = Stream.<HasIdentifier<Cast>>of(
Cast.ID,
Cast.CAST_NAME,
Cast.CAST_GENDER,
Cast.CAST_IMAGE,
Cast.CAST_DESCRIPTION,
Cast.CAST_BIRTHDAY
)
.map(HasIdentifier::identifier)
.collect(toSet());
return EntityStoreHolder.of(
entityStore,
fieldCaches,
multiFieldCaches,
columnIdentifiers
);
}
public static CompletableFuture<GeneratedCastCacheHolder> reload(CompletableFuture<EntityStore<Cast>> entityStoreFuture, ExecutorService executor) {
final CompletableFuture<FieldCache.OfInt> fieldIdCacheFuture =
DataStoreHolderUtil.buildIntCache(entityStoreFuture, executor, Cast.ID, FieldCache.DISTINCT);
final CompletableFuture<FieldCache.OfString> fieldCastNameCacheFuture =
DataStoreHolderUtil.buildStringCache(entityStoreFuture, executor, Cast.CAST_NAME, 0);
final CompletableFuture<FieldCache.OfInt> fieldCastGenderCacheFuture =
DataStoreHolderUtil.buildIntCache(entityStoreFuture, executor, Cast.CAST_GENDER, 0);
final CompletableFuture<FieldCache.OfString> fieldCastImageCacheFuture =
DataStoreHolderUtil.buildStringCache(entityStoreFuture, executor, Cast.CAST_IMAGE, 0);
final CompletableFuture<FieldCache.OfString> fieldCastDescriptionCacheFuture =
DataStoreHolderUtil.buildStringCache(entityStoreFuture, executor, Cast.CAST_DESCRIPTION, 0);
final CompletableFuture<FieldCache.OfComparable<Date>> fieldCastBirthdayCacheFuture =
DataStoreHolderUtil.buildComparableCache(entityStoreFuture, executor, Cast.CAST_BIRTHDAY, 0);
return entityStoreFuture.thenApplyAsync(entityStore -> {
try {
return new GeneratedCastCacheHolder(
entityStore,
fieldIdCacheFuture.get(),
fieldCastNameCacheFuture.get(),
fieldCastGenderCacheFuture.get(),
fieldCastImageCacheFuture.get(),
fieldCastDescriptionCacheFuture.get(),
fieldCastBirthdayCacheFuture.get()
);
} catch (final ExecutionException | InterruptedException ex) {
throw new RuntimeException(ex);
}
});
}
@Override
public void close() {
entityStore.close();
fieldIdCache.close();
fieldCastNameCache.close();
fieldCastGenderCache.close();
fieldCastImageCache.close();
fieldCastDescriptionCache.close();
fieldCastBirthdayCache.close();
}
@Override
public Statistics getStatistics() {
return StatisticsUtil.getStatistics(
this,
entityStore.identifier(),
Arrays.asList(
Cast.Identifier.ID,
Cast.Identifier.CAST_NAME,
Cast.Identifier.CAST_GENDER,
Cast.Identifier.CAST_IMAGE,
Cast.Identifier.CAST_DESCRIPTION,
Cast.Identifier.CAST_BIRTHDAY
)
);
}
private Map<ColumnLabel, Map<ColumnLabel, MultiFieldCache<?, ?, ?>>> createMultiCacheMap() {
return Collections.emptyMap();
}
} | [
"nameless27081995@gmail.com"
] | nameless27081995@gmail.com |
0b8e2d003af243851d45419b9cd0bc5fd99c8d89 | b00fecb4125056bd3954f84bc06aea23cb55cd68 | /src/android/utils/FileHelper.java | 4575cc643b97f62b71010404b3bbcc1676e4ff3c | [] | no_license | realidfarm/cordova-plugin-xmstep | 5606c019ba90c11bf67f321de48aa4d75265a1b7 | 8a4bca051ee12288e46ea9452fd8e6b6697ac07d | refs/heads/master | 2021-01-01T19:03:34.319150 | 2017-07-31T09:11:54 | 2017-07-31T09:11:54 | 98,494,114 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,079 | java | package com.realidfarm.xmstep.utils;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import android.text.TextUtils;
public class FileHelper {
public static final int KB = 1024;
public static final int MB = KB * KB;
public static final int GB = KB * MB;
public static final int TB = KB * GB;
public static final String GBK = "GBK";
public static final String UTF8 = "UTF-8";
public static String charset = GBK;
public static boolean exist(String pathAndFileName) {
return new File(pathAndFileName).exists();
}
public static boolean notExist(String pathAndFileName) {
return !exist(pathAndFileName);
}
public static boolean create(String pathAndFileName) {
boolean re = false;
try {
File file = new File(pathAndFileName);
if (!file.exists() && haveFreeSpace(file.getParent())) {
re = file.createNewFile();
}
} catch (IOException e) {
e.printStackTrace();
}
return re;
}
public static boolean delete(String pathAndFileName) {
boolean re = false;
re = new File(pathAndFileName).delete();
return re;
}
public static boolean backup(String sourcePathAndFileName,
String destinationPathAndFileName) {
return copy(sourcePathAndFileName, destinationPathAndFileName);
}
public static boolean recover(String sourcePathAndFileName,
String destinationPathAndFileName) {
return copy(sourcePathAndFileName, destinationPathAndFileName);
}
public static boolean copy(String sourcePathAndFileName,
String destinationPathAndFileName) {
boolean re = false;
try {
if (!TextUtils.isEmpty(sourcePathAndFileName)
&& !TextUtils.isEmpty(destinationPathAndFileName)) {
FileInputStream in = new FileInputStream(sourcePathAndFileName);
boolean toCopy = true;
if (notExist(destinationPathAndFileName)) {
toCopy = create(destinationPathAndFileName);
}
if (toCopy) {
FileOutputStream out = new FileOutputStream(
destinationPathAndFileName);
byte[] bt = new byte[1024];
int count;
while ((count = in.read(bt)) > 0) {
out.write(bt, 0, count);
}
in.close();
out.close();
re = true;
}
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return re;
}
public static boolean move(String sourcePathAndFileName,
String destinationPathAndFileName) {
boolean re = false;
if (copy(sourcePathAndFileName, destinationPathAndFileName)) {
re = delete(sourcePathAndFileName);
}
return re;
}
public static boolean rename(String sourcePathAndFileName,
String destinationPathAndFileName) {
return move(sourcePathAndFileName, destinationPathAndFileName);
}
public static File getFile(String pathAndFileName) {
File file = new File(pathAndFileName);
if (!file.exists()) {
try {
file.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
return file;
}
public static boolean haveFreeSpace(String pathAndFileName) {
return getFreeSpace(pathAndFileName) > 0;
}
public static boolean haveFreeSpace(File file) {
return getFreeSpace(file) > 0;
}
public static long getFreeSpace(File file) {
return getFreeSpace(file.getParent(), charset) * MB;
}
private static long getFreeSpace(String path, String charset) {
long re = -1;
try {
if (System.getProperty("os.name").startsWith("Linux")) {
re = getFreeSpaceOnLinux(path);
}
if (re == -1) {
throw new UnsupportedOperationException(
"The method getFreeSpace(String path) has not been implemented for this operating system.");
}
} catch (Exception e) {
e.printStackTrace();
}
return re;
}
private static long getFreeSpaceOnLinux(String path) throws Exception {
long bytesFree = -1;
Process p = Runtime.getRuntime().exec("df " + path);
InputStream reader = new BufferedInputStream(p.getInputStream());
StringBuffer buffer = new StringBuffer();
for (;;) {
int c = reader.read();
if (c == -1)
break;
buffer.append((char) c);
}
String outputText = buffer.toString();
reader.close();
// parse the output text for the bytes free info
StringTokenizer tokenizer = new StringTokenizer(outputText, "\n");
tokenizer.nextToken();
if (tokenizer.hasMoreTokens()) {
String line2 = tokenizer.nextToken();
StringTokenizer tokenizer2 = new StringTokenizer(line2, " ");
if (tokenizer2.countTokens() >= 4) {
String tmp = tokenizer2.nextToken();
tmp = tokenizer2.nextToken();
tmp = tokenizer2.nextToken();
tmp = tokenizer2.nextToken();
if (!TextUtils.isEmpty(tmp)) {
bytesFree = Long.parseLong(tmp.trim().substring(0,
tmp.length() - 1));
return bytesFree;
}
}
return bytesFree;
}
throw new Exception("Can not read the free space of " + path + " path");
}
public static long getFreeSpace(String pathAndFileName) {
return getFreeSpace(new File(pathAndFileName));
}
public static long getFileSizes(File f) {
long s = 0;
FileInputStream fis = null;
try {
if (f.exists()) {
fis = new FileInputStream(f);
s = fis.available();
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (fis != null) {
fis.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
return s;
}
public static String read(String pathAndFileName) {
String re = "";
File file = new File(pathAndFileName);
if (file.exists()) {
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader(file));
String temp = null;
StringBuffer sb = new StringBuffer();
temp = br.readLine();
while (temp != null) {
sb.append(temp + "\n");
temp = br.readLine();
}
re = sb.toString();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (br != null) {
try {
br.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
return re;
}
public static boolean write(String pathAndFileName, String msg) {
return append(pathAndFileName, msg);
}
public static boolean append(String pathAndFileName, String msg) {
return write(pathAndFileName, msg, true);
}
public static boolean cover(String pathAndFileName, String msg) {
return write(pathAndFileName, msg, false);
}
public static boolean write(String pathAndFileName, String msg,
boolean isAppened) {
boolean re = false;
if (haveFreeSpace(pathAndFileName)) {
File file = new File(pathAndFileName);
BufferedWriter bw = null;
try {
if (!file.exists()) {
file.createNewFile();
}
if (file.exists()) {
bw = new BufferedWriter(new FileWriter(file, isAppened));
bw.write(msg);
re = true;
}
} catch (IOException e) {
e.printStackTrace();
} finally {
if (bw != null) {
try {
bw.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
return re;
}
public Byte[] readFile(String fileName) {
File f = new File(fileName);
InputStream file;
try {
List<Byte> bufferList = new ArrayList<Byte>();
file = new FileInputStream(f);
int length = 0;
byte[] buffer = new byte[1024];
while ((length = file.read(buffer)) > 0) {
for (int i = 0; i < length; i++) {
bufferList.add(Byte.valueOf(buffer[i]));
}
}
Byte[] bufArray = new Byte[bufferList.size()];
return bufferList.toArray(bufArray);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
} | [
"taofeng_ls@sina.com"
] | taofeng_ls@sina.com |
045f6f5edb704d4fa8ee1b9b7397401984fe6464 | 951579c55d34469e7a30d806196cc67558bc23df | /extensions/addOns/typoSquat/src/main/java/org/zaproxy/zap/extension/typoSquat/actions/userActions/UserRedirectAction.java | 8f2627b58ad5ec175eb8c4953f7fcf7be63c053b | [] | no_license | fluffydeer/team-project-owasp-zap | e3b1e9934d526f7caed9c33f1e0c4a46817cb131 | e520ab7d96d80e4e60fb41c4518cb6885d33f27d | refs/heads/main | 2023-03-06T09:44:52.751473 | 2021-02-24T11:36:34 | 2021-02-24T11:36:34 | 341,623,337 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,150 | java | package org.zaproxy.zap.extension.typoSquat.actions.userActions;
import org.zaproxy.zap.extension.typoSquat.fileHandler.DomainHandler;
import org.parosproxy.paros.network.HttpMessage;
import org.zaproxy.zap.extension.typoSquat.session.SessionManager;
import org.zaproxy.zap.extension.typoSquat.warningPage.TypoSquatSuggestion;
public class UserRedirectAction extends AbstractUserAction {
private DomainHandler domainHandler;
private String redirectDomain;
public UserRedirectAction(TypoSquatSuggestion suggestion, String originalDomain, DomainHandler domainHandler) {
super(suggestion.getUUID(), originalDomain);
this.redirectDomain = suggestion.getDomain();
this.domainHandler = domainHandler;
}
@Override
public boolean execute(HttpMessage msg, SessionManager manager) {
if (! isValid(uuid, originalDomain)) {
throw new IllegalArgumentException("UUID does not match domain.");
}
domainHandler.addToBlackList(originalDomain, redirectDomain);
this.invalidateOtherActions(manager);
return this.setRedirectResponse(msg, redirectDomain);
}
}
| [
"natiklementova@gmail.com"
] | natiklementova@gmail.com |
b98f55cffe9f5976cc09e1c6c391e59150d1c9fb | e3b1b470121d9f506e69de25ffe06a9c80beb7e9 | /src/main/java/com/meicloud/model/Queue.java | f113ce86bc00f47ae6ad09528a43b4917477ad57 | [] | no_license | zhougit86/MSS | a7673241c2c9c06009b54b7c209e3cf98c7142b0 | 5cf2072673c594e35ec6ee1a9c05fd835daf3af5 | refs/heads/master | 2020-04-11T07:51:00.934140 | 2018-12-13T10:40:41 | 2018-12-13T10:40:41 | 161,624,007 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,716 | java | package com.meicloud.model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ApiModel("集群信息")
public class Queue {
@ApiModelProperty(
value = "集群编码",
example = "1"
)
private String queueId;
@ApiModelProperty(
value = "集群编码",
example = "GXT_UAT",
required = true
)
private String queueCode;
@ApiModelProperty(
value = "集群名称",
example = "默认集群",
required = true
)
private String queueName;
@ApiModelProperty(
value = "git地址",
example = "http://10.16.28.73/IBD/bdis.git"
)
private String gitUrl;
@ApiModelProperty(
value = "git登录账号",
example = "root"
)
private String gitUserName;
@ApiModelProperty(
value = "git登录密码",
example = "123456"
)
private String gitPassWord;
@ApiModelProperty(
value = "svn地址",
example = "https://lijl38519.cn.midea.com/svn/YONGHUI/ECI/trunk/10_DEPLOY_DEV"
)
private String svnUrl;
@ApiModelProperty(
value = "svn登录账号",
example = "root"
)
private String svnUserName;
@ApiModelProperty(
value = "svn登录密码",
example = "123456"
)
private String svnPassWord;
public String getQueueId() {
return this.queueId;
}
public void setQueueId(String queueId) {
this.queueId = queueId;
}
public String getQueueCode() {
return this.queueCode;
}
public void setQueueCode(String queueCode) {
this.queueCode = queueCode;
}
public String getQueueName() {
return this.queueName;
}
public void setQueueName(String queueName) {
this.queueName = queueName;
}
public String getGitUrl() {
return this.gitUrl;
}
public void setGitUrl(String gitUrl) {
this.gitUrl = gitUrl;
}
public String getGitUserName() {
return this.gitUserName;
}
public void setGitUserName(String gitUserName) {
this.gitUserName = gitUserName;
}
public String getGitPassWord() {
return this.gitPassWord;
}
public void setGitPassWord(String gitPassWord) {
this.gitPassWord = gitPassWord;
}
public String getSvnUrl() {
return this.svnUrl;
}
public void setSvnUrl(String svnUrl) {
this.svnUrl = svnUrl;
}
public String getSvnUserName() {
return this.svnUserName;
}
public void setSvnUserName(String svnUserName) {
this.svnUserName = svnUserName;
}
public String getSvnPassWord() {
return this.svnPassWord;
}
public void setSvnPassWord(String svnPassWord) {
this.svnPassWord = svnPassWord;
}
}
| [
"80828913@yonghui.cn"
] | 80828913@yonghui.cn |
0b8f45ab1bb2084c2ddec8313b04641f9ada37b3 | 6e58ce5bef4a34fd90f9871f08ae06bbf417d4de | /src/main/java/com/edto/cursomc/dto/ProductDTO.java | 45b4434207adff40f7cd1ca39f8f3a4c82c2e3bb | [] | no_license | Oliveira-86/coursemc | d067aa94afdf69078a7e12d4947919aa3c3ea31b | 1ea6265202b49717b7d0808281ffc7120449c211 | refs/heads/master | 2023-01-19T05:10:56.878123 | 2020-11-18T16:29:44 | 2020-11-18T16:29:44 | 294,813,361 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 716 | java | package com.edto.cursomc.dto;
import java.io.Serializable;
import com.edto.cursomc.domain.Product;
public class ProductDTO implements Serializable{
private static final long serialVersionUID = 1L;
private Long id;
private String name;
private Double price;
public ProductDTO() {
}
public ProductDTO(Product obj) {
id = obj.getId();
name = obj.getName();
price = obj.getPrice();
}
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 Double getPrice() {
return price;
}
public void setPrice(Double price) {
this.price = price;
}
}
| [
"egberto.duarte.14@gmail.com"
] | egberto.duarte.14@gmail.com |
9744b8ec79e2d2ebe23b49af7184c14a2d7dedeb | c6d931a0b96addf006061f4f1e8bc78e53e35263 | /core/src/main/java/org/openstack4j/openstack/internal/MicroVersion.java | 6ae876a1eb32647773ed5cffbe975782b5965fbf | [
"Apache-2.0"
] | permissive | 17862953931/openstack4j | a8ea441009d14afa839cf6f42d128652687751e1 | 9d5f1a0c91b6db8942019fddd2997e6b2a33ef57 | refs/heads/master | 2020-09-04T09:29:26.354230 | 2020-02-19T02:52:06 | 2020-02-19T02:52:06 | 219,702,460 | 2 | 1 | NOASSERTION | 2020-02-19T02:52:07 | 2019-11-05T09:09:05 | Java | UTF-8 | Java | false | false | 1,731 | java | package org.openstack4j.openstack.internal;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Common representation of an API micro version.
*
* @author Daniel Gonzalez Nothnagel
*/
public class MicroVersion implements Comparable<MicroVersion> {
private final static Pattern VERSION_REGEX = Pattern.compile("^([1-9]\\d*)\\.([1-9]\\d*|0|)$");
private final int majorVersion;
private final int minorVersion;
public MicroVersion(String version) {
Matcher versionMatcher = VERSION_REGEX.matcher(version);
if (!versionMatcher.matches()) {
throw new IllegalArgumentException(String.format(
"Invalid version pattern %s, should be 'X.Y' (Major.Minor)", version));
}
majorVersion = Integer.valueOf(versionMatcher.group(1));
minorVersion = Integer.valueOf(versionMatcher.group(2));
}
public MicroVersion(int majorVersion, int minorVersion) {
this.majorVersion = majorVersion;
this.minorVersion = minorVersion;
}
@Override
public int compareTo(MicroVersion o) {
int majorDifference = majorVersion - o.majorVersion;
if (majorDifference != 0) {
return majorDifference;
}
return minorVersion - o.minorVersion;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof MicroVersion) {
MicroVersion v = (MicroVersion) obj;
return compareTo(v) == 0;
}
return false;
}
@Override
public String toString() {
return String.format("%d.%d", majorVersion, minorVersion);
}
}
| [
"daniel@gonzalez-nothnagel.de"
] | daniel@gonzalez-nothnagel.de |
820f7bc5fd0e99e1dae4cedd5c2e51224e41d414 | 0d4a94b90ead351554d2a252f809e56e6ce64d91 | /android/app/src/main/java/com/ccrn/MainApplication.java | 5eb8ba545379627417a2572edb43d2f07b433aa3 | [] | no_license | pocket-law/react-native-test-cc | bbae24d933904ef85c7e58ffb611f2743ed582c2 | 7f3dbe03c849f62298ba19312cf1ff3b10905b0b | refs/heads/master | 2020-04-18T05:47:03.049042 | 2019-02-08T00:04:19 | 2019-02-08T00:04:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,201 | java | package com.ccrn;
import android.app.Application;
import com.facebook.react.ReactApplication;
import net.no_mad.tts.TextToSpeechPackage;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
import java.util.Arrays;
import java.util.List;
import org.pgsqlite.SQLitePluginPackage;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new TextToSpeechPackage(),
new SQLitePluginPackage()
);
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
}
}
| [
"gcgolda@gmail.com"
] | gcgolda@gmail.com |
10d89db8d06328ad1ff38b93e7eb180e1bceee24 | 5d07ac5c253fdb4d7f99ba8d2e1fe45b26ef03b4 | /editor/SimpleNoteChartPlayer.java | e74b11949133288e91a40d87cbba2f30bbe8b7b6 | [] | no_license | TigerHix/cytus | 3c15de3a52f0ec34c418a415bd427fae2fd38bfb | b8be85edc36fb8b163f3947b553c93598c660009 | refs/heads/master | 2021-01-22T14:20:52.988729 | 2014-11-30T06:31:42 | 2014-11-30T06:31:42 | 27,483,262 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,643 | java | package cytus.editor;
import cytus.*;
import java.awt.*;
import java.awt.image.*;
import java.text.*;
import javax.swing.*;
import javax.media.*;
import java.util.*;
import java.io.*;
public class SimpleNoteChartPlayer {
NoteChart pdata = null;
LinkedList<NoteChart.Note> selection = new LinkedList<NoteChart.Note>();
BufferedImage buf = new BufferedImage(720, 480, BufferedImage.TYPE_INT_ARGB);
Graphics2D g = (Graphics2D) buf.getGraphics();
Player player = null; // MediaPlayer
int WIDTH = 675, HEIGHT = 375, XOFF = 22, YOFF = 52;
public SimpleNoteChartPlayer(NoteChart pdata, Player player) {
this.pdata = pdata;
this.player = player;
g.setStroke(new BasicStroke(5));
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
}
public int calcPage(double time) {
return (int) ((time + pdata.pshift) / pdata.beat);
}
public int calcX(double x) {
return (int) (x * WIDTH + XOFF);
}
public int calcY(double time) {
int cpage = calcPage(time);
double y = (time + pdata.pshift) / pdata.beat - cpage;
if (cpage % 2 == 0)
y = 1 - y;
return (int) (y * HEIGHT + YOFF);
}
public void paint() {
double time = player.getMediaTime().getSeconds();
g.setColor(Color.WHITE);
g.fillRect(0, 0, 720, 480);
int CSIZE = 72, NSIZE = 36, TSIZE = 36;
for (int i = 0; i < pdata.links.size(); i++) {
NoteChart.Link l = pdata.links.get(i);
if ((l.nodes.getFirst().time <= time + pdata.beat)
&& (time <= l.nodes.getLast().time)) {
int last = -1;
for (int j = 0; j < l.n; j++) {
NoteChart.Note node = l.nodes.get(j);
int x = calcX(node.x);
int y = calcY(node.time);
if ((time + pdata.beat > node.time) && (time < node.time)) {
if (selection.contains(node)) {
g.setColor(new Color(255, 0, 0, 100));
g.fillOval(x - 20, y - 20, 40, 40);
}
if (time <= node.time - pdata.beat / 2) {
double alpha = (time - (node.time - pdata.beat))
/ (pdata.beat / 2);
g.setComposite(AlphaComposite.SrcOver
.derive((float) alpha));
} else
g.setComposite(AlphaComposite.SrcOver);
if (j < l.n - 1) {
g.setColor(Color.BLACK);
int nextx = calcX(l.nodes.get(j + 1).x);
int nexty = calcY(l.nodes.get(j + 1).time);
g.drawLine(x, y, nextx, nexty);
}
g.setColor(new Color(255, 255, 0, 100));
g.fillOval(x - NSIZE / 2, y - NSIZE / 2, NSIZE, NSIZE);
g.setColor(Color.RED);
g.drawString(String.valueOf(node.id), x, y);
}
if (time >= node.time)
last = j;
}
int cx = calcX(l.nodes.getFirst().x);
int cy = calcY(l.nodes.getFirst().time);
if (last != -1) {
if (last == l.n - 1)
last--;
NoteChart.Note node = l.nodes.get(last);
NoteChart.Note next = l.nodes.get(last + 1);
int x = calcX(node.x);
int y = calcY(node.time);
int nextx = calcX(next.x);
int nexty = calcY(next.time);
double pos = (time - node.time) / (next.time - node.time);
cx = (int) ((nextx - x) * pos + x);
cy = (int) ((nexty - y) * pos + y);
}
g.setComposite(AlphaComposite.SrcOver);
g.setColor(new Color(0, 255, 0, 100));
g.fillOval(cx - CSIZE / 2, cy - CSIZE / 2, CSIZE, CSIZE);
g.setColor(new Color(255, 255, 0, 100));
g.drawOval(cx - CSIZE / 2, cy - CSIZE / 2, CSIZE, CSIZE);
}
}
int start = -1, end = -1;
for (int i = 0; i < pdata.notes.size(); i++) {
NoteChart.Note note = pdata.notes.get(i);
if ((note.time <= time + pdata.beat)
&& (time <= note.time + note.holdtime)) {
if (start == -1)
start = i;
end = i;
}
}
if (end != -1) {
for (int i = end; i >= start; i--) {
NoteChart.Note note = pdata.notes.get(i);
if (note.linkref != -1)
continue;
int x = calcX(note.x);
int y = calcY(note.time);
int y2 = 0;
if (time + pdata.beat <= note.time + note.holdtime)
y2 = calcY(time + pdata.beat);
else
y2 = calcY(note.time + note.holdtime);
if (selection.contains(note)) {
g.setColor(new Color(255, 0, 0, 100));
g.fillOval(x - 40, y - 40, 80, 80);
}
if (time <= note.time - pdata.beat / 2) {
double alpha = (time - (note.time - pdata.beat))
/ (pdata.beat / 2);
g.setComposite(AlphaComposite.SrcOver.derive((float) alpha));
} else
g.setComposite(AlphaComposite.SrcOver);
if (note.holdtime == 0) { // Circle
g.setColor(new Color(0, 0, 0, 100));
g.fillOval(x - CSIZE / 2, y - CSIZE / 2, CSIZE, CSIZE);
g.setColor(note.page % 2 == 0 ? Color.MAGENTA : Color.GREEN);
g.drawOval(x - CSIZE / 2, y - CSIZE / 2, CSIZE, CSIZE);
} else { // Hold
g.setColor(Color.YELLOW);
if (y < y2)
g.fillRect(x - TSIZE / 2, y, TSIZE, y2 - y);
else
g.fillRect(x - TSIZE / 2, y2, TSIZE, y - y2);
if (time > note.time) {
int pos = (int) ((y2 - y) * (time - note.time) / note.holdtime)
+ y;
g.setColor(Color.CYAN);
if (y < pos)
g.fillRect(x - TSIZE / 2, y, TSIZE, pos - y);
else
g.fillRect(x - TSIZE / 2, pos, TSIZE, y - pos);
}
g.setColor(Color.YELLOW);
g.fillOval(x - CSIZE / 2, y - CSIZE / 2, CSIZE, CSIZE);
g.setColor(new Color(0, 0, 0, 100));
g.drawOval(x - CSIZE / 2, y - CSIZE / 2, CSIZE, CSIZE);
}
g.setColor(Color.RED);
g.drawString(String.valueOf(note.id), x, y);
}
}
int liney = calcY(time);
g.setComposite(AlphaComposite.SrcOver);
g.setColor(Color.BLACK);
g.drawLine(0, liney, 720, liney);
g.drawString(
"Time:" + new java.text.DecimalFormat("0.000").format(time),
10, 20);
}
} | [
"413405663@qq.com"
] | 413405663@qq.com |
32e852ebb9af0c12b6873c00b98f99b2689ae7f1 | ffeaf567e9b1aadb4c00d95cd3df4e6484f36dcd | /Hotgram/com/google/firebase/iid/k.java | 6105ef1761a79a10d52a6b8bfcfad1c6be56e87b | [] | no_license | danielperez9430/Third-party-Telegram-Apps-Spy | dfe541290c8512ca366e401aedf5cc5bfcaa6c3e | f6fc0f9c677bd5d5cd3585790b033094c2f0226d | refs/heads/master | 2020-04-11T23:26:06.025903 | 2018-12-18T10:07:20 | 2018-12-18T10:07:20 | 162,166,647 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,213 | java | package com.google.firebase.iid;
import android.os.IBinder;
import android.os.Message;
import android.os.Messenger;
import android.os.RemoteException;
import android.util.Log;
final class k {
private final Messenger a;
private final zzk b;
k(IBinder arg4) {
super();
String v0 = arg4.getInterfaceDescriptor();
zzk v2 = null;
if("android.os.IMessenger".equals(v0)) {
this.a = new Messenger(arg4);
this.b = v2;
return;
}
if("com.google.android.gms.iid.IMessengerCompat".equals(v0)) {
this.b = new zzk(arg4);
this.a = ((Messenger)v2);
return;
}
String v4 = "Invalid interface descriptor: ";
v0 = String.valueOf(v0);
v4 = v0.length() != 0 ? v4.concat(v0) : new String(v4);
Log.w("MessengerIpcClient", v4);
throw new RemoteException();
}
final void a(Message arg2) {
if(this.a != null) {
this.a.send(arg2);
return;
}
if(this.b != null) {
this.b.a(arg2);
return;
}
throw new IllegalStateException("Both messengers are null");
}
}
| [
"dpefe@hotmail.es"
] | dpefe@hotmail.es |
7545537c90d9645fc82f941d0e8be21693bd857e | fd73e79976bcccee8ef84d92881a8265c5773b0d | /app/src/main/java/com/example/outla/myapplication/Receipt.java | 07c4f7c8843b4c515388908cb72336a66a8a15ee | [] | no_license | cathalaherne2/receiptsGatherer | caeaf55483927e095b8ccf02a060e1536a7363ab | 290dae3f2133000d78f6b1168c3faa48cace1fdf | refs/heads/master | 2020-05-02T17:26:34.006445 | 2019-04-11T19:13:08 | 2019-04-11T19:13:08 | 178,098,353 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,234 | java | package com.example.outla.myapplication;
public class Receipt {
private String Total;
private String ShopName;
private String URL;
private String TimeDate;
private String Logo;
public Receipt(String shopName, String total, String url, String logo, String timeDate) {
ShopName = shopName;
Total = total;
URL = url;
TimeDate = timeDate;
Logo = logo;
}
public String getTotal() {
return Total;
}
public void setTotal(String total) {
Total = total;
}
public String getShopName() {
return ShopName;
}
public void setShopName(String shopName) {
ShopName = shopName;
}
public void setURL(String URL) {
this.URL = URL;
}
public String getTimeDate() {
return TimeDate;
}
public void setTimeDate(String timeDate) {
TimeDate = timeDate;
}
public String getDate() {
return TimeDate;
}
public void setDate(String date) {
TimeDate = date;
}
public String getLogo() {
return Logo;
}
public void setLogo(String logo) {
Logo = logo;
}
public String getURL() {
return URL;
}
} | [
"cathalaherne2@gmail.com"
] | cathalaherne2@gmail.com |
e39d53a2ada1ea00882042c0ee1f69d7c1d6f87d | 059bcece1a759624e6894b2533cb6b5a6a250321 | /spring-geode-autoconfigure/src/test/java/org/springframework/geode/boot/autoconfigure/repository/service/CustomerService.java | 9a1c54b5da3df05f7ecb22bb74969fb7c57a4295 | [
"Apache-2.0"
] | permissive | koalaanntree/spring-boot-data-geode | 7364e3a698048b84988bf434d3b7b0dbd6035abf | 2a4f0b0f4e2fb7e33ae4f34bee19b5b223d0df83 | refs/heads/master | 2020-05-18T00:31:30.379791 | 2019-04-24T19:13:59 | 2019-04-24T19:13:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,561 | java | /*
* Copyright 2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://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.springframework.geode.boot.autoconfigure.repository.service;
import static org.springframework.data.gemfire.util.RuntimeExceptionFactory.newIllegalArgumentException;
import static org.springframework.data.gemfire.util.RuntimeExceptionFactory.newIllegalStateException;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicLong;
import org.springframework.geode.boot.autoconfigure.repository.model.Customer;
import org.springframework.geode.boot.autoconfigure.repository.repo.CustomerRepository;
import org.springframework.stereotype.Service;
/**
* The {@link CustomerService} class is an application service for managing {@link Customer Customers}.
*
* @author John Blum
* @see org.springframework.geode.boot.autoconfigure.repository.model.Customer
* @see org.springframework.geode.boot.autoconfigure.repository.repo.CustomerRepository
* @see org.springframework.stereotype.Service
* @since 1.0.0
*/
@Service
public class CustomerService {
private final CustomerRepository customerRepository;
private final AtomicLong identifierSequence = new AtomicLong(0L);
public CustomerService(CustomerRepository customerRepository) {
this.customerRepository = customerRepository;
}
public CustomerRepository getCustomerRepository() {
return Optional.ofNullable(this.customerRepository)
.orElseThrow(() -> newIllegalStateException("CustomerRepository was not properly configured"));
}
public Optional<Customer> findBy(String name) {
return Optional.ofNullable(getCustomerRepository().findByName(name));
}
protected Long nextId() {
return identifierSequence.incrementAndGet();
}
public Customer save(Customer customer) {
return Optional.ofNullable(customer)
.map(it -> {
if (customer.isNew()) {
customer.identifiedBy(nextId());
}
return getCustomerRepository().save(customer);
})
.orElseThrow(() -> newIllegalArgumentException("Customer is required"));
}
}
| [
"jblum@pivotal.io"
] | jblum@pivotal.io |
73d6c9c6f1152cd5fba087a795084c0f343151f0 | 6db6185a1a42bbcbc63749bcdaf13c3347908655 | /draven-springboot/noxus-draven-springboot-2.2.x/noxus-draven-mybatis/noxus-draven-mybatis-mybatis-plus/src/main/java/com/noxus/draven/plus/mapper/UserMapper.java | 89412f6dc224b792f517e4d2c3e8e7e462636b93 | [] | no_license | the-glorious-executione-noxus/draven-spring | f09a4937d907932abc5a85ccbf56c5daac33d96b | 1fb10c33b72b4ec5b8d26ffb067bb085fafb2e8b | refs/heads/master | 2023-08-14T14:08:13.810602 | 2020-03-24T11:21:25 | 2020-03-24T11:21:25 | 228,608,382 | 0 | 0 | null | 2023-07-23T00:37:04 | 2019-12-17T12:08:27 | JavaScript | UTF-8 | Java | false | false | 394 | java | package com.noxus.draven.plus.mapper;
import com.noxus.draven.plus.entity.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
/**
* <p>
* Mapper 接口
* </p>
*
* @author draven
* @since 2020-01-11
*/
public interface UserMapper extends BaseMapper<User> {
@Select("select * from User where id = 1 ")
User selectOnes();
}
| [
"w1994z0115x"
] | w1994z0115x |
ea63ca2d4382c4a1afefdda6815954da4785fd2c | d93edde87418e88c12b151f96a0f033f70a1a578 | /libraries/core/src/main/java/uk/ac/kcl/inf/mdeoptimiser/libraries/core/optimisation/specification/SearchSpecification.java | 7fd1573a372cc0de1632da33f9c0954298880d0d | [] | no_license | mde-optimiser/mde_optimiser | 99537347ac5b0b235b9029d991d834c8018bdc4f | 201a7e5633277993933182cb31af8c83ba7a8247 | refs/heads/master | 2022-08-15T21:43:41.463403 | 2022-07-14T22:33:03 | 2022-07-14T22:33:03 | 74,063,717 | 4 | 10 | null | 2023-07-19T15:01:31 | 2016-11-17T20:16:05 | Java | UTF-8 | Java | false | false | 9,546 | java | package uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.specification;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.eclipse.core.runtime.IPath;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.henshin.model.Module;
import org.eclipse.emf.henshin.model.Unit;
import org.eclipse.emf.henshin.model.resource.HenshinResourceSet;
import uk.ac.kcl.inf.mdeoptimiser.languages.mopt.Optimisation;
import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.IGuidanceFunction;
import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.IModelInitialiser;
import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.IModelProvider;
import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.executor.UserModelProvider;
import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.interpreter.guidance.GuidanceFunctionAdapter;
import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.interpreter.guidance.GuidanceFunctionsFactory;
import uk.ac.kcl.inf.mdeoptimiser.libraries.core.reflection.LanguageClassLoader;
import uk.ac.kcl.inf.mdeoptimiser.libraries.rulegen.RulesGenerator;
import uk.ac.kcl.inf.mdeoptimiser.libraries.rulegen.metamodel.Multiplicity;
import uk.ac.kcl.inf.mdeoptimiser.libraries.rulegen.metamodel.RuleSpec;
public class SearchSpecification implements ISearchSpecification {
private Optimisation model;
HenshinResourceSet henshinResourceSet;
EPackage theMetamodel;
List<Unit> breedingOperators;
List<Unit> mutationOperators;
IPath projectRootPath;
Map<EPackage, List<Module>> generatedOperators;
List<IGuidanceFunction> fitnessFunctions;
List<IGuidanceFunction> constraintFunctions;
public SearchSpecification(IPath projectRootPath, Optimisation model) {
this.model = model;
this.projectRootPath = projectRootPath;
}
public Optimisation getOptimisationModel() {
return this.model;
}
public List<Unit> getBreedingOperators() {
if (breedingOperators != null) {
return this.breedingOperators;
}
breedingOperators = new LinkedList<Unit>();
breedingOperators.addAll(
this.getOptimisationModel().getSearch().getEvolvers().stream()
.filter(operator -> operator.getEvolverType().getName().equals("BREED"))
.map(
operator ->
getResourceSet()
.getModule(URI.createURI(operator.getRule_location()), false)
.getUnit(operator.getUnit()))
.collect(Collectors.toList()));
return breedingOperators;
}
public List<Unit> getMutationOperators() {
if (this.mutationOperators != null) {
return this.mutationOperators;
}
mutationOperators = new LinkedList<>();
mutationOperators.addAll(
model.getSearch().getEvolvers().stream()
.filter(operator -> operator.getEvolverType().getName().equals("MUTATE"))
.map(
operator ->
getResourceSet()
.getModule(URI.createURI(operator.getRule_location()), false)
.getUnit(operator.getUnit()))
.collect(Collectors.toList()));
// Automatically generate mutations operators
var generatedMutations = this.getRulegenOperators();
if (!generatedMutations.isEmpty()) {
// For each of the automatically generated modules, add the generated mutations
// to the list of evolvers
// Are we ever going to have more than one metamodel? Perhaps this should be a
// pair instead
var metamodel = generatedMutations.keySet().iterator().next();
var mutations = generatedMutations.get(metamodel);
mutations.forEach(mutation -> mutationOperators.addAll(mutation.getAllRules()));
}
return mutationOperators;
}
public List<Multiplicity> getMultiplicityRefinements() {
// A list of multiplicity refinements specified by the user in the DSL.
// This is optional.
var refinements = model.getGoal().getRefinements();
var multiplicityRefinements = new ArrayList<Multiplicity>();
if (!refinements.isEmpty()) {
refinements.forEach(
refinement ->
multiplicityRefinements.add(
new Multiplicity(
refinement.getNode(),
refinement.getEdge(),
refinement.getLowerBound(),
refinement.getUpperBound(),
getMetamodel())));
}
return multiplicityRefinements;
}
public List<RuleSpec> getRulegenSpecs() {
var rulegenSpecs = model.getSearch().getRulegen();
var ruleSpecs = new ArrayList<RuleSpec>();
if (!rulegenSpecs.isEmpty()) {
rulegenSpecs.forEach(
rulegenSpec -> {
// Crete the spec for a node, if configured in the MOPT file or an edge generation
if (rulegenSpec.getNodeSpec() != null) {
ruleSpecs.add(
new RuleSpec(
rulegenSpec.getNodeSpec().getNode(),
rulegenSpec.getNodeSpec().getGenerationRestriction()));
} else {
ruleSpecs.add(
new RuleSpec(
rulegenSpec.getEdgeSpec().getNode(),
rulegenSpec.getEdgeSpec().getEdge(),
rulegenSpec.getEdgeSpec().getGenerationRestriction()));
}
});
}
return ruleSpecs;
}
/**
* If there are any rule generation instructions present, then generate the corresponding rules.
*
* @return list of generated mutation operators
* @throws Exception
*/
public Map<EPackage, List<Module>> getRulegenOperators() {
if (this.generatedOperators == null) {
// Generate the list of modules that are automatically generated
var mutations =
new RulesGenerator(
this.getMetamodel(), this.getMultiplicityRefinements(), this.getRulegenSpecs());
this.generatedOperators = mutations.generateRules();
}
return this.generatedOperators;
}
public HenshinResourceSet getResourceSet() {
if (henshinResourceSet == null) {
henshinResourceSet =
new HenshinResourceSet(
projectRootPath
.append(this.getOptimisationModel().getProblem().getBasepath().getLocation())
.toPortableString());
}
return henshinResourceSet;
}
public EPackage getMetamodel() {
if (theMetamodel == null) {
if (!this.getOptimisationModel()
.getProblem()
.getMetamodel()
.getLocation()
.endsWith(".ecore")) {
// The location is not an ecore file, assume it's a class name
theMetamodel =
LanguageClassLoader.load(this.getOptimisationModel().getProblem().getMetamodel());
} else {
theMetamodel =
getResourceSet()
.registerDynamicEPackages(
this.getOptimisationModel().getProblem().getMetamodel().getLocation())
.get(0);
}
}
return theMetamodel;
}
public IModelProvider getModelProvider() {
// TODO Extend the DSL to allow the user to specify a generic extension to factory map. Then we
// can
// initialise that and dynamically load any type of model and handle it with the correct factory
// Resource.Factory.Registry.INSTANCE
// .getExtensionToFactoryMap()
// .put("*", new XMIResourceFactoryImpl());
if (this.getOptimisationModel().getProblem().getModelInitialiser() != null) {
return new UserModelProvider(
this.getModelInitialiser(),
getResourceSet(),
this.getOptimisationModel().getProblem().getModel().getLocation());
}
return new UserModelProvider(
getResourceSet(), this.getOptimisationModel().getProblem().getModel().getLocation());
}
public IModelInitialiser getModelInitialiser() {
if (this.getOptimisationModel().getProblem().getModelInitialiser() != null) {
return LanguageClassLoader.load(
this.getOptimisationModel().getProblem().getModelInitialiser());
}
return null;
}
@Override
public List<IGuidanceFunction> getConstraintFunctions() {
if (this.constraintFunctions == null) {
setConstraintFunctions();
}
return this.constraintFunctions;
}
public void setConstraintFunctions() {
if (constraintFunctions == null) {
this.constraintFunctions =
getOptimisationModel().getGoal().getConstraints().stream()
.map(
constraint ->
new GuidanceFunctionsFactory()
.loadFunction(new GuidanceFunctionAdapter(constraint)))
.collect(Collectors.toList());
}
}
@Override
public List<IGuidanceFunction> getObjectiveFunctions() {
if (this.fitnessFunctions == null) {
setObjectiveFunctions();
}
return this.fitnessFunctions;
}
public void setObjectiveFunctions() {
if (fitnessFunctions == null) {
this.fitnessFunctions =
getOptimisationModel().getGoal().getObjectives().stream()
.map(
objective ->
new GuidanceFunctionsFactory()
.loadFunction(new GuidanceFunctionAdapter(objective)))
.collect(Collectors.toList());
}
}
}
| [
"alxbrd@users.noreply.github.com"
] | alxbrd@users.noreply.github.com |
6fd4996cfc57331b2eb2d264a624fbadfea2eade | 87f989b37e9961742ec32f7b5466e0052f0487dd | /Codebase/Roomix/ui/src/main/java/at/fhv/roomix/ui/view/checkin/edit/CheckInEditViewModel.java | 9bd05ab412b52e6804cd2d740cda0df46ba9336e | [] | no_license | HeilOliver/Roomix | c2273a1f8bb70c0be1673069f35f2838ec2514e3 | 4117e9d719cd271d209a87b82fe335b8852ab0cd | refs/heads/master | 2021-03-22T01:13:42.708315 | 2018-05-07T11:55:48 | 2018-05-07T11:55:48 | 122,192,618 | 2 | 0 | null | 2018-06-10T09:56:40 | 2018-02-20T12:00:27 | Java | UTF-8 | Java | false | false | 140 | java | package at.fhv.roomix.ui.view.checkin.edit;
import de.saxsys.mvvmfx.ViewModel;
public class CheckInEditViewModel implements ViewModel {
}
| [
"32767920+drunkenMonkey-1@users.noreply.github.com"
] | 32767920+drunkenMonkey-1@users.noreply.github.com |
d9cd0424e7ec0d66e79207388dcf0a4f9ea49271 | f6c75e31355c878fb0e215c7549932746f9945c4 | /src/test/java/com/scp/CrudWithTestNG/AppTest.java | f3f40b2db2e6564a6b2f1cde8c5f027a2797d0c5 | [] | no_license | sk4092/CrudWithTestNG | 4a8bf8bcf63982e1e7acdb2a3f22a0fcbb3202e5 | 5cff08edabd4f8b41ea5ca403258681b82f1ba39 | refs/heads/master | 2020-03-23T00:43:16.227853 | 2018-07-13T20:56:16 | 2018-07-13T20:56:16 | 140,881,635 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 650 | java | package com.scp.CrudWithTestNG;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
}
| [
"swapnil.kumbhar@spiderlogic.com"
] | swapnil.kumbhar@spiderlogic.com |
b7b96b447ae941f6dfb0be4b0dada4ed2e935b97 | a51b22c7601fbc1e7d5e852f5db4614001c61b5f | /springboot/src/main/java/com/neuedu/pojo/Shipping.java | dbb8cc1bcdee442f89dbf207c063f31f0a2b63ba | [] | no_license | yuecay/shopping | 160dd98fce6111c65ab06ae973aa11a23a1133ca | 14f0c41d02cfc0a70b820f6f115d0aa9766bb21f | refs/heads/master | 2022-11-20T00:16:11.713270 | 2019-12-28T07:40:29 | 2019-12-28T07:40:29 | 228,355,141 | 1 | 0 | null | 2022-11-16T10:31:44 | 2019-12-16T09:55:14 | PLpgSQL | UTF-8 | Java | false | false | 11,335 | java | package com.neuedu.pojo;
import java.util.Date;
public class Shipping {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column neuedu_shipping.id
*
* @mbg.generated
*/
private Integer id;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column neuedu_shipping.user_id
*
* @mbg.generated
*/
private Integer userId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column neuedu_shipping.receiver_name
*
* @mbg.generated
*/
private String receiverName;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column neuedu_shipping.receiver_phone
*
* @mbg.generated
*/
private String receiverPhone;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column neuedu_shipping.receiver_mobile
*
* @mbg.generated
*/
private String receiverMobile;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column neuedu_shipping.receiver_province
*
* @mbg.generated
*/
private String receiverProvince;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column neuedu_shipping.receiver_city
*
* @mbg.generated
*/
private String receiverCity;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column neuedu_shipping.receiver_district
*
* @mbg.generated
*/
private String receiverDistrict;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column neuedu_shipping.receiver_address
*
* @mbg.generated
*/
private String receiverAddress;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column neuedu_shipping.receiver_zip
*
* @mbg.generated
*/
private String receiverZip;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column neuedu_shipping.create_time
*
* @mbg.generated
*/
private Date createTime;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column neuedu_shipping.update_time
*
* @mbg.generated
*/
private Date updateTime;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column neuedu_shipping.id
*
* @return the value of neuedu_shipping.id
*
* @mbg.generated
*/
public Integer getId() {
return id;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column neuedu_shipping.id
*
* @param id the value for neuedu_shipping.id
*
* @mbg.generated
*/
public void setId(Integer id) {
this.id = id;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column neuedu_shipping.user_id
*
* @return the value of neuedu_shipping.user_id
*
* @mbg.generated
*/
public Integer getUserId() {
return userId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column neuedu_shipping.user_id
*
* @param userId the value for neuedu_shipping.user_id
*
* @mbg.generated
*/
public void setUserId(Integer userId) {
this.userId = userId;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column neuedu_shipping.receiver_name
*
* @return the value of neuedu_shipping.receiver_name
*
* @mbg.generated
*/
public String getReceiverName() {
return receiverName;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column neuedu_shipping.receiver_name
*
* @param receiverName the value for neuedu_shipping.receiver_name
*
* @mbg.generated
*/
public void setReceiverName(String receiverName) {
this.receiverName = receiverName == null ? null : receiverName.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column neuedu_shipping.receiver_phone
*
* @return the value of neuedu_shipping.receiver_phone
*
* @mbg.generated
*/
public String getReceiverPhone() {
return receiverPhone;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column neuedu_shipping.receiver_phone
*
* @param receiverPhone the value for neuedu_shipping.receiver_phone
*
* @mbg.generated
*/
public void setReceiverPhone(String receiverPhone) {
this.receiverPhone = receiverPhone == null ? null : receiverPhone.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column neuedu_shipping.receiver_mobile
*
* @return the value of neuedu_shipping.receiver_mobile
*
* @mbg.generated
*/
public String getReceiverMobile() {
return receiverMobile;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column neuedu_shipping.receiver_mobile
*
* @param receiverMobile the value for neuedu_shipping.receiver_mobile
*
* @mbg.generated
*/
public void setReceiverMobile(String receiverMobile) {
this.receiverMobile = receiverMobile == null ? null : receiverMobile.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column neuedu_shipping.receiver_province
*
* @return the value of neuedu_shipping.receiver_province
*
* @mbg.generated
*/
public String getReceiverProvince() {
return receiverProvince;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column neuedu_shipping.receiver_province
*
* @param receiverProvince the value for neuedu_shipping.receiver_province
*
* @mbg.generated
*/
public void setReceiverProvince(String receiverProvince) {
this.receiverProvince = receiverProvince == null ? null : receiverProvince.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column neuedu_shipping.receiver_city
*
* @return the value of neuedu_shipping.receiver_city
*
* @mbg.generated
*/
public String getReceiverCity() {
return receiverCity;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column neuedu_shipping.receiver_city
*
* @param receiverCity the value for neuedu_shipping.receiver_city
*
* @mbg.generated
*/
public void setReceiverCity(String receiverCity) {
this.receiverCity = receiverCity == null ? null : receiverCity.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column neuedu_shipping.receiver_district
*
* @return the value of neuedu_shipping.receiver_district
*
* @mbg.generated
*/
public String getReceiverDistrict() {
return receiverDistrict;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column neuedu_shipping.receiver_district
*
* @param receiverDistrict the value for neuedu_shipping.receiver_district
*
* @mbg.generated
*/
public void setReceiverDistrict(String receiverDistrict) {
this.receiverDistrict = receiverDistrict == null ? null : receiverDistrict.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column neuedu_shipping.receiver_address
*
* @return the value of neuedu_shipping.receiver_address
*
* @mbg.generated
*/
public String getReceiverAddress() {
return receiverAddress;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column neuedu_shipping.receiver_address
*
* @param receiverAddress the value for neuedu_shipping.receiver_address
*
* @mbg.generated
*/
public void setReceiverAddress(String receiverAddress) {
this.receiverAddress = receiverAddress == null ? null : receiverAddress.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column neuedu_shipping.receiver_zip
*
* @return the value of neuedu_shipping.receiver_zip
*
* @mbg.generated
*/
public String getReceiverZip() {
return receiverZip;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column neuedu_shipping.receiver_zip
*
* @param receiverZip the value for neuedu_shipping.receiver_zip
*
* @mbg.generated
*/
public void setReceiverZip(String receiverZip) {
this.receiverZip = receiverZip == null ? null : receiverZip.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column neuedu_shipping.create_time
*
* @return the value of neuedu_shipping.create_time
*
* @mbg.generated
*/
public Date getCreateTime() {
return createTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column neuedu_shipping.create_time
*
* @param createTime the value for neuedu_shipping.create_time
*
* @mbg.generated
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column neuedu_shipping.update_time
*
* @return the value of neuedu_shipping.update_time
*
* @mbg.generated
*/
public Date getUpdateTime() {
return updateTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column neuedu_shipping.update_time
*
* @param updateTime the value for neuedu_shipping.update_time
*
* @mbg.generated
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
} | [
"hyc110214@163.com"
] | hyc110214@163.com |
0839c40e2c85e230a1214fa6c138d5f5628a7a4c | f01a039566621a87938bd5c7dcfcd9baf10c164e | /examples/junit4/MoneyTest.java | efc71268b0c8895f9739cb6f58dfbae61ad24da5 | [] | no_license | litaowan/JtestExample | 94ae4cc7c552de21d340571319adf3f8a6da4ce1 | b99138bc7dc6cd2aad7c4d2b353ab26284075a76 | refs/heads/master | 2020-05-22T11:38:18.323147 | 2019-05-13T03:30:34 | 2019-05-13T03:30:34 | 186,326,955 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,528 | java | package examples.junit4;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import junit.framework.JUnit4TestAdapter;
import org.junit.Before;
import org.junit.Test;
/**
* MoneyTest is a JUnit 4 test class for class Money and MoneyBag.
* @see examples.junit4.Money
*/
public class MoneyTest {
private Money f12CHF;
private Money f14CHF;
private Money f7USD;
private Money f21USD;
private IMoney fMB1;
private IMoney fMB2;
@Before public void setUp() {
f12CHF= new Money(12, "CHF");
f14CHF= new Money(14, "CHF");
f7USD= new Money( 7, "USD");
f21USD= new Money(21, "USD");
fMB1= MoneyBag.create(f12CHF, f7USD);
fMB2= MoneyBag.create(f14CHF, f21USD);
}
@Test public void testBagMultiply() {
// {[12 CHF][7 USD]} *2 == {[24 CHF][14 USD]}
IMoney expected= MoneyBag.create(new Money(24, "CHF"), new Money(14, "USD"));
assertEquals(expected, fMB1.multiply(2));
assertEquals(fMB1, fMB1.multiply(1));
assertTrue(fMB1.multiply(0).isZero());
}
@Test public void testBagNegate() {
// {[12 CHF][7 USD]} negate == {[-12 CHF][-7 USD]}
IMoney expected= MoneyBag.create(new Money(-12, "CHF"), new Money(-7, "USD"));
assertEquals(expected, fMB1.negate());
}
@Test public void testBagSimpleAdd() {
// {[12 CHF][7 USD]} + [14 CHF] == {[26 CHF][7 USD]}
IMoney expected= MoneyBag.create(new Money(26, "CHF"), new Money(7, "USD"));
assertEquals(expected, fMB1.add(f14CHF));
}
@Test public void testBagSubtract() {
// {[12 CHF][7 USD]} - {[14 CHF][21 USD] == {[-2 CHF][-14 USD]}
IMoney expected= MoneyBag.create(new Money(-2, "CHF"), new Money(-14, "USD"));
assertEquals(expected, fMB1.subtract(fMB2));
}
@Test public void testBagSumAdd() {
// {[12 CHF][7 USD]} + {[14 CHF][21 USD]} == {[26 CHF][28 USD]}
IMoney expected= MoneyBag.create(new Money(26, "CHF"), new Money(28, "USD"));
assertEquals(expected, fMB1.add(fMB2));
}
@Test public void testIsZero() {
assertTrue(fMB1.subtract(fMB1).isZero());
assertTrue(MoneyBag.create(new Money (0, "CHF"), new Money (0, "USD")).isZero());
}
@Test public void testMixedSimpleAdd() {
// [12 CHF] + [7 USD] == {[12 CHF][7 USD]}
IMoney expected= MoneyBag.create(f12CHF, f7USD);
assertEquals(expected, f12CHF.add(f7USD));
}
@Test public void testBagNotEquals() {
IMoney bag= MoneyBag.create(f12CHF, f7USD);
assertFalse(bag.equals(new Money(12, "DEM").add(f7USD)));
}
@Test public void testMoneyBagEquals() {
assertTrue(!fMB1.equals(null));
assertEquals(fMB1, fMB1);
IMoney equal= MoneyBag.create(new Money(12, "CHF"), new Money(7, "USD"));
assertTrue(fMB1.equals(equal));
assertTrue(!fMB1.equals(f12CHF));
assertTrue(!f12CHF.equals(fMB1));
assertTrue(!fMB1.equals(fMB2));
}
@Test public void testMoneyBagHash() {
IMoney equal= MoneyBag.create(new Money(12, "CHF"), new Money(7, "USD"));
assertEquals(fMB1.hashCode(), equal.hashCode());
}
@Test public void testMoneyEquals() {
assertTrue(!f12CHF.equals(null));
Money equalMoney= new Money(12, "CHF");
assertEquals(f12CHF, f12CHF);
assertEquals(f12CHF, equalMoney);
assertEquals(f12CHF.hashCode(), equalMoney.hashCode());
assertTrue(!f12CHF.equals(f14CHF));
}
@Test public void zeroMoniesAreEqualRegardlessOfCurrency() {
Money zeroDollars= new Money(0, "USD");
Money zeroFrancs= new Money(0, "CHF");
assertEquals(zeroDollars, zeroFrancs);
assertEquals(zeroDollars.hashCode(), zeroFrancs.hashCode());
}
@Test public void testMoneyHash() {
assertTrue(!f12CHF.equals(null));
Money equal= new Money(12, "CHF");
assertEquals(f12CHF.hashCode(), equal.hashCode());
}
@Test public void testSimplify() {
IMoney money= MoneyBag.create(new Money(26, "CHF"), new Money(28, "CHF"));
assertEquals(new Money(54, "CHF"), money);
}
@Test public void testNormalize2() {
// {[12 CHF][7 USD]} - [12 CHF] == [7 USD]
Money expected= new Money(7, "USD");
assertEquals(expected, fMB1.subtract(f12CHF));
}
@Test public void testNormalize3() {
// {[12 CHF][7 USD]} - {[12 CHF][3 USD]} == [4 USD]
IMoney ms1= MoneyBag.create(new Money(12, "CHF"), new Money(3, "USD"));
Money expected= new Money(4, "USD");
assertEquals(expected, fMB1.subtract(ms1));
}
@Test public void testNormalize4() { // [12 CHF] - {[12 CHF][3 USD]} == [-3 USD]
IMoney ms1= MoneyBag.create(new Money(12, "CHF"), new Money(3, "USD"));
Money expected= new Money(-3, "USD");
assertEquals(expected, f12CHF.subtract(ms1));
}
@Test public void testPrint() {
assertEquals("[12 CHF]", f12CHF.toString());
}
@Test public void testSimpleAdd() {
// [12 CHF] + [14 CHF] == [26 CHF]
Money expected= new Money(26, "CHF");
assertEquals(expected, f12CHF.add(f14CHF));
}
@Test public void testSimpleBagAdd() {
// [14 CHF] + {[12 CHF][7 USD]} == {[26 CHF][7 USD]}
IMoney expected= MoneyBag.create(new Money(26, "CHF"), new Money(7, "USD"));
assertEquals(expected, f14CHF.add(fMB1));
}
@Test public void testSimpleMultiply() {
// [14 CHF] *2 == [28 CHF]
Money expected= new Money(28, "CHF");
assertEquals(expected, f14CHF.multiply(2));
}
@Test public void testSimpleNegate() {
// [14 CHF] negate == [-14 CHF]
Money expected= new Money(-14, "CHF");
assertEquals(expected, f14CHF.negate());
}
@Test public void testSimpleSubtract() {
// [14 CHF] - [12 CHF] == [2 CHF]
Money expected= new Money(2, "CHF");
assertEquals(expected, f14CHF.subtract(f12CHF));
}
public Class getTestedClass() {
return Money.class;
}
} | [
"2781683768@qq.com"
] | 2781683768@qq.com |
12eaf7ac9b69bcdbf7dff3d83095029e3d6e6b4c | 81aaec416bf47dfba52ebfd657e17dbab0ed5c97 | /app/src/main/java/com/digestivethinking/madridshops/fragments/ShopsFragment.java | 1c85f3314852ab3fac85295dcd09aa36b31008e8 | [] | no_license | pigmonchu/MadridShoppingAndroid | adbc81740858c5f1c92a4a07023ad4b39c9b0ebf | 7807eab11628401d891a5bb8fc0e0aa74a83e8ba | refs/heads/master | 2020-12-02T18:05:00.965022 | 2017-07-10T06:02:13 | 2017-07-10T06:02:13 | 96,469,146 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,178 | java | package com.digestivethinking.madridshops.fragments;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.digestivethinking.madridshops.R;
import com.digestivethinking.madridshops.adapters.ShopsAdapter;
import com.digestivethinking.madridshops.domain.model.Shop;
import com.digestivethinking.madridshops.domain.model.Shops;
import com.digestivethinking.madridshops.views.OnElementClick;
import java.lang.ref.WeakReference;
public class ShopsFragment extends Fragment {
private OnElementClick<Shop> listener;
private RecyclerView shopsRecyclerView;
private ShopsAdapter adapter;
private Shops shops;
public ShopsFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_shops, container, false);
shopsRecyclerView = (RecyclerView) view.findViewById(R.id.fragment_shops__recycler_view);
shopsRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
return view;
}
public void setShops(Shops shops) {
this.shops = shops;
adapter = new ShopsAdapter(shops, getActivity());
shopsRecyclerView.setAdapter(adapter);
adapter.setOnClickListener(new OnElementClick<Shop>() {
@Override
public void clickedOn(@NonNull Shop shop, int position) {
Log.d("Click", shop.getName());
if (listener != null) {
ShopsFragment.this.listener.clickedOn(shop, position);
}
}
});
}
public void setOnElementClickListener(OnElementClick<Shop> listener) {
this.listener = listener;
}
}
| [
"monterdi@gmail.com"
] | monterdi@gmail.com |
a1a52592a509a40e883127b649eb594e41387e75 | e8246c71b0635c26371695d57e2e74a023347924 | /backend/web/src/main/java/com/smingjob/web/repositories/AliveRepository.java | 37ff7f17d720354c41cbc25193a7725b6bf962af | [] | no_license | hemolee/JobALive | a1da5372310223959481c306fd1c4d41b0a4b80d | 40ee27fff3322d15cf5a50ba3c9a75f1626cd1f5 | refs/heads/master | 2023-02-16T01:08:13.225913 | 2019-07-22T11:49:23 | 2019-07-22T11:49:23 | 197,924,441 | 0 | 0 | null | 2021-01-05T12:15:08 | 2019-07-20T12:00:25 | JavaScript | UTF-8 | Java | false | false | 283 | java | package com.smingjob.web.repositories;
import com.smingjob.web.enttites.Alive;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface AliveRepository extends JpaRepository<Alive, Long> {
} | [
"lhm73012@gmail.com"
] | lhm73012@gmail.com |
1ae4b38612d0e9e93a66e2ea0b5ca2a1b8f30790 | 0af8b92686a58eb0b64e319b22411432aca7a8f3 | /single-large-project/src/test/java/org/gradle/test/performancenull_447/Testnull_44655.java | 8a30479573e0a715ac20d5f36ca6a239703508b4 | [] | no_license | gradle/performance-comparisons | b0d38db37c326e0ce271abebdb3c91769b860799 | e53dc7182fafcf9fedf07920cbbea8b40ee4eef4 | refs/heads/master | 2023-08-14T19:24:39.164276 | 2022-11-24T05:18:33 | 2022-11-24T05:18:33 | 80,121,268 | 17 | 15 | null | 2022-09-30T08:04:35 | 2017-01-26T14:25:33 | null | UTF-8 | Java | false | false | 308 | java | package org.gradle.test.performancenull_447;
import static org.junit.Assert.*;
public class Testnull_44655 {
private final Productionnull_44655 production = new Productionnull_44655("value");
@org.junit.Test
public void test() {
assertEquals(production.getProperty(), "value");
}
} | [
"cedric.champeau@gmail.com"
] | cedric.champeau@gmail.com |
da5319f639ee333e8948e3ede27336eca721da7e | 9798b9682e2fa6ccff42387ba8f9c754bad2c5fa | /fast-orm/src/main/java/com/che/fast_orm/helper/SqlGenerater.java | 4f3e886238505fb2ac9f771192002c58c5c12aee | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | LovingMy/BaseUtil | d9fc89d31d17c8a3487f04c731298aa599eaeb35 | ba8773682d5e6d9e7f1b43e5ebed7d7a7b61d026 | refs/heads/master | 2021-01-19T16:01:25.195680 | 2016-09-19T12:26:09 | 2016-09-19T12:26:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,023 | java | package com.che.fast_orm.helper;
/**
* Sql语句生成器
* <p>
* 作者:余天然 on 16/9/15 下午9:03
*/
public class SqlGenerater {
public final static String BAK_SUFFIX = "_bak";//备份的后缀
/**
* 生成create语句
* <p>
* 格式:create table Student(id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, age TEXT)
*/
public static String create(Class<?> clazz) {
TableWrapper wrapper = ReflectHelper.parseClass(clazz);
//拼接:create table Student(id INTEGER PRIMARY KEY AUTOINCREMENT,
StringBuilder sb = new StringBuilder("create table if not exists " + wrapper.name);
//拼接:(id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, age TEXT)
sb.append(TypeConverter.zipNameType(wrapper));
return sb.toString();
}
/**
* 生成drop语句
* <p>
* 格式:drop table if exists Student;
*/
public static String drop(Class<?> clazz) {
StringBuilder sb = new StringBuilder("drop table if exists " + ReflectHelper.getTableName(clazz));
return sb.toString();
}
/**
* 生成insert语句
* <p>
* 格式:insert or replace into Student (name,age) values ('Fishyer',23)
*/
public static <T> String insert(T t) {
TableWrapper wrapper = ReflectHelper.parseObject(t);
//拼接:insert into Student
StringBuilder sb = new StringBuilder("insert or replace into " + wrapper.name + " ");
//拼接:(name,age)
sb.append(TypeConverter.zipName(wrapper));
//拼接: values
sb.append(" values ");
//拼接:('Fishyer',23)
sb.append(TypeConverter.zipValue(wrapper));
return sb.toString();
}
/**
* 生成queryAll语句
* <p>
* 格式:select * from Student
*/
public static String queryAll(Class<?> clazz) {
StringBuilder sb = new StringBuilder("select * from " + ReflectHelper.getTableName(clazz));
return sb.toString();
}
/**
* 生成deleteAll语句
* <p>
* 格式:delete from Student
*/
public static String deleteAll(Class<?> clazz) {
StringBuilder sb = new StringBuilder("delete from " + ReflectHelper.getTableName(clazz));
return sb.toString();
}
/**
* 生成queryObj语句
* <p>
* 格式:select * from Student where name='Fishyer' and age=23
*/
public static <T> String queryObj(T t) {
TableWrapper wrapper = ReflectHelper.parseObject(t);
//拼接:select * from Student
StringBuilder sb = new StringBuilder("select * from " + wrapper.name);
//拼接: where name='Fishyer' and age=23
sb.append(TypeConverter.zipConnNameValue(wrapper));
return sb.toString();
}
/**
* 生成deleteObj语句
* <p>
* 格式:delete from Student where name='Fishyer' and age=23
*/
public static <T> String deleteObj(T t) {
TableWrapper wrapper = ReflectHelper.parseObject(t);
//拼接:select * from Student
StringBuilder sb = new StringBuilder("delete from " + wrapper.name);
//拼接: where name='Fishyer' and age=23
sb.append(TypeConverter.zipConnNameValue(wrapper));
return sb.toString();
}
/**
* 生成bak语句
* <p>
* 格式:create table Student2 as select *from Student
*/
public static <T> String bak(Class<T> clazz) {
String table = ReflectHelper.getTableName(clazz);
String tableBak = table + BAK_SUFFIX;
StringBuilder sb = new StringBuilder("create table " + tableBak + " as select *from " + table);
return sb.toString();
}
/**
* 生成queryBak语句
* <p>
* 格式:select * from Student
*/
public static String queryBak(Class<?> clazz) {
StringBuilder sb = new StringBuilder("select * from " + ReflectHelper.getTableName(clazz) + BAK_SUFFIX);
return sb.toString();
}
}
| [
"yutianran@che.com"
] | yutianran@che.com |
c1238f2cbdd709e1631661b9f9c6b196ba7c5702 | b7012c80a3086d5935ac520cd3918be784e99af2 | /src/Lecture5/SimpleThread/ThreeThreadsTest.java | 2db91a3530b90b46a72232285e530c03c502988f | [] | no_license | SuienS/concurrent-programming | 677e7c8e2b6486f4aa6ee9f099eacaa811e4e779 | 4cfcb1f80178125db8a1a21845b433cf0f282361 | refs/heads/main | 2023-05-15T23:10:39.181181 | 2020-11-08T10:44:24 | 2020-11-08T10:44:24 | 311,038,106 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 583 | java | /*
package Lecture5.SimpleThread;
public class ThreeThreadsTest {
public static void main (String args[])
{
// Declare 3 thread variables
Thread firstThrd ;
Thread secondThrd ;
Thread thirdThrd ;
// Create the 3 threads
firstThrd = new SimpleThread("FirstThread") ;
secondThrd = new SimpleThread("SecondThread") ;
thirdThrd = new SimpleThread("ThirdThread") ;
// Start the 3 threads executing
firstThrd.start() ;
secondThrd.start() ;
thirdThrd.start() ;
}
}
*/
| [
"ravidu.rocks@gmail.com"
] | ravidu.rocks@gmail.com |
db600dd4a15f84e9d8cc394f77df779a6113cc8f | d5005ff5e9b921c39d32f40fb2787755b88abbb7 | /OrikaTesting/src/au/com/home/local/orika/output/IndividualDetail.java | c320494942db5f5b32d246250a608ad7ae64b93a | [] | no_license | sushantwarik/macproject | 99d51777e8c080b6f64adbe6f56f778de5cdaaf6 | 89990dfcb969ee2c3b4e856d9f4acf02fde17d80 | refs/heads/master | 2022-11-18T07:02:57.317015 | 2019-08-19T09:43:43 | 2019-08-19T09:43:43 | 71,018,655 | 0 | 0 | null | 2022-11-16T04:59:35 | 2016-10-15T23:15:13 | Java | UTF-8 | Java | false | false | 513 | java | package au.com.home.local.orika.output;
public class IndividualDetail {
private NamePart name;
private String dateOfBirth;
private String sex;
public NamePart getName() {
return name;
}
public void setName(NamePart name) {
this.name = name;
}
public String getDateOfBirth() {
return dateOfBirth;
}
public void setDateOfBirth(String dateOfBirth) {
this.dateOfBirth = dateOfBirth;
}
public String getSex() {
return sex;
}
public void setSex(String gender) {
this.sex = gender;
}
}
| [
"sushant.warik@outlook.com"
] | sushant.warik@outlook.com |
97050c661cad39b8e48587c33207b6c8192f2e48 | f1824494a26543ccbb686b7090d6c56250554f77 | /src/main/java/com/wrox/Filter/AuthenticationFilter.java | eaa0c1ccbfa729842f03073dfe43e26cc8d4b165 | [] | no_license | zxg680/javaweb | fd244f0664c71edbf239b9f09f5b25de850648cd | ca5c5027db12ca8cb6bfe7a6f44912289f4f790e | refs/heads/master | 2021-01-23T10:29:30.400560 | 2017-06-01T14:19:14 | 2017-06-01T14:19:14 | 93,064,623 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,380 | java | /**
* @Title: AuthenticationFilter.java
* @Package com.wrox.Filter
* @Description: TODO
* @author Xiaogang.Zhang
* @date 2017年5月29日 下午8:14:12
* @version V1.0
*/
package com.wrox.Filter;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
/**
* @ClassName: AuthenticationFilter
* @Description: TODO
* @author Xiaogang.Zhang
* @date 2017年5月29日 下午8:14:12
*
*/
public class AuthenticationFilter implements Filter {
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
HttpSession session = ((HttpServletRequest) request).getSession(false);
if (session != null && session.getAttribute("username") == null) {
((HttpServletResponse) response).sendRedirect("login");
} else {
chain.doFilter(request, response);
}
}
@Override
public void init(FilterConfig config) throws ServletException {
}
@Override
public void destroy() {
}
}
| [
"zxg680@163.com"
] | zxg680@163.com |
a5273105e2056322f2e6918de8c3f20e78ef16a0 | 1157ddeba3a715637d131a03820236ba072c48b3 | /omod/src/main/java/org/openmrs/module/drugshistory/page/controller/DrugsHistoryPageController.java | 6cfebf32364512f205d6c6db705e79cd5c8fe6d3 | [] | no_license | Guerschon/drugshistory | 0baf8f46e900d62cbeb66153969d6e25d13ef8de | e0e88d97d27dcc2a0a7eea3209223d41d037909f | refs/heads/master | 2020-07-07T01:53:16.153019 | 2016-09-16T16:13:07 | 2016-09-16T16:13:07 | 67,516,071 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 814 | java | package org.openmrs.module.drugshistory.page.controller;
import java.util.List;
import org.json.JSONObject;
import org.openmrs.Obs;
import org.openmrs.Patient;
import org.openmrs.api.context.Context;
import org.openmrs.module.drugshistory.api.DrugsHistoryService;
import org.openmrs.ui.framework.page.PageModel;
import org.springframework.web.bind.annotation.RequestParam;
public class DrugsHistoryPageController {
public void controller(PageModel model, @RequestParam("patientId") Patient patient) {
JSONObject patientOpts = new JSONObject();
patientOpts.put("name", patient.getPersonName().getFullName());
model.addAttribute("patientPropts", patientOpts);
List<Obs> drugname = Context.getService(DrugsHistoryService.class).getDrugsHistory(patient);
model.addAttribute("drugname", drugname);
}
}
| [
"francois_guerschon@yahoo.fr"
] | francois_guerschon@yahoo.fr |
79cf0ca6fe334c55b86bc9e12374d194352c72c2 | 48a773185c79945dbc3a989163a743b45ba26077 | /model2/src/com/naver/action/BoardModifyView.java | 1c38343ab9cc283bd0a52a75ea6afd15bf7024f7 | [] | no_license | mochangyong/model2 | cc5ff86be720a6880847ea4e0093de8940ad4f25 | a3091a93ddd50aaadb99fd019e458ce8797f8cd1 | refs/heads/master | 2020-06-02T22:01:53.547007 | 2014-06-11T08:20:07 | 2014-06-11T08:20:07 | null | 0 | 0 | null | null | null | null | UHC | Java | false | false | 986 | java | package com.naver.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.naver.dao.Board18DAO;
import com.naver.model.Board18Bean;
public class BoardModifyView implements Action {
@Override
public ActionForward execute(HttpServletRequest request,
HttpServletResponse response) throws Exception {
ActionForward forward = new ActionForward();
request.setCharacterEncoding("euc-kr");
Board18DAO boarddao = new Board18DAO();
Board18Bean boarddata = new Board18Bean();
int no = Integer.parseInt(request.getParameter("no"));
boarddata = boarddao.getDetail(no);
if(boarddata == null ){
System.out.println("(수정)상세보기 실패");
return null;
}
System.out.println("(수정)상세보기 성공");
request.setAttribute("boarddata", boarddata);
forward.setRedirect(false);
forward.setPath("./board/board_modify.jsp");
return forward;
}
}
| [
"lee yunhee@my_computer"
] | lee yunhee@my_computer |
1fbb83923e8d7f32df99d3f5c055e9d2de3e30ec | 5fc8c26644b67fffa682c5d5e8c2de49051ac005 | /blockChainMonitor/src/main/java/com/fuzamei/service/ExceptionLogService.java | c2defd44b208fce44771d7910ca735f8fc5c4940 | [] | no_license | caibei1/blockChainMonitor | c08304e4a807a17d988bc725652a943db75460f0 | 7d90bedfc8b8efdc48d279c0c8036593de7629f8 | refs/heads/master | 2020-03-18T11:41:42.515450 | 2018-05-24T08:36:36 | 2018-05-24T08:36:36 | 134,686,282 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 461 | java | package com.fuzamei.service;
import com.fuzamei.entity.ExceptionLog;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
public interface ExceptionLogService {
boolean insertAppLog(ExceptionLog exceptionLog);
boolean updateExceptionState(@Param("id")int id,@Param("state")int state);
}
| [
"1536161955@qq.com"
] | 1536161955@qq.com |
4786fdbb633465446e1aebd58eac4356a859c336 | cebbb3eb50323299a9fc0bcb007dfc8ec4c33493 | /sidi-app-ptof/src/main/java/it/istruzione/ptof/helper/CustomCalendarExDeserializer.java | dedcad0e6eedaf9b0b1fb164874f66affe60ab4c | [] | no_license | sronca/sic | 386641239d827f7c1ae055b4a4f45933c6fd5daf | 2d725e1c4d7e9b38956386450ebcbc767cf2f7c9 | refs/heads/master | 2021-05-04T21:50:41.739660 | 2018-02-02T16:08:10 | 2018-02-02T16:08:10 | 119,974,741 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,039 | java | package it.istruzione.ptof.helper;
import java.io.IOException;
import java.text.ParseException;
import java.util.Calendar;
import org.apache.commons.lang3.time.FastDateFormat;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
public class CustomCalendarExDeserializer extends JsonDeserializer<Calendar> {
@Override
public Calendar deserialize(JsonParser jp, DeserializationContext ctxt)
throws IOException, JsonProcessingException {
try {
if(org.apache.commons.lang.StringUtils.isBlank(jp.getText())){
return null;
}
return CommonsUtility.getCalendar(FastDateFormat.getInstance("dd/MM/yyyy HH:mm").parse(jp.getText()));
} catch (ParseException e) {
// TODO Auto-generated catch block
throw new RuntimeException(e);
}
}
}
| [
"s.ronca@prismaprogetti.it"
] | s.ronca@prismaprogetti.it |
f821db197120e5a32242403e5cf527ab979bc58e | e3e3cd88f96cd543f2b2befd34d39ad973294270 | /app/src/androidTest/java/jc/tarjetas/com/proyectotarjetas/ApplicationTest.java | 4de2741f50001474dd5136f53bcad9898c650c45 | [] | no_license | datoncito/ProyectoTarjetas | b8c3b64508d94aad65d96786285c3b7a57008008 | 2db543927c576b1abef7757b15d67fa94a96fd6d | refs/heads/master | 2021-01-19T09:41:07.400973 | 2014-12-11T00:41:07 | 2014-12-11T00:41:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 363 | java | package jc.tarjetas.com.proyectotarjetas;
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);
}
} | [
"jcampos@mexico-movil.com"
] | jcampos@mexico-movil.com |
cc31d7a6a2726a566c34ab9e3e4621f87e682f23 | 8e213530ea37b6cb081d06f03078bc681e07063c | /src/quiz/SortBubble.java | e11bc8b4987f3145aaa62a6619f758263c6c9fe9 | [] | no_license | kadun1/K01Java | 66cea669787e46a56909fe36a7e4e6ee2d61aaba | c80099bcd34d36636e0cb7d0f679930cc9a1ab47 | refs/heads/master | 2023-02-25T16:43:57.049059 | 2021-01-27T15:14:37 | 2021-01-27T15:14:37 | 309,946,553 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,970 | java | package quiz;
import java.util.Random;
import java.util.Scanner;
/*
버블정렬(Bubble Sort) : 정렬이 진행되는 과정이 거품이 보글보글 피어오르는
모습과 비슷하다 하여 지어진 명칭이다.
정렬 알고리즘 중에서는 가장 단순하고 효율성이 떨어지는 알고리즘이다.
데이터가 10개인 경우 45번의 비교가 필요하다.
*/
public class SortBubble {
//전역변수 형태로 생성하여 모든 메소드에서 접근가능
static Random rnd = new Random();
static Scanner scanner = new Scanner(System.in);
public static void main(String[] args) {
//1]중복되지 않는 난수 10개를 생성한다.
int[] arr = new int[10];
//난수생성후 arr배열에 저장하기 위한 메소드 호출
randomCreate(arr);
//2]생성된 난수를 통해 초기화된 배열을 출력한다.(정렬 전 출력)
showArray(arr, "난수생성직후 배열출력");
//3]정렬의 방법을 선택한다.(1.오름차순, 2.내림차순)
int orderSelect = menuSelect();
//4]버블정렬 알고리즘을 통한 정렬을 진행한다.
bubbleSort(arr, orderSelect);
//5]정렬된 결과를 출력한다(정렬 후 출력)
showArray(arr, "버블정렬 이후 배열출력");
}
public static void bubbleSort(int[] arrParam, int ordSel) {
//swap(자리변경)을 위한 임시변수 생성
int temp, swapCount=1;
/*
크기가 10인 배열이므로 스캔은 9번만 반복하면 된다.
즉, i의 증가치는 0~8까지 변하게 된다.
*/
for(int i=0 ; i<arrParam.length-1 ; i++) {
/*
실제 요소값에 대한 비교를 진행한다.
버블정렬의 목적은 오름차순일때 큰 숫자를 제일뒤로 보내주는
것이다. 즉 요소1과 요소2를 비교하여 요소1이 크다면
서로 자리를 바꿔서 큰 숫자를 뒤로 보내준다.
*/
for(int j=0 ; j<(arrParam.length-1)-i ; j++) {
/*
j가0일때 : arrParam[0] > arrParam[1] 비교
j가1일때 : arrParam[1] > arrParam[2] 비교
.....
*/
if(ordSel==1) {//오름차순을 선택했을때
if(arrParam[j] > arrParam[j+1]) {
/*
앞의 요소가 크다고 판단이 되면 서로 swap하여
자리를 서로 바꿔서 큰 숫자를 뒤로 보내준다.
*/
temp = arrParam[j];
arrParam[j] = arrParam[j+1];
arrParam[j+1] = temp;
//값의 변경이 있을때마다 배열전체 출력하기
showArray(arrParam,"SWAP중(오름차순 정렬중):"+
(swapCount++) + "회교환됨");
}
}
else if(ordSel==2) {//내림차순을 선택했을때
if(arrParam[j] < arrParam[j+1]) {
/*
앞의 요소가 작다고 판단이 되면 서로 swap하여
자리를 서로 바꿔서 작은 숫자를 뒤로 보내준다.
*/
temp = arrParam[j];
arrParam[j] = arrParam[j+1];
arrParam[j+1] = temp;
//값의 변경이 있을때마다 배열전체 출력하기
showArray(arrParam,"SWAP중(내림차순 정렬중):"+
(swapCount++) + "회교환됨");
}
}
}
}
}//end of bubbleSort()
public static int menuSelect() {
System.out.println("정렬할 방법을 선택하세요");
System.out.println("1.오름차순, 2.내림차순");
return scanner.nextInt();
}
public static void showArray(int[] arr, String message) {
System.out.println(message);
for(int i=0 ; i<arr.length ; i++) {
System.out.printf("%d ", arr[i]);
}
System.out.println();
}//end of showArray()
public static void randomCreate(int[] arrParam) {
//난수생성을 위한 씨드설정
rnd.setSeed(System.currentTimeMillis());
/*
난수생성 방법1:
1]난수 10개를 우선 생성한후 배열에 담아준다.
2]배열 전체를 대상으로 중복확인을 한다.
3]만약 중복되는 요소가 발견되면 다시 1번으로 돌아가서 난수를
생성한다.
4]중복되는 요소가 없다면 함수를 종료하고 메인으로 돌아간다.
*/
while(true) {
//1.난수10개 생성후 배열담기
for(int i=0 ; i<arrParam.length ; i++) {
arrParam[i] = rnd.nextInt(99) + 1;//1~99까지의 정수 생성
}
//2.중복확인
boolean rndFlag = false;/*중복체크를 위한 변수(false라면 중복된
난수가 없는경우이고, 중복된 난수가 발견된다면 true로
값을 변경할것임 */
for(int i=0 ; i<arrParam.length ; i++) {
for(int j=0 ; j<arrParam.length ; j++) {
/*
비교의 조건은 인덱스i와 인덱스j가 서로 다를때이다.
인덱스가 동일하다면 같은숫자일테니까...
*/
if(i!=j && arrParam[i]==arrParam[j]) {
//중복된 값이 발견된다면 true로 값을 변경
rndFlag = true;
}
}
}
//3.중복된값이 없다면 break로 while루프 탈출하기
if(rndFlag==false) break;
}//end of while
}//end of randomCreate()
}
| [
"kadunjj@gmail.com"
] | kadunjj@gmail.com |
34f538058d3694da9a9afeff69d8abf95258ae9c | 9712188a580f63f698c2a903151c1711b1680ff8 | /src/loops/Ptn3.java | c25ce8af8a12f255e6d443e58bb29081cce9a04a | [] | no_license | b19java0101/sheetal_assigment_1 | 975e8ef504c527b00b06db12b11173eb4fd7b328 | c20e9f4906ceb75b6095e7b3d301ccd25fe0fad0 | refs/heads/master | 2020-04-20T19:05:17.870748 | 2019-02-04T07:05:23 | 2019-02-04T07:05:23 | 169,039,616 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 261 | java | package loops;
class Ptn3
{
public static void main (String args[])
{
int i,j;
//for(i=1;i<=5;i++)
for(i=1;i<=5;i++)
{
//for(j=1;j<=i;j++)
for(j=5;j>=i;j--)
{
//System.out.print(i);
System.out.print(j);
}
System.out.println();
}}}
| [
"ACER@DESKTOP-4V51LTM"
] | ACER@DESKTOP-4V51LTM |
bd97091fe46d4132bd8f2904898e47826fcb7eb3 | 90446fee39885af358b61e596b8a89ff2198d02a | /Test/src/Test2.java | 830e709cbe90db077c9301b709e547f0d53404cd | [] | no_license | pawan-bloglovin/myRepository4 | ce384097d95a60771bf7f9b8ff8b7ceffb585d9d | 546eac3e4283a9e3dff604914ac57563b5d5c7f3 | refs/heads/master | 2021-01-10T05:25:03.094063 | 2016-03-02T12:09:03 | 2016-03-02T12:09:03 | 52,959,420 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 143 | java |
public class Test2 {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("");
}
}
| [
"pawan@bloglovin.com"
] | pawan@bloglovin.com |
0705f99f28ec04ccbb690173128dccb30a26e41c | 932f97398da1f32eb4f20d4664b0089a935ed01c | /app/src/test/java/net/pramodk/canvasapplication/ExampleUnitTest.java | 256212d5716251de325f619c8003e9e8520eaa81 | [] | no_license | Dual-Task/CanvasApplication | 1ed472c22ce9f703b25fe7a6c748e1a007136452 | 60728fb2d848e67743e515f585e44eccae0fc64c | refs/heads/master | 2020-04-03T12:51:59.423603 | 2018-10-29T19:10:47 | 2018-10-29T19:10:47 | 155,266,638 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 407 | java | package net.pramodk.canvasapplication;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"pramod.kotipalli@gmail.com"
] | pramod.kotipalli@gmail.com |
7575bb48f2e817cfe40b27537600fa642e8753f0 | 1279d9ce2d688e8f085683423414568383c3d44f | /Euler_8.java | a87ac1aad909d50ae361d558ddf0ebd653710d96 | [] | no_license | cofax48/Project-Euler | 4fb886fc32929e71ce1356f557e01c7751f2e482 | d1472806e406d1114b3676c3881910698b48343f | refs/heads/master | 2021-01-20T18:15:07.172440 | 2018-09-21T19:59:03 | 2018-09-21T19:59:03 | 90,911,526 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,635 | java | public class Euler_8 {
public static void main(String args[]) {
String longNum = "7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729629049156044077239071381051585930796086670172427121883998797908792274921901699720888093776657273330010533678812202354218097512545405947522435258490771167055601360483958644670632441572215539753697817977846174064955149290862569321978468622482839722413756570560574902614079729686524145351004748216637048440319989000889524345065854122758866688116427171479924442928230863465674813919123162824586178664583591245665294765456828489128831426076900422421902267105562632111110937054421750694165896040807198403850962455444362981230987879927244284909188845801561660979191338754992005240636899125607176060588611646710940507754100225698315520005593572972571636269561882670428252483600823257530420752963450";
long longNumLength = longNum.length() - 12;
int i = 0;
long highestProdSum = 0;
while (i < longNumLength) {
long firstNum = Long.parseLong(Character.toString(longNum.charAt(i)));
long secondNum = Long.parseLong(Character.toString(longNum.charAt(i + 1)));
long thirdNum = Long.parseLong(Character.toString(longNum.charAt(i + 2)));
long fourthNum = Long.parseLong(Character.toString(longNum.charAt(i + 3)));
long fiveNum = Long.parseLong(Character.toString(longNum.charAt(i + 4)));
long sixNum = Long.parseLong(Character.toString(longNum.charAt(i + 5)));
long sevNum = Long.parseLong(Character.toString(longNum.charAt(i + 6)));
long eightNum = Long.parseLong(Character.toString(longNum.charAt(i + 7)));
long nineNum = Long.parseLong(Character.toString(longNum.charAt(i + 8)));
long tenNum = Long.parseLong(Character.toString(longNum.charAt(i + 9)));
long elevNum = Long.parseLong(Character.toString(longNum.charAt(i + 10)));
long twelvNum = Long.parseLong(Character.toString(longNum.charAt(i + 11)));
long thirtNum = Long.parseLong(Character.toString(longNum.charAt(i + 12)));
long numSum = firstNum * secondNum * thirdNum * fourthNum * fiveNum * sixNum
* sevNum * eightNum * nineNum * tenNum * elevNum * twelvNum * thirtNum;
if (numSum >= highestProdSum) {
highestProdSum = numSum;
System.out.println(numSum);
}
i++;
}
System.out.println("The greatest product is: " + highestProdSum);
}
}
| [
"cofax48@uchicago.edu"
] | cofax48@uchicago.edu |
26c0ab8c42c359d8c0dac02541f535007d3a54e3 | 7bddbcc6ae7a317abe1085c2d338529f9972500d | /app/src/main/java/com/orange/oy/activity/shakephoto_318/PutInTask2Activity.java | 6d841d71181540a758763b5434fb40033974932c | [] | no_license | cherry98/Rose_ouye | a76158443444bb46bc03b402f44ff3f7723626a4 | 705a1cfedea65ac92e8cee2ef2421bbee56aed4c | refs/heads/master | 2020-03-28T15:44:50.818307 | 2018-09-13T10:36:14 | 2018-09-13T10:36:14 | 148,622,312 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 24,545 | java | package com.orange.oy.activity.shakephoto_318;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.handmark.pulltorefresh.library.PullToRefreshBase;
import com.handmark.pulltorefresh.library.PullToRefreshListView;
import com.orange.oy.R;
import com.orange.oy.activity.createtask_317.TaskCheckDesActivity;
import com.orange.oy.activity.createtask_317.TaskMouldActivity;
import com.orange.oy.activity.createtask_321.AddfeeActivity;
import com.orange.oy.activity.shakephoto_316.CollectPhotoActivity;
import com.orange.oy.adapter.PutInTaskAdapter2;
import com.orange.oy.base.AppInfo;
import com.orange.oy.base.BaseActivity;
import com.orange.oy.base.MyUMShareUtils;
import com.orange.oy.base.Tools;
import com.orange.oy.dialog.ConfirmDialog;
import com.orange.oy.dialog.CustomProgressDialog;
import com.orange.oy.dialog.UMShareDialog;
import com.orange.oy.info.PutInTaskInfo;
import com.orange.oy.network.NetworkConnection;
import com.orange.oy.network.NetworkView;
import com.orange.oy.network.Urls;
import com.orange.oy.view.AppTitle;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import static com.orange.oy.R.id.putin_listview2;
import static com.orange.oy.R.id.putin_listview3;
import static com.orange.oy.R.id.putin_one;
import static com.orange.oy.R.id.putin_oneing;
import static com.orange.oy.R.id.putin_three;
import static com.orange.oy.R.id.putin_threeing;
import static com.orange.oy.R.id.putin_two;
import static com.orange.oy.R.id.putin_twoing;
/**
* beibei 我发布的任务(已投放,草稿箱,已结束) 把V3.17拆成三个页面
*/
public class PutInTask2Activity extends BaseActivity implements AppTitle.OnBackClickForAppTitle,
PutInTaskAdapter2.IPutInTask {
private void initTitle() {
appTitle = (AppTitle) findViewById(R.id.titleview);
appTitle.showBack(this);
if (!Tools.isEmpty(activity_status)) {
switch (activity_status) {
case "1":
appTitle.settingName("草稿箱");
//右侧有删除按钮
settingDel1();
break;
case "2":
appTitle.settingName("投放中");
break;
default:
appTitle.settingName("已结束");
break;
}
}
}
private void settingDel1() {
appTitle.hideExit();
if (putInTaskAdapter != null) {
putInTaskAdapter.setDelet(false);
}
appTitle.showIllustrate(R.mipmap.grrw_button_shanchu, new AppTitle.OnExitClickForAppTitle() {
public void onExit() {
settingDel2();
}
});
}
private void settingDel2() {
appTitle.hideIllustrate();
if (putInTaskAdapter != null) {
putInTaskAdapter.setDelet(true);
}
appTitle.settingExit("完成", new AppTitle.OnExitClickForAppTitle() {
public void onExit() {
settingDel1();
}
});
}
private void iniNetworkConnection() {
activityList = new NetworkConnection(this) {
public Map<String, String> getNetworkParams() {
Map<String, String> params = new HashMap<>();
params.put("usermobile", AppInfo.getName(PutInTask2Activity.this));
params.put("token", Tools.getToken());
params.put("activity_status", activity_status); // 活动状态1:草稿箱未发布;2:投放中;3:已结束
params.put("page", page + "");
params.put("sort_type", "2");//按创建时间排序,1为正序,2为倒序,不传时默认为正序
return params;
}
};
closeProject = new NetworkConnection(this) {
public Map<String, String> getNetworkParams() {
Map<String, String> params = new HashMap<>();
params.put("usermobile", AppInfo.getName(PutInTask2Activity.this));
params.put("token", Tools.getToken());
params.put("project_id", project_id);
return params;
}
};
delActivityInfo = new NetworkConnection(this) {
public Map<String, String> getNetworkParams() {
Map<String, String> params = new HashMap<>();
params.put("usermobile", AppInfo.getName(PutInTask2Activity.this));
params.put("token", Tools.getToken());
params.put("ai_id", ai_id); // ai_id 活动id【必传】
return params;
}
};
}
public void onResume() {
super.onResume();
if (activity_status != null) {
getDataLeft();
}
}
public void onPause() {
super.onPause();
}
public void onStop() {
super.onStop();
if (activityList != null) {
activityList.stop(Urls.ActivityList);
}
if (closeProject != null) {
closeProject.stop(Urls.CloseProject);
}
if (delActivityInfo != null) {
delActivityInfo.stop(Urls.DelActivityInfo);
}
}
private String activity_status, project_id, ai_id;
public static final String TAG = PutInTask2Activity.class.getName();
private NetworkConnection activityList, delActivityInfo;
private NetworkConnection closeProject;
private ArrayList<PutInTaskInfo> listLeft;
private PullToRefreshListView putin_listview;
private NetworkView putin_networkview;
private PutInTaskAdapter2 putInTaskAdapter;
private AppTitle appTitle;
private int page = 1;
private String IsGrantInAidActivity; //判断是否从赞助费存为草稿来的
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_putin_task);
putin_listview = (PullToRefreshListView) findViewById(R.id.putin_listview);
putin_networkview = (NetworkView) findViewById(R.id.putin_networkview);
activity_status = getIntent().getStringExtra("activity_status");
initTitle();
iniNetworkConnection();
initView();
refreshListView();
IsGrantInAidActivity = getIntent().getStringExtra("IsGrantInAidActivity");
}
private void initView() throws NullPointerException {
listLeft = new ArrayList<>();
putInTaskAdapter = new PutInTaskAdapter2(PutInTask2Activity.this, listLeft, activity_status);
putin_listview.setAdapter(putInTaskAdapter);
putInTaskAdapter.setiPutInTask(this);
}
public void getDataLeft() {
activityList.stop(Urls.ActivityList);
activityList.sendPostRequest(Urls.ActivityList, new Response.Listener<String>() {
public void onResponse(String s) {
Tools.d(s);
JSONObject jsonObject;
try {
jsonObject = new JSONObject(s);
if ("200".equals(jsonObject.getString("code"))) {
if (page == 1) {
if (listLeft != null)
listLeft.clear();
else
listLeft = new ArrayList<PutInTaskInfo>();
}
putin_listview.onRefreshComplete();
if (!jsonObject.isNull("data")) {
JSONArray jsonArray = jsonObject.getJSONObject("data").getJSONArray("list");
int length = jsonArray.length();
if (length > 0) {
putin_networkview.setVisibility(View.GONE);
for (int i = 0; i < length; i++) {
jsonObject = jsonArray.getJSONObject(i);
PutInTaskInfo putInTaskInfo = new PutInTaskInfo();
putInTaskInfo.setAi_id(jsonObject.optString("ai_id"));
putInTaskInfo.setActivity_name(jsonObject.optString("activity_name"));
putInTaskInfo.setTarget_num(jsonObject.optString("target_num")); //目标照片数
putInTaskInfo.setGet_num(jsonObject.optString("get_num")); //收到的照片数
putInTaskInfo.setBegin_date(jsonObject.optString("begin_date"));
putInTaskInfo.setEnd_date(jsonObject.optString("end_date"));
putInTaskInfo.setActivity_status(jsonObject.optString("activity_status"));
putInTaskInfo.setActivity_type(jsonObject.optString("activity_type")); //活动类型(1:集图活动;2:偶业项目)
putInTaskInfo.setProject_id(jsonObject.optString("project_id"));
putInTaskInfo.setTemplate_img(jsonObject.optString("template_img")); //图标
putInTaskInfo.setProject_total_money(jsonObject.optString("project_total_money"));
putInTaskInfo.setMoney(jsonObject.optString("money")); // 执行单价
putInTaskInfo.setTotal_num(jsonObject.optString("total_num")); //执行总量
putInTaskInfo.setGettask_num(jsonObject.optString("gettask_num"));//已领数量
putInTaskInfo.setDone_num(jsonObject.optString("done_num")); // 已做数量
putInTaskInfo.setCheck_num(jsonObject.optString("check_num")); // 待审核数量
putInTaskInfo.setComplete_num(jsonObject.optString("complete_num")); // 已做数量
putInTaskInfo.setPass_num(jsonObject.optString("pass_num"));
putInTaskInfo.setUnpass_num(jsonObject.optString("unpass_num"));
putInTaskInfo.setReward_money(jsonObject.optString("reward_money")); //发放奖励金额"
putInTaskInfo.setAd_show_num(jsonObject.optString("ad_show_num"));
putInTaskInfo.setAd_click_num(jsonObject.optString("ad_click_num"));
putInTaskInfo.setSponsor_num(jsonObject.optString("sponsor_num"));
// 活动状态1:草稿箱未发布;2:投放中;3:已结束
listLeft.add(putInTaskInfo);
}
if (putInTaskAdapter != null) {
putInTaskAdapter.notifyDataSetChanged();
}
if (length < 15) {
putin_listview.setMode(PullToRefreshBase.Mode.PULL_FROM_START);
} else {
putin_listview.setMode(PullToRefreshBase.Mode.BOTH);
}
} else {
if (page == 1) {
putin_networkview.setVisibility(View.VISIBLE);
if ("2".equals(activity_status)) {
putin_listview.setVisibility(View.GONE);
putin_networkview.SettingMSG(R.mipmap.grrw_image, "没有投放中的任务哦~");
} else if ("1".equals(activity_status)) {
putin_listview.setVisibility(View.GONE);
putin_networkview.SettingMSG(R.mipmap.grrw_image, "草稿箱是空的哦~");
} else if ("3".equals(activity_status)) {
putin_listview.setVisibility(View.GONE);
putin_networkview.SettingMSG(R.mipmap.grrw_image, "暂无结束活动哦~");
}
} else {
putin_listview.setMode(PullToRefreshBase.Mode.PULL_FROM_START);
}
}
}
} else {
Tools.showToast(PutInTask2Activity.this, jsonObject.getString("msg"));
}
} catch (JSONException e) {
Tools.showToast(PutInTask2Activity.this, getResources().getString(R.string.network_error));
putin_listview.onRefreshComplete();
}
putin_listview.onRefreshComplete();
}
}, new Response.ErrorListener()
{
public void onErrorResponse(VolleyError volleyError) {
try {
activityList.stop(Urls.ActivityList);
putin_listview.onRefreshComplete();
putin_networkview.setVisibility(View.VISIBLE);
putin_networkview.NoNetwork(getResources().getString(R.string.network_fail) + "点击重试");
putin_networkview.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
putin_networkview.setOnClickListener(null);
putin_networkview.NoNetwork("正在重试...");
getDataLeft();
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
private void refreshListView() {
putin_listview.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener2<ListView>() {
@Override
public void onPullDownToRefresh(PullToRefreshBase<ListView> refreshView) {
page = 1;
getDataLeft();
}
@Override
public void onPullUpToRefresh(PullToRefreshBase<ListView> refreshView) {
page++;
getDataLeft();
}
});
}
@Override
public void onBack() {
baseFinish();
}
// "activity_type":"活动类型(1:集图活动;2:偶业项目)"
@Override
public void PutIntask(int position) {//草稿箱投放(可编辑)
if (listLeft != null && !listLeft.isEmpty() && position < listLeft.size()) {
PutInTaskInfo putInTaskInfo = listLeft.get(position);
if (putInTaskInfo.getActivity_type().equals("2")) {
project_id = putInTaskInfo.getProject_id();
Intent intent = new Intent(this, TaskMouldActivity.class);
intent.putExtra("project_id", project_id);
intent.putExtra("which_page", "1");
startActivity(intent);
} else {
Intent intent = new Intent(this, CollectPhotoActivity.class);
intent.putExtra("ai_id", listLeft.get(position).getAi_id());
intent.putExtra("which_page", "2");//草稿箱 集图活动 V3.20
startActivity(intent);
}
}
}
@Override
public void NextPutIntask(int position) { //再投放
if (listLeft != null && !listLeft.isEmpty() && position < listLeft.size()) {
PutInTaskInfo putInTaskInfo = listLeft.get(position);
project_id = putInTaskInfo.getProject_id();
Intent intent = new Intent(this, TaskMouldActivity.class);
intent.putExtra("project_id", project_id);
intent.putExtra("which_page", "2");
startActivity(intent);
}
}
@Override
public void Look(int position) { //已经结束的
if (listLeft != null && !listLeft.isEmpty() && position < listLeft.size()) {
PutInTaskInfo putInTaskInfo = listLeft.get(position);
project_id = putInTaskInfo.getProject_id();
Intent intent = new Intent(PutInTask2Activity.this, TaskCheckDesActivity.class);
intent.putExtra("IsTaskFinish", "2");
intent.putExtra("project_id", putInTaskInfo.getProject_id());
startActivity(intent);
}
}
@Override
public void Looktwo(int position) { //已投放的
if (listLeft != null && !listLeft.isEmpty() && position < listLeft.size()) {
PutInTaskInfo putInTaskInfo = listLeft.get(position);
project_id = putInTaskInfo.getProject_id();
Intent intent = new Intent(PutInTask2Activity.this, TaskCheckDesActivity.class);
intent.putExtra("IsTaskFinish", "1");
intent.putExtra("project_id", putInTaskInfo.getProject_id());
startActivity(intent);
}
}
//==================================集图活动==================================//
@Override
public void Edit(int position) { //集图活动编辑 V3.20
if (listLeft != null && !listLeft.isEmpty() && position < listLeft.size()) {
Intent intent = new Intent(this, CollectPhotoActivity.class);
intent.putExtra("ai_id", listLeft.get(position).getAi_id());
intent.putExtra("which_page", "1");//已投放->编辑
startActivity(intent);
}
}
@Override
public void Lookthree(int position) { //集图活动查看
if (listLeft != null && !listLeft.isEmpty() && position < listLeft.size()) {
PutInTaskInfo putInTaskInfo = listLeft.get(position);
Intent intent = new Intent(PutInTask2Activity.this, NewActivityDetailActivity.class);
intent.putExtra("activity_status", putInTaskInfo.getActivity_status());
intent.putExtra("ai_id", putInTaskInfo.getAi_id());
intent.putExtra("template_img", putInTaskInfo.getTemplate_img());
startActivity(intent);
}
}
@Override
public void PutIntasktwo(int position) { //草稿箱投放(可编辑) 集图活动
if (listLeft != null && !listLeft.isEmpty() && position < listLeft.size()) {
Intent intent = new Intent(this, CollectPhotoActivity.class);
intent.putExtra("ai_id", listLeft.get(position).getAi_id());
intent.putExtra("which_page", "2");
startActivity(intent);
}
}
public void FinishTask(int position) { //结束按钮
if (listLeft != null && !listLeft.isEmpty() && position < listLeft.size()) {
PutInTaskInfo putInTaskInfo = listLeft.get(position);
ConfirmDialog.showDialog(this, "提示", 1, "确定要结束这个活动吗?", "取消", "确定", putInTaskInfo, true,
new ConfirmDialog.OnSystemDialogClickListener() {
public void leftClick(Object object) {
}
public void rightClick(Object object) {
PutInTaskInfo putInTaskInfo = (PutInTaskInfo) object;
project_id = putInTaskInfo.getProject_id();
closeProject();
}
});
}
}
public void PutAgain(int position) {//集图再次投放 V3.20
if (listLeft != null && !listLeft.isEmpty() && position < listLeft.size()) {
Intent intent = new Intent(this, CollectPhotoActivity.class);
intent.putExtra("ai_id", listLeft.get(position).getAi_id());
intent.putExtra("which_page", "4");
intent.putExtra("putagain", true);
startActivity(intent);
}
}
@Override
public void deleteDraft(int position) { //删除草稿
if (listLeft != null && !listLeft.isEmpty() && position < listLeft.size()) {
ai_id = listLeft.get(position).getAi_id();
ConfirmDialog.showDialog(this, "您确定要删除草稿?", true, new ConfirmDialog.OnSystemDialogClickListener() {
@Override
public void leftClick(Object object) {
putInTaskAdapter.setDelet(false);
putInTaskAdapter.notifyDataSetChanged();
settingDel1();
}
@Override
public void rightClick(Object object) {
putInTaskAdapter.setDelet(false);
putInTaskAdapter.notifyDataSetChanged();
abandon();
settingDel1();
}
});
}
}
@Override
public void additionalexpenses(int position) {
if (listLeft != null && !listLeft.isEmpty() && position < listLeft.size()) {
Intent intent = new Intent(this, AddfeeActivity.class);
intent.putExtra("project_id", listLeft.get(position).getProject_id());
startActivity(intent);
}
}
private void abandon() {
delActivityInfo.sendPostRequest(Urls.DelActivityInfo, new Response.Listener<String>() {
@Override
public void onResponse(String s) {
Tools.d(s);
try {
JSONObject jsonObject = new JSONObject(s);
if (jsonObject.getInt("code") == 200) {
getDataLeft();
Tools.showToast(PutInTask2Activity.this, "删除成功");
} else {
Tools.showToast(PutInTask2Activity.this, jsonObject.getString("msg"));
}
} catch (JSONException e) {
Tools.showToast(PutInTask2Activity.this, getResources().getString(R.string.network_error));
}
CustomProgressDialog.Dissmiss();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError volleyError) {
Tools.showToast(PutInTask2Activity.this, getResources().getString(R.string.network_volleyerror));
CustomProgressDialog.Dissmiss();
}
});
}
private void closeProject() {
closeProject.sendPostRequest(Urls.CloseProject, new Response.Listener<String>() {
public void onResponse(String s) {
try {
JSONObject jsonObject = new JSONObject(s);
if (jsonObject.getInt("code") == 200) {
page = 1;
activity_status = "2";
getDataLeft();
ConfirmDialog.showDialog(PutInTask2Activity.this, "项目已关闭", 2, "剩余金额将在24小时内转回您的账户。", "",
"我知道了", null, true, null);
} else {
Tools.showToast(PutInTask2Activity.this, jsonObject.getString("msg"));
}
} catch (JSONException e) {
Tools.showToast(PutInTask2Activity.this, getResources().getString(R.string.network_error));
}
}
}, new Response.ErrorListener() {
public void onErrorResponse(VolleyError volleyError) {
Tools.showToast(PutInTask2Activity.this, getResources().getString(R.string.network_volleyerror));
}
});
}
public void Share(int position) {
if (listLeft != null && !listLeft.isEmpty() && position < listLeft.size()) {
final String webUrl = Urls.InviteToActivity + "usermobile=" +
AppInfo.getName(PutInTask2Activity.this) + "&ai_id=" + listLeft.get(position).getAi_id();
UMShareDialog.showDialog(PutInTask2Activity.this, false, new UMShareDialog.UMShareListener() {
public void shareOnclick(int type) {
MyUMShareUtils.umShare(PutInTask2Activity.this, type, webUrl);
}
});
}
}
}
| [
"cherry18515@163.com"
] | cherry18515@163.com |
a595a0adb54fa5530653832edbd9c41904608fc0 | 52019a46c8f25534afa491a5f68bf5598e68510b | /core/runtime/src/main/java/org/nakedobjects/runtime/objectstore/inmemory/internal/ObjectStoreInstances.java | 83efefcd9329872eea813236ec2f713c12068ec1 | [
"Apache-2.0"
] | permissive | JavaQualitasCorpus/nakedobjects-4.0.0 | e765b4980994be681e5562584ebcf41e8086c69a | 37ee250d4c8da969eac76749420064ca4c918e8e | refs/heads/master | 2023-08-29T13:48:01.268876 | 2020-06-02T18:07:23 | 2020-06-02T18:07:23 | 167,005,009 | 0 | 1 | Apache-2.0 | 2022-06-10T22:44:43 | 2019-01-22T14:08:50 | Java | UTF-8 | Java | false | false | 9,237 | java | package org.nakedobjects.runtime.objectstore.inmemory.internal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Vector;
import org.nakedobjects.applib.clock.Clock;
import org.nakedobjects.metamodel.adapter.NakedObject;
import org.nakedobjects.metamodel.adapter.oid.Oid;
import org.nakedobjects.metamodel.adapter.version.SerialNumberVersion;
import org.nakedobjects.metamodel.adapter.version.Version;
import org.nakedobjects.metamodel.authentication.AuthenticationSession;
import org.nakedobjects.metamodel.commons.debug.DebugString;
import org.nakedobjects.metamodel.spec.NakedObjectSpecification;
import org.nakedobjects.runtime.context.NakedObjectsContext;
import org.nakedobjects.runtime.objectstore.inmemory.InMemoryObjectStore;
import org.nakedobjects.runtime.persistence.PersistenceSession;
import org.nakedobjects.runtime.persistence.PersistenceSessionHydrator;
import org.nakedobjects.runtime.persistence.adaptermanager.AdapterManager;
import org.nakedobjects.runtime.persistence.query.PersistenceQueryBuiltIn;
import org.nakedobjects.runtime.persistence.query.PersistenceQueryFindByTitle;
/*
* The objects need to store in a repeatable sequence so the elements and instances method return the same data for any repeated
* call, and so that one subset of instances follows on the previous. This is done by keeping the objects in the order that they
* where created.
*/
public final class ObjectStoreInstances {
private final Map<Oid, Object> pojoByOidMap = new HashMap<Oid, Object>();
private final Map<Oid, String> titleByOidMap = new HashMap<Oid, String>();
private final Map<Oid, SerialNumberVersion> versionByOidMap = new HashMap<Oid, SerialNumberVersion>();
@SuppressWarnings("unused")
private final NakedObjectSpecification spec;
/////////////////////////////////////////////////////////
// Constructors
/////////////////////////////////////////////////////////
public ObjectStoreInstances(NakedObjectSpecification spec) {
this.spec = spec;
}
/////////////////////////////////////////////////////////
// Object Instances
/////////////////////////////////////////////////////////
/**
* TODO: shouldn't really be exposing this directly.
*/
public Map<Oid, Object> getObjectInstances() {
return pojoByOidMap;
}
public Set<Oid> getOids() {
return Collections.unmodifiableSet(pojoByOidMap.keySet());
}
public Object getPojo(Oid oid) {
return pojoByOidMap.get(oid);
}
public Version getVersion(Oid oid) {
return versionByOidMap.get(oid);
}
/////////////////////////////////////////////////////////
// shutdown
/////////////////////////////////////////////////////////
public void shutdown() {
pojoByOidMap.clear();
titleByOidMap.clear();
versionByOidMap.clear();
}
/////////////////////////////////////////////////////////
// save, remove
/////////////////////////////////////////////////////////
public void save(final NakedObject adapter) {
pojoByOidMap.put(adapter.getOid(), adapter.getObject());
titleByOidMap.put(adapter.getOid(), adapter.titleString().toLowerCase());
SerialNumberVersion version = versionByOidMap.get(adapter.getOid());
SerialNumberVersion nextVersion = nextVersion(version);
versionByOidMap.put(adapter.getOid(), nextVersion);
adapter.setOptimisticLock(nextVersion);
}
private synchronized SerialNumberVersion nextVersion(SerialNumberVersion version) {
long sequence = (version != null? version.getSequence(): 0) +1;
return new SerialNumberVersion(sequence, getAuthenticationSession().getUserName(), new Date(Clock.getTime()));
}
public void remove(final Oid oid) {
pojoByOidMap.remove(oid);
titleByOidMap.remove(oid);
versionByOidMap.remove(oid);
}
/////////////////////////////////////////////////////////
// retrieveObject
/////////////////////////////////////////////////////////
/**
* If the pojo exists in the object store, then looks up the
* {@link NakedObject adapter} from the {@link AdapterManager}, and only
* if none found does it {@link PersistenceSessionHydrator#recreateAdapter(Oid, Object) recreate}
* a new {@link NakedObject adapter}.
*/
public NakedObject retrieveObject(final Oid oid) {
final Object pojo = getObjectInstances().get(oid);
if (pojo == null) {
return null;
}
NakedObject adapterLookedUpByPojo = getAdapterManager().getAdapterFor(pojo);
if (adapterLookedUpByPojo != null) {
return adapterLookedUpByPojo;
}
NakedObject adapterLookedUpByOid = getAdapterManager().getAdapterFor(oid);
if (adapterLookedUpByOid != null) {
return adapterLookedUpByOid;
}
return getHydrator().recreateAdapter(oid, pojo);
}
/////////////////////////////////////////////////////////
// instances, numberOfInstances, hasInstances
/////////////////////////////////////////////////////////
/**
* Not API, but <tt>public</tt> so can be called by {@link InMemoryObjectStore}.
*/
public void findInstancesAndAdd(final PersistenceQueryBuiltIn persistenceQuery, final Vector<NakedObject> foundInstances) {
if (persistenceQuery instanceof PersistenceQueryFindByTitle) {
for (final Oid oid : titleByOidMap.keySet()) {
final String title = titleByOidMap.get(oid);
if (((PersistenceQueryFindByTitle) persistenceQuery).matches(title)) {
final NakedObject adapter = retrieveObject(oid);
foundInstances.add(adapter);
}
}
return;
}
for (final NakedObject element : elements()) {
if (persistenceQuery.matches(element)) {
foundInstances.addElement(element);
}
}
}
public int numberOfInstances() {
return getObjectInstances().size();
}
public boolean hasInstances() {
return numberOfInstances() > 0;
}
private List<NakedObject> elements() {
final List<NakedObject> v = new ArrayList<NakedObject>(getObjectInstances().size());
for (final Oid oid : getObjectInstances().keySet()) {
v.add(retrieveObject(oid));
}
return v;
}
/////////////////////////////////////////////////////////
// Debugging
/////////////////////////////////////////////////////////
public void debugData(final DebugString debug) {
debug.indent();
if (getObjectInstances().size() == 0) {
debug.appendln("no instances");
}
for (final Oid oid : getObjectInstances().keySet()) {
final String title = titleByOidMap.get(oid);
final Object object = getObjectInstances().get(oid);
debug.appendln(oid.toString(), object + " (" + title + ")");
}
debug.appendln();
debug.unindent();
}
// ///////////////////////////////////////////////////////
// Dependencies (from context)
// ///////////////////////////////////////////////////////
/**
* Must use {@link NakedObjectsContext context}, because although this object is recreated with each
* {@link PersistenceSession session}, the persisted objects that get
* {@link #attachPersistedObjects(MemoryObjectStorePersistedObjects) attached} to it span multiple
* sessions.
*
* <p>
* The alternative design would be to laboriously inject this object via the
* {@link InMemoryObjectStore}.
*/
private PersistenceSession getPersistenceSession() {
return NakedObjectsContext.getPersistenceSession();
}
/**
* Must use {@link NakedObjectsContext context}, because although this object is recreated with each
* {@link PersistenceSession session}, the persisted objects that get
* {@link #attachPersistedObjects(MemoryObjectStorePersistedObjects) attached} to it span multiple
* sessions.
*
* <p>
* The alternative design would be to laboriously inject this object via the
* {@link InMemoryObjectStore}.
*/
private AdapterManager getAdapterManager() {
return getPersistenceSession().getAdapterManager();
}
/**
* Must use {@link NakedObjectsContext context}, because although this object is recreated with each
* {@link PersistenceSession session}, the persisted objects that get
* {@link #attachPersistedObjects(MemoryObjectStorePersistedObjects) attached} to it span multiple
* sessions.
*
* <p>
* The alternative design would be to laboriously inject this object via the
* {@link InMemoryObjectStore}.
*/
private PersistenceSessionHydrator getHydrator() {
return getPersistenceSession();
}
private static AuthenticationSession getAuthenticationSession() {
return NakedObjectsContext.getAuthenticationSession();
}
}
// Copyright (c) Naked Objects Group Ltd.
| [
"taibi@sonar-scheduler.rd.tut.fi"
] | taibi@sonar-scheduler.rd.tut.fi |
a35e444f5a2f7fe0d70ccf591f88e8ea027694ca | fa10cb2e1f0d97a31e253a31029688e48001a28e | /src/main/java/com/ustcck/library/config/CacheConfiguration.java | a0e857f17619aea20f085055d9193af2b041bde4 | [] | no_license | ustcck/library | e1854f6ea0a8ded6316f379639a9f2147ac8d864 | fc4098e1302649fe2c73950fbf0659db18aa9103 | refs/heads/main | 2023-01-12T02:48:46.861510 | 2020-11-17T06:01:51 | 2020-11-17T06:01:51 | 313,521,962 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,610 | java | package com.ustcck.library.config;
import io.github.jhipster.config.JHipsterConstants;
import io.github.jhipster.config.JHipsterProperties;
import com.hazelcast.config.*;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.core.Hazelcast;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cache.CacheManager;
import org.springframework.boot.info.BuildProperties;
import org.springframework.boot.info.GitProperties;
import org.springframework.cache.interceptor.KeyGenerator;
import org.springframework.beans.factory.annotation.Autowired;
import io.github.jhipster.config.cache.PrefixedKeyGenerator;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.*;
import org.springframework.core.env.Environment;
import org.springframework.core.env.Profiles;
import javax.annotation.PreDestroy;
@Configuration
@EnableCaching
public class CacheConfiguration {
private GitProperties gitProperties;
private BuildProperties buildProperties;
private final Logger log = LoggerFactory.getLogger(CacheConfiguration.class);
private final Environment env;
public CacheConfiguration(Environment env) {
this.env = env;
}
@PreDestroy
public void destroy() {
log.info("Closing Cache Manager");
Hazelcast.shutdownAll();
}
@Bean
public CacheManager cacheManager(HazelcastInstance hazelcastInstance) {
log.debug("Starting HazelcastCacheManager");
return new com.hazelcast.spring.cache.HazelcastCacheManager(hazelcastInstance);
}
@Bean
public HazelcastInstance hazelcastInstance(JHipsterProperties jHipsterProperties) {
log.debug("Configuring Hazelcast");
HazelcastInstance hazelCastInstance = Hazelcast.getHazelcastInstanceByName("library");
if (hazelCastInstance != null) {
log.debug("Hazelcast already initialized");
return hazelCastInstance;
}
Config config = new Config();
config.setInstanceName("library");
config.getNetworkConfig().setPort(5701);
config.getNetworkConfig().setPortAutoIncrement(true);
// In development, remove multicast auto-configuration
if (env.acceptsProfiles(Profiles.of(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT))) {
System.setProperty("hazelcast.local.localAddress", "127.0.0.1");
config.getNetworkConfig().getJoin().getAwsConfig().setEnabled(false);
config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);
config.getNetworkConfig().getJoin().getTcpIpConfig().setEnabled(false);
}
config.getMapConfigs().put("default", initializeDefaultMapConfig(jHipsterProperties));
// Full reference is available at: https://docs.hazelcast.org/docs/management-center/3.9/manual/html/Deploying_and_Starting.html
config.setManagementCenterConfig(initializeDefaultManagementCenterConfig(jHipsterProperties));
config.getMapConfigs().put("com.ustcck.library.domain.*", initializeDomainMapConfig(jHipsterProperties));
return Hazelcast.newHazelcastInstance(config);
}
private ManagementCenterConfig initializeDefaultManagementCenterConfig(JHipsterProperties jHipsterProperties) {
ManagementCenterConfig managementCenterConfig = new ManagementCenterConfig();
managementCenterConfig.setEnabled(jHipsterProperties.getCache().getHazelcast().getManagementCenter().isEnabled());
managementCenterConfig.setUrl(jHipsterProperties.getCache().getHazelcast().getManagementCenter().getUrl());
managementCenterConfig.setUpdateInterval(jHipsterProperties.getCache().getHazelcast().getManagementCenter().getUpdateInterval());
return managementCenterConfig;
}
private MapConfig initializeDefaultMapConfig(JHipsterProperties jHipsterProperties) {
MapConfig mapConfig = new MapConfig();
/*
Number of backups. If 1 is set as the backup-count for example,
then all entries of the map will be copied to another JVM for
fail-safety. Valid numbers are 0 (no backup), 1, 2, 3.
*/
mapConfig.setBackupCount(jHipsterProperties.getCache().getHazelcast().getBackupCount());
/*
Valid values are:
NONE (no eviction),
LRU (Least Recently Used),
LFU (Least Frequently Used).
NONE is the default.
*/
mapConfig.setEvictionPolicy(EvictionPolicy.LRU);
/*
Maximum size of the map. When max size is reached,
map is evicted based on the policy defined.
Any integer between 0 and Integer.MAX_VALUE. 0 means
Integer.MAX_VALUE. Default is 0.
*/
mapConfig.setMaxSizeConfig(new MaxSizeConfig(0, MaxSizeConfig.MaxSizePolicy.USED_HEAP_SIZE));
return mapConfig;
}
private MapConfig initializeDomainMapConfig(JHipsterProperties jHipsterProperties) {
MapConfig mapConfig = new MapConfig();
mapConfig.setTimeToLiveSeconds(jHipsterProperties.getCache().getHazelcast().getTimeToLiveSeconds());
return mapConfig;
}
@Autowired(required = false)
public void setGitProperties(GitProperties gitProperties) {
this.gitProperties = gitProperties;
}
@Autowired(required = false)
public void setBuildProperties(BuildProperties buildProperties) {
this.buildProperties = buildProperties;
}
@Bean
public KeyGenerator keyGenerator() {
return new PrefixedKeyGenerator(this.gitProperties, this.buildProperties);
}
}
| [
"4438707@qq.com"
] | 4438707@qq.com |
69587f084f97636f034c15236d75529729397d64 | b7c81772761c67e001dcb7d1ed23f5d4c8ba8a80 | /app/src/main/java/com/example/andrey/newtmpclient/activities/needdoingtasks/di/NeedDoingTasksScope.java | c08cc0dd37239d4d06985ab29431642c2c25eda8 | [] | no_license | samaromku/NewTmpClient | 18bf5a83297c9fe54b7422b2393ef413f5cf8a33 | 3840423f770f1f245848c33ed8d7dba327fc9f60 | refs/heads/master | 2021-01-01T06:12:52.114585 | 2019-02-14T13:05:51 | 2019-02-14T13:05:51 | 97,379,734 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 262 | java | package com.example.andrey.newtmpclient.activities.needdoingtasks.di;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import javax.inject.Scope;
@Scope
@Retention(RetentionPolicy.RUNTIME)
@interface NeedDoingTasksScope {
}
| [
"savchenko@magnit.ru"
] | savchenko@magnit.ru |
287afe256ee1118d19446768458bb1ad9ccb25bc | ac68b309495d823bf081d168c4a013095c76b1fd | /HubbleBackend/src/com/hubble/hubblebackend/postgressql/model/ReleaseGroupSecondaryType.java | e86e828d8f8da494d04b369d12e5f66a38fb90d1 | [] | no_license | hmehrotra/hubble | f6d726b8a9d7deed94f67893c3c44c2763be88c3 | 3762613ed351d3fd4b31c369c3f10b33c06edf70 | refs/heads/master | 2016-08-04T14:16:38.080270 | 2015-09-21T00:22:10 | 2015-09-21T00:22:10 | 12,354,502 | 0 | 0 | null | 2015-08-30T00:45:27 | 2013-08-25T05:18:10 | HTML | UTF-8 | Java | false | false | 1,425 | java | package com.hubble.hubblebackend.postgressql.model;
// Generated Sep 7, 2015 5:12:35 PM by Hibernate Tools 3.4.0.CR1
/**
* ReleaseGroupSecondaryType generated by hbm2java
*/
public class ReleaseGroupSecondaryType implements java.io.Serializable {
private int id;
private String name;
private Integer parent;
private int childOrder;
private String description;
public ReleaseGroupSecondaryType() {
}
public ReleaseGroupSecondaryType(int id, String name, int childOrder) {
this.id = id;
this.name = name;
this.childOrder = childOrder;
}
public ReleaseGroupSecondaryType(int id, String name, Integer parent,
int childOrder, String description) {
this.id = id;
this.name = name;
this.parent = parent;
this.childOrder = childOrder;
this.description = description;
}
public int getId() {
return this.id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public Integer getParent() {
return this.parent;
}
public void setParent(Integer parent) {
this.parent = parent;
}
public int getChildOrder() {
return this.childOrder;
}
public void setChildOrder(int childOrder) {
this.childOrder = childOrder;
}
public String getDescription() {
return this.description;
}
public void setDescription(String description) {
this.description = description;
}
}
| [
"hmehrotra@apple.com"
] | hmehrotra@apple.com |
a1bc68fe4dd120e59b4f9ad49d9c52cce761c1db | 776e937de0534e2817584ed015285ad47395c875 | /app/src/main/java/com/example/codeli_klip/LoginGoogleActivity.java | 8034b2c03d5029407b4aab3bc591ef53dfb43165 | [] | no_license | KBOHYUN/codeli_android_klip_ver | 40ce4f1d07f734765a47c18194273f5e167f6d07 | f98a878396d260823e675e21e34023d5277ac46c | refs/heads/master | 2023-05-14T17:36:31.574540 | 2021-06-14T00:59:33 | 2021-06-14T00:59:33 | 365,611,079 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,077 | java | package com.example.codeli_klip;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.text.method.SingleLineTransformationMethod;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.auth.api.Auth;
import com.google.android.gms.auth.api.signin.GoogleSignIn;
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import com.google.android.gms.auth.api.signin.GoogleSignInClient;
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
import com.google.android.gms.auth.api.signin.GoogleSignInResult;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.SignInButton;
import com.google.android.gms.common.api.ApiException;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.android.material.snackbar.Snackbar;
import com.google.firebase.auth.AuthCredential;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.auth.GoogleAuthProvider;
public class LoginGoogleActivity extends AppCompatActivity {
private FirebaseAuth firebaseAuth = null;
private GoogleSignInClient googleSignInClient;
private static final int RC_SIGN_IN = 9001;
private SignInButton signInButton;
private String name;
private String email;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_google_login);
ImageView ivGlide = (ImageView)findViewById(R.id.iv_glide);
signInButton = findViewById(R.id.google_login_button);
// 파이어베이스 인증 객체 선언
firebaseAuth = FirebaseAuth.getInstance();
// Google 로그인을 앱에 통합
// GoogleSignInOptions 개체를 구성할 때 requestIdToken을 호출
GoogleSignInOptions googleSignInOptions = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(getString(R.string.default_web_client_id))
.requestEmail()
.build();
googleSignInClient = GoogleSignIn.getClient(this, googleSignInOptions);
signInButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent signInIntent = googleSignInClient.getSignInIntent();
startActivityForResult(signInIntent, RC_SIGN_IN);
}
});
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// 구글로그인 버튼 응답
if (requestCode == RC_SIGN_IN) {
Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data);
try {
// 구글 로그인 성공
GoogleSignInAccount account = task.getResult(ApiException.class);
email=account.getEmail();
name=account.getDisplayName();
firebaseAuthWithGoogle(account);
} catch (ApiException e) {
}
}
}
// 사용자가 정상적으로 로그인한 후에 GoogleSignInAccount 개체에서 ID 토큰을 가져와서
// Firebase 사용자 인증 정보로 교환하고 Firebase 사용자 인증 정보를 사용해 Firebase에 인증합니다.
private void firebaseAuthWithGoogle(GoogleSignInAccount acct) {
AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null);
firebaseAuth.signInWithCredential(credential)
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
// 로그인 성공
Toast.makeText(getApplicationContext(), "구글 로그인 성공", Toast.LENGTH_SHORT).show();
Intent intent=new Intent(getApplicationContext(), SigninActivity.class);
intent.putExtra("name",name);
intent.putExtra("email",email);
startActivity(intent);
} else {
// 로그인 실패
Toast.makeText(getApplicationContext(), "구글 로그인 실패", Toast.LENGTH_SHORT).show();
Intent intent=new Intent(getApplicationContext(), LoginGoogleActivity.class);
startActivity(intent);
}
}
});
}
} | [
"kbh5640@naver.com"
] | kbh5640@naver.com |
ede767320f49669c1eb95de7b4637aab35e8bb03 | 9dfb2d0bf7691f388ef6bde3c5e8cc0c40f57948 | /coding/src/Nets/no1.java | ebdc0db70d1844c1072b84abc911e9ffc648181b | [] | no_license | fengxiaozhou/job_coding | 0cc392395f4be371ca08961757e6755618ae4868 | 50200d740927152cff74ae05f331711da11b4db4 | refs/heads/master | 2020-03-21T22:49:27.318604 | 2018-10-30T09:08:58 | 2018-10-30T09:08:58 | 139,149,513 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 336 | java | package Nets;
import java.util.Scanner;
/**
* @author Fz
* @date 2018/9/8 16:57
*/
public class no1 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
if(sc.next()=="bwbwb")
System.out.println(5);
if(sc.next()=="wwb")
System.out.println(3);
}
}
| [
"fengzhouxmu@163.com"
] | fengzhouxmu@163.com |
c8bd60146febb935d1c8178077e9ce55ee0893d7 | b3ad513a6083d21cbfc21938a6fc01b58feaff95 | /app/src/main/java/com/appjumper/silkscreen/bean/Province.java | e37f2e59c31e9458787cb21a95367a356557f805 | [] | no_license | beyondbox/net | e0d9b12b8d5e45d31f6a1430a9399ccc2c6a249a | 5c2bbc2f1e77a75dc541ac58192fd7361a4603d6 | refs/heads/master | 2021-01-20T14:29:34.517648 | 2018-03-20T08:13:03 | 2018-03-20T08:13:03 | 90,618,930 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 800 | java | package com.appjumper.silkscreen.bean;
/**
* Created by botx on 2017/9/30.
*/
public class Province {
/**
* province_id : 820
* province_name : 江苏
* shuling : 12
*/
private String province_id;
private String province_name;
private String shuling;
public String getProvince_id() {
return province_id;
}
public void setProvince_id(String province_id) {
this.province_id = province_id;
}
public String getProvince_name() {
return province_name;
}
public void setProvince_name(String province_name) {
this.province_name = province_name;
}
public String getShuling() {
return shuling;
}
public void setShuling(String shuling) {
this.shuling = shuling;
}
}
| [
"363843073@qq.com"
] | 363843073@qq.com |
e329a1b6a4acedbf8a1c4718ae0b67ebc978b3fb | 43d2b1ca2aaabbef582bef6a6269ae57c78afc69 | /app/src/main/java/ava/shadesofme/MainActivity.java | f8dcb050f7fc3b724057a0b5c1d3628ad812bb38 | [] | no_license | alina-beck/ShadesOfMe | a710dfd9268ab0d551b8fa3ac47e49cf62cb23d4 | 5db16339f78b5abbf723b1ed4f2ec0f453af4b46 | refs/heads/master | 2021-05-31T20:08:38.714772 | 2016-07-19T11:05:17 | 2016-07-19T11:05:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,558 | java | package ava.shadesofme;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import ava.shadesofme.Content.ContentFragment;
import ava.shadesofme.Content.ContentViewModel;
import ava.shadesofme.Content.Inventory.InventoryFragment;
import ava.shadesofme.Content.Item.InventoryItemFragment;
import ava.shadesofme.Dashboard.DashboardFragment;
import ava.shadesofme.Dashboard.DashboardViewModel;
/** Starting point for the game - the MainActivity is responsible for starting the Initialiser.
*
* The MainActivity acts as container for DashboardFragment and ContentFragments
* and manages the navigation between ContentFragments when prompted. */
public class MainActivity extends AppCompatActivity {
// ViewModel names
public static final String DASHBOARD = "Dashboard";
public static final String INVENTORY = "Inventory";
public static final String INVENTORY_ITEM = "Inventory Item";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Initialiser initialiser = new Initialiser(this);
initialiser.startGame();
}
public void initDashboardFragment(DashboardViewModel dashboardViewModel) {
Bundle bundle = new Bundle();
bundle.putParcelable(DASHBOARD, dashboardViewModel);
DashboardFragment dashboardFragment = new DashboardFragment();
dashboardFragment.setArguments(bundle);
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.add(R.id.container_fragment_dashboard, dashboardFragment);
ft.commit();
}
public void setContentFragment(String name, ContentViewModel viewModel) {
Bundle bundle = new Bundle();
bundle.putParcelable(name, viewModel);
ContentFragment fragment;
switch (name) {
case INVENTORY:
fragment = new InventoryFragment();
break;
case INVENTORY_ITEM:
fragment = new InventoryItemFragment();
break;
default:
// TODO: throw and handle exception
System.out.println("no such fragment");
return;
}
fragment.setArguments(bundle);
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.add(R.id.container_fragment_dashboard, fragment);
ft.addToBackStack(null);
ft.commit();
}
}
| [
"4ndroid4va@gmail.com"
] | 4ndroid4va@gmail.com |
c8c69334513e81e5334589bee5a903fa40f81608 | ed5a1748f1c8db83952d6a70c2b37208b7004727 | /src/main/java/com/sixmac/dao/RolemodulesDao.java | 30229905ff85d3775071147076c9839e5171e3b1 | [] | no_license | phyche/ruanfan | aa2285973fbef0877aa00f4242d6c3290aed3900 | ba6e9f45144dce15305367719404e9bfbd67cc7f | refs/heads/master | 2021-05-03T10:08:21.491431 | 2016-07-15T06:08:56 | 2016-07-15T06:08:56 | 61,848,235 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 645 | java | package com.sixmac.dao;
import com.sixmac.entity.Rolemodules;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import java.util.List;
/**
* Created by Administrator on 2016/3/4 0004 下午 2:47.
*/
public interface RolemodulesDao extends JpaRepository<Rolemodules, Integer> {
@Query("select a from Rolemodules a where a.role.id = ?1")
public List<Rolemodules> findListByRoleId(Integer roleId);
@Query("select a from Rolemodules a where a.role.id = ?1 group by a.module.parentId")
public List<Rolemodules> findListByRoleIdGroupByParentId(Integer roleId);
} | [
"412824651@qq.com"
] | 412824651@qq.com |
0e1edd47a41d71b272dbe6fe3d12fa5f68950e25 | da86f543af9b66a180b1268c91b0f4bfbd4dcba2 | /src/main/java/com/elong/pb/newdda/parser/ast/expression/primary/function/string/Rtrim.java | 8dda8fc91ad972753ffed775a3e2a8e5c315037f | [] | no_license | makemyownlife/newdda-server | 811db910cd0b12144602ba7f7bab73167066b3cc | 8669296db2e77db8c7269f5f1b55a227442e0424 | refs/heads/master | 2021-01-01T19:24:34.340120 | 2016-03-13T11:08:43 | 2016-03-13T11:08:43 | 26,998,804 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,242 | java | /*
* Copyright 1999-2012 Alibaba Group.
*
* 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.
*/
/**
* (created at 2011-1-23)
*/
package com.elong.pb.newdda.parser.ast.expression.primary.function.string;
import java.util.List;
import com.elong.pb.newdda.parser.ast.expression.Expression;
import com.elong.pb.newdda.parser.ast.expression.primary.function.FunctionExpression;
/**
* @author <a href="mailto:shuo.qius@alibaba-inc.com">QIU Shuo</a>
*/
public class Rtrim extends FunctionExpression {
public Rtrim(List<Expression> arguments) {
super("RTRIM", arguments);
}
@Override
public FunctionExpression constructFunction(List<Expression> arguments) {
return new Rtrim(arguments);
}
}
| [
"zhangyong7120180@163.com"
] | zhangyong7120180@163.com |
d7d0232023718950f316af1ebcf9c8fa2804b679 | d2394373b65a16b9af45b7998669ba3d0033e21a | /framework/src/main/java/x/tools/framework/error/XError.java | 31d20af43304a9b9ddc37c592b4517c2a7400167 | [
"MIT"
] | permissive | tajoy/xtoolsframework | ae3f210f6b3f60ce1c4cf7f7fd1afc3eb73b71ea | e0041d5c5996cdaeb65996b5a10889419923333c | refs/heads/master | 2020-03-27T17:47:54.844556 | 2018-10-04T08:33:01 | 2018-10-04T08:33:01 | 146,875,110 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 354 | java | package x.tools.framework.error;
public abstract class XError extends Exception {
public XError() {
super();
}
public XError(String message) {
super(message);
}
public XError(String message, Throwable cause) {
super(message, cause);
}
public XError(Throwable cause) {
super(cause);
}
}
| [
"tj328111241@gmail.com"
] | tj328111241@gmail.com |
e88d5da09ebf8195b187ab700b8c61c794d6c36a | 9728939f3d4e3d24558e5279101c11c5867ae025 | /Const.java | 087cc4bc762e8c7616828b8394ac8f5f36c5506d | [] | no_license | chewy-18/RegressionThroughTrees | 1f2434c0988857a94fe9d18b9b7a0b845c56371a | e4844abf5d73b2d5311eb6264d489cc309b2a5b4 | refs/heads/master | 2021-05-28T08:52:51.151895 | 2015-01-31T15:48:51 | 2015-01-31T15:48:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,769 | java | /* This file: Const.java
* Programmer: David Chiu (dchiu1@andrew.cmu.edu) adapted from Steve's code
* Course/Section 95-712A
* Assignment: Homework 9.1, Evolve trees with new methods
* chooseTreeProportionalToFitness in generation class;
* New evolver class that evolves trees based on fitness
* and test class that tests evolver class
* Description: Contains const class that describes the values
* held in nodes that are not operators; Has addRandomKids
* method but does nothing in this class
*
*/
import java.util.*;
import java.text.*;
/** A Node wrapper for a constant in an algebraic expression. */
public class Const extends Node {
private double value;
public Const(double d) {value = d; }
public void setChild(int position, Node n) {}
public double eval(double[] data) { return value; }
public String toString() {
String s = new String();
s += NumberFormat.getInstance().format(value);
return s;
}
public void addRandomKids(OperatorFactory o, TerminalFactory t,
int maxDepth, Random rand) {}
public Node duplicate() {
Const alterEgo = new Const(value);
return alterEgo;
}
/** Returns a NodePairPlus object whose parent and child are null,
* and whose counter equals the incoming nodeNumber. */
public NodePairPlus traceTree(int nodeNumber, int clipNumber) {
NodePairPlus p = new NodePairPlus();
p.parent = null;
p.child = null;
p.counter = nodeNumber;
return p;
}
/** Should never be called, since constants have no children. */
public void changeChild(Node oldChild, Node newChild) {
System.out.println("Const.changeChild() should never be called!");
}
}
| [
"dchiu1@andrew.cmu.edu"
] | dchiu1@andrew.cmu.edu |
26f92f8cad0682607fe166c2d310615ce9113593 | dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9 | /data_defect4j/preprossed_method_corpus/Math/65/org/apache/commons/math/FunctionEvaluationException_FunctionEvaluationException_58.java | 649be9d5b6ea46d81b5332b52704e50a8976f9fe | [] | no_license | hvdthong/NetML | dca6cf4d34c5799b400d718e0a6cd2e0b167297d | 9bb103da21327912e5a29cbf9be9ff4d058731a5 | refs/heads/master | 2021-06-30T15:03:52.618255 | 2020-10-07T01:58:48 | 2020-10-07T01:58:48 | 150,383,588 | 1 | 1 | null | 2018-09-26T07:08:45 | 2018-09-26T07:08:44 | null | UTF-8 | Java | false | false | 683 | java |
org apach common math
except thrown error occur evalu function
maintain code argument code properti hold input
caus function evalu fail
version revis date
function evalu except functionevaluationexcept math except mathexcept
construct except indic argument
caus function evalu fail
param argument fail function argument
function evalu except functionevaluationexcept argument
local format localizedformat evalu fail arrai real vector arrayrealvector argument
argument argument clone
| [
"hvdthong@gmail.com"
] | hvdthong@gmail.com |
63dafee0a6287d2a4d7b1b885db518edd5991195 | fc979b663d936f0e11b8941f7630bf22df62bac2 | /target/generated-sources/jaxb/io/spring/guides/gs_producing_web_service/GetCountryRequest.java | 38d960a192698dbdf894903dc88dd40783f04c20 | [] | no_license | thecoder8890/producing-web-service | bbe5b050e16f5db943fb1dcd99a4e355cf44807f | 00de40cd467d87ae4b7260d64f5400b927ac5e74 | refs/heads/master | 2022-04-19T22:16:44.577512 | 2020-04-23T14:30:49 | 2020-04-23T14:30:49 | 258,231,958 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,833 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.2
// See <a href="https://javaee.github.io/jaxb-v2/">https://javaee.github.io/jaxb-v2/</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2020.04.23 at 06:15:21 PM IST
//
package io.spring.guides.gs_producing_web_service;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"name"
})
@XmlRootElement(name = "getCountryRequest")
public class GetCountryRequest {
@XmlElement(required = true)
protected String name;
/**
* Gets the value of the name property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getName() {
return name;
}
/**
* Sets the value of the name property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setName(String value) {
this.name = value;
}
}
| [
"mingle@altimetrik.com"
] | mingle@altimetrik.com |
12e7c383c8621129d01609fb56a8a051afc7fa25 | 20e3b03ecce73a9ea96ecee9dcdca307b2191c97 | /app/src/main/java/com/example/juliod07/news_reader_app/Model/UrlsToLogos.java | 90af64b791dda71fa83a4b02ccc6ddeaa6fab344 | [] | no_license | Blast06/NotiNews | 35ebe2c1f1ea7ed87c74cf6a67c7463da5f61e93 | 79673da60879d696bde474b754346989f73d89f0 | refs/heads/master | 2021-09-08T19:29:09.851078 | 2018-03-11T23:58:25 | 2018-03-11T23:58:25 | 124,480,904 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 583 | java | package com.example.juliod07.news_reader_app.Model;
/**
* Created by JulioD07 on 3/4/2018.
*/
public class UrlsToLogos {
private String small,medium,large;
public String getSmall() {
return small;
}
public void setSmall(String small) {
this.small = small;
}
public String getMedium() {
return medium;
}
public void setMedium(String medium) {
this.medium = medium;
}
public String getLarge() {
return large;
}
public void setLarge(String large) {
this.large = large;
}
}
| [
"lacalculadora06@hotmail.com"
] | lacalculadora06@hotmail.com |
0e04eca148d0e11e194b4a9c95a93803941f0186 | 5c0d799a4deb818d6108d74ddb3fb1516ac893bb | /src/main/java/com/liqiwei/server/netty/http/router/HttpRouteParse.java | 10ad30406fefa43db04f2b3f382fabcab65ba05a | [] | no_license | kukudereagan/NettyServer | a8be6c3a29499210310e4c8d674150215eafade4 | 170fce7a7a2904c075ec74954298506977b658ed | refs/heads/master | 2020-06-05T04:05:47.770268 | 2018-02-28T04:40:07 | 2018-02-28T04:40:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,609 | java | package com.liqiwei.server.netty.http.router;
import com.liqiwei.server.annotations.Controller;
import com.liqiwei.server.annotations.RequestMapping;
import com.liqiwei.server.netty.http.wrapper.HttpRequestWrapper;
import com.liqiwei.server.netty.http.wrapper.HttpResponseWrapper;
import com.liqiwei.server.util.ClassUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
/**
* http 路由配置
*/
public class HttpRouteParse {
private static final Logger LOGGER = LoggerFactory.getLogger(HttpRouteParse.class);
private Map<String, MappingResult> controllers = new HashMap<String, MappingResult>();
/**
* controller所在包
*
*/
public HttpRouteParse(String controllerPackageName){
controllers = new HashMap<String, MappingResult>();
scanPackage(controllerPackageName);
}
/**
* 扫描包
*
*/
private void scanPackage(String pkgName) {
Set<Class<?>> classes = ClassUtil.getClasses(pkgName);
for (Class<?> clazz : classes) {
Controller ctrl = clazz.getAnnotation(Controller.class);
if (ctrl != null) {
//类级别映射
RequestMapping classMapping = clazz.getAnnotation(RequestMapping.class);
Method[] method = clazz.getMethods();
for (int i = 0; i < method.length; i++) {
RequestMapping requestMapping = method[i].getAnnotation(RequestMapping.class);
if (requestMapping != null) {
String url = (classMapping == null ? "" : classMapping.value());
//拼接映射URL
url +=requestMapping.value();
MappingResult result;
try {
result = new MappingResult(url, clazz, ctrl.ctrlName(), method[i], clazz.newInstance());
controllers.put(url, result);
LOGGER.info(result.toString());
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
}
}
}
}
}
}
/**
* 路由转发
*
* @param request
* @param response
*/
public void dispatch(HttpRequestWrapper request, HttpResponseWrapper response){
if(controllers != null && request.getUri() != "/favicon.ico"){
MappingResult mappingResult = controllers.get(request.getUri());
if(mappingResult == null){
response.append("url no found : "+request.getUri());
return;
}
try {
mappingResult.getMethod().invoke(mappingResult.getCtrlInstance(), request, response);
//增加cors
response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
response.setHeader("Access-Control-Max-Age", "3600");
response.setHeader("Access-Control-Allow-Headers", "x-requested-with");
//打印输出日志:
LOGGER.info("响应输出:{}",response.flush());
} catch (Exception e) {
LOGGER.error("处理请求" + request.getUri() + "发生异常," + e.getMessage(), e);
}
}else{
response.append("route error");
}
}
} | [
"liqiwei123@outlook.com"
] | liqiwei123@outlook.com |
57cf15b61defce3d8547726c04145a92946f3dfb | 193b5b869f9e66aa7ea5d03b6db266863db3d8ad | /securebookmark_for_android/app/src/main/java/jp/csrf/seccamp2016/securebookmark/ProvisionActivity.java | ce0343bf2a43b0ed6203e3703060a351832efdd9 | [] | no_license | nishimunea/securitycamp2016 | 46a81237a2021741765222c8abf993ef990dc966 | 6ef76b39a13f7178badef755577839d8692404a1 | refs/heads/master | 2020-12-24T06:41:31.151587 | 2016-07-31T09:32:13 | 2016-07-31T09:32:13 | 64,542,169 | 2 | 1 | null | 2016-07-31T08:11:28 | 2016-07-30T12:02:48 | Java | UTF-8 | Java | false | false | 4,411 | java | package jp.csrf.seccamp2016.securebookmark;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintStream;
import java.net.URL;
import java.util.regex.Pattern;
import javax.net.ssl.HttpsURLConnection;
public class ProvisionActivity extends AppCompatActivity {
private final String INITIAL_URL = "https://seccamp2016.csrf.jp/bookmark/provision";
public final static String CREDENTIALS = "Credentials";
private Button createButton;
private TextView usernameTextView;
private TextView adminPasswordTextView;
private TextView statusTextView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_provision);
createButton = (Button) findViewById(R.id.createButton);
usernameTextView = (TextView) findViewById(R.id.username);
adminPasswordTextView = (TextView) findViewById(R.id.password);
statusTextView = (TextView) findViewById(R.id.status);
statusTextView.setText("");
}
@Override
protected void onStop() {
super.onStop();
finish();
}
public void onClickCreateButton(View v) {
final String username = usernameTextView.getText().toString();
final String adminPassword = adminPasswordTextView.getText().toString();
Pattern p = Pattern.compile("^[0-9a-zA-Z]+$");
if (p.matcher(username).find() && p.matcher(adminPassword).find()) {
statusTextView.setText("Creating user...");
createButton.setEnabled(false);
AsyncTask<String, Void, String> task = new networkingTask();
task.execute("username=" + username + "&" + "admin_password=" + adminPassword);
} else {
statusTextView.setText("Username and password must be alphanumeric.");
}
}
private class networkingTask extends AsyncTask<String, Void, String> {
@Override
protected String doInBackground(String... params) {
String result = "";
try {
HttpsURLConnection conn;
URL url = new URL(INITIAL_URL);
conn = (HttpsURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setDoOutput(true);
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
OutputStream os = conn.getOutputStream();
PrintStream ps = new PrintStream(os);
ps.print(params[0]);
ps.close();
if (conn.getResponseCode() == 200) {
BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));
result = reader.readLine();
}
conn.disconnect();
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
@Override
protected void onPostExecute(String result) {
try {
JSONObject json = new JSONObject(result);
SharedPreferences prefs = getSharedPreferences(CREDENTIALS, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = prefs.edit();
editor.putString("username", json.getString("username"));
editor.putString("password1", json.getString("password1"));
editor.putString("password2", json.getString("password2"));
editor.putString("password3", json.getString("password3"));
editor.putString("password4", json.getString("password4"));
editor.putString("password5", json.getString("password5"));
editor.apply();
statusTextView.setText("Registration successful.");
} catch (JSONException e) {
statusTextView.setText("Registration failure.");
e.printStackTrace();
}
}
}
}
| [
"nishimunea@gmail.com"
] | nishimunea@gmail.com |
7580c33b5f8d3fd2a441b13b45a9d3073bcfa220 | 0fa514ba7e6afb28626a7c71955db17a04277efc | /src/main/java/com/chains/pwqxfwjk/model/Zrsq.java | 58b1e378a22775198f3492e510bf42f65c8efc30 | [] | no_license | huangyuzhi/newPro | 1632d50142011a93182fc8da3d307826b7eba9fe | b52a8865d3acd0fc55cdc46084313204285eb1af | refs/heads/master | 2021-07-19T02:10:16.626401 | 2017-10-25T10:28:22 | 2017-10-25T10:28:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,517 | java | package com.chains.pwqxfwjk.model;
import javax.persistence.Column;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.SecondaryTable;
import javax.persistence.Table;
/**
* 类名称:Zrsq<br>
* 功能描述: 增容申请 <br>
* <br>
* 创建人:zw<br>
* 创建时间:2015年12月10日 上午8:59:34<br>
* 修改人:zw<br>
* 修改时间:2015年12月10日 上午8:59:34<br>
* 修改备注:
*
* @version 1.0.0
*/
@Entity
@Table(name = "POWER_BUSINESS_INFO")
@SecondaryTable(name="POWER_BUSINESS_DETAIL_INFO", pkJoinColumns={
@PrimaryKeyJoinColumn(name="subid", referencedColumnName="id")
})
@DiscriminatorValue("zrsq")
public class Zrsq extends PowerBusinessInfo {
/**
* 用一句话描述这个变量表示什么
*/
private static final long serialVersionUID = 1L;
/**
* 当前负荷
*/
private String charge;
/**
* 新增负荷
*/
private String increaseCharge;
public Zrsq() {
setBusinessType("zrsq");
}
@Column(table = "POWER_BUSINESS_DETAIL_INFO", name = "charge")
public String getCharge() {
return this.charge;
}
public void setCharge(String charge) {
this.charge = charge;
}
@Column(table = "POWER_BUSINESS_DETAIL_INFO", name = "increase_charge")
public String getIncreaseCharge() {
return this.increaseCharge;
}
public void setIncreaseCharge(String increaseCharge) {
this.increaseCharge = increaseCharge;
}
}
| [
"hyz1060@163.com"
] | hyz1060@163.com |
21e9bf56dab60388d4571765e83f4f7742e6ff92 | 68e0c2a454d453bb95271d9ede2330149878c2fe | /app/src/main/java/adapter/BooksAdapter.java | bc4a9e6665bf52529c13d1a53f3631451e42c69f | [] | no_license | SartikaHsb/BookStoreApps | b5a1a986db0e598a65f9376cd60584189a62dd78 | 016b84f5f4179cd0e006e151f1dc52b94800cb7a | refs/heads/master | 2021-01-11T06:17:49.024634 | 2016-10-04T23:33:42 | 2016-10-04T23:33:42 | 69,968,919 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,332 | java | package adapter;
/**
* Created by sartikahasibuan on 7/8/2016.
*/
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Point;
import android.graphics.Rect;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.DecelerateInterpolator;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.example.zxcvbn.bookstore.R;
import com.squareup.picasso.Picasso;
import activity.Detail_Book;
import provider.GlobalData;
import model.DataContentProvider;
public class BooksAdapter extends BaseAdapter {
String [] result;
Context context;
String [] imageCover;
String[] price;
String[] getBookTitle;
String[] getBookPrice;
String[] getBookCover;
private static LayoutInflater inflater=null;
GlobalData global_data = new GlobalData();
DataContentProvider dataContentProvider;
private Animator mCurrentAnimator;
private int mShortAnimationDuration;
private String URL = "http://www.g-i.com.my:3002";
public BooksAdapter(Context c, String id) {
// TODO Auto-generated constructor stub
context= c;
if(id!=null) {
getBookTitle = DataContentProvider.getBookTitle(context, id);
getBookPrice = DataContentProvider.getBookPrice(context, id);
}
else
{
getBookTitle = DataContentProvider.getBookTit(context);
getBookPrice = DataContentProvider.getBookPr(context);
getBookCover = DataContentProvider.getCoverBook(context);
}
int[] getCover = DataContentProvider.getCover(context);
result=getBookTitle;
price = getBookPrice;
imageCover = getBookCover;
//imageId=getCover;
inflater = ( LayoutInflater )context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return result.length;
}
@Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return position;
}
@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return position;
}
public class Holder
{
TextView tvTitle;
TextView tvPrice;
ImageView img;
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
Holder holder=new Holder();
View rowView;
ImageView imageView = new ImageView(this.context);
rowView = inflater.inflate(R.layout.book_list, null);
holder.tvTitle=(TextView) rowView.findViewById(R.id.textView1);
holder.tvPrice=(TextView) rowView.findViewById(R.id.textView2);
holder.img=(ImageView) rowView.findViewById(R.id.imageView1);
holder.tvTitle.setText(result[position]);
holder.tvPrice.setText("RM "+price[position]);
Picasso.with(context).load(URL+imageCover[position]).into(holder.img);
Log.d("URL Images",""+URL+imageCover[position]);
//holder.img.setImageResource(imageId[position]);
imageView.setLayoutParams(new GridView.LayoutParams(200,150));
rowView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Toast.makeText(context, "You Clicked "+result[position], Toast.LENGTH_LONG).show();
String res=result[position];
// int id = (Integer) v.getTag();
//zoomImageFromThumb(v, imageId[position]);
Intent intent = new Intent(context, Detail_Book.class);
intent.putExtra("book_name",res);
context.startActivity(intent);
}
});
return rowView;
}
private void zoomImageFromThumb(final View thumbView, int imageResId) {
// If there's an animation in progress, cancel it immediately and
// proceed with this one.
if (mCurrentAnimator != null) {
mCurrentAnimator.cancel();
}
// Load the high-resolution "zoomed-in" image.
final ImageView expandedImageView = (ImageView) ((Activity) context)
.findViewById(R.id.expanded_image);
expandedImageView.setImageResource(imageResId);
// Calculate the starting and ending bounds for the zoomed-in image.
// This step
// involves lots of math. Yay, math.
final Rect startBounds = new Rect();
final Rect finalBounds = new Rect();
final Point globalOffset = new Point();
// The start bounds are the global visible rectangle of the thumbnail,
// and the
// final bounds are the global visible rectangle of the container view.
// Also
// set the container view's offset as the origin for the bounds, since
// that's
// the origin for the positioning animation properties (X, Y).
thumbView.getGlobalVisibleRect(startBounds);
((Activity) context).findViewById(R.id.container)
.getGlobalVisibleRect(finalBounds, globalOffset);
startBounds.offset(-globalOffset.x, -globalOffset.y);
finalBounds.offset(-globalOffset.x, -globalOffset.y);
// Adjust the start bounds to be the same aspect ratio as the final
// bounds using the
// "center crop" technique. This prevents undesirable stretching during
// the animation.
// Also calculate the start scaling factor (the end scaling factor is
// always 1.0).
float startScale;
if ((float) finalBounds.width() / finalBounds.height() > (float) startBounds
.width() / startBounds.height()) {
// Extend start bounds horizontally
startScale = (float) startBounds.height() / finalBounds.height();
float startWidth = startScale * finalBounds.width();
float deltaWidth = (startWidth - startBounds.width()) / 2;
startBounds.left -= deltaWidth;
startBounds.right += deltaWidth;
} else {
// Extend start bounds vertically
startScale = (float) startBounds.width() / finalBounds.width();
float startHeight = startScale * finalBounds.height();
float deltaHeight = (startHeight - startBounds.height()) / 2;
startBounds.top -= deltaHeight;
startBounds.bottom += deltaHeight;
}
// Hide the thumbnail and show the zoomed-in view. When the animation
// begins,
// it will position the zoomed-in view in the place of the thumbnail.
thumbView.setAlpha(0f);
expandedImageView.setVisibility(View.VISIBLE);
// Set the pivot point for SCALE_X and SCALE_Y transformations to the
// top-left corner of
// the zoomed-in view (the default is the center of the view).
expandedImageView.setPivotX(0f);
expandedImageView.setPivotY(0f);
// Construct and run the parallel animation of the four translation and
// scale properties
// (X, Y, SCALE_X, and SCALE_Y).
AnimatorSet set = new AnimatorSet();
set.play(
ObjectAnimator.ofFloat(expandedImageView, View.X,
startBounds.left, finalBounds.left))
.with(ObjectAnimator.ofFloat(expandedImageView, View.Y,
startBounds.top, finalBounds.top))
.with(ObjectAnimator.ofFloat(expandedImageView, View.SCALE_X,
startScale, 1f))
.with(ObjectAnimator.ofFloat(expandedImageView, View.SCALE_Y,
startScale, 1f));
set.setDuration(mShortAnimationDuration);
set.setInterpolator(new DecelerateInterpolator());
set.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mCurrentAnimator = null;
}
@Override
public void onAnimationCancel(Animator animation) {
mCurrentAnimator = null;
}
});
set.start();
mCurrentAnimator = set;
// Upon clicking the zoomed-in image, it should zoom back down to the
// original bounds
// and show the thumbnail instead of the expanded image.
final float startScaleFinal = startScale;
expandedImageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (mCurrentAnimator != null) {
mCurrentAnimator.cancel();
}
// Animate the four positioning/sizing properties in parallel,
// back to their
// original values.
AnimatorSet set = new AnimatorSet();
set.play(
ObjectAnimator.ofFloat(expandedImageView, View.X,
startBounds.left))
.with(ObjectAnimator.ofFloat(expandedImageView, View.Y,
startBounds.top))
.with(ObjectAnimator.ofFloat(expandedImageView,
View.SCALE_X, startScaleFinal))
.with(ObjectAnimator.ofFloat(expandedImageView,
View.SCALE_Y, startScaleFinal));
set.setDuration(mShortAnimationDuration);
set.setInterpolator(new DecelerateInterpolator());
set.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
thumbView.setAlpha(1f);
expandedImageView.setVisibility(View.GONE);
mCurrentAnimator = null;
}
@Override
public void onAnimationCancel(Animator animation) {
thumbView.setAlpha(1f);
expandedImageView.setVisibility(View.GONE);
mCurrentAnimator = null;
}
});
set.start();
mCurrentAnimator = set;
}
});
}
}
| [
"sartikasarihasibuan@gmail.com"
] | sartikasarihasibuan@gmail.com |
6634ba8b35808e6680157115ad01dbbf0469da7e | 95e944448000c08dd3d6915abb468767c9f29d3c | /sources/com/p280ss/android/ugc/aweme/p313im/sdk/common/C31077d.java | 5a19a040702a61f7d5d4ffe34106cb0ce80c4a36 | [] | no_license | xrealm/tiktok-src | 261b1faaf7b39d64bb7cb4106dc1a35963bd6868 | 90f305b5f981d39cfb313d75ab231326c9fca597 | refs/heads/master | 2022-11-12T06:43:07.401661 | 2020-07-04T20:21:12 | 2020-07-04T20:21:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,920 | java | package com.p280ss.android.ugc.aweme.p313im.sdk.common;
import android.arch.lifecycle.C0043i;
import android.arch.lifecycle.C0053p;
import com.p280ss.android.ugc.aweme.arch.widgets.base.C23084b;
import java.util.List;
import kotlin.jvm.internal.C7571f;
import kotlin.jvm.internal.C7573i;
/* renamed from: com.ss.android.ugc.aweme.im.sdk.common.d */
public final class C31077d<T> extends C23084b<Integer> {
/* renamed from: g */
public static final C31078a f81561g = new C31078a(null);
/* renamed from: b */
public boolean f81562b;
/* renamed from: c */
public boolean f81563c;
/* renamed from: d */
public boolean f81564d;
/* renamed from: e */
public Throwable f81565e;
/* renamed from: f */
public final C23084b<List<T>> f81566f;
/* renamed from: com.ss.android.ugc.aweme.im.sdk.common.d$a */
public static final class C31078a {
private C31078a() {
}
public /* synthetic */ C31078a(C7571f fVar) {
this();
}
}
/* renamed from: com.ss.android.ugc.aweme.im.sdk.common.d$b */
static final class C31079b<T> implements C0053p<Integer> {
/* renamed from: a */
final /* synthetic */ C31077d f81567a;
/* renamed from: b */
final /* synthetic */ C31071b f81568b;
C31079b(C31077d dVar, C31071b bVar) {
this.f81567a = dVar;
this.f81568b = bVar;
}
/* access modifiers changed from: private */
/* renamed from: a */
public void onChanged(Integer num) {
if (num != null && num.intValue() == 1) {
this.f81568b.mo81560a();
} else if (num != null && num.intValue() == 3) {
this.f81568b.mo81562a((List) this.f81567a.f81566f.getValue(), this.f81567a.f81562b);
} else {
if (num != null && num.intValue() == 2) {
this.f81568b.mo81561a(this.f81567a.f81565e);
}
}
}
}
/* renamed from: a */
public final void mo81564a(Throwable th) {
this.f81565e = th;
mo81565a(false);
setValue(Integer.valueOf(2));
}
/* renamed from: b */
public final void mo81566b(boolean z) {
this.f81564d = true;
mo81565a(false);
setValue(Integer.valueOf(3));
}
public C31077d(C23084b<List<T>> bVar) {
C7573i.m23587b(bVar, "data");
this.f81566f = bVar;
setValue(Integer.valueOf(0));
}
/* renamed from: a */
public final void mo81565a(boolean z) {
this.f81563c = z;
if (z) {
setValue(Integer.valueOf(1));
}
}
/* renamed from: a */
public final void mo81563a(C0043i iVar, C31071b<T> bVar) {
C7573i.m23587b(iVar, "lifecycleOwner");
C7573i.m23587b(bVar, "listListener");
observe(iVar, new C31079b(this, bVar));
}
}
| [
"65450641+Xyzdesk@users.noreply.github.com"
] | 65450641+Xyzdesk@users.noreply.github.com |
fc0d3cd46f5ee4497a38d55718541de93d0860ce | 60d4de7865da4b39a3bc64c7f530f7b21de0b7ad | /src/main/java/com/tts/TechTalentTwitter/configuration/SecurityConfiguration.java | 54bc5ceb05fdf6cdc32ddf4061c71a957d9232a3 | [] | no_license | michael-albright/Twitter | 9647532733e1d2d66b2eee303f2a5b6d42434a91 | 37bf0508a008b85350d6fe3df1caffe6fc51e5ce | refs/heads/main | 2023-04-05T15:41:52.525184 | 2021-04-05T05:34:12 | 2021-04-05T05:34:12 | 354,730,642 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,973 | java | package com.tts.TechTalentTwitter.configuration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
import javax.sql.DataSource;
@Configuration
@EnableWebSecurity
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
@Autowired
private BCryptPasswordEncoder bCryptPasswordEncoder;
@Autowired
private DataSource dataSource;
@Value("${spring.queries.users-query}")
private String usersQuery;
@Value("${spring.queries.roles-query}")
private String rolesQuery;
@Override
//look up something in a database
protected void configure(AuthenticationManagerBuilder auth)
throws Exception {
auth.
jdbcAuthentication()
.usersByUsernameQuery(usersQuery)
.authoritiesByUsernameQuery(rolesQuery)
.dataSource(dataSource)
.passwordEncoder(bCryptPasswordEncoder);
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.
authorizeRequests()//Category of authorization requests
.antMatchers("/console/**").permitAll()
.antMatchers("/login").permitAll()
.antMatchers("/signup").permitAll()
.antMatchers("/custom.js").permitAll()
.antMatchers("/custom.css").permitAll()
.antMatchers().hasAuthority("USER").anyRequest()
.authenticated().and().csrf().disable().formLogin()
.loginPage("/login").failureUrl("/login?error=true")
.defaultSuccessUrl("/tweets")
.usernameParameter("username")
.passwordParameter("password")
.and().logout()
.logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
.logoutSuccessUrl("/login").and().exceptionHandling();
http.headers().frameOptions().disable();
}
@Override
public void configure(WebSecurity web) throws Exception
{
web //directories that wont go through security at all
.ignoring()
.antMatchers("/resources/**", "/static/**", "/css/**", "/js/**", "/images/**");
}
} | [
"msalbrig@gmail.com"
] | msalbrig@gmail.com |
8d00c3f8b8c568981ef5ef6ebde5d7b5f8c0bd4e | 501fc5d4fe26c966f6da8e48feee0a8fc75e226d | /src/main/java/com/henrique/cursomc/DTO/EmailDTO.java | 34868f12db1952e4bb53954a105a1c0dcfb0a9ec | [] | no_license | hiquecs/spring_boot_ionic_backend | 9cead20183295594ac9615164eccdbcbe40e3aa0 | eedd4c35dfff3b7fca916a20ca12c2e65f1a5485 | refs/heads/master | 2021-08-22T07:03:36.257734 | 2021-06-02T20:35:47 | 2021-06-02T20:35:47 | 137,833,861 | 0 | 0 | null | 2021-06-02T20:44:50 | 2018-06-19T03:08:28 | Java | UTF-8 | Java | false | false | 511 | java | package com.henrique.cursomc.DTO;
import java.io.Serializable;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotEmpty;
public class EmailDTO implements Serializable {
private static final long serialVersionUID = 1L;
@NotEmpty(message = "Preenchimento obrigatorio ")
@Email(message = "Email invalido")
private String email;
public EmailDTO() {
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
}
| [
"hiquecs@gmail.com"
] | hiquecs@gmail.com |
213b3f57190fbada1d8bbb577c698a1ba0c540ba | ad4beedef0d5a58fea01a96cb91c6b9c5bd76c79 | /src/main/java/com/ch/system/web/paging/OpenAdvertisementOverviewPaging.java | 4b815b2259861387b4e6260d0bd3ce0105a36e8b | [] | no_license | kunkun39/HB_YL | afaed8edffd1c13e89817931611d0fc0455d3cf3 | aa8519d06d6cf35185dc3d70fcf396b98d3fe7a7 | refs/heads/master | 2020-12-24T13:17:26.733263 | 2015-03-30T05:12:15 | 2015-03-30T05:12:15 | 32,303,780 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,020 | java | package com.ch.system.web.paging;
import com.ch.system.service.AdvertisementService;
import com.ch.system.web.facade.dto.OpenAdvertisementDTO;
import java.util.List;
/**
* User: Jack Wang
* Date: 15-3-17
* Time: 下午2:26
*/
public class OpenAdvertisementOverviewPaging extends AbstractPaging<OpenAdvertisementDTO> {
private AdvertisementService advertisementService;
public OpenAdvertisementOverviewPaging(AdvertisementService advertisementService) {
this.advertisementService = advertisementService;
}
public List<OpenAdvertisementDTO> getItems() {
return advertisementService.obtainOpenAdvertisements(getStartPosition(), getPageSize());
}
public long getTotalItemSize() {
if (totalItemSize >= 0) {
return totalItemSize;
}
totalItemSize = advertisementService.obtainOpenAdvertisementSize();
return totalItemSize;
}
public String getParameterValues() {
return "";
}
} | [
"34445282@qq.com"
] | 34445282@qq.com |
23ff8298c430529a1eeca43e10cef0c6fc95bc5f | d91b81ae9a6cef3b2a1c8d2baf3234b2f3bcad79 | /src/interpreter/debugger/ui/uitools/UITool.java | 9d6a597753ff15f7be7147d106b5364ef4e919c3 | [] | no_license | EggnogII/Interpreter-Debugger-X | 495d2d5eca192fde5dc9e78161e2511c7971fb38 | 136bf0beea7aa804e5cd5781f31ccd67f7e0523a | refs/heads/master | 2020-05-29T15:07:56.465954 | 2016-06-02T00:42:37 | 2016-06-02T00:42:37 | 60,220,362 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 743 | 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 interpreter.debugger.ui.uitools;
import interpreter.debugger.DVirtualMachine;
import interpreter.debugger.tools.Tool;
import interpreter.debugger.ui.UI;
import java.util.Vector;
/**
* UI version of the tool class
* @author Imran Irfan
*/
public abstract class UITool extends Tool{
//initializes the tool
public abstract void init(Vector Args);
@Override
public void init(int arg){}
//executes the tool
public abstract void execute(UI ui);
@Override
public void execute(DVirtualMachine vm){}
}
| [
"imranbirfan@gmail.com"
] | imranbirfan@gmail.com |
f1527db8eb3203c3bdfc0bc544dc45ff89571a97 | 134357cb7c008d7cf21079a01dc968f035c52a73 | /app/src/main/java/com/example/map/mylocation/dialog/InputNumberDiaolg.java | 35b3a79e4918b843cf399544d6408dc9305f1cc2 | [] | no_license | zsh9/Lab | ffe090a9d67558a51167cef4db1da269cc9e3fbb | b71a73922919d9b2073a7928334d03912127edf5 | refs/heads/master | 2023-03-29T05:16:02.607589 | 2021-03-23T05:50:21 | 2021-03-23T05:50:21 | 350,593,934 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,977 | java | package com.example.map.mylocation.dialog;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import androidx.annotation.NonNull;
import com.blankj.utilcode.util.StringUtils;
import com.example.map.mylocation.R;
import com.example.map.mylocation.utils.DensityUtil;
import com.example.map.mylocation.utils.Event;
import com.example.map.mylocation.utils.EventBusUtil;
/**
* 输入内容
* Created by wuxiaodong on 2019/7/29.
*/
public class InputNumberDiaolg extends Dialog {
private Context mContext;
private EditText editText;
private Button sure, cancle;
String number;
int from = 0;
public InputNumberDiaolg(@NonNull Context context, int themeResId) {
super(context, R.style.dialog_vip);
this.mContext = context;
}
public InputNumberDiaolg(@NonNull Context context, int themeResId, int type) {
super(context, R.style.dialog_vip);
this.mContext = context;
this.from = type;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
init();
}
private void init() {
LayoutInflater inflater = LayoutInflater.from(mContext);
View view = inflater.inflate(R.layout.dialog_input_number, null);
setContentView(view);
editText = view.findViewById(R.id.edt_number);
sure = view.findViewById(R.id.sure_btn);
cancle = view.findViewById(R.id.cancle_btn);
number = editText.getText().toString().trim();
cancle.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
sure.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!StringUtils.isEmpty(editText.getText().toString().trim())) {
EventBusUtil.sendEvent(new Event(from, editText.getText().toString().trim()));
} else {
}
dismiss();
}
});
Window dialogWindow = getWindow();
dialogWindow.setGravity(Gravity.CENTER); // 此处可以设置dialog显示的位置为居中
WindowManager.LayoutParams lp = dialogWindow.getAttributes();
DisplayMetrics d = mContext.getResources().getDisplayMetrics(); // 获取屏幕宽、高用
lp.width = d.widthPixels;// 高度设置为屏幕的0.8
lp.height = DensityUtil.dip2px(mContext, 200);// 高度设置为屏幕的0.8
// lp.height = d.heightPixels;
setCanceledOnTouchOutside(true);
dialogWindow.setAttributes(lp);
}
}
| [
"xxx"
] | xxx |
c8ab334ca69cc322eddc0260925b88b06ec54468 | 5fa363391cb4271cdfa6a89a56684d689648d673 | /src/test/java/jmh/atomic/AtomicStampedReferenceTest.java | 20af8fa618c9325fa9bf4e3ad25f06f6c7d1b732 | [] | no_license | YukunSun/concurrent | 63c8b017df683577f4d3efcc58766216f593037c | b54b6c6125397b2b198c3a5db562c0590573c6f7 | refs/heads/master | 2021-06-11T18:42:17.789712 | 2021-06-10T15:32:48 | 2021-06-10T15:32:48 | 75,477,941 | 1 | 0 | null | 2020-12-22T02:42:42 | 2016-12-03T14:18:20 | Java | UTF-8 | Java | false | false | 753 | java | package jmh.atomic;
import org.junit.Assert;
import org.junit.Test;
import java.util.concurrent.atomic.AtomicStampedReference;
/**
* @author sunyk
**/
public class AtomicStampedReferenceTest {
/**
* 解决 AtomicReference 的 ABA 问题
*/
@Test
public void atomicStampedReference() {
AtomicStampedReference<String> reference = new AtomicStampedReference<>("v1", 1);
Assert.assertEquals(1, reference.getStamp());
Assert.assertEquals("v1", reference.getReference());
Assert.assertEquals(false, reference.compareAndSet("v1", "v2", 2, 2));
Assert.assertEquals(true, reference.compareAndSet("v1", "v2", 1, 2));
Assert.assertEquals(true, reference.attemptStamp("v2", 100));
}
}
| [
"sunyukun@flipboard.cn"
] | sunyukun@flipboard.cn |
57eedb690e205aafb0b7280333fe27e287985940 | 1f109cdafee21aac5668e94926b0e2299e2379a3 | /Awesome/app/src/main/java/com/dismas/imaya/newpipe/DownloadDialog.java | 735287e37ab53f331420a881d9875bd9ff0833b2 | [] | no_license | ImayaDismas/awesome | 91dcfe3395e62368d49cd3411a50405dd456a68d | 7e357cacd999dbfbdaa50e701a49cefc37666d4b | refs/heads/master | 2021-01-17T20:02:20.575650 | 2016-04-12T20:51:33 | 2016-04-12T20:51:33 | 54,651,427 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,424 | java | package com.dismas.imaya.newpipe;
import android.Manifest;
import android.app.Dialog;
import android.app.DownloadManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.DialogFragment;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AlertDialog;
import android.util.Log;
import android.widget.Toast;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
/**
* Created by imaya on 3/25/16.
*/
public class DownloadDialog extends DialogFragment {
private static final String TAG = DialogFragment.class.getName();
public static final String TITLE = "name";
public static final String FILE_SUFFIX_AUDIO = "file_suffix_audio";
public static final String FILE_SUFFIX_VIDEO = "file_suffix_video";
public static final String AUDIO_URL = "audio_url";
public static final String VIDEO_URL = "video_url";
private Bundle arguments;
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
arguments = getArguments();
super.onCreateDialog(savedInstanceState);
if(ContextCompat.checkSelfPermission(this.getContext(), Manifest.permission.WRITE_EXTERNAL_STORAGE)!= PackageManager.PERMISSION_GRANTED)
ActivityCompat.requestPermissions(getActivity(), new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 0);
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle(R.string.download_dialog_title);
// If no audio stream available
if(arguments.getString(AUDIO_URL) == null) {
builder.setItems(R.array.download_options_no_audio, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Context context = getActivity();
String title = arguments.getString(TITLE);
switch (which) {
case 0: // Video
download(arguments.getString(VIDEO_URL),
title,
arguments.getString(FILE_SUFFIX_VIDEO), context);
break;
default:
Log.d(TAG, "lolz");
}
}
});
// If no video stream available
} else if(arguments.getString(VIDEO_URL) == null) {
builder.setItems(R.array.download_options_no_video, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Context context = getActivity();
String title = arguments.getString(TITLE);
switch (which) {
case 0: // Audio
download(arguments.getString(AUDIO_URL),
title,
arguments.getString(FILE_SUFFIX_AUDIO), context);
break;
default:
Log.d(TAG, "lolz");
}
}
});
//if both streams ar available
} else {
builder.setItems(R.array.download_options, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Context context = getActivity();
String title = arguments.getString(TITLE);
switch (which) {
case 0: // Video
download(arguments.getString(VIDEO_URL),
title,
arguments.getString(FILE_SUFFIX_VIDEO), context);
break;
case 1:
download(arguments.getString(AUDIO_URL),
title,
arguments.getString(FILE_SUFFIX_AUDIO), context);
break;
default:
Log.d(TAG, "lolz");
}
}
});
}
return builder.create();
}
/**
* #143 #44 #42 #22: make shure that the filename does not contain illegal chars.
* This should fix some of the "cannot download" problems.
* */
private String createFileName(String fName) {
// from http://eng-przemelek.blogspot.de/2009/07/how-to-create-valid-file-name.html
List<String> forbiddenCharsPatterns = new ArrayList<>();
forbiddenCharsPatterns.add("[:]+"); // Mac OS, but it looks that also Windows XP
forbiddenCharsPatterns.add("[\\*\"/\\\\\\[\\]\\:\\;\\|\\=\\,]+"); // Windows
forbiddenCharsPatterns.add("[^\\w\\d\\.]+"); // last chance... only latin letters and digits
String nameToTest = fName;
for (String pattern : forbiddenCharsPatterns) {
nameToTest = nameToTest.replaceAll(pattern, "_");
}
return nameToTest;
}
private void download(String url, String title, String fileSuffix, Context context) {
File downloadDir = NewPipeSettings.getDownloadFolder();
if(!downloadDir.exists()) {
//attempt to create directory
boolean mkdir = downloadDir.mkdirs();
if(!mkdir && !downloadDir.isDirectory()) {
String message = context.getString(R.string.err_dir_create,downloadDir.toString());
Log.e(TAG, message);
Toast.makeText(context, message, Toast.LENGTH_LONG).show();
return;
}
String message = context.getString(R.string.info_dir_created,downloadDir.toString());
Log.e(TAG, message);
Toast.makeText(context,message , Toast.LENGTH_LONG).show();
}
File saveFilePath = new File(downloadDir,createFileName(title) + fileSuffix);
long id = 0;
if (App.isUsingTor()) {
// if using Tor, do not use DownloadManager because the proxy cannot be set
FileDownloader.downloadFile(getContext(), url, saveFilePath, title);
} else {
DownloadManager dm = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
DownloadManager.Request request = new DownloadManager.Request(
Uri.parse(url));
request.setDestinationUri(Uri.fromFile(saveFilePath));
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
request.setTitle(title);
request.setDescription("'" + url +
"' => '" + saveFilePath + "'");
request.allowScanningByMediaScanner();
try {
id = dm.enqueue(request);
} catch (Exception e) {
e.printStackTrace();
}
}
Log.i(TAG,"Started downloading '" + url +
"' => '" + saveFilePath + "' #" + id);
}
} | [
"imayadismas@gmail.com"
] | imayadismas@gmail.com |
be52fd207db5e50c3cbc42ff5ccf049fbacf8216 | 97bbeb62635dff1c25d2391407ed4e67c4317447 | /app/src/main/java/com/etmay/newradar/MainActivity.java | 05f04a1e6d9836b08f2b6a2d56fb209d51abd34a | [] | no_license | zhelong111/AnimRadar | ee184860886ac665431ef1dedc6692fbe2dbab8f | 265020cb24dbb3a179ccf6c41aeaeb935d390f3b | refs/heads/master | 2021-05-05T07:07:27.367221 | 2018-01-25T03:33:08 | 2018-01-25T03:33:08 | 118,851,984 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 514 | java | package com.etmay.newradar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
RadarView radarView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
radarView = findViewById(R.id.radar);
}
@Override
protected void onDestroy() {
super.onDestroy();
radarView.destroy();
}
}
| [
""
] | |
d924758455748eda4d9c32fdb93cebdbf28b5e3e | cf980bffe5498e34a491d6cdecb0bd2ab6692515 | /src/main/java/io/jokerr/jaxrs/providers/AccessDeniedExceptionMapper.java | f80a2a73166f6431a14c29deaaa3c96d98af0cc2 | [
"MIT"
] | permissive | jokerr/spring-boot-custom-security | 3866aca7b7e11aaac3a9ab5da3f1a745c73f1e1f | 10b10b50637aa514df697ec2d9e365f3ace8dde7 | refs/heads/master | 2021-09-10T17:31:11.585058 | 2018-03-30T03:47:39 | 2018-03-30T03:47:39 | 105,720,789 | 0 | 0 | MIT | 2018-03-30T03:38:57 | 2017-10-04T01:24:02 | Java | UTF-8 | Java | false | false | 776 | java | package io.jokerr.jaxrs.providers;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.access.AccessDeniedException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;
/**
* @author jokerr
*/
@Provider
public class AccessDeniedExceptionMapper implements ExceptionMapper<AccessDeniedException> {
private static final Logger LOGGER = LoggerFactory.getLogger(AccessDeniedExceptionMapper.class);
@Override
public Response toResponse(AccessDeniedException exception) {
LOGGER.debug("Access Denied", exception);
return Response.status(403).entity(exception.getMessage()).type(MediaType.TEXT_PLAIN).build();
}
}
| [
"kerrminator@gmail.com"
] | kerrminator@gmail.com |
b35719a15aa5c08b79a76b8d1571d6bdda29bf78 | e95ac9bf99bab99a59c8e410c9f85c094c5a6e5d | /GeolicaE/src/ru/liveplanet/zt/TextLayer.java | 244c5f7c8b12c0db934d93368fe3e03b9855dbb7 | [] | no_license | rahulyhg/geolika | 1b8af83d864f52a1d8f754461cc15540d23986e2 | be8ef6cfa6a1ddea64d87a1bd98706e414fc47e0 | refs/heads/master | 2021-05-27T22:36:34.074423 | 2014-04-20T20:55:43 | 2014-04-20T20:55:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,302 | java | // **********************************************************************
//
// <copyright>
//
// BBN Technologies
// 10 Moulton Street
// Cambridge, MA 02138
// (617) 873-8000
//
// Copyright (C) BBNT Solutions LLC. All rights reserved.
//
// </copyright>
// **********************************************************************
//
// $Source:
// /cvs/distapps/openmap/src/openmap/com/bbn/openmap/examples/hello/TextLayer.java,v
// $
// $RCSfile: TextLayer.java,v $
// $Revision: 1.2.2.1 $
// $Date: 2004/10/14 18:26:47 $
// $Author: dietrick $
//
// **********************************************************************
package ru.liveplanet.zt;
import java.awt.*;
import com.bbn.openmap.Layer;
import com.bbn.openmap.event.ProjectionEvent;
public class TextLayer extends Layer {
// Projection projection; // not needed in this very simple layer
/**
* During construction, we'll fill this with this Font we wish to
* use
*/
Font font;
String str;
/**
* Construct a TextLayer instance.
*/
public TextLayer(String str) {
font = new Font("TimesRoman", Font.BOLD + Font.ITALIC, 48);
setName("Hello, World"); // pretty name for menus
this.str=str;
}
/**
* In this method we paint on the screen whatever is appropriate
* for this layer.
*/
public void paint(Graphics g) {
Rectangle r = g.getClipBounds();
int halfHeight = r.height / 2;
int halfWidth = r.width / 2;
g.setFont(font);
FontMetrics fm = g.getFontMetrics(font);
int halfStringWidth = fm.stringWidth(str) / 2;
g.setColor(Color.red);
g.drawString(str,
halfWidth - halfStringWidth,
halfHeight);
}
/**
* We have to implement this method. In this simple case, it turns
* out we don't have to reshape our "Hello, World!" display for
* the projection, so this method becomes a NOP.
*
* Normally in this method we would get the projection, and then
* either send it a forward message, or send an OMGraphics the
* project message, and then call repaint().
*/
public void projectionChanged(ProjectionEvent e) {}
} | [
"dmirtsev@gmail.com"
] | dmirtsev@gmail.com |
11406a63a856e912104030e643a393739bcd60d1 | 9c8a74248400cc34e2df7006e71a316b1836a8f0 | /app/src/main/java/com/twopole/app/autoplay/AutoPlayGuard2Activity.java | d0e3e9059ed687cef65cea916f9c43f432942ee4 | [] | no_license | ArmyChen/jpyc | 37f951863cce158ad69f384b8cdee09d25f3130b | e64d2a91b535f907bb52f847cb158a0c36ed1121 | refs/heads/master | 2021-01-19T06:06:39.387689 | 2016-07-27T07:25:52 | 2016-07-27T07:25:52 | 62,375,529 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 386 | java | package com.twopole.app.autoplay;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.twopole.app.R;
public class AutoPlayGuard2Activity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_autoplay_guard_2);
}
}
| [
"450216797@qq.com"
] | 450216797@qq.com |
853a6c30192dc19e57f25ea9016441ccfc28cc8a | f6650d4a9a4b316600068d605782e4e08ca7e1b3 | /src/main/java/com/intercorp/msirdigital/model/dto/response/ClientMetricResponse.java | c02960450a2a86fc606668003ad0d55a80de7bbc | [] | no_license | fsupo/ms-irdigital | f33856077b7e3813d5f790a1d1b219c8be75cd32 | 6557e2c843226fbe730ebe6581582bb8af1e7cb9 | refs/heads/master | 2021-05-23T14:29:18.963716 | 2020-04-05T21:59:16 | 2020-04-05T21:59:16 | 253,340,425 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 616 | java | package com.intercorp.msirdigital.model.dto.response;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class ClientMetricResponse {
private Integer count;
private Double ageAverage;
private Double ageStandarDeviation;
public ClientMetricResponse() {
this.count = 0;
this.ageAverage = 0.0;
this.ageStandarDeviation = 0.0;
}
public ClientMetricResponse(Integer count, Double ageAverage, Double ageStandarDeviation) {
this.count = count;
this.ageAverage = ageAverage;
this.ageStandarDeviation = ageStandarDeviation;
}
}
| [
"fernando.supo6@gmail.com"
] | fernando.supo6@gmail.com |
98def8a98d492968648e963bcda9e9ada08453bc | 0b22eaf2e050c067736f85f17ee088688c36524e | /src/com/sample/org/tweetservlet.java | 2326345e1c86195ee6b5038b1289902b4054bdc7 | [] | no_license | AakashTakale/TweetBlog- | dbd6b8a087181a8f12410f22b0cb298f2828d008 | 54061ac4edcb8318c5df71de73214d505e6cf891 | refs/heads/master | 2021-01-13T00:42:41.893939 | 2016-03-04T07:44:22 | 2016-03-04T07:44:22 | 52,820,874 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,609 | java | package com.sample.org;
import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
import java.util.UUID;
import java.util.ArrayList;
import java.util.Date;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
/**
* Servlet implementation class tweetservlet
*/
@WebServlet("/tweetservlet")
public class tweetservlet extends HttpServlet {
private static final long serialVersionUID = 1L;
public final static Map<String, bean> tweetdb = new HashMap<>();
public final static TreeMap<String, bean> treemap = new TreeMap<String, bean>(tweetdb);
/**
* @see HttpServlet#HttpServlet()
*/
public tweetservlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.getWriter().append("Served at: ").append(request.getContextPath());
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
HttpSession session = request.getSession();
String usercomments = request.getParameter("uc");
if(usercomments.isEmpty())
{
request.getRequestDispatcher("/home.jsp").forward(request, response);
}
else
{
bean b = new bean();
//UUID idOne = UUID.randomUUID();
String tweetid = UUID.randomUUID().toString();
String username = (String) session.getAttribute("username");
DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss MM/dd");
Date d =new Date();
String dat = dateFormat.format(d);
b.setComment(usercomments);
b.setUsername(username);
b.setDate(dat);
b.setTweetid(tweetid);
//response.getWriter().println(""+b.getUsername());
tweetservlet.tweetdb.put(tweetid,b);
request.setAttribute("tweetdata",tweetdb );
request.getRequestDispatcher("/home.jsp").forward(request, response);
}
}
}
| [
"aksh_takale@yahoo.co.in"
] | aksh_takale@yahoo.co.in |
7166524f3c39e48b88a525f8c30c404d7a15a23e | 73dce8d7394a73089e768a7817a9375d53b35d9d | /network_api/src/main/java/com/arch/demo/network_api/errorhandler/ExceptionHandle.java | a91e24aeabcd4046b28eebe3c2241f29ea8084b5 | [] | no_license | WS1009/project | f10d9b7050bd6e512454912788e047e7930af46e | 8872cf4a5e852521230d38777a84079e2e90a5a0 | refs/heads/master | 2022-11-06T10:16:22.373146 | 2020-06-29T11:10:08 | 2020-06-29T11:10:08 | 275,789,328 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,122 | java | package com.arch.demo.network_api.errorhandler;
import android.net.ParseException;
import com.google.gson.JsonParseException;
import com.jakewharton.retrofit2.adapter.rxjava2.HttpException;
import org.apache.http.conn.ConnectTimeoutException;
import org.json.JSONException;
import java.net.ConnectException;
/**
* Created by Allen on 2017/7/20.
* 保留所有版权,未经允许请不要分享到互联网和其他人
*/
public class ExceptionHandle {
private static final int UNAUTHORIZED = 401;
private static final int FORBIDDEN = 403;
private static final int NOT_FOUND = 404;
private static final int REQUEST_TIMEOUT = 408;
private static final int INTERNAL_SERVER_ERROR = 500;
private static final int BAD_GATEWAY = 502;
private static final int SERVICE_UNAVAILABLE = 503;
private static final int GATEWAY_TIMEOUT = 504;
public static ResponeThrowable handleException(Throwable e) {
ResponeThrowable ex;
if (e instanceof HttpException) {
HttpException httpException = (HttpException) e;
ex = new ResponeThrowable(e, ERROR.HTTP_ERROR);
switch (httpException.code()) {
case UNAUTHORIZED:
case FORBIDDEN:
case NOT_FOUND:
case REQUEST_TIMEOUT:
case GATEWAY_TIMEOUT:
case INTERNAL_SERVER_ERROR:
case BAD_GATEWAY:
case SERVICE_UNAVAILABLE:
default:
ex.message = "网络错误";
break;
}
return ex;
} else if (e instanceof ServerException) {
ServerException resultException = (ServerException) e;
ex = new ResponeThrowable(resultException, resultException.code);
ex.message = resultException.message;
return ex;
} else if (e instanceof JsonParseException
|| e instanceof JSONException
|| e instanceof ParseException) {
ex = new ResponeThrowable(e, ERROR.PARSE_ERROR);
ex.message = "解析错误";
return ex;
} else if (e instanceof ConnectException) {
ex = new ResponeThrowable(e, ERROR.NETWORD_ERROR);
ex.message = "连接失败";
return ex;
} else if (e instanceof javax.net.ssl.SSLHandshakeException) {
ex = new ResponeThrowable(e, ERROR.SSL_ERROR);
ex.message = "证书验证失败";
return ex;
} else if (e instanceof ConnectTimeoutException){
ex = new ResponeThrowable(e, ERROR.TIMEOUT_ERROR);
ex.message = "连接超时";
return ex;
} else if (e instanceof java.net.SocketTimeoutException) {
ex = new ResponeThrowable(e, ERROR.TIMEOUT_ERROR);
ex.message = "连接超时";
return ex;
}
else {
ex = new ResponeThrowable(e, ERROR.UNKNOWN);
ex.message = "未知错误";
return ex;
}
}
/**
* 约定异常
*/
public class ERROR {
/**
* 未知错误
*/
public static final int UNKNOWN = 1000;
/**
* 解析错误
*/
public static final int PARSE_ERROR = 1001;
/**
* 网络错误
*/
public static final int NETWORD_ERROR = 1002;
/**
* 协议出错
*/
public static final int HTTP_ERROR = 1003;
/**
* 证书出错
*/
public static final int SSL_ERROR = 1005;
/**
* 连接超时
*/
public static final int TIMEOUT_ERROR = 1006;
}
public static class ResponeThrowable extends Exception {
public int code;
public String message;
public ResponeThrowable(Throwable throwable, int code) {
super(throwable);
this.code = code;
}
}
public class ServerException extends RuntimeException {
public int code;
public String message;
}
}
| [
"wangshun3@jd.com"
] | wangshun3@jd.com |
bb2d58d6dfced3aaf8c4a2bcc4f452efc6fb8fe4 | 55c7241458441ef1b84b9b644a82502eb9c904ab | /src/java/comparators/YearComparator.java | 16a2efc2d791487a2804a80ee9d0ef96b900011b | [] | no_license | LaszloSomogyi/IMDBtop1000 | 888c191246bdc9b7e95d02337555c3aab3950581 | ab3ca5e204f7caab81d6f2f5da0a9bebefb5e337 | refs/heads/main | 2023-03-18T13:10:21.291174 | 2021-03-07T18:10:28 | 2021-03-07T18:10:28 | 344,546,070 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 532 | 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 comparators;
import java.util.Comparator;
import pojos.ImdbTop1000;
/**
*
* @author Somogyi László <proceed step by step>
*/
public class YearComparator implements Comparator<ImdbTop1000>{
@Override
public int compare(ImdbTop1000 o1, ImdbTop1000 o2) {
return o1.getReleasedYear()-o2.getReleasedYear();
}
}
| [
"slsomogyilaszlo@gmail.com"
] | slsomogyilaszlo@gmail.com |
ddfe4a3a87da97a4795eb1e812f0a8009281241a | 342f052a8d0d0948fda0fa215b0012dea6f33387 | /src/test/java/architecture/ActivityDaoTest.java | 36366e94f91d4a61778cffe6d5d68d14aa9b7ce5 | [] | no_license | GergelyMihalyi/training-solutions | 0408f33fae2dd81155622b403c477b0142888aaa | 5f8296414ea5dc13d53821628fe0d8d50feb7b37 | refs/heads/master | 2023-03-25T23:27:14.710593 | 2021-03-16T09:49:18 | 2021-03-16T09:49:18 | 309,600,480 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,115 | java | package architecture;
import com.mysql.cj.jdbc.MysqlDataSource;
import org.flywaydb.core.Flyway;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import simplequery.Activity;
import simplequery.Type;
import java.time.LocalDateTime;
import static org.junit.jupiter.api.Assertions.*;
class ActivityDaoTest {
private ActivityDao activityDao;
@BeforeEach
public void init(){
MysqlDataSource dataSource = new MysqlDataSource();
dataSource.setUrl("jdbc:mysql://localhost:3306/activitytracker?useUnicode=true");
dataSource.setUser("activitytracker");
dataSource.setPassword("activitytracker");
Flyway flyway = Flyway.configure().dataSource(dataSource).load();
flyway.clean();
flyway.migrate();
activityDao = new ActivityDao(dataSource);
}
@Test
public void testInsert() {
Activity a1 = new Activity(LocalDateTime.of(2021,3,6,12,12,12), "first", Type.BASKETBALL);
activityDao.saveActivity(a1);
assertEquals(Type.BASKETBALL, activityDao.findActivityById(1).getType());
}
} | [
"gergely.mihalyi@gmail.com"
] | gergely.mihalyi@gmail.com |
dafcb626899c6fe3483f9df69eddd32727e97dcd | 06a6bde8548236ce01732160745ad58e21702f00 | /src/main/java/Create_Json/JsonOutput.java | a9ba2481bb750cb667e899541bc64ca3e37ca918 | [] | no_license | ychakr2s/Graph_Algorithms | 723f528add219e9580d9dc90054b206c3547b84f | ffc6649b26693a6507f50021f44847fb79a22e7e | refs/heads/master | 2022-06-23T00:02:26.932159 | 2021-01-16T21:17:40 | 2021-01-16T21:17:40 | 184,112,843 | 0 | 0 | null | 2022-05-20T20:57:47 | 2019-04-29T17:17:18 | Java | UTF-8 | Java | false | false | 307 | java | package Create_Json;
import Graph.Graph;
import java.util.ArrayList;
public class JsonOutput {
private Graph Graph;
private ArrayList<Algorithm> algorithms;
public JsonOutput(Graph gr, ArrayList<Algorithm> algorithms) {
this.Graph = gr;
this.algorithms = algorithms;
}
}
| [
"yassine.chakri.gus@gmail.com"
] | yassine.chakri.gus@gmail.com |
880929f8eb2e499de3776bca49e77ed515136d65 | 3b72ec0e7110f0df598302965e35504b77812c7b | /src/main/java/com/xuetangx/memcached/servlet/ServletContainer.java | 01e3fb45efc589a9e484cd34a0b71aea64f82d18 | [] | no_license | xingfei/memcached | 177a8686dc53afb0682de618d5753c5c6c21aeea | e3350aa02c25e981e09b16bbc2a305e0d01cab18 | refs/heads/master | 2021-08-18T22:05:01.116042 | 2017-11-24T03:03:30 | 2017-11-24T03:03:30 | 111,870,023 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 959 | java | /**
*
*/
package com.xuetangx.memcached.servlet;
/**
* @author xingfei
*
*/
public class ServletContainer {
private MemcacheServlet servlet;
private ServletListener listener;
private ServletContext context;
public void start() throws Exception {
if (listener != null) {
listener.contextStart(context);
}
servlet.init(context);
}
public void destroy() {
servlet.destroy();
if (listener != null) {
listener.destroy();
}
servlet = null;
context = null;
listener = null;
}
public MemcacheServlet getServlet() {
return servlet;
}
public void setServlet(MemcacheServlet servlet) {
this.servlet = servlet;
}
public ServletListener getListener() {
return listener;
}
public void setListener(ServletListener listener) {
this.listener = listener;
}
public ServletContext getContext() {
return context;
}
public void setContext(ServletContext context) {
this.context = context;
}
}
| [
"xingfei@xuetangx.com"
] | xingfei@xuetangx.com |
1b9119f785db2eb5d22328735c157b17d3a85a95 | 66fa2ab413c936a67d41a52533e141e32003690c | /zsxc-module-system/src/main/java/com/zs/create/modules/system/service/impl/SysRolePermissionServiceImpl.java | 430c318eed8126cd97b7b20a69b774b1146b7074 | [] | no_license | xjf123321/zsxc-parent | 42cc7bc3ef7fc79b3c047d2a3de9016bc5c9bf58 | c47a6ad62ba0de77a478e445838596e13cc350c0 | refs/heads/master | 2022-12-02T13:04:45.222919 | 2020-03-13T02:11:35 | 2020-03-13T02:11:35 | 246,970,891 | 0 | 0 | null | 2022-11-16T12:16:56 | 2020-03-13T02:19:28 | HTML | UTF-8 | Java | false | false | 3,542 | java | package com.zs.create.modules.system.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zs.create.common.constant.CacheConstant;
import com.zs.create.common.util.oConvertUtils;
import com.zs.create.modules.system.entity.SysRolePermission;
import com.zs.create.modules.system.mapper.SysRolePermissionMapper;
import com.zs.create.modules.system.service.ISysRolePermissionService;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.stereotype.Service;
import java.util.*;
/**
* <p>
* 角色权限表 服务实现类
* </p>
*
* @Author lingrui
* @since 2018-12-21
*/
@Service
public class SysRolePermissionServiceImpl extends ServiceImpl<SysRolePermissionMapper, SysRolePermission> implements ISysRolePermissionService {
@Override
@CacheEvict(value = CacheConstant.LOGIN_USER_RULES_CACHE, allEntries = true)
public void saveRolePermission(String roleId, String permissionIds) {
LambdaQueryWrapper<SysRolePermission> query = new QueryWrapper<SysRolePermission>().lambda().eq(SysRolePermission::getRoleId, roleId);
this.remove(query);
List<SysRolePermission> list = new ArrayList<SysRolePermission>();
String[] arr = permissionIds.split(",");
for (String p : arr) {
if (oConvertUtils.isNotEmpty(p)) {
SysRolePermission rolepms = new SysRolePermission(roleId, p);
list.add(rolepms);
}
}
this.saveBatch(list);
}
@Override
@CacheEvict(value = CacheConstant.LOGIN_USER_RULES_CACHE, allEntries = true)
public void saveRolePermission(String roleId, String permissionIds, String lastPermissionIds) {
List<String> add = getDiff(lastPermissionIds, permissionIds);
if (add != null && add.size() > 0) {
List<SysRolePermission> list = new ArrayList<SysRolePermission>();
for (String p : add) {
if (oConvertUtils.isNotEmpty(p)) {
SysRolePermission rolepms = new SysRolePermission(roleId, p);
list.add(rolepms);
}
}
this.saveBatch(list);
}
List<String> delete = getDiff(permissionIds, lastPermissionIds);
if (delete != null && delete.size() > 0) {
for (String permissionId : delete) {
this.remove(new QueryWrapper<SysRolePermission>().lambda().eq(SysRolePermission::getRoleId, roleId).eq(SysRolePermission::getPermissionId, permissionId));
}
}
}
/**
* 从diff中找出main中没有的元素
*
* @param main
* @param diff
* @return
*/
private List<String> getDiff(String main, String diff) {
if (oConvertUtils.isEmpty(diff)) {
return null;
}
if (oConvertUtils.isEmpty(main)) {
return Arrays.asList(diff.split(","));
}
String[] mainArr = main.split(",");
String[] diffArr = diff.split(",");
Map<String, Integer> map = new HashMap<>();
for (String string : mainArr) {
map.put(string, 1);
}
List<String> res = new ArrayList<String>();
for (String key : diffArr) {
if (oConvertUtils.isNotEmpty(key) && !map.containsKey(key)) {
res.add(key);
}
}
return res;
}
}
| [
"aaxjf123321@163.com"
] | aaxjf123321@163.com |
406f435df364218d31f237ade41a69d864c6bc41 | ade6050e294d323fc9859d0797b410638f941cf5 | /DIGITIME/src/gui/GlobaleEgenskaberOkButtonListener.java | 7e464f6ffb7e3b0226916c1199a960e95d42c759 | [] | no_license | MartinWesthPetersen/Digitime | dbcee79a8345b535393e6dba5533aab3b0151e53 | bf9fad73a62448aa80af75c4e04dc879b30405a6 | refs/heads/master | 2016-09-10T20:29:09.220227 | 2013-11-12T14:53:09 | 2013-11-12T14:53:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 523 | java | package gui;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import appliction.Settings;
public class GlobaleEgenskaberOkButtonListener implements ActionListener {
public static final GlobaleEgenskaberOkButtonListener instance = new GlobaleEgenskaberOkButtonListener();
@Override
public void actionPerformed(ActionEvent arg0) {
String takst = GlobaleEgenskaber.instance.getTextField().getText();
Settings.instance.setStandardtakst(takst);
GlobaleEgenskaber.instance.dispose();
}
}
| [
"martin_westh@hotmail.com"
] | martin_westh@hotmail.com |
75dd66d29819c59bd0799f48041778151e0eac52 | 1e111df57a5fc68213d4d47326adea259f9e572b | /aem65/src/main/java/com/cognifide/qa/bb/aem65/tests/GuiceModule.java | 1833b80a9b12cba8219f1b0cb016ae55110f4479 | [
"Apache-2.0"
] | permissive | wttech/bobcat-aem-tests | b9338824ebf81e26045fb07c5edf8ca4103d0936 | cb2ed0b40f30222f45264762d99c7d07799b5488 | refs/heads/master | 2023-02-23T14:06:23.051175 | 2021-01-28T14:16:14 | 2021-01-28T14:16:14 | 148,498,022 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 708 | java | package com.cognifide.qa.bb.aem65.tests;
import com.cognifide.qa.bb.aem65.tests.pageobjects.TextComponent;
import com.cognifide.qa.bb.aem65.tests.pageobjects.TextComponentImpl;
import com.google.inject.AbstractModule;
/**
* Your Guice module.
* <p/>
* The two modules that are installed here are probably the minimum that you'll want to have in your
* project.
* <p/>
* CoreModule -- all core functionality, like scope PageObjects or FrameSwitcher. ReporterModule --
* reporting functionality, including reporting rule and HTML report.
*/
public class GuiceModule extends AbstractModule {
@Override
protected void configure() {
bind(TextComponent.class).to(TextComponentImpl.class);
}
}
| [
"mich.krzyzanowski@gmail.com"
] | mich.krzyzanowski@gmail.com |
4d9d8098a66e5c092736a3fbbbd7e29ea11ca851 | dd745c6563a1f96e7c6f70c813d08683622828d2 | /alignments/src/main/java/eu/fbk/fm/alignments/output/CSVResultWriter.java | 823e85928e6504c6edfd2fb46b1dd7d66112b46a | [
"Apache-2.0"
] | permissive | Remper/sociallink | 776e80b04a2f115868ba3e61ad9fa7c19c6dd0af | 517becd115999914901b4503baa108849058be2c | refs/heads/master | 2021-01-19T20:41:52.615752 | 2018-10-08T17:25:48 | 2018-10-08T17:25:48 | 64,405,938 | 15 | 3 | null | null | null | null | UTF-8 | Java | false | false | 1,440 | java | package eu.fbk.fm.alignments.output;
import com.google.common.base.Charsets;
import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVPrinter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.List;
import java.util.zip.GZIPOutputStream;
/**
* Writes CSV with the results to disk
*
* @author Yaroslav Nechaev (remper@me.com)
*/
public class CSVResultWriter implements ResultWriter {
private final CSVPrinter csvWriter;
public CSVResultWriter(File output) throws IOException {
csvWriter = new CSVPrinter(
new OutputStreamWriter(new GZIPOutputStream(new FileOutputStream(output)), Charsets.UTF_8),
CSVFormat.DEFAULT);
}
@Override
public void write(String resourceId, List<DumpResource.Candidate> candidates, Long trueUid) {
try {
for (DumpResource.Candidate candidate : candidates) {
csvWriter.printRecord(resourceId, candidate.uid, candidate.score, candidate.is_alignment);
}
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public void flush() {
try {
csvWriter.flush();
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public void close() throws IOException {
csvWriter.close();
}
}
| [
"remper@me.com"
] | remper@me.com |
0e8ad0275d43736eca15b0610711c0981e860d17 | bd3296a9ed115058bd18086878a2db1e6630b6f0 | /src/main/java/bf/onea/domain/PersistentAuditEvent.java | c8715f0a7e3d2b54be13dff1491e5d42a2a3a14c | [] | no_license | Kadsuke/sidotapp | 7e5df866ed917607759c4427fe4f153ea6024e8e | ded26aaad10085c50efcd97c34ba6c1a0e2ab7c3 | refs/heads/main | 2023-01-31T20:49:16.371591 | 2020-12-14T09:02:39 | 2020-12-14T09:02:39 | 316,159,926 | 0 | 0 | null | 2020-12-14T09:02:41 | 2020-11-26T07:56:10 | TypeScript | UTF-8 | Java | false | false | 2,607 | java | package bf.onea.domain;
import java.io.Serializable;
import java.time.Instant;
import java.util.HashMap;
import java.util.Map;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
/**
* Persist AuditEvent managed by the Spring Boot actuator.
*
* @see org.springframework.boot.actuate.audit.AuditEvent
*/
@Entity
@Table(name = "jhi_persistent_audit_event")
public class PersistentAuditEvent implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
@SequenceGenerator(name = "sequenceGenerator")
@Column(name = "event_id")
private Long id;
@NotNull
@Column(nullable = false)
private String principal;
@Column(name = "event_date")
private Instant auditEventDate;
@Column(name = "event_type")
private String auditEventType;
@ElementCollection
@MapKeyColumn(name = "name")
@Column(name = "value")
@CollectionTable(name = "jhi_persistent_audit_evt_data", joinColumns = @JoinColumn(name = "event_id"))
private Map<String, String> data = new HashMap<>();
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getPrincipal() {
return principal;
}
public void setPrincipal(String principal) {
this.principal = principal;
}
public Instant getAuditEventDate() {
return auditEventDate;
}
public void setAuditEventDate(Instant auditEventDate) {
this.auditEventDate = auditEventDate;
}
public String getAuditEventType() {
return auditEventType;
}
public void setAuditEventType(String auditEventType) {
this.auditEventType = auditEventType;
}
public Map<String, String> getData() {
return data;
}
public void setData(Map<String, String> data) {
this.data = data;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof PersistentAuditEvent)) {
return false;
}
return id != null && id.equals(((PersistentAuditEvent) o).id);
}
@Override
public int hashCode() {
return 31;
}
// prettier-ignore
@Override
public String toString() {
return "PersistentAuditEvent{" +
"principal='" + principal + '\'' +
", auditEventDate=" + auditEventDate +
", auditEventType='" + auditEventType + '\'' +
'}';
}
}
| [
"jhipster-bot@jhipster.tech"
] | jhipster-bot@jhipster.tech |
4642fae48863911e7e6345b93325eb8870c33290 | 97ede59f3eb5d842b887f97e0ff17a14a9d47b76 | /UF-3.1.2/src/AlgoritmOrdenacion/Ejercicio3.java | cae7867b00268e58cdcb824334124ffd02656c05 | [] | no_license | jorgepachon/Proyectos-Java | adc4c39af1996dba29b7cb852fd6a3f5babf4717 | f52c811eee66c3b17b7757402c805773ae988218 | refs/heads/master | 2021-01-23T03:20:55.781727 | 2017-04-29T16:19:54 | 2017-04-29T16:19:54 | 86,068,461 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 682 | java | package AlgoritmOrdenacion;
import java.util.Arrays;
public class Ejercicio3 {
public static void main(String[] args) {
int[] sueldos = { 1200, 750, 820, 550, 490 };
int aux;
int pasos=0;//esto se añade despues
// Implementa el algoritmo que acabas de ver en la parte teórica
for (int k = 0; k < sueldos.length-1; k++) {
for (int f = 0; f < sueldos.length - 1 -k; f++) { //-k reduce pasos
pasos++;
if (sueldos[f] > sueldos[f + 1]) {
aux = sueldos[f];
sueldos[f] = sueldos[f + 1];
sueldos[f + 1] = aux;
}
}
}
System.out.println(Arrays.toString(sueldos));
System.out.println("algoritmo resuelto en "+pasos+" pasos");
}
}
| [
"jorge.pachon@live.u-tad-com"
] | jorge.pachon@live.u-tad-com |
fdb1c70b6e34cff9668bec6243f5a01d41ba5c44 | 71da7e88d6f9a326fd06f62e7ea5ff5a222d7793 | /app/src/main/java/co/id/shope/fragments/CartPembayaranFragment.java | e53571fa6fa4f8ed588f9a9d49c0cbb4f897b007 | [] | no_license | kyky04/aplikasimandiri-client | 86094978d596862508ceb9ee13163b2e4fe80d58 | 627f8f30d68dbb43be712de7d8f7eb42e2ae99ee | refs/heads/master | 2020-04-14T01:05:46.555312 | 2018-12-30T01:00:39 | 2018-12-30T01:00:39 | 163,551,932 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,953 | java | package co.id.shope.fragments;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.widget.CardView;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.androidnetworking.AndroidNetworking;
import com.androidnetworking.error.ANError;
import com.androidnetworking.interfaces.ParsedRequestListener;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;
import co.id.shope.R;
import co.id.shope.activities.CheckOutActivity;
import co.id.shope.adapters.BankAdapter;
import co.id.shope.adapters.ShippingAdapter;
import co.id.shope.data.Contans;
import co.id.shope.models.BankResponse;
import co.id.shope.models.DataItemBank;
import co.id.shope.utils.CommonUtil;
import co.id.shope.views.SliderIndicator;
/**
* A simple {@link Fragment} subclass.
* Activities that contain this fragment must implement the
* {@link OnFragmentInteractionListener} interface
* to handle interaction events.
*/
public class CartPembayaranFragment extends Fragment {
private static final String TAG = "CartShippingFragment";
@BindView(R.id.recycler_pembayaran)
RecyclerView recyclerPembayaran;
@BindView(R.id.card)
CardView card;
Unbinder unbinder;
ProgressDialog progressDialog;
ShippingAdapter shippingAdapter;
BankAdapter adapter;
int id_bank = 0;
String nama_bank, norek,atas_nama ="";
private OnFragmentInteractionListener mListener;
private SliderIndicator mIndicator;
public CartPembayaranFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_pembayaran, container, false);
unbinder = ButterKnife.bind(this, view);
recyclerPembayaran.setLayoutManager(new LinearLayoutManager(getActivity()));
adapter = new BankAdapter(getActivity());
recyclerPembayaran.setAdapter(adapter);
loadAlamat();
adapter.setOnItemClickListener(new BankAdapter.OnItemClickListener() {
@Override
public void onClick(DataItemBank bank) {
Log.d(TAG, "onClick: " + bank.getId());
id_bank = bank.getId();
atas_nama = bank.getAtasNama();
norek = bank.getNoRekening();
nama_bank = bank.getNamaBank();
}
});
return view;
}
@Override
public void onDestroyView() {
super.onDestroyView();
unbinder.unbind();
}
public interface OnFragmentInteractionListener {
void onFragmentInteraction();
}
void loadAlamat() {
openDialog();
AndroidNetworking.get(Contans.BANK)
.build()
.getAsObject(BankResponse.class, new ParsedRequestListener() {
@Override
public void onResponse(Object response) {
closerDialog();
if (response instanceof BankResponse) {
adapter.swap(((BankResponse) response).getData());
}
}
@Override
public void onError(ANError anError) {
closerDialog();
}
});
}
void openDialog() {
progressDialog = new ProgressDialog(getActivity());
progressDialog.setMessage("Loading . . .");
progressDialog.setCancelable(false);
progressDialog.show();
}
void closerDialog() {
progressDialog.dismiss();
}
void openFragment(Fragment fragment) {
FragmentManager manager = getFragmentManager();
FragmentTransaction transaction = manager.beginTransaction();
transaction.add(android.R.id.content, fragment).addToBackStack(null).commit();
transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
}
public boolean getIdbank() {
if (id_bank != 0) {
Log.d(TAG, "getIdbank: "+atas_nama);
((CheckOutActivity) getActivity()).setBank(id_bank);
((CheckOutActivity) getActivity()).getReview().setAtas_nama(atas_nama);
((CheckOutActivity) getActivity()).getReview().setRekening(nama_bank);
((CheckOutActivity) getActivity()).getReview().setNo_rek(norek);
return true;
} else {
CommonUtil.showToast(getActivity(), "Anda Belum memilih bank !");
return false;
}
}
}
| [
"rizki@pragmainf.co.id"
] | rizki@pragmainf.co.id |
096ebfa9797fc01940ce4d13e773b745eb6990f2 | ec847a6172d991a8a5692ceb1cae37c33d3733c2 | /app/src/test/java/com/zhsw/mytest01/ExampleUnitTest.java | cf12b90de0e6b7a47474f2f731f59e29d5f83877 | [] | no_license | xipioyou/MyTest02 | 090e434373b3a46c5e74afbd8b2056b003fdc4f5 | d5aa42d029778ca0798843430e6fe89cc603680e | refs/heads/master | 2021-10-19T07:07:41.687634 | 2019-02-19T02:44:12 | 2019-02-19T02:44:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 378 | java | package com.zhsw.mytest01;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"20799463@qq.com"
] | 20799463@qq.com |
ceba94285f9a6f58a0f7d632db5c278613a6d2be | f70fbda194888eb872c6de5550fde037b6cf46a4 | /src/Entity/FireBall.java | 405ab21de34c2a90a2852b2d6350da272c4f2e35 | [] | no_license | vaughnthesheep/Kill-The-Scene | 9d9111f6631bd3bdb96fdcd2518750fbdcb83575 | 26cf21420d7d82cdc8b1cf34b61cc5ca72a6c890 | refs/heads/master | 2020-12-24T16:16:34.223416 | 2014-07-29T01:37:57 | 2014-07-29T01:37:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,686 | java | package Entity;
import java.awt.image.BufferedImage;
import javax.imageio.ImageIO;
import java.awt.*;
import TileMap.TileMap;
public class FireBall extends MapObject{
private boolean hit;
private boolean remove;
private BufferedImage[] sprites;
private BufferedImage[] hitSprites;
public FireBall(TileMap tm, boolean right)
{
super(tm);
facingRight = right;
moveSpeed = 3.8;
if(right) dx = moveSpeed;
else dx = -moveSpeed;
width = 30;
height = 30;
cwidth = 14;
cheight = 14;
// load sprites
try
{
BufferedImage spritesheet = ImageIO.read(getClass().getResourceAsStream("/Sprites/Player/fireball.gif"));
sprites = new BufferedImage[4];
for(int i = 0; i < sprites.length; i++)
{
sprites[i] = spritesheet.getSubimage(
i * width,
0,
width,
height
);
}
hitSprites = new BufferedImage[3];
for(int i = 0; i < hitSprites.length; i++)
{
hitSprites[i] = spritesheet.getSubimage(
i * width,
height,
width,
height
);
}
animation = new Animation();
animation.setFrames(sprites);
animation.setDelay(70);
}
catch(Exception e)
{
e.printStackTrace();
}
}
public void setHit()
{
if(hit) return;
hit = true;
animation.setFrames(hitSprites);
animation.setDelay(70);
dx = 0;
}
public boolean shouldRemove(){ return remove; }
public void update()
{
checkTileMapCollision();
setPosition(xtemp, ytemp);
if(dx == 0 && !hit)
{
setHit();
}
animation.update();
if(hit && animation.hasPlayedOnce())
{
remove = true;
}
}
public void draw(Graphics2D g)
{
setMapPosition();
super.draw(g);
}
}
| [
"vaughnthesheep@gmail.com"
] | vaughnthesheep@gmail.com |
3128cdefc986d0a87813249a98d22c813cb67058 | 9cf806ca441bd08de11b58e750932468bd47ce57 | /SprHibStrt/src/com/lbr/dao/hibernate/domain/CountryHome.java | f2cc4ea5e6235d05eb573e51e1e181fc0eaecd27 | [] | no_license | vikaswaters/lbrrepo | edfbde9f88a711b0d0e58c71737e3426960fa262 | 51c6ee7aa0a1de9536a7b66cf405f3e097284f3e | HEAD | 2016-09-05T10:45:42.845909 | 2011-06-14T11:12:29 | 2011-06-14T11:13:54 | 1,784,802 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,463 | java | package com.lbr.dao.hibernate.domain;
// Generated Feb 23, 2011 12:34:52 PM by Hibernate Tools 3.4.0.Beta1
import java.util.List;
import javax.naming.InitialContext;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.LockMode;
import org.hibernate.SessionFactory;
import static org.hibernate.criterion.Example.create;
/**
* Home object for domain model class Country.
* @see com.lbr.dao.hibernate.domain.Country
* @author Hibernate Tools
*/
public class CountryHome {
private static final Log log = LogFactory.getLog(CountryHome.class);
private final SessionFactory sessionFactory = getSessionFactory();
protected SessionFactory getSessionFactory() {
try {
return (SessionFactory) new InitialContext()
.lookup("SessionFactory");
} catch (Exception e) {
log.error("Could not locate SessionFactory in JNDI", e);
throw new IllegalStateException(
"Could not locate SessionFactory in JNDI");
}
}
public void persist(Country transientInstance) {
log.debug("persisting Country instance");
try {
sessionFactory.getCurrentSession().persist(transientInstance);
log.debug("persist successful");
} catch (RuntimeException re) {
log.error("persist failed", re);
throw re;
}
}
public void attachDirty(Country instance) {
log.debug("attaching dirty Country instance");
try {
sessionFactory.getCurrentSession().saveOrUpdate(instance);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public void attachClean(Country instance) {
log.debug("attaching clean Country instance");
try {
sessionFactory.getCurrentSession().lock(instance, LockMode.NONE);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public void delete(Country persistentInstance) {
log.debug("deleting Country instance");
try {
sessionFactory.getCurrentSession().delete(persistentInstance);
log.debug("delete successful");
} catch (RuntimeException re) {
log.error("delete failed", re);
throw re;
}
}
public Country merge(Country detachedInstance) {
log.debug("merging Country instance");
try {
Country result = (Country) sessionFactory.getCurrentSession()
.merge(detachedInstance);
log.debug("merge successful");
return result;
} catch (RuntimeException re) {
log.error("merge failed", re);
throw re;
}
}
public Country findById(java.lang.Integer id) {
log.debug("getting Country instance with id: " + id);
try {
Country instance = (Country) sessionFactory.getCurrentSession()
.get("com.lbr.dao.hibernate.Country", id);
if (instance == null) {
log.debug("get successful, no instance found");
} else {
log.debug("get successful, instance found");
}
return instance;
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
}
public List<Country> findByExample(Country instance) {
log.debug("finding Country instance by example");
try {
List<Country> results = (List<Country>) sessionFactory
.getCurrentSession()
.createCriteria("com.lbr.dao.hibernate.Country")
.add(create(instance)).list();
log.debug("find by example successful, result size: "
+ results.size());
return results;
} catch (RuntimeException re) {
log.error("find by example failed", re);
throw re;
}
}
}
| [
"vikas_sinha@hotmail.com"
] | vikas_sinha@hotmail.com |
716995bc9391e98844fbc9f05ad6ba7f930dbf57 | 30ee9f52bb05060e09f07088e4a75fd38725c9a0 | /thread_jvm_os_concurrent_io_netty/src/main/java/org/anonymous/netty/netty/codec2/MyDataInfo.java | 792ed3ba2923fb32a2ac61ff601ea35a5b567eec | [] | no_license | childnn/childone | be3b67c0aac4e89ed1305efd5b1f79f390974306 | 6c6ac01cb2130581c85e5514f6fcf9712e9d1e2d | refs/heads/master | 2023-06-25T03:45:22.285934 | 2023-06-07T08:46:33 | 2023-06-07T08:46:33 | 218,492,936 | 0 | 0 | null | 2023-06-14T22:55:25 | 2019-10-30T09:42:18 | Java | UTF-8 | Java | false | true | 75,575 | java | // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: Student.proto
package org.anonymous.netty.netty.codec2;
import com.google.protobuf.AbstractMessageLite;
public final class MyDataInfo {
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_MyMessage_descriptor;
private static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_MyMessage_fieldAccessorTable;
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_Student_descriptor;
private static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_Student_fieldAccessorTable;
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_Worker_descriptor;
private static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_Worker_fieldAccessorTable;
private static com.google.protobuf.Descriptors.FileDescriptor
descriptor;
static {
String[] descriptorData = {
"\n\rStudent.proto\"\244\001\n\tMyMessage\022&\n\tdata_ty" +
"pe\030\001 \001(\0162\023.MyMessage.DataType\022\033\n\007student" +
"\030\002 \001(\0132\010.StudentH\000\022\031\n\006worker\030\003 \001(\0132\007.Wor" +
"kerH\000\"+\n\010DataType\022\017\n\013StudentType\020\000\022\016\n\nWo" +
"rkerType\020\001B\n\n\010dataBody\"#\n\007Student\022\n\n\002id\030" +
"\001 \001(\005\022\014\n\004name\030\002 \001(\t\"#\n\006Worker\022\014\n\004name\030\001 " +
"\001(\t\022\013\n\003age\030\002 \001(\005B(\n\030org.anonymous.netty.co" +
"dec2B\nMyDataInfoH\001b\006proto3"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
public com.google.protobuf.ExtensionRegistry assignDescriptors(
com.google.protobuf.Descriptors.FileDescriptor root) {
descriptor = root;
return null;
}
};
com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[]{
}, assigner);
internal_static_MyMessage_descriptor =
getDescriptor().getMessageTypes().get(0);
internal_static_MyMessage_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_MyMessage_descriptor,
new String[]{"DataType", "Student", "Worker", "DataBody",});
internal_static_Student_descriptor =
getDescriptor().getMessageTypes().get(1);
internal_static_Student_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_Student_descriptor,
new String[]{"Id", "Name",});
internal_static_Worker_descriptor =
getDescriptor().getMessageTypes().get(2);
internal_static_Worker_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_Worker_descriptor,
new String[]{"Name", "Age",});
}
private MyDataInfo() {
}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistryLite registry) {
}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistry registry) {
registerAllExtensions(
(com.google.protobuf.ExtensionRegistryLite) registry);
}
public static com.google.protobuf.Descriptors.FileDescriptor
getDescriptor() {
return descriptor;
}
public interface MyMessageOrBuilder extends
// @@protoc_insertion_point(interface_extends:MyMessage)
com.google.protobuf.MessageOrBuilder {
/**
* <pre>
* 用data_type 来标识传的是哪一个枚举类型
* </pre>
*
* <code>.MyMessage.DataType data_type = 1;</code>
*/
int getDataTypeValue();
/**
* <pre>
* 用data_type 来标识传的是哪一个枚举类型
* </pre>
*
* <code>.MyMessage.DataType data_type = 1;</code>
*/
MyMessage.DataType getDataType();
/**
* <code>.Student student = 2;</code>
*/
boolean hasStudent();
/**
* <code>.Student student = 2;</code>
*/
Student getStudent();
/**
* <code>.Student student = 2;</code>
*/
StudentOrBuilder getStudentOrBuilder();
/**
* <code>.Worker worker = 3;</code>
*/
boolean hasWorker();
/**
* <code>.Worker worker = 3;</code>
*/
Worker getWorker();
/**
* <code>.Worker worker = 3;</code>
*/
WorkerOrBuilder getWorkerOrBuilder();
MyMessage.DataBodyCase getDataBodyCase();
}
public interface StudentOrBuilder extends
// @@protoc_insertion_point(interface_extends:Student)
com.google.protobuf.MessageOrBuilder {
/**
* <pre>
* Student类的属性
* </pre>
*
* <code>int32 id = 1;</code>
*/
int getId();
/**
* <pre>
* </pre>
*
* <code>string name = 2;</code>
*/
String getName();
/**
* <pre>
* </pre>
*
* <code>string name = 2;</code>
*/
com.google.protobuf.ByteString
getNameBytes();
}
public interface WorkerOrBuilder extends
// @@protoc_insertion_point(interface_extends:Worker)
com.google.protobuf.MessageOrBuilder {
/**
* <code>string name = 1;</code>
*/
String getName();
/**
* <code>string name = 1;</code>
*/
com.google.protobuf.ByteString
getNameBytes();
/**
* <code>int32 age = 2;</code>
*/
int getAge();
}
/**
* <pre>
* protobuf 可以使用message 管理其他的message
* </pre>
* <p>
* Protobuf type {@code MyMessage}
*/
public static final class MyMessage extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:MyMessage)
MyMessageOrBuilder {
public static final int DATA_TYPE_FIELD_NUMBER = 1;
public static final int STUDENT_FIELD_NUMBER = 2;
public static final int WORKER_FIELD_NUMBER = 3;
private static final long serialVersionUID = 0L;
// @@protoc_insertion_point(class_scope:MyMessage)
private static final MyMessage DEFAULT_INSTANCE;
private static final com.google.protobuf.Parser<MyMessage>
PARSER = new com.google.protobuf.AbstractParser<MyMessage>() {
@Override
public MyMessage parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new MyMessage(input, extensionRegistry);
}
};
static {
DEFAULT_INSTANCE = new MyMessage();
}
private int dataBodyCase_ = 0;
private Object dataBody_;
private int dataType_;
private byte memoizedIsInitialized = -1;
// Use MyMessage.newBuilder() to construct.
private MyMessage(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private MyMessage() {
dataType_ = 0;
}
private MyMessage(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
if (extensionRegistry == null) {
throw new NullPointerException();
}
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 8: {
int rawValue = input.readEnum();
dataType_ = rawValue;
break;
}
case 18: {
Student.Builder subBuilder = null;
if (dataBodyCase_ == 2) {
subBuilder = ((Student) dataBody_).toBuilder();
}
dataBody_ =
input.readMessage(Student.parser(), extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom((Student) dataBody_);
dataBody_ = subBuilder.buildPartial();
}
dataBodyCase_ = 2;
break;
}
case 26: {
Worker.Builder subBuilder = null;
if (dataBodyCase_ == 3) {
subBuilder = ((Worker) dataBody_).toBuilder();
}
dataBody_ =
input.readMessage(Worker.parser(), extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom((Worker) dataBody_);
dataBody_ = subBuilder.buildPartial();
}
dataBodyCase_ = 3;
break;
}
default: {
if (!parseUnknownFieldProto3(
input, unknownFields, extensionRegistry, tag)) {
done = true;
}
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return MyDataInfo.internal_static_MyMessage_descriptor;
}
public static MyMessage parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static MyMessage parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static MyMessage parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static MyMessage parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static MyMessage parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static MyMessage parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static MyMessage parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static MyMessage parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static MyMessage parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static MyMessage parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static MyMessage parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static MyMessage parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(MyMessage prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
public static MyMessage getDefaultInstance() {
return DEFAULT_INSTANCE;
}
public static com.google.protobuf.Parser<MyMessage> parser() {
return PARSER;
}
@Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
@Override
protected FieldAccessorTable
internalGetFieldAccessorTable() {
return MyDataInfo.internal_static_MyMessage_fieldAccessorTable
.ensureFieldAccessorsInitialized(
MyMessage.class, Builder.class);
}
public DataBodyCase
getDataBodyCase() {
return DataBodyCase.forNumber(
dataBodyCase_);
}
/**
* <pre>
* 用data_type 来标识传的是哪一个枚举类型
* </pre>
*
* <code>.MyMessage.DataType data_type = 1;</code>
*/
public int getDataTypeValue() {
return dataType_;
}
/**
* <pre>
* 用data_type 来标识传的是哪一个枚举类型
* </pre>
*
* <code>.MyMessage.DataType data_type = 1;</code>
*/
public DataType getDataType() {
DataType result = DataType.valueOf(dataType_);
return result == null ? DataType.UNRECOGNIZED : result;
}
/**
* <code>.Student student = 2;</code>
*/
public boolean hasStudent() {
return dataBodyCase_ == 2;
}
/**
* <code>.Student student = 2;</code>
*/
public Student getStudent() {
if (dataBodyCase_ == 2) {
return (Student) dataBody_;
}
return Student.getDefaultInstance();
}
/**
* <code>.Student student = 2;</code>
*/
public StudentOrBuilder getStudentOrBuilder() {
if (dataBodyCase_ == 2) {
return (Student) dataBody_;
}
return Student.getDefaultInstance();
}
/**
* <code>.Worker worker = 3;</code>
*/
public boolean hasWorker() {
return dataBodyCase_ == 3;
}
/**
* <code>.Worker worker = 3;</code>
*/
public Worker getWorker() {
if (dataBodyCase_ == 3) {
return (Worker) dataBody_;
}
return Worker.getDefaultInstance();
}
/**
* <code>.Worker worker = 3;</code>
*/
public WorkerOrBuilder getWorkerOrBuilder() {
if (dataBodyCase_ == 3) {
return (Worker) dataBody_;
}
return Worker.getDefaultInstance();
}
@Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
@Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
if (dataType_ != DataType.StudentType.getNumber()) {
output.writeEnum(1, dataType_);
}
if (dataBodyCase_ == 2) {
output.writeMessage(2, (Student) dataBody_);
}
if (dataBodyCase_ == 3) {
output.writeMessage(3, (Worker) dataBody_);
}
unknownFields.writeTo(output);
}
@Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (dataType_ != DataType.StudentType.getNumber()) {
size += com.google.protobuf.CodedOutputStream
.computeEnumSize(1, dataType_);
}
if (dataBodyCase_ == 2) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(2, (Student) dataBody_);
}
if (dataBodyCase_ == 3) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(3, (Worker) dataBody_);
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
}
@Override
public boolean equals(final Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof MyMessage)) {
return super.equals(obj);
}
MyMessage other = (MyMessage) obj;
boolean result = true;
result = result && dataType_ == other.dataType_;
result = result && getDataBodyCase().equals(
other.getDataBodyCase());
if (!result) return false;
switch (dataBodyCase_) {
case 2:
result = result && getStudent()
.equals(other.getStudent());
break;
case 3:
result = result && getWorker()
.equals(other.getWorker());
break;
case 0:
default:
}
result = result && unknownFields.equals(other.unknownFields);
return result;
}
@Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + DATA_TYPE_FIELD_NUMBER;
hash = (53 * hash) + dataType_;
switch (dataBodyCase_) {
case 2:
hash = (37 * hash) + STUDENT_FIELD_NUMBER;
hash = (53 * hash) + getStudent().hashCode();
break;
case 3:
hash = (37 * hash) + WORKER_FIELD_NUMBER;
hash = (53 * hash) + getWorker().hashCode();
break;
case 0:
default:
}
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
@Override
public Builder newBuilderForType() {
return newBuilder();
}
@Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@Override
protected Builder newBuilderForType(
BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
@Override
public com.google.protobuf.Parser<MyMessage> getParserForType() {
return PARSER;
}
@Override
public MyMessage getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
/**
* <pre>
* 定义一个枚举类型
* </pre>
* <p>
* Protobuf enum {@code MyMessage.DataType}
*/
public enum DataType
implements com.google.protobuf.ProtocolMessageEnum {
/**
* <pre>
* 在proto3 要求enum的编号从0开始
* </pre>
*
* <code>StudentType = 0;</code>
*/
StudentType(0),
/**
* <code>WorkerType = 1;</code>
*/
WorkerType(1),
UNRECOGNIZED(-1),
;
/**
* <pre>
* 在proto3 要求enum的编号从0开始
* </pre>
*
* <code>StudentType = 0;</code>
*/
public static final int StudentType_VALUE = 0;
/**
* <code>WorkerType = 1;</code>
*/
public static final int WorkerType_VALUE = 1;
private static final com.google.protobuf.Internal.EnumLiteMap<
DataType> internalValueMap =
new com.google.protobuf.Internal.EnumLiteMap<DataType>() {
public DataType findValueByNumber(int number) {
return DataType.forNumber(number);
}
};
private static final DataType[] VALUES = values();
private final int value;
DataType(int value) {
this.value = value;
}
/**
* @deprecated Use {@link #forNumber(int)} instead.
*/
@Deprecated
public static DataType valueOf(int value) {
return forNumber(value);
}
public static DataType forNumber(int value) {
switch (value) {
case 0:
return StudentType;
case 1:
return WorkerType;
default:
return null;
}
}
public static com.google.protobuf.Internal.EnumLiteMap<DataType>
internalGetValueMap() {
return internalValueMap;
}
public static final com.google.protobuf.Descriptors.EnumDescriptor
getDescriptor() {
return MyMessage.getDescriptor().getEnumTypes().get(0);
}
public static DataType valueOf(
com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
if (desc.getType() != getDescriptor()) {
throw new IllegalArgumentException(
"EnumValueDescriptor is not for this type.");
}
if (desc.getIndex() == -1) {
return UNRECOGNIZED;
}
return VALUES[desc.getIndex()];
}
public final int getNumber() {
if (this == UNRECOGNIZED) {
throw new IllegalArgumentException(
"Can't get the number of an unknown enum value.");
}
return value;
}
public final com.google.protobuf.Descriptors.EnumValueDescriptor
getValueDescriptor() {
return getDescriptor().getValues().get(ordinal());
}
public final com.google.protobuf.Descriptors.EnumDescriptor
getDescriptorForType() {
return getDescriptor();
}
// @@protoc_insertion_point(enum_scope:MyMessage.DataType)
}
public enum DataBodyCase
implements com.google.protobuf.Internal.EnumLite {
STUDENT(2),
WORKER(3),
DATABODY_NOT_SET(0);
private final int value;
DataBodyCase(int value) {
this.value = value;
}
/**
* @deprecated Use {@link #forNumber(int)} instead.
*/
@Deprecated
public static DataBodyCase valueOf(int value) {
return forNumber(value);
}
public static DataBodyCase forNumber(int value) {
switch (value) {
case 2:
return STUDENT;
case 3:
return WORKER;
case 0:
return DATABODY_NOT_SET;
default:
return null;
}
}
public int getNumber() {
return this.value;
}
}
/**
* <pre>
* protobuf 可以使用message 管理其他的message
* </pre>
* <p>
* Protobuf type {@code MyMessage}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:MyMessage)
MyMessageOrBuilder {
private int dataBodyCase_ = 0;
private Object dataBody_;
private int dataType_ = 0;
private com.google.protobuf.SingleFieldBuilderV3<
Student, Student.Builder, StudentOrBuilder> studentBuilder_;
private com.google.protobuf.SingleFieldBuilderV3<
Worker, Worker.Builder, WorkerOrBuilder> workerBuilder_;
// Construct using org.anonymous.netty.codec2.MyDataInfo.MyMessage.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return MyDataInfo.internal_static_MyMessage_descriptor;
}
@Override
protected FieldAccessorTable
internalGetFieldAccessorTable() {
return MyDataInfo.internal_static_MyMessage_fieldAccessorTable
.ensureFieldAccessorsInitialized(
MyMessage.class, Builder.class);
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
}
}
@Override
public Builder clear() {
super.clear();
dataType_ = 0;
dataBodyCase_ = 0;
dataBody_ = null;
return this;
}
@Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return MyDataInfo.internal_static_MyMessage_descriptor;
}
@Override
public MyMessage getDefaultInstanceForType() {
return MyMessage.getDefaultInstance();
}
@Override
public MyMessage build() {
MyMessage result = buildPartial();
if (!result.isInitialized()) {
throw Builder.newUninitializedMessageException(result);
}
return result;
}
@Override
public MyMessage buildPartial() {
MyMessage result = new MyMessage(this);
result.dataType_ = dataType_;
if (dataBodyCase_ == 2) {
if (studentBuilder_ == null) {
result.dataBody_ = dataBody_;
} else {
result.dataBody_ = studentBuilder_.build();
}
}
if (dataBodyCase_ == 3) {
if (workerBuilder_ == null) {
result.dataBody_ = dataBody_;
} else {
result.dataBody_ = workerBuilder_.build();
}
}
result.dataBodyCase_ = dataBodyCase_;
onBuilt();
return result;
}
@Override
public Builder clone() {
return super.clone();
}
@Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
Object value) {
return super.setField(field, value);
}
@Override
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return super.clearField(field);
}
@Override
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return super.clearOneof(oneof);
}
@Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, Object value) {
return super.setRepeatedField(field, index, value);
}
@Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
Object value) {
return super.addRepeatedField(field, value);
}
@Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof MyMessage) {
return mergeFrom((MyMessage) other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(MyMessage other) {
if (other == MyMessage.getDefaultInstance()) return this;
if (other.dataType_ != 0) {
setDataTypeValue(other.getDataTypeValue());
}
switch (other.getDataBodyCase()) {
case STUDENT: {
mergeStudent(other.getStudent());
break;
}
case WORKER: {
mergeWorker(other.getWorker());
break;
}
case DATABODY_NOT_SET: {
break;
}
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
@Override
public final boolean isInitialized() {
return true;
}
@Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
MyMessage parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (MyMessage) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
public DataBodyCase
getDataBodyCase() {
return DataBodyCase.forNumber(
dataBodyCase_);
}
public Builder clearDataBody() {
dataBodyCase_ = 0;
dataBody_ = null;
onChanged();
return this;
}
/**
* <pre>
* 用data_type 来标识传的是哪一个枚举类型
* </pre>
*
* <code>.MyMessage.DataType data_type = 1;</code>
*/
public int getDataTypeValue() {
return dataType_;
}
/**
* <pre>
* 用data_type 来标识传的是哪一个枚举类型
* </pre>
*
* <code>.MyMessage.DataType data_type = 1;</code>
*/
public Builder setDataTypeValue(int value) {
dataType_ = value;
onChanged();
return this;
}
/**
* <pre>
* 用data_type 来标识传的是哪一个枚举类型
* </pre>
*
* <code>.MyMessage.DataType data_type = 1;</code>
*/
public DataType getDataType() {
DataType result = DataType.valueOf(dataType_);
return result == null ? DataType.UNRECOGNIZED : result;
}
/**
* <pre>
* 用data_type 来标识传的是哪一个枚举类型
* </pre>
*
* <code>.MyMessage.DataType data_type = 1;</code>
*/
public Builder setDataType(DataType value) {
if (value == null) {
throw new NullPointerException();
}
dataType_ = value.getNumber();
onChanged();
return this;
}
/**
* <pre>
* 用data_type 来标识传的是哪一个枚举类型
* </pre>
*
* <code>.MyMessage.DataType data_type = 1;</code>
*/
public Builder clearDataType() {
dataType_ = 0;
onChanged();
return this;
}
/**
* <code>.Student student = 2;</code>
*/
public boolean hasStudent() {
return dataBodyCase_ == 2;
}
/**
* <code>.Student student = 2;</code>
*/
public Student getStudent() {
if (studentBuilder_ == null) {
if (dataBodyCase_ == 2) {
return (Student) dataBody_;
}
return Student.getDefaultInstance();
} else {
if (dataBodyCase_ == 2) {
return studentBuilder_.getMessage();
}
return Student.getDefaultInstance();
}
}
/**
* <code>.Student student = 2;</code>
*/
public Builder setStudent(Student value) {
if (studentBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
dataBody_ = value;
onChanged();
} else {
studentBuilder_.setMessage(value);
}
dataBodyCase_ = 2;
return this;
}
/**
* <code>.Student student = 2;</code>
*/
public Builder setStudent(
Student.Builder builderForValue) {
if (studentBuilder_ == null) {
dataBody_ = builderForValue.build();
onChanged();
} else {
studentBuilder_.setMessage(builderForValue.build());
}
dataBodyCase_ = 2;
return this;
}
/**
* <code>.Student student = 2;</code>
*/
public Builder mergeStudent(Student value) {
if (studentBuilder_ == null) {
if (dataBodyCase_ == 2 &&
dataBody_ != Student.getDefaultInstance()) {
dataBody_ = Student.newBuilder((Student) dataBody_)
.mergeFrom(value).buildPartial();
} else {
dataBody_ = value;
}
onChanged();
} else {
if (dataBodyCase_ == 2) {
studentBuilder_.mergeFrom(value);
}
studentBuilder_.setMessage(value);
}
dataBodyCase_ = 2;
return this;
}
/**
* <code>.Student student = 2;</code>
*/
public Builder clearStudent() {
if (studentBuilder_ == null) {
if (dataBodyCase_ == 2) {
dataBodyCase_ = 0;
dataBody_ = null;
onChanged();
}
} else {
if (dataBodyCase_ == 2) {
dataBodyCase_ = 0;
dataBody_ = null;
}
studentBuilder_.clear();
}
return this;
}
/**
* <code>.Student student = 2;</code>
*/
public Student.Builder getStudentBuilder() {
return getStudentFieldBuilder().getBuilder();
}
/**
* <code>.Student student = 2;</code>
*/
public StudentOrBuilder getStudentOrBuilder() {
if ((dataBodyCase_ == 2) && (studentBuilder_ != null)) {
return studentBuilder_.getMessageOrBuilder();
} else {
if (dataBodyCase_ == 2) {
return (Student) dataBody_;
}
return Student.getDefaultInstance();
}
}
/**
* <code>.Student student = 2;</code>
*/
private com.google.protobuf.SingleFieldBuilderV3<
Student, Student.Builder, StudentOrBuilder>
getStudentFieldBuilder() {
if (studentBuilder_ == null) {
if (!(dataBodyCase_ == 2)) {
dataBody_ = Student.getDefaultInstance();
}
studentBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
Student, Student.Builder, StudentOrBuilder>(
(Student) dataBody_,
getParentForChildren(),
isClean());
dataBody_ = null;
}
dataBodyCase_ = 2;
onChanged();
return studentBuilder_;
}
/**
* <code>.Worker worker = 3;</code>
*/
public boolean hasWorker() {
return dataBodyCase_ == 3;
}
/**
* <code>.Worker worker = 3;</code>
*/
public Worker getWorker() {
if (workerBuilder_ == null) {
if (dataBodyCase_ == 3) {
return (Worker) dataBody_;
}
return Worker.getDefaultInstance();
} else {
if (dataBodyCase_ == 3) {
return workerBuilder_.getMessage();
}
return Worker.getDefaultInstance();
}
}
/**
* <code>.Worker worker = 3;</code>
*/
public Builder setWorker(Worker value) {
if (workerBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
dataBody_ = value;
onChanged();
} else {
workerBuilder_.setMessage(value);
}
dataBodyCase_ = 3;
return this;
}
/**
* <code>.Worker worker = 3;</code>
*/
public Builder setWorker(
Worker.Builder builderForValue) {
if (workerBuilder_ == null) {
dataBody_ = builderForValue.build();
onChanged();
} else {
workerBuilder_.setMessage(builderForValue.build());
}
dataBodyCase_ = 3;
return this;
}
/**
* <code>.Worker worker = 3;</code>
*/
public Builder mergeWorker(Worker value) {
if (workerBuilder_ == null) {
if (dataBodyCase_ == 3 &&
dataBody_ != Worker.getDefaultInstance()) {
dataBody_ = Worker.newBuilder((Worker) dataBody_)
.mergeFrom(value).buildPartial();
} else {
dataBody_ = value;
}
onChanged();
} else {
if (dataBodyCase_ == 3) {
workerBuilder_.mergeFrom(value);
}
workerBuilder_.setMessage(value);
}
dataBodyCase_ = 3;
return this;
}
/**
* <code>.Worker worker = 3;</code>
*/
public Builder clearWorker() {
if (workerBuilder_ == null) {
if (dataBodyCase_ == 3) {
dataBodyCase_ = 0;
dataBody_ = null;
onChanged();
}
} else {
if (dataBodyCase_ == 3) {
dataBodyCase_ = 0;
dataBody_ = null;
}
workerBuilder_.clear();
}
return this;
}
/**
* <code>.Worker worker = 3;</code>
*/
public Worker.Builder getWorkerBuilder() {
return getWorkerFieldBuilder().getBuilder();
}
/**
* <code>.Worker worker = 3;</code>
*/
public WorkerOrBuilder getWorkerOrBuilder() {
if ((dataBodyCase_ == 3) && (workerBuilder_ != null)) {
return workerBuilder_.getMessageOrBuilder();
} else {
if (dataBodyCase_ == 3) {
return (Worker) dataBody_;
}
return Worker.getDefaultInstance();
}
}
/**
* <code>.Worker worker = 3;</code>
*/
private com.google.protobuf.SingleFieldBuilderV3<
Worker, Worker.Builder, WorkerOrBuilder>
getWorkerFieldBuilder() {
if (workerBuilder_ == null) {
if (!(dataBodyCase_ == 3)) {
dataBody_ = Worker.getDefaultInstance();
}
workerBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
Worker, Worker.Builder, WorkerOrBuilder>(
(Worker) dataBody_,
getParentForChildren(),
isClean());
dataBody_ = null;
}
dataBodyCase_ = 3;
onChanged();
return workerBuilder_;
}
@Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFieldsProto3(unknownFields);
}
@Override
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:MyMessage)
}
}
/**
* Protobuf type {@code Student}
*/
public static final class Student extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:Student)
StudentOrBuilder {
public static final int ID_FIELD_NUMBER = 1;
public static final int NAME_FIELD_NUMBER = 2;
private static final long serialVersionUID = 0L;
// @@protoc_insertion_point(class_scope:Student)
private static final Student DEFAULT_INSTANCE;
private static final com.google.protobuf.Parser<Student>
PARSER = new com.google.protobuf.AbstractParser<Student>() {
@Override
public Student parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new Student(input, extensionRegistry);
}
};
static {
DEFAULT_INSTANCE = new Student();
}
private int id_;
private volatile Object name_;
private byte memoizedIsInitialized = -1;
// Use Student.newBuilder() to construct.
private Student(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private Student() {
id_ = 0;
name_ = "";
}
private Student(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
if (extensionRegistry == null) {
throw new NullPointerException();
}
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 8: {
id_ = input.readInt32();
break;
}
case 18: {
String s = input.readStringRequireUtf8();
name_ = s;
break;
}
default: {
if (!parseUnknownFieldProto3(
input, unknownFields, extensionRegistry, tag)) {
done = true;
}
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return MyDataInfo.internal_static_Student_descriptor;
}
public static Student parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static Student parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static Student parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static Student parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static Student parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static Student parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static Student parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static Student parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static Student parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static Student parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static Student parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static Student parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(Student prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
public static Student getDefaultInstance() {
return DEFAULT_INSTANCE;
}
public static com.google.protobuf.Parser<Student> parser() {
return PARSER;
}
@Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
@Override
protected FieldAccessorTable
internalGetFieldAccessorTable() {
return MyDataInfo.internal_static_Student_fieldAccessorTable
.ensureFieldAccessorsInitialized(
Student.class, Builder.class);
}
/**
* <pre>
* Student类的属性
* </pre>
*
* <code>int32 id = 1;</code>
*/
public int getId() {
return id_;
}
/**
* <pre>
* </pre>
*
* <code>string name = 2;</code>
*/
public String getName() {
Object ref = name_;
if (ref instanceof String) {
return (String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
String s = bs.toStringUtf8();
name_ = s;
return s;
}
}
/**
* <pre>
* </pre>
*
* <code>string name = 2;</code>
*/
public com.google.protobuf.ByteString
getNameBytes() {
Object ref = name_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(String) ref);
name_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
@Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
@Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
if (id_ != 0) {
output.writeInt32(1, id_);
}
if (!getNameBytes().isEmpty()) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 2, name_);
}
unknownFields.writeTo(output);
}
@Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (id_ != 0) {
size += com.google.protobuf.CodedOutputStream
.computeInt32Size(1, id_);
}
if (!getNameBytes().isEmpty()) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, name_);
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
}
@Override
public boolean equals(final Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof Student)) {
return super.equals(obj);
}
Student other = (Student) obj;
boolean result = true;
result = result && (getId()
== other.getId());
result = result && getName()
.equals(other.getName());
result = result && unknownFields.equals(other.unknownFields);
return result;
}
@Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + ID_FIELD_NUMBER;
hash = (53 * hash) + getId();
hash = (37 * hash) + NAME_FIELD_NUMBER;
hash = (53 * hash) + getName().hashCode();
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
@Override
public Builder newBuilderForType() {
return newBuilder();
}
@Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@Override
protected Builder newBuilderForType(
BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
@Override
public com.google.protobuf.Parser<Student> getParserForType() {
return PARSER;
}
@Override
public Student getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
/**
* Protobuf type {@code Student}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:Student)
StudentOrBuilder {
private int id_;
private Object name_ = "";
// Construct using org.anonymous.netty.codec2.MyDataInfo.Student.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return MyDataInfo.internal_static_Student_descriptor;
}
@Override
protected FieldAccessorTable
internalGetFieldAccessorTable() {
return MyDataInfo.internal_static_Student_fieldAccessorTable
.ensureFieldAccessorsInitialized(
Student.class, Builder.class);
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
}
}
@Override
public Builder clear() {
super.clear();
id_ = 0;
name_ = "";
return this;
}
@Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return MyDataInfo.internal_static_Student_descriptor;
}
@Override
public Student getDefaultInstanceForType() {
return Student.getDefaultInstance();
}
@Override
public Student build() {
Student result = buildPartial();
if (!result.isInitialized()) {
throw Builder.newUninitializedMessageException(result);
}
return result;
}
@Override
public Student buildPartial() {
Student result = new Student(this);
result.id_ = id_;
result.name_ = name_;
onBuilt();
return result;
}
@Override
public Builder clone() {
return super.clone();
}
@Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
Object value) {
return super.setField(field, value);
}
@Override
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return super.clearField(field);
}
@Override
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return super.clearOneof(oneof);
}
@Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, Object value) {
return super.setRepeatedField(field, index, value);
}
@Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
Object value) {
return super.addRepeatedField(field, value);
}
@Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof Student) {
return mergeFrom((Student) other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(Student other) {
if (other == Student.getDefaultInstance()) return this;
if (other.getId() != 0) {
setId(other.getId());
}
if (!other.getName().isEmpty()) {
name_ = other.name_;
onChanged();
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
@Override
public final boolean isInitialized() {
return true;
}
@Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
Student parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (Student) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
/**
* <pre>
* Student类的属性
* </pre>
*
* <code>int32 id = 1;</code>
*/
public int getId() {
return id_;
}
/**
* <pre>
* Student类的属性
* </pre>
*
* <code>int32 id = 1;</code>
*/
public Builder setId(int value) {
id_ = value;
onChanged();
return this;
}
/**
* <pre>
* Student类的属性
* </pre>
*
* <code>int32 id = 1;</code>
*/
public Builder clearId() {
id_ = 0;
onChanged();
return this;
}
/**
* <pre>
* </pre>
*
* <code>string name = 2;</code>
*/
public String getName() {
Object ref = name_;
if (!(ref instanceof String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
String s = bs.toStringUtf8();
name_ = s;
return s;
} else {
return (String) ref;
}
}
/**
* <pre>
* </pre>
*
* <code>string name = 2;</code>
*/
public Builder setName(
String value) {
if (value == null) {
throw new NullPointerException();
}
name_ = value;
onChanged();
return this;
}
/**
* <pre>
* </pre>
*
* <code>string name = 2;</code>
*/
public com.google.protobuf.ByteString
getNameBytes() {
Object ref = name_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(String) ref);
name_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <pre>
* </pre>
*
* <code>string name = 2;</code>
*/
public Builder setNameBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
AbstractMessageLite.checkByteStringIsUtf8(value);
name_ = value;
onChanged();
return this;
}
/**
* <pre>
* </pre>
*
* <code>string name = 2;</code>
*/
public Builder clearName() {
name_ = getDefaultInstance().getName();
onChanged();
return this;
}
@Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFieldsProto3(unknownFields);
}
@Override
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:Student)
}
}
/**
* Protobuf type {@code Worker}
*/
public static final class Worker extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:Worker)
WorkerOrBuilder {
public static final int NAME_FIELD_NUMBER = 1;
public static final int AGE_FIELD_NUMBER = 2;
private static final long serialVersionUID = 0L;
// @@protoc_insertion_point(class_scope:Worker)
private static final Worker DEFAULT_INSTANCE;
private static final com.google.protobuf.Parser<Worker>
PARSER = new com.google.protobuf.AbstractParser<Worker>() {
@Override
public Worker parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new Worker(input, extensionRegistry);
}
};
static {
DEFAULT_INSTANCE = new Worker();
}
private volatile Object name_;
private int age_;
private byte memoizedIsInitialized = -1;
// Use Worker.newBuilder() to construct.
private Worker(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private Worker() {
name_ = "";
age_ = 0;
}
private Worker(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
if (extensionRegistry == null) {
throw new NullPointerException();
}
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 10: {
String s = input.readStringRequireUtf8();
name_ = s;
break;
}
case 16: {
age_ = input.readInt32();
break;
}
default: {
if (!parseUnknownFieldProto3(
input, unknownFields, extensionRegistry, tag)) {
done = true;
}
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return MyDataInfo.internal_static_Worker_descriptor;
}
public static Worker parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static Worker parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static Worker parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static Worker parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static Worker parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static Worker parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static Worker parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static Worker parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static Worker parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static Worker parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static Worker parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static Worker parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(Worker prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
public static Worker getDefaultInstance() {
return DEFAULT_INSTANCE;
}
public static com.google.protobuf.Parser<Worker> parser() {
return PARSER;
}
@Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
@Override
protected FieldAccessorTable
internalGetFieldAccessorTable() {
return MyDataInfo.internal_static_Worker_fieldAccessorTable
.ensureFieldAccessorsInitialized(
Worker.class, Builder.class);
}
/**
* <code>string name = 1;</code>
*/
public String getName() {
Object ref = name_;
if (ref instanceof String) {
return (String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
String s = bs.toStringUtf8();
name_ = s;
return s;
}
}
/**
* <code>string name = 1;</code>
*/
public com.google.protobuf.ByteString
getNameBytes() {
Object ref = name_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(String) ref);
name_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>int32 age = 2;</code>
*/
public int getAge() {
return age_;
}
@Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
@Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
if (!getNameBytes().isEmpty()) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_);
}
if (age_ != 0) {
output.writeInt32(2, age_);
}
unknownFields.writeTo(output);
}
@Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (!getNameBytes().isEmpty()) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_);
}
if (age_ != 0) {
size += com.google.protobuf.CodedOutputStream
.computeInt32Size(2, age_);
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
}
@Override
public boolean equals(final Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof Worker)) {
return super.equals(obj);
}
Worker other = (Worker) obj;
boolean result = true;
result = result && getName()
.equals(other.getName());
result = result && (getAge()
== other.getAge());
result = result && unknownFields.equals(other.unknownFields);
return result;
}
@Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + NAME_FIELD_NUMBER;
hash = (53 * hash) + getName().hashCode();
hash = (37 * hash) + AGE_FIELD_NUMBER;
hash = (53 * hash) + getAge();
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
@Override
public Builder newBuilderForType() {
return newBuilder();
}
@Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@Override
protected Builder newBuilderForType(
BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
@Override
public com.google.protobuf.Parser<Worker> getParserForType() {
return PARSER;
}
@Override
public Worker getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
/**
* Protobuf type {@code Worker}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:Worker)
WorkerOrBuilder {
private Object name_ = "";
private int age_;
// Construct using org.anonymous.netty.codec2.MyDataInfo.Worker.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return MyDataInfo.internal_static_Worker_descriptor;
}
@Override
protected FieldAccessorTable
internalGetFieldAccessorTable() {
return MyDataInfo.internal_static_Worker_fieldAccessorTable
.ensureFieldAccessorsInitialized(
Worker.class, Builder.class);
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
}
}
@Override
public Builder clear() {
super.clear();
name_ = "";
age_ = 0;
return this;
}
@Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return MyDataInfo.internal_static_Worker_descriptor;
}
@Override
public Worker getDefaultInstanceForType() {
return Worker.getDefaultInstance();
}
@Override
public Worker build() {
Worker result = buildPartial();
if (!result.isInitialized()) {
throw Builder.newUninitializedMessageException(result);
}
return result;
}
@Override
public Worker buildPartial() {
Worker result = new Worker(this);
result.name_ = name_;
result.age_ = age_;
onBuilt();
return result;
}
@Override
public Builder clone() {
return super.clone();
}
@Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
Object value) {
return super.setField(field, value);
}
@Override
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return super.clearField(field);
}
@Override
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return super.clearOneof(oneof);
}
@Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, Object value) {
return super.setRepeatedField(field, index, value);
}
@Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
Object value) {
return super.addRepeatedField(field, value);
}
@Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof Worker) {
return mergeFrom((Worker) other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(Worker other) {
if (other == Worker.getDefaultInstance()) return this;
if (!other.getName().isEmpty()) {
name_ = other.name_;
onChanged();
}
if (other.getAge() != 0) {
setAge(other.getAge());
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
@Override
public final boolean isInitialized() {
return true;
}
@Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
Worker parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (Worker) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
/**
* <code>string name = 1;</code>
*/
public String getName() {
Object ref = name_;
if (!(ref instanceof String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
String s = bs.toStringUtf8();
name_ = s;
return s;
} else {
return (String) ref;
}
}
/**
* <code>string name = 1;</code>
*/
public Builder setName(
String value) {
if (value == null) {
throw new NullPointerException();
}
name_ = value;
onChanged();
return this;
}
/**
* <code>string name = 1;</code>
*/
public com.google.protobuf.ByteString
getNameBytes() {
Object ref = name_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(String) ref);
name_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>string name = 1;</code>
*/
public Builder setNameBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
AbstractMessageLite.checkByteStringIsUtf8(value);
name_ = value;
onChanged();
return this;
}
/**
* <code>string name = 1;</code>
*/
public Builder clearName() {
name_ = getDefaultInstance().getName();
onChanged();
return this;
}
/**
* <code>int32 age = 2;</code>
*/
public int getAge() {
return age_;
}
/**
* <code>int32 age = 2;</code>
*/
public Builder setAge(int value) {
age_ = value;
onChanged();
return this;
}
/**
* <code>int32 age = 2;</code>
*/
public Builder clearAge() {
age_ = 0;
onChanged();
return this;
}
@Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFieldsProto3(unknownFields);
}
@Override
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:Worker)
}
}
// @@protoc_insertion_point(outer_class_scope)
}
| [
"13163249276@163.com"
] | 13163249276@163.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.