blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
listlengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8485b9ae7cf5b5abcc78fe0e496bae71d19f53df
|
2054895337b913b51fa8be9d2906f6c97923eda4
|
/src/main/java/org/hr_xml/_3/USHealthCoverageCodeType.java
|
fbc8581df21b16f68c5d60355d4b14bb689af541
|
[] |
no_license
|
jkomorek/hrxml
|
92e9fee42336a2b4b9e91fa7383584de452b8e79
|
4151d85f1a4e05132f4f1bda3d06b3e0705069f9
|
refs/heads/master
| 2021-01-23T03:04:51.415157 | 2014-02-28T05:51:52 | 2014-02-28T05:51:52 | 16,828,973 | 3 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 7,127 |
java
|
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2014.01.06 at 10:26:45 PM EST
//
package org.hr_xml._3;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlValue;
import javax.xml.bind.annotation.adapters.NormalizedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
/**
* <p>Java class for USHealthCoverageCodeType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="USHealthCoverageCodeType">
* <simpleContent>
* <extension base="<http://www.hr-xml.org/3>USHealthCoverageCodeContentType">
* <attGroup ref="{http://www.openapplications.org/oagis/9}CodeListAttributeGroup"/>
* </extension>
* </simpleContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "USHealthCoverageCodeType", propOrder = {
"value"
})
public class USHealthCoverageCodeType {
@XmlValue
protected String value;
@XmlAttribute(name = "listID")
@XmlJavaTypeAdapter(NormalizedStringAdapter.class)
protected String listID;
@XmlAttribute(name = "listAgencyID")
@XmlJavaTypeAdapter(NormalizedStringAdapter.class)
protected String listAgencyID;
@XmlAttribute(name = "listAgencyName")
protected String listAgencyName;
@XmlAttribute(name = "listName")
protected String listName;
@XmlAttribute(name = "listVersionID")
@XmlJavaTypeAdapter(NormalizedStringAdapter.class)
protected String listVersionID;
@XmlAttribute(name = "name")
protected String name;
@XmlAttribute(name = "languageID")
protected String languageID;
@XmlAttribute(name = "listURI")
@XmlSchemaType(name = "anyURI")
protected String listURI;
@XmlAttribute(name = "listSchemeURI")
@XmlSchemaType(name = "anyURI")
protected String listSchemeURI;
/**
* A code that classifies the types of tier coverage. This is an HR-XML open list.
*
* @return
* possible object is
* {@link String }
*
*/
public String getValue() {
return value;
}
/**
* Sets the value of the value property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setValue(String value) {
this.value = value;
}
/**
* Gets the value of the listID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getListID() {
return listID;
}
/**
* Sets the value of the listID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setListID(String value) {
this.listID = value;
}
/**
* Gets the value of the listAgencyID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getListAgencyID() {
return listAgencyID;
}
/**
* Sets the value of the listAgencyID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setListAgencyID(String value) {
this.listAgencyID = value;
}
/**
* Gets the value of the listAgencyName property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getListAgencyName() {
return listAgencyName;
}
/**
* Sets the value of the listAgencyName property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setListAgencyName(String value) {
this.listAgencyName = value;
}
/**
* Gets the value of the listName property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getListName() {
return listName;
}
/**
* Sets the value of the listName property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setListName(String value) {
this.listName = value;
}
/**
* Gets the value of the listVersionID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getListVersionID() {
return listVersionID;
}
/**
* Sets the value of the listVersionID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setListVersionID(String value) {
this.listVersionID = value;
}
/**
* Gets the value of the name property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getName() {
return name;
}
/**
* Sets the value of the name property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setName(String value) {
this.name = value;
}
/**
* Gets the value of the languageID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLanguageID() {
return languageID;
}
/**
* Sets the value of the languageID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLanguageID(String value) {
this.languageID = value;
}
/**
* Gets the value of the listURI property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getListURI() {
return listURI;
}
/**
* Sets the value of the listURI property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setListURI(String value) {
this.listURI = value;
}
/**
* Gets the value of the listSchemeURI property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getListSchemeURI() {
return listSchemeURI;
}
/**
* Sets the value of the listSchemeURI property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setListSchemeURI(String value) {
this.listSchemeURI = value;
}
}
|
[
"[email protected]"
] | |
7174512c73e131558ce5f3095191b39a666fc861
|
1b626c504f46844f4056a4b6acb6aef702feb736
|
/Math/Division.java
|
6bb1e430cd821e09bdfe3656b970e02f6f20cba6
|
[] |
no_license
|
zxcware/Algorithm
|
120a87f451dadb21d3533efc842caad4441d3250
|
aa7f56107668c67708aaeace4e965f00e2402ebe
|
refs/heads/master
| 2021-01-01T16:56:09.141197 | 2013-10-24T17:44:32 | 2013-10-24T17:44:32 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,152 |
java
|
package Math;
/* Leetcode */
public class Division {
private int neg(int a) {
int neg = 0;
int d = a < 0 ? -1 : 1;
while (a != 0) {
neg += d;
a += d;
}
return neg;
}
private int abs(int a) {
if (a < 0)
return neg(a);
else
return a;
}
public int divide(int m, int n) {
int absm = abs(m);
int absn = abs(n);
if (absm < absn)
return 0;
int preRes = 0, res = 1;
int preTotal = 0, total = absn;
while (total < absm) {
preTotal = total;
total += total;
preRes = res;
res += res;
}
if (total > absm) {
total = preTotal;
res = preRes;
while (total < absm) {
total += absn;
res += 1;
}
if (total > absm)
res -= 1;
}
if ((m ^ n) < 0) {
res = neg(res);
}
return res;
}
public int divide2(int dividend, int divisor) {
// Start typing your Java solution below
// DO NOT write main() function
long a = Math.abs((long) dividend);
long b = Math.abs((long) divisor);
int res = 0;
while (a >= b) {
int i = 1;
while (a >= (b << i))
i++;
res |= (1 << (i - 1));
a -= (b << (i - 1));
}
if (((dividend ^ divisor) >> 31) != 0)
res = -res;
return res;
}
public int divide3(int dividend, int divisor) {
// Start typing your Java solution below
// DO NOT write main() function
if (divisor == 0)
return -1;
boolean negative = (dividend ^ divisor) < 0;
long a = Math.abs((long)dividend);
long b = Math.abs((long)divisor);
int count, res = 0;
while (a >= b){
count = 1;
while ((b << count) <= a)
count++;
count--;
res += (1 << count);
a -= (b << count);
}
if (negative)
return -res;
return res;
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Division div = new Division();
int a = -1;
int b = 1;
System.out.println(div.divide2(a, b));
System.out.println(div.divide3(a, b));
System.out.println((a ^ b) > 0);
}
}
|
[
"czx@czx-ThinkPad-T430.(none)"
] |
czx@czx-ThinkPad-T430.(none)
|
7fed9f338bc374194a0b082eaddd94b580032f3b
|
ef2b2697731a0e509ee13043a3bc21b0fbcd2dc6
|
/tools/plugins/com.liferay.ide.server.ui/src/com/liferay/ide/server/ui/action/AbstractServerRunningAction.java
|
e384174303572dd06878f098da7507209306d01b
|
[] |
no_license
|
cinnndy9/liferay-ide
|
e7ad193cc17592111778ee06e558c3f05d502205
|
afabd27787cb7215f7c8b7e60bed694645568506
|
refs/heads/master
| 2020-12-25T06:31:30.607233 | 2013-02-28T03:44:16 | 2013-02-28T03:50:30 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,909 |
java
|
/*******************************************************************************
* Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
*******************************************************************************/
package com.liferay.ide.server.ui.action;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PlatformUI;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.ui.IServerModule;
/**
* @author Greg Amerson
*/
public abstract class AbstractServerRunningAction implements IObjectActionDelegate
{
protected IServer selectedServer;
protected IServerModule selectedModule;
protected IWorkbenchPart activePart;
public AbstractServerRunningAction()
{
super();
}
public void selectionChanged( IAction action, ISelection selection )
{
selectedServer = null;
if( !selection.isEmpty() )
{
if( selection instanceof IStructuredSelection )
{
Object obj = ( (IStructuredSelection) selection ).getFirstElement();
if( obj instanceof IServer )
{
selectedServer = (IServer) obj;
action.setEnabled( ( selectedServer.getServerState() & getRequiredServerState() ) > 0 );
}
else if( obj instanceof IServerModule )
{
selectedModule = (IServerModule) obj;
action.setEnabled( ( selectedModule.getServer().getServerState() & getRequiredServerState() ) > 0 );
}
}
}
}
protected abstract int getRequiredServerState();
public void setActivePart( IAction action, IWorkbenchPart targetPart )
{
this.activePart = targetPart;
}
protected IWorkbenchPart getActivePart()
{
return this.activePart;
}
protected Shell getActiveShell()
{
if( getActivePart() != null )
{
return getActivePart().getSite().getShell();
}
else
{
return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
}
}
}
|
[
"[email protected]"
] | |
c2e28398f5ef2add790b8e80c83015ee0f19269e
|
0adf8993a436b99d7006dd21cdb54413e23aec5a
|
/interface/src/main/java/com/rakuten/tech/mobile/http/Http.java
|
cb43000149790a05f7efaa7434a3da3d4d6bb2a6
|
[
"MIT"
] |
permissive
|
PAISHackathon/android-http-interface
|
57adda1a3b55d4061e04697ee402d1e0b93d137b
|
50b215cebab7ee339ed5b6be9511b5c7a5af6f8d
|
refs/heads/master
| 2021-07-24T22:44:06.516789 | 2017-11-06T05:22:51 | 2017-11-06T05:22:51 | 107,642,136 | 0 | 1 | null | 2017-11-07T00:39:10 | 2017-10-20T06:47:16 |
Java
|
UTF-8
|
Java
| false | false | 5,086 |
java
|
package com.rakuten.tech.mobile.http;
import android.net.Uri;
import android.support.annotation.NonNull;
import java.io.IOException;
import java.util.Map;
/**
* <p>HTTP abstraction layer inspired by okhttp3 interfaces
*
* <p>Encodes minimal contract that our libraries expect from an http client implementation.
*/
@SuppressWarnings("unused")
public interface Http {
interface ResponseCallback<T> {
void onResponse(@NonNull Call<T> call, @NonNull T response);
}
interface FailureCallback {
void onFailure(@NonNull Call call, IOException e);
}
interface Request {
byte[] body();
@NonNull Map<String, String> headers();
@NonNull String contentType();
@NonNull Uri url();
@NonNull String method();
}
interface Response {
@NonNull byte[] bytes();
int code();
@NonNull String contentType();
@NonNull String string();
@NonNull Map<String, String> headers();
}
interface Client {
/**
* <p>Creates a new {@link Call<Response>} that should be ready to execute without any other
* steps of preparation
* @param request request configuration
* @return call ready to be executed
*/
@NonNull Call<Response> newCall(@NonNull Request request);
}
interface Transform<S, T> {
@NonNull T apply(S response);
}
interface Call<T> {
/**
* @return the request that defines this call
*/
@NonNull Request request();
/**
* <p>Execute the HTTP request synchronously
* @return result of the request
* @throws IOException IO fails - note that this should <b>not</b> throw when HTTP status
* codes signal errors.
*/
@NonNull T execute() throws IOException;
/**
* <p>Apply a transformation to the response. If the call is executed asynchronously via
* {@link #enqueue(ResponseCallback, FailureCallback)} the transformation should be
* executed on a background thread.
*
* <p>A typical use case for such a transformation is parsing an raw http response into
* java model objects, e.g.
*
* <code>
* Call<Http.Response> call = client.newCall(request);
* Call<JSONObject> transformedCall = call.transform(response -> response -> {
* try {
* return new JSONObject(response.string());
* } catch (JSONException e) {
* return new JSONObject();
* }
* });
* JSONObject parsed = transformedCall.enqueue();
* </code>
*
* <p>another way of using this is to execute multiple sequential http requests on a
* background thread, e.g.
*
* <code>
* Call<Http.Response> call = client.newCall(request);
* Call<JSONObject> transformedCall = call.transform(response -> response -> {
* String nextRequestUrl = JSONObject(response.string()).getString("url");
* Request<Http.Response> nextRequest = ValueRequest.build().method("GET").url(url).build();
* try {
* Http.Response nextResponse = client.newCall(nextRequest).execute();
* return new JSONObject(nextResponse.string())
* } catch (IOException | JSONException e) {
* return new JSONObject();
* }
* });
* JSONObject parsed = call.execute();
* </code>
*
* @param transform transformation function that will be applied to the response
* @param <V> type of the result of the transformation
* @return new call that returns the transformed result when executed.
*/
<V> Call<V> transform(Transform<T, V> transform);
/**
* <p>Execute the HTTP request on a <b>background thread</b> and return to the <b>main
* thread</b> with the result or failure.
*
* @param responseCallback will be called with the response on the main thread
* @param failureCallback wil be called with the cause of failure on the main thread
*/
void enqueue(ResponseCallback<T> responseCallback, FailureCallback failureCallback);
/**
* <p>Abort executing the request.
*
* <p>If a request is executed asynchronouly via {@link #enqueue(ResponseCallback, FailureCallback)}
* a call to {@link #cancel()} should abort the execution if possible. If the request was
* aborted successfully the failure callback should be notified and the success callback
* should not be called.
*
* <p>Should have no effect if the request already finished or hasn't started yet or the
* request in executing synchronously via {@link #execute()}.
*/
void cancel();
/**
* @return If {@link #cancel()} was called.
*/
boolean isCanceled();
}
}
|
[
"[email protected]"
] | |
ab568800e57dc83d2d455e5e52cd0bae3d724730
|
b8726244e717387efdcf0842345d969c47a9aa3d
|
/src/main/java/com/sqrfactor/model/Verification.java
|
655b4fa4f650d48576dd4803ce4b86eb6d8666b4
|
[] |
no_license
|
SqrFactor/portal-backend
|
a9d0ca1d31413289b0b35ec4c08c719aeea525db
|
087624041b7f9da6eb6cc12c191a784194a06b9d
|
refs/heads/master
| 2022-09-19T14:20:34.201507 | 2017-04-18T11:54:55 | 2017-04-18T11:54:55 | 53,121,817 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,073 |
java
|
package com.sqrfactor.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.Size;
/**
* @author Angad Gill
*
*/
@Entity
@Table(name = "verification_details")
public class Verification {
@Id
@Column(name = "verificationId")
private long verificationId;
@Column(name = "verificationUserId")
private long verificationUserId;
@Column(name = "emailCode")
private String emailCode;
@Column(name = "phoneCode")
private String phoneCode;
public Verification(){
}
/**
* @param verificationId
* @param verificationUserId
* @param emailCode
* @param phoneCode
*/
public Verification(long verificationId, long verificationUserId, String emailCode, String phoneCode) {
super();
this.verificationId = verificationId;
this.verificationUserId = verificationUserId;
this.emailCode = emailCode;
this.phoneCode = phoneCode;
}
/**
* @return the verificationId
*/
public long getVerificationId() {
return verificationId;
}
/**
* @param verificationId the verificationId to set
*/
public void setVerificationId(long verificationId) {
this.verificationId = verificationId;
}
/**
* @return the verificationUserId
*/
public long getVerificationUserId() {
return verificationUserId;
}
/**
* @param verificationUserId the verificationUserId to set
*/
public void setVerificationUserId(long verificationUserId) {
this.verificationUserId = verificationUserId;
}
/**
* @return the emailCode
*/
public String getEmailCode() {
return emailCode;
}
/**
* @param emailCode the emailCode to set
*/
public void setEmailCode(String emailCode) {
this.emailCode = emailCode;
}
/**
* @return the phoneCode
*/
public String getPhoneCode() {
return phoneCode;
}
/**
* @param phoneCode the phoneCode to set
*/
public void setPhoneCode(String phoneCode) {
this.phoneCode = phoneCode;
}
}
|
[
"[email protected]"
] | |
7a4085824cb5b7e07ed2c3cf29b19997cb6400bf
|
06dce89c080ed019f8d1b532bb31667991411ff4
|
/src/test/java/enmasse/systemtest/AnycastTest.java
|
0a4ad57f9520263f473f52feff0b4be471440905
|
[
"Apache-2.0"
] |
permissive
|
vbusch/systemtests
|
39004a01667f2ad56e546ff425b2a8253b33364c
|
13a8496d7ac528b9e1a7bbeb1e4b6cc7dcdee2f9
|
refs/heads/master
| 2021-01-17T22:44:20.901421 | 2017-02-24T11:37:41 | 2017-02-24T11:37:41 | 84,202,203 | 0 | 0 | null | 2017-03-07T13:28:29 | 2017-03-07T13:28:29 | null |
UTF-8
|
Java
| false | false | 1,529 |
java
|
/*
* Copyright 2016 Red Hat 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 enmasse.systemtest;
import org.junit.Test;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
public class AnycastTest extends VertxTestBase {
@Test
public void testMessagesDeliveredToReceiver() throws Exception {
Destination dest = Destination.anycast("anycast");
deploy(dest);
EnMasseClient client = createQueueClient();
List<String> msgs = Arrays.asList("foo", "bar", "baz");
Future<List<String>> recvResult = client.recvMessages(dest.getAddress(), msgs.size());
Future<Integer> sendResult = client.sendMessages(dest.getAddress(), msgs);
assertThat(sendResult.get(1, TimeUnit.MINUTES), is(msgs.size()));
assertThat(recvResult.get(1, TimeUnit.MINUTES).size(), is(msgs.size()));
}
}
|
[
"[email protected]"
] | |
c695f004b18a582621f9007dafd0f20ca6447760
|
d23a98fd12d037caf549dc31b0da356e9d5bc4e6
|
/core/src/main/java/com/mycompany/hadoop_study/utils/FindLatestPath.java
|
955327df74fd378b5503084f0c012ccd36e84db0
|
[] |
no_license
|
siyu618/hadoop_study
|
29160a03a6328a887e9ecb5ee6e970945f0b7ec6
|
b2926cf4aa48dee4b6cbd72b723207673e09f82a
|
refs/heads/master
| 2021-01-18T16:36:40.131066 | 2014-06-12T01:31:36 | 2014-06-12T01:31:36 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,509 |
java
|
package com.mycompany.hadoop_study.utils;
import com.yahoo.partner_targeting.user_match.Config;
import com.yahoo.partner_targeting.utils.StringUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.conf.Configured;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.mapred.JobConf;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;
import org.apache.log4j.Logger;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Properties;
public class FindLatestPath extends Configured implements Tool {
private static Logger log = Logger.getLogger(FindLatestPath.class);
public static void main(String[] args) throws Exception {
int rc = ToolRunner.run(new Configuration(), new FindLatestPath(), args);
System.exit(rc);
}
@Override
public int run(String[] args) throws Exception {
JobConf jconf = new JobConf(getConf(), FindLatestPath.class);
Config.setHadoopDefaults(jconf);
Config.setOozieDefaults(jconf);
Properties props = new Properties();
setOozieOutputProperties(jconf, props);
File oozieOutputProps = new File(System.getProperty("oozie.action.output.properties"));
log.info("save properties to " + oozieOutputProps.getAbsolutePath());
OutputStream os = new FileOutputStream(oozieOutputProps);
props.store(os, null);
os.close();
log.info("done");
return 0;
}
private void setOozieOutputProperties(JobConf jconf, Properties props) throws IOException {
String toProcess = Config.getValue(jconf, Config.Key.FindLatestPaths);
for (String pair : StringUtils.parseCSV(toProcess)) {
String[] keyVal = pair.split("=");
if (keyVal.length != 2) {
log.error("skip invalid setting " + pair);
continue;
}
Path path = new Path(keyVal[1]);
FileSystem fsys = path.getFileSystem(jconf);
FileStatus[] fstats = fsys.listStatus(path);
FileStatus last = null;
if (fstats != null) {
for (FileStatus fstat : fstats) {
if (last == null) {
last = fstat;
continue;
}
if (fstat.getPath().getName().compareTo(last.getPath().getName()) > 0) {
last = fstat;
}
}
}
if (last == null) {
log.warn("can't find a file for " + pair);
continue;
}
props.put(keyVal[0], last.getPath().toString());
log.info(keyVal[0] + " <= " + last.getPath().toString());
}
}
}
|
[
"[email protected]"
] | |
eab0b7b236c6f1e87b47f7776a56e9869bb86336
|
416f2c2a40dee4864975ad844836328184113f35
|
/ClientHandler.java
|
c74a7478247342959cb0e5d20b03796b85ff072e
|
[] |
no_license
|
octaroot/BI-PSI-2015
|
f62c9ecef12ff8ffae5f001375d5eacc2a857323
|
f3c56673b9345fbd54d17020c9873e33f5e8d284
|
refs/heads/master
| 2021-01-23T05:09:45.396774 | 2017-05-31T14:45:04 | 2017-05-31T14:45:56 | 92,955,681 | 1 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 7,990 |
java
|
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.net.Socket;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.regex.Pattern;
/**
* @author martin ([email protected])
* @since 6.3.15.
*/
final class ClientHandler implements Runnable
{
private Socket clientSocket;
private InputStream input;
private PrintWriter output;
private ClientStates clientState;
private String clientRobotName;
private OutputCommand oc;
private InputCommand ic;
private Boolean lineMode;
/**
* Constructs the ClientHandler
*
* @param clientSocket Client's socket
*/
public ClientHandler(Socket clientSocket)
{
this.clientSocket = clientSocket;
this.clientRobotName = null;
this.input = null;
this.output = null;
this.clientState = ClientStates.USERNAME;
this.oc = null;
this.lineMode = true;
}
/**
* Closes the connection. Flushes output and waits a for a short time before closing it
*/
private void closeConnection()
{
try
{
output.flush();
Thread.sleep(100);
input.close();
output.close();
if (!clientSocket.isClosed()) clientSocket.close();
}
catch (Exception e)
{
System.err.println("Unable to gracefully close connection.");
}
}
/**
* In case the connection hans for too long, this method can be called to gracefully timeout
*/
public void kill()
{
System.err.println("[DEBUG][!][" + clientSocket.getInetAddress() + ":" + clientSocket.getPort() + "] We took " +
"too long, ClientHandler killer called. Sending TIMEOUT now");
oc.sendMessage(OutputCommand.MessageTypes.TIMEOUT);
closeConnection();
}
/**
* Main method, sets up streams and handles all communication logic
*/
@Override
public void run()
{
try
{
output = new PrintWriter(clientSocket.getOutputStream(), true);
input = clientSocket.getInputStream();
oc = new OutputCommand(output, clientSocket);
ic = new InputCommand(input, clientSocket);
}
catch (IOException e)
{
System.err.println("Unable to open streams");
return;
}
/**
* Send a LOGIN message to client
*/
oc.sendMessage(OutputCommand.MessageTypes.LOGIN);
String inputLine = "";
/**
* Main loop
*/
while (!clientSocket.isClosed())
{
/**
* We like to read till \r\n whenever we can
*/
if (lineMode)
{
inputLine = ic.readLine();
if (inputLine == null)
{
closeConnection();
return;
}
}
/**
* Mail communication logic switch
*/
switch (clientState)
{
case USERNAME:
clientRobotName = inputLine;
oc.sendMessage(OutputCommand.MessageTypes.PASSWORD);
clientState = ClientStates.PASSWORD;
break;
case PASSWORD:
UsernameLexicalAnalyzer usernameAnalyzer = new UsernameLexicalAnalyzer();
PasswordLexicalAnalyzer passwordAnalyzer = new PasswordLexicalAnalyzer();
try
{
usernameAnalyzer.parseTokens(clientRobotName);
passwordAnalyzer.parseTokens(inputLine);
if (!Authenticator.areCredentialsValid(clientRobotName, inputLine))
throw new Exception("Credentials invalid");
}
catch (Exception e)
{
oc.sendMessage(OutputCommand.MessageTypes.LOGIN_FAILED);
closeConnection();
return;
}
oc.sendMessage(OutputCommand.MessageTypes.OK);
clientState = ClientStates.AUTHENTICATED;
lineMode = false;
break;
case AUTHENTICATED:
PayloadTypeLexicalInstancedAnalyzer payloadTypeAnalyzer = new PayloadTypeLexicalInstancedAnalyzer();
StringBuilder sb = new StringBuilder();
try
{
for (int i = 0; i < 5; i++)
{
char c = ic.readChar();
sb.append(c);
payloadTypeAnalyzer.parseCharacter(c);
}
PayloadTypeLexicalInstancedAnalyzer.PayloadModes payloadMode = payloadTypeAnalyzer.getPayloadType();
System.out.println("[INFO][ ][" + clientSocket.getInetAddress() + ":" + clientSocket.getPort() + "] Recognized message type - " + payloadMode);
switch (payloadMode)
{
case INFO:
lineMode = true;
clientState = ClientStates.INFO_MESSAGE;
break;
case FOTO:
lineMode = false;
clientState = ClientStates.FOTO_MESSAGE;
}
}
catch (SyntaxIncorrect syntaxIncorrect)
{
System.out.println("[INFO][ ][" + clientSocket.getInetAddress() + ":" + clientSocket.getPort() + "] Bad message format. Received: \"" + sb.toString() + "\"");
oc.sendMessage(OutputCommand.MessageTypes.SYNTAX_ERROR);
closeConnection();
return;
}
catch (Exception e)
{
closeConnection();
return;
}
break;
case INFO_MESSAGE:
InfoMessageLexicalAnalyzer infoMessageAnalyzer = new InfoMessageLexicalAnalyzer();
infoMessageAnalyzer.parseTokens(inputLine);
oc.sendMessage(OutputCommand.MessageTypes.OK);
clientState = ClientStates.AUTHENTICATED;
lineMode = false;
break;
case FOTO_MESSAGE:
FotoMessageLengthLexicalInstancedAnalyzer fotoMessageLengthAnalyzer = new FotoMessageLengthLexicalInstancedAnalyzer();
StringBuilder messageLengthBuilder = new StringBuilder();
while (!fotoMessageLengthAnalyzer.isStateFinal())
{
try
{
char c = ic.readChar();
fotoMessageLengthAnalyzer.parseCharacter(c);
if (fotoMessageLengthAnalyzer.isStateFinal()) break;
messageLengthBuilder.append(c);
}
catch (SyntaxIncorrect syntaxIncorrect)
{
System.out.println("[INFO][ ][" + clientSocket.getInetAddress() + ":" + clientSocket.getPort() + "] Bad FOTO message length format. Received: \"" +
messageLengthBuilder.toString() + "\"");
oc.sendMessage(OutputCommand.MessageTypes.SYNTAX_ERROR);
closeConnection();
return;
}
catch (Exception e)
{
closeConnection();
return;
}
}
String dataLengthString = messageLengthBuilder.toString();
int dataLength;
if (!Pattern.matches("^\\d+$", dataLengthString))
{
System.out.println("[INFO][ ][" + clientSocket.getInetAddress() + ":" + clientSocket.getPort() + "] Bad image length format. Received: \"" + dataLengthString + "\"");
oc.sendMessage(OutputCommand.MessageTypes.SYNTAX_ERROR);
closeConnection();
return;
}
dataLength = Integer.parseInt(dataLengthString);
byte imageData[] = ic.readBytes(dataLength);
if (imageData == null)
{
closeConnection();
return;
}
System.out.println("[INFO][ ][" + clientSocket.getInetAddress() + ":" + clientSocket.getPort() +
"] Received " + dataLengthString + " bytes of image data");
byte correctChecksumBytes[] = ic.readBytes(4);
if (correctChecksumBytes == null)
{
closeConnection();
return;
}
System.out.println("[INFO][ ][" + clientSocket.getInetAddress() + ":" + clientSocket.getPort() +
"] Received 4 bytes of image checksum");
ByteBuffer bb = ByteBuffer.wrap(correctChecksumBytes);
bb.order(ByteOrder.BIG_ENDIAN);
int correctChecksum = bb.getInt();
final int calculatedChecksum = ImageDataValidator.calculateChecksum(imageData);
if (calculatedChecksum != correctChecksum)
{
System.out.println("[INFO][ ][" + clientSocket.getInetAddress() + ":" + clientSocket.getPort() + "] Checksum mismatch. Received: " + correctChecksum + ", " +
"calculated: " + calculatedChecksum);
oc.sendMessage(OutputCommand.MessageTypes.BAD_CHECKSUM);
clientState = ClientStates.AUTHENTICATED;
break;
}
//TODO: save image to disk
oc.sendMessage(OutputCommand.MessageTypes.OK);
clientState = ClientStates.AUTHENTICATED;
break;
}
}
closeConnection();
}
/**
* Client state during the communication
*/
private enum ClientStates
{
USERNAME, PASSWORD, AUTHENTICATED, INFO_MESSAGE, FOTO_MESSAGE
}
}
|
[
"[email protected]"
] | |
751b6d8e5c0ff1bdef8490bba64ccbf01d58908b
|
5a02aecc77c72688772ccfa5ffb01deea08de755
|
/PicThink/app/src/main/java/com/mb/picvisionlive/chooseaddress/views/ItemsRange.java
|
875308b5f8f8f385cee59a6bd8ab09313b503ccd
|
[] |
no_license
|
lordmen99/tencent
|
1a5659018eaf1126cb0e710f75f0faa4f3e8b0f6
|
ec20705eac424ea6d9fea05b7efe5db64c78d719
|
refs/heads/master
| 2021-05-02T08:15:28.010579 | 2016-06-08T05:16:04 | 2016-06-08T05:16:04 | 120,847,197 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,831 |
java
|
/*
* Android Wheel Control.
* https://code.google.com/p/android-wheel/
*
* Copyright 2011 Yuri Kanivets
*
* 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.mb.picvisionlive.chooseaddress.views;
/**
* Range for visible items.
*/
public class ItemsRange {
// First item number
private int first;
// Items count
private int count;
/**
* Default constructor. Creates an empty range
*/
public ItemsRange() {
this(0, 0);
}
/**
* Constructor
*
* @param first
* the number of first item
* @param count
* the count of items
*/
public ItemsRange(int first, int count) {
this.first = first;
this.count = count;
}
/**
* Gets number of first item
*
* @return the number of the first item
*/
public int getFirst() {
return first;
}
/**
* Gets number of last item
*
* @return the number of last item
*/
public int getLast() {
return getFirst() + getCount() - 1;
}
/**
* Get items count
*
* @return the count of items
*/
public int getCount() {
return count;
}
/**
* Tests whether item is contained by range
*
* @param index
* the item number
* @return true if item is contained
*/
public boolean contains(int index) {
return index >= getFirst() && index <= getLast();
}
}
|
[
"yangmeng@048fd09e-6c49-4b47-a20a-0f6d7d1c1cbb"
] |
yangmeng@048fd09e-6c49-4b47-a20a-0f6d7d1c1cbb
|
7b98119424eeb826265eef6145829e3fdee48289
|
59bc6b2ebed74b3e1ceed435cd5ff8b765194508
|
/app/src/main/java/wayne/enterprises/onetask/MainActivity.java
|
ca83ce240b759359f33f076c4f6bdb469264709a
|
[] |
no_license
|
ahmed-fathy-aly/one-task
|
33d4033b2450f40a87209dbb38e5b8399027c1e9
|
2c6445423b61e765b7703e89f1822623ef4d3ccb
|
refs/heads/master
| 2021-05-02T18:16:50.687482 | 2018-03-18T13:45:30 | 2018-03-18T13:45:30 | 120,660,098 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 643 |
java
|
package wayne.enterprises.onetask;
import android.arch.lifecycle.GenericLifecycleObserver;
import android.arch.lifecycle.Lifecycle;
import android.arch.lifecycle.LifecycleOwner;
import android.os.Bundle;
import android.os.PersistableBundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
public class MainActivity extends ViewModelProviderActivity<TasksViewModel> {
@Override
protected ViewModelFragment createFragment() {
return TaskTabsFragment.newInstance();
}
@NonNull
@Override
protected TasksViewModel createViewModel() {
return ViewModelFactory.getInstance().tasksViewModel();
}
}
|
[
"[email protected]"
] | |
ad08f0cb5dffa50daee0f37d93ce9a6f201bb360
|
4cad92a9cedc20dececb9db81e3954c3db7ccb3b
|
/src/basic/java/practice/PriorityQueueComparator.java
|
d9892523c23be46e8b00b791bf0aae0d89d4b5ea
|
[] |
no_license
|
nmodi72/PracticeCodingChallanges
|
f6e12a292cf8e1583743084c8f5cad91ceb8ddba
|
dd0b57891ccf3246ade9b9b8ea91cea5e3d84618
|
refs/heads/master
| 2021-01-10T05:43:30.827877 | 2016-11-07T15:06:47 | 2016-11-07T15:06:47 | 49,031,753 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 377 |
java
|
package basic.java.practice;
import java.util.Comparator;
public class PriorityQueueComparator implements Comparator<String> {
@Override
public int compare(String str1, String str2) {
if (str1.length() < str2.length()) {
return -1;
}
if (str1.length() > str2.length()) {
return 1;
}
return 0;
}
}
|
[
"[email protected]"
] | |
82cbc248bfe78b309ecec306f537a754166d6db2
|
3dc9515e19f278159e9f1558b8dc1e777060c374
|
/app/src/main/java/com/fourpool/ramencompass/MainActivity.java
|
7bc7b004d197a633002b9d67fbf64a57749f20ef
|
[] |
no_license
|
matthewmichihara/ramen-compass
|
b8ca6c62a0b86d05ed2abe2e065b952d58949b8d
|
c8df56f358213cae661ea9f1684ff1c26f03ff39
|
refs/heads/master
| 2021-01-20T04:32:53.053021 | 2015-01-20T15:48:53 | 2015-01-20T15:48:53 | 29,537,555 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 5,551 |
java
|
package com.fourpool.ramencompass;
import android.app.Activity;
import android.content.Intent;
import android.content.IntentSender;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.location.Location;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
import android.widget.Toast;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesClient;
import com.google.android.gms.location.LocationClient;
import com.google.android.gms.location.LocationListener;
import com.google.android.gms.location.LocationRequest;
import com.squareup.picasso.Picasso;
import retrofit.Callback;
import retrofit.RestAdapter;
import retrofit.RetrofitError;
import retrofit.client.Response;
public class MainActivity extends Activity implements LocationListener {
private static final String TAG = MainActivity.class.getSimpleName();
private CompassView compassView;
private ImageView image;
private LocationClient locationClient;
private Foursquare foursquare;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
RestAdapter restAdapter = new RestAdapter.Builder().setEndpoint("https://api.foursquare.com").build();
foursquare = restAdapter.create(Foursquare.class);
// Create the LocationRequest object
final LocationRequest locationRequest = LocationRequest.create();
// Use high accuracy
locationRequest.setPriority(
LocationRequest.PRIORITY_HIGH_ACCURACY);
// Set the update interval to 5 seconds
locationRequest.setInterval(500);
// Set the fastest update interval to 1 second
locationRequest.setFastestInterval(100);
locationClient = new LocationClient(this, new GooglePlayServicesClient.ConnectionCallbacks() {
@Override
public void onConnected(Bundle bundle) {
locationClient.requestLocationUpdates(locationRequest, MainActivity.this);
}
@Override
public void onDisconnected() {
}
}, new GooglePlayServicesClient.OnConnectionFailedListener() {
@Override
public void onConnectionFailed(ConnectionResult connectionResult) {
Toast.makeText(MainActivity.this, "failed - " + connectionResult.toString(), Toast.LENGTH_SHORT);
}
});
compassView = (CompassView) findViewById(R.id.compass);
image = (ImageView) findViewById(R.id.image);
}
@Override
protected void onStart() {
super.onStart();
locationClient.connect();
compassView.connect();
}
@Override
protected void onStop() {
super.onStop();
locationClient.disconnect();
compassView.disconnect();
}
@Override
public void onLocationChanged(final Location location) {
String ll = location.getLatitude() + "," + location.getLongitude();
foursquare.getNearestRamen(ll, new Callback<RamenResponse>() {
@Override
public void success(RamenResponse ramenResponse, Response response) {
RamenResponse.Response.Venue ramenVenue = ramenResponse.response.venues.get(0);
final String ramenVenueId = ramenVenue.id;
Location ramenLocation = new Location("foursquare");
// float esbLat = 40.754977f;
// float esbLng = -73.942407f;
// ramenLocation.setLongitude(esbLng);
// ramenLocation.setLatitude(esbLat);
ramenLocation.setLongitude(ramenVenue.location.lng);
ramenLocation.setLatitude(ramenVenue.location.lat);
compassView.setTargetLocation(location, ramenLocation);
foursquare.getVenuePhotoUrl(ramenVenue.id, new Callback<VenuePhotosResponse>() {
@Override
public void success(VenuePhotosResponse venuePhotosResponse, Response response) {
Picasso.with(MainActivity.this).load(venuePhotosResponse.response.photos.items.get(0).getUrl()).into(image);
image.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String url = "http://www.foursquare.com/v/" + ramenVenueId;
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
}
});
}
@Override
public void failure(RetrofitError error) {
}
});
Toast.makeText(MainActivity.this, "nearest is " + ramenResponse.response.venues.get(0).name, Toast.LENGTH_SHORT).show();
}
@Override
public void failure(RetrofitError error) {
Log.e("mattm", "got here failure" + error.toString());
Toast.makeText(MainActivity.this, "failed", Toast.LENGTH_SHORT);
}
});
}
}
|
[
"[email protected]"
] | |
20abadfe7bed03fcad9a8487b1502296428a7469
|
df648a9777f985e502af5373a24f6e7b16450a6b
|
/app/src/main/java/com/crazyhitty/chdev/ks/predator/account/PredatorAuthenticator.java
|
55bac8bb9822df55dd891e0d68d21bf667499c73
|
[
"MIT"
] |
permissive
|
Sifdon/Capstone-Project
|
94bc8b0942b405c07bf7ff6696c5a006c575ecee
|
1e4fb59e754ea2a8984e217b4046565ba2d40202
|
refs/heads/master
| 2021-05-06T13:50:26.620146 | 2017-09-29T20:30:20 | 2017-09-29T20:30:20 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 5,529 |
java
|
/*
* MIT License
*
* Copyright (c) 2016 Kartik Sharma
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.crazyhitty.chdev.ks.predator.account;
import android.accounts.AbstractAccountAuthenticator;
import android.accounts.Account;
import android.accounts.AccountAuthenticatorResponse;
import android.accounts.AccountManager;
import android.accounts.NetworkErrorException;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import com.crazyhitty.chdev.ks.predator.data.Constants;
import com.crazyhitty.chdev.ks.predator.ui.activities.AuthenticatorActivity;
import com.crazyhitty.chdev.ks.predator.utils.Logger;
import java.lang.ref.WeakReference;
import static android.accounts.AccountManager.KEY_BOOLEAN_RESULT;
/**
* Author: Kartik Sharma
* Email Id: [email protected]
* Created: 1/1/2017 9:14 PM
* Description: Authenticator account manager for predator.
*/
public class PredatorAuthenticator extends AbstractAccountAuthenticator {
private static final String TAG = "PredatorAuthenticator";
private WeakReference<Context> mContextWeakReference;
public PredatorAuthenticator(Context context) {
super(context);
mContextWeakReference = new WeakReference<Context>(context);
}
@Override
public Bundle editProperties(AccountAuthenticatorResponse response, String accountType) {
return null;
}
@Override
public Bundle addAccount(AccountAuthenticatorResponse response, String accountType, String authTokenType, String[] requiredFeatures, Bundle options) throws NetworkErrorException {
// Check if the context was null or not.
if (mContextWeakReference.get() == null) {
return null;
}
Intent intent = new Intent(mContextWeakReference.get(), AuthenticatorActivity.class);
intent.putExtra(Constants.Authenticator.ACCOUNT_TYPE, accountType);
intent.putExtra(Constants.Authenticator.AUTH_TOKEN_TYPE, authTokenType);
intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response);
Bundle bundle = new Bundle();
bundle.putParcelable(AccountManager.KEY_INTENT, intent);
return bundle;
}
@Override
public Bundle confirmCredentials(AccountAuthenticatorResponse response, Account account, Bundle options) throws NetworkErrorException {
return null;
}
@Override
public Bundle getAuthToken(AccountAuthenticatorResponse response, Account account, String authTokenType, Bundle options) throws NetworkErrorException {
// Check if the context was null or not.
if (mContextWeakReference.get() == null) {
return null;
}
// Check if any authToken is available or not.
AccountManager accountManager = AccountManager.get(mContextWeakReference.get());
String authToken = accountManager.peekAuthToken(account, authTokenType);
// If the authToken is available, return it.
if (!TextUtils.isEmpty(authToken)) {
Bundle result = new Bundle();
result.putString(AccountManager.KEY_ACCOUNT_NAME, account.name);
result.putString(AccountManager.KEY_ACCOUNT_TYPE, account.type);
result.putString(AccountManager.KEY_AUTHTOKEN, authToken);
return result;
}
// If the authToken is unavailable, retry for a new one.
Intent intent = new Intent(mContextWeakReference.get(), AuthenticatorActivity.class);
intent.putExtra(Constants.Authenticator.ACCOUNT_TYPE, account.type);
intent.putExtra(Constants.Authenticator.AUTH_TOKEN_TYPE, authTokenType);
intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response);
Bundle bundle = new Bundle();
bundle.putParcelable(AccountManager.KEY_INTENT, intent);
return bundle;
}
@Override
public String getAuthTokenLabel(String authTokenType) {
return null;
}
@Override
public Bundle updateCredentials(AccountAuthenticatorResponse response, Account account, String authTokenType, Bundle options) throws NetworkErrorException {
return null;
}
@Override
public Bundle hasFeatures(AccountAuthenticatorResponse response, Account account, String[] features) throws NetworkErrorException {
final Bundle result = new Bundle();
result.putBoolean(KEY_BOOLEAN_RESULT, false);
return result;
}
}
|
[
"[email protected]"
] | |
4e4b4005ba40e65eb3726ec99b027ff77376c00a
|
9047a6581e413a3d5c4860cd2f1847b0b245724b
|
/src/main/java/net/sppan/blog/repository/ResourceCategoryRepository.java
|
338020e0b5c5e50acdbb86ca1aa35dc4cd89b823
|
[] |
no_license
|
XiaYingyin/MyBlogSys
|
72bd2071b2fd09210348c65a65b3430e39a4e3e5
|
ecfa174327c25b67f7bb97b16e0d4c18fcd99744
|
refs/heads/master
| 2020-05-09T21:18:56.926543 | 2019-04-21T03:23:27 | 2019-04-21T03:23:27 | 181,438,866 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 362 |
java
|
package net.sppan.blog.repository;
import net.sppan.blog.entity.ResourceCategory;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface ResourceCategoryRepository extends JpaRepository<ResourceCategory, Long> {
List<ResourceCategory> findByTypeAndParentIdAndStatus(int type, long parentId, int status);
}
|
[
"[email protected]"
] | |
290fe051425602a990dfdefb6f4ad9028fcce36c
|
1bf5a19fc828327395ff24e2a43de3a43a783271
|
/src/com/kingdee/spider/views/CodeScanResultContentProvider.java
|
01b61ae8846f1bf1bb0b3a9c4a51cbce63399ad5
|
[] |
no_license
|
geniuslyy/javacode-spider
|
b8b72d7a99b0d25ec0e8da3b90e6850a146d61b5
|
c30e71943952120ded8537167b17dcf40eae01ef
|
refs/heads/master
| 2021-01-19T08:16:14.437946 | 2013-07-18T13:54:42 | 2013-07-18T13:54:42 | 11,284,818 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 887 |
java
|
package com.kingdee.spider.views;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.ITreeContentProvider;
import com.kingdee.spider.model.IJavaCodeElement;
import com.kingdee.spider.model.ITreeNode;
public class CodeScanResultContentProvider extends ArrayContentProvider implements ITreeContentProvider {
@Override
public Object[] getChildren(final Object parentElement) {
IJavaCodeElement javaCodeModel = (IJavaCodeElement) parentElement;
return javaCodeModel.getChildren().toArray(new ITreeNode[] {});
}
@Override
public Object getParent(final Object element) {
IJavaCodeElement javaCodeModel = (IJavaCodeElement) element;
return javaCodeModel.getParent();
}
@Override
public boolean hasChildren(final Object element) {
IJavaCodeElement javaCodeModel = (IJavaCodeElement) element;
return javaCodeModel.hasChildren();
}
}
|
[
"[email protected]"
] | |
8a3db81ae1a58f56589b4a5215773528baf0a391
|
b0d3cc99f606a39090131e0f67f1a9441e9deca6
|
/src/main/java/tn/esprit/services/IDeliveryManService.java
|
15f645635264915ee27445363daa17435119261c
|
[] |
no_license
|
Ahmed-Karoui/Backend-PI
|
fc43276384a5a0c4e04171713b6fd899367e6fd4
|
f7990ee18edc268d35f85beb34ab620947397e60
|
refs/heads/master
| 2023-06-28T05:33:08.610681 | 2021-07-24T12:25:32 | 2021-07-24T12:25:32 | 376,143,948 | 0 | 2 | null | 2021-07-24T01:34:19 | 2021-06-11T21:15:42 |
Java
|
UTF-8
|
Java
| false | false | 1,457 |
java
|
package tn.esprit.services;
import java.util.List;
import java.util.Map;
import org.springframework.web.bind.annotation.PathVariable;
import tn.esprit.entities.AffectationDto;
import tn.esprit.entities.DeliveryMan;
import tn.esprit.entities.DeliveryManStat;
import tn.esprit.entities.Order;
import tn.esprit.entities.PropositionDto;
public interface IDeliveryManService {
//crud
public int addDeliveryMan(DeliveryMan DeliveryMan);
public int deleteDeliveryMan(int idDeliveryMan);
public int updateDeliveryMan(DeliveryMan DeliveryMan);
public DeliveryMan findDeliveryMan(int idDeliveryMan);
public List<DeliveryMan> listDeliveryMan();
//affectatiopn tache avancée
public String affectOrdersToDeliveryMan(AffectationDto aff);
public Order setOrderDelivered_Criteria(int idDeliveryMan,int idOrder); // il reste a ajouter la notification par email !
public Order supprimerAffectation(int idOrder);
public String affectOrdersToDeliveryManFront(int idD,int idC);
//recherche criteria
public DeliveryMan getDeliveryManByFirstName(String prenom);
public List<Order> getListOrdersByDeliveryManId(int id);
//statistique without JPQL QUERY ==> using View
public List<DeliveryManStat> getAllDeliveryManStatus();
public DeliveryManStat getDeliveryManStatById(@PathVariable int id);
//algo optimisation
public List<DeliveryMan> optimisationAlgo(@PathVariable int codePostalOrder);
//cron
}
|
[
"[email protected]"
] | |
0bbfed77ec73799737f0e25eea6be7ab48220060
|
6167b84299848bc36c206f57b7e6a7130f283cb0
|
/src/main/java/net/gobro/plauen/service/GameService.java
|
cbdeda74e4f178af10600b79d54603e3410f6a67
|
[] |
no_license
|
slavarosin/plauen
|
eeb83ed8fd0da72788647193182b7fdf934d39c9
|
67d0154c64275420fb850b0e3332b7665c247d8f
|
refs/heads/master
| 2021-01-01T18:27:33.943134 | 2015-06-16T21:53:32 | 2015-06-16T21:53:32 | 10,501,992 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 889 |
java
|
package net.gobro.plauen.service;
import java.util.Calendar;
import java.util.List;
import net.gobro.plauen.model.CountryEnum;
import net.gobro.plauen.model.Game;
import net.gobro.plauen.model.User;
import net.gobro.plauen.model.UserPlay;
public interface GameService {
Game create(Game game);
Game fetch(Integer id);
List<Game> fetchGamesOpenedForBidding(CountryEnum country, Calendar baseDate);
List<Game> fetchAll(CountryEnum attribute);
// List<Game> fetchGamesOpenedForRegistration(CountryEnum country,
// Calendar baseDate);
List<Game> fetchGamesActivatedAt(Calendar date, CountryEnum country);
List<Game> fetchGamesStartingAt(Calendar date, CountryEnum country);
UserPlay join(Game game, User bot, Calendar instance, boolean validate);
Game store(Game game);
List<Game> fetchClosedGames(Calendar forDate);
List<Integer> getMaximumNumberOfPlayersList();
}
|
[
"[email protected]"
] | |
fc6ba880d3f3c0dba53d9f30d9ffb7a0465ef88b
|
e4707e29d3d44e6116ecb335fc7ff3aae326002e
|
/StormPage/src/main/java/com/storm/service/domain/User.java
|
6037439e5244efc03ba6520420e9535a8936659b
|
[] |
no_license
|
wammelier/stormView
|
6f966ffc123264bdc510c0a82e8705c57120913e
|
c51c3a5175b88735a201d4f6f86129374f3c7d39
|
refs/heads/master
| 2023-04-04T05:27:49.252655 | 2021-03-29T13:18:19 | 2021-03-29T13:18:19 | 352,649,924 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,972 |
java
|
package com.storm.service.domain;
import java.sql.Timestamp;
public class User {
private String userId;
private String userPwd;
private String userName;
private String nickName;
private String email;
private String gender;
private String phone;
private String birth;
private String userImg;
private String address;
private String leaderName; // 울타리리더이름
private String baptismName; // 세례종류('0' = 없음, '1' = 세례, '2'=입교, '3' = 유아세례
private String userPosition; // 청년직책 ('0' = 일 '1' = 리더)
private Timestamp signRegDate; // 홈페이지 가입일시
private Timestamp registoreRegDate; // 관리자가 유저 등록일시
private String signupFlag; // 어플 가입여부 플래그 ('0' = 가입안됨, '1' = 가입됨)
private String userRole; // 사이트내 직책 '0' = 일반회원, '1' = 관리자
private String userDeleted; // 재명여부 '0' = 일반회원, '1' = 재명회
public User() {
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getUserPwd() {
return userPwd;
}
public void setUserPwd(String userPwd) {
this.userPwd = userPwd;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getBirth() {
return birth;
}
public void setBirth(String birth) {
this.birth = birth;
}
public String getUserImg() {
return userImg;
}
public void setUserImg(String userImg) {
this.userImg = userImg;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getLeaderName() {
return leaderName;
}
public void setLeaderName(String leaderName) {
this.leaderName = leaderName;
}
public String getBaptismName() {
return baptismName;
}
public void setBaptismName(String baptismName) {
this.baptismName = baptismName;
}
public String getUserPosition() {
return userPosition;
}
public void setUserPosition(String userPosition) {
this.userPosition = userPosition;
}
public Timestamp getSignRegDate() {
return signRegDate;
}
public void setSignRegDate(Timestamp signRegDate) {
this.signRegDate = signRegDate;
}
public Timestamp getRegistoreRegDate() {
return registoreRegDate;
}
public void setRegistoreRegDate(Timestamp registoreRegDate) {
this.registoreRegDate = registoreRegDate;
}
public String getSignupFlag() {
return signupFlag;
}
public void setSignupFlag(String signupFlag) {
this.signupFlag = signupFlag;
}
public String getUserRole() {
return userRole;
}
public void setUserRole(String userRole) {
this.userRole = userRole;
}
public String getUserDeleted() {
return userDeleted;
}
public void setUserDeleted(String userDeleted) {
this.userDeleted = userDeleted;
}
@Override
public String toString() {
return "User [userId=" + userId + ", userPwd=" + userPwd + ", userName=" + userName + ", nickName=" + nickName
+ ", email=" + email + ", gender=" + gender + ", phone=" + phone + ", birth=" + birth + ", userImg="
+ userImg + ", address=" + address + ", leaderName=" + leaderName + ", baptismName=" + baptismName
+ ", userPosition=" + userPosition + ", signRegDate=" + signRegDate + ", registoreRegDate="
+ registoreRegDate + ", signupFlag=" + signupFlag + ", userRole=" + userRole + ", userDeleted="
+ userDeleted + "]";
}
}
|
[
"[email protected]"
] | |
b9dfa9cc6ad72f4e00ad6761af466c7e8b7dd310
|
9744aefd3ee2999242cccb8b51d4b9156a16b16e
|
/progrados/crearArchivoTxt.java
|
11504063efdf68abc4cdb44ba32bf77e1b73c578
|
[] |
no_license
|
Tuanis99/Progra2LaBuena
|
ce9362dcf6718c3983fbf03a2d3058b57f3622e7
|
ac39e9fb20c9a48c99590c713dc73a24050528df
|
refs/heads/master
| 2020-05-25T22:45:05.291436 | 2019-05-22T11:03:03 | 2019-05-22T11:03:03 | 188,021,042 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,318 |
java
|
package progrados;
import java.io.*;
import javax.swing.JOptionPane;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.io.IOException;
public class crearArchivoTxt {
public void crearArchivo(){
try{
File file = new File("C:\\Users\\Catalina\\Documents\\progra");
boolean fvar = file.createNewFile();
if (fvar){
JOptionPane.showMessageDialog(null, "Se ha creado el archivo", "Error", JOptionPane.PLAIN_MESSAGE);
}
else{
System.out.println("Ya existe un archivo con ese nombre en la ubicación seleccionada");
}
}
catch(IOException e){
System.out.println("Excepción");
e.printStackTrace();
}
}
public static void main(String[] args) {
try{
File file = new File("agregarLugarDeAlmacenamiento.txt");
boolean fvar = file.createNewFile();
if (fvar){
System.out.println("Se ha creado el archivo");
}
else{
System.out.println("Ya existe un archivo con ese nombre en la ubicación seleccionada");
}
}
catch(IOException e){
System.out.println("Excepción");
e.printStackTrace();
}
}
}
|
[
"[email protected]"
] | |
8939aeb05272bceafe15bf50c674cf4438929c22
|
8b85a2a22b35da796336cac195a5fe81141c78ee
|
/src/main/java/mcjty/lostcities/worldgen/lost/cityassets/AssetRegistries.java
|
1b7a0a3426045dd948a07628d7d3bae5efbc8ce5
|
[
"MIT"
] |
permissive
|
McJtyMods/LostCities
|
b1f277ad8750f732f9f1b5e5d95c6f7819024a21
|
2f72edbc83e8297a954838493232de338fc45bbe
|
refs/heads/1.16
| 2023-08-17T00:38:24.426339 | 2022-08-27T06:32:35 | 2022-08-27T06:32:35 | 93,220,488 | 92 | 63 |
MIT
| 2023-08-10T05:40:57 | 2017-06-03T03:20:36 |
Java
|
UTF-8
|
Java
| false | false | 7,586 |
java
|
package mcjty.lostcities.worldgen.lost.cityassets;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import mcjty.lostcities.LostCities;
import mcjty.lostcities.varia.Counter;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.*;
public class AssetRegistries {
public static final AbstractAssetRegistry<Condition> CONDITIONS = new AbstractAssetRegistry<>();
public static final AbstractAssetRegistry<WorldStyle> WORLDSTYLES = new AbstractAssetRegistry<>();
public static final AbstractAssetRegistry<CityStyle> CITYSTYLES = new AbstractAssetRegistry<>();
public static final AbstractAssetRegistry<BuildingPart> PARTS = new AbstractAssetRegistry<>();
public static final AbstractAssetRegistry<Building> BUILDINGS = new AbstractAssetRegistry<>();
public static final AbstractAssetRegistry<MultiBuilding> MULTI_BUILDINGS = new AbstractAssetRegistry<>();
public static final AbstractAssetRegistry<Style> STYLES = new AbstractAssetRegistry<>();
public static final AbstractAssetRegistry<Palette> PALETTES = new AbstractAssetRegistry<>();
public static final AbstractAssetRegistry<PredefinedCity> PREDEFINED_CITIES = new AbstractAssetRegistry<>();
public static final AbstractAssetRegistry<PredefinedSphere> PREDEFINED_SPHERES = new AbstractAssetRegistry<>();
public static final void reset() {
CONDITIONS.reset();
WORLDSTYLES.reset();
PARTS.reset();
BUILDINGS.reset();
CITYSTYLES.reset();
MULTI_BUILDINGS.reset();
STYLES.reset();
PALETTES.reset();
PREDEFINED_CITIES.reset();
PREDEFINED_SPHERES.reset();
}
public static void load(File file) {
try(FileInputStream in = new FileInputStream(file)) {
load(in, file.getName());
} catch (FileNotFoundException e) {
// Not an error
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
private static void add(Map<Character, Set<String>> map, Character character, String partName) {
if (!map.containsKey(character)) {
map.put(character, new HashSet<>());
}
map.get(character).add(partName);
}
public static void showStatistics() {
Counter<Character> counterLocal = new Counter<>();
Counter<Character> counterGlobal = new Counter<>();
Map<Character, Set<String>> usersPerCharacter = new HashMap<>();
for (BuildingPart part : PARTS.getIterable()) {
Palette localPalette = part.getLocalPalette();
Map<Character, Object> palette = Collections.emptyMap();
if (localPalette != null) {
palette = localPalette.palette;
}
for (int x = 0 ; x < part.getXSize() ; x++) {
for (int z = 0 ; z < part.getZSize() ; z++) {
char[] slice = part.getVSlice(x, z);
if (slice != null) {
for (char c : slice) {
if (palette.containsKey(c)) {
counterLocal.add(c);
} else {
counterGlobal.add(c);
}
add(usersPerCharacter, c, part.getName());
}
}
}
}
}
List<Map.Entry<Character, Integer>> global = new ArrayList<>(counterGlobal.getMap().entrySet());
List<Map.Entry<Character, Integer>> local = new ArrayList<>(counterLocal.getMap().entrySet());
global.sort((e1, e2) -> e2.getValue().compareTo(e1.getValue()));
local.sort((e1, e2) -> e2.getValue().compareTo(e1.getValue()));
LostCities.setup.getLogger().info("############################################################################");
LostCities.setup.getLogger().info("Global palette entries");
printMap(usersPerCharacter, global);
LostCities.setup.getLogger().info("----------------------------------------------------------------------------");
LostCities.setup.getLogger().info("Local palette entries");
printMap(usersPerCharacter, local);
LostCities.setup.getLogger().info("----------------------------------------------------------------------------");
printChars("Global: ", counterGlobal);
printChars("Local: ", counterLocal);
LostCities.setup.getLogger().info("############################################################################");
}
private static void printChars(String prefix, Counter<Character> counter) {
List<Character> chars = new ArrayList<>(counter.getMap().keySet());
chars.sort(Character::compareTo);
String s = "";
for (Character character : chars) {
s += character;
}
LostCities.setup.getLogger().info(prefix + s);
}
private static void printMap(Map<Character, Set<String>> usersPerCharacter, List<Map.Entry<Character, Integer>> map) {
for (Map.Entry<Character, Integer> entry : map) {
Set<String> users = usersPerCharacter.get(entry.getKey());
String s = " " + entry.getKey() + ": " + entry.getValue() + " Uses";
if (users.size() < 10) {
s += ", Used by: ";
for (String user : users) {
s += user + ",";
}
} else {
s += ", Used " + users.size() + " times";
}
LostCities.setup.getLogger().info(s);
}
}
public static void load(InputStream inputstream, String filename) {
try(BufferedReader br = new BufferedReader(new InputStreamReader(inputstream, StandardCharsets.UTF_8))) {
JsonParser parser = new JsonParser();
JsonElement element = parser.parse(br);
for (JsonElement entry : element.getAsJsonArray()) {
JsonObject object = entry.getAsJsonObject();
String type = object.get("type").getAsString();
if ("style".equals(type)) {
STYLES.register(new Style(object));
} else if ("condition".equals(type)) {
CONDITIONS.register(new Condition(object));
} else if ("palette".equals(type)) {
PALETTES.register(new Palette(object));
} else if ("citystyle".equals(type)) {
CITYSTYLES.register(new CityStyle(object));
} else if ("part".equals(type)) {
PARTS.register(new BuildingPart(object));
} else if ("building".equals(type)) {
BUILDINGS.register(new Building(object));
} else if ("multibuilding".equals(type)) {
MULTI_BUILDINGS.register(new MultiBuilding(object));
} else if ("worldstyle".equals(type)) {
WORLDSTYLES.register(new WorldStyle(object));
} else if ("city".equals(type)) {
PREDEFINED_CITIES.register(new PredefinedCity(object));
} else if ("sphere".equals(type)) {
PREDEFINED_SPHERES.register(new PredefinedSphere(object));
} else {
throw new RuntimeException("Unknown type '" + type + " in " + filename + "'!");
}
}
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
}
|
[
"slto15aGH10"
] |
slto15aGH10
|
a77b2c1bc8ae2cfc725b75e362e13f403f03568c
|
2e37b28c9ee8e657efcbe1219cd9a92d5a28e607
|
/java_rt/src/com/sun/corba/se/spi/activation/LocatorPackage/ServerLocation.java
|
ce1208153d906705c6df14ba0a97e92fc0de5315
|
[] |
no_license
|
wendellup/java_JRE
|
4050eac2ea799b79d0515df47c0ed01d1bebecc7
|
5d054e8ee3884e26d2bb523dffae71abfb83b140
|
refs/heads/master
| 2021-09-08T04:10:02.628651 | 2021-07-31T03:58:00 | 2021-07-31T03:58:00 | 21,631,408 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 746 |
java
|
package com.sun.corba.se.spi.activation.LocatorPackage;
/**
* com/sun/corba/se/spi/activation/LocatorPackage/ServerLocation.java .
* Generated by the IDL-to-Java compiler (portable), version "3.2"
* from ../../../../src/share/classes/com/sun/corba/se/spi/activation/activation.idl
* Wednesday, December 18, 2013 6:35:01 PM PST
*/
public final class ServerLocation implements org.omg.CORBA.portable.IDLEntity
{
public String hostname = null;
public com.sun.corba.se.spi.activation.ORBPortInfo ports[] = null;
public ServerLocation ()
{
} // ctor
public ServerLocation (String _hostname, com.sun.corba.se.spi.activation.ORBPortInfo[] _ports)
{
hostname = _hostname;
ports = _ports;
} // ctor
} // class ServerLocation
|
[
"[email protected]"
] | |
fa350e0e86e04c6aee66f3a44f296adadc7e3db1
|
6d0ebcfdfe5646203c6c3e31c6ea6eb82fd441d8
|
/src/plugins/tree_viewer/src/figtree/ui/components/.svn/text-base/RangeSliderUI.java.svn-base
|
a338c16da6fe4580b01edf2c7d6eb0eb3eb55abd
|
[] |
no_license
|
sjordine/Anubis
|
b11d1ce808ef782ce86401ec41503b06973ab9b2
|
ee0c2cc8085124cd196b06333df6509a0f29b10c
|
refs/heads/master
| 2021-01-01T18:23:07.837009 | 2015-01-04T20:49:47 | 2015-01-04T20:49:47 | 28,785,242 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 22,923 |
/*
* RangeSliderUI.java
*
* Copyright (C) 2012 Andrew Rambaut
*
* 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package figtree.ui.components;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.Shape;
import java.awt.event.MouseEvent;
import java.awt.geom.Path2D;
import javax.swing.JComponent;
import javax.swing.JSlider;
import javax.swing.SwingUtilities;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.plaf.basic.BasicSliderUI;
/**
* UI delegate for the RangeSlider component. RangeSliderUI paints two thumbs,
* one for the lower value and one for the upper value.
*/
class RangeSliderUI extends BasicSliderUI {
/** Color of selected range. */
private Color rangeColor = Color.DARK_GRAY;
/** Location and size of thumb for upper value. */
private Rectangle upperThumbRect;
/** Indicator that determines whether upper thumb is selected. */
private boolean upperThumbSelected;
/** Indicator that determines whether lower thumb is being dragged. */
private transient boolean lowerDragging;
/** Indicator that determines whether upper thumb is being dragged. */
private transient boolean upperDragging;
/**
* Constructs a RangeSliderUI for the specified slider component.
* @param b RangeSlider
*/
public RangeSliderUI(RangeSlider b) {
super(b);
}
/**
* Installs this UI delegate on the specified component.
*/
@Override
public void installUI(JComponent c) {
upperThumbRect = new Rectangle();
super.installUI(c);
}
/**
* Creates a listener to handle track events in the specified slider.
*/
@Override
protected TrackListener createTrackListener(JSlider slider) {
return new RangeTrackListener();
}
/**
* Creates a listener to handle change events in the specified slider.
*/
@Override
protected ChangeListener createChangeListener(JSlider slider) {
return new ChangeHandler();
}
/**
* Updates the dimensions for both thumbs.
*/
@Override
protected void calculateThumbSize() {
// Call superclass method for lower thumb size.
super.calculateThumbSize();
// Set upper thumb size.
upperThumbRect.setSize(thumbRect.width, thumbRect.height);
}
/**
* Updates the locations for both thumbs.
*/
@Override
protected void calculateThumbLocation() {
// Call superclass method for lower thumb location.
super.calculateThumbLocation();
// Adjust upper value to snap to ticks if necessary.
if (slider.getSnapToTicks()) {
int upperValue = slider.getValue() + slider.getExtent();
int snappedValue = upperValue;
int majorTickSpacing = slider.getMajorTickSpacing();
int minorTickSpacing = slider.getMinorTickSpacing();
int tickSpacing = 0;
if (minorTickSpacing > 0) {
tickSpacing = minorTickSpacing;
} else if (majorTickSpacing > 0) {
tickSpacing = majorTickSpacing;
}
if (tickSpacing != 0) {
// If it's not on a tick, change the value
if ((upperValue - slider.getMinimum()) % tickSpacing != 0) {
float temp = (float)(upperValue - slider.getMinimum()) / (float)tickSpacing;
int whichTick = Math.round(temp);
snappedValue = slider.getMinimum() + (whichTick * tickSpacing);
}
if (snappedValue != upperValue) {
slider.setExtent(snappedValue - slider.getValue());
}
}
}
// Calculate upper thumb location. The thumb is centered over its
// value on the track.
if (slider.getOrientation() == JSlider.HORIZONTAL) {
int upperPosition = xPositionForValue(slider.getValue() + slider.getExtent());
// upperThumbRect.x = upperPosition - (upperThumbRect.width / 2);
// upperThumbRect.y = trackRect.y;
upperThumbRect.x = upperPosition - (upperThumbRect.width / 2);
upperThumbRect.y = trackRect.y;
} else {
int upperPosition = yPositionForValue(slider.getValue() + slider.getExtent());
upperThumbRect.x = trackRect.x;
upperThumbRect.y = upperPosition - (upperThumbRect.height / 2);
}
}
/**
* Returns the size of a thumb.
*/
@Override
protected Dimension getThumbSize() {
return new Dimension(12, 12);
}
/**
* Paints the slider. The selected thumb is always painted on top of the
* other thumb.
*/
@Override
public void paint(Graphics g, JComponent c) {
super.paint(g, c);
Rectangle clipRect = g.getClipBounds();
if (upperThumbSelected) {
// Paint lower thumb first, then upper thumb.
if (clipRect.intersects(thumbRect)) {
paintLowerThumb(g);
}
if (clipRect.intersects(upperThumbRect)) {
paintUpperThumb(g);
}
} else {
// Paint upper thumb first, then lower thumb.
if (clipRect.intersects(upperThumbRect)) {
paintUpperThumb(g);
}
if (clipRect.intersects(thumbRect)) {
paintLowerThumb(g);
}
}
}
/**
* Paints the track.
*/
@Override
public void paintTrack(Graphics g) {
// Draw track.
super.paintTrack(g);
Rectangle trackBounds = trackRect;
if (slider.getOrientation() == JSlider.HORIZONTAL) {
// Determine position of selected range by moving from the middle
// of one thumb to the other.
int lowerX = thumbRect.x + (thumbRect.width / 2);
int upperX = upperThumbRect.x + (upperThumbRect.width / 2);
// Determine track position.
int cy = (trackBounds.height / 2) - 2;
// Save color and shift position.
Color oldColor = g.getColor();
g.translate(trackBounds.x, trackBounds.y + cy);
// Draw selected range.
g.setColor(rangeColor);
for (int y = 0; y <= 3; y++) {
g.drawLine(lowerX - trackBounds.x, y, upperX - trackBounds.x, y);
}
// Restore position and color.
g.translate(-trackBounds.x, -(trackBounds.y + cy));
g.setColor(oldColor);
} else {
// Determine position of selected range by moving from the middle
// of one thumb to the other.
int lowerY = thumbRect.x + (thumbRect.width / 2);
int upperY = upperThumbRect.x + (upperThumbRect.width / 2);
// Determine track position.
int cx = (trackBounds.width / 2) - 2;
// Save color and shift position.
Color oldColor = g.getColor();
g.translate(trackBounds.x + cx, trackBounds.y);
// Draw selected range.
g.setColor(rangeColor);
for (int x = 0; x <= 3; x++) {
g.drawLine(x, lowerY - trackBounds.y, x, upperY - trackBounds.y);
}
// Restore position and color.
g.translate(-(trackBounds.x + cx), -trackBounds.y);
g.setColor(oldColor);
}
}
/**
* Overrides superclass method to do nothing. Thumb painting is handled
* within the <code>paint()</code> method.
*/
@Override
public void paintThumb(Graphics g) {
// Do nothing.
}
/**
* Paints the thumb for the lower value using the specified graphics object.
*/
private void paintLowerThumb(Graphics g) {
Rectangle knobBounds = thumbRect;
int w = knobBounds.width;
int h = knobBounds.height;
// Create graphics copy.
Graphics2D g2d = (Graphics2D) g.create();
// Create default thumb shape.
Shape thumbShape = createThumbShape(w - 1, h - 1, false);
// Draw thumb.
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g2d.translate(knobBounds.x, knobBounds.y);
g2d.setColor(Color.LIGHT_GRAY);
g2d.fill(thumbShape);
g2d.setColor(Color.GRAY);
g2d.draw(thumbShape);
// Dispose graphics.
g2d.dispose();
}
/**
* Paints the thumb for the upper value using the specified graphics object.
*/
private void paintUpperThumb(Graphics g) {
Rectangle knobBounds = upperThumbRect;
int w = knobBounds.width;
int h = knobBounds.height;
// Create graphics copy.
Graphics2D g2d = (Graphics2D) g.create();
// Create default thumb shape.
Shape thumbShape = createThumbShape(w - 1, h - 1, true);
// Draw thumb.
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g2d.translate(knobBounds.x, knobBounds.y);
g2d.setColor(Color.LIGHT_GRAY);
g2d.fill(thumbShape);
g2d.setColor(Color.GRAY);
g2d.draw(thumbShape);
// Dispose graphics.
g2d.dispose();
}
/**
* Returns a Shape representing a thumb.
*/
private Shape createThumbShape(int width, int height, boolean upper) {
// Use circular shape.
// Ellipse2D shape = new Ellipse2D.Double(0, 0, width, height);
// return shape;
Path2D path = new Path2D.Float();
if (slider.getOrientation() == JSlider.HORIZONTAL) {
float d = 0.5F * width;
path.moveTo(d, 0);
path.lineTo((upper ? width : 0.0), d);
path.lineTo((upper ? width : 0.0), height);
path.lineTo(0.5 * width, height);
} else {
float d = 0.5F * height;
path.moveTo(0, d);
path.lineTo(d, (upper ? height : 0.0));
path.lineTo(width, (upper ? height : 0.0));
path.lineTo(height, 0.5 * height);
}
path.closePath();
return path;
}
/**
* Sets the location of the upper thumb, and repaints the slider. This is
* called when the upper thumb is dragged to repaint the slider. The
* <code>setThumbLocation()</code> method performs the same task for the
* lower thumb.
*/
private void setUpperThumbLocation(int x, int y) {
Rectangle upperUnionRect = new Rectangle();
upperUnionRect.setBounds(upperThumbRect);
upperThumbRect.setLocation(x, y);
SwingUtilities.computeUnion(upperThumbRect.x, upperThumbRect.y, upperThumbRect.width, upperThumbRect.height, upperUnionRect);
slider.repaint(upperUnionRect.x, upperUnionRect.y, upperUnionRect.width, upperUnionRect.height);
}
/**
* Moves the selected thumb in the specified direction by a block increment.
* This method is called when the user presses the Page Up or Down keys.
*/
public void scrollByBlock(int direction) {
synchronized (slider) {
int blockIncrement = (slider.getMaximum() - slider.getMinimum()) / 10;
if (blockIncrement <= 0 && slider.getMaximum() > slider.getMinimum()) {
blockIncrement = 1;
}
int delta = blockIncrement * ((direction > 0) ? POSITIVE_SCROLL : NEGATIVE_SCROLL);
if (upperThumbSelected) {
int oldValue = ((RangeSlider) slider).getUpperValue();
((RangeSlider) slider).setUpperValue(oldValue + delta);
} else {
int oldValue = slider.getValue();
slider.setValue(oldValue + delta);
}
}
}
/**
* Moves the selected thumb in the specified direction by a unit increment.
* This method is called when the user presses one of the arrow keys.
*/
public void scrollByUnit(int direction) {
synchronized (slider) {
int delta = 1 * ((direction > 0) ? POSITIVE_SCROLL : NEGATIVE_SCROLL);
if (upperThumbSelected) {
int oldValue = ((RangeSlider) slider).getUpperValue();
((RangeSlider) slider).setUpperValue(oldValue + delta);
} else {
int oldValue = slider.getValue();
slider.setValue(oldValue + delta);
}
}
}
/**
* Listener to handle model change events. This calculates the thumb
* locations and repaints the slider if the value change is not caused by
* dragging a thumb.
*/
public class ChangeHandler implements ChangeListener {
public void stateChanged(ChangeEvent arg0) {
if (!lowerDragging && !upperDragging) {
calculateThumbLocation();
slider.repaint();
}
}
}
/**
* Listener to handle mouse movements in the slider track.
*/
public class RangeTrackListener extends TrackListener {
@Override
public void mousePressed(MouseEvent e) {
if (!slider.isEnabled()) {
return;
}
currentMouseX = e.getX();
currentMouseY = e.getY();
if (slider.isRequestFocusEnabled()) {
slider.requestFocus();
}
// Determine which thumb is pressed. If the upper thumb is
// selected (last one dragged), then check its position first;
// otherwise check the position of the lower thumb first.
// if (upperThumbSelected) {
// if (upperThumbRect.contains(currentMouseX, currentMouseY)) {
// upperPressed = true;
// } else if (thumbRect.contains(currentMouseX, currentMouseY)) {
// lowerPressed = true;
// }
// } else {
// if (thumbRect.contains(currentMouseX, currentMouseY)) {
// lowerPressed = true;
// } else if (upperThumbRect.contains(currentMouseX, currentMouseY)) {
// upperPressed = true;
// }
// }
// Determine which thumb is pressed. First check against the upper
// slider rects top half...
boolean lowerPressed = false;
boolean upperPressed = false;
Rectangle urect = new Rectangle(upperThumbRect);
Rectangle lrect = new Rectangle(thumbRect);
if (slider.getOrientation() == JSlider.HORIZONTAL) {
urect.width = (int)Math.round(0.5 * urect.width);
urect.x += urect.width;
lrect.width = urect.width;
} else {
urect.height = (int)Math.round(0.5 * urect.height);
urect.y += urect.height;
lrect.height = urect.height;
}
if (urect.contains(currentMouseX, currentMouseY)) {
upperPressed = true;
} else if (lrect.contains(currentMouseX, currentMouseY)) {
lowerPressed = true;
}
// Handle lower thumb pressed.
if (lowerPressed) {
switch (slider.getOrientation()) {
case JSlider.VERTICAL:
offset = currentMouseY - thumbRect.y;
break;
case JSlider.HORIZONTAL:
offset = currentMouseX - thumbRect.x;
break;
}
upperThumbSelected = false;
lowerDragging = true;
return;
}
lowerDragging = false;
// Handle upper thumb pressed.
if (upperPressed) {
switch (slider.getOrientation()) {
case JSlider.VERTICAL:
offset = currentMouseY - upperThumbRect.y;
break;
case JSlider.HORIZONTAL:
offset = currentMouseX - upperThumbRect.x;
break;
}
upperThumbSelected = true;
upperDragging = true;
return;
}
upperDragging = false;
}
@Override
public void mouseReleased(MouseEvent e) {
lowerDragging = false;
upperDragging = false;
slider.setValueIsAdjusting(false);
super.mouseReleased(e);
}
@Override
public void mouseDragged(MouseEvent e) {
if (!slider.isEnabled()) {
return;
}
currentMouseX = e.getX();
currentMouseY = e.getY();
if (lowerDragging) {
slider.setValueIsAdjusting(true);
moveLowerThumb();
} else if (upperDragging) {
slider.setValueIsAdjusting(true);
moveUpperThumb();
}
}
@Override
public boolean shouldScroll(int direction) {
return false;
}
/**
* Moves the location of the lower thumb, and sets its corresponding
* value in the slider.
*/
private void moveLowerThumb() {
int thumbMiddle = 0;
switch (slider.getOrientation()) {
case JSlider.VERTICAL:
int halfThumbHeight = thumbRect.height / 2;
int thumbTop = currentMouseY - offset;
int trackTop = trackRect.y;
int trackBottom = trackRect.y + (trackRect.height - 1);
int vMax = yPositionForValue(slider.getValue() + slider.getExtent());
// Apply bounds to thumb position.
if (drawInverted()) {
trackBottom = vMax;
} else {
trackTop = vMax;
}
thumbTop = Math.max(thumbTop, trackTop - halfThumbHeight);
thumbTop = Math.min(thumbTop, trackBottom - halfThumbHeight);
setThumbLocation(thumbRect.x, thumbTop);
// Update slider value.
thumbMiddle = thumbTop + halfThumbHeight;
slider.setValue(valueForYPosition(thumbMiddle));
break;
case JSlider.HORIZONTAL:
int halfThumbWidth = thumbRect.width / 2;
int thumbLeft = currentMouseX - offset;
int trackLeft = trackRect.x;
int trackRight = trackRect.x + (trackRect.width - 1);
int hMax = xPositionForValue(slider.getValue() + slider.getExtent());
// Apply bounds to thumb position.
if (drawInverted()) {
trackLeft = hMax;
} else {
trackRight = hMax;
}
thumbLeft = Math.max(thumbLeft, trackLeft - halfThumbWidth);
thumbLeft = Math.min(thumbLeft, trackRight - halfThumbWidth);
setThumbLocation(thumbLeft, thumbRect.y);
// Update slider value.
thumbMiddle = thumbLeft + halfThumbWidth;
slider.setValue(valueForXPosition(thumbMiddle));
break;
default:
return;
}
}
/**
* Moves the location of the upper thumb, and sets its corresponding
* value in the slider.
*/
private void moveUpperThumb() {
int thumbMiddle = 0;
switch (slider.getOrientation()) {
case JSlider.VERTICAL:
int halfThumbHeight = thumbRect.height / 2;
int thumbTop = currentMouseY - offset;
int trackTop = trackRect.y;
int trackBottom = trackRect.y + (trackRect.height - 1);
int vMin = yPositionForValue(slider.getValue());
// Apply bounds to thumb position.
if (drawInverted()) {
trackTop = vMin;
} else {
trackBottom = vMin;
}
thumbTop = Math.max(thumbTop, trackTop - halfThumbHeight);
thumbTop = Math.min(thumbTop, trackBottom - halfThumbHeight);
setUpperThumbLocation(thumbRect.x, thumbTop);
// Update slider extent.
thumbMiddle = thumbTop + halfThumbHeight;
slider.setExtent(valueForYPosition(thumbMiddle) - slider.getValue());
break;
case JSlider.HORIZONTAL:
int halfThumbWidth = thumbRect.width / 2;
int thumbLeft = currentMouseX - offset;
int trackLeft = trackRect.x;
int trackRight = trackRect.x + (trackRect.width - 1);
int hMin = xPositionForValue(slider.getValue());
// Apply bounds to thumb position.
if (drawInverted()) {
trackRight = hMin;
} else {
trackLeft = hMin;
}
thumbLeft = Math.max(thumbLeft, trackLeft - halfThumbWidth);
thumbLeft = Math.min(thumbLeft, trackRight - halfThumbWidth);
setUpperThumbLocation(thumbLeft, thumbRect.y);
// Update slider extent.
thumbMiddle = thumbLeft + halfThumbWidth;
slider.setExtent(valueForXPosition(thumbMiddle) - slider.getValue());
break;
default:
return;
}
}
}
}
|
[
"[email protected]"
] | ||
8c6837ebc121c6588a29dd8333a5ba9fc8b6b818
|
973256f413ece89578178cb2a2da5809508e5fb6
|
/src/main/java/com/dbc/lxshop/Dao/Impl/FactoryLicenceDaoImpl.java
|
b3b97ed27bb81323e6e1374f2bae0eac5086d6e4
|
[] |
no_license
|
DengBoCong/lxshop
|
19d6588045987e3d67d7f8165e9fb1443f013911
|
bdb8a634d5ba4a898aca2618d745c43133279232
|
refs/heads/master
| 2020-07-05T12:08:50.369499 | 2019-08-28T16:31:32 | 2019-08-28T16:31:32 | 202,644,706 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 6,967 |
java
|
package com.dbc.lxshop.Dao.Impl;
import com.dbc.lxshop.Dao.FactoryLicenceDao;
import com.dbc.lxshop.Model.Entity.LFactoryLicenceEntity;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @program: lxshop
* @description:
* @author: DBC
* @create: 2019-08-27 10:30
**/
@Repository("factoryLicenceDao")
public class FactoryLicenceDaoImpl implements FactoryLicenceDao {
@Qualifier("sessionFactory")
@Autowired
private SessionFactory sessionFactory;
/**
* @Description: 添加经销商营业执照实体类
* @Param: LFactoryLicenceEntity
* @return: boolean
* @Author: DBC
* @Date: 2019/8/26
*/
@Override
public boolean addFactoryLicence(LFactoryLicenceEntity lFactoryLicenceEntity) {
Session session = sessionFactory.openSession();
Transaction transaction = session.beginTransaction();
List<LFactoryLicenceEntity> list = null;
try{
list = session.createNamedQuery("FACTORYLICENCE.FACTORY_ID", LFactoryLicenceEntity.class)
.setParameter("userId", lFactoryLicenceEntity.getUserId()).getResultList();
}catch (IllegalArgumentException e){
System.out.println("FactoryLicenceDao查询语句出现问题");
e.printStackTrace();
}
if (!list.isEmpty()) return false;
else{
try{
session.save(lFactoryLicenceEntity);
transaction.commit();
}catch (Exception e){
System.out.println("FactoryLicenceDao中Session操作出错!");
e.printStackTrace();
}
session.close();
return true;
}
}
/**
* @Description: 通过id删除经销商营业执照实体类
* @Param: int
* @return: boolean
* @Author: DBC
* @Date: 2019/8/26
*/
@SuppressWarnings("unchecked")
@Override
public boolean deleteFactoryLicence(int factoryLicenceId) {
Session session = sessionFactory.openSession();
Transaction transaction = session.beginTransaction();
LFactoryLicenceEntity lFactoryLicenceEntity = null;
lFactoryLicenceEntity = (LFactoryLicenceEntity)session.get(LFactoryLicenceEntity.class, factoryLicenceId);
if(lFactoryLicenceEntity == null) return false;
else{
try{
session.delete(lFactoryLicenceEntity);
transaction.commit();
}catch (Exception e){
System.out.println("FactoryLicenceDao中Session操作出错!");
e.printStackTrace();
}
session.close();
return true;
}
}
/**
* @Description: 更新经销商营业执照实体类
* @Param: LFactoryLicenceEntity
* @return: boolean
* @Author: DBC
* @Date: 2019/8/26
*/
@SuppressWarnings("unchecked")
@Override
public boolean updateFactoryLicence(LFactoryLicenceEntity lFactoryLicenceEntity) {
Session session = sessionFactory.openSession();
Transaction transaction = session.beginTransaction();
LFactoryLicenceEntity lFactoryLicenceEntity1 = null;
lFactoryLicenceEntity1 = (LFactoryLicenceEntity)session.get(LFactoryLicenceEntity.class, lFactoryLicenceEntity.getId());
if(lFactoryLicenceEntity1 == null) return false;
else{
if(lFactoryLicenceEntity.getLicenceNumber() != null)
lFactoryLicenceEntity1.setLicenceNumber(lFactoryLicenceEntity.getLicenceNumber());
if(lFactoryLicenceEntity.getLicenceName() != null)
lFactoryLicenceEntity1.setLicenceName(lFactoryLicenceEntity.getLicenceName());
if(lFactoryLicenceEntity.getLegalPerson() != null)
lFactoryLicenceEntity1.setLegalPerson(lFactoryLicenceEntity.getLegalPerson());
if(lFactoryLicenceEntity.getLegalPersonTel() != null)
lFactoryLicenceEntity1.setLegalPersonTel(lFactoryLicenceEntity.getLegalPersonTel());
if(lFactoryLicenceEntity.getLegalPersonIdcard() != null)
lFactoryLicenceEntity1.setLegalPersonIdcard(lFactoryLicenceEntity.getLegalPersonIdcard());
if(lFactoryLicenceEntity.getLicencePhoto() != null)
lFactoryLicenceEntity1.setLicencePhoto(lFactoryLicenceEntity.getLicencePhoto());
if(lFactoryLicenceEntity.getLegalPersonBphoto() != null)
lFactoryLicenceEntity1.setLegalPersonBphoto(lFactoryLicenceEntity.getLegalPersonBphoto());
if(lFactoryLicenceEntity.getLegalPersonFphoto() != null)
lFactoryLicenceEntity1.setLegalPersonFphoto(lFactoryLicenceEntity.getLegalPersonFphoto());
try{
session.update(lFactoryLicenceEntity1);
transaction.commit();
}catch (Exception e){
System.out.println("FactoryLicenceDao中Session操作出错!");
e.printStackTrace();
}
session.close();
return true;
}
}
/**
* @Description: 通过id查询经销商营业执照实体类
* @Param: int
* @return: LFactoryLicenceEntity
* @Author: DBC
* @Date: 2019/8/26
*/
@SuppressWarnings("unchecked")
@Override
public LFactoryLicenceEntity listById(int factoryLicenceId) {
Session session = sessionFactory.openSession();
LFactoryLicenceEntity lFactoryLicenceEntity = null;
lFactoryLicenceEntity = (LFactoryLicenceEntity)session.get(LFactoryLicenceEntity.class, factoryLicenceId);
session.close();
return lFactoryLicenceEntity;
}
/**
* @Description: 通过经销商ID查询经销商营业执照实体类
* @Param: int
* @return: LFactoryLicenceEntity
* @Author: DBC
* @Date: 2019/8/26
*/
@Override
public LFactoryLicenceEntity listByFactoryId(int factoryId) {
Session session = sessionFactory.openSession();
List<LFactoryLicenceEntity> list = null;
try{
list = session.createNamedQuery("FACTORYLICENCE.FACTORY_ID", LFactoryLicenceEntity.class)
.setParameter("userId", factoryId).getResultList();
}catch (IllegalArgumentException e){
System.out.println("FactoryLicenceDao查询语句出现问题");
e.printStackTrace();
}
session.close();
if(list.isEmpty()) return null;
else return list.get(0);
}
public void setSessionFactory(SessionFactory sessionFactory) {
this.sessionFactory = sessionFactory;
}
public SessionFactory getSessionFactory() {
return sessionFactory;
}
}
|
[
"[email protected]"
] | |
e5cabfcabd44ab07024487511967c5869f9e0775
|
f97ba375da68423d12255fa8231365104867d9b0
|
/study-notes/j2ee-collection/java-web/04-JavaWeb/src/com/coderZsq/_25_shoppingcart/servlet/ShoppingCartServlet.java
|
3cc6c167f280f3c9c986343f95d00101b122e631
|
[
"MIT"
] |
permissive
|
lei720/coderZsq.practice.server
|
7a728612e69c44e0877c0153c828b50d8ea7fa7c
|
4ddf9842cd088d4a0c2780ac22d41d7e6229164b
|
refs/heads/master
| 2023-07-16T11:21:26.942849 | 2021-09-08T04:38:07 | 2021-09-08T04:38:07 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,606 |
java
|
package com.coderZsq._25_shoppingcart.servlet;
import com.coderZsq._25_shoppingcart.domain.CartItem;
import com.coderZsq._25_shoppingcart.domain.ShoppingCart;
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 java.io.IOException;
import java.math.BigDecimal;
// 处理购物车的添加/删除
@WebServlet("/shoppingcart")
public class ShoppingCartServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
@Override
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
req.setCharacterEncoding("UTF-8");
String cmd = req.getParameter("cmd");
if ("save".equals(cmd)) {
this.save(req, resp);
} else if ("delete".equals(cmd)) {
this.delete(req, resp);
}
resp.sendRedirect("/shoppingcart/cart_list.jsp");
}
// 添加进购物车
protected void save(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
// 1. 接受请求参数
String name = req.getParameter("name");
String num = req.getParameter("num");
String id = "";
BigDecimal price = BigDecimal.ZERO;
if ("iphone".equals(name)) {
id = "123";
price = new BigDecimal("5000");
} else if ("ipad".equals(name)) {
id = "456";
price = new BigDecimal("3000");
} else if ("iWatch".equals(name)) {
id = "789";
price = new BigDecimal("10000");
}
CartItem item = new CartItem(id, name, price, Integer.valueOf(num));
// 2. 调用业务方法处理请求
ShoppingCart cart = (ShoppingCart) req.getSession().getAttribute("SHOPPINGCART_IN_SESSION");
if (cart == null) {
cart = new ShoppingCart();
req.getSession().setAttribute("SHOPPINGCART_IN_SESSION", cart);
}
cart.save(item);
// 3. 控制界面跳转
}
// 从购物车中移除某个商品
protected void delete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
// 1. 接受请求参数
String id = req.getParameter("id");
// 2. 调用业务方法处理请求
ShoppingCart cart = (ShoppingCart) req.getSession().getAttribute("SHOPPINGCART_IN_SESSION");
cart.delete(id);
// 3. 控制界面跳转
}
}
|
[
"[email protected]"
] | |
ed2fe2b5752c336b6a408777fa5df8276c1f64ef
|
a0a7e7a96301f5aa48857a1e7fc9388f2efc5de8
|
/src/main/java/org/irmantas/booksstore/model/ErrMsg.java
|
4c08c6c1588ca9fb6f9e88000eecbc5fdd16ab03
|
[] |
no_license
|
irmantas555/book-store
|
af1615445cd649945cbdd7a6c61aa22564e25004
|
1f0695a0ab5ad61ff7098e4ec0aa16116393dc75
|
refs/heads/master
| 2023-03-02T05:46:24.439497 | 2021-02-15T08:52:12 | 2021-02-15T08:52:12 | 338,844,026 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 521 |
java
|
package org.irmantas.booksstore.model;
public class ErrMsg {
public static final String NO_ENTITY_WITH_ID = "Entity with such Id not exists in DB";
public static final String NO_ENTITY_WITH_BARCODE = "Entity with such barcode not exists in DB";
public static final String BARCODE_NOT_VALID = "Value of barcode for search is not valid";
public static final String NO_SUCH_FIELD= "No such field in in Books";
public static final String DB_OPERATION_FAILED = "There was an error in DB operation";
}
|
[
"[email protected]"
] | |
6c2ec8e737301ebc4a3466d1a024d734ac1545d1
|
10997e06837ad07f578e73aae8a1c3058552ba59
|
/cloud-consumer-order80/src/main/java/com/wayn/learn/springcloud/order/config/MyRoundLb.java
|
86d2eb5959c214a7037ed5782596e8e14880249a
|
[] |
no_license
|
wayn111/springcloud-learning-2020
|
7eff68daa64bb3affd179b42947c585342a1f3a2
|
c087f409743aa680dd39660dfe6563129cee7b32
|
refs/heads/main
| 2023-07-14T01:41:10.171361 | 2021-08-29T14:21:23 | 2021-08-29T14:21:23 | 378,063,787 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,339 |
java
|
package com.wayn.learn.springcloud.order.config;
import cn.hutool.core.collection.CollectionUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
/**
* 自定义轮询负载均衡算法
*/
@Slf4j
@Component
public class MyRoundLb implements LoadBlance {
private final AtomicInteger atomicInteger = new AtomicInteger();
@Override
public ServiceInstance getInstance(List<ServiceInstance> instances) {
if (CollectionUtil.isEmpty(instances)) {
log.warn("服务实例集合为空!");
return null;
}
return instances.get(compareAndSet() % instances.size());
}
private int compareAndSet() {
int current, next, retryCount = 100;
current = atomicInteger.get();
if (current >= Integer.MAX_VALUE) {
current = 0;
}
next = current + 1;
int count = 0;
while (!atomicInteger.compareAndSet(current, next)) {
count++;
if (count >= retryCount) {
log.warn("原子比较超过" + retryCount + "次,未能设置成功~");
return current;
}
}
return next;
}
}
|
[
"[email protected]"
] | |
fbb99c3de168c8d63773b58eff69a1ec4bb9a56a
|
be81f77592404e96e869d157acb6345027802282
|
/tunerservice/tunerservice/src/org/droidtv/euinstallersat/wizard/settings/connectionTypeWizard/screen/LNBSelectionScreen.java
|
525aeb298c130ab1bb3565a33eb2f24e190f9651
|
[] |
no_license
|
GongHuixue/2k15_asta_app
|
a5f39ca515958ad38a50b6a42a46b3fdb0d86b09
|
99ee7b8795db43374a19b0b439e90c3a63866862
|
refs/heads/master
| 2021-01-24T20:01:59.468015 | 2018-08-26T03:29:39 | 2018-08-26T03:29:39 | 123,243,941 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 9,600 |
java
|
package org.droidtv.euinstallersat.wizard.settings.connectionTypeWizard.screen;
import java.util.Observable;
import org.droidtv.euinstallersat.model.mwapi.NativeAPIWrapper;
import org.droidtv.euinstallersat.model.mwapi.NativeAPIWrapper.CONNECTION_TYPE;
import org.droidtv.euinstallersat.wizard.settings.WizardSettingsActivity;
import org.droidtv.euinstallersat.wizard.settings.connectionTypeWizard.ConnTypeScreen;
import org.droidtv.euinstallersat.wizard.settings.connectionTypeWizard.ConnTypeWizard;
import org.droidtv.euinstallersat.wizard.settings.connectionTypeWizard.ConnTypeWizard.ConnTypeScreenReq;
import org.droidtv.ui.tvwidget2k15.wizardframework.WizardStep;
import org.droidtv.ui.tvwidget2k15.wizardframework.common.CheckBoxSelector;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.util.AttributeSet;
import android.util.Log;
import android.util.SparseBooleanArray;
import android.view.FocusFinder;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.Button;
public class LNBSelectionScreen extends WizardStep implements ConnTypeScreen {
private final String TAG = LNBSelectionScreen.class.getName();
private Context mContext;
private NativeAPIWrapper nwrap;
private CheckBoxSelector mCheckBoxSelector;
public LNBSelectionScreen(Context context, AttributeSet attrSet, int defStyle) {
super(context, attrSet, defStyle);
mContext = context;
nwrap = NativeAPIWrapper.getInstance();
loadLayout(context);
}
private void loadLayout(final Context context) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(org.droidtv.ui.tvwidget2k15.R.layout.checkbox_selector_layout, null);
addView(view);
mCheckBoxSelector = (CheckBoxSelector) view.findViewById(org.droidtv.ui.tvwidget2k15.R.id.checkBoxSelector1);
OnClickListener buttonPrevious_Listener = new OnClickListener() {
@Override
public void onClick(View v) {
launchWizardSettings();
}
};
OnClickListener buttonNext_Listener = new OnClickListener() {
@Override
public void onClick(View v) {
// mCheckBoxSelector.isItemChecked(position);
SparseBooleanArray arr = mCheckBoxSelector.getCheckedItemPositions();
if(arr.size() == 0){
// cannot proceed
}else{
// reset
for(int index = 0; index < 4; index++){
nwrap.setPrescanLNBs(index,true);
}
// save selected LNB's
for(int index = 0; index < arr.size(); index++){
if(arr.get(index) == true){
nwrap.setPrescanLNBs(index, true);
}else{
nwrap.setPrescanLNBs(index, false);
}
}
launchWizardSettings();
}
}
};
OnClickListener buttonCancel_Listener = new OnClickListener() {
@Override
public void onClick(View v) {
launchWizardSettings();
}
};
mCheckBoxSelector.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
SparseBooleanArray arr = mCheckBoxSelector.getCheckedItemPositions();
int selectedLNBCount = 0;
for(int index = 0; index < arr.size(); index++){
if(arr.get(index) == true){
selectedLNBCount++;
}
}
if(selectedLNBCount == 0){
setButton3Enabled(false);
}else{
setButton3Enabled(true);
}
}
});
setButton1(mContext.getString(org.droidtv.ui.strings.R.string.MAIN_BUTTON_CANCEL), buttonCancel_Listener, VISIBLE);
setButton2(mContext.getString(org.droidtv.ui.strings.R.string.MAIN_BUTTON_PREVIOUS), buttonPrevious_Listener, INVISIBLE);
setButton3(mContext.getString(org.droidtv.ui.strings.R.string.MAIN_BUTTON_NEXT), buttonNext_Listener, VISIBLE);
setHintText(mContext.getString(org.droidtv.ui.strings.R.string.MAIN_CH_LNB_SELECTION));
}
private void launchWizardSettings() {
Intent intent;
intent = new Intent(mContext, WizardSettingsActivity.class);
((Activity) mContext).finish();
mContext.startActivity(intent);
}
public LNBSelectionScreen(Context context, AttributeSet attrSet) {
this(context, attrSet, 0);
}
public LNBSelectionScreen(Context context) {
super(context);
}
@Override
public void setInstance(ConnTypeWizard p_wizard) {
}
@Override
public ConnTypeScreenReq getScreenName() {
return ConnTypeScreenReq.LNBSELECTION;
}
@Override
public void screenIntialization() {
int maxLNBCount = 4;
if (nwrap.getConnectionTypeFromMW() == CONNECTION_TYPE.DISEQC_MINI) {
mCheckBoxSelector.setArray(new String[] {
mContext.getString(org.droidtv.ui.strings.R.string.MAIN_WI_SAT_SATELLITE_LNB1),
mContext.getString(org.droidtv.ui.strings.R.string.MAIN_WI_SAT_SATELLITE_LNB2)
});
maxLNBCount = 2;
} else if (nwrap.getConnectionTypeFromMW() == CONNECTION_TYPE.DISEQC_1_0) {
mCheckBoxSelector.setArray(new String[] {
mContext.getString(org.droidtv.ui.strings.R.string.MAIN_WI_SAT_SATELLITE_LNB1),
mContext.getString(org.droidtv.ui.strings.R.string.MAIN_WI_SAT_SATELLITE_LNB2),
mContext.getString(org.droidtv.ui.strings.R.string.MAIN_WI_SAT_SATELLITE_LNB3),
mContext.getString(org.droidtv.ui.strings.R.string.MAIN_WI_SAT_SATELLITE_LNB4)
});
maxLNBCount = 4;
}
for(int index = 0; index < maxLNBCount; index++){
mCheckBoxSelector.setItemChecked(index, nwrap.getPrescanForLNBs()[index]);
}
mCheckBoxSelector.requestFocus();
}
@Override
public void update(Observable arg0, Object arg1) {
}
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
int keyCode = event.getKeyCode();
int keyAction = event.getAction();
boolean handled = false;
View currentFocus;
View leftFocus = null;
View rightFocus = null;
currentFocus = ((Activity)mContext).getCurrentFocus();
if (currentFocus != null) {
leftFocus = FocusFinder.getInstance().findNextFocus((ViewGroup) currentFocus.getParent(), currentFocus, View.FOCUS_LEFT);
rightFocus = FocusFinder.getInstance().findNextFocus((ViewGroup) currentFocus.getParent(), currentFocus, View.FOCUS_RIGHT);
}
/*if ((event.getKeyCode() == KeyEvent.KEYCODE_BACK) || (event.getKeyCode() == KeyEvent.KEYCODE_ESCAPE)) {
launchWizardSettings();
}*/
Log.d(TAG, "dispatchKeyEvent currentFocus: " + currentFocus + " ,leftFocus:" + leftFocus + ",rightFocus:" + rightFocus);
if ((keyCode == KeyEvent.KEYCODE_BACK) || (keyCode == KeyEvent.KEYCODE_ESCAPE)) {
if (keyAction == KeyEvent.ACTION_DOWN) {
launchWizardSettings();
handled = true;
} else if (keyAction == KeyEvent.ACTION_UP) {
handled = true;
}
} else if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT) {
if (keyAction == KeyEvent.ACTION_DOWN) {
if (currentFocus instanceof Button) {
// left key pressed over wizard buttons
if (leftFocus == null) {
// nothing on the left side go to previous screen
handled = true;
}else if(leftFocus instanceof Button){
leftFocus.requestFocus();
handled = true;
}
// else let android handled the default case
} else if (currentFocus instanceof CheckBoxSelector) {
// left key pressed over radio list
handled = true;
} else {
// block other default cases
handled = true;
}
} else if (keyAction == KeyEvent.ACTION_UP) {
handled = true;
}
} else if (keyCode == KeyEvent.KEYCODE_DPAD_RIGHT) {
if (keyAction == KeyEvent.ACTION_DOWN) {
if (currentFocus instanceof Button) {
// right key pressed over wizard buttons
if (rightFocus == null) {
// nothing on the right side consume the key
handled = true;
}else if(rightFocus instanceof Button){
rightFocus.requestFocus();
handled = true;
}// else let android handled the default case
} else if (currentFocus instanceof CheckBoxSelector) {
// right key pressed over radio list
setButton3focussed();
handled = true;
}else {
// block other default cases
handled = true;
}
} else if (keyAction == KeyEvent.ACTION_UP) {
handled = true;
}
} else if (keyCode == KeyEvent.KEYCODE_DPAD_UP) {
handled = super.dispatchKeyEvent(event);
} else if (keyCode == KeyEvent.KEYCODE_DPAD_DOWN) {
handled = super.dispatchKeyEvent(event);
}else {
// for other keys let it call super to retain default behavior from wizard framework
super.dispatchKeyEvent(event);
handled = false;
}
return handled;
}
}
|
[
"[email protected]"
] | |
cbfd12c0f598bbfb54c66c2cc6688267e860ed6e
|
2133179f3cfca1be61866053c0a844bd80e79a29
|
/Lab3/Fifth/src/King.java
|
f2304ee8b546023047403df90080ab3864810ce3
|
[] |
no_license
|
SeilkhanA/OOP2018
|
dc5ef66db878eaa910ddd733cb3484c536a168c8
|
a1f0cc8b83110f9d97a421aab3db93dfe96930e4
|
refs/heads/master
| 2020-03-27T23:09:37.418985 | 2018-10-01T14:41:09 | 2018-10-01T14:41:09 | 147,295,995 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,030 |
java
|
import java.util.Scanner;
public class King extends Piece {
private King(int x, int y){
super(x,y);
}
public boolean isLegalMove(int dX, int dY){
if(dX > 0 && dX <= 8 && dY > 0 && dY <= 8){
if( (Math.abs(getX() - dX) == 1) && (Math.abs(getY() - dY) == 0))
return true;
else if ((Math.abs(getY() - dY)) == 1 &&
(Math.abs(getX() - dX) == 1))
return true;
else if (Math.abs(getX() - dX) == 0 && Math.abs(getY() - dY) == 1)
return true;
else return false;
}
return false;
}
public static void main (String [] args){
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int y = sc.nextInt();
int dX = sc.nextInt();
int dY = sc.nextInt();
King kg = new King(x,y);
boolean test = kg.isLegalMove(dX,dY);
System.out.println(test);
}
}
|
[
"[email protected]"
] | |
c287fb5667d61405bd11e5210452eeeef84bb146
|
f6217482eaf93ba3d37b05823ea86705023426f6
|
/java bighomework/src/edu/fjnu/empmis/exception/EmployeeMISException.java
|
0e44b28115c9a45e1c9671c6ea09bbe9ccfbec91
|
[] |
no_license
|
hyh122/MyGitHub
|
aa7d1c03d2acb5110eb060bffda966910e2b0c39
|
30e1b99979ea379916c16c9c472056779ca4966f
|
refs/heads/master
| 2020-05-17T10:51:04.932022 | 2014-10-31T06:54:00 | 2014-10-31T06:54:00 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 547 |
java
|
package edu.fjnu.empmis.exception;
public class EmployeeMISException extends RuntimeException{
public EmployeeMISException() {
super();
// TODO Auto-generated constructor stub
}
public EmployeeMISException(String message, Throwable cause) {
super(message, cause);
// TODO Auto-generated constructor stub
}
public EmployeeMISException(String message) {
super(message);
// TODO Auto-generated constructor stub
}
public EmployeeMISException(Throwable cause) {
super(cause);
// TODO Auto-generated constructor stub
}
}
|
[
"[email protected]"
] | |
32b7209f73ea7832608dfba30e8e6bba8d84a64e
|
0c5565b0c489358cf6bdb6f352794cc30d7c0b51
|
/Vector.java
|
5b6120dea039a8a15b8fe6f0c7d05df865ed25ef
|
[] |
no_license
|
animatinator/escape
|
1a89bbfc6790a7d5fc8edd0aa00c3e85995b9e83
|
9a9e72fb5d07633e856052bf7ec472e0106eefa8
|
refs/heads/master
| 2016-08-12T05:01:20.421841 | 2015-11-16T18:02:28 | 2015-11-16T18:02:28 | 46,291,887 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 352 |
java
|
// Vector.java
package escape;
class Vector {
public int x;
public int y;
public Vector() {
this.x = 0;
this.y = 0;
}
public Vector(int x, int y) {
this.x = x;
this.y = y;
}
public Vector(int[] pos) {
this.x = pos[0];
this.y = pos[1];
}
public Vector negate() {
return new Vector(-x, -y);
}
}
|
[
"[email protected]"
] | |
e5f6a5ffb6459bf160c0afe9212ad1dcc80e2748
|
5f811dcd2debd1c7d46822a2800e51a7decd2a1a
|
/pano-front-web/src/main/java/com/focus3d/pano/admin/dao/PanoUserLongInDAO.java
|
54ee951c2b925a50f0ab9aede0d0881503da1f11
|
[] |
no_license
|
focus3d-fc/pano-front
|
f87b4cb8300a826d4f880715ebe689ecfb1ee798
|
d3cc840720eccba9471f6557c0af34193a58b7ee
|
refs/heads/master
| 2021-09-02T23:48:27.963864 | 2018-01-04T04:26:14 | 2018-01-04T04:26:14 | 96,875,392 | 0 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,192 |
java
|
package com.focus3d.pano.admin.dao;
import java.util.List;
import com.focus3d.pano.model.PanoProjectHousePackage;
import com.focus3d.pano.model.PanoProjectPackage;
import com.focus3d.pano.model.PanoProjectPackageStyle;
import com.focus3d.pano.model.PanoUserLongin;
import com.focus3d.pano.model.getListPano;
public interface PanoUserLongInDAO {
public List<PanoUserLongin> getUserLongin(PanoUserLongin longin);
public List<PanoProjectPackageStyle> getPPPSSelect(Long house_style_sn);
public int getdelete(PanoProjectHousePackage sns);
public List<PanoProjectPackage> getselect();
public Long getinsert(PanoProjectPackageStyle pano); //套餐增加
public List<PanoProjectPackageStyle> getselects(PanoProjectPackageStyle pano); // 查询户型风格SN
public Long getinserts(PanoProjectHousePackage pano);
public List<getListPano> getselect1(getListPano pano);
/**
* 查询套餐 风格 楼盘 户型 name
*/
public List<getListPano> getpackage(getListPano sn);
public List<PanoProjectHousePackage> getpackage2(Long house_style_sn);
public List<PanoProjectPackageStyle> getpackage1(PanoProjectPackageStyle sn);
public int getInsert1(PanoProjectHousePackage sn);
}
|
[
"[email protected]"
] | |
4143722185264be63979fcf6354275e7fed87b07
|
4239c53fa00ea8724d21c35011ddb3cc645241f2
|
/src/main/java/com/g11/questionmark/Controllers/QuestionController.java
|
e00869dfd761139bedb05d55991034df446fc326
|
[] |
no_license
|
JohananAP/QuestionMark
|
ff8187aad336b005c1aa63b2583dcef21b44a131
|
69d4223ce1f25dd7b25940316f48169db98cc6d2
|
refs/heads/master
| 2023-08-06T20:13:45.805030 | 2021-09-21T16:41:44 | 2021-09-21T16:41:44 | 408,278,806 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 6,235 |
java
|
package com.g11.questionmark.Controllers;
import com.g11.questionmark.Models.Answer;
import com.g11.questionmark.Models.Question;
import com.g11.questionmark.Models.User;
import com.g11.questionmark.Models.Vote;
import com.g11.questionmark.Services.AnswerService;
import com.g11.questionmark.Services.QuestionService;
import com.g11.questionmark.Services.VoteService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
@Controller
public class QuestionController {
QuestionService questionService = new QuestionService();
AnswerService answerService = new AnswerService();
VoteService voteService = new VoteService();
@RequestMapping("/question/{questionId}")
public String renderQuestionPage(@PathVariable(name = "questionId") String questionId, Model model, HttpServletRequest httpServletRequest) {
HttpSession httpSession = httpServletRequest.getSession();
if (httpSession == null || httpSession.getAttribute("userId") == null) {
User user = new User();
model.addAttribute("user", user);
return "login";
}
Question question = questionService.getQuestionDetails(questionId);
if (question != null) {
Answer answer = new Answer();
Vote vote = new Vote();
answer.setQuestionId(question.getQuestionId());
vote.setEntityId(question.getQuestionId());
model.addAttribute("question", question);
model.addAttribute("answer", answer);
model.addAttribute("answers", answerService.getAllAnswersOfQuestion(Integer.parseInt(questionId)));
return "question";
}
return "errorPage";
}
@RequestMapping(value = "/submitAnswer", method = RequestMethod.POST)
public String submitAnswer(@ModelAttribute("answer") Answer answer, Model model, HttpServletRequest httpServletRequest) {
HttpSession httpSession = httpServletRequest.getSession();
if (httpSession == null || httpSession.getAttribute("userId") == null) {
User user = new User();
model.addAttribute("user", user);
return "login";
}
Integer userId = (Integer) httpSession.getAttribute("userId");
if (answerService.submitAnswer(answer, userId)) {
return "redirect:/question/"+answer.getQuestionId();
}
return "errorPage";
}
@RequestMapping(value = "/questionVote/{questionId}", method = RequestMethod.POST, params="action=up")
public String questionUpVote(@PathVariable(name = "questionId") String questionId, Model model, HttpServletRequest httpServletRequest) {
HttpSession httpSession = httpServletRequest.getSession();
if (httpSession == null || httpSession.getAttribute("userId") == null) {
User user = new User();
model.addAttribute("usesr", user);
return "login";
}
Integer userId = (Integer) httpSession.getAttribute("userId");
Vote vote = new Vote();
vote.setEntityId(Integer.parseInt(questionId));
vote.setVote("UP");
vote.setEntity("questions");
if (voteService.upVote(vote, userId)) {
return "redirect:/question/"+questionId;
}
return "errorPage";
}
@RequestMapping(value = "/questionVote/{questionId}", method = RequestMethod.POST, params="action=down")
public String questionDownVote(@PathVariable(name = "questionId") String questionId, Model model, HttpServletRequest httpServletRequest) {
HttpSession httpSession = httpServletRequest.getSession();
if (httpSession == null || httpSession.getAttribute("userId") == null) {
User user = new User();
model.addAttribute("user", user);
return "login";
}
Integer userId = (Integer) httpSession.getAttribute("userId");
Vote vote = new Vote();
vote.setEntityId(Integer.parseInt(questionId));
vote.setVote("DOWN");
vote.setEntity("questions");
if (voteService.downVote(vote, userId)) {
return "redirect:/question/"+questionId;
}
return "errorPage";
}
@RequestMapping(value = "/answerVote/{questionId}/{answerId}", method = RequestMethod.POST, params="action=up")
public String answerUpVote(@PathVariable(name = "questionId") String questionId, @PathVariable(name = "answerId") String answerId, Model model, HttpServletRequest httpServletRequest) {
HttpSession httpSession = httpServletRequest.getSession();
if (httpSession == null || httpSession.getAttribute("userId") == null) {
User user = new User();
model.addAttribute("user", user);
return "login";
}
Integer userId = (Integer) httpSession.getAttribute("userId");
Vote vote = new Vote();
vote.setEntityId(Integer.parseInt(answerId));
vote.setVote("UP");
vote.setEntity("answers");
if (voteService.upVote(vote, userId)) {
return "redirect:/question/"+questionId;
}
return "errorPage";
}
@RequestMapping(value = "/answerVote/{questionId}/{answerId}", method = RequestMethod.POST, params="action=down")
public String answerDownVote(@PathVariable(name = "questionId") String questionId, @PathVariable(name = "answerId") String answerId, Model model, HttpServletRequest httpServletRequest) {
HttpSession httpSession = httpServletRequest.getSession();
if (httpSession == null || httpSession.getAttribute("userId") == null) {
User user = new User();
model.addAttribute("user", user);
return "login";
}
Integer userId = (Integer) httpSession.getAttribute("userId");
Vote vote = new Vote();
vote.setEntityId(Integer.parseInt(answerId));
vote.setVote("DOWN");
vote.setEntity("answers");
if (voteService.downVote(vote, userId)) {
return "redirect:/question/"+questionId;
}
return "errorPage";
}
}
|
[
"[email protected]"
] | |
bfe311a686e8c93d7bb84cec5e96faa62cd26ad2
|
91e6a9f9b842eb910dd9120e7dde5db1d0e74048
|
/src/sk/itsovy/ganoczi/sudokusolver/Game.java
|
9b8a01c6b3b653c9dfa8e2a789411ef0d51de0f6
|
[] |
no_license
|
PeterGanoczi/SudokuSolver
|
99e24caacd51248164f6b4ffc292edf8f4105e4e
|
78d3121771a2eddf656372f297eb7b16959f7d10
|
refs/heads/master
| 2022-12-23T12:08:13.711630 | 2020-09-29T22:27:51 | 2020-09-29T22:27:51 | 299,438,849 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 548 |
java
|
package sk.itsovy.ganoczi.sudokusolver;
import sk.itsovy.ganoczi.sudokusolver.model.Board;
public class Game {
private Board board;
private boolean state;
public Game(Board board, boolean state) {
this.board = board;
this.state = state;
}
public Board getBoard() {
return board;
}
public void setBoard(Board board) {
this.board = board;
}
public boolean isState() {
return state;
}
public void setState(boolean state) {
this.state = state;
}
}
|
[
"[email protected]"
] | |
0a522ba55710026fcfc864d1b706ed6b9f88cca0
|
51198c09bca0cd715e36bbe3217c54ef2ef84d26
|
/src/main/java/com/ebolotina/trianglearea/Triangle.java
|
e5f4c8a541bfc8a7300a477d27edce5934172236
|
[] |
no_license
|
Elissbett/trianglearea
|
0c68ce13ef4ad1ef2fa4c7ddcbc2d0f7af5e28ed
|
94dd495d3e1c378a32c0a2c4ca5c262ac490d479
|
refs/heads/master
| 2020-08-21T10:03:36.567295 | 2019-10-19T02:28:31 | 2019-10-19T02:28:31 | 216,136,481 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,100 |
java
|
package com.ebolotina.trianglearea;
public class Triangle {
private final Point a;
private final Point b;
private final Point c;
private Double area;
public Triangle(Point a, Point b, Point c) {
this.a = a;
this.b = b;
this.c = c;
}
public double area() {
if (area == null) {
area = 1.0 / 2 * Math.abs((a.x - c.x) * (b.y - c.y) - (b.x - c.x) * (a.y - c.y));
}
return area;
}
public boolean isIsosceles() {
final double ab = length(a, b);
final double bc = length(c, b);
final double ac = length(a, c);
return sidesEquals(ab, bc) || sidesEquals(ac, bc) || sidesEquals(ab, ac);
}
@Override
public String toString() {
return a.x + " " + a.y + " " + b.x + " " + b.y + " " + c.x + " " + c.y;
}
private double length(Point a, Point b) {
return Math.sqrt(Math.pow(a.x - b.x, 2) + Math.pow(a.y - b.y, 2));
}
private boolean sidesEquals(double first, double second) {
return Math.abs(first - second) < 0.00001;
}
}
|
[
"[email protected]"
] | |
73bf77ed0321d6e745af1aec84c5a50a61dfb9e4
|
dca48bb5af970a6e247640dc68d7fdc26a9ae2b0
|
/src/main/java/com/spring/mvc/psi/entities/Product.java
|
0b6edb9913d9ddd55c24364c99eaeaac20b6ed8a
|
[] |
no_license
|
vincenttuan/SpringData1102
|
8ac00838f51de585115ac184498d54b33b0574b4
|
2139027e2959d1fb0c4a557eb494c88f4f69b8a6
|
refs/heads/master
| 2023-02-12T14:49:13.685911 | 2021-01-08T13:41:17 | 2021-01-08T13:41:17 | 324,987,944 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,684 |
java
|
package com.spring.mvc.psi.entities;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.OneToMany;
import javax.persistence.Table;
@Entity
@Table(name = "PRODUCT")
public class Product {
@Id
@GeneratedValue
private Integer id;
@Column(name = "name", nullable = false, length = 50)
private String name;
@Column(name = "image", columnDefinition = "clob") // clob 大字串, blob 大二進位
@Lob
private String image; // base64 String for image
@OneToMany(mappedBy = "product")
private List<Purchase> purchases = new ArrayList<>();
@OneToMany(mappedBy = "product")
private List<Sales> saleses = new ArrayList<>();
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
public List<Purchase> getPurchases() {
return purchases;
}
public void setPurchases(List<Purchase> purchases) {
this.purchases = purchases;
}
public List<Sales> getSaleses() {
return saleses;
}
public void setSaleses(List<Sales> saleses) {
this.saleses = saleses;
}
}
|
[
"[email protected]"
] | |
d3c14de511f0a83c3034c2f41bfdea2f568694d7
|
338328bc06567d54ef2052a0a38bf6dbe0109506
|
/shells/ca-dbtool-shell/src/main/java/org/xipki/ca/dbtool/shell/ImportOcspCmd.java
|
b588d5e53aea9908250e8f64f6c4942befd74fec
|
[
"Apache-2.0"
] |
permissive
|
karymei/xipki
|
bd519579936d2a78d9ba461fccb61da2bcf2d056
|
7582ca7b205ee95c1820cc65eac1e7cea23b95c5
|
refs/heads/master
| 2021-09-04T02:41:32.311989 | 2018-01-14T20:09:24 | 2018-01-14T20:09:24 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,315 |
java
|
/*
*
* Copyright (c) 2013 - 2018 Lijun Liao
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.xipki.ca.dbtool.shell;
import org.apache.karaf.shell.api.action.Command;
import org.apache.karaf.shell.api.action.Completion;
import org.apache.karaf.shell.api.action.Option;
import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.xipki.ca.dbtool.port.DbPortWorker;
import org.xipki.ca.dbtool.port.ocsp.OcspDbImportWorker;
import org.xipki.console.karaf.completer.DirPathCompleter;
import org.xipki.console.karaf.completer.FilePathCompleter;
/**
* @author Lijun Liao
* @since 2.0.0
*/
@Command(scope = "ca", name = "import-ocsp",
description = "import OCSP database")
@Service
public class ImportOcspCmd extends DbPortAction {
private static final String DFLT_DBCONF_FILE = "xipki/ca-config/ocsp-db.properties";
@Option(name = "--db-conf",
description = "database configuration file")
@Completion(FilePathCompleter.class)
private String dbconfFile = DFLT_DBCONF_FILE;
@Option(name = "--in-dir", required = true,
description = "input directory\n(required)")
@Completion(DirPathCompleter.class)
private String indir;
@Option(name = "-k",
description = "number of certificates per commit")
private Integer numCertsPerCommit = 100;
@Option(name = "--resume")
private Boolean resume = Boolean.FALSE;
@Option(name = "--test",
description = "just test the import, no real import")
private Boolean testOnly = Boolean.FALSE;
@Override
protected DbPortWorker getDbPortWorker() throws Exception {
return new OcspDbImportWorker(datasourceFactory, passwordResolver, dbconfFile, resume,
indir, numCertsPerCommit.intValue(), testOnly);
}
}
|
[
"[email protected]"
] | |
d4638d6046742e67a2be9ddf96d91e78a7485e28
|
9a4e9b75faaa75ec028fe3ffaba9947da45f37a3
|
/src/main/java/rest/security/WebSecurity.java
|
a8af7b65602a7dc798dbd3fcdca7347902b179f9
|
[] |
no_license
|
developer-java/rest
|
57aba4830da040d844bf92c1b29f1291c8c138a5
|
ac541573a464f6a0880175e692cc87bc59531f9a
|
refs/heads/master
| 2020-03-21T11:03:13.652560 | 2018-06-24T12:52:02 | 2018-06-24T12:52:02 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,287 |
java
|
package rest.security;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.CorsConfigurationSource;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import static rest.security.SecurityUtils.SIGN_UP_URL;
@Configuration
@EnableWebSecurity
public class WebSecurity extends WebSecurityConfigurerAdapter {
private UserDetailsService userDetailsService;
public WebSecurity(UserDetailsService userDetailsService) {
this.userDetailsService = userDetailsService;
}
@Bean
public BCryptPasswordEncoder bCryptPasswordEncoder() {
return new BCryptPasswordEncoder();
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.cors().and().csrf().disable().authorizeRequests()
.antMatchers(HttpMethod.POST, SIGN_UP_URL).permitAll()
.anyRequest().authenticated()
.and()
.addFilter(new JWTAuthenticationFilter(authenticationManager()))
.addFilter(new JWTAuthorizationFilter(authenticationManager()));
}
@Override
public void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(userDetailsService).passwordEncoder(bCryptPasswordEncoder());
}
@Bean
CorsConfigurationSource corsConfigurationSource() {
final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
source.registerCorsConfiguration("/**", new CorsConfiguration().applyPermitDefaultValues());
return source;
}
}
|
[
"[email protected]"
] | |
9a2cad87db8b15dbdd10c78199194e671be1dc4f
|
3d8270c9e16d8fdd79f20d6ca82a67c7c500e421
|
/src/FirstUniqueCharacterInString.java
|
3d6839df0fe170ff1bf3db2e0568d2132dd084ab
|
[] |
no_license
|
PayalSainathMehta/August-Leetcode-Challenge
|
51bdfe2929c2fdca14faa1541247a10595ba8b37
|
964fa59d8c34d364b380b57b37cbe824825593e0
|
refs/heads/master
| 2022-12-08T15:46:41.165166 | 2020-09-01T14:57:37 | 2020-09-01T14:57:37 | 284,311,508 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 879 |
java
|
import java.util.HashMap;
import java.util.Map;
public class FirstUniqueCharacterInString {
public static int firstUniqChar(String s) {
if(s.length() == 0 || s == null)
return -1;
Map<Character, Integer> map = new HashMap<>();
for(int i = 0; i < s.length(); i++){
char current = s.charAt(i);
if(!map.containsKey(current))
map.put(current, i); //add index
else
map.put(current, -1); //invalidate
}
int min = Integer.MAX_VALUE;
for(char c: map.keySet()){
if(map.get(c) > -1 && map.get(c) < min)
min = map.get(c);
}
return min == Integer.MAX_VALUE ? -1 : min;
}
public static void main(String[] args) {
String s = "loveleetcode";
System.out.println(firstUniqChar(s));
}
}
|
[
"[email protected]"
] | |
4bb7b0fd99632245ddc625c23fb12d2ff325b741
|
aff0e7a38692eaccda0e611a8d00bfe1122b2556
|
/source/kom-manager-service/src/test/java/com/transsion/store/test/manager/TestVisitModelSettingManager.java
|
ae2d217a902af0443faf0619070e5b749c6c4e94
|
[] |
no_license
|
ESSE-xiaogui/kom_manager_new
|
15d04ec850ca822661a4480c93b28e51894470cb
|
56d2b9403fb4caaf9c81cc14d6dd2298d3ad9b96
|
refs/heads/master
| 2021-01-22T22:39:06.987671 | 2017-03-20T09:36:13 | 2017-03-20T09:36:13 | 85,556,395 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,214 |
java
|
package com.transsion.store.test.manager;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import com.shangkang.core.exception.ServiceException;
import com.transsion.store.context.UserContext;
import com.transsion.store.dto.VisitModelSettingListDto;
import com.transsion.store.manager.VisitModeSettingManager;
import com.transsion.store.test.base.GenericTestCase;
/**
* @author guihua.zhang on 2017-03-14
* */
public class TestVisitModelSettingManager extends GenericTestCase{
private VisitModeSettingManager visitModeSettingManager;
private UserContext userContext;
@Before
protected void setUp() throws Exception {
super.setUp();
visitModeSettingManager = this.getBean("visitModeSettingManager");
userContext = this.getUserContext("NG0238", "123456");
}
//根据城市ID和当月时间查询所有重点机型
@Test
public void testFindVisitModel() throws ServiceException{
Long cityId=51L;
String currentDate="2017-02-01";
List<VisitModelSettingListDto> list = visitModeSettingManager.findVisitModel(userContext.getToken(), cityId, currentDate);
System.out.println(list);
}
}
|
[
"[email protected]"
] | |
9885f69e66728b93cd594c57a15935303168d5ce
|
21ffaadaee5e9f76e85c53997cdde13b62eadda6
|
/examples-advanced-ignite-indexing/src/main/java/com/hawkore/ignite/examples/entities/person2/Person.java
|
09d1c4b2c2363e849a44143cb9120cc871290d4e
|
[] |
no_license
|
hawkore/examples-apache-ignite-extensions
|
909dfe6efc31b32802efb867dd22d5f139a998e3
|
1282664ebe06a717568d68f877e6fafd578e86e8
|
refs/heads/master
| 2022-06-17T13:39:13.743555 | 2022-06-08T15:00:10 | 2022-06-08T15:00:10 | 164,684,029 | 1 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 5,617 |
java
|
/*
* Copyright (C) 2018 HAWKORE S.L. (http://hawkore.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hawkore.ignite.examples.entities.person2;
import org.apache.ignite.cache.query.annotations.QuerySqlField;
import org.apache.ignite.cache.query.annotations.QueryTextField;
import org.apache.ignite.cache.query.annotations.QueryTextField.BooleanMapper;
import org.apache.ignite.cache.query.annotations.QueryTextField.DateMapper;
import org.apache.ignite.cache.query.annotations.QueryTextField.DateRangeMapper;
import org.apache.ignite.cache.query.annotations.QueryTextField.GeoPointMapper;
import org.apache.ignite.cache.query.annotations.QueryTextField.IndexOptions;
import org.apache.ignite.cache.query.annotations.QueryTextField.IntegerMapper;
import org.apache.ignite.cache.query.annotations.QueryTextField.SnowballAnalyzer;
import org.apache.ignite.cache.query.annotations.QueryTextField.StringMapper;
import org.apache.ignite.cache.query.annotations.QueryTextField.TextMapper;
/**
* Person for Annotation Based Configuration
*
* @author Manuel Núñez ([email protected])
*
*/
@QueryTextField(
// Index configuration
indexOptions = @IndexOptions(refreshSeconds = 60, partitions = 10, ramBufferMB = 10, defaultAnalyzer = "english", snowballAnalyzers = {
@SnowballAnalyzer(name = "my_custom_analyzer", language = "Spanish", stopwords = "el,la,lo,loas,las,a,ante,bajo,cabe,con,contra")
}),
// this will create an additional field named "place" into Lucene Document
// that will be indexed
geoPointMappers = @GeoPointMapper(name = "place", latitude = "latitude", longitude = "longitude"),
// this will create an additional field named "duration" into Lucene
// Document
// that will be indexed
dateRangeMappers = @DateRangeMapper(name = "duration", from = "start_date", to = "stop_date", pattern = "yyyy/MM/dd")
)
public class Person {
@QuerySqlField(index = true)
@QueryTextField(stringMappers = @StringMapper)
private String food;
@QuerySqlField
private float latitude;
@QuerySqlField
private float longitude;
@QueryTextField(integerMappers = @IntegerMapper)
private int number;
@QueryTextField(booleanMappers = @BooleanMapper)
private boolean bool;
@QuerySqlField
@QueryTextField(textMappers = @TextMapper(analyzer = "my_custom_analyzer"))
private String phrase;
@QueryTextField(dateMappers = @DateMapper(validated = true, pattern = "yyyy/MM/dd"))
private String date;
@QuerySqlField(name = "start_date")
private String startDate;
@QuerySqlField(name = "stop_date")
private String stopDate;
/**
*
*/
public Person() {
// default constructor
}
/**
* @return the food
*/
public String getFood() {
return food;
}
/**
* @param food
* the food to set
*/
public void setFood(String food) {
this.food = food;
}
/**
* @return the latitude
*/
public float getLatitude() {
return latitude;
}
/**
* @param latitude
* the latitude to set
*/
public void setLatitude(float latitude) {
this.latitude = latitude;
}
/**
* @return the longitude
*/
public float getLongitude() {
return longitude;
}
/**
* @param longitude
* the longitude to set
*/
public void setLongitude(float longitude) {
this.longitude = longitude;
}
/**
* @return the number
*/
public int getNumber() {
return number;
}
/**
* @param number
* the number to set
*/
public void setNumber(int number) {
this.number = number;
}
/**
* @return the bool
*/
public boolean isBool() {
return bool;
}
/**
* @param bool
* the bool to set
*/
public void setBool(boolean bool) {
this.bool = bool;
}
/**
* @return the phrase
*/
public String getPhrase() {
return phrase;
}
/**
* @param phrase
* the phrase to set
*/
public void setPhrase(String phrase) {
this.phrase = phrase;
}
/**
* @return the date
*/
public String getDate() {
return date;
}
/**
* @param date
* the date to set
*/
public void setDate(String date) {
this.date = date;
}
/**
* @return the startDate
*/
public String getStartDate() {
return startDate;
}
/**
* @param startDate
* the startDate to set
*/
public void setStartDate(String startDate) {
this.startDate = startDate;
}
/**
* @return the stopDate
*/
public String getStopDate() {
return stopDate;
}
/**
* @param stopDate
* the stopDate to set
*/
public void setStopDate(String stopDate) {
this.stopDate = stopDate;
}
}
|
[
"[email protected]"
] | |
aa797e6956ad9fd06d70de606514ed4f136e1ff4
|
ed34528fc9940e31973da65f307c01ee6da4ec43
|
/src/main/java/ch/hfict/model/Address.java
|
edd069d3506b1bb31a1cc87bba01c9cb8fe5bd82
|
[] |
no_license
|
oguzCoel/Flyway
|
1ee8f6efef325a7cf67093d0186d59f4bf7f205b
|
2ea96dc9b856c00ce50be56c4efebcaacf15cfe3
|
refs/heads/master
| 2016-09-06T04:00:10.385593 | 2014-12-08T22:40:44 | 2014-12-08T22:40:44 | 27,737,710 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,396 |
java
|
package ch.hfict.model;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import java.io.Serializable;
import org.hibernate.search.annotations.Analyze;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Indexed;
/**
* This class is used to represent an address with address,
* city, province and postal-code information.
*
* @author <a href="mailto:[email protected]">Matt Raible</a>
*/
@Embeddable
@Indexed
public class Address extends BaseObject implements Serializable {
private static final long serialVersionUID = 3617859655330969141L;
private String address;
private String city;
private String province;
private String country;
private String postalCode;
@Column(length = 150)
@Field
public String getAddress() {
return address;
}
@Column(length = 50)
@Field
public String getCity() {
return city;
}
@Column(length = 100)
@Field
public String getProvince() {
return province;
}
@Column(length = 100)
@Field
public String getCountry() {
return country;
}
@Column(name = "postal_code", length = 15)
@Field(analyze= Analyze.NO)
public String getPostalCode() {
return postalCode;
}
public void setAddress(String address) {
this.address = address;
}
public void setCity(String city) {
this.city = city;
}
public void setCountry(String country) {
this.country = country;
}
public void setPostalCode(String postalCode) {
this.postalCode = postalCode;
}
public void setProvince(String province) {
this.province = province;
}
/**
* Overridden equals method for object comparison. Compares based on hashCode.
*
* @param o Object to compare
* @return true/false based on hashCode
*/
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof Address)) {
return false;
}
final Address address1 = (Address) o;
return this.hashCode() == address1.hashCode();
}
/**
* Overridden hashCode method - compares on address, city, province, country and postal code.
*
* @return hashCode
*/
public int hashCode() {
int result;
result = (address != null ? address.hashCode() : 0);
result = 29 * result + (city != null ? city.hashCode() : 0);
result = 29 * result + (province != null ? province.hashCode() : 0);
result = 29 * result + (country != null ? country.hashCode() : 0);
result = 29 * result + (postalCode != null ? postalCode.hashCode() : 0);
return result;
}
/**
* Returns a multi-line String with key=value pairs.
*
* @return a String representation of this class.
*/
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("country", this.country)
.append("address", this.address)
.append("province", this.province)
.append("postalCode", this.postalCode)
.append("city", this.city).toString();
}
}
|
[
"[email protected]"
] | |
ffbe144d1de865c2e65c4ca96ca4841f506112b8
|
21236b35ff5b108a5862527da31a324149d717a3
|
/src/test/java/dev/infrastructr/deck/api/controllers/InventoryControllerTest.java
|
614a801f7e2550f915b0ffc45db0b987e8fe9e34
|
[
"MIT"
] |
permissive
|
infrastructr/deck-api
|
c0bb0acc3d06683acb98e26eb0a6055065952f6a
|
7ff57719679b69f92c9e9ec2fbda25180790d7ae
|
refs/heads/master
| 2022-10-02T11:04:10.854969 | 2020-05-25T21:24:34 | 2020-05-25T21:24:34 | 245,249,537 | 0 | 0 |
MIT
| 2022-09-08T01:06:24 | 2020-03-05T19:25:17 |
Java
|
UTF-8
|
Java
| false | false | 5,635 |
java
|
package dev.infrastructr.deck.api.controllers;
import dev.infrastructr.deck.ContextCleaner;
import dev.infrastructr.deck.WebTestBase;
import dev.infrastructr.deck.api.actions.InventoryActions;
import dev.infrastructr.deck.api.actions.ProjectActions;
import dev.infrastructr.deck.api.entities.Inventory;
import dev.infrastructr.deck.api.entities.Project;
import dev.infrastructr.deck.api.models.TestContext;
import dev.infrastructr.deck.api.requests.CreateHostRequest;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import static dev.infrastructr.deck.api.builders.CreateHostRequestBuilder.createHostRequest;
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.springframework.http.HttpStatus.OK;
public class InventoryControllerTest extends WebTestBase {
@Autowired
private ProjectActions projectActions;
@Autowired
private InventoryActions inventoryActions;
@Autowired
private ContextCleaner contextCleaner;
@Test
public void shouldCreate(){
TestContext context = new TestContext();
Project project = projectActions.create(context);
CreateHostRequest request = createHostRequest()
.withInventoryId(project.getId())
.build();
given(documentationSpec)
.filter(getDocument("inventory-create"))
.cookie(context.getCookie())
.body(request)
.contentType("application/json")
.when()
.post("/projects/{projectId}/inventories", project.getId())
.then()
.assertThat()
.statusCode(is(OK.value()))
.and()
.body("id", is(notNullValue()))
.body("name", is(request.getName()))
.body("description", is(request.getDescription()));
contextCleaner.clean(context);
}
@Test
public void shouldGetByProjectId(){
TestContext context = new TestContext();
Inventory inventory = inventoryActions.create(context);
Project project = context.getProjects().get(0);
given(documentationSpec)
.filter(getDocument("inventory-get-by-project-id"))
.cookie(context.getCookie())
.contentType("application/json")
.when()
.get("/projects/{projectId}/inventories", project.getId())
.then()
.assertThat()
.statusCode(is(OK.value()))
.and()
.body("content[0].id", is(inventory.getId().toString()))
.body("content[0].name", is(inventory.getName()))
.body("content[0].description", is(inventory.getDescription()));
contextCleaner.clean(context);
}
@Test
public void shouldGetFilteredByProjectId(){
TestContext context = new TestContext();
Inventory inventory = inventoryActions.create(context);
Project project = context.getProjects().get(0);
given(documentationSpec)
.filter(getDocument("inventory-get-filtered"))
.cookie(context.getCookie())
.contentType("application/json")
.when()
.get("/projects/{projectId}/inventories?filter={filter}", project.getId(), inventory.getName())
.then()
.assertThat()
.statusCode(is(OK.value()))
.and()
.body("content[0].id", is(inventory.getId().toString()))
.body("content[0].name", is(inventory.getName()))
.body("content[0].description", is(inventory.getDescription()));
contextCleaner.clean(context);
}
@Test
public void shouldGetOnePerPageSortedByProjectId(){
TestContext context = new TestContext();
Project project = projectActions.create(context);
Inventory inventory = inventoryActions.create(context, project.getId());
Inventory anotherInventory = inventoryActions.create(context, project.getId());
String sort = "name,desc";
Inventory expectedInventory = inventory.getName().compareTo(anotherInventory.getName()) > 0
? inventory
: anotherInventory;
given(documentationSpec)
.filter(getDocument("inventory-get-by-project-id"))
.cookie(context.getCookie())
.contentType("application/json")
.when()
.get("/projects/{projectId}/inventories?page=0&size=1&sort={sort}", project.getId(), sort)
.then()
.assertThat()
.statusCode(is(OK.value()))
.and()
.body("content[0].id", is(expectedInventory.getId().toString()))
.body("content[0].name", is(expectedInventory.getName()))
.body("content[0].description", is(expectedInventory.getDescription()));
contextCleaner.clean(context);
}
@Test
public void shouldGetById(){
TestContext context = new TestContext();
Inventory inventory = inventoryActions.create(context);
given(documentationSpec)
.filter(getDocument("inventory-get-by-id"))
.cookie(context.getCookie())
.contentType("application/json")
.when()
.get("/inventories/{inventoryId}", inventory.getId())
.then()
.assertThat()
.statusCode(is(OK.value()))
.and()
.body("id", is(inventory.getId().toString()))
.body("name", is(inventory.getName()))
.body("description", is(inventory.getDescription()));
contextCleaner.clean(context);
}
}
|
[
"[email protected]"
] | |
8b7e3d1160c0b746749ac5b14ac1f8dab890620e
|
d0ddb5f21fb71cfbd49706282d86a582d2df5555
|
/src/main/java/com/example/demo/exception/MatchDateNotFoundException.java
|
69c0640f13f1761815ee5ae36147755954818264
|
[] |
no_license
|
ryzenboi98/nba-stats
|
bec7cf038ecf8c564dae4cf2e4e5eab3ebb4f4bf
|
3c64a14457bda115b03bccf4e8a1d7c54e97b0bd
|
refs/heads/master
| 2023-01-09T00:38:03.307784 | 2020-11-04T19:57:29 | 2020-11-04T19:57:29 | 304,427,910 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 158 |
java
|
package com.example.demo.exception;
public class MatchDateNotFoundException extends RuntimeException{
private static final long serialVersionUID = 1L;
}
|
[
"[email protected]"
] | |
dc459114b9a78375618606ac09621bcbd91e47cb
|
993ef76e5663bf762d7aa045035ff14401bd6b4b
|
/src/main/java/com/adobe/cq/commerce/magento/graphql/MediaGalleryEntryQuery.java
|
3cbc2c65ede33f32a81528b2925ca5b04af8c264
|
[
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
Bounteous-Inc/commerce-cif-magento-graphql
|
c8983f0120371a3175e265b9e44c3e0ac99eed2f
|
5b97904d436e10702bca7e8289e500b95759f879
|
refs/heads/master
| 2020-12-18T17:00:27.341576 | 2019-10-18T09:53:31 | 2019-10-18T09:53:31 | 235,463,116 | 0 | 0 | null | 2020-01-21T23:41:01 | 2020-01-21T23:41:01 | null |
UTF-8
|
Java
| false | false | 3,244 |
java
|
/*******************************************************************************
*
* Copyright 2019 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*
******************************************************************************/
package com.adobe.cq.commerce.magento.graphql;
import com.shopify.graphql.support.AbstractQuery;
/**
* MediaGalleryEntry defines characteristics about images and videos associated with a specific
* product.
*/
public class MediaGalleryEntryQuery extends AbstractQuery<MediaGalleryEntryQuery> {
MediaGalleryEntryQuery(StringBuilder _queryBuilder) {
super(_queryBuilder);
}
/**
* Contains a ProductMediaGalleryEntriesContent object.
*/
public MediaGalleryEntryQuery content(ProductMediaGalleryEntriesContentQueryDefinition queryDef) {
startField("content");
_queryBuilder.append('{');
queryDef.define(new ProductMediaGalleryEntriesContentQuery(_queryBuilder));
_queryBuilder.append('}');
return this;
}
/**
* Whether the image is hidden from vie.
*/
public MediaGalleryEntryQuery disabled() {
startField("disabled");
return this;
}
/**
* The path of the image on the server.
*/
public MediaGalleryEntryQuery file() {
startField("file");
return this;
}
/**
* The identifier assigned to the object.
*/
public MediaGalleryEntryQuery id() {
startField("id");
return this;
}
/**
* The alt text displayed on the UI when the user points to the image.
*/
public MediaGalleryEntryQuery label() {
startField("label");
return this;
}
/**
* image or video.
*/
public MediaGalleryEntryQuery mediaType() {
startField("media_type");
return this;
}
/**
* The media item's position after it has been sorted.
*/
public MediaGalleryEntryQuery position() {
startField("position");
return this;
}
/**
* Array of image types. It can have the following values: image, small_image, thumbnail.
*/
public MediaGalleryEntryQuery types() {
startField("types");
return this;
}
/**
* Contains a ProductMediaGalleryEntriesVideoContent object.
*/
public MediaGalleryEntryQuery videoContent(ProductMediaGalleryEntriesVideoContentQueryDefinition queryDef) {
startField("video_content");
_queryBuilder.append('{');
queryDef.define(new ProductMediaGalleryEntriesVideoContentQuery(_queryBuilder));
_queryBuilder.append('}');
return this;
}
}
|
[
"[email protected]"
] | |
8a0032b5664960846553d9a271bc7d1e59a35a4d
|
6d0d7083047e141e2507101f62cd4e184d86fad6
|
/CIS551Proj4/src/cis551proj4/TransException.java
|
5ea016b1bc719c3c2368a265703338b04f8c20d8
|
[] |
no_license
|
RafaUresti/sxyjava
|
01d8e9ca1c25240064a73c2037160c018e56010f
|
47b29d32545a995e579565e5e23f8d4f5c7d10e8
|
refs/heads/master
| 2021-01-10T16:07:19.076388 | 2010-07-25T20:15:40 | 2010-07-25T20:15:40 | 47,238,268 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 181 |
java
|
package cis551proj4;
public class TransException extends Exception {
public static final long serialVersionUID = 331003;
public TransException(String s) {
super(s);
}
}
|
[
"sxycode@a54e21ba-c1fb-68c1-60e3-a40b99c34a01"
] |
sxycode@a54e21ba-c1fb-68c1-60e3-a40b99c34a01
|
04f7f11a1d2add0e13dab54e99886603f43e9dfd
|
ab30df4b1585692472d32a9cbcf6c8ae107dc9a7
|
/generated-test-cases/MessageFormatter/12-run/MOSA_MessageFormatter_ESTest.java
|
fc9af57e6131e1f52cd0c2bf3a85ab8b745ef04d
|
[
"Apache-2.0"
] |
permissive
|
fpalomba/issta16-test-code-quality-matters
|
8d87b51ce1ca8305cf9ff67b2eb71899cbfb7d46
|
b18697fb7f3ed77a8875d39c6b81a1afa82d7245
|
refs/heads/master
| 2020-12-24T21:27:40.669676 | 2016-04-22T21:38:36 | 2016-04-22T21:38:36 | 56,882,946 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 17,169 |
java
|
/*
* This file was automatically generated by EvoSuite
* Mon Dec 14 16:59:27 GMT 2015
*/
package com.lts.application.international;
import static org.junit.Assert.*;
import org.junit.Test;
import com.lts.application.ApplicationException;
import com.lts.application.international.MessageFormatter;
import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.evosuite.runtime.mock.java.lang.MockThrowable;
import org.evosuite.runtime.testdata.EvoSuiteFile;
import org.evosuite.runtime.testdata.EvoSuiteLocalAddress;
import org.evosuite.runtime.testdata.EvoSuiteRemoteAddress;
import org.evosuite.runtime.testdata.EvoSuiteURL;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true)
public class MessageFormatter_ESTest extends MessageFormatter_ESTest_scaffolding {
//Test case number: 0
/*
* 1 covered goal:
* Goal 1. com.lts.application.international.MessageFormatter.tryLoad(Ljava/lang/String;Ljava/lang/String;)Ljava/util/ResourceBundle;: I18 Branch 17 IFGT L485 - true
*/
@Test
public void test00() throws Throwable {
MessageFormatter messageFormatter0 = new MessageFormatter();
// Undeclared exception!
try {
ResourceBundle resourceBundle0 = messageFormatter0.tryLoad("", "j,kRT8gV00bd7@Rvy");
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
}
}
//Test case number: 1
/*
* 1 covered goal:
* Goal 1. com.lts.application.international.MessageFormatter.tryLoad(Ljava/lang/String;Ljava/lang/String;)Ljava/util/ResourceBundle;: I11 Branch 16 IF_ACMPEQ L485 - true
*/
@Test
public void test01() throws Throwable {
MessageFormatter messageFormatter0 = new MessageFormatter();
// Undeclared exception!
try {
ResourceBundle resourceBundle0 = messageFormatter0.tryLoad((String) null, "messages");
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
}
}
//Test case number: 2
/*
* 1 covered goal:
* Goal 1. com.lts.application.international.MessageFormatter.listToString(Ljava/util/List;)Ljava/lang/String;: I7 Branch 13 IF_ACMPNE L459 - false
*/
@Test
public void test02() throws Throwable {
MessageFormatter messageFormatter0 = new MessageFormatter();
String string0 = messageFormatter0.listToString((List<String>) null);
assertEquals("null", string0);
}
//Test case number: 3
/*
* 13 covered goals:
* Goal 1. com.lts.application.international.MessageFormatter.initializeResourceBundle(Ljava/util/List;Ljava/util/List;Ljava/util/Locale;Ljava/lang/ClassLoader;)V: I40 Branch 9 IF_ICMPGE L430 - false
* Goal 2. com.lts.application.international.MessageFormatter.addResourceBundles()V: I12 Branch 10 IFEQ L445 - true
* Goal 3. com.lts.application.international.MessageFormatter.addResourceBundles()V: I12 Branch 10 IFEQ L445 - false
* Goal 4. com.lts.application.international.MessageFormatter.addResourceBundles()V: I29 Branch 11 IFEQ L447 - true
* Goal 5. com.lts.application.international.MessageFormatter.addResourceBundles()V: I29 Branch 11 IFEQ L447 - false
* Goal 6. com.lts.application.international.MessageFormatter.addResourceBundles()V: I48 Branch 12 IF_ACMPEQ L450 - true
* Goal 7. com.lts.application.international.MessageFormatter.listToString(Ljava/util/List;)Ljava/lang/String;: I7 Branch 13 IF_ACMPNE L459 - true
* Goal 8. com.lts.application.international.MessageFormatter.listToString(Ljava/util/List;)Ljava/lang/String;: I33 Branch 14 IFEQ L465 - true
* Goal 9. com.lts.application.international.MessageFormatter.listToString(Ljava/util/List;)Ljava/lang/String;: I33 Branch 14 IFEQ L465 - false
* Goal 10. com.lts.application.international.MessageFormatter.listToString(Ljava/util/List;)Ljava/lang/String;: I44 Branch 15 IFEQ L467 - true
* Goal 11. com.lts.application.international.MessageFormatter.listToString(Ljava/util/List;)Ljava/lang/String;: I44 Branch 15 IFEQ L467 - false
* Goal 12. com.lts.application.international.MessageFormatter.tryLoad(Ljava/lang/String;Ljava/lang/String;)Ljava/util/ResourceBundle;: I11 Branch 16 IF_ACMPEQ L485 - false
* Goal 13. com.lts.application.international.MessageFormatter.tryLoad(Ljava/lang/String;Ljava/lang/String;)Ljava/util/ResourceBundle;: I18 Branch 17 IFGT L485 - false
*/
@Test
public void test03() throws Throwable {
MessageFormatter messageFormatter0 = new MessageFormatter();
List<String> list0 = ResourceBundle.Control.FORMAT_DEFAULT;
Locale locale0 = Locale.SIMPLIFIED_CHINESE;
ClassLoader classLoader0 = ClassLoader.getSystemClassLoader();
try {
messageFormatter0.initializeResourceBundle(list0, list0, locale0, classLoader0);
fail("Expecting exception: Exception");
} catch(Exception e) {
//
// Could not find any resource bundle give names: java.class, java.properties; and resource path: java.class, java.properties
//
}
}
//Test case number: 4
/*
* 1 covered goal:
* Goal 1. com.lts.application.international.MessageFormatter.getMessage(Ljava/lang/Throwable;)Ljava/lang/String;: I20 Branch 8 IFEQ L372 - false
*/
@Test
public void test04() throws Throwable {
MessageFormatter messageFormatter0 = new MessageFormatter();
MockThrowable mockThrowable0 = new MockThrowable();
ApplicationException applicationException0 = new ApplicationException((Throwable) mockThrowable0, "QiYZ$1QR>\tsiPEw", (Object) "QiYZ$1QR>\tsiPEw");
// Undeclared exception!
try {
String string0 = messageFormatter0.getMessage((Throwable) applicationException0);
fail("Expecting exception: RuntimeException");
} catch(RuntimeException e) {
//
// com.lts.application.ApplicationMessages.error.keyNotFound
//
}
}
//Test case number: 5
/*
* 1 covered goal:
* Goal 1. com.lts.application.international.MessageFormatter.getMessage(Ljava/lang/Throwable;)Ljava/lang/String;: I20 Branch 8 IFEQ L372 - true
*/
@Test
public void test05() throws Throwable {
MessageFormatter messageFormatter0 = new MessageFormatter();
MockThrowable mockThrowable0 = new MockThrowable("");
// Undeclared exception!
try {
String string0 = messageFormatter0.getMessage((Throwable) mockThrowable0);
fail("Expecting exception: RuntimeException");
} catch(RuntimeException e) {
//
// com.lts.application.ApplicationMessages.error.keyNotFound
//
}
}
//Test case number: 6
/*
* 1 covered goal:
* Goal 1. com.lts.application.international.MessageFormatter.formatMessage(Ljava/lang/String;[Ljava/lang/Object;Ljava/util/ResourceBundle;)Ljava/lang/String;: I16 Branch 4 IF_ACMPNE L277 - false
*/
@Test
public void test06() throws Throwable {
MessageFormatter messageFormatter0 = new MessageFormatter();
// Undeclared exception!
try {
String string0 = messageFormatter0.formatMessage((String) null, (Object[]) null, (ResourceBundle) null);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
}
}
//Test case number: 7
/*
* 4 covered goals:
* Goal 1. com.lts.application.international.MessageFormatter.buildList([Ljava/lang/Object;)Ljava/util/List;: I13 Branch 1 IF_ACMPEQ L122 - false
* Goal 2. com.lts.application.international.MessageFormatter.buildList([Ljava/lang/Object;)Ljava/util/List;: I25 Branch 2 IF_ICMPGE L124 - true
* Goal 3. com.lts.application.international.MessageFormatter.buildList([Ljava/lang/Object;)Ljava/util/List;: I25 Branch 2 IF_ICMPGE L124 - false
* Goal 4. com.lts.application.international.MessageFormatter.createLoadException(Ljava/util/List;)Lcom/lts/application/ApplicationException;: I21 Branch 3 IFEQ L180 - false
*/
@Test
public void test07() throws Throwable {
MessageFormatter messageFormatter0 = new MessageFormatter();
Object[] objectArray0 = new Object[10];
List list0 = MessageFormatter.buildList(objectArray0);
// Undeclared exception!
try {
ApplicationException applicationException0 = messageFormatter0.createLoadException(list0);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
}
}
//Test case number: 8
/*
* 1 covered goal:
* Goal 1. com.lts.application.international.MessageFormatter.buildList([Ljava/lang/Object;)Ljava/util/List;: I13 Branch 1 IF_ACMPEQ L122 - true
*/
@Test
public void test08() throws Throwable {
List list0 = MessageFormatter.buildList((Object[]) null);
assertEquals(0, list0.size());
}
//Test case number: 9
/*
* 1 covered goal:
* Goal 1. com.lts.application.international.MessageFormatter$LoadBundleError.<init>(Ljava/lang/String;Ljava/lang/Throwable;)V: root-Branch
*/
@Test
public void test09() throws Throwable {
MockThrowable mockThrowable0 = new MockThrowable();
ApplicationException applicationException0 = new ApplicationException((Throwable) mockThrowable0, "QiYZ$1QR>\tsiPEw", (Object) "QiYZ$1QR>\tsiPEw");
MessageFormatter.LoadBundleError messageFormatter_LoadBundleError0 = new MessageFormatter.LoadBundleError("QiYZ$1QR>\tsiPEw", (Throwable) applicationException0);
}
//Test case number: 10
/*
* 1 covered goal:
* Goal 1. com.lts.application.international.MessageFormatter.getMessage(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/String;: root-Branch
*/
@Test
public void test10() throws Throwable {
MessageFormatter messageFormatter0 = new MessageFormatter();
// Undeclared exception!
try {
String string0 = messageFormatter0.getMessage("", (Object) "", (Object) null);
fail("Expecting exception: RuntimeException");
} catch(RuntimeException e) {
//
// com.lts.application.ApplicationMessages.error.keyNotFound
//
}
}
//Test case number: 11
/*
* 1 covered goal:
* Goal 1. com.lts.application.international.MessageFormatter.initializeResourceBundle()V: root-Branch
*/
@Test
public void test11() throws Throwable {
MessageFormatter messageFormatter0 = new MessageFormatter();
messageFormatter0.initializeResourceBundle();
}
//Test case number: 12
/*
* 1 covered goal:
* Goal 1. com.lts.application.international.MessageFormatter.getMessage(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;: root-Branch
*/
@Test
public void test12() throws Throwable {
MessageFormatter messageFormatter0 = new MessageFormatter();
Object[] objectArray0 = new Object[5];
try {
String string0 = messageFormatter0.getMessage("", objectArray0);
fail("Expecting exception: RuntimeException");
} catch(RuntimeException e) {
//
// com.lts.application.ApplicationMessages.error.keyNotFound
//
}
}
//Test case number: 13
/*
* 2 covered goals:
* Goal 1. com.lts.application.international.MessageFormatter.loadCriticalBundles()Ljava/util/List;: root-Branch
* Goal 2. com.lts.application.international.MessageFormatter.createLoadException(Ljava/util/List;)Lcom/lts/application/ApplicationException;: I21 Branch 3 IFEQ L180 - true
*/
@Test
public void test13() throws Throwable {
MessageFormatter messageFormatter0 = new MessageFormatter();
List list0 = messageFormatter0.loadCriticalBundles();
ApplicationException applicationException0 = messageFormatter0.createLoadException(list0);
assertEquals("critical.com.lts.application.errors.resourceBundle.load", applicationException0.getKey());
}
//Test case number: 14
@Test
public void test14() throws Throwable {
MessageFormatter messageFormatter0 = new MessageFormatter();
// Undeclared exception!
try {
String string0 = messageFormatter0.getMessage("QpraM%:'tEOK <");
fail("Expecting exception: RuntimeException");
} catch(RuntimeException e) {
//
// com.lts.application.ApplicationMessages.error.keyNotFound
//
}
}
//Test case number: 15
/*
* 1 covered goal:
* Goal 1. com.lts.application.international.MessageFormatter.getLastException()Ljava/lang/Throwable;: root-Branch
*/
@Test
public void test15() throws Throwable {
MessageFormatter messageFormatter0 = new MessageFormatter();
Throwable throwable0 = messageFormatter0.getLastException();
assertNull(throwable0);
}
//Test case number: 16
/*
* 2 covered goals:
* Goal 1. com.lts.application.international.MessageFormatter.initializeResourceBundle(Ljava/util/List;Ljava/util/List;)V: root-Branch
* Goal 2. com.lts.application.international.MessageFormatter.initializeResourceBundle(Ljava/util/List;)V: root-Branch
*/
@Test
public void test16() throws Throwable {
MessageFormatter messageFormatter0 = new MessageFormatter();
// Undeclared exception!
try {
messageFormatter0.initializeResourceBundle((List<String>) null);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
}
}
//Test case number: 17
/*
* 1 covered goal:
* Goal 1. com.lts.application.international.MessageFormatter.temp()V: root-Branch
*/
@Test
public void test17() throws Throwable {
MessageFormatter messageFormatter0 = new MessageFormatter();
messageFormatter0.temp();
}
//Test case number: 18
/*
* 1 covered goal:
* Goal 1. com.lts.application.international.MessageFormatter.listResources(Ljava/lang/String;Ljava/lang/ClassLoader;)Ljava/util/List;: root-Branch
*/
@Test
public void test18() throws Throwable {
MessageFormatter messageFormatter0 = new MessageFormatter();
ClassLoader classLoader0 = ClassLoader.getSystemClassLoader();
List list0 = messageFormatter0.listResources("QiYZ$1QR>\tsiPEw", classLoader0);
assertEquals(0, list0.size());
}
//Test case number: 19
/*
* 4 covered goals:
* Goal 1. com.lts.application.international.MessageFormatter.addBundle(Ljava/util/ResourceBundle;)V: root-Branch
* Goal 2. com.lts.application.international.MessageFormatter.getMessage(Ljava/lang/String;)Ljava/lang/String;: root-Branch
* Goal 3. com.lts.application.international.MessageFormatter.formatMessage(Ljava/lang/String;[Ljava/lang/Object;Ljava/util/ResourceBundle;)Ljava/lang/String;: I16 Branch 4 IF_ACMPNE L277 - true
* Goal 4. com.lts.application.international.MessageFormatter.formatMessage(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;: I16 Branch 5 IFEQ L300 - false
*/
@Test
public void test19() throws Throwable {
MessageFormatter messageFormatter0 = new MessageFormatter();
messageFormatter0.addBundle((ResourceBundle) null);
// Undeclared exception!
try {
String string0 = messageFormatter0.getMessage("QpraM%:'tEOK <");
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
}
}
//Test case number: 20
/*
* 4 covered goals:
* Goal 1. com.lts.application.international.MessageFormatter.getMessage(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/String;: root-Branch
* Goal 2. com.lts.application.international.MessageFormatter.<init>()V: root-Branch
* Goal 3. com.lts.application.international.MessageFormatter.formatMessage(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;: I16 Branch 5 IFEQ L300 - true
* Goal 4. com.lts.application.international.MessageFormatter.formatMessage(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;: I55 Branch 7 IF_ACMPNE L307 - false
*/
@Test
public void test20() throws Throwable {
MessageFormatter messageFormatter0 = new MessageFormatter();
// Undeclared exception!
try {
String string0 = messageFormatter0.getMessage("", (Object) "", (Object) "", (Object) messageFormatter0);
fail("Expecting exception: RuntimeException");
} catch(RuntimeException e) {
//
// com.lts.application.ApplicationMessages.error.keyNotFound
//
}
}
}
|
[
"[email protected]"
] | |
119e3a866408a75401282b6971d7311b0068841a
|
f74ce68069a10ce3c28c494e6d1594d64bebc46e
|
/test/ShipTest.java
|
458c12f8ab9af44874fc4aaf3dca5e0c68d65597
|
[] |
no_license
|
dezren39/Vandise-agile-sp2018-oop
|
9cc9e575abf85b0b7121de830c55b3ac532de1eb
|
2e64198e7835270badecdf0896679273b86d93c4
|
refs/heads/master
| 2021-01-25T09:59:46.563995 | 2018-03-07T22:06:19 | 2018-03-07T22:06:19 | 123,331,649 | 1 | 0 | null | 2018-02-28T19:26:13 | 2018-02-28T19:26:12 | null |
UTF-8
|
Java
| false | false | 1,115 |
java
|
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.is;
import org.junit.Before;
import org.junit.Test;
public class ShipTest {
private Ship ship;
@Before
public void setUp() throws Exception {
this.ship = new Ship(3);
}
@Test
public void testShipIsInitializedWithLife() {
assertThat(this.ship.getLife(), is(3));
}
@Test
public void testShipIsNotSunkOnInitialize() {
assertThat(this.ship.isSunk(), is(false));
}
@Test
public void testShipHitDeductsLife() throws Exception {
this.ship.hit();
assertThat(this.ship.getLife(), is(2));
}
@Test
public void testShipCanBeSunk() throws Exception {
int life = this.ship.getLife();
for (int i = 0; i < life; i++) {
this.ship.hit();
}
assertThat(this.ship.isSunk(), is(true));
}
@Test
public void testShipUpdateCallsHit() throws Exception {
this.ship.update();
assertThat(this.ship.getLife(), is(2));
}
@Test(expected = Exception.class)
public void testCannotHitShipMoreThenMaxLife() throws Exception {
this.ship.hit();
this.ship.hit();
this.ship.hit();
// error!
this.ship.hit();
}
}
|
[
"[email protected]"
] | |
be6ab5a7a71323abd08346b75f4c7a5bd6f022d6
|
72e1b2f90a100494b2b2ea2aa6fe2899b7e33ccb
|
/hackerRank/src/com/concurrent/ConcurrentStack.java
|
777fb5911af4c4349874321e8a32700c7bd46105
|
[] |
no_license
|
pragatidev/JavaProgramming
|
d715aa47efb10e41a1ef9c66d5ca94a489605bdf
|
e54c0a1d95d966c47d8b3f481b1719f9f067f32f
|
refs/heads/master
| 2020-05-21T13:29:15.380639 | 2017-11-13T21:22:34 | 2017-11-13T21:22:34 | 63,547,331 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 828 |
java
|
/**
*
*/
package com.concurrent;
import java.util.concurrent.atomic.AtomicReference;
/**
* @author pkunwer
*
*/
public class ConcurrentStack<E> {
AtomicReference<Node<E>> top = new AtomicReference<Node<E>>();
public void push(E item) {
Node<E> newHead = new Node<E>(item);
Node<E> oldHead;
do {
oldHead = top.get();
newHead.next = oldHead;
} while (!top.compareAndSet(oldHead, newHead));
}
public E pop() {
Node<E> oldHead;
Node<E> newHead;
do {
oldHead = top.get();
if (oldHead == null)
return null;
newHead = oldHead.next;
} while (!top.compareAndSet(oldHead, newHead));
return oldHead.item;
}
private static class Node<E> {
public final E item;
public Node<E> next;
public Node(E item) {
this.item = item;
}
}
}
|
[
"[email protected]"
] | |
119f8642cf0e7a9852b913af4596abfc1c302b46
|
e2e334dc0b3bca407aecf87549c289b8d321572b
|
/Random practicing/Extras 1/src/Cliente.java
|
738405b06c233d4d8630e48a18b63052935af048
|
[] |
no_license
|
gustavorlh96/Java
|
ec083abf8ad81c6fa6e4cebed9fe7dd64c9d95b3
|
96e84efeafc74be19bd6e0edef9d15c2ea4a5001
|
refs/heads/master
| 2023-04-18T15:48:05.092905 | 2021-05-06T04:36:45 | 2021-05-06T04:36:45 | 364,120,723 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,049 |
java
|
public class Cliente {
private String nome, email, sexo, senha;
private int idade;
public Cliente(String _nome, String _email, String _sexo, String _senha, int _idade) {
this.nome = _nome;
this.email = _email;
this.sexo = _sexo;
this.senha = _senha;
this.idade = _idade;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getSexo() {
return sexo;
}
public void setSexo(String sexo) {
this.sexo = sexo;
}
public String getSenha() {
return senha;
}
public void setSenha(String senha) {
this.senha = senha;
}
public int getIdade() {
return idade;
}
public void setIdade(int idade) {
this.idade = idade;
}
public String toString() {
return "Cliente [nome=" + nome + ", email=" + email + ", sexo=" + sexo + ", senha=" + senha + ", idade=" + idade
+ "]";
}
}
|
[
"[email protected]"
] | |
2ad0e610538f32667699ddb3a5baf89883c044c2
|
5dd6cb5fdc54ce991fca82a719e363dde18a71b4
|
/parts/src/org/lineageos/settings/doze/TiltSensor.java
|
5e2a73615c5398f93825085e1e174d4d37fce8bb
|
[] |
no_license
|
aragon12/android_device_xiaomi_rosy
|
3b7d548a4f79b3a468a573836d0dca971d81ecd5
|
eb6eb84e598aa9c1ed9567ddc88994e1431400b0
|
refs/heads/lineage-16.0
| 2020-03-14T20:56:45.203953 | 2017-10-26T00:06:14 | 2019-04-08T10:44:36 | 131,785,916 | 5 | 34 | null | 2019-02-20T10:02:56 | 2018-05-02T02:12:28 |
C++
|
UTF-8
|
Java
| false | false | 2,977 |
java
|
/*
* Copyright (c) 2015 The CyanogenMod Project
* 2017-2018 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.lineageos.settings.doze;
import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.SystemClock;
import android.util.Log;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
public class TiltSensor implements SensorEventListener {
private static final boolean DEBUG = false;
private static final String TAG = "TiltSensor";
private static final int BATCH_LATENCY_IN_MS = 100;
private static final int MIN_PULSE_INTERVAL_MS = 2500;
private SensorManager mSensorManager;
private Sensor mSensor;
private Context mContext;
private ExecutorService mExecutorService;
private long mEntryTimestamp;
public TiltSensor(Context context) {
mContext = context;
mSensorManager = mContext.getSystemService(SensorManager.class);
mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_TILT_DETECTOR);
mExecutorService = Executors.newSingleThreadExecutor();
}
private Future<?> submit(Runnable runnable) {
return mExecutorService.submit(runnable);
}
@Override
public void onSensorChanged(SensorEvent event) {
if (DEBUG) Log.d(TAG, "Got sensor event: " + event.values[0]);
long delta = SystemClock.elapsedRealtime() - mEntryTimestamp;
if (delta < MIN_PULSE_INTERVAL_MS) {
return;
} else {
mEntryTimestamp = SystemClock.elapsedRealtime();
}
if (event.values[0] == 1) {
DozeUtils.launchDozePulse(mContext);
}
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
/* Empty */
}
protected void enable() {
if (DEBUG) Log.d(TAG, "Enabling");
submit(() -> {
mSensorManager.registerListener(this, mSensor,
SensorManager.SENSOR_DELAY_NORMAL, BATCH_LATENCY_IN_MS * 1000);
});
mEntryTimestamp = SystemClock.elapsedRealtime();
}
protected void disable() {
if (DEBUG) Log.d(TAG, "Disabling");
submit(() -> {
mSensorManager.unregisterListener(this, mSensor);
});
}
}
|
[
"[email protected]"
] | |
75f6ee8c7de660aad714632abe234a8ae2ee94b2
|
eb1c79d4d2f904bacc75c5d8b7fd6725e8997a74
|
/14.Strings/StringTest22.java
|
7dc0df06a229ce6c357d702ea29aece467bfb485
|
[] |
no_license
|
ashbora/Java-programs
|
ac9974691fa8a257f75c48ea585abee299cbc10e
|
151cf1269c6d674db6e0e86ca2a28445783657fc
|
refs/heads/master
| 2023-07-04T09:06:02.971685 | 2021-08-08T16:59:54 | 2021-08-08T16:59:54 | 390,077,431 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 379 |
java
|
/*
difference between equals() and ==
*/
class StringTest22
{
public static void main(String [] args)
{
String s1 = "Elegant";
String s2 = new String(s1);
String s3 = s1;
System.out.println("s1 equals s2 = "+s1.equals(s2));
System.out.println("s1 == s2 = "+(s1==s2));
System.out.println("s1 == s3 = "+(s1==s3));
}
}
|
[
"[email protected]"
] | |
43e51af614741d9471d7ebdc63dfbf5587420f6e
|
38d140da333d3863ed8e9e914f01e8e9dabd4d28
|
/src/main/java/nutan/tech/models/ExpensesModel.java
|
dfb7bb7d964bde88ca069b401bfa5ca0ad91a686
|
[] |
no_license
|
jazz2canvey/palmbusiness
|
db9f576aecf808b292f070e8e502fea2e258c098
|
b08d70b125b2a4da2039ef45f637c9e46c53cb70
|
refs/heads/swastik
| 2022-06-27T17:19:38.979516 | 2019-06-24T14:47:17 | 2019-06-24T14:47:17 | 145,240,914 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,395 |
java
|
package nutan.tech.models;
public class ExpensesModel {
int expense_id, bank_payment_mode;
double amount;
String enterprise_id, entry_date, expense_name, expense_head, description;
boolean payed_via_cash, payed_via_bank;
public ExpensesModel() {
}
public ExpensesModel(int expense_id, int bank_payment_mode, double amount, String enterprise_id, String entry_date, String expense_name, String expense_head, String description, boolean payed_via_cash, boolean payed_via_bank) {
this.expense_id = expense_id;
this.bank_payment_mode = bank_payment_mode;
this.amount = amount;
this.enterprise_id = enterprise_id;
this.entry_date = entry_date;
this.expense_name = expense_name;
this.expense_head = expense_head;
this.description = description;
this.payed_via_cash = payed_via_cash;
this.payed_via_bank = payed_via_bank;
}
public int getExpense_id() {
return expense_id;
}
public void setExpense_id(int expense_id) {
this.expense_id = expense_id;
}
public int getBank_payment_mode() {
return bank_payment_mode;
}
public void setBank_payment_mode(int bank_payment_mode) {
this.bank_payment_mode = bank_payment_mode;
}
public double getAmount() {
return amount;
}
public void setAmount(double amount) {
this.amount = amount;
}
public String getEnterprise_id() {
return enterprise_id;
}
public void setEnterprise_id(String enterprise_id) {
this.enterprise_id = enterprise_id;
}
public String getEntry_date() {
return entry_date;
}
public void setEntry_date(String entry_date) {
this.entry_date = entry_date;
}
public String getExpense_name() {
return expense_name;
}
public void setExpense_name(String expense_name) {
this.expense_name = expense_name;
}
public String getExpense_head() {
return expense_head;
}
public void setExpense_head(String expense_head) {
this.expense_head = expense_head;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public boolean isPayed_via_cash() {
return payed_via_cash;
}
public void setPayed_via_cash(boolean payed_via_cash) {
this.payed_via_cash = payed_via_cash;
}
public boolean isPayed_via_bank() {
return payed_via_bank;
}
public void setPayed_via_bank(boolean payed_via_bank) {
this.payed_via_bank = payed_via_bank;
}
}
|
[
"[email protected]"
] | |
325c9f6d9207ac6fb740bc54109e8641205807c8
|
a2ef7f0b54924851d517b84f8638da90dbec89b7
|
/app/src/androidTest/java/com/helpyou/itproject/ContactsTest.java
|
633d490136f10935b32f6aaaac4b463de0e1aca6
|
[] |
no_license
|
rishabgarg2021/AndroidAppNavSight
|
88061bddb797139be5b865400ba46c4c10edc943
|
8fa722bffe20662f1fa0cea92641d81d477038a0
|
refs/heads/master
| 2020-04-14T23:00:12.105078 | 2019-01-05T05:54:39 | 2019-01-05T05:54:39 | 164,186,401 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,841 |
java
|
package com.helpyou.itproject;
import android.content.Intent;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import static android.support.test.espresso.Espresso.onData;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
import static org.hamcrest.CoreMatchers.anything;
import static org.junit.Assert.*;
@RunWith(AndroidJUnit4.class)
public class ContactsTest {
@Rule
public ActivityTestRule<Contacts> mActivityRule = new ActivityTestRule<>(Contacts.class, false, false);
@Before
public void setUp() throws Exception {
Intent intent = new Intent();
intent.putExtra("userId", "DzXbB5EOkJOTdJmKltjVv0v1U8n1");
intent.putExtra("phone", "+61406255366");
mActivityRule.launchActivity(intent);
}
@Test
public void completeTest() throws InterruptedException {
onView(withId(R.id.action_reload)).perform(click());
onView(withId(R.id.contactListView)).check(matches(isDisplayed()));
//Thread.sleep(10000);
//You need to have at least 1 registered contact to make this test pass
onData(anything()).inAdapterView(withId(R.id.contactListView)).atPosition(0).perform(click());
}
@After
public void tearDown() throws Exception {
}
}
|
[
"[email protected]"
] | |
692dd814f4b2b6136780f99c8ee0f91017a0ff59
|
d39142d213771ada0e886f829257c6c7fbf1ce17
|
/source code and apk file/app/gradleBuild/generated/source/r/release/android/support/graphics/drawable/animated/R.java
|
e0cb1aa7349de63f5f17dc58158d355e217cd830
|
[
"MIT"
] |
permissive
|
shishir95/Eye-Assistant
|
3f6270e7ad5468c3e2e1c2abeef47e61784e456f
|
eb54c5ce40cd33e96bc4912e36166cab2c6a4012
|
refs/heads/master
| 2020-04-11T13:57:56.049321 | 2019-06-11T19:03:28 | 2019-06-11T19:03:28 | 161,836,841 | 1 | 1 |
MIT
| 2018-12-19T14:42:59 | 2018-12-14T20:25:41 |
Java
|
UTF-8
|
Java
| false | false | 10,339 |
java
|
/* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package android.support.graphics.drawable.animated;
public final class R {
public static final class attr {
public static final int coordinatorLayoutStyle = 0x7f020064;
public static final int font = 0x7f020079;
public static final int fontProviderAuthority = 0x7f02007b;
public static final int fontProviderCerts = 0x7f02007c;
public static final int fontProviderFetchStrategy = 0x7f02007d;
public static final int fontProviderFetchTimeout = 0x7f02007e;
public static final int fontProviderPackage = 0x7f02007f;
public static final int fontProviderQuery = 0x7f020080;
public static final int fontStyle = 0x7f020081;
public static final int fontVariationSettings = 0x7f020082;
public static final int fontWeight = 0x7f020083;
public static final int keylines = 0x7f020093;
public static final int layout_anchor = 0x7f020095;
public static final int layout_anchorGravity = 0x7f020096;
public static final int layout_behavior = 0x7f020097;
public static final int layout_dodgeInsetEdges = 0x7f0200c1;
public static final int layout_insetEdge = 0x7f0200ca;
public static final int layout_keyline = 0x7f0200cb;
public static final int statusBarBackground = 0x7f020106;
public static final int ttcIndex = 0x7f020139;
}
public static final class bool {
public static final int abc_action_bar_embed_tabs = 0x7f030000;
}
public static final class color {
public static final int notification_action_color_filter = 0x7f04003f;
public static final int notification_icon_bg_color = 0x7f040040;
public static final int ripple_material_light = 0x7f04004a;
public static final int secondary_text_default_material_light = 0x7f04004c;
}
public static final class dimen {
public static final int compat_button_inset_horizontal_material = 0x7f05004c;
public static final int compat_button_inset_vertical_material = 0x7f05004d;
public static final int compat_button_padding_horizontal_material = 0x7f05004e;
public static final int compat_button_padding_vertical_material = 0x7f05004f;
public static final int compat_control_corner_material = 0x7f050050;
public static final int notification_action_icon_size = 0x7f05005a;
public static final int notification_action_text_size = 0x7f05005b;
public static final int notification_big_circle_margin = 0x7f05005c;
public static final int notification_content_margin_start = 0x7f05005d;
public static final int notification_large_icon_height = 0x7f05005e;
public static final int notification_large_icon_width = 0x7f05005f;
public static final int notification_main_column_padding_top = 0x7f050060;
public static final int notification_media_narrow_margin = 0x7f050061;
public static final int notification_right_icon_size = 0x7f050062;
public static final int notification_right_side_padding_top = 0x7f050063;
public static final int notification_small_icon_background_padding = 0x7f050064;
public static final int notification_small_icon_size_as_large = 0x7f050065;
public static final int notification_subtext_size = 0x7f050066;
public static final int notification_top_pad = 0x7f050067;
public static final int notification_top_pad_large_text = 0x7f050068;
}
public static final class drawable {
public static final int notification_action_background = 0x7f060058;
public static final int notification_bg = 0x7f060059;
public static final int notification_bg_low = 0x7f06005a;
public static final int notification_bg_low_normal = 0x7f06005b;
public static final int notification_bg_low_pressed = 0x7f06005c;
public static final int notification_bg_normal = 0x7f06005d;
public static final int notification_bg_normal_pressed = 0x7f06005e;
public static final int notification_icon_background = 0x7f06005f;
public static final int notification_template_icon_bg = 0x7f060060;
public static final int notification_template_icon_low_bg = 0x7f060061;
public static final int notification_tile_bg = 0x7f060062;
public static final int notify_panel_notification_icon_bg = 0x7f060063;
}
public static final class id {
public static final int action_container = 0x7f07000d;
public static final int action_divider = 0x7f07000f;
public static final int action_image = 0x7f070010;
public static final int action_text = 0x7f070016;
public static final int actions = 0x7f070017;
public static final int async = 0x7f07001d;
public static final int blocking = 0x7f070021;
public static final int bottom = 0x7f070022;
public static final int chronometer = 0x7f070029;
public static final int end = 0x7f070039;
public static final int forever = 0x7f07003f;
public static final int icon = 0x7f070047;
public static final int icon_group = 0x7f070048;
public static final int info = 0x7f07004b;
public static final int italic = 0x7f07004d;
public static final int left = 0x7f07004e;
public static final int line1 = 0x7f07004f;
public static final int line3 = 0x7f070050;
public static final int none = 0x7f070057;
public static final int normal = 0x7f070058;
public static final int notification_background = 0x7f070059;
public static final int notification_main_column = 0x7f07005a;
public static final int notification_main_column_container = 0x7f07005b;
public static final int right = 0x7f070065;
public static final int right_icon = 0x7f070066;
public static final int right_side = 0x7f070067;
public static final int start = 0x7f070083;
public static final int tag_transition_group = 0x7f070087;
public static final int text = 0x7f070088;
public static final int text2 = 0x7f070089;
public static final int time = 0x7f07008d;
public static final int title = 0x7f07008e;
public static final int top = 0x7f070091;
}
public static final class integer {
public static final int status_bar_notification_info_maxnum = 0x7f080004;
}
public static final class layout {
public static final int notification_action = 0x7f090022;
public static final int notification_action_tombstone = 0x7f090023;
public static final int notification_template_custom_big = 0x7f090024;
public static final int notification_template_icon_group = 0x7f090025;
public static final int notification_template_part_chronometer = 0x7f090026;
public static final int notification_template_part_time = 0x7f090027;
}
public static final class string {
public static final int status_bar_notification_info_overflow = 0x7f0b0020;
}
public static final class style {
public static final int TextAppearance_Compat_Notification = 0x7f0c00ea;
public static final int TextAppearance_Compat_Notification_Info = 0x7f0c00eb;
public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0c00ec;
public static final int TextAppearance_Compat_Notification_Time = 0x7f0c00ed;
public static final int TextAppearance_Compat_Notification_Title = 0x7f0c00ee;
public static final int Widget_Compat_NotificationActionContainer = 0x7f0c0156;
public static final int Widget_Compat_NotificationActionText = 0x7f0c0157;
public static final int Widget_Support_CoordinatorLayout = 0x7f0c0158;
}
public static final class styleable {
public static final int[] CoordinatorLayout = { 0x7f020093, 0x7f020106 };
public static final int CoordinatorLayout_keylines = 0;
public static final int CoordinatorLayout_statusBarBackground = 1;
public static final int[] CoordinatorLayout_Layout = { 0x010100b3, 0x7f020095, 0x7f020096, 0x7f020097, 0x7f0200c1, 0x7f0200ca, 0x7f0200cb };
public static final int CoordinatorLayout_Layout_android_layout_gravity = 0;
public static final int CoordinatorLayout_Layout_layout_anchor = 1;
public static final int CoordinatorLayout_Layout_layout_anchorGravity = 2;
public static final int CoordinatorLayout_Layout_layout_behavior = 3;
public static final int CoordinatorLayout_Layout_layout_dodgeInsetEdges = 4;
public static final int CoordinatorLayout_Layout_layout_insetEdge = 5;
public static final int CoordinatorLayout_Layout_layout_keyline = 6;
public static final int[] FontFamily = { 0x7f02007b, 0x7f02007c, 0x7f02007d, 0x7f02007e, 0x7f02007f, 0x7f020080 };
public static final int FontFamily_fontProviderAuthority = 0;
public static final int FontFamily_fontProviderCerts = 1;
public static final int FontFamily_fontProviderFetchStrategy = 2;
public static final int FontFamily_fontProviderFetchTimeout = 3;
public static final int FontFamily_fontProviderPackage = 4;
public static final int FontFamily_fontProviderQuery = 5;
public static final int[] FontFamilyFont = { 0x01010532, 0x01010533, 0x0101053f, 0x0101056f, 0x01010570, 0x7f020079, 0x7f020081, 0x7f020082, 0x7f020083, 0x7f020139 };
public static final int FontFamilyFont_android_font = 0;
public static final int FontFamilyFont_android_fontWeight = 1;
public static final int FontFamilyFont_android_fontStyle = 2;
public static final int FontFamilyFont_android_ttcIndex = 3;
public static final int FontFamilyFont_android_fontVariationSettings = 4;
public static final int FontFamilyFont_font = 5;
public static final int FontFamilyFont_fontStyle = 6;
public static final int FontFamilyFont_fontVariationSettings = 7;
public static final int FontFamilyFont_fontWeight = 8;
public static final int FontFamilyFont_ttcIndex = 9;
}
}
|
[
"[email protected]"
] | |
cd50dea89fe5eb15853e664f19dea5d7f604db8e
|
536dc62371a9be28c0fd0cdece4bbc1f25d9c1a8
|
/sistema/sincronizacionCristian/UtilRed.java
|
d29f1812519688c33133a34e8292d12a9073dc62
|
[] |
no_license
|
22jess/Pruebas
|
5ed79bd09c524d96ce302257ee77805961071361
|
2d9aa4b55a728498be181e9413e155bd8da354d1
|
refs/heads/master
| 2020-05-01T13:40:00.575569 | 2019-03-25T02:17:48 | 2019-03-25T02:17:48 | 177,497,898 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,875 |
java
|
/* Sistemas Concurrentes y Distribuidos
Algoritmos de Sincronización de Relojes - Cristian
CeroCero
*/
package sistemaDistribuido.sistema.sincronizacionCristian;
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
public class UtilRed{
private static ByteOrder orden = ByteOrder.BIG_ENDIAN;
public final static String CODIFICACION = "ISO-8859-1";
public static long toLong(byte[] bytes,int offset){
return ByteBuffer.wrap(bytes,offset,Long.BYTES).order(orden).getLong();
}
public static long toLong(byte[] bytes){
return ByteBuffer.wrap(bytes).order(orden).getLong();
}
public static int toInt(byte[] bytes,int offset){
return ByteBuffer.wrap(bytes,offset,Integer.BYTES).order(orden).getInt();
}
public static int toInt(byte[] bytes){
return ByteBuffer.wrap(bytes).order(orden).getInt();
}
public static short toShort(byte[] bytes){
return ByteBuffer.wrap(bytes).order(orden).getShort();
}
public static short toShort(byte[] solicitud, int offset) {
return ByteBuffer.wrap(solicitud,offset,Short.BYTES).order(orden).getShort();
}
public static String toString(byte[] bytes,int offset, int numBytes){
byte[] bytesCadena = new byte[numBytes];
System.arraycopy(bytes, offset, bytesCadena, 0, numBytes);
try {
return new String(bytesCadena,CODIFICACION);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return null;
}
public static byte[] toBytes(int x){
return ByteBuffer.allocate(Integer.BYTES).order(orden).putInt(x).array();
}
public static byte[] toBytes(short x){
return ByteBuffer.allocate(Short.BYTES).order(orden).putShort(x).array();
}
public static byte[] toBytes(long x){
return ByteBuffer.allocate(Long.BYTES).order(orden).putLong(x).array();
}
}
|
[
"[email protected]"
] | |
7b7ab7bafb79ebcbe602caa676fa0461eca97f22
|
eeb6243ac21267da30c4d8a1f6552cdb1e26b972
|
/util/Time.java
|
44274aa1e498a5baa593a92ff6299e0b099bea2f
|
[] |
no_license
|
mircea-dinoiu/edwinbot-java
|
343f80c1aed706eed911c6773f3ae635d23876b9
|
cf4a206773c07ed665c9c2c219700e17e25a0f31
|
refs/heads/master
| 2020-09-22T07:24:13.064600 | 2016-09-08T18:43:14 | 2016-09-08T18:43:14 | 67,730,437 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 6,525 |
java
|
package util;
import manager.Language;
import java.util.*;
public class Time {
final private static boolean DEFAULT_RETURN_DECIMAL = false;
/**
* Format seconds to short string
* E.g. if seconds = 300125, the method will return 3d 11h 22m 5s
* Doesn't support negative numbers!
*
* @param seconds seconds
* @param returnDecimal true to consider milliseconds
* @return the formatted string
*/
public static String formatSecondsToShortString(Number seconds, boolean returnDecimal) {
if (!util.Numbers.hasDecimals(seconds)) {
seconds = seconds.longValue();
} else if (!returnDecimal) {
seconds = Math.round(seconds.floatValue());
}
if (0 == seconds.floatValue()) {
return "0s";
} else {
List<String> ret = new ArrayList<>();
HashMap<String, Integer> mapping = new LinkedHashMap<>();
Number fractionalPart = util.Numbers.getFractionalPart(seconds);
seconds = seconds.longValue();
mapping.put("year", 3600 * 24 * 365);
mapping.put("month", 3600 * 24 * 30);
mapping.put("day", 3600 * 24);
mapping.put("hour", 3600);
mapping.put("minute", 60);
mapping.put("second", 1);
for (Map.Entry<String, Integer> each : mapping.entrySet()) {
long value = seconds.longValue() / each.getValue();
String stringValue = "";
if (value > 0) {
if (!each.getKey().equals("second")) {
seconds = seconds.longValue() - each.getValue() * value;
}
if (each.getKey().equals("second")) {
if (util.Numbers.hasDecimals(fractionalPart)) {
stringValue = String.valueOf(value + fractionalPart.floatValue());
} else {
stringValue = String.valueOf(value);
}
} else {
stringValue = String.valueOf(value);
}
} else if (each.getKey().equals("second")
&& util.Numbers.hasDecimals(fractionalPart)) {
stringValue = String.valueOf(fractionalPart.floatValue());
}
if (stringValue.length() > 0) {
ret.add(String.format(
"%s%s",
stringValue,
each.getKey().charAt(0)
));
}
}
return util.Strings.implode(" ", ret);
}
}
public static String formatSecondsToShortString(Number seconds) {
return formatSecondsToShortString(seconds, DEFAULT_RETURN_DECIMAL);
}
/**
* Format seconds to long string
* E.g.: if seconds = 300125, the method will return 3 days, 11 hours, 22 minutes and 5 seconds
* Doesn't support negative numbers!
*
* @param seconds seconds
* @param language language to use
* @param returnDecimal true to consider milliseconds
* @return the formatted string
*/
public static String formatSecondsToLongString(Number seconds, String language, boolean returnDecimal) {
if (!util.Numbers.hasDecimals(seconds)) {
seconds = seconds.longValue();
} else if (!returnDecimal) {
seconds = Math.round(seconds.floatValue());
}
if (0 == seconds.floatValue()) {
return util.Localization.formatNumber(
0,
Language.get("SECONDS", language),
Language.get("SECOND", language),
language
);
} else {
List<String> ret = new ArrayList<>();
HashMap<String, Integer> mapping = new LinkedHashMap<>();
Number fractionalPart = util.Numbers.getFractionalPart(seconds);
String result;
seconds = seconds.longValue();
mapping.put("year", 3600 * 24 * 365);
mapping.put("month", 3600 * 24 * 30);
mapping.put("day", 3600 * 24);
mapping.put("hour", 3600);
mapping.put("minute", 60);
mapping.put("second", 1);
for (Map.Entry<String, Integer> each : mapping.entrySet()) {
long value = seconds.longValue() / each.getValue();
Number valueToUse = 0;
if (value > 0) {
if (!each.getKey().equals("second")) {
seconds = seconds.longValue() - each.getValue() * value;
}
if (each.getKey().equals("second")) {
if (util.Numbers.hasDecimals(fractionalPart)) {
valueToUse = value + fractionalPart.floatValue();
} else {
valueToUse = value;
}
} else {
valueToUse = value;
}
} else if (each.getKey().equals("second")
&& util.Numbers.hasDecimals(fractionalPart)) {
valueToUse = fractionalPart;
}
if (0 != valueToUse.floatValue()) {
ret.add(util.Localization.formatNumber(
valueToUse,
Language.get(each.getKey().concat("s").toUpperCase(), language),
Language.get(each.getKey().toUpperCase(), language),
language
));
}
}
if (ret.size() > 1) {
String andWord = String.format(
" %s ",
Language.get("AND", language)
);
List<String> temp = new ArrayList<>();
temp.add(util.Strings.implode(", ", ret.subList(0, ret.size() - 1)));
temp.add(ret.get(ret.size() - 1));
result = util.Strings.implode(
andWord,
temp
);
} else {
result = ret.get(0);
}
return result;
}
}
public static String formatSecondsToLongString(Number seconds, String language) {
return formatSecondsToLongString(seconds, language, DEFAULT_RETURN_DECIMAL);
}
}
|
[
"[email protected]"
] | |
7fbae7bc05d733e0a19ade578ca803fad4a55c2f
|
296642083e93aaf320e5340c945024ef26d03121
|
/src/main/java/de/webever/dropwizard/helpers/errors/WebserviceExceptionMapper.java
|
63c6938467fa3e167bcadecb05f63049e85d7592
|
[
"MIT"
] |
permissive
|
webeverde/dropwizard-helpers
|
a906d223c57bc527e9f4b505e772c0c72887a8da
|
76e8d07e5f03dd6f76a4e551d298c3bbdc2b5e43
|
refs/heads/develop
| 2021-06-12T09:15:10.861574 | 2019-05-28T08:07:13 | 2019-05-28T08:07:13 | 169,550,322 | 1 | 2 |
MIT
| 2021-04-26T18:50:09 | 2019-02-07T09:55:28 |
Java
|
UTF-8
|
Java
| false | false | 945 |
java
|
package de.webever.dropwizard.helpers.errors;
import java.util.Set;
import javax.validation.ConstraintViolation;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;
import io.dropwizard.jersey.validation.JerseyViolationException;
/**
* Catches {@link JerseyViolationException} and converts the attached
* {@link ConstraintViolation}s to {@link WebserviceErrorContainer}s.
*
* @author Richard Naeve
*
*/
@Provider
public class WebserviceExceptionMapper implements ExceptionMapper<JerseyViolationException> {
@Override
public Response toResponse(JerseyViolationException exception) {
Set<ConstraintViolation<?>> set = exception.getConstraintViolations();
WebserviceException w = new WebserviceException();
for (ConstraintViolation<?> constraintViolation : set) {
w.addError(WebserviceError.forValidation(constraintViolation));
}
return w.getResponse();
}
}
|
[
"[email protected]"
] | |
d09163a04bb33c3ee40bdd270a28ca7b4c075437
|
06856c3edbf43d7162982ad0d8a4c1a5839b5d7a
|
/src/test/java/com/vgv/excel/io/props/sheet/ColumnWidthTest.java
|
53c441d7ef2f8a84d8b1770b39e8f7fa6dfa7f35
|
[
"MIT"
] |
permissive
|
battyone/excel-io
|
b703c6e59a6bc782b787eadd9d2fda6aebfd4ae5
|
4d1f3a3c55d2f2356bc597719b58757807247b83
|
refs/heads/master
| 2021-09-10T14:12:26.964402 | 2018-03-27T16:23:22 | 2018-03-27T16:23:22 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,100 |
java
|
/**
* The MIT License (MIT)
*
* Copyright (c) 2018 Vedran Grgo Vatavuk
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.vgv.excel.io.props.sheet;
import java.io.IOException;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;
/**
* Test cases for {@link ColumnWidth}.
* @author Vedran Vatavuk ([email protected])
* @version $Id$
* @since 0.1
*/
public final class ColumnWidthTest {
/**
* Set column width.
* @throws IOException If fails
*/
@Test
public void setColumnWidth() throws IOException {
try (final Workbook wbook = new XSSFWorkbook()) {
final int width = 100;
final Sheet sheet = wbook.createSheet();
new ColumnWidth(0, width).accept(sheet);
MatcherAssert.assertThat(
sheet.getColumnWidth(0),
Matchers.equalTo(width)
);
}
}
}
|
[
"[email protected]"
] | |
daa67933c570942381690849d71e5b38f28333e2
|
ba6cced44332bdf3efaecc503f406ac3e23501c7
|
/app/src/main/java/com/example/alumna/presenter/Interface/GalleryPresenterImpl.java
|
f3dc25e5c8e4dd1e12a5abb75e4ecb4e883fc696
|
[] |
no_license
|
lollipop5371/Alumna
|
78ca40a66f8cc7a90917ce0c224d3d9c5af9a45b
|
489d7fce85be48a22cabe838f36e7ebb3b047fac
|
refs/heads/master
| 2021-01-20T02:42:01.652203 | 2017-05-08T13:25:07 | 2017-05-08T13:25:07 | 89,442,673 | 0 | 0 | null | 2017-04-26T05:45:44 | 2017-04-26T05:45:44 | null |
UTF-8
|
Java
| false | false | 142 |
java
|
package com.example.alumna.presenter.Interface;
/**
* Created by Administrator on 2017/4/25.
*/
public interface GalleryPresenterImpl {
}
|
[
"[email protected]"
] | |
41c8653878b49ffb76ffc4f7729991d73d64210a
|
0b3875650f515ba6359e564b4c98b8a687f7bd0d
|
/dynamiccontrolslibrary/src/main/java/com/vdoers/dynamiccontrolslibrary/mControls/contols/mTextView.java
|
13bdfc13c9233b73fb138d6749a91d3540d94109
|
[] |
no_license
|
NazarAbbas/DynamicControls
|
d64fe2ef72fe6a3711765eb8fe6d88616027080d
|
7086925410785a497a37efeabbcf4deff8ede49b
|
refs/heads/master
| 2021-06-26T09:43:58.427183 | 2021-03-01T12:53:26 | 2021-03-01T12:53:26 | 208,387,713 | 4 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,269 |
java
|
package com.vdoers.dynamiccontrolslibrary.mControls.contols;
import android.app.Activity;
import android.content.Intent;
import android.text.SpannableString;
import android.text.style.UnderlineSpan;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.vdoers.dynamiccontrolslibrary.R;
import com.vdoers.dynamiccontrolslibrary.mControls.Constant;
import com.vdoers.dynamiccontrolslibrary.mControls.TermsAndConditionWebViewActivity;
public class mTextView extends LinearLayout {
private TextView textView;
private Activity context;
public mTextView(Activity context, JsonWorkflowList.Field field) {
super(context);
setOrientation(LinearLayout.VERTICAL);
this.context = context;
initUI();
setClickListener(field);
showUI(field);
}
private void showUI(JsonWorkflowList.Field field) {
if (field.getReadMoreURL() != null && !field.getReadMoreURL().equalsIgnoreCase("")) {
SpannableString content = new SpannableString(field.getLabel());
content.setSpan(new UnderlineSpan(), 0, content.length(), 0);
textView.setText(content);
} else {
textView.setText(field.getLabel());
}
}
private void setClickListener(final JsonWorkflowList.Field field) {
//textView.setOnClickListener((OnClickListener) context);
if (field.getReadMoreURL() != null && !field.getReadMoreURL().equalsIgnoreCase("")) {
textView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// Toast.makeText(context, "coming soon...", Toast.LENGTH_LONG).show();
Intent intent = new Intent(context, TermsAndConditionWebViewActivity.class);
intent.putExtra(Constant.WEBVIEW_URL, field.getReadMoreURL());
context.startActivity(intent);
}
});
}
}
private void initUI() {
LinearLayout topLayout = (LinearLayout) context.getLayoutInflater().inflate(R.layout.dynamic_textview, null);
textView = (TextView) topLayout.findViewById(R.id.textview);
addView(topLayout);
}
}
|
[
"[email protected]"
] | |
e972b380dbada49eaf16c16fea2f9fe45b4a96be
|
5518288ae5964306b146ea9428622e06960d8d6a
|
/src/java/pwp/add_clerk.java
|
950e0d156441dd2b3eaaecd42f8be29be4d4a13f
|
[] |
no_license
|
elkant/PWP
|
68cb79da347bfbe71de987a418a9792b670bd587
|
7b567ded9a8c08047193c519139b55881b4d4069
|
refs/heads/master
| 2021-01-17T10:18:30.407253 | 2017-03-21T08:43:28 | 2017-03-21T08:43:28 | 56,304,190 | 0 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 8,424 |
java
|
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package pwp;
import java.io.IOException;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.sql.SQLException;
import java.util.Random;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
/**
*
* @author Geofrey Nyabuto
*/
public class add_clerk extends HttpServlet {
HttpSession session;
String f_name,m_name,s_name,phoneno,username,password, userid,level;
boolean statuz=false;
MessageDigest m;
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
try {
response.setContentType("text/html;charset=UTF-8");
session=request.getSession();
// if (session.getAttribute("userid") == null) {
// response.sendRedirect("index.jsp");
// }
userid=request.getParameter("userid");
f_name=request.getParameter("f_name");
m_name=request.getParameter("m_name");
s_name=request.getParameter("s_name");
level=request.getParameter("level");
//random id generator
if(request.getParameter("phoneno")!=null){ phoneno=request.getParameter("phoneno");}
else{
phoneno="none";
}
username=request.getParameter("username");
password=request.getParameter("pass");
//encrypt password
m = MessageDigest.getInstance("MD5");
m.update(password.getBytes(), 0, password.length());
String pw = new BigInteger(1, m.digest()).toString(16);
dbConn conn= new dbConn();
//save details to clerk table
IdGenerator ig = new IdGenerator();
String save="insert into clerks(clerk_id, first_name,sur_name, phone,timestamp) "
+ "values ('"+userid+"','"+f_name+"','"+s_name+"','"+phoneno+"','"+ig.toDay()+"')";
//save details to the usewrs table
String add_to_users="insert into users(userid,password,username,level,timestamp) "
+ "values ('"+userid+"','"+pw+"','"+username+"','"+level+"','"+ig.toDay()+"')";
String checker="select * from users where username='"+username+"'";
String useridchecker="select * from users where userid='"+userid+"'";
conn.rs=conn.st.executeQuery(checker);
//check if username is already used
if(!conn.rs.next())
{
//check if userid already exists
conn.rs=conn.st.executeQuery(useridchecker);
//if the userid exixts, generate another one
if(conn.rs.next()){
double myran=generateRandomNumber(10889, 20000);
userid="";
userid=userid+myran;
String useridchecker1="select * from users where userid='"+myran+"'";
//check again if the user id has been used
conn.rs=conn.st.executeQuery(useridchecker1);
//******************LEVEL 2 USERID CHECKER***********//
//check contonuously if the userid exists
if(conn.rs.next()){
double myran1=generateRandomNumber(generateRandomNumber(1, 9000), 30000);
userid="";
userid=userid+myran1;
//add to clerks database
conn.st.executeUpdate(save);
//add top users table
conn.st.executeUpdate(add_to_users);
}
//if not replicated, then save to database
else{
System.out.println("worked at second level");
//add to clerks table
conn.st.executeUpdate(save);
//add top users table
conn.st.executeUpdate(add_to_users);
}
}
//finally add to tables in database
else{
System.out.println("duplicate didnt exist::");
//add to clerks table
conn.st.executeUpdate(save);
//add top users table
conn.st.executeUpdate(add_to_users);
}
if(level.equals("0")) {
session.setAttribute("clerk_added", "<font color=\"green\">Administrator added succesfully</font>");
}
if(level.equals("2")){
session.setAttribute("clerk_added", "<font color=\"green\">User added succesfully</font>");
}
if(level.equals("5")) {
session.setAttribute("clerk_added", "<font color=\"green\">Guest added succesfully</font>");
}
}
else{
session.setAttribute("clerk_added", "<b><font color=\"red\">Sorry, That username is already used.Use a different one</font></b>");
}
if(conn.rs!=null){conn.rs.close();}
if(conn.st!=null){conn.st.close();}
if(conn.rs1!=null){conn.rs1.close();}
if(conn.st1!=null){conn.st1.close();}
if(conn.rs2!=null){conn.rs2.close();}
if(conn.st2!=null){conn.st2.close();}
if(conn.st3!=null){conn.st3.close();}
if(conn.pst!=null){conn.pst.close();}
if(conn.pst!=null){conn.pst.close();}
if(conn.pst1!=null){conn.pst1.close();}
if(conn.pst1!=null){conn.pst1.close();}
if(conn.conn!=null){conn.conn.close();}
response.sendRedirect("add_clerk.jsp");
} catch (SQLException ex) {
Logger.getLogger(add_clerk.class.getName()).log(Level.SEVERE, null, ex);
} catch (NoSuchAlgorithmException ex) {
Logger.getLogger(add_clerk.class.getName()).log(Level.SEVERE, null, ex);
}
}
public int generateRandomNumber(int start, int end ){
Random random = new Random();
long fraction = (long) ((end - start + 1 ) * random.nextDouble());
return ((int)(fraction + start));
}
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
|
[
"[email protected]"
] | |
22d5159f6717f711f7802c4b08960e3018e38672
|
65ab4029118e7111dd638f5325323e2e1d163cbb
|
/src/main/java/com/bsport/gateway/filters/SimpleCORSFilter.java
|
64d6941b1219b14f4bd8ea1dddb34a04eb7eccff
|
[] |
no_license
|
bsport062019/gateway
|
d68d7f7005d7f380b3f9c32710d138b1bbbf97bb
|
dbde3415ee41427c0528b3dc684442a20abc63fe
|
refs/heads/master
| 2022-04-10T08:11:30.303993 | 2020-04-05T11:12:26 | 2020-04-05T11:12:26 | 196,680,695 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,596 |
java
|
package com.bsport.gateway.filters;
/**
* Created by IntelliJ IDEA.
*
* @author : truongnq
* @Date time: 2019-04-05 00:30
* To change this template use File | Settings | File Templates.
*/
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.stereotype.Component;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@Component
public class SimpleCORSFilter implements Filter {
private static final Logger LOGGER = LogManager.getLogger(SimpleCORSFilter.class);
public SimpleCORSFilter() {
LOGGER.info("Khoi tao class CORSFilter");
}
@Override
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) res;
response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Access-Control-Allow-Credentials", "true");
response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE, HEAD, PATCH, PUT");
response.setHeader("Access-Control-Max-Age", "3600");
response.setHeader("Access-Control-Allow-Headers", "Content-Type, Authorization, Accept, X-Requested-With, remember-me");
chain.doFilter(req, res);
}
@Override
public void init(FilterConfig filterConfig) {
}
@Override
public void destroy() {
}
}
|
[
"[email protected]"
] | |
c03aef8f6b06a5ba4d791a12b6d2da2632d33c7e
|
fcd987e95e094638282788c0bc5aacf700d09531
|
/src/main/java/hello/core/order/Order.java
|
89e959a32ab9815169abec01b90c1b82a3816f8f
|
[] |
no_license
|
ssda332/spring
|
ce4948f559811365746904055a9c75a777c2acc2
|
3c4c7a747b075431a09bbaa38059d39e7fdcf9a6
|
refs/heads/master
| 2023-04-27T15:35:31.903526 | 2021-05-02T01:50:34 | 2021-05-02T01:50:34 | 357,234,598 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,413 |
java
|
package hello.core.order;
public class Order {
private Long memberId;
private String itemName;
private int itemPrice;
private int discountPrice;
public Order(Long memberId, String itemName, int itemPrice, int discountPrice) {
this.memberId = memberId;
this.itemName = itemName;
this.itemPrice = itemPrice;
this.discountPrice = discountPrice;
}
public Long getMemberId() {
return memberId;
}
public void setMemberId(Long memberId) {
this.memberId = memberId;
}
public String getItemName() {
return itemName;
}
public void setItemName(String itemName) {
this.itemName = itemName;
}
public int getItemPrice() {
return itemPrice;
}
public void setItemPrice(int itemPrice) {
this.itemPrice = itemPrice;
}
public int getDiscountPrice() {
return discountPrice;
}
public void setDiscountPrice(int discountPrice) {
this.discountPrice = discountPrice;
}
public int calculatePrice() {
return itemPrice - discountPrice;
}
@Override
public String toString() {
return "Order{" +
"memberId=" + memberId +
", itemName='" + itemName + '\'' +
", itemPrice=" + itemPrice +
", discountPrice=" + discountPrice +
'}';
}
}
|
[
"[email protected]"
] | |
6d591f7343917c4d814406a2b35a1f1c11b8e37a
|
2f581f068b126fb179d0523a12def1d6be9d5c27
|
/src/test/java/com/company/TestData.java
|
c569425c747daf8592088cfadd4529908a96cbce
|
[] |
no_license
|
FrozenMorozen/cmd-file-data-sorter
|
e834ef8d8ad138581413d36e6b300a693585388c
|
642c8dc2cd216775a82839fac3c2968252079830
|
refs/heads/master
| 2020-07-30T01:40:53.698635 | 2019-10-21T16:22:45 | 2019-10-21T16:22:45 | 210,041,159 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,038 |
java
|
package com.company;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
public class TestData {
public static String FILE_NAME_FOR_CREATING = "/home/denis/test_file.txt";
public static String FILE_NAME_FOR_WRITING = "/home/denis/out.txt";
static File createTestFile(String fileName) {
try {
return new File(String.valueOf(Files.createFile(Paths.get(fileName))));
} catch (IOException e) {
return null;
}
}
public static void deleteTestFile(File file) {
try {
if (file != null) {
Files.delete(Paths.get(file.getAbsolutePath()));
}
} catch (IOException e) {
e.printStackTrace();
}
}
public static List<Object> createStringList() {
List<Object> rightList = new ArrayList<>();
rightList.add("ss");
rightList.add("aa");
rightList.add("bb");
rightList.add("cc");
rightList.add("ff");
rightList.add("cc");
rightList.add("uuu");
return rightList;
}
}
|
[
"[email protected]"
] | |
41579c47f0f74437b8a21c3f6ba35cf000619fed
|
3581ea333137a694eeec2e07da2b3c7b556ac32c
|
/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/providers/jackson2/resource/ProxyWithGenericReturnTypeJacksonAbstractParent.java
|
417f14dea5406a6881e56a2f87e3677f81f3e030
|
[
"Apache-2.0"
] |
permissive
|
fabiocarvalho777/Resteasy
|
d8b39366c50d49d197d5938b97c73b1a5cb581b5
|
94dae2cf6866705fe409048fde78ef2316c93121
|
refs/heads/master
| 2020-12-02T16:28:18.396872 | 2017-07-07T18:36:57 | 2017-07-07T18:36:57 | 96,557,475 | 1 | 0 | null | 2017-07-07T16:41:04 | 2017-07-07T16:41:04 | null |
UTF-8
|
Java
| false | false | 693 |
java
|
package org.jboss.resteasy.test.providers.jackson2.resource;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
@JsonSubTypes({
@JsonSubTypes.Type(value = ProxyWithGenericReturnTypeJacksonType1.class, name = "type1"),
@JsonSubTypes.Type(value = ProxyWithGenericReturnTypeJacksonType2.class, name = "type2")})
public abstract class ProxyWithGenericReturnTypeJacksonAbstractParent {
protected long id;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
}
|
[
"[email protected]"
] | |
a21f0c8ea486f8bbcc557f7f3f9c9d6ed58b2b3f
|
f09632b306e34c1bc42c58b4c9f82f1243d7106c
|
/src/main/java/controller/adminServlet/CensoredPostsServlet.java
|
6fa95a2eaa3fceef75c64eea21526c480767269b
|
[] |
no_license
|
aliaziz/WapFinalProject
|
bc99b177e554ffe2a70c083e662d1c8687fbffa9
|
091f047e12f0180a3c5ec34fe55bed74feab420c
|
refs/heads/master
| 2023-01-12T07:48:42.902162 | 2020-11-18T22:17:22 | 2020-11-18T22:17:22 | 312,055,840 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,547 |
java
|
package controller.adminServlet;
import controller.BaseServlet;
import dao.PostDao;
import model.Post;
import utils.ServletUrl;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
@WebServlet(urlPatterns = {ServletUrl.CENSORED_POST_SERVLET, "/admin" + ServletUrl.CENSORED_POST_SERVLET})
public class CensoredPostsServlet extends BaseServlet {
private final PostDao postDao = new PostDao();
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
List<Post> postList = postDao.getUnhealthyPost();
req.getSession().setAttribute("unhealthyPost", postList);
resp.sendRedirect("censoredPosts.jsp");
}
@Override
protected void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
int postId = Integer.parseInt(req.getParameter("postId"));
if(postDao.deleteUnhealthyPost(postId)) resp.getWriter().write("success");
else resp.getWriter().write("failed");
}
@Override
protected void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
int postId = Integer.parseInt(req.getParameter("postId"));
if(postDao.liveUnhealthyPost(postId)) resp.getWriter().write("success");
else resp.getWriter().write("failed");
}
}
|
[
"[email protected]"
] | |
c0bb96f524954fefcbed49a72b957ae9bad678b9
|
cf648ca0184c62947544d77d0d4519bc3dfccf8c
|
/course_work_front/src/sample/controllers/ErrorsPageController.java
|
79a57de2b0cafbbb6dafda69d8ff6b8a6289af5f
|
[] |
no_license
|
CheGevarAa/courseach
|
0640d9a621edddd884f913e0421f03334addf401
|
fe274649140f531a646615e84e5d7f5a55ec4654
|
refs/heads/main
| 2023-04-26T21:00:51.064379 | 2021-05-04T16:32:30 | 2021-05-04T16:32:30 | 359,894,556 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,459 |
java
|
package sample.controllers;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.scene.control.Alert;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.stage.Stage;
import sample.models.Employee;
import sample.models.Errors;
import sample.models.Report;
import sample.utils.EmployeeRequests;
import sample.utils.ErrorsRequests;
import sample.utils.ReportRequests;
import java.io.IOException;
public class ErrorsPageController {
/**
* Модуль контроллера страницы приложения, содержащей данные об ошибках
* В данном модуле прописано программное заполнение объектов формы необходимыми данными
* при помощью метода инициализации
*/
@FXML
private TableView<Errors> err_table;
@FXML
private TableColumn<Errors, Long> error_code;
@FXML
private TableColumn<Errors, String> error_name;
private Stage stage;
private ObservableList<Errors> errors;
MainController controller = new MainController();
public void initialize(Stage stage, ObservableList<Errors> errors){
this.stage=stage;
this.errors=errors;
err_table.setItems(errors);
error_code.setCellValueFactory(cellData -> cellData.getValue().error_codeProperty().asObject());
error_name.setCellValueFactory(cellData -> cellData.getValue().descriptionProperty());
}
@FXML
private void handleNewError() throws IOException {
Errors tempError = new Errors();
Errors resError = controller.showErrorEditPage(stage, tempError);
if(resError != null){
errors.add(resError);
ErrorsRequests.createError(resError);
}
}
@FXML
private void handleEditError() throws IOException {
Errors tempError = err_table.getSelectionModel().getSelectedItem();
Errors resError = controller.showErrorEditPage(stage, tempError);
if(resError != null) {
ErrorsRequests.updateError(resError);
}
}
@FXML
public void handleDeleteError(){
int selected = err_table.getSelectionModel().getSelectedIndex();
if(selected>=0){
Boolean res = ErrorsRequests.deleteError(err_table.getSelectionModel().getSelectedItem());
if(res){
err_table.getItems().remove(selected);
}else{
Alert alert = new Alert(Alert.AlertType.WARNING);
alert.initOwner(stage);
alert.setTitle("Error");
alert.setHeaderText("Could not delete this employee");
alert.setContentText("Try again");
alert.showAndWait();
}
}else{
Alert alert = new Alert(Alert.AlertType.WARNING);
alert.initOwner(stage);
alert.setTitle("Error");
alert.setHeaderText("Nothing to delete");
alert.setContentText("Select object to delete");
alert.showAndWait();
}
}
@FXML
public void handleStatistics() throws IOException {
ObservableList<Report> errors = ReportRequests.getAll();
controller.showStatisticsPage(stage, errors);
}
}
|
[
"[email protected]"
] | |
f6b57fb86afa7e119a168bf39592e231204eaf01
|
fa91450deb625cda070e82d5c31770be5ca1dec6
|
/Diff-Raw-Data/10/10_da9567d43370d509bbd57dccabd9eb46a77c1ca5/ClientSearchRequestTest/10_da9567d43370d509bbd57dccabd9eb46a77c1ca5_ClientSearchRequestTest_s.java
|
fe18c74d1259447daec8571be76f8f7bca16b8c0
|
[] |
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 | 10,444 |
java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.directory.shared.client.api.operations.search;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
import java.util.concurrent.TimeUnit;
import org.apache.directory.ldap.client.api.LdapNetworkConnection;
import org.apache.directory.ldap.client.api.future.SearchFuture;
import org.apache.directory.server.annotations.CreateLdapServer;
import org.apache.directory.server.annotations.CreateTransport;
import org.apache.directory.server.core.annotations.ApplyLdifs;
import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
import org.apache.directory.server.core.integ.FrameworkRunner;
import org.apache.directory.shared.client.api.LdapApiIntegrationUtils;
import org.apache.directory.shared.ldap.model.cursor.Cursor;
import org.apache.directory.shared.ldap.model.cursor.EntryCursor;
import org.apache.directory.shared.ldap.model.entry.Entry;
import org.apache.directory.shared.ldap.model.message.AliasDerefMode;
import org.apache.directory.shared.ldap.model.message.Response;
import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
import org.apache.directory.shared.ldap.model.message.SearchRequest;
import org.apache.directory.shared.ldap.model.message.SearchRequestImpl;
import org.apache.directory.shared.ldap.model.message.SearchResultDone;
import org.apache.directory.shared.ldap.model.message.SearchScope;
import org.apache.directory.shared.ldap.model.message.controls.ManageDsaITImpl;
import org.apache.directory.shared.ldap.model.name.Dn;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* TODO ClientSearchRequestTest.
*
* @author <a href="mailto:[email protected]">Apache Directory Project</a>
*/
@RunWith(FrameworkRunner.class)
@CreateLdapServer(transports =
{ @CreateTransport(protocol = "LDAP"), @CreateTransport(protocol = "LDAPS") })
@ApplyLdifs(
{
"dn: cn=user1,ou=users,ou=system",
"objectClass: person",
"objectClass: top",
"sn: user1 sn",
"cn: user1",
// alias to the above entry
"dn: cn=user1-alias,ou=users,ou=system",
"objectClass: alias",
"objectClass: top",
"objectClass: extensibleObject",
"aliasedObjectName: cn=user1,ou=users,ou=system",
"cn: user1-alias",
// Another user
"dn: cn=elecharny,ou=users,ou=system",
"objectClass: top",
"objectClass: person",
"objectClass: extensibleObject",
"sn:: RW1tYW51ZWwgTMOpY2hhcm55",
"cn: elecharny",
"publicKey:: MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKbHnLFs5N2PHk0gkyI/g3XeIdjxnWOAW5RVap4zWZuNY4gNGH1MhfHPVHcy6WEMoo+zaxU0Xh+Iv6BzrIa70IUCAwEAAQ=="
})
public class ClientSearchRequestTest extends AbstractLdapTestUnit
{
private LdapNetworkConnection connection;
@Before
public void setup() throws Exception
{
connection = LdapApiIntegrationUtils.getPooledAdminConnection( getLdapServer() );
}
@After
public void shutdown() throws Exception
{
LdapApiIntegrationUtils.releasePooledAdminConnection( connection, getLdapServer() );
}
@Test
public void testSimpleSearch() throws Exception
{
EntryCursor cursor = connection.search( "ou=system", "(objectclass=*)", SearchScope.ONELEVEL );
int count = 0;
while ( cursor.next() )
{
Entry entry = cursor.get();
assertNotNull( entry );
count++;
}
SearchResultDone done = cursor.getSearchResultDone();
assertNotNull( done );
assertEquals( ResultCodeEnum.SUCCESS, done.getLdapResult().getResultCode() );
assertEquals( 5, count );
cursor.close();
}
@Test
public void testSimpleSearchWithControl() throws Exception
{
SearchRequest searchRequest = new SearchRequestImpl().setBase( new Dn( "ou=system" ) )
.setFilter( "(objectclass=*)" )
.setScope( SearchScope.ONELEVEL ).addControl( new ManageDsaITImpl() );
EntryCursor cursor = connection.search( "ou=system", "(objectclass=*)", SearchScope.ONELEVEL );
int count = 0;
while ( cursor.next() )
{
Entry entry = cursor.get();
assertNotNull( entry );
count++;
}
SearchResultDone done = cursor.getSearchResultDone();
assertNotNull( done );
assertEquals( ResultCodeEnum.SUCCESS, done.getLdapResult().getResultCode() );
assertEquals( 5, count );
cursor.close();
}
@Test
public void testSearch() throws Exception
{
EntryCursor cursor = connection.search( "ou=system", "(objectclass=*)",
SearchScope.ONELEVEL,
"*", "+" );
int count = 0;
while ( cursor.next() )
{
assertNotNull( cursor.get() );
count++;
}
SearchResultDone done = cursor.getSearchResultDone();
assertNotNull( done );
assertEquals( ResultCodeEnum.SUCCESS, done.getLdapResult().getResultCode() );
assertEquals( 5, count );
cursor.close();
}
@Test
public void testSearchEquality() throws Exception
{
EntryCursor cursor = connection.search( "ou=system", "(objectclass=organizationalUnit)",
SearchScope.ONELEVEL, "*", "+" );
int count = 0;
while ( cursor.next() )
{
Entry entry = cursor.get();
assertNotNull( entry );
count++;
}
assertEquals( 4, count );
cursor.close();
}
@Test
public void testAsyncSearch() throws Exception
{
SearchFuture searchFuture = connection.searchAsync( "ou=system", "(objectclass=*)", SearchScope.ONELEVEL, "*",
"+" );
int count = 0;
Response searchResponse = null;
do
{
searchResponse = searchFuture.get( 1000, TimeUnit.MILLISECONDS );
assertNotNull( searchResponse );
if ( !( searchResponse instanceof SearchResultDone ) )
{
count++;
}
}
while ( !( searchResponse instanceof SearchResultDone ) );
assertEquals( 5, count );
}
/**
* Test a search with a Substring filter
* @throws Exception
*/
@Test
public void testSearchPersonSubstring() throws Exception
{
SearchFuture searchFuture = connection.searchAsync( "ou=system", "(objectclass=*ers*)", SearchScope.SUBTREE,
"*", "+" );
int count = 0;
Response searchResponse = null;
do
{
searchResponse = searchFuture.get( 100000, TimeUnit.MILLISECONDS );
assertNotNull( searchResponse );
if ( !( searchResponse instanceof SearchResultDone ) )
{
count++;
}
}
while ( !( searchResponse instanceof SearchResultDone ) );
assertEquals( 3, count );
}
@Test
public void testSearchWithDerefAlias() throws Exception
{
SearchRequest searchRequest = new SearchRequestImpl();
searchRequest.setBase( new Dn( "ou=users,ou=system" ) );
searchRequest.setFilter( "(objectClass=*)" );
searchRequest.setScope( SearchScope.ONELEVEL );
searchRequest.addAttributes( "*" );
int count = 0;
Cursor<Response> cursor = connection.search( searchRequest );
while ( cursor.next() )
{
count++;
}
cursor.close();
// due to dereferencing of aliases we get only one entry
assertEquals( 2, count );
count = 0;
searchRequest.setDerefAliases( AliasDerefMode.NEVER_DEREF_ALIASES );
cursor = connection.search( searchRequest );
while ( cursor.next() )
{
count++;
}
cursor.close();
assertEquals( 3, count );
}
@Test
public void testSearchUTF8() throws Exception
{
EntryCursor cursor = connection.search( "ou=users,ou=system", "(sn=Emmanuel L\u00E9charny)", SearchScope.ONELEVEL, "*", "+" );
assertFalse (cursor.next() );
cursor.close();
}
@Test
public void testSearchBinary() throws Exception
{
connection.loadSchema();
EntryCursor cursor = connection.search( "ou=system", "(publicKey=\\30\\5C\\30\\0D\\06\\09\\2A\\86\\48\\86\\F7\\0D\\01\\01\\01\\05\\00\\03\\4B\\00\\30\\48\\02\\41\\00\\A6\\C7\\9C\\B1\\6C\\E4\\DD\\8F\\1E\\4D\\20\\93\\22\\3F\\83\\75\\DE\\21\\D8\\F1\\9D\\63\\80\\5B\\94\\55\\6A\\9E\\33\\59\\9B\\8D\\63\\88\\0D\\18\\7D\\4C\\85\\F1\\CF\\54\\77\\32\\E9\\61\\0C\\A2\\8F\\B3\\6B\\15\\34\\5E\\1F\\88\\BF\\A0\\73\\AC\\86\\BB\\D0\\85\\02\\03\\01\\00\\01)", SearchScope.SUBTREE, "publicKey" );
assertTrue( cursor.next() );
Entry entry = cursor.get();
assertNotNull( entry.get( "publicKey" ) );
cursor.close();
}
}
|
[
"[email protected]"
] | |
6f60cd852be64f3ad3ae5334fe5b3fb5a89bb19c
|
619a7999f5500992ac556bfada05d64119bf3cce
|
/src/main/java/by/epam/carrentalapp/service/UserService.java
|
23644d216f755f3970d91b5d11e70abaec933e93
|
[] |
no_license
|
IvanSinegovsky/epam-final-project
|
89a37b5d042b854ceb1cf7f5cb2b5695bbe5f224
|
59532658db7fad1b38927d5567ae2311d812e83c
|
refs/heads/master
| 2023-06-09T13:58:30.246841 | 2021-07-01T18:41:35 | 2021-07-01T18:41:35 | 365,021,384 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 362 |
java
|
package by.epam.carrentalapp.service;
import by.epam.carrentalapp.bean.dto.LoginUserDto;
import by.epam.carrentalapp.bean.entity.user.User;
import java.util.Optional;
public interface UserService {
Optional<User> login(LoginUserDto userDto);
void registerCustomer(String name, String lastname,String email, String password, String passportNumber);
}
|
[
"[email protected]"
] | |
0c426bf10dcd99ebefcb16fd47a4b3d9eb23ac45
|
657156f1c7745248bdb1444303e79eab89bb0233
|
/src/main/java/hellfirepvp/astralsorcery/common/item/gem/GemAttributeHelper.java
|
c9c4b787810dfcb9b14ed29527e483bb3cca903d
|
[] |
no_license
|
Mekle001/AstralSorcery
|
dd4c36d12ee2460cc5eb1be09c85f1ac64e728c5
|
79d141797fa4f55ba04a457de3a26b1830fcb0fd
|
refs/heads/master
| 2020-04-08T23:45:15.663207 | 2018-11-29T13:30:57 | 2018-11-29T13:30:57 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 13,536 |
java
|
/*******************************************************************************
* HellFirePvP / Astral Sorcery 2018
*
* All rights reserved.
* The source code is available on github: https://github.com/HellFirePvP/AstralSorcery
* For further details, see the License file there.
******************************************************************************/
package hellfirepvp.astralsorcery.common.item.gem;
import com.google.common.collect.Maps;
import hellfirepvp.astralsorcery.AstralSorcery;
import hellfirepvp.astralsorcery.common.constellation.perk.attribute.AttributeTypeRegistry;
import hellfirepvp.astralsorcery.common.constellation.perk.attribute.GemAttributeModifier;
import hellfirepvp.astralsorcery.common.constellation.perk.attribute.PerkAttributeModifier;
import hellfirepvp.astralsorcery.common.data.config.entry.ConfigEntry;
import hellfirepvp.astralsorcery.common.util.MiscUtils;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.config.Configuration;
import javax.annotation.Nullable;
import java.util.*;
/**
* This class is part of the Astral Sorcery Mod
* The complete source code for this mod can be found on github.
* Class: GemAttributeHelper
* Created by HellFirePvP
* Date: 18.11.2018 / 10:00
*/
public class GemAttributeHelper {
private static final Random rand = new Random();
private static Map<String, Integer> weightedModifiers = new HashMap<String, Integer>() {
{
put(AttributeTypeRegistry.ATTR_TYPE_HEALTH, 12);
put(AttributeTypeRegistry.ATTR_TYPE_MOVESPEED, 8);
put(AttributeTypeRegistry.ATTR_TYPE_ARMOR, 8);
put(AttributeTypeRegistry.ATTR_TYPE_REACH, 4);
put(AttributeTypeRegistry.ATTR_TYPE_ATTACK_SPEED, 2);
put(AttributeTypeRegistry.ATTR_TYPE_MELEE_DAMAGE, 8);
put(AttributeTypeRegistry.ATTR_TYPE_PROJ_DAMAGE, 8);
put(AttributeTypeRegistry.ATTR_TYPE_LIFE_RECOVERY, 2);
put(AttributeTypeRegistry.ATTR_TYPE_INC_HARVEST_SPEED, 2);
put(AttributeTypeRegistry.ATTR_TYPE_INC_CRIT_CHANCE, 4);
put(AttributeTypeRegistry.ATTR_TYPE_INC_CRIT_MULTIPLIER, 4);
put(AttributeTypeRegistry.ATTR_TYPE_INC_ALL_ELEMENTAL_RESIST, 2);
put(AttributeTypeRegistry.ATTR_TYPE_INC_DODGE, 2);
put(AttributeTypeRegistry.ATTR_TYPE_INC_PERK_EXP, 1);
//TC runic shielding
put(AstralSorcery.MODID + ".compat.thaumcraft.runicshield", 2);
}
};
private static Map<String, Integer> configuredModifiers = Maps.newHashMap();
private static float chance3Modifiers = 0.2F;
private static float chance4Modifiers = 0.05F;
private static boolean allowDuplicateTypes = false;
private static float incModifierLower = 0.05F;
private static float incModifierHigher = 0.08F;
private static boolean allowNegativeModifiers = false;
private static float chanceNegative = 0.25F;
private static float decModifierLower = 0.05F;
private static float decModifierHigher = 0.08F;
private static boolean allowMoreLessModifiers = false;
private static float chanceMultiplicative = 0.1F;
private static float moreModifierLower = 0.05F;
private static float moreModifierHigher = 0.08F;
private static float lessModifierLower = 0.05F;
private static float lessModifierHigher = 0.08F;
public static boolean rollGem(ItemStack gem) {
return rollGem(gem, rand);
}
public static boolean rollGem(ItemStack gem, Random random) {
if (!ItemPerkGem.getModifiers(gem).isEmpty()) {
return false;
}
int rolls = getPotentialMods(random);
List<GemAttributeModifier> mods = new ArrayList<>();
for (int i = 0; i < rolls; i++) {
String type = null;
if (allowDuplicateTypes) {
type = MiscUtils.getWeightedRandomEntry(configuredModifiers.keySet(),
random, s -> configuredModifiers.getOrDefault(s, 1));
} else {
List<String> keys = new ArrayList<>(configuredModifiers.keySet());
while (!keys.isEmpty() && type == null) {
String item = getWeightedResultAndRemove(keys, random);
if (item != null) {
boolean foundType = false;
for (GemAttributeModifier m : mods) {
if (m.getAttributeType().equals(item)) {
foundType = true;
}
}
if (foundType) {
continue;
}
type = item;
}
}
}
if (type == null) {
continue;
}
boolean isNegative = allowNegativeModifiers && random.nextFloat() < chanceNegative;
boolean isMultiplicative = allowMoreLessModifiers && random.nextFloat() < chanceMultiplicative;
float lower = isNegative ? (isMultiplicative ? lessModifierLower : decModifierLower) : (isMultiplicative ? moreModifierLower : incModifierLower);
float higher = isNegative ? (isMultiplicative ? lessModifierHigher : decModifierHigher) : (isMultiplicative ? moreModifierHigher : incModifierHigher);
float value;
if (lower > higher) {
value = lower;
} else {
value = lower + (random.nextFloat() * (higher - lower));
}
PerkAttributeModifier.Mode mode = isMultiplicative ? PerkAttributeModifier.Mode.STACKING_MULTIPLY : PerkAttributeModifier.Mode.ADDED_MULTIPLY;
float rValue = isMultiplicative ? 1F + value : value;
if (allowDuplicateTypes) {
String fType = type;
GemAttributeModifier existing = MiscUtils.iterativeSearch(mods,
mod -> mod.getAttributeType().equals(fType) && mod.getMode().equals(mode));
if (existing != null) {
mods.remove(existing);
float combinedValue;
if (isMultiplicative) {
combinedValue = (existing.getFlatValue() - 1F) + (rValue - 1F);
} else {
combinedValue = existing.getFlatValue() + rValue;
}
if (combinedValue != 0F) {
mods.add(new GemAttributeModifier(UUID.randomUUID(), type, mode, isMultiplicative ? combinedValue + 1 : combinedValue));
} //If == 0 -> don't re-add anything.
} else {
mods.add(new GemAttributeModifier(UUID.randomUUID(), type, mode, rValue));
}
} else {
mods.add(new GemAttributeModifier(UUID.randomUUID(), type, mode, rValue));
}
}
ItemPerkGem.setModifiers(gem, mods);
return true;
}
@Nullable
private static String getWeightedResultAndRemove(List<String> list, Random random) {
if (list.isEmpty()) {
return null;
}
String result = MiscUtils.getWeightedRandomEntry(list, random, s -> configuredModifiers.getOrDefault(s, 1));
if (result != null) {
list.remove(result);
}
return result;
}
private static int getPotentialMods(Random random) {
int mods = 2;
if (random.nextFloat() < chance3Modifiers) {
mods++;
if (random.nextFloat() < chance4Modifiers) {
mods++;
}
}
return mods;
}
public static class CfgEntry extends ConfigEntry {
public CfgEntry() {
super(Section.PERKS, "gem");
}
@Override
public void loadFromConfig(Configuration cfg) {
configuredModifiers.clear();
List<String> flattened = MiscUtils.flatten(weightedModifiers, (key, weight) -> key + "=" + weight);
String[] arr = flattened.toArray(new String[flattened.size()]);
String[] configuredList = cfg.getStringList(getKey() + "WeightedModifiers", getConfigurationSection(),
arr, "List of weighted modifiers the gem may roll. Format: 'modifier=weight'");
fillModifiers(configuredList);
allowDuplicateTypes = cfg.getBoolean(getKey() + "AllowDuplicateTypes", getConfigurationSection(), allowDuplicateTypes,
"If this is set to true, the same type of modifier (e.g. maxhealth) can roll multiple times");
chance3Modifiers = cfg.getFloat(getKey() + "Chance3Modifiers", getConfigurationSection(), chance3Modifiers, 0F, 1F,
"Defines the chance the gem can roll a 3rd modifier. The lower this chance, the rarer.");
chance4Modifiers = cfg.getFloat(getKey() + "Chance4Modifiers", getConfigurationSection(), chance4Modifiers, 0F, 1F,
"Defines the chance the gem can roll a 4th modifier. A 3rd modifier MUST be rolled before and the chances are independent of each other. The lower this chance, the rarer.");
allowNegativeModifiers = cfg.getBoolean(getKey() + "AllowNegativeModifier", getConfigurationSection(), allowNegativeModifiers,
"If this is set to true, a modifier may roll negative instead of positive, depending on the configured chance (see ChanceNegativeModifier)");
chanceNegative = cfg.getFloat(getKey() + "ChanceNegativeModifier", getConfigurationSection(), chanceNegative, 0F, 1F,
"If 'AllowNegativeModifier' is set to true, this defines the chance a given modifier may be negative instead of positive.");
allowMoreLessModifiers = cfg.getBoolean(getKey() + "AllowMoreLessModifier", getConfigurationSection(), allowMoreLessModifiers,
"If this is set to true, a modifier may roll to be 'more'/'less' instead of 'increased'/'decreased', depending on the configured chance (see ChanceMoreLessModifier)");
chanceMultiplicative = cfg.getFloat(getKey() + "ChanceMoreLessModifier", getConfigurationSection(), chanceMultiplicative, 0F, 1F,
"If 'AllowMoreLessModifier' is set to true, this defines the chance a given modifier may be 'more'/'less' instead of 'increased'/'decreased'.");
String section = getConfigurationSection() + ".ranges";
incModifierLower = cfg.getFloat("Increased_Lower_Bound", section, incModifierLower, 0F, 1F,
"Defines the lower bound an 'increased' modifier can roll. Value is in percent (0.01 means 1%, 0.1 means 10%, ...)");
incModifierHigher = cfg.getFloat("Increased_Higher_Bound", section, incModifierHigher, 0F, 1F,
"Defines the lower bound an 'increased' modifier can roll. Value is in percent (0.01 means 1%, 0.1 means 10%, ...)");
decModifierLower = cfg.getFloat("Decreased_Lower_Bound", section, decModifierLower, 0F, 1F,
"Defines the lower bound an 'decreased' modifier can roll. Value is in percent (0.01 means 1%, 0.1 means 10%, ...)");
decModifierHigher = cfg.getFloat("Decreased_Higher_Bound", section, decModifierHigher, 0F, 1F,
"Defines the lower bound an 'decreased' modifier can roll. Value is in percent (0.01 means 1%, 0.1 means 10%, ...)");
moreModifierLower = cfg.getFloat("More_Lower_Bound", section, moreModifierLower, 0F, 1F,
"Defines the lower bound an 'more' modifier can roll. Value is in percent (0.01 means 1%, 0.1 means 10%, ...)");
moreModifierHigher = cfg.getFloat("More_Higher_Bound", section, moreModifierHigher, 0F, 1F,
"Defines the lower bound an 'more' modifier can roll. Value is in percent (0.01 means 1%, 0.1 means 10%, ...)");
lessModifierLower = cfg.getFloat("Less_Lower_Bound", section, lessModifierLower, 0F, 1F,
"Defines the lower bound an 'less' modifier can roll. Value is in percent (0.01 means 1%, 0.1 means 10%, ...)");
lessModifierHigher = cfg.getFloat("Less_Higher_Bound", section, lessModifierHigher, 0F, 1F,
"Defines the lower bound an 'less' modifier can roll. Value is in percent (0.01 means 1%, 0.1 means 10%, ...)");
}
private void fillModifiers(String[] configuredList) {
for (String s : configuredList) {
String[] spl = s.split("=");
if (spl.length != 2) {
AstralSorcery.log.info("Ignoring wrong format for gem attribute modifier: " + s + " (Too many/not enough '=' found!)");
continue;
}
String key = spl[0];
String strWeight = spl[1];
int weight;
try {
weight = Integer.parseInt(strWeight);
} catch (NumberFormatException exc) {
AstralSorcery.log.info("Ignoring wrong format for gem attribute modifier: " + s + " (The weight '" + strWeight + "' is not an integer number!)");
continue;
}
configuredModifiers.put(key, weight);
}
}
}
}
|
[
"[email protected]"
] | |
f8772b363dc46063e6c5fc5ac9e3864b460d45d3
|
2e98a39e61db1e5da89a71607b13082af4ddca94
|
/flexwdreanew/src/com/flexwm/server/cm/WFlowOpportunityLoose.java
|
0bec58dd2d2a180c61aab77fdab76c40070f7175
|
[] |
no_license
|
ceherrera-sym/flexwm-dreanew
|
59b927a48a8246babe827f19a131b9129abe2a52
|
228ed7be7718d46a1f2592c253b096e1b942631e
|
refs/heads/master
| 2022-12-18T13:44:42.804524 | 2020-09-15T15:01:52 | 2020-09-15T15:01:52 | 285,393,781 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,606 |
java
|
package com.flexwm.server.cm;
import com.flexwm.server.wf.IWFlowAction;
import com.flexwm.server.wf.PmWFlow;
import com.flexwm.server.wf.PmWFlowLog;
import com.flexwm.shared.cm.BmoCustomer;
import com.flexwm.shared.cm.BmoLoseMotive;
import com.flexwm.shared.cm.BmoOpportunity;
import com.flexwm.shared.cm.BmoQuote;
import com.flexwm.shared.wf.BmoWFlow;
import com.flexwm.shared.wf.BmoWFlowLog;
import com.flexwm.shared.wf.BmoWFlowStep;
import com.symgae.server.PmConn;
import com.symgae.shared.BmUpdateResult;
import com.symgae.shared.SFException;
import com.symgae.shared.SFParams;
public class WFlowOpportunityLoose implements IWFlowAction {
@Override
public void action(SFParams sFParams, PmConn pmConn, BmoWFlowStep bmoWFlowStep, BmUpdateResult bmUpdateResult) throws SFException {
// Se gana la oportunidad dependiendo del avance de la tarea
PmOpportunity pmOpportunity = new PmOpportunity(sFParams);
BmoOpportunity bmoOpportunity = (BmoOpportunity)pmOpportunity.get(pmConn, bmoWFlowStep.getBmoWFlow().getCallerId().toInteger());
// Obtener el flujo
PmWFlow pmWFlow = new PmWFlow(sFParams);
BmoWFlow bmoWFlow = (BmoWFlow)pmWFlow.get(pmConn, bmoOpportunity.getWFlowId().toInteger());
PmWFlowLog pmWFlowLog = new PmWFlowLog(sFParams);
// Obtiene datos del cliente
PmCustomer pmCustomer = new PmCustomer(sFParams);
BmoCustomer bmoCustomer = (BmoCustomer)pmCustomer.get(pmConn, bmoOpportunity.getCustomerId().toInteger());
// Si la oportunidad no esta ganada o perdida y la tarea esta al 100, cambia status
if (bmoWFlowStep.getProgress().toInteger() == 100 && bmoOpportunity.getStatus().toChar() != BmoOpportunity.STATUS_LOST
|| bmoOpportunity.getStatus().toChar() != BmoOpportunity.STATUS_WON) {
bmoOpportunity.getStatus().setValue(BmoOpportunity.STATUS_LOST);
pmOpportunity.saveSimple(pmConn, bmoOpportunity, bmUpdateResult);
String motives = "";
//if (bmoOpportunity.getBmoOrderType().getType().equals(BmoOrderType.TYPE_PROPERTY)) {
// En caso de establecer como perdida la oportunidad, forzar ingreso del motivo
if (bmoOpportunity.getStatus().toChar() == BmoOpportunity.STATUS_LOST) {
if (!(bmoOpportunity.getLoseMotiveId().toInteger() > 0))
bmUpdateResult.addError(bmoOpportunity.getLoseMotiveId().getName(), "Debe asigarse el Motivo de Perder en la Oportunidad.");
else{
PmLoseMotive pmLoseMotive = new PmLoseMotive(sFParams);
BmoLoseMotive bmoLoseMotive = (BmoLoseMotive)pmLoseMotive.get(bmoOpportunity.getLoseMotiveId().toInteger());
motives = bmoLoseMotive.getName().toString() + " | "+ bmoOpportunity.getLoseComments().toString();
}
}
//}
pmWFlowLog.addLog(pmConn, bmUpdateResult, bmoOpportunity.getWFlowId().toInteger(), BmoWFlowLog.TYPE_OTHER, "Oportunidad Perdida a través de la Tarea: " + bmoWFlowStep.getName().toString() + ", Motivo: " + motives);
//Cancelar cotización
PmQuote pmQuote = new PmQuote(sFParams);
BmoQuote bmoQuote = new BmoQuote();
bmoQuote = (BmoQuote)pmQuote.get(pmConn, bmoOpportunity.getQuoteId().toInteger());
if (bmoQuote.getWFlowId().toInteger() > 0){
bmoQuote.getStatus().setValue(BmoQuote.STATUS_CANCELLED);
pmQuote.saveSimple(pmConn, bmoQuote, bmUpdateResult);
pmWFlowLog.addLog(pmConn, bmUpdateResult, bmoQuote.getWFlowId().toInteger(), BmoWFlowLog.TYPE_OTHER, "La Cotización se guardó como Cancelada.");
}
// Deshabilitar flujo
bmoWFlow.getStatus().setValue(BmoWFlow.STATUS_INACTIVE);
pmWFlow.saveSimple(pmConn, bmoWFlow, bmUpdateResult);
//Actualizar estatus del cliente
pmCustomer.updateStatus(pmConn, bmoCustomer, bmUpdateResult);
}
// Si el avance es menor a 100 y la oportunidad esta autorizada, regresarlo
else if (bmoWFlowStep.getProgress().toInteger() < 100 && bmoOpportunity.getStatus().toChar() == BmoOpportunity.STATUS_LOST) {
//Si tiene permiso para cambiar estatus de la oportunidad cambia estatus desde la tarea
if (sFParams.hasSpecialAccess(BmoOpportunity.ACCESS_CHANGESTATUS)) {
bmoOpportunity.getStatus().setValue(BmoOpportunity.STATUS_REVISION);
pmOpportunity.saveSimple(pmConn, bmoOpportunity, bmUpdateResult);
pmWFlowLog.addLog(pmConn, bmUpdateResult, bmoOpportunity.getWFlowId().toInteger(), BmoWFlowLog.TYPE_OTHER, "Oportunidad En Revisión a través de la Tarea: " + bmoWFlowStep.getName().toString());
// Habilitar flujo
bmoWFlow.getStatus().setValue(BmoWFlow.STATUS_ACTIVE);
pmWFlow.saveSimple(pmConn, bmoWFlow, bmUpdateResult);
//Actualizar estatus del cliente
pmCustomer.updateStatus(pmConn, bmoCustomer, bmUpdateResult);
}
}
}
}
|
[
"[email protected]"
] | |
33e038e6f32c29269111c0f08c5823819adabd39
|
0ac28b7e3cb0c11a028c529d1720547ec7b60a06
|
/src/main/java/osm5/ns/yang/nfvo/mano/types/rev170208/guest/epa/guest/epa/numa/policy/numa/aware/numa/node/policy/node/OmNumaType.java
|
924b3cdd13bb5f3909252811ba0393cabbd57504
|
[
"Apache-2.0"
] |
permissive
|
openslice/io.openslice.sol005nbi.osm5
|
5d76e8dd9b4170bdbb9b2359459371abb2324d41
|
f4f6cf80dbd61f5336052ebfcd572ae238d68d89
|
refs/heads/master
| 2021-11-18T00:35:31.753227 | 2020-06-15T15:50:33 | 2020-06-15T15:50:33 | 198,384,737 | 0 | 0 |
Apache-2.0
| 2021-08-02T17:18:18 | 2019-07-23T08:16:53 |
Java
|
UTF-8
|
Java
| false | false | 2,301 |
java
|
/*-
* ========================LICENSE_START=================================
* io.openslice.sol005nbi.osm5
* %%
* Copyright (C) 2019 openslice.io
* %%
* 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.
* =========================LICENSE_END==================================
*/
package osm5.ns.yang.nfvo.mano.types.rev170208.guest.epa.guest.epa.numa.policy.numa.aware.numa.node.policy.node;
import org.opendaylight.yangtools.yang.binding.ChoiceIn;
import org.opendaylight.yangtools.yang.common.QName;
import osm5.ns.yang.nfvo.mano.types.rev170208.$YangModuleInfoImpl;
import osm5.ns.yang.nfvo.mano.types.rev170208.guest.epa.guest.epa.numa.policy.numa.aware.numa.node.policy.Node;
/**
* OpenMANO Numa type selection
*
* <p>
* This class represents the following YANG schema fragment defined in module <b>mano-types</b>
* <pre>
* choice om-numa-type {
* case cores {
* leaf num-cores {
* type uint8;
* }
* }
* case paired-threads {
* container paired-threads {
* leaf num-paired-threads {
* type uint8;
* }
* list paired-thread-ids {
* max-elements 16;
* key thread-a;
* leaf thread-a {
* type uint8;
* }
* leaf thread-b {
* type uint8;
* }
* }
* }
* }
* case threads {
* leaf num-threads {
* type uint8;
* }
* }
* }
* </pre>The schema path to identify an instance is
* <i>mano-types/guest-epa/guest-epa/numa-policy/numa-aware/numa-node-policy/node/om-numa-type</i>
*
*/
public interface OmNumaType
extends
ChoiceIn<Node>
{
public static final QName QNAME = $YangModuleInfoImpl.qnameOf("om-numa-type");
}
|
[
"[email protected]"
] | |
ca45f71c5690b1f45dec0991b890076382034ffd
|
1406c14398e44c694ec212c64b24eba31cca5a84
|
/src/com/tutorial/main/SmartEnemy.java
|
f06787cf4b62e593da98530b93e0c43e3ff80d3c
|
[] |
no_license
|
kuccello/letsmakeagame
|
faa056e4c7c10ce7e2fbf6dd554469e56da5d0d1
|
877cdc5c5c2bc34312ccc1bfc590a56308b01eff
|
refs/heads/master
| 2021-01-22T09:32:04.015459 | 2015-04-13T13:37:03 | 2015-04-13T13:37:03 | 33,870,402 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,311 |
java
|
package com.tutorial.main;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
public class SmartEnemy extends GameObject {
private Handler handler;
private GameObject player;
public SmartEnemy(float x, float y, ID id, Handler handler) {
super(x, y, id);
this.handler = handler;
for (GameObject gObj : handler.object) {
if (gObj.getId() == ID.PLAYER) {
player = gObj;
}
}
}
@Override
public void tick() {
x += velX;
y += velY;
float diffX = x - player.getX() - 8;
float diffY = y - player.getY() - 8;
float distance = (float) Math.sqrt(((x - player.getX())*(x - player.getX())) + ((y - player.getY())*(y - player.getY())) );
velX = (int) ((-1.0/distance) * diffX);
velY = (int) ((-1.0/distance) * diffY);
if (y <= 0 || y >= Game.HEIGHT - 32) {
velY *= -1;
}
if (x <= 0 || x >= Game.WIDTH - 32) {
velX *= -1;
}
handler.addObject(new Trail(x, y, ID.TRAIL, Color.cyan, 16, 16, 0.02f, handler));
}
@Override
public void render(Graphics g) {
g.setColor(Color.GREEN);
g.fillRect((int)x, (int)y, 16, 16);
Graphics2D g2d = (Graphics2D) g;
g.setColor(Color.RED);
g2d.draw(getBounds());
}
@Override
public Rectangle getBounds() {
return new Rectangle((int)x, (int)y, 16, 16);
}
}
|
[
"[email protected]"
] | |
66ab76d33a6f801c3f9304713f02c4704d193eb6
|
24d8cf871b092b2d60fc85d5320e1bc761a7cbe2
|
/DrJava/rev3734-3807/right-branch-380/src/edu/rice/cs/drjava/model/debug/DebugBreakpointData.java
|
cd62992b44c60290d7f7ac64eb769908ff5ab36a
|
[] |
no_license
|
joliebig/featurehouse_fstmerge_examples
|
af1b963537839d13e834f829cf51f8ad5e6ffe76
|
1a99c1788f0eb9f1e5d8c2ced3892d00cd9449ad
|
refs/heads/master
| 2016-09-05T10:24:50.974902 | 2013-03-28T16:28:47 | 2013-03-28T16:28:47 | 9,080,611 | 3 | 2 | null | null | null | null |
UTF-8
|
Java
| false | false | 237 |
java
|
package edu.rice.cs.drjava.model.debug;
import java.io.File;
public interface DebugBreakpointData {
public File getFile();
public int getOffset();
public int getLineNumber();
public boolean isEnabled();
}
|
[
"[email protected]"
] | |
c3ac9d26a0ef99be2f6534b5c41c269ca4e796af
|
fc7d299c4e437146f8c59b81b039984bda1a3747
|
/Pizzeria/src/Logic/Node.java
|
48f5294c93996387ddac6ab350aaa7bbd0f0e71f
|
[] |
no_license
|
z0976190100/PizzeriaRemote
|
4162d5f77d65ea47e4292df23383d8e172f61c59
|
18ab0f355ecdd529dae8f7c3d61672e1f3057c83
|
refs/heads/master
| 2021-07-13T01:54:11.210625 | 2017-10-08T23:02:41 | 2017-10-08T23:02:41 | 105,530,240 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 784 |
java
|
package Logic;
import java.util.*;
public class Node {
String name;
int cost = 0;
boolean visited;
String neighboursSt;
Map<Node, Integer> neighbours = new HashMap<>();
Node(String nam, String neigh) {
this.name = nam;
//this.roadLength = roadLeng;
this.visited = false;
this.neighboursSt = neigh;
}
void setNeighboursSt(List<Node> allNod) {
String[] result = this.neighboursSt.split(";");
for (String s : result
) {
String[] res = s.split(",");
for (Node n : allNod
) {
if (n.name.equals(res[0])) {
this.neighbours.put(n, Integer.parseInt(res[1]));
}
}
}
}
}
|
[
"[email protected]"
] | |
cdfe479efce733d7b0bcc8b2901c48280ecf8159
|
69d3184bac2b3bd7e808971a7706b1e2ee0dbbc5
|
/IA-83/11/lab_8/src/Lab8dot2.java
|
206b06a778905263bcea11af39b14272926a07ea
|
[] |
no_license
|
iamillia/20102010
|
bca4490877374d7c23bbc1a17100e04008d0b095
|
1fb1a68c815a61472aba166c3d51dcad2f6abf47
|
refs/heads/master
| 2020-04-23T09:12:20.295507 | 2019-05-08T06:24:01 | 2019-05-08T06:24:01 | 171,061,031 | 11 | 26 | null | 2019-10-10T15:30:23 | 2019-02-16T23:01:44 |
Java
|
UTF-8
|
Java
| false | false | 689 |
java
|
import java.util.Arrays;
import java.util.Comparator;
import java.util.TreeSet;
public class Lab8dot2 {
protected class Compar implements Comparator<QuadraticEquation>{
@Override
public int compare(final QuadraticEquation o1, final QuadraticEquation o2) {
return (o1.a < o2.a) ? -1 : (o1.a == o2.a) ? (o1.b < o2.b) ? -1 : (o1.b == o2.b) ? (o1.c < o2.c) ? -1 : (o1.c == o2.c) ? 0 : 1 : 1 : 1;
}
}
public void printSorted(QuadraticEquation[] arr){
Comparator compar = this.new Compar();
TreeSet<QuadraticEquation> asd = new TreeSet<>(compar);
asd.addAll(Arrays.asList(arr));
System.out.println(asd);
}
}
|
[
"[email protected]"
] | |
57e9762f445ef2d5bfbbffb732736043f27ae51e
|
49bc601b74be608d5a98f8b5a81466528fc2305a
|
/predator-processor/src/main/java/io/micronaut/data/processor/visitors/RepositoryTypeElementVisitor.java
|
a9ab461ef51a55698dc080654618a935f084dac0
|
[
"Apache-2.0"
] |
permissive
|
glaforge/micronaut-predator
|
39a44dc97fff501b63fd9f56ce04ea73897939f5
|
59076922a34185723bfa2e16b5ed43b03ab9b89e
|
refs/heads/master
| 2022-01-24T04:19:45.668397 | 2019-07-19T10:38:25 | 2019-07-19T10:38:25 | 198,100,373 | 0 | 0 |
Apache-2.0
| 2019-07-21T20:09:16 | 2019-07-21T20:09:16 | null |
UTF-8
|
Java
| false | false | 29,855 |
java
|
/*
* Copyright 2017-2019 original authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.micronaut.data.processor.visitors;
import io.micronaut.context.annotation.Parameter;
import io.micronaut.context.annotation.Property;
import io.micronaut.core.annotation.*;
import io.micronaut.core.io.service.ServiceDefinition;
import io.micronaut.core.io.service.SoftServiceLoader;
import io.micronaut.core.order.OrderUtil;
import io.micronaut.core.util.ArrayUtils;
import io.micronaut.core.util.CollectionUtils;
import io.micronaut.core.util.StringUtils;
import io.micronaut.data.annotation.*;
import io.micronaut.data.intercept.PredatorInterceptor;
import io.micronaut.data.intercept.annotation.PredatorMethod;
import io.micronaut.data.model.*;
import io.micronaut.data.model.query.QueryModel;
import io.micronaut.data.model.Sort;
import io.micronaut.data.model.query.builder.QueryResult;
import io.micronaut.data.model.query.builder.QueryBuilder;
import io.micronaut.data.processor.model.SourcePersistentEntity;
import io.micronaut.data.processor.model.SourcePersistentProperty;
import io.micronaut.data.processor.visitors.finders.*;
import io.micronaut.data.processor.visitors.finders.page.FindPageByMethod;
import io.micronaut.data.processor.visitors.finders.page.ListPageMethod;
import io.micronaut.data.processor.visitors.finders.slice.FindSliceByMethod;
import io.micronaut.data.processor.visitors.finders.slice.ListSliceMethod;
import io.micronaut.data.repository.GenericRepository;
import io.micronaut.inject.ast.*;
import io.micronaut.inject.visitor.TypeElementVisitor;
import io.micronaut.inject.visitor.VisitorContext;
import edu.umd.cs.findbugs.annotations.Nullable;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* The main {@link TypeElementVisitor} that visits interfaces annotated with {@link Repository}
* and generates queries for each abstract method.
*
* @author graemerocher
* @since 1.0.0
*/
@Internal
public class RepositoryTypeElementVisitor implements TypeElementVisitor<Repository, Object> {
public static final String SPRING_REPO = "org.springframework.data.repository.Repository";
private ClassElement currentClass;
private ClassElement currentRepository;
private QueryBuilder queryEncoder;
private Map<String, String> typeRoles = new HashMap<>();
private List<MethodCandidate> finders;
private boolean failing = false;
private Set<String> visitedRepositories = new HashSet<>();
private Map<String, DataType> dataTypes = Collections.emptyMap();
private Map<String, SourcePersistentEntity> entityMap = new HashMap<>(50);
private final Function<ClassElement, SourcePersistentEntity> entityResolver = new Function<ClassElement, SourcePersistentEntity>() {
@Override
public SourcePersistentEntity apply(ClassElement classElement) {
return entityMap.computeIfAbsent(classElement.getName(), s -> new SourcePersistentEntity(classElement, this));
}
};
/**
* Default constructor.
*/
public RepositoryTypeElementVisitor() {
typeRoles.put(Pageable.class.getName(), TypeRole.PAGEABLE);
typeRoles.put(Sort.class.getName(), TypeRole.SORT);
typeRoles.put(Page.class.getName(), TypeRole.PAGE);
typeRoles.put(Slice.class.getName(), TypeRole.SLICE);
}
@Override
public void start(VisitorContext visitorContext) {
if (finders == null) {
finders = initializeMethodCandidates(visitorContext);
}
}
@Override
public void visitClass(ClassElement element, VisitorContext context) {
String interfaceName = element.getName();
if (failing) {
return;
}
if (visitedRepositories.contains(interfaceName)) {
// prevent duplicate visits
currentRepository = null;
currentClass = null;
return;
}
this.currentClass = element;
if (element.hasDeclaredStereotype(Repository.class)) {
visitedRepositories.add(interfaceName);
currentRepository = element;
queryEncoder = QueryBuilder.newQueryBuilder(element.getAnnotationMetadata());
this.dataTypes = MappedEntityVisitor.getConfiguredDataTypes(currentRepository);
AnnotationMetadata annotationMetadata = element.getAnnotationMetadata();
List<AnnotationValue<TypeRole>> roleArray = annotationMetadata
.findAnnotation(RepositoryConfiguration.class)
.map(av -> av.getAnnotations("typeRoles", TypeRole.class))
.orElse(Collections.emptyList());
for (AnnotationValue<TypeRole> parameterRole : roleArray) {
String role = parameterRole.stringValue("role").orElse(null);
AnnotationClassValue cv = parameterRole.get("type", AnnotationClassValue.class).orElse(null);
if (StringUtils.isNotEmpty(role) && cv != null) {
context.getClassElement(cv.getName()).ifPresent(ce ->
typeRoles.put(ce.getName(), role)
);
}
}
if (element.isAssignable(SPRING_REPO)) {
context.getClassElement("org.springframework.data.domain.Pageable").ifPresent(ce ->
typeRoles.put(ce.getName(), TypeRole.PAGEABLE)
);
context.getClassElement("org.springframework.data.domain.Page").ifPresent(ce ->
typeRoles.put(ce.getName(), TypeRole.PAGE)
);
context.getClassElement("org.springframework.data.domain.Slice").ifPresent(ce ->
typeRoles.put(ce.getName(), TypeRole.SLICE)
);
context.getClassElement("org.springframework.data.domain.Sort").ifPresent(ce ->
typeRoles.put(ce.getName(), TypeRole.SORT)
);
}
if (queryEncoder == null) {
context.fail("QueryEncoder not present on annotation processor path", element);
failing = true;
}
}
}
@Override
public void visitMethod(MethodElement element, VisitorContext context) {
if (currentRepository == null || failing) {
return;
}
ClassElement genericReturnType = element.getGenericReturnType();
if (queryEncoder != null && currentClass != null && element.isAbstract() && !element.isStatic() && finders != null) {
ParameterElement[] parameters = element.getParameters();
Map<String, Element> parametersInRole = new HashMap<>(2);
for (ParameterElement parameter : parameters) {
ClassElement type = parameter.getType();
this.typeRoles.entrySet().stream().filter(entry -> {
String roleType = entry.getKey();
return type.isAssignable(roleType);
}
).forEach(entry ->
parametersInRole.put(entry.getValue(), parameter)
);
}
if (element.hasDeclaredAnnotation(PredatorMethod.class)) {
// explicitly handled
return;
}
MatchContext matchContext = new MatchContext(
currentRepository,
context,
element,
typeRoles,
genericReturnType,
parameters
);
for (MethodCandidate finder : finders) {
if (finder.isMethodMatch(element, matchContext)) {
SourcePersistentEntity entity = resolvePersistentEntity(element, parametersInRole, context);
if (entity == null) {
matchContext.fail("Unable to establish persistent entity to query for method: " + element.getName());
this.failing = matchContext.isFailing();
return;
}
String idType = resolveIdType(entity);
MethodMatchContext methodMatchContext = new MethodMatchContext(
currentRepository,
entity,
context,
genericReturnType,
element,
parametersInRole,
typeRoles,
parameters,
entityResolver
);
MethodMatchInfo methodInfo;
try {
methodInfo = finder.buildMatchInfo(methodMatchContext);
} catch (Exception e) {
matchContext.fail(e.getMessage());
return;
}
if (methodInfo != null) {
// populate parameter roles
for (Map.Entry<String, Element> entry : methodMatchContext.getParametersInRole().entrySet()) {
methodInfo.addParameterRole(
entry.getKey(),
entry.getValue().getName()
);
}
QueryModel queryObject = methodInfo.getQuery();
QueryModel countQuery;
QueryResult preparedCount = null;
Map<String, String> parameterBinding = null;
boolean rawCount = false;
if (queryObject != null) {
if (queryObject instanceof RawQuery) {
RawQuery rawQuery = (RawQuery) queryObject;
// no need to annotation since already annotated, just replace the
// the computed parameter names
parameterBinding = rawQuery.getParameterBinding();
if (matchContext.isTypeInRole(genericReturnType, TypeRole.PAGE)) {
String cq = matchContext.getAnnotationMetadata().stringValue(io.micronaut.data.annotation.Query.class, "countQuery")
.orElse(null);
if (StringUtils.isEmpty(cq)) {
methodMatchContext.fail("Query returns a Page and does not specify a 'countQuery' member.");
this.failing = true;
return;
} else {
rawCount = true;
}
}
} else {
QueryResult encodedQuery;
try {
switch (methodInfo.getOperationType()) {
case DELETE:
encodedQuery = queryEncoder.buildDelete(queryObject);
break;
case UPDATE:
encodedQuery = queryEncoder
.buildUpdate(
queryObject,
methodInfo.getUpdateProperties());
break;
case INSERT:
// TODO
default:
encodedQuery = queryEncoder.buildQuery(queryObject);
}
} catch (Exception e) {
methodMatchContext.fail("Invalid query method [" + element.getName() + "] of repository [" + currentRepository.getName() + "]: " + e.getMessage());
this.failing = true;
return;
}
parameterBinding = encodedQuery.getParameters();
if (TypeUtils.isReactiveOrFuture(genericReturnType)) {
genericReturnType = genericReturnType.getFirstTypeArgument().orElse(entity.getType());
}
if (matchContext.isTypeInRole(genericReturnType, TypeRole.PAGE)) {
countQuery = QueryModel.from(queryObject.getPersistentEntity());
countQuery.projections().count();
QueryModel.Junction junction = queryObject.getCriteria();
for (QueryModel.Criterion criterion : junction.getCriteria()) {
countQuery.add(criterion);
}
preparedCount = queryEncoder.buildQuery(countQuery);
QueryResult finalPreparedCount = preparedCount;
element.annotate(io.micronaut.data.annotation.Query.class, annotationBuilder -> {
annotationBuilder.value(encodedQuery.getQuery());
annotationBuilder.member(PredatorMethod.META_MEMBER_COUNT_QUERY, finalPreparedCount.getQuery());
}
);
} else {
element.annotate(io.micronaut.data.annotation.Query.class, annotationBuilder ->
annotationBuilder.value(encodedQuery.getQuery())
);
}
}
}
Class<? extends PredatorInterceptor> runtimeInterceptor = methodInfo.getRuntimeInterceptor();
if (runtimeInterceptor != null) {
Map<String, String> finalParameterBinding = parameterBinding;
QueryResult finalPreparedCount1 = preparedCount;
boolean finalRawCount = rawCount;
element.annotate(PredatorMethod.class, annotationBuilder -> {
if (runtimeInterceptor.getSimpleName().startsWith("Save")) {
try {
QueryResult queryResult = queryEncoder.buildInsert(currentRepository.getAnnotationMetadata(), entity);
if (queryResult != null) {
Map<String, String> qp = queryResult.getParameters();
addParameterTypeDefinitions(methodMatchContext, qp, parameters, annotationBuilder);
AnnotationValue<?>[] annotationValues = parameterBindingToAnnotationValues(qp);
annotationBuilder.member(PredatorMethod.META_MEMBER_INSERT_STMT, queryResult.getQuery());
annotationBuilder.member(PredatorMethod.META_MEMBER_INSERT_BINDING, annotationValues);
}
} catch (Exception e) {
context.fail("Error building insert statement", element);
failing = true;
}
}
annotationBuilder.member(PredatorMethod.META_MEMBER_ROOT_ENTITY, new AnnotationClassValue<>(entity.getName()));
// include the roles
methodInfo.getParameterRoles()
.forEach(annotationBuilder::member);
if (methodInfo.isDto()) {
annotationBuilder.member(PredatorMethod.META_MEMBER_DTO, true);
}
TypedElement resultType = methodInfo.getResultType();
if (resultType != null) {
annotationBuilder.member(PredatorMethod.META_MEMBER_RESULT_TYPE, new AnnotationClassValue<>(resultType.getName()));
ClassElement type = resultType.getType();
if (!type.getName().equals("void")) {
annotationBuilder.member(PredatorMethod.META_MEMBER_RESULT_DATA_TYPE, TypeUtils.resolveDataType(type, dataTypes));
}
}
if (idType != null) {
annotationBuilder.member(PredatorMethod.META_MEMBER_ID_TYPE, idType);
}
annotationBuilder.member(PredatorMethod.META_MEMBER_INTERCEPTOR, runtimeInterceptor);
if (CollectionUtils.isNotEmpty(finalParameterBinding)) {
AnnotationValue<?>[] annotationParameters = parameterBindingToAnnotationValues(finalParameterBinding);
if (ArrayUtils.isNotEmpty(annotationParameters)) {
annotationBuilder.member(PredatorMethod.META_MEMBER_PARAMETER_BINDING, annotationParameters);
if (finalRawCount) {
annotationBuilder.member(PredatorMethod.META_MEMBER_COUNT_PARAMETERS, annotationParameters);
}
}
addParameterTypeDefinitions(methodMatchContext, finalParameterBinding, parameters, annotationBuilder);
}
if (finalPreparedCount1 != null) {
AnnotationValue<?>[] annotationParameters = parameterBindingToAnnotationValues(finalPreparedCount1.getParameters());
annotationBuilder.member(PredatorMethod.META_MEMBER_COUNT_PARAMETERS, annotationParameters);
}
Optional<ParameterElement> entityParam = Arrays.stream(parameters).filter(p -> {
ClassElement t = p.getGenericType();
return t.isAssignable(entity.getName());
}).findFirst();
entityParam.ifPresent(parameterElement -> annotationBuilder.member(PredatorMethod.META_MEMBER_ENTITY, parameterElement.getName()));
for (Map.Entry<String, String> entry : methodInfo.getParameterRoles().entrySet()) {
annotationBuilder.member(entry.getKey(), entry.getValue());
}
if (queryObject != null) {
if (queryObject instanceof RawQuery) {
element.annotate(Query.class, (builder) -> builder.member(PredatorMethod.META_MEMBER_RAW_QUERY, true));
}
int max = queryObject.getMax();
if (max > -1) {
annotationBuilder.member(PredatorMethod.META_MEMBER_PAGE_SIZE, max);
}
long offset = queryObject.getOffset();
if (offset > 0) {
annotationBuilder.member(PredatorMethod.META_MEMBER_PAGE_INDEX, offset);
}
}
});
return;
} else {
methodMatchContext.fail("Unable to implement Repository method: " + currentRepository.getSimpleName() + "." + element.getName() + "(..). No possible runtime implementations found.");
this.failing = true;
return;
}
}
this.failing = methodMatchContext.isFailing();
}
}
this.failing = true;
String messageStart = matchContext.getUnableToImplementMessage();
context.fail(messageStart + "No possible implementations found.", element);
}
}
private void addParameterTypeDefinitions(
MethodMatchContext matchContext, Map<String, String> parameterBinding,
ParameterElement[] parameters,
AnnotationValueBuilder<PredatorMethod> annotationBuilder) {
if (!matchContext.supportsImplicitQueries()) {
List<AnnotationValue<?>> annotationValues = new ArrayList<>(parameterBinding.size());
Map<String, String> reverseMap = parameterBinding.entrySet().stream().collect(Collectors.toMap(
Map.Entry::getValue,
Map.Entry::getKey
));
for (ParameterElement parameter : parameters) {
String name = parameter.stringValue(Parameter.class).orElse(parameter.getName());
String index = reverseMap.remove(name);
if (index != null) {
ClassElement genericType = parameter.getGenericType();
if (TypeUtils.isContainerType(genericType)) {
genericType = genericType.getFirstTypeArgument().orElse(genericType);
}
ClassElement finalGenericType = genericType;
DataType dt = parameter.enumValue(TypeDef.class, "type", DataType.class)
.orElseGet(() -> TypeUtils.resolveDataType(finalGenericType, dataTypes));
AnnotationValue<TypeDef> typeDef = AnnotationValue.builder(TypeDef.class)
.member("type", dt)
.member("names", index).build();
annotationValues.add(typeDef);
}
}
if (CollectionUtils.isNotEmpty(reverseMap)) {
Set<String> names = reverseMap.keySet();
SourcePersistentEntity rootEntity = matchContext.getRootEntity();
for (String name : names) {
SourcePersistentProperty p = rootEntity.getPropertyByName(name);
if (p != null) {
AnnotationValue<TypeDef> typeDef = AnnotationValue.builder(TypeDef.class)
.member("type", p.getDataType())
.member("names", reverseMap.get(name)).build();
annotationValues.add(typeDef);
}
}
}
AnnotationValue[] typeDefValues = annotationValues.toArray(new AnnotationValue[0]);
if (ArrayUtils.isNotEmpty(typeDefValues)) {
annotationBuilder.member("typeDefs", typeDefValues);
}
}
}
private AnnotationValue<?>[] parameterBindingToAnnotationValues(Map<String, String> finalParameterBinding) {
AnnotationValue<?>[] annotationParameters = new AnnotationValue[finalParameterBinding.size()];
int i = 0;
for (Map.Entry<String, String> entry : finalParameterBinding.entrySet()) {
annotationParameters[i++] = AnnotationValue.builder(Property.class)
.member("name", entry.getKey())
.member("value", entry.getValue())
.build();
}
return annotationParameters;
}
private List<MethodCandidate> initializeMethodCandidates(VisitorContext context) {
List<MethodCandidate> finderList = Arrays.asList(
new FindByFinder(),
new ExistsByFinder(),
new SaveEntityMethod(),
new SaveOneMethod(),
new SaveAllMethod(),
new ListMethod(),
new CountMethod(),
new DeleteByMethod(),
new DeleteMethod(),
new CountByMethod(),
new UpdateMethod(),
new UpdateByMethod(),
new ListSliceMethod(),
new FindSliceByMethod(),
new ListSliceMethod(),
new FindPageByMethod(),
new ListPageMethod(),
new FindOneMethod(),
new FindByIdsMethod()
);
SoftServiceLoader<MethodCandidate> otherCandidates = SoftServiceLoader.load(MethodCandidate.class);
for (ServiceDefinition<MethodCandidate> definition : otherCandidates) {
if (definition.isPresent()) {
try {
finderList.add(definition.load());
} catch (Exception e) {
context.warn("Could not load Predator method candidate [" + definition.getName() + "]: " + e.getMessage(), null);
}
}
}
OrderUtil.sort(finderList);
return finderList;
}
private @Nullable String resolveIdType(PersistentEntity entity) {
Map<String, ClassElement> typeArguments = currentRepository.getTypeArguments(GenericRepository.class);
String varName = "ID";
if (typeArguments.isEmpty()) {
typeArguments = currentRepository.getTypeArguments(SPRING_REPO);
}
if (!typeArguments.isEmpty()) {
ClassElement ce = typeArguments.get(varName);
if (ce != null) {
return ce.getName();
}
}
PersistentProperty identity = entity.getIdentity();
if (identity != null) {
return identity.getName();
}
return null;
}
private @Nullable SourcePersistentEntity resolvePersistentEntity(MethodElement element, Map<String, Element> parametersInRole, VisitorContext context) {
ClassElement returnType = element.getGenericReturnType();
SourcePersistentEntity entity = resolvePersistentEntity(returnType);
if (entity == null) {
entity = resolveEntityForCurrentClass();
}
if (entity != null) {
List<PersistentProperty> propertiesInRole = entity.getPersistentProperties()
.stream().filter(pp -> pp.getAnnotationMetadata().hasStereotype(TypeRole.class))
.collect(Collectors.toList());
for (PersistentProperty persistentProperty : propertiesInRole) {
String role = persistentProperty.getAnnotationMetadata().getValue(TypeRole.class, "role", String.class).orElse(null);
if (role != null) {
parametersInRole.put(role, ((SourcePersistentProperty) persistentProperty).getPropertyElement());
}
}
return entity;
} else {
context.fail("Could not resolved root entity. Either implement the Repository interface or define the entity as part of the signature", element);
return null;
}
}
private SourcePersistentEntity resolveEntityForCurrentClass() {
SourcePersistentEntity entity = null;
Map<String, ClassElement> typeArguments = currentRepository.getTypeArguments(GenericRepository.class);
String argName = "E";
if (typeArguments.isEmpty()) {
argName = "T";
typeArguments = currentRepository.getTypeArguments(SPRING_REPO);
}
if (!typeArguments.isEmpty()) {
ClassElement ce = typeArguments.get(argName);
if (ce != null) {
return entityResolver.apply(ce);
}
}
return entity;
}
private SourcePersistentEntity resolvePersistentEntity(ClassElement returnType) {
if (returnType != null) {
if (returnType.hasAnnotation(MappedEntity.class)) {
return entityResolver.apply(returnType);
} else {
Collection<ClassElement> typeArguments = returnType.getTypeArguments().values();
for (ClassElement typeArgument : typeArguments) {
SourcePersistentEntity entity = resolvePersistentEntity(typeArgument);
if (entity != null) {
return entity;
}
}
}
}
return null;
}
}
|
[
"[email protected]"
] | |
f19c1869a46f74e2f29c9b4d244a44ff6c458c86
|
59ca721ca1b2904fbdee2350cd002e1e5f17bd54
|
/aliyun-java-sdk-smartag-inner/src/main/java/com/aliyuncs/smartag_inner/model/v20180313/InnerDeleteCCNEventRelationRequest.java
|
5e5a57ee2cd1473805ef682964a160ba402a3f8a
|
[
"Apache-2.0"
] |
permissive
|
longtx/aliyun-openapi-java-sdk
|
8fadfd08fbcf00c4c5c1d9067cfad20a14e42c9c
|
7a9ab9eb99566b9e335465a3358553869563e161
|
refs/heads/master
| 2020-04-26T02:00:35.360905 | 2019-02-28T13:47:08 | 2019-02-28T13:47:08 | 173,221,745 | 2 | 0 |
NOASSERTION
| 2019-03-01T02:33:35 | 2019-03-01T02:33:35 | null |
UTF-8
|
Java
| false | false | 3,789 |
java
|
/*
* 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.aliyuncs.smartag_inner.model.v20180313;
import com.aliyuncs.RpcAcsRequest;
/**
* @author auto create
* @version
*/
public class InnerDeleteCCNEventRelationRequest extends RpcAcsRequest<InnerDeleteCCNEventRelationResponse> {
public InnerDeleteCCNEventRelationRequest() {
super("Smartag-inner", "2018-03-13", "InnerDeleteCCNEventRelation", "smartag", "innerAPI");
}
private String access_key_id;
private String childEventInstanceId;
private String childEventNamespace;
private String parentEventRegionNo;
private String parentEventNamespace;
private String parentEventInstanceId;
private String childEventRegionNo;
private String regionNo;
public String getAccess_key_id() {
return this.access_key_id;
}
public void setAccess_key_id(String access_key_id) {
this.access_key_id = access_key_id;
if(access_key_id != null){
putQueryParameter("access_key_id", access_key_id);
}
}
public String getChildEventInstanceId() {
return this.childEventInstanceId;
}
public void setChildEventInstanceId(String childEventInstanceId) {
this.childEventInstanceId = childEventInstanceId;
if(childEventInstanceId != null){
putQueryParameter("ChildEventInstanceId", childEventInstanceId);
}
}
public String getChildEventNamespace() {
return this.childEventNamespace;
}
public void setChildEventNamespace(String childEventNamespace) {
this.childEventNamespace = childEventNamespace;
if(childEventNamespace != null){
putQueryParameter("ChildEventNamespace", childEventNamespace);
}
}
public String getParentEventRegionNo() {
return this.parentEventRegionNo;
}
public void setParentEventRegionNo(String parentEventRegionNo) {
this.parentEventRegionNo = parentEventRegionNo;
if(parentEventRegionNo != null){
putQueryParameter("ParentEventRegionNo", parentEventRegionNo);
}
}
public String getParentEventNamespace() {
return this.parentEventNamespace;
}
public void setParentEventNamespace(String parentEventNamespace) {
this.parentEventNamespace = parentEventNamespace;
if(parentEventNamespace != null){
putQueryParameter("ParentEventNamespace", parentEventNamespace);
}
}
public String getParentEventInstanceId() {
return this.parentEventInstanceId;
}
public void setParentEventInstanceId(String parentEventInstanceId) {
this.parentEventInstanceId = parentEventInstanceId;
if(parentEventInstanceId != null){
putQueryParameter("ParentEventInstanceId", parentEventInstanceId);
}
}
public String getChildEventRegionNo() {
return this.childEventRegionNo;
}
public void setChildEventRegionNo(String childEventRegionNo) {
this.childEventRegionNo = childEventRegionNo;
if(childEventRegionNo != null){
putQueryParameter("ChildEventRegionNo", childEventRegionNo);
}
}
public String getRegionNo() {
return this.regionNo;
}
public void setRegionNo(String regionNo) {
this.regionNo = regionNo;
if(regionNo != null){
putQueryParameter("RegionNo", regionNo);
}
}
@Override
public Class<InnerDeleteCCNEventRelationResponse> getResponseClass() {
return InnerDeleteCCNEventRelationResponse.class;
}
}
|
[
"[email protected]"
] | |
086acd87113c1a10e76d541ded3fba559290fef2
|
27bcd7aeba674dbd5c7d4ba1aa09637933d93454
|
/java/multithread/src/main/com/yu/chapter6/singleton/Les3_3_lazy_staticInnerClass_recommend.java
|
86c8b19399935e9e82f62c52fdef022b0738bf9b
|
[] |
no_license
|
xijiayu163/develop
|
f43b79cc17deaad983ee7d25df1f26edc58be3f4
|
4db9904b4f5f04fc6d9312b65e0df25d65ced75e
|
refs/heads/master
| 2021-01-17T09:28:11.173671 | 2017-10-28T10:04:21 | 2017-10-28T10:04:21 | 83,886,912 | 0 | 0 | null | null | null | null |
GB18030
|
Java
| false | false | 2,212 |
java
|
package com.yu.chapter6.singleton;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.ObjectStreamException;
import java.io.Serializable;
public class Les3_3_lazy_staticInnerClass_recommend {
public static class MyObject implements Serializable {
private static final long serialVersionUID = 888L;
// 内部类方式
private static class MyObjectHandler {
private static final MyObject myObject = new MyObject();
}
private MyObject() {
}
public static MyObject getInstance() {
return MyObjectHandler.myObject;
}
protected Object readResolve() throws ObjectStreamException {
System.out.println("调用了readResolve方法!");
return MyObjectHandler.myObject;
}
}
/**
*
* 静态内部类方式实现多线程单例模式
* 缺点:如果遇到序列化对象时,使用默认的方式运行得到的结果还是多例的
* 解决办法椒使用readResolve
*
* 865113938
调用了readResolve方法!
865113938
* @param args
*/
public static void main(String[] args) {
try {
MyObject myObject = MyObject.getInstance();
FileOutputStream fosRef = new FileOutputStream(new File(
"myObjectFile.txt"));
ObjectOutputStream oosRef = new ObjectOutputStream(fosRef);
oosRef.writeObject(myObject);
oosRef.close();
fosRef.close();
System.out.println(myObject.hashCode());
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
FileInputStream fisRef = new FileInputStream(new File(
"myObjectFile.txt"));
ObjectInputStream iosRef = new ObjectInputStream(fisRef);
MyObject myObject = (MyObject) iosRef.readObject();
iosRef.close();
fisRef.close();
System.out.println(myObject.hashCode());
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
}
|
[
"[email protected]"
] | |
90c389b474546357d1747e492627517b0ca3bdef
|
77df41d3de985202b4e723a87158ae69ff0ee226
|
/app/src/main/java/nekadgeek/agendaramadhan/realm/RealmConfig.java
|
fe36bff98bba6e8753671bd30829504e1a5da30e
|
[] |
no_license
|
andripratama/agenda-ramadhan
|
b94c59273460ea497e7ed68c9953ae8f6577a576
|
b55ba202f400159fe7fa925e332e3f70a2e21325
|
refs/heads/master
| 2021-01-17T18:22:09.228973 | 2016-06-09T07:48:17 | 2016-06-09T07:48:17 | 60,757,960 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,219 |
java
|
package nekadgeek.agendaramadhan.realm;
import android.app.Application;
import io.realm.DynamicRealm;
import io.realm.Realm;
import io.realm.RealmConfiguration;
import io.realm.RealmMigration;
import io.realm.RealmSchema;
/**
* Created by AndriPratama on 6/8/2016.
*/
public class RealmConfig extends Application{
@Override
public void onCreate() {
super.onCreate();
RealmConfiguration configuration = new RealmConfiguration.Builder(this)
.schemaVersion(0)
.migration(new DataMigration())
.build();
Realm.setDefaultConfiguration(configuration);
}
private class DataMigration implements RealmMigration{
@Override
public void migrate(DynamicRealm realm, long oldVersion, long newVersion) {
RealmSchema schema = realm.getSchema();
if (oldVersion == 0 ){
schema.create("Agenda")
.addField("id", int.class)
.addField("judul", String.class)
.addField("deskripsi", String.class)
.addField("tanggal", String.class);
oldVersion++;
}
}
}
}
|
[
"[email protected]"
] | |
3b8d9bbd09119dd7b77da342e3d402050d3ba89e
|
25fa7cfeaec68d3ac19de0f6d69046bc4e5970ce
|
/src/main/java/hitne/config/DateTimeFormatConfiguration.java
|
71ef1f4d88ffbd8547da9d7f4908bc9f556a299a
|
[] |
no_license
|
drasko-kosovic/hitne
|
d55356de85d997fe58ce68c0ebde9fbae585520f
|
17eb0573c937b9a6469a822c12a73354f53c6308
|
refs/heads/master
| 2023-03-21T01:27:04.286733 | 2020-06-19T09:02:19 | 2020-06-19T09:02:19 | 345,909,669 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 712 |
java
|
package hitne.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.format.FormatterRegistry;
import org.springframework.format.datetime.standard.DateTimeFormatterRegistrar;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* Configure the converters to use the ISO format for dates by default.
*/
@Configuration
public class DateTimeFormatConfiguration implements WebMvcConfigurer {
@Override
public void addFormatters(FormatterRegistry registry) {
DateTimeFormatterRegistrar registrar = new DateTimeFormatterRegistrar();
registrar.setUseIsoFormat(true);
registrar.registerFormatters(registry);
}
}
|
[
"[email protected]"
] | |
e86f5d5fce9d99964d8f13d67ab987a63c963e29
|
65e6c8d79f89eab2b0be41b18f998b1aaab33959
|
/zz91/ast1949-persist/src/main/java/com/ast/ast1949/persist/information/impl/PeriodicalDetailsDAOImpl.java
|
96b1a94439066671904a6af0d153f95ea50cb81e
|
[] |
no_license
|
cash2one/91
|
14eeb47d22c7e561d2a718489cbc99409d6abd07
|
525b49860cd5e92ef012b474df6c9dc4f8256756
|
refs/heads/master
| 2021-01-19T11:20:46.930263 | 2016-06-28T02:36:26 | 2016-06-28T02:37:24 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,659 |
java
|
/**
* Copyright 2010 ASTO.
* All right reserved.
* Created on 2010-8-25
*/
package com.ast.ast1949.persist.information.impl;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.stereotype.Component;
import com.ast.ast1949.domain.information.PeriodicalDetails;
import com.ast.ast1949.dto.PageDto;
import com.ast.ast1949.exception.PersistLayerException;
import com.ast.ast1949.persist.information.PeriodicalDetailsDAO;
import com.ast.ast1949.util.Assert;
/**
* @author Mays ([email protected])
*
*/
@Component("periodicalDetailsDAO")
public class PeriodicalDetailsDAOImpl extends SqlMapClientDaoSupport implements PeriodicalDetailsDAO {
public Integer batchInsertPeriodicalDetails(List<PeriodicalDetails> details) {
Assert.notNull(details, "the details list can not be null");
Integer impact=0;
try {
getSqlMapClient().startBatch();
for(PeriodicalDetails d:details){
if((Integer)getSqlMapClientTemplate().insert("periodicalDetails.insertPeriodicalDetails", d)>0){
impact+=1;
}
}
getSqlMapClient().executeBatch();
} catch (SQLException e) {
throw new PersistLayerException("an error occur when batch insert periodical details",e);
}
return impact;
}
public Integer deleteDetails(Integer[] detailsIdArray) {
Assert.notNull(detailsIdArray, "the details list can not be null");
Integer impact=0;
try {
getSqlMapClient().startBatch();
for(Integer i:detailsIdArray){
if(getSqlMapClientTemplate().delete("periodicalDetails.deleteDetailsById",i)>0){
impact+=1;
}
}
getSqlMapClient().executeBatch();
} catch (SQLException e) {
throw new PersistLayerException("an error occur when batch delete periodical details",e);
}
return impact;
}
public List<PeriodicalDetails> listPreviewDetailsByPeriodicalId(
Integer periodicalId) {
Assert.notNull(periodicalId, "the periodicalId list can not be null");
return getSqlMapClientTemplate().queryForList("periodicalDetails.listPreviewDetailsByPeriodicalId",periodicalId);
}
public Integer updateBaseDetails(PeriodicalDetails details) {
Assert.notNull(details, "the details list can not be null");
return getSqlMapClientTemplate().update("periodicalDetails.updateBaseDetails", details);
}
public Integer updatePageType(Integer id, Integer pageType) {
Assert.notNull(pageType , "the pageType list can not be null");
Assert.notNull(id , "the id list can not be null");
Map<String, Object> root = new HashMap<String, Object>();
root.put("id", id);
if(pageType==null||"".equals(pageType)){
pageType=PAGE_TYPE_BODY;
}
root.put("pageType", pageType);
return getSqlMapClientTemplate().update("periodicalDetails.updatePageType", root);
}
public Integer countPageDetailsByPeriodicalId(Integer periodicalId) {
Assert.notNull(periodicalId, "the periodicalId list can not be null");
return (Integer) getSqlMapClientTemplate().queryForObject("periodicalDetails.countPageDetailsByPeriodicalId", periodicalId);
}
public List<PeriodicalDetails> pageDetailsByPeriodicalId(
Integer periodicalId, PageDto page) {
Assert.notNull(periodicalId, "the periodicalId list can not be null");
Assert.notNull(page, "the page list can not be null");
Map<String, Object> root = new HashMap<String, Object>();
root.put("periodicalId",periodicalId);
root.put("page",page);
return getSqlMapClientTemplate().queryForList("periodicalDetails.pageDetailsByPeriodicalId",root);
}
public Integer deleteDetailsByPeriodicalId(Integer periodicalId) {
Assert.notNull(periodicalId, "the periodicalId list can not be null");
return getSqlMapClientTemplate().delete("periodicalDetails.deleteDetailsByPeriodicalId", periodicalId);
}
public PeriodicalDetails selectDetailsById(Integer id) {
Assert.notNull(id, "id is not null");
return (PeriodicalDetails) getSqlMapClientTemplate().queryForObject("periodicalDetails.selectDetailsById", id);
}
@SuppressWarnings("unchecked")
public List<PeriodicalDetails> pageDetailsByPeriodicalIdAndType(Integer periodicalId,
Integer type) {
Assert.notNull(type, "type is not null");
Assert.notNull(periodicalId, "periodicalId is not null");
Map<String, Object> map=new HashMap<String, Object>();
map.put("type", type);
map.put("periodicalId", periodicalId);
return getSqlMapClientTemplate().queryForList("periodicalDetails.pageDetailsByPeriodicalIdAndType", map);
}
}
|
[
"[email protected]"
] | |
4d9ff6cc6f001eba25c395b2ff7db9ac3b7a061c
|
90ab504d88d41651bef85c8ae043a82413d36c80
|
/DummyHttpProxy/org/kobeyoung81/dummyhttpproxy/HexDumpProxyFrontendHandler.java
|
5813e1fe500f0bba36fd0932362798995b27a65c
|
[
"Apache-2.0"
] |
permissive
|
kobeyoung81/snappyproxy
|
aaa505253a19030967e5ec895bbb8a7cdfec6686
|
0a47c82201a5fad99c9cb7d2b94e496265643863
|
refs/heads/master
| 2021-01-10T08:28:58.062820 | 2016-02-10T15:07:30 | 2016-02-10T15:07:30 | 51,448,216 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,711 |
java
|
/*
* Copyright 2012 The Netty Project
*
* The Netty Project licenses this file to you under the Apache License,
* version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package org.kobeyoung81.dummyhttpproxy;
import io.netty.bootstrap.Bootstrap;
import io.netty.buffer.Unpooled;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.ChannelOption;
import io.netty.handler.codec.compression.SnappyFramedDecoder;
import io.netty.handler.codec.compression.SnappyFramedEncoder;
public class HexDumpProxyFrontendHandler extends ChannelInboundHandlerAdapter {
private final String remoteHost;
private final int remotePort;
private final String role;
private volatile Channel outboundChannel;
public HexDumpProxyFrontendHandler(String role, String remoteHost,
int remotePort) {
this.remoteHost = remoteHost;
this.remotePort = remotePort;
this.role = role;
}
@Override
public void channelActive(ChannelHandlerContext ctx) {
final Channel inboundChannel = ctx.channel();
// Start the connection attempt.
Bootstrap b = new Bootstrap();
b.group(inboundChannel.eventLoop()).channel(ctx.channel().getClass())
.handler(new HexDumpProxyBackendHandler(inboundChannel))
.option(ChannelOption.AUTO_READ, false);
ChannelFuture f = b.connect(remoteHost, remotePort);
outboundChannel = f.channel();
if ("local".equals(role)) {
outboundChannel.pipeline().addLast(new SnappyFramedEncoder());
outboundChannel.pipeline().addLast(new DummyHttpRequestEncoder());
outboundChannel.pipeline().addFirst(new SnappyFramedDecoder());
outboundChannel.pipeline().addFirst(new DummyHttpResponseDecoder());
}
f.addListener(new ChannelFutureListener() {
@Override
public void operationComplete(ChannelFuture future) {
if (future.isSuccess()) {
// connection complete start to read first data
inboundChannel.read();
} else {
// Close the connection if the connection attempt has
// failed.
inboundChannel.close();
}
}
});
}
@Override
public void channelRead(final ChannelHandlerContext ctx, Object msg) {
if (outboundChannel.isActive()) {
outboundChannel.writeAndFlush(msg).addListener(
new ChannelFutureListener() {
@Override
public void operationComplete(ChannelFuture future) {
if (future.isSuccess()) {
// was able to flush out data, start to read the
// next chunk
ctx.channel().read();
} else {
future.channel().close();
}
}
});
}
}
@Override
public void channelInactive(ChannelHandlerContext ctx) {
if (outboundChannel != null) {
closeOnFlush(outboundChannel);
}
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
cause.printStackTrace();
closeOnFlush(ctx.channel());
}
/**
* Closes the specified channel after all queued write requests are flushed.
*/
static void closeOnFlush(Channel ch) {
if (ch.isActive()) {
ch.writeAndFlush(Unpooled.EMPTY_BUFFER).addListener(
ChannelFutureListener.CLOSE);
}
}
}
|
[
"[email protected]"
] | |
19bd96acef1386f066c1510cd84615484773a0d6
|
3db2cdc73401132750b711652672e7f04d9dfdea
|
/src/main/java/Item.java
|
ae127c30c3e31404732b068d0ddd8206df22f2bf
|
[] |
no_license
|
vkn02/APFE179000307_C3_Project
|
d84e14af303b51e4bdd66d7a4513d36ab721f2d0
|
6e169fd45d59348f453819088caa1d0a8d5f7ba0
|
refs/heads/main
| 2023-06-10T07:15:49.209636 | 2021-06-30T16:05:33 | 2021-06-30T16:05:33 | 381,749,363 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 374 |
java
|
public class Item {
private final String name;
private final int price;
public Item(String name, int price) {
this.name = name;
this.price = price;
}
public String getName() {
return name;
}
public int getPrice() {
return price;
}
@Override
public String toString() {
return name + ":" + price + "\n";
}
}
|
[
"[email protected]"
] | |
24f6bee68f399bec4c1ddae2c4dd067be5abd852
|
ae87d5e51a80dc359eaabcd58c3b8551552a0f42
|
/2013年/FtpClientdownloadpatch/src/com/frankhujiyun/android/ui/MyProgress.java
|
4d09cd0265c0ab1191263a3203ca9ac0c1de1a66
|
[] |
no_license
|
hzjiyun/Android
|
fb5a95366435f028bfc45641d34a86e7b5aee28d
|
87a8b4e33303260b2cbc71ff656b2f41ba2f9b26
|
refs/heads/master
| 2021-01-17T23:43:55.768984 | 2013-08-12T01:05:27 | 2013-08-12T01:05:27 | null | 0 | 0 | null | null | null | null |
GB18030
|
Java
| false | false | 1,741 |
java
|
package com.frankhujiyun.android.ui;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.widget.ProgressBar;
/*
* copy
*/
public class MyProgress extends ProgressBar {
String text;
Paint mPaint;
public MyProgress(Context context) {
super(context);
// TODO Auto-generated constructor stub
System.out.println("1");
initText();
}
public MyProgress(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
// TODO Auto-generated constructor stub
System.out.println("2");
initText();
}
public MyProgress(Context context, AttributeSet attrs) {
super(context, attrs);
// TODO Auto-generated constructor stub
System.out.println("3");
initText();
}
@Override
public synchronized void setProgress(int progress) {
// TODO Auto-generated method stub
setText(progress);
super.setProgress(progress);
}
@Override
protected synchronized void onDraw(Canvas canvas) {
// TODO Auto-generated method stub
super.onDraw(canvas);
// this.setText();
Rect rect = new Rect();
this.mPaint.getTextBounds(this.text, 0, this.text.length(), rect);
int x = (getWidth() / 2) - rect.centerX();
int y = (getHeight() / 2) - rect.centerY();
canvas.drawText(this.text, x, y, this.mPaint);
}
// 初始化,画笔
private void initText() {
this.mPaint = new Paint();
this.mPaint.setColor(Color.BLACK);
}
private void setText() {
setText(this.getProgress());
}
// 设置文字内容
private void setText(int progress) {
int i = (progress * 100) / this.getMax();
this.text = String.valueOf(i) + "%";
}
}
|
[
"[email protected]"
] | |
996e21cfce30bc6606d14560acf8e1cb4f1179ac
|
5b82e2f7c720c49dff236970aacd610e7c41a077
|
/QueryReformulation-master 2/data/ExampleSourceCodeFiles/OpenSystemEditorAction.java
|
e4fd23cff4fb01b128399d5a9a2312d381ef6d44
|
[] |
no_license
|
shy942/EGITrepoOnlineVersion
|
4b157da0f76dc5bbf179437242d2224d782dd267
|
f88fb20497dcc30ff1add5fe359cbca772142b09
|
refs/heads/master
| 2021-01-20T16:04:23.509863 | 2016-07-21T20:43:22 | 2016-07-21T20:43:22 | 63,737,385 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,954 |
java
|
/Users/user/eclipse.platform.ui/bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/OpenSystemEditorAction.java
org eclipse actions java util iterator org eclipse core resources file org eclipse core resources resource org eclipse jface viewers structured selection org eclipse editor registry org eclipse workbench page org eclipse part init exception org eclipse platform org eclipse internal ide dialog util org eclipse internal ide workbench messages org eclipse internal ide help context ids org eclipse file editor input standard action opening system editor selected file resource this instantiated intended subclassed noextend this intended subclassed clients open system editor action selection listener action action string platform open system editor action workbench open editor workbench page workbench page creates action open system editors selected file resources param workbench open editor open system editor action workbench page workbench messages open system editor action text set tool tip text workbench messages open system editor action tool tip set null illegal argument exception workbench window workbench help system set help help context ids workbench page return workbench open editor workbench open editor workbench page workbench page workbench page opens system editor file resource param file file resource open file file file workbench page open editor file editor input file editor registry part init exception dialog util open error workbench page workbench window shell workbench messages open system editor action dialog title message override iterator itr selected resources iterator itr next resource resource resource itr resource file open file file resource code open system editor action code implementation code selection listener action code method enables action selection file resources override update selection structured selection selection update selection selection selection type resource
|
[
"[email protected]"
] | |
6b1b0c244d5d3b7c2310cac6c3d1c5815780a83c
|
d4ca222d7423f3e660badfe00d9087b8eaaacab5
|
/src/main/java/com/imooc/o2o/service/impl/UserShopMapServiceImpl.java
|
fd034ea4aaa1d87a0b40df9ff738b9e87fbb91e2
|
[] |
no_license
|
yizhichangyuan/o2o-SpringBoot
|
bfc34a33f7967113bb77af6cd92a3bca4b482135
|
80f508fb73a90760153e3c4b302c95228b91c13c
|
refs/heads/master
| 2023-03-10T07:41:57.474084 | 2021-02-24T16:00:06 | 2021-02-24T16:00:06 | 340,821,269 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,447 |
java
|
package com.imooc.o2o.service.impl;
import com.imooc.o2o.dao.UserShopMapDao;
import com.imooc.o2o.dto.UserShopMapExecution;
import com.imooc.o2o.entity.UserShopMap;
import com.imooc.o2o.enums.UserShopMapStateEnum;
import com.imooc.o2o.exceptions.UserShopMapException;
import com.imooc.o2o.service.UserShopMapService;
import com.imooc.o2o.util.HttpServletRequestUtil;
import com.imooc.o2o.util.RowIndexCalculator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* @PackageName:com.imooc.o2o.service.impl
* @NAME:UserShopMapServiceImpl
* @Description:
* @author: yizhichangyuan
* @date:2021/2/22 10:46
*/
@Service
public class UserShopMapServiceImpl implements UserShopMapService {
@Autowired
private UserShopMapDao userShopMapDao;
/**
* 用户购买商品或发生兑换时,更新用户积分
* @param userShopMap
* @return
*/
@Override
public UserShopMapExecution updateUserShopMap(UserShopMap userShopMap) {
if(userShopMap == null || userShopMap.getShop() == null || userShopMap.getShop().getShopId() == null
|| userShopMap.getUser() == null || userShopMap.getUser().getUserId() == null){
return new UserShopMapExecution(UserShopMapStateEnum.NULL_INFO);
}
try{
int effectNum = userShopMapDao.updateUserShopMap(userShopMap.getShop().getShopId(), userShopMap.getUser().getUserId(), userShopMap.getPoint());
if(effectNum <= 0){
return new UserShopMapExecution(UserShopMapStateEnum.INNER_ERROR);
}else{
return new UserShopMapExecution(UserShopMapStateEnum.SUCCESS);
}
}catch(Exception e){
throw new UserShopMapException(e.toString());
}
}
@Override
public UserShopMapExecution addUserShopMap(UserShopMap userShopMap) {
if(userShopMap == null || userShopMap.getShop() == null || userShopMap.getShop().getShopId() == null
|| userShopMap.getUser() == null || userShopMap.getUser().getUserId() == null || userShopMap.getPoint() != null){
return new UserShopMapExecution(UserShopMapStateEnum.NULL_INFO);
}
try{
userShopMap.setCreateTime(new Date());
int effectNum = userShopMapDao.insertUserShopMap(userShopMap);
if(effectNum <= 0){
return new UserShopMapExecution(UserShopMapStateEnum.INNER_ERROR);
}else{
return new UserShopMapExecution(UserShopMapStateEnum.SUCCESS);
}
}catch(Exception e){
throw new UserShopMapException(e.toString());
}
}
@Override
public UserShopMapExecution queryUserShopMapList(UserShopMap userShopMap, int pageIndex, int pageSize) {
if(userShopMap == null || userShopMap.getShop() == null || userShopMap.getShop().getShopId() == null){
return new UserShopMapExecution(UserShopMapStateEnum.NULL_INFO);
}
if(pageIndex < -1 || pageSize < -1){
return new UserShopMapExecution(UserShopMapStateEnum.EMPTY_PAGE_INDEX);
}
try{
int rowIndex = RowIndexCalculator.calRowIndex(pageIndex, pageSize);
List<UserShopMap> userShopMapList = userShopMapDao.queryUserShopMapList(userShopMap, rowIndex, pageSize);
int count = userShopMapDao.queryUserShopMapCount(userShopMap);
UserShopMapExecution userShopMapExecution = new UserShopMapExecution(UserShopMapStateEnum.SUCCESS, userShopMapList);
userShopMapExecution.setCount(count);
return userShopMapExecution;
}catch(Exception e){
throw new UserShopMapException(e.toString());
}
}
/**
* 用户登陆获取用户积分
* @param userId
* @param shopId
* @return
*/
@Override
public UserShopMapExecution queryUserShopMapById(long userId, long shopId) {
if(userId <= -1 || shopId <= -1){
return new UserShopMapExecution(UserShopMapStateEnum.NULL_INFO);
}
try{
UserShopMap userShopMap = userShopMapDao.queryUserShopMapById(userId, shopId);
return new UserShopMapExecution(UserShopMapStateEnum.SUCCESS, userShopMap);
}catch(Exception e){
throw new UserShopMapException(e.toString());
}
}
}
|
[
"[email protected]"
] | |
c08a336a14f91151b8e500f55417536f73c1591e
|
1b20d02dc3b293ee9f8b6aad629b697fa31dce83
|
/my_pulltorefreshdemo02/src/main/java/com/view/my_pulltorefreshdemo02/MarkActivity.java
|
c48fed48c7321b88f736388eb4fd961b7ba80b48
|
[] |
no_license
|
MarkCHYL/MarkSmartRefresh_demo
|
dc5d22819f7f23225d12f7ffd2e308a9107b422e
|
00ec155ed5ebe1c7282cc384184b624f6bcc5335
|
refs/heads/master
| 2020-03-08T03:20:41.021257 | 2018-04-03T09:59:55 | 2018-04-03T09:59:55 | 127,888,267 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,645 |
java
|
package com.view.my_pulltorefreshdemo02;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.Scroller;
import android.widget.TextView;
public class MarkActivity extends AppCompatActivity implements PulltorefreshView.RefreshCallBack {
private RecyclerView mRecyHome = null;
private PulltorefreshView reFreshView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_mark);
initView();
}
private void initView() {
mRecyHome = (RecyclerView) findViewById(R.id.recy_home);
final LinearLayoutManager layoutManager = new LinearLayoutManager(this);
mRecyHome.setLayoutManager(layoutManager);
mRecyHome.setAdapter(new HomeAdapter());
reFreshView = (PulltorefreshView) findViewById(R.id.refreshView);
reFreshView.setRefreshCallBack(this);
}
@Override
public void upRefresh(Scroller scroller, int y) {
scroller.startScroll(0, y, 0, -100);
reFreshView.invalidate();
}
@Override
public void downLoad(Scroller scroller,int y) {
scroller.startScroll(0, y, 0, 100);
reFreshView.invalidate();
}
class HomeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(MarkActivity.this).inflate(R.layout.item_bear,parent,false);
return new HomeViewHolder(view);
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
((HomeViewHolder) holder).tv_name.setText("美女"+position);
((HomeViewHolder) holder).iv_picture.setBackgroundResource(R.mipmap.ic_launcher);
}
@Override
public int getItemCount() {
return 10;
}
class HomeViewHolder extends RecyclerView.ViewHolder {
private TextView tv_name = null;
private ImageView iv_picture = null;
private HomeViewHolder(View itemView) {
super(itemView);
tv_name = (TextView) itemView.findViewById(R.id.tv_name);
iv_picture = (ImageView) itemView.findViewById(R.id.iv_picture);
}
}
}
}
|
[
"[email protected]"
] | |
a4a337b43e356e2eb3ce18a0964133a04f00b20f
|
6fb9750bc930a4c6b7bd6d6bfa5ad1eb60cbffeb
|
/pe.com.edu.siaa.core.rest/src/main/java/pe/com/edu/siaa/core/ejb/service/rest/seguridad/impl/UsuarioEntidadRestController.java
|
e48621f24ac659006e90cacbda69ddce7c2b43c7
|
[] |
no_license
|
LABECORPORATION/pe.com.edu.mercado.core.build
|
db65c02fbfd9e78707f626e5bfbcebc41a1cb6c1
|
cc7873c5a579c612cb6a154b39b096ff03f8463f
|
refs/heads/master
| 2023-06-09T10:01:44.087065 | 2021-07-02T15:24:40 | 2021-07-02T15:24:40 | 379,013,596 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,468 |
java
|
package pe.com.edu.siaa.core.ejb.service.rest.seguridad.impl;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
import pe.com.edu.siaa.core.ejb.factory.TransferDataObjectUtil;
import pe.com.edu.siaa.core.ejb.service.rest.impl.GenericServiceRestImpl;
import pe.com.edu.siaa.core.ejb.service.seguridad.local.SeguridadServiceLocal;
import pe.com.edu.siaa.core.model.dto.seguridad.UsuarioEntidadDTO;
import pe.com.edu.siaa.core.model.type.AccionType;
import pe.com.edu.siaa.core.vo.ResultadoRestVO;
/**
* La Class UsuarioEntidadRestController.
* <ul>
* <li>Copyright 2017 ndavilal -
* ndavilal. Todos los derechos reservados.</li>
* </ul>
*
* @author ndavilal
* @version 2.1, Mon Oct 16 14:31:03 COT 2017
* @since SIAA-CORE 2.1
*/
@Stateless
@Path("/usuarioEntidadRestController")
@Consumes(MediaType.APPLICATION_JSON )
@Produces(MediaType.APPLICATION_JSON)
public class UsuarioEntidadRestController extends GenericServiceRestImpl {
@EJB
private transient SeguridadServiceLocal seguridadServiceLocal;
@POST
public ResultadoRestVO<UsuarioEntidadDTO> crear(UsuarioEntidadDTO usuarioEntidad) throws Exception {
return controladorAccion(usuarioEntidad,AccionType.CREAR);
}
@PUT
public ResultadoRestVO<UsuarioEntidadDTO> modificar(UsuarioEntidadDTO usuarioEntidad) throws Exception {
return controladorAccion(usuarioEntidad,AccionType.MODIFICAR);
}
@DELETE
@Path("/{id}")
public ResultadoRestVO<UsuarioEntidadDTO> eliminar(@PathParam("id") String idUsuarioEntidad) throws Exception {
UsuarioEntidadDTO usuarioEntidad = new UsuarioEntidadDTO();
usuarioEntidad.setIdUsuarioEntidad(idUsuarioEntidad);
return controladorAccion(usuarioEntidad,AccionType.ELIMINAR);
}
private ResultadoRestVO<UsuarioEntidadDTO> controladorAccion(UsuarioEntidadDTO usuarioEntidad, AccionType accionType){
ResultadoRestVO<UsuarioEntidadDTO> resultado = new ResultadoRestVO<UsuarioEntidadDTO>();
try {
resultado.setObjetoResultado(seguridadServiceLocal.controladorAccionUsuarioEntidad(usuarioEntidad,accionType));
} catch (Exception e) {
parsearResultadoError(e, resultado);
}
return resultado;
}
@GET
@Path("/get/{id}")
public ResultadoRestVO<UsuarioEntidadDTO> finById(@PathParam("id") String idUsuarioEntidad) throws Exception {
UsuarioEntidadDTO usuarioEntidad = new UsuarioEntidadDTO();
usuarioEntidad.setIdUsuarioEntidad(idUsuarioEntidad);
return controladorAccion(usuarioEntidad,AccionType.FIND_BY_ID);
}
@GET
@Path("/listar")
public ResultadoRestVO<UsuarioEntidadDTO> listarUsuarioEntidad(@Context UriInfo info){
ResultadoRestVO<UsuarioEntidadDTO> resultado = new ResultadoRestVO<UsuarioEntidadDTO>();
UsuarioEntidadDTO usuarioEntidad = transferUriInfo(info);
try {
resultado.setListaResultado(seguridadServiceLocal.listarUsuarioEntidad(usuarioEntidad));
} catch (Exception e) {
parsearResultadoError(e, resultado);
}
return resultado;
}
@GET
@Path("/contar")
public ResultadoRestVO<UsuarioEntidadDTO> contarUsuarioEntidad(@Context UriInfo info){
ResultadoRestVO<UsuarioEntidadDTO> resultado = new ResultadoRestVO<UsuarioEntidadDTO>();
UsuarioEntidadDTO usuarioEntidad = transferUriInfo(info);
try {
resultado.setContador(seguridadServiceLocal.contarListarUsuarioEntidad(usuarioEntidad));
if (resultado.isData()) {
resultado.setListaResultado(seguridadServiceLocal.listarUsuarioEntidad(usuarioEntidad));
}
} catch (Exception e) {
parsearResultadoError(e, resultado);
}
return resultado;
}
@GET
@Path("/")
public ResultadoRestVO<UsuarioEntidadDTO> inicializarUsuarioEntidad(@Context UriInfo info) throws Exception {
UsuarioEntidadDTO usuarioEntidad = transferUriInfo(info);
ResultadoRestVO<UsuarioEntidadDTO> resultado = new ResultadoRestVO<UsuarioEntidadDTO>();
try {
resultado.setObjetoResultado(usuarioEntidad);
} catch (Exception e) {
parsearResultadoError(e, resultado);
}
return resultado;
}
private UsuarioEntidadDTO transferUriInfo(@Context UriInfo info) {
UsuarioEntidadDTO resultado = TransferDataObjectUtil.transferObjetoEntityGetRestDTO(info,UsuarioEntidadDTO.class);
return resultado;
}
}
|
[
"[email protected]"
] | |
72fa2320d9305556bd0ae6d8dac097bf41b85fc0
|
b6ccb1d3f20ff03afe060ffdf1dd257fc896bfb2
|
/emailDemo/src/main/java/com/email/demo/object/User.java
|
84801787b5f0e405d73e3d23e0b8697dd00a3254
|
[] |
no_license
|
fengfanchen/Java
|
c77bc24ecdfefec3998c240b61c2559cd5c82721
|
efbf1e8e84a66438d995037513e049afa4ab041f
|
refs/heads/master
| 2022-12-10T23:16:37.858187 | 2022-11-29T03:07:34 | 2022-11-29T03:07:34 | 192,455,455 | 38 | 69 | null | 2022-11-29T03:15:22 | 2019-06-18T03:04:24 |
Java
|
UTF-8
|
Java
| false | false | 2,307 |
java
|
package com.email.demo.object;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import java.util.Objects;
@Entity
public class User {
private int userId;
private String userName;
private String userPassword;
private String userActive;
private Integer userStatus;
private String userEmail;
@Id
@Column(name = "user_id")
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
@Basic
@Column(name = "user_name")
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
@Basic
@Column(name = "user_password")
public String getUserPassword() {
return userPassword;
}
public void setUserPassword(String userPassword) {
this.userPassword = userPassword;
}
@Basic
@Column(name = "user_active")
public String getUserActive() {
return userActive;
}
public void setUserActive(String userActive) {
this.userActive = userActive;
}
@Basic
@Column(name = "user_status")
public Integer getUserStatus() {
return userStatus;
}
public void setUserStatus(Integer userStatus) {
this.userStatus = userStatus;
}
@Basic
@Column(name = "user_email")
public String getUserEmail() {
return userEmail;
}
public void setUserEmail(String userEmail) {
this.userEmail = userEmail;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
User user = (User) o;
return userId == user.userId &&
Objects.equals(userName, user.userName) &&
Objects.equals(userPassword, user.userPassword) &&
Objects.equals(userActive, user.userActive) &&
Objects.equals(userStatus, user.userStatus) &&
Objects.equals(userEmail, user.userEmail);
}
@Override
public int hashCode() {
return Objects.hash(userId, userName, userPassword, userActive, userStatus, userEmail);
}
}
|
[
"[email protected]"
] | |
bbd00f57294206b37c6b928f76c14a5c7eed8bbe
|
8d06c5d98a374cb4f6746bd4461370ac086c6e9b
|
/src/main/java/ua/com/andriy/config/DataConfig.java
|
cb0178f740a9f5f0d89286ceec5797ac6001b0fd
|
[] |
no_license
|
Andreus75/Library
|
a55ec2eeec56c7520903142edbc514510c86a4da
|
88abaa116b8c24be72c49b6bb3cce158a1ee9c89
|
refs/heads/master
| 2023-04-25T03:12:15.798891 | 2021-05-12T08:36:47 | 2021-05-12T08:36:47 | 300,051,704 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,274 |
java
|
package ua.com.andriy.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.JpaVendorAdapter;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.orm.jpa.vendor.Database;
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
import java.util.Properties;
@Configuration
@EnableJpaRepositories("ua.com.andriy.dao")
@EnableTransactionManagement
public class DataConfig {
@Bean
public DataSource dataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setUrl("jdbc:mysql://localhost:3306/library?createDatabaseIfNotExist=true");
dataSource.setDriverClassName("com.mysql.jdbc.Driver");
dataSource.setUsername("root");
dataSource.setPassword("root");
return dataSource;
}
@Bean
public JpaVendorAdapter vendorAdapter() {
HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
vendorAdapter.setDatabase(Database.MYSQL);
vendorAdapter.setShowSql(true);
return vendorAdapter;
}
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
LocalContainerEntityManagerFactoryBean factoryBean = new LocalContainerEntityManagerFactoryBean();
factoryBean.setDataSource(dataSource());
factoryBean.setJpaVendorAdapter(vendorAdapter());
factoryBean.setPackagesToScan("ua.com.andriy.model");
Properties properties = new Properties();
properties.put("hibernate.hbm2ddl.auto", "update");
factoryBean.setJpaProperties(properties);
return factoryBean;
}
@Bean
public JpaTransactionManager transactionManager (EntityManagerFactory factory) {
return new JpaTransactionManager(factory);
}
}
|
[
"[email protected]"
] | |
80ea3f97bb47635c39ec5f879aa9858bbd457b61
|
c3b9bc58dd2f70a73f6aacb4d1ed2cf367356014
|
/src/main/java/com/jpworks/datajdbc/MainApplication.java
|
b5e37aaff19aef04a41cd2652037708df040d8e0
|
[
"Apache-2.0"
] |
permissive
|
mijaresorlando/ws-employee-soapspringws
|
e728181d100cae5ab3109b91cd598a4410c3922d
|
46e85846412b7c9f0bd877994e0e741c8ed5db21
|
refs/heads/main
| 2022-12-27T04:22:55.615458 | 2020-10-12T20:51:29 | 2020-10-12T20:51:29 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 308 |
java
|
package com.jpworks.datajdbc;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class MainApplication {
public static void main(String[] args) {
SpringApplication.run(MainApplication.class, args);
}
}
|
[
"[email protected]"
] | |
87cedbc4188132eb10f0def65e20300a0ec448a0
|
618310e0ee42aa084779df14f08b8e0bf48f62f4
|
/app/src/main/java/com/faishalbadri/hijab/util/Singleton/LoadingStatus.java
|
8e0ed85445d369d28dc97ba334b8860d68951f3a
|
[] |
no_license
|
FaishalAlbadri/WarningMVP
|
d1e1394e62ba4c0f8f988bace2c60c9d48e37180
|
e8f7509822d89fb50c084a904a21c8e085c4882b
|
refs/heads/master
| 2021-05-07T18:40:00.203797 | 2018-03-03T14:15:05 | 2018-03-03T14:15:05 | 108,804,138 | 0 | 0 | null | 2018-02-17T18:07:18 | 2017-10-30T05:06:10 |
Java
|
UTF-8
|
Java
| false | false | 530 |
java
|
package com.faishalbadri.hijab.util.Singleton;
/**
* Created by fikriimaduddin on 04/01/18.
*/
public class LoadingStatus {
private static LoadingStatus mInstance = null;
private String status;
public LoadingStatus() {
status = null;
}
public static LoadingStatus getInstance() {
if (mInstance == null) {
mInstance = new LoadingStatus();
}
return mInstance;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
}
|
[
"[email protected]"
] | |
8c086b3a3fa19163aaae37586dd92d51dc6fd988
|
80f2a3291e8d7f69dcc980529df42fada4a30546
|
/engine_java/000_Engine_Core/gfx/com/cell/gfx/particle/IParticleLauncher.java
|
fd593bf8c370294d77710bffd1ce58edfb8a0079
|
[] |
no_license
|
Letractively/cellengine
|
5b125d8418df1e108fd4d24557553c23af671aff
|
4f79ddc33f0f45c3ac6d3da7ef2eb3b1e97a9ded
|
refs/heads/master
| 2016-08-12T18:40:47.360983 | 2012-12-04T08:57:18 | 2012-12-04T08:57:18 | 46,205,801 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 928 |
java
|
package com.cell.gfx.particle;
import com.cell.gfx.IGraphics;
/**
* Particle Launcher.</br>
* do something what particle movement.
* @author yifeizhang
* @since 2006-12-5
* @version 1.0
*/
public interface IParticleLauncher {
/**
* Initial Emitted Particle.
* @param particle
* @param id
*/
public void particleEmitted(CParticle particle, int id);
/**
* when the Particle Terminated.
* @param particle
* @param id
*/
public void particleTerminated(CParticle particle, int id);
/**
* Affected the Particle.
* @param particle
* @param id
*/
public void particleAffected(CParticle particle, int id);
/**
* Render the Particle.
* @param g
* @param x TODO
* @param y TODO
* @param particle
* @param id
* @param x
* @param y
*/
public void particleRender(IGraphics g, int x, int y, CParticle particle, int id);
}
|
[
"wazazhang@3d9cc3ef-9625-0410-a0f0-cde76ce531e7"
] |
wazazhang@3d9cc3ef-9625-0410-a0f0-cde76ce531e7
|
74e0994674911d02190ce7afcfc771b906901899
|
513713b44a0ee52774210cef17f89bc00614f772
|
/observer/src/poetchess/observer/weather_observable/ForecastDisplay.java
|
307553d39c3560622117c1fa07acc75551928088
|
[] |
no_license
|
poetchess/design_pattern_in_java
|
8f83e4808c88d702d454b4654eaa0a0089781e2f
|
275f8afb2a3ac2fc4465278bcfa0d95c488a5ca2
|
refs/heads/master
| 2020-06-18T18:11:18.764217 | 2017-12-24T08:45:40 | 2017-12-24T08:45:40 | 94,172,260 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,115 |
java
|
package poetchess.observer.weather_observable;
import java.util.Observable;
import java.util.Observer;
/**
* Created by poetchess on 17-6-13.
*/
public class ForecastDisplay implements Observer, DisplayElement {
private float currentPressure = 29.92f;
private float lastPressure;
public ForecastDisplay(Observable observable) {
observable.addObserver(this);
}
@Override
public void update(Observable o, Object arg) {
if (o instanceof WeatherData) {
WeatherData wd = (WeatherData)o;
lastPressure = currentPressure;
currentPressure = wd.getPressure();
display();
}
}
@Override
public void display() {
System.out.print("Forecast: ");
if (currentPressure > lastPressure) {
System.out.println("Improving weather on the way!");
} else if (currentPressure == lastPressure) {
System.out.println("More of the same");
} else if (currentPressure < lastPressure) {
System.out.println("Watch out for cooler, rainy weather");
}
}
}
|
[
"[email protected]"
] | |
bf432ed700b3b46194172b8aef8687d3c51dd853
|
53c81a3a69af1862cc7d5b03a03b63050400dd28
|
/src/main/java/cn/edu/sjtu/se/dclab/haiercloud/web/scale/IMysqlScaling.java
|
3f747402c8d1bdc7d842acbd442e1a339b3db1b6
|
[] |
no_license
|
sjtudclab/haier-cloud-webapp
|
fd1087efe1318d8ec7bce1b3dc26dc26cdf2639c
|
ed4b6ae4c2bed6345d8be9f895ad9802b766c4d6
|
refs/heads/master
| 2016-09-05T16:36:24.417235 | 2013-12-11T11:25:59 | 2013-12-11T11:25:59 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 88 |
java
|
package cn.edu.sjtu.se.dclab.haiercloud.web.scale;
public interface IMysqlScaling {
}
|
[
"[email protected]"
] | |
86a91e8544e4545c1bc8e47b37736ab0491e6ed9
|
b45ac7c425d081a60c95be7d6e96f1279fb0deba
|
/src/stc/states/LevelSelect.java
|
3dd36130e18eb25ca2eb3a3481dbb4b2f4a297bc
|
[] |
no_license
|
Skylaark/squaringthecircle
|
7575d8017b3c44861f3c159d358ff358b4482a9e
|
2ea412e188b9880010621c91ecf79dbd889c6af6
|
refs/heads/master
| 2021-01-01T18:44:48.275858 | 2017-07-26T13:38:15 | 2017-07-26T13:38:15 | 98,423,097 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,869 |
java
|
package stc.states;
import org.newdawn.slick.Color;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Input;
import stc.GameState;
import stc.Model;
import stc.TransitionManager;
import stc.UI.UIButton;
import stc.UI.UILabel;
import stc.UI.UIRenderable;
import java.util.ArrayList;
/**
* Created by Ollie on 20/05/2017.
*/
public class LevelSelect {
private GameState gs;
private TransitionManager tm;
private Model m;
private ArrayList<UIRenderable> staticUI;
private ArrayList<UIRenderable> rotatingUI;
public LevelSelect(GameState gameState, TransitionManager tm, GameContainer gc) {
gs = gameState;
this.tm = tm;
m = gs.m;
//Static UI
staticUI = new ArrayList<>();
UILabel tmpLabel = new UILabel(gc);
tmpLabel.text = "Arrow keys to choose level\nEnter to play, Esc to go back";
tmpLabel.anchor.set(0.5f, 0.5f);
tmpLabel.offset.set(0f, 0.7f);
tmpLabel.color = Color.green.darker(0.4f);
staticUI.add(tmpLabel.clone());
//Rotating UI
rotatingUI = new ArrayList<>();
UIButton tmpButton = new UIButton(m.getProperty("name"), gc);
tmpButton.anchor.set(0.5f, 0.5f);
tmpButton.offset.set(0f, -0.46f);
tmpButton.setTransparentBox(true);
tmpButton.setOnClickCallback(() -> {
tm.transitionGrow(m, GameState.State.LEVEL, 1.0f, 0.3f);
});
rotatingUI.add(tmpButton.clone());
tmpButton.setText(m.getProperty("prev").split("\\.")[0]);
tmpButton.rotation = 90f;
tmpButton.setOnClickCallback(() -> {
tm.transitionFadeRotate(m, new Model(m.getProperty("prev"), 0.6f, 0f), gs.currentState, -90, 0.3f);
});
rotatingUI.add(tmpButton.clone());
tmpButton.setText(m.getProperty("next").split("\\.")[0]);
tmpButton.rotation = -90f;
tmpButton.setOnClickCallback(() -> {
tm.transitionFadeRotate(m, new Model(m.getProperty("next"), 0.6f, 0f), gs.currentState, 90, 0.3f);
});
rotatingUI.add(tmpButton.clone());
}
public void update(GameContainer gc) {
m = gs.m;
if(gc.getInput().isKeyDown(Input.KEY_ENTER)) {
tm.transitionGrow(m, GameState.State.LEVEL, 1.0f, 0.3f);
}
if(gc.getInput().isKeyDown(Input.KEY_ESCAPE)) {
tm.transitionFade(m, new Model("menu.txt", 0.6f, 0f), GameState.State.MENU, 0.4f);
}
if(gc.getInput().isKeyPressed(Input.KEY_RIGHT)) {
tm.transitionFadeRotate(m, new Model(m.getProperty("next"), 0.6f, 0f), gs.currentState, 90, 0.3f);
}
else if(gc.getInput().isKeyPressed(Input.KEY_LEFT)) {
tm.transitionFadeRotate(m, new Model(m.getProperty("prev"), 0.6f, 0f), gs.currentState, -90, 0.3f);
}
if(gc.getInput().isKeyPressed(Input.KEY_SPACE)) {
m.toggleRedBlue();
}
for(UIRenderable r : staticUI) {
r.update();
}
for(UIRenderable r : rotatingUI) {
r.update();
}
}
public void render(GameContainer gc, Graphics g) {
gs.m.render(gc, g);
renderText(g, gs.m);
}
public void renderText(Graphics g, Model m) {
((UIButton)rotatingUI.get(0)).setText(m.getProperty("name"));
((UIButton)rotatingUI.get(1)).setText(m.getProperty("prev").split("\\.")[0]);
((UIButton)rotatingUI.get(2)).setText(m.getProperty("next").split("\\.")[0]);
if(gs.currentState == GameState.State.TRANSITION) {
if(tm.getNewState() == GameState.State.LEVEL || gs.previousState == GameState.State.LEVEL) {
for(UIRenderable r : rotatingUI) {
r.color.a = 1f-(m.getScale()-0.6f)*2.5f;
r.scale = m.getScale()/0.6f;
r.offsetRotation(m.getRotation());
r.scaleOffset(m.getScale());
r.render(g);
}
} else {
for(UIRenderable r : rotatingUI) {
r.color.a = m.getOpacity();
r.scale = m.getScale()/0.6f;
r.offsetRotation(m.getRotation());
r.scaleOffset(m.getScale());
r.render(g);
}
}
} else {
for(UIRenderable r : rotatingUI) {
r.color.a = m.getOpacity();
r.scale = m.getScale()/0.6f;
r.offsetRotation(m.getRotation());
r.scaleOffset(m.getScale());
r.render(g);
}
}
for(UIRenderable r : staticUI) {
r.scale = m.getScale()/0.6f;
r.scaleOffset(m.getScale());
r.color.a = m.getOpacity();
r.render(g);
}
}
}
|
[
"[email protected]"
] | |
d607b304a2393dbf857d35e85a874762e3c7acc7
|
b4767ad5daa9710083cf6be73a693217a1198957
|
/common/spring-cloud-common-model/src/main/java/cn/com/lisz/common/model/base/RoleModel.java
|
b89d6af4249ff748c47d8a8ee8ba4b63c6f6691e
|
[] |
no_license
|
lishuozhe/spring-cloud
|
792ba41ec8b3b411fd806b83e7a185e6160d86a9
|
da45e2f835903f452920c2513659047503138f44
|
refs/heads/master
| 2022-07-29T08:06:36.911242 | 2022-07-11T11:11:55 | 2022-07-11T11:11:55 | 196,919,848 | 0 | 1 | null | 2022-07-11T11:11:55 | 2019-07-15T03:49:04 |
Java
|
UTF-8
|
Java
| false | false | 762 |
java
|
package cn.com.lisz.common.model.base;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.util.List;
import cn.com.lisz.common.model.BaseModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ApiModel(value = "角色", description = "角色模型")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class RoleModel extends BaseModel {
@ApiModelProperty(value = "角色编码", required = true, example = "ADMIN")
private String code;
@ApiModelProperty(value = "角色名称", required = true, example = "管理员")
private String name;
@ApiModelProperty(value = "角色权限")
private List<PermissionModel> permissions;
}
|
[
"[email protected]"
] | |
ae400627bb82b96a37daee0c04c42b880643e19d
|
e5a8c17e3109386f6f0a2f863517637a81e264b7
|
/Eclipse_WS/apitraining/src/main/java/com/synechron/apiautomation/apitraining/post/GitRepoPOJO.java
|
473b9c0da866a95f233b8c7c6909163cdaf7d307
|
[] |
no_license
|
AravindaHB/Synechron_API_Automation
|
9b7eba325f3626cc28bdf8e2e75f6a1ecfd0e030
|
a0bb521eaa8f029a03c0d4198f9c1df182944e32
|
refs/heads/master
| 2023-08-10T16:40:15.511870 | 2021-09-24T10:51:26 | 2021-09-24T10:51:26 | 409,167,569 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 392 |
java
|
package com.synechron.apiautomation.apitraining.post;
public class GitRepoPOJO {
private String name;
private String description;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
|
[
"[email protected]"
] | |
e5a66c170e3f65dfd656578eec995e8e54b304f4
|
e7cb38a15026d156a11e4cf0ea61bed00b837abe
|
/groundwork-monitor-platform/agents/cloudhub/src/main/java/org/groundwork/cloudhub/connectors/rhev/restapi/Clusters.java
|
46bf2c5f1f836938ce5ace7476fea59d73ce7551
|
[] |
no_license
|
wang-shun/groundwork-trunk
|
5e0ce72c739fc07f634aeefc8f4beb1c89f128af
|
ea1ca766fd690e75c3ee1ebe0ec17411bc651a76
|
refs/heads/master
| 2020-04-01T08:50:03.249587 | 2018-08-20T21:21:57 | 2018-08-20T21:21:57 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,336 |
java
|
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2013.02.07 at 03:07:31 PM PST
//
package org.groundwork.cloudhub.connectors.rhev.restapi;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import java.util.ArrayList;
import java.util.List;
/**
* <p>Java class for Clusters complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="Clusters">
* <complexContent>
* <extension base="{}BaseResources">
* <sequence>
* <element ref="{}cluster" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Clusters", propOrder = {
"clusters"
})
public class Clusters
extends BaseResources
{
@XmlElement(name = "cluster")
protected List<Cluster> clusters;
/**
* Gets the value of the clusters property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the clusters property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getClusters().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Cluster }
*
*
*/
public List<Cluster> getClusters() {
if (clusters == null) {
clusters = new ArrayList<Cluster>();
}
return this.clusters;
}
public boolean isSetClusters() {
return ((this.clusters!= null)&&(!this.clusters.isEmpty()));
}
public void unsetClusters() {
this.clusters = null;
}
}
|
[
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.