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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
b9cc41ddca5329fbf0a4a6aa5e5127551918c562 | ecf98ff0387d1bffa09b188d356ae0b81f45ea1f | /src/main/java/parser/Conference.java | d98d9789f02a8ca67efa8e014221ef018eddac1b | [] | no_license | Wowu/agh-io-schedules-cli | 5f5cef47dffca61c6cadaed4ef65b7c1b4214a32 | ebf99f84afe8a6e3647e3d42e45197f9d17ff3da | refs/heads/master | 2023-05-14T00:32:55.070359 | 2021-06-01T17:42:26 | 2021-06-01T17:42:26 | 348,279,301 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,552 | java | package parser;
import java.util.ArrayList;
import java.util.List;
@SuppressWarnings("unused")
public class Conference {
private final Schedule schedule;
private final Integer number;
private final List<Meeting> meetings;
public Conference(Schedule schedule, Integer number) {
this.schedule = schedule;
this.number = number;
meetings = new ArrayList<>();
}
/**
* returns true if conferences have no collisions
*/
public boolean compareConference(Conference otherConference, StringBuilder result, boolean sameSchedule) {
boolean noCollisions = true;
for (Meeting meeting : meetings) {
boolean noCollisionsMeeting = true;
StringBuilder response =
new StringBuilder(String.format("\n%17s %s", "-", meeting.toString()));
for (Meeting otherMeeting : otherConference.getMeetings()) {
if (!sameSchedule || !meeting.equals(otherMeeting)) {
if (!meeting.compareMeeting(otherMeeting, response)) {
noCollisionsMeeting = false;
}
}
}
if (!noCollisionsMeeting) {
result.append(response);
noCollisions = false;
}
}
return noCollisions;
}
public Schedule getSchedule() {
return schedule;
}
public Integer getNumber() {
return number;
}
public List<Meeting> getMeetings() {
return meetings;
}
}
| [
"lucasjezap@gmail.com"
] | lucasjezap@gmail.com |
cacdb29db380a93bb63c8d61069392fb48b18a8d | 63c480718ef2171307d74598740019e4e8a411e3 | /xposedcompat/src/main/java/com/swift/sandhook/xposedcompat/utils/DexLog.java | e2b6b37a3f4c1cef0702a0b0f2bc7554f72d65c7 | [
"Apache-2.0"
] | permissive | netstu/SandHook | 909678a3264a58a533c93d09da9a437b7ab64845 | 0b88465556fd9847d612bc1cfca0152e14bd2257 | refs/heads/master | 2020-04-23T06:29:15.519535 | 2019-02-16T04:00:31 | 2019-02-16T04:00:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 732 | java | package com.swift.sandhook.xposedcompat.utils;
import android.util.Log;
import com.swift.sandhook.xposedcompat.BuildConfig;
public class DexLog {
public static final String TAG = "SandXposed-dexmaker";
public static int v(String s) {
return Log.v(TAG, s);
}
public static int i(String s) {
return Log.i(TAG, s);
}
public static int d(String s) {
if (BuildConfig.DEBUG) {
return Log.d(TAG, s);
}
return 0;
}
public static int w(String s) {
return Log.w(TAG, s);
}
public static int e(String s) {
return Log.e(TAG, s);
}
public static int e(String s, Throwable t) {
return Log.e(TAG, s, t);
}
}
| [
"swift_gan@trendmicro.com.cn"
] | swift_gan@trendmicro.com.cn |
0cbe8960cae2a6b9020b0bcfae70bcb857958432 | e9866556bde4dda7320754874cafb39478f5d22e | /src/main/java/chap2/Movie.java | 4001ee1cae6244ba79981ab3e35770542e258d21 | [] | no_license | brewagebear/the-objects-review | bb0673fa1fa4b152183ccc036ad1f5e34b8db98a | 9f7569a49ebf56a7b08922b824af28d412e32e07 | refs/heads/master | 2023-07-08T15:34:23.101512 | 2021-08-14T14:15:48 | 2021-08-14T14:15:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 786 | java | package chap2;
import chap2.policy.DiscountPolicy;
import java.time.Duration;
public class Movie {
private String title;
private Duration runningTime;
private Money fee;
private DiscountPolicy discountPolicy;
public Movie(String title, Duration runningTime, Money fee, DiscountPolicy discountPolicy) {
this.title = title;
this.runningTime = runningTime;
this.fee = fee;
this.discountPolicy = discountPolicy;
}
public Money getFee() {
return fee;
}
public Money calculateMovieFee(Screening screening) {
return fee.minus(discountPolicy.calculateDiscount(screening));
}
public void changeDiscountPolicy(DiscountPolicy discountPolicy) {
this.discountPolicy = discountPolicy;
}
}
| [
"workingssu@gmail.com"
] | workingssu@gmail.com |
4d35c9c00e7f0f834a8142f04817663e3482735a | 67cba194543f3acab18a53741c2dc65aa8e07e48 | /dissector-core/src/main/java/net/bramp/dissector/node/NumberNode.java | cd0139114114640457725a6717461d978aa97350 | [
"BSD-2-Clause"
] | permissive | bramp/dissector | 5799eb8aac10c89cf319bc305a895b0e9486b425 | f80754fa2c9364af8919c61eb55b77c71703f4ec | refs/heads/master | 2023-03-19T16:15:03.475096 | 2016-11-12T23:43:53 | 2016-11-12T23:43:53 | 16,671,113 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,067 | java | package net.bramp.dissector.node;
import net.bramp.dissector.io.ExtendedRandomAccessFile;
import java.io.IOException;
/**
* Generic number of specific length
* @author bramp
*/
public class NumberNode extends Node<Long> {
long value;
byte radix = 10;
public NumberNode() {}
// TODO Move length/signed into constructor
public NumberNode read(ExtendedRandomAccessFile in, int length) throws IOException {
return read(in, length, false);
}
public NumberNode read(ExtendedRandomAccessFile in, int length, boolean signed) throws IOException {
super.setPos(in, length);
value = signed ? in.readIntOfLength(length) : in.readUnsignedIntOfLength(length);
return this;
}
public NumberNode base(int radix) {
this.radix = (byte)radix;
return this;
}
public Long value() {
return value;
}
public String toString() {
if (radix == 16)
return "0x" + Long.toString(value, radix).toUpperCase();
return Long.toString(value, radix);
}
}
| [
"me@bramp.net"
] | me@bramp.net |
6f663bf5cdd55eba262a2bb9ac5773f75afa7f4b | 2360fd96acc36615ab4ae9f270b42ca143c9aa66 | /src/com/facebook/buck/cli/ArtifactCaches.java | dfe5883696d9ab659baca64c8e8b64eb24195e07 | [
"Apache-2.0"
] | permissive | iammrwu/buck | 223f77008b5544f71843f020627722ebae5d9859 | 60a29692e8822388bf4178907d78c198d06504c0 | refs/heads/master | 2021-01-16T18:58:40.817071 | 2015-09-13T15:02:16 | 2015-09-13T19:27:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,515 | java | /*
* Copyright 2013-present Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. You may obtain
* a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package com.facebook.buck.cli;
import com.facebook.buck.event.BuckEventBus;
import com.facebook.buck.io.ProjectFilesystem;
import com.facebook.buck.rules.ArtifactCache;
import com.facebook.buck.rules.ArtifactCacheConnectEvent;
import com.facebook.buck.rules.DirArtifactCache;
import com.facebook.buck.rules.HttpArtifactCache;
import com.facebook.buck.rules.LoggingArtifactCacheDecorator;
import com.facebook.buck.rules.MultiArtifactCache;
import com.facebook.buck.rules.NoopArtifactCache;
import com.facebook.buck.util.HumanReadableException;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.hash.Hashing;
import com.squareup.okhttp.ConnectionPool;
import com.squareup.okhttp.Interceptor;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Response;
import java.io.IOException;
import java.net.URL;
import java.nio.file.Path;
import java.util.concurrent.TimeUnit;
/**
* Creates instances of the {@link ArtifactCache}.
*/
public class ArtifactCaches {
private ArtifactCaches() {
}
public static ArtifactCache newInstance(
ArtifactCacheBuckConfig buckConfig,
BuckEventBus buckEventBus,
ProjectFilesystem projectFilesystem,
Optional<String> wifiSsid) throws InterruptedException {
ArtifactCacheConnectEvent.Started started = ArtifactCacheConnectEvent.started();
buckEventBus.post(started);
ArtifactCache artifactCache = new LoggingArtifactCacheDecorator(
buckEventBus,
newInstanceInternal(
buckConfig,
buckEventBus,
projectFilesystem,
wifiSsid));
buckEventBus.post(ArtifactCacheConnectEvent.finished(started));
return artifactCache;
}
private static ArtifactCache newInstanceInternal(
ArtifactCacheBuckConfig buckConfig,
BuckEventBus buckEventBus,
ProjectFilesystem projectFilesystem,
Optional<String> wifiSsid) throws InterruptedException {
ImmutableSet<ArtifactCacheBuckConfig.ArtifactCacheMode> modes =
buckConfig.getArtifactCacheModes();
if (modes.isEmpty()) {
return new NoopArtifactCache();
}
ImmutableList.Builder<ArtifactCache> builder = ImmutableList.builder();
boolean useDistributedCache = buckConfig.isWifiUsableForDistributedCache(wifiSsid);
for (ArtifactCacheBuckConfig.ArtifactCacheMode mode : modes) {
switch (mode) {
case dir:
ArtifactCache dirArtifactCache = createDirArtifactCache(buckConfig, projectFilesystem);
buckEventBus.register(dirArtifactCache);
builder.add(dirArtifactCache);
break;
case http:
if (useDistributedCache) {
ArtifactCache httpArtifactCache = createHttpArtifactCache(
buckConfig,
buckEventBus,
projectFilesystem);
builder.add(httpArtifactCache);
}
break;
}
}
ImmutableList<ArtifactCache> artifactCaches = builder.build();
if (artifactCaches.size() == 1) {
// Don't bother wrapping a single artifact cache in MultiArtifactCache.
return artifactCaches.get(0);
} else {
return new MultiArtifactCache(artifactCaches);
}
}
private static ArtifactCache createDirArtifactCache(
ArtifactCacheBuckConfig buckConfig,
ProjectFilesystem projectFilesystem) {
Path cacheDir = buckConfig.getCacheDir();
boolean doStore = buckConfig.getDirCacheReadMode();
try {
return new DirArtifactCache(
"dir",
projectFilesystem,
cacheDir,
doStore,
buckConfig.getCacheDirMaxSizeBytes());
} catch (IOException e) {
throw new HumanReadableException(
"Failure initializing artifact cache directory: %s",
cacheDir);
}
}
private static ArtifactCache createHttpArtifactCache(
ArtifactCacheBuckConfig buckConfig,
BuckEventBus buckEventBus,
ProjectFilesystem projectFilesystem) {
URL url = buckConfig.getHttpCacheUrl();
int timeoutSeconds = buckConfig.getHttpCacheTimeoutSeconds();
boolean doStore = buckConfig.getHttpCacheReadMode();
final String host = buckConfig.getHostToReportToRemoteCacheServer();
// Setup the defaut client to use.
OkHttpClient client = new OkHttpClient();
client.networkInterceptors().add(
new Interceptor() {
@Override
public Response intercept(Chain chain) throws IOException {
return chain.proceed(
chain.request().newBuilder()
.addHeader("X-BuckCache-User", System.getProperty("user.name", "<unknown>"))
.addHeader("X-BuckCache-Host", host)
.build());
}
});
client.setConnectTimeout(timeoutSeconds, TimeUnit.SECONDS);
client.setConnectionPool(
new ConnectionPool(
// It's important that this number is greater than the `-j` parallelism,
// as if it's too small, we'll overflow the reusable connection pool and
// start spamming new connections. While this isn't the best location,
// the other current option is setting this wherever we construct a `Build`
// object and have access to the `-j` argument. However, since that is
// created in several places leave it here for now.
/* maxIdleConnections */ 200,
/* keepAliveDurationMs */ TimeUnit.MINUTES.toMillis(5)));
// For fetches, use a client with a read timeout.
OkHttpClient fetchClient = client.clone();
fetchClient.setReadTimeout(timeoutSeconds, TimeUnit.SECONDS);
return new HttpArtifactCache(
"http",
fetchClient,
client,
url,
doStore,
projectFilesystem,
buckEventBus,
Hashing.crc32());
}
}
| [
"sdwilsh@fb.com"
] | sdwilsh@fb.com |
05ff2b1a5dbd4f2bf401698381caaf5d66859a11 | 5f1341521f5dfcd8e78f38c71aa759d87d93fe35 | /gnhzb/src/edu/zju/cims201/GOF/web/message/sessionListener/ApplicationConstants.java | fade7cfad3aab45bacfd04c7b2f559d2d1da3fa5 | [] | no_license | bbl4229112/gnhzb | 7d021383725a7dff8763d00c9646ed2d4793e74a | 1ce6790f543c8170b961b58e758264d1860f3787 | refs/heads/master | 2021-01-17T23:17:44.026206 | 2015-07-20T08:09:28 | 2015-07-20T08:09:28 | 39,332,082 | 0 | 0 | null | 2015-07-19T11:53:06 | 2015-07-19T11:53:04 | null | UTF-8 | Java | false | false | 742 | java | package edu.zju.cims201.GOF.web.message.sessionListener;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpSession;
public class ApplicationConstants {
public static Map<String,HttpSession> SESSION_MAP =
new HashMap<String,HttpSession>();//用来索引所有session----
public static int CURRENT_LOGIN_COUNT = 0;//当前登录用户总数----
public static int TOTAL_HISTORY_COUNT = 0;//历史访客总数
public static int MAX_ONLINE_COUNT = 0;//最大在线访客数量
public static Date START_DATE = new Date();//服务器启动时间
public static Date MAX_ONLINE_COUNT_DATE = new Date();//达到最大访客量的日期
}
| [
"595612343@qq.com"
] | 595612343@qq.com |
e4920ce64c6598d5c106f9ea5b40312d25932f20 | b8f487de1c3071351739887291db153c3199ec0e | /src/test/resources/TestAction5.java | 0ec36e75a577ba0ee7ecafe830337f376c5fb3a1 | [
"MIT"
] | permissive | wody/action-pack-sdk | eaed5aa95eab9230f6713594eaec5fea6908849f | 5f4984f826f1a92bc95891ea8f5f6285144cc7ef | refs/heads/master | 2022-07-17T06:09:15.764506 | 2020-05-15T13:42:36 | 2020-05-15T13:42:36 | 264,159,859 | 0 | 0 | MIT | 2020-05-15T10:03:51 | 2020-05-15T10:03:50 | null | UTF-8 | Java | false | false | 1,815 | java | package com.broadcom;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import com.broadcom.apdk.api.BaseAction;
import com.broadcom.apdk.api.annotations.Action;
import com.broadcom.apdk.api.annotations.ActionOutputParam;
@Action(
name = "ACTION5",
title = "Action #5 for testing the API"
)
public class TestAction5 extends BaseAction {
@ActionOutputParam
short shortPrimitive;
@ActionOutputParam
Short shortWrapper;
@ActionOutputParam
byte bytePrimitive;
@ActionOutputParam
Byte byteWrapper;
@ActionOutputParam
char charPrimitive;
@ActionOutputParam
Character charWrapper;
@ActionOutputParam
int intPrimitive;
@ActionOutputParam
Integer intWrapper;
@ActionOutputParam
float floatPrimitive;
@ActionOutputParam
Float floatWrapper;
@ActionOutputParam
long longPrimitive;
@ActionOutputParam
Long longWrapper;
@ActionOutputParam
double doublePrimitive;
@ActionOutputParam
Double doubleWrapper;
@ActionOutputParam
boolean booleanPrimitive;
@ActionOutputParam
Boolean booleanWrapper;
@ActionOutputParam
String string;
@ActionOutputParam
LocalDate date;
@ActionOutputParam
LocalDateTime datetime;
@ActionOutputParam
LocalTime time;
@Override
public void run() {
date = LocalDate.of(1980, 3, 4);
time = LocalTime.of(14, 8);
datetime = LocalDateTime.of(date, time);
string = "Description";
floatPrimitive = (float) 4.3;
floatWrapper = (float) 4078.387;
bytePrimitive = 3;
byteWrapper = 4;
intPrimitive = 777;
intWrapper = 87;
charPrimitive = 't';
charWrapper = 'f';
longPrimitive = 686;
longWrapper = (long) 6534;
booleanPrimitive = false;
booleanWrapper = true;
shortPrimitive = 1;
shortWrapper = 2;
doublePrimitive = 87.87;
doubleWrapper = 103.43;
}
}
| [
"mg685065@broadcom.net"
] | mg685065@broadcom.net |
d1177cb5b0480b4fdd2618a244ca6351eeed1633 | 3aa4eb3a19a4b1154d9c7d2445feedd100943958 | /nvwa-zkadmin/src/main/java/org/bigmouth/nvwa/zkadmin/interceptor/AuthorizationInterceptor.java | 74912e9cb3a48c9e539ae28931b5b2e7e1389b76 | [] | no_license | big-mouth-cn/nvwa | de367065600d6e751cb432df660f377b57052654 | 6a460cf62c65ed70478a6e9ef3b5a142e8775d19 | refs/heads/master | 2020-04-12T02:25:02.566820 | 2018-01-15T04:34:33 | 2018-01-15T04:34:33 | 57,180,498 | 20 | 26 | null | null | null | null | UTF-8 | Java | false | false | 2,060 | java | package org.bigmouth.nvwa.zkadmin.interceptor;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang.StringUtils;
import org.bigmouth.nvwa.utils.StringHelper;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
public class AuthorizationInterceptor implements HandlerInterceptor {
private final String username;
private final String password;
public AuthorizationInterceptor(String username, String password) {
this.username = username;
this.password = password;
}
@Override
public void afterCompletion(HttpServletRequest arg0, HttpServletResponse arg1, Object arg2, Exception arg3)
throws Exception {
}
@Override
public void postHandle(HttpServletRequest arg0, HttpServletResponse arg1, Object arg2, ModelAndView arg3)
throws Exception {
}
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object arg2) throws Exception {
String sessionAuth = (String) request.getSession().getAttribute("auth");
if (sessionAuth == null) {
if (!checkHeaderAuth(request, response)) {
response.setStatus(401);
response.setHeader("Cache-Control", "no-store");
response.setDateHeader("Expires", 0);
response.setHeader("WWW-authenticate", "Basic Realm=\"请输入授权账号密码\"");
return false;
}
}
return true;
}
private boolean checkHeaderAuth(HttpServletRequest request,
HttpServletResponse response) throws IOException {
String auth = request.getHeader("Authorization");
if ((auth != null) && (auth.length() > 6)) {
auth = auth.substring(6, auth.length());
byte[] decodeBase64 = Base64.decodeBase64(auth);
String plaintext = StringHelper.convert(decodeBase64);
if (StringUtils.equals(plaintext, username + ":" + password)) {
request.getSession().setAttribute("auth", auth);
return true;
}
}
return false;
}
}
| [
"huxiao.mail@qq.com"
] | huxiao.mail@qq.com |
6bf904f5438958b9b2eca91aa6b7d1d56813c745 | 50ddfcbd7fb7a5675e15cf28374aed8f78031f49 | /src/zirix/zxcc/server/ZXMain.java | f6bc4085cf46d8950dcf6894756f0b222038ff2a | [] | no_license | zirixdev/ZXCC_RAPHAEL | 7316ed724492816c529f992c651c5f682bca3de9 | b56d105463d205e7c06b3a6322820500e821c187 | refs/heads/master | 2021-01-19T07:40:52.691743 | 2015-01-05T12:41:33 | 2015-01-05T12:41:33 | 27,817,893 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 744 | java | /*ZIRIX CONTROL CENTER - ZX MAIN
DESENVOLVIDO POR ZIRIX SOLUÇÕES EM RASTREAMENTO LTDA.
DESENVOLVEDOR: RAPHAEL B. MARQUES
TECNOLOGIAS UTILIZADAS: JAVA*/
package zirix.zxcc.server;
public class ZXMain {
public static String URL_ADRESS_= null;
public static String DB_NAME_= null;
public static String LOCAL_= null;
public static void main(String[] args) {
}
public static void setUrlAdress(String UrlAdress){ URL_ADRESS_ = UrlAdress;}
public static void setDbName(String DbName){ DB_NAME_ = DbName;}
public static void setLocal(String Local){ LOCAL_ = Local;}
public static String getLocal(){return LOCAL_;}
public static String getDbName(){return DB_NAME_;}
public static String getAdress(){return URL_ADRESS_;}
}
| [
"raphael.zirix@gmail.com"
] | raphael.zirix@gmail.com |
eb113be436fe5d77a541ba54dff647fcbba0ed29 | 3b0395a91d50bb697b4ef7046023ef38a22b424a | /src/main/java/com/jfinal/weixin/sdk/msg/in/event/InUserPayFromCardEvent.java | 254ad0b5b837b2858cb2eec03d55bcd12579be2b | [] | no_license | otamanager/otareport | 936e7db5e2fee6b0e95729a3dcc72202e1cc5f01 | 7115ff0e3357104b3d7f332481a09723c9b97e81 | refs/heads/master | 2021-01-17T17:43:23.503938 | 2016-10-11T07:34:20 | 2016-10-11T07:34:20 | 70,567,866 | 3 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,304 | java | package com.jfinal.weixin.sdk.msg.in.event;
/**
* Created by L.cm on 2016/5/5.
* 微信会员卡快速买单
* <pre>
* <xml>
* <ToUserName><![CDATA[gh_7638cbc70355]]></ToUserName>
* <FromUserName><![CDATA[o_CBes-OUGtQ4vxd_7r5-p5QRRXU]]></FromUserName>
* <CreateTime>1462420332</CreateTime>
* <MsgType><![CDATA[event]]></MsgType>
* <Event><![CDATA[user_pay_from_pay_cell]]></Event>
* <CardId><![CDATA[p_CBes55910LQGAOStjVKaTChpsg]]></CardId>
* <UserCardCode><![CDATA[777670435071]]></UserCardCode>
* <TransId><![CDATA[4001802001201605055526028099]]></TransId>
* <LocationId>403808221</LocationId>
* <Fee>100</Fee>
* <OriginalFee>100</OriginalFee>
* </xml>
* </pre>
*/
public class InUserPayFromCardEvent extends EventInMsg {
public static final String EVENT = "user_pay_from_pay_cell";
private String cardId;
private String userCardCode;
private String transId;
private String locationId;
private String fee;
private String originalFee;
public InUserPayFromCardEvent(String toUserName, String fromUserName, Integer createTime, String msgType, String event) {
super(toUserName, fromUserName, createTime, msgType, event);
}
public String getCardId() {
return cardId;
}
public void setCardId(String cardId) {
this.cardId = cardId;
}
public String getUserCardCode() {
return userCardCode;
}
public void setUserCardCode(String userCardCode) {
this.userCardCode = userCardCode;
}
public String getTransId() {
return transId;
}
public void setTransId(String transId) {
this.transId = transId;
}
public String getLocationId() {
return locationId;
}
public void setLocationId(String locationId) {
this.locationId = locationId;
}
public String getFee() {
return fee;
}
public void setFee(String fee) {
this.fee = fee;
}
public String getOriginalFee() {
return originalFee;
}
public void setOriginalFee(String originalFee) {
this.originalFee = originalFee;
}
}
| [
"857169072@qq.com"
] | 857169072@qq.com |
0d7dfd8a74cdc811a13320a0954d02eb5ab3d77d | 4ba291307588bc3522a6117d632ea8cb7b2cc1ba | /liangliang/app/src/main/java/cn/chono/yopper/Service/Http/OrderLastest/OrderLastestBean.java | fdf9a6069c96c09ccbacb00a87c7b7cdf8f76e92 | [] | no_license | 439ED537979D8E831561964DBBBD7413/LiaLia | 838cf98c5a737d63ec1d0be7023c0e9750bb232b | 6b4f0ad1dbfd4e85240cf51ac1402a5bc6b35bd4 | refs/heads/master | 2020-04-03T12:58:16.317166 | 2016-09-12T02:50:21 | 2016-09-12T02:50:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 259 | java | package cn.chono.yopper.Service.Http.OrderLastest;
import cn.chono.yopper.Service.Http.ParameterBean;
/**
* Created by cc on 16/5/20.
*/
public class OrderLastestBean extends ParameterBean {
public int bookingUserId;
public int receiveUserId;
}
| [
"jinyu_yang@ssic.cn"
] | jinyu_yang@ssic.cn |
45222c9f813f76c8aae8ce1d0c04de494e0faa97 | 37dc8ab4cb35bf5a1ab35ca14f827be188ff0698 | /artemis-common/src/main/java/com/ctrip/soa/artemis/taskdispatcher/TaskDispatchers.java | 05d72711c0017e376d2184dc142c0cefa5e74fce | [
"Apache-2.0"
] | permissive | ctripcorp/artemis | 84440e38fec5af7771b834678abb0024e1f02c41 | 9a3a2f5179801508d9925939fe8ad0eb3f8c1a56 | refs/heads/master | 2023-07-30T17:46:32.066517 | 2019-02-22T01:37:31 | 2019-02-22T01:37:31 | 107,536,049 | 40 | 14 | null | null | null | null | UTF-8 | Java | false | false | 726 | java | package com.ctrip.soa.artemis.taskdispatcher;
import java.util.List;
/**
* Created by Qiang Zhao on 10/07/2016.
*/
public class TaskDispatchers {
public static <T extends Task, W> TaskDispatcher<T> newSingleItemTaskDispatcher(String dispatcherId,
TaskProcessor<T, T> taskProcessor) {
return new DefaultTaskDispatcher<>(dispatcherId, new SingleItemTaskAcceptor<T>(dispatcherId),
taskProcessor);
}
public static <T extends Task> TaskDispatcher<T> newBatchingTaskDispatcher(String dispatcherId,
TaskProcessor<T, List<T>> taskProcessor) {
return new DefaultTaskDispatcher<>(dispatcherId, new BatchingTaskAcceptor<T>(dispatcherId), taskProcessor);
}
}
| [
"q_zhao@Ctrip.com"
] | q_zhao@Ctrip.com |
04f738378671c4d8d57b350417317476455d21b2 | 586c669e61c242a9fd67bba5a41f1a9defde4ce8 | /cooperation/src/main/java/com/reache/cooperation/modules/sys/security/UsernamePasswordToken.java | 5d7da67d319368de905e29129e09a014f8d25e5b | [] | no_license | shockw/cooperation | 15366dcf541078ef9befec74ca3a23fbfc7e04c2 | d8d4dcf5218bcd350f875424767d44077a73f237 | refs/heads/master | 2021-08-28T05:05:19.304363 | 2017-12-11T08:09:23 | 2017-12-11T08:09:23 | 104,889,256 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 961 | java | /**
* Copyright © 2012-2016 <a href="https://github.com/reache/cooperation">Cooperation</a> All rights reserved.
*/
package com.reache.cooperation.modules.sys.security;
/**
* 用户和密码(包含验证码)令牌类
* @author ThinkGem
* @version 2013-5-19
*/
public class UsernamePasswordToken extends org.apache.shiro.authc.UsernamePasswordToken {
private static final long serialVersionUID = 1L;
private String captcha;
private boolean mobileLogin;
public UsernamePasswordToken() {
super();
}
public UsernamePasswordToken(String username, char[] password,
boolean rememberMe, String host, String captcha, boolean mobileLogin) {
super(username, password, rememberMe, host);
this.captcha = captcha;
this.mobileLogin = mobileLogin;
}
public String getCaptcha() {
return captcha;
}
public void setCaptcha(String captcha) {
this.captcha = captcha;
}
public boolean isMobileLogin() {
return mobileLogin;
}
}
| [
"wz19831129"
] | wz19831129 |
b4ba523adf889483598a56b1969f0bd14718d4d6 | 92339e55f71b3126698c84cdcf37994fff0e00df | /springboot-servicio-oauth/src/main/java/com/gmr/formacion/springboot/app/oauth/service/IUsuarioService.java | 3a9600ee92e52dd0b043061c4702149dee223df1 | [] | no_license | gregoriomena/cursomicroservicios | bc0a5472540030e31f19f95f0bbd8bd5bcfa768e | 753813c6bd8d147e6eed91fd4e0e0eaebe0df9d4 | refs/heads/master | 2023-08-17T11:51:37.327443 | 2021-09-30T14:37:36 | 2021-09-30T14:37:36 | 395,242,018 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 261 | java | package com.gmr.formacion.springboot.app.oauth.service;
import com.gmr.formacion.springboot.app.commons.usuarios.models.entity.Usuario;
public interface IUsuarioService {
Usuario findByUsername(String username);
Usuario update(Usuario usuario, Long id);
}
| [
"gregoriomena@hiberus.com"
] | gregoriomena@hiberus.com |
32b2ac94aea248bb0a986c2551b16a4c44710029 | a8e7e1194b62f360775239b82af5b95d90121353 | /view/src/net/katsuster/strview/media/mkv/MKVHeaderSimpleBlock.java | 81ca646062dd0b8eda90ebdea6a28b510ba77fc1 | [
"Apache-2.0"
] | permissive | indrajithbandara/strview | 84eed905d996c6ecc1e12e5bcf6c7a899afca616 | 3a79390a941c7bc4edc05b91f0023acaf7184f58 | refs/heads/master | 2021-05-09T21:18:08.852554 | 2017-09-09T16:03:48 | 2017-10-31T16:06:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,628 | java | package net.katsuster.strview.media.mkv;
import java.util.*;
import net.katsuster.strview.util.*;
import net.katsuster.strview.media.*;
import net.katsuster.strview.media.mkv.MKVConsts.*;
/**
* <p>
* Matroska SimpleBlock タグヘッダ。
* </p>
*
* @author katsuhiro
*/
public class MKVHeaderSimpleBlock extends MKVHeader {
public EBMLvalue track_number;
public UInt timecode;
public UInt keyframe;
public UInt reserved1;
public UInt invisible;
public UInt lacing;
public UInt discardable;
//EBML lacing
public UInt lacing_head;
public EBMLvalue lacing_size0;
public ArrayList<EBMLlacing> lacing_diffs;
//Lacing の各フレームのサイズ(バイト単位)
private ArrayList<Long> lacing_sizes;
public MKVHeaderSimpleBlock() {
track_number = new EBMLvalue();
timecode = new UInt();
keyframe = new UInt();
reserved1 = new UInt();
invisible = new UInt();
lacing = new UInt();
discardable = new UInt();
lacing_head = new UInt();
lacing_size0 = new EBMLvalue();
lacing_diffs = new ArrayList<EBMLlacing>();
lacing_sizes = new ArrayList<Long>();
}
@Override
public MKVHeaderSimpleBlock clone()
throws CloneNotSupportedException {
MKVHeaderSimpleBlock obj = (MKVHeaderSimpleBlock)super.clone();
obj.track_number = track_number.clone();
obj.timecode = (UInt)timecode.clone();
obj.keyframe = (UInt)keyframe.clone();
obj.reserved1 = (UInt)reserved1.clone();
obj.invisible = (UInt)invisible.clone();
obj.lacing = (UInt)lacing.clone();
obj.discardable = (UInt)discardable.clone();
obj.lacing_head = (UInt)lacing_head.clone();
obj.lacing_size0 = lacing_size0.clone();
obj.lacing_diffs = new ArrayList<EBMLlacing>();
for (EBMLlacing v : lacing_diffs) {
obj.lacing_diffs.add(v.clone());
}
lacing_sizes = new ArrayList<Long>();
for (Long v : lacing_sizes) {
obj.lacing_sizes.add(new Long(v));
}
return obj;
}
@Override
public boolean isMaster() {
return false;
}
@Override
public void read(PacketReader<?> c) {
read(c, this);
}
public static void read(PacketReader<?> c,
MKVHeaderSimpleBlock d) {
EBMLlacing val;
long pos;
long frame_size, frame_sum;
int i;
c.enterBlock("Matroska SimpleBlock");
MKVHeader.read(c, d);
pos = c.position();
d.track_number.read(c);
d.timecode = c.readUInt(16, d.timecode );
d.keyframe = c.readUInt( 1, d.keyframe );
d.reserved1 = c.readUInt( 3, d.reserved1 );
d.invisible = c.readUInt( 1, d.invisible );
d.lacing = c.readUInt( 2, d.lacing );
d.discardable = c.readUInt( 1, d.discardable);
if (d.lacing.intValue() == LACING.EBML) {
d.lacing_head = c.readUInt( 8, d.lacing_head);
d.lacing_size0.read(c);
//最初のフレームサイズは絶対値
frame_size = d.lacing_size0.getValue();
frame_sum = frame_size;
d.lacing_sizes.add(frame_size);
for (i = 0; i < d.lacing_head.intValue() - 1; i++) {
val = new EBMLlacing();
val.read(c);
d.lacing_diffs.add(val);
//2 ~ n-1 のフレームサイズは相対値
frame_size += val.getValue();
frame_sum += frame_size;
d.lacing_sizes.add(frame_size);
}
//最後のフレームサイズはブロックサイズから計算
frame_size = (d.tag_len.getValue() - frame_sum)
- ((c.position() - pos) >> 3);
d.lacing_sizes.add(frame_size);
} else if (d.lacing.intValue() == LACING.FIXED_SIZE) {
d.lacing_head = c.readUInt( 8, d.lacing_head);
}
c.leaveBlock();
}
@Override
public void write(PacketWriter<?> c) {
write(c, this);
}
public static void write(PacketWriter<?> c,
MKVHeaderSimpleBlock d) {
int i;
c.enterBlock("Matroska SimpleBlock");
MKVHeader.write(c, d);
c.mark("track_number", "");
d.track_number.write(c);
c.writeUInt(16, d.timecode , "timecode" );
c.writeUInt( 1, d.keyframe , "keyframe" );
c.writeUInt( 3, d.reserved1 , "reserved1" );
c.writeUInt( 1, d.invisible , "invisible" );
c.writeUInt( 2, d.lacing , "lacing" , d.getLacingName());
c.writeUInt( 1, d.discardable, "discardable");
if (d.lacing.intValue() == LACING.EBML) {
c.writeUInt( 8, d.lacing_head, "lacing_head");
c.mark("lacing_size0", "");
d.lacing_size0.write(c);
for (i = 0; i < d.lacing_head.intValue() - 1; i++) {
c.mark("lacing_diffs[" + i + "]", "");
d.lacing_diffs.get(i).write(c);
}
for (i = 0; i < d.lacing_head.intValue() + 1; i++) {
c.mark("lacing_sizes[" + i + "]",
d.lacing_sizes.get(i));
}
} else if (d.lacing.intValue() == LACING.FIXED_SIZE) {
c.writeUInt( 8, d.lacing_head, "lacing_head");
}
c.leaveBlock();
}
public String getLacingName() {
return MKVConsts.getLacingName(lacing.intValue());
}
}
| [
"katsuhiro@katsuster.net"
] | katsuhiro@katsuster.net |
618a7a235b07c2776fa5686d4bbf90955a2f7c7a | 5c78244ba47e7b87dc73ec0e99c53be69e33c11e | /src/main/java/com/stephen/mongo/order/OrderDao.java | 8be1b63f310df8b0c295b323c99b064800671f58 | [] | no_license | hualiwenyu/ssh | 2b61d35368cb40c147c6d6f8e7abe7273972520b | cde20653dc6cd69924dabb332c1006653c27a9c3 | refs/heads/master | 2021-01-02T00:59:34.824029 | 2017-08-10T10:45:43 | 2017-08-10T10:45:43 | 98,948,188 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 512 | java | package com.stephen.mongo.order;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoOperations;
import org.springframework.stereotype.Component;
/**
* @author: Stephen(武海昊)
* @Date: 17/8/10.
*/
@Component
public class OrderDao {
@Autowired
private MongoOperations mongo;
public void save(Order order) {
mongo.save(order);
}
public long count() {
return mongo.getCollection("order").count();
}
}
| [
"whh43278@ly.com"
] | whh43278@ly.com |
014fc93527cdfa5bb2b242e752f80355aab4baf0 | 5150f95930d812fba5c4c910114d875bd1c85d75 | /homework4/src/homework4/SumAndAvg.java | 75e724e135312fce72e20578eb6dcebdd7fce6ad | [] | no_license | YuryNoh930508/classwork1 | 66ce9569c0ba0a64f872b112516635a95e89f0cf | 5f8e8eff4677c502a0c35267a7fb38e2bbf47213 | refs/heads/master | 2021-05-01T15:32:56.437468 | 2016-10-14T04:45:41 | 2016-10-14T04:45:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 857 | java | package homework4;
import java.util.*;
public class SumAndAvg {
double avg;
int quitFlag, sum = 0, sumCnt = 0; //exit state, total sum, total op'ed count
void init() {
do {
this.quitFlag = this.input();
} while(this.quitFlag == 0); //loop if not in exit state
print();
}
int input() {
Scanner s = new Scanner(System.in);
System.out.print("숫자를 입력(Q:종료) >> ");
if(s.hasNextInt()) {
this.sum += s.nextInt();
this.sumCnt += 1;
}
else if(s.next().equalsIgnoreCase("Q"))
return 1;
return 0;
}
void print() {
if(sumCnt > 0) { //if more than zero entries have been made
this.avg = sum/(double)sumCnt;
System.out.printf("\n 합계는 %d이고, 평균은 %.2f입니다. \n", sum, avg);
}
System.out.println("\n 프로그램3을 종료합니다. \n");
}
}
| [
"dliam123@naver.com"
] | dliam123@naver.com |
7c0f7e21ff1bbcb8314a314716b9c154d2c6f8db | ab49099ce745200649f380d297801e223883ad06 | /app/src/main/java/com/m3gv/news/common/view/xrecyclerview/AppBarStateChangeListener.java | 92b3d33a16a4dbe8d1e412e1cf423cbf1f1b5330 | [] | no_license | meikaiss/M3GVCode | 5317f147fca0db8b8c8d3b711bdca8cfe0247eee | 7d3ff721b6be840096457665edaaef663dc5c620 | refs/heads/master | 2021-01-11T12:19:23.855076 | 2017-12-20T03:05:03 | 2017-12-20T03:05:03 | 76,465,663 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,174 | java | package com.m3gv.news.common.view.xrecyclerview;
import android.support.design.widget.AppBarLayout;
/**
* Created by meikai on 16/8/15.
*/
public abstract class AppBarStateChangeListener implements AppBarLayout.OnOffsetChangedListener {
public enum State {
EXPANDED,
COLLAPSED,
IDLE
}
private State mCurrentState = State.IDLE;
@Override
public final void onOffsetChanged(AppBarLayout appBarLayout, int i) {
if (i == 0) {
if (mCurrentState != State.EXPANDED) {
onStateChanged(appBarLayout, State.EXPANDED);
}
mCurrentState = State.EXPANDED;
} else if (Math.abs(i) >= appBarLayout.getTotalScrollRange()) {
if (mCurrentState != State.COLLAPSED) {
onStateChanged(appBarLayout, State.COLLAPSED);
}
mCurrentState = State.COLLAPSED;
} else {
if (mCurrentState != State.IDLE) {
onStateChanged(appBarLayout, State.IDLE);
}
mCurrentState = State.IDLE;
}
}
public abstract void onStateChanged(AppBarLayout appBarLayout, State state);
}
| [
"meikai@mucang.cn"
] | meikai@mucang.cn |
aab46aed276e102fb91a87149ec8b308754aad55 | 5efe4dcde766f2c3fd09fbdf1a98fbdb9b973773 | /app/src/main/java/com/aiminerva/oldpeople/bean/MenuInfo.java | 882c27c323517e61c8306a8bb79056408eecf02c | [] | no_license | mapuwen123/oldpeople | 6f3019686899d0fd2e7ed4944406bd9279531579 | 3715e44eaf5fb87f830ac8a06f458840d7a98bcd | refs/heads/master | 2020-12-02T17:41:46.497156 | 2017-07-07T08:24:46 | 2017-07-07T08:24:46 | 96,413,331 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 742 | java | package com.aiminerva.oldpeople.bean;
import org.json.JSONException;
import org.json.JSONObject;
public class MenuInfo {
public int mMenuIndex;
public String mMenuTitle;
public MenuInfo() {
}
public MenuInfo(JSONObject object) throws JSONException {
if (object == null) {
return;
}
if (object.has("id")) {
mMenuIndex = object.getInt("id");
}
if (object.has("title")) {
mMenuTitle = object.getString("title");
}
}
public JSONObject objectToJson() throws JSONException {
JSONObject object = new JSONObject();
object.put("id", mMenuIndex);
object.put("title", mMenuTitle);
return object;
}
}
| [
"mapuwen@outlook.com"
] | mapuwen@outlook.com |
9df05b0def1233947596a690066a00de8d33e308 | bf3cdf268d522e4acfe1142f32036d237bfc54da | /app/src/main/java/saiyi/com/aircleanerformwz_2018_12_19/action/Action.java | 6b2b9250a2cfd4c46044bfeb9b63cf4247df1d17 | [] | no_license | WangZhouA/AirCleanerFormWZ_2018_12_19 | 80d84ffe81cf05e73706995cc6b1970fd7d1bc42 | 6d86b1e028c525965e2fd2b00a7b478486ec774f | refs/heads/master | 2020-04-29T01:38:23.464756 | 2019-03-15T02:50:16 | 2019-03-15T02:50:16 | 175,737,029 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,129 | java | package saiyi.com.aircleanerformwz_2018_12_19.action;
import com.lib.fast.common.event.EventAction;
/**
* created by siwei on 2018/11/5
*/
public class Action implements EventAction {
/**
* 添加新的设备
*/
public static final String TRANSFERLOCATIONINFORMATION="WWW.TRANSFERLOCATIONINFORMATION.COM";
public static final String CITY="WWW.CITY.COM"; // 市
public static final String DISTRICT="WWW.DISTRICT.COM"; //区
private int actionId;
private String actionIdMessage;
@Override
public int getActionId() {
return actionId;
}
@Override
public String getActionMessage() {
return actionIdMessage;
}
public void setActionId(int actionId) {
this.actionId = actionId;
}
public String getActionIdMessage() {
return actionIdMessage;
}
public void setActionIdMessage(String actionIdMessage) {
this.actionIdMessage = actionIdMessage;
}
public Action(int actionId, String actionIdMessage ) {
this.actionId = actionId;
this.actionIdMessage = actionIdMessage;
}
}
| [
"514077686@qq.com"
] | 514077686@qq.com |
6e41c94febba3ab9e2b1d27de78769bd2db8aa25 | 18b9444a4f4b4e8f3d3c9425b78ad7ee33da3479 | /src/main/java/mx/uv/servicio/soap/SoapApplication.java | 5be74fd21e8e781062a04d5f8bc56368fa3c4b92 | [] | no_license | lpanonymous/Aerolinea | d8698911969f4c0640042ed4565545f2ffb256f5 | 693757f6ac68bf7aec841c821727de4375bda66e | refs/heads/master | 2022-11-10T14:16:18.081013 | 2020-06-28T01:06:12 | 2020-06-28T01:06:12 | 249,624,428 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 450 | java | package mx.uv.servicio.soap;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@SpringBootApplication
public class SoapApplication {
public static void main(String[] args) {
SpringApplication.run(SoapApplication.class, args);
//hola mundo
}
}
| [
"lpanonymous0101@gmail.com"
] | lpanonymous0101@gmail.com |
3b092d9a5912ea3d385ba8646d96b5a0abdd4136 | d5144caaeca3385314465fbca536c0d9c6eaae26 | /app/src/test/java/aslan/ayahtaskmanager/ExampleUnitTest.java | 87ba85342beda13dc567d3d4180da601a7623a5d | [] | no_license | alsalamcse/FINAL-AYAH | dcd3c4501e3aa1d6ffc6166f4c04cafd3f0d4ec2 | e98b2fd9f9ce6ee2d37bf3418d5fa4835f754c3c | refs/heads/master | 2020-03-31T16:18:10.787890 | 2018-12-06T12:05:02 | 2018-12-06T12:05:02 | 152,369,438 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 382 | java | package aslan.ayahtaskmanager;
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);
}
} | [
"adam.awad.2000@hotmail.com"
] | adam.awad.2000@hotmail.com |
11700cb4ca06ddb06c73a498184d1540ce5dfcae | 4c978513b1912791213ade583677527a573fa648 | /src/com/worksapp/Main_2.java | 12874a8c247b1f39d0e16445233d8a63367fe0a8 | [] | no_license | xuerenlv/NewWorkMy | 0634243a1376cf3a7280bdfa71181b96100f6dd4 | c829ce7311cf3656f0134b1bdfbf186adf7fa343 | refs/heads/master | 2020-04-18T11:42:36.391954 | 2017-09-20T14:40:14 | 2017-09-20T14:40:14 | 66,996,968 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,650 | java | package com.worksapp;
import java.util.Scanner;
public class Main_2 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] arr = new int[n];
int all_xor = 0;
for (int i = 0; i < n; i++) {
arr[i] = in.nextInt();
all_xor ^= arr[i];
}
Tree tree = new Tree();
tree.add(0);// 先加 0 ,是因为可以是空集合。
int left_xor = 0, ans = 0;
for (int i = 0; i < n; i++) {
left_xor ^= arr[i];
all_xor ^= arr[i];
tree.add(left_xor); // 每次都把前缀的异或值加入到字典树中,然后查找后缀的最大异或值
ans = Math.max(ans, all_xor ^ tree.find(all_xor));
}
System.out.println(ans);
}
}
// implement one prefix tree, 在一组数中找一个数的最大异或值
class TreeNode {
TreeNode zero, one;
}
class Tree {
TreeNode root;
Tree() {
root = new TreeNode();
}
void add(int x) {
TreeNode p = root;
for (int i = 30; i >= 0; i--) {
if (((x >> i) & 1) == 1) {
if (p.one == null)
p.one = new TreeNode();
p = p.one;
} else {
if (p.zero == null)
p.zero = new TreeNode();
p = p.zero;
}
}
}
// in tree find one num, make it xor with x ,to be the largest
int find(int x) {
int res = 0;
TreeNode p = root;
for (int i = 30; i >= 0; i--) {
int count = 0;
if (((x >> i) & 1) == 1) {
if (p.zero != null) {
count = 0;
p = p.zero;
} else {
count = 1;
p = p.one;
}
} else {
if (p.one != null) {
count = 1;
p = p.one;
} else {
count = 0;
p = p.zero;
}
}
res = 2 * res + count;
}
return res;
}
} | [
"xuerenlv@gmail.com"
] | xuerenlv@gmail.com |
40daf6bd9347fc6de6ed78c1dbc23a63269e5a27 | bf7e0dd54d46beb2c41afde1afe39455c81e80c2 | /user-service/src/main/java/com/saradha/userservice/controller/UserController.java | 60871577f1ad4400f45c57319caa25764c97d652 | [] | no_license | saradha/spring-boot-micro-service-demo | 21112ba88b01a14d7bf69aaae5a21ec681ffbcdf | 4e9b83ca6efb135afac60eada3e137bc37680cd3 | refs/heads/master | 2023-05-08T08:17:56.700383 | 2021-05-03T08:47:07 | 2021-05-03T08:47:07 | 363,859,163 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 754 | java | package com.saradha.userservice.controller;
import com.saradha.userservice.entity.User;
import com.saradha.userservice.response.ResponseVO;
import com.saradha.userservice.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.websocket.server.PathParam;
@RestController
@RequestMapping("/user")
public class UserController {
@Autowired
UserService userService;
@PostMapping("/")
public User saveUser(@RequestBody User user) {
return userService.saveUser(user);
}
@GetMapping("/{id}")
public ResponseVO getUserWithDepartment(@PathVariable("id") Long id) {
return userService.getUserWithDepartment(id);
}
}
| [
"chaaruu.90@gmail.com"
] | chaaruu.90@gmail.com |
1a0a38331faf9eedc3a487f332765d3190576ebc | 5deae274fe074ff0fad9f5bd7c8c257af9d9cdd1 | /app/src/main/java/com/example/appsalud1/saludActivity.java | 7c656ebe01a838a6bd267dbf1467c5127976ec0b | [] | no_license | Nicolasvo2020/AppSalud1 | 244c4cadfa83271670b7743f7f17a8ee7947f06e | a6d124e669ea92dca0a838c65ac329b95be2e356 | refs/heads/master | 2023-04-28T19:07:56.551995 | 2021-05-14T02:15:13 | 2021-05-14T02:15:13 | 367,225,522 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,115 | java | package com.example.appsalud1;
import androidx.appcompat.app.AppCompatActivity;
import android.icu.text.UnicodeSetSpanner;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;
public class saludActivity extends AppCompatActivity {
EditText etNombre, etAltura, etPeso;
TextView txtResultado, txtResultado1;
RadioButton rbHombre, rbMujer;
Button btnCalcular, btnLimpiar;
RadioGroup rg;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_salud);
etNombre = findViewById(R.id.etNombre);
etAltura = findViewById(R.id.etAltura);
etAltura.setEnabled(false);
etPeso = findViewById(R.id.etPeso);
etPeso.setEnabled(false);
txtResultado = findViewById(R.id.txtResultado);
txtResultado1 = findViewById(R.id.txtResultado1);
rbHombre = findViewById(R.id.rbHombre);
rbMujer = findViewById(R.id.rbMujer);
btnCalcular = findViewById(R.id.btnCalcular);
btnCalcular.setEnabled(false);
btnLimpiar = findViewById(R.id.btnLimpiar);
rg = findViewById(R.id.rg);
rg.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
if (checkedId==R.id.rbHombre){
Toast.makeText(getApplicationContext(),"Elegiste hombre",Toast.LENGTH_SHORT).show();
}
else if(checkedId==R.id.rbMujer){
Toast.makeText(getApplicationContext(),"Elegiste Mujer",Toast.LENGTH_SHORT).show();
}
else {
Toast.makeText(getApplicationContext(),"No elegiste ninguna opción",Toast.LENGTH_SHORT).show();
}
btnCalcular.setEnabled(true);
}
});
btnCalcular.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Double calcular, talla, peso;
String mensaje = null;
talla = Double.parseDouble(etAltura.getText().toString());
peso = Double.parseDouble(etPeso.getText().toString());
calcular = peso / Math.pow(talla, 2);
if (calcular < 16.00 )
mensaje = String.valueOf("Peso Muy Grave");
else if (calcular < 18.99)
mensaje = String.valueOf("Peso Grave");
else if (calcular < 20.49)
mensaje = String.valueOf("Bajo Peso");
else if (calcular < 26.99)
mensaje = String.valueOf("Peso Normal");
else if (calcular < 31.99)
mensaje = String.valueOf("Sobre Peso");
else if (calcular < 36.99)
mensaje = String.valueOf("Obesidad Grado 1");
else if (calcular < 41.99)
mensaje = String.valueOf("Obesidad Grado II");
else if (calcular > 42.00)
mensaje = String.valueOf("Obesidad Grado III");
txtResultado.setText(etNombre.getText() + " Su IMC con respecto a su peso " + etPeso.getText() + " es de " + String.format("%.2f", calcular));
txtResultado1.setText("Categoria de IMC " + mensaje.toString());
}
});
btnLimpiar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
etNombre.setText("");
etAltura.setText("");
etPeso.setText("");
txtResultado.setText("");
txtResultado1.setText("");
rbHombre.setChecked(false);
rbMujer.setChecked(false);
btnCalcular.setEnabled(false);
}
});
}
} | [
"84160086+Nicolasvo2020@users.noreply.github.com"
] | 84160086+Nicolasvo2020@users.noreply.github.com |
642cbda3f4c19645f6cb0ce357f6bbb0f0e5b858 | 2fefa06f45d99a461c53a7dfcc6968918b55b90f | /com/google/android/gms/location/internal/zzb.java | 4fc38be0423f9f4373ce6ad137aee7b40879f635 | [] | no_license | javagose/Route34 | 61f57c1bef0bbafc84370221197ab3c17ddff302 | 7ea799724282a4aee30c8cf6c014f243a06e15b8 | refs/heads/master | 2021-01-12T05:41:48.414305 | 2016-12-23T22:14:49 | 2016-12-23T22:14:49 | 77,170,727 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,258 | java | package com.google.android.gms.location.internal;
import android.content.Context;
import android.os.Bundle;
import android.os.DeadObjectException;
import android.os.IBinder;
import android.os.IInterface;
import android.os.Looper;
import com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks;
import com.google.android.gms.common.api.GoogleApiClient.OnConnectionFailedListener;
import com.google.android.gms.common.internal.zzf;
import com.google.android.gms.common.internal.zzj;
import com.google.android.gms.location.internal.zzi.zza;
public class zzb extends zzj<zzi> {
private final String zzaOs;
protected final zzp<zzi> zzaOt;
/* renamed from: com.google.android.gms.location.internal.zzb.1 */
class C09081 implements zzp<zzi> {
final /* synthetic */ zzb zzaOu;
C09081(zzb com_google_android_gms_location_internal_zzb) {
this.zzaOu = com_google_android_gms_location_internal_zzb;
}
public void zzqI() {
this.zzaOu.zzqI();
}
public /* synthetic */ IInterface zzqJ() throws DeadObjectException {
return zzyM();
}
public zzi zzyM() throws DeadObjectException {
return (zzi) this.zzaOu.zzqJ();
}
}
public zzb(Context context, Looper looper, ConnectionCallbacks connectionCallbacks, OnConnectionFailedListener onConnectionFailedListener, String str, zzf com_google_android_gms_common_internal_zzf) {
super(context, looper, 23, com_google_android_gms_common_internal_zzf, connectionCallbacks, onConnectionFailedListener);
this.zzaOt = new C09081(this);
this.zzaOs = str;
}
protected /* synthetic */ IInterface zzW(IBinder iBinder) {
return zzcg(iBinder);
}
protected zzi zzcg(IBinder iBinder) {
return zza.zzcj(iBinder);
}
protected String zzgu() {
return "com.google.android.location.internal.GoogleLocationManagerService.START";
}
protected String zzgv() {
return "com.google.android.gms.location.internal.IGoogleLocationManagerService";
}
protected Bundle zzml() {
Bundle bundle = new Bundle();
bundle.putString("client_name", this.zzaOs);
return bundle;
}
}
| [
"walid benjehd"
] | walid benjehd |
19a94d387f86cccb2241a875451d6c245ea73748 | 4ef602cd041411e7d4324517a5e6e43a1df4d21a | /factory-app-api/src/main/java/com/wode/api/web/controller/AppVersionController.java | 260e0fc1826938e331370dff4f1cb984f32972e2 | [] | no_license | beijingwode/myFactory | 08d847d5c35a8900d7374227a67078a2bd0f78b8 | 43795f28318b8c9a7f37c407621134490c37d649 | refs/heads/master | 2021-05-11T00:24:22.127891 | 2018-01-26T06:39:22 | 2018-01-26T06:39:22 | 118,300,323 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,563 | java | package com.wode.api.web.controller;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.wode.common.stereotype.NoCheckLogin;
import com.wode.common.util.ActResult;
import com.wode.common.util.StringUtils;
import com.wode.factory.user.util.Constant;
/**
* 2015-6-17
*
* @author 谷子夜
*/
@Controller
@RequestMapping("/app/version")
@ResponseBody
public class AppVersionController extends BaseController {
/**
* 功能:验证密码找回/修改验证码
*
* @param request
* @param phoneNumber
* @param code
* @return
*/
@RequestMapping("getVersion")
@NoCheckLogin
public ActResult<AppVesion> getVersion(HttpServletRequest request) {
String name = request.getParameter("name");
if (StringUtils.isNullOrEmpty(name)) {
return ActResult.success(new AppVesion());
}else{
String versionCode= Constant.IOS_VERSION_CODE;
String mustUpdate=Constant.IOS_MUST_UPDATE;
String updateMsg=Constant.IOS_UPDATE_MSG;
String downloadUrl=Constant.IOS_DOWNLOAD_URL;
return ActResult.success(new AppVesion(versionCode,mustUpdate,updateMsg,downloadUrl));
}
}
class AppVesion {
private String versionCode;
private String mustUpdate;
private String updateMsg;
private String downloadUrl;
public AppVesion() {
versionCode= Constant.APP_VERSION_CODE;
mustUpdate=Constant.APP_MUST_UPDATE;
updateMsg=Constant.APP_UPDATE_MSG;
downloadUrl=Constant.APP_DOWNLOAD_URL;
}
public AppVesion(String versionCode, String mustUpdate, String updateMsg, String downloadUrl) {
super();
this.versionCode = versionCode;
this.mustUpdate = mustUpdate;
this.updateMsg = updateMsg;
this.downloadUrl = downloadUrl;
}
public String getVersionCode() {
return versionCode;
}
public void setVersionCode(String versionCode) {
this.versionCode = versionCode;
}
public String getMustUpdate() {
return mustUpdate;
}
public void setMustUpdate(String mustUpdate) {
this.mustUpdate = mustUpdate;
}
public String getUpdateMsg() {
return updateMsg;
}
public void setUpdateMsg(String updateMsg) {
this.updateMsg = updateMsg;
}
public String getDownloadUrl() {
return downloadUrl;
}
public void setDownloadUrl(String downloadUrl) {
this.downloadUrl = downloadUrl;
}
}
}
| [
"gyj@wo-de.com"
] | gyj@wo-de.com |
100c4800f89e130f7f7d204de0dfbe6c9fbd4beb | 4a998460daa7728e896d0cfa0c21c100cde9e555 | /src/main/java/com/onpaging/bean/Lunch.java | e230cd418f39ef8030867d712e16c2594314f2ec | [] | no_license | hairgely/page700 | e883630a9be68850fe4239f9d7860c24eedf40a4 | 4940cd345bc2e00cc30fd0297457269adc3e96ed | refs/heads/master | 2021-01-13T02:53:41.381310 | 2016-12-26T00:32:33 | 2016-12-26T00:32:33 | 77,096,152 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,991 | java | package com.onpaging.bean;
public class Lunch {
private String lnum;
private String unum;
private String lname;
private String ldate;
private String lpay;
private String ltype; // 점심, 저녁
private String lplace; // 장소
private String lat; //위도
private String lon; //경도
private String lmemo; //메모
private String lrate; //평점
private String lphoto; //사진
private String createTime;
private String rtype;
public String getLnum() {
return lnum;
}
public void setLnum(String lnum) {
this.lnum = lnum;
}
public String getLname() {
return lname;
}
public void setLname(String lname) {
this.lname = lname;
}
public String getLdate() {
return ldate;
}
public void setLdate(String ldate) {
this.ldate = ldate;
}
public String getLpay() {
return lpay;
}
public void setLpay(String lpay) {
this.lpay = lpay;
}
public String getLtype() {
return ltype;
}
public void setLtype(String ltype) {
this.ltype = ltype;
}
public String getLplace() {
return lplace;
}
public void setLplace(String lplace) {
this.lplace = lplace;
}
public String getLat() {
return lat;
}
public void setLat(String lat) {
this.lat = lat;
}
public String getLon() {
return lon;
}
public void setLon(String lon) {
this.lon = lon;
}
public String getLmemo() {
return lmemo;
}
public void setLmemo(String lmemo) {
this.lmemo = lmemo;
}
public String getLrate() {
return lrate;
}
public void setLrate(String lrate) {
this.lrate = lrate;
}
public String getLphoto() {
return lphoto;
}
public void setLphoto(String lphoto) {
this.lphoto = lphoto;
}
public String getUnum() {
return unum;
}
public void setUnum(String unum) {
this.unum = unum;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public String getRtype() {
return rtype;
}
public void setRtype(String rtype) {
this.rtype = rtype;
}
}
| [
"hairgely@gmail.com"
] | hairgely@gmail.com |
596803c8872acea488ca3f2efed571fc6ae6aeb7 | 6d4d52a85ae98ce439962c57558b219fd4272237 | /src/main/java/space.edhits.edtrust/ListServiceController.java | d766c81a5155467ad90f1946f3ccb56e52511a0d | [] | no_license | inorton/EDTrust | 62b9c2615e2fa7a250e4d58ad8460129a09025f6 | f0d91e05974e6da9e2e085625ba7cc79f086312c | refs/heads/master | 2021-01-22T21:17:24.615337 | 2018-02-21T21:55:31 | 2018-02-21T21:55:31 | 100,678,964 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,031 | java | package space.edhits.edtrust;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
/**
* REST Controller for list check/submit API
*/
@RestController
@RequestMapping(value = Constants.TRUST_SERVICE_BASE)
public class ListServiceController {
final UserApiContextFactory contextFactory;
public ListServiceController(@Autowired UserApiContextFactory contextFactory) {
this.contextFactory = contextFactory;
}
@RequestMapping(value = "/check", method = RequestMethod.POST)
public ResponseEntity<ContactResponse> check(@RequestHeader(value = "apikey", required = true) String apikey,
@RequestBody ContactRequest contactRequest) throws UnknownUser, UnknownList {
UserApiContext user = contextFactory.getUser(apikey);
ContactResponse check = user.check(contactRequest.getCmdr());
return ResponseEntity.ok(check);
}
}
| [
"inorton@gmail.com"
] | inorton@gmail.com |
ae9784a634cd751929aa62e0da50bc0672e81b95 | 0469258f01dfc2891f26f7c3397742594e51a465 | /retrofit_rxjava_demo/src/main/java/com/technohack/retrofit_rxjava_demo/PostAdapter.java | d5e966672b04c40544f96455b6db261dfa480ff8 | [] | no_license | harsh6768/Rx_Java_Demo | d861c2f97260429daf6c2edb0a74f121aec61787 | 753e91f90e8286bf65241085502a38bc020c7d0b | refs/heads/master | 2020-04-19T11:14:06.747466 | 2019-01-31T05:51:24 | 2019-01-31T05:51:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,796 | java | package com.technohack.retrofit_rxjava_demo;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.technohack.retrofit_rxjava_demo.model.PostModel;
import java.util.List;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
public class PostAdapter extends RecyclerView.Adapter<PostAdapter.MyViewHolder> {
Context context ;
List<PostModel> postModelList;
public PostAdapter(Context context, List<PostModel> postModelList) {
this.context = context;
this.postModelList = postModelList;
}
@NonNull
@Override
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view= LayoutInflater.from(context).inflate(R.layout.post_list_item,parent,false);
return new MyViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
holder.postAuthor.setText(String.valueOf(postModelList.get(position).getUserId()));
holder.postTitle.setText(postModelList.get(position).getTitle());
holder.postContent.setText(postModelList.get(position).getBody().substring(0,30));
}
@Override
public int getItemCount() {
return postModelList.size();
}
public class MyViewHolder extends RecyclerView.ViewHolder {
TextView postTitle,postAuthor,postContent;
public MyViewHolder(@NonNull View itemView) {
super(itemView);
postAuthor=itemView.findViewById(R.id.post_authodId);
postTitle=itemView.findViewById(R.id.post_titleId);
postContent=itemView.findViewById(R.id.post_contentId);
}
}
}
| [
"harshchaurasiya6768@gmail.com"
] | harshchaurasiya6768@gmail.com |
62a0d4bd050d67b42d50fa87971c9f588deb2d75 | 0ba871fd58208eab91bdd28f20e20590931ae32a | /src/main/java/de/sfiss/tt/ui/jsf/base/AbstractEntityDetailViewBean.java | b2b91cb92efa47dde58044874a6a8abc09b6d29b | [] | no_license | sfiss/TravelTracker | f2a0be2975992a48808f48dbe7f2d0e288bd9e14 | 01dd370bf411eeb4416160805a7746e178c69099 | refs/heads/master | 2021-01-01T06:32:12.274593 | 2014-05-28T14:43:59 | 2014-05-28T14:43:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 457 | java | package de.sfiss.tt.ui.jsf.base;
import de.sfiss.tt.model.EntityBase;
@SuppressWarnings("serial")
public abstract class AbstractEntityDetailViewBean<E extends EntityBase>
implements EntityDetailView<E> {
protected String parentView;
@Override
public String back() {
return parentView;
}
@Override
public void update(String parentView, E entity) {
this.parentView = parentView;
update(entity);
}
public abstract void update(E entity);
}
| [
"sebastian.fiss@googlemail.com"
] | sebastian.fiss@googlemail.com |
b26048d76f7c2362185b14d2aaa9260362a034ad | 7b9a806ccb4e9b3794f17d736e0e65b7ceb4e12b | /cloudalibaba-consumer-nacos-order84/src/main/java/com/yangluyao/springcloud/config/ApplicationContextConfig.java | c32f467d7d68f17d0e3e920c10265fa65ff4de47 | [] | no_license | csdnjavaWjy/springcloud2020 | 8d9efb227b121d462a0f3839f7ba235a3007a558 | 3d5684625f3f69457bd3caab5b21c282795d6be0 | refs/heads/master | 2022-12-29T16:59:34.045847 | 2020-04-27T06:17:40 | 2020-04-27T06:17:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 545 | java | package com.yangluyao.springcloud.config;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
/**
* @author YLY
* @ClassName ApplicationContextConfig
* @Date 2020/4/22
* @Version 1.0.1
*/
@Configuration
public class ApplicationContextConfig {
@Bean
@LoadBalanced
public RestTemplate getRestTemplate(){
return new RestTemplate();
}
}
| [
"815090488@qq.com"
] | 815090488@qq.com |
8bd4b864f3003d22ce8b80668040c8f6ca2b6eaa | 9246cba6fdd6000d3656b5158e750252b2eb3331 | /Java Fundamentals/Arrays/Solution6.java | ae54a0b0f541544f4fa4d530c319dba2f8a2642b | [] | no_license | HarshPaliwal/WiproTraining-PBL | 91eb5b435a98f680667e594abe2620b3aa57e9ef | 1d9cb1363f713c16edbecc0d1859c1f6f20bbe51 | refs/heads/master | 2022-11-25T17:37:53.278482 | 2020-07-18T05:48:22 | 2020-07-18T05:48:22 | 275,021,277 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 662 | java | import java.util.Scanner;
class Solution6{
public static void sort(int[] arr,int size){
for(int i=1;i<size;++i){
int key=arr[i];
int j=i-1;
while(j>=0 && arr[j]>key){
arr[j+1]=arr[j];
j--;
}
arr[j+1]=key;
}
}
public static void main(String[] args){
Scanner scan=new Scanner(System.in);
System.out.print("Enter Size of array : ");
int size=scan.nextInt();
int[] arr=new int[size];
System.out.print("Enter integers : ");
for(int itr=0;itr<size;itr++){
arr[itr]=scan.nextInt();
}
scan.close();
sort(arr,size);
for(int itr=0;itr<size;itr++){
System.out.print(arr[itr]+" ");
}
}
} | [
"noreply@github.com"
] | noreply@github.com |
2b38c1876ae7677814c312cc9f32a76b3bd3d9ca | 00a1bf43cda164cea7cb46d7b19666e3847374c9 | /src/servlet/ShowWishlist.java | 2fe071d14cc21634510dcc3550280f719fd3d2c9 | [] | no_license | GB1609/SIW | d13cd1a43ae046119bdd150fa8290174a239d6f7 | 77730f5f562088c9535224afbe4ca0757839a993 | refs/heads/master | 2020-04-06T06:59:54.319276 | 2016-09-02T09:16:13 | 2016-09-02T09:16:13 | 62,718,239 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,351 | java | package servlet;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.google.gson.Gson;
import core.DaoFactory;
import dao.WishListDao;
@WebServlet("/ShowWishlistServlet")
public class ShowWishlist extends HttpServlet {
private static final long serialVersionUID = 1L;
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
doPost(req, resp);
}
@Override
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html");
response.getWriter();
String owner = request.getParameter("owner");
DaoFactory dao = DaoFactory.getDAOFactory(DaoFactory.POSTGRESQL);
WishListDao wld = dao.getWishListDao();
List<String> list = new ArrayList<>();
list = wld.searchByOwner(owner);
String gson;
if (!list.isEmpty())
gson = new Gson().toJson(list);
else
gson = new Gson().toJson("EMPTY");
response.setContentType("application/json");
response.getWriter().write(gson);
}
}
| [
"Andrea@PC-Andrew"
] | Andrea@PC-Andrew |
07eade47d64c4da3b690bf8e92ab1f73987cbdd2 | 7809fcf5e1e91658ff3738606811f6b16293c203 | /src/main/java/com/shaw/lucene/DmhyDataIndex.java | 97c3b866e52f61b33893d795e92ddf680d87f9eb | [] | no_license | imn5100/autoDanime | 47d924b83af8c5bbb7e5d54a7d40ceed10241b7a | e473517cfdc6eafc92110a43a3124c470a700342 | refs/heads/master | 2020-05-21T20:46:37.573564 | 2016-11-01T06:30:30 | 2016-11-01T06:30:30 | 63,234,539 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,671 | java | package com.shaw.lucene;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.cn.smart.SmartChineseAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.document.LongField;
import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.DocValuesType;
import org.apache.lucene.index.IndexOptions;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.Term;
import org.apache.lucene.queryparser.classic.QueryParser;
import org.apache.lucene.search.BooleanClause;
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.ScoreDoc;
import org.apache.lucene.search.Sort;
import org.apache.lucene.search.SortField;
import org.apache.lucene.search.SortField.Type;
import org.apache.lucene.search.TopDocs;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.FSDirectory;
import com.alibaba.fastjson.JSONObject;
import com.shaw.bo.DmhyData;
import com.shaw.utils.TimeUtils;
//更删lucene 索引的操作已移至 搜索中心。废弃此工具类
@Deprecated
public class DmhyDataIndex {
public static final String DEFAULT_PATH = "/lucene/anime";
private Directory dir;
private Analyzer analyzer;
public DmhyDataIndex(Analyzer analyzer, String path) throws Exception {
if (analyzer == null) {
this.analyzer = new SmartChineseAnalyzer();
} else {
this.analyzer = analyzer;
}
if (StringUtils.isNotBlank(path)) {
this.dir = FSDirectory.open(Paths.get(path));
} else {
this.dir = FSDirectory.open(Paths.get(DEFAULT_PATH));
}
}
public DmhyDataIndex() throws Exception {
this.analyzer = new SmartChineseAnalyzer();
this.dir = FSDirectory.open(Paths.get(DEFAULT_PATH));
}
public IndexWriter getWriter() throws Exception {
IndexWriterConfig config = new IndexWriterConfig(analyzer);
return new IndexWriter(dir, config);
}
public IndexReader getReader() throws Exception {
return DirectoryReader.open(dir);
}
/**
* Indexed, not tokenized, omits norms, indexes none, stored.
*/
public static final FieldType TYPE_NOT_INDEX_STORED = new FieldType();
public static final FieldType TIME_TYPE = new FieldType();
static {
TYPE_NOT_INDEX_STORED.setOmitNorms(true);
TYPE_NOT_INDEX_STORED.setIndexOptions(IndexOptions.NONE);
TYPE_NOT_INDEX_STORED.setTokenized(false);
TYPE_NOT_INDEX_STORED.setStored(true);
TYPE_NOT_INDEX_STORED.freeze();
TIME_TYPE.setTokenized(true);
TIME_TYPE.setOmitNorms(true);
TIME_TYPE.setStored(false);
TIME_TYPE.setIndexOptions(IndexOptions.DOCS);
TIME_TYPE.setNumericType(FieldType.NumericType.LONG);
TIME_TYPE.setDocValuesType(DocValuesType.NUMERIC);
TIME_TYPE.freeze();
}
/**
* 依据具体需求,判断字段是否需要索引或存储。 很多字段可以只索引不存储 title classi 用于搜索 索引建立。 time 用于关联时间排序。
**/
public void addIndex(DmhyData data) throws Exception {
IndexWriter writer = getWriter();
try {
Document doc = new Document();
// 索引字段
doc.add(new TextField("title", data.getTitle(), Field.Store.NO));
doc.add(new LongField("time", TimeUtils.formatDate(data.getTime(), "yyyy/MM/dd HH:mm").getTime(),
TIME_TYPE));
doc.add(new StringField("id", data.getId().toString(), Field.Store.YES));
// 存储,但是不做索引
String luceneData = JSONObject.toJSONString(data);
doc.add(new Field("data", luceneData, TYPE_NOT_INDEX_STORED));
writer.addDocument(doc);
} finally {
writer.close();
}
}
public void addIndexList(List<DmhyData> dataList) throws Exception {
IndexWriter writer = getWriter();
try {
for (DmhyData data : dataList) {
Document doc = new Document();
// 索引字段
doc.add(new TextField("title", data.getTitle(), Field.Store.NO));
doc.add(new LongField("time", TimeUtils.formatDate(data.getTime(), "yyyy/MM/dd HH:mm").getTime(),
TIME_TYPE));
doc.add(new StringField("id", data.getId().toString(), Field.Store.YES));
// 存储,但是不做索引
String luceneData = JSONObject.toJSONString(data);
doc.add(new Field("data", luceneData, TYPE_NOT_INDEX_STORED));
writer.addDocument(doc);
}
} finally {
writer.close();
}
}
public List<DmhyData> searchAnime(String keyword) throws Exception {
IndexReader reader = getReader();
IndexSearcher searcher = new IndexSearcher(reader);
QueryParser titleParser = new QueryParser("title", this.analyzer);
Query titleQuery = titleParser.parse(keyword);
BooleanQuery.Builder builder = new BooleanQuery.Builder();
builder.add(titleQuery, BooleanClause.Occur.SHOULD);
// 按时间和 title 关联度排序 关联度优先
Sort sort = new Sort(new SortField("title", SortField.Type.SCORE), new SortField("time", Type.LONG, true));
TopDocs hits = searcher.search(builder.build(), 10, sort);
List<DmhyData> datas = new ArrayList<DmhyData>();
for (ScoreDoc scoreDoc : hits.scoreDocs) {
Document doc = searcher.doc(scoreDoc.doc);
String dataStr = doc.get("data");
DmhyData dmhyData = JSONObject.parseObject(dataStr, DmhyData.class);
datas.add(dmhyData);
}
return datas;
}
public void updateIndex(DmhyData data) throws Exception {
IndexWriter writer = getWriter();
try {
Document doc = new Document();
// 索引字段 title 用于搜索 ,time 用于搜索排序,id用于维护索引
doc.add(new TextField("title", data.getTitle(), Field.Store.NO));
doc.add(new LongField("time", TimeUtils.formatDate(data.getTime(), "yyyy/MM/dd HH:mm").getTime(),
TIME_TYPE));
doc.add(new StringField("id", data.getId().toString(), Field.Store.YES));
// 存储,但是不做索引
String luceneData = JSONObject.toJSONString(data);
doc.add(new Field("data", luceneData, TYPE_NOT_INDEX_STORED));
writer.updateDocument(new Term("id", data.getId().toString()), doc);
} finally {
writer.close();
}
}
public void updateIndexList(List<DmhyData> dataList) throws Exception {
IndexWriter writer = getWriter();
try {
for (DmhyData data : dataList) {
Document doc = new Document();
// 索引字段
doc.add(new TextField("title", data.getTitle(), Field.Store.NO));
doc.add(new LongField("time", TimeUtils.formatDate(data.getTime(), "yyyy/MM/dd HH:mm").getTime(),
TIME_TYPE));
doc.add(new StringField("id", data.getId().toString(), Field.Store.YES));
// 存储,但是不做索引
String luceneData = JSONObject.toJSONString(data);
doc.add(new Field("data", luceneData, TYPE_NOT_INDEX_STORED));
writer.updateDocument(new Term("id", data.getId().toString()), doc);
}
} finally {
writer.close();
}
}
public void deleteIndex(String id) throws Exception {
IndexWriter writer = getWriter();
try {
writer.deleteDocuments(new Term("id", id));
writer.forceMergeDeletes();
writer.commit();
} finally {
writer.close();
}
}
public void batchDeleteIndex(List<String> ids) throws Exception {
IndexWriter writer = getWriter();
try {
for (String id : ids) {
writer.deleteDocuments(new Term("id", id));
writer.forceMergeDeletes();
}
writer.commit();
} finally {
writer.close();
}
}
}
| [
"tuanzi@2dfire.com"
] | tuanzi@2dfire.com |
dc8d53ebb647be7dc6263b8804aa59735d2d0363 | 520b64fe9df60cf48747c63b4e7feb967ca1c66b | /src/main/java/models/goals/GoalsReachesBySearchPhrase.java | 1b8bfd88d3661fcf21a4e779ee9906ee1ce1dcd5 | [] | no_license | Sergey271195/metrika_hibernate | 95bb217b8768af5045de3bca35101514253f5daa | 15ba7b5cb04fcbec9d39fa9579eb3e2272845a4d | refs/heads/main | 2023-02-14T21:11:05.769146 | 2021-01-08T13:11:42 | 2021-01-08T13:11:42 | 326,507,153 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,603 | java | package models.goals;
import models.Goal;
import models.sources.SearchPhrase;
import models.Webpage;
import javax.persistence.*;
import java.time.LocalDate;
@Entity
@Table(
name = "goalssearchphrase",
uniqueConstraints = {@UniqueConstraint(columnNames = {"goal_id", "phrase_id", "date"})}
)
public class GoalsReachesBySearchPhrase {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
private LocalDate date;
private double reaches;
@ManyToOne
@JoinColumn(name = "goal_id")
private Goal goal;
@ManyToOne
@JoinColumn(name = "phrase_id")
private SearchPhrase searchPhrase;
@ManyToOne
@JoinColumn(name = "webpage_id")
private Webpage webpage;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public LocalDate getDate() {
return date;
}
public void setDate(LocalDate date) {
this.date = date;
}
public double getReaches() {
return reaches;
}
public void setReaches(double reaches) {
this.reaches = reaches;
}
public Goal getGoal() {
return goal;
}
public void setGoal(Goal goal) {
this.goal = goal;
}
public SearchPhrase getSearchPhrase() {
return searchPhrase;
}
public void setSearchPhrase(SearchPhrase searchPhrase) {
this.searchPhrase = searchPhrase;
}
public Webpage getWebpage() {
return webpage;
}
public void setWebpage(Webpage webpage) {
this.webpage = webpage;
}
}
| [
"mackovckin.sergei@yandex.ru"
] | mackovckin.sergei@yandex.ru |
82867ab61eccff65cfe564e53b1fce7d3c182cf7 | 4c19b724f95682ed21a82ab09b05556b5beea63c | /XMSYGame/java2/server/zxyy-webhome/src/main/java/com/xmsy/server/zxyy/webhome/modules/manager/gamerecordbairensangong/service/GameRecordBairensangongService.java | 9d047c0a2722a03d8c580983fe77c12e9849bd98 | [] | no_license | angel-like/angel | a66f8fda992fba01b81c128dd52b97c67f1ef027 | 3f7d79a61dc44a9c4547a60ab8648bc390c0f01e | refs/heads/master | 2023-03-11T03:14:49.059036 | 2022-11-17T11:35:37 | 2022-11-17T11:35:37 | 222,582,930 | 3 | 5 | null | 2023-02-22T05:29:45 | 2019-11-19T01:41:25 | JavaScript | UTF-8 | Java | false | false | 730 | java | package com.xmsy.server.zxyy.webhome.modules.manager.gamerecordbairensangong.service;
import com.baomidou.mybatisplus.service.IService;
import com.xmsy.server.zxyy.webhome.modules.app.gamerecord.param.sangong.BairenSanGongGameRecordParams;
import com.xmsy.server.zxyy.webhome.modules.manager.gamerecordbairensangong.entity.GameRecordBairensangongEntity;
/**
* 游戏记录-百人三公
*
* @author xiaoling
* @email xxxxx
* @date 2019-09-04 16:58:30
*/
public interface GameRecordBairensangongService extends IService<GameRecordBairensangongEntity> {
/**
* 保存百人三公游戏记录
*
* @param gameRecordParams
*/
void appSaveGameRecord(BairenSanGongGameRecordParams bairenSanGongGameRecordParams);
}
| [
"163@qq.com"
] | 163@qq.com |
63e8edd0439d115e041b82dc18c9460c1ea69e70 | a88c2bf624f2b4ac29e5460a705ba2f0ccf9376b | /src/com/hr/entity/EASYBUY_USER.java | 4b5bcfb51b9c4c0f8321832ba91a3e3556552a3a | [] | no_license | ENotFoundException/FlowerShop | b6235112f9f0985c3b5b60a5aca837f10bdc55db | edd4dbfcdc44b1ad7cd8011eeda7825a93f6252e | refs/heads/master | 2022-12-10T03:00:40.851918 | 2020-09-07T07:58:36 | 2020-09-07T07:58:36 | 293,410,296 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,158 | java | package com.hr.entity;
//用户
public class EASYBUY_USER {
private String EU_USER_ID;
private String EU_USER_NAME;
private String EU_PASSWORD;
private String EU_SEX;
private String EU_BIRTHDAY;
private String EU_IDENTITY_CODE;
private String EU_EMAIL;
private String EU_MOBILE;
private String EU_ADDRESS;
private int EU_STATUS;
public EASYBUY_USER(String eUUSERID, String eUUSERNAME, String eUPASSWORD,
String eUSEX, String eUBIRTHDAY, String eUIDENTITYCODE,
String eUEMAIL, String eUMOBILE, String eUADDRESS, int eUSTATUS) {
//super();
EU_USER_ID = eUUSERID;
EU_USER_NAME = eUUSERNAME;
EU_PASSWORD = eUPASSWORD;
EU_SEX = eUSEX;
EU_BIRTHDAY = eUBIRTHDAY;
EU_IDENTITY_CODE = eUIDENTITYCODE;
EU_EMAIL = eUEMAIL;
EU_MOBILE = eUMOBILE;
EU_ADDRESS = eUADDRESS;
EU_STATUS = eUSTATUS;
}
public String getEU_USER_ID() {
return EU_USER_ID;
}
public void setEU_USER_ID(String eUUSERID) {
EU_USER_ID = eUUSERID;
}
public String getEU_USER_NAME() {
return EU_USER_NAME;
}
public void setEU_USER_NAME(String eUUSERNAME) {
EU_USER_NAME = eUUSERNAME;
}
public String getEU_PASSWORD() {
return EU_PASSWORD;
}
public void setEU_PASSWORD(String eUPASSWORD) {
EU_PASSWORD = eUPASSWORD;
}
public String getEU_SEX() {
return EU_SEX;
}
public void setEU_SEX(String eUSEX) {
EU_SEX = eUSEX;
}
public String getEU_BIRTHDAY() {
return EU_BIRTHDAY;
}
public void setEU_BIRTHDAY(String eUBIRTHDAY) {
EU_BIRTHDAY = eUBIRTHDAY;
}
public String getEU_IDENTITY_CODE() {
return EU_IDENTITY_CODE;
}
public void setEU_IDENTITY_CODE(String eUIDENTITYCODE) {
EU_IDENTITY_CODE = eUIDENTITYCODE;
}
public String getEU_EMAIL() {
return EU_EMAIL;
}
public void setEU_EMAIL(String eUEMAIL) {
EU_EMAIL = eUEMAIL;
}
public String getEU_MOBILE() {
return EU_MOBILE;
}
public void setEU_MOBILE(String eUMOBILE) {
EU_MOBILE = eUMOBILE;
}
public String getEU_ADDRESS() {
return EU_ADDRESS;
}
public void setEU_ADDRESS(String eUADDRESS) {
EU_ADDRESS = eUADDRESS;
}
public int getEU_STATUS() {
return EU_STATUS;
}
public void setEU_STATUS(int eUSTATUS) {
EU_STATUS = eUSTATUS;
}
}
| [
"wangzj_root@163.com"
] | wangzj_root@163.com |
bd45309e5e461a6f09df631883db7d89cfbe5118 | d67e34a2bc691f3fb8eec9489a21149d8f058ecc | /Daily3/app/src/main/java/com/trevorpc/week1daily3_translations/MainActivity.java | 1f94fb0ded62b3f9078a49fa957dc1a69a6bde14 | [] | no_license | TrevorJPrescott/Test1 | aceac411a5e5455992195355b778e1873a7bc4ae | f7ceb612e9dd63660d8536de32d7dfc2178b351c | refs/heads/master | 2020-04-07T01:05:56.682912 | 2018-11-16T22:56:00 | 2018-11-16T22:56:00 | 157,930,358 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 350 | java | package com.trevorpc.week1daily3_translations;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
| [
"prescotttj93@gmail.com"
] | prescotttj93@gmail.com |
94aba340b3bcfa6a178fc665a4fc8bc76fd91bcc | 7e7c749228d0fddd2c417fd14866b87d330dd916 | /School/Data Structures/Hashing/src/HashTable.java | 618ac15542e3ee5f92dab563bfa905e397797900 | [] | no_license | victorkwak/Projects | f8d838dc3219d41a0e874c82c774e305b18a1824 | 646fdf06a37e865b32400f122b02e65fa5b5312f | refs/heads/master | 2020-05-16T05:50:33.325038 | 2015-03-03T10:37:40 | 2015-03-03T10:37:40 | 19,307,237 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,662 | java | import java.io.*;
import java.text.DecimalFormat;
import java.util.Scanner;
/**
* Victor Kwak
* CS240
* Hashing
* The program will read files from a directory and organize the data into a hash table.
* The table is searchable by name (athlete) and will return their average score.
* July 14, 2014
*/
public class HashTable {
private static Entry[] scores = new Entry[50];
private static int tableSize = 0;
private static int collisions = 0;
/**
* Entries to put into the hash table
*/
static class Entry {
Entry next;
String key;
float value;
int occurrence = 1;
Entry(String key, float value) {
next = null;
this.key = key;
this.value = value;
}
/**
* @return average score for the entry.
*/
float averageScore() {
return value / occurrence;
}
/**
* @return a string containing the average score and the number of times a score for this entry was inputted.
*/
public String toString() {
DecimalFormat decimalFormat = new DecimalFormat("##0.000");
return "\t" + key + ": " + "Avg: " + String.valueOf(decimalFormat.format(averageScore()))
+ "\t # Scores: " + occurrence;
}
}
/**
* Takes a filename and and calls the "put" method for each line in the file.
*
* @param filename name of file to be read
*/
public static void readFile(File filename) {
try {
BufferedReader bufferedReader = new BufferedReader(new FileReader(filename));
String currentLine;
while ((currentLine = bufferedReader.readLine()) != null) {
if (!currentLine.isEmpty()) {
put(currentLine);
}
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* Takes a string and parses the key (name) and value (score) from the line.
*
* @param currentLine string to be parsed
*/
public static void put(String currentLine) {
String key = "";
float value;
String[] format = currentLine.split("\\s+"); // Split current line by whitespace
// Parsing information in the array
if (format[format.length - 1].matches("\\d+([.]\\d*)?")) { // Checking if last word of the line is a number
for (int i = 0; i < format.length - 1; i++) {
key += format[i];
if (i != format.length - 2) {
key += " ";
}
}
value = Float.parseFloat(format[format.length - 1]);
} else {
return;
}
// Inputting into hash table
int hashValue = hash(key);
if (scores[hashValue] == null) { // nothing in location
scores[hashValue] = new Entry(key, value);
tableSize++;
} else {
Entry current = scores[hashValue];
while (current != null) {
if (current.key.equals(key)) { // same value inside entry
current.value = current.value + value;
current.occurrence++;
return;
} else {
if (current.next == null) { // different value inside entry
current.next = new Entry(key, value);
tableSize++;
collisions++;
return;
}
}
current = current.next;
}
}
}
/**
* @param key String to be hashed
* @return hash value for the string argument
*/
public static int hash(String key) {
int hashValue = compression(hashCode(key));
if (hashValue < 0) {
hashValue = -hashValue;
}
return hashValue;
}
/**
* @param s String to generate hash code using polynomial method
* @return hash code
*/
public static int hashCode(String s) {
int hash = 0;
for (int i = 0; i < s.length(); i++) {
hash = 31 * hash + s.charAt(i);
}
return hash;
}
/**
*
* @param hashCode integer to be changed so that it can act as an index value in the hash table
* @return hash value for the entry
*/
public static int compression(int hashCode) {
return hashCode % (scores.length - 1);
}
/**
* Prints out the minimum and maximum averages for the data set
*/
public static void averages() {
float minAverage = 200;
float maxAverage = 0;
String minNames = "";
String maxNames = "";
for (Entry e : scores) {
if (e != null) {
if (e.next == null) {
if (e.averageScore() < minAverage) {
minAverage = e.averageScore();
minNames = "\t" + e.key;
} else if (e.averageScore() > maxAverage) {
maxAverage = e.averageScore();
maxNames = "\t" + e.key;
} else if (e.averageScore() == minAverage) {
minNames = minNames + "\n\t" + e.key;
} else if (e.averageScore() == maxAverage) {
maxNames = maxNames + "\n\t" + e.key;
}
} else {
Entry current = e.next;
while (current != null) {
if (current.averageScore() < minAverage) {
minAverage = current.averageScore();
minNames = "\t" + current.key;
} else if (current.averageScore() > maxAverage) {
maxAverage = current.averageScore();
maxNames = "\t" + current.key;
} else if (current.averageScore() == minAverage) {
minNames = minNames + "\n\t" + current.key;
} else if (current.averageScore() == maxAverage) {
maxNames = maxNames + "\n\t" + current.key;
}
current = current.next;
}
}
}
}
DecimalFormat decimalFormat = new DecimalFormat("##0.000");
System.out.println("Minimum average: " + decimalFormat.format(minAverage));
System.out.println(minNames);
System.out.println("Maximum average: " + decimalFormat.format(maxAverage));
System.out.println(maxNames);
}
/**
* Used when user searches for a string. Prints out the contents of an entry if there is a match.
* @param name string to search for
*/
public static void get(String name) {
Entry entry = scores[hash(name)];
if (entry == null) {
System.out.println(name + " not found.");
return;
} else {
while (entry != null) {
if (entry.key.equals(name)) {
System.out.println(entry);
return;
}
entry = entry.next;
}
}
System.out.println(name + " not found");
}
/**
* Displays information about the current hash table and takes the user's input. User can either enter what they
* want to search for or input "exit" to exit the program.
*/
public static void menu() {
System.out.println("# of collisions: " + collisions);
System.out.println("Size of table: " + tableSize);
System.out.println("");
System.out.println("# of names: " + tableSize);
averages();
System.out.println("");
Scanner scanner = new Scanner(System.in);
String name = "";
while (!name.equalsIgnoreCase("exit")) {
System.out.print("Name: ");
name = scanner.nextLine().trim();
if (!name.equalsIgnoreCase("exit")) {
get(name);
}
}
}
public static void main(String[] args) {
if (args.length < 1) {
System.out.println("Directory isn't there.");
System.exit(1);
}
File directory = new File(args[0]);
File[] files = directory.listFiles();
for (File e : files) {
readFile(e);
}
menu();
}
}
| [
"victorkwak@gmail.com"
] | victorkwak@gmail.com |
0f9bffc208818302ffeeb31ba15e3d225e822b1b | db277c17bccdc5a974e03a415410159c64c34178 | /src/com/kddb/DetailKhutbahJumatIng4.java | f7c029b8ce64a72c6768d90cbbedcf4038f4faae | [] | no_license | ikbarrame/UAS | c5ac9728978baebff28e65a64322efcfa1072c16 | 90a813de6dbf698cedb8877feb55740b0350f970 | refs/heads/master | 2020-12-24T16:07:54.104700 | 2014-12-22T01:28:20 | 2014-12-22T01:28:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,551 | java | package com.kddb;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import android.app.Activity;
import android.content.res.Resources;
import android.os.Bundle;
import android.webkit.WebView;
public class DetailKhutbahJumatIng4 extends Activity{
WebView webview;
@Override
public void onCreate(Bundle bundle){
super.onCreate(bundle);
setContentView(R.layout.webwiew);
webview = (WebView) findViewById(R.id.webView1);
String content = ambilResource(getResources(),R.raw.mother);
String mimeType = "text/html";
String encoding = "UTF-8";
//webview.loadUrl("file:///android_asset/info.html");
//webview.loadData(content, mimeType, encoding);
webview.loadDataWithBaseURL("file:///android_asset", content, mimeType, encoding, null);
}
public static String ambilResource(Resources resources, int resId) {
InputStream rawResource = resources.openRawResource(resId);
String content = ubahKeString(rawResource);
try {rawResource.close();} catch (IOException e) {}
return content;
}
private static String ubahKeString(InputStream in) {
String l;
BufferedReader r = new BufferedReader(new InputStreamReader(in));
StringBuilder s = new StringBuilder();
try {
while ((l = r.readLine()) != null) {
s.append(l + "\n");
}
} catch (IOException e) {}
return s.toString();
}
public void onBackPressed(){
finish();
System.exit(0);
}
} | [
"ikbarrame@gmail.com"
] | ikbarrame@gmail.com |
bfb05996e5d0af9d031180531a11c85d1a3c22b6 | 85c6811c7b7ff87324acb8885fe49cc5092cbd0f | /src/main/java/org/panda_lang/lily/plugin/PluginManager.java | 88cbc5c6874f13cc82a8739e276a2f6fa19ad346 | [] | no_license | test-on/Lily | 959eb0d7e9891034896094194cb89b660b81e3d8 | 822a48e54c36dbb85a23896281d618943058dbc2 | refs/heads/master | 2021-01-12T05:43:13.544770 | 2016-11-24T18:42:53 | 2016-11-24T18:42:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,232 | java | package org.panda_lang.lily.plugin;
import org.panda_lang.lily.Lily;
import java.util.ArrayList;
import java.util.Collection;
public class PluginManager {
private final Lily lily;
private final Collection<LilyPlugin> plugins;
public PluginManager(Lily lily) {
this.lily = lily;
this.plugins = new ArrayList<>();
}
public void loadPlugins() {
for (LilyPlugin plugin : plugins) {
plugin.onLoad();
}
}
public void enablePlugins() {
for (LilyPlugin plugin : plugins) {
plugin.onEnable(lily);
}
}
public void disablePlugins() {
for (LilyPlugin plugin : plugins) {
plugin.onDisable();
}
}
public void registerPlugin(LilyPlugin lilyPlugin) {
plugins.add(lilyPlugin);
}
@SuppressWarnings("unchecked")
public <T extends LilyPlugin> T getPlugin(String name) {
for (LilyPlugin plugin : plugins) {
String pluginName = plugin.getName();
if (name.equals(pluginName)) {
return (T) plugin;
}
}
return null;
}
public Collection<LilyPlugin> getPlugins() {
return plugins;
}
}
| [
"dzikoysk@dzikoysk.net"
] | dzikoysk@dzikoysk.net |
7763454670946f33c5607b732fe2a520f8dae83e | ee53b0262007b2f0db0fe15b2ad85f65fafa4e25 | /Leetcode/1162. As Far from Land as Possible.java | b0615ec819aff59d5309b03fb1f3c4b58b7f9ac5 | [] | no_license | xiaohuanlin/Algorithms | bd48caacb08295fc5756acdac609be78e143a760 | 157cbaeeff74130e5105e58a6b4cdf66403a8a6f | refs/heads/master | 2023-08-09T05:18:06.221485 | 2023-08-08T11:53:15 | 2023-08-08T11:53:15 | 131,491,056 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,574 | java | import java.util.*;
// Given an n x n grid containing only values 0 and 1, where 0 represents water and 1 represents land, find a water cell such that its distance to the nearest land cell is maximized, and return the distance. If no land or water exists in the grid, return -1.
// The distance used in this problem is the Manhattan distance: the distance between two cells (x0, y0) and (x1, y1) is |x0 - x1| + |y0 - y1|.
// Example 1:
// Input: grid = [[1,0,1],[0,0,0],[1,0,1]]
// Output: 2
// Explanation: The cell (1, 1) is as far as possible from all the land with distance 2.
// Example 2:
// Input: grid = [[1,0,0],[0,0,0],[0,0,0]]
// Output: 4
// Explanation: The cell (2, 2) is as far as possible from all the land with distance 4.
// Constraints:
// n == grid.length
// n == grid[i].length
// 1 <= n <= 100
// grid[i][j] is 0 or 1
class Solution1162 {
public int maxDistance(int[][] grid) {
Queue<Integer> q = new LinkedList<>();
int row = grid.length;
int col = grid[0].length;
for (int i = 0; i < row; i++) {
for (int j = 0; j < col; j++) {
if (grid[i][j] == 1) {
q.offer(i * row + j);
}
}
}
if (q.size() == row * col) {
return -1;
}
Set<Integer> memory = new HashSet<>();
int distance = -1;
int[][] directions = {
{-1, 0},
{1, 0},
{0, 1},
{0, -1},
};
while (!q.isEmpty()) {
int size = q.size();
for (int i = 0; i < size; i++) {
int num = q.poll();
int x = num / row;
int y = num % row;
for (int[] direction: directions) {
int newX = x + direction[0];
int newY = y + direction[1];
int newNum = newX * row + newY;
if (memory.contains(newNum)) {
continue;
}
if (newX >= 0 && newX < row && newY >= 0 && newY < col && grid[newX][newY] == 0) {
q.offer(newNum);
memory.add(newNum);
}
}
}
distance++;
}
return distance;
}
}
class Driver1162 {
public static void main(String[] args) {
Solution1162 solution = new Solution1162();
int[][] grid = {{1,0,0},{0,0,0},{0,0,0}};
System.out.println(solution.maxDistance(grid));
}
} | [
"xiaohuanlin1993@gmail.com"
] | xiaohuanlin1993@gmail.com |
3e9758406de02e9874bd9dceb17cfd733b18c78b | 2f5cd5ba8a78edcddf99c7e3c9c19829f9dbd214 | /java/playgrounds/.svn/pristine/3e/3e9758406de02e9874bd9dceb17cfd733b18c78b.svn-base | c31b3edf4b5e852f2b82c30637efb889366100f9 | [] | no_license | HTplex/Storage | 5ff1f23dfe8c05a0a8fe5354bb6bbc57cfcd5789 | e94faac57b42d6f39c311f84bd4ccb32c52c2d30 | refs/heads/master | 2021-01-10T17:43:20.686441 | 2016-04-05T08:56:57 | 2016-04-05T08:56:57 | 55,478,274 | 1 | 1 | null | 2020-10-28T20:35:29 | 2016-04-05T07:43:17 | Java | UTF-8 | Java | false | false | 5,465 | /* *********************************************************************** *
* project: org.matsim.*
* *
* *********************************************************************** *
* *
* copyright : (C) 2014 by the members listed in the COPYING, *
* LICENSE and WARRANTY file. *
* email : info at matsim dot org *
* *
* *********************************************************************** *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* See also COPYING, LICENSE and WARRANTY file *
* *
* *********************************************************************** */
package playground.agarwalamit.analysis.congestion;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.SortedMap;
import org.apache.log4j.Logger;
import org.matsim.api.core.v01.Id;
import org.matsim.api.core.v01.Scenario;
import org.matsim.api.core.v01.network.Link;
import org.matsim.api.core.v01.population.Person;
import org.matsim.core.api.experimental.events.EventsManager;
import org.matsim.core.events.EventsUtils;
import org.matsim.core.events.MatsimEventsReader;
import org.matsim.core.events.handler.EventHandler;
import org.matsim.core.scenario.ScenarioImpl;
import playground.vsp.analysis.modules.AbstractAnalysisModule;
import playground.vsp.congestion.handlers.CongestionHandlerImplV3;
/**
* This analyzer calculates delay from link enter and link leave events and therefore provides only experienced delay.
* <p> In order to get the caused delay for each person, see {@link CausedDelayAnalyzer}
*
* @author amit
*/
public class ExperiencedDelayAnalyzer extends AbstractAnalysisModule {
private final Logger logger = Logger.getLogger(ExperiencedDelayAnalyzer.class);
private final String eventsFile;
private ExperiencedDelayHandler congestionPerPersonHandler;
private final int noOfTimeBins;
private SortedMap<Double, Map<Id<Person>, Double>> congestionPerPersonTimeInterval;
private Map<Double, Map<Id<Link>, Double>> congestionPerLinkTimeInterval;
private EventsManager eventsManager;
private Scenario scenario;
private boolean isSortingForInsideMunich = false;
public ExperiencedDelayAnalyzer(String eventFile, int noOfTimeBins) {
super(ExperiencedDelayAnalyzer.class.getSimpleName());
this.eventsFile = eventFile;
this.noOfTimeBins = noOfTimeBins;
}
public ExperiencedDelayAnalyzer(String eventFile, int noOfTimeBins, boolean isSortingForInsideMunich) {
super(ExperiencedDelayAnalyzer.class.getSimpleName());
this.eventsFile = eventFile;
this.noOfTimeBins = noOfTimeBins;
this.isSortingForInsideMunich = isSortingForInsideMunich;
}
public void run(Scenario scenario){
init(scenario);
preProcessData();
postProcessData();
checkTotalDelayUsingAlternativeMethod();
}
public void init(Scenario scenario){
this.scenario = scenario;
this.congestionPerPersonHandler = new ExperiencedDelayHandler(this.noOfTimeBins, this.scenario, isSortingForInsideMunich);
}
@Override
public List<EventHandler> getEventHandler() {
List<EventHandler> handler = new LinkedList<EventHandler>();
return handler;
}
@Override
public void preProcessData() {
this.eventsManager = EventsUtils.createEventsManager();
MatsimEventsReader eventsReader = new MatsimEventsReader(this.eventsManager);
this.eventsManager.addHandler(this.congestionPerPersonHandler);
eventsReader.readFile(this.eventsFile);
}
@Override
public void postProcessData() {
this.congestionPerPersonTimeInterval= this.congestionPerPersonHandler.getDelayPerPersonAndTimeInterval();
this.congestionPerLinkTimeInterval= this.congestionPerPersonHandler.getDelayPerLinkAndTimeInterval();
}
@Override
public void writeResults(String outputFolder) {
}
public double getTotalDelaysInHours (){
return this.congestionPerPersonHandler.getTotalDelayInHours();
}
public SortedMap<Double, Map<Id<Person>, Double>> getCongestionPerPersonTimeInterval() {
return this.congestionPerPersonTimeInterval;
}
public Map<Double, Map<Id<Link>, Double>> getCongestionPerLinkTimeInterval() {
return this.congestionPerLinkTimeInterval;
}
public void checkTotalDelayUsingAlternativeMethod(){
EventsManager em = EventsUtils.createEventsManager();
CongestionHandlerImplV3 implV3 = new CongestionHandlerImplV3(em, (ScenarioImpl) this.scenario);
MatsimEventsReader eventsReader = new MatsimEventsReader(em);
em.addHandler(implV3);
eventsReader.readFile(this.eventsFile);
if(implV3.getTotalDelay()/3600!=this.congestionPerPersonHandler.getTotalDelayInHours())
throw new RuntimeException("Total Delays are not equal using two methods; values are "+implV3.getTotalDelay()/3600+","+this.congestionPerPersonHandler.getTotalDelayInHours());
}
}
| [
"htplex@gmail.com"
] | htplex@gmail.com | |
10cc92bb0793a76826fc8202fb6e45d607ed89ec | 77422b77c30cbf8d4725367afd60768fd442a422 | /app/src/main/java/com/example/pc/mhealth/fragments/TitleFragment.java | 8837fad890f2eeb915cb36b1639d14b0d057a269 | [] | no_license | haurbano/mHealthAndroid | eaf703e0a82844094c35b29e0a72a4eb3173079b | d7768253a07190e51dfc8dda0e528eeff600ad7b | refs/heads/master | 2021-01-10T11:36:27.500508 | 2015-06-01T01:36:20 | 2015-06-01T01:36:20 | 36,054,891 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 220 | java | package com.example.pc.mhealth.fragments;
import android.support.v4.app.Fragment;
/**
* Created by pc on 07/05/2015.
*/
public abstract class TitleFragment extends Fragment {
public abstract String getTitle();
}
| [
"h.a.u.r1993@gmail.com"
] | h.a.u.r1993@gmail.com |
6aec1885dab617b300b3370bee6b4bc01f09b4fe | dd3502da8f04b9ec44ef5b251b3d52453a6d0b01 | /src/test/java/com/jarq/algorithms/sorts/BubbleTest.java | 6eee6811ffcde038963db1b3facd6e6736299485 | [] | no_license | jarqprog/Algorithms | 4fa64339b273dd239e010eaed342c36c691d2a5b | 734f34788a675e6705bcdf45d0728f42827d4df5 | refs/heads/master | 2021-04-30T13:37:25.156002 | 2018-06-22T14:17:20 | 2018-06-22T14:17:20 | 121,299,147 | 0 | 0 | null | 2018-06-22T14:17:22 | 2018-02-12T20:40:24 | Java | UTF-8 | Java | false | false | 682 | java | package com.jarq.algorithms.sorts;
import org.junit.Test;
import java.util.Arrays;
import java.util.List;
import static org.junit.Assert.*;
public class BubbleTest {
private Sorting sorting = new Bubble();
@Test
public void sort_list() {
List<Integer> unsorted = Arrays.asList(4, -11, 8, 2000, -3, 1, 0);
List<Integer> sorted = Arrays.asList(-11, -3, 0, 1, 4, 8, 2000);
assertEquals(sorted, sorting.sort(unsorted));
}
@Test
public void sort_array() {
int[] unsorted = {4, -11, 8, 2000, -3, 1, 0};
int[] sorted = {-11, -3, 0, 1, 4, 8, 2000};
assertArrayEquals(sorted, sorting.sort(unsorted));
}
} | [
"jarqprog@gmail.com"
] | jarqprog@gmail.com |
ec0bd942fefed4b51580e8ecd8c99e9a652de586 | b964e7f936d6c0c755cc7e02af2f58113d3a3cdc | /Epsilon5-Java/client/src/main/java/com/epsilon5/client/window/Scene.java | 8dbfd48ea2484ccac93fe0c5112e89db573ac7f4 | [] | no_license | dmitrysl/Epsilon5 | 0fdf88a0e9bb7f23ca41ec275ba33d17457095a8 | fe5111bd0de82a0e2edce3e94a205d0cf545b315 | refs/heads/master | 2020-12-26T02:49:22.472980 | 2013-06-27T06:32:15 | 2013-06-27T06:32:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,715 | java | package com.epsilon5.client.window;
import com.google.inject.Inject;
import com.jogamp.opengl.util.GLArrayDataServer;
import com.jogamp.opengl.util.PMVMatrix;
import com.jogamp.opengl.util.glsl.ShaderCode;
import com.jogamp.opengl.util.glsl.ShaderProgram;
import com.jogamp.opengl.util.glsl.ShaderState;
import com.jogamp.opengl.util.texture.Texture;
import com.jogamp.opengl.util.texture.TextureIO;
import com.epsilon5.client.network.Protocol;
import com.epsilon5.client.world.CurrentWorld;
import com.epsilon5.client.world.Drawable;
import com.epsilon5.client.world.Sprite;
import com.epsilon5.client.world.Sprites;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.media.opengl.*;
import java.io.*;
import java.util.Map;
import java.util.TreeMap;
class Scene implements GLEventListener {
private static final boolean CHECK_DRAWING_SEQUENCE = true;
private static final boolean GL_DEBUGGING = false;
private final Logger logger = LoggerFactory.getLogger(Scene.class);
private final CurrentWorld currentWorld;
private final PMVMatrix matrix = new PMVMatrix();
private final Map<Integer, Sprite> sprites = new TreeMap<>();
private final Map<Integer, Texture> textures = new TreeMap<>();
private ShaderState shader;
private GLUniformData uniformData;
private GLArrayDataServer vertexBuffer;
private GLArrayDataServer texCoordBuffer;
private GLArrayDataServer elementsBuffer;
private int lastLayer;
private static final float[] VERTEX_BUFFER = {
1.0f, 0.0f, 1.0f,
1.0f, 1.0f, 1.0f,
0.0f, 0.0f, 1.0f,
0.0f, 1.0f, 1.0f,
};
private static final float[] TEXCOORD_BUFFER = {
1.0f, 0.0f,
1.0f, 1.0f,
0.0f, 0.0f,
0.0f, 1.0f,
};
private static final short[] ELEMENTS_BUFFER = {
0, 1, 2,
2, 1, 3,
};
@Inject
private Scene(Sprites sprites, CurrentWorld currentWorld) {
for (Sprite sprite : sprites.getSprite()) {
this.sprites.put(sprite.getId(), sprite);
}
this.currentWorld = currentWorld;
}
private void draw(GL2ES2 gl, Drawable drawable) {
final Sprite sprite = sprites.get(drawable.getSpriteId());
final Texture texture = textures.get(drawable.getSpriteId());
texture.bind(gl);
final int paddingRight = sprite.getPaddingRight() == null ? 0 : sprite.getPaddingRight();
final int paddingBottom = sprite.getPaddingBottom() == null ? 0 : sprite.getPaddingBottom();
if (CHECK_DRAWING_SEQUENCE) {
if (lastLayer >= drawable.getLayer()) {
lastLayer = drawable.getLayer();
} else {
throw new IllegalStateException();
}
}
matrix.glPushMatrix();
matrix.glTranslatef(
drawable.getX() - (sprite.getWidth() - paddingRight) / 2,
drawable.getY() - (sprite.getHeight() - paddingBottom) / 2,
0);
matrix.glScalef(sprite.getWidth(), sprite.getHeight(), drawable.getLayer());
shader.uniform(gl, uniformData);
gl.glDrawElements(GL2ES2.GL_TRIANGLES,
elementsBuffer.getComponentCount() * elementsBuffer.getElementCount(),
elementsBuffer.getComponentType(), elementsBuffer.getVBOOffset());
matrix.glPopMatrix();
}
private void drawScene(GL2ES2 gl) {
final Protocol.Player hero = currentWorld.getHero();
matrix.glTranslatef(-hero.getX(), -hero.getY(), 0);
draw(gl, currentWorld.getBackgroundDrawable());
for (int i = 0, count = currentWorld.getBulletCount(); i < count; ++i) {
draw(gl, currentWorld.getBulletDrawable(i));
}
for (int i = 0, count = currentWorld.getPlayerCount(); i < count; ++i) {
draw(gl, currentWorld.getPlayerDrawable(i));
}
}
@Override
public void display(GLAutoDrawable drawable) {
final GL2ES2 gl = drawable.getGL().getGL2ES2();
if (!currentWorld.isDrawable()) {
gl.glClear(GL2ES2.GL_COLOR_BUFFER_BIT);
return;
}
gl.glClear(GL2ES2.GL_DEPTH_BUFFER_BIT);
{
shader.useProgram(gl, true);
matrix.glPushMatrix();
elementsBuffer.bindBuffer(gl, true);
vertexBuffer.bindBuffer(gl, true);
texCoordBuffer.bindBuffer(gl, true);
}
if (CHECK_DRAWING_SEQUENCE) {
lastLayer = Integer.MAX_VALUE;
}
drawScene(gl);
{
gl.glBindTexture(GL2ES2.GL_TEXTURE_2D, 0);
shader.useProgram(gl, false);
matrix.glPopMatrix();
texCoordBuffer.bindBuffer(gl, false);
vertexBuffer.bindBuffer(gl, false);
elementsBuffer.bindBuffer(gl, false);
}
}
@Override
public void dispose(GLAutoDrawable drawable) {
final GL2ES2 gl = drawable.getGL().getGL2ES2();
for (Texture texture : textures.values()) {
texture.destroy(gl);
}
shader.destroy(gl);
matrix.destroy();
vertexBuffer.destroy(gl);
texCoordBuffer.destroy(gl);
elementsBuffer.destroy(gl);
}
@Override
public void init(GLAutoDrawable drawable) {
if (GL_DEBUGGING) {
final DebugGL2ES2 glDebug = new DebugGL2ES2(drawable.getGL().getGL2ES2());
final TraceGL2ES2 glTrace = new TraceGL2ES2(glDebug, System.out);
drawable.setGL(glTrace);
}
final GL2ES2 gl = drawable.getGL().getGL2ES2();
gl.glEnable(GL2ES2.GL_BLEND);
gl.glEnable(GL2ES2.GL_DEPTH_TEST);
gl.glBlendFunc(GL2ES2.GL_SRC_ALPHA, GL2ES2.GL_ONE_MINUS_SRC_ALPHA);
gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
gl.glTexParameteri(GL2ES2.GL_TEXTURE_2D, GL2ES2.GL_TEXTURE_MIN_FILTER, GL2ES2.GL_LINEAR_MIPMAP_LINEAR);
gl.glTexParameteri(GL2ES2.GL_TEXTURE_2D, GL2ES2.GL_TEXTURE_MAG_FILTER, GL2ES2.GL_LINEAR);
try {
for (Sprite sprite : sprites.values()) {
final File file = new File("textures/" + sprite.getTexture() + ".dds");
textures.put(sprite.getId(), TextureIO.newTexture(file, false));
logger.debug("Texture '{}' is loaded", sprite.getTexture());
}
} catch (IOException e) {
throw new RuntimeException(e);
}
final ShaderCode vs = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER,
1, ShaderCode.class,
new String[]{"shaders/scene.vert.txt"}, false);
final ShaderCode fs = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER,
1, ShaderCode.class,
new String[]{"shaders/scene.frag.txt"}, false);
final OutputStream baos = new ByteArrayOutputStream();
final PrintStream stream = new PrintStream(baos);
final ShaderProgram program = new ShaderProgram();
boolean status;
status = program.add(gl, vs, stream);
status &= program.add(gl, fs, stream);
status &= program.link(gl, stream);
if (!status) {
throw new RuntimeException(baos.toString());
}
shader = new ShaderState();
shader.attachShaderProgram(gl, program, true);
uniformData = new GLUniformData("mgl_PMVMatrix", 4, 4, matrix.glGetPMvMatrixf());
shader.ownUniform(uniformData);
vertexBuffer = GLArrayDataServer.createGLSL("mgl_Vertex", 3,
GL2ES2.GL_FLOAT, false, 4, GL2ES2.GL_STATIC_DRAW);
for (float e : VERTEX_BUFFER) vertexBuffer.putf(e);
vertexBuffer.seal(gl, true);
texCoordBuffer = GLArrayDataServer.createGLSL("mgl_MultiTexCoord", 2,
GL2ES2.GL_FLOAT, false, 4, GL2ES2.GL_STATIC_DRAW);
for (float e : TEXCOORD_BUFFER) texCoordBuffer.putf(e);
texCoordBuffer.seal(gl, true);
elementsBuffer = GLArrayDataServer.createData(3, GL2ES2.GL_UNSIGNED_SHORT, 2,
GL2ES2.GL_STATIC_DRAW, GL2ES2.GL_ELEMENT_ARRAY_BUFFER);
for (short e : ELEMENTS_BUFFER) elementsBuffer.puts(e);
elementsBuffer.seal(gl, true);
}
@Override
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
logger.info("Reshape ({}, {})", width, height);
matrix.glMatrixMode(PMVMatrix.GL_PROJECTION);
matrix.glLoadIdentity();
matrix.glOrthof(width / -2, width / 2, height / -2, height / 2, 1, 10);
matrix.glMatrixMode(PMVMatrix.GL_MODELVIEW);
matrix.glLoadIdentity();
matrix.glScalef(1, -1, -1);
}
}
| [
"semerli@yandex.ru"
] | semerli@yandex.ru |
3bc479950085aba2d60bcfec10f0de4b3ac8a094 | 7b90f94f15444b825296334db86860539c9230c8 | /225. Implement Stack using Queues/test_code.java | 8a802a4afd08e7f4b67cf30e304b8851c80d3662 | [] | no_license | chaozhiwen/LeetCode-in-Java | b51a40645e2d1ef6d9d67974f269078e1c8e10a4 | 3fddf82120966bd016a20ab7e89c7dcf11aa6b66 | refs/heads/master | 2020-04-01T21:13:10.059104 | 2019-02-06T14:45:00 | 2019-02-06T14:45:00 | 153,644,026 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,494 | java | import java.util.Stack;
class MyStack {
Queue<Integer> q;
/** Initialize your data structure here. */
public MyStack() {
q=new LinkedList<Integer>();
}
/** Push element x onto stack. */
public void push(int x) {
if(q.isEmpty()){
q.add(x);
}else{
Queue<Integer> temp=new LinkedList<>();
while(!q.isEmpty()){
temp.add(q.poll());
}
q.add(x);
while(!temp.isEmpty()){
q.add(temp.poll());
}
}
}
/** Removes the element on top of the stack and returns that element. */
public int pop() {
if(q.isEmpty()){
return 0;
}else{
return q.poll();
}
}
/** Get the top element. */
public int top() {
if(q.isEmpty()){
return 0;
}else{
return q.peek();
}
}
/** Returns whether the stack is empty. */
public boolean empty() {
return q.isEmpty();
}
}
class Main{
public static void main(String[] args){
MyStack q=new Mystack();
System.out.println("Operation:");
System.out.print("empty(),push(1),push(2),push(3),push(4),empty(),pop(),pop(),pop(),pop(),empty():"+q.empty()+" ");
q.push(1);
q.push(2);
q.push(3);
q.push(4);
System.out.print(q.empty()+" ");
while(!q.empty()){
System.out.print(q.pop()+" ");
}
System.out.println(q.empty());
}
}
| [
"noreply@github.com"
] | noreply@github.com |
0d811dd06f186c4a9c691eb6cd3361c1c6c10916 | 02accd85cb86f7819ccb8100a7edcb9c8ab06232 | /20190818-JsonPlaceholder/src/appl/app.java | e281c72628c288e6981afea8a50ddfb296349c36 | [] | no_license | select26/telran | 77c7747297d59951c61b9081d468e5ea1d406658 | 72ea0765fac32a33e8b2f78c471b08dd01bfe42a | refs/heads/master | 2022-12-25T14:35:59.139473 | 2019-10-24T11:47:14 | 2019-10-24T11:47:14 | 191,749,937 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,920 | java | package appl;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import dto.BlogPost;
public class app {
public static void main(String[] args) throws JsonProcessingException
{
String url = "http://jsonplaceholder.typicode.com/posts?id={id}&userId={userId}";
//url = "http://jsonplaceholder.typicode.com/posts?userId={userId}";
RestTemplate restTemplate = new RestTemplate();
HttpEntity<String> httpEntity = new HttpEntity<>(null); //headers is null for GET request
/* Map<String, Integer> uriVars = new HashMap<>();
uriVars.put("id", 15);
uriVars.put("userId", 2);
//read arrays of posts
ResponseEntity<BlogPost[]> responce =
restTemplate.exchange(url, HttpMethod.GET, httpEntity, BlogPost[].class, uriVars); //Jackson required
System.out.println(responce);
System.out.println();
System.out.println(Arrays.toString(responce.getBody()));
System.out.println();
System.out.println();
*/
//create a new blogPost
BlogPost post = new BlogPost(12, 100, "Haifa", "Test body");
String body = new ObjectMapper().writeValueAsString(post);
System.out.println(body);
url = "http://jsonplaceholder.typicode.com/posts";
HttpHeaders headers = new HttpHeaders();
headers.add("Content-Type", "application/json");
httpEntity = new HttpEntity<>(body, headers);
ResponseEntity<BlogPost> responce =
restTemplate.exchange(url, HttpMethod.POST, httpEntity, BlogPost.class);
System.out.println(responce.getBody());
}
}
| [
"Dennis@Chertkov.info"
] | Dennis@Chertkov.info |
b8a72bd262d5c3e6ee6e75f092e7e9b36c371238 | ff15dc23e2f01d1ac90938445f3e3d74c361ee1c | /JTetris4x4/src/module-info.java | 29dd60a544a3275bf739b6d1167316ecc81f59cf | [] | no_license | jmedina2099/JTetris | 4c257c31c257f0e9cc8882bf0fea1aa092283b0a | f8809e4f5b27be2e455c07c23e34308c17f2516b | refs/heads/master | 2023-05-15T01:29:42.992071 | 2021-06-10T21:21:33 | 2021-06-10T21:21:33 | 374,154,143 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 45 | java | module JTetris4x4 {
requires java.desktop;
} | [
"jmedina@debian"
] | jmedina@debian |
d14d35470742ca022efe6e4aa3f5bad309de2b45 | 2bdc19262159e62902c79ab6911275f6d0c50f93 | /src/main/java/com/pk/petrolstationmonolith/services/account/AddressService.java | f29e971f0b511488bd1832aacf929d78e37cbf05 | [] | no_license | slawomirbuczek/petrol-station-monolith | 49d1ade6923ead1b4a8843a53894b3c44f77daf3 | 5a2c154df9a933096caf9cb27fd569d7acb91325 | refs/heads/main | 2023-03-18T10:01:31.174714 | 2021-03-08T12:37:56 | 2021-03-08T12:37:56 | 338,895,473 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,218 | java | package com.pk.petrolstationmonolith.services.account;
import com.pk.petrolstationmonolith.dtos.account.AddressDto;
import com.pk.petrolstationmonolith.entities.account.Addresses;
import com.pk.petrolstationmonolith.exceptions.account.address.AddressNotFoundException;
import com.pk.petrolstationmonolith.repositories.account.AddressRepository;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.modelmapper.ModelMapper;
import org.springframework.stereotype.Service;
@Service
@AllArgsConstructor
@Slf4j
public class AddressService {
private final AddressRepository addressRepository;
private final ModelMapper mapper;
public AddressDto getAddressDto(long customerId) {
log.trace("Getting addres dto for customer with id " + customerId);
return mapAddressToDto(getAddress(customerId));
}
public void addAddress(Addresses addresses) {
log.trace("Adding new address for customer with id " + addresses.getCustomers().getId());
addressRepository.save(addresses);
}
public AddressDto updateAddress(long customerId, AddressDto addressDto) {
log.trace("Updating address for customer with id " + customerId);
Addresses oldAddresses = getAddress(customerId);
Addresses addresses = mapDtoToAddress(addressDto);
addresses.setCustomers(oldAddresses.getCustomers());
addresses = addressRepository.save(addresses);
return mapAddressToDto(addresses);
}
public AddressDto deleteAddress(long customerId) {
log.trace("Deleting address for customer with id " + customerId);
Addresses addresses = getAddress(customerId);
addressRepository.delete(addresses);
return mapAddressToDto(addresses);
}
private Addresses getAddress(long customerId) {
return addressRepository.findByCustomersId(customerId)
.orElseThrow(() -> new AddressNotFoundException(customerId));
}
private AddressDto mapAddressToDto(Addresses addresses) {
return mapper.map(addresses, AddressDto.class);
}
private Addresses mapDtoToAddress(AddressDto addressDto) {
return mapper.map(addressDto, Addresses.class);
}
}
| [
"slawekbuczek210@gmail.com"
] | slawekbuczek210@gmail.com |
ad0c821160589d25d62859e89fce6404d4f0fb8f | 9d3137185262fec3df783399ec594151bbc54cb7 | /JR/src/t3004/BinaryRepresentationTask.java | 7990af8f7ca95eff29341aeb42b0d9fac2b28930 | [] | no_license | ArseniiT/JR | 8362218bec2b945b921ad5d0900c0ea47b161288 | 1bc0e88ee51bcf64cb4e4925b7b7486a9decf991 | refs/heads/master | 2021-09-05T10:34:06.315807 | 2018-01-26T12:59:52 | 2018-01-26T12:59:52 | 89,603,379 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 620 | java | package t3004;
import java.util.concurrent.RecursiveTask;
/**
* Created by DELL on 1/18/2018.
*/
public class BinaryRepresentationTask extends RecursiveTask<String> {
int x;
public BinaryRepresentationTask(int x) {
this.x = x;
}
@Override
protected String compute() {
int a = x % 2;
int b = x / 2;
String result = String.valueOf(a);
if (b > 0) {
BinaryRepresentationTask task = new BinaryRepresentationTask(b);
task.fork();
return task.join() + a;
}
return result;
}
}
| [
"DELL@DELL-Laptop-M5A6LK"
] | DELL@DELL-Laptop-M5A6LK |
3657f7297038d8be660f9e4e1e534fd25fa2e9e2 | 2338099936b2d3eb3787e4d597e890e8aec5b209 | /ordinary-project/design-patterns/src/main/java/com/dmxiaoshen/behavior/observer/Main.java | 2482a8fb7ded3f2e59ad3e63ce74cd26d72f33a6 | [] | no_license | dmxiaoshen/spring-collections | 7889ae4324a5eabfeb3f6e4b598735af9895066c | 1bd8927bbfaea99b0eb54a5a6e58197df91a8b69 | refs/heads/master | 2020-03-28T12:20:55.643185 | 2018-10-16T08:31:32 | 2018-10-16T08:31:32 | 148,289,631 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,187 | java | package com.dmxiaoshen.behavior.observer;
/**
* Created by hzhsg on 2018/5/7.
* 观察者模式
当对象间存在一对多关系时,则使用观察者模式(Observer Pattern)。比如,当一个对象被修改时,则会自动通知它的依赖对象。观察者模式属于行为型模式。
介绍
意图:定义对象间的一种一对多的依赖关系,当一个对象的状态发生改变时,所有依赖于它的对象都得到通知并被自动更新。
主要解决:一个对象状态改变给其他对象通知的问题,而且要考虑到易用和低耦合,保证高度的协作。
何时使用:一个对象(目标对象)的状态发生改变,所有的依赖对象(观察者对象)都将得到通知,进行广播通知。
如何解决:使用面向对象技术,可以将这种依赖关系弱化。
关键代码:在抽象类里有一个 ArrayList 存放观察者们。
应用实例: 1、拍卖的时候,拍卖师观察最高标价,然后通知给其他竞价者竞价。 2、西游记里面悟空请求菩萨降服红孩儿,菩萨洒了一地水招来一个老乌龟,这个乌龟就是观察者,他观察菩萨洒水这个动作。
优点: 1、观察者和被观察者是抽象耦合的。 2、建立一套触发机制。
缺点: 1、如果一个被观察者对象有很多的直接和间接的观察者的话,将所有的观察者都通知到会花费很多时间。 2、如果在观察者和观察目标之间有循环依赖的话,观察目标会触发它们之间进行循环调用,可能导致系统崩溃。 3、观察者模式没有相应的机制让观察者知道所观察的目标对象是怎么发生变化的,而仅仅只是知道观察目标发生了变化。
使用场景:
一个抽象模型有两个方面,其中一个方面依赖于另一个方面。将这些方面封装在独立的对象中使它们可以各自独立地改变和复用。
一个对象的改变将导致其他一个或多个对象也发生改变,而不知道具体有多少对象将发生改变,可以降低对象之间的耦合度。
一个对象必须通知其他对象,而并不知道这些对象是谁。
需要在系统中创建一个触发链,A对象的行为将影响B对象,B对象的行为将影响C对象……,可以使用观察者模式创建一种链式触发机制。
注意事项: 1、JAVA 中已经有了对观察者模式的支持类。 2、避免循环引用。 3、如果顺序执行,某一观察者错误会导致系统卡壳,一般采用异步方式。
*/
public class Main {
public static void main(String[] args) {
testObserver();
}
public static void testObserver(){
WeChatPublic weChatPublic = new WeChatPublic();
User user1 = new User("Tom");
User user2 = new User("Lucky");
User user3 = new User("Jack");
weChatPublic.registerObserver(user1);
weChatPublic.registerObserver(user2);
weChatPublic.registerObserver(user3);
weChatPublic.pushMessage("今天有大雨");
weChatPublic.removeObserver(user2);
weChatPublic.pushMessage("明天大晴天");
}
}
| [
"hsg@dmxiaoshen.com"
] | hsg@dmxiaoshen.com |
dc58544407899d89c6f1bbebd7ea247d49425005 | fadee890e2b7aca73da25b8c9b16abf863cb1f3d | /src/main/java/ru/javawebinar/topjava/util/MealsUtil.java | 6d66435b351ed19c0fc204dfc5cc399bb5d99f56 | [] | no_license | krivoijlos156/topjava | 43560295e44b76fc9fea5167235a94a1bcee1af0 | ec75fb60630c5a781bba0c9f0954d6ad85b71a2e | refs/heads/master | 2022-12-19T01:56:36.208419 | 2020-08-27T18:27:57 | 2020-08-27T18:27:57 | 268,792,999 | 0 | 0 | null | 2020-06-06T15:32:18 | 2020-06-02T12:19:58 | Java | UTF-8 | Java | false | false | 3,230 | java | package ru.javawebinar.topjava.util;
import ru.javawebinar.topjava.model.Meal;
import ru.javawebinar.topjava.to.MealTo;
import java.util.function.Predicate;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.Month;
import java.util.Arrays;
import java.util.*;
import java.util.stream.Collectors;
//import static ru.javawebinar.topjava.util.DateTimeUtil.isBetweenHalfOpen;
import static ru.javawebinar.topjava.util.Util.isBetweenHalfOpen;
public class MealsUtil {
public static final int DEFAULT_CALORIES_PER_DAY = 2000;
public static final List<Meal> MEALS = Arrays.asList(
new Meal(LocalDateTime.of(2020, Month.JANUARY, 30, 10, 0), "Завтрак", 500),
new Meal(LocalDateTime.of(2020, Month.JANUARY, 30, 13, 0), "Обед", 1000),
new Meal(LocalDateTime.of(2020, Month.JANUARY, 30, 20, 0), "Ужин", 500),
new Meal(LocalDateTime.of(2020, Month.JANUARY, 31, 0, 0), "Еда на граничное значение", 100),
new Meal(LocalDateTime.of(2020, Month.JANUARY, 31, 10, 0), "Завтрак", 1000),
new Meal(LocalDateTime.of(2020, Month.JANUARY, 31, 13, 0), "Обед", 500),
new Meal(LocalDateTime.of(2020, Month.JANUARY, 31, 20, 0), "Ужин", 410)
);
private MealsUtil() {
}
public static List<MealTo> getTos(Collection<Meal> meals, int caloriesPerDay) {
return filterByPredicate(meals, caloriesPerDay, meal -> true);
}
public static List<MealTo> getFilteredTos(Collection<Meal> meals, int caloriesPerDay, LocalTime startTime, LocalTime endTime) {
return filterByPredicate(meals, caloriesPerDay, meal -> isBetweenHalfOpen(meal.getTime(), startTime, endTime));
}
public static List<MealTo> filterByPredicate(Collection<Meal> meals, int caloriesPerDay, Predicate<Meal> filter) {
Map<LocalDate, Integer> caloriesSumByDate = meals.stream()
.collect(
Collectors.groupingBy(Meal::getDate, Collectors.summingInt(Meal::getCalories))
// Collectors.toMap(Meal::getDate, Meal::getCalories, Integer::sum)
);
return meals.stream()
.filter(filter)
.map(meal -> createTo(meal, caloriesSumByDate.get(meal.getDate()) > caloriesPerDay))
.collect(Collectors.toList());
}
public static List<MealTo> filteredByCycles(List<Meal> meals, LocalTime startTime, LocalTime endTime, int caloriesPerDay) {
final Map<LocalDate, Integer> caloriesSumByDate = new HashMap<>();
meals.forEach(meal -> caloriesSumByDate.merge(meal.getDate(), meal.getCalories(), Integer::sum));
final List<MealTo> mealsTo = new ArrayList<>();
meals.forEach(meal -> {
if (isBetweenHalfOpen(meal.getTime(), startTime, endTime)) {
mealsTo.add(createTo(meal, caloriesSumByDate.get(meal.getDate()) > caloriesPerDay));
}
});
return mealsTo;
}
public static MealTo createTo(Meal meal, boolean excess) {
return new MealTo(meal.getId(), meal.getDateTime(), meal.getDescription(), meal.getCalories(), excess);
}
}
| [
"krivoijlos@gmail.com"
] | krivoijlos@gmail.com |
88279d9911ec4311e778072f6bd07604b10484a9 | dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9 | /data_defect4j/preprossed_method_corpus/Math/96/org/apache/commons/math/stat/descriptive/MultivariateSummaryStatistics_checkDimension_622.java | 609ce2c717110754aab95858ac7b68b212286e8d | [] | no_license | hvdthong/NetML | dca6cf4d34c5799b400d718e0a6cd2e0b167297d | 9bb103da21327912e5a29cbf9be9ff4d058731a5 | refs/heads/master | 2021-06-30T15:03:52.618255 | 2020-10-07T01:58:48 | 2020-10-07T01:58:48 | 150,383,588 | 1 | 1 | null | 2018-09-26T07:08:45 | 2018-09-26T07:08:44 | null | UTF-8 | Java | false | false | 1,970 | java |
org apach common math stat descript
comput summari statist stream tupl ad
link add addvalu add addvalu method data valu store
memori comput statist larg
tupl stream
link storeless univari statist storelessunivariatestatist instanc maintain
summari state comput statist configur setter
implement overridden
call link set impl setmeanimpl storeless univari statist storelessunivariatestatist actual
paramet method implement
link storeless univari statist storelessunivariatestatist configur
complet code add addvalu code call configur
common math provid implement
comput statist stream tupl construct
multivari statist multivariatestatist instanc dimens
link add addvalu add tupl code xxx getxxx code
method xxx statist arrai code code
valu code code arrai element
statist data rang consist element
input tupl code add addvalu code call
actual paramet
code sum getsum code element arrai valu
note thread safe
link synchron multivari summari statist synchronizedmultivariatesummarystatist concurr access multipl
thread requir
version revis date
multivari summari statist multivariatesummarystatist
throw dimens mismatch except dimensionmismatchexcept dimens
param dimens dimens check
dimens mismatch except dimensionmismatchexcept dimens
check dimens checkdimens dimens
dimens mismatch except dimensionmismatchexcept
dimens
dimens mismatch except dimensionmismatchexcept dimens
| [
"hvdthong@gmail.com"
] | hvdthong@gmail.com |
dd3ea446988938271302580ce71fe4593257ae1f | 677f3cfcbf739e350b7f34a36844a93a226d59f1 | /gaia/cloud/dreams-common/common-cloud/src/main/java/com/dreams/cloud/base/common/service/user/AccountClient.java | cf3550c5073c24dc55dd47a635c3620ddff2a3ae | [] | no_license | gitzhan/dreams | b085204a7381ba921c5f0eeddcf0caecad75729c | d11658426a2786392fdc37137eca983dd1c765fd | refs/heads/master | 2020-03-19T09:30:58.272894 | 2018-06-21T16:31:41 | 2018-06-21T16:31:41 | 136,295,628 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,113 | java | package com.dreams.cloud.base.common.service.user;
import com.dreams.cloud.base.common.config.BasicLogLevelConfig;
import com.dreams.cloud.base.common.service.user.fallback.AccountFallBack;
import com.dreams.cloud.common.structs.HttpResult;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
/**
* @description:
* @author: zyl
* @version: v1.6.1
* @date: 2018/6/21
**/
@FeignClient(value = "pro-user", fallbackFactory = AccountFallBack.class, configuration = BasicLogLevelConfig.class)
public interface AccountClient {
/**
* 注册
* @param account
* @return
*/
@PostMapping(path = "/account")
HttpResult<String> register(@RequestBody String account);
/**
* 根据账号名查账户
* @param username
* @return
*/
@GetMapping(path = "/account")
HttpResult<String> getAccountIdByUsername(@RequestParam("username") String username);
}
| [
"260597116@qq.com"
] | 260597116@qq.com |
6c67659d624f0cce343218b826726403b9622a4d | 65de02d273b123f355e57ef60d5516aad30ace13 | /build/app/generated/source/buildConfig/release/com/example/karma/BuildConfig.java | 9cb71f42f3529f0c66d508d81d24a285748bf475 | [] | no_license | Vaibhavch2001/Tanishq-Karma | 9462b48564cdab97847d6f79bcb24a62cf42aa04 | 908f65183c30fc53a44be60f2aa75f9a3f570d78 | refs/heads/main | 2023-06-05T17:31:54.219320 | 2021-06-14T11:52:16 | 2021-06-14T11:52:16 | 376,804,365 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 380 | java | /**
* Automatically generated file. DO NOT MODIFY
*/
package com.example.karma;
public final class BuildConfig {
public static final boolean DEBUG = false;
public static final String APPLICATION_ID = "com.example.karma";
public static final String BUILD_TYPE = "release";
public static final int VERSION_CODE = 1;
public static final String VERSION_NAME = "1.0.0";
}
| [
"vaibhavsandeepnidhi@gmail.com"
] | vaibhavsandeepnidhi@gmail.com |
1011c61f3098cbf9039fe235447bcda876a11326 | 6a8f83c7d8406361bc4c5b969442fc6905438553 | /src/main/java/com.edu/PalindromeService.java | 341834956db1bb99e7e34414196644f2e90e6596 | [] | no_license | yettimon/PalindromeCheck | ab61f27bd3a283a898fe5b370add01b7e4caff75 | 763e37309bf1a432fd7baeb51a91bd1d0123fd8d | refs/heads/master | 2022-11-29T09:27:26.314891 | 2020-08-09T10:10:14 | 2020-08-09T10:10:14 | 286,211,942 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 766 | java | package com.edu;
import java.util.logging.Logger;
public class PalindromeService {
private static final Logger LOGGER =
Logger.getLogger(PalindromeService.class.getName());
private static String cleanString(String stringToClean){
if (stringToClean == null){return null;}
return stringToClean.toLowerCase().replaceAll("[^A-Za-z0-9]", "");
}
public static Boolean check (String possiblyPalindrome){
LOGGER.info("Creating check method");
String cleanedString = cleanString(possiblyPalindrome);
if (possiblyPalindrome == null){return null;}
if (possiblyPalindrome.length() == 0) return false;
return new StringBuilder(cleanedString).reverse().toString().equals(cleanedString);
}
}
| [
"globalobjectiveart@gmail.com"
] | globalobjectiveart@gmail.com |
587d8ae7437d895df3eb6014f472a3f89d47f2c0 | 4a1cf00b86764cbbf1d1fb49d602b1c9256720e9 | /src/com/cxxsheng/profiler/utils/Base64.java | 06d891535a06fc2965e37dad1c3d599ad4e31070 | [] | no_license | friendan/profiler | e4ab02dcaa753ea67c5c6790747490108434e785 | 321d2c58163901116a5d02b32c65b7b1ca530de0 | refs/heads/master | 2022-10-30T22:39:58.965904 | 2020-06-19T05:50:49 | 2020-06-19T05:50:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,217 | java | package com.cxxsheng.profiler.utils;
import java.util.Arrays;
/**
*
* @version 2.2
* @author Mikael Grev Date: 2004-aug-02 Time: 11:31:11
* @deprecated internal api, don't use.
*/
public class Base64 {
public static final char[] CA = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".toCharArray();
public static final int[] IA = new int[256];
static {
Arrays.fill(IA, -1);
for (int i = 0, iS = CA.length; i < iS; i++)
IA[CA[i]] = i;
IA['='] = 0;
}
/**
* Decodes a BASE64 encoded char array that is known to be resonably well formatted. The method is about twice as
* fast as #decode(char[]). The preconditions are:<br>
* + The array must have a line length of 76 chars OR no line separators at all (one line).<br>
* + Line separator must be "\r\n", as specified in RFC 2045 + The array must not contain illegal characters within
* the encoded string<br>
* + The array CAN have illegal characters at the beginning and end, those will be dealt with appropriately.<br>
*
* @param chars The source array. Length 0 will return an empty array. <code>null</code> will throw an exception.
* @return The decoded array of bytes. May be of length 0.
*/
public static byte[] decodeFast(char[] chars, int offset, int charsLen) {
// Check special case
if (charsLen == 0) {
return new byte[0];
}
int sIx = offset, eIx = offset + charsLen - 1; // Start and end index after trimming.
// Trim illegal chars from start
while (sIx < eIx && IA[chars[sIx]] < 0)
sIx++;
// Trim illegal chars from end
while (eIx > 0 && IA[chars[eIx]] < 0)
eIx--;
// get the padding count (=) (0, 1 or 2)
int pad = chars[eIx] == '=' ? (chars[eIx - 1] == '=' ? 2 : 1) : 0; // Count '=' at end.
int cCnt = eIx - sIx + 1; // Content count including possible separators
int sepCnt = charsLen > 76 ? (chars[76] == '\r' ? cCnt / 78 : 0) << 1 : 0;
int len = ((cCnt - sepCnt) * 6 >> 3) - pad; // The number of decoded bytes
byte[] bytes = new byte[len]; // Preallocate byte[] of exact length
// Decode all but the last 0 - 2 bytes.
int d = 0;
for (int cc = 0, eLen = (len / 3) * 3; d < eLen;) {
// Assemble three bytes into an int from four "valid" characters.
int i = IA[chars[sIx++]] << 18 | IA[chars[sIx++]] << 12 | IA[chars[sIx++]] << 6 | IA[chars[sIx++]];
// Add the bytes
bytes[d++] = (byte) (i >> 16);
bytes[d++] = (byte) (i >> 8);
bytes[d++] = (byte) i;
// If line separator, jump over it.
if (sepCnt > 0 && ++cc == 19) {
sIx += 2;
cc = 0;
}
}
if (d < len) {
// Decode last 1-3 bytes (incl '=') into 1-3 bytes
int i = 0;
for (int j = 0; sIx <= eIx - pad; j++)
i |= IA[chars[sIx++]] << (18 - j * 6);
for (int r = 16; d < len; r -= 8)
bytes[d++] = (byte) (i >> r);
}
return bytes;
}
public static byte[] decodeFast(String chars, int offset, int charsLen) {
// Check special case
if (charsLen == 0) {
return new byte[0];
}
int sIx = offset, eIx = offset + charsLen - 1; // Start and end index after trimming.
// Trim illegal chars from start
while (sIx < eIx && IA[chars.charAt(sIx)] < 0)
sIx++;
// Trim illegal chars from end
while (eIx > 0 && IA[chars.charAt(eIx)] < 0)
eIx--;
// get the padding count (=) (0, 1 or 2)
int pad = chars.charAt(eIx) == '=' ? (chars.charAt(eIx - 1) == '=' ? 2 : 1) : 0; // Count '=' at end.
int cCnt = eIx - sIx + 1; // Content count including possible separators
int sepCnt = charsLen > 76 ? (chars.charAt(76) == '\r' ? cCnt / 78 : 0) << 1 : 0;
int len = ((cCnt - sepCnt) * 6 >> 3) - pad; // The number of decoded bytes
byte[] bytes = new byte[len]; // Preallocate byte[] of exact length
// Decode all but the last 0 - 2 bytes.
int d = 0;
for (int cc = 0, eLen = (len / 3) * 3; d < eLen;) {
// Assemble three bytes into an int from four "valid" characters.
int i = IA[chars.charAt(sIx++)] << 18 | IA[chars.charAt(sIx++)] << 12 | IA[chars.charAt(sIx++)] << 6 | IA[chars.charAt(sIx++)];
// Add the bytes
bytes[d++] = (byte) (i >> 16);
bytes[d++] = (byte) (i >> 8);
bytes[d++] = (byte) i;
// If line separator, jump over it.
if (sepCnt > 0 && ++cc == 19) {
sIx += 2;
cc = 0;
}
}
if (d < len) {
// Decode last 1-3 bytes (incl '=') into 1-3 bytes
int i = 0;
for (int j = 0; sIx <= eIx - pad; j++)
i |= IA[chars.charAt(sIx++)] << (18 - j * 6);
for (int r = 16; d < len; r -= 8)
bytes[d++] = (byte) (i >> r);
}
return bytes;
}
/**
* Decodes a BASE64 encoded string that is known to be resonably well formatted. The method is about twice as fast
* as decode(String). The preconditions are:<br>
* + The array must have a line length of 76 chars OR no line separators at all (one line).<br>
* + Line separator must be "\r\n", as specified in RFC 2045 + The array must not contain illegal characters within
* the encoded string<br>
* + The array CAN have illegal characters at the beginning and end, those will be dealt with appropriately.<br>
*
* @param s The source string. Length 0 will return an empty array. <code>null</code> will throw an exception.
* @return The decoded array of bytes. May be of length 0.
*/
public static byte[] decodeFast(String s) {
// Check special case
int sLen = s.length();
if (sLen == 0) {
return new byte[0];
}
int sIx = 0, eIx = sLen - 1; // Start and end index after trimming.
// Trim illegal chars from start
while (sIx < eIx && IA[s.charAt(sIx) & 0xff] < 0)
sIx++;
// Trim illegal chars from end
while (eIx > 0 && IA[s.charAt(eIx) & 0xff] < 0)
eIx--;
// get the padding count (=) (0, 1 or 2)
int pad = s.charAt(eIx) == '=' ? (s.charAt(eIx - 1) == '=' ? 2 : 1) : 0; // Count '=' at end.
int cCnt = eIx - sIx + 1; // Content count including possible separators
int sepCnt = sLen > 76 ? (s.charAt(76) == '\r' ? cCnt / 78 : 0) << 1 : 0;
int len = ((cCnt - sepCnt) * 6 >> 3) - pad; // The number of decoded bytes
byte[] dArr = new byte[len]; // Preallocate byte[] of exact length
// Decode all but the last 0 - 2 bytes.
int d = 0;
for (int cc = 0, eLen = (len / 3) * 3; d < eLen;) {
// Assemble three bytes into an int from four "valid" characters.
int i = IA[s.charAt(sIx++)] << 18 | IA[s.charAt(sIx++)] << 12 | IA[s.charAt(sIx++)] << 6
| IA[s.charAt(sIx++)];
// Add the bytes
dArr[d++] = (byte) (i >> 16);
dArr[d++] = (byte) (i >> 8);
dArr[d++] = (byte) i;
// If line separator, jump over it.
if (sepCnt > 0 && ++cc == 19) {
sIx += 2;
cc = 0;
}
}
if (d < len) {
// Decode last 1-3 bytes (incl '=') into 1-3 bytes
int i = 0;
for (int j = 0; sIx <= eIx - pad; j++)
i |= IA[s.charAt(sIx++)] << (18 - j * 6);
for (int r = 16; d < len; r -= 8)
dArr[d++] = (byte) (i >> r);
}
return dArr;
}
} | [
"you@example.com"
] | you@example.com |
78e1b91cb9ec0de82550db388ec56d0bab3a018d | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/19/19_28997d0b49d4f0aea96731ba8536cbad3efd5fd3/PlexusUserListPlexusResource/19_28997d0b49d4f0aea96731ba8536cbad3efd5fd3_PlexusUserListPlexusResource_s.java | bf26eb6baa03139f363b1715044983e3e99b301d | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 3,258 | java | /**
* Sonatype Nexus (TM) [Open Source Version].
* Copyright (c) 2008 Sonatype, Inc. All rights reserved.
* Includes the third-party code listed at ${thirdPartyUrl}.
*
* This program is licensed to you under Version 3 only of the GNU
* General Public License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License Version 3 for more details.
*
* You should have received a copy of the GNU General Public License
* Version 3 along with this program. If not, see http://www.gnu.org/licenses/.
*/
package org.sonatype.nexus.rest.users;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.restlet.Context;
import org.restlet.data.Request;
import org.restlet.data.Response;
import org.restlet.resource.ResourceException;
import org.restlet.resource.Variant;
import org.sonatype.jsecurity.locators.users.PlexusUser;
import org.sonatype.jsecurity.locators.users.PlexusUserManager;
import org.sonatype.nexus.rest.model.PlexusRoleResource;
import org.sonatype.nexus.rest.model.PlexusUserListResourceResponse;
import org.sonatype.nexus.rest.model.PlexusUserResource;
import org.sonatype.plexus.rest.resource.PathProtectionDescriptor;
import org.sonatype.plexus.rest.resource.PlexusResource;
import com.thoughtworks.xstream.XStream;
@Component( role = PlexusResource.class, hint = "PlexusUserListPlexusResource" )
public class PlexusUserListPlexusResource
extends AbstractPlexusUserPlexusResource
{
public static final String USER_SOURCE_KEY = "userSource";
@Requirement( role = PlexusUserManager.class, hint="additinalRoles" )
private PlexusUserManager userManager;
public PlexusUserListPlexusResource()
{
setModifiable( false );
}
@Override
public Object getPayloadInstance()
{
return null;
}
@Override
public PathProtectionDescriptor getResourceProtection()
{
return new PathProtectionDescriptor( "/plexus_users/*", "authcBasic,perms[nexus:users]" );
}
@Override
public String getResourceUri()
{
return "/plexus_users/{" + USER_SOURCE_KEY + "}";
}
@Override
public Object get( Context context, Request request, Response response, Variant variant )
throws ResourceException
{
PlexusUserListResourceResponse result = new PlexusUserListResourceResponse();
for ( PlexusUser user : userManager.listUsers( getUserSource( request ) ) )
{
PlexusUserResource res = nexusToRestModel( user, request );
if ( res != null )
{
result.addData( res );
}
}
return result;
}
protected String getUserSource( Request request )
{
return request.getAttributes().get( USER_SOURCE_KEY ).toString();
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
1e8d03c969bdbff0dd353fa21dd93e6a1fc9df3b | ceed8ee18ab314b40b3e5b170dceb9adedc39b1e | /android/external/icu/android_icu4j/src/main/java/android/icu/text/NFSubstitution.java | a8db0a6b4a996b4febc6af0480a67ab19e79d2de | [
"BSD-3-Clause",
"NAIST-2003",
"LicenseRef-scancode-unicode",
"ICU",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause"
] | permissive | BPI-SINOVOIP/BPI-H3-New-Android7 | c9906db06010ed6b86df53afb6e25f506ad3917c | 111cb59a0770d080de7b30eb8b6398a545497080 | refs/heads/master | 2023-02-28T20:15:21.191551 | 2018-10-08T06:51:44 | 2018-10-08T06:51:44 | 132,708,249 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 66,497 | java | /* GENERATED SOURCE. DO NOT MODIFY. */
/*
*******************************************************************************
* Copyright (C) 1996-2015, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
package android.icu.text;
import java.text.ParsePosition;
//===================================================================
// NFSubstitution (abstract base class)
//===================================================================
/**
* An abstract class defining protocol for substitutions. A substitution
* is a section of a rule that inserts text into the rule's rule text
* based on some part of the number being formatted.
* @author Richard Gillam
*/
abstract class NFSubstitution {
//-----------------------------------------------------------------------
// data members
//-----------------------------------------------------------------------
/**
* The substitution's position in the rule text of the rule that owns it
*/
final int pos;
/**
* The rule set this substitution uses to format its result, or null.
* (Either this or numberFormat has to be non-null.)
*/
final NFRuleSet ruleSet;
/**
* The DecimalFormat this substitution uses to format its result,
* or null. (Either this or ruleSet has to be non-null.)
*/
final DecimalFormat numberFormat;
//-----------------------------------------------------------------------
// construction
//-----------------------------------------------------------------------
/**
* Parses the description, creates the right kind of substitution,
* and initializes it based on the description.
* @param pos The substitution's position in the rule text of the
* rule that owns it.
* @param rule The rule containing this substitution
* @param rulePredecessor The rule preceding the one that contains
* this substitution in the rule set's rule list (this is used
* only for >>> substitutions).
* @param ruleSet The rule set containing the rule containing this
* substitution
* @param formatter The RuleBasedNumberFormat that ultimately owns
* this substitution
* @param description The description to parse to build the substitution
* (this is just the substring of the rule's description containing
* the substitution token itself)
* @return A new substitution constructed according to the description
*/
public static NFSubstitution makeSubstitution(int pos,
NFRule rule,
NFRule rulePredecessor,
NFRuleSet ruleSet,
RuleBasedNumberFormat formatter,
String description) {
// if the description is empty, return a NullSubstitution
if (description.length() == 0) {
return null;
}
switch (description.charAt(0)) {
case '<':
if (rule.getBaseValue() == NFRule.NEGATIVE_NUMBER_RULE) {
// throw an exception if the rule is a negative number rule
///CLOVER:OFF
// If you look at the call hierarchy of this method, the rule would
// never be directly modified by the user and therefore makes the
// following pointless unless the user changes the ruleset.
throw new IllegalArgumentException("<< not allowed in negative-number rule");
///CLOVER:ON
}
else if (rule.getBaseValue() == NFRule.IMPROPER_FRACTION_RULE
|| rule.getBaseValue() == NFRule.PROPER_FRACTION_RULE
|| rule.getBaseValue() == NFRule.MASTER_RULE)
{
// if the rule is a fraction rule, return an IntegralPartSubstitution
return new IntegralPartSubstitution(pos, ruleSet, description);
}
else if (ruleSet.isFractionSet()) {
// if the rule set containing the rule is a fraction
// rule set, return a NumeratorSubstitution
return new NumeratorSubstitution(pos, rule.getBaseValue(),
formatter.getDefaultRuleSet(), description);
}
else {
// otherwise, return a MultiplierSubstitution
return new MultiplierSubstitution(pos, rule.getDivisor(), ruleSet,
description);
}
case '>':
if (rule.getBaseValue() == NFRule.NEGATIVE_NUMBER_RULE) {
// if the rule is a negative-number rule, return
// an AbsoluteValueSubstitution
return new AbsoluteValueSubstitution(pos, ruleSet, description);
}
else if (rule.getBaseValue() == NFRule.IMPROPER_FRACTION_RULE
|| rule.getBaseValue() == NFRule.PROPER_FRACTION_RULE
|| rule.getBaseValue() == NFRule.MASTER_RULE)
{
// if the rule is a fraction rule, return a
// FractionalPartSubstitution
return new FractionalPartSubstitution(pos, ruleSet, description);
}
else if (ruleSet.isFractionSet()) {
// if the rule set owning the rule is a fraction rule set,
// throw an exception
///CLOVER:OFF
// If you look at the call hierarchy of this method, the rule would
// never be directly modified by the user and therefore makes the
// following pointless unless the user changes the ruleset.
throw new IllegalArgumentException(">> not allowed in fraction rule set");
///CLOVER:ON
}
else {
// otherwise, return a ModulusSubstitution
return new ModulusSubstitution(pos, rule.getDivisor(), rulePredecessor,
ruleSet, description);
}
case '=':
return new SameValueSubstitution(pos, ruleSet, description);
default:
// and if it's anything else, throw an exception
///CLOVER:OFF
// If you look at the call hierarchy of this method, the rule would
// never be directly modified by the user and therefore makes the
// following pointless unless the user changes the ruleset.
throw new IllegalArgumentException("Illegal substitution character");
///CLOVER:ON
}
}
/**
* Base constructor for substitutions. This constructor sets up the
* fields which are common to all substitutions.
* @param pos The substitution's position in the owning rule's rule
* text
* @param ruleSet The rule set that owns this substitution
* @param description The substitution descriptor (i.e., the text
* inside the token characters)
*/
NFSubstitution(int pos,
NFRuleSet ruleSet,
String description) {
// initialize the substitution's position in its parent rule
this.pos = pos;
int descriptionLen = description.length();
// the description should begin and end with the same character.
// If it doesn't that's a syntax error. Otherwise,
// makeSubstitution() was the only thing that needed to know
// about these characters, so strip them off
if (descriptionLen >= 2 && description.charAt(0) == description.charAt(descriptionLen - 1)) {
description = description.substring(1, descriptionLen - 1);
}
else if (descriptionLen != 0) {
throw new IllegalArgumentException("Illegal substitution syntax");
}
// if the description was just two paired token characters
// (i.e., "<<" or ">>"), it uses the rule set it belongs to to
// format its result
if (description.length() == 0) {
this.ruleSet = ruleSet;
this.numberFormat = null;
}
else if (description.charAt(0) == '%') {
// if the description contains a rule set name, that's the rule
// set we use to format the result: get a reference to the
// names rule set
this.ruleSet = ruleSet.owner.findRuleSet(description);
this.numberFormat = null;
}
else if (description.charAt(0) == '#' || description.charAt(0) == '0') {
// if the description begins with 0 or #, treat it as a
// DecimalFormat pattern, and initialize a DecimalFormat with
// that pattern (then set it to use the DecimalFormatSymbols
// belonging to our formatter)
this.ruleSet = null;
this.numberFormat = (DecimalFormat) ruleSet.owner.getDecimalFormat().clone();
this.numberFormat.applyPattern(description);
}
else if (description.charAt(0) == '>') {
// if the description is ">>>", this substitution bypasses the
// usual rule-search process and always uses the rule that precedes
// it in its own rule set's rule list (this is used for place-value
// notations: formats where you want to see a particular part of
// a number even when it's 0)
this.ruleSet = ruleSet; // was null, thai rules added to control space
this.numberFormat = null;
}
else {
// and of the description is none of these things, it's a syntax error
throw new IllegalArgumentException("Illegal substitution syntax");
}
}
/**
* Set's the substitution's divisor. Used by NFRule.setBaseValue().
* A no-op for all substitutions except multiplier and modulus
* substitutions.
* @param radix The radix of the divisor
* @param exponent The exponent of the divisor
*/
public void setDivisor(int radix, int exponent) {
// a no-op for all substitutions except multiplier and modulus substitutions
}
//-----------------------------------------------------------------------
// boilerplate
//-----------------------------------------------------------------------
/**
* Compares two substitutions for equality
* @param that The substitution to compare this one to
* @return true if the two substitutions are functionally equivalent
*/
public boolean equals(Object that) {
// compare class and all of the fields all substitutions have
// in common
if (that == null) {
return false;
}
if (this == that) {
return true;
}
if (this.getClass() == that.getClass()) {
NFSubstitution that2 = (NFSubstitution)that;
return pos == that2.pos
&& (ruleSet != null || that2.ruleSet == null) // can't compare tree structure, no .equals or recurse
&& (numberFormat == null ? (that2.numberFormat == null) : numberFormat.equals(that2.numberFormat));
}
return false;
}
public int hashCode() {
assert false : "hashCode not designed";
return 42;
}
/**
* Returns a textual description of the substitution
* @return A textual description of the substitution. This might
* not be identical to the description it was created from, but
* it'll produce the same result.
*/
public String toString() {
// use tokenChar() to get the character at the beginning and
// end of the substitution token. In between them will go
// either the name of the rule set it uses, or the pattern of
// the DecimalFormat it uses
if (ruleSet != null) {
return tokenChar() + ruleSet.getName() + tokenChar();
} else {
return tokenChar() + numberFormat.toPattern() + tokenChar();
}
}
//-----------------------------------------------------------------------
// formatting
//-----------------------------------------------------------------------
/**
* Performs a mathematical operation on the number, formats it using
* either ruleSet or decimalFormat, and inserts the result into
* toInsertInto.
* @param number The number being formatted.
* @param toInsertInto The string we insert the result into
* @param position The position in toInsertInto where the owning rule's
* rule text begins (this value is added to this substitution's
* position to determine exactly where to insert the new text)
*/
public void doSubstitution(long number, StringBuffer toInsertInto, int position, int recursionCount) {
if (ruleSet != null) {
// perform a transformation on the number that is dependent
// on the type of substitution this is, then just call its
// rule set's format() method to format the result
long numberToFormat = transformNumber(number);
ruleSet.format(numberToFormat, toInsertInto, position + pos, recursionCount);
} else {
// or perform the transformation on the number (preserving
// the result's fractional part if the formatter it set
// to show it), then use that formatter's format() method
// to format the result
double numberToFormat = transformNumber((double)number);
if (numberFormat.getMaximumFractionDigits() == 0) {
numberToFormat = Math.floor(numberToFormat);
}
toInsertInto.insert(position + pos, numberFormat.format(numberToFormat));
}
}
/**
* Performs a mathematical operation on the number, formats it using
* either ruleSet or decimalFormat, and inserts the result into
* toInsertInto.
* @param number The number being formatted.
* @param toInsertInto The string we insert the result into
* @param position The position in toInsertInto where the owning rule's
* rule text begins (this value is added to this substitution's
* position to determine exactly where to insert the new text)
*/
public void doSubstitution(double number, StringBuffer toInsertInto, int position, int recursionCount) {
// perform a transformation on the number being formatted that
// is dependent on the type of substitution this is
double numberToFormat = transformNumber(number);
if (Double.isInfinite(numberToFormat)) {
// This is probably a minus rule. Combine it with an infinite rule.
NFRule infiniteRule = ruleSet.findRule(Double.POSITIVE_INFINITY);
infiniteRule.doFormat(numberToFormat, toInsertInto, position + pos, recursionCount);
return;
}
// if the result is an integer, from here on out we work in integer
// space (saving time and memory and preserving accuracy)
if (numberToFormat == Math.floor(numberToFormat) && ruleSet != null) {
ruleSet.format((long)numberToFormat, toInsertInto, position + pos, recursionCount);
// if the result isn't an integer, then call either our rule set's
// format() method or our DecimalFormat's format() method to
// format the result
} else {
if (ruleSet != null) {
ruleSet.format(numberToFormat, toInsertInto, position + pos, recursionCount);
} else {
toInsertInto.insert(position + this.pos, numberFormat.format(numberToFormat));
}
}
}
/**
* Subclasses override this function to perform some kind of
* mathematical operation on the number. The result of this operation
* is formatted using the rule set or DecimalFormat that this
* substitution refers to, and the result is inserted into the result
* string.
* @param number The number being formatted
* @return The result of performing the opreration on the number
*/
public abstract long transformNumber(long number);
/**
* Subclasses override this function to perform some kind of
* mathematical operation on the number. The result of this operation
* is formatted using the rule set or DecimalFormat that this
* substitution refers to, and the result is inserted into the result
* string.
* @param number The number being formatted
* @return The result of performing the opreration on the number
*/
public abstract double transformNumber(double number);
//-----------------------------------------------------------------------
// parsing
//-----------------------------------------------------------------------
/**
* Parses a string using the rule set or DecimalFormat belonging
* to this substitution. If there's a match, a mathematical
* operation (the inverse of the one used in formatting) is
* performed on the result of the parse and the value passed in
* and returned as the result. The parse position is updated to
* point to the first unmatched character in the string.
* @param text The string to parse
* @param parsePosition On entry, ignored, but assumed to be 0.
* On exit, this is updated to point to the first unmatched
* character (or 0 if the substitution didn't match)
* @param baseValue A partial parse result that should be
* combined with the result of this parse
* @param upperBound When searching the rule set for a rule
* matching the string passed in, only rules with base values
* lower than this are considered
* @param lenientParse If true and matching against rules fails,
* the substitution will also try matching the text against
* numerals using a default-constructed NumberFormat. If false,
* no extra work is done. (This value is false whenever the
* formatter isn't in lenient-parse mode, but is also false
* under some conditions even when the formatter _is_ in
* lenient-parse mode.)
* @return If there's a match, this is the result of composing
* baseValue with whatever was returned from matching the
* characters. This will be either a Long or a Double. If there's
* no match this is new Long(0) (not null), and parsePosition
* is left unchanged.
*/
public Number doParse(String text, ParsePosition parsePosition, double baseValue,
double upperBound, boolean lenientParse) {
Number tempResult;
// figure out the highest base value a rule can have and match
// the text being parsed (this varies according to the type of
// substitutions: multiplier, modulus, and numerator substitutions
// restrict the search to rules with base values lower than their
// own; same-value substitutions leave the upper bound wherever
// it was, and the others allow any rule to match
upperBound = calcUpperBound(upperBound);
// use our rule set to parse the text. If that fails and
// lenient parsing is enabled (this is always false if the
// formatter's lenient-parsing mode is off, but it may also
// be false even when the formatter's lenient-parse mode is
// on), then also try parsing the text using a default-
// constructed NumberFormat
if (ruleSet != null) {
tempResult = ruleSet.parse(text, parsePosition, upperBound);
if (lenientParse && !ruleSet.isFractionSet() && parsePosition.getIndex() == 0) {
tempResult = ruleSet.owner.getDecimalFormat().parse(text, parsePosition);
}
// ...or use our DecimalFormat to parse the text
} else {
tempResult = numberFormat.parse(text, parsePosition);
}
// if the parse was successful, we've already advanced the caller's
// parse position (this is the one function that doesn't have one
// of its own). Derive a parse result and return it as a Long,
// if possible, or a Double
if (parsePosition.getIndex() != 0) {
double result = tempResult.doubleValue();
// composeRuleValue() produces a full parse result from
// the partial parse result passed to this function from
// the caller (this is either the owning rule's base value
// or the partial result obtained from composing the
// owning rule's base value with its other substitution's
// parse result) and the partial parse result obtained by
// matching the substitution (which will be the same value
// the caller would get by parsing just this part of the
// text with RuleBasedNumberFormat.parse() ). How the two
// values are used to derive the full parse result depends
// on the types of substitutions: For a regular rule, the
// ultimate result is its multiplier substitution's result
// times the rule's divisor (or the rule's base value) plus
// the modulus substitution's result (which will actually
// supersede part of the rule's base value). For a negative-
// number rule, the result is the negative of its substitution's
// result. For a fraction rule, it's the sum of its two
// substitution results. For a rule in a fraction rule set,
// it's the numerator substitution's result divided by
// the rule's base value. Results from same-value substitutions
// propagate back upward, and null substitutions don't affect
// the result.
result = composeRuleValue(result, baseValue);
if (result == (long)result) {
return Long.valueOf((long)result);
} else {
return new Double(result);
}
// if the parse was UNsuccessful, return 0
} else {
return tempResult;
}
}
/**
* Derives a new value from the two values passed in. The two values
* are typically either the base values of two rules (the one containing
* the substitution and the one matching the substitution) or partial
* parse results derived in some other way. The operation is generally
* the inverse of the operation performed by transformNumber().
* @param newRuleValue The value produced by matching this substitution
* @param oldRuleValue The value that was passed to the substitution
* by the rule that owns it
* @return A third value derived from the other two, representing a
* partial parse result
*/
public abstract double composeRuleValue(double newRuleValue, double oldRuleValue);
/**
* Calculates an upper bound when searching for a rule that matches
* this substitution. Rules with base values greater than or equal
* to upperBound are not considered.
* @param oldUpperBound The current upper-bound setting. The new
* upper bound can't be any higher.
*/
public abstract double calcUpperBound(double oldUpperBound);
//-----------------------------------------------------------------------
// simple accessors
//-----------------------------------------------------------------------
/**
* Returns the substitution's position in the rule that owns it.
* @return The substitution's position in the rule that owns it.
*/
public final int getPos() {
return pos;
}
/**
* Returns the character used in the textual representation of
* substitutions of this type. Used by toString().
* @return This substitution's token character.
*/
abstract char tokenChar();
/**
* Returns true if this is a modulus substitution. (We didn't do this
* with instanceof partially because it causes source files to
* proliferate and partially because we have to port this to C++.)
* @return true if this object is an instance of ModulusSubstitution
*/
public boolean isModulusSubstitution() {
return false;
}
public void setDecimalFormatSymbols(DecimalFormatSymbols newSymbols) {
if (numberFormat != null) {
numberFormat.setDecimalFormatSymbols(newSymbols);
}
}
}
//===================================================================
// SameValueSubstitution
//===================================================================
/**
* A substitution that passes the value passed to it through unchanged.
* Represented by == in rule descriptions.
*/
class SameValueSubstitution extends NFSubstitution {
//-----------------------------------------------------------------------
// construction
//-----------------------------------------------------------------------
/**
* Constructs a SameValueSubstution. This function just uses the
* superclass constructor, but it performs a check that this
* substitution doesn't call the rule set that owns it, since that
* would lead to infinite recursion.
*/
SameValueSubstitution(int pos,
NFRuleSet ruleSet,
String description) {
super(pos, ruleSet, description);
if (description.equals("==")) {
throw new IllegalArgumentException("== is not a legal token");
}
}
//-----------------------------------------------------------------------
// formatting
//-----------------------------------------------------------------------
/**
* Returns "number" unchanged.
* @return "number"
*/
public long transformNumber(long number) {
return number;
}
/**
* Returns "number" unchanged.
* @return "number"
*/
public double transformNumber(double number) {
return number;
}
//-----------------------------------------------------------------------
// parsing
//-----------------------------------------------------------------------
/**
* Returns newRuleValue and ignores oldRuleValue. (The value we got
* matching the substitution supersedes the value of the rule
* that owns the substitution.)
* @param newRuleValue The value resulting from matching the substitution
* @param oldRuleValue The value of the rule containing the
* substitution.
* @return newRuleValue
*/
public double composeRuleValue(double newRuleValue, double oldRuleValue) {
return newRuleValue;
}
/**
* SameValueSubstitution doesn't change the upper bound.
* @param oldUpperBound The current upper bound.
* @return oldUpperBound
*/
public double calcUpperBound(double oldUpperBound) {
return oldUpperBound;
}
//-----------------------------------------------------------------------
// simple accessor
//-----------------------------------------------------------------------
/**
* The token character for a SameValueSubstitution is =.
* @return '='
*/
char tokenChar() {
return '=';
}
}
//===================================================================
// MultiplierSubstitution
//===================================================================
/**
* A substitution that divides the number being formatted by the rule's
* divisor and formats the quotient. Represented by << in normal
* rules.
*/
class MultiplierSubstitution extends NFSubstitution {
//-----------------------------------------------------------------------
// data members
//-----------------------------------------------------------------------
/**
* The divisor of the rule that owns this substitution.
*/
double divisor;
//-----------------------------------------------------------------------
// construction
//-----------------------------------------------------------------------
/**
* Constructs a MultiplierSubstitution. This uses the superclass
* constructor to initialize most members, but this substitution
* also maintains its own copy of its rule's divisor.
* @param pos The substitution's position in its rule's rule text
* @param divisor The owning rule's divisor
* @param ruleSet The ruleSet this substitution uses to format its result
* @param description The description describing this substitution
*/
MultiplierSubstitution(int pos,
double divisor,
NFRuleSet ruleSet,
String description) {
super(pos, ruleSet, description);
// the owning rule's divisor affects the behavior of this
// substitution. Rather than keeping a back-pointer to the
// rule, we keep a copy of the divisor
this.divisor = divisor;
if (divisor == 0) { // this will cause recursion
throw new IllegalStateException("Substitution with divisor 0 " + description.substring(0, pos) +
" | " + description.substring(pos));
}
}
/**
* Sets the substitution's divisor based on the values passed in.
* @param radix The radix of the divisor.
* @param exponent The exponent of the divisor.
*/
public void setDivisor(int radix, int exponent) {
divisor = Math.pow(radix, exponent);
if (divisor == 0) {
throw new IllegalStateException("Substitution with divisor 0");
}
}
//-----------------------------------------------------------------------
// boilerplate
//-----------------------------------------------------------------------
/**
* Augments the superclass's equals() function by comparing divisors.
* @param that The other substitution
* @return true if the two substitutions are functionally equal
*/
public boolean equals(Object that) {
return super.equals(that) && divisor == ((MultiplierSubstitution) that).divisor;
}
//-----------------------------------------------------------------------
// formatting
//-----------------------------------------------------------------------
/**
* Divides the number by the rule's divisor and returns the quotient.
* @param number The number being formatted.
* @return "number" divided by the rule's divisor
*/
public long transformNumber(long number) {
return (long)Math.floor(number / divisor);
}
/**
* Divides the number by the rule's divisor and returns the quotient.
* This is an integral quotient if we're filling in the substitution
* using another rule set, but it's the full quotient (integral and
* fractional parts) if we're filling in the substitution using
* a DecimalFormat. (This allows things such as "1.2 million".)
* @param number The number being formatted
* @return "number" divided by the rule's divisor
*/
public double transformNumber(double number) {
if (ruleSet == null) {
return number / divisor;
} else {
return Math.floor(number / divisor);
}
}
//-----------------------------------------------------------------------
// parsing
//-----------------------------------------------------------------------
/**
* Returns newRuleValue times the divisor. Ignores oldRuleValue.
* (The result of matching a << substitution supersedes the base
* value of the rule that contains it.)
* @param newRuleValue The result of matching the substitution
* @param oldRuleValue The base value of the rule containing the
* substitution
* @return newRuleValue * divisor
*/
public double composeRuleValue(double newRuleValue, double oldRuleValue) {
return newRuleValue * divisor;
}
/**
* Sets the upper bound down to the rule's divisor.
* @param oldUpperBound Ignored.
* @return The rule's divisor.
*/
public double calcUpperBound(double oldUpperBound) {
return divisor;
}
//-----------------------------------------------------------------------
// simple accessor
//-----------------------------------------------------------------------
/**
* The token character for a multiplier substitution is <.
* @return '<'
*/
char tokenChar() {
return '<';
}
}
//===================================================================
// ModulusSubstitution
//===================================================================
/**
* A substitution that divides the number being formatted by the its rule's
* divisor and formats the remainder. Represented by ">>" in a
* regular rule.
*/
class ModulusSubstitution extends NFSubstitution {
//-----------------------------------------------------------------------
// data members
//-----------------------------------------------------------------------
/**
* The divisor of the rule owning this substitution
*/
double divisor;
/**
* If this is a >>> substitution, the rule to use to format
* the substitution value. Otherwise, null.
*/
private final NFRule ruleToUse;
//-----------------------------------------------------------------------
// construction
//-----------------------------------------------------------------------
/**
* Constructs a ModulusSubstitution. In addition to the inherited
* members, a ModulusSubstitution keeps track of the divisor of the
* rule that owns it, and may also keep a reference to the rule
* that precedes the rule containing this substitution in the rule
* set's rule list.
* @param pos The substitution's position in its rule's rule text
* @param divisor The divisor of the rule that owns this substitution
* @param rulePredecessor The rule that precedes this substitution's
* rule in its rule set's rule list
* @param description The description for this substitution
*/
ModulusSubstitution(int pos,
double divisor,
NFRule rulePredecessor,
NFRuleSet ruleSet,
String description)
{
super(pos, ruleSet, description);
// the owning rule's divisor controls the behavior of this
// substitution: rather than keeping a backpointer to the rule,
// we keep a copy of the divisor
this.divisor = divisor;
if (divisor == 0) { // this will cause recursion
throw new IllegalStateException("Substitution with bad divisor (" + divisor + ") "+ description.substring(0, pos) +
" | " + description.substring(pos));
}
// the >>> token doesn't alter how this substitution calculates the
// values it uses for formatting and parsing, but it changes
// what's done with that value after it's obtained: >>> short-
// circuits the rule-search process and goes straight to the
// specified rule to format the substitution value
if (description.equals(">>>")) {
ruleToUse = rulePredecessor;
} else {
ruleToUse = null;
}
}
/**
* Makes the substitution's divisor conform to that of the rule
* that owns it. Used when the divisor is determined after creation.
* @param radix The radix of the divisor.
* @param exponent The exponent of the divisor.
*/
public void setDivisor(int radix, int exponent) {
divisor = Math.pow(radix, exponent);
if (divisor == 0) { // this will cause recursion
throw new IllegalStateException("Substitution with bad divisor");
}
}
//-----------------------------------------------------------------------
// boilerplate
//-----------------------------------------------------------------------
/**
* Augments the inherited equals() function by comparing divisors and
* ruleToUse.
* @param that The other substitution
* @return true if the two substitutions are functionally equivalent
*/
public boolean equals(Object that) {
if (super.equals(that)) {
ModulusSubstitution that2 = (ModulusSubstitution)that;
return divisor == that2.divisor;
} else {
return false;
}
}
//-----------------------------------------------------------------------
// formatting
//-----------------------------------------------------------------------
/**
* If this is a >>> substitution, use ruleToUse to fill in
* the substitution. Otherwise, just use the superclass function.
* @param number The number being formatted
* @param toInsertInto The string to insert the result of this substitution
* into
* @param position The position of the rule text in toInsertInto
*/
public void doSubstitution(long number, StringBuffer toInsertInto, int position, int recursionCount) {
// if this isn't a >>> substitution, just use the inherited version
// of this function (which uses either a rule set or a DecimalFormat
// to format its substitution value)
if (ruleToUse == null) {
super.doSubstitution(number, toInsertInto, position, recursionCount);
} else {
// a >>> substitution goes straight to a particular rule to
// format the substitution value
long numberToFormat = transformNumber(number);
ruleToUse.doFormat(numberToFormat, toInsertInto, position + pos, recursionCount);
}
}
/**
* If this is a >>> substitution, use ruleToUse to fill in
* the substitution. Otherwise, just use the superclass function.
* @param number The number being formatted
* @param toInsertInto The string to insert the result of this substitution
* into
* @param position The position of the rule text in toInsertInto
*/
public void doSubstitution(double number, StringBuffer toInsertInto, int position, int recursionCount) {
// if this isn't a >>> substitution, just use the inherited version
// of this function (which uses either a rule set or a DecimalFormat
// to format its substitution value)
if (ruleToUse == null) {
super.doSubstitution(number, toInsertInto, position, recursionCount);
} else {
// a >>> substitution goes straight to a particular rule to
// format the substitution value
double numberToFormat = transformNumber(number);
ruleToUse.doFormat(numberToFormat, toInsertInto, position + pos, recursionCount);
}
}
/**
* Divides the number being formatted by the rule's divisor and
* returns the remainder.
* @param number The number being formatted
* @return "number" mod divisor
*/
public long transformNumber(long number) {
return (long)Math.floor(number % divisor);
}
/**
* Divides the number being formatted by the rule's divisor and
* returns the remainder.
* @param number The number being formatted
* @return "number" mod divisor
*/
public double transformNumber(double number) {
return Math.floor(number % divisor);
}
//-----------------------------------------------------------------------
// parsing
//-----------------------------------------------------------------------
/**
* If this is a >>> substitution, match only against ruleToUse.
* Otherwise, use the superclass function.
* @param text The string to parse
* @param parsePosition Ignored on entry, updated on exit to point to
* the first unmatched character.
* @param baseValue The partial parse result prior to calling this
* routine.
*/
public Number doParse(String text, ParsePosition parsePosition, double baseValue,
double upperBound, boolean lenientParse) {
// if this isn't a >>> substitution, we can just use the
// inherited parse() routine to do the parsing
if (ruleToUse == null) {
return super.doParse(text, parsePosition, baseValue, upperBound, lenientParse);
} else {
// but if it IS a >>> substitution, we have to do it here: we
// use the specific rule's doParse() method, and then we have to
// do some of the other work of NFRuleSet.parse()
Number tempResult = ruleToUse.doParse(text, parsePosition, false, upperBound);
if (parsePosition.getIndex() != 0) {
double result = tempResult.doubleValue();
result = composeRuleValue(result, baseValue);
if (result == (long)result) {
return Long.valueOf((long)result);
} else {
return new Double(result);
}
} else {
return tempResult;
}
}
}
/**
* Returns the highest multiple of the rule's divisor that its less
* than or equal to oldRuleValue, plus newRuleValue. (The result
* is the sum of the result of parsing the substitution plus the
* base value of the rule containing the substitution, but if the
* owning rule's base value isn't an even multiple of its divisor,
* we have to round it down to a multiple of the divisor, or we
* get unwanted digits in the result.)
* @param newRuleValue The result of parsing the substitution
* @param oldRuleValue The base value of the rule containing the
* substitution
*/
public double composeRuleValue(double newRuleValue, double oldRuleValue) {
return (oldRuleValue - (oldRuleValue % divisor)) + newRuleValue;
}
/**
* Sets the upper bound down to the owning rule's divisor
* @param oldUpperBound Ignored
* @return The owning rule's divisor
*/
public double calcUpperBound(double oldUpperBound) {
return divisor;
}
//-----------------------------------------------------------------------
// simple accessors
//-----------------------------------------------------------------------
/**
* Returns true. This _is_ a ModulusSubstitution.
* @return true
*/
public boolean isModulusSubstitution() {
return true;
}
/**
* The token character of a ModulusSubstitution is >.
* @return '>'
*/
char tokenChar() {
return '>';
}
}
//===================================================================
// IntegralPartSubstitution
//===================================================================
/**
* A substitution that formats the number's integral part. This is
* represented by << in a fraction rule.
*/
class IntegralPartSubstitution extends NFSubstitution {
//-----------------------------------------------------------------------
// construction
//-----------------------------------------------------------------------
/**
* Constructs an IntegralPartSubstitution. This just calls
* the superclass constructor.
*/
IntegralPartSubstitution(int pos,
NFRuleSet ruleSet,
String description) {
super(pos, ruleSet, description);
}
//-----------------------------------------------------------------------
// formatting
//-----------------------------------------------------------------------
/**
* Returns the number's integral part. (For a long, that's just the
* number unchanged.)
* @param number The number being formatted
* @return "number" unchanged
*/
public long transformNumber(long number) {
return number;
}
/**
* Returns the number's integral part.
* @param number The integral part of the number being formatted
* @return floor(number)
*/
public double transformNumber(double number) {
return Math.floor(number);
}
//-----------------------------------------------------------------------
// parsing
//-----------------------------------------------------------------------
/**
* Returns the sum of the result of parsing the substitution and the
* owning rule's base value. (The owning rule, at best, has an
* integral-part substitution and a fractional-part substitution,
* so we can safely just add them.)
* @param newRuleValue The result of matching the substitution
* @param oldRuleValue The partial result of the parse prior to
* calling this function
* @return oldRuleValue + newRuleValue
*/
public double composeRuleValue(double newRuleValue, double oldRuleValue) {
return newRuleValue + oldRuleValue;
}
/**
* An IntegralPartSubstitution sets the upper bound back up so all
* potentially matching rules are considered.
* @param oldUpperBound Ignored
* @return Double.MAX_VALUE
*/
public double calcUpperBound(double oldUpperBound) {
return Double.MAX_VALUE;
}
//-----------------------------------------------------------------------
// simple accessor
//-----------------------------------------------------------------------
/**
* An IntegralPartSubstitution's token character is <
* @return '<'
*/
char tokenChar() {
return '<';
}
}
//===================================================================
// FractionalPartSubstitution
//===================================================================
/**
* A substitution that formats the fractional part of a number. This is
* represented by >> in a fraction rule.
*/
class FractionalPartSubstitution extends NFSubstitution {
//-----------------------------------------------------------------------
// data members
//-----------------------------------------------------------------------
/**
* true if this substitution should have the default "by digits"
* behavior, false otherwise
*/
private final boolean byDigits;
/**
* true if we automatically insert spaces to separate names of digits
* set to false by '>>>' in fraction rules, used by Thai.
*/
private final boolean useSpaces;
//-----------------------------------------------------------------------
// construction
//-----------------------------------------------------------------------
/**
* Constructs a FractionalPartSubstitution. This object keeps a flag
* telling whether it should format by digits or not. In addition,
* it marks the rule set it calls (if any) as a fraction rule set.
*/
FractionalPartSubstitution(int pos,
NFRuleSet ruleSet,
String description) {
super(pos, ruleSet, description);
if (description.equals(">>") || description.equals(">>>") || ruleSet == this.ruleSet) {
byDigits = true;
useSpaces = !description.equals(">>>");
} else {
byDigits = false;
useSpaces = true;
this.ruleSet.makeIntoFractionRuleSet();
}
}
//-----------------------------------------------------------------------
// formatting
//-----------------------------------------------------------------------
/**
* If in "by digits" mode, fills in the substitution one decimal digit
* at a time using the rule set containing this substitution.
* Otherwise, uses the superclass function.
* @param number The number being formatted
* @param toInsertInto The string to insert the result of formatting
* the substitution into
* @param position The position of the owning rule's rule text in
* toInsertInto
*/
public void doSubstitution(double number, StringBuffer toInsertInto, int position, int recursionCount) {
if (!byDigits) {
// if we're not in "byDigits" mode, just use the inherited
// doSubstitution() routine
super.doSubstitution(number, toInsertInto, position, recursionCount);
}
else {
// if we're in "byDigits" mode, transform the value into an integer
// by moving the decimal point eight places to the right and
// pulling digits off the right one at a time, formatting each digit
// as an integer using this substitution's owning rule set
// (this is slower, but more accurate, than doing it from the
// other end)
// just print to string and then use that
DigitList dl = new DigitList();
dl.set(number, 20, true);
boolean pad = false;
while (dl.count > Math.max(0, dl.decimalAt)) {
if (pad && useSpaces) {
toInsertInto.insert(position + pos, ' ');
} else {
pad = true;
}
ruleSet.format(dl.digits[--dl.count] - '0', toInsertInto, position + pos, recursionCount);
}
while (dl.decimalAt < 0) {
if (pad && useSpaces) {
toInsertInto.insert(position + pos, ' ');
} else {
pad = true;
}
ruleSet.format(0, toInsertInto, position + pos, recursionCount);
++dl.decimalAt;
}
}
}
/**
* Returns the fractional part of the number, which will always be
* zero if it's a long.
* @param number The number being formatted
* @return 0
*/
public long transformNumber(long number) {
return 0;
}
/**
* Returns the fractional part of the number.
* @param number The number being formatted.
* @return number - floor(number)
*/
public double transformNumber(double number) {
return number - Math.floor(number);
}
//-----------------------------------------------------------------------
// parsing
//-----------------------------------------------------------------------
/**
* If in "by digits" mode, parses the string as if it were a string
* of individual digits; otherwise, uses the superclass function.
* @param text The string to parse
* @param parsePosition Ignored on entry, but updated on exit to point
* to the first unmatched character
* @param baseValue The partial parse result prior to entering this
* function
* @param upperBound Only consider rules with base values lower than
* this when filling in the substitution
* @param lenientParse If true, try matching the text as numerals if
* matching as words doesn't work
* @return If the match was successful, the current partial parse
* result; otherwise new Long(0). The result is either a Long or
* a Double.
*/
public Number doParse(String text, ParsePosition parsePosition, double baseValue,
double upperBound, boolean lenientParse) {
// if we're not in byDigits mode, we can just use the inherited
// doParse()
if (!byDigits) {
return super.doParse(text, parsePosition, baseValue, 0, lenientParse);
}
else {
// if we ARE in byDigits mode, parse the text one digit at a time
// using this substitution's owning rule set (we do this by setting
// upperBound to 10 when calling doParse() ) until we reach
// nonmatching text
String workText = text;
ParsePosition workPos = new ParsePosition(1);
double result;
int digit;
DigitList dl = new DigitList();
while (workText.length() > 0 && workPos.getIndex() != 0) {
workPos.setIndex(0);
digit = ruleSet.parse(workText, workPos, 10).intValue();
if (lenientParse && workPos.getIndex() == 0) {
Number n = ruleSet.owner.getDecimalFormat().parse(workText, workPos);
if (n != null) {
digit = n.intValue();
}
}
if (workPos.getIndex() != 0) {
dl.append('0'+digit);
parsePosition.setIndex(parsePosition.getIndex() + workPos.getIndex());
workText = workText.substring(workPos.getIndex());
while (workText.length() > 0 && workText.charAt(0) == ' ') {
workText = workText.substring(1);
parsePosition.setIndex(parsePosition.getIndex() + 1);
}
}
}
result = dl.count == 0 ? 0 : dl.getDouble();
result = composeRuleValue(result, baseValue);
return new Double(result);
}
}
/**
* Returns the sum of the two partial parse results.
* @param newRuleValue The result of parsing the substitution
* @param oldRuleValue The partial parse result prior to calling
* this function
* @return newRuleValue + oldRuleValue
*/
public double composeRuleValue(double newRuleValue, double oldRuleValue) {
return newRuleValue + oldRuleValue;
}
/**
* Not used.
*/
public double calcUpperBound(double oldUpperBound) {
return 0; // this value is ignored
}
//-----------------------------------------------------------------------
// simple accessor
//-----------------------------------------------------------------------
/**
* The token character for a FractionalPartSubstitution is >.
* @return '>'
*/
char tokenChar() {
return '>';
}
}
//===================================================================
// AbsoluteValueSubstitution
//===================================================================
/**
* A substitution that formats the absolute value of the number.
* This substitution is represented by >> in a negative-number rule.
*/
class AbsoluteValueSubstitution extends NFSubstitution {
//-----------------------------------------------------------------------
// construction
//-----------------------------------------------------------------------
/**
* Constructs an AbsoluteValueSubstitution. This just uses the
* superclass constructor.
*/
AbsoluteValueSubstitution(int pos,
NFRuleSet ruleSet,
String description) {
super(pos, ruleSet, description);
}
//-----------------------------------------------------------------------
// formatting
//-----------------------------------------------------------------------
/**
* Returns the absolute value of the number.
* @param number The number being formatted.
* @return abs(number)
*/
public long transformNumber(long number) {
return Math.abs(number);
}
/**
* Returns the absolute value of the number.
* @param number The number being formatted.
* @return abs(number)
*/
public double transformNumber(double number) {
return Math.abs(number);
}
//-----------------------------------------------------------------------
// parsing
//-----------------------------------------------------------------------
/**
* Returns the additive inverse of the result of parsing the
* substitution (this supersedes the earlier partial result)
* @param newRuleValue The result of parsing the substitution
* @param oldRuleValue The partial parse result prior to calling
* this function
* @return -newRuleValue
*/
public double composeRuleValue(double newRuleValue, double oldRuleValue) {
return -newRuleValue;
}
/**
* Sets the upper bound beck up to consider all rules
* @param oldUpperBound Ignored.
* @return Double.MAX_VALUE
*/
public double calcUpperBound(double oldUpperBound) {
return Double.MAX_VALUE;
}
//-----------------------------------------------------------------------
// simple accessor
//-----------------------------------------------------------------------
/**
* The token character for an AbsoluteValueSubstitution is >
* @return '>'
*/
char tokenChar() {
return '>';
}
}
//===================================================================
// NumeratorSubstitution
//===================================================================
/**
* A substitution that multiplies the number being formatted (which is
* between 0 and 1) by the base value of the rule that owns it and
* formats the result. It is represented by << in the rules
* in a fraction rule set.
*/
class NumeratorSubstitution extends NFSubstitution {
//-----------------------------------------------------------------------
// data members
//-----------------------------------------------------------------------
/**
* The denominator of the fraction we're finding the numerator for.
* (The base value of the rule that owns this substitution.)
*/
private final double denominator;
/**
* True if we format leading zeros (this is a hack for Hebrew spellout)
*/
private final boolean withZeros;
//-----------------------------------------------------------------------
// construction
//-----------------------------------------------------------------------
/**
* Constructs a NumeratorSubstitution. In addition to the inherited
* fields, a NumeratorSubstitution keeps track of a denominator, which
* is merely the base value of the rule that owns it.
*/
NumeratorSubstitution(int pos,
double denominator,
NFRuleSet ruleSet,
String description) {
super(pos, ruleSet, fixdesc(description));
// this substitution's behavior depends on the rule's base value
// Rather than keeping a backpointer to the rule, we copy its
// base value here
this.denominator = denominator;
this.withZeros = description.endsWith("<<");
}
static String fixdesc(String description) {
return description.endsWith("<<")
? description.substring(0,description.length()-1)
: description;
}
//-----------------------------------------------------------------------
// boilerplate
//-----------------------------------------------------------------------
/**
* Tests two NumeratorSubstitutions for equality
* @param that The other NumeratorSubstitution
* @return true if the two objects are functionally equivalent
*/
public boolean equals(Object that) {
if (super.equals(that)) {
NumeratorSubstitution that2 = (NumeratorSubstitution)that;
return denominator == that2.denominator && withZeros == that2.withZeros;
} else {
return false;
}
}
//-----------------------------------------------------------------------
// formatting
//-----------------------------------------------------------------------
/**
* Performs a mathematical operation on the number, formats it using
* either ruleSet or decimalFormat, and inserts the result into
* toInsertInto.
* @param number The number being formatted.
* @param toInsertInto The string we insert the result into
* @param position The position in toInsertInto where the owning rule's
* rule text begins (this value is added to this substitution's
* position to determine exactly where to insert the new text)
*/
public void doSubstitution(double number, StringBuffer toInsertInto, int position, int recursionCount) {
// perform a transformation on the number being formatted that
// is dependent on the type of substitution this is
//String s = toInsertInto.toString();
double numberToFormat = transformNumber(number);
if (withZeros && ruleSet != null) {
// if there are leading zeros in the decimal expansion then emit them
long nf = (long)numberToFormat;
int len = toInsertInto.length();
while ((nf *= 10) < denominator) {
toInsertInto.insert(position + pos, ' ');
ruleSet.format(0, toInsertInto, position + pos, recursionCount);
}
position += toInsertInto.length() - len;
}
// if the result is an integer, from here on out we work in integer
// space (saving time and memory and preserving accuracy)
if (numberToFormat == Math.floor(numberToFormat) && ruleSet != null) {
ruleSet.format((long)numberToFormat, toInsertInto, position + pos, recursionCount);
// if the result isn't an integer, then call either our rule set's
// format() method or our DecimalFormat's format() method to
// format the result
} else {
if (ruleSet != null) {
ruleSet.format(numberToFormat, toInsertInto, position + pos, recursionCount);
} else {
toInsertInto.insert(position + pos, numberFormat.format(numberToFormat));
}
}
}
/**
* Returns the number being formatted times the denominator.
* @param number The number being formatted
* @return number * denominator
*/
public long transformNumber(long number) {
return Math.round(number * denominator);
}
/**
* Returns the number being formatted times the denominator.
* @param number The number being formatted
* @return number * denominator
*/
public double transformNumber(double number) {
return Math.round(number * denominator);
}
//-----------------------------------------------------------------------
// parsing
//-----------------------------------------------------------------------
/**
* Dispatches to the inherited version of this function, but makes
* sure that lenientParse is off.
*/
public Number doParse(String text, ParsePosition parsePosition, double baseValue,
double upperBound, boolean lenientParse) {
// we don't have to do anything special to do the parsing here,
// but we have to turn lenient parsing off-- if we leave it on,
// it SERIOUSLY messes up the algorithm
// if withZeros is true, we need to count the zeros
// and use that to adjust the parse result
int zeroCount = 0;
if (withZeros) {
String workText = text;
ParsePosition workPos = new ParsePosition(1);
//int digit;
while (workText.length() > 0 && workPos.getIndex() != 0) {
workPos.setIndex(0);
/*digit = */ruleSet.parse(workText, workPos, 1).intValue(); // parse zero or nothing at all
if (workPos.getIndex() == 0) {
// we failed, either there were no more zeros, or the number was formatted with digits
// either way, we're done
break;
}
++zeroCount;
parsePosition.setIndex(parsePosition.getIndex() + workPos.getIndex());
workText = workText.substring(workPos.getIndex());
while (workText.length() > 0 && workText.charAt(0) == ' ') {
workText = workText.substring(1);
parsePosition.setIndex(parsePosition.getIndex() + 1);
}
}
text = text.substring(parsePosition.getIndex()); // arrgh!
parsePosition.setIndex(0);
}
// we've parsed off the zeros, now let's parse the rest from our current position
Number result = super.doParse(text, parsePosition, withZeros ? 1 : baseValue, upperBound, false);
if (withZeros) {
// any base value will do in this case. is there a way to
// force this to not bother trying all the base values?
// compute the 'effective' base and prescale the value down
long n = result.longValue();
long d = 1;
while (d <= n) {
d *= 10;
}
// now add the zeros
while (zeroCount > 0) {
d *= 10;
--zeroCount;
}
// d is now our true denominator
result = new Double(n/(double)d);
}
return result;
}
/**
* Divides the result of parsing the substitution by the partial
* parse result.
* @param newRuleValue The result of parsing the substitution
* @param oldRuleValue The owning rule's base value
* @return newRuleValue / oldRuleValue
*/
public double composeRuleValue(double newRuleValue, double oldRuleValue) {
return newRuleValue / oldRuleValue;
}
/**
* Sets the upper bound down to this rule's base value
* @param oldUpperBound Ignored
* @return The base value of the rule owning this substitution
*/
public double calcUpperBound(double oldUpperBound) {
return denominator;
}
//-----------------------------------------------------------------------
// simple accessor
//-----------------------------------------------------------------------
/**
* The token character for a NumeratorSubstitution is <
* @return '<'
*/
char tokenChar() {
return '<';
}
}
| [
"Justin"
] | Justin |
d6c3deffdb41208036e5d715c2c105e29b4c10ee | eff9b41c3727cfbe5750245c8f05e94720d64c33 | /code/app/src/main/java/com/thetechsolutions/whodouconsumer/Signup/activities/SignupActivity.java | e60f1dcbb9f34908abec0338cb61d6900039105f | [] | no_license | uzairsabir/consumer | 15a132d3fb7a70a05d3f2cb96ee981dce561b328 | b1f53caf9834223bcb5cf6173d0f185feb230d47 | refs/heads/master | 2020-01-24T20:53:28.584999 | 2017-03-08T19:23:54 | 2017-03-08T19:23:54 | 73,853,361 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 24,798 | java | package com.thetechsolutions.whodouconsumer.Signup.activities;
import android.Manifest;
import android.app.Activity;
import android.app.Dialog;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.AsyncTask;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.afollestad.materialdialogs.GravityEnum;
import com.afollestad.materialdialogs.MaterialDialog;
import com.andreabaccega.widget.FormEditText;
import com.github.pinball83.maskededittext.MaskedEditText;
import com.mukesh.countrypicker.fragments.CountryPicker;
import com.mukesh.countrypicker.interfaces.CountryPickerListener;
import com.thetechsolutions.whodouconsumer.AppHelpers.Config.AppConstants;
import com.thetechsolutions.whodouconsumer.AppHelpers.Controllers.AppController;
import com.thetechsolutions.whodouconsumer.AppHelpers.Controllers.ListenerController;
import com.thetechsolutions.whodouconsumer.AppHelpers.DataBase.RealmDataRetrive;
import com.thetechsolutions.whodouconsumer.AppHelpers.DataTypes.ProfileDT;
import com.thetechsolutions.whodouconsumer.HomeScreenActivity;
import com.thetechsolutions.whodouconsumer.R;
import com.thetechsolutions.whodouconsumer.Signup.controllers.SignUpAsynController;
import org.vanguardmatrix.engine.android.AppPreferences;
import org.vanguardmatrix.engine.utils.MyLogs;
import org.vanguardmatrix.engine.utils.NetworkManager;
import org.vanguardmatrix.engine.utils.PermissionHandler;
import org.vanguardmatrix.engine.utils.UtilityFunctions;
import java.util.HashMap;
import java.util.Map;
import eu.siacs.conversations.ui.MagicCreateActivity;
/**
* Created by Uzair on 12/6/2015.
*/
public class SignupActivity extends MagicCreateActivity implements View.OnClickListener {
private static final int TIME_DELAY = 2000;
public static boolean isRegisterationScreen, isCodeInputScreen;
private static long back_pressed;
Activity activity;
//EditText _edit_phone;
Dialog workDialog;
RelativeLayout bottomLay;
String inputPhoneNumber, fName, lName, email, code1, code2, code3, code4;
int zipCode;
Button signup_btn;
MaskedEditText country_number;
TextView country_name, country_code, term_text;
String finalNumber;
MaterialDialog term_and_condition_dialoge;
public static Intent createIntent(Activity activity) {
return new Intent(activity, SignupActivity.class);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login_with_number);
activity = this;
viewsInitialize();
viewHandler();
try {
getActionBar().hide();
} catch (Exception e) {
}
}
private void viewHandler() {
if (isRegisterationScreen) {
callRegisterationDialog(activity);
} else if (isCodeInputScreen) {
callInputCodeDialog(activity);
}
}
private void viewsInitialize() {
// try {
// BaseFlagFragment.initUI(activity);
// } catch (Exception e) {
// e.printStackTrace();
// }
// try {
// BaseFlagFragment.initCodes(activity);
//
// } catch (Exception e) {
// e.printStackTrace();
// }
try {
country_name = (TextView) findViewById(R.id.country_name);
country_code = (TextView) findViewById(R.id.country_code);
term_text = (TextView) findViewById(R.id.term_text);
//final android.app.FragmentTransaction fragmentTransaction= getFragmentManager().beginTransaction();
term_text.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
term_and_condition_dialoge = new MaterialDialog.Builder(activity)
.title("Privacy Policy")
.content("This privacy policy governs your use of the software application Whodou (“Application”) for mobile\n" +
"\n" +
"devices that was created by Pingem, Inc.. The Application is a consumer oriented platform that allows the\n" +
"\n" +
"consumer to engage with existing providers via live chat, scheduling, payment and general coordination of\n" +
"\n" +
"the consumer/vendor relationship. Additionally, the Application allow consumers to add their friends in\n" +
"\n" +
"order to seamlessly share their go-to vendors.\n" +
"\n" +
"User Provided Information \n" +
"\n" +
"The Application obtains the information you provide when you download and register the Application. \n" +
"\n" +
"Registration with us is mandatory in order to be able to use the basic features of the Application.\n" +
"\n" +
"When you register with us and use the Application, you generally provide (a) your name, email address,\n" +
"\n" +
"age, user name, password and other registration information; (b) transaction-related information, such as\n" +
"\n" +
"when you make purchases, respond to any offers, or download or use applications from us; (c) information\n" +
"\n" +
"you provide us when you contact us for help; (d) credit card information for purchase and use of the\n" +
"\n" +
"Application, and; (e) information you enter into our system when using the Application, such as contact\n" +
"\n" +
"information and project management information.\n" +
"\n" +
"We may also use the information you provided us to contact your from time to time to provide you with\n" +
"\n" +
"important information, required notices and marketing promotions.")
.contentGravity(GravityEnum.CENTER)
.backgroundColor(activity.getResources().getColor(R.color.white))
.titleColor(activity.getResources().getColor(R.color.black))
.contentColor(activity.getResources().getColor(R.color.who_do_u_medium_grey))
.show();
}
});
country_name.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
final CountryPicker picker = CountryPicker.newInstance("Select Country");
picker.show(getSupportFragmentManager(), "COUNTRY_PICKER");
picker.setListener(new CountryPickerListener() {
@Override
public void onSelectCountry(String name, String code, String dialCode, int flagDrawableResID) {
country_code.setText(dialCode);
country_name.setText(name);
picker.dismiss();
}
});
}
});
try {
country_number = (MaskedEditText) findViewById(R.id.country_number);
} catch (Exception e) {
}
} catch (Exception e) {
}
bottomLay = (RelativeLayout) findViewById(R.id.bottom_lay);
bottomLay.setVisibility(View.GONE);
// country_container = (LinearLayout) findViewById(R.id.country_container);
// _edit_phone = (EditText) findViewById(R.id.phone);
signup_btn = (Button) findViewById(R.id.signup_btn);
signup_btn.setOnClickListener(this);
UtilityFunctions.showKeyboard(activity);
country_number.setFocusable(true);
}
@Override
public void onBackPressed() {
if (back_pressed + TIME_DELAY > System.currentTimeMillis()) {
super.onBackPressed();
try {
HomeScreenActivity.activity.finish();
} catch (Exception e) {
}
} else {
UtilityFunctions.showToast_onCenter("Press once again to exit", activity);
}
back_pressed = System.currentTimeMillis();
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.signup_btn:
if (country_number.getUnmaskedText().length() == 10) {
finalNumber = country_code.getText().toString() + country_number.getUnmaskedText();
AppPreferences.setString(AppPreferences.PREF_USER_COUNTRY_CODE, country_code.getText().toString().replace("+", ""));
inputNumberValidator(finalNumber);
} else {
UtilityFunctions.showToast_onCenter(activity.getString(R.string.please_format_number), activity);
}
break;
default:
break;
}
}
public void callSignUpAsyn(String signUpType) {
if (UtilityFunctions.checkInternet(activity)) {
new SignUpAsync(activity, signUpType).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}
public void callRegisterationDialog(final Activity activity) {
isRegisterationScreen = true;
workDialog = new Dialog(activity);
workDialog.setCancelable(false);
workDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
workDialog.setContentView(R.layout.dialoge_signup_registeration);
final FormEditText first_Name = (FormEditText) workDialog.findViewById(R.id.first_name);
final FormEditText last_Name = (FormEditText) workDialog.findViewById(R.id.last_name);
final FormEditText email_address = (FormEditText) workDialog.findViewById(R.id.email_name);
final FormEditText zip_Code = (FormEditText) workDialog.findViewById(R.id.zip_code);
// categorySelectedText = (TextView) workDialog.findViewById(R.id.categorylist);
// subcategorylist = (TextView) workDialog.findViewById(R.id.subcategorylist);
Window window = workDialog.getWindow();
window.setLayout(WindowManager.LayoutParams.FILL_PARENT, AppPreferences.getInt(AppPreferences.PREF_DEVICE_HEIGHT) - 600);
workDialog.show();
Button declineButton = (Button) workDialog.findViewById(R.id.cancel_btn);
final Button acceptButton = (Button) workDialog.findViewById(R.id.signup_btn);
acceptButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
fName = first_Name.getText().toString();
lName = last_Name.getText().toString();
email = email_address.getText().toString();
zipCode = Integer.parseInt(zip_Code.getText().toString());
} catch (Exception e) {
}
validatorReg(first_Name, email_address, zip_Code);
isRegisterationScreen = false;
}
});
declineButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
workDialog.dismiss();
isRegisterationScreen = false;
}
});
if (AppPreferences.getString(AppPreferences.PREF_USER_STATUS).equals(AppConstants.USER_NOT_ON_APP)) {
ProfileDT profileDTs = RealmDataRetrive.getProfile();
if (profileDTs != null) {
first_Name.setText(profileDTs.getFirst_name());
last_Name.setText(profileDTs.getLast_name());
email_address.setText(profileDTs.getEmail_1());
try {
zip_Code.setText(profileDTs.getZip_code());
} catch (Exception e) {
}
}
}
email_address.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
workDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
}
}
});
// UtilityFunctions.showKeyboard(activity);
//email_address.setFocusable(true);
//email_address.setFocusableInTouchMode(true);
}
public void callInputCodeDialog(final Activity activity) {
workDialog = new Dialog(activity);
isCodeInputScreen = true;
workDialog.setCancelable(false);
workDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
workDialog.setContentView(R.layout.dialoge_signup_input_code);
final FormEditText code_1 = (FormEditText) workDialog.findViewById(R.id.code_one);
final FormEditText code_2 = (FormEditText) workDialog.findViewById(R.id.code_two);
final FormEditText code_3 = (FormEditText) workDialog.findViewById(R.id.code_three);
final FormEditText code_4 = (FormEditText) workDialog.findViewById(R.id.code_four);
// UtilityFunctions.showSoftKeyboard(activity, code_1);
code_1.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (count == 1) {
code_2.requestFocus();
}
}
@Override
public void afterTextChanged(Editable s) {
}
});
code_2.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (count == 1) {
code_3.requestFocus();
}
}
@Override
public void afterTextChanged(Editable s) {
}
});
code_3.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (count == 1) {
code_4.requestFocus();
}
}
@Override
public void afterTextChanged(Editable s) {
}
});
code_4.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (count == 1) {
UtilityFunctions.hideKeyboard(activity);
}
}
@Override
public void afterTextChanged(Editable s) {
}
});
workDialog.show();
Window window = workDialog.getWindow();
window.setLayout(WindowManager.LayoutParams.FILL_PARENT, WindowManager.LayoutParams.WRAP_CONTENT);
Button declineButton = (Button) workDialog.findViewById(R.id.cancel_btn);
final Button acceptButton = (Button) workDialog.findViewById(R.id.signup_btn);
acceptButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
validatorCode(code_1, code_2, code_3, code_4);
}
});
declineButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
workDialog.dismiss();
isCodeInputScreen = false;
}
});
code_1.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
workDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
}
}
});
}
public class SignUpAsync extends AsyncTask<String, Void, Integer> {
Activity _activity;
String signup_type;
public SignUpAsync(Activity activity, String _signup_type) {
_activity = activity;
signup_type = _signup_type;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
AppController.showDialoge(activity);
try {
workDialog.dismiss();
} catch (Exception e) {
}
}
@Override
protected Integer doInBackground(String... params) {
try {
if (signup_type.equals(AppConstants.SIGNUP_FUNCTION_TYPE_NUMBER_VERIFICATION)) {
if (SignUpAsynController.getInstance().callUserExistence(activity,inputPhoneNumber)) {
return 0;
}
} else if (signup_type.equals(AppConstants.SIGNUP_FUNCTION_TYPE_REGISTRATION)) {
if (SignUpAsynController.getInstance().callRegisteration(email, fName, lName, zipCode))
return 1;
} else if (signup_type.equals(AppConstants.SIGNUP_FUNCTION_TYPE_CODE_VERIFICATION)) {
if (SignUpAsynController.getInstance().callCodeVerification(activity, code1 + code2 + code3 + code4))
return 2;
}
} catch (Exception e) {
e.printStackTrace();
}
return 4;
}
@Override
protected void onPostExecute(Integer result) {
super.onPostExecute(result);
AppController.hideDialoge();
try {
workDialog.dismiss();
} catch (Exception e) {
}
if (!NetworkManager.isConnected(activity)) {
AppController.showToast(activity, "No Internet Connectivity");
} else {
if (result == 0) {
if (AppPreferences.getString(AppPreferences.PREF_USER_STATUS).equals(AppConstants.USER_NEW) ||
AppPreferences.getString(AppPreferences.PREF_USER_STATUS).equals(AppConstants.USER_NOT_ON_APP)) {
callRegisterationDialog(activity);
} else if (AppPreferences.getString(AppPreferences.PREF_USER_STATUS).equals(AppConstants.USER_REGISTERED)) {
callInputCodeDialog(activity);
}
} else if (result == 1) {
callInputCodeDialog(activity);
} else if (result == 2) {
MyLogs.printinfo("verified " + RealmDataRetrive.getProfile().getUsername() + "_c");
try {
createXmppConnection(RealmDataRetrive.getProfile().getUsername() + "_c", "1234");
} catch (Exception e) {
}
if (PermissionHandler.allPermissionsHandler(activity)) {
AppPreferences.setBoolean(AppPreferences.PREF_REGISTERATION_DONE, true);
AppPreferences.setBoolean(AppPreferences.PREF_IS_SIGNUP_DONE, true);
ListenerController.openInitProgressActivity(activity);
activity.finish();
}
} else {
if (signup_type.equals(AppConstants.SIGNUP_FUNCTION_TYPE_NUMBER_VERIFICATION) || signup_type.equals(AppConstants.SIGNUP_FUNCTION_TYPE_REGISTRATION)) {
AppController.showToast(activity, "Something went wrong!");
} else if (signup_type.equals(AppConstants.SIGNUP_FUNCTION_TYPE_CODE_VERIFICATION)) {
AppController.showToast(activity, "Please enter correct code");
callInputCodeDialog(activity);
}
}
}
}
}
private void inputNumberValidator(String completeNumber) {
MyLogs.printinfo("country_code " + AppPreferences.getString(AppPreferences.PREF_USER_COUNTRY_CODE));
inputPhoneNumber = completeNumber;
if (UtilityFunctions.isEmpty(inputPhoneNumber)) {
UtilityFunctions.showToast_onCenter(activity.getString(R.string.please_filled), activity);
return;
}
// if (!UtilityFunctions.isContainSpaces(inputPhoneNumber)) {
// UtilityFunctions.showToast_onCenter(activity.getString(R.string.please_format_number), activity);
// return;
// }
inputPhoneNumber = UtilityFunctions.getstandarizeNumber(inputPhoneNumber, activity);
new SignUpAsync(activity, AppConstants.SIGNUP_FUNCTION_TYPE_NUMBER_VERIFICATION).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
switch (requestCode) {
case PermissionHandler.REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS: {
Map<String, Integer> perms = new HashMap<String, Integer>();
perms.put(Manifest.permission.READ_CONTACTS, PackageManager.PERMISSION_GRANTED);
for (int i = 0; i < permissions.length; i++)
perms.put(permissions[i], grantResults[i]);
if (perms.get(Manifest.permission.READ_CONTACTS) == PackageManager.PERMISSION_GRANTED) {
try {
AppPreferences.setBoolean(AppPreferences.PREF_REGISTERATION_DONE, true);
AppPreferences.setBoolean(AppPreferences.PREF_IS_SIGNUP_DONE, true);
ListenerController.openInitProgressActivity(activity);
activity.finish();
} catch (Exception e) {
}
} else {
UtilityFunctions.showToast_onCenter("Some Permission is Denied", activity);
}
}
break;
default:
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
}
private void validatorReg(FormEditText firstName, FormEditText email, FormEditText zip_code) {
FormEditText[] allFields;
allFields = new FormEditText[]{firstName, email, zip_code};
boolean allValid = true;
for (FormEditText field : allFields) {
allValid = field.testValidity() && allValid;
}
if (allValid) {
callSignUpAsyn(AppConstants.SIGNUP_FUNCTION_TYPE_REGISTRATION);
}
}
private void validatorCode(FormEditText _code1, FormEditText _code2, FormEditText _code3, FormEditText _code4) {
FormEditText[] allFields = {_code1, _code2, _code3, _code4};
boolean allValid = true;
for (FormEditText field : allFields) {
allValid = field.testValidity() && allValid;
}
code1 = _code1.getText().toString();
code2 = _code2.getText().toString();
code3 = _code3.getText().toString();
code4 = _code4.getText().toString();
if (allValid) {
callSignUpAsyn(AppConstants.SIGNUP_FUNCTION_TYPE_CODE_VERIFICATION);
} else {
}
}
}
| [
"uzair92ssuet92@gmail.com"
] | uzair92ssuet92@gmail.com |
ebbfe6836cf5fec99d20a528fa2e8754717dd323 | 7ac0cc2c28bb479caf7d1402e3a6d094a35b0559 | /problems/rodCutting/RodCutting.java | d29b8ebe935043ea7ca4dfa96adf4eb1fe4d5c76 | [] | no_license | luisalfonsopreciado/The-Algorithms | 5349c499d43c73721673165fe261cb9fc8c5caf0 | 8ed01ff59c757228ce9288b405b273661e4d7f46 | refs/heads/master | 2023-05-03T03:26:20.154530 | 2021-05-25T22:48:10 | 2021-05-25T22:48:10 | 314,413,738 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 725 | java | package problems.rodCutting;
public class RodCutting {
public static int maxProfitBottomUp(int[] prices, int n) {
if (prices.length < n || n < 0) {
System.out.println("Invalid Input");
return -1;
}
int[] dp = new int[n + 1];
dp[1] = prices[0];
for (int i = 2; i < dp.length; i++) {
dp[i] = prices[i - 1];
for (int j = 1; j <= i / 2; j++) {
dp[i] = Math.max(dp[i], dp[j] + dp[i - j]);
}
}
return dp[n];
}
public static void main(String[] args) {
int[] prices = { 1, 5, 8, 9, 10, 17, 17, 20, 24, 30 };
System.out.println(maxProfitBottomUp(prices, 10));
}
}
| [
"luisapreciado99@gmail.com"
] | luisapreciado99@gmail.com |
bec4cbebe86af412a5af9b5b92849aaf175f58f5 | 3e312492b0d5f4a9b01bd91e31fb01d3d3b4b7ae | /src/main/java/group/uchain/oilsupplychain/vo/OrdersVO.java | 054f4c49452ad79e911e752b1598befbed04341f | [] | no_license | Jayrunz/oil-supply-chain | b99b55f7c77247be8f00f7fb900f3c0ec72d205d | 6f37680a1b41d315c42f902cd7ebd9fd06e83cef | refs/heads/master | 2022-04-05T21:11:31.050149 | 2020-03-05T12:44:46 | 2020-03-05T12:44:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 603 | java | package group.uchain.oilsupplychain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @author panghu
* @title: OrdersVO
* @projectName oil-supply-chain
* @date 19-4-5 下午3:13
*/
@Data
public class OrdersVO implements Serializable {
private static final long serialVersionUID = -8090707222074181693L;
private String id;
private String batchNumber;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT-5 ")
private Date date;
private String from;
private String to;
}
| [
"123@panghu.com"
] | 123@panghu.com |
f9ded3ff20b39c66614b13ba88c9fd8d858ee4e6 | c1e75c31cdd3c1014a75135ad8d01ac0c0bba1ba | /App code/app/src/main/java/com/clubapp/aniruddhadeshpande/dev/BlogPostId.java | c6bd74ac20de11893c6e3eaf6e7a8e1d9368702f | [] | no_license | Vishwajeetdeulkar/ClubApp | c956a985babd3ab0632a8eef3b6640832e4a9463 | 0ebd07a1b5ca1718ce77b43baa3d1b0857868291 | refs/heads/master | 2020-03-12T16:37:35.103266 | 2018-05-04T13:59:44 | 2018-05-04T13:59:44 | 130,720,025 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 342 | java | package com.clubapp.aniruddhadeshpande.dev;
import android.support.annotation.NonNull;
import com.google.firebase.firestore.Exclude;
public class BlogPostId {
@Exclude
public String BlogPostId;
public <T extends BlogPostId> T withId(@NonNull final String id) {
this.BlogPostId = id;
return (T) this;
}
}
| [
"vishwajeetd13@gmail.com"
] | vishwajeetd13@gmail.com |
379ed14d8124e76ecfbc4bea9fb1370d83944603 | bc57e6d148dacd55df5944ceb8e3d319cc6443c1 | /android/app/src/debug/java/com/penguincute/ReactNativeFlipper.java | ad0a5a688bd18dab2bdf1759454516ac4fdb0f85 | [] | no_license | Triq0409/WordMemoApp | 1360ab0a4eb058fda45328472ec12803e71a87b5 | 6e53531973785009e576b832504736267fa22ffb | refs/heads/master | 2022-12-04T14:44:10.228998 | 2020-08-17T07:23:30 | 2020-08-17T07:23:30 | 288,111,820 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,266 | java | /**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* <p>This source code is licensed under the MIT license found in the LICENSE file in the root
* directory of this source tree.
*/
package com.penguincute;
import android.content.Context;
import com.facebook.flipper.android.AndroidFlipperClient;
import com.facebook.flipper.android.utils.FlipperUtils;
import com.facebook.flipper.core.FlipperClient;
import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin;
import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin;
import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin;
import com.facebook.flipper.plugins.inspector.DescriptorMapping;
import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin;
import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor;
import com.facebook.flipper.plugins.network.NetworkFlipperPlugin;
import com.facebook.flipper.plugins.react.ReactFlipperPlugin;
import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.modules.network.NetworkingModule;
import okhttp3.OkHttpClient;
public class ReactNativeFlipper {
public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
if (FlipperUtils.shouldEnableFlipper(context)) {
final FlipperClient client = AndroidFlipperClient.getInstance(context);
client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults()));
client.addPlugin(new ReactFlipperPlugin());
client.addPlugin(new DatabasesFlipperPlugin(context));
client.addPlugin(new SharedPreferencesFlipperPlugin(context));
client.addPlugin(CrashReporterPlugin.getInstance());
NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin();
NetworkingModule.setCustomClientBuilder(
new NetworkingModule.CustomClientBuilder() {
@Override
public void apply(OkHttpClient.Builder builder) {
builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin));
}
});
client.addPlugin(networkFlipperPlugin);
client.start();
// Fresco Plugin needs to ensure that ImagePipelineFactory is initialized
// Hence we run if after all native modules have been initialized
ReactContext reactContext = reactInstanceManager.getCurrentReactContext();
if (reactContext == null) {
reactInstanceManager.addReactInstanceEventListener(
new ReactInstanceManager.ReactInstanceEventListener() {
@Override
public void onReactContextInitialized(ReactContext reactContext) {
reactInstanceManager.removeReactInstanceEventListener(this);
reactContext.runOnNativeModulesQueueThread(
new Runnable() {
@Override
public void run() {
client.addPlugin(new FrescoFlipperPlugin());
}
});
}
});
} else {
client.addPlugin(new FrescoFlipperPlugin());
}
}
}
}
| [
"lyoujinn@naver.com"
] | lyoujinn@naver.com |
4a7f81f76c1633bfc76a18f4c0fab8b7e4496ee0 | 9188c0d56220c52a986cec2f0f704dbaf3df870a | /JavaSE/src/loianeGroner/aula042/Aluno.java | 5b8d7c3fccd7069183064ef9295855a0dd4adb6c | [] | no_license | hectorroberto/treinamentos | 9f848a903fc5e134a0725a0b57956fe2ff115fbe | 4d58c32e08d7e63143c3c81bd237d6c8610e11a0 | refs/heads/master | 2021-01-22T22:24:32.080038 | 2017-05-01T07:00:38 | 2017-05-01T07:00:38 | 85,541,129 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,139 | java |
package loianeGroner.aula042;
/**
*
* @author Administrador
*/
public class Aluno extends Pessoa {
private String matricula;
private String curso;
private String turma;
public Aluno(String nome, String cpf, String dataNascimento, String matricula, String curso, String turma) {
super(nome, cpf, dataNascimento);
this.matricula = matricula;
this.curso = curso;
this.turma = turma;
}
public String getTurma() {
return turma;
}
public void setTurma(String turma) {
this.turma = turma;
}
public String getMatricula() {
return matricula;
}
public void setMatricula(String matricula) {
this.matricula = matricula;
}
public String getCurso() {
return curso;
}
public void setCurso(String curso) {
this.curso = curso;
}
@Override
public String toString() {
return super.toString() + "Aluno{" + "matricula=" + matricula + ", curso=" + curso + ", turma=" + turma + '}';
}
}
| [
"hectorroberto.ti@gmail.com"
] | hectorroberto.ti@gmail.com |
d63a7718e58c2680cbef02f3e3f4550c122faf13 | 70280fa8303e098400e7a222f795df417a71a3b5 | /bboss-pdp-auth/src/org/frameworkset/platform/framework/Module.java | 6dcfc42029b6ae9cd53bdae3b9060c8796b2155d | [
"Apache-2.0"
] | permissive | cannysquirrel/bboss-pdp | e2ccb271968c4e76bbe954b2a5ecb5565e1a8866 | 9fb1fd17cb267289f30b38296703a0f6c7e690c7 | refs/heads/master | 2021-01-12T03:18:57.667988 | 2017-01-03T05:36:37 | 2017-01-03T05:36:37 | 78,190,607 | 1 | 0 | null | 2017-01-06T08:53:10 | 2017-01-06T08:53:10 | null | UTF-8 | Java | false | false | 3,853 | java | package org.frameworkset.platform.framework;
import java.util.Locale;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.frameworkset.web.servlet.support.RequestContextUtils;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2005</p>
*
* <p>Company: iSany</p>
*
* @author biaoping.yin
* @version 1.0
*/
public class Module extends BaseMenuItem{
private String description;
private Map<Locale,String> localeDescriptions;
private MenuQueue menus;
private ItemQueue items;
private ModuleQueue subModules;
private String url;
/**
* 标识模块对应的module的权限状态:如果true标识module本身没有权限,但是下级菜单有权限,主要用于判别是否显示module的url地址,true不应该显示,因为没有module的直接权限,false时根据是否有module权限来显示url
*/
private boolean usesubpermission = false;
public Module()
{
this.items = new ItemQueue();
this.subModules = new ModuleQueue();
this.menus = new MenuQueue();
}
public void addSubModule(Module subModule)
{
this.subModules.addModule(subModule);
this.menus.addMenuItem(subModule);
}
public void addItem(Item item)
{
this.items.addItem(item);
this.menus.addMenuItem(item);
}
public String getDescription() {
return description;
}
public String getDescription(HttpServletRequest request) {
if(this.localeDescriptions == null)
return description;
Locale locale = RequestContextUtils.getRequestContextLocal(request);
String temp = this.localeDescriptions.get(locale);
if(temp == null)
return description;
return temp;
}
public boolean isUsesubpermission() {
return usesubpermission;
}
public void setUsesubpermission(boolean usesubpermission) {
this.usesubpermission = usesubpermission;
}
public ItemQueue getItems() {
return items;
}
public String getPath()
{
return path != null?path:(path = this.parentPath + "/" + this.id + "$module");
}
public ModuleQueue getSubModules() {
return subModules;
}
public void setDescription(String description) {
this.description = description;
}
public void setItems(ItemQueue items) {
this.items = items;
}
// public MenuItem getParent() {
// if(parentPath.equals(Framework.getSuperMenu(Framework.getSubsystemFromPath(parentPath))))
// {
// if(this.subSystem == null)
// return Framework.getInstance().getRoot();
// else
// return Framework.getInstance(subSystem.getId()).getRoot();
// }
// if(this.subSystem == null)
// return Framework.getInstance().getMenu(this.parentPath);
// else
// return Framework.getInstance(subSystem.getId()).getMenu(this.parentPath);
// }
/* (non-Javadoc)
* @see com.frameworkset.platform.framework.MenuItem#isMain()
*/
public boolean isMain() {
// TODO Auto-generated method stub
return false;
}
public String getArea() {
// TODO Auto-generated method stub
return null;
}
public Map<Locale, String> getLocaleDescriptions() {
return localeDescriptions;
}
public void setLocaleDescriptions(Map<Locale, String> localeDescriptions) {
this.localeDescriptions = localeDescriptions;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public boolean hasSonOfModule()
{
return (getSubModules() != null && getSubModules().size() > 0) ||
(getItems() != null && getItems().size() > 0);
}
public MenuQueue getMenus() {
return menus;
}
}
| [
"yin-bp@163.com"
] | yin-bp@163.com |
629bdf28ca3b83e5023a59b04a5aa394f859f210 | 2d8f91a4f88a183aaa554557d2e5234c657b29db | /app/src/main/java/com/example/crud_2019/ProductsAdapter.java | 694ec775ce8c05971d9b14624cca58186705fd55 | [] | no_license | DannyDmz/Crud_2019 | e6116ab0d67aae25e5359ff6eb0d5922318d5cec | 56d1c2966d7a41048ca6f62be75a0e000d8e3675 | refs/heads/master | 2020-09-06T19:30:54.346944 | 2019-11-08T20:54:55 | 2019-11-08T20:54:55 | 220,525,219 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,647 | java | package com.example.crud_2019;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import java.util.List;
//import android.support.v7.widget.RecyclerView;
public class ProductsAdapter extends RecyclerView.Adapter<ProductsAdapter.ProductViewHolder> {
private Context mCtx;
private List<Productos> productList;
public ProductsAdapter(Context mCtx, List<Productos> productList) {
this.mCtx = mCtx;
this.productList = productList;
}
@Override
public ProductViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
LayoutInflater inflater = LayoutInflater.from(mCtx);
View view = inflater.inflate(R.layout.list_layout, null);
return new ProductViewHolder(view);
}
@Override
public void onBindViewHolder(ProductViewHolder holder, int position) {
Productos product = productList.get(position);
//loading the image
String im = product.getImagen();
//Toast.makeText(mCtx, ""+im, Toast.LENGTH_SHORT).show();
if(im.isEmpty()) {
holder.imageView.setImageResource(R.drawable.imgnoencontrada);
holder.textViewCodigo1.setText(String.valueOf(product.getCodigo()));
holder.textViewDescripcion1.setText(product.getDescripcion());
holder.textViewPrecio1.setText(String.valueOf(product.getPrecio()));
}else{
Glide.with(mCtx)
.load(product.getImagen())
.into(holder.imageView);
holder.textViewCodigo1.setText(String.valueOf(product.getCodigo()));
holder.textViewDescripcion1.setText(product.getDescripcion());
holder.textViewPrecio1.setText(String.valueOf(product.getPrecio()));
}
}
@Override
public int getItemCount() {
return productList.size();
}
public static class ProductViewHolder extends RecyclerView.ViewHolder {
TextView textViewCodigo1, textViewDescripcion1, textViewPrecio1;
ImageView imageView;
public ProductViewHolder(View itemView) {
super(itemView);
textViewCodigo1 = itemView.findViewById(R.id.textViewCodigo1);
textViewDescripcion1 = itemView.findViewById(R.id.textViewDescripcion1);
textViewPrecio1= itemView.findViewById(R.id.textViewPrecio1);
imageView = itemView.findViewById(R.id.imageView);
}
}
}
| [
"dd8687@gmail.com"
] | dd8687@gmail.com |
d797709850b2604939167db15cbfd1acb8b174cc | 28c086c88c54bb7b03be7df3c98862366b62a798 | /src/main/java/wccifall2020/reviews/repositories/CategoryRepository.java | 11135da1269c0b9d82f14c081f632d6a93ef451e | [] | no_license | monicasimmons/reviews-site-full-stack-msimmons | 83d2f0f275426d1c3d51667d97783040d288ced4 | fb1cf1f0df1f44f5796fe2e4d5dbbef83d1cba68 | refs/heads/main | 2022-12-30T01:15:00.875242 | 2020-10-14T03:08:34 | 2020-10-14T03:08:34 | 303,542,814 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 290 | java | package wccifall2020.reviews.repositories;
import org.springframework.data.repository.CrudRepository;
import wccifall2020.reviews.models.Category;
public interface CategoryRepository extends CrudRepository<Category, Long> {
Category findCategoryByCategoryName(String categoryName);
}
| [
"monicasimmons76@gmail.com"
] | monicasimmons76@gmail.com |
9da7cc1ec1440deba943447bc3a07e7a8eebe980 | e38c255fe43cb626b38743e430e9fde7fb4e9e7b | /code-generator-maven-plugin/src/test/resources/RegexpTest/ru/vood/admplugin/infrastructure/sql/dbms/oracle/AddPrimaryKeySql.java | c5832daa1c91ec7b7e92b5a1957ea7150d6b401b | [] | no_license | igorvood/CodeGeneratorByTemlateMavenPlugin | e6b91e5273df7b6467a9752697fde12b41279e7e | 25917f2e0e974bb711d2a4688029b0ca3dcafec7 | refs/heads/master | 2022-04-09T16:12:33.097324 | 2020-03-15T18:10:56 | 2020-03-15T18:10:56 | 233,096,531 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,226 | java | package ru.vood.admplugin.infrastructure.sql.dbms.oracle;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import ru.vood.admplugin.infrastructure.sql.additionalSteps.oracle.LimitingNameDBMS;
import ru.vood.admplugin.infrastructure.tune.PluginTunes;
@Service
public class AddPrimaryKeySql {
private PluginTunes tunes;
private LimitingNameDBMS nameDBMS;
@Autowired
public AddPrimaryKeySql(PluginTunes tunes, LimitingNameDBMS nameDBMS) {
this.tunes = tunes;
this.nameDBMS = nameDBMS;
}
public String generateUserPK(String tableName) {
return generate(tableName, tunes.getTableSpaceUserIndex());
}
public String generateSys(String tableName) {
return generate(tableName, tunes.getTableSpaceSysIndex());
}
private String generate(String tableName, String tableSpace) {
String nameConstraint = nameDBMS.getNameObj("PK#" + tableName);
return "alter table " + tunes.getUser() + "." + tableName + "\n" +
" add constraint " + nameConstraint + " primary key (ID)\n" +
" using index tablespace \n" + tableSpace + tunes.getStorageIndex();
}
}
| [
"balitsky_igor@list.ru"
] | balitsky_igor@list.ru |
8f323c069ef867a0f3aac5c33b1d512800aed95e | 66dcb35a52da92a1a7db9625c97e0c2360bc241a | /tcc-demo-provider/src/main/java/com/tcc/demo/ApplicationBootstrapProvider.java | adbf0a813d1c37f1f587cb361e236d9b90c2738a | [] | no_license | mijingling/tcc-demo | b39ae3e24a409638ea2def4741b9d47c7551c81d | a3a08ba1d325ee9475691e4eb4f5d77bab64dd67 | refs/heads/master | 2021-01-19T07:16:05.138812 | 2017-04-07T10:16:24 | 2017-04-07T10:16:24 | 87,532,648 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 610 | java | package com.tcc.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ImportResource;
import org.springframework.context.annotation.PropertySource;
@SpringBootApplication
@PropertySource({ "classpath:application.properties" })
@ImportResource({"classpath:applicationContext.xml","classpath:tcc-transaction.xml"})
public class ApplicationBootstrapProvider {
public static void main(String[] args) {
SpringApplication.run(ApplicationBootstrapProvider.class, args);
}
}
| [
"wn@qian360.com"
] | wn@qian360.com |
d746e3ca2b7bf19683917ed284d7d3613ee543da | ea39ccf14d4a27e0053e7ba4bbd7877b568bf52c | /src/main/java/cn/ws/dataStructure/heap/MaxHeapTest.java | 0d0cba76a15dc88213421826aaf599a414d35c27 | [] | no_license | wssapro/study | 89dc3c70bb8d70f6d11cdfa70e2967862ba75374 | 84013ad044f76d58d651fa914c6873f9fca028d8 | refs/heads/master | 2023-08-27T22:10:48.693164 | 2021-10-15T09:45:20 | 2021-10-15T09:45:20 | 417,446,294 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,417 | java | package cn.ws.dataStructure.heap;
import java.util.Arrays;
/**
* @author wangshun
* @date 2019/3/26 16:45
*/
public class MaxHeapTest {
private static int arr[] = new int[]{12,23,32,21,45,56};
public static void main(String[] args) {
//heap();
//heapSort();
//heapifySort();
MaxHeap maxHeap = new MaxHeap();
maxHeap.heapSort(arr,arr.length);
System.out.println(Arrays.toString(arr));
}
//插入
public static void heap(){
MaxHeap maxHeap = new MaxHeap();
for (int i = 0; i < arr.length; i++) {
maxHeap.insert(arr[i]);
}
while(!maxHeap.isEmpty()){
System.out.print(maxHeap.extractMax()+" ");
}
System.out.println();
}
//每插入一个都生成最大数
public static void heapSort(){
MaxHeap maxHeap = new MaxHeap();
for (int i = 0; i < arr.length; i++) {
maxHeap.insert(arr[i]);
}
for (int i = arr.length-1; i >=0; i--) {
arr[i] = maxHeap.extractMax();
}
System.out.println(Arrays.toString(arr));
}
//先写成一个树,再从最后一个不是叶子节点的节点判断
public static void heapifySort(){
MaxHeap maxHeap = new MaxHeap(arr);
for (int i = arr.length-1; i >=0; i--) {
System.out.print(maxHeap.extractMax());
}
}
}
| [
"15951679087@163.com"
] | 15951679087@163.com |
5525a9aeffafbd61387789337a8f640586457b3c | be797898cca60a367fff55b9d1006d35fbfef7e1 | /blog/src/main/java/vip/bigeye/blog/service/ParentService.java | dc91f877e7b721d9d99f78a81ab814af8b5893fc | [] | no_license | 815193474/blog | 3a5471286e78789ecdaa74f1f29a49890fcf2d76 | 7136bb4dae5919174f61e0b61a18acbe00e1c6b7 | refs/heads/master | 2022-12-04T23:51:01.272395 | 2020-08-14T09:29:35 | 2020-08-14T09:29:35 | 287,493,995 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 319 | java | package vip.bigeye.blog.service;
import java.util.List;
/**
* @Author wolf VX:a815193474
* @Date 2019-08-21 12:06
*/
public interface ParentService<Object,Serializable> {
public boolean deleteById(String id);
public void save(Object o);
public Object findById(String id);
public List<Object> findAll();
}
| [
"815193474@qq.com"
] | 815193474@qq.com |
3bdbf1216c70a3542f4e9a9a469db5aaaed3d10c | 9157c520e704c6e3c23984f99fa87e1f461be426 | /jxszj_zhmd/src/main/java/com/jxszj/pojo/sap/SapZzfyjtTbExample.java | 616d86557e6ce7cfa7144cc65859490ebb99d81d | [] | no_license | sb1748/work | b03899b796eef6ba53dec8be0f3fc1f8c6231fe0 | d7a37cb0107e044374305ad6c710cd748c350d23 | refs/heads/master | 2023-07-02T22:12:21.777762 | 2021-08-05T10:59:16 | 2021-08-05T10:59:16 | 392,943,510 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 46,138 | java | package com.jxszj.pojo.sap;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
public class SapZzfyjtTbExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public SapZzfyjtTbExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
protected void addCriterionForJDBCDate(String condition, Date value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
addCriterion(condition, new java.sql.Date(value.getTime()), property);
}
protected void addCriterionForJDBCDate(String condition, List<Date> values, String property) {
if (values == null || values.size() == 0) {
throw new RuntimeException("Value list for " + property + " cannot be null or empty");
}
List<java.sql.Date> dateList = new ArrayList<java.sql.Date>();
Iterator<Date> iter = values.iterator();
while (iter.hasNext()) {
dateList.add(new java.sql.Date(iter.next().getTime()));
}
addCriterion(condition, dateList, property);
}
protected void addCriterionForJDBCDate(String condition, Date value1, Date value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
addCriterion(condition, new java.sql.Date(value1.getTime()), new java.sql.Date(value2.getTime()), property);
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Integer value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Integer value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Integer value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Integer value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Integer value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Integer> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Integer> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Integer value1, Integer value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Integer value1, Integer value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andZzIsNull() {
addCriterion("zz is null");
return (Criteria) this;
}
public Criteria andZzIsNotNull() {
addCriterion("zz is not null");
return (Criteria) this;
}
public Criteria andZzEqualTo(String value) {
addCriterion("zz =", value, "zz");
return (Criteria) this;
}
public Criteria andZzNotEqualTo(String value) {
addCriterion("zz <>", value, "zz");
return (Criteria) this;
}
public Criteria andZzGreaterThan(String value) {
addCriterion("zz >", value, "zz");
return (Criteria) this;
}
public Criteria andZzGreaterThanOrEqualTo(String value) {
addCriterion("zz >=", value, "zz");
return (Criteria) this;
}
public Criteria andZzLessThan(String value) {
addCriterion("zz <", value, "zz");
return (Criteria) this;
}
public Criteria andZzLessThanOrEqualTo(String value) {
addCriterion("zz <=", value, "zz");
return (Criteria) this;
}
public Criteria andZzLike(String value) {
addCriterion("zz like", value, "zz");
return (Criteria) this;
}
public Criteria andZzNotLike(String value) {
addCriterion("zz not like", value, "zz");
return (Criteria) this;
}
public Criteria andZzIn(List<String> values) {
addCriterion("zz in", values, "zz");
return (Criteria) this;
}
public Criteria andZzNotIn(List<String> values) {
addCriterion("zz not in", values, "zz");
return (Criteria) this;
}
public Criteria andZzBetween(String value1, String value2) {
addCriterion("zz between", value1, value2, "zz");
return (Criteria) this;
}
public Criteria andZzNotBetween(String value1, String value2) {
addCriterion("zz not between", value1, value2, "zz");
return (Criteria) this;
}
public Criteria andJfkmIsNull() {
addCriterion("jfkm is null");
return (Criteria) this;
}
public Criteria andJfkmIsNotNull() {
addCriterion("jfkm is not null");
return (Criteria) this;
}
public Criteria andJfkmEqualTo(String value) {
addCriterion("jfkm =", value, "jfkm");
return (Criteria) this;
}
public Criteria andJfkmNotEqualTo(String value) {
addCriterion("jfkm <>", value, "jfkm");
return (Criteria) this;
}
public Criteria andJfkmGreaterThan(String value) {
addCriterion("jfkm >", value, "jfkm");
return (Criteria) this;
}
public Criteria andJfkmGreaterThanOrEqualTo(String value) {
addCriterion("jfkm >=", value, "jfkm");
return (Criteria) this;
}
public Criteria andJfkmLessThan(String value) {
addCriterion("jfkm <", value, "jfkm");
return (Criteria) this;
}
public Criteria andJfkmLessThanOrEqualTo(String value) {
addCriterion("jfkm <=", value, "jfkm");
return (Criteria) this;
}
public Criteria andJfkmLike(String value) {
addCriterion("jfkm like", value, "jfkm");
return (Criteria) this;
}
public Criteria andJfkmNotLike(String value) {
addCriterion("jfkm not like", value, "jfkm");
return (Criteria) this;
}
public Criteria andJfkmIn(List<String> values) {
addCriterion("jfkm in", values, "jfkm");
return (Criteria) this;
}
public Criteria andJfkmNotIn(List<String> values) {
addCriterion("jfkm not in", values, "jfkm");
return (Criteria) this;
}
public Criteria andJfkmBetween(String value1, String value2) {
addCriterion("jfkm between", value1, value2, "jfkm");
return (Criteria) this;
}
public Criteria andJfkmNotBetween(String value1, String value2) {
addCriterion("jfkm not between", value1, value2, "jfkm");
return (Criteria) this;
}
public Criteria andJfjeIsNull() {
addCriterion("jfje is null");
return (Criteria) this;
}
public Criteria andJfjeIsNotNull() {
addCriterion("jfje is not null");
return (Criteria) this;
}
public Criteria andJfjeEqualTo(String value) {
addCriterion("jfje =", value, "jfje");
return (Criteria) this;
}
public Criteria andJfjeNotEqualTo(String value) {
addCriterion("jfje <>", value, "jfje");
return (Criteria) this;
}
public Criteria andJfjeGreaterThan(String value) {
addCriterion("jfje >", value, "jfje");
return (Criteria) this;
}
public Criteria andJfjeGreaterThanOrEqualTo(String value) {
addCriterion("jfje >=", value, "jfje");
return (Criteria) this;
}
public Criteria andJfjeLessThan(String value) {
addCriterion("jfje <", value, "jfje");
return (Criteria) this;
}
public Criteria andJfjeLessThanOrEqualTo(String value) {
addCriterion("jfje <=", value, "jfje");
return (Criteria) this;
}
public Criteria andJfjeLike(String value) {
addCriterion("jfje like", value, "jfje");
return (Criteria) this;
}
public Criteria andJfjeNotLike(String value) {
addCriterion("jfje not like", value, "jfje");
return (Criteria) this;
}
public Criteria andJfjeIn(List<String> values) {
addCriterion("jfje in", values, "jfje");
return (Criteria) this;
}
public Criteria andJfjeNotIn(List<String> values) {
addCriterion("jfje not in", values, "jfje");
return (Criteria) this;
}
public Criteria andJfjeBetween(String value1, String value2) {
addCriterion("jfje between", value1, value2, "jfje");
return (Criteria) this;
}
public Criteria andJfjeNotBetween(String value1, String value2) {
addCriterion("jfje not between", value1, value2, "jfje");
return (Criteria) this;
}
public Criteria andCbzxIsNull() {
addCriterion("cbzx is null");
return (Criteria) this;
}
public Criteria andCbzxIsNotNull() {
addCriterion("cbzx is not null");
return (Criteria) this;
}
public Criteria andCbzxEqualTo(String value) {
addCriterion("cbzx =", value, "cbzx");
return (Criteria) this;
}
public Criteria andCbzxNotEqualTo(String value) {
addCriterion("cbzx <>", value, "cbzx");
return (Criteria) this;
}
public Criteria andCbzxGreaterThan(String value) {
addCriterion("cbzx >", value, "cbzx");
return (Criteria) this;
}
public Criteria andCbzxGreaterThanOrEqualTo(String value) {
addCriterion("cbzx >=", value, "cbzx");
return (Criteria) this;
}
public Criteria andCbzxLessThan(String value) {
addCriterion("cbzx <", value, "cbzx");
return (Criteria) this;
}
public Criteria andCbzxLessThanOrEqualTo(String value) {
addCriterion("cbzx <=", value, "cbzx");
return (Criteria) this;
}
public Criteria andCbzxLike(String value) {
addCriterion("cbzx like", value, "cbzx");
return (Criteria) this;
}
public Criteria andCbzxNotLike(String value) {
addCriterion("cbzx not like", value, "cbzx");
return (Criteria) this;
}
public Criteria andCbzxIn(List<String> values) {
addCriterion("cbzx in", values, "cbzx");
return (Criteria) this;
}
public Criteria andCbzxNotIn(List<String> values) {
addCriterion("cbzx not in", values, "cbzx");
return (Criteria) this;
}
public Criteria andCbzxBetween(String value1, String value2) {
addCriterion("cbzx between", value1, value2, "cbzx");
return (Criteria) this;
}
public Criteria andCbzxNotBetween(String value1, String value2) {
addCriterion("cbzx not between", value1, value2, "cbzx");
return (Criteria) this;
}
public Criteria andDfkmIsNull() {
addCriterion("dfkm is null");
return (Criteria) this;
}
public Criteria andDfkmIsNotNull() {
addCriterion("dfkm is not null");
return (Criteria) this;
}
public Criteria andDfkmEqualTo(String value) {
addCriterion("dfkm =", value, "dfkm");
return (Criteria) this;
}
public Criteria andDfkmNotEqualTo(String value) {
addCriterion("dfkm <>", value, "dfkm");
return (Criteria) this;
}
public Criteria andDfkmGreaterThan(String value) {
addCriterion("dfkm >", value, "dfkm");
return (Criteria) this;
}
public Criteria andDfkmGreaterThanOrEqualTo(String value) {
addCriterion("dfkm >=", value, "dfkm");
return (Criteria) this;
}
public Criteria andDfkmLessThan(String value) {
addCriterion("dfkm <", value, "dfkm");
return (Criteria) this;
}
public Criteria andDfkmLessThanOrEqualTo(String value) {
addCriterion("dfkm <=", value, "dfkm");
return (Criteria) this;
}
public Criteria andDfkmLike(String value) {
addCriterion("dfkm like", value, "dfkm");
return (Criteria) this;
}
public Criteria andDfkmNotLike(String value) {
addCriterion("dfkm not like", value, "dfkm");
return (Criteria) this;
}
public Criteria andDfkmIn(List<String> values) {
addCriterion("dfkm in", values, "dfkm");
return (Criteria) this;
}
public Criteria andDfkmNotIn(List<String> values) {
addCriterion("dfkm not in", values, "dfkm");
return (Criteria) this;
}
public Criteria andDfkmBetween(String value1, String value2) {
addCriterion("dfkm between", value1, value2, "dfkm");
return (Criteria) this;
}
public Criteria andDfkmNotBetween(String value1, String value2) {
addCriterion("dfkm not between", value1, value2, "dfkm");
return (Criteria) this;
}
public Criteria andDfjeIsNull() {
addCriterion("dfje is null");
return (Criteria) this;
}
public Criteria andDfjeIsNotNull() {
addCriterion("dfje is not null");
return (Criteria) this;
}
public Criteria andDfjeEqualTo(String value) {
addCriterion("dfje =", value, "dfje");
return (Criteria) this;
}
public Criteria andDfjeNotEqualTo(String value) {
addCriterion("dfje <>", value, "dfje");
return (Criteria) this;
}
public Criteria andDfjeGreaterThan(String value) {
addCriterion("dfje >", value, "dfje");
return (Criteria) this;
}
public Criteria andDfjeGreaterThanOrEqualTo(String value) {
addCriterion("dfje >=", value, "dfje");
return (Criteria) this;
}
public Criteria andDfjeLessThan(String value) {
addCriterion("dfje <", value, "dfje");
return (Criteria) this;
}
public Criteria andDfjeLessThanOrEqualTo(String value) {
addCriterion("dfje <=", value, "dfje");
return (Criteria) this;
}
public Criteria andDfjeLike(String value) {
addCriterion("dfje like", value, "dfje");
return (Criteria) this;
}
public Criteria andDfjeNotLike(String value) {
addCriterion("dfje not like", value, "dfje");
return (Criteria) this;
}
public Criteria andDfjeIn(List<String> values) {
addCriterion("dfje in", values, "dfje");
return (Criteria) this;
}
public Criteria andDfjeNotIn(List<String> values) {
addCriterion("dfje not in", values, "dfje");
return (Criteria) this;
}
public Criteria andDfjeBetween(String value1, String value2) {
addCriterion("dfje between", value1, value2, "dfje");
return (Criteria) this;
}
public Criteria andDfjeNotBetween(String value1, String value2) {
addCriterion("dfje not between", value1, value2, "dfje");
return (Criteria) this;
}
public Criteria andDateIsNull() {
addCriterion("date is null");
return (Criteria) this;
}
public Criteria andDateIsNotNull() {
addCriterion("date is not null");
return (Criteria) this;
}
public Criteria andDateEqualTo(Date value) {
addCriterionForJDBCDate("date =", value, "date");
return (Criteria) this;
}
public Criteria andDateNotEqualTo(Date value) {
addCriterionForJDBCDate("date <>", value, "date");
return (Criteria) this;
}
public Criteria andDateGreaterThan(Date value) {
addCriterionForJDBCDate("date >", value, "date");
return (Criteria) this;
}
public Criteria andDateGreaterThanOrEqualTo(Date value) {
addCriterionForJDBCDate("date >=", value, "date");
return (Criteria) this;
}
public Criteria andDateLessThan(Date value) {
addCriterionForJDBCDate("date <", value, "date");
return (Criteria) this;
}
public Criteria andDateLessThanOrEqualTo(Date value) {
addCriterionForJDBCDate("date <=", value, "date");
return (Criteria) this;
}
public Criteria andDateIn(List<Date> values) {
addCriterionForJDBCDate("date in", values, "date");
return (Criteria) this;
}
public Criteria andDateNotIn(List<Date> values) {
addCriterionForJDBCDate("date not in", values, "date");
return (Criteria) this;
}
public Criteria andDateBetween(Date value1, Date value2) {
addCriterionForJDBCDate("date between", value1, value2, "date");
return (Criteria) this;
}
public Criteria andDateNotBetween(Date value1, Date value2) {
addCriterionForJDBCDate("date not between", value1, value2, "date");
return (Criteria) this;
}
public Criteria andMsgIsNull() {
addCriterion("msg is null");
return (Criteria) this;
}
public Criteria andMsgIsNotNull() {
addCriterion("msg is not null");
return (Criteria) this;
}
public Criteria andMsgEqualTo(String value) {
addCriterion("msg =", value, "msg");
return (Criteria) this;
}
public Criteria andMsgNotEqualTo(String value) {
addCriterion("msg <>", value, "msg");
return (Criteria) this;
}
public Criteria andMsgGreaterThan(String value) {
addCriterion("msg >", value, "msg");
return (Criteria) this;
}
public Criteria andMsgGreaterThanOrEqualTo(String value) {
addCriterion("msg >=", value, "msg");
return (Criteria) this;
}
public Criteria andMsgLessThan(String value) {
addCriterion("msg <", value, "msg");
return (Criteria) this;
}
public Criteria andMsgLessThanOrEqualTo(String value) {
addCriterion("msg <=", value, "msg");
return (Criteria) this;
}
public Criteria andMsgLike(String value) {
addCriterion("msg like", value, "msg");
return (Criteria) this;
}
public Criteria andMsgNotLike(String value) {
addCriterion("msg not like", value, "msg");
return (Criteria) this;
}
public Criteria andMsgIn(List<String> values) {
addCriterion("msg in", values, "msg");
return (Criteria) this;
}
public Criteria andMsgNotIn(List<String> values) {
addCriterion("msg not in", values, "msg");
return (Criteria) this;
}
public Criteria andMsgBetween(String value1, String value2) {
addCriterion("msg between", value1, value2, "msg");
return (Criteria) this;
}
public Criteria andMsgNotBetween(String value1, String value2) {
addCriterion("msg not between", value1, value2, "msg");
return (Criteria) this;
}
public Criteria andCjrIsNull() {
addCriterion("cjr is null");
return (Criteria) this;
}
public Criteria andCjrIsNotNull() {
addCriterion("cjr is not null");
return (Criteria) this;
}
public Criteria andCjrEqualTo(String value) {
addCriterion("cjr =", value, "cjr");
return (Criteria) this;
}
public Criteria andCjrNotEqualTo(String value) {
addCriterion("cjr <>", value, "cjr");
return (Criteria) this;
}
public Criteria andCjrGreaterThan(String value) {
addCriterion("cjr >", value, "cjr");
return (Criteria) this;
}
public Criteria andCjrGreaterThanOrEqualTo(String value) {
addCriterion("cjr >=", value, "cjr");
return (Criteria) this;
}
public Criteria andCjrLessThan(String value) {
addCriterion("cjr <", value, "cjr");
return (Criteria) this;
}
public Criteria andCjrLessThanOrEqualTo(String value) {
addCriterion("cjr <=", value, "cjr");
return (Criteria) this;
}
public Criteria andCjrLike(String value) {
addCriterion("cjr like", value, "cjr");
return (Criteria) this;
}
public Criteria andCjrNotLike(String value) {
addCriterion("cjr not like", value, "cjr");
return (Criteria) this;
}
public Criteria andCjrIn(List<String> values) {
addCriterion("cjr in", values, "cjr");
return (Criteria) this;
}
public Criteria andCjrNotIn(List<String> values) {
addCriterion("cjr not in", values, "cjr");
return (Criteria) this;
}
public Criteria andCjrBetween(String value1, String value2) {
addCriterion("cjr between", value1, value2, "cjr");
return (Criteria) this;
}
public Criteria andCjrNotBetween(String value1, String value2) {
addCriterion("cjr not between", value1, value2, "cjr");
return (Criteria) this;
}
public Criteria andStatusIsNull() {
addCriterion("status is null");
return (Criteria) this;
}
public Criteria andStatusIsNotNull() {
addCriterion("status is not null");
return (Criteria) this;
}
public Criteria andStatusEqualTo(String value) {
addCriterion("status =", value, "status");
return (Criteria) this;
}
public Criteria andStatusNotEqualTo(String value) {
addCriterion("status <>", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThan(String value) {
addCriterion("status >", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThanOrEqualTo(String value) {
addCriterion("status >=", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThan(String value) {
addCriterion("status <", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThanOrEqualTo(String value) {
addCriterion("status <=", value, "status");
return (Criteria) this;
}
public Criteria andStatusLike(String value) {
addCriterion("status like", value, "status");
return (Criteria) this;
}
public Criteria andStatusNotLike(String value) {
addCriterion("status not like", value, "status");
return (Criteria) this;
}
public Criteria andStatusIn(List<String> values) {
addCriterion("status in", values, "status");
return (Criteria) this;
}
public Criteria andStatusNotIn(List<String> values) {
addCriterion("status not in", values, "status");
return (Criteria) this;
}
public Criteria andStatusBetween(String value1, String value2) {
addCriterion("status between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andStatusNotBetween(String value1, String value2) {
addCriterion("status not between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andPzbhIsNull() {
addCriterion("pzbh is null");
return (Criteria) this;
}
public Criteria andPzbhIsNotNull() {
addCriterion("pzbh is not null");
return (Criteria) this;
}
public Criteria andPzbhEqualTo(String value) {
addCriterion("pzbh =", value, "pzbh");
return (Criteria) this;
}
public Criteria andPzbhNotEqualTo(String value) {
addCriterion("pzbh <>", value, "pzbh");
return (Criteria) this;
}
public Criteria andPzbhGreaterThan(String value) {
addCriterion("pzbh >", value, "pzbh");
return (Criteria) this;
}
public Criteria andPzbhGreaterThanOrEqualTo(String value) {
addCriterion("pzbh >=", value, "pzbh");
return (Criteria) this;
}
public Criteria andPzbhLessThan(String value) {
addCriterion("pzbh <", value, "pzbh");
return (Criteria) this;
}
public Criteria andPzbhLessThanOrEqualTo(String value) {
addCriterion("pzbh <=", value, "pzbh");
return (Criteria) this;
}
public Criteria andPzbhLike(String value) {
addCriterion("pzbh like", value, "pzbh");
return (Criteria) this;
}
public Criteria andPzbhNotLike(String value) {
addCriterion("pzbh not like", value, "pzbh");
return (Criteria) this;
}
public Criteria andPzbhIn(List<String> values) {
addCriterion("pzbh in", values, "pzbh");
return (Criteria) this;
}
public Criteria andPzbhNotIn(List<String> values) {
addCriterion("pzbh not in", values, "pzbh");
return (Criteria) this;
}
public Criteria andPzbhBetween(String value1, String value2) {
addCriterion("pzbh between", value1, value2, "pzbh");
return (Criteria) this;
}
public Criteria andPzbhNotBetween(String value1, String value2) {
addCriterion("pzbh not between", value1, value2, "pzbh");
return (Criteria) this;
}
public Criteria andPzrqIsNull() {
addCriterion("pzrq is null");
return (Criteria) this;
}
public Criteria andPzrqIsNotNull() {
addCriterion("pzrq is not null");
return (Criteria) this;
}
public Criteria andPzrqEqualTo(String value) {
addCriterion("pzrq =", value, "pzrq");
return (Criteria) this;
}
public Criteria andPzrqNotEqualTo(String value) {
addCriterion("pzrq <>", value, "pzrq");
return (Criteria) this;
}
public Criteria andPzrqGreaterThan(String value) {
addCriterion("pzrq >", value, "pzrq");
return (Criteria) this;
}
public Criteria andPzrqGreaterThanOrEqualTo(String value) {
addCriterion("pzrq >=", value, "pzrq");
return (Criteria) this;
}
public Criteria andPzrqLessThan(String value) {
addCriterion("pzrq <", value, "pzrq");
return (Criteria) this;
}
public Criteria andPzrqLessThanOrEqualTo(String value) {
addCriterion("pzrq <=", value, "pzrq");
return (Criteria) this;
}
public Criteria andPzrqLike(String value) {
addCriterion("pzrq like", value, "pzrq");
return (Criteria) this;
}
public Criteria andPzrqNotLike(String value) {
addCriterion("pzrq not like", value, "pzrq");
return (Criteria) this;
}
public Criteria andPzrqIn(List<String> values) {
addCriterion("pzrq in", values, "pzrq");
return (Criteria) this;
}
public Criteria andPzrqNotIn(List<String> values) {
addCriterion("pzrq not in", values, "pzrq");
return (Criteria) this;
}
public Criteria andPzrqBetween(String value1, String value2) {
addCriterion("pzrq between", value1, value2, "pzrq");
return (Criteria) this;
}
public Criteria andPzrqNotBetween(String value1, String value2) {
addCriterion("pzrq not between", value1, value2, "pzrq");
return (Criteria) this;
}
public Criteria andGzrqIsNull() {
addCriterion("gzrq is null");
return (Criteria) this;
}
public Criteria andGzrqIsNotNull() {
addCriterion("gzrq is not null");
return (Criteria) this;
}
public Criteria andGzrqEqualTo(String value) {
addCriterion("gzrq =", value, "gzrq");
return (Criteria) this;
}
public Criteria andGzrqNotEqualTo(String value) {
addCriterion("gzrq <>", value, "gzrq");
return (Criteria) this;
}
public Criteria andGzrqGreaterThan(String value) {
addCriterion("gzrq >", value, "gzrq");
return (Criteria) this;
}
public Criteria andGzrqGreaterThanOrEqualTo(String value) {
addCriterion("gzrq >=", value, "gzrq");
return (Criteria) this;
}
public Criteria andGzrqLessThan(String value) {
addCriterion("gzrq <", value, "gzrq");
return (Criteria) this;
}
public Criteria andGzrqLessThanOrEqualTo(String value) {
addCriterion("gzrq <=", value, "gzrq");
return (Criteria) this;
}
public Criteria andGzrqLike(String value) {
addCriterion("gzrq like", value, "gzrq");
return (Criteria) this;
}
public Criteria andGzrqNotLike(String value) {
addCriterion("gzrq not like", value, "gzrq");
return (Criteria) this;
}
public Criteria andGzrqIn(List<String> values) {
addCriterion("gzrq in", values, "gzrq");
return (Criteria) this;
}
public Criteria andGzrqNotIn(List<String> values) {
addCriterion("gzrq not in", values, "gzrq");
return (Criteria) this;
}
public Criteria andGzrqBetween(String value1, String value2) {
addCriterion("gzrq between", value1, value2, "gzrq");
return (Criteria) this;
}
public Criteria andGzrqNotBetween(String value1, String value2) {
addCriterion("gzrq not between", value1, value2, "gzrq");
return (Criteria) this;
}
public Criteria andHtextIsNull() {
addCriterion("htext is null");
return (Criteria) this;
}
public Criteria andHtextIsNotNull() {
addCriterion("htext is not null");
return (Criteria) this;
}
public Criteria andHtextEqualTo(String value) {
addCriterion("htext =", value, "htext");
return (Criteria) this;
}
public Criteria andHtextNotEqualTo(String value) {
addCriterion("htext <>", value, "htext");
return (Criteria) this;
}
public Criteria andHtextGreaterThan(String value) {
addCriterion("htext >", value, "htext");
return (Criteria) this;
}
public Criteria andHtextGreaterThanOrEqualTo(String value) {
addCriterion("htext >=", value, "htext");
return (Criteria) this;
}
public Criteria andHtextLessThan(String value) {
addCriterion("htext <", value, "htext");
return (Criteria) this;
}
public Criteria andHtextLessThanOrEqualTo(String value) {
addCriterion("htext <=", value, "htext");
return (Criteria) this;
}
public Criteria andHtextLike(String value) {
addCriterion("htext like", value, "htext");
return (Criteria) this;
}
public Criteria andHtextNotLike(String value) {
addCriterion("htext not like", value, "htext");
return (Criteria) this;
}
public Criteria andHtextIn(List<String> values) {
addCriterion("htext in", values, "htext");
return (Criteria) this;
}
public Criteria andHtextNotIn(List<String> values) {
addCriterion("htext not in", values, "htext");
return (Criteria) this;
}
public Criteria andHtextBetween(String value1, String value2) {
addCriterion("htext between", value1, value2, "htext");
return (Criteria) this;
}
public Criteria andHtextNotBetween(String value1, String value2) {
addCriterion("htext not between", value1, value2, "htext");
return (Criteria) this;
}
public Criteria andTextIsNull() {
addCriterion("text is null");
return (Criteria) this;
}
public Criteria andTextIsNotNull() {
addCriterion("text is not null");
return (Criteria) this;
}
public Criteria andTextEqualTo(String value) {
addCriterion("text =", value, "text");
return (Criteria) this;
}
public Criteria andTextNotEqualTo(String value) {
addCriterion("text <>", value, "text");
return (Criteria) this;
}
public Criteria andTextGreaterThan(String value) {
addCriterion("text >", value, "text");
return (Criteria) this;
}
public Criteria andTextGreaterThanOrEqualTo(String value) {
addCriterion("text >=", value, "text");
return (Criteria) this;
}
public Criteria andTextLessThan(String value) {
addCriterion("text <", value, "text");
return (Criteria) this;
}
public Criteria andTextLessThanOrEqualTo(String value) {
addCriterion("text <=", value, "text");
return (Criteria) this;
}
public Criteria andTextLike(String value) {
addCriterion("text like", value, "text");
return (Criteria) this;
}
public Criteria andTextNotLike(String value) {
addCriterion("text not like", value, "text");
return (Criteria) this;
}
public Criteria andTextIn(List<String> values) {
addCriterion("text in", values, "text");
return (Criteria) this;
}
public Criteria andTextNotIn(List<String> values) {
addCriterion("text not in", values, "text");
return (Criteria) this;
}
public Criteria andTextBetween(String value1, String value2) {
addCriterion("text between", value1, value2, "text");
return (Criteria) this;
}
public Criteria andTextNotBetween(String value1, String value2) {
addCriterion("text not between", value1, value2, "text");
return (Criteria) this;
}
public Criteria andJfyydmIsNull() {
addCriterion("jfyydm is null");
return (Criteria) this;
}
public Criteria andJfyydmIsNotNull() {
addCriterion("jfyydm is not null");
return (Criteria) this;
}
public Criteria andJfyydmEqualTo(String value) {
addCriterion("jfyydm =", value, "jfyydm");
return (Criteria) this;
}
public Criteria andJfyydmNotEqualTo(String value) {
addCriterion("jfyydm <>", value, "jfyydm");
return (Criteria) this;
}
public Criteria andJfyydmGreaterThan(String value) {
addCriterion("jfyydm >", value, "jfyydm");
return (Criteria) this;
}
public Criteria andJfyydmGreaterThanOrEqualTo(String value) {
addCriterion("jfyydm >=", value, "jfyydm");
return (Criteria) this;
}
public Criteria andJfyydmLessThan(String value) {
addCriterion("jfyydm <", value, "jfyydm");
return (Criteria) this;
}
public Criteria andJfyydmLessThanOrEqualTo(String value) {
addCriterion("jfyydm <=", value, "jfyydm");
return (Criteria) this;
}
public Criteria andJfyydmLike(String value) {
addCriterion("jfyydm like", value, "jfyydm");
return (Criteria) this;
}
public Criteria andJfyydmNotLike(String value) {
addCriterion("jfyydm not like", value, "jfyydm");
return (Criteria) this;
}
public Criteria andJfyydmIn(List<String> values) {
addCriterion("jfyydm in", values, "jfyydm");
return (Criteria) this;
}
public Criteria andJfyydmNotIn(List<String> values) {
addCriterion("jfyydm not in", values, "jfyydm");
return (Criteria) this;
}
public Criteria andJfyydmBetween(String value1, String value2) {
addCriterion("jfyydm between", value1, value2, "jfyydm");
return (Criteria) this;
}
public Criteria andJfyydmNotBetween(String value1, String value2) {
addCriterion("jfyydm not between", value1, value2, "jfyydm");
return (Criteria) this;
}
public Criteria andDfyydmIsNull() {
addCriterion("dfyydm is null");
return (Criteria) this;
}
public Criteria andDfyydmIsNotNull() {
addCriterion("dfyydm is not null");
return (Criteria) this;
}
public Criteria andDfyydmEqualTo(String value) {
addCriterion("dfyydm =", value, "dfyydm");
return (Criteria) this;
}
public Criteria andDfyydmNotEqualTo(String value) {
addCriterion("dfyydm <>", value, "dfyydm");
return (Criteria) this;
}
public Criteria andDfyydmGreaterThan(String value) {
addCriterion("dfyydm >", value, "dfyydm");
return (Criteria) this;
}
public Criteria andDfyydmGreaterThanOrEqualTo(String value) {
addCriterion("dfyydm >=", value, "dfyydm");
return (Criteria) this;
}
public Criteria andDfyydmLessThan(String value) {
addCriterion("dfyydm <", value, "dfyydm");
return (Criteria) this;
}
public Criteria andDfyydmLessThanOrEqualTo(String value) {
addCriterion("dfyydm <=", value, "dfyydm");
return (Criteria) this;
}
public Criteria andDfyydmLike(String value) {
addCriterion("dfyydm like", value, "dfyydm");
return (Criteria) this;
}
public Criteria andDfyydmNotLike(String value) {
addCriterion("dfyydm not like", value, "dfyydm");
return (Criteria) this;
}
public Criteria andDfyydmIn(List<String> values) {
addCriterion("dfyydm in", values, "dfyydm");
return (Criteria) this;
}
public Criteria andDfyydmNotIn(List<String> values) {
addCriterion("dfyydm not in", values, "dfyydm");
return (Criteria) this;
}
public Criteria andDfyydmBetween(String value1, String value2) {
addCriterion("dfyydm between", value1, value2, "dfyydm");
return (Criteria) this;
}
public Criteria andDfyydmNotBetween(String value1, String value2) {
addCriterion("dfyydm not between", value1, value2, "dfyydm");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
} | [
"1178095136@qq.com"
] | 1178095136@qq.com |
5be83a75faf583925e091b0954717a2833d6b6e7 | 01516cee0414eb9258e95aa800ca9c80209345cb | /app/src/main/java/com/zhongchuang/canting/easeui/widget/RoundImageView.java | ce37abe8f8283a9441c15ad6efff29990c6a57f3 | [] | no_license | P79N6A/CantingGit | ecb01e086e50b731501b583d398b7fa4067fbd42 | aa7dc4891f43d974f71239bfd9816efd91302de7 | refs/heads/master | 2020-04-27T12:07:58.499679 | 2019-03-07T10:15:40 | 2019-03-07T10:15:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,235 | java | package com.zhongchuang.canting.easeui.widget;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import com.zhongchuang.canting.R;;
import io.valuesfeng.picker.universalimageloader.core.DisplayImageOptions;
import io.valuesfeng.picker.universalimageloader.core.ImageLoader;
import io.valuesfeng.picker.universalimageloader.core.display.RoundedBitmapDisplayer;
public class RoundImageView extends WebImageView {
private int roundWidth = 5;
private int roundHeight = 5;
public RoundImageView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init(context, attrs);
}
public RoundImageView(Context context, AttributeSet attrs) {
super(context, attrs);
init(context, attrs);
}
public RoundImageView(Context context) {
super(context);
init(context, null);
}
private void init(Context context, AttributeSet attrs) {
if (attrs != null) {
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.RoundAngleImageView);
roundWidth = a.getDimensionPixelSize(R.styleable.RoundAngleImageView_roundWidth, roundWidth);
roundHeight = a.getDimensionPixelSize(R.styleable.RoundAngleImageView_roundHeight, roundHeight);
} else {
float density = context.getResources().getDisplayMetrics().density;
roundWidth = (int) (roundWidth * density);
roundHeight = (int) (roundHeight * density);
}
}
public void setImageWithURL(final Context context, final String urlString, int resId) {
DisplayImageOptions options = new DisplayImageOptions.Builder()
.cacheInMemory(true) //使用内存缓存
.cacheOnDisk(true) //使用硬盘缓存
.considerExifParams(true)
.showImageForEmptyUri(resId)
.showImageOnLoading(resId)
.displayer(new RoundedBitmapDisplayer(roundWidth))
.build();//基本的图片形状
ImageLoader.getInstance().displayImage(urlString, this, options);
}
}
| [
"admin"
] | admin |
6d2a85c6a285a36f95bf9ce0f7807c76f7ba39d8 | 2d7903d780b237d5fdb2fde76208798bbddf1a6f | /src/com/android/ePerion/gallery/mapEperion/VisitedSitesOverlay.java | 7651d024d13041f16e7e9b70cdac7cca52b8b0b4 | [] | no_license | Oleur/Eperion-picture-gallery | e1879255e14813099e70131d560897fdd0f89167 | 62a06e00374b91fa9a1f7b518e3f6944bdd90ab9 | refs/heads/master | 2021-01-23T07:02:32.648141 | 2012-11-02T20:50:42 | 2012-11-02T20:50:42 | 6,404,304 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,789 | java | /**
* Copyright 2012 Julien Salvi
*
* This file is part of E-Perion project.
*
* Mercury is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Mercury is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Mercury. If not, see <http://www.gnu.org/licenses/>.
*/
package com.android.ePerion.gallery.mapEperion;
import java.util.ArrayList;
import java.util.List;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.widget.Toast;
import com.google.android.maps.ItemizedOverlay;
import com.google.android.maps.OverlayItem;
// TODO: Auto-generated Javadoc
/**
* Overlay item that acts as a marker on the map. When the user click on the map the picture information will be displayed.
* @author Julien Salvi
*/
public class VisitedSitesOverlay extends ItemizedOverlay<OverlayItem> {
/** The sites list. */
private List<OverlayItem> sitesList = new ArrayList<OverlayItem>();
/** The ctx. */
private Context ctx;
/**
* Constructor of a visited overlay thanks to a drawable marker.
* @param marker Drawable marker.
*/
public VisitedSitesOverlay(Drawable marker) {
super(boundCenterBottom(marker));
}
/**
* Constructor of visited overlay thanks to drawable marker and a context.
* @param marker Drawable marker.
* @param context Context.
*/
public VisitedSitesOverlay(Drawable marker, Context context) {
super(boundCenterBottom(marker));
ctx = context;
}
/* (non-Javadoc)
* @see com.google.android.maps.ItemizedOverlay#createItem(int)
*/
@Override
protected OverlayItem createItem(int item) {
// return the item.
return sitesList.get(item);
}
/* (non-Javadoc)
* @see com.google.android.maps.ItemizedOverlay#size()
*/
@Override
public int size() {
return sitesList.size();
}
/* (non-Javadoc)
* @see com.google.android.maps.ItemizedOverlay#onTap(int)
*/
@Override
protected boolean onTap(int index) {
OverlayItem oItem = sitesList.get(index);
Toast.makeText(ctx, "Name: "+oItem.getTitle()+", Comment: "+oItem.getSnippet(), Toast.LENGTH_SHORT).show();
return true;
}
/**
* Add an overlay item.
*
* @param overlay the overlay
*/
public void addOverlayItem(OverlayItem overlay) {
sitesList.add(overlay);
populate();
}
}
| [
"oleur.utbm@gmail.com"
] | oleur.utbm@gmail.com |
4ff93f24ffeecf9853a42610201124525711962d | c1f52586733ef9eeab3e013802e350d16409af9e | /src/main/java/com/zoro/springboot/filter/CustomFilter.java | 723cadcebc81a7a7f22b03217640724508944c92 | [] | no_license | zoroseven/onepiece | 04b64d996f2293b60febe102c2c71416dd25c4c9 | d2ccd33d32cfbe1d6b3c818b977df55b3da26c1a | refs/heads/master | 2022-06-23T02:24:29.162808 | 2020-09-06T03:42:28 | 2020-09-06T03:42:28 | 145,351,960 | 0 | 0 | null | 2022-06-20T23:31:27 | 2018-08-20T01:35:51 | Java | UTF-8 | Java | false | false | 1,169 | java | package com.zoro.springboot.filter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;
/**
* @date 2018/8/27 17:26
*/
@WebFilter(filterName = "customFilter",urlPatterns = {"/*"})
public class CustomFilter implements Filter {
private static final Logger logger = LoggerFactory.getLogger(CustomFilter.class);
@Override
public void init(FilterConfig filterConfig) throws ServletException {
logger.info("filter 初始化");
}
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException {
logger.info("doFilter 请求处理");
//对request、response进行一些预处理
// 比如设置请求编码
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
//TODO 进行业务逻辑
//链路 直接传给下一个过滤器
filterChain.doFilter(request, response);
}
@Override
public void destroy() {
logger.info("filter 销毁");
}
}
| [
"18642659280@163.com"
] | 18642659280@163.com |
c5664f77ebfcb9b75a7da302f8e1b0a198a6de40 | 5e54ea41cc360c490cba92bef7bc5b71a62e3cb4 | /src/test/java/shali/tech/ptcount/GalgamePtcountApplicationTests.java | dcf945e3fb570610ce67ca59f212d8fa477ef518 | [] | no_license | wensimin/galgame_ptcount | 4a409de5872e306d687cf81bb613a649e18b649a | 664940915ce44b1247914125d3d51b93f1d98fb5 | refs/heads/master | 2020-04-21T11:17:41.953387 | 2019-02-07T04:35:26 | 2019-02-07T04:35:26 | 169,519,026 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 344 | java | package shali.tech.ptcount;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class GalgamePtcountApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"hukaizhiyu2@gmail.com"
] | hukaizhiyu2@gmail.com |
fccea511848eeb11d28e973fcdf5647ba05aa2ee | 6f2bfe9cef3a574b6a1be2fbbc3235b067a8171b | /spring-jpa/src/test/java/com/ak/learning/blogsapp/resources/TestAuthorResource.java | ee8293566dedfe1438eb2eefd8ca6ccb29ff9c09 | [
"MIT"
] | permissive | devak23/spring | f800ff7f2fa561dbf720ef083ce4218ec375e73b | f0a349a7fe7b5fa6e8af8f9490e2a42de48580d2 | refs/heads/master | 2021-08-16T01:57:32.277468 | 2021-07-24T03:22:26 | 2021-07-24T03:22:26 | 95,565,534 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,784 | java | package com.ak.learning.blogsapp.resources;
import com.ak.learning.blogsapp.BlogsApp;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.http.MediaType;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = BlogsApp.class)
@WebMvcTest(AuthorResource.class)
public class TestAuthorResource {
@Autowired
private WebApplicationContext context;
@Autowired
private MockMvc mockMvc;
@Before
public void setUp() {
mockMvc = MockMvcBuilders.webAppContextSetup(context).build();
}
@Test
public void testGetAuthorsReturnsAListOfAuthors() throws Exception {
String url = new StringBuilder()
.append("/")
.append(AuthorResource.AUTHORS_BASE_URI)
.toString();
mockMvc.perform(MockMvcRequestBuilders.get(url))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andDo(print())
.andReturn();
}
}
| [
"developer.ak23@gmail.com"
] | developer.ak23@gmail.com |
64dccb07db3e564938c6fd29456649992196a464 | a3e56e1b4b572ab386e5913d112b9121ec4f6b83 | /src/Exceptions/QuizInputException.java | 65ebc0f16c305559ddff05a4841f62c9d4af4556 | [] | no_license | RomanK94/Quiz | 39eaf1ac1e12ccded6adf73f827b91879df257f1 | e974f8b72a0d98dd9a7e5b2fb66fc2e261bdaacd | refs/heads/master | 2021-01-10T15:28:56.876724 | 2016-03-22T16:17:07 | 2016-03-22T16:17:07 | 54,211,910 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 74 | java | package Exceptions;
public class QuizInputException extends Exception{
}
| [
"kyznetsoffr@gmail.com"
] | kyznetsoffr@gmail.com |
824f3d49d16a931359a5d6c879c16123da42ddcf | 54d7128616eaa9574b6823cdafed3f6eddd066d8 | /Myapp/src/main/java/com/example/a24073/campusradio/controller/fragment/MyLiveRoomFragmentFour.java | 651e9823cdddc034ad9dd0300392d2efd3ac5886 | [] | no_license | reggie1996/CampusRadio | a151b3c4202909edb9d245eed3df3531106a42cf | 351473897c2b1edc502a0bf221f43256912d5563 | refs/heads/master | 2021-01-24T01:46:33.857577 | 2018-02-25T09:28:20 | 2018-02-25T09:28:20 | 115,425,666 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,946 | java | package com.example.a24073.campusradio.controller.fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import com.cunoraz.gifview.library.GifView;
import com.example.a24073.campusradio.R;
import com.fynn.switcher.Switch;
/**
* A simple {@link Fragment} subclass.
*/
public class MyLiveRoomFragmentFour extends Fragment {
com.fynn.switcher.Switch aSwitch;
TextView tv_connectstatus;
Button button;
GifView gifView1;
ImageView nowave;
TextView tv_someonespk;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_my_live_room_fragment_four, container, false);
}
@Override
public void onViewCreated(final View view, @Nullable final Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
aSwitch = (Switch) view.findViewById(R.id.openconnet);
tv_connectstatus = (TextView) view.findViewById(R.id.connectstatus);
tv_someonespk = (TextView) view.findViewById(R.id.tv_someonespk);
nowave = (ImageView) view.findViewById(R.id.nowave);
aSwitch.setOnCheckedChangeListener(new Switch.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(Switch s, boolean isChecked) {
if(isChecked){
tv_connectstatus.setText("已开启直播互动");
}else {
tv_connectstatus.setText("尚未开启直播互动");
}
}
});
gifView1 = (GifView)view.findViewById(R.id.gif1);
gifView1.setVisibility(View.INVISIBLE);
gifView1.play();
button = (Button) view.findViewById(R.id.button);
button.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if(event.getAction() == MotionEvent.ACTION_UP){
tv_someonespk.setText("当前无人发言");
gifView1.setVisibility(View.INVISIBLE);
nowave.setVisibility(View.VISIBLE);
}
if(event.getAction() == MotionEvent.ACTION_DOWN){
if(aSwitch.isChecked()) {
tv_someonespk.setText("我正在讲话...");
gifView1.setVisibility(View.VISIBLE);
nowave.setVisibility(View.INVISIBLE);
}
}
return false;
}
});
}
}
| [
"240730853@qq.com"
] | 240730853@qq.com |
bced91be4e2f021ff2bf0f20b9ffd73a77bff958 | cc6b2a8e7937ec6e12f25f113abc97ddef535491 | /app/src/test/java/com/shallowblue/shallowblue/PackUnpacktest.java | 3d7fbb4cf86fb21dc83d021eaecc4ea2d5eff0a5 | [] | no_license | kylepiefer/shallow-blue | 0f2a36f06441d47c3d20ac4eb0e16010d414ade0 | a18111f9a214d3003d0eeaa1cae9680c5d1ba99d | refs/heads/master | 2021-03-30T16:06:33.940032 | 2016-05-05T04:01:20 | 2016-05-07T22:00:09 | 52,567,944 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,756 | java | package com.shallowblue.shallowblue;
import junit.framework.Assert;
import org.junit.Test;
import java.util.ArrayList;
import dalvik.annotation.TestTargetClass;
/**
* Created by peter on 4/27/2016.
*/
public class PackUnpacktest {
@Test
public void oneMove(){
GameBoard board1 = new GameBoard();
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(5));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(4));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(4));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(5));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(4));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(3));
board1.move(board1.getAllLegalMoves().get(5));
board1.move(board1.getAllLegalMoves().get(4));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(4));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(4));
board1.move(board1.getAllLegalMoves().get(5));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(5));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(3));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(5));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(3));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(3));
board1.move(board1.getAllLegalMoves().get(5));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(4));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(4));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(4));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(3));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(4));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(4));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(4));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(3));
board1.move(board1.getAllLegalMoves().get(5));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(4));
board1.move(board1.getAllLegalMoves().get(4));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(3));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(4));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(4));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(4));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(3));
board1.move(board1.getAllLegalMoves().get(5));
board1.move(board1.getAllLegalMoves().get(4));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(4));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(4));
board1.move(board1.getAllLegalMoves().get(5));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(3));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(3));
board1.move(board1.getAllLegalMoves().get(2));
board1.move(board1.getAllLegalMoves().get(1));
String packedString = board1.pack();
GameBoard board2 = new GameBoard(packedString);
String packedString2 = board2.pack();
Assert.assertEquals(packedString, packedString2);
}
public void twoMove(){
GameBoard board1 = new GameBoard();
board1.move(board1.getAllLegalMoves().get(1));
board1.move(board1.getAllLegalMoves().get(1));
String packedString = board1.pack();
GameBoard board2 = new GameBoard(packedString);
Assert.assertEquals(packedString, board2.pack());
}
}
| [
"lasurakswarm@gmail.com"
] | lasurakswarm@gmail.com |
ec0480754b70eeb6c7b134c0195204939d35031d | 839d619559119c22e8f213258316451ead614106 | /src/main/java/com/enhinck/db/entity/ColumnTypeEnum.java | 554cf5952428fdba03c7e49acc43044f4140f9fc | [
"Apache-2.0"
] | permissive | Enhinck/db-utils | 6625d527a7a25c3c93257c6d8f4f4bd4a292496c | 9b2fab4de70b9232778934c6a5eb920b3682563d | refs/heads/master | 2022-07-09T07:49:25.701749 | 2019-09-10T09:24:14 | 2019-09-10T09:24:14 | 194,997,420 | 4 | 3 | Apache-2.0 | 2022-06-29T17:29:06 | 2019-07-03T06:58:04 | Java | UTF-8 | Java | false | false | 426 | java | package com.enhinck.db.entity;
import lombok.Getter;
/**
* 字段类型
*
* @author
*/
@Getter
public enum ColumnTypeEnum {
// 文本
STRING("String", "文本"),
// 文本
NUMBER("NUMBER", "数值"),
// 日期
DATE("Date", "日期");
private String value;
private String desc;
ColumnTypeEnum(String value, String desc) {
this.value = value;
this.desc = desc;
}
}
| [
"huenbin@foxmail.com"
] | huenbin@foxmail.com |
a1803751d1d008dade87bf11f78c2059545f906a | b4967222c69993f559aba710dd276979c1abaf3f | /livraria/src/main/java/br/com/alura/livraria/bean/TemaBean.java | 436029ed665e4945bbe347b834597ae61ac463f8 | [] | no_license | fwfurtado/cdi_1_2 | 010d4c04461d928a0eccce23b19caef91c0f3f6e | c33a22c61bd817e82984af602fab5b9c2dd925ea | refs/heads/master | 2021-06-06T02:11:33.673966 | 2016-08-30T20:04:36 | 2016-08-30T20:04:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 936 | java | package br.com.alura.livraria.bean;
import java.io.Serializable;
import javax.enterprise.context.SessionScoped;
import javax.inject.Named;
@Named
@SessionScoped
public class TemaBean implements Serializable {
private static final long serialVersionUID = 3740536135286026768L;
private String tema = "vader";
public String getTema() {
return tema;
}
public void setTema(String tema) {
this.tema = tema;
}
public String[] getTemas() {
return new String[]{"afterdark","afternoon","afterwork","aristo",
"black-tie","blitzer","bluesky","bootstrap","casablanca",
"cupertino","cruze","dark-hive","delta","dot-luv","eggplant",
"excite-bike","flick","glass-x","home","hot-sneaks",
"humanity","le-frog","midnight","mint-choc","overcast",
"pepper-grinder","redmond","rocket","sam","smoothness",
"south-street","start","sunny","swanky-purse","trontastic",
"ui-darkness","ui-lightness","vader"};
}
}
| [
"feh.wilinando@gmail.com"
] | feh.wilinando@gmail.com |
ca6a24317aac65445f9ef09e783308969b2bc2ad | 8a43f74b998defa62ba4e926075be76ae891d7c1 | /app/src/androidTest/java/com/example/propertyanimations/ExampleInstrumentedTest.java | 898b8cff3168f63e718ee4a8b94a8bd5391585af | [] | no_license | cardinal9/PropertyAnimations | dc07453ae2362c85e4a78e49c8ab0a4b47369efc | 34ed80b1855934f3b27b061793e8326c36b42a98 | refs/heads/master | 2020-12-13T22:06:11.764895 | 2020-01-17T12:50:16 | 2020-01-17T12:50:16 | 234,543,547 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 776 | java | package com.example.propertyanimations;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.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.getInstrumentation().getTargetContext();
assertEquals("com.example.propertyanimations", appContext.getPackageName());
}
}
| [
"joonas.pitkonen@hotmail.fi"
] | joonas.pitkonen@hotmail.fi |
79b20152a7acc8dac8ec8bf38fec014448112fc9 | a54e241333e9f69cfc505bd7b04d9f9b762f4a93 | /cloud-ops-esc/src/main/java/com/cloud/ops/esc/LocationMatcher.java | 9f4c52336fa36996e1070471043d3cb818d5ff37 | [] | no_license | ns7381/cloud-ops | 7d6b603bf45c60d5bf16f74e14ec9a06b57b2ff1 | 2c5d1021a79feece517c48eff00d6933b7e27fae | refs/heads/master | 2021-01-18T19:45:22.844251 | 2018-05-30T09:00:12 | 2018-05-30T09:00:12 | 86,910,582 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,891 | java | package com.cloud.ops.esc;
import com.cloud.ops.common.exception.OpsException;
import com.cloud.ops.esc.location.LocationService;
import com.cloud.ops.esc.provider.LocalLocationProvider;
import com.cloud.ops.esc.provider.jclouds.DockerLocationProvider;
import com.cloud.ops.esc.provider.jclouds.OpenstackLocationProvider;
import com.cloud.ops.esc.wf.model.WorkFlowEntity;
import com.cloud.ops.tosca.Tosca;
import com.cloud.ops.tosca.model.Topology;
import com.cloud.ops.tosca.model.definition.ScalarPropertyValue;
import com.cloud.ops.tosca.model.template.LocationTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
import java.util.Optional;
import static com.cloud.ops.tosca.model.normative.NormativeNodeConstants.*;
import static com.cloud.ops.tosca.model.normative.NormativeLocationConstants.LOCATION_TYPE_OPENSTACK;
/**
* Created by Nathan on 2017/5/17.
*/
@Service
public class LocationMatcher {
@Autowired
private DockerLocationProvider docker;
@Autowired
private LocalLocationProvider local;
@Autowired
private OpenstackLocationProvider openstack;
@Autowired
private LocationService locationService;
private LocationProvider match(Topology topology) {
switch (topology.getComputeType(COMPUTE_TYPE)) {
case COMPUTE_TYPE_LOCAL:
return local;
case COMPUTE_TYPE_OPENSTACK:
String yamlFilePath = locationService.findByType(LOCATION_TYPE_OPENSTACK).get(0).getYamlFilePath();
Map<String, LocationTemplate> locationTemplates = Tosca.getLocationTemplates(yamlFilePath);
Optional<Map.Entry<String, LocationTemplate>> first = locationTemplates.entrySet().stream().findFirst();
if (first.isPresent()) {
LocationTemplate loc = first.get().getValue();
openstack.setEndpoint(((ScalarPropertyValue) loc.getAttributes().get("endpoint")).getValue());
openstack.setIdentity(((ScalarPropertyValue) loc.getAttributes().get("identity")).getValue());
openstack.setCredential(((ScalarPropertyValue) loc.getAttributes().get("credential")).getValue());
} else {
throw new OpsException("not find location");
}
return openstack;
case COMPUTE_TYPE_DOCKER:
return docker;
default:
return local;
}
}
public Topology install(Topology topology, WorkFlowEntity entity, Map<String, Object> inputs) {
return match(topology).install(topology, entity, inputs);
}
public void executeWorkFlow(Topology topology, WorkFlowEntity entity, Map<String, Object> inputs) {
match(topology).executeWorkFlow(topology, entity, inputs);
}
}
| [
"ns7381@sina.cn"
] | ns7381@sina.cn |
f193b9fe91855a99255f7903ef73d62eaae3c24f | bc2fdf51df559865262b72d1c08039f475f986dd | /wine-cellar/src/main/java/io/renren/modules/cellar/controller/CellarMemberAddressDbController.java | 1caa75873d810f4ccfce165ccf2e000d6d36dc03 | [
"Apache-2.0"
] | permissive | chenweilong1022/wineCellar | 970a39be06ab5e6fca90801b8067e157cd26c12b | 327ea7b1da581d749bd20e2ece036c8975e0b3dd | refs/heads/master | 2022-11-13T15:15:24.526867 | 2019-06-12T09:09:17 | 2019-06-12T09:09:17 | 168,101,709 | 2 | 0 | null | 2022-11-03T22:49:33 | 2019-01-29T06:26:16 | JavaScript | UTF-8 | Java | false | false | 2,649 | java | package io.renren.modules.cellar.controller;
import java.util.Arrays;
import java.util.Map;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
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 io.renren.modules.cellar.entity.CellarMemberAddressDbEntity;
import io.renren.modules.cellar.service.CellarMemberAddressDbService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;
/**
* 会员地址表
*
* @author chenweilong
* @email 1433471850@qq.com
* @date 2019-02-26 10:56:54
*/
@RestController
@RequestMapping("cellar/cellarmemberaddressdb")
public class CellarMemberAddressDbController {
@Autowired
private CellarMemberAddressDbService cellarMemberAddressDbService;
/**
* 列表
*/
@RequestMapping("/list")
@RequiresPermissions("cellar:cellarmemberaddressdb:list")
public R list(CellarMemberAddressDbEntity cellarMemberAddressDb){
PageUtils page = cellarMemberAddressDbService.queryPage(cellarMemberAddressDb);
return R.ok().put("page", page);
}
/**
* 信息
*/
@RequestMapping("/info/{addressId}")
@RequiresPermissions("cellar:cellarmemberaddressdb:info")
public R info(@PathVariable("addressId") Long addressId){
CellarMemberAddressDbEntity cellarMemberAddressDb = cellarMemberAddressDbService.getById(addressId);
return R.ok().put("cellarMemberAddressDb", cellarMemberAddressDb);
}
/**
* 保存
*/
@RequestMapping("/save")
@RequiresPermissions("cellar:cellarmemberaddressdb:save")
public R save(@RequestBody CellarMemberAddressDbEntity cellarMemberAddressDb){
cellarMemberAddressDbService.save(cellarMemberAddressDb);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
@RequiresPermissions("cellar:cellarmemberaddressdb:update")
public R update(@RequestBody CellarMemberAddressDbEntity cellarMemberAddressDb){
cellarMemberAddressDbService.updateById(cellarMemberAddressDb);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
@RequiresPermissions("cellar:cellarmemberaddressdb:delete")
public R delete(@RequestBody Long[] addressIds){
cellarMemberAddressDbService.removeByIds(Arrays.asList(addressIds));
return R.ok();
}
}
| [
"chenweilong"
] | chenweilong |
192f3e156b4dc6f54c8d982fb5b1552d3aee0bd7 | 082e26b011e30dc62a62fae95f375e4f87d9e99c | /docs/weixin_7.0.4_source/反编译源码/反混淆后/src/main/java/com/google/android/gms/internal/measurement/zzes.java | 7a539312c73861b1c14095ea252209144aaf5a17 | [] | no_license | xsren/AndroidReverseNotes | 9631a5aabc031006e795a112b7ac756a8edd4385 | 9202c276fe9f04a978e4e08b08e42645d97ca94b | refs/heads/master | 2021-04-07T22:50:51.072197 | 2019-07-16T02:24:43 | 2019-07-16T02:24:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,111 | java | package com.google.android.gms.internal.measurement;
import com.tencent.matrix.trace.core.AppMethodBeat;
import java.util.Iterator;
final class zzes implements Iterator<String> {
private Iterator<String> zzafz = this.zzaga.zzafy.keySet().iterator();
private final /* synthetic */ zzer zzaga;
zzes(zzer zzer) {
this.zzaga = zzer;
AppMethodBeat.m2504i(68740);
AppMethodBeat.m2505o(68740);
}
public final boolean hasNext() {
AppMethodBeat.m2504i(68741);
boolean hasNext = this.zzafz.hasNext();
AppMethodBeat.m2505o(68741);
return hasNext;
}
public final /* synthetic */ Object next() {
AppMethodBeat.m2504i(68743);
String str = (String) this.zzafz.next();
AppMethodBeat.m2505o(68743);
return str;
}
public final void remove() {
AppMethodBeat.m2504i(68742);
UnsupportedOperationException unsupportedOperationException = new UnsupportedOperationException("Remove not supported");
AppMethodBeat.m2505o(68742);
throw unsupportedOperationException;
}
}
| [
"alwangsisi@163.com"
] | alwangsisi@163.com |
fea6a2632298789f1be804ff1f9c81b16e1ae046 | 8e3728bd2ebbf5688b044373c43e6b56bf1c92f6 | /src/com/chalet/rhinocort/controller/LoginController.java | 0d52ba2af3f453a889a2050876876a3ca615f1cb | [] | no_license | chaletli2014/rhinocort | 07b58f284edce800784660ad6239b4d7c146d42e | cb9e1e7c7aed34cf2b3d19d0ff384f840ec501b5 | refs/heads/master | 2016-09-05T17:13:43.857192 | 2015-01-20T14:08:07 | 2015-01-20T14:08:07 | 22,645,356 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,308 | java | package com.chalet.rhinocort.controller;
import javax.servlet.http.HttpServletRequest;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import com.chalet.rhinocort.model.WebUserInfo;
import com.chalet.rhinocort.service.UserService;
import com.chalet.rhinocort.utils.RhinocortAttributes;
@Controller
public class LoginController {
private Logger logger = Logger.getLogger(LoginController.class);
@Autowired
@Qualifier("userService")
private UserService userService;
@RequestMapping("/login")
public ModelAndView login(HttpServletRequest request){
ModelAndView view = new ModelAndView();
view.setViewName("login");
if( null != request.getSession(true).getAttribute(RhinocortAttributes.WEB_LOGIN_MESSAGE)){
view.addObject(RhinocortAttributes.WEB_LOGIN_MESSAGE,(String)request.getSession().getAttribute(RhinocortAttributes.WEB_LOGIN_MESSAGE));
}
request.getSession().removeAttribute(RhinocortAttributes.WEB_LOGIN_MESSAGE);
return view;
}
@RequestMapping("/doLogin")
public String doLogin(HttpServletRequest request){
try{
String telephone = request.getParameter("web_login_userName");
String password = request.getParameter("web_login_password");
WebUserInfo webUser = userService.getWebUser(telephone, password);
if( webUser == null ){
request.getSession(true).setAttribute(RhinocortAttributes.WEB_LOGIN_MESSAGE,RhinocortAttributes.WEB_LOGIN_MESSAGE_NO_USER);
return "redirect:login";
}else{
request.getSession(true).setAttribute(RhinocortAttributes.WEB_LOGIN_USER, webUser);
return "redirect:showUploadData";
}
}catch(Exception e){
logger.error("fail to login",e);
request.getSession(true).setAttribute(RhinocortAttributes.WEB_LOGIN_MESSAGE,e.getMessage());
return "redirect:login";
}
}
}
| [
"chaletproject@163.ccom"
] | chaletproject@163.ccom |
1ad1a7f53f5b3ace8c373f16e61e8041d8f94261 | d125c51de854615962e595e999eb6c53490fb3aa | /src/test/java/com/example/demo/BookRecordApplicationTests.java | 118afdfaa84ee2a3440a3f6cf99d08cafabf6de2 | [] | no_license | MitraSham49/BookRecord | 1e2ae986919bd4484057782d3b9a685a2bb20c74 | 14b0724f31309e55540fca33fa4a646eaa6271a3 | refs/heads/master | 2020-03-09T19:58:59.564959 | 2018-04-10T17:30:46 | 2018-04-10T17:30:46 | 128,971,386 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 337 | java | package com.example.demo;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class BookRecordApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"mairmeds@gmail.com"
] | mairmeds@gmail.com |
3c26fd492332b1f576d8d66bcccfa1d7a0dab27b | b40591ea380eced5360cc9f30e55a766f3a66585 | /qunaer/App/src/main/java/com/huawei/hwid/openapi/update/ui/BaseActivity.java | 291e47524883fcd4315575b6674daed2441fd620 | [] | no_license | PoseidonMRT/UserfulCodeResource | 08935f4155ac7567fc279300a03f80337f9a5516 | 040dacc22c236fde06f650c46c5cfeb8d52171c0 | refs/heads/master | 2022-10-09T13:00:48.616694 | 2019-04-19T02:42:45 | 2019-04-19T02:42:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,840 | java | package com.huawei.hwid.openapi.update.ui;
import android.app.ActionBar;
import android.app.Activity;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.MenuItem;
import com.huawei.hwid.openapi.quicklogin.d.a.c;
import com.huawei.hwid.openapi.quicklogin.d.b;
import java.util.ArrayList;
public abstract class BaseActivity extends Activity {
private int a = 0;
private int b = 0;
private boolean c = false;
private ProgressDialog d;
private ArrayList e = new ArrayList();
private boolean f = false;
private boolean g = true;
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
}
public void a(Dialog dialog) {
if (dialog != null) {
synchronized (this.e) {
c.b("BaseActivity", "mManagedDialogList.size = " + this.e.size());
this.e.add(dialog);
}
}
}
protected void onDestroy() {
a();
super.onDestroy();
}
public void a() {
synchronized (this.e) {
int size = this.e.size();
for (int i = 0; i < size; i++) {
Dialog dialog = (Dialog) this.e.get(i);
if (dialog.isShowing()) {
dialog.dismiss();
}
}
this.e.clear();
}
}
public synchronized void a(String str) {
if (TextUtils.isEmpty(str)) {
str = getString(b.a(this, "CS_waiting_progress_message"));
}
c.a("BaseActivity", "oobe Login, showRequestProgressDialog theme id is " + com.huawei.hwid.openapi.update.b.c.b(this));
if (this.d == null) {
this.d = new a(this, this);
this.d.setCanceledOnTouchOutside(false);
this.d.setMessage(str);
a(this.d);
}
c.a("BaseActivity", "this.isFinishing():" + isFinishing());
if (!(this.d.isShowing() || isFinishing())) {
this.d.setMessage(str);
this.d.show();
}
}
private boolean a(int i, KeyEvent keyEvent) {
if ((4 == i && !this.c) || 84 == i) {
return true;
}
if (this.c) {
finish();
}
return false;
}
public synchronized void b() {
c.b("BaseActivity", "dismissRequestProgressDialog");
if (this.d != null && this.d.isShowing()) {
this.d.dismiss();
}
}
public void setContentView(int i) {
int b = com.huawei.hwid.openapi.update.b.c.b(this);
if (b != 0) {
setTheme(b);
}
if (com.huawei.hwid.openapi.update.b.c.a || this.a == 0 || this.b == 0) {
try {
super.setContentView(i);
} catch (IllegalStateException e) {
c.d("BaseActivity", e.getMessage());
} catch (Exception e2) {
c.d("BaseActivity", e2.getMessage());
}
if (com.huawei.hwid.openapi.update.b.c.a && this.g) {
try {
ActionBar actionBar = getActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
if (this.a != 0) {
actionBar.setTitle(this.a);
return;
}
return;
}
return;
} catch (Throwable e3) {
c.a("BaseActivity", e3.getMessage(), e3);
return;
}
}
return;
}
super.setContentView(i);
}
public boolean onOptionsItemSelected(MenuItem menuItem) {
if (menuItem.getItemId() != 16908332) {
return super.onOptionsItemSelected(menuItem);
}
if (this.g) {
onBackPressed();
}
return true;
}
protected void onActivityResult(int i, int i2, Intent intent) {
synchronized (this) {
this.f = false;
super.onActivityResult(i, i2, intent);
}
}
public synchronized void startActivityForResult(Intent intent, int i) {
if ((intent.getFlags() & 268435456) == 0) {
if (!this.f) {
this.f = true;
}
}
super.startActivityForResult(intent, i);
}
public void startActivity(Intent intent) {
startActivityForResult(intent, 0);
}
public void onBackPressed() {
try {
super.onBackPressed();
} catch (Throwable e) {
c.b("BaseActivity", "catch Exception throw by FragmentManager!", e);
}
}
}
| [
"1044176601@qq.com"
] | 1044176601@qq.com |
b5fc4ad75679b48cc7af9a9d0667157b3f5af491 | 4f4a5b824aa92a356ae56f99914506755a09d2fb | /TellyChatter/src/main/java/com/project/telly/util/Crawler.java | eac48d8695fc786dbadcc6d632caa10c9834e306 | [] | no_license | yuzuin/TellyChatter | edc4903429c759b8baa7f01cf41ef5b651ee4096 | 30b31fcfe998feec6dcb26c74ed0a798926a084c | refs/heads/master | 2023-03-30T07:39:35.702445 | 2021-03-26T15:05:47 | 2021-03-26T15:05:47 | 345,084,413 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,653 | java | package com.project.telly.util;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import com.project.telly.vo.naverMovieDTO;
public class Crawler {
// 크롤러
//static ArrayList<naverMovieDTO> movieList = new ArrayList<>();
public static void main(String[] args) {
// // Jsoup를 이용해서 http://www.cgv.co.kr/movies/ 크롤링
// String url = "https://movie.naver.com/movie/running/current.nhn"; //크롤링할 url지정
// Document doc = null; //Document에는 페이지의 전체 소스가 저장된다
//
// try {
// doc = Jsoup.connect(url).get();
// } catch (IOException e) {
// e.printStackTrace();
// }
// //select를 이용하여 원하는 태그를 선택한다. select는 원하는 값을 가져오기 위한 중요한 기능이다.
// Elements element = doc.select("li");
//
// System.out.println("============================================================");
//
// //Iterator을 사용하여 하나씩 값 가져오기
// Iterator<Element> ie1 = element.select("dt.tit").iterator();
// Iterator<Element> ie2 = element.select("dd").iterator();
// Iterator<Element> ie3 = element.select("img").iterator();
//
// naverMovieDTO movie=new naverMovieDTO();
// for(int i=0;i<5;i++) {
// movie.setTitle(ie1.next().text());
// movie.setInfo(ie2.next().text());
// movie.setImg(ie3.next().text());
//
// movieList.add(movie);
// }
//
// /**
// while (ie1.hasNext()) {
// System.out.println(ie1.next().text()+"\t"+ie2.next().text()+"\t"+ie3.next());
// }
// */
//
// System.out.println("============================================================");
movieGetter();
}
public static ArrayList<naverMovieDTO> movieGetter() {
ArrayList<naverMovieDTO> movieList = new ArrayList<>();
naverMovieDTO[] movies = new naverMovieDTO[6];
// Jsoup를 이용해서 http://www.cgv.co.kr/movies/ 크롤링
String url = "http://www.cgv.co.kr/movies/"; //크롤링할 url지정
Document doc = null; //Document에는 페이지의 전체 소스가 저장된다
try {
doc = Jsoup.connect(url).get();
} catch (IOException e) {
e.printStackTrace();
}
//select를 이용하여 원하는 태그를 선택한다. select는 원하는 값을 가져오기 위한 중요한 기능이다.
Elements element = doc.select("ol");
System.out.println("============================================================");
//Iterator을 사용하여 하나씩 값 가져오기
Iterator<Element> ie1 = element.select("strong.title").iterator();
Iterator<Element> ie2 = element.select("span.txt-info").iterator();
Iterator<Element> ie3 = element.select("span.thumb-image").iterator();
Iterator<Element> ie4 = element.select("div.box-contents>a").iterator();
int i=0;
while(ie1.hasNext()) {
String imgSrc = ie3.next().getElementsByAttribute("src").attr("src"); // 이미지 소스
String detailLink = ie4.next().getElementsByAttribute("href").attr("href"); // 뮤비 디테일
naverMovieDTO movie=new naverMovieDTO();
movie.setTitle(ie1.next().text());
movie.setInfo(ie2.next().text());
movie.setImg(imgSrc);
movie.setDetail(detailLink);
movieList.add(movie);
movies[i]=movie;
System.out.println(movieList.get(i).getTitle());
System.out.println(movieList.get(i).getInfo());
System.out.println("이미지 "+movieList.get(i).getImg());
i++;
if(i>5) break;
}
return movieList;
}
}
| [
"united1878@hanmail.net"
] | united1878@hanmail.net |
342a54b061af9f8fcf181deaf5d1a1f9a25ad1b8 | 3ae5b7927ea0d5342b75240b775576dcd1e01973 | /src/test/t0429count.java | e7288bb3170f6c55b0ce5b373f06e93d3da262b2 | [] | no_license | lilililizhan/leetcode | 755a0fbb75af7efb20b0c9d4a40de485484ece51 | e02b635d76313127528fe9b700338c28409f29f4 | refs/heads/master | 2023-07-10T09:10:46.215759 | 2021-08-01T04:51:12 | 2021-08-01T04:51:12 | 386,297,127 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,020 | java | package test;
import java.util.*;
public class t0429count {
public static void main(String[] args) {
//第一题
// Scanner sc = new Scanner(System.in);
// String text = sc.nextLine();
// while(sc.hasNextLine()){
// String stemp = sc.nextLine();
// if(stemp.length()==0)break;
// text += " "+stemp;
// }
// Map<String,Integer> map = count(text);
// for (String s:map.keySet()
// ) {
// System.out.println(s+": "+map.get(s));
// }
//第二题
// int[] arr = {23,23,56,90,76,73,11,90};
// int[] res = del2(arr);
// System.out.println(Arrays.toString(res));
//第四题
// int[] arr = {0,1,2,3,4,5,6};
// dis(arr);
// System.out.println(Arrays.toString(arr));
//第三题
int[] arr = {3,5,7,1,4,8};
quickSort(arr,0,arr.length-1);
System.out.println(Arrays.toString(arr));
}
public static Map<String, Integer> count(String text){
Map<String,Integer> map = new HashMap<>();
String[] sarr = text.split(" ");
// System.out.println(Arrays.toString(sarr));
for (int i = 0; i < sarr.length; i++) {
int temp = map.getOrDefault(sarr[i],0);
map.put(sarr[i],temp+1);
}
return map;
}
public static int[] del(int[] arr){
Set<Integer> set = new HashSet<>();
for (int i = 0; i < arr.length; i++) {
set.add(arr[i]);
}
int[] res = new int[set.size()];
int index = 0;
for (Integer i: set) {
res[index] = i;
index++;
}
return res;
}
public static int[] del2(int[] arr){
Set<Integer> set = new LinkedHashSet<>();
for (int i = 0; i < arr.length; i++) {
set.add(arr[i]);
}
int[] res = new int[set.size()];
int index = 0;
System.out.println(set.toString());
System.out.println("----------");
// for (int i = 0; i < set.size(); i++) {
// System.out.println(set.toString());
// }
for (Integer i: set) {
res[index] = i;
index++;
}
return res;
}
public static void dis(int[] arr){
int len = arr.length;
int i =0;
int j = len-1;
int temp;
if(len %2 ==1){
temp = arr[(i+j)/2];
arr[(i+j)/2] = arr[0];
arr[0] = temp;
}
while(i<j){
temp = arr[j];
arr[j] = arr[i];
arr[i] = temp;
i++;
j--;
}
}
//
// public static void quickSort(int[] arr,int left,int rigjt){
// int i = left;
// int j = rigjt;
// if(i==j)return;
// int middle = (i+j)/2;
// while (i<j){
// while (i<middle){
// if(arr[i]<arr[middle])i++;
// else break;
// }
// while(j>middle){
// if(arr[j]>arr[middle])j--;
// else break;
// }
// if(i>=j)break;
// int temp = arr[i];
// arr[i] = arr[j];
// arr[j] = temp;
// }
// quickSort(arr,0,middle-1);
// quickSort(arr,middle+1,arr.length-1);
//
// }
public static void quickSort(int[] arr,int left, int right) {
if(left>=right)return;
int l = left;
int r = right;
int middle = arr[(left + right) / 2];
int temp;
while( l < r) {
while( arr[l] < middle) l++;
while(arr[r] > middle) r--;
if( l >= r) break;
temp = arr[l];
arr[l] = arr[r];
arr[r] = temp;
if(arr[l] == middle) r--;
if(arr[r] == middle) l++;
}
if (l == r) {
l += 1;
r -= 1;
}
quickSort(arr, left, r);
quickSort(arr, l, right);
}
}
| [
"1509333628@qq.com"
] | 1509333628@qq.com |
c12e1c99a75af24d0d1647d54010e65748dcc1b0 | d8b5ccb6e62f819695f7a88c8c2a7b1e0926fa05 | /LigaSalaCadiz/src/servlets/BorraUsuario.java | 4d1ca24ec661b6821755f8ccf84eba53a0650753 | [] | no_license | AngelBayRo/WebIISS | d645e785b970816b3597aae7fe4dea257b9a8ee5 | e16c8ad35e0de8a9de8aec2c515e4975c1225eda | refs/heads/master | 2021-01-13T00:52:39.684259 | 2016-01-18T17:03:05 | 2016-01-18T17:03:05 | 49,880,987 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,404 | java | package servlets;
import java.io.IOException;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.swing.JOptionPane;
import entidades.Usuario;
import bd.UsuarioBD;
/**
* Servlet implementation class BorraUsuario
*/
public class BorraUsuario extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public BorraUsuario() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Usuario u=null;
UsuarioBD ubd= new UsuarioBD();
try {
u= ubd.usuario_bynick("josecai7");
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println(u.getNombre());
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("HOLA1");
}
}
| [
"anbayrom@gmail.com"
] | anbayrom@gmail.com |
689e45d3b69b9d223caa39d3dd3b64d320eb66b9 | de9c826fde5b804b7b0305bc6b1977a0a2611005 | /app/src/main/java/realmstudy/adapter/recycler/WrapperAdapter.java | d4f6780b49008fcef8a376c84570cbdf38faad4f | [] | no_license | spnaga68/ILC_NEW | 6c8ddaceb133d889ce7d4a82d44c7678c0da9871 | 1a8e1189e1d1ec43ccb031cd308a3b17efd35cc7 | refs/heads/master | 2020-12-30T17:00:06.576793 | 2017-08-22T15:00:12 | 2017-08-22T15:00:12 | 91,053,006 | 0 | 0 | null | 2017-08-22T15:00:13 | 2017-05-12T04:57:08 | Java | UTF-8 | Java | false | false | 2,561 | java | package realmstudy.adapter.recycler;
import android.support.v7.widget.RecyclerView;
import android.view.ViewGroup;
class WrapperAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private static final int ITEM_VIEW_TYPE_LOADING = Integer.MAX_VALUE - 50; // Magic
private final RecyclerView.Adapter wrappedAdapter;
private final LoadingListItemCreator loadingListItemCreator;
private boolean displayLoadingRow = true;
public WrapperAdapter(RecyclerView.Adapter adapter, LoadingListItemCreator creator) {
this.wrappedAdapter = adapter;
this.loadingListItemCreator = creator;
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
if (viewType == ITEM_VIEW_TYPE_LOADING) {
return loadingListItemCreator.onCreateViewHolder(parent, viewType);
} else {
return wrappedAdapter.onCreateViewHolder(parent, viewType);
}
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
if (isLoadingRow(position)) {
loadingListItemCreator.onBindViewHolder(holder, position);
} else {
wrappedAdapter.onBindViewHolder(holder, position);
}
}
@Override
public int getItemCount() {
return displayLoadingRow ? wrappedAdapter.getItemCount() + 1 : wrappedAdapter.getItemCount();
}
@Override
public int getItemViewType(int position) {
return isLoadingRow(position) ? ITEM_VIEW_TYPE_LOADING : wrappedAdapter.getItemViewType(position);
}
@Override
public long getItemId(int position) {
return isLoadingRow(position) ? RecyclerView.NO_ID : wrappedAdapter.getItemId(position);
}
@Override
public void setHasStableIds(boolean hasStableIds) {
super.setHasStableIds(hasStableIds);
wrappedAdapter.setHasStableIds(hasStableIds);
}
public RecyclerView.Adapter getWrappedAdapter() {
return wrappedAdapter;
}
boolean isDisplayLoadingRow() {
return displayLoadingRow;
}
void displayLoadingRow(boolean displayLoadingRow) {
if (this.displayLoadingRow != displayLoadingRow) {
this.displayLoadingRow = displayLoadingRow;
notifyDataSetChanged();
}
}
boolean isLoadingRow(int position) {
return displayLoadingRow && position == getLoadingRowPosition();
}
private int getLoadingRowPosition() {
return displayLoadingRow ? getItemCount() - 1 : -1;
}
} | [
"nagarajan929@gmail.com"
] | nagarajan929@gmail.com |
3e2173a8f90d647b47d0f54800787b3a53ef6ecc | ef0c1514e9af6de3ba4a20e0d01de7cc3a915188 | /sdk/webpubsub/azure-messaging-webpubsub/src/samples/java/com/azure/messaging/webpubsub/DirectMessageSample.java | f51b365851d8ce66d53c5d023df623089106e8a4 | [
"MIT",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-unknown-license-reference",
"LGPL-2.1-or-later",
"CC0-1.0",
"BSD-3-Clause",
"UPL-1.0",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"LicenseRef-scancode-generic-cla"
] | permissive | Azure/azure-sdk-for-java | 0902d584b42d3654b4ce65b1dad8409f18ddf4bc | 789bdc6c065dc44ce9b8b630e2f2e5896b2a7616 | refs/heads/main | 2023-09-04T09:36:35.821969 | 2023-09-02T01:53:56 | 2023-09-02T01:53:56 | 2,928,948 | 2,027 | 2,084 | MIT | 2023-09-14T21:37:15 | 2011-12-06T23:33:56 | Java | UTF-8 | Java | false | false | 967 | java | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.azure.messaging.webpubsub;
import com.azure.core.util.Configuration;
import com.azure.messaging.webpubsub.models.WebPubSubContentType;
public class DirectMessageSample {
private static final String CONNECTION_STRING = Configuration.getGlobalConfiguration().get("WEB_PUB_SUB_CS");
public static void main(String[] args) {
// build a sync client
WebPubSubServiceClient chatHub = new WebPubSubServiceClientBuilder()
.connectionString(CONNECTION_STRING)
.hub("chat")
.buildClient();
// send a text message directly to a user
chatHub.sendToUser("jogiles", "Hi there!", WebPubSubContentType.TEXT_PLAIN);
// send a text message to a specific connection
chatHub.sendToConnection("Tn3XcrAbHI0OE36XvbWwige4ac096c1", "Hi there!", WebPubSubContentType.TEXT_PLAIN);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
53049cb1c70a0ffe531e3e2c2df346189a5aa13d | 44e7adc9a1c5c0a1116097ac99c2a51692d4c986 | /aws-java-sdk-codeartifact/src/main/java/com/amazonaws/services/codeartifact/model/transform/AccessDeniedExceptionUnmarshaller.java | f7f5c5047e64d54ddd327436c7c2b19a538bca74 | [
"Apache-2.0"
] | permissive | QiAnXinCodeSafe/aws-sdk-java | f93bc97c289984e41527ae5bba97bebd6554ddbe | 8251e0a3d910da4f63f1b102b171a3abf212099e | refs/heads/master | 2023-01-28T14:28:05.239019 | 2020-12-03T22:09:01 | 2020-12-03T22:09:01 | 318,460,751 | 1 | 0 | Apache-2.0 | 2020-12-04T10:06:51 | 2020-12-04T09:05:03 | null | UTF-8 | Java | false | false | 2,862 | java | /*
* Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.codeartifact.model.transform;
import java.math.*;
import javax.annotation.Generated;
import com.amazonaws.services.codeartifact.model.*;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*;
import com.amazonaws.transform.*;
import com.fasterxml.jackson.core.JsonToken;
import static com.fasterxml.jackson.core.JsonToken.*;
/**
* AccessDeniedException JSON Unmarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AccessDeniedExceptionUnmarshaller extends EnhancedJsonErrorUnmarshaller {
private AccessDeniedExceptionUnmarshaller() {
super(com.amazonaws.services.codeartifact.model.AccessDeniedException.class, "AccessDeniedException");
}
@Override
public com.amazonaws.services.codeartifact.model.AccessDeniedException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception {
com.amazonaws.services.codeartifact.model.AccessDeniedException accessDeniedException = new com.amazonaws.services.codeartifact.model.AccessDeniedException(
null);
int originalDepth = context.getCurrentDepth();
String currentParentElement = context.getCurrentParentElement();
int targetDepth = originalDepth + 1;
JsonToken token = context.getCurrentToken();
if (token == null)
token = context.nextToken();
if (token == VALUE_NULL) {
return null;
}
while (true) {
if (token == null)
break;
if (token == FIELD_NAME || token == START_OBJECT) {
} else if (token == END_ARRAY || token == END_OBJECT) {
if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {
if (context.getCurrentDepth() <= originalDepth)
break;
}
}
token = context.nextToken();
}
return accessDeniedException;
}
private static AccessDeniedExceptionUnmarshaller instance;
public static AccessDeniedExceptionUnmarshaller getInstance() {
if (instance == null)
instance = new AccessDeniedExceptionUnmarshaller();
return instance;
}
}
| [
""
] | |
be9ddef6e225209a41cf876d72fbd54a90819c9f | 43e1e499e70caca6752a38de495b30700fc152e4 | /src/main/java/com/ezhuanbing/api/service/RoleService.java | bde88f3146f068c9531db2dec0c7b5b2c2ccb598 | [] | no_license | jiabangping/ezhuanbing-api | e33e41fd02fcf11aafb480aec2fe249e9dd4bb2f | 33de2fe78fade991c8a5b27352bd2781073c9c0a | refs/heads/master | 2021-01-12T12:29:19.063273 | 2016-11-01T07:52:11 | 2016-11-01T07:52:11 | 72,514,995 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,780 | java | package com.ezhuanbing.api.service;
import com.ezhuanbing.api.dao.mybatis.mapper.FunctionMapper;
import com.ezhuanbing.api.dao.mybatis.mapper.RoleFunctionsMapper;
import com.ezhuanbing.api.dao.mybatis.mapper.RoleInfoMapper;
import com.ezhuanbing.api.dao.mybatis.mapper.UserFunctionsMapper;
import com.ezhuanbing.api.dao.mybatis.mapper.UserRolesMapper;
import com.ezhuanbing.api.exception.HttpStatus403Exception;
import com.ezhuanbing.api.exception.HttpStatus404Exception;
import com.ezhuanbing.api.exception.HttpStatus409Exception;
import com.ezhuanbing.api.main.FunctionDefinition;
import com.ezhuanbing.api.model.Function;
import com.ezhuanbing.api.model.RoleFunctions;
import com.ezhuanbing.api.model.RoleInfo;
import com.ezhuanbing.api.model.RoleInfoExample;
import com.ezhuanbing.api.model.UserFunctions;
import com.ezhuanbing.api.model.UserRoles;
import com.ezhuanbing.api.model.UserRolesExample;
import com.ezhuanbing.api.vo.RoleFunction;
import com.github.pagehelper.PageHelper;
import org.apache.commons.lang.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by wangwl on 2016/7/16.
*/
@Service
public class RoleService {
@Autowired
private RoleInfoMapper roleInfoMapper;
@Autowired
private RoleFunctionsMapper roleFunctionsMapper;
@Autowired
private FunctionMapper functionMapper;
@Autowired
private UserRolesMapper userRolesMapper;
@Autowired
private UserFunctionsMapper userFunctionsMapper;
public List<RoleFunction> getListByName(int hospitalId, String name, Integer pageIndex, Integer pageSize) throws HttpStatus403Exception {
List<RoleFunction> roleFunctionList = new ArrayList<RoleFunction>();
PageHelper.startPage(pageIndex, pageSize, "roleId");
RoleInfoExample example = new RoleInfoExample();
example.createCriteria().andHospitalIdEqualTo(hospitalId).andRoleNameLike("%" + name + "%");
List<RoleInfo> roleInfoList = roleInfoMapper.selectByExample(example);
for (RoleInfo roleInfo : roleInfoList) {
List<Function> functionList = functionMapper.selectByRoleId(roleInfo.getRoleId());
RoleFunction roleFunction = RoleFunction.builder()
.roleId(roleInfo.getRoleId()).roleName(roleInfo.getRoleName()).functions(functionList)
.build();
roleFunctionList.add(roleFunction);
}
return roleFunctionList;
}
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
public RoleFunction insertRole(int hospitalId, RoleFunction roleFunction) throws HttpStatus403Exception {
RoleInfo roleInfo = RoleInfo.builder().roleName(roleFunction.getRoleName()).hospitalId(hospitalId).build();
int result = roleInfoMapper.insert(roleInfo);
if (result > 0) {
List<Function> functions = roleFunction.getFunctions();
insertRoleFunction(roleInfo.getRoleId(), functions);
}
return getRoleFunction(hospitalId, roleInfo.getRoleId());
}
private void insertRoleFunction(Integer roleId, List<Function> functions) {
List<Integer> tabFunction = new ArrayList<>();
Map<Integer, Integer[]> tabFunctionMap = new HashMap<>(FunctionDefinition.TAB_FUNCTION_MAP);
for (Function function : functions) {
RoleFunctions roleFunctions = RoleFunctions.builder()
.roleId(roleId).functionId(function.getId()).build();
roleFunctionsMapper.insert(roleFunctions);
for (Map.Entry<Integer, Integer[]> integerEntry : tabFunctionMap.entrySet()) {
if (ArrayUtils.contains(integerEntry.getValue(), function.getId())) {
tabFunction.add(integerEntry.getKey());
tabFunctionMap.remove(integerEntry.getKey());
break;
}
}
}
for (Integer integer : tabFunction) {
RoleFunctions roleFunctions = RoleFunctions.builder()
.roleId(roleId).functionId(integer).build();
roleFunctionsMapper.insert(roleFunctions);
}
}
public RoleFunction getRoleFunction(int hospitalId, Integer id) throws HttpStatus403Exception {
int count = verifyHospitalRole(hospitalId, id);
if (count < 1) {
throw new HttpStatus403Exception("服务器拒绝请求", "update_role_error",
"更新角色失败,该用户的权限不允许此角色", "");
}
RoleInfo roleInfo = roleInfoMapper.selectByPrimaryKey(id);
List<Function> functionList = functionMapper.selectByRoleId(roleInfo.getRoleId());
return RoleFunction.builder()
.roleId(roleInfo.getRoleId()).roleName(roleInfo.getRoleName()).functions(functionList)
.build();
}
private int verifyHospitalRole(int hospitalId, Integer id) {
RoleInfoExample example = new RoleInfoExample();
example.createCriteria().andHospitalIdEqualTo(hospitalId).andRoleIdEqualTo(id);
return roleInfoMapper.selectCountByExample(example);
}
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
public void updateRole(int hospitalId, RoleFunction roleFunction) throws HttpStatus403Exception, HttpStatus404Exception {
int count = verifyHospitalRole(hospitalId, roleFunction.getRoleId());
if (count < 1) {
throw new HttpStatus403Exception("服务器拒绝请求", "update_role_error",
"更新角色失败,该用户的权限不允许此角色", "");
}
RoleInfo roleInfo = RoleInfo.builder().roleId(roleFunction.getRoleId()).roleName(roleFunction.getRoleName()).build();
count = roleInfoMapper.updateByPrimaryKeySelective(roleInfo);
if (count < 1) {
throw new HttpStatus404Exception("服务器找不到对应资源", "update_role_error",
"更新角色失败,服务器找不到对应资源。 角色 id = " + roleFunction.getRoleId() + " ,可能是没有该角色", "");
}
RoleFunctions delete = RoleFunctions.builder()
.roleId(roleInfo.getRoleId()).build();
roleFunctionsMapper.delete(delete);
List<Function> functions = roleFunction.getFunctions();
insertRoleFunction(roleInfo.getRoleId(), functions);
}
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
public void deleteRole(int hospitalId, Integer id) throws HttpStatus403Exception, HttpStatus404Exception, HttpStatus409Exception {
int count = verifyHospitalRole(hospitalId, id);
if (count < 1) {
throw new HttpStatus403Exception("服务器拒绝请求", "delete_role_error",
"删除角色失败,该用户的权限不允许删除此角色", "");
}
UserRolesExample example = new UserRolesExample();
example.createCriteria().andRoleIdEqualTo(id);
count = userRolesMapper.selectCountByExample(example);
if (count > 0) {
throw new HttpStatus409Exception("资源冲突,或者资源被锁定", "delete_role_error",
"该角色已有用户在使用,不允许删除", "");
}
count = roleInfoMapper.deleteByPrimaryKey(id);
if (count < 1) {
throw new HttpStatus404Exception("服务器找不到对应资源", "delete_role_error",
"删除角色失败,服务器找不到对应资源。 角色 id = " + id + " ,可能是没有该角色", "");
}
RoleFunctions delete = RoleFunctions.builder()
.roleId(id).build();
roleFunctionsMapper.delete(delete);
}
public List<RoleFunction> getListByUserId(Integer userId) throws HttpStatus403Exception {
List<RoleFunction> roleFunctionList = new ArrayList<>();
List<RoleInfo> roleInfoList = roleInfoMapper.selectByUserId(userId);
for (RoleInfo roleInfo : roleInfoList) {
List<Function> functionList = functionMapper.selectByRoleId(roleInfo.getRoleId());
RoleFunction roleFunction = RoleFunction.builder()
.roleId(roleInfo.getRoleId()).roleName(roleInfo.getRoleName()).functions(functionList)
.build();
roleFunctionList.add(roleFunction);
}
return roleFunctionList;
}
public List<Function> getFunctionListByUserId(Integer id) {
return functionMapper.selectByUserId(id);
}
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
public void updateUserRole(Integer id, List<RoleFunction> roleFunctionList, List<Function> functionList) {
userRolesMapper.delete(UserRoles.builder().userId(id).build());
List<UserRoles> userRolesList = new ArrayList<>(roleFunctionList.size());
for (RoleFunction roleFunction : roleFunctionList) {
UserRoles userRolesBuilder = UserRoles.builder().userId(id).roleId(roleFunction.getRoleId()).build();
userRolesList.add(userRolesBuilder);
}
if (userRolesList.size() > 0) {
userRolesMapper.insertList(userRolesList);
}
Map<Integer, Integer[]> tabFunctionMap = new HashMap<>(FunctionDefinition.TAB_FUNCTION_MAP);
userFunctionsMapper.delete(UserFunctions.builder().userId(id).build());
List<UserFunctions> userFunctionsList = new ArrayList<>();
for (Function function : functionList) {
UserFunctions userFunctions = UserFunctions.builder().userId(id).functionId(function.getId()).build();
userFunctionsList.add(userFunctions);
for (Map.Entry<Integer, Integer[]> integerEntry : tabFunctionMap.entrySet()) {
if (ArrayUtils.contains(integerEntry.getValue(), function.getId())) {
userFunctionsList.add(UserFunctions.builder().userId(id).functionId(integerEntry.getKey()).build());
tabFunctionMap.remove(integerEntry.getKey());
break;
}
}
}
if (userFunctionsList.size() > 0) {
userFunctionsMapper.insertList(userFunctionsList);
}
}
public List<Function> getFunctionListByRoleInfoList(int hospitalId, List<Integer> roleIds) throws HttpStatus403Exception {
if (roleIds == null || roleIds.size() == 0) {
return Collections.emptyList();
}
RoleInfoExample example = new RoleInfoExample();
example.createCriteria().andHospitalIdEqualTo(hospitalId).andRoleIdIn(roleIds);
int count = roleInfoMapper.selectCountByExample(example);
if (count != roleIds.size()) {
throw new HttpStatus403Exception("服务器拒绝请求", "get_function_error",
"获取方法集合失败,该用户不具有访问下列角色的权限 :" + Arrays.toString(roleIds.toArray()), "");
}
return functionMapper.selectAllByRoleIds(roleIds);
}
}
| [
"1355926178@qq.com"
] | 1355926178@qq.com |
ac7781ac89cc794fc37bb7257da2b2735257abb3 | fc3d9c8aa49987c65c4d454a911feaac96c4e81d | /src/main/java/linhVu/ApplicationInitializer.java | ad63a6eed3bcca3d27df18e2288deab1a93944ae | [] | no_license | Vuthuylinh/iNote_File | a1c0324070c721a8f70efad186b974c59a29885a | 2fa46e1bcb298768c90d845e7f0dbd7d6a98952f | refs/heads/master | 2020-08-19T13:21:07.792040 | 2019-10-18T02:21:32 | 2019-10-18T02:21:32 | 215,924,118 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 944 | java | package linhVu;
import org.springframework.web.filter.CharacterEncodingFilter;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
import javax.servlet.Filter;
public class ApplicationInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
@Override
protected Class<?>[] getRootConfigClasses() {
return new Class[]{ApplicationConfig.class};
}
@Override
protected Class<?>[] getServletConfigClasses() {
return new Class[]{};
}
@Override
protected String[] getServletMappings() {
return new String[]{"/"};
}
//de go tieng Viet trong database
@Override
protected Filter[] getServletFilters() {
CharacterEncodingFilter characterEncodingFilter = new CharacterEncodingFilter();
characterEncodingFilter.setEncoding("UTF-8");
return new Filter[]{characterEncodingFilter};
}
} | [
"thuylinh2490@gmail.com"
] | thuylinh2490@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.