blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f39970c8051843fb7debc4982ffa2a989ca2a3c3 | 65c37921c5000bc01a428d36f059578ce02ebaab | /jooq/src/main/test/test/generated/pg_catalog/routines/DateGt.java | 6dbc51c405e00f3533c66bda60a54bb3492a8f2a | [] | no_license | azeredoA/projetos | 05dde053aaba32f825f17f3e951d2fcb2d3034fc | 7be5995edfaad4449ec3c68d422247fc113281d0 | refs/heads/master | 2021-01-11T05:43:21.466522 | 2013-06-10T15:39:42 | 2013-06-10T15:40:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,239 | java | /**
* This class is generated by jOOQ
*/
package test.generated.pg_catalog.routines;
/**
* This class is generated by jOOQ.
*/
@javax.annotation.Generated(value = {"http://www.jooq.org", "2.6.0"},
comments = "This class is generated by jOOQ")
@java.lang.SuppressWarnings("all")
public class DateGt extends org.jooq.impl.AbstractRoutine<java.lang.Boolean> {
private static final long serialVersionUID = -900370036;
/**
* The procedure parameter <code>pg_catalog.date_gt.RETURN_VALUE</code>
*/
public static final org.jooq.Parameter<java.lang.Boolean> RETURN_VALUE = createParameter("RETURN_VALUE", org.jooq.impl.SQLDataType.BOOLEAN);
/**
* The procedure parameter <code>pg_catalog.date_gt._1</code>
*/
public static final org.jooq.Parameter<java.sql.Date> _1 = createParameter("_1", org.jooq.impl.SQLDataType.DATE);
/**
* The procedure parameter <code>pg_catalog.date_gt._2</code>
*/
public static final org.jooq.Parameter<java.sql.Date> _2 = createParameter("_2", org.jooq.impl.SQLDataType.DATE);
/**
* Create a new routine call instance
*/
public DateGt() {
super("date_gt", test.generated.pg_catalog.PgCatalog.PG_CATALOG, org.jooq.impl.SQLDataType.BOOLEAN);
setReturnParameter(RETURN_VALUE);
addInParameter(_1);
addInParameter(_2);
}
/**
* Set the <code>_1</code> parameter IN value to the routine
*/
public void set__1(java.sql.Date value) {
setValue(test.generated.pg_catalog.routines.DateGt._1, value);
}
/**
* Set the <code>_1</code> parameter to the function
* <p>
* Use this method only, if the function is called as a {@link org.jooq.Field} in a {@link org.jooq.Select} statement!
*/
public void set__1(org.jooq.Field<java.sql.Date> field) {
setField(_1, field);
}
/**
* Set the <code>_2</code> parameter IN value to the routine
*/
public void set__2(java.sql.Date value) {
setValue(test.generated.pg_catalog.routines.DateGt._2, value);
}
/**
* Set the <code>_2</code> parameter to the function
* <p>
* Use this method only, if the function is called as a {@link org.jooq.Field} in a {@link org.jooq.Select} statement!
*/
public void set__2(org.jooq.Field<java.sql.Date> field) {
setField(_2, field);
}
}
| [
"[email protected]"
] | |
8df1cab8bb119d0a4a42437e65fca64dbe945697 | e3e95f186251066a91faa96696e624ca9c05d71b | /src/main/java/org/zviaghintseva/intro2/interfaces/Receiver.java | fb16bbbd46a697388c917c27a5412d16f2fbb215 | [] | no_license | Anna27032000/intro2 | 2bf639722145327fc442565339c7f3632d17bf64 | 91666c7bc8022bc56a5730be9f29077c9cd6e401 | refs/heads/master | 2023-01-04T16:23:42.481957 | 2020-11-01T19:56:31 | 2020-11-01T19:56:31 | 299,296,849 | 0 | 0 | null | 2020-09-28T12:22:50 | 2020-09-28T12:09:51 | null | UTF-8 | Java | false | false | 123 | java | package org.zviaghintseva.intro2.interfaces;
public interface Receiver {
public String getMessage(String message);
}
| [
"[email protected]"
] | |
84d7c63e26920980f10bd8225198532732dc4f9b | 6100bb97604bd6ddc1174167b12cdfbe32703be7 | /tass/src/com/sun/billf/tass/Visitee.java | 6d79d5265ff74e31779d17250e4ca0885acbd371 | [] | no_license | zathras/java.net | 1c06bce2f8218f63b0a3174c774872d5bb43882c | cc10f2dbe6879dd2f387631510e2fb247b43aa62 | refs/heads/master | 2023-02-02T12:34:11.749192 | 2022-01-27T04:50:00 | 2022-01-27T04:50:00 | 176,968,689 | 13 | 3 | null | null | null | null | UTF-8 | Java | false | false | 1,053 | java |
package com.sun.billf.tass;
import org.apache.bcel.generic.Type;
interface Visitee {
/**
* Check a named class. This is called when a reference to a
* named class is encountered.
**/
void checkForClass(String name);
/**
* Check a type. This is called when a reference to a type
* is encountered. The type might be UninitializedObjectType,
* and array type, or an object type (a class).
*
* @see #checkForClass(String)
**/
void checkType(Type t);
/**
* Called when some kind of error is encountered.
**/
void reportError(String description);
/**
* Check a reference to a field. Called when a field reference
* is encountered in the application being checked.
**/
void checkFieldRef(String className, String fieldName);
/**
* Check a reference to a method. Called when a method reference
* is encountered in the application being checked.
**/
void checkMethodRef(String className, String methodName, Type[] args);
}
| [
"[email protected]"
] | |
594777aa9e12f4b4f6ea19a277876da275aa5a87 | 0e3247fc9e61bb5e919e1493e8bd03606f64d719 | /src/main/java/controller/BaseController.java | 564d287ea87aec544ed78ed9eae3dfbda7fdbd8c | [] | no_license | wangchenghb/ht_sec | e42748c11d6b229a0aa55a042ab1c77884c04773 | deedb71e6842cf114531989ad0d609ef51c02145 | refs/heads/master | 2020-09-22T20:56:48.906591 | 2016-08-24T13:40:20 | 2016-08-24T13:40:20 | 66,426,212 | 0 | 0 | null | 2016-08-24T13:40:20 | 2016-08-24T03:32:28 | Java | UTF-8 | Java | false | false | 750 | java | package controller;
import java.text.SimpleDateFormat;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.web.bind.ServletRequestDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
/**
* 公有的controller解决日期格式问题
* @author tarena
*
*/
public class BaseController {
//为了让日期格式生效变得更通用,可以建一个BaseController,然后把这个方法写在BaseController里
//然后,让其他Controller继承BaseController
@InitBinder
public void InitBinder(ServletRequestDataBinder binder){
binder.registerCustomEditor(java.util.Date.class, new CustomDateEditor(new SimpleDateFormat("yyyy-MM-dd"), true));
}
}
| [
"[email protected]"
] | |
d0b3e2d29f767a63c4b42ef10c395a85db1ca81b | 032ad85c8479e4d847d7748746fe4c4899163510 | /src/main/java/by/bntu/fitr/povt/vasilkou/bntu_shop/mappers/impl/UserMapperImpl.java | 0717da7d2ccb88b5ed0d705e50cc2fd715d30002 | [] | no_license | Viktar-Vasilkou/bntu-shop | 4d45c01a3104c56d05dda5907702f5c292cb9de2 | 5f3183021ede26233296f831e472fedf88ad890e | refs/heads/master | 2023-03-17T10:52:11.120596 | 2021-03-10T18:57:26 | 2021-03-10T18:57:26 | 320,610,825 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,562 | java | package by.bntu.fitr.povt.vasilkou.bntu_shop.mappers.impl;
import by.bntu.fitr.povt.vasilkou.bntu_shop.dto.UserDto;
import by.bntu.fitr.povt.vasilkou.bntu_shop.mappers.api.UserMapper;
import by.bntu.fitr.povt.vasilkou.bntu_shop.model.User;
import by.bntu.fitr.povt.vasilkou.bntu_shop.repositories.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class UserMapperImpl implements UserMapper {
private UserRepository userRepository;
@Autowired
public void setUserRepository(UserRepository userRepository) {
this.userRepository = userRepository;
}
@Override
public UserDto toDto(User user) {
if (user == null) {
return null;
}
return UserDto.builder()
.id(user.getId())
.login(user.getLogin())
.name(user.getName())
.phoneNumber(user.getPhoneNumber())
.surname(user.getSurname())
.build();
}
@Override
public User toEntity(UserDto userDto) {
if (userDto == null) {
return null;
}
User user = new User();
if (userRepository.existsById(userDto.getId())) {
user = userRepository.getOne(userDto.getId());
}
user.setName(userDto.getName());
user.setSurname(userDto.getSurname());
user.setLogin(userDto.getLogin());
user.setPhoneNumber(userDto.getPhoneNumber());
return user;
}
}
| [
"[email protected]"
] | |
9d9fd45e572ef87ed44d33750dbb0e3664ff6cbd | 57b7e7a4a424eb4aff81534cab978d6aa7de8ec1 | /Capitulo02_Variaveis/src/VariaveisInteiras01.java | f1ffd4581b2f05941f75a6ce5a5f3d91f899568d | [] | no_license | matheusmagenta/CursoJava | 4d207fb0ba7c95b279f96c0bdb96a9dfb2beb275 | d20c044916c064690d63d1d1012069d951ef6438 | refs/heads/master | 2021-01-15T10:30:10.487294 | 2017-08-16T12:47:06 | 2017-08-16T12:47:06 | 99,583,236 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 756 | java |
public class VariaveisInteiras01 {
public static void main(String[] args) {
byte b1 = 120; // -128 a 127
short s1 = 32000; //-32768 a 32767
int i1= 150000; //-2147483648 a 2147483647
//e o tipo long? veremos em instantes...
//operações com tipos inteiros
byte soma1 = 10 + 10;
byte op1 = 10;
byte op2 = 120;
byte soma2 = (byte)(op1 + op2);
System.out.println("soma2 = " + soma2);
long numerogrande = 3000000000L;
/*
* o valor é 3000000000, apesar de ser compativel
* com o tipo long, é tratado pelo compilador como int;
* nesse caso, é necessário incluir a letra "L" no final do
* número, de forma a forçá-lo a ser armazenado como long
*/
}
} | [
"[email protected]"
] | |
dc69d78546738c67f4fad727bff4df4e1fe9bc87 | fef2a9962ef5b2eafe9ce4b43756c45f8e17806b | /src/main/java/PrimeNumbers.java | 29ff715dff1969dd88359fb801687707e84cb789 | [] | no_license | chirayush/PrimeNumbers | 76f01f8b940575a7979d20093d618dea9a4999fa | a533ee363687f694dbd25ffcbdbb6161651fcf59 | refs/heads/master | 2020-03-22T02:05:45.608639 | 2018-07-01T17:47:14 | 2018-07-01T17:47:14 | 139,348,708 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 30 | java | final class PrimeNumbers {
}
| [
"[email protected]"
] | |
666a8eafb21f63c19e558b1218eb7a14b970485f | bb8bdca167cb3a7422e06e6b523f3f3e3a8e23ac | /app/src/main/java/com/example/mydiet/ui/slideshow/SlideshowFragment.java | 7321a86f196c34e9bc30611cc2a176e87a34426d | [] | no_license | Simphiwe-Jiyane/MyDiet | 34d0483940d5c7c11ce94095d376d8e7d345a299 | 6d8ef39b6fa5148caf64c071d456d002ba23ecc8 | refs/heads/master | 2022-12-22T19:31:02.405697 | 2020-09-28T21:17:55 | 2020-09-28T21:17:55 | 299,312,033 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,172 | java | package com.example.mydiet.ui.slideshow;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProviders;
import com.example.mydiet.R;
public class SlideshowFragment extends Fragment {
private SlideshowViewModel slideshowViewModel;
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
slideshowViewModel =
ViewModelProviders.of(this).get(SlideshowViewModel.class);
View root = inflater.inflate(R.layout.fragment_slideshow, container, false);
final TextView textView = root.findViewById(R.id.text_slideshow);
slideshowViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() {
@Override
public void onChanged(@Nullable String s) {
textView.setText(s);
}
});
return root;
}
} | [
"[email protected]"
] | |
55f0d2621f670f730280db4eac094c57fe2c9390 | b757a03eeaa2dfc17d51b1f163665c38452ea28a | /src/main/java/br/com/william/spring_essentials/model/Student.java | fc734b7a844fa3de457a57c6f8ac481c48d00972 | [] | no_license | JohnWill14/springboot-essentials | 94b6e28522fe1ce30e3e4c46bc38c8df156f6fd3 | 543ea4fa1b726e32b012d22efad07a3ea8943e8b | refs/heads/master | 2023-02-21T05:22:11.341298 | 2021-01-08T20:44:51 | 2021-01-08T20:44:51 | 324,698,973 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,321 | java | package br.com.william.spring_essentials.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.NotEmpty;
@Entity
public class Student extends AbstractEntity {
@Column(length = 100)
@NotBlank(message = "Campo nome não pode ser vazio ou nulo")
private String name;
@NotEmpty(message = "Campo email não pode ser vazio")
@Email
private String email;
public Student(String name, String email) {
super();
this.name = name;
this.email = email;
}
public Student() {
super();
// TODO Auto-generated constructor stub
}
private Student(String name) {
super();
this.name = name;
}
public Student(Long id, String name) {
this(name);
this.id = id;
}
public Student(Long id, String name, String email) {
super();
this.id = id;
this.name = name;
this.email = email;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
return "Student [name=" + name + ", email=" + email + ", id=" + id + "]";
}
}
| [
"[email protected]"
] | |
da815ad858e038eb49fc5788f98b47571df7a516 | c04608e4e89577008b80c8bfc88668c1bae9d11d | /src/main/java/cn/kyne/bnr/client/util/NullOutputStream.java | a865fec10c80f1f4dd14882cda1bc425ebe9e5f9 | [] | no_license | huang-kai/BnrClient | 7833c9c588311d07e1783c2f7dd0cae5d7c120e2 | 1636eebcd828d53a4f16f015292dfb56fc43ae64 | refs/heads/master | 2020-04-14T09:48:27.509901 | 2015-04-29T09:23:51 | 2015-04-29T09:23:51 | 34,782,392 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 731 | java | package cn.kyne.bnr.client.util;
import java.io.IOException;
import java.io.OutputStream;
/**
* Singleton OutputStream that discards everything written to it.
*/
public class NullOutputStream extends OutputStream {
private static NullOutputStream INSTANCE = new NullOutputStream();
/**
* Private constructor to prevent instantiation.
*/
private NullOutputStream() {
}
public static NullOutputStream getInstance() {
return INSTANCE;
}
@Override
public void write(int b) throws IOException {
}
@Override
public void write(byte[] b, int off, int len) throws IOException {
}
@Override
public void write(byte[] b) throws IOException {
}
}
| [
"[email protected]"
] | |
3e3cf01cfd80525879359b2c8e60396f38df71fa | 5833965b5d3995524a61b51d93b64ac6e5bc9045 | /src/com/javarush/test/level07/lesson12/home04/Solution.java | 2e6d18b604789187befd1f7e21ea480806117d32 | [] | no_license | skkif1/JavaCore-step-by-step | 3e8abceae18ccfa9e2e0c7964cba73893a33ed7b | 37af172b98db461c2dc17ffa8892f1ddff8baf58 | refs/heads/master | 2020-04-14T14:07:30.578896 | 2016-02-02T20:20:22 | 2016-02-02T20:20:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,154 | java | package com.javarush.test.level07.lesson12.home04;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
/* Вводить с клавиатуры строки, пока пользователь не введёт строку 'end'
Создать список строк.
Ввести строки с клавиатуры и добавить их в список.
Вводить с клавиатуры строки, пока пользователь не введёт строку "end". "end" не учитывать.
Вывести строки на экран, каждую с новой строки.
*/
public class Solution
{
public static void main(String[] args) throws IOException
{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
ArrayList<String> mass1 = new ArrayList<>();
for (String s = reader.readLine(); !s.equals("end"); s = reader.readLine())
{
mass1.add(s);
}
for (int i = 0; i < mass1.size(); i++)
System.out.println(mass1.get(i));
}
}
| [
"[email protected]"
] | |
7f89088b3919db431cf5eb282c39c5a9b41022ba | 1a3fd16bfb0087761095961478297c26a9dd467e | /http-client/src/test/java/com/proofpoint/http/client/balancing/TestBalancingHttpClient.java | 577f0026eeb39004434d8b76a34a90975eee5d94 | [
"Apache-2.0"
] | permissive | parags/platform | 6d8b47d25715ea465ac106b089e7aff548f8f656 | 78cb72bd8745016adc28a00b46b1a7587275525b | refs/heads/master | 2021-01-16T18:07:45.550834 | 2015-01-21T20:08:10 | 2015-01-21T20:08:10 | 12,907,150 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,003 | java | package com.proofpoint.http.client.balancing;
import com.proofpoint.http.client.HttpClient;
import com.proofpoint.http.client.Request;
import com.proofpoint.http.client.RequestStats;
import com.proofpoint.http.client.Response;
import com.proofpoint.http.client.ResponseHandler;
import org.testng.annotations.Test;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import static com.google.common.base.Preconditions.checkArgument;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertSame;
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;
public class TestBalancingHttpClient
extends AbstractTestBalancingHttpClient<HttpClient>
{
@Override
protected TestingHttpClient createTestingClient()
{
return new TestingHttpClient("PUT");
}
@Override
protected BalancingHttpClient createBalancingHttpClient()
{
return new BalancingHttpClient(serviceBalancer, httpClient,
new BalancingHttpClientConfig().setMaxAttempts(3));
}
@Override
protected void assertHandlerExceptionThrown(ResponseHandler responseHandler, RuntimeException handlerException)
throws Exception
{
try {
balancingHttpClient.execute(request, responseHandler);
fail("Exception not thrown");
}
catch (Exception e) {
assertSame(e, handlerException, "Exception thrown by BalancingHttpClient");
}
}
@Override
protected void issueRequest()
throws Exception
{
balancingHttpClient.executeAsync(request, mock(ResponseHandler.class));
}
@Test
public void testGetStats()
{
RequestStats requestStats = new RequestStats();
HttpClient mockClient = mock(HttpClient.class);
when(mockClient.getStats()).thenReturn(requestStats);
balancingHttpClient = new BalancingHttpClient(serviceBalancer, mockClient, new BalancingHttpClientConfig());
assertSame(balancingHttpClient.getStats(), requestStats);
verify(mockClient).getStats();
verifyNoMoreInteractions(mockClient, serviceBalancer);
}
@Test
public void testClose()
{
HttpClient mockClient = mock(HttpClient.class);
balancingHttpClient = new BalancingHttpClient(serviceBalancer, mockClient, new BalancingHttpClientConfig());
balancingHttpClient.close();
verify(mockClient).close();
verifyNoMoreInteractions(mockClient, serviceBalancer);
}
class TestingHttpClient
implements HttpClient, TestingClient
{
private String method;
private List<URI> uris = new ArrayList<>();
private List<Object> responses = new ArrayList<>();
TestingHttpClient(String method)
{
this.method = method;
checkArgument(uris.size() == responses.size(), "uris same size as responses");
}
public TestingHttpClient expectCall(String uri, Response response)
{
return expectCall(URI.create(uri), response);
}
public TestingHttpClient expectCall(String uri, Exception exception)
{
return expectCall(URI.create(uri), exception);
}
private TestingHttpClient expectCall(URI uri, Object response)
{
uris.add(uri);
responses.add(response);
return this;
}
public void assertDone()
{
assertEquals(uris.size(), 0, "all expected calls made");
}
@Override
public <T, E extends Exception> HttpResponseFuture<T> executeAsync(Request request, ResponseHandler<T, E> responseHandler)
{
throw new UnsupportedOperationException();
}
@Override
public <T, E extends Exception> T execute(Request request, ResponseHandler<T, E> responseHandler)
throws E
{
assertTrue(uris.size() > 0, "call was expected");
assertEquals(request.getMethod(), method, "request method");
assertEquals(request.getUri(), uris.remove(0), "request uri");
assertEquals(request.getBodyGenerator(), bodyGenerator, "request body generator");
Object response = responses.remove(0);
if (response instanceof Exception) {
return responseHandler.handleException(request, (Exception) response);
}
return responseHandler.handle(request, (Response) response);
}
@Override
public RequestStats getStats()
{
throw new UnsupportedOperationException();
}
@Override
public void close()
{
throw new UnsupportedOperationException();
}
}
}
| [
"[email protected]"
] | |
b5465e109ac4d586d1548a05998e5a59e0cc4e24 | 4f773252d3bd4de4ddcdb74f7f9bf7c1bdd47aa7 | /Forge/Base/src/main/java/br/com/gamemods/minecity/forge/base/accessors/entity/base/PotionApplier.java | 02739ffaa4823cb82c8b18e1328a0c70a3f55cb0 | [] | no_license | Plugner/MineCity | c02c19ef8cd033aa25e89783ed465b03829136e9 | e0512b4cdfa82875a1a4012d681f0777afb8f5c6 | refs/heads/master | 2021-09-24T12:27:41.952641 | 2021-09-14T16:36:11 | 2021-09-14T16:36:11 | 302,193,934 | 1 | 0 | null | 2021-09-14T16:36:12 | 2020-10-08T00:33:03 | null | UTF-8 | Java | false | false | 1,532 | java | package br.com.gamemods.minecity.forge.base.accessors.entity.base;
import net.minecraft.entity.Entity;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EntityDamageSource;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
public interface PotionApplier
{
@NotNull
default Action getPotionAction(IEntityLivingBase mcEntity, IPotionEffect mcEffect, Class<?> sourceClass,
String methodName, String methodDesc, List<?> methodParams)
{
return Action.SIMULATE_POTION;
}
@Nullable
default IEntity getPotionSource(IEntityLivingBase entity, IPotionEffect mcEffect, Class<?> sourceClass,
String methodName, String methodDesc, List<?> methodParams)
{
if(this instanceof IEntity)
return (IEntity) this;
return null;
}
default DamageSource getPotionDamageSource(IEntity sourceEntity, IEntityLivingBase entity, IPotionEffect mcEffect,
Class<?> sourceClass, String methodName, String methodDesc,
List<?> methodParams)
{
if(sourceEntity != null)
return new EntityDamageSource("potion", (Entity) sourceEntity).setMagicDamage();
return new DamageSource("potion").setMagicDamage();
}
enum Action
{
NOTHING, SIMULATE_POTION, SIMULATE_DAMAGE_VERBOSE, SIMULATE_DAMAGE_SILENT
}
}
| [
"[email protected]"
] | |
6088c480baeff52dec1c47c0cc5ba36b2bb334f9 | 35e98992bd2b14b10a158b0759fc7c935fd38e9f | /app/src/main/java/com/example/aplikasiskripsitest/HalamanListActivity.java | 4af2d73cb6b463d3cfe1d5629edfdb7b34fef104 | [] | no_license | barizhilmi/testaplikasiskripsi | 89fcbab1c2c8b86b58c49498905a05a808b965c7 | 2a1778be46785b5401832bc4b1babc64abe3291a | refs/heads/master | 2021-01-06T10:37:19.912019 | 2020-02-19T03:49:59 | 2020-02-19T03:49:59 | 241,299,424 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,649 | java | package com.example.aplikasiskripsitest;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
public class HalamanListActivity extends AppCompatActivity {
private String[] dataPantai = {"Pantai Mondangan","Pantai Jonggring Saloko","Pantai Ngliyep-Pasir Panjang"
,"Pantai Bantol","Pantai Kondang Iwak","Pantai Kondang Merak", "Pantai Balekambangan", "Pantai Wonogoro",
"Pantai Ngantep", "Pantai Bajulmati", "Pantai Goa Cina", "Pantai Sendang Biru", "Pantai Tamban Indah",
"Pantai Lenggoksono", "Pantai Wediawu", "Pantai Sepilot", "Pantai Licin"};
private Button btnCari;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_halaman_list);
btnCari = findViewById(R.id.btnCari);
btnCari.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
launchHalamanInputBobot();
}
});
ListView listView = findViewById(R.id.list_pantai_malang);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, android.R.id.text1, dataPantai);
listView.setAdapter(adapter);
}
public void launchHalamanInputBobot(){
Intent intent = new Intent(HalamanListActivity.this, InputBobotActivity.class);
startActivity(intent);
}
}
| [
"[email protected]"
] | |
7bd5995df205249cda096e750ac640f9ae16432d | 36a6cf3869191757466c617719b405d1b0a17db6 | /src/main/java/com/lionxxw/seckill/dto/SeckillExecution.java | 5d9b4cde9ccfe1b207e8f3575cb690772bb9b14b | [] | no_license | fimi2008/seckill | e0773f6b9bc688e7fa7f307a32462fa26d0a3c30 | 2cc13cb0cde6fa431a15f9c479c5755ecfed3df2 | refs/heads/master | 2021-01-21T10:19:09.975988 | 2018-11-26T06:01:13 | 2018-11-26T06:01:13 | 83,403,589 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,598 | java | package com.lionxxw.seckill.dto;
import com.lionxxw.seckill.entity.SuccessKilled;
import com.lionxxw.seckill.enums.SeckillStatEnum;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
/**
* 封装秒杀执行后结果
* Package com.lionxxw.seckill.dto
* Project seckill
* Author lionxxw
* Created on 2017/2/28 16:04
* version 1.0.0
*/
@Getter
@Setter
public class SeckillExecution implements Serializable{
private static final long serialVersionUID = 2032787759215856532L;
private Long seckillId; // 秒杀商品id
private Integer state; // 秒杀执行结果状态
private String stateInfo; // 状态表示
private SuccessKilled successKilled; // 秒杀成功对象
public SeckillExecution(Long seckillId, SeckillStatEnum seckillStatEnum, SuccessKilled successKilled) {
this.seckillId = seckillId;
this.state = seckillStatEnum.getState();
this.stateInfo = seckillStatEnum.getStateInfo();
this.successKilled = successKilled;
}
public SeckillExecution(Long seckillId, SeckillStatEnum seckillStatEnum) {
this.seckillId = seckillId;
this.state = seckillStatEnum.getState();
this.stateInfo = seckillStatEnum.getStateInfo();
}
@Override
public String toString() {
return "SeckillExecution{" +
"seckillId=" + seckillId +
", state=" + state +
", stateInfo='" + stateInfo + '\'' +
", successKilled=" + successKilled +
'}';
}
}
| [
"[email protected]"
] | |
0ebbe144ea6415f4e0cd81b6b0e45d4dc32e3dc6 | 9ea78e8fbcc72442b96af2b6150497b0b7dacb50 | /src/main/lombok/com/restfb/types/UserProfile.java | 997fab57d5341e086fb0ccbdd7495f25e97a9b3e | [
"MIT"
] | permissive | amit-jay/restfb | e8f49700069be0b984d5cd2ae10c5f9f5d22b021 | 762c7f263d8f944123ebe4b2f65caffe2279c877 | refs/heads/master | 2023-05-23T23:18:06.521247 | 2021-05-12T20:44:42 | 2021-05-12T20:44:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,318 | java | /*
* Copyright (c) 2010-2021 Mark Allen, Norbert Bartels.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.restfb.types;
import com.restfb.Facebook;
import lombok.Getter;
import lombok.Setter;
/**
* Respresents the User Profile object as defined
* <a href="https://developers.facebook.com/docs/messenger-platform/identity/user-profile/">here</a>
*/
public class UserProfile extends AbstractFacebookType {
@Getter
@Setter
@Facebook("first_name")
private String firstName;
@Getter
@Setter
@Facebook("last_name")
private String lastName;
@Getter
@Setter
@Facebook("profile_pic")
private String profilePic;
@Getter
@Setter
@Facebook
private String locale;
@Getter
@Setter
@Facebook
private String timezone;
@Getter
@Setter
@Facebook
private String gender;
@Getter
@Setter
@Facebook("is_payment_enabled")
private Boolean isPaymentEnabled;
@Getter
@Setter
@Facebook("last_ad_referral")
private LastAdReferral lastAdReferral;
public static class LastAdReferral extends AbstractFacebookType {
@Getter
@Setter
@Facebook
private String source;
@Getter
@Setter
@Facebook
private String type;
@Getter
@Setter
@Facebook("ad_id")
private String adId;
}
}
| [
"[email protected]"
] | |
4f591c12e060d00eb1e12c55a5eaff3a6715c0f3 | 1e1f16fa1f0e6c4cb3f485afb689d747b288bb10 | /concurrent-plus/src/com/concurrent/ch05/bitwite/Permission.java | ea2d19f1741bab0a47da0455c839a6c62c397afb | [
"AFL-3.0"
] | permissive | 18261938766/java-bable | b0ce9619cec9bf8d232fe8d36773ec07ee8083ba | 5642fd6511e19c21b78be2c8e09a3698fff67498 | refs/heads/master | 2022-12-06T16:32:01.062817 | 2020-08-14T07:07:22 | 2020-08-14T07:07:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,405 | java | package com.concurrent.ch05.bitwite;
/**
* 位运算用在权限控制
*/
public class Permission {
//增
private static final int ADD = 1 << 0; // 0001
//删
private static final int DELETE = 1 << 1; // 0010
//改
private static final int UPDATE = 1 << 2; // 0100
//查
private static final int GET = 1 << 3; // 1000
//权限
private int per;
//设置权限
private void setPer(int flag) {
per = flag;
}
//增加某些权限
private void addPer(int flag) {
per = per | flag;
}
//删除某些权限
private void detelePer(int flag) {
per = per & ~flag;
}
//判断用户是否拥有某些权限
private boolean isAllow(int flag) {
return ((flag & per) == flag);
}
//判断用户是否没有某些权限
private boolean isNotAllow(int flag) {
return ((per & flag) == 0);
}
public static void main(String[] args) {
int flag = 15; // 1111
Permission permission = new Permission();
permission.setPer(flag);
permission.detelePer(ADD | GET);
System.out.println("select = " + permission.isAllow(GET));
System.out.println("update = " + permission.isAllow(UPDATE));
System.out.println("insert = " + permission.isAllow(ADD));
System.out.println("delete = " + permission.isAllow(DELETE));
}
}
| [
"[email protected]"
] | |
ae83bae434cd8f2c84500e3aca99dfb998ad98e3 | cdf78f418cfd7f07ca78e938c15e3e057837125d | /app/src/androidTest/java/com/nextinput/EJML/ExampleInstrumentedTest.java | 39fb39e2a75ad3a895d72142857a2639a5655431 | [] | no_license | vsutardja-ni/Multiforce | 0a250335c7a1b9b5fed71dd62997fbad96e55a76 | df142b5d15c9a1a94143966976b875cae2472187 | refs/heads/master | 2021-01-22T10:07:41.506484 | 2017-02-14T20:59:16 | 2017-02-14T20:59:16 | 81,989,027 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 772 | java | package com.nextinput.evk.GenericN5App;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.iancampbell.myapplication4", appContext.getPackageName());
}
}
| [
"[email protected]"
] | |
0eeb731c30e51a9609cb8ed4e8f6af2ce655bd5e | db586c9caba8b36998c58d242af45fb235617472 | /Bai2.3/src/com/longnguyen/controller/test.java | eb5ca074e3309cad71e5ffb068b2f9f050499216 | [] | no_license | Longzip113/CongNghe-Java | 8b78941da33193ef479bd6a23d173d6b44ba99b0 | b91fb32cc57786e1521423c8df7ce95bdc79b436 | refs/heads/master | 2022-11-05T11:30:06.476447 | 2020-06-16T04:25:02 | 2020-06-16T04:25:02 | 265,272,005 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 181 | java | package com.longnguyen.controller;
import com.longnguyen.view.MainView;
public class test {
public static void main(String[] args) {
MainView uiMainView = new MainView();
}
}
| [
"[email protected]"
] | |
a29a29b2eaccb62b254f0e6b6080ca4f26450ee1 | 7c478d3e096ec3acca4ba6cda50dd1e0beae4d8a | /src/main/java/cn/goldlone/bigdata_platform/dao/DataGroupDao.java | 1ce9c39dbb6c88f06ac164f72679dde52ee3ec89 | [] | no_license | fork-th-org/bigdata_platform | ff3fd4bdedb95b945ef7838a0e77c3c31647afe5 | 4ae2644580b3ae2b258da321316f0c857a64b722 | refs/heads/master | 2021-10-02T04:14:05.844836 | 2018-11-29T02:37:05 | 2018-11-29T02:37:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 625 | java | package cn.goldlone.bigdata_platform.dao;
import cn.goldlone.bigdata_platform.model.DataGroup;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author Created by CN on 2018/11/21/0021 19:52 .
*/
@Mapper
public interface DataGroupDao {
List<DataGroup> getDataGroup(@Param("userId") Integer userId,
@Param("offset") int offset,
@Param("limit") int limit);
void addDataGroup(DataGroup dataGroup);
void updateDataGroup(DataGroup dataGroup);
void deleteDataGroup(Integer id);
}
| [
"[email protected]"
] | |
b4be6c59685e7f043979d7000e6e6bca731af6ee | 000dfe1f472040a67955326b33e5af58d5dae337 | /src/javaexample/Car.java | 9a25741d0a6e1e53f38e8c10648ce20daaf4cee1 | [] | no_license | alexandrupaunescu/JavaTraining | a8a04c7646f584058c1a1644030542a835cbea52 | 66509e95b2e91e0723f600759defc5054a959a0a | refs/heads/master | 2022-12-12T23:32:58.050062 | 2020-08-25T09:59:17 | 2020-08-25T09:59:17 | 243,246,413 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,155 | 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 javaexample;
/**
*
* @author Dinamo
*/
public class Car implements Saleable {
private float salePrice = (float) 500.99;
public String name; // name of brand
@Override
public float getSalePrice() {
//throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
return salePrice;
}
public enum Color {
RED, BLUE, GREEN, BLACK
};
public Color color; //Color of car
public short speed; // max speed of car
// methods
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Car.Color getColor() {
return color;
}
public void setColor(Car.Color color) {
this.color = color;
}
public short getSpeed() {
return speed;
}
public void setSpeed(short speed) {
this.speed = speed;
}
}
| [
"Dinamo@DESKTOP-7RQMABD"
] | Dinamo@DESKTOP-7RQMABD |
22afce3077bc644fd65d71b8b0b7b0c6872fc7b9 | 50c2c98ed92e3434a4179f6ef3bcee268cfc88d4 | /src/euler/upto40/Problem22.java | eff6a68de7a1d716c500a88f4a90339c2059b611 | [] | no_license | duffymo/project-euler-java | b61a7e9ee4f8d3daffa7f5bf86ce56f204a882dd | 7f8744d9181f3de649bdfb68da4ca7c175bd9f2e | refs/heads/master | 2021-01-15T21:44:34.112147 | 2013-10-03T09:10:52 | 2013-10-03T09:10:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 59,800 | java | package euler.upto40;
import org.apache.commons.io.IOUtils;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
/**
* Problem22
* <pre>
* Using names.txt (right click and 'Save Link/Target As...'), a 46K text file containing over five-thousand first
* names, begin by sorting it into alphabetical order. Then working out the alphabetical value for each name,
* multiply this value by its alphabetical position in the list to obtain a name score.
* For example, when the list is sorted into alphabetical order, COLIN, which is worth 3 + 15 + 12 + 9 + 14 = 53,
* is the 938th name in the list. So, COLIN would obtain a score of 938*53 = 49714.
* What is the total of all the name scores in the file?
* </pre>
* <code>
* {AARON=49, ABBEY=35, ABBIE=19, ABBY=30, ABDUL=40, ABE=8, ABEL=20, ABIGAIL=41, ABRAHAM=44, ABRAM=35, ADA=6, ADAH=14, ADALBERTO=78, ADALINE=46, ADAM=19, ADAN=20, ADDIE=23, ADELA=23, ADELAIDA=37, ADELAIDE=41, ADELE=27, ADELIA=32, ADELINA=46, ADELINE=50, ADELL=34, ADELLA=35, ADELLE=39, ADENA=25, ADINA=29, ADOLFO=53, ADOLPH=56, ADRIA=33, ADRIAN=47, ADRIANA=48, ADRIANE=52, ADRIANNA=62, ADRIANNE=66, ADRIEN=51, ADRIENE=56, ADRIENNE=70, AFTON=56, AGATHA=38, AGNES=46, AGNUS=62, AGRIPINA=75, AGUEDA=39, AGUSTIN=91, AGUSTINA=92, AHMAD=27, AHMED=31, AI=10, AIDA=15, AIDE=19, AIKO=36, AILEEN=46, AILENE=46, AIMEE=33, AISHA=38, AJA=12, AKIKO=47, AKILAH=42, AL=13, ALAINA=38, ALAINE=42, ALAN=28, ALANA=29, ALANE=33, ALANNA=43, ALAYNA=54, ALBA=16, ALBERT=58, ALBERTA=59, ALBERTHA=67, ALBERTINA=82, ALBERTINE=86, ALBERTO=73, ALBINA=39, ALDA=18, ALDEN=36, ALDO=32, ALEASE=43, ALEC=21, ALECIA=31, ALEEN=37, ALEIDA=32, ALEISHA=55, ALEJANDRA=66, ALEJANDRINA=89, ALEJANDRO=80, ALENA=33, ALENE=37, ALESHA=46, ALESHIA=55, ALESIA=47, ALESSANDRA=94, ALETA=39, ALETHA=47, ALETHEA=52, ALETHIA=56, ALEX=42, ALEXA=43, ALEXANDER=84, ALEXANDRA=80, ALEXANDRIA=89, ALEXIA=52, ALEXIS=70, ALFONSO=82, ALFONZO=89, ALFRED=46, ALFREDA=47, ALFREDIA=56, ALFREDO=61, ALI=22, ALIA=23, ALICA=26, ALICE=30, ALICIA=35, ALIDA=27, ALINA=37, ALINE=41, ALISA=42, ALISE=46, ALISHA=50, ALISHIA=59, ALISIA=51, ALISON=70, ALISSA=61, ALITA=43, ALIX=46, ALIZA=49, ALLA=26, ALLAN=40, ALLEEN=49, ALLEGRA=56, ALLEN=44, ALLENA=45, ALLENE=49, ALLIE=39, ALLINE=53, ALLISON=82, ALLYN=64, ALLYSON=98, ALMA=27, ALMEDA=36, ALMETA=52, ALONA=43, ALONSO=76, ALONZO=83, ALPHA=38, ALPHONSE=90, ALPHONSO=100, ALTA=34, ALTAGRACIA=73, ALTHA=42, ALTHEA=47, ALTON=62, ALVA=36, ALVARO=69, ALVERA=59, ALVERTA=79, ALVIN=58, ALVINA=59, ALYCE=46, ALYCIA=51, ALYSA=58, ALYSE=62, ALYSHA=66, ALYSIA=67, ALYSON=86, ALYSSA=77, AMADA=20, AMADO=34, AMAL=27, AMALIA=37, AMANDA=34, AMBER=39, AMBERLY=76, AMBROSE=73, AMEE=24, AMELIA=41, AMERICA=50, AMI=23, AMIE=28, AMIEE=33, AMINA=38, AMIRA=42, AMMIE=41, AMOS=48, AMPARO=64, AMY=39, AN=15, ANA=16, ANABEL=35, ANALISA=57, ANAMARIA=58, ANASTACIA=69, ANASTASIA=85, ANDERA=43, ANDERSON=90, ANDRA=38, ANDRE=42, ANDREA=43, ANDREAS=62, ANDREE=47, ANDRES=61, ANDREW=65, ANDRIA=47, ANDY=44, ANETTE=65, ANGEL=39, ANGELA=40, ANGELE=44, ANGELENA=59, ANGELES=63, ANGELIA=49, ANGELIC=51, ANGELICA=52, ANGELIKA=60, ANGELINA=63, ANGELINE=67, ANGELIQUE=91, ANGELITA=69, ANGELLA=52, ANGELO=54, ANGELYN=78, ANGIE=36, ANGILA=44, ANGLA=35, ANGLE=39, ANGLEA=40, ANH=23, ANIBAL=39, ANIKA=36, ANISA=44, ANISHA=52, ANISSA=63, ANITA=45, ANITRA=63, ANJA=26, ANJANETTE=90, ANJELICA=55, ANN=29, ANNA=30, ANNABEL=49, ANNABELL=61, ANNABELLE=66, ANNALEE=52, ANNALISA=71, ANNAMAE=49, ANNAMARIA=72, ANNAMARIE=76, ANNE=34, ANNELIESE=84, ANNELLE=63, ANNEMARIE=80, ANNETT=74, ANNETTA=75, ANNETTE=79, ANNICE=46, ANNIE=43, ANNIKA=50, ANNIS=57, ANNITA=59, ANNMARIE=75, ANTHONY=97, ANTIONE=78, ANTIONETTE=123, ANTOINE=78, ANTOINETTE=123, ANTON=64, ANTONE=69, ANTONETTA=110, ANTONETTE=114, ANTONIA=74, ANTONIETTA=119, ANTONINA=88, ANTONIO=88, ANTONY=89, ANTWAN=73, ANYA=41, APOLONIA=83, APRIL=56, APRYL=72, ARA=20, ARACELI=49, ARACELIS=68, ARACELY=65, ARCELIA=49, ARCHIE=44, ARDATH=52, ARDELIA=50, ARDELL=52, ARDELLA=53, ARDELLE=57, ARDEN=42, ARDIS=51, ARDITH=60, ARETHA=53, ARGELIA=53, ARGENTINA=89, ARIANA=44, ARIANE=48, ARIANNA=58, ARIANNE=62, ARICA=32, ARIE=33, ARIEL=45, ARIELLE=62, ARLA=32, ARLEAN=51, ARLEEN=55, ARLEN=50, ARLENA=51, ARLENE=55, ARLETHA=65, ARLETTA=77, ARLETTE=81, ARLIE=45, ARLINDA=59, ARLINE=59, ARLYNE=75, ARMAND=51, ARMANDA=52, ARMANDINA=75, ARMANDO=66, ARMIDA=46, ARMINDA=60, ARNETTA=79, ARNETTE=83, ARNITA=63, ARNOLD=64, ARNOLDO=79, ARNULFO=87, ARON=48, ARRON=66, ART=39, ARTHUR=86, ARTIE=53, ARTURO=93, ARVILLA=75, ASA=21, ASHA=29, ASHANTI=72, ASHELY=70, ASHLEA=46, ASHLEE=50, ASHLEIGH=69, ASHLEY=70, ASHLI=49, ASHLIE=54, ASHLY=65, ASHLYN=79, ASHTON=77, ASIA=30, ASLEY=62, ASSUNTA=95, ASTRID=71, ASUNCION=96, ATHENA=49, AUBREY=72, AUDIE=40, AUDRA=45, AUDREA=50, AUDREY=74, AUDRIA=54, AUDRIE=58, AUDRY=69, AUGUST=89, AUGUSTA=90, AUGUSTINA=113, AUGUSTINE=117, AUGUSTUS=129, AUNDREA=64, AURA=41, AUREA=46, AURELIA=67, AURELIO=81, AURORA=74, AURORE=78, AUSTIN=84, AUTUMN=90, AVA=24, AVELINA=64, AVERY=71, AVIS=51, AVRIL=62, AWILDA=50, AYAKO=53, AYANA=42, AYANNA=56, AYESHA=59, AZALEE=50, AZUCENA=71, AZZIE=67, BABARA=25, BABETTE=55, BAILEY=54, BAMBI=27, BAO=18, BARABARA=44, BARB=23, BARBAR=42, BARBARA=43, BARBERA=47, BARBIE=37, BARBRA=42, BARI=30, BARNEY=65, BARRETT=84, BARRIE=53, BARRY=64, BART=41, BARTON=70, BASIL=43, BASILIA=53, BEA=8, BEATA=29, BEATRICE=63, BEATRIS=74, BEATRIZ=81, BEAU=29, BEAULAH=50, BEBE=14, BECKI=30, BECKIE=35, BECKY=46, BEE=12, BELEN=38, BELIA=29, BELINDA=47, BELKIS=58, BELL=31, BELLA=32, BELLE=36, BELVA=42, BEN=21, BENEDICT=62, BENITA=51, BENITO=65, BENJAMIN=68, BENNETT=80, BENNIE=49, BENNY=60, BENTON=70, BERENICE=61, BERNA=40, BERNADETTE=94, BERNADINE=72, BERNARD=62, BERNARDA=63, BERNARDINA=86, BERNARDINE=90, BERNARDO=77, BERNEICE=61, BERNETTA=85, BERNICE=56, BERNIE=53, BERNIECE=61, BERNITA=69, BERRY=68, BERT=45, BERTA=46, BERTHA=54, BERTIE=59, BERTRAM=77, BERYL=62, BESS=45, BESSIE=59, BETH=35, BETHANIE=64, BETHANN=64, BETHANY=75, BETHEL=52, BETSEY=76, BETSY=71, BETTE=52, BETTIE=61, BETTINA=71, BETTY=72, BETTYANN=101, BETTYE=77, BEULA=41, BEULAH=49, BEV=29, BEVERLEE=74, BEVERLEY=94, BEVERLY=89, BIANCA=30, BIBI=22, BILL=35, BILLI=44, BILLIE=49, BILLY=60, BILLYE=65, BIRDIE=47, BIRGIT=65, BLAINE=43, BLAIR=42, BLAKE=31, BLANCA=33, BLANCH=40, BLANCHE=45, BLONDELL=76, BLOSSOM=95, BLYTHE=72, BO=17, BOB=19, BOBBI=30, BOBBIE=35, BOBBY=46, BOBBYE=51, BOBETTE=69, BOK=28, BONG=38, BONITA=61, BONNIE=59, BONNY=70, BOOKER=66, BORIS=63, BOYCE=50, BOYD=46, BRAD=25, BRADFORD=68, BRADLEY=67, BRADLY=62, BRADY=50, BRAIN=44, BRANDA=40, BRANDE=44, BRANDEE=49, BRANDEN=58, BRANDI=48, BRANDIE=53, BRANDON=68, BRANDY=64, BRANT=55, BREANA=41, BREANN=54, BREANNA=55, BREANNE=59, BREE=30, BRENDA=44, BRENDAN=58, BRENDON=72, BRENNA=54, BRENT=59, BRENTON=88, BRET=45, BRETT=65, BRIAN=44, BRIANA=45, BRIANNA=59, BRIANNE=63, BRICE=37, BRIDGET=65, BRIDGETT=85, BRIDGETTE=90, BRIGETTE=86, BRIGID=49, BRIGIDA=50, BRIGITTE=90, BRINDA=48, BRITANY=89, BRITNEY=93, BRITNI=72, BRITT=69, BRITTA=70, BRITTANEY=114, BRITTANI=93, BRITTANIE=98, BRITTANY=109, BRITTENY=113, BRITTNEY=113, BRITTNI=92, BRITTNY=108, BROCK=49, BRODERICK=85, BRONWYN=111, BROOK=61, BROOKE=66, BROOKS=80, BRUCE=49, BRUNA=56, BRUNILDA=81, BRUNO=70, BRYAN=60, BRYANNA=75, BRYANT=80, BRYCE=53, BRYNN=73, BRYON=74, BUCK=37, BUD=27, BUDDY=56, BUENA=43, BUFFY=60, BUFORD=66, BULA=36, BULAH=44, BUNNY=76, BURL=53, BURMA=55, BURT=61, BURTON=90, BUSTER=85, BYRON=74, CAITLIN=68, CAITLYN=84, CALANDRA=54, CALEB=23, CALISTA=65, CALLIE=42, CALVIN=61, CAMELIA=44, CAMELLIA=56, CAMERON=69, CAMI=26, CAMIE=31, CAMILA=39, CAMILLA=51, CAMILLE=55, CAMMIE=44, CAMMY=55, CANDACE=31, CANDANCE=45, CANDELARIA=68, CANDI=31, CANDICE=39, CANDIDA=36, CANDIE=36, CANDIS=50, CANDRA=41, CANDY=47, CANDYCE=55, CAPRICE=55, CARA=23, CAREN=41, CAREY=52, CARI=31, CARIDAD=40, CARIE=36, CARIN=45, CARINA=46, CARISA=51, CARISSA=70, CARITA=52, CARL=34, CARLA=35, CARLEE=44, CARLEEN=58, CARLENA=54, CARLENE=58, CARLETTA=80, CARLEY=64, CARLI=43, CARLIE=48, CARLINE=62, CARLITA=64, CARLO=49, CARLOS=68, CARLOTA=70, CARLOTTA=90, CARLTON=83, CARLY=59, CARLYN=73, CARMA=36, CARMAN=50, CARMEL=52, CARMELA=53, CARMELIA=62, CARMELINA=76, CARMELITA=82, CARMELLA=65, CARMELO=67, CARMEN=54, CARMINA=59, CARMINE=63, CARMON=64, CAROL=49, CAROLA=50, CAROLANN=78, CAROLE=54, CAROLEE=59, CAROLIN=72, CAROLINA=73, CAROLINE=77, CAROLL=61, CAROLYN=88, CAROLYNE=93, CAROLYNN=102, CARON=51, CAROYLN=88, CARRI=49, CARRIE=54, CARROL=67, CARROLL=79, CARRY=65, CARSON=70, CARTER=65, CARY=47, CARYL=59, CARYLON=88, CARYN=61, CASANDRA=61, CASEY=53, CASIE=37, CASIMIRA=73, CASSANDRA=80, CASSAUNDRA=101, CASSEY=72, CASSI=51, CASSIDY=80, CASSIE=56, CASSONDRA=94, CASSY=67, CATALINA=61, CATARINA=67, CATERINA=71, CATHARINE=79, CATHERIN=78, CATHERINA=79, CATHERINE=83, CATHERN=69, CATHERYN=94, CATHEY=62, CATHI=41, CATHIE=46, CATHLEEN=68, CATHRINE=78, CATHRYN=89, CATHY=57, CATINA=48, CATRICE=59, CATRINA=66, CAYLA=42, CECELIA=38, CECIL=32, CECILA=33, CECILE=37, CECILIA=42, CECILLE=49, CECILY=57, CEDRIC=42, CEDRICK=53, CELENA=40, CELESTA=65, CELESTE=69, CELESTINA=88, CELESTINE=92, CELIA=30, CELINA=44, CELINDA=48, CELINE=48, CELSA=40, CEOLA=36, CESAR=46, CHAD=16, CHADWICK=62, CHAE=17, CHAN=26, CHANA=27, CHANCE=34, CHANDA=31, CHANDRA=49, CHANEL=43, CHANELL=55, CHANELLE=60, CHANG=33, CHANTAL=59, CHANTAY=72, CHANTE=51, CHANTEL=63, CHANTELL=75, CHANTELLE=80, CHARA=31, CHARIS=58, CHARISE=63, CHARISSA=78, CHARISSE=82, CHARITA=60, CHARITY=84, CHARLA=43, CHARLEEN=66, CHARLENA=62, CHARLENE=66, CHARLES=66, CHARLESETTA=112, CHARLETTE=92, CHARLEY=72, CHARLIE=56, CHARLINE=70, CHARLOTT=97, CHARLOTTE=102, CHARLSIE=75, CHARLYN=81, CHARMAIN=67, CHARMAINE=72, CHAROLETTE=107, CHAS=31, CHASE=36, CHASIDY=69, CHASITY=85, CHASSIDY=88, CHASTITY=105, CHAU=33, CHAUNCEY=80, CHAYA=38, CHELSEA=53, CHELSEY=77, CHELSIE=61, CHER=34, CHERE=39, CHEREE=44, CHERELLE=68, CHERI=43, CHERIE=48, CHERILYN=94, CHERISE=67, CHERISH=70, CHERLY=71, CHERLYN=85, CHERRI=61, CHERRIE=66, CHERRY=77, CHERRYL=89, CHERY=59, CHERYL=71, CHERYLE=76, CHERYLL=83, CHESTER=78, CHET=36, CHEYENNE=79, CHI=20, CHIA=21, CHIEKO=51, CHIN=34, CHINA=35, CHING=41, CHIQUITA=88, CHLOE=43, CHONG=47, CHRIS=57, CHRISSY=101, CHRISTA=78, CHRISTAL=90, CHRISTEEN=101, CHRISTEL=94, CHRISTEN=96, CHRISTENA=97, CHRISTENE=101, CHRISTI=86, CHRISTIA=87, CHRISTIAN=101, CHRISTIANA=102, CHRISTIANE=106, CHRISTIE=91, CHRISTIN=100, CHRISTINA=101, CHRISTINE=105, CHRISTINIA=110, CHRISTOPER=131, CHRISTOPHER=139, CHRISTY=102, CHRYSTAL=106, CHU=32, CHUCK=46, CHUN=46, CHUNG=53, CIARA=32, CICELY=57, CIERA=36, CIERRA=54, CINDA=31, CINDERELLA=83, CINDI=39, CINDIE=44, CINDY=55, CINTHIA=64, CIRA=31, CLAIR=43, CLAIRE=48, CLARA=35, CLARE=39, CLARENCE=61, CLARETHA=68, CLARETTA=80, CLARIBEL=62, CLARICE=51, CLARINDA=62, CLARINE=62, CLARIS=62, CLARISA=63, CLARISSA=82, CLARITA=64, CLARK=45, CLASSIE=68, CLAUD=41, CLAUDE=46, CLAUDETTE=91, CLAUDIA=51, CLAUDIE=55, CLAUDINE=69, CLAUDIO=65, CLAY=41, CLAYTON=90, CLELIA=42, CLEMENCIA=65, CLEMENT=72, CLEMENTE=77, CLEMENTINA=96, CLEMENTINE=100, CLEMMIE=60, CLEO=35, CLEOPATRA=91, CLEORA=54, CLEOTILDE=85, CLETA=41, CLETUS=80, CLEVELAND=78, CLIFF=36, CLIFFORD=73, CLIFTON=79, CLINT=58, CLINTON=87, CLORA=49, CLORINDA=76, CLOTILDE=80, CLYDE=49, CODI=31, CODY=47, COLBY=57, COLE=35, COLEEN=54, COLEMAN=63, COLENE=54, COLETTA=76, COLETTE=80, COLIN=53, COLLEEN=66, COLLEN=61, COLLENE=66, COLLETTE=92, COLLIN=65, COLTON=79, COLUMBUS=106, CONCEPCION=97, CONCEPTION=114, CONCETTA=81, CONCHA=44, CONCHITA=73, CONNIE=60, CONRAD=55, CONSTANCE=94, CONSUELA=90, CONSUELO=104, CONTESSA=96, CORA=37, CORAL=49, CORALEE=59, CORALIE=63, CORAZON=92, CORDELIA=67, CORDELL=69, CORDIA=50, CORDIE=54, COREEN=60, CORENE=60, CORETTA=82, COREY=66, CORI=45, CORIE=50, CORINA=60, CORINE=64, CORINNA=74, CORINNE=78, CORLISS=95, CORNELIA=77, CORNELIUS=116, CORNELL=79, CORRIE=68, CORRIN=77, CORRINA=78, CORRINE=82, CORRINNE=96, CORTEZ=87, CORTNEY=100, CORY=61, COURTNEY=121, COY=43, CRAIG=38, CREOLA=54, CRIS=49, CRISELDA=71, CRISSY=93, CRISTA=70, CRISTAL=82, CRISTEN=88, CRISTI=78, CRISTIE=83, CRISTIN=92, CRISTINA=93, CRISTINE=97, CRISTOBAL=99, CRISTOPHER=131, CRISTY=94, CRUZ=68, CRYSTA=86, CRYSTAL=98, CRYSTLE=102, CUC=27, CURT=62, CURTIS=90, CYNDI=55, CYNDY=71, CYNTHIA=80, CYRIL=67, CYRSTAL=98, CYRUS=86, CYTHIA=66, DACIA=18, DAGMAR=44, DAGNY=51, DAHLIA=35, DAINA=29, DAINE=33, DAISEY=63, DAISY=58, DAKOTA=52, DALE=22, DALENE=41, DALIA=27, DALILA=39, DALLAS=49, DALTON=66, DAMARIS=65, DAMIAN=42, DAMIEN=46, DAMION=56, DAMON=47, DAN=19, DANA=20, DANAE=25, DANE=24, DANELLE=53, DANETTE=69, DANI=28, DANIA=29, DANIAL=41, DANICA=32, DANIEL=45, DANIELA=46, DANIELE=50, DANIELL=57, DANIELLA=58, DANIELLE=62, DANIKA=40, DANILLE=57, DANILO=55, DANITA=49, DANN=33, DANNA=34, DANNETTE=83, DANNIE=47, DANNIELLE=76, DANNY=58, DANTE=44, DANUTA=61, DANYEL=61, DANYELL=73, DANYELLE=78, DAPHINE=57, DAPHNE=48, DARA=24, DARBY=50, DARCEL=43, DARCEY=56, DARCI=35, DARCIE=40, DARCY=51, DARELL=52, DAREN=42, DARIA=33, DARIN=46, DARIO=47, DARIUS=72, DARLA=36, DARLEEN=59, DARLENA=55, DARLENE=59, DARLINE=63, DARNELL=66, DARON=52, DARREL=58, DARRELL=70, DARREN=60, DARRICK=64, DARRIN=64, DARRON=70, DARRYL=78, DARWIN=69, DARYL=60, DAVE=32, DAVID=40, DAVIDA=41, DAVINA=51, DAVIS=55, DAWN=42, DAWNA=43, DAWNE=47, DAYLE=47, DAYNA=45, DAYSI=58, DEADRA=33, DEAN=24, DEANA=25, DEANDRA=47, DEANDRE=51, DEANDREA=52, DEANE=29, DEANGELO=63, DEANN=38, DEANNA=39, DEANNE=43, DEB=11, DEBBI=22, DEBBIE=27, DEBBRA=32, DEBBY=38, DEBERA=35, DEBI=20, DEBORA=45, DEBORAH=53, DEBRA=30, DEBRAH=38, DEBROAH=53, DEDE=18, DEDRA=32, DEE=14, DEEANN=43, DEEANNA=44, DEEDEE=28, DEEDRA=37, DEENA=29, DEETTA=55, DEIDRA=41, DEIDRE=45, DEIRDRE=63, DEJA=20, DEL=21, DELAINE=50, DELANA=37, DELBERT=66, DELCIE=38, DELENA=41, DELFINA=51, DELIA=31, DELICIA=43, DELILA=43, DELILAH=51, DELINDA=49, DELISA=50, DELL=33, DELLA=34, DELMA=35, DELMAR=53, DELMER=57, DELMY=59, DELOIS=64, DELOISE=69, DELORA=55, DELORAS=74, DELORES=78, DELORIS=82, DELORSE=78, DELPHA=46, DELPHIA=55, DELPHINE=73, DELSIE=54, DELTA=42, DEMARCUS=84, DEMETRA=66, DEMETRIA=75, DEMETRICE=82, DEMETRIUS=114, DENA=24, DENAE=29, DENEEN=47, DENESE=52, DENICE=40, DENIS=51, DENISE=56, DENISHA=60, DENISSE=75, DENITA=53, DENNA=38, DENNIS=65, DENNISE=70, DENNY=62, DENVER=68, DENYSE=72, DEON=38, DEONNA=53, DEREK=43, DERICK=50, DERRICK=68, DESHAWN=74, DESIRAE=61, DESIRE=60, DESIREE=65, DESMOND=74, DESPINA=68, DESSIE=61, DESTINY=96, DETRA=48, DEVIN=54, DEVON=60, DEVONA=61, DEVORA=65, DEVORAH=73, DEWAYNE=77, DEWEY=62, DEWITT=81, DEXTER=76, DIA=14, DIAMOND=60, DIAN=28, DIANA=29, DIANE=33, DIANN=42, DIANNA=43, DIANNE=47, DICK=27, DIEDRA=41, DIEDRE=45, DIEGO=40, DIERDRE=63, DIGNA=35, DILLON=66, DIMPLE=59, DINA=28, DINAH=36, DINO=42, DINORAH=69, DION=42, DIONE=47, DIONNA=57, DIONNE=61, DIRK=42, DIVINA=59, DIXIE=51, DODIE=37, DOLLIE=57, DOLLY=68, DOLORES=88, DOLORIS=92, DOMENIC=63, DOMENICA=64, DOMINGA=63, DOMINGO=77, DOMINIC=67, DOMINICA=68, DOMINICK=78, DOMINIQUE=107, DOMINQUE=98, DOMITILA=83, DOMONIQUE=113, DON=33, DONA=34, DONALD=50, DONELLA=63, DONETTA=79, DONETTE=83, DONG=40, DONITA=63, DONN=47, DONNA=48, DONNELL=76, DONNETTA=93, DONNETTE=97, DONNIE=61, DONNY=72, DONOVAN=85, DONTE=58, DONYA=59, DORA=38, DORATHY=91, DORCAS=60, DOREATHA=72, DOREEN=61, DORENE=61, DORETHA=71, DORETHEA=76, DORETTA=83, DORI=46, DORIA=47, DORIAN=61, DORIE=51, DORINDA=65, DORINE=65, DORIS=65, DORLA=50, DOROTHA=81, DOROTHEA=86, DOROTHY=105, DORRIS=83, DORSEY=86, DORTHA=66, DORTHEA=71, DORTHEY=95, DORTHY=90, DOT=39, DOTTIE=73, DOTTY=84, DOUG=47, DOUGLAS=79, DOUGLASS=98, DOVIE=55, DOYLE=61, DREAMA=42, DREMA=41, DREW=50, DRUCILLA=80, DRUSILLA=96, DUANE=45, DUDLEY=71, DULCE=45, DULCIE=54, DUNCAN=57, DUNG=46, DUSTI=73, DUSTIN=87, DUSTY=89, DWAIN=51, DWANA=43, DWAYNE=72, DWIGHT=71, DYAN=44, DYLAN=56, EARL=36, EARLE=41, EARLEAN=56, EARLEEN=60, EARLENE=60, EARLIE=50, EARLINE=64, EARNEST=82, EARNESTINE=110, EARTHA=53, EASTER=68, EBONI=45, EBONIE=50, EBONY=61, ECHO=31, ED=9, EDA=10, EDDA=14, EDDIE=27, EDDY=38, EDELMIRA=67, EDEN=28, EDGAR=35, EDGARDO=54, EDIE=23, EDISON=66, EDITH=46, EDMOND=55, EDMUND=61, EDMUNDO=76, EDNA=24, EDRA=28, EDRIS=55, EDUARDO=68, EDWARD=55, EDWARDO=70, EDWIN=55, EDWINA=56, EDYTH=62, EDYTHE=67, EFFIE=31, EFRAIN=53, EFREN=48, EHTEL=50, EILEEN=50, EILENE=50, ELA=18, ELADIA=32, ELAINA=42, ELAINE=46, ELANA=33, ELANE=37, ELANOR=65, ELAYNE=62, ELBA=20, ELBERT=62, ELDA=22, ELDEN=40, ELDON=50, ELDORA=55, ELDRIDGE=64, ELEANOR=70, ELEANORA=71, ELEANORE=75, ELEASE=47, ELENA=37, ELENE=41, ELENI=45, ELENOR=69, ELENORA=70, ELENORE=74, ELEONOR=84, ELEONORA=85, ELEONORE=89, ELFREDA=51, ELFRIEDA=60, ELFRIEDE=64, ELI=26, ELIA=27, ELIANA=42, ELIAS=46, ELICIA=39, ELIDA=31, ELIDIA=40, ELIJAH=45, ELIN=40, ELINA=41, ELINOR=73, ELINORE=78, ELISA=46, ELISABETH=81, ELISE=50, ELISEO=65, ELISHA=54, ELISSA=65, ELIZ=52, ELIZA=53, ELIZABET=80, ELIZABETH=88, ELIZBETH=87, ELIZEBETH=92, ELKE=33, ELLA=30, ELLAMAE=49, ELLAN=44, ELLEN=48, ELLENA=49, ELLI=38, ELLIE=43, ELLIOT=73, ELLIOTT=93, ELLIS=57, ELLSWORTH=132, ELLY=54, ELLYN=68, ELMA=31, ELMER=53, ELMIRA=58, ELMO=45, ELNA=32, ELNORA=65, ELODIA=46, ELOIS=60, ELOISA=61, ELOISE=65, ELOUISE=86, ELOY=57, ELROY=75, ELSA=37, ELSE=41, ELSIE=50, ELSY=61, ELTON=66, ELVA=40, ELVERA=63, ELVIA=49, ELVIE=53, ELVIN=62, ELVINA=63, ELVIRA=67, ELVIS=67, ELWANDA=60, ELWOOD=74, ELYSE=66, ELZA=44, EMA=19, EMANUEL=71, EMELDA=40, EMELIA=45, EMELINA=59, EMELINE=63, EMELY=60, EMERALD=58, EMERITA=71, EMERSON=89, EMERY=66, EMIKO=53, EMIL=39, EMILE=44, EMILEE=49, EMILIA=49, EMILIE=53, EMILIO=63, EMILY=64, EMMA=32, EMMALINE=72, EMMANUEL=84, EMMETT=76, EMMIE=45, EMMITT=80, EMMY=56, EMOGENE=64, EMORY=76, ENA=20, ENDA=24, ENEDINA=52, ENEIDA=38, ENID=32, ENOCH=45, ENOLA=47, ENRIQUE=89, ENRIQUETA=110, EPIFANIA=61, ERA=24, ERASMO=71, ERIC=35, ERICA=36, ERICH=43, ERICK=46, ERICKA=47, ERIK=43, ERIKA=44, ERIN=46, ERINN=60, ERLENE=59, ERLINDA=63, ERLINE=63, ERMA=37, ERMELINDA=81, ERMINIA=69, ERNA=38, ERNEST=81, ERNESTINA=105, ERNESTINE=109, ERNESTO=96, ERNIE=51, ERROL=68, ERVIN=68, ERWIN=69, ERYN=62, ESMERALDA=78, ESPERANZA=105, ESSIE=57, ESTA=45, ESTEBAN=66, ESTEFANA=71, ESTELA=62, ESTELL=73, ESTELLA=74, ESTELLE=78, ESTER=67, ESTHER=75, ESTRELLA=92, ETHA=34, ETHAN=48, ETHEL=50, ETHELENE=74, ETHELYN=89, ETHYL=70, ETSUKO=91, ETTA=46, ETTIE=59, EUFEMIA=60, EUGENA=53, EUGENE=57, EUGENIA=62, EUGENIE=66, EUGENIO=76, EULA=39, EULAH=47, EULALIA=61, EUN=40, EUNA=41, EUNICE=57, EURA=45, EUSEBIA=62, EUSEBIO=76, EUSTOLIA=102, EVA=28, EVALYN=79, EVAN=42, EVANGELINA=90, EVANGELINE=94, EVE=32, EVELIA=54, EVELIN=67, EVELINA=68, EVELINE=72, EVELYN=83, EVELYNE=88, EVELYNN=97, EVERETT=95, EVERETTE=100, EVETTE=77, EVIA=37, EVIE=41, EVITA=57, EVON=56, EVONNE=75, EWA=29, EXIE=43, EZEKIEL=73, EZEQUIEL=100, EZRA=50, FABIAN=33, FABIOLA=46, FAE=12, FAIRY=59, FAITH=44, FALLON=60, FANNIE=49, FANNY=60, FARAH=34, FARRAH=52, FATIMA=50, FATIMAH=58, FAUSTINA=91, FAUSTINO=105, FAUSTO=82, FAVIOLA=66, FAWN=44, FAY=32, FAYE=37, FE=11, FEDERICO=65, FELECIA=41, FELICA=36, FELICE=40, FELICIA=45, FELICIDAD=53, FELICITA=65, FELICITAS=84, FELIPA=49, FELIPE=53, FELISA=52, FELISHA=60, FELIX=56, FELTON=72, FERDINAND=75, FERMIN=65, FERMINA=66, FERN=43, FERNANDA=63, FERNANDE=67, FERNANDO=77, FERNE=48, FIDEL=36, FIDELA=37, FIDELIA=46, FILIBERTO=96, FILOMENA=75, FIONA=45, FLAVIA=51, FLETA=44, FLETCHER=77, FLO=33, FLOR=51, FLORA=52, FLORANCE=74, FLORENCE=78, FLORENCIA=83, FLORENCIO=97, FLORENE=75, FLORENTINA=114, FLORENTINO=128, FLORETTA=97, FLORIA=61, FLORIDA=65, FLORINDA=79, FLORINE=79, FLORRIE=83, FLOSSIE=85, FLOY=58, FLOYD=62, FONDA=40, FOREST=83, FORREST=101, FOSTER=83, FRAN=39, FRANCE=47, FRANCENE=66, FRANCES=66, FRANCESCA=70, FRANCESCO=84, FRANCHESCA=78, FRANCIE=56, FRANCINA=66, FRANCINE=70, FRANCIS=70, FRANCISCA=74, FRANCISCO=88, FRANCOISE=90, FRANK=50, FRANKIE=64, FRANKLIN=85, FRANKLYN=101, FRANSISCA=90, FRED=33, FREDA=34, FREDDA=38, FREDDIE=51, FREDDY=62, FREDERIC=68, FREDERICA=69, FREDERICK=79, FREDERICKA=80, FREDIA=43, FREDRIC=63, FREDRICK=74, FREDRICKA=75, FREEDA=39, FREEMAN=62, FREIDA=43, FRIDA=38, FRIEDA=43, FRITZ=79, FUMIKO=75, GABRIEL=54, GABRIELA=55, GABRIELE=59, GABRIELLA=67, GABRIELLE=71, GAIL=29, GALA=21, GALE=25, GALEN=39, GALINA=44, GARFIELD=62, GARLAND=57, GARNET=65, GARNETT=85, GARRET=69, GARRETT=89, GARRY=69, GARTH=54, GARY=51, GASTON=76, GAVIN=53, GAY=33, GAYE=38, GAYLA=46, GAYLE=50, GAYLENE=69, GAYLORD=82, GAYNELL=76, GAYNELLE=81, GEARLDINE=75, GEMA=26, GEMMA=39, GENA=27, GENARO=60, GENE=31, GENESIS=78, GENEVA=54, GENEVIE=67, GENEVIEVE=94, GENEVIVE=89, GENIA=36, GENIE=40, GENNA=41, GENNIE=54, GENNY=65, GENOVEVA=91, GEOFFREY=87, GEORGANN=81, GEORGE=57, GEORGEANN=86, GEORGEANNA=87, GEORGENE=76, GEORGETTA=98, GEORGETTE=102, GEORGIA=62, GEORGIANA=77, GEORGIANN=90, GEORGIANNA=91, GEORGIANNE=95, GEORGIE=66, GEORGINA=76, GEORGINE=80, GERALD=47, GERALDINE=75, GERALDO=62, GERALYN=82, GERARD=53, GERARDO=68, GERDA=35, GERI=39, GERMAINE=72, GERMAN=58, GERRI=57, GERRY=73, GERTHA=59, GERTIE=64, GERTRUD=93, GERTRUDE=98, GERTRUDIS=121, GERTUDE=80, GHISLAINE=84, GIA=17, GIANNA=46, GIDGET=52, GIGI=32, GIL=28, GILBERT=73, GILBERTE=78, GILBERTO=88, GILDA=33, GILLIAN=64, GILMA=42, GINA=31, GINETTE=80, GINGER=60, GINNY=69, GINO=45, GIOVANNA=83, GIOVANNI=91, GISELA=53, GISELE=57, GISELLE=69, GITA=37, GIUSEPPE=98, GIUSEPPINA=117, GLADIS=52, GLADY=49, GLADYS=68, GLAYDS=68, GLEN=38, GLENDA=43, GLENDORA=76, GLENN=52, GLENNA=53, GLENNIE=66, GLENNIS=80, GLINDA=47, GLORIA=62, GLORY=77, GLYNDA=63, GLYNIS=86, GOLDA=39, GOLDEN=57, GOLDIE=52, GONZALO=90, GORDON=73, GRACE=34, GRACIA=39, GRACIE=43, GRACIELA=56, GRADY=55, GRAHAM=48, GRAIG=42, GRANT=60, GRANVILLE=100, GRAYCE=59, GRAZYNA=92, GREG=37, GREGG=44, GREGORIA=80, GREGORIO=94, GREGORY=95, GRETA=51, GRETCHEN=80, GRETTA=71, GRICELDA=59, GRISEL=70, GRISELDA=75, GROVER=85, GUADALUPE=88, GUDRUN=85, GUILLERMINA=121, GUILLERMO=112, GUS=47, GUSSIE=80, GUSTAVO=105, GUY=53, GWEN=49, GWENDA=54, GWENDOLYN=119, GWENN=63, GWYN=69, GWYNETH=102, HA=9, HAE=14, HAI=18, HAILEY=60, HAL=21, HALEY=51, HALINA=45, HALLEY=63, HALLIE=47, HAN=23, HANA=24, HANG=30, HANH=31, HANK=34, HANNA=38, HANNAH=46, HANNELORE=92, HANS=42, HARLAN=54, HARLAND=58, HARLEY=69, HARMONY=94, HAROLD=58, HARRIET=79, HARRIETT=99, HARRIETTE=104, HARRIS=73, HARRISON=102, HARRY=70, HARVEY=79, HASSAN=62, HASSIE=61, HATTIE=63, HAYDEE=48, HAYDEN=57, HAYLEY=76, HAYWOOD=91, HAZEL=52, HEATH=42, HEATHER=65, HECTOR=69, HEDWIG=56, HEDY=42, HEE=18, HEIDE=31, HEIDI=35, HEIDY=51, HEIKE=38, HELAINE=54, HELEN=44, HELENA=45, HELENE=49, HELGA=33, HELLEN=56, HENRIETTA=100, HENRIETTE=104, HENRY=70, HERB=33, HERBERT=76, HERIBERTO=100, HERLINDA=71, HERMA=45, HERMAN=59, HERMELINDA=89, HERMILA=66, HERMINA=68, HERMINE=72, HERMINIA=77, HERSCHEL=78, HERSHEL=75, HERTA=52, HERTHA=60, HESTER=75, HETTIE=67, HIEDI=35, HIEN=36, HILARIA=58, HILARIO=72, HILARY=73, HILDA=34, HILDE=38, HILDEGARD=68, HILDEGARDE=73, HILDRED=60, HILLARY=85, HILMA=43, HILTON=78, HIPOLITO=104, HIRAM=49, HIROKO=76, HISAKO=63, HOA=24, HOBERT=68, HOLLEY=77, HOLLI=56, HOLLIE=61, HOLLIS=75, HOLLY=72, HOMER=59, HONEY=67, HONG=44, HOPE=44, HORACE=50, HORACIO=69, HORTENCIA=93, HORTENSE=104, HORTENSIA=109, HOSEA=48, HOUSTON=112, HOWARD=69, HOYT=68, HSIU=57, HUBERT=74, HUE=34, HUEY=59, HUGH=44, HUGO=51, HUI=38, HULDA=46, HUMBERTO=102, HUNG=50, HUNTER=86, HUONG=65, HWA=32, HYACINTH=88, HYE=38, HYMAN=61, HYO=48, HYON=62, HYUN=68, IAN=24, IDA=14, IDALIA=36, IDELL=42, IDELLA=43, IESHA=42, IGNACIA=44, IGNACIO=58, IKE=25, ILA=22, ILANA=37, ILDA=26, ILEANA=42, ILEEN=45, ILENE=45, ILIANA=46, ILLA=34, ILONA=51, ILSE=45, ILUMINADA=84, IMA=23, IMELDA=44, IMOGENE=68, IN=23, INA=24, INDIA=37, INDIRA=55, INELL=52, INES=47, INEZ=54, INGA=31, INGE=35, INGEBORG=77, INGER=53, INGRID=61, INOCENCIA=73, IOLA=37, IONA=39, IONE=43, IRA=28, IRAIDA=42, IRENA=47, IRENE=51, IRINA=51, IRIS=55, IRISH=63, IRMA=41, IRMGARD=70, IRVIN=72, IRVING=79, IRWIN=73, ISA=29, ISAAC=33, ISABEL=48, ISABELL=60, ISABELLA=61, ISABELLE=65, ISADORA=67, ISAIAH=47, ISAIAS=58, ISAURA=69, ISELA=46, ISIAH=46, ISIDRA=60, ISIDRO=74, ISIS=56, ISMAEL=59, ISOBEL=62, ISRAEL=64, ISREAL=64, ISSAC=51, IVA=32, IVAN=46, IVANA=47, IVELISSE=100, IVETTE=81, IVEY=61, IVONNE=79, IVORY=89, IVY=56, IZETTA=81, IZOLA=63, JA=11, JACALYN=66, JACELYN=70, JACINDA=42, JACINTA=58, JACINTO=72, JACK=25, JACKELINE=70, JACKELYN=81, JACKI=34, JACKIE=39, JACKLYN=76, JACKQUELINE=108, JACKSON=73, JACLYN=65, JACOB=31, JACQUALINE=93, JACQUE=57, JACQUELIN=92, JACQUELINE=97, JACQUELYN=108, JACQUELYNE=113, JACQUELYNN=122, JACQUES=76, JACQUETTA=98, JACQUI=61, JACQUIE=66, JACQUILINE=101, JACQULINE=92, JACQULYN=103, JADA=16, JADE=20, JADWIGA=55, JAE=16, JAIME=38, JAIMEE=43, JAIMIE=47, JAKE=27, JALEESA=53, JALISA=52, JAMA=25, JAMAAL=38, JAMAL=37, JAMAR=43, JAME=29, JAMEE=34, JAMEL=41, JAMES=48, JAMEY=54, JAMI=33, JAMIE=38, JAMIKA=45, JAMILA=46, JAMISON=81, JAMMIE=51, JAN=25, JANA=26, JANAE=31, JANAY=51, JANE=30, JANEAN=45, JANEE=35, JANEEN=49, JANEL=42, JANELL=54, JANELLA=55, JANELLE=59, JANENE=49, JANESSA=69, JANET=50, JANETH=58, JANETT=70, JANETTA=71, JANETTE=75, JANEY=55, JANI=34, JANICE=42, JANIE=39, JANIECE=47, JANINA=49, JANINE=53, JANIS=53, JANISE=58, JANITA=55, JANN=39, JANNA=40, JANNET=64, JANNETTE=89, JANNIE=53, JANUARY=90, JANYCE=58, JAQUELINE=94, JAQUELYN=105, JARED=38, JAROD=48, JARRED=56, JARRETT=92, JARROD=66, JARVIS=79, JASMIN=66, JASMINE=71, JASON=59, JASPER=69, JAUNITA=76, JAVIER=65, JAY=36, JAYE=41, JAYME=54, JAYMIE=63, JAYNA=51, JAYNE=55, JAYSON=84, JAZMIN=73, JAZMINE=78, JC=13, JEAN=30, JEANA=31, JEANE=35, JEANELLE=64, JEANENE=54, JEANETT=75, JEANETTA=76, JEANETTE=80, JEANICE=47, JEANIE=44, JEANINE=58, JEANMARIE=76, JEANNA=45, JEANNE=49, JEANNETTA=90, JEANNETTE=94, JEANNIE=58, JEANNINE=72, JED=19, JEFF=27, JEFFEREY=80, JEFFERSON=98, JEFFERY=75, JEFFIE=41, JEFFREY=75, JEFFRY=70, JEN=29, JENA=30, JENAE=35, JENE=34, JENEE=39, JENELL=58, JENELLE=63, JENETTE=79, JENEVA=57, JENI=38, JENICE=46, JENIFER=67, JENIFFER=73, JENINE=57, JENISE=62, JENNA=44, JENNEFER=77, JENNELL=72, JENNETTE=93, JENNI=52, JENNIE=57, JENNIFER=81, JENNIFFER=87, JENNINE=71, JENNY=68, JERALD=50, JERALDINE=78, JERAMY=72, JERE=38, JEREMIAH=69, JEREMY=76, JERI=42, JERICA=46, JERILYN=93, JERLENE=69, JERMAINE=75, JEROLD=64, JEROME=66, JEROMY=86, JERRELL=80, JERRI=60, JERRICA=64, JERRIE=65, JERROD=70, JERROLD=82, JERRY=76, JESENIA=63, JESICA=47, JESS=53, JESSE=58, JESSENIA=82, JESSI=62, JESSIA=63, JESSICA=66, JESSIE=67, JESSIKA=74, JESTINE=82, JESUS=74, JESUSA=75, JESUSITA=104, JETTA=56, JETTIE=69, JEWEL=55, JEWELL=67, JI=19, JILL=43, JILLIAN=67, JIM=32, JIMMIE=59, JIMMY=70, JIN=33, JINA=34, JINNY=72, JO=25, JOAN=40, JOANA=41, JOANE=45, JOANIE=54, JOANN=54, JOANNA=55, JOANNE=59, JOANNIE=68, JOAQUIN=87, JOAQUINA=88, JOCELYN=84, JODEE=39, JODI=38, JODIE=43, JODY=54, JOE=30, JOEANN=59, JOEL=42, JOELLA=55, JOELLE=59, JOELLEN=73, JOESPH=73, JOETTA=71, JOETTE=75, JOEY=55, JOHANA=49, JOHANNA=63, JOHANNE=67, JOHN=47, JOHNA=48, JOHNATHAN=91, JOHNATHON=105, JOHNETTA=93, JOHNETTE=97, JOHNIE=61, JOHNNA=62, JOHNNIE=75, JOHNNY=86, JOHNSIE=80, JOHNSON=95, JOI=34, JOIE=39, JOLANDA=57, JOLEEN=61, JOLENE=61, JOLIE=51, JOLINE=65, JOLYN=76, JOLYNN=90, JON=39, JONA=40, JONAH=48, JONAS=59, JONATHAN=83, JONATHON=97, JONE=44, JONELL=68, JONELLE=73, JONG=46, JONI=48, JONIE=53, JONNA=54, JONNIE=67, JORDAN=62, JORDON=76, JORGE=55, JOSE=49, JOSEF=55, JOSEFA=56, JOSEFINA=79, JOSEFINE=83, JOSELYN=100, JOSEPH=73, JOSEPHINA=97, JOSEPHINE=101, JOSETTE=94, JOSH=52, JOSHUA=74, JOSIAH=62, JOSIE=58, JOSLYN=95, JOSPEH=73, JOSPHINE=96, JOSUE=70, JOVAN=62, JOVITA=77, JOY=50, JOYA=51, JOYCE=58, JOYCELYN=109, JOYE=55, JUAN=46, JUANA=47, JUANITA=76, JUDE=40, JUDI=44, JUDIE=49, JUDITH=72, JUDSON=83, JUDY=60, JULE=48, JULEE=53, JULENE=67, JULES=67, JULI=52, JULIA=53, JULIAN=67, JULIANA=68, JULIANE=72, JULIANN=81, JULIANNA=82, JULIANNE=86, JULIE=57, JULIEANN=86, JULIENNE=90, JULIET=77, JULIETA=78, JULIETTA=98, JULIETTE=102, JULIO=67, JULISSA=91, JULIUS=92, JUNE=50, JUNG=52, JUNIE=59, JUNIOR=87, JUNITA=75, JUNKO=71, JUSTA=71, JUSTIN=93, JUSTINA=94, JUSTINE=98, JUTTA=72, KA=12, KACEY=45, KACI=24, KACIE=29, KACY=40, KAI=21, KAILA=34, KAITLIN=76, KAITLYN=92, KALA=25, KALEIGH=53, KALEY=54, KALI=33, KALLIE=50, KALYN=63, KAM=25, KAMALA=39, KAMI=34, KAMILAH=55, KANDACE=39, KANDI=39, KANDICE=47, KANDIS=58, KANDRA=49, KANDY=55, KANESHA=59, KANISHA=63, KARA=31, KARAN=45, KAREEM=53, KAREEN=54, KAREN=49, KARENA=50, KAREY=60, KARI=39, KARIE=44, KARIMA=53, KARIN=53, KARINA=54, KARINE=58, KARISA=59, KARISSA=78, KARL=42, KARLA=43, KARLEEN=66, KARLENE=66, KARLY=67, KARLYN=81, KARMA=44, KARMEN=62, KAROL=57, KAROLE=62, KAROLINE=85, KAROLYN=96, KARON=59, KARREN=67, KARRI=57, KARRIE=62, KARRY=73, KARY=55, KARYL=67, KARYN=69, KASANDRA=69, KASEY=61, KASHA=40, KASI=40, KASIE=45, KASSANDRA=88, KASSIE=64, KATE=37, KATELIN=72, KATELYN=88, KATELYNN=102, KATERINE=83, KATHALEEN=77, KATHARINA=83, KATHARINE=87, KATHARYN=98, KATHE=45, KATHELEEN=81, KATHERIN=86, KATHERINA=87, KATHERINE=91, KATHERN=77, KATHERYN=102, KATHEY=70, KATHI=49, KATHIE=54, KATHLEEN=76, KATHLENE=76, KATHLINE=80, KATHLYN=91, KATHRIN=81, KATHRINE=86, KATHRYN=97, KATHRYNE=102, KATHY=65, KATHYRN=97, KATI=41, KATIA=42, KATIE=46, KATINA=56, KATLYN=83, KATRICE=67, KATRINA=74, KATTIE=66, KATY=57, KAY=37, KAYCE=45, KAYCEE=50, KAYE=42, KAYLA=50, KAYLEE=59, KAYLEEN=73, KAYLEIGH=78, KAYLENE=73, KAZUKO=85, KECIA=29, KEELEY=63, KEELY=58, KEENA=36, KEENAN=50, KEESHA=49, KEIKO=51, KEILA=38, KEIRA=44, KEISHA=53, KEITH=53, KEITHA=54, KELI=37, KELLE=45, KELLEE=50, KELLEY=70, KELLI=49, KELLIE=54, KELLY=65, KELLYE=70, KELSEY=77, KELSI=56, KELSIE=61, KELVIN=73, KEMBERLY=91, KEN=30, KENA=31, KENDA=35, KENDAL=47, KENDALL=59, KENDRA=53, KENDRICK=75, KENETH=63, KENIA=40, KENISHA=67, KENNA=45, KENNETH=77, KENNITH=81, KENNY=69, KENT=50, KENTON=79, KENYA=56, KENYATTA=97, KENYETTA=101, KERA=35, KEREN=53, KERI=43, KERMIT=76, KERRI=61, KERRIE=66, KERRY=77, KERSTIN=96, KESHA=44, KESHIA=53, KETURAH=84, KEVA=39, KEVEN=57, KEVIN=61, KHADIJAH=52, KHALILAH=62, KIA=21, KIANA=36, KIARA=40, KIERA=44, KIERSTEN=101, KIESHA=53, KIETH=53, KILEY=62, KIM=33, KIMBER=58, KIMBERELY=100, KIMBERLEE=80, KIMBERLEY=100, KIMBERLI=79, KIMBERLIE=84, KIMBERLY=95, KIMBERY=83, KIMBRA=54, KIMI=42, KIMIKO=68, KINA=35, KINDRA=57, KING=41, KIP=36, KIRA=39, KIRBY=65, KIRK=49, KIRSTEN=96, KIRSTIE=91, KIRSTIN=100, KISHA=48, KIT=40, KITTIE=74, KITTY=85, KIYOKO=86, KIZZIE=86, KIZZY=97, KLARA=43, KOREY=74, KORI=53, KORTNEY=108, KORY=69, KOURTNEY=129, KRAIG=46, KRIS=57, KRISHNA=80, KRISSY=101, KRISTA=78, KRISTAL=90, KRISTAN=92, KRISTEEN=101, KRISTEL=94, KRISTEN=96, KRISTI=86, KRISTIAN=101, KRISTIE=91, KRISTIN=100, KRISTINA=101, KRISTINE=105, KRISTLE=94, KRISTOFER=121, KRISTOPHER=139, KRISTY=102, KRISTYN=116, KRYSTA=94, KRYSTAL=106, KRYSTEN=112, KRYSTIN=116, KRYSTINA=117, KRYSTLE=110, KRYSTYNA=133, KUM=45, KURT=70, KURTIS=98, KYLA=49, KYLE=53, KYLEE=58, KYLIE=62, KYM=49, KYMBERLY=111, KYOKO=77, KYONG=72, KYRA=55, KYUNG=78, LACEY=46, LACHELLE=58, LACI=25, LACIE=30, LACRESHA=67, LACY=41, LADAWN=55, LADONNA=61, LADY=42, LAEL=30, LAHOMA=50, LAI=22, LAILA=35, LAINE=41, LAJUANA=60, LAKEESHA=62, LAKEISHA=66, LAKENDRA=66, LAKENYA=69, LAKESHA=57, LAKESHIA=66, LAKIA=34, LAKIESHA=66, LAKISHA=61, LAKITA=54, LALA=26, LAMAR=45, LAMONICA=68, LAMONT=75, LAN=27, LANA=28, LANCE=35, LANDON=60, LANE=32, LANELL=56, LANELLE=61, LANETTE=77, LANG=34, LANI=36, LANIE=41, LANITA=57, LANNIE=55, LANNY=66, LANORA=61, LAQUANDA=71, LAQUITA=81, LARA=32, LARAE=37, LARAINE=60, LAREE=41, LARHONDA=73, LARISA=60, LARISSA=79, LARITA=61, LARONDA=65, LARRAINE=78, LARRY=74, LARUE=57, LASANDRA=70, LASHANDA=60, LASHANDRA=78, LASHAUN=76, LASHAUNDA=81, LASHAWN=78, LASHAWNA=79, LASHAWNDA=83, LASHAY=66, LASHELL=69, LASHON=69, LASHONDA=74, LASHUNDA=80, LASONYA=87, LATANYA=74, LATARSHA=80, LATASHA=62, LATASHIA=71, LATESHA=66, LATIA=43, LATICIA=55, LATINA=57, LATISHA=70, LATONIA=72, LATONYA=88, LATORIA=76, LATOSHA=76, LATOYA=74, LATOYIA=83, LATRICE=68, LATRICIA=73, LATRINA=75, LATRISHA=88, LAUNA=49, LAURA=53, LAURALEE=75, LAURAN=67, LAURE=57, LAUREEN=76, LAUREL=69, LAUREN=71, LAURENA=72, LAURENCE=79, LAURENE=76, LAURETTA=98, LAURETTE=102, LAURI=61, LAURICE=69, LAURIE=66, LAURINDA=80, LAURINE=80, LAURYN=91, LAVADA=41, LAVELLE=69, LAVENIA=64, LAVERA=59, LAVERN=72, LAVERNA=73, LAVERNE=77, LAVETA=61, LAVETTE=85, LAVINA=59, LAVINIA=68, LAVON=64, LAVONA=65, LAVONDA=69, LAVONE=69, LAVONIA=74, LAVONNA=79, LAVONNE=83, LAWANA=52, LAWANDA=56, LAWANNA=66, LAWERENCE=86, LAWRENCE=81, LAYLA=51, LAYNE=57, LAZARO=73, LE=17, LEA=18, LEAH=26, LEAN=32, LEANA=33, LEANDRA=55, LEANDRO=69, LEANN=46, LEANNA=47, LEANNE=51, LEANORA=66, LEATHA=47, LEATRICE=73, LECIA=30, LEDA=22, LEE=22, LEEANN=51, LEEANNA=52, LEEANNE=56, LEENA=37, LEESA=42, LEIA=27, LEIDA=31, LEIF=32, LEIGH=41, LEIGHA=42, LEIGHANN=70, LEILA=39, LEILANI=62, LEISA=46, LEISHA=54, LEKISHA=65, LELA=30, LELAH=38, LELAND=48, LELIA=39, LEMUEL=68, LEN=31, LENA=32, LENARD=54, LENITA=61, LENNA=46, LENNIE=59, LENNY=70, LENORA=65, LENORE=69, LEO=32, LEOLA=45, LEOMA=46, LEON=46, LEONA=47, LEONARD=69, LEONARDA=70, LEONARDO=84, LEONE=51, LEONEL=63, LEONIA=56, LEONIDA=60, LEONIE=60, LEONILA=68, LEONOR=79, LEONORA=80, LEONORE=84, LEONTINE=94, LEOPOLDO=94, LEORA=51, LEOTA=53, LERA=36, LEROY=75, LES=36, LESA=37, LESHA=45, LESIA=46, LESLEE=58, LESLEY=78, LESLI=57, LESLIE=62, LESSIE=69, LESTER=79, LETA=38, LETHA=46, LETICIA=59, LETISHA=74, LETITIA=76, LETTIE=71, LETTY=82, LEVI=48, LEWIS=68, LEXIE=55, LEZLIE=69, LI=21, LIA=22, LIANA=37, LIANE=41, LIANNE=55, LIBBIE=39, LIBBY=50, LIBERTY=91, LIBRADA=47, LIDA=26, LIDIA=35, LIEN=40, LIESELOTTE=122, LIGIA=38, LILA=34, LILI=42, LILIA=43, LILIAN=57, LILIANA=58, LILLA=46, LILLI=54, LILLIA=55, LILLIAM=68, LILLIAN=69, LILLIANA=70, LILLIE=59, LILLY=70, LILY=58, LIN=35, LINA=36, LINCOLN=79, LINDA=40, LINDSAY=84, LINDSEY=88, LINDSY=83, LINDY=64, LINETTE=85, LING=42, LINH=43, LINN=49, LINNEA=55, LINNIE=63, LINO=50, LINSEY=84, LINWOOD=92, LIONEL=67, LISA=41, LISABETH=76, LISANDRA=78, LISBETH=75, LISE=45, LISETTE=90, LISHA=49, LISSA=60, LISSETTE=109, LITA=42, LIVIA=53, LIZ=47, LIZA=48, LIZABETH=83, LIZBETH=82, LIZETH=80, LIZETTE=97, LIZZETTE=123, LIZZIE=87, LLOYD=68, LOAN=42, LOGAN=49, LOIDA=41, LOIS=55, LOISE=60, LOLA=40, LOLITA=69, LOMA=41, LON=41, LONA=42, LONDA=46, LONG=48, LONI=50, LONNA=56, LONNIE=69, LONNY=80, LORA=46, LORAINE=74, LORALEE=68, LORE=50, LOREAN=65, LOREE=55, LOREEN=69, LORELEI=76, LOREN=64, LORENA=65, LORENE=69, LORENZA=91, LORENZO=105, LORETA=71, LORETTA=91, LORETTE=95, LORI=54, LORIA=55, LORIANN=83, LORIE=59, LORILEE=76, LORINA=69, LORINDA=73, LORINE=73, LORIS=73, LORITA=75, LORNA=60, LORRAINE=92, LORRETTA=109, LORRI=72, LORRIANE=92, LORRIE=77, LORRINE=91, LORY=70, LOTTIE=81, LOU=48, LOUANN=77, LOUANNE=82, LOUELLA=78, LOUETTA=94, LOUIE=62, LOUIS=76, LOUISA=77, LOUISE=81, LOURA=67, LOURDES=94, LOURIE=80, LOUVENIA=99, LOVE=54, LOVELLA=79, LOVETTA=95, LOVIE=63, LOWELL=79, LOYCE=60, LOYD=56, LU=33, LUANA=49, LUANN=62, LUANNA=63, LUANNE=67, LUBA=36, LUCAS=56, LUCI=45, LUCIA=46, LUCIANA=61, LUCIANO=75, LUCIE=50, LUCIEN=64, LUCIENNE=83, LUCILA=58, LUCILE=62, LUCILLA=70, LUCILLE=74, LUCINA=60, LUCINDA=64, LUCIO=60, LUCIUS=85, LUCRECIA=72, LUCRETIA=89, LUCY=61, LUDIE=51, LUDIVINA=92, LUE=38, LUELLA=63, LUETTA=79, LUIGI=58, LUIS=61, LUISA=62, LUISE=66, LUKE=49, LULA=46, LULU=66, LUNA=48, LUPE=54, LUPITA=79, LURA=52, LURLENE=87, LURLINE=91, LUTHER=84, LUVENIA=84, LUZ=59, LYDA=42, LYDIA=51, LYLA=50, LYLE=54, LYMAN=65, LYN=51, LYNDA=56, LYNDIA=65, LYNDON=84, LYNDSAY=100, LYNDSEY=104, LYNELL=80, LYNELLE=85, LYNETTA=97, LYNETTE=101, LYNN=65, LYNNA=66, LYNNE=70, LYNNETTE=115, LYNSEY=100, LYNWOOD=108, MA=14, MABEL=33, MABELLE=50, MABLE=33, MAC=17, MACHELLE=59, MACIE=31, MACK=28, MACKENZIE=87, MACY=42, MADALENE=55, MADALINE=59, MADALYN=70, MADDIE=36, MADELAINE=64, MADELEINE=68, MADELENE=59, MADELINE=63, MADELYN=74, MADGE=30, MADIE=32, MADISON=75, MADLYN=69, MADONNA=62, MAE=19, MAEGAN=41, MAFALDA=38, MAGALI=43, MAGALY=59, MAGAN=36, MAGARET=65, MAGDA=26, MAGDALEN=57, MAGDALENA=58, MAGDALENE=62, MAGEN=40, MAGGIE=42, MAGNOLIA=72, MAHALIA=45, MAI=23, MAIA=24, MAIDA=28, MAILE=40, MAIRA=42, MAIRE=46, MAISHA=51, MAISIE=56, MAJOR=57, MAJORIE=71, MAKEDA=35, MALCOLM=69, MALCOM=57, MALENA=46, MALIA=36, MALIK=46, MALIKA=47, MALINDA=54, MALISA=55, MALISSA=74, MALKA=38, MALLIE=52, MALLORY=96, MALORIE=73, MALVINA=72, MAMIE=41, MAMMIE=54, MAN=28, MANA=29, MANDA=33, MANDI=41, MANDIE=46, MANDY=57, MANIE=42, MANUAL=62, MANUEL=66, MANUELA=67, MANY=53, MAO=29, MAPLE=47, MARA=33, MARAGARET=84, MARAGRET=83, MARANDA=52, MARC=35, MARCEL=52, MARCELA=53, MARCELENE=76, MARCELINA=76, MARCELINE=80, MARCELINO=90, MARCELL=64, MARCELLA=65, MARCELLE=69, MARCELLUS=104, MARCELO=67, MARCENE=59, MARCHELLE=77, MARCI=44, MARCIA=45, MARCIE=49, MARCO=50, MARCOS=69, MARCUS=75, MARCY=60, MARDELL=65, MAREN=51, MARG=39, MARGARET=83, MARGARETA=84, MARGARETE=88, MARGARETT=103, MARGARETTA=104, MARGARETTE=108, MARGARITA=88, MARGARITE=92, MARGARITO=102, MARGART=78, MARGE=44, MARGENE=63, MARGERET=87, MARGERT=82, MARGERY=87, MARGET=64, MARGHERITA=100, MARGIE=53, MARGIT=68, MARGO=54, MARGORIE=86, MARGOT=74, MARGRET=82, MARGRETT=102, MARGUERITA=113, MARGUERITE=117, MARGURITE=112, MARGY=64, MARHTA=61, MARI=41, MARIA=42, MARIAH=50, MARIAM=55, MARIAN=56, MARIANA=57, MARIANELA=74, MARIANN=70, MARIANNA=71, MARIANNE=75, MARIANO=71, MARIBEL=60, MARIBETH=76, MARICA=45, MARICELA=62, MARICRUZ=109, MARIE=46, MARIEL=58, MARIELA=59, MARIELLA=71, MARIELLE=75, MARIETTA=87, MARIETTE=91, MARIKO=67, MARILEE=63, MARILOU=89, MARILU=74, MARILYN=92, MARILYNN=106, MARIN=55, MARINA=56, MARINDA=60, MARINE=60, MARIO=56, MARION=70, MARIS=60, MARISA=61, MARISELA=78, MARISHA=69, MARISOL=87, MARISSA=80, MARITA=62, MARITZA=88, MARIVEL=80, MARJORIE=89, MARJORY=100, MARK=43, MARKETTA=89, MARKITA=73, MARKUS=83, MARLA=45, MARLANA=60, MARLEEN=68, MARLEN=63, MARLENA=64, MARLENE=68, MARLIN=67, MARLINE=72, MARLO=59, MARLON=73, MARLYN=83, MARLYS=88, MARNA=47, MARNI=55, MARNIE=60, MARQUERITE=127, MARQUETTA=116, MARQUIS=98, MARQUITA=100, MARQUITTA=120, MARRY=75, MARSHA=60, MARSHALL=84, MARTA=53, MARTH=60, MARTHA=61, MARTI=61, MARTIN=75, MARTINA=76, MARTINE=80, MARTY=77, MARVA=55, MARVEL=71, MARVELLA=84, MARVIN=77, MARVIS=82, MARX=56, MARY=57, MARYA=58, MARYALICE=87, MARYAM=71, MARYANN=86, MARYANNA=87, MARYANNE=91, MARYBELLE=93, MARYBETH=92, MARYELLEN=105, MARYETTA=103, MARYJANE=87, MARYJO=82, MARYLAND=88, MARYLEE=79, MARYLIN=92, MARYLN=83, MARYLOU=105, MARYLOUISE=138, MARYLYN=108, MARYLYNN=122, MARYROSE=114, MASAKO=60, MASON=62, MATHA=43, MATHEW=70, MATHILDA=68, MATHILDE=72, MATILDA=60, MATILDE=64, MATT=54, MATTHEW=90, MATTIE=68, MAUD=39, MAUDE=44, MAUDIE=53, MAURA=54, MAUREEN=77, MAURICE=70, MAURICIO=89, MAURINE=81, MAURITA=83, MAURO=68, MAVIS=64, MAX=38, MAXIE=52, MAXIMA=61, MAXIMINA=84, MAXIMO=75, MAXINE=66, MAXWELL=90, MAY=39, MAYA=40, MAYBELL=70, MAYBELLE=75, MAYE=44, MAYME=57, MAYNARD=76, MAYOLA=67, MAYRA=58, MAZIE=54, MCKENZIE=86, MCKINLEY=92, MEAGAN=41, MEAGHAN=49, MECHELLE=63, MEDA=23, MEE=23, MEG=25, MEGAN=40, MEGGAN=47, MEGHAN=48, MEGHANN=62, MEI=27, MEL=30, MELAINE=59, MELANI=54, MELANIA=55, MELANIE=59, MELANY=70, MELBA=33, MELDA=35, MELIA=40, MELIDA=44, MELINA=54, MELINDA=58, MELISA=59, MELISSA=78, MELISSIA=87, MELITA=60, MELLIE=56, MELLISA=71, MELLISSA=90, MELODEE=59, MELODI=58, MELODIE=63, MELODY=74, MELONIE=73, MELONY=84, MELVA=53, MELVIN=75, MELVINA=76, MELYNDA=74, MENDY=61, MERCEDES=72, MERCEDEZ=79, MERCY=64, MEREDITH=82, MERI=45, MERIDETH=82, MERIDITH=86, MERILYN=96, MERISSA=84, MERLE=53, MERLENE=72, MERLIN=71, MERLYN=87, MERNA=51, MERRI=63, MERRIE=68, MERRILEE=85, MERRILL=87, MERRY=79, MERTIE=70, MERVIN=81, MERYL=73, META=39, MI=22, MIA=23, MICA=26, MICAELA=44, MICAH=34, MICHA=34, MICHAEL=51, MICHAELA=52, MICHAELE=56, MICHAL=46, MICHALE=51, MICHEAL=51, MICHEL=50, MICHELE=55, MICHELINA=74, MICHELINE=78, MICHELL=62, MICHELLE=67, MICHIKO=68, MICKEY=66, MICKI=45, MICKIE=50, MIESHA=55, MIGDALIA=56, MIGNON=72, MIGUEL=67, MIGUELINA=91, MIKA=34, MIKAELA=52, MIKE=38, MIKEL=50, MIKI=42, MIKKI=53, MILA=35, MILAGRO=75, MILAGROS=94, MILAN=49, MILDA=39, MILDRED=65, MILES=58, MILFORD=77, MILISSA=82, MILLARD=69, MILLICENT=97, MILLIE=60, MILLY=71, MILO=49, MILTON=83, MIMI=44, MIN=36, MINA=37, MINDA=41, MINDI=49, MINDY=65, MINERVA=82, MING=43, MINH=44, MINNA=51, MINNIE=64, MINTA=57, MIQUEL=77, MIRA=41, MIRANDA=60, MIREILLE=83, MIRELLA=70, MIREYA=71, MIRIAM=63, MIRIAN=64, MIRNA=55, MIRTA=61, MIRTHA=69, MISHA=50, MISS=60, MISSY=85, MISTI=70, MISTIE=75, MISTY=86, MITCH=53, MITCHEL=70, MITCHELL=82, MITSUE=87, MITSUKO=108, MITTIE=76, MITZI=77, MITZIE=82, MIYOKO=88, MODESTA=77, MODESTO=91, MOHAMED=59, MOHAMMAD=68, MOHAMMED=72, MOIRA=56, MOISES=80, MOLLIE=66, MOLLY=77, MONA=43, MONET=67, MONICA=55, MONIKA=63, MONIQUE=94, MONNIE=70, MONROE=80, MONSERRATE=128, MONTE=67, MONTY=87, MOON=57, MORA=47, MORGAN=68, MORIAH=64, MORRIS=92, MORTON=95, MOSE=52, MOSES=71, MOSHE=60, MOZELL=83, MOZELLA=84, MOZELLE=88, MUI=43, MUOI=58, MURIEL=78, MURRAY=96, MY=38, MYESHA=71, MYLES=74, MYONG=74, MYRA=57, MYRIAM=79, MYRL=68, MYRLE=73, MYRNA=71, MYRON=85, MYRTA=77, MYRTICE=93, MYRTIE=90, MYRTIS=104, MYRTLE=93, MYUNG=80, NA=15, NADA=20, NADENE=43, NADIA=29, NADINE=47, NAIDA=29, NAKESHA=59, NAKIA=36, NAKISHA=63, NAKITA=56, NAM=28, NAN=29, NANA=30, NANCEE=42, NANCEY=62, NANCI=41, NANCIE=46, NANCY=57, NANETTE=79, NANNETTE=93, NANNIE=57, NAOMA=44, NAOMI=52, NAPOLEON=92, NARCISA=65, NATACHA=48, NATALIA=58, NATALIE=62, NATALYA=74, NATASHA=64, NATASHIA=73, NATHALIE=70, NATHAN=58, NATHANAEL=76, NATHANIAL=80, NATHANIEL=84, NATISHA=72, NATIVIDAD=84, NATOSHA=78, NEAL=32, NECOLE=54, NED=23, NEDA=24, NEDRA=42, NEELY=61, NEIDA=33, NEIL=40, NELDA=36, NELIA=41, NELIDA=45, NELL=43, NELLA=44, NELLE=48, NELLIE=57, NELLY=68, NELSON=79, NENA=34, NENITA=63, NEOMA=48, NEOMI=56, NEREIDA=56, NERISSA=85, NERY=62, NESTOR=91, NETA=40, NETTIE=73, NEVA=42, NEVADA=47, NEVILLE=79, NEWTON=91, NGA=22, NGAN=36, NGOC=39, NGUYET=92, NIA=24, NICHELLE=68, NICHOL=61, NICHOLAS=81, NICHOLE=66, NICHOLLE=78, NICK=37, NICKI=46, NICKIE=51, NICKOLAS=84, NICKOLE=69, NICKY=62, NICOL=53, NICOLA=54, NICOLAS=73, NICOLASA=74, NICOLE=58, NICOLETTE=103, NICOLLE=70, NIDA=28, NIDIA=37, NIESHA=56, NIEVES=74, NIGEL=47, NIKI=43, NIKIA=44, NIKITA=64, NIKKI=54, NIKOLE=66, NILA=36, NILDA=40, NILSA=55, NINA=38, NINFA=44, NISHA=51, NITA=44, NOAH=38, NOBLE=48, NOBUKO=78, NOE=34, NOEL=46, NOELIA=56, NOELLA=59, NOELLE=63, NOEMI=56, NOHEMI=64, NOLA=42, NOLAN=56, NOMA=43, NONA=44, NORA=48, NORAH=56, NORBERT=92, NORBERTO=107, NOREEN=71, NORENE=71, NORIKO=82, NORINE=75, NORMA=61, NORMAN=75, NORMAND=79, NORRIS=93, NOVA=52, NOVELLA=81, NU=35, NUBIA=47, NUMBERS=92, NYDIA=53, NYLA=52, OBDULIA=64, OCIE=32, OCTAVIA=71, OCTAVIO=85, ODA=20, ODELIA=46, ODELL=48, ODESSA=63, ODETTE=69, ODILIA=50, ODIS=47, OFELIA=48, OK=26, OLA=28, OLEN=46, OLENE=51, OLETA=53, OLEVIA=64, OLGA=35, OLIMPIA=75, OLIN=50, OLINDA=55, OLIVA=59, OLIVE=63, OLIVER=81, OLIVIA=68, OLLIE=53, OLYMPIA=91, OMA=29, OMAR=47, OMEGA=41, OMER=51, ONA=30, ONEIDA=48, ONIE=43, ONITA=59, OPAL=44, OPHELIA=66, ORA=34, ORALEE=56, ORALIA=56, OREN=52, ORETHA=67, ORLANDO=79, ORPHA=58, ORVAL=68, ORVILLE=93, OSCAR=56, OSSIE=67, OSVALDO=88, OSWALDO=89, OTELIA=62, OTHA=44, OTILIA=66, OTIS=63, OTTO=70, OUIDA=50, OWEN=57, OZELL=70, OZELLA=71, OZIE=55, PA=17, PABLO=46, PAGE=29, PAIGE=38, PALMA=43, PALMER=65, PALMIRA=70, PAM=30, PAMALA=44, PAMELA=48, PAMELIA=57, PAMELLA=60, PAMILA=52, PAMULA=64, PANDORA=69, PANSY=75, PAOLA=45, PARIS=63, PARKER=69, PARTHENIA=92, PARTICIA=77, PASQUALE=92, PASTY=81, PAT=37, PATIENCE=73, PATRIA=65, PATRICA=68, PATRICE=72, PATRICIA=77, PATRICK=78, PATRINA=79, PATSY=81, PATTI=66, PATTIE=71, PATTY=82, PAUL=50, PAULA=51, PAULENE=74, PAULETTA=96, PAULETTE=100, PAULINA=74, PAULINE=78, PAULITA=80, PAZ=43, PEARL=52, PEARLE=57, PEARLENE=76, PEARLIE=66, PEARLINE=80, PEARLY=77, PEDRO=58, PEG=28, PEGGIE=49, PEGGY=60, PEI=30, PENELOPE=88, PENNEY=79, PENNI=58, PENNIE=63, PENNY=74, PERCY=67, PERLA=52, PERRY=82, PETE=46, PETER=64, PETRA=60, PETRINA=83, PETRONILA=110, PHEBE=36, PHIL=45, PHILIP=70, PHILLIP=82, PHILLIS=85, PHILOMENA=93, PHOEBE=51, PHUNG=66, PHUONG=81, PHYLICIA=83, PHYLIS=89, PHYLISS=108, PHYLLIS=101, PIA=26, PIEDAD=39, PIERRE=71, PILAR=56, PING=46, PINKIE=64, PIPER=64, POK=42, POLLY=80, PORFIRIO=106, PORSCHE=84, PORSHA=77, PORTER=92, PORTIA=79, PRECIOUS=106, PRESTON=107, PRICILLA=80, PRINCE=65, PRINCESS=103, PRISCILA=87, PRISCILLA=99, PROVIDENCIA=116, PRUDENCE=86, PURA=56, QIANA=42, QUEEN=62, QUEENIE=76, QUENTIN=100, QUIANA=63, QUINCY=89, QUINN=75, QUINTIN=104, QUINTON=110, QUYEN=82, RACHAEL=48, RACHAL=43, RACHEAL=48, RACHEL=47, RACHELE=52, RACHELL=59, RACHELLE=64, RACQUEL=77, RAE=24, RAEANN=53, RAELENE=60, RAFAEL=43, RAFAELA=44, RAGUEL=64, RAINA=43, RAISA=48, RALEIGH=60, RALPH=55, RAMIRO=74, RAMON=61, RAMONA=62, RAMONITA=91, RANA=34, RANAE=39, RANDA=38, RANDAL=50, RANDALL=62, RANDEE=47, RANDELL=66, RANDI=46, RANDOLPH=88, RANDY=62, RANEE=43, RAPHAEL=61, RAQUEL=74, RASHAD=51, RASHEEDA=61, RASHIDA=60, RAUL=52, RAVEN=60, RAY=44, RAYE=49, RAYFORD=87, RAYLENE=80, RAYMON=86, RAYMOND=90, RAYMONDE=95, RAYMUNDO=111, RAYNA=59, REA=24, REAGAN=46, REANNA=53, REATHA=53, REBA=26, REBBECA=36, REBBECCA=39, REBECA=34, REBECCA=37, REBECKA=45, REBEKAH=50, REDA=28, REED=32, REENA=43, REFUGIA=67, REFUGIO=81, REGAN=45, REGENA=50, REGENIA=59, REGGIE=51, REGINA=54, REGINALD=70, REGINE=58, REGINIA=63, REID=36, REIKO=58, REINA=47, REINALDO=78, REITA=53, REMA=37, REMEDIOS=88, REMONA=66, RENA=38, RENAE=43, RENALDO=69, RENATA=59, RENATE=63, RENATO=73, RENAY=63, RENDA=42, RENE=42, RENEA=43, RENEE=47, RENETTA=83, RENITA=67, RENNA=52, RESSIE=75, RETA=44, RETHA=52, RETTA=64, REUBEN=65, REVA=46, REX=47, REY=48, REYES=72, REYNA=63, REYNALDA=80, REYNALDO=94, RHEA=32, RHEBA=34, RHETT=71, RHIANNON=93, RHODA=46, RHONA=56, RHONDA=60, RIA=28, RICARDA=54, RICARDO=68, RICH=38, RICHARD=61, RICHELLE=72, RICHIE=52, RICK=41, RICKEY=71, RICKI=50, RICKIE=55, RICKY=66, RICO=45, RIGOBERTO=109, RIKKI=58, RILEY=69, RIMA=41, RINA=42, RISA=47, RITA=48, RIVA=50, RIVKA=61, ROB=35, ROBBI=46, ROBBIE=51, ROBBIN=60, ROBBY=62, ROBBYN=76, ROBENA=55, ROBERT=78, ROBERTA=79, ROBERTO=93, ROBIN=58, ROBT=55, ROBYN=74, ROCCO=54, ROCHEL=61, ROCHELL=73, ROCHELLE=78, ROCIO=60, ROCKY=72, ROD=37, RODERICK=83, RODGER=67, RODNEY=81, RODOLFO=85, RODRICK=78, RODRIGO=86, ROGELIO=81, ROGER=63, ROLAND=64, ROLANDA=65, ROLANDE=69, ROLANDO=79, ROLF=51, ROLLAND=76, ROMA=47, ROMAINE=75, ROMAN=61, ROMANA=62, ROMELIA=73, ROMEO=66, ROMONA=76, RON=47, RONA=48, RONALD=64, RONDA=52, RONI=56, RONNA=62, RONNI=70, RONNIE=75, RONNY=86, ROOSEVELT=131, RORY=76, ROSA=53, ROSALBA=68, ROSALEE=75, ROSALIA=75, ROSALIE=79, ROSALINA=89, ROSALIND=92, ROSALINDA=93, ROSALINE=93, ROSALVA=88, ROSALYN=104, ROSAMARIA=95, ROSAMOND=99, ROSANA=68, ROSANN=81, ROSANNA=82, ROSANNE=86, ROSARIA=81, ROSARIO=95, ROSAURA=93, ROSCOE=75, ROSE=57, ROSEANN=86, ROSEANNA=87, ROSEANNE=91, ROSELEE=79, ROSELIA=79, ROSELINE=97, ROSELLA=82, ROSELLE=86, ROSELYN=108, ROSEMARIE=103, ROSEMARY=114, ROSENA=72, ROSENDA=76, ROSENDO=90, ROSETTA=98, ROSETTE=102, ROSIA=62, ROSIE=66, ROSINA=76, ROSIO=76, ROSITA=82, ROSLYN=103, ROSS=71, ROSSANA=87, ROSSIE=85, ROSY=77, ROWENA=76, ROXANA=73, ROXANE=77, ROXANN=86, ROXANNA=87, ROXANNE=91, ROXIE=71, ROXY=82, ROY=58, ROYAL=71, ROYCE=66, ROZANNE=93, ROZELLA=89, RUBEN=60, RUBI=50, RUBIE=55, RUBIN=64, RUBY=66, RUBYE=71, RUDOLF=76, RUDOLPH=94, RUDY=68, RUEBEN=65, RUFINA=69, RUFUS=85, RUPERT=98, RUSS=77, RUSSEL=94, RUSSELL=106, RUSTY=103, RUTH=67, RUTHA=68, RUTHANN=96, RUTHANNE=101, RUTHE=72, RUTHIE=81, RYAN=58, RYANN=72, SABINA=46, SABINE=50, SABRA=41, SABRINA=64, SACHA=32, SACHIKO=66, SADE=29, SADIE=38, SADYE=54, SAGE=32, SAL=32, SALENA=52, SALINA=56, SALLEY=74, SALLIE=58, SALLY=69, SALOME=65, SALVADOR=92, SALVATORE=113, SAM=33, SAMANTHA=77, SAMARA=53, SAMATHA=63, SAMELLA=63, SAMIRA=61, SAMMIE=60, SAMMY=71, SAMUAL=67, SAMUEL=71, SANA=35, SANDA=39, SANDEE=48, SANDI=47, SANDIE=52, SANDRA=57, SANDY=63, SANFORD=77, SANG=41, SANJUANA=81, SANJUANITA=110, SANORA=68, SANTA=55, SANTANA=70, SANTIAGO=86, SANTINA=78, SANTO=69, SANTOS=88, SARA=39, SARAH=47, SARAI=48, SARAN=53, SARI=47, SARINA=62, SARITA=68, SASHA=48, SATURNINA=117, SAU=41, SAUL=53, SAUNDRA=78, SAVANNA=72, SAVANNAH=80, SCARLET=78, SCARLETT=98, SCOT=57, SCOTT=77, SCOTTIE=91, SCOTTY=102, SEAN=39, SEASON=73, SEBASTIAN=90, SEBRINA=68, SEE=29, SEEMA=43, SELENA=56, SELENE=60, SELINA=60, SELMA=50, SENA=39, SENAIDA=53, SEPTEMBER=103, SERAFINA=73, SERENA=62, SERGIO=73, SERINA=66, SERITA=72, SETH=52, SETSUKO=110, SEYMOUR=116, SHA=28, SHAD=32, SHAE=33, SHAINA=52, SHAKIA=49, SHAKIRA=67, SHAKITA=69, SHALA=41, SHALANDA=60, SHALON=69, SHALONDA=74, SHAMEKA=58, SHAMIKA=62, SHAN=42, SHANA=43, SHANAE=48, SHANDA=47, SHANDI=55, SHANDRA=65, SHANE=47, SHANEKA=59, SHANEL=59, SHANELL=71, SHANELLE=76, SHANI=51, SHANICE=59, SHANIKA=63, SHANIQUA=90, SHANITA=72, SHANNA=57, SHANNAN=71, SHANNON=85, SHANON=71, SHANTA=63, SHANTAE=68, SHANTAY=88, SHANTE=67, SHANTEL=79, SHANTELL=91, SHANTELLE=96, SHANTI=71, SHAQUANA=82, SHAQUITA=96, SHARA=47, SHARAN=61, SHARDA=51, SHAREE=56, SHARELL=75, SHAREN=65, SHARI=55, SHARICE=63, SHARIE=60, SHARIKA=67, SHARILYN=106, SHARITA=76, SHARLA=59, SHARLEEN=82, SHARLENE=82, SHARMAINE=88, SHAROLYN=112, SHARON=75, SHARONDA=80, SHARRI=73, SHARRON=93, SHARYL=83, SHARYN=85, SHASTA=68, SHAUN=63, SHAUNA=64, SHAUNDA=68, SHAUNNA=78, SHAUNTA=84, SHAUNTE=88, SHAVON=79, SHAVONDA=84, SHAVONNE=98, SHAWANA=67, SHAWANDA=71, SHAWANNA=81, SHAWN=65, SHAWNA=66, SHAWNDA=70, SHAWNEE=75, SHAWNNA=80, SHAWNTA=86, SHAY=53, SHAYLA=66, SHAYNA=68, SHAYNE=72, SHEA=33, SHEBA=35, SHEENA=52, SHEILA=54, SHEILAH=62, SHELA=45, SHELBA=47, SHELBY=71, SHELDON=77, SHELIA=54, SHELLA=57, SHELLEY=86, SHELLI=65, SHELLIE=70, SHELLY=81, SHELTON=93, SHEMEKA=62, SHEMIKA=66, SHENA=47, SHENIKA=67, SHENITA=76, SHENNA=61, SHERA=51, SHEREE=60, SHERELL=79, SHERI=59, SHERICE=67, SHERIDAN=78, SHERIE=64, SHERIKA=71, SHERILL=83, SHERILYN=110, SHERISE=83, SHERITA=80, SHERLENE=86, SHERLEY=92, SHERLY=87, SHERLYN=101, SHERMAN=78, SHERON=79, SHERRELL=97, SHERRI=77, SHERRIE=82, SHERRIL=89, SHERRILL=101, SHERRON=97, SHERRY=93, SHERRYL=105, SHERWOOD=107, SHERY=75, SHERYL=87, SHERYLL=99, SHIELA=54, SHILA=49, SHILOH=71, SHIN=50, SHIRA=55, SHIRELY=96, SHIRL=66, SHIRLEE=76, SHIRLEEN=90, SHIRLENE=90, SHIRLEY=96, SHIRLY=91, SHIZUE=88, SHIZUKO=109, SHON=56, SHONA=57, SHONDA=61, SHONDRA=79, SHONNA=71, SHONTA=77, SHOSHANA=85, SHU=48, SHYLA=65, SIBYL=67, SID=32, SIDNEY=76, SIERRA=70, SIGNE=54, SIGRID=66, SILAS=60, SILVA=63, SILVANA=78, SILVIA=72, SIMA=42, SIMON=70, SIMONA=71, SIMONE=75, SIMONNE=89, SINA=43, SINDY=71, SIOBHAN=68, SIRENA=66, SIU=49, SIXTA=73, SKYE=60, SLYVIA=88, SO=34, SOCORRO=103, SOFIA=50, SOILA=56, SOL=46, SOLANGE=73, SOLEDAD=60, SOLOMON=103, SOMER=70, SOMMER=83, SON=48, SONA=49, SONDRA=71, SONG=55, SONIA=58, SONJA=59, SONNY=87, SONYA=74, SOO=49, SOOK=60, SOON=63, SOPHIA=68, SOPHIE=72, SORAYA=79, SPARKLE=82, SPENCER=80, SPRING=83, STACEE=53, STACEY=73, STACI=52, STACIA=53, STACIE=57, STACY=68, STAN=54, STANFORD=97, STANLEY=96, STANTON=103, STAR=58, STARLA=71, STARR=76, STASIA=69, STEFAN=65, STEFANI=74, STEFANIA=75, STEFANIE=79, STEFANY=90, STEFFANIE=85, STELLA=69, STEPANIE=89, STEPHAINE=97, STEPHAN=83, STEPHANE=88, STEPHANI=92, STEPHANIA=93, STEPHANIE=97, STEPHANY=108, STEPHEN=87, STEPHENIE=101, STEPHINE=96, STEPHNIE=96, STERLING=104, STEVE=71, STEVEN=85, STEVIE=80, STEWART=106, STORMY=110, STUART=99, SU=40, SUANNE=74, SUDIE=58, SUE=45, SUEANN=74, SUELLEN=88, SUK=51, SULEMA=71, SUMIKO=88, SUMMER=89, SUN=54, SUNDAY=84, SUNG=61, SUNNI=77, SUNNY=93, SUNSHINE=109, SUSAN=74, SUSANA=75, SUSANN=88, SUSANNA=89, SUSANNAH=97, SUSANNE=93, SUSIE=73, SUSY=84, SUZAN=81, SUZANN=95, SUZANNA=96, SUZANNE=100, SUZETTE=116, SUZI=75, SUZIE=80, SUZY=91, SVETLANA=94, SYBIL=67, SYBLE=63, SYDNEY=92, SYLVESTER=145, SYLVIA=88, SYLVIE=92, SYNTHIA=96, SYREETA=93, TA=21, TABATHA=53, TABETHA=57, TABITHA=61, TAD=25, TAI=30, TAINA=45, TAISHA=58, TAJUANA=68, TAKAKO=59, TAKISHA=69, TALIA=43, TALISHA=70, TALITHA=71, TAM=34, TAMA=35, TAMALA=48, TAMAR=53, TAMARA=54, TAMATHA=64, TAMBRA=55, TAMEIKA=60, TAMEKA=51, TAMEKIA=60, TAMELA=52, TAMERA=58, TAMESHA=67, TAMI=43, TAMICA=47, TAMIE=48, TAMIKA=55, TAMIKO=69, TAMISHA=71, TAMMARA=67, TAMMERA=71, TAMMI=56, TAMMIE=61, TAMMY=72, TAMRA=53, TANA=36, TANDRA=58, TANDY=64, TANEKA=52, TANESHA=68, TANGELA=60, TANIA=45, TANIKA=56, TANISHA=72, TANJA=46, TANNA=50, TANNER=72, TANYA=61, TARA=40, TARAH=48, TAREN=58, TARI=48, TARRA=58, TARSHA=67, TARYN=78, TASHA=49, TASHIA=58, TASHINA=72, TASIA=50, TATIANA=66, TATUM=75, TATYANA=82, TAUNYA=82, TAWANA=60, TAWANDA=64, TAWANNA=74, TAWNA=59, TAWNY=83, TAWNYA=84, TAYLOR=91, TAYNA=61, TED=29, TEDDY=58, TEENA=45, TEGAN=47, TEISHA=62, TELMA=51, TEMEKA=55, TEMIKA=59, TEMPIE=68, TEMPLE=71, TENA=40, TENESHA=72, TENISHA=76, TENNIE=67, TENNILLE=91, TEODORA=78, TEODORO=92, TEOFILA=68, TEQUILA=85, TERA=44, TEREASA=69, TERENCE=70, TERESA=68, TERESE=72, TERESIA=77, TERESITA=97, TERESSA=87, TERI=52, TERICA=56, TERINA=67, TERISA=72, TERRA=62, TERRANCE=84, TERRELL=90, TERRENCE=88, TERRESA=86, TERRI=70, TERRIE=75, TERRILYN=121, TERRY=86, TESHA=53, TESS=63, TESSA=64, TESSIE=77, THAD=33, THADDEUS=82, THALIA=51, THANH=51, THAO=44, THEA=34, THEDA=38, THELMA=59, THEO=48, THEODORA=86, THEODORE=90, THEOLA=61, THERESA=76, THERESE=80, THERESIA=85, THERESSA=95, THERON=80, THERSA=71, THI=37, THOMAS=76, THOMASENA=96, THOMASINA=100, THOMASINE=104, THORA=62, THRESA=71, THU=49, THURMAN=95, THUY=74, TIA=30, TIANA=45, TIANNA=59, TIARA=49, TIEN=48, TIERA=53, TIERRA=71, TIESHA=62, TIFANY=75, TIFFANEY=86, TIFFANI=65, TIFFANIE=70, TIFFANY=81, TIFFINY=89, TIJUANA=76, TILDA=46, TILLIE=67, TIM=42, TIMIKA=63, TIMMY=80, TIMOTHY=110, TINA=44, TINISHA=80, TINY=68, TISA=49, TISH=56, TISHA=57, TITUS=89, TOBI=46, TOBIAS=66, TOBIE=51, TOBY=62, TOCCARA=61, TOD=39, TODD=43, TOI=44, TOM=48, TOMAS=68, TOMASA=69, TOMEKA=65, TOMI=57, TOMIKA=69, TOMIKO=83, TOMMIE=75, TOMMY=86, TOMMYE=91, TOMOKO=89, TONA=50, TONDA=54, TONETTE=99, TONEY=79, TONI=58, TONIA=59, TONIE=63, TONISHA=86, TONITA=79, TONJA=60, TONY=74, TONYA=75, TORA=54, TORI=62, TORIE=67, TORRI=80, TORRIE=85, TORY=78, TOSHA=63, TOSHIA=72, TOSHIKO=97, TOVA=58, TOWANDA=78, TOYA=61, TRACEE=52, TRACEY=72, TRACI=51, TRACIE=56, TRACY=67, TRAN=53, TRANG=60, TRAVIS=89, TREASA=64, TREENA=63, TRENA=58, TRENT=77, TRENTON=106, TRESA=63, TRESSA=82, TRESSIE=95, TREVA=66, TREVOR=98, TREY=68, TRICIA=60, TRINA=62, TRINH=69, TRINIDAD=79, TRINITY=115, TRISH=74, TRISHA=75, TRISTA=87, TRISTAN=101, TROY=78, TRUDI=72, TRUDIE=77, TRUDY=88, TRULA=72, TRUMAN=87, TU=41, TUAN=56, TULA=54, TUYET=91, TWANA=59, TWANDA=63, TWANNA=73, TWILA=65, TWYLA=81, TY=45, TYESHA=78, TYISHA=82, TYLER=80, TYNISHA=96, TYRA=64, TYREE=73, TYRELL=92, TYRON=92, TYRONE=97, TYSON=93, ULA=34, ULRIKE=76, ULYSSES=120, UN=35, UNA=36, URSULA=92, USHA=49, UTE=46, VADA=28, VAL=35, VALARIE=68, VALDA=40, VALENCIA=67, VALENE=59, VALENTIN=97, VALENTINA=98, VALENTINE=102, VALERI=67, VALERIA=68, VALERIE=72, VALERY=83, VALLIE=61, VALORIE=82, VALRIE=67, VAN=37, VANCE=45, VANDA=42, VANESA=62, VANESSA=81, VANETTA=83, VANIA=47, VANITA=67, VANNA=52, VANNESA=76, VANNESSA=95, VASHTI=79, VASILIKI=92, VAUGHN=73, VEDA=32, VELDA=44, VELIA=49, VELLA=52, VELMA=53, VELVA=62, VELVET=86, VENA=42, VENESSA=85, VENETTA=87, VENICE=58, VENITA=71, VENNIE=69, VENUS=81, VEOLA=55, VERA=46, VERDA=50, VERDELL=78, VERDIE=63, VERENA=65, VERGIE=66, VERLA=58, VERLENE=81, VERLIE=71, VERLINE=85, VERN=59, VERNA=60, VERNELL=88, VERNETTA=105, VERNIA=69, VERNICE=76, VERNIE=73, VERNITA=89, VERNON=88, VERONA=75, VERONICA=87, VERONIKA=95, VERONIQUE=126, VERSIE=78, VERTIE=79, VESTA=67, VETA=48, VI=31, VICENTA=74, VICENTE=78, VICKEY=75, VICKI=54, VICKIE=59, VICKY=70, VICTOR=87, VICTORIA=97, VICTORINA=111, VIDA=36, VIKI=51, VIKKI=62, VILMA=57, VINA=46, VINCE=53, VINCENT=87, VINCENZA=94, VINCENZO=108, VINITA=75, VINNIE=73, VIOLA=59, VIOLET=83, VIOLETA=84, VIOLETTE=108, VIRGEN=75, VIRGIE=70, VIRGIL=77, VIRGILIO=101, VIRGINA=80, VIRGINIA=89, VITA=52, VITO=66, VIVA=54, VIVAN=68, VIVIAN=77, VIVIANA=78, VIVIEN=81, VIVIENNE=100, VON=51, VONCILE=80, VONDA=56, VONNIE=79, WADE=33, WAI=33, WALDO=55, WALKER=70, WALLACE=57, WALLY=73, WALTER=79, WALTON=85, WALTRAUD=100, WAN=38, WANDA=43, WANETA=64, WANETTA=84, WANITA=68, WARD=46, WARNER=79, WARREN=79, WAVA=47, WAYLON=90, WAYNE=68, WEI=37, WELDON=73, WEN=42, WENDELL=75, WENDI=55, WENDIE=60, WENDOLYN=112, WENDY=71, WENONA=72, WERNER=83, WES=47, WESLEY=89, WESTON=96, WHITLEY=102, WHITNEY=104, WILBER=69, WILBERT=89, WILBUR=85, WILBURN=99, WILDA=49, WILEY=74, WILFORD=87, WILFRED=77, WILFREDO=92, WILHELMINA=106, WILHEMINA=94, WILL=56, WILLA=57, WILLARD=79, WILLENA=76, WILLENE=80, WILLETTA=102, WILLETTE=106, WILLIA=66, WILLIAM=79, WILLIAMS=98, WILLIAN=80, WILLIE=70, WILLIEMAE=89, WILLIS=84, WILLODEAN=95, WILLOW=94, WILLY=81, WILMA=58, WILMER=80, WILSON=92, WILTON=93, WINDY=75, WINFORD=89, WINFRED=79, WINIFRED=88, WINNIE=74, WINNIFRED=102, WINONA=76, WINSTON=114, WINTER=89, WM=36, WONDA=57, WOODROW=113, WYATT=89, WYNELL=91, WYNONA=92, XAVIER=79, XENIA=53, XIAO=49, XIOMARA=81, XOCHITL=91, XUAN=60, YADIRA=58, YAEKO=57, YAEL=43, YAHAIRA=63, YAJAIRA=65, YAN=40, YANG=47, YANIRA=68, YASMIN=81, YASMINE=86, YASUKO=92, YEE=35, YELENA=62, YEN=44, YER=48, YESENIA=78, YESSENIA=97, YETTA=71, YEVETTE=102, YI=34, YING=55, YOKO=66, YOLANDA=72, YOLANDE=76, YOLANDO=86, YOLONDA=86, YON=54, YONG=61, YOSHIE=81, YOSHIKO=102, YOULANDA=93, YOUNG=82, YU=46, YUETTE=96, YUK=57, YUKI=66, YUKIKO=92, YUKO=72, YULANDA=78, YUN=60, YUNG=67, YUONNE=94, YURI=73, YURIKO=99, YVETTE=97, YVONE=81, YVONNE=95, ZACHARIAH=75, ZACHARY=82, ZACHERY=86, ZACK=41, ZACKARY=85, ZADA=32, ZAIDA=41, ZANA=42, ZANDRA=64, ZANE=46, ZELDA=48, ZELLA=56, ZELMA=57, ZENA=46, ZENAIDA=60, ZENIA=55, ZENOBIA=72, ZETTA=72, ZINA=50, ZITA=56, ZOE=46, ZOFIA=57, ZOILA=63, ZOLA=54, ZONA=56, ZONIA=65, ZORA=60, ZORAIDA=74, ZULA=60, ZULEMA=78, ZULMA=73}
* # names=5163
* sum=871198282
* </code>
* User: MOD
* Date: Nov 25, 2008
* Time: 2:55:25 PM
* @link http://projecteuler.net/index.php?section=problems&id=22
*/
public class Problem22 {
public static void main(String[] args) {
try {
InputStream is = new FileInputStream("data/names.txt");
Map<String, Integer> nameMap = readNames(is);
System.out.println(nameMap);
List<String> names = new ArrayList<String>(nameMap.keySet());
int numNames = names.size();
System.out.println("# names=" + numNames);
int sum = 0;
for (int i = 0; i < numNames; ++i) {
sum += (i + 1) * nameMap.get(names.get(i));
}
System.out.println("sum=" + sum);
} catch (IOException e) {
e.printStackTrace();
}
}
public static Map<String, Integer> readNames(InputStream is) throws IOException {
Map<String, Integer> names = new TreeMap<String, Integer>();
BufferedReader br = null;
try {
br = new BufferedReader(new InputStreamReader(is));
String line;
while ((line = br.readLine()) != null) {
line = line.trim();
String[] tokens = line.split(",");
for (int i = 0; i < tokens.length; ++i) {
String name = tokens[i].replaceAll("\"", "");
for (int j = 0; j < name.length(); ++j) {
int value = sumOfCharacterValues(name);
names.put(name, value);
}
}
}
} finally {
IOUtils.closeQuietly(is);
}
return names;
}
public static int sumOfCharacterValues(String name) {
int sum = 0;
for (int i = 0; i < name.length(); ++i) {
char c = name.charAt(i);
sum += c - 'A' + 1;
}
return sum;
}
}
| [
"duffymo@home"
] | duffymo@home |
f0b9931935d4e6fd3ee127d1e5fcb141edbd4a5b | f5d4e14d5964b2a5556c0813c06067f67a64a3ab | /src/com/creational/BuilderDesignPattern/VegBurger.java | 372c5bfcd7d3e3ab4d7c8384460999e79fc883b5 | [] | no_license | spampana/Design-Patterns | e9cda3ea1da5a55ff548ffd11036a8065c8dca38 | 09f7f7eacd710b79139498a359f65b3d0d96451e | refs/heads/master | 2021-01-15T16:53:21.769035 | 2014-11-21T12:37:41 | 2014-11-21T12:37:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 212 | java | package com.creational.BuilderDesignPattern;
public class VegBurger extends Burger {
@Override
public String name() {
return "veg Burger";
}
@Override
public float price() {
return 30.0f;
}
}
| [
"[email protected]"
] | |
e4eed36dd7dbfb969b7ece2df792150a1f67fe81 | 1cdd5f4167c0890ff2e32263211a88e26a9abc79 | /eltc/src/java/eltc/web/showBean/CityObject.java | 0305d3023e0dd6fbafbe39a58a98c5fe675ab284 | [] | no_license | sanzhar73ismailov/eltc | 714c74f160a64a68f0626a054a47c66fdf85e3a7 | 39c932311c08f64bb85936fa295cbff92e9d6516 | refs/heads/master | 2020-03-29T08:50:52.058338 | 2017-06-18T06:17:43 | 2017-06-18T06:18:00 | 94,668,434 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 325 | java | package eltc.web.showBean;
import domain.City;
import eltc.web.showBean.stringObjects.AbstractObject;
class CityObject extends AbstractObject {
public CityObject() {
}
@Override
public String getStringFromObject(Object object) {
City bean = (City) object;
return bean.getName();
}
}
| [
"[email protected]"
] | |
d0380d9c30c763bced6eb5a7e4cf2bc66ad50ce3 | bc98fcf79f4da1665120b114aae10c00778ff26d | /工具类/密码加密工具类/频率分析法加密工具,结合凯撒加密-FrequencyCipherUtil.java | b4ffc25c5327efcf1b321dbc8366a4e25875035d | [
"Apache-2.0"
] | permissive | YellowKang/Java_Manual | 42caa35c1c6e1d22a18e09b4c94217550a864098 | 7ad68aa68fb63ceb5f3ccd3f5cf9659f5954c848 | refs/heads/master | 2023-03-06T05:22:11.022780 | 2023-02-23T06:42:44 | 2023-02-23T06:42:44 | 226,649,620 | 45 | 10 | null | 2022-05-14T01:37:06 | 2019-12-08T10:26:07 | Java | UTF-8 | Java | false | false | 4,259 | java | import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
/**
* @Author BigKang
* @Date 2020/6/24 10:03 上午
* @Motto 仰天大笑撸码去, 我辈岂是蓬蒿人
* @Summarize 频率分析法加密工具,结合凯撒加密(可自定义修改)
*/
public class FrequencyCipherUtil {
/**
* 词频分析计算Key,然后进行凯撒加密
* @param s
* @return
*/
public static String encrypt(String s){
Integer key = frequencyRouting(s);
String encrypt = CaesarCipherUtil.encrypt(s, key);
return encrypt;
}
/**
* 词频分析计算Key,然后进行凯撒解密
* @param s
* @return
*/
public static String decode(String s){
Integer key = frequencyRouting(s);
String decode = CaesarCipherUtil.decode(s, key);
return decode;
}
/**
* 词频路由,返回加密Key,自定义规则进行加密
* @return
*/
private static Integer frequencyRouting(String s){
// 默认统计前3排名的词频
List<CharFrequency> charFrequencies = frequencySort(s, 3);
Integer key = 0;
Boolean flag = true;
// 计算词频规律,首先+最大值然后减去下一个,一次排列,最后乘以2
for (CharFrequency charFrequency : charFrequencies) {
if(flag){
key += charFrequency.frequency;
flag = false;
}else {
key -= charFrequency.frequency;
flag = true;
}
}
// 如果大于0则乘以2
if(key > 0){
key *= 2;
}
return key;
}
/**
* 重载词频排序,默认不统计前几
*
* @param s
* @return
*/
public static List<CharFrequency> frequencySort(String s) {
return frequencySort(s, null);
}
/**
* 重载词频排序,默认排序
*
* @param s
* @param length
* @return
*/
public static List<CharFrequency> frequencySort(String s, Integer length) {
return frequencySort(s, length, true);
}
/**
* 词频统计字符
*
* @param s 词频统计字符
* @param length 返回的词频个数(排序后,前3或者前几)
* @return
*/
public static List<CharFrequency> frequencySort(String s, Integer length, Boolean sort) {
// 初始化字符数组
char[] chars = s.toCharArray();
Map<Character, Integer> map = new TreeMap<>();
// 遍历之后放入Map,并且统计次数
for (char aChar : chars) {
Integer frequency = map.get(aChar);
if (frequency == null) {
map.put(aChar, 1);
} else {
map.put(aChar, ++frequency);
}
}
// 遍历Key放入CharFrequency集合对象
List<CharFrequency> charFrequencies = new ArrayList<>();
for (Character character : map.keySet()) {
Integer integer = map.get(character);
charFrequencies.add(new CharFrequency(character, integer));
}
if (sort != null && sort) {
// 根据frequency频率排序
charFrequencies.sort(null);
}
// 检查是否只需要统计前几位
if (length != null && charFrequencies.size() > length) {
return charFrequencies.subList(0, length);
}
return charFrequencies;
}
/**
* 字符频率
*/
public static class CharFrequency implements Comparable<CharFrequency> {
public char character;
public int frequency;
public CharFrequency(char character, int frequency) {
this.character = character;
this.frequency = frequency;
}
@Override
public int compareTo(CharFrequency o) {
return o.frequency - this.frequency;
}
}
/**
* Main测试
*
* @param args
*/
public static void main(String[] args) {
String encrypt = encrypt("Big qweqwqe");
System.out.println(encrypt);
String decode = decode(encrypt);
System.out.println(decode);
}
}
| [
"“[email protected]”"
] | |
4c50306f50ea6d0091edf0f9d6bcb324b147d203 | d4620fcf4c90e78033addda8a535bd3503478681 | /plugins/devkit/devkit-java-tests/testSrc/org/jetbrains/idea/devkit/inspections/DevkitInspectionsRegistrationCheckTest.java | eec3a1368de7b34fa1467911895be847eac40793 | [
"Apache-2.0"
] | permissive | bc-lee/intellij-community | 94e22f46d8c66f09300b990248f77162fcd4d3fd | 996d33fd17a3c434bcb361bfe47b8c12449af90e | refs/heads/master | 2023-09-01T04:12:47.035684 | 2023-07-30T19:41:22 | 2023-07-30T20:08:55 | 253,115,731 | 0 | 0 | Apache-2.0 | 2023-07-30T22:56:20 | 2020-04-04T23:07:54 | null | UTF-8 | Java | false | false | 2,536 | java | // Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.idea.devkit.inspections;
import com.intellij.codeInspection.LocalInspectionEP;
import com.intellij.testFramework.fixtures.BasePlatformTestCase;
import com.intellij.util.containers.ContainerUtil;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class DevkitInspectionsRegistrationCheckTest extends BasePlatformTestCase {
private static final List<String> DISABLED_INSPECTIONS =
List.of("PluginXmlDynamicPlugin",
"StatisticsCollectorNotRegistered",
"UseCouple",
"HighlightVisitorInternal",
"PluginXmlI18n",
"SerializableCtor");
private static final List<String> WIP_INSPECTIONS =
List.of("ExtensionClassShouldBeFinalAndNonPublic",
"ActionPresentationInstantiatedInCtor",
"CancellationCheckInLoops",
"ApplicationServiceAsStaticFinalField",
"ThreadingConcurrency",
"TokenSetInParserDefinition",
"CallingMethodShouldBeRequiresBlockingContext",
"IncorrectProcessCanceledExceptionHandling");
/**
* Validates all DevKit inspections that are disabled by default match the expected known set.
*/
public void testKnownDisabledByDefaultInspections() {
List<LocalInspectionEP> devkitInspections = ContainerUtil.filter(LocalInspectionEP.LOCAL_INSPECTION.getExtensionList(), ep -> {
return "DevKit".equals(ep.getPluginDescriptor().getPluginId().getIdString());
});
assertEquals("Mismatch in total inspections, check classpath in test run configuration (intellij.devkit.plugin)", 63,
devkitInspections.size());
List<LocalInspectionEP> disabledInspections = ContainerUtil.filter(devkitInspections, ep -> !ep.enabledByDefault);
List<String> disabledInspectionShortNames = new ArrayList<>(ContainerUtil.map(disabledInspections, ep -> ep.getShortName()));
Collections.sort(disabledInspectionShortNames);
assertContainsElements("Mismatch in known disabled inspections", disabledInspectionShortNames, DISABLED_INSPECTIONS);
List<String> allKnownDisabledInspections = new ArrayList<>(ContainerUtil.concat(DISABLED_INSPECTIONS, WIP_INSPECTIONS));
Collections.sort(allKnownDisabledInspections);
assertSameElements("Mismatch in known WIP inspections", disabledInspectionShortNames,
allKnownDisabledInspections);
}
}
| [
"[email protected]"
] | |
01039e2f4c713dd752741e09feb70847348a805e | 0866e54a2daf19091b627f3480de9c40b15f4a70 | /Programming/src/Uva12531.java | 278340a872ba315cc1cfd0bcb43b2223e1f053d3 | [] | no_license | ankhia/programming | 70250bd0a5fa2890b4fe2438c87a0cf7a3d252b2 | 18f2c4a357ddd2cc3931cf8d14c47c4ee75a2aa8 | refs/heads/master | 2021-01-24T16:10:26.659392 | 2016-03-29T02:45:37 | 2016-03-29T02:45:37 | 9,322,117 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 751 | java |
import java.io.BufferedReader;
import java.io.InputStreamReader;
/**
* @author Angie Milena Vega Leon
* @linkDeArchivo http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=3976
* @veredict Accepted
* @problemId 12531
* @problemName Hours and Minutes
* @judge http://uva.onlinejudge.org/
* @category AC
* @level easy
* @date 11/12/2012
**/
public class Uva12531 {
public static void main(String[] args) throws Throwable{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
for (String line; (line=in.readLine())!=null; ) {
int grade = Integer.parseInt(line);
if(grade%6==0)
System.out.println("Y");
else
System.out.println("N");
}
}
}
| [
"[email protected]"
] | |
4cab13a5a02acbd3753193cbf63e7c0c848418a8 | 080ad81b996b6bbd951e51a3797850c1ab13c1ad | /c2d-core/src/main/java/info/u250/c2d/utils/Mathutils.java | 9ece69bd85b13c0ce5e5de3f750b0c1ee7622062 | [
"Apache-2.0"
] | permissive | hahachiu/c2d-engine | beae94dec025fa1a9c077a67b398a0db2d8a2fde | acf7c769d6da552331f5faf2855375407e67afdb | refs/heads/master | 2022-09-30T00:07:53.628879 | 2020-06-02T07:48:10 | 2020-06-02T07:48:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 345 | java | package info.u250.c2d.utils;
import com.badlogic.gdx.math.Vector2;
public class Mathutils {
/**
* if the three points is clock wise , if not , make it to be
*/
public static boolean isClockwise(Vector2 p1, Vector2 p2, Vector2 p3) {
return ((p1.x - p3.x) * (p2.y - p3.y) - (p1.y - p3.y) * (p2.x - p3.x)) < 0;
}
}
| [
"[email protected]"
] | |
87ccc0ea5a4a74d22a41a2df429870bf2360456f | e75f4c2c8c1199da340f9cfa8b5e60afc7c8e289 | /src/main/java/com/selenium/driver/downloader/SeleniumBrowserDriverDownloader/doc/FileStorageProperties.java | a315675e050e351e2b462d2f28cd350ff94f28a6 | [] | no_license | MohitRathi244/SeleniumBrowserDriverDownloader | 05f841f465cde0af26173350ebf4ed64d6e819f4 | 2737a5fbe87c5cf0f097c0e019db5f72b275edd6 | refs/heads/master | 2020-03-31T02:08:28.637110 | 2018-10-07T15:50:55 | 2018-10-07T15:50:55 | 151,809,935 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 418 | java | package com.selenium.driver.downloader.SeleniumBrowserDriverDownloader.doc;
import org.springframework.boot.context.properties.ConfigurationProperties;
@ConfigurationProperties(prefix = "file")
public class FileStorageProperties {
private String uploadDir;
public String getUploadDir() {
return uploadDir;
}
public void setUploadDir(String uploadDir) {
this.uploadDir = uploadDir;
}
}
| [
"[email protected]"
] | |
0dafc304d94e56c9a011dcc9a600839c34a9a8ad | dd80a584130ef1a0333429ba76c1cee0eb40df73 | /cts/tools/signature-tools/test/signature/converter/util/AbstractConvertTest.java | 04935d8ebb18d72ade85573a798f67bee1ac4d37 | [
"MIT"
] | permissive | karunmatharu/Android-4.4-Pay-by-Data | 466f4e169ede13c5835424c78e8c30ce58f885c1 | fcb778e92d4aad525ef7a995660580f948d40bc9 | refs/heads/master | 2021-03-24T13:33:01.721868 | 2017-02-18T17:48:49 | 2017-02-18T17:48:49 | 81,847,777 | 0 | 2 | MIT | 2020-03-09T00:02:12 | 2017-02-13T16:47:00 | null | UTF-8 | Java | false | false | 1,357 | java | /*
* Copyright (C) 2009 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package signature.converter.util;
import java.io.IOException;
import java.util.Set;
import org.junit.Before;
import signature.converter.Visibility;
import signature.model.IApi;
public abstract class AbstractConvertTest extends AbstractTestSourceConverter {
private ITestSourceConverter converter;
/**
* Creates and returns a converter instance.
* @return a converter instance
*/
public abstract ITestSourceConverter createConverter();
@Before
public void setupConverter(){
converter = createConverter();
}
public IApi convert(Visibility visibility, Set<CompilationUnit> units) throws IOException {
return converter.convert(visibility, units);
}
}
| [
"[email protected]"
] | |
b0dddcd20d63b219586265796d570cc74ebeaece | 31a15006b1363b6b261f5028da32617c1afbc004 | /src/com/newtime/command/EmptyCommand.java | 75752fe6936b8a8ccea83feecd368dc84019affa | [
"Apache-2.0"
] | permissive | SageSphinx63920/OmeCord | 7de49c1464c6aa7961559732ca9ae5b72ca62def | 1df9aacea8eaee4c631c9f7a93a91bdfa443edcd | refs/heads/main | 2023-08-07T03:14:35.531125 | 2021-09-28T19:03:32 | 2021-09-28T19:03:32 | 369,669,379 | 1 | 0 | null | 2021-05-21T22:43:51 | 2021-05-21T22:43:50 | null | UTF-8 | Java | false | false | 2,554 | java | package com.newtime.command;
import java.awt.Color;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import com.newtime.database.LiteSQL;
import com.newtime.main.Main;
import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.entities.Member;
import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.TextChannel;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
import net.dv8tion.jda.api.hooks.ListenerAdapter;
/**
* @author SageSphinx63920
*
* Copyright (c) 2019 - 2021 by New Time Development/Sage to present. All rights reserved
*/
public class EmptyCommand extends ListenerAdapter{
@SuppressWarnings("unused")
public void onGuildMessageReceived(GuildMessageReceivedEvent event) {
if (event.getMessage().getContentRaw().startsWith(Main.prefix + "<prefix>")) {
//Angaben
TextChannel ch = event.getChannel();
Member m = event.getMember();
Guild g = event.getGuild();
Message mes = event.getMessage();
List<Color> ColorList = Arrays.asList(Color.GREEN,Color.BLUE, Color.CYAN, Color.LIGHT_GRAY, Color.MAGENTA, Color.ORANGE, Color.PINK, Color.RED, Color.WHITE, Color.YELLOW, Color.decode("#0b0064"));
Color Color_RANDOM = ColorList.get(new Random().nextInt(ColorList.size()));
String[] args = event.getMessage().getContentDisplay().split(" ");
int length = args.length;
StringBuilder strbuild = new StringBuilder();
//1 2
for(int i = 2; i < length; i++) strbuild.append(args[i] + " "); //i = anzahl von suvfix: e.ichbincool
String argsstring = strbuild.toString().trim();
ResultSet lanRS = LiteSQL.onQuery("SELECT * FROM lang WHERE userid = " + m.getIdLong());
String lan = null;
try {
if(lanRS.next()) {
lan = lanRS.getString("botLan");
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
ResultSet premiumRS = LiteSQL.onQuery("SELECT * FROM premium WHERE userid = " + m.getIdLong());
boolean premium = false;
try {
if(premiumRS.next()) {
premium = true;
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//Hier gehts los
//DONT CHANGE
premium = false;
lan = "en";
}
}
}
| [
"[email protected]"
] | |
efdc0ba7b102c84f45fbafcdfeeaade2e93c614d | 18a160b80e5d6e769da85adc0bbfe345cab375ef | /app/src/main/java/com/fzls/moiveranking/SettingsActivity.java | 742bbff0f4adadb919094b91d3c0819581e0e996 | [] | no_license | fzls/MoiveRanking | 49e32f1a98b49d389c594cea64f406dd15edefe4 | 0625596fef6ad16e06d61fa2a14c694371cc0398 | refs/heads/master | 2021-01-10T11:08:21.230954 | 2016-03-03T12:37:09 | 2016-03-03T12:37:09 | 53,048,750 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,510 | java | package com.fzls.moiveranking;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.media.Ringtone;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceFragment;
import android.preference.PreferenceManager;
import android.preference.RingtonePreference;
import android.support.v4.app.NavUtils;
import android.support.v7.app.ActionBar;
import android.text.TextUtils;
import android.view.MenuItem;
import java.util.List;
/**
* A {@link PreferenceActivity} that presents a set of application settings. On
* handset devices, settings are presented as a single list. On tablets,
* settings are split by category, with category headers shown to the left of
* the list of settings.
* <p/>
* See <a href="http://developer.android.com/design/patterns/settings.html">
* Android Design: Settings</a> for design guidelines and the <a
* href="http://developer.android.com/guide/topics/ui/settings.html">Settings
* API Guide</a> for more information on developing a Settings UI.
*/
public class SettingsActivity extends AppCompatPreferenceActivity {
/**
* A preference value change listener that updates the preference's summary
* to reflect its new value.
*/
private static Preference.OnPreferenceChangeListener sBindPreferenceSummaryToValueListener = new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object value) {
String stringValue = value.toString();
if (preference instanceof ListPreference) {
// For list preferences, look up the correct display value in
// the preference's 'entries' list.
ListPreference listPreference = (ListPreference) preference;
int index = listPreference.findIndexOfValue(stringValue);
// Set the summary to reflect the new value.
preference.setSummary(
index >= 0
? listPreference.getEntries()[index]
: null);
} else if (preference instanceof RingtonePreference) {
// For ringtone preferences, look up the correct display value
// using RingtoneManager.
if (TextUtils.isEmpty(stringValue)) {
// Empty values correspond to 'silent' (no ringtone).
preference.setSummary(R.string.pref_ringtone_silent);
} else {
Ringtone ringtone = RingtoneManager.getRingtone(
preference.getContext(), Uri.parse(stringValue));
if (ringtone == null) {
// Clear the summary if there was a lookup error.
preference.setSummary(null);
} else {
// Set the summary to reflect the new ringtone display
// name.
String name = ringtone.getTitle(preference.getContext());
preference.setSummary(name);
}
}
} else {
// For all other preferences, set the summary to the value's
// simple string representation.
preference.setSummary(stringValue);
}
return true;
}
};
/**
* Helper method to determine if the device has an extra-large screen. For
* example, 10" tablets are extra-large.
*/
private static boolean isXLargeTablet(Context context) {
return (context.getResources().getConfiguration().screenLayout
& Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
}
/**
* Binds a preference's summary to its value. More specifically, when the
* preference's value is changed, its summary (line of text below the
* preference title) is updated to reflect the value. The summary is also
* immediately updated upon calling this method. The exact display format is
* dependent on the type of preference.
*
* @see #sBindPreferenceSummaryToValueListener
*/
private static void bindPreferenceSummaryToValue(Preference preference) {
// Set the listener to watch for value changes.
preference.setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener);
// Trigger the listener immediately with the preference's
// current value.
sBindPreferenceSummaryToValueListener.onPreferenceChange(preference,
PreferenceManager
.getDefaultSharedPreferences(preference.getContext())
.getString(preference.getKey(), ""));
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setupActionBar();
}
/**
* Set up the {@link android.app.ActionBar}, if the API is available.
*/
private void setupActionBar() {
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
// Show the Up button in the action bar.
actionBar.setDisplayHomeAsUpEnabled(true);
}
}
@Override
public boolean onMenuItemSelected(int featureId, MenuItem item) {
int id = item.getItemId();
if (id == android.R.id.home) {
if (!super.onMenuItemSelected(featureId, item)) {
NavUtils.navigateUpFromSameTask(this);
}
return true;
}
return super.onMenuItemSelected(featureId, item);
}
/**
* {@inheritDoc}
*/
@Override
public boolean onIsMultiPane() {
return isXLargeTablet(this);
}
/**
* {@inheritDoc}
*/
@Override
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void onBuildHeaders(List<Header> target) {
loadHeadersFromResource(R.xml.pref_headers, target);
}
/**
* This method stops fragment injection in malicious applications.
* Make sure to deny any unknown fragments here.
*/
protected boolean isValidFragment(String fragmentName) {
return PreferenceFragment.class.getName().equals(fragmentName)
|| GeneralPreferenceFragment.class.getName().equals(fragmentName)
|| DataSyncPreferenceFragment.class.getName().equals(fragmentName)
|| NotificationPreferenceFragment.class.getName().equals(fragmentName);
}
/**
* This fragment shows general preferences only. It is used when the
* activity is showing a two-pane settings UI.
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static class GeneralPreferenceFragment extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.pref_general);
setHasOptionsMenu(true);
// Bind the summaries of EditText/List/Dialog/Ringtone preferences
// to their values. When their values change, their summaries are
// updated to reflect the new value, per the Android Design
// guidelines.
bindPreferenceSummaryToValue(findPreference("example_text"));
bindPreferenceSummaryToValue(findPreference("example_list"));
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == android.R.id.home) {
startActivity(new Intent(getActivity(), SettingsActivity.class));
return true;
}
return super.onOptionsItemSelected(item);
}
}
/**
* This fragment shows notification preferences only. It is used when the
* activity is showing a two-pane settings UI.
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static class NotificationPreferenceFragment extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.pref_notification);
setHasOptionsMenu(true);
// Bind the summaries of EditText/List/Dialog/Ringtone preferences
// to their values. When their values change, their summaries are
// updated to reflect the new value, per the Android Design
// guidelines.
bindPreferenceSummaryToValue(findPreference("notifications_new_message_ringtone"));
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == android.R.id.home) {
startActivity(new Intent(getActivity(), SettingsActivity.class));
return true;
}
return super.onOptionsItemSelected(item);
}
}
/**
* This fragment shows data and sync preferences only. It is used when the
* activity is showing a two-pane settings UI.
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static class DataSyncPreferenceFragment extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.pref_data_sync);
setHasOptionsMenu(true);
// Bind the summaries of EditText/List/Dialog/Ringtone preferences
// to their values. When their values change, their summaries are
// updated to reflect the new value, per the Android Design
// guidelines.
bindPreferenceSummaryToValue(findPreference("sync_frequency"));
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == android.R.id.home) {
startActivity(new Intent(getActivity(), SettingsActivity.class));
return true;
}
return super.onOptionsItemSelected(item);
}
}
}
| [
"[email protected]"
] | |
d1e77b77d534c7f517313f72bde77e1c21ca7a30 | 0ac3db7e3a7f1b408f5f8f34bf911b1c7e7a4289 | /src/bone/server/server/model/L1Karma.java | 223a326226bec0bef435aefaa1ed01eaf961c68a | [] | no_license | zajako/lineage-jimin | 4d56ad288d4417dca92bc824f2d1b484992702e3 | d8148ac99ad0b5530be3c22e6d7a5db80bbf2e5e | refs/heads/master | 2021-01-10T00:57:46.449401 | 2011-10-05T22:32:33 | 2011-10-05T22:32:33 | 46,512,502 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,000 | java | /*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* http://www.gnu.org/copyleft/gpl.html
*/
package bone.server.server.model;
import bone.server.server.utils.IntRange;
public class L1Karma {
private static final int[] KARMA_POINT = { 10000, 20000, 100000, 500000,
1500000, 3000000, 5000000, 10000000, 15500000 };
private static IntRange KARMA_RANGE = new IntRange(-15500000, 15500000);
private int _karma = 0;
public int get() {
return _karma;
}
public void set(int i) {
_karma = KARMA_RANGE.ensure(i);
}
public void add(int i) {
set(_karma + i);
}
public int getLevel() {
boolean isMinus = false;
int karmaLevel = 0;
int karma = get();
if (karma < 0) {
isMinus = true;
karma *= -1;
}
for (int point : KARMA_POINT) {
if (karma >= point) {
karmaLevel++;
if (karmaLevel >= 8) {
break;
}
} else {
break;
}
}
if (isMinus) {
karmaLevel *= -1;
}
return karmaLevel;
}
public int getPercent() {
int karma = get();
int karmaLevel = getLevel();
if (karmaLevel == 0) {
return 0;
}
if (karma < 0) {
karma *= -1;
karmaLevel *= -1;
}
return 100 * (karma - KARMA_POINT[karmaLevel - 1])
/ (KARMA_POINT[karmaLevel] - KARMA_POINT[karmaLevel - 1]);
}
}
| [
"[email protected]"
] | |
2f80fedc9507ed96f15dea83040ad8f0e7cd8375 | f91b07bef43cdfd7e02889c7ce44992f19ab4a4b | /ssm_project/ssm_itheima_web/src/main/java/com/itheima/controller/UserController.java | 96412c96fd4ebb7990ca4aff069652e7dfedcb47 | [] | no_license | ido0524/ssm-projrct | 3f615340dca7c0f582eb2da7fdb5f5a368eedb91 | f004f53343503b718fb872fb2186dc1bff3316aa | refs/heads/master | 2020-04-13T23:09:53.315433 | 2018-12-29T10:22:09 | 2018-12-29T10:22:44 | 163,498,907 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,169 | java | package com.itheima.controller;
import com.github.pagehelper.PageInfo;
import com.itheima.domain.Orders;
import com.itheima.domain.Product;
import com.itheima.domain.Roles;
import com.itheima.domain.UserInfo;
import com.itheima.service.RolesService;
import com.itheima.service.UserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
* @author [email protected]
* @date 2018/12/27
*/
@Controller
@RequestMapping("/user")
public class UserController {
@Autowired
private UserInfoService userInfoService;
@Autowired
private RolesService rolesService;
//注入加密对象
@Autowired
private PasswordEncoder passwordEncoder;
@RequestMapping("/findAll")
public String findAll(@RequestParam(required = true,defaultValue = "1") Integer pageNum, @RequestParam(required = true,defaultValue = "2") Integer pageSize, Model model) throws Exception {
List<UserInfo> userList=userInfoService.findAll(pageNum,pageSize);
PageInfo info= new PageInfo(userList);
model.addAttribute("userList",info);
return "user-list";
}
//保存
@RequestMapping("/saveUser")
public String saveUser(UserInfo userInfo) throws Exception{
//获取数据库明文密码加密
String encode = passwordEncoder.encode(userInfo.getPassword());
userInfo.setPassword(encode);
userInfoService.saveUser(userInfo);
return "redirect:findAll";
}
//详情
@RequestMapping("/findById")
public String findById(String id,Model model) throws Exception {
UserInfo userInfo= userInfoService.findById(id);
model.addAttribute("user",userInfo);
return "user-show";
}
//修改
@RequestMapping("/findUserById")
public String findUserById(String id,Model model) throws Exception {
UserInfo userInfo= userInfoService.findById(id);
model.addAttribute("user",userInfo);
return "user-update";
}
@RequestMapping("/updateUser")
public String updateProduct(UserInfo userInfo,Integer flag) throws Exception {
//修改密码之后密码加密
if(flag==1){
String encodePwd = passwordEncoder.encode(userInfo.getPassword());
userInfo.setPassword(encodePwd);
}
userInfoService.updateUser(userInfo);
return "redirect:findAll";
}
@RequestMapping("/findRoles")
public String findRoles(String id,Model model) throws Exception{
List<Roles> roles = rolesService.findAll();//flag=null;
List<Roles> userRoles = rolesService.findByUserId(id);
for (Roles role : roles) {
for (Roles userRole : userRoles) {
//如果roleID=userRoleId
if (role.getId().equals(userRole.getId())){
role.setFlag(1);
}
}
}
model.addAttribute("roleList",roles);
return "user-role-add";
}
}
| [
"[email protected]"
] | |
099e0e4b2914c5b6b1bd3b9ff244f41663cd6d8e | da5cc9c328e9d4c8f1a63190b0d2862fe7366e08 | /src/main/java/com/otr/mq/service/PacketService.java | 741ac302b5907ab4d80fc118cda316ef5095efab | [] | no_license | sirvaulterscoff/mq-demo | 7869c3cf18cfea96369551994480c60c13e89754 | f6f310503b8f6849df8d46bc5c35f24379373470 | refs/heads/master | 2020-03-30T17:06:23.083021 | 2015-02-28T14:52:41 | 2015-02-28T14:52:41 | 31,465,334 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 385 | java | package com.otr.mq.service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.UUID;
/**
* TODO: comment
* @author pobedenniy.alexey
* @since 28.02.2015
*/
public interface PacketService {
@Transactional(propagation = Propagation.REQUIRES_NEW)
void storeNewPacket(String value);
}
| [
"[email protected]"
] | |
6cf8a79b58758b7f42457f9b518d05c821b47ed8 | 4447593586ef3a58b7feb0355d9ffee71887110c | /CFG Analysis/src/ui/SelectFilePanel.java | a121bb7c56c1726cc7bbafeb7d0bb24840651aae | [] | no_license | wsgan001/CFG-Analysis | 74055fbd232500f30c890d8d24b2526c72c748e5 | dd41aed0e167f75e8e62a49f9c4f3c728fdde3cb | refs/heads/master | 2020-04-07T00:32:27.525872 | 2015-11-19T20:27:10 | 2015-11-19T20:27:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,374 | java | package ui;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.filechooser.FileNameExtensionFilter;
public class SelectFilePanel extends SelectPanel {
private static final long serialVersionUID = -1827134053709772044L;
protected FileType _fileType;
// constructor
public SelectFilePanel(String lblSelectFileText, FileType fileType, UIFrame frame) {
super(lblSelectFileText, UIConstants.NO_FILE_SELECTED, frame);
_fileType = fileType;
}
// Adds the ActionListener to the open button.
// Will require them to select a file of type _fileType.
@Override
protected void addButtonActionListener(JButton btnOpenButton) {
btnOpenButton.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
File selectedFile = null;
try {
JFileChooser jfc = new JFileChooser();
switch(_fileType){
case GraphML:
jfc.addChoosableFileFilter(new FileNameExtensionFilter("GraphML File","graphml"));
break;
case Code:
jfc.addChoosableFileFilter(new FileNameExtensionFilter("Java file","java"));
jfc.addChoosableFileFilter(new FileNameExtensionFilter("Text file","txt"));
break;
}
jfc.setAcceptAllFileFilterUsed(false); // remove "All Files" option
jfc.showOpenDialog(null);
jfc.setVisible(true);
selectedFile = new File(jfc.getSelectedFile().getPath());
} catch (Exception exc) {
_lblFileSelected.setText(UIConstants.OPEN_COMMAND_FAILED + exc.getLocalizedMessage());
}
if (selectedFile != null) {
_selectedFile = selectedFile;
_lblFileSelected.setText(">>> " + _selectedFile.getAbsolutePath());
}
_uiFrame.updateGoButtonEnabled();
}
});
}
// Does nothing since this is opening a file, not saving a file
@Override
protected void addSaveFileName() {
// Do nothing
}
@Override
public Boolean hasFileSelected(){
return super.hasFileSelected()
&& !_lblFileSelected.getText().equals(UIConstants.NO_FILE_SELECTED);
}
}
| [
"[email protected]"
] | |
3b0793e4796de061ee8e15090fb54cabf304bae5 | f5c55cf3079e0a8ca2aa7983e691a506bb60fd0b | /app/src/main/java/com/example/myportfolio/cv/CVAdapter.java | 8da5f63220639cf2b71d481849d3ca3240152ebd | [] | no_license | rajs25/My-Portfolio | 6702de4e764c5126e7fb4e7dd01dc19e65a8072c | 51dcc2cc3de900d53ff6e92815523404592a45a1 | refs/heads/main | 2023-01-09T13:49:38.729790 | 2020-11-05T10:43:21 | 2020-11-05T10:43:21 | 310,005,737 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,488 | java | package com.example.myportfolio.cv;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.example.myportfolio.R;
import java.util.List;
public class CVAdapter extends RecyclerView.Adapter<CVAdapter.CVViewHolder> {
List<CVItem> mdata;
public CVAdapter(List<CVItem> mdata) {
this.mdata = mdata;
}
@NonNull
@Override
public CVViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.item_cv,parent,false);
return new CVViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull CVViewHolder holder, int position) {
holder.tvTitle.setText(mdata.get(position).getTitle());
holder.tvDescription.setText(mdata.get(position).getDescription());
}
@Override
public int getItemCount() {
return mdata.size();
}
public class CVViewHolder extends RecyclerView.ViewHolder {
TextView tvTitle,tvDescription;
public CVViewHolder(@NonNull View itemView) {
super(itemView);
tvTitle = itemView.findViewById(R.id.item_cv_title);
tvDescription = itemView.findViewById(R.id.item_cv_desc);
}
}
} | [
"[email protected]"
] | |
49ee245806f3ab61fc8b0c44441c11cb6c2ae672 | cd3d7bc9de5567c154ab61ab2e22b1c73dd27ae1 | /2019_12_18_SegmentsAndPoints/src/main/java/SegmentsAndPoints.java | 9f4d26073ecd7a7ff1b6109ca8fdf077dcc345b8 | [] | no_license | SkybaEvgen/Java-Tasks | 808e3fd423ca0678fab409b9f3d3dd0f42d51cd4 | 51eb48ce0e0cca16aa15d56ee18e972e17390f36 | refs/heads/master | 2020-09-14T00:51:54.875065 | 2020-02-26T14:08:12 | 2020-02-26T14:08:12 | 222,958,306 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,396 | java | /*Даны отрезки и точки на числовой прямой.
Найти для каждой точки количество отрезков,
которые её покрывают.
*/
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class SegmentsAndPoints {
public List<Integer> findTheNumberOfSegmentsForEachPoint (List<Segment> segments, List<Double> points) {
int qtySegments = 0;
List<Integer> result = new ArrayList<>();
List<Point> listPoints = new ArrayList<>();
for (Double pointValue : points) {
Point point = new Point(0, pointValue);
listPoints.add(point);
}
for (Segment segmentValue : segments) {
Point pointLeft = new Point(1, segmentValue.getLeft());
Point pointRight = new Point(2, segmentValue.getRight());
listPoints.add(pointLeft);
listPoints.add(pointRight);
}
Collections.sort(listPoints);
for (Point listPointValue : listPoints) {
if (listPointValue.getKind() == 0) {
result.add(qtySegments);
}
if (listPointValue.getKind() == 1) {
qtySegments++;
}
if (listPointValue.getKind() == 2) {
qtySegments--;
}
}
return result;
}
}
| [
"[email protected]"
] | |
96157b3815b42cabb6616333c7e71064c0fdfad3 | 6f06a003f332c9b01068b9512373f42890ff47d4 | /app/src/main/java/com/mandiriecash/ecashtoll/services/models/Toll.java | 8a1d2b17da1500cd6fdf17700577633f0279e9ca | [] | no_license | hermes-mandirihackathon/ecash-toll | edbaaed9cb00952559b66f5941ee213ec98d7943 | 5565f5ee8aff3d9c15ebd5ea599df7982e84eb60 | refs/heads/master | 2020-04-11T00:12:02.418206 | 2016-02-27T00:35:56 | 2016-02-27T00:35:56 | 50,222,019 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 384 | java | package com.mandiriecash.ecashtoll.services.models;
public class Toll {
private int id;
private String name;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| [
"[email protected]"
] | |
8ab75ce6df193c9155053e0833bcf245b98e1a56 | dc6b2411ed752e08e61cddb466f64181aba8a6e7 | /app/src/main/java/com/zjw/dr/util/FileCacheUtils.java | a0c66b063c7b6c19d22fbb4e76d8bd0488db4b9e | [] | no_license | zhujinwie/Dr | 33611991ede7f05f0715b2da9395f89ee95fb3d6 | 34a9e9ca89cb97630f093d9c74b2b352203d69a6 | refs/heads/master | 2021-01-25T11:28:07.410896 | 2018-03-01T07:58:09 | 2018-03-01T07:58:09 | 123,399,344 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,801 | java | package com.zjw.dr.util;
import android.content.Context;
import android.os.Environment;
import java.io.File;
import java.math.BigDecimal;
public class FileCacheUtils {
public static String getTotalCacheSize(Context context) {
try {
long cacheSize = getFolderSize(context.getApplicationContext().getCacheDir());
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED))
cacheSize += getFolderSize(context.getApplicationContext().getExternalCacheDir());
return getFormatSize(cacheSize);
} catch (Exception e) {
e.printStackTrace();
return "";
}
}
public static void clearAllCache(Context context) {
deleteDir(context.getCacheDir());
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED))
deleteDir(context.getExternalCacheDir());
}
public static boolean deleteDir(File dir) {
if (dir != null && dir.isDirectory()) {
String[] children = dir.list();
for (String aChildren : children) {
boolean success = deleteDir(new File(dir, aChildren));
if (!success) return false;
}
}
return dir.delete();
}
public static long getFolderSize(File file) throws Exception {
long size = 0;
try {
File[] fileList = file.listFiles();
for (File aFileList : fileList) {
if (aFileList.isDirectory()) size = size + getFolderSize(aFileList);
else size = size + aFileList.length();
}
} catch (Exception e) {
e.printStackTrace();
}
return size;
}
/**
* 格式化单位
*/
public static String getFormatSize(double size) {
double kiloByte = size / 1024;
if (kiloByte < 1) return "0K";
double megaByte = kiloByte / 1024;
if (megaByte < 1) {
BigDecimal result1 = new BigDecimal(Double.toString(kiloByte));
return result1.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString() + "KB";
}
double gigaByte = megaByte / 1024;
if (gigaByte < 1) {
BigDecimal result2 = new BigDecimal(Double.toString(megaByte));
return result2.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString() + "MB";
}
double teraBytes = gigaByte / 1024;
if (teraBytes < 1) {
BigDecimal result3 = new BigDecimal(Double.toString(gigaByte));
return result3.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString() + "GB";
}
BigDecimal result4 = new BigDecimal(teraBytes);
return result4.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString() + "TB";
}
} | [
"祝锦伟"
] | 祝锦伟 |
31dcd8314b97217e3ebea50993da134204f6197f | fab6e574fc28ef9592167995958b6d9e135d151d | /src/org/task1/Class1.java | 0cc5f2f63d30eb04b9b43370b214e5dda1740235 | [] | no_license | MohamedMoula/ABCD | f92ebd1d81868dc74d752e0bb1cab97aff781b8c | ff4a80c701de8fe584b1f3a66ff84acd9325f7f4 | refs/heads/master | 2023-07-26T14:04:18.338077 | 2021-09-03T10:17:04 | 2021-09-03T10:17:04 | 402,728,956 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 885 | java | package org.task1;
public class Class1 extends Abs3{
public void demo() {
System.out.println("demo");
}
public void AxisBank() {
System.out.println("zero account");
}
public void IndianBank() {
System.out.println("saving");
}
public void Kotak() {
System.out.println("fixed");
}
public void train() {
System.out.println("railways");
}
public void bus() {
System.out.println("Roadways");
}
public void car() {
System.out.println("for family");
}
public void apple() {
System.out.println("contains vitamin a");
}
public void lemon() {
System.out.println("Vitamin c");
}
public void avacado() {
System.out.println("fat");
}
public void clientId() {
System.out.println("cli id i12345");
}
public void comId() {
System.out.println("com id is 678");
}
public void empname() {
System.out.println("emp name is Billgates");
}
}
| [
"[email protected]"
] | |
6d8d0306c5a7904de4e240aecc3de20a42fc6dfc | ad77aac33615b6f0e0a90f3a9b2ce0bd6cd05ff0 | /pdfinvoices/src/main/java/br/dev/pedro/pdfinvoices/service/InvoiceService.java | ca1643f012fc75d4f8731b1d772e8582952726ba | [] | no_license | crossworth/the-confident-spring-professional | 7fe9e6ec810ce05af7198f05cea24f758c1bfde6 | 0b247b36a9e59972ebc532da339687ef414e3bd2 | refs/heads/master | 2022-11-29T20:09:32.333992 | 2020-08-12T15:09:21 | 2020-08-12T15:09:21 | 285,314,515 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,047 | java | package br.dev.pedro.pdfinvoices.service;
import br.dev.pedro.pdfinvoices.model.Invoice;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.support.GeneratedKeyHolder;
import org.springframework.jdbc.support.KeyHolder;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import java.sql.PreparedStatement;
import java.sql.Statement;
import java.util.List;
@Component
public class InvoiceService {
/**
* Older versions of spring needed Autowired annotation on the constructor
* to let the the Spring IoC know that the parameters was dependencies
* We have to use Autowired only when using multiple constructors
* to let spring knows which one to use
* <p>
* Another way of using is field injection or setter injection
*/
private final UserService userService;
private final String cdnURL;
private final JdbcTemplate jdbcTemplate;
public InvoiceService(UserService userService, JdbcTemplate jdbcTemplate, @Value("${cdn.url}") String cdnURL) {
this.userService = userService;
this.jdbcTemplate = jdbcTemplate;
this.cdnURL = cdnURL;
}
@PostConstruct
public void init() {
System.out.println("Setup something before anything...");
}
@PreDestroy
public void shutdown() {
System.out.println("Teardown something after everything...");
}
@Transactional
public List<Invoice> findAll() {
return this.jdbcTemplate.query("SELECT id, user_id, pdf_url, amount from invoices", (resultSet, i) -> {
Invoice invoice = new Invoice();
invoice.setId(resultSet.getObject("id").toString());
invoice.setPdfURL(resultSet.getString("pdf_url"));
invoice.setUserID(resultSet.getString("user_id"));
invoice.setAmount(resultSet.getInt("amount"));
return invoice;
});
}
@Transactional
public Invoice create(String userID, Integer amount) {
String generatePdfURL = this.cdnURL + "/images/default/sample.pdf";
KeyHolder keyHolder = new GeneratedKeyHolder();
this.jdbcTemplate.update(connection -> {
PreparedStatement ps = connection.prepareStatement("INSERT INTO invoices (user_id, pdf_url, amount) VALUES (?, ?, ?)",
Statement.RETURN_GENERATED_KEYS);
ps.setString(1, userID);
ps.setString(2, generatePdfURL);
ps.setInt(3, amount);
return ps;
}, keyHolder);
String uuid = !keyHolder.getKeys().isEmpty() ? keyHolder.getKeys().values().iterator().next().toString() : null;
Invoice invoice = new Invoice();
invoice.setId(uuid);
invoice.setPdfURL(generatePdfURL);
invoice.setAmount(amount);
invoice.setUserID(userID);
return invoice;
}
}
| [
"[email protected]"
] | |
268226e33a9a1a618f4e97d45e02f6a63dd7b589 | 03cb20d8ca6ade4fec4f36d1560e6cba06e56ec7 | /src/main/java/com/adobe/cq/commerce/magento/graphql/FilterEqualTypeInput.java | 40daad7565063964d9cb6cf775acf139255d4e08 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | Pushparajan/commerce-cif-magento-graphql | e178b6f5f8551aa5911347ef2b33496c93c810ef | a04d02207f0348c6d7dada19fb3d8654ca893a75 | refs/heads/master | 2023-01-09T03:37:18.873529 | 2020-11-10T14:35:21 | 2020-11-10T14:35:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,863 | java | /*******************************************************************************
*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*
******************************************************************************/
package com.adobe.cq.commerce.magento.graphql;
import java.io.Serializable;
import java.util.List;
import com.shopify.graphql.support.AbstractQuery;
import com.shopify.graphql.support.Input;
/**
* Defines a filter that matches the input exactly.
*/
public class FilterEqualTypeInput implements Serializable {
private Input<String> eq = Input.undefined();
private Input<List<String>> in = Input.undefined();
/**
* A string to filter on
*/
public String getEq() {
return eq.getValue();
}
/**
* A string to filter on
*/
public Input<String> getEqInput() {
return eq;
}
/**
* A string to filter on
*/
public FilterEqualTypeInput setEq(String eq) {
this.eq = Input.optional(eq);
return this;
}
/**
* A string to filter on
*/
public FilterEqualTypeInput setEqInput(Input<String> eq) {
if (eq == null) {
throw new IllegalArgumentException("Input can not be null");
}
this.eq = eq;
return this;
}
/**
* An array of values to filter on
*/
public List<String> getIn() {
return in.getValue();
}
/**
* An array of values to filter on
*/
public Input<List<String>> getInInput() {
return in;
}
/**
* An array of values to filter on
*/
public FilterEqualTypeInput setIn(List<String> in) {
this.in = Input.optional(in);
return this;
}
/**
* An array of values to filter on
*/
public FilterEqualTypeInput setInInput(Input<List<String>> in) {
if (in == null) {
throw new IllegalArgumentException("Input can not be null");
}
this.in = in;
return this;
}
public void appendTo(StringBuilder _queryBuilder) {
String separator = "";
_queryBuilder.append('{');
if (this.eq.isDefined()) {
_queryBuilder.append(separator);
separator = ",";
_queryBuilder.append("eq:");
if (eq.getValue() != null) {
AbstractQuery.appendQuotedString(_queryBuilder, eq.getValue().toString());
} else {
_queryBuilder.append("null");
}
}
if (this.in.isDefined()) {
_queryBuilder.append(separator);
separator = ",";
_queryBuilder.append("in:");
if (in.getValue() != null) {
_queryBuilder.append('[');
{
String listSeperator1 = "";
for (String item1 : in.getValue()) {
_queryBuilder.append(listSeperator1);
listSeperator1 = ",";
AbstractQuery.appendQuotedString(_queryBuilder, item1.toString());
}
}
_queryBuilder.append(']');
} else {
_queryBuilder.append("null");
}
}
_queryBuilder.append('}');
}
}
| [
"[email protected]"
] | |
b55b52cad155629dbee4132eaaf40794605f66bb | af1b878e3608dfb38bb6e47773c35193bddcab00 | /demo-model/src/main/java/com/ssm/framework/model/enu/common/typehandler/IsValidEnumTypeHandler.java | 166f199265c002fcddc00325646e7d49fab33fef | [] | no_license | phym/demo-web | 90bddbe30d2c63d567bb8079a58ffa187f786c3d | e77ed3383050892c435ca793daa462821d621390 | refs/heads/master | 2021-01-23T06:01:11.418336 | 2017-06-01T02:08:08 | 2017-06-01T02:08:08 | 93,006,766 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 342 | java | package com.ssm.framework.model.enu.common.typehandler;
import org.apache.ibatis.type.EnumOrdinalTypeHandler;
import com.ssm.framework.model.enu.common.IsValidEnum;
public class IsValidEnumTypeHandler extends EnumOrdinalTypeHandler<IsValidEnum> {
public IsValidEnumTypeHandler(Class<IsValidEnum> type) {
super(type);
}
}
| [
"[email protected]"
] | |
002e596d33bb6ee0b2d11def52eedcd4e03d0318 | 835c7d25565d9887f12f29c53ca0dd89543b19cc | /Indeed/DuplicateWord.java | 23e1df058798bc8fcd5ba1bd5b9ac2ba8272f68b | [] | no_license | youhaogit/code | 0421b02537c97742ca4427981e174f10d0fb67b7 | 58d3f929d57dbb575626aba289301c15d7cc7a1e | refs/heads/master | 2020-04-27T18:37:05.302620 | 2019-04-12T05:51:30 | 2019-04-12T05:51:30 | 174,297,937 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,631 | java | package Indeed;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
public class DuplicateWord {
// 问题是输入一组word,找出duplicate
// 例如输入 "abc def ghi abc",输出abc即可
public static String findDuplicate(String str) {
String[] strs = str.split(" ");
Set<String> set = new HashSet<>();
for(String s: strs) {
if(set.contains(s)) {
return s;
}
set.add(s);
}
return null;
}
// 1. “java python python java" 返回python因为走到python是先出现了duplicate
// 2. “java python python java" 返回java因为在有duplicate的单词中,java第一次出现的最早
static class Location {
int pos;
boolean repeated;
public Location(int pos) {
this.pos = pos;
this.repeated = false;
}
}
public static String earliestDuplicate(String s) {
String[] strs = s.split(" ");
Map<String, Location> map = new HashMap<>();
int idx = 1;
for(String str: strs) {
if(map.containsKey(str)) {
Location loc = map.get(str);
if(!loc.repeated) {
loc.repeated = true;
// map.put(str, loc);
}
}else {
map.put(str, new Location(idx));
}
idx++;
}
String ans = null;
int pos = Integer.MAX_VALUE;
for(Map.Entry<String, Location> entry: map.entrySet()) {
if (entry.getValue().repeated && entry.getValue().pos < pos) {
ans = entry.getKey();
pos = entry.getValue().pos;
}
}
return ans;
}
public static String earliestDuplicateII(String s) {
String[] strs = s.split(" ");
Map<String, Integer> map = new HashMap<>();
Set<String> visited = new HashSet<>();
int idx = 1;
for(String str: strs) {
if(!map.containsKey(str)) {
map.put(str, idx);
}else {
visited.add(str);
}
idx++;
}
String ans = null;
int loc = Integer.MAX_VALUE;
for(String str: visited) {
if(map.get(str) < loc) {
ans = str;
loc = map.get(str);
}
}
return ans;
}
public static void main(String[] args) {
String str = "cat dog cat";
System.out.println(earliestDuplicateII(str));
}
}
| [
"[email protected]"
] | |
70525e2b532ff13b2d2621b4a6077682368de93e | a49865d35af934874df88ccf304178d978f43e46 | /WorkTogether/app/src/main/java/jang/worktogether/Utils/PacketUtil.java | 75c06df54b503bac4d798e25e01f7ef789c8c585 | [] | no_license | iz000/WorkTogether | 4b4391801f850e05659ef3b590e32eec891a0fa9 | 796fb81dbb44fbaf61f89feeeaad5597d48609ba | refs/heads/master | 2021-01-21T22:36:03.388928 | 2017-12-13T06:19:17 | 2017-12-13T06:19:17 | 102,166,052 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 32,368 | java | package jang.worktogether.Utils;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.os.Handler;
import android.os.Looper;
import android.support.v4.app.NotificationCompat;
import android.support.v4.content.LocalBroadcastManager;
import android.util.Log;
import android.widget.Toast;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import jang.worktogether.R;
import jang.worktogether.basic.LoginActivity;
import jang.worktogether.basic.SplashActivity;
import jang.worktogether.basic.WTapplication;
import jang.worktogether.basic.basic_class.ChatRoom;
import jang.worktogether.basic.basic_class.MyGroup;
import jang.worktogether.basic.basic_class.User;
import jang.worktogether.chatting.ChattingRoomActivity;
import jang.worktogether.chatting.EnteredChattingListFragment;
import jang.worktogether.chatting.SQLIte.DBManager;
import jang.worktogether.chatting.SQLIte.FeedReaderContract;
import jang.worktogether.chatting.SocketClient;
import jang.worktogether.chatting.SocketService;
import jang.worktogether.group.ModifyProfileActivity;
import static jang.worktogether.basic.UserProfileActivity.USER_RELATION_CHECK;
import static jang.worktogether.chatting.ChattingListActivity.NEW_ENTERED;
import static jang.worktogether.chatting.ChattingListActivity.NEW_MEMBER;
import static jang.worktogether.chatting.ChattingListActivity.NEW_NOTENTERED;
import static jang.worktogether.chatting.MakeChattingActivity.CHATTING_MAKE_COMPLETED;
import static jang.worktogether.group.MainActivity.NEW_FRIEND;
import static jang.worktogether.group.MainActivity.NEW_FRIEND_REQUEST;
import static jang.worktogether.group.MainActivity.NEW_GROUP;
public class PacketUtil {
private SocketClient socketClient;
String protocol;
protected byte[] data;
protected Context context;
protected WTapplication wtApplication;
LocalBroadcastManager broadCaster;
DBManager dbManager;
SQLiteDatabase db;
private NotificationManager nm;
public PacketUtil(String protocol, byte[] data, Context context){
this.protocol = protocol;
this.data = data;
this.context = context;
wtApplication = (WTapplication)context.getApplicationContext();
broadCaster = LocalBroadcastManager.getInstance(context);
nm = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
}
public void setSocketClient(SocketClient socketClient) {
this.socketClient = socketClient;
dbManager = new DBManager(context, this.socketClient.clientID);
}
public void execute(){ // 패킷을 받았을 때 해야하는 일
switch (protocol){
case "200" : {
try {
String[] bodyStr = (new String(data, "utf-8")).split("\\|", 5);
db = dbManager.getWritableDatabase();
String group_id = bodyStr[1];
String chat_id = bodyStr[2];
ContentValues values = new ContentValues();
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_GROUP_ID, group_id);
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_CHAT_ID, chat_id);
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_CHAT_TIME, Long.parseLong(bodyStr[3]));
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_USER_ID, bodyStr[0]);
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_CHAT_CONTENT, bodyStr[4]);
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_CHAT_TYPE, "text");
if(wtApplication.getCurrentGroup() != null) {
if (wtApplication.getCurrentGroup().getId().equals(group_id)) {
if (wtApplication.getCurrentGroupEnteredChatRooms().containsKey(chat_id)) {
wtApplication.getCurrentGroupEnteredChatRooms()
.get(chat_id).setLastChat(bodyStr[4]);
wtApplication.getCurrentGroupEnteredChatRooms()
.get(chat_id).addChatCount();
broadCaster.sendBroadcast(
new Intent(EnteredChattingListFragment.CHAT_COUNT_PLUS));
}
}
}
if(wtApplication.getCurrentChatRoom() == null){
//현재 채팅방이 null이면 읽지 않음 상태로 저장
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_CHAT_READ, 0);
}
else if(wtApplication.getCurrentChatRoom().getChatRoomID().equals(chat_id)){
//현재 채팅방이 null이 아니면 읽음 상태로 저장
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_CHAT_READ, 1);
//채팅방 액티비티에 채팅 내용을 보내줌
Intent intent = new Intent(ChattingRoomActivity.CHAT_MESSAGE);
intent.putExtra(ChattingRoomActivity.CHAT_MESSAGE, bodyStr);
broadCaster.sendBroadcast(intent);
}
else{
//다른 채팅방에 온 패킷이면 읽지 않음으로 저장
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_CHAT_READ, 0);
}
db.insert(FeedReaderContract.FeedEntry.TABLE_NAME, null, values);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
finally {
if(db != null){
db.close();
}
}
break;
}
case "201" : {
try {
String[] bodyStr = (new String(data, "utf-8")).split("\\|", 8);
db = dbManager.getWritableDatabase();
String group_id = bodyStr[1];
String chat_id = bodyStr[2];
ContentValues values = new ContentValues();
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_GROUP_ID, group_id);
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_CHAT_ID, chat_id);
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_CHAT_TIME, Long.parseLong(bodyStr[6]));
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_USER_ID, bodyStr[0]);
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_CHAT_CONTENT,
bodyStr[3] + "|" + bodyStr[4] + "|" + bodyStr[5] + "|" + bodyStr[7]);
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_CHAT_TYPE, "file");
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_CHAT_READ, 0);
if(wtApplication.getCurrentGroup() != null) {
if (wtApplication.getCurrentGroup().getId().equals(group_id)) {
if (wtApplication.getCurrentGroupEnteredChatRooms().containsKey(chat_id)) {
wtApplication.getCurrentGroupEnteredChatRooms()
.get(chat_id).setLastChat(bodyStr[7]+"."+bodyStr[5]);
wtApplication.getCurrentGroupEnteredChatRooms()
.get(chat_id).addChatCount();
broadCaster.sendBroadcast(
new Intent(EnteredChattingListFragment.CHAT_COUNT_PLUS));
}
}
}
if(wtApplication.getCurrentChatRoom() == null){
//현재 채팅방이 null이면 읽지 않음 상태로 저장
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_CHAT_READ, 0);
}
else if(wtApplication.getCurrentChatRoom().getChatRoomID().equals(chat_id)){
//현재 채팅방이 null이 아니면 읽음 상태로 저장
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_CHAT_READ, 1);
//채팅방 액티비티에 채팅 내용을 보내줌
Intent intent = new Intent(ChattingRoomActivity.FILE_MESSAGE);
intent.putExtra(ChattingRoomActivity.FILE_MESSAGE, bodyStr);
broadCaster.sendBroadcast(intent);
}
else{
//다른 채팅방에 온 패킷이면 읽지 않음으로 저장
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_CHAT_READ, 0);
}
db.insert(FeedReaderContract.FeedEntry.TABLE_NAME, null, values);
}
catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
finally {
if(db != null){
db.close();
}
}
break;
}
case "202" : {
try {
String[] bodyStr = (new String(data, "utf-8")).split("\\|", 7);
db = dbManager.getWritableDatabase();
String group_id = bodyStr[1];
String chat_id = bodyStr[2];
ContentValues values = new ContentValues();
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_GROUP_ID, bodyStr[1]);
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_CHAT_ID, bodyStr[2]);
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_CHAT_TIME, Long.parseLong(bodyStr[5]));
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_USER_ID, bodyStr[0]);
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_CHAT_CONTENT,
bodyStr[3] + "|" + bodyStr[4] + "|" + bodyStr[5] + "|" + bodyStr[6]);
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_CHAT_TYPE, "image");
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_CHAT_READ, 0);
if(wtApplication.getCurrentGroup() != null) {
if (wtApplication.getCurrentGroup().getId().equals(group_id)) {
if (wtApplication.getCurrentGroupEnteredChatRooms().containsKey(chat_id)) {
wtApplication.getCurrentGroupEnteredChatRooms()
.get(chat_id).setLastChat("사진");
wtApplication.getCurrentGroupEnteredChatRooms()
.get(chat_id).addChatCount();
broadCaster.sendBroadcast(
new Intent(EnteredChattingListFragment.CHAT_COUNT_PLUS));
}
}
}
if(wtApplication.getCurrentChatRoom() == null){
//현재 채팅방이 null이면 읽지 않음 상태로 저장
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_CHAT_READ, 0);
}
else if(wtApplication.getCurrentChatRoom().getChatRoomID().equals(chat_id)){
//현재 채팅방이 null이 아니면 읽음 상태로 저장
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_CHAT_READ, 1);
//채팅방 액티비티에 채팅 내용을 보내줌
Intent intent = new Intent(ChattingRoomActivity.IMAGE_MESSAGE);
intent.putExtra(ChattingRoomActivity.IMAGE_MESSAGE, bodyStr);
broadCaster.sendBroadcast(intent);
}
else{
//다른 채팅방에 온 패킷이면 읽지 않음으로 저장
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_CHAT_READ, 0);
}
db.insert(FeedReaderContract.FeedEntry.TABLE_NAME, null, values);
}
catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
finally {
if(db != null){
db.close();
}
}
break;
}
case "206" : { // 프로필 업로드가 완료되었을 때
try {
String body = new String(data, "utf-8");
wtApplication.getMyself().setProfile(body);
broadCaster.sendBroadcast(new Intent(ModifyProfileActivity.PROFILE_UPLOADED));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
break;
}
case "221" : { // 이메일을 통해 친구 요청을 보내고 답이 왔을 때
try{
final String body = new String(data, "utf-8");
final Handler handler = new Handler(Looper.getMainLooper());
final String[] bodyStr = body.split("\\|", 4);
if(wtApplication.getMyself() != null) {
String toastMessage;
if (body.equals("101")) {
toastMessage = ErrorcodeUtil.errorMessage(body);
}
else if(body.equals("alreadyRequested")){
toastMessage = "이미 친구 요청을 보냈습니다";
}
else if(body.equals("alreadyFriend")){
toastMessage = "이미 친구입니다";
}
else {
toastMessage = bodyStr[1]+"님에게 친구 요청을 보냈습니다";
}
final String finalToastMessage = toastMessage;
handler.post(new Runnable() {
@Override
public void run() {
Toast.makeText(context, finalToastMessage, Toast.LENGTH_SHORT).show();
}
});
}
}
catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
finally {
if(db != null){
db.close();
}
}
break;
}
case "231" : { // 새로운 유저가 채팅방에 들어왔다는 패킷을 받았을 때
try {
String[] bodyStr = (new String(data, "utf-8")).split("\\|", 7);
db = dbManager.getWritableDatabase();
String group_id = bodyStr[0];
String chat_id = bodyStr[1];
Long time = Long.parseLong(bodyStr[3]);
ContentValues values = new ContentValues();
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_GROUP_ID, group_id);
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_CHAT_ID, chat_id);
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_CHAT_TIME, time);
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_USER_ID, bodyStr[2]);
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_CHAT_CONTENT, bodyStr[4]);
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_CHAT_TYPE, "enter");
if(wtApplication.getCurrentChatRoom() == null){
//현재 채팅방이 null이어도 읽음 상태로 저장. 읽지않은 메세지 수에 포함안됨.
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_CHAT_READ, 1);
}
else if(wtApplication.getCurrentChatRoom().getChatRoomID().equals(chat_id)){
//현재 채팅방이 null이 아니고 현재 채팅방에 온 패킷이면 읽음 상태로 저장
User user = new User(bodyStr[2], bodyStr[4], bodyStr[6],
bodyStr[5], User.Relation.NoRelation);
wtApplication.getCurrentChatRoom().addUser(user);
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_CHAT_READ, 1);
//채팅방 액티비티에 들어온 유저의 이름을 보내줌
Intent intent = new Intent(ChattingRoomActivity.USER_ENTER);
intent.putExtra(ChattingRoomActivity.USER_ENTER, bodyStr[4]);
broadCaster.sendBroadcast(intent);
}
else{
//다른 채팅방에 온 패킷이어도 읽음으로 저장
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_CHAT_READ, 1);
}
db.insert(FeedReaderContract.FeedEntry.TABLE_NAME, null, values);
}
catch(IOException e){
e.printStackTrace();
}
finally {
if(db != null){
db.close();
}
}
break;
}
case "232" : { // 나와의 관계를 물어본 후 받은 패킷
try {
String[] bodyStr = (new String(data, "utf-8")).split("\\|", 2);
Intent intent = new Intent(USER_RELATION_CHECK);
intent.putExtra("id", bodyStr[0]);
intent.putExtra("relation", bodyStr[1]);
broadCaster.sendBroadcast(intent);
}
catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
break;
}
case "233" : { // 채팅방에서 유저가 나갔을 때
try {
String[] bodyStr = (new String(data, "utf-8")).split("\\|", 5);
db = dbManager.getWritableDatabase();
String group_id = bodyStr[0];
String chat_id = bodyStr[1];
Long time = Long.parseLong(bodyStr[3]);
ContentValues values = new ContentValues();
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_GROUP_ID, group_id);
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_CHAT_ID, chat_id);
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_CHAT_TIME, time);
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_USER_ID, bodyStr[2]);
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_CHAT_CONTENT, bodyStr[4]);
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_CHAT_TYPE, "out");
if(wtApplication.getCurrentChatRoom() == null){
//현재 채팅방이 null이어도 읽음 상태로 저장
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_CHAT_READ, 1);
}
else if(wtApplication.getCurrentChatRoom().getChatRoomID().equals(chat_id)){
//현재 채팅방이 null이 아니고 현재 채팅방에 온 패킷이면 읽음 상태로 저장
wtApplication.getCurrentChatRoom().removeUser(bodyStr[2]);
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_CHAT_READ, 1);
//그 채팅방 액티비티로 나간 유저의 이름을 보내줌
Intent intent = new Intent(ChattingRoomActivity.USER_OUT);
intent.putExtra(ChattingRoomActivity.USER_OUT, bodyStr[4]);
broadCaster.sendBroadcast(intent);
}
else{
//다른 채팅방에 온 패킷이어도 읽음으로 저장
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_CHAT_READ, 1);
}
db.insert(FeedReaderContract.FeedEntry.TABLE_NAME, null, values);
}
catch(IOException e){
e.printStackTrace();
}
finally {
if(db != null){
db.close();
}
}
break;
}
case "241" : { // 그룹에 새로운 채팅방이 생겼을 때
try {
String[] bodyStr = (new String(data, "utf-8")).split("\\|", 5);
if(wtApplication.getCurrentGroup() != null){
if(wtApplication.getCurrentGroup().getId().equals(bodyStr[0])){
ChatRoom chatRoom = new ChatRoom(bodyStr[1], bodyStr[4]);
chatRoom.setMemberNum(Integer.parseInt(bodyStr[2]));
for(String id : bodyStr[3].split(",")){
if(id.equals(wtApplication.getMyself().getId())){
wtApplication.getCurrentGroupEnteredChatRooms().put(bodyStr[1], chatRoom);
broadCaster.sendBroadcast(new Intent(NEW_ENTERED));
Intent intent = new Intent(CHATTING_MAKE_COMPLETED);
intent.putExtra("c_id", bodyStr[1]);
broadCaster.sendBroadcast(intent);
return;
}
}
wtApplication.getCurrentGroupNotEnteredChatRooms().put(bodyStr[1], chatRoom);
broadCaster.sendBroadcast(new Intent(NEW_NOTENTERED));
}
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
break;
}
case "251" : { // 친구 요청이 들어왔을 때
try {
String[] bodyStr = (new String(data, "utf-8")).split("\\|", 4);
if(wtApplication.getFriendRequest() != null){
User user = new User(bodyStr[0], bodyStr[1], bodyStr[2], bodyStr[3], User.Relation.Requester);
wtApplication.addFriendRequest(user);
broadCaster.sendBroadcast(new Intent(NEW_FRIEND_REQUEST));
}
startNotification("251", bodyStr[1]);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
break;
}
case "253" : { // 그룹에 참가했을 때
try {
final String[] bodyStr = (new String(data, "utf-8")).split("\\|", 5);
if(wtApplication.getMyself() != null) {
MyGroup myGroup = new MyGroup(bodyStr[0], bodyStr[1], bodyStr[2], bodyStr[4]);
myGroup.setMemberCount(Integer.parseInt(bodyStr[3]));
wtApplication.getMyself().addGroup(myGroup);
broadCaster.sendBroadcast(new Intent(NEW_GROUP));
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
@Override
public void run() {
Toast.makeText(context, bodyStr[1] + " 그룹에 참가가 완료되었습니다", Toast.LENGTH_SHORT).show();
}
});
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
break;
}
case "254" : { // 친구 수락을 했을 때
try {
final String[] bodyStr = (new String(data, "utf-8")).split("\\|", 4);
if(wtApplication.getMyself() != null){
User user = new User(bodyStr[0], bodyStr[1], bodyStr[2], bodyStr[3], User.Relation.Friend);
wtApplication.getMyself().addFriend(user);
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
@Override
public void run() {
Toast.makeText(context, bodyStr[1]+"님이 친구로 추가되었습니다", Toast.LENGTH_SHORT).show();
}
});
broadCaster.sendBroadcast(new Intent(NEW_FRIEND));
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
break;
}
case "255" : { // 그룹의 기존 유저들이 새로운 그룹원이 추가되었다는 것을 알림받을 때
try {
String[] bodyStr = (new String(data, "utf-8")).split("\\|", 5);
if(wtApplication.getMyself() != null){
if(wtApplication.getMyself().getId().equals(bodyStr[1])){
return;
}
User user = new User(bodyStr[1], bodyStr[2], bodyStr[3], bodyStr[4], User.Relation.NoRelation);
if(wtApplication.getCurrentGroup().getId().equals(bodyStr[0])){
wtApplication.getCurrentGroup().addUser(user);
}
wtApplication.getMyself().getGroups().get(bodyStr[0]).addUser(user);
broadCaster.sendBroadcast(new Intent(NEW_MEMBER));
}
startNotification("255", wtApplication.getMyself().getGroups().get(bodyStr[0])
.getName(), bodyStr[2]);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
break;
}
case "256" : { // 친구 요청을 한 상대가 친구 요청을 수락했을 때 받는 패킷
try {
String[] bodyStr = (new String(data, "utf-8")).split("\\|", 4);
if(wtApplication.getMyself() != null){
User user = new User(bodyStr[0], bodyStr[1], bodyStr[2], bodyStr[3], User.Relation.Friend);
wtApplication.getMyself().addFriend(user);
broadCaster.sendBroadcast(new Intent(NEW_FRIEND));
}
startNotification("256", bodyStr[1]);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
break;
}
case "300" : {
try {
final String bodyStr = new String(data, "utf-8");
if(bodyStr.equals("friendRequestError")){
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
@Override
public void run() {
Toast.makeText(context, "이미 친구이거나 친구 요청을 보낸 상태입니다",
Toast.LENGTH_SHORT).show();
}
});
}
else if(bodyStr.equals("111")){
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
@Override
public void run() {
Toast.makeText(context, ErrorcodeUtil.errorMessage(bodyStr),
Toast.LENGTH_SHORT).show();
}
});
LogoutUtil.logout(context);
context.stopService(new Intent(context, SocketService.class));
broadCaster.sendBroadcast(new Intent(LoginActivity.RE_LOGIN_NEEDED));
}
Log.i("chat", bodyStr + " 패킷에서 에러가 발생했습니다");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
break;
}
}
}
private void startNotification(String protocol, String... contents){
NotificationCompat.Builder notiBuilder = new NotificationCompat.Builder(context);
notiBuilder.setSmallIcon(R.drawable.icon)
.setWhen(System.currentTimeMillis());
switch (protocol){
case "251" : { // 노티 누르면 main activity 세번째 탭으로
Intent intent = new Intent(context, SplashActivity.class);
intent.putExtra("noti", 251);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
notiBuilder.setTicker(contents[0] + "님이 친구 요청을 보냈습니다")
.setContentTitle(contents[0] + "님의 친구 요청")
.setAutoCancel(true)
.setContentIntent(PendingIntent.getActivity(context, 0, intent,
PendingIntent.FLAG_UPDATE_CURRENT));
nm.notify(251, notiBuilder.build());
break;
}
case "255" : { // 노티 누르면 main activity 첫번째 탭으로
Intent intent = new Intent(context, SplashActivity.class);
intent.putExtra("noti", 255);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
notiBuilder.setTicker(contents[0] + " 그룹에 " + contents[1] + "님이 참여하셨습니다")
.setContentTitle(contents[1] + "님의 "+contents[0]+" 그룹 참여")
.setAutoCancel(true)
.setContentIntent(PendingIntent.getActivity(context, 0, intent,
PendingIntent.FLAG_UPDATE_CURRENT));
nm.notify(255, notiBuilder.build());
break;
}
case "256" : { // 노티 누르면 main activity 두번째 탭으로
Intent intent = new Intent(context, SplashActivity.class);
intent.putExtra("noti", 256);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
notiBuilder.setTicker(contents[0] + "님이 친구 요청을 수락했습니다")
.setContentTitle(contents[0] + "님의 친구 요청 수락")
.setAutoCancel(true)
.setContentIntent(PendingIntent.getActivity(context, 0, intent,
PendingIntent.FLAG_UPDATE_CURRENT));
nm.notify(256, notiBuilder.build());
break;
}
}
}
public static int byteArrayToInt(byte[] byteArray) {
return (byteArray[0] & 0xff) << 24 | (byteArray[1] & 0xff) << 16 | (byteArray[2] & 0xff) << 8
| (byteArray[3] & 0xff);
}
public static byte[] intToByteArray(int a) {
return ByteBuffer.allocate(4).putInt(a).array();
}
}
| [
"[email protected]"
] | |
e0cde1588e95af72bb0e212f064431adffcfbbb0 | 8ba84925775929385ec44dc24a258af0d8d5fe3c | /app/src/main/java/com/baidu/mobstat/bd.java | c244e64903c2d3f39b1b7b6ed98ddad6d3530fac | [] | no_license | zbLiuLiu/ToTheBestTA | 0c82ac696da9908cc9ae4568d3bccc69b6c7db79 | 93ee9aee520d39de619fd998532ffc9df437839b | refs/heads/master | 2020-08-02T08:13:39.150949 | 2019-09-27T09:50:48 | 2019-09-27T09:50:48 | 211,284,521 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,549 | java | package com.baidu.mobstat;
import android.util.Log;
import com.a.a.a.a.a.a.a;
import java.io.PrintWriter;
import java.io.StringWriter;
public final class bd {
public static int a = 7;
static {
}
private static String a() { return "Bottom"; }
private static void a(int paramInt, String paramString) {
if (a(paramInt))
Log.println(paramInt, a(), paramString);
}
public static void a(String paramString) { a(3, paramString); }
public static void a(Throwable paramThrowable) { a(3, d(paramThrowable)); }
private static boolean a(int paramInt) { return (paramInt >= a); }
public static void b(String paramString) { a(5, paramString); }
public static void b(Throwable paramThrowable) { a(5, d(paramThrowable)); }
public static void c(String paramString) { a(6, paramString); }
public static void c(Throwable paramThrowable) { a(6, d(paramThrowable)); }
private static String d(Throwable paramThrowable) {
if (paramThrowable == null)
return "";
for (Throwable throwable = paramThrowable; throwable != null; throwable = throwable.getCause()) {
if (throwable instanceof java.net.UnknownHostException)
return "";
}
StringWriter stringWriter = new StringWriter();
a.a(paramThrowable, new PrintWriter(stringWriter));
return stringWriter.toString();
}
}
/* Location: E:\Android逆向\送给最好的TA\classes-dex2jar.jar!\com\baidu\mobstat\bd.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 1.0.7
*/ | [
"[email protected]"
] | |
782af7cb3beb604a1b5a546b95f97fd91c915735 | a12c21f18ac52b1d432d878cad4ce9a26cf67164 | /src/java/com/deploy/web/utils/X509ShellUtils.java | ce239718fb6bce0357a9f88ad94c2f9707f69cc5 | [] | no_license | zhanght86/deploy_sm2_rsa | b364c6c76a6c3da99a3bf2e9d9f2015ff4fa686c | 4c55f3585d46e2cbac8a92ffbe8f830e80d1c58d | refs/heads/master | 2021-06-08T13:27:57.978524 | 2016-11-22T10:02:34 | 2016-11-22T10:02:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,387 | java | package com.deploy.web.utils;
import com.deploy.utils.StringContext;
import com.inetec.common.util.OSInfo;
import com.inetec.common.util.Proc;
import org.apache.log4j.Logger;
import java.math.BigInteger;
import java.util.UUID;
/**
* Created by IntelliJ IDEA.
* User: Administrator
* Date: 13-7-4
* Time: 上午6:55
* To change this template use File | Settings | File Templates.
*/
public class X509ShellUtils {
private static Logger logger = Logger.getLogger(X509ShellUtils.class);
//生成uuid唯一序列号
public static String build_uuid() {
//使用UUID生成序列号
UUID uuid = UUID.randomUUID();
String ids[] = uuid.toString().split("-");
StringBuffer strBuf = new StringBuffer();
for (int i = 0; i < ids.length; i++) {
strBuf.append(ids[i]);
}
BigInteger big = new BigInteger(strBuf.toString(), 16);
return big.toString();
}
//签发rsa CA
public static boolean build_rsa_selfsign_ca(String days, String bits, String keyfile, String certificate, String apply_conf) {
Proc proc = new Proc();
String command = null;
if (OSInfo.getOSInfo().isWin()) {
command = StringContext.systemPath + "/commands/windows/rsa/build-selfsign-ca.bat " +
days + " " +
build_uuid() + " " +
bits + " " +
keyfile +" " +
certificate+ " " +
apply_conf;
} else {
command = StringContext.systemPath + "/commands/liunx/rsa/build-selfsign-ca.sh " +
days + " " +
build_uuid() + " " +
bits + " " +
keyfile + " " +
certificate + " " +
apply_conf;
}
logger.info(command);
proc.exec(command);
if (proc.getResultCode() != -1) {
if(!proc.getErrorOutput().contains("error")&&!proc.getErrorOutput().contains("Error")){
return true;
} else {
logger.equals(proc.getErrorOutput());
}
}
return false;
}
//生成sm2 CA
public static boolean build_sm2_ca(String csrFile, String extFile,String extensions, String caKey,String caCrt,String days) {
Proc proc = new Proc();
String command = null;
if (OSInfo.getOSInfo().isWin()) {
command = StringContext.systemPath + "/commands/windows/sm2/build-selfsign-ca.bat " +
build_uuid() + " " +
csrFile + " " +
extFile+ " " +
extensions+ " " +
caKey+ " " +
caCrt+ " " +
days;
} else {
command = StringContext.systemPath + "/commands/liunx/sm2/build-selfsign-ca.sh " +
build_uuid() + " " +
csrFile + " " +
extFile+ " " +
extensions+ " " +
caKey+ " " +
caCrt+ " " +
days;
}
logger.info(command);
proc.exec(command);
if (proc.getResultCode() != -1) {
if(!proc.getErrorOutput().contains("error")&&!proc.getErrorOutput().contains("Error")){
return true;
} else {
logger.equals(proc.getErrorOutput());
}
}
return false;
}
//生成sm2私钥
public static boolean build_sm2_key(String bits, String keyfile) {
Proc proc = new Proc();
String command = null;
if (OSInfo.getOSInfo().isWin()) {
command = StringContext.systemPath + "/commands/windows/sm2/build-key.bat " +
keyfile + " " +
bits;
} else {
command = StringContext.systemPath + "/commands/liunx/sm2/build-key.sh " +
keyfile + " " +
bits;
}
logger.info(command);
proc.exec(command);
if (proc.getResultCode() != -1) {
if(!proc.getErrorOutput().contains("error")&&!proc.getErrorOutput().contains("Error")){
return true;
} else {
logger.equals(proc.getErrorOutput());
}
}
return false;
}
//生成sm2请求
public static boolean build_sm2_csr(String keyfile, String csrfile, String apply_conf) {
Proc proc = new Proc();
String command = null;
if (OSInfo.getOSInfo().isWin()) {
command = StringContext.systemPath + "/commands/windows/sm2/build-csr.bat " +
keyfile + " " +
csrfile + " " +
apply_conf;
} else {
command = StringContext.systemPath + "/commands/liunx/sm2/build-csr.sh " +
keyfile + " " +
csrfile + " " +
apply_conf;
}
logger.info(command);
proc.exec(command);
if (proc.getResultCode() != -1) {
if(!proc.getErrorOutput().contains("error")&&!proc.getErrorOutput().contains("Error")){
return true;
} else {
logger.equals(proc.getErrorOutput());
}
}
return false;
}
}
| [
"[email protected]"
] | |
55db445e4b02907ff7f6967ba262f0bad60ea67d | e9c754dae8fb75b6e6bb4d85f26d8e449a697ad9 | /src/test/java/com/ravunana/manda/domain/EscrituracaoContabilTest.java | c3b25d7dacd1dafa60455cfc88ac532549158557 | [] | no_license | ravunana/manda-negocio | 2089848c2e6e3b417e4d16bfeb0e675a8cffdf82 | 3a30f454a3b59fc2ed159074b647f02d0b512353 | refs/heads/develop | 2022-12-25T06:56:56.414348 | 2020-06-19T11:07:55 | 2020-06-19T11:07:55 | 228,268,755 | 3 | 0 | null | 2022-12-16T04:42:18 | 2019-12-15T23:41:09 | Java | UTF-8 | Java | false | false | 936 | java | package com.ravunana.manda.domain;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
import com.ravunana.manda.web.rest.TestUtil;
public class EscrituracaoContabilTest {
@Test
public void equalsVerifier() throws Exception {
TestUtil.equalsVerifier(EscrituracaoContabil.class);
EscrituracaoContabil escrituracaoContabil1 = new EscrituracaoContabil();
escrituracaoContabil1.setId(1L);
EscrituracaoContabil escrituracaoContabil2 = new EscrituracaoContabil();
escrituracaoContabil2.setId(escrituracaoContabil1.getId());
assertThat(escrituracaoContabil1).isEqualTo(escrituracaoContabil2);
escrituracaoContabil2.setId(2L);
assertThat(escrituracaoContabil1).isNotEqualTo(escrituracaoContabil2);
escrituracaoContabil1.setId(null);
assertThat(escrituracaoContabil1).isNotEqualTo(escrituracaoContabil2);
}
}
| [
"Osodrac"
] | Osodrac |
722795067c56816c7d90e34d40c2da3644686f6f | 93112af422b044b8b85428fbc210d858376a4f54 | /app/src/main/java/com/example/myquizapp/MVVM/FirebaseRepository.java | 8a6f983f8553fbe592f2d8bbfee5d94cbc8b1bc2 | [] | no_license | developersamuelakram/QuizApp_Firebase_MVVM | db7ddae2a06a361f6ed62e686c42c9fe12771f5d | bb699dfa21c657edc650a80c8472c3c5a0ade30f | refs/heads/master | 2023-02-11T03:21:06.715395 | 2021-01-14T09:49:47 | 2021-01-14T09:49:47 | 329,559,884 | 2 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,400 | java | package com.example.myquizapp.MVVM;
import androidx.annotation.NonNull;
import com.example.myquizapp.Model.QuizModel;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.firestore.FirebaseFirestore;
import com.google.firebase.firestore.Query;
import com.google.firebase.firestore.QuerySnapshot;
import java.util.List;
public class FirebaseRepository {
OnFireStoreDataAdded fireStoreDataAdded;
FirebaseFirestore firestore = FirebaseFirestore.getInstance();
Query quizRef = firestore.collection("QuizList");
public FirebaseRepository(OnFireStoreDataAdded fireStoreDataAdded) {
this.fireStoreDataAdded = fireStoreDataAdded;
}
public void getDataFromFireStore() {
quizRef.get().addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
@Override
public void onComplete(@NonNull Task<QuerySnapshot> task) {
if (task.isSuccessful()) {
fireStoreDataAdded.quizDataAdded(task.getResult().toObjects(QuizModel.class));
} else {
fireStoreDataAdded.OnError(task.getException());
}
}
});
}
public interface OnFireStoreDataAdded {
void quizDataAdded(List<QuizModel> quizModelList);
void OnError(Exception e);
}
}
| [
"[email protected]"
] | |
2f6761a3131257cfe63e49f83adf2af7ca4e5c4a | 8204dd36449fbe15b2b31c6c769696c9913918a0 | /betaas-utils/coap-server-betaas/src/main/java/org/eclipse/californium/examples/resources/BasicResource.java | 4b65db91842b1c66868017d97dd5927b84c2b183 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | permissive | izmendi/BETaaS_Platform-Tools | 2dc176f6a15854939c638c32021fad2b2e45b213 | f67a950f9173668b13ff81adcf79d9019cc79298 | refs/heads/master | 2021-01-18T05:44:04.139075 | 2015-04-27T08:45:04 | 2015-04-27T08:45:04 | 31,535,388 | 1 | 0 | null | 2015-03-02T10:35:00 | 2015-03-02T10:35:00 | null | UTF-8 | Java | false | false | 8,040 | java | package org.eclipse.californium.examples.resources;
import javax.xml.stream.XMLStreamReader;
import org.eclipse.californium.core.CoapResource;
import org.eclipse.californium.core.server.resources.CoapExchange;
import org.eclipse.californium.examples.CoAPServer;
public abstract class BasicResource extends CoapResource {
protected String id;
protected String output;
protected String digital;
protected String maxresponsetime;
protected String memorystatus;
protected String batterylevel;
protected String protocol;
protected String type;
protected String unit;
protected String environment;
protected String lat;
protected String lon;
protected String altitude;
protected String floor;
protected String locationkeywork;
protected String locationIdentifier;
protected String computationalcost;
protected String batterycost;
protected String measurement;
public void setAttributes() {
getAttributes().setTitle("Basic Resource");
getAttributes().addAttribute(CoAPServer.DEVICEID, id);
getAttributes().addAttribute(CoAPServer.OUTPUT, output);
getAttributes().addAttribute(CoAPServer.DIGITAL, digital);
getAttributes().addAttribute(CoAPServer.MAXRESPONSETIME, maxresponsetime);
getAttributes().addAttribute(CoAPServer.MEMORYSTATUS, memorystatus);
getAttributes().addAttribute(CoAPServer.BATTERYLEVEL, batterylevel);
getAttributes().addAttribute(CoAPServer.PROTOCOL, protocol);
getAttributes().addAttribute(CoAPServer.TYPE, type);
getAttributes().addAttribute(CoAPServer.UNIT, unit);
getAttributes().addAttribute(CoAPServer.ENVIRONMENT, environment);
getAttributes().addAttribute(CoAPServer.LATITUDE, lat);
getAttributes().addAttribute(CoAPServer.LONGITUDE, lon);
getAttributes().addAttribute(CoAPServer.ALTITUDE, altitude);
getAttributes().addAttribute(CoAPServer.FLOOR, floor);
getAttributes().addAttribute(CoAPServer.LOCATIONKEYWORD, locationkeywork);
getAttributes().addAttribute(CoAPServer.LOCATIONIDENTIFIER, locationIdentifier);
getAttributes().addAttribute(CoAPServer.COMPUTATIONALCOST, computationalcost);
getAttributes().addAttribute(CoAPServer.BATTERYCOST, batterycost);
getAttributes().addAttribute(CoAPServer.MEASUREMENT, measurement);
}
public BasicResource(String name) {
super(name);
setOutput("");
setDigital("");
setMaxresponsetime("");
setMemorystatus("");
setBatterylevel("");
setProtocol("coap");
setType("");
setUnit("");
setEnvironment("");
setLat("");
setLon("");
setAltitude("");
setFloor("");
setLocationkeywork("");
setLocationIdentifier("");
setComputationalcost("");
setBatterycost("");
setMeasurement("");
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getLocationIdentifier() {
return locationIdentifier;
}
public void setLocationIdentifier(String locationIdentifier) {
this.locationIdentifier = locationIdentifier;
}
public String getLat() {
return lat;
}
public void setLat(String lat) {
this.lat = lat;
}
public String getLon() {
return lon;
}
public void setLon(String lon) {
this.lon = lon;
}
public String getOutput() {
return output;
}
public void setOutput(String output) {
this.output = output;
}
public String getDigital() {
return digital;
}
public void setDigital(String digital) {
this.digital = digital;
}
public String getMaxresponsetime() {
return maxresponsetime;
}
public void setMaxresponsetime(String maxresponsetime) {
this.maxresponsetime = maxresponsetime;
}
public String getMemorystatus() {
return memorystatus;
}
public void setMemorystatus(String memorystatus) {
this.memorystatus = memorystatus;
}
public String getBatterylevel() {
return batterylevel;
}
public void setBatterylevel(String batterylevel) {
this.batterylevel = batterylevel;
}
public String getProtocol() {
return protocol;
}
public void setProtocol(String protocol) {
this.protocol = protocol;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public String getEnvironment() {
return environment;
}
public void setEnvironment(String environment) {
this.environment = environment;
}
public String getAltitude() {
return altitude;
}
public void setAltitude(String altitude) {
this.altitude = altitude;
}
public String getFloor() {
return floor;
}
public void setFloor(String floor) {
this.floor = floor;
}
public String getLocationkeywork() {
return locationkeywork;
}
public void setLocationkeywork(String locationkeywork) {
this.locationkeywork = locationkeywork;
}
public String getComputationalcost() {
return computationalcost;
}
public void setComputationalcost(String computationalcost) {
this.computationalcost = computationalcost;
}
public String getBatterycost() {
return batterycost;
}
public void setBatterycost(String batterycost) {
this.batterycost = batterycost;
}
public String getMeasurement() {
return measurement;
}
public void setMeasurement(String measurement) {
System.out.print("Meas set "+measurement+"\n");
this.measurement = measurement;
}
public void readXMLAttributes(XMLStreamReader reader){
System.out.print("XML \n");
for(int i = 0 ; i < reader.getAttributeCount(); i++){
String attName = reader.getAttributeLocalName(i);
System.out.print(attName+"\n");
if(attName.equals(CoAPServer.OUTPUT))
this.setOutput(reader.getAttributeValue(i));
if(attName.equals(CoAPServer.DIGITAL))
this.setDigital(reader.getAttributeValue(i));
if(attName.equals(CoAPServer.MAXRESPONSETIME))
this.setMaxresponsetime(reader.getAttributeValue(i));
if(attName.equals(CoAPServer.MEMORYSTATUS))
this.setMemorystatus(reader.getAttributeValue(i));
if(attName.equals(CoAPServer.BATTERYLEVEL))
this.setBatterylevel(reader.getAttributeValue(i));
if(attName.equals(CoAPServer.PROTOCOL))
this.setProtocol(reader.getAttributeValue(i));
if(attName.equals(CoAPServer.TYPE))
this.setType(reader.getAttributeValue(i));
if(attName.equals(CoAPServer.UNIT))
this.setUnit(reader.getAttributeValue(i));
if(attName.equals(CoAPServer.ENVIRONMENT))
this.setEnvironment(reader.getAttributeValue(i));
if(attName.equals(CoAPServer.LATITUDE))
this.setLat(reader.getAttributeValue(i));
if(attName.equals(CoAPServer.LONGITUDE))
this.setLon(reader.getAttributeValue(i));
if(attName.equals(CoAPServer.ALTITUDE))
this.setAltitude(reader.getAttributeValue(i));
if(attName.equals(CoAPServer.FLOOR))
this.setFloor(reader.getAttributeValue(i));
if(attName.equals(CoAPServer.LOCATIONKEYWORD))
this.setLocationkeywork(reader.getAttributeValue(i));
if(attName.equals(CoAPServer.LOCATIONIDENTIFIER))
this.setLocationIdentifier(reader.getAttributeValue(i));
if(attName.equals(CoAPServer.COMPUTATIONALCOST))
this.setComputationalcost(reader.getAttributeValue(i));
if(attName.equals(CoAPServer.BATTERYCOST))
this.setBatterycost(reader.getAttributeValue(i));
if(attName.equals(CoAPServer.MEASUREMENT)){
System.out.print("Meas found " + attName+"\n");
this.setMeasurement(reader.getAttributeValue(i));
}
}
}
@Override
public abstract void handleGET(CoapExchange exchange);
@Override
public abstract void handlePOST(CoapExchange exchange);
@Override
public abstract void handlePUT(CoapExchange exchange);
public static String readDeviceId(XMLStreamReader reader) {
for(int i = 0 ; i < reader.getAttributeCount(); i++){
String attName = reader.getAttributeLocalName(i);
if(attName.equals(CoAPServer.DEVICEID))
{
return reader.getAttributeValue(i);
}
}
return null;
}
}
| [
"[email protected]"
] | |
1d330d348b0d2037bab8952dbe5348313f207a4b | f21f26419091dd7d308aa62ae3567ff5844e3218 | /CheckingAccount.java | 422e604de070449cdec683c61caac8127b4c3e8c | [] | no_license | jmobarry/CMSC203_Lab9 | e339555f863daa1210f0597ed2dc0f81051302fc | e9bca8a557fc17f60a64b20cee26e3e8d5f8cd2c | refs/heads/main | 2023-01-20T09:39:40.496310 | 2020-11-24T16:05:05 | 2020-11-24T16:05:05 | 315,682,898 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 339 | java |
public class CheckingAccount extends BankAccount {
private static final double FEE = .15;
public CheckingAccount(String name, double amount) {
super(name,amount);
super.setAccountNumber(super.getAccountNumber() + "-10");
}
public boolean withdraw(double amount) {
return super.withdraw(amount + FEE);
}
}
| [
"[email protected]"
] | |
61ac78f003570622a3e34a326c30a9c4045c43dc | c2d8181a8e634979da48dc934b773788f09ffafb | /storyteller/output/realize/UsersAction.java | b3f0f0753b51a77029bcc2e2c7eeeaec8232c1f8 | [] | no_license | toukubo/storyteller | ccb8281cdc17b87758e2607252d2d3c877ffe40c | 6128b8d275efbf18fd26d617c8503a6e922c602d | refs/heads/master | 2021-05-03T16:30:14.533638 | 2016-04-20T12:52:46 | 2016-04-20T12:52:46 | 9,352,300 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,945 | java | package net.realize.web.app;
import net.realize.model.*;
import net.realize.beans.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.text.SimpleDateFormat;
import java.util.Iterator;
import java.util.Vector;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang.StringUtils;
import java.util.Date;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Restrictions;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.web.context.support.WebApplicationContextUtils;
import net.enclosing.util.HibernateSession;
import net.storyteller.desktop.CopyProperties;
public class UsersAction extends Action{
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest req,
HttpServletResponse res) throws Exception{
Session session = new HibernateSession().currentSession(this
.getServlet().getServletContext());
//<snippet sentence="UsersAction">
// Vector vector = new Vector();
Criteria criteria = session.createCriteria(User.class);
req.setAttribute("users",criteria.list());
// for (Iterator iter = criteria.list().iterator(); iter.hasNext();) {
// User user = (User) iter.next();
// vector.add(user);
// }
User user = new UserImpl();
UserForm userform = new UserForm();
criteria = session.createCriteria(User.class);
if (req.getAttribute("form")== null && req.getParameter("id")!=null){
criteria.add(Restrictions.idEq(Integer.valueOf(req
.getParameter("id"))));
user = (User) criteria.uniqueResult();
new CopyProperties(user,userform);
} else if(req.getAttribute("form")!=null){
userform = (UserForm)req.getAttribute("form");
criteria.add(Restrictions.idEq(userform.getId()));
user = (User) criteria.uniqueResult();
}
req.setAttribute("model",user);
req.setAttribute("form",userform);
//</snippet>
Criteria criteriaCertificationType= session.createCriteria(CertificationType.class);
req.setAttribute("CertificationTypes", criteriaCertificationType.list());
// if(req.getParameter("displayexport") !=null){
// return mapping.findForward("displayexport");
// }
// if(req.getParameter("csv") !=null){
// CsvExportUsersAction csvExportUsersAction
// = new CsvExportUsersAction(req,session,Collection collection);
// }
return mapping.findForward("success");
}
} | [
"[email protected]"
] | |
192b24406fee5b83e1a0557dc77a6ccac48eb625 | 20eb8333ea899d81143aeb2202bfeab48518ae05 | /GameCalendar/src/com/hit/gamecalendar/main/java/common/enums/ELoggingLevel.java | 09c8b57065428340ca17bf43778b978fc7f4db08 | [] | no_license | kimilevy/HITJavaServerProject | 38beed1f231a3dabb84ec7cb682566b91dc2068a | a751e5c578fbe2cbdbd32647b29afcd11bbeadc5 | refs/heads/main | 2023-06-04T08:22:46.455313 | 2021-06-28T12:46:14 | 2021-06-28T12:46:14 | 351,826,131 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 371 | java | package com.hit.gamecalendar.main.java.common.enums;
public enum ELoggingLevel {
ERROR(0),
INFORMATION(1),
DEBUG(2);
private final int numVal;
ELoggingLevel(int i) {
this.numVal = i;
}
int getNum() {
return numVal;
}
public int compareNum(ELoggingLevel other) {
return this.numVal - other.numVal;
}
}
| [
"[email protected]"
] | |
45200f86688808a2f25b33a270cdaf9f8df10337 | 31c2e9ac7aab1990c9cba9f469319c77fce77102 | /app/src/main/java/com/lessask/friends/FriendsAdapter.java | a6180ceffe63ee53a6ad30d4a1aafd5bbed3eb33 | [] | no_license | huangjilaiqin/TestGradle | 482af21822825b8f3782caa7472fc07a03cc4704 | 18098b3751a95c2812f9d173df37415ba8def2b3 | refs/heads/master | 2021-01-17T14:09:32.871015 | 2016-03-27T15:41:40 | 2016-03-27T15:43:01 | 39,896,889 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,886 | java | package com.lessask.friends;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.support.v4.util.LruCache;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.ImageLoader;
import com.android.volley.toolbox.Volley;
import com.lessask.R;
import com.lessask.global.GlobalInfos;
import com.lessask.model.ChatMessage;
import com.lessask.model.User;
import com.lessask.util.TimeHelper;
import java.io.File;
import java.util.ArrayList;
/**
* Created by JHuang on 2015/8/18.
*/
public class FriendsAdapter extends BaseAdapter{
private static final String TAG = FriendsAdapter.class.getName();
private RequestQueue requestQueue;
private final LruCache<String, Bitmap> lruCache = new LruCache<String, Bitmap>(20);
private ImageLoader.ImageCache imageCache;
private ImageLoader imageLoader;
private Context context;
private ArrayList<User> originFriends;
private File headImgDir;
private GlobalInfos globalInfos = GlobalInfos.getInstance();
public FriendsAdapter(Context context, ArrayList data){
this.context = context;
originFriends = data;
//to do 这里有时出现NullException
headImgDir = context.getExternalFilesDir("headImg");
requestQueue = Volley.newRequestQueue(context);
imageCache = new ImageLoader.ImageCache() {
@Override
public void putBitmap(String key, Bitmap bitmap) {
lruCache.put(key, bitmap);
}
@Override
public Bitmap getBitmap(String key) {
return lruCache.get(key);
}
};
imageLoader = new ImageLoader(requestQueue, imageCache);
}
@Override
public int getCount() {
if(originFriends==null){
return 0;
}
return originFriends.size();
}
@Override
public Object getItem(int position) {
return originFriends.get(position);
}
@Override
public long getItemId(int position) {
return 0;
}
private Bitmap decodeUriAsBitmap(Uri uri){
Bitmap bitmap = null;
try {
//bitmap = BitmapFactory.decodeStream(getContentResolver().openInputStream(uri));
bitmap = BitmapFactory.decodeFile(uri.getPath());
} catch (Exception e) {
e.printStackTrace();
return null;
}
return bitmap;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
User user = (User)getItem(position);
convertView = LayoutInflater.from(context).inflate(R.layout.contact_item, null);
ImageView ivHead = (ImageView)convertView.findViewById(R.id.head_img);
TextView tvName = (TextView)convertView.findViewById(R.id.name);
TextView tvContent = (TextView)convertView.findViewById(R.id.content);
TextView tvTime = (TextView)convertView.findViewById(R.id.time);
int userid = globalInfos.getUserId();
int friendid = user.getUserid();
String chatgroupId = userid<friendid?userid+""+friendid:friendid+""+userid;
ArrayList chatContent = globalInfos.getChatContent(chatgroupId);
ChatMessage msg = null;
if(chatContent.size()>0) {
msg = (ChatMessage) chatContent.get(chatContent.size()-1);
}
tvName.setText(user.getNickname());
//获取对话内容
if(msg!=null) {
tvContent.setText(msg.getContent());
tvTime.setText(TimeHelper.date2Chat(msg.getTime()));
}
//先从内内存中找, 再从文件中找, 再服务器加载
//Bitmap bmp = user.getHeadImg();
Bitmap bmp = null;
if(bmp == null){
File imageFile = new File(headImgDir, user.getUserid()+".jpg");
if(imageFile.exists()) {
Uri headImgUri = Uri.fromFile(imageFile);//获取文件的Uri
bmp = decodeUriAsBitmap(headImgUri);
//user.setHeadImg(bmp);
ivHead.setImageBitmap(bmp);
}else {
//设置默认图像
ivHead.setImageResource(R.mipmap.ic_launcher);
//异步加载图像
String friendHeadImgUrl = globalInfos.getHeadImgHost()+user.getUserid()+".jpg";
ImageLoader.ImageListener listener = ImageLoader.getImageListener(ivHead,R.mipmap.ic_launcher, R.mipmap.ic_launcher);
imageLoader.get(friendHeadImgUrl, listener);
}
}else {
ivHead.setImageBitmap(bmp);
}
return convertView;
}
} | [
"[email protected]"
] | |
b3793f2c8be50b1874bdd94b786f6007600b4b1c | c37ecee6763b36d97b4d61dca47c222a3028c280 | /example/src/main/java/com/fastcode/example/domain/core/authorization/role/RoleEntity.java | 6538bfa63d49f1fa89c24d1cfb39e9a8e5bb1c3f | [] | no_license | fastcode-inc/lkjh6 | b76fe9531271a2c7d9b0e175295b48602cfd3c19 | 435baa264d654df45b701301fafbdb000550f587 | refs/heads/master | 2023-02-19T23:08:26.162547 | 2021-01-18T09:07:15 | 2021-01-18T09:07:15 | 330,137,464 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 825 | java | package com.fastcode.example.domain.core.authorization.role;
import com.fastcode.example.domain.core.abstractentity.AbstractEntity;
import java.time.*;
import javax.persistence.*;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Entity
@Table(name = "role")
@Getter
@Setter
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
@NoArgsConstructor
public class RoleEntity extends AbstractEntity {
@Basic
@Column(name = "display_name", nullable = false, length = 255)
private String displayName;
@Basic
@Column(name = "name", nullable = false, length = 255)
private String name;
@Id
@EqualsAndHashCode.Include
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", nullable = false)
private Long id;
}
| [
"[email protected]"
] | |
212f0f06471b2642e4417c610d19e1092036720e | 3a9025f49ae256ffe25b6a849167debbdb996960 | /app/src/main/java/com/swiftsoft/colossus/mobileoil/Trip_Undelivered_List.java | 03c45f8138d65ce6bffb49ad34b3da0f53423d31 | [] | no_license | lsq304567/ColossusMobileOil | cf4c5b5a9de53dd201e463600ebe5eef69f6c804 | 883e7c9e261d5f1dc432e5c2ad0e640e9e6b0ae8 | refs/heads/master | 2021-01-16T22:54:44.917269 | 2016-01-28T17:22:45 | 2016-01-28T17:22:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,843 | java | package com.swiftsoft.colossus.mobileoil;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ListView;
import android.widget.AdapterView.OnItemClickListener;
import com.swiftsoft.colossus.mobileoil.database.adapter.UndeliveredAdapter;
import com.swiftsoft.colossus.mobileoil.database.model.dbTripOrder;
import com.swiftsoft.colossus.mobileoil.view.MyFlipperView;
import com.swiftsoft.colossus.mobileoil.view.MyInfoView1Line;
public class Trip_Undelivered_List extends MyFlipperView
{
private Trip trip;
private UndeliveredAdapter adapter;
private MyInfoView1Line infoview;
private ListView lvOrders;
public Trip_Undelivered_List(Context context)
{
super(context);
init(context);
}
public Trip_Undelivered_List(Context context, AttributeSet attrs)
{
super(context, attrs);
init(context);
}
private void init(Context context)
{
try
{
// Leave breadcrumb.
CrashReporter.leaveBreadcrumb("Trip_Undelivered_List: init");
// Store reference to Trip activity.
trip = (Trip)context;
// Inflate layout.
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
inflater.inflate(R.layout.trip_undelivered_list, this, true);
infoview = (MyInfoView1Line)this.findViewById(R.id.trip_undelivered_list_infoview);
lvOrders = (ListView)this.findViewById(R.id.trip_undelivered_list_orders);
lvOrders.setOnItemClickListener(lvOnClick);
Button btnBack = (Button) this.findViewById(R.id.trip_undelivered_list_back);
Button btnDelivered = (Button) this.findViewById(R.id.trip_undelivered_list_delivered);
Button btnNext = (Button) this.findViewById(R.id.trip_undelivered_list_next);
btnBack.setOnClickListener(onClickListener);
btnDelivered.setOnClickListener(onClickListener);
btnNext.setOnClickListener(onClickListener);
}
catch (Exception e)
{
CrashReporter.logHandledException(e);
}
}
@Override
public boolean resumeView()
{
try
{
CrashReporter.leaveBreadcrumb("Trip_Undelivered_List: resumeView");
// Resume updating.
infoview.resume();
return true;
}
catch (Exception e)
{
CrashReporter.logHandledException(e);
return false;
}
}
@Override
public void pauseView()
{
try
{
CrashReporter.leaveBreadcrumb("Trip_Undelivered_List: pauseView");
// Pause updating.
infoview.pause();
}
catch (Exception e)
{
CrashReporter.logHandledException(e);
}
}
@Override
public void updateUI()
{
try
{
CrashReporter.leaveBreadcrumb("Trip_Undelivered_List: updateUI");
// Refresh data.
adapter = new UndeliveredAdapter(trip, Active.trip.GetUndelivered());
// Bind to listview.
lvOrders.setAdapter(adapter);
// Update UI.
infoview.setDefaultTv1("Trip " + Active.trip.No);
infoview.setDefaultTv2(adapter.getCount() + " undelivered");
}
catch (Exception e)
{
CrashReporter.logHandledException(e);
}
}
private final OnItemClickListener lvOnClick = new OnItemClickListener()
{
@Override
public void onItemClick(AdapterView<?> a, View v, int position, long id)
{
try
{
// Leave breadcrumb.
CrashReporter.leaveBreadcrumb("Trip_Undelivered_List: lvOnClick");
trip.OrderId = id;
startOrder(id);
}
catch (Exception e)
{
CrashReporter.logHandledException(e);
}
}
};
private final OnClickListener onClickListener = new OnClickListener()
{
@Override
public void onClick(View view)
{
try
{
switch (view.getId())
{
case R.id.trip_undelivered_list_back:
// Leave breadcrumb.
CrashReporter.leaveBreadcrumb("Trip_Undelivered_List: onClick - Back");
// Switch views.
trip.selectView(Trip.ViewTransportDoc, -1);
break;
case R.id.trip_undelivered_list_delivered:
// Leave breadcrumb.
CrashReporter.leaveBreadcrumb("Trip_Undelivered_List: onClick - Delivered");
// Show delivered dialog.
trip.showDelivered();
break;
case R.id.trip_undelivered_list_next:
// Leave breadcrumb.
CrashReporter.leaveBreadcrumb("Trip_Undelivered_List: onClick - Next");
// Check if all delivered.
if (Active.trip.GetUndelivered().size() > 0)
{
trip.OrderId = adapter.getItemId(0);
startOrder(adapter.getItemId(0));
}
else
{
// All deliveries done; switch to stock at end view.
trip.selectView(Trip.ViewStockEnd, +1);
}
break;
}
}
catch (Exception e)
{
CrashReporter.logHandledException(e);
}
}
};
private void startOrder(long id)
{
CrashReporter.leaveBreadcrumb("Trip_Undelivered_List: startOrder");
// Start next order.
Active.order = dbTripOrder.load(dbTripOrder.class, id);
if (Active.order != null)
{
// Mark the Active.order as Delivering.
trip.orderStarted();
// Switch to order summary view.
trip.selectView(Trip.ViewUndeliveredSummary, +1);
}
}
}
| [
"T4nger!ne"
] | T4nger!ne |
d2f5388597da380edf3e05a5b0cdfeba1f20438a | cbf85bb16ab3d70257892ebc51b355c27010467b | /RevStr.java | e95851978e41b2e628f5fa2e2b13b462851610ee | [] | no_license | mzuer/Java_code_examples | 48b66d002ba08384c050a1fa1db594d9de404aab | 767bb46356fd17fd9c379e4a4eb211b1c173b339 | refs/heads/master | 2021-01-10T06:57:53.698370 | 2015-09-25T20:48:35 | 2015-09-25T20:48:35 | 43,174,630 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 240 | java | package reverse_string;
public class RevStr {
private String s;
public RevStr(String s){
this.s=s;
}
public String reverse(){
String s2="";
for(int i=s.length()-1;i>=0;i--){
s2+=s.charAt(i);
}
return s2;
}
}
| [
"[email protected]"
] | |
6f1deb7e77a53c1dc9b4120c04d9168170050c6b | e3fc9c88d343c2b29134feeac4aaa92c33191d12 | /src/main/java/ar/com/tacsutn/grupo1/eventapp/client/EventFilter.java | cb030b93207d33d5baf9c62dedd07ba508fdd912 | [] | no_license | jonigl/tacs-grupo1-api | 5c1a211bba67260c7d885c6e21d3f35d5584b5fe | 60fed79a0724b296ff22ce7bf0e8d9fa47f44da5 | refs/heads/master | 2020-03-27T11:48:05.561605 | 2018-11-19T09:03:16 | 2018-11-19T09:03:16 | 146,508,076 | 3 | 6 | null | 2018-11-19T08:33:59 | 2018-08-28T21:19:36 | Java | UTF-8 | Java | false | false | 2,942 | java | package ar.com.tacsutn.grupo1.eventapp.client;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Objects;
import java.util.stream.Stream;
@JsonInclude(JsonInclude.Include.NON_NULL)
public class EventFilter {
private static final String KEYWORD_KEY = "q";
private static final String START_DATE_FROM_KEY = "start_date.range_start";
private static final String START_DATE_TO_KEY = "start_date.range_end";
private static final String ADDRESS_KEY = "location.address";
private static final String PRICE_KEY = "price";
private String keyword;
private LocalDateTime startDateFrom;
private LocalDateTime startDateTo;
private String address;
private String price;
public String getKeyword() {
return keyword;
}
public String getStartDateFrom() {
return startDateFrom == null ? null : formatDateTime(startDateFrom);
}
public String getStartDateTo() {
return startDateTo == null ? null : formatDateTime(startDateTo);
}
public String getAddress() {
return address;
}
public String getPrice() {
return price;
}
public EventFilter setKeyword(String keyword) {
this.keyword = keyword;
return this;
}
public EventFilter setStartDateFrom(LocalDateTime startDateFrom) {
this.startDateFrom = startDateFrom;
return this;
}
public EventFilter setStartDateTo(LocalDateTime startDateTo) {
this.startDateTo = startDateTo;
return this;
}
public EventFilter setAddress(String address) {
this.address = address;
return this;
}
public EventFilter setPrice(String price) {
this.price = price;
return this;
}
MultiValueMap<String, String> getQueryParams() {
MultiValueMap<String, String> multiValueMap = new LinkedMultiValueMap<>();
multiValueMap.set(KEYWORD_KEY, getKeyword());
multiValueMap.set(START_DATE_FROM_KEY, getStartDateFrom());
multiValueMap.set(START_DATE_TO_KEY, getStartDateTo());
multiValueMap.set(ADDRESS_KEY, getAddress());
multiValueMap.set(PRICE_KEY, getPrice());
multiValueMap.values().removeIf(elem -> elem.stream().allMatch(Objects::isNull));
return multiValueMap;
}
@JsonIgnore
public boolean isValid() {
return Stream.of(
getKeyword(),
getStartDateFrom(),
getStartDateTo(),
getAddress(),
getPrice()
).anyMatch(Objects::nonNull);
}
private String formatDateTime(LocalDateTime dateTime) {
return DateTimeFormatter.ISO_DATE_TIME.format(dateTime.withNano(0));
}
}
| [
"[email protected]"
] | |
d2449bdc2badf4932bed005c923f105d8e491bfc | 1dfeff82b84e3dbb1beff70ad3431e0532ef54bb | /java파일/package-info.java | 13bcfea1ad9197740f0c9603d75c42474b3e7d8c | [] | no_license | JeongTaekgyu/Java_Theorem | fb51693a0cb9126694cf54c451d15db914f29455 | 23172cb25fb6d4d6b9b534e2c4a3188507008bfc | refs/heads/master | 2021-11-09T13:17:27.183974 | 2021-10-26T14:04:26 | 2021-10-26T14:04:26 | 237,189,813 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,546 | java | /**
*
*/
/**
* @author Teak
* email : [email protected]
*
*/
package Class_And_Object;
/*
1. 클래스와 객체
클래스의 정의 - 객체를 정의해 놓은 것이다.
클래스의 용도 - 객체를 생성하는데 사용된다.
객체의 정의 - 실제로 존재하는 것, 사물 또는 개념
객체의 용도 - 객체가 가지고 있는 기능과 속성에 따라 다름
ex)
클래스/객체 = 제품 설계도/제품
tv설계도/tv
붕어빵기계/붕어빵
2. 객체와 인스턴스
클래스로부터 객체를 만드는 과정을 클래스의 인스턴스화라고 하며,
어떤 클래스로부터 만들어진 객체를 그 클래스의 인스턴스(instance)라고 한다.
죽, 객체는 모든 인스턴스를 대표하는 포괄적인 의미이며
인스턴스는 어떤 클래스로부터 만들어진 것인지를 강조하는 구체적인 의미이다.
3. 객체의 구성요소 - 속성과 기능
객체는 속성과 기능의 집합이다.
속성(property) - 멤버변수(member variable), 특성(attribute), 필드(field), 상태(state)
기능(function) - 메서드(method), 함수(function), 행위(behavior)
ex) TV의 속성과 기능
속성 - 크기, 길이, 높이, 색상, 볼륨, 채널 등
기능 - 켜기, 끄기, 볼륨 높이기, 볼륨 낮추기, 채널 변경하기 등
객체 지향 프로그래밍에서는
속성(property) -> 멤버변수(variable)
기능(fucntion) -> 메서드(method)
로 표현한다.
*/ | [
"[email protected]"
] | |
7ccc6d322de226d5d999839af98b07059bf61797 | 260f0789380b0772560232144d3424201633e5f8 | /common/src/test/java/dto/UserDTOTest.java | 4a472bb587610c6353f36aa87db089abab6a7bd7 | [] | no_license | conceptviolator/practic-work2 | 45355b62edb5eb289b16411c8ecd88b83f335c67 | fbcb56f2602f09c5975a4f43ab8c5a843f791d23 | refs/heads/master | 2021-08-22T20:44:14.839546 | 2017-12-01T07:40:12 | 2017-12-01T07:40:12 | 112,710,029 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 627 | java | package dto;
import org.junit.Test;
import static junit.framework.TestCase.assertTrue;
public class UserDTOTest {
@Test
public void userToString() throws Exception {
UserDTO user = new UserDTO();
user.setId(12L);
user.setPhoneNumber("+7 495 727-47-47");
assertTrue(user.toString().contains("495"));
}
@Test
public void jsonToObject() throws Exception {
UserDTO user = new UserDTO();
user.setId(1234567890L);
user.setPhoneNumber("+7 495 727-47-47");
assertTrue(user.jsonToObject(user.toJson()).toString().contains("1234567890"));
}
}
| [
"[email protected]"
] | |
c9218b1fc38fee495d52fddf0dae44062ee59fda | fa93c9be2923e697fb8a2066f8fb65c7718cdec7 | /sources/com/avito/android/rating/review_details/di/ReviewDetailsModule.java | c899aeab030770784aed8aa67734cd0d62d547e9 | [] | no_license | Auch-Auch/avito_source | b6c9f4b0e5c977b36d5fbc88c52f23ff908b7f8b | 76fdcc5b7e036c57ecc193e790b0582481768cdc | refs/heads/master | 2023-05-06T01:32:43.014668 | 2021-05-25T10:19:22 | 2021-05-25T10:19:22 | 370,650,685 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,819 | java | package com.avito.android.rating.review_details.di;
import com.avito.android.rating.review_details.ReviewDetailsPresenter;
import com.avito.android.rating.review_details.ReviewDetailsPresenterImpl;
import com.avito.android.rating.review_details.reply.ReviewReplyPresenter;
import com.avito.android.rating.review_details.reply.ReviewReplyPresenterImpl;
import com.avito.android.rating.review_details.upload.ReviewReplyInteractor;
import com.avito.android.rating.review_details.upload.ReviewReplyInteractorImpl;
import dagger.Binds;
import dagger.Module;
import kotlin.Metadata;
import org.jetbrains.annotations.NotNull;
@Metadata(bv = {1, 0, 3}, d1 = {"\u00000\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\bg\u0018\u00002\u00020\u0001J\u0017\u0010\u0005\u001a\u00020\u00042\u0006\u0010\u0003\u001a\u00020\u0002H'¢\u0006\u0004\b\u0005\u0010\u0006J\u0017\u0010\n\u001a\u00020\t2\u0006\u0010\b\u001a\u00020\u0007H'¢\u0006\u0004\b\n\u0010\u000bJ\u0017\u0010\u000e\u001a\u00020\r2\u0006\u0010\u0003\u001a\u00020\fH'¢\u0006\u0004\b\u000e\u0010\u000f¨\u0006\u0010"}, d2 = {"Lcom/avito/android/rating/review_details/di/ReviewDetailsModule;", "", "Lcom/avito/android/rating/review_details/ReviewDetailsPresenterImpl;", "presenter", "Lcom/avito/android/rating/review_details/ReviewDetailsPresenter;", "bindReviewDetailsPresenter", "(Lcom/avito/android/rating/review_details/ReviewDetailsPresenterImpl;)Lcom/avito/android/rating/review_details/ReviewDetailsPresenter;", "Lcom/avito/android/rating/review_details/upload/ReviewReplyInteractorImpl;", "interactor", "Lcom/avito/android/rating/review_details/upload/ReviewReplyInteractor;", "bindReviewReplyInteractor", "(Lcom/avito/android/rating/review_details/upload/ReviewReplyInteractorImpl;)Lcom/avito/android/rating/review_details/upload/ReviewReplyInteractor;", "Lcom/avito/android/rating/review_details/reply/ReviewReplyPresenterImpl;", "Lcom/avito/android/rating/review_details/reply/ReviewReplyPresenter;", "bindReviewReplyPresenter", "(Lcom/avito/android/rating/review_details/reply/ReviewReplyPresenterImpl;)Lcom/avito/android/rating/review_details/reply/ReviewReplyPresenter;", "rating_release"}, k = 1, mv = {1, 4, 2})
@Module
public interface ReviewDetailsModule {
@Binds
@NotNull
ReviewDetailsPresenter bindReviewDetailsPresenter(@NotNull ReviewDetailsPresenterImpl reviewDetailsPresenterImpl);
@Binds
@NotNull
ReviewReplyInteractor bindReviewReplyInteractor(@NotNull ReviewReplyInteractorImpl reviewReplyInteractorImpl);
@Binds
@NotNull
ReviewReplyPresenter bindReviewReplyPresenter(@NotNull ReviewReplyPresenterImpl reviewReplyPresenterImpl);
}
| [
"[email protected]"
] | |
ef7266f47c45b6ef65d4282b3e0e0e2de0e06e8f | 3936bd4f1480d17590ce9877af172fb7b9dca4ef | /src/main/java/net/majakorpi/simplemsgboard/config/ServletInitializer.java | defe0e86911585c07379f2e52b0f11d8e4e0357b | [] | no_license | mmajis/spring4webmvc-restapp | 02b6ec4edfe1f9812659c57ed36b9e7648ceb7fb | 5c659bdf61fd611a98785e93a27551fb94845068 | refs/heads/master | 2020-06-02T22:19:31.794150 | 2014-05-26T05:28:30 | 2014-05-26T05:28:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,200 | java | package net.majakorpi.simplemsgboard.config;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRegistration;
import org.springframework.web.WebApplicationInitializer;
import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
import org.springframework.web.servlet.DispatcherServlet;
public class ServletInitializer implements WebApplicationInitializer {
@Override
public void onStartup(ServletContext servletContext)
throws ServletException {
AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext();
rootContext.register(SimpleMessageBoardServiceConfiguration.class);
servletContext.addListener(new ContextLoaderListener(rootContext));
AnnotationConfigWebApplicationContext appContext = new AnnotationConfigWebApplicationContext();
appContext.register(SimpleMessageBoardWebConfiguration.class);
ServletRegistration.Dynamic dispatcher = servletContext.addServlet(
"DispatcherServlet", new DispatcherServlet(appContext));
dispatcher.setLoadOnStartup(1);
dispatcher.addMapping("/*");
}
} | [
"[email protected]"
] | |
79a6ef1dd3cec7714ea14228a87f7297a7ab434e | d2913594ce487123f1765fa3fb163f269c9c29ec | /library/src/jp/co/cyberagent/android/gpuimage/util/HuaweiUtil.java | 684022ad9aba977fb5031dad1e7aa610df914224 | [] | no_license | gm-jack/ArProject | c170d2d43ba0495322eafefc6a4d1e5ab154341f | 3d7e93169aa6a6a538c6e65dda57c0dfc4db28dd | refs/heads/master | 2021-01-19T20:50:58.708005 | 2017-05-23T11:13:31 | 2017-05-23T11:13:34 | 83,033,080 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,931 | java | package jp.co.cyberagent.android.gpuimage.util;
import android.content.Context;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.WindowManager;
import java.lang.reflect.Method;
/**
* Created by yxy
* on 2017/5/3.
*/
public class HuaweiUtil {
public static final String SMALL = "720X1280";
public static final String MEDIUM = "1080X1920";
public static final String LARGE = "1440X2560";
//获取屏幕原始尺寸高度,包括虚拟功能键高度
public static int getDpi(Context context) {
int dpi = 0;
WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
Display display = windowManager.getDefaultDisplay();
DisplayMetrics displayMetrics = new DisplayMetrics();
@SuppressWarnings("rawtypes")
Class c;
try {
c = Class.forName("android.view.Display");
@SuppressWarnings("unchecked")
Method method = c.getMethod("getRealMetrics", DisplayMetrics.class);
method.invoke(display, displayMetrics);
dpi = displayMetrics.heightPixels;
} catch (Exception e) {
e.printStackTrace();
}
return dpi;
}
/**
* 获取 虚拟按键的高度
*
* @param context
* @return
*/
public static int getBottomStatusHeight(Context context) {
int totalHeight = getDpi(context);
int contentHeight = getScreenHeight(context);
return totalHeight - contentHeight;
}
/**
* 获得屏幕高度
*
* @param context
* @return
*/
public static int getScreenHeight(Context context) {
WindowManager wm = (WindowManager) context
.getSystemService(Context.WINDOW_SERVICE);
DisplayMetrics outMetrics = new DisplayMetrics();
wm.getDefaultDisplay().getMetrics(outMetrics);
return outMetrics.heightPixels;
}
/**
* 获得屏幕高度
*
* @param context
* @return
*/
public static int getScreenWidth(Context context) {
WindowManager wm = (WindowManager) context
.getSystemService(Context.WINDOW_SERVICE);
DisplayMetrics outMetrics = new DisplayMetrics();
wm.getDefaultDisplay().getMetrics(outMetrics);
return outMetrics.widthPixels;
}
/**
* 是否是华为
*/
public static boolean isHUAWEI() {
return android.os.Build.MANUFACTURER.equals("HUAWEI");
}
public static String getName() {
return android.os.Build.MANUFACTURER;
}
public static String getPix(Context context) {
int width = getScreenWidth(context);
if (width <= 720)
return SMALL;
else if (width > 720 && width <= 1080)
return MEDIUM;
else if (width > 1080)
return LARGE;
return "";
}
}
| [
"[email protected]"
] | |
912b9415fd9be7ecf07e6b9701524758a1c473e0 | d6bc998fb877b1a213734e884c3835c775fa65d9 | /Shoppingcart/src/main/java/com/example/controller/ManageProductController.java | a997f5d5b9d2e80f4953e15bbd664bd09224993d | [] | no_license | Abdelaziz10/WAP | c38d4ed9f0d69e7a719f5dcf8b67965013fcc1cc | 50a30b468f69e6b8b3976eb1613bd1e663148d70 | refs/heads/master | 2022-11-27T16:45:28.949740 | 2019-06-22T15:09:18 | 2019-06-22T15:09:18 | 188,896,022 | 0 | 0 | null | 2022-11-16T05:36:45 | 2019-05-27T19:06:02 | Java | UTF-8 | Java | false | false | 920 | java | package com.example.controller;
import com.example.dao.ProductDAO;
import com.example.model.JsonConverter;
import com.example.model.Product;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
@WebServlet({"/manageProduct"})
public class ManageProductController extends HttpServlet {
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setAttribute("pageTypeProductManagement", true);
RequestDispatcher view = request.getRequestDispatcher("index.jsp");
view.forward(request, response);
}
}
| [
"[email protected]"
] | |
b350f6f6ff3ac3c9e05871027767b78d22f6a366 | 8be5b750e3cfc5bd9dfda861c5bc24720052183e | /cmdb/src/main/java/com/channelsoft/ccod/support/cmdb/service/impl/AppManagerServiceImpl.java | e5015d42599970a3845aa5fe87effe7cb202f8b0 | [] | no_license | 3284180393/supportDev | c484c5cc2364375c52798198002a9e968d346320 | b909d230e21c7d92f7e25392d8f18589c210b9ca | refs/heads/master | 2022-06-26T08:10:57.617659 | 2020-01-17T10:36:49 | 2020-01-17T10:36:49 | 221,192,900 | 0 | 0 | null | 2023-09-14T00:05:34 | 2019-11-12T10:38:38 | Java | UTF-8 | Java | false | false | 160,721 | java | package com.channelsoft.ccod.support.cmdb.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.channelsoft.ccod.support.cmdb.config.NotCheckCfgApp;
import com.channelsoft.ccod.support.cmdb.constant.*;
import com.channelsoft.ccod.support.cmdb.dao.*;
import com.channelsoft.ccod.support.cmdb.exception.*;
import com.channelsoft.ccod.support.cmdb.po.*;
import com.channelsoft.ccod.support.cmdb.service.IAppManagerService;
import com.channelsoft.ccod.support.cmdb.service.ILJPaasService;
import com.channelsoft.ccod.support.cmdb.service.INexusService;
import com.channelsoft.ccod.support.cmdb.service.IPlatformAppCollectService;
import com.channelsoft.ccod.support.cmdb.vo.*;
import org.apache.commons.lang3.StringUtils;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Service;
import org.springframework.util.DigestUtils;
import javax.annotation.PostConstruct;
import java.io.FileInputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.function.Function;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
* @ClassName: AppManagerServiceImpl
* @Author: lanhb
* @Description: AppManagerService的实现类
* @Date: 2019/11/20 14:21
* @Version: 1.0
*/
@Service
public class AppManagerServiceImpl implements IAppManagerService {
// @Autowired
// AppMapper appMapper;
@Value("${nexus.platform-app-cfg-repository}")
private String platformAppCfgRepository;
@Value("${nexus.app-module-repository}")
private String appRepository;
@Value("${debug}")
private boolean debug;
@Value("${nexus.user}")
private String nexusUserName;
@Value("${nexus.password}")
private String nexusPassword;
@Value("${nexus.host-url}")
private String nexusHostUrl;
@Value("${app-publish-nexus.user}")
private String publishNexusUserName;
@Value("${app-publish-nexus.password}")
private String publishNexusPassword;
@Value("${app-publish-nexus.host-url}")
private String publishNexusHostUrl;
@Value("${lj-paas.idle-pool-set-name}")
private String paasIdlePoolSetName;
@Value("${test.demo-new-create-platform-id}")
private String newDemoCreatePlatformId;
@Value("${test.demo-new-create-platform-name}")
private String newDemoCreatePlatformName;
@Value("${ccod.domain-id-regex}")
private String domainIdRegex;
@Autowired
IPlatformAppCollectService platformAppCollectService;
@Autowired
INexusService nexusService;
@Autowired
AppMapper appMapper;
@Autowired
AppCfgFileMapper appCfgFileMapper;
@Autowired
AppInstallPackageMapper appInstallPackageMapper;
@Autowired
ServerMapper serverMapper;
@Autowired
ServerUserMapper serverUserMapper;
@Autowired
PlatformMapper platformMapper;
@Autowired
DomainMapper domainMapper;
@Autowired
PlatformAppMapper platformAppMapper;
@Autowired
PlatformAppCfgFileMapper platformAppCfgFileMapper;
@Autowired
AppModuleMapper appModuleMapper;
@Autowired
PlatformAppDeployDetailMapper platformAppDeployDetailMapper;
@Autowired
PlatformResourceMapper platformResourceMapper;
@Autowired
PlatformAppBkModuleMapper platformAppBkModuleMapper;
@Autowired
PlatformUpdateSchemaMapper platformUpdateSchemaMapper;
@Autowired
ILJPaasService paasService;
@Autowired
private NotCheckCfgApp notCheckCfgApp;
private boolean isPlatformCheckOngoing = false;
private Set<String> notCheckCfgAppSet;
private final static Logger logger = LoggerFactory.getLogger(AppManagerServiceImpl.class);
private Map<String, PlatformUpdateSchemaInfo> platformUpdateSchemaMap = new ConcurrentHashMap<>();
@PostConstruct
void init() throws Exception
{
this.notCheckCfgAppSet = new HashSet<>(this.notCheckCfgApp.getNotCheckCfgApps());
logger.info(String.format("%s will not check cfg count of app",
JSONArray.toJSONString(this.notCheckCfgAppSet)));
List<PlatformUpdateSchemaPo> schemaPoList = this.platformUpdateSchemaMapper.select();
for(PlatformUpdateSchemaPo po : schemaPoList)
{
try
{
PlatformUpdateSchemaInfo schemaInfo = JSONObject.parseObject(po.getContext(), PlatformUpdateSchemaInfo.class);
this.platformUpdateSchemaMap.put(po.getPlatformId(), schemaInfo);
}
catch (Exception ex)
{
logger.error(String.format("parse %s platform update schema exception", po.getPlatformId()), ex);
}
}
try
{
System.out.println("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
// this.appMapper.selectByPrimaryKey(1);
// this.appMapper.select(null, null, null, null);
// platformAppCollectService.collectPlatformAppData("shltPA", null, null, null, null);
// this.startCollectPlatformAppData("tool", null, null, null, null);
// this.appModuleMapper.select("jj","aa", "bb", "kk");
// this.platformAppDeployDetailMapper.select("11", "22", "33", "44",
// "55", "66", "77", "88");
// List<AppModuleVo> appList = this.appModuleMapper.select(null, null, null, null);
// System.out.println(JSONArray.toJSONString(appList));
// List<PlatformAppDeployDetailVo> deployList = this.platformAppDeployDetailMapper.select(null, null, null,
// null, null, null, null, null);
// System.out.println(JSONArray.toJSONString(deployList));
// List<PlatformResourceVo> platformResourceList = this.platformResourceMapper.select();
// System.out.println(JSONArray.toJSONString(platformResourceList));
System.out.println("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$");
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
private String getTempSaveDir(String directory) {
String saveDir = String.format("%s/downloads/%s", System.getProperty("user.dir"), directory);
return saveDir;
}
@Override
public AppModuleVo createNewAppModule(String appName, String appAlias, String version, VersionControl versionControl, String versionControlUrl, AppInstallPackagePo installPackage, AppCfgFilePo[] cfgs, String basePath) throws Exception {
return null;
}
@Override
public AppModuleVo[] queryApps(String appName) throws DataAccessException {
logger.debug(String.format("begin to query app modules : appName=%s", appName));
List<AppModuleVo> list = this.appModuleMapper.select(null, appName, null, null);
logger.info(String.format("query %d app module record with appName=%s", list.size(), appName));
return list.toArray(new AppModuleVo[0]);
}
@Override
public AppModuleVo queryAppByVersion(String appName, String version) throws ParamException, DataAccessException {
logger.debug(String.format("begin to query appName=%s and version=%s app module record", appName, version));
if(StringUtils.isBlank(appName))
{
logger.error("query FAIL : appName is blank");
throw new ParamException("appName is blank");
}
if(StringUtils.isBlank(version))
{
logger.error("query FAIL : version is blank");
throw new ParamException("version is blank");
}
AppModuleVo moduleVo = this.appModuleMapper.selectByNameAndVersion(appName, version);
if(moduleVo == null)
{
logger.warn(String.format("not find app module with appName=%s and version=%s", appName, version));
}
else
{
logger.info(String.format("query app module[%s] with appName=%s and version=%s",
JSONObject.toJSONString(moduleVo), appName, version));
}
return moduleVo;
}
@Override
public PlatformAppDeployDetailVo[] queryPlatformApps(String platformId, String domainId, String hostIp) throws DataAccessException {
logger.debug(String.format("begin to query platform apps : platformId=%s, domainId=%s, hostIp=%s",
platformId, domainId, hostIp));
List<PlatformAppDeployDetailVo> list = this.platformAppDeployDetailMapper.selectPlatformApps(platformId, domainId, hostIp);
logger.info(String.format("query %d record with platformId=%s and domainId=%s and hostIp=%s",
list.size(), platformId, domainId, hostIp));
return list.toArray(new PlatformAppDeployDetailVo[0]);
}
@Override
public PlatformAppDeployDetailVo[] queryAppDeployDetails(String appName, String platformId, String domainId, String hostIp) throws DataAccessException {
logger.debug(String.format("begin to query platform apps : appName=%s, platformId=%s, domainId=%s, hostIp=%s",
appName, platformId, domainId, hostIp));
List<PlatformAppDeployDetailVo> list = this.platformAppDeployDetailMapper.selectAppDeployDetails(appName, platformId, domainId, hostIp);
logger.info(String.format("query %d record with appName=%s and platformId=%s and domainId=%s and hostIp=%s",
list.size(), appName, platformId, domainId, hostIp));
return list.toArray(new PlatformAppDeployDetailVo[0]);
}
@Override
public PlatformAppModuleVo[] startCollectPlatformAppData(String platformId, String platformName, String domainId, String hostIp, String appName, String version) throws ParamException, Exception {
PlatformPo platformPo = platformMapper.selectByPrimaryKey(platformId);
if(platformPo != null && !platformPo.getPlatformName().equals(platformName))
{
logger.error(String.format("platformId=%s platform has been record in database, but its name is %s, not %s",
platformId, platformPo.getPlatformName(), platformName));
throw new ParamException(String.format("platformId=%s platform has been record in database, but its name is %s, not %s",
platformId, platformPo.getPlatformName(), platformName));
}
if(this.isPlatformCheckOngoing)
{
logger.error(String.format("start platform=%s app data collect FAIL : some collect task is ongoing", platformId));
throw new Exception(String.format("start platform=%s app data collect FAIL : some collect task is ongoing", platformId));
}
try
{
this.isPlatformCheckOngoing = true;
List<PlatformAppModuleVo> modules = this.platformAppCollectService.collectPlatformAppData(platformId, platformName, domainId, hostIp, appName, version);
Map<String, List<PlatformAppModuleVo>> platformAppModuleMap = modules.stream().collect(Collectors.groupingBy(PlatformAppModuleVo::getPlatformId));
if(platformAppModuleMap.keySet().size() > 1)
{
logger.error(String.format("platformId=%s client collected data platformId not unique : [%s]",
platformId, String.join(",", platformAppModuleMap.keySet())));
throw new ClientCollectDataException(String.format("platformId=%s client collected data platformId not unique : [%s]",
platformId, String.join(",", platformAppModuleMap.keySet())));
}
else if(!platformAppModuleMap.containsKey(platformId))
{
logger.error(String.format("platformId=%s client collected data's platformId is %s",
platformId, JSONObject.toJSONString(platformAppModuleMap.keySet())));
throw new ClientCollectDataException(String.format("platformId=%s client collected data's platformId is %s",
platformId, JSONObject.toJSONString(platformAppModuleMap.keySet())));
}
platformAppModuleMap = modules.stream().collect(Collectors.groupingBy(PlatformAppModuleVo::getPlatformName));
if(platformAppModuleMap.keySet().size() > 1)
{
logger.error(String.format("platformName=%s client collected data platformName not unique : [%s]",
platformName, String.join(",", platformAppModuleMap.keySet())));
throw new ClientCollectDataException(String.format("platformName=%s client collected data platformName not unique : [%s]",
platformName, String.join(",", platformAppModuleMap.keySet())));
}
else if(!platformAppModuleMap.containsKey(platformName))
{
logger.error(String.format("platformName=%s client collected data's platformName is %s",
platformName, JSONObject.toJSONString(platformAppModuleMap.keySet())));
throw new ClientCollectDataException(String.format("platformName=%s client collected data's platformName is %s",
platformName, JSONObject.toJSONString(platformAppModuleMap.keySet())));
}
Map<String, List<PlatformAppModuleVo>> domainAppMap = modules.stream().collect(Collectors.groupingBy(PlatformAppModuleVo::getDomainId));
Map<String, DomainPo> domainMap = domainMapper.select(platformId, null).stream().collect(Collectors.toMap(DomainPo::getDomainId, Function.identity()));
for(String reportDomainId : domainAppMap.keySet())
{
Map<String, PlatformAppModuleVo> domainNameAppModuleMap = domainAppMap.get(reportDomainId)
.stream().collect(Collectors.toMap(PlatformAppModuleVo::getDomainName, Function.identity()));
if(domainNameAppModuleMap.size() > 1)
{
logger.error(String.format("domainId=%s has not unique domainName=[%s]",
reportDomainId, String.join(",", domainNameAppModuleMap.keySet())));
throw new ClientCollectDataException(String.format("domainId=%s has not unique domainName=[%s]",
reportDomainId, String.join(",", domainNameAppModuleMap.keySet())));
}
String reportDomainName = domainAppMap.get(reportDomainId).get(0).getDomainName();
if(domainMap.containsKey(reportDomainId) && domainMap.get(reportDomainId).getDomainName().equals(reportDomainName))
{
logger.error(String.format("domainId=%s is record in database, but its name=%s not %s",
reportDomainId, domainMap.get(reportDomainId).getDomainName(), reportDomainName));
throw new ClientCollectDataException(String.format("domainId=%s is record in database, but its name=%s not %s",
reportDomainId, domainMap.get(reportDomainId).getDomainName(), reportDomainName));
}
}
if(platformPo == null)
{
platformPo = modules.get(0).getPlatform();
platformMapper.insert(platformPo);
}
for(List<PlatformAppModuleVo> domainModules : domainAppMap.values())
{
DomainPo domainPo = domainModules.get(0).getDomain();
if(!domainMap.containsKey(domainPo.getDomainId()))
{
domainMapper.insert(domainPo);
}
}
Map<String, AppModuleVo> appModuleMap = new HashMap<>();
handleCollectedPlatformAppModules(appModuleMap, modules.toArray(new PlatformAppModuleVo[0]));
return modules.toArray(new PlatformAppModuleVo[0]);
}
finally {
this.isPlatformCheckOngoing = false;
}
}
@Override
public PlatformAppModuleVo[] startCheckPlatformAppData(String platformId, String platformName, String domainName, String hostIp, String appName, String version) throws Exception {
if(this.isPlatformCheckOngoing)
{
logger.error(String.format("start platform=%s app data check FAIL : some collect task is ongoing", platformId));
throw new Exception(String.format("start platform=%s app data check FAIL : some collect task is ongoing", platformId));
}
this.isPlatformCheckOngoing = true;
List<PlatformAppModuleVo> modules = this.platformAppCollectService.collectPlatformAppData(platformId, platformName, domainName, hostIp, appName, version);
this.isPlatformCheckOngoing = false;
return modules.toArray(new PlatformAppModuleVo[0]);
}
/**
* 将一组平台应用模块上传到nexus
* 如果某个模块对应的component已经在nexus存在则对比安装包的md5,如果md5不一致则报错,该平台应用模块上传失败,否则上传该平台应用模块的配置文件
* 如果component不存在则创建该应用对应的component(appName/appAlias/version),并上传该平台应用的配置文件
* @param modules 需要上传的模块
* @throws Exception
*/
void handleCollectedPlatformAppModules(Map<String, AppModuleVo> appModuleMap, PlatformAppModuleVo[] modules) throws Exception
{
Map<String, List<NexusAssetInfo>> appFileAssetMap = new HashMap<>();
for(PlatformAppModuleVo module : modules)
{
try
{
boolean handleSucc = handlePlatformAppModule(module, appModuleMap, appFileAssetMap);
if(!handleSucc)
{
logger.error(String.format("handle [%s] FAIL", module.toString()));
}
}
catch (Exception ex)
{
logger.error(String.format("handle [%s] exception", module.toString()), ex);
}
}
}
/**
* 处理客户端收集的平台应用信息
* 如果该模块在db中没有记录则需要上传二进制安装包以及配置文件并在数据库创建一条记录
* 归档平台应用的配置文件,并在数据库创建一条平台应用详情记录
* @param module 客户端收集的平台应用信息
* @param appModuleMap 已经处理的应用模块
* @param appFileAssetMap 已经处理的应用模块在nexus的存储记录
* @return 添加后的模块
* @throws DataAccessException 查询数据库异常
* @throws InterfaceCallException 调用nexus接口异常
* @throws NexusException nexus返回调用失败信息或是解析nexus调用结果失败
* @throws DBNexusNotConsistentException cmdb记录的信息和nexus不一致
*/
private boolean handlePlatformAppModule(PlatformAppModuleVo module, Map<String, AppModuleVo> appModuleMap,
Map<String, List<NexusAssetInfo>> appFileAssetMap)
throws DataAccessException, InterfaceCallException, NexusException, DBNexusNotConsistentException
{
AppPo appPo = module.getAppInfo();
String appName = appPo.getAppName();
String appVersion = appPo.getVersion();
String appDirectory = appPo.getAppNexusDirectory();
AppModuleVo moduleVo;
if(appModuleMap.containsKey(appDirectory))
{
moduleVo = appModuleMap.get(appDirectory);
}
else
{
moduleVo = appModuleMapper.selectByNameAndVersion(appName, appVersion);
}
List<NexusAssetInfo> appFileAssetList;
if(appFileAssetMap.containsKey(appDirectory))
{
appFileAssetList = appFileAssetMap.get(appDirectory);
}
else
{
String group = String.format("/%s/%s", appName, appVersion);
appFileAssetList = this.nexusService.queryGroupAssetMap(this.nexusHostUrl, this.nexusUserName, nexusPassword, this.appRepository, group);
}
if(moduleVo != null && appFileAssetList.size() == 0)
{
logger.error(String.format("cmdb data is not matched with nexus : cmdb has appName=%s and version=%s record but nexus has not",
appName, appVersion));
throw new DBNexusNotConsistentException(String.format("cmdb data is not matched with nexus : cmdb has appName=%s and version=%s record but nexus has not",
appName, appVersion));
}
if(moduleVo == null && appFileAssetList.size() > 0)
{
logger.error(String.format("cmdb data is not matched with nexus : nexus has appName=%s and version=%s record but cmdb has not",
appName, appVersion));
throw new DBNexusNotConsistentException(String.format("cmdb data is not matched with nexus : nexus has appName=%s and version=%s record but cmdb has not",
appName, appVersion));
}
if(appFileAssetList.size() == 0)
{
appFileAssetList = addAppToNexus(appName, appVersion, module.getInstallPackage(), module.getCfgs(), this.appRepository, appDirectory);
appFileAssetMap.put(appDirectory, appFileAssetList);
}
if(moduleVo == null)
{
moduleVo = addNewAppToDB(appPo, module.getInstallPackage(), module.getCfgs());
appModuleMap.put(appDirectory, moduleVo);
}
if(StringUtils.isBlank(module.getInstallPackage().getLocalSavePath()))
{
logger.error(String.format("handle [%s] FAIL : not receive install package[%s]",
module.toString(), module.getInstallPackage().getFileName()));
return false;
}
String compareResult = compareAppFileWithNexusRecord(appName, appVersion, moduleVo.getInstallPackage(), moduleVo.getCfgs(), appFileAssetList);
if(StringUtils.isNotBlank(compareResult))
{
logger.error(String.format("collected appName=%s and version=%s files is not matched with nexus : %s",
appName, appVersion, compareResult));
throw new DBNexusNotConsistentException(String.format("collected appName=%s and version=%s files is not matched with nexus : %s",
appName, appVersion, compareResult));
}
PlatformAppPo platformApp = module.getPlatformApp();
platformApp.setAppId(appPo.getAppId());
this.platformAppMapper.insert(platformApp);
for(DeployFileInfo cfgFilePo : module.getCfgs())
{
PlatformAppCfgFilePo po = new PlatformAppCfgFilePo(platformApp.getPlatformAppId(), cfgFilePo);
this.platformAppCfgFileMapper.insert(po);
}
logger.info(String.format("[%s] platform app module handle SUCCESS", module.toString()));
return true;
}
private AppModuleVo addNewAppToDB(AppPo app, DeployFileInfo installPackage, DeployFileInfo[] cfgs) throws DataAccessException
{
if(debug)
{
if(StringUtils.isBlank(app.getAppType()))
app.setAppType(AppType.CCOD_KERNEL_MODULE.name);
if(StringUtils.isBlank(app.getCcodVersion()))
app.setCcodVersion("4.5");
}
this.appMapper.insert(app);
AppInstallPackagePo instPkgPo = new AppInstallPackagePo(app.getAppId(), installPackage);
this.appInstallPackageMapper.insert(instPkgPo);
List<AppCfgFilePo> cfgList = new ArrayList<>();
for(DeployFileInfo cfg : cfgs)
{
AppCfgFilePo cfgFilePo = new AppCfgFilePo(app.getAppId(), cfg);
this.appCfgFileMapper.insert(cfgFilePo);
cfgList.add(cfgFilePo);
}
AppModuleVo moduleVo = new AppModuleVo(app, instPkgPo, cfgList);
return moduleVo;
}
private List<NexusAssetInfo> addAppToNexus(String appName, String version, DeployFileInfo installPackage, DeployFileInfo[] cfgs, String repository, String directory) throws InterfaceCallException, NexusException
{
logger.info(String.format("prepare to upload appName=%s and version=%s app to directory=%s at repository=%s",
appName, version, directory, repository));
List<DeployFileInfo> uploadFiles = new ArrayList<>();
uploadFiles.add(installPackage);
uploadFiles.addAll(Arrays.asList(cfgs));
List<NexusAssetInfo> fileAssetList = this.nexusService.uploadRawComponent(this.nexusHostUrl, this.nexusUserName, this.nexusPassword, repository, directory, uploadFiles.toArray(new DeployFileInfo[0]));
return fileAssetList;
}
/**
* 将安装包和配置文件和nexus存储的信息
* @param appName 应用名
* @param version 应用版本
* @param installPackage 安装包
* @param cfgs 配置文件
* @param NexusFileList 该应用存储在nexus的文件信息
* @return 对比结果,如果完全符合返回""
*/
private String compareAppFileWithNexusRecord(String appName, String version, AppInstallPackagePo installPackage, List<AppCfgFilePo> cfgs, List<NexusAssetInfo> NexusFileList)
{
logger.debug(String.format("begin to compare appName=%s and version=%s installPackage and cfgs with nexus record",
appName, version));
Map<String, NexusAssetInfo> nexusFileMap = NexusFileList.stream().collect(Collectors.toMap(NexusAssetInfo::getPath, Function.identity()));
StringBuffer sb = new StringBuffer();
String path = String.format("%s/%s/%s", appName, version, installPackage.getFileName());
if(!nexusFileMap.containsKey(path))
{
sb.append(String.format("installPackageFile=%s not in nexus record,", installPackage.getFileName()));;
}
else if(!nexusFileMap.get(path).getMd5().equals(installPackage.getMd5()))
{
sb.append(String.format("installPackage=%s md5=%s is not equal with nexus md5=%s,"
,installPackage.getFileName(), installPackage.getMd5(), nexusFileMap.get(path).getMd5()));;
}
if(!this.notCheckCfgAppSet.contains(appName))
{
if(cfgs.size() != nexusFileMap.size() -1)
{
sb.append(String.format("cfg count is %d but nexus is %d,", cfgs.size(), nexusFileMap.size() -1));
}
else
{
for(AppCfgFilePo cfg : cfgs)
{
path = String.format("%s/%s/%s", appName, version, cfg.getFileName());
if(!nexusFileMap.containsKey(path))
{
sb.append(String.format("cfg=%s not in nexus,", cfg.getFileName()));
}
}
}
}
logger.info(String.format("the result of files of appName=%s with version=%s compare with nexus is : %s", sb.toString()));
return sb.toString().replaceAll(",$", "");
}
@Override
public void createNewPlatformAppDataCollectTask(String platformId, String platformName, String domainId, String hostIp, String appName, String version) throws Exception {
logger.info(String.format("begin to create platformId=%s, domainId=%s, hostIp=%s, appName=%s, version=%s app collect task",
platformId, domainId, hostIp, appName, version));
if(this.isPlatformCheckOngoing)
{
logger.error(String.format("create platform collect task FaIL : some collect task is ongoing"));
throw new Exception(String.format("create platform collect task FaIL : some collect task is ongoing"));
}
ExecutorService executor = Executors.newFixedThreadPool(1);
Thread taskThread = new Thread(new Runnable(){
@Override
public void run() {
try
{
startCollectPlatformAppData(platformId, platformName, domainId, hostIp, appName, version);
}
catch (Exception ex)
{
logger.error(String.format("start platformId=%s, domainId=%s, hostIp=%s, appName=%s, version=%s app collect task exception",
platformId, domainId, hostIp, appName, version), ex);
}
}
});
executor.execute(taskThread);
executor.shutdown();
}
/**
* 部署应用到域主机
* @param domain 部署应用的域信息
* @param setId 部署该应用的域归属的set id
* @param bkSet 部署该应用的set信息
* @param hostList 平台下面的所有主机列表
* @param deployOperationList 部署的操作
* @param appList 应用记录列表
* @throws InterfaceCallException 调用蓝鲸api失败
* @throws LJPaasException 蓝鲸api返回调用失败或是解析蓝鲸api返回结果
*/
private void deployAppsToDomainHost(DomainPo domain, String setId, LJSetInfo bkSet, List<LJHostInfo> hostList,
List<AppUpdateOperationInfo> deployOperationList, List<AppModuleVo> appList)
throws InterfaceCallException, LJPaasException, NexusException, IOException
{
logger.debug(String.format("begin to add new %d apps to %s/%s(%s)/%s(%s)", deployOperationList.size(),
domain.getPlatformId(), setId, bkSet.getBkSetName(), domain.getDomainId(), domain.getDomainName()));
Date now = new Date();
List<PlatformAppPo> deployAppList = new ArrayList<>();
Map<String, LJHostInfo> hostMap = hostList.stream().collect(Collectors.toMap(LJHostInfo::getHostInnerIp, Function.identity()));
Map<String, List<AppModuleVo>> appMap = appList.stream().collect(Collectors.groupingBy(AppModuleVo::getAppName));
for(AppUpdateOperationInfo deployOperationInfo : deployOperationList)
{
Map<String, AppModuleVo> versionMap = appMap.get(deployOperationInfo.getAppName()).stream().collect(Collectors.toMap(AppModuleVo::getVersion, Function.identity()));
AppModuleVo appPo = versionMap.get(deployOperationInfo.getTargetVersion());
LJHostInfo bkHost = hostMap.get(deployOperationInfo.getHostIp());
logger.debug(String.format("insert appId=%d to hostIp=%s with appAlias=%s and deployDirectory=%s to database",
appPo.getAppId(), bkHost.getHostInnerIp(), deployOperationInfo.getAppAlias(), deployOperationInfo.getBasePath()));
PlatformAppPo deployApp = new PlatformAppPo();
deployApp.setAppAlias(deployOperationInfo.getAppAlias());
deployApp.setHostIp(bkHost.getHostInnerIp());
deployApp.setAppRunner(deployOperationInfo.getAppRunner());
deployApp.setDeployTime(now);
deployApp.setAppId(appPo.getAppId());
deployApp.setPlatformId(domain.getPlatformId());
deployApp.setBasePath(deployOperationInfo.getBasePath());
deployApp.setDomainId(domain.getDomainId());
platformAppMapper.insert(deployApp);
deployAppList.add(deployApp);
handlePlatformAppCfgs(deployApp, appPo, deployOperationInfo.getCfgs());
}
paasService.bindDeployAppsToBizSet(bkSet.getBkBizId(), setId, bkSet.getBkSetId(), bkSet.getBkSetName(), deployAppList);
}
/**
* 处理平台应用配置文件
* 处理流程:首先下载配置文件,其次将下载的配置文件按一定格式上传到nexus去,最后入库
* @param platformAppPo 平台应用
* @param appPo 该平台应用对应的app详情
* @param cfgs 配置文件信息
* @throws InterfaceCallException 接口调用失败
* @throws NexusException nexus返回失败或是处理nexus返回信息失败
* @throws IOException 保存文件失败
*/
private void handlePlatformAppCfgs(PlatformAppPo platformAppPo, AppModuleVo appPo, List<AppFileNexusInfo> cfgs) throws InterfaceCallException, NexusException, IOException
{
List<DeployFileInfo> fileList = new ArrayList<>();
List<PlatformAppCfgFilePo> cfgFileList = new ArrayList<>();
Date now = new Date();
SimpleDateFormat sf = new SimpleDateFormat("yyyyMMddHHmmss");
String directory = platformAppPo.getPlatformAppDirectory(appPo.getAppName(), appPo.getVersion(), platformAppPo);
logger.debug(String.format("begin to handle %s cfgs", directory));
String tmpSaveDir = getTempSaveDir(DigestUtils.md5DigestAsHex(directory.getBytes()));
for(AppFileNexusInfo cfg : cfgs)
{
String downloadUrl = cfg.getFileNexusDownloadUrl(this.nexusHostUrl);
logger.debug(String.format("download cfg from %s", downloadUrl));
String savePth = nexusService.downloadFile(this.nexusUserName, this.nexusPassword, downloadUrl, tmpSaveDir, cfg.getFileName());
DeployFileInfo fileInfo = new DeployFileInfo();
fileInfo.setExt(cfg.getExt());
fileInfo.setFileMd5(cfg.getMd5());
fileInfo.setLocalSavePath(savePth);
fileInfo.setNexusRepository(this.appRepository);
fileInfo.setNexusDirectory(directory);
fileInfo.setFileSize(cfg.getFileSize());
fileInfo.setFileName(cfg.getFileName());
fileList.add(fileInfo);
PlatformAppCfgFilePo cfgFilePo = new PlatformAppCfgFilePo();
cfgFilePo.setMd5(cfg.getMd5());
cfgFilePo.setFileName(cfg.getFileName());
cfgFilePo.setExt(cfg.getExt());
cfgFilePo.setPlatformAppId(platformAppPo.getPlatformAppId());
cfgFilePo.setCreateTime(now);
cfgFilePo.setDeployPath(cfg.getDeployPath());
cfgFilePo.setNexusDirectory(directory);
cfgFilePo.setNexusRepository(this.platformAppCfgRepository);
cfgFileList.add(cfgFilePo);
}
logger.debug(String.format("upload platform app cfgs to %s/%s/%s", nexusHostUrl, this.platformAppCfgRepository, directory));
Map<String, NexusAssetInfo> assetMap = nexusService.uploadRawComponent(this.nexusHostUrl, this.nexusUserName, this.nexusPassword, this.platformAppCfgRepository, directory, fileList.toArray(new DeployFileInfo[0]))
.stream().collect(Collectors.toMap(NexusAssetInfo::getPath, Function.identity()));
logger.debug(String.format("delete platformAppId=%d record from platform_app_cfg_file", platformAppPo.getPlatformAppId()));
platformAppCfgFileMapper.delete(null, platformAppPo.getPlatformAppId());
for(PlatformAppCfgFilePo cfgFilePo : cfgFileList)
{
String path = String.format("%s/%s", directory, cfgFilePo.getFileName());
cfgFilePo.setNexusAssetId(assetMap.get(path).getId());
logger.debug(String.format("insert %s cfg into platform_app_cfg_file", path));
this.platformAppCfgFileMapper.insert(cfgFilePo);
}
logger.info(String.format("handle %s cfgs SUCCESS", directory));
}
private void addNewDomainToPlatform(String domainId, String domainName, List<AppUpdateOperationInfo> domainApps,
List<AppModuleVo> appList, PlatformPo platform, String setId, LJSetInfo bkSet, List<LJHostInfo> bkHostList)
throws InterfaceCallException, LJPaasException, NexusException, IOException
{
Date now = new Date();
DomainPo newDomain = new DomainPo();
newDomain.setComment("");
newDomain.setDomainId(domainId);
newDomain.setPlatformId(platform.getPlatformId());
newDomain.setStatus(1);
newDomain.setUpdateTime(now);
newDomain.setCreateTime(now);
newDomain.setDomainName(domainName);
this.domainMapper.insert(newDomain);
deployAppsToDomainHost(newDomain, setId, bkSet, bkHostList, domainApps, appList);
}
/**
* 将指定域的一组应用删除
* @param domain 指定删除应用的域
* @param bkSet 该域归属的蓝鲸paas的set
* @param deleteOperationList 需要移除的应用操作列表
* @param appBkModuleList 被移除的应用对应的蓝鲸模块关系列表
* @throws ParamException
* @throws InterfaceCallException 调用蓝鲸api失败
* @throws LJPaasException 蓝鲸api返回调用失败或是解析蓝鲸api返回结果失败
*/
private void removeAppsFromDomainHost(DomainPo domain, LJSetInfo bkSet, List<AppUpdateOperationInfo> deleteOperationList, List<PlatformAppBkModulePo> appBkModuleList)
throws ParamException, InterfaceCallException, LJPaasException
{
logger.debug(String.format("begin to remove %d apps from platformId=%s and domainId=%s",
deleteOperationList.size(), domain.getPlatformId(), domain.getDomainId()));
List<PlatformAppBkModulePo> removedAppBkModuleList = new ArrayList<>();
Map<Integer, PlatformAppBkModulePo> appBkModuleMap = appBkModuleList.stream().collect(Collectors.toMap(PlatformAppBkModulePo::getPlatformAppId, Function.identity()));
for(AppUpdateOperationInfo deleteOperationInfo : deleteOperationList)
{
removedAppBkModuleList.add(appBkModuleMap.get(deleteOperationInfo.getPlatformAppId()));
}
this.paasService.disBindDeployAppsToBizSet(bkSet.getBkBizId(), bkSet.getBkSetId(), removedAppBkModuleList);
for(AppUpdateOperationInfo deleteOperationInfo : deleteOperationList)
{
logger.debug(String.format("delete id=%d platform app cfg record", deleteOperationInfo.getPlatformAppId()));
platformAppCfgFileMapper.delete(null, deleteOperationInfo.getPlatformAppId());
logger.debug(String.format("delete id=%d platform app record", deleteOperationInfo.getPlatformAppId()));
platformAppMapper.delete(deleteOperationInfo.getPlatformAppId(), null, null);
}
logger.debug(String.format("remove %d apps from platformId=%s and domainId=%s SUCCESS",
removedAppBkModuleList.size(), domain.getPlatformId(), domain.getDomainId()));
}
/**
* 检查平台升级计划参数是否合法
* @param schema 需要检查的平台升级计划
* @param domainList 该平台下的所有域
* @param appList 相关的应用列表
* @param deployApps 该平台已经部署的应用
* @param bkSetList 该平台的对应的蓝鲸biz下的所有set列表
* @param bkHostList 该平台下所有主机
* @param appBkModuleList 该平台升级签部署的应用和蓝鲸模块的关系表
* @return 如果检查通过返回空,否则返回检查失败原因
*/
private String checkPlatformUpdateTask(PlatformUpdateSchemaInfo schema, List<DomainPo> domainList,
List<AppModuleVo> appList, List<PlatformAppPo> deployApps,
List<LJSetInfo> bkSetList, List<LJHostInfo> bkHostList,
List<PlatformAppBkModulePo> appBkModuleList, Map<String, BizSetDefine> bizSetDefineMap)
{
if(schema.getDomainUpdatePlanList() == null)
{
schema.setDomainUpdatePlanList(new ArrayList<>());
}
Map<String, DomainPo> domainMap = domainList.stream().collect(Collectors.toMap(DomainPo::getDomainId, Function.identity()));
Map<String, DomainPo> domainNameMap = domainList.stream().collect(Collectors.toMap(DomainPo::getDomainName, Function.identity()));
Map<String, LJSetInfo> setMap = bkSetList.stream().collect(Collectors.toMap(LJSetInfo::getBkSetName, Function.identity()));
PlatformUpdateTaskType taskType = schema.getTaskType();
StringBuffer sb = new StringBuffer();
for(DomainUpdatePlanInfo planInfo : schema.getDomainUpdatePlanList())
{
if(StringUtils.isBlank(planInfo.getDomainId()) || StringUtils.isBlank(planInfo.getDomainName()))
{
return "domainId and domainName of domain update plan can not be blank";
}
else if(!Pattern.matches(this.domainIdRegex, planInfo.getDomainId()))
{
sb.append(String.format("%s,", planInfo.getDomainId()));
}
}
if(StringUtils.isNotBlank(sb.toString()))
{
return String.format("domainId %s is not regal : only wanted 0-9a-z or - and - can not be beginning or end", sb.toString().replaceAll(",$", ""));
}
Map<String, List<DomainUpdatePlanInfo>> updateDomainMap = schema.getDomainUpdatePlanList().stream().collect(Collectors.groupingBy(DomainUpdatePlanInfo::getDomainId));
Map<String, List<PlatformAppPo>> domainAppMap = deployApps.stream().collect(Collectors.groupingBy(PlatformAppPo::getDomainId));
for(String domainId : updateDomainMap.keySet())
{
if(updateDomainMap.get(domainId).size() > 1)
{
logger.error(String.format("domainId %s duplicate", domainId));
sb.append(String.format("%s;", domainId));
}
}
if(StringUtils.isNotBlank(sb.toString()))
{
return String.format("domainId %s duplicate", sb.toString().replaceAll(";$", ""));
}
updateDomainMap = schema.getDomainUpdatePlanList().stream().collect(Collectors.groupingBy(DomainUpdatePlanInfo::getDomainName));
for(String domainName : updateDomainMap.keySet())
{
if(updateDomainMap.get(domainName).size() > 1)
{
logger.error(String.format("domainName %s duplicate", domainName));
sb.append(String.format("%s;", domainName));
}
}
if(StringUtils.isNotBlank(sb.toString()))
{
return String.format("domainName %s duplicate", sb.toString().replaceAll(";$", ""));
}
for(DomainUpdatePlanInfo planInfo : schema.getDomainUpdatePlanList())
{
DomainUpdateType updateType = planInfo.getUpdateType();
if(updateType == null)
{
sb.append(String.format("DomainUpdateType of %s is blank;", JSONObject.toJSONString(planInfo)));
continue;
}
switch (updateType)
{
case ADD:
if(domainMap.containsKey(planInfo.getDomainId()))
{
sb.append(String.format("%s domain %s, but %s exist;",
updateType.name, planInfo.getDomainId(), planInfo.getDomainId()));
continue;
}
else if(domainNameMap.containsKey(planInfo.getDomainName()))
{
sb.append(String.format("%s domain %s, but %s exist;",
updateType.name, planInfo.getDomainName(), planInfo.getDomainName()));
continue;
}
break;
default:
if(!domainMap.containsKey(planInfo.getDomainId()))
{
sb.append(String.format("%s domain %s, but %s not exist;",
updateType.name, planInfo.getDomainId(), planInfo.getDomainId()));
continue;
}
else if(!domainNameMap.containsKey(planInfo.getDomainName()))
{
sb.append(String.format("%s domain %s, but %s not exist;",
updateType.name, planInfo.getDomainName(), planInfo.getDomainName()));
continue;
}
else if(!setMap.containsKey(planInfo.getBkSetName()))
{
sb.append(String.format("%s %s of %s of domain %s not exist;",
updateType.name, planInfo.getDomainId(), planInfo.getBkSetName()));
continue;
}
break;
}
switch (taskType)
{
case CREATE:
switch (updateType)
{
case ADD:
if(!bizSetDefineMap.containsKey(planInfo.getBkSetName()))
{
sb.append(String.format("setName %s of new create domain %s not exist",
planInfo.getBkSetName(), planInfo.getDomainId()));
continue;
}
break;
default:
sb.append(String.format("%s of %s only support %s %s, not %s;",
taskType.name, schema.getPlatformId(), DomainUpdateType.ADD.name, planInfo.getDomainId(), updateType.name));
continue;
}
break;
case DELETE:
switch (updateType)
{
case DELETE:
break;
default:
sb.append(String.format("%s of %s only support %s %s, not %s;",
taskType.name, schema.getPlatformId(), DomainUpdateType.ADD.name, planInfo.getDomainId(), updateType.name));
continue;
}
break;
case UPDATE:
switch (updateType)
{
case ADD:
if(!setMap.containsKey(planInfo.getBkSetName()))
{
sb.append(String.format("bkSetName=%s of domain %s not exist;",
planInfo.getBkSetName(), planInfo.getDomainId()));
continue;
}
break;
default:
break;
}
break;
}
if(planInfo.getAppUpdateOperationList() == null || planInfo.getAppUpdateOperationList().size() == 0)
{
// sb.append(String.format("operation of %s %s is blank;", updateType.name, planInfo.getDomainId()));
continue;
}
List<PlatformAppPo> domainAppList = new ArrayList<>();
if(domainAppMap.containsKey(planInfo.getDomainId()))
{
domainAppList = domainAppMap.get(planInfo.getDomainId());
}
String operationCheckResult = updateOperationCheck(updateType, planInfo.getAppUpdateOperationList(), appList, domainAppList, appBkModuleList, bkHostList);
sb.append(operationCheckResult);
}
// Map<String, List<AppUpdateOperationInfo>> ipAppMap = allOperationList.stream().collect(Collectors.groupingBy(AppUpdateOperationInfo::getHostIp));
// for(String hostIp : ipAppMap.keySet())
// {
// Map<String, List<AppUpdateOperationInfo>> appNameMap = ipAppMap.get(hostIp).stream().collect(Collectors.groupingBy(AppUpdateOperationInfo::getAppName));
// for(String appName : appNameMap.keySet())
// {
// if(appNameMap.get(appName).size() > 1)
// {
// Set<String> aliasSet = new HashSet<>();
// for(AppUpdateOperationInfo opt : appNameMap.get(appName))
// {
// switch (opt.getOperation())
// {
// case ADD:
// case CFG_UPDATE:
// case VERSION_UPDATE:
// if(aliasSet.contains(opt.getAppAlias()))
// {
// sb.append(String.format("%s at %s alias duplicate;", appName, hostIp));
// }
// else
// {
// aliasSet.add(opt.getAppAlias());
// }
// default:
// break;
// }
// }
// }
// }
// }
return sb.toString();
}
/**
* 验证应用升级操作的相关蚕食是否正确
* @param updateType 域升级方案类型
* @param operationList 域升级的应用升级操作明细
* @param appList 当前应用列表
* @param deployApps 域已经部署的应用列表
* @param appBkModuleList 已经部署的应用和蓝鲸模块的关系表
* @param hostList 平台下所有服务器列表
* @return 检查结果,如果为空则表示检查通过,否则返回检查失败原因
*/
private String updateOperationCheck(DomainUpdateType updateType, List<AppUpdateOperationInfo> operationList, List<AppModuleVo> appList, List<PlatformAppPo> deployApps, List<PlatformAppBkModulePo> appBkModuleList, List<LJHostInfo> hostList)
{
Map<String, LJHostInfo> hostMap = hostList.stream().collect(Collectors.toMap(LJHostInfo::getHostInnerIp, Function.identity()));
Map<String, List<AppModuleVo>> appMap = appList.stream().collect(Collectors.groupingBy(AppModuleVo::getAppName));
Map<Integer, PlatformAppBkModulePo> appBkModuleMap = appBkModuleList.stream().collect(Collectors.toMap(PlatformAppBkModulePo::getPlatformAppId, Function.identity()));
Map<Integer, PlatformAppPo> platformAppMap = deployApps.stream().collect(Collectors.toMap(PlatformAppPo::getPlatformAppId, Function.identity()));
StringBuffer sb = new StringBuffer();
Set<String> deployAppSet = new HashSet<>();
for(PlatformAppPo po : deployApps)
{
if(deployAppSet.contains(po.getAppAlias()))
{
sb.append(String.format("%s,", po.getAppAlias()));
}
else
{
deployAppSet.add(po.getAppAlias());
}
}
if(StringUtils.isNotBlank(sb.toString()))
{
return String.format("alias %s duplicate;", sb.toString().replaceAll(",$", ""));
}
for(AppUpdateOperationInfo operationInfo : operationList)
{
if(operationInfo.getOperation() == null)
{
sb.append(String.format("operationType of %s is blank;", JSONObject.toJSONString(operationInfo)));
}
else if(AppUpdateOperation.START.equals(operationInfo.getOperation()) || AppUpdateOperation.STOP.equals(operationInfo.getOperation()))
{
sb.append(String.format("%s of %s is not support now", operationInfo.getOperation().name, JSONObject.toJSONString(operationInfo)));
}
else if(DomainUpdateType.ADD.equals(updateType) && !AppUpdateOperation.ADD.equals(operationInfo.getOperation()))
{
sb.append(String.format("DomainUpdateType=%s only support AppUpdateOperation=%s, not %s of %s;",
DomainUpdateType.ADD.name, AppUpdateOperation.ADD.name, operationInfo.getOperation().name, JSONObject.toJSONString(operationInfo)));
}
else if(DomainUpdateType.DELETE.equals(updateType) && !AppUpdateOperation.DELETE.equals(operationInfo.getOperation()))
{
sb.append(String.format("DomainUpdateType=%s only support AppUpdateOperation=%s, not %s of %s;",
DomainUpdateType.DELETE.name, AppUpdateOperation.DELETE.name, operationInfo.getOperation().name, JSONObject.toJSONString(operationInfo)));
}
else if(!appMap.containsKey(operationInfo.getAppName()))
{
sb.append(String.format("appName %s of %s not exist;", operationInfo.getAppName(), JSONObject.toJSONString(operationInfo)));
}
else if(StringUtils.isBlank(operationInfo.getHostIp()))
{
sb.append(String.format("host of %s is blank;", JSONObject.toJSONString(operationInfo)));
}
else if(!hostMap.containsKey(operationInfo.getHostIp()))
{
sb.append(String.format("host %s of %s not exist;", operationInfo.getHostIp(), JSONObject.toJSONString(operationInfo)));
}
else
{
Map<String, AppModuleVo> versionMap = appMap.get(operationInfo.getAppName()).stream().collect(Collectors.toMap(AppModuleVo::getVersion, Function.identity()));
AppUpdateOperation operation = operationInfo.getOperation();
switch (operation)
{
case ADD:
if(StringUtils.isBlank(operationInfo.getTargetVersion()))
{
sb.append(String.format("%s : version of %s is blank;", operation.name, operationInfo.getAppName()));
}
else if(!versionMap.containsKey(operationInfo.getTargetVersion()))
{
sb.append(String.format("%s : version %s of %s not exist;", operation.name, operationInfo.getTargetVersion(), operationInfo.getAppName()));
}
if(StringUtils.isBlank(operationInfo.getAppAlias()))
{
sb.append(String.format("%s : alias of %s is blank;", operation.name, operationInfo.getAppName()));
}
else if(deployAppSet.contains(operationInfo.getAppAlias()))
{
sb.append(String.format("%s : alias %s duplicate;", operation.name, operationInfo.getAppAlias()));
}
else
{
deployAppSet.add(operationInfo.getAppAlias());
}
if(StringUtils.isBlank(operationInfo.getBasePath()))
{
sb.append(String.format("%s : basePath of %s is blank;", operation.name, operationInfo.getAppAlias()));
}
if(StringUtils.isBlank(operationInfo.getAppRunner()))
{
sb.append(String.format("%s : appRunner of %s is blank;", operation.name, operationInfo.getAppAlias()));
}
if(operationInfo.getCfgs() == null || operationInfo.getCfgs().size() == 0)
{
sb.append(String.format("%s : cfg of %s is 0;", operation.name, operationInfo.getAppAlias()));
}
else
{
String compareResult = cfgFileCompare(versionMap.get(operationInfo.getTargetVersion()), operationInfo.getCfgs());
if(StringUtils.isNotBlank(compareResult))
sb.append(String.format("%s : cfg of %s is not match [%s];", operation.name, operationInfo.getAppAlias(), compareResult));
}
break;
case VERSION_UPDATE:
if(!platformAppMap.containsKey(operationInfo.getPlatformAppId()))
{
sb.append(String.format("%s : platformAppId=%d of %s not exist", operation.name, operationInfo.getPlatformAppId(), operationInfo.getAppName()));
}
if(StringUtils.isBlank(operationInfo.getTargetVersion()))
{
sb.append(String.format("%s : target version of %s is blank;", operation.name, operationInfo.getAppName()));
}
else if(!versionMap.containsKey(operationInfo.getTargetVersion()))
{
sb.append(String.format("%s : target version %s of %s not exist;", operation.name, operationInfo.getTargetVersion(), operationInfo.getAppName()));
}
if(StringUtils.isBlank(operationInfo.getOriginalVersion()))
{
sb.append(String.format("%s : original version of %s is blank;", operation.name, operationInfo.getAppName()));
}
else if(!versionMap.containsKey(operationInfo.getOriginalVersion()))
{
sb.append(String.format("%s : original version %s of %s not exist;", operation.name, operationInfo.getOriginalVersion(), operationInfo.getAppName()));
}
if(StringUtils.isBlank(operationInfo.getAppAlias()))
{
sb.append(String.format("%s : alias of %s is blank;", operation.name, operationInfo.getAppName()));
}
else if(!deployAppSet.contains(operationInfo.getAppAlias()))
{
sb.append(String.format("%s : alias of %s not exist;", operation.name, operationInfo.getAppName()));
}
if(operationInfo.getCfgs() == null || operationInfo.getCfgs().size() == 0)
{
sb.append(String.format("%s : cfg of %s is 0;", operation.name, JSONObject.toJSONString(operationInfo)));
}
if(!appBkModuleMap.containsKey(operationInfo.getPlatformAppId()))
{
sb.append(String.format("%s : platformAppId=%d of %s lj paas module relation not exist;", operation.name, operationInfo.getPlatformAppId(), JSONObject.toJSONString(operationInfo)));
}
else
{
String compareResult = cfgFileCompare(versionMap.get(operationInfo.getTargetVersion()), operationInfo.getCfgs());
if(StringUtils.isNotBlank(compareResult))
sb.append(String.format("%s : cfg of %s is not match [%s];", operation.name, JSONObject.toJSONString(operationInfo), compareResult));
}
break;
case CFG_UPDATE:
if(StringUtils.isBlank(operationInfo.getOriginalVersion()))
{
sb.append(String.format("%s : original version of %s is blank;", operation.name, operationInfo.getAppName()));
}
else if(!versionMap.containsKey(operationInfo.getOriginalVersion()))
{
sb.append(String.format("%s : original version %s of %s not exist;", operation.name, operationInfo.getOriginalVersion(), operationInfo.getAppName()));
}
if(StringUtils.isBlank(operationInfo.getAppAlias()))
{
sb.append(String.format("%s : alias of %s is blank;", operation.name, JSONObject.toJSONString(operationInfo)));
}
else if(!deployAppSet.contains(operationInfo.getAppAlias()))
{
sb.append(String.format("%s : %s of %s not exist;", operation.name, operationInfo.getAppAlias(), operationInfo.getAppName()));
}
if(operationInfo.getCfgs() == null || operationInfo.getCfgs().size() == 0)
{
sb.append(String.format("%s : cfg of %s is 0;", operation.name, JSONObject.toJSONString(operationInfo)));
}
if(!appBkModuleMap.containsKey(operationInfo.getPlatformAppId()))
{
sb.append(String.format("%s : platformAppId=%d of %s lj paas module relation not exist;", operation.name, operationInfo.getPlatformAppId(), JSONObject.toJSONString(operationInfo)));
}
else
{
String compareResult = cfgFileCompare(versionMap.get(operationInfo.getOriginalVersion()), operationInfo.getCfgs());
if(StringUtils.isNotBlank(compareResult))
sb.append(String.format("%s : cfg of %s is not match[%s];", operation.name, JSONObject.toJSONString(operationInfo), compareResult));
}
break;
case DELETE:
if(StringUtils.isBlank(operationInfo.getOriginalVersion()))
{
sb.append(String.format("%s : original version of %s is blank;", operation.name, JSONObject.toJSONString(operationInfo)));
}
else if(!versionMap.containsKey(operationInfo.getOriginalVersion()))
{
sb.append(String.format("%s : original version %s of %s not exist;", operation.name, operationInfo.getOriginalVersion(), JSONObject.toJSONString(operationInfo)));
}
if(StringUtils.isBlank(operationInfo.getAppAlias()))
{
sb.append(String.format("%s : alias of %s is blank;", operation.name, JSONObject.toJSONString(operationInfo)));
}
else if(!deployAppSet.contains(operationInfo.getAppAlias()))
{
sb.append(String.format("%s : %s of %s not exist;", operation.name, operationInfo.getAppAlias(), operationInfo.getAppName()));
}
else
{
deployAppSet.remove(operationInfo.getAppAlias());
}
if(!appBkModuleMap.containsKey(operationInfo.getPlatformAppId()))
{
sb.append(String.format("%s : platformAppId=%d of %s lj paas module relation not exist;", operation.name, operationInfo.getPlatformAppId(), JSONObject.toJSONString(operationInfo)));
}
break;
default:
}
}
}
return sb.toString();
}
/**
* 将平台升级结果保存到数据库并同步给蓝鲸paas
* @param schemaInfo 执行完的平台升级计划
* @param platformPo 执行计划的平台信息
* @param domainList 平台下的所有域列表
* @param appList 当前应用列表
* @param deployApps 执行升级计划前部署应用列表
* @param appBkModuleList 执行升级计划前部署应用同蓝鲸paas平台的关系
* @param bkSetList 该平台对应蓝鲸biz下的所有set列表
* @param bkHostList 该平台所有服务器列表
* @throws ParamException
* @throws InterfaceCallException 调用蓝鲸api或是nexus的api失败
* @throws LJPaasException 蓝鲸api返回接口调用失败或是解析蓝鲸api返回结果失败
* @throws NexusException nexus api返回调用失败或是解析nexus api的返回结果失败
* @throws IOException 处理文件失败
*/
private void recordPlatformUpdateResult(PlatformUpdateSchemaInfo schemaInfo, PlatformPo platformPo,
List<DomainPo> domainList, List<AppModuleVo> appList, List<PlatformAppPo> deployApps,
List<PlatformAppBkModulePo> appBkModuleList, List<LJSetInfo> bkSetList,
List<LJHostInfo> bkHostList) throws ParamException, InterfaceCallException, LJPaasException, NexusException, IOException
{
Map<String, LJSetInfo> setMap = bkSetList.stream().collect(Collectors.toMap(LJSetInfo::getBkSetName, Function.identity()));
Map<String, DomainPo> domainMap = domainList.stream().collect(Collectors.toMap(DomainPo::getDomainId, Function.identity()));
Map<Integer, PlatformAppPo> platformAppMap = deployApps.stream().collect(Collectors.toMap(PlatformAppPo::getPlatformAppId, Function.identity()));
Map<String, List<AppModuleVo>> appMap = appList.stream().collect(Collectors.groupingBy(AppModuleVo::getAppName));
for(DomainUpdatePlanInfo planInfo : schemaInfo.getDomainUpdatePlanList())
{
switch (planInfo.getUpdateType())
{
case ADD:
addNewDomainToPlatform(planInfo.getDomainId(), planInfo.getDomainName(), planInfo.getAppUpdateOperationList(),
appList, platformPo, planInfo.getSetId(), setMap.get(planInfo.getBkSetName()), bkHostList);
break;
case DELETE:
deleteDomainFromPlatform(domainMap.get(planInfo.getDomainId()), setMap.get(planInfo.getBkSetName()), planInfo.getAppUpdateOperationList(), bkHostList);
break;
default:
DomainPo domainPo = domainMap.get(planInfo.getDomainId());
LJSetInfo bkSet = setMap.get(planInfo.getBkSetName());
Map<AppUpdateOperation, List<AppUpdateOperationInfo>> operationMap = planInfo.getAppUpdateOperationList().stream().collect(Collectors.groupingBy(AppUpdateOperationInfo::getOperation));
if(operationMap.containsKey(AppUpdateOperation.DELETE))
{
removeAppsFromDomainHost(domainPo, bkSet, operationMap.get(AppUpdateOperation.DELETE), appBkModuleList);
}
if(operationMap.containsKey(AppUpdateOperation.VERSION_UPDATE))
{
for(AppUpdateOperationInfo updateOperationInfo : operationMap.get(AppUpdateOperation.VERSION_UPDATE))
{
Map<String, AppModuleVo> versionMap = appMap.get(updateOperationInfo.getAppName()).stream().collect(Collectors.toMap(AppModuleVo::getVersion, Function.identity()));
updateDeployAppModuleVersion(updateOperationInfo, platformAppMap.get(updateOperationInfo.getPlatformAppId()), versionMap.get(updateOperationInfo.getOriginalVersion()), versionMap.get(updateOperationInfo.getTargetVersion()));
}
}
if(operationMap.containsKey(AppUpdateOperation.CFG_UPDATE))
{
for(AppUpdateOperationInfo cfgOperationInfo : operationMap.get(AppUpdateOperation.CFG_UPDATE))
{
Map<String, AppModuleVo> versionMap = appMap.get(cfgOperationInfo.getAppName()).stream().collect(Collectors.toMap(AppModuleVo::getVersion, Function.identity()));
modifyDeployAppModuleCfg(cfgOperationInfo, platformAppMap.get(cfgOperationInfo.getPlatformAppId()), versionMap.get(cfgOperationInfo.getOriginalVersion()));
}
}
if(operationMap.containsKey(AppUpdateOperation.ADD))
{
deployAppsToDomainHost(domainPo, planInfo.getSetId(), bkSet, bkHostList, operationMap.get(AppUpdateOperation.ADD), appList);
}
}
}
}
private String cfgFileCompare(AppModuleVo app, List<AppFileNexusInfo> cfgs)
{
StringBuffer sb = new StringBuffer();
Map<String, AppCfgFilePo> appCfgMap = app.getCfgs().stream().collect(Collectors.toMap(AppCfgFilePo::getFileName, Function.identity()));
Map<String, AppFileNexusInfo> comparedCfgMap = cfgs.stream().collect(Collectors.toMap(AppFileNexusInfo::getFileName, Function.identity()));
for(String fileName : appCfgMap.keySet())
{
if(!comparedCfgMap.containsKey(fileName))
{
sb.append(String.format("cfg %s is not exist,", fileName));
}
}
for(String fileName : comparedCfgMap.keySet())
{
if(!appCfgMap.containsKey(fileName))
{
sb.append(String.format("%s is not wanted cfg,", fileName));
}
}
sb.toString().replaceAll(",$", "");
return sb.toString();
}
@Override
public void updatePlatformUpdateSchema(PlatformUpdateSchemaInfo updateSchema) throws ParamException, InterfaceCallException, LJPaasException, NexusException, IOException {
logger.debug(String.format("begin to update platform update schema : %s", JSONObject.toJSONString(updateSchema)));
Date now = new Date();
if(StringUtils.isBlank(updateSchema.getPlatformId()))
{
logger.error(String.format("platformId of update schema is blank"));
throw new ParamException(String.format("platformId of update schema is blank"));
}
else if(StringUtils.isBlank(updateSchema.getPlatformName()))
{
logger.error(String.format("platformName of update schema is blank"));
throw new ParamException(String.format("platformName of update schema is blank"));
}
else if(updateSchema.getBkBizId() <= 0)
{
logger.error(String.format("bkBizId of update schema is 0"));
throw new ParamException(String.format("not bkBizId of update schema"));
}
LJBizInfo bkBiz = paasService.queryBizInfoById(updateSchema.getBkBizId());
if(bkBiz == null)
{
logger.error(String.format("bkBizId=%d biz not exist", updateSchema.getBkBizId()));
throw new ParamException(String.format("bkBizId=%d biz not exist", updateSchema.getBkBizId()));
}
if(!updateSchema.getPlatformName().equals(bkBiz.getBkBizName()))
{
logger.error(String.format("bkBizName of bizBkId is %s, not %s", updateSchema.getBkBizId(), bkBiz.getBkBizName(), updateSchema.getPlatformName()));
throw new ParamException(String.format("bkBizName of bizBkId is %s, not %s", updateSchema.getBkBizId(), bkBiz.getBkBizName(), updateSchema.getPlatformName()));
}
PlatformPo platformPo = platformMapper.selectByPrimaryKey(updateSchema.getPlatformId());
if(platformPo == null)
{
if(!updateSchema.getStatus().equals(UpdateStatus.CREATE))
{
logger.error(String.format("%s platform %s not exist", updateSchema.getStatus().name, updateSchema.getPlatformId()));
throw new ParamException(String.format("%s platform %s not exist", updateSchema.getStatus().name, updateSchema.getPlatformId()));
}
else
{
platformPo = new PlatformPo(updateSchema.getPlatformId(), updateSchema.getPlatformName(),
updateSchema.getBkBizId(), updateSchema.getBkCloudId(), CCODPlatformStatus.SCHEMA_CREATE_PLATFORM,
updateSchema.getCcodVersion(), "create by platform create schema");
if(StringUtils.isNotBlank(updateSchema.getCcodVersion()))
{
platformPo.setCcodVersion("CCOD4.1");
}
this.platformMapper.insert(platformPo);
}
}
if(!platformPo.getPlatformName().equals(updateSchema.getPlatformName()))
{
logger.error(String.format("platformName of %s is %s, not %s",
platformPo.getPlatformId(), platformPo.getPlatformName(), updateSchema.getPlatformName()));
throw new ParamException(String.format("bkBizName of bizBkId is %s, not %s", updateSchema.getBkBizId(), bkBiz.getBkBizName(), updateSchema.getPlatformName()));
}
if(updateSchema.getPlatformId().equals("ccAppTest"))
{
updateSchema.setStatus(UpdateStatus.SUCCESS);
for(DomainUpdatePlanInfo planInfo : updateSchema.getDomainUpdatePlanList())
{
planInfo.setStatus(UpdateStatus.SUCCESS);
}
}
CCODPlatformStatus platformStatus = CCODPlatformStatus.getEnumById(platformPo.getStatus());
if(platformStatus == null)
{
logger.error(String.format("%s status %d is unknown", platformPo.getPlatformId(), platformPo.getStatus()));
throw new ParamException(String.format("%s status %d is unknown", platformPo.getPlatformId(), platformPo.getStatus()));
}
switch (updateSchema.getTaskType())
{
case CREATE:
switch (platformStatus)
{
case SCHEMA_CREATE_PLATFORM:
if(StringUtils.isBlank(updateSchema.getCcodVersion()))
{
logger.error(String.format("ccod version of %s is blank", updateSchema.getPlatformId()));
throw new ParamException(String.format("ccod version of %s is blank", updateSchema.getPlatformId()));
}
break;
default:
logger.error(String.format("not support %s platform %s which status is %s",
updateSchema.getTaskType().name, updateSchema.getPlatformId(), platformStatus.name));
throw new ParamException(String.format("not support %s platform %s which status is %s",
updateSchema.getTaskType().name, updateSchema.getPlatformId(), platformStatus.name));
}
break;
case UPDATE:
switch (platformStatus)
{
case WAIT_SYNC_EXIST_PLATFORM_TO_PAAS:
case UNKNOWN:
case SCHEMA_CREATE_PLATFORM:
logger.error(String.format("not support %s platform %s which status is %s",
updateSchema.getTaskType().name, updateSchema.getPlatformId(), platformStatus.name));
throw new ParamException(String.format("not support %s platform %s which status is %s",
updateSchema.getTaskType().name, updateSchema.getPlatformId(), platformStatus.name));
default:
break;
}
break;
default:
logger.error(String.format("current version not support %s %s", updateSchema.getTaskType().name, updateSchema.getPlatformId()));
throw new ParamException(String.format("current version not support %s %s", updateSchema.getTaskType().name, updateSchema.getPlatformId()));
}
List<DomainPo> domainList = this.domainMapper.select(updateSchema.getPlatformId(), null);
List<AppModuleVo> appList = this.appModuleMapper.select(null, null, null, null);
List<PlatformAppPo> deployApps = this.platformAppMapper.select(updateSchema.getPlatformId(), null, null, null, null, null);
List<LJSetInfo> bkSetList = this.paasService.queryBkBizSet(updateSchema.getBkBizId());
List<LJHostInfo> bkHostList = this.paasService.queryBKHost(updateSchema.getBkBizId(), null, null, null, null);
List<PlatformAppBkModulePo> appBkModuleList = this.platformAppBkModuleMapper.select(updateSchema.getPlatformId(), null, null, null, null, null);
Map<String, BizSetDefine> bizSetDefineMap = paasService.queryCCODBizSet(false).stream().collect(Collectors.toMap(BizSetDefine::getName, Function.identity()));
String schemaCheckResult;
logger.debug(String.format("%s %s has been %s", updateSchema.getTaskType().name, updateSchema.getPlatformId(), updateSchema.getStatus().name));
switch (updateSchema.getTaskType())
{
case CREATE:
switch (updateSchema.getStatus())
{
case CANCEL:
case FAIL:
this.platformUpdateSchemaMap.remove(updateSchema.getPlatformId());
this.platformUpdateSchemaMapper.delete(updateSchema.getPlatformId());
this.platformMapper.delete(updateSchema.getPlatformId());
break;
case SUCCESS:
schemaCheckResult = checkPlatformUpdateTask(updateSchema, domainList, appList, deployApps, bkSetList, bkHostList, appBkModuleList, bizSetDefineMap);
if(StringUtils.isNotBlank(schemaCheckResult))
{
logger.error(String.format("schema is not legal : %s", schemaCheckResult));
throw new ParamException(String.format("schema is not legal : %s", schemaCheckResult));
}
recordPlatformUpdateResult(updateSchema, platformPo, domainList, appList, deployApps, appBkModuleList, bkSetList, bkHostList);
if(this.platformUpdateSchemaMap.containsKey(updateSchema.getPlatformId()))
this.platformUpdateSchemaMap.remove(updateSchema.getPlatformId());
this.platformUpdateSchemaMapper.delete(updateSchema.getPlatformId());
platformPo.setStatus(CCODPlatformStatus.RUNNING.id);
platformPo.setUpdateTime(now);
this.platformMapper.update(platformPo);
break;
default:
schemaCheckResult = checkPlatformUpdateTask(updateSchema, domainList, appList, deployApps, bkSetList, bkHostList, appBkModuleList, bizSetDefineMap);
if(StringUtils.isNotBlank(schemaCheckResult))
{
logger.error(String.format("schema is not legal : %s", schemaCheckResult));
throw new ParamException(String.format("schema is not legal : %s", schemaCheckResult));
}
this.platformUpdateSchemaMapper.delete(updateSchema.getPlatformId());
this.platformUpdateSchemaMap.put(updateSchema.getPlatformId(), updateSchema);
PlatformUpdateSchemaPo schemaPo = new PlatformUpdateSchemaPo();
schemaPo.setPlatformId(updateSchema.getPlatformId());
schemaPo.setContext(JSONObject.toJSONString(updateSchema).getBytes());
platformUpdateSchemaMapper.insert(schemaPo);
break;
}
break;
case UPDATE:
switch (updateSchema.getStatus())
{
case CANCEL:
case FAIL:
this.platformUpdateSchemaMap.remove(updateSchema.getPlatformId());
this.platformUpdateSchemaMapper.delete(updateSchema.getPlatformId());
platformPo.setStatus(CCODPlatformStatus.RUNNING.id);
platformPo.setUpdateTime(now);
this.platformMapper.update(platformPo);
break;
case SUCCESS:
schemaCheckResult = checkPlatformUpdateTask(updateSchema, domainList, appList, deployApps, bkSetList, bkHostList, appBkModuleList, bizSetDefineMap);
if(StringUtils.isNotBlank(schemaCheckResult))
{
logger.error(String.format("schema is not legal : %s", schemaCheckResult));
throw new ParamException(String.format("schema is not legal : %s", schemaCheckResult));
}
recordPlatformUpdateResult(updateSchema, platformPo, domainList, appList, deployApps, appBkModuleList, bkSetList, bkHostList);
if(this.platformUpdateSchemaMap.containsKey(updateSchema.getPlatformId()))
this.platformUpdateSchemaMap.remove(updateSchema.getPlatformId());
this.platformUpdateSchemaMapper.delete(updateSchema.getPlatformId());
platformPo.setStatus(CCODPlatformStatus.RUNNING.id);
platformPo.setUpdateTime(now);
this.platformMapper.update(platformPo);
break;
default:
schemaCheckResult = checkPlatformUpdateTask(updateSchema, domainList, appList, deployApps, bkSetList, bkHostList, appBkModuleList, bizSetDefineMap);
if(StringUtils.isNotBlank(schemaCheckResult))
{
logger.error(String.format("schema is not legal : %s", schemaCheckResult));
throw new ParamException(String.format("schema is not legal : %s", schemaCheckResult));
}
this.platformUpdateSchemaMap.put(updateSchema.getPlatformId(), updateSchema);
platformPo.setStatus(CCODPlatformStatus.SCHEMA_UPDATE_PLATFORM.id);
platformPo.setUpdateTime(now);
platformMapper.update(platformPo);
platformUpdateSchemaMapper.delete(updateSchema.getPlatformId());
PlatformUpdateSchemaPo schemaPo = new PlatformUpdateSchemaPo();
schemaPo.setPlatformId(updateSchema.getPlatformId());
schemaPo.setContext(JSONObject.toJSONString(updateSchema).getBytes());
platformUpdateSchemaMapper.insert(schemaPo);
break;
}
break;
default:
logger.error(String.format("current version not support platform %s", updateSchema.getTaskType().name));
throw new ParamException(String.format("current version not support platform %s", updateSchema.getTaskType().name));
}
}
// private DomainUpdatePlanInfo generateDomainUpdatePlan(DomainUpdateType updateType, UpdateStatus updateStatus, AppUpdateOperation operation, int domId, String domainName, String domainId, List<CCODModuleInfo> deployApps, List<AppPo> appList)
// {
// Date now = new Date();
// DomainUpdatePlanInfo planInfo = new DomainUpdatePlanInfo();
// planInfo.setDomainId(domainId);
// planInfo.setDomainName(domainName);
// planInfo.setCreateTime(now);
// planInfo.setUpdateTime(now);
// planInfo.setExecuteTime(now);
// List<AppUpdateOperationInfo> operationList = new ArrayList<>();
// Map<String, List<AppPo>> nameAppMap = appList.stream().collect(Collectors.groupingBy(AppPo::getAppName));
// for(CCODModuleInfo deployApp : deployApps)
// {
// Map<String, AppPo> versionAppMap = nameAppMap.get(deployApp.getModuleName()).stream().collect(Collectors.toMap(AppPo::getVersion, Function.identity()));
// AppPo chosenApp = versionAppMap.get(deployApp.getVersion());
// if(!DomainUpdateType.ADD.equals(updateType))
// {
// for(String version : versionAppMap.keySet())
// {
// if(!version.equals(deployApp.getVersion()))
// {
// chosenApp = versionAppMap.get(version);
// break;
// }
// }
// }
// AppUpdateOperationInfo operationInfo = generateAppUpdateOperation(operation, deployApp, chosenApp, updateStatus);
// operationList.add(operationInfo);
// }
// planInfo.setAppUpdateOperationList(operationList);
// return planInfo;
// }
// private AppUpdateOperationInfo generateAppUpdateOperation(AppUpdateOperation operation, CCODModuleInfo deployApp, AppPo targetApp, UpdateStatus updateStatus)
// {
// Date now = new Date();
// AppUpdateOperationInfo info = new AppUpdateOperationInfo();
//// info.setAppRunner(deployApp.getAppRunner());
//// info.setBasePath(deployApp.getBasePath());
//// info.setHostIp(deployApp.getHostIp());
//// info.setCfgs(new ArrayList<>());
//// for(PlatformAppCfgFilePo cfg : deployApp.getCfgs())
//// {
//// AppFileNexusInfo fileInfo = new AppFileNexusInfo();
//// fileInfo.setDeployPath(deployApp.get);
//// NexusAssetInfo assetInfo = new NexusAssetInfo();
//// Checksum checksum = new Checksum();
//// checksum.md5 = cfg.getMd5();
//// assetInfo.setChecksum(checksum);
//// assetInfo.setId(cfg.getNexusAssetId());
//// assetInfo.setPath(cfg.getNexusDirectory());
//// assetInfo.setRepository(cfg.getNexusRepository());
//// info.getCfgs().add(assetInfo);
//// }
//// info.setOperation(operation);
//// info.setOriginalAppId(deployApp.getAppId());
//// info.setTargetAppId(deployApp.getAppId());
//// switch (operation)
//// {
//// case ADD:
//// info.setOriginalAppId(0);
//// break;
//// case DELETE:
//// info.setTargetAppId(0);
//// info.setCfgs(new ArrayList<>());
//// break;
//// case CFG_UPDATE:
//// info.setTargetAppId(0);
//// break;
//// default:
//// break;
//// }
// return info;
// }
/**
* 将某个域从平台移除
* @param deleteDomain 需要删除的域
* @param bkSet 该域归属的蓝鲸paas的set
* @param bkHostList 该域关联的服务器信息
* @throws InterfaceCallException 调用蓝鲸api异常
* @throws LJPaasException 蓝鲸api返回调用失败或是解析蓝鲸返回消息失败
*/
private void deleteDomainFromPlatform(DomainPo deleteDomain, LJSetInfo bkSet, List<AppUpdateOperationInfo> deleteOperationList, List<LJHostInfo> bkHostList)
throws ParamException, InterfaceCallException, LJPaasException
{
logger.debug(String.format("begin to remove domainId=%s and domainName=%s from platformId=%s",
deleteDomain.getDomainId(), deleteDomain.getDomainName(), deleteDomain.getPlatformId()));
List<PlatformAppBkModulePo> domainBkModuleList = this.platformAppBkModuleMapper.select(deleteDomain.getPlatformId(),
deleteDomain.getDomainId(), null, null, null, null);
this.removeAppsFromDomainHost(deleteDomain, bkSet, deleteOperationList, domainBkModuleList);
logger.debug(String.format("delete all domainId=%s and platformId=%s app record",
deleteDomain.getDomainId(), deleteDomain.getPlatformId()));
platformAppMapper.delete(null, deleteDomain.getPlatformId(), deleteDomain.getDomainId());
logger.debug(String.format("delete domainId=%s and platformId=%s record from database",
deleteDomain.getDomainId(), deleteDomain.getPlatformId()));
domainMapper.delete(deleteDomain.getDomainId(), deleteDomain.getPlatformId());
logger.info(String.format("delete domainId=%s from platformId=%s SUCCESS",
deleteDomain.getDomainId(), deleteDomain.getPlatformId()));
}
/**
* 升级已有的应用模块
* @param updateApp 模块升级操作信息
* @param deployApp 该模块的部署记录
* @param originalApp 升级前app信息
* @param targetApp 升级后app信息
* @throws DataAccessException cmdb数据库访问异常
* @throws InterfaceCallException 调用蓝鲸api失败
* @throws LJPaasException 蓝鲸api返回调用失败或是解析蓝鲸api返回结果
*/
private void updateDeployAppModuleVersion(AppUpdateOperationInfo updateApp, PlatformAppPo deployApp, AppModuleVo originalApp, AppModuleVo targetApp)
throws InterfaceCallException, NexusException, IOException
{
logger.debug(String.format("begin to modify %s version from %s to %s at %s/%s/%s",
updateApp.getAppAlias(), originalApp.getVersion(), targetApp.getVersion(), deployApp.getPlatformId(), deployApp.getDomainId(), deployApp.getHostIp()));
Date now = new Date();
handlePlatformAppCfgs(deployApp, targetApp, updateApp.getCfgs());
deployApp.setAppId(targetApp.getAppId());
deployApp.setDeployTime(now);
logger.debug(String.format("update platformAppId=%d platform_app record", deployApp.getPlatformAppId()));
platformAppMapper.update(deployApp);
logger.info(String.format("update %s version from %s to %s at %s SUCCESS",
updateApp.getAppAlias(), originalApp.getVersion(), targetApp.getVersion(), deployApp.getHostIp()));
}
/**
* 修改已有的应用的配置文件
* @param modifiedCfgApp 修改配置文件的操作信息
* @param deployApp 被修改配置应用部署记录
* @param appModule 被修改配置app记录
* @throws DataAccessException cmdb数据库访问异常
* @throws InterfaceCallException 调用蓝鲸api失败
* @throws LJPaasException 蓝鲸api返回调用失败或是解析蓝鲸api返回结果
*/
private void modifyDeployAppModuleCfg(AppUpdateOperationInfo modifiedCfgApp, PlatformAppPo deployApp, AppModuleVo appModule)
throws InterfaceCallException, NexusException, IOException
{
logger.debug(String.format("begin to modify %d %s cfgs at %s/%s/%s",
modifiedCfgApp.getCfgs().size(), modifiedCfgApp.getAppAlias(), deployApp.getPlatformId(), deployApp.getDomainId(), deployApp.getHostIp()));
handlePlatformAppCfgs(deployApp, appModule, modifiedCfgApp.getCfgs());
Date now = new Date();
deployApp.setDeployTime(now);
logger.debug(String.format("update platformAppId=%d platform_app record deployTime", deployApp.getPlatformAppId()));
platformAppMapper.update(deployApp);
logger.debug(String.format("modify %d %s cfgs at %s/%s/%s SUCCESS",
modifiedCfgApp.getCfgs().size(), modifiedCfgApp.getAppAlias(), deployApp.getPlatformId(), deployApp.getDomainId(), deployApp.getHostIp()));
}
/**
* 根据现有数据生成一个demo平台创建计划
* @param bkBizId 需要创建的平台biz id
* @param platformId 需要创建的平台id
* @param platformName 需要创建的平台名
* @param bkCloudId 该平台服务器对应的cloud id
* @return 新创建的demo平台创建计划
* @throws ParamException
* @throws InterfaceCallException
* @throws LJPaasException
*/
private PlatformUpdateSchemaInfo generatePlatformCreateDemoSchema(String platformId, String platformName, int bkBizId, int bkCloudId) throws ParamException, InterfaceCallException, LJPaasException {
PlatformPo platform = platformMapper.selectByPrimaryKey(platformId);
if (platform != null) {
logger.error(String.format("create new platform create schema FAIL : %s exist", platformId));
throw new ParamException(String.format("create new platform create schema FAIL : %s exist", platformId));
}
platform = platformMapper.selectByNameBizId(platformName, null);
if (platform != null) {
logger.error(String.format("create new platform create schema FAIL : %s exist", platformName));
throw new ParamException(String.format("create new platform create schema FAIL : %s exist", platformName));
}
LJBizInfo bkBiz = paasService.queryBizInfoById(bkBizId);
if (bkBiz == null) {
logger.error(String.format("create new platform create schema FAIL : bkBizId=%d biz not exist", bkBizId));
throw new ParamException(String.format("create new platform create schema FAIL : bkBizId=%d biz not exist", bkBizId));
}
if (!platformName.equals(bkBiz.getBkBizName()))
{
logger.error(String.format("create new platform create schema FAIL : bkBizId=%d biz name is %s, not %s", bkBizId, bkBiz.getBkBizName(), platformName));
throw new ParamException(String.format(String.format("create new platform create schema FAIL : bkBizId=%d biz name is %s, not %s", bkBizId, bkBiz.getBkBizName(), platformName)));
}
Date now = new Date();
List<AppModuleVo> appList = this.appModuleMapper.select(null, null, null, null);
Map<String, List<AppModuleVo>> appMap = appList.stream().collect(Collectors.groupingBy(AppModuleVo::getAppName));
Map<String, BizSetDefine> setDefineMap = this.paasService.queryCCODBizSet(false).stream().collect(Collectors.toMap(BizSetDefine::getName, Function.identity()));
List<LJSetInfo> setList = this.paasService.resetExistBiz(bkBizId, new ArrayList<>(setDefineMap.keySet()));
platform = new PlatformPo(platformId, platformName, bkBizId, bkCloudId, CCODPlatformStatus.RUNNING,
"CCOD4.1", "通过程序自动创建的demo平台");
platformMapper.insert(platform);
PlatformUpdateSchemaInfo schema = new PlatformUpdateSchemaInfo(platformId, platformName, bkBizId, bkCloudId,
"CCOD4.1", PlatformUpdateTaskType.CREATE,
String.format("%s(%s)平台新建计划", platformName, platformId),
String.format("通过程序自动创建的%s(%s)平台新建计划"));
Random random = new Random();
List<String> hostList = new ArrayList<>();
for(BizSetDefine setDefine : setDefineMap.values())
{
if(setDefine.getApps().length == 0)
continue;
String hostIp = String.format("%d.%d.%d.%d", 173,random.nextInt(10000) % 255,
random.nextInt(10000) % 255, random.nextInt(10000) % 255);
hostList.add(hostIp);
DomainUpdatePlanInfo planInfo = new DomainUpdatePlanInfo();
planInfo.setUpdateType(DomainUpdateType.ADD);
planInfo.setStatus(UpdateStatus.CREATE);
planInfo.setComment("由程序自动生成的新建域");
String domainId = setDefine.getFixedDomainId();
String domainName = setDefine.getFixedDomainName();
if(StringUtils.isBlank(domainId))
{
domainId = "newCreateTestDomain";
domainName = "新建测试域";
}
planInfo.setDomainId(domainId);
planInfo.setDomainName(domainName);
planInfo.setCreateTime(now);
planInfo.setUpdateTime(now);
planInfo.setExecuteTime(now);
planInfo.setAppUpdateOperationList(new ArrayList<>());
planInfo.setBkSetName(setDefine.getName());
planInfo.setSetId(setDefine.getId());
for(String appName : setDefine.getApps())
{
AppModuleVo appModuleVo = appMap.get(appName).get(0);
AppUpdateOperationInfo addOperationInfo = new AppUpdateOperationInfo();
addOperationInfo.setHostIp(hostIp);
addOperationInfo.setOperation(AppUpdateOperation.ADD);
addOperationInfo.setCfgs(new ArrayList<>());
for(AppCfgFilePo appCfgFilePo : appModuleVo.getCfgs())
{
AppFileNexusInfo info = new AppFileNexusInfo();
info.setDeployPath(appCfgFilePo.getDeployPath());
info.setExt(appCfgFilePo.getExt());
info.setFileName(appCfgFilePo.getFileName());
info.setFileSize(0);
info.setMd5(appCfgFilePo.getMd5());
info.setNexusAssetId(appCfgFilePo.getNexusAssetId());
info.setNexusPath(String.format("%s/%s", appCfgFilePo.getNexusDirectory(), appCfgFilePo.getFileName()));
info.setNexusRepository(appCfgFilePo.getNexusRepository());
addOperationInfo.getCfgs().add(info);
}
addOperationInfo.setBasePath(appModuleVo.getBasePath());
addOperationInfo.setAppRunner("qnsoft");
addOperationInfo.setAppAlias(appModuleVo.getAppAlias());
addOperationInfo.setAppName(appModuleVo.getAppName());
addOperationInfo.setTargetVersion(appModuleVo.getVersion());
planInfo.getAppUpdateOperationList().add(addOperationInfo);
}
schema.getDomainUpdatePlanList().add(planInfo);
}
LJSetInfo idlePoolSet = setList.stream().collect(Collectors.toMap(LJSetInfo::getBkSetName, Function.identity())).get(this.paasIdlePoolSetName);
List<LJHostInfo> bkHostList = this.paasService.addNewHostToIdlePool(bkBizId, idlePoolSet.getBkSetId(), hostList, bkCloudId);
Map<String, BizSetDefine> bizSetDefineMap = paasService.queryCCODBizSet(false).stream().collect(Collectors.toMap(BizSetDefine::getName, Function.identity()));
String planCheckResult = checkPlatformUpdateTask(schema, new ArrayList<>(), appList, new ArrayList<>(), setList, bkHostList, new ArrayList<>(), bizSetDefineMap);
if(StringUtils.isNotBlank(planCheckResult))
{
logger.error(String.format("check platform update schema FAIL : %s", planCheckResult));
throw new ParamException(String.format("check platform update schema FAIL : %s", planCheckResult));
}
return schema;
}
@Override
public PlatformUpdateSchemaInfo createPlatformUpdateSchemaDemo(PlatformUpdateSchemaParamVo paramVo) throws ParamException, InterfaceCallException, LJPaasException {
logger.debug(String.format("prepare to create platform update schema demo : params=%s", JSONObject.toJSONString(paramVo)));
if(paramVo.getBkBizId() == 0)
{
logger.error(String.format("create demo schema FAIL : bkBizId=0"));
throw new ParamException(String.format("create demo schema FAIL : bkBizId=0"));
}
else if(StringUtils.isBlank(paramVo.getPlatformId()))
{
logger.error(String.format("create demo schema FAIL : platformId is blank"));
throw new ParamException(String.format("create demo schema FAIL : platformId is blank"));
}
else if(StringUtils.isBlank(paramVo.getPlatformName()))
{
logger.error(String.format("create demo schema FAIL : platformName is blank"));
throw new ParamException(String.format("create demo schema FAIL : platformName is blank"));
}
else if(paramVo.getTaskType() == null)
{
logger.error(String.format("create demo schema FAIL : taskType is blank"));
throw new ParamException(String.format("create demo schema FAIL : taskType is blank"));
}
PlatformUpdateSchemaInfo schemaInfo;
if(PlatformUpdateTaskType.CREATE.equals(paramVo.getTaskType()))
{
schemaInfo = generatePlatformCreateDemoSchema(paramVo.getPlatformId(), paramVo.getPlatformName(), paramVo.getBkBizId(), paramVo.getBkCloudId());
}
else
{
logger.error(String.format("current version not support %s platform update demo schema create", paramVo.getTaskType().name));
throw new ParamException(String.format("current version not support %s platform update demo schema create", paramVo.getTaskType().name));
}
platformUpdateSchemaMapper.delete(paramVo.getPlatformId());
PlatformUpdateSchemaPo schemaPo = new PlatformUpdateSchemaPo();
schemaPo.setPlatformId(paramVo.getPlatformId());
schemaPo.setContext(JSONObject.toJSONString(schemaInfo).getBytes());
platformUpdateSchemaMapper.insert(schemaPo);
this.platformUpdateSchemaMap.put(paramVo.getPlatformId(), schemaInfo);
return schemaInfo;
}
@Override
public List<PlatformUpdateSchemaInfo> queryPlatformUpdateSchema(String platformId) {
logger.debug(String.format("begin to query platformId=%s platform update schema", platformId));
List<PlatformUpdateSchemaInfo> schemaList = new ArrayList<>();
if(StringUtils.isBlank(platformId))
{
schemaList = new ArrayList<>(this.platformUpdateSchemaMap.values());
}
else
{
if(this.platformUpdateSchemaMap.containsKey(platformId))
{
schemaList.add(platformUpdateSchemaMap.get(platformId));
}
}
return schemaList;
}
/**
* 把通过onlinemanager主动收集上来的ccod应用部署情况同步到paas之前需要给这些应用添加对应的bizId
* 确定应用归属的set信息,并根据定义的set-app关系对某些应用归属域重新赋值
* @param bizId 蓝鲸paas的biz id
* @param deployApps 需要处理的应用详情
* @return 处理后的结果
* @throws NotSupportAppException 如果应用中存在没有在lj-paas.set-apps节点定义的应用将抛出此异常
*/
private List<PlatformAppDeployDetailVo> makeUpBizInfoForDeployApps(int bizId, List<PlatformAppDeployDetailVo> deployApps) throws NotSupportAppException
{
Map<String, List<BizSetDefine>> appSetRelationMap = this.paasService.getAppBizSetRelation();
for(PlatformAppDeployDetailVo deployApp : deployApps)
{
if(!appSetRelationMap.containsKey(deployApp.getAppName()))
{
logger.error(String.format("%s没有在配置文件的lj-paas.set-apps节点中定义", deployApp.getAppName()));
throw new NotSupportAppException(String.format("%s未定义所属的set信息", deployApp.getAppName()));
}
deployApp.setBkBizId(bizId);
BizSetDefine sd = appSetRelationMap.get(deployApp.getAppName()).get(0);
deployApp.setBkSetName(sd.getName());
if(StringUtils.isNotBlank(sd.getFixedDomainName()))
{
deployApp.setSetId(sd.getId());
deployApp.setBkSetName(sd.getName());
deployApp.setDomainId(sd.getFixedDomainId());
deployApp.setDomainName(sd.getFixedDomainName());
}
}
return deployApps;
}
/**
* 根据应用部署详情生成平台的set拓扑结构
* @param deployAppList 平台的应用部署明细
* @return 台的set拓扑结构
* @throws DBPAASDataNotConsistentException
* @throws NotSupportAppException
*/
private List<CCODSetInfo> generateCCODSetInfo(List<PlatformAppDeployDetailVo> deployAppList, List<String> setNames) throws ParamException, NotSupportAppException
{
Map<String, List<BizSetDefine>> appSetRelationMap = this.paasService.getAppBizSetRelation();
Map<String, BizSetDefine> setDefineMap = this.paasService.queryCCODBizSet(false).stream().collect(Collectors.toMap(BizSetDefine::getName, Function.identity()));
Map<String, List<PlatformAppDeployDetailVo>> setAppMap = deployAppList.stream().collect(Collectors.groupingBy(PlatformAppDeployDetailVo::getBkSetName));
List<CCODSetInfo> setList = new ArrayList<>();
for(PlatformAppDeployDetailVo deployApp : deployAppList)
{
if(!appSetRelationMap.containsKey(deployApp.getAppName()))
{
logger.error(String.format("current version not support %s", deployApp.getAppName()));
throw new NotSupportAppException(String.format("current version not support %s", deployApp.getAppName()));
}
else if(!setDefineMap.containsKey(deployApp.getBkSetName()))
{
logger.error(String.format("%s is not a legal ccod set name", deployApp.getBkSetName()));
throw new ParamException(String.format("%s is not a legal ccod set name", deployApp.getBkSetName()));
}
}
for(String setName : setAppMap.keySet())
{
Map<String, List<PlatformAppDeployDetailVo>> domainAppMap = setAppMap.get(setName)
.stream().collect(Collectors.groupingBy(PlatformAppDeployDetailVo::getDomainName));
List<CCODDomainInfo> domainList = new ArrayList<>();
for(String domainName : domainAppMap.keySet())
{
List<PlatformAppDeployDetailVo> domAppList = domainAppMap.get(domainName);
CCODDomainInfo domain = new CCODDomainInfo(domAppList.get(0).getDomainId(), domAppList.get(0).getDomainName());
for(PlatformAppDeployDetailVo deployApp : domAppList)
{
CCODModuleInfo bkModule = new CCODModuleInfo(deployApp);
domain.getModules().add(bkModule);
}
domainList.add(domain);
}
CCODSetInfo set = new CCODSetInfo(setName);
set.setDomains(domainList);
setList.add(set);
}
for(String setName : setNames)
{
if(!setAppMap.containsKey(setName))
{
CCODSetInfo setInfo = new CCODSetInfo(setName);
setList.add(setInfo);
}
}
return setList;
}
@Override
public PlatformTopologyInfo getPlatformTopology(String platformId) throws ParamException, InterfaceCallException, LJPaasException, NotSupportAppException
{
logger.debug(String.format("begin to query %s platform topology", platformId));
PlatformPo platform = platformMapper.selectByPrimaryKey(platformId);
if(platform == null)
{
logger.error(String.format("%s platform not exist", platformId));
throw new ParamException(String.format("%s platform not exist", platformId));
}
PlatformTopologyInfo topology = new PlatformTopologyInfo(platform);
if(topology.getStatus() == null)
{
logger.error(String.format("unknown ccod platform status %d", platform.getStatus()));
throw new ParamException(String.format("unknown ccod platform status %d", platform.getStatus()));
}
List<LJHostInfo> idleHostList;
PlatformUpdateSchemaInfo schema;
List<CCODSetInfo> setList;
Map<String, BizSetDefine> bizSetMap = paasService.queryCCODBizSet(false).stream().collect(Collectors.toMap(BizSetDefine::getName, Function.identity()));
List<PlatformAppDeployDetailVo> deployAppList;
switch (topology.getStatus())
{
case SCHEMA_CREATE_PLATFORM:
setList = new ArrayList<>();
idleHostList = this.paasService.queryBizIdleHost(platform.getBkBizId());
schema = this.platformUpdateSchemaMap.containsKey(platformId) ? this.platformUpdateSchemaMap.get(platformId) : null;
break;
case RUNNING:
if(this.platformUpdateSchemaMap.containsKey(platformId))
{
logger.error(String.format("%s status is %s, but it has an update schema",
platformId, topology.getStatus().name));
throw new ParamException(String.format("%s status is %s, but it has an update schema",
platformId, topology.getStatus().name));
}
deployAppList = this.platformAppDeployDetailMapper.selectPlatformApps(platformId, null, null);
setList = generateCCODSetInfo(deployAppList, new ArrayList<>(bizSetMap.keySet()));
idleHostList = this.paasService.queryBizIdleHost(platform.getBkBizId());
schema = null;
break;
case SCHEMA_UPDATE_PLATFORM:
if(!this.platformUpdateSchemaMap.containsKey(platformId))
{
logger.error(String.format("%s status is %s, but can not find its update schema",
platformId, topology.getStatus().name));
throw new ParamException(String.format("%s status is %s, but can not find its update schema",
platformId, topology.getStatus().name));
}
deployAppList = this.platformAppDeployDetailMapper.selectPlatformApps(platformId, null, null);
setList = generateCCODSetInfo(deployAppList, new ArrayList<>(bizSetMap.keySet()));
idleHostList = this.paasService.queryBizIdleHost(platform.getBkBizId());
schema = this.platformUpdateSchemaMap.get(platformId);
break;
case WAIT_SYNC_EXIST_PLATFORM_TO_PAAS:
if(this.platformUpdateSchemaMap.containsKey(platformId))
{
logger.error(String.format("%s status is %s, but it has an update schema",
platformId, topology.getStatus().name));
throw new ParamException(String.format("%s status is %s, but it has an update schema",
platformId, topology.getStatus().name));
}
deployAppList = this.platformAppDeployDetailMapper.selectPlatformApps(platformId, null, null);
deployAppList = makeUpBizInfoForDeployApps(platform.getBkBizId(), deployAppList);
setList = generateCCODSetInfo(deployAppList, new ArrayList<>(bizSetMap.keySet()));
idleHostList = this.paasService.queryBizIdleHost(platform.getBkBizId());
schema = null;
break;
default:
idleHostList = new ArrayList<>();
setList = new ArrayList<>();
schema = null;
}
topology.setSetList(setList);
topology.setSchema(schema);
topology.setIdleHosts(idleHostList);
return topology;
}
@Override
public List<PlatformTopologyInfo> queryAllPlatformTopology() throws ParamException, InterfaceCallException, LJPaasException, NotSupportAppException {
List<PlatformTopologyInfo> topoList = new ArrayList<>();
List<PlatformPo> platforms = platformMapper.select(null);
for(PlatformPo platformPo : platforms)
{
PlatformTopologyInfo topo = new PlatformTopologyInfo(platformPo);
if(topo.getStatus() == null)
{
logger.error(String.format("%s status %d is unknown", platformPo.getPlatformId(), platformPo.getStatus()));
continue;
}
switch (topo.getStatus())
{
case RUNNING:
case WAIT_SYNC_EXIST_PLATFORM_TO_PAAS:
case SCHEMA_UPDATE_PLATFORM:
case SCHEMA_CREATE_PLATFORM:
topoList.add(topo);
break;
default:
}
}
return topoList;
}
@Override
public void registerNewAppModule(AppModuleVo appModule) throws NotSupportAppException, ParamException, InterfaceCallException, NexusException, IOException {
logger.debug(String.format("begin to register app=[%s] into cmdb", JSONObject.toJSONString(appModule)));
Map<String, List<BizSetDefine>> appSetRelationMap = this.paasService.getAppBizSetRelation();
if (!appSetRelationMap.containsKey(appModule.getAppName())) {
logger.error(String.format("appName=%s is not supported by cmdb", appModule.getAppName()));
throw new NotSupportAppException(String.format("appName=%s is not supported by cmdb", appModule.getAppName()));
}
String moduleCheckResult = checkModuleParam(appModule);
if (StringUtils.isNotBlank(moduleCheckResult)) {
logger.error(String.format("app module params check FAIL %s", moduleCheckResult));
throw new ParamException(String.format("app module params check FAIL %s", moduleCheckResult));
}
AppModuleVo oldModuleVo = this.appModuleMapper.selectByNameAndVersion(appModule.getAppName(), appModule.getVersion());
if (oldModuleVo != null) {
if(!oldModuleVo.getInstallPackage().getFileName().equals(appModule.getInstallPackage().getFileName()))
{
logger.error(String.format("%s's version %s has been registered, but old install package fileName is %s and new install package fileName is %s",
appModule.getAppName(), appModule.getVersion(), appModule.getInstallPackage().getFileName(), oldModuleVo.getInstallPackage().getFileName()));
throw new ParamException(String.format("%s's version %s has been registered, but old install package fileName is %s and new install package fileName is %s",
appModule.getAppName(), appModule.getVersion(), appModule.getInstallPackage().getFileName(), oldModuleVo.getInstallPackage().getFileName()));
}
else if(!oldModuleVo.getInstallPackage().getMd5().equals(appModule.getInstallPackage().getMd5()))
{
logger.error(String.format("%s's version %s has been registered, but old install package md5 is %s and new install package md5 is %s",
appModule.getAppName(), appModule.getVersion(), appModule.getInstallPackage().getFileName(), oldModuleVo.getInstallPackage().getFileName()));
throw new ParamException(String.format("%s's version %s has been registered, but old install package fileName is %s and new install package fileName is %s",
appModule.getAppName(), appModule.getVersion(), appModule.getInstallPackage().getMd5(), oldModuleVo.getInstallPackage().getMd5()));
}
else if(oldModuleVo.getCfgs().size() != appModule.getCfgs().size())
{
logger.error(String.format("%s's version %s has been registered, but old has %d cfg and new has is %d",
appModule.getAppName(), appModule.getVersion(), appModule.getInstallPackage().getFileName(), oldModuleVo.getInstallPackage().getFileName()));
throw new ParamException(String.format("%s's version %s has been registered, but old install package fileName is %s and new install package fileName is %s",
appModule.getAppName(), appModule.getVersion(), appModule.getCfgs().size(), oldModuleVo.getCfgs().size()));
}
else
{
Map<String, AppCfgFilePo> cfgFileMap = oldModuleVo.getCfgs().stream().collect(Collectors.toMap(AppCfgFilePo::getFileName, Function.identity()));
for(AppCfgFilePo cfgFilePo : appModule.getCfgs())
{
if(!cfgFileMap.containsKey(cfgFilePo.getFileName()))
{
logger.error(String.format("%s's version %s has been registered, but cfg fileName not equal",
appModule.getAppName(), appModule.getVersion()));
throw new ParamException(String.format("%s's version %s has been registered, but cfg fileName not equal",
appModule.getAppName(), appModule.getVersion()));
}
else if(!cfgFileMap.get(cfgFilePo.getFileName()).getDeployPath().equals(cfgFilePo.getDeployPath()))
{
logger.error(String.format("%s's version %s has been registered, but cfg deploy path not equal",
appModule.getAppName(), appModule.getVersion()));
throw new ParamException(String.format("%s's version %s has been registered, but cfg deploy path not equal",
appModule.getAppName(), appModule.getVersion()));
}
}
}
logger.error(String.format("%s's version %s has been registered", appModule.getAppName(), appModule.getVersion()));
throw new ParamException(String.format("%s's version %s has been registered", appModule.getAppName(), appModule.getVersion()));
}
String directory = appModule.getAppModuleNexusDirectory();
String tmpSaveDir = getTempSaveDir(DigestUtils.md5DigestAsHex(directory.getBytes()));
List<DeployFileInfo> fileList = new ArrayList<>();
String downloadUrl = appModule.getInstallPackage().getFileNexusDownloadUrl(this.publishNexusHostUrl);
logger.debug(String.format("download cfg from %s", downloadUrl));
String savePth = nexusService.downloadFile(this.nexusUserName, this.nexusPassword, downloadUrl, tmpSaveDir, appModule.getInstallPackage().getFileName());
String md5 = DigestUtils.md5DigestAsHex(new FileInputStream(savePth));
if(!md5.equals(appModule.getInstallPackage().getMd5()))
{
logger.error(String.format("install package %s verify md5 FAIL : report=%s and download=%s",
appModule.getInstallPackage().getFileName(), appModule.getInstallPackage().getMd5(), md5));
throw new ParamException(String.format("install package %s verify md5 FAIL : report=%s and download=%s",
appModule.getInstallPackage().getFileName(), appModule.getInstallPackage().getMd5(), md5));
}
DeployFileInfo fileInfo = new DeployFileInfo();
fileInfo.setFileName(appModule.getInstallPackage().getFileName());
fileInfo.setNexusAssetId(appModule.getInstallPackage().getNexusAssetId());
fileInfo.setNexusDirectory(appModule.getInstallPackage().getNexusDirectory());
fileInfo.setNexusRepository(appModule.getInstallPackage().getNexusRepository());
fileInfo.setLocalSavePath(savePth);
fileInfo.setFileMd5(appModule.getInstallPackage().getMd5());
fileInfo.setExt(appModule.getInstallPackage().getExt());
fileInfo.setBasePath(appModule.getBasePath());
fileInfo.setDeployPath(appModule.getBasePath());
fileList.add(fileInfo);
for(AppCfgFilePo cfg : appModule.getCfgs())
{
downloadUrl = cfg.getFileNexusDownloadUrl(this.publishNexusHostUrl);
logger.debug(String.format("download cfg from %s", downloadUrl));
savePth = nexusService.downloadFile(this.nexusUserName, this.nexusPassword, downloadUrl, tmpSaveDir, cfg.getFileName());
md5 = DigestUtils.md5DigestAsHex(new FileInputStream(savePth));
if(!md5.equals(cfg.getMd5()))
{
logger.error(String.format("cfg %s verify md5 FAIL : report=%s and download=%s",
cfg.getFileName(), cfg.getMd5(), md5));
throw new ParamException(String.format("cfg %s verify md5 FAIL : report=%s and download=%s",
cfg.getFileName(), cfg.getMd5(), md5));
}
fileInfo = new DeployFileInfo();
fileInfo.setFileName(cfg.getFileName());
fileInfo.setNexusAssetId(cfg.getNexusAssetId());
fileInfo.setNexusDirectory(directory);
fileInfo.setNexusRepository(this.appRepository);
fileInfo.setLocalSavePath(savePth);
fileInfo.setFileMd5(cfg.getMd5());
fileInfo.setExt(cfg.getExt());
fileInfo.setBasePath(appModule.getBasePath());
fileInfo.setDeployPath(cfg.getDeployPath());
fileList.add(fileInfo);
}
Map<String, NexusAssetInfo> assetMap = this.nexusService.uploadRawComponent(this.nexusHostUrl, this.nexusUserName, this.nexusPassword, this.appRepository, directory, fileList.toArray(new DeployFileInfo[0])).stream().collect(Collectors.toMap(NexusAssetInfo::getPath, Function.identity()));
AppPo appPo = new AppPo(appModule);
Date now = new Date();
appPo.setCreateTime(now);
appPo.setUpdateTime(now);
this.appMapper.insert(appPo);
appModule.getInstallPackage().setNexusRepository(this.appRepository);
appModule.getInstallPackage().setNexusDirectory(directory);
appModule.getInstallPackage().setAppId(appPo.getAppId());
appModule.getInstallPackage().setNexusAssetId(assetMap.get(String.format("%s/%s", directory, appModule.getInstallPackage().getFileName())).getId());
this.appInstallPackageMapper.insert(appModule.getInstallPackage());
for(AppCfgFilePo cfgFilePo : appModule.getCfgs())
{
cfgFilePo.setAppId(appPo.getAppId());
cfgFilePo.setNexusDirectory(directory);
cfgFilePo.setNexusRepository(this.appRepository);
cfgFilePo.setNexusAssetId(assetMap.get(String.format("%s/%s", directory, cfgFilePo.getFileName())).getId());
this.appCfgFileMapper.insert(cfgFilePo);
}
}
@Override
public void updateAppModule(AppModuleVo appModule) throws NotSupportAppException, ParamException, InterfaceCallException, NexusException, IOException {
logger.debug(String.format("begin to modify cfg of app=[%s] in cmdb", JSONObject.toJSONString(appModule)));
if(StringUtils.isBlank(appModule.getAppName()))
{
logger.error(String.format("app name is blank"));
throw new ParamException(String.format("app name is blank"));
}
if(StringUtils.isBlank(appModule.getVersion()))
{
logger.error(String.format("version of %s is blank", appModule.getAppName()));
throw new ParamException(String.format("version of %s is blank", appModule.getAppName()));
}
if(appModule.getInstallPackage() == null)
{
logger.error(String.format("install package of %s version %s is blank", appModule.getAppName(), appModule.getVersion()));
throw new ParamException(String.format("install package of %s version %s is blank", appModule.getAppName(), appModule.getVersion()));
}
if(appModule.getCfgs() == null || appModule.getCfgs().size() == 0)
{
logger.error(String.format("cfg of %s version %s is blank", appModule.getAppName(), appModule.getVersion()));
throw new ParamException(String.format("cfg of %s version %s is blank", appModule.getAppName(), appModule.getVersion()));
}
Map<String, List<BizSetDefine>> appSetRelationMap = this.paasService.getAppBizSetRelation();
if (!appSetRelationMap.containsKey(appModule.getAppName())) {
logger.error(String.format("appName=%s is not supported by cmdb", appModule.getAppName()));
throw new NotSupportAppException(String.format("appName=%s is not supported by cmdb", appModule.getAppName()));
}
AppModuleVo oldModuleVo = this.appModuleMapper.selectByNameAndVersion(appModule.getAppName(), appModule.getVersion());
if (oldModuleVo == null)
{
logger.error(String.format("%s version %s has not registered", appModule.getAppName(), appModule.getVersion()));
throw new ParamException(String.format("%s version %s has not registered", appModule.getAppName(), appModule.getVersion()));
}
String directory = appModule.getAppModuleNexusDirectory();
String tmpSaveDir = getTempSaveDir(DigestUtils.md5DigestAsHex(directory.getBytes()));
List<DeployFileInfo> fileList = new ArrayList<>();
String downloadUrl = appModule.getInstallPackage().getFileNexusDownloadUrl(this.publishNexusHostUrl);
logger.debug(String.format("download cfg from %s", downloadUrl));
String savePth = nexusService.downloadFile(this.nexusUserName, this.nexusPassword, downloadUrl, tmpSaveDir, appModule.getInstallPackage().getFileName());
String md5 = DigestUtils.md5DigestAsHex(new FileInputStream(savePth));
if(!md5.equals(appModule.getInstallPackage().getMd5()))
{
logger.error(String.format("install package %s verify md5 FAIL : report=%s and download=%s",
appModule.getInstallPackage().getFileName(), appModule.getInstallPackage().getMd5(), md5));
throw new ParamException(String.format("install package %s verify md5 FAIL : report=%s and download=%s",
appModule.getInstallPackage().getFileName(), appModule.getInstallPackage().getMd5(), md5));
}
DeployFileInfo fileInfo = new DeployFileInfo();
fileInfo.setFileName(appModule.getInstallPackage().getFileName());
fileInfo.setNexusAssetId(appModule.getInstallPackage().getNexusAssetId());
fileInfo.setNexusDirectory(appModule.getInstallPackage().getNexusDirectory());
fileInfo.setNexusRepository(appModule.getInstallPackage().getNexusRepository());
fileInfo.setLocalSavePath(savePth);
fileInfo.setFileMd5(appModule.getInstallPackage().getMd5());
fileInfo.setExt(appModule.getInstallPackage().getExt());
fileInfo.setBasePath(appModule.getBasePath());
fileInfo.setDeployPath(appModule.getBasePath());
fileList.add(fileInfo);
for(AppCfgFilePo cfg : appModule.getCfgs())
{
downloadUrl = cfg.getFileNexusDownloadUrl(this.publishNexusHostUrl);
logger.debug(String.format("download cfg from %s", downloadUrl));
savePth = nexusService.downloadFile(this.nexusUserName, this.nexusPassword, downloadUrl, tmpSaveDir, cfg.getFileName());
md5 = DigestUtils.md5DigestAsHex(new FileInputStream(savePth));
if(!md5.equals(cfg.getMd5()))
{
logger.error(String.format("cfg %s verify md5 FAIL : report=%s and download=%s",
cfg.getFileName(), cfg.getMd5(), md5));
throw new ParamException(String.format("cfg %s verify md5 FAIL : report=%s and download=%s",
cfg.getFileName(), cfg.getMd5(), md5));
}
fileInfo = new DeployFileInfo();
fileInfo.setFileName(cfg.getFileName());
fileInfo.setNexusAssetId(cfg.getNexusAssetId());
fileInfo.setNexusDirectory(directory);
fileInfo.setNexusRepository(this.appRepository);
fileInfo.setLocalSavePath(savePth);
fileInfo.setFileMd5(cfg.getMd5());
fileInfo.setExt(cfg.getExt());
fileInfo.setBasePath(appModule.getBasePath());
fileInfo.setDeployPath(cfg.getDeployPath());
fileList.add(fileInfo);
}
Map<String, NexusAssetInfo> assetMap = this.nexusService.uploadRawComponent(this.nexusHostUrl, this.nexusUserName, this.nexusPassword, this.appRepository, directory, fileList.toArray(new DeployFileInfo[0])).stream().collect(Collectors.toMap(NexusAssetInfo::getPath, Function.identity()));
logger.debug(String.format("delete old version install package"));
this.appInstallPackageMapper.delete(null, oldModuleVo.getAppId());
logger.debug(String.format("delete old version cfgs"));
this.appCfgFileMapper.delete(null, oldModuleVo.getAppId());
oldModuleVo.getInstallPackage().setNexusAssetId(assetMap.get(String.format("%s/%s", directory, appModule.getInstallPackage().getFileName())).getId());
this.appInstallPackageMapper.insert(oldModuleVo.getInstallPackage());
for(AppCfgFilePo cfgFilePo : appModule.getCfgs())
{
cfgFilePo.setAppId(oldModuleVo.getAppId());
cfgFilePo.setNexusDirectory(directory);
cfgFilePo.setNexusRepository(this.appRepository);
cfgFilePo.setNexusAssetId(assetMap.get(String.format("%s/%s", directory, cfgFilePo.getFileName())).getId());
this.appCfgFileMapper.insert(cfgFilePo);
}
}
private String checkModuleParam(AppModuleVo appModuleVo)
{
StringBuffer sb = new StringBuffer();
if(StringUtils.isBlank(appModuleVo.getAppName()))
{
sb.append("appName is blank,");
}
if(StringUtils.isBlank(appModuleVo.getVersion()))
{
sb.append("appVersion is blank,");
}
if(StringUtils.isBlank(appModuleVo.getBasePath()))
{
sb.append("default base path is blank,");
}
if(appModuleVo.getInstallPackage() == null)
{
sb.append("install package is null,");
}
if(appModuleVo.getCfgs() == null || appModuleVo.getCfgs().size() == 0)
{
sb.append("cfg is null,");
}
return sb.toString().replaceAll(",$", "");
}
@Override
public PlatformUpdateSchemaInfo createDemoNewPlatform(String platformId, String platformName, int bkBizId, int bkCloudId, List<String> planAppList) throws ParamException, InterfaceCallException, LJPaasException
{
Date now = new Date();
PlatformPo platformPo = this.platformMapper.selectByPrimaryKey(platformId);
if(platformPo != null)
{
logger.error(String.format("demo platform[id=%s, name=%s] exist", platformId, platformName));
throw new ParamException(String.format("demo platform[id=%s, name=%s] exist", platformId, platformName));
}
List<LJBizInfo> bizList = paasService.queryAllBiz();
Map<String, LJBizInfo> bizMap = bizList.stream().collect(Collectors.toMap(LJBizInfo::getBkBizName, Function.identity()));
if(!bizMap.containsKey(platformName))
{
logger.error(String.format("biz %s not exist at lj paas", platformName));
throw new ParamException(String.format("biz %s not exist at lj paas", platformName));
}
else if(bizMap.get(platformName).getBkBizId() != bkBizId)
{
logger.error(String.format("%s bkBizId is %d not %d", bizMap.get(platformName).getBkBizId(), bkBizId));
throw new ParamException(String.format("%s bkBizId is %d not %d", bizMap.get(platformName).getBkBizId(), bkBizId));
}
Map<String, List<String>> planAppMap = new HashMap<>();
for(String planApp : planAppList)
{
String[] arr = planApp.split("##");
if(!planAppMap.containsKey(arr[0]))
{
planAppMap.put(arr[0], new ArrayList<>());
}
planAppMap.get(arr[0]).add(planApp);
}
List<AppModuleVo> appList = this.appModuleMapper.select(null, null, null, null);
Map<String, List<AppModuleVo>> appMap = appList.stream().collect(Collectors.groupingBy(AppModuleVo::getAppName));
PlatformUpdateSchemaInfo schema = new PlatformUpdateSchemaInfo(platformId, platformName, bkBizId, bkCloudId, "CCOD4.1",
PlatformUpdateTaskType.CREATE, String.format("%s(%s)平台新建计划", platformName, platformId),
String.format("通过程序自动创建的%s(%s)平台新建计划", platformName, platformId));
Set<String> ipSet = new HashSet<>();
Map<String, BizSetDefine> setDefineMap = this.paasService.queryCCODBizSet(false).stream().collect(Collectors.toMap(BizSetDefine::getName, Function.identity()));
for(BizSetDefine setDefine : setDefineMap.values())
{
if(setDefine.getApps().length == 0)
continue;
DomainUpdatePlanInfo planInfo = new DomainUpdatePlanInfo();
planInfo.setUpdateType(DomainUpdateType.ADD);
planInfo.setStatus(UpdateStatus.CREATE);
planInfo.setComment("由程序自动生成的新建域");
String domainId = setDefine.getFixedDomainId();
String domainName = setDefine.getFixedDomainName();
if(StringUtils.isBlank(domainId))
{
domainId = "new-create-test-domain";
domainName = "新建测试域";
}
planInfo.setDomainId(domainId);
planInfo.setDomainName(domainName);
planInfo.setCreateTime(now);
planInfo.setUpdateTime(now);
planInfo.setExecuteTime(now);
planInfo.setAppUpdateOperationList(new ArrayList<>());
planInfo.setBkSetName(setDefine.getName());
planInfo.setSetId(setDefine.getId());
for(String appName : setDefine.getApps())
{
if(planAppMap.containsKey(appName))
{
for(String planApp : planAppMap.get(appName))
{
String[] arr = planApp.split("##");
String appAlias = arr[1];
String version = arr[2];
String hostIp = arr[3].split("@")[1];
ipSet.add(hostIp);
String[] pathArr = arr[3].split("@")[0].replaceAll("^/", "").split("/");
pathArr[1] = appAlias;
String basePath = String.format("/%s", String.join("/", pathArr));
Map<String, AppModuleVo> versionMap = appMap.get(appName).stream().collect(Collectors.toMap(AppModuleVo::getVersion, Function.identity()));
if(!versionMap.containsKey(version))
{
logger.error(String.format("create demo platform create schema FAIL : %s has not version=%s",
appName, version));
throw new ParamException(String.format("create demo platform create schema FAIL : %s has not version=%s",
appName, version));
}
AppModuleVo appModuleVo = versionMap.get(version);
AppUpdateOperationInfo addOperationInfo = new AppUpdateOperationInfo();
addOperationInfo.setHostIp(hostIp);
addOperationInfo.setOperation(AppUpdateOperation.ADD);
addOperationInfo.setCfgs(new ArrayList<>());
for(AppCfgFilePo appCfgFilePo : appModuleVo.getCfgs())
{
AppFileNexusInfo info = new AppFileNexusInfo();
info.setDeployPath(appCfgFilePo.getDeployPath());
info.setExt(appCfgFilePo.getExt());
info.setFileName(appCfgFilePo.getFileName());
info.setFileSize(0);
info.setMd5(appCfgFilePo.getMd5());
info.setNexusAssetId(appCfgFilePo.getNexusAssetId());
info.setNexusPath(String.format("%s/%s", appCfgFilePo.getNexusDirectory(), appCfgFilePo.getFileName()));
info.setNexusRepository(appCfgFilePo.getNexusRepository());
addOperationInfo.getCfgs().add(info);
}
addOperationInfo.setBasePath(basePath);
addOperationInfo.setAppRunner(appAlias);
addOperationInfo.setAppAlias(appAlias);
addOperationInfo.setAppName(appName);
addOperationInfo.setTargetVersion(version);
planInfo.getAppUpdateOperationList().add(addOperationInfo);
}
}
}
schema.getDomainUpdatePlanList().add(planInfo);
}
Map<String, LJHostInfo> hostMap = paasService.queryBKHost(bkBizId, null, null, null, null)
.stream().collect(Collectors.toMap(LJHostInfo::getHostInnerIp, Function.identity()));
for(String hostIp : ipSet)
{
if(!hostMap.containsKey(hostIp))
{
logger.error(String.format("%s has not %s host", platformName, hostIp));
throw new LJPaasException(String.format("%s has not %s host", platformName, hostIp));
}
}
paasService.resetExistBiz(bkBizId, new ArrayList<>(setDefineMap.keySet()));
schema.setBkBizId(bkBizId);
platformPo = new PlatformPo(platformId, platformName, bkBizId, bkCloudId, CCODPlatformStatus.SCHEMA_CREATE_PLATFORM,
"CCOD4.1", "create by tools for test");
this.platformMapper.insert(platformPo);
List<LJSetInfo> setList = this.paasService.queryBkBizSet(bkBizId);
List<LJHostInfo> idleHostList = paasService.queryBizIdleHost(bkBizId);
Map<String, BizSetDefine> bizSetDefineMap = paasService.queryCCODBizSet(false).stream().collect(Collectors.toMap(BizSetDefine::getName, Function.identity()));
String checkResult = checkPlatformUpdateTask(schema, new ArrayList<>(), appList, new ArrayList<>(), setList, idleHostList, new ArrayList<>(), bizSetDefineMap);
if(StringUtils.isNotBlank(checkResult))
{
logger.error(String.format("demo platform generate fail : %s", checkResult));
throw new ParamException(String.format("demo platform generate fail : %s", checkResult));
}
PlatformUpdateSchemaPo schemaPo = new PlatformUpdateSchemaPo();
schemaPo.setContext(JSONObject.toJSONString(schema).getBytes());
schemaPo.setPlatformId(platformId);
this.platformUpdateSchemaMapper.insert(schemaPo);
this.platformUpdateSchemaMap.put(platformId, schema);
return schema;
}
@Override
public PlatformUpdateSchemaInfo createDemoUpdatePlatform(String platformId, String platformName, int bkBizId) throws ParamException, InterfaceCallException, LJPaasException {
logger.debug(String.format("begin to create demo update platform[platformId=%s,platformName=%s,bkBizId=%d]",
platformId, platformName, bkBizId));
Date now = new Date();
PlatformPo platform = platformMapper.selectByPrimaryKey(platformId);
if(platform == null)
{
logger.error(String.format("platformId=%s not exist", platformId));
throw new ParamException(String.format("platformId=%s not exist", platformId));
}
if(!platform.getPlatformName().equals(platformName))
{
logger.error(String.format("name of platformId=%s is %s not %s",
platformId, platform.getPlatformName(), platformName));
throw new ParamException(String.format("name of platformId=%s is %s not %s",
platformId, platform.getPlatformName(), platformName));
}
LJBizInfo bkBiz = this.paasService.queryBizInfoById(bkBizId);
if(bkBiz == null)
{
logger.error(String.format("bkBizId=%d biz not exist", bkBizId));
throw new ParamException(String.format("bkBizId=%d biz not exist", bkBizId));
}
if(!bkBiz.getBkBizName().equals(platformName))
{
logger.error(String.format("bkBizId=%d biz name is %s not %s",
bkBizId, bkBiz.getBkBizName(), platformName));
throw new ParamException(String.format("bkBizId=%d biz name is %s not %s",
bkBizId, bkBiz.getBkBizName(), platformName));
}
List<DomainPo> domainList = domainMapper.select(platformId, null);
if(domainList.size() == 0)
{
logger.error(String.format("%s has 0 domain", platformId));
throw new ParamException(String.format("%s has 0 domain", platformId));
}
List<PlatformAppDeployDetailVo> deployApps = platformAppDeployDetailMapper.selectPlatformApps(platformId, null, null);
if(deployApps.size() == 0)
{
logger.error(String.format("%s has deployed 0 app", platformId));
throw new ParamException(String.format("%s has deployed 0 app", platformId));
}
List<AppModuleVo> appModuleList = appModuleMapper.select(null, null, null, null);
Map<String, List<AppModuleVo>> appModuleMap = appModuleList.stream().collect(Collectors.groupingBy(AppModuleVo::getAppName));
List<DomainUpdatePlanInfo> planList = new ArrayList<>();
Map<String, List<PlatformAppDeployDetailVo>> setAppMap = deployApps.stream().collect(Collectors.groupingBy(PlatformAppDeployDetailVo::getBkSetName));
for(String bkSetName : setAppMap.keySet())
{
List<PlatformAppDeployDetailVo> setAppList = setAppMap.get(bkSetName);
Map<String, List<PlatformAppDeployDetailVo>> domainAppMap = setAppList.stream().collect(Collectors.groupingBy(PlatformAppDeployDetailVo::getDomainId));
int index = 1;
for(String domainId : domainAppMap.keySet())
{
List<PlatformAppDeployDetailVo> domainAppList = domainAppMap.get(domainId);
if("域服务".equals(bkSetName))
{
DomainUpdatePlanInfo planInfo = new DomainUpdatePlanInfo();
planInfo.setAppUpdateOperationList(new ArrayList<>());
planInfo.setStatus(UpdateStatus.CREATE);
planInfo.setSetId(domainAppList.get(0).getSetId());
planInfo.setBkSetName(bkSetName);
planInfo.setExecuteTime(now);
planInfo.setUpdateTime(now);
planInfo.setCreateTime(now);
planInfo.setDomainName(domainAppList.get(0).getDomainName());
planInfo.setDomainId(domainId);
planInfo.setComment(String.format("域%s移除方案", domainId));
planInfo.setUpdateType(DomainUpdateType.DELETE);
for(PlatformAppDeployDetailVo deployApp : domainAppList)
{
AppUpdateOperationInfo opt = new AppUpdateOperationInfo();
opt.setAppName(deployApp.getAppName());
opt.setAppAlias(deployApp.getAppAlias());
opt.setOperation(AppUpdateOperation.DELETE);
opt.setHostIp(deployApp.getHostIp());
opt.setPlatformAppId(deployApp.getPlatformAppId());
opt.setOriginalVersion(deployApp.getVersion());
planInfo.getAppUpdateOperationList().add(opt);
}
planList.add(planInfo);
planInfo = new DomainUpdatePlanInfo();
planInfo.setAppUpdateOperationList(new ArrayList<>());
planInfo.setStatus(UpdateStatus.CREATE);
planInfo.setSetId(domainAppList.get(0).getSetId());
planInfo.setBkSetName(bkSetName);
planInfo.setExecuteTime(now);
planInfo.setUpdateTime(now);
planInfo.setCreateTime(now);
planInfo.setDomainName(String.format("新建%s%d", domainAppList.get(0).getDomainName(), index));
planInfo.setDomainId(String.format("new-create-%s-%d", domainAppList.get(0).getDomainId(), index));
index++;
planInfo.setComment(String.format("域%s新建方案", planInfo.getDomainId()));
planInfo.setUpdateType(DomainUpdateType.ADD);
for(PlatformAppDeployDetailVo deployApp : domainAppList)
{
AppUpdateOperationInfo opt = new AppUpdateOperationInfo();
opt.setCfgs(new ArrayList<>());
for(PlatformAppCfgFilePo cfgFilePo : deployApp.getCfgs())
{
AppFileNexusInfo nexusInfo = new AppFileNexusInfo();
nexusInfo.setNexusRepository(cfgFilePo.getNexusRepository());
nexusInfo.setNexusPath(cfgFilePo.getFileNexusSavePath());
nexusInfo.setNexusAssetId(nexusInfo.getNexusAssetId());
nexusInfo.setMd5(cfgFilePo.getMd5());
nexusInfo.setFileSize(0);
nexusInfo.setFileName(cfgFilePo.getFileName());
nexusInfo.setExt(cfgFilePo.getExt());
nexusInfo.setDeployPath(cfgFilePo.getDeployPath());
opt.getCfgs().add(nexusInfo);
}
opt.setHostIp(deployApp.getHostIp());
opt.setOperation(AppUpdateOperation.ADD);
opt.setBasePath(deployApp.getBasePath());
opt.setAppRunner(deployApp.getAppRunner());
opt.setAppAlias(deployApp.getAppAlias());
opt.setAppName(deployApp.getAppName());
opt.setTargetVersion(deployApp.getVersion());
planInfo.getAppUpdateOperationList().add(opt);
}
planList.add(planInfo);
}
else
{
DomainUpdatePlanInfo planInfo = new DomainUpdatePlanInfo();
planInfo.setAppUpdateOperationList(new ArrayList<>());
planInfo.setStatus(UpdateStatus.CREATE);
planInfo.setSetId(domainAppList.get(0).getSetId());
planInfo.setBkSetName(bkSetName);
planInfo.setExecuteTime(now);
planInfo.setUpdateTime(now);
planInfo.setCreateTime(now);
planInfo.setDomainName(domainAppList.get(0).getDomainName());
planInfo.setDomainId(domainId);
planInfo.setComment(String.format("域%s升级方案", domainId));
planInfo.setUpdateType(DomainUpdateType.UPDATE);
planList.add(planInfo);
for(PlatformAppDeployDetailVo deployApp : domainAppList)
{
if(index % 2 == 1)
{
if(appModuleMap.get(deployApp.getAppName()).size() > 1)
{
for(AppModuleVo moduleVo : appModuleMap.get(deployApp.getAppName()))
{
if(!moduleVo.getVersion().equals(deployApp.getVersion()))
{
AppUpdateOperationInfo opt = new AppUpdateOperationInfo();
opt.setTargetVersion(moduleVo.getVersion());
opt.setAppName(deployApp.getAppName());
opt.setAppAlias(deployApp.getAppAlias());
opt.setAppRunner(deployApp.getAppRunner());
opt.setBasePath(deployApp.getBasePath());
opt.setOperation(AppUpdateOperation.VERSION_UPDATE);
opt.setHostIp(deployApp.getHostIp());
opt.setOriginalVersion(deployApp.getVersion());
opt.setPlatformAppId(deployApp.getPlatformAppId());
opt.setCfgs(new ArrayList<>());
for(AppCfgFilePo cfgFilePo : moduleVo.getCfgs())
{
AppFileNexusInfo nexusInfo = new AppFileNexusInfo();
nexusInfo.setNexusRepository(cfgFilePo.getNexusRepository());
nexusInfo.setNexusPath(cfgFilePo.getNexusFileSavePath());
nexusInfo.setNexusAssetId(nexusInfo.getNexusAssetId());
nexusInfo.setMd5(cfgFilePo.getMd5());
nexusInfo.setFileSize(0);
nexusInfo.setFileName(cfgFilePo.getFileName());
nexusInfo.setExt(cfgFilePo.getExt());
nexusInfo.setDeployPath(cfgFilePo.getDeployPath());
opt.getCfgs().add(nexusInfo);
}
planInfo.getAppUpdateOperationList().add(opt);
break;
}
}
}
else
{
AppUpdateOperationInfo opt = new AppUpdateOperationInfo();
opt.setPlatformAppId(deployApp.getPlatformAppId());
opt.setOriginalVersion(deployApp.getVersion());
opt.setHostIp(deployApp.getHostIp());
opt.setOperation(AppUpdateOperation.CFG_UPDATE);
opt.setBasePath(deployApp.getBasePath());
opt.setAppRunner(deployApp.getAppRunner());
opt.setAppAlias(deployApp.getAppAlias());
opt.setAppName(deployApp.getAppName());
opt.setCfgs(new ArrayList<>());
for(PlatformAppCfgFilePo cfgFilePo : deployApp.getCfgs())
{
AppFileNexusInfo nexusInfo = new AppFileNexusInfo();
nexusInfo.setNexusRepository(cfgFilePo.getNexusRepository());
nexusInfo.setNexusPath(cfgFilePo.getFileNexusSavePath());
nexusInfo.setNexusAssetId(nexusInfo.getNexusAssetId());
nexusInfo.setMd5(cfgFilePo.getMd5());
nexusInfo.setFileSize(0);
nexusInfo.setFileName(cfgFilePo.getFileName());
nexusInfo.setExt(cfgFilePo.getExt());
nexusInfo.setDeployPath(cfgFilePo.getDeployPath());
opt.getCfgs().add(nexusInfo);
}
planInfo.getAppUpdateOperationList().add(opt);
}
}
else
{
AppUpdateOperationInfo opt = new AppUpdateOperationInfo();
opt.setAppName(deployApp.getAppName());
opt.setAppAlias(deployApp.getAppAlias());
opt.setAppRunner(deployApp.getAppRunner());
opt.setBasePath(deployApp.getBasePath());
opt.setOperation(AppUpdateOperation.DELETE);
opt.setHostIp(deployApp.getHostIp());
opt.setOriginalVersion(deployApp.getVersion());
opt.setPlatformAppId(deployApp.getPlatformAppId());
planInfo.getAppUpdateOperationList().add(opt);
}
}
}
}
}
PlatformUpdateSchemaInfo schema = new PlatformUpdateSchemaInfo(platformId, platformName, bkBizId, platform.getBkCloudId(),
"CCOD4.1", PlatformUpdateTaskType.UPDATE, "create demo update platform",
"demo update platform create by program");
schema.setDomainUpdatePlanList(planList);
List<PlatformAppPo> platformAppList = platformAppMapper.select(platformId, null, null, null, null, null);
List<LJSetInfo> bkSetList = paasService.queryBkBizSet(bkBizId);
List<LJHostInfo> bkHostList = paasService.queryBKHost(bkBizId, null, null, null, null);
List<PlatformAppBkModulePo> appBkModuleList = platformAppBkModuleMapper.select(platformId, null, null, null, null, null);
Map<String, BizSetDefine> bizSetDefineMap = paasService.queryCCODBizSet(false).stream().collect(Collectors.toMap(BizSetDefine::getName, Function.identity()));
String schemaCheckResult = checkPlatformUpdateTask(schema, domainList, appModuleList, platformAppList, bkSetList, bkHostList, appBkModuleList, bizSetDefineMap);
if(StringUtils.isNotBlank(schemaCheckResult))
{
logger.error(String.format("generate schema fail : %s", schemaCheckResult));
throw new ParamException(String.format("generate schema fail : %s", schemaCheckResult));
}
PlatformUpdateSchemaPo schemaPo = new PlatformUpdateSchemaPo();
schemaPo.setPlatformId(platformId);
schemaPo.setContext(JSONObject.toJSONString(schema).getBytes());
this.platformUpdateSchemaMapper.insert(schemaPo);
platform.setStatus(CCODPlatformStatus.SCHEMA_UPDATE_PLATFORM.id);
platformMapper.update(platform);
this.platformUpdateSchemaMap.put(platformId, schema);
return schema;
}
@Override
public void deletePlatformUpdateSchema(String platformId) throws ParamException {
logger.debug(String.format("begin to delete platform update schema of %s", platformId));
PlatformPo platformPo = platformMapper.selectByPrimaryKey(platformId);
if(platformPo == null)
{
logger.error(String.format("%s platform not exist", platformId));
throw new ParamException(String.format("%s platform not exist", platformId));
}
CCODPlatformStatus status = CCODPlatformStatus.getEnumById(platformPo.getStatus());
if(status == null)
{
logger.error(String.format("%s status value %d is unknown", platformId, platformPo.getStatus()));
throw new ParamException(String.format("%s status value %d is unknown", platformId, platformPo.getStatus()));
}
if(this.platformUpdateSchemaMap.containsKey(platformId))
{
logger.debug(String.format("remove schema of %s from memory", platformId));
this.platformUpdateSchemaMap.remove(platformId);
}
logger.debug(String.format("delete schema of %s from database", platformId));
this.platformUpdateSchemaMapper.delete(platformId);
switch (status)
{
case SCHEMA_CREATE_PLATFORM:
logger.debug(String.format("%s status is %s, so it should be deleted", platformId, status.name));
platformMapper.delete(platformId);
break;
default:
logger.debug(String.format("%s status is %s, so it should be updated to %s",
platformId, status.name, CCODPlatformStatus.RUNNING.name));
platformPo.setStatus(CCODPlatformStatus.RUNNING.id);
platformMapper.update(platformPo);
break;
}
}
@Override
public void deletePlatform(String platformId) throws ParamException {
logger.debug(String.format("begin to delete %s from cmdb", platformId));
PlatformPo platformPo = platformMapper.selectByPrimaryKey(platformId);
if(platformPo == null)
{
logger.error(String.format("%s not exist", platformId));
throw new ParamException(String.format("%s not exist", platformId));
}
if(this.platformUpdateSchemaMap.containsKey(platformId))
{
this.platformUpdateSchemaMap.remove(platformId);
}
this.platformUpdateSchemaMapper.delete(platformId);
List<PlatformAppPo> deployApps = platformAppMapper.select(platformId, null, null, null, null, null);
this.platformAppBkModuleMapper.delete(null, null, platformId, null);
for(PlatformAppPo deployApp : deployApps)
{
platformAppCfgFileMapper.delete(null, deployApp.getPlatformAppId());
}
this.platformAppMapper.delete(null, platformId, null);
this.domainMapper.delete(null, platformId);
this.platformMapper.delete(platformId);
logger.info(String.format("%s delete success", platformId));
}
@Test
public void schemaParamTest()
{
PlatformUpdateSchemaParamVo paramVo = new PlatformUpdateSchemaParamVo();
paramVo.setBkBizId(0);
paramVo.setBkCloudId(8);
paramVo.setPlatformId("ccodDevelopTestPlatform");
paramVo.setPlatformName("ccod开发测试平台");
paramVo.setTaskType(PlatformUpdateTaskType.CREATE);
String script = "glsServer##glsServer##ece10ef28dce83ab36e4d79213ec4f69##/home/ccodrunner/[email protected]\n" +
"LicenseServer##license##5214##/home/ccodrunner/[email protected]\n" +
"configserver##configserver##aca2af60caa0fb9f4af57f37f869dafc90472525##/home/cfs/[email protected]\n" +
"gls##gls##10309##/home/ccodrunner/resin-4.0.13/[email protected]\n" +
"dcms##dcms##11110##/home/ccodrunner/resin-4.0.13/[email protected]\n" +
"dcmsWebservice##dcmsWebservice##20503##/home/ccodrunner/resin-4.0.13/[email protected]\n" +
"dcmsRecord##dcmsRecord##21763##/home/ccodrunner/resin-4.0.13/[email protected]\n" +
"dcmsStaticsReport##dcmsStatics##20537##/home/ccodrunner/resin-4.0.13/[email protected]\n" +
"dcmsStaticsReport##dcmsStaticsReport##20528##/home/ccodrunner/resin-4.0.13/[email protected]\n" +
"safetyMonitor##safetyMonitor##20383##/home/ccodrunner/resin-4.0.13/[email protected]\n" +
"dcmssg##dcmsSG##20070##/home/ccodrunner/resin-4.0.13/[email protected]\n" +
"customWebservice##customWebservice##19553##/home/ccodrunner/resin-4.0.13/[email protected]\n" +
"dcmsx##dcmsx##master_8efabf4##/home/ccodrunner/resin-4.0.13/[email protected]\n" +
"slee##slee##3.1.5.0##/home/slee/Platform/slee/ChannelSoft/CsCCP/SoftSwitch/[email protected]\n" +
"UCGateway##UCGateway##b4c50cc9602c11c9cbfae23d07f134dc##/home/ccodrunner/SmartDialer4.1/[email protected]\n" +
"AppGateWay##AppGateWay##c03e1e3fedf73f25a1565c602b8e4040##/home/ccodrunner/SmartDialer4.1/[email protected]\n" +
"DialEngine##DialEngine##24ae5d2c45523ab5c7e0da7b86db4c18##/home/ccodrunner/SmartDialer4.1/[email protected]\n" +
"cmsserver##cms##4c303e2a4b97a047f63eb01b247303c9306fbda5##/home/channelsoft/[email protected]\n" +
"cmsserver##cms##4c303e2a4b97a047f63eb01b247303c9306fbda5##/home/ccodrunner/[email protected]\n" +
"UCDServer##ucds##deb3c3c4bf62c5ae5b3f8a467029a03ed95fb39e##/home/ccodrunner/[email protected]\n" +
"ucxserver##ucx##1fef2157ea07c483979b424c758192bd709e6c2a##/home/ccodrunner/[email protected]\n" +
"DDSServer##dds##150:18722##/home/ccodrunner/[email protected]\n" +
"dcs##dcs##155:21974##/home/ccodrunner/[email protected]\n" +
"StatSchedule##ss##154:21104##/home/ccodrunner/[email protected]\n" +
"EAService##eas##216:11502##/home/ccodrunner/[email protected]\n" +
"dcproxy##dcproxy##195:21857##/home/ccodrunner/[email protected]\n" +
"daengine##daengine##179:20744##/home/ccodrunner/[email protected]";
paramVo.setPlanAppList(Arrays.asList(script.split("\n")));
System.out.println(JSONObject.toJSONString(paramVo));
}
@Test
public void splitTest()
{
String path = "/home/ccodrunner/resin-4.0.13/webapps";
String appAlias = "dcmsx";
path = path.replaceAll("^/", "");
String[] arr = path.split("/");
arr[1] = appAlias;
System.out.println(String.join("/", arr));
}
}
| [
"[email protected]"
] | |
ef21984d7b67fdbdb457ab1505b6fac65ce6aa51 | c37890750e1cf8db3112efb61596b2c35eeeed6a | /src/main/java/Payments/CardPayment.java | b2d5d6da3d465e23f75d118cde0300fd12a8e009 | [] | no_license | catrionameriel/Venue_ticketing_system | 0ee71408ff525047000d883db029214eae213ca9 | 8616c54b16031e6f9b907e5a4102f63fc11daa04 | refs/heads/master | 2021-05-14T02:27:00.251770 | 2018-01-26T15:35:29 | 2018-01-26T15:35:29 | 116,594,120 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 500 | java | package Payments;
public abstract class CardPayment extends PaymentMethod {
private String nameOnCard;
private long cardNumber;
protected CardPayment(String paymentName, double availableFunds, String name, long cardNumber) {
super(paymentName, availableFunds);
nameOnCard = name;
this.cardNumber = cardNumber;
}
public String getNameOnCard(){
return nameOnCard;
}
public long getCardNumber(){
return this.cardNumber;
}
}
| [
"[email protected]"
] | |
325c75c0f048b42d69bfe0b6a437cfef63659095 | 61af5071032b1cbd47e2898ac8351d8cf9a82edd | /appeon.aje.web.engine/src/appeon/aje/webengine/EngineerBuilder.java | 63300ac59eaf515fec35b261bb5fcbeb4551ec66 | [] | no_license | delez/ssh_scaffold | f181b2dd116219753df671d65abd3ea3859fd6c2 | 4314f1c7ef6f3616e7368d1fc198123d787d4697 | refs/heads/master | 2020-04-12T17:50:44.094489 | 2013-01-16T14:28:32 | 2013-01-16T14:28:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,047 | java | /**
*
*/
package appeon.aje.webengine;
import java.io.IOException;
import java.io.Writer;
import java.util.Properties;
import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity;
import org.apache.velocity.exception.MethodInvocationException;
import org.apache.velocity.exception.ParseErrorException;
import org.apache.velocity.exception.ResourceNotFoundException;
/**
*
*/
public class EngineerBuilder {
private Context context;
public EngineerBuilder(Context ctx) throws EngineException {
this.context = ctx;
try {
Properties properties = new Properties();
properties.load(EngineerBuilder.class.getResourceAsStream("/velocity.properties"));
Velocity.init(properties);//
} catch (Exception e) {
throw new EngineException(e);
}
}
/**
*
* @param writer
* @param templateFile
* @param model
* @throws EngineException
*/
public void out(Writer writer, String templateFile, Object model)
throws EngineException {
out(writer, templateFile, "model", model);
}
/**
*
* @param writer
* @param templateFile
* @param model
* @throws EngineException
*/
public void out(Writer writer, String templateFile, String name, Object model)
throws EngineException {
VelocityContext vc = new VelocityContext();
vc.put(name, model);
vc.put("context", context);
out(writer, templateFile, vc);
}
/**
*
* @param writer
* @param templateFile
* @param model
* @throws EngineException
*/
public void out(Writer writer, String templateFile, Object model, Sapper sapper)
throws EngineException {
VelocityContext vc = new VelocityContext();
vc.put("model", model);
vc.put("sapper", sapper);
vc.put("context", context);
out(writer, templateFile, vc);
}
public static void out(Writer writer, String templateFile, Properties props){
out(writer, templateFile, new VelocityContext(props));
}
/**
*
* @param writer
* @param templateFile
* @param context
* @throws EngineException
*/
public static void out(Writer writer, String templateFile, VelocityContext context)
throws EngineException {
Template template = null;
try {
template = Velocity.getTemplate(templateFile);
if (template != null)
template.merge(context, writer);
} catch (ResourceNotFoundException rnfe) {
throw new EngineException("error : cannot find template "
+ templateFile + " : " + rnfe);
} catch (ParseErrorException pee) {
throw new EngineException("Syntax error in template "
+ templateFile + ":" + pee);
} catch (MethodInvocationException e) {
throw new EngineException(e);
} catch (Exception e) {
throw new EngineException(e);
}
/*
* flush and cleanup
*/
try {
writer.flush();
} catch (IOException e) {
throw new EngineException("close writer error", e);
}
}
}
| [
"[email protected]"
] | |
388f8e18408f963beac127bc9af68cc447be0f81 | 4b4cf0417fe981f6ee07386eac7e5500c39745ad | /core/src/main/java/org/kobjects/android64/MemoryListener.java | f1a4632eb335810569506dd4ddb0748e996affb8 | [] | no_license | stefanhaustein/android64 | 2a9498beb9f26be4fe4e39d6ce9ac1ed9eee7a02 | f88d1142d764e34d2ab8a07d7cc2ae04fd7752e8 | refs/heads/master | 2023-09-02T09:22:34.693110 | 2019-12-20T12:34:18 | 2019-12-20T12:34:18 | 203,216,157 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 107 | java | package org.kobjects.android64;
public interface MemoryListener {
void set(int address, int value);
}
| [
"[email protected]"
] | |
920d4a8584d91bc5dd3193e788315addfc7ce1cb | 9aadb0678e182300f43438729bac4e512ea911f2 | /JAVA_Algorithm/disjoint_set/DisjointSetTest.java | 9577b99205ec568af8a32ee39337eaeec7a396d6 | [] | no_license | SeungsoonLeee/ssafy | ef0d6aee50a23764a0dc403bce6a7a8c651cf4c2 | 4a7e9c8b14b590f562f5ba68703afd86aa5dfb06 | refs/heads/master | 2023-01-21T00:11:57.330642 | 2019-11-28T08:40:58 | 2019-11-28T08:40:58 | 194,757,133 | 1 | 1 | null | 2023-01-05T11:14:08 | 2019-07-01T23:47:52 | Java | UTF-8 | Java | false | false | 1,091 | java | package ssafy.com.disjointset;
import java.util.Arrays;
import java.util.Scanner;
public class DisjointSetTest {
static int[] parents;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int count = sc.nextInt();
parents = new int[N];
// 1. set 만들기
Arrays.fill(parents, -1);
for (int i = 0; i < count; i++) {
int a = sc.nextInt();
int b = sc.nextInt();
System.out.println(union(a, b));
}
System.out.println(find(0) + " " + find(1));
System.out.println(find(3) + " " + find(4));
System.out.println(find(2) + " " + find(3));
// 0 3
// 1 4
// 3 4
}
private static boolean union(int a, int b) {
int aRoot = find(a);
int bRoot = find(b);
if (aRoot != bRoot) {
parents[bRoot] = aRoot;
return true;
}
return false;
}
private static int find(int f) {
if (parents[f] < 0) // 음수인 경우 root라는 의미이므로 자기 자신을 리턴
return f;
return parents[f] = find(parents[f]); // path compression
}
}
| [
"[email protected]"
] | |
eb5787177269706f012334e84569df8217eaac65 | 98ad85b3d919e1f041dd00b966185335539dcf59 | /app/src/main/java/com/icommunicate/apiCall/requestModels/FetchMessageRequest.java | 36638a93d92837bf7b8f399de7fac896d046c5a3 | [] | no_license | BhadreshChavada/iCommunicate | aff9246c44635f7e21f475cec687e066e5e572d7 | 8b983cf5f6655df17de09dd9ca314efc1ccb9675 | refs/heads/master | 2023-02-02T09:51:39.492144 | 2020-12-10T09:24:46 | 2020-12-10T09:24:46 | 287,230,797 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 614 | java | package com.icommunicate.apiCall.requestModels;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
/**
* Created by system-15 on 16/1/20 Timing 14:35.
*/
public class FetchMessageRequest {
@SerializedName("to")
@Expose
private String to;
@SerializedName("from")
@Expose
private String from;
public String getTo() {
return to;
}
public void setTo(String to) {
this.to = to;
}
public String getFrom() {
return from;
}
public void setFrom(String from) {
this.from = from;
}
}
| [
"[email protected]"
] | |
034187cdae80c7801084c23b13e1c415fa086dd7 | 5ea5372d306353fdc6416ac56aeb437f6103fc89 | /test/net/ion/rosetta/query/QueryParser.java | dcb00117493dc1c869a514d3e28370c4b6cdbeae | [] | no_license | nextjava/craken | 3e71e9a86a2fa8657814a8bf3b2e0f3e8b779ef3 | 6ff5401fdc32f30f5a045e10a6a8a1aff81c6fe8 | refs/heads/master | 2021-01-18T07:38:56.203488 | 2013-08-19T00:53:28 | 2013-08-19T00:53:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,124 | java | package net.ion.rosetta.query;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import net.ion.rosetta.OperatorTable;
import net.ion.rosetta.Parser;
import net.ion.rosetta.Parsers;
import net.ion.rosetta.Scanners;
import net.ion.rosetta.Terminals;
import net.ion.rosetta.functors.Binary;
import net.ion.rosetta.functors.Map;
import net.ion.rosetta.pattern.Patterns;
public class QueryParser {
private enum BinaryOperator implements Binary<Filter> {
AND {
public Filter map(Filter a, Filter b) {
return new And(a, b);
}
},
OR {
public Filter map(Filter a, Filter b) {
return new Or(a, b);
}
}
}
public static final Parser<String> SINGLE_QUOTE_STRING = Scanners.pattern(Patterns.regex("((\\\\.)|[^\'\\\\])*"), "quoted string").between(Scanners.isChar('\''), Scanners.isChar('\'')).source();
public static final Map<String, String> SINGLE_QUOTE_STRING_MAP = new Map<String, String>() {
public String map(String text) {
return text.substring(1, text.length() - 1).replace("\\'", "'");
}
@Override
public String toString() {
return "SINGLE_QUOTE_STRING";
}
};
private static final Parser<Filter> TOKEN = Terminals.StringLiteral.PARSER.map(new net.ion.rosetta.functors.Map<String, Filter>() {
public Token map(String s) {
return new Token(s);
}
});
private static final Terminals OPERATORS = Terminals.operators("+", ",", "(", ")");
private static final Parser<Object> TOKENIZER = Parsers.<Object> or(SINGLE_QUOTE_STRING.map(SINGLE_QUOTE_STRING_MAP), OPERATORS.tokenizer());
private static Parser<?> term(String... names) {
return OPERATORS.token(names);
}
private static <T> Parser<T> op(String name, T value) {
return term(name).retn(value);
}
private static Parser<Filter> query(Parser<Filter> atom) {
Parser.Reference<Filter> ref = Parser.newReference();
Parser<Filter> unit = ref.lazy().between(term("("), term(")")).or(atom);
Parser<Filter> parser = new OperatorTable<Filter>().infixl(op(",", BinaryOperator.OR), 10).infixl(op("+", BinaryOperator.AND), 20).build(unit);
ref.set(parser);
return parser;
}
private static Parser<Void> nodelim = Parsers.always();
private static final Parser<Filter> parser = query(TOKEN).from(TOKENIZER, nodelim);
public static Filter parse(String source) {
/*
* String decoded = ""; char[] chars = source.toCharArray(); for (int i = 0; i < chars.length; i++) { if (chars[i] == '%') { int a = chars[++i]; int b = chars[++i]; if (a >= 'A') a = a-'A'; else a = a-'0'; if (b >= 'A') b = b-'A'; else b = b-'0'; decoded += (char)(16*a+b); } decoded += chars[i]; }
*/
source = source.replace("+", "%2B");
try {
source = URLDecoder.decode(source, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
System.out.println(source);
return parser.parse(source);
}
public static void main(String args[]) {
// System.out.println(SINGLE_QUOTE_STRING.parse("'foo'"));
System.out.println(QueryParser.parse("'hi: bye'+'ho!:bo+ o\\\'n'"));
}
}
| [
"[email protected]"
] | |
516f580649d86ace95a1b26ec510e5da34ad595d | 114055c22b5027f3ca743c4af30dd0cae2a08eef | /Run.java | 9ce466ad919242cf85d86449b4d5df89b32b2b14 | [] | no_license | MichalPekacki/Auction-system | 141b78e80be8a5a755620e4594e49098663ef943 | 556248357664d807a9a1c52992583e5c0c6a9a54 | refs/heads/master | 2020-08-07T12:14:41.922851 | 2019-10-07T17:42:52 | 2019-10-07T17:42:52 | 213,446,308 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 98 | java |
public class Run {
public static void main(String[] args) {
new Console().run();
}
}
| [
"[email protected]"
] | |
0f3b97a4de5efab0ac3e7915cf53c21019fb9560 | 5acd479fe5aea91e37be83b369915a7eeab5c255 | /src/main/java/com/rahul/Exercise20Aug/Tshirt.java | 62822eb3e5a383a6e7cf394814a39c8cde103da3 | [] | no_license | reclonerk/TestProject | 818019c25ee80050d7667d2ba81a0fce7afac08b | e2fb11cdaa442b219fb496f70229682d47c7055a | refs/heads/master | 2023-07-05T15:12:56.754691 | 2021-08-20T09:16:38 | 2021-08-20T09:16:38 | 398,192,781 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 392 | java | package com.rahul.Exercise20Aug;
public class Tshirt {
private String type;
private int quantity = 10;
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
| [
"[email protected]"
] | |
312de9b48c1b9dd7b0e22cd0eed2fb978ea25033 | 5643e2dc3946ffb490ac8d9f9e5e27c386656f46 | /app/src/main/java/android/luna/ViewUi/bottombar/OnTabReselectListener.java | ba37e0dae8a2eb487f28856b1b76d4e3ea01b152 | [] | no_license | cremlee/App | c22402df07a3e4ec483eed4ee3575cafd8899b69 | 454d5d43b27328282d18ffb6a66026dd0f0eeddc | refs/heads/master | 2021-06-24T16:43:23.337350 | 2018-08-10T00:09:53 | 2018-08-10T00:09:53 | 143,685,409 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,125 | java | package android.luna.ViewUi.bottombar;
import android.support.annotation.IdRes;
/*
* BottomBar library for Android
* Copyright (c) 2016 Iiro Krankka (http://github.com/roughike).
*
* 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.
*/
public interface OnTabReselectListener {
/**
* The method being called when currently visible {@link BottomBarTab} is
* reselected. Use this method for scrolling to the top of your content,
* as recommended by the Material Design spec
*
* @param tabId the {@link BottomBarTab} that was reselected.
*/
void onTabReSelected(@IdRes int tabId);
}
| [
"[email protected]"
] | |
465d3d946c1edb51734c793c6faa75fe482fd8c1 | 3bb5908564cf7f3bfed0f0b31001ff123515ca06 | /demo/src/com/manasa/PmFraction.java | 78ffb04989d7241d178ad6540ebe738a8b805698 | [
"MIT"
] | permissive | meturi/demo | eb84ad8df2fa8bb1cf142a007fd0f5011be24956 | 045cd3115dc678865b482119a30eb3ba79370014 | refs/heads/master | 2020-04-06T11:07:34.174199 | 2019-02-24T07:54:03 | 2019-02-24T07:54:03 | 157,404,666 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 753 | java | package com.manasa;
import java.util.Scanner;
public class PmFraction {
static void plusMinus(int ar[])
{
float j=0,k=0,l=0;
for(int i=0;i<ar.length;i++)
{
if(ar[i]<0)
j++;
if(ar[i]==0)
k++;
if(ar[i]>0)
l++;
}
System.out.println(j/ar.length);
System.out.println("zeroes fraction in array are" +(k/ar.length));
System.out.println("positive numbers fraction in array are" +(l/ar.length));
}
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
System.out.println("enter the length of array");
int n = sc.nextInt();
int ar[] = new int[n];
for(int i=0;i<n;i++)
{
ar[i]= sc.nextInt();
}
plusMinus(ar);
}
}
| [
"[email protected]"
] | |
cbc3c075ec4fbaa54d732a69df117d2d4ac27f32 | c3c9042b35b7d693ac6b898674ca834440ef234b | /chapter05-wallet/src/main/java/com/wudimanong/wallet/dao/mapper/UserBalanceOrderDao.java | b4532b4f83fe38382416faf0d85462b90f2f4e9f | [] | no_license | manongwudi/springcloud-action | 969ad7cc51a0e42d88ca5f1d5479d93939559397 | afaecb9764fa4da2f1bfb208203454162f1fdb86 | refs/heads/master | 2022-09-22T23:20:50.632705 | 2021-08-26T05:17:55 | 2021-08-26T05:17:55 | 229,698,585 | 2 | 2 | null | 2022-09-08T01:04:51 | 2019-12-23T07:19:28 | Java | UTF-8 | Java | false | false | 331 | java | package com.wudimanong.wallet.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wudimanong.wallet.dao.model.UserBalanceOrderPO;
import org.springframework.stereotype.Repository;
/**
* @author jiangqiao
*/
@Repository
public interface UserBalanceOrderDao extends BaseMapper<UserBalanceOrderPO> {
}
| [
"[email protected]"
] | |
3bcf57b2e1aa772b1bbe96848cb431342dc5c514 | 1c6d85152866eccc03126365833a4aaf81624d11 | /assignments/harika/schoolschema/src/main/java/org/hcl/harika/schoolMgmtLog/DatabaseConnection.java | 76d2765580c3f077ecc547221946c45a741ffff9 | [] | no_license | hehagsv-team/java | e41ed5e6b255c111d4f23fe5727f00be8c3636ec | fc07925630c71953d1daf0346cb6fd81fab28c9c | refs/heads/master | 2023-01-07T22:29:03.836920 | 2020-10-22T07:13:42 | 2020-10-22T07:13:42 | 220,201,357 | 0 | 3 | null | 2023-01-06T04:37:45 | 2019-11-07T09:40:55 | Java | UTF-8 | Java | false | false | 715 | java | package org.hcl.harika.schoolMgmtLog;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import org.apache.log4j.Logger;
public class DatabaseConnection {
final static Logger logger=Logger.getLogger(DatabaseConnection.class);
static final String DB_URL = "jdbc:h2:~/test";
static final String USER = "sa";
static final String PASS = "";
public static Connection getConnection() {
Connection connection = null;
PreparedStatement ps = null;
try {
connection = DriverManager.getConnection(DB_URL,USER,PASS);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return connection;
}
}
| [
"[email protected]"
] | |
8c4344015b82760393d90a06468b92149569bfbf | ea62492ea30f5280d0ee4982a5d91460fbfb6431 | /SpringStudy/spring-09-appconfig/src/test/java/MyTest.java | 9f1c105701e99479c2175c0eff03a949e8d64253 | [] | no_license | IPostYellow/SSMStudyRecords | 15e2a9d5c9a3bb667932384a48894be4d3b3ccdc | cd3dbffee416302e1679b098d0060fd5599af1c4 | refs/heads/main | 2023-05-09T06:43:44.248582 | 2021-05-25T12:41:04 | 2021-05-25T12:41:04 | 358,531,673 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 491 | java | import config.MyConfig;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import pojo.User;
public class MyTest {
public static void main(String[] args) {
//通过纯注解配置
ApplicationContext context = new AnnotationConfigApplicationContext(MyConfig.class);
User getUser = context.getBean("getUser", User.class);
System.out.println(getUser.toString());
}
}
| [
"[email protected]"
] | |
a4a1f8ee6f50aab2aa325536ba28879619902232 | 2d67acd5dbb2a58664bae84dc4bc5a0ada1f4476 | /src/com/Shx/ExeUse/ExeOpen.java | 14080a0f6c1c1ce69b82b8665c4c704a1358fa4b | [] | no_license | IMSHX/QuickApplicationOpening | 7c93c761212e69659be3b78affd933c6dc55ea95 | 0de886be7d7e905966b368f60dc979ba5dd930d9 | refs/heads/master | 2020-05-04T06:09:50.244843 | 2019-05-13T15:50:38 | 2019-05-13T15:50:38 | 178,996,081 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 356 | java | package com.Shx.ExeUse;
import java.io.IOException;
/**
* 编写人:SHX
* 编写时间:2019/3/10
* 编写目的:启动.exe文件
*/
public class ExeOpen {
public void OpenExe(String fileName){
try {
Runtime.getRuntime().exec(fileName);
} catch (IOException e) {
e.printStackTrace();
}
}
}
| [
"[email protected]"
] | |
f0ff5b306e05dd2dec485fae0b48dbd863707cd4 | 0b0499e40174620955dfaa8bfa359b807ddc95c0 | /src/ru/kpetryaev/scene/BallSpaceMain.java | e98aed50b36b0a130fe842c2ac8e45dc32b54ec6 | [] | no_license | sibstu-ivt/oop_labs | 8de985f67bcde0a9e8e0874beb1fe5fff4d7e3b1 | 375288d1a56447f86b611653175c464c931b57f0 | refs/heads/master | 2021-01-21T09:53:09.902726 | 2015-11-20T01:47:08 | 2015-11-20T01:47:08 | 46,459,911 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 513 | java | package ru.kpetryaev.scene;
import javafx.application.Application;
import javafx.stage.Stage;
public class BallSpaceMain extends Application {
@Override
public void start(Stage stage) throws Exception{
BallSpace ballSpace = new BallSpace();
// stage.setScene(new Scene(ballSpace));
stage.setTitle("Custom Control");
stage.setWidth(500);
stage.setHeight(400);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
| [
"[email protected]"
] | |
4d83bb60c5f622718263a99862a86d8f14634d73 | 634ae05c5e190412b2c50a7b5317c3d331322bdf | /Sandbox/src/main/java/basic/SwitchString.java | dd9695c523b9f9908044570440ffd186164871f7 | [] | no_license | ganqzz/java_workspace | 1b919aff1f177c5b6971e7f19f465129a247ed72 | 3a7285e9b1945c8b55a4b02bbb20aee3d31a9086 | refs/heads/master | 2023-07-16T06:03:36.310878 | 2021-09-04T03:44:37 | 2021-09-04T03:44:37 | 389,467,395 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 648 | java | package basic;
class SwitchString {
public static void main(String[] args) {
int h = 0;
String s = args.length == 0 ? "" : args[0].trim().toLowerCase();
switch (s) {
case "hoge":
System.out.println("Case1: " + s);
break;
case "fuga":
System.out.println("Case2: " + s);
// break; // スルー
case "fefe":
System.out.println("Case3: " + s);
break;
default:
System.out.println("Default.");
break;
}
System.out.println();
}
}
| [
"[email protected]"
] | |
c5f0bda02cdf36e157d4160c176e3268a0923a98 | e67dddc05c8b7c143a35aad37c2ca88ca5aa3637 | /笔试/src/wangwei/t2/Test.java | 41337d13985c39d0a53b8f0feddc4938a145dbee | [] | no_license | Linliquan/java-learn | 886ff104e64b38982d7083a116b399bed847b717 | 4ff318715d9d89c55d93fa230d52115f09e58559 | refs/heads/master | 2022-07-04T07:23:15.042731 | 2021-08-07T09:55:37 | 2021-08-07T09:55:37 | 182,282,157 | 4 | 0 | null | 2022-06-21T04:15:10 | 2019-04-19T15:03:39 | Java | UTF-8 | Java | false | false | 2,535 | java | package wangwei.t2;
import java.util.*;
import java.math.*;
public class Test{
static int maxn=(int)(100+10);
static int n,m;
static BigInteger MOD =new BigInteger("100000");
static String INF="";
static BigInteger[][] map=new BigInteger[maxn][maxn];
static BigInteger base=new BigInteger("2");
static void init() {
for(int i=0;i<=n;i++) {
for(int j=0;j<=n;j++) {
if(i!=j)
map[i][j]=new BigInteger(INF);
else
map[i][j]=new BigInteger("0");
}
}
}
static BigInteger[] dis=new BigInteger[maxn];
static boolean[] vis =new boolean[maxn];
static void dijkstra(int start) {
for(int i=0;i<n;i++) {
dis[i]=map[start][i];
vis[i]=false;
}
dis[start]=new BigInteger("0");
vis[start]=true;
for(int i=0;i<n-1;i++) {
int k=-1;
BigInteger minD=new BigInteger(INF);
for(int j=0;j<n;j++) {
if(!vis[j]&&dis[j].compareTo(minD)<0) {
minD=dis[j];
k=j;
}
}
if(k==-1) break;
vis[k]=true;
for(int j=0;j<n;j++) {
if(!vis[j]&&dis[j].compareTo(dis[k].add(map[k][j]))>0)
dis[j]=dis[k].add(map[k][j]);
}
}
}
public static void main(String[] args) {
Scanner cin=new Scanner(System.in);
for(int i=0;i<=160;i++)
INF+="9";
while(cin.hasNext()) {
n=cin.nextInt();
m=cin.nextInt();
init();
for(int k=0;k<m;k++) {
int u=cin.nextInt();
int v=cin.nextInt();
if(!map[u][v].toString().equals(INF)) continue;
map[u][v]=map[v][u]=new BigInteger( base.pow(k).toString());
}
dijkstra(0);
for(int i=1;i<n;i++) {
BigInteger d=dis[i];
if(d.toString().equals(INF))
System.out.println("-1");
else
System.out.println(d.mod(MOD));
}
}
cin.close();
}
}
//import java.util.Scanner;
//
//public class Test {
// public static void main(String[] args) {
// Scanner sc = new Scanner(System.in);
//
// int [] a = new int[36];
// for(int i = 0; i < 36; i++){
// a[i] = sc.nextInt();
// }
//
// }
//}
| [
"[email protected]"
] | |
d4505b4f87269a7488cf046d297374daf552f993 | 6c53b2b97e7d6873709ae1106e929bbe181a9379 | /src/java/com/eviware/soapui/support/propertyexpansion/PropertyExpansionDropTarget.java | f72b49205997f68b064803fb0d9f3093738820c5 | [] | no_license | stallewar/soapui- | ca7824f4c4bc268b9a7798383f4f2a141d38214b | 0464f7826945709032964af67906e7d6e61b698a | refs/heads/master | 2023-03-19T05:23:56.746903 | 2011-07-12T08:29:36 | 2011-07-12T08:29:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,305 | java | /*
* soapUI, copyright (C) 2004-2011 eviware.com
*
* soapUI is free software; you can redistribute it and/or modify it under the
* terms of version 2.1 of the GNU Lesser General Public License as published by
* the Free Software Foundation.
*
* soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details at gnu.org.
*/
package com.eviware.soapui.support.propertyexpansion;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.dnd.DropTargetDragEvent;
import java.awt.dnd.DropTargetDropEvent;
import java.awt.dnd.DropTargetEvent;
import java.awt.dnd.DropTargetListener;
import javax.swing.text.JTextComponent;
import com.eviware.soapui.SoapUI;
import com.eviware.soapui.model.propertyexpansion.PropertyExpansionImpl;
import com.eviware.soapui.model.propertyexpansion.PropertyExpansionUtils;
import com.eviware.soapui.model.tree.nodes.PropertyTreeNode.PropertyModelItem;
import com.eviware.soapui.support.UISupport;
import com.eviware.soapui.support.xml.JXEditTextArea;
import com.eviware.soapui.support.xml.XmlUtils;
public final class PropertyExpansionDropTarget implements DropTargetListener
{
private final PropertyExpansionTarget target;
public PropertyExpansionDropTarget( PropertyExpansionTarget target )
{
this.target = target;
}
public void dragEnter( DropTargetDragEvent dtde )
{
if( !isAcceptable( dtde.getTransferable() ) )
dtde.rejectDrag();
}
public void dragExit( DropTargetEvent dtde )
{
if( dtde.getDropTargetContext().getComponent() instanceof JTextComponent )
( ( JTextComponent )dtde.getDropTargetContext().getComponent() ).getCaret().setVisible( false );
else if( dtde.getDropTargetContext().getComponent() instanceof JXEditTextArea )
( ( JXEditTextArea )dtde.getDropTargetContext().getComponent() ).setCaretVisible( false );
}
public void dragOver( DropTargetDragEvent dtde )
{
if( !isAcceptable( dtde.getTransferable() ) )
dtde.rejectDrag();
if( dtde.getDropTargetContext().getComponent() instanceof JTextComponent )
{
JTextComponent textField = ( JTextComponent )dtde.getDropTargetContext().getComponent();
int pos = textField.viewToModel( dtde.getLocation() );
if( pos != -1 )
{
textField.setCaretPosition( pos );
textField.getCaret().setVisible( true );
}
}
if( dtde.getDropTargetContext().getComponent() instanceof JXEditTextArea )
{
JXEditTextArea textField = ( JXEditTextArea )dtde.getDropTargetContext().getComponent();
int pos = textField.pointToOffset( dtde.getLocation() );
if( pos != -1 )
{
textField.setCaretPosition( pos );
textField.setCaretVisible( true );
}
}
dtde.acceptDrag( dtde.getDropAction() );
}
public void drop( DropTargetDropEvent dtde )
{
if( !isAcceptable( dtde.getTransferable() ) )
dtde.rejectDrop();
else
{
try
{
Transferable transferable = dtde.getTransferable();
Object transferData = transferable.getTransferData( transferable.getTransferDataFlavors()[0] );
if( transferData instanceof PropertyModelItem )
{
dtde.acceptDrop( dtde.getDropAction() );
PropertyModelItem modelItem = ( PropertyModelItem )transferData;
String xpath = modelItem.getXPath();
if( xpath == null && XmlUtils.seemsToBeXml( modelItem.getProperty().getValue() ) )
{
xpath = UISupport.selectXPath( "Create PropertyExpansion", "Select XPath below", modelItem
.getProperty().getValue(), null );
if( xpath != null )
xpath = PropertyExpansionUtils.shortenXPathForPropertyExpansion( xpath, modelItem.getProperty()
.getValue() );
}
target.insertPropertyExpansion( new PropertyExpansionImpl( modelItem.getProperty(), xpath ),
dtde.getLocation() );
dtde.dropComplete( true );
}
}
catch( Exception e )
{
SoapUI.logError( e );
}
if( dtde.getDropTargetContext().getComponent() instanceof JTextComponent )
( ( JTextComponent )dtde.getDropTargetContext().getComponent() ).getCaret().setVisible( false );
else if( dtde.getDropTargetContext().getComponent() instanceof JXEditTextArea )
( ( JXEditTextArea )dtde.getDropTargetContext().getComponent() ).setCaretVisible( false );
}
}
public void dropActionChanged( DropTargetDragEvent dtde )
{
}
public boolean isAcceptable( Transferable transferable )
{
DataFlavor[] flavors = transferable.getTransferDataFlavors();
for( int i = 0; i < flavors.length; i++ )
{
DataFlavor flavor = flavors[i];
if( flavor.isMimeTypeEqual( DataFlavor.javaJVMLocalObjectMimeType ) )
{
try
{
Object modelItem = transferable.getTransferData( flavor );
if( modelItem instanceof PropertyModelItem )
{
return PropertyExpansionUtils.canExpandProperty( target.getContextModelItem(),
( ( PropertyModelItem )modelItem ).getProperty() );
}
}
catch( Exception ex )
{
SoapUI.logError( ex );
}
}
}
return false;
}
}
| [
"oysteigi@bluebear.(none)"
] | oysteigi@bluebear.(none) |
bb546de612ae8338a066695a15431d66987e68a8 | 4550f69306fe18febc0dddf54bbfebfd438a6956 | /src/main/java/fr/ippon/myinvoice/web/filter/gzip/GZipServletFilter.java | 69a1555323635f923178aa69b787f49bc9872cc1 | [] | no_license | BulkSecurityGeneratorProject/sample-cassandra-multi-criteria | 569519427b5693a4a170fb97b602eefa404c4c9f | 57c80bc43d460a2d3a66deb1dd7638eb3803dafb | refs/heads/master | 2022-12-21T00:00:17.813296 | 2015-06-01T16:03:10 | 2015-06-01T16:03:10 | 296,565,024 | 0 | 0 | null | 2020-09-18T08:44:11 | 2020-09-18T08:44:10 | null | UTF-8 | Java | false | false | 4,349 | java | package fr.ippon.myinvoice.web.filter.gzip;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.zip.GZIPOutputStream;
public class GZipServletFilter implements Filter {
private Logger log = LoggerFactory.getLogger(GZipServletFilter.class);
@Override
public void init(FilterConfig filterConfig) throws ServletException {
// Nothing to initialize
}
@Override
public void destroy() {
// Nothing to destroy
}
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletRequest httpRequest = (HttpServletRequest) request;
HttpServletResponse httpResponse = (HttpServletResponse) response;
if (!isIncluded(httpRequest) && acceptsGZipEncoding(httpRequest) && !response.isCommitted()) {
// Client accepts zipped content
if (log.isTraceEnabled()) {
log.trace("{} Written with gzip compression", httpRequest.getRequestURL());
}
// Create a gzip stream
final ByteArrayOutputStream compressed = new ByteArrayOutputStream();
final GZIPOutputStream gzout = new GZIPOutputStream(compressed);
// Handle the request
final GZipServletResponseWrapper wrapper = new GZipServletResponseWrapper(httpResponse, gzout);
wrapper.setDisableFlushBuffer(true);
chain.doFilter(request, wrapper);
wrapper.flush();
gzout.close();
// double check one more time before writing out
// repsonse might have been committed due to error
if (response.isCommitted()) {
return;
}
// return on these special cases when content is empty or unchanged
switch (wrapper.getStatus()) {
case HttpServletResponse.SC_NO_CONTENT:
case HttpServletResponse.SC_RESET_CONTENT:
case HttpServletResponse.SC_NOT_MODIFIED:
return;
default:
}
// Saneness checks
byte[] compressedBytes = compressed.toByteArray();
boolean shouldGzippedBodyBeZero = GZipResponseUtil.shouldGzippedBodyBeZero(compressedBytes, httpRequest);
boolean shouldBodyBeZero = GZipResponseUtil.shouldBodyBeZero(httpRequest, wrapper.getStatus());
if (shouldGzippedBodyBeZero || shouldBodyBeZero) {
// No reason to add GZIP headers or write body if no content was written or status code specifies no
// content
response.setContentLength(0);
return;
}
// Write the zipped body
GZipResponseUtil.addGzipHeader(httpResponse);
response.setContentLength(compressedBytes.length);
response.getOutputStream().write(compressedBytes);
} else {
// Client does not accept zipped content - don't bother zipping
if (log.isTraceEnabled()) {
log.trace("{} Written without gzip compression because the request does not accept gzip", httpRequest.getRequestURL());
}
chain.doFilter(request, response);
}
}
/**
* Checks if the request uri is an include. These cannot be gzipped.
*/
private boolean isIncluded(final HttpServletRequest request) {
String uri = (String) request.getAttribute("javax.servlet.include.request_uri");
boolean includeRequest = !(uri == null);
if (includeRequest && log.isDebugEnabled()) {
log.debug("{} resulted in an include request. This is unusable, because"
+ "the response will be assembled into the overrall response. Not gzipping.",
request.getRequestURL());
}
return includeRequest;
}
private boolean acceptsGZipEncoding(HttpServletRequest httpRequest) {
String acceptEncoding = httpRequest.getHeader("Accept-Encoding");
return acceptEncoding != null && acceptEncoding.contains("gzip");
}
}
| [
"[email protected]"
] | |
5822e1ef83fad05f32095991a90d0713ea33627a | 1563cdf4f808d9b2844643e787994bbea2ce5c55 | /pinyin/src/com/nillith/pinyin/Pinyin.java | 1b0b0d084cc42e22981a2e8265d1b942be9240be | [
"Apache-2.0"
] | permissive | tsp520/UniPinyin | 7c154cb1a5b8f396b326d5487b144979ee0e3ca9 | 765840c3d627eb417ba644dd4ac78be1c0665e13 | refs/heads/master | 2021-06-01T03:21:50.401810 | 2016-08-08T11:44:04 | 2016-08-08T11:44:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,603 | java | package com.nillith.pinyin;
public class Pinyin {
private static final Dictionary dict = Dictionary.getInstance();
public static Pinyin parsePinyin(String s) {
return new Pinyin((char) Meta.indexOf(s));
}
public static Pinyin getPinyin(char c) {
return new Pinyin(dict.get(c));
}
public static Pinyin[] getPinyin(String str) {
int num = str.length();
Pinyin[] result = new Pinyin[num];
for (int i = 0; i < num; ++i) {
result[i] = getPinyin(str.charAt(i));
}
return result;
}
public static String getPinyinString(char c) {
return getPinyin(c).toString();
}
public static String getPinyinStringAscii(char c) {
return getPinyin(c).toStringAscii();
}
public static String getPinyinStringAsciiNoTone(char c) {
return getPinyin(c).toStringAsciiNoTone();
}
public static String getPinyinString(String str) {
return getPinyinString(str, DELIMITER_DEFAULT, IGNORE_NOT_FOUND);
}
public static String getPinyinStringAscii(String str) {
return getPinyinStringAscii(str, DELIMITER_DEFAULT, IGNORE_NOT_FOUND);
}
public static String getPinyinStringAsciiNoTone(String str) {
return getPinyinStringAsciiNoTone(str, DELIMITER_DEFAULT, IGNORE_NOT_FOUND);
}
static final int PINYIN_LENGTH_AVG = 4;
static final String DELIMITER_DEFAULT = " ";
static final boolean IGNORE_NOT_FOUND = false;
static final int RESULT_DEFAULT = 0;
static final int RESULT_ASCII = 1;
static final int RESULT_ASCII_NO_TONE = 2;
static String getPinyinString(String str, String delimiter, boolean ignoreNotFound, final int resultOption) {
if (null == delimiter) {
delimiter = "";
}
Pinyin pinyin = new Pinyin();
StringBuilder sb = new StringBuilder((PINYIN_LENGTH_AVG + delimiter.length()) * str.length());
char c;
for (int i = 0, end = str.length(); i < end; ++i) {
c = str.charAt(i);
pinyin.data = dict.get(c);
if (0 == pinyin.data) {
if (!ignoreNotFound) {
sb.append(c);
sb.append(delimiter);
}
} else {
switch (resultOption) {
case RESULT_DEFAULT:
sb.append(pinyin.toString());
break;
case RESULT_ASCII:
sb.append(pinyin.toStringAscii());
break;
case RESULT_ASCII_NO_TONE:
sb.append(pinyin.toStringAsciiNoTone());
break;
default:
throw new IllegalArgumentException();
}
sb.append(delimiter);
}
}
return sb.toString().substring(0, sb.length() - delimiter.length());
}
public static String getPinyinString(String str, String delimiter, boolean ignoreNotFound) {
return getPinyinString(str, delimiter, ignoreNotFound, RESULT_DEFAULT);
}
public static String getPinyinStringAscii(String str, String delimiter, boolean ignoreNotFound) {
return getPinyinString(str, delimiter, ignoreNotFound, RESULT_ASCII);
}
public static String getPinyinStringAsciiNoTone(String str, String delimiter, boolean ignoreNotFound) {
return getPinyinString(str, delimiter, ignoreNotFound, RESULT_ASCII_NO_TONE);
}
public static Pinyin[] getPinyinAll(char c) {
Pinyin pinyin = getPinyin(c);
if (pinyin.isMarkedAsHeteronym()) {
char[] extras = dict.getExtras(c);
Pinyin[] pinyins = new Pinyin[extras.length];
pinyins[0] = pinyin;
for (int i = 1; i < pinyins.length; ++i) {
pinyins[i] = new Pinyin(extras[i]);
}
return pinyins;
} else {
return new Pinyin[]{pinyin};
}
}
public String getInitial() {
return getMeta().getInitial();
}
public String getFinal() {
return getMeta().getFinal();
}
public String getFinalAscii() {
return getMeta().getFinalAscii();
}
public int getTone() {
return getMeta().getTone();
}
@Override
public String toString() {
return getMeta().toString();
}
public String toStringAscii() {
return getMeta().toStringAscii();
}
public String toStringAsciiNoTone() {
return getMeta().toStringAsciiNoTone();
}
public Pinyin() {
}
Pinyin(char data) {
this.data = data;
}
public void unsafeSetInternal(char data) {
this.data = data;
}
public char getInternal() {
return data;
}
private Meta getMeta() {
return Meta.ALL[getMetaIndex()];
}
char data;
private static final char IS_HETERONYM = 1;
public static boolean isHeteronym(char c) {
return getPinyin(c).isMarkedAsHeteronym();
}
boolean isMarkedAsHeteronym() {
return getExtra() == IS_HETERONYM;
}
void markAsHeteronym() {
setExtra(IS_HETERONYM);
}
private static final int IDX_BITS = 11;
private static final char IDX_MASK = 0x7ff;
int getMetaIndex() {
int result = data & IDX_MASK;
return result;
}
int getExtra() {
return data >>> IDX_BITS;
}
void setExtra(int extra) {
data = (char) (getMetaIndex() | (extra << IDX_BITS));
}
}
| [
"[email protected]"
] | |
e7ab45ad68bcff3c6f290675bbcb5c0c6d622cd5 | d1c71eeffd7481c4d49e960a06496abeee90d41f | /src/game/GameConstants.java | 018cb6c750d2108db50b86d9462653d5e791a759 | [] | no_license | gbeljajew/GSPP | 0f46ca56282af74d96530bdfc4b79729d75a11c1 | 5dc9ed7982b0fb752146d315b82b25884c644b4a | refs/heads/master | 2020-03-28T07:37:46.155616 | 2019-07-01T17:12:19 | 2019-07-01T17:12:19 | 147,913,942 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,950 | java |
package game;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;
import javax.swing.JOptionPane;
/**
* @author gbeljajew
*/
public class GameConstants
{
// OPTIONAL check all those constants and change, if needed.
// a few constants needed for building up game gui.
/** screen width. */
public static final int PANEL_WIDTH;
/** screen high. */
public static final int PANEL_HEIGHT;
/** true: this game starts in full screen, false: in a window. */
public static final boolean FULL_SCREEN_MODE = false;
/** time between updates. <br>
* FPS = 1000 / TIMER_PERIOD */
public static final int TIMER_PERIOD = 20;
/** maximal number of scores that are saved */
public static final int MAX_SCORE_ENTRIES = 20;
/** Width of buttons in menu */
public static final int BUTTON_WIDTH = GameConstants.PANEL_WIDTH / 4 - 5;
/** Height of buttons in menu */
public static final int BUTTON_HEIGHT = 20;
/** Get your localized Strings from here */
public static final ResourceBundle RESOURCE_BUNDLE = PropertyResourceBundle.getBundle("game.local.MyBundle");
/** path to folder, where this game was started */
public static final String WORK_PATH;
/** Path to save file for score */
public static final String SAVE_PATH;
public static final String ICON_IMAGE_PATH = "/graphic/GameSeedIcon.png";
private static final String SAVE_FILE_NAME = "/score.dat";
static
{
// OPTIONAL if you want you can load those constants from config.
if(FULL_SCREEN_MODE)
{
Dimension desctop = Toolkit.getDefaultToolkit().getScreenSize();
PANEL_WIDTH = desctop.width;
PANEL_HEIGHT = desctop.height;
}
else
{
PANEL_WIDTH = 800;
PANEL_HEIGHT = 600;
}
URI location;
String workPath = ".";
try
{
location = GameConstants.class.getProtectionDomain().getCodeSource().getLocation().toURI();
Path path = Paths.get( location).getParent();
workPath = path.toAbsolutePath().toString();
}
catch( URISyntaxException ex )
{
// i didn't used here method from game.util.Utils because i did not want to create circular dependances.
JOptionPane.showMessageDialog( null,
ex,
RESOURCE_BUNDLE.getString( "error.generic_error"),
JOptionPane.ERROR_MESSAGE);
}
WORK_PATH = workPath;
SAVE_PATH = WORK_PATH + SAVE_FILE_NAME;
}
}
| [
"[email protected]"
] | |
e840f4fc50328ae53e6b8a6582e47aebc03fe605 | 98d9e5fb6f7992bbeaf663dfe28729a22a9c9837 | /CICLO_II/Retos/Reto 5/Soluciones/Reto65/src/controller.java | 794aa8516354c1c6cfce234cdd63e17f77b0751b | [] | no_license | MISIONTIC-UN-2022/CICLO_II | b913f922ad7ae333c67cc04bd813b70e4657c760 | 40b2c1d4fa9efd97600874d4182a352f3b43d992 | refs/heads/master | 2023-07-20T10:46:54.484178 | 2021-08-25T23:34:45 | 2021-08-25T23:34:45 | 399,983,308 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 5,754 | java | import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.ListView;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.scene.input.MouseEvent;
public class controller {
@FXML
private Label bodyOfWaterLabel;
@FXML
private Label nameLabel;
@FXML
private TextField nameTextField;
@FXML
private Label idLabel;
@FXML
private TextField idTextField;
@FXML
private Label typeOfWaterLabel;
@FXML
private TextField typeOfWaterTextField;
@FXML
private Label cityLabel;
@FXML
private TextField cityTextField;
@FXML
private Label bodyOfWaterTypeLabel;
@FXML
private TextField bodyOfWaterTypeTextField;
@FXML
private Label ircaLabel;
@FXML
private TextField ircaTextField;
@FXML
private Button addBodyOfWaterButton;
@FXML
private TextArea textArea1;
@FXML
private TextArea textArea2;
@FXML
private Label pNameLabel;
@FXML
private TextField pNameTextField;
@FXML
private Label pIDLabel;
@FXML
private TextField pIDTextField;
@FXML
private Label populationLabel;
@FXML
private TextField populationTextField;
@FXML
private ListView<DensidadPoblacional> populationDensityList;
@FXML
private TextArea textArea3;
@FXML
private Button addPopulationDensityButton;
@FXML
private Button addPopulationButton;
@FXML
private Button processDataButton;
@FXML
void addBodyOfWaterButtonClick(ActionEvent event) {
String s = String.join(" ", nameTextField.getText(),
idTextField.getText(),
cityTextField.getText(),
bodyOfWaterTypeTextField.getText(),
typeOfWaterTextField.getText(),
ircaTextField.getText());
//System.out.println(s);
textArea1.setText(textArea1.getText() + s + "\n");
nameTextField.setText("");
idTextField.setText("");
cityTextField.setText("");
bodyOfWaterTypeTextField.setText("");
typeOfWaterTextField.setText("");
ircaTextField.setText("");
}
@FXML
void addPopulationButtonClick(ActionEvent event) {
if (!populationTextField.getText().isEmpty()) {
int cantHab = Integer.parseInt(populationTextField.getText());
DensidadPoblacional pd = populationDensityList.getSelectionModel().getSelectedItem();
pd.setCantidadHabitantes(cantHab);
populationTextField.setText("");
}
}
@FXML
void addPopulationDensityButtonClick(ActionEvent event) {
DensidadPoblacional pd = new DensidadPoblacional(Double.parseDouble(pIDTextField.getText()), pNameTextField.getText());
populationDensityList.getItems().add(pd);
pNameTextField.setText("");
pIDTextField.setText("");
}
@FXML
void itemMouseClick(MouseEvent event) {
DensidadPoblacional pd = populationDensityList.getSelectionModel().getSelectedItem();
textArea3.setText("");
textArea3.setText("El nivel de afección en es de tipo: " + String.valueOf(pd.afeccion()));
}
@FXML
void processDataButtonClick(ActionEvent event) {
String datitos = textArea1.getText().strip();
String[] cuerposDeAguasS = datitos.split("\n");
CuerpoDeAgua[] datos = new CuerpoDeAgua[cuerposDeAguasS.length];
for (int i = 0; i < cuerposDeAguasS.length; i++) {
String[] temp = cuerposDeAguasS[i].split(" ");
datos[i] = new CuerpoDeAgua(temp[0], Double.parseDouble(temp[1]),
temp[2], temp[3], temp[4], Double.parseDouble(temp[5]));
}
//Id de cada cuerpo de agua
double id;
for (int i = 0; i < cuerposDeAguasS.length; i++) {
id = datos[i].getId();
System.out.println(id);
TextArea2.setText(TextArea2.getText() + String.format("%.2f", id) +"\n");
}
// Numero de cuerpos de agua con nivel de riesgo entre BAJO y MEDIO
double cont = 0;
for (int i = 0; i < cuerposDeAguasS.length; i++) {
if (datos[i].getIrca() > 5 && datos[i].getIrca() <= 35) {
cont++;
}
}
System.out.println(String.format("%.2f", cont));
TextArea2.setText(TextArea2.getText() + String.format("%.2f", cont) +"\n");
//Nombre de cuerpos de agua con nivel de riesgo MEDIO
double contm = 0;
for (int i = 0; i < cuerposDeAguasS.length; i++) {
if (datos[i].getIrca() > 14 && datos[i].getIrca() <= 35) {
System.out.print(datos[i].getNombre() + " ");
TextArea2.setText(TextArea2.getText() + datos[i].getNombre() + " " + "\n");
contm++;
}
}
if (contm == 0) {
System.out.print("NA");
TextArea2.setText(TextArea2.getText() + "NA" + "\n");
}
//irca mas alto
double max = -1;
for (int i = 0; i < cuerposDeAguasS.length; i++) {
if (datos[i].getIrca() > max) {
max = datos[i].getIrca();
}
}
System.out.println("\n"+String.format("%.2f", max));
TextArea2.setText(TextArea2.getText() + "\n" + String.format("%.2f", max) + "\n");
}
}
| [
"[email protected]"
] | |
4b53da592efb7c3b452132b07f1df5595bc11623 | 1e7e6102354bcb0bccd511c4175c08e118fb8d27 | /lind-rs/src/main/java/de/egatlovs/lind/components/structure/entity/constraint/CheckValidRegex.java | e8f3ef53cc1d620f7c8a209071a1189a56c6c70b | [] | no_license | EgatlovS/lind | c63834e9f8a00f0eab7e04e3ac90d414ebc9956b | 6ae538f28ae40251534a5f8b619610e0a04dd42d | refs/heads/master | 2021-06-21T11:08:31.046616 | 2017-08-12T23:43:36 | 2017-08-12T23:43:36 | 95,186,769 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 605 | java | package de.egatlovs.lind.components.structure.entity.constraint;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
public class CheckValidRegex implements ConstraintValidator<ValidRegex, String> {
@Override
public void initialize(ValidRegex constraintAnnotation) {
}
@Override
public boolean isValid(String value, ConstraintValidatorContext context) {
try {
Pattern.compile(value);
return true;
} catch (PatternSyntaxException e) {
return false;
}
}
}
| [
"[email protected]"
] | |
b46317b8f98cd6aba573b0b93bead32ccf4c4e4a | cd647ca576bebe09ac13584d6c8b8008d4ea1523 | /app/src/main/java/com/example/admatic_51/emptytemplate/Activity/Screen7.java | 51588cc48f32c9297dacd9137a87b260d944cfec | [] | no_license | sabarna1604/AutomationDemo | e792199abe37c5b8c6afc909ea029a67e249160e | f0bbad275bca22eb5af3e92c759514dd35fb2b4c | refs/heads/master | 2021-09-10T12:15:32.379220 | 2018-03-26T05:42:21 | 2018-03-26T05:42:21 | 113,031,180 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 571 | java | package com.example.admatic_51.emptytemplate.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import com.example.admatic_51.emptytemplate.R;
/**
* Created by Admatic-51 on 29-11-2017.
*/
public class Screen7 extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.screen7);
}
}
| [
"[email protected]"
] | |
5e53f413652c95887cb550d169afc37c47a1534f | 98d006e8483c1d723c609c54535c52901dafbf3d | /src/main/java/com/yh/util/PageInterceptor.java | 19095d94232d71a85a0189a50e01312e803cda09 | [] | no_license | 1030364549/yh-trade | 5ea7686d1a2200a7487904c6a62e47e9803da903 | 55061d3007c74547b5ad4b4d4383b84780aee310 | refs/heads/master | 2022-07-03T20:42:37.281457 | 2019-10-22T08:01:39 | 2019-10-22T08:01:39 | 216,756,637 | 0 | 0 | null | 2022-02-09T22:29:00 | 2019-10-22T08:00:53 | JavaScript | UTF-8 | Java | false | false | 11,892 | java | package com.yh.util;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Collection;
import java.util.List;
import java.util.Properties;
import java.util.StringTokenizer;
import org.apache.ibatis.executor.parameter.ParameterHandler;
import org.apache.ibatis.executor.statement.RoutingStatementHandler;
import org.apache.ibatis.executor.statement.StatementHandler;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.mapping.ParameterMapping;
import org.apache.ibatis.plugin.Interceptor;
import org.apache.ibatis.plugin.Intercepts;
import org.apache.ibatis.plugin.Invocation;
import org.apache.ibatis.plugin.Plugin;
import org.apache.ibatis.plugin.Signature;
import com.yh.entity.Page;
import org.apache.ibatis.scripting.defaults.DefaultParameterHandler;
/**
* ************************************
* 分页拦截器,用于拦截需要进行分页查询的操作,然后对其进行分页处理。
*
* @param <T>
* @param <PK> ************************************
*/
@SuppressWarnings("all")
@Intercepts({@Signature(method = "prepare", type = StatementHandler.class, args = {Connection.class, Integer.class})})
public class PageInterceptor implements Interceptor {
private String databaseType;//数据库类型,不同的数据库有不同的分页方法
private String printSql;//控制台输出SQL语句,0不输出,1输出
private String writeSqlLog;//保存sql操作日志
/**
* ************************************
* 拦截后要执行的方法
*
* @param <T>
* @param <PK> ************************************
*/
public Object intercept(Invocation invocation) throws Throwable {
//对于StatementHandler其实只有两个实现类,一个是RoutingStatementHandler,另一个是抽象类BaseStatementHandler,
//BaseStatementHandler有三个子类,分别是SimpleStatementHandler,PreparedStatementHandler和CallableStatementHandler,
//SimpleStatementHandler是用于处理Statement的,PreparedStatementHandler是处理PreparedStatement的,而CallableStatementHandler是
//处理CallableStatement的。Mybatis在进行Sql语句处理的时候都是建立的RoutingStatementHandler,而在RoutingStatementHandler里面拥有一个
//StatementHandler类型的delegate属性,RoutingStatementHandler会依据Statement的不同建立对应的BaseStatementHandler,即SimpleStatementHandler、
//PreparedStatementHandler或CallableStatementHandler,在RoutingStatementHandler里面所有StatementHandler接口方法的实现都是调用的delegate对应的方法。
//我们在PageInterceptor类上已经用@Signature标记了该Interceptor只拦截StatementHandler接口的prepare方法,又因为Mybatis只有在建立RoutingStatementHandler的时候
//是通过Interceptor的plugin方法进行包裹的,所以我们这里拦截到的目标对象肯定是RoutingStatementHandler对象。
RoutingStatementHandler handler = (RoutingStatementHandler) invocation.getTarget();
//通过反射获取到当前RoutingStatementHandler对象的delegate属性
StatementHandler delegate = (StatementHandler) ReflectUtil.getFieldValue(handler, "delegate");
//获取到当前StatementHandler的 boundSql,这里不管是调用handler.getBoundSql()还是直接调用delegate.getBoundSql()结果是一样的,因为之前已经说过了
//RoutingStatementHandler实现的所有StatementHandler接口方法里面都是调用的delegate对应的方法。
BoundSql bounSql = delegate.getBoundSql();
//拿到当前绑定Sql的参数对象,就是我们在调用对应的Mapper映射语句时所传入的参数对象
//获取当前要执行的Sql语句,也就是我们直接在Mapper映射语句中写的Sql语句
String sql = bounSql.getSql();
if ("1".equals("1")) {
System.out.println("----------------------------------------------SQL Print----------------------------------------------");
String beSql = formatSql(sql);
System.out.println(beSql);
System.out.println("-----------------------------------------------------------------------------------------------------");
}
Object obj = bounSql.getParameterObject();
//通过传入的是Page对象 认定它是需要进行分页操作的
if (obj instanceof Page) {
Page page = (Page)obj;
//通过反射获取delegate父类BaseStatementHandler的mappedStatement属性
MappedStatement mappedStatement = (MappedStatement) ReflectUtil.getFieldValue(delegate, "mappedStatement");
//拦截到的prepare方法参数是一个Connection对象
Connection connection = (Connection) invocation.getArgs()[0];
//如果是第一次,那么就统计,接下来翻页将不统计
if (page.getPageNo() == 1) {
this.setTotalRecord(page, mappedStatement, connection);
}
//获取分页SQL语句
String pageSql = this.getPageSql(page, sql);
//利用反射设置当前BoundSql对应的sql属性为我们建立好的分页Sql语句
ReflectUtil.setFieldValue(bounSql, "sql", pageSql);
}
return invocation.proceed();
}
/**
* ************************************
* 拦截器对应的封装原始对象的方法
*
* @param <T>
* @param <PK> ************************************
*/
public Object plugin(Object target) {
return Plugin.wrap(target, this);
}
/**
* ************************************
* 设置注册拦截器时设定的属性
*
* @param <T>
* @param <PK> ************************************
*/
public void setProperties(Properties properties) {
this.databaseType = properties.getProperty("databaseType");
this.printSql = properties.getProperty("printSql");
this.writeSqlLog = properties.getProperty("writeSqlLog");
}
/**
* ************************************
* 给当前的参数对象page设置总记录数
*
* @param page Mapper映射语句对应的参数对象
* @param mappedStatement Mapper映射语句
* @param connection 当前的数据库连接
* ************************************
*/
private void setTotalRecord(Page page, MappedStatement mappedStatement, Connection connection) {
//获取对应的BoundSql,这个BoundSql其实跟我们利用StatementHandler获取到的BoundSql是同一个对象。
//delegate里面的boundSql也是通过mappedStatement.getBoundSql(paramObj)方法获取到的。
BoundSql boundSql = mappedStatement.getBoundSql(page);
//获取到我们自己写在Mapper映射语句中对应的Sql语句
String sql = boundSql.getSql();
//通过查询Sql语句获取到对应的计算总记录数的sql语句
String countSql = this.getCountSql(sql);
//通过BoundSql获取对应的参数映射
List<ParameterMapping> parameterMappings = boundSql.getParameterMappings();
//利用Configuration、查询记录数的Sql语句countSql、参数映射关系parameterMappings和参数对象page建立查询记录数对应的BoundSql对象。
BoundSql countBoundSql = new BoundSql(mappedStatement.getConfiguration(), countSql, parameterMappings, page);
//通过mappedStatement、参数对象page和BoundSql对象countBoundSql建立一个用于设定参数的ParameterHandler对象
ParameterHandler parameterHandler = new DefaultParameterHandler(mappedStatement, page, countBoundSql);
//通过connection建立一个countSql对应的PreparedStatement对象。
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
pstmt = connection.prepareStatement(countSql);
//通过parameterHandler给PreparedStatement对象设置参数
parameterHandler.setParameters(pstmt);
//之后就是执行获取总记录数的Sql语句和获取结果了
rs = pstmt.executeQuery();
if (rs.next()) {
int totalRecord = rs.getInt(1);
//给当前的参数page对象设置总记录数
page.setTotalRecord(totalRecord);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (rs != null) {
rs.close();
}
if (pstmt != null) {
pstmt.close();
}
} catch (SQLException e) {
e.printStackTrace();
}
}
}
/**
* ************************************
* 根据原Sql语句获取对应的查询总记录数的Sql语句
*
* @param sql ************************************
*/
private String getCountSql(String sql) {
String new_sql = "select count(*) from (" + sql + ")";
return new_sql;
}
private String getPageSql(Page page, String sql) {
StringBuffer sqlBuffer = new StringBuffer(sql);
if ("mysql".equalsIgnoreCase(databaseType)) {
return getMySqlPageSql(page, sqlBuffer);
} else if ("oracle".equalsIgnoreCase(databaseType)) {
return getOraclePageSql(page, sqlBuffer);
}
return sqlBuffer.toString();
}
/**
* ************************************
* 获取Mysql数据库的分页查询语句
*
* @param sql ************************************
*/
private String getMySqlPageSql(Page page, StringBuffer sqlBuffer) {
if (page.getOrderField() != null && !page.getOrderField().equals("") && sqlBuffer.indexOf("order by") == -1) {
sqlBuffer.append(" order by ").append(page.getOrderField()).append(" ").append(page.getOrderDirection());
}
//计算第一条记录的位置,Mysql中记录的位置是从0开始的
int offset = (page.getPageNo() - 1) * page.getPageSize();
sqlBuffer.append(" limit ").append(offset).append(",").append(page.getPageSize());
return sqlBuffer.toString();
}
private String getOraclePageSql(Page page, StringBuffer sqlBuffer) {
if (page.getOrderField() != null && !page.getOrderField().equals("") && sqlBuffer.indexOf("order by") == -1) {
sqlBuffer.append(" order by ").append(page.getOrderField()).append(" ").append(page.getOrderDirection());
}
//计算第一条记录的位置,Oracle分页是通过rownum进行的,而rownum是从1开始的
int offset = (page.getPageNo() - 1) * page.getPageSize() + 1;
sqlBuffer.insert(0, "select u.*, rownum r from (").append(") u where rownum < ").append(offset + page.getPageSize());
sqlBuffer.insert(0, "select * from (").append(") where r >= ").append(offset);
System.out.println(sqlBuffer.toString());
return sqlBuffer.toString();
}
/**
* ************************************
* 格式化SQL
*
* @param sql ************************************
*/
private String formatSql(String sql) {
// 输入sql字符串空判断
if (sql == null || sql.length() == 0) {
return "";
}
// 美化sql
sql = beautifySql(sql);
return sql;
}
/**
* ************************************
* 美化SQL
*
* @param sql ************************************
*/
private String beautifySql(String sql) {
sql = sql.replaceAll("[\\s\n ]+", " ");
return sql;
}
}
| [
"[email protected]"
] | |
3eb6b47c6a034027a2cd6f4e996a2501e4796875 | cec95e3cdba980d7d000fe5229cad02305605ff9 | /SplitCalculator/src/ArrayCalculator.java | ddea7d074f72cca93e0b800ea87bd103c967a847 | [] | no_license | Kimhyungwoo1/Java | 988d2d4f20489640c0551f1ae29e2fe93a7bfdd2 | e382293ed63eb170fdb1b0fbd07e2ad8f7acbe8c | refs/heads/master | 2021-01-11T19:48:15.111447 | 2017-02-17T07:13:17 | 2017-02-17T07:13:17 | 79,401,237 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 158 | java |
public class ArrayCalculator {
void calculator(int[] points) {
int resulte = points[0] + points[1] + points[2];
System.out.println(resulte);
}
}
| [
"[email protected]"
] | |
df79e7401ae7cf5a946e96fb76adec6b4e6aac12 | fced7a4151e36158775901ce4cecc69e301b9c45 | /cldt-common-zk/src/main/java/com/cldt/zk/registry/exception/RegExceptionHandler.java | c19a56fd82e474edebb162bcfb966c56b12b4efe | [
"Apache-2.0"
] | permissive | andy-chau/cldt-common | 7189eeafba2481ea97dd6b7e38281e174de5f1ad | e92c544d9834d94f6d1c809ad5d9b4c064da0bbe | refs/heads/master | 2021-10-24T22:13:46.545709 | 2019-03-29T09:29:57 | 2019-03-29T09:29:57 | 176,850,589 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,175 | java | package com.cldt.zk.registry.exception;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.zookeeper.KeeperException.NoNodeException;
import org.apache.zookeeper.KeeperException.NodeExistsException;
/**
* 注册中心异常处理类.
*
* @author zhangliang
*/
@Slf4j
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class RegExceptionHandler {
/**
* 处理异常.
* <p>
* <p>处理掉中断和连接失效异常并继续抛注册中心.</p>
*
* @param cause 待处理异常.
*/
public static void handleException(final Exception cause) {
if (null == cause) {
return;
}
boolean flag = isIgnoredException(cause) || null != cause.getCause() && isIgnoredException(cause.getCause());
if (flag) {
log.debug("Elastic job: ignored exception for: {}", cause.getMessage());
} else if (cause instanceof InterruptedException) {
Thread.currentThread().interrupt();
} else {
throw new RegException(cause);
}
}
private static boolean isIgnoredException(final Throwable cause) {
return cause instanceof NoNodeException || cause instanceof NodeExistsException;
}
}
| [
"[email protected]"
] | |
91bf43d75c989f9c918da6fc467186d4e94ce48e | 2753ab85dca8541eaeebc9c763da69d48285fda4 | /Car Decision/CarCostCalculation.java | 5801d767b2978cef60f3142c82423b337f5f109e | [] | no_license | Ali17560/CS175-01L | a772de65a89c02fb2fc4544e5089c3ebb247da41 | e8dcb5afb99caad5cf87b421811a1ec2da1d8bb7 | refs/heads/master | 2022-04-30T16:14:24.769722 | 2022-03-25T02:38:20 | 2022-03-25T02:38:20 | 238,813,137 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,475 | java | import java.util.Scanner;
public class CarCostCalculation {
public static void main(String[] args) {
// TODO Auto-generated method stub
//Inputs
Scanner scan=new Scanner(System.in);
System.out.print("Enter the cost of a regular car: ");
double regularCarCost=scan.nextDouble();
System.out.print("Enter the miles per gallon of a regular car: ");
double regularGallonMiles=scan.nextDouble();
System.out.print("Enter the cost of a hybrid car: ");
double hybridCarCost=scan.nextDouble();
System.out.print("Enter the miles per gallon of a hybrid car: ");;
double hybridGallonMiles=scan.nextDouble();
System.out.print("Enter the miles traveled in a year: ");
double travelMiles=scan.nextDouble();
System.out.print("Enter the cost per gallon of gas: ");
double costPerGallon=scan.nextDouble();
//Computations
double yearOne=regularCarCost+(travelMiles/regularGallonMiles)*2.5;
System.out.println("Cost to own after Year 1 for regular car: "+yearOne);
double yearOne1=hybridCarCost+(travelMiles/hybridGallonMiles)*2.5;
System.out.println("Cost to own after Year 1 for hybrid car: "+yearOne1);
double yearTwo=regularCarCost+(travelMiles*(2)/regularGallonMiles)*2.5;
System.out.println("Cost to own after Year 2 for regular car: "+yearTwo);
double yearTwo2=hybridCarCost+(travelMiles*(2)/hybridGallonMiles)*2.5;
System.out.println("Cost to own after Year 2 for hybrid car: "+yearTwo2);
double yearThree=regularCarCost+(travelMiles*(3)/regularGallonMiles)*2.5;
System.out.println("Cost to own after Year 3 for regular car: "+yearThree);
double yearThree3=hybridCarCost+(travelMiles*(3)/hybridGallonMiles)*2.5;
System.out.println("Cost to own after Year 3 for hybrid car: "+yearThree3);
double yearFour=regularCarCost+(travelMiles*(4)/regularGallonMiles)*2.5;
System.out.println("Cost to own after Year 4 for regular car: "+yearFour);
double yearFour4=hybridCarCost+(travelMiles*(4)/hybridGallonMiles)*2.5;
System.out.println("Cost to own after Year 4 for hybrid car: "+yearFour4);
double yearFive=regularCarCost+(travelMiles*(5)/regularGallonMiles)*2.5;
System.out.println("Cost to own after Year 5 for regular car: "+yearFive);
double yearFive5=hybridCarCost+(travelMiles*(5)/hybridGallonMiles)*2.5;
System.out.println("Cost to own after Year 5 for hybrid car: "+yearFive5);
System.out.println("The hybrid car pays back after 5 years");
}
}
| [
"[email protected]"
] | |
fd26c90b5eeb9e944b8f7e4e2e7b0169968ae161 | b79d189fc142f49adc1c34dd9a72bb82926a5a87 | /AcademicoJSF/src/main/java/pe/edu/upeu/ServletInitializer.java | b2194cab3caadee4861d12c343afde39b1af3398 | [] | no_license | davidmp/ProyectJavaArquitecturas | c749fba1bf184167f328d60a2638f2123d805212 | 8c780af50c9930973f870e290674c0cfac110790 | refs/heads/master | 2020-03-26T21:55:08.801988 | 2018-11-21T17:12:08 | 2018-11-21T17:12:08 | 145,417,711 | 2 | 4 | null | null | null | null | UTF-8 | Java | false | false | 3,057 | java | package pe.edu.upeu;
import java.util.Collections;
import javax.faces.application.ProjectStage;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import org.primefaces.util.Constants;
import org.springframework.beans.factory.config.CustomScopeConfigurer;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.ServletContextInitializer;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ResourceBundleMessageSource;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
//import org.springframework.faces.mvc.JsfView;
//import org.springframework.web.servlet.view.UrlBasedViewResolver;
@Configuration
@EnableAutoConfiguration //(exclude = { JpaConfig.class })
@ComponentScan
@SpringBootApplication
public class ServletInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(AcademicoJsfApplication.class);
}
@Bean
public static CustomScopeConfigurer customScopeConfigurer() {
CustomScopeConfigurer configurer = new CustomScopeConfigurer();
configurer.setScopes(Collections.<String, Object>singletonMap(FacesViewScope.NAME, new FacesViewScope()));
return configurer;
}
@Bean
public ServletContextInitializer servletContextCustomizer() {
return new ServletContextInitializer() {
@Override
public void onStartup(ServletContext sc) throws ServletException {
sc.setInitParameter(Constants.ContextParams.THEME, "start");
sc.setInitParameter(Constants.ContextParams.FONT_AWESOME, "true");
sc.setInitParameter(ProjectStage.PROJECT_STAGE_PARAM_NAME, ProjectStage.Development.name());
}
};
}
// @Bean
// public UrlBasedViewResolver setupViewResolver() {
// UrlBasedViewResolver resolver = new UrlBasedViewResolver();
// resolver.setViewClass(JsfView.class);
// resolver.setPrefix("/WEB-INF/modulos/");
// resolver.setSuffix(".xhtml");
//
// return resolver;
// }
@Bean
public MessageSource messageSourceOther() {
ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
messageSource.setBasename("messages");
return messageSource;
}
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/resources/**").addResourceLocations("/resources/");
registry.addResourceHandler("/webjars/**").addResourceLocations("/webjars/");
}
}
| [
"[email protected]"
] | |
f9613fe3b516189d590c97765442ef95a5bba9cb | 8368f1929c9ab9d0a5a57de2cc9173fc8fa0919e | /src/com/ymj/pattern/code03_prototype/simple/Client.java | 6fcc43aeda6c0e9499969dea24556d08fe798940 | [] | no_license | Asurazzz/DesignPattern | 74f8b5bb019b8384d10eb13d32dac6ce887555ad | fd7939f05921993f6a1e9028b049b899c056edd2 | refs/heads/main | 2021-07-21T21:15:57.696214 | 2021-06-17T03:34:04 | 2021-06-17T03:34:04 | 251,341,520 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 411 | java | package com.ymj.pattern.code03_prototype.simple;
/**
* @Classname Client
* @Description TODO
* @Date 2021/6/8 16:15
* @Created by yemingjie
*/
public class Client {
private Prototype prototype;
public Client(Prototype prototype) {
this.prototype = prototype;
}
public Prototype startClone(Prototype concretPrototype) {
return (Prototype) concretPrototype.clone();
}
}
| [
"[email protected]"
] | |
563bbbbacccdc53aaf8ac087797610a9a253b43d | bf2966abae57885c29e70852243a22abc8ba8eb0 | /aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/transform/DeleteInventoryResultJsonUnmarshaller.java | 937a30644ad6edbb2b0e0d570b9bb254dbedadde | [
"Apache-2.0"
] | permissive | kmbotts/aws-sdk-java | ae20b3244131d52b9687eb026b9c620da8b49935 | 388f6427e00fb1c2f211abda5bad3a75d29eef62 | refs/heads/master | 2021-12-23T14:39:26.369661 | 2021-07-26T20:09:07 | 2021-07-26T20:09:07 | 246,296,939 | 0 | 0 | Apache-2.0 | 2020-03-10T12:37:34 | 2020-03-10T12:37:33 | null | UTF-8 | Java | false | false | 3,380 | java | /*
* Copyright 2016-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.simplesystemsmanagement.model.transform;
import java.math.*;
import javax.annotation.Generated;
import com.amazonaws.services.simplesystemsmanagement.model.*;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*;
import com.amazonaws.transform.*;
import com.fasterxml.jackson.core.JsonToken;
import static com.fasterxml.jackson.core.JsonToken.*;
/**
* DeleteInventoryResult JSON Unmarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class DeleteInventoryResultJsonUnmarshaller implements Unmarshaller<DeleteInventoryResult, JsonUnmarshallerContext> {
public DeleteInventoryResult unmarshall(JsonUnmarshallerContext context) throws Exception {
DeleteInventoryResult deleteInventoryResult = new DeleteInventoryResult();
int originalDepth = context.getCurrentDepth();
String currentParentElement = context.getCurrentParentElement();
int targetDepth = originalDepth + 1;
JsonToken token = context.getCurrentToken();
if (token == null)
token = context.nextToken();
if (token == VALUE_NULL) {
return deleteInventoryResult;
}
while (true) {
if (token == null)
break;
if (token == FIELD_NAME || token == START_OBJECT) {
if (context.testExpression("DeletionId", targetDepth)) {
context.nextToken();
deleteInventoryResult.setDeletionId(context.getUnmarshaller(String.class).unmarshall(context));
}
if (context.testExpression("TypeName", targetDepth)) {
context.nextToken();
deleteInventoryResult.setTypeName(context.getUnmarshaller(String.class).unmarshall(context));
}
if (context.testExpression("DeletionSummary", targetDepth)) {
context.nextToken();
deleteInventoryResult.setDeletionSummary(InventoryDeletionSummaryJsonUnmarshaller.getInstance().unmarshall(context));
}
} else if (token == END_ARRAY || token == END_OBJECT) {
if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {
if (context.getCurrentDepth() <= originalDepth)
break;
}
}
token = context.nextToken();
}
return deleteInventoryResult;
}
private static DeleteInventoryResultJsonUnmarshaller instance;
public static DeleteInventoryResultJsonUnmarshaller getInstance() {
if (instance == null)
instance = new DeleteInventoryResultJsonUnmarshaller();
return instance;
}
}
| [
""
] | |
f7135dbe570d10f037792be41ce922703a1ab09d | c800b6aa137b5b95a52a13501ffc1a563087237a | /src/main/java/cn/com/sky/algorithms/leetcode/easy/LargestPalindromeProduct479.java | 34f5e07083f07c1e2a0213de17e88901f3c4e12c | [] | no_license | git-sky/algorithms | a0b85a550c4605e207a75ba9083b9243cbadf319 | 582faffa813fce70e0e5afbb3d990f07219d3e2d | refs/heads/master | 2021-01-19T00:43:08.133723 | 2018-02-24T05:59:25 | 2018-02-24T05:59:25 | 73,152,330 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 493 | java | package cn.com.sky.algorithms.leetcode.easy;
/**
* <pre>
*
* 479. Largest Palindrome Product
*
* Find the largest palindrome made from the product of two n-digit numbers.
*
* Since the result could be very large, you should return the largest palindrome mod 1337.
*
* Example:
*
* Input: 2
*
* Output: 987
*
* Explanation: 99 x 91 = 9009, 9009 % 1337 = 987
*
* Note:
*
* The range of n is [1,8].
*
*
* </pre>
*/
public class LargestPalindromeProduct479 {
}
| [
"[email protected]"
] | |
f07962e6331d1e2b74cce8453f9f384a16c6a765 | 5f53b1ea0bbb537188aa6110db524bc7f1926def | /header/src/main/java/org/zstack/header/host/TakeSnapshotOnHypervisorMsg.java | 292afb46540ac0f4848b2c74d72207664b8cc6d4 | [
"Apache-2.0"
] | permissive | dangpf/zstack | 86293e2a5b479cf70c96a903c90523f29e41fd22 | 8db5d96d06f961d366c67c16394f4e4572c02115 | refs/heads/master | 2021-01-18T13:06:11.080079 | 2016-09-01T09:57:37 | 2016-09-01T09:58:40 | 56,648,736 | 1 | 0 | null | 2016-04-20T02:28:56 | 2016-04-20T02:28:55 | null | UTF-8 | Java | false | false | 1,645 | java | package org.zstack.header.host;
import org.zstack.header.core.ApiTimeout;
import org.zstack.header.message.NeedReplyMessage;
import org.zstack.header.volume.APICreateVolumeSnapshotMsg;
import org.zstack.header.volume.VolumeInventory;
@ApiTimeout(apiClasses = {APICreateVolumeSnapshotMsg.class})
public class TakeSnapshotOnHypervisorMsg extends NeedReplyMessage implements HostMessage {
private String hostUuid;
private String vmUuid;
private String snapshotName;
private VolumeInventory volume;
private String installPath;
private boolean fullSnapshot;
public boolean isFullSnapshot() {
return fullSnapshot;
}
public void setFullSnapshot(boolean fullSnapshot) {
this.fullSnapshot = fullSnapshot;
}
public String getSnapshotName() {
return snapshotName;
}
public void setSnapshotName(String snapshotName) {
this.snapshotName = snapshotName;
}
@Override
public String getHostUuid() {
return hostUuid;
}
public void setHostUuid(String hostUuid) {
this.hostUuid = hostUuid;
}
public String getVmUuid() {
return vmUuid;
}
public void setVmUuid(String vmUuid) {
this.vmUuid = vmUuid;
}
public VolumeInventory getVolume() {
return volume;
}
public void setVolume(VolumeInventory volume) {
this.volume = volume;
}
public String getInstallPath() {
return installPath;
}
public void setInstallPath(String installPath) {
this.installPath = installPath;
}
}
| [
"[email protected]"
] | |
0d794d406c5b2b02b77a11c49c7e763e9edd422c | cc1efcfd76393bb8feb94fad238bab6ead6a38c2 | /weather-city-server/src/main/java/com/fangdean/weathercity/util/XmlBuilder.java | 296ccca87037629a0ed197d24830fa9cb784399b | [] | no_license | mianjuhou/weathernew | d8c37defe31b733c29c0f3833ab68d39b2ad37ac | 89937634edd5822b7fab5c6731e3981dfe0dbee9 | refs/heads/master | 2020-03-21T01:50:04.609794 | 2018-06-20T10:17:13 | 2018-06-20T10:17:13 | 137,965,512 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 706 | java | package com.fangdean.weathercity.util;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
public class XmlBuilder {
public static Object xmlStrTpObject(Class<?> clazz, String xmlStr) throws IOException, JAXBException {
Reader reader = new StringReader(xmlStr);
JAXBContext context = JAXBContext.newInstance(clazz);
Unmarshaller unmarshaller = context.createUnmarshaller();
Object xmlObject = unmarshaller.unmarshal(reader);
if (null != reader) {
reader.close();
}
return xmlObject;
}
}
| [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.