blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2 values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557 values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82 values | src_encoding stringclasses 28 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 7 5.41M | extension stringclasses 11 values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ad6e9fb0dd9a5a564f2db4b47f60e8f5aead5b90 | ce1ca4ad007082009b76792cb352e5a2c39003c1 | /renren-admin/src/main/java/io/renren/modules/demo/dao/GoodsDao.java | caf0781fdc94e516472107b6f40eda113e7340c1 | [
"Apache-2.0"
] | permissive | xhm993502807/renren-security | 8680440382001bcc21622b22eccbf6f2fb0f1a6f | 58fa86c18cb1c247cb4f87248469acb42175014d | refs/heads/master | 2023-06-24T05:41:02.934532 | 2021-07-29T06:26:00 | 2021-07-29T06:26:00 | 390,247,029 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 365 | java | package io.renren.modules.demo.dao;
import io.renren.modules.demo.entity.GoodsEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* 商品管理
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2021-06-18 15:09:45
*/
@Mapper
public interface GoodsDao extends BaseMapper<GoodsEntity> {
}
| [
"993502807@qq.com"
] | 993502807@qq.com |
653a392dbe6b8a21215efc8177f7bb6c9e3fac8f | 7276bf166be74ee9244bbaf6b02330e2d33bd0ca | /osa08-Osa08_03.Varastointia/src/main/java/Muutoshistoria.java | 59e46d9a385378787929080a2844893bc6d5a2d0 | [] | no_license | mjHarakka/JavaMOOC_2019 | 35a01cd8f609ba3699f3fafbd50708e13fcd695f | 45a11fc71829fbb5104e342917cec5e47a80dd5f | refs/heads/master | 2020-04-23T04:14:28.577050 | 2019-05-15T20:44:27 | 2019-05-15T20:44:27 | 170,902,584 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,684 | 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.
*/
/**
*
* @author mikkoharakka
*/
import java.util.ArrayList;
public class Muutoshistoria {
private ArrayList<Double> tilanteet;
public Muutoshistoria() {
tilanteet = new ArrayList<>();
}
public double maxArvo() {
if (tilanteet.isEmpty()) {
return 0;
} else {
Double maxArvo = tilanteet.get(0);
for (Double arvo: tilanteet) {
if (arvo > maxArvo) {
maxArvo = arvo;
}
}
return maxArvo;
}
}
public double minArvo() {
if (tilanteet.isEmpty()) {
return 0;
} else {
Double minArvo = tilanteet.get(0);
for (Double arvo: tilanteet) {
if (arvo < minArvo) {
minArvo = arvo;
}
}
return minArvo;
}
}
public double keskiarvo() {
int summa = 0;
if (tilanteet.isEmpty()) {
return 0;
} else {
for (Double arvo: tilanteet) {
summa += arvo;
}
return summa / (double)tilanteet.size();
}
}
public void lisaa(double tilanne) {
this.tilanteet.add(tilanne);
}
public void nollaa() {
this.tilanteet.clear();
}
@Override
public String toString() {
return this.tilanteet.toString();
}
}
| [
"mj.harakka@gmail.com"
] | mj.harakka@gmail.com |
4556a4b2514354fcdc367215c1bd4dddd36e668b | a77b637c69d9497a0c29ffc0b89cbfa5cb1958f7 | /app/src/main/java/com/wangyukui/ywkj/bean/SearcherBean.java | 187bc5dd4ed9aa74a5e81d6010493a7a8deadd12 | [] | no_license | wangchenxing1990/tashanzhishi | 6b764aba6ffd499f7bef2576743d0be503d84e38 | 15b3829e0ac092d8b55eb19db6222e8ddbd4f90e | refs/heads/master | 2020-04-07T07:45:03.429599 | 2018-11-19T08:35:44 | 2018-11-19T08:35:44 | 158,187,293 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 748 | java | package com.wangyukui.ywkj.bean;
import java.io.Serializable;
/**
* Created by Administrator on 2017/5/22.
*/
public class SearcherBean implements Serializable {
private String id;
private String search_name;
private String updated_at;
public SearcherBean() {
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUpdated_at() {
return updated_at;
}
public void setUpdated_at(String updated_at) {
this.updated_at = updated_at;
}
public String getSearch_name() {
return search_name;
}
public void setSearch_name(String search_name) {
this.search_name = search_name;
}
}
| [
"18317770484@163.com"
] | 18317770484@163.com |
ef77001b01886c6e26621fcb99740079342019a2 | 4878bac6915d196f70f23f4ccf119891f047f114 | /app/src/main/java/com/android/vkplayer/view/AutoResizeTextView.java | 26d60970f9a39be48fe999cfc31055c5385070ba | [] | no_license | insearching/VKPlayer | 7a489d2384f2fd5db06ee42fdeea9d791bc1f510 | 2de6f77339f68fe146768c561ab5e5dd18538ecf | refs/heads/master | 2016-09-06T09:47:05.253726 | 2014-09-30T14:06:20 | 2014-09-30T14:06:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,076 | java | package com.android.vkplayer.view;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.RectF;
import android.os.Build;
import android.text.Layout;
import android.text.StaticLayout;
import android.text.TextPaint;
import android.util.AttributeSet;
import android.util.SparseIntArray;
import android.util.TypedValue;
import android.widget.TextView;
/**
* Created by insearching on 16.07.2014.
*/
public class AutoResizeTextView extends TextView {
private interface SizeTester {
/**
*
* @param suggestedSize
* Size of text to be tested
* @param availableSpace
* available space in which text must fit
* @return an integer < 0 if after applying {@code suggestedSize} to
* text, it takes less space than {@code availableSpace}, > 0
* otherwise
*/
public int onTestSize(int suggestedSize, RectF availableSpace);
}
private RectF mTextRect = new RectF();
private RectF mAvailableSpaceRect;
private SparseIntArray mTextCachedSizes;
private TextPaint mPaint;
private float mMaxTextSize;
private float mSpacingMult = 1.0f;
private float mSpacingAdd = 0.0f;
private float mMinTextSize = 20;
private int mWidthLimit;
private static final int NO_LINE_LIMIT = -1;
private int mMaxLines;
private boolean mEnableSizeCache = true;
private boolean mInitiallized;
public AutoResizeTextView(Context context) {
super(context);
initialize();
}
public AutoResizeTextView(Context context, AttributeSet attrs) {
super(context, attrs);
initialize();
}
public AutoResizeTextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
initialize();
}
private void initialize() {
mPaint = new TextPaint(getPaint());
mMaxTextSize = getTextSize();
mAvailableSpaceRect = new RectF();
mTextCachedSizes = new SparseIntArray();
if (mMaxLines == 0) {
// no value was assigned during construction
mMaxLines = NO_LINE_LIMIT;
}
mInitiallized = true;
}
@Override
public void setText(final CharSequence text, BufferType type) {
super.setText(text, type);
adjustTextSize(text.toString());
}
@Override
public void setTextSize(float size) {
mMaxTextSize = size;
mTextCachedSizes.clear();
adjustTextSize(getText().toString());
}
@Override
public void setMaxLines(int maxlines) {
super.setMaxLines(maxlines);
mMaxLines = maxlines;
reAdjust();
}
public int getMaxLines() {
return mMaxLines;
}
@Override
public void setSingleLine() {
super.setSingleLine();
mMaxLines = 1;
reAdjust();
}
@Override
public void setSingleLine(boolean singleLine) {
super.setSingleLine(singleLine);
if (singleLine) {
mMaxLines = 1;
} else {
mMaxLines = NO_LINE_LIMIT;
}
reAdjust();
}
@Override
public void setLines(int lines) {
super.setLines(lines);
mMaxLines = lines;
reAdjust();
}
@Override
public void setTextSize(int unit, float size) {
Context c = getContext();
Resources r;
if (c == null)
r = Resources.getSystem();
else
r = c.getResources();
mMaxTextSize = TypedValue.applyDimension(unit, size,
r.getDisplayMetrics());
mTextCachedSizes.clear();
adjustTextSize(getText().toString());
}
@Override
public void setLineSpacing(float add, float mult) {
super.setLineSpacing(add, mult);
mSpacingMult = mult;
mSpacingAdd = add;
}
/**
* Set the lower text size limit and invalidate the view
*
* @param minTextSize
*/
public void setMinTextSize(float minTextSize) {
mMinTextSize = minTextSize;
reAdjust();
}
private void reAdjust() {
adjustTextSize(getText().toString());
}
private void adjustTextSize(String string) {
if (!mInitiallized) {
return;
}
int startSize = (int) mMinTextSize;
int heightLimit = getMeasuredHeight() - getCompoundPaddingBottom()
- getCompoundPaddingTop();
mWidthLimit = getMeasuredWidth() - getCompoundPaddingLeft()
- getCompoundPaddingRight();
mAvailableSpaceRect.right = mWidthLimit;
mAvailableSpaceRect.bottom = heightLimit;
super.setTextSize(
TypedValue.COMPLEX_UNIT_PX,
efficientTextSizeSearch(startSize, (int) mMaxTextSize,
mSizeTester, mAvailableSpaceRect));
}
private final SizeTester mSizeTester = new SizeTester() {
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Override
public int onTestSize(int suggestedSize, RectF availableSPace) {
mPaint.setTextSize(suggestedSize);
String text = getText().toString();
boolean singleline = getMaxLines() == 1;
if (singleline) {
mTextRect.bottom = mPaint.getFontSpacing();
mTextRect.right = mPaint.measureText(text);
} else {
StaticLayout layout = new StaticLayout(text, mPaint,
mWidthLimit, Layout.Alignment.ALIGN_NORMAL, mSpacingMult,
mSpacingAdd, true);
// return early if we have more lines
if (getMaxLines() != NO_LINE_LIMIT
&& layout.getLineCount() > getMaxLines()) {
return 1;
}
mTextRect.bottom = layout.getHeight();
int maxWidth = -1;
for (int i = 0; i < layout.getLineCount(); i++) {
if (maxWidth < layout.getLineWidth(i)) {
maxWidth = (int) layout.getLineWidth(i);
}
}
mTextRect.right = maxWidth;
}
mTextRect.offsetTo(0, 0);
if (availableSPace.contains(mTextRect)) {
// may be too small, don't worry we will find the best match
return -1;
} else {
// too big
return 1;
}
}
};
/**
* Enables or disables size caching, enabling it will improve performance
* where you are animating a value inside TextView. This stores the font
* size against getText().length() Be careful though while enabling it as 0
* takes more space than 1 on some fonts and so on.
*
* @param enable
* enable font size caching
*/
public void enableSizeCache(boolean enable) {
mEnableSizeCache = enable;
mTextCachedSizes.clear();
adjustTextSize(getText().toString());
}
private int efficientTextSizeSearch(int start, int end,
SizeTester sizeTester, RectF availableSpace) {
if (!mEnableSizeCache) {
return binarySearch(start, end, sizeTester, availableSpace);
}
String text = getText().toString();
int key = text == null ? 0 : text.length();
int size = mTextCachedSizes.get(key);
if (size != 0) {
return size;
}
size = binarySearch(start, end, sizeTester, availableSpace);
mTextCachedSizes.put(key, size);
return size;
}
private static int binarySearch(int start, int end, SizeTester sizeTester,
RectF availableSpace) {
int lastBest = start;
int lo = start;
int hi = end - 1;
int mid = 0;
while (lo <= hi) {
mid = (lo + hi) >>> 1;
int midValCmp = sizeTester.onTestSize(mid, availableSpace);
if (midValCmp < 0) {
lastBest = lo;
lo = mid + 1;
} else if (midValCmp > 0) {
hi = mid - 1;
lastBest = hi;
} else {
return mid;
}
}
// make sure to return last best
// this is what should always be returned
return lastBest;
}
@Override
protected void onTextChanged(final CharSequence text, final int start,
final int before, final int after) {
super.onTextChanged(text, start, before, after);
reAdjust();
}
@Override
protected void onSizeChanged(int width, int height, int oldwidth,
int oldheight) {
mTextCachedSizes.clear();
super.onSizeChanged(width, height, oldwidth, oldheight);
if (width != oldwidth || height != oldheight) {
reAdjust();
}
}
}
| [
"serhii@sjinnovation.com"
] | serhii@sjinnovation.com |
0d4745e54c77c22467b6fc1b2daf2640baef7205 | 1f19aec2ecfd756934898cf0ad2758ee18d9eca2 | /u-1/u-1-f9370.java | 11d9d10ba41433ab4174cdba7e9a779908f7c66e | [] | no_license | apertureatf/perftest | f6c6e69efad59265197f43af5072aa7af8393a34 | 584257a0c1ada22e5486052c11395858a87b20d5 | refs/heads/master | 2020-06-07T17:52:51.172890 | 2019-06-21T18:53:01 | 2019-06-21T18:53:01 | 193,039,805 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 106 | java | mastercard 5555555555554444 4012888888881881 4222222222222 378282246310005 6011111111111117
5792922642289 | [
"jenkins@khan.paloaltonetworks.local"
] | jenkins@khan.paloaltonetworks.local |
2fe2feb72b7ea59f6a79ff24feacce4d295f82ff | 382b120561efa86a4ddc8854ab8081da91063ca9 | /components/camel-dhis2/camel-dhis2-component/src/main/java/org/apache/camel/component/dhis2/Dhis2Converters.java | e7ae5e6a455ad67f2252259254b8f7ae75d39d44 | [
"Apache-2.0"
] | permissive | orpiske/camel | 512f3f5c707137038901fbe8244d4c65497a0a8e | d6e445aca0eeeb397e7c2c2f8d19972fcfafcb7c | refs/heads/main | 2023-08-31T19:46:35.859496 | 2023-08-31T14:23:54 | 2023-08-31T14:23:54 | 166,656,227 | 1 | 0 | Apache-2.0 | 2023-07-08T08:21:11 | 2019-01-20T12:01:23 | Java | UTF-8 | Java | false | false | 1,643 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.camel.component.dhis2;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.camel.Converter;
import org.apache.camel.Exchange;
import org.apache.camel.component.dhis2.api.Dhis2Resource;
import org.apache.camel.spi.TypeConverterRegistry;
@Converter(generateLoader = true)
public final class Dhis2Converters {
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
private Dhis2Converters() {
}
@Converter(fallback = true)
public static <T> T convertTo(Class<T> type, Exchange exchange, Object resource, TypeConverterRegistry registry) {
if (resource instanceof Dhis2Resource && type.getName().startsWith("org.hisp.dhis.api.model")) {
return OBJECT_MAPPER.convertValue(resource, type);
} else {
return null;
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
b0e7648d26327d984510b65f88c0d5c710c1568c | 2118c38e6cfb549b3a2491b3f3fc5ce8d1dd1635 | /AplicaciónWebVentas/ModeloVentas/target/generated-sources/annotations/com/sinensia/modelo/beans/Producto_.java | 2bfcb1e56bae86e5243a5ffd9cd44ac597ea7d42 | [] | no_license | germanpardi/curso_java_spring | 1446cdb9366039b7c57bd104002b4595eb3f17c9 | ee86cad0f81e410b66a0407006288063906bbec6 | refs/heads/master | 2020-05-20T04:49:00.700789 | 2019-05-22T11:19:48 | 2019-05-22T11:19:48 | 185,391,328 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 763 | java | package com.sinensia.modelo.beans;
import com.sinensia.modelo.beans.Compra;
import javax.annotation.Generated;
import javax.persistence.metamodel.ListAttribute;
import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel;
@Generated(value="EclipseLink-2.5.2.v20140319-rNA", date="2019-05-22T09:21:25")
@StaticMetamodel(Producto.class)
public class Producto_ {
public static volatile SingularAttribute<Producto, Double> precio;
public static volatile SingularAttribute<Producto, Integer> id;
public static volatile SingularAttribute<Producto, Integer> stock;
public static volatile ListAttribute<Producto, Compra> compraList;
public static volatile SingularAttribute<Producto, String> nombre;
} | [
"gapc18894@gmail.com"
] | gapc18894@gmail.com |
0584cc1c1eb63de1f27071c534538bb2054979d8 | e37a64782c9c417bad7977adec4b61a58dc5aa11 | /designpatterns/builder/BuilderTest.java | 128314a999f34b974997767a4df0e3aa3368f2b4 | [] | no_license | neeraj270185/schooldays | 1494d470766e980d3e3bcb67087046937dcd3b8f | fee85deba26b63d4426683c96398010feecd47d8 | refs/heads/master | 2021-01-20T20:31:57.283368 | 2016-11-28T09:20:58 | 2016-11-28T09:20:58 | 65,301,620 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,395 | java | package builder;
public class BuilderTest {
public static void main(String args[]) {
// Creating object using Builder pattern in java
Cake whiteCake = new Cake.Builder().sugar(1).butter(0.5).eggs(2).vanila(2).flour(1.5).bakingpowder(0.75)
.build();
// Cake is ready to eat :)
System.out.println(whiteCake);
}
}
class Cake {
private final double sugar; // cup
private final double butter; // cup
private final int eggs;
private final int vanila; // spoon
private final double flour; // cup
private final double bakingpowder; // spoon
private final double milk; // cup
private final int cherry;
public static class Builder {
private double sugar; // cup
private double butter; // cup
private int eggs;
private int vanila; // spoon
private double flour; // cup
private double bakingpowder; // spoon
private double milk; // cup
private int cherry;
// builder methods for setting property
public Builder sugar(double cup) {
this.sugar = cup;
return this;
}
public Builder butter(double cup) {
this.butter = cup;
return this;
}
public Builder eggs(int number) {
this.eggs = number;
return this;
}
public Builder vanila(int spoon) {
this.vanila = spoon;
return this;
}
public Builder flour(double cup) {
this.flour = cup;
return this;
}
public Builder bakingpowder(double spoon) {
this.sugar = spoon;
return this;
}
public Builder milk(double cup) {
this.milk = cup;
return this;
}
public Builder cherry(int number) {
this.cherry = number;
return this;
}
// return fully build object
public Cake build() {
return new Cake(this);
}
}
// private constructor to enforce object creation through builder
private Cake(Builder builder) {
this.sugar = builder.sugar;
this.butter = builder.butter;
this.eggs = builder.eggs;
this.vanila = builder.vanila;
this.flour = builder.flour;
this.bakingpowder = builder.bakingpowder;
this.milk = builder.milk;
this.cherry = builder.cherry;
}
@Override
public String toString() {
return "Cake{" + "sugar=" + sugar + ", butter=" + butter + ", eggs=" + eggs + ", vanila=" + vanila + ", flour="
+ flour + ", bakingpowder=" + bakingpowder + ", milk=" + milk + ", cherry=" + cherry + '}';
}
}
| [
"kumar_nee@LP-3C970EEA061A.HCLT.CORP.HCL.IN"
] | kumar_nee@LP-3C970EEA061A.HCLT.CORP.HCL.IN |
326b0cbfbf60c4a5bd5ac3d65dda2e16ff27a5ce | 092c76fcc6c411ee77deef508e725c1b8277a2fe | /hybris/bin/ext-content/cmswebservices/testsrc/de/hybris/platform/cmswebservices/util/dao/impl/AbstractCmsWebServicesDao.java | 43e8eb1098a5e942234a2660f5b230bbedcb0432 | [
"MIT"
] | permissive | BaggaShivanshu2/hybris-bookstore-tutorial | 4de5d667bae82851fe4743025d9cf0a4f03c5e65 | 699ab7fd8514ac56792cb911ee9c1578d58fc0e3 | refs/heads/master | 2022-11-28T12:15:32.049256 | 2020-08-05T11:29:14 | 2020-08-05T11:29:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,531 | java | /*
* [y] hybris Platform
*
* Copyright (c) 2000-2016 hybris AG
* All rights reserved.
*
* This software is the confidential and proprietary information of hybris
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with hybris.
*
*
*/
package de.hybris.platform.cmswebservices.util.dao.impl;
import de.hybris.platform.catalog.model.CatalogVersionModel;
import de.hybris.platform.cmswebservices.util.dao.CmsWebServicesDao;
import de.hybris.platform.servicelayer.search.FlexibleSearchQuery;
import de.hybris.platform.servicelayer.search.FlexibleSearchService;
import org.springframework.beans.factory.annotation.Required;
public abstract class AbstractCmsWebServicesDao<T> implements CmsWebServicesDao<T>
{
private FlexibleSearchService flexibleSearchService;
protected abstract String getQuery();
@Override
public T getByUidAndCatalogVersion(String uid, CatalogVersionModel catalogVersion)
{
final FlexibleSearchQuery query = new FlexibleSearchQuery(getQuery());
query.addQueryParameter("uid", uid);
query.addQueryParameter("catalogVersion", catalogVersion);
return getFlexibleSearchService().searchUnique(query);
}
public FlexibleSearchService getFlexibleSearchService()
{
return flexibleSearchService;
}
@Required
public void setFlexibleSearchService(FlexibleSearchService flexibleSearchService)
{
this.flexibleSearchService = flexibleSearchService;
}
}
| [
"xelilim@hotmail.com"
] | xelilim@hotmail.com |
18626d3c2ed4ac1c25eb727dd9244d21d9f30e14 | 81a5b70c1eb3bab98678af4419608e9dd9cbdaa1 | /app/src/main/java/com/thorandzeus/shalom/lyrics/models/ListItem.java | 06d0e7b1735af3dbe31dd11d465434618536f864 | [] | no_license | shalom06/christainsonglyrics-android | 153cc51c51f45e9590f0537cfb16bb315f0f43aa | 9462698a1841024a96d4338056a0e48e9c2f2f2c | refs/heads/master | 2022-05-31T13:31:19.022013 | 2020-05-03T00:48:53 | 2020-05-03T00:48:53 | 244,055,147 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 338 | java | package com.thorandzeus.shalom.lyrics.models;
public class ListItem {
private String songName;
public String getSongName() {
return songName;
}
public void setSongName(String songName) {
this.songName = songName;
}
public ListItem(String songName) {
this.songName = songName;
}
}
| [
"shalommathews05@gmail.com"
] | shalommathews05@gmail.com |
ac4f543b8e46a5dfb157c1cb078b333ce218e360 | 48e835e6f176a8ac9ae3ca718e8922891f1e5a18 | /benchmark/training/org/apache/zookeeper/ZooKeeperTest.java | 922b4edde10ee9365ebf9582e6e2ffa57d9437c7 | [] | no_license | STAMP-project/dspot-experiments | f2c7a639d6616ae0adfc491b4cb4eefcb83d04e5 | 121487e65cdce6988081b67f21bbc6731354a47f | refs/heads/master | 2023-02-07T14:40:12.919811 | 2019-11-06T07:17:09 | 2019-11-06T07:17:09 | 75,710,758 | 14 | 19 | null | 2023-01-26T23:57:41 | 2016-12-06T08:27:42 | null | UTF-8 | Java | false | false | 21,732 | java | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.zookeeper;
import CreateMode.PERSISTENT;
import Ids.OPEN_ACL_UNSAFE;
import Ids.READ_ACL_UNSAFE;
import KeeperException.Code.NONODE;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.zookeeper.AsyncCallback.VoidCallback;
import org.apache.zookeeper.data.Stat;
import org.apache.zookeeper.test.ClientBase;
import org.junit.Assert;
import org.junit.Test;
/**
* Testing ZooKeeper public methods
*/
public class ZooKeeperTest extends ClientBase {
private static final String LINE_SEPARATOR = System.getProperty("line.separator", "\n");
@Test
public void testDeleteRecursive() throws IOException, InterruptedException, CliException, KeeperException {
final ZooKeeper zk = createClient();
// making sure setdata works on /
zk.setData("/", "some".getBytes(), (-1));
zk.create("/a", "some".getBytes(), OPEN_ACL_UNSAFE, PERSISTENT);
zk.create("/a/b", "some".getBytes(), OPEN_ACL_UNSAFE, PERSISTENT);
zk.create("/a/b/v", "some".getBytes(), OPEN_ACL_UNSAFE, PERSISTENT);
zk.create("/a/b/v/1", "some".getBytes(), OPEN_ACL_UNSAFE, PERSISTENT);
zk.create("/a/c", "some".getBytes(), OPEN_ACL_UNSAFE, PERSISTENT);
zk.create("/a/c/v", "some".getBytes(), OPEN_ACL_UNSAFE, PERSISTENT);
List<String> children = zk.getChildren("/a", false);
Assert.assertEquals("2 children - b & c should be present ", children.size(), 2);
Assert.assertTrue(children.contains("b"));
Assert.assertTrue(children.contains("c"));
ZooKeeperMain zkMain = new ZooKeeperMain(zk);
// 'rmr' is deprecated, so the test here is just for backwards
// compatibility.
String cmdstring0 = "rmr /a/b/v";
String cmdstring1 = "deleteall /a";
zkMain.cl.parseCommand(cmdstring0);
Assert.assertFalse(zkMain.processZKCmd(zkMain.cl));
Assert.assertEquals(null, zk.exists("/a/b/v", null));
zkMain.cl.parseCommand(cmdstring1);
Assert.assertFalse(zkMain.processZKCmd(zkMain.cl));
Assert.assertNull(zk.exists("/a", null));
}
@Test
public void testDeleteRecursiveAsync() throws IOException, InterruptedException, KeeperException {
final ZooKeeper zk = createClient();
// making sure setdata works on /
zk.setData("/", "some".getBytes(), (-1));
zk.create("/a", "some".getBytes(), OPEN_ACL_UNSAFE, PERSISTENT);
zk.create("/a/b", "some".getBytes(), OPEN_ACL_UNSAFE, PERSISTENT);
zk.create("/a/b/v", "some".getBytes(), OPEN_ACL_UNSAFE, PERSISTENT);
zk.create("/a/b/v/1", "some".getBytes(), OPEN_ACL_UNSAFE, PERSISTENT);
zk.create("/a/c", "some".getBytes(), OPEN_ACL_UNSAFE, PERSISTENT);
zk.create("/a/c/v", "some".getBytes(), OPEN_ACL_UNSAFE, PERSISTENT);
for (int i = 0; i < 50; ++i) {
zk.create(("/a/c/" + i), "some".getBytes(), OPEN_ACL_UNSAFE, PERSISTENT);
}
List<String> children = zk.getChildren("/a", false);
Assert.assertEquals("2 children - b & c should be present ", children.size(), 2);
Assert.assertTrue(children.contains("b"));
Assert.assertTrue(children.contains("c"));
VoidCallback cb = new VoidCallback() {
@Override
public void processResult(int rc, String path, Object ctx) {
synchronized(ctx) {
((AtomicInteger) (ctx)).set(4);
ctx.notify();
}
}
};
final AtomicInteger ctx = new AtomicInteger(3);
ZKUtil.deleteRecursive(zk, "/a", cb, ctx);
synchronized(ctx) {
ctx.wait();
}
Assert.assertEquals(4, ((AtomicInteger) (ctx)).get());
}
@Test
public void testStatWhenPathDoesNotExist() throws IOException, InterruptedException, MalformedCommandException {
final ZooKeeper zk = createClient();
ZooKeeperMain main = new ZooKeeperMain(zk);
String cmdstring = "stat /invalidPath";
main.cl.parseCommand(cmdstring);
try {
main.processZKCmd(main.cl);
Assert.fail("As Node does not exist, command should fail by throwing No Node Exception.");
} catch (CliException e) {
Assert.assertEquals("Node does not exist: /invalidPath", e.getMessage());
}
}
@Test
public void testParseWithExtraSpaces() throws Exception {
final ZooKeeper zk = createClient();
ZooKeeperMain zkMain = new ZooKeeperMain(zk);
String cmdstring = " ls / ";
zkMain.cl.parseCommand(cmdstring);
Assert.assertEquals("Spaces also considered as characters", zkMain.cl.getNumArguments(), 2);
Assert.assertEquals("ls is not taken as first argument", zkMain.cl.getCmdArgument(0), "ls");
Assert.assertEquals("/ is not taken as second argument", zkMain.cl.getCmdArgument(1), "/");
}
@Test
public void testParseWithQuotes() throws Exception {
final ZooKeeper zk = createClient();
ZooKeeperMain zkMain = new ZooKeeperMain(zk);
for (String quoteChar : new String[]{ "'", "\"" }) {
String cmdstring = String.format("create /node %1$squoted data%1$s", quoteChar);
zkMain.cl.parseCommand(cmdstring);
Assert.assertEquals("quotes combine arguments", zkMain.cl.getNumArguments(), 3);
Assert.assertEquals("create is not taken as first argument", zkMain.cl.getCmdArgument(0), "create");
Assert.assertEquals("/node is not taken as second argument", zkMain.cl.getCmdArgument(1), "/node");
Assert.assertEquals("quoted data is not taken as third argument", zkMain.cl.getCmdArgument(2), "quoted data");
}
}
@Test
public void testParseWithMixedQuotes() throws Exception {
final ZooKeeper zk = createClient();
ZooKeeperMain zkMain = new ZooKeeperMain(zk);
for (String[] quoteChars : new String[][]{ new String[]{ "'", "\"" }, new String[]{ "\"", "'" } }) {
String outerQuotes = quoteChars[0];
String innerQuotes = quoteChars[1];
String cmdstring = String.format("create /node %1$s%2$squoted data%2$s%1$s", outerQuotes, innerQuotes);
zkMain.cl.parseCommand(cmdstring);
Assert.assertEquals("quotes combine arguments", zkMain.cl.getNumArguments(), 3);
Assert.assertEquals("create is not taken as first argument", zkMain.cl.getCmdArgument(0), "create");
Assert.assertEquals("/node is not taken as second argument", zkMain.cl.getCmdArgument(1), "/node");
Assert.assertEquals("quoted data is not taken as third argument", zkMain.cl.getCmdArgument(2), ((innerQuotes + "quoted data") + innerQuotes));
}
}
@Test
public void testParseWithEmptyQuotes() throws Exception {
final ZooKeeper zk = createClient();
ZooKeeperMain zkMain = new ZooKeeperMain(zk);
String cmdstring = "create /node ''";
zkMain.cl.parseCommand(cmdstring);
Assert.assertEquals("empty quotes should produce arguments", zkMain.cl.getNumArguments(), 3);
Assert.assertEquals("create is not taken as first argument", zkMain.cl.getCmdArgument(0), "create");
Assert.assertEquals("/node is not taken as second argument", zkMain.cl.getCmdArgument(1), "/node");
Assert.assertEquals("empty string is not taken as third argument", zkMain.cl.getCmdArgument(2), "");
}
@Test
public void testParseWithMultipleQuotes() throws Exception {
final ZooKeeper zk = createClient();
ZooKeeperMain zkMain = new ZooKeeperMain(zk);
String cmdstring = "create /node '' ''";
zkMain.cl.parseCommand(cmdstring);
Assert.assertEquals("expected 5 arguments", zkMain.cl.getNumArguments(), 4);
Assert.assertEquals("create is not taken as first argument", zkMain.cl.getCmdArgument(0), "create");
Assert.assertEquals("/node is not taken as second argument", zkMain.cl.getCmdArgument(1), "/node");
Assert.assertEquals("empty string is not taken as third argument", zkMain.cl.getCmdArgument(2), "");
Assert.assertEquals("empty string is not taken as fourth argument", zkMain.cl.getCmdArgument(3), "");
}
@Test
public void testNonexistantCommand() throws Exception {
testInvalidCommand("cret -s /node1", 127);
}
@Test
public void testCreateCommandWithoutPath() throws Exception {
testInvalidCommand("create", 1);
}
@Test
public void testCreateEphemeralCommandWithoutPath() throws Exception {
testInvalidCommand("create -e ", 1);
}
@Test
public void testCreateSequentialCommandWithoutPath() throws Exception {
testInvalidCommand("create -s ", 1);
}
@Test
public void testCreateEphemeralSequentialCommandWithoutPath() throws Exception {
testInvalidCommand("create -s -e ", 1);
}
@Test
public void testCreateNodeWithoutData() throws Exception {
final ZooKeeper zk = createClient();
ZooKeeperMain zkMain = new ZooKeeperMain(zk);
// create persistent sequential node
String cmdstring = "create -s /node ";
zkMain.cl.parseCommand(cmdstring);
Assert.assertTrue("Doesn't create node without data", zkMain.processZKCmd(zkMain.cl));
// create ephemeral node
cmdstring = "create -e /node ";
zkMain.cl.parseCommand(cmdstring);
Assert.assertTrue("Doesn't create node without data", zkMain.processZKCmd(zkMain.cl));
// create ephemeral sequential node
cmdstring = "create -s -e /node ";
zkMain.cl.parseCommand(cmdstring);
Assert.assertTrue("Doesn't create node without data", zkMain.processZKCmd(zkMain.cl));
// creating ephemeral with wrong option.
cmdstring = "create -s y /node";
zkMain.cl.parseCommand(cmdstring);
try {
Assert.assertTrue("Created node with wrong option", zkMain.processZKCmd(zkMain.cl));
Assert.fail(("Created the node with wrong option should " + "throw Exception."));
} catch (MalformedPathException e) {
Assert.assertEquals("Path must start with / character", e.getMessage());
}
}
@Test
public void testACLWithExtraAgruments() throws Exception {
final ZooKeeper zk = createClient();
ZooKeeperMain zkMain = new ZooKeeperMain(zk);
// create persistent sequential node
String cmdstring = "create -s /l data ip:10.18.52.144:cdrwa f g h";
zkMain.cl.parseCommand(cmdstring);
Assert.assertTrue("Not considering the extra arguments after the acls.", zkMain.processZKCmd(zkMain.cl));
}
@Test
public void testCreatePersistentNode() throws Exception {
final ZooKeeper zk = createClient();
ZooKeeperMain zkMain = new ZooKeeperMain(zk);
String cmdstring = "create /node2";
zkMain.cl.parseCommand(cmdstring);
Assert.assertTrue("Not creating Persistent node.", zkMain.processZKCmd(zkMain.cl));
}
@Test
public void testDelete() throws Exception {
final ZooKeeper zk = createClient();
ZooKeeperMain zkMain = new ZooKeeperMain(zk);
String cmdstring1 = "create -e /node2 data";
String cmdstring2 = "delete /node2";
String cmdstring3 = "ls /node2";
zkMain.cl.parseCommand(cmdstring1);
Assert.assertTrue(zkMain.processZKCmd(zkMain.cl));
zkMain.cl.parseCommand(cmdstring2);
Assert.assertFalse(zkMain.processZKCmd(zkMain.cl));
zkMain.cl.parseCommand(cmdstring3);
Assert.assertFalse("", zkMain.processCmd(zkMain.cl));
}
@Test
public void testDeleteNonexistantNode() throws Exception {
testInvalidCommand("delete /blahblahblah", 1);
}
@Test
public void testStatCommand() throws Exception {
final ZooKeeper zk = createClient();
ZooKeeperMain zkMain = new ZooKeeperMain(zk);
String cmdstring1 = "create -e /node3 data";
String cmdstring2 = "stat /node3";
String cmdstring3 = "delete /node3";
zkMain.cl.parseCommand(cmdstring1);
Assert.assertTrue(zkMain.processZKCmd(zkMain.cl));
zkMain.cl.parseCommand(cmdstring2);
Assert.assertFalse(zkMain.processZKCmd(zkMain.cl));
zkMain.cl.parseCommand(cmdstring3);
Assert.assertFalse(zkMain.processZKCmd(zkMain.cl));
}
@Test
public void testInvalidStatCommand() throws Exception {
final ZooKeeper zk = createClient();
ZooKeeperMain zkMain = new ZooKeeperMain(zk);
// node doesn't exists
String cmdstring1 = "stat /node123";
zkMain.cl.parseCommand(cmdstring1);
try {
Assert.assertFalse(zkMain.processZKCmd(zkMain.cl));
Assert.fail("Path doesn't exists so, command should fail.");
} catch (CliWrapperException e) {
Assert.assertEquals(NONODE, code());
}
}
@Test
public void testSetData() throws Exception {
final ZooKeeper zk = createClient();
ZooKeeperMain zkMain = new ZooKeeperMain(zk);
String cmdstring1 = "create -e /node4 data";
String cmdstring2 = "set /node4 " + "data";
String cmdstring3 = "delete /node4";
Stat stat = new Stat();
int version = 0;
zkMain.cl.parseCommand(cmdstring1);
Assert.assertTrue(zkMain.processZKCmd(zkMain.cl));
stat = zk.exists("/node4", true);
version = stat.getVersion();
zkMain.cl.parseCommand(cmdstring2);
Assert.assertFalse(zkMain.processZKCmd(zkMain.cl));
stat = zk.exists("/node4", true);
Assert.assertEquals((version + 1), stat.getVersion());
zkMain.cl.parseCommand(cmdstring3);
Assert.assertFalse(zkMain.processZKCmd(zkMain.cl));
}
@Test
public void testCheckInvalidAcls() throws Exception {
final ZooKeeper zk = createClient();
ZooKeeperMain zkMain = new ZooKeeperMain(zk);
String cmdstring = "create -s -e /node data ip:scheme:gggsd";// invalid acl's
// For Invalid ACls should not throw exception
zkMain.executeLine(cmdstring);
}
@Test
public void testDeleteWithInvalidVersionNo() throws Exception {
final ZooKeeper zk = createClient();
ZooKeeperMain zkMain = new ZooKeeperMain(zk);
String cmdstring = "create -s -e /node1 data ";
String cmdstring1 = "delete /node1 2";// invalid dataversion no
zkMain.executeLine(cmdstring);
// For Invalid dataversion number should not throw exception
zkMain.executeLine(cmdstring1);
}
@Test
public void testCliCommandsNotEchoingUsage() throws Exception {
// setup redirect out/err streams to get System.in/err, use this judiciously!
final PrintStream systemErr = System.err;// get current err
final ByteArrayOutputStream errContent = new ByteArrayOutputStream();
System.setErr(new PrintStream(errContent));
final ZooKeeper zk = createClient();
ZooKeeperMain zkMain = new ZooKeeperMain(zk);
String cmd1 = "printwatches";
zkMain.executeLine(cmd1);
String cmd2 = "history";
zkMain.executeLine(cmd2);
String cmd3 = "redo";
zkMain.executeLine(cmd3);
// revert redirect of out/err streams - important step!
System.setErr(systemErr);
if (errContent.toString().contains("ZooKeeper -server host:port cmd args")) {
Assert.fail("CLI commands (history, redo, connect, printwatches) display usage info!");
}
}
// ZOOKEEPER-2467 : Testing negative number for redo command
@Test
public void testRedoWithNegativeCmdNumber() throws Exception {
final ZooKeeper zk = createClient();
ZooKeeperMain zkMain = new ZooKeeperMain(zk);
String cmd1 = "redo -1";
// setup redirect out/err streams to get System.in/err, use this
// judiciously!
final PrintStream systemErr = System.err;// get current err
final ByteArrayOutputStream errContent = new ByteArrayOutputStream();
System.setErr(new PrintStream(errContent));
try {
zkMain.executeLine(cmd1);
Assert.assertEquals("Command index out of range", errContent.toString().trim());
} finally {
// revert redirect of out/err streams - important step!
System.setErr(systemErr);
}
}
@Test
public void testSortedLs() throws Exception {
final ZooKeeper zk = createClient();
ZooKeeperMain zkMain = new ZooKeeperMain(zk);
zkMain.executeLine("create /aa1");
zkMain.executeLine("create /aa2");
zkMain.executeLine("create /aa3");
zkMain.executeLine("create /test1");
zkMain.executeLine("create /zk1");
LsCommand cmd = new LsCommand();
cmd.setZk(zk);
cmd.parse("ls /".split(" "));
List<String> expected = new ArrayList<String>();
expected.add("[aa1, aa2, aa3, test1, zk1, zookeeper]");
ZooKeeperTest.runCommandExpect(cmd, expected);
}
@Test
public void testLsrCommand() throws Exception {
final ZooKeeper zk = createClient();
ZooKeeperMain zkMain = new ZooKeeperMain(zk);
zkMain.executeLine("create /a");
zkMain.executeLine("create /a/b");
zkMain.executeLine("create /a/c");
zkMain.executeLine("create /a/b/d");
zkMain.executeLine("create /a/c/e");
zkMain.executeLine("create /a/f");
LsCommand cmd = new LsCommand();
cmd.setZk(zk);
cmd.parse("ls -R /a".split(" "));
List<String> expected = new ArrayList<String>();
expected.add("/a");
expected.add("/a/b");
expected.add("/a/c");
expected.add("/a/f");
expected.add("/a/b/d");
expected.add("/a/c/e");
ZooKeeperTest.runCommandExpect(cmd, expected);
}
@Test
public void testLsrRootCommand() throws Exception {
final ZooKeeper zk = createClient();
ZooKeeperMain zkMain = new ZooKeeperMain(zk);
LsCommand cmd = new LsCommand();
cmd.setZk(zk);
cmd.parse("ls -R /".split(" "));
List<String> expected = new ArrayList<String>();
expected.add("/");
expected.add("/zookeeper");
ZooKeeperTest.runCommandExpect(cmd, expected);
}
@Test
public void testLsrLeafCommand() throws Exception {
final ZooKeeper zk = createClient();
ZooKeeperMain zkMain = new ZooKeeperMain(zk);
zkMain.executeLine("create /b");
zkMain.executeLine("create /b/c");
LsCommand cmd = new LsCommand();
cmd.setZk(zk);
cmd.parse("ls -R /b/c".split(" "));
List<String> expected = new ArrayList<String>();
expected.add("/b/c");
ZooKeeperTest.runCommandExpect(cmd, expected);
}
@Test
public void testLsrNonexistantZnodeCommand() throws Exception {
final ZooKeeper zk = createClient();
ZooKeeperMain zkMain = new ZooKeeperMain(zk);
zkMain.executeLine("create /b");
zkMain.executeLine("create /b/c");
LsCommand cmd = new LsCommand();
cmd.setZk(zk);
cmd.parse("ls -R /b/c/d".split(" "));
try {
ZooKeeperTest.runCommandExpect(cmd, new ArrayList<String>());
Assert.fail("Path doesn't exists so, command should fail.");
} catch (CliWrapperException e) {
Assert.assertEquals(NONODE, code());
}
}
@Test
public void testSetAclRecursive() throws Exception {
final ZooKeeper zk = createClient();
final byte[] EMPTY = new byte[0];
zk.setData("/", EMPTY, (-1));
zk.create("/a", EMPTY, OPEN_ACL_UNSAFE, PERSISTENT);
zk.create("/a/b", EMPTY, OPEN_ACL_UNSAFE, PERSISTENT);
zk.create("/a/b/c", EMPTY, OPEN_ACL_UNSAFE, PERSISTENT);
zk.create("/a/d", EMPTY, OPEN_ACL_UNSAFE, PERSISTENT);
zk.create("/e", EMPTY, OPEN_ACL_UNSAFE, PERSISTENT);
ZooKeeperMain zkMain = new ZooKeeperMain(zk);
String setAclCommand = "setAcl -R /a world:anyone:r";
zkMain.cl.parseCommand(setAclCommand);
Assert.assertFalse(zkMain.processZKCmd(zkMain.cl));
Assert.assertEquals(READ_ACL_UNSAFE, zk.getACL("/a", new Stat()));
Assert.assertEquals(READ_ACL_UNSAFE, zk.getACL("/a/b", new Stat()));
Assert.assertEquals(READ_ACL_UNSAFE, zk.getACL("/a/b/c", new Stat()));
Assert.assertEquals(READ_ACL_UNSAFE, zk.getACL("/a/d", new Stat()));
// /e is unset, its acl should remain the same.
Assert.assertEquals(OPEN_ACL_UNSAFE, zk.getACL("/e", new Stat()));
}
}
| [
"benjamin.danglot@inria.fr"
] | benjamin.danglot@inria.fr |
8bc811c9d811c14e776b22b17a122f7e5b8bc6cd | 4b9966401f9ed4af1179658c8bed4da4e97875cc | /app/src/main/java/com/example/administrator/koudaiwanzi/person/question/ServerEmailActivity.java | cfebe16ad9e8e2d2f23d7f87f16aa3a3f2bf1fec | [] | no_license | liu66104/koudaiwanzime | 37cb2593036513277ac7de9ea207d0264cee17e3 | 363a2aa1ae38a6c14bab1487014570c2a695185f | refs/heads/master | 2020-12-03T09:29:41.892422 | 2017-06-27T09:00:26 | 2017-06-27T09:00:26 | 95,625,253 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 929 | java | package com.example.administrator.koudaiwanzi.person.question;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import com.example.administrator.koudaiwanzi.R;
import org.xutils.view.annotation.ContentView;
import org.xutils.view.annotation.Event;
import org.xutils.x;
/**
* Created by Administrator on 2016/9/1.
*/
@ContentView(R.layout.activity_server)
public class ServerEmailActivity extends AppCompatActivity{
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
x.view().inject(this);
}
@Event(R.id.iv_server_email_back)
private void rlClick(View view) {
Intent intent = new Intent(ServerEmailActivity.this,QuestionActivity.class);
startActivity(intent);
finish();
}
}
| [
"695335338@qq.com"
] | 695335338@qq.com |
1590a48a0dbd0c930145817b0570bd31a158b483 | 3e81b9205b822b7bdaaa13616cbb3133ca958f10 | /src/main/java/com/island/monster/service/IslandPaintingService.java | 6ab8c7fcbb27cbbffecabb4896db523385f822e7 | [] | no_license | yaoguopeng/monster | 5132160ceaaa03d186408687113f4dc6ab7ba67f | e04e2cbd92653a2b16d4ceefb773479a8b08ae85 | refs/heads/master | 2023-03-03T06:17:41.232594 | 2022-12-23T07:47:21 | 2022-12-23T07:47:21 | 180,915,035 | 1 | 0 | null | 2023-02-22T08:49:27 | 2019-04-12T02:29:27 | Java | UTF-8 | Java | false | false | 705 | java | package com.island.monster.service;
import com.github.pagehelper.PageInfo;
import com.island.monster.bean.IslandPainting;
import java.util.List;
public interface IslandPaintingService {
IslandPainting add(IslandPainting islandPainting);
IslandPainting remove(Integer id);
IslandPainting setDel(Integer id);
IslandPainting edit(IslandPainting islandPainting);
IslandPainting getOne(IslandPainting islandPainting);
IslandPainting nextPainting(Integer currentId);
IslandPainting randomPainting();
List<IslandPainting> getList(IslandPainting islandPainting);
PageInfo<IslandPainting> getPage(IslandPainting islandPainting, Integer pageNum, Integer pageSize);
}
| [
"helloyaogp@163.com"
] | helloyaogp@163.com |
ebf516ac748f067fb71003688c7d87386b916d29 | f6006f719310bea13a173944c34619d2f14769d2 | /src/rpg/Commands.java | 74b94d66264e20f74c72bfed8254b73a2e250caa | [] | no_license | TBthegr81/TextRPG | 44440ee56117019219beb20839b2540b71623c9b | 7dd816678cdd23cdefd502b50a46e2410e2a9047 | refs/heads/master | 2016-08-04T23:49:21.031699 | 2013-01-09T09:46:45 | 2013-01-09T09:46:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 41 | java | package rpg;
public class Commands {
}
| [
"torbjorn.hagenstam@snekabel.se"
] | torbjorn.hagenstam@snekabel.se |
f55b7ba22672a74f1fa9701607765d775fb638b3 | 4f112c512a62e50706046c218cf94adfced926c1 | /app/src/main/java/com/hendri/tiketsaya/RegiterOneAct.java | 4c6c1717667e78249d48d9ad3aee269aa6889eed | [] | no_license | hendrisusanto/TiketSayaApp | 0c0a125877ce9f90bee9ef7143324012d05f2d6f | 37de581a9b0c349ea0a5e7102c2c7ecee58390b7 | refs/heads/master | 2023-03-22T06:01:25.550233 | 2021-03-15T06:22:35 | 2021-03-15T06:22:35 | 347,858,429 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,729 | java | package com.hendri.tiketsaya;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.Toast;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
public class RegiterOneAct extends AppCompatActivity {
Button btn_continue_RO;
LinearLayout btn_back_RO;
EditText username, password, email_address;
DatabaseReference reference, referense_username;
String USERNAME_KEY ="usernamekey";
String username_key = "";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_regiter_one);
btn_back_RO = findViewById(R.id.btn_back_RO);
username = findViewById(R.id.username);
password = findViewById(R.id.password);
email_address = findViewById(R.id.email_address);
btn_back_RO.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
btn_continue_RO = findViewById(R.id.btn_continue_RO);
btn_continue_RO.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//ubah state menjadi loading
stateButtonflase();
//mengambil username pada firebase
referense_username = FirebaseDatabase.getInstance().getReference().child("Users")
.child(username.getText().toString());
referense_username.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
final String username1 = username.getText().toString();
final String password1 = password.getText().toString();
final String email1 = email_address.getText().toString();
//validasi user, pw, dan email kosong
if (username1.isEmpty() || password1.isEmpty() || email1.isEmpty()){ // validasi username sudah ada
Toast.makeText(getApplicationContext()," Data tidak boleh kosong!", Toast.LENGTH_SHORT).show();
//UBAH STATE JADI ACTIVE
stateButtontrue();
}else {
if (snapshot.exists()){
Toast.makeText(getApplicationContext(),"Username sudah tersedia!",
Toast.LENGTH_SHORT).show();
//UBAH STATE JADI ACTIVE
stateButtontrue();
}else{
//menyimpan data secara local storage handphone
SharedPreferences sharedPreferences = getSharedPreferences(USERNAME_KEY, MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString(username_key, username.getText().toString());
editor.apply();
// menyimpan pada firebase
reference = FirebaseDatabase.getInstance().getReference().child("Users").
child(username.getText().toString());
reference.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
snapshot.getRef().child("username").setValue(username.getText().toString());
snapshot.getRef().child("password").setValue(password.getText().toString());
snapshot.getRef().child("email_address").setValue(email_address.getText().toString());
snapshot.getRef().child("user_balance").setValue(800);
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
}
});
//berpindah activity
Intent gotoregister = new Intent(RegiterOneAct.this, RegiterTwoAct.class);
startActivity(gotoregister);
//UBAH STATE JADI ACTIVE
stateButtontrue();
}
}
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
}
});
}
});
}
public void stateButtonflase(){
btn_continue_RO.setEnabled(false);
btn_continue_RO.setText("Loading ...");
}
public void stateButtontrue(){
btn_continue_RO.setEnabled(true);
btn_continue_RO.setText("CONTINUE");
}
} | [
"hendridevjava@gmail.com"
] | hendridevjava@gmail.com |
19a6ecca8b0c58edf6a81b4bfb45af5b1193416e | 49b57339d939ea3f498249d3aacca1dec543163b | /jadx-snap-new/sources/org/chromium/net/NetworkChangeNotifier.java | 616c59235f037cb31d7988d74e9964003aeb598b | [] | no_license | 8secz-johndpope/snapchat-re | 1655036c41518c3a2aaa0c2543dc49f4acb93eaf | 04f5c5bb627d21f620088525fffcf5c99abd7ce5 | refs/heads/master | 2020-08-24T09:14:38.209745 | 2019-06-14T05:13:44 | 2019-06-14T05:13:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,716 | java | package org.chromium.net;
import android.annotation.SuppressLint;
import android.net.ConnectivityManager;
import android.net.Network;
import android.os.Build.VERSION;
import com.mapbox.services.android.telemetry.navigation.MapboxNavigationEvent;
import defpackage.akon;
import defpackage.akop;
import defpackage.akph;
import java.util.ArrayList;
import java.util.Iterator;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.net.NetworkChangeNotifierAutoDetect.c;
import org.chromium.net.NetworkChangeNotifierAutoDetect.d;
import org.chromium.net.NetworkChangeNotifierAutoDetect.e;
public class NetworkChangeNotifier {
@SuppressLint({"StaticFieldLeak"})
private static NetworkChangeNotifier f;
private static /* synthetic */ boolean g = (NetworkChangeNotifier.class.desiredAssertionStatus() ^ 1);
private final ArrayList<Long> a = new ArrayList();
private final akop<Object> b = new akop();
private final ConnectivityManager c = ((ConnectivityManager) akon.a.getSystemService(MapboxNavigationEvent.KEY_CONNECTIVITY));
private NetworkChangeNotifierAutoDetect d;
private int e = 0;
protected NetworkChangeNotifier() {
}
public static NetworkChangeNotifier a() {
if (g || f != null) {
return f;
}
throw new AssertionError();
}
private void a(int i, long j) {
Iterator it = this.a.iterator();
while (it.hasNext()) {
nativeNotifyConnectionTypeChanged(((Long) it.next()).longValue(), i, j);
}
Iterator it2 = this.b.iterator();
while (it2.hasNext()) {
it2.next();
}
}
private static void b() {
a().a(false, new akph());
}
private void c() {
NetworkChangeNotifierAutoDetect networkChangeNotifierAutoDetect = this.d;
if (networkChangeNotifierAutoDetect != null) {
networkChangeNotifierAutoDetect.a();
this.d = null;
}
}
private void c(int i) {
a(i, getCurrentDefaultNetId());
}
@CalledByNative
public static void fakeConnectionSubtypeChanged(int i) {
b();
a().b(i);
}
@CalledByNative
public static void fakeDefaultNetwork(long j, int i) {
b();
a().a(i, j);
}
@CalledByNative
public static void fakeNetworkConnected(long j, int i) {
b();
a().a(j, i);
}
@CalledByNative
public static void fakeNetworkDisconnected(long j) {
b();
a().b(j);
}
@CalledByNative
public static void fakeNetworkSoonToBeDisconnected(long j) {
b();
a().a(j);
}
@CalledByNative
public static void fakePurgeActiveNetworkList(long[] jArr) {
b();
a().a(jArr);
}
@CalledByNative
public static void forceConnectivityState(boolean z) {
b();
NetworkChangeNotifier a = a();
int i = 0;
if ((a.e != 6) != z) {
if (!z) {
i = 6;
}
a.a(i);
a.b(z ^ 1);
}
}
@CalledByNative
public static NetworkChangeNotifier init() {
if (f == null) {
f = new NetworkChangeNotifier();
}
return f;
}
@CalledByNative
public static boolean isProcessBoundToNetwork() {
NetworkChangeNotifier a = a();
if (VERSION.SDK_INT >= 21) {
if (VERSION.SDK_INT < 23) {
return ConnectivityManager.getProcessDefaultNetwork() != null;
} else {
if (a.c.getBoundNetworkForProcess() != null) {
return true;
}
}
}
return false;
}
private native void nativeNotifyConnectionTypeChanged(long j, int i, long j2);
private native void nativeNotifyMaxBandwidthChanged(long j, int i);
private native void nativeNotifyOfNetworkConnect(long j, long j2, int i);
private native void nativeNotifyOfNetworkDisconnect(long j, long j2);
private native void nativeNotifyOfNetworkSoonToDisconnect(long j, long j2);
private native void nativeNotifyPurgeActiveNetworkList(long j, long[] jArr);
/* Access modifiers changed, original: final */
public final void a(int i) {
this.e = i;
c(i);
}
/* Access modifiers changed, original: final */
public final void a(long j) {
Iterator it = this.a.iterator();
while (it.hasNext()) {
nativeNotifyOfNetworkSoonToDisconnect(((Long) it.next()).longValue(), j);
}
}
/* Access modifiers changed, original: final */
public final void a(long j, int i) {
Iterator it = this.a.iterator();
while (it.hasNext()) {
nativeNotifyOfNetworkConnect(((Long) it.next()).longValue(), j, i);
}
}
public final void a(boolean z, e eVar) {
if (!z) {
c();
} else if (this.d == null) {
this.d = new NetworkChangeNotifierAutoDetect(new d() {
public final void a(int i) {
NetworkChangeNotifier.this.a(i);
}
public final void a(long j) {
NetworkChangeNotifier.this.a(j);
}
public final void a(long j, int i) {
NetworkChangeNotifier.this.a(j, i);
}
public final void a(long[] jArr) {
NetworkChangeNotifier.this.a(jArr);
}
public final void b(int i) {
NetworkChangeNotifier.this.b(i);
}
public final void b(long j) {
NetworkChangeNotifier.this.b(j);
}
}, eVar);
c d = this.d.d();
a(d.a());
b(d.b());
}
}
/* Access modifiers changed, original: final */
public final void a(long[] jArr) {
Iterator it = this.a.iterator();
while (it.hasNext()) {
nativeNotifyPurgeActiveNetworkList(((Long) it.next()).longValue(), jArr);
}
}
@CalledByNative
public void addNativeObserver(long j) {
this.a.add(Long.valueOf(j));
}
/* Access modifiers changed, original: final */
public final void b(int i) {
Iterator it = this.a.iterator();
while (it.hasNext()) {
nativeNotifyMaxBandwidthChanged(((Long) it.next()).longValue(), i);
}
}
/* Access modifiers changed, original: final */
public final void b(long j) {
Iterator it = this.a.iterator();
while (it.hasNext()) {
nativeNotifyOfNetworkDisconnect(((Long) it.next()).longValue(), j);
}
}
@CalledByNative
public int getCurrentConnectionSubtype() {
NetworkChangeNotifierAutoDetect networkChangeNotifierAutoDetect = this.d;
return networkChangeNotifierAutoDetect == null ? 0 : networkChangeNotifierAutoDetect.d().b();
}
@CalledByNative
public int getCurrentConnectionType() {
return this.e;
}
@CalledByNative
public long getCurrentDefaultNetId() {
NetworkChangeNotifierAutoDetect networkChangeNotifierAutoDetect = this.d;
if (networkChangeNotifierAutoDetect == null || VERSION.SDK_INT < 21) {
return -1;
}
Network b = networkChangeNotifierAutoDetect.b.b();
return b == null ? -1 : NetworkChangeNotifierAutoDetect.a(b);
}
@CalledByNative
public long[] getCurrentNetworksAndTypes() {
NetworkChangeNotifierAutoDetect networkChangeNotifierAutoDetect = this.d;
int i = 0;
if (networkChangeNotifierAutoDetect == null) {
return new long[0];
}
if (VERSION.SDK_INT < 21) {
return new long[0];
}
Network[] a = NetworkChangeNotifierAutoDetect.a(networkChangeNotifierAutoDetect.b, null);
long[] jArr = new long[(a.length << 1)];
int length = a.length;
int i2 = 0;
while (i < length) {
Network network = a[i];
int i3 = i2 + 1;
jArr[i2] = NetworkChangeNotifierAutoDetect.a(network);
i2 = i3 + 1;
jArr[i3] = (long) networkChangeNotifierAutoDetect.b.a(network);
i++;
}
return jArr;
}
@CalledByNative
public boolean registerNetworkCallbackFailed() {
NetworkChangeNotifierAutoDetect networkChangeNotifierAutoDetect = this.d;
return networkChangeNotifierAutoDetect == null ? false : networkChangeNotifierAutoDetect.e;
}
@CalledByNative
public void removeNativeObserver(long j) {
this.a.remove(Long.valueOf(j));
}
}
| [
"blevy@protonmail.com"
] | blevy@protonmail.com |
e8ea6a2eb008d5b02dc25c1fc9d7aa7997bdf51a | 39046f98b04471973b607edc20af7330fe30fec4 | /jadx-decompile/crittercism/android/an.java | 8f7bfe3baab8590d249b9a4a6369d31a723a1fbd | [] | no_license | riskyend/ThreeSeven | debb62c8f96c26bcd9d1510e60511704c484de92 | 58b1b4d8fc549c3f4c27aea3b1f55c1ac24140f3 | refs/heads/master | 2021-01-16T21:35:05.472707 | 2016-09-11T14:49:22 | 2016-09-11T14:49:22 | 68,145,881 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,100 | java | package crittercism.android;
import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat;
import org.apache.http.ParseException;
import org.apache.http.RequestLine;
import org.apache.http.message.BasicLineParser;
import org.apache.http.message.ParserCursor;
import org.apache.http.util.CharArrayBuffer;
public final class an extends af {
public an(al alVar) {
super(alVar);
}
public final af b() {
return new am(this);
}
public final af c() {
return as.d;
}
public final boolean a(CharArrayBuffer charArrayBuffer) {
try {
RequestLine parseRequestLine = BasicLineParser.DEFAULT.parseRequestLine(charArrayBuffer, new ParserCursor(0, charArrayBuffer.length()));
this.a.a(parseRequestLine.getMethod(), parseRequestLine.getUri());
return true;
} catch (ParseException e) {
return false;
}
}
protected final int d() {
return 64;
}
protected final int e() {
return AccessibilityNodeInfoCompat.ACTION_PREVIOUS_HTML_ELEMENT;
}
}
| [
"will748@gmail.com"
] | will748@gmail.com |
e32c0bb21edb00d8ff8985a9a4911ba854cd6632 | 2f3b1a8a88c5aa9c5eb94b19520197c27f9863ef | /Esame-Chiara-Brogna-N46003729/src/it/unina/esame/control/GestioneAppelloTest.java | ec8977befa48de2957ceb520ef3c5afb692c7982 | [] | no_license | chiarabrogna/IsEsame | 7535f99bf733ee00bcc9e741a57f46ffe5d19cc5 | 4aba121466e153205bd4500c9d4a5134eca4ae6e | refs/heads/master | 2020-11-26T00:45:15.857929 | 2019-12-18T20:11:44 | 2019-12-18T20:11:44 | 228,910,834 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,329 | java | package it.unina.esame.control;
import java.time.LocalDate;
import java.util.ArrayList;
import org.junit.Test;
import it.unina.esame.entity.Appello;
import it.unina.esame.entity.Corso;
import it.unina.esame.entity.Data;
import it.unina.esame.entity.Docente;
import it.unina.esame.entity.Sede;
import it.unina.esame.entity.Studente;
import it.unina.esame.entity.Tipologia;
public class GestioneAppelloTest {
@Test
public void test01UnoStudenteAUnAppello() throws Exception {
GestioneAppello gestione = new GestioneAppello();
Docente doc = new Docente("Docente");
Studente s = new Studente("Paolo", "Di Paolo", "N36", 23);
Data primaData = new Data(LocalDate.of(2017, 11, 18), Tipologia.Scritta, Sede.Aula);
gestione.nuovaData(primaData); //aggiungo data in array date
Corso c = gestione.creaCorso("corso1", doc, 3);
Appello a = gestione.creaAppello(gestione.elencoDate(), false, c);
c.addAppello(a);
gestione.prenotaStudente(s, a);
gestione.stampaStudentiPrenotati(a);
}
@Test
public void test02NessunoStudentePrenotato() throws Exception {
GestioneAppello gestione = new GestioneAppello();
Docente doc = new Docente("Docente");
Data primaData = new Data(LocalDate.of(2017, 11, 18), Tipologia.Scritta, Sede.Aula);
gestione.nuovaData(primaData); //aggiungo data in array date
Corso c = gestione.creaCorso("corso1", doc, 3);
Appello a = gestione.creaAppello(gestione.elencoDate(), false, c);
c.addAppello(a);
gestione.stampaStudentiPrenotati(a);
}
@Test
public void test03DueStudentiPrenotatiAUnAppello() throws Exception{
GestioneAppello gestione = new GestioneAppello();
Docente doc = new Docente("Primo");
Studente s = new Studente("Paolo", "Di Paolo", "N36", 23);
Studente s0 = new Studente("Chiara", "Brogna", "N39", 25);
Data primaData = new Data(LocalDate.of(2017, 11, 18), Tipologia.Scritta, Sede.Aula);
gestione.nuovaData(primaData); //aggiungo data in array date
Corso c =gestione.creaCorso("corso1", doc, 3);
Appello a = gestione.creaAppello(gestione.elencoDate(), false, c);
c.addAppello(a);
gestione.prenotaStudente(s, a);
gestione.prenotaStudente(s0, a);
gestione.stampaStudentiPrenotati(a);
}
@Test
public void test04AppelloChiuso() throws Exception {
GestioneAppello gestione = new GestioneAppello();
Docente doc = new Docente("Docente");
Studente s = new Studente("Paolo", "Di Paolo", "N36", 23);
Data primaData = new Data(LocalDate.of(2017, 11, 18), Tipologia.Scritta, Sede.Aula);
gestione.nuovaData(primaData); //aggiungo data in array date
Corso c = gestione.creaCorso("corso1", doc, 3);
Appello a = gestione.creaAppello(gestione.elencoDate(), false, c);
c.addAppello(a);
gestione.AppelloChiuso(a);
gestione.prenotaStudente(s, a);
gestione.stampaStudentiPrenotati(a);
}
@Test
public void test05StudentePrenotatoDueVolteAdUnAppello() throws Exception {
GestioneAppello gestione = new GestioneAppello();
Docente doc = new Docente("Docente");
Studente s = new Studente("Paolo", "Di Paolo", "N36", 23);
Data primaData = new Data(LocalDate.of(2017, 11, 18), Tipologia.Scritta, Sede.Aula);
gestione.nuovaData(primaData); //aggiungo data in array date
Corso c = gestione.creaCorso("corso1", doc, 3);
Appello a = gestione.creaAppello(gestione.elencoDate(), false, c);
c.addAppello(a);
gestione.prenotaStudente(s, a);
gestione.prenotaStudente(s, a);
gestione.stampaStudentiPrenotati(a);
}
@Test
public void test06DueAppelliPerUnCorsoConUnPrenotato() throws Exception {
GestioneAppello gestione = new GestioneAppello();
Docente doc = new Docente("Docente");
Studente s = new Studente("Paolo", "Di Paolo", "N36", 23);
Data primaData = new Data(LocalDate.of(2017, 11, 18), Tipologia.Scritta, Sede.Aula);
gestione.nuovaData(primaData); //aggiungo data in array date
Corso c = gestione.creaCorso("corso1", doc, 3);
Appello A0 = gestione.creaAppello(gestione.elencoDate(), false, c);
Appello A1= gestione.creaAppello(gestione.elencoDate(), false, c);
c.addAppello(A0);
c.addAppello(A1);
gestione.prenotaStudente(s,A0);
gestione.prenotaStudente(s,A1);
gestione.stampaStudentiPrenotati(A0);
gestione.stampaStudentiPrenotati(A1);
}
@Test
public void test07SenzaData() throws Exception {
GestioneAppello gestione = new GestioneAppello();
Docente doc = new Docente("Docente");
Studente s = new Studente("Paolo", "Di Paolo", "N36", 23);
Corso c = gestione.creaCorso("corso1", doc, 3);
Appello a = gestione.creaAppello(gestione.elencoDate(), false, c);
c.addAppello(a);
gestione.prenotaStudente(s, a);
gestione.stampaStudentiPrenotati(a);
}
@Test
public void test08PiuDatePerUnAppello() throws Exception {
GestioneAppello gestione = new GestioneAppello();
Docente doc = new Docente("Docente");
Studente s = new Studente("Paolo", "Di Paolo", "N36", 23);
Data primaData = new Data(LocalDate.of(2017, 11, 18), Tipologia.Scritta, Sede.Aula);
Data secondaData= new Data(LocalDate.of(2017,12,18),Tipologia.Al_Calcolatore, Sede.Laboratorio);
gestione.nuovaData(primaData);
gestione.nuovaData(secondaData);
Corso c = gestione.creaCorso("corso1", doc, 3);
Appello a = gestione.creaAppello(gestione.elencoDate(), false, c);
c.addAppello(a);
gestione.prenotaStudente(s, a);
gestione.stampaStudentiPrenotati(a);
}
@Test
public void test09UnoStudentePrenotatoAppelloApertoUnoStudentePrenotatoAppelloChiuso() throws Exception{
GestioneAppello gestione = new GestioneAppello();
Docente doc = new Docente("Docente");
Studente s = new Studente("Paolo", "Di Paolo", "N36", 23);
Studente s0 = new Studente("Chiara", "Brogna", "N39", 25);
Data primaData= new Data(LocalDate.of(2016, 1, 1), Tipologia.Scritta, Sede.Aula);
gestione.nuovaData(primaData);
Corso c = gestione.creaCorso("corso1", doc, 3);
Appello a = gestione.creaAppello(gestione.elencoDate(), false, c);
c.addAppello(a);
gestione.prenotaStudente(s, a);
gestione.AppelloChiuso(a);
gestione.prenotaStudente(s0, a);
gestione.stampaStudentiPrenotati(a);
}
@Test
public void test10UnoStudentePrenotaDueAppelliPerDueCorsi () throws Exception {
GestioneAppello gestione = new GestioneAppello();
Docente doc = new Docente("Docente");
Studente s = new Studente("Paolo", "Di Paolo", "N36", 23);
Data primaData= new Data(LocalDate.of(2016, 1, 1), Tipologia.Scritta, Sede.Aula);
gestione.nuovaData(primaData);
Corso c = gestione.creaCorso("corso1", doc, 6);
Corso c0= gestione.creaCorso("corso2", doc, 3);
Appello A0 = gestione.creaAppello(gestione.elencoDate(), false, c);
Appello A1 = gestione.creaAppello(gestione.elencoDate(), false, c0);
c.addAppello(A0);
c0.addAppello(A1);
gestione.prenotaStudente(s,A0);
gestione.prenotaStudente(s,A1);
gestione.stampaStudentiPrenotati(A0);
gestione.stampaStudentiPrenotati(A1);
}
}
| [
"chiar@DESKTOP-4L2IKDO.homenet.telecomitalia.it"
] | chiar@DESKTOP-4L2IKDO.homenet.telecomitalia.it |
e786bdb8c9961399548998c3fc22e68291232cc8 | 3f50976ec0355537e2ae91d380f9281c9eebff88 | /JavaBasics/dataStructures/collectionsLibrary/Reader.java | 3f9c7dfdff3e1399de7f373f04cf3fa37c2f160e | [
"MIT"
] | permissive | DenitsaRP/Java-Playground | 8714885fc79aff41ba3d61446b9e532f90dc3dd3 | 90f2f30cb7ac139c7cd3842309a1fdac53f833f4 | refs/heads/master | 2020-03-23T09:59:01.440238 | 2018-10-31T14:12:57 | 2018-10-31T14:12:57 | 141,418,859 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 826 | java | package dataStructures.collectionsLibrary;
public class Reader {
private String name;
private int id;
private static int readerId = 100;
public Reader(String name) {
this.name = name;
this.id = readerId++;
}
public int getId() {
return id;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + id;
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Reader other = (Reader) obj;
if (id != other.id)
return false;
return true;
}
@Override
public String toString() {
return "Reader [name=" + name + ", id=" + id + "]";
}
}
| [
"d3nitsa@gmail.com"
] | d3nitsa@gmail.com |
f015a7126c4a4d4907afdefa672bad13070a2a0d | 38ac7aab2fabf01434f2d44b70a3c0d1c8b8f9b6 | /src/test/java/com/deserve/snakesladders/SnakesAndLaddersApplicationTests.java | 1e20a44aac74bd83cf6e8067de97a182de244be0 | [] | no_license | riteshneve/deserve-snakes-ladders | 0fabcc07517808ede08fca3997527398dea1e263 | da427f9e1188514789a74a31b071123cb3ff273b | refs/heads/master | 2023-07-20T13:54:40.308913 | 2021-09-06T14:50:02 | 2021-09-06T14:50:02 | 403,496,773 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 227 | java | package com.deserve.snakesladders;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class SnakesAndLaddersApplicationTests {
@Test
void contextLoads() {
}
}
| [
"ritesh.n@turtlemint.com"
] | ritesh.n@turtlemint.com |
a777229b2ee91531004704167bf93ee7c25aeb42 | 9c9c2a2b3b9b0d9c9b0e735b6d5a29ce251e1847 | /graph-query-ir/src/main/java/oracle/pgql/lang/ir/QueryType.java | 27065556b6b34f4033e15bc96c6074d9097cb5e6 | [
"Apache-2.0",
"UPL-1.0"
] | permissive | breakdawn/pgql-lang | ba6b2c75335c8b9a64948866f1347b58b07a9115 | 9810ef574e2032692ddbaadb1a647e4aef2a5932 | refs/heads/master | 2020-10-02T09:14:51.929826 | 2019-11-27T20:18:45 | 2019-11-27T20:18:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 179 | java | /*
* Copyright (C) 2013 - 2019 Oracle and/or its affiliates. All rights reserved.
*/
package oracle.pgql.lang.ir;
public enum QueryType {
SELECT,
GRAPH_UPDATE,
MODIFY
}
| [
"oskar.van.rest@oracle.com"
] | oskar.van.rest@oracle.com |
7f721114cf587c4c2689b0ba59f3a87d33e3a44b | 0e22529c8c35530cc9b4ee6481e5d3cd14dc99cf | /app/src/main/java/com/example/locationapplication/Main2Activity.java | 723ef52aab4f9fd74d83cb0651287b6ef7e7e78c | [] | no_license | isupersky/LocationApplication | 583f381d615c3e10cd3ab6a0139029f010ff8ae6 | 9c8b59330b0c0219255e0d21dce10b5d581c3963 | refs/heads/master | 2020-05-03T13:56:02.254866 | 2019-04-04T21:37:08 | 2019-04-04T21:37:08 | 178,664,539 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,630 | java | package com.example.locationapplication;
import android.support.annotation.NonNull;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.NavigationView;
import android.support.design.widget.Snackbar;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.content.Context;
import android.content.Intent;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonObjectRequest;
import com.android.volley.toolbox.Volley;
import com.bumptech.glide.Glide;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class Main2Activity extends AppCompatActivity implements LocationListener{
private RequestQueue mQueue;
Button getLocationBtn;
TextView locationText;
double lat,lon;
public String imgId;
LocationManager locationManager;
ImageView img;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
// setSupportActionBar(toolbar);
getLocationBtn = (Button)findViewById(R.id.getLocationBtn);
locationText = (TextView)findViewById(R.id.locationText);
mQueue = Volley.newRequestQueue(this);
getLocationBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getLocation();
// String weatherUrl = "http://api.openweathermap.org/data/2.5/weather?lat="+22+"&lon="+75+"&units=metric&APPID=2bf54d7c3d8918fa21a85b6dcc979c9a";
//jsonParse(weatherUrl);
}
});
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.addDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
return false;
}
});
View v= navigationView.getHeaderView(0);
img = v.findViewById(R.id.imageViewHeader);
String imgUrl= "http://openweathermap.org/img/w/" + imgId+ ".png";
// img = findViewById(R.id.imageViewHeader);
Glide.with(this).load(imgUrl).into(img);
}
void getLocation() {
try {
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
//locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 5000, 5, this);
//new try
Location location = locationManager.getLastKnownLocation(locationManager.NETWORK_PROVIDER);
onLocationChanged(location);
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,0,0,this);
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, this);
}
catch(SecurityException e) {
e.printStackTrace();
}
}
@Override
public void onLocationChanged(Location location) {
lat =location.getLatitude();
lon= location.getLongitude();
String weatherUrl = "http://api.openweathermap.org/data/2.5/weather?lat="+lat+"&lon="+lon+"&units=metric&APPID=2bf54d7c3d8918fa21a85b6dcc979c9a";
locationText.setText("Current Location: " + lat + ", " + lon);
// Toast.makeText(this,""+lat+ lon,Toast.LENGTH_SHORT).show();
jsonParse(weatherUrl);
}
private void jsonParse(String url) {
//String url = "https://api.data.gov.in/resource/9ef84268-d588-465a-a308-a864a43d0070?api-key=579b464db66ec23bdd000001f0af90f3616349b86afb5082c578bf37&format=json&filters[state]=Gujarat";
// Toast.makeText(getApplicationContext(),"yaha aa rha hai 1",Toast.LENGTH_SHORT).show();
JsonObjectRequest request = new JsonObjectRequest(Request.Method.GET, url, null,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
try {
//Toast.makeText(getApplicationContext(),"yaha aa rha hai 2",Toast.LENGTH_SHORT).show();
JSONArray jsonArray = response.getJSONArray("weather");
JSONObject main = response.getJSONObject("main");
//Toast.makeText(this, ""+jsonArray.length(), Toast.LENGTH_SHORT).show();
// Toast.makeText(getApplicationContext(),""+jsonArray.length(),Toast.LENGTH_SHORT).show();
// for(int i = 0; i<jsonArray.length() ; i++){
//JSONObject record = jsonArray.getJSONObject(i);
String temp = main.getString("temp");
Toast.makeText(getApplicationContext(), "Temperature : "+ temp, Toast.LENGTH_SHORT).show();
String pressure = main.getString("pressure");
Toast.makeText(getApplicationContext(), "Pressure : "+ pressure, Toast.LENGTH_SHORT).show();
JSONObject Weatherobject =jsonArray.getJSONObject(0) ;
imgId = Weatherobject.getString("icon");
Toast.makeText(getApplicationContext(), "id : "+ Weatherobject.getString("icon"), Toast.LENGTH_SHORT).show();
//String temp = main.getString("timestamp");
} catch (JSONException e) {
e.printStackTrace();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(getApplicationContext(), ""+ error, Toast.LENGTH_SHORT).show();
}
});
mQueue.add(request);
}
@Override
public void onProviderDisabled(String provider) {
Toast.makeText(Main2Activity.this, "Please Enable GPS and Internet", Toast.LENGTH_SHORT).show();
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
}
@Override
public void onProviderEnabled(String provider) {
}
}
| [
"aakash9868sinha@live.com"
] | aakash9868sinha@live.com |
451b35376570a9161750b7750fe771fb05b79131 | c726a3a51715f553ce695fa90bfa74986c619e74 | /Toll/src/main/java/com/toll/app/model/Product.java | fbad5dd2b6d791e6478a49589d626dad7ee04972 | [] | no_license | Shubham1011/ReviewApp | af00140a9b72b3ab4cfe91f76e7d912d46ee0ea1 | bd32aacd293e53cd9467bd1f2c63ddd44be5d181 | refs/heads/master | 2022-12-13T06:53:13.634361 | 2020-08-04T06:19:08 | 2020-08-04T06:19:08 | 241,618,199 | 0 | 0 | null | 2022-12-05T09:20:09 | 2020-02-19T12:38:05 | JavaScript | UTF-8 | Java | false | false | 804 | java | package com.toll.app.model;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.MongoId;
import java.util.ArrayList;
@Document(collection = "product")
public class Product {
@Id
private String id;
private String name;
private ArrayList<String> reviews;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public ArrayList<String> getReviews() {
return reviews;
}
public void setReviews(ArrayList<String> reviews) {
this.reviews = reviews;
}
}
| [
"shubhamspalkar@gmail.com"
] | shubhamspalkar@gmail.com |
0aedded5cef71938da9e4df019a98235c7c39bc5 | 01cc7b77f0688ef50a8090fe62e8e8df7da5a703 | /src/db/mysql/MySQLConnection.java | 52ea4761b5867d9fc53ec6f0c380ba90c6eb9fc7 | [] | no_license | darkpeach/Jupiter | 79c04fe57d5cf62e7709bba78bc460fde9d76685 | b84c0e632045367e0e7edb1b2c47657283515acb | refs/heads/master | 2022-09-30T17:16:20.325164 | 2020-05-26T01:22:01 | 2020-05-26T01:22:01 | 254,807,121 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,907 | java | package db.mysql;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import db.DBConnection;
import entity.Item;
import entity.Item.ItemBuilder;
import external.TicketMasterAPI;
public class MySQLConnection implements DBConnection{
private Connection conn;
public MySQLConnection() {
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn = DriverManager.getConnection(MySQLDBUtil.URL);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void close() {
if (conn != null) {
try {
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
@Override
public void setFavoriteItems(String userId, List<String> itemIds) {
if (conn == null) {
return;
}
try {
String sql = "INSERT IGNORE INTO history (user_id, item_id) VALUES (?, ?)";
PreparedStatement stmt = conn.prepareStatement(sql);
for(String itemId: itemIds) {
stmt.setString(1, userId);
stmt.setString(2, itemId);
stmt.execute();
}
}catch(SQLException e) {
e.printStackTrace();
}
}
@Override
public void unsetFavoriteItems(String userId, List<String> itemIds) {
if(conn == null) {
return;
}
try {
String sql = "DELETE FROM history WHERE user_id = ? AND item_id = ?";
PreparedStatement stmt = conn.prepareStatement(sql);
for(String itemId: itemIds) {
stmt.setString(1, userId);
stmt.setString(2, itemId);
stmt.execute();
}
}catch(SQLException e) {
e.printStackTrace();
}
}
@Override
public Set<String> getFavoriteItemIds(String userId) {
if(conn == null) {
return new HashSet<>();
}
Set<String> itemIds = new HashSet<>();
try {
String sql = "SELECT item_id from history where user_id = ?";
PreparedStatement stmt = conn.prepareStatement(sql);
stmt.setString(1, userId);
ResultSet rs = stmt.executeQuery();
while(rs.next()) {
String itemId = rs.getString("item_id");
itemIds.add(itemId);
}
} catch (SQLException e) {
e.printStackTrace();
}
return itemIds;
}
@Override
public Set<Item> getFavoriteItems(String userId) {
if(conn == null) {
return new HashSet<>();
}
Set<Item> favoriteItems = new HashSet<>();
Set<String> itemIds = getFavoriteItemIds(userId);
try {
String sql = "SELECT * FROM items WHERE item_id = ?";
PreparedStatement stmt = conn.prepareStatement(sql);
for(String itemId: itemIds) {
stmt.setString(1, itemId);
ResultSet rs = stmt.executeQuery();
ItemBuilder builder = new ItemBuilder();
while(rs.next()) {
builder.setItemId(rs.getString("item_id"));
builder.setName(rs.getString("name"));
builder.setAddress(rs.getString("address"));
builder.setImageUrl(rs.getString("image_url"));
builder.setUrl(rs.getString("url"));
builder.setCategories(getCategories(itemId));
builder.setDistance(rs.getDouble("distance"));
builder.setRating(rs.getDouble("rating"));
favoriteItems.add(builder.build());
}
}
} catch (SQLException e) {
e.printStackTrace();
}
return favoriteItems;
}
@Override
public Set<String> getCategories(String itemId) {
if(conn == null) {
return new HashSet<>();
}
Set<String> categories = new HashSet<>();
try {
String sql = "SELECT * FROM categories WHERE item_id = ?";
PreparedStatement stmt = conn.prepareStatement(sql);
stmt.setString(1, itemId);
ResultSet rs = stmt.executeQuery();
while(rs.next()) {
categories.add(rs.getString("category"));
}
} catch (SQLException e) {
e.printStackTrace();
}
return categories;
}
@Override
public List<Item> searchItems(double lat, double lon, String term) {
// TODO Auto-generated method stub
TicketMasterAPI tmApi = new TicketMasterAPI();
List<Item> items = tmApi.search(lat, lon, term);
for(Item item: items) {
saveItem(item);
}
return items;
}
@Override
public void saveItem(Item item) {
// TODO Auto-generated method stub
if (conn == null) {
return;
}
try {
String sql = "INSERT IGNORE INTO items VALUES (?, ?, ?, ?, ?, ?, ?)";
PreparedStatement stmt = conn.prepareStatement(sql);
stmt.setString(1, item.getItemId());
stmt.setString(2, item.getName());
stmt.setDouble(3, item.getRating());
stmt.setString(4, item.getAddress());
stmt.setString(5, item.getImageUrl());
stmt.setString(6, item.getUrl());
stmt.setDouble(7, item.getDistance());
stmt.execute();
sql = "INSERT IGNORE INTO categories VALUES (?, ?)";
stmt = conn.prepareStatement(sql);
for (String category : item.getCategories()) {
stmt.setString(1, item.getItemId());
stmt.setString(2, category);
stmt.execute();
}
} catch (SQLException e) {
e.printStackTrace();
}
}
@Override
public String getFullname(String userId) {
if(conn == null) {
return "";
}
String fullName = "";
try {
String sql = "SELECT first_name, last_name FROM users WHERE user_id = ?";
PreparedStatement stmt = conn.prepareStatement(sql);
stmt.setString(1, userId);
ResultSet rs = stmt.executeQuery();
if(rs.next()) {
fullName = String.join(" ", rs.getString("first_name"), rs.getString("last_name"));
}
} catch (SQLException e) {
e.printStackTrace();
}
return fullName;
}
@Override
public boolean verifyLogin(String userId, String password) {
if(conn == null) {
return false;
}
try {
String sql = "SELECT user_id FROM users WHERE user_id = ? and password = ?";
PreparedStatement stmt = conn.prepareStatement(sql);
stmt.setString(1, userId);
stmt.setString(2, password);
ResultSet rs = stmt.executeQuery();
if(rs.next()){
return true;
}
} catch (SQLException e) {
e.printStackTrace();
}
return false;
}
}
| [
"zhr900301@gmail.com"
] | zhr900301@gmail.com |
00195bb366ce286a276526bf8c78b357d6b2d2d2 | 792a4de53e9ce34366105168f7659d8f04874735 | /app/build/generated/source/r/debug/android/support/v7/recyclerview/R.java | c06648561be4207798ca67d3645c434250de526c | [] | no_license | sheraz-ahmad94/SMDDemo | ceb17daadadfac62dfb7172a39de2da20d040ad0 | 85402b79c4923a31cb0129640a53b43101791634 | refs/heads/master | 2022-07-19T03:56:16.870406 | 2020-05-15T01:28:37 | 2020-05-15T01:28:37 | 264,065,210 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,033 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package android.support.v7.recyclerview;
public final class R {
public static final class attr {
public static final int coordinatorLayoutStyle = 0x7f03007f;
public static final int fastScrollEnabled = 0x7f0300a3;
public static final int fastScrollHorizontalThumbDrawable = 0x7f0300a4;
public static final int fastScrollHorizontalTrackDrawable = 0x7f0300a5;
public static final int fastScrollVerticalThumbDrawable = 0x7f0300a6;
public static final int fastScrollVerticalTrackDrawable = 0x7f0300a7;
public static final int font = 0x7f0300a8;
public static final int fontProviderAuthority = 0x7f0300aa;
public static final int fontProviderCerts = 0x7f0300ab;
public static final int fontProviderFetchStrategy = 0x7f0300ac;
public static final int fontProviderFetchTimeout = 0x7f0300ad;
public static final int fontProviderPackage = 0x7f0300ae;
public static final int fontProviderQuery = 0x7f0300af;
public static final int fontStyle = 0x7f0300b0;
public static final int fontWeight = 0x7f0300b1;
public static final int keylines = 0x7f0300cd;
public static final int layoutManager = 0x7f0300d3;
public static final int layout_anchor = 0x7f0300d4;
public static final int layout_anchorGravity = 0x7f0300d5;
public static final int layout_behavior = 0x7f0300d6;
public static final int layout_dodgeInsetEdges = 0x7f030102;
public static final int layout_insetEdge = 0x7f03010b;
public static final int layout_keyline = 0x7f03010c;
public static final int reverseLayout = 0x7f030142;
public static final int spanCount = 0x7f030152;
public static final int stackFromEnd = 0x7f030158;
public static final int statusBarBackground = 0x7f03015c;
}
public static final class bool {
public static final int abc_action_bar_embed_tabs = 0x7f040000;
}
public static final class color {
public static final int notification_action_color_filter = 0x7f050061;
public static final int notification_icon_bg_color = 0x7f050062;
public static final int ripple_material_light = 0x7f050071;
public static final int secondary_text_default_material_light = 0x7f050073;
}
public static final class dimen {
public static final int compat_button_inset_horizontal_material = 0x7f06004b;
public static final int compat_button_inset_vertical_material = 0x7f06004c;
public static final int compat_button_padding_horizontal_material = 0x7f06004d;
public static final int compat_button_padding_vertical_material = 0x7f06004e;
public static final int compat_control_corner_material = 0x7f06004f;
public static final int fastscroll_default_thickness = 0x7f06007a;
public static final int fastscroll_margin = 0x7f06007b;
public static final int fastscroll_minimum_range = 0x7f06007c;
public static final int item_touch_helper_max_drag_scroll_per_frame = 0x7f060084;
public static final int item_touch_helper_swipe_escape_max_velocity = 0x7f060085;
public static final int item_touch_helper_swipe_escape_velocity = 0x7f060086;
public static final int notification_action_icon_size = 0x7f060087;
public static final int notification_action_text_size = 0x7f060088;
public static final int notification_big_circle_margin = 0x7f060089;
public static final int notification_content_margin_start = 0x7f06008a;
public static final int notification_large_icon_height = 0x7f06008b;
public static final int notification_large_icon_width = 0x7f06008c;
public static final int notification_main_column_padding_top = 0x7f06008d;
public static final int notification_media_narrow_margin = 0x7f06008e;
public static final int notification_right_icon_size = 0x7f06008f;
public static final int notification_right_side_padding_top = 0x7f060090;
public static final int notification_small_icon_background_padding = 0x7f060091;
public static final int notification_small_icon_size_as_large = 0x7f060092;
public static final int notification_subtext_size = 0x7f060093;
public static final int notification_top_pad = 0x7f060094;
public static final int notification_top_pad_large_text = 0x7f060095;
}
public static final class drawable {
public static final int notification_action_background = 0x7f070087;
public static final int notification_bg = 0x7f070088;
public static final int notification_bg_low = 0x7f070089;
public static final int notification_bg_low_normal = 0x7f07008a;
public static final int notification_bg_low_pressed = 0x7f07008b;
public static final int notification_bg_normal = 0x7f07008c;
public static final int notification_bg_normal_pressed = 0x7f07008d;
public static final int notification_icon_background = 0x7f07008e;
public static final int notification_template_icon_bg = 0x7f07008f;
public static final int notification_template_icon_low_bg = 0x7f070090;
public static final int notification_tile_bg = 0x7f070091;
public static final int notify_panel_notification_icon_bg = 0x7f070092;
}
public static final class id {
public static final int action_container = 0x7f080010;
public static final int action_divider = 0x7f080012;
public static final int action_image = 0x7f080013;
public static final int action_text = 0x7f08001b;
public static final int actions = 0x7f08001c;
public static final int async = 0x7f080025;
public static final int blocking = 0x7f080029;
public static final int bottom = 0x7f08002a;
public static final int chronometer = 0x7f08003a;
public static final int end = 0x7f080052;
public static final int forever = 0x7f08005e;
public static final int icon = 0x7f080066;
public static final int icon_group = 0x7f080067;
public static final int info = 0x7f08006d;
public static final int italic = 0x7f080073;
public static final int item_touch_helper_previous_elevation = 0x7f080074;
public static final int left = 0x7f080076;
public static final int line1 = 0x7f080078;
public static final int line3 = 0x7f080079;
public static final int none = 0x7f080087;
public static final int normal = 0x7f080088;
public static final int notification_background = 0x7f080089;
public static final int notification_main_column = 0x7f08008a;
public static final int notification_main_column_container = 0x7f08008b;
public static final int right = 0x7f080099;
public static final int right_icon = 0x7f08009a;
public static final int right_side = 0x7f08009b;
public static final int start = 0x7f0800c1;
public static final int tag_transition_group = 0x7f0800c6;
public static final int text = 0x7f0800c8;
public static final int text2 = 0x7f0800c9;
public static final int time = 0x7f0800d1;
public static final int title = 0x7f0800d2;
public static final int top = 0x7f0800d5;
}
public static final class integer {
public static final int status_bar_notification_info_maxnum = 0x7f09000a;
}
public static final class layout {
public static final int notification_action = 0x7f0a0037;
public static final int notification_action_tombstone = 0x7f0a0038;
public static final int notification_template_custom_big = 0x7f0a003f;
public static final int notification_template_icon_group = 0x7f0a0040;
public static final int notification_template_part_chronometer = 0x7f0a0044;
public static final int notification_template_part_time = 0x7f0a0045;
}
public static final class string {
public static final int status_bar_notification_info_overflow = 0x7f0e0063;
}
public static final class style {
public static final int TextAppearance_Compat_Notification = 0x7f0f00ed;
public static final int TextAppearance_Compat_Notification_Info = 0x7f0f00ee;
public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0f00f0;
public static final int TextAppearance_Compat_Notification_Time = 0x7f0f00f3;
public static final int TextAppearance_Compat_Notification_Title = 0x7f0f00f5;
public static final int Widget_Compat_NotificationActionContainer = 0x7f0f016b;
public static final int Widget_Compat_NotificationActionText = 0x7f0f016c;
public static final int Widget_Support_CoordinatorLayout = 0x7f0f0178;
}
public static final class styleable {
public static final int[] CoordinatorLayout = { 0x7f0300cd, 0x7f03015c };
public static final int CoordinatorLayout_keylines = 0;
public static final int CoordinatorLayout_statusBarBackground = 1;
public static final int[] CoordinatorLayout_Layout = { 0x010100b3, 0x7f0300d4, 0x7f0300d5, 0x7f0300d6, 0x7f030102, 0x7f03010b, 0x7f03010c };
public static final int CoordinatorLayout_Layout_android_layout_gravity = 0;
public static final int CoordinatorLayout_Layout_layout_anchor = 1;
public static final int CoordinatorLayout_Layout_layout_anchorGravity = 2;
public static final int CoordinatorLayout_Layout_layout_behavior = 3;
public static final int CoordinatorLayout_Layout_layout_dodgeInsetEdges = 4;
public static final int CoordinatorLayout_Layout_layout_insetEdge = 5;
public static final int CoordinatorLayout_Layout_layout_keyline = 6;
public static final int[] FontFamily = { 0x7f0300aa, 0x7f0300ab, 0x7f0300ac, 0x7f0300ad, 0x7f0300ae, 0x7f0300af };
public static final int FontFamily_fontProviderAuthority = 0;
public static final int FontFamily_fontProviderCerts = 1;
public static final int FontFamily_fontProviderFetchStrategy = 2;
public static final int FontFamily_fontProviderFetchTimeout = 3;
public static final int FontFamily_fontProviderPackage = 4;
public static final int FontFamily_fontProviderQuery = 5;
public static final int[] FontFamilyFont = { 0x01010532, 0x01010533, 0x0101053f, 0x7f0300a8, 0x7f0300b0, 0x7f0300b1 };
public static final int FontFamilyFont_android_font = 0;
public static final int FontFamilyFont_android_fontWeight = 1;
public static final int FontFamilyFont_android_fontStyle = 2;
public static final int FontFamilyFont_font = 3;
public static final int FontFamilyFont_fontStyle = 4;
public static final int FontFamilyFont_fontWeight = 5;
public static final int[] RecyclerView = { 0x010100c4, 0x010100f1, 0x7f0300a3, 0x7f0300a4, 0x7f0300a5, 0x7f0300a6, 0x7f0300a7, 0x7f0300d3, 0x7f030142, 0x7f030152, 0x7f030158 };
public static final int RecyclerView_android_orientation = 0;
public static final int RecyclerView_android_descendantFocusability = 1;
public static final int RecyclerView_fastScrollEnabled = 2;
public static final int RecyclerView_fastScrollHorizontalThumbDrawable = 3;
public static final int RecyclerView_fastScrollHorizontalTrackDrawable = 4;
public static final int RecyclerView_fastScrollVerticalThumbDrawable = 5;
public static final int RecyclerView_fastScrollVerticalTrackDrawable = 6;
public static final int RecyclerView_layoutManager = 7;
public static final int RecyclerView_reverseLayout = 8;
public static final int RecyclerView_spanCount = 9;
public static final int RecyclerView_stackFromEnd = 10;
}
}
| [
"sheraz.ahmad@protonmail.com"
] | sheraz.ahmad@protonmail.com |
98dd25b4864bde459e6f3e1edf6d08079674cde1 | a7a9355a026ba696b0eb3be762110b34bf006380 | /spring-boot-hello1/src/main/java/com/kfit/test/web/HelloController.java | 24676bb1d02034235cb474a511edb14ce79f97fc | [] | no_license | liweiyuan/springBoot | 96a49e52b7a723a7984649c4ae2085e435ff0876 | d21eac3f4f381da52bcd54b830783f3e48f2eb98 | refs/heads/master | 2021-01-21T14:33:11.308383 | 2017-06-24T13:40:01 | 2017-06-24T13:40:01 | 95,299,563 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 324 | java | package com.kfit.test.web;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController // 标记为:restful
public class HelloController {
@RequestMapping("/hello")
public String hello(){
return "Hello world!";
}
}
| [
"535767595@qq.com"
] | 535767595@qq.com |
cc9d2c53ba02c165edb363c1d8dfbdb91c8d544b | 6a76b9a294ecf09b071984a51dd809e1e1467c7c | /src/LeetCode/Test01_60/Test55.java | 73333dba14db6baa6045120191b8b6a97d7dd7eb | [] | no_license | Lux3833/NOWCODER | bfa55c43dd372be9b5b3089b25f6a14eeb8510e3 | 171ae914f2047c9447fce5cb325d4a3ecc2768c5 | refs/heads/master | 2023-05-04T20:34:28.606258 | 2021-05-23T05:41:29 | 2021-05-23T05:41:29 | 303,978,698 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,252 | java | package LeetCode.Test01_60;
import LeetCode.Utils.Utils;
/**
* @title: Test55
* @Author: Lux_er
* @Date: 2021/4/27 0027 下午 8:52
* @Description:跳跃游戏
* 给定一个非负整数数组 nums ,你最初位于数组的 第一个下标 。
* 数组中的每个元素代表你在该位置可以跳跃的最大长度。
* 判断你是否能够到达最后一个下标。
*/
public class Test55 {
public static void main(String[] args) {
Utils utils = new Utils();
int[] arr = utils.inputNums();
boolean res = cap(arr,0);
System.out.println(res);
}
private static boolean cap(int[] arr, int i) {
if(arr == null || arr.length == 0 ){
return false;
}
if(arr[i]+i >= arr.length-1){
return true;
}
if(arr[arr[i]+i] == 0){
return false;
}
int res = Integer.MIN_VALUE;
int index = i;
for (int j = i; j < arr[i]+i; j++) {
if(res <= arr[j]+j){
res = arr[j]+j;
index = j;
}
}
if(arr[index]+index >= arr.length-1){
return true;
}else{
cap(arr, index);
}
return false;
}
}
| [
"961930248@qq.com"
] | 961930248@qq.com |
c3e9ada747f4b783f0ddab1f5e00e921625592a1 | a4700be0919cff4297cc81e256f25e6e239103ac | /src/main/java/com/lifehrx/disruptor/v4_09/Main.java | 1359a7dd5d3ce320b5502471986ecb449e2eb8c6 | [] | no_license | lifehrx/JUC-master | 3c183b31a1489a92b23c051da23d7e86220dfea7 | 1303cfc2b0586b5388c78ad960f9320784efba44 | refs/heads/master | 2023-03-17T07:17:26.898415 | 2020-07-28T03:24:00 | 2020-07-28T03:24:00 | 276,538,308 | 0 | 0 | null | 2021-03-31T22:15:05 | 2020-07-02T03:22:52 | Java | UTF-8 | Java | false | false | 1,367 | java | package com.lifehrx.disruptor.v4_09;
import com.lmax.disruptor.RingBuffer;
import com.lmax.disruptor.dsl.Disruptor;
import com.lmax.disruptor.util.DaemonThreadFactory;
import java.nio.ByteBuffer;
public class Main {
public static void handleEvent(LongEvent event, long sequence, boolean endOfBatch)
{
System.out.println(event);
}
public static void translate(LongEvent event, long sequence, ByteBuffer buffer)
{
event.setValue(buffer.getLong(0));
}
public static void main(String[] args) throws Exception
{
// Specify the size of the ring buffer, must be power of 2.
int bufferSize = 1024;
// Construct the Disruptor
Disruptor<LongEvent> disruptor = new Disruptor<>(LongEvent::new, bufferSize, DaemonThreadFactory.INSTANCE);
// Connect the handler
disruptor.handleEventsWith(Main::handleEvent);
// Start the Disruptor, starts all threads running
disruptor.start();
// Get the ring buffer from the Disruptor to be used for publishing.
RingBuffer<LongEvent> ringBuffer = disruptor.getRingBuffer();
ByteBuffer bb = ByteBuffer.allocate(8);
for (long l = 0; true; l++)
{
bb.putLong(0, l);
ringBuffer.publishEvent(Main::translate, bb);
Thread.sleep(1000);
}
}
}
| [
"lifehrx@gmail.com"
] | lifehrx@gmail.com |
6bcf04431b73b678bfa5e64add764dc5328dddca | a0a6e6c1caefda886d4fa4662cc3f53f56231378 | /src/chemotaxis/g1/ids/IDSCandidate.java | dd426bb58ed6ab8481396fd8b320e7b80cc412f7 | [] | no_license | AlexPeile/chemotaxis | 2b86913e84dca6c58b4ba5c0a778fa3e90654e16 | 7a42273eaee2ff7711b0df312dda665afcfd9ed6 | refs/heads/master | 2023-08-23T12:21:24.075875 | 2021-10-01T23:57:57 | 2021-10-01T23:57:57 | 407,593,875 | 0 | 0 | null | 2021-10-01T23:59:27 | 2021-09-17T15:37:29 | Java | UTF-8 | Java | false | false | 1,613 | java | package chemotaxis.g1.ids;
import chemotaxis.sim.ChemicalCell;
import chemotaxis.sim.ChemicalPlacement;
/**
* Wrapper class so that we can compare and de-dupe chemical placements.
*/
public class IDSCandidate implements Comparable<IDSCandidate> {
private ChemicalPlacement placement;
private String repr;
IDSCandidate(ChemicalPlacement placement) {
this.setPlacement(placement);
}
public ChemicalPlacement getPlacement() {
return placement;
}
public void setPlacement(ChemicalPlacement placement) {
this.placement = placement;
StringBuilder sb = new StringBuilder();
sb.append(placement.location.x);
sb.append(',');
sb.append(placement.location.y);
if (placement.chemicals.contains(ChemicalCell.ChemicalType.BLUE)) {
sb.append('B');
}
if (placement.chemicals.contains(ChemicalCell.ChemicalType.GREEN)) {
sb.append('G');
}
if (placement.chemicals.contains(ChemicalCell.ChemicalType.RED)) {
sb.append('R');
}
this.repr = sb.toString();
}
@Override
public String toString() {
return this.repr;
}
@Override
public int hashCode() {
return this.repr.hashCode();
}
@Override
public boolean equals(Object other) {
if (!(other instanceof IDSCandidate)) {
return false;
}
return this.repr.equals(((IDSCandidate) other).repr);
}
@Override
public int compareTo(IDSCandidate other) {
return this.repr.compareTo(other.repr);
}
} | [
"etm2131@columbia.edu"
] | etm2131@columbia.edu |
baeab1206bb1afd9b51f771cd4a71c29f367bc69 | 3dc0baf2b60a592a48b1e80c515f1d851f10dfa7 | /String - Lower case/Main.java | 528fd540e7f8c3162db738221330bf2e458af402 | [] | no_license | deeedev/Playground | 88dfb8ae501619e5da1da63a5c5b72e2b8424579 | e358d179716f820bce514588e0f62940adcbf36d | refs/heads/master | 2023-01-13T23:36:58.662826 | 2020-11-19T12:03:09 | 2020-11-19T12:03:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 204 | java | import java.util.Scanner;
class Main
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
String str = sc.nextLine();
System.out.println(str.toLowerCase());
}
} | [
"deepankar_tiwari@outlook.com"
] | deepankar_tiwari@outlook.com |
71be98a9271f306a463824e21a174fd0422e658b | 85538eee877d5dc893b94e2055715fb3c8c9454f | /thtest/workspace/thinking_in_java/src/tcp/vote/demo/VoteMsgCoder.java | 202efa899874b38b28c9c7e003566f62ecff6783 | [] | no_license | linuxth1988/demo | 6199d61d5d2c0c01d953b88c961bdb7191118db7 | 147faf7c20c18aa17d0c5095a5066b0c06000e3c | refs/heads/master | 2020-05-20T03:24:19.706555 | 2013-10-18T14:36:54 | 2013-10-18T14:36:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 253 | java | package tcp.vote.demo;
import java.io.IOException;
/**提供对投票信息进行序列化和反序列化的接口*/
public interface VoteMsgCoder
{
byte[] toWire(VoteMsg msg)throws IOException;
VoteMsg fromWire(byte[] message)throws IOException;
}
| [
"tangxiansheng21@gmail.com"
] | tangxiansheng21@gmail.com |
9d95f1efc15a6bc8aea71707d0f010d0ecfeefeb | 2148a0f14418ac28ea9780706173308d72a2ae2d | /src/main/java/org/topdank/mc/bot/api/nbt/conversion/builtin/LongTagConverter.java | c23a26e63c41b8a90c01646114b6e65d97cbd7db | [] | no_license | t81lal/mcbot | 85831a0a62c49c5142114bfdeaf85362b5d502a2 | de6f8ca7879e3d83e253d2f6fbf9ecfb263462fb | refs/heads/master | 2022-06-03T06:16:29.541751 | 2015-12-24T19:46:30 | 2015-12-24T19:46:30 | 229,469,980 | 0 | 0 | null | 2022-05-20T21:19:45 | 2019-12-21T18:53:48 | Java | UTF-8 | Java | false | false | 485 | java | package org.topdank.mc.bot.api.nbt.conversion.builtin;
import org.topdank.mc.bot.api.nbt.conversion.TagConverter;
import org.topdank.mc.bot.api.nbt.tag.builtin.LongTag;
/**
* A converter that converts between LongTag and long.
*/
public class LongTagConverter implements TagConverter<LongTag, Long> {
@Override
public Long convert(LongTag tag) {
return tag.getValue();
}
@Override
public LongTag convert(String name, Long value) {
return new LongTag(name, value);
}
}
| [
"GenerallyCool@hotmail.com"
] | GenerallyCool@hotmail.com |
267cacb9b96a975247dfcc6f0c47e607bd740e16 | 8cd0df80323f0f86c329589b1b20d9cf658ae875 | /src/ru/fastcards/editor/PostCardFragmentPrint.java | ec34cadc9575c9ba2c124a64d7d4725622a49952 | [
"Apache-2.0"
] | permissive | Defuera/cards-app | b988cc900cd7a2f0b3f90e2befa15bb6a3548650 | 214d68d535f180529358c941db0232b574a287f2 | refs/heads/master | 2020-05-09T22:20:42.090368 | 2014-09-23T18:11:52 | 2014-09-23T18:11:52 | 24,382,946 | 1 | 0 | null | null | null | null | WINDOWS-1251 | Java | false | false | 10,459 | java | package ru.fastcards.editor;
import ru.fastcards.R;
import ru.fastcards.utils.ImageManager;
import ru.fastcards.utils.ScreenParams;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.os.Bundle;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.FrameLayout.LayoutParams;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
public class PostCardFragmentPrint extends PostCardFragment{
private Bitmap front_image;
private Bitmap back_image;
private View v;
private LinearLayout workspace;
private EditText postcardText;
private FrameLayout background;
private LineCountAnalyser lineCountAnalyser;
private ImageView frontImage;
private ImageView backImage;
private android.widget.LinearLayout.LayoutParams imageParams;
private FrameLayout.LayoutParams backgroundParams;
private LinearLayout.LayoutParams textParams,textZoomParams;
private LinearLayout.LayoutParams signParams,signZoomParams;
private FrameLayout reverce_side;
private final String TAG="PrintPostCard";
private RelativeLayout signature_container;
private ImageView signature_image;
private ImageView signature_background;
private String frontfilename;
private String backfilename;
private ImageManager manager;
private LayoutParams workspaceParams;
private android.widget.LinearLayout.LayoutParams workspaceZoomParams;
public PostCardFragmentPrint() {
// TODO Auto-generated constructor stub
manager = new ImageManager(context);
frontfilename=manager.createFileNameFromUrl(theme.getPostCardFrontThumb());
backfilename=manager.createFileNameFromUrl(theme.getPostCardBackThumb());
front_image=manager.decodeBitmapFromFile(frontfilename);
back_image=manager.decodeBitmapFromFile(backfilename);
}
//OVERRIDED FRAGMENTS METHODS************************************************************
@Override
public void onResume() {
// TODO Auto-generated method stub
super.onResume();
RestoreText();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// TODO Auto-generated method stub
v=inflater.inflate(R.layout.postcard_fragment_print, null);
createPrintPostCard();
return v;
}
@Override
public void onPause() {
// TODO Auto-generated method stub
savePostcard();
super.onPause();
}
//*****************************************************************************************
@Override
public void savePostcard() {
card.setText(postcardText.getText().toString());
// if (card.getSignatureImage()!=null) card.setStateSignature(Constants.OPEN);
card.setPrintSignature(card.getSignatureImage());
}
private void createPrintPostCard(){
front_image=manager.decodeBitmapFromFile(frontfilename);
back_image=manager.decodeBitmapFromFile(backfilename);
frontImage=(ImageView) v.findViewById(R.id.postcard_front_image);
frontImage.setImageBitmap(front_image);
backImage=(ImageView)v.findViewById(R.id.postcard_back_image);
backImage.setImageBitmap(back_image);
reverce_side=(FrameLayout)v.findViewById(R.id.reverse_side);
workspace=(LinearLayout) v.findViewById(R.id.workspace_print);
//Поле для ввода текстовой подписи
signature_container=(RelativeLayout)v.findViewById(R.id.signature_container);
//Для перехода на окно с рисованием подписи
signature_background=(ImageView) v.findViewById(R.id.signature_background);
signature_image=(ImageView) v.findViewById(R.id.signature_image);
//Поле ввода текста в открытку
postcardText=(EditText) v.findViewById(R.id.postcard_text);
//Фон-пока что не нужнен
background=(FrameLayout) v.findViewById(R.id.background);
lineCountAnalyser=new LineCountAnalyser(context,background, postcardText);
createLayoutParams();
statePostcardText();
frontImage.setFocusableInTouchMode(true);
frontImage.requestFocus();
setListeners();
}
private void setListeners(){
signature_background.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
PostCardListener.onStartSignatureActivityEvent();
}
});
frontImage.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub
close();
return false;
}
});
backImage.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub
close();
return false;
}
});
}
private void close(){
InputMethodManager imm = (InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(postcardText.getWindowToken(), 0);
if (getEditableMode()){
setWithoutZoomParams();
PostCardListener.onCloseEditorModeEvent();
postcardText.clearFocus();}
}
private void createLayoutParams(){
float backgroundHeight=ScreenParams.screenHeight*9/12;
float backgroundWidth=backgroundHeight*1252/1843;
float imageWidth=backgroundWidth;
float imageHeight=backgroundWidth*1252/1843;
float textWidth=imageWidth*530/1843;
float textHeight=imageHeight*330/1252;
float scaledWidth=imageWidth/1843;
float scaledHeight=imageHeight/1252;
float leftMargin=theme.getpTextLeft()*scaledWidth;
float topMargin=theme.getpTextTop()*scaledHeight;
//Params for all workspace
backgroundParams=new FrameLayout.LayoutParams((int)backgroundWidth,(int)backgroundHeight);
//Params for image
imageParams=new LinearLayout.LayoutParams((int)imageWidth,(int)imageHeight);//Временное решение
imageParams.gravity=Gravity.CENTER_HORIZONTAL;
textParams=new LinearLayout.LayoutParams((int)(textWidth),(int)(textHeight));
textParams.leftMargin=(int)leftMargin;
textParams.topMargin=(int)(topMargin-textHeight);
workspaceParams=new FrameLayout.LayoutParams((int)(textWidth),(int)(textHeight));
workspaceParams.leftMargin=(int)leftMargin;
workspaceParams.topMargin=(int)(topMargin-textHeight);
signParams=new LinearLayout.LayoutParams((int)(ScreenParams.screenHeight/12),(int)(ScreenParams.screenWidth/12));
signParams.leftMargin=(int)leftMargin;
textZoomParams=new LinearLayout.LayoutParams((int)(textWidth*2),(int)(textHeight*2));
textZoomParams.leftMargin=(int)leftMargin;
workspaceZoomParams=new LinearLayout.LayoutParams((int)(textWidth*2),(int)(textHeight*2));
workspaceZoomParams.leftMargin=(int)leftMargin;
signZoomParams=new LinearLayout.LayoutParams((int)(ScreenParams.screenHeight/6),(int)(ScreenParams.screenWidth/6));
signZoomParams.leftMargin=(int)leftMargin;
background.setLayoutParams(backgroundParams);
//Set Layout params
frontImage.setLayoutParams(imageParams);
reverce_side.setLayoutParams(imageParams);
setWithoutZoomParams();
textStyle();
}
private void setWithoutZoomParams(){
// postcardText.setLayoutParams(textParams);
workspace.setLayoutParams(textParams);
signature_container.setLayoutParams(signParams);
textStyle();
}
private void setZoomParams(){
// postcardText.setLayoutParams(textZoomParams);
workspace.setLayoutParams(textZoomParams);
signature_container.setLayoutParams(signZoomParams);
textStyle();
}
public Bitmap getHorisontalBitmap(Bitmap largeBitmap){
postcardText.setDrawingCacheEnabled(false);
postcardText.setText(null);
int textWidth = 530;
int textHeight = 330;
int width=largeBitmap.getWidth();
int height=largeBitmap.getHeight();
Bitmap bitmap=Bitmap.createBitmap(width, height,Config.ARGB_8888);
Canvas canvas=new Canvas(bitmap);
canvas.drawColor(Color.WHITE);
Rect dst = new Rect(0, 0, width, height);
canvas.drawBitmap(largeBitmap, null, dst, new Paint());
postcardText.setText(card.getText());
postcardText.setCursorVisible(false);
postcardText.buildDrawingCache();
Bitmap textBitmap=Bitmap.createBitmap(postcardText.getDrawingCache());
int left=theme.getpTextLeft();
int top=theme.getpTextTop()-textHeight;
int right=theme.getpTextLeft()+textWidth;
int bottom=theme.getpTextTop();
Rect textRect = new Rect(left, top, right, bottom);
canvas.drawBitmap(textBitmap, null, textRect, new Paint());
int signLeft=theme.getpTextLeft();
int signTop=theme.getpTextTop();
int signRight=theme.getpTextLeft()+textWidth/2;
int signBottom=theme.getpTextTop()+textHeight/2;
Rect signRect = new Rect(signLeft, signTop, signRight , signBottom);
Bitmap signatureBitmap=card.getSignatureImage();
if (signatureBitmap!=null)
canvas.drawBitmap(signatureBitmap, null, signRect, new Paint());
return textBitmap;
}
private void textStyle(){
float textSize=workspace.getLayoutParams().height/12;
int unit=TypedValue.COMPLEX_UNIT_PX;
postcardText.setTextColor(Color.BLACK);
postcardText.setTextSize(unit,textSize);
}
private void RestoreText(){
postcardText.setText(card.getText());
signature_image.setImageBitmap(card.getSignatureImage());
}
@Override
public void setTextPostCard(String text){
postcardText.setText(text);
}
private void statePostcardText(){
postcardText.setSelection(0);
postcardText.setLines(8);
lineCountAnalyser.setLineCount(textFieldLines());
}
public boolean getEditableMode(){
if (postcardText==null) return false;
return postcardText.isFocused();
}
public void ZoomText(){
setZoomParams();
}
public String getText(){
card.setText(postcardText.getText().toString());
return card.getText();
}
} | [
"justdevelopers@gmail.com"
] | justdevelopers@gmail.com |
0bdaf3371b13e661390ab400c27ed032d42f187c | 6af127e56945ab4b66d2085c121b7946ed9f7fd0 | /app/src/main/java/me/justup/upme/dialogs/ViewImageDialog.java | 4643cae38e6af2b10c4752ce5a7ef00f914222d7 | [] | no_license | Viktor-s/new_app | 10b3ae70c1e2d2b3ae372b2824c8d5f9b5820ae9 | 2360897d7e6613917bc2594bdfee78c3175e9501 | refs/heads/master | 2021-03-24T11:09:23.228384 | 2015-06-22T15:06:32 | 2015-06-22T15:06:32 | 29,297,579 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,409 | java | package me.justup.upme.dialogs;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.Toast;
import me.justup.upme.R;
public class ViewImageDialog extends DialogFragment {
public static final String VIEW_IMAGE_DIALOG = "view_image_dialog";
private static final String VIEW_IMAGE_FILE_NAME = "view_image_file_name";
private static final String VIEW_IMAGE_FILE_PATH = "view_image_file_path";
private Bitmap image;
public static ViewImageDialog newInstance(final String fileName, final String filePath) {
Bundle args = new Bundle();
args.putString(VIEW_IMAGE_FILE_NAME, fileName);
args.putString(VIEW_IMAGE_FILE_PATH, filePath);
ViewImageDialog fragment = new ViewImageDialog();
fragment.setArguments(args);
return fragment;
}
@SuppressLint("InflateParams")
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
String fileName = (String) getArguments().getSerializable(VIEW_IMAGE_FILE_NAME);
String filePath = (String) getArguments().getSerializable(VIEW_IMAGE_FILE_PATH);
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
LayoutInflater inflater = getActivity().getLayoutInflater();
View dialogView = inflater.inflate(R.layout.dialog_view_image, null);
setCancelable(false);
ImageView mImagePanel = (ImageView) dialogView.findViewById(R.id.dialog_image_panel);
try {
image = BitmapFactory.decodeFile(filePath);
} catch (OutOfMemoryError e) {
Toast.makeText(getActivity(), e.toString(), Toast.LENGTH_LONG).show();
dismiss();
}
mImagePanel.setImageBitmap(image);
builder.setView(dialogView).setTitle(fileName).setPositiveButton(R.string.button_close, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
image = null;
dialog.dismiss();
}
});
return builder.create();
}
}
| [
"initrod@gmail.com"
] | initrod@gmail.com |
46a34b018430511d50356a5b4ca00590c94814d8 | f886812ecab339023ecf23ff5aa28b7051cc951e | /src/main/java/com/twineworks/tweakflow/lang/ast/structure/match/HeadTailListPatternNode.java | 6a2686c0f08a48a521b9a162d9592aa9399706c1 | [
"MIT"
] | permissive | twineworks/tweakflow | 995608af17f309bacb0064769499077aca7e1f8d | b6aa5241b9347c14d58bb0ef8f6b75a955ea92b6 | refs/heads/master | 2023-02-21T12:51:35.647910 | 2023-02-17T10:52:09 | 2023-02-17T10:52:09 | 97,735,381 | 31 | 6 | MIT | 2022-01-07T18:52:04 | 2017-07-19T15:55:15 | Java | UTF-8 | Java | false | false | 3,670 | java | /*
* The MIT License (MIT)
*
* Copyright (c) 2019 Twineworks GmbH
*
* 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.twineworks.tweakflow.lang.ast.structure.match;
import com.twineworks.tweakflow.lang.analysis.visitors.Visitor;
import com.twineworks.tweakflow.lang.ast.Node;
import com.twineworks.tweakflow.lang.parse.SourceInfo;
import com.twineworks.tweakflow.lang.scope.Scope;
import com.twineworks.tweakflow.lang.interpreter.ops.PatternOp;
import java.util.ArrayList;
import java.util.List;
public class HeadTailListPatternNode implements Node, MatchPatternNode {
private ArrayList<MatchPatternNode> elements = new ArrayList<>();
private CapturePatternNode tailCapture;
private CapturePatternNode capture;
private PatternOp patternOp;
private SourceInfo sourceInfo;
private Scope scope;
@Override
public HeadTailListPatternNode copy() {
HeadTailListPatternNode copy = new HeadTailListPatternNode();
copy.sourceInfo = sourceInfo;
copy.tailCapture = tailCapture.copy();
copy.capture = capture == null ? null : capture.copy();
for (MatchPatternNode element : elements) {
copy.elements.add((MatchPatternNode) element.copy());
}
return copy;
}
@Override
public SourceInfo getSourceInfo() {
return sourceInfo;
}
@Override
public HeadTailListPatternNode setSourceInfo(SourceInfo sourceInfo) {
this.sourceInfo = sourceInfo;
return this;
}
@Override
public List<? extends Node> getChildren() {
ArrayList<Node> ret = new ArrayList<>();
ret.addAll(elements);
ret.add(tailCapture);
if (capture != null) {
ret.add(capture);
}
return ret;
}
@Override
public Scope getScope() {
return scope;
}
@Override
public HeadTailListPatternNode setScope(Scope scope) {
this.scope = scope;
return this;
}
@Override
public HeadTailListPatternNode accept(Visitor visitor) {
return visitor.visit(this);
}
@Override
public PatternOp getPatternOp() {
return patternOp;
}
public HeadTailListPatternNode setPatternOp(PatternOp patternOp) {
this.patternOp = patternOp;
return this;
}
public ArrayList<MatchPatternNode> getElements() {
return elements;
}
public CapturePatternNode getTailCapture() {
return tailCapture;
}
public HeadTailListPatternNode setTailCapture(CapturePatternNode tailCapture) {
this.tailCapture = tailCapture;
return this;
}
public CapturePatternNode getCapture() {
return capture;
}
public HeadTailListPatternNode setCapture(CapturePatternNode capture) {
this.capture = capture;
return this;
}
}
| [
"slawomir.chodnicki@gmail.com"
] | slawomir.chodnicki@gmail.com |
a3fe62bc988ff22df803da4c5376cc6d2176a786 | 49dcf2a808dfb241072105ce9e34da1686e4fcc4 | /LifecycleLog/app/src/androidTest/java/com/example/android_logging_the_lifecycle_methods/ExampleInstrumentedTest.java | 47c0dd2519e2d4eaca0dde42efef4a9c32035133 | [] | no_license | Adrian-Jablonski/Beginning-Android | d1ea7aa9dba97c9dcaaaf24b864763e90aca27d4 | 98aeced1a263d0fd327f28b807ba70e0a2bd67ec | refs/heads/master | 2020-05-03T09:41:24.882640 | 2019-04-15T02:50:11 | 2019-04-15T02:50:11 | 178,561,046 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 782 | java | package com.example.android_logging_the_lifecycle_methods;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.android_logging_the_lifecycle_methods", appContext.getPackageName());
}
}
| [
"Jablonski.Adrian1@gmail.com"
] | Jablonski.Adrian1@gmail.com |
81e9ecf927396a424dbe31251ab8681f69a1fc25 | a4a51084cfb715c7076c810520542af38a854868 | /src/main/java/cn/tongdun/android/core/ooxoxoooxooo0xx00/o00o0o0oo0oo0o000x00.java | ef87ce86193c3ee02fd31c0a03d6a1725ec379b6 | [] | no_license | BharathPalanivelu/repotest | ddaf56a94eb52867408e0e769f35bef2d815da72 | f78ae38738d2ba6c9b9b4049f3092188fabb5b59 | refs/heads/master | 2020-09-30T18:55:04.802341 | 2019-12-02T10:52:08 | 2019-12-02T10:52:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,861 | java | package cn.tongdun.android.core.ooxoxoooxooo0xx00;
import android.app.ActivityManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
public class o00o0o0oo0oo0o000x00 {
public static synchronized Map o00xxox0x0xoox(Context context) {
Hashtable hashtable;
String str;
ApplicationInfo applicationInfo;
boolean z;
String str2;
boolean z2;
synchronized (o00o0o0oo0oo0o000x00.class) {
PackageManager packageManager = context.getPackageManager();
StringBuilder sb = new StringBuilder();
StringBuilder sb2 = new StringBuilder();
List installedPackages = packageManager.getInstalledPackages(0);
if (installedPackages == null || installedPackages.size() == 0) {
Intent intent = new Intent(o00xxox0x0xoox("53566b4076467b0c3c0b261a2d00774f7558685e691e0a120215", 7));
intent.addCategory(o00xxox0x0xoox("53366b2076267b6c3c6b267a2d60772d7538643a6c276770057d11661c6d117a", 103));
installedPackages = packageManager.queryIntentActivities(intent, 0);
}
Iterator it = installedPackages.iterator();
String[] strArr = {o00xxox0x0xoox("517261312e3e2428392e3464", 32), o00xxox0x0xoox("51166155285d2855235c68", 68), o00xxox0x0xoox("512461673e632a6e2562276264", 118), o00xxox0x0xoox("551067186c11275e28543e49384472", 70), o00xxox0x0xoox("51006143275e3348214466", 82), o00xxox0x0xoox("5169612a222e3e3279", 59), o00xxox0x0xoox("5157611437053f0b3d0f7a", 5), o00xxox0x0xoox("51106153394c265567", 66), o00xxox0x0xoox("513461772068207761", 102), o00xxox0x0xoox("511361503c42305c36473f0e", 65), o00xxox0x0xoox("513461773c613a2c75237f3562336f79", 102), o00xxox0x0xoox("510a614923402841315870", 88), o00xxox0x0xoox("51746137363b2f382e3167", 38), o00xxox0x0xoox("514d610e28002e0125016e", 31), o00xxox0x0xoox("51016142234b32496a", 83), o00xxox0x0xoox("514161022e0f2b1f270467", 19), o00xxox0x0xoox("51416102360e2d0f3152", 19), o00xxox0x0xoox("510061433c5f3d48", 82), o00xxox0x0xoox("515e611d2701304c", 12), o00xxox0x0xoox("516c612f3521246a", 62), o00xxox0x0xoox("51166155225d2e402f1b", 68), o00xxox0x0xoox("516661252229312d22242266", 52), o00xxox0x0xoox("5138617b2370213b", 106), o00xxox0x0xoox("512061632b682b71", 114), o00xxox0x0xoox("5124616720662b73376a3137", 118), o00xxox0x0xoox("511f615c22542e47211c", 77), o00xxox0x0xoox("5138617b277a3d6c3671203a", 106), o00xxox0x0xoox("517a61393e213c3f67", 40), o00xxox0x0xoox("517b613838263f2f2c3e2a356c", 41), o00xxox0x0xoox("512e616d226f39742469276468", 124), o00xxox0x0xoox("51582318380f33077c", 11), o00xxox0x0xoox("512361603b7734", 113), o00xxox0x0xoox("512061633f6124723b39", 114), o00xxox0x0xoox("5139617a3c643077366a2c7823", 107), o00xxox0x0xoox("51116152355d291a", 67), o00xxox0x0xoox("5162612128343f3434352926262f2464", 48), o00xxox0x0xoox("515f611c2a0f3904201629166b", 13), o00xxox0x0xoox("516b61283e303c2e67", 57), o00xxox0x0xoox("5155611629023e02360a7d", 7), o00xxox0x0xoox("513161722e60286675", 99), o00xxox0x0xoox("517061333d2439213f2c297b", 34), o00xxox0x0xoox("510561462c4d25422c4d2b4c2205", 87), o00xxox0x0xoox("516461272c2b2c303d3e78", 54), o00xxox0x0xoox("513361702e7c2a722233", 97), o00xxox0x0xoox("51506113221b23162b033a0d7f", 2)};
String[] strArr2 = {o00xxox0x0xoox("1c3e203020", 45)};
String[] strArr3 = {o00xxox0x0xoox("71004e0c4b307e3b7728622025", 117)};
Hashtable hashtable2 = new Hashtable();
String str3 = null;
int i = 0;
while (true) {
if (!it.hasNext()) {
break;
}
Object next = it.next();
if (next instanceof ResolveInfo) {
applicationInfo = ((ResolveInfo) next).activityInfo.applicationInfo;
str = ((ResolveInfo) next).activityInfo.packageName;
} else {
str = str3;
applicationInfo = null;
}
if (next instanceof PackageInfo) {
applicationInfo = ((PackageInfo) next).applicationInfo;
str = applicationInfo.packageName;
}
if ((applicationInfo.flags & 1) > 0) {
int length = strArr.length;
int i2 = 0;
while (true) {
if (i2 >= length) {
z2 = false;
break;
}
String str4 = strArr[i2];
if (str.startsWith(str4)) {
String str5 = (String) hashtable2.get(str4);
if (str5 == null) {
hashtable2.put(str4, o00xxox0x0xoox("03", 27));
} else {
hashtable2.put(str4, Integer.toString(Integer.parseInt(str5) + 1));
}
z2 = true;
} else {
i2++;
}
}
int length2 = strArr2.length;
int i3 = 0;
while (true) {
if (i3 >= length2) {
break;
} else if (str.endsWith(strArr2[i3])) {
z2 = true;
break;
} else {
i3++;
}
}
if (z2 || o00xxox0x0xoox("531e6b08760e7b", 79).equals(str)) {
str3 = str;
}
}
if ((applicationInfo.flags & 1) <= 0) {
int length3 = strArr3.length;
int i4 = 0;
while (true) {
if (i4 >= length3) {
z = false;
break;
} else if (str.startsWith(strArr3[i4])) {
z = true;
break;
} else {
i4++;
}
}
if (!z) {
if (i < 20) {
str2 = packageManager.getApplicationLabel(applicationInfo).toString();
} else {
str2 = o00xxox0x0xoox("1f", 122);
}
i++;
if (i > 100) {
break;
}
if (sb.length() > 0) {
sb.append(o00xxox0x0xoox("1e", 43));
}
sb.append(str + o00xxox0x0xoox("08", 4) + str2);
if (sb2.length() > 0) {
sb2.append(o00xxox0x0xoox("1e", 53));
}
sb2.append(str);
sb2.append(o00xxox0x0xoox("08", 105));
sb2.append(str2);
}
}
str3 = str;
}
for (String str6 : hashtable2.keySet()) {
if (Integer.parseInt((String) hashtable2.get(str6)) > 5) {
if (sb.length() > 0) {
sb.append(o00xxox0x0xoox("1e", 16));
}
sb.append(str6 + o00xxox0x0xoox("18", 119) + ((String) hashtable2.get(str6)));
}
}
hashtable = new Hashtable();
hashtable.put(o00xxox0x0xoox("517961647d6d6c7c", 43), sb.toString());
hashtable.put(o00xxox0x0xoox("56316c33772e712f", 110), sb2.toString());
}
return hashtable;
}
public static String o00xxox0x0xoox(Context context, ActivityManager activityManager) {
if (!xoo0xoo0oxo00x0o0.o00xxox0x0xoox(context, "android.permission.GET_TASKS")) {
return o00xxox0x0xoox("5f7e777e5b51464f", 36);
}
StringBuilder sb = new StringBuilder();
for (ActivityManager.RunningTaskInfo runningTaskInfo : activityManager.getRunningTasks(Integer.MAX_VALUE)) {
String packageName = runningTaskInfo.baseActivity.getPackageName();
if (sb.length() > 0) {
sb.append(o00xxox0x0xoox("1e", 40));
}
sb.append(packageName);
}
return sb.toString();
}
public static String o00xxox0x0xoox(String str, int i) {
try {
int length = str.length() / 2;
char[] charArray = str.toCharArray();
byte[] bArr = new byte[length];
for (int i2 = 0; i2 < length; i2++) {
int i3 = i2 * 2;
bArr[i2] = (byte) ("0123456789abcdef".indexOf(charArray[i3 + 1]) | ("0123456789abcdef".indexOf(charArray[i3]) << 4));
}
byte b2 = (byte) (i ^ 94);
int length2 = bArr.length;
bArr[0] = (byte) (bArr[0] ^ 50);
byte b3 = bArr[0];
int i4 = 1;
while (i4 < length2) {
byte b4 = bArr[i4];
bArr[i4] = (byte) ((b3 ^ bArr[i4]) ^ b2);
i4++;
b3 = b4;
}
return new String(bArr, "utf-8");
} catch (Exception e2) {
e2.printStackTrace();
return null;
}
}
}
| [
"noiz354@gmail.com"
] | noiz354@gmail.com |
ce3ca453ae8161d2eced5c4481324d6ac714e6e2 | ae850da1f683f5c58a8aa487b1fb41598a14c7f1 | /researchers/src/main/java/com/platform/researchers/controllers/UserController.java | 9cf59e7c1e726e6ff8cab91e58dd441d6546968b | [] | no_license | Roberto-GH/researchers_platform | 37475aae13b6ee369f5d9ed36370f5406782da36 | bfae9ac4f2580d08665ac4d1ed4122cbeeaf0454 | refs/heads/main | 2023-08-18T16:41:30.621657 | 2021-10-19T15:56:49 | 2021-10-19T15:56:49 | 410,172,683 | 0 | 0 | null | 2021-10-05T01:54:08 | 2021-09-25T04:15:02 | Java | UTF-8 | Java | false | false | 2,677 | java | package com.platform.researchers.controllers;
import com.platform.researchers.dtos.userdto.UserAuthRequestDto;
import com.platform.researchers.dtos.userdto.UserAuthResponseDto;
import com.platform.researchers.dtos.userdto.UserRequestDto;
import com.platform.researchers.dtos.userdto.UserResponseDto;
import com.platform.researchers.modelmappers.UserModelMapper;
import com.platform.researchers.services.UserService;
import com.platform.researchers.utils.JWTUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@RestController
@CrossOrigin(origins = "*", methods = {RequestMethod.GET, RequestMethod.POST, RequestMethod.PUT, RequestMethod.DELETE})
@RequestMapping("/api")
public class UserController {
public static final String API = "/api";
public static final String USERS = "/users";
public static final String AUTH = "/auth";
public static final String ID_ID = "/{_id}";
@Autowired
private UserService userService;
@Autowired
private UserModelMapper userModelMapper;
@Autowired
private JWTUtil jwtUtil;
@GetMapping("/users")
public List<UserResponseDto> findAll(){
List<UserResponseDto> userResponseDtos = userService.findAll();
return userResponseDtos;
}
@GetMapping(USERS+ID_ID)
public UserResponseDto findById(@PathVariable String _id) {
UserResponseDto userResponseDto = userService.findById(_id);
return userResponseDto;
}
@PostMapping(USERS)
public UserResponseDto createUser(@RequestBody UserRequestDto userDto){
UserResponseDto userResponseDto = userService.createUser(userDto);
return userResponseDto;
}
@PostMapping(USERS+AUTH)
public ResponseEntity<?> verifyAuth(@RequestBody UserAuthRequestDto userAuthDto){
UserResponseDto userResponseDto = userService.verifyAuth(userAuthDto);
if (Objects.isNull(userResponseDto)){
Map<String, String> jsonResponse = new HashMap<>();
jsonResponse.put("error", "Usuario o contraseña incorrecto");
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(jsonResponse);
}
String tokenJwt = jwtUtil.create(userResponseDto.get_id(),userResponseDto.getEmail());
UserAuthResponseDto userAuthResponseDto = userModelMapper.userDtoToAuthResponseDtoMapper(userResponseDto);
return ResponseEntity.status(HttpStatus.OK).header("Authorization", "Bearer "+tokenJwt).body(userAuthResponseDto);
}
}
| [
"roberthdrums@gmail.com"
] | roberthdrums@gmail.com |
e9113349965ef4f7f9393788c9b68daa1aeece74 | 4f887833d997122cc7fb0df6ea82148c3dccd46e | /app/src/main/java/com/yangrufeng/mud/mudserver/entity/Player.java | c9676532abe16de866b0742e0d98f1f8abb1fbf3 | [] | no_license | yangrufeng/MudServer | 679dd475e6ec332920b00fb2b798d2c0081a2b5a | e56f0576fbaad73a29267dbe09987751d305dea4 | refs/heads/master | 2020-04-22T02:36:57.256200 | 2019-02-11T02:55:02 | 2019-02-11T02:55:02 | 170,056,532 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,581 | java | package com.yangrufeng.mud.mudserver.entity;
import com.yangrufeng.mud.mudserver.common.Common;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.HashMap;
import java.util.Map;
/**
* Created by pc on 2018/11/11.
*/
public class Player {
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getCon() {
return con;
}
public void setCon(int con) {
this.con = con;
}
public int getDex() {
return dex;
}
public void setDex(int dex) {
this.dex = dex;
}
public int getHungry() {
return hungry;
}
public void setHungry(int hungry) {
this.hungry = hungry;
}
public int getStr() {
return str;
}
public void setStr(int str) {
this.str = str;
}
public int getCost_while_sleep() {
return cost_while_sleep;
}
public void setCost_while_sleep(int cost_while_sleep) {
this.cost_while_sleep = cost_while_sleep;
}
public float getPhysical_injury_percent() {
return physical_injury_percent;
}
public void setPhysical_injury_percent(float physical_injury_percent) {
this.physical_injury_percent = physical_injury_percent;
}
public float getDrug_effect_percent() {
return drug_effect_percent;
}
public void setDrug_effect_percent(float drug_effect_percent) {
this.drug_effect_percent = drug_effect_percent;
}
public float getNpc_favor_percent() {
return npc_favor_percent;
}
public void setNpc_favor_percent(float npc_favor_percent) {
this.npc_favor_percent = npc_favor_percent;
}
public float getThreat_from_a_warrior() {
return threat_from_a_warrior;
}
public void setThreat_from_a_warrior(float threat_from_a_warrior) {
this.threat_from_a_warrior = threat_from_a_warrior;
}
public String getDes() {
return des;
}
public void setDes(String des) {
this.des = des;
}
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
private String ip;
private String name; // 姓名(【昵称|角色名】)
private int con; // 体质(生命)
private int maxcon; // 最大体质(生命)
public int getMaxhungry() {
return maxhungry;
}
public void setMaxhungry(int maxhungry) {
this.maxhungry = maxhungry;
}
private int maxhungry; // 最大饥饿值
private int dex; // 敏捷(行动速度)
public int getMaxcon() {
return maxcon;
}
public void setMaxcon(int maxcon) {
this.maxcon = maxcon;
}
private int hungry; // 饥饿值(行动力)
private int str; // 力量(攻击力)
private String des; // 描述
private int cost_while_sleep = 5; // 休息时消耗饥饿值(默认休息消耗5)
private float physical_injury_percent = 1; // 物理伤害百分比(默认100%)
private float drug_effect_percent = 1; // 使用回复类药物效果(默认100%)
private float npc_favor_percent = 1; // NPC好感度增长效果(默认100%)
private float threat_from_a_warrior = 0; // 怪物的仇恨值(默认0)
public Place getPosition() {
return position;
}
public void setPosition(Place position) {
this.position = position;
}
private Place position;
public Map<String, Task> getAcceptedTask() {
return acceptedTask;
}
public void setAcceptedTask(Map<String, Task> acceptedTask) {
this.acceptedTask = acceptedTask;
}
private Map<String,Task> acceptedTask = new HashMap<String,Task>(); // 接受的任务
public Map<String,Thing> getOwnThings() {
return ownThings;
}
public void setOwnThings(Map<String,Thing> ownThings) {
this.ownThings = ownThings;
}
private Map<String,Thing> ownThings = new HashMap<String,Thing>(); // 拥有的物品
public JSONObject toJSONObject() throws JSONException {
JSONObject o = new JSONObject();
o.put(Common.JSON_ID,this.ip);
o.put(Common.JSON_NAME,this.name);
o.put(Common.JSON_CON,this.con);
o.put(Common.JSON_DEX,this.dex);
o.put(Common.JSON_STR,this.str);
o.put(Common.JSON_HUNGRY,this.hungry);
o.put(Common.JSON_DESC,this.des);
o.put(Common.JSON_POSITION,this.position.getId());
return o;
}
}
| [
"251814590@163.com"
] | 251814590@163.com |
db0b48f664ec6a00b3a65183cae7e6d9a0f6cbb6 | 80cba38462cfdcda3bc0c5b31fcc25347c2ab3a3 | /app/src/main/java/com/android/beautifulthing/MagazineFragment/bean/MagazineDetailBean.java | 45de460f56c3ede4de6dc3169df254d66a3a85f5 | [] | no_license | zs811128838/BeautifulDiscovery | 202bdfd278c525a72678ffda29d6eb7dbf1710c0 | 8a37b93a0a0c8b3cf75e18829fa15653ed3fd8c0 | refs/heads/master | 2020-12-25T14:48:42.354326 | 2016-09-20T07:23:20 | 2016-09-20T07:23:20 | 67,427,937 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 40,219 | java | package com.android.beautifulthing.MagazineFragment.bean;
import java.util.List;
/**
* Created by keshanpu on 16/9/11.
*/
public class MagazineDetailBean {
/**
* refer_products : [{"name":"KISS","cover_images":["http://dstatic.zuimeia.com/product/pic/2016/6/12/50dbc84b-9072-4035-8ba8-2ad043c89588_800x530.jpeg"],"mark_user_num":4,"images":["http://dstatic.zuimeia.com/product/pic/2016/6/12/50dbc84b-9072-4035-8ba8-2ad043c89588_800x530.jpeg"],"publish_at":1469635200000,"id":545},{"name":"ESSENTIALS PACKAGE","cover_images":["http://dstatic.zuimeia.com/product/pic/2016/6/12/1c187c28-28fa-4696-ae11-665a0f38519a_800x530.jpeg"],"mark_user_num":5,"images":["http://dstatic.zuimeia.com/product/pic/2016/6/12/1c187c28-28fa-4696-ae11-665a0f38519a_800x530.jpeg"],"publish_at":1469635200000,"id":543},{"name":"BRIGHT","cover_images":["http://dstatic.zuimeia.com/product/pic/2016/6/12/e2f04105-aace-4929-998d-342b57d3cebd_800x530.jpeg"],"mark_user_num":5,"images":["http://dstatic.zuimeia.com/product/pic/2016/6/12/e2f04105-aace-4929-998d-342b57d3cebd_800x530.jpeg"],"publish_at":1469635200000,"id":542},{"name":"BEHAVE","cover_images":["http://dstatic.zuimeia.com/product/pic/2016/6/12/971d475c-49cd-437e-b357-b61deffb1b65_800x530.jpeg"],"mark_user_num":5,"images":["http://dstatic.zuimeia.com/product/pic/2016/6/12/971d475c-49cd-437e-b357-b61deffb1b65_800x530.jpeg"],"publish_at":1469635200000,"id":541}]
* title : Kate Poole: 一个制作精油的「炼金术师」
* comment_num : 15
* author : {"username":"狐萝卜","avatar_url":"http://dstatic.zuimeia.com/user/avatar/2016/08/27/d17e6a982c677b1e4b35726af80d6a50_254x255.jpg","id":30,"sign":"在光怪陆离的世界里记录时尚的梦旅人"}
* sub_title : 万物的精髓就是平衡
* favor_user_num : 38
* comments : [{"content":"啊哈","created_at":1473697414000,"id":3855,"author":{"username":"🐱猫大圣 \u200d🤖️微信机器人","avatar_url":"http://wx.qlogo.cn/mmopen/B8HPPaibicsOy2JQ2OAwhoHCsD7l03jG5Z7cJic6FjN80UIpy40UbBFMIenMZhkXy8eQdJI8auXdHD1x4bHcrnpf6Stu9IEIFWy/0","id":54372,"sign":"遇见最美的自己"}},{"content":"非常喜欢","created_at":1473572689000,"id":3791,"author":{"username":"莹徽","avatar_url":"http://wx.qlogo.cn/mmopen/OADFJvKicONvbeTTa3J4LPKjiaAdxFmNRHRa3HrUTYEt8DANBAUKWKfZUoxkkOkPpjialGSpOVtFIv9gUTGr8hQASswqGSLNGkd/0","id":47108,"sign":"遇见最美的自己"}},{"content":"精油对于女性来说是皮肤的必需品,所以选择什么样的精油还有什么样的味道还有达到的效果是非常重要的","created_at":1473244040000,"id":3625,"author":{"username":"Each other","avatar_url":"http://q.qlogo.cn/qqapp/1105321739/51754E00721417190B519082FFD459AC/100","id":52087,"sign":"遇见最美的自己"}},{"content":"666","created_at":1473200199000,"id":3606,"author":{"username":"萌,Miss you!","avatar_url":"http://dstatic.zuimeia.com/user/avatar/2016/9/7/7b08031a-391a-4178-9c28-8bdcec3ef9ac.jpg","id":51812,"sign":"遇见最美的自己"}},{"content":"就像是制香一样","created_at":1473051646000,"id":3561,"author":{"username":"我看看就好","avatar_url":"http://q.qlogo.cn/qqapp/1105321739/C70B78FE5A3342B859EA135D33BE0521/100","id":51204,"sign":"遇见最美的自己"}},{"content":"喜欢,确实很好。","created_at":1472960278000,"id":3539,"author":{"username":"心动。🐳","avatar_url":"http://q.qlogo.cn/qqapp/1105321739/A2AB206A95AC25E7AE13B1C2976D4731/100","id":50554,"sign":"遇见最美的自己"}},{"content":"是哒😂 神迷钢炼~","created_at":1472874180000,"parent_comment":{"content":"一看就是钢炼看多了。。","created_at":1472863506000,"id":3502,"author":{"username":"冰之神域","avatar_url":"http://q.qlogo.cn/qqapp/1105321739/5B06AD44376CB846CD4FC76E5515ADDF/100","id":33310,"sign":"遇见最美的自己"}},"id":3506,"author":{"username":"狐萝卜","avatar_url":"http://dstatic.zuimeia.com/user/avatar/2016/08/27/d17e6a982c677b1e4b35726af80d6a50_254x255.jpg","id":30,"sign":"在光怪陆离的世界里记录时尚的梦旅人"}},{"content":"一看就是钢炼看多了。。","created_at":1472863506000,"id":3502,"author":{"username":"冰之神域","avatar_url":"http://q.qlogo.cn/qqapp/1105321739/5B06AD44376CB846CD4FC76E5515ADDF/100","id":33310,"sign":"遇见最美的自己"}},{"content":"不错","created_at":1472784654000,"id":3480,"author":{"username":" nothing`","avatar_url":"http://dstatic.zuimeia.com/user/avatar/2016/9/13/2900e187-d124-4cf9-b6ff-3ca62ab47bf0.jpg","id":11,"sign":"遇见最美的自己"}},{"content":"精油是好东西,如果皮肤烂了不能用怎么办?","created_at":1472735708000,"id":3474,"author":{"username":"hoogestudio","avatar_url":"http://q.qlogo.cn/qqapp/1105321739/B3DC48BDCBF7EA620C65718D2D00D978/100","id":37101,"sign":"遇见最美的自己"}}]
* content : <p>曾经一度迷恋《钢之炼金术师》这部动漫,在那个充斥着各种超能炼金师的二次元世界里,只要了解物质的内在规律,遵循等价交换原则,就可以通过分解再次构造出你想要的东西。</p><p>而在现实的西方世界里,仍旧存在着这样的一群隐秘的炼金术士,不过,他们潜心修行,炼制法则的初衷,不再是为了追求虚无缥缈的长生不死的「黄金之药」,而是为了在人与自然间搭起桥梁。在物我相融间,找到一种完美的平衡。</p><p><img src="http://dstatic.zuimeia.com/media/article/image/2016/8/31/9d07d230-cb35-4aa7-82bc-8dce51a18883_800x313.jpeg"/></p><p><!--?xml version="1.0" encoding="UTF-8" standalone="no"?-->我猜,今天所要谈及的 Kate Poole 的心里应该很早就藏着一个炼金师的梦吧。一个肯把自己品牌取名为:「Essential Apothecary(药剂师)Alchemist(炼金士)」的医学药剂师,很难不让人把她的特殊身份和喜好联系在一起。儿时对于各种植物草药的喜欢,让她迷醉在自然的神秘世界;而成年后的她,却又通过不断的努力,从她热爱的世界里萃取出各种植物的芬芳。因此,在 Kate 的精油配方里,你不但可以嗅出追求梦想的热切,还有着对于自然本身深深的依恋。</p><p><img src="http://dstatic.zuimeia.com/media/article/image/2016/8/31/defb29e3-2b89-4e40-b3d1-97201d14c5de_800x313.jpeg"/></p><p><!--?xml version="1.0" encoding="UTF-8" standalone="no"?-->Kate 从小就把自己视作野孩子,山间林野就是她的家。生长在西雅图附近的小镇,不仅为她的童年除去了不必要的喧嚣,也在她的心里种下了亲近自然的花花草草。逐渐长大的 Kate 的喜好之一就是收集各种各样的植物标本。而早在她开始记事起,Kate 就在不断尝试将各种植物捣制成药。自然成了她隐秘的巨大宝库,而她在这里可以轻易的自给自足。</p><p><img src="http://dstatic.zuimeia.com/media/article/image/2016/8/31/1baece93-cc28-4b5e-bdaa-6b87568569a5_800x313.jpeg"/></p><p>高中的时候,Kate 接触到了 Jethro Klass 和 Dr. Christoper's(他们都是美国草药学的传奇先驱)的学术理论,并开始研制药膏,医治家人。不同于儿时浅显的尝试和摸索,现在的她有了更为完整全面的理论指导。只是那时候的她并不能明确自己所追寻的方向。70 年代 Jeanne Rose(芳香疗法的业界权威)的草药身体书的出现,让 Kate 找到了真正的心有所属,并从此踏上了寻求纯天然植物皮肤护理之路。 而真正让 Kate 爱上精油,并且深陷其中的,还要等她八十年代初遇见「梦想导师」Gabriel Moray 了(自然医学界的泰斗的徒弟)。</p><p><img src="http://dstatic.zuimeia.com/media/article/image/2016/8/31/2d2d2f52-75eb-4cfe-9440-7b8f0278af32_800x313.jpeg"/></p><p><!--?xml version="1.0" encoding="UTF-8" standalone="no"?-->Kate 曾经说过:「纯精油更像是一种维持身体平衡状态的内在智慧,这是炼金术的本质,也是我配方的核心。」 就像《钢之炼金术师》里的等价交换原则,炼金的过程需要以同等的代价交换,代价不够的话便需要以自己的任何部份(身体的一部分、记忆等等)被作为代价的填补而被拿走,这就是一种平衡的精神。</p><p><img src="http://dstatic.zuimeia.com/media/article/image/2016/8/31/accbf0a9-c64d-4b0f-84bd-4e9b6fd49d39_800x588.jpeg"/></p><p><!--?xml version="1.0" encoding="UTF-8" standalone="no"?-->说到精油护理,总难免不会谈及到精油本身的功效,而在 Kate 的心里,不掺杂杂质的纯正精油才是对健康大有裨益的。如除去身体毒素,使皮肤更平滑,具有抗菌性,抗炎症。不仅如此,还能通过调节身体的生理系统来改善心情。如此看来,虽然时代在不停更迭,但这些神秘的炼金师却依旧拥有着化腐朽为神奇的功力。</p><p><img src="http://dstatic.zuimeia.com/media/article/image/2016/8/31/03caeacf-48d3-43ed-9923-93945d9ae79b_800x559.jpeg"/></p><p>后来 Kate Poole 创立了自己的精油品牌:Essential Apothecary Alchemists 。产品分为精油,脸部,头发,香水四个系列。 </p><p><img src="http://dstatic.zuimeia.com/media/article/image/2016/8/31/ed3a8841-90b1-43b1-9e33-3fc7f6051725_640x640.jpeg"/></p><p><!--?xml version="1.0" encoding="UTF-8" standalone="no"?-->「Behave」是精油系列的护发精油,主要是用来柔顺不安分乱糟糟的头发们。100%有机配方,用最高品质的精油来滋养头发,在使用 Behave 之前不妨用蜂蜡来打底,让掌心变得温暖,精油就能快速的渗透到头发根部。</p><p><img src="http://dstatic.zuimeia.com/media/article/image/2016/8/31/3d385b46-16f1-4f7f-b161-f33b88db526f_640x640.jpeg"/></p><p><!--?xml version="1.0" encoding="UTF-8" standalone="no"?-->「Bright」则是用来清洁牙龈和牙齿的。牙齿的多孔性意味着细菌很轻易得就能入侵。刷牙的时候用Bright 轻柔地去掉牙垢,清除口腔内造成牙龈感染的细菌。这款精油同样也能缓解疼痛,清新口气,治愈表皮组织。</p><p><img src="http://dstatic.zuimeia.com/media/article/image/2016/8/31/f501a142-5f10-42e3-8163-4d595facc804_640x640.jpeg"/></p><p><!--?xml version="1.0" encoding="UTF-8" standalone="no"?-->「YPARX」是香水系列的款产品,香根草, 小豆蔻,香柏,烟草中是它的主要成分。古代的香料和烟草赋予了 YPARX 浓烈有力的香味。</p><p><img src="http://dstatic.zuimeia.com/media/article/image/2016/8/31/534c000e-d98c-4dea-a39d-ebe066c47e07_795x795.jpeg"/></p><p><!--?xml version="1.0" encoding="UTF-8" standalone="no"?--></p><p>对我而言,所谓的炼金术,更像是 Kate 与大自然的相处之道。一方面心里那个年幼的她还在孜孜不倦的探求着自然世界里的无穷无尽,而另一方面,那个成人世界里的她,也不断地通过自己的方式萃取出自然与人类间的联系。Kate 所为我们描绘出的自然永远是一份崭新的光景:除了对于大自然本身的热爱外,你还能透过这位善良的信使,听到大自然所传递给人类的所有福音。</p><p><!--?xml version="1.0" encoding="UTF-8" standalone="no"?-->除特别注明外,图片均来自 Essential Apothecary Alchemists 官网和 @essentialapothecary in Instagram</p>
* web_url : http://design.zuimeia.com/article/68/
* image_url : http://dstatic.zuimeia.com/common/image/2016/8/31/813cf0ce-0770-4a8e-b69a-fc50a0ad9db4_839x839.jpeg
* like_user_num : 200
* publish_at : 1472614440000
* designers : [{"city":"西雅图","concept":"维持内在身体的平衡是一件充满智慧的事","name":"Kate Poole","label":"Essential Apothecary Alchemist 创始人","avatar_url":"http://dstatic.zuimeia.com/designer/avatar/2016/6/18/4b003d3c-1f3e-4593-833b-0e20f72d527c.jpg","id":30,"categories":[{"id":13,"name":"实用"},{"id":24,"name":"西雅图"},{"id":26,"name":"其他"},{"id":30,"name":"独立设计师"}],"description":"Kate 在热爱野外大自然的家庭长大,从小就喜欢到处逛游和搜集野外的自然草药。在高中的时候,Kate 研究了 Jethro Klass and Dr. Christoper 的作品,开始自己制作和烧制药膏,甚至会尝试为朋友和家人\u201c医治\u201d 小病。后来,Kate 爱上了精油,因为其健康的特效和美好的香薰味道。Kate 创办了自己的精油品牌: Essential Apothecary Alchemist。"}]
* id : 68
* refer_articles : []
*/
private DataBean data;
/**
* data : {"refer_products":[{"name":"KISS","cover_images":["http://dstatic.zuimeia.com/product/pic/2016/6/12/50dbc84b-9072-4035-8ba8-2ad043c89588_800x530.jpeg"],"mark_user_num":4,"images":["http://dstatic.zuimeia.com/product/pic/2016/6/12/50dbc84b-9072-4035-8ba8-2ad043c89588_800x530.jpeg"],"publish_at":1469635200000,"id":545},{"name":"ESSENTIALS PACKAGE","cover_images":["http://dstatic.zuimeia.com/product/pic/2016/6/12/1c187c28-28fa-4696-ae11-665a0f38519a_800x530.jpeg"],"mark_user_num":5,"images":["http://dstatic.zuimeia.com/product/pic/2016/6/12/1c187c28-28fa-4696-ae11-665a0f38519a_800x530.jpeg"],"publish_at":1469635200000,"id":543},{"name":"BRIGHT","cover_images":["http://dstatic.zuimeia.com/product/pic/2016/6/12/e2f04105-aace-4929-998d-342b57d3cebd_800x530.jpeg"],"mark_user_num":5,"images":["http://dstatic.zuimeia.com/product/pic/2016/6/12/e2f04105-aace-4929-998d-342b57d3cebd_800x530.jpeg"],"publish_at":1469635200000,"id":542},{"name":"BEHAVE","cover_images":["http://dstatic.zuimeia.com/product/pic/2016/6/12/971d475c-49cd-437e-b357-b61deffb1b65_800x530.jpeg"],"mark_user_num":5,"images":["http://dstatic.zuimeia.com/product/pic/2016/6/12/971d475c-49cd-437e-b357-b61deffb1b65_800x530.jpeg"],"publish_at":1469635200000,"id":541}],"title":"Kate Poole: 一个制作精油的「炼金术师」","comment_num":15,"author":{"username":"狐萝卜","avatar_url":"http://dstatic.zuimeia.com/user/avatar/2016/08/27/d17e6a982c677b1e4b35726af80d6a50_254x255.jpg","id":30,"sign":"在光怪陆离的世界里记录时尚的梦旅人"},"sub_title":"万物的精髓就是平衡","favor_user_num":38,"comments":[{"content":"啊哈","created_at":1473697414000,"id":3855,"author":{"username":"🐱猫大圣 \u200d🤖️微信机器人","avatar_url":"http://wx.qlogo.cn/mmopen/B8HPPaibicsOy2JQ2OAwhoHCsD7l03jG5Z7cJic6FjN80UIpy40UbBFMIenMZhkXy8eQdJI8auXdHD1x4bHcrnpf6Stu9IEIFWy/0","id":54372,"sign":"遇见最美的自己"}},{"content":"非常喜欢","created_at":1473572689000,"id":3791,"author":{"username":"莹徽","avatar_url":"http://wx.qlogo.cn/mmopen/OADFJvKicONvbeTTa3J4LPKjiaAdxFmNRHRa3HrUTYEt8DANBAUKWKfZUoxkkOkPpjialGSpOVtFIv9gUTGr8hQASswqGSLNGkd/0","id":47108,"sign":"遇见最美的自己"}},{"content":"精油对于女性来说是皮肤的必需品,所以选择什么样的精油还有什么样的味道还有达到的效果是非常重要的","created_at":1473244040000,"id":3625,"author":{"username":"Each other","avatar_url":"http://q.qlogo.cn/qqapp/1105321739/51754E00721417190B519082FFD459AC/100","id":52087,"sign":"遇见最美的自己"}},{"content":"666","created_at":1473200199000,"id":3606,"author":{"username":"萌,Miss you!","avatar_url":"http://dstatic.zuimeia.com/user/avatar/2016/9/7/7b08031a-391a-4178-9c28-8bdcec3ef9ac.jpg","id":51812,"sign":"遇见最美的自己"}},{"content":"就像是制香一样","created_at":1473051646000,"id":3561,"author":{"username":"我看看就好","avatar_url":"http://q.qlogo.cn/qqapp/1105321739/C70B78FE5A3342B859EA135D33BE0521/100","id":51204,"sign":"遇见最美的自己"}},{"content":"喜欢,确实很好。","created_at":1472960278000,"id":3539,"author":{"username":"心动。🐳","avatar_url":"http://q.qlogo.cn/qqapp/1105321739/A2AB206A95AC25E7AE13B1C2976D4731/100","id":50554,"sign":"遇见最美的自己"}},{"content":"是哒😂 神迷钢炼~","created_at":1472874180000,"parent_comment":{"content":"一看就是钢炼看多了。。","created_at":1472863506000,"id":3502,"author":{"username":"冰之神域","avatar_url":"http://q.qlogo.cn/qqapp/1105321739/5B06AD44376CB846CD4FC76E5515ADDF/100","id":33310,"sign":"遇见最美的自己"}},"id":3506,"author":{"username":"狐萝卜","avatar_url":"http://dstatic.zuimeia.com/user/avatar/2016/08/27/d17e6a982c677b1e4b35726af80d6a50_254x255.jpg","id":30,"sign":"在光怪陆离的世界里记录时尚的梦旅人"}},{"content":"一看就是钢炼看多了。。","created_at":1472863506000,"id":3502,"author":{"username":"冰之神域","avatar_url":"http://q.qlogo.cn/qqapp/1105321739/5B06AD44376CB846CD4FC76E5515ADDF/100","id":33310,"sign":"遇见最美的自己"}},{"content":"不错","created_at":1472784654000,"id":3480,"author":{"username":" nothing`","avatar_url":"http://dstatic.zuimeia.com/user/avatar/2016/9/13/2900e187-d124-4cf9-b6ff-3ca62ab47bf0.jpg","id":11,"sign":"遇见最美的自己"}},{"content":"精油是好东西,如果皮肤烂了不能用怎么办?","created_at":1472735708000,"id":3474,"author":{"username":"hoogestudio","avatar_url":"http://q.qlogo.cn/qqapp/1105321739/B3DC48BDCBF7EA620C65718D2D00D978/100","id":37101,"sign":"遇见最美的自己"}}],"content":"<p>曾经一度迷恋《钢之炼金术师》这部动漫,在那个充斥着各种超能炼金师的二次元世界里,只要了解物质的内在规律,遵循等价交换原则,就可以通过分解再次构造出你想要的东西。<\/p><p>而在现实的西方世界里,仍旧存在着这样的一群隐秘的炼金术士,不过,他们潜心修行,炼制法则的初衷,不再是为了追求虚无缥缈的长生不死的「黄金之药」,而是为了在人与自然间搭起桥梁。在物我相融间,找到一种完美的平衡。<\/p><p><img src=\"http://dstatic.zuimeia.com/media/article/image/2016/8/31/9d07d230-cb35-4aa7-82bc-8dce51a18883_800x313.jpeg\"/><\/p><p><!--?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?-->我猜,今天所要谈及的 Kate Poole 的心里应该很早就藏着一个炼金师的梦吧。一个肯把自己品牌取名为:「Essential Apothecary(药剂师)Alchemist(炼金士)」的医学药剂师,很难不让人把她的特殊身份和喜好联系在一起。儿时对于各种植物草药的喜欢,让她迷醉在自然的神秘世界;而成年后的她,却又通过不断的努力,从她热爱的世界里萃取出各种植物的芬芳。因此,在 Kate 的精油配方里,你不但可以嗅出追求梦想的热切,还有着对于自然本身深深的依恋。<\/p><p><img src=\"http://dstatic.zuimeia.com/media/article/image/2016/8/31/defb29e3-2b89-4e40-b3d1-97201d14c5de_800x313.jpeg\"/><\/p><p><!--?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?-->Kate 从小就把自己视作野孩子,山间林野就是她的家。生长在西雅图附近的小镇,不仅为她的童年除去了不必要的喧嚣,也在她的心里种下了亲近自然的花花草草。逐渐长大的 Kate 的喜好之一就是收集各种各样的植物标本。而早在她开始记事起,Kate 就在不断尝试将各种植物捣制成药。自然成了她隐秘的巨大宝库,而她在这里可以轻易的自给自足。<\/p><p><img src=\"http://dstatic.zuimeia.com/media/article/image/2016/8/31/1baece93-cc28-4b5e-bdaa-6b87568569a5_800x313.jpeg\"/><\/p><p>高中的时候,Kate 接触到了 Jethro Klass 和 Dr. Christoper's(他们都是美国草药学的传奇先驱)的学术理论,并开始研制药膏,医治家人。不同于儿时浅显的尝试和摸索,现在的她有了更为完整全面的理论指导。只是那时候的她并不能明确自己所追寻的方向。70 年代 Jeanne Rose(芳香疗法的业界权威)的草药身体书的出现,让 Kate 找到了真正的心有所属,并从此踏上了寻求纯天然植物皮肤护理之路。 而真正让 Kate 爱上精油,并且深陷其中的,还要等她八十年代初遇见「梦想导师」Gabriel Moray 了(自然医学界的泰斗的徒弟)。<\/p><p><img src=\"http://dstatic.zuimeia.com/media/article/image/2016/8/31/2d2d2f52-75eb-4cfe-9440-7b8f0278af32_800x313.jpeg\"/><\/p><p><!--?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?-->Kate 曾经说过:「纯精油更像是一种维持身体平衡状态的内在智慧,这是炼金术的本质,也是我配方的核心。」 就像《钢之炼金术师》里的等价交换原则,炼金的过程需要以同等的代价交换,代价不够的话便需要以自己的任何部份(身体的一部分、记忆等等)被作为代价的填补而被拿走,这就是一种平衡的精神。<\/p><p><img src=\"http://dstatic.zuimeia.com/media/article/image/2016/8/31/accbf0a9-c64d-4b0f-84bd-4e9b6fd49d39_800x588.jpeg\"/><\/p><p><!--?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?-->说到精油护理,总难免不会谈及到精油本身的功效,而在 Kate 的心里,不掺杂杂质的纯正精油才是对健康大有裨益的。如除去身体毒素,使皮肤更平滑,具有抗菌性,抗炎症。不仅如此,还能通过调节身体的生理系统来改善心情。如此看来,虽然时代在不停更迭,但这些神秘的炼金师却依旧拥有着化腐朽为神奇的功力。<\/p><p><img src=\"http://dstatic.zuimeia.com/media/article/image/2016/8/31/03caeacf-48d3-43ed-9923-93945d9ae79b_800x559.jpeg\"/><\/p><p>后来 Kate Poole 创立了自己的精油品牌:Essential Apothecary Alchemists 。产品分为精油,脸部,头发,香水四个系列。 <\/p><p><img src=\"http://dstatic.zuimeia.com/media/article/image/2016/8/31/ed3a8841-90b1-43b1-9e33-3fc7f6051725_640x640.jpeg\"/><\/p><p><!--?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?-->「Behave」是精油系列的护发精油,主要是用来柔顺不安分乱糟糟的头发们。100%有机配方,用最高品质的精油来滋养头发,在使用 Behave 之前不妨用蜂蜡来打底,让掌心变得温暖,精油就能快速的渗透到头发根部。<\/p><p><img src=\"http://dstatic.zuimeia.com/media/article/image/2016/8/31/3d385b46-16f1-4f7f-b161-f33b88db526f_640x640.jpeg\"/><\/p><p><!--?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?-->「Bright」则是用来清洁牙龈和牙齿的。牙齿的多孔性意味着细菌很轻易得就能入侵。刷牙的时候用Bright 轻柔地去掉牙垢,清除口腔内造成牙龈感染的细菌。这款精油同样也能缓解疼痛,清新口气,治愈表皮组织。<\/p><p><img src=\"http://dstatic.zuimeia.com/media/article/image/2016/8/31/f501a142-5f10-42e3-8163-4d595facc804_640x640.jpeg\"/><\/p><p><!--?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?-->「YPARX」是香水系列的款产品,香根草, 小豆蔻,香柏,烟草中是它的主要成分。古代的香料和烟草赋予了 YPARX 浓烈有力的香味。<\/p><p><img src=\"http://dstatic.zuimeia.com/media/article/image/2016/8/31/534c000e-d98c-4dea-a39d-ebe066c47e07_795x795.jpeg\"/><\/p><p><!--?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?--><\/p><p>对我而言,所谓的炼金术,更像是 Kate 与大自然的相处之道。一方面心里那个年幼的她还在孜孜不倦的探求着自然世界里的无穷无尽,而另一方面,那个成人世界里的她,也不断地通过自己的方式萃取出自然与人类间的联系。Kate 所为我们描绘出的自然永远是一份崭新的光景:除了对于大自然本身的热爱外,你还能透过这位善良的信使,听到大自然所传递给人类的所有福音。<\/p><p><!--?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?-->除特别注明外,图片均来自 Essential Apothecary Alchemists 官网和 @essentialapothecary in Instagram<\/p>","web_url":"http://design.zuimeia.com/article/68/","image_url":"http://dstatic.zuimeia.com/common/image/2016/8/31/813cf0ce-0770-4a8e-b69a-fc50a0ad9db4_839x839.jpeg","like_user_num":200,"publish_at":1472614440000,"designers":[{"city":"西雅图","concept":"维持内在身体的平衡是一件充满智慧的事","name":"Kate Poole","label":"Essential Apothecary Alchemist 创始人","avatar_url":"http://dstatic.zuimeia.com/designer/avatar/2016/6/18/4b003d3c-1f3e-4593-833b-0e20f72d527c.jpg","id":30,"categories":[{"id":13,"name":"实用"},{"id":24,"name":"西雅图"},{"id":26,"name":"其他"},{"id":30,"name":"独立设计师"}],"description":"Kate 在热爱野外大自然的家庭长大,从小就喜欢到处逛游和搜集野外的自然草药。在高中的时候,Kate 研究了 Jethro Klass and Dr. Christoper 的作品,开始自己制作和烧制药膏,甚至会尝试为朋友和家人\u201c医治\u201d 小病。后来,Kate 爱上了精油,因为其健康的特效和美好的香薰味道。Kate 创办了自己的精油品牌: Essential Apothecary Alchemist。"}],"id":68,"refer_articles":[]}
* result : 1
*/
private int result;
public DataBean getData() {
return data;
}
public void setData(DataBean data) {
this.data = data;
}
public int getResult() {
return result;
}
public void setResult(int result) {
this.result = result;
}
public static class DataBean {
private String title;
@Override
public String toString() {
return "DataBean{" +
"title='" + title + '\'' +
", comment_num=" + comment_num +
", author=" + author +
", sub_title='" + sub_title + '\'' +
", favor_user_num=" + favor_user_num +
", content='" + content + '\'' +
", web_url='" + web_url + '\'' +
", image_url='" + image_url + '\'' +
", like_user_num=" + like_user_num +
", publish_at=" + publish_at +
", id=" + id +
", refer_products=" + refer_products +
", comments=" + comments +
", designers=" + designers +
", refer_articles=" + refer_articles +
'}';
}
private int comment_num;
/**
* username : 狐萝卜
* avatar_url : http://dstatic.zuimeia.com/user/avatar/2016/08/27/d17e6a982c677b1e4b35726af80d6a50_254x255.jpg
* id : 30
* sign : 在光怪陆离的世界里记录时尚的梦旅人
*/
private AuthorBean author;
private String sub_title;
private int favor_user_num;
private String content;
private String web_url;
private String image_url;
private int like_user_num;
private long publish_at;
private int id;
/**
* name : KISS
* cover_images : ["http://dstatic.zuimeia.com/product/pic/2016/6/12/50dbc84b-9072-4035-8ba8-2ad043c89588_800x530.jpeg"]
* mark_user_num : 4
* images : ["http://dstatic.zuimeia.com/product/pic/2016/6/12/50dbc84b-9072-4035-8ba8-2ad043c89588_800x530.jpeg"]
* publish_at : 1469635200000
* id : 545
*/
private List<ReferProductsBean> refer_products;
/**
* content : 啊哈
* created_at : 1473697414000
* id : 3855
* author : {"username":"🐱猫大圣 \u200d🤖️微信机器人","avatar_url":"http://wx.qlogo.cn/mmopen/B8HPPaibicsOy2JQ2OAwhoHCsD7l03jG5Z7cJic6FjN80UIpy40UbBFMIenMZhkXy8eQdJI8auXdHD1x4bHcrnpf6Stu9IEIFWy/0","id":54372,"sign":"遇见最美的自己"}
*/
private List<CommentsBean> comments;
/**
* city : 西雅图
* concept : 维持内在身体的平衡是一件充满智慧的事
* name : Kate Poole
* label : Essential Apothecary Alchemist 创始人
* avatar_url : http://dstatic.zuimeia.com/designer/avatar/2016/6/18/4b003d3c-1f3e-4593-833b-0e20f72d527c.jpg
* id : 30
* categories : [{"id":13,"name":"实用"},{"id":24,"name":"西雅图"},{"id":26,"name":"其他"},{"id":30,"name":"独立设计师"}]
* description : Kate 在热爱野外大自然的家庭长大,从小就喜欢到处逛游和搜集野外的自然草药。在高中的时候,Kate 研究了 Jethro Klass and Dr. Christoper 的作品,开始自己制作和烧制药膏,甚至会尝试为朋友和家人“医治” 小病。后来,Kate 爱上了精油,因为其健康的特效和美好的香薰味道。Kate 创办了自己的精油品牌: Essential Apothecary Alchemist。
*/
private List<DesignersBean> designers;
private List<?> refer_articles;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public int getComment_num() {
return comment_num;
}
public void setComment_num(int comment_num) {
this.comment_num = comment_num;
}
public AuthorBean getAuthor() {
return author;
}
public void setAuthor(AuthorBean author) {
this.author = author;
}
public String getSub_title() {
return sub_title;
}
public void setSub_title(String sub_title) {
this.sub_title = sub_title;
}
public int getFavor_user_num() {
return favor_user_num;
}
public void setFavor_user_num(int favor_user_num) {
this.favor_user_num = favor_user_num;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getWeb_url() {
return web_url;
}
public void setWeb_url(String web_url) {
this.web_url = web_url;
}
public String getImage_url() {
return image_url;
}
public void setImage_url(String image_url) {
this.image_url = image_url;
}
public int getLike_user_num() {
return like_user_num;
}
public void setLike_user_num(int like_user_num) {
this.like_user_num = like_user_num;
}
public long getPublish_at() {
return publish_at;
}
public void setPublish_at(long publish_at) {
this.publish_at = publish_at;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public List<ReferProductsBean> getRefer_products() {
return refer_products;
}
public void setRefer_products(List<ReferProductsBean> refer_products) {
this.refer_products = refer_products;
}
public List<CommentsBean> getComments() {
return comments;
}
public void setComments(List<CommentsBean> comments) {
this.comments = comments;
}
public List<DesignersBean> getDesigners() {
return designers;
}
public void setDesigners(List<DesignersBean> designers) {
this.designers = designers;
}
public List<?> getRefer_articles() {
return refer_articles;
}
public void setRefer_articles(List<?> refer_articles) {
this.refer_articles = refer_articles;
}
public static class AuthorBean {
private String username;
private String avatar_url;
private int id;
private String sign;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getAvatar_url() {
return avatar_url;
}
public void setAvatar_url(String avatar_url) {
this.avatar_url = avatar_url;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getSign() {
return sign;
}
public void setSign(String sign) {
this.sign = sign;
}
}
public static class ReferProductsBean {
private String name;
private int mark_user_num;
private long publish_at;
private int id;
private List<String> cover_images;
private List<String> images;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getMark_user_num() {
return mark_user_num;
}
public void setMark_user_num(int mark_user_num) {
this.mark_user_num = mark_user_num;
}
public long getPublish_at() {
return publish_at;
}
public void setPublish_at(long publish_at) {
this.publish_at = publish_at;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public List<String> getCover_images() {
return cover_images;
}
public void setCover_images(List<String> cover_images) {
this.cover_images = cover_images;
}
public List<String> getImages() {
return images;
}
public void setImages(List<String> images) {
this.images = images;
}
}
public static class CommentsBean {
private String content;
private long created_at;
private int id;
@Override
public String toString() {
return "CommentsBean{" +
"content='" + content + '\'' +
", created_at=" + created_at +
", id=" + id +
", author=" + author +
'}';
}
/**
* username : 🐱猫大圣 🤖️微信机器人
* avatar_url : http://wx.qlogo.cn/mmopen/B8HPPaibicsOy2JQ2OAwhoHCsD7l03jG5Z7cJic6FjN80UIpy40UbBFMIenMZhkXy8eQdJI8auXdHD1x4bHcrnpf6Stu9IEIFWy/0
* id : 54372
* sign : 遇见最美的自己
*/
private AuthorBean author;
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public long getCreated_at() {
return created_at;
}
public void setCreated_at(long created_at) {
this.created_at = created_at;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public AuthorBean getAuthor() {
return author;
}
public void setAuthor(AuthorBean author) {
this.author = author;
}
public static class AuthorBean {
@Override
public String toString() {
return "AuthorBean{" +
"username='" + username + '\'' +
", avatar_url='" + avatar_url + '\'' +
", id=" + id +
", sign='" + sign + '\'' +
'}';
}
private String username;
private String avatar_url;
private int id;
private String sign;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getAvatar_url() {
return avatar_url;
}
public void setAvatar_url(String avatar_url) {
this.avatar_url = avatar_url;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getSign() {
return sign;
}
public void setSign(String sign) {
this.sign = sign;
}
}
}
public static class DesignersBean {
@Override
public String toString() {
return "DesignersBean{" +
"city='" + city + '\'' +
", concept='" + concept + '\'' +
", name='" + name + '\'' +
", label='" + label + '\'' +
", avatar_url='" + avatar_url + '\'' +
", id=" + id +
", description='" + description + '\'' +
", categories=" + categories +
'}';
}
private String city;
private String concept;
private String name;
private String label;
private String avatar_url;
private int id;
private String description;
/**
* id : 13
* name : 实用
*/
private List<CategoriesBean> categories;
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getConcept() {
return concept;
}
public void setConcept(String concept) {
this.concept = concept;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getAvatar_url() {
return avatar_url;
}
public void setAvatar_url(String avatar_url) {
this.avatar_url = avatar_url;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public List<CategoriesBean> getCategories() {
return categories;
}
public void setCategories(List<CategoriesBean> categories) {
this.categories = categories;
}
public static class CategoriesBean {
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;
}
}
}
}
}
| [
"keshanpu@126.com"
] | keshanpu@126.com |
4c51352bea0bcc375a2e1a30227a691315d41663 | 78cdb06af5178720ae158a91f2d5e1766e7dcc59 | /src/test/java/com/softwareverde/util/PackageTests.java | c1559216dcfb9fb2dc5f5e2574d8ad2618afcccb | [
"MIT"
] | permissive | SoftwareVerde/java-logging | 6772e97caf39f7bd1c02b74466f7f2180647226d | 280d2f812bdfd3f07c6476df510db07979936ddb | refs/heads/master | 2021-12-31T18:54:51.702471 | 2021-12-16T02:55:13 | 2021-12-16T02:55:13 | 126,208,247 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,399 | java | package com.softwareverde.util;
import org.junit.Assert;
import org.junit.Test;
public class PackageTests {
@Test
public void should_merge_simple_packages() {
// Setup
final MutablePackage rootPackage = Package.newRootPackage();
final MutablePackage pkg = Package.fromString("com.softwareverde.util");
Assert.assertEquals("com.softwareverde.util", pkg.toString());
// Action
rootPackage.mergeInPackage(pkg);
// Assert
Assert.assertTrue(rootPackage.hasChild("com"));
Assert.assertTrue(rootPackage.hasChild("com.softwareverde"));
Assert.assertTrue(rootPackage.hasChild("com.softwareverde.util"));
Assert.assertFalse(rootPackage.hasChild("org"));
Assert.assertFalse(rootPackage.hasChild("com.softwareverde.invalid"));
Assert.assertFalse(rootPackage.hasChild("com.softwareverde.constable"));
Assert.assertFalse(rootPackage.hasChild("com.softwareverde.logging"));
}
@Test
public void should_merge_packages_with_duplicates() {
// Setup
final MutablePackage rootPackage = Package.newRootPackage();
final MutablePackage softwareVerdeLoggingPackage = Package.fromString("com.softwareverde.logging");
rootPackage.mergeInPackage(softwareVerdeLoggingPackage);
final MutablePackage pkg = Package.fromString("com.softwareverde.util");
Assert.assertEquals("com.softwareverde.util", pkg.toString());
// Action
rootPackage.mergeInPackage(pkg);
// Assert
Assert.assertTrue(rootPackage.hasChild("com"));
Assert.assertTrue(rootPackage.hasChild("com.softwareverde"));
Assert.assertTrue(rootPackage.hasChild("com.softwareverde.util"));
Assert.assertTrue(rootPackage.hasChild("com.softwareverde.logging"));
Assert.assertFalse(rootPackage.hasChild("com.softwareverde.constable"));
}
@Test
public void should_merge_packages_with_duplicates_and_existing_children() {
// Setup
final MutablePackage rootPackage = Package.newRootPackage();
final MutablePackage softwareVerdeLoggingPackage = Package.fromString("com.softwareverde.logging");
rootPackage.mergeInPackage(softwareVerdeLoggingPackage);
final MutablePackage pkg = Package.fromString("com.softwareverde.constable.list");
Assert.assertEquals("com.softwareverde.constable.list", pkg.toString());
// Action
rootPackage.mergeInPackage(pkg);
// Assert
Assert.assertTrue(rootPackage.hasChild("com"));
Assert.assertTrue(rootPackage.hasChild("com.softwareverde"));
Assert.assertTrue(rootPackage.hasChild("com.softwareverde.constable"));
Assert.assertTrue(rootPackage.hasChild("com.softwareverde.constable.list"));
Assert.assertTrue(rootPackage.hasChild("com.softwareverde.logging"));
Assert.assertFalse(rootPackage.hasChild("com.softwareverde.util"));
}
@Test
public void should_merge_merged_packages_with_duplicates_and_existing_children() {
// Setup
final MutablePackage rootPackage = Package.newRootPackage();
final MutablePackage softwareVerdePackage = Package.fromString("com.softwareverde");
final MutablePackage softwareVerdeLoggingPackage = Package.fromString("com.softwareverde.logging");
softwareVerdePackage.mergeInPackage(softwareVerdeLoggingPackage);
rootPackage.mergeInPackage(softwareVerdePackage);
final MutablePackage pkg = Package.fromString("com.softwareverde.constable");
final MutablePackage listPkg = Package.fromString("com.softwareverde.constable.list");
pkg.mergeInPackage(listPkg);
Assert.assertEquals("com.softwareverde.constable", pkg.toString());
Assert.assertTrue(pkg.getRoot().hasChild("com.softwareverde.constable.list"));
// Action
rootPackage.mergeInPackage(pkg);
// Assert
Assert.assertTrue(rootPackage.hasChild("com"));
Assert.assertTrue(rootPackage.hasChild("com.softwareverde"));
Assert.assertTrue(rootPackage.hasChild("com.softwareverde.constable"));
Assert.assertTrue(rootPackage.hasChild("com.softwareverde.constable.list"));
Assert.assertTrue(rootPackage.hasChild("com.softwareverde.logging"));
Assert.assertFalse(rootPackage.hasChild("com.softwareverde.util"));
}
}
| [
"josh@softwareverde.com"
] | josh@softwareverde.com |
ee375718362bef3d91470fbe584d0e967471a2a0 | 835627678fb430408e3bf44a54b16c2d1886612a | /app/src/main/java/com/example/den_f/shoppinglistapp/interfaces/IShoppingList.java | fc5a73c05b87818e0fef8be3ec323ce6f8408510 | [] | no_license | Bombebak/ShoppingListApp | fce6d75b9e2f784f08c3e8f0c23239290505e459 | 381d3d3decd9989ab9ffe07e95802222c086edf3 | refs/heads/master | 2020-06-10T21:48:56.542028 | 2016-12-07T18:31:56 | 2016-12-07T18:31:56 | 75,864,193 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 458 | java | package com.example.den_f.shoppinglistapp.interfaces;
import com.example.den_f.shoppinglistapp.models.ShoppingListItem;
/**
* Created by Den_F on 13-11-2016.
*/
public interface IShoppingList {
void AddToShoppingList(String productName, int productQuantity);
void EditShoppingItem(ShoppingListItem item);
void DeleteShoppingItem(ShoppingListItem item);
void DeleteShoppingItems(ShoppingListItem[] items);
void ClearShoppingList();
}
| [
"Den_Farlige_Pilot@hotmail.com"
] | Den_Farlige_Pilot@hotmail.com |
43570e8b22b2d68ef6a3d43f2fb8ca6ee4793d6d | dbfb9c007ab30678f31e62aad34471015d9277a7 | /lock/src/main/java/com/auth0/lock/fragment/DatabaseChangePasswordFragment.java | 5126b89a9003a647541d52578bfc0fbb03c2373e | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | mgonto/Lock.Android | 9bf53d0dcb61d1ff0ef9ce7b05347e3fe7060d2c | faf99067a193bb81e4291ece5e50be12b44df598 | refs/heads/master | 2021-01-24T22:44:49.667190 | 2015-01-16T21:42:59 | 2015-01-16T21:42:59 | 29,368,659 | 0 | 0 | null | 2015-01-16T21:28:52 | 2015-01-16T21:28:51 | null | UTF-8 | Java | false | false | 5,685 | java | /*
* DatabaseChangePasswordFragment.java
*
* Copyright (c) 2014 Auth0 (http://auth0.com)
*
* 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.auth0.lock.fragment;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.EditorInfo;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.auth0.api.callback.BaseCallback;
import com.auth0.lock.R;
import com.auth0.lock.event.AuthenticationError;
import com.auth0.lock.event.ChangePasswordEvent;
import com.auth0.lock.event.NavigationEvent;
import com.auth0.lock.validation.ResetPasswordValidator;
import com.auth0.lock.validation.Validator;
import com.auth0.lock.widget.CredentialField;
public class DatabaseChangePasswordFragment extends BaseTitledFragment {
CredentialField usernameField;
CredentialField passwordField;
CredentialField repeatPasswordField;
Button sendButton;
ProgressBar progressBar;
private Validator validator;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_database_change_password, container, false);
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
usernameField = (CredentialField) view.findViewById(R.id.db_change_password_username_field);
if (!useEmail) {
usernameField.setHint(R.string.username_placeholder);
usernameField.setIconResource(R.drawable.ic_person);
usernameField.setErrorIconResource(R.drawable.ic_person_error);
usernameField.refresh();
}
passwordField = (CredentialField) view.findViewById(R.id.db_change_password_password_field);
repeatPasswordField = (CredentialField) view.findViewById(R.id.db_change_password_repeat_password_field);
sendButton = (Button) view.findViewById(R.id.db_reset_button);
progressBar = (ProgressBar) view.findViewById(R.id.db_change_password_progress_indicator);
Button cancelButton = (Button) view.findViewById(R.id.db_change_password_cancel_button);
cancelButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
bus.post(NavigationEvent.BACK);
}
});
sendButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
changePassword();
}
});
repeatPasswordField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
changePassword();
}
return false;
}
});
validator = new ResetPasswordValidator(useEmail);
}
@Override
protected int getTitleResource() {
return R.string.database_change_password_title;
}
private void changePassword() {
AuthenticationError error = validator.validateFrom(this);
boolean valid = error == null;
if (valid) {
performChange();
} else {
bus.post(error);
}
}
private void performChange() {
sendButton.setEnabled(false);
sendButton.setText("");
progressBar.setVisibility(View.VISIBLE);
String username = usernameField.getText().toString().trim();
String password = passwordField.getText().toString();
client.changePassword(username, password, authenticationParameters, new BaseCallback<Void>() {
@Override
public void onSuccess(Void payload) {
bus.post(new ChangePasswordEvent());
sendButton.setEnabled(true);
sendButton.setText(R.string.db_change_password_btn_text);
progressBar.setVisibility(View.GONE);
}
@Override
public void onFailure(Throwable error) {
bus.post(new AuthenticationError(R.string.db_change_password_error_title, R.string.db_change_password_error_message, error));
sendButton.setEnabled(true);
sendButton.setText(R.string.db_change_password_btn_text);
progressBar.setVisibility(View.GONE);
}
});
}
}
| [
"hernanzalazar@gmail.com"
] | hernanzalazar@gmail.com |
519bbf30b996014d28926577dad654bb181e971c | a842c4d77cff81208970b6648ac65a81c8e42fb0 | /src/main/java/objects/Aura.java | 8a78b3142526600970e44ba3e1d16da239999350 | [] | no_license | pantinor/gdx-exodus | 0926e38563f0e55190fb877926b854826805c7f7 | 9ca9b3cb92548b562ca4632121f5ed37ca53dfb0 | refs/heads/master | 2021-01-10T05:22:44.035450 | 2018-04-01T00:04:31 | 2018-04-01T00:04:31 | 45,147,614 | 6 | 3 | null | null | null | null | UTF-8 | Java | false | false | 758 | java | package objects;
import exodus.Constants.AuraType;
public class Aura {
private AuraType type = AuraType.NONE;
private int duration;
public void set(AuraType t, int d) {
this.type = t;
this.duration = d;
}
public int getDuration() {
return duration;
}
public void setDuration(int d) {
this.duration = d;
}
public AuraType getType() {
return type;
}
public void setType(AuraType t) {
this.type = t;
}
public boolean isActive() {
return duration > 0;
}
public void passTurn() {
if (duration > 0) {
duration--;
if (duration == 0) {
type = AuraType.NONE;
}
}
}
}
| [
"pantinor@gmail.com"
] | pantinor@gmail.com |
41096b5e91733a736dc2481b4f8fab297c01c585 | 28ba2a6e47ee4dc5c3768bc3fafeaddf3d09c731 | /src/main/java/com/story/UserStorytask/CDVRouteEvent.java | 672f04f9a4cfe0126f6e6abc866c43ef73804e41 | [] | no_license | gaikartejas/NewPracticeGit | 7cf991a72d21e3a7e278f12b028078733bac9d2e | 11708675e5621b95b371b633fe693c7ad477f428 | refs/heads/main | 2023-02-04T19:56:39.216916 | 2020-12-27T05:32:31 | 2020-12-27T05:32:31 | 324,692,453 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 202 | java | package com.story.UserStorytask;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Getter
@Setter
@ToString
public class CDVRouteEvent {
private String ID;
private String name;
} | [
"gaikar.tejas22@gmgail.com"
] | gaikar.tejas22@gmgail.com |
91edba9b6a63dff20fd7a49d32546c173d0a4f10 | c210109200077a439e715587ca0d7a9bbec9810c | /src/test/java/io/github/jhipster/sample/web/rest/BankAccountResourceIntTest.java | f52433c2fc081402cd764064258bb98ddcd9e178 | [] | no_license | guoyu07/jhipster-sample-app-hazelcast | 99363f8c85afe299c6ae01236b8fea396261aaa7 | 10d453a6d6fc56f00e1f431edc487671a954d4cf | refs/heads/master | 2020-06-01T05:11:30.519653 | 2017-06-09T15:36:58 | 2017-06-09T15:36:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,176 | java | package io.github.jhipster.sample.web.rest;
import io.github.jhipster.sample.JhipsterHazelcastSampleApplicationApp;
import io.github.jhipster.sample.domain.BankAccount;
import io.github.jhipster.sample.repository.BankAccountRepository;
import io.github.jhipster.sample.web.rest.errors.ExceptionTranslator;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.MockitoAnnotations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.web.PageableHandlerMethodArgumentResolver;
import org.springframework.http.MediaType;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.transaction.annotation.Transactional;
import javax.persistence.EntityManager;
import java.math.BigDecimal;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.hasItem;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
/**
* Test class for the BankAccountResource REST controller.
*
* @see BankAccountResource
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = JhipsterHazelcastSampleApplicationApp.class)
public class BankAccountResourceIntTest {
private static final String DEFAULT_NAME = "AAAAAAAAAA";
private static final String UPDATED_NAME = "BBBBBBBBBB";
private static final BigDecimal DEFAULT_BALANCE = new BigDecimal(1);
private static final BigDecimal UPDATED_BALANCE = new BigDecimal(2);
@Autowired
private BankAccountRepository bankAccountRepository;
@Autowired
private MappingJackson2HttpMessageConverter jacksonMessageConverter;
@Autowired
private PageableHandlerMethodArgumentResolver pageableArgumentResolver;
@Autowired
private ExceptionTranslator exceptionTranslator;
@Autowired
private EntityManager em;
private MockMvc restBankAccountMockMvc;
private BankAccount bankAccount;
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
BankAccountResource bankAccountResource = new BankAccountResource(bankAccountRepository);
this.restBankAccountMockMvc = MockMvcBuilders.standaloneSetup(bankAccountResource)
.setCustomArgumentResolvers(pageableArgumentResolver)
.setControllerAdvice(exceptionTranslator)
.setMessageConverters(jacksonMessageConverter).build();
}
/**
* Create an entity for this test.
*
* This is a static method, as tests for other entities might also need it,
* if they test an entity which requires the current entity.
*/
public static BankAccount createEntity(EntityManager em) {
BankAccount bankAccount = new BankAccount();
bankAccount.setName(DEFAULT_NAME);
bankAccount.setBalance(DEFAULT_BALANCE);
return bankAccount;
}
@Before
public void initTest() {
bankAccount = createEntity(em);
}
@Test
@Transactional
public void createBankAccount() throws Exception {
int databaseSizeBeforeCreate = bankAccountRepository.findAll().size();
// Create the BankAccount
restBankAccountMockMvc.perform(post("/api/bank-accounts")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(bankAccount)))
.andExpect(status().isCreated());
// Validate the BankAccount in the database
List<BankAccount> bankAccountList = bankAccountRepository.findAll();
assertThat(bankAccountList).hasSize(databaseSizeBeforeCreate + 1);
BankAccount testBankAccount = bankAccountList.get(bankAccountList.size() - 1);
assertThat(testBankAccount.getName()).isEqualTo(DEFAULT_NAME);
assertThat(testBankAccount.getBalance()).isEqualTo(DEFAULT_BALANCE);
}
@Test
@Transactional
public void createBankAccountWithExistingId() throws Exception {
int databaseSizeBeforeCreate = bankAccountRepository.findAll().size();
// Create the BankAccount with an existing ID
bankAccount.setId(1L);
// An entity with an existing ID cannot be created, so this API call must fail
restBankAccountMockMvc.perform(post("/api/bank-accounts")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(bankAccount)))
.andExpect(status().isBadRequest());
// Validate the Alice in the database
List<BankAccount> bankAccountList = bankAccountRepository.findAll();
assertThat(bankAccountList).hasSize(databaseSizeBeforeCreate);
}
@Test
@Transactional
public void checkNameIsRequired() throws Exception {
int databaseSizeBeforeTest = bankAccountRepository.findAll().size();
// set the field null
bankAccount.setName(null);
// Create the BankAccount, which fails.
restBankAccountMockMvc.perform(post("/api/bank-accounts")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(bankAccount)))
.andExpect(status().isBadRequest());
List<BankAccount> bankAccountList = bankAccountRepository.findAll();
assertThat(bankAccountList).hasSize(databaseSizeBeforeTest);
}
@Test
@Transactional
public void checkBalanceIsRequired() throws Exception {
int databaseSizeBeforeTest = bankAccountRepository.findAll().size();
// set the field null
bankAccount.setBalance(null);
// Create the BankAccount, which fails.
restBankAccountMockMvc.perform(post("/api/bank-accounts")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(bankAccount)))
.andExpect(status().isBadRequest());
List<BankAccount> bankAccountList = bankAccountRepository.findAll();
assertThat(bankAccountList).hasSize(databaseSizeBeforeTest);
}
@Test
@Transactional
public void getAllBankAccounts() throws Exception {
// Initialize the database
bankAccountRepository.saveAndFlush(bankAccount);
// Get all the bankAccountList
restBankAccountMockMvc.perform(get("/api/bank-accounts?sort=id,desc"))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.[*].id").value(hasItem(bankAccount.getId().intValue())))
.andExpect(jsonPath("$.[*].name").value(hasItem(DEFAULT_NAME.toString())))
.andExpect(jsonPath("$.[*].balance").value(hasItem(DEFAULT_BALANCE.intValue())));
}
@Test
@Transactional
public void getBankAccount() throws Exception {
// Initialize the database
bankAccountRepository.saveAndFlush(bankAccount);
// Get the bankAccount
restBankAccountMockMvc.perform(get("/api/bank-accounts/{id}", bankAccount.getId()))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.id").value(bankAccount.getId().intValue()))
.andExpect(jsonPath("$.name").value(DEFAULT_NAME.toString()))
.andExpect(jsonPath("$.balance").value(DEFAULT_BALANCE.intValue()));
}
@Test
@Transactional
public void getNonExistingBankAccount() throws Exception {
// Get the bankAccount
restBankAccountMockMvc.perform(get("/api/bank-accounts/{id}", Long.MAX_VALUE))
.andExpect(status().isNotFound());
}
@Test
@Transactional
public void updateBankAccount() throws Exception {
// Initialize the database
bankAccountRepository.saveAndFlush(bankAccount);
int databaseSizeBeforeUpdate = bankAccountRepository.findAll().size();
// Update the bankAccount
BankAccount updatedBankAccount = bankAccountRepository.findOne(bankAccount.getId());
updatedBankAccount.setName(UPDATED_NAME);
updatedBankAccount.setBalance(UPDATED_BALANCE);
restBankAccountMockMvc.perform(put("/api/bank-accounts")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(updatedBankAccount)))
.andExpect(status().isOk());
// Validate the BankAccount in the database
List<BankAccount> bankAccountList = bankAccountRepository.findAll();
assertThat(bankAccountList).hasSize(databaseSizeBeforeUpdate);
BankAccount testBankAccount = bankAccountList.get(bankAccountList.size() - 1);
assertThat(testBankAccount.getName()).isEqualTo(UPDATED_NAME);
assertThat(testBankAccount.getBalance()).isEqualTo(UPDATED_BALANCE);
}
@Test
@Transactional
public void updateNonExistingBankAccount() throws Exception {
int databaseSizeBeforeUpdate = bankAccountRepository.findAll().size();
// Create the BankAccount
// If the entity doesn't have an ID, it will be created instead of just being updated
restBankAccountMockMvc.perform(put("/api/bank-accounts")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(bankAccount)))
.andExpect(status().isCreated());
// Validate the BankAccount in the database
List<BankAccount> bankAccountList = bankAccountRepository.findAll();
assertThat(bankAccountList).hasSize(databaseSizeBeforeUpdate + 1);
}
@Test
@Transactional
public void deleteBankAccount() throws Exception {
// Initialize the database
bankAccountRepository.saveAndFlush(bankAccount);
int databaseSizeBeforeDelete = bankAccountRepository.findAll().size();
// Get the bankAccount
restBankAccountMockMvc.perform(delete("/api/bank-accounts/{id}", bankAccount.getId())
.accept(TestUtil.APPLICATION_JSON_UTF8))
.andExpect(status().isOk());
// Validate the database is empty
List<BankAccount> bankAccountList = bankAccountRepository.findAll();
assertThat(bankAccountList).hasSize(databaseSizeBeforeDelete - 1);
}
@Test
@Transactional
public void equalsVerifier() throws Exception {
TestUtil.equalsVerifier(BankAccount.class);
BankAccount bankAccount1 = new BankAccount();
bankAccount1.setId(1L);
BankAccount bankAccount2 = new BankAccount();
bankAccount2.setId(bankAccount1.getId());
assertThat(bankAccount1).isEqualTo(bankAccount2);
bankAccount2.setId(2L);
assertThat(bankAccount1).isNotEqualTo(bankAccount2);
bankAccount1.setId(null);
assertThat(bankAccount1).isNotEqualTo(bankAccount2);
}
}
| [
"julien.dubois@gmail.com"
] | julien.dubois@gmail.com |
1dbb07294c4cbe6ab93bf64086de27b48e9a8f04 | 1c5fd654b46d3fb018032dc11aa17552b64b191c | /spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2ClientPropertiesRegistrationAdapter.java | 8d50f8d117b5c5a6cb4018755a516f02c48df6bb | [
"Apache-2.0"
] | permissive | yangfancoming/spring-boot-build | 6ce9b97b105e401a4016ae4b75964ef93beeb9f1 | 3d4b8cbb8fea3e68617490609a68ded8f034bc67 | refs/heads/master | 2023-01-07T11:10:28.181679 | 2021-06-21T11:46:46 | 2021-06-21T11:46:46 | 193,871,877 | 0 | 0 | Apache-2.0 | 2022-12-27T14:52:46 | 2019-06-26T09:19:40 | Java | UTF-8 | Java | false | false | 4,362 | java |
package org.springframework.boot.autoconfigure.security.oauth2.client;
import java.util.HashMap;
import java.util.Map;
import org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientProperties.Provider;
import org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientProperties.Registration;
import org.springframework.boot.context.properties.PropertyMapper;
import org.springframework.boot.convert.ApplicationConversionService;
import org.springframework.core.convert.ConversionException;
import org.springframework.security.config.oauth2.client.CommonOAuth2Provider;
import org.springframework.security.oauth2.client.registration.ClientRegistration;
import org.springframework.security.oauth2.client.registration.ClientRegistration.Builder;
import org.springframework.security.oauth2.core.AuthorizationGrantType;
import org.springframework.security.oauth2.core.ClientAuthenticationMethod;
import org.springframework.util.StringUtils;
/**
* Adapter class to convert {@link OAuth2ClientProperties} to a
* {@link ClientRegistration}.
*
* @author Phillip Webb
* @author Thiago Hirata
*/
final class OAuth2ClientPropertiesRegistrationAdapter {
private OAuth2ClientPropertiesRegistrationAdapter() {
}
public static Map<String, ClientRegistration> getClientRegistrations(
OAuth2ClientProperties properties) {
Map<String, ClientRegistration> clientRegistrations = new HashMap<>();
properties.getRegistration().forEach((key, value) -> clientRegistrations.put(key,
getClientRegistration(key, value, properties.getProvider())));
return clientRegistrations;
}
private static ClientRegistration getClientRegistration(String registrationId,
Registration properties, Map<String, Provider> providers) {
Builder builder = getBuilder(registrationId, properties.getProvider(), providers);
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
map.from(properties::getClientId).to(builder::clientId);
map.from(properties::getClientSecret).to(builder::clientSecret);
map.from(properties::getClientAuthenticationMethod)
.as(ClientAuthenticationMethod::new)
.to(builder::clientAuthenticationMethod);
map.from(properties::getAuthorizationGrantType).as(AuthorizationGrantType::new)
.to(builder::authorizationGrantType);
map.from(properties::getRedirectUriTemplate).to(builder::redirectUriTemplate);
map.from(properties::getScope).as((scope) -> StringUtils.toStringArray(scope))
.to(builder::scope);
map.from(properties::getClientName).to(builder::clientName);
return builder.build();
}
private static Builder getBuilder(String registrationId, String configuredProviderId,
Map<String, Provider> providers) {
String providerId = (configuredProviderId != null) ? configuredProviderId
: registrationId;
CommonOAuth2Provider provider = getCommonProvider(providerId);
if (provider == null && !providers.containsKey(providerId)) {
throw new IllegalStateException(
getErrorMessage(configuredProviderId, registrationId));
}
Builder builder = (provider != null) ? provider.getBuilder(registrationId)
: ClientRegistration.withRegistrationId(registrationId);
if (providers.containsKey(providerId)) {
return getBuilder(builder, providers.get(providerId));
}
return builder;
}
private static String getErrorMessage(String configuredProviderId,
String registrationId) {
return ((configuredProviderId != null)
? "Unknown provider ID '" + configuredProviderId + "'"
: "Provider ID must be specified for client registration '"
+ registrationId + "'");
}
private static Builder getBuilder(Builder builder, Provider provider) {
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
map.from(provider::getAuthorizationUri).to(builder::authorizationUri);
map.from(provider::getTokenUri).to(builder::tokenUri);
map.from(provider::getUserInfoUri).to(builder::userInfoUri);
map.from(provider::getJwkSetUri).to(builder::jwkSetUri);
map.from(provider::getUserNameAttribute).to(builder::userNameAttributeName);
return builder;
}
private static CommonOAuth2Provider getCommonProvider(String providerId) {
try {
return ApplicationConversionService.getSharedInstance().convert(providerId,
CommonOAuth2Provider.class);
}
catch (ConversionException ex) {
return null;
}
}
}
| [
"34465021+jwfl724168@users.noreply.github.com"
] | 34465021+jwfl724168@users.noreply.github.com |
89a677e56258fb1d1724d5ee6cf8486cbebd459c | 4257f017c4738d7c1891f91d19655c45975103f4 | /TestViewPager/app/src/main/java/fpt/gstpro/testviewpager/model/Photo.java | 300ad27f2d0bdff5c774281a23346d516720bafc | [] | no_license | ninh-the-composer/android-study | e68b5e559a3e7dc9a123ab540bf08fdab10e9742 | 39386dd812ba91cbcccbf6bc73ab4c2902251317 | refs/heads/master | 2023-05-28T07:21:14.725913 | 2021-05-24T07:08:16 | 2021-05-24T07:08:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,545 | java | package fpt.gstpro.testviewpager.model;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class Photo {
@SerializedName("albumId")
@Expose
private int albumId;
@SerializedName("id")
@Expose
private int id;
@SerializedName("title")
@Expose
private String title;
@SerializedName("url")
@Expose
private String url;
@SerializedName("thumbnailUrl")
@Expose
private String thumbnailUrl;
/**
* No args constructor for use in serialization
*/
public Photo() {
}
public Photo(int albumId, int id, String title, String url, String thumbnailUrl) {
super();
this.albumId = albumId;
this.id = id;
this.title = title;
this.url = url;
this.thumbnailUrl = thumbnailUrl;
}
public int getAlbumId() {
return albumId;
}
public void setAlbumId(int albumId) {
this.albumId = albumId;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getThumbnailUrl() {
return thumbnailUrl;
}
public void setThumbnailUrl(String thumbnailUrl) {
this.thumbnailUrl = thumbnailUrl;
}
} | [
"adzekk01@gmail.com"
] | adzekk01@gmail.com |
f2d6e2966c11f7d4a65ba0e077e4e26104025eb8 | 180a75e3e7260a8d446a4a78b23f2dd930729e83 | /POO20204_201905555_rodrigo/src/aula14/sala_aula_teste/TestaAgenda.java | d25b88a8f5585a67a3026c7debde36115903772e | [] | no_license | Spaink/POO_2020-4 | aae03a2c97e1c30343872561de37e9f62b9bf3d8 | b392dd9295928bb050ef42f97d33b57ade9ef784 | refs/heads/master | 2020-12-12T18:16:21.284018 | 2020-02-09T19:00:58 | 2020-02-09T19:00:58 | 234,195,716 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 91 | java | package aula14.sala_aula_teste;
import org.junit.Before;
public class TestaAgenda {
}
| [
"rodrigo.alves@level5jr.com.br"
] | rodrigo.alves@level5jr.com.br |
31f80a80171d776ccefb2ef2b988edff74d64939 | 5b93ab442bda15acd710d71a4723c67803be283d | /Point Initializations/src/Point.java | b7d9a92fa5d8656d32d08a2d1db9a650b493f145 | [] | no_license | sepehrja/AspectJ | ccec5744b26d3a260f8272d13069c6a9f14f056d | 85693df4cd1fc9d5e3b699f3d3a2f707e0a2f911 | refs/heads/master | 2022-04-14T18:45:59.318896 | 2020-02-02T23:47:30 | 2020-02-02T23:47:30 | 237,854,139 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 169 | java |
public class Point {
public float x;
public float y;
public Point() {
this(0, 0);
}
public Point (float x, float y) {
this.x = x;
this.y = y;
}
}
| [
"jalayersepehr@gmail.com"
] | jalayersepehr@gmail.com |
23179576d9139db04cbb413f8820aae87ad29283 | 98b1ccad537fad866032ad38553948d9d3e432db | /src/main/java/com/chtw/cidemo/CidemoApplication.java | bb8322b2e7bf181fb375dcc3b3a0157e21e4304b | [] | no_license | twwch/ci-demo | 7113bf2d9f4dd8976b6a6ac4fe11401e0e94718a | f64a924ff326b24484326f1d5758543bf9bbf6bf | refs/heads/master | 2023-07-17T20:14:22.462605 | 2021-09-04T11:03:08 | 2021-09-04T11:03:08 | 403,024,450 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 320 | java | package com.chtw.cidemo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class CidemoApplication {
public static void main(String[] args) {
SpringApplication.run(CidemoApplication.class, args);
}
}
| [
"chenhao03@xiaoduotech.com"
] | chenhao03@xiaoduotech.com |
9cbb61299ad092aedc102f06d8aa69b6f70d1e73 | d75030a113e753c0762ec0bf105d9f9a6ef54079 | /fakeplayer-plugin/src/main/java/io/github/portlek/fakeplayer/file/MenuFile.java | a6a0e5345495ab5520a84fdc0be52e346af22c4d | [
"MIT"
] | permissive | YemY4YT/fakeplayer | 3aaf22ff2a35e222e4a0fcff0b342e59e774a1a3 | 98a89447251a80892773aba20511ebcf73ce377a | refs/heads/master | 2023-01-29T03:08:46.913167 | 2020-12-13T11:25:07 | 2020-12-13T11:25:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,120 | java | package io.github.portlek.fakeplayer.file;
import com.cryptomorin.xseries.XMaterial;
import io.github.portlek.bukkititembuilder.ItemStackBuilder;
import io.github.portlek.bukkititembuilder.util.ColorUtil;
import io.github.portlek.configs.annotations.Config;
import io.github.portlek.configs.annotations.Instance;
import io.github.portlek.configs.annotations.Property;
import io.github.portlek.configs.annotations.Section;
import io.github.portlek.configs.bukkit.BukkitManaged;
import io.github.portlek.configs.bukkit.BukkitSection;
import io.github.portlek.configs.type.YamlFileType;
import io.github.portlek.fakeplayer.FakePlayer;
import io.github.portlek.fakeplayer.file.provider.ListMenuProvider;
import io.github.portlek.fakeplayer.util.FileElement;
import io.github.portlek.mapentry.MapEntry;
import io.github.portlek.replaceable.Replaceable;
import io.github.portlek.replaceable.rp.RpString;
import io.github.portlek.smartinventory.Page;
import java.util.Collections;
import net.wesjd.anvilgui.AnvilGUI;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
@Config(
name = "menu",
type = YamlFileType.class,
location = "%basedir%/FakePlayer"
)
public final class MenuFile extends BukkitManaged {
@Instance
public final MenuFile.FakePlayers fakePlayers = new MenuFile.FakePlayers();
@Override
public void onLoad() {
this.setAutoSave(true);
}
@Section("fake-players")
public static final class FakePlayers extends BukkitSection {
@Property
public String type_fake_player = "Type a name";
@Property
public String put_less_than_16_character = "Put less than 16 char!";
@Property
public RpString title = Replaceable.from("&eFake Players")
.map(ColorUtil::colored);
@Property
public FileElement fake_player = new FileElement(
ItemStackBuilder.from(XMaterial.PLAYER_HEAD)
.name("&a%player_name%")
.lore("",
"&7Right Click to delete this fake player.",
"&7Left Click to teleport this fake player.",
"&7Middle Click to toggle visible this fake player.")
.itemStack(),
0, 0);
@Property
public FileElement add = new FileElement(
ItemStackBuilder.from(XMaterial.APPLE)
.name("&aAdd Fake Player")
.lore("", "&7Click and add fake player to your location.")
.itemStack(),
4, 4);
@Property
public FileElement next = new FileElement(
ItemStackBuilder.from(XMaterial.ARROW)
.name("&aNext")
.lore("",
"&7Click and see the next page.")
.itemStack(),
5, 5);
@Property
public FileElement previous = new FileElement(
ItemStackBuilder.from(XMaterial.ARROW)
.name("&aPrevious")
.lore("",
"&7Click and see the previous page.")
.itemStack(),
5, 3);
public void openAnvil(@NotNull final Player player) {
new AnvilGUI.Builder()
.onComplete((clicker, s) -> {
if (FakePlayer.getAPI().fakesFile.fakeplayers.containsKey(s)) {
clicker.sendMessage(FakePlayer.getAPI().languageFile.errors.there_is_already.get()
.build(Collections.singleton(MapEntry.from("%name%", () -> s))));
return AnvilGUI.Response.close();
}
if (s.trim().length() > 16) {
return AnvilGUI.Response.text(this.put_less_than_16_character);
}
FakePlayer.getAPI().fakesFile.addFakes(s.trim(), clicker.getLocation());
clicker.sendMessage(FakePlayer.getAPI().languageFile.generals.fake_player_added.get()
.build(Collections.singleton(MapEntry.from("%name%", () -> s))));
return AnvilGUI.Response.close();
})
.text(this.type_fake_player)
.plugin(FakePlayer.getInstance())
.open(player);
}
@NotNull
public Page inventory() {
return Page.build(
FakePlayer.getAPI().inventory,
new ListMenuProvider(
this.fake_player,
this.add,
this.next,
this.previous
)).row(6)
.title(this.title.build());
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
17414fd4c997993b4bda3a9d48c66f1272fffe2f | c6257e86485e85c1a89751edd064d8419781263a | /src/uoc/jezamora/tfc/firmapp/mng/UserMngr.java | 25eaa314d774e4d67ce758c7d7910ad47c2903b0 | [] | no_license | juanen/FirmApp | 692448f02118bf233ce584f02d79588abe882de4 | 92e2c957ff713e67f11a6279c9f04c1ce2e6d37b | refs/heads/master | 2021-01-21T10:12:53.325763 | 2013-01-04T10:49:16 | 2013-01-04T10:49:16 | null | 0 | 0 | null | null | null | null | WINDOWS-1250 | Java | false | false | 5,881 | java | /**
* @Author JE Zamora Alvarez - UOC - TFC
* @Date 2012/12 - V1.0
*
* Manage class user profile
*/
package uoc.jezamora.tfc.firmapp.mng;
import org.json.JSONException;
import org.json.JSONObject;
import android.content.Context;
import uoc.jezamora.tfc.firmapp.ent.Session;
import uoc.jezamora.tfc.firmapp.ent.User;
import uoc.jezamora.tfc.firmapp.swb.WebServiceMngr;
public class UserMngr {
// JSON Response node names
private static String KEY_SUCCESS = "success";
private static String KEY_ERROR = "error";
private static String KEY_ERROR_MSG = "error_msg";
private static String KEY_UID = "userid";
private static String KEY_NAME = "name";
private static String KEY_NIF = "nif";
private static String KEY_SURNAME = "surname";
private static String KEY_PROV = "province";
private static String KEY_BORN = "date_born";
private static String KEY_EMAIL = "email";
private static String ACTI = "1";
private static String NO_ACTI = "13";
private static String DUPLI = "12";
private static String NO_UPDATE = "19";
private User user;
private Session session;
public UserMngr(User user, Context context) {
setUser(user);
}
/*
* Getters i setters
*/
private void setSession(Session session) {
this.session = session;
}
private void setUser(User user) {
this.user = user;
}
private User getUser() {
return user;
}
/*
* load user
*/
public User loadUser(String idUser) {
WebServiceMngr wsMngr = new WebServiceMngr();
JSONObject json = wsMngr.loadUser(idUser);
try {
// check for response
if (!json.getString(KEY_SUCCESS).equals("")
|| !json.getString(KEY_ERROR).equals("")) {
String res = json.getString(KEY_SUCCESS);
if (res.equals(ACTI)) {
JSONObject json_user = json.getJSONObject("user");
user = new User(json_user.getInt(KEY_UID),
json_user.getString(KEY_NIF),
json_user.getString(KEY_NAME),
json_user.getString(KEY_SURNAME),
json_user.getString(KEY_PROV),
json_user.getString(KEY_BORN),
json_user.getString(KEY_EMAIL), "");
setUser(user);
} else if ((json.getString(KEY_ERROR).equals(NO_ACTI))
|| (json.getString(KEY_ERROR).equals(DUPLI))) {
session = new Session(0, "", "", json.getString(KEY_ERROR),
json.getString(KEY_ERROR_MSG));
setSession(session);
user = null;
return null;
}
} else {
user = null;
}
} catch (JSONException e) {
e.printStackTrace();
}
return user;
}
/*
* Create user
*/
public Session newUser(User user) {
WebServiceMngr wsMngr = new WebServiceMngr();
JSONObject json = wsMngr.newUser(getUser().getnif(), getUser()
.getuserName(), getUser().getSurname(),
getUser().getProvince(), getUser().getFec(), getUser()
.geteMail(), getUser().getpassword());
try {
if (!json.getString(KEY_SUCCESS).equals("")
|| !json.getString(KEY_ERROR).equals("")) {
String res = json.getString(KEY_SUCCESS);
if (res.equals(ACTI)) {
JSONObject json_user = json.getJSONObject("user");
session = new Session(json_user.getInt(KEY_UID),
json_user.getString(KEY_EMAIL),
json_user.getString(KEY_NAME),
json.getString(KEY_SUCCESS), "");
setSession(session);
} else if ((json.getString(KEY_ERROR).equals(NO_ACTI))
|| (json.getString(KEY_ERROR).equals(DUPLI))) {
session = new Session(0, "", "", json.getString(KEY_ERROR),
json.getString(KEY_ERROR_MSG));
setSession(session);
return session;
}
} else {
session = null;
}
} catch (JSONException e) {
e.printStackTrace();
}
return session;
}
/*
* update user
*/
public String updateUser(User user) {
String update = "";
WebServiceMngr wsMngr = new WebServiceMngr();
JSONObject json = wsMngr.updateUser(String.valueOf(getUser()
.getuserId()), getUser().getuserName(), getUser().getSurname(),
getUser().getProvince(), getUser().getFec());
try {
if (!json.getString(KEY_SUCCESS).equals("")
|| !json.getString(KEY_ERROR).equals("")) {
String res = json.getString(KEY_SUCCESS);
if (res.equals(ACTI)) {
update = json.getString(KEY_SUCCESS);
} else if ((json.getString(KEY_ERROR).equals(NO_UPDATE))
|| (json.getString(KEY_ERROR).equals(DUPLI))) {
update = json.getString(KEY_ERROR_MSG);
}
} else {
update = "";
}
} catch (JSONException e) {
e.printStackTrace();
}
return update;
}
/*
* Validate new user
*/
public String validateUserData(boolean pwdCheck) {
if (getUser().getuserName().compareTo("") == 0) {
return "Nombre usuario sin informar";
}
if (getUser().getSurname().compareTo("") == 0) {
return "Campo apellido sin informar";
}
if (getUser().getnif().compareTo("") == 0) {
return "Campo NIF sin informar";
}
if (getUser().getProvince().compareTo("") == 0) {
return "Campo provincia sin informar";
}
if (getUser().getFec().compareTo("") == 0) {
return "Campo fecha de nacimiento sin informar";
}
if (getUser().geteMail().compareTo("") == 0) {
return "Campo email sin informar";
}
if (getUser().getpassword().compareTo("") == 0) {
return "Campo contrase–a sin informar";
}
if (!getUser().geteMail().toString()
.matches("[a-zA-Z0-9._-]+@[a-z]+\\.+[a-z]+")) {
return "Formato email inv‡lido";
}
else
return null;
}
/*
* Modify user validate
*/
public String validateModiUser(boolean pwdCheck) {
if (getUser().getuserName().compareTo("") == 0) {
return "Nombre usuario vacio";
}
if (getUser().getSurname().compareTo("") == 0) {
return "Campo apellido sin informar";
}
if (getUser().getProvince().compareTo("") == 0) {
return "Campo provincia sin informar";
}
if (getUser().getFec().compareTo("") == 0) {
return "Campo fecha de nacimiento sin informar";
}
else
return null;
}
}
| [
"zamora.juanenrique@gmail.com"
] | zamora.juanenrique@gmail.com |
d85af965f8fde8fe76b198506092aaf61277ea8e | 1bc627c380d57604101bc65e5c402ea88332c919 | /src/main/java/com/fsoft/ez/controller/EZN101Controller.java | 2d19cb701ac40057557089cc57a4e0d60b7a0811 | [] | no_license | lmhieuptit/ToeicOnline | 3478f03c484fd7da507c0dc968b9a54b6666fcf1 | c13f9622c3685c45ee66d31b329b409aadb5867d | refs/heads/master | 2023-06-26T00:56:03.742248 | 2021-07-21T10:47:38 | 2021-07-21T10:47:38 | 388,077,876 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,063 | java | package com.fsoft.ez.controller;
import java.util.List;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.fsoft.ez.entity.TblDepartment;
import com.fsoft.ez.entity.TblEmployee;
import com.fsoft.ez.entity.custom.EZN10101;
import com.fsoft.ez.entity.custom.EZN10102;
import com.fsoft.ez.model.request.EZN101001Request;
import com.fsoft.ez.service.EZN101Service;
@RestController
@RequestMapping("/api/admin")
public class EZN101Controller {
@Autowired
private EZN101Service ezn101Service;
@GetMapping("/all-department")
public List<TblDepartment> getAllDepartment() {
return this.ezn101Service.getListDepartment();
}
@GetMapping("/all-employee")
public List<TblEmployee> findEmployeeByDeptId(@RequestParam("deptId") String deptId) {
return this.ezn101Service.findEmployeeByDeptId(deptId);
}
@GetMapping("/all-jobindicator-department")
public List<EZN10102> findPositionByDeptId(@RequestParam("deptId") String deptId) {
return this.ezn101Service.findJobIndicatorByDeptId(deptId);
}
@GetMapping("/get-process-by-name")
public List<EZN10101> getProcessByName(@RequestParam String keySearchProcess) {
return this.ezn101Service.getProcessByName(keySearchProcess);
}
@PutMapping(path = "/edit-process")
public void editProcess(@RequestBody @Valid EZN101001Request ezn101001Request) throws Exception {
this.ezn101Service.editProcess(ezn101001Request);
}
@DeleteMapping(path = "/delete-process")
public String deleteProcess(@RequestParam("processId") Long processId) throws Exception {
return this.ezn101Service.deleteProcess(processId);
}
}
| [
"lmhieuptit@gmail.com"
] | lmhieuptit@gmail.com |
0393416d4acd6ea84161e5f8e675e7373579efc9 | aca457909ef8c4eb989ba23919de508c490b074a | /DialerJADXDecompile/adr.java | 1b5018b4bc86727012f2dc8c2394d04094586880 | [] | no_license | KHikami/ProjectFiCallingDeciphered | bfccc1e1ba5680d32a4337746de4b525f1911969 | cc92bf6d4cad16559a2ecbc592503d37a182dee3 | refs/heads/master | 2021-01-12T17:50:59.643861 | 2016-12-08T01:20:34 | 2016-12-08T01:23:04 | 71,650,754 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 25,590 | java | import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.database.CharArrayBuffer;
import android.database.Cursor;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.text.SpannableString;
import android.text.TextUtils;
import android.text.TextUtils.TruncateAt;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.MeasureSpec;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.AbsListView.SelectionBoundsAdjuster;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;
import android.widget.QuickContactBadge;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Locale;
import java.util.regex.Pattern;
/* compiled from: PG */
public final class adr extends ViewGroup implements SelectionBoundsAdjuster {
static final Pattern a;
private int A;
private int B;
private int C;
private int D;
private int E;
private int F;
private int G;
private Drawable H;
private int I;
private int J;
private int K;
private int L;
private int M;
private int N;
private TextView O;
private ImageView P;
private TextView Q;
private ImageView R;
private int S;
private int T;
private int U;
private boolean V;
private boolean W;
private int aa;
private int ab;
private int ac;
private int ad;
private int ae;
private int af;
private int ag;
private int ah;
private int ai;
private int aj;
private Rect ak;
final acx b;
public ArrayList c;
public ArrayList d;
public String e;
aek f;
boolean g;
public boolean h;
public int i;
boolean j;
boolean k;
QuickContactBadge l;
TextView m;
TextView n;
TextView o;
TextView p;
ImageView q;
ImageView r;
ColorStateList s;
boolean t;
boolean u;
public boolean v;
CharSequence w;
int x;
private int y;
private int z;
static {
a = Pattern.compile("([\\w-\\.]+)@((?:[\\w]+\\.)+)([a-zA-Z]{2,4})|[\\w]+");
}
public adr(Context context, AttributeSet attributeSet, boolean z) {
this(context, null);
this.h = z;
}
public adr(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
CharArrayBuffer charArrayBuffer = new CharArrayBuffer(128);
charArrayBuffer = new CharArrayBuffer(128);
this.y = 0;
this.z = 0;
this.A = 0;
this.B = 4;
this.C = 16;
this.D = 0;
this.I = 32;
this.J = 16;
this.M = 3;
this.N = 5;
this.g = false;
this.h = false;
this.i = a(false);
this.k = true;
this.S = 0;
this.t = false;
this.ab = -16777216;
this.v = true;
this.ak = new Rect();
if (abp.a != null) {
TypedArray obtainStyledAttributes = getContext().obtainStyledAttributes(attributeSet, abp.a);
this.y = obtainStyledAttributes.getDimensionPixelSize(abp.g, this.y);
this.H = obtainStyledAttributes.getDrawable(abp.b);
this.z = obtainStyledAttributes.getDimensionPixelOffset(abp.e, this.z);
this.A = obtainStyledAttributes.getDimensionPixelOffset(abp.f, this.A);
this.B = obtainStyledAttributes.getDimensionPixelOffset(abp.p, this.B);
this.C = obtainStyledAttributes.getDimensionPixelOffset(abp.q, this.C);
this.S = obtainStyledAttributes.getDimensionPixelOffset(abp.o, this.S);
this.D = obtainStyledAttributes.getDimensionPixelOffset(abp.r, this.D);
this.E = obtainStyledAttributes.getDimensionPixelOffset(abp.s, this.E);
this.N = obtainStyledAttributes.getInteger(abp.d, this.N);
this.M = obtainStyledAttributes.getInteger(abp.h, this.M);
this.ab = obtainStyledAttributes.getColor(abp.i, this.ab);
this.F = (int) obtainStyledAttributes.getDimension(abp.j, (float) ((int) getResources().getDimension(buf.cO)));
this.I = obtainStyledAttributes.getDimensionPixelOffset(abp.u, this.I);
this.J = obtainStyledAttributes.getDimensionPixelOffset(abp.t, this.J);
setPaddingRelative(obtainStyledAttributes.getDimensionPixelOffset(abp.l, 0), obtainStyledAttributes.getDimensionPixelOffset(abp.n, 0), obtainStyledAttributes.getDimensionPixelOffset(abp.m, 0), obtainStyledAttributes.getDimensionPixelOffset(abp.k, 0));
obtainStyledAttributes.recycle();
}
this.b = new acx(1);
if (abp.C != null) {
obtainStyledAttributes = getContext().obtainStyledAttributes(abp.C);
this.s = obtainStyledAttributes.getColorStateList(abp.D);
obtainStyledAttributes.recycle();
}
this.G = getResources().getDimensionPixelSize(buf.cP);
if (this.H != null) {
this.H.setCallback(this);
}
this.c = new ArrayList();
this.d = new ArrayList();
setLayoutDirection(3);
}
public static final int a(boolean z) {
switch (TextUtils.getLayoutDirectionFromLocale(Locale.getDefault())) {
case rq.b /*1*/:
return adu.b;
default:
return adu.a;
}
}
protected final void onMeasure(int i, int i2) {
int i3;
int i4;
int i5;
View view = null;
int resolveSize = resolveSize(0, i);
int i6 = this.y;
this.aa = 0;
this.ac = 0;
this.ad = 0;
this.ae = 0;
this.aj = 0;
this.af = 0;
this.ag = 0;
this.ai = 0;
this.ah = 0;
if (!this.t) {
i3 = this.S;
this.U = i3;
this.T = i3;
if (!this.k && this.P == null) {
if (!this.V) {
this.T = 0;
}
if (!this.W) {
this.U = 0;
}
}
this.t = true;
}
if (this.T > 0 || this.V) {
i3 = ((resolveSize - getPaddingLeft()) - getPaddingRight()) - (this.T + this.z);
} else {
i3 = (resolveSize - getPaddingLeft()) - getPaddingRight();
}
if (this.j) {
i3 -= this.G + this.z;
}
if (this.h) {
i3 -= this.I + this.J;
}
if (a(view)) {
view.measure(MeasureSpec.makeMeasureSpec(0, 0), MeasureSpec.makeMeasureSpec(0, 0));
this.ai = view.getMeasuredWidth();
this.ah = view.getMeasuredHeight();
i3 -= this.ai + this.z;
}
if (a(this.m)) {
if (this.i != adu.a) {
i4 = i3 - this.D;
} else {
i4 = i3;
}
this.m.measure(MeasureSpec.makeMeasureSpec(i4, 1073741824), MeasureSpec.makeMeasureSpec(0, 0));
this.aa = this.m.getMeasuredHeight();
}
if (a(view)) {
view.measure(MeasureSpec.makeMeasureSpec(i3, 1073741824), MeasureSpec.makeMeasureSpec(0, 0));
this.ac = view.getMeasuredHeight();
}
if (a(this.o)) {
if (a(this.n)) {
i4 = i3 - this.A;
i5 = (this.N * i4) / (this.N + this.M);
i4 = (i4 * this.M) / (this.N + this.M);
} else {
i4 = i3;
i5 = i4;
i4 = 0;
}
} else if (a(this.n)) {
i4 = i3;
i5 = 0;
} else {
i4 = 0;
i5 = i4;
i4 = 0;
}
if (a(this.o)) {
this.o.measure(MeasureSpec.makeMeasureSpec(i5, 1073741824), MeasureSpec.makeMeasureSpec(0, 0));
this.ae = this.o.getMeasuredHeight();
}
if (a(this.n)) {
this.n.measure(MeasureSpec.makeMeasureSpec(i4, oe.INVALID_ID), MeasureSpec.makeMeasureSpec(0, 0));
this.ad = this.n.getMeasuredHeight();
}
this.aj = Math.max(this.ad, this.ae);
if (a(this.Q)) {
this.Q.measure(MeasureSpec.makeMeasureSpec(i3, 1073741824), MeasureSpec.makeMeasureSpec(0, 0));
this.af = this.Q.getMeasuredHeight();
}
if (a(this.q)) {
this.q.measure(MeasureSpec.makeMeasureSpec(this.C, 1073741824), MeasureSpec.makeMeasureSpec(this.C, 1073741824));
this.ag = this.q.getMeasuredHeight();
}
if (this.h && a(this.r)) {
this.r.measure(MeasureSpec.makeMeasureSpec(this.I, 1073741824), MeasureSpec.makeMeasureSpec(this.I, 1073741824));
}
if (a(this.R)) {
this.R.measure(MeasureSpec.makeMeasureSpec(0, 0), MeasureSpec.makeMeasureSpec(0, 0));
this.aa = Math.max(this.aa, this.R.getMeasuredHeight());
}
if (a(this.p)) {
if (a(this.q)) {
i3 = (i3 - this.q.getMeasuredWidth()) - this.B;
}
this.p.measure(MeasureSpec.makeMeasureSpec(i3, 1073741824), MeasureSpec.makeMeasureSpec(0, 0));
this.ag = Math.max(this.ag, this.p.getMeasuredHeight());
}
i3 = Math.max(Math.max((((this.aa + this.ac) + this.aj) + this.af) + this.ag, (this.U + getPaddingBottom()) + getPaddingTop()), i6);
if (this.O != null && this.O.getVisibility() == 0) {
this.O.measure(MeasureSpec.makeMeasureSpec(this.G, 1073741824), MeasureSpec.makeMeasureSpec(0, 0));
}
setMeasuredDimension(resolveSize, i3);
}
protected final void onLayout(boolean z, int i, int i2, int i3, int i4) {
int i5 = i4 - i2;
int i6 = i3 - i;
int paddingLeft = getPaddingLeft();
int paddingRight = i6 - getPaddingRight();
boolean b = aix.b(this);
if (this.j) {
if (this.O != null) {
int measuredHeight = this.O.getMeasuredHeight();
int i7 = ((i5 - measuredHeight) / 2) + this.E;
TextView textView = this.O;
int i8 = b ? paddingRight - this.G : paddingLeft;
if (b) {
i6 = paddingRight;
} else {
i6 = this.G + paddingLeft;
}
textView.layout(i8, i7, i6, measuredHeight + i7);
}
if (b) {
paddingRight -= this.G;
i6 = paddingLeft;
} else {
i6 = this.G + paddingLeft;
}
} else {
i6 = paddingLeft;
}
this.ak.set(i + i6, 0, i + paddingRight, i5);
this.K = i + i6;
this.L = i + paddingRight;
if (this.j) {
if (b) {
paddingRight -= this.z;
} else {
i6 += this.z;
}
}
if (this.u && isActivated()) {
this.H.setBounds(this.ak);
}
if (a(null)) {
paddingLeft = ((i5 - this.ah) / 2) + 0;
vf vfVar;
if (this.i == adu.a) {
vfVar = null;
vfVar.layout(paddingRight - this.ai, paddingLeft, paddingRight, this.ah + paddingLeft);
} else {
vfVar = null;
vfVar.layout(i6, paddingLeft, this.ai + i6, this.ah + paddingLeft);
}
}
View view = this.l != null ? this.l : this.P;
if (this.i != adu.a) {
if (view != null) {
i8 = ((i5 - this.U) / 2) + 0;
view.layout(paddingRight - this.T, i8, paddingRight, this.U + i8);
paddingRight -= this.T + this.z;
} else if (this.V) {
paddingRight -= this.T + this.z;
}
i6 += this.D;
} else if (view != null) {
i8 = ((i5 - this.U) / 2) + 0;
view.layout(i6, i8, this.T + i6, this.U + i8);
i6 += this.T + this.z;
} else if (this.V) {
i6 += this.T + this.z;
}
if (this.h) {
if (a(this.r)) {
paddingLeft = ((i5 - this.I) / 2) + 0;
if (b) {
this.r.layout(i6, paddingLeft, this.I + i6, this.I + paddingLeft);
} else {
this.r.layout(paddingRight - this.I, paddingLeft, paddingRight, this.I + paddingLeft);
}
}
if (this.i == adu.a) {
paddingRight -= this.I + this.J;
} else {
i6 += this.I + this.J;
}
}
i5 = ((i5 - ((((this.aa + this.ac) + this.aj) + this.af) + this.ag)) / 2) + this.E;
paddingLeft = 0;
if (a(this.R)) {
i8 = this.R.getMeasuredWidth();
paddingLeft = this.ai > 0 ? this.ai + this.z : 0;
if (this.i == adu.a) {
this.R.layout((paddingRight - i8) - paddingLeft, i5, paddingRight - paddingLeft, this.aa + i5);
paddingLeft = i8;
} else {
this.R.layout(i6 + paddingLeft, i5, paddingLeft + (i6 + i8), this.aa + i5);
paddingLeft = i8;
}
}
if (a(this.m)) {
paddingLeft += this.ai > 0 ? this.ai + this.z : 0;
if (this.i == adu.a) {
this.m.layout(i6, i5, paddingRight - paddingLeft, this.aa + i5);
} else {
this.m.layout(paddingLeft + i6, i5, paddingRight, this.aa + i5);
}
}
if (a(this.m) || a(this.R)) {
i8 = i5 + this.aa;
} else {
i8 = i5;
}
if (b) {
if (a(this.q)) {
paddingLeft = this.q.getMeasuredWidth();
this.q.layout(paddingRight - paddingLeft, i8, paddingRight, this.ag + i8);
paddingLeft = paddingRight - (paddingLeft + this.B);
} else {
paddingLeft = paddingRight;
}
if (a(this.p)) {
this.p.layout(i6, i8, paddingLeft, this.ag + i8);
}
} else {
if (a(this.q)) {
paddingLeft = this.q.getMeasuredWidth();
this.q.layout(i6, i8, i6 + paddingLeft, this.ag + i8);
paddingLeft = (paddingLeft + this.B) + i6;
} else {
paddingLeft = i6;
}
if (a(this.p)) {
this.p.layout(paddingLeft, i8, paddingRight, this.ag + i8);
}
}
if (a(this.p) || a(this.q)) {
paddingLeft = this.ag + i8;
} else {
paddingLeft = i8;
}
if (a(null)) {
TextView textView2 = null;
textView2.layout(i6, paddingLeft, paddingRight, this.ac + paddingLeft);
paddingLeft += this.ac;
}
if (!a(this.n)) {
i8 = paddingRight;
paddingRight = i6;
} else if (b) {
i8 = this.n.getMeasuredWidth() + i6;
this.n.layout(paddingRight - this.n.getMeasuredWidth(), (this.aj + paddingLeft) - this.ad, paddingRight, this.aj + paddingLeft);
int i9 = i8;
i8 = paddingRight - (this.n.getMeasuredWidth() + this.A);
paddingRight = i9;
} else {
this.n.layout(i6, (this.aj + paddingLeft) - this.ad, paddingRight, this.aj + paddingLeft);
i8 = paddingRight;
paddingRight = (this.n.getMeasuredWidth() + this.A) + i6;
}
if (a(this.o)) {
if (b) {
this.o.layout(i8 - this.o.getMeasuredWidth(), (this.aj + paddingLeft) - this.ae, i8, this.aj + paddingLeft);
} else {
this.o.layout(paddingRight, (this.aj + paddingLeft) - this.ae, i8, this.aj + paddingLeft);
}
}
if (a(this.n) || a(this.o)) {
paddingLeft += this.aj;
}
if (a(this.Q)) {
this.Q.layout(i6, paddingLeft, i8, this.af + paddingLeft);
}
}
public final void adjustListItemSelectionBounds(Rect rect) {
if (this.v) {
rect.top += this.ak.top;
rect.bottom = rect.top + this.ak.height();
rect.left = this.ak.left;
rect.right = this.ak.right;
}
}
private static boolean a(View view) {
return view != null && view.getVisibility() == 0;
}
final LayoutParams a() {
LayoutParams generateDefaultLayoutParams = generateDefaultLayoutParams();
generateDefaultLayoutParams.width = this.S;
generateDefaultLayoutParams.height = generateDefaultLayoutParams.width;
return generateDefaultLayoutParams;
}
protected final void drawableStateChanged() {
super.drawableStateChanged();
if (this.u) {
this.H.setState(getDrawableState());
}
}
protected final boolean verifyDrawable(Drawable drawable) {
return drawable == this.H || super.verifyDrawable(drawable);
}
public final void jumpDrawablesToCurrentState() {
super.jumpDrawablesToCurrentState();
if (this.u) {
this.H.jumpToCurrentState();
}
}
public final void dispatchDraw(Canvas canvas) {
if (this.u && isActivated()) {
this.H.draw(canvas);
}
super.dispatchDraw(canvas);
}
public final void a(String str) {
if (!TextUtils.isEmpty(str)) {
if (this.O == null) {
this.O = new TextView(getContext());
this.O.setTextAppearance(getContext(), buf.gX);
this.O.setGravity(aix.b(this) ? 5 : 3);
addView(this.O);
}
a(this.O, (CharSequence) str);
this.O.setVisibility(0);
this.O.setAllCaps(true);
} else if (this.O != null) {
this.O.setVisibility(8);
}
}
public final ImageView b() {
if (this.P == null) {
this.P = new ImageView(getContext());
this.P.setLayoutParams(a());
this.P.setBackground(null);
addView(this.P);
this.t = false;
}
return this.P;
}
public final void a(boolean z, boolean z2) {
this.t = false;
this.V = z;
this.W = z2;
if (this.P != null) {
removeView(this.P);
this.P = null;
}
if (this.l != null) {
removeView(this.l);
this.l = null;
}
}
public final TextView c() {
if (this.n == null) {
this.n = new TextView(getContext());
this.n.setLayoutParams(new LayoutParams(-2, -2));
this.n.setSingleLine(true);
this.n.setEllipsize(TruncateAt.MARQUEE);
this.n.setTextAppearance(getContext(), buf.gY);
if (this.i == adu.a) {
this.n.setAllCaps(true);
} else {
this.n.setTypeface(this.n.getTypeface(), 1);
}
this.n.setActivated(isActivated());
this.n.setId(cob.q);
addView(this.n);
}
return this.n;
}
public final TextView d() {
if (this.o == null) {
this.o = new TextView(getContext());
this.o.setSingleLine(true);
this.o.setEllipsize(TruncateAt.MARQUEE);
this.o.setTextAppearance(getContext(), buf.gY);
this.o.setTextAlignment(5);
this.o.setActivated(isActivated());
this.o.setId(cob.p);
if (abw.h()) {
this.o.setElegantTextHeight(false);
}
addView(this.o);
}
return this.o;
}
public final void b(String str) {
if (!TextUtils.isEmpty(str)) {
acx acx = this.b;
if (this.Q == null) {
this.Q = new TextView(getContext());
this.Q.setSingleLine(true);
this.Q.setEllipsize(TruncateAt.MARQUEE);
this.Q.setTextAppearance(getContext(), 16973894);
this.Q.setTextAlignment(5);
this.Q.setActivated(isActivated());
addView(this.Q);
}
acx.a(this.Q, str, this.e);
this.Q.setVisibility(0);
if (aim.a((CharSequence) str)) {
this.Q.setContentDescription(buf.a((CharSequence) str));
} else {
this.Q.setContentDescription(null);
}
} else if (this.Q != null) {
this.Q.setVisibility(8);
}
}
public final void b(boolean z) {
int i = 0;
if (this.R != null) {
ImageView imageView = this.R;
if (!z) {
i = 8;
}
imageView.setVisibility(i);
} else if (z) {
this.R = new ImageView(getContext());
addView(this.R);
this.R.setImageResource(buf.dg);
this.R.setScaleType(ScaleType.CENTER_INSIDE);
this.R.setVisibility(0);
}
}
static TruncateAt e() {
return TruncateAt.MARQUEE;
}
public final void a(Cursor cursor, int i) {
a(cursor.getString(i));
if (this.l != null) {
this.l.setContentDescription(getContext().getString(buf.ey, new Object[]{this.m.getText()}));
}
}
public final void a(CharSequence charSequence) {
if (TextUtils.isEmpty(charSequence)) {
charSequence = this.w;
} else if (this.e != null) {
charSequence = this.b.a(charSequence, this.e);
} else if (this.c.size() != 0) {
CharSequence spannableString = new SpannableString(charSequence);
Iterator it = this.c.iterator();
while (it.hasNext()) {
adt adt = (adt) it.next();
this.b.a((SpannableString) spannableString, adt.a, adt.b);
}
charSequence = spannableString;
}
if (this.m == null) {
this.m = new TextView(getContext());
this.m.setSingleLine(true);
this.m.setEllipsize(TruncateAt.MARQUEE);
this.m.setTextColor(this.ab);
this.m.setTextSize(0, (float) this.F);
this.m.setActivated(isActivated());
this.m.setGravity(16);
this.m.setTextAlignment(5);
this.m.setId(cob.r);
if (abw.h()) {
this.m.setElegantTextHeight(false);
}
addView(this.m);
}
a(this.m, charSequence);
if (aim.a(charSequence)) {
this.m.setTextDirection(3);
this.m.setContentDescription(buf.a(charSequence.toString()));
return;
}
this.m.setContentDescription(charSequence.toString());
}
static String a(String str, int i, int i2) {
int i3;
int i4 = i;
int i5 = i2;
while (i4 < str.length()) {
if (!Character.isLetterOrDigit(str.charAt(i4))) {
break;
}
i5--;
i4++;
}
i4 = i;
i5 = i2;
int i6 = i5;
int i7 = i5;
i5 = i;
for (i3 = i - 1; i3 >= 0 && i6 > 0; i3--) {
if (!Character.isLetterOrDigit(str.charAt(i3))) {
i5 = i3;
i7 = i6;
}
i6--;
}
for (i3 = i4; i3 < str.length() && i7 > 0; i3++) {
if (!Character.isLetterOrDigit(str.charAt(i3))) {
i4 = i3;
}
i7--;
}
StringBuilder stringBuilder = new StringBuilder();
if (i5 > 0) {
stringBuilder.append("...");
}
stringBuilder.append(str.substring(i5, i4));
if (i4 < str.length()) {
stringBuilder.append("...");
}
return stringBuilder.toString();
}
public final void requestLayout() {
forceLayout();
}
public final void a(int i) {
ImageView b = b();
b.setScaleType(ScaleType.CENTER);
Drawable a = gd.a(getContext(), i);
int c = gd.c(getContext(), buf.cH);
if (abw.h()) {
b.setImageDrawable(a);
b.setImageTintList(ColorStateList.valueOf(c));
return;
}
a = gr.e(a).mutate();
gr.a(a, c);
b.setImageDrawable(a);
}
public final boolean onTouchEvent(MotionEvent motionEvent) {
float x = motionEvent.getX();
float y = motionEvent.getY();
if (!this.ak.contains((int) x, (int) y)) {
boolean z;
if (x < ((float) this.K) || x >= ((float) this.L) || y < 0.0f || y >= ((float) (getBottom() - getTop()))) {
z = false;
} else {
z = true;
}
if (z) {
return true;
}
}
return super.onTouchEvent(motionEvent);
}
final void a(TextView textView, CharSequence charSequence) {
if (TruncateAt.MARQUEE == TruncateAt.MARQUEE) {
CharSequence spannableString = new SpannableString(charSequence);
spannableString.setSpan(TruncateAt.MARQUEE, 0, spannableString.length(), 33);
textView.setText(spannableString);
return;
}
textView.setText(charSequence);
}
}
| [
"chu.rachelh@gmail.com"
] | chu.rachelh@gmail.com |
187e95d945f37761ca4b5173b3338529f32dcbd2 | 38d12cad57f6eec69e19d7770da95dea97220262 | /camera/code/java/com/demo/demos/render/CameraPreviewRender.java | f093c85e2c5af6c03922f8c8b8f8f75b2895a017 | [] | no_license | ohhhyeahhh/learn_android | 8c6bc4e153faa38f350787d566b9001772188a0a | 70af915d907cb3ee941d3eb84c8303de87beb12e | refs/heads/master | 2021-02-20T17:41:35.695927 | 2020-09-26T08:15:34 | 2020-09-26T08:15:34 | 245,342,829 | 3 | 16 | null | 2020-05-07T02:52:55 | 2020-03-06T06:07:54 | Java | UTF-8 | Java | false | false | 6,906 | java | package com.demo.demos.render;
import android.graphics.Bitmap;
import android.graphics.SurfaceTexture;
import android.opengl.GLSurfaceView;
import android.opengl.Matrix;
import android.os.Environment;
import android.util.Log;
import com.demo.demos.filter.ColorFilter;
import com.demo.demos.filter.CameraFilter;
import com.demo.demos.utils.MatrixUtil;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;
import static android.opengl.GLES20.glReadPixels;
import static android.opengl.GLES30.*;
import static com.demo.demos.utils.CommonUtil.TAG;
/**
* Created by wangyt on 2019/5/21
*/
public class CameraPreviewRender implements GLSurfaceView.Renderer {
boolean useFront = false;
float[] matrix = new float[16];
boolean takingPhoto = false;
boolean recordingVideo = false;
SurfaceTexture surfaceTexture;
int[] cameraTexture = new int[1];
CameraFilter cameraFilter;
ColorFilter colorFilter;
int width, height;
int[] exportFrame = new int[1];
int[] exportTexture = new int[1];
public CameraPreviewRender() {
cameraFilter = new CameraFilter();
colorFilter = new ColorFilter();
}
public void setUseFront(boolean useFront) {
if (this.useFront != useFront) {
this.useFront = useFront;
cameraFilter.setUseFront(useFront);
matrix = MatrixUtil.flip(matrix, true, false);
}
}
public SurfaceTexture getSurfaceTexture() {
return surfaceTexture;
}
public boolean isTakingPhoto() {
return takingPhoto;
}
public void setTakingPhoto(boolean takingPhoto) {
this.takingPhoto = takingPhoto;
}
public boolean isRecordingVideo() {
return recordingVideo;
}
public void setRecordingVideo(boolean recordingVideo) {
this.recordingVideo = recordingVideo;
}
@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
createTexture();
surfaceTexture = new SurfaceTexture(cameraTexture[0]);
cameraFilter.onSurfaceCreated();
colorFilter.onSurfaceCreated();
matrix = MatrixUtil.flip(colorFilter.getMatrix(), false, true);
colorFilter.setMatrix(matrix);
}
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
if (this.width != width || this.height != height) {
this.width = width;
this.height = height;
cameraFilter.onSurfaceChanged(width, height);
colorFilter.onSurfaceChanged(width, height);
delFrameBufferAndTexture();
genFrameBufferAndTexture();
}
}
@Override
public void onDrawFrame(GL10 gl) {
if (surfaceTexture != null) {
surfaceTexture.updateTexImage();
}
cameraFilter.setTextureId(cameraTexture);
cameraFilter.onDraw();
colorFilter.setTextureId(cameraFilter.getOutputTextureId());
if (isTakingPhoto()) {
ByteBuffer exportBuffer = ByteBuffer.allocate(width * height * 4);
bindFrameBufferAndTexture();
colorFilter.setMatrix(MatrixUtil.flip(matrix, false, true));
colorFilter.onDraw();
glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, exportBuffer);
savePhoto(exportBuffer);
unBindFrameBuffer();
setTakingPhoto(false);
colorFilter.setMatrix(MatrixUtil.flip(matrix, false, true));
} else {
colorFilter.onDraw();
}
}
private void createTexture() {
glGenTextures(cameraTexture.length, cameraTexture, 0);
}
public void delFrameBufferAndTexture() {
glDeleteFramebuffers(exportFrame.length, exportFrame, 0);
glDeleteTextures(exportTexture.length, exportTexture, 0);
}
public void genFrameBufferAndTexture() {
glGenFramebuffers(exportFrame.length, exportFrame, 0);
glGenTextures(exportTexture.length, exportTexture, 0);
glBindTexture(GL_TEXTURE_2D, exportTexture[0]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, null);
setTextureParameters();
glBindTexture(GL_TEXTURE_2D, 0);
}
public void setTextureParameters() {
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
}
public void bindFrameBufferAndTexture() {
glBindFramebuffer(GL_FRAMEBUFFER, exportFrame[0]);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, exportTexture[0], 0);
}
public void unBindFrameBuffer() {
glBindFramebuffer(GL_FRAMEBUFFER, 0);
}
// public ByteBuffer getPixelBuffer(){
// final ByteBuffer buffer = ByteBuffer.allocate(width * height * 4);
// glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
// return buffer;
// }
public void savePhoto(final ByteBuffer buffer) {
new Thread(new Runnable() {
@Override
public void run() {
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
bitmap.copyPixelsFromBuffer(buffer);
String folderPath = Environment.getExternalStorageDirectory() + "/DCIM/Camera/";
File folder = new File(folderPath);
if (!folder.exists() && !folder.mkdirs()) {
Log.e("demos", "图片目录异常");
return;
}
String filePath = folderPath + System.currentTimeMillis() + ".jpg";
BufferedOutputStream bos = null;
try {
FileOutputStream fos = new FileOutputStream(filePath);
bos = new BufferedOutputStream(fos);
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, bos);
} catch (FileNotFoundException e) {
e.printStackTrace();
} finally {
if (bos != null) {
try {
bos.flush();
bos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (bitmap != null) {
bitmap.recycle();
}
}
}
}).start();
}
}
| [
"347006087@qq.com"
] | 347006087@qq.com |
657a961621e34386acde7a5d0019cf5f95663ec4 | b3633e3ec170e10ffaf07f7125d1bc17ff2b462f | /Benchmarks/ph-commons-ph-commons-parent-pom-9.3.9-patched/ph-commons/src/test/java/com/helger/commons/lang/ClassHierarchyCacheTest.java | 0ea9311ebc246b213d88729e3938d25086572f65 | [
"Apache-2.0"
] | permissive | dliang2000/hierarchy_analysis | 23c30460050a2451606adf28cc1e09fc101e7457 | 4083b4c9e0daaf519cd1c3f37c4379bf97da9329 | refs/heads/master | 2022-05-31T02:01:24.776781 | 2021-03-30T20:39:58 | 2021-03-30T20:39:58 | 231,459,166 | 1 | 0 | null | 2022-05-20T21:58:23 | 2020-01-02T21:03:00 | Java | UTF-8 | Java | false | false | 2,503 | java | /**
* Copyright (C) 2014-2019 Philip Helger (www.helger.com)
* philip[at]helger[dot]com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.helger.commons.lang;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.Serializable;
import java.util.Collection;
import org.junit.Test;
import com.helger.commons.CGlobal;
import com.helger.commons.id.IHasID;
import com.helger.commons.type.IHasObjectType;
import com.helger.commons.type.ITypedObject;
import com.helger.commons.type.TypedObject;
/**
* Test class for class {@link ClassHierarchyCache}.
*
* @author Philip Helger
*/
public final class ClassHierarchyCacheTest
{
@Test
public void testGetClassHierarchy ()
{
// Very basic class
Collection <Class <?>> aHierarchy = ClassHierarchyCache.getClassHierarchy (Object.class);
assertEquals (1, aHierarchy.size ());
assertTrue (aHierarchy.contains (Object.class));
// More sophisticated static class (no interfaces)
aHierarchy = ClassHierarchyCache.getClassHierarchy (CGlobal.class);
// Is usually 2, but with Cobertura enabled, it is 3!
assertTrue (aHierarchy.size () >= 2);
assertTrue (aHierarchy.contains (CGlobal.class));
assertTrue (aHierarchy.contains (Object.class));
// More sophisticated static class (with interfaces)
aHierarchy = ClassHierarchyCache.getClassHierarchy (TypedObject.class);
assertTrue (aHierarchy.size () >= 6);
assertTrue (aHierarchy.contains (TypedObject.class));
assertTrue (aHierarchy.contains (IHasObjectType.class));
assertTrue (aHierarchy.contains (ITypedObject.class));
assertTrue (aHierarchy.contains (IHasID.class));
assertTrue (aHierarchy.contains (Object.class));
assertTrue (aHierarchy.contains (Serializable.class));
try
{
ClassHierarchyCache.getClassHierarchy (null);
fail ();
}
catch (final NullPointerException ex)
{}
}
}
| [
"q8liang@uwaterloo.ca"
] | q8liang@uwaterloo.ca |
ec58d1f739b766c0f1e80d97c9327a9f2e187470 | 35ada520817e468a1dc936c54323faa01aaeadbe | /Exploring-Java-8/src/in/explore/core/java8/streams/MenuOperations.java | a8378793349433fe4fa1d43ad812c18a88b09d47 | [] | no_license | prashantrr143/core-java-8 | 40bbf16c8aecc8613180e81b355ff9cfc418c568 | 53d06ccd1ace95ea29b08797f54198204aa34fa6 | refs/heads/master | 2020-06-23T16:56:58.657514 | 2018-07-06T06:44:00 | 2018-07-06T06:44:00 | 74,643,053 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,543 | java | package in.explore.core.java8.streams;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.Function;
import java.util.stream.Collector;
import in.explore.core.java8.streams.domain.CaloricLevel;
import in.explore.core.java8.streams.domain.Dish;
import in.explore.core.java8.streams.domain.DishType;
import in.explore.core.java8.streams.domain.MenuFactory;
import static java.util.stream.Collectors.*;
import static java.util.Comparator.*;
public class MenuOperations {
public void groupDishesByType(List<Dish> menu) {
Map<DishType, List<Dish>> map = menu.stream().collect(groupingBy(Dish::getType));
System.out.println("Dishes Grouped by their types \n " + map);
}
public void getMaxCaloricDishGroupedByType(List<Dish> menu) {
Map<DishType, Optional<Dish>> map = menu.stream()
.collect(groupingBy(Dish::getType, maxBy(comparingInt(Dish::getCalories))));
for (Map.Entry<DishType, Optional<Dish>> entry : map.entrySet()) {
System.out.println(entry.getKey());
System.out.println(entry.getValue().get());
}
}
public void getMaxCaloricDishGroupedByTypeWithOutOptional(List<Dish> menu) {
Map<DishType, Dish> map = menu.stream().collect(
groupingBy(Dish::getType, collectingAndThen(maxBy(comparingInt(Dish::getCalories)), Optional::get)));
}
// Multi Level Grouping
public void groupDishesByTypeAndCaloricLevel(List<Dish> menu) {
Map<DishType, Map<CaloricLevel, List<Dish>>> map =
menu.stream().collect(groupingBy(Dish::getType, groupingBy(d -> {
if (d.getCalories() <= 400)
return CaloricLevel.DIET;
else if (d.getCalories() <= 700)
return CaloricLevel.NORMAL;
else
return CaloricLevel.FAT;
})));
System.out.println("Dishes Grouped by their types and then grouped by caloric level \n " + map);
}
public void getDishesCountByDishType(List<Dish> menu) {
Map<DishType, Long> map = menu.stream().collect(groupingBy(Dish::getType, counting()));
System.out.println("Dishes Grouped by their types and their count \n " + map);
}
public static void main(String args[]) {
MenuOperations operations = new MenuOperations();
/*
* operations.groupDishesByType(MenuFactory.createMenu());
* operations.getDishesCountByDishType(MenuFactory.createMenu());
* operations.groupDishesByTypeAndCaloricLevel(MenuFactory.createMenu())
* ;
*/
operations.getMaxCaloricDishGroupedByType(MenuFactory.createMenu());
}
}
| [
"prashant.siet153@gmail.com"
] | prashant.siet153@gmail.com |
c9bfd479c590eda326f35b2cd76f12e283bc3be4 | fd431c99a3cefebe3556fa30ce3768f904128496 | /JF-THIRD-PAY/pay_component/src/main/java/com/pay/business/order/service/impl/Payv2PayOrderClearServiceImpl.java | c90fd62f0ab031f5f12de2acc6645e67c22b0e5a | [] | no_license | liushengmz/scpc | d2140cb24d0af16c39e4fef4c0cd1422b144e238 | f760bf2c3b1ec45fd06d0d89018a3bfae3c9748c | refs/heads/master | 2021-06-19T15:49:59.928248 | 2018-10-16T08:24:18 | 2018-10-16T08:24:18 | 95,423,982 | 2 | 4 | null | 2017-06-28T02:35:14 | 2017-06-26T08:13:22 | null | UTF-8 | Java | false | false | 79,783 | java | package com.pay.business.order.service.impl;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.Charset;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import com.alipay.api.request.AlipayDataDataserviceBillDownloadurlQueryRequest;
import com.alipay.api.response.AlipayDataDataserviceBillDownloadurlQueryResponse;
import com.core.teamwork.base.service.impl.BaseServiceImpl;
import com.core.teamwork.base.util.date.DateStyle;
import com.core.teamwork.base.util.date.DateUtil;
import com.core.teamwork.base.util.ftp.FtpUploadClient;
import com.core.teamwork.base.util.insertid.ZipUtil;
import com.core.teamwork.base.util.page.PageHelper;
import com.core.teamwork.base.util.page.PageObject;
import com.csvreader.CsvReader;
import com.pay.business.merchant.entity.Payv2BussCompany;
import com.pay.business.merchant.entity.Payv2BussCompanyApp;
import com.pay.business.merchant.entity.Payv2BussCompanyShop;
import com.pay.business.merchant.mapper.Payv2BussCompanyAppMapper;
import com.pay.business.merchant.mapper.Payv2BussCompanyMapper;
import com.pay.business.merchant.mapper.Payv2BussCompanyShopMapper;
import com.pay.business.order.entity.OrderClearVO;
import com.pay.business.order.entity.Payv2PayOrder;
import com.pay.business.order.entity.Payv2PayOrderClear;
import com.pay.business.order.entity.Payv2PayOrderRefund;
import com.pay.business.order.entity.Payv2PayOrderVO;
import com.pay.business.order.mapper.Payv2PayOrderClearMapper;
import com.pay.business.order.mapper.Payv2PayOrderMapper;
import com.pay.business.order.mapper.Payv2PayOrderRefundMapper;
import com.pay.business.order.service.Payv2PayOrderClearService;
import com.pay.business.payway.entity.Payv2PayWay;
import com.pay.business.payway.entity.Payv2PayWayRate;
import com.pay.business.payway.mapper.Payv2PayWayMapper;
import com.pay.business.payway.mapper.Payv2PayWayRateMapper;
import com.pay.business.record.entity.Payv2BillDown;
import com.pay.business.record.entity.Payv2BussWayDetail;
import com.pay.business.record.entity.Payv2DayCompanyClear;
import com.pay.business.record.mapper.Payv2BillDownMapper;
import com.pay.business.record.mapper.Payv2BussWayDetailMapper;
import com.pay.business.record.mapper.Payv2DayCompanyClearMapper;
import com.pay.business.util.CSVUtils;
import com.pay.business.util.DecimalUtil;
import com.pay.business.util.PayRateDictValue;
import com.pay.business.util.alipay.AliPay;
import com.pay.business.util.alipay.PayConfigApi;
import com.pay.business.util.hfbpay.WeChatSubscrip.pay.HfbWeChatPay;
import com.pay.business.util.minshengbank.HttpMinshengBank;
import com.pay.business.util.pinganbank.pay.PABankPay;
import com.pay.business.util.pinganbank.pay.PANOrderVo;
import com.pay.business.util.wftpay.WftWeChatPay;
import com.pay.business.util.xyBankWeChatPay.XyBankPay;
import com.pay.business.util.xyShenzhen.XYSZBankPay;
import javassist.expr.NewArray;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
/**
* @author cyl
* @version
*/
@Service("payv2PayOrderClearService")
public class Payv2PayOrderClearServiceImpl extends BaseServiceImpl<Payv2PayOrderClear, Payv2PayOrderClearMapper> implements Payv2PayOrderClearService {
private static final Logger LOGGER = Logger.getLogger(Payv2PayOrderClearServiceImpl.class);
// 注入当前dao对象
@Autowired
private Payv2PayOrderClearMapper payv2PayOrderClearMapper;
@Autowired
private Payv2PayOrderMapper payv2PayOrderMapper;
@Autowired
private Payv2BussCompanyMapper payv2BussCompanyMapper;
@Autowired
private Payv2BussCompanyAppMapper payv2BussCompanyAppMapper;
@Autowired
private Payv2BussCompanyShopMapper payv2BussCompanyShopMapper;
@Autowired
private Payv2PayWayMapper payv2PayWayMapper;
@Autowired
private Payv2BillDownMapper payv2BillDownMapper;
@Autowired
private Payv2PayOrderRefundMapper payv2PayOrderRefundMapper;
@Autowired
private Payv2PayWayRateMapper payv2PayWayRateMapper;
@Autowired
private Payv2DayCompanyClearMapper payv2DayCompanyClearMapper;
@Autowired
private Payv2BussWayDetailMapper payv2BussWayDetailMapper;
public Payv2PayOrderClearServiceImpl() {
setMapperClass(Payv2PayOrderClearMapper.class, Payv2PayOrderClear.class);
}
/**
* 调用支付宝接口,查询对账单下载地址
*
* @param time
* @return
* @throws Exception
*/
private AlipayDataDataserviceBillDownloadurlQueryResponse getAlipayResponse(String time, String appId, String pkcsb_private, String aplipay_rsa_public)
throws Exception {
AlipayClient alipayClient = new DefaultAlipayClient(PayConfigApi.MOBILEPAY_SERVICE, appId, pkcsb_private, PayConfigApi.FORMAT, PayConfigApi.CHARSET,
aplipay_rsa_public);
AlipayDataDataserviceBillDownloadurlQueryRequest request = new AlipayDataDataserviceBillDownloadurlQueryRequest();
request.setBizContent("{" + " \"bill_type\":\"trade\"," + " \"bill_date\":\"" + time + "\"" + " }");
AlipayDataDataserviceBillDownloadurlQueryResponse response = alipayClient.execute(request);
return response;
}
/**
* 调用支付宝接口,查询对账单下载地址
*
* @param time
* @return
* @throws Exception
*/
private AlipayDataDataserviceBillDownloadurlQueryResponse getAlipayResponse(String time, String appId, String pkcsb_private, String aplipay_rsa_public,
String singType) throws Exception {
AlipayClient alipayClient = new DefaultAlipayClient(PayConfigApi.MOBILEPAY_SERVICE, appId, pkcsb_private, PayConfigApi.FORMAT, PayConfigApi.CHARSET,
aplipay_rsa_public, singType);
AlipayDataDataserviceBillDownloadurlQueryRequest request = new AlipayDataDataserviceBillDownloadurlQueryRequest();
request.setBizContent("{" + " \"bill_type\":\"trade\"," + " \"bill_date\":\"" + time + "\"" + " }");
AlipayDataDataserviceBillDownloadurlQueryResponse response = alipayClient.execute(request);
return response;
}
/**
* 获取压缩包的 名字
*
* @param con
* @return
* @throws Exception
*/
private String getFileName(HttpURLConnection con) throws Exception {
boolean isok = false;
String filename = "";
con.setInstanceFollowRedirects(false);
con.setUseCaches(false);
con.setAllowUserInteraction(false);
con.connect();
Map<String, List<String>> hf = con.getHeaderFields();
if (hf == null) {
System.out.println("hf is null");
}
Set<String> key = hf.keySet();
if (key == null) {
System.out.println("key is null");
}
for (String skey : key) {
List<String> values = hf.get(skey);
for (String value : values) {
String result;
result = new String(value.getBytes("ISO-8859-1"), "GBK");
int location = result.indexOf("filename");
if (location >= 0) {
result = result.substring(location + "filename".length());
filename = result.substring(result.indexOf("=") + 1);
isok = true;
}
}
if (isok) {
break;
}
}
return filename;
}
/**
* 获取包是数据下载地址
*
* @param response
* @return
*/
private String getDownloadurl(AlipayDataDataserviceBillDownloadurlQueryResponse response) {
JSONObject jsonObject = JSONObject.fromObject(response.getBody());
String urlString = jsonObject.getString("alipay_data_dataservice_bill_downloadurl_query_response");
JSONObject jsonObject2 = JSONObject.fromObject(urlString);
String downloadurl = jsonObject2.getString("bill_download_url");
return downloadurl;
}
/**
* 把download下来的zip包文件保存本地
*
* @param con
* @param tempZipPathFileName
* @throws Exception
*/
private void writeDataToTempZip(HttpURLConnection con, String tempZipPathFileName) throws Exception {
// 得到输入流
InputStream inputStream = con.getInputStream();
// 获取自己数组
byte[] getData = readInputStream(inputStream);
File file = new File(tempZipPathFileName);
FileOutputStream fos = new FileOutputStream(file);
fos.write(getData);
if (fos != null) {
fos.close();
}
if (inputStream != null) {
inputStream.close();
}
}
/**
* 获取解压后要读取的csv文件名称
*
* @param alipayFile
* @return
*/
private String getNeedReadAlipayFile(String readTempZipPathFileName) {
File alipayFile = new File(readTempZipPathFileName);
String alipayFileName = "";
File[] array = alipayFile.listFiles();
for (int i = 0; i < array.length; i++) {
if (array[i].isFile() && array[i].getName().indexOf("(") == -1) {
alipayFileName = array[i].getName();
}
}
return alipayFileName;
}
/**
* 根据订单封装清单对象
*
* @param pav2PayOrderObjMap
* @param alipayOrderNum
* @param alipayMoney
* @return
*/
private Payv2PayOrderClear getOrderClearByOrder(Map<String, Object> pav2PayOrderObjMap, String alipayOrderNum, String alipayMoney, String alipayOrderType,
String payType, Date finishedTimeDate, Double rateValue) {
Payv2PayOrderClear clear = new Payv2PayOrderClear();
Payv2PayOrder payv2PayOrder = (Payv2PayOrder) pav2PayOrderObjMap.get(alipayOrderNum);
if (StringUtils.isNotEmpty(payv2PayOrder.getMerchantOrderNum())) {
clear.setMerchantOrderNum(payv2PayOrder.getMerchantOrderNum());// 商家订单号
}
if (StringUtils.isNotEmpty(payv2PayOrder.getOrderNum())) {
clear.setOrderNum(payv2PayOrder.getOrderNum());// 支付集订单号
}
if (payv2PayOrder.getCompanyId() != null) {
clear.setCompanyId(payv2PayOrder.getCompanyId());// 商户id,关联payv2_buss_company表
}
if (payv2PayOrder.getAppId() != null) {
clear.setAppId(payv2PayOrder.getAppId());// 应用id,关联payv2_buss_company_app或payv2_buss_company_shop表
}
if (payv2PayOrder.getPayWayId() != null) {
clear.setPayWayId(payv2PayOrder.getPayWayId());// 支付渠道,关联payv2_pay_way表
}
if (payv2PayOrder.getOrderType() > 0) {
clear.setMerchantType(payv2PayOrder.getOrderType());// 商户类型1.线上2.线下
}
clear.setType(1);// 类型1.交易2.退款
if (StringUtils.isNotEmpty(payv2PayOrder.getOrderName())) {
clear.setOrderName(payv2PayOrder.getOrderName());// 订单名称
}
clear.setCreateTime(new Date());
double paymoney = Double.valueOf(alipayMoney);
if (payv2PayOrder.getPayMoney() != null && payv2PayOrder.getPayDiscountMoney().doubleValue() == paymoney) {
clear.setStatus(1);// 订单正常
if (payv2PayOrder.getPayStatus().intValue() != 1&&payv2PayOrder.getPayStatus().intValue() != 5) {
clear.setStatus(3);// 记录可能异常订单
// 更新订单状态
Payv2PayOrder der = new Payv2PayOrder();
der.setId(payv2PayOrder.getId());
der.setPayStatus(1);// 成功
System.out.println(finishedTimeDate);
der.setPayTime(finishedTimeDate);
payv2PayOrder.setPayDiscountMoney(paymoney);
payv2PayOrder.setPayTime(finishedTimeDate);
payv2PayOrderMapper.updateByEntity(der);
}
payv2PayOrder.setAlipayOrderType(alipayOrderType);// 对账单类型
payv2PayOrder.setPayType(payType);// 支付类型
if (payv2PayOrder.getPayTime() == null) {
payv2PayOrder.setPayTime(finishedTimeDate);
}
clear.setOrderMoney(payv2PayOrder.getPayMoney());
} else {
clear.setStatus(2);// 订单异常
clear.setOrderMoney(payv2PayOrder.getPayMoney());
}
return clear;
}
/**
* 根据退款单和订单匹配数据 封装清单
*
* @param payv2PayOrderRefundObjMap
* @param pav2PayOrderObjMap
* @param time
* @param finishedTimeDate
* @param alipayMoney
* @param alipayOrderNum
* @return
*/
private Payv2PayOrderClear getOrderClearByOrderRefund(Map<String, Object> payv2PayOrderRefundObjMap, Map<String, Object> pav2PayOrderObjMap,
String refundNum, String alipayMoney, String alipayOrderNum, String alipayOrderType, String payType) {
Payv2PayOrderClear clear = new Payv2PayOrderClear();
Payv2PayOrderRefund payv2PayOrderRefund = (Payv2PayOrderRefund) payv2PayOrderRefundObjMap.get(refundNum);
if (payv2PayOrderRefund == null) {
return null;
}
Payv2PayOrder payv2PayOrder = (Payv2PayOrder) pav2PayOrderObjMap.get(payv2PayOrderRefund.getOrderNum());
if (payv2PayOrder != null) {
clear.setMerchantOrderNum(payv2PayOrder.getMerchantOrderNum());// 商家订单号
clear.setOrderNum(payv2PayOrder.getOrderNum());// 支付集订单号
clear.setRefundNum(refundNum);//退款订单号
clear.setCompanyId(payv2PayOrder.getCompanyId());// 商户id,关联payv2_buss_company表
clear.setAppId(payv2PayOrder.getAppId());// 应用id,关联payv2_buss_company_app或payv2_buss_company_shop表
clear.setPayWayId(payv2PayOrder.getPayWayId());// 支付渠道,关联payv2_pay_way表
clear.setMerchantType(payv2PayOrder.getOrderType());// 商户类型1.线上2.线下
clear.setType(2);// 类型1.交易2.退款
clear.setOrderName(payv2PayOrder.getOrderName());// 订单名称
clear.setCreateTime(new Date());
double paymoney = Double.valueOf(alipayMoney);
clear.setOrderMoney(payv2PayOrderRefund.getRefundMoney());
double refundMoney = payv2PayOrderRefund.getRefundMoney() == null ? 0 : payv2PayOrderRefund.getRefundMoney().doubleValue();
// 如果金额和时间都匹配 那么就是匹配上了
if (refundMoney == Math.abs(paymoney)) {
clear.setStatus(1);// 订单正常
payv2PayOrder.setAlipayOrderType(alipayOrderType);// 对账单业务类型
payv2PayOrder.setPayType(payType);// 支付类型
payv2PayOrder.setPayMoney(paymoney);
} else {
clear.setStatus(2);// 订单异常
}
}
return clear;
}
/**
* 对账:每天10点执行定时器去执行
*/
public void job(String alipayTime, String weixinTime, Map<String, Object> pav2PayOrderObjMap,
Map<String, Object> payv2PayOrderRefundObjMap, String payName, Payv2PayWayRate rate) throws Exception {
if (PayRateDictValue.PAY_TYPE_ALIPAY_APP.equals(rate.getDictName()) || PayRateDictValue.PAY_TYPE_ALIPAY_WEB.equals(rate.getDictName())) {
LOGGER.info("通道为:-----》" + rate.getDictName());
// 1.调用支付宝接口,查询对账单下载地址
AlipayDataDataserviceBillDownloadurlQueryResponse response = getAlipayResponse(alipayTime, rate.getRateKey1(), rate.getRateKey2(),
rate.getRateKey3());
if (response.isSuccess()) {
String downloadurl = getDownloadurl(response);
alipayHandle(downloadurl, alipayTime, pav2PayOrderObjMap, payv2PayOrderRefundObjMap, payName, rate.getPayWayRate());
} else {
LOGGER.error("调用失败");
}
}
// 支付宝扫码支付对账接口
else if (PayRateDictValue.PAY_TYPE_ALIPAY_SMZL.equals(rate.getDictName())) {
LOGGER.info("通道为:-----》" + rate.getDictName());
// 1.调用支付宝接口,查询对账单下载地址
AlipayDataDataserviceBillDownloadurlQueryResponse response = getAlipayResponse(alipayTime, rate.getRateKey1(), rate.getRateKey2(),
rate.getRateKey3(), "RSA2");
if (response.isSuccess()) {
String downloadurl = getDownloadurl(response);
alipayHandle(downloadurl, alipayTime, pav2PayOrderObjMap, payv2PayOrderRefundObjMap, payName, rate.getPayWayRate());
} else {
LOGGER.error("调用失败");
}
}
// 威富通统一对账接口
else if (PayRateDictValue.PAY_TYPE_WFT_WEIXIN.equals(rate.getDictName()) || PayRateDictValue.PAY_TYPE_WFT_WEIXIN_GZH.equals(rate.getDictName())) {
LOGGER.info("通道为:-----》" + rate.getDictName());
String orderArrs[] = WftWeChatPay.downloadOrder(weixinTime, rate.getRateKey1(), rate.getRateKey2());
wxHandle(orderArrs, weixinTime, pav2PayOrderObjMap, payv2PayOrderRefundObjMap, payName, rate.getPayWayRate());
}
//兴业深圳统一对账接口
else if (PayRateDictValue.PAY_TYPE_XYSZ_ALI_SCAN.equals(rate.getDictName()) || PayRateDictValue.PAY_TYPE_XYSZ_WEIXIN_SCAN.equals(rate.getDictName())
|| PayRateDictValue.PAY_TYPE_XYSZ_WEIXIN_WAP.equals(rate.getDictName())) {
LOGGER.info("通道为:-----》" + rate.getDictName());
LOGGER.info("======》兴业深圳对账开始");
try {
String[] xyszOderFind = XYSZBankPay.xyszOderFind(weixinTime, rate.getRateKey1(), rate.getRateKey2());
wxHandle(xyszOderFind, weixinTime, pav2PayOrderObjMap, payv2PayOrderRefundObjMap, payName, rate.getPayWayRate());
} catch (Exception e) {
LOGGER.error("======》兴业深圳对账失败,失败原因:" + e.getMessage());
e.printStackTrace();
}
}
// 兴业银行:微信对账接口查询:微信公众号,微信扫码
if (PayRateDictValue.PAY_TYPE_XYBANk_WEIXIN_GZH.equals(rate.getDictName())
||PayRateDictValue.PAY_TYPE_XYBANk_WEIXIN_SCAN.equals(rate.getDictName())
) {
LOGGER.info("通道为:-----》" + rate.getDictName());
LOGGER.info("======》兴业银行:微信对账开始");
String appid = rate.getRateKey1();
String mch_id = rate.getRateKey2();
String key = rate.getRateKey3();
LOGGER.info("======》对账商户号为:" + mch_id);
if (appid != null && mch_id != null & key != null) {
String str[] = XyBankPay.xyWechatStatement(appid, mch_id, key, weixinTime);
if (str != null) {
xyBankWechatHandle(str, weixinTime, pav2PayOrderObjMap, payv2PayOrderRefundObjMap, payName, rate.getPayWayRate());
} else {
LOGGER.error("调用失败");
}
} else {
LOGGER.error("===》兴业银行微信对账参数错误:商户号,appid,key为空,请检查数据库通道参数配置");
}
}
// 兴业银行:支付宝扫码对账接口查询
else if (PayRateDictValue.PAY_TYPE_XYBANk_ALI_SCAN.equals(rate.getDictName())) {
LOGGER.info("通道为:-----》" + rate.getDictName());
LOGGER.info("兴业银行:支付宝扫码对账开始");
String appid = rate.getRateKey1();
String mch_id = rate.getRateKey2();
String key = rate.getRateKey3();
LOGGER.info("======》对账商户号为:" + mch_id);
if (appid != null && mch_id != null & key != null) {
String str[] = AliPay.xyBankAliStatement(appid, mch_id, key, weixinTime);
if (str != null) {
xyBankAliHandle(str, weixinTime, pav2PayOrderObjMap, payv2PayOrderRefundObjMap, payName, rate.getPayWayRate());
} else {
LOGGER.error("调用失败");
}
} else {
LOGGER.error("===》兴业银行支付宝参数错误:商户号,appid,key为空,请检查数据库通道参数配置");
}
}
// 民生银行:对账接口(支持目前通道:微信扫码;支付宝扫码对账,微信公众号,qq)
else if (PayRateDictValue.PAY_TYPE_MSBANk_ALI_SCAN.equals(rate.getDictName())
||PayRateDictValue.PAY_TYPE_MSBANk_WEIXIN_SCAN.equals(rate.getDictName())
|| PayRateDictValue.PAY_TYPE_MSBANk_WEIXIN_GZH.equals(rate.getDictName())
|| PayRateDictValue.PAY_TYPE_MSBANk_QQ_SCAN.equals(rate.getDictName())) {
LOGGER.info("通道为:-----》" + rate.getDictName());
LOGGER.info("民生银行对账接口对账开始");
Map<String, Object> paramMap = new HashMap<String, Object>();
// 代理商户号:
String expanderId = rate.getRateKey3();
// 商户号
String customerId = rate.getRateKey1();
//获取加密文件名字;密码,:请注意在生成cer文件的时候,名字,密码,alias请保持一致
String thdSysNme=rate.getRateKey4();
LOGGER.info("======》对账商户号为:" + customerId);
if (expanderId != null && customerId != null&thdSysNme!=null) {
paramMap.put("expanderId", expanderId);
paramMap.put("customerId", customerId);
// 查询开始时间
paramMap.put("beginDate", alipayTime);
// 结束时间
paramMap.put("endDate", alipayTime);
// 服务商类型
paramMap.put("serviceProviderId", "YF");
// 日期类型:1-交易日期,2-清算日期
paramMap.put("dateType", "1");
// 交易类型:WX微信 ZFB:支付宝
if ( PayRateDictValue.PAY_TYPE_MSBANk_WEIXIN_SCAN.equals(rate.getDictName()) ||
PayRateDictValue.PAY_TYPE_MSBANk_WEIXIN_GZH.equals(rate.getDictName())) {
paramMap.put("channelId", "WX");
}
if (PayRateDictValue.PAY_TYPE_MSBANk_ALI_SCAN.equals(rate.getDictName())) {
paramMap.put("channelId", "ZFB");
}
if (PayRateDictValue.PAY_TYPE_MSBANk_QQ_SCAN.equals(rate.getDictName())) {
paramMap.put("channelId", "QQ");
}
// 获取相关配置
paramMap = HttpMinshengBank.getParams(paramMap,thdSysNme);
// 访问
String responseBody = HttpMinshengBank.msBankAliStatement(paramMap);
if (responseBody != null) {// 成功
// 解析:生成对账文件
MSBankHandle(responseBody, pav2PayOrderObjMap, payv2PayOrderRefundObjMap, payName, rate.getPayWayRate());
} else {// 失败
LOGGER.error("调用失败");
}
} else {
LOGGER.error("===》民生银行对账接口参数错误:RateKey1,RateKey3,RateKey4不能为空,请检查数据库通道数据是否填写完整");
}
}
// 汇付宝对账接口:汇付宝只提供成功的订单数据(支持微信与支付宝账单)
else if (PayRateDictValue.PAY_TYPE_HFB_WEIXIN_GZH.equals(rate.getDictName())
|| PayRateDictValue.PAY_TYPE_HFB_WX_WEB.equals(rate.getDictName())
|| PayRateDictValue.PAY_TYPE_HFB_WX_SDK.equals(rate.getDictName())
|| PayRateDictValue.PAY_TYPE_HFB_ALI_SDK.equals(rate.getDictName())) {
LOGGER.info("通道为:-----》" + rate.getDictName());
LOGGER.info("汇付宝对账开始");
int version = 2;
String agent_id = rate.getRateKey1();
// RateKey4:代表:对账需要的key
String key = rate.getRateKey4();
// 支付类型:62=认证支付,20=网银支付,18=快捷支付,0=所有支付
int pay_type = 0;
// 格式为yyyyMMddHHmmss,比如 20140701110000
String begin_time = weixinTime + "000000";
// 格式为yyyyMMddHHmmss,比如 20140701110000
String end_time = weixinTime + "235959";
// 分页查询记录数量,最大500条
int page_size = 500;
// 分页查询页码
int page_index = 1;
LOGGER.info("======》对账商户号为:" + agent_id);
if (agent_id != null && key != null) {
// 访问
String[] responseBody = HfbWeChatPay.hfbStatement(version, agent_id, key, pay_type, begin_time, end_time, page_size, page_index);
if (responseBody != null) {
// 解析:生成对账文件
HFBHandle(responseBody, pav2PayOrderObjMap, payv2PayOrderRefundObjMap, payName, rate.getPayWayRate());
} else {
LOGGER.error("调用失败");
}
} else {
LOGGER.error("===》汇付宝对账参数错误:商户号或者商户key为空,请检查数据库通道数据是否填写完整");
}
}
//平安银行对账接口:微信,支付宝
else if(PayRateDictValue.PAY_TYPE_PABANk_WEIXIN_SCAN.equals(rate.getDictName())
||PayRateDictValue.PAY_TYPE_PABANk_ALI_SCAN.equals(rate.getDictName())
||PayRateDictValue.PAY_TYPE_PA_BANK_QQ_SCAN.equals(rate.getDictName())
){
LOGGER.info("通道为:-----》" + rate.getDictName());
LOGGER.info("平安银行对账开始");
String OPEN_ID=rate.getRateKey1();
String OPEN_KEY=rate.getRateKey2();
if(OPEN_ID!=null&&OPEN_KEY!=null){
//开发者流水号
String outNo=null;
//交易号
String tradeNo=null;
//付款订单号
String ordNo=null;
//交易方式
String pmtTag=null;
if(PayRateDictValue.PAY_TYPE_PABANk_WEIXIN_SCAN.equals(rate.getDictName())){
pmtTag = "Weixin";
}
if(PayRateDictValue.PAY_TYPE_PABANk_ALI_SCAN.equals(rate.getDictName())){
pmtTag = "AlipayPAZH";
}
if(PayRateDictValue.PAY_TYPE_PA_BANK_QQ_SCAN.equals(rate.getDictName()))
{
pmtTag = "QQ_SCAN";
}
//交易类型:1交易 2:退款:这里不限制
String ordType=null;
//订单状态(1交易成功,2待支付,4已取消,9等待用户输入密码确认)这
//对账只查交易成功的状态的订单
String status="1";
//查询开始时间:yyy-MM-dd HH:mm:ss
String sdate=alipayTime+" 00:00:00";
//查询结束时间
String edate=alipayTime+" 23:59:59";
List<PANOrderVo> voList=PABankPay.queryOrderList(outNo, tradeNo, ordNo, pmtTag, ordType, status, sdate, edate, OPEN_ID, OPEN_KEY);
if(voList.size()>0){
//解析数据
PINGANHandle(voList, pav2PayOrderObjMap, payv2PayOrderRefundObjMap,payName, rate.getPayWayRate());
}else{
System.out.println("返回数据为空");
}
}else{
LOGGER.error("===》平安银行对账参数错误:RateKey1,RateKey2,请检查数据库通道数据是否填写完整");
}
}
}
/**
* 微信对账文件处理
*
* @param downloadurl
* @param time
* @param sdclearList
* @param thclearList
* @throws Exception
*/
private void wxHandle(String orderArrs[], String time, Map<String, Object> pav2PayOrderObjMap, Map<String, Object> payv2PayOrderRefundObjMap,
String payType, Double rateValue) throws Exception {
/*
* 微信对账文件格式
* 交易时间,公众账号ID,第三方商户号,商户号,子商户号,设备编号,威富通订单号,第三方订单号,商户订单号,用户标识,交易类型
* ,交易状态,付款银行
* ,货币种类,总金额,企业红包金额,威富通退款单号,商户退款单号,退款金额,企业红包退款金额,退款类型,退款状态,商品名称
* ,商户数据包,手续费
* ,费率,终端类型,对账标识,门店编号,商户名称,收银员,子商户ID,免充值券金额,实收金额,扩展字段1,扩展字段2,扩展字段3,扩展字段4
* `2017-04-27 10:54:27,`appid,`,`,`103590007749,`IOS_SDK,`
* 103590007749201704271123822958
* ,`H17042750114951E,`DD20170427105227878240
* ,`openid,`pay.weixin.wappayv3
* ,`支付成功,`CFT,`CNY,`10.00,`0.00,`,`,`,`,`,`,`全国 10元话费
* 15220183163,`,`0.10
* ,`1.00%,`iOS_SDK,`0,`,`北京全民金服科技有限公司,`,`,`0.00,`10.00,`,`,`,`
* `2017-04-27 14:20:09,`appid,`,`,`103590007749,`IOS_SDK,`
* 103590007749201704276103512127
* ,`H17042750760091O,`DD2017042714184297028
* ,`openid,`pay.weixin.wappayv3
* ,`支付成功,`CFT,`CNY,`10.00,`0.00,`,`,`,`,`,`,`全国 10元话费
* 15220183163,`,`0.10
* ,`1.00%,`iOS_SDK,`0,`,`北京全民金服科技有限公司,`,`,`0.00,`10.00,`,`,`,`
* `2017-04-27 15:24:17,`appid,`,`,`103590007749,`AND_SDK,`
* 103590007749201704276103668234
* ,`H17042750920861U,`DD20170427152242223461
* ,`openid,`pay.weixin.wappayv3
* ,`支付成功,`CFT,`CNY,`10.00,`0.00,`,`,`,`,`,`,`全国 10元话费
* 18682475275,`,`0.10
* ,`1.00%,`AND_SDK,`0,`,`北京全民金服科技有限公司,`,`,`0.00,`10.00,`,`,`,`
* `2017-04-27 16:16:46,`appid,`,`,`103590007749,`AND_SDK,`
* 103590007749201704274132650712
* ,`H17042751118051R,`DD20170427161236184642
* ,`openid,`pay.weixin.wappayv3
* ,`支付成功,`CFT,`CNY,`10.00,`0.00,`,`,`,`,`,`,`全国 10元话费
* 13922810506,`,`0.10
* ,`1.00%,`AND_SDK,`0,`,`北京全民金服科技有限公司,`,`,`0.00,`10.00,`,`,`,`
* `2017-04-27 17:03:59,`appid,`,`,`103590007749,`IOS_SDK,`
* 103590007749201704277105301982
* ,`H17042751215811J,`DD20170427170138471692
* ,`openid,`pay.weixin.wappayv3
* ,`支付成功,`CFT,`CNY,`4.50,`0.00,`,`,`,`,`,`,`全国通用 30M流量
* 15220183163,`,`0.05
* ,`1.00%,`iOS_SDK,`0,`,`北京全民金服科技有限公司,`,`,`0.00,`4.50,`,`,`,`
* `2017-04-27 11:14:01,`appid,`,`,`103590007749,`IOS_SDK,`
* 103590007749201704271123822958
* ,`H17042750114951E,`DD20170427105227878240
* ,`openid,`pay.weixin.wappayv3
* ,`转入退款,`CFT,`CNY,`10.00,`,`103590007749201704276102916173
* ,`5647895456,`10.00,`,`ORIGINAL,`退款成功,`全国 10元话费
* 15220183163,`,`-0.10,`
* 1.00%,`iOS_SDK,`0,`,`北京全民金服科技有限公司,`,`,`0.00,`-10.00,`,`,`,`
* 总交易单数,总交易额,总退款金额,总企业红包退款金额,总手续费金额,总实收金额
* `5,`44.50,`10.00,`0,`0.35,`34.50
*/
if (orderArrs != null) {
for (int i = 1; i < orderArrs.length - 2; i++) {
String orderStrs = orderArrs[i];
String[] orderArr = orderStrs.split(",");
// 微信对账文件38个字段
if (orderArr.length >= 38) {
Payv2PayOrderClear clear = null;
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date finishedTimeDate = df.parse(getOrderStr(orderArr[0]));
if (orderArr[11].equals("`支付成功")) {
if (pav2PayOrderObjMap.containsKey(getOrderStr(orderArr[8]))) {
clear = getOrderClearByOrder(pav2PayOrderObjMap, getOrderStr(orderArr[8]), getOrderStr(orderArr[14]), "交易", payType,
finishedTimeDate, rateValue);
if (clear != null) {
clear.setUpstreamTime(finishedTimeDate);
clear.setUpstreamAmount(Double.valueOf(getOrderStr(orderArr[14])));
clear.setClearTime(finishedTimeDate);
clear.setTransactionId(getOrderStr(orderArr[6]));
}
}
} else if (orderArr[11].equals("`转入退款")) {
/*
* if(payv2PayOrderRefundObjMap.containsKey(getOrderStr(
* orderArr[0]))){
*/
clear = getOrderClearByOrderRefund(payv2PayOrderRefundObjMap, pav2PayOrderObjMap, getOrderStr(orderArr[17]), getOrderStr(orderArr[14]),
getOrderStr(orderArr[8]), "退款", payType);
if (clear != null) {
clear.setUpstreamTime(finishedTimeDate);
clear.setUpstreamAmount(Double.valueOf(getOrderStr(orderArr[14])));
clear.setClearTime(finishedTimeDate);
clear.setTransactionId(getOrderStr(orderArr[16]));
}
// }
}
if (clear != null) {
//修改对账单状态
updateOrderClear(clear);
// payv2PayOrderClearMapper.insertByEntity(clear);
} else {
// 默认成功状态
int type = 1;
String orderNum = "";
String transactionId = "";
String alipayMoney = "";
if (orderArr[11].equals("`转入退款")) {
// 退款状态
type = 2;
orderNum = getOrderStr(orderArr[17]);
transactionId = getOrderStr(orderArr[16]);
alipayMoney = getOrderStr(orderArr[14]);
}
if (orderArr[11].equals("`支付成功")) {
//交易成功
// 订单号
orderNum = getOrderStr(orderArr[8]);
transactionId = getOrderStr(orderArr[6]);
alipayMoney = getOrderStr(orderArr[14]);
}
if (orderNum != null) {
updateOrderTime(orderNum, finishedTimeDate, Double.valueOf(alipayMoney), type, transactionId);
}
}
}
}
System.out.println("微信对账完毕");
}
}
/**
* @Title: xyBankWechatHandle
* @Description: 兴业银行微信对账单
* @param @param orderArrs
* @param @param time
* @param @param pav2PayOrderObjMap
* @param @param payv2PayOrderRefundObjMap
* @param @param orderList
* @param @param payType 设定文件
* @return void 返回类型
* @throws
*/
public void xyBankWechatHandle(String str[], String time, Map<String, Object> pav2PayOrderObjMap, Map<String, Object> payv2PayOrderRefundObjMap,
String payType, Double rateValue) {
List<List<String>> list = new ArrayList<List<String>>();
List<String> list1 = new ArrayList<String>();
int num = str.length / 24;
for (int i = 1; i < str.length; i++) {
if (i % 24 == 0) {
list1.add(str[i]);
list.add(list1);
if (i == num * 24) {
int n = list1.get(list1.size() - 1).indexOf("总交易单数");
list1.set(list1.size() - 1, list1.get(list1.size() - 1).substring(0, n));
}
list1 = new ArrayList<String>();
} else {
list1.add(str[i]);
}
if (i == str.length - 1) {
list.add(list1);
}
}
try {
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
for (List<String> list2 : list) {
Payv2PayOrderClear clear = null;
for (int i = 0; i < list2.size(); i++) {
String yes = xygetOrderStr(list2.get(i));
// 成功
if (yes.equals("SUCCESS")) {
// 获取订单号
System.out.println("交易状态:" + yes);
System.out.println("支付集订单号:" + xygetOrderStr(list2.get(5)));
System.out.println("总金额:" + xygetOrderStr(list2.get(11)));
Date finishedTimeDate = df.parse(xygetOrderStr(list2.get(0)));
System.out.println("交易时间:" + finishedTimeDate);
System.out.println("上游订单号:"+xygetOrderStr(list2.get(4)));
int money = Integer.valueOf(xygetOrderStr(list2.get(11)));
double money1 = money / 100.00;
String wxMoney = String.valueOf(money1);
if (pav2PayOrderObjMap.containsKey(xygetOrderStr(list2.get(5)))) {
clear = getOrderClearByOrder(pav2PayOrderObjMap, xygetOrderStr(list2.get(5)), wxMoney, "交易", payType, finishedTimeDate,
rateValue);
}
if (clear != null) {
clear.setUpstreamTime(finishedTimeDate);
clear.setUpstreamAmount(Double.valueOf(wxMoney));
//上游订单号:
clear.setTransactionId(xygetOrderStr(list2.get(4)));
clear.setClearTime(finishedTimeDate);
}
}
// 退款
String refundNum="";
if (yes.equals("REFUND")) {
System.out.println("交易状态:" + yes);
System.out.println("退款订单号:" + xygetOrderStr(list2.get(14)));
System.out.println("支付集订单号:" + xygetOrderStr(list2.get(5)));
System.out.println("退款金额:" + xygetOrderStr(list2.get(15)));
System.out.println("上游退款订单号:"+xygetOrderStr(list2.get(4)));
refundNum = xygetOrderStr(list2.get(14));
int money = Integer.valueOf(xygetOrderStr(list2.get(15)));
double money1 = money / 100.00;
String alipayMoney = String.valueOf(money1);
String alipayOrderNum = xygetOrderStr(list2.get(5));
Date finishedTimeDate = df.parse(xygetOrderStr(list2.get(0)));
System.out.println("交易时间:" + finishedTimeDate);
clear = getOrderClearByOrderRefund(payv2PayOrderRefundObjMap, pav2PayOrderObjMap, refundNum, alipayMoney, alipayOrderNum, "退款",
payType);
if (clear != null) {
clear.setUpstreamTime(finishedTimeDate);
clear.setUpstreamAmount(Double.valueOf(alipayMoney));
//上游退款订单号:
clear.setTransactionId(xygetOrderStr(list2.get(4)));
clear.setClearTime(finishedTimeDate);
}
}
if(clear==null){
//交易
int type=1;
String orderNum=null;
Date finishedTimeDate=null;
double money=0.00;
String transactionId=null;
if (yes.equals("SUCCESS")) {
type=1;
orderNum=xygetOrderStr(list2.get(5));
finishedTimeDate = df.parse(xygetOrderStr(list2.get(0)));
int money2 = Integer.valueOf(xygetOrderStr(list2.get(11)));
money = money2 / 100.00;
transactionId=xygetOrderStr(list2.get(4));
}
//退款
if (yes.equals("REFUND")) {
type=2;
orderNum=xygetOrderStr(list2.get(14));
finishedTimeDate = df.parse(xygetOrderStr(list2.get(0)));
int money2 = Integer.valueOf(xygetOrderStr(list2.get(15)));
money = money2 / 100.00;
transactionId=xygetOrderStr(list2.get(4));
}
if(orderNum!=null){
//修改隔夜漏单情况
updateOrderTime(orderNum, finishedTimeDate, money, type, transactionId);
}
}
}
if (clear != null) {
//修改对账单状态
updateOrderClear(clear);
// payv2PayOrderClearMapper.insertByEntity(clear);
}
}
} catch (ParseException e) {
e.printStackTrace();
LOGGER.error("解析失败" + e);
}
System.out.println("兴业银行微信对账单完毕");
}
/**
* @Title: xyBankAliHandle
* @Description: 兴业银行支付宝扫码对账单
* @param @param str
* @param @param time
* @param @param pav2PayOrderObjMap
* @param @param payv2PayOrderRefundObjMap
* @param @param orderList
* @param @param payType 设定文件
* @return void 返回类型
* @throws
*/
public void xyBankAliHandle(String str[], String time, Map<String, Object> pav2PayOrderObjMap, Map<String, Object> payv2PayOrderRefundObjMap,
String payType, Double rateValue) {
List<List<String>> list = new ArrayList<List<String>>();
List<String> list1 = new ArrayList<String>();
int num = str.length / 28;
for (int i = 1; i < str.length; i++) {
if (i % 28 == 0) {
list1.add(str[i]);
list.add(list1);
if (i == num * 28) {
int n = list1.get(list1.size() - 1).indexOf("总交易单数");
list1.set(list1.size() - 1, list1.get(list1.size() - 1).substring(0, n));
}
list1 = new ArrayList<String>();
} else {
list1.add(str[i]);
}
if (i == str.length - 1) {
list.add(list1);
}
}
try {
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
for (List<String> list2 : list) {
Payv2PayOrderClear clear = null;
for (int i = 0; i < list2.size(); i++) {
String yes = xygetOrderStr(list2.get(i));
// 成功
if (yes.equals("交易")) {
// 获取订单号
System.out.println("交易状态:" + yes);
System.out.println("支付集订单号:" + xygetOrderStr(list2.get(2)));
System.out.println("总金额:" + xygetOrderStr(list2.get(25)));
Date finishedTimeDate = df.parse(xygetOrderStr(list2.get(6)));
System.out.println("交易时间:" + finishedTimeDate);
System.out.println("上游订单号:" + xygetOrderStr(list2.get(1)));
String alimoney =xygetOrderStr(list2.get(25));
if (pav2PayOrderObjMap.containsKey(xygetOrderStr(list2.get(2)))) {
clear = getOrderClearByOrder(pav2PayOrderObjMap, xygetOrderStr(list2.get(2)),alimoney, "交易",
payType, finishedTimeDate, rateValue);
}
if (clear != null) {
clear.setUpstreamTime(finishedTimeDate);
clear.setUpstreamAmount(Double.valueOf(alimoney));
clear.setTransactionId(xygetOrderStr(list2.get(1)));
clear.setClearTime(finishedTimeDate);
}
}
if (yes.equals("退款")) {
System.out.println("交易状态:" + yes);
System.out.println("退款订单号:" + xygetOrderStr(list2.get(22)));
System.out.println("支付集订单号:" + xygetOrderStr(list2.get(2)));
System.out.println("退款金额:" + xygetOrderStr(list2.get(25)));
Date finishedTimeDate = df.parse(xygetOrderStr(list2.get(6)));
System.out.println("交易时间:" + finishedTimeDate);
System.out.println("上游退款订单号:" + xygetOrderStr(list2.get(1)));
String alimoney = xygetOrderStr(list2.get(25));
clear = getOrderClearByOrderRefund(payv2PayOrderRefundObjMap, pav2PayOrderObjMap, xygetOrderStr(list2.get(22)),
alimoney, xygetOrderStr(list2.get(2)), "退款", payType);
if (clear != null) {
clear.setUpstreamTime(finishedTimeDate);
clear.setUpstreamAmount(Double.valueOf(alimoney));
clear.setTransactionId(xygetOrderStr(list2.get(1)));
clear.setClearTime(finishedTimeDate);
}
}
if(clear==null){
int type=1;
String orderNum=null;
Date finishedTimeDate=null;
double money=0.00;
String transactionId=null;
//交易
if (yes.equals("SUCCESS")) {
type=1;
orderNum=xygetOrderStr(list2.get(2));
finishedTimeDate = df.parse(xygetOrderStr(list2.get(6)));
String alimoney = xygetOrderStr(list2.get(25));
money=Double.valueOf(alimoney);
transactionId=xygetOrderStr(list2.get(1));
}
//退款
if (yes.equals("REFUND")) {
type=2;
orderNum=xygetOrderStr(list2.get(22));
finishedTimeDate =df.parse(xygetOrderStr(list2.get(6)));
String alimoney = xygetOrderStr(list2.get(25));
money=Double.valueOf(alimoney);
transactionId=xygetOrderStr(list2.get(1));
}
if(orderNum!=null){
//修改隔夜漏单情况
updateOrderTime(orderNum, finishedTimeDate, money, type, transactionId);
}
}
}
if (clear != null) {
//修改对账单状态
updateOrderClear(clear);
// payv2PayOrderClearMapper.insertByEntity(clear);
}
}
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("兴业银行支付宝对账单完毕");
}
/**
* 支付宝对账文件处理
*
* @param downloadurl
* @param time
* @param sdclearList
* @param thclearList
* @throws Exception
*/
private void alipayHandle(String downloadurl, String time, Map<String, Object> pav2PayOrderObjMap, Map<String, Object> payv2PayOrderRefundObjMap,
String payType, Double rateValue) throws Exception {
// 2.获取支付宝返回的账单下载地址,获取数据包
URL url = new URL(downloadurl);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
String filename = getFileName(con);
// 文件保存位置
String userDirPath = System.getProperty("user.dir");
String tempZipPath = userDirPath + "/alipay";
File saveDir = new File(tempZipPath);
if (!saveDir.exists()) {
saveDir.mkdir();
}
String tempZipPathFileName = tempZipPath + File.separator + filename;
// 写数据到临时文件,把download下来的zip包文件保存本地
writeDataToTempZip(con, tempZipPathFileName);
// 关闭连接
con.disconnect();
// zip包文件解压的文件夹名称
String outputPathFileName = tempZipPathFileName.substring(0, tempZipPathFileName.lastIndexOf("."));
// 3.解压
ZipUtil.unzip(tempZipPathFileName, outputPathFileName, true);
// 拼接解压后的文件路径
String readTempZipPathFileName = tempZipPath + File.separator + filename.substring(0, filename.lastIndexOf(".")) + File.separator
+ filename.substring(0, filename.lastIndexOf("."));
// 获取解压后需要读取数据的文件名称
String alipayFileName = getNeedReadAlipayFile(readTempZipPathFileName);
// 生成CsvReader对象,以,为分隔符,GBK编码方式
CsvReader r = new CsvReader(readTempZipPathFileName + File.separator + alipayFileName, ',', Charset.forName("GBK"));
// 读取表头
r.readHeaders();
// 逐条读取记录,直至读完
int canRead = 0;
while (r.readRecord()) {
// 读取一条记录
String nameaaaString = r.getRawRecord();
if (canRead == 1) {
// 按列名读取这条记录的值
String transactionId = r.get(0).trim().replace("\t", "");
String alipayOrderNum = r.get(1).trim().replace("\t", "");
String alipayOrderType = r.get(2).trim().replace("\t", "");
String finishedTime = r.get(5).trim().replace("\t", "");
String refundNum = r.get(21).trim().replace("\t", "");
Date finishedTimeDate = null;
if (StringUtils.isNoneEmpty(finishedTime)) {
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
finishedTimeDate = df.parse(finishedTime);
}
Payv2PayOrderClear clear = null;
String alipayMoney = r.get(11).trim().replace("\t", "");
//打印
System.out.println(transactionId+"\t"+alipayOrderNum+"\t"+alipayOrderType+"\t"+finishedTime+"\t"+refundNum+"\t"+alipayMoney+"\n");
// 交易订单处理
if (alipayOrderType.equals("交易")) {
if (pav2PayOrderObjMap.containsKey(alipayOrderNum)) {
clear = getOrderClearByOrder(pav2PayOrderObjMap, alipayOrderNum, alipayMoney, alipayOrderType, payType, finishedTimeDate,
rateValue);
if (clear != null) {
clear.setUpstreamTime(finishedTimeDate);
clear.setUpstreamAmount(Double.valueOf(alipayMoney));
clear.setTransactionId(transactionId);
clear.setClearTime(finishedTimeDate);
}
}
} else if (alipayOrderType.equals("退款")) {// 退款订单处理
clear = getOrderClearByOrderRefund(payv2PayOrderRefundObjMap, pav2PayOrderObjMap, refundNum, alipayMoney, alipayOrderNum, alipayOrderType,
payType);
if (clear != null) {
clear.setUpstreamTime(finishedTimeDate);
clear.setUpstreamAmount(Double.valueOf(alipayMoney));
clear.setTransactionId(transactionId);
clear.setClearTime(finishedTimeDate);
}
// }
}
if (clear != null) {
//修改对账单状态
updateOrderClear(clear);
// payv2PayOrderClearMapper.insertByEntity(clear);
}else{
//修改隔夜漏单情况:根据上游传回来的支付集订单号
int type=1;
String orderNum=null;
if(alipayOrderType.equals("交易")){
type=1;
orderNum=alipayOrderNum;
}
if(alipayOrderType.equals("退款")){
type=2;
orderNum=refundNum;
}
if(orderNum!=null){
updateOrderTime(orderNum, finishedTimeDate, Double.valueOf(alipayMoney), type,transactionId);
}
}
}
if (nameaaaString.indexOf("支付宝交易号") > -1) {
canRead = 1;
}
if (nameaaaString.indexOf("业务明细列表结束") > -1) {
break;
}
}
r.close();
// 删除下载的临时文件
deleteFile(new File(tempZipPath));
}
/**
* 根据appId分组生成对账文件
*
* @param orderList
* @param alipayTime String alipayTime = DateUtil.DateToString(as,"yyyy-MM-dd");
* @param as Date as = new Date(new Date().getTime()-24*60*60*1000);
*/
public void appIdDownBill(List<Payv2PayOrderClear> orderList, String alipayTime, Date as
,Payv2DayCompanyClear payv2DayCompanyClear,Map<String, Object> map) {
// 根据appId分组
Map<Long, List<Payv2PayOrderClear>> groupOrderMap = new HashMap<Long, List<Payv2PayOrderClear>>();
for (Payv2PayOrderClear order : orderList) {
Long appId = order.getAppId();
if (appId != null) {
if (!groupOrderMap.containsKey(appId)) {
List<Payv2PayOrderClear> orderTeamList = new ArrayList<Payv2PayOrderClear>();
orderTeamList.add(order);
groupOrderMap.put(appId, orderTeamList);
} else {
groupOrderMap.get(appId).add(order);
}
}
}
String path = System.getProperty("user.dir");
String tempZipPath = path + "/accountstatement";
File saveDir = new File(tempZipPath);
if (!saveDir.exists()) {
saveDir.mkdir();
}
// 根据分组生成文件 ,上传
Set<Long> keySets = groupOrderMap.keySet();
for (Long appId : keySets) {
List<Payv2PayOrderClear> oList = groupOrderMap.get(appId);
List exportData = new ArrayList<Map>();
Map row = null;
// 文件头
LinkedHashMap head = new LinkedHashMap();
head.put("1", "支付集订单号");
head.put("2", "商户订单号");
head.put("3", "支付集退款订单号");
head.put("4", "订单名称");
head.put("5", "业务类型");
head.put("6", "支付方式");
head.put("7", "订单金额");
head.put("8", "手续费");
head.put("9", "交易时间");
// 交易笔数
int tradeTotol = 0;
// 总金额
double tradePayMoney = 0.0;
// 退款总数
int refundTotol = 0;
// 退款金额
double refundPayMoney = 0.0;
// 文件内容
// 下单时间排序
ListSort(oList);
for (Payv2PayOrderClear order : oList) {
row = new LinkedHashMap<String, String>();
double payMoney = order.getOrderMoney() == null ? 0 : order.getOrderMoney();
int type = order.getType();
String alipayOrderType = "交易";
if (type==1) {
tradeTotol++;
tradePayMoney += payMoney;
} else if (type==2) {
alipayOrderType = "退款";
refundTotol++;
refundPayMoney += payMoney;
}
row.put("1", order.getOrderNum());
row.put("2", order.getMerchantOrderNum() + "\t");
row.put("3", order.getRefundNum() == null ? "" : order.getRefundNum() + "\t");
row.put("4", order.getOrderName() == null ? "" : order.getOrderName());
row.put("5", alipayOrderType);
row.put("6", order.getPayWayId()==1?"支付宝":"微信");
row.put("7", payMoney);
row.put("8", order.getBussWayRateMoney() == null ? 0 : order.getBussWayRateMoney());
row.put("9", DateUtil.DateToString(order.getPayTime(), "yyyy-MM-dd HH:mm:ss") + "\t");
exportData.add(row);
}
String fileName = "account_statement";
File targetFile = CSVUtils.createCSVFile(exportData, head, tempZipPath, fileName, alipayTime, tradeTotol, tradePayMoney, refundTotol,
refundPayMoney);
String fileUploadName = fileName + DateUtil.DateToString(new Date(), "yyyyMMddHHmmss")+appId;
String url = FtpUploadClient.getInstance().uploadFile(fileUploadName + ".csv", targetFile);
// 得到的文件地址保存起来
Payv2BillDown down = new Payv2BillDown();
down.setUrl(url);
down.setAppId(appId);
down.setCreateTime(new Date());
down.setClearTime(as);
payv2BillDownMapper.insertByEntity(down);
deleteFile(targetFile);
System.out.println(url);
}
//将帐单号更新到详情记录中
payv2BussWayDetailMapper.updateCompanyCheckId(map);
payv2DayCompanyClearMapper.updateByEntity(payv2DayCompanyClear);
}
/**
* 根据companyId分组生成对账文件
*
* @param orderList
* @param alipayTime
* @param as
* @throws Exception
*/
public void companyIdDownBill(List<Payv2PayOrderVO> orderList, String alipayTime, Date as, Map<Long, String> map) throws Exception {
Map<Long, List<Payv2PayOrderVO>> groupCompanyMap = new HashMap<Long, List<Payv2PayOrderVO>>();
for (Payv2PayOrderVO order : orderList) {
Long companyId = order.getCompanyId();
if (companyId != null) {
if (!groupCompanyMap.containsKey(companyId)) {
List<Payv2PayOrderVO> orderTeamList = new ArrayList<Payv2PayOrderVO>();
orderTeamList.add(order);
groupCompanyMap.put(companyId, orderTeamList);
} else {
groupCompanyMap.get(companyId).add(order);
}
}
}
// 根据分组生成文件 ,上传
Set<Long> keySets = groupCompanyMap.keySet();
for (Long companyId : keySets) {
List<Payv2PayOrderVO> oList = groupCompanyMap.get(companyId);
// 已支付订单笔数
int tradeTotol = 0;
// 已支付订单金额
double tradePayMoney = 0.0;
// 已退款订单笔数
int refundTotol = 0;
// 已退款订单金额
double refundPayMoney = 0.0;
// 手续费
double rateMoney = 0.0;
// 手续费利润
double rateProfit = 0.0;
Long channelId = null;
for (Payv2PayOrderVO order : oList) {
channelId = order.getChannelId();
double payMoney = order.getPayMoney() == null ? 0 : order.getPayMoney();
String alipayOrderType = order.getAlipayOrderType() == null ? "" : order.getAlipayOrderType();
if ("交易".equals(alipayOrderType)) {
tradeTotol++;
tradePayMoney += payMoney;
rateMoney += order.getPayWayMoney();
if (order.getPayWayMoney().doubleValue() >= getCeil(order.getRateValue() * payMoney / 1000, 2)) {
rateProfit = rateProfit + order.getPayWayMoney() - getCeil(order.getRateValue() * payMoney / 1000, 2);
} else {
rateProfit = rateProfit + 0;
}
} else if ("退款".equals(alipayOrderType)) {
refundTotol++;
refundPayMoney += payMoney;
}
}
// 新增商户每天账单结算
Payv2DayCompanyClear pdcc = new Payv2DayCompanyClear();
pdcc.setChannelId(channelId);
pdcc.setClearTime(getDate(alipayTime));
String companyCheckId = System.currentTimeMillis() + "" + companyId;
pdcc.setCompanyCheckId(companyCheckId);
pdcc.setCompanyId(companyId);
pdcc.setCreateTime(new Date());
pdcc.setRateMoney(rateMoney); // 手续费
pdcc.setRateProfit(rateProfit);// 手续费利润
pdcc.setRefundMoney(refundPayMoney);// 已退款订单金额
pdcc.setSuccessMoney(tradePayMoney);// 已支付订单金额
pdcc.setSuccessCount(tradeTotol);// 交易笔数
pdcc.setRefundCount(refundTotol);// 退款笔数
payv2DayCompanyClearMapper.insertByEntity(pdcc);
map.put(companyId, companyCheckId);
}
}
/**
* 根据appId和rateId分组生成对账文件
*
* @param orderList
* @param alipayTime
* @param as
* @throws Exception
*/
public void comRateIdDownBill(List<Payv2PayOrderVO> orderList, String alipayTime, Date as, Map<Long, String> comMap) throws Exception {
// 根据companyId和rateId分组
Map<String, List<Payv2PayOrderVO>> groupComRateMap = new HashMap<String, List<Payv2PayOrderVO>>();
for (Payv2PayOrderVO order : orderList) {
Long appId = order.getAppId();
Long rateId = order.getRateId();
if (appId != null && rateId != null) {
String comRate = appId + "-" + rateId;
if (!groupComRateMap.containsKey(comRate)) {
List<Payv2PayOrderVO> orderTeamList = new ArrayList<Payv2PayOrderVO>();
orderTeamList.add(order);
groupComRateMap.put(comRate, orderTeamList);
} else {
groupComRateMap.get(comRate).add(order);
}
}
}
// 根据分组生成文件 ,上传
Set<String> keySets = groupComRateMap.keySet();
for (String comRate : keySets) {
List<Payv2PayOrderVO> oList = groupComRateMap.get(comRate);
// 已支付订单笔数
int tradeTotol = 0;
// 已支付订单金额
double tradePayMoney = 0.0;
// 已退款订单笔数
int refundTotol = 0;
// 已退款订单金额
double refundPayMoney = 0.0;
// 手续费
double rateMoney = 0.0;
// 商户签约费率
double bussWayRate = 0.0;
// 成本费率
double costRate = 0.0;
// 成本手续费
double costRateMoney = 0.0;
String[] str = comRate.split("-");
Long appId = Long.valueOf(str[0]);
Long companyId = null;
Long channelId = null;
for (Payv2PayOrderVO order : oList) {
companyId = order.getCompanyId();
channelId = order.getChannelId();
double payMoney = order.getPayMoney() == null ? 0 : order.getPayMoney();
String alipayOrderType = order.getAlipayOrderType() == null ? "" : order.getAlipayOrderType();
if ("交易".equals(alipayOrderType)) {
tradeTotol++;
tradePayMoney += payMoney;
rateMoney += order.getPayWayMoney();
costRateMoney += getCeil(order.getRateValue() * payMoney / 1000, 2);
costRate = order.getRateValue();
if (null != order.getComRateValue()) {
bussWayRate = order.getComRateValue();
}
} else if ("退款".equals(alipayOrderType)) {
refundTotol++;
refundPayMoney += payMoney;
}
}
// 新增商户每天账单结算
Payv2BussWayDetail pbwd = new Payv2BussWayDetail();
pbwd.setChannelId(channelId);
pbwd.setCompanyId(companyId);
pbwd.setAppId(appId);
pbwd.setPayWayId(Long.valueOf(str[1]));
if (companyId != null && comMap.containsKey(companyId)) {
pbwd.setCompanyCheckId(comMap.get(companyId));
}
pbwd.setSuccessCount(tradeTotol); // 交易笔数
pbwd.setSuccessMoney(tradePayMoney);// 交易金额
pbwd.setRefundCount(refundTotol); // 退款笔数
pbwd.setRefundMoney(refundPayMoney);// 退款金额
pbwd.setBussMoney(tradePayMoney - refundPayMoney);// 交易净额
pbwd.setCostRate(costRate); // 成本费率
pbwd.setCostRateMoney(costRateMoney);// 成本手续费
pbwd.setBussWayRate(bussWayRate);// 商户签约费率
pbwd.setBussWayRateMoney(rateMoney);// 商户手续费
pbwd.setClearTime(getDate(alipayTime));
pbwd.setCreateTime(new Date());
payv2BussWayDetailMapper.insertByEntity(pbwd);
}
}
/**
* 向上取整
*
* @param d
* @param n
* 保留位数
* @return
*/
public double getCeil(double d, int n) {
BigDecimal b = new BigDecimal(String.valueOf(d));
b = b.divide(BigDecimal.ONE, n, BigDecimal.ROUND_CEILING);
return b.doubleValue();
}
// yyyyMMdd
private Date getDate(String date) throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
return sdf.parse(date);
}
private String getOrderStr(String str) {
return str.replace("`", "");
}
private String xygetOrderStr(String str) {
return str.replace(",", "");
}
/**
* 通过递归调用删除一个文件夹及下面的所有文件
*
* @param file
*/
public void deleteFile(File file) {
if (file.isFile()) {// 表示该文件不是文件夹
file.delete();
} else {
// 首先得到当前的路径
String[] childFilePaths = file.list();
for (String childFilePath : childFilePaths) {
File childFile = new File(file.getAbsolutePath() + File.separator + childFilePath);
deleteFile(childFile);
}
file.delete();
}
}
public static byte[] readInputStream(InputStream inputStream) throws IOException {
byte[] buffer = new byte[1024];
int len = 0;
ByteArrayOutputStream bos = new ByteArrayOutputStream();
while ((len = inputStream.read(buffer)) != -1) {
bos.write(buffer, 0, len);
}
bos.close();
return bos.toByteArray();
}
public PageObject<Payv2PayOrderClear> payv2PayOrderClearList(Map<String, Object> map) {
int totalData = payv2PayOrderClearMapper.getCount(map);
PageHelper pageHelper = new PageHelper(totalData, map);
List<Payv2PayOrderClear> list = payv2PayOrderClearMapper.pageQueryByObject(pageHelper.getMap());
for (Payv2PayOrderClear clear : list) {
clear.setIncomeMoney(0.00);// 收入金额
clear.setReturnMoney(0.00);// 退款金额
clear.setActuallyPayMoney(0.00);// 实收金额
clear.setArrivalMoney(0.00);// 到账金额
clear.setRate(0.00);// 手续费
// 获取公司名称
if (clear.getCompanyId() != null) {
Payv2BussCompany payv2BussCompany = new Payv2BussCompany();
payv2BussCompany.setId(clear.getCompanyId());
payv2BussCompany = payv2BussCompanyMapper.selectSingle(payv2BussCompany);
if (payv2BussCompany != null) {
clear.setCompanyName(payv2BussCompany.getCompanyName());
}
}
// 获取应用名称
if (StringUtils.isNotEmpty(clear.getOrderNum())) {
Payv2PayOrder payv2PayOrder = new Payv2PayOrder();
payv2PayOrder.setOrderNum(clear.getOrderNum());
payv2PayOrder = payv2PayOrderMapper.selectSingle(payv2PayOrder);
if (payv2PayOrder != null) {
clear.setOrderName(payv2PayOrder.getOrderName());
}
}
if (clear.getAppId() != null && clear.getMerchantType() != null) {
if (clear.getMerchantType().intValue() == 1) {
Payv2BussCompanyApp payv2BussCompanyApp = new Payv2BussCompanyApp();
payv2BussCompanyApp.setId(clear.getAppId());
payv2BussCompanyApp = payv2BussCompanyAppMapper.selectSingle(payv2BussCompanyApp);
if (payv2BussCompanyApp != null) {
clear.setAppName(payv2BussCompanyApp.getAppName());
}
} else if (clear.getMerchantType().intValue() == 2) {
Payv2BussCompanyShop payv2BussCompanyShop = new Payv2BussCompanyShop();
payv2BussCompanyShop.setId(clear.getAppId());
payv2BussCompanyShop = payv2BussCompanyShopMapper.selectSingle(payv2BussCompanyShop);
if (payv2BussCompanyShop != null) {
clear.setAppName(payv2BussCompanyShop.getShopName());
}
}
}
// 获取支付通道名称
if (clear.getPayWayId() != null) {
Payv2PayWay payv2PayWay = new Payv2PayWay();
payv2PayWay.setId(clear.getPayWayId());
payv2PayWay = payv2PayWayMapper.selectSingle(payv2PayWay);
if (payv2PayWay != null) {
clear.setWayName(payv2PayWay.getWayName());
}
}
}
PageObject<Payv2PayOrderClear> pageObject = pageHelper.getPageObject();
pageObject.setDataList(list);
return pageObject;
}
/**
* @Title: MSBankHandle
* @Description: 民生银行对账接口
* @param @param str
* @param @param time
* @param @param pav2PayOrderObjMap
* @param @param payv2PayOrderRefundObjMap
* @param @param orderList
* @param @param payType 设定文件
* @return void 返回类型
* @throws
*/
public void MSBankHandle(String str, Map<String, Object> pav2PayOrderObjMap, Map<String, Object> payv2PayOrderRefundObjMap,
String payType, Double rateValue) {
JSONObject jsonObject = JSONObject.fromObject(str);
JSONObject json_to_data = jsonObject.getJSONObject("reply");// 即可
if (json_to_data.containsKey("cupCheckDetailList") && null != json_to_data.getJSONArray("cupCheckDetailList")) {
JSONArray json_to_strings = json_to_data.getJSONArray("cupCheckDetailList");
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
if (json_to_strings.size() > 0) {
for (int i = 0; i < json_to_strings.size(); i++) {// 循环读取即可
Payv2PayOrderClear clear = null;
JSONObject json_to_string1 = json_to_strings.getJSONObject(i);
// 获取支付是否成功与退款
String transType = (String) json_to_string1.get("transType");
System.out.println("交易状态:" + transType);
if (json_to_string1 != null) {
// 商户订单号
String alipayOrderNum = json_to_string1.getString("merchantOrderId");
// 金额
String alipayMoney = json_to_string1.getString("transAmt");
// 交易时间 年月日
Long ytime = json_to_string1.getLong("transDate");
String transactionId = json_to_string1.getString("chnlOrderId");
// 时间
Long time = json_to_string1.getLong("transTime");
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd ");
SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("HH:mm:ss");
Date date = new Date(ytime);
Date date1 = new Date(time);
String res = simpleDateFormat.format(date) + simpleDateFormat1.format(date1);
Date finishedTimeDate = df.parse(res);
if (transType.equals("1")) {// 成功
if (pav2PayOrderObjMap.containsKey(alipayOrderNum)) {
clear = getOrderClearByOrder(pav2PayOrderObjMap, alipayOrderNum, alipayMoney, "交易", payType, finishedTimeDate,
rateValue);
}
}
String refundNum=null;
if (transType.equals("3")) {// 退款
// 退款订单号
refundNum = json_to_string1.getString("requestFlowNo");
clear = getOrderClearByOrderRefund(payv2PayOrderRefundObjMap, pav2PayOrderObjMap, refundNum, alipayMoney, alipayOrderNum, "退款",
payType);
}
if (clear != null) {
clear.setUpstreamTime(finishedTimeDate);
clear.setUpstreamAmount(Double.valueOf(alipayMoney));
clear.setClearTime(finishedTimeDate);
clear.setTransactionId(transactionId);
}
//修个隔夜漏单数据
if(clear==null){
int type=1;
String orderNum=null;
//交易
if (transType.equals("1")) {
type=1;
orderNum=alipayOrderNum;
}
//退款
if (transType.equals("3")) {
type=2;
orderNum=json_to_string1.getString("requestFlowNo");
}
if(orderNum!=null){
//修改隔夜漏单情况
updateOrderTime(orderNum, finishedTimeDate, Double.valueOf(alipayMoney), type, transactionId);
}
}
}
if (clear != null) {
//修改对账单状态
updateOrderClear(clear);
// payv2PayOrderClearMapper.insertByEntity(clear);
}
}
}
} catch (Exception e) {
e.printStackTrace();
LOGGER.error("民生银行对账单数据插入失败原因!" + e);
}
} else {
LOGGER.error("民生银行对账单数据插入失败原因!" + json_to_data);
}
System.out.println("民生银行对账单完毕!");
}
/**
* @Title: HFBHandle
* @Description: 汇付宝-对账生成
* @param @param str
* @param @param pav2PayOrderObjMap
* @param @param payv2PayOrderRefundObjMap
* @param @param orderList
* @param @param payType
* @param @param rateValue 设定文件
* @return void 返回类型
* @throws
*/
public void HFBHandle(String[] str, Map<String, Object> pav2PayOrderObjMap, Map<String, Object> payv2PayOrderRefundObjMap,
String payType, Double rateValue) {
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
if (str != null) {
for (int i = 0; i < str.length; i++) {
Payv2PayOrderClear clear = null;
String indo = str[i];
String indo2[] = indo.split(",");
System.out.println("商户订单号:" + indo2[1]);
System.out.println("交易金额:" + indo2[4]);
System.out.println("交易时间:" + indo2[3]);
String alipayOrderNum = String.valueOf(indo2[1]);
String alipayMoney = String.valueOf(indo2[4]);
// 格式:
String finishedTimeDate1 = String.valueOf(indo2[3]);
// 交易时间
Date finishedTimeDate = df.parse(finishedTimeDate1);
if (pav2PayOrderObjMap.containsKey(alipayOrderNum)) {
clear = getOrderClearByOrder(pav2PayOrderObjMap, alipayOrderNum, alipayMoney, "交易", payType, finishedTimeDate, rateValue);
if (clear != null) {
clear.setUpstreamTime(finishedTimeDate);
clear.setUpstreamAmount(Double.valueOf(alipayMoney));
clear.setClearTime(finishedTimeDate);
clear.setTransactionId(indo2[0]);
//修改对账单状态
updateOrderClear(clear);
// payv2PayOrderClearMapper.insertByEntity(clear);
}
}
//汇付宝没有退款对账
if(clear==null){
updateOrderTime(indo2[1], finishedTimeDate,Double.valueOf(alipayMoney), 1, indo2[0]);
}
}
}
} catch (Exception e) {
e.printStackTrace();
LOGGER.info("=====>汇付宝-对账生成:原因" + e);
}
System.out.println("汇付宝-对账完毕!");
}
private static void ListSort(List<Payv2PayOrderClear> list) {
Collections.sort(list, new Comparator<Payv2PayOrderClear>() {
@Override
public int compare(Payv2PayOrderClear o1, Payv2PayOrderClear o2) {
try {
Date dt1 = o1.getCreateTime();
Date dt2 = o2.getCreateTime();
if (dt1.getTime() > dt2.getTime()) {
return 1;
} else if (dt1.getTime() < dt2.getTime()) {
return -1;
} else {
return 0;
}
} catch (Exception e) {
e.printStackTrace();
}
return 0;
}
});
}
/**
*
* updateOrderClear
* 修改对账表状态
* @param clear 设定文件
* void 返回类型
*/
public void updateOrderClear(Payv2PayOrderClear clear){
Payv2PayOrderClear newClear=new Payv2PayOrderClear();
if(clear.getType()==1){//订单:交易状态
//上游流水号
newClear.setTransactionId(clear.getTransactionId());
//对账状态
newClear.setStatus(clear.getStatus());
//平台订单号
newClear.setOrderNum(clear.getOrderNum());
//对账时间
newClear.setClearTime(clear.getClearTime());
//上游交易时间
newClear.setUpstreamTime(clear.getUpstreamTime());
//上游交易金额
newClear.setUpstreamAmount(clear.getUpstreamAmount());
//上游状态
newClear.setUpstreamStatus(1);
//平台状态
newClear.setPayStatus(1);
//对账类型
newClear.setType(1);
payv2PayOrderClearMapper.updateByEntity2(newClear);
}
if(clear.getType()==2){//退款
newClear.setTransactionId(clear.getTransactionId());
newClear.setStatus(clear.getStatus());
newClear.setRefundNum(clear.getRefundNum());
newClear.setClearTime(clear.getClearTime());
newClear.setUpstreamTime(clear.getUpstreamTime());
newClear.setUpstreamAmount(clear.getUpstreamAmount());
newClear.setUpstreamStatus(1);
newClear.setPayStatus(1);
newClear.setType(2);
payv2PayOrderClearMapper.updateByEntity2(newClear);
}
}
/**
*
* updateOrderTime
* 根据上游传回的支付集订单号,修改每日对账表,订单表的支付时间,退款订单表
* @param orderNum 订单号:退款订单号
* @param time 交易时间
* @param money 金额
* @param type 1:交易 2:退款
* @param transactionId 上游订单流水号
* void 返回类型
*/
public void updateOrderTime(String orderNum,Date time,double money,int type,String transactionId){
// 打印
System.out.println("单号:"+orderNum+"\t"+"时间:"+DateUtil.DateToString(time, "yyyy-MM-dd HH:mm:ss")+"\t"+"金额:"+money+"\t"+"上游流水号:"+transactionId+"\n");
//查询是否存在
Payv2PayOrderClear payv2PayOrderClear=new Payv2PayOrderClear();
if(type==1){
payv2PayOrderClear.setOrderNum(orderNum);
}
if(type==2){
payv2PayOrderClear.setRefundNum(orderNum);
}
//未支付
payv2PayOrderClear.setPayStatus(3);
//出账
payv2PayOrderClear.setStatus(5);
payv2PayOrderClear.setType(type);
Payv2PayOrderClear payv2PayOrderClear1=payv2PayOrderClearMapper.selectSingle(payv2PayOrderClear);
if(payv2PayOrderClear1!=null){
//上游钱
payv2PayOrderClear1.setUpstreamAmount(money);
//改为支付成功
payv2PayOrderClear1.setPayStatus(1);
//上游状态
payv2PayOrderClear1.setUpstreamStatus(1);
//交易时间
payv2PayOrderClear1.setPayTime(time);
//上游交易时间
payv2PayOrderClear1.setUpstreamTime(time);
//对账状态为正常
payv2PayOrderClear1.setStatus(1);
//上游流水号
payv2PayOrderClear1.setTransactionId(transactionId);
//对账时间
payv2PayOrderClear1.setClearTime(time);
//修改对账表
payv2PayOrderClearMapper.updateByEntity(payv2PayOrderClear1);
//交易
if(type==1){
//先查询是否存在
Payv2PayOrder payv2PayOrder=new Payv2PayOrder();
payv2PayOrder.setOrderNum(orderNum);
payv2PayOrder.setPayStatus(3);
Payv2PayOrder payv2PayOrder1=payv2PayOrderMapper.selectSingle(payv2PayOrder);
if(payv2PayOrder1!=null){
//修改订单表
//创建时间
payv2PayOrder1.setCreateTime(time);
//支付时间
payv2PayOrder1.setPayTime(time);
//订单状态:正常1
payv2PayOrder1.setPayStatus(1);
payv2PayOrderMapper.updateByEntity(payv2PayOrder1);
}
}
//退款
if(type==1){
Payv2PayOrderRefund payv2PayOrderRefund=new Payv2PayOrderRefund();
payv2PayOrderRefund.setRefundNum(orderNum);
Payv2PayOrderRefund payv2PayOrderRefund1=payv2PayOrderRefundMapper.selectSingle(payv2PayOrderRefund);
if(payv2PayOrderRefund1!=null){
payv2PayOrderRefund1.setUpdateTime(new Date());
payv2PayOrderRefund1.setRefundTime(time);
payv2PayOrderRefundMapper.updateByEntity(payv2PayOrderRefund1);
}
}
}
System.out.println("隔夜对账数据完毕");
}
/**
* 获取某个时间的订单数据与退款数据
*/
public List<Map<String, Object>> getOderAndRefundByTime(String createTimeBegin, Long rateId) throws Exception {
List<Map<String, Object>> mapList=new ArrayList<Map<String,Object>>();
Map<String, Object> map=new HashMap<String, Object>();
map.put("createTimeBegin", createTimeBegin);
map.put("rateId", rateId);
Map<String, Object> pav2PayOrderObjMap = new HashMap<String, Object>();
//获取订单数据
List<Payv2PayOrder> payv2PayOrderList = payv2PayOrderMapper.selectByObjectDate(map);
for(Payv2PayOrder order : payv2PayOrderList){
pav2PayOrderObjMap.put(order.getOrderNum(), order);
}
Map<String, Object> payv2PayOrderRefundObjMap = new HashMap<String, Object>();
//获取退款订单数据
List<Payv2PayOrderRefund> payv2PayOrderRefundList = payv2PayOrderRefundMapper.selectByRefundTime(map);
for (Payv2PayOrderRefund refund : payv2PayOrderRefundList) {
payv2PayOrderRefundObjMap.put(refund.getRefundNum(), refund);
}
mapList.add(payv2PayOrderRefundObjMap);
mapList.add(pav2PayOrderObjMap);
return mapList;
}
public List<String> getBills() {
return payv2PayOrderClearMapper.getBills();
}
public List<Map<String,Object>> getBillList(String date) {
List<Map<String,Object>> billList = payv2PayOrderClearMapper.getBillList(date);
return billList;
}
@SuppressWarnings("unchecked")
public PageObject<OrderClearVO> getDifferOrder(Map<String, Object> map) {
int totalData = payv2PayOrderClearMapper.getDifferCount(map);
PageHelper helper = new PageHelper(totalData, map);
List<OrderClearVO> differOrder = payv2PayOrderClearMapper.getDifferOrder(helper.getMap());
PageObject<OrderClearVO> pageList = helper.getPageObject();
pageList.setDataList(differOrder);
return pageList;
}
public int isHaveBill(Map<String, Object> map) {
// 根据条件搜索出对账集合
List<Payv2PayOrderClear> orderClearList = payv2PayOrderClearMapper.isHaveBill(map);//搜索未出账的数据
List<Payv2PayOrderClear> orderClearList2 = payv2PayOrderClearMapper.isHaveClear(map);//搜索已出账的数据
int status = 0;
// 判断是否均已出账
System.out.println(orderClearList.size());
if(orderClearList.size() == 0 && orderClearList2.size() > 0){
status = 1; //有数据并可以出账单
}else if(orderClearList.size() > 0){
status = 2; //存在未出账的数据
}else if(orderClearList.size() == 0 && orderClearList2.size() == 0){
status = 3; //该商户在当前搜索条件无订单,只改变账单状态,不生成账单
}
return status;
}
public void updateClear(String ids) {
payv2PayOrderClearMapper.updateClear(ids);
//更改订单表状态已支付之类的。
List<Map<String, Object>> ordeClear = payv2PayOrderClearMapper.getOrdeClear(ids);
for (Map<String, Object> map : ordeClear) {
//交易
if(Integer.parseInt(map.get("type").toString())==1){
Payv2PayOrder order = new Payv2PayOrder();
order.setOrderNum(map.get("order_num").toString()); //订单号
order.setPayMoney(Double.valueOf(map.get("order_money").toString())); //订单金额
order.setPayDiscountMoney(Double.valueOf(map.get("order_money").toString())); //优惠后订单金额(=订单金额)
order.setPayWayMoney(Double.valueOf(map.get("buss_way_rate_money").toString())); //通道费
order.setPayStatus(Integer.parseInt(map.get("upstream_status").toString())); //状态(上游状态)
payv2PayOrderMapper.updateByEntity(order);
} else {
Payv2PayOrderRefund refund = new Payv2PayOrderRefund();
refund.setRefundNum(map.get("refund_num").toString());
refund.setRefundMoney(Double.valueOf(map.get("order_money").toString())); //退款金额
refund.setRefundStatus(Integer.parseInt(map.get("upstream_status").toString())); //状态(上游状态)
payv2PayOrderRefundMapper.updateByEntity(refund);
}
}
}
public void updateOutOrder(String date, String rateId) {
payv2PayOrderClearMapper.updateOutOrder(date, rateId);
List<Map<String, Object>> clearDetail = payv2PayOrderClearMapper.getClearDetail(date, rateId);
List<Payv2BussWayDetail> list = new ArrayList<Payv2BussWayDetail>();
for (int i = 0; i < clearDetail.size(); i++) { //只留退款记录
if(new Integer(2).equals(Integer.valueOf(clearDetail.get(i).get("type").toString()))){
continue;
}
Long companyId = Long.valueOf(clearDetail.get(i).get("company_id").toString()); //商户id
Long appId = Long.valueOf(clearDetail.get(i).get("app_id").toString()); //appId
Integer count = Integer.valueOf(clearDetail.get(i).get("counts").toString()); //交易总笔数
Double money = Double.valueOf(clearDetail.get(i).get("money").toString()); //交易总额
Double costRate = Double.valueOf(clearDetail.get(i).get("cost_rate").toString()); //成本费率
Double bussRate = Double.valueOf(clearDetail.get(i).get("buss_way_rate").toString()); //商户费率
Double costRateMoney = Double.valueOf(clearDetail.get(i).get("costMoney").toString()); //成本手续费
Double bussRateMoney = Double.valueOf(clearDetail.get(i).get("wayMoney").toString()); //商户手续费
Long channelId = Long.valueOf(clearDetail.get(i).get("channel_id").toString()); //
Payv2BussWayDetail detail = new Payv2BussWayDetail();
detail.setCompanyId(companyId);
detail.setAppId(appId);
detail.setSuccessCount(count);
detail.setSuccessMoney(money);
detail.setCostRate(costRate);
detail.setBussWayRate(bussRate);
detail.setCostRateMoney(costRateMoney);
detail.setBussWayRateMoney(bussRateMoney);
detail.setChannelId(channelId);
detail.setRefundCount(0);
detail.setRefundMoney(0.0);
detail.setPayWayId(Long.valueOf(rateId));
list.add(detail);
clearDetail.remove(i);
i--;
}
for (Map<String, Object> map : clearDetail) {
Long companyId = Long.valueOf(map.get("company_id").toString()); //商户id
Long appId = Long.valueOf(map.get("app_id").toString()); //appId
Integer count = Integer.valueOf(map.get("counts").toString()); //退款总笔数
Double money = Double.valueOf(map.get("money").toString()); //退款总额
for (Payv2BussWayDetail detail : list) {
if(companyId==detail.getCompanyId() && appId==detail.getAppId()){
detail.setRefundCount(count);
detail.setRefundMoney(money);
continue;
}
}
}
for (Payv2BussWayDetail detail : list) {
double ceil = DecimalUtil.getCeil(detail.getSuccessMoney()-detail.getRefundMoney(),2);
detail.setBussMoney(ceil); //支付净额
detail.setClearTime(DateUtil.StringToDate(date, DateStyle.YYYY_MM_DD));
detail.setCreateTime(new Date());
payv2BussWayDetailMapper.insertByEntity(detail);
}
}
public List<Payv2PayOrderClear> queryByApp(Map<String, Object> orderParam) {
return payv2PayOrderClearMapper.queryByApp(orderParam);
}
/**
* PINGANHandle
* 平安银行:对账接口数据解析
* @param list
* @param pav2PayOrderObjMap
* @param payv2PayOrderRefundObjMap
* @param payType
* @param rateValue 设定文件
* void 返回类型
*/
public void PINGANHandle(List<PANOrderVo> list, Map<String, Object> pav2PayOrderObjMap, Map<String, Object> payv2PayOrderRefundObjMap, String payType,
Double rateValue) {
try {
for (PANOrderVo panOrderVo : list) {
Payv2PayOrderClear clear = null;
// 交易类型
String ordtype = panOrderVo.getOrd_type();
// 商户流水号
String Ord_mct_id = panOrderVo.getOrd_mct_id();
// 支付集订单号
String Out_no = panOrderVo.getOut_no();
// 金额
String trade_amount = panOrderVo.getTrade_amount();
int trade_amount1 = Integer.valueOf(trade_amount);
// 实际交易是解决
String date = panOrderVo.getTrade_pay_time();
Date finishedTimeDate = null;
if (StringUtils.isNoneEmpty(date)) {
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
finishedTimeDate = df.parse(date);
}
double money = trade_amount1 / 100.00;
// 交易
if (ordtype.equals("1")) {
if (pav2PayOrderObjMap.containsKey(Out_no)) {
clear = getOrderClearByOrder(pav2PayOrderObjMap, Out_no, String.valueOf(money), "交易", payType, finishedTimeDate, rateValue);
}
if (clear != null) {
clear.setUpstreamTime(finishedTimeDate);
clear.setUpstreamAmount(money);
// 上游订单号:
clear.setTransactionId(Ord_mct_id);
clear.setClearTime(finishedTimeDate);
}
}
// 退款
if (ordtype.equals("2")) {
clear = getOrderClearByOrderRefund(payv2PayOrderRefundObjMap, pav2PayOrderObjMap, Out_no, String.valueOf(money), null, "退款", payType);
if (clear != null) {
clear.setUpstreamTime(finishedTimeDate);
clear.setUpstreamAmount(money);
// 上游退款订单号:
clear.setTransactionId(Ord_mct_id);
clear.setClearTime(finishedTimeDate);
}
}
if (clear != null) {
// 修改对账单状态
updateOrderClear(clear);
// payv2PayOrderClearMapper.insertByEntity(clear);
}
// 修改隔夜漏单情况
if (clear == null) {
int type = 1;
// 交易
if (ordtype.equals("1")) {
type = 1;
}
// 退款
if (ordtype.equals("2")) {
type = 2;
}
if (Out_no != null) {
updateOrderTime(Out_no, finishedTimeDate, money, type, Ord_mct_id);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("平安银行:对账接口数据完毕");
}
}
| [
"liushengmz@163.com"
] | liushengmz@163.com |
784eed6118d65fd78f2b9bdcfea0d00e64f41dea | 3abd7d584859db957d9840b0c8cee822589089da | /Desktop/YeShow/src/main/java/common/controller/EncodingFillter.java | c62f17903b5f9676521f7e4d7a953147dbeef3c1 | [] | no_license | ddeokho/YeShow | 48fc6a94bd10bfc515e28e79cec33594ec9faf47 | 1f4746cf21c5d2635c69dca12ba9a0c623de0e2d | refs/heads/master | 2022-12-06T11:01:46.757772 | 2020-08-26T09:19:48 | 2020-08-26T09:19:48 | 290,449,749 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,657 | java | package common.controller;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebFilter;
/**
* Servlet Filter implementation class EncodingFillter
*/
@WebFilter("/*")//WEBFILLTER
public class EncodingFillter implements Filter {
/**
* Default constructor.
*/
public EncodingFillter() {
// TODO Auto-generated constructor stub
}
/**
* @see Filter#destroy()
*/
public void destroy() {
// TODO Auto-generated method stub
}
/**
* @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain)
*/
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
//request�� ������ ���� ���� ó���� �ڵ尡 �ִٸ�
//�� ������ �����Ѵ�.
//���� request�� ���� �Ŀ� ���� ó���� �ڵ尡 �ִٸ�
//���� ���⼭ �����Ѵ�.
//�츮�� ��� ��û ó���DZ� ���� �ѱ� ���ڵ�
//ó���� ���Ϳ��� �� ����
request.setCharacterEncoding("UTF-8");
//System.out.println("�ѱ�ó�� ó���߾��");
chain.doFilter(request, response);
}
/**
* @see Filter#init(FilterConfig)
*/
public void init(FilterConfig fConfig) throws ServletException {
// TODO Auto-generated method stub
}
}
| [
"sksski1359@gmail.com"
] | sksski1359@gmail.com |
fcbb47e350c2b3be3abb80a55062067c7fbb24b5 | 0039dc07de2e539748e40db7b060367f0f2a3d99 | /CreditAnalytics/2.3/src/org/drip/quant/solver1D/FixedPointFinderOutput.java | 796b27545f32e6898a8d0504156995b4041bf61b | [
"Apache-2.0"
] | permissive | tech2bg/creditanalytics | a4318518e42a557ffb3396be9350a367d3a208b3 | b24196a76f98b1c104f251d74ac22a213ae920cf | refs/heads/master | 2020-04-05T23:46:29.529999 | 2015-05-07T01:40:52 | 2015-05-07T01:40:52 | 35,299,804 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,484 | java |
package org.drip.quant.solver1D;
/*
* -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*/
/*!
* Copyright (C) 2014 Lakshmi Krishnamurthy
* Copyright (C) 2013 Lakshmi Krishnamurthy
* Copyright (C) 2012 Lakshmi Krishnamurthy
*
* This file is part of DRIP, a free-software/open-source library for fixed income analysts and developers -
* http://www.credit-trader.org/Begin.html
*
* DRIP is a free, full featured, fixed income rates, credit, and FX analytics library with a focus towards
* pricing/valuation, risk, and market making.
*
* 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.
*/
/**
* FixedPointFinderOutput holds the result of the fixed point search.
*
* FixedPointFinderOutput contains the following fields:
* - Whether the search completed successfully
* - The number of iterations, the number of objective function base/derivative calculations, and the time
* taken for the search
* - The output from initialization
*
* @author Lakshmi Krishnamurthy
*/
public class FixedPointFinderOutput {
private int _iNumOFCalcs = 0;
private long _lStartTime = 0L;
private int _iNumIterations = 0;
private int _iNumOFDerivCalcs = 0;
private boolean _bHasRoot = false;
private double _dblRoot = java.lang.Double.NaN;
private double _dblRootFindingTime = java.lang.Double.NaN;
private org.drip.quant.solver1D.ExecutionInitializationOutput _eiop = null;
/**
* FixedPointFinderOutput constructor
*
* @param eiop Execution Initialization Output 1D
*
* @throws java.lang.Exception Thrown if inputs are invalid
*/
public FixedPointFinderOutput (
final org.drip.quant.solver1D.ExecutionInitializationOutput eiop)
throws java.lang.Exception
{
if (null == (_eiop = eiop))
throw new java.lang.Exception ("FixedPointFinderOutput constructor: Invalid inputs!");
_lStartTime = System.nanoTime();
}
/**
* Set the Root
*
* @param dblRoot Root
*
* @return TRUE => Successfully set
*/
public boolean setRoot (
final double dblRoot)
{
_dblRootFindingTime = (System.nanoTime() - _lStartTime) * 0.000001;
if (!org.drip.quant.common.NumberUtil.IsValid (_dblRoot = dblRoot)) return false;
return _bHasRoot = true;
}
/**
* Indicate whether the root is present in the output, i.e., if the finder has successfully completed.
*
* @return TRUE => Root exists in the output
*/
public boolean containsRoot()
{
return _bHasRoot;
}
/**
* Return the time elapsed for the the full root finding operation
*
* @return Time taken for root finding
*/
public double time()
{
return _dblRootFindingTime;
}
/**
* Return the root
*
* @return Root
*/
public double getRoot()
{
return _dblRoot;
}
/**
* Increment the number of Iterations
*
* @return TRUE => Successfully incremented
*/
public boolean incrIterations()
{
++_iNumIterations;
return true;
}
/**
* Return The number of iterations taken
*
* @return Number of iterations taken
*/
public int getNumIterations()
{
return _iNumIterations;
}
/**
* Increment the number of Objective Function evaluations
*
* @return TRUE => Successfully incremented
*/
public boolean incrOFCalcs()
{
++_iNumOFCalcs;
return true;
}
/**
* Retrieve the number of objective function calculations needed
*
* @return Number of objective function calculations needed
*/
public int getNumOFCalcs()
{
return _iNumOFCalcs;
}
/**
* Increment the number of Objective Function Derivative evaluations
*
* @return TRUE => Successfully incremented
*/
public boolean incrOFDerivCalcs()
{
++_iNumOFDerivCalcs;
return true;
}
/**
* Retrieve the number of objective function derivative calculations needed
*
* @return Number of objective function derivative calculations needed
*/
public int getNumOFDerivCalcs()
{
return _iNumOFDerivCalcs;
}
/**
* Retrieve the Execution Initialization Output
*
* @return Execution Initialization Output
*/
public org.drip.quant.solver1D.ExecutionInitializationOutput getEIOP()
{
return _eiop;
}
/**
* Return a string form of the root finder output
*
* @return String form of the root finder output
*/
public java.lang.String displayString()
{
java.lang.StringBuffer sb = new java.lang.StringBuffer();
sb.append (_eiop.displayString());
sb.append ("\n\tRoot finding Done? " + _bHasRoot + " [" + _dblRootFindingTime + " msec]");
sb.append ("\n\tRoot: " + _dblRoot);
sb.append ("\n\tNum Iterations: " + _iNumIterations);
sb.append ("\n\tNum OF Calculations: " + _iNumOFCalcs);
sb.append ("\n\tNum OF Derivative Calculations: " + _iNumOFDerivCalcs);
return sb.toString();
}
}
| [
"OpenCredit@DRIP"
] | OpenCredit@DRIP |
86a2af77868d49f8a100239737a69ea18b132eeb | f11f4580f62d7c2aa1d0641ba131b185bdac4358 | /app/src/main/java/com/teamnamenotfoundexception/hoteller/fragments/Tut2Fragment.java | 154017f454d65ae25749467e7d0b6b72f85d05e3 | [] | no_license | deepakchethan/Hotel-Management-App | 1fd1f4045b5d825e6c1eeb5bf7d51b7c93ebe9bf | 779aafb935eda5741e9cbafbdedb0218432bd5b3 | refs/heads/master | 2021-04-06T04:08:59.107875 | 2019-10-01T14:40:11 | 2019-10-01T14:40:11 | 124,899,215 | 0 | 1 | null | 2019-10-01T14:40:12 | 2018-03-12T14:10:47 | Java | UTF-8 | Java | false | false | 724 | java | package com.teamnamenotfoundexception.hoteller.fragments;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.teamnamenotfoundexception.hoteller.R;
/**
* A simple {@link Fragment} subclass.
*/
public class Tut2Fragment extends Fragment {
public Tut2Fragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_tut2, container, false);
}
}
| [
"deepakchethan@outlook.com"
] | deepakchethan@outlook.com |
7faa3720c9c23f697061a0e4fae7a1ff154a2be9 | 96dcb3b1e90e461bcf7879b5423fade5648edf88 | /data/src/main/java/conductor/com/data/repository/AbstractDataSource.java | afdc241a076737769d15d6ab11360d2e2d6f31d5 | [] | no_license | nihad92/MVI-Android-Architecture | 5a748d2f54fa206f8c3945df4caa3bdaa6444a9d | 43dfe905ed4356e04e5f87c6546e38c18db5fab2 | refs/heads/master | 2021-07-15T16:00:39.248178 | 2017-10-21T01:13:17 | 2017-10-21T01:13:17 | 107,741,166 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 265 | java | package conductor.com.data.repository;
import io.reactivex.Observable;
public abstract class AbstractDataSource<A, B> {
public final Observable<A> fetch(B payload) {
return fetchData(payload);
}
protected abstract Observable<A> fetchData(B payload);
}
| [
"nihad92@gmail.com"
] | nihad92@gmail.com |
25047b9c13084c494ffca88265ab2490a19f34e1 | f1fe63712d5dfa895a2ff7fd23e591acd8850b37 | /SPORTCRED/src/main/java/c01/todoteamname/project/SPORTCRED/ResetDebate.java | 63a5965ff2bdad032bf0a637f31d8479816e7789 | [] | no_license | aumpatel3113/SportCred-Web-App | d84c745528a299446181fc728cf81b788056f9ef | dad2335e8c9d225c3b81fc096473d9e122a5a397 | refs/heads/master | 2023-02-04T02:28:05.294938 | 2020-12-22T20:50:27 | 2020-12-22T20:50:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,187 | java | package c01.todoteamname.project.SPORTCRED;
import java.io.IOException;
import org.json.JSONException;
import org.json.JSONObject;
import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;
public class ResetDebate implements HttpHandler {
final static String password = "SPORTCRED IS VERY COOL, YES IT IS";
Neo4JDB nb = Neo4JDB.createInstanceOfDatabase();
public ResetDebate() {}
@Override
public void handle(HttpExchange r) {
try {
if (r.getRequestMethod().equals("PUT")) {
handleGet(r);
}
} catch (Exception e) {
try {
r.sendResponseHeaders(400, -1);
} catch (IOException e1) {
}
}
}
private void handleGet(HttpExchange r) throws IOException, JSONException {
String body = Utils.convert(r.getRequestBody());
JSONObject deserialized = new JSONObject(body);
if (deserialized.has("password")) {
if (deserialized.get("password").equals(password)) {
this.nb.resetDebateQuestions(r);
r.sendResponseHeaders(200, -1);
} else {
r.sendResponseHeaders(400, -1);
}
}
else {
r.sendResponseHeaders(400, -1);
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
c72f3a2de59b435528974dea767a0781a6083a03 | 34e7d519efe420ac68e7663fd5a069289c02dc30 | /src/main/java/me/hyperburger/contry/Methods.java | b722a9f75898cc84bafadad098dfeb42c3897161 | [] | no_license | Hyperburger/NightVisionPublic2 | b164874fd5a740558368926b66610a5b87de26b4 | a956d0a256caf027823bb33e2ec14929642f84f1 | refs/heads/master | 2020-07-02T09:17:40.622111 | 2019-08-09T14:23:20 | 2019-08-09T14:23:20 | 201,483,700 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 196 | java | package me.hyperburger.contry;
import org.bukkit.ChatColor;
public class Methods {
public static String pl(String M) {
return ChatColor.translateAlternateColorCodes('&', M);
}
} | [
"eueu309@gmail.com"
] | eueu309@gmail.com |
ffc3f13db7df33e20418c274969401dd3763f2b2 | a111991e703fa5524a556f21578dc724aeb0de5b | /app/src/androidTest/java/com/venkateshsuvarna/carzbuy/ExampleInstrumentedTest.java | 32fabcd3454d3462f2a0d1ae8c9905ea182e20d2 | [] | no_license | venkateshsuvarna/carzbuy-android-mvp | cf01488c1f2a6ae7d606f078457c47f7d48f4360 | 321e4bdbd101ca7ca6c66bf1400aa66aff40674c | refs/heads/master | 2020-03-28T07:23:55.591796 | 2018-09-08T03:43:59 | 2018-09-08T03:43:59 | 147,898,394 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 740 | java | package com.venkateshsuvarna.carzbuy;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.venkateshsuvarna.carzbuy", appContext.getPackageName());
}
}
| [
"venkatesh.l.suvarna1@gmail.com"
] | venkatesh.l.suvarna1@gmail.com |
9edb5b52f89b34953263acba815428063f2713af | c764c139ba2869a520524c20e1c8b2315690cc70 | /src/_01/composition/Fuel.java | ee3831630f6acde5d0da43ac3a0d2a54530505f6 | [] | no_license | furkansuglun/SpringCore_fromBook | 6ba1061b10efb5d64c9b0290c4aabf92379cc7ad | c9964fab9aee1d646837c5bb525f678cdb122117 | refs/heads/master | 2021-01-11T19:15:25.935511 | 2017-01-27T17:50:59 | 2017-01-27T17:50:59 | 79,343,894 | 0 | 0 | null | null | null | null | ISO-8859-16 | Java | false | false | 116 | java | package _01.composition;
public class Fuel {
public void hasFuel() {
System.out.println("Yakęt var.");
}
}
| [
"sulun_furkan.54@hotmail.com"
] | sulun_furkan.54@hotmail.com |
51e0e576b1016e5e7531e4886fd2a156b0b2b866 | 851103ede3b14da72706a4fdfdbbf26c1cb7871f | /test0419/Main2.java | 8aa990629211e527521834ba05d7765d7fb57ac4 | [] | no_license | Ren-Yaqian/nowcoder-exercise | 6033846fb18f4dc813382ad9297df76f10f0d0d5 | 49157e7bed0858053188cc72db20525846a1ece1 | refs/heads/main | 2023-07-05T02:05:42.660658 | 2021-08-11T01:17:52 | 2021-08-11T01:17:52 | 359,762,702 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 946 | java | package test0419;
//删数
import java.util.Scanner;
public class Main2 {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
while (scan.hasNext()) {
int n = scan.nextInt();
if(n>1000){
n = 999;
}
boolean[] delete = new boolean[n];
int count = 0;
int index = 0;
int num = 0;
while (count < n) {
for (int i = 0; i != n; ++i) {
if (delete[i] == false) {
++num;
if (num == 3) {
delete[i] = true;
num = 0;
++count;
index = i;
}
}
}
}
System.out.println(index);
}
}
} | [
"noreply@github.com"
] | noreply@github.com |
755fdc79526e916318878b1fa200893c8e27eb0b | ce1a693343bda16dc75fd64f1688bbfa5d27ac07 | /testsuite/src/main/org/jboss/test/web/servlets/StandaloneENCServlet.java | f8406d7c0a54f7cbc923d58b84ccf32d88e02a00 | [] | no_license | JavaQualitasCorpus/jboss-5.1.0 | 641c412b1e4f5f75bb650cecdbb2a56de2f6a321 | 9307e841b1edc37cc97c732e4b87125530d8ae49 | refs/heads/master | 2023-08-12T08:39:55.319337 | 2020-06-02T17:48:09 | 2020-06-02T17:48:09 | 167,004,817 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,723 | java | /*
* JBoss, Home of Professional Open Source.
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software 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.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.test.web.servlets;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Date;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/** Tests of the server ENC naming context configured via web.xml. This servlet has
* no dependencies on other ee component deployments as the env references are to mock
* objects. It does depend on a kernel beans deployment to setup the jndi bindings.
*
* @author Scott.Stark@jboss.org
* @version $Revision: 85945 $
*/
public class StandaloneENCServlet extends HttpServlet
{
private static final long serialVersionUID = 1;
org.jboss.logging.Logger log = org.jboss.logging.Logger.getLogger(getClass());
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
ENCTester tester = new ENCTester(log);
tester.testENC();
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head><title>ENCServlet</title></head>");
out.println("<body>Tests passed<br>Time:" + new Date() + "</body>");
out.println("</html>");
out.close();
}
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
processRequest(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
processRequest(request, response);
}
}
| [
"taibi@sonar-scheduler.rd.tut.fi"
] | taibi@sonar-scheduler.rd.tut.fi |
2ccc551cacc8606db61e875dbdd619a99c5d1a79 | 9c64ab252d5ce42427ddb45cd4be3d6482a6a890 | /jud-cloud-framework/jud-cloud-upms/jud-cloud-upms-biz/src/main/java/jud/cloud/upms/biz/service/MobileService.java | ffdf208e18bc0076c43f413988fc71f4ee84cef2 | [] | no_license | apc2018/jud-cloud | f0a93cb6dec7302d7b326c808b42a5a20ae3ff66 | c2291bd172582217ba4f148339fb01ba0a16acf8 | refs/heads/master | 2020-08-01T03:47:38.045862 | 2019-09-25T14:08:06 | 2019-09-25T14:08:06 | 209,495,940 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 253 | java | package jud.cloud.upms.biz.service;
import jud.cloud.common.core.util.R;
public interface MobileService {
/**
* 发送手机验证码
*
* @param mobile mobile
* @return code
*/
R<Boolean> sendSmsCode(String mobile);
}
| [
"tj007_bo@163.com"
] | tj007_bo@163.com |
4291cebdb420f856f5b103702cf8553b62065d1b | 495334c8e93b2fd5f0966e4bddd4bca7549e456b | /app/src/main/java/edu/coe/shughes/movingdots/BugView.java | 35b0b59c596a08636f56ab6bc7af5ecc12f6fafa | [] | no_license | IJTillman/Bugs_Game | 65154c198e7e53798aaa5bea09e8225cdcfd097f | 67016349e33d12a4dc77d1bb4463f0fa0d763a36 | refs/heads/master | 2021-01-17T15:45:20.007931 | 2017-04-17T02:55:07 | 2017-04-17T02:55:07 | 84,111,894 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,631 | java | package edu.coe.shughes.movingdots;
import android.content.Context;
import android.os.Handler;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.Toast;
import java.util.Random;
/**
* Created by SHughes on 3/2/2017.
*/
public class BugView extends ImageView {
public static final int REDBUG = 1;
public static final int BLUEBUG = 0;
private int maxX;
private int maxY;
private int minX;
private int minY;
private int x;
private int y;
private Random rand;
private Random rand1;
private Random rand2;
private Speed speed;
private float direction;
private double dirRad;
private int size;
private int type;
private Handler refreshHandler = new Handler();
private long delay = 50;
private boolean squished;
private int timeDead;
private boolean dead;
private float opacity;
public BugView(Context context) {
super(context);
init(1);
}
public BugView(Context context, int i, Speed global_speed) {
super(context);
init(i);
setSpeed(global_speed);
}
public BugView(Context context, AttributeSet attrs) {
super(context, attrs);
init(1);
}
public BugView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(1);
}
private void init(int i){
rand = new Random();
rand1 = new Random();
rand2 = new Random();
maxY= 500;
maxX = 1000;
minX = 0;
minY= 0;
size = 150;
squished = false;
// Adjust the size of the bug
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(size, size);
setLayoutParams(layoutParams);
//speed = 20;
direction = 180;
dirRad = direction * Math.PI /180;
setRotation(direction);
opacity = 1f;
dead = false;
if (i == 1) {
type = 1;
setBugType(1);
x = rand1.nextInt(maxX/2-50)+maxX/2+60;
y = rand2.nextInt(maxY-15);
setX(x);
setY(y);
}
else{
type = 0;
setBugType(0);
x = rand1.nextInt(maxX/2-60);
y = rand2.nextInt(maxY-15);
setX(0);
setY(y);
}
refreshHandler.post(update);
}
private void setSpeed(Speed speed1){
speed = speed1;
}
public void setBugType(int t){
Random randNum = new Random();
int test = randNum.nextInt(3);
if (t == BLUEBUG){
if(test == 0) {
setImageResource(R.drawable.bluebug);
}
if(test ==1){
setImageResource(R.mipmap.bluebug2);
}
if(test==2){
setImageResource(R.mipmap.bluebug3);
}
}
else{
if(test == 0) {
setImageResource(R.drawable.redbug);
}
if(test ==1){
setImageResource(R.mipmap.redbug2);
}
if(test==2){
setImageResource(R.mipmap.redbug3);
}
}
}
public void squished(int i){
if (i==0){
setImageResource(R.mipmap.blue);
squished = true;
}
else{
setImageResource(R.mipmap.red);
squished = true;
}
}
public boolean getSquished(){
return squished;
}
private Runnable update = new Runnable() {
@Override
public void run() {
if (!squished) {
int newx;
int newy;
if (rand.nextInt(30) < 2) {
direction += rand.nextInt(90) - 45;
dirRad = direction * Math.PI / 180;
setRotation(direction);
}
newx = x + (int) (speed.getSpeed() * Math.sin(dirRad));
newy = y - (int) (speed.getSpeed() * Math.cos(dirRad));
if (collision(newx,newy)) {
direction = (direction + 180) % 360;
dirRad = direction * Math.PI / 180;
setRotation(direction);
}
else {
x = newx;
y = newy;
setX(x);
setY(y);
}
//Log.d("BUGS", ((Integer)x).toString() + " "+ ((Integer)x).toString());
invalidate();
refreshHandler.postDelayed(update, delay);
}
else {
timeDead = timeDead + 50;
if (timeDead > 500) {
opacity = opacity - 0.05f;
setAlpha(opacity);
if (timeDead > 1500) {
dead = true;
Thread.interrupted();
}
}
invalidate();
refreshHandler.postDelayed(update, delay);
}
}
};
private boolean collision(int newx, int newy){
boolean test1 = true;
boolean test2 = true;
test1 = (newx > maxX - 10) || (newx < minX + 10) || (newy > maxY - 10) || (newy < minY - 10);
if (type == 1){
test2 = (newx < maxX/2 + 50);
}
else{
test2 = (newx > maxX/2 - 50);
}
return (test1 || test2);
}
}
| [
"ijtillman@coe.edu"
] | ijtillman@coe.edu |
058934a6ace6a7fd6c5b3800b3eb44822fe67738 | 0e0848cf21f4ff8529960b39c05027335b818a0e | /src/com/sfc/leetcode/Two_Sum.java | 0364b362e7af4c4a71fa0b7880e5df14e8b1e5a1 | [] | no_license | slowfishcolor/leetcode-new | 184f24a7d6cb5fe06291920424c5467e1448df2d | 8fc775dbcc8698395228ff7ef40228f88518987a | refs/heads/master | 2021-01-21T10:16:18.113934 | 2017-09-20T15:27:23 | 2017-09-20T15:27:23 | 83,401,438 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,104 | java | package com.sfc.leetcode;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* Given an array of integers, return indices of the two numbers such that they add up to a specific target.
* You may assume that each input would have exactly one solution, and you may not use the same element twice.
* 给定一个整形数组,找出其中的两个数,使其和为某个指定的值
* Created by Prophet on 2017/2/23.
*/
public class Two_Sum {
/**
* 暴力搜索, O(n2)
* @param nums
* @param target
* @return
*/
public int[] twoSum(int[] nums, int target) {
if (nums == null || nums.length < 2) return null;
for (int i = 0; i < nums.length - 1; i++ ) {
int t = target - nums[i];
for (int j = i + 1; j < nums.length; j++) {
if (t == nums[j]) return new int[]{i, j};
}
}
return null;
}
/**
* 先排序,再从两头开始查找 O(NlogN + N)
* 然而排序后顺序乱了。。。
* @param nums
* @param target
* @return
*/
public int[] twoSum1(int[] nums, int target) {
if (nums == null || nums.length < 2) return null;
Arrays.sort(nums);
for (int i = 0, j = nums.length - 1; i < j; ) {
int t = nums[i] + nums[j];
if (t == target) {return new int[] {i, j};}
if (t > target) {j--;}
else {i++;}
}
return null;
}
/**
* Hash 存储,直接找,O(n)
* 有可能存在相同的元素
* map存的value是元素出现的次数
* @param nums
* @param target
* @return
*/
public int[] twoSum2(int[] nums, int target) {
if (nums == null || nums.length < 2) return null;
Map<Integer, Integer> map = new HashMap<>();
for (int i = 0; i < nums.length; i++) {
int t = target - nums[i];
if (map.containsKey(t))
return new int[] {map.get(t), i};
map.put(nums[i], i);
}
return null;
}
}
| [
"slowfishcolor@gmail.com"
] | slowfishcolor@gmail.com |
2f4b7f3f258d62eadd32e3994d70ca67bd83fc49 | 91f71e2609437e6354f73d2dcb1cf96521bcceba | /src/cn/infection/utils/PageBean.java | 7e9fa25c600dfdbee308bbcef567e11dc10fed4c | [] | no_license | riceDarling/CAS_Infection | 855d6111bdf24da4dd5dcd48b35d94f96ab1de94 | b7138240a33c87e135f27403b03806856dc14cfb | refs/heads/master | 2021-01-22T13:23:53.842961 | 2017-08-18T01:56:52 | 2017-08-18T10:17:47 | 100,662,009 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,478 | java | package cn.infection.utils;
import javax.servlet.http.HttpServletRequest;
public class PageBean {
/**
* 获取界面显示页数
*
* @param request
* @return
*/
public static int getPageCount(HttpServletRequest request) {
int pageCount = 10;
String param = request.getParameter("pageCount");
if (param != null && !param.trim().isEmpty()) {
try {
pageCount = Integer.parseInt(param);
} catch (RuntimeException e) {
throw e;
}
}
return pageCount;
}
/**
* 获取当前页码
*
* @param request
* @return
*/
public static int getCurrentPage(HttpServletRequest request) {
int currentPage = 1;
String param = request.getParameter("currentPage");
if (param != null && !param.trim().isEmpty()) {
try {
currentPage = Integer.parseInt(param);
} catch (RuntimeException e) {
throw e;
}
}
return currentPage;
}
/**
* 截取url,页面中的分页导航中需要使用它做为超链接的目标!
*
* @param request
* @return
*/
public static String getUrl(HttpServletRequest request) {
String url = request.getRequestURI() + "?" + request.getQueryString();
/* 如果url中存在pc参数,就截取掉,不存在就不用截取 */
int index = url.lastIndexOf("¤tPage=");
if (index != -1) {
url = url.substring(0, index);
}
//System.out.println("------------------------------"+url);
return url;
}
}
| [
"2398300521@qq.com"
] | 2398300521@qq.com |
e091201f142a2f9b035afcf159aad756f7d3a026 | 8c7b37a4c6680eb2fd72fcc8e119c3a8bb9eb259 | /patterns/src/patterns/BehavourialPattern1.java | 79694d241091a1f152d3aac579e7b2d554e0c3c2 | [] | no_license | tejas-epam/Pissay-tejaswini-design-patterns | 71dab4d5ac3fae7c560715ef387450eb2463a4c0 | a92f5f7f6c51a8707f75070dbab5b20857149900 | refs/heads/master | 2021-03-09T20:38:35.941730 | 2020-03-10T18:36:47 | 2020-03-10T18:36:47 | 246,378,696 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 951 | java | package patterns;
public class BehavourialPattern1 {
public static void main(String[] args)
{
Alert A = new Alert();
A.alert();
A.alert();
A.set(new Silent());
A.alert();
A.alert();
}
}
interface MobileAlert
{
public void alert(Alert a);
}
class Alert
{
private MobileAlert currentState;
public Alert()
{
currentState = new Vibration();
}
public void set(MobileAlert ma)
{
currentState = ma;
}
public void alert()
{
currentState.alert(this);
}
}
class Vibration implements MobileAlert
{
public void alert(Alert a)
{
System.out.println("vibration");
}
}
class Silent implements MobileAlert
{
public void alert(Alert a)
{
System.out.println("silent");
}
}
| [
"tejaswini@DESKTOP-MNBVGCS"
] | tejaswini@DESKTOP-MNBVGCS |
98ed4b78e64dd9f66cc99247b587d1d2cb8e4a27 | 32dc3c1948b43b1fb1791088f429900d1adbf619 | /ClassificationTraining/huaweiSimple/CountCharacters2.java | 85a0dccc9c25e3c89dc66b9fda04f83df8d61e0e | [
"MIT"
] | permissive | Kevin-SJW/Enterprise-programming-exercises | a6a00e6477163bec55ba7d9bcd72c6f81bce3c7c | 7b64e7c7c0d4b5bb4624b7ce3f5875485ab2d614 | refs/heads/master | 2021-06-20T11:11:38.396675 | 2021-02-20T13:32:08 | 2021-02-20T13:32:08 | 177,378,667 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,375 | java | package ClassificationTraining.huaweiSimple;
/**
* @Classname CountCharacters2
* @Description TODO
* @Date 2020/10/7 20:28
* @Created by Administrator
*/
public class CountCharacters2 {
public static void main(String[] args) {
String[] words = {"cat", "bt", "hat", "tree"};
String chars = "atach";
System.out.println(countCharacters(words, chars));
}
public static int countCharacters(String[] words, String chars) {
if (words == null || words.length == 0) {
return 0;
}
if (chars == null || chars.length() == 0) {
return 0;
}
int ans = 0;
char[] value = getChars(chars);
for (String word : words) {
char[] cur = getChars(word);
int len = word.length();
if (cmp(cur, value)) {
ans += len;
}
}
return ans;
}
//string 2 array
public static char[] getChars(String s) {
char[] value = new char[26];
for (int i = 0; i < s.length(); i++) {
value[s.charAt(i) - 'a']++;
}
return value;
}
public static boolean cmp(char[] cur, char[] values) {
for (int i = 0; i < cur.length; i++) {
if (cur[i] > values[i]) {
return false;
}
}
return true;
}
}
| [
"shijianweicisco@163.com"
] | shijianweicisco@163.com |
ab0798ff4a0bba68cf6a427f2fb74d4780710cc2 | 750560577778994af1137b860a364e23a5b8a57f | /src/com/schoolcontact/utils/AsyncImageLoader.java | 43a262ac2036c3278f9dde45d0e58c732c612bfa | [] | no_license | wujia28762/SchoolContact | 3f04ad7a138a3158969cba68179d4ad27822132f | d860662093eb4cd0c2130842becd8ba5d065258d | refs/heads/master | 2021-01-19T21:55:21.805147 | 2017-05-27T07:04:11 | 2017-05-27T07:04:11 | 88,723,078 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,363 | java | package com.schoolcontact.utils;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.ref.ReferenceQueue;
import java.lang.ref.SoftReference;
import java.net.HttpURLConnection;
import java.net.URL;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import com.school_contact.main.R;
import com.schoolcontact.listener.AsyncImageLoaderListener;
import com.schoolcontact.model.ImageViewWithUrl;
import com.schoolcontact.utils.ZoomImageView;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.BitmapFactory.Options;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Environment;
import android.support.v4.util.LruCache;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
/**
* 图片异步加载�?
*
*
*
*/
@SuppressLint("NewApi")
public class AsyncImageLoader {
private Context context;
// 内存缓存默认 5M
static final int MEM_CACHE_DEFAULT_SIZE = 5 * 1024 * 1024;
// 文件缓存默认 10M
static final int DISK_CACHE_DEFAULT_SIZE = 10 * 1024 * 1024;
// �?级内存缓存基�? LruCache
private LruCache<String, Bitmap> memCache;
// 二级文件缓存基于 DiskLruCache
private DiskLruCache diskCache;
private boolean isCompress;
private AsyncImageLoaderListener asyncimageloaderfinshlistener;
public void setAsyncimageloaderfinshlistener(
AsyncImageLoaderListener asyncimageloaderfinshlistener) {
this.asyncimageloaderfinshlistener = asyncimageloaderfinshlistener;
}
private TextView tv;
public AsyncImageLoader(Context context) {
this.context = context;
initMemCache();
initDiskLruCache();
}
/**
* 初始化内存缓�?
*/
private void initMemCache() {
memCache = new LruCache<String, Bitmap>(MEM_CACHE_DEFAULT_SIZE) {
@Override
protected int sizeOf(String key, Bitmap bitmap) {
return bitmap.getByteCount();
}
};
}
/**
* 初始化文件缓�?
*/
private void initDiskLruCache() {
try {
File cacheDir = getDiskCacheDir(context, "bitmap");
if (!cacheDir.exists()) {
cacheDir.mkdirs();
}
diskCache = DiskLruCache.open(cacheDir, getAppVersion(context), 1,
DISK_CACHE_DEFAULT_SIZE);
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* 从内存缓存中�?
*
* @param url
*/
public Bitmap getBitmapFromMem(String url) {
return memCache.get(url);
}
/**
* 加入到内存缓存中
*
* @param url
* @param bitmap
*/
public void putBitmapToMem(String url, Bitmap bitmap) {
memCache.put(url, bitmap);
}
/**
* 从文件缓存中�?
*
* @param url
*/
public Bitmap getBitmapFromDisk(String url) {
try {
String key = hashKeyForDisk(url);
DiskLruCache.Snapshot snapShot = diskCache.get(key);
Bitmap bitmap = null;
ReferenceQueue<Bitmap> queue = new ReferenceQueue<Bitmap>();
SoftReference<Bitmap> bitmapref = new SoftReference<Bitmap>(bitmap,
queue);
if (bitmapref != null) {
bitmap = (Bitmap) bitmapref.get();
}
if (snapShot != null) {
InputStream is = snapShot.getInputStream(0);
if (isCompress) {
BitmapFactory.Options options = new Options();
options.inJustDecodeBounds = true;
// BitmapFactory.decodeStream(is, null,options);
options.inPreferredConfig = Bitmap.Config.ARGB_4444;
options.inSampleSize = calculateInSampleSize(options,
EventList.comPressHeight, EventList.comPressHeight);
options.inJustDecodeBounds = false;
options.inPurgeable = true;
options.inInputShareable = true;
bitmap = BitmapFactory.decodeStream(is, null, options);
} else {
bitmap = BitmapFactory.decodeStream(is);
}
return bitmap;
}
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
/**
* �? url 加载图片
*
* @param imageView
* @param imageUrl
*/
public Bitmap loadImage(ImageView imageView, String imageUrl) {
// 先从内存中拿
Bitmap bitmap = null;
ReferenceQueue<Bitmap> queue = new ReferenceQueue<Bitmap>();
SoftReference<Bitmap> bitmapref = new SoftReference<Bitmap>(bitmap,
queue);
if (bitmapref != null) {
bitmap = (Bitmap) bitmapref.get();
}
bitmap = getBitmapFromMem(imageUrl);
if (bitmap != null) {
Log.i("leslie", "image exists in memory");
return bitmap;
}
// 再从文件中找
bitmap = getBitmapFromDisk(imageUrl);
if (bitmap != null) {
Log.i("leslie", "image exists in file");
// 重新缓存到内存中
putBitmapToMem(imageUrl, bitmap);
return bitmap;
}
// 内存和文件中都没有再从网络下�?
if (!TextUtils.isEmpty(imageUrl)) {
if (asyncimageloaderfinshlistener != null)
asyncimageloaderfinshlistener.StartLoader();
new ImageDownloadTask(imageView).execute(imageUrl);
}
return null;
}
class ImageDownloadTask extends AsyncTask<String, Integer, Bitmap> {
private String imageUrl;
private ImageView imageView;
private ZoomImageView ziv;
private ImageViewWithUrl mImageViewWithUrl;
public ImageDownloadTask(ImageView imageView) {
this.imageView = imageView;
}
public ImageDownloadTask(ZoomImageView zoomiv) {
this.ziv = zoomiv;
}
public ImageDownloadTask(ImageViewWithUrl zoomiv) {
this.mImageViewWithUrl = zoomiv;
}
@Override
protected Bitmap doInBackground(String... params) {
try {
imageUrl = params[0];
String key = hashKeyForDisk(imageUrl);
// 下载成功后直接将图片流写入文件缓�?
DiskLruCache.Editor editor = diskCache.edit(key);
if (editor != null) {
OutputStream outputStream = editor.newOutputStream(0);
if (downloadUrlToStream(imageUrl, outputStream)) {
editor.commit();
} else {
editor.abort();
}
}
diskCache.flush();
Bitmap bitmap = null;
ReferenceQueue<Bitmap> queue = new ReferenceQueue<Bitmap>();
SoftReference<Bitmap> bitmapref = new SoftReference<Bitmap>(
bitmap, queue);
if (bitmapref != null) {
bitmap = (Bitmap) bitmapref.get();
}
bitmap = getBitmapFromDisk(imageUrl);
if (bitmap != null) {
// 将图片加入到内存缓存�?
putBitmapToMem(imageUrl, bitmap);
return bitmap;
}
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Bitmap result) {
super.onPostExecute(result);
if (result != null) {
// 通过 tag 来防止图片错�?
if (imageView != null && imageView.getTag() != null
&& imageView.getTag().equals(imageUrl)) {
if (imageView instanceof ZoomImageView) {
//
((ZoomImageView) imageView).setImageBitmap(result);
((ZoomImageView) imageView).setBackgroundColor(context.getResources().getColor(R.color.hei));
} else {
imageView.setImageBitmap(result);
imageView.setBackgroundResource(0);
}
} else if (mImageViewWithUrl != null
&& mImageViewWithUrl.getmUrl().equals(imageUrl)) {
mImageViewWithUrl.getmImageView().setImageBitmap(result);
mImageViewWithUrl.getmImageView().setBackgroundResource(0);
}
if (asyncimageloaderfinshlistener != null) {
asyncimageloaderfinshlistener.FinshLoader();
}
}
}
private boolean downloadUrlToStream(String urlString,
OutputStream outputStream) {
HttpURLConnection urlConnection = null;
BufferedOutputStream out = null;
BufferedInputStream in = null;
try {
final URL url = new URL(urlString);
urlConnection = (HttpURLConnection) url.openConnection();
in = new BufferedInputStream(urlConnection.getInputStream(),
8 * 1024);
out = new BufferedOutputStream(outputStream, 8 * 1024);
int b;
while ((b = in.read()) != -1) {
out.write(b);
}
return true;
} catch (final IOException e) {
e.printStackTrace();
} finally {
if (urlConnection != null) {
urlConnection.disconnect();
}
try {
if (out != null) {
out.close();
}
if (in != null) {
in.close();
}
} catch (final IOException e) {
e.printStackTrace();
}
}
return false;
}
}
private File getDiskCacheDir(Context context, String uniqueName) {
String cachePath;
if (Environment.MEDIA_MOUNTED.equals(Environment
.getExternalStorageState())
|| !Environment.isExternalStorageRemovable()) {
cachePath = context.getExternalCacheDir().getPath();
} else {
cachePath = context.getCacheDir().getPath();
}
return new File(cachePath + File.separator + uniqueName);
}
private int getAppVersion(Context context) {
try {
PackageInfo info = context.getPackageManager().getPackageInfo(
context.getPackageName(), 0);
return info.versionCode;
} catch (NameNotFoundException e) {
e.printStackTrace();
}
return 1;
}
private String hashKeyForDisk(String key) {
String cacheKey;
try {
final MessageDigest mDigest = MessageDigest.getInstance("MD5");
mDigest.update(key.getBytes());
cacheKey = bytesToHexString(mDigest.digest());
} catch (NoSuchAlgorithmException e) {
cacheKey = String.valueOf(key.hashCode());
}
return cacheKey;
}
private String bytesToHexString(byte[] bytes) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < bytes.length; i++) {
String hex = Integer.toHexString(0xFF & bytes[i]);
if (hex.length() == 1) {
sb.append('0');
}
sb.append(hex);
}
return sb.toString();
}
public Bitmap loadImage(ImageViewWithUrl iv_bigimage, String imageUrl) {
// 先从内存中拿
Bitmap bitmap = null;
ReferenceQueue<Bitmap> queue = new ReferenceQueue<Bitmap>();
SoftReference<Bitmap> bitmapref = new SoftReference<Bitmap>(bitmap,
queue);
if (bitmapref != null) {
bitmap = (Bitmap) bitmapref.get();
}
bitmap = getBitmapFromMem(imageUrl);
if (bitmap != null) {
Log.i("leslie", "image exists in memory");
return bitmap;
}
// 再从文件中找
bitmap = getBitmapFromDisk(imageUrl);
if (bitmap != null) {
Log.i("leslie", "image exists in file");
// 重新缓存到内存中
putBitmapToMem(imageUrl, bitmap);
return bitmap;
}
// 内存和文件中都没有再从网络下�?
if (!TextUtils.isEmpty(imageUrl)) {
new ImageDownloadTask(iv_bigimage).execute(imageUrl);
}
return null;
}
public boolean isCompress() {
return isCompress;
}
public void setCompress(boolean isCompress) {
this.isCompress = isCompress;
}
public int calculateInSampleSize(BitmapFactory.Options op, int reqWidth,
int reqheight) {
int originalWidth = op.outWidth;
int originalHeight = op.outHeight;
int inSampleSize = 1;
if (originalWidth > reqWidth || originalHeight > reqheight) {
int halfWidth = originalWidth / 2;
int halfHeight = originalHeight / 2;
while ((halfWidth / inSampleSize > reqWidth)
&& (halfHeight / inSampleSize > reqheight)) {
inSampleSize *= 2;
}
}
return inSampleSize;
}
}
| [
"wujiaxing_687543@foxmail.com"
] | wujiaxing_687543@foxmail.com |
6f3418f76f174e086042b4b5a894729c87f93e6c | 53d677a55e4ece8883526738f1c9d00fa6560ff7 | /com/tencent/mm/plugin/emoji/ui/v2/EmojiStoreV2BaseFragment$6.java | e78134fdc88fab7ee09fd24978a64129962e943d | [] | no_license | 0jinxing/wechat-apk-source | 544c2d79bfc10261eb36389c1edfdf553d8f312a | f75eefd87e9b9ecf2f76fc6d48dbba8e24afcf3d | refs/heads/master | 2020-06-07T20:06:03.580028 | 2019-06-21T09:17:26 | 2019-06-21T09:17:26 | 193,069,132 | 9 | 4 | null | null | null | null | UTF-8 | Java | false | false | 672 | java | package com.tencent.mm.plugin.emoji.ui.v2;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
final class EmojiStoreV2BaseFragment$6
implements View.OnTouchListener
{
EmojiStoreV2BaseFragment$6(EmojiStoreV2BaseFragment paramEmojiStoreV2BaseFragment)
{
}
public final boolean onTouch(View paramView, MotionEvent paramMotionEvent)
{
return false;
}
}
/* Location: C:\Users\Lin\Downloads\dex-tools-2.1-SNAPSHOT\dex-tools-2.1-SNAPSHOT\classes2-dex2jar.jar
* Qualified Name: com.tencent.mm.plugin.emoji.ui.v2.EmojiStoreV2BaseFragment.6
* JD-Core Version: 0.6.2
*/ | [
"172601673@qq.com"
] | 172601673@qq.com |
ec0e0c6e93a3019e6f879e2efab3dfa681c2a5bd | d54eaa467935e554401638a7a5c06ee365e6cc3c | /src/main/java/com/simulations/covid/domain/SimulatorFacade.java | 09724bc296499818077769c2f13eb35ffbef8628 | [] | no_license | fay3r/covid-simulation-backend | 35134db60828b3480f534448ea93bca483ab843d | dc397974c7fe763ff5dfe44beb36bc869f952eed | refs/heads/master | 2023-04-27T06:25:39.672197 | 2021-05-26T22:43:50 | 2021-05-26T22:43:50 | 371,036,329 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,806 | java | package com.simulations.covid.domain;
import com.simulations.covid.dto.PersonDto;
import com.simulations.covid.dto.SimulationDto;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.transaction.annotation.Transactional;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Transactional
public class SimulatorFacade {
private static final Logger LOGGER = LoggerFactory.getLogger(SimulatorFacade.class);
private final SimulationDayRepository simulationDayRepository;
private final SimulationRepository simulationRepository;
private final PersonRepository personRepository;
private final DataCreator dataCreator;
private final SimulatorService simulatorService;
private final SimulationDataValidator simulationDataValidator;
public SimulatorFacade(SimulationDayRepository simulationDayRepository,
SimulationRepository simulationRepository,
PersonRepository personRepository,
DataCreator dataCreator,
SimulatorService simulatorService,
SimulationDataValidator simulationDataValidator) {
this.simulationDayRepository = simulationDayRepository;
this.simulationRepository = simulationRepository;
this.personRepository = personRepository;
this.dataCreator = dataCreator;
this.simulatorService = simulatorService;
this.simulationDataValidator = simulationDataValidator;
}
public LinkedHashMap<String,Object> runSimulation(SimulationDto simulationDto) {
LinkedHashMap<String,Object> returnData = new LinkedHashMap<>();
if(!simulationDataValidator.validate(simulationDto)){
LOGGER.info("INPUT DATA ERROR");
returnData.put("error","invalid input");
return returnData;
}
LOGGER.info("CORRECT INPUT DATA");
LOGGER.info("CREATING THE NECESSARY DATA");
int simulationId = dataCreator.putData(simulationDto,simulationRepository,personRepository);
LOGGER.info("COLLECTING INFO ABOUT PEOPLE");
List<PersonDto> persons = personRepository.findAllBySimulationId(simulationId)
.stream().map(Person::dto).collect(Collectors.toList());
LOGGER.info("SIMULATING PANDEMIC RUN");
simulatorService.simulate(simulationDto,simulationDayRepository,persons);
returnData.put("simulationDetails",simulationDto);
returnData.put("simulationId",simulationId);
returnData.put("run", simulationDayRepository.findAllBySimulationId(simulationId)
.stream().map(SimulationDay::dto).collect(Collectors.toList()));
return returnData;
}
}
| [
"patryks9090@gmail.com"
] | patryks9090@gmail.com |
c8f6e4a19740281f03ccb50ef03992e60693665f | 42bcadb7e9d0dadf73d53fe4a2da20b6ced95a43 | /src/singleton/VolatileDoubleCheckLazySingleton.java | 608d84a41cc6cdd3c88ea5981223103707553175 | [] | no_license | VangelisHaha/design-patterns-demo | a6da13d9f0ea29b0b7a6ec32aecb847fc3742bbd | c8d32a0cafe4a47cbccb2b2619c7b702ab0f3f4b | refs/heads/master | 2020-06-04T14:05:24.737288 | 2019-07-17T04:40:39 | 2019-07-17T04:40:39 | 192,054,520 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,002 | java | package singleton;
import java.io.IOException;
import java.net.Socket;
import java.nio.channels.SocketChannel;
/**
* 懒汉式+同步方法+Double-Check+Volatile
*
* @author Vangelis
* @date 2019-07-16 17:42
*/
public final class VolatileDoubleCheckLazySingleton {
// private byte[] data = new byte[2014];
private volatile static VolatileDoubleCheckLazySingleton instance = null;
SocketChannel socketChannel;
Socket socket;
private VolatileDoubleCheckLazySingleton() throws IOException {
// 初始化
this.socketChannel = SocketChannel.open();
this.socket = new Socket();
}
public static VolatileDoubleCheckLazySingleton getInstance() throws IOException {
if (null==instance) {
synchronized (VolatileDoubleCheckLazySingleton.class) {
if (null==instance) {
instance = new VolatileDoubleCheckLazySingleton();
}
}
}
return instance;
}
}
| [
"wangjie@icaremgt.com"
] | wangjie@icaremgt.com |
32b57c68f3abc5f817c772e3356cf89be2542466 | 3800cd99fdb7d827b471d2541fa69e74eaa9e6e8 | /src/main/java/jb/dao/BasedataDaoI.java | bdda601ef5f4f19024a07746c0c679a37a27f4c3 | [] | no_license | huanganrang/dive | 7183929b807aa3fb3928e8cb8639352f7315797c | 07e64e38510fb25bd901cb0ad0a17f71a6732369 | refs/heads/master | 2020-04-06T06:51:40.546561 | 2016-07-09T17:09:11 | 2016-07-09T17:09:11 | 38,625,923 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 184 | java | package jb.dao;
import jb.model.Tbasedata;
/**
* basedata数据库操作类
*
* @author John
*
*/
public interface BasedataDaoI extends BaseDaoI<Tbasedata> {
}
| [
"huangzhi@huangzhi-PC"
] | huangzhi@huangzhi-PC |
8f57418ac6b82f513cb813166950e76fffd53001 | f6bb19544b74f4952d1d90465d5b3695fce89bd4 | /source/ocotillo/graph/rendering/Rendering2D.java | a8194764ae1e34e2150ce489ab150eff860beb8d | [] | no_license | cluelab/ocotillo | 2406e75c48932f77e9f494e2457a17b67f262e16 | 7d9d4b7e9347e557b0e17f836c2999df80413509 | refs/heads/master | 2021-01-11T14:10:57.314197 | 2017-06-21T12:00:07 | 2017-06-21T12:00:07 | 94,996,917 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,469 | java | /**
* Copyright © 2014-2015 Paolo Simonetto
*
* 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 ocotillo.graph.rendering;
import ocotillo.geometry.Box;
import ocotillo.geometry.Coordinates;
import ocotillo.graph.Graph;
import ocotillo.graph.Node;
import ocotillo.graph.NodeAttribute;
import ocotillo.graph.StdAttribute;
import ocotillo.graph.layout.Layout2D;
import ocotillo.graph.rendering.svg.SvgElement;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.image.BufferedImage;
import java.util.List;
/**
* Collects several methods relevant to the 2D rendering of a graph.
*/
public class Rendering2D {
/**
* Computes the size of the given text.
*
* @param text the text.
* @param fontScaling the font scaling.
* @return the text size.
*/
public static Coordinates textSize(String text, double fontScaling) {
BufferedImage dummyImage = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB);
Font referenceFont = new Font("SansSerif", Font.PLAIN, 10);
FontMetrics referenceFontMetrics = dummyImage.getGraphics().getFontMetrics(referenceFont);
double referenceWidth = referenceFontMetrics.stringWidth("x");
double referenceHeight = referenceFontMetrics.getHeight();
Font currentFont = new Font("SansSerif", Font.PLAIN, (int) (fontScaling * 10));
FontMetrics currentFontMetrics = dummyImage.getGraphics().getFontMetrics(currentFont);
double currentWidht = currentFontMetrics.stringWidth(text);
double currentHeight = currentFontMetrics.getHeight();
return new Coordinates(currentWidht / referenceWidth, currentHeight / referenceHeight);
}
/**
* Computes the box of the given text.
*
* @param text the text.
* @param center the central position of the text.
* @param fontScaling the font scaling.
* @return the text box.
*/
public static Box textBox(String text, Coordinates center, double fontScaling) {
Coordinates textSize = textSize(text, fontScaling);
return new Box(center, textSize);
}
/**
* Returns the rendering box for the given graph.
*
* @param graph the graph.
* @return the rendering box of the graph.
*/
public static Box graphBox(Graph graph) {
Box renderingBox = Layout2D.graphBox(graph);
Box labelBox = labelBox(graph);
if (labelBox != null) {
renderingBox = renderingBox.combine(labelBox);
}
Box graphicsBox = graphicsBox(graph, null);
if (graphicsBox != null) {
renderingBox = renderingBox.combine(graphicsBox);
}
return renderingBox;
}
/**
* Computes the box including the nodes labels.
*
* @param graph the graph.
* @return the node label box.
*/
private static Box labelBox(Graph graph) {
Box labelBox = null;
NodeAttribute<Coordinates> nodePositions = graph.<Coordinates>nodeAttribute(StdAttribute.nodePosition);
NodeAttribute<String> nodeLabels = graph.<String>nodeAttribute(StdAttribute.label);
NodeAttribute<Double> nodeLabelFontScaling = graph.<Double>nodeAttribute(StdAttribute.labelScaling);
NodeAttribute<Coordinates> nodeLabelOffset = graph.<Coordinates>nodeAttribute(StdAttribute.labelOffset);
for (Node node : graph.nodes()) {
String label = nodeLabels.get(node);
Coordinates center = nodePositions.get(node).plus(nodeLabelOffset.get(node));
double fontScaling = nodeLabelFontScaling.get(node);
if (labelBox == null) {
labelBox = textBox(label, center, fontScaling);
} else {
labelBox = labelBox.combine(textBox(label, center, fontScaling));
}
}
return labelBox;
}
/**
* Combine a given box with the graphic box of a given graph.
*
* @param graph the graph.
* @param currentBox the current box.
* @return the combined box.
*/
private static Box graphicsBox(Graph graph, Box currentBox) {
String graphics = GraphicsTools.getLocalGraphics(graph).get();
List<SvgElement> elements = SvgElement.parseSvg(graphics);
for (SvgElement element : elements) {
if (currentBox == null) {
currentBox = element.box();
} else {
currentBox = currentBox.combine(element.box());
}
}
for (Graph subgraph : graph.subGraphs()) {
currentBox = graphicsBox(subgraph, currentBox);
}
return currentBox;
}
/**
* Resizes a node to make it sufficient to contain its label. Uses the
* default margin of 0.25.
*
* @param node the node.
* @param graph the graph.
*/
public static void resizeGlyphToFitLabel(Node node, Graph graph) {
resizeGlyphToFitLabel(node, graph, 0.25);
}
/**
* Resizes a node to make it sufficient to contain its label.
*
* @param node the node.
* @param graph the graph.
* @param margin the margin to be used.
*/
public static void resizeGlyphToFitLabel(Node node, Graph graph, double margin) {
NodeAttribute<Coordinates> nodeSizes = graph.<Coordinates>nodeAttribute(StdAttribute.nodeSize);
NodeAttribute<String> nodeLabels = graph.<String>nodeAttribute(StdAttribute.label);
NodeAttribute<Double> nodeLabelFontScaling = graph.<Double>nodeAttribute(StdAttribute.labelScaling);
resizeGlyphToFitLabel(node, nodeSizes, nodeLabels, nodeLabelFontScaling, margin);
}
/**
* Resizes a node to make it sufficient to contain its label. Uses the
* default margin of 0.25.
*
* @param node the node.
* @param nodeSizes the node sizes.
* @param nodeLabels the node labels.
* @param nodeLabelFontScaling the node font scalings.
*/
public static void resizeGlyphToFitLabel(Node node, NodeAttribute<Coordinates> nodeSizes, NodeAttribute<String> nodeLabels, NodeAttribute<Double> nodeLabelFontScaling) {
resizeGlyphToFitLabel(node, nodeSizes, nodeLabels, nodeLabelFontScaling, 0.25);
}
/**
* Resizes a node to make it sufficient to contain its label.
*
* @param node the node.
* @param nodeSizes the node sizes.
* @param nodeLabels the node labels.
* @param nodeLabelFontScaling the node font scalings.
* @param margin the margin to be used.
*/
public static void resizeGlyphToFitLabel(Node node, NodeAttribute<Coordinates> nodeSizes, NodeAttribute<String> nodeLabels, NodeAttribute<Double> nodeLabelFontScaling, double margin) {
String label = nodeLabels.get(node);
double fontScaling = nodeLabelFontScaling.get(node);
Coordinates textSize = textSize(label, fontScaling);
nodeSizes.set(node, textSize.plusIP(new Coordinates(2 * margin, 2 * margin)));
}
}
| [
"matderosa@unisa.it"
] | matderosa@unisa.it |
0a2ace305e6bb72468b275f5995cb12bdb7e8daa | 217d96db536ff284fc1b168bf640104f00ba1ad5 | /rifidi/trunk/org.rifidi.ui.common/src/org/rifidi/ui/common/validators/BooleanValidator.java | 793d8e484767e0acae41c6b2cde0b9c93a363ae3 | [] | no_license | TranscendsLLC/emulator | d5b94965b8ebd894707c093334c51aabf30d0075 | a46c42cd2e86aafc213df7585dc923895a589446 | refs/heads/master | 2021-01-14T12:31:10.876450 | 2010-10-01T21:28:07 | 2010-10-01T21:28:07 | 43,608,652 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 946 | java | /*
* ComPortValidator.java
*
* Created: Apr 9, 2007
* Project: RiFidi Emulator - A Software Simulation Tool for RFID Devices
* http://www.rifidi.org
* http://rifidi.sourceforge.net
* Copyright: Pramari LLC and the Rifidi Project
* License: Lesser GNU Public License (LGPL)
* http://www.opensource.org/licenses/lgpl-license.html
*/
package org.rifidi.ui.common.validators;
import org.eclipse.jface.viewers.ICellEditorValidator;
/**
* This validator should never be used.
* It is just here because the framework requires a validator for everything.
*
* @author Jochen Mader - jochen@pramari.com
*
*/
public class BooleanValidator implements ICellEditorValidator {
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ICellEditorValidator#isValid(java.lang.Object)
*/
public String isValid(Object value) {
if(value instanceof Boolean){
return null;
}
return "Please enter a valid boolean";
}
}
| [
"kyle@70ba6d20-ffbb-44b8-b480-e27427137dba"
] | kyle@70ba6d20-ffbb-44b8-b480-e27427137dba |
4e9a172c98e4b6f5c028b3652d96a4b7665f3cc4 | ab3eccd0be02fb3ad95b02d5b11687050a147bce | /apis/mapbox-gl/out/src/main/java/js/mapboxgl/AnimationOptions.java | cdbe5891db1a7b81ae8a5f17030eeebf4b069fdd | [] | no_license | ibaca/typescript2java | 263fd104a9792e7be2a20ab95b016ad694a054fe | 0b71b8a3a4c43df1562881f0816509ca4dafbd7e | refs/heads/master | 2021-04-27T10:43:14.101736 | 2018-02-23T11:37:16 | 2018-02-23T11:37:18 | 122,543,398 | 0 | 0 | null | 2018-02-22T22:33:30 | 2018-02-22T22:33:29 | null | UTF-8 | Java | false | false | 1,898 | java | package js.mapboxgl;
import javaemul.internal.annotations.DoNotAutobox;
import js.PointLike_UnionOfArrayOfNumberAndPoint;
import js.browser.Array;
import js.browser.Function;
import jsinterop.annotations.JsPackage;
import jsinterop.annotations.JsProperty;
import jsinterop.annotations.JsType;
/**
* source type: "tsd/mapbox-gl/index".AnimationOptions
* flags: Object (32768)
* declared in: tsd/mapbox-gl/index.d.ts at pos 20772
* AnimationOptions
*/
@JsType(isNative=true, namespace=JsPackage.GLOBAL, name="Object")
public interface AnimationOptions
{
/*
Methods
*/
/**
* inherited from (js.mapboxgl.AnimationOptions)
*/
@JsProperty(name = "animate")
Boolean getAnimate();
/**
* inherited from (js.mapboxgl.AnimationOptions)
*/
@JsProperty(name = "duration")
Number getDuration();
/**
* inherited from (js.mapboxgl.AnimationOptions)
*/
@JsProperty(name = "easing")
Function getEasing();
/**
* inherited from (js.mapboxgl.AnimationOptions)
*/
@JsProperty(name = "offset")
PointLike_UnionOfArrayOfNumberAndPoint getOffset();
/**
* inherited from (js.mapboxgl.AnimationOptions)
*/
@JsProperty(name = "animate")
void setAnimate(Boolean value);
/**
* inherited from (js.mapboxgl.AnimationOptions)
*/
@JsProperty(name = "duration")
void setDuration(@DoNotAutobox Number value);
/**
* inherited from (js.mapboxgl.AnimationOptions)
*/
@JsProperty(name = "easing")
void setEasing(Function value);
@JsProperty(name = "offset")
void setOffset(Point value);
@JsProperty(name = "offset")
void setOffset(Array<Number> value);
/**
* inherited from (js.mapboxgl.AnimationOptions)
*/
@JsProperty(name = "offset")
void setOffset(PointLike_UnionOfArrayOfNumberAndPoint value);
}
| [
"ignacio@bacamt.com"
] | ignacio@bacamt.com |
7e383e608b5d92eccd10493f047b8f4b10cfa29a | e80bad8f42f7a996b9998b9c9b303c8b23b881eb | /appLib/src/main/java/com/ab/global/AbConstant.java | 4ab482f46ad02546bc02c43cd6cbcdf8ae301a55 | [] | no_license | hzl512/CSMAMVP | 84fb6a8715e222e3f0d001fbdc2aae7faf79cbdb | a38d0ad748d003a76a5d5d9160992b44e9fcab87 | refs/heads/master | 2021-07-12T14:21:35.631129 | 2017-12-04T13:34:27 | 2017-12-04T13:34:27 | 86,672,897 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 850 | java | /*
* Copyright (C) 2012 www.amsoft.cn
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.ab.global;
// TODO: Auto-generated Javadoc
/**
* © 2012 amsoft.cn
* 名称:AbConstant.java
* 描述:常量.
*
* @author 还如一梦中
* @version v1.0
* @date:2013-10-16 下午1:33:39
*/
public class AbConstant {
}
| [
"826064591@qq.com"
] | 826064591@qq.com |
febecc202f495676b554bf55188505a0d226fe84 | d3e8b153f5204fecbd55784058d224ce512e92f6 | /src/com/spoj/basics/PrangonAndString.java | 0f4638728e63f725b407e77d5781440ee0425431 | [] | no_license | shrey32/Hacker-Rank | a8175b2d41d1bd3364f70dce6fcc7e4fa571e4ab | 56125330f1726dfc8a2bebf8c9f3f84d2172ed00 | refs/heads/master | 2021-07-25T13:51:43.438888 | 2021-06-25T17:22:30 | 2021-06-25T17:22:30 | 25,756,527 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 911 | java | package com.spoj.basics;
import java.util.Scanner;
/**
* <a href="https://www.spoj.com/problems/MOZPAS/">MOZPAS - Prangon and
* String</a>
*
* @author Shrey
*
*/
public class PrangonAndString {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int m = scan.nextInt();
System.out.println(build(n, m));
scan.close();
}
private static final String build(int n, int m) {
StringBuilder sb = new StringBuilder();
char[] chars = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
't', 'u', 'v', 'w', 'x', 'y', 'z' };
int charInd = 0;
int currCharCount = 0;
while (sb.length() < n) {
while (currCharCount < m) {
sb.append(chars[charInd]);
currCharCount++;
}
currCharCount = 0;
charInd++;
}
return sb.toString();
}
}
| [
"shreysharma.sharma31@gmail.com"
] | shreysharma.sharma31@gmail.com |
338420846b3a6eba22ec5d6a5b51e53cf6f2834a | 85f370af5a729465095e38f067fe1717a83129fa | /src/FigureGUI.java | e973243325018da8ed4bcee3f22c4dad96f67ae6 | [] | no_license | max114/AStar | d58c720aacdad182deaa58058b53e2f9ab183596 | 29347a680166796bb3998f2c034d309c2cf46220 | refs/heads/master | 2020-12-24T21:36:39.349507 | 2016-05-13T19:44:57 | 2016-05-13T19:44:57 | 58,413,472 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,053 | java |
/**
* This class creates GUI that contains the buttons, the text area and the panel
* that we are going to draw the rectangle and circle objects
* @author Max Zelalem
*/
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.GridLayout;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.io.EOFException;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.GregorianCalendar;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
public class FigureGUI extends JFrame implements ActionListener {
private static enum Action {RECTANGLE, CIRCLE, DATE};
private JButton redButton = new JButton("Red");
private JButton greenButton = new JButton("Green");
private JButton blueButton = new JButton("Blue");
private JButton rectangleButton = new JButton("Rectangle");
private JButton circleButton = new JButton("Circle");
private JButton exitButton = new JButton("Exit");
private JTextArea listArea = new JTextArea(10, 20);
private GregorianCalendar currentDate;
private FiguresPanel figuresPanel = new FiguresPanel();
private Action action = Action.RECTANGLE;
private String formattedDate;
private int x1;
private int x2;
private int y1;
private int y2;
private int x;
private int y;
protected ArrayList listFigures = new ArrayList<Figure>();
private String file ="FiguresSeretseab";
File fileName=new File(file);
private Rectangle rectangle1;
private Circle circle1;
private Point point;
private ArrayList<Point> arrayOfPoints = new ArrayList<Point>();
private Color colors;
private int r;
/**
* This class creates the custom panel that we are going to use to draw the circle and rectangle objects
* @max zlelalem
*/
public class FiguresPanel extends JPanel implements MouseListener {
/*** This method draws the objects into the panel
*/
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
g.setColor(figuresPanel.getBackground());
//get all the objects in the listfigures array list and draw them into the panel
for(int i=0;i<listFigures.size();i++){
//check to see if that object is a rectangle
if(listFigures.get(i).getClass().getName().equalsIgnoreCase("Rectangle")){
Rectangle rect= listFigures.get(i);
g.setColor(rect.getColor());
g.drawRect(rect.getX(),rect.getY(), rect.getWidth(), rect.getHeight());
g.fillRect(rect.getX(),rect.getY(), rect.getWidth(), rect.getHeight());
}
//check to see if that object is a circle
else if(listFigures.get(i).getClass().getName().equalsIgnoreCase("Circle")){
Circle cir=(Circle) listFigures.get(i);
g.setColor(cir.getColor());
g.drawOval(cir.getX(),cir.getY(), Integer.valueOf((int) (2*cir.getRadius())),Integer.valueOf((int) ((int)2*cir.getRadius())));
g.fillOval(cir.getX(),cir.getY(), Integer.valueOf((int) (2*cir.getRadius())),Integer.valueOf((int) ((int)2*cir.getRadius())));
}
}
//draw the date
if (action==Action.DATE);{
g.setColor(Color.BLACK);
g.drawString(formattedDate, 10, figuresPanel.getHeight()-figuresPanel.getHeight()/20);
}
}
/**-
* Waits for the mouse click and creates the appropriate figures.
*/
@Override
public void mouseClicked(MouseEvent event) {
switch(action) {
case RECTANGLE:
//check to see if arrayOfPoints is empty.If it is empty put that point where the mouse is clicked into the array
if(arrayOfPoints.isEmpty()){
x=event.getX();
y=event.getY();
point=new Point(x,y);
arrayOfPoints.add(point);
}
//if arrayOfPoints is not empty then add the second point into the array
else if(!arrayOfPoints.isEmpty()){
x=event.getX();
y=event.getY();
point=new Point(x,y);
arrayOfPoints.add(point);
x1=arrayOfPoints.get(0).x;
y1=arrayOfPoints.get(0).y;
x2=arrayOfPoints.get(1).x;
y2=arrayOfPoints.get(1).y;
//create a new rectangle object using the points and the selected color
rectangle1=new Rectangle(x1, y1, x2-x1, y2-y1, colors);
listFigures.add(rectangle1);
listArea.append(rectangle1.toString() + "\n");
this.repaint();
//clear the array
arrayOfPoints.clear();
}
break;
case CIRCLE:
//process the mouse click
//check to see if arrayOfPoints is empty.If it is empty put that point where the mouse is clicked into the array
if(arrayOfPoints.isEmpty()){
x=event.getX();
y=event.getY();
//System.out.println(x + "ops" + y);
point=new Point(x,y);
arrayOfPoints.add(point);
}
//if arrayOfPoints is not empty then add the second point into the array
else if(!arrayOfPoints.isEmpty()){
x=event.getX();
y=event.getY();
point=new Point(x,y);
arrayOfPoints.add(point);
x1=arrayOfPoints.get(0).x;
y1=arrayOfPoints.get(0).y;
x2=arrayOfPoints.get(1).x;
y2=arrayOfPoints.get(1).y;
r=(int)Math.sqrt(((x2-x1)*(x2-x1))+((y2-y1)*(y2-y1)));
circle1=new Circle(x1, y1,r, colors);
listFigures.add(circle1);
listArea.append(circle1.toString() + "\n");
this.repaint();
arrayOfPoints.clear();
break;
}
}
}
/**
* Not used
*/
@Override
public void mouseEntered(MouseEvent arg0) {
}
/**
* Not used
*/
@Override
public void mouseExited(MouseEvent arg0) {
}
/**
* Not used
*/
@Override
public void mousePressed(MouseEvent arg0) {
}
/**
* Not used
*/
@Override
public void mouseReleased(MouseEvent arg0) {
}
}
/**
* Sets up the entire interface.
* @throws ClassNotFoundException
*/
public FigureGUI() {
super("Figures GUI");
JPanel backgroundPanel=new JPanel(new GridLayout(1, 3));;
JPanel buttonPanel = new JPanel(new GridLayout(2, 3));
JPanel listPanel = new JPanel(new GridLayout(1, 1));
JPanel mainPanel = new JPanel(new GridLayout(1, 4));
//add the buttons to the button panel
buttonPanel.add(redButton);
buttonPanel.add(greenButton);
buttonPanel.add(blueButton);
buttonPanel.add(rectangleButton);
buttonPanel.add(circleButton);
buttonPanel.add(exitButton);
//add the jscrollpane to the text area and put it on a jpanel
listPanel.add(new JScrollPane(listArea));
mainPanel.add(figuresPanel);
//add listeners to all buttons and clicks on the figresPanel
redButton.addActionListener(this);
greenButton.addActionListener(this);
blueButton.addActionListener(this);
rectangleButton.addActionListener(this);
circleButton.addActionListener(this);
exitButton.addActionListener(this);
figuresPanel.addMouseListener(figuresPanel);
//check to see if the file exists
if(fileName.exists()){
//read from file and put the objects that we read into listFigures arraylist and re draw it
try {
ObjectInputStream inputStream = null;
inputStream = new ObjectInputStream(new FileInputStream(file));
Object obj = null;
try {
while ((obj = inputStream.readObject()) != null) {
//check to see if the object that we read is a rectangle
if (obj instanceof Rectangle) {
listFigures.add(obj);
repaint();
listArea.append(obj.toString() + "\n");
}
//check to see the object that we read is a circle
if (obj instanceof Circle) {
listFigures.add(obj);
listArea.append(obj.toString() + "\n");
repaint();
}
}
inputStream.close();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (FileNotFoundException e) {
System.out.println("The specified file hasn't been created yet");
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (EOFException ex) { //This exception will be caught when EOF is reached
System.out.println("End of file reached.");
} catch (FileNotFoundException e) {
System.out.println("The specified file hasn't been created yet");
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
//create the date object
currentDate = new GregorianCalendar();
SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MMM-yyyy");
formattedDate = dateFormat.format(currentDate.getTime());
//add all panels to the jFrame
backgroundPanel.add(figuresPanel, BorderLayout.WEST);
backgroundPanel.add(buttonPanel);
backgroundPanel.add(listPanel,BorderLayout.EAST);
add(backgroundPanel);
}
/**
* Listener for all buttons.
*/
@Override
public void actionPerformed(ActionEvent event) {
if(event.getSource()==rectangleButton){
action=Action.RECTANGLE;
}
else if(event.getSource()==circleButton){
action=Action.CIRCLE;
//new Circle(x1, y1, (int)Math.sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1)), colors);
}
else if(event.getSource()==redButton){
colors=Color.RED;
}
else if(event.getSource()==greenButton){
colors=Color.GREEN;
}
else if(event.getSource()==blueButton){
colors=Color.BLUE;
}
else if (event.getSource()==exitButton){
writeObject(file);
System.exit(0);
}
}
/**
* writes the objects that we created to a file
*
*/
public void writeObject(String file){
try {
ObjectOutputStream output = new ObjectOutputStream(
new FileOutputStream(fileName));
for(int i=0;i<listFigures.size();i++){
output.writeObject(listFigures.get(i));
}
output.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
* The method creates an FigureGUI object
*
* @param args not used
* @throws ClassNotFoundException
*/
public static void main(String[] args) throws ClassNotFoundException {
FigureGUI figureGUI=new FigureGUI();
figureGUI.setSize(900,250);
figureGUI.setTitle("FigureGUI");
figureGUI.setVisible(true);
figureGUI.setLocationRelativeTo(null);
//for(int i=0;i<listFigures.size();i++){
//System.out.println(listFigures.get(i).toString());
//}
}
}
| [
"max.zelalem@gmail.com"
] | max.zelalem@gmail.com |
b3bf91da932a511ffcc232cf8cc808fad62de8bb | 88ede05492042f4fc62f8227749817ae9ddd04e1 | /app/src/main/java/android/vn/leo/qrscan/ui/MainActivity.java | c1ae91104d74d956af40498ab5e66457478d1853 | [] | no_license | dinhlamvn/qrscan | 26dd2800cb133f4bb555d2eaac7f5be8c1f163e7 | b7275183deb0d6c7bf24292a4bda0945fc0e2f59 | refs/heads/master | 2022-09-15T15:05:47.740069 | 2022-08-28T02:57:02 | 2022-08-28T02:57:02 | 180,054,043 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,773 | java | package android.vn.leo.qrscan.ui;
import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.provider.Settings;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.vn.leo.qrscan.BuildConfig;
import android.vn.leo.qrscan.R;
import android.vn.leo.qrscan.ui.scan.ScanFragment;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import com.karumi.dexter.Dexter;
import com.karumi.dexter.PermissionToken;
import com.karumi.dexter.listener.PermissionDeniedResponse;
import com.karumi.dexter.listener.PermissionGrantedResponse;
import com.karumi.dexter.listener.PermissionRequest;
import com.karumi.dexter.listener.single.PermissionListener;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Dexter.withActivity(this)
.withPermission(Manifest.permission.CAMERA)
.withListener(new PermissionListener() {
@Override
public void onPermissionGranted(PermissionGrantedResponse response) {
MainActivity.this.onPermissionGranted();
}
@Override
public void onPermissionDenied(PermissionDeniedResponse response) {
startAppSettingToRequestPermission();
}
@Override
public void onPermissionRationaleShouldBeShown(PermissionRequest permission, PermissionToken token) {
token.continuePermissionRequest();
}
})
.check();
}
private void onPermissionGranted() {
getSupportFragmentManager().beginTransaction()
.replace(R.id.frame_container, new ScanFragment())
.commit();
}
@Override
protected void onResume() {
super.onResume();
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
startAppSettingToRequestPermission();
}
}
private void startAppSettingToRequestPermission() {
Toast.makeText(MainActivity.this, R.string.permission_camera_denied, Toast.LENGTH_SHORT).show();
final Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
Uri uri = Uri.fromParts("package", getPackageName(), null);
intent.setData(uri);
startActivity(intent);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
final MenuInflater menuInflater = getMenuInflater();
menuInflater.inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
if (item.getItemId() == R.id.menu_about) {
showAboutInfo();
return true;
}
return super.onOptionsItemSelected(item);
}
private void showAboutInfo() {
new AlertDialog.Builder(this)
.setTitle(R.string.dialog_about_title)
.setMessage(getString(R.string.dialog_about_message, getString(R.string.app_name), BuildConfig.VERSION_NAME, getString(R.string.developer), getString(R.string.developer_contact)))
.setPositiveButton(R.string.dialog_about_button, null)
.setCancelable(true)
.show();
}
} | [
"dinhlamvn353@gmail.com"
] | dinhlamvn353@gmail.com |
80e1211c0a3638f4462b499f83a0db9477e01de9 | 33b895b26e9743e1a96546c1a6964b75c7063844 | /src/main/java/core/Louandgrey.java | e929206805ea7abdd4b3ddda99c956744506a6c7 | [] | no_license | gt-python-16/narvar_UI | 8658af9979d2ef356ba954ffd2947f810bc7357c | 4d39ba6db1d7db6544fe6c83320cf906e0f072b4 | refs/heads/master | 2021-01-19T00:54:34.130271 | 2017-04-04T18:03:57 | 2017-04-04T18:03:57 | 87,218,674 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,656 | java | package core;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.openqa.selenium.*;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.Select;
import org.openqa.selenium.support.ui.WebDriverWait;
import java.util.regex.*;
/**
* 'Lou and Gray' TrackingPage
*
*/
public class Louandgrey extends BasePage {
public static final String PAGE_URL = "http://qa.narvar.com/louandgrey/tracking/FedEx?tracking_numbers=846902361923544";
public static WebDriverWait wait;
public static WebDriver _driver;
By phoneLocator = By.id("tel");
By updatePhoneLocator = By.cssSelector("a.sms-redirect-link"); //or By.className("sms-redirect-link");
By updatedPhoneMessageLocator = By.cssSelector(".sms-header-container>h4");//By.className("updated-success-header");
By smsSignUpButtonLocator = By.id("sms-signup");
By errorMessageInvalidPhoneNumberLocator = By.cssSelector(".invalid-sms-number-tooltip>div>div");
By trackingNumberLocator = By.className("tracking-number");
By shippingStatusLocator = By.xpath("//div[@class='tracking-status-container']/h2");
By trackingTimeStampsLocator = By.xpath("//ul[@class='shippingActivityList']/li/div[@class='timestamp']");
By trackingDescriptionsLocator = By.xpath("//ul[@class='shippingActivityList']/li/div[@class='description-container']");
protected Louandgrey() {
super(PAGE_URL);
}
public static Louandgrey openTrackingPage(WebDriver driver) {
Louandgrey trackingPage = new Louandgrey();
_driver = driver;
Logger l = Logger.getLogger("");
l.setLevel(Level.OFF);
driver.get(PAGE_URL);
return trackingPage;
}
public String getShippingStatus() {
_driver.manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS);
WebDriverWait wait = new WebDriverWait(_driver, 20);
wait.until(ExpectedConditions.visibilityOfElementLocated(shippingStatusLocator));
WebElement element = _driver.findElement(shippingStatusLocator);
String content = (String) ((JavascriptExecutor) _driver)
.executeScript("return arguments[0].innerHTML", element);
System.out.println(content);
_driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
return content;
}
public int getNumberOfShippingRecords() {
List<WebElement> trackingTimeStamps = _driver.findElements(By.className("timestamp"));
//List<WebElement> trackingDescriptions = _driver.findElements(trackingDescriptionsLocator);
return trackingTimeStamps.size();
}
public void setPhoneNumber(String phoneNumber) {
// phoneNumber
WebElement phoneField = _driver.findElement(phoneLocator);
phoneField.clear();
phoneField.sendKeys(phoneNumber);
}
public String updatePhoneNumber(String phoneNumber) {
return updatePhone(phoneNumber, updatedPhoneMessageLocator);
}
public String updatePhoneNumberWithInvalidNumber(String phoneNumber) {
return updatePhone(phoneNumber, errorMessageInvalidPhoneNumberLocator);
}
public String updatePhone(String phoneNumber, By messageLocator) {
String confirmMessage = "";
if (isElementHidden(phoneLocator, _driver)) {
_driver.findElement(updatePhoneLocator).click();
WebElement phone = _driver.findElement(phoneLocator);
phone.clear();
phone.sendKeys(phoneNumber);
_driver.findElement(smsSignUpButtonLocator).click();
confirmMessage = getElementInnerHTML(messageLocator);
}
return confirmMessage.trim();
}
// returns alt-text for LOGO image link
public String getAltRetailerLogo() {
WebElement logo = _driver.findElement(retailerLogoLocator);
return logo.getAttribute("alt");
}
// click on logo image link -> redirect to retailer site -> verify page title
public String verifyLogolink(String substr_title) throws InterruptedException {
_driver.findElement(retailerLogoLocator).click();
return verify_link(substr_title);
}
// click on tracking number link -> redirect to shipping company site -> verify page title
public String verifyShippinglink(String substr_title) throws InterruptedException {
String trackTitle = "";
//scrolling to make link visible
_driver.findElement(By.cssSelector("div.tracking-status-container")).click();
((JavascriptExecutor)_driver).executeScript("arguments[0].scrollIntoView();", _driver.findElement(trackingNumberLocator));
_driver.manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS);
WebDriverWait wait = new WebDriverWait(_driver, 30);
wait.until(ExpectedConditions.visibilityOfElementLocated(trackingNumberLocator));
wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("img.carrier-logo")));
WebElement trackingNumberLink = _driver.findElement(trackingNumberLocator);
_driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
trackingNumberLink.click();
trackTitle = verify_link(substr_title);
return trackTitle;
}
///////////////
public String getElementText(By locator) {
_driver.manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS);
WebDriverWait wait = new WebDriverWait(_driver, 30);
wait.until(ExpectedConditions.elementToBeClickable(_driver.findElement(locator)));
//wait.until(ExpectedConditions.visibilityOf(_driver.findElement(locator)));
String content_text = _driver.findElement(locator).getText();
_driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
return content_text;
} //getElementText ** end
public String getElementInnerHTML(By locator) {
_driver.manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS);
WebDriverWait wait = new WebDriverWait(_driver, 20);
wait.until(ExpectedConditions.elementToBeClickable(_driver.findElement(locator)));
WebElement element = _driver.findElement(locator);
String content = (String) ((JavascriptExecutor) _driver)
.executeScript("return arguments[0].innerHTML", element);
//System.out.println(content);
_driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
return content;
} //getElementInnerHTML ** end
public String verify_link(String substr_title) throws InterruptedException{
_driver.manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS);
ArrayList<String> allTabs = new ArrayList<String>(_driver.getWindowHandles());
WebDriverWait wait = new WebDriverWait(_driver, 40);
wait.until(ExpectedConditions.numberOfWindowsToBe(2));
_driver.switchTo().window(allTabs.get(1));
wait.until(ExpectedConditions.titleContains(substr_title));
String pageTitle = _driver.getTitle();
//String trackTitle = _driver.findElement(By.className("shipmentTitleBar_label_track_nick")).getAttribute("title");
_driver.close();
wait.until(ExpectedConditions.numberOfWindowsToBe(1));
_driver.switchTo().window(allTabs.get(0));
wait.until(ExpectedConditions.titleContains("louandgrey.narvar.com"));
_driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
return pageTitle;
} //
}
| [
"galinaTim0417@gmail.com"
] | galinaTim0417@gmail.com |
cea6aef52a7c817b4c89a90216bbbc98f1552008 | 61f770a8c844cb8a258832c62a64925552b6f813 | /massis-remote/src/main/java/com/massisframework/massis/remote/highlevel/HighLevelCommandController.java | ad8ddd76a206d06f0ec56fa22646721ae3fe2560 | [] | no_license | rpax/massis-remote | d1046e9ee29dd15ca1fa852f18bfc25f374502a1 | 85d3a0c301491db45d0a88d475737e3ae59caecb | refs/heads/master | 2021-01-10T04:29:58.129054 | 2016-04-17T12:40:21 | 2016-04-17T12:40:21 | 55,345,037 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,160 | java | package com.massisframework.massis.remote.highlevel;
import java.util.Iterator;
import java.util.Map;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import com.massisframework.massis.model.agents.HighLevelController;
import com.massisframework.massis.model.agents.LowLevelAgent;
public class HighLevelCommandController extends HighLevelController {
private static final long serialVersionUID = 1L;
private Queue<HighLevelAction> pending;
public HighLevelCommandController(LowLevelAgent agent,
Map<String, String> metadata, String resourcesFolder) {
super(agent, metadata, resourcesFolder);
this.agent.setHighLevelData(this);
this.pending = new ConcurrentLinkedQueue<>();
}
public void enqueueCommand(HighLevelAction cmd) {
this.pending.add(cmd);
}
@Override
public void stop() {
/*
* Clean resources, threads...etc
*/
}
@Override
public void step() {
for (Iterator<HighLevelAction> it = pending.iterator(); it.hasNext();) {
HighLevelAction action = it.next();
if (action.execute(this)) {
it.remove();
}
}
}
public LowLevelAgent getLowLevelAgent() {
return this.agent;
}
} | [
"rpax@ucm.es"
] | rpax@ucm.es |
a158fd1185819b17983245c158be99ac6307e4dc | fe91ce3c6bff95204681fcafd0fb47f63c338ae5 | /video_play/src/main/java/com/test/video_play/server/tcp/EncodeV1.java | 677a5edbec979a10139b254a86cf566295218dc7 | [] | no_license | qulong/TestH264Player | d3b278c193ef8972f3c418e96cbc649f5fe7f329 | 1b655c414c446022211c5a27e15e681b669401dd | refs/heads/master | 2020-04-15T05:08:51.226082 | 2019-01-09T07:40:37 | 2019-01-09T07:40:37 | 164,410,401 | 0 | 0 | null | 2019-01-07T09:40:54 | 2019-01-07T09:40:54 | null | UTF-8 | Java | false | false | 1,966 | java | package com.test.video_play.server.tcp;
import android.text.TextUtils;
import com.test.video_play.ScreenRecordApi;
import com.test.video_play.utils.ByteUtil;
import java.nio.ByteBuffer;
/**
* Created by xu.wang
* Date on 2018/08/22 14:47:47.
*
* @Desc 传输数据格式
*/
public class EncodeV1 {
private int mainCmd;
private int subCmd;
private String sendBody;
private byte[] sendBuffer; //要发送的内容
/**
* by wt
*
* @param mainCmd 主指令
* @param subCmd 子指令
* @param sendBody 文本内容
* @param sendBuffer 音视频内容
*/
public EncodeV1(int mainCmd, int subCmd, String sendBody, byte[] sendBuffer) {
this.mainCmd = mainCmd;
this.subCmd = subCmd;
this.sendBody = sendBody;
this.sendBuffer = sendBuffer;
}
public byte[] buildSendContent() {
int bodyLength = 0;
int bodyByte = 0;
ByteBuffer bb = null;
//文本数据
if (!TextUtils.isEmpty(sendBody)) {
bodyLength = sendBody.getBytes().length;
}
//音视频数据
if (sendBuffer.length != 0) {
bodyByte = sendBuffer.length;
}
//创建内存缓冲区
bb = ByteBuffer.allocate(18 + bodyLength + bodyByte);
bb.put(ScreenRecordApi.encodeVersion1); //0-1编码版本
bb.put(ByteUtil.int2Bytes(mainCmd)); //1-5 主指令
bb.put(ByteUtil.int2Bytes(subCmd)); //5-9 子指令
bb.put(ByteUtil.int2Bytes(bodyLength)); //9-13位,文本数据长度
bb.put(ByteUtil.int2Bytes(bodyByte)); //13-17位,音视频数据长度
byte[] tempb = bb.array();
bb.put(ByteUtil.getCheckCode(tempb));
//数据字节数组
if (bodyLength != 0) {
bb.put(sendBody.getBytes());
}
if (sendBuffer.length != 0) {
bb.put(sendBuffer);
}
return bb.array();
}
}
| [
"wangxu@zonekey.com.cn"
] | wangxu@zonekey.com.cn |
ae66de9e879227906741c315dc70f5fa99259390 | f44399936178dd27a618b4ede601b0f952028334 | /src/main/java/com/project/controller/backend/LoginController.java | d0ac85e62801ce5859402e1be5c11cf59ef6f312 | [
"Apache-2.0"
] | permissive | wangyinqing/kyuubi | cbf2345c4102c728bbcc77fe7e193728c3c12128 | 51111ba0cd84783ed472b11b40e45c04b403bf3b | refs/heads/master | 2021-05-25T11:13:02.109300 | 2018-07-16T14:23:33 | 2018-07-16T14:23:33 | 127,231,409 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,794 | java | package com.project.controller.backend;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
/**
* @author wangyinqing
*/
@Controller("backendLoginController")
@RequestMapping("backend")
public class LoginController {
private ConcurrentMap<String,String> localSut = new ConcurrentHashMap<>();
@ResponseBody
@RequestMapping("/login")
public String login(@RequestParam() String account, @RequestParam() String password, HttpServletResponse response) throws Exception{
Map map = new HashMap();
if(!"admin".equalsIgnoreCase(account)
|| !"admin".equalsIgnoreCase(password)){
map.put("code",0);
map.put("message","账号或者密码不正确");
}else{
String token = UUID.randomUUID().toString().replaceAll("-", "");
localSut.put(token, account);
Cookie cookie = new Cookie("sut", token);
cookie.setHttpOnly(true);
response.addCookie(cookie);
map.put("code",1);
}
ObjectMapper mapper = new ObjectMapper();
return mapper.writeValueAsString(map);
}
@RequestMapping("validateUser")
@ResponseBody
public String vaildate(@CookieValue(value = "sut", required = false, defaultValue = "") String token) throws Exception {
String account = localSut.get(token);
Map map = new HashMap();
if (account == null) {
map.put("code", 0);
} else {
map.put("code", 1);
map.put("user", account);
}
ObjectMapper mapper = new ObjectMapper();
return mapper.writeValueAsString(map);
}
@RequestMapping("invalidateUser")
@ResponseBody
public String invaildate(@CookieValue("sut") String token, HttpServletResponse response) throws Exception {
Map map = new HashMap();
String account = localSut.remove(token);
if (account == null) {
map.put("code", 0);
} else {
map.put("code", 1);
Cookie cookie = new Cookie("sut", null);
cookie.setMaxAge(0);
response.addCookie(cookie);
}
ObjectMapper mapper = new ObjectMapper();
return mapper.writeValueAsString(map);
}
}
| [
"wangyinqing1986@gmail.com"
] | wangyinqing1986@gmail.com |
78a6f92d10d8ed997113fd0808fcb474c8e4da4a | d9a0e9937c2636bcc562a4e05d67ba9ffb3640df | /xc-framework/xc-service-manage-course/src/main/java/com/xuecheng/manage/course/controller/TestCourseController.java | b6cdf1edd5da1ea973f30d7a8c4b1dd11aadb0ec | [] | no_license | chrilwe/xuecheng | 2dbce54dce76a370e40fd20ca22ca501cb6c326e | 35625776678362d2a7a93001a5f5bbf4c7144be8 | refs/heads/master | 2022-12-08T14:57:12.792534 | 2019-06-18T15:44:34 | 2019-06-18T15:44:34 | 173,674,136 | 1 | 0 | null | 2022-11-24T06:26:08 | 2019-03-04T04:32:47 | Java | UTF-8 | Java | false | false | 6,780 | java | package com.xuecheng.manage.course.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import com.xuecheng.framework.common.client.XcServiceList;
import com.xuecheng.framework.common.model.response.QueryResponseResult;
import com.xuecheng.framework.common.model.response.ResponseResult;
import com.xuecheng.framework.domain.course.CourseBase;
import com.xuecheng.framework.domain.course.Teachplan;
import com.xuecheng.framework.domain.course.TeachplanMedia;
import com.xuecheng.framework.domain.course.response.AddCourseResult;
/**
* 模拟课程管理页面前端
*
* @author Administrator
*
*/
@RestController
@RequestMapping("/course/test")
public class TestCourseController {
@Autowired
private RestTemplate restTemplate;
@Autowired
private LoadBalancerClient loadBalancerClient;
/**
* 1.模拟添加课程
*/
@GetMapping("/addCourseBase")
public AddCourseResult addCourseBase() {
CourseBase courseBase = new CourseBase();
courseBase.setCompanyId("1");
courseBase.setDescription("Lucene从小白开始入门到精通");
courseBase.setGrade("200001");// 难度等级为初级
courseBase.setMt("1-1");
courseBase.setName("Lucene入门教程");
courseBase.setSt("1-1-1");
courseBase.setStudymodel("201001");// 录播
courseBase.setUsers("适合掌握一些编程语言的初级程序员");
// 获取请求url
ServiceInstance choose = loadBalancerClient.choose(XcServiceList.XC_SERVICE_MANAGE_COURSE);
String url = choose.getUri() + "/course/coursebase/add";
// 设置请求头
MultiValueMap<String, String> headers = new LinkedMultiValueMap<>();
// 设置请求体
MultiValueMap<String, String> body = new LinkedMultiValueMap<>();
body.add("companyId", courseBase.getCompanyId());
body.add("description", courseBase.getDescription());
body.add("grade", courseBase.getGrade());
body.add("mt", courseBase.getMt());
body.add("name", courseBase.getName());
body.add("st", courseBase.getSt());
body.add("studymodel", courseBase.getStudymodel());
body.add("users", courseBase.getUsers());
HttpEntity<MultiValueMap<String, String>> httpEntity = new HttpEntity<MultiValueMap<String, String>>(body,
headers);
ResponseEntity<AddCourseResult> response = restTemplate.exchange(url, HttpMethod.POST, httpEntity,
AddCourseResult.class);
return response.getBody();
}
/**
* 模拟课程计划的添加
*/
@GetMapping("/teachplan/add/{courseId}")
public ResponseResult addTeachplan(@PathVariable("courseId") String courseId) {
Teachplan teachplan = new Teachplan();
teachplan.setCourseid(courseId);
teachplan.setDescription("初识lucene");
teachplan.setGrade("1");
teachplan.setPname("第一章");
teachplan.setPtype("1");
teachplan.setTimelength(24d);
// 获取请求url
ServiceInstance choose = loadBalancerClient.choose(XcServiceList.XC_SERVICE_MANAGE_COURSE);
String url = choose.getUri() + "/course/teachplan/add";
// 设置请求头
MultiValueMap<String, String> headers = new LinkedMultiValueMap<>();
// 设置请求体
MultiValueMap<String, String> body = new LinkedMultiValueMap<>();
body.add("courseid", teachplan.getCourseid());
body.add("description", teachplan.getDescription());
body.add("grade", teachplan.getGrade());
body.add("status", teachplan.getStatus());
body.add("pname", teachplan.getPname());
body.add("timelength", teachplan.getTimelength() + "");
HttpEntity<MultiValueMap<String, String>> httpEntity = new HttpEntity<MultiValueMap<String, String>>(body,
headers);
ResponseEntity<ResponseResult> response = restTemplate.exchange(url, HttpMethod.POST, httpEntity,
ResponseResult.class);
return response.getBody();
}
/**
* 模拟课程图片上传
*/
@GetMapping("/pic/upload")
public ResponseResult uploadPic() {
return null;
}
/**
* 模拟教师信息的添加
*/
@GetMapping("/teacher/add")
public ResponseResult addTeacherMessage() {
return null;
}
/**
* 模拟分页查询媒体文件信息,供教学计划进行关联
*/
@GetMapping("/mediaFile/list/{page}/{size}")
public QueryResponseResult queryMediaFile() {
// 获取请求url
ServiceInstance choose = loadBalancerClient.choose(XcServiceList.XC_SERVICE_MANAGE_MEDIA);
String url = choose.getUri() + "/media/list/0/1";
// 获取媒体文件
ResponseEntity<QueryResponseResult> response = restTemplate.getForEntity(url, QueryResponseResult.class);
return response.getBody();
}
/**
* 模拟教学计划关联视频文件
*/
@GetMapping("/saveMedia")
public ResponseResult saveMedia() {
TeachplanMedia tm = new TeachplanMedia();
tm.setCourseId("11611f8f-2bdd-4783-9b08-092569dd8fcc");
tm.setMediaFileOriginalName("lucene.avi");
tm.setMediaId("c5c75d70f382e6016d2f506d134eee11");
tm.setMediaUrl("c5c75d70f382e6016d2f506d134eee11.m3u8");
tm.setTeachplanId("4028e58161bd3b380161bd40cf3400ii");
// 获取请求url
ServiceInstance choose = loadBalancerClient.choose(XcServiceList.XC_SERVICE_MANAGE_COURSE);
String url = choose.getUri() + "/course/savemedia";
// 设置请求头
MultiValueMap<String, String> headers = new LinkedMultiValueMap<>();
// 设置请求体
MultiValueMap<String, String> body = new LinkedMultiValueMap<>();
body.add("courseId", tm.getCourseId());
body.add("mediaFileOriginalName", tm.getMediaFileOriginalName());
body.add("mediaId", tm.getMediaId());
body.add("mediaUrl", tm.getMediaUrl());
body.add("teachplanId", tm.getTeachplanId());
HttpEntity<MultiValueMap<String, String>> httpEntity = new HttpEntity<MultiValueMap<String, String>>(body,
headers);
ResponseEntity<ResponseResult> response = restTemplate.exchange(url, HttpMethod.POST, httpEntity,
ResponseResult.class);
return response.getBody();
}
/**
* 模拟课程页面预览
*/
@GetMapping("/preview")
public void preview() {
// 获取请求url
ServiceInstance choose = loadBalancerClient.choose(XcServiceList.XC_SERVICE_MANAGE_COURSE);
String url = choose.getUri() + "/course/previewhtml/{siteId}/{courseId}/{templateId}";
}
/**
* 模拟课程页面发布
*/
}
| [
"1129864619@qq.com"
] | 1129864619@qq.com |
42f33a633272318a4901eb71535a7b00b150d138 | 91dddee4aad1c6737e9cb48b32c4148a4d4a0b7a | /src/main/java/ch/bfh/bti7535/w2017/Strategies/BaseLine/BaseLineStrategy.java | 61f62001ec54a660390eee27918363c1f4db6e1c | [] | no_license | quickstar/ch.bfh.bti7535.w2017.dataGreen | 160a7cf743af0694e69a358ba5a4395646a88139 | 7fd0a4fa8a851a6e814c542ac34e4a28b4a16082 | refs/heads/master | 2021-09-04T02:35:47.088438 | 2018-01-14T19:23:20 | 2018-01-14T19:23:20 | 111,442,076 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,233 | java | package ch.bfh.bti7535.w2017.Strategies.BaseLine;
import ch.bfh.bti7535.w2017.Strategies.SentimentStrategy;
import ch.bfh.bti7535.w2017.io.BaseClassifier;
import ch.bfh.bti7535.w2017.io.CorrectlyClassified;
import ch.bfh.bti7535.w2017.io.ReviewReader;
import ch.bfh.bti7535.w2017.io.Unclassifiable;
import weka.core.stopwords.StopwordsHandler;
import java.util.List;
public class BaseLineStrategy extends SentimentStrategy {
/**
* Initializes the class.
*
* @param stopWordHandlers
*/
public BaseLineStrategy(List<StopwordsHandler> stopWordHandlers) {
super(stopWordHandlers);
}
@Override
public void run() {
List<BaseClassifier> baseReviews = new ReviewReader().analyzeFile();
long correctClassified = 0;
long unclassifiable = 0;
long total = 2000;
for (BaseClassifier r : baseReviews) {
if (r instanceof CorrectlyClassified) {
correctClassified++;
}
if (r instanceof Unclassifiable) {
unclassifiable++;
}
}
long percentage = correctClassified * 100 / (total - unclassifiable);
setSummary("Baseline accuracy: " + percentage);
}
}
| [
"lukas.laederach@3volutions.ch"
] | lukas.laederach@3volutions.ch |
a2727569937cb376524b36bb97c624730d0594aa | 58dffc75051b7e3338d2623f68c7611c94fdba7b | /new/src/DateFormatTest.java | 2c7b8d7cb1c0e84918149a3151c70ea29d4faecd | [] | no_license | atal34/myproject | 837db97edc5b72859f58bb78798e156ca123f7d7 | 63d710f47dd3d3d7468b5b23e03ee6f1671681e5 | refs/heads/master | 2021-07-02T22:39:36.921580 | 2021-06-19T04:17:54 | 2021-06-19T04:17:54 | 88,830,025 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 320 | java | import java.text.Format;
import java.text.SimpleDateFormat;
import java.util.Date;
public class DateFormatTest {
public static void main(String[] args) {
Format formatter1 = new SimpleDateFormat("dd/MM/yyyy HH:MM:SS");
String s1 = formatter1.format(new Date());
System.out.println(s1);
}
}
| [
"689218@CTSC01248431001.cts.com"
] | 689218@CTSC01248431001.cts.com |
5ad6f8e7b4385efc4d858e85e5ae0eb24c1d37be | cbc6169dd9e7294d73ed31c07e3dd18c1dc2ec62 | /android/src/main/java/org/reactnative/MutableImage.java | 8d5fcc3e7ffe5c56142e49f49da18956f9d3d5a2 | [
"MIT",
"Apache-2.0",
"BSD-3-Clause"
] | permissive | frazercomputing/react-native-camera | 4866740eaba73be160f437e7dc8f619054eb8451 | c4733bdcc4726813bf9200db759daaf86bf37ff0 | refs/heads/master | 2020-03-23T13:28:47.121396 | 2019-05-14T20:48:38 | 2019-05-14T20:48:38 | 141,620,515 | 0 | 0 | NOASSERTION | 2019-05-14T20:48:39 | 2018-07-19T19:07:01 | Java | UTF-8 | Java | false | false | 9,690 | java | package org.reactnative;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.media.ExifInterface;
import android.util.Base64;
import android.util.Log;
import com.drew.imaging.ImageMetadataReader;
import com.drew.imaging.ImageProcessingException;
import com.drew.metadata.Directory;
import com.drew.metadata.Metadata;
import com.drew.metadata.MetadataException;
import com.drew.metadata.Tag;
import com.drew.metadata.exif.ExifIFD0Directory;
import com.facebook.react.bridge.ReadableMap;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
public class MutableImage {
private static final String TAG = "RNCamera";
private final byte[] originalImageData;
private Bitmap currentRepresentation;
private Metadata originalImageMetaData;
private boolean hasBeenReoriented = false;
public MutableImage(byte[] originalImageData) {
this.originalImageData = originalImageData;
this.currentRepresentation = toBitmap(originalImageData);
}
public void mirrorImage() throws ImageMutationFailedException {
Matrix m = new Matrix();
m.preScale(-1, 1);
Bitmap bitmap = Bitmap.createBitmap(
currentRepresentation,
0,
0,
currentRepresentation.getWidth(),
currentRepresentation.getHeight(),
m,
false
);
if (bitmap == null)
throw new ImageMutationFailedException("failed to mirror");
this.currentRepresentation = bitmap;
}
public void fixOrientation() throws ImageMutationFailedException {
try {
Metadata metadata = originalImageMetaData();
ExifIFD0Directory exifIFD0Directory = metadata.getFirstDirectoryOfType(ExifIFD0Directory.class);
if (exifIFD0Directory == null) {
return;
} else if (exifIFD0Directory.containsTag(ExifIFD0Directory.TAG_ORIENTATION)) {
int exifOrientation = exifIFD0Directory.getInt(ExifIFD0Directory.TAG_ORIENTATION);
if(exifOrientation != 1) {
rotate(exifOrientation);
exifIFD0Directory.setInt(ExifIFD0Directory.TAG_ORIENTATION, 1);
}
}
} catch (ImageProcessingException | IOException | MetadataException e) {
throw new ImageMutationFailedException("failed to fix orientation", e);
}
}
//see http://www.impulseadventure.com/photo/exif-orientation.html
private void rotate(int exifOrientation) throws ImageMutationFailedException {
final Matrix bitmapMatrix = new Matrix();
switch (exifOrientation) {
case 1:
return;//no rotation required
case 2:
bitmapMatrix.postScale(-1, 1);
break;
case 3:
bitmapMatrix.postRotate(180);
break;
case 4:
bitmapMatrix.postRotate(180);
bitmapMatrix.postScale(-1, 1);
break;
case 5:
bitmapMatrix.postRotate(90);
bitmapMatrix.postScale(-1, 1);
break;
case 6:
bitmapMatrix.postRotate(90);
break;
case 7:
bitmapMatrix.postRotate(270);
bitmapMatrix.postScale(-1, 1);
break;
case 8:
bitmapMatrix.postRotate(270);
break;
default:
break;
}
Bitmap transformedBitmap = Bitmap.createBitmap(
currentRepresentation,
0,
0,
currentRepresentation.getWidth(),
currentRepresentation.getHeight(),
bitmapMatrix,
false
);
if (transformedBitmap == null)
throw new ImageMutationFailedException("failed to rotate");
this.currentRepresentation = transformedBitmap;
this.hasBeenReoriented = true;
}
private static Bitmap toBitmap(byte[] data) {
try {
ByteArrayInputStream inputStream = new ByteArrayInputStream(data);
Bitmap photo = BitmapFactory.decodeStream(inputStream);
inputStream.close();
return photo;
} catch (IOException e) {
throw new IllegalStateException("Will not happen", e);
}
}
public String toBase64(int jpegQualityPercent) {
return Base64.encodeToString(toJpeg(currentRepresentation, jpegQualityPercent), Base64.DEFAULT);
}
public void writeDataToFile(File file, ReadableMap options, int jpegQualityPercent) throws IOException {
FileOutputStream fos = new FileOutputStream(file);
fos.write(toJpeg(currentRepresentation, jpegQualityPercent));
fos.close();
try {
ExifInterface exif = new ExifInterface(file.getAbsolutePath());
// copy original exif data to the output exif...
// unfortunately, this Android ExifInterface class doesn't understand all the tags so we lose some
for (Directory directory : originalImageMetaData().getDirectories()) {
for (Tag tag : directory.getTags()) {
int tagType = tag.getTagType();
Object object = directory.getObject(tagType);
exif.setAttribute(tag.getTagName(), object.toString());
}
}
writeLocationExifData(options, exif);
if(hasBeenReoriented)
rewriteOrientation(exif);
exif.saveAttributes();
} catch (ImageProcessingException | IOException e) {
Log.e(TAG, "failed to save exif data", e);
}
}
private void rewriteOrientation(ExifInterface exif) {
exif.setAttribute(ExifInterface.TAG_ORIENTATION, String.valueOf(ExifInterface.ORIENTATION_NORMAL));
}
private void writeLocationExifData(ReadableMap options, ExifInterface exif) {
if(!options.hasKey("metadata"))
return;
ReadableMap metadata = options.getMap("metadata");
if (!metadata.hasKey("location"))
return;
ReadableMap location = metadata.getMap("location");
if(!location.hasKey("coords"))
return;
try {
ReadableMap coords = location.getMap("coords");
double latitude = coords.getDouble("latitude");
double longitude = coords.getDouble("longitude");
GPS.writeExifData(latitude, longitude, exif);
} catch (IOException e) {
Log.e(TAG, "Couldn't write location data", e);
}
}
private Metadata originalImageMetaData() throws ImageProcessingException, IOException {
if(this.originalImageMetaData == null) {//this is expensive, don't do it more than once
originalImageMetaData = ImageMetadataReader.readMetadata(
new BufferedInputStream(new ByteArrayInputStream(originalImageData)),
originalImageData.length
);
}
return originalImageMetaData;
}
private static byte[] toJpeg(Bitmap bitmap, int quality) throws OutOfMemoryError {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, quality, outputStream);
try {
return outputStream.toByteArray();
} finally {
try {
outputStream.close();
} catch (IOException e) {
Log.e(TAG, "problem compressing jpeg", e);
}
}
}
public static class ImageMutationFailedException extends Exception {
public ImageMutationFailedException(String detailMessage, Throwable throwable) {
super(detailMessage, throwable);
}
public ImageMutationFailedException(String detailMessage) {
super(detailMessage);
}
}
private static class GPS {
public static void writeExifData(double latitude, double longitude, ExifInterface exif) throws IOException {
exif.setAttribute(ExifInterface.TAG_GPS_LATITUDE, toDegreeMinuteSecods(latitude));
exif.setAttribute(ExifInterface.TAG_GPS_LATITUDE_REF, latitudeRef(latitude));
exif.setAttribute(ExifInterface.TAG_GPS_LONGITUDE, toDegreeMinuteSecods(longitude));
exif.setAttribute(ExifInterface.TAG_GPS_LONGITUDE_REF, longitudeRef(longitude));
}
private static String latitudeRef(double latitude) {
return latitude < 0.0d ? "S" : "N";
}
private static String longitudeRef(double longitude) {
return longitude < 0.0d ? "W" : "E";
}
private static String toDegreeMinuteSecods(double latitude) {
latitude = Math.abs(latitude);
int degree = (int) latitude;
latitude *= 60;
latitude -= (degree * 60.0d);
int minute = (int) latitude;
latitude *= 60;
latitude -= (minute * 60.0d);
int second = (int) (latitude * 1000.0d);
StringBuffer sb = new StringBuffer();
sb.append(degree);
sb.append("/1,");
sb.append(minute);
sb.append("/1,");
sb.append(second);
sb.append("/1000,");
return sb.toString();
}
}
}
| [
"sibeliusseraphini@gmail.com"
] | sibeliusseraphini@gmail.com |
438cdb7ebe6dbb5f40c5c1c924c63de2f75d845f | dfb4edf2fe5d9c73b109bf2a7a130c6b2352a651 | /5.2 Combinatorial and Greedy Algorithms - Exercise/CombExec/src/snakes/Main2.java | 8a8373c88fcec7f172fcf45f3db2e0af0f2d05cd | [] | no_license | aquaruiz/Algorithms | 098b2332c5424004e43e6d97d79ec7e5a83d949b | baa3ae505a5c8d4d397dbfd7eb1b5864d34478ba | refs/heads/master | 2021-07-01T12:14:59.699810 | 2019-08-16T10:53:52 | 2019-08-16T10:53:52 | 175,662,646 | 1 | 0 | null | 2020-10-13T14:38:19 | 2019-03-14T16:46:58 | Java | UTF-8 | Java | false | false | 4,029 | java | package snakes;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
public class Main2 {
static int maxLenght;
static int snakeCount;
static Set<String> usedSnakes = new LinkedHashSet<>();
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader bReader = new BufferedReader(new InputStreamReader(System.in));
maxLenght = Integer.parseInt(bReader.readLine());
bReader.close();
ArrayDeque<Cell> snake = new ArrayDeque<>();
List<Character> directions = new ArrayList<>() ;
// R -> D -> L -> U
Cell currentNewCell = new Cell(0, 0);
generateSnake(currentNewCell, 'S', snake, directions);
System.out.println("Snakes count = " + snakeCount);
}
private static void generateSnake(Cell cell, char direction, ArrayDeque<Cell> snake, List<Character> directions) {
if (snake.size() == maxLenght) {
String currentSnake = String.valueOf(directions);
if (!usedSnakes.contains(currentSnake)) {
System.out.println(currentSnake.replaceAll("[ ,\\[\\]]", ""));
snakeCount++;
usedSnakes.add(currentSnake);
markIsomorphicSnakes(directions);
}
return;
}
if (snake.contains(cell)) {
return;
}
snake.addLast(cell);
directions.add(direction);
Cell newCell = new Cell(cell.getRow(), cell.getCol() + 1);
generateSnake(newCell, 'R', snake, directions);
if (snake.size() > 1) {
newCell = new Cell(cell.getRow() + 1, cell.getCol());
generateSnake(newCell, 'D', snake, directions);
}
if (snake.size() > 2) {
newCell = new Cell(cell.getRow(), cell.getCol() - 1);
generateSnake(newCell, 'L', snake, directions);
}
if (snake.size() > 3) {
newCell = new Cell(cell.getRow() - 1, cell.getCol());
generateSnake(newCell, 'U', snake, directions);
}
snake.removeLast();
directions.remove(directions.size() - 1);
}
private static void markIsomorphicSnakes(List<Character> directions) {
flipSnake(directions);
usedSnakes.add(String.valueOf(directions));
switchSnakeHeadAndTail(directions);
usedSnakes.add(String.valueOf(directions));
Collections.reverse(directions);
usedSnakes.add(String.valueOf(directions));
while (directions.get(1) != 'R') {
rotateSnakeClockwise(directions);
}
usedSnakes.add(String.valueOf(directions));
flipSnake(directions);
usedSnakes.add(String.valueOf(directions));
}
private static void rotateSnakeClockwise(List<Character> directions) {
for (int i = 0; i < directions.size(); i++) {
switch (directions.get(i)) {
case 'U':
directions.set(i, 'R');
break;
case 'D':
directions.set(i, 'L');
break;
case 'R':
directions.set(i, 'D');
break;
case 'L':
directions.set(i, 'U');
break;
}
}
}
private static void switchSnakeHeadAndTail(List<Character> directions) {
char temp = directions.remove(0);
directions.add(temp);
for (int i = 0; i < directions.size(); i++) {
switch (directions.get(i)) {
case 'U':
directions.set(i, 'D');
break;
case 'D':
directions.set(i, 'U');
break;
case 'R':
directions.set(i, 'L');
break;
case 'L':
directions.set(i, 'R');
break;
}
}
}
private static void flipSnake(List<Character> directions) {
for (int i = 0; i < directions.size(); i++) {
switch (directions.get(i)) {
case 'U':
directions.set(i, 'D');
break;
case 'D':
directions.set(i, 'U');
break;
}
}
}
public static class Cell {
private int row;
private int col;
public Cell() {
}
public Cell(int row, int col) {
setRow(row);
setCol(col);
}
public int getRow() {
return row;
}
public int getCol() {
return col;
}
public void setRow(int row) {
this.row = row;
}
public void setCol(int col) {
this.col = col;
}
}
} | [
"gpetiaa@gmail.com"
] | gpetiaa@gmail.com |
b384ca874d7a96b3de91f52df1779a07ab963650 | 58fb74aafdd5aee3a4339e63051f1b8da5205f3e | /app/src/test/java/com/poppin/movies/ExampleUnitTest.java | b7ac662b2819edd7852a506fc02a6c6c8306beec | [] | no_license | allefsousa/imdbApiFilmes | 4ef224f5661c7299b9978e7090e8a5e642ac7844 | e5326a01b4c2fe63d8cf9830e4e6c3899dc5dd49 | refs/heads/master | 2020-03-25T13:27:25.332977 | 2018-08-08T03:00:15 | 2018-08-08T03:00:15 | 143,826,132 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 378 | java | package com.poppin.movies;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"allefsousa_1@hotmail.com"
] | allefsousa_1@hotmail.com |
f46157f33e5442e068ffbe0c476bbf5ac86c483d | bf7b4c21300a8ccebb380e0e0a031982466ccd83 | /middlewareConcepts2014-master/Assignment3/lib/jacorb-3.4/src/generated/org/omg/CosNotifyComm/SequencePushSupplierPOA.java | cce23c51c7503d071de139932f5d706419f4a03e | [] | no_license | Puriakshat/Tuberlin | 3fe36b970aabad30ed95e8a07c2f875e4912a3db | 28dcf7f7edfe7320c740c306b1c0593a6c1b3115 | refs/heads/master | 2021-01-19T07:30:16.857479 | 2014-11-06T18:49:16 | 2014-11-06T18:49:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,576 | java | package org.omg.CosNotifyComm;
/**
* Generated from IDL interface "SequencePushSupplier".
*
* @author JacORB IDL compiler V @project.version@
* @version generated at 27-May-2014 20:14:30
*/
public abstract class SequencePushSupplierPOA
extends org.omg.PortableServer.Servant
implements org.omg.CORBA.portable.InvokeHandler, org.omg.CosNotifyComm.SequencePushSupplierOperations
{
static private final java.util.HashMap<String,Integer> m_opsHash = new java.util.HashMap<String,Integer>();
static
{
m_opsHash.put ( "subscription_change", Integer.valueOf(0));
m_opsHash.put ( "disconnect_sequence_push_supplier", Integer.valueOf(1));
}
private String[] ids = {"IDL:omg.org/CosNotifyComm/SequencePushSupplier:1.0","IDL:omg.org/CosNotifyComm/NotifySubscribe:1.0"};
public org.omg.CosNotifyComm.SequencePushSupplier _this()
{
org.omg.CORBA.Object __o = _this_object() ;
org.omg.CosNotifyComm.SequencePushSupplier __r = org.omg.CosNotifyComm.SequencePushSupplierHelper.narrow(__o);
return __r;
}
public org.omg.CosNotifyComm.SequencePushSupplier _this(org.omg.CORBA.ORB orb)
{
org.omg.CORBA.Object __o = _this_object(orb) ;
org.omg.CosNotifyComm.SequencePushSupplier __r = org.omg.CosNotifyComm.SequencePushSupplierHelper.narrow(__o);
return __r;
}
public org.omg.CORBA.portable.OutputStream _invoke(String method, org.omg.CORBA.portable.InputStream _input, org.omg.CORBA.portable.ResponseHandler handler)
throws org.omg.CORBA.SystemException
{
org.omg.CORBA.portable.OutputStream _out = null;
// do something
// quick lookup of operation
java.lang.Integer opsIndex = (java.lang.Integer)m_opsHash.get ( method );
if ( null == opsIndex )
throw new org.omg.CORBA.BAD_OPERATION(method + " not found");
switch ( opsIndex.intValue() )
{
case 0: // subscription_change
{
try
{
org.omg.CosNotification.EventType[] _arg0=org.omg.CosNotification.EventTypeSeqHelper.read(_input);
org.omg.CosNotification.EventType[] _arg1=org.omg.CosNotification.EventTypeSeqHelper.read(_input);
_out = handler.createReply();
subscription_change(_arg0,_arg1);
}
catch(org.omg.CosNotifyComm.InvalidEventType _ex0)
{
_out = handler.createExceptionReply();
org.omg.CosNotifyComm.InvalidEventTypeHelper.write(_out, _ex0);
}
break;
}
case 1: // disconnect_sequence_push_supplier
{
_out = handler.createReply();
disconnect_sequence_push_supplier();
break;
}
}
return _out;
}
public String[] _all_interfaces(org.omg.PortableServer.POA poa, byte[] obj_id)
{
return ids;
}
}
| [
"puri.akshat@gmail.com"
] | puri.akshat@gmail.com |
af3b53cc76dc93d3cbe98ba901d8bcb6d0309b62 | 0bb9bf2fd75f33fc07390b0e228a2e5a0bd4d1bf | /Revision2/src/Strings/permutations.java | 38b02db27d76e178946dab1b27af2665e351fcc3 | [] | no_license | rewanth21/freetime | 286a453f0ab4643f569ae4e81233db45c9e73ead | c485b8db2b2b79d98bc1d47e03ac64ab5311f1ea | refs/heads/master | 2020-12-24T08:01:54.229736 | 2016-11-26T23:54:42 | 2016-11-26T23:54:42 | 46,446,912 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,467 | java | package Strings;
import java.util.LinkedHashMap;
import java.util.Map.Entry;
public class permutations {
public static void main(String[] args) {
// TODO Auto-generated method stub
String s = "AABC";
String[] stringarray = s.split("");
LinkedHashMap<String, Integer> map = new LinkedHashMap<>();
for(String string : stringarray){
if(map.containsKey(string)){
map.put(string, map.get(string) + 1);
}
else
map.put(string, 1);
}
String[] newstringarray = new String[map.size()];
int[] count = new int[map.size()];
int i = 0;
for(Entry<String, Integer> entry : map.entrySet()){
String key = entry.getKey();
int value = entry.getValue();
newstringarray[i] = key;
count[i] = value;
i++;
}
String[] result = new String[s.length()];
permuteUtil(newstringarray, count, result, 0);
}
static void permuteUtil(String str[], int count[], String result[], int level){
if(level == result.length){
for(String s : result){
System.out.print(s);
}
System.out.println();
}
for(int i = 0; i < str.length;i++){
if(count[i] == 0){
continue;
}
result[level] = str[i];
count[i]--;
permuteUtil(str, count, result, level+1);
count[i]++;
}
}
}
| [
"rewanth19@gmail.com"
] | rewanth19@gmail.com |
3925514526b54ad34f6fa93c017e9658907fd01f | 843c49ad39ebb50269d86986a2e3d471cac5ea20 | /time-management-backend-springboot-app/src/main/java/com/toptal/timemgmt/security/JwtAuthenticationFilter.java | 60b2b3f792bd0ce41b2c1812beec31beeda2268c | [] | no_license | Bhargav9427/Time-Management-Application | c0ecc33a652df0bcd82d07b2255c5e3c8f2e1bf7 | 2b810b3c1a9270737a49cd7a7cd04a46d519fc2b | refs/heads/master | 2023-04-13T17:47:08.571237 | 2021-04-07T18:00:27 | 2021-04-07T18:00:27 | 355,636,124 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,284 | java | package com.toptal.timemgmt.security;
import java.io.IOException;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
import org.springframework.util.StringUtils;
import org.springframework.web.filter.OncePerRequestFilter;
public class JwtAuthenticationFilter extends OncePerRequestFilter {
@Autowired
private JwtTokenProvider tokenProvider;
@Autowired
private CustomUserDetailsService customUserDetailsService;
private static final Logger logger = LoggerFactory.getLogger(JwtAuthenticationFilter.class);
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
try {
String jwt = getJwtFromRequest(request);
if (StringUtils.hasText(jwt) && tokenProvider.validateToken(jwt)) {
Long userId = tokenProvider.getUserIdFromJWT(jwt);
UserDetails userDetails = customUserDetailsService.loadUserById(userId);
UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(userDetails, null, userDetails.getAuthorities());
authentication.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
SecurityContextHolder.getContext().setAuthentication(authentication);
}
} catch (Exception ex) {
logger.error("Could not set user authentication in security context", ex);
}
filterChain.doFilter(request, response);
}
private String getJwtFromRequest(HttpServletRequest request) {
String bearerToken = request.getHeader("Authorization");
if (StringUtils.hasText(bearerToken) && bearerToken.startsWith("Bearer ")) {
return bearerToken.substring(7);
}
return null;
}
}
| [
"bhargav.kular@radixhealth.com"
] | bhargav.kular@radixhealth.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.