blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 7
410
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
684M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 132
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 28
values | content
stringlengths 3
9.45M
| authors
listlengths 1
1
| author_id
stringlengths 0
352
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0495a3a4b938b9b0924bc65302565f6209e420ff
|
9dfb07095844525a9d1b5a3e5de3cb840486c12b
|
/MinecraftServer/src/net/minecraft/util/text/TextComponentString.java
|
df4ca60f127711390cb74852cd4e47513ac72921
|
[] |
no_license
|
ilYYYa/ModdedMinecraftServer
|
0ae1870e6ba9d388afb8fd6e866ca6a62f96a628
|
7b8143a11f848bf6411917e3d9c60b0289234a3f
|
refs/heads/master
| 2020-12-24T20:10:30.533606
| 2017-04-03T15:32:15
| 2017-04-03T15:32:15
| 86,241,373
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,009
|
java
|
package net.minecraft.util.text;
public class TextComponentString extends TextComponentBase
{
private final String text;
public TextComponentString(String msg)
{
this.text = msg;
}
/**
* Gets the text value of this ChatComponentText. TODO: what are getUnformattedText and getUnformattedTextForChat
* missing that made someone decide to create a third equivalent method that only ChatComponentText can implement?
*/
public String getText()
{
return this.text;
}
/**
* Gets the text of this component, without any special formatting codes added, for chat. TODO: why is this two
* different methods?
*/
public String getUnformattedComponentText()
{
return this.text;
}
/**
* Creates a copy of this component. Almost a deep copy, except the style is shallow-copied.
*/
public TextComponentString createCopy()
{
TextComponentString textcomponentstring = new TextComponentString(this.text);
textcomponentstring.setStyle(this.getStyle().createShallowCopy());
for (ITextComponent itextcomponent : this.getSiblings())
{
textcomponentstring.appendSibling(itextcomponent.createCopy());
}
return textcomponentstring;
}
public boolean equals(Object p_equals_1_)
{
if (this == p_equals_1_)
{
return true;
}
else if (!(p_equals_1_ instanceof TextComponentString))
{
return false;
}
else
{
TextComponentString textcomponentstring = (TextComponentString)p_equals_1_;
return this.text.equals(textcomponentstring.getText()) && super.equals(p_equals_1_);
}
}
public String toString()
{
return "TextComponent{text=\'" + this.text + '\'' + ", siblings=" + this.siblings + ", style=" + this.getStyle() + '}';
}
}
|
[
"ilyyya.777@gmail.com"
] |
ilyyya.777@gmail.com
|
3771d11260d6e43d69dd583e890d16afdcd8831a
|
be73270af6be0a811bca4f1710dc6a038e4a8fd2
|
/crash-reproduction-moho/results/XWIKI-14227-25-9-SPEA2-WeightedSum:TestLen:CallDiversity/org/xwiki/job/AbstractJob_ESTest.java
|
59e0db077ec8f75bad819ed88444918ca3dc29d7
|
[] |
no_license
|
STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application
|
cf118b23ecb87a8bf59643e42f7556b521d1f754
|
3bb39683f9c343b8ec94890a00b8f260d158dfe3
|
refs/heads/master
| 2022-07-29T14:44:00.774547
| 2020-08-10T15:14:49
| 2020-08-10T15:14:49
| 285,804,495
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 542
|
java
|
/*
* This file was automatically generated by EvoSuite
* Sun Jan 19 00:11:19 UTC 2020
*/
package org.xwiki.job;
import org.junit.Test;
import static org.junit.Assert.*;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(useVFS = true, useJEE = true)
public class AbstractJob_ESTest extends AbstractJob_ESTest_scaffolding {
@Test
public void notGeneratedAnyTest() {
// EvoSuite did not generate any tests
}
}
|
[
"pouria.derakhshanfar@gmail.com"
] |
pouria.derakhshanfar@gmail.com
|
100a011922e39a134afc0ea81eacedf20e6e1e3f
|
baeaf2728e6edd2263eea48c1669be37bf5ebf8c
|
/Chapter2/LayoutPractice/app/src/test/java/com/android/layoutpractice/ExampleUnitTest.java
|
7bb95c93e822103d745b4d9d04c71bcdaf2b63d6
|
[] |
no_license
|
jessi87/DoitAndroid
|
4fba093bbaf89842566c36b5bd196b07c9df77a6
|
f10557a24260142be12279753068b6c17d55040a
|
refs/heads/master
| 2021-04-01T09:02:30.284153
| 2020-09-18T08:31:05
| 2020-09-18T08:31:05
| 241,541,197
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 387
|
java
|
package com.android.layoutpractice;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}
|
[
"jessiseo87@gmail.com"
] |
jessiseo87@gmail.com
|
8f6a8455a9788a9ca43cafc587ffd2a83691a338
|
612dcd2dda7b762cec49ef740497b4481be2fdbf
|
/src/com/rtg/util/arithcode/Order0ModelBuilder.java
|
a61de0b55eb4ac4a05824aced0119120b7dacc64
|
[
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
usernamegemaoa/rtg-tools
|
01c38c2d88ef318f2bddedde5bb08821f5c9d204
|
eb13bbb82d2fbeab7d54a92e8493ddd2acf0d349
|
refs/heads/master
| 2021-01-19T21:41:59.433014
| 2016-10-17T21:47:27
| 2016-10-17T21:47:27
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,940
|
java
|
/*
* Copyright (c) 2014. Real Time Genomics Limited.
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.rtg.util.arithcode;
/**
*/
public class Order0ModelBuilder implements ArithModelBuilder {
private final int[] mCounts;
/**
* @param range number of different symbols > 0
*/
public Order0ModelBuilder(final int range) {
mCounts = new int[range];
}
@Override
public void add(byte[] buffer, int offset, int length) {
for (int i = offset; i < offset + length; i++) {
mCounts[buffer[i]]++;
}
}
@Override
public ArithCodeModel model() {
return new StaticModel(mCounts);
}
}
|
[
"len@realtimegenomics.com"
] |
len@realtimegenomics.com
|
131895245d73c60299d3e710f010d723677c14ed
|
10a15b46b1d0026fe375c889735261eefe7fef30
|
/management/src/main/java/com/epam/cdp/management/dao/FailQueueDao.java
|
66e68588057731b8e40e05424b2b2456fc1fb863
|
[] |
no_license
|
Geniy00/cdp-jms
|
7646815031d5de48c1d2a1d9d76ff88be8e68acf
|
6b9a7e2590906f45033b44a5282a0e8a18b0226d
|
refs/heads/master
| 2021-01-01T16:50:31.487842
| 2015-01-17T08:23:36
| 2015-01-17T08:23:36
| 11,159,207
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 375
|
java
|
package com.epam.cdp.management.dao;
import com.epam.cdp.core.entity.FailQueueMessage;
import java.util.List;
/**
* @author Geniy00
*/
public interface FailQueueDao {
FailQueueMessage saveOrUpdate(FailQueueMessage failQueueMessage);
void delete(FailQueueMessage failQueueMessage);
FailQueueMessage find(Long id);
List<FailQueueMessage> findAll();
}
|
[
"geniyk@gmail.com"
] |
geniyk@gmail.com
|
683e1724d73ac8809fe09718e94894c1d41f3d4f
|
64efda733945bb6b239a7f792bd26f0dcafd02c7
|
/Zoo/src/codekamp/Dog.java
|
a5db53bd51565fb3b09c82b5a5b2cebe5c6c2438
|
[] |
no_license
|
puneetrix/java_aug
|
54622cf99fb5212363a714db3a2ab27f36a89cb3
|
ca5f2b4b39ec11b6e5d98e3b565734ece5185f1d
|
refs/heads/master
| 2021-06-24T00:27:04.261701
| 2017-08-16T16:25:01
| 2017-08-16T16:25:01
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 485
|
java
|
package codekamp;
/**
* Created by cerebro on 14/08/17.
*/
public class Dog extends Animal {
public void bark() {
System.out.println("Wuff Wuff");
}
public void bark(String a, int b) {
System.out.println("Wuff " + a);
}
//method overloading
public void bark(int x, String y) {
System.out.println("Wuff " + y);
}
// this is method overriding
public void walk() {
System.out.println("fire fire");
}
}
|
[
"101.prashant@gmail.com"
] |
101.prashant@gmail.com
|
f1cd66589b73862a60a0a299c12095c44f9ba6d1
|
177fa54cb4b2b01c15ffb79d4ac7f49531369e1e
|
/ppmtool_full_stack/src/main/java/ferdis/personal/project/tool/ppm_tool/payLoad/LoginRequest.java
|
99d022066299de2e178c26548798f0cef32b5cc5
|
[] |
no_license
|
Ferdis17/ppm_too_fullstack
|
4c164bc4953481ced786ea449e37b2354cf77aae
|
1d11c88ef74be1ab46c5da40fb2254e9dc5120ec
|
refs/heads/master
| 2023-01-09T13:36:41.575541
| 2020-01-10T02:41:01
| 2020-01-10T02:41:01
| 201,809,155
| 1
| 0
| null | 2023-01-06T00:58:51
| 2019-08-11T19:56:49
|
JavaScript
|
UTF-8
|
Java
| false
| false
| 604
|
java
|
package ferdis.personal.project.tool.ppm_tool.payLoad;
import javax.validation.constraints.NotBlank;
public class LoginRequest {
@NotBlank(message = "Username cannot be blank")
private String userName;
@NotBlank(message = "Password cannot be blank")
private String password;
public String getUserName() {
return userName;
}
public void setUserName(String username) {
this.userName = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
|
[
"fmuriyesu@users.noreply.github.com"
] |
fmuriyesu@users.noreply.github.com
|
4be05f92611bcf50f51cd3ce725a377646ac9724
|
7ea6460affa5b2a2fdb7099d393eb977d08122d4
|
/OntologicalFramework/src/ontologyFramework/OFRunning/OFInitialising/OFBuilderInterface.java
|
c9626357cc6c5c8b93e25a641f2a95b0c6ba7880
|
[] |
no_license
|
buoncubi/OntologyFramework
|
4daa2e4132ed3039be5ecab2345bffd293e1173c
|
211bc56ad3ae731584ee83fa0806ff7b0deae963
|
refs/heads/master
| 2021-01-10T12:57:01.904626
| 2016-11-04T23:51:00
| 2016-11-04T23:51:00
| 43,822,117
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,703
|
java
|
package ontologyFramework.OFRunning.OFInitialising;
import java.util.Map;
import ontologyFramework.OFContextManagement.OWLReferences;
import ontologyFramework.OFRunning.OFInvokingManager.OFBuiltMapInvoker;
/**
* This interface is instantiated and called during the initialization phase of the software
* for the method {@link OFInitialiser#buildIndividual(org.semanticweb.owlapi.model.OWLNamedIndividual, OWLReferences)}.
* Its proposes is to be used to load classes into the framework.
* Than, they will be available trough the class: {@link OFBuiltMapInvoker}
* as a Map where the initialized class from an implementation of this Procedure can be retrieved
* based on the list name specified by the builder ontological individual.
*
* @author Buoncomapgni Luca
* @version 1.0
*/
/* @see ontologyFramework.OFRunning.OFInitialising.OFInitialiser
@see ontologyFramework.OFRunning.OFInitialising.OFBuilderCommon
@see ontologyFramework.OFDataMapping.OFDataMapperBuilder
@see ontologyFramework.OFErrorManagement.OFException.OFExceptionBuilder
@see ontologyFramework.OFEventManagement.OFTimeTriggerManagement.OFTimeTriggerBuilder
@see ontologyFramework.OFEventManagement.OFEventBuilder
@see ontologyFramework.synchronisingManager.OFSynchroniserBuilder
@see ontologyFramework.OFProcedureManagment.OFSchedulingBuilder*/
public interface OFBuilderInterface< T extends Object> {
/**
* Given references to the ontology, already initialized classes and key words it
* discover the ontology to retrieve information and initialize other classes.
* A call to this method should clear all stored variables that are used in
* {@link #getInitialisedClasses}
*
* @param keyWords retrieved by {@link OFBuilderCommon#getKeyWords(org.semanticweb.owlapi.model.OWLNamedIndividual, OWLReferences)}
* @param ontoRef reference to the ontology which contains the builder individual
* @param listInvoker references to already initialized classes from {@link OFInitialiser}
*/
public void buildInfo( String[] keyWords, OWLReferences ontoRef, OFBuiltMapInvoker listInvoker);
/**
* During initialization phase, {@link OFInitialiser} calls {@link #buildInfo(String[], OWLReferences, OFBuiltMapInvoker)}
* first and than retries the initialized Map from this method. Its returning value is add to the Map
* managed by {@link OFBuiltMapInvoker} with key value given by {@link OFBuilderCommon#getBuildedListName(org.semanticweb.owlapi.model.OWLNamedIndividual, OWLReferences)}.
*
* @return initialisedMap a Map which contains the initialized classes linked to a key (by default it
* is of type String}
*/
public Map< String, T> getInitialisedObject();
}
|
[
"luca.buoncompagni@edu.unige.it"
] |
luca.buoncompagni@edu.unige.it
|
9efbe1a5e69faba5fe0fc60eee4d8f95af4fc8dd
|
f4e92996602c00143dafb7a3dea993fd62797578
|
/ChatServerSide/src/ClientHandler.java
|
9add25f156ab050a43b9b6b69382ad3c0c8c0570
|
[] |
no_license
|
Liuzin/Chatt
|
c3489cc38c9755551470df4c5d1d0f947563c152
|
a756525b9afa4ef0dac0011d70e6779d9b699090
|
refs/heads/master
| 2020-04-06T03:38:21.527980
| 2016-06-05T19:13:02
| 2016-06-05T19:13:02
| 60,476,298
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,727
|
java
|
/**
* By Liuzin
* **/
//библиотеки, которые используем
import java.io.PrintWriter;
import java.net.Socket;
import java.util.Scanner;
public class ClientHandler implements Runnable {
//по сути все тоже самое, что и в клиенте: сокет, сканнер, принтврайтер (для получения и чтения сообщений)
private Socket s;
private Scanner in;
private PrintWriter out;
private String name;
public static int CLIENTS_NUM = 0;
//присвоение клиенту номера
public ClientHandler(Socket s) {
CLIENTS_NUM++;
this.s = s;
name = "Client #" + CLIENTS_NUM;
}
@Override
public void run() {
try {
in = new Scanner(s.getInputStream()); //считываение написанного
out = new PrintWriter(s.getOutputStream(), true); //написание сообщения от сервера
out.println("Hello, User!");
while (true) {
//переписка
if (in.hasNext()) {
String str = in.nextLine(); //считываение сообщений
System.out.println(name + ": " + str); //имя клиента + его сообщение
out.println("Echo: " + str); //ответ
if (str.equals("end")) //если написали "end", то все заканчивается
break;
}
}
s.close(); //закрытие сокета
} catch (Exception e) { //иииииииисключения
}
}
}
|
[
"katusha.tu@gmail.com"
] |
katusha.tu@gmail.com
|
39d01442f6b5c4b967e40d03215911ae29133ceb
|
35eb6e70a0f9b90d2e59cdebf37a142c0a85a3c3
|
/src/main/java/me/marcsteiner/glacier/GlacierWeb.java
|
7825bcea7c31d84e93fa552fe96363ff0fbe8c90
|
[
"MIT"
] |
permissive
|
my-legacy-projects/Glacier
|
5d2a04502447bff96278b1cd9952a93df26a34bd
|
f08e6f27c02a487bbd710be77e87724cc98127e1
|
refs/heads/master
| 2023-05-26T14:09:49.507382
| 2019-01-12T22:46:53
| 2019-01-12T22:46:53
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,131
|
java
|
package me.marcsteiner.glacier;
import me.marcsteiner.glacier.routes.blog.BlogRouter;
import org.kohsuke.MetaInfServices;
import ro.pippo.core.Application;
import ro.pippo.core.route.*;
import ro.pippo.freemarker.FreemarkerTemplateEngine;
@MetaInfServices
public class GlacierWeb extends Application {
@Override
protected void onInit() {
setTemplateEngine(new FreemarkerTemplateEngine());
setUploadLocation(Glacier.getInstance().getConfig().getString("upload.location"));
// Add routes for static content
addResourceRoute(new PublicResourceHandler());
addResourceRoute(new WebjarsResourceHandler());
addFileResourceRoute("/static", "static");
getRouter().ignorePaths("/favicon.ico");
addBeforeFilters();
// Groups
addRouteGroup(new BlogRouter());
GET("/", routeContext -> routeContext.redirect("/blog"));
addAfterFilters();
}
@Override
protected void onDestroy() {
}
private void addBeforeFilters() {
ANY("/.*", new CSRFHandler());
}
private void addAfterFilters() {
}
}
|
[
"git@marcsteiner.me"
] |
git@marcsteiner.me
|
2a26695c76d6dedeae68b37e7329c264e32ed5b7
|
8dad66dcbb57422926cbdacd982d09a2193b0321
|
/integration/broker-tests/tests-common/admin-clients/src/main/java/org/wso2/mb/integration/common/clients/AndesJMSConsumer.java
|
8ffe06bbbd63a6444fc38bf5f36c572bdb900cdf
|
[
"Apache-2.0"
] |
permissive
|
tongpi/product-ei
|
12617004c8cb3c5c74d340f05b67e8bc8602abad
|
d78699d0d88f1716bef1983305e82b8998fb8b1b
|
refs/heads/master
| 2021-04-18T19:12:22.513355
| 2019-01-22T06:45:04
| 2019-01-22T06:45:04
| 126,449,785
| 0
| 2
|
Apache-2.0
| 2019-01-22T06:45:05
| 2018-03-23T07:39:09
|
Java
|
UTF-8
|
Java
| false
| false
| 25,342
|
java
|
/*
* Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. 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.wso2.mb.integration.common.clients;
import org.apache.log4j.Logger;
import org.wso2.mb.integration.common.clients.configurations.AndesJMSConsumerClientConfiguration;
import org.wso2.mb.integration.common.clients.exceptions.AndesClientException;
import org.wso2.mb.integration.common.clients.operations.utils.AndesClientConstants;
import org.wso2.mb.integration.common.clients.operations.utils.AndesClientUtils;
import org.wso2.mb.integration.common.clients.operations.utils.ExchangeType;
import org.wso2.mb.integration.common.clients.operations.utils.JMSDeliveryStatus;
import javax.jms.Connection;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.MessageListener;
import javax.jms.Queue;
import javax.jms.QueueConnection;
import javax.jms.QueueConnectionFactory;
import javax.jms.QueueReceiver;
import javax.jms.QueueSession;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.jms.Topic;
import javax.jms.TopicConnection;
import javax.jms.TopicConnectionFactory;
import javax.jms.TopicSession;
import javax.jms.TopicSubscriber;
import javax.naming.NamingException;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicLong;
/**
* The JMS message consumer used for creating a consumer, reading messages synchronously and also
* asynchronously.
*/
public class AndesJMSConsumer extends AndesJMSBase
implements Runnable, MessageListener {
/**
* The logger used in logging information, warnings, errors and etc.
*/
private static Logger log = Logger.getLogger(AndesJMSConsumer.class);
/**
* The configuration for the consumer
*/
private final AndesJMSConsumerClientConfiguration consumerConfig;
/**
* Timestamp for the first message consumed
*/
private long firstMessageConsumedTimestamp;
/**
* Timestamp of the last message consumes
*/
private long lastMessageConsumedTimestamp;
/**
* The amount of messages received by the the consumer
*/
private AtomicLong receivedMessageCount;
/**
* The addition of the time differences between the timestamp at which it got published and the
* timestamp at which it got consumed for each message consumed.
*/
private long totalLatency;
/**
* The JMS connection used to create the JMS sessions
*/
private Connection connection;
/**
* The JMS session used to create the JMS receiver
*/
private Session session;
/**
* The receiver used the consume the received messages
*/
private MessageConsumer receiver;
/**
* Creates a new JMS consumer with a given configuration.
*
* @param config The configuration.
* @param createConsumer Creates the connection, session and receiver.
* @throws NamingException
* @throws JMSException
*/
public AndesJMSConsumer(AndesJMSConsumerClientConfiguration config, boolean createConsumer)
throws NamingException, JMSException {
super(config);
receivedMessageCount = new AtomicLong(0);
// Sets the configuration
this.consumerConfig = config;
if (createConsumer) {
if (ExchangeType.QUEUE == this.consumerConfig.getExchangeType()) {
this.createQueueConnection();
} else if (ExchangeType.TOPIC == this.consumerConfig.getExchangeType()) {
this.createTopicConnection();
}
}
}
/**
* Creates a topic connection, session and receiver.
*
* @throws NamingException
* @throws JMSException
*/
private void createTopicConnection() throws NamingException, JMSException {
// Creates a topic connection, sessions and receiver
TopicConnectionFactory connFactory = (TopicConnectionFactory) super.getInitialContext()
.lookup(AndesClientConstants.CF_NAME);
TopicConnection topicConnection = connFactory.createTopicConnection();
topicConnection.setClientID(this.consumerConfig.getSubscriptionID());
topicConnection.start();
TopicSession topicSession;
// Sets acknowledgement mode
if (TopicSession.SESSION_TRANSACTED == this.consumerConfig.getAcknowledgeMode().getType()) {
topicSession = topicConnection
.createTopicSession(true, this.consumerConfig.getAcknowledgeMode().getType());
} else {
topicSession = topicConnection
.createTopicSession(false, this.consumerConfig.getAcknowledgeMode().getType());
}
Topic topic =
(Topic) super.getInitialContext().lookup(this.consumerConfig.getDestinationName());
connection = topicConnection;
session = topicSession;
// If topic is durable
if (this.consumerConfig.isDurable()) {
// If selectors exists
if (null != this.consumerConfig.getSelectors()) {
receiver = topicSession.createDurableSubscriber(topic, this.consumerConfig
.getSubscriptionID(), this.consumerConfig.getSelectors(), false);
} else {
receiver = topicSession
.createDurableSubscriber(topic, this.consumerConfig.getSubscriptionID());
}
} else {
// If selectors exists
if (null != this.consumerConfig.getSelectors()) {
receiver = topicSession
.createSubscriber(topic, this.consumerConfig.getSelectors(), false);
} else {
receiver = topicSession.createSubscriber(topic);
}
}
}
/**
* Creates a queue connection, session and receiver.
*
* @throws NamingException
* @throws JMSException
*/
private void createQueueConnection() throws NamingException, JMSException {
// Creates a queue connection, sessions and receiver
QueueConnectionFactory connFactory = (QueueConnectionFactory) super.getInitialContext()
.lookup(AndesClientConstants.CF_NAME);
QueueConnection queueConnection = connFactory.createQueueConnection();
queueConnection.start();
QueueSession queueSession;
// Sets acknowledgement mode
if (QueueSession.SESSION_TRANSACTED == this.consumerConfig.getAcknowledgeMode().getType()) {
queueSession = queueConnection
.createQueueSession(true, this.consumerConfig.getAcknowledgeMode().getType());
} else {
queueSession = queueConnection
.createQueueSession(false, this.consumerConfig.getAcknowledgeMode().getType());
}
Queue queue =
(Queue) super.getInitialContext().lookup(this.consumerConfig.getDestinationName());
connection = queueConnection;
session = queueSession;
// If selectors exists
if (null != this.consumerConfig.getSelectors()) {
receiver = queueSession.createReceiver(queue, this.consumerConfig.getSelectors());
} else {
receiver = queueSession.createReceiver(queue);
}
}
/**
* {@inheritDoc}
*/
@Override
public void startClient() throws AndesClientException, JMSException {
if (null != connection && null != session && null != receiver) {
log.info("Starting Consumer");
if (this.consumerConfig.isAsync()) {
// Use an asynchronous message listener
receiver.setMessageListener(this);
} else {
// Uses a thread to listen to messages
Thread consumerThread = new Thread(this);
consumerThread.start();
}
} else {
throw new AndesClientException("The connection, session and message receiver is not assigned.");
}
}
/**
* {@inheritDoc}
*/
@Override
public void stopClient(){
/**
* Using a separate thread as stopping the consumer on "onMessage" thread is not allowed.
*/
Thread stopThread = new Thread(new Runnable() {
@Override
public void run() {
if (null != connection && null != session && null != receiver) {
try {
log.info("Closing Consumer");
if (ExchangeType.TOPIC == consumerConfig.getExchangeType()) {
if (null != receiver) {
TopicSubscriber topicSubscriber = (TopicSubscriber) receiver;
topicSubscriber.close();
}
if (null != session) {
TopicSession topicSession = (TopicSession) session;
topicSession.close();
}
if (null != connection) {
TopicConnection topicConnection = (TopicConnection) connection;
topicConnection.close();
}
} else if (ExchangeType.QUEUE == consumerConfig.getExchangeType()) {
if (null != receiver) {
QueueReceiver queueReceiver = (QueueReceiver) receiver;
queueReceiver.close();
}
if (null != session) {
QueueSession queueSession = (QueueSession) session;
queueSession.close();
}
if (null != connection) {
QueueConnection queueConnection = (QueueConnection) connection;
queueConnection.stop();
queueConnection.close();
}
}
receiver = null;
session = null;
connection = null;
log.info("Consumer Closed");
} catch (JMSException e) {
log.error("Error in stopping client.", e);
throw new RuntimeException("Error in stopping client.", e);
}
}
}
});
stopThread.start();
try {
stopThread.join();
} catch (InterruptedException e) {
throw new RuntimeException("Error waiting for subscriber to stop", e);
}
}
public void stopClientSync(){
if (null != connection && null != session && null != receiver) {
try {
log.info("Closing Consumer");
if (ExchangeType.TOPIC == consumerConfig.getExchangeType()) {
if (null != receiver) {
TopicSubscriber topicSubscriber = (TopicSubscriber) receiver;
topicSubscriber.close();
}
if (null != session) {
TopicSession topicSession = (TopicSession) session;
topicSession.close();
}
if (null != connection) {
TopicConnection topicConnection = (TopicConnection) connection;
topicConnection.close();
}
} else if (ExchangeType.QUEUE == consumerConfig.getExchangeType()) {
if (null != receiver) {
QueueReceiver queueReceiver = (QueueReceiver) receiver;
queueReceiver.close();
}
if (null != session) {
QueueSession queueSession = (QueueSession) session;
queueSession.close();
}
if (null != connection) {
QueueConnection queueConnection = (QueueConnection) connection;
queueConnection.stop();
queueConnection.close();
}
}
receiver = null;
session = null;
connection = null;
log.info("Consumer Closed");
} catch (JMSException e) {
log.error("Error in stopping client.", e);
throw new RuntimeException("Error in stopping client.", e);
}
}
}
/**
* Un-Subscribes and closes a consumers.
*
* @param stopClient true if the client needs to stopped after un-subscribing, false otherwise.
* @throws JMSException
*/
public void unSubscribe(final boolean stopClient) throws JMSException {
/**
* Using a separate thread as un-subscribing the consumer on "onMessage" thread is not allowed.
*/
Thread unsubscribeThread = new Thread(new Runnable() {
@Override
public void run() {
if (null != connection && null != session && null != receiver) {
try {
log.info("Un-subscribing Subscriber");
session.unsubscribe(consumerConfig.getSubscriptionID());
log.info("Subscriber Un-Subscribed");
if (stopClient) {
stopClient();
}
} catch (JMSException e) {
log.error("Error in removing subscription(un-subscribing).", e);
throw new RuntimeException("JMSException : Error in removing subscription(un-subscribing).", e);
}
} else {
AndesClientException andesClientException =
new AndesClientException("The connection, session and message receiver is not assigned.");
log.error("The connection, session and message receiver is not assigned.", andesClientException);
throw new RuntimeException("The connection, session and message receiver is not assigned.", andesClientException);
}
}
});
unsubscribeThread.start();
try {
unsubscribeThread.join();
} catch (InterruptedException e) {
throw new RuntimeException("Error waiting for consumer to unsubscribe", e);
}
}
/**
* {@inheritDoc}
*/
@Override
public void run() {
try {
boolean interrupted = false;
while (true) {
Message message = this.receiver.receive();
// We assume message receiving was interrupted if we receive null
if (null == message) {
interrupted = true;
break;
} else if ( processReceivedMessage(message)) {
break;
}
}
if (!interrupted) {
stopClientSync();
}
} catch (JMSException e) {
log.error("Error while receiving messages ", e);
throw new RuntimeException("JMSException : Error while listening to messages", e);
} catch (IOException e) {
log.error("Error while writing message to file", e);
throw new RuntimeException("IOException : Error while writing message to file\"", e);
}
}
/**
* {@inheritDoc}
*/
@Override
public void onMessage(Message message) {
try {
boolean success = this.processReceivedMessage(message);
if(success) {
stopClient();
}
} catch (JMSException e) {
log.error("Error while listening to messages", e);
throw new RuntimeException("Error while listening to messages", e);
} catch (IOException e) {
log.error("Error while writing message to file", e);
throw new RuntimeException("Error while listening to messages", e);
}
}
/**
* Processes the received messages. The processing includes the following actions. 1.
* Calculation of transactions per second. 2. Calculation of average latency for messages. 3.
* Message detail logging 4. Writes messages to a file. 5. Writes statistics to a file. 6.
* Closing and un-subscribing of client.
*
* @param message The {@link javax.jms.Message} to publish.
* @return true if client is stopped or un-subscribed, false otherwise.
* @throws JMSException
* @throws IOException
*/
private boolean processReceivedMessage(Message message)
throws JMSException, IOException {
if (null != message) {
long threadID = Thread.currentThread().getId();
// Calculating total latency
long currentTimeStamp = System.currentTimeMillis();
this.totalLatency = this.totalLatency + (currentTimeStamp - message.getJMSTimestamp());
// Setting timestamps for TPS calculation
if (0 == this.firstMessageConsumedTimestamp) {
this.firstMessageConsumedTimestamp = currentTimeStamp;
}
this.lastMessageConsumedTimestamp = currentTimeStamp;
// Incrementing message received count
this.receivedMessageCount.incrementAndGet();
JMSDeliveryStatus deliveryStatus;
// Gets whether the message is original or redelivered
if (message.getJMSRedelivered()) {
deliveryStatus = JMSDeliveryStatus.REDELIVERED;
} else {
deliveryStatus = JMSDeliveryStatus.ORIGINAL;
}
// Logging the received message
if (0 == this.receivedMessageCount.get() % this.consumerConfig
.getPrintsPerMessageCount()) {
log.info("[RECEIVE] ThreadID:" + threadID + " Destination(" + this.consumerConfig
.getExchangeType().getType() + "):" +
this.consumerConfig.getDestinationName() + " ReceivedMessageCount:" +
this.receivedMessageCount + " MessageToReceive:" +
this.consumerConfig
.getMaximumMessagesToReceived() + " Original/Redelivered:" + deliveryStatus
.getStatus());
}
// Writes the statistics
if (null != this.consumerConfig.getFilePathToWriteStatistics()) {
String statisticsString = Long.toString(currentTimeStamp) + "," + Double
.toString(this.getConsumerTPS()) + "," + Double
.toString(this.getAverageLatency());
AndesClientUtils.writeStatisticsToFile(statisticsString, this.consumerConfig
.getFilePathToWriteStatistics());
}
if (message instanceof TextMessage) {
TextMessage textMessage = (TextMessage) message;
// Writes the received messages
if (null != this.consumerConfig.getFilePathToWriteReceivedMessages()) {
AndesClientUtils
.writeReceivedMessagesToFile(textMessage.getText(), this.consumerConfig
.getFilePathToWriteReceivedMessages());
} else {
this.consumerConfig.addReceivedMessage(textMessage.getText());
}
}
// Acknowledges messages
if (0 == this.receivedMessageCount.get() % this.consumerConfig
.getAcknowledgeAfterEachMessageCount()) {
if (Session.CLIENT_ACKNOWLEDGE == session.getAcknowledgeMode()) {
message.acknowledge();
log.info("Acknowledging message : " + message.getJMSMessageID());
}
}
if (0 == this.receivedMessageCount.get() % consumerConfig
.getCommitAfterEachMessageCount()) {
// Committing session
session.commit();
log.info("Committed session");
} else if (0 == this.receivedMessageCount.get() % consumerConfig
.getRollbackAfterEachMessageCount()) {
// Roll-backing session
session.rollback();
log.info("Roll-backed session");
} else if (0 == this.receivedMessageCount.get() % consumerConfig
.getRecoverAfterEachMessageCount()) {
// recover the session
log.info("Recovering session");
session.recover();
}
if (this.receivedMessageCount.get() >= consumerConfig
.getUnSubscribeAfterEachMessageCount()) {
// Un-Subscribing consumer
unSubscribe(true);
// Waiting till consumer is un-subscribed so that no messages will be read.
AndesClientUtils.sleepForInterval(1000L);
return true;
} else if (this.receivedMessageCount.get() >= consumerConfig
.getMaximumMessagesToReceived()) {
return true;
}
// Delaying reading of messages
if (0 < consumerConfig.getRunningDelay()) {
try {
Thread.sleep(consumerConfig.getRunningDelay());
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
}
return false;
}
/**
* Gets the received message count for the consumer.
*
* @return The received message count.
*/
public AtomicLong getReceivedMessageCount() {
return this.receivedMessageCount;
}
/**
* Gets the consumer transactions per seconds.
*
* @return The consumer transactions per seconds.
*/
public double getConsumerTPS() {
if (0 == this.lastMessageConsumedTimestamp - this.firstMessageConsumedTimestamp) {
return this.receivedMessageCount.doubleValue() / (1D / 1000);
} else {
return this.receivedMessageCount
.doubleValue() / (((double) (this.lastMessageConsumedTimestamp - this.firstMessageConsumedTimestamp)) / 1000D);
}
}
/**
* Gets the average latency for the consumer in receiving messages.
*
* @return The average latency.
*/
public double getAverageLatency() {
if (0 == this.receivedMessageCount.doubleValue()) {
log.warn("No messages were received to calculate average latency.");
return 0D;
} else {
return (((double) this.totalLatency) / 1000D) / this.receivedMessageCount.doubleValue();
}
}
/**
* {@inheritDoc}
*/
@Override
public AndesJMSConsumerClientConfiguration getConfig() {
return this.consumerConfig;
}
/**
* Gets the JMS message consuming connection ({@link javax.jms.Connection}).
*
* @return A {@link javax.jms.Connection}
*/
public Connection getConnection() {
return this.connection;
}
/**
* Sets the JMS message consuming connection ({@link javax.jms.Connection}).
*
* @param connection A {@link javax.jms.Connection}.
*/
public void setConnection(Connection connection) {
this.connection = connection;
}
/**
* Gets the JMS message consuming session ({@link javax.jms.Session}).
*
* @return A {@link javax.jms.Session}.
*/
public Session getSession() {
return this.session;
}
/**
* Sets the JMS message consuming session ({@link javax.jms.Session}).
*
* @param session A {@link javax.jms.Session}.
*/
public void setSession(Session session) {
this.session = session;
}
/**
* Gets the JMS message consumer ({@link javax.jms.MessageConsumer}).
*
* @return A {@link javax.jms.MessageConsumer}.
*/
public MessageConsumer getReceiver() {
return this.receiver;
}
/**
* Sets the JMS message consumer ({@link javax.jms.MessageConsumer}).
*
* @param receiver A {@link javax.jms.MessageConsumer}.
*/
public void setReceiver(MessageConsumer receiver) {
this.receiver = receiver;
}
}
|
[
"dilee.dev@gmail.com"
] |
dilee.dev@gmail.com
|
61045fdc011a9b975cb0f063762766fb8bf87bc2
|
8544c6537c719eb81b929c6d8ab89ec8587ff971
|
/projectclient/UDPPutClient.java
|
1f522170c533521ac0e42608a5f49b9fc7b8f8f4
|
[] |
no_license
|
naimahossain/reliable-UDP
|
2d295b9e7fb4cec9bd98208013cb189cc589f7dc
|
e365c6d86578d58c1b359e8e52cc864bec13f556
|
refs/heads/master
| 2021-01-10T06:58:00.394062
| 2016-01-14T00:51:05
| 2016-01-14T00:51:05
| 49,612,194
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 12,022
|
java
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package projectclient;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.nio.channels.FileChannel;
import java.nio.channels.FileLock;
import java.util.zip.CRC32;
/**
*
* @author Naima
*/
public class UDPPutClient implements IUdpClient
{
private boolean _isTimeout = false;
private DatagramSocket _socket;
private InetAddress _host;
private int _port;
private final String _fileName;
public UDPPutClient(String fileName)
{
_fileName = fileName;
}
//initiates the client
public void InitiateClient(int port, String hostName)
{
_port = port;
try
{
_host = InetAddress.getByName(hostName) ;
// Construct the socket
_socket = new DatagramSocket() ;
}
catch (IOException ex)
{
ErrorHandler.HandleError(UDPGetClient.class.getName(), ex);
}
catch (IllegalArgumentException ex)
{
ErrorHandler.Print(UDPGetClient.class.getName(), ex);
}
}
//initiates the file transfer
public void InitiateFileTransfer()
{
IO.Print("InitiateFileTransfer");
byte[] fileContent = ReadChunks(_fileName);
InitiateFileTransfer(fileContent);
IO.Print("Reading");
}
//ack receiver
private int ReceiveAck(int numOfTimeOut)
{
while(true)
{
DatagramPacket getAck = new DatagramPacket( new byte[Utility.PACKETSIZE], Utility.PACKETSIZE );
try
{
_socket.setSoTimeout(10000);// set the timeout in millisecounds.
// Receive a packet (blocking)
_socket.receive(getAck);
IO.Print("Received Acknowledge");
byte[] data = getAck.getData();
/*
First 3 bytes for acknowledge data->
this contains seq number received by client if successful,
otherwise contains 0
*/
byte[] seqb = new byte[3];
seqb[0] = data[0];
seqb[1] = data[1];
seqb[2] = data[2];
return Utility.ThreeByteArrayToInt(seqb);
}
catch(java.net.SocketTimeoutException ex)
{
// timeout exception.
IO.Print("Timeout reached!!! " + ex);
numOfTimeOut++;
IO.Print("Timeout reached..."+numOfTimeOut);
if(numOfTimeOut < Utility.TimeOutCounter)
return ReceiveAck(numOfTimeOut);
else
_isTimeout = true;
return 0;
}
catch (IOException ex)
{
ErrorHandler.Print(UDPPutClient.class.getName() ,ex);
return 0;
}
}
}
//returns if the timeout occured or not
public boolean IsTimeOutOccurred()
{
return _isTimeout;
}
//Reads the file from the disc to the memory
private byte[] ReadChunks(String fileName)
{
FileInputStream stream = null;
FileChannel inChannel = null;
try
{
File file = new File(Utility.DirectoryName+fileName);
stream = new FileInputStream(file);
inChannel = stream.getChannel();
//locks the file before reading
FileLock lock = inChannel.tryLock(0, Long.MAX_VALUE, true);
byte[] array = new byte[Utility.DATASIZE];
int a = stream.read(array);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
byte[] arr;
IO.Print("Reading file");
while(true)
{
if(a==-1)
break;
IO.Print("a = "+a);
//keep reading DATASIZE bytes from file and add to the byte array stream
if(a == Utility.DATASIZE)
outputStream.write(array);
//last portion of the file size is smaller than DATASIZE
//so creates an array of that size with the data and writes that to the byte array stream
else
outputStream.write(Utility.GetArray(0, a, array));
//Reads datasize byte from the file
a = stream.read(array);
}
arr = outputStream.toByteArray();
lock.release();//release the lock
return arr;
}
catch (FileNotFoundException ex)
{
ErrorHandler.Print(UDPPutClient.class.getName(), ex);
return new byte[0];
}
catch (IOException ex)
{
ErrorHandler.Print(UDPPutClient.class.getName(), ex);
return new byte[0];
}
finally
{
try
{
if(stream != null)
stream.close();
if(inChannel != null)
inChannel.close();
}
catch (IOException ex)
{
ErrorHandler.Print(UDPPutClient.class.getName(), ex);
}
}
}
//closes the socket
public void Close()
{
_socket.close();
}
//initiates file transfer
private void InitiateFileTransfer(byte[] fileContent)
{
int numOfPackets = (int)Math.floor((double)fileContent.length/(double)Utility.DATASIZE);
int lastChunkSize = fileContent.length - (numOfPackets * Utility.DATASIZE);
if(lastChunkSize > 0)
numOfPackets += 1;
byte[] packetNum = Utility.IntTo4ByteArray(numOfPackets);
byte[] lastChunk = Utility.IntTo3ByteArray(lastChunkSize);
IO.Print("lastChunkSize = "+lastChunkSize+" from byte = "+Utility.ThreeByteArrayToInt(lastChunk));
try
{
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
outputStream.write(packetNum);
outputStream.write(lastChunk);
byte[] arr = outputStream.toByteArray();
SendResponse(Utility.TrueACK, arr);
if(_isTimeout)
return;
IO.Print("Send first response");
SendResponse(1, fileContent);
if(_isTimeout)
return;
IO.Print("Send second response");
}
catch (IOException ex)
{
ErrorHandler.Print(UDPPutClient.class.getName() ,ex);
}
}
//creates byte array to send appending header and checksum and sends the array to client
//also receives clients acknowledgement
private int CreateAndSendPacket(int start, int end, int header, byte[] actualArray)
{
IO.Print("Start = "+start+" End = "+end);
byte[] data = Utility.GetArray(start, end, actualArray);
System.out.println(data.length);
byte[] packetData = CreatePacketData(header, data);
System.out.println(packetData.length);
SendPacket(packetData);
int ack = ReceiveAck(0);
if(_isTimeout)
return ack;
/*
time out didn't occur but ack is 0.
->the file client received was either corrupted or wrong seq.
->try sending data again
*/
IO.Print("ack = "+ack+" i = "+header);
if(IsRetransmitNeeded(ack))
Retransmit(packetData, ack);
return ack;
}
//checks if the retransmimssion needed or not
private boolean IsRetransmitNeeded(int ack)
{//timeout didn't occur but the ack=0->client didn't received the correct packet
return ack == 0 && !_isTimeout;
}
//Retransmitting
private void Retransmit(byte[] packetData, int ack)
{
int timeOutC = 0;
while(IsRetransmitNeeded(0))
{
SendPacket(packetData);
ack = ReceiveAck(timeOutC);
timeOutC++;
}
}
private void SendResponse(int packetStartingHeader, byte[] response)
{
int len = response.length;
int numOfPackets = len/Utility.DATASIZE;
IO.Print("totalLen = "+len+" numOfPacket = "+numOfPackets+" packetStartingHeader = "+packetStartingHeader);
int i = 0;
while(numOfPackets>i)
{
int ack = CreateAndSendPacket(i*Utility.DATASIZE, (i+1)*Utility.DATASIZE, i+1, response);
if(_isTimeout)
return;
if(ack == (i+1) || ack == Utility.TrueACK) //client received the correct packet, proceed to next packet
i++;
IO.Print("Current Seq = "+i);
}
//last pack
IO.Print("start = "+(i*Utility.DATASIZE)+" response len = "+response.length);
int packetHeader = GetHeader(packetStartingHeader, i+1, numOfPackets);
CreateAndSendPacket(i*Utility.DATASIZE, len, packetHeader, response);
}
/*
if this data is only one packet
->header will be true ack, otherwise header will be seqNum
*/
private int GetHeader(int prevHeader, int seq, int numOfPackets)
{
int packetHeader;
if(numOfPackets > 0)
packetHeader = seq;
else
packetHeader = prevHeader;
return packetHeader;
}
//sends packet
private void SendPacket(byte[] b)
{
try
{
IO.Print("Sending Data");
DatagramPacket packet = new DatagramPacket( b, b.length, _host, _port ) ;
// Send it
_socket.send(packet);
}
catch (IOException ex)
{
ErrorHandler.Print(UDPGetClient.class.getName(), ex);
}
}
//creates checksum value
private int GetCheckSumValue(byte[] data, int seq)
{
byte[] seqArr = Utility.IntTo3ByteArray(seq);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
try
{
outputStream.write(seqArr);
outputStream.write(data);
byte[] arr = outputStream.toByteArray();
//creates checksum
CRC32 checkSum = new CRC32();
checkSum.update(arr);
int checkSumValue = (int) checkSum.getValue();
IO.Print("checkSumValue = "+checkSumValue);
return checkSumValue;
}
catch (IOException ex)
{
ErrorHandler.Print(UDPPutClient.class.getName() ,ex);
}
return 0;
}
//creates final byte array for packet
private byte[] CreatePacketData(int seq, byte[] data)
{
int checkSumValue = GetCheckSumValue(data, seq);
IO.Print("checkSumValue = "+checkSumValue);
byte[] seqArr = Utility.IntTo3ByteArray(seq);
byte[] lenArr = Utility.IntTo2ByteArray(data.length);
byte[] checkSumArr = Utility.IntTo4ByteArray(checkSumValue);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
byte[] arr = new byte[data.length+9];
try
{
outputStream.write(seqArr);
outputStream.write(lenArr);
outputStream.write(checkSumArr);
outputStream.write(data);
arr = outputStream.toByteArray();
}
catch (IOException ex)
{
ErrorHandler.Print(UDPGetClient.class.getName() ,ex);
}
return arr;
}
}
|
[
"naima.academic@gmail.com"
] |
naima.academic@gmail.com
|
6a059e599327cc7d8942feb92009f7f78b02ffa9
|
11c29b47a88328aadf1e61649c4cd70f4aec1f45
|
/jsp project/OpenProjectMVC/src/member/service/MemberEditServiceImpl.java
|
d7025bca7d6740f2ad80ab4394b7da8d40b60bbd
|
[] |
no_license
|
Yangmiseon/aiajr0330-
|
8e29931dee839f0722247170a946cec42396edd8
|
3e1bc9cbbee4983a4d2c77f25c42376ee1b9899b
|
refs/heads/master
| 2022-12-20T13:18:05.001309
| 2020-09-22T14:56:49
| 2020-09-22T14:56:49
| 253,968,389
| 0
| 0
| null | 2022-12-16T09:45:23
| 2020-04-08T02:46:33
|
Java
|
UTF-8
|
Java
| false
| false
| 4,680
|
java
|
package member.service;
import java.io.File;
import java.io.UnsupportedEncodingException;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Iterator;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileUploadException;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import jdbc.ConnectionProvider;
import member.dao.MemberDao;
import member.model.Member;
import service.Service;
public class MemberEditServiceImpl implements Service {
MemberDao dao;
@Override
public String getViewPage(
HttpServletRequest request,
HttpServletResponse response) {
// 파일 업로드 - 사진
// 사용자 데이터를 받기 - uid, upw, uname, uphoto
int resultCnt = 0;
// 데이터 베이스에 수정 데이터 변수
int idx = 0;
String upw = null;
String uname = null;
String oldFile = null;
String uphoto = null;
Connection conn = null;
try {
boolean isMultipart = ServletFileUpload.isMultipartContent(request);
if (isMultipart) {
DiskFileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
List<FileItem> items = upload.parseRequest(request);
Iterator<FileItem> ite = items.iterator();
while (ite.hasNext()) {
FileItem item = ite.next();
// isFormField() : text value를 가지는 input 확인
if (item.isFormField()) { // type=file 이외의 input
// 파라미터 이름
String paramName = item.getFieldName();
// 파라미터의 값
String paramValue = item.getString("utf-8");
//System.out.println(paramName + " = " + paramValue);
if(paramName.equals("idx")){
idx = Integer.parseInt(paramValue);
} else if(paramName.equals("upw")) {
upw = paramValue;
} else if(paramName.equals("uname")) {
uname = paramValue;
} else if(paramName.equals("oldFile")) {
// 이전 파일은 새로운 파일이 없을때 업데이트가 되도록합니다.
oldFile = paramValue;
}
} else { // type=file
if(item.getFieldName().equals("photo") && item.getSize()>0) {
System.out.println("파일 없이 들어오면 안된다");
// 서버 내부의 경로
String uri = "/upload/users";
//String uri = request.getSession().getServletContext().getInitParameter("uploadPath");
// 시스템의 실제(절대) 경로
String realPath = request.getSession().getServletContext().getRealPath(uri);
// System.out.println(realPath);
String newFileName = System.nanoTime() + "_" + item.getName();
// 서버의 저장소에 실제 저장
File saveFile = new File(realPath, newFileName);
item.write(saveFile);
System.out.println("저장 완료");
uphoto = uri+"/"+newFileName;
}
}
}
// 새로 파일이 저장 되었을 때 처리
// 이전 파일 삭제.
// 새로운 파일이 없을 때 이전 파일 이름 저장
if(uphoto!=null) {
File oFile = new File(request.getSession().getServletContext().getRealPath(oldFile));
if(oFile.exists()) {
if(oFile.delete()) {
System.out.println("새로운 파일이 추가되어 이전파일은 삭제합니다.");
}
}
} else {
uphoto = oldFile;
}
// 데이터 베이스 저장
Member member = new Member();
member.setIdx(idx);
member.setUpw(upw);
member.setUname(uname);
member.setUphoto(uphoto);
conn = ConnectionProvider.getConnection();
dao = MemberDao.getInstance() ;
resultCnt = dao.editMember(conn, member);
request.setAttribute("member", member);
request.setAttribute("result", resultCnt);
}
} catch (FileUploadException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO: handle exception
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
if(conn != null) {
try {
conn.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
return "/WEB-INF/views/member/edit.jsp";
}
}
|
[
"63032946+Yangmiseon@users.noreply.github.com"
] |
63032946+Yangmiseon@users.noreply.github.com
|
2148782854e5dd447c93c27f6dc347cc1dc534e2
|
c4ac5ce27efde2b765b7efbf86d252e82fb19d55
|
/app/src/main/java/com/myhexaville/Logic/JSONData/$_JSON_Friend_Response.java
|
5c946aef1872243af31e912d50d3e3d23138a302
|
[] |
no_license
|
YAMMEN10/Chat_App
|
61358361c1f4cab2a5b6b9a19633a2c1f8cb2abc
|
af0075e467fcccd2e6ddb2816b34db30b5806deb
|
refs/heads/master
| 2020-05-30T17:56:29.356714
| 2019-06-30T17:29:02
| 2019-06-30T17:29:19
| 189,878,783
| 0
| 0
| null | 2019-06-13T19:22:37
| 2019-06-02T18:03:20
|
Java
|
UTF-8
|
Java
| false
| false
| 461
|
java
|
package com.myhexaville.Logic.JSONData;
public class $_JSON_Friend_Response extends $_JSON_Account_Response {
private String Id_user;
public $_JSON_Friend_Response(String type, String idReceived, boolean Done, String Id_user) {
super(type, idReceived, Done);
this.Id_user = Id_user;
}
public String getId_user() {
return Id_user;
}
public void setId_user(String id_user) {
Id_user = id_user;
}
}
|
[
"YAMMEN.githup98@gmail.com"
] |
YAMMEN.githup98@gmail.com
|
d9fc89d0243bc8d452ba04d8acd71f72fee31744
|
22cbd4bfc25ed0b021f57baf6f7bf796918d479c
|
/Multiservicios/src/cerdo/unsa/Contrasena.java
|
c0443f3ec18560a5fd85c616156b45e107a3462f
|
[] |
no_license
|
JoongieMagaly/multi-v5
|
249f84a446d759ead1e8ccb372a9fc4bdea12db0
|
808b4c5651b55a9279f291a3d99b23238128239b
|
refs/heads/master
| 2020-05-20T04:11:05.926661
| 2015-07-23T19:07:33
| 2015-07-23T19:07:33
| 38,903,567
| 0
| 0
| null | null | null | null |
ISO-8859-1
|
Java
| false
| false
| 1,892
|
java
|
package cerdo.unsa;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
import javax.jdo.Query;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
@SuppressWarnings("serial")
public class Contrasena extends HttpServlet{
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
HttpSession misesion= req.getSession();
String contraseña=(String)misesion.getAttribute("contraseña");
if(req.getParameter("contraseñaa").equals(req.getParameter("contraseñan"))){
misesion.setAttribute("cambio", "fallido");
RequestDispatcher rd = getServletContext().getRequestDispatcher("/WEB-INF/realizado.jsp");
rd.forward(req, resp);
}
else if(!req.getParameter("contraseñan").equals(req.getParameter("contraseñac"))){
misesion.setAttribute("cambio", "nuevas");
RequestDispatcher rd = getServletContext().getRequestDispatcher("/WEB-INF/realizado.jsp");
rd.forward(req, resp);
}
else if(contraseña.equals(req.getParameter("contraseñaa"))){
String codigo=(String)misesion.getAttribute("codigo");
List<Empleado> p = PersonaService.personasXCodigo(codigo);
for(Empleado x : p){
x.setContraseña(req.getParameter("contraseñan"));
misesion.setAttribute("cambio", "exito");
RequestDispatcher rd = getServletContext().getRequestDispatcher("/WEB-INF/realizado.jsp");
rd.forward(req, resp);
}
}
else{
misesion.setAttribute("cambio", "nocoincide");
RequestDispatcher rd = getServletContext().getRequestDispatcher("/WEB-INF/realizado.jsp");
rd.forward(req, resp);
}
}
}
|
[
"magalyvillegascahuana@gmail.com"
] |
magalyvillegascahuana@gmail.com
|
28aba595db7c9ed0e0968df0f73106827a6e8468
|
12563229bd1c69d26900d4a2ea34fe4c64c33b7e
|
/nan21.dnet.module.md/nan21.dnet.module.md.presenter/src/main/java/net/nan21/dnet/module/md/base/tx/ds/model/PaymentMethodDs.java
|
b54525ba83233c7c7bbc989bb40e0b917672fa6f
|
[] |
no_license
|
nan21/nan21.dnet.modules
|
90b002c6847aa491c54bd38f163ba40a745a5060
|
83e5f02498db49e3d28f92bd8216fba5d186dd27
|
refs/heads/master
| 2023-03-15T16:22:57.059953
| 2012-08-01T07:36:57
| 2012-08-01T07:36:57
| 1,918,395
| 0
| 1
| null | 2012-07-24T03:23:00
| 2011-06-19T05:56:03
|
Java
|
UTF-8
|
Java
| false
| false
| 1,626
|
java
|
/*
* DNet eBusiness Suite
* Copyright: 2008-2012 Nan21 Electronics SRL. All rights reserved.
* Use is subject to license terms.
*/
package net.nan21.dnet.module.md.base.tx.ds.model;
import net.nan21.dnet.core.api.annotation.Ds;
import net.nan21.dnet.core.api.annotation.DsField;
import net.nan21.dnet.core.api.annotation.SortField;
import net.nan21.dnet.core.presenter.model.base.AbstractTypeDs;
import net.nan21.dnet.module.md.base.tx.domain.entity.PaymentMethod;
@Ds(entity = PaymentMethod.class, sort = { @SortField(field = PaymentMethodDs.fNAME) })
public class PaymentMethodDs extends AbstractTypeDs<PaymentMethod> {
public static final String fTYPE = "type";
public static final String fDOCTYPEID = "docTypeId";
public static final String fDOCTYPE = "docType";
@DsField()
private String type;
@DsField(join = "left", path = "docType.id")
private Long docTypeId;
@DsField(join = "left", path = "docType.name")
private String docType;
public PaymentMethodDs() {
super();
}
public PaymentMethodDs(PaymentMethod e) {
super(e);
}
public String getType() {
return this.type;
}
public void setType(String type) {
this.type = type;
}
public Long getDocTypeId() {
return this.docTypeId;
}
public void setDocTypeId(Long docTypeId) {
this.docTypeId = docTypeId;
}
public String getDocType() {
return this.docType;
}
public void setDocType(String docType) {
this.docType = docType;
}
}
|
[
"mathe_attila@yahoo.com"
] |
mathe_attila@yahoo.com
|
19ebfce53d631f4a3faec5dd5cc363f9c927b157
|
051beb43551f54cc60c606fdc3cd8798f8be28a4
|
/app/src/main/java/com/example/anirban/navbar/MainActivity.java
|
7d564a704ac6547c3109c2dd1021e24912ba2e02
|
[] |
no_license
|
AnirbanBanik1998/Navbar
|
2c4a42228847d7ee2125a45c588781572886d739
|
56c3b9ea475fdf597b237643f1e93c371c36d446
|
refs/heads/master
| 2021-01-21T14:52:38.849479
| 2017-06-25T08:42:32
| 2017-06-25T08:42:32
| 95,347,854
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,506
|
java
|
package com.example.anirban.navbar;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.view.View;
import android.support.design.widget.NavigationView;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
public class MainActivity extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.setDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
}
@Override
public void onBackPressed() {
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
} else {
super.onBackPressed();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
// Handle navigation view item clicks here.
int id = item.getItemId();
if (id == R.id.nav_camera) {
// Handle the camera action
} else if (id == R.id.nav_gallery) {
} else if (id == R.id.nav_slideshow) {
} else if (id == R.id.nav_manage) {
} else if (id == R.id.nav_share) {
} else if (id == R.id.nav_send) {
}
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
}
}
|
[
"anirbanbanik17@gmail.com"
] |
anirbanbanik17@gmail.com
|
b3150fdb783268a34033d21a9a565b7c4d14401b
|
f2b83a97fc7597a07d459204e857fff430e4a953
|
/app/src/main/java/com/demos/flux/actions/ActionsCreater.java
|
2c0f35251ad7bdc8e9cdf26ea8bc1afce84162b5
|
[] |
no_license
|
70kg/Demos
|
8e27c0ba90c605351b81ae7fef450695edda6843
|
3f9cd54e6916be8cdb0adb523d6388959fa197a7
|
refs/heads/master
| 2020-12-24T07:43:27.790586
| 2016-08-02T11:38:36
| 2016-08-02T11:38:36
| 51,301,724
| 8
| 2
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,859
|
java
|
package com.demos.flux.actions;
import com.demos.flux.dispatcher.Dispatcher;
import com.demos.flux.model.GitHubUser;
import com.demos.flux.request.GitHubApiUtils;
import com.socks.library.KLog;
import rx.Observer;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;
/**
* Created by Mr_Wrong on 16/3/25.
* 网络请求在actioncreateer里面进行
*/
public class ActionsCreater {
private static ActionsCreater creater;
private Dispatcher mDispatcher;
public ActionsCreater(Dispatcher dispatcher) {
mDispatcher = dispatcher;
}
public static ActionsCreater getInstance(Dispatcher Dispatcher) {
if (creater == null) {
synchronized (ActionsCreater.class) {
if (creater == null) {
creater = new ActionsCreater(Dispatcher);
}
}
}
return creater;
}
//---
//这里进行网络的请求操作
public void sendMessage(String message) {
mDispatcher.dispatch(new MessageAction(MessageAction.ACTION_MESSAGE, message));
}
public void queryUser(String name) {
GitHubApiUtils.getInstance().getGitHubApi().user(name)
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<GitHubUser>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
KLog.e(e);
}
@Override
public void onNext(GitHubUser gitHubUser) {
mDispatcher.dispatch(new UserAction(UserAction.MYACTION, gitHubUser));
}
});
}
}
|
[
"mrwrong12138@gmail.com"
] |
mrwrong12138@gmail.com
|
c76d413eac5d2db807d66a86695d72729454cb8f
|
22e506ee8e3620ee039e50de447def1e1b9a8fb3
|
/java_src/android/support/p007v4/widget/CursorFilter.java
|
d04e430f1302a52f6082707847834e338bba0f9a
|
[] |
no_license
|
Qiangong2/GraffitiAllianceSource
|
477152471c02aa2382814719021ce22d762b1d87
|
5a32de16987709c4e38594823cbfdf1bd37119c5
|
refs/heads/master
| 2023-07-04T23:09:23.004755
| 2021-08-11T18:10:17
| 2021-08-11T18:10:17
| 395,075,728
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,629
|
java
|
package android.support.p007v4.widget;
import android.database.Cursor;
import android.widget.Filter;
/* renamed from: android.support.v4.widget.CursorFilter */
class CursorFilter extends Filter {
CursorFilterClient mClient;
/* renamed from: android.support.v4.widget.CursorFilter$CursorFilterClient */
interface CursorFilterClient {
void changeCursor(Cursor cursor);
CharSequence convertToString(Cursor cursor);
Cursor getCursor();
Cursor runQueryOnBackgroundThread(CharSequence charSequence);
}
CursorFilter(CursorFilterClient client) {
this.mClient = client;
}
public CharSequence convertResultToString(Object resultValue) {
return this.mClient.convertToString((Cursor) resultValue);
}
/* access modifiers changed from: protected */
public Filter.FilterResults performFiltering(CharSequence constraint) {
Cursor cursor = this.mClient.runQueryOnBackgroundThread(constraint);
Filter.FilterResults results = new Filter.FilterResults();
if (cursor != null) {
results.count = cursor.getCount();
results.values = cursor;
} else {
results.count = 0;
results.values = null;
}
return results;
}
/* access modifiers changed from: protected */
public void publishResults(CharSequence constraint, Filter.FilterResults results) {
Cursor oldCursor = this.mClient.getCursor();
if (results.values != null && results.values != oldCursor) {
this.mClient.changeCursor((Cursor) results.values);
}
}
}
|
[
"sassafrass@fasizzle.com"
] |
sassafrass@fasizzle.com
|
0d5d1bb06824828910d869845fb787b7be1ce5dd
|
bd23a959cba164e44145b1c550916a597281ec6e
|
/src/main/java/com/wild/spring/rest/dao/EmployeeDAOImpl.java
|
27dba9f78c8c72ffd567b14ed438edc5e1f81b2b
|
[] |
no_license
|
AndreyWild/spring_course_rest
|
140ce117cc00de496f5537b772f0f68f7bef2344
|
414736abd8dc1bcf8b07b7923f1ba3e3fe9b92bb
|
refs/heads/master
| 2023-04-05T23:57:14.641122
| 2021-04-23T16:58:48
| 2021-04-23T16:58:48
| 359,917,013
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,114
|
java
|
package com.wild.spring.rest.dao;
import com.wild.spring.rest.entity.Employee;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.query.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public class EmployeeDAOImpl implements EmployeeDAO {
@Autowired
private SessionFactory sessionFactory;
@Override
public List<Employee> getAllEmployees() {
Session session = sessionFactory.getCurrentSession();
List<Employee> allEmployees = session.createQuery("from Employee",
Employee.class).getResultList(); // получаем список работников
// Query<Employee> query = session.createQuery("from Employee", Employee.class);
// List<Employee> allEmployees = query.getResultList(); // получаем список работников
return allEmployees;
}
@Override
public void saveEmployee(Employee employee) {
Session session = sessionFactory.getCurrentSession(); // открываем сессию
//session.save(employee); // сохраняем работника
session.saveOrUpdate(employee); // сохраняем или обновляем работника
}
@Override
public Employee getEmployee(int id) {
Session session = sessionFactory.getCurrentSession(); // открываем сессию
Employee employee = session.get(Employee.class, id); // получаем работника с указ. id
return employee; // возвращаем этого работника
}
@Override
public void deleteEmployee(int id) {
Session session = sessionFactory.getCurrentSession(); // открываем сессию
Query<Employee> query = session.createQuery("delete from Employee where id =:empId");
query.setParameter("empId", id); // присвоить параметру employeeId значение параметра id
query.executeUpdate();
}
}
|
[
"and1rei@mail.ru"
] |
and1rei@mail.ru
|
78d3bbf0306adbfdc11d3e7467f11da8406328bf
|
32bd72a946608931d979b1f475bec15aa020edb9
|
/apktool/apk/wkhelper_1.6.6.4_167/smali/android/support/v4/app/e.java
|
193b561eb1c58eb359faff27d3e6c264ee0df823
|
[] |
no_license
|
Jagle/mytools
|
80d3a68b3dc70cbffaf8c4f3a5e9d855734da2af
|
8aef2f8400b6e9a4b0fad9292332c93f594053e6
|
refs/heads/master
| 2016-08-12T20:39:27.614965
| 2015-08-07T11:32:25
| 2015-08-07T11:32:25
| 36,046,910
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 6,416
|
java
|
package android.support.v4.app; class e { void a() { int a;
a=0;// .class final Landroid/support/v4/app/e;
a=0;// .super Ljava/lang/Object;
a=0;//
a=0;// # interfaces
a=0;// .implements Landroid/view/ViewTreeObserver$OnPreDrawListener;
a=0;//
a=0;//
a=0;// # instance fields
a=0;// .field final synthetic a:Landroid/view/View;
a=0;//
a=0;// .field final synthetic b:Ljava/lang/Object;
a=0;//
a=0;// .field final synthetic c:Ljava/util/ArrayList;
a=0;//
a=0;// .field final synthetic d:Landroid/support/v4/app/h;
a=0;//
a=0;// .field final synthetic e:Z
a=0;//
a=0;// .field final synthetic f:Landroid/support/v4/app/Fragment;
a=0;//
a=0;// .field final synthetic g:Landroid/support/v4/app/Fragment;
a=0;//
a=0;// .field final synthetic h:Landroid/support/v4/app/c;
a=0;//
a=0;//
a=0;// # direct methods
a=0;// .method constructor <init>(Landroid/support/v4/app/c;Landroid/view/View;Ljava/lang/Object;Ljava/util/ArrayList;Landroid/support/v4/app/h;ZLandroid/support/v4/app/Fragment;Landroid/support/v4/app/Fragment;)V
a=0;// .locals 0
a=0;//
a=0;// iput-object p1, p0, Landroid/support/v4/app/e;->h:Landroid/support/v4/app/c;
a=0;//
a=0;// iput-object p2, p0, Landroid/support/v4/app/e;->a:Landroid/view/View;
a=0;//
a=0;// iput-object p3, p0, Landroid/support/v4/app/e;->b:Ljava/lang/Object;
a=0;//
a=0;// iput-object p4, p0, Landroid/support/v4/app/e;->c:Ljava/util/ArrayList;
a=0;//
a=0;// iput-object p5, p0, Landroid/support/v4/app/e;->d:Landroid/support/v4/app/h;
a=0;//
a=0;// iput-boolean p6, p0, Landroid/support/v4/app/e;->e:Z
a=0;//
a=0;// iput-object p7, p0, Landroid/support/v4/app/e;->f:Landroid/support/v4/app/Fragment;
a=0;//
a=0;// iput-object p8, p0, Landroid/support/v4/app/e;->g:Landroid/support/v4/app/Fragment;
a=0;//
a=0;// invoke-direct {p0}, Ljava/lang/Object;-><init>()V
a=0;//
a=0;// #p0=(Reference,Landroid/support/v4/app/e;);
a=0;// return-void
a=0;// .end method
a=0;//
a=0;//
a=0;// # virtual methods
a=0;// .method public final onPreDraw()Z
a=0;// .locals 4
a=0;//
a=0;// iget-object v0, p0, Landroid/support/v4/app/e;->a:Landroid/view/View;
a=0;//
a=0;// #v0=(Reference,Landroid/view/View;);
a=0;// invoke-virtual {v0}, Landroid/view/View;->getViewTreeObserver()Landroid/view/ViewTreeObserver;
a=0;//
a=0;// move-result-object v0
a=0;//
a=0;// invoke-virtual {v0, p0}, Landroid/view/ViewTreeObserver;->removeOnPreDrawListener(Landroid/view/ViewTreeObserver$OnPreDrawListener;)V
a=0;//
a=0;// iget-object v0, p0, Landroid/support/v4/app/e;->b:Ljava/lang/Object;
a=0;//
a=0;// if-eqz v0, :cond_0
a=0;//
a=0;// iget-object v0, p0, Landroid/support/v4/app/e;->b:Ljava/lang/Object;
a=0;//
a=0;// iget-object v1, p0, Landroid/support/v4/app/e;->c:Ljava/util/ArrayList;
a=0;//
a=0;// #v1=(Reference,Ljava/util/ArrayList;);
a=0;// invoke-static {v0, v1}, Landroid/support/v4/app/z;->a(Ljava/lang/Object;Ljava/util/ArrayList;)V
a=0;//
a=0;// iget-object v0, p0, Landroid/support/v4/app/e;->c:Ljava/util/ArrayList;
a=0;//
a=0;// invoke-virtual {v0}, Ljava/util/ArrayList;->clear()V
a=0;//
a=0;// iget-object v0, p0, Landroid/support/v4/app/e;->h:Landroid/support/v4/app/c;
a=0;//
a=0;// iget-object v1, p0, Landroid/support/v4/app/e;->d:Landroid/support/v4/app/h;
a=0;//
a=0;// iget-boolean v2, p0, Landroid/support/v4/app/e;->e:Z
a=0;//
a=0;// #v2=(Boolean);
a=0;// iget-object v3, p0, Landroid/support/v4/app/e;->f:Landroid/support/v4/app/Fragment;
a=0;//
a=0;// #v3=(Reference,Landroid/support/v4/app/Fragment;);
a=0;// invoke-static {v0, v1, v2, v3}, Landroid/support/v4/app/c;->a(Landroid/support/v4/app/c;Landroid/support/v4/app/h;ZLandroid/support/v4/app/Fragment;)Landroid/support/v4/c/a;
a=0;//
a=0;// move-result-object v0
a=0;//
a=0;// invoke-virtual {v0}, Landroid/support/v4/c/a;->isEmpty()Z
a=0;//
a=0;// move-result v1
a=0;//
a=0;// #v1=(Boolean);
a=0;// if-eqz v1, :cond_1
a=0;//
a=0;// iget-object v1, p0, Landroid/support/v4/app/e;->c:Ljava/util/ArrayList;
a=0;//
a=0;// #v1=(Reference,Ljava/util/ArrayList;);
a=0;// iget-object v2, p0, Landroid/support/v4/app/e;->d:Landroid/support/v4/app/h;
a=0;//
a=0;// #v2=(Reference,Landroid/support/v4/app/h;);
a=0;// iget-object v2, v2, Landroid/support/v4/app/h;->d:Landroid/view/View;
a=0;//
a=0;// invoke-virtual {v1, v2}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
a=0;//
a=0;// :goto_0
a=0;// iget-object v1, p0, Landroid/support/v4/app/e;->b:Ljava/lang/Object;
a=0;//
a=0;// iget-object v2, p0, Landroid/support/v4/app/e;->c:Ljava/util/ArrayList;
a=0;//
a=0;// invoke-static {v1, v2}, Landroid/support/v4/app/z;->b(Ljava/lang/Object;Ljava/util/ArrayList;)V
a=0;//
a=0;// iget-object v1, p0, Landroid/support/v4/app/e;->h:Landroid/support/v4/app/c;
a=0;//
a=0;// iget-object v2, p0, Landroid/support/v4/app/e;->d:Landroid/support/v4/app/h;
a=0;//
a=0;// invoke-static {v1, v0, v2}, Landroid/support/v4/app/c;->a(Landroid/support/v4/app/c;Landroid/support/v4/c/a;Landroid/support/v4/app/h;)V
a=0;//
a=0;// iget-object v1, p0, Landroid/support/v4/app/e;->f:Landroid/support/v4/app/Fragment;
a=0;//
a=0;// iget-object v2, p0, Landroid/support/v4/app/e;->g:Landroid/support/v4/app/Fragment;
a=0;//
a=0;// iget-boolean v3, p0, Landroid/support/v4/app/e;->e:Z
a=0;//
a=0;// #v3=(Boolean);
a=0;// invoke-static {v1, v2, v3, v0}, Landroid/support/v4/app/c;->a(Landroid/support/v4/app/Fragment;Landroid/support/v4/app/Fragment;ZLandroid/support/v4/c/a;)V
a=0;//
a=0;// :cond_0
a=0;// #v1=(Conflicted);v2=(Conflicted);v3=(Conflicted);
a=0;// const/4 v0, 0x1
a=0;//
a=0;// #v0=(One);
a=0;// return v0
a=0;//
a=0;// :cond_1
a=0;// #v0=(Reference,Landroid/support/v4/c/a;);v1=(Boolean);v2=(Boolean);v3=(Reference,Landroid/support/v4/app/Fragment;);
a=0;// iget-object v1, p0, Landroid/support/v4/app/e;->c:Ljava/util/ArrayList;
a=0;//
a=0;// #v1=(Reference,Ljava/util/ArrayList;);
a=0;// invoke-virtual {v0}, Landroid/support/v4/c/a;->values()Ljava/util/Collection;
a=0;//
a=0;// move-result-object v2
a=0;//
a=0;// #v2=(Reference,Ljava/util/Collection;);
a=0;// invoke-virtual {v1, v2}, Ljava/util/ArrayList;->addAll(Ljava/util/Collection;)Z
a=0;//
a=0;// goto :goto_0
a=0;// .end method
}}
|
[
"jagle@liujiedeMacBook-Pro.local"
] |
jagle@liujiedeMacBook-Pro.local
|
57166722baab64b61009e2c7ca516851ba166f30
|
a0265807ad4e2b27bb0a025a0583b809df09da91
|
/src/main/java/Project/service/RequestService.java
|
1fc16517326a088c91c5d66e3bc7b36babb7c225
|
[] |
no_license
|
aprogachov/RepositoryFirst
|
75ca99e8ccf667a54d26e00c4a88bfebe783d7e6
|
81f25eac9d9f4705d2f82c2cdd0f9d139c193641
|
refs/heads/master
| 2020-03-19T12:08:20.849721
| 2018-06-07T17:38:11
| 2018-06-07T17:38:11
| 136,498,125
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 759
|
java
|
package Project.service;
import Project.DAO.RequestDao;
import Project.model.Request;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
@Service
public class RequestService {
@Autowired
private RequestDao requestDao;
@Transactional(readOnly = true, propagation=Propagation.SUPPORTS)
public List<Request> allRequests() {
return requestDao.allRequests();
}
@Transactional
public void saveRequest(Request request) {
requestDao.saveRequest(request);
}
}
|
[
"aprogachov@gmail.com"
] |
aprogachov@gmail.com
|
908919fa15c1877a5864246774d5ec89a8a5a6ac
|
cbf600a8d967e95d6ea7e6664522f030b237ac95
|
/src/test/java/com/wu/sell/service/impl/ProductServiceImplTest.java
|
a76ecf97285df40eb648198a75aff08292d9f893
|
[] |
no_license
|
qq1045227031/sell
|
777462aa9dced016835f97297373a228e4cb92dd
|
63ed095d1c4efe2dadb5ab21a9feff51313950ce
|
refs/heads/master
| 2022-12-26T12:00:25.235314
| 2020-05-27T07:51:42
| 2020-05-27T07:51:42
| 267,001,675
| 0
| 0
| null | 2020-10-13T22:20:30
| 2020-05-26T09:34:08
|
Java
|
UTF-8
|
Java
| false
| false
| 2,151
|
java
|
package com.wu.sell.service.impl;
import com.wu.sell.dataobject.ProductInfo;
import com.wu.sell.enums.ProductStatusEnum;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.test.context.junit4.SpringRunner;
import java.math.BigDecimal;
import java.util.List;
import static org.junit.Assert.*;
@RunWith(SpringRunner.class)
@SpringBootTest
public class ProductServiceImplTest {
@Autowired
private ProductServiceImpl productService;
@Test
public void findOne() throws Exception {
ProductInfo productInfo = productService.findOne("1");
Assert.assertEquals((Integer)1, productInfo.getProductId());
}
@Test
public void findUpAll() throws Exception {
List<ProductInfo> productInfoList = productService.findUpAll();
Assert.assertNotEquals(0, productInfoList.size());
}
@Test
public void findAll() throws Exception {
PageRequest request = new PageRequest(0, 2);
Page<ProductInfo> productInfoPage = productService.findAll(request);
// System.out.println(productInfoPage.getTotalElements());
// productInfoPage.getContent();//转化为本来的类型
Assert.assertNotEquals(0, productInfoPage.getTotalElements());
}
@Test
public void save() throws Exception {
ProductInfo productInfo = new ProductInfo();
productInfo.setProductId("100");//修改
productInfo.setProductName("皮皮虾");
productInfo.setProductPrice(new BigDecimal(3.2));
productInfo.setProductStock(100);
productInfo.setProductDescription("很好吃的虾");
productInfo.setProductIcon("http://xxxxx.jpg");
productInfo.setProductStatus(ProductStatusEnum.DOWN.getCode());
productInfo.setCategoryType(2);
ProductInfo result = productService.save(productInfo);
Assert.assertNotNull(result);
}
}
|
[
"1045227031@qq.com"
] |
1045227031@qq.com
|
8d0d229945e07850a2c2f8faba4a52b632c12beb
|
45a0f201acaf4c0f002c5aa64bea3a47d7c9038e
|
/ParqueaderoCarRun/src/java/DAO/RolParqueoDAO.java
|
e5a3e0ef282371c1859b7d1a685072149997cfbf
|
[] |
no_license
|
maribel000/parqueadero-car-run
|
47248efbc4b6d816664e12674d8f1f842bc91602
|
dca6651f1e8cc283c2be4aefe138bce39ba6f395
|
refs/heads/master
| 2016-09-16T02:38:57.081260
| 2011-06-09T20:18:31
| 2011-06-09T20:18:31
| 40,152,961
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 638
|
java
|
package DAO;
import java.util.List;
import entity.Rolparqueo;
/**
*
* @author eagle
*/
public class RolParqueoDAO extends GeneralDAO<RolParqueoDAO, String> {
@Override
public String getReadQuery() {
return "SELECT r FROM rolParqueo r";
}
@Override
public String getReadByNameQuery() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public String[] makeArray(List lis, int tam) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Class getEntityClass() {
return Rolparqueo.class;
}
}
|
[
"rvillabonas@717f917d-fdd7-54f2-cfaa-ef75c8cdf1c5"
] |
rvillabonas@717f917d-fdd7-54f2-cfaa-ef75c8cdf1c5
|
29da8b1cc2bc3511580d023de66bb63afad249eb
|
46d6b7d4aa703b1b03a038f857492ef349659cbf
|
/cerp-system-api/src/main/java/com/matthew/cerp/service/SystemLogService.java
|
8d8eb805d2e272529d310616a51d3a6a079a85b3
|
[] |
no_license
|
yezijiang/cerp-dubbo
|
3c9444df99e6794d38c729aec1ee6cc85fdfdc0d
|
3e7ca1525900e76a986cfd473fcd3d1b0b653d60
|
refs/heads/master
| 2020-12-03T01:59:31.135671
| 2017-07-06T10:05:33
| 2017-07-06T10:05:33
| 95,891,542
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 504
|
java
|
package com.matthew.cerp.service;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.matthew.cerp.entity.TSLog;
import java.util.List;
import java.util.Map;
/**
* Created with IntelliJ IDEA
* User: maxing
* TIME: 2017-06-29 11:22
*/
public interface SystemLogService {
void insertOperateLog(TSLog log);
void insertOperateFailLog(TSLog log);
void insertLoginLog(TSLog log);
List<TSLog> queryLogData(Map<String, Object> params, PageBounds pageBounds);
}
|
[
"maxingfight1990@163.com"
] |
maxingfight1990@163.com
|
a4e6ed5976fba871251817decd057a22efd04171
|
ecc9a3aa55c5100dd7d811837079afa528904522
|
/project/popcustomerservice/.svn/pristine/82/8256089dfe9fc7fd4c2d4838334247b698b50f4a.svn-base
|
0f1559902c6ad66ae531c89696e5525145e00553
|
[] |
no_license
|
vian127/complateCRM
|
eb01a30b4ca3b7e3e9ac0b69ed334b168c154908
|
fe0c0b754240188b1cddfa4a1b8adad6196d7f5a
|
refs/heads/master
| 2020-03-28T23:22:09.975327
| 2018-09-18T13:38:08
| 2018-09-18T13:38:08
| 149,288,199
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,270
|
package com.pop136.customerservice.mapper.agent.tag;
import com.pop136.core.mybatis.AbstractBaseMapper;
import com.pop136.core.mybatis.annotation.Table;
import com.pop136.core.mybatis.criteria.Condition;
import com.pop136.core.mybatis.criteria.ConditionMapping;
import com.pop136.customerservice.entity.tag.TagCustomer;
import com.pop136.customerservice.entity.tag.TagCustomerLog;
import com.pop136.customerservice.vo.tag.search.TagValueSearchVo;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* 客户标签 values
*/
@Repository
@Table("sslog_tagvalue_customer")
public class TagCustomerLogMapper extends AbstractBaseMapper {
@Override
public void init() {
ConditionMapping mapping = new ConditionMapping( ) ;
super.putMapping( DEF_MAPPING_KEY , mapping);
super.setUnityFlterCondition( new Condition[]{ new Condition("deleteflag" , 0 , Condition.SYMBOL.EQ )});
}
public List<TagCustomer> findTagCustomerList(TagValueSearchVo searchVo) {
return sqlTemplate.selectList("TagCustomerMapper.findTagCustomerList", searchVo);
}
public void batchInsert(List<TagCustomerLog> tagCustomerLogs) {
sqlTemplate.update("TagCustomerMapper.tagCustomerLogs", tagCustomerLogs);
}
}
|
[
"fengfeng"
] |
fengfeng
|
|
12ae3e7ec6871482ee314e17a0eb6c00bfe02a35
|
68aea04e8998eb6243543a336cf06bd7b94d9298
|
/src/sort/Sortable.java
|
569ceac94c9592d20f2e019f2fcd4d44c8f6e80b
|
[] |
no_license
|
mlambovski/SortingUpDown
|
2f887c2dd2aee35eed96bf957797a1235b545998
|
cf712c01f40a107c88f49ded44329f40a8fe2300
|
refs/heads/master
| 2016-09-06T15:34:55.804235
| 2015-06-14T16:08:22
| 2015-06-14T16:08:22
| 37,419,281
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 81
|
java
|
package sort;
public interface Sortable {
boolean greater(int a, int b);
}
|
[
"mlambovski@gmail.com"
] |
mlambovski@gmail.com
|
31529cf48172fd1c2b87b317bd9fb64df35329cd
|
6129ee02cdb6f1cffc8991d70882f0a873119589
|
/src/jp/co/casleyconsulting/www/nurseryVacancy/extactor/SetagayaExtractor.java
|
028f99f3cf0846c283476846f3facf58bcbf5456
|
[] |
no_license
|
baldinghead/hoikubatch
|
61b6043aede2b4de5ee1a198a50a42a1f060c0fd
|
0d2d5c4651a08c0be05d7f03be9e157592119465
|
refs/heads/master
| 2021-01-10T21:12:03.318578
| 2014-08-05T15:54:17
| 2014-08-05T15:54:17
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,500
|
java
|
package jp.co.casleyconsulting.www.nurseryVacancy.extactor;
import java.util.ArrayList;
import java.util.List;
import jp.co.casleyconsulting.www.nurseryVacancy.dto.NurseryVacancyInfo;
import org.apache.commons.lang3.StringUtils;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
/**
* @author FUJIWARA
*
*/
public class SetagayaExtractor extends GeneralExtractor {
/*
* (非 Javadoc)
*
* @see Extractor#extract(java.lang.String)
*/
@Override
public List<NurseryVacancyInfo> extract(String url) {
Document doc = getDocument(url);
List<NurseryVacancyInfo> resList = new ArrayList<>();
Elements tables = doc.getElementsByClass("table03");
for (Element table : tables) {
Elements trs = table.getElementsByTag("tr");
List<Element> trsList = trs.subList(1, trs.size());
for (Element tr : trsList) {
Elements tds = tr.getElementsByTag("td");
if (tds.size() > 5 && StringUtils.isNotEmpty(tds.get(1).text())) {
NurseryVacancyInfo info = new NurseryVacancyInfo();
info.name = tds.get(1).text();
info.zeroCnt = tds.get(4).text().trim();
info.firstCnt = tds.get(5).text().trim();
info.secondCnt = tds.get(6).text().trim();
info.thirdCnt = tds.get(7).text().trim();
info.fourthCnt = tds.get(8).text().trim();
info.fifthCnt = tds.get(9).text().trim();
resList.add(info);
}
}
}
return resList;
}
}
|
[
"yoshio@fujiwarayoshio-no-iMac.local"
] |
yoshio@fujiwarayoshio-no-iMac.local
|
f9c1dcc25ba4dbcca5beaa66d13a4c25639669ac
|
edc139b0268d5568df88255df03585b5c340b8ca
|
/projects/org.activebpel.rt.b4p/src/org/activebpel/rt/b4p/impl/engine/AeNotification.java
|
beba6e593dfae3b115dad8293c8e59faced8b27f
|
[] |
no_license
|
wangzm05/provenancesys
|
61bad1933b2ff5398137fbbeb930a77086e8660b
|
031c84095c2a7afc4873bd6ef97012831f88e5a8
|
refs/heads/master
| 2020-03-27T19:50:15.067788
| 2009-05-08T06:02:31
| 2009-05-08T06:02:31
| 32,144,610
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,476
|
java
|
// $Header: /Development/AEDevelopment/projects/org.activebpel.rt.b4p/src/org/activebpel/rt/b4p/impl/engine/AeNotification.java,v 1.2 2008/02/16 22:29:48 mford Exp $
/////////////////////////////////////////////////////////////////////////////
// PROPRIETARY RIGHTS STATEMENT
// The contents of this file represent confidential information that is the
// proprietary property of Active Endpoints, Inc. Viewing or use of
// this information is prohibited without the express written consent of
// Active Endpoints, Inc. Removal of this PROPRIETARY RIGHTS STATEMENT
// is strictly forbidden. Copyright (c) 2002-2007 All rights reserved.
/////////////////////////////////////////////////////////////////////////////
package org.activebpel.rt.b4p.impl.engine;
import org.activebpel.rt.b4p.def.AePeopleActivityDef;
import org.activebpel.rt.message.IAeMessageData;
/**
* Passed to the B4P manager when a notification needs to be
* executed.
*/
public class AeNotification extends AeB4PQueueObject
{
/**
* C'tor.
*
* @param aProcessId
* @param aLocationId
* @param aLocationPath
* @param aMessageData
* @param aPeopleActivityDef
*/
public AeNotification(long aProcessId, int aLocationId, String aLocationPath, IAeMessageData aMessageData,
AePeopleActivityDef aPeopleActivityDef)
{
super(aProcessId, aLocationId, aLocationPath, aMessageData, aPeopleActivityDef);
}
}
|
[
"wangzm05@ca528a1e-3b83-11de-a81c-fde7d73ceb89"
] |
wangzm05@ca528a1e-3b83-11de-a81c-fde7d73ceb89
|
ace4faf7a83a6a5d2c492346ba6c53a67ded5901
|
9510312628b8f0708d7116a652b7c5c2a4010587
|
/src/test/java/toutiao/controller/ArticleControllerTest.java
|
79cf9a18c80cd30c7b0076a9926ecf4c2c359907
|
[] |
no_license
|
wjt2015/heima_toutiao
|
8a0c6aaee8e8a733a8b6630b4e30fb85021ae720
|
452d4436054d5bb2e583f0f659752f61bc0aa913
|
refs/heads/main
| 2023-03-24T05:46:34.414120
| 2021-01-27T10:06:14
| 2021-01-27T10:06:14
| 329,804,494
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 635
|
java
|
package toutiao.controller;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import toutiao.model.ArticleRequest;
@Slf4j
public class ArticleControllerTest {
@Test
public void load() {
}
@Test
public void loadMore() {
}
@Test
public void loadNew() {
}
@Test
public void json() {
long ts = System.currentTimeMillis() - 1000000L;
ArticleRequest articleRequest = new ArticleRequest(1, 1, 1, "财经", ts);
String jsonString = JSON.toJSONString(articleRequest);
log.info("jsonString={};", jsonString);
}
}
|
[
"jintao9@staff.weibo.com"
] |
jintao9@staff.weibo.com
|
337d353548a69b6f651cc73df34f375951069eb8
|
dd70815a3d289163c14880d777dec4c44378a62e
|
/app/src/main/java/com/example/aitor/flickry/AppContext.java
|
f1442030ed361c8de8079ca1686bc09de35b518d
|
[] |
no_license
|
aitorvs/Flickry
|
a2a84af23e9cd6b816a87e5c6e26f484dfa4ca3c
|
3f1a2dee9beee9f208bd2c9e14d4f3319b0cb7c1
|
refs/heads/master
| 2021-07-13T07:26:11.626770
| 2017-10-15T21:19:20
| 2017-10-15T21:19:20
| 107,039,770
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 112
|
java
|
package com.example.aitor.flickry;
import javax.inject.Qualifier;
@Qualifier
public @interface AppContext {
}
|
[
"aitor.viana.sanchez@ing.nl"
] |
aitor.viana.sanchez@ing.nl
|
22becc1a81eb0c970b9f688d844f908ab395249a
|
eda69ebeab2e513bc1658c54a09887f7462a9a4d
|
/meggieTest/src/Pages/CloseBrowser.java
|
f130571c2ed7f25ac11203eda96a39d63f5ec020
|
[] |
no_license
|
fangbing/webdriver_start
|
5202950f89acce85b969357ffb33c4a631d0d1bc
|
a830e626ffcd2ba343ef6ef50844a7568c9a5b0b
|
refs/heads/master
| 2016-09-10T00:58:51.206557
| 2014-03-17T01:06:23
| 2014-03-17T01:06:23
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 390
|
java
|
package Pages;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class CloseBrowser {
public static void main(String[] args) {
// TODO Auto-generated method stub
WebDriver dr = new ChromeDriver();
System.out.println("browser will be closed");
dr.quit();
System.out.println("browser is closed");
}
}
|
[
"735699747@qq.com"
] |
735699747@qq.com
|
1647c3535b4ee12474fa8311afa32c411674b4b5
|
fa91450deb625cda070e82d5c31770be5ca1dec6
|
/Diff-Raw-Data/2/2_7722f819948c51090c0ee7b95826563f2ce161fa/BasicWebSteps/2_7722f819948c51090c0ee7b95826563f2ce161fa_BasicWebSteps_s.java
|
53dbf18d7be61651a8b4b427b5d8e73b0c0ae42b
|
[] |
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
| 5,500
|
java
|
package org.sukrupa.cucumber.steps;
import cuke4duke.annotation.After;
import cuke4duke.annotation.I18n.EN.Given;
import cuke4duke.annotation.I18n.EN.Then;
import cuke4duke.annotation.I18n.EN.When;
import net.sf.sahi.client.Browser;
import net.sf.sahi.client.ElementStub;
import org.sukrupa.cucumber.SahiFacade;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.junit.Assert.*;
import static org.sukrupa.cucumber.SahiFacade.browser;
public class BasicWebSteps {
protected static final String TOP_LEVEL_DIV = "page";
@When("^I select \"([^\"]*)\" from \"([^\"]*)\"$")
public void choseFrom(String choice, String ObjectID) {
browser().byId(ObjectID).choose(choice);
}
@Then("^([^\" ]*) should contain ([^\"]*)$")
public void shouldContain(String ObjectID, String objectValueToMatch) {
String objectValue = browser().byId(ObjectID).getValue();
assertThat(objectValue, containsString(objectValueToMatch));
}
@Then("^([^\"]*) is blank")
public void shouldbeBlank(String ObjectID) {
String objectValue = browser().byId(ObjectID).getValue();
// assertThat(objectValue, is(""));
}
@Then("^\"([^\"]*)\" should not contain \"([^\"]*)\"$")
public void shouldNotContain(String ObjectID, String objectValueToMatch) {
String objectValue = browser().byId(ObjectID).getValue();
assertThat(objectValue, not(containsString(objectValueToMatch)));
}
@When("^I click \"([^\"]*)\" button$")
public void clickButton(String buttonText) {
browser().button(buttonText).click();
}
@When("^I click \"([^\"]*)\" submit button$")
public void clickSubmitButton(String buttonText) {
browser().submit(buttonText).click();
}
@When("^I submit a search$")
public void submitSearch() {
browser().submit("Search").click();
}
@Then("^the button ([^\"]*) must be displayed$")
public void buttonShouldBeDisplayed(String text) {
assertTrue(browser().submit(text).exists());
}
@Then("\"([^\"]*)\" should be displayed$")
public void shouldBeDisplayed(String text) {
ElementStub pageDiv = browser().div(TOP_LEVEL_DIV);
assertTrue(pageDiv.exists());
assertTrue(browser().containsText(pageDiv, text));
}
@Then("^([^\"]*) should not be displayed$")
public void shouldNotBeDisplayed(String text) {
assertFalse(browser().containsText(browser().div(TOP_LEVEL_DIV), text));
}
@When("^I click \"([^\"]*)\" link$")
public void clickLink(String text) {
browser().link(text).click();
}
@When("^I fill in the \"([^\"]*)\" with \"([^\"]*)\"$")
public void fillInTheTextfieldWith(String field, String fieldContent) {
browser().textbox(field).setValue(fieldContent);
}
@Then("^student ([^\"]*) is displayed$")
public void studentIsDisplayed(String text) {
Browser browser = browser();
assertTrue(browser.containsText(browser.div(TOP_LEVEL_DIV), text));
}
@Then("^student \"([^\"]*)\" is not displayed$")
public void studentIsNotDisplayed(String text) {
assertFalse(browser().containsText(browser().div("page"), text));
}
@Then("^\"([^\"]*)\" should be displayed in \"([^\"]*)\"$")
public void shouldBeDisplayedInField(String text, String field) {
assertTrue(browser().select(field).getText().contains(text));
}
@Then("^the ([^\"]*) page is displayed")
public void pageIsDisplayed(String pageName) {
assertTrue(browser().containsText(browser().div(TOP_LEVEL_DIV), pageName));
}
@When("^I \"([^\"]*)\" in the sidebar")
public void clickLinkInSidebar(String text) {
browser().link(text).click();
}
@When("^I enter ([^\"']*) as ([^\"]*)")
public void enterIntoTheTextBox(String text, String elementId) {
if (browser().label(elementId).exists(true)) {
elementId = browser().label(elementId).fetch("htmlFor");
}
browser().byId(elementId).setValue(text);
}
@When("^I select ([^\"']*) as ([^\"]*)")
public void selectFromDropDown(String value, String dropDownName) {
browser().select(dropDownName).choose(value);
}
@Then("^the message \"([^\"]*)\" is displayed$")
public void displayErrorMessage(String errorMessage) {
assertTrue(browser().containsText(browser().div(TOP_LEVEL_DIV), errorMessage));
}
@When("^I \"([^\"]*)\" the form")
public void submitForm(String submitButtonName) {
browser().submit(submitButtonName).click();
}
@Given("^I am on the ([^\"]*) page$")
public void navigateToAdminPages(String pageName) {
navigateTo(pageName);
}
@When("^I navigate to the ([^\"]*) page$")
public void navigateToPage(String pageName) {
navigateTo(pageName);
}
private void navigateTo(String pageName) {
browser().link(pageName).click();
}
@Then("^the message \"([^\"]*)\" should be displayed$")
public void displayMessage(String message) {
assertTrue(browser().containsText(browser().div(TOP_LEVEL_DIV), message));
}
@After
public void closeBrowser() {
SahiFacade.closeBrowser();
}
}
|
[
"yuzhongxing88@gmail.com"
] |
yuzhongxing88@gmail.com
|
c4cfdae4a5d50ffff6b7f52f39510eee01f3923f
|
e4dff0c9183ec43e24a726dc5639713e30476346
|
/src/main/java/com/springboottest/springboottest/config/CrosConfig.java
|
1bd6a9b87340abe513286f9aa54bb08d0c33d821
|
[] |
no_license
|
yuqian-max/springboottest
|
e27c7b0bbb1cbf427907bfbf6cb18307ade8b918
|
2ceb9335e654a42efce70acbaf4dae09f13bba7f
|
refs/heads/master
| 2021-01-13T18:56:22.324554
| 2020-02-23T05:46:09
| 2020-02-23T05:46:09
| 242,463,844
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 665
|
java
|
package com.springboottest.springboottest.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class CrosConfig implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("*")
.allowedMethods("GET","HEAD","POST","PUT","DELETE","OPTIONS")
.allowCredentials(true)
.maxAge(3600)
.allowedHeaders("*");
}
}
|
[
"x900124@163.com"
] |
x900124@163.com
|
517ec8822744c05762c0250dbb983524c5e198b7
|
880c227b6782660b283688a89cd0ae4b4a3a69a3
|
/src/com/ipartek/formacion/danielsan/Rueda.java
|
293c1a32527494faafa6731eafdb27551ef13be4
|
[] |
no_license
|
ipartek/LibroJava7
|
0ed2a118a6369194b04d5e984c3d6c88277da74f
|
2c163161891a52ba022bd476b7980a2860185179
|
refs/heads/master
| 2021-01-23T00:25:25.228457
| 2017-05-21T20:14:06
| 2017-05-21T20:14:06
| 85,730,051
| 9
| 2
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 556
|
java
|
package com.ipartek.formacion.danielsan;
public class Rueda {
private double radio, ancho;
@Override
public String toString() {
return "Rueda [radio=" + radio + ", ancho=" + ancho + "]";
}
public Rueda(double radio, double ancho) {
super();
this.radio = radio;
this.ancho = ancho;
}
public double getRadio() {
return radio;
}
public void setRadio(double radio) {
this.radio = radio;
}
public double getAncho() {
return ancho;
}
public void setAncho(double ancho) {
this.ancho = ancho;
}
}
|
[
"danielsanchezsanchez20@gmail.com"
] |
danielsanchezsanchez20@gmail.com
|
0142992ae833a66008658656234f8b54da0673d3
|
22546c84b8df0ee2859d69b9f8ad1bccb7213c29
|
/AOP/src/main/java/com/spring/image/ImageCopy.java
|
e0d51e9d96e1394154348ecf8ee6a81330dff099
|
[] |
no_license
|
yexiaoci/spring-study
|
a71557da62b3ed27fb517a6ba97b1ab5215c8b5a
|
512fef0e505def11dac2fc23f91aaa675935ba9a
|
refs/heads/master
| 2021-10-27T15:30:30.455201
| 2019-04-18T01:28:34
| 2019-04-18T01:28:34
| 173,725,091
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 742
|
java
|
package com.spring.image;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.*;
public class ImageCopy {
private static final Logger logger = LoggerFactory.getLogger(ImageCopy.class);
public void copyImage()throws IOException{
logger.info("开始将图片从D盘复制到E盘...");
File srcFile = new File("D:/bg1.jpg");
File destFile = new File("E:/bg1.jpg");
InputStream in =new FileInputStream(srcFile);
OutputStream out =new FileOutputStream(destFile);
byte[]bytes = new byte[(int) srcFile.length()];
int len;
while((len = in.read(bytes))!= -1){
out.write(bytes,0,len);
}
in.close();
out.close();
}
}
|
[
"2871238016@qq.com"
] |
2871238016@qq.com
|
f1704e7ee6defd9820efc99931b2d6e74e0875db
|
7ef0009278c41916afd51ff92cc1b2e4385688f9
|
/src/itea/lsn15/Wrk_SocketsChat/ChatClient/Message.java
|
4875d5c6160611553b32f5ab3742969f0e23817a
|
[] |
no_license
|
Aurusd/itea_jb
|
fc0d487ca3aeace963904b2905b7d3e1f08fe1df
|
3a7889ea46da5ba53d2805117ffd06c3d73d4e36
|
refs/heads/master
| 2021-03-12T19:20:54.054295
| 2015-01-21T14:43:35
| 2015-01-21T14:43:35
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,168
|
java
|
package itea.lsn15.Wrk_SocketsChat.ChatClient;
import java.io.*;
import java.util.Date;
public class Message implements Serializable {
private static final long serialVersionUID = 1L;
public Date date = new Date();
public String from;
public String to;
public boolean isFile;
public transient String text;
public transient String path;
@Override
public String toString() {
return new StringBuilder()
.append("[")
.append(date.toString())
.append(", From: ")
.append(from)
.append(", To: ")
.append(to)
.append("] ")
.append(text)
.toString();
}
public void writeToStream(OutputStream out)
throws IOException
{
ByteArrayOutputStream bs = new ByteArrayOutputStream();
ObjectOutputStream os = new ObjectOutputStream(bs);
try {
os.writeObject(this);
if ( ! isFile) {
os.writeUTF(text);
} else {
// write file content
}
} finally {
os.flush();
os.close();
}
byte[] packet = bs.toByteArray();
DataOutputStream ds = new DataOutputStream(out);
ds.writeInt(packet.length);
ds.write(packet);
ds.flush();
}
public static Message readFromStream(InputStream in)
throws IOException, ClassNotFoundException
{
if (in.available() <= 0)
return null;
DataInputStream ds = new DataInputStream(in);
int len = ds.readInt();
byte[] packet = new byte[len];
ds.read(packet);
ByteArrayInputStream bs = new ByteArrayInputStream(packet);
ObjectInputStream os = new ObjectInputStream(bs);
try {
Message msg = (Message) os.readObject();
if ( ! msg.isFile) {
msg.text = (String) os.readUTF();
} else {
// read file content
}
return msg;
} finally {
os.close();
}
}
}
|
[
"palevg@gmail.com"
] |
palevg@gmail.com
|
9a4fb224619b4346cd5fcecd2854c5b2e357478c
|
42d2eca38787896e86446ebc44e978df25d4252e
|
/app/src/main/java/com/rcklos/lentme/clientOld/Receiver.java
|
3a2d8d7d37902c868d5b4cb9330f4e651958af99
|
[] |
no_license
|
Rcklos/LentMe
|
83cfd2421c41fd29beeb6397108e88d9aba1bafc
|
c2af59d7305517ecc4096982a129951b73e005ab
|
refs/heads/master
| 2021-04-24T14:58:35.160222
| 2020-03-28T04:05:10
| 2020-03-28T04:05:10
| 250,710,852
| 2
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,344
|
java
|
package com.rcklos.lentme.clientOld;
import android.util.Log;
import com.rcklos.lentme.dataOld.constPool;
import java.net.Socket;
public abstract class Receiver extends Thread {
protected static String TAG = constPool.TAG + "Recver";
String user;
Socket socket;
boolean RUN_RECEIVER = true;
boolean destroy = false;
public Receiver(String user , Socket socket) {
this.user = user;
this.socket = socket;
}
public abstract void init();
public abstract void Rreceive() throws Exception;
public abstract void Rdestroy();
public abstract boolean closeSocket() throws Exception ;
public void run() {
init();
while( RUN_RECEIVER ) {
if(socket.isClosed()) {
//Log.i()
break;
}
try {
Rreceive();
Thread.sleep(constPool.TIME_SLEEP);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
Log.i(TAG,"已终止ֹreceive");
destroy = true;
Rdestroy();
}
}
if ( !destroy ) Rdestroy();
}
public void breakReceive() {
this.RUN_RECEIVER = false;
}
public boolean isBreakReceive(){
return RUN_RECEIVER;
}
public void setUser( String user ) {
this.user = user;
}
public String getUser() {
return user;
}
public Socket getSocket() {
return socket;
}
}
|
[
"2015297729@qq.com"
] |
2015297729@qq.com
|
1ac8797dfc1752e9daeaa97a51f4364bb09608a3
|
3a856a230c169110607c23c2c88bcc931356c7bb
|
/05-architecture/XX-UIWebViewComponent/webview/src/main/java/com/xiangxue/webview/webviewprocess/BaseWebView.java
|
e1c57c82de941b8f9157c3a2d8c7eabf86926722
|
[] |
no_license
|
klzhong69/android-code
|
de9627fe3c5f890011d3bd0809e73fa8da5b0f3e
|
7e07776c9dc61e857ca5c36ab81a0fb22cd619c1
|
refs/heads/main
| 2023-08-13T16:08:29.994460
| 2021-10-13T15:22:50
| 2021-10-13T15:22:50
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,663
|
java
|
package com.xiangxue.webview.webviewprocess;
import android.content.Context;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Log;
import android.webkit.JavascriptInterface;
import android.webkit.WebView;
import com.google.gson.Gson;
import com.xiangxue.webview.WebViewCallBack;
import com.xiangxue.webview.bean.JsParam;
import com.xiangxue.webview.webviewprocess.settings.WebViewDefaultSettings;
import com.xiangxue.webview.webviewprocess.webchromeclient.XiangxueWebChromeClient;
import com.xiangxue.webview.webviewprocess.webviewclient.XiangxueWebViewClient;
public class BaseWebView extends WebView {
public static final String TAG = "XiangxueWebView";
public BaseWebView(Context context) {
super(context);
init();
}
public BaseWebView(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public BaseWebView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init();
}
public BaseWebView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
init();
}
public void init() {
WebViewProcessCommandDispatcher.getInstance().initAidlConnection();
WebViewDefaultSettings.getInstance().setSettings(this);
addJavascriptInterface(this, "xiangxuewebview");
}
public void registerWebViewCallBack(WebViewCallBack webViewCallBack) {
setWebViewClient(new XiangxueWebViewClient(webViewCallBack));
setWebChromeClient(new XiangxueWebChromeClient(webViewCallBack));
}
@JavascriptInterface
public void takeNativeAction(final String jsParam) {
Log.i(TAG, jsParam);
if (!TextUtils.isEmpty(jsParam)) {
final JsParam jsParamObject = new Gson().fromJson(jsParam, JsParam.class);
if (jsParamObject != null) {
WebViewProcessCommandDispatcher.getInstance().executeCommand(jsParamObject.name, new Gson().toJson(jsParamObject.param), this);
}
}
}
public void handleCallback(final String callbackname, final String response){
if(!TextUtils.isEmpty(callbackname) && !TextUtils.isEmpty(response)){
post(new Runnable() {
@Override
public void run() {
String jscode = "javascript:xiangxuejs.callback('" + callbackname + "'," + response + ")";
Log.e("xxxxxx", jscode);
evaluateJavascript(jscode, null);
}
});
}
}
}
|
[
"ztiany3@gmail.com"
] |
ztiany3@gmail.com
|
65df464360fc6acbe1b17ebef414847673ef9283
|
ea1d6493324cd0542e8f0f73cd1e0a816cc816e1
|
/app/src/main/java/ttatli/com/foursquareappdemo/models/Responce.java
|
0a579271b9cb121814419525e6cceb1b091ceff3
|
[] |
no_license
|
ttatlii/foursquareAppDemo
|
422c404fc1db4885d3d343f5a59f606fd877d496
|
13cdd272360a6f7f057bf9dc62b3025973342761
|
refs/heads/master
| 2020-06-29T20:05:06.054087
| 2019-08-05T14:59:45
| 2019-08-05T14:59:45
| 200,612,258
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 181
|
java
|
package ttatli.com.foursquareappdemo.models;
import java.io.Serializable;
import java.util.List;
public class Responce implements Serializable {
public List<Venue> venues;
}
|
[
"ttatli@NETAS.com.tr"
] |
ttatli@NETAS.com.tr
|
21279166f93151313c70431d759faf24a30aafdd
|
7bf22b39369994a3369c1dd0aa64d4cdf9726331
|
/src/main/java/com/joseph/foamadminjava/config/RedisConfig.java
|
955458b52223e57dee997701780676f318e97525
|
[] |
no_license
|
coderjingtao/foam-admin-java
|
a5f1b65a2bfcb46d97490e8ac046a685bb79944c
|
f54a301f951ad0407e84afe49f25c2e6543c2a46
|
refs/heads/master
| 2023-08-11T10:43:52.596118
| 2021-10-06T00:57:11
| 2021-10-06T00:57:11
| 414,025,650
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,467
|
java
|
package com.joseph.foamadminjava.config;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
@Configuration
public class RedisConfig {
/**
* 重新配置Redis的序列化方式,否则存储到redis的数据不方便查看
* @param redisConnectionFactory redis connection factory
* @return new redis template
*/
@Bean
RedisTemplate redisTemplate(RedisConnectionFactory redisConnectionFactory){
RedisTemplate redisTemplate = new RedisTemplate();
redisTemplate.setConnectionFactory(redisConnectionFactory);
Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class);
jackson2JsonRedisSerializer.setObjectMapper(new ObjectMapper());
redisTemplate.setKeySerializer(new StringRedisSerializer());
redisTemplate.setValueSerializer(jackson2JsonRedisSerializer);
redisTemplate.setHashKeySerializer(new StringRedisSerializer());
redisTemplate.setHashValueSerializer(jackson2JsonRedisSerializer);
return redisTemplate;
}
}
|
[
"liujingtao529@gmail.com"
] |
liujingtao529@gmail.com
|
a9df0c2e4334f4a0f4301398927462c0aeb5b557
|
dca08bb50fd2be42a1903c04626decad07ed92cb
|
/xueliang/app/src/main/java/com/example/xueliang/view/readview/animation/SlidePageAnim.java
|
ae4816fb3ec9e36ba9a9c9e4210682184c93533d
|
[] |
no_license
|
wangbf11/androidTV
|
d795907e002f03ac9acdc95f1f16ebab9a725f63
|
92788b4162c3b1a2d6bc5e3b0e76e696a10133e1
|
refs/heads/master
| 2021-08-26T05:58:31.629330
| 2020-06-01T07:39:44
| 2020-06-01T07:39:44
| 251,294,980
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,439
|
java
|
package com.example.xueliang.view.readview.animation;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.view.View;
/**
* Created by wbf
*/
public class SlidePageAnim extends HorizonPageAnim {
private Rect mSrcRect, mDestRect,mNextSrcRect,mNextDestRect;
public SlidePageAnim(int w, int h, View view, OnPageChangeListener listener) {
super(w, h, view, listener);
mSrcRect = new Rect(0, 0, mViewWidth, mViewHeight);
mDestRect = new Rect(0, 0, mViewWidth, mViewHeight);
mNextSrcRect = new Rect(0, 0, mViewWidth, mViewHeight);
mNextDestRect = new Rect(0, 0, mViewWidth, mViewHeight);
}
@Override
public void drawStatic(Canvas canvas) {
if (isCancel){
canvas.drawBitmap(mCurBitmap, 0, 0, null);
}else {
canvas.drawBitmap(mNextBitmap, 0, 0, null);
}
}
@Override
public void drawMove(Canvas canvas) {
int dis = 0;
switch (mDirection){
case NEXT:
//左半边的剩余区域
dis = (int) (mScreenWidth - mStartX + mTouchX);
if (dis > mScreenWidth){
dis = mScreenWidth;
}
//计算bitmap截取的区域
mSrcRect.left = mScreenWidth - dis;
//计算bitmap在canvas显示的区域
mDestRect.right = dis;
//计算下一页截取的区域
mNextSrcRect.right = mScreenWidth - dis;
//计算下一页在canvas显示的区域
mNextDestRect.left = dis;
canvas.drawBitmap(mNextBitmap,mNextSrcRect,mNextDestRect,null);
canvas.drawBitmap(mCurBitmap,mSrcRect,mDestRect,null);
break;
default:
dis = (int) (mTouchX - mStartX);
if (dis < 0){
dis = 0;
mStartX = mTouchX;
}
mSrcRect.left = mScreenWidth - dis;
mDestRect.right = dis;
//计算下一页截取的区域
mNextSrcRect.right = mScreenWidth - dis;
//计算下一页在canvas显示的区域
mNextDestRect.left = dis;
canvas.drawBitmap(mCurBitmap,mNextSrcRect,mNextDestRect,null);
canvas.drawBitmap(mNextBitmap,mSrcRect,mDestRect,null);
break;
}
}
@Override
public void startAnim() {
super.startAnim();
int dx = 0;
switch (mDirection){
case NEXT:
if (isCancel){
int dis = (int)((mScreenWidth - mStartX) + mTouchX);
if (dis > mScreenWidth){
dis = mScreenWidth;
}
dx = mScreenWidth - dis;
}else{
dx = (int) -(mTouchX + (mScreenWidth - mStartX));
}
break;
default:
if (isCancel){
dx = (int)-Math.abs(mTouchX - mStartX);
}else{
dx = (int) (mScreenWidth - (mTouchX - mStartX));
}
break;
}
//滑动速度保持一致
int duration = (400 * Math.abs(dx)) / mScreenWidth;
mScroller.startScroll((int) mTouchX, 0, dx, 0, duration);
}
}
|
[
"584623818@qq.com"
] |
584623818@qq.com
|
6b39b742fb4d35e7cd32fc16fbf5e7b2a7e0adf7
|
686147b97f78a3abe52ab7621dd24fb23e190302
|
/src/org/tempuri/WSLCSD/Service/WCISDBIO.java
|
116d10168e79fb99cb83dc061d6fdc8ffbbce237
|
[] |
no_license
|
CeliaJSLau/WCIS
|
1904bc37f9b2da30d91e951738391d6a2e94f713
|
9837d42a459a731ee8ff4694458533a2a77d7abe
|
refs/heads/master
| 2023-06-09T04:13:00.583404
| 2021-06-25T04:09:25
| 2021-06-25T04:09:25
| 380,120,152
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 11,132
|
java
|
package org.tempuri.WSLCSD.Service;
import java.io.File;
import java.sql.Connection;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.google.gson.Gson;
public class WCISDBIO {
private Gson gson = new Gson();
protected final Log logger = LogFactory.getLog(getClass());
public Util util = new Util();
public ParseLCSDDB parse = new ParseLCSDDB();
public static void main(String[] args) throws Exception{
// String processDate = (args.length>0 && args[0]!=null)?args[0]:(new SimpleDateFormat("yyyy-MM-dd").format(new Date(System.currentTimeMillis()-24*60*60*1000)));
// new WCISDBIO().wcis_ws2db("2021-06-25");
WCISDBIO newJob =new WCISDBIO();
if(args.length>0 && args[0]!=null)
newJob.wcis_ws2db(args[0]);
else {
for(String s : newJob.getProcessDate()) {
newJob.wcis_ws2db(s);
}
}
}
public void wcis_ws2db(String getDate) throws Exception {
logger.info("Run WCISDBIO for request Date: "+getDate);
Connection conn=getDBConnection();
try {
org.tempuri.WSLCSD.Service.MainSoapStub binding= getSoap();
String loginToken=getLogin(getDate,binding);
doDataTransmission(binding,loginToken,getDate,conn);
updateJobandSendEmail(true,conn,getDate);
}catch(Exception e) {
updateJobandSendEmail(false,conn,getDate);
}
conn.close();
}
public void doDataTransmission(org.tempuri.WSLCSD.Service.MainSoapStub binding, String loginToken, String requestDate,Connection conn) throws Exception{
importSubjectMatter(binding,loginToken,requestDate,conn);
importCaseStatus(binding,loginToken,requestDate,conn);
importCaseType(binding,loginToken,requestDate,conn);
importReferralStatus(binding,loginToken,requestDate,conn);
importCase(binding,loginToken,requestDate,conn);
exportCodeTable(binding,loginToken,requestDate,conn);
}
public org.tempuri.WSLCSD.Service.MainSoapStub getSoap() {
org.tempuri.WSLCSD.Service.MainSoapStub binding;
try {
binding = (org.tempuri.WSLCSD.Service.MainSoapStub)
new org.tempuri.WSLCSD.Service.MainLocator().getmainSoap();
}
catch (javax.xml.rpc.ServiceException jre) {
logger.error("JAX-RPC ServiceException caught: ", jre);
throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
}
binding.setTimeout(60000);
return binding;
}
public String getLogin(String getDate,org.tempuri.WSLCSD.Service.MainSoapStub binding) throws Exception{
org.tempuri.WSLCSD.Service.LoginRsp value = null;
try {
value = binding.login(new org.tempuri.WSLCSD.Service.LoginReq(util.getPath("WSLOGIN"),util.getPath("WSPWD")));
}catch(Exception e) {
logger.error("login error: ", e);
throw new Exception("[getLogin => " + e.toString() + "]");
}
org.tempuri.WSLCSD.Service.ReturnStatusList[] returnStatusLists=value.getReturnStatusLists();
int loginStatus = returnStatusLists[0].getReturnCode();
logger.info("login status: "+returnStatusLists[0].getReturnCode() +" "+returnStatusLists[0].getReturnMsg());
if(loginStatus!=100) {
logger.info("LOGIN WCIS WS FAILED ON "+getDate);
throw new Exception("login failed");
}
return value.getReturnStatusLists()[0].getReturnKey();
}
public Connection getDBConnection() {
Connection conn=new DBUtil().getConnection();
return conn;
}
public List<String> getProcessDate() throws SQLException{
LocalDate latestProcessDate = LocalDate.parse(parse.getLatestProcessDate(), DateTimeFormatter.ofPattern("yyyy-MM-dd"));
LocalDate currentProcessDate = LocalDate.now().minusDays(1);
List<String> processDates = new ArrayList<String>();
do {
processDates.add(DateTimeFormatter.ofPattern("yyyy-MM-dd").format(currentProcessDate));
currentProcessDate = currentProcessDate.minusDays(1);
}while(latestProcessDate.isBefore(currentProcessDate));
Collections.reverse(processDates);
return processDates;
}
public void importSubjectMatter(org.tempuri.WSLCSD.Service.MainSoapStub binding, String loginToken, String requestDate,Connection conn) throws Exception{
org.tempuri.WSLCSD.Service.GetLCSDSubjectMatterListRsp value1 = null;
try {
value1 = binding.getLCSDSubjectMatterList(new org.tempuri.WSLCSD.Service.GetLCSDSubjectMatterListReq(loginToken,requestDate,""));
logger.info("LCSDSubjectMatterLists returnstatus:"+value1.getReturnStatusLists()[0].getReturnCode()+" - "+value1.getReturnStatusLists()[0].getReturnMsg());
if(value1.getReturnStatusLists()[0].getReturnCode()==101) {
parse.parseSubjectMatter(value1.getLCSDSubjectMatterLists(),conn);
}
}catch(Exception e) {
logger.error("importSubjectMatter: ", e);
throw new Exception("[importSubjectMatter => " + e.toString() + "]");
}
}
public void importCaseStatus(org.tempuri.WSLCSD.Service.MainSoapStub binding, String loginToken, String requestDate,Connection conn) throws Exception{
org.tempuri.WSLCSD.Service.GetLCSDMappingListRsp value2 = null;
try {
value2 = binding.getLCSDMappingList(new org.tempuri.WSLCSD.Service.GetLCSDMappingListReq(loginToken,requestDate,"CASE_STATUS",""));
logger.info("LCSDCaseStatusCodes returnstatus:"+value2.getReturnStatusLists()[0].getReturnCode()+" - "+value2.getReturnStatusLists()[0].getReturnMsg());
System.out.println(gson.toJson(value2.getLCSDMappingLists()));
if(value2.getReturnStatusLists()[0].getReturnCode()==101) {
parse.parseCaseStatus(value2.getLCSDMappingLists(),conn);
}
}catch(Exception e) {
logger.error("importCaseStatus: ", e);
throw new Exception("[importCaseStatus => " + e.toString() + "]");
}
}
public void importCaseType(org.tempuri.WSLCSD.Service.MainSoapStub binding, String loginToken, String requestDate,Connection conn) throws Exception{
org.tempuri.WSLCSD.Service.GetLCSDMappingListRsp value3 = null;
try {
value3 =binding.getLCSDMappingList(new org.tempuri.WSLCSD.Service.GetLCSDMappingListReq(loginToken,requestDate,"CASE_TYPE",""));
logger.info("LCSDCaseTypeCodes returnstatus:"+value3.getReturnStatusLists()[0].getReturnCode()+" - "+value3.getReturnStatusLists()[0].getReturnMsg());
System.out.println(gson.toJson(value3.getLCSDMappingLists()));
if(value3.getReturnStatusLists()[0].getReturnCode()==101) {
parse.parseCaseType(value3.getLCSDMappingLists(),conn);
}
}catch(Exception e) {
logger.error("importCaseType: ", e);
throw new Exception("[importCaseType => " + e.toString() + "]");
}
}
public void importReferralStatus(org.tempuri.WSLCSD.Service.MainSoapStub binding, String loginToken, String requestDate,Connection conn) throws Exception {
org.tempuri.WSLCSD.Service.GetLCSDMappingListRsp value4 = null;
try {
value4 =binding.getLCSDMappingList(new org.tempuri.WSLCSD.Service.GetLCSDMappingListReq(loginToken,requestDate,"REFERRAL_STATUS",""));
logger.info("ReferralStatusCodes returnstatus:"+value4.getReturnStatusLists()[0].getReturnCode()+" - "+value4.getReturnStatusLists()[0].getReturnMsg());
System.out.println(gson.toJson(value4.getLCSDMappingLists()));
if(value4.getReturnStatusLists()[0].getReturnCode()==101) {
parse.parseReferralStatus(value4.getLCSDMappingLists(),conn);
}
}catch(Exception e) {
logger.error("importReferralStatus: ", e);
throw new Exception("[importReferralStatus => " + e.toString() + "]");
}
}
public void importCase(org.tempuri.WSLCSD.Service.MainSoapStub binding, String loginToken, String requestDate,Connection conn) throws Exception{
org.tempuri.WSLCSD.Service.GetLCSDCaseDetailRsp value5=null;
String datasetKey="";
List<LCSDCaseDetailList> detailList = new ArrayList<LCSDCaseDetailList>();
try {
do {
value5 = binding.getLCSDCaseDetailList(new org.tempuri.WSLCSD.Service.GetLCSDCaseDetailReq(loginToken,requestDate,datasetKey));
datasetKey = value5.getReturnStatusLists()[0].getReturnKey();
Collections.addAll(detailList, value5.getLCSDCaseDetailLists());
logger.info("LCSDCaseDetailLists returnstatus:"+value5.getReturnStatusLists()[0].getReturnCode()+" - "+value5.getReturnStatusLists()[0].getReturnMsg());
}while(value5.getReturnStatusLists()[0].getReturnCode()==102);
if(detailList!=null && !detailList.isEmpty()) {
parse.parseCase(detailList,conn);
}
}catch(Exception e) {
logger.error("importCase: ", e);
throw new Exception("[importCase => " + e.toString() + "]");
}
}
public void exportCodeTable(org.tempuri.WSLCSD.Service.MainSoapStub binding, String loginToken, String requestDate,Connection conn) throws Exception{
try {
String[] CODE_TABLE = util.getPath("CODE_TABLES").split(",");
String exportDir = util.getPath("WCIS_EXPORT_DIR");
parse.extractCodeTableFromDB(conn);
org.tempuri.WSLCSD.Service.UploadLCSDFileRsp value6 =binding.uploadLCSDFile(new org.tempuri.WSLCSD.Service.UploadLCSDFileReq(loginToken,requestDate,"ctrl.txt",util.encodeFileToBase64(new File(exportDir+"ctrl.txt"))));
logger.info("uploadLCSDFile "+"ctrl.txt"+" returnstatus:"+value6.getReturnStatusLists()[0].getReturnCode()+" - "+value6.getReturnStatusLists()[0].getReturnMsg());
for (int i = 0; i < CODE_TABLE.length; i++) {
File executeFile = new File(exportDir+CODE_TABLE[i]+".CSV");
if(executeFile.exists()) {
value6=binding.uploadLCSDFile(new org.tempuri.WSLCSD.Service.UploadLCSDFileReq(loginToken,requestDate,CODE_TABLE[i]+".CSV",util.encodeFileToBase64(executeFile)));
logger.info("uploadLCSDFile "+CODE_TABLE[i]+".CSV"+" returnstatus:"+value6.getReturnStatusLists()[0].getReturnCode()+" - "+value6.getReturnStatusLists()[0].getReturnMsg());
}else
logger.info("uploadLCSDFile not exists:"+CODE_TABLE[i]+".CSV");
}
}catch(Exception e) {
logger.error("exportCodeTable: ", e);
throw new Exception("[exportCodeTable => " + e.toString() + "]");
}
}
public void updateJobandSendEmail(boolean success,Connection conn, String processDate) throws Exception {
String success_text=success?"Success":"Failed";
long BATCH_HISTORY_SEQ=parse.getBatchHistSeq(success?"Completed":"Failed",conn);
if(success)
parse.updateWCISSyncDate(conn,processDate);
String subject = "WCISDataIO completed with status " + success_text + " (Batch History Sequence: "
+ BATCH_HISTORY_SEQ + ")";
String message = "Dear Administrator,<br><br>Please be informed that the job WCISDataIO"
+ " was completed with status " + success_text + " at "
+ new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + " with batch history sequence: "
+ BATCH_HISTORY_SEQ + ".";
List<String> USER_ID=parse.getSysUserId(conn);
USER_ID.forEach((String name) -> { util.message(name, subject, message); });
logger.info("WCISDataIO completed with status "+success_text+" on " +new Date());
}
}
|
[
"celia.js.lau@gmail.com"
] |
celia.js.lau@gmail.com
|
09abe0c1b53cc90d225e587d908b85f2263aeccb
|
e3a72dd498fe7bc64ba98773c405e1333c3db11d
|
/dbpa/src/main/java/com/hauldata/dbpa/file/html/Html.java
|
dd008812a0554be3af77ece594b61afc5eb8a4a5
|
[
"Apache-2.0"
] |
permissive
|
rdesantis/hauldata
|
01c99656563e0662914e33e1cf37f2610c66848f
|
224efec86349805513940aa99f98ef2e2f860c52
|
refs/heads/master
| 2022-12-11T00:25:15.194357
| 2021-06-23T14:20:57
| 2021-06-23T14:20:57
| 52,346,125
| 0
| 0
|
Apache-2.0
| 2022-12-06T00:42:54
| 2016-02-23T09:12:53
|
Java
|
UTF-8
|
Java
| false
| false
| 3,946
|
java
|
/*
* Copyright (c) 2017, Ronald DeSantis
*
* 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.hauldata.dbpa.file.html;
import com.hauldata.dbpa.file.Headers;
import com.hauldata.dbpa.file.PageNode;
import com.hauldata.dbpa.file.SourceHeaders;
import com.hauldata.dbpa.file.TargetHeaders;
import com.hauldata.dbpa.variable.Variable;
public class Html implements PageNode {
private Variable<String> variable;
private HtmlOptions options;
private Headers headers;
private int rowIndex;
private boolean isHeader;
private StringBuilder content;
public Html(Variable<String> variable, HtmlOptions options) {
this.variable = variable;
this.options = options;
rowIndex = 0;
isHeader = false;
content = new StringBuilder();
}
@Override
public void setHeaders(Headers headers) {
this.headers = headers;
}
@Override
public SourceHeaders getSourceHeaders() {
return (SourceHeaders)headers;
}
@Override
public TargetHeaders getTargetHeaders() {
return (TargetHeaders)headers;
}
@Override
public String getName() {
return variable.getName();
}
@Override
public void writeColumn(int columnIndex, Object object) {
if (columnIndex == 1) {
rowIndex++;
isHeader = false;
if (rowIndex == 1) {
startTag("table", options.getTableStyle(), true);
if (headers.exist()) {
startTag("thead", options.getHeadStyle(), true);
isHeader = true;
}
else {
startTag("tbody", options.getBodyStyle(), true);
}
}
else {
endTag("tr");
if ((rowIndex == 2) && headers.exist()) {
endTag("thead");
startTag("tbody", options.getBodyStyle(), true);
}
}
boolean rowNeedsStartTag = true;
if (object instanceof String) {
String value = (String)object;
if (value.startsWith("<tr")) {
int endTagIndex = value.indexOf('>') + 1;
content.append(value.substring(0, endTagIndex));
endLine();
object = value.substring(endTagIndex);
rowNeedsStartTag = false;
}
}
if (rowNeedsStartTag){
startTag("tr", null, true);
}
}
String cellTag = isHeader ? "th" : "td";
String cellStyle = isHeader ? options.getHeadCellStyle() : options.getBodyCellStyle();
boolean cellNeedsStartTag = true;
if (object instanceof String) {
String value = (String)object;
if (value.startsWith("<" + cellTag)) {
cellNeedsStartTag = false;
}
}
if (cellNeedsStartTag){
startTag(cellTag, cellStyle, false);
}
if (object != null) {
content.append(object.toString());
}
endTag(cellTag);
}
private void startTag(String tag, String style, boolean eol) {
content.append("<");
content.append(tag);
if (style != null) {
content.append(" style=\"");
content.append(style);
content.append("\"");
}
content.append(">");
if (eol) {
endLine();
}
}
private void endTag(String tag) {
content.append("</");
content.append(tag);
content.append(">");
endLine();
}
private void endLine() {
content.append(String.format("%n"));
}
@Override
public void flush() {
if (0 < rowIndex) {
endTag("tr");
}
if ((rowIndex == 1) && headers.exist()) {
endTag("thead");
}
else {
endTag("tbody");
}
endTag("table");
variable.setValue(content.toString());
}
@Override
public void close() {}
// Never called.
@Override public Object readColumn(int columnIndex) { return null; }
@Override public boolean hasRow() { return false; }
}
|
[
"rdesantis@cmtnyc.com"
] |
rdesantis@cmtnyc.com
|
c2511cf461d6ef0264c4332579a7f37f7875dd22
|
dc2561fe1980eb1e432a0b36ad6ef54d42ff8487
|
/serialcomm/src/main/java/com/lexiang/library/queue/DataQueue.java
|
30d9dc308f1063508e1260c615de5e67d864858a
|
[
"MIT"
] |
permissive
|
lemoclone/SerialPortComm
|
b861ec950c0189c581aa62af80979725fef113f8
|
f6604918a2919c9784bccd8b3b22317ded189657
|
refs/heads/master
| 2023-01-06T02:48:46.139294
| 2022-12-29T08:16:53
| 2022-12-29T08:16:53
| 106,533,573
| 6
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 918
|
java
|
package com.lexiang.library.queue;
import java.util.concurrent.PriorityBlockingQueue;
class DataQueue {
private String mTag = "";
private final PriorityBlockingQueue<SerialPortData<?>> mSignalRequestQueue = new PriorityBlockingQueue<>();
private Dispatcher mDispatcher;
private DataHandler mMessageHandler;
DataQueue(DataHandler messageHandler, String tag) {
mMessageHandler = messageHandler;
mTag = tag;
}
public void start() {
stop();
mDispatcher = new Dispatcher(mSignalRequestQueue, mMessageHandler,mTag);
mDispatcher.start();
}
public void stop() {
if (mDispatcher != null) {
mDispatcher.quit();
}
}
public <T> SerialPortData<T> add(SerialPortData<T> request) {
synchronized (mSignalRequestQueue) {
mSignalRequestQueue.add(request);
}
return request;
}
}
|
[
"kossqwas@gmail.com"
] |
kossqwas@gmail.com
|
ac80ba6df10fabdc276d200c2a5bdc2e5dab4d24
|
94e964e62c444c263529976bae2346f875b1c613
|
/src/main/java/com/lotus/java8Learn/lambda/MethodInvoke.java
|
2ae019f2fd74dccf8fb1e5693f008a779a0c4694
|
[] |
no_license
|
7colorlotus/java8Learn
|
77d49168a17541543eaa58496761379fb907503e
|
d4fe7188ee5dda22540475f21bcb01b7e8644e92
|
refs/heads/master
| 2021-10-11T10:11:26.358229
| 2019-01-24T14:58:24
| 2019-01-24T14:58:24
| 110,489,962
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,643
|
java
|
package com.lotus.java8Learn.lambda;
import com.lotus.java8Learn.entity.Apple;
import com.lotus.java8Learn.entity.Person;
import java.time.LocalDate;
import java.time.LocalTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.function.*;
/**
* 方法引用的形式
* 引用静态方法 ContainingClass::staticMethodName
* 引用某个对象的实例方法(containingObject是Lambda中调用一个已经存在的外部对象中的方法) containingObject::instanceMethodName
* 引用某个类型的任意对象的实例方法(containingObject是lambda表达式的参数) ContainingType::methodName
* 引用构造方法 ClassName::new
* <p>
* Created by zhusheng on 2017/11/14 0014.
*/
public class MethodInvoke {
public static void main(String[] args) {
//引用静态方法
Person p1 = new Person("张三", LocalDate.now(), Person.Sex.MALE, "zhangsan@126.com");
Person p2 = new Person("李四", LocalDate.now(), Person.Sex.MALE, "lisi@126.com");
Person p3 = new Person("王五", LocalDate.now(), Person.Sex.MALE, "wangwu@126.com");
List<Person> personList = Arrays.asList(p1, p2, p3);
personList.sort(Person::compareByAge);
System.out.println(personList);
//引用某个对象的实例方法
new Thread(p1::print).start();
//引用某个类型的任意对象的实例方法
String[] strings = {"123", "ssaa", "sss", "aaa"};
Arrays.sort(strings, String::compareToIgnoreCase);
List strList = Arrays.asList(strings);
System.out.println(strList);
//引用构造方法
//无构造参数
Supplier<Apple> appleSupplier = Apple :: new;
Apple apple = appleSupplier.get();
System.out.println(apple);
//一个构造参数
Function<Integer,Apple> appleIntegerFunction = Apple :: new;
Apple apple1 = appleIntegerFunction.apply(10);
System.out.println(apple1);
List<Integer> weights = Arrays.asList(7, 3, 4, 10);
List<Apple> apples = map(weights, Apple::new);
System.out.println(apples);
//两个构造参数
BiFunction<String, Integer, Apple> c3 = Apple::new;
Apple apple3 = c3.apply("green", 110);
System.out.println(apple3);
}
public static List<Apple> map(List<Integer> list,
Function<Integer, Apple> f){
List<Apple> result = new ArrayList<>();
for(Integer e: list){
result.add(f.apply(e));
}
return result;
}
}
|
[
"zhusheng@ekeyfund.com"
] |
zhusheng@ekeyfund.com
|
b6b32ae8888d95881a15d194b226fb36daf86eca
|
c8a4b3a4508126e8a4235e27e93ef10e6fbd2fd8
|
/src/main/java/com/day6/inteface/FigureInte2.java
|
14dca44b645b8bd240afe9996361a98c115389b7
|
[] |
no_license
|
fengshaokun/FengUtils
|
5b548eb324d72a76eb9afa418a43a69b992287ba
|
58ee13740c0db0753532eb9b8b46c5f4ddf577a8
|
refs/heads/main
| 2023-06-02T17:08:08.027537
| 2021-06-22T08:45:45
| 2021-06-22T08:45:45
| 370,885,474
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 102
|
java
|
package com.day6.inteface;
public interface FigureInte2 {
double getArea1();
double getPer1();
}
|
[
"843234378@qq.com"
] |
843234378@qq.com
|
f035a76b5d756e96e0e3d8e7d53498a7a24a09eb
|
5b7cd7228a371c40f7a536307f6dbe079c3b13e6
|
/src/main/java/com/wilb0t/aoc/Day16.java
|
59e89a530b69dc2b974a9173d7dd7a16c12d8d10
|
[] |
no_license
|
reidwilbur/aoc2016-java
|
119739ce88556c4b6a7d6658e4b91adfaab2bb80
|
f8fb97f71148925c869b77bac6b517255d575098
|
refs/heads/master
| 2021-01-12T08:28:26.853736
| 2016-12-19T01:16:23
| 2016-12-19T01:16:23
| 76,589,319
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,178
|
java
|
package com.wilb0t.aoc;
public class Day16 {
public static String genBits(String initBits, int bitsLen) {
StringBuilder data = new StringBuilder(bitsLen);
data.append(initBits);
while (data.length() < bitsLen) {
int curLen = data.length();
data.append('0');
for (int idx = curLen - 1; (idx >= 0) && (data.length() < bitsLen); idx--) {
data.append((data.charAt(idx) == '1') ? '0' : '1');
}
}
return data.toString();
}
public static String genCheckSum(String bits) {
int csize = 2;
while ((bits.length() / csize) % 2 == 0) {
csize *= 2;
}
StringBuilder cksum = new StringBuilder();
int chunks = bits.length() / csize;
for (int chunk = 0; chunk < chunks; chunk++) {
int onecnt = 0;
for (int idx = (chunk*csize); idx < ((chunk+1)*csize); idx++) {
if (bits.charAt(idx) == '1') {
onecnt += 1;
}
}
cksum.append((onecnt % 2 == 0) ? '1' : '0');
}
return cksum.toString();
}
public static String genBitsAndCheckSum(String initBits, int dataLen) {
String data = genBits(initBits, dataLen);
return genCheckSum(data);
}
}
|
[
"reid.wilbur@gmail.com"
] |
reid.wilbur@gmail.com
|
c13c183fa63bfed56baa526ecf08c85cc5bf9d30
|
09da1a8438dfb7fb7b0509b6d49a9e789a02d300
|
/src/main/java/com/dai/jigsaw/core/feature/orm/dialect/MySql5PageHepler.java
|
6caa5f7d9e5a11f47aab5c97749d57bd72407b04
|
[] |
no_license
|
lengyuedaidai/jigsaw
|
c463ae316f3391c862a2f80c31af1a90bc40d9f7
|
d8e4abbb43872dd0ecb8e52813b56c3e2d68ae19
|
refs/heads/master
| 2021-01-13T16:30:08.366015
| 2018-10-18T01:50:02
| 2018-10-18T01:50:02
| 79,558,127
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,915
|
java
|
package com.dai.jigsaw.core.feature.orm.dialect;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* @author StarZou
* @since 2014年5月18日 下午1:33:01
**/
public class MySql5PageHepler {
/**
* 得到查询总数的sql
*/
public static String getCountString(String querySelect) {
querySelect = getLineSql(querySelect);
int orderIndex = getLastOrderInsertPoint(querySelect);
int formIndex = getAfterFormInsertPoint(querySelect);
String select = querySelect.substring(0, formIndex);
// 如果SELECT 中包含 DISTINCT 只能在外层包含COUNT
if (select.toLowerCase().indexOf("select distinct") != -1 || querySelect.toLowerCase().indexOf("group by") != -1) {
return new StringBuffer(querySelect.length()).append("select count(1) count from (").append(querySelect.substring(0, orderIndex)).append(" ) t").toString();
} else {
return new StringBuffer(querySelect.length()).append("select count(1) count ").append(querySelect.substring(formIndex, orderIndex)).toString();
}
}
/**
* 得到最后一个Order By的插入点位置
*
* @return 返回最后一个Order By插入点的位置
*/
private static int getLastOrderInsertPoint(String querySelect) {
int orderIndex = querySelect.toLowerCase().lastIndexOf("order by");
if (orderIndex == -1) {
orderIndex = querySelect.length();
}
if (!isBracketCanPartnership(querySelect.substring(orderIndex, querySelect.length()))) {
throw new RuntimeException("My SQL 分页必须要有Order by 语句!");
}
return orderIndex;
}
/**
* 得到分页的SQL
*
* @param offset
* 偏移量
* @param limit
* 位置
* @return 分页SQL
*/
public static String getLimitString(String querySelect, int offset, int limit) {
querySelect = getLineSql(querySelect);
String sql = querySelect + " limit " + offset + " ," + limit;
return sql;
}
/**
* 将SQL语句变成一条语句,并且每个单词的间隔都是1个空格
*
* @param sql
* SQL语句
* @return 如果sql是NULL返回空,否则返回转化后的SQL
*/
private static String getLineSql(String sql) {
return sql.replaceAll("[\r\n]", " ").replaceAll("\\s{2,}", " ");
}
/**
* 得到SQL第一个正确的FROM的的插入点
*/
private static int getAfterFormInsertPoint(String querySelect) {
String regex = "\\s+FROM\\s+";
Pattern pattern = Pattern.compile(regex, Pattern.CASE_INSENSITIVE);
Matcher matcher = pattern.matcher(querySelect);
while (matcher.find()) {
int fromStartIndex = matcher.start(0);
String text = querySelect.substring(0, fromStartIndex);
if (isBracketCanPartnership(text)) {
return fromStartIndex;
}
}
return 0;
}
/**
* 判断括号"()"是否匹配,并不会判断排列顺序是否正确
*
* @param text
* 要判断的文本
* @return 如果匹配返回TRUE,否则返回FALSE
*/
private static boolean isBracketCanPartnership(String text) {
if (text == null || (getIndexOfCount(text, '(') != getIndexOfCount(text, ')'))) {
return false;
}
return true;
}
/**
* 得到一个字符在另一个字符串中出现的次数
*
* @param text
* 文本
* @param ch
* 字符
*/
private static int getIndexOfCount(String text, char ch) {
int count = 0;
for (int i = 0; i < text.length(); i++) {
count = (text.charAt(i) == ch) ? count + 1 : count;
}
return count;
}
}
|
[
"418088181@qq.com"
] |
418088181@qq.com
|
d269110089744b7a994c1ac68d2b063538a5d386
|
3b6c8bb4a61bf4349c62494c82897ea44d1a0fd6
|
/src/main/java/student/TestGroup.java
|
a96c57acbeafea6411491cb700555cc878040a20
|
[] |
no_license
|
Andrey72/OOP_HomeWork
|
0b9802edf9484a73478e5a115770ddf05cb1e28d
|
98cafb5ffe8143ec0e67def0e7c1f00c5600d9eb
|
refs/heads/master
| 2021-01-21T11:49:05.676013
| 2017-05-27T05:33:20
| 2017-05-27T05:33:20
| 91,755,161
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,277
|
java
|
package main.java.student;
/**
* Created by Sherlock on 19.05.2017.
*/
public class TestGroup {
public static void main(String[] args) {
Student student1 = new Student("Watsgen", "Muzich", 29);
Student student2 = new Student("Max", "Muzi", 29);
Student student3 = new Student("Wac", "Muzichenko", 29);
Student student4 = new Student("Ma5", "Muzichenko", 27);
Student student7 = new Student("Andrey", "Kor", 27);
Group group = new Group(20, 3);
group.showStudents();
group.addStudent(student1);
group.addStudent(student2);
group.addStudent(student3);
group.addStudent(student4);
group.addStudent(student7);
group.addStudent(student4);
group.showStudents();
// Arrays.sort(students);
//group.showStudents();
System.out.println("***********************");
/* // group.removeStudent(0);
group.showStudents();
System.out.println("***********************");
group.updateStudent(student1, 2);
group.showStudents();
System.out.println("***********************");
group.sortByName();
group.showStudents();
System.out.println("*********************");
*/
}
}
|
[
"vadsan27200@gmail.com"
] |
vadsan27200@gmail.com
|
25fbbb512442a8859fe7663bd67c107fabe7bb6a
|
dd24dee28a73fc56d09eb34e8517cffc8357b31b
|
/app/src/main/java/cn/ittiger/video/activity/BaseActivity.java
|
2d0c00fbdf52f0458e656eace6b947c7ac744e4b
|
[
"Apache-2.0"
] |
permissive
|
qingjiaowolwh/TigerVideo
|
14b10b8735ec279a89e8dfb0af5912185586a9d9
|
d9e3e22576b77862a877eec75d16ba7a064f8098
|
refs/heads/master
| 2021-01-10T23:45:09.366858
| 2016-10-09T07:57:57
| 2016-10-09T07:57:57
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,783
|
java
|
package cn.ittiger.video.activity;
import cn.ittiger.video.R;
import cn.ittiger.video.util.PageLoadingHelper;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
public abstract class BaseActivity extends AppCompatActivity {
protected PageLoadingHelper mPageLoadingHelper;
protected Toolbar mToolbar;
protected Context mContext;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mContext = this;
ViewGroup view = (ViewGroup) LayoutInflater.from(this).inflate(R.layout.base_activity_layout, null);
mToolbar = (Toolbar) view.findViewById(R.id.toolbar);
view.addView(getContentView(savedInstanceState), 2);
setContentView(view);
setSupportActionBar(mToolbar);
if(isNavigationButtonEnable()) {
mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(isNavigationButtonEnable()) {
onBackPressed();
}
}
});
} else {
getSupportActionBar().setHomeButtonEnabled(false);
getSupportActionBar().setDisplayHomeAsUpEnabled(false);
}
mPageLoadingHelper = new PageLoadingHelper(view);
mPageLoadingHelper.setOnLoadingClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
clickToRefresh();
}
});
if(isInitRefreshEnable()) {
clickToRefresh();
}
}
public boolean isNavigationButtonEnable() {
return true;
}
public boolean isInitRefreshEnable() {
return true;
}
/**
* Fragment数据视图
* @param savedInstanceState
* @return
*/
public abstract View getContentView(@Nullable Bundle savedInstanceState);
/**
* 点击刷新加载
*/
private void clickToRefresh() {
startRefresh();
refreshData();
}
/**
* 初始化数据
*/
public void refreshData() {
}
/**
* 开始加载数据
*/
private void startRefresh() {
mPageLoadingHelper.startRefresh();
}
/**
* 加载失败
*/
public void refreshFailed() {
mPageLoadingHelper.refreshFailed();
}
/**
* 加载成功
*/
public void refreshSuccess() {
mPageLoadingHelper.refreshSuccess();
}
}
|
[
"ylhu@bainainfo.com"
] |
ylhu@bainainfo.com
|
fd42dd29ce4955eb634f7ef5566b794666bf1b4d
|
1bb572957a6ef271e30413acde3f26114c7e1b48
|
/app/src/main/java/practica/practicalaberint/Coa.java
|
bfc7d04625b31331d2bc6243f51a737571ca2aec
|
[] |
no_license
|
Jose122333/PracticaAndroid
|
fd468b51ebfd7f868a33da250c0a71e64880dee5
|
3e5dabcbc412b9d4b28c6825c6b729a613dd7e87
|
refs/heads/master
| 2016-09-13T19:55:03.300229
| 2016-05-25T14:45:16
| 2016-05-25T14:45:16
| 56,586,970
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,503
|
java
|
package practica.practicalaberint;
/**
* Created by Ramon Mas on 13/3/16.
* Gestió d'elements amb una Coa de Nodes
* Operacions: afegeix, treu, buida, consulta, elements
*/
public class Coa {
class Node {
Object element;
Node següent;
public Node(Object o) {
element = o;
següent = null;
}
}
Node primer; // el primer element de la coa
Node darrer; // el darrer
int elements; // quants en hi ha ?
public Coa()
{
darrer = null;
elements = 0;
}
public void afegeix(Object o) // inserta un objecte dins la coa
{
Node node = new Node(o);
if (primer == null)
{
primer = node;
darrer = node;
} else
{
darrer.següent = node;
darrer = node;
}
elements++;
}
public Object treu() // extreu el primer objecte de la coa
{
if (primer == null)
return null;
Object o = primer.element;
primer = primer.següent;
elements--;
return o;
}
public boolean buida()
{
return (elements == 0);
} // coa buida ?
public int elements()
{
return elements;
} // quants elements hi ha ?
public Object consulta() // consulta el primer element però no el treu
{
if (primer == null)
return null;
else
return primer.element;
}
}
|
[
"JoseVela@MacBook-Air-de-Jose.local"
] |
JoseVela@MacBook-Air-de-Jose.local
|
cc05493166c67cdc15374f03bd849737f43446f6
|
eba898ee0ed329a825d07787939fc77bf6e58153
|
/HeightOfBinaryTree.java
|
d08b199d517d9302fa5eaf4de556acfd7529f27b
|
[] |
no_license
|
pavithraconnect/LeetcodeProblems
|
27b6eac50e985b57f18362dd5e1f046b9cf731e1
|
7eec5ec700a545e8665e57e806ae194e4354a71d
|
refs/heads/master
| 2020-06-07T07:21:58.602477
| 2019-06-27T18:16:20
| 2019-06-27T18:16:20
| 192,960,161
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 653
|
java
|
class HeightOfBinaryTree{
Node root;
public int heightOfBT(Node node){
if(node == null){
return 0;
}
else{
int lDepth = heightOfBT(node.left);
int rDepth = heightOfBT(node.right);
return Math.max(lDepth,rDepth)+1;
}
}
public static void main(String[] args) {
HeightOfBinaryTree tree = new HeightOfBinaryTree();
tree.root = new Node(1);
tree.root.left = new Node(2);
tree.root.right = new Node(3);
tree.root.left.left = new Node(4);
tree.root.left.right = new Node(5);
tree.root.left.right = new Node(5);
System.out.println("Height of tree is : " +tree.heightOfBT(tree.root));
}
}
|
[
"pavithrakanan93@gmail.com"
] |
pavithrakanan93@gmail.com
|
de7e2b35882e0419ebf19846bedda054fbb09bbd
|
22d08e27da170bdc27c86cb5ca4e332221635d35
|
/LiMS/src/main/java/hcmue/gst/off/extensions/PageableResult.java
|
b5e30c0e6f03cd2349348c54f4035590cd1630e0
|
[] |
no_license
|
thanhbinh19395/off_lims
|
e21ef15a3931caeb26356dbb2010b0a673c5a4b0
|
d04f69224c334a222a74f55044a893da652845bc
|
refs/heads/master
| 2021-01-13T12:08:40.583899
| 2017-03-31T11:45:43
| 2017-03-31T11:45:43
| 81,165,521
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,225
|
java
|
package hcmue.gst.off.extensions;
import org.springframework.data.domain.Page;
/**
* Created by Thanh Binh on 2/19/2017.
*/
public class PageableResult<T> extends Result<Iterable<T>> {
private int totalPage;
private int pageSize;
private int currentPage;
public PageableResult(Page<T> data, String message, boolean isSuccess) {
super(data.getContent(), message, isSuccess);
pageSize = data.getSize();
totalPage = data.getTotalPages();
currentPage = data.getNumber();
}
public PageableResult(Page<T> data, boolean isSuccess) {
super(data.getContent(), isSuccess);
pageSize = data.getSize();
totalPage = data.getTotalPages();
currentPage = data.getNumber();
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public int getCurrentPage() {
return currentPage;
}
public void setCurrentPage(int currentPage) {
this.currentPage = currentPage;
}
public int getTotalPage() {
return totalPage;
}
public void setTotalPage(int totalPage) {
this.totalPage = totalPage;
}
}
|
[
"binhipadair@gmail.com"
] |
binhipadair@gmail.com
|
e73fc08466abcb5f99f3b6fbcb899f9de5b7da36
|
07efa03a2f3bdaecb69c2446a01ea386c63f26df
|
/eclipse_jee/Pdf/IndiaExtracts2/com/hertz/hercutil/presentation/HercDate.java
|
45b80466ab740caf6d36203cc4e082eca4e0cf89
|
[] |
no_license
|
johnvincentio/repo-java
|
cc21e2b6e4d2bed038e2f7138bb8a269dfabeb2c
|
1824797cb4e0c52e0945248850e40e20b09effdd
|
refs/heads/master
| 2022-07-08T18:14:36.378588
| 2020-01-29T20:55:49
| 2020-01-29T20:55:49
| 84,679,095
| 0
| 0
| null | 2022-06-30T20:11:56
| 2017-03-11T20:51:46
|
Java
|
UTF-8
|
Java
| false
| false
| 6,894
|
java
|
/********************************************************************
* Copyright (c) 2006 The Hertz Corporation *
* All Rights Reserved. (Unpublished.) *
* *
* The information contained herein is confidential and *
* proprietary to The Hertz Corporation and may not be *
* duplicated, disclosed to third parties, or used for any *
* purpose not expressly authorized by it. Any unauthorized *
* use, duplication, or disclosure is prohibited by law. *
* *
*********************************************************************/
package com.hertz.hercutil.presentation;
import java.io.Serializable;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
/**
* Herc Address object
*
* @author John Vincent
*/
public class HercDate implements Serializable, Cloneable {
private Date date;
/**
* Constructor will set to current date/time
*
*/
public HercDate() {
Calendar cal = Calendar.getInstance();
date = cal.getTime();
}
/**
* Constructor sets to passed date/time
*
* @param d Date to set to
*/
public HercDate(Date d) {date = d;}
/**
* Constructor will set to date/time from RentalMan last activity date
*
* @param b Date from RentalMan table via the DAO
*/
public HercDate (BigDecimal b) {
date = null;
try {
if (b != null && b.intValue() != 0) {
date = new SimpleDateFormat("yyyyMMdd").parse(b.toString());
}
}
catch (Exception e) {
}
}
/**
* Clone the Object
*/
public Object clone() {
try {
HercDate cloned = (HercDate) super.clone();
cloned.date = (Date) date.clone();
return cloned;
}
catch (CloneNotSupportedException e) {
return null;
}
}
/**
* Check this Object for equality with another
*
* @param obj Object to check
* @return true if objects are equal
*/
public boolean equals (Object obj) {
if (this == obj) return true;
if (! (obj instanceof HercDate)) return false;
HercDate d = (HercDate) obj;
return date.equals(d.getDate());
}
/**
* Get the Date
*
* @return Date as a Date object
*/
public Date getDate() {return date;}
/**
* Set the date to Date
*
* @param date Date object
*/
public void setDate (Date date) {this.date = date;}
/**
* Get the date in MM/dd/yyyy format
*
* @return date in MM/dd/yyyy format
*/
public String getDateString() {
if (date == null) return null;
return new SimpleDateFormat("MM/dd/yyyy").format(date);
}
/**
* Get the date in yyyyMMddHHmmss format, used for LDAP
*
* @return date in yyyyMMddHHmmss format
*/
public String getDateStringForLdap() {
if (date == null) return "";
return new SimpleDateFormat("yyyyMMddHHmmss").format(date);
}
/**
* Get the date in yyyy-MM-dd HH:mm:ss format, used for DB2
*
* @return date in yyyy-MM-dd HH:mm:ss format
*/
public String getDateStringForDB2() {
if (date == null) return "";
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date);
}
/**
* Get the date in yyyy-MM-dd, used for DB2 Date columns
*
* @return date in yyyy-MM-dd format
*/
public String getSimpleDateStringForDB2() {
if (date == null) return "";
return new SimpleDateFormat("yyyy-MM-dd").format(date);
}
/**
* Get the time in h:mm a format, used for DB2
*
* @return time in h:mm a format
*/
public String getFormattedTimeString() {
return new SimpleDateFormat("h:mm a").format(date);
}
/**
* Get time in milliseconds - used to reverse sort the requests lists
*
* @return time in milliseconds
*/
public long getTime() {return date.getTime();}
/**
* Get the date in MM/dd/yyyy format, used for AdminTool History format
*
* @return date in yyyy-MM-dd HH:mm:ss format
*/
public String getHistoryDateString() {
return new SimpleDateFormat("MM/dd/yyyy").format(date);
}
/**
* Get the date in MMddyy format, used for RentalMan.
* Do not change this, or use for any other purpose
*
* @return date in MMddyy format
*/
public String getRentalManDateFormat() {
return new SimpleDateFormat("MMddyy").format(date);
}
/**
* Get the date in yyyyMMdd format, used for RentalMan.
* Do not change this, or use for any other purpose
*
* @return date in yyyyMMdd format
*/
public String getRentalManTodayDateFormat() {
return new SimpleDateFormat("yyyyMMdd").format(date);
}
/**
* Get a Date for the Date string, used only by LDAP. Note that if the Date is not set,
* the current Date will be returned.
* Example date string is 20070502174431.
*
* Do not change this, or use for any other purpose.
*
* @param dateString Date as a LDAP String
* @return String as a Date
*/
public static Date parseLDAPDate (String dateString) {
try {
if (dateString == null) return new Date();
return new SimpleDateFormat("yyyyMMddHHmmss").parse(dateString);
}
catch (ParseException e) {
return new Date();
}
}
/**
* Get a Date for the Date string. Note that if the Date is not set,
* the current Date will be returned.
* Note that the date string must be in the format MMMyyyydd, else current Date will be returned.
*
* Do not change this.
*
* @param dateString Date as a String
* @return String as a Date
*/
public static Date parseDate (String dateString) {
try {
if (dateString == null) return new Date();
return new SimpleDateFormat("MMMyyyydd").parse(dateString);
}
catch (ParseException e) {
return new Date();
}
}
/**
* Get a Date for the Date string that is formatted as format.
* Note that if the Date is not set, the current Date will be returned.
* Note that the date string must be in the format format, else current Date will be returned.
*
* Do not change this.
*
* @param dateString Date as a String
* @param format The format of DateString
* @return String as a Date
*/
public static Date parseDate (String dateString, String format) {
try {
if (dateString == null) return new Date();
return new SimpleDateFormat(format).parse(dateString);
}
catch (ParseException e) {
return new Date();
}
}
/**
* Get the date in yyyy-MM-dd HH:mm:ss format
*
* @return date in yyyy-MM-dd HH:mm:ss format
*/
public String toString() {
if (date == null) return "";
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date);
}
/**
* Determine whether the date is null
*
* @return true if the date is null
*/
public boolean isNull() {
return (date == null) ? true : false;
}
}
|
[
"john@johnvincent.io"
] |
john@johnvincent.io
|
177189e4221c82a9f69fa442391acc724591985c
|
d6fb6aec9fb70566da0e25707477b3994f211aa1
|
/src/bean/base/BaseQueryUI.java
|
e09a06cdaff5563b00c9eabccfae4a432a228752
|
[] |
no_license
|
lijiajie1991/WZZCLIENT
|
c60bb172e6b66d53298aab212db58843d895fc4c
|
2a2ca77deb4e57ac30624850c53ef0890b572f2d
|
refs/heads/master
| 2020-03-24T19:46:03.827994
| 2018-07-31T01:03:06
| 2018-07-31T01:03:06
| 142,943,999
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,517
|
java
|
package bean.base;
import java.awt.BorderLayout;
import java.awt.Rectangle;
import java.util.LinkedList;
import common.db.FilterInfo;
import common.db.FilterItemInfo;
import em.CompareType;
import myswing.container.LabelContainer;
import myswing.editor.FormatInputField;
import myswing.table.ColumnInfo;
import ui.base.QueryUI;
public class BaseQueryUI extends QueryUI{
private static final long serialVersionUID = 1L;
protected LabelContainer conNumber = null;
protected FormatInputField txtNumber = null;
protected LabelContainer conName = null;
protected FormatInputField txtName = null;
public BaseQueryUI()
{
super();
}
public void initUI(LinkedList<ColumnInfo> cols) throws Exception
{
super.initUI(cols);
txtNumber = new FormatInputField();
conNumber = new LabelContainer(txtNumber, 80, BorderLayout.WEST, true, "编号:");
conNumber.setBounds(new Rectangle(5, 5, 230, 30));
txtName = new FormatInputField();
conName = new LabelContainer(txtName, 80, BorderLayout.WEST, true, "名称:");
conName.setBounds(new Rectangle(260, 5, 230, 30));
jpFilter.add(conNumber);
jpFilter.add(conName);
}
protected void createFilterAndSort()
{
super.createFilterAndSort();
filter = new FilterInfo();
String number = txtNumber.getText();
String name = txtName.getText();
filter.addItem(new FilterItemInfo("number", CompareType.LIKE, number));
filter.addItem(new FilterItemInfo("name", CompareType.LIKE, name));
filter.setMkr("#0 and #1");
}
}
|
[
"243132347@qq.com"
] |
243132347@qq.com
|
735675b39afdacc60a6a647bc6bd7c7682989014
|
740cd98eec1923e524ee84e50b9f250fc27a15c6
|
/src/main/java/com/xxc/util/SpringContextUtil.java
|
d13f62f7ab6320da2051d42dcac7b8a4e6917345
|
[] |
no_license
|
XuXc515/battery
|
e537c6df2e5b2d5a161952b9ec644c51d931b0d4
|
121bb22c6f760bb4d2993e4c7fe4126595d8760b
|
refs/heads/master
| 2023-06-04T09:37:16.849270
| 2021-06-24T03:53:39
| 2021-06-24T03:53:39
| 379,790,582
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,307
|
java
|
package com.xxc.util;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
/**
* Spring Context 工具类
*
* @author MrBird
*/
@Component
public class SpringContextUtil implements ApplicationContextAware {
private static ApplicationContext applicationContext;
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
SpringContextUtil.applicationContext = applicationContext;
}
public static Object getBean(String name) {
return applicationContext.getBean(name);
}
public static <T> T getBean(Class<T> clazz) {
return applicationContext.getBean(clazz);
}
public static <T> T getBean(String name, Class<T> requiredType) {
return applicationContext.getBean(name, requiredType);
}
public static boolean containsBean(String name) {
return applicationContext.containsBean(name);
}
public static boolean isSingleton(String name) {
return applicationContext.isSingleton(name);
}
public static Class<?> getType(String name) {
return applicationContext.getType(name);
}
}
|
[
"moretz210@163.com"
] |
moretz210@163.com
|
013cdcfdd07dda2e7e6bc8671f9ca91d5ef12d73
|
b8db0afd7a8c6ea1eed48ed4dd1ab776d7bb011f
|
/src/taxi_DAO/Vehicule_taxi_DAO.java
|
d799898be87f8101197119703f5f91e1e8b6f22e
|
[] |
no_license
|
frankkamgo/projet_final
|
d9cd9272bad953a4b5d156bdbfc20888ceb998e0
|
88c1dbb3cc1ed0629a9a9bad8e3bceecbffa5b12
|
refs/heads/master
| 2020-05-17T00:47:10.764660
| 2019-05-21T13:16:40
| 2019-05-21T13:16:40
| 183,406,850
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 8,883
|
java
|
package taxi_DAO;
/**
* classe de mappage poo-relationnel Vehicule_taxi
*
* @author frank kamgo
* @version 1.0
* @see Vehicule_taxi
*/
import java.sql.*;
import java.time.LocalDate;
import java.util.*;
import taxi.metier.Client_taxi;
import taxi.metier.Vehicule_taxi;
public class Vehicule_taxi_DAO extends DAO<Vehicule_taxi> {
public static Vehicule_taxi creation(Vehicule_taxi taxi) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
public static List<Vehicule_taxi> rechdescription(String desRech) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
/**
* création d'un vehicule_taxi sur base des valeurs de son objet métier
*
* @throws SQLException erreur de création
* @param obj client_taxi à créer
* @return vehicule_taxi créé
*/
@Override
public Vehicule_taxi create(Vehicule_taxi obj) throws SQLException {
String req1 = "insert into api_taxi(immatriculation,carburant,prixkm,description) values(?,?,?,?)";
String req2 = "select idtaxi from api_taxi where immatriculation=? and carburant=? and prixkm=?";
try (PreparedStatement pstm1 = dbConnect.prepareStatement(req1);
PreparedStatement pstm2 = dbConnect.prepareStatement(req2)) {
pstm1.setString(1, obj.getImmatriculation());
pstm1.setString(2, obj.getCarburant());
pstm1.setInt(3, obj.getPrixkm());
pstm1.setString(4, obj.getDescription());
int n = pstm1.executeUpdate();
if (n == 0) {
throw new SQLException("erreur de creation du taxi, aucune ligne créée");
}
pstm2.setString(1, obj.getImmatriculation());
pstm2.setString(2, obj.getCarburant());
pstm2.setInt(3, obj.getPrixkm());
try (ResultSet rs = pstm2.executeQuery()) {
if (rs.next()) {
int idtaxi = rs.getInt(1);
obj.setIdtaxi(idtaxi);
return read(idtaxi);
} else {
throw new SQLException("erreur de création taxi, record introuvable");
}
}
}
}
/**
* récupération des données d'un vehicule_taxi sur base de son identifiant
*
* @throws SQLException code inconnu
* @param idtaxi identifiant du client_taxi
* @return client_taxi trouvé
*/
@Override
public Vehicule_taxi read(int idtaxi) throws SQLException {
String req = "select * from api_taxi where idtaxi = ?";
try (PreparedStatement pstm = dbConnect.prepareStatement(req)) {
pstm.setInt(1, idtaxi);
try (ResultSet rs = pstm.executeQuery()) {
if (rs.next()) {
String immatriculation = rs.getString("immatriculation");
String carburant = rs.getString("carburant");
int prixkm = rs.getInt("prixkm");
String description = rs.getString("description");
return new Vehicule_taxi(idtaxi, immatriculation, carburant, prixkm, description);
} else {
throw new SQLException("Code inconnu");
}
}
}
}
public Vehicule_taxi readImmatriculation(String immatriculation) throws SQLException {
String req = "select * from api_taxi where immatriculation = ?";
try (PreparedStatement pstm = dbConnect.prepareStatement(req)) {
pstm.setString(1, immatriculation);
try (ResultSet rs = pstm.executeQuery()) {
if (rs.next()) {
int idtaxi = rs.getInt("idtaxi");
String carburant = rs.getString("carburant");
int prixkm = rs.getInt("prixkm");
String description = rs.getString("description");
return new Vehicule_taxi(idtaxi, immatriculation, carburant, prixkm, description);
} else {
throw new SQLException("Code inconnu");
}
}
}
}
/**
* mise à jour des données du taxi sur base de son identifiant
*
* @return Client_taxi
* @param obj Vehicule_taxi à mettre à jour
* @throws SQLException erreur de mise à jour
*/
@Override
public Vehicule_taxi update(Vehicule_taxi obj) throws SQLException {
String req = "update api_taxi set immatriculation=?,carburant=?,prixkm=?,description=? where idtaxi= ?";
try (PreparedStatement pstm = dbConnect.prepareStatement(req)) {
pstm.setInt(5, obj.getIdtaxi());
pstm.setString(1, obj.getImmatriculation());
pstm.setString(2, obj.getCarburant());
pstm.setInt(3, obj.getPrixkm());
pstm.setString(4, obj.getDescription());
int n = pstm.executeUpdate();
if (n == 0) {
throw new SQLException("aucune ligne vehicule_taxi mise à jour");
}
return read(obj.getIdtaxi());
}
}
/**
* effacement du Vehicule_taxi sur base de son identifiant
*
* @throws SQLException erreur d'effacement
* @param obj Vehicule_taxi à effacer
*/
@Override
public void delete(Vehicule_taxi obj) throws SQLException {
String req = "delete from api_taxi where immatriculation=?";
try (PreparedStatement pstm = dbConnect.prepareStatement(req)) {
pstm.setString(1, obj.getImmatriculation());
int n = pstm.executeUpdate();
if (n == 0) {
throw new SQLException("aucune ligne vehicule_taxi effacée");
}
else{
System.out.println("le taxi a bien été suprimé");
}
}
}
/**
* méthode permettant de récupérer tous les Vehicule_taxi portant un certain
description
*
* @param descrech description recherché
* @return liste du vehicule_taxi
* @throws SQLException nom inconnu
*/
public List<Vehicule_taxi> rechdescption(String descrech) throws SQLException {
List<Vehicule_taxi> plusieurs = new ArrayList<>();
String req = "select * from api_taxi where description like ?";
try (PreparedStatement pstm = dbConnect.prepareStatement(req)) {
pstm.setString(1, "%" + descrech + "%");
try (ResultSet rs = pstm.executeQuery()) {
boolean trouve = false;
while (rs.next()) {
trouve = true;
int idtaxi = rs.getInt("idtaxi");
String immatriculation = rs.getString("immatriculation");
String carburant = rs.getString("carburant");
int prixkm = rs.getInt("prixkm");
String description = rs.getString("description");
plusieurs.add(new Vehicule_taxi(idtaxi, immatriculation, carburant, prixkm, description));
}
if (!trouve) {
throw new SQLException(" description inexistante");
} else {
return plusieurs;
}
}
}
}
public List<Vehicule_taxi> rechimmatriculation(String immrech) throws SQLException {
List<Vehicule_taxi> plusieurs = new ArrayList<>();
String req = "select * from api_taxi where immatriculation like ?";
try (PreparedStatement pstm = dbConnect.prepareStatement(req)) {
pstm.setString(1, "%" + immrech + "%");
try (ResultSet rs = pstm.executeQuery()) {
boolean trouve = false;
while (rs.next()) {
trouve = true;
int idtaxi = rs.getInt("idtaxi");
String immatriculation = rs.getString("immatriculation");
String carburant = rs.getString("carburant");
int prixkm = rs.getInt("prixkm");
String description = rs.getString("description");
plusieurs.add(new Vehicule_taxi(idtaxi, immatriculation, carburant, prixkm, description));
}
if (!trouve) {
throw new SQLException(" immatriculation inexistante");
} else {
return plusieurs;
}
}
}
}
}
|
[
"tkamgo84@gmail.com"
] |
tkamgo84@gmail.com
|
72ff50ebb349902fc336c4831f22adeb14c0dd85
|
a63fa9f887d25021ed566504bf08789bafceef99
|
/src/main/java/es/uvigo/ei/sing/singulator/generator/java/JavaModelGenerator.java
|
29f6c2546391f7fdca1fe26ff94b17736fb9b54d
|
[] |
no_license
|
gaeperez/bam
|
f6f82e8e78a0c2f0f823745bae95ffdb1dc5fffa
|
ed40a56205cc624697f9abf7375e784d680318e3
|
refs/heads/master
| 2022-12-21T01:42:15.487311
| 2020-09-24T12:49:37
| 2020-09-24T12:49:37
| 298,276,780
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,792
|
java
|
package es.uvigo.ei.sing.singulator.generator.java;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.util.ArrayList;
import java.util.List;
import es.uvigo.ei.sing.singulator.generator.ModelGenerator;
import es.uvigo.ei.sing.singulator.model.JsonSingulator;
abstract class JavaModelGenerator implements ModelGenerator {
protected Path outputDir;
protected String packageName;
protected JsonSingulator singulator;
protected JavaModelGenerator() {
}
@Override
public void generateModel(final JsonSingulator jsonSingulator, final Path outputDir, final String packageName) {
this.outputDir = createDirs(outputDir.toString(), packageName);
this.packageName = packageName;
this.singulator = jsonSingulator;
generateGeneral();
generateCommon();
generateCells();
generateAgents();
generateTransporters();
generateFeeders();
generateEvents();
}
protected void writeToFile(final List<String> lines, final Path output) {
try {
Files.write(output, lines, Charset.defaultCharset());
} catch (IOException e) {
e.printStackTrace();
}
}
protected void copyFile(final InputStream in, final Path target) {
try {
Files.copy(in, target, StandardCopyOption.REPLACE_EXISTING);
} catch (IOException e) {
e.printStackTrace();
}
}
protected Path createDirs(final String outputDir, final String packageName) {
String output = outputDir + "/java/" + getModelMode();
final String[] dirs = packageName.split("\\.");
for (String dir : dirs) {
output += "/" + dir;
}
final List<String> create = new ArrayList<>();
create.add(output + "/agents/molecules/buildingblocks");
create.add(output + "/agents/molecules/lzws");
create.add(output + "/agents/molecules/macromolecules");
create.add(output + "/agents/ribosomes");
create.add(output + "/cells");
create.add(output + "/common");
create.add(output + "/events");
create.add(output + "/feeders");
create.add(output + "/general");
create.add(output + "/transporters");
create.add(output + "/containers");
create.forEach(d -> new File(d).mkdirs());
return Paths.get(output);
}
protected void generateAgents() {
generateMolecules();
generateRibosomes();
}
protected abstract String getModelMode();
protected abstract void generateGeneral();
protected abstract void generateCells();
protected abstract void generateCommon();
protected abstract void generateRibosomes();
protected abstract void generateMolecules();
protected abstract void generateTransporters();
protected abstract void generateFeeders();
protected abstract void generateEvents();
}
|
[
"gael.pr91@gmail.com"
] |
gael.pr91@gmail.com
|
5908ea09a9a6b951193e76cc501080a05c3ab37f
|
f89a5fce7dd5cd5702e3b4c09c2aa8dd3c0b84d1
|
/src/cn/com/goldfinance/domain/wkxf/AccTransdetail.java
|
a48339ee890e7fe27682a1ab385b836def64e59f
|
[] |
no_license
|
care001/cswechat
|
5726a2b37163d12946adeed87d708aff43836bb2
|
1c32098a42a5f7cd1c23392147c24a49cfe9b8d5
|
refs/heads/master
| 2021-01-12T23:34:27.342803
| 2017-01-16T01:21:25
| 2017-01-16T01:21:25
| 60,591,491
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,877
|
java
|
package cn.com.goldfinance.domain.wkxf;
/**
*
* @author liuhui
* 交易流水
*/
public class AccTransdetail {
private String cardId;
private String empId;
//使用扇区号
private String secId;
//交易日期
private String acctransday;
/**
* 交易类型,10自动充值,11手工充值,12转帐收入,20消费,21退款支出,22销户支出,23转帐支出,24补帐消费
*/
private String acctranstype;
//充值金额
private String imoneyvalue;
//消费金额
private String omoneyvalue;
//卡片使用次数
private String cardusenum;
//卡余额
private String cardmoneyvalue;
//类型
private String type;
private String amount;
private String devId;
private String detail;
private String status;
private String remark;
private String oprtid;
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getDetail() {
return detail;
}
public void setDetail(String detail) {
this.detail = detail;
}
public String getDevId() {
return devId;
}
public void setDevId(String devId) {
this.devId = devId;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getAmount() {
return amount;
}
public void setAmount(String amount) {
this.amount = amount;
}
public String getCardId() {
return cardId;
}
public void setCardId(String cardId) {
this.cardId = cardId;
}
public String getEmpId() {
return empId;
}
public void setEmpId(String empId) {
this.empId = empId;
}
public String getSecId() {
return secId;
}
public void setSecId(String secId) {
this.secId = secId;
}
public String getAcctransday() {
return acctransday;
}
public void setAcctransday(String acctransday) {
this.acctransday = acctransday;
}
public String getAcctranstype() {
return acctranstype;
}
public void setAcctranstype(String acctranstype) {
this.acctranstype = acctranstype;
}
public String getImoneyvalue() {
return imoneyvalue;
}
public void setImoneyvalue(String imoneyvalue) {
this.imoneyvalue = imoneyvalue;
}
public String getOmoneyvalue() {
return omoneyvalue;
}
public void setOmoneyvalue(String omoneyvalue) {
this.omoneyvalue = omoneyvalue;
}
public String getCardusenum() {
return cardusenum;
}
public void setCardusenum(String cardusenum) {
this.cardusenum = cardusenum;
}
public String getCardmoneyvalue() {
return cardmoneyvalue;
}
public void setCardmoneyvalue(String cardmoneyvalue) {
this.cardmoneyvalue = cardmoneyvalue;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public String getOprtid() {
return oprtid;
}
public void setOprtid(String oprtid) {
this.oprtid = oprtid;
}
}
|
[
"13757629272@163.com"
] |
13757629272@163.com
|
b4ec960d6a30711bfde7dd13fd9e9a2ee0330d8d
|
e4987b38c1e6bda736e2a1f30e385f756ec25731
|
/src/datastructure/UserMap.java
|
1fa73e9446ffad82213cec41c0c159c10fa6266b
|
[] |
no_license
|
tanvirahmmed/project6
|
304be44ba408db4a4424cb7d86ec2de8c14b7ad8
|
bdc953586954c8f55c03c5c005f01d84e5b68c57
|
refs/heads/master
| 2020-12-24T06:50:26.770172
| 2016-08-06T16:29:38
| 2016-08-06T16:29:38
| 64,599,333
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 719
|
java
|
package datastructure;
import com.sun.javafx.collections.MappingChange;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* Created by rinko on 8/6/2016.
*/
public class UserMap {
public static void main(String[] args) {
Map<String, String> map = new LinkedHashMap<String, String>();
map.put("Bangladesh","Dhaka");
map.put("India","Kolkata");
map.put("UK","Londo");
map.put("Canada","Ontario");
map.put("Japan","Tokeyo");
//map.put("Japan","Toke2yo");
for(Map.Entry<String, String> entry:map.entrySet())
{
System.out.println(entry.getKey()+" : "+ entry.getValue());
}
}
}
|
[
"rinko.ewu@gmail.com"
] |
rinko.ewu@gmail.com
|
55cd411390430dfe2386ed5bafbecaeaaa839a8e
|
e96f371b86efb986217fa5d54feca59587425a32
|
/SpringVersion5/src/main/java/com/myproject/spring5/mvc/exceptions/BusinessException.java
|
048427e3eb478f154966e1b3746c77932e58650e
|
[] |
no_license
|
rmsdud2435/Spring5-Study
|
57f4885bf7ce6473bdfdae9c9bcc34074c5b1af5
|
61748561af02227e512c9af1d9834ab842cdf4ed
|
refs/heads/master
| 2022-12-11T17:07:27.570197
| 2019-07-09T09:25:03
| 2019-07-09T09:25:03
| 184,674,974
| 0
| 0
| null | 2022-12-06T00:40:13
| 2019-05-03T00:08:27
|
Java
|
UTF-8
|
Java
| false
| false
| 129
|
java
|
package com.myproject.spring5.mvc.exceptions;
@SuppressWarnings("serial")
public class BusinessException extends Exception {
}
|
[
"rmsdud2435@gamil.com"
] |
rmsdud2435@gamil.com
|
efb1e5e51b4844632bc9974d36c8694f07a47323
|
f9bf34cb70e514cf3e715118f34a05c8e6cf4e4b
|
/src/main/java/monitordata/controller/NetController.java
|
5347fa96e4c5d34ae8de317e1bdf20545bf46383
|
[] |
no_license
|
qh870754310/monitor_data
|
4471ccdbbfe3eef709d3aead2438b1126fefcebd
|
3786d6b7f5a11b31a7cb9a1e2bc80ea28657b2e6
|
refs/heads/master
| 2020-04-28T15:51:51.486907
| 2019-03-13T09:45:47
| 2019-03-13T09:45:47
| 175,391,537
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 38,749
|
java
|
package monitordata.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import monitordata.util.HttpClientHelper;
import monitordata.util.ResponseHelper;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.conn.scheme.PlainSocketFactory;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.conn.ssl.SSLSocketFactory;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.conn.BasicClientConnectionManager;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URI;
import java.net.URLEncoder;
import java.security.cert.CertificateException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by Administrator on 2018/1/30.
*/
@Controller
@RequestMapping("/net")
public class NetController {
private static int port = 32102;
private static String userName = "base_user";
private static String pwd = "Change_4si";
private static String ip = "10.1.2.243";
private static String charset = "utf-8";
private HttpClientHelper httpClientHelper = new HttpClientHelper();
@RequestMapping(value = "/test1")
public void test1(HttpServletResponse response) {
JSONObject jsonObject = new JSONObject();
//set the URL
String openidURL = "/rest/openapi/sm/session";
//set parameters
List<BasicNameValuePair> parameters = new ArrayList<BasicNameValuePair>();
parameters.add(new BasicNameValuePair("userid", userName));
parameters.add(new BasicNameValuePair("value", pwd));
parameters.add(new BasicNameValuePair("ipaddr", "10.1.2.243"));
//create a connection manager
X509TrustManager tm = new X509TrustManager() {
@Override
public void checkClientTrusted(java.security.cert.X509Certificate[] x509Certificates, String s) throws CertificateException {
}
@Override
public void checkServerTrusted(java.security.cert.X509Certificate[] x509Certificates, String s) throws CertificateException {
}
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return null;
}
};
//create a SSL connection
SSLContext sslcontext = null;
try {
sslcontext = SSLContext.getInstance("TLS");
sslcontext.init(null, new TrustManager[] { tm }, null);
SSLSocketFactory socketFactory = new SSLSocketFactory(sslcontext, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
SchemeRegistry schemeRegistry = new SchemeRegistry();
schemeRegistry.register(new Scheme("https", port, socketFactory));
schemeRegistry.register(new Scheme("http", 80, PlainSocketFactory.getSocketFactory()));//http 80 端口
schemeRegistry.register(new Scheme("https", 443, socketFactory));//https 443端口
//create a HttpClient to connect to the target host
HttpClient httpClient = new DefaultHttpClient(new BasicClientConnectionManager(schemeRegistry));
//set the URL
String url = "https://" + ip + ":" + port + openidURL;
//set the method
HttpPut httpPut = new HttpPut(url);
httpPut.setEntity(new UrlEncodedFormEntity(parameters, "UTF-8"));
//send the request
HttpResponse httpResponse = httpClient.execute(httpPut);
/* String result = EntityUtils.toString(httpResponse.getEntity(), Charset.forName("utf-8"));*/
Map<String, String> retMap = parseResponse(getResult(httpResponse));
String openID = "";
if (retMap.get("code").equals("0")) {
openID = retMap.get("data");
}
System.out.println(openID);
jsonObject.put("result", openID);
} catch (Exception e) {
e.printStackTrace();
}
ResponseHelper.write(response, jsonObject);
}
/**
* 查询服务器设备列表
*
* @param response HttpServletResponse对象
*/
@RequestMapping(value = "/device/list")
public void getDeviceList(HttpServletResponse response, String servertype) {
JSONObject jsonObject = new JSONObject();
try {
final String openID = getOpenID();
if (null == openID || openID.isEmpty()) {
System.out.println("failed to login.");
return;
}
final String result = queryDeviceList(openID, servertype);
System.out.println(result);
jsonObject.put("result",result);
jsonObject.put("state", true);
} catch (Exception e) {
e.printStackTrace();
jsonObject.put("state", false);
}
ResponseHelper.write(response, jsonObject);
}
/**
* 查询指定服务器的部件详细信息
*
* @param response HttpServletResponse对象
* @param dn
*/
@RequestMapping(value = "/device/detail")
public void getDeviceDetail(HttpServletResponse response, String dn) {
JSONObject jsonObject = new JSONObject();
try {
final String openID = getOpenID();
if (null == openID || openID.isEmpty()) {
System.out.println("failed to login.");
return;
}
System.out.println(openID);
if(StringUtils.isEmpty(dn)) {
dn = "NE=34603447";
} else {
dn = "NE="+ dn;
}
final String result = queryDevice(openID, dn);
System.out.println(result);
jsonObject.put("result",result);
jsonObject.put("state", true);
} catch (Exception e) {
jsonObject.put("state", false);
}
ResponseHelper.write(response, jsonObject);
}
/**
* 根据指定参数获取存储设备列表
*
* @param response
* @param dn 可选(设备标识,设备标识格式为“NE=xxx”,作为URL参数时需要做转义处理)
*/
@RequestMapping(value = "/storage/device")
public void getStorageDevice(HttpServletResponse response, String dn, String deviceSeries) {
JSONObject jsonObject = new JSONObject();
try {
final String openID = getOpenID();
if (null == openID || openID.isEmpty()) {
System.out.println("failed to login.");
return;
}
System.out.println(openID);
/*String deviceSeries = "fcswitch"; //交换机*/
final String result = queryStorageDevice(openID, deviceSeries, dn);
System.out.println(result);
jsonObject.put("result",result);
jsonObject.put("state", true);
} catch (Exception e) {
jsonObject.put("state", false);
}
ResponseHelper.write(response, jsonObject);
}
public String queryStorageDevice(String openID, String deviceSeries, String dn) throws Exception {
//set the URL and method
final String queryURL = "/rest/openapi/storage/device";
//set headers and parameters
final List<BasicNameValuePair> headers = new ArrayList<BasicNameValuePair>();
headers.add(new BasicNameValuePair("openid", openID));
//set parameters
final List<BasicNameValuePair> parameters = new ArrayList<BasicNameValuePair>();
parameters.add(new BasicNameValuePair("deviceSeries", deviceSeries));
if (!StringUtils.isEmpty(dn)) {
parameters.add(new BasicNameValuePair("dn", dn));
}
//create a connection manager
final X509TrustManager tm = new X509TrustManager() {
@Override
public void checkClientTrusted(java.security.cert.X509Certificate[] x509Certificates, String s) throws CertificateException {
}
@Override
public void checkServerTrusted(java.security.cert.X509Certificate[] x509Certificates, String s) throws CertificateException {
}
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return null;
}
};
//create a SSL connection
final SSLContext sslcontext = SSLContext.getInstance("TLS");
sslcontext.init(null, new TrustManager[] { tm }, null);
SSLSocketFactory socketFactory = new SSLSocketFactory(sslcontext, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
final SchemeRegistry schemeRegistry = new SchemeRegistry();
schemeRegistry.register(new Scheme("https", port, socketFactory));
//create a HttpClient to connect to the target host
final HttpClient httpClient = new DefaultHttpClient(new BasicClientConnectionManager(schemeRegistry));
//set the URL
String url = "https://" + ip + ":" + port + queryURL;
//set parameters
if (null != parameters) {
url += "?";
boolean init = false;
for (final BasicNameValuePair e : parameters) {
if (!init) {
url += URLEncoder.encode(e.getName(), "UTF-8") + "=" + URLEncoder.encode(e.getValue(), "UTF-8");
init = true;
} else {
url += "&" + URLEncoder.encode(e.getName(), "UTF-8") + "=" + URLEncoder.encode (e.getValue(), "UTF-8");
}
}
}
System.out.println(url);
final HttpGet httpGet = new HttpGet(url);
//set headers
if (null != headers) {
for (final BasicNameValuePair header : headers) {
httpGet.setHeader(header.getName(), header.getValue());
}
}
//send the request
final HttpResponse response = httpClient.execute(httpGet);
final String ret = getResult(response);
System.out.println(ret);
if (null == ret || ret.isEmpty()) {
return "";
}
//get the result
final Map<String, String> retMap = parseResponse(ret);
if (retMap.get("code").equals("0")) {
System.out.println(retMap.get("data"));
return retMap.get("data");
}
return "";
}
/**
* 获取openID
*
* @return
* @throws Exception
*/
@RequestMapping("/getOpenID")
public static String getOpenID() throws Exception {
//set the URL
final String openidURL = "/rest/openapi/sm/session";
//set parameters
final List<BasicNameValuePair> parameters = new ArrayList<BasicNameValuePair>();
parameters.add(new BasicNameValuePair("userid", userName));
parameters.add(new BasicNameValuePair("value", pwd));
parameters.add(new BasicNameValuePair("ipaddr", ip));
//create a connection manager
final X509TrustManager tm = new X509TrustManager()
{
@Override
public void checkClientTrusted(java.security.cert.X509Certificate[] x509Certificates, String s) throws CertificateException {
}
@Override
public void checkServerTrusted(java.security.cert.X509Certificate[] x509Certificates, String s) throws CertificateException {
}
@Override
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return null;
}
};
//create a SSL connection
final SSLContext sslcontext = SSLContext.getInstance("TLS");
sslcontext.init(null, new TrustManager[] {tm}, null);
final SSLSocketFactory socketFactory = new SSLSocketFactory(sslcontext, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
final SchemeRegistry schemeRegistry = new SchemeRegistry();
schemeRegistry.register(new Scheme("https", port, socketFactory));
//create a HttpClient to connect to the target host
final HttpClient httpClient = new DefaultHttpClient(new BasicClientConnectionManager (schemeRegistry));
//set the URL
final String url = "https://" + ip + ":" + port + openidURL;
//set the method
final HttpPut httpPut = new HttpPut(url);
httpPut.setEntity(new UrlEncodedFormEntity(parameters, "UTF-8"));
//send the request
final HttpResponse response = httpClient.execute(httpPut);
final Map<String, String> retMap = parseResponse(getResult(response));
System.out.println(retMap);
if (retMap.get("code").equals("0")) {
return retMap.get("data");
}
return "";
}
/**
* 查询服务器列表
*
* @param openID
* @param serverType
* @return
* @throws Exception
*/
public static String queryDeviceList(final String openID, String serverType) throws Exception {
//set the URL and method
final String query_URL = "/rest/openapi/server/device";
//set headers and parameters
final List<BasicNameValuePair> headers = new ArrayList<BasicNameValuePair>();
headers.add(new BasicNameValuePair("openid", openID));
//set parameters
final List<BasicNameValuePair> parameters = new ArrayList<BasicNameValuePair>();
parameters.add(new BasicNameValuePair("servertype", serverType));
//create a connection manager
final X509TrustManager tm = new X509TrustManager() {
@Override
public void checkClientTrusted(java.security.cert.X509Certificate[] x509Certificates, String s) throws CertificateException {
}
@Override
public void checkServerTrusted(java.security.cert.X509Certificate[] x509Certificates, String s) throws CertificateException {
}
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return null;
}
};
//create a SSL connection
final SSLContext sslcontext = SSLContext.getInstance("TLS");
sslcontext.init(null, new TrustManager[] { tm }, null);
SSLSocketFactory socketFactory = new SSLSocketFactory(sslcontext, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
final SchemeRegistry schemeRegistry = new SchemeRegistry();
schemeRegistry.register(new Scheme("https", port, socketFactory));
//create a HttpClient to connect to the target host
final HttpClient httpClient = new DefaultHttpClient(new BasicClientConnectionManager(schemeRegistry));
//set the URL
String url = "https://" + ip + ":" + port + query_URL;
//set parameters
if (null != parameters) {
url += "?";
boolean init = false;
for (final BasicNameValuePair e : parameters) {
if (!init) {
url += URLEncoder.encode(e.getName(), "UTF-8") + "=" + URLEncoder.encode(e.getValue(), "UTF-8");
init = true;
} else {
url += "&" + URLEncoder.encode(e.getName(), "UTF-8") + "=" + URLEncoder.encode (e.getValue(), "UTF-8");
}
}
}
System.out.println(url);
final HttpGet httpGet = new HttpGet(url);
//set headers
if (null != headers) {
for (final BasicNameValuePair header : headers) {
httpGet.setHeader(header.getName(), header.getValue());
}
}
//send the request
final HttpResponse response = httpClient.execute(httpGet);
final String ret = getResult(response);
System.out.println(ret);
if (null == ret || ret.isEmpty()) {
return "";
}
//get the result
final Map<String, String> retMap = parseResponse(ret);
if (retMap.get("code").equals("0")) {
System.out.println(retMap.get("data"));
return retMap.get("data");
}
return "";
}
/**
* 获取服务器信息
*
* @param openID
* @return
* @throws Exception
*/
public static String queryDevice(final String openID, final String dn) throws Exception {
System.out.println(openID);
//set the URL and method
final String queryURL = "/rest/openapi/server/device/detail";
//set headers and parameters
final List<BasicNameValuePair> headers = new ArrayList<BasicNameValuePair>();
headers.add(new BasicNameValuePair("openid", openID));
//set parameters
final List<BasicNameValuePair> parameters = new ArrayList<BasicNameValuePair>();
parameters.add(new BasicNameValuePair("dn", dn));
//create a connection manager
final X509TrustManager tm = new X509TrustManager() {
@Override
public void checkClientTrusted(java.security.cert.X509Certificate[] x509Certificates, String s) throws CertificateException {
}
@Override
public void checkServerTrusted(java.security.cert.X509Certificate[] x509Certificates, String s) throws CertificateException {
}
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return null;
}
};
//create a SSL connection
final SSLContext sslcontext = SSLContext.getInstance("TLS");
sslcontext.init(null, new TrustManager[] { tm }, null);
SSLSocketFactory socketFactory = new SSLSocketFactory(sslcontext, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
final SchemeRegistry schemeRegistry = new SchemeRegistry();
schemeRegistry.register(new Scheme("https", port, socketFactory));
//create a HttpClient to connect to the target host
final HttpClient httpClient = new DefaultHttpClient(new BasicClientConnectionManager(schemeRegistry));
//set the URL
String url = "https://" + ip + ":" + port + queryURL;
//set parameters
if (null != parameters) {
url += "?";
boolean init = false;
for (final BasicNameValuePair e : parameters) {
if (!init) {
url += URLEncoder.encode(e.getName(), "UTF-8") + "=" + URLEncoder.encode(e.getValue(), "UTF-8");
init = true;
} else {
url += "&" + URLEncoder.encode(e.getName(), "UTF-8") + "=" + URLEncoder.encode (e.getValue(), "UTF-8");
}
}
}
System.out.println(url);
final HttpGet httpGet = new HttpGet(url);
//set headers
if (null != headers) {
for (final BasicNameValuePair header : headers) {
httpGet.setHeader(header.getName(), header.getValue());
}
}
//send the request
final HttpResponse response = httpClient.execute(httpGet);
final String ret = getResult(response);
System.out.println(ret);
if (null == ret || ret.isEmpty()) {
return "";
}
//get the result
final Map<String, String> retMap = parseResponse(ret);
if (retMap.get("code").equals("0")) {
System.out.println(retMap.get("data"));
return retMap.get("data");
}
return "";
}
/**
* 查询所有的设备类别信息列表
* @throws Exception
*/
@RequestMapping("/queryNeCategoryTest")
public static void queryNeCategoryTest(HttpServletResponse httpServletResponse) throws Exception {
JSONObject jsonObject = new JSONObject();
String openID = getOpenID();
//set the URL and method
final String openidURL = "/rest/openapi/necategory";
String method = "GET";
//set headers and parameters
final List<BasicNameValuePair> headers = new ArrayList<BasicNameValuePair>();
headers.add(new BasicNameValuePair("openid", openID));
//set parameters
final List<BasicNameValuePair> parameters = null;
//create a connection manager
final X509TrustManager tm = new X509TrustManager() {
@Override
public void checkClientTrusted(java.security.cert.X509Certificate[] x509Certificates, String s) throws CertificateException {
}
@Override
public void checkServerTrusted(java.security.cert.X509Certificate[] x509Certificates, String s) throws CertificateException {
}
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return null;
}
};
//create a SSL connection
final SSLContext sslcontext = SSLContext.getInstance("TLS");
sslcontext.init(null, new TrustManager[] { tm }, null);
SSLSocketFactory socketFactory = new SSLSocketFactory(sslcontext, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
final SchemeRegistry schemeRegistry = new SchemeRegistry();
schemeRegistry.register(new Scheme("https", port, socketFactory));
//create a HttpClient to connect to the target host
final HttpClient httpClient = new DefaultHttpClient(new BasicClientConnectionManager(schemeRegistry));
//set the URL
String url = "https://" + ip + ":" + port + openidURL;
//set parameters
if (null != parameters) {
url += "?";
boolean init = false;
for (final BasicNameValuePair e : parameters) {
if (!init) {
url += URLEncoder.encode(e.getName(), "UTF-8") + "=" + URLEncoder.encode(e.getValue(), "UTF-8");
init = true;
} else {
url += "&" + URLEncoder.encode(e.getName(), "UTF-8") + "=" + URLEncoder.encode (e.getValue(), "UTF-8");
}
}
}
System.out.println(url);
final HttpGet httpGet = new HttpGet(url);
//set headers
if (null != headers) {
for (final BasicNameValuePair header : headers) {
httpGet.setHeader(header.getName(), header.getValue());
}
}
//send the request
final HttpResponse response = httpClient.execute(httpGet);
final String ret = getResult(response);
System.out.println(ret);
jsonObject.put("result", ret);
ResponseHelper.write(httpServletResponse, jsonObject);
}
/**
* 查询预订条件的设备类型信息列表
* @param httpServletResponse
* @throws Exception
*/
@RequestMapping("/queryNeTypeTest")
public static void queryNeTypeTest(HttpServletResponse httpServletResponse) throws Exception {
JSONObject jsonObject = new JSONObject();
String openID = getOpenID();
//set the URL and method
final String openidURL = "/rest/openapi/netype";
String method = "GET";
//set headers and parameters
final List<BasicNameValuePair> headers = new ArrayList<BasicNameValuePair>();
headers.add(new BasicNameValuePair("openid", openID));
//set parameters
List<BasicNameValuePair> parameters = new ArrayList<BasicNameValuePair>();
parameters.add(new BasicNameValuePair("category", ""));
parameters.add(new BasicNameValuePair("start", ""));
parameters.add(new BasicNameValuePair("size", ""));
parameters.add(new BasicNameValuePair("orderby", ""));
parameters.add(new BasicNameValuePair("desc", ""));
//create a connection manager
final X509TrustManager tm = new X509TrustManager() {
@Override
public void checkClientTrusted(java.security.cert.X509Certificate[] x509Certificates, String s) throws CertificateException {
}
@Override
public void checkServerTrusted(java.security.cert.X509Certificate[] x509Certificates, String s) throws CertificateException {
}
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return null;
}
};
//create a SSL connection
final SSLContext sslcontext = SSLContext.getInstance("TLS");
sslcontext.init(null, new TrustManager[] { tm }, null);
SSLSocketFactory socketFactory = new SSLSocketFactory(sslcontext, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
final SchemeRegistry schemeRegistry = new SchemeRegistry();
schemeRegistry.register(new Scheme("https", port, socketFactory));
//create a HttpClient to connect to the target host
final HttpClient httpClient = new DefaultHttpClient(new BasicClientConnectionManager(schemeRegistry));
//set the URL
String url = "https://" + ip + ":" + port + openidURL;
//set parameters
if (null != parameters) {
url += "?";
boolean init = false;
for (final BasicNameValuePair e : parameters) {
if (!init) {
url += URLEncoder.encode(e.getName(), "UTF-8") + "=" + URLEncoder.encode(e.getValue(), "UTF-8");
init = true;
} else {
url += "&" + URLEncoder.encode(e.getName(), "UTF-8") + "=" + URLEncoder.encode (e.getValue(), "UTF-8");
}
}
}
System.out.println(url);
final HttpGet httpGet = new HttpGet(url);
//set headers
if (null != headers) {
for (final BasicNameValuePair header : headers) {
httpGet.setHeader(header.getName(), header.getValue());
}
}
//send the request
final HttpResponse response = httpClient.execute(httpGet);
final String ret = getResult(response);
System.out.println(ret);
jsonObject.put("result", ret);
ResponseHelper.write(httpServletResponse, jsonObject);
}
@RequestMapping("/queryNeDeviceTest")
public static String queryNeDeviceTest() throws Exception {
JSONObject jsonObject = new JSONObject();
String openID = getOpenID();
//set the URL and method
final String openidURL = "/rest/openapi/nedevice";
String method = "GET";
//set headers and parameters
final List<BasicNameValuePair> headers = new ArrayList<BasicNameValuePair>();
headers.add(new BasicNameValuePair("openid", openID));
//set parameters
List<BasicNameValuePair> parameters = new ArrayList<BasicNameValuePair>();
parameters.add(new BasicNameValuePair("necategory", ""));
parameters.add(new BasicNameValuePair("netype", ""));
parameters.add(new BasicNameValuePair("neip", ""));
parameters.add(new BasicNameValuePair("nestate", ""));
parameters.add(new BasicNameValuePair("start", ""));
parameters.add(new BasicNameValuePair("size", "500"));
parameters.add(new BasicNameValuePair("orderby", ""));
parameters.add(new BasicNameValuePair("desc", ""));
//create a connection manager
final X509TrustManager tm = new X509TrustManager() {
@Override
public void checkClientTrusted(java.security.cert.X509Certificate[] x509Certificates, String s) throws CertificateException {
}
@Override
public void checkServerTrusted(java.security.cert.X509Certificate[] x509Certificates, String s) throws CertificateException {
}
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return null;
}
};
//create a SSL connection
final SSLContext sslcontext = SSLContext.getInstance("TLS");
sslcontext.init(null, new TrustManager[] { tm }, null);
SSLSocketFactory socketFactory = new SSLSocketFactory(sslcontext, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
final SchemeRegistry schemeRegistry = new SchemeRegistry();
schemeRegistry.register(new Scheme("https", port, socketFactory));
//create a HttpClient to connect to the target host
final HttpClient httpClient = new DefaultHttpClient(new BasicClientConnectionManager(schemeRegistry));
//set the URL
String url = "https://" + ip + ":" + port + openidURL;
//set parameters
if (null != parameters) {
url += "?";
boolean init = false;
for (final BasicNameValuePair e : parameters) {
if (!init) {
url += URLEncoder.encode(e.getName(), "UTF-8") + "=" + URLEncoder.encode(e.getValue(), "UTF-8");
init = true;
} else {
url += "&" + URLEncoder.encode(e.getName(), "UTF-8") + "=" + URLEncoder.encode (e.getValue(), "UTF-8");
}
}
}
System.out.println(url);
final HttpGet httpGet = new HttpGet(url);
//set headers
if (null != headers) {
for (final BasicNameValuePair header : headers) {
httpGet.setHeader(header.getName(), header.getValue());
}
}
//send the request
final HttpResponse response = httpClient.execute(httpGet);
final String ret = getResult(response);
System.out.println(ret);
if (null == ret || ret.isEmpty()) {
return "";
}
//get the result
final Map<String, String> retMap = parseResponse(ret);
if (retMap.get("code").equals("0")) {
System.out.println(retMap.get("data"));
return retMap.get("data");
}
return "";
}
/**
* 查询预订条件的端口信息
*
* @param httpServletResponse
* @throws Exception
*/
@RequestMapping("/queryPortResTest")
public static void queryPortResTest(HttpServletResponse httpServletResponse) throws Exception {
JSONObject jsonObject = new JSONObject();
String openID = getOpenID();
//set the URL and method
final String openidURL = "/rest/openapi/network/port";
String method = "GET";
//set headers and parameters
final List<BasicNameValuePair> headers = new ArrayList<BasicNameValuePair>();
headers.add(new BasicNameValuePair("openid", openID));
//set parameters
List<BasicNameValuePair> parameters = new ArrayList<BasicNameValuePair>();
parameters.add(new BasicNameValuePair("necategory", ""));
parameters.add(new BasicNameValuePair("netype", ""));
parameters.add(new BasicNameValuePair("neip", ""));
parameters.add(new BasicNameValuePair("nestate", ""));
parameters.add(new BasicNameValuePair("start", ""));
parameters.add(new BasicNameValuePair("size", "3000"));
parameters.add(new BasicNameValuePair("orderby", ""));
parameters.add(new BasicNameValuePair("desc", ""));
//create a connection manager
final X509TrustManager tm = new X509TrustManager() {
@Override
public void checkClientTrusted(java.security.cert.X509Certificate[] x509Certificates, String s) throws CertificateException {
}
@Override
public void checkServerTrusted(java.security.cert.X509Certificate[] x509Certificates, String s) throws CertificateException {
}
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return null;
}
};
//create a SSL connection
final SSLContext sslcontext = SSLContext.getInstance("TLS");
sslcontext.init(null, new TrustManager[] { tm }, null);
SSLSocketFactory socketFactory = new SSLSocketFactory(sslcontext, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
final SchemeRegistry schemeRegistry = new SchemeRegistry();
schemeRegistry.register(new Scheme("https", port, socketFactory));
//create a HttpClient to connect to the target host
final HttpClient httpClient = new DefaultHttpClient(new BasicClientConnectionManager(schemeRegistry));
//set the URL
String url = "https://" + ip + ":" + port + openidURL;
//set parameters
if (null != parameters) {
url += "?";
boolean init = false;
for (final BasicNameValuePair e : parameters) {
if (!init) {
url += URLEncoder.encode(e.getName(), "UTF-8") + "=" + URLEncoder.encode(e.getValue(), "UTF-8");
init = true;
} else {
url += "&" + URLEncoder.encode(e.getName(), "UTF-8") + "=" + URLEncoder.encode (e.getValue(), "UTF-8");
}
}
}
System.out.println(url);
final HttpGet httpGet = new HttpGet(url);
//set headers
if (null != headers) {
for (final BasicNameValuePair header : headers) {
httpGet.setHeader(header.getName(), header.getValue());
}
}
//send the request
final HttpResponse response = httpClient.execute(httpGet);
final String ret = getResult(response);
System.out.println(ret);
jsonObject.put("result", ret);
ResponseHelper.write(httpServletResponse, jsonObject);
}
/**
* get the result
*/
public static String getResult(final HttpResponse response) throws IllegalStateException, IOException {
if (200 != response.getStatusLine().getStatusCode()) {
return "";
}
final InputStream is = response.getEntity().getContent();
final BufferedReader br = new BufferedReader(new InputStreamReader(is));
String ret = "";
String line = "";
while ((line = br.readLine()) != null) {
if (!ret.isEmpty()) {
ret += "\n";
}
ret += line;
}
return ret;
}
public static Map<String, String> parseResponse(final String input) {
final Map<String, String> retMap = new HashMap<String, String>();
final JSONObject jObject = JSONObject.parseObject(input);
if (null == jObject) {
return retMap;
}
if (null != jObject.get("code")) {
final String i = jObject.get("code").toString();
retMap.put("code", i);
}
if (null != jObject.get("data")) {
final String data = jObject.get("data").toString();
retMap.put("data", data);
}
if (null != jObject.get("description")) {
final String des = jObject.get("description").toString();
retMap.put("description", des);
}
if (null != jObject.get("result")) {
final String res = jObject.get("result").toString();
retMap.put("result", res);
}
return retMap;
}
@RequestMapping(value = "/getServerInfo")
public String getServerInfo(String dn, HttpServletRequest request) throws IOException {
return "redirect:/net/device/detail?dn=" + dn; //重定向到华为网管系统
}
@RequestMapping("/getDataGrid")
public void getDataGrid(HttpServletResponse httpServletResponse, String deviceName) {
JSONObject jsonObject = new JSONObject();
final String url = "http://10.1.2.243:8081/net/queryNeDeviceTest";
CloseableHttpClient httpClient = HttpClients.createDefault();
Map<String, String> param = null;
String ret = "";
CloseableHttpResponse response = null;
try {
URIBuilder builder = new URIBuilder(url);
if (param != null) {
for (String key:param.keySet()) {
builder.addParameter(key, param.get(key));
}
}
URI uri = builder.build();
HttpGet httpGet = new HttpGet(uri);
response = httpClient.execute(httpGet);
if (response.getStatusLine().getStatusCode() == 200) {
ret = EntityUtils.toString(response.getEntity(), "UTF-8");
}
if (null == ret || ret.isEmpty()) {
jsonObject.put("state", false);
}
JSONObject parseObject = JSONObject.parseObject(ret);
JSONObject p = JSONObject.parseObject(parseObject.getString("result"));
System.out.println(p.getString("code").equals("0"));
if (p.getString("code").equals("0")) {
if (!StringUtils.isEmpty(p.get("data"))) {
JSONArray json = JSONArray.parseArray(p.getString("data"));
if (!StringUtils.isEmpty(deviceName)) {
if (json.size() > 0) {
for (Object obj : json) {
JSONObject object = (JSONObject) obj;
if ("Ac4700".equals(deviceName)) {
deviceName = "AC4700";
}
if (object.get("nename").equals(deviceName)) {
jsonObject.put("result", object);
jsonObject.put("state", true);
}
}
} else {
jsonObject.put("state", true);
}
} else {
jsonObject.put("result", json);
}
}
}
} catch (Exception e) {
jsonObject.put("state", false);
}
ResponseHelper.write(httpServletResponse, jsonObject);
}
}
|
[
"870754310@qq.com"
] |
870754310@qq.com
|
221acd6862dda045bb8dd8f9d717bbf0264e50d0
|
12ea92a2dc162738284dd7895233f09ebd419840
|
/src/main/java/com/example/demo/liskov_substitution_principle/bad_case/Square.java
|
67f996fe7c06549f718e7c6710a724b338350408
|
[] |
no_license
|
Youngerjesus/object-oriented-programming
|
b6e7f59d8c27d40b336accb2adbd78aff6f5ec7f
|
95ab326e45cebc707cdba690e0a4278b3de081e9
|
refs/heads/master
| 2023-08-26T23:14:23.301690
| 2021-11-09T09:44:34
| 2021-11-09T09:44:34
| 292,286,905
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 446
|
java
|
package com.example.demo.liskov_substitution_principle.bad_case;
public class Square extends Rectangle{
public Square() {}
public Square(int size) {
width = height = size;
}
@Override
public void setWidth(int width) {
super.setWidth(width);
super.setHeight(width);
}
@Override
public void setHeight(int height) {
super.setHeight(height);
super.setWidth(height);
}
}
|
[
"yjh930919@gmail.com"
] |
yjh930919@gmail.com
|
5b7960880cc3a246bb35992a0fc0c45ae6a0e5f6
|
4ac382fca7182cca066a378765530f9204e119f3
|
/app/src/main/java/com/example/aksma/myapplication/MainActivity.java
|
8faa22af12b3cb67dac5d60327b8314ff4d1ee9e
|
[
"Apache-2.0"
] |
permissive
|
akshaypalshikar/android
|
6ccff7fb6c16c8e4b2c5f8ffe9507e5c4f2d55f8
|
bfa694561e3e7927df6b650f881f225f8ce04313
|
refs/heads/master
| 2021-01-21T14:49:48.927423
| 2017-06-25T08:46:14
| 2017-06-25T08:46:14
| 95,345,627
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 357
|
java
|
package com.example.aksma.myapplication;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
|
[
"aksmakesit@gmail.com"
] |
aksmakesit@gmail.com
|
555098a0b879b44523736d2ce59aa88403cbe93f
|
79d412df055aa3055b21c3ac5a55a0b43848baa3
|
/app/src/main/java/com/hack/asksepp/asksepp_demo/zeitangabe/ZeitangabeApi.java
|
68a074d366923eb6259b21f9383234afdec87b3d
|
[] |
no_license
|
noehmeier/askseppapp
|
ec6fa30e8591d237b47ce0b4920c5b9ebd2f317a
|
151f444ae0c0d09350e2cd283c0a78088286bbd2
|
refs/heads/master
| 2021-01-10T05:46:39.191867
| 2016-03-20T10:08:01
| 2016-03-20T10:08:01
| 54,311,105
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 380
|
java
|
package com.hack.asksepp.asksepp_demo.zeitangabe;
import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.Path;
import retrofit2.http.Query;
/**
* Created by mateusz on 20.03.16.
*/
public interface ZeitangabeApi {
@GET("/api/Zeitangabes/findOne")
public Call<Zeitangabe> zeitangabe(@Query(value = "filter[where][timeInSeconds]") int timeInSeconds);
}
|
[
"noehmeie@hm.edu"
] |
noehmeie@hm.edu
|
578d4137749a27a9b435c0ca48e92d0e3e67c574
|
54473ba37c8bcb8740d718b0461ae804f42ed7e7
|
/src/main/java/com/sky/maven1/Princiapl.java
|
f356b37051bc456a35e60991f91aec1f0590e84d
|
[] |
no_license
|
Jesus-Eduardo142/maven1
|
d1423b814a50e65482b2903a6561922f50ec9e70
|
e9c257349d1984aabad0f7d3d3512099e2652255
|
refs/heads/master
| 2022-10-19T06:04:37.395792
| 2020-06-08T03:01:11
| 2020-06-08T03:01:11
| 269,677,869
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 468
|
java
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.sky.maven1;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author skylar
*/
public class Princiapl {
public static void main(String[] args) {
Logger.getLogger(Princiapl.class.getName()).log(Level.INFO, "Hola mundo...");
}
}
|
[
"f78541985@gmail.com"
] |
f78541985@gmail.com
|
7fccc8665a5680c8b88271d73dad54a9314f8402
|
dfbaae48f7ec14bf5b572cf863ddfb6815cbfc12
|
/app/src/main/java/com/reshma/prajapati/mylist/adapters/MyListAdapter.java
|
d8b6056e778cb566cdce9c951262fc135e1ffe20
|
[] |
no_license
|
ReshmaPrp/InfyTask
|
a85331228dfe10bc1a96b7081f017aceb831a0dd
|
406d886576e4e6d0434bc830a2c04b66240be25c
|
refs/heads/master
| 2020-03-11T14:24:51.291125
| 2018-05-02T17:32:22
| 2018-05-02T17:32:22
| 130,053,542
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,639
|
java
|
package com.reshma.prajapati.mylist.adapters;
import android.databinding.BindingAdapter;
import android.databinding.DataBindingUtil;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import com.reshma.prajapati.mylist.R;
import com.reshma.prajapati.mylist.databinding.ListItemBinding;
import com.reshma.prajapati.mylist.model.Row;
import com.squareup.picasso.Picasso;
import java.util.ArrayList;
/*
* Adapter listing data into recycler view
* */
public class MyListAdapter extends RecyclerView.Adapter<MyListAdapter.ViewHolder> {
private ArrayList<Row> mDataList;
public MyListAdapter(ArrayList<Row> myDataList) {
this.mDataList =myDataList;
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext());
//Binding list view
ListItemBinding itemBinding =
DataBindingUtil.inflate(layoutInflater,R.layout.list_item, parent,false);
return new ViewHolder(itemBinding);
}
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
Row data = mDataList.get(position);
holder.bind(data);
loadImage((ImageView) holder.itemView.findViewById(R.id.img), data.getImageHref());
//currently data is not available for specfic row then will not display
if(data.getTitle()==null && data.getDescription()==null){
holder.itemBinding.itemLayout.setVisibility(View.GONE);
holder.itemBinding.img.setVisibility(View.GONE);
}
}
@Override
public int getItemCount() {
return mDataList.size();
}
class ViewHolder extends RecyclerView.ViewHolder {
private ListItemBinding itemBinding;
ViewHolder(ListItemBinding itemBinding) {
super(itemBinding.getRoot());
this.itemBinding = itemBinding;
}
void bind(Row data) {
itemBinding.setData(data);
itemBinding.executePendingBindings();
}
}
@BindingAdapter({"bind:image"})
public static void loadImage(ImageView view, String imageUrl) {
if(imageUrl!=null) {
//Picasso library for lazy loading and cache
Picasso.get()
.load(imageUrl)
.fit()
.placeholder(R.mipmap.ic_launcher)
.into(view);
}
}
}
|
[
"resu.prp@gmail.com"
] |
resu.prp@gmail.com
|
d23bda6760219ef3f0b201b39b903f54d5ee400d
|
c6194df4686576197546711a65465afc7d7c525e
|
/src/main/java/com/iris/dss/AuthenticationException/CustomOAuthRequestProcessingFilterException.java
|
3e7ec9f26fa57592d18695ec348249d882965efe
|
[] |
no_license
|
amyaeda/dss-moe
|
d4fc077af0639f7bc3bd4ddb2b24f2f9996627a9
|
2366b414678322b9b02a523960cea5c65d5605af
|
refs/heads/main
| 2023-03-13T00:36:29.650758
| 2021-03-01T02:11:14
| 2021-03-01T02:11:14
| 343,264,362
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 449
|
java
|
package com.iris.dss.AuthenticationException;
import org.springframework.security.core.AuthenticationException;
public class CustomOAuthRequestProcessingFilterException extends AuthenticationException {
private static final long serialVersionUID = 1L;
public CustomOAuthRequestProcessingFilterException(String msg) {
super(msg);
}
public CustomOAuthRequestProcessingFilterException(String msg, Exception ex) {
super(msg, ex);
}
}
|
[
"paridah@iris.com.my"
] |
paridah@iris.com.my
|
ca64b7ecbc1bd9325330466d2a14ce77e14726d7
|
969854e3b88738b52eea02dab9a7d92b97797c97
|
/src/main/java/gxt/visual/ui/client/interfaces/view/ITreeGridView.java
|
b6931e7d950271d50b69018470845905b4e5a152
|
[] |
no_license
|
bbai/gxt-interfaces
|
1b130b301fc31444dae103c7d17a4bbace5ef9c3
|
4bb0fc716e4a45525fc31a39647669f30e69d2b8
|
refs/heads/master
| 2021-01-21T19:35:09.393173
| 2010-06-08T21:56:07
| 2010-06-08T21:56:07
| 42,747,579
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,959
|
java
|
package gxt.visual.ui.client.interfaces.view;
import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.data.ModelIconProvider;
import com.extjs.gxt.ui.client.store.TreeStore;
import com.extjs.gxt.ui.client.widget.grid.GridView;
import com.extjs.gxt.ui.client.widget.treegrid.TreeGridView;
import com.extjs.gxt.ui.client.widget.treegrid.TreeGrid.TreeNode;
import com.extjs.gxt.ui.client.widget.treepanel.TreeStyle;
import com.google.gwt.user.client.Element;
/**
* @author eugenp
*/
public interface ITreeGridView< M extends ModelData > extends IGridView< M >{
/**
* Collapses all nodes.
*/
void collapseAll();
/**
* Expands all nodes.
*/
void expandAll();
/**
* Returns the tree node for the given target.
* @param target the target element
* @return the tree node or null if no match
*/
TreeNode findNode( Element target );
/**
* Returns the model icon provider.
* @return the icon provider
*/
ModelIconProvider< M > getIconProvider();
/**
* Returns the tree style.
* @return the tree style
*/
TreeStyle getStyle();
/**
* Returns the tree's tree store.
* @return the tree store
*/
TreeStore< M > getTreeStore();
/**
* Returns the tree's view.
* @return the view
*/
TreeGridView getTreeView();
/**
* Returns true if auto expand is enabled.
* @return the auto expand state
*/
boolean isAutoExpand();
/**
* Returns true if auto load is enabled.
* @return the auto load state
*/
boolean isAutoLoad();
/**
* Returns true when a loader is queried for it's children each time a node is expanded. Only applies when using a loader with the tree store.
* @return true if caching
*/
boolean isCaching();
/**
* Returns true if the model is expanded.
* @param model the model
* @return true if expanded
*/
boolean isExpanded( M model );
/**
* Returns true if the model is a leaf node. The leaf state allows a tree item to specify if it has children before the children have been realized.
* @param model the model
* @return the leaf state
*/
boolean isLeaf( M model );
/**
* If set to true, all non leaf nodes will be expanded automatically (defaults to false).
* @param autoExpand the auto expand state to set.
*/
void setAutoExpand( boolean autoExpand );
/**
* Sets whether all children should automatically be loaded recursively (defaults to false). Useful when the tree must be fully populated when initially rendered.
* @param autoLoad true to auto load
*/
void setAutoLoad( boolean autoLoad );
/**
* Sets whether the children should be cached after first being retrieved from the store (defaults to true). When <code>false</code>, a load request will be made each time a node is expanded.
* @param caching the caching state
*/
void setCaching( boolean caching );
/**
* Sets the item's expand state.
* @param model the model
* @param expand true to expand
*/
void setExpanded( M model, boolean expand );
/**
* Sets the item's expand state.
* @param model the model
* @param expand true to expand
* @param deep true to expand all children recursively
*/
@SuppressWarnings( "unchecked" )
void setExpanded( M model, boolean expand, boolean deep );
/**
* Sets the tree's model icon provider which provides the icon style for each model.
* @param iconProvider the icon provider
*/
void setIconProvider( ModelIconProvider< M > iconProvider );
/**
* Sets the item's leaf state. The leaf state allows control of the expand icon before the children have been realized.
* @param model the model
* @param leaf the leaf state
*/
void setLeaf( M model, boolean leaf );
void setView( GridView view );
/**
* Toggles the model's expand state.
* @param model the model
*/
void toggle( M model );
}
|
[
"hanriseldon@gmail.com"
] |
hanriseldon@gmail.com
|
95f3109b2e81527745bc2776482cfc787a41084b
|
bc038e89bc67e2f9c228c25a2ec13616f07c490a
|
/src/ReplitTry/R094_Loop_ShoppingList2.java
|
867ac678e6ae74a3f92cc910bea2c3f3b51fc87d
|
[] |
no_license
|
kamiltoprak/Summer2020_B20
|
43957bf7c73b3650e16b8e4b4a3704da826ad395
|
65dc3806c0d099ef275b5f84a4e167475fc2d07f
|
refs/heads/master
| 2023-02-06T08:59:27.059443
| 2020-12-24T03:12:49
| 2020-12-24T03:12:49
| 284,479,607
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,377
|
java
|
package ReplitTry;
/*Your program should ask use to enter items followed by its price. After adding item, ask user if he wants to add one more item. If so, repeat previous steps again. If no, print shopping list report and total price as show in examples. Your program should accept up to 10 items.
Hint: use do while loop.
Example:
output: Enter Item1 and its price:
input: Tomatoes
input: 5.5
output: Add one more item?
input: yes
output: Enter Item2 and its price:
input: Cheese
input: 3.5
output: Add one more item?
input: yes
output: Enter Item3 and its price:
input: Apples
input: 6.3
output: Add one more item?
input: no
output: Item1: Tomatoes Price: 5.5, Item2: Cheese Price: 3.5, Item3: Apples Price: 6.3
output: Total price: 15.3
Example:
output: Enter Item1 and its price:
input: Lemons
input: 2.3
output: Add one more item?
input: yes
output: Enter Item2 and its price:
input: Oranges
input: 6
output: Add one more item?
input: no
output: Item1: Lemons Price: 2.3, Item2: Oranges Price: 6.0
output: Total price: 8.3*/
import java.util.Scanner;
public class R094_Loop_ShoppingList2 {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
String shoppingListReport = "";
String item = "";
String countinue = "";
double price = 0;
int count = 1;
double totalProce = 0;
while(count>=0){
System.out.println("Enter Item"+count+" and its price:");
item=scan.next();
price=scan.nextDouble();
shoppingListReport+="Item"+count+": "+item+" Price: "+ price;
System.out.println("Add one more item?");
totalProce+=price;
countinue=scan.next();
if(countinue.equals("no")){
break;
}else{
shoppingListReport+=", ";
}
count++;
}
System.out.println(shoppingListReport);
System.out.println("Total price: "+totalProce);
}
}
|
[
"ktoprak@gmail.com"
] |
ktoprak@gmail.com
|
7e5be1d2042bc54afd7952dfdd20e515c6b77236
|
77c21282a040c15571d3adfbeb6debc2b21142f2
|
/src/main/java/vo/ModifyEquipment.java
|
0ba6ddd84b862ff2ddb6b6d4e66d639aa1eb911b
|
[] |
no_license
|
a830144/Drone
|
1661bf3ec4f63222e12f390486096533f5658a29
|
5baf423defc14d3d5607fc63b5b233ab90593d9d
|
refs/heads/master
| 2022-12-23T09:28:05.508781
| 2020-12-12T02:04:21
| 2020-12-12T02:04:21
| 178,626,322
| 0
| 0
| null | 2022-12-15T23:48:05
| 2019-03-31T00:39:28
|
JavaScript
|
UTF-8
|
Java
| false
| false
| 4,847
|
java
|
package vo;
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;
public class ModifyEquipment extends BaseEquipmentAttachment{
private String airframe;
private String propulsion;
private String battery;
private String controller;
private String payload;
public String getAirframe() {
return airframe;
}
public void setAirframe(String airframe) {
this.airframe = airframe;
}
public String getPropulsion() {
return propulsion;
}
public void setPropulsion(String propulsion) {
this.propulsion = propulsion;
}
public String getBattery() {
return battery;
}
public void setBattery(String battery) {
this.battery = battery;
}
public String getController() {
return controller;
}
public void setController(String controller) {
this.controller = controller;
}
public String getPayload() {
return payload;
}
public void setPayload(String payload) {
this.payload = payload;
}
public String getOthers() {
return others;
}
public void setOthers(String others) {
this.others = others;
}
public String getAirframe_comment() {
return airframe_comment;
}
public void setAirframe_comment(String airframe_comment) {
this.airframe_comment = airframe_comment;
}
public String getPropulsion_comment() {
return propulsion_comment;
}
public void setPropulsion_comment(String propulsion_comment) {
this.propulsion_comment = propulsion_comment;
}
public String getBattery_comment() {
return battery_comment;
}
public void setBattery_comment(String battery_comment) {
this.battery_comment = battery_comment;
}
public String getController_comment() {
return controller_comment;
}
public void setController_comment(String controller_comment) {
this.controller_comment = controller_comment;
}
public String getPayload_comment() {
return payload_comment;
}
public void setPayload_comment(String payload_comment) {
this.payload_comment = payload_comment;
}
public String getOthers_comment() {
return others_comment;
}
public void setOthers_comment(String others_comment) {
this.others_comment = others_comment;
}
public String getAirframe_photo() {
return airframe_photo;
}
public void setAirframe_photo(String airframe_photo) {
this.airframe_photo = airframe_photo;
}
public String getPropulsion_photo() {
return propulsion_photo;
}
public void setPropulsion_photo(String propulsion_photo) {
this.propulsion_photo = propulsion_photo;
}
public String getBattery_photo() {
return battery_photo;
}
public void setBattery_photo(String battery_photo) {
this.battery_photo = battery_photo;
}
public String getController_photo() {
return controller_photo;
}
public void setController_photo(String controller_photo) {
this.controller_photo = controller_photo;
}
public String getPayload_photo() {
return payload_photo;
}
public void setPayload_photo(String payload_photo) {
this.payload_photo = payload_photo;
}
public String getOthers_photo() {
return others_photo;
}
public void setOthers_photo(String others_photo) {
this.others_photo = others_photo;
}
private String others;
private String airframe_comment;
private String propulsion_comment;
private String battery_comment;
private String controller_comment;
private String payload_comment;
private String others_comment;
private String airframe_photo;
private String propulsion_photo;
private String battery_photo;
private String controller_photo;
private String payload_photo;
private String others_photo;
public Map<String,TempAttach> getResultHashMap(){
Map<String,TempAttach> map = new HashMap<String,TempAttach>();
if(!this.getClass().getSuperclass().equals(Object.class)){
Class<?> c = this.getClass();
Field[] fields = c.getDeclaredFields();
for(int i =0;i<fields.length;i++){
Field field = fields[i];
field.setAccessible(true);
String key = null;
TempAttach tempAttach = null;
String value_status = null;
String value_comment = null;
String modificationPhoto = null;
try {
key = detailMap.get(field.getName());
if (key != null) {
value_status = (String) field.get(this);
value_comment = (String) c.getDeclaredField(field.getName() + "_comment").get(this);
modificationPhoto = (String) c.getDeclaredField(field.getName() + "_photo").get(this);
tempAttach = new TempAttach(key, value_status, value_comment, modificationPhoto);
}
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (NoSuchFieldException e) {
e.printStackTrace();
} catch (SecurityException e) {
e.printStackTrace();
}
if (key != null && tempAttach != null) {
map.put(key, tempAttach);
}
}
}
return map;
}
}
|
[
"a830144@gmail.com"
] |
a830144@gmail.com
|
51ea2b9f14cc0cb8861f8d3e1787b52bd710f9d6
|
d1eb6e875f89e3e751e5629b9c22c20da2bf42e2
|
/mid_lab_solutions/AfterMid_PersonalExercises/src/streams/creation/ByStreamOfFromArguments.java
|
6c79da26c3b35bbc855cdcbc078bcbf493492fea
|
[] |
no_license
|
tsitotaw/CS_401_MPP
|
c8825403c9513dfb97b437c3f4506c6b0b879070
|
6be79542b4436ab33b6678fc01416fb15168df06
|
refs/heads/main
| 2023-09-05T19:45:55.104466
| 2021-10-22T12:52:18
| 2021-10-22T12:52:18
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 223
|
java
|
package streams.creation;
import java.util.stream.Stream;
public class ByStreamOfFromArguments {
public static void main(String[] args) {
Stream.of("hello", "world", "is")
.forEach(System.out::println);
}
}
|
[
"tamiratfissehasitotaw@gmail.com"
] |
tamiratfissehasitotaw@gmail.com
|
4a2f9490b0023d47e8f583275d05aa26722a0082
|
debb5ad644bbe59374a5d28f467fb0c1f3e07fdc
|
/dalesbred/src/main/java/org/dalesbred/package-info.java
|
e17002e4322f85a490a23a34ca06cb6dccc7817a
|
[
"MIT"
] |
permissive
|
EvidentSolutions/dalesbred
|
1c5932c5da5cffdfe21193d945749bceecd173e3
|
eb5dced5cd793efc7506b99214517efd0acb0a3f
|
refs/heads/main
| 2023-02-07T04:36:05.195550
| 2023-01-31T13:49:38
| 2023-01-31T13:49:38
| 32,988,487
| 60
| 22
|
MIT
| 2022-07-01T14:34:17
| 2015-03-27T13:47:20
|
Java
|
UTF-8
|
Java
| false
| false
| 1,276
|
java
|
/*
* Copyright (c) 2015 Evident Solutions Oy
*
* 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.
*/
/**
* Contains the most important classes, most notably {@link org.dalesbred.Database}.
*
* @see org.dalesbred.Database
*/
package org.dalesbred;
|
[
"juha.komulainen@evident.fi"
] |
juha.komulainen@evident.fi
|
cf212e56ba8309ed919764b8977d41da1018e649
|
8a78f7d4cc4276c7c93b3db0337f8c72c3aec73e
|
/gmall-api/src/main/java/bean/PmsSkuSaleAttrValue.java
|
dfe467d50e2933245515f66b054a678435dce357
|
[] |
no_license
|
ggbombgg/gmall0113
|
3bf0a79c98a3ad1a177dc4f4dd1230dd268a1718
|
be359102ac6c25bed3a30f754a38e65c9e5b6033
|
refs/heads/master
| 2022-09-11T02:13:04.106188
| 2020-01-20T16:56:02
| 2020-01-20T16:56:02
| 233,550,036
| 0
| 0
| null | 2022-09-01T23:18:58
| 2020-01-13T08:44:58
|
Java
|
UTF-8
|
Java
| false
| false
| 1,424
|
java
|
package bean;
import javax.persistence.Column;
import javax.persistence.Id;
import java.io.Serializable;
/**
* @param
* @return
*/
public class PmsSkuSaleAttrValue implements Serializable {
@Id
@Column
String id;
@Column
String skuId;
@Column
String saleAttrId;
@Column
String saleAttrValueId;
@Column
String saleAttrName;
@Column
String saleAttrValueName;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getSkuId() {
return skuId;
}
public void setSkuId(String skuId) {
this.skuId = skuId;
}
public String getSaleAttrId() {
return saleAttrId;
}
public void setSaleAttrId(String saleAttrId) {
this.saleAttrId = saleAttrId;
}
public String getSaleAttrValueId() {
return saleAttrValueId;
}
public void setSaleAttrValueId(String saleAttrValueId) {
this.saleAttrValueId = saleAttrValueId;
}
public String getSaleAttrName() {
return saleAttrName;
}
public void setSaleAttrName(String saleAttrName) {
this.saleAttrName = saleAttrName;
}
public String getSaleAttrValueName() {
return saleAttrValueName;
}
public void setSaleAttrValueName(String saleAttrValueName) {
this.saleAttrValueName = saleAttrValueName;
}
}
|
[
"815246875@qq.com"
] |
815246875@qq.com
|
cd33b7e794baf7230e9506f38d75db5c80cd813f
|
b8e3e449651bd64e5c126b5f91853428a595b5d8
|
/portal-application/src/main/java/com/similan/portal/view/collabspace/CollabWorkspaceHistoryView.java
|
bcedd98e7dc719ac35c3bb86494d0b294824a498
|
[] |
no_license
|
suparna2702/ServiceFabric
|
ee5801a346fda63edf0bea75103e693e52037fc4
|
d526376f9530f608726fa6ad1b7912b4ec384a82
|
refs/heads/master
| 2021-03-22T04:40:41.688184
| 2016-12-06T02:06:38
| 2016-12-06T02:06:38
| 75,250,704
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,474
|
java
|
package com.similan.portal.view.collabspace;
import java.util.List;
import javax.annotation.PostConstruct;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import com.similan.domain.entity.community.PhotoViewOption;
import com.similan.framework.dto.OrganizationDetailInfoDto;
import com.similan.framework.dto.member.MemberInfoDto;
import com.similan.portal.view.BaseView;
import com.similan.service.api.collaborationworkspace.dto.basic.CollaborationWorkspaceDto;
import com.similan.service.api.collaborationworkspace.dto.key.CollaborationWorkspaceKey;
import com.similan.service.api.wall.dto.basic.WallEntryDto;
import com.similan.service.api.wall.dto.key.WallKey;
@Scope("view")
@Component("workspaceHistoryView")
@Slf4j
public class CollabWorkspaceHistoryView extends BaseView {
private static final long serialVersionUID = 1L;
@Autowired
private MemberInfoDto member;
@Autowired
private OrganizationDetailInfoDto orgInfo;
private CollaborationWorkspaceDto workspace;
private List<WallEntryDto<CollaborationWorkspaceKey>> wallEntries = null;
@PostConstruct
public void init() {
log.info("Initializing workspace history view");
String workSpaceName = this.getContextParam("wsname");
String workSpaceOwnerName = this.getContextParam("owsname");
log.info("Workspace name " + workSpaceName + " owner name " + workSpaceOwnerName);
if (workSpaceName != null) {
CollaborationWorkspaceKey workspaceKey = new CollaborationWorkspaceKey(workSpaceOwnerName, workSpaceName);
this.workspace = this.getCollabWorkspaceService().getDetail(workspaceKey);
this.fetchLatestWallEntries();
}
}
private void fetchLatestWallEntries(){
/* get the wall */
WallKey<CollaborationWorkspaceKey> wallKey = new WallKey<CollaborationWorkspaceKey>(this.workspace.getKey());
wallEntries = this.getWallService().getLatest(wallKey);
}
public String getWorkspaceLogo(){
return PhotoViewOption.ShowPhoto.effectivePhoto("images/businessLogo.jpg",
workspace.getLogo());
}
public MemberInfoDto getMember() {
return member;
}
public OrganizationDetailInfoDto getOrgInfo() {
return orgInfo;
}
public CollaborationWorkspaceDto getWorkspace() {
return workspace;
}
public List<WallEntryDto<CollaborationWorkspaceKey>> getWallEntries() {
return wallEntries;
}
}
|
[
"suparna2702@gmail.com"
] |
suparna2702@gmail.com
|
49341359d4d0a80943a90d5148af6edebcc61cc8
|
274ede4a61b95d2a665de77ba811d4ddf3f0d712
|
/discovery-server/src/main/java/app/metatron/discovery/domain/workbook/configurations/datasource/JoinMapping.java
|
d21eab61733f960d888ecdd449607bdd3721272c
|
[
"Apache-2.0",
"GPL-2.0-only",
"OFL-1.1",
"LGPL-2.1-or-later",
"MIT",
"LGPL-2.0-or-later",
"EPL-1.0",
"BSD-3-Clause"
] |
permissive
|
metatron-app/metatron-discovery
|
0c33c9272eddc25de3250685f4881ccd265271bc
|
08c838b4c09fb2e2b83f560aeba71887711bd546
|
refs/heads/master
| 2023-08-12T19:05:35.272532
| 2023-05-19T04:00:28
| 2023-05-19T04:00:28
| 142,546,516
| 3,762
| 325
|
Apache-2.0
| 2023-07-18T20:52:04
| 2018-07-27T07:54:46
|
TypeScript
|
UTF-8
|
Java
| false
| false
| 3,214
|
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 app.metatron.discovery.domain.workbook.configurations.datasource;
import com.google.common.base.Preconditions;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.apache.commons.lang.StringUtils;
import java.io.Serializable;
import java.util.Map;
import javax.validation.constraints.NotNull;
import app.metatron.discovery.domain.datasource.DataSource;
public class JoinMapping implements Serializable {
/**
* Join Type
*/
@NotNull
JoinType type;
/**
* 데이터 소스 Name
*/
String name;
/**
* 데이터 소스 Name Alias, 하위 Join 수행시 namespace 로 활용
*/
String joinAlias;
/**
* Join 할 Mutliple KeyMap, key : Mater Key , value : Lookup Key
*/
Map<String, String> keyPair;
/**
* 하위에 조인할 join 정보
*/
JoinMapping join;
/**
* Biz. Logic 용 객체(스펙과 관련 없음)
*/
@JsonIgnore
app.metatron.discovery.domain.datasource.DataSource metaDataSource;
public JoinMapping(
@JsonProperty("name") String name,
@JsonProperty("joinAlias") String joinAlias,
@JsonProperty("type") String type,
@JsonProperty("keyPair") Map<String, String> keyPair,
@JsonProperty("join") JoinMapping join) {
if(StringUtils.isEmpty(name)) {
throw new IllegalArgumentException("'name' properties required ");
}
this.name = name;
this.joinAlias = StringUtils.isEmpty(joinAlias) ? name : joinAlias;
this.type = JoinType.valueOf(Preconditions.checkNotNull(type).toUpperCase());
this.keyPair = keyPair;
this.join = join;
}
public JoinType getType() {
return type;
}
public void setType(JoinType type) {
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Map<String, String> getKeyPair() {
return keyPair;
}
public void setKeyPair(Map<String, String> keyPair) {
this.keyPair = keyPair;
}
public JoinMapping getJoin() {
return join;
}
public void setJoin(JoinMapping join) {
this.join = join;
}
public String getJoinAlias() {
return joinAlias;
}
public void setJoinAlias(String joinAlias) {
this.joinAlias = joinAlias;
}
public DataSource getMetaDataSource() {
return metaDataSource;
}
public void setMetaDataSource(DataSource metaDataSource) {
this.metaDataSource = metaDataSource;
}
/**
* 연결(Join) 타입
*/
public enum JoinType {
INNER,
LEFT_OUTER,
RIGHT_OUTER, // Not Supported
FULL // Not Supported
}
}
|
[
"kyungtaak@sk.com"
] |
kyungtaak@sk.com
|
1789281560f95b2da5d60f87677bcc99ee2761f5
|
5f706495d24cb3535bc09aec3158de8318f5dd0f
|
/gvr-performance/gvrperformance/src/main/java/org/gearvrf/performance/TestActivity.java
|
e641663958d381c209afd7606e573c5de72ba8cc
|
[] |
no_license
|
Hankay/GearVRf-Demos
|
d4aa1a5d108e05e3d4c2220bccc334731705b6c5
|
feb4fc247c36b519f716c963105815a4aa03d683
|
refs/heads/master
| 2021-01-22T05:33:25.539449
| 2016-05-06T18:29:10
| 2016-05-06T18:29:10
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 936
|
java
|
/* Copyright 2015 Samsung Electronics Co., LTD
*
* 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.gearvrf.performance;
import org.gearvrf.GVRActivity;
import android.os.Bundle;
public class TestActivity extends GVRActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setScript(new TestScript(this), "gvr_note4.xml");
}
}
|
[
"m.marinov@samsung.com"
] |
m.marinov@samsung.com
|
3878d8a88f10462cdc5ef8319e79e0301a2a6505
|
d2231b67b86ee2d434afade61d21420a3eabcf13
|
/src/com/res/cobol/syntaxtree/NumericConstant.java
|
a6dfded0614bdf6881e2ba015cf33d1b58a0c0a2
|
[] |
no_license
|
tcelio2/RES
|
64f3ec5ffe89189a345b50a09b607a2fcdf06272
|
b327088b4c5c7d9768fbd8b1dfeea36f2b9eac50
|
refs/heads/master
| 2021-01-10T02:53:05.750603
| 2015-06-02T15:28:19
| 2015-06-02T15:28:19
| 36,742,379
| 2
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,306
|
java
|
//
// Generated by JTB 1.3.2
//
package com.res.cobol.syntaxtree;
/**
* Grammar production:
* <PRE>
* nodeOptional -> ( <PLUSCHAR> | <MINUSCHAR> )?
* nodeChoice -> ( IntegerConstant() <DOTCHAR> [ IntegerConstant() ] | <DOTCHAR> IntegerConstant() | IntegerConstant() )
* </PRE>
*/
public class NumericConstant extends com.res.cobol.RESNode implements Node {
private Node parent;
public NodeOptional nodeOptional;
public NodeChoice nodeChoice;
public NumericConstant(NodeOptional n0, NodeChoice n1) {
nodeOptional = n0;
if ( nodeOptional != null ) nodeOptional.setParent(this);
nodeChoice = n1;
if ( nodeChoice != null ) nodeChoice.setParent(this);
}
public NumericConstant() {}
public void accept(com.res.cobol.visitor.Visitor v) {
v.visit(this);
}
public <R,A> R accept(com.res.cobol.visitor.GJVisitor<R,A> v, A argu) {
return v.visit(this,argu);
}
public <R> R accept(com.res.cobol.visitor.GJNoArguVisitor<R> v) {
return v.visit(this);
}
public <A> void accept(com.res.cobol.visitor.GJVoidVisitor<A> v, A argu) {
v.visit(this,argu);
}
public void setParent(Node n) { parent = n; }
public Node getParent() { return parent; }
}
|
[
"tpereirc@br.ibm.com"
] |
tpereirc@br.ibm.com
|
2ebfe7230a8002f37b5593f61478345c17abc046
|
2b2a858ff6d57a6779c9563c1ae5f6fed2620c5a
|
/app/src/test/java/com/commax/convertstringtohextest/ExampleUnitTest.java
|
9f3d61ceb1350c8957371bb7798a2d606a93367f
|
[] |
no_license
|
goodsogi/ConvertStringToHexTest
|
8bf6841462aa69fe29fb63661111dbf0685227da
|
1f9f7667d5ff72aa71a7e984818f1655314e6324
|
refs/heads/master
| 2020-09-27T11:49:23.151864
| 2016-09-02T08:24:30
| 2016-09-02T08:24:30
| 67,204,950
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 326
|
java
|
package com.commax.convertstringtohextest;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}
|
[
"goodsogi@gmail.com"
] |
goodsogi@gmail.com
|
cf2baf16d974242f46fc3e3e0556ec2432d90a5b
|
dab106ccb833c07119ea2b17cefe2bad521ef565
|
/shared/src/main/java/app/himawari/exentity/Member.java
|
8ef0fd53ef7f1e71e970f19233fa254cd8748078
|
[
"MIT"
] |
permissive
|
cxpqwvtj/himawari
|
8f6309152a2deead0209c6377fa4bc9bf6e8eb10
|
36e3586eae320a5b39d086cb102d33cfcd8bf606
|
refs/heads/master
| 2021-01-19T11:51:58.546132
| 2018-08-21T21:31:48
| 2018-08-21T21:31:48
| 69,770,215
| 0
| 0
|
MIT
| 2018-03-22T21:48:48
| 2016-10-02T00:01:39
|
Java
|
UTF-8
|
Java
| false
| false
| 410
|
java
|
package app.himawari.exentity;
import app.himawari.bsentity.BsMember;
/**
* The entity of MEMBER.
* <p>
* You can implement your original methods here.
* This class remains when re-generating.
* </p>
* @author DBFlute(AutoGenerator)
*/
public class Member extends BsMember {
/** The serial version UID for object serialization. (Default) */
private static final long serialVersionUID = 1L;
}
|
[
"cxpqwvtj@gmail.com"
] |
cxpqwvtj@gmail.com
|
9c7efb25919c78423f1c083ea2df551d3514c448
|
2ed7c4c05df3e2bdcb88caa0a993033e047fb29a
|
/common/com.raytheon.uf.common.util/src/com/raytheon/uf/common/util/Filter.java
|
299b93813eef0431db72098182a81d73392c0578
|
[] |
no_license
|
Unidata/awips2-core
|
d378a50c78994f85a27b481e6f77c792d1fe0684
|
ab00755b9e158ce66821b6fc05dee5d902421ab8
|
refs/heads/unidata_18.2.1
| 2023-07-22T12:41:05.308429
| 2023-02-13T20:02:40
| 2023-02-13T20:02:40
| 34,124,839
| 3
| 7
| null | 2023-07-06T15:40:45
| 2015-04-17T15:39:56
|
Java
|
UTF-8
|
Java
| false
| false
| 2,012
|
java
|
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.util;
import java.io.File;
import java.io.FileFilter;
/**
* Extension of the {@link FileFilter} class for any file type
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 06/14/06 garmendariz Initial check-in
*
* </pre>
*
* @author garmendariz
* @version 1.0
*/
public class Filter implements FileFilter {
/** A file type (jar, tiff, xml) - any case */
private String fileType;
/**
* Implementation of the {@link FileFilter#accept(File)} method to retrieve only files with the
* set file type.
*/
public boolean accept(File pathname) {
if (pathname.isDirectory()
|| pathname.getName().toUpperCase().endsWith("." + fileType.toUpperCase())) {
return true;
} else {
return false;
}
}
/**
* Retrieve the file extension
* @return A file extension
*/
public String getFileType()
{
return fileType;
}
/**
* Set the file type
* @param fileType A file extension
*/
public void setFileType(String fileType)
{
this.fileType = fileType;
}
}
|
[
"Steven_L_Harris@raytheon.com"
] |
Steven_L_Harris@raytheon.com
|
c597e5f7627f3f1cac70cb6ead2f5cdbecd2c4e3
|
93c68fe4de65ba5d2629a55bd431ada56a2997fc
|
/src/com/rapidminer/lcm/internals/tidlist/IntConsecutiveItemsConcatenatedTidList.java
|
f3cef158abfbde21b602ffbd8f364204d5415918
|
[] |
no_license
|
shubhampachori12110095/rmlcm
|
a8cd0dadc193e92b3845b8ea38d099d2591c9379
|
23d1358d0677d52e4d2a1a2fbf10b0ccf2e972a3
|
refs/heads/master
| 2020-03-09T12:36:38.744174
| 2014-07-25T12:17:49
| 2014-07-25T12:17:49
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,768
|
java
|
/*
This file is part of jLCM
Copyright 2013 Martin Kirchgessner, Vincent Leroy, Alexandre Termier, Sihem Amer-Yahia, Marie-Christine Rousset, Université Joseph Fourier and CNRS
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
or see the LICENSE.txt file joined with this program.
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.rapidminer.lcm.internals.tidlist;
import java.util.Arrays;
import com.rapidminer.lcm.internals.Counters;
public class IntConsecutiveItemsConcatenatedTidList extends ConsecutiveItemsConcatenatedTidList {
public static boolean compatible(int maxTid) {
return true;
}
private int[] array;
@Override
public TidList clone() {
IntConsecutiveItemsConcatenatedTidList o = (IntConsecutiveItemsConcatenatedTidList) super.clone();
o.array = Arrays.copyOf(this.array, this.array.length);
return o;
}
@Override
void allocateArray(int size) {
this.array = new int[size];
}
@Override
void write(int position, int transaction) {
this.array[position] = transaction;
}
@Override
int read(int position) {
return this.array[position];
}
public IntConsecutiveItemsConcatenatedTidList(Counters c, int highestItem) {
super(c, highestItem);
}
public IntConsecutiveItemsConcatenatedTidList(int[] lengths, int highestItem) {
super(lengths, highestItem);
}
}
|
[
"johnwufr@gmail.com"
] |
johnwufr@gmail.com
|
74db09c0913b1219ef80d2229a807f57b28e4730
|
c007084673962e81095bf141d30e2146f1f8fcbb
|
/CTCI_Java_LinkListDupeRemoval/src/RemoveDupes.java
|
bfe86cef521a890884aaa217fcdfce5a666bb899
|
[] |
no_license
|
huksu/Random
|
b0e8f5d0d3f519a0a51cec777b7b3b79e5a9f7da
|
40851815aecfcb0b6f46edaa68f232e5664143a4
|
refs/heads/master
| 2021-01-10T10:11:34.474154
| 2016-04-02T02:54:24
| 2016-04-02T02:54:24
| 53,681,376
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 4,404
|
java
|
/**
* Created by thuskinson on 3/18/2016.
* Write code to remove duplicates from an unsorted linked list.
* Follow up: How would you solve this problem if a temporary buffer was not allowed?
*/
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.HashSet;
import java.util.Hashtable;
public class RemoveDupes {
public static class Node<N> {
Node<N> next = null;
N data;
public Node(N data){
this.data = data;
}
public Node<N> append(N data){
return(this.next = new Node<N>(data));
}
}
public static void main(String [] args){
String fileName = args[0];
RemoveDupes(fileName);
RemoveDupes2(fileName);
RemoveDupes3(fileName);
}
private static void RemoveDupes(String fileName){
Node<Integer> head = new Node(null); // first node is null
readFile(fileName, head);
Node<Integer> n = head.next;
Node<Integer> trailer = head;
HashSet<Integer> hashSet = new HashSet<>();
while(n != null) {
if(!hashSet.contains(n.data)){
hashSet.add(n.data);
trailer = n;
} else {
// drop the node from the list
trailer.next = n.next;
}
n = n.next;
}
System.out.println("Cleaned List: ");
n = head.next;
while(n != null) {
System.out.println(n.data);
n = n.next;
}
}
private static void RemoveDupes2(String fileName){
Node<Integer> head = new Node(null); // first node is null
readFile(fileName, head);
HashSet<Integer> hashSet = new HashSet<>();
Node<Integer> n = head.next;
hashSet.add(n.data);
while(n.next != null){
if(!hashSet.contains(n.next.data)){
hashSet.add(n.next.data);
n = n.next;
} else {
// drop the node from the list
if(n.next == null){
n.next = null;
} else {
n.next = n.next.next;
}
}
}
System.out.println("Cleaned List: ");
n = head.next;
while(n != null) {
System.out.println(n.data);
n = n.next;
}
}
private static void RemoveDupes3(String fileName){
// Let's avoid use of the hash table for O(n^2) complexity
Node<Integer> head = new Node(null); // first node is null
readFile(fileName, head);
Node<Integer> n = head.next;
while(n != null) {
Node<Integer> next = n.next;
Node<Integer> trailer = n;
while(next != null){
if(n.data == next.data){
// remove next from the linked list
trailer.next = next.next;
} else {
// keep on truckin...
trailer = next;
}
next = next.next;
}
n = n.next;
}
System.out.println("Cleaned List: ");
n = head.next;
while(n != null) {
System.out.println(n.data);
n = n.next;
}
}
private static void readFile(String fileName, Node<Integer> n){
// This will reference one line at a time
String line = null;
try {
// FileReader reads text files in the default encoding.
FileReader fileReader =
new FileReader(fileName);
// Always wrap FileReader in BufferedReader.
BufferedReader bufferedReader =
new BufferedReader(fileReader);
while((line = bufferedReader.readLine()) != null) {
n = n.append(Integer.parseInt(line));
}
// Always close files.
bufferedReader.close();
}
catch(FileNotFoundException ex) {
System.out.println(
"Unable to open file '" +
fileName + "'");
}
catch(IOException ex) {
System.out.println(
"Error reading file '"
+ fileName + "'");
}
}
}
|
[
"thuskinson@thuskinson.OptimalBlue.local"
] |
thuskinson@thuskinson.OptimalBlue.local
|
9a5478d28e14310298fb8bc8db85c48f850c79cf
|
52f93ad5313982af8f23046ad789b1ec071c5c1e
|
/src/main/java/com/springmongo/resources/UserResource.java
|
78f9596cf8cda7163da47724c0b589d1d03f1975
|
[] |
no_license
|
harlenmendes/spring-mongo
|
547d0fe5e253a0ec51653cc3dd0b75920ac97ae2
|
fe9e76af4180905db53113a18308c3b93b9b5b4b
|
refs/heads/master
| 2023-03-13T23:12:47.510362
| 2021-03-15T12:59:42
| 2021-03-15T12:59:42
| 347,676,629
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 806
|
java
|
package com.springmongo.resources;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.springmongo.domain.User;
@RestController
@RequestMapping(value = "/users")
public class UserResource {
@RequestMapping(method=RequestMethod.GET)
public ResponseEntity<List<User>> findAll(){
User maria = new User("1", "Maria", "maria@maria.com");
User alex = new User("2", "Alex", "alex@alex.com");
List<User> list = new ArrayList<>();
list.addAll(Arrays.asList(maria,alex));
return ResponseEntity.ok().body(list);
}
}
|
[
"harlenmendes@gmail.com"
] |
harlenmendes@gmail.com
|
88e40c7e37f1d662135a74681fcd6eccdca73d7f
|
a6338f4c762b0dcc7ae1a888bfc5e3389f74506c
|
/app/src/main/java/com/example/administrator/myapp/util/MD5.java
|
9a1bb3f472b68f293db7592b3c7b63de766d5dd5
|
[
"Apache-2.0"
] |
permissive
|
carey111/myapp
|
8ad1d1584fcd35c454d67a6d98c38df005e6019f
|
e4ddc229f3584f130e372f5c25153062f4e70855
|
refs/heads/master
| 2021-01-12T16:14:52.309841
| 2016-11-02T12:21:40
| 2016-11-02T12:21:40
| 71,958,359
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,079
|
java
|
package com.example.administrator.myapp.util;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class MD5 {
public static String SHA1(String decript) {
try {
MessageDigest digest = MessageDigest
.getInstance("SHA-1");
digest.update(decript.getBytes());
byte messageDigest[] = digest.digest();
// Create Hex String
StringBuffer hexString = new StringBuffer();
for (int i = 0; i < messageDigest.length; i++) {
String shaHex = Integer.toHexString(messageDigest[i] & 0xFF);
if (shaHex.length() < 2) {
hexString.append(0);
}
hexString.append(shaHex);
}
return hexString.toString();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
return "";
}
public static String getMD5(String str) throws NoSuchAlgorithmException {
MessageDigest md5 = null;
try {
md5 = MessageDigest.getInstance("MD5");
} catch (Exception e) {
e.printStackTrace();
return "";
}
char[] charArray = str.toCharArray();
byte[] byteArray = new byte[charArray.length];
for (int i = 0; i < charArray.length; i++) {
byteArray[i] = (byte) charArray[i];
}
byte[] md5Bytes = md5.digest(byteArray);
StringBuffer hexValue = new StringBuffer();
for (int i = 0; i < md5Bytes.length; i++) {
int val = ((int) md5Bytes[i]) & 0xff;
if (val < 16) {
hexValue.append("0");
}
hexValue.append(Integer.toHexString(val));
}
return hexValue.toString();
}
public static String byte2hex(byte[] b) {
String hs = "";
String stmp = "";
for (int n = 0; n < b.length; n++) {
stmp = (Integer.toHexString(b[n] & 0XFF));
if (stmp.length() == 1) {
hs = hs + "0" + stmp;
} else {
hs = hs + stmp;
}
}
return hs;
}
public static String encryptToSHA(String info) {
byte[] digesta = null;
try {
MessageDigest alga = MessageDigest.getInstance("SHA-1");
alga.update(info.getBytes());
digesta = alga.digest();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
String rs = byte2hex(digesta);
return rs;
}
}
|
[
"1453647869@qq.com"
] |
1453647869@qq.com
|
20c613aa4d8ad41025451051afdb6ec20a3d86a2
|
0796303f27f8e8bc01fe8790316676e4547b291b
|
/src/main/java/org/twuni/money/treasury/responder/EvaluateResponder.java
|
2f2e994ea0fc8e30998e8adbba0310de33f24467
|
[
"Apache-2.0"
] |
permissive
|
twuni/treasury-server
|
429a501ee789c80581af9ab2a117c0e317e894a4
|
37e8cd3bd2bd946d5e95a17e9f51236c55281177
|
refs/heads/master
| 2019-01-19T17:50:38.967179
| 2011-08-12T03:21:18
| 2011-08-12T03:21:18
| 2,074,351
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 816
|
java
|
package org.twuni.money.treasury.responder;
import org.twuni.common.net.http.request.Request;
import org.twuni.common.net.http.responder.Responder;
import org.twuni.common.net.http.response.Response;
import org.twuni.common.net.http.response.Status;
import org.twuni.common.persistence.Connection;
import org.twuni.money.treasury.responder.transaction.EvaluateTransaction;
public class EvaluateResponder implements Responder {
private final Connection connection;
public EvaluateResponder( Connection connection ) {
this.connection = connection;
}
@Override
public Response respondTo( Request request ) {
EvaluateTransaction transaction = new EvaluateTransaction( new String( request.getContent() ) );
connection.run( transaction );
return new Response( Status.OK, transaction.getResult() );
}
}
|
[
"github.aeonic@spamgourmet.com"
] |
github.aeonic@spamgourmet.com
|
c8f75b86895703ed468d633864737a4d715bd0ed
|
fee9ecf7044ead289672305fe1f9573b409f8713
|
/File_demos/create_file.java
|
c0c9516f497f198bfaffa93269c1330293409127
|
[] |
no_license
|
benittobeny34/Java
|
1e3492f20d837560ecd6d10ec948701883fe235d
|
f6119d05db0c42303e9af4d9ec65c4488641cf26
|
refs/heads/master
| 2022-12-16T01:14:23.992506
| 2020-09-10T17:16:54
| 2020-09-10T17:16:54
| 294,474,947
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 488
|
java
|
package File_demos;
import java.io.File;
import java.io.FileOutputStream;
public class create_file
{
public static void main(String args[]) throws Exception
{
File f = new File("java.txt");
String msg = "java is a object oriented programming"+" this is my firt program for file operation";
byte buffer[] = msg.getBytes();
FileOutputStream fos = new FileOutputStream(f);
fos.write(buffer);
fos.close();
}
}
|
[
"brendonbeni42@gmail.com"
] |
brendonbeni42@gmail.com
|
3d2598ceb5cbb78ab26fec5bd372b3a0a9e205fc
|
061258da953c5e92f225d038e964b8b7c293b98e
|
/RadioApp/app/src/main/java/com/gobeike/radioapp/config/Constants.java
|
8b273a51f602963a627dc3d61088fe9efc361f5d
|
[] |
no_license
|
1049884729/xinlingfamen
|
4d08424e18fe4e78395e573e2ef59c62475ede9b
|
c769d1f2f88bc13801113504f81ee2cc8cd4fc2c
|
refs/heads/master
| 2020-04-12T06:43:56.559484
| 2017-06-16T09:19:35
| 2017-06-16T09:19:35
| 65,865,591
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,209
|
java
|
package com.gobeike.radioapp.config;
import android.os.Environment;
/**
* Created by xuff on 17-3-17.
*/
public class Constants
{
public static String PLAY_BUTTON_URL = "playMusic_url";
/**
* 播放按钮的状态
*/
public static String PLAY_BUTTON_STATE = "playMusic_state";
public static String[] music_List =
{"http://192.168.1.15:8080/gaoshanliushui.mp3", "http://192.168.1.15:8080/pipayu.mp3",
"http://192.168.1.15:8080/yunshui.mp3", "http://192.168.1.15:8080/yuzhouchangwan.mp3"};
public static String[] music_List_local = {Environment.getExternalStorageDirectory() + "/Music/test.mp3"};
public static String MUSIC_SEEKBAR_VALUE = "seekbarValue";
public static String MUSIC_ACTION = "Music_Action";
public final static int ACTION_playMusic = 1;
public final static int ACTION_pauseMusic = 2;
public final static int ACTION_seekbarToMusic = 3;
public final static int ACTION_nextMusic = 4;
public final static int ACTION_preMusic = 5;
public final static int ACTION_downloadMusic = 6;
public final static int ACTION_pointToplayMusic = 7;
}
|
[
"1049884729@qq.com"
] |
1049884729@qq.com
|
823e57948a7e27aada1024e402fff89586f47a71
|
1742f7078f56fd1de814402c3ffd8a678d344bae
|
/src/main/java/com/sxt/sys/service/qxs/finance/AccountServiceI.java
|
0f2774c71c46f272b581e70985deec43d0f753c3
|
[] |
no_license
|
winterming23/xterp
|
350107d45db41a8161da9c6cc21f97b62541ddb6
|
84df33d28d1bab88b6c7283669e41e2478bd9070
|
refs/heads/master
| 2022-07-26T09:41:09.529039
| 2020-01-07T03:36:24
| 2020-01-07T03:37:54
| 228,287,504
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,105
|
java
|
package com.sxt.sys.service.qxs.finance;
import com.sxt.sys.domain.qxs.finance.Account;
import java.util.List;
/**
* 账号信息业务处理
*/
public interface AccountServiceI {
/**
* 查询所有未删除的账号信息
* @return
*/
List<Account> queryNotDeleteAccount();
/**
* 查询所有已删除的记录
* @return
*/
List<Account> queryDeleteAccount();
/**
* 查询所有数据包括已删除的
* @return
*/
List<Account> queryAllAccount();
/**
* 根据id查询当前信息
* @param id
* @return
*/
Account getOneAccount(Integer id);
/**
* 修改账号信息
* @param account
* @return
*/
boolean updateAccount(Account account);
/**
* 标记删除
* @param deleteFlag 0:未删除;1:已删除; 默认 0
* @param id
* @return
*/
boolean deleteAccount(Integer deleteFlag, Integer id);
/**
* 新增账号信息
* @param account
* @return
*/
boolean addAccount(Account account, String name);
}
|
[
"1272134864@qq.com"
] |
1272134864@qq.com
|
48a5de6fe0cb94ec6f8785aff54eaf749448378e
|
331676cd6f30cdcf9c07b4427f7bd23dd3fe4bc8
|
/src/main/java/com/mybatis/model/Words.java
|
72fc03a8365e193127793512a041c7a82bfab11f
|
[] |
no_license
|
none1982/mybatis
|
79b0af27b5d0580d60e52f15b3e065314ee40d9a
|
fb3d7e281f89404dc1b9e283c24dc2323d046f42
|
refs/heads/master
| 2020-09-05T22:16:57.642899
| 2017-08-18T09:26:06
| 2017-08-18T09:26:06
| 100,469,702
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,083
|
java
|
package com.mybatis.model;
public class Words {
private String word;
private int count;
public String getWord() {
return word;
}
public void setWord(String word) {
this.word = word;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + count;
result = prime * result + ((word == null) ? 0 : word.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Words other = (Words) obj;
if (count != other.count)
return false;
if (word == null) {
if (other.word != null)
return false;
} else if (!word.equals(other.word))
return false;
return true;
}
@Override
public String toString() {
return "Words [word=" + word + ", count=" + count + "]";
}
}
|
[
"noneman@ms73.url.com.tw"
] |
noneman@ms73.url.com.tw
|
e975cd745337d9b8ac626a5de1ef495cd7bc0d8e
|
9954a0323d4b2898d7a9441620a47401cbf97b4f
|
/Backend. Spring example/impl/redmine/dto/IssueDTO.java
|
0c9cf421c5d2d86278b3ccbb33e705ec97ccfcf7
|
[] |
no_license
|
SvetlanaSuvorova/code-example
|
eb6d023b7d739b7eb783cd22166a3b80fcc96d89
|
8dd3fd3442fe5e3500563545628ca68453c37285
|
refs/heads/master
| 2022-07-17T18:41:35.585388
| 2020-02-28T16:49:48
| 2020-02-28T16:49:48
| 210,335,825
| 1
| 0
| null | 2022-05-26T02:10:42
| 2019-09-23T11:16:41
|
C
|
UTF-8
|
Java
| false
| false
| 1,140
|
java
|
package ...widget.impl.redmine.dto;
/*
* DTO class to display issue data received from the external tracking tool on the client.
*/
public class IssueDTO {
private int id;
private String description;
private String priorityText;
private String subject;
public IssueDTO(final int id, final String subject, final String description, final String priorityText) {
this.id = id;
this.subject = subject;
this.description = description;
this.priorityText = priorityText;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getPriorityText() {
return priorityText;
}
public void setPriorityText(String priorityText) {
this.priorityText = priorityText;
}
}
|
[
"svs@soft-werke.com"
] |
svs@soft-werke.com
|
162c1fe7d96c82025fb79a0de62dbde31e9f1a7a
|
afd9545b214c36a971f1200d56d368801833d1e2
|
/TestGIT.java
|
0a06d566e775a184ff26ce0760846db0cebc33c0
|
[] |
no_license
|
alxparahin/Lesson3
|
a2f943d5536b5fbb50a8d8f2316e888e16226906
|
ddbf4264ada0a590827df289e356f1dabb36457d
|
refs/heads/master
| 2020-08-10T01:43:46.445854
| 2019-10-10T18:34:50
| 2019-10-10T18:34:50
| 214,224,018
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 48
|
java
|
public class TestGIT {
private byte varB;
}
|
[
"Parakhin.A.Vla@sberbank.ru"
] |
Parakhin.A.Vla@sberbank.ru
|
9001cfddada00a7ea36c6ec5d70ff83566468d5e
|
7b5d77754f74dade6936ddc76cffd4ac3aed9c8e
|
/Routing_Scheme/Routing/src/ads/TrieNode.java
|
9f2df880529ef8e0d832237c56305a31f321cca6
|
[] |
no_license
|
DeepakNair90/Routing_Scheme
|
4f87e56ac52de996e3e895c04b57aa68f678b08c
|
79821010b78669881da09da96b03578fc7b0a8a2
|
refs/heads/master
| 2021-01-02T08:19:28.602498
| 2015-07-25T16:36:41
| 2015-07-25T16:36:41
| 39,670,342
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 437
|
java
|
//AUTHOR - DEEPAK NAIR UFID:13361231
package ads;
//TRIENODE CLASS WHICH DEFINES NODES OF TRIE BEING BUILT ON ROUTERS
public class TrieNode
{
TrieNode left;
TrieNode right;
int data;
boolean isLeaf;
TrieNode parent;
public TrieNode()
{
left = null;
right = null;
parent=null;
isLeaf=false;
data=-1;
}
public TrieNode(int value)
{
left = null;
right = null;
parent=null;
isLeaf=false;
data=value;
}
}
|
[
"deepakvnair1990@hotmail.com"
] |
deepakvnair1990@hotmail.com
|
829c3a1eb645ea76c70b43484d883cfe33f272e1
|
558df4cc0edfa11e917ee7f6aede586cd8587fac
|
/Electricos/src/ptovta/DomEnt.java
|
e374a38620e6ca4a4ec55bca3a2f745a3d55a439
|
[] |
no_license
|
njmube/SOSDev
|
58ed1bbac2bdb91536b20017713127741f944ab8
|
7b9d44de6ec1d61ae7f6bf18184f4b51b55972c0
|
refs/heads/master
| 2020-06-10T12:22:45.426839
| 2015-12-18T17:45:14
| 2015-12-18T17:45:14
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 78,564
|
java
|
//Paquete
package ptovta;
//Importaciones
import static ptovta.Princip.bIdle;
import java.awt.Cursor;
import javax.swing.table.DefaultTableModel;
import java.awt.event.KeyEvent;
import java.io.IOException;
import java.net.URISyntaxException;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
/*Clase para modificar la dirección de envio*/
public class DomEnt extends javax.swing.JFrame
{
/*Contiene el color original del botón*/
private final java.awt.Color colOri;
/*Contiene el contador de filas*/
private int iContFi;
/*Contiene la referencia de la tabla del otro formulario para tener acceso a las variables*/
private final javax.swing.JTable jTabDom;
/*Constructor sin argumentos*/
public DomEnt(javax.swing.JTable jTabD)
{
/*Inicaliza los componentes gráficos*/
initComponents();
/*Crea el listener para cuando se cambia de selección en la tabla*/
jTab.getSelectionModel().addListSelectionListener(new ListSelectionListener()
{
@Override
public void valueChanged(ListSelectionEvent lse)
{
/*Si no hay selección regresa*/
if(jTab.getSelectedRow()==-1)
return;
/*Carga todos los datos de la tabla en los controles*/
jTTel.setText (jTabDom.getValueAt(jTab.getSelectedRow(), 0).toString());
jTLada.setText (jTabDom.getValueAt(jTab.getSelectedRow(), 1).toString());
jTExten.setText (jTabDom.getValueAt(jTab.getSelectedRow(), 2).toString());
jTCel.setText (jTabDom.getValueAt(jTab.getSelectedRow(), 3).toString());
jTTelPer1.setText (jTabDom.getValueAt(jTab.getSelectedRow(), 4).toString());
jTTelPer2.setText (jTabDom.getValueAt(jTab.getSelectedRow(), 5).toString());
jTCall.setText (jTabDom.getValueAt(jTab.getSelectedRow(), 6).toString());
jTCol.setText (jTabDom.getValueAt(jTab.getSelectedRow(), 7).toString());
jTNoExt.setText (jTabDom.getValueAt(jTab.getSelectedRow(), 8).toString());
jTNoInt.setText (jTabDom.getValueAt(jTab.getSelectedRow(), 9).toString());
jTCP.setText (jTabDom.getValueAt(jTab.getSelectedRow(), 10).toString());
jTCiu.setText (jTabDom.getValueAt(jTab.getSelectedRow(), 11).toString());
jTEstad.setText (jTabDom.getValueAt(jTab.getSelectedRow(), 12).toString());
jTPai.setText (jTabDom.getValueAt(jTab.getSelectedRow(), 13).toString());
jTCo1.setText (jTabDom.getValueAt(jTab.getSelectedRow(), 14).toString());
jTCo2.setText (jTabDom.getValueAt(jTab.getSelectedRow(), 15).toString());
jTCo3.setText (jTabDom.getValueAt(jTab.getSelectedRow(), 16).toString());
}
});
/*Establece el tamaño de las columnas de la tabla*/
jTab.getColumnModel().getColumn(1).setPreferredWidth(400);
/*Inicializa el contador de filas en uno*/
iContFi = 1;
/*Para que la tabla tengan scroll horisontal*/
jTab.setAutoResizeMode(0);
/*Obtiene la dirección de la tabla del otro formulario*/
jTabDom = jTabD;
/*Establece el botón por default*/
this.getRootPane().setDefaultButton(jBAgre);
/*Obtiene el color original que deben tener los botones*/
colOri = jBSal.getBackground();
/*Esconde el link de ayuda*/
jLAyu.setVisible(false);
/*Centra la ventana*/
this.setLocationRelativeTo(null);
/*Establece el titulo de la ventana con El usuario, la fecha y hora*/
this.setTitle("Direcciónes de entrega, Usuario: <" + Login.sUsrG + "> " + Login.sFLog);
//Establece el ícono de la forma
Star.vSetIconFram(this);
/*Pon el foco del teclado en el primer control*/
jTLada.grabFocus();
/*Recorre todos los elementos de la tabla de domicilios del otro formulario y agregalos a la tabla actual*/
for(int x = 0; x < jTabDom.getRowCount(); x++)
{
/*Agrega la calle de la otra tabla a la tabla actual*/
DefaultTableModel te = (DefaultTableModel)jTab.getModel();
Object nu[] = {iContFi, jTabDom.getValueAt(x, 6)};
te.addRow(nu);
}
}/*Fin de public LPrecs() */
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel14 = new javax.swing.JLabel();
jP1 = new javax.swing.JPanel();
jLAyu = new javax.swing.JLabel();
jLabel40 = new javax.swing.JLabel();
jLabel39 = new javax.swing.JLabel();
jTLada = new javax.swing.JTextField();
jTTel = new javax.swing.JTextField();
jLabel20 = new javax.swing.JLabel();
jTExten = new javax.swing.JTextField();
jLabel41 = new javax.swing.JLabel();
jTCel = new javax.swing.JTextField();
jLabel21 = new javax.swing.JLabel();
jTTelPer1 = new javax.swing.JTextField();
jLabel13 = new javax.swing.JLabel();
jTTelPer2 = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
jTCall = new javax.swing.JTextField();
jLabel4 = new javax.swing.JLabel();
jTCol = new javax.swing.JTextField();
jLabel22 = new javax.swing.JLabel();
jTNoExt = new javax.swing.JTextField();
jLabel9 = new javax.swing.JLabel();
jTNoInt = new javax.swing.JTextField();
jLabel10 = new javax.swing.JLabel();
jTCP = new javax.swing.JTextField();
jLabel7 = new javax.swing.JLabel();
jTCiu = new javax.swing.JTextField();
jLabel5 = new javax.swing.JLabel();
jTEstad = new javax.swing.JTextField();
jLabel6 = new javax.swing.JLabel();
jTPai = new javax.swing.JTextField();
jLabel30 = new javax.swing.JLabel();
jTCo1 = new javax.swing.JTextField();
jLCo1 = new javax.swing.JLabel();
jLabel17 = new javax.swing.JLabel();
jTCo2 = new javax.swing.JTextField();
jLCo2 = new javax.swing.JLabel();
jLabel18 = new javax.swing.JLabel();
jTCo3 = new javax.swing.JTextField();
jLCo3 = new javax.swing.JLabel();
jBAgre = new javax.swing.JButton();
jBSal = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
jTab = new javax.swing.JTable();
jBDel = new javax.swing.JButton();
jLabel14.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jLabel14.setText("Utilidad %:");
setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
setResizable(false);
addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
public void mouseDragged(java.awt.event.MouseEvent evt) {
formMouseDragged(evt);
}
public void mouseMoved(java.awt.event.MouseEvent evt) {
formMouseMoved(evt);
}
});
addMouseWheelListener(new java.awt.event.MouseWheelListener() {
public void mouseWheelMoved(java.awt.event.MouseWheelEvent evt) {
formMouseWheelMoved(evt);
}
});
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {
formWindowClosing(evt);
}
});
addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
formKeyPressed(evt);
}
});
jP1.setBackground(new java.awt.Color(255, 255, 255));
jP1.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
jP1KeyPressed(evt);
}
});
jP1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jLAyu.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
jLAyu.setForeground(new java.awt.Color(0, 51, 204));
jLAyu.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLAyu.setText("http://Ayuda en Lìnea");
jLAyu.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseEntered(java.awt.event.MouseEvent evt) {
jLAyuMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
jLAyuMouseExited(evt);
}
});
jP1.add(jLAyu, new org.netbeans.lib.awtextra.AbsoluteConstraints(370, 460, 220, 20));
jLabel40.setText("Teléfono:");
jP1.add(jLabel40, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10, -1, -1));
jLabel39.setText("Lada:");
jP1.add(jLabel39, new org.netbeans.lib.awtextra.AbsoluteConstraints(150, 10, 40, 20));
jTLada.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 255)));
jTLada.setNextFocusableComponent(jTTel);
jTLada.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
jTLadaFocusGained(evt);
}
public void focusLost(java.awt.event.FocusEvent evt) {
jTLadaFocusLost(evt);
}
});
jTLada.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
jTLadaKeyPressed(evt);
}
public void keyTyped(java.awt.event.KeyEvent evt) {
jTLadaKeyTyped(evt);
}
});
jP1.add(jTLada, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 10, 50, 20));
jTTel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 255)));
jTTel.setNextFocusableComponent(jTExten);
jTTel.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
jTTelFocusGained(evt);
}
public void focusLost(java.awt.event.FocusEvent evt) {
jTTelFocusLost(evt);
}
});
jTTel.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
jTTelKeyPressed(evt);
}
public void keyTyped(java.awt.event.KeyEvent evt) {
jTTelKeyTyped(evt);
}
});
jP1.add(jTTel, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 10, 130, 20));
jLabel20.setText("Extensión:");
jP1.add(jLabel20, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 30, 100, -1));
jTExten.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 255)));
jTExten.setNextFocusableComponent(jTCel);
jTExten.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
jTExtenFocusGained(evt);
}
public void focusLost(java.awt.event.FocusEvent evt) {
jTExtenFocusLost(evt);
}
});
jTExten.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
jTExtenKeyPressed(evt);
}
public void keyTyped(java.awt.event.KeyEvent evt) {
jTExtenKeyTyped(evt);
}
});
jP1.add(jTExten, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 30, 230, 20));
jLabel41.setText("Celular:");
jP1.add(jLabel41, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 50, 100, -1));
jTCel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 255)));
jTCel.setNextFocusableComponent(jTTelPer1);
jTCel.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
jTCelFocusGained(evt);
}
public void focusLost(java.awt.event.FocusEvent evt) {
jTCelFocusLost(evt);
}
});
jTCel.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
jTCelKeyPressed(evt);
}
});
jP1.add(jTCel, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 50, 230, 20));
jLabel21.setText("Teléfono Personal 1:");
jP1.add(jLabel21, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 70, -1, -1));
jTTelPer1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 255)));
jTTelPer1.setNextFocusableComponent(jTTelPer2);
jTTelPer1.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
jTTelPer1FocusGained(evt);
}
public void focusLost(java.awt.event.FocusEvent evt) {
jTTelPer1FocusLost(evt);
}
});
jTTelPer1.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
jTTelPer1KeyPressed(evt);
}
public void keyTyped(java.awt.event.KeyEvent evt) {
jTTelPer1KeyTyped(evt);
}
});
jP1.add(jTTelPer1, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 70, 230, 20));
jLabel13.setText("Teléfono Personal 2:");
jP1.add(jLabel13, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 90, -1, -1));
jTTelPer2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 255)));
jTTelPer2.setNextFocusableComponent(jTCall);
jTTelPer2.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
jTTelPer2FocusGained(evt);
}
public void focusLost(java.awt.event.FocusEvent evt) {
jTTelPer2FocusLost(evt);
}
});
jTTelPer2.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
jTTelPer2KeyPressed(evt);
}
public void keyTyped(java.awt.event.KeyEvent evt) {
jTTelPer2KeyTyped(evt);
}
});
jP1.add(jTTelPer2, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 90, 230, 20));
jLabel3.setText("Calle:");
jP1.add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 110, -1, -1));
jTCall.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 255)));
jTCall.setNextFocusableComponent(jTCol);
jTCall.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
jTCallFocusGained(evt);
}
public void focusLost(java.awt.event.FocusEvent evt) {
jTCallFocusLost(evt);
}
});
jTCall.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
jTCallKeyPressed(evt);
}
});
jP1.add(jTCall, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 110, 230, 20));
jLabel4.setText("Colonia:");
jP1.add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 130, -1, -1));
jTCol.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 255)));
jTCol.setNextFocusableComponent(jTNoExt);
jTCol.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
jTColFocusGained(evt);
}
public void focusLost(java.awt.event.FocusEvent evt) {
jTColFocusLost(evt);
}
});
jTCol.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
jTColKeyPressed(evt);
}
});
jP1.add(jTCol, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 130, 230, 20));
jLabel22.setText("No. Exterior:");
jP1.add(jLabel22, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 150, 100, -1));
jTNoExt.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 255)));
jTNoExt.setNextFocusableComponent(jTNoInt);
jTNoExt.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
jTNoExtFocusGained(evt);
}
public void focusLost(java.awt.event.FocusEvent evt) {
jTNoExtFocusLost(evt);
}
});
jTNoExt.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
jTNoExtKeyPressed(evt);
}
});
jP1.add(jTNoExt, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 150, 230, 20));
jLabel9.setText("No. Interior:");
jP1.add(jLabel9, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 170, 100, -1));
jTNoInt.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 255)));
jTNoInt.setNextFocusableComponent(jTCP);
jTNoInt.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
jTNoIntFocusGained(evt);
}
public void focusLost(java.awt.event.FocusEvent evt) {
jTNoIntFocusLost(evt);
}
});
jTNoInt.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
jTNoIntKeyPressed(evt);
}
public void keyTyped(java.awt.event.KeyEvent evt) {
jTNoIntKeyTyped(evt);
}
});
jP1.add(jTNoInt, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 170, 230, 20));
jLabel10.setText("CP:");
jP1.add(jLabel10, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 190, -1, -1));
jTCP.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 255)));
jTCP.setNextFocusableComponent(jTCiu);
jTCP.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
jTCPFocusGained(evt);
}
public void focusLost(java.awt.event.FocusEvent evt) {
jTCPFocusLost(evt);
}
});
jTCP.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
jTCPKeyPressed(evt);
}
public void keyTyped(java.awt.event.KeyEvent evt) {
jTCPKeyTyped(evt);
}
});
jP1.add(jTCP, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 190, 230, 20));
jLabel7.setText("Ciudad:");
jP1.add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 210, -1, -1));
jTCiu.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 255)));
jTCiu.setNextFocusableComponent(jTEstad);
jTCiu.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
jTCiuFocusGained(evt);
}
public void focusLost(java.awt.event.FocusEvent evt) {
jTCiuFocusLost(evt);
}
});
jTCiu.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
jTCiuKeyPressed(evt);
}
});
jP1.add(jTCiu, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 210, 230, 20));
jLabel5.setText("Estado:");
jP1.add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 230, -1, -1));
jTEstad.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 255)));
jTEstad.setNextFocusableComponent(jTPai);
jTEstad.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
jTEstadFocusGained(evt);
}
public void focusLost(java.awt.event.FocusEvent evt) {
jTEstadFocusLost(evt);
}
});
jTEstad.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
jTEstadKeyPressed(evt);
}
});
jP1.add(jTEstad, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 230, 230, 20));
jLabel6.setText("País:");
jP1.add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 254, -1, 10));
jTPai.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 255)));
jTPai.setNextFocusableComponent(jTCo1);
jTPai.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
jTPaiFocusGained(evt);
}
public void focusLost(java.awt.event.FocusEvent evt) {
jTPaiFocusLost(evt);
}
});
jTPai.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
jTPaiKeyPressed(evt);
}
});
jP1.add(jTPai, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 250, 230, 20));
jLabel30.setText("Correo1:");
jP1.add(jLabel30, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 280, -1, 10));
jTCo1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 255)));
jTCo1.setNextFocusableComponent(jTCo2);
jTCo1.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
jTCo1FocusGained(evt);
}
public void focusLost(java.awt.event.FocusEvent evt) {
jTCo1FocusLost(evt);
}
});
jTCo1.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
jTCo1KeyPressed(evt);
}
});
jP1.add(jTCo1, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 270, 230, 20));
jLCo1.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 11)); // NOI18N
jLCo1.setForeground(new java.awt.Color(51, 51, 255));
jLCo1.setText("-");
jLCo1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLCo1MouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
jLCo1MouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
jLCo1MouseExited(evt);
}
});
jP1.add(jLCo1, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 290, 230, -1));
jLabel17.setText("Correo2:");
jP1.add(jLabel17, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 310, -1, -1));
jTCo2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 255)));
jTCo2.setNextFocusableComponent(jTCo3);
jTCo2.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
jTCo2FocusGained(evt);
}
public void focusLost(java.awt.event.FocusEvent evt) {
jTCo2FocusLost(evt);
}
});
jTCo2.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
jTCo2KeyPressed(evt);
}
});
jP1.add(jTCo2, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 310, 230, 20));
jLCo2.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 11)); // NOI18N
jLCo2.setForeground(new java.awt.Color(51, 51, 255));
jLCo2.setText("-");
jLCo2.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLCo2MouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
jLCo2MouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
jLCo2MouseExited(evt);
}
});
jP1.add(jLCo2, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 330, 230, -1));
jLabel18.setText("Correo3:");
jP1.add(jLabel18, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 350, -1, -1));
jTCo3.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 255)));
jTCo3.setNextFocusableComponent(jBSal);
jTCo3.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
jTCo3FocusGained(evt);
}
public void focusLost(java.awt.event.FocusEvent evt) {
jTCo3FocusLost(evt);
}
});
jTCo3.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
jTCo3KeyPressed(evt);
}
});
jP1.add(jTCo3, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 350, 230, 20));
jLCo3.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 11)); // NOI18N
jLCo3.setForeground(new java.awt.Color(51, 51, 255));
jLCo3.setText("-");
jLCo3.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLCo3MouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
jLCo3MouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
jLCo3MouseExited(evt);
}
});
jP1.add(jLCo3, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 370, 230, -1));
jBAgre.setBackground(new java.awt.Color(255, 255, 255));
jBAgre.setFont(new java.awt.Font("Tahoma", 1, 10)); // NOI18N
jBAgre.setForeground(new java.awt.Color(0, 102, 0));
jBAgre.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imgs/agre.png"))); // NOI18N
jBAgre.setText("Agregar");
jBAgre.setToolTipText("Guardar");
jBAgre.setNextFocusableComponent(jBDel);
jBAgre.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseEntered(java.awt.event.MouseEvent evt) {
jBAgreMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
jBAgreMouseExited(evt);
}
});
jBAgre.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jBAgreActionPerformed(evt);
}
});
jBAgre.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
jBAgreKeyPressed(evt);
}
});
jP1.add(jBAgre, new org.netbeans.lib.awtextra.AbsoluteConstraints(380, 430, 100, 20));
jBSal.setBackground(new java.awt.Color(255, 255, 255));
jBSal.setFont(new java.awt.Font("Tahoma", 1, 10)); // NOI18N
jBSal.setForeground(new java.awt.Color(0, 102, 0));
jBSal.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imgs/sal.png"))); // NOI18N
jBSal.setText("Salir");
jBSal.setToolTipText("Salir (ESC)");
jBSal.setName(""); // NOI18N
jBSal.setNextFocusableComponent(jBAgre);
jBSal.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseEntered(java.awt.event.MouseEvent evt) {
jBSalMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
jBSalMouseExited(evt);
}
});
jBSal.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jBSalActionPerformed(evt);
}
});
jBSal.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
jBSalKeyPressed(evt);
}
});
jP1.add(jBSal, new org.netbeans.lib.awtextra.AbsoluteConstraints(250, 390, 120, 30));
jTab.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"No.", "Calle"
}
) {
boolean[] canEdit = new boolean [] {
false, true
};
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
jTab.setGridColor(new java.awt.Color(255, 255, 255));
jTab.setName(""); // NOI18N
jTab.setNextFocusableComponent(jTLada);
jTab.setSelectionMode(javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
jTab.setShowHorizontalLines(false);
jTab.setShowVerticalLines(false);
jTab.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
jTabKeyPressed(evt);
}
});
jScrollPane1.setViewportView(jTab);
jP1.add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(380, 10, 300, 420));
jBDel.setBackground(new java.awt.Color(255, 255, 255));
jBDel.setFont(new java.awt.Font("Tahoma", 1, 10)); // NOI18N
jBDel.setForeground(new java.awt.Color(0, 102, 0));
jBDel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imgs/del.png"))); // NOI18N
jBDel.setText("Borrar");
jBDel.setNextFocusableComponent(jTab);
jBDel.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseEntered(java.awt.event.MouseEvent evt) {
jBDelMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
jBDelMouseExited(evt);
}
});
jBDel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jBDelActionPerformed(evt);
}
});
jBDel.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
jBDelKeyPressed(evt);
}
});
jP1.add(jBDel, new org.netbeans.lib.awtextra.AbsoluteConstraints(480, 430, 100, 20));
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jP1, javax.swing.GroupLayout.DEFAULT_SIZE, 690, Short.MAX_VALUE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jP1, javax.swing.GroupLayout.DEFAULT_SIZE, 487, Short.MAX_VALUE)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
/*Cuando se presiona una tecla en el formulario*/
private void formKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_formKeyPressed
//Llama a la función escalable
vKeyPreEsc(evt);
}//GEN-LAST:event_formKeyPressed
/*Cuando se presiona una tecla en el panel*/
private void jP1KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jP1KeyPressed
//Llama a la función escalable
vKeyPreEsc(evt);
}//GEN-LAST:event_jP1KeyPressed
/*Cuando se mueve la rueda del mouse en la forma*/
private void formMouseWheelMoved(java.awt.event.MouseWheelEvent evt) {//GEN-FIRST:event_formMouseWheelMoved
/*Pon la bandera para saber que ya hubó un evento y no se desloguie*/
bIdle = true;
}//GEN-LAST:event_formMouseWheelMoved
/*Cuando el mouse se arrastra en la forma*/
private void formMouseDragged(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMouseDragged
/*Pon la bandera para saber que ya hubó un evento y no se desloguie*/
bIdle = true;
}//GEN-LAST:event_formMouseDragged
/*Cuando se mueve el mouse en la forma*/
private void formMouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMouseMoved
/*Pon la bandera para saber que ya hubó un evento y no se desloguie*/
bIdle = true;
}//GEN-LAST:event_formMouseMoved
/*Cuando el mouse entra en el campo del link de ayuda*/
private void jLAyuMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLAyuMouseEntered
/*Cambia el cursor del ratón*/
this.setCursor( new Cursor(Cursor.HAND_CURSOR));
}//GEN-LAST:event_jLAyuMouseEntered
/*Cuando el mouse sale del campo del link de ayuda*/
private void jLAyuMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLAyuMouseExited
/*Cambia el cursor del ratón al que tenía*/
this.setCursor( new Cursor(Cursor.DEFAULT_CURSOR));
}//GEN-LAST:event_jLAyuMouseExited
/*Cuando se esta saliendo de la forma*/
private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
/*Presiona el botón de salir*/
jBSal.doClick();
}//GEN-LAST:event_formWindowClosing
/*Cuando se gana el foco del teclado en el campo de la lada*/
private void jTLadaFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTLadaFocusGained
/*Selecciona todo el texto cuando gana el foco*/
jTLada.setSelectionStart(0);jTLada.setSelectionEnd(jTLada.getText().length());
}//GEN-LAST:event_jTLadaFocusGained
/*Cuando se presiona una tecla en el campo de la lada*/
private void jTLadaKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTLadaKeyPressed
//Llama a la función escalable
vKeyPreEsc(evt);
}//GEN-LAST:event_jTLadaKeyPressed
/*Cuando se tipea una tecla en el campo de la lada*/
private void jTLadaKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTLadaKeyTyped
/*Comprueba que el carácter este en los límites permitidos para numeración*/
if(((evt.getKeyChar() < '0') || (evt.getKeyChar() > '9')) && (evt.getKeyChar() != '\b') && (evt.getKeyChar() != '.'))
evt.consume();
}//GEN-LAST:event_jTLadaKeyTyped
/*Cuando se gana el foco del teclado en el campo del teléfono*/
private void jTTelFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTTelFocusGained
/*Selecciona todo el texto cuando gana el foco*/
jTTel.setSelectionStart(0);
jTTel.setSelectionEnd(jTTel.getText().length());
}//GEN-LAST:event_jTTelFocusGained
/*Cuando se pierde el foco del teclado en el campo del teléfono*/
private void jTTelFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTTelFocusLost
/*Coloca el cursor al principio del control*/
jTTel.setCaretPosition(0);
/*Si el campo excede la cantidad de caes permitidos recortalo*/
if(jTTel.getText().length()> 255)
jTTel.setText(jTTel.getText().substring(0, 255));
}//GEN-LAST:event_jTTelFocusLost
/*Cuando se presiona un tecla en el campo del teléfono*/
private void jTTelKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTTelKeyPressed
//Llama a la función escalable
vKeyPreEsc(evt);
}//GEN-LAST:event_jTTelKeyPressed
/*Cuando se tipea una tecla en el campo del teléfono*/
private void jTTelKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTTelKeyTyped
/*Comprueba que el carácter este en los límites permitidos para el teléfono entonces*/
if(((evt.getKeyChar() < '0') || (evt.getKeyChar() > '9')) && (evt.getKeyChar() != '\b') && (evt.getKeyChar() != '-') && (evt.getKeyChar() != ' ') && (evt.getKeyChar() != '(') && (evt.getKeyChar() != ')'))
evt.consume();
}//GEN-LAST:event_jTTelKeyTyped
/*Cuando se gana el foco del teclaod en el campo de la extensión*/
private void jTExtenFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTExtenFocusGained
/*Selecciona todo el texto cuando gana el foco*/
jTExten.setSelectionStart(0);
jTExten.setSelectionEnd(jTExten.getText().length());
}//GEN-LAST:event_jTExtenFocusGained
/*Cuando se presiona un tecla en el campo de la extensión*/
private void jTExtenKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTExtenKeyPressed
//Llama a la función escalable
vKeyPreEsc(evt);
}//GEN-LAST:event_jTExtenKeyPressed
/*Cuando se tipea una tecla en el campo de la extensión*/
private void jTExtenKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTExtenKeyTyped
/*Comprueba que el carácter este en los límites permitidos para numeración*/
if(((evt.getKeyChar() < '0') || (evt.getKeyChar() > '9')) && (evt.getKeyChar() != '\b') && (evt.getKeyChar() != '.'))
evt.consume();
}//GEN-LAST:event_jTExtenKeyTyped
/*Cuando se gana el foco del teclado en el campo del célular*/
private void jTCelFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTCelFocusGained
/*Selecciona todo el texto cuando gana el foco*/
jTCel.setSelectionStart(0);
jTCel.setSelectionEnd(jTCel.getText().length());
}//GEN-LAST:event_jTCelFocusGained
/*Cuando se presiona una tecla en el campo del célular*/
private void jTCelKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTCelKeyPressed
//Llama a la función escalable
vKeyPreEsc(evt);
}//GEN-LAST:event_jTCelKeyPressed
/*Cuadno se gana el foco del teclado en el campo del teléfono personal 1*/
private void jTTelPer1FocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTTelPer1FocusGained
/*Selecciona todo el texto cuando gana el foco*/
jTTelPer1.setSelectionStart(0);jTTelPer1.setSelectionEnd(jTTelPer1.getText().length());
}//GEN-LAST:event_jTTelPer1FocusGained
/*Cuando se pierde el foco del teclado en el campo del teléfono personal 1*/
private void jTTelPer1FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTTelPer1FocusLost
/*Coloca el cursor al principio del control*/
jTTelPer1.setCaretPosition(0);
/*Si el campo excede la cantidad de caes permitidos recortalo*/
if(jTTelPer1.getText().length()> 255)
jTTelPer1.setText(jTTelPer1.getText().substring(0, 255));
}//GEN-LAST:event_jTTelPer1FocusLost
/*Cuando se presiona una tecla en el campo del teléfono personal 1*/
private void jTTelPer1KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTTelPer1KeyPressed
//Llama a la función escalable
vKeyPreEsc(evt);
}//GEN-LAST:event_jTTelPer1KeyPressed
/*Cuando se tipea una tecla en el campo del teléfono personal 1*/
private void jTTelPer1KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTTelPer1KeyTyped
/*Si el carácter introducido es minúscula entonces colocalo en mayúsculas*/
if(Character.isLowerCase(evt.getKeyChar()))
evt.setKeyChar(Character.toUpperCase(evt.getKeyChar()));
}//GEN-LAST:event_jTTelPer1KeyTyped
/*Cuando se gana el foco del teclado en el campo del teléfono personal 2*/
private void jTTelPer2FocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTTelPer2FocusGained
/*Selecciona todo el texto cuando gana el foco*/
jTTelPer2.setSelectionStart(0);jTTelPer2.setSelectionEnd(jTTelPer2.getText().length());
}//GEN-LAST:event_jTTelPer2FocusGained
/*Cuando se pierde el foco del teclado en el campo del teléfono personal 2*/
private void jTTelPer2FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTTelPer2FocusLost
/*Coloca el cursor al principio del control*/
jTTelPer2.setCaretPosition(0);
/*Si el campo excede la cantidad de caes permitidos recortalo*/
if(jTTelPer2.getText().length()> 255)
jTTelPer2.setText(jTTelPer2.getText().substring(0, 255));
}//GEN-LAST:event_jTTelPer2FocusLost
/*Cuando se presiona una tecla en el campo del teléfono personal 2*/
private void jTTelPer2KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTTelPer2KeyPressed
//Llama a la función escalable
vKeyPreEsc(evt);
}//GEN-LAST:event_jTTelPer2KeyPressed
/*Cuando se tipea una tecla en el campo del teléfono personal 2*/
private void jTTelPer2KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTTelPer2KeyTyped
/*Si el carácter introducido es minúscula entonces*/
if(Character.isLowerCase(evt.getKeyChar()))
evt.setKeyChar(Character.toUpperCase(evt.getKeyChar()));
}//GEN-LAST:event_jTTelPer2KeyTyped
/*Cuando se gana el foco del teclado en el campo de la calle*/
private void jTCallFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTCallFocusGained
/*Selecciona todo el texto cuando gana el foco*/
jTCall.setSelectionStart(0);jTCall.setSelectionEnd(jTCall.getText().length());
}//GEN-LAST:event_jTCallFocusGained
/*Cuando se pierde el foco del teclado en el campo de la calle*/
private void jTCallFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTCallFocusLost
/*Coloca el cursor al principio del control*/
jTCall.setCaretPosition(0);
/*Si el campo excede la cantidad de caes permitidos recortalo*/
if(jTCall.getText().length()> 255)
jTCall.setText(jTCall.getText().substring(0, 255));
}//GEN-LAST:event_jTCallFocusLost
/*Cuando se presiona una tecla en el campo de la calle*/
private void jTCallKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTCallKeyPressed
//Llama a la función escalable
vKeyPreEsc(evt);
}//GEN-LAST:event_jTCallKeyPressed
/*Cuando se gana el foco del teclado en el campo de la colonia*/
private void jTColFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTColFocusGained
/*Selecciona todo el texto cuando gana el foco*/
jTCol.setSelectionStart(0);jTCol.setSelectionEnd(jTCol.getText().length());
}//GEN-LAST:event_jTColFocusGained
/*Cuando se pierde el foco del teclado en el campo de la colonia*/
private void jTColFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTColFocusLost
/*Coloca el cursor al principio del control*/
jTCol.setCaretPosition(0);
/*Si el campo excede la cantidad de caes permitidos recortalo*/
if(jTCol.getText().length()> 255)
jTCol.setText(jTCol.getText().substring(0, 255));
}//GEN-LAST:event_jTColFocusLost
/*Cuando se presiona una tecla en el campo de la colonia*/
private void jTColKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTColKeyPressed
//Llama a la función escalable
vKeyPreEsc(evt);
}//GEN-LAST:event_jTColKeyPressed
/*Cuando se gana el foco del teclado en el campo del número de exterior*/
private void jTNoExtFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTNoExtFocusGained
/*Selecciona todo el texto cuando gana el foco*/
jTNoExt.setSelectionStart(0);jTNoExt.setSelectionEnd(jTNoExt.getText().length());
}//GEN-LAST:event_jTNoExtFocusGained
/*Cuando se pierde el foco del teclado en el campo del número de exterior*/
private void jTNoExtFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTNoExtFocusLost
/*Coloca el cursor al principio del control*/
jTNoExt.setCaretPosition(0);
/*Si el campo excede la cantidad de caes permitidos recortalo*/
if(jTNoExt.getText().length()> 21)
jTNoExt.setText(jTNoExt.getText().substring(0, 21));
}//GEN-LAST:event_jTNoExtFocusLost
/*Cuando se presiona una tecla en el campo del número de exterior*/
private void jTNoExtKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTNoExtKeyPressed
//Llama a la función escalable
vKeyPreEsc(evt);
}//GEN-LAST:event_jTNoExtKeyPressed
/*Cuando se gana el foco del teclado en el campo del número de interior*/
private void jTNoIntFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTNoIntFocusGained
/*Selecciona todo el texto cuando gana el foco*/
jTNoInt.setSelectionStart(0);jTNoInt.setSelectionEnd(jTNoInt.getText().length());
}//GEN-LAST:event_jTNoIntFocusGained
/*Cuando se pierde el foco del teclado en el campo del número de interior*/
private void jTNoIntFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTNoIntFocusLost
/*Coloca el cursor al principio del control*/
jTNoInt.setCaretPosition(0);
/*Si el campo excede la cantidad de caes permitidos recortalo*/
if(jTNoInt.getText().length()> 21)
jTNoInt.setText(jTNoInt.getText().substring(0, 21));
}//GEN-LAST:event_jTNoIntFocusLost
/*Cuando se presiona una tecla en el campo del número de interior*/
private void jTNoIntKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTNoIntKeyPressed
//Llama a la función escalable
vKeyPreEsc(evt);
}//GEN-LAST:event_jTNoIntKeyPressed
/*Cuando se tipea una tecla en el campo del número de interior*/
private void jTNoIntKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTNoIntKeyTyped
/*Si el carácter introducido es minúscula entonces*/
if(Character.isLowerCase(evt.getKeyChar()))
evt.setKeyChar(Character.toUpperCase(evt.getKeyChar()));
}//GEN-LAST:event_jTNoIntKeyTyped
/*Cuando se gana el foco del teclado en el campo del CP*/
private void jTCPFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTCPFocusGained
/*Selecciona todo el texto cuando gana el foco*/
jTCP.setSelectionStart(0);jTCP.setSelectionEnd(jTCP.getText().length());
}//GEN-LAST:event_jTCPFocusGained
/*Cuando se pierde el foco del teclado en el campo del CP*/
private void jTCPFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTCPFocusLost
/*Coloca el cursor al principio del control*/
jTCP.setCaretPosition(0);
/*Si el campo excede la cantidad de caes permitidos recortalo*/
if(jTCP.getText().length()> 6)
jTCP.setText(jTCP.getText().substring(0, 6));
}//GEN-LAST:event_jTCPFocusLost
/*Cuando se presiona una tecla en el campo del CP*/
private void jTCPKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTCPKeyPressed
//Llama a la función escalable
vKeyPreEsc(evt);
}//GEN-LAST:event_jTCPKeyPressed
/*Cuando se tipea una tecla en el campo del CP*/
private void jTCPKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTCPKeyTyped
/*Comprueba que el carácter este en los límites permitidos para numeración*/
if(((evt.getKeyChar() < '0') || (evt.getKeyChar() > '9')) && (evt.getKeyChar() != '\b') && (evt.getKeyChar() != '.'))
evt.consume();
}//GEN-LAST:event_jTCPKeyTyped
/*Cuando se gana el foco del teclado en el campo de la ciudad*/
private void jTCiuFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTCiuFocusGained
/*Selecciona todo el texto cuando gana el foco*/
jTCiu.setSelectionStart(0);jTCiu.setSelectionEnd(jTCiu.getText().length());
}//GEN-LAST:event_jTCiuFocusGained
/*Cuando se pierde el foco del teclado en el campo de la ciudad*/
private void jTCiuFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTCiuFocusLost
/*Coloca el cursor al principio del control*/
jTCiu.setCaretPosition(0);
/*Si el campo excede la cantidad de caes permitidos recortalo*/
if(jTCiu.getText().length()> 255)
jTCiu.setText(jTCiu.getText().substring(0, 255));
}//GEN-LAST:event_jTCiuFocusLost
/*Cuando se presiona una tecla en el campo de la ciudad*/
private void jTCiuKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTCiuKeyPressed
//Llama a la función escalable
vKeyPreEsc(evt);
}//GEN-LAST:event_jTCiuKeyPressed
/*Cuando se gana el foco del teclado en el campo el estado*/
private void jTEstadFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTEstadFocusGained
/*Selecciona todo el texto cuando gana el foco*/
jTEstad.setSelectionStart(0);jTEstad.setSelectionEnd(jTEstad.getText().length());
}//GEN-LAST:event_jTEstadFocusGained
/*Cuando se pierde el foco del teclado en el campo del estado*/
private void jTEstadFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTEstadFocusLost
/*Coloca el cursor al principio del control*/
jTEstad.setCaretPosition(0);
/*Si el campo excede la cantidad de caes permitidos recortalo*/
if(jTEstad.getText().length()> 255)
jTEstad.setText(jTEstad.getText().substring(0, 255));
}//GEN-LAST:event_jTEstadFocusLost
/*Cuando se presiona una tecla en el campo del estado*/
private void jTEstadKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTEstadKeyPressed
//Llama a la función escalable
vKeyPreEsc(evt);
}//GEN-LAST:event_jTEstadKeyPressed
/*Cuando se gana el foco del teclado en el campo del pais*/
private void jTPaiFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTPaiFocusGained
/*Selecciona todo el texto cuando gana el foco*/
jTPai.setSelectionStart(0);jTPai.setSelectionEnd(jTPai.getText().length());
}//GEN-LAST:event_jTPaiFocusGained
/*Cuando se pierde el foco del teclado en el campo del pais*/
private void jTPaiFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTPaiFocusLost
/*Coloca el cursor al principio del control*/
jTPai.setCaretPosition(0);
/*Si el campo excede la cantidad de caes permitidos recortalo*/
if(jTPai.getText().length()> 255)
jTPai.setText(jTPai.getText().substring(0, 255));
}//GEN-LAST:event_jTPaiFocusLost
/*Cuando se presiona una tecla en el campo del pais*/
private void jTPaiKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTPaiKeyPressed
//Llama a la función escalable
vKeyPreEsc(evt);
}//GEN-LAST:event_jTPaiKeyPressed
/*Cuando se gana el foco del teclado en el campo del correo 1*/
private void jTCo1FocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTCo1FocusGained
/*Selecciona todo el texto cuando gana el foco*/
jTCo1.setSelectionStart(0);jTCo1.setSelectionEnd(jTCo1.getText().length());
}//GEN-LAST:event_jTCo1FocusGained
/*Cuando se pierde el foco del teclado en el campo del correo 1*/
private void jTCo1FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTCo1FocusLost
/*Coloca el cursor al principio del control*/
jTCo1.setCaretPosition(0);
/*Coloca el borde negro si tiene datos*/
jTCo1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204,204,255)));
/*Valida el correo electrónico que sea válido*/
if((!jTCo1.getText().toLowerCase().contains("@") || !jTCo1.getText().toLowerCase().contains(".")) && jTCo1.getText().compareTo("")!=0)
{
/*Mensajea*/
JOptionPane.showMessageDialog(null, "No es un correo electrónico valido.", "Nuevo Cliente", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource(Star.sRutIconAd)));
/*Coloca el borde rojo*/
jTCo1.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.RED));
}
/*Si el campo excede la cantidad de caes permitidos recortalo*/
if(jTCo1.getText().length()> 100)
jTCo1.setText(jTCo1.getText().substring(0, 100));
/*Coloca en el label de correo 1 el correo que el usuario escribió*/
jLCo1.setText(jTCo1.getText());
/*Si el usuario no escribió nada entonces solo poner el guión*/
if(jTCo1.getText().compareTo("")==0)
jLCo1.setText("-");
}//GEN-LAST:event_jTCo1FocusLost
/*Cuando se presiona una tecla en el campo del correo 1*/
private void jTCo1KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTCo1KeyPressed
//Llama a la función escalable
vKeyPreEsc(evt);
}//GEN-LAST:event_jTCo1KeyPressed
/*Cuando se presiona con el mouse en label de correo 1*/
private void jLCo1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLCo1MouseClicked
/*Abre la aplicación de correo por default del usuario con el correo electrónico clickeado*/
java.awt.Desktop desk;
if(java.awt.Desktop.isDesktopSupported() && (desk = java.awt.Desktop.getDesktop()).isSupported(java.awt.Desktop.Action.MAIL))
{
java.net.URI mailto;
try
{
mailto = new java.net.URI("mailto:" + jLCo1.getText() + "?subject=");
}
catch(URISyntaxException expnUriSynta)
{
//Procesa el error y regresa
Star.iErrProc(this.getClass().getName() + " " + expnUriSynta.getMessage(), Star.sErrUriSynta, expnUriSynta.getStackTrace());
return;
}
try
{
desk.mail(mailto);
}
catch(IOException expnIO)
{
//Procesa el error
Star.iErrProc(this.getClass().getName() + " " + expnIO.getMessage(), Star.sErrIO, expnIO.getStackTrace());
}
}
}//GEN-LAST:event_jLCo1MouseClicked
/*Cuando el mouse entra en el label de correo 1*/
private void jLCo1MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLCo1MouseEntered
/*Cambia el cursor del ratón*/
this.setCursor( new Cursor(Cursor.HAND_CURSOR));
}//GEN-LAST:event_jLCo1MouseEntered
/*Cuando el mouse sale del label de correo 1*/
private void jLCo1MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLCo1MouseExited
/*Cambia el cursor del ratón al que tenía*/
this.setCursor( new Cursor(Cursor.DEFAULT_CURSOR));
}//GEN-LAST:event_jLCo1MouseExited
/*Cuando se gana el foco del teclado en el campo del correo 2*/
private void jTCo2FocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTCo2FocusGained
/*Selecciona todo el texto cuando gana el foco*/
jTCo2.setSelectionStart(0);jTCo2.setSelectionEnd(jTCo2.getText().length());
}//GEN-LAST:event_jTCo2FocusGained
/*Cuando se pierde el foco del teclado en el campo del correo 2*/
private void jTCo2FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTCo2FocusLost
/*Coloca el cursor al principio del control*/
jTCo2.setCaretPosition(0);
/*Coloca el borde negro si tiene datos*/
jTCo2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204,204,255)));
/*Valida el correo electrónico que sea válido*/
if((!jTCo2.getText().toLowerCase().contains("@") || !jTCo2.getText().toLowerCase().contains(".")) && jTCo2.getText().compareTo("")!=0)
{
/*Mensajea*/
JOptionPane.showMessageDialog(null, "No es un correo electrónico valido.", "Nuevo Cliente", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource(Star.sRutIconAd)));
/*Coloca el borde rojo*/
jTCo2.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.RED));
}
/*Si el campo excede la cantidad de caes permitidos recortalo*/
if(jTCo2.getText().length()> 100)
jTCo2.setText(jTCo2.getText().substring(0, 100));
/*Coloca en el label de correo 2 el correo que el usuario escribió*/
jLCo2.setText(jTCo2.getText());
/*Si el usuario no escribió nada entonces solo poner el guión*/
if(jTCo2.getText().compareTo("")==0)
jLCo2.setText("-");
}//GEN-LAST:event_jTCo2FocusLost
/*Cuando se presiona una tecla en el campo del correo 2*/
private void jTCo2KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTCo2KeyPressed
//Llama a la función escalable
vKeyPreEsc(evt);
}//GEN-LAST:event_jTCo2KeyPressed
/*Cuando se hace click con el mouse en el label de correo 2*/
private void jLCo2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLCo2MouseClicked
/*Abre la aplicación de correo por default del usuario con el correo electrónico clickeado*/
java.awt.Desktop de;
if(java.awt.Desktop.isDesktopSupported() && (de = java.awt.Desktop.getDesktop()).isSupported(java.awt.Desktop.Action.MAIL))
{
java.net.URI mailto;
try
{
mailto = new java.net.URI("mailto:" + jLCo2.getText() + "?subject=");
}
catch(URISyntaxException expnUriSynta)
{
//Procesa el error y regresa
Star.iErrProc(this.getClass().getName() + " " + expnUriSynta.getMessage(), Star.sErrUriSynta, expnUriSynta.getStackTrace());
return;
}
try
{
de.mail(mailto);
}
catch(IOException expnIO)
{
//Procesa el error
Star.iErrProc(this.getClass().getName() + " " + expnIO.getMessage(), Star.sErrIO, expnIO.getStackTrace());
}
}
}//GEN-LAST:event_jLCo2MouseClicked
/*Cuando el mouse entra en el label del correo 2*/
private void jLCo2MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLCo2MouseEntered
/*Cambia el cursor del ratón*/
this.setCursor( new Cursor(Cursor.HAND_CURSOR));
}//GEN-LAST:event_jLCo2MouseEntered
/*Cuando el mouse sale del label de correo 2*/
private void jLCo2MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLCo2MouseExited
/*Cambia el cursor del ratón al que tenía*/
this.setCursor( new Cursor(Cursor.DEFAULT_CURSOR));
}//GEN-LAST:event_jLCo2MouseExited
/*Cuando se gana el foco del teclado en el campo del correo 3*/
private void jTCo3FocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTCo3FocusGained
/*Selecciona todo el texto cuando gana el foco*/
jTCo3.setSelectionStart(0);jTCo3.setSelectionEnd(jTCo3.getText().length());
}//GEN-LAST:event_jTCo3FocusGained
/*Cuando se pierde el foco del teclado en el campo del correo 3*/
private void jTCo3FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTCo3FocusLost
/*Coloca el cursor al principio del control*/
jTCo3.setCaretPosition(0);
/*Coloca el borde negro si tiene datos*/
jTCo3.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204,204,255)));
/*Valida el correo electrónico que sea válido*/
if((!jTCo3.getText().toLowerCase().contains("@") || !jTCo3.getText().toLowerCase().contains(".")) && jTCo3.getText().compareTo("")!=0)
{
/*Mensajea*/
JOptionPane.showMessageDialog(null, "No es un correo electrónico valido.", "Nuevo Cliente", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource(Star.sRutIconAd)));
/*Coloca el borde rojo*/
jTCo3.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.RED));
}
/*Si el campo excede la cantidad de caes permitidos recortalo*/
if(jTCo3.getText().length()> 100)
jTCo3.setText(jTCo3.getText().substring(0, 100));
/*Coloca en el label de correo 3 el correo que el usuario escribió*/
jLCo3.setText(jTCo3.getText());
/*Si el usuario no escribió nada entonces solo poner el guión*/
if(jTCo3.getText().compareTo("")==0)
jLCo3.setText("-");
}//GEN-LAST:event_jTCo3FocusLost
/*Cuando se presiona una tecla en el campo del correo 3*/
private void jTCo3KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTCo3KeyPressed
//Llama a la función escalable
vKeyPreEsc(evt);
}//GEN-LAST:event_jTCo3KeyPressed
/*Cuando se hace clic con el mouse en el label de correo 3*/
private void jLCo3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLCo3MouseClicked
/*Abre la aplicación de correo por default del usuario con el correo electrónico clickeado*/
java.awt.Desktop de;
if(java.awt.Desktop.isDesktopSupported() && (de = java.awt.Desktop.getDesktop()).isSupported(java.awt.Desktop.Action.MAIL))
{
java.net.URI mailto;
try
{
mailto = new java.net.URI("mailto:" + jLCo1.getText() + "?subject=");
}
catch(URISyntaxException expnUriSynta)
{
//Procesa el error y regresa
Star.iErrProc(this.getClass().getName() + " " + expnUriSynta.getMessage(), Star.sErrUriSynta, expnUriSynta.getStackTrace());
return;
}
try
{
de.mail(mailto);
}
catch(IOException expnIO)
{
//Procesa el error y regresa
Star.iErrProc(this.getClass().getName() + " " + expnIO.getMessage(), Star.sErrIO, expnIO.getStackTrace());
}
}
}//GEN-LAST:event_jLCo3MouseClicked
/*Cuando el mouse entra en el label de correo 3*/
private void jLCo3MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLCo3MouseEntered
/*Cambia el cursor del ratón*/
this.setCursor( new Cursor(Cursor.HAND_CURSOR));
}//GEN-LAST:event_jLCo3MouseEntered
/*Cuando el mouse sale del label de correo 3*/
private void jLCo3MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLCo3MouseExited
/*Cambia el cursor del ratón al que tenía*/
this.setCursor( new Cursor(Cursor.DEFAULT_CURSOR));
}//GEN-LAST:event_jLCo3MouseExited
/*Cuando el mouse entra en el botón de guaradar*/
private void jBAgreMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jBAgreMouseEntered
/*Cambia el color del fondo del botón*/
jBAgre.setBackground(Star.colBot);
}//GEN-LAST:event_jBAgreMouseEntered
/*Cuadno el mouse sale del botón de guardar*/
private void jBAgreMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jBAgreMouseExited
/*Cambia el color del fondo del botón al original*/
jBAgre.setBackground(colOri);
}//GEN-LAST:event_jBAgreMouseExited
/*Cuando se presiona el botón de agregar*/
private void jBAgreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBAgreActionPerformed
/*Valida el correo electrónico que sea válido*/
if((!jTCo1.getText().toLowerCase().contains("@") || !jTCo1.getText().toLowerCase().contains(".")) && jTCo1.getText().compareTo("")!=0)
{
/*Coloca el borde rojo y el foco en el control*/
jTCo1.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.RED));
jTCo1.grabFocus();
/*Mensajea y regresa*/
JOptionPane.showMessageDialog(null, "No es un correo electrónico valido.", "Domicilio Entrega", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource(Star.sRutIconAd)));
return;
}
/*Valida el correo electrónico que sea válido*/
if((!jTCo2.getText().toLowerCase().contains("@") || !jTCo2.getText().toLowerCase().contains(".")) && jTCo2.getText().compareTo("")!=0)
{
/*Coloca el borde rojo y el foco en el control*/
jTCo2.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.RED));
jTCo2.grabFocus();
/*Mensajea y regresa*/
JOptionPane.showMessageDialog(null, "No es un correo electrónico valido.", "Domicilio Entrega", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource(Star.sRutIconAd)));
return;
}
/*Valida el correo electrónico que sea válido*/
if((!jTCo3.getText().toLowerCase().contains("@") || !jTCo3.getText().toLowerCase().contains(".")) && jTCo3.getText().compareTo("")!=0)
{
/*Coloca el borde rojo y el foco en el control*/
jTCo3.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.RED));
jTCo3.grabFocus();
/*Mensajea y regresa*/
JOptionPane.showMessageDialog(null, "No es un correo electrónico valido.", "Domicilio Entrega", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource(Star.sRutIconAd)));
return;
}
/*Preguntar al usuario si esta seguro de que querer agregar la dirección de envio*/
Object[] op = {"Si","No"};
int iRes = JOptionPane.showOptionDialog(this, "¿Seguro que quieres agregar la dirección?", "Agregar Nueva Dirección", JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource(Star.sRutIconDu)), op, op[0]);
if(iRes==JOptionPane.NO_OPTION || iRes==JOptionPane.CLOSED_OPTION)
return;
/*Agrega el registro en la tabla del otro formulario*/
DefaultTableModel te = (DefaultTableModel)jTabDom.getModel();
Object nu[] = {jTTel.getText(), jTLada.getText(), jTExten.getText(), jTCel.getText(), jTTelPer1.getText(), jTTelPer2.getText(), jTCall.getText(), jTCol.getText(), jTNoExt.getText(), jTNoInt.getText(), jTCP.getText(), jTCiu.getText(), jTEstad.getText(), jTPai.getText(), jTCo1.getText(), jTCo2.getText(), jTCo3.getText()};
te.addRow(nu);
/*Agrega el registro en la tabla local*/
te = (DefaultTableModel)jTab.getModel();
Object nu2[] = {iContFi, jTCall.getText()};
te.addRow(nu2);
/*Aumenta en uno el contador de filas*/
++iContFi;
}//GEN-LAST:event_jBAgreActionPerformed
/*Cuadno se presiona una tecla en el botón de agregar*/
private void jBAgreKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jBAgreKeyPressed
//Llama a la función escalable
vKeyPreEsc(evt);
}//GEN-LAST:event_jBAgreKeyPressed
/*Cuando el mouse entra en el botón de salir*/
private void jBSalMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jBSalMouseEntered
/*Cambia el color del fondo del botón*/
jBSal.setBackground(Star.colBot);
}//GEN-LAST:event_jBSalMouseEntered
/*Cuando el mouse sale del botón de salir*/
private void jBSalMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jBSalMouseExited
/*Cambia el color del fondo del botón al original*/
jBSal.setBackground(colOri);
}//GEN-LAST:event_jBSalMouseExited
/*Cuando se presiona el botón de salir*/
private void jBSalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBSalActionPerformed
/*Llama al recolector de basura*/
System.gc();
/*Cierra la forma*/
this.dispose();
}//GEN-LAST:event_jBSalActionPerformed
/*Cuando se presiona una tecla en el botón de salir*/
private void jBSalKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jBSalKeyPressed
//Llama a la función escalable
vKeyPreEsc(evt);
}//GEN-LAST:event_jBSalKeyPressed
/*Cuando se pierde el foco del teclado en el campo de la lada*/
private void jTLadaFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTLadaFocusLost
/*Coloca el cursor al principio del control*/
jTLada.setCaretPosition(0);
}//GEN-LAST:event_jTLadaFocusLost
/*Cuando se pierde el foco del teclado en el campo de la extensiòn*/
private void jTExtenFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTExtenFocusLost
/*Coloca el cursor al principio del control*/
jTExten.setCaretPosition(0);
}//GEN-LAST:event_jTExtenFocusLost
/*Cuando se pierde el foco del teclado en el campo del célular*/
private void jTCelFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTCelFocusLost
/*Coloca el cursor al principio del control*/
jTCel.setCaretPosition(0);
}//GEN-LAST:event_jTCelFocusLost
/*Cuando se presiona una tecla en la tabla de direcciones*/
private void jTabKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTabKeyPressed
//Llama a la función escalable
vKeyPreEsc(evt);
}//GEN-LAST:event_jTabKeyPressed
/*Cuando se presiona una tecla en el botón de borrar*/
private void jBDelKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jBDelKeyPressed
//Llama a la función escalable
vKeyPreEsc(evt);
}//GEN-LAST:event_jBDelKeyPressed
/*Cuando se presiona el botón de borrar*/
private void jBDelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBDelActionPerformed
/*Si no hay selección en la tabla de emps no puede seguir*/
if(jTab.getSelectedRow()==-1)
{
/*Mensajea*/
JOptionPane.showMessageDialog(null, "No has seleccionado una dirección de la lista para borrar.", "Borrar Dirección", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource(Star.sRutIconAd)));
/*Coloca el foco del teclado en la lista de emps y regresa*/
jTab.grabFocus();
return;
}
/*Pregunta si esta seguro de borrar la cliente*/
Object[] op = {"Si","No"};
int iRes = JOptionPane.showOptionDialog(this, "¿Seguro que quieres borrar la(s) dirección(es)?", "Borrar Dirección", JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource(Star.sRutIconDu)), op, op[0]);
if(iRes==JOptionPane.NO_OPTION || iRes==JOptionPane.CLOSED_OPTION)
return;
/*Recorre toda la selección del usuario*/
int iSel[] = jTab.getSelectedRows();
DefaultTableModel tm = (DefaultTableModel)jTab.getModel();
for(int x = iSel.length - 1; x >= 0; x--)
{
/*Borralo de la tabla*/
tm.removeRow(iSel[x]);
/*Borralo de la tabla del otro formulario*/
tm = (DefaultTableModel)jTabDom.getModel();
tm.removeRow(iSel[x]);
/*Resta en uno el contador de filas el contador de filas en uno*/
--iContFi;
}
}//GEN-LAST:event_jBDelActionPerformed
/*Cuando el mouse entra en el botón de borrar*/
private void jBDelMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jBDelMouseEntered
/*Cambia el color del fondo del botón*/
jBDel.setBackground(Star.colBot);
}//GEN-LAST:event_jBDelMouseEntered
/*Cuando el mouse sale del botón de borrar*/
private void jBDelMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jBDelMouseExited
/*Cambia el color del fondo del botón al original*/
jBDel.setBackground(colOri);
}//GEN-LAST:event_jBDelMouseExited
/*Función escalable para cuando se presiona una tecla en el módulo*/
void vKeyPreEsc(java.awt.event.KeyEvent evt)
{
/*Pon la bandera para saber que ya hubó un evento y no se desloguie*/
bIdle = true;
/*Si se presiona la tecla de escape presiona el botón de salir*/
if(evt.getKeyCode() == KeyEvent.VK_ESCAPE)
jBSal.doClick();
/*Si se presiona CTRL + SUP entonces presiona el botón de borrar*/
else if(evt.isControlDown() && evt.getKeyCode() == KeyEvent.VK_DELETE)
jBDel.doClick();
/*Si se presiona CTRL + N entonces presiona el botón de guardar*/
else if(evt.isControlDown() && evt.getKeyCode() == KeyEvent.VK_N)
jBAgre.doClick();
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jBAgre;
private javax.swing.JButton jBDel;
private javax.swing.JButton jBSal;
private javax.swing.JLabel jLAyu;
private javax.swing.JLabel jLCo1;
private javax.swing.JLabel jLCo2;
private javax.swing.JLabel jLCo3;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel17;
private javax.swing.JLabel jLabel18;
private javax.swing.JLabel jLabel20;
private javax.swing.JLabel jLabel21;
private javax.swing.JLabel jLabel22;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel30;
private javax.swing.JLabel jLabel39;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel40;
private javax.swing.JLabel jLabel41;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jP1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextField jTCP;
private javax.swing.JTextField jTCall;
private javax.swing.JTextField jTCel;
private javax.swing.JTextField jTCiu;
private javax.swing.JTextField jTCo1;
private javax.swing.JTextField jTCo2;
private javax.swing.JTextField jTCo3;
private javax.swing.JTextField jTCol;
private javax.swing.JTextField jTEstad;
private javax.swing.JTextField jTExten;
private javax.swing.JTextField jTLada;
private javax.swing.JTextField jTNoExt;
private javax.swing.JTextField jTNoInt;
private javax.swing.JTextField jTPai;
private javax.swing.JTextField jTTel;
private javax.swing.JTextField jTTelPer1;
private javax.swing.JTextField jTTelPer2;
private javax.swing.JTable jTab;
// End of variables declaration//GEN-END:variables
}/*Fin de public class Clientes extends javax.swing.JFrame */
|
[
"cesar.martinez@sos-soft.com"
] |
cesar.martinez@sos-soft.com
|
3ff3f965b322366d12fb65c26ab89c79ac248552
|
45365dccf512e3ee63e3cb9b64f0c8c47a883539
|
/src/main/java/com/baidu/yun/core/exception/YunHttpClientException.java
|
736d02ca328d97e8c5966cf60f3bf2f1048f7df3
|
[] |
no_license
|
nwj20100401/imserver
|
9288f988e68dcd64c7d17801ab69e7adfc6354dc
|
5677ffae1e93ac7fa4b24041050b514ec2856d24
|
refs/heads/master
| 2021-01-21T13:35:10.741939
| 2016-05-27T08:31:32
| 2016-05-27T08:31:32
| 53,181,384
| 4
| 4
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 264
|
java
|
package com.baidu.yun.core.exception;
public class YunHttpClientException extends Exception {
/**
*
*/
private static final long serialVersionUID = -6129408500549568294L;
public YunHttpClientException(String msg) {
super(msg);
}
}
|
[
"18638806483@163.com"
] |
18638806483@163.com
|
edc35be9c8444f66261ffcd6f6048d6181027289
|
e96172bcad99d9fddaa00c25d00a319716c9ca3a
|
/plugin/src/main/java/com/intellij/java/impl/ig/performance/JavaLangReflectInspection.java
|
21304e888066e52ab49aea64220c126bbb95aa3a
|
[
"Apache-2.0"
] |
permissive
|
consulo/consulo-java
|
8c1633d485833651e2a9ecda43e27c3cbfa70a8a
|
a96757bc015eff692571285c0a10a140c8c721f8
|
refs/heads/master
| 2023-09-03T12:33:23.746878
| 2023-08-29T07:26:25
| 2023-08-29T07:26:25
| 13,799,330
| 5
| 4
|
Apache-2.0
| 2023-01-03T08:32:23
| 2013-10-23T09:56:39
|
Java
|
UTF-8
|
Java
| false
| false
| 2,360
|
java
|
/*
* Copyright 2003-2007 Dave Griffith, Bas Leijdekkers
*
* 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.intellij.java.impl.ig.performance;
import javax.annotation.Nonnull;
import com.intellij.java.language.psi.PsiClassType;
import com.intellij.java.language.psi.PsiType;
import com.intellij.java.language.psi.PsiTypeElement;
import com.intellij.java.language.psi.PsiVariable;
import com.siyeh.InspectionGadgetsBundle;
import com.siyeh.ig.BaseInspection;
import com.siyeh.ig.BaseInspectionVisitor;
import consulo.annotation.component.ExtensionImpl;
import org.jetbrains.annotations.NonNls;
@ExtensionImpl
public class JavaLangReflectInspection extends BaseInspection {
@Nonnull
public String getDisplayName() {
return InspectionGadgetsBundle.message(
"java.lang.reflect.display.name");
}
@Nonnull
protected String buildErrorString(Object... infos) {
return InspectionGadgetsBundle.message(
"java.lang.reflect.problem.descriptor");
}
public BaseInspectionVisitor buildVisitor() {
return new JavaLangReflectVisitor();
}
private static class JavaLangReflectVisitor extends BaseInspectionVisitor {
@Override
public void visitVariable(@Nonnull PsiVariable variable) {
super.visitVariable(variable);
final PsiType type = variable.getType();
final PsiType componentType = type.getDeepComponentType();
if (!(componentType instanceof PsiClassType)) {
return;
}
final String className = ((PsiClassType)componentType).getClassName();
@NonNls final String javaLangReflect = "java.lang.reflect.";
if (!className.startsWith(javaLangReflect)) {
return;
}
final PsiTypeElement typeElement = variable.getTypeElement();
if (typeElement == null) {
return;
}
registerError(typeElement);
}
}
}
|
[
"vistall.valeriy@gmail.com"
] |
vistall.valeriy@gmail.com
|
844f0a80e40094cc5114ea1531dff69e63e39822
|
e37de6db1d0f1ca70f48ffc5eafc6e43744bc980
|
/mondrian/mondrian-model/src/main/java/com/tonbeller/wcf/format/StringHandler.java
|
5d63ff02557f1ecb12f4b479aab6c5d56f0a7456
|
[] |
no_license
|
cnopens/BA
|
8490e6e83210343a35bb1e5a6769209a16557e3f
|
ba58acf949af1249cc637ccf50702bb28462d8ad
|
refs/heads/master
| 2021-01-20T16:38:38.479034
| 2014-11-13T00:44:00
| 2014-11-13T00:44:00
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,550
|
java
|
/*
* ====================================================================
* This software is subject to the terms of the Common Public License
* Agreement, available at the following URL:
* http://www.opensource.org/licenses/cpl.html .
* Copyright (C) 2003-2004 TONBELLER AG.
* All Rights Reserved.
* You must accept the terms of that agreement to use this software.
* ====================================================================
*
*
*/
package com.tonbeller.wcf.format;
import java.util.List;
/**
* @author av
*/
public class StringHandler extends FormatHandlerSupport {
public String format(Object o, String userPattern) {
// dont show "null"
if (o == null)
return "";
return String.valueOf(o);
}
public Object parse(String s, String userPattern) {
// microsoft sends \r\n sometimes?!
if (s.indexOf(13) >= 0) {
StringBuffer sb = new StringBuffer();
char[] ca = s.toCharArray();
for (int i = 0; i < ca.length; i++) {
if (ca[i] != 13)
sb.append(ca[i]);
}
s = sb.toString();
}
return s;
}
public boolean canHandle(Object value) {
return value instanceof String;
}
public Object toNativeArray(List list) {
String[] array = new String[list.size()];
for (int i = 0; i < array.length; i++)
array[i] = (String) list.get(i);
return array;
}
public Object[] toObjectArray(Object value) {
if (value instanceof String)
return new String[] {(String) value };
return (String[]) value;
}
}
|
[
"panbasten@126.com"
] |
panbasten@126.com
|
39bf4111e80788c503a2d4e8c135e63b7512c182
|
0e02393f6d9c09f2453c3e7bc729052ff74f922f
|
/librarytao/src/main/java/com/yitao/widget/InsideViewPager.java
|
0941b5afbbe3d3e58cd7d44547ef1e10e6d9a180
|
[] |
no_license
|
eaglelhq/HBPostal
|
fbcb6765d082940cb3511c2312ab9b1cbe8c3180
|
76df376aed3022506bbb1eacc598dbc1377242ba
|
refs/heads/master
| 2021-05-05T19:55:44.299097
| 2018-11-12T02:49:23
| 2018-11-12T02:49:23
| 103,887,994
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 4,392
|
java
|
package com.yitao.widget;
import android.content.Context;
import android.graphics.PointF;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.GestureDetector;
import android.view.MotionEvent;
/**
* 此ViewPager解决与父容器ScrollView冲突的问题,无法完美解决.有卡顿 此自定义组件和下拉刷新scrollview配合暂时小完美,有待改善
*
* @author bavariama
*
*/
public class InsideViewPager extends ViewPager {
// float curX = 0f;
// float downX = 0f;
OnSingleTouchListener onSingleTouchListener;
/** 触摸时按下的点 **/
PointF downP = new PointF();
/** 触摸时当前的点 **/
PointF curP = new PointF();
/** 自定义手势**/
private GestureDetector mGestureDetector;
public InsideViewPager(Context context) {
// TODO Auto-generated constructor stub
super(context);
mGestureDetector = new GestureDetector(context, new XScrollDetector());
}
public InsideViewPager(Context context, AttributeSet attrs) {
// TODO Auto-generated constructor stub
super(context, attrs);
mGestureDetector = new GestureDetector(context, new XScrollDetector());
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
// TODO Auto-generated method stub
// return super.onInterceptTouchEvent(ev);
//接近水平滑动时子控件处理该事件,否则交给父控件处理
return !mGestureDetector.onTouchEvent(ev);
// return true;
}
@Override
public boolean onTouchEvent(MotionEvent ev) {
// curX = ev.getX();
// // TODO Auto-generated method stub
// if (ev.getAction() == MotionEvent.ACTION_DOWN) {
// downX = curX;
// }
// int curIndex = getCurrentItem();
// if (curIndex == 0) {
// if (downX <= curX) {
// getParent().requestDisallowInterceptTouchEvent(false);
// } else {
// getParent().requestDisallowInterceptTouchEvent(true);
// }
// } else if (curIndex == getAdapter().getCount() - 1) {
// if (downX >= curX) {
// getParent().requestDisallowInterceptTouchEvent(false);
// } else {
// getParent().requestDisallowInterceptTouchEvent(true);
// }
// } else {
// getParent().requestDisallowInterceptTouchEvent(true);
// }
// getParent().requestDisallowInterceptTouchEvent(false);
//
// return super.onTouchEvent(ev);
//每次进行onTouch事件都记录当前的按下的坐标
curP.x = ev.getX();
curP.y = ev.getY();
if(ev.getAction() == MotionEvent.ACTION_DOWN){
//记录按下时候的坐标
//切记不可用 downP = curP ,这样在改变curP的时候,downP也会改变
downP.x = ev.getX();
downP.y = ev.getY();
//此句代码是为了通知他的父ViewPager现在进行的是本控件的操作,不要对我的操作进行干扰
getParent().requestDisallowInterceptTouchEvent(false);
}
if(ev.getAction() == MotionEvent.ACTION_MOVE){
float distanceX = curP.x - downP.x;
float distanceY = curP.y - downP.y;
//接近水平滑动,ViewPager控件捕获手势,水平滚动
if(Math.abs(distanceX) > Math.abs(distanceY)){
//此句代码是为了通知他的父ViewPager现在进行的是本控件的操作,不要对我的操作进行干扰
getParent().requestDisallowInterceptTouchEvent(false);
}else{
//接近垂直滑动,交给父控件处理
getParent().requestDisallowInterceptTouchEvent(true);
}
}
return super.onTouchEvent(ev);
}
private class XScrollDetector extends GestureDetector.SimpleOnGestureListener{
@Override
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
// return super.onScroll(e1, e2, distanceX, distanceY);
//接近水平滑动时子控件处理该事件,否则交给父控件处理
return (Math.abs(distanceX) > Math.abs(distanceY));
}
}
public void onSingleTouch() {
if (onSingleTouchListener != null) {
onSingleTouchListener.onSingleTouch();
}
}
public interface OnSingleTouchListener {
public void onSingleTouch();
}
public void setOnSingleTouchListner(
OnSingleTouchListener onSingleTouchListener) {
this.onSingleTouchListener = onSingleTouchListener;
}
}
|
[
"lhq11031103@126.com"
] |
lhq11031103@126.com
|
8b3acd626498461fc927017d2a97c147de4801c9
|
ba09be3c156d47dbb0298ff2d49b693a4d0ad07f
|
/src/com/sgepit/pcmis/tzgl/hbm/VPcTzglDyreport3M.java
|
2d7efd74875b0dacc9582cb01d5c0a870ee88d50
|
[] |
no_license
|
newlethe/myProject
|
835d001abc86cd2e8be825da73d5421f8d31620f
|
ff2a30e9c58a751fa78ac7722e2936b3c9a02d20
|
refs/heads/master
| 2021-01-21T04:53:53.244374
| 2016-06-07T04:11:36
| 2016-06-07T04:19:11
| 47,071,697
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 6,421
|
java
|
package com.sgepit.pcmis.tzgl.hbm;
import java.util.Date;
/**
* PcTzglDyreport1M entity.
*
* @author MyEclipse Persistence Tools
*/
public class VPcTzglDyreport3M implements java.io.Serializable {
// Fields
private String uids;
private String pid;
private String sjType;
private String unitId;
private String title;
private String userId;
private Date createDate;
private String state;
private String billState;
private String memo;
private Double memoNumber1;
private Double memoNumber2;
private Double memoNumber3;
private String memoVarchar1;
private String memoVarchar2;
private String memoVarchar3;
private Date memoDate1;
private Date memoDate2;
//在实体Java类中加入以下属性
private String unitTypeId;
private String unitname;
private String reason;
private String createperson;
private String unitUsername;
private String countUsername;
private String createpersonTel;
private Date reportDate;
private String flagNull;
// Constructors
public String getCreateperson() {
return createperson;
}
public void setCreateperson(String createperson) {
this.createperson = createperson;
}
public String getUnitUsername() {
return unitUsername;
}
public void setUnitUsername(String unitUsername) {
this.unitUsername = unitUsername;
}
public String getCountUsername() {
return countUsername;
}
public void setCountUsername(String countUsername) {
this.countUsername = countUsername;
}
public String getCreatepersonTel() {
return createpersonTel;
}
public void setCreatepersonTel(String createpersonTel) {
this.createpersonTel = createpersonTel;
}
public Date getReportDate() {
return reportDate;
}
public void setReportDate(Date reportDate) {
this.reportDate = reportDate;
}
/** default constructor */
public VPcTzglDyreport3M() {
}
/** full constructor */
public VPcTzglDyreport3M(String pid, String sjType, String unitId,
String title, String userId, Date createDate, String state,
String billState, String memo, Double memoNumber1,
Double memoNumber2, Double memoNumber3, String memoVarchar1,
String memoVarchar2, String memoVarchar3, Date memoDate1,
Date memoDate2,String unitTypeId, String unitname, String reason,
String createperson,String unitUsername,String countUsername,
String createpersonTel,Date reportDate, String flagNull) {
this.pid = pid;
this.sjType = sjType;
this.unitId = unitId;
this.title = title;
this.userId = userId;
this.createDate = createDate;
this.state = state;
this.billState = billState;
this.memo = memo;
this.memoNumber1 = memoNumber1;
this.memoNumber2 = memoNumber2;
this.memoNumber3 = memoNumber3;
this.memoVarchar1 = memoVarchar1;
this.memoVarchar2 = memoVarchar2;
this.memoVarchar3 = memoVarchar3;
this.memoDate1 = memoDate1;
this.memoDate2 = memoDate2;
this.unitTypeId = unitTypeId;
this.unitname = unitname;
this.reason =reason;
this.createperson=createperson;
this.countUsername=countUsername;
this.unitUsername=unitUsername;
this.createpersonTel=createpersonTel;
this.reportDate=reportDate;
this.flagNull = flagNull;
}
// Property accessors
public String getUids() {
return this.uids;
}
public void setUids(String uids) {
this.uids = uids;
}
public String getPid() {
return this.pid;
}
public void setPid(String pid) {
this.pid = pid;
}
public String getSjType() {
return this.sjType;
}
public void setSjType(String sjType) {
this.sjType = sjType;
}
public String getUnitId() {
return this.unitId;
}
public void setUnitId(String unitId) {
this.unitId = unitId;
}
public String getTitle() {
return this.title;
}
public void setTitle(String title) {
this.title = title;
}
public String getUserId() {
return this.userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public Date getCreateDate() {
return this.createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
public String getState() {
return this.state;
}
public void setState(String state) {
this.state = state;
}
public String getBillState() {
return this.billState;
}
public void setBillState(String billState) {
this.billState = billState;
}
public String getMemo() {
return this.memo;
}
public void setMemo(String memo) {
this.memo = memo;
}
public Double getMemoNumber1() {
return this.memoNumber1;
}
public void setMemoNumber1(Double memoNumber1) {
this.memoNumber1 = memoNumber1;
}
public Double getMemoNumber2() {
return this.memoNumber2;
}
public void setMemoNumber2(Double memoNumber2) {
this.memoNumber2 = memoNumber2;
}
public Double getMemoNumber3() {
return this.memoNumber3;
}
public void setMemoNumber3(Double memoNumber3) {
this.memoNumber3 = memoNumber3;
}
public String getMemoVarchar1() {
return this.memoVarchar1;
}
public void setMemoVarchar1(String memoVarchar1) {
this.memoVarchar1 = memoVarchar1;
}
public String getMemoVarchar2() {
return this.memoVarchar2;
}
public void setMemoVarchar2(String memoVarchar2) {
this.memoVarchar2 = memoVarchar2;
}
public String getMemoVarchar3() {
return this.memoVarchar3;
}
public void setMemoVarchar3(String memoVarchar3) {
this.memoVarchar3 = memoVarchar3;
}
public Date getMemoDate1() {
return this.memoDate1;
}
public void setMemoDate1(Date memoDate1) {
this.memoDate1 = memoDate1;
}
public Date getMemoDate2() {
return this.memoDate2;
}
public void setMemoDate2(Date memoDate2) {
this.memoDate2 = memoDate2;
}
public String getUnitTypeId() {
return unitTypeId;
}
public void setUnitTypeId(String unitTypeId) {
this.unitTypeId = unitTypeId;
}
public String getUnitname() {
return unitname;
}
public void setUnitname(String unitname) {
this.unitname = unitname;
}
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
public String getFlagNull() {
return flagNull;
}
public void setFlagNull(String flagNull) {
this.flagNull = flagNull;
}
}
|
[
"newlethe@qq.com"
] |
newlethe@qq.com
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.