blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
982dbb604e1447d5d152dc2951f9bfd69f4efcb2 | 64346c5e6c90747f0d8db5362e6ca849d4f89653 | /test/ar/edu/unq/po2/tpObserver/publicaciones/PublicationSystemTestCase.java | 2565a7155d8ef000cbe78c8112a15777cd40ee86 | [] | no_license | nicolasdemaio/unq-poo2-de_maio | cc3f7b81ea8182be95a83c321a764c2cd7c47825 | 45a8d635141e1dd2a3e561b1f6dd595d4634b0d2 | refs/heads/master | 2023-02-16T12:26:13.716850 | 2021-01-16T02:29:44 | 2021-01-16T02:29:44 | 329,969,255 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,543 | java | package ar.edu.unq.po2.tpObserver.publicaciones;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.Mockito.*;
import java.util.Arrays;
import java.util.List;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
class PublicationSystemTestCase {
private PublicationSystem sistema;
@BeforeEach
void setUp() throws Exception {
sistema = new PublicationSystem();
}
@Test
void testConstructor() {
assertTrue(sistema.getSuscriptores().isEmpty());
}
@Test
void testAgregarSuscriptor() {
//Setup
IInvestigador investigador = mock(IInvestigador.class);
List<String> preferencias = Arrays.asList("Bernal", "Smalltalk");
//Exercise
sistema.agregarSuscriptor(investigador, preferencias);
//Verify
assertTrue(sistema.getSuscriptores().containsKey(investigador));
assertEquals(preferencias, sistema.preferenciasDe(investigador));
}
@Test
void testRemoverSuscriptor() {
//Setup
IInvestigador investigador = mock(IInvestigador.class);
List<String> preferencias = Arrays.asList("Bernal", "Smalltalk");
//Exercise
sistema.agregarSuscriptor(investigador, preferencias);
sistema.removerSuscriptor(investigador);
//Verify
assertFalse(sistema.getSuscriptores().containsKey(investigador));
}
@Test
void testCuandoSeAgregaUnArticulo_SeNotificaALosSuscriptoresConEsosIntereses() {
//Setup
IInvestigador investigadorNotificado = mock(IInvestigador.class);
List<String> preferenciasNotificables = Arrays.asList("Bernal", "Smalltalk");
IInvestigador investigadorNoNotificado = mock(IInvestigador.class);
List<String> preferenciasNoNotificables = Arrays.asList("Java");
Article articulo = mock(Article.class);
when(articulo.correspondeConLasPreferencias(preferenciasNotificables)).thenReturn(true);
when(articulo.correspondeConLasPreferencias(preferenciasNoNotificables)).thenReturn(false);
//Exercise
sistema.agregarSuscriptor(investigadorNotificado, preferenciasNotificables);
sistema.agregarSuscriptor(investigadorNoNotificado, preferenciasNoNotificables);
sistema.addArticle(articulo);
//Verify
assertTrue(sistema.getArticulos().contains(articulo));
verify(investigadorNotificado, times(1)).update(articulo);
verifyZeroInteractions(investigadorNoNotificado);
}
@Test
void testRemoveArticle() {
//Setup
Article articulo = mock(Article.class);
//Exercise
sistema.removeArticle(articulo);
//Verify
assertFalse(sistema.getArticulos().contains(articulo));
}
}
| [
"[email protected]"
] | |
991dbffea437c8af3f109fb046347fa10b685cb2 | b882f1445aaf2bfa6abaf1da78e7b9961bfcacdf | /src/com/jntua/dao/model/StudentTL.java | 9e018e8838f921962cc0c90bf17908241da2441d | [] | no_license | Security-Online-Examination-System/Online-Exaination-System | ea6dcb6d9cb695280f130c7273e623dc5b8d1737 | 0e33a6b5c3e451a9a13b8ac12779ebb08785f2b5 | refs/heads/master | 2020-03-31T01:05:44.214236 | 2018-10-05T19:13:36 | 2018-10-05T19:13:36 | 151,766,523 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,251 | java | package com.jntua.dao.model;
public class StudentTL {
private Integer studentId;
private String name;
private String emailId;
private String mobileNo;
private String regNo;
private String password;
private Integer courseId;
public Integer getCourseId() {
return courseId;
}
public void setCourseId(Integer courseId) {
this.courseId = courseId;
}
private String semester;
public Integer getStudentId() {
return studentId;
}
public void setStudentId(Integer studentId) {
this.studentId = studentId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEmailId() {
return emailId;
}
public void setEmailId(String emailId) {
this.emailId = emailId;
}
public String getMobileNo() {
return mobileNo;
}
public void setMobileNo(String mobileNo) {
this.mobileNo = mobileNo;
}
public String getRegNo() {
return regNo;
}
public void setRegNo(String regNo) {
this.regNo = regNo;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getSemester() {
return semester;
}
public void setSemester(String semester) {
this.semester = semester;
}
}
| [
"[email protected]"
] | |
886baabea5626bd8903874b222c90f9d5c6c771c | 0516237d5b20ba090503ee042dc2c74ec2cf0b5f | /arabic_countries_names_picker/src/main/java/com/mnashat/arabic_countries_names_picker/CountriesProvider.java | ad743486ab919191eef1abdb127c5ce1105ab6ed | [] | no_license | MuhamamdNashat/Arabic-Countries-Names-Picker-Android | a05a5c65baeac0ea1952f0cca45ee93272dca9f0 | 08eece09711a1df44ebc83c7a8038e7f2e3fb3e9 | refs/heads/master | 2020-06-15T16:19:51.279255 | 2019-07-05T04:49:55 | 2019-07-05T04:49:55 | 195,339,625 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 434 | java | package com.mnashat.arabic_countries_names_picker;
import android.app.Activity;
import android.content.Intent;
public class CountriesProvider {
public static final int COUNTRIES_CODE = 421;
public static final String COUNTRY = "country";
public static void getCountries(Activity activity)
{
Intent intent = new Intent(activity,CountriesActivity.class);
activity.startActivityForResult(intent,COUNTRIES_CODE);
}
}
| [
"[email protected]"
] | |
ee933d006867347bffa1634972cf39dcd61a6040 | 15abcafeb6dfb831d8469ffab007650710f96aeb | /src/main/java/com/project/shared/entities/WorkingTime.java | 61991adf04adb0e539912ffad3a327cbb4b95ecc | [] | no_license | Krupnova/project | 042cb46221ccba7ea9942b086b7bfc2e16989e8a | f3345bac6bfc6f59a929500f7356cb45fbf8dd13 | refs/heads/master | 2021-08-23T15:05:45.859875 | 2017-12-05T10:15:40 | 2017-12-05T10:15:40 | 113,082,684 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,542 | java | package com.project.shared.entities;
import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
@Entity
@Table(name = "working_time")
public class WorkingTime implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
@ManyToOne()
@Cascade({CascadeType.SAVE_UPDATE})
@JoinColumn(name = "employee_id", nullable = false)
@OnDelete(action = OnDeleteAction.CASCADE)
private Employee employee;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "working_time_start", nullable = false)
private Date workingTimeStart;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "working_time_end", nullable = false)
private Date workingTimeEnd;
@Column(name = "holiday", nullable = false)
private boolean holiday;
public WorkingTime() {
}
public WorkingTime(Employee employee, Date workingTimeStart, Date workingTimeEnd) {
this.employee = employee;
this.workingTimeStart = workingTimeStart;
this.workingTimeEnd = workingTimeEnd;
holiday = false;
}
public WorkingTime(Employee employee, Date workingTimeStart, Date workingTimeEnd, boolean holiday) {
this.employee = employee;
this.workingTimeStart = workingTimeStart;
this.workingTimeEnd = workingTimeEnd;
this.holiday = holiday;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public Employee getEmployee() {
return employee;
}
public void setEmployee(Employee employee) {
this.employee = employee;
}
public Date getWorkingTimeStart() {
return workingTimeStart;
}
public void setWorkingTimeStart(Date start) {
this.workingTimeStart = start;
}
public Date getWorkingTimeEnd() {
return workingTimeEnd;
}
public void setWorkingTimeEnd(Date end) {
this.workingTimeEnd = end;
}
public boolean isHoliday() {
return holiday;
}
public void setHoliday(boolean holiday) {
this.holiday = holiday;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
WorkingTime that = (WorkingTime) o;
if (id != that.id) return false;
if (!employee.equals(that.employee)) return false;
if (!workingTimeStart.equals(that.workingTimeStart)) return false;
if (holiday != that.holiday) return false;
return workingTimeEnd.equals(that.workingTimeEnd);
}
@Override
public int hashCode() {
int result = (int) (id ^ (id >>> 32));
result = 31 * result + employee.hashCode();
result = 31 * result + workingTimeStart.hashCode();
result = 31 * result + workingTimeEnd.hashCode();
result = 31 * result + (holiday ? 1 : 0);
return result;
}
@Override
public String toString() {
return "WorkingTime{" +
"id=" + id +
", employeeId=" + (employee == null ? null : employee.getEmployeeId()) +
", start=" + workingTimeStart +
", end=" + workingTimeEnd +
(holiday ? ", it's holiday" : ", it's workday") +
'}';
}
}
| [
"[email protected]"
] | |
3d2353023665b89261cb4a0c06f0a7bc7d3f4b07 | 3896e5924cda190ea06fce6fbcf9bd7211f12343 | /negocio/src/main/java/co/edu/uniquindio/proyecto/servicios/TelefonoServicio.java | 94248eb9e0d54b0b7cc8e4c42d8dadb45eea913b | [] | no_license | CristianUni/UniLocal | 58c42889d88918ac6f1f80f06a6ff6c7ee68aa7e | 9ef6440020e408f158bf85b6cc5626e9af55fc29 | refs/heads/master | 2023-06-29T20:07:06.998420 | 2021-08-05T00:49:15 | 2021-08-05T00:49:15 | 357,613,804 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 87 | java | package co.edu.uniquindio.proyecto.servicios;
public interface TelefonoServicio {
}
| [
"[email protected]"
] | |
f6406cd1753434b30fec93ddf05b4db425e3ab1a | 782c86aa87434dc32604b864166bfd7816865c4f | /src/main/java/com/progressoft/brix/domino/ui/utils/IsHtmlComponent.java | e09adeb27e1a791713bd8ae4c13afe6141ac9d45 | [] | no_license | DevLord-Shiv/domino-ui | b081da6b259e22c1ab8541700a9d6cddcab82eb4 | 4f8846f5f687ade2825f3a2bdd9b903a3cc5d33f | refs/heads/master | 2021-04-12T08:20:38.624897 | 2018-03-18T19:51:38 | 2018-03-18T19:51:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 258 | java | package com.progressoft.brix.domino.ui.utils;
import elemental2.dom.HTMLElement;
import org.jboss.gwt.elemento.core.IsElement;
public interface IsHtmlComponent<E extends HTMLElement, C extends IsElement<E>>{
HtmlComponentBuilder<E,C> htmlBuilder();
}
| [
"[email protected]"
] | |
73d93b2c9f3b69dcee42883e230f7d9a0bdb557d | ae1581f40c0bb73053881062ceb9db1e81c56ea5 | /core/src/test/java/framework/utils/tests/dto/httpclient/Location.java | 7500ec28bc4de190c767e3944b182856dda27369 | [] | no_license | nbabii/framework.automation | c35175d8d9998dbb43336bb11eac7b9ab4711267 | cc6ed268ce6036bfa9d66c5ffd576f0a04a2a5cc | refs/heads/master | 2021-05-29T17:33:47.498737 | 2015-03-04T18:22:28 | 2015-03-04T18:22:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 852 | java | package framework.utils.tests.dto.httpclient;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.thoughtworks.xstream.annotations.XStreamAlias;
@XStreamAlias("location")
@JsonIgnoreProperties(ignoreUnknown = true)
public class Location {
@XStreamAlias("lat")
private double lat;
@XStreamAlias("lng")
private double lng;
@JsonCreator
public Location(@JsonProperty("lat") double lat, @JsonProperty("lng") double lng) {
super();
this.lat = lat;
this.lng = lng;
}
public double getLat() {
return lat;
}
public void setLat(double lat) {
this.lat = lat;
}
public double getLng() {
return lng;
}
public void setLng(double lng) {
this.lng = lng;
}
}
| [
"tlytvyn"
] | tlytvyn |
9b9f5096546fb37a5b195024b436bd3302411de8 | 38976fe84f73cb441bdd51eab2b61f665301a478 | /jtbdivelogbook-client/src/main/java/be/vds/jtbdive/client/view/docking/DiverDetailDockable.java | 3454c296603606e801573d1ec7ca5e27d486ac14 | [] | no_license | jtbgroup/jtbdivelogbook | 941b2d5d2bfd4aa7a73ba3e7545fed5a8ca63136 | eb85eec22414ec9f6b1576508b042d9fda6a5543 | refs/heads/master | 2021-01-10T22:06:45.586396 | 2016-01-01T19:11:08 | 2016-01-01T19:11:08 | 27,634,681 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,128 | java | /*
* Jt'B Dive Logbook - Electronic dive logbook.
*
* Copyright (C) 2010 Gautier Vanderslyen
*
* Jt'B Dive Logbook is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package be.vds.jtbdive.client.view.docking;
import be.vds.jtbdive.client.view.core.diver.DiverDetailPanel;
import be.vds.jtbdive.client.view.utils.UIAgent;
import be.vds.jtbdive.core.logging.Syslog;
import bibliothek.gui.dock.common.event.CDockableAdapter;
import bibliothek.gui.dock.common.event.CDockableStateListener;
import bibliothek.gui.dock.common.intern.CDockable;
public class DiverDetailDockable extends I18nDefaultSingleCDockable {
private static final Syslog LOGGER = Syslog.getLogger(DiverDetailDockable.class);
private DiverDetailPanel contentPanel;
public DiverDetailDockable() {
super(DockingLayoutManager.VIEW_DIVER_DETAIL,
DockingLayoutManager.VIEW_DIVER_DETAIL, UIAgent.getInstance()
.getIcon(UIAgent.ICON_DIVER_BLACK_DETAIL_16), null);
initListeners();
initComponents();
}
private void initComponents() {
contentPanel = new DiverDetailPanel();
getContentPane().add(contentPanel);
}
private void initListeners() {
CDockableStateListener listener = new CDockableAdapter() {
@Override
public void visibilityChanged(CDockable cd) {
boolean visible = DiverDetailDockable.this.isVisible();
LOGGER.debug("visibility is now : " +visible);
}
};
this.addCDockableStateListener(listener);
}
}
| [
"[email protected]"
] | |
ea6cd22c941196e37eed15669b82788980005696 | 3a5985651d77a31437cfdac25e594087c27e93d6 | /ojc-core/component-common/xmlbeans/xbean-src/2.3.0/xmlbeans/src/common/org/apache/xmlbeans/impl/common/NameUtil.java | 28acc6f4ecda419dd8978bcf39fa959275a61c2f | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | vitalif/openesb-components | a37d62133d81edb3fdc091abd5c1d72dbe2fc736 | 560910d2a1fdf31879e3d76825edf079f76812c7 | refs/heads/master | 2023-09-04T14:40:55.665415 | 2016-01-25T13:12:22 | 2016-01-25T13:12:33 | 48,222,841 | 0 | 5 | null | null | null | null | UTF-8 | Java | false | false | 24,467 | java | /* Copyright 2004 The Apache Software Foundation
*
* 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.apache.xmlbeans.impl.common;
import javax.xml.namespace.QName;
import java.util.*;
public class NameUtil
{
// punctuation characters
public final static char HYPHEN = '\u002D';
public final static char PERIOD = '\u002E';
public final static char COLON = '\u003A';
public final static char USCORE = '\u005F';
public final static char DOT = '\u00B7';
public final static char TELEIA = '\u0387';
public final static char AYAH = '\u06DD';
public final static char ELHIZB = '\u06DE';
private final static boolean DEBUG = false;
private final static Set javaWords = new HashSet(Arrays.asList(
new String[]
{
"assert",
"abstract",
"boolean",
"break",
"byte",
"case",
"catch",
"char",
"class",
"const",
"continue",
"default",
"do",
"double",
"else",
"enum", // since JDK1.5
"extends",
"false", // not a keyword
"final",
"finally",
"float",
"for",
"goto",
"if",
"implements",
"import",
"instanceof",
"int",
"interface",
"long",
"native",
"new",
"null", // not a keyword
"package",
"private",
"protected",
"public",
"return",
"short",
"static",
"strictfp",
"super",
"switch",
"synchronized",
"this",
"threadsafe",
"throw",
"throws",
"transient",
"true", // not a keyword
"try",
"void",
"volatile",
"while",
}
));
/*
private final static Set javaNames = new HashSet(Arrays.asList(
new String[]
{
"CharSequence",
"Cloneable",
"Comparable",
"Runnable",
"Boolean",
"Byte",
"Character",
"Class",
"ClassLoader",
"Compiler",
"Double",
"Float",
"InheritableThreadLocal",
"Integer",
"Long",
"Math",
"Number",
"Object",
"Package",
"Process",
"Runtime",
"RuntimePermission",
"SecurityManager",
"Short",
"StackTraceElement",
"StrictMath",
"String",
"StringBuffer",
"System",
"Thread",
"ThreadGroup",
"ThreadLocal",
"Throwable",
"Void",
"ArithmeticException",
"ArrayIndexOutOfBoundsException",
"ArrayStoreException",
"ClassCastException",
"ClassNotFoundException",
"CloneNotSupportedException",
"Exception",
"IllegalAccessException",
"IllegalArgumentException",
"IllegalMonitorStateException",
"IllegalStateException",
"IllegalThreadStateException",
"IndexOutOfBoundsException",
"InstantiationException",
"InterruptedException",
"NegativeArraySizeException",
"NoSuchFieldException",
"NoSuchMethodException",
"NullPointerException",
"NumberFormatException",
"RuntimeException",
"SecurityException",
"StringIndexOutOfBoundsException",
"UnsupportedOperationException",
"AbstractMethodError",
"AssertionError",
"ClassCircularityError",
"ClassFormatError",
"Error",
"ExceptionInInitializerError",
"IllegalAccessError",
"IncompatibleClassChangeError",
"InstantiationError",
"InternalError",
"LinkageError",
"NoClassDefFoundError",
"NoSuchFieldError",
"NoSuchMethodError",
"OutOfMemoryError",
"StackOverflowError",
"ThreadDeath",
"UnknownError",
"UnsatisfiedLinkError",
"UnsupportedClassVersionError",
"VerifyError",
"VirtualMachineError",
}
));
*/
private final static Set javaNames = new HashSet(Arrays.asList(
new String[]
{
// 1. all the Java.lang classes [1.4.1 JDK].
"CharSequence",
"Cloneable",
"Comparable",
"Runnable",
"Boolean",
"Byte",
"Character",
"Class",
"ClassLoader",
"Compiler",
"Double",
"Float",
"InheritableThreadLocal",
"Integer",
"Long",
"Math",
"Number",
"Object",
"Package",
"Process",
"Runtime",
"RuntimePermission",
"SecurityManager",
"Short",
"StackTraceElement",
"StrictMath",
"String",
"StringBuffer",
"System",
"Thread",
"ThreadGroup",
"ThreadLocal",
"Throwable",
"Void",
"ArithmeticException",
"ArrayIndexOutOfBoundsException",
"ArrayStoreException",
"ClassCastException",
"ClassNotFoundException",
"CloneNotSupportedException",
"Exception",
"IllegalAccessException",
"IllegalArgumentException",
"IllegalMonitorStateException",
"IllegalStateException",
"IllegalThreadStateException",
"IndexOutOfBoundsException",
"InstantiationException",
"InterruptedException",
"NegativeArraySizeException",
"NoSuchFieldException",
"NoSuchMethodException",
"NullPointerException",
"NumberFormatException",
"RuntimeException",
"SecurityException",
"StringIndexOutOfBoundsException",
"UnsupportedOperationException",
"AbstractMethodError",
"AssertionError",
"ClassCircularityError",
"ClassFormatError",
"Error",
"ExceptionInInitializerError",
"IllegalAccessError",
"IncompatibleClassChangeError",
"InstantiationError",
"InternalError",
"LinkageError",
"NoClassDefFoundError",
"NoSuchFieldError",
"NoSuchMethodError",
"OutOfMemoryError",
"StackOverflowError",
"ThreadDeath",
"UnknownError",
"UnsatisfiedLinkError",
"UnsupportedClassVersionError",
"VerifyError",
"VirtualMachineError",
// 2. other classes used as primitive types by xml beans
"BigInteger",
"BigDecimal",
"Enum",
"Date",
"GDate",
"GDuration",
"QName",
"List",
// 3. the top few org.apache.xmlbeans names
"XmlObject",
"XmlCursor",
"XmlBeans",
"SchemaType",
}
));
public static boolean isValidJavaIdentifier(String id)
{
if (id == null)
throw new IllegalArgumentException("id cannot be null");
int len = id.length();
if (len == 0)
return false;
if (javaWords.contains(id))
return false;
if (!Character.isJavaIdentifierStart(id.charAt(0)))
return false;
for (int i = 1; i < len; i++)
{
if (!Character.isJavaIdentifierPart(id.charAt(i)))
return false;
}
return true;
}
public static String getClassNameFromQName(QName qname)
{
return getClassNameFromQName(qname, false);
}
public static String getClassNameFromQName(QName qname, boolean useJaxRpcRules)
{
String java_type = upperCamelCase(qname.getLocalPart(), useJaxRpcRules);
String uri = qname.getNamespaceURI();
String java_pkg = null;
java_pkg = getPackageFromNamespace(uri, useJaxRpcRules);
if (java_pkg != null)
return java_pkg + "." + java_type;
else
return java_type;
}
private static final String JAVA_NS_PREFIX="java:";
private static final String LANG_PREFIX = "java.";
public static String getNamespaceFromPackage(final Class clazz)
{
Class curr_clazz = clazz;
while (curr_clazz.isArray())
curr_clazz = curr_clazz.getComponentType();
String fullname = clazz.getName();
int lastdot = fullname.lastIndexOf('.');
String pkg_name = lastdot < 0 ? "" : fullname.substring(0, lastdot);
//special case for builtin types
/*
if (curr_clazz.isPrimitive())
{
pkg_name = c.getJavaLanguageNamespaceUri();
}
else if (pkg_name.startsWith(LANG_PREFIX))
{
final String rem_str = pkg_name.substring(LANG_PREFIX.length());
pkg_name = c.getJavaLanguageNamespaceUri() + "." + rem_str;
}
*/
return JAVA_NS_PREFIX + pkg_name;
}
private static boolean isUriSchemeChar(char ch)
{
return (ch >= 'a' && ch <='z' ||
ch >= 'A' && ch <='Z' ||
ch >= '0' && ch <='9' ||
ch == '-' || ch == '.' || ch == '+');
}
private static boolean isUriAlphaChar(char ch)
{
return (ch >= 'a' && ch <='z' || ch >= 'A' && ch <= 'Z');
}
private static int findSchemeColon(String uri)
{
int len = uri.length();
if (len == 0)
return -1;
if (!isUriAlphaChar(uri.charAt(0)))
return -1;
int i;
for (i = 1; i < len; i++)
if (!isUriSchemeChar(uri.charAt(i)))
break;
if (i == len)
return -1;
if (uri.charAt(i) != ':')
return -1;
// consume consecutive colons
for (; i < len; i++)
if (uri.charAt(i) != ':')
break;
// for the "scheme:::" case, return len-1
return i-1;
}
private static String jls77String(String name)
{
StringBuffer buf = new StringBuffer(name);
for (int i = 0; i < name.length(); i++)
{
// We need to also make sure that our package names don't contain the
// "$" character in them, which, although a valid Java identifier part,
// would create confusion when trying to generate fully-qualified names
if (!Character.isJavaIdentifierPart(buf.charAt(i)) || '$' == buf.charAt(i))
buf.setCharAt(i, '_');
}
if (buf.length() == 0 || !Character.isJavaIdentifierStart(buf.charAt(0)))
buf.insert(0, '_');
if (isJavaReservedWord(name))
buf.append('_');
return buf.toString();
}
private static List splitDNS(String dns)
{
// JAXB says: only split+reverse DNS if TLD matches known TLDs or ISO 3166
// We are ignoring this now (TH)
List result = new ArrayList();
int end = dns.length();
int begin = dns.lastIndexOf('.');
for ( ; begin != -1 ; begin--)
{
if (dns.charAt(begin) == '.') {
result.add(jls77String(dns.substring(begin + 1, end)));
end = begin;
}
}
result.add(jls77String(dns.substring(0, end)));
// JAXB draft example implies removal of www
if (result.size() >= 3 &&
((String)result.get(result.size() - 1)).toLowerCase().equals("www"))
result.remove(result.size() - 1);
return result;
}
private static String processFilename(String filename)
{
// JAXB says: strip 2 or 3 letter extension or ".html"
int i = filename.lastIndexOf('.');
if (i > 0 && (
i + 1 + 2 == filename.length() ||
i + 1 + 3 == filename.length() ||
filename.substring(i + 1).toLowerCase() == "html"))
{
return filename.substring(0, i);
}
return filename;
}
public static String getPackageFromNamespace(String uri)
{
return getPackageFromNamespace(uri, false);
}
public static String getPackageFromNamespace(String uri, boolean useJaxRpcRules)
{
// special case: no namespace -> package "noNamespace"
if (uri == null || uri.length() == 0)
return "noNamespace";
// apply draft JAXB rules
int len = uri.length();
int i = findSchemeColon(uri);
List result = null;
if (i == len-1)
{
// XMLBEANS-57: colon is at end so just use scheme as the package name
result = new ArrayList();
result.add(uri.substring(0, i));
}
else if (i >= 0 && uri.substring(0, i).equals("java"))
{
result = Arrays.asList(uri.substring(i + 1).split("\\."));
}
else {
result = new ArrayList();
outer: for (i = i + 1; i < len; )
{
while (uri.charAt(i) == '/')
if (++i >= len) break outer;
int start = i;
while (uri.charAt(i) != '/')
if (++i >= len) break;
int end = i;
result.add(uri.substring(start, end));
}
if (result.size() > 1)
result.set(result.size() - 1, processFilename((String)result.get(result.size() - 1)));
if (result.size() > 0)
{
List splitdns = splitDNS((String)result.get(0));
result.remove(0);
result.addAll(0, splitdns);
}
}
StringBuffer buf = new StringBuffer();
for (Iterator it = result.iterator(); it.hasNext(); )
{
String part = nonJavaKeyword(lowerCamelCase((String)it.next(), useJaxRpcRules, true));
if (part.length() > 0)
{
buf.append(part);
buf.append('.');
}
}
if (buf.length() == 0)
return "noNamespace";
if (useJaxRpcRules)
return buf.substring(0, buf.length() - 1).toLowerCase();
return buf.substring(0, buf.length() - 1); // chop off extra dot
}
public static void main(String[] args)
{
for (int i = 0; i < args.length; i++)
System.out.println(upperCaseUnderbar(args[i]));
}
/**
* Returns a upper-case-and-underbar string using the JAXB rules.
* Always starts with a capital letter that is a valid
* java identifier start. (If JAXB rules don't produce
* one, then "X_" is prepended.)
*/
public static String upperCaseUnderbar(String xml_name)
{
StringBuffer buf = new StringBuffer();
List words = splitWords(xml_name, false);
final int sz = words.size() - 1;
if (sz >= 0 && !Character.isJavaIdentifierStart(((String)words.get(0)).charAt(0)))
buf.append("X_");
for(int i = 0 ; i < sz ; i++)
{
buf.append((String)words.get(i));
buf.append(USCORE);
}
if (sz >= 0)
{
buf.append((String)words.get(sz));
}
//upcase entire buffer
final int len = buf.length();
for(int j = 0 ; j < len ; j++)
{
char c = buf.charAt(j);
buf.setCharAt(j, Character.toUpperCase(c));
}
return buf.toString();
}
/**
* Returns a camel-cased string using the JAXB rules.
* Always starts with a capital letter that is a valid
* java identifier start. (If JAXB rules don't produce
* one, then "X" is prepended.)
*/
public static String upperCamelCase(String xml_name)
{
return upperCamelCase(xml_name, false);
}
/**
* Returns a camel-cased string, but either JAXB or JAX-RPC rules
* are used
*/
public static String upperCamelCase(String xml_name, boolean useJaxRpcRules)
{
StringBuffer buf = new StringBuffer();
List words = splitWords(xml_name, useJaxRpcRules);
if (words.size() > 0)
{
if (!Character.isJavaIdentifierStart(((String)words.get(0)).charAt(0)))
buf.append("X");
Iterator itr = words.iterator();
while(itr.hasNext())
buf.append((String)itr.next());
}
return buf.toString();
}
/**
* Returns a camel-cased string using the JAXB rules,
* where the first component is lowercased. Note that
* if the first component is an acronym, the whole
* thigns gets lowercased.
* Always starts with a lowercase letter that is a valid
* java identifier start. (If JAXB rules don't produce
* one, then "x" is prepended.)
*/
public static String lowerCamelCase(String xml_name)
{
return lowerCamelCase(xml_name, false, true);
}
/**
* Returns a camel-cased string using the JAXB or JAX-RPC rules
*/
public static String lowerCamelCase(String xml_name, boolean useJaxRpcRules,
boolean fixGeneratedName)
{
StringBuffer buf = new StringBuffer();
List words = splitWords(xml_name, useJaxRpcRules);
if (words.size() > 0)
{
String first = ((String)words.get(0)).toLowerCase();
char f = first.charAt(0);
if (!Character.isJavaIdentifierStart(f) && fixGeneratedName)
buf.append("x");
buf.append(first);
Iterator itr = words.iterator();
itr.next(); // skip already-lowercased word
while(itr.hasNext())
buf.append((String)itr.next());
}
return buf.toString();
}
public static String upperCaseFirstLetter(String s)
{
if (s.length() == 0 || Character.isUpperCase(s.charAt(0)))
return s;
StringBuffer buf = new StringBuffer(s);
buf.setCharAt(0, Character.toUpperCase(buf.charAt(0)));
return buf.toString();
}
/**
split an xml name into words via JAXB approach, upcasing first
letter of each word as needed, if upcase is true
ncname is xml ncname (i.e. no colons).
*/
private static void addCapped(List list, String str)
{
if (str.length() > 0)
list.add(upperCaseFirstLetter(str));
}
public static List splitWords(String name, boolean useJaxRpcRules)
{
List list = new ArrayList();
int len = name.length();
int start = 0;
int prefix = START;
for (int i = 0; i < len; i++)
{
int current = getCharClass(name.charAt(i), useJaxRpcRules);
if (prefix != PUNCT && current == PUNCT)
{
addCapped(list, name.substring(start, i));
while ((current = getCharClass(name.charAt(i), useJaxRpcRules)) == PUNCT)
if (++i >= len) return list;
start = i;
}
else if ((prefix == DIGIT) != (current == DIGIT) ||
(prefix == LOWER && current != LOWER) ||
(isLetter(prefix) != isLetter(current)))
{
addCapped(list, name.substring(start, i));
start = i;
}
else if (prefix == UPPER && current == LOWER && i > start + 1)
{
addCapped(list, name.substring(start, i - 1));
start = i - 1;
}
prefix = current;
}
addCapped(list, name.substring(start));
return list;
}
//char classes
private final static int START = 0;
private final static int PUNCT = 1;
private final static int DIGIT = 2;
private final static int MARK = 3;
private final static int UPPER = 4;
private final static int LOWER= 5;
private final static int NOCASE= 6;
public static int getCharClass(char c, boolean useJaxRpcRules)
{
//ordering is important here.
if (isPunctuation(c, useJaxRpcRules))
return PUNCT;
else if (Character.isDigit(c))
return DIGIT;
else if (Character.isUpperCase(c))
return UPPER;
else if (Character.isLowerCase(c))
return LOWER;
else if (Character.isLetter(c))
return NOCASE;
else if (Character.isJavaIdentifierPart(c))
return MARK;
else
return PUNCT; // not covered by JAXB: treat it as punctuation
}
private static boolean isLetter(int state)
{
return (state==UPPER
|| state==LOWER
|| state==NOCASE);
}
public static boolean isPunctuation(char c, boolean useJaxRpcRules)
{
return (c == HYPHEN
|| c == PERIOD
|| c == COLON
|| c == DOT
|| (c == USCORE && !useJaxRpcRules)
|| c == TELEIA
|| c == AYAH
|| c == ELHIZB);
}
/**
* Intended to be applied to a lowercase-starting identifier that
* may collide with a Java keyword. If it does collide, this
* prepends the letter "x".
*/
public static String nonJavaKeyword(String word)
{
if (isJavaReservedWord(word))
return 'x' + word;
return word;
}
/**
* Intended to be applied to an uppercase-starting identifier that
* may collide with a java.lang.* classname. If it does collide, this
* prepends the letter "X".
*/
public static String nonJavaCommonClassName(String name)
{
if (isJavaCommonClassName(name))
return "X" + name;
return name;
}
private static boolean isJavaReservedWord(String word)
{
return isJavaReservedWord(word, true);
}
private static boolean isJavaReservedWord(String word, boolean ignore_case)
{
if (ignore_case)
word = word.toLowerCase();
return javaWords.contains(word);
}
public static boolean isJavaCommonClassName(String word)
{
return javaNames.contains(word);
}
}
| [
"[email protected]"
] | |
9753353b33b7072d132a9d2be7d6749c25a6ce96 | f9ce7716fbffe77a5e258a19e3f238e9f6132f73 | /src/main/java/com/github/muhdhariz/Excel.java | 8421fec334a4f30bf6fcc1686303226012e99f8c | [] | no_license | muhdhariz/256549-STIW3054-A191-A2 | ec3c15a09f994ed36deb17f91efca05192989bd7 | c921c3d1551f95b7cec0ca111a02dd8f64057b8b | refs/heads/master | 2020-08-30T14:00:46.296981 | 2019-11-09T15:39:46 | 2019-11-09T15:39:46 | 218,402,036 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,065 | java | package com.github.muhdhariz;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.io.IOException;
public class Excel {
private static XSSFWorkbook workbook = new XSSFWorkbook();
private static XSSFSheet sheet1 = workbook.createSheet("Sir Zamri Followers' Statistic");
private static CreateExcelTempFile createExcelTempFile = new CreateExcelTempFile();
public static void main(String[] args) throws IOException {
createExcelTempFile.main(args);
String FILE_NAME = CreateExcelTempFile.temp.toString();
Object[][] data1 = Output.Output;
int rowNum = 0;
System.out.println();
System.out.println("Creating " + CreateExcelTempFile.temp.getName() + " File");
System.out.println("Excel Filepath: " + CreateExcelTempFile.temp.getAbsolutePath());
CreateExcelSheet.sheet(sheet1, data1, rowNum);
new CreateExcel(FILE_NAME, workbook);
}
}
| [
"[email protected]"
] | |
0071e9ec244c1abd47d06768b2c3872efb2e7bfa | 7970f7017b1f006016a6d579292c48c6526bd1df | /ParkJPA/test/test/UserPaymentTest.java | 64cc209a92eb6f91bce80169cb4f084c3a24479e | [] | no_license | swthomas/Park | aee0678afdf40c4025ab02386f5057fc92dd7570 | 2b7748ff3b2f2f7da1f019442e958311dec58d55 | refs/heads/master | 2021-03-22T00:17:15.245840 | 2017-10-04T02:34:56 | 2017-10-04T02:34:56 | 87,951,899 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,032 | java | package test;
import static org.junit.Assert.assertEquals;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import entities.UserPayment;
public class UserPaymentTest {
private EntityManagerFactory emf = null;
private EntityManager em = null;
@Before
public void setUp() throws Exception {
emf = Persistence.createEntityManagerFactory("Parkr");
em = emf.createEntityManager();
}
@After
public void tearDown() throws Exception {
em.close();
emf.close();
}
// --------------------------------Test go Here--------------------------------//
@Test
public void test_userPayment_mapping() {
assertEquals("23.12",em.find(UserPayment.class, 1).getAmount().toString());
}
//----------------------------------------------------------------------------//
@Test
public void test_true_is_true() {
boolean pass = true;
assertEquals(pass, true);
}
}
| [
"[email protected]"
] | |
913b361d0a0bab9d1c27f12391cdc32d562999c7 | 65751cb8ad56706fc6ffa19ee42fe0830126bcb2 | /src/main/java/maskgen/MaskJoin.java | 8c1fad5e1f07ea8718d3311e6aff7caccf541daa | [] | no_license | usnistgov/WIPP-annotations2masks-plugin | 66801e506c0506ad16a1c87b12fadec0e497567a | dbf0a3509075f89b7b745a09bf873a323916b575 | refs/heads/master | 2022-12-27T15:49:32.067387 | 2020-06-10T18:58:45 | 2020-06-10T18:58:45 | 255,989,073 | 0 | 1 | null | 2020-10-13T21:13:23 | 2020-04-15T17:26:14 | Java | UTF-8 | Java | false | false | 19,455 | java | package maskgen;
import java.awt.Color;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import javax.imageio.ImageIO;
import ij.IJ;
import ij.ImagePlus;
import ij.io.FileSaver;
import ij.process.ByteProcessor;
import ij.process.ColorProcessor;
import ij.process.ImageProcessor;
import io.AnnotationLoader;
import loci.formats.FormatException;
import util.FileOper;
import util.MathOper;
/**
* This class is designed to accommodate the WIPP based annotations that are based on an overlay of model-based binary mask
* and the raw image in order to assess whether the model is correct
* Use in the concrete project
*
* @author pnb
*
*/
public class MaskJoin {
public boolean MaskBooleanJoin(String AnnotMaskFileFolder, String ModelMaskFileFolder, String outFileFolder ) throws IOException, FormatException{
// sanity check
if (AnnotMaskFileFolder == null || ModelMaskFileFolder == null || outFileFolder == null) {
System.err.println("Error: null AnnotMaskFileFolder, ModelMaskFileFolder or outFileFolder ");
return false;
}
/*Check directory if exist*/
File directory=new File(AnnotMaskFileFolder);
if(!directory.exists()){
System.out.println("Input annotation mask Directory does not exist: " + AnnotMaskFileFolder);
return false;
}
directory=new File(ModelMaskFileFolder);
if(!directory.exists()){
System.out.println("Input model mask Directory does not exist: " + ModelMaskFileFolder);
return false;
}
directory=new File(outFileFolder);
if(!directory.exists()){
System.out.println("output Directory does not exist: " + outFileFolder);
return false;
}
///////////////////////////////////////////////////////////
// getting JSON files to process
Collection<String> dirAnnotFiles = FileOper.readFileDirectory(AnnotMaskFileFolder);
if (dirAnnotFiles.isEmpty()){
System.err.println("dirAnnotFiles Directory is empty: " + dirAnnotFiles);
return false;
}
// select JSON files with the right suffix
String suffixTIFF = new String(".tif");
System.out.println("TEST: dirAnnotFiles= " + dirAnnotFiles);
Collection<String> dirSelectAnnotFiles = FileOper.selectFileType(dirAnnotFiles,suffixTIFF );
// sort stacks to process
Collection<String> sortedAnnotInFolder = FileOper.sort(dirSelectAnnotFiles,
FileOper.SORT_ASCENDING);
///////////////////////////////////////////////////////////////
// getting images to process
Collection<String> dirModelFiles = FileOper.readFileDirectory(ModelMaskFileFolder);
// select images with the right suffix
//String suffixTIFF = new String(".tif");
Collection<String> dirSelectModelFiles = FileOper.selectFileType(dirModelFiles,suffixTIFF );
if (dirSelectModelFiles.isEmpty()){
System.err.println("dirSelectModelFiles Directory is empty: " + dirSelectModelFiles);
return false;
}
// sort stacks to process
Collection<String> sortedModelsInFolder = FileOper.sort(dirSelectModelFiles,
FileOper.SORT_ASCENDING);
//////////////////////////////////////////////////////
AnnotationLoader annotClass = new AnnotationLoader();
String annotFileName = new String();
String modelFileName = new String();
String outFileName = new String(outFileFolder);
if(!outFileFolder.endsWith(File.separator)) {
outFileName += File.separator;
}
// store metadata about the execution
//ArrayList<String> strSaveMapping = new ArrayList<String>();
boolean foundMatch = false;
for (Iterator<String> k = sortedAnnotInFolder.iterator(); k.hasNext();) {
annotFileName = k.next(); // looks like: mask_Sample__3_28_.ome.tif or Sample__13_39_.ome.tif
String nameAnnot = (new File(annotFileName)).getName();
// TODO check what to remove, this case is mask_ and .ome.tif (mask_Sample__3_28_.ome.tif)
// this is for the case: mask_Sample__3_28_.ome.tif
//nameAnnot = nameAnnot.substring(5, nameAnnot.length()-8);
// this is for the case Sample__13_39_.ome.tif
nameAnnot = nameAnnot.substring(0, nameAnnot.length()-8);
// find matching rawFileName
foundMatch = false;
for(Iterator<String> r = sortedModelsInFolder.iterator(); !foundMatch && r.hasNext(); ){
modelFileName = r.next(); // looks like: Sample__3_28__bySize_t68_s198.ome.tif or Sample_(1,19)_bySize_t68_s198.tif
String nameTIFF = (new File(modelFileName)).getName();
if(nameTIFF.contains("(") || nameTIFF.contains(")") || nameTIFF.contains(",") ){
//nameTIFF = nameTIFF.replaceAll("\\([^()]*\\)", "_");
nameTIFF = nameTIFF.replaceAll("\\(", "_");
nameTIFF = nameTIFF.replaceAll("\\)", "_");
nameTIFF = nameTIFF.replaceAll(",", "_");
nameTIFF = nameTIFF.substring(0, nameTIFF.length()-20); // TODO check what to remove Sample__3_28__bySize_t68_s198.tif
System.out.println("modified nameTIFF = " + nameTIFF);
}else{
nameTIFF = nameTIFF.substring(0, nameTIFF.length()-24); // TODO check what to remove Sample__3_28__bySize_t68_s198.ome.tif
}
if(nameAnnot.equalsIgnoreCase(nameTIFF)){
foundMatch = true;
}
}
if(!foundMatch){
System.err.println("ERROR: could not find a matching annotated TIFF image to the model TIFF image");
continue;
}
System.out.println("INFO: matching pair: annotated image = " + annotFileName + " model binary image = " + modelFileName);
//ArrayList<Annotation> annotations = annotClass.readJSONfromWIPP(JSONfileName);
//AnnotationLoader.printArrayListAnnot(annotations);
//MaskFromAnnotations myClass = new MaskFromAnnotations();
// construct the output file name
//String name = new String(nameAnnot);//(new File(JSONfileName)).getName();
//name = name.substring(0, name.length()-5) + ".tif";
ImagePlus annotImage = IJ.openImage(annotFileName);
//ImageProcessor ipAnnot = annotImage.getProcessor();
ImagePlus modelImage = IJ.openImage(modelFileName);
//ImageProcessor ipModel = modelImage.getProcessor();
ImagePlus res = AnnotModelJoin(annotImage, modelImage);
FileSaver fs = new FileSaver(res);
String OutputName = new String(outFileName + nameAnnot + ".tif" );
fs.saveAsTiff(OutputName);
}
return true;
}
/**
* This method takes two grayscale masks and merges the non-zero labels in the two images
*
* @param annotImage - mask 1
* @param modelImage - mask 2
* @return ImagePlus of the merged mask
*/
public ImagePlus AnnotModelJoin(ImagePlus annotImage, ImagePlus modelImage){
ImageProcessor ipAnnot = annotImage.getProcessor();
ImageProcessor ipModel = modelImage.getProcessor();
int width = ipAnnot.getWidth();
int height = ipAnnot.getHeight();
int nbElements = width*height;
byte[] pix = new byte[nbElements];
for(int k = 0; k < nbElements; k++) {
if(ipAnnot.get(k) != 0 && ipModel.get(k) != 0){
pix[k] = (byte)ipAnnot.get(k);
}else{
pix[k] = 0;
}
}
ImageProcessor ip = new ByteProcessor(width, height, pix);
ImagePlus result = new ImagePlus("AnnotModelJoin", ip);
return result;
}
/**
* This method is used for merging two sets of binary masks
*
* @param Mask1FileFolder
* @param Mask2FileFolder
* @param outFileFolder
* @return
* @throws IOException
* @throws FormatException
*/
public boolean BinaryMaskBooleanJoinBatch(String Mask1FileFolder, String Mask2FileFolder, String outFileFolder ) throws IOException, FormatException{
// sanity check
if (Mask1FileFolder == null || Mask2FileFolder == null || outFileFolder == null) {
System.err.println("Error: null Mask1FileFolder, Mask2FileFolder or outFileFolder ");
return false;
}
/*Check directory if exist*/
File directory=new File(Mask1FileFolder);
if(!directory.exists()){
System.out.println("Input mask1 Directory does not exist: " + Mask1FileFolder);
return false;
}
directory=new File(Mask2FileFolder);
if(!directory.exists()){
System.out.println("Input mask2 Directory does not exist: " + Mask2FileFolder);
return false;
}
directory=new File(outFileFolder);
if(!directory.exists()){
System.out.println("output Directory does not exist: " + outFileFolder);
return false;
}
///////////////////////////////////////////////////////////
// getting mask files to process
Collection<String> dirMask1Files = FileOper.readFileDirectory(Mask1FileFolder);
if (dirMask1Files.isEmpty()){
System.err.println("dirMask1Files Directory is empty: " + dirMask1Files);
return false;
}
// select image files with the right suffix
String suffixTIFF = new String(".tif");
System.out.println("TEST: dirMask1Files= " + dirMask1Files);
Collection<String> dirSelectMask1Files = FileOper.selectFileType(dirMask1Files,suffixTIFF );
// sort stacks to process
Collection<String> sortedMask1InFolder = FileOper.sort(dirSelectMask1Files,
FileOper.SORT_ASCENDING);
///////////////////////////////////////////////////////////////
// getting images to process
Collection<String> dirMask2Files = FileOper.readFileDirectory(Mask2FileFolder);
// select images with the right suffix
//String suffixTIFF = new String(".tif");
Collection<String> dirSelectMask2Files = FileOper.selectFileType(dirMask2Files,suffixTIFF );
if (dirSelectMask2Files.isEmpty()){
System.err.println("dirSelectMask2Files Directory is empty: " + dirSelectMask2Files);
return false;
}
// sort stacks to process
Collection<String> sortedMask2InFolder = FileOper.sort(dirSelectMask2Files,
FileOper.SORT_ASCENDING);
//////////////////////////////////////////////////////
String mask1FileName = new String();
String mask2FileName = new String();
boolean foundMatch = false;
for (Iterator<String> k = sortedMask2InFolder.iterator(); k.hasNext();) {
mask2FileName = k.next(); // looks like: binary_mask_Sample__3_33_.tif
String nameMask2 = (new File(mask2FileName)).getName();
nameMask2 = nameMask2.substring(0, nameMask2.length()-4);
// find matching rawFileName
foundMatch = false;
for(Iterator<String> r = sortedMask1InFolder.iterator(); !foundMatch && r.hasNext(); ){
mask1FileName = r.next(); // looks like: Sample__3_28__bySize_t68_s198.ome.tif or Sample_(1,19)_bySize_t68_s198.tif
String nameMask1 = (new File(mask1FileName)).getName();
nameMask1 = nameMask1.substring(0, nameMask1.length()-4);
if(nameMask2.equalsIgnoreCase(nameMask1)){
foundMatch = true;
}
}
if(!foundMatch){
System.err.println("ERROR: could not find a matching mask1 image to the mask 2 image");
continue;
}
System.out.println("INFO: matching pair: matching mask1 image = " + mask1FileName + " , mask 2 image = " + mask2FileName);
String outFileName = new String(outFileFolder);
if(!outFileFolder.endsWith(File.separator)) {
outFileName += File.separator;
}
String OutputName = new String(outFileName + nameMask2 + ".tif" );
BinaryMaskBooleanJoin(mask1FileName, mask2FileName, OutputName);
}
return true;
}
/**
* This method is for joining two binary masks using MathOper boolean OR operation
*
* @param mask1_filename
* @param mask2_filename
* @param out_filename
*/
public void BinaryMaskBooleanJoin(String mask1_filename, String mask2_filename, String out_filename ){
ImagePlus mask1 = IJ.openImage(mask1_filename);
ImagePlus mask2 = IJ.openImage(mask2_filename);
ImagePlus res = MathOper.booleanOR(mask1, mask2);
FileSaver fs = new FileSaver(res);
//String OutputName = new String(outFileName + nameAnnot + ".tif" );
fs.saveAsPng(out_filename);
}
/**
* This method is for processing two color masks using ColorMaskJoin method
*
* @param mask1_filename
* @param mask2_filename
* @param out_filename
*/
public void ColorMaskJoinBatch(String mask1_filename, String mask2_filename, String out_filename ){
ImagePlus mask1 = IJ.openImage(mask1_filename);
ImagePlus mask2 = IJ.openImage(mask2_filename);
ImagePlus res = ColorMaskJoin(mask1, mask2);
FileSaver fs = new FileSaver(res);
//String OutputName = new String(outFileName + nameAnnot + ".tif" );
fs.saveAsPng(out_filename);
}
/**
* This method takes two color masks and merges the non-grayscale labels in the two images
*
* @param modelImage - mask 1
* @param annotImage - mask 2
* @return ImagePlus of the merged mask
*/
public ImagePlus ColorMaskJoin( ImagePlus mask1, ImagePlus mask2){
// sanity check
if(mask1 == null || mask2 == null){
System.err.println("ERROR: input images are null");
return null;
}
ImageProcessor ipModel = mask1.getProcessor();
ImageProcessor ipAnnot = mask2.getProcessor();
ColorProcessor colorIpAnnot = (ColorProcessor) ipAnnot.convertToRGB();
ColorProcessor colorIpModel = (ColorProcessor) ipModel.convertToRGB();
if(colorIpAnnot.getWidth() != colorIpModel.getWidth() || colorIpAnnot.getHeight() != colorIpModel.getHeight()){
System.err.println("ERROR: dimensions of the two images do not match");
return null;
}
// red --> IRON_OXIDE
Color iron_oxideColor = new Color(255, 0, 0);
// green --> AUGITE
Color augiteColor = new Color(0, 255, 0);
// white --> IRON_OXIDE
Color iron_oxideColorNew = new Color(255, 255, 200);
// purple --> AUGITE
Color augiteColorNew = new Color(255, 200, 255);
// dark green manually assigned to fix Steve's annotation = 34, 177, 76 since red was used in the same image for cracks and iron oxide
// must be replaced by white --> IRON_OXIDE
Color iron_oxideColor_bad = new Color(34,177,76);
for (int x = 0; x < colorIpAnnot.getWidth(); x++) {
for (int y = 0; y < colorIpAnnot.getHeight(); y++) {
Color pixelColor = colorIpAnnot.getColor(x, y);
if(pixelColor.getRed() == pixelColor.getGreen() && pixelColor.getGreen() == pixelColor.getBlue()){
// skip
}else{
// overwrite the pixel
//Color mask1_Color = colorIpAnnot.getColor(x, y);
/* if(pixelColor.getRed() == iron_oxideColor.getRed() && pixelColor.getGreen() == iron_oxideColor.getGreen() && pixelColor.getBlue() == iron_oxideColor.getBlue()){
// overwrite the pixel with the new color to avoid already assigned color to other classes
colorIpModel.setColor(iron_oxideColorNew);
colorIpModel.drawPixel(x,y);
}else{
if(pixelColor.getRed() == augiteColor.getRed() && pixelColor.getGreen() == augiteColor.getGreen() && pixelColor.getBlue() == augiteColor.getBlue()){
// overwrite the pixel with the new color to avoid already assigned color to other classes
colorIpModel.setColor(augiteColorNew);
colorIpModel.drawPixel(x,y);
}else{
colorIpModel.setColor(pixelColor);
colorIpModel.drawPixel(x,y);
}
}*/
if(pixelColor.getRed() == iron_oxideColor_bad.getRed() && pixelColor.getGreen() == iron_oxideColor_bad.getGreen() && pixelColor.getBlue() == iron_oxideColor_bad.getBlue()){
// overwrite the pixel with the new color to avoid already assigned color to other classes
colorIpModel.setColor(iron_oxideColorNew);
colorIpModel.drawPixel(x,y);
}
}
}
}
return mask1;
}
/**
* @param args
* @throws FormatException
* @throws IOException
*/
public static void main(String[] args) throws IOException, FormatException {
/* String AnnotMaskFileFolder = new String("C:\\PeterB\\Projects\\TestData\\concrete_SteveFeldman\\TrainingImageMasks\\AnnotationWIPP2018-10-28\\annotMask\\");
String ModelMaskFileFolder = new String("C:\\PeterB\\Projects\\TestData\\concrete_SteveFeldman\\TrainingImageMasks\\AnnotationWIPP2018-10-28\\darkThreshVolcanics\\");
String outFileFolder = new String("C:\\PeterB\\Projects\\TestData\\concrete_SteveFeldman\\TrainingImageMasks\\AnnotationWIPP2018-10-28\\output\\");
MaskJoin myClass = new MaskJoin();
myClass.MaskBooleanJoin(AnnotMaskFileFolder, ModelMaskFileFolder, outFileFolder);
*/
MaskJoin myClass = new MaskJoin();
// merge 4, 23
//String mask1_filename = new String("C:\\PeterB\\Projects\\TestData\\concrete_SteveFeldman\\AssistCreationAnnotations\\April2019\\annotatedFOV\\Sample__4_23_First_NEW.png");
//String mask2_filename = new String("C:\\PeterB\\Projects\\TestData\\concrete_SteveFeldman\\AssistCreationAnnotations\\April2019\\annotatedFOV\\Sample__4_23_Fe-oxide_Augite.png");
// merge 4, 31
/* String mask1_filename = new String("C:\\PeterB\\Projects\\TestData\\concrete_SteveFeldman\\AssistCreationAnnotations\\April2019\\annotatedFOV\\Sample__4_31_Fe-oxide_Augite_Volcanic_NEW.png");
String mask2_filename = new String("C:\\PeterB\\Projects\\TestData\\concrete_SteveFeldman\\AssistCreationAnnotations\\April2019\\annotatedFOV\\Sample__4_31_Fe-oxide_Augite_Volcanic.png");
String out_filename = new String("C:\\PeterB\\Projects\\TestData\\concrete_SteveFeldman\\AssistCreationAnnotations\\April2019\\grayMasks\\Sample_4_31.png");
*/
/* // fix bad labels for fe_oxide in Steve's annotations
// Sample__4_33_, Sample__4_34_, Sample__4_36_
String mask1_filename = new String("C:\\PeterB\\Projects\\TestData\\concrete_SteveFeldman\\AssistCreationAnnotations\\April2019\\annotatedFOV\\Sample__4_33_.png");
String mask2_filename = new String("C:\\PeterB\\Projects\\TestData\\concrete_SteveFeldman\\AssistCreationAnnotations\\April2019\\annotatedFOV\\Sample__4_33_.png");
String out_filename = new String("C:\\PeterB\\Projects\\TestData\\concrete_SteveFeldman\\AssistCreationAnnotations\\April2019\\annotatedFOV\\fix_Sample__4_33_.png");
myClass.ColorMaskJoinBatch( mask1_filename, mask2_filename, out_filename );
*/
// this is step 3: to generate masks for the class aggregate = quartzite + feldspar + augite + iron oxide
/* String mask1_folder = new String("C:\\PeterB\\Projects\\TestData\\concrete_SteveFeldman\\AssistCreationAnnotations\\April2019\\binaryReferenceQuartzite");
String mask2_folder = new String("C:\\PeterB\\Projects\\TestData\\concrete_SteveFeldman\\AssistCreationAnnotations\\April2019\\binaryReferenceFeldspar");
String out_folder = new String("C:\\PeterB\\Projects\\TestData\\concrete_SteveFeldman\\AssistCreationAnnotations\\April2019\\tempOut");*/
/* String mask1_folder = new String("C:\\PeterB\\Projects\\TestData\\concrete_SteveFeldman\\AssistCreationAnnotations\\April2019\\binaryReferenceAugite");
String mask2_folder = new String("C:\\PeterB\\Projects\\TestData\\concrete_SteveFeldman\\AssistCreationAnnotations\\April2019\\binaryReferenceIron_oxide");
String out_folder = new String("C:\\PeterB\\Projects\\TestData\\concrete_SteveFeldman\\AssistCreationAnnotations\\April2019\\tempOut2");*/
String mask1_folder = new String("C:\\PeterB\\Projects\\TestData\\concrete_SteveFeldman\\AssistCreationAnnotations\\April2019\\tempOut");
String mask2_folder = new String("C:\\PeterB\\Projects\\TestData\\concrete_SteveFeldman\\AssistCreationAnnotations\\April2019\\tempOut2");
String out_folder = new String("C:\\PeterB\\Projects\\TestData\\concrete_SteveFeldman\\AssistCreationAnnotations\\April2019\\binaryReferenceAggregate");
myClass.BinaryMaskBooleanJoinBatch(mask1_folder, mask2_folder, out_folder );
System.out.println("DONE");
}
}
| [
"[email protected]"
] | |
03a267dc3c03889f5ffbf4cc788ab513a3ecb576 | 968ed3a0ab8ed74fe7721da49cb7a55ccc72fa2d | /app/src/main/java/fragment/PaiHangFragment.java | 5e1ae3ba32709d9335087835e804164353188ad6 | [] | no_license | MrLiusGitHub/EasyCar | cd0eb68750b2e442924145cb39cfb3337ad26326 | 98634a471cd80a06a5d5d7c54aa1f9279cacc0e4 | refs/heads/master | 2021-01-20T19:39:18.827158 | 2016-06-16T06:45:38 | 2016-06-16T06:45:38 | 61,268,871 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,690 | java | package fragment;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import com.example.ldc.easycar.R;
import com.google.gson.Gson;
import com.squareup.okhttp.Callback;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.Response;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import adapter.PaiHangAdapter;
import bean.PaiHangBean;
import in.srain.cube.views.ptr.PtrClassicFrameLayout;
import in.srain.cube.views.ptr.PtrDefaultHandler;
import in.srain.cube.views.ptr.PtrFrameLayout;
import utils.OKHttpUtils;
/**
* Created by ldc on 2016/6/8.
*/
public class PaiHangFragment extends BaseFragment{
private String start_url="http://api.ycapp.yiche.com/indexdata/GetSerialSaleDataList/?cityid=0&carlevel=";
private String end_url="&month=2016-04-01&page=1&length=20";
private List<PaiHangBean.DataCount.ListDataBean> mData=new ArrayList<>();
private RecyclerView recyclerView;
private PaiHangAdapter adapter;
private Handler hander=new Handler();
private PtrClassicFrameLayout ptr;
private String url;
public static PaiHangFragment newInstance(int type) {
Bundle args = new Bundle();
args.putInt("type",type);
PaiHangFragment fragment = new PaiHangFragment();
fragment.setArguments(args);
return fragment;
}
/**
* 网络请求获得数据源,并把数据赋给fragment中的relativelayout
*/
@Override
protected void initData() {
int type=getArguments().getInt("type");
url = start_url.concat(type+"").concat(end_url);
OKHttpUtils.buildGetAsync(getActivity(), url, "paihang", new Callback() {
@Override
public void onFailure(Request request, IOException e) {
}
@Override
public void onResponse(Response response) throws IOException {
String json=response.body().string();
final PaiHangBean paiHangBean=new Gson().fromJson(json, PaiHangBean.class);
hander.post(new Runnable() {
@Override
public void run() {
mData=paiHangBean.data.list;
adapter.notifyDataSetChanged();
}
});
}
});
}
/**
* 初始化布局
* @param view
*/
@Override
protected void initView(View view) {
recyclerView = (RecyclerView) view.findViewById(R.id.recylerView_base);
ptr = (PtrClassicFrameLayout) view.findViewById(R.id.ptr_base);
ptr.post(new Runnable() {
@Override
public void run() {
ptr.autoRefresh();
}
});
ptr.setPtrHandler(new PtrDefaultHandler() {
@Override
public void onRefreshBegin(PtrFrameLayout frame) {
long start =System.currentTimeMillis();
getData(url);
long end =System.currentTimeMillis();
if (end -start <1500){
hander.postDelayed(new Runnable() {
@Override
public void run() {
ptr.refreshComplete();
}
},1500-end+start);
}else{
hander.post(new Runnable() {
@Override
public void run() {
ptr.refreshComplete();
}
});
}
}
});
adapter = new PaiHangAdapter(getActivity(),mData);
recyclerView.setAdapter(adapter);
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
}
private void getData(String url) {
OKHttpUtils.buildGetAsync(getActivity(), url, "tupian", new Callback() {
@Override
public void onFailure(Request request, IOException e) {
}
@Override
public void onResponse(Response response) throws IOException {
String json = response.body().string();
final PaiHangBean paiHangBean=new Gson().fromJson(json, PaiHangBean.class);
hander.post(new Runnable() {
@Override
public void run() {
mData.addAll(0,paiHangBean.data.list);
adapter.setData(mData);
}
});
}
});
}
}
| [
"[email protected]"
] | |
7aa6c29edd68635ebf3b94d81a2f5a4ca9ea3b19 | fa34a5244c230506295374884244f1434eb882cc | /SequenceFront/src/sequencefront/Main.java | abd2ba284f15f3951a6bfac77ad754d30650edb6 | [] | no_license | recap/datafluo | da4890b0713c0cc75212706cf988a27ff568a6bf | da4ee8b08cb7292a091345dbf6a802363323c15e | refs/heads/master | 2021-01-09T20:57:30.536346 | 2016-06-15T14:21:29 | 2016-06-15T14:21:29 | 61,210,976 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 487 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package sequencefront;
import java.io.IOException;
import javax.jms.JMSException;
/**
*
* @author reggie
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws JMSException, IOException {
// TODO code application logic here
Logger l = new Logger();
Starter s = new Starter();
}
}
| [
"[email protected]"
] | |
60be77eb33d2760ce3a105d04ec96d02c3a6237f | aa13a8f95db5c5c19095976801ad50d351702638 | /app/src/main/java/mor/com/scanqrcode/Main3Activity.java | f4a33839342840f314ac64d8ab3d719607b6625a | [] | no_license | DioserG/ScanQRCode | c28cf666075b1d003bf0df00a79699a8ff3e2f00 | bfa008a08e21f5784ca94da599a16f44d3e649c3 | refs/heads/master | 2022-12-23T20:43:04.137646 | 2020-09-17T14:25:41 | 2020-09-17T14:25:41 | 273,287,472 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,024 | java | package mor.com.scanqrcode;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ListView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import org.json.JSONArray;
import org.json.JSONObject;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Main3Activity extends AppCompatActivity {
private ListView listView;
private List<Map<String,Object>> lista;
private listaMovimento adapter;
private String[] de = {"usuario", "coletor", "peso", "data_hora"};
private int[] para = {R.id.txUsuario, R.id.txColetor, R.id.txPeso, R.id.txData_Hora};
String urlWebServicesLocal = " http://192.168.2.42:80/sucata/validaLogin.php";
String urlWebServicesDesenvolvimento = "http://10.10.100.24:80/sucata/lista_coletor.php";
String urlWebServicesHomologacao = "http://192.168.1.23:80/sucata_chamados/validaLogin.php";
String urlWebServicesProducao = "http://192.168.1.23:80/sucata/validaLogin.php";
StringRequest stringRequest; //validação login
RequestQueue requestQueue; //validação login
Button btnBuscaTotal,btnBuscaDia;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main3);
requestQueue = Volley.newRequestQueue(this); // necessário para buscar dados do banco
btnBuscaTotal = (Button) findViewById(R.id.btnBuscaTotal);
btnBuscaTotal.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View view)
{
// Toast.makeText(getApplicationContext(),"Validando seus dados ...espere",Toast.LENGTH_LONG).show();
exibeMovimentoColetaTotal();
}
});
btnBuscaDia = (Button) findViewById(R.id.btnBuscaDia);
btnBuscaDia.setOnClickListener(new View.OnClickListener()//validações ao clicar no botão LOGAR
{
@Override
public void onClick(View view)
{
// Toast.makeText(getApplicationContext(),"Validando seus dados ...espere",Toast.LENGTH_LONG).show();
exibeMovimentoColetaDia();
}
});
}
public void exibeMovimentoColetaTotal()
{
listView = findViewById(R.id.listView_coletar);
lista = new ArrayList<>();
final String controle1 = "1";
stringRequest = new StringRequest(Request.Method.POST, urlWebServicesDesenvolvimento, new Response.Listener<String>()
{
@Override
public void onResponse(String response)
{
//Log.v("LogLogin", response);
try {
JSONObject object = new JSONObject(response);
JSONArray Jarray = object.getJSONArray("response");
String usuario = "", coletor = "", peso = "", data_hora = "";
for (int i = 0; i < Jarray.length(); i++)
{
Map<String,Object> items = new HashMap<>();
JSONObject Jasonobject = Jarray.getJSONObject(i);
usuario = Jasonobject.getString("usuario");
coletor = Jasonobject.getString("produto");
peso = Jasonobject.getString("peso");
data_hora = Jasonobject.getString("data_hora");
//Toast.makeText(getApplicationContext(), usuario, Toast.LENGTH_LONG).show();
items.put("usuario", " Usuário: " + usuario);
items.put("coletor", " Coletor: " + coletor);
items.put("peso", " Peso Bruto: " + peso);
items.put("data_hora", " Data/Hora: " + data_hora);
lista.add(items);
}
adapter = new listaMovimento( getApplication(), lista, R.layout.lista_movimento_coletor, de, para);
listView.setAdapter(adapter);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
Map<String,Object> item = lista.get(i);
String posicao = (String.valueOf(l+1));
}
});;
}
catch (Exception e)
{
Log.v("LogLogin", e.getMessage());
}
}
}, new Response.ErrorListener()
{
@Override
public void onErrorResponse(VolleyError error)
{
Log.e("LogLogin", error.getMessage());
}
})
{
@Override
protected Map<String, String> getParams()
{
Map<String, String> params = new HashMap<>();
params.put("controle1", controle1);
return params;
}
};
requestQueue.add(stringRequest);
}
private void alert (String s)
{
Toast.makeText(this,s,Toast.LENGTH_SHORT).show();
}
public void exibeMovimentoColetaDia()
{
listView = findViewById(R.id.listView_coletar);
lista = new ArrayList<>();
final String controle2 = "2";
stringRequest = new StringRequest(Request.Method.POST, urlWebServicesDesenvolvimento, new Response.Listener<String>()
{
@Override
public void onResponse(String responseDia)
{
Log.v("LogLogin2", responseDia);
//Toast.makeText(getApplicationContext(), responseDia, Toast.LENGTH_LONG).show();
try {
JSONObject object = new JSONObject(responseDia);
JSONArray Jarray = object.getJSONArray("responseDia");
String usuario = "", coletor = "", peso = "", data_hora = "";
for (int i = 0; i < Jarray.length(); i++)
{
Map<String,Object> items = new HashMap<>();
JSONObject Jasonobject = Jarray.getJSONObject(i);
usuario = Jasonobject.getString("usuario");
coletor = Jasonobject.getString("produto");
peso = Jasonobject.getString("peso");
data_hora = Jasonobject.getString("data_hora");
//Toast.makeText(getApplicationContext(), usuario, Toast.LENGTH_LONG).show();
items.put("usuario", " Usuário: " + usuario + " ");
items.put("coletor", " Coletor: " + coletor + " ");
items.put("peso", " Peso Bruto: " + peso + " ");
items.put("data_hora", " Data/Hora: " + data_hora + " ");
lista.add(items);
}
adapter = new listaMovimento( getApplication(), lista, R.layout.lista_movimento_coletor, de, para);
listView.setAdapter(adapter);
}
catch (Exception e)
{
Log.v("LogLogin", e.getMessage());
}
}
}, new Response.ErrorListener()
{
@Override
public void onErrorResponse(VolleyError error)
{
Log.e("LogLogin", error.getMessage());
}
})
{
@Override // envia valor para .php por POST
protected Map<String, String> getParams()
{
Map<String, String> params = new HashMap<>();
params.put("controle2", controle2);
return params;
}
};
requestQueue.add(stringRequest);
}
private void alertDia (String s)
{
Toast.makeText(this,s,Toast.LENGTH_SHORT).show();
}
}
| [
"[email protected]"
] | |
16a61142b84794f6b04591590023f5b7aaf1bb4e | cbb6b30c5088e073d0dd134a20e77cdda9b045cd | /Sistema-de-Igrejas-master/src/main/java/com/br/mvsistemas/erp/model/ControleAcesso.java | cb8ed18208cb086d31c66562ba94456dd4553d9e | [] | no_license | lulukamagaiver/Sistema-de-Igrejas | d3cad6c285c77a2cad602dd8e9f752c0ceb25b48 | 9f83b26c74d43b8e693e53d0d881edd6fde91a79 | refs/heads/master | 2022-10-20T01:21:39.084667 | 2022-09-28T16:33:46 | 2022-09-28T16:33:46 | 45,357,514 | 0 | 0 | null | 2022-09-28T16:33:47 | 2015-11-01T21:06:40 | Java | UTF-8 | Java | false | false | 2,286 | java | package com.br.mvsistemas.erp.model;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.hibernate.annotations.ForeignKey;
@SuppressWarnings("deprecation")
@Entity
public class ControleAcesso implements Serializable{
/**
*
*/
private static final long serialVersionUID = -9219801049250154110L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@ManyToOne(cascade=CascadeType.ALL)
@JoinColumn(name="id_admUsuario") @ForeignKey(name="FK_USUARIO_CONTROLE_ACESSO")
private AdmUsuario usuario;
@Temporal(TemporalType.DATE)
private Date dataLogin;
/**
* @return the id
*/
public Long getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Long id) {
this.id = id;
}
/**
* @return the usuario
*/
public AdmUsuario getUsuario() {
return usuario;
}
/**
* @param usuario the usuario to set
*/
public void setUsuario(AdmUsuario usuario) {
this.usuario = usuario;
}
/**
* @return the dataLogin
*/
public Date getDataLogin() {
return dataLogin;
}
/**
* @param dataLogin the dataLogin to set
*/
public void setDataLogin(Date dataLogin) {
this.dataLogin = dataLogin;
}
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
}
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ControleAcesso other = (ControleAcesso) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
}
| [
"[email protected]"
] | |
4988027223afbcfaf5271f89ea19c6b6206638ed | e20d9f64a664a0b2215af9f511c8cfbae81bb671 | /src/com/biz/controllr/ScoreExec_05.java | 1ac13c79cfaf220fbe4b54272d957a16da81f114 | [] | no_license | cally91/Collections_02 | 144fd978e6bb4b80bc56f8f3864fe8be139456ee | 6d36be6b04f6b667a5e84ebcc2c0da61533686f2 | refs/heads/master | 2020-06-02T21:08:15.902113 | 2019-06-11T07:39:53 | 2019-06-11T07:39:53 | 191,310,436 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,126 | java | package com.biz.controllr;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import com.biz.model.ScoreVO;
public class ScoreExec_05 {
public static void main(String[] args) {
// 일단 비어 있는 (리스트가 없는 )자료구조 (data structuere) 를 생성
// 필요에 따라 내용 (리스트)를 추가해서 사용할 수있는
// 자바의 독득한 기능
// 자바 1.8이상에서만 정상 작동된다,
// List scList = new ArrayList();
// 호환성을 위햇 사용하는 표준문법
// 1.<ScoreVO(성격표)를 담을 비어있는 List를 생성
List<ScoreVO> scList = new ArrayList<ScoreVO>();
Random rnd = new Random();
ScoreVO sVO = new ScoreVO();
sVO.setNumder("1");
sVO.setName("홍길동");
sVO.setKor(rnd.nextInt(50) + 51);
sVO.setEng(rnd.nextInt(50) + 51);
sVO.setMath(rnd.nextInt(50) + 51);
scList.add(sVO);
sVO=new ScoreVO();
sVO.setNumder("2");
sVO.setName("성춘향");
sVO.setKor(rnd.nextInt(50) + 51);
sVO.setEng(rnd.nextInt(50) + 51);
sVO.setMath(rnd.nextInt(50) + 51);
scList.add(sVO);
}
}
| [
"[email protected]"
] | |
74a65816cdc9328a88972c17d7185fb8814d17c4 | 9168a0404fd1198c9be7ed279d2e1bd96b9b7650 | /app/src/main/java/com/titans/grouptravelplanner/SimpleItem.java | d0bebf67e45a066e3ad50aee1e2014cd81743fe8 | [] | no_license | ShridharGoel/GroupTravelPlanner | 9d358249eead1043d6a18ec2739fa741758e651c | b8e076621e070959b0cbc3df422beda37ba31fbf | refs/heads/master | 2023-01-08T18:22:09.142856 | 2020-11-14T07:58:17 | 2020-11-14T07:58:17 | 310,618,334 | 0 | 1 | null | 2020-11-14T07:58:18 | 2020-11-06T14:24:53 | Java | UTF-8 | Java | false | false | 2,176 | java | package com.titans.grouptravelplanner;
import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
public class SimpleItem extends DrawerItem<SimpleItem.ViewHolder> {
private int selectedItemIconTint;
private int selectedItemTextTint;
private int normalItemIconTint;
private int normalItemTextTint;
private Drawable icon;
private String title;
public SimpleItem(Drawable icon, String title) {
this.icon = icon;
this.title = title;
}
@Override
public ViewHolder createViewHolder(ViewGroup parent) {
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
View v = inflater.inflate(R.layout.item_option, parent, false);
return new ViewHolder(v);
}
@Override
public void bindViewHolder(ViewHolder holder) {
holder.title.setText(title);
holder.icon.setImageDrawable(icon);
holder.title.setTextColor(isChecked ? selectedItemTextTint : normalItemTextTint);
holder.icon.setColorFilter(isChecked ? selectedItemIconTint : normalItemIconTint);
}
public SimpleItem withSelectedIconTint(int selectedItemIconTint) {
this.selectedItemIconTint = selectedItemIconTint;
return this;
}
public SimpleItem withSelectedTextTint(int selectedItemTextTint) {
this.selectedItemTextTint = selectedItemTextTint;
return this;
}
public SimpleItem withIconTint(int normalItemIconTint) {
this.normalItemIconTint = normalItemIconTint;
return this;
}
public SimpleItem withTextTint(int normalItemTextTint) {
this.normalItemTextTint = normalItemTextTint;
return this;
}
static class ViewHolder extends DrawerAdapter.ViewHolder {
private ImageView icon;
private TextView title;
public ViewHolder(View itemView) {
super(itemView);
icon = (ImageView) itemView.findViewById(R.id.icon);
title = (TextView) itemView.findViewById(R.id.title);
}
}
} | [
"[email protected]"
] | |
749c6614cdd0e6d3fbed1ce5fe7670e3dfe42e95 | ebafc37c8fbc67c1e3a51556ad29ef29968b9570 | /Homework5Main.java | d4e122e53f6894f41e44eb8d32804cbbd41ca1f5 | [] | no_license | cwright1162/SlidingTilePuzzleSolver | 0e4193ac855658d41462f30e0c505e14fe66f2cf | 0a95ec59f6afa25707409a3530dfbd48d3e72c3d | refs/heads/main | 2023-01-08T11:10:11.351695 | 2020-11-10T23:52:13 | 2020-11-10T23:52:13 | 311,813,027 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 889 | java | package v2;
import java.util.ArrayList;
import csis4463.*;
/**
* See comments in Homework5.java first.
*
* @author Corey Wright
*/
public class Homework5Main {
public static void main(String[] args) {
// write code here to demonstrate that your 8 puzzle solver works.
Homework5 test = new Homework5();
//Create a 3x3 puzzle where the optimal path is of length 8
SlidingTilePuzzle puzzle = new SlidingTilePuzzle(3, 3, 8);
System.out.println("Our Puzzle is:");
System.out.println(puzzle);
ArrayList<SlidingTilePuzzle> path = test.solver(puzzle);
//Path stores the start state up to the goal state, so the shortest past is the size - 1
System.out.println(path.size() - 1);
System.out.println("Solution path");
for (SlidingTilePuzzle s : path) {
System.out.println();
System.out.println(s);
}
}
} | [
"[email protected]"
] | |
3eead24357554cacc7fea2349552b6be040a317f | 802b51430aad084b64aef0e25db48ea0e589b4bf | /2sem/PIS/pis_webapp/src/main/java/com/vut/fit/pis2020/configuration/WebConfig.java | a921269a4ab2d85340d1de094a8a320b1f0a8420 | [
"MIT"
] | permissive | TomasLapsansky/VUT-FIT-MITAI | dcbd36a64a5232db1a4e1603f84eea05f5ff0f3a | b31f86db58de538b8f5c87fb854e86c036e3b19c | refs/heads/master | 2021-06-30T04:17:52.859270 | 2021-02-08T17:49:41 | 2021-02-08T17:49:41 | 237,456,563 | 0 | 1 | null | 2021-06-04T22:18:50 | 2020-01-31T15:20:44 | JavaScript | UTF-8 | Java | false | false | 490 | java | package com.vut.fit.pis2020.configuration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class WebConfig implements WebMvcConfigurer {
@Bean
public BCryptPasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
}
| [
"[email protected]"
] | |
de41841c81af5101bf0046cfb5eb8e3bd6ba5392 | 9e1c5db2bfd7f9178aa16edd59531ca64fc5235a | /Zhangjiyong1501A20170103/app/src/main/java/com/bwei/zhangjiyong1501a20170103/MainActivity.java | 4f08e2f6457f027e8bfa3e0eb952b1fe7a56ec76 | [] | no_license | nanshanjun/NumberTwo | 21a806d58bf13be7db15720b969f5c82a879be2a | 4e118441717c0e200690276525b179d49e7e322b | refs/heads/master | 2021-01-19T09:19:02.849004 | 2017-04-10T00:22:00 | 2017-04-10T00:22:00 | 87,749,788 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 729 | java | package com.bwei.zhangjiyong1501a20170103;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
public class MainActivity extends AppCompatActivity {
private Circle circle_one;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
circle_one = (Circle) findViewById(R.id.circle_one);
// circle_one.onMyCircleDownListener(new Circle.CircleDown() {
// @Override
// public void CircleDon() {
//
// int random= 1000+(int)(Math.random()*8999);
//
// circle_one.addMessage(random+"");
//
// }
// });
}
}
| [
"[email protected]"
] | |
e4612fe1ba399363a37c84b475bf0ea5425841a7 | 12b14b30fcaf3da3f6e9dc3cb3e717346a35870a | /examples/commons-math3/mutations/mutants-LoessInterpolator/329/org/apache/commons/math3/analysis/interpolation/LoessInterpolator.java | 738cffe699c6fc575fb07d0ef1734d4a09471813 | [
"BSD-3-Clause",
"Minpack",
"Apache-2.0"
] | permissive | SmartTests/smartTest | b1de326998857e715dcd5075ee322482e4b34fb6 | b30e8ec7d571e83e9f38cd003476a6842c06ef39 | refs/heads/main | 2023-01-03T01:27:05.262904 | 2020-10-27T20:24:48 | 2020-10-27T20:24:48 | 305,502,060 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 19,440 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.commons.math3.analysis.interpolation;
import java.io.Serializable;
import java.util.Arrays;
import org.apache.commons.math3.analysis.polynomials.PolynomialSplineFunction;
import org.apache.commons.math3.exception.NotPositiveException;
import org.apache.commons.math3.exception.OutOfRangeException;
import org.apache.commons.math3.exception.DimensionMismatchException;
import org.apache.commons.math3.exception.NoDataException;
import org.apache.commons.math3.exception.NumberIsTooSmallException;
import org.apache.commons.math3.exception.NonMonotonicSequenceException;
import org.apache.commons.math3.exception.NotFiniteNumberException;
import org.apache.commons.math3.exception.util.LocalizedFormats;
import org.apache.commons.math3.util.FastMath;
import org.apache.commons.math3.util.MathUtils;
import org.apache.commons.math3.util.MathArrays;
/**
* Implements the <a href="http://en.wikipedia.org/wiki/Local_regression">
* Local Regression Algorithm</a> (also Loess, Lowess) for interpolation of
* real univariate functions.
* <p/>
* For reference, see
* <a href="http://www.math.tau.ac.il/~yekutiel/MA seminar/Cleveland 1979.pdf">
* William S. Cleveland - Robust Locally Weighted Regression and Smoothing
* Scatterplots</a>
* <p/>
* This class implements both the loess method and serves as an interpolation
* adapter to it, allowing one to build a spline on the obtained loess fit.
*
* @version $Id$
* @since 2.0
*/
public class LoessInterpolator
implements UnivariateInterpolator, Serializable {
/** Default value of the bandwidth parameter. */
public static final double DEFAULT_BANDWIDTH = 0.3;
/** Default value of the number of robustness iterations. */
public static final int DEFAULT_ROBUSTNESS_ITERS = 2;
/**
* Default value for accuracy.
* @since 2.1
*/
public static final double DEFAULT_ACCURACY = 1e-12;
/** serializable version identifier. */
private static final long serialVersionUID = 5204927143605193821L;
/**
* The bandwidth parameter: when computing the loess fit at
* a particular point, this fraction of source points closest
* to the current point is taken into account for computing
* a least-squares regression.
* <p/>
* A sensible value is usually 0.25 to 0.5.
*/
private final double bandwidth;
/**
* The number of robustness iterations parameter: this many
* robustness iterations are done.
* <p/>
* A sensible value is usually 0 (just the initial fit without any
* robustness iterations) to 4.
*/
private final int robustnessIters;
/**
* If the median residual at a certain robustness iteration
* is less than this amount, no more iterations are done.
*/
private final double accuracy;
/**
* Constructs a new {@link LoessInterpolator}
* with a bandwidth of {@link #DEFAULT_BANDWIDTH},
* {@link #DEFAULT_ROBUSTNESS_ITERS} robustness iterations
* and an accuracy of {#link #DEFAULT_ACCURACY}.
* See {@link #LoessInterpolator(double, int, double)} for an explanation of
* the parameters.
*/
public LoessInterpolator() {
this.bandwidth = DEFAULT_BANDWIDTH;
this.robustnessIters = DEFAULT_ROBUSTNESS_ITERS;
this.accuracy = DEFAULT_ACCURACY;
}
/**
* Construct a new {@link LoessInterpolator}
* with given bandwidth and number of robustness iterations.
* <p>
* Calling this constructor is equivalent to calling {link {@link
* #LoessInterpolator(double, int, double) LoessInterpolator(bandwidth,
* robustnessIters, LoessInterpolator.DEFAULT_ACCURACY)}
* </p>
*
* @param bandwidth when computing the loess fit at
* a particular point, this fraction of source points closest
* to the current point is taken into account for computing
* a least-squares regression.</br>
* A sensible value is usually 0.25 to 0.5, the default value is
* {@link #DEFAULT_BANDWIDTH}.
* @param robustnessIters This many robustness iterations are done.</br>
* A sensible value is usually 0 (just the initial fit without any
* robustness iterations) to 4, the default value is
* {@link #DEFAULT_ROBUSTNESS_ITERS}.
* @see #LoessInterpolator(double, int, double)
*/
public LoessInterpolator(double bandwidth, int robustnessIters) {
this(bandwidth, robustnessIters, DEFAULT_ACCURACY);
}
/**
* Construct a new {@link LoessInterpolator}
* with given bandwidth, number of robustness iterations and accuracy.
*
* @param bandwidth when computing the loess fit at
* a particular point, this fraction of source points closest
* to the current point is taken into account for computing
* a least-squares regression.</br>
* A sensible value is usually 0.25 to 0.5, the default value is
* {@link #DEFAULT_BANDWIDTH}.
* @param robustnessIters This many robustness iterations are done.</br>
* A sensible value is usually 0 (just the initial fit without any
* robustness iterations) to 4, the default value is
* {@link #DEFAULT_ROBUSTNESS_ITERS}.
* @param accuracy If the median residual at a certain robustness iteration
* is less than this amount, no more iterations are done.
* @throws OutOfRangeException if bandwidth does not lie in the interval [0,1].
* @throws NotPositiveException if {@code robustnessIters} is negative.
* @see #LoessInterpolator(double, int)
* @since 2.1
*/
public LoessInterpolator(double bandwidth, int robustnessIters, double accuracy)
throws OutOfRangeException,
NotPositiveException {
if (bandwidth < 0 ||
bandwidth > 1) {
throw new OutOfRangeException(LocalizedFormats.BANDWIDTH, bandwidth, 0, 1);
}
this.bandwidth = bandwidth;
if (robustnessIters < 0) {
throw new NotPositiveException(LocalizedFormats.ROBUSTNESS_ITERATIONS, robustnessIters);
}
this.robustnessIters = robustnessIters;
this.accuracy = accuracy;
}
/**
* Compute an interpolating function by performing a loess fit
* on the data at the original abscissae and then building a cubic spline
* with a
* {@link org.apache.commons.math3.analysis.interpolation.SplineInterpolator}
* on the resulting fit.
*
* @param xval the arguments for the interpolation points
* @param yval the values for the interpolation points
* @return A cubic spline built upon a loess fit to the data at the original abscissae
* @throws NonMonotonicSequenceException if {@code xval} not sorted in
* strictly increasing order.
* @throws DimensionMismatchException if {@code xval} and {@code yval} have
* different sizes.
* @throws NoDataException if {@code xval} or {@code yval} has zero size.
* @throws NotFiniteNumberException if any of the arguments and values are
* not finite real numbers.
* @throws NumberIsTooSmallException if the bandwidth is too small to
* accomodate the size of the input data (i.e. the bandwidth must be
* larger than 2/n).
*/
public final PolynomialSplineFunction interpolate(final double[] xval,
final double[] yval)
throws NonMonotonicSequenceException,
DimensionMismatchException,
NoDataException,
NotFiniteNumberException,
NumberIsTooSmallException {
return new SplineInterpolator().interpolate(xval, smooth(xval, yval));
}
/**
* Compute a weighted loess fit on the data at the original abscissae.
*
* @param xval Arguments for the interpolation points.
* @param yval Values for the interpolation points.
* @param weights point weights: coefficients by which the robustness weight
* of a point is multiplied.
* @return the values of the loess fit at corresponding original abscissae.
* @throws NonMonotonicSequenceException if {@code xval} not sorted in
* strictly increasing order.
* @throws DimensionMismatchException if {@code xval} and {@code yval} have
* different sizes.
* @throws NoDataException if {@code xval} or {@code yval} has zero size.
* @throws NotFiniteNumberException if any of the arguments and values are
not finite real numbers.
* @throws NumberIsTooSmallException if the bandwidth is too small to
* accomodate the size of the input data (i.e. the bandwidth must be
* larger than 2/n).
* @since 2.1
*/
public final double[] smooth(final double[] xval, final double[] yval,
final double[] weights)
throws NonMonotonicSequenceException,
DimensionMismatchException,
NoDataException,
NotFiniteNumberException,
NumberIsTooSmallException {
if (xval.length != yval.length) {
throw new DimensionMismatchException(xval.length, yval.length);
}
final int n = xval.length;
if (n == 0) {
throw new NoDataException();
}
checkAllFiniteReal(xval);
checkAllFiniteReal(yval);
checkAllFiniteReal(weights);
MathArrays.checkOrder(xval);
if (n == 1) {
return new double[]{yval[0]};
}
if (n == 2) {
return new double[]{yval[0], yval[1]};
}
int bandwidthInPoints = (int) (bandwidth * n);
if (bandwidthInPoints < 2) {
throw new NumberIsTooSmallException(LocalizedFormats.BANDWIDTH,
bandwidthInPoints, 2, true);
}
final double[] res = new double[n];
final double[] residuals = new double[n];
final double[] sortedResiduals = new double[n];
final double[] robustnessWeights = new double[n];
// Do an initial fit and 'robustnessIters' robustness iterations.
// This is equivalent to doing 'robustnessIters+1' robustness iterations
// starting with all robustness weights set to 1.
Arrays.fill(robustnessWeights, 1);
for (int iter = 0; iter <= robustnessIters; ++iter) {
final int[] bandwidthInterval = {0, bandwidthInPoints - 1};
// At each x, compute a local weighted linear regression
for (int i = 0; i < n; ++i) {
final double x = xval[i];
// Find out the interval of source points on which
// a regression is to be made.
if (i > 0) {
updateBandwidthInterval(xval, weights, i, bandwidthInterval);
}
final int ileft = bandwidthInterval[0];
final int iright = bandwidthInterval[1];
// Compute the point of the bandwidth interval that is
// farthest from x
final int edge;
if (xval[i] - xval[ileft] > xval[iright] - xval[i]) {
edge = ileft;
} else {
edge = iright;
}
// Compute a least-squares linear fit weighted by
// the product of robustness weights and the tricube
// weight function.
// See http://en.wikipedia.org/wiki/Linear_regression
// (section "Univariate linear case")
// and http://en.wikipedia.org/wiki/Weighted_least_squares
// (section "Weighted least squares")
double sumWeights = 0;
double sumX = 0;
double sumXSquared = 0;
double sumY = 0;
double sumXY = 0;
double denom = FastMath.abs(1.0 / (xval[edge] - x));
for (int k = ileft; k <= iright; ++k) {
final double xk = xval[k];
final double yk = yval[k];
final double dist = (k < i) ? x - xk : xk - x;
final double w = tricube(dist * denom) * robustnessWeights[k] * weights[k];
final double xkw = xk * w;
sumWeights += w;
sumX += xkw;
sumXSquared += xk * xkw;
sumY += yk * w;
sumXY += yk * xkw;
}
final double meanX = sumX / sumWeights;
final double meanY = sumY / sumWeights;
final double meanXY = sumXY / sumWeights;
final double meanXSquared = sumXSquared / sumWeights;
final double beta;
if (FastMath.sqrt(FastMath.abs(meanXSquared - meanX * meanX)) < accuracy) {
beta = 0;
} else {
beta = (meanXY - meanX * meanY) / (meanXSquared - meanX * meanX);
}
final double alpha = meanY - beta * meanX;
res[i] = beta * x + alpha;
residuals[i] = FastMath.abs(yval[i] - res[i]);
}
// No need to recompute the robustness weights at the last
// iteration, they won't be needed anymore
if (iter == robustnessIters) {
break;
}
// Recompute the robustness weights.
// Find the median residual.
// An arraycopy and a sort are completely tractable here,
// because the preceding loop is a lot more expensive
System.arraycopy(residuals, 0, sortedResiduals, 0, n);
Arrays.sort(sortedResiduals);
final double medianResidual = sortedResiduals[n / 2];
if (FastMath.abs(medianResidual) < accuracy) {
break;
}
for (int i = 0; i < n; ++i) {
final double arg = residuals[i] / (6 * medianResidual);
if (arg >= 1) {
robustnessWeights[i] = 0;
} else {
final double w = 1 - arg * arg;
robustnessWeights[i] = w * w;
}
}
}
return res;
}
/**
* Compute a loess fit on the data at the original abscissae.
*
* @param xval the arguments for the interpolation points
* @param yval the values for the interpolation points
* @return values of the loess fit at corresponding original abscissae
* @throws NonMonotonicSequenceException if {@code xval} not sorted in
* strictly increasing order.
* @throws DimensionMismatchException if {@code xval} and {@code yval} have
* different sizes.
* @throws NoDataException if {@code xval} or {@code yval} has zero size.
* @throws NotFiniteNumberException if any of the arguments and values are
* not finite real numbers.
* @throws NumberIsTooSmallException if the bandwidth is too small to
* accomodate the size of the input data (i.e. the bandwidth must be
* larger than 2/n).
*/
public final double[] smooth(final double[] xval, final double[] yval)
throws NonMonotonicSequenceException,
DimensionMismatchException,
NoDataException,
NotFiniteNumberException,
NumberIsTooSmallException {
if (xval.length != yval.length) {
throw new DimensionMismatchException(xval.length, yval.length);
}
final double[] unitWeights = new double[xval.length];
;
return smooth(xval, yval, unitWeights);
}
/**
* Given an index interval into xval that embraces a certain number of
* points closest to {@code xval[i-1]}, update the interval so that it
* embraces the same number of points closest to {@code xval[i]},
* ignoring zero weights.
*
* @param xval Arguments array.
* @param weights Weights array.
* @param i Index around which the new interval should be computed.
* @param bandwidthInterval a two-element array {left, right} such that:
* {@code (left==0 or xval[i] - xval[left-1] > xval[right] - xval[i])}
* and
* {@code (right==xval.length-1 or xval[right+1] - xval[i] > xval[i] - xval[left])}.
* The array will be updated.
*/
private static void updateBandwidthInterval(final double[] xval, final double[] weights,
final int i,
final int[] bandwidthInterval) {
final int left = bandwidthInterval[0];
final int right = bandwidthInterval[1];
// The right edge should be adjusted if the next point to the right
// is closer to xval[i] than the leftmost point of the current interval
int nextRight = nextNonzero(weights, right);
if (nextRight < xval.length && xval[nextRight] - xval[i] < xval[i] - xval[left]) {
int nextLeft = nextNonzero(weights, bandwidthInterval[0]);
bandwidthInterval[0] = nextLeft;
bandwidthInterval[1] = nextRight;
}
}
/**
* Return the smallest index {@code j} such that
* {@code j > i && (j == weights.length || weights[j] != 0)}.
*
* @param weights Weights array.
* @param i Index from which to start search.
* @return the smallest compliant index.
*/
private static int nextNonzero(final double[] weights, final int i) {
int j = i + 1;
while(j < weights.length && weights[j] == 0) {
++j;
}
return j;
}
/**
* Compute the
* <a href="http://en.wikipedia.org/wiki/Local_regression#Weight_function">tricube</a>
* weight function
*
* @param x Argument.
* @return <code>(1 - |x|<sup>3</sup>)<sup>3</sup></code> for |x| < 1, 0 otherwise.
*/
private static double tricube(final double x) {
final double absX = FastMath.abs(x);
if (absX >= 1.0) {
return 0.0;
}
final double tmp = 1 - absX * absX * absX;
return tmp * tmp * tmp;
}
/**
* Check that all elements of an array are finite real numbers.
*
* @param values Values array.
* @throws org.apache.commons.math3.exception.NotFiniteNumberException
* if one of the values is not a finite real number.
*/
private static void checkAllFiniteReal(final double[] values) {
for (int i = 0; i < values.length; i++) {
MathUtils.checkFinite(values[i]);
}
}
}
| [
"[email protected]"
] | |
ae2d6bb5a7f19efa9f5e942862d6cb74dc73c06b | cddfef24e026ca90e277a38d3a73f779d924f324 | /demo-redis-mq-template/src/main/java/com/gcdd/redis/mq/template/Consumer.java | ac0b0f70a6fc80a6b9952016e5226bb8f3862109 | [] | no_license | gcdd1993/demos | a0a04d38429734176124895b684531e482f419dc | 408a5a90b480183220f697e84825991feff3009c | refs/heads/master | 2020-04-29T23:37:24.615043 | 2019-04-10T08:15:48 | 2019-04-10T08:15:48 | 176,482,084 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 931 | java | package com.gcdd.redis.mq.template;
import org.redisson.api.RTopic;
import org.redisson.api.RedissonClient;
import org.redisson.api.listener.MessageListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
/**
* @author gaochen
* @date 2019/3/4
*/
@Service
public class Consumer {
@Autowired
private RedissonClient redisson;
@PostConstruct
public void consume() {
for (int i = 0; i < 2; i++) {
RTopic topic = redisson.getTopic("anyTopic");
topic.addListener(MyMessage.class, new MessageListener<MyMessage>() {
@Override
public void onMessage(CharSequence channel, MyMessage msg) {
System.out.println(Thread.currentThread().getName() + "consume receive message " + msg);
}
});
}
}
}
| [
"[email protected]"
] | |
735b368667b9cd879495a6d4be97d0839de7b18d | fceec5e9bf69314050a45072826e97f7de804a3e | /Mahasiswa.java | 2e3218393b7b55a3bd7ef534077403f4e10dabb3 | [] | no_license | andika22/soal1 | 08b18a83ce7c94c4c66292ac15a6f95365cc2c9d | 8690a719009972a75bc35b3ce2f674eb7b8f2f61 | refs/heads/master | 2021-01-15T12:15:37.482888 | 2016-03-05T09:20:22 | 2016-03-05T09:20:22 | 53,178,524 | 0 | 0 | null | 2016-03-05T02:26:18 | 2016-03-05T02:26:17 | null | UTF-8 | Java | false | false | 888 | java |
package mahasiswa;
public class Mahasiswa {
private String nama;
private int nim;
private String alamat;
private String kelas;
private String jurusan;
public void setnama(String s){
nama = s;
}
public void setnim(int i){
nim = i;
}
public void setalamat(String s){
alamat = s;
}
public void setkelas(String s){
kelas = s;
}
public void setjurusan(String s){
jurusan = s;
}
public void displaymessage(){
System.out.println("Seorang mahasiswa memiliki nama " + nama);
System.out.println("dan memiliki NIM " + nim);
System.out.println("beralamat di " + alamat);
System.out.println("dia berkuliah jurusan " + jurusan);
System.out.println("dan dia adalah anggota kelas " + kelas);
}
}
| [
"[email protected]"
] | |
a0d833d8d1706af95d79553b42ae9fcdeca28b14 | d5dcdb4634e5abd781b7c816092b9265de48a88b | /src/test/java/com/pages/Category/EditCategoryPage.java | 1a0c0c52f1df62056f09e63ffe9d1c5cf754f7ef | [] | no_license | Alexandra91/Admin | 1bdb0b4ffe56cb5b3ae5e1fec99e9f5b300a5cdb | 3afa120e850d7bd0b5f71d7a16a67b7d9a1d2aa3 | refs/heads/master | 2021-01-09T20:26:49.414349 | 2016-09-20T13:00:52 | 2016-09-20T13:00:52 | 63,674,507 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 64 | java | package com.pages.Category;
public class EditCategoryPage {
}
| [
"[email protected]"
] | |
6a2abe9a54d92b9e1924ae2843cfb95f84b7230f | a2d9bef6d805ef4d7a137445899dae1ed9391012 | /day8-数组/04小组作业/涂志文/day8_数组/src/com/qf/edu/MyDemo4.java | 79c9c172ed34879ab46b3bd14f6819d31a803067 | [] | no_license | jacktzw/04- | fb7ebfb2a5ff8c235da5ea8d9cef55ad73c79a54 | 96f34638f2bd6bc26fef94d1158c3b809a3a5d52 | refs/heads/master | 2022-12-03T14:13:59.194726 | 2020-07-31T00:56:58 | 2020-07-31T00:56:58 | 283,909,032 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 878 | java | package com.qf.edu;
import java.util.Arrays;
public class MyDemo4 {
public static void main(String[] args) {
int[] a=new int[5];
Arrays.fill(a, 11); //数组的填充方法
System.out.println(Arrays.equals(a, a));
System.out.println(Arrays.toString(a));
// Arrays.binarySearch(a, key);
//二维数组
int arr[][]= {{5,8},{1,2,3},{5,6,8,9,4}};
//取值
// System.out.println(arr[2][3]);
//遍历
for (int i = 0; i < arr.length; i++) { //外层为行
System.out.println(Arrays.toString(arr[i]));
/*
* for (int j = 0; j < arr[i].length; j++) { //内层为列
* System.out.print(arr[i][j]+","); }
*/
// System.out.println();
/*
* 二维数组的创建方式
*/
/*
* int [][]arr1; arr1=new int[10][5]; int [][]arr2=new int[5][5]; int
* [][]arr3=new int[5][]; arr3[0]=new int[3]; arr3[0][0]=5;
*/
}
}
}
| [
"[email protected]"
] | |
ad8a0a6923d8b0039e720ce3d9defb1b448a2db9 | eab4f2ead82e24ccf1cdc87729e4e2b65f3050e6 | /src/main/java/com/play/game/repository/mysql/mapper/GameInfoMapper.java | e4433845652d2f99af34c34c48005f376dc1c6b9 | [] | no_license | lzzjingcairensheng/just-play | dbaf4451ef8964a0725c89e6c9d8e0a4ae1d3e30 | cc0e8077f743c6a328604aee9fd1086af3dd392c | refs/heads/master | 2021-08-28T03:06:20.971809 | 2017-12-11T04:51:03 | 2017-12-11T04:51:03 | 110,499,526 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,112 | java | package com.play.game.repository.mysql.mapper;
import com.play.game.entity.GameInfo;
import com.play.game.repository.mysql.criteria.GameInfoCriteria;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;
public interface GameInfoMapper {
long countByExample(GameInfoCriteria example);
int deleteByExample(GameInfoCriteria example);
int deleteByPrimaryKey(Integer gameId);
int insert(GameInfo record);
int insertSelective(GameInfo record);
List<GameInfo> selectByExampleWithRowbounds(GameInfoCriteria example, RowBounds rowBounds);
List<GameInfo> selectByExample(GameInfoCriteria example);
GameInfo selectByPrimaryKey(Integer gameId);
int updateByExampleSelective(@Param("record") GameInfo record, @Param("example") GameInfoCriteria example);
int updateByExample(@Param("record") GameInfo record, @Param("example") GameInfoCriteria example);
int updateByPrimaryKeySelective(GameInfo record);
int updateByPrimaryKey(GameInfo record);
void batchInsert(@Param("items") List<GameInfo> items);
} | [
"[email protected]"
] | |
4d8b357136964bc447d4d10575bb092cdce0eced | 1fb2d2b1dc47763b542bb917cc5d38c606c03530 | /test/com/rtg/reader/PrereadHashFunctionTest.java | 5c50f8ae6673ae4f2f2682c503471ee6c290daf9 | [
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | xtmgah/rtg-tools | 7ba624647eac3366df899a16abe4cbbaa4f84b99 | 6e8279e7d2e60754e21462faadd9a4324fd007b3 | refs/heads/master | 2021-01-18T04:57:30.468409 | 2015-07-15T22:53:14 | 2015-07-15T22:53:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,578 | 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.reader;
import junit.framework.TestCase;
/**
* Tests.
*/
public class PrereadHashFunctionTest extends TestCase {
public PrereadHashFunctionTest(final String name) {
super(name);
}
public void testInit() {
PrereadHashFunction prf = new PrereadHashFunction();
assertEquals(0L, prf.getHash());
}
public void testInt() {
PrereadHashFunction prf = new PrereadHashFunction();
for (int i = 0 ; i < 1000; i++) {
prf.irvineHash(i);
}
assertEquals(8815098401637430148L, prf.getHash());
}
public void testLong() {
PrereadHashFunction prf = new PrereadHashFunction();
for (long l = 0 ; l < 1000; l++) {
prf.irvineHash(l);
}
assertEquals(6022146393827695201L, prf.getHash());
}
public void testOutput() {
PrereadHashFunction prf = new PrereadHashFunction();
prf.irvineHash(5);
prf.irvineHash("PrereadHashFunction");
assertEquals(-139924295097060585L, prf.getHash());
}
public void testString() {
PrereadHashFunction prf = new PrereadHashFunction();
prf.irvineHash("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
assertEquals(-159429765726103168L, prf.getHash());
}
private static final long[] HASH = {
-4964420948893066024L,
7564655870752979346L,
3831662765844904176L,
6137546356583794141L,
-594798593157429144L,
112842269129291794L,
-669528114487223426L,
-1109287713991315740L,
-974081879987450628L,
-1160629452687687109L,
7326573195622447256L,
6410576364588137014L,
5424394867226112926L,
-9103770306483490189L,
2139215297105423308L,
-4232865876030345843L,
-6273872167485304708L,
2891469594365336806L,
6976596177944619528L,
2578166436595196069L,
-5627216606837767319L,
-3592913410653813758L,
92698085241473569L,
-8796603504740353600L,
-4722652817683412901L,
2619856624980352251L,
8886318912347348303L,
-8401480976436315613L,
-7801123389691242517L,
3779987867844568136L,
-6947711303906420817L,
3407244680303549079L,
197092594700490712L,
2970725011242582564L,
3284532136690698432L,
-8478177725643278359L,
-482677293272704124L,
4527320925905780494L,
7277626163180921831L,
4014050679668805482L,
7969120158891947125L,
4300965142756182089L,
-2030825140507191061L,
707006413279611759L,
-7519275600551226667L,
-6360924135797636003L,
2210640064016022649L,
-6410673298797731886L,
-289193436830779917L,
3813634057487595412L,
6911063436971917473L,
8547294963617019503L,
6154022364946197696L,
8175826803456981118L,
-9147084144055124649L,
-18800628192384088L,
-6817826759444601261L,
-1667880028869348243L,
-9082071447080613645L,
9065674809775364834L,
7909671975457870438L,
5683311091615826937L,
-5214481407826501455L,
-693328208225879290L,
3864458965704708566L,
3184808690151788414L,
-8320357513071910606L,
-8200160751728555263L,
-7603456060161050842L,
-3888746125786119271L,
-5552347832537805063L,
3774859742041214532L,
4702249276633814781L,
-4096719924219374161L,
4150930343758163695L,
-311691390498039484L,
-3622597253628401501L,
-3019456038419834778L,
3008729024856518368L,
-6686992125460025861L,
161601140914943624L,
-6803345800057020374L,
3836516331752709628L,
-2207018395996362651L,
-5404080405594186050L,
-5102892484113533015L,
-9048258330105186985L,
-237923595412718844L,
2826893961496978298L,
-5338953178777934760L,
-3246979880425410455L,
2281331448982092637L,
-7065999876450923625L,
8888791547312749291L,
1840067945267344782L,
-7062411921403462023L,
518729297779020562L,
-7536618281581788192L,
1347092278477147782L,
1365943130551420261L,
-5904149397109527665L,
5165118076730241013L,
-7305211479695003402L,
-2773637612724504142L,
6526887576802954450L,
-7403923644694799186L,
5388172503113520870L,
-2279230739761038859L,
-4717761859960318649L,
7807265917042125009L,
6932437597733693250L,
5004478446554740296L,
-4983868948686226820L,
-2089196626022557463L,
806172501569318489L,
8443078202631527623L,
-2537354127574070879L,
-1809183693800895546L,
1152708571114219105L,
-4356742874647865835L,
7889674025587210255L,
-15063047445053702L,
1141886611049844721L,
-7631037532535991852L,
-7982034127000075330L,
-6234520482433768610L,
-1710360246199412092L,
4546857235350971184L,
4583808669371655117L,
-5407509412797283957L,
6229851483527453949L,
-7243389174711685803L,
5818523204758407422L,
451431109683129954L,
8319638437045870110L,
6809326219677622260L,
8556296580499353143L,
3269551181474795397L,
-5974473391241630449L,
-5246761733127519293L,
-4733994914873378558L,
-1307825960948043813L,
-7565129111504795170L,
-6566813981172607238L,
2038177896599595533L,
-4157820461140106224L,
5653609452294381049L,
-2202565841775117866L,
-6817890117611987541L,
-1311679443604766958L,
3628279229051225269L,
-4525977720206120167L,
2907771609439525970L,
778059278289524373L,
6984359371816035275L,
-3936364606998129528L,
-5298787210079405285L,
2034188968277120912L,
-4387870378401475627L,
554672037112194924L,
5840819797252213829L,
-6141412821020480834L,
7866485694190557398L,
7388975574969141522L,
-4726765176532574285L,
6738701484706097438L,
-4357952859750176081L,
5952195970042072907L,
-8988751357500304535L,
8830011414065963124L,
2419637729810828715L,
586541553579625708L,
8198777404514432018L,
-5690429332067571771L,
-5182139003232109836L,
-4096094371451621809L,
5314520057811676541L,
-4033293396040907809L,
-622504768958473957L,
-64131069627898415L,
4410735263197203227L,
8212144607526460367L,
2402170585793741972L,
4325283475773974610L,
-6344159268077467517L,
-7890971429993775768L,
-8190969857040160713L,
4617151108230248888L,
-1470552416272715281L,
-5095890738279829053L,
-4113790345307396671L,
4469205987600845164L,
3241129027203716284L,
8205001152228352441L,
-3141642311557935535L,
-7343378748249317669L,
-6678700892246573074L,
5596136011188865643L,
1206361913488075499L,
-1143135553327786506L,
4914520655968408745L,
4227465294407942587L,
5607375553831556344L,
6861091380696820658L,
-2635540877404264775L,
-3558812817526879536L,
7170789582926847684L,
4892933472165288585L,
597173744976948491L,
-6091386647335781738L,
1371725377195789311L,
-7210074501640255752L,
3295738803696009778L,
546636298196020284L,
-5383611729103365571L,
5124104824591383551L,
2135919692763215075L,
-5695875964136749644L,
6438111700768233846L,
4208357349436110756L,
3091674171583948921L,
-7477735970847863754L,
-3506913595212098426L,
-8947977927743584400L,
6437570226861442418L,
979401604932372669L,
-7264508646647264850L,
-5874799961348262672L,
-7678580529857168913L,
6820729910234791048L,
-996271069855517935L,
-5784334880520928715L,
4142656736146180664L,
8201412039385703835L,
-5393578045340737736L,
549670855068890709L,
-6292301921292308170L,
5827649394587063099L,
-3398439017277695601L,
2869919216733092328L,
8363831910784389368L,
5897574581860534902L,
-8306706606536940827L,
-8812761396236860533L,
5816535479574000431L,
-5605727922123064679L,
1750179170939337200L,
-759857275904125856L,
2392129137028815281L,
435317679251669431L,
1562823400580920263L,
965148254923310220L,
8669113822474706681L,
-3326272830183554775L,
-570055038919252890L,
6456096406736068536L,
};
public void testHashes() {
assertEquals(256, PrereadHashFunction.HASH_BLOCKS.length);
for (int i = 0; i < HASH.length; i++) {
assertEquals(HASH[i], PrereadHashFunction.HASH_BLOCKS[i]);
}
}
}
| [
"[email protected]"
] | |
76523dd56728aa5e30cb725ab3b81c3ba23fcd0a | 454abf3798945ebc3150614095f4ce4f02705ee6 | /code/src/com/model/CounselDAO.java | 8d20d61650f31fc210445dea0a2c0eef636e95c3 | [] | no_license | 2019-SMHRD-Deep3/Gosogak | 012ff58b0d99c9bdf691699e733f5d8ea03f6608 | 69dd49bfae1e08eabc805af6386d0a41933a06c4 | refs/heads/master | 2021-03-02T22:47:58.176981 | 2020-05-26T11:06:57 | 2020-05-26T11:06:57 | 245,911,855 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,434 | java | package com.model;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
public class CounselDAO {
private Connection conn;
private PreparedStatement psmt;
private ResultSet rs;
private void getConnection() {
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
String db_url = "jdbc:oracle:thin:@localhost:1521:xe";
String db_id = "gosogak";
String db_pw = "gosogak";
conn = DriverManager.getConnection(db_url, db_id, db_pw);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
}
private void close() {
try {
if (rs != null)
rs.close();
if (psmt != null)
psmt.close();
if (conn != null)
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
public int insertCounsel(CounselDTO dto) {
int cnt=0;
try {
getConnection();
String sql="insert into COUNSELING values(couns_seq.nextval,?,?,?,?,sysdate)";
psmt=conn.prepareStatement(sql);
psmt.setString(1, dto.getCounsel_id());
psmt.setString(2, dto.getCounsel_manager());
psmt.setString(3, dto.getCounsel_title());
psmt.setString(4, dto.getCounsel_content());
cnt=psmt.executeUpdate();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally {
close();
}
return cnt;
}
public ArrayList<CounselDTO> selectCounsel(String id) {
ArrayList<CounselDTO> counselList=new ArrayList<CounselDTO>();
try {
getConnection();
String sql="select * from COUNSELING where MEMBER_ID=?";
psmt=conn.prepareStatement(sql);
psmt.setString(1, id);
rs=psmt.executeQuery();
while(rs.next()) {
int counsel_cd=rs.getInt(1);
String counsel_id=rs.getString(2);
String counsel_manager=rs.getString(3);
String counsel_title=rs.getString(4);
String counsel_content=rs.getString(5);
String counsel_dt=rs.getString(6);
CounselDTO dto=new CounselDTO(counsel_cd, counsel_id, counsel_manager, counsel_title, counsel_content, counsel_dt);
counselList.add(dto);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally {
close();
}
return counselList;
}
}
| [
"[email protected]"
] | |
9694b149e2bf2ed60486137d9c57119fdeaf7f90 | a02d90032439939e082c8412e45e14f349088592 | /Code android/Buddy_stable/gen/com/example/buddy/R.java | 106ab6082ce09e71a5a163bbcab7ab7ef1f14bd9 | [] | no_license | dedobbin/buddy | 2e5f991adf84aa637b9e496530217b7dbb546bd3 | 9066b9666672089404b1e68d254cfd5a3df25345 | refs/heads/master | 2023-04-23T04:57:33.403653 | 2021-05-12T19:52:26 | 2021-05-12T19:52:26 | 366,836,979 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,156 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.example.buddy;
public final class R {
public static final class array {
public static final int items=0x7f060000;
}
public static final class attr {
}
public static final class dimen {
/** Default screen margins, per the Android Design guidelines.
Customize dimensions originally defined in res/values/dimens.xml (such as
screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
*/
public static final int activity_horizontal_margin=0x7f040000;
public static final int activity_vertical_margin=0x7f040001;
}
public static final class drawable {
public static final int ic_drawer=0x7f020000;
public static final int ic_launcher=0x7f020001;
public static final int icon_groups=0x7f020002;
public static final int splash_background=0x7f020003;
public static final int title_buddy=0x7f020004;
}
public static final class id {
public static final int FriendFour=0x7f090018;
public static final int FriendFourLoc=0x7f090019;
public static final int FriendFourTemp=0x7f09001d;
public static final int FriendOne=0x7f090012;
public static final int FriendOneLoc=0x7f090015;
public static final int FriendOneTemp=0x7f09001b;
public static final int FriendThree=0x7f090013;
public static final int FriendThreeLoc=0x7f090017;
public static final int FriendThreeTemp=0x7f09001c;
public static final int FriendTwo=0x7f090014;
public static final int FriendTwoLoc=0x7f090016;
public static final int FriendTwoTemp=0x7f09001a;
public static final int TextView02=0x7f09001f;
public static final int action_friends=0x7f090021;
public static final int action_settings=0x7f090020;
public static final int bHumidityHigher=0x7f090005;
public static final int bHumidityLower=0x7f090004;
public static final int bRefresh=0x7f090008;
public static final int bclimateHigher=0x7f090001;
public static final int bclimateLower=0x7f090002;
public static final int content_frame=0x7f090010;
public static final int drawer_layout=0x7f09000f;
public static final int etLokaal=0x7f090007;
public static final int imageView1=0x7f090009;
public static final int ivTittle=0x7f09000a;
public static final int left_drawer=0x7f090011;
public static final int ownInfoTV=0x7f09001e;
public static final int textView1=0x7f090000;
public static final int tvCur=0x7f09000c;
public static final int tvHumText=0x7f090006;
public static final int tvOwnLocation=0x7f09000d;
public static final int tvOwnTemp=0x7f09000e;
public static final int tvTemp=0x7f09000b;
public static final int tvclimateText=0x7f090003;
}
public static final class layout {
public static final int account=0x7f030000;
public static final int activity_climate=0x7f030001;
public static final int activity_main=0x7f030002;
public static final int framelayout=0x7f030003;
public static final int friendlist=0x7f030004;
public static final int splash=0x7f030005;
public static final int test=0x7f030006;
}
public static final class menu {
public static final int main=0x7f080000;
}
public static final class string {
public static final int action_friends=0x7f050002;
public static final int action_settings=0x7f050001;
public static final int app_name=0x7f050000;
public static final int drawer_close=0x7f050004;
public static final int drawer_open=0x7f050003;
}
public static final class style {
/**
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
Base application theme for API 11+. This theme completely replaces
AppBaseTheme from res/values/styles.xml on API 11+ devices.
API 11 theme customizations can go here.
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
API 14 theme customizations can go here.
*/
public static final int AppBaseTheme=0x7f070000;
/** Application theme.
All customizations that are NOT specific to a particular API-level can go here.
*/
public static final int AppTheme=0x7f070001;
}
}
| [
"[email protected]"
] | |
8b444ca8fa4619a42866d154c3aa2571ff704ae9 | ac6ecc45eb7cdd35ae2d4a15ba9d93714e01b070 | /Renting/src/main/java/com/renting/service/ReservationService.java | d0f8039d0e9f1a60624616d6a34aaf2242675c4c | [] | no_license | risen255/Renting-Spring-Hibernate-Application | e2629c8e8b0e14da873f52828fc7c9c2055f7b41 | 12b5ce46373c7697debdfa089a2f77c69af3753b | refs/heads/master | 2021-01-12T08:28:23.827973 | 2016-12-15T19:15:28 | 2016-12-15T19:15:28 | 76,588,456 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 354 | java | package com.renting.service;
import com.renting.action.form.ReservationAction;
import com.renting.model.Reservation;
import com.renting.model.Room;
public interface ReservationService extends AbstractService<Reservation> {
Reservation getActiveReservation(Room room);
boolean bookRoom(ReservationAction reservationAction, Room room);
} | [
"[email protected]"
] | |
5769bddc7eced18a7ce6e1be795450fa9ceb9e30 | 33a5fcf025d92929669d53cf2dc3f1635eeb59c6 | /济南大气/meshing/src/main/java/cn/com/mapuni/meshing/activity/LoginActivity.java | 9d7294ae2d47dd6a2e3b249be4a22e6172f286da | [] | no_license | dayunxiang/MyHistoryProjects | 2cacbe26d522eeb3f858d69aa6b3c77f3c533f37 | 6e041f53a184e7c4380ce25f5c0274aa10f06c8e | refs/heads/master | 2020-11-29T09:23:27.085614 | 2018-03-12T07:07:18 | 2018-03-12T07:07:18 | null | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 5,285 | java | package cn.com.mapuni.meshing.activity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import cn.com.mapuni.meshing.base.controls.loading.YutuLoading;
import cn.com.mapuni.meshing.base.util.DisplayUitl;
import cn.com.mapuni.meshing.netprovider.WebServiceProvider;
import cn.com.mapuni.meshingtotal.R;
public class LoginActivity extends Activity implements OnClickListener {
private Button btn_login;
private EditText edt_username, edt_password;
private Intent intent;
private YutuLoading yutuLoading;
/** 最后登录的用户信息SP name */
private final String LAST_USER_SP_NAME = "lastuser";
/** 当前登录用户名 */
private String user;
/** 当前登录用户名密码 */
private String pass;
/** 当前登录用户id */
private String userid;
private final Handler handler = new Handler() {
@Override
public void handleMessage(android.os.Message msg) {
switch (msg.what) {
case 1:
if (yutuLoading != null) {
yutuLoading.dismissDialog();
}
Toast.makeText(LoginActivity.this, "登录成功!", Toast.LENGTH_SHORT)
.show();
saveUserInfo();
intent = new Intent(LoginActivity.this, MainActivity.class);
startActivity(intent);
finish();
break;
case 2:
if (yutuLoading != null) {
yutuLoading.dismissDialog();
}
Toast.makeText(LoginActivity.this, "用户名或密码错误!",
Toast.LENGTH_SHORT).show();
break;
case 3:
if (yutuLoading != null) {
yutuLoading.dismissDialog();
}
LoginActivity.this.finish();
Toast.makeText(LoginActivity.this, "网络错误", Toast.LENGTH_SHORT)
.show();
break;
}
}
private void saveUserInfo() {
DisplayUitl.writePreferences(LoginActivity.this, LAST_USER_SP_NAME,
"user", user);
DisplayUitl.writePreferences(LoginActivity.this, LAST_USER_SP_NAME,
"pass", pass);
DisplayUitl.writePreferences(LoginActivity.this, LAST_USER_SP_NAME,
"userid", userid);
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);// 去掉标题栏
setContentView(R.layout.activity_login);
btn_login = (Button) findViewById(R.id.btn_login);
btn_login.setOnClickListener(this);
edt_username = (EditText) findViewById(R.id.edt_username);
edt_username.setOnClickListener(this);
edt_password = (EditText) findViewById(R.id.edt_password);
edt_password.setOnClickListener(this);
autoLogin();
}
/**
* 自动登录
*/
private void autoLogin() {
String user = DisplayUitl.readPreferences(LoginActivity.this,
LAST_USER_SP_NAME, "user");
String pwd = DisplayUitl.readPreferences(LoginActivity.this,
LAST_USER_SP_NAME, "pass");
edt_username.setText(user);
edt_password.setText(pwd);
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
switch (v.getId()) {
case R.id.btn_login:
// syncTaskLogin();
handler.sendEmptyMessage(1);
break;
default:
break;
}
}
public void syncTaskLogin() {
yutuLoading = new YutuLoading(this);
yutuLoading.setCancelable(true);
yutuLoading.setLoadMsg("正在登录,请稍候", "");
yutuLoading.showDialog();
new Thread(new Runnable() {
@Override
public void run() {
ArrayList<HashMap<String, Object>> params = new ArrayList<HashMap<String, Object>>();
HashMap<String, Object> param = new HashMap<String, Object>();
user = edt_username.getText().toString();
pass = edt_password.getText().toString();
param.put("userName", user);
param.put("userPwd", pass);
params.add(param);
String result = "";
try {
result = (String) WebServiceProvider
.callWebService(
"http://tempuri.org/",
"login",
params,
"http://171.8.66.103:8033/WebService/RM_WebServiceForJava.asmx",
WebServiceProvider.RETURN_STRING, true);
// String[] node = { "GUID", "RWBH", "FileAttachmentPath",
// "FileAttachmentName", "UpdateTime",
// "SyncDataRegionCode" };
if (result == null || result.equals("[]")
|| result.equals("")) {
handler.sendEmptyMessage(3);
return;
}
// ArrayList<HashMap<String, Object>> wjlist =
// JsonHelper.paseJSON(result);
// if (wjlist == null || wjlist.size() == 0) {
// return;
// }
JSONObject jsonObject = new JSONObject(result);
Boolean isSuccess = jsonObject.getBoolean("isSuccess");
if (isSuccess) {
userid = jsonObject.getJSONArray("result").getJSONObject(0).getString("USER_ID");
handler.sendEmptyMessage(1);
} else {
handler.sendEmptyMessage(2);
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}).start();
}
}
| [
"[email protected]"
] | |
078e2ecc9fb9cec4b5cdf26e53a162117c942cb8 | 8d2125b342ff4a12950a40288689fafe9b2928f9 | /app/src/main/java/com/holike/crm/activity/mine/ChangePasswordActivity.java | e305e37e9add47787d63aa0be07d035b15bac732 | [] | no_license | gallopmark/HolikeCRM_Old | 8a63e5c76683890246a5a0482a9114d2a894d629 | cd5ad354df58b1defa68f71f1f20250c2fb38c4a | refs/heads/master | 2020-07-12T20:28:33.955839 | 2019-11-13T09:22:20 | 2019-11-13T09:22:20 | 204,900,694 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,997 | java | package com.holike.crm.activity.mine;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import com.holike.crm.R;
import com.holike.crm.base.MyFragmentActivity;
import com.holike.crm.presenter.activity.ChangePasswordPresenter;
import com.holike.crm.presenter.fragment.MinePresenter;
import com.holike.crm.view.activity.ChangePasswordView;
import butterknife.BindView;
import butterknife.OnClick;
import static com.holike.crm.presenter.activity.LoginPresenter.showPassword;
/**
* 修改密码
*/
public class ChangePasswordActivity extends MyFragmentActivity<ChangePasswordPresenter, ChangePasswordView> implements ChangePasswordView {
@BindView(R.id.et_change_password_oldpassword)
EditText etOldpassword;
@BindView(R.id.et_change_password_newpassword)
EditText etNewpassword;
@BindView(R.id.et_change_password_surepassword)
EditText etSurepassword;
@BindView(R.id.iv_change_password_oldpassword)
ImageView ivOldpassword;
@BindView(R.id.iv_change_password_newpassword)
ImageView ivNewpassword;
@BindView(R.id.iv_change_password_surepassword)
ImageView ivSurepassword;
private boolean isShowOld, isShowNew, isShowSure;
@Override
protected int setContentViewId() {
return R.layout.activity_change_password;
}
@Override
protected ChangePasswordPresenter attachPresenter() {
return new ChangePasswordPresenter();
}
@Override
protected void init() {
setTitle(getString(R.string.my_change_password));
setBack();
}
@Override
public void changePasswordSuccess() {
dismissLoading();
showShortToast(R.string.tips_change_success);
MinePresenter.logout(this);
}
@Override
public void changePasswordFailed(String failed) {
dismissLoading();
showShortToast(failed);
}
@Override
public void warn(String text) {
dismissLoading();
showShortToast(text);
}
@OnClick({R.id.iv_change_password_oldpassword, R.id.iv_change_password_newpassword, R.id.iv_change_password_surepassword, R.id.btn_change_password_save})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.iv_change_password_oldpassword:
isShowOld = showPassword(isShowOld, etOldpassword, ivOldpassword);
break;
case R.id.iv_change_password_newpassword:
isShowNew = showPassword(isShowNew, etNewpassword, ivNewpassword);
break;
case R.id.iv_change_password_surepassword:
isShowSure = showPassword(isShowSure, etSurepassword, ivSurepassword);
break;
case R.id.btn_change_password_save:
showLoading();
mPresenter.changePassword(etOldpassword.getText().toString(), etNewpassword.getText().toString(), etSurepassword.getText().toString());
break;
}
}
}
| [
"[email protected]"
] | |
545c7ecbabb2e6b00eca69974849d5874857b0dc | 8416e2396e84f5c123919dc1126fcdf320ebe143 | /CucumberProject/src/test/java/pages/AddProduct.java | b481fa0843af91a8dd195232f90ac291ef5bd2d2 | [] | no_license | KhushbuThakur268/CucumberProj | cf39cced71b53384a235e58607b6583c47bb542e | 05c4edfa0ff57fd95440fc8a70edeffcd343af61 | refs/heads/master | 2020-05-17T01:06:32.226567 | 2019-04-26T10:35:55 | 2019-04-26T10:35:55 | 183,417,016 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,610 | java | package pages;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.How;
public class AddProduct
{
@FindBy(how = How.PARTIAL_LINK_TEXT, using = "SignIn")
public static WebElement signIn;
@FindBy(how = How.ID, using = "userName")
public static WebElement username;
@FindBy(how = How.ID, using = "password")
public static WebElement password;
@FindBy(how = How.CSS, using = "input[value='Login']")
public static WebElement logIn;
@FindBy(how = How.XPATH, using = "/html/body/main/div/div/div/div[1]/button/h4")
public static WebElement addProducts;
@FindBy(how = How.ID, using = "categorydropid")
// @FindBy(how = How.XPATH, using = "//select[@id='categorydropid']")
// @FindBy(how = How.NAME, using = "categorydropname")
public static WebElement categoryName;
@FindBy(how = How.ID, using = "subcategorydropid")
public static WebElement subCategoryName;
@FindBy(how = How.ID, using = "prodid")
public static WebElement productName;
@FindBy(how = How.ID, using = "priceid")
public static WebElement price;
@FindBy(how = How.ID, using = "quantityid")
public static WebElement quantity;
@FindBy(how = How.ID, using = "brandid")
public static WebElement brand;
@FindBy(how = How.ID, using = "description")
public static WebElement desc;
@FindBy(how = How.CSS, using = "input[value='Add Product']")
public static WebElement addProduct;
@FindBy(how = How.XPATH, using = "/html/body/main/div/div/div/form/b/i")
public static WebElement proResult;
}
| [
"[email protected]"
] | |
dd3e72c3e342c9c8fa6bfc7f5469a117540ee2bc | 25bbe9976d451d69967e9f9d8307e4c01b0ba874 | /cities-api/src/main/java/com/github/daviladev/cities/service/EarthRadius.java | 93d9dbaef0db1b6ef6cc1c675924d4a0c3c2f027 | [] | no_license | daviladev/apiConsultacidades_dio | 2774d7b4e8351f51c339365b6664eb36e1ae7fe9 | 059f4f071904c04ba6314692f6068e08a903e150 | refs/heads/main | 2023-06-17T16:55:04.624145 | 2021-07-14T19:04:45 | 2021-07-14T19:04:45 | 386,047,054 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 423 | java | package com.github.daviladev.cities.service;
public enum EarthRadius {
METERS("m", 6378168),
KILOMETERS("km", 6378.168f),
MILES("mi", 3958.747716f);
private final String unit;
private final float value;
EarthRadius(final String unit, final float value) {
this.unit = unit;
this.value = value;
}
public float getValue() {
return value;
}
public String getUnit() {
return unit;
}
}
| [
"[email protected]"
] | |
5ae2f18356c8366f9c4a9c6d6811f9a657f87e6f | 6cf684993333075baf5f74d470964da901879397 | /camel-wsdl-db-orch-route/src/main/java/com/mycompany/dinardap/db/EntidadFilaProcessor.java | 0c66e6106caaba46026efc39326d62a202f9b201 | [] | no_license | iamthewall/Camel-WSDL-DB-Orchestation-Route | daf3191ae39e4e2fc068d0854b12994961865fad | 6cb06ec30f5c72dfafdf9c93055f09d3b402c6cc | refs/heads/master | 2016-09-08T02:07:52.129348 | 2015-07-16T16:04:47 | 2015-07-16T16:05:06 | 39,206,873 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 803 | java | package com.mycompany.dinardap.db;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
public class EntidadFilaProcessor implements Processor {
@Override
public void process(Exchange exchange) throws Exception
{
ArrayList<LinkedHashMap<String, Object>> resultado = exchange.getIn().getBody(ArrayList.class);
for (LinkedHashMap<String, Object> fila: resultado )
{
Iterator it = fila.entrySet().iterator();
while (it.hasNext()) {
Map.Entry pair = (Map.Entry)it.next();
System.out.println(pair.getKey() + " = " + pair.getValue());
it.remove(); // avoids a ConcurrentModificationException
}
}
}
}
| [
"[email protected]"
] | |
44c0a7a26249e1107668188631cd0056b044aafd | c0d55a71beae9a508d7e754f23e60303236d90e3 | /guice/src/main/java/io/datakernel/guice/servicegraph/SingletonService.java | 4293bea94758090f1398ed36711052a6664d86c8 | [
"Apache-2.0"
] | permissive | vmykh/datakernel | 8bad072c55f81fa46a1cf6b40e73179da8b63f57 | 0380a9fec4bf2e5181a0a3149906a2b83b1dc6d2 | refs/heads/master | 2021-01-17T10:47:24.965107 | 2015-08-05T14:47:45 | 2015-08-05T19:12:21 | 40,474,902 | 0 | 0 | null | 2015-08-31T07:55:48 | 2015-08-10T09:40:04 | Java | UTF-8 | Java | false | false | 1,030 | java | /*
* Copyright (C) 2015 SoftIndex LLC.
*
* 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 io.datakernel.guice.servicegraph;
import com.google.inject.ScopeAnnotation;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
@ScopeAnnotation
@Target({TYPE, METHOD})
@Retention(RUNTIME)
public @interface SingletonService {
}
| [
"[email protected]"
] | |
14891269383a372a660bbdc03accc8cfe9677cd3 | 8ded4312af8db4576ff7079358d5f66f7a256ffe | /Week5/src/trigger/week5/temperatureconverter/Main.java | f196f3594d63cdeed30c0b6b5c69421e6ceac42f | [
"WTFPL"
] | permissive | trigger-segfault/MCC-Java | c6ccabf0c2f26c461366c95425d238d5141dd57c | 1d23781927399f211608a1f78e2e2a0e10cb31b8 | refs/heads/master | 2020-04-24T06:51:36.404648 | 2019-05-10T16:24:07 | 2019-05-10T16:24:07 | 171,780,016 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 557 | java | /*
* Class Name: Main
* Author: Robert Jordan
* Date Created: Feb 20, 2019
* Synopsis: The main class to run the temperature converter program loop.
*/
package trigger.week5.temperatureconverter;
/**
* The main class for the temperature converter program.
*/
public class Main {
/**
* The main method for the temperature converter program.
* @param args Unused
*/
public static void main(String[] args) {
Menu.printTitle();
Temperature lastAnswer = null;
do {
lastAnswer = Menu.run(lastAnswer);
} while (lastAnswer != null);
}
}
| [
"[email protected]"
] | |
55f21225f753b5455b143ee2a16612634295c1f2 | 1c44755af185b717360f62c1ad6519e172091fa2 | /SynchronizedReentrantLock/src/ConsumerProducer2/Consumer.java | aac3ea62559779ecc991b3aa3a295696097701ec | [] | no_license | brianfordream/maven | 9b7dbde4e12f86ab7ce71d9c3c2720e5683b8a2d | 26af52de2d8c7247bb4dbd2890fb7be44c5604ab | refs/heads/master | 2021-01-22T02:43:12.408881 | 2014-08-27T06:18:25 | 2014-08-27T06:18:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 728 | java | package ConsumerProducer2;
import java.util.Random;
public class Consumer<T> implements Runnable {
private ConditionBoundBuffer<T> buffer;
Random random=new Random();
public Consumer(ConditionBoundBuffer<T> buffer){
this.buffer=buffer;
}
@Override
public void run() {
// TODO Auto-generated method stub
while(true){
try {
Thread.sleep(random.nextInt(100));
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
consume();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
public void consume() throws InterruptedException{
buffer.get();
}
}
| [
"[email protected]"
] | |
09e97b10452fbefb7a4b4b9c58639e82ef2eeef4 | 76e0e6e5991f82290bf3cf0d66e2eb0f650e8e00 | /03EnumerationsAndAnnotations/src/_02CardRank/CardRank.java | 3b5aaae9818d683fe7e0ef9ddcee1ee8492de256 | [
"MIT"
] | permissive | lapd87/SoftUniJavaOOPAdvanced | 47ba0efba41b4b2619d4b363996e23fe070290cc | e06cf284fffc7259210a94f327d078d228edf76f | refs/heads/master | 2020-03-27T21:40:22.120084 | 2018-09-03T07:26:02 | 2018-09-03T07:26:02 | 147,166,690 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 223 | java | package _02CardRank;
/**
* Created by IntelliJ IDEA.
* User: LAPD
* Date: 18.7.2018 г.
* Time: 12:11 ч.
*/
public enum CardRank {
ACE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, TEN, JACK, QUEEN, KING;
}
| [
"[email protected]"
] | |
fcb759b5d25b4d931fcb3078050a5ce13001f802 | d2984ba2b5ff607687aac9c65ccefa1bd6e41ede | /src/net/datenwerke/rs/core/client/datasourcemanager/DatasourceAdminModule.java | d8b9e89e3a5f80b75fc4f010e05c9809d9645f3d | [] | no_license | bireports/ReportServer | da979eaf472b3e199e6fbd52b3031f0e819bff14 | 0f9b9dca75136c2bfc20aa611ebbc7dc24cfde62 | refs/heads/master | 2020-04-18T10:18:56.181123 | 2019-01-25T00:45:14 | 2019-01-25T00:45:14 | 167,463,795 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,187 | java | /*
* ReportServer
* Copyright (c) 2018 InfoFabrik GmbH
* http://reportserver.net/
*
*
* This file is part of ReportServer.
*
* ReportServer is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.datenwerke.rs.core.client.datasourcemanager;
import net.datenwerke.gf.client.administration.interfaces.AdminModule;
import net.datenwerke.gxtdto.client.resources.BaseResources;
import net.datenwerke.rs.core.client.datasourcemanager.locale.DatasourcesMessages;
import net.datenwerke.rs.core.client.datasourcemanager.ui.DatasourceManagerPanel;
import net.datenwerke.rs.theme.client.icon.BaseIcon;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.user.client.ui.Widget;
import com.google.inject.Inject;
import com.google.inject.Provider;
/**
*
*
*/
public class DatasourceAdminModule implements AdminModule {
final private Provider<DatasourceManagerPanel> datasourceManagerPanelProvider;
@Inject
public DatasourceAdminModule(
Provider<DatasourceManagerPanel> datasourceManagerPanel
){
/* store objects */
this.datasourceManagerPanelProvider = datasourceManagerPanel;
}
@Override
public ImageResource getNavigationIcon(){
return BaseIcon.DATABASE.toImageResource();
}
@Override
public String getNavigationText() {
return DatasourcesMessages.INSTANCE.adminModuleName();
}
@Override
public Widget getMainWidget() {
return datasourceManagerPanelProvider.get();
}
@Override
public void notifyOfSelection() {
// ignore
}
}
| [
"[email protected]"
] | |
89ebb2b1103daec847511fecb7766121ae4aae6d | d8f56b2c60c96c366562ebd2df85a8d99020c128 | /app/src/test/java/com/easybuy/sg/grouponebuy/ExampleUnitTest.java | 84698b6af15a2fd0435c1d5799b0b225151a9e34 | [] | no_license | WawaTechnology/GrouponAndroid | 283aab6610bd31dea2e7445db426b2257211702b | 0dc05d14775e3a54c5ac7a2b8534f2e0df7c17a1 | refs/heads/master | 2020-04-09T22:20:38.991708 | 2019-07-30T06:37:28 | 2019-07-30T06:37:28 | 160,625,846 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,911 | java | package com.easybuy.sg.grouponebuy;
import android.support.v4.widget.TextViewCompat;
import com.easybuy.sg.grouponebuy.model.Product;
import org.junit.Before;
import org.junit.Test;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
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 {
Product product1;
Product product2;
@Before
public void setUp() throws Exception {
product1=new Product();
product2=new Product();
product1.setId("213k");
product1.setNameEn("grapes");
product1.setTotalNumber(3);
product2.setId("213k");
product2.setNameEn("grapes");
product2.setTotalNumber(4);
}
@Test
public void checkModified()
{
boolean res=product1.isModified(product2);
assertTrue(res);
}
@Test
public void checkEqual()
{
boolean res= product1.equals(product2);
assertTrue(res);
}
@Test
public void checkString()
{
String a="sam";
String b="sam";
String c=b;
b="ram";
System.out.println(a);
System.out.println(b);
System.out.println(c);
}
@Test
public void printFactorial()
{
int i=1;
int f=1;
while(i<=5)
{
f=f*i;
i+=1;
}
System.out.println(f) ;
}
@Test
public void reverseString()
{
String s="samp";
char ch[]=s.toCharArray();
int n=s.length();
for(int i=0;i<s.length()/2;i++)
{
char temp=ch[i];
ch[i]=ch[n-1-i];
ch[n-1-i]=temp;
}
System.out.println(String.valueOf(ch));
}
} | [
"[email protected]"
] | |
b80fbbfe4431622dbb6127c2dbca16e2dca993d0 | e2f1b18cd6ca38adc2e286354e01cbe4d4423fd9 | /src/com/javarush/test/level34/lesson02/home01/Solution.java | 454425272611183d4de966c69dfadb6f2d0f37b1 | [] | no_license | Polurival/JRHW | 092ab6d034d6e46dd99d57b67910ca4a7749f602 | 6f08a005d5b444f6ad00df80aa0eac645b662831 | refs/heads/master | 2020-04-10T10:12:38.467016 | 2016-05-09T11:47:33 | 2016-05-09T11:47:33 | 50,867,434 | 7 | 14 | null | null | null | null | UTF-8 | Java | false | false | 12,770 | java | package com.javarush.test.level34.lesson02.home01;
import java.util.ArrayList;
import java.util.List;
/* Рекурсия для мат.выражения
На вход подается строка - математическое выражение.
Выражение включает целые и дробные числа, скобки (), пробелы, знак отрицания -, возведение в степень ^, sin(x), cos(x), tan(x)
Для sin(x), cos(x), tan(x) выражение внутри скобок считать градусами, например, cos(3 + 19*3)=0.5
Степень задается так: a^(1+3) и так a^4, что эквивалентно a*a*a*a.
С помощью рекурсии вычислить выражение и количество математических операций. Вывести через пробел результат в консоль.
Результат выводить с точностью до двух знаков, для 0.33333 вывести 0.33, использовать стандартный принцип округления.
Не создавайте статические переменные и поля класса.
Не пишите косвенную рекурсию.
Пример, состоящий из операций sin * - + * +:
sin(2*(-5+1.5*4)+28)
Результат:
0.5 6
*/
public class Solution
{
public static void main(String[] args)
{
Solution solution = new Solution();
solution.recursion("sin(2*(-5+1.5*4)+28)", 0); //expected output 0.5 6
}
public void recursion(final String expression, int countOperation)
{
//нахождение позиций открывающих и закрывающих скобок подвыражения
boolean hasOpenBracketPos = false;
int openBracketPos = 0;
int closeBracketPos = 0;
for (int i = 0; i < expression.toCharArray().length; i++)
{
char c = expression.charAt(i);
if (c == '(' && hasOpenBracketPos)
{
openBracketPos = i;
} else if (c == '(')
{
openBracketPos = i;
hasOpenBracketPos = true;
}
if (c == ')')
{
closeBracketPos = i;
break;
}
}
// вычисление подвыражения:
String subExpression;
if (openBracketPos == 0 && closeBracketPos == 0)
{
subExpression = expression;
} else
{
subExpression = expression.substring(openBracketPos + 1, closeBracketPos);
}
subExpression = subExpression.replaceAll(" ", "");
//Создание списков операций и чисел
List<String> operations = new ArrayList<>();
List<String> numbers = new ArrayList<>();
String number = "";
boolean isOperationFirst = false;
for (int i = 0; i < subExpression.toCharArray().length; i++)
{
char c = subExpression.charAt(i);
if ((c >= '0' && c <= '9') || (c == '.'))
{
if (i < subExpression.toCharArray().length - 1)
{
number += c;
continue;
} else
{
number += c;
}
}
if (!number.equals(""))
{
numbers.add(number);
number = "";
}
if (c == '-' || c == '+' || c == '*' || c == '/' || c == '^')
{
if (i == 0)
{
isOperationFirst = true;
}
operations.add(String.valueOf(c));
}
}
int operationsAmount = operations.size();
//вычисление подвыражения:
double subExpressionResult = 0d;
while (operations.size() > 0)
{
//вычисление всех операций возведения в степень:
while (operations.contains("^"))
{
//вычисление одной операции возведения в степень:
int operationPos = 0;
int numberForInvolutePos = 0;
int involuteNumberPos = 0;
double numberForInvolute;
for (int i = 0; i < operations.size(); i++)
{
if (operations.get(i).equals("^"))
{
operationPos = i;
if (isOperationFirst)
{
numberForInvolutePos = i - 1;
involuteNumberPos = i;
numberForInvolute = Double.valueOf(numbers.get(i - 1));
subExpressionResult = numberForInvolute;
for (int j = 1; j < Double.valueOf(numbers.get(i)); j++)
{
subExpressionResult = subExpressionResult * numberForInvolute;
}
} else
{
numberForInvolutePos = i;
involuteNumberPos = i + 1;
numberForInvolute = Double.valueOf(numbers.get(i));
subExpressionResult = numberForInvolute;
for (int j = 1; j < Double.valueOf(numbers.get(i + 1)); j++)
{
subExpressionResult = subExpressionResult * numberForInvolute;
}
}
break;
}
}
operations.remove(operationPos);
numbers.remove(numberForInvolutePos);
numbers.remove(involuteNumberPos - 1);
if (isOperationFirst)
{
numbers.add(operationPos - 1, String.valueOf(subExpressionResult));
} else
{
numbers.add(operationPos, String.valueOf(subExpressionResult));
}
}
// вычисление всех операций умножения и деления:
while (operations.contains("*") || operations.contains("/"))
{
//вычисление одной операции умножения или деления:
int operationPos = 0;
int firstNumberPos = 0;
int secondNumberPos = 0;
for (int i = 0; i < operations.size(); i++)
{
String opChar = operations.get(i);
if (opChar.equals("*") || opChar.equals("/"))
{
operationPos = i;
if (isOperationFirst)
{
firstNumberPos = i - 1;
secondNumberPos = i;
} else
{
firstNumberPos = i;
secondNumberPos = i + 1;
}
double firstNumber = Double.valueOf(numbers.get(firstNumberPos));
double secondNumber = Double.valueOf(numbers.get(secondNumberPos));
if (opChar.equals("*"))
{
subExpressionResult = firstNumber * secondNumber;
} else if (opChar.equals("/"))
{
subExpressionResult = firstNumber / secondNumber;
}
break;
}
}
operations.remove(operationPos);
numbers.remove(firstNumberPos);
numbers.remove(secondNumberPos - 1);
if (isOperationFirst)
{
numbers.add(operationPos - 1, String.valueOf(subExpressionResult));
} else
{
numbers.add(operationPos, String.valueOf(subExpressionResult));
}
}
// вычисление всех операций сложения и вычитания:
subExpressionResult = 0d;
for (int i = 0; i < operations.size(); i++)
{
if (isOperationFirst && (i == 0))
{
subExpressionResult = Double.valueOf(operations.get(i) + numbers.get(i));
continue;
} else if (!isOperationFirst && (i == 0))
{
subExpressionResult = Double.valueOf(numbers.get(i));
}
String op = operations.get(i);
switch (op)
{
case "-":
if (isOperationFirst)
{
subExpressionResult -= Double.valueOf(numbers.get(i));
} else
{
subExpressionResult -= Double.valueOf(numbers.get(i + 1));
}
break;
case "+":
if (isOperationFirst)
{
subExpressionResult += Double.valueOf(numbers.get(i));
} else
{
subExpressionResult += Double.valueOf(numbers.get(i + 1));
}
break;
}
}
operations.clear();
}
// после вычисления подвыражения, проверка и вычисление синуса, косинуса или тангенса:
String trigoStr = null;
if (openBracketPos >= 3)
{
String symbolsBeforeOpenBracket = expression.substring(openBracketPos - 3, openBracketPos);
switch (symbolsBeforeOpenBracket)
{
case "sin":
subExpressionResult = Math.sin(Math.toRadians(subExpressionResult));
operationsAmount++;
trigoStr = "sin";
break;
case "cos":
subExpressionResult = Math.cos(Math.toRadians(subExpressionResult));
operationsAmount++;
trigoStr = "cos";
break;
case "tan":
subExpressionResult = Math.tan(Math.toRadians(subExpressionResult));
operationsAmount++;
trigoStr = "tan";
break;
default:
break;
}
subExpressionResult = Math.rint(100 * subExpressionResult) / 100.0;
}
//Конкатенация нового expression для рекурсии:
String newExpression;
if (expression.contains("+") || expression.contains("-") || expression.contains("*") ||
expression.contains("/") || expression.contains("^") || expression.contains("sin") ||
expression.contains("cos") || expression.contains("tan"))
{
if ((trigoStr != null) && (expression.substring(openBracketPos - 3, openBracketPos).equals(trigoStr))) {
newExpression = expression.substring(0, openBracketPos - 3) +
subExpressionResult +
(closeBracketPos == expression.length() - 1 ? "" : expression.substring(closeBracketPos + 1));
} else
{
if (openBracketPos == 0 && closeBracketPos == 0)
{
newExpression = String.valueOf(subExpressionResult);
} else
{
newExpression = expression.substring(0, openBracketPos) +
subExpressionResult +
(closeBracketPos == expression.length() - 1 ? "" : expression.substring(closeBracketPos + 1));
}
}
recursion(newExpression, countOperation + operationsAmount);
} else
{
System.out.println(expression + " " + (countOperation + operationsAmount));
}
//implement
}
public Solution()
{
//don't delete
}
}
| [
"[email protected]"
] | |
076e585b780b112dba8c748eabf88d53c94ae91d | c67561580329b8689f3f2febaf14e81090ea8ee3 | /com.dao.common/src/main/java/com/dao/common/persistence/interceptor/SQLHelper.java | 2fa22d5f92facdab8db8e72c4228052b2e53b3d0 | [] | no_license | dao2014/dynamic | 27d9e9272954fb2fb69ab3a83d160b51e787eee6 | 00cdb86fe6f457bf16d90874318a3fc2db17cce9 | refs/heads/master | 2021-01-10T12:46:03.065306 | 2016-04-02T23:49:00 | 2016-04-02T23:56:00 | 55,302,050 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,188 | java | /**
* Copyright © 2012-2014 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
*/
package com.dao.common.persistence.interceptor;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.ibatis.executor.ErrorContext;
import org.apache.ibatis.executor.ExecutorException;
import org.apache.ibatis.logging.Log;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.mapping.ParameterMapping;
import org.apache.ibatis.mapping.ParameterMode;
import org.apache.ibatis.reflection.MetaObject;
import org.apache.ibatis.reflection.property.PropertyTokenizer;
import org.apache.ibatis.scripting.xmltags.ForEachSqlNode;
import org.apache.ibatis.session.Configuration;
import org.apache.ibatis.type.TypeHandler;
import org.apache.ibatis.type.TypeHandlerRegistry;
import com.dao.common.config.Global;
import com.dao.common.persistence.Page;
import com.dao.common.persistence.dialect.Dialect;
import com.dao.common.utils.Reflections;
import com.dao.common.utils.StringUtils;
/**
* SQL工具类
* @author poplar.yfyang / thinkgem
* @version 2013-8-28
*/
public class SQLHelper {
/**
* 对SQL参数(?)设值,参考org.apache.ibatis.executor.parameter.DefaultParameterHandler
*
* @param ps 表示预编译的 SQL 语句的对象。
* @param mappedStatement MappedStatement
* @param boundSql SQL
* @param parameterObject 参数对象
* @throws java.sql.SQLException 数据库异常
*/
@SuppressWarnings("unchecked")
public static void setParameters(PreparedStatement ps, MappedStatement mappedStatement, BoundSql boundSql, Object parameterObject) throws SQLException {
ErrorContext.instance().activity("setting parameters").object(mappedStatement.getParameterMap().getId());
List<ParameterMapping> parameterMappings = boundSql.getParameterMappings();
if (parameterMappings != null) {
Configuration configuration = mappedStatement.getConfiguration();
TypeHandlerRegistry typeHandlerRegistry = configuration.getTypeHandlerRegistry();
MetaObject metaObject = parameterObject == null ? null :
configuration.newMetaObject(parameterObject);
for (int i = 0; i < parameterMappings.size(); i++) {
ParameterMapping parameterMapping = parameterMappings.get(i);
if (parameterMapping.getMode() != ParameterMode.OUT) {
Object value;
String propertyName = parameterMapping.getProperty();
PropertyTokenizer prop = new PropertyTokenizer(propertyName);
if (parameterObject == null) {
value = null;
} else if (typeHandlerRegistry.hasTypeHandler(parameterObject.getClass())) {
value = parameterObject;
} else if (boundSql.hasAdditionalParameter(propertyName)) {
value = boundSql.getAdditionalParameter(propertyName);
} else if (propertyName.startsWith(ForEachSqlNode.ITEM_PREFIX) && boundSql.hasAdditionalParameter(prop.getName())) {
value = boundSql.getAdditionalParameter(prop.getName());
if (value != null) {
value = configuration.newMetaObject(value).getValue(propertyName.substring(prop.getName().length()));
}
} else {
value = metaObject == null ? null : metaObject.getValue(propertyName);
}
@SuppressWarnings("rawtypes")
TypeHandler typeHandler = parameterMapping.getTypeHandler();
if (typeHandler == null) {
throw new ExecutorException("There was no TypeHandler found for parameter " + propertyName + " of statement " + mappedStatement.getId());
}
typeHandler.setParameter(ps, i + 1, value, parameterMapping.getJdbcType());
}
}
}
}
/**
* 查询总纪录数
* @param sql SQL语句
* @param connection 数据库连接
* @param mappedStatement mapped
* @param parameterObject 参数
* @param boundSql boundSql
* @return 总记录数
* @throws SQLException sql查询错误
*/
public static int getCount(final String sql, final Connection connection,
final MappedStatement mappedStatement, final Object parameterObject,
final BoundSql boundSql, Log log) throws SQLException {
String dbName = Global.getConfig("jdbc.type");
final String countSql;
if("oracle".equals(dbName)){
countSql = "select count(1) from (" + sql + ") tmp_count";
}else{
countSql = "select count(1) from (" + removeOrders(sql) + ") tmp_count";
// countSql = "select count(1) " + removeSelect(removeOrders(sql));
}
Connection conn = connection;
PreparedStatement ps = null;
ResultSet rs = null;
try {
if (log.isDebugEnabled()) {
log.debug("COUNT SQL: " + StringUtils.replaceEach(countSql, new String[]{"\n","\t"}, new String[]{" "," "}));
}
if (conn == null){
conn = mappedStatement.getConfiguration().getEnvironment().getDataSource().getConnection();
}
ps = conn.prepareStatement(countSql);
BoundSql countBS = new BoundSql(mappedStatement.getConfiguration(), countSql,
boundSql.getParameterMappings(), parameterObject);
//解决MyBatis 分页foreach 参数失效 start
if (Reflections.getFieldValue(boundSql, "metaParameters") != null) {
MetaObject mo = (MetaObject) Reflections.getFieldValue(boundSql, "metaParameters");
Reflections.setFieldValue(countBS, "metaParameters", mo);
}
//解决MyBatis 分页foreach 参数失效 end
SQLHelper.setParameters(ps, mappedStatement, countBS, parameterObject);
rs = ps.executeQuery();
int count = 0;
if (rs.next()) {
count = rs.getInt(1);
}
return count;
} finally {
if (rs != null) {
rs.close();
}
if (ps != null) {
ps.close();
}
if (conn != null) {
conn.close();
}
}
}
/**
* 根据数据库方言,生成特定的分页sql
* @param sql Mapper中的Sql语句
* @param page 分页对象
* @param dialect 方言类型
* @return 分页SQL
*/
public static String generatePageSql(String sql, Page<Object> page, Dialect dialect) {
if (dialect.supportsLimit()) {
return dialect.getLimitString(sql, page.getFirstResult(), page.getMaxResults());
} else {
return sql;
}
}
/**
* 去除qlString的select子句。
* @param hql
* @return
*/
@SuppressWarnings("unused")
private static String removeSelect(String qlString){
int beginPos = qlString.toLowerCase().indexOf("from");
return qlString.substring(beginPos);
}
/**
* 去除hql的orderBy子句。
* @param hql
* @return
*/
@SuppressWarnings("unused")
private static String removeOrders(String qlString) {
Pattern p = Pattern.compile("order\\s*by[\\w|\\W|\\s|\\S]*", Pattern.CASE_INSENSITIVE);
Matcher m = p.matcher(qlString);
StringBuffer sb = new StringBuffer();
while (m.find()) {
m.appendReplacement(sb, "");
}
m.appendTail(sb);
return sb.toString();
}
}
| [
"[email protected]"
] | |
e497d55387ddb1a9d50ade6a6ec3563d3ebff51d | 900fd99aa903b4c6017aba790452441543a72655 | /src/main/java/com/dong/reference/NormalReferenceTest.java | 630ac1eff6c1bbaf330bf507d8778454bf1ff4f1 | [] | no_license | dongliyang2018/java-guide | b9898d4219d06f29d964aeec400d455dfa7abee5 | 53514ac00c8bb245cb21641d7a967d2293334977 | refs/heads/master | 2023-04-08T11:42:37.887128 | 2021-04-25T12:32:33 | 2021-04-25T12:32:33 | 360,447,099 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 380 | java | package com.dong.reference;
import java.io.IOException;
/**
* 强引用测试
*/
public class NormalReferenceTest {
public static void main(String[] args) throws IOException {
//强引用,也就是普通的引用
M m = new M();
m = null;
//调用垃圾回收器
System.gc();
System.in.read();
}
}
| [
"[email protected]"
] | |
2571dfb54da5158e63daf86bc6bd80b97c576e69 | 0f2c008898c5cb261df1604181fd1e1bb0e59112 | /bi-webservice/src/main/java/com/chengfeng/kj/webservice/service/impl/EmployeesServiceImpl.java | d536a0a7be564a10a6ec43134743d9a80f61df74 | [] | no_license | konglingjuanyi/bi-webservice | 179e218c62a9b5e03f35c3205209e42377edf45c | aa3514017cfc5408e792f590d40e4821c2a1e0e9 | refs/heads/master | 2021-01-22T08:06:59.627743 | 2016-03-24T09:32:16 | 2016-03-24T09:32:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,787 | java | package com.chengfeng.kj.webservice.service.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import net.sf.json.JSONObject;
import org.apache.commons.httpclient.params.HttpMethodParams;
import org.springframework.stereotype.Service;
import com.chengfeng.kj.webservice.dao.IEmployeesDao;
import com.chengfeng.kj.webservice.domain.EmployeeVO;
import com.chengfeng.kj.webservice.service.IEmployeesService;
import com.thinkjf.service.ServiceException;
@Service("employeesService")
public class EmployeesServiceImpl implements IEmployeesService {
@Resource(name ="employeesDao")
private IEmployeesDao employeesDao;
@Override
public List<EmployeeVO> queryEmployee(Map<String, Object> searchMap) throws ServiceException {
return employeesDao.queryEmployee(searchMap);
}
@Override
public void doDeleteEmployeeBySend(Map<String, Object> searchMap)
throws ServiceException {
employeesDao.doDeleteEmployeeBySend(searchMap);
}
@Override
public List<EmployeeVO> queryUpdateEmployee(Map<String, Object> searchMap)
throws ServiceException {
return employeesDao.queryUpdateEmployee(searchMap);
}
@Override
public List<String> getBusinessParams(Map<String, Object> searchMap)
throws ServiceException {
List<EmployeeVO> list = employeesDao.queryUpdateEmployee(searchMap);
if(list.size()>0){
List<String> jsonlist = new ArrayList<String>();
for(int i=0;i<list.size();i++){
JSONObject jsonObj = new JSONObject();
jsonObj.put("EMPLOYEE_CODE", list.get(i).getEmployeeCode());
jsonObj.put("EMPLOYEE_NAME", list.get(i).getEmployeeName());
jsonObj.put("SITE_CODE", list.get(i).getOwnerSite()==null?"/":list.get(i).getOwnerSite());
if(list.get(i).getDeptName()!=null){
String[] dn = list.get(i).getDeptName().split("/");
if(dn.length>1){
jsonObj.put("DEPT_NAME", dn[0]);
jsonObj.put("JOB_NAME", dn[1]);
}else{
jsonObj.put("DEPT_NAME", dn[0]);
jsonObj.put("JOB_NAME", "员工");
}
}else{
jsonObj.put("DEPT_NAME", "/");
jsonObj.put("JOB_NAME", "员工");
}
jsonObj.put("PHONE_SMS", "/");
jsonObj.put("PHONE", "/");
jsonObj.put("PDA_PWD", list.get(i).getBarPassword()==null?"/":list.get(i).getBarPassword());
jsonObj.put("RD_STATUS", list.get(i).getOperFalg()==null?"":list.get(i).getOperFalg());
jsonObj.put("ALIPAY_NO", list.get(i).getAlipay()==null?"":list.get(i).getAlipay());
jsonObj.put("WECHAT_NO", "");
jsonObj.put("REAL_NAME_STATUS", list.get(i).getCheckState()==null?"":list.get(i).getCheckState());
jsonlist.add(jsonObj.toString());
}
return jsonlist;
}else{
return null;
}
}
}
| [
"[email protected]"
] | |
fb5f3390bc9b42fec4be39e9cd7d4bca9569955a | d50c58d75d315599db66b688be5844623fb318c5 | /src/main/java/com/lrm/handler/ControllerExceptionHandler.java | 44d1b5d099f6e788cd040889b5e8b6640f3f9d2a | [] | no_license | nczhweb/blog | 2f8c8480cb1739e27a5833b536002c5f5fcff293 | 4b2e9f8e14e7b124e6c967f3e09fd99eb3d2e9a3 | refs/heads/master | 2022-04-24T17:35:20.405143 | 2020-04-29T08:10:48 | 2020-04-29T08:10:48 | 259,863,438 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,125 | java | package com.lrm.handler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
@ControllerAdvice
public class ControllerExceptionHandler {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@ExceptionHandler(Exception.class)
public ModelAndView exceptionHander(HttpServletRequest request, Exception e) throws Exception {
logger.error("Requst URL : {},Exception : {}", request.getRequestURL(),e);
if (AnnotationUtils.findAnnotation(e.getClass(), ResponseStatus.class) != null) {
throw e;
}
ModelAndView mv = new ModelAndView();
mv.addObject("url",request.getRequestURL());
mv.addObject("exception", e);
mv.setViewName("error/error");
return mv;
}
}
| [
"[email protected]"
] | |
e5cfb5d01eb3d9200d6a06b31695e6a300c37ed1 | f4f47423d5f32b1ec3172636b612dca6028ab593 | /src/main/java/com/nutrymaco/tester/asserting/AssertResult.java | db79a69fdb5438d7004a0b319203cdb859f4fd04 | [] | no_license | Nutrymaco/tester | 4a6d79cc65dc5432865c9c0a811118f58c8c4ef0 | d9ccdf2ce9a6c8b0bd22a752137abd56717cd905 | refs/heads/master | 2023-05-01T22:44:27.446985 | 2021-04-29T09:40:38 | 2021-04-29T09:40:38 | 362,765,487 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 112 | java | package com.nutrymaco.tester.asserting;
public interface AssertResult<T> {
T expected();
T actual();
}
| [
"[email protected]"
] | |
aedc26727f5728a26dea313e5ed67efb7ec02839 | c2fbb40cbceadfcb2dba3754e04a26aa0db9ce28 | /GooglePlayMarket/app/src/main/java/com/example/yangzimu/googleplaymarket/sanguowushuang.java | 4b64765317afbfeb7f135dcc816367fe2f01349b | [] | no_license | TikennyS/GooglePlayMarket | b3462e30049283921f8778a56c19377a965b3608 | 5d11a3ab94300f3a3e7610a4585191ceb30f11ef | refs/heads/master | 2021-01-15T18:22:25.678326 | 2017-08-09T08:10:52 | 2017-08-09T08:10:52 | 99,782,066 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 794 | java | package com.example.yangzimu.googleplaymarket;
import android.os.Build;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.WindowManager;
/**
* Created by hmd on 2017/5/25.
*/
public class sanguowushuang extends AppCompatActivity{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sanguowushuang);
initWindow();
}
private void initWindow() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
//getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
}
}
}
| [
"[email protected]"
] | |
ea800891e22122e34600c48d9973ed94892aad51 | 0830bb00f9db32e8993cd0f96e0169c676048856 | /src/main/java/com/angkorteam/finance/faclient/SystemService.java | d90aeeb32f68b3305e62239840caf06aeb4f3f4d | [
"Apache-2.0"
] | permissive | PkayJava/FAClient | 0d92b48b900072d9f86a8a4696d5dfabc30c129e | 6a550dbeaa3b00d42abf574e794273bf7a6790ff | refs/heads/master | 2021-01-18T16:07:19.400322 | 2017-04-09T14:14:20 | 2017-04-09T14:14:20 | 86,714,562 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,300 | java | package com.angkorteam.finance.faclient;
import com.angkorteam.finance.faclient.dto.system.*;
import retrofit2.Call;
import retrofit2.http.*;
import java.util.List;
import java.util.Map;
/**
* Created by socheatkhauv on 3/31/17.
*/
public interface SystemService {
@POST("api/v1/authentication")
Call<Authentication> authentication(@Query(value = "username", encoded = true) String username, @Query(value = "password", encoded = true) String password);
@GET("api/v1/configurations")
Call<Map<String, List<Configuration>>> configurationList();
@GET("api/v1/configurations/{id}")
Call<Configuration> configurationRetrieve(@Path("id") long id);
@PUT("api/v1/configurations/{id}")
Call<ConfigurationUpdateResponse> configurationUpdate(@Path("id") long id, @Body ConfigurationUpdate configuration);
@GET("api/v1/hooks")
Call<List<Hook>> hookList();
@GET("api/v1/hooks/{id}")
Call<Hook> hookRetrieve(@Path("id") long id);
@POST("api/v1/hooks")
Call<HookCreateResponse> hookCreate(@Body HookCreate hook);
@PUT("api/v1/hooks/{id}")
Call<HookUpdateResponse> hookUpdate(@Path("id") long id, @Body HookUpdate hook);
@DELETE("api/v1/hooks/{id}")
Call<HookDeleteResponse> hookDelete(@Path("id") long id);
@GET("api/v1/accountnumberformats")
Call<List<AccountNumberFormat>> accountNumberFormatList();
@GET("api/v1/accountnumberformats/{id}")
Call<AccountNumberFormat> accountNumberFormatRetrieve(@Path("id") long id);
@POST("api/v1/accountnumberformats")
Call<AccountNumberFormatCreateResponse> accountNumberFormatCreate(@Body AccountNumberFormatCreate accountNumberFormat);
@PUT("api/v1/accountnumberformats/{id}")
Call<AccountNumberFormatUpdateResponse> accountNumberFormatUpdate(@Path("id") long id, @Body AccountNumberFormatUpdate accountNumberFormat);
@DELETE("api/v1/accountnumberformats/{id}")
Call<AccountNumberFormatDeleteResponse> accountNumberFormatDelete(@Path("id") long id);
@GET("api/v1/codes")
Call<List<Code>> codeList();
@POST("api/v1/codes")
Call<CodeCreateResponse> codeCreate(@Body CodeCreate code);
@GET("api/v1/codes/{id}")
Call<Code> codeRetrieve(@Path("id") long id);
@PUT("api/v1/codes/{id}")
Call<CodeUpdateResponse> codeUpdate(@Path("id") long id, @Body CodeUpdate code);
@DELETE("api/v1/codes/{id}")
Call<CodeDeleteResponse> codeDelete(@Path("id") long id);
@GET("api/v1/codes/{codeId}/codevalues")
Call<List<CodeValue>> codeValueList(@Path("codeId") long codeId);
@GET("api/v1/codes/{codeId}/codevalues/{valueId}")
Call<CodeValue> codeValueRetrieve(@Path("codeId") long codeId, @Path("valueId") long valueId);
@POST("api/v1/codes/{codeId}/codevalues")
Call<CodeValueCreateResponse> codeValueCreate(@Path("codeId") long codeId, @Body CodeValueCreate codeValue);
@PUT("api/v1/codes/{codeId}/codevalues/{valueId}")
Call<CodeValueUpdateResponse> codeValueUpdate(@Path("codeId") long codeId, @Path("valueId") long valueId, @Body CodeValueUpdate codeValue);
@DELETE("api/v1/codes/{codeId}/codevalues/{valueId}")
Call<CodeValueDeleteResponse> codeValueDelete(@Path("codeId") long codeId, @Path("valueId") long valueId);
@GET("api/v1/audits")
Call<List<Audit>> auditList();
@GET("api/v1/audits/{id}")
Call<Audit> auditRetrieve(@Path("id") long id);
@GET("api/v1/makercheckers")
Call<List<MakerChecker>> makerCheckerList();
@POST("api/v1/makercheckers/{id}?command=approve")
Call<MakerCheckerApproveResponse> makerCheckerApprove(@Path("id") long commandId);
@DELETE("api/v1/makercheckers/{id}")
Call<MakerCheckerDeleteResponse> makerCheckerDelete(@Path("id") long commandId);
@POST("api/v1/makercheckers/{id}?command=reject")
Call<MakerCheckerRejectResponse> makerCheckerReject(@Path("id") long commandId);
@GET("api/v1/offices")
Call<List<Office>> officeList();
@GET("api/v1/offices/{id}")
Call<Office> officeRetrieve(@Path("id") long id);
@POST("api/v1/offices")
Call<OfficeCreateResponse> officeCreate(@Body OfficeCreate office);
@PUT("api/v1/offices/{id}")
Call<OfficeUpdateResponse> officeUpdate(@Path("id") long id, @Body OfficeUpdate office);
@GET("api/v1/datatables/{registeredTableName}")
Call<DataTable> dataTableRetrieve(@Path("registeredTableName") String registeredTableName);
@GET("api/v1/datatables")
Call<List<DataTable>> dataTableList();
@GET("api/v1/datatables")
Call<List<DataTable>> dataTableList(@Query("apptable") String appTable);
@GET("api/v1/datatables/{apptable}/{officeId}?genericResultSet=true")
Call<DataTableGenericResultSetResponse> dataTableAppTableResultSet(@Path("apptable") String appTable, @Path("officeId") long officeId);
@POST("api/v1/datatables/{apptable}/{officeId}?genericResultSet=true")
Call<Map<String, Object>> dataTableAppTableResultSetCreate(@Path("apptable") String appTable, @Path("officeId") long officeId, @Body Map<String, Object> record);
@PUT("api/v1/datatables/{apptable}/{officeId}?genericResultSet=true")
Call<Map<String, Object>> dataTableAppTableResultSetUpdate(@Path("apptable") String appTable, @Path("officeId") long officeId, @Body Map<String, Object> record);
}
| [
"[email protected]"
] | |
23859afffcaba64d07bbf872d0235ec06ca1fc17 | df04e4fda50926156c3711b6ca0bfc109eb2321c | /src/com/utad/marcos/jorge/jmfweather/CCityDetailsPagerAdapter.java | ef1842c9738c7220c2b0cc563633d1574e6d3fa5 | [] | no_license | jmarcosf/JMFWeather | 32dc11df26651dfbc6e97f209827f50023c7c367 | 8db4cbc72b21d1dd2b6ddcf9b7eec964c4bb1a5c | refs/heads/master | 2020-05-17T03:48:33.249743 | 2014-01-16T16:18:14 | 2014-01-16T16:18:14 | null | 0 | 0 | null | null | null | null | WINDOWS-1250 | Java | false | false | 4,590 | java | /**************************************************************/
/* */
/* CCityDetailsPagerAdapter.java */
/* (c)2013 jmarcosf */
/* */
/* Description: CCityDetailsPagerAdapter Class */
/* JmfWeather Project */
/* Práctica asignatura Android Fundamental */
/* U-Tad - Master Apps */
/* www.u-tad.com */
/* */
/* Date: December 2013 */
/* */
/**************************************************************/
package com.utad.marcos.jorge.jmfweather;
import java.util.ArrayList;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
/**************************************************************/
/* */
/* */
/* */
/* CCityDetailsPagerAdapter Class */
/* */
/* */
/* */
/**************************************************************/
public class CCityDetailsPagerAdapter extends FragmentStatePagerAdapter
{
private ArrayList< Long > m_CityIdList;
/*********************************************************/
/* */
/* */
/* Constructors */
/* */
/* */
/*********************************************************/
/* */
/* CCityDetailsPagerAdapter.CCityDetailsPagerAdapter() */
/* */
/*********************************************************/
public CCityDetailsPagerAdapter( FragmentManager fragmentMgr, ArrayList< Long > CityIdList )
{
super( fragmentMgr );
this.m_CityIdList = CityIdList;
}
/*********************************************************/
/* */
/* */
/* FragmentStatePagerAdapter Override Methods */
/* */
/* */
/*********************************************************/
/* */
/* CCityDetailsPagerAdapter.getItem() */
/* */
/*********************************************************/
@Override
public Fragment getItem( int iPosition )
{
CCityDetailsFragment Fragment = new CCityDetailsFragment();
Bundle Params = new Bundle();
long CityId = m_CityIdList.get( iPosition ).longValue();
Params.putLong( CCityDetailsActivity.IDS_CITY_ID_PARAM, CityId );
Fragment.setArguments( Params );
return Fragment;
}
/*********************************************************/
/* */
/* CCityDetailsPagerAdapter.getCount() */
/* */
/*********************************************************/
@Override
public int getCount()
{
return m_CityIdList.size();
}
/*********************************************************/
/* */
/* CCityDetailsPagerAdapter.getItemPosition() */
/* */
/*********************************************************/
@Override
public int getItemPosition( Object item )
{
return POSITION_NONE;
}
}
| [
"[email protected]"
] | |
f44a5bdd8bdf385076106335f5851e85ec6a2971 | 7a2cb3103caf8a79a967fea7847c5878e13c70da | /srcTest/me/synology/iden1109/map/model/test/UIdTest.java | 4d69cc31a9fac70e8e4aa80752e9267c4290eb7b | [] | no_license | iden1109/ArtCulturalMap | 65f861948fac740a56d0d9a828431ffcb8ed57af | a3810397b638f507ae1f8881cd1c266ab9153631 | refs/heads/master | 2021-01-10T19:58:55.311208 | 2015-02-17T06:48:20 | 2015-02-17T06:48:20 | 21,231,151 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 707 | java | package me.synology.iden1109.map.model.test;
import static org.junit.Assert.*;
import junit.framework.Assert;
import me.synology.iden1109.map.model.UId;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
public class UIdTest {
private String table = "uid";
private String type = "cols";
private UId uid;
@Before
public void setUp() throws Exception {
//uid = new UId(table, type);
uid = UId.getInstance();
}
@After
public void tearDown() throws Exception {
}
@Test
public void testGetId() {
Assert.assertEquals("00001", uid.getId("test"));
Assert.assertEquals("00001", uid.getId("test"));
Assert.assertEquals("test", uid.getName("00001"));
}
}
| [
"[email protected]"
] | |
49eec09e0a2644f80802328c36cd353c0d3f5817 | 0ece71a840c9806bf06f57170cfebeac76f976d8 | /MyCameraApps/MyCamera3/paracamera/src/main/java/com/mindorks/paracamera/Utils.java | 922add496ac2b5d2fac7449853b8857b5ea5ca1a | [] | no_license | hoyyang/AndroidLearning | 7bb30b07f2b30eb183ecbfaac33aff4999059ae1 | be6591b630633ac2973dc074fc432c468ea6a2fd | refs/heads/master | 2022-12-24T09:17:10.702668 | 2020-10-01T06:42:58 | 2020-10-01T06:42:58 | 294,613,372 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,140 | java | package com.mindorks.paracamera;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.media.ExifInterface;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
/**
* Created by janisharali on 28/07/16.
*/
public class Utils {
private static final String TAG = "Utils";
/**
* @param context
* @param dirName
* @param fileName
* @param fileType
* @return
*/
public static File createImageFile(
Context context,
String dirName,
String fileName,
String fileType) {
try {
File file = createDir(context, dirName);
File image = new File(file.getAbsoluteFile() + File.separator + fileName + fileType);
if (!image.getParentFile().exists()) {
image.getParentFile().mkdirs();
}
image.createNewFile();
return image;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* @param context
* @param dirName
* @return
*/
public static File createDir(Context context, String dirName) {
File file = new File(context.getFilesDir() + File.separator + dirName);
if (!file.exists()) {
file.mkdir();
}
return file;
}
/**
* @param file
* @param requiredHeight
* @return
*/
public static Bitmap decodeFile(File file, int requiredHeight) {
try {
// Decode image size
BitmapFactory.Options o = new BitmapFactory.Options();
o.inJustDecodeBounds = true;
BitmapFactory.decodeStream(new FileInputStream(file), null, o);
// Find the correct scale value. It should be the power of 2.
int scale = 1;
while (o.outWidth / scale / 2 >= requiredHeight &&
o.outHeight / scale / 2 >= requiredHeight) {
scale *= 2;
}
// Decode with inSampleSize
BitmapFactory.Options o2 = new BitmapFactory.Options();
o2.inSampleSize = scale;
return BitmapFactory.decodeStream(new FileInputStream(file), null, o2);
} catch (FileNotFoundException e) {
e.printStackTrace();
return null;
}
}
/**
* @param bitmap
* @param filePath
* @param imageType
* @param compression
*/
public static void saveBitmap(Bitmap bitmap, String filePath, String imageType, int compression) {
FileOutputStream out = null;
try {
out = new FileOutputStream(filePath);
// PNG is a loss less format, the compression factor (100) is ignored
switch (imageType) {
case "png":
case "PNG":
case ".png":
bitmap.compress(Bitmap.CompressFormat.PNG, compression, out);
break;
case "jpg":
case "JPG":
case ".jpg":
case "jpeg":
case "JPEG":
case ".jpeg":
bitmap.compress(Bitmap.CompressFormat.JPEG, compression, out);
break;
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (out != null) {
out.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
/**
* @param imagePath
* @return
*/
public static int getImageRotation(String imagePath) {
try {
File imageFile = new File(imagePath);
if (imageFile.exists()) {
ExifInterface exif = new ExifInterface(imageFile.getPath());
int rotation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
return exifToDegrees(rotation);
}
} catch (Exception e) {
e.printStackTrace();
}
return 0;
}
/**
* @param src
* @param rotation
* @return
*/
public static Bitmap rotateBitmap(Bitmap src, int rotation) {
Matrix matrix = new Matrix();
if (rotation != 0) {
matrix.preRotate(rotation);
return Bitmap.createBitmap(src, 0, 0, src.getWidth(), src.getHeight(), matrix, true);
}
return src;
}
/**
* @param exifOrientation
* @return
*/
private static int exifToDegrees(int exifOrientation) {
if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_90) {
return 90;
} else if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_180) {
return 180;
} else if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_270) {
return 270;
}
return 0;
}
}
| [
"[email protected]"
] | |
32811c427caa9065484c12edad8f6f437b304b4e | d9a3d8299c93bb88e274290893ed8f95c9dd9762 | /Camera223/app/src/main/java/jp/ohwada/android/camera223/ui/CameraSourcePreview.java | d6966d68ebea09b2be2e6290ee8959adbd557d83 | [] | no_license | lzzkdxc/Android_Samples | 67d11ca20b06ee7edeea3e4480049693f3795aad | 2c6649fef782f926a1a187d4500805c70b8c316d | refs/heads/master | 2020-12-14T00:19:21.916364 | 2020-01-16T04:24:37 | 2020-01-16T04:24:37 | 234,574,842 | 1 | 0 | null | 2020-01-17T15:17:49 | 2020-01-17T15:17:49 | null | UTF-8 | Java | false | false | 6,163 | java | /**
* Camera2 Sample
* CameraSourcePreview
* 2019-08-01 K.OHWADA
*/
package jp.ohwada.android.camera223.ui;
import android.content.Context;
import android.graphics.Point;
import android.graphics.SurfaceTexture;
import android.util.AttributeSet;
import android.util.Log;
import android.util.Size;
import android.view.Display;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.TextureView;
import android.view.ViewGroup;
import android.view.WindowManager;
import java.io.IOException;
import jp.ohwada.android.camera223.util.Camera2Source ;
import jp.ohwada.android.camera223.util.DisplayUtil ;
import jp.ohwada.android.camera223.R ;
/**
* class CameraSourcePreview
* original : https://github.com/EzequielAdrianM/Camera2Vision
*/
public class CameraSourcePreview extends ViewGroup {
// debug
private final static boolean D = true;
private final static String TAG = "Camera2";
private final static String TAG_SUB = "CameraSourcePreview";
private final static boolean USE_TEXTURE_VIEW = true;
// dimen/linear_layout_control_height
private final static int LINEAR_LAYOUT_CONTROL_HEIGHT = 92;
private AutoFitTextureView mTextureView;
private SurfaceView mSurfaceView;
private boolean isTextureViewAvailable = false;
private boolean isSurfaceViewAvailable = false;
private boolean isStartRequested = false;
private Camera2Source mCamera2Source;
/**
* constractor
*/
public CameraSourcePreview(Context context) {
super(context);
initPreview(context);
}
/**
* constractor
*/
public CameraSourcePreview(Context context, AttributeSet attrs) {
super(context, attrs);
initPreview(context);
}
/**
* initPreview
*/
private void initPreview(Context context) {
isStartRequested = false;
isTextureViewAvailable = false;
isSurfaceViewAvailable = false;
if(USE_TEXTURE_VIEW ) {
mTextureView = new AutoFitTextureView(context);
addView(mTextureView);
mTextureView.setSurfaceTextureListener(mSurfaceTextureListener);
} else {
mSurfaceView = new SurfaceView(context);
addView(mSurfaceView);
mSurfaceView.getHolder().addCallback(mSurfaceViewListener);
}
} // initPreview
/**
* start
*/
public void start(Camera2Source camera2Source) {
log_d("start");
startCamera(camera2Source);
} // start
/**
* startCamera
*/
private void startCamera(Camera2Source camera2Source) {
log_d("startCamera");
if (camera2Source == null) {
log_d("camera2Source == null");
stop();
return;
}
mCamera2Source = camera2Source;
isStartRequested = true;
startIfReady();
} // startCamera
/**
* stop
*/
public void stop() {
isStartRequested = false;
if(mCamera2Source != null) {
mCamera2Source.stop();
}
} // stop
/**
* startIfReady
*/
private void startIfReady() {
log_d("startIfReady");
if (!isStartRequested) {
log_d("not isStartRequested");
return;
}
if (isSurfaceViewAvailable) {
mCamera2Source.start(mSurfaceView);
} else if (isTextureViewAvailable) {
mCamera2Source.start(mTextureView);
} else {
log_d("not ViewAvailable");
return;
}
} // startIfReady
/**
* onLayout
*/
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
log_d("onLayout");
int layoutWidth = right - left;
int layoutHeight = bottom - top;
int childWidth = layoutWidth;
int childHeight = layoutHeight - DisplayUtil.dpToPx(LINEAR_LAYOUT_CONTROL_HEIGHT);
for (int i = 0; i < getChildCount(); ++i) {getChildAt(i).layout(0, 0, childWidth, childHeight);
}
} // onLayout
/**
* write into logcat
*/
private void log_d( String msg ) {
if (D) Log.d( TAG, TAG_SUB + " " + msg );
} // log_d
/**
* TextureView.SurfaceTextureListener
*/
private final TextureView.SurfaceTextureListener mSurfaceTextureListener = new TextureView.SurfaceTextureListener() {
@Override
public void onSurfaceTextureAvailable(SurfaceTexture texture, int width, int height) {
log_d(" onSurfaceTextureAvailable");
isTextureViewAvailable = true;
// mOverlay.bringToFront();
startIfReady();
}
@Override
public void onSurfaceTextureSizeChanged(SurfaceTexture texture, int width, int height) {
log_d("onSurfaceTextureSizeChanged");
// nop
}
@Override
public boolean onSurfaceTextureDestroyed(SurfaceTexture texture) {
log_d("onSurfaceTextureDestroyed");
isTextureViewAvailable = false;
return true;
}
@Override
public void onSurfaceTextureUpdated(SurfaceTexture texture) {
//log_d("onSurfaceTextureUpdated");
// nop
}
}; // TextureView.SurfaceTextureListener
/**
* SurfaceHolder.Callback
*/
private final SurfaceHolder.Callback mSurfaceViewListener = new SurfaceHolder.Callback() {
@Override
public void surfaceCreated(SurfaceHolder surface) {
log_d( "surfaceCreated" );
isSurfaceViewAvailable = true;
startIfReady();
}
@Override
public void surfaceDestroyed(SurfaceHolder surface) {
log_d( " surfaceDestroyed" );
isSurfaceViewAvailable = false;
}
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
// log_d( "surfaceChanged" );
// nop
}
}; // SurfaceHolder.Callback
} // class CameraSourcePreview
| [
"[email protected]"
] | |
dd20d002e2e189058e60438f7ef1f183a0aca3a3 | e44eb8eb9d108fdc09b7e8799dccef9869f0746a | /bigballoon/src/main/java/com/util/codeGenerator/MapToBeanUtils.java | 86d0bacaf9624bb177c7e984f4c539fce749ca61 | [] | no_license | Mrhuangyi/xiaochengxuDemo | 38b20e5dfca388186581b029a31d6cb782ae58af | 57b13bb111356aae4660c4786d548b4bf4be23a6 | refs/heads/master | 2020-04-25T15:38:25.529529 | 2019-04-10T07:27:02 | 2019-04-10T07:27:02 | 172,885,279 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,633 | java | package com.util.codeGenerator;
import java.beans.BeanInfo;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
*
* @功能说明:List<Map>结果集转化为List<JavaBean>工具类,
* @去掉下划线,忽略大小写进行比较,例如ad_code可赋值给adCode属性
* @作者: herun
* @创建日期:2015-11-06
* @版本号:V1.0
*/
public class MapToBeanUtils<T> {
/**
* List<Map>数据转换为JavaBean数据
*
* @param maps
* @param beanClass
* @return
* @throws Exception
*/
public List<T> ListMapToJavaBean(List<Map> maps, Class<T> beanClass) throws Exception {
// 返回数据集合
List<T> list = new ArrayList<T>();
for (Map<String, Object> map : maps) {
T t = beanClass.newInstance();
BeanInfo beanInfo = Introspector.getBeanInfo(t.getClass());
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
for (PropertyDescriptor property : propertyDescriptors) {
String key = property.getName();// bean
for (String mapKey : map.keySet()) {
if (mapKey.replace("_", "").toLowerCase().equals(key.replace("_", "").toLowerCase())) {
Object value = map.get(mapKey);
Method setter = property.getWriteMethod();// 得到property对应的setter方法
Field[] fields = t.getClass().getDeclaredFields();
boolean v = false;
for (Field field : fields) {
String filedName = field.getName().replace("_", "").toLowerCase();
if (filedName.equals(key.replace("_", "").toLowerCase())) {
if (field.getType() == Integer.class || field.getType() == int.class) {
if (value != null) {
setter.invoke(t, Integer.parseInt(value.toString()));
}
} else if (field.getType() == Float.class || field.getType() == float.class) {
if (value != null) {
setter.invoke(t, Float.parseFloat(value.toString()));
}
} else if (field.getType() == Long.class || field.getType() == long.class) {
if (value != null) {
setter.invoke(t, Long.parseLong(value.toString()));
}
} else if (field.getType() == Double.class || field.getType() == double.class) {
if (value != null) {
setter.invoke(t, Double.parseDouble(value.toString()));
}
} else if (field.getType() == Short.class || field.getType() == short.class) {
if (value != null) {
setter.invoke(t, Short.parseShort(value.toString()));
}
} else if (field.getType() == String.class) {
if (value != null) {
setter.invoke(t, (Object) value.toString());
}
} else if (field.getType() == Date.class) {
if (value != null) {
if (value.getClass() == String.class) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
setter.invoke(t, format.parse(value.toString()));
} else {
setter.invoke(t, value);
}
}
} else if (field.getType() == Timestamp.class) {
if (value != null) {
setter.invoke(t, value);
}
} else {
// 其他类型
if (value != null) {
setter.invoke(t, value);
}
}
v = true;
continue;
}
}
if (v) {
continue;
}
}
}
}
list.add(t);
}
// 返回
return list;
}
}
| [
"[email protected]"
] | |
ac4cae75ecd9ab0204cd71d1131ef3ed67364075 | f344ce8caabb253842cc3bac9c2e27e0fdbc2e33 | /org.caltoopia.frontend/src/org/caltoopia/cli/CompilationError.java | 6bbf8e1c1c14d110eeec96bf097cc380a8de0920 | [] | no_license | Caltoopia/caltoopia | 1bc459e029445897b32b37d6d5385869df6d50fa | 7d58c77125f8d85f9a06cca6aeb4fd563ea72889 | refs/heads/master | 2021-01-23T22:39:04.902409 | 2013-12-10T12:30:57 | 2013-12-10T12:30:57 | 7,734,367 | 2 | 0 | null | 2013-05-13T11:29:56 | 2013-01-21T15:11:41 | Java | UTF-8 | Java | false | false | 1,883 | java | /*
* Copyright (c) Ericsson AB, 2013
* All rights reserved.
*
* License terms:
*
* Redistribution and use in source and binary forms,
* with or without modification, are permitted provided
* that the following conditions are met:
* * Redistributions of source code must retain the above
* copyright notice, this list of conditions and the
* following disclaimer.
* * 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.
* * Neither the name of the copyright holder nor the names
* of its contributors may be used to endorse or promote
* products derived from this software without specific
* prior written permission.
*
* 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 OWNER 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 org.caltoopia.cli;
public class CompilationError extends RuntimeException {
private static final long serialVersionUID = 1L;
public CompilationError(String message) {
super(message);
}
}
| [
"[email protected]"
] | |
521d046a7863943d185b5bae82f780bb1f3fdff5 | 4637b9ccf17ce5c4c532f452cffb633eb2fc86d6 | /src/jukebox/Song.java | 736d908ae8b1d8491d550044d131cb13dc22bc38 | [] | no_license | alexv1993/chap15-jukebox3 | dbca10c9ac9ddc88a50c69a0c7f963e68eecaf98 | 8cd55da97856d3d6fcd12bbae45b3556a22143c5 | refs/heads/master | 2021-06-27T17:53:40.083375 | 2017-09-12T18:23:44 | 2017-09-12T18:23:44 | 103,302,339 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 857 | java | package jukebox;
/**
* Created by vendin on 12.09.2017.
*/
public class Song implements Comparable<Song> {
String title;
String artist;
String rating;
String bpm;
public int compareTo(Song s) {
return title.compareTo(s.getTitle());
}
public Song(String title, String artist, String rating, String bpm) {
this.title = title;
this.artist = artist;
this.rating = rating;
this.bpm = bpm;
}
public String getTitle() {
return title;
}
public String getArtist() {
return artist;
}
public String getRating() {
return rating;
}
public String getBpm() {
return bpm;
}
@Override
public String toString() {
return "jukebox.Song{" +
"title='" + title + '\'' +
'}';
}
}
| [
"[email protected]"
] | |
9b65ddcf3e06891a208bbafa9064c5c49b62c1d8 | 44354dd5ef89ce5e271bd2efc644bbca1b97a474 | /app/src/test/java/com/example/abdel/robotsapp/ExampleUnitTest.java | 015619751aa9565037f297cfb003c972883ff75e | [] | no_license | abdelix/RobotsApp | 0d1b33aedf49b39097b7f10217b71ac784556562 | 91cd9453915fb3aec44f0bed5505dc445f46a264 | refs/heads/master | 2020-04-06T06:09:36.555451 | 2016-11-14T00:22:03 | 2016-11-14T00:22:03 | 73,652,152 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 405 | java | package com.example.abdel.robotsapp;
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() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
e56c67feb7bc05f2d4198dc1cdff18ac6800ba21 | 3f79e2bdb7e0059ff290e4ab4bd14003a43fe372 | /Daily/src/main/java/com/daily/vo/GoodsViewVO.java | 52970f65fcb2ae8e15a23b269159932af3475e5d | [] | no_license | hoon91/shop_pracitce | 5ba5c096215a74db64c69662fe5c32d6abc70ed9 | 3128e36cb2444c7d6d6c6a5d5cb3c09dff42426d | refs/heads/master | 2023-06-14T07:21:20.749930 | 2021-07-09T16:39:55 | 2021-07-09T16:39:55 | 384,495,881 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,833 | java | package com.daily.vo;
import java.util.Date;
public class GoodsViewVO {
private int gdsNum;
private String gdsName;
private String cateCode;
private int gdsPrice;
private int gdsStock;
private String gdsDes;
private String gdsImg;
private Date gdsDate;
private String cateCodeRef;
private String cateName;
private String gdsThumbImg;
public int getGdsNum() {
return gdsNum;
}
public void setGdsNum(int gdsNum) {
this.gdsNum = gdsNum;
}
public String getGdsName() {
return gdsName;
}
public void setGdsName(String gdsName) {
this.gdsName = gdsName;
}
public String getCateCode() {
return cateCode;
}
public void setCateCode(String cateCode) {
this.cateCode = cateCode;
}
public int getGdsPrice() {
return gdsPrice;
}
public void setGdsPrice(int gdsPrice) {
this.gdsPrice = gdsPrice;
}
public int getGdsStock() {
return gdsStock;
}
public void setGdsStock(int gdsStock) {
this.gdsStock = gdsStock;
}
public String getGdsDes() {
return gdsDes;
}
public void setGdsDes(String gdsDes) {
this.gdsDes = gdsDes;
}
public String getGdsImg() {
return gdsImg;
}
public void setGdsImg(String gdsImg) {
this.gdsImg = gdsImg;
}
public Date getGdsDate() {
return gdsDate;
}
public void setGdsDate(Date gdsDate) {
this.gdsDate = gdsDate;
}
public String getCateCodeRef() {
return cateCodeRef;
}
public void setCateCodeRef(String cateCodeRef) {
this.cateCodeRef = cateCodeRef;
}
public String getCateName() {
return cateName;
}
public void setCateName(String cateName) {
this.cateName = cateName;
}
public String getGdsThumbImg() {
return gdsThumbImg;
}
public void setGdsThumbImg(String gdsThumbImg) {
this.gdsThumbImg = gdsThumbImg;
}
}
| [
"[email protected]"
] | |
437f525cfac222f264bb8f557b7a763955a49c3e | 0830bbd0c94d1299277334c2aa4a48ef7d4f1b40 | /src/main/java/org/freedom/activity/EmployeeManagement/model/Employee.java | 87055674fd88603932f4d2a0ad23300a6c50a864 | [] | no_license | behimanshu/EmployeeManagement | 8b484734c1b0d6811c2be158ba2bb8fda494d93c | 6566be9be9a9e93d40b9b39320633b49008c0e18 | refs/heads/master | 2021-01-19T13:49:19.225484 | 2017-02-21T21:32:04 | 2017-02-21T21:32:04 | 82,420,644 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,306 | java | package org.freedom.activity.EmployeeManagement.model;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class Employee {
private int emp_id;
private String emp_lname;
private String emp_fname;
private String emp_email;
private double emp_phone;
private String emp_gender;
private int emp_age;
private int emp_YOJ;
private int dept_id;
public Employee() {
}
public Employee(int emp_id, String emp_lname, String emp_fname, String emp_email, double emp_phone,
String emp_gender, int emp_age, int emp_YOJ, int dept_id) {
super();
this.emp_id = emp_id;
this.emp_lname = emp_lname;
this.emp_fname = emp_fname;
this.emp_email = emp_email;
this.emp_phone = emp_phone;
this.emp_gender = emp_gender;
this.emp_age = emp_age;
this.emp_YOJ = emp_YOJ;
this.dept_id = dept_id;
}
public int getDept_id() {
return dept_id;
}
public void setDept_id(int dept_id) {
this.dept_id = dept_id;
}
public int getEmp_id() {
return emp_id;
}
public void setEmp_id(int emp_id) {
this.emp_id = emp_id;
}
public String getEmp_lname() {
return emp_lname;
}
public void setEmp_lname(String emp_lname) {
this.emp_lname = emp_lname;
}
public String getEmp_fname() {
return emp_fname;
}
public void setEmp_fname(String emp_fname) {
this.emp_fname = emp_fname;
}
public String getEmp_email() {
return emp_email;
}
public void setEmp_email(String emp_email) {
this.emp_email = emp_email;
}
public double getEmp_phone() {
return emp_phone;
}
public void setEmp_phone(double emp_phone) {
this.emp_phone = emp_phone;
}
public String getEmp_gender() {
return emp_gender;
}
public void setEmp_gender(String emp_gender) {
this.emp_gender = emp_gender;
}
public int getEmp_age() {
return emp_age;
}
public void setEmp_age(int emp_age) {
this.emp_age = emp_age;
}
public int getEmp_YOJ() {
return emp_YOJ;
}
public void setEmp_YOJ(int emp_YOJ) {
this.emp_YOJ = emp_YOJ;
}
@Override
public String toString() {
return "Employee [emp_id=" + emp_id + ", emp_lname=" + emp_lname + ", emp_fname=" + emp_fname + ", emp_email="
+ emp_email + ", emp_phone=" + emp_phone + ", emp_gender=" + emp_gender + ", emp_age=" + emp_age
+ ", emp_YOJ=" + emp_YOJ + ", dept_id=" + dept_id + "]";
}
}
| [
"[email protected]"
] | |
ad3f297c1ac15b603e0ff1315af485f89e456bf5 | 45e8f7ca8bbc939c3f39b006957951ff0e1fee27 | /src/com/bapop/dce/bo/FileUploadBean.java | c387f4ea6e6fa832e6530cebd3a4f06581dcb63b | [] | no_license | cristheinz/dce-reporting | 98338d9fdb15a10caa78535322f96f14ce68022d | 78bbbb6aa81c7541b0899df328676a91278740c0 | refs/heads/master | 2021-01-23T22:15:30.217992 | 2015-06-29T14:58:49 | 2015-06-29T14:58:49 | 14,205,897 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 513 | java | package com.bapop.dce.bo;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
public class FileUploadBean {
private CommonsMultipartFile file;
public CommonsMultipartFile getFile() {
return file;
}
public void setFile(CommonsMultipartFile file) {
this.file = file;
}
/*
private MultipartFile file;
public void setFile(MultipartFile file) {
this.file = file;
}
public MultipartFile getFile() {
return file;
}*/
}
| [
"[email protected]"
] | |
3bcc8d384f374954d7daf8fd90677e573cb5ca37 | d1c508ffdd6e696e52dc9368221ea7e0badeac69 | /StackViewEx/app/src/main/java/com/milenacabrera/stackviewex/MainActivity.java | 0622f853f5079199443a145e53b7afc6554a4fcf | [] | no_license | MissyM/Android-Projects | b712c3523d5c0ef50b9fe1a439b26eea4e601e38 | a7104cacdfcd22db6092157e87ce9ea4f905ab7a | refs/heads/master | 2021-01-21T20:59:34.737159 | 2017-08-11T12:22:47 | 2017-08-11T12:22:47 | 92,293,588 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,559 | java | package com.milenacabrera.stackviewex;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.StackView;
import java.util.LinkedList;
import java.util.List;
public class MainActivity extends AppCompatActivity {
StackView stackView;
List<Pelicula> peliculas;
Intent intent;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
stackView = (StackView) findViewById(R.id.stkImagenes);
cargarPeliculas();
AdapterStack adapter = new AdapterStack(this,R.layout.item,peliculas);
stackView.setAdapter(adapter);
}
public void cargarPeliculas(){
peliculas = new LinkedList<>();
peliculas.add(new Pelicula(R.string.civil_war,R.drawable.f1, R.string.civil_war_sinapsis, R.string.civil_war_reparto,R.string.civil_war_director));
peliculas.add(new Pelicula(R.string.deadpool,R.drawable.f2, R.string.deadpool_sinapsis, R.string.deadpool_reparto,R.string.deadpool_director));
peliculas.add(new Pelicula(R.string.buscando_a_dori,R.drawable.f3, R.string.buscando_a_dori_sinapsis, R.string.buscando_a_dori_reparto, R.string.buscando_a_dori_director));
peliculas.add(new Pelicula(R.string.doctor_strange,R.drawable.f4, R.string.doctor_strange_sinapsis, R.string.doctor_strange_reparto, R.string.doctor_strange_director));
}
}
| [
"[email protected]"
] | |
701e06f64c550b4637a116bc9c26a8b16beb3ae5 | af609418252a86a40d41c70809b2d932952d3859 | /user-edge-service/src/main/java/com/imooc/user/controller/UserController.java | f9cf98c8f885bd7652e33865a66495b8a61b059d | [] | no_license | yangbao/micro-service | 42f86fda4ec8834e5c581ebf40f0a334659017b8 | 3a948e7b8f0dde38b3b558b4ba76183a79fc0b65 | refs/heads/master | 2023-01-05T18:15:49.080267 | 2020-10-26T04:53:17 | 2020-10-26T04:53:17 | 306,609,480 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,235 | java | package com.imooc.user.controller;
import com.imooc.thrift.user.UserInfo;
import com.imooc.thrift.user.dto.UserDTO;
import com.imooc.user.redis.RedisClient;
import com.imooc.user.response.LoginResponse;
import com.imooc.user.response.Response;
import com.imooc.user.thrift.ServiceProvider;
import org.apache.commons.lang.StringUtils;
import org.apache.thrift.TException;
import org.apache.tomcat.util.buf.HexUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.security.MessageDigest;
import java.util.Random;
/**
* Created by Michael on 2017/10/30.
*/
@Controller
@RequestMapping("/user")
public class UserController {
private final ServiceProvider serviceProvider;
private final RedisClient redisClient;
public UserController(ServiceProvider serviceProvider,
RedisClient redisClient) {
this.serviceProvider = serviceProvider;
this.redisClient = redisClient;
}
@RequestMapping(value="/login", method = RequestMethod.GET)
public String login() {
return "login";
}
@RequestMapping(value="/login", method = RequestMethod.POST)
@ResponseBody
public Response login(@RequestParam("username")String username,
@RequestParam("password")String password) {
//1. 验证用户名密码
UserInfo userInfo = null;
try {
userInfo = serviceProvider.getUserService().getUserByName(username);
} catch (TException e) {
e.printStackTrace();
return Response.USERNAME_PASSWORD_INVALID;
}
if(userInfo==null) {
return Response.USERNAME_PASSWORD_INVALID;
}
if(!userInfo.getPassword().equalsIgnoreCase(md5(password))) {
return Response.USERNAME_PASSWORD_INVALID;
}
//2. 生成token
String token = genToken();
//3. 缓存用户
redisClient.set(token, toDTO(userInfo), 3600);
return new LoginResponse(token);
}
@RequestMapping(value = "/sendVerifyCode", method = RequestMethod.POST)
@ResponseBody
public Response sendVerifyCode(@RequestParam(value="mobile", required = false) String mobile,
@RequestParam(value="email", required = false) String email) {
String message = "Verify code is:";
String code = randomCode("0123456789", 6);
try {
boolean result = false;
if(StringUtils.isNotBlank(mobile)) {
result = serviceProvider.getMessasgeService().sendMobileMessage(mobile, message+code);
redisClient.set(mobile, code);
} else if(StringUtils.isNotBlank(email)) {
result = serviceProvider.getMessasgeService().sendEmailMessage(email, message+code);
redisClient.set(email, code);
} else {
return Response.MOBILE_OR_EMAIL_REQUIRED;
}
if(!result) {
return Response.SEND_VERIFYCODE_FAILED;
}
} catch (TException e) {
e.printStackTrace();
return Response.exception(e);
}
return Response.SUCCESS;
}
@RequestMapping(value="/register", method = RequestMethod.POST)
@ResponseBody
public Response register(@RequestParam("username") String username,
@RequestParam("password") String password,
@RequestParam(value="mobile", required = false) String mobile,
@RequestParam(value="email", required = false) String email,
@RequestParam("verifyCode") String verifyCode) {
if(StringUtils.isBlank(mobile) && StringUtils.isBlank(email)) {
return Response.MOBILE_OR_EMAIL_REQUIRED;
}
if(StringUtils.isNotBlank(mobile)) {
String redisCode = redisClient.get(mobile);
if(!verifyCode.equals(redisCode)) {
return Response.VERIFY_CODE_INVALID;
}
}else {
String redisCode = redisClient.get(email);
if(!verifyCode.equals(redisCode)) {
return Response.VERIFY_CODE_INVALID;
}
}
UserInfo userInfo = new UserInfo();
userInfo.setUsername(username);
userInfo.setPassword(md5(password));
userInfo.setMobile(mobile);
userInfo.setEmail(email);
try {
serviceProvider.getUserService().regiserUser(userInfo);
} catch (TException e) {
e.printStackTrace();
return Response.exception(e);
}
return Response.SUCCESS;
}
@RequestMapping(value="/authentication", method = RequestMethod.POST)
@ResponseBody
public UserDTO authentication(@RequestHeader("token") String token) {
return redisClient.get(token);
}
private UserDTO toDTO(UserInfo userInfo) {
UserDTO userDTO = new UserDTO();
BeanUtils.copyProperties(userInfo, userDTO);
return userDTO;
}
private String genToken() {
return randomCode("0123456789abcdefghijklmnopqrstuvwxyz", 32);
}
private String randomCode(String s, int size) {
StringBuilder result = new StringBuilder(size);
Random random = new Random();
for(int i=0;i<size;i++) {
int loc = random.nextInt(s.length());
result.append(s.charAt(loc));
}
return result.toString();
}
private String md5(String password) {
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
byte[] md5Bytes = md5.digest(password.getBytes("utf-8"));
return HexUtils.toHexString(md5Bytes);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}
| [
"[email protected]"
] | |
d99ba4762f4772ba97075ae025f539ae3d824e31 | 92f244ca104e260f35d4d9949c710a181ec25cee | /app/src/main/java/com/scanba/solidusandroid/api/SolidusInterface.java | 5f43a634e68ea448140e98bc98708be178825012 | [] | no_license | imufun/SolidusAndroid | 0a9a9108b068f2991739ba4486a13467dfd9fecb | fd4676234d5db2fdefc4f4d312a4316585109cce | refs/heads/master | 2021-01-19T14:24:02.300003 | 2017-04-11T18:40:18 | 2017-04-11T18:40:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,232 | java | package com.scanba.solidusandroid.api;
import com.scanba.solidusandroid.models.Order;
import com.scanba.solidusandroid.models.Product;
import com.scanba.solidusandroid.models.containers.ProductsContainer;
import com.scanba.solidusandroid.models.containers.StatesContainer;
import com.scanba.solidusandroid.models.containers.TaxonomiesContainer;
import com.scanba.solidusandroid.models.locale.State;
import com.scanba.solidusandroid.models.order.OrderLineItem;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Path;
import retrofit2.http.Query;
public interface SolidusInterface {
@GET("states")
Call<StatesContainer> getStates(@Query("country_id") int country_id, @Query("token") String token);
@GET("taxons/products")
Call<ProductsContainer> getProductsByTaxon(@Query("id") int id, @Query("page") int page, @Query("token") String token);
@GET("products")
Call<ProductsContainer> getProducts(@Query("page") int page, @Query("ids") String ids, @Query("token") String token);
@GET("products/{id}")
Call<Product> getProduct(@Path("id") int id, @Query("token") String token);
@GET("taxonomies")
Call<TaxonomiesContainer> getTaxonomies(@Query("token") String token);
@POST("orders")
Call<Order> createNewOrder(@Query("token") String token);
@GET("orders/{number}")
Call<Order> getOrder(@Path("number") String number, @Query("token") String token);
@POST("orders/{number}/line_items")
Call<OrderLineItem> addItemToOrder(@Path("number") String number,
@Query("line_item[variant_id]") int variantId,
@Query("line_item[quantity]") int quantity,
@Query("token") String token);
@PUT("orders/{number}")
Call<Order> updateOrderEmail(@Path("number") String number,
@Query("order[email]") String email,
@Query("token") String token);
@PUT("checkouts/{number}/next")
Call<Order> advanceOrderToNextStep(@Path("number") String number, @Query("token") String token);
}
| [
"[email protected]"
] | |
2cc819e1591c121c4051439dba8ab5017d027ac5 | 69c0753718afc42df65afef3ee790562ea3fa1a2 | /CodeEval/src/com/algorithms/BubbleSort.java | e6db99cc2d42f72dd5faff8023e1486a43ca163d | [] | no_license | Thundersoul/algo | 9de08f3bb67f8a96377f57fd6bbb3cf4bed94fde | f0f08952df8fbd464cdabe67018d55a7bc7b13e5 | refs/heads/master | 2021-01-02T23:07:08.203796 | 2015-04-15T15:53:17 | 2015-04-15T15:53:17 | 34,003,398 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 657 | java | /**
*
*/
package com.algorithms;
/**
* @author ACER
*
*/
public class BubbleSort {
/**
* @param args
*/
public static void main(String[] args) {
int arr[] = {4,1,3,7,9,2};
BubbleSort sort = new BubbleSort();
for(int i : sort.bubbleSort(arr)){
System.out.println(i);
}
}
public int[] bubbleSort(int[] unsortedArr){
for(int i=0; i < unsortedArr.length; i++){
for(int j=i ; j<unsortedArr.length; j++){
if (unsortedArr[i] > unsortedArr[j]){
int temp = unsortedArr[i];
unsortedArr[i] = unsortedArr[j];
unsortedArr[j] = temp;
}
}
}
return unsortedArr;
}
}
| [
"[email protected]"
] | |
088328185cbd90cf0ca00eb239f64802923ab7a8 | c911eaff3fa5122a5750316b40f9bb03818aae05 | /app/src/main/java/com/recsmeterreading/activities/ReportsActivity.java | d9e6fcc7adc4e4bf144b7e6c24eefc3c376fdcd7 | [] | no_license | anyemiuser/RECS_Meter_Mohini | 9a6a6333a60c70e59c902e8b3e9f66ed7ebd8aec | 9686ad57f40ba35806932917e37f209d32d173ca | refs/heads/master | 2020-07-27T23:17:42.220922 | 2019-09-23T09:19:00 | 2019-09-23T09:19:00 | 209,240,347 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,390 | java | package com.recsmeterreading.activities;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import com.recsmeterreading.R;
public class ReportsActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_reports);
findViewById(R.id.totalServicesLyt).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i = new Intent(getApplicationContext(),TotalServiceNoActivity.class);
startActivity(i);
}
});
findViewById(R.id.totalServicesBilledLyt).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i = new Intent(getApplicationContext(),BilledDetailsActivity.class);
startActivity(i);
}
});
findViewById(R.id.totalServicesUnbilledLyt).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i = new Intent(getApplicationContext(),UnBilledDetailsActivity.class);
startActivity(i);
}
});
}
}
| [
"[email protected]"
] | |
058d62645e07629068234c03484bcce18c7b3df6 | 1f19aec2ecfd756934898cf0ad2758ee18d9eca2 | /u-1/u-13/u-13-f2835.java | 51c21fb8a6c9b7e20343638005a1e11c528d752d | [] | no_license | apertureatf/perftest | f6c6e69efad59265197f43af5072aa7af8393a34 | 584257a0c1ada22e5486052c11395858a87b20d5 | refs/heads/master | 2020-06-07T17:52:51.172890 | 2019-06-21T18:53:01 | 2019-06-21T18:53:01 | 193,039,805 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 106 | java | mastercard 5555555555554444 4012888888881881 4222222222222 378282246310005 6011111111111117
3657107589510 | [
"[email protected]"
] | |
f986668054fe34e8c3f062c5d26a8f758cbbf908 | 97bb818886b79ddcde8685616183c685a24d6f42 | /aldenPark.week13.InClassAssignment/src/Salaried.java | 1a0f209d185a6705de657d53725c2b5c609d2185 | [] | no_license | aldenpark/CS1400 | 54a20402ef1ee5b49d5450f56d4f5eaf2653fb40 | 288902f992c2cfab1268ae7b751dd3f679a2278f | refs/heads/master | 2021-08-24T13:29:10.612227 | 2017-12-10T01:01:09 | 2017-12-10T01:01:09 | 107,609,508 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 561 | java | /**
* @filename: Salaried.java
* @author: Alden Park
* @date: 11/21/2017
* @description: Week 13 in Class Assignment
*/
/**
* This class implements a salaried employee
*/
public class Salaried extends Employee {
private double salary; // per year
public Salaried(String name, double salary)
{
super(name);
this.salary = salary;
} // end constructor
@Override
public double getPay()
{
return this.salary / 24; // per half month
} // end getPay
} // end class Salaried
| [
"[email protected]"
] | |
b8e2ea4e7bb2a654bdf5ec105baa06d4f66d89ca | 40283e09325e45266ec52ddfa9fbb9cfbaa3efb2 | /src/main/java/edu/uoregon/cs/p2presenter/server/authentication/LoginRequestHandler.java | ae3cf0091e8ba13b9c0cbc61e55de54211b77831 | [] | no_license | also/p2presenter-server | 3bb1dde5916d3d312e9d86adf3889b29532bdee1 | 398be12f1e98a705c873ac172a2379eb230a6c65 | refs/heads/master | 2021-06-03T05:04:16.477215 | 2008-12-18T08:06:40 | 2008-12-18T08:06:40 | 75,879 | 1 | 0 | null | 2019-10-21T21:34:35 | 2008-11-14T06:30:41 | JavaScript | UTF-8 | Java | false | false | 2,308 | java | package edu.uoregon.cs.p2presenter.server.authentication;
import org.springframework.security.Authentication;
import org.springframework.security.AuthenticationManager;
import org.springframework.security.context.SecurityContextHolder;
import org.springframework.security.context.SecurityContextImpl;
import org.springframework.security.providers.UsernamePasswordAuthenticationToken;
import com.ryanberdeen.postal.handler.RequestHandler;
import com.ryanberdeen.postal.handler.RequestMatcher;
import com.ryanberdeen.postal.message.IncomingRequestHeaders;
import com.ryanberdeen.postal.message.IncomingRequestMessage;
import com.ryanberdeen.postal.message.OutgoingResponseMessage;
/** Logs users in.
*
* <p>The handler stores the {@link Authentication} returned by the {@link AuthenticationManager}
* for the given <var>username</var> and <var>password</var>.</p>
*
* <p><strong>Expected message format:</strong></p>
* <pre><var>username</var><kbd>\n</kbd><var>password</var></pre>
*
* @author Ryan Berdeen
*
*/
public class LoginRequestHandler implements RequestHandler {
public static final RequestMatcher NOT_LOGIN_REQUEST_MATCHER = new RequestMatcher() {
public boolean match(IncomingRequestHeaders incomingRequestHeaders) {
return !"/login".equals(incomingRequestHeaders);
}
};
private AuthenticationManager authenticationManager;
/** Sets the {@link AuthenticationManager} used to verify credentials.
*/
public void setAuthenticationManager(AuthenticationManager authenticationManager) {
this.authenticationManager = authenticationManager;
}
public OutgoingResponseMessage handleRequest(IncomingRequestMessage request) throws Exception {
String[] usernamePassword = request.getContentAsString().split("(\r|\n|\r\n)");
UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(usernamePassword[0], usernamePassword[1]);
try {
Authentication authentication = authenticationManager.authenticate(token);
SecurityContextImpl securityContext = new SecurityContextImpl();
securityContext.setAuthentication(authentication);
SecurityContextHolder.setContext(securityContext);
return new OutgoingResponseMessage(request);
}
catch (Exception ex) {
return new OutgoingResponseMessage(request, 401, ex.getMessage());
}
}
}
| [
"[email protected]"
] | |
fa37632ec042e5e6e4f6d07e6f5938bdbea5b404 | a5d9df5cea88dac550eaa91d98c2298052f8d92c | /src/main/java/com/naive/toosimple/dao/AuthorDao.java | 157824269b503fc782c9c0dfd6dced2e918d47d0 | [] | no_license | KeanuAscent/springboot-mysql-jdbc | 77da9df120f6c3ad2cbd3b807c4e43e81f3f60f8 | 4e16f83a5d29be1d3803ad241c00785249754593 | refs/heads/master | 2020-04-14T10:51:15.738344 | 2019-01-02T12:43:16 | 2019-01-02T12:43:16 | 163,797,909 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 352 | java | package com.naive.toosimple.dao;
import com.naive.toosimple.domain.entity.Author;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface AuthorDao {
int add(Author author);
int update(Author author);
int delete(Long id);
Author findAuthor(Long id);
List<Author> findAuthorList();
}
| [
"[email protected]"
] | |
e20449605d6a0e23b7fe31acb5577445a7dcda11 | ce86968708eb23f88f34560a0694b59f6406f474 | /app/src/main/java/rp/com/birthdayinfo/View/Activities/ViewBirthday.java | 5e34a9d51eca9630d31156c9378927dc87de5bae | [] | no_license | RiccardoP87/BirthdayInfo | 94b77d188750711b11939e07d5fe2aa5845ff942 | d19bfc06979bae409a16b3b0eb03a737f4762e94 | refs/heads/master | 2021-01-23T21:43:17.901972 | 2017-09-08T20:45:22 | 2017-09-08T20:45:22 | 102,900,675 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,659 | java | package rp.com.birthdayinfo.View.Activities;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.graphics.drawable.ColorDrawable;
import android.os.Build;
import android.speech.tts.TextToSpeech;
import android.support.multidex.MultiDex;
import android.support.v4.view.MenuItemCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ImageButton;
import android.widget.Spinner;
import android.widget.TextView;
import com.andexert.library.RippleView;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import rp.com.birthdayinfo.Controller.AppController;
import rp.com.birthdayinfo.Controller.SharedUtilities;
import rp.com.birthdayinfo.Model.People;
import rp.com.birthdayinfo.R;
public class ViewBirthday extends AppCompatActivity {
private Toolbar toolbar;
private TextView year,month,week,day,hour,min,sec;
private RippleView next;
private String age;
private AppController app;
private String text;
private TextView t;
private String ages;
private String text2;
private ImageButton change;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE) {
setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
setContentView(R.layout.activity_view_birthday);
app = new AppController(getApplicationContext());
age = getIntent().getExtras().getString("Age");
toolbar = (Toolbar) findViewById(R.id.toolbar);
t = (TextView) findViewById(R.id.oroscopo);
text = getIntent().getExtras().getString("Name");
t.setText(getResources().getString(R.string.di)+" "
+text);
text2 = getIntent().getExtras().getString("Today");
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setBackgroundDrawable(new
ColorDrawable(getResources().getColor(R.color.bpRed)));
getSupportActionBar().setDisplayShowTitleEnabled(false);
if(Build.VERSION.SDK_INT >= 21) {
Window window = this.getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.setStatusBarColor(new
ColorDrawable(getResources().getColor(R.color.bpDarker_red)).getColor());
}else{}
year = (TextView)findViewById(R.id.textView12);
month = (TextView)findViewById(R.id.textViewM);
week = (TextView)findViewById(R.id.textViewS);
day = (TextView)findViewById(R.id.textViewG);
hour = (TextView)findViewById(R.id.textViewH);
min = (TextView)findViewById(R.id.textViewMM);
sec = (TextView)findViewById(R.id.textViewSEC);
next = (RippleView) findViewById(R.id.nextR);
year.setText(app.computeAge(age,text));
month.setText(app.computeM(age,text));
week.setText(app.computeW(age,text));
day.setText(app.computeD(age,text));
hour.setText(app.computeH(age,text));
min.setText(app.computeMin(age,text));
sec.setText(app.computeSec(age,text));
change = (ImageButton) findViewById(R.id.imageButton);
next.setOnRippleCompleteListener(new RippleView.OnRippleCompleteListener() {
@Override
public void onComplete(RippleView rippleView) {
Intent i = new Intent(ViewBirthday.this,BirthdayInfoActivity.class);
i.putExtra("Today",text2);
i.putExtra("Name",getIntent().getExtras().getString("Name"));
i.putExtra("Age",getIntent().getExtras().getString("Age"));
i.putExtra("LoveMOF",getIntent().getExtras().getBoolean("LoveMOF"));
startActivity(i);
}
});
change.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(ViewBirthday.this,ListPeopleActivity.class);
i.putExtra("Class",ViewBirthday.this.getClass().getSimpleName());
i.putExtra("Today",getIntent().getExtras().getString("Today"));
startActivity(i);
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu2, menu);
return true;
}
@Override
@Deprecated
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_about:
final Intent i = new Intent(ViewBirthday.this,AboutActivity.class);
i.putExtra("Today",text);
i.putExtra("Name",getIntent().getExtras().getString("Name"));
i.putExtra("Age",getIntent().getExtras().getString("Age"));
startActivity(i);
break;
case R.id.menu_other:
final Intent apps = new Intent(ViewBirthday.this,OtherApps.class);
apps.putExtra("Today",text);
apps.putExtra("Name",getIntent().getExtras().getString("Name"));
apps.putExtra("Age",getIntent().getExtras().getString("Age"));
startActivity(apps);
break;
case android.R.id.home:
Intent back = new Intent(getApplicationContext(), MainActivity.class);
back.putExtra("Today",text);
back.putExtra("Name",getIntent().getExtras().getString("Name"));
back.putExtra("Age",getIntent().getExtras().getString("Age"));
startActivity(back);
break;
default:
break;
}
return true;
}
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
| [
"[email protected]"
] | |
532cffbf72e05dcc2b7204b26123c6abafa11090 | ddd38972d2e73c464ee77024f6ba4d6e11aac97b | /agent/arcus-system/src/main/java/com/iris/agent/config/ConfigService.java | 4c80433b1a232a2af7693c29be9a4edab9bfb15b | [
"Apache-2.0"
] | permissive | arcus-smart-home/arcusplatform | bc5a3bde6dc4268b9aaf9082c75482e6599dfb16 | a2293efa1cd8e884e6bedbe9c51bf29832ba8652 | refs/heads/master | 2022-04-27T02:58:20.720270 | 2021-09-05T01:36:12 | 2021-09-05T01:36:12 | 168,190,985 | 104 | 50 | Apache-2.0 | 2022-03-10T01:33:34 | 2019-01-29T16:49:10 | Java | UTF-8 | Java | false | false | 16,301 | java | /*
* Copyright 2019 Arcus Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.iris.agent.config;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.TreeMap;
import java.util.UUID;
import org.eclipse.jdt.annotation.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.almworks.sqlite4java.SQLiteConnection;
import com.almworks.sqlite4java.SQLiteStatement;
import com.google.common.base.Supplier;
import com.iris.agent.db.Db;
import com.iris.agent.db.DbBinder;
import com.iris.agent.db.DbExtractor;
import com.iris.agent.db.DbService;
import com.iris.agent.db.DbUtils;
public final class ConfigService {
private static final Logger log = LoggerFactory.getLogger(ConfigService.class);
private static final Object START_LOCK = new Object();
private static final String CHECK_CONFIG_TABLE = "SELECT name FROM sqlite_master WHERE type='table' AND name='config'";
private static final String[] SCHEMA_SCRIPTS = {
"/sql/config.sql",
"/sql/update-config-1.sql",
};
private static boolean configStarted = false;
@SuppressWarnings("null")
private static Map<String,String> defaults;
private static final Map<String,ValueWithTime<String>> config = Collections.synchronizedMap(new HashMap<>());
private ConfigService() {
}
@SuppressWarnings("null")
private static boolean configTableExists(Db db) {
String name = db.query(CHECK_CONFIG_TABLE, new DbExtractor<String>() {
@Override
@Nullable
public String extract(SQLiteConnection conn, SQLiteStatement stmt) throws Exception {
return stmt.columnString(0);
}
});
return name != null;
}
public static void setupSchema(Db db) {
int curVersion = 0;
if(configTableExists(db)) {
curVersion = get(db, "schema", Integer.class, 0);
}
for(int i = curVersion; i < SCHEMA_SCRIPTS.length; i++) {
log.debug("executing sql script {}", SCHEMA_SCRIPTS[i]);
db.execute(ConfigService.class.getResource(SCHEMA_SCRIPTS[i]));
}
}
public static void start(Set<File> configs) {
synchronized (START_LOCK) {
if (configStarted) {
throw new IllegalStateException("configuration service already started");
}
// Read the default configuration
defaults = mergeProperties(configs);
// Run database initialization
setupSchema(DbService.get());
// Preload all config
try {
long start = System.nanoTime();
List<KeyValuePair> kvs = allWithTime();
for (KeyValuePair kv : kvs) {
config.putIfAbsent(kv.key, kv.value);
}
double elapsed = (System.nanoTime() - start) / 1000000000.0;
log.info("loaded {} configuration records in {}s", kvs.size(), String.format("%.3f", elapsed));
} catch (Exception ex) {
log.warn("failed to preload configuration:", ex);
}
}
}
public static void shutdown() {
synchronized (START_LOCK) {
config.clear();
}
}
private static Map<String,String> mergeProperties(Set<File> configs) {
Map<String,String> result = new HashMap<>();
for(File f : configs) {
result.putAll(loadProperties(f));
}
for (String key : System.getProperties().stringPropertyNames()) {
result.put(key, System.getProperty(key));
}
for (Map.Entry<String,String> entry : System.getenv().entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
if (key == null) continue;
String trimKey = key.trim();
if (trimKey.isEmpty()) continue;
result.put(trimKey, value);
String dottedKey = trimKey.replaceAll("_+", ".").toLowerCase();
result.put(dottedKey, value);
}
if (log.isDebugEnabled()) {
for (Map.Entry<String,String> entry : new TreeMap<>(result).entrySet()) {
log.debug("default configuration: {} -> {}", entry.getKey(), entry.getValue());
}
}
return result;
}
private static Map<String,String> loadProperties(File file) {
Properties properties = new Properties();
try(FileInputStream fis = new FileInputStream(file)) {
properties.load(fis);
} catch (IOException ex) {
log.warn("failed to load properties from configuratino file {}: {}", file, ex.getMessage(), ex);
}
Map<String,String> result = new HashMap<>();
for (String key : properties.stringPropertyNames()) {
result.put(key, properties.getProperty(key));
}
return result;
}
/////////////////////////////////////////////////////////////////////////////
// High-level support
/////////////////////////////////////////////////////////////////////////////
public static <T> void put(String key, @Nullable T value) {
put(key, value, System.currentTimeMillis(), Long.MIN_VALUE);
}
public static <T> void put(String key, @Nullable T value, long lastUpdateTime, long lastReportTime) {
String svalue = ConversionService.from(value);
ValueWithTime<String> vwt = new ValueWithTime<String>(svalue,lastUpdateTime,lastReportTime);
// write through cache
config.put(key, vwt);
put(DbService.get(), key, vwt);
}
@SuppressWarnings("null")
public static <T> T get(String key, Class<T> type) {
return ConversionService.to(type, get(key));
}
public static <T> T get(String key, Class<T> type, @Nullable T def) {
String value = get(key);
if (value == null) return def;
return ConversionService.to(type, value);
}
public static String get(String key) {
ValueWithTime<String> vwt = getWithTime(key);
String result = (vwt != null) ? vwt.value : null;
if (result == null) {
result = defaults.get(key);
}
return result;
}
public static <T> ValueWithTime<T> getWithTime(String key, Class<T> type) {
ValueWithTime<String> result = getWithTime(key);
if (result == null) return null;
return new ValueWithTime(ConversionService.to(type, result.value), result.lastUpdateTime, result.lastReportTime);
}
public static <T> ValueWithTime<T> getWithTime(String key, Class<T> type, @Nullable T def) {
ValueWithTime<T> result = getWithTime(key, type);
return (result == null) ? new ValueWithTime(def,Long.MIN_VALUE,Long.MIN_VALUE) : result;
}
public static ValueWithTime<String> getWithTime(String key) {
return config.get(key);
}
public static Supplier<String> supplier(String key) {
return supplier(key, null);
}
public static Supplier<String> supplier(String key, @Nullable String def) {
return supplier(key, String.class, def);
}
public static <T> Supplier<T> supplier(String key, Class<T> type, @Nullable T def) {
return new ConfigSupplier<T>(key, type, def);
}
public static Map<String,String> all() {
return all(true);
}
public static Map<String,String> all(boolean withDefaults) {
Map<String,String> result = new HashMap<>();
if (withDefaults) {
result.putAll(defaults);
}
List<KeyValue> all = DbService.get().queryAll("SELECT key,value FROM config", ConfigAllExtractor.INSTANCE);
for (KeyValue kv : all) {
result.put(kv.key, kv.value);
}
return result;
}
private static List<KeyValuePair> allWithTime() {
return DbService.get().queryAll("SELECT key,value,lastUpdateTime,lastReportTime FROM config", ConfigAllWithTimeExtractor.INSTANCE);
}
/////////////////////////////////////////////////////////////////////////////
// High-level support with custom db
/////////////////////////////////////////////////////////////////////////////
public static <T> void put(Db db, String key, @Nullable T value) {
put(db, key, value, System.currentTimeMillis(), Long.MIN_VALUE);
}
public static <T> void put(Db db, String key, @Nullable T value, long lastUpdateTime, long lastReportTime) {
String svalue = ConversionService.from(value);
put(db, key,new ValueWithTime<String>(svalue,lastUpdateTime,lastReportTime));
}
private static void put(Db db, String key, @Nullable ValueWithTime<String> value) {
KeyValuePair pair = new KeyValuePair(key,value);
db.execute("INSERT OR REPLACE INTO config (key,value,lastUpdateTime,lastReportTime) VALUES (?,?,?,?)", InsertBinder.INSTANCE, pair);
}
@SuppressWarnings("null")
public static <T> T get(Db db, String key, Class<T> type) {
return ConversionService.to(type, get(db,key));
}
@SuppressWarnings("null")
public static <T> T get(Db db, String key, Class<T> type, @Nullable T def) {
T result = get(db, key, type);
return (result == null) ? def : result;
}
@SuppressWarnings({"unused", "null" })
public static String get(Db db, String key) {
String result = db.query("SELECT value FROM config WHERE key=?", ConfigBinder.INSTANCE, key, ConfigExtractor.INSTANCE);
if (result == null) {
result = defaults.get(key);
}
return result;
}
@SuppressWarnings("null")
public static <T> ValueWithTime<T> getWithTime(Db db, String key, Class<T> type) {
ValueWithTime<String> result = getWithTime(db,key);
if (result == null) return null;
return new ValueWithTime(ConversionService.to(type, result.value), result.lastUpdateTime, result.lastReportTime);
}
@SuppressWarnings("null")
public static <T> ValueWithTime<T> getWithTime(Db db, String key, Class<T> type, @Nullable T def) {
ValueWithTime<T> result = getWithTime(db, key, type);
return (result == null) ? new ValueWithTime(def,Long.MIN_VALUE,Long.MIN_VALUE) : result;
}
@SuppressWarnings({"unused", "null" })
public static ValueWithTime<String> getWithTime(Db db, String key) {
ValueWithTime<String> result = db.query("SELECT value,lastUpdateTime,lastReportTime FROM config WHERE key=?", ConfigBinder.INSTANCE, key, ConfigExtractorWithTime.INSTANCE);
if (result == null) {
String def = defaults.get(key);
if (def != null) {
return new ValueWithTime(def, Long.MIN_VALUE, Long.MIN_VALUE);
}
}
return result;
}
/////////////////////////////////////////////////////////////////////////////
// Implementation details
/////////////////////////////////////////////////////////////////////////////
public static final class ValueWithTime<T> {
public final T value;
public final long lastUpdateTime;
public final long lastReportTime;
public ValueWithTime(T value, long lastUpdateTime, long lastReportTime) {
this.value = value;
this.lastUpdateTime = lastUpdateTime;
this.lastReportTime = lastReportTime;
}
}
private static final class ConfigSupplier<T> implements Supplier<T> {
private final String key;
private final Class<T> type;
private final @Nullable T defaultValue;
public ConfigSupplier(String key, Class<T> type, @Nullable T defaultValue) {
this.key = key;
this.type = type;
this.defaultValue = defaultValue;
}
@Override
public T get() {
return ConfigService.get(key, type, defaultValue);
}
}
private static final class KeyValuePair {
private final String key;
@Nullable
private final ValueWithTime<String> value;
private KeyValuePair(String key, @Nullable ValueWithTime<String> value) {
this.key = key;
this.value = value;
}
}
private static enum ConfigBinder implements DbBinder<String> {
INSTANCE;
@Override
public void bind(SQLiteConnection conn, SQLiteStatement stmt, String value) throws Exception {
stmt.bind(1, value);
}
}
private static enum InsertBinder implements DbBinder<KeyValuePair> {
INSTANCE;
@Override
public void bind(SQLiteConnection conn, SQLiteStatement stmt, KeyValuePair pair) throws Exception {
ValueWithTime<String> val = pair.value;
stmt.bind(1, pair.key);
DbUtils.bind(stmt, val == null ? null : val.value, 2);
stmt.bind(3, val == null ? Long.MIN_VALUE : val.lastUpdateTime);
stmt.bind(4, val == null ? Long.MIN_VALUE : val.lastReportTime);
}
}
private static enum ConfigExtractor implements DbExtractor<String> {
INSTANCE;
@Override
public String extract(SQLiteConnection conn, SQLiteStatement stmt) throws Exception {
return stmt.columnString(0);
}
}
private static enum ConfigExtractorWithTime implements DbExtractor<ValueWithTime<String>> {
INSTANCE;
@Override
public ValueWithTime<String> extract(SQLiteConnection conn, SQLiteStatement stmt) throws Exception {
return new ValueWithTime<String>(stmt.columnString(0), stmt.columnLong(1), stmt.columnLong(2));
}
}
private static final class KeyValue {
private final String key;
private final String value;
public KeyValue(String key, String value) {
this.key = key;
this.value = value;
}
}
private static enum ConfigAllExtractor implements DbExtractor<KeyValue> {
INSTANCE;
@Override
public KeyValue extract(SQLiteConnection conn, SQLiteStatement stmt) throws Exception {
String key = stmt.columnString(0);
String val = stmt.columnString(1);
return new KeyValue(key,val);
}
}
private static enum ConfigAllWithTimeExtractor implements DbExtractor<KeyValuePair> {
INSTANCE;
@Override
public KeyValuePair extract(SQLiteConnection conn, SQLiteStatement stmt) throws Exception {
String key = stmt.columnString(0);
String val = stmt.columnString(1);
Long lastUpdateTime = stmt.columnLong(2);
Long lastReportTime = stmt.columnLong(3);
ValueWithTime<String> vwt = new ValueWithTime(val, lastUpdateTime, lastReportTime);
return new KeyValuePair(key,vwt);
}
}
/**
* Puts any unknown object into the config.
* Works by figuring out if it matches a class that can be converted.
*
* Use long for date information.
*
* @param key
* @param obj
*/
public static void putObject(String key, @Nullable Object obj) {
if (obj == null ) {
put(key,null);
return;
}
Class<?> cls = obj.getClass();
if (cls.equals(Boolean.class) || cls.equals(boolean.class)) {
put(key,(Boolean) obj);
} else if (cls.equals(Byte.class) || cls.equals(byte.class)) {
put(key,(Byte) obj);
} else if (cls.equals(Short.class) || cls.equals(short.class)) {
put(key,(Short) obj);
} else if (cls.equals(Integer.class) || cls.equals(int.class)) {
put(key,(Integer) obj);
} else if (cls.equals(Long.class) || cls.equals(long.class)) {
put(key,(Long) obj);
} else if (cls.equals(Float.class) || cls.equals(float.class)) {
put(key,(Float) obj);
} else if (cls.equals(Double.class) || cls.equals(double.class)) {
put(key,(Double) obj);
} else if (cls.equals(String.class)) {
put(key,(String) obj);
} else if (cls.equals(UUID.class) ) {
put(key,(UUID) obj);
} else if (cls.equals(byte[].class) ) {
put(key,(byte[]) obj);
}
}
}
| [
"[email protected]"
] | |
07c333cb0e0933a759f5ee4328960b65d5b1b7b6 | ce8e8e8453be6c8de8799241e210eaee55668f9a | /knf-ofe-reporting-tools/src/main/java/pl/softech/knf/ofe/shared/Money.java | d8b0921dd0492b57544856067f3f2be5a176b80a | [] | no_license | ssledz/incubator | 09e541cbd5f473c72555c03a3a782d9f907299fe | 81025425e7202747ac75de7383e4616c67d8c42c | refs/heads/master | 2021-01-22T21:17:07.276309 | 2015-06-01T22:35:54 | 2015-06-01T22:35:54 | 33,742,742 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,675 | java | package pl.softech.knf.ofe.shared;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
/**
* @author Sławomir Śledź <[email protected]>
* @since 1.0
*/
public class Money {
private static final int DEFAULT_SCALE = 10000;
private final long value;
private final int scale;
public Money(long value, int scale) {
this.value = value;
this.scale = scale;
}
public Money(long value) {
this(value, DEFAULT_SCALE);
}
public Money(double value) {
this((long) (value * DEFAULT_SCALE), DEFAULT_SCALE);
}
public long getValue() {
return value;
}
public double getValueAsDouble() {
return (double) value / DEFAULT_SCALE;
}
public int getScale() {
return scale;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof Money)) {
return false;
}
Money money = (Money) o;
return new EqualsBuilder()
.append(value, money.value)
.append(scale, money.scale)
.isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37)
.append(value)
.append(scale)
.toHashCode();
}
@Override
public String toString() {
return new ToStringBuilder(this)
.append("value", value)
.append("scale", scale)
.toString();
}
}
| [
"[email protected]"
] | |
46f4a463989f2efae166dd0c1635ab456ef3dc2d | 08e43e0c3d03a1265f75f2fe59aebb294cd4b43a | /src/main/java/com/baidu/disconf/web/tools/JedisClusterFactory.java | d50e53f7b56399fc6b08d61f6d719b6663d90124 | [] | no_license | j5land/disconf-web-deploy | fba6e7a3e29300393e917fad7ac8c9b775b1b9ab | 610e370008e2ce067b4284ce2e7188f00fd6256d | refs/heads/master | 2020-12-24T20:33:05.005096 | 2016-05-20T05:28:13 | 2016-05-20T05:28:13 | 59,264,332 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,965 | java | package com.baidu.disconf.web.tools;
import java.io.File;
import java.io.FileInputStream;
import java.util.HashSet;
import java.util.Properties;
import java.util.Set;
import java.util.regex.Pattern;
import org.apache.log4j.Logger;
import redis.clients.jedis.BinaryJedisCluster;
import redis.clients.jedis.HostAndPort;
/**
* 集成spring的JedisClusterFactory<br/>
* jedis 集群实例获取工厂类,提供JedisCluster实例的获取
* @author vincent 2015-8-11
*
*/
public class JedisClusterFactory {
private static final Logger logger=Logger.getLogger(JedisClusterFactory.class);
private String addressConfig; //配置文件所在路径
private String addressKeyPrefix ; //配置文件中集群主机的key值前缀
private static BinaryJedisCluster binaryJedisCluster;
private Integer timeout=10000; //获取redis超时时间
private Integer maxRedirections=6; //最大重连次数
private Pattern p = Pattern.compile("^.+[:]\\d{1,5}\\s*$");
private static JedisClusterFactory instance;
public static JedisClusterFactory getInstance(){
if(instance==null){
instance=new JedisClusterFactory();
}
return instance;
}
private JedisClusterFactory(){
//单例
}
public static BinaryJedisCluster getBinaryJedisCluster() {
if(binaryJedisCluster==null){
logger.warn("binaryJedisCluster为空,无法使用jedis缓存");
// throw new NullPointerException("binaryJedisCluster为空,请先调用init方法进行初始化之后再获取redis集群实例");
}
return binaryJedisCluster;
}
/**
* 从配置文件中解析出集群主机的ip和端口
* @return
* @throws Exception
*/
private Set<HostAndPort> parseHostAndPort() throws Exception {
try {
Properties prop = new Properties();
prop.load(new FileInputStream(new File(addressConfig)));
Set<HostAndPort> haps = new HashSet<HostAndPort>();
for (Object key : prop.keySet()) {
if (!((String) key).startsWith(addressKeyPrefix)) {
continue;
}
String val = (String) prop.get(key);
boolean isIpPort = p.matcher(val).matches();
if (!isIpPort) {
throw new IllegalArgumentException("ip 或 port 不合法");
}
String[] ipAndPort = val.split(":");
HostAndPort hap = new HostAndPort(ipAndPort[0], Integer.parseInt(ipAndPort[1]));
haps.add(hap);
}
return haps;
} catch (IllegalArgumentException ex) {
throw ex;
} catch (Exception ex) {
throw new RuntimeException("解析 jedis 配置文件失败", ex);
}
}
public void init() {
Set<HostAndPort> haps;
try {
haps = this.parseHostAndPort();
logger.info("开始初始化redis……");
binaryJedisCluster = new BinaryJedisCluster(haps, timeout, maxRedirections);
} catch (Exception e) {
logger.error("binaryJedisCluster init exceptioni:",e);
}
logger.info("初始化redis完成……");
}
public void setAddressConfig(String addressConfig) {
this.addressConfig = addressConfig;
}
public void setTimeout(int timeout) {
if(timeout!=0){
this.timeout = timeout;
}
}
public void setMaxRedirections(int maxRedirections) {
if(maxRedirections!=0){
this.maxRedirections = maxRedirections;
}
}
public void setAddressKeyPrefix(String addressKeyPrefix) {
this.addressKeyPrefix = addressKeyPrefix;
}
} | [
"[email protected]"
] | |
d7089148b0813c63be2e793f50f228d6cab3f19a | 760203006dbb1532756d80e705db0a23c679a8e3 | /QLD/src/BangDiem/frmTinhDiem.java | 5fd87de010bac051a513a76fba5047490d2da00e | [] | no_license | Honghm/QLDiemSinhVien | 274cbb33e4b440af9cd97f031489293199d43673 | 0a417ddcc4dbe0ae39dec41f640e09467b670a3d | refs/heads/master | 2023-02-21T01:04:54.764449 | 2021-01-23T05:19:01 | 2021-01-23T05:19:01 | 332,133,585 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,363 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package BangDiem;
import LopHoc.ILopHocDAO;
import LopHoc.LopHoc;
import SinhVien.ISinhVienDAO;
import SinhVien.SinhVien;
//import com.sun.org.apache.bcel.internal.generic.ARRAYLENGTH;
import java.util.ArrayList;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.DefaultComboBoxModel;
import javax.swing.DefaultListModel;
import javax.swing.table.DefaultTableModel;
/**
*
* @author duong
*/
public class frmTinhDiem extends javax.swing.JPanel {
private DefaultTableModel dtm;
private DefaultListModel dlm;
private DefaultComboBoxModel dcbmMasv;
private DefaultComboBoxModel dcbmMamh;
ArrayList<BangDiem> listsv = null;
ArrayList<BangDiem> listmh = null;
public frmTinhDiem() {
initComponents();
dlm = new DefaultListModel();
dtm = new DefaultTableModel();
dcbmMamh = new DefaultComboBoxModel();
dcbmMasv = new DefaultComboBoxModel();
try {
//Load ma lop tai bang diem
IBangDiemDAO bangDiemDAO = (IBangDiemDAO) Class.forName("BangDiem.BangDiemDAO").newInstance();
listsv = bangDiemDAO.findMasv();
for (BangDiem bd : listsv) {
dcbmMasv.addElement(bd.getMasv());
}
jcbMasv.setModel(dcbmMasv);
dtm.addColumn("Lần Thi");
dtm.addColumn("Hệ Số");
dtm.addColumn("Điểm");
jtbtinhdiem.setModel(dtm);
} catch (ClassNotFoundException ex) {
Logger.getLogger(frmTinhDiem.class.getName()).log(Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
Logger.getLogger(frmTinhDiem.class.getName()).log(Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
Logger.getLogger(frmTinhDiem.class.getName()).log(Level.SEVERE, null, ex);
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jFormattedTextField1 = new javax.swing.JFormattedTextField();
jPanel1 = new javax.swing.JPanel();
jPanel2 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
jlMaMon = new javax.swing.JList();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jcbMasv = new javax.swing.JComboBox();
jPanel3 = new javax.swing.JPanel();
jScrollPane2 = new javax.swing.JScrollPane();
jtbtinhdiem = new javax.swing.JTable();
jtfDTB = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
jPanel4 = new javax.swing.JPanel();
jLabel4 = new javax.swing.JLabel();
jFormattedTextField1.setText("jFormattedTextField1");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 100, Short.MAX_VALUE)
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 100, Short.MAX_VALUE)
);
setBorder(javax.swing.BorderFactory.createTitledBorder(""));
jPanel2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 204)));
jlMaMon.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
jlMaMonValueChanged(evt);
}
});
jScrollPane1.setViewportView(jlMaMon);
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel1.setForeground(new java.awt.Color(255, 0, 0));
jLabel1.setText("Mã Sinh Viên");
jLabel2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel2.setForeground(new java.awt.Color(255, 0, 0));
jLabel2.setText("Mã Môn");
jcbMasv.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
jcbMasv.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jcbMasvActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(18, 18, 18)
.addComponent(jLabel1))
.addComponent(jcbMasv, javax.swing.GroupLayout.Alignment.TRAILING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(39, 39, 39)
.addComponent(jLabel2)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addGap(23, 23, 23)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jcbMasv, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 152, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel3.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 204)));
jPanel3.setForeground(new java.awt.Color(0, 0, 204));
jtbtinhdiem.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
) {
boolean[] canEdit = new boolean [] {
false, false, false, false
};
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
jScrollPane2.setViewportView(jtbtinhdiem);
jtfDTB.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jtfDTB.setForeground(new java.awt.Color(255, 0, 0));
jtfDTB.setDisabledTextColor(new java.awt.Color(0, 51, 255));
jtfDTB.setEnabled(false);
jLabel3.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel3.setForeground(new java.awt.Color(255, 0, 0));
jLabel3.setText("Điểm Trung Bình");
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 503, Short.MAX_VALUE)
.addContainerGap())
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(164, 164, 164)
.addComponent(jLabel3)
.addGap(18, 18, 18)
.addComponent(jtfDTB, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 208, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jtfDTB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3))
.addContainerGap(15, Short.MAX_VALUE))
);
jPanel4.setBackground(new java.awt.Color(0, 0, 255));
jLabel4.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
jLabel4.setForeground(new java.awt.Color(255, 255, 255));
jLabel4.setText("BẢNG ĐIỂM");
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
.addContainerGap(349, Short.MAX_VALUE)
.addComponent(jLabel4)
.addGap(377, 377, 377))
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jLabel4))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(53, 53, 53)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(148, Short.MAX_VALUE))
.addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(37, 37, 37)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(16, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
private void jcbMasvActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbMasvActionPerformed
try {
IBangDiemDAO diemDAO = (IBangDiemDAO) Class.forName("BangDiem.BangDiemDAO").newInstance();
listmh = diemDAO.findMaMH(listsv.get(jcbMasv.getSelectedIndex()).getMasv());
dlm.removeAllElements();
for (BangDiem bangDiem : listmh) {
dlm.addElement(bangDiem.getMamh());
}
jlMaMon.setModel(dlm);
} catch (ClassNotFoundException ex) {
Logger.getLogger(frmTinhDiem.class.getName()).log(Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
Logger.getLogger(frmTinhDiem.class.getName()).log(Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
Logger.getLogger(frmTinhDiem.class.getName()).log(Level.SEVERE, null, ex);
}
}//GEN-LAST:event_jcbMasvActionPerformed
private void jlMaMonValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_jlMaMonValueChanged
if (jlMaMon.getSelectedValue() != null) {
try {
while (dtm.getRowCount() > 0) {
dtm.removeRow(0);
}
String maSV = jcbMasv.getSelectedItem().toString();
String maMon = jlMaMon.getSelectedValue().toString();
IBangDiemDAO diemDAO = (IBangDiemDAO) Class.forName("BangDiem.BangDiemDAO").newInstance();
ArrayList<BangDiem> list = diemDAO.loaddiem(maSV, maMon);
float diemTB = 0;
int tongHS = 0;
for (int i = 0; i < list.size(); i++) {
Vector v = new Vector();
v.add(list.get(i).getLanthi());
v.add(list.get(i).getHeso());
v.add(list.get(i).getDiem());
tongHS += list.get(i).getHeso();
diemTB += list.get(i).getDiem() * list.get(i).getHeso();
dtm.addRow(v);
}
jtfDTB.setText((diemTB / tongHS) + "");
} catch (ClassNotFoundException ex) {
Logger.getLogger(frmTinhDiem.class.getName()).log(Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
Logger.getLogger(frmTinhDiem.class.getName()).log(Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
Logger.getLogger(frmTinhDiem.class.getName()).log(Level.SEVERE, null, ex);
}
}
}//GEN-LAST:event_jlMaMonValueChanged
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JFormattedTextField jFormattedTextField1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JComboBox jcbMasv;
private javax.swing.JList jlMaMon;
private javax.swing.JTable jtbtinhdiem;
private javax.swing.JTextField jtfDTB;
// End of variables declaration//GEN-END:variables
}
| [
"[email protected]"
] | |
5041b7eab794b547fc68837b68e359baf57e5ecf | 685e3097d073a5a948e26f15936897a126cfabdd | /SortArrayByParityII/Solution.java | 001db7eb0d9601e9a317af84f7b69e7e8a680f22 | [] | no_license | flyPisces/LeetCodeSolution | 2ae0b48c149bb1eb20c180647feaabd392120e4e | e4399fc8791491082934b634a60caa2a1e350fbd | refs/heads/master | 2021-01-10T22:36:23.241283 | 2020-08-22T07:01:38 | 2020-08-22T07:01:38 | 69,706,033 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 867 | java | package SortArrayByParityII;
/**
*
Given an array A of non-negative integers, half of the integers in A are odd, and half of the integers are even.
Sort the array so that whenever A[i] is odd, i is odd; and whenever A[i] is even, i is even.
You may return any answer array that satisfies this condition.
Example 1:
Input: [4,2,5,7]
Output: [4,5,2,7]
Explanation: [4,7,2,5], [2,5,4,7], [2,7,4,5] would also have been accepted.
*/
public class Solution {
public int[] sortArrayByParityII(int[] A) {
int j = 1;
for (int i = 0;i < A.length;i = i + 2) {
if (A[i] % 2 != 0) {
while (j < A.length && A[j] % 2 == 1) {
j = j + 2;
}
int temp = A[i];
A[i] = A[j];
A[j] = temp;
}
}
return A;
}
}
| [
"!Pat381mort686"
] | !Pat381mort686 |
fe0a4488c8b10dd8fadf341693f553b649111b7c | 4a2af19a17888717e90360070109074070f35d36 | /laboratorios/lab05/ejercicioEnLinea/Bicolor.java | d7563f1f2f7ad973c48b74294d8dabc2508ae39b | [] | no_license | pabloosoriom/ST0245-032 | ed5c3325e4a59242fd54579051c077f65cdc1da7 | bc1f78633a43412adcc23942dca70113d06d4790 | refs/heads/master | 2020-03-23T08:03:36.093550 | 2018-11-06T15:38:55 | 2018-11-06T15:38:55 | 141,305,935 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 364 | java |
/**
* Clase que para determinar cual es el valor de un nodo y su respectivo color
* color=1=> Blanco
* color=-1=> Negro
* @author Pablo Alberto Osorio Marualnda- Verónica Mendoza Iguarán
*/
public class Bicolor
{
int vertice;
int color;
public Bicolor(int vertice, int color){
this.vertice=vertice;
this.color=color;
}
}
| [
"[email protected]"
] | |
a53307c7287041e32b0dfda4a726569660684518 | 4443bd1dee8fbafd850f004c22691540c5f1b7f1 | /RecursionExample/src/test/java/test/RecursionExample/AppTest.java | 0bb3721b0a74c8bc31324234beaa3a3582dce496 | [] | no_license | dstanko/RecursiveGraph | 068fad2e5dc06befae191109a7a7a1205096823e | 9d41dd407407866780a828073925e3e8868245b3 | refs/heads/master | 2020-06-08T05:32:08.917612 | 2013-07-26T17:51:08 | 2013-07-26T17:51:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 649 | java | package test.RecursionExample;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
}
| [
"[email protected]"
] | |
2a2d2a564d65838062d339ee272ecbdb943d9cc6 | 89a8b2bb08981f340d8607d17cedb7377b3ea08d | /src/test/java/com/dataart/services/ConvertRdd2DFTest.java | 3fe44ce54c4e0db59878d6ac926ebab318e07f50 | [] | no_license | Jeka1978/sparktraining | 188fd6b55d29688d65483a8a7734931cd2265771 | dbf0c746cdb103bb2743512be45937095e3e90e3 | refs/heads/master | 2021-01-22T10:40:21.276653 | 2017-05-28T15:29:06 | 2017-05-28T15:29:06 | 92,651,508 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,802 | java | package com.dataart.services;
import com.dataart.conf.CommonConfig;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;
import org.apache.spark.sql.Dataset;
import org.apache.spark.sql.Row;
import org.apache.spark.sql.RowFactory;
import org.apache.spark.sql.SQLContext;
import org.apache.spark.sql.types.DataTypes;
import org.apache.spark.sql.types.StructField;
import org.apache.spark.sql.types.StructType;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
/**
* Created by Evegeny on 04/05/2017.
*/
@RunWith(SpringRunner.class)
@ContextConfiguration(classes = CommonConfig.class)
@ActiveProfiles("DEV")
public class ConvertRdd2DFTest {
@Autowired
private SQLContext sqlContext;
@Autowired
private JavaSparkContext sc;
@Test
public void test() throws Exception {
JavaRDD<String> rdd = sc.textFile("data/taxi_order.txt");
JavaRDD<Row> rowJavaRDD = rdd.map(line -> {
String[] split = line.split(" ");
return RowFactory.create(split[0], split[1], Integer.parseInt(split[2]));
});
StructType schema = DataTypes.createStructType(new StructField[]{
DataTypes.createStructField("id", DataTypes.StringType, false),
DataTypes.createStructField("city", DataTypes.StringType, false),
DataTypes.createStructField("km", DataTypes.IntegerType, false)});
Dataset<Row> dataFrame = sqlContext.createDataFrame(rowJavaRDD, schema);
dataFrame.show();
}
}
| [
"papakita2009"
] | papakita2009 |
32b145d0e8c298419cdd0845b8d9743b929a7eb9 | 1a92b52a3acdecd7cd62f31e7a1b1ebb0dd66d08 | /src/test/java/domain/Inventory.java | 32d0781faf59ea8c7f2f89d6c0da9a509cd79b7c | [] | no_license | alexandervanhecke/flatworm | 342fa6dd2c98590c3fd335efc6726ee05a431dc0 | b58973ee2faf139d88a15d2b211435df92828b84 | refs/heads/master | 2020-12-26T00:06:19.339145 | 2016-08-16T19:02:05 | 2016-08-16T19:02:05 | 65,845,087 | 0 | 0 | null | 2016-08-16T18:45:13 | 2016-08-16T18:45:13 | null | UTF-8 | Java | false | false | 1,182 | java | /*
* Created on Apr 5, 2005
*
* To change the template for this generated file go to Window>Preferences>Java>Code Generation>Code and
* Comments
*/
package domain;
/**
* @author e50633
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
public class Inventory {
private String sku;
private double price;
private int quantity;
private String description;
/**
* @return
*/
public String getDescription() {
return description;
}
/**
* @return
*/
public double getPrice() {
return price;
}
/**
* @return
*/
public int getQuantity() {
return quantity;
}
/**
* @return
*/
public String getSku() {
return sku;
}
/**
* @param string
*/
public void setDescription(String string) {
description = string;
}
/**
* @param d
*/
public void setPrice(double d) {
price = d;
}
/**
* @param i
*/
public void setQuantity(int i) {
quantity = i;
}
/**
* @param string
*/
public void setSku(String string) {
sku = string;
}
}
| [
"[email protected]"
] | |
243062deb3706a1f11444ae3a82a445b2af9af0e | eb56a13c91cbd829677f0eb3c48e6819a3f42ccf | /src/main/java/com/connor/hozon/bom/common/util/dict/DictCache.java | ccbd45ee90688d0fdeaaf0f0ebaa86f005eebd0e | [] | no_license | ztnice/Mybatis-generate | 26dcb5c156d97934630caf6d1493fb50238548c2 | 0c5d6f956959797573a3f3c8ef4d0300e413473b | refs/heads/baseOnNewStart | 2022-06-28T07:14:09.158517 | 2020-08-12T02:23:44 | 2020-08-12T02:23:44 | 141,215,757 | 0 | 0 | null | 2022-06-21T00:48:58 | 2018-07-17T01:44:20 | JavaScript | UTF-8 | Java | false | false | 2,712 | java | package com.connor.hozon.bom.common.util.dict;
import com.connor.hozon.bom.sys.entity.Dict;
import java.util.Collection;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
/*
* 类描述:数据字典操作类
* @auther linzf
* @create 2017/8/24 0024
*/
public class DictCache {
/**静态数据字典信息*/
private static Map<String,Map<String,Dict>> dictMap = new Hashtable<String,Map<String,Dict>>();
/**
* 获取数据字典
* @return Map
* */
public static Map<String, Map<String, Dict>> getDictMap() {
return dictMap;
}
/**
* 载入数据字典缓存
* @param list
* */
public static void load(List<Dict> list){
for(Dict d : list){
Map<String,Dict> map = dictMap.get(d.getType());
if(map == null){
map = new Hashtable<String,Dict>();
dictMap.put(d.getType(), map);
}
map.put(d.getCode(), d);
}
}
/**
* 重新载入数据字典缓存
* @param list
* */
public static void reload(List<Dict> list){
dictMap.clear();
load(list);
}
/**
* 获取数据字典
* @param type
* @return Collection<Dict>
* */
public static Collection<Dict> getDicts(String type){
Map<String, Dict> map = dictMap.get(type);
if(map!=null)
return map.values();
return null;
}
/**
* 获取数据字典
* @param type
* @param code
* @return Dict
* */
public static Dict getDict(String type, String code){
Map<String, Dict> map = dictMap.get(type);
if(map!=null)
return map.get(code);
return null;
}
/**
* 获取数据字典
* @param type
* @param value
* @return Dict
* */
public static Dict getDictByTypeAndValue(String type, String value){
Map<String, Dict> map = dictMap.get(type);
if(map!=null){
for(Dict dict : map.values()){
if(value != null && value.equals(dict.getValue())){
return dict;
}
else if(dict.getValue()==null){
return dict;
}
}
}
return null;
}
/**
* 获取数据字典值
* @param type
* @param code
* @return Dict
* */
public static String getDictValue(String type, String code){
Map<String, Dict> map = dictMap.get(type);
if(map!=null){
Dict dict = map.get(code);
if(dict!=null)
return dict.getValue();
}
return null;
}
}
| [
"[email protected]"
] | |
214665f7acd35425f6b50cb648cd515fcb5e3e7f | 52171c1989d3031c444e6561627bf4d64787895b | /libwebrtc/src/main/java/org/webrtc/PeerConnectionFactory.java | a12f2e1f344ed71a6664be31db1c59bde120745c | [] | no_license | jingchuanhu/AppRTCDemo | e103141d04179600cb40d4924e1018e85538e99b | 13904569d19e71745082ffc7c8177356b769a380 | refs/heads/master | 2020-03-10T04:33:15.478184 | 2018-04-12T04:53:54 | 2018-04-12T04:53:54 | 129,194,956 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 19,127 | java | /*
* Copyright 2013 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
package org.webrtc;
import android.content.Context;
import java.util.List;
/**
* Java wrapper for a C++ PeerConnectionFactoryInterface. Main entry point to
* the PeerConnection API for clients.
*/
@JNINamespace("webrtc::jni")
public class PeerConnectionFactory {
public static final String TRIAL_ENABLED = "Enabled";
@Deprecated public static final String VIDEO_FRAME_EMIT_TRIAL = "VideoFrameEmit";
private static final String TAG = "PeerConnectionFactory";
private static final String VIDEO_CAPTURER_THREAD_NAME = "VideoCapturerThread";
private final long nativeFactory;
private static volatile boolean internalTracerInitialized = false;
private static Context applicationContext;
private static Thread networkThread;
private static Thread workerThread;
private static Thread signalingThread;
private EglBase localEglbase;
private EglBase remoteEglbase;
public static class InitializationOptions {
final Context applicationContext;
final String fieldTrials;
final boolean enableInternalTracer;
final boolean enableVideoHwAcceleration;
final NativeLibraryLoader nativeLibraryLoader;
private InitializationOptions(Context applicationContext, String fieldTrials,
boolean enableInternalTracer, boolean enableVideoHwAcceleration,
NativeLibraryLoader nativeLibraryLoader) {
this.applicationContext = applicationContext;
this.fieldTrials = fieldTrials;
this.enableInternalTracer = enableInternalTracer;
this.enableVideoHwAcceleration = enableVideoHwAcceleration;
this.nativeLibraryLoader = nativeLibraryLoader;
}
public static Builder builder(Context applicationContext) {
return new Builder(applicationContext);
}
public static class Builder {
private final Context applicationContext;
private String fieldTrials = "";
private boolean enableInternalTracer = false;
private boolean enableVideoHwAcceleration = true;
private NativeLibraryLoader nativeLibraryLoader = new NativeLibrary.DefaultLoader();
Builder(Context applicationContext) {
this.applicationContext = applicationContext;
}
public Builder setFieldTrials(String fieldTrials) {
this.fieldTrials = fieldTrials;
return this;
}
public Builder setEnableInternalTracer(boolean enableInternalTracer) {
this.enableInternalTracer = enableInternalTracer;
return this;
}
public Builder setEnableVideoHwAcceleration(boolean enableVideoHwAcceleration) {
this.enableVideoHwAcceleration = enableVideoHwAcceleration;
return this;
}
public Builder setNativeLibraryLoader(NativeLibraryLoader nativeLibraryLoader) {
this.nativeLibraryLoader = nativeLibraryLoader;
return this;
}
public PeerConnectionFactory.InitializationOptions createInitializationOptions() {
return new PeerConnectionFactory.InitializationOptions(applicationContext, fieldTrials,
enableInternalTracer, enableVideoHwAcceleration, nativeLibraryLoader);
}
}
}
public static class Options {
// Keep in sync with webrtc/rtc_base/network.h!
//
// These bit fields are defined for |networkIgnoreMask| below.
static final int ADAPTER_TYPE_UNKNOWN = 0;
static final int ADAPTER_TYPE_ETHERNET = 1 << 0;
static final int ADAPTER_TYPE_WIFI = 1 << 1;
static final int ADAPTER_TYPE_CELLULAR = 1 << 2;
static final int ADAPTER_TYPE_VPN = 1 << 3;
static final int ADAPTER_TYPE_LOOPBACK = 1 << 4;
public int networkIgnoreMask;
public boolean disableEncryption;
public boolean disableNetworkMonitor;
@CalledByNative("Options")
int getNetworkIgnoreMask() {
return networkIgnoreMask;
}
@CalledByNative("Options")
boolean getDisableEncryption() {
return disableEncryption;
}
@CalledByNative("Options")
boolean getDisableNetworkMonitor() {
return disableNetworkMonitor;
}
}
public static class Builder {
private Options options;
private VideoEncoderFactory encoderFactory;
private VideoDecoderFactory decoderFactory;
private AudioProcessingFactory audioProcessingFactory;
private FecControllerFactoryFactoryInterface fecControllerFactoryFactory;
private Builder() {}
public Builder setOptions(Options options) {
this.options = options;
return this;
}
public Builder setVideoEncoderFactory(VideoEncoderFactory encoderFactory) {
this.encoderFactory = encoderFactory;
return this;
}
public Builder setVideoDecoderFactory(VideoDecoderFactory decoderFactory) {
this.decoderFactory = decoderFactory;
return this;
}
public Builder setAudioProcessingFactory(AudioProcessingFactory audioProcessingFactory) {
if (audioProcessingFactory == null) {
throw new NullPointerException(
"PeerConnectionFactory builder does not accept a null AudioProcessingFactory.");
}
this.audioProcessingFactory = audioProcessingFactory;
return this;
}
public Builder setFecControllerFactoryFactoryInterface(
FecControllerFactoryFactoryInterface fecControllerFactoryFactory) {
this.fecControllerFactoryFactory = fecControllerFactoryFactory;
return this;
}
public PeerConnectionFactory createPeerConnectionFactory() {
return new PeerConnectionFactory(options, encoderFactory, decoderFactory,
audioProcessingFactory, fecControllerFactoryFactory);
}
}
public static Builder builder() {
return new Builder();
}
/**
* Loads and initializes WebRTC. This must be called at least once before creating a
* PeerConnectionFactory. Replaces all the old initialization methods. Must not be called while
* a PeerConnectionFactory is alive.
*/
public static void initialize(InitializationOptions options) {
ContextUtils.initialize(options.applicationContext);
NativeLibrary.initialize(options.nativeLibraryLoader);
nativeInitializeAndroidGlobals(options.applicationContext, options.enableVideoHwAcceleration);
initializeFieldTrials(options.fieldTrials);
if (options.enableInternalTracer && !internalTracerInitialized) {
initializeInternalTracer();
}
}
private void checkInitializeHasBeenCalled() {
if (!NativeLibrary.isLoaded() || ContextUtils.getApplicationContext() == null) {
throw new IllegalStateException(
"PeerConnectionFactory.initialize was not called before creating a "
+ "PeerConnectionFactory.");
}
}
private static void initializeInternalTracer() {
internalTracerInitialized = true;
nativeInitializeInternalTracer();
}
public static void shutdownInternalTracer() {
internalTracerInitialized = false;
nativeShutdownInternalTracer();
}
// Field trial initialization. Must be called before PeerConnectionFactory
// is created.
// Deprecated, use PeerConnectionFactory.initialize instead.
@Deprecated
public static void initializeFieldTrials(String fieldTrialsInitString) {
nativeInitializeFieldTrials(fieldTrialsInitString);
}
// Wrapper of webrtc::field_trial::FindFullName. Develop the feature with default behaviour off.
// Example usage:
// if (PeerConnectionFactory.fieldTrialsFindFullName("WebRTCExperiment").equals("Enabled")) {
// method1();
// } else {
// method2();
// }
public static String fieldTrialsFindFullName(String name) {
return NativeLibrary.isLoaded() ? nativeFindFieldTrialsFullName(name) : "";
}
// Start/stop internal capturing of internal tracing.
public static boolean startInternalTracingCapture(String tracingFilename) {
return nativeStartInternalTracingCapture(tracingFilename);
}
public static void stopInternalTracingCapture() {
nativeStopInternalTracingCapture();
}
@Deprecated
public PeerConnectionFactory() {
this(null);
}
// Note: initializeAndroidGlobals must be called at least once before
// constructing a PeerConnectionFactory.
@Deprecated
public PeerConnectionFactory(Options options) {
this(options, null /* encoderFactory */, null /* decoderFactory */);
}
@Deprecated
public PeerConnectionFactory(
Options options, VideoEncoderFactory encoderFactory, VideoDecoderFactory decoderFactory) {
checkInitializeHasBeenCalled();
nativeFactory =
nativeCreatePeerConnectionFactory(options, encoderFactory, decoderFactory, 0, 0);
if (nativeFactory == 0) {
throw new RuntimeException("Failed to initialize PeerConnectionFactory!");
}
}
@Deprecated
public PeerConnectionFactory(Options options, VideoEncoderFactory encoderFactory,
VideoDecoderFactory decoderFactory, AudioProcessingFactory audioProcessingFactory) {
this(options, encoderFactory, decoderFactory, audioProcessingFactory,
null /* fecControllerFactoryFactory */);
}
private PeerConnectionFactory(Options options, VideoEncoderFactory encoderFactory,
VideoDecoderFactory decoderFactory, AudioProcessingFactory audioProcessingFactory,
FecControllerFactoryFactoryInterface fecControllerFactoryFactory) {
checkInitializeHasBeenCalled();
nativeFactory = nativeCreatePeerConnectionFactory(options, encoderFactory, decoderFactory,
audioProcessingFactory == null ? 0 : audioProcessingFactory.createNative(),
fecControllerFactoryFactory == null ? 0 : fecControllerFactoryFactory.createNative());
if (nativeFactory == 0) {
throw new RuntimeException("Failed to initialize PeerConnectionFactory!");
}
}
/**
* Deprecated. PeerConnection constraints are deprecated. Supply values in rtcConfig struct
* instead and use the method without constraints in the signature.
*/
@Deprecated
public PeerConnection createPeerConnection(PeerConnection.RTCConfiguration rtcConfig,
MediaConstraints constraints, PeerConnection.Observer observer) {
long nativeObserver = PeerConnection.createNativePeerConnectionObserver(observer);
if (nativeObserver == 0) {
return null;
}
long nativePeerConnection =
nativeCreatePeerConnection(nativeFactory, rtcConfig, constraints, nativeObserver);
if (nativePeerConnection == 0) {
return null;
}
return new PeerConnection(nativePeerConnection);
}
/**
* Deprecated. PeerConnection constraints are deprecated. Supply values in rtcConfig struct
* instead and use the method without constraints in the signature.
*/
@Deprecated
public PeerConnection createPeerConnection(List<PeerConnection.IceServer> iceServers,
MediaConstraints constraints, PeerConnection.Observer observer) {
PeerConnection.RTCConfiguration rtcConfig = new PeerConnection.RTCConfiguration(iceServers);
return createPeerConnection(rtcConfig, constraints, observer);
}
public PeerConnection createPeerConnection(
List<PeerConnection.IceServer> iceServers, PeerConnection.Observer observer) {
PeerConnection.RTCConfiguration rtcConfig = new PeerConnection.RTCConfiguration(iceServers);
return createPeerConnection(rtcConfig, observer);
}
public PeerConnection createPeerConnection(
PeerConnection.RTCConfiguration rtcConfig, PeerConnection.Observer observer) {
return createPeerConnection(rtcConfig, null /* constraints */, observer);
}
public MediaStream createLocalMediaStream(String label) {
return new MediaStream(nativeCreateLocalMediaStream(nativeFactory, label));
}
public VideoSource createVideoSource(VideoCapturer capturer) {
final EglBase.Context eglContext =
localEglbase == null ? null : localEglbase.getEglBaseContext();
final SurfaceTextureHelper surfaceTextureHelper =
SurfaceTextureHelper.create(VIDEO_CAPTURER_THREAD_NAME, eglContext);
long nativeAndroidVideoTrackSource =
nativeCreateVideoSource(nativeFactory, surfaceTextureHelper, capturer.isScreencast());
VideoCapturer.CapturerObserver capturerObserver =
new AndroidVideoTrackSourceObserver(nativeAndroidVideoTrackSource);
capturer.initialize(
surfaceTextureHelper, ContextUtils.getApplicationContext(), capturerObserver);
return new VideoSource(nativeAndroidVideoTrackSource);
}
public VideoTrack createVideoTrack(String id, VideoSource source) {
return new VideoTrack(nativeCreateVideoTrack(nativeFactory, id, source.nativeSource));
}
public AudioSource createAudioSource(MediaConstraints constraints) {
return new AudioSource(nativeCreateAudioSource(nativeFactory, constraints));
}
public AudioTrack createAudioTrack(String id, AudioSource source) {
return new AudioTrack(nativeCreateAudioTrack(nativeFactory, id, source.nativeSource));
}
// Starts recording an AEC dump. Ownership of the file is transfered to the
// native code. If an AEC dump is already in progress, it will be stopped and
// a new one will start using the provided file.
public boolean startAecDump(int file_descriptor, int filesize_limit_bytes) {
return nativeStartAecDump(nativeFactory, file_descriptor, filesize_limit_bytes);
}
// Stops recording an AEC dump. If no AEC dump is currently being recorded,
// this call will have no effect.
public void stopAecDump() {
nativeStopAecDump(nativeFactory);
}
@Deprecated
public void setOptions(Options options) {
nativeSetOptions(nativeFactory, options);
}
/** Set the EGL context used by HW Video encoding and decoding.
*
* @param localEglContext Must be the same as used by VideoCapturerAndroid and any local video
* renderer.
* @param remoteEglContext Must be the same as used by any remote video renderer.
*/
public void setVideoHwAccelerationOptions(
EglBase.Context localEglContext, EglBase.Context remoteEglContext) {
if (localEglbase != null) {
Logging.w(TAG, "Egl context already set.");
localEglbase.release();
}
if (remoteEglbase != null) {
Logging.w(TAG, "Egl context already set.");
remoteEglbase.release();
}
localEglbase = EglBase.create(localEglContext);
remoteEglbase = EglBase.create(remoteEglContext);
nativeSetVideoHwAccelerationOptions(
nativeFactory, localEglbase.getEglBaseContext(), remoteEglbase.getEglBaseContext());
}
public void dispose() {
nativeFreeFactory(nativeFactory);
networkThread = null;
workerThread = null;
signalingThread = null;
if (localEglbase != null)
localEglbase.release();
if (remoteEglbase != null)
remoteEglbase.release();
}
public void threadsCallbacks() {
nativeInvokeThreadsCallbacks(nativeFactory);
}
/** Returns a pointer to the native webrtc::PeerConnectionFactoryInterface. */
public long getNativePeerConnectionFactory() {
return nativeGetNativePeerConnectionFactory(nativeFactory);
}
/** Returns a pointer to the native OwnedFactoryAndThreads object */
public long getNativeOwnedFactoryAndThreads() {
return nativeFactory;
}
private static void printStackTrace(Thread thread, String threadName) {
if (thread != null) {
StackTraceElement[] stackTraces = thread.getStackTrace();
if (stackTraces.length > 0) {
Logging.d(TAG, threadName + " stacks trace:");
for (StackTraceElement stackTrace : stackTraces) {
Logging.d(TAG, stackTrace.toString());
}
}
}
}
public static void printStackTraces() {
printStackTrace(networkThread, "Network thread");
printStackTrace(workerThread, "Worker thread");
printStackTrace(signalingThread, "Signaling thread");
}
@CalledByNative
private static void onNetworkThreadReady() {
networkThread = Thread.currentThread();
Logging.d(TAG, "onNetworkThreadReady");
}
@CalledByNative
private static void onWorkerThreadReady() {
workerThread = Thread.currentThread();
Logging.d(TAG, "onWorkerThreadReady");
}
@CalledByNative
private static void onSignalingThreadReady() {
signalingThread = Thread.currentThread();
Logging.d(TAG, "onSignalingThreadReady");
}
// Must be called at least once before creating a PeerConnectionFactory
// (for example, at application startup time).
private static native void nativeInitializeAndroidGlobals(
Context context, boolean videoHwAcceleration);
private static native void nativeInitializeFieldTrials(String fieldTrialsInitString);
private static native String nativeFindFieldTrialsFullName(String name);
// Internal tracing initialization. Must be called before PeerConnectionFactory is created to
// prevent racing with tracing code.
// Deprecated, use PeerConnectionFactory.initialize instead.
private static native void nativeInitializeInternalTracer();
// Internal tracing shutdown, called to prevent resource leaks. Must be called after
// PeerConnectionFactory is gone to prevent races with code performing tracing.
private static native void nativeShutdownInternalTracer();
private static native boolean nativeStartInternalTracingCapture(String tracingFilename);
private static native void nativeStopInternalTracingCapture();
private static native long nativeCreatePeerConnectionFactory(Options options,
VideoEncoderFactory encoderFactory, VideoDecoderFactory decoderFactory,
long nativeAudioProcessor, long nativeFecControllerFactory);
private static native long nativeCreatePeerConnection(long factory,
PeerConnection.RTCConfiguration rtcConfig, MediaConstraints constraints, long nativeObserver);
private static native long nativeCreateLocalMediaStream(long factory, String label);
private static native long nativeCreateVideoSource(
long factory, SurfaceTextureHelper surfaceTextureHelper, boolean is_screencast);
private static native long nativeCreateVideoTrack(
long factory, String id, long nativeVideoSource);
private static native long nativeCreateAudioSource(long factory, MediaConstraints constraints);
private static native long nativeCreateAudioTrack(long factory, String id, long nativeSource);
private static native boolean nativeStartAecDump(
long factory, int file_descriptor, int filesize_limit_bytes);
private static native void nativeStopAecDump(long factory);
@Deprecated public native void nativeSetOptions(long factory, Options options);
private static native void nativeSetVideoHwAccelerationOptions(
long factory, Object localEGLContext, Object remoteEGLContext);
private static native void nativeInvokeThreadsCallbacks(long factory);
private static native void nativeFreeFactory(long factory);
private static native long nativeGetNativePeerConnectionFactory(long factory);
}
| [
"[email protected]"
] | |
42157e52f6ec18b3b2fe42a93635f3b49123c30b | b49c8103d4a99afa9e77a76da98b66daac80b76c | /src/mytest/java45.java | d9dd59349dc1014c303c27b0249fc916b0c6e217 | [] | no_license | justfungx/mytest | c4d350a1269782f0ac0a049a6de843be42e62225 | 8cbbf280ee1308d5965e4d4ec8663fb2755b518c | refs/heads/master | 2020-09-24T00:56:10.587997 | 2016-09-08T05:37:09 | 2016-09-08T05:37:09 | 66,991,984 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,077 | java | package mytest;
public class java45 {
public static void main(String[] args) {
java541 obj1 = new java541("A");
java541 obj2 = new java541("B");
java542 obj3 = new java542("C");
Thread t1q = new Thread(obj3);
// obj1.run();
// obj2.run();
obj1.start(); //權限大於RUN ,所以還是會執行RUN
obj2.start();
t1q.start();
try{
Thread.sleep(200);
}catch(InterruptedException e){
}
System.out.println("Main");
obj2.interrupt();
}
}
class java541 extends Thread {
String name;
java541(String name){this.name = name;}
@Override
public void run() {
for (int i=0; i<10; i++){
System.out.println(name + ":" + i);
try {
Thread.sleep(100);
} catch (InterruptedException e) {
break;
}
}
}
}
class java542 implements Runnable{
String name;
java542(String name){this.name = name;}
@Override
public void run() {
for (int i=0; i<10; i++){
System.out.println(name + ":" + i);
try {
Thread.sleep(100);
} catch (InterruptedException e) {
break;
}
}
}
} | [
"[email protected]"
] | |
16a27ca103520cb7f29797f58503d2d8190f6009 | f65a103cec78d0fabec9cba0dd6089f64a10d413 | /day_1/assignment_6/exception/InsufficientBalanceException.java | ecee07111c0a51d84773c98fde48ab4f8fe294a0 | [] | no_license | chiragreddy/Advanced_Lab2 | 75390c8a88420beba84724e20b45574c5bfc3814 | 16267298c24ad725d12af4747bf407d2f91351ab | refs/heads/master | 2020-05-02T22:15:36.190068 | 2019-03-28T16:54:27 | 2019-03-28T16:54:27 | 178,246,418 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 200 | java | package assignment_6.exception;
public class InsufficientBalanceException extends Exception{
public InsufficientBalanceException() {
super("Insufficient Balance in the account");
}
}
| [
"[email protected]"
] | |
f80b3ca9d5392c7d78c2f4c853d726f0b66e7258 | ae1f81f43712b57d0c629fc9e3563222ca22367f | /app/src/main/java/com/wowwee/revair_android_sdk/fragment/MenuFragment.java | 801ff3914347ff01dcb91f71b5fde9b1afded868 | [
"Apache-2.0"
] | permissive | WowWeeLabs/REVAIR-Android-SDK | 69f23644e140f89cc07b02902638d332b3adcd0c | 549e28402f015e67cf66dee0cd0027a0a318d0d4 | refs/heads/master | 2020-03-19T06:14:43.761046 | 2018-06-04T09:54:41 | 2018-06-04T09:54:41 | 136,000,202 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,734 | java | package com.wowwee.revair_android_sdk.fragment;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import com.wowwee.bluetoothrobotcontrollib.revair.REVAir;
import com.wowwee.bluetoothrobotcontrollib.revair.REVAirFinder;
import com.wowwee.revair_android_sdk.R;
import com.wowwee.revair_android_sdk.utils.FragmentHelper;
/**
* Created by davidchan on 22/3/2017.
*/
public class MenuFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
if (container == null)
return null;
final int flags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
getActivity().getWindow().getDecorView().setSystemUiVisibility(flags);
View view = inflater.inflate(R.layout.fragment_menu, container, false);
ListView listView = (ListView)view.findViewById(R.id.menuTable);
String[] robotNameArr = {"Change LED color", "Setting Features", "Free Flight", "Stunt (Beacon Mode)"};
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this.getActivity(), android.R.layout.simple_list_item_1, android.R.id.text1, robotNameArr);
listView.setAdapter(adapter);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position,
long id) {
if (REVAirFinder.getInstance().getREVAirRobotConnectedList().size() > 0) {
REVAir robot = (REVAir)REVAirFinder.getInstance().getREVAirRobotConnectedList().get(0);
switch (position) {
case 0:
FragmentHelper.switchFragment(getActivity().getSupportFragmentManager(), new ChangeLEDFragment(), R.id.view_id_content, false);
break;
case 1:
FragmentHelper.switchFragment(getActivity().getSupportFragmentManager(), new SettingFragment(), R.id.view_id_content, false);
break;
case 2:
FragmentHelper.switchFragment(getActivity().getSupportFragmentManager(), new DriveFragment(), R.id.view_id_content, false);
break;
case 3:
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle("Stunt (Beacon Mode)");
builder.setMessage("Please turn on REV car to play this mode.");
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
FragmentHelper.switchFragment(getActivity().getSupportFragmentManager(), new StuntFragment(), R.id.view_id_content, false);
}
});
AlertDialog alertDialog = builder.create();
Window dialogWindow = alertDialog.getWindow();
dialogWindow.setFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
dialogWindow.addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
alertDialog.show();
dialogWindow.setFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
dialogWindow.getDecorView().setSystemUiVisibility(getActivity().getWindow().getDecorView().getSystemUiVisibility());
alertDialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
break;
}
}
}
});
return view;
}
}
| [
"[email protected]"
] | |
b05c6bfe6a1ecb083615da986dfdfa1b316e6925 | d806c89037d16c5d104b61377207d549f831a2b3 | /Java/uwb/uwb/uwb-modules/uwb-modules-websocket/src/main/java/com/zhilutec/uwb/config/WebSocketConfig.java | 72b51fa5bad889d134d6cb5abd3dbdebfa3d9193 | [] | no_license | wuhlcom/uwb | eef4c2b9d68260752b35f39ea4f4a7d62d771434 | 9aa14745e9f76c4f0c2f1b0c577350b388a4faa2 | refs/heads/master | 2020-03-19T19:32:42.475138 | 2018-12-25T06:32:39 | 2018-12-25T06:32:39 | 136,861,886 | 3 | 5 | null | null | null | null | UTF-8 | Java | false | false | 484 | java | /**
* @author :wuhongliang [email protected]
* @version :2017年11月7日 下午4:13:12 *
*/
package com.zhilutec.uwb.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
@Configuration
public class WebSocketConfig {
@Bean
public ServerEndpointExporter serverEndpointExporter(){
return new ServerEndpointExporter();
}
}
| [
"[email protected]"
] | |
5997fdd2933f1e8129e4bd7a435021c883cdb705 | 0b8f45dc52b7f6a3d5a266ae5653517e974c1805 | /app/src/main/java/com/example/asif/myappevent/Students.java | a9946f18c57cabb5b1910d2af4d909047af45cd7 | [] | no_license | AsifAhmedShodip/Event | 61e8e4ed9beebb98c50da83f1a5a1ae8d6036432 | b1a4a294839a89ba6ef50d9bd150182a12e3aac2 | refs/heads/master | 2021-07-23T14:23:24.221387 | 2017-11-02T15:43:50 | 2017-11-02T15:43:50 | 109,283,935 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,520 | java | package com.example.asif.myappevent;
/**
* Created by aniomi on 9/30/17.
*/
public class Students {
static Students current=new Students();
String name;
String pass;
String mail;
String dept;
String year;
String location;
String blood;
String uid;
public Students()
{
name=pass=mail=dept=year=location=blood=uid="Omi";
}
public Students(String name, String pass, String mail, String dept, String year, String location, String blood,String uid){
this.name = name;
this.pass = pass;
this.mail = mail;
this.dept = dept;
this.year = year;
this.location = location;
this.blood = blood;
this.uid=uid;
}
public void allSet(Students s)
{
this.name = s.name;
this.pass = s.pass;
this.mail = s.mail;
this.dept = s.dept;
this.year = s.year;
this.location = s.location;
this.blood = s.blood;
this.uid=s.uid;
}
/* boolean isValid()
{
boolean flag=true;
flag=flag && (Search.curr.name.equals("none") || this.name.contains(Search.curr.name));
flag=flag && (Search.curr.dept.equals("none") || this.dept.equals(Search.curr.dept));
flag=flag && (Search.curr.year.equals("none") || this.year.equals(Search.curr.year));
flag=flag && (Search.curr.blood.equals("none") || this.blood.equals(Search.curr.blood));
return flag;
}*/
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPass() {
return pass;
}
public void setPass(String pass) {
this.pass = pass;
}
public String getMail() {
return mail;
}
public void setMail(String mail) {
this.mail = mail;
}
public String getDept() {
return dept;
}
public void setDept(String dept) {
this.dept = dept;
}
public String getYear() {
return year;
}
public void setYear(String year) {
this.year = year;
}
public String getLoc() {
return location;
}
public void setLoc(String loc) {
this.location = loc;
}
public String getBlood() {
return blood;
}
public void setBlood(String blood) {
this.blood = blood;
}
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
} | [
"[email protected]"
] | |
817ca47c7bcfb9164076397eb2c968e2d726c2c2 | c3ef1845dd3ed6b013635fba27dc393044ee1781 | /plugin/gen/org/jetbrains/rust/psi/impl/RustMacroExprImpl.java | 99b5dd4d4b07f0aa8cab7ddbec787dfb975ffe6d | [] | no_license | matklad/rust-idea-plugin | ea3c9a28cd9e2f5c417315184b4c2540dba8a01c | 8af8d61802708cf51546879d1364a381a6fa3a43 | refs/heads/master | 2021-01-13T01:08:35.603455 | 2015-10-07T18:54:40 | 2015-10-07T18:55:25 | 41,671,115 | 8 | 2 | null | 2015-09-17T17:44:21 | 2015-08-31T11:08:32 | Java | UTF-8 | Java | false | true | 975 | java | // This is a generated file. Not intended for manual editing.
package org.jetbrains.rust.psi.impl;
import java.util.List;
import org.jetbrains.annotations.*;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.util.PsiTreeUtil;
import static org.jetbrains.rust.psi.RustTypes.*;
import org.jetbrains.rust.psi.*;
public class RustMacroExprImpl extends RustExprImpl implements RustMacroExpr {
public RustMacroExprImpl(ASTNode node) {
super(node);
}
public void accept(@NotNull PsiElementVisitor visitor) {
if (visitor instanceof RustVisitor) ((RustVisitor)visitor).visitMacroExpr(this);
else super.accept(visitor);
}
@Override
@Nullable
public RustCommaSeparatedList getCommaSeparatedList() {
return findChildByClass(RustCommaSeparatedList.class);
}
@Override
@NotNull
public PsiElement getIdent() {
return findNotNullChildByType(IDENT);
}
}
| [
"[email protected]"
] | |
87f4fb56c1f5cf6bcee6de2fca83606bde4e3025 | e5b06b6a4eb9c3331bba95185da1de429ca127c4 | /app/src/main/java/cn/company1075/xiaofu/view/adapter/GridRecycleViewAdapter.java | ea7f264a95268ce5cd6027c3063416942dcad697 | [] | no_license | Android-YZP/xiaofu2 | 595fc04e6f85d9df24279ceef79fac68b897fd6e | e83bd26f1a98a2913e2ab2fc6aa5295efcf8cd4e | refs/heads/master | 2020-05-03T20:40:16.473823 | 2019-04-01T07:22:38 | 2019-04-01T07:22:39 | 178,807,720 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,449 | java | package cn.company1075.xiaofu.view.adapter;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.util.DisplayMetrics;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import java.util.List;
import cn.company1075.xiaofu.GankService;
import cn.company1075.xiaofu.ProductActivity;
import cn.company1075.xiaofu.R;
import cn.company1075.xiaofu.utils.Goods;
import cn.company1075.xiaofu.utils.GoodsDetail;
import cn.company1075.xiaofu.utils.OkHttpUtils;
import cn.company1075.xiaofu.utils.xiaofu.PopUtils;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
import retrofit2.http.PUT;
public class GridRecycleViewAdapter extends RecyclerView.Adapter<GridRecycleViewAdapter.MyViewHolder> {
private LayoutInflater mLayoutInflater;
private List<Goods.DataBean> data;
private int mItemLayout;
private Context context;
private int width;
private int height;
public GridRecycleViewAdapter(Context context, int itemLayout, List<Goods.DataBean> datalist) {
mLayoutInflater = LayoutInflater.from(context);
mItemLayout = itemLayout;
data = datalist;
this.context = context;
Resources resources = context.getResources();
DisplayMetrics dm = resources.getDisplayMetrics();
width = dm.widthPixels;
height = dm.heightPixels;
}
public void setData(List<Goods.DataBean> data){
this.data = data;
notifyDataSetChanged();
}
@NonNull
@Override
public GridRecycleViewAdapter.MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new MyViewHolder(mLayoutInflater.inflate(mItemLayout, parent, false));
}
@Override
public void onBindViewHolder(@NonNull final GridRecycleViewAdapter.MyViewHolder holder, final int position) {
holder.tv.setText(data.get(position).getGoodName());
Glide.with(context).load(data.get(position).getGoodImage()).into(holder.img);
holder. img.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(context, ProductActivity.class);
intent.putExtra("value", (Long) data.get(position).getGoodId());
context.startActivity(intent);
}
});
}
@Override
public int getItemCount() {
return data.size();
}
class MyViewHolder extends RecyclerView.ViewHolder {
private ImageView img;
private TextView tv;
public MyViewHolder(View itemView) {
super(itemView);
img = (ImageView) itemView.findViewById(R.id.recycler_item_image);
tv = itemView.findViewById(R.id.recycler_item_tv);
//设置宽与高长度相等
/*LinearLayout.LayoutParams params= (LinearLayout.LayoutParams) img.getLayoutParams();
params.height = params.width;
img.setLayoutParams(params);*/
}
}
}
| [
"[email protected]"
] | |
ab51d02c60e250cd358766cc8dbb31806ad1de9c | aae6fa589dd42c285d5fe645904f9d390972e01a | /shiku-push/src/main/java/com/shiku/push/service/HWPushService.java | 2e8474651ab6f928e22cfac7190deaf666f9e95a | [] | no_license | CNLzr/shikuim-main | 2e0ffa1b8b4d36b4caf29e482c1da7d3f7ded605 | af6857e77658d1b11ab2aca1071f856289559367 | refs/heads/main | 2023-09-02T01:54:51.031342 | 2021-11-12T00:44:26 | 2021-11-12T00:44:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,178 | java | package com.shiku.push.service;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.SocketTimeoutException;
import java.net.URL;
import java.net.URLEncoder;
import java.text.MessageFormat;
import java.util.List;
import org.apache.commons.io.IOUtils;
import org.json.simple.JSONArray;
import com.alibaba.fastjson.JSONObject;
import cn.xyz.mianshi.vo.MsgNotice;
//华为推送集成通知栏消息
public class HWPushService extends PushServiceUtils{
private static String appSecret = getPushConfig().getHw_appSecret();
private static String appId = getPushConfig().getHw_appId();
private static String tokenUrl = getPushConfig().getHw_tokenUrl();
private static String apiUrl = getPushConfig().getHw_apiUrl();
private static String iconUrl = getPushConfig().getHw_iconUrl();
private static String accessToken;
private static long tokenExpiredTime;
/*public static void main(String[] args) throws IOException{
sendPushMessage("0865217039424357300001122700CN01");
}*/
//获取下发通知消息的认证Token
private static void refreshToken() throws IOException
{
String msgBody = MessageFormat.format(
"grant_type=client_credentials&client_secret={0}&client_id={1}",
URLEncoder.encode(appSecret, "UTF-8"), appId);
String response = httpPost(tokenUrl, msgBody, 10000, 10000);
JSONObject obj = JSONObject.parseObject(response);
if(null==obj) {
log.error("HWPushService refreshToken response is null ");
}
String token = obj.getString("access_token");
Long expires_in = obj.getLong("expires_in");
if(null!=token)
accessToken = token;
if(null!=expires_in)
tokenExpiredTime = System.currentTimeMillis() + obj.getLong("expires_in") - 5*60*1000;
}
// 发送Push消息
public static void sendPushMessage(MsgNotice notice,String callNum,String token) throws IOException{
if (tokenExpiredTime <= System.currentTimeMillis())
{
refreshToken();
}
/*PushManager.requestToken为客户端申请token的方法,可以调用多次以防止申请token失败*/
/*PushToken不支持手动编写,需使用客户端的onToken方法获取*/
JSONArray deviceTokens = new JSONArray();//目标设备Token
deviceTokens.add(token);
/*deviceTokens.add("22345678901234561234567890123456");
deviceTokens.add("32345678901234561234567890123456");*/
JSONObject body = new JSONObject();//仅通知栏消息需要设置标题和内容,透传消息key和value为用户自定义
body.put("title", notice.getTitle());//消息标题
body.put("content", notice.getText());//消息内容体
/*if(120==notice.getType()||115==notice.getType()){
body.put("callNum", callNum);
}*/
JSONObject param = new JSONObject();
// param.put("appPkgName", appPkgName);//定义需要打开的appPkgName
String url="intent://"+appPkgName+"/notification#Intent;scheme=sk;launchFlags=0x10000000;S.userId="+notice.getFrom()+";end";
param.put("intent", url);
JSONObject action = new JSONObject();
// action.put("type", 3);//类型3为打开APP,其他行为请参考接口文档设置
action.put("type", 1);
action.put("param", param);//消息点击动作参数
JSONObject msg = new JSONObject();
msg.put("type", 3);//3: 通知栏消息,异步透传消息请根据接口文档设置
msg.put("action", action);//消息点击动作
msg.put("body", body);//通知栏消息body内容
JSONObject ext = new JSONObject();//扩展信息,含BI消息统计,特定展示风格,消息折叠。
ext.put("biTag", "Trump");//设置消息标签,如果带了这个标签,会在回执中推送给CP用于检测某种类型消息的到达率和状态
ext.put("icon",iconUrl);//自定义推送消息在通知栏的图标,value为一个公网可以访问的URL
JSONObject hps = new JSONObject();//华为PUSH消息总结构体
hps.put("msg", msg);
hps.put("ext", ext);
JSONObject payload = new JSONObject();
payload.put("hps", hps);
String postBody = MessageFormat.format(
"access_token={0}&nsp_svc={1}&nsp_ts={2}&device_token_list={3}&payload={4}",
URLEncoder.encode(accessToken,"UTF-8"),
URLEncoder.encode("openpush.message.api.send","UTF-8"),
URLEncoder.encode(String.valueOf(System.currentTimeMillis() / 1000),"UTF-8"),
URLEncoder.encode(deviceTokens.toString(),"UTF-8"),
URLEncoder.encode(payload.toString(),"UTF-8"));
String postUrl = apiUrl + "?nsp_ctx=" + URLEncoder.encode("{\"ver\":\"1\", \"appId\":\"" + appId + "\"}", "UTF-8");
httpPost(postUrl, postBody, 5000, 5000);
}
public static void sendTransMessage(MsgNotice notice,String callNum,String token) throws IOException
{
if (tokenExpiredTime <= System.currentTimeMillis())
{
refreshToken();
}
/*PushManager.requestToken为客户端申请token的方法,可以调用多次以防止申请token失败*/
/*PushToken不支持手动编写,需使用客户端的onToken方法获取*/
JSONArray deviceTokens = new JSONArray();//目标设备Token
deviceTokens.add(token);
/*deviceTokens.add("22345678901234561234567890123456");
deviceTokens.add("32345678901234561234567890123456");*/
JSONObject body = new JSONObject();
body.put("key1", notice.getText());//透传消息自定义body内容
/* body.put("key2", "value2");//透传消息自定义body内容
body.put("key3", "value3");//透传消息自定义body内容
*/
JSONObject msg = new JSONObject();
msg.put("type", 1);//1: 透传异步消息,通知栏消息请根据接口文档设置
msg.put("body", body.toString());//body内容不一定是JSON,可以是String,若为JSON需要转化为String发送
JSONObject hps = new JSONObject();//华为PUSH消息总结构体
hps.put("msg", msg);
JSONObject payload = new JSONObject();
payload.put("hps", hps);
String postBody = MessageFormat.format(
"access_token={0}&nsp_svc={1}&nsp_ts={2}&device_token_list={3}&payload={4}",
URLEncoder.encode(accessToken,"UTF-8"),
URLEncoder.encode("openpush.message.api.send","UTF-8"),
URLEncoder.encode(String.valueOf(System.currentTimeMillis() / 1000),"UTF-8"),
URLEncoder.encode(deviceTokens.toString(),"UTF-8"),
URLEncoder.encode(payload.toString(),"UTF-8"));
String postUrl = apiUrl + "?nsp_ctx=" + URLEncoder.encode("{\"ver\":\"1\", \"appId\":\"" + appId + "\"}", "UTF-8");
httpPost(postUrl, postBody, 5000, 5000);
}
public static String httpPost(String httpUrl, String data, int connectTimeout, int readTimeout) {
OutputStream outPut = null;
HttpURLConnection urlConnection = null;
InputStream in = null;
/*if(KConstants.isDebug) {
log.info("httpPost ==> {}",httpUrl);
log.info("data ==> {}",data);
}*/
try
{
URL url = new URL(httpUrl);
urlConnection = (HttpURLConnection)url.openConnection();
urlConnection.setRequestMethod("POST");
urlConnection.setDoOutput(true);
urlConnection.setDoInput(true);
urlConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
urlConnection.setConnectTimeout(connectTimeout);
urlConnection.setReadTimeout(readTimeout);
urlConnection.connect();
// POST data
outPut = urlConnection.getOutputStream();
outPut.write(data.getBytes("UTF-8"));
outPut.flush();
// read response
if (urlConnection.getResponseCode() < 400)
{
in = urlConnection.getInputStream();
}
else
{
in = urlConnection.getErrorStream();
}
List<String> lines = IOUtils.readLines(in, urlConnection.getContentEncoding());
StringBuffer strBuf = new StringBuffer();
for (String line : lines)
{
strBuf.append(line);
}
System.out.println(strBuf.toString());
return strBuf.toString();
}catch (SocketTimeoutException e) {
log.error("huawei push Exception {} ",e.getMessage());
httpPost(httpUrl, data, 5000, 5000);
return null;
}catch (Exception e) {
log.error("huawei push Exception {} ",e.getMessage());
//httpPost(httpUrl, data, 10000, 10000);
return null;
}
finally{
IOUtils.closeQuietly(outPut);
IOUtils.closeQuietly(in);
if (urlConnection != null)
{
urlConnection.disconnect();
}
}
}
// 华为批量推送
public static void fullSendPushMessage(MsgNotice notice,JSONArray tokens) throws IOException{
if (tokenExpiredTime <= System.currentTimeMillis())
{
refreshToken();
}
JSONObject body = new JSONObject();//仅通知栏消息需要设置标题和内容,透传消息key和value为用户自定义
body.put("title", notice.getTitle());//消息标题
body.put("content", notice.getText());//消息内容体
JSONObject param = new JSONObject();
// param.put("appPkgName", appPkgName);//定义需要打开的appPkgName
String url;
if(null == notice.getObjectId())
url="intent://"+appPkgName+"/notification#Intent;scheme=sk;launchFlags=0x10000000;end";
else
url="intent://"+appPkgName+"/notification#Intent;scheme=sk;launchFlags=0x10000000;S.url="+URLEncoder.encode(notice.getObjectId(), "UTF-8")+";end";
param.put("intent", url);
JSONObject action = new JSONObject();
// action.put("type", 3);//类型3为打开APP,其他行为请参考接口文档设置
action.put("type", 1);
action.put("param", param);//消息点击动作参数
JSONObject msg = new JSONObject();
msg.put("type", 3);//3: 通知栏消息,异步透传消息请根据接口文档设置
msg.put("action", action);//消息点击动作
msg.put("body", body);//通知栏消息body内容
JSONObject ext = new JSONObject();//扩展信息,含BI消息统计,特定展示风格,消息折叠。
ext.put("biTag", "Trump");//设置消息标签,如果带了这个标签,会在回执中推送给CP用于检测某种类型消息的到达率和状态
ext.put("icon",iconUrl);//自定义推送消息在通知栏的图标,value为一个公网可以访问的URL
JSONObject hps = new JSONObject();//华为PUSH消息总结构体
hps.put("msg", msg);
hps.put("ext", ext);
JSONObject payload = new JSONObject();
payload.put("hps", hps);
String postBody = MessageFormat.format(
"access_token={0}&nsp_svc={1}&nsp_ts={2}&device_token_list={3}&payload={4}",
URLEncoder.encode(accessToken,"UTF-8"),
URLEncoder.encode("openpush.message.api.send","UTF-8"),
URLEncoder.encode(String.valueOf(System.currentTimeMillis() / 1000),"UTF-8"),
URLEncoder.encode(tokens.toString(),"UTF-8"),
URLEncoder.encode(payload.toString(),"UTF-8"));
String postUrl = apiUrl + "?nsp_ctx=" + URLEncoder.encode("{\"ver\":\"1\", \"appId\":\"" + appId + "\"}", "UTF-8");
httpPost(postUrl, postBody, 5000, 5000);
}
}
| [
"[email protected]"
] | |
6d3634bc9cf5ff7b68dde1c657348d4fa63d1ad4 | 7dd42433ef98c599a4f8447174ba492463bbfeef | /src/main/java/com/andiblas/artists/service/dto/UserDTO.java | 52bad2c0b5cb0b5a77af3f30784e49f7488f8dbe | [] | no_license | andiblas/ArtistsSample | 7bd1a94ab8c4f0a7f8c46f98751a4e8ce9a3aedf | 222867875e40e02a1c515c86210f8380f608fb59 | refs/heads/master | 2020-03-20T02:47:30.955835 | 2018-06-12T20:29:58 | 2018-06-12T20:29:58 | 137,124,255 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,645 | java | package com.andiblas.artists.service.dto;
import com.andiblas.artists.config.Constants;
import com.andiblas.artists.domain.Authority;
import com.andiblas.artists.domain.User;
import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.NotBlank;
import javax.validation.constraints.*;
import java.time.Instant;
import java.util.Set;
import java.util.stream.Collectors;
/**
* A DTO representing a user, with his authorities.
*/
public class UserDTO {
private Long id;
@NotBlank
@Pattern(regexp = Constants.LOGIN_REGEX)
@Size(min = 1, max = 100)
private String login;
@Size(max = 50)
private String firstName;
@Size(max = 50)
private String lastName;
@Email
@Size(min = 5, max = 100)
private String email;
@Size(max = 256)
private String imageUrl;
private boolean activated = false;
@Size(min = 2, max = 6)
private String langKey;
private String createdBy;
private Instant createdDate;
private String lastModifiedBy;
private Instant lastModifiedDate;
private Set<String> authorities;
public UserDTO() {
// Empty constructor needed for Jackson.
}
public UserDTO(User user) {
this.id = user.getId();
this.login = user.getLogin();
this.firstName = user.getFirstName();
this.lastName = user.getLastName();
this.email = user.getEmail();
this.activated = user.getActivated();
this.imageUrl = user.getImageUrl();
this.langKey = user.getLangKey();
this.createdBy = user.getCreatedBy();
this.createdDate = user.getCreatedDate();
this.lastModifiedBy = user.getLastModifiedBy();
this.lastModifiedDate = user.getLastModifiedDate();
this.authorities = user.getAuthorities().stream()
.map(Authority::getName)
.collect(Collectors.toSet());
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getLogin() {
return login;
}
public void setLogin(String login) {
this.login = login;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getImageUrl() {
return imageUrl;
}
public void setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
}
public boolean isActivated() {
return activated;
}
public void setActivated(boolean activated) {
this.activated = activated;
}
public String getLangKey() {
return langKey;
}
public void setLangKey(String langKey) {
this.langKey = langKey;
}
public String getCreatedBy() {
return createdBy;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
public Instant getCreatedDate() {
return createdDate;
}
public void setCreatedDate(Instant createdDate) {
this.createdDate = createdDate;
}
public String getLastModifiedBy() {
return lastModifiedBy;
}
public void setLastModifiedBy(String lastModifiedBy) {
this.lastModifiedBy = lastModifiedBy;
}
public Instant getLastModifiedDate() {
return lastModifiedDate;
}
public void setLastModifiedDate(Instant lastModifiedDate) {
this.lastModifiedDate = lastModifiedDate;
}
public Set<String> getAuthorities() {
return authorities;
}
public void setAuthorities(Set<String> authorities) {
this.authorities = authorities;
}
@Override
public String toString() {
return "UserDTO{" +
"login='" + login + '\'' +
", firstName='" + firstName + '\'' +
", lastName='" + lastName + '\'' +
", email='" + email + '\'' +
", imageUrl='" + imageUrl + '\'' +
", activated=" + activated +
", langKey='" + langKey + '\'' +
", createdBy=" + createdBy +
", createdDate=" + createdDate +
", lastModifiedBy='" + lastModifiedBy + '\'' +
", lastModifiedDate=" + lastModifiedDate +
", authorities=" + authorities +
"}";
}
}
| [
"[email protected]"
] | |
e2acdfb0504fcf8c77ad3dbfa576d9609e422988 | 165b2df00647df5290fe07e745671834f6f0143e | /android/src/main/kotlin/com/braintreepayments/api/models/MetadataBuilder.java | 2d88a50bb7bbfaaed09374983a40c8a1148af0a5 | [] | no_license | hanhon/braintree_pay | 364274ecd5833bae1fdfbc722e05f538f79bef15 | 0e6bf5b2527793cd9dd6add3a18f5d11a6f5da7a | refs/heads/master | 2021-01-04T23:07:49.068703 | 2019-11-15T09:56:38 | 2019-11-15T09:56:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,644 | java | package com.braintreepayments.api.models;
import com.mwp.braintreepay.BuildConfig;
import org.json.JSONException;
import org.json.JSONObject;
public class MetadataBuilder {
public static final String META_KEY = "_meta";
private static final String SOURCE_KEY = "source";
private static final String INTEGRATION_KEY = "integration";
private static final String SESSION_ID_KEY = "sessionId";
private static final String VERSION_KEY = "version";
private static final String PLATFORM_KEY = "platform";
private JSONObject mJson;
public MetadataBuilder() {
mJson = new JSONObject();
try {
mJson.put(PLATFORM_KEY, "android");
} catch (JSONException ignored) {}
}
public MetadataBuilder source(String source) {
try {
mJson.put(SOURCE_KEY, source);
} catch (JSONException ignored) {}
return this;
}
public MetadataBuilder integration(String integration) {
try {
mJson.put(INTEGRATION_KEY, integration);
} catch (JSONException ignored) {}
return this;
}
public MetadataBuilder sessionId(String sessionId) {
try {
mJson.put(SESSION_ID_KEY, sessionId);
} catch (JSONException ignored) {}
return this;
}
public MetadataBuilder version() {
try {
mJson.put(VERSION_KEY, BuildConfig.VERSION_NAME);
} catch (JSONException ignored) {}
return this;
}
public JSONObject build() {
return mJson;
}
@Override
public String toString() {
return mJson.toString();
}
}
| [
"[email protected]"
] | |
4ddcce90291ec2df0564e6e569689378f50d9400 | a4d449f78563634e02cc5ecdf162d1604da3b185 | /pet-clinic-data/src/main/java/com/gaurav/petclinic/model/Vet.java | 8bbe0f8ca7149a2431d6f816dd16b0e2b7c4e77d | [] | no_license | gauravpathak-spring/spring-petclinic | 39214af7920cdd2f4fffa471b1a83612740e6d2a | e7f7723e20a4d50b60d62968c83622d51ff8229e | refs/heads/master | 2020-04-05T16:04:36.089509 | 2018-11-26T17:57:37 | 2018-11-26T17:57:37 | 156,996,006 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 73 | java | package com.gaurav.petclinic.model;
public class Vet extends Person{
}
| [
"[email protected]"
] | |
d1dc0b84673d218b53412cf51b5a4afaf2c213b1 | 80dd9470adccb2d112558c88c23acc63db28645f | /src/main/java/io/springsecurity/controller/TestController.java | c063fd8c3db4460b005b36d213eaafc4973967d0 | [] | no_license | pratapscs/spring-boot-security | 226e5590e0ffb5da6d73f25c78eaee3fdb33ac1d | 9c2e260edda27623e889e10bd009ea0c820a9323 | refs/heads/master | 2023-07-09T23:33:57.601195 | 2021-08-04T13:04:53 | 2021-08-04T13:04:53 | 367,662,641 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 462 | java | package io.springsecurity.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class TestController {
@GetMapping("/")
public String home() {
return ("<h1>Welcome</h1>");
}
@GetMapping("/user")
public String user() {
return ("<h1>Welcome User</h1>");
}
@GetMapping("/admin")
public String admin() {
return ("<h1>Welcome Admin</h1>");
}
}
| [
"[email protected]"
] | |
eefa407e76d40fba2d0a6a11f6ad6d3715e3e48e | 73267be654cd1fd76cf2cb9ea3a75630d9f58a41 | /services/cloudide/src/main/java/com/huaweicloud/sdk/cloudide/v2/model/ExtensionVersionSnake.java | cdfa98cab8b082e8a476f40184edb5c8b02c1b85 | [
"Apache-2.0"
] | permissive | huaweicloud/huaweicloud-sdk-java-v3 | 51b32a451fac321a0affe2176663fed8a9cd8042 | 2f8543d0d037b35c2664298ba39a89cc9d8ed9a3 | refs/heads/master | 2023-08-29T06:50:15.642693 | 2023-08-24T08:34:48 | 2023-08-24T08:34:48 | 262,207,545 | 91 | 57 | NOASSERTION | 2023-09-08T12:24:55 | 2020-05-08T02:27:00 | Java | UTF-8 | Java | false | false | 34,123 | java | package com.huaweicloud.sdk.cloudide.v2.model;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.Consumer;
/**
* ExtensionVersionSnake
*/
public class ExtensionVersionSnake {
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "id")
private String id;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "version")
private String version;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "version_ranking")
private Long versionRanking;
/**
* 插件版本状态 - INIT 待发布 - VALIDATING 审核中 - REJECTED 审核拒绝 - PUBLISHED 插件上架 - OFFLINE 插件下线 - ABANDONED 废弃 - GRAY_INIT 灰度审核 - GRAYED 灰度发布 - GRAY_REJECTED 灰度拒绝
*/
public static final class StatusEnum {
/**
* Enum INIT for value: "INIT"
*/
public static final StatusEnum INIT = new StatusEnum("INIT");
/**
* Enum VALIDATING for value: "VALIDATING"
*/
public static final StatusEnum VALIDATING = new StatusEnum("VALIDATING");
/**
* Enum REJECTED for value: "REJECTED"
*/
public static final StatusEnum REJECTED = new StatusEnum("REJECTED");
/**
* Enum PUBLISHED for value: "PUBLISHED"
*/
public static final StatusEnum PUBLISHED = new StatusEnum("PUBLISHED");
/**
* Enum OFFLINE for value: "OFFLINE"
*/
public static final StatusEnum OFFLINE = new StatusEnum("OFFLINE");
/**
* Enum ABANDONED for value: "ABANDONED"
*/
public static final StatusEnum ABANDONED = new StatusEnum("ABANDONED");
/**
* Enum GRAY_INIT for value: "GRAY_INIT"
*/
public static final StatusEnum GRAY_INIT = new StatusEnum("GRAY_INIT");
/**
* Enum GRAYED for value: "GRAYED"
*/
public static final StatusEnum GRAYED = new StatusEnum("GRAYED");
/**
* Enum GRAY_REJECTED for value: "GRAY_REJECTED"
*/
public static final StatusEnum GRAY_REJECTED = new StatusEnum("GRAY_REJECTED");
private static final Map<String, StatusEnum> STATIC_FIELDS = createStaticFields();
private static Map<String, StatusEnum> createStaticFields() {
Map<String, StatusEnum> map = new HashMap<>();
map.put("INIT", INIT);
map.put("VALIDATING", VALIDATING);
map.put("REJECTED", REJECTED);
map.put("PUBLISHED", PUBLISHED);
map.put("OFFLINE", OFFLINE);
map.put("ABANDONED", ABANDONED);
map.put("GRAY_INIT", GRAY_INIT);
map.put("GRAYED", GRAYED);
map.put("GRAY_REJECTED", GRAY_REJECTED);
return Collections.unmodifiableMap(map);
}
private String value;
StatusEnum(String value) {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
@JsonCreator
public static StatusEnum fromValue(String value) {
if (value == null) {
return null;
}
return java.util.Optional.ofNullable(STATIC_FIELDS.get(value)).orElse(new StatusEnum(value));
}
public static StatusEnum valueOf(String value) {
if (value == null) {
return null;
}
return java.util.Optional.ofNullable(STATIC_FIELDS.get(value))
.orElseThrow(() -> new IllegalArgumentException("Unexpected value '" + value + "'"));
}
@Override
public boolean equals(Object obj) {
if (obj instanceof StatusEnum) {
return this.value.equals(((StatusEnum) obj).value);
}
return false;
}
@Override
public int hashCode() {
return this.value.hashCode();
}
}
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "status")
private StatusEnum status;
/**
* 插件状态 - INIT 待发布 - VALIDATING 审核中 - REJECTED 审核拒绝 - PUBLISHED 插件上架 - OFFLINE 插件下线 - ABANDONED 废弃 - GRAY_INIT 灰度审核 - GRAYED 灰度发布 - GRAY_REJECTED 灰度拒绝
*/
public static final class VersionStatusEnum {
/**
* Enum INIT for value: "INIT"
*/
public static final VersionStatusEnum INIT = new VersionStatusEnum("INIT");
/**
* Enum VALIDATING for value: "VALIDATING"
*/
public static final VersionStatusEnum VALIDATING = new VersionStatusEnum("VALIDATING");
/**
* Enum REJECTED for value: "REJECTED"
*/
public static final VersionStatusEnum REJECTED = new VersionStatusEnum("REJECTED");
/**
* Enum PUBLISHED for value: "PUBLISHED"
*/
public static final VersionStatusEnum PUBLISHED = new VersionStatusEnum("PUBLISHED");
/**
* Enum OFFLINE for value: "OFFLINE"
*/
public static final VersionStatusEnum OFFLINE = new VersionStatusEnum("OFFLINE");
/**
* Enum ABANDONED for value: "ABANDONED"
*/
public static final VersionStatusEnum ABANDONED = new VersionStatusEnum("ABANDONED");
/**
* Enum GRAY_INIT for value: "GRAY_INIT"
*/
public static final VersionStatusEnum GRAY_INIT = new VersionStatusEnum("GRAY_INIT");
/**
* Enum GRAYED for value: "GRAYED"
*/
public static final VersionStatusEnum GRAYED = new VersionStatusEnum("GRAYED");
/**
* Enum GRAY_REJECTED for value: "GRAY_REJECTED"
*/
public static final VersionStatusEnum GRAY_REJECTED = new VersionStatusEnum("GRAY_REJECTED");
private static final Map<String, VersionStatusEnum> STATIC_FIELDS = createStaticFields();
private static Map<String, VersionStatusEnum> createStaticFields() {
Map<String, VersionStatusEnum> map = new HashMap<>();
map.put("INIT", INIT);
map.put("VALIDATING", VALIDATING);
map.put("REJECTED", REJECTED);
map.put("PUBLISHED", PUBLISHED);
map.put("OFFLINE", OFFLINE);
map.put("ABANDONED", ABANDONED);
map.put("GRAY_INIT", GRAY_INIT);
map.put("GRAYED", GRAYED);
map.put("GRAY_REJECTED", GRAY_REJECTED);
return Collections.unmodifiableMap(map);
}
private String value;
VersionStatusEnum(String value) {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
@JsonCreator
public static VersionStatusEnum fromValue(String value) {
if (value == null) {
return null;
}
return java.util.Optional.ofNullable(STATIC_FIELDS.get(value)).orElse(new VersionStatusEnum(value));
}
public static VersionStatusEnum valueOf(String value) {
if (value == null) {
return null;
}
return java.util.Optional.ofNullable(STATIC_FIELDS.get(value))
.orElseThrow(() -> new IllegalArgumentException("Unexpected value '" + value + "'"));
}
@Override
public boolean equals(Object obj) {
if (obj instanceof VersionStatusEnum) {
return this.value.equals(((VersionStatusEnum) obj).value);
}
return false;
}
@Override
public int hashCode() {
return this.value.hashCode();
}
}
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "version_status")
private VersionStatusEnum versionStatus;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "asset_uri")
private String assetUri;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "last_updated")
private OffsetDateTime lastUpdated;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "files")
private List<ExtensionFileSnake> files = null;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "validate_message")
private String validateMessage;
/**
* 插件审核状态 - NONE 无 - UPLOADING 上传中 - VALIDATING 系统审核 - OFFLINING 用户申请下线 - ONLINING 用户申请上线 - UMS_VALIDATING 发布商审核中
*/
public static final class VersionValidateStatusEnum {
/**
* Enum NONE for value: "NONE"
*/
public static final VersionValidateStatusEnum NONE = new VersionValidateStatusEnum("NONE");
/**
* Enum UPLOADING for value: "UPLOADING"
*/
public static final VersionValidateStatusEnum UPLOADING = new VersionValidateStatusEnum("UPLOADING");
/**
* Enum VALIDATING for value: "VALIDATING"
*/
public static final VersionValidateStatusEnum VALIDATING = new VersionValidateStatusEnum("VALIDATING");
/**
* Enum OFFLINING for value: "OFFLINING"
*/
public static final VersionValidateStatusEnum OFFLINING = new VersionValidateStatusEnum("OFFLINING");
/**
* Enum ONLINING for value: "ONLINING"
*/
public static final VersionValidateStatusEnum ONLINING = new VersionValidateStatusEnum("ONLINING");
/**
* Enum UMS_VALIDATING for value: "UMS_VALIDATING"
*/
public static final VersionValidateStatusEnum UMS_VALIDATING = new VersionValidateStatusEnum("UMS_VALIDATING");
private static final Map<String, VersionValidateStatusEnum> STATIC_FIELDS = createStaticFields();
private static Map<String, VersionValidateStatusEnum> createStaticFields() {
Map<String, VersionValidateStatusEnum> map = new HashMap<>();
map.put("NONE", NONE);
map.put("UPLOADING", UPLOADING);
map.put("VALIDATING", VALIDATING);
map.put("OFFLINING", OFFLINING);
map.put("ONLINING", ONLINING);
map.put("UMS_VALIDATING", UMS_VALIDATING);
return Collections.unmodifiableMap(map);
}
private String value;
VersionValidateStatusEnum(String value) {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
@JsonCreator
public static VersionValidateStatusEnum fromValue(String value) {
if (value == null) {
return null;
}
return java.util.Optional.ofNullable(STATIC_FIELDS.get(value)).orElse(new VersionValidateStatusEnum(value));
}
public static VersionValidateStatusEnum valueOf(String value) {
if (value == null) {
return null;
}
return java.util.Optional.ofNullable(STATIC_FIELDS.get(value))
.orElseThrow(() -> new IllegalArgumentException("Unexpected value '" + value + "'"));
}
@Override
public boolean equals(Object obj) {
if (obj instanceof VersionValidateStatusEnum) {
return this.value.equals(((VersionValidateStatusEnum) obj).value);
}
return false;
}
@Override
public int hashCode() {
return this.value.hashCode();
}
}
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "version_validate_status")
private VersionValidateStatusEnum versionValidateStatus;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "display_name")
private String displayName;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "description")
private String description;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "min_ide_version")
private String minIdeVersion;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "max_ide_version")
private String maxIdeVersion;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "version_date")
private OffsetDateTime versionDate;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "preview")
private Boolean preview;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "extension_pack")
private String extensionPack;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "extension_dependencies")
private String extensionDependencies;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "created_at")
private OffsetDateTime createdAt;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "support_ide")
private Integer supportIde;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "repo_url")
private String repoUrl;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "help_page")
private String helpPage;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "website")
private String website;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "issue_link")
private String issueLink;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "asset_size")
private Long assetSize;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "depends")
private List<String> depends = null;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "property_list")
private List<CodeArtsIDEOnlineExtensionVersionProperty> propertyList = null;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "uploader")
private String uploader;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "extension_id")
private String extensionId;
public ExtensionVersionSnake withId(String id) {
this.id = id;
return this;
}
/**
* 插件版本id
* @return id
*/
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public ExtensionVersionSnake withVersion(String version) {
this.version = version;
return this;
}
/**
* 插件版本号
* @return version
*/
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public ExtensionVersionSnake withVersionRanking(Long versionRanking) {
this.versionRanking = versionRanking;
return this;
}
/**
* 版本排序
* minimum: 0
* maximum: 2147483647
* @return versionRanking
*/
public Long getVersionRanking() {
return versionRanking;
}
public void setVersionRanking(Long versionRanking) {
this.versionRanking = versionRanking;
}
public ExtensionVersionSnake withStatus(StatusEnum status) {
this.status = status;
return this;
}
/**
* 插件版本状态 - INIT 待发布 - VALIDATING 审核中 - REJECTED 审核拒绝 - PUBLISHED 插件上架 - OFFLINE 插件下线 - ABANDONED 废弃 - GRAY_INIT 灰度审核 - GRAYED 灰度发布 - GRAY_REJECTED 灰度拒绝
* @return status
*/
public StatusEnum getStatus() {
return status;
}
public void setStatus(StatusEnum status) {
this.status = status;
}
public ExtensionVersionSnake withVersionStatus(VersionStatusEnum versionStatus) {
this.versionStatus = versionStatus;
return this;
}
/**
* 插件状态 - INIT 待发布 - VALIDATING 审核中 - REJECTED 审核拒绝 - PUBLISHED 插件上架 - OFFLINE 插件下线 - ABANDONED 废弃 - GRAY_INIT 灰度审核 - GRAYED 灰度发布 - GRAY_REJECTED 灰度拒绝
* @return versionStatus
*/
public VersionStatusEnum getVersionStatus() {
return versionStatus;
}
public void setVersionStatus(VersionStatusEnum versionStatus) {
this.versionStatus = versionStatus;
}
public ExtensionVersionSnake withAssetUri(String assetUri) {
this.assetUri = assetUri;
return this;
}
/**
* 资源文件url
* @return assetUri
*/
public String getAssetUri() {
return assetUri;
}
public void setAssetUri(String assetUri) {
this.assetUri = assetUri;
}
public ExtensionVersionSnake withLastUpdated(OffsetDateTime lastUpdated) {
this.lastUpdated = lastUpdated;
return this;
}
/**
* 更新时间
* @return lastUpdated
*/
public OffsetDateTime getLastUpdated() {
return lastUpdated;
}
public void setLastUpdated(OffsetDateTime lastUpdated) {
this.lastUpdated = lastUpdated;
}
public ExtensionVersionSnake withFiles(List<ExtensionFileSnake> files) {
this.files = files;
return this;
}
public ExtensionVersionSnake addFilesItem(ExtensionFileSnake filesItem) {
if (this.files == null) {
this.files = new ArrayList<>();
}
this.files.add(filesItem);
return this;
}
public ExtensionVersionSnake withFiles(Consumer<List<ExtensionFileSnake>> filesSetter) {
if (this.files == null) {
this.files = new ArrayList<>();
}
filesSetter.accept(this.files);
return this;
}
/**
* 插件文件集合
* @return files
*/
public List<ExtensionFileSnake> getFiles() {
return files;
}
public void setFiles(List<ExtensionFileSnake> files) {
this.files = files;
}
public ExtensionVersionSnake withValidateMessage(String validateMessage) {
this.validateMessage = validateMessage;
return this;
}
/**
* 插件审核信息
* @return validateMessage
*/
public String getValidateMessage() {
return validateMessage;
}
public void setValidateMessage(String validateMessage) {
this.validateMessage = validateMessage;
}
public ExtensionVersionSnake withVersionValidateStatus(VersionValidateStatusEnum versionValidateStatus) {
this.versionValidateStatus = versionValidateStatus;
return this;
}
/**
* 插件审核状态 - NONE 无 - UPLOADING 上传中 - VALIDATING 系统审核 - OFFLINING 用户申请下线 - ONLINING 用户申请上线 - UMS_VALIDATING 发布商审核中
* @return versionValidateStatus
*/
public VersionValidateStatusEnum getVersionValidateStatus() {
return versionValidateStatus;
}
public void setVersionValidateStatus(VersionValidateStatusEnum versionValidateStatus) {
this.versionValidateStatus = versionValidateStatus;
}
public ExtensionVersionSnake withDisplayName(String displayName) {
this.displayName = displayName;
return this;
}
/**
* 插件展示名称
* @return displayName
*/
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public ExtensionVersionSnake withDescription(String description) {
this.description = description;
return this;
}
/**
* 插件描述
* @return description
*/
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public ExtensionVersionSnake withMinIdeVersion(String minIdeVersion) {
this.minIdeVersion = minIdeVersion;
return this;
}
/**
* 插件支持ide版本
* @return minIdeVersion
*/
public String getMinIdeVersion() {
return minIdeVersion;
}
public void setMinIdeVersion(String minIdeVersion) {
this.minIdeVersion = minIdeVersion;
}
public ExtensionVersionSnake withMaxIdeVersion(String maxIdeVersion) {
this.maxIdeVersion = maxIdeVersion;
return this;
}
/**
* 支持的最大版本
* @return maxIdeVersion
*/
public String getMaxIdeVersion() {
return maxIdeVersion;
}
public void setMaxIdeVersion(String maxIdeVersion) {
this.maxIdeVersion = maxIdeVersion;
}
public ExtensionVersionSnake withVersionDate(OffsetDateTime versionDate) {
this.versionDate = versionDate;
return this;
}
/**
* 发布时间
* @return versionDate
*/
public OffsetDateTime getVersionDate() {
return versionDate;
}
public void setVersionDate(OffsetDateTime versionDate) {
this.versionDate = versionDate;
}
public ExtensionVersionSnake withPreview(Boolean preview) {
this.preview = preview;
return this;
}
/**
* 是否预览
* @return preview
*/
public Boolean getPreview() {
return preview;
}
public void setPreview(Boolean preview) {
this.preview = preview;
}
public ExtensionVersionSnake withExtensionPack(String extensionPack) {
this.extensionPack = extensionPack;
return this;
}
/**
* 包含插件列表
* @return extensionPack
*/
public String getExtensionPack() {
return extensionPack;
}
public void setExtensionPack(String extensionPack) {
this.extensionPack = extensionPack;
}
public ExtensionVersionSnake withExtensionDependencies(String extensionDependencies) {
this.extensionDependencies = extensionDependencies;
return this;
}
/**
* 依赖插件列表
* @return extensionDependencies
*/
public String getExtensionDependencies() {
return extensionDependencies;
}
public void setExtensionDependencies(String extensionDependencies) {
this.extensionDependencies = extensionDependencies;
}
public ExtensionVersionSnake withCreatedAt(OffsetDateTime createdAt) {
this.createdAt = createdAt;
return this;
}
/**
* 创建时间
* @return createdAt
*/
public OffsetDateTime getCreatedAt() {
return createdAt;
}
public void setCreatedAt(OffsetDateTime createdAt) {
this.createdAt = createdAt;
}
public ExtensionVersionSnake withSupportIde(Integer supportIde) {
this.supportIde = supportIde;
return this;
}
/**
* 支持的ide编码
* minimum: 0
* maximum: 2147483647
* @return supportIde
*/
public Integer getSupportIde() {
return supportIde;
}
public void setSupportIde(Integer supportIde) {
this.supportIde = supportIde;
}
public ExtensionVersionSnake withRepoUrl(String repoUrl) {
this.repoUrl = repoUrl;
return this;
}
/**
* 插件包源码仓
* @return repoUrl
*/
public String getRepoUrl() {
return repoUrl;
}
public void setRepoUrl(String repoUrl) {
this.repoUrl = repoUrl;
}
public ExtensionVersionSnake withHelpPage(String helpPage) {
this.helpPage = helpPage;
return this;
}
/**
* 帮助页面
* @return helpPage
*/
public String getHelpPage() {
return helpPage;
}
public void setHelpPage(String helpPage) {
this.helpPage = helpPage;
}
public ExtensionVersionSnake withWebsite(String website) {
this.website = website;
return this;
}
/**
* 产品首页
* @return website
*/
public String getWebsite() {
return website;
}
public void setWebsite(String website) {
this.website = website;
}
public ExtensionVersionSnake withIssueLink(String issueLink) {
this.issueLink = issueLink;
return this;
}
/**
* 问题链接
* @return issueLink
*/
public String getIssueLink() {
return issueLink;
}
public void setIssueLink(String issueLink) {
this.issueLink = issueLink;
}
public ExtensionVersionSnake withAssetSize(Long assetSize) {
this.assetSize = assetSize;
return this;
}
/**
* 插件大小
* minimum: 0
* maximum: 2147483647
* @return assetSize
*/
public Long getAssetSize() {
return assetSize;
}
public void setAssetSize(Long assetSize) {
this.assetSize = assetSize;
}
public ExtensionVersionSnake withDepends(List<String> depends) {
this.depends = depends;
return this;
}
public ExtensionVersionSnake addDependsItem(String dependsItem) {
if (this.depends == null) {
this.depends = new ArrayList<>();
}
this.depends.add(dependsItem);
return this;
}
public ExtensionVersionSnake withDepends(Consumer<List<String>> dependsSetter) {
if (this.depends == null) {
this.depends = new ArrayList<>();
}
dependsSetter.accept(this.depends);
return this;
}
/**
* 依赖插件
* @return depends
*/
public List<String> getDepends() {
return depends;
}
public void setDepends(List<String> depends) {
this.depends = depends;
}
public ExtensionVersionSnake withPropertyList(List<CodeArtsIDEOnlineExtensionVersionProperty> propertyList) {
this.propertyList = propertyList;
return this;
}
public ExtensionVersionSnake addPropertyListItem(CodeArtsIDEOnlineExtensionVersionProperty propertyListItem) {
if (this.propertyList == null) {
this.propertyList = new ArrayList<>();
}
this.propertyList.add(propertyListItem);
return this;
}
public ExtensionVersionSnake withPropertyList(
Consumer<List<CodeArtsIDEOnlineExtensionVersionProperty>> propertyListSetter) {
if (this.propertyList == null) {
this.propertyList = new ArrayList<>();
}
propertyListSetter.accept(this.propertyList);
return this;
}
/**
* CodeArtsIDEOnline插件版本参数
* @return propertyList
*/
public List<CodeArtsIDEOnlineExtensionVersionProperty> getPropertyList() {
return propertyList;
}
public void setPropertyList(List<CodeArtsIDEOnlineExtensionVersionProperty> propertyList) {
this.propertyList = propertyList;
}
public ExtensionVersionSnake withUploader(String uploader) {
this.uploader = uploader;
return this;
}
/**
* 版本发布者
* @return uploader
*/
public String getUploader() {
return uploader;
}
public void setUploader(String uploader) {
this.uploader = uploader;
}
public ExtensionVersionSnake withExtensionId(String extensionId) {
this.extensionId = extensionId;
return this;
}
/**
* 插件id
* @return extensionId
*/
public String getExtensionId() {
return extensionId;
}
public void setExtensionId(String extensionId) {
this.extensionId = extensionId;
}
@Override
public boolean equals(java.lang.Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
ExtensionVersionSnake that = (ExtensionVersionSnake) obj;
return Objects.equals(this.id, that.id) && Objects.equals(this.version, that.version)
&& Objects.equals(this.versionRanking, that.versionRanking) && Objects.equals(this.status, that.status)
&& Objects.equals(this.versionStatus, that.versionStatus) && Objects.equals(this.assetUri, that.assetUri)
&& Objects.equals(this.lastUpdated, that.lastUpdated) && Objects.equals(this.files, that.files)
&& Objects.equals(this.validateMessage, that.validateMessage)
&& Objects.equals(this.versionValidateStatus, that.versionValidateStatus)
&& Objects.equals(this.displayName, that.displayName) && Objects.equals(this.description, that.description)
&& Objects.equals(this.minIdeVersion, that.minIdeVersion)
&& Objects.equals(this.maxIdeVersion, that.maxIdeVersion)
&& Objects.equals(this.versionDate, that.versionDate) && Objects.equals(this.preview, that.preview)
&& Objects.equals(this.extensionPack, that.extensionPack)
&& Objects.equals(this.extensionDependencies, that.extensionDependencies)
&& Objects.equals(this.createdAt, that.createdAt) && Objects.equals(this.supportIde, that.supportIde)
&& Objects.equals(this.repoUrl, that.repoUrl) && Objects.equals(this.helpPage, that.helpPage)
&& Objects.equals(this.website, that.website) && Objects.equals(this.issueLink, that.issueLink)
&& Objects.equals(this.assetSize, that.assetSize) && Objects.equals(this.depends, that.depends)
&& Objects.equals(this.propertyList, that.propertyList) && Objects.equals(this.uploader, that.uploader)
&& Objects.equals(this.extensionId, that.extensionId);
}
@Override
public int hashCode() {
return Objects.hash(id,
version,
versionRanking,
status,
versionStatus,
assetUri,
lastUpdated,
files,
validateMessage,
versionValidateStatus,
displayName,
description,
minIdeVersion,
maxIdeVersion,
versionDate,
preview,
extensionPack,
extensionDependencies,
createdAt,
supportIde,
repoUrl,
helpPage,
website,
issueLink,
assetSize,
depends,
propertyList,
uploader,
extensionId);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ExtensionVersionSnake {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" version: ").append(toIndentedString(version)).append("\n");
sb.append(" versionRanking: ").append(toIndentedString(versionRanking)).append("\n");
sb.append(" status: ").append(toIndentedString(status)).append("\n");
sb.append(" versionStatus: ").append(toIndentedString(versionStatus)).append("\n");
sb.append(" assetUri: ").append(toIndentedString(assetUri)).append("\n");
sb.append(" lastUpdated: ").append(toIndentedString(lastUpdated)).append("\n");
sb.append(" files: ").append(toIndentedString(files)).append("\n");
sb.append(" validateMessage: ").append(toIndentedString(validateMessage)).append("\n");
sb.append(" versionValidateStatus: ").append(toIndentedString(versionValidateStatus)).append("\n");
sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n");
sb.append(" description: ").append(toIndentedString(description)).append("\n");
sb.append(" minIdeVersion: ").append(toIndentedString(minIdeVersion)).append("\n");
sb.append(" maxIdeVersion: ").append(toIndentedString(maxIdeVersion)).append("\n");
sb.append(" versionDate: ").append(toIndentedString(versionDate)).append("\n");
sb.append(" preview: ").append(toIndentedString(preview)).append("\n");
sb.append(" extensionPack: ").append(toIndentedString(extensionPack)).append("\n");
sb.append(" extensionDependencies: ").append(toIndentedString(extensionDependencies)).append("\n");
sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n");
sb.append(" supportIde: ").append(toIndentedString(supportIde)).append("\n");
sb.append(" repoUrl: ").append(toIndentedString(repoUrl)).append("\n");
sb.append(" helpPage: ").append(toIndentedString(helpPage)).append("\n");
sb.append(" website: ").append(toIndentedString(website)).append("\n");
sb.append(" issueLink: ").append(toIndentedString(issueLink)).append("\n");
sb.append(" assetSize: ").append(toIndentedString(assetSize)).append("\n");
sb.append(" depends: ").append(toIndentedString(depends)).append("\n");
sb.append(" propertyList: ").append(toIndentedString(propertyList)).append("\n");
sb.append(" uploader: ").append(toIndentedString(uploader)).append("\n");
sb.append(" extensionId: ").append(toIndentedString(extensionId)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
| [
"[email protected]"
] | |
b39d7a74d9d7c16e32fbee97b5e073556149732c | 90105f7814623298673fa9bcf0bd3e2943a9a506 | /src/main/java/vadikvs/ife/FirmEntity.java | d19f243099d3530bf6ba5ea5bcafe1e733fbb35e | [] | no_license | Vadikvs666/ife | 42e43c72d50e8b53ee3185f8db11fe6b83981202 | 49e1ae20b8f6b9a1c15d98213796ee9c73eb02d9 | refs/heads/master | 2022-07-09T00:27:21.765728 | 2022-06-23T05:13:41 | 2022-06-23T05:13:41 | 89,911,838 | 1 | 0 | null | 2022-06-28T14:45:33 | 2017-05-01T09:24:13 | Java | UTF-8 | Java | false | false | 575 | java | /*
* Автор Вагин Вадим Сергеевич
* e-mail: [email protected]
*/
package vadikvs.ife;
/**
*
* @author vadim
*/
public class FirmEntity {
private Integer id;
private String name;
public FirmEntity(Integer id,String name){
this.id=id;
this.name=name;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| [
"[email protected]"
] | |
161c8d9a5187cb42a3eda757f60535ef5942c68e | 6305a69bc2d70d7a90290faad021d88cc74ad09c | /src/main/java/ac/za/cput/dip/obey/Calculator.java | 3a14d5cf6fb90842cdc95bc1d98e4996fff3fe22 | [] | no_license | crdsmith/CH4 | 04971628f9f6de78d75479b23b908f4faea948c8 | caef4c47dbaace67c2f4fccaf6f8796a00867c45 | refs/heads/master | 2021-01-01T04:55:47.356972 | 2016-05-03T22:05:29 | 2016-05-03T22:05:29 | 57,033,122 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 104 | java | package ac.za.cput.dip.obey;
/**
*
*/
public interface Calculator {
public int calculateAge();
}
| [
"[email protected]"
] | |
162dfdba0e7a8d6efac5856809b3c152b25fd408 | a11baefeebe005ec14ffbc25069e8f64bf9dce51 | /src/main/java/pt/m0rais/crates/manager/InventoryManager.java | d80a1a8817c8aea95f89b09067efad72d8f8eb81 | [] | no_license | M0rais/senior-crates | 7bf4e9eb854493244d9e9b1896c0c79e6127d104 | 676710bf319e9bfdbad76b81ad8c8918242a21d8 | refs/heads/main | 2023-06-15T17:40:00.905678 | 2021-07-11T19:17:30 | 2021-07-11T19:17:30 | 385,004,078 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,304 | java | package pt.m0rais.crates.manager;
import org.bukkit.entity.Player;
import pt.m0rais.crates.SeniorCrates;
import pt.m0rais.crates.listener.InventoryListener;
import pt.m0rais.crates.model.inventory.InventoryBuilder;
import java.util.UUID;
import java.util.WeakHashMap;
public class InventoryManager {
private final WeakHashMap<UUID, InventoryBuilder> inventories;
public InventoryManager(SeniorCrates plugin) {
this.inventories = new WeakHashMap<>();
plugin.getServer().getPluginManager().registerEvents(new InventoryListener(this), plugin);
}
public void open(Player player, InventoryBuilder builder) {
inventories.remove(player.getUniqueId());
inventories.put(player.getUniqueId(), builder);
player.openInventory(builder.build());
}
public void close(Player p) {
if (!inventories.containsKey(p.getUniqueId()))
return;
inventories.remove(p.getUniqueId());
}
public boolean hasInventoryBuilder(Player player, InventoryBuilder builder) {
UUID uuid = player.getUniqueId();
if (!inventories.containsKey(uuid)) return false;
return inventories.get(uuid) == builder;
}
public WeakHashMap<UUID, InventoryBuilder> getInventories() {
return inventories;
}
}
| [
"[email protected]"
] | |
27de2992deb7fa8cd8efb5e2d28708bfefc0de4d | c5a0191cec7eaf2080c7fe3c1e04b6cab54000ba | /src/prof_solved/mid_solved/ch6/Q6_A.java | 4054ee5238ba031230aeaeb0e47d9d381ba6901c | [] | no_license | yks095/SolvingProb | 719700944fd49900e88498be7790c8ad034f6ab5 | 24f593d56c8ef9d85d968fca907e604f508f5e2e | refs/heads/master | 2020-07-16T08:29:41.922867 | 2020-04-02T14:30:12 | 2020-04-02T14:30:12 | 205,754,398 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 59 | java | package prof_solved.mid_solved.ch6;
public class Q6_A {
}
| [
"[email protected]"
] | |
76227387c19ee435dbc4641f6bb17ee0ff33e15b | aecd3fa75cd52b06a9ba041913883fcff5f1d22a | /modules/czsem-gate-plugin/src/main/java/czsem/gate/utils/GateAwareTreeIndexExtended.java | ba740b99526979776cbd250a1ea51b61370b97f0 | [
"Apache-2.0"
] | permissive | datlowe/czsem-gate-tools | 85ffd0afb041bd4077badb3cc276390aed779ee6 | 4e18604020b571be007570fdd4836a2b9aba1d86 | refs/heads/master | 2023-08-06T17:05:13.959348 | 2023-07-24T13:05:54 | 2023-07-24T13:05:54 | 75,639,614 | 1 | 1 | Apache-2.0 | 2023-09-06T15:07:59 | 2016-12-05T15:39:20 | Java | UTF-8 | Java | false | false | 1,740 | java | package czsem.gate.utils;
import gate.Annotation;
import gate.AnnotationSet;
import gate.Document;
import gate.creole.ontology.Ontology;
import java.util.HashMap;
import java.util.Map;
public class GateAwareTreeIndexExtended extends GateAwareTreeIndex {
protected AnnotationSet nodesAS;
protected Map<Integer, Annotation> annIdMap = new HashMap<>();
protected Map<Integer, String> annIdDependecyKindMap = new HashMap<>();
protected final Document document;
protected Ontology ontology;
public GateAwareTreeIndexExtended(Document document) {
this.document = document;
}
public Map<Integer, Annotation> getAnnIdMap() {
return annIdMap;
}
public Map<Integer, String> getDependecyTypeMap() {
return annIdDependecyKindMap;
}
public AnnotationSet getNodesAS() {
return nodesAS;
}
public void setNodesAS(AnnotationSet nodesAS) {
this.nodesAS = nodesAS;
}
@Override
protected void addNode(Integer id) {
super.addNode(id);
if (nodesAS != null)
annIdMap.put(id, nodesAS.get(id));
}
@Override
public void addDependency(Annotation parentAnn, Annotation childAnn, String dependencyType) {
super.addDependency(parentAnn, childAnn, dependencyType);
addNodeAnnotation(parentAnn);
addNodeAnnotation(childAnn);
}
protected void addNodeAnnotation(Annotation a) {
annIdMap.put(a.getId(), a);
}
@Override
public void addDependency(Integer parent, Integer child, String dependencyType) {
super.addDependency(parent, child, dependencyType);
annIdDependecyKindMap.put(child, dependencyType);
}
public Document getDocument() {
return document;
}
public Ontology getOntology() {
return ontology;
}
public void setOntology(Ontology ontology) {
this.ontology = ontology;
}
}
| [
"[email protected]"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.