blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2
values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 9.45M | extension stringclasses 28
values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
99afe0c3bddcd34958d4b9aae066f15086e232a9 | 30483d30ca4f8ca149f16c8d5a0266f948f0f02a | /jswingripples/src/main/java/org/incha/core/jswingripples/parser/Analyzer.java | d0a8fc55f2f8b842a045092e9b44a13a10c0e067 | [] | no_license | samhv/jedit_cc4401 | 0959b2374c133c023086e295aed4c4673b916e2f | 97cde3d6418f344985ce6be5c880d36afd34afa1 | refs/heads/master | 2020-05-17T00:45:23.157380 | 2015-08-19T16:50:18 | 2015-08-19T16:50:18 | 33,628,761 | 5 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,207 | java | package org.incha.core.jswingripples.parser;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
import org.incha.compiler.dom.JavaDomUtils;
import org.incha.core.jswingripples.MethodOverrideTester;
import org.incha.core.jswingripples.TypeHierarchySupport;
import org.incha.core.jswingripples.eig.JSwingRipplesEIG;
import org.incha.core.jswingripples.eig.JSwingRipplesEIGNode;
import org.incha.ui.JSwingRipplesApplication;
import org.incha.ui.TaskProgressMonitor;
import org.incha.ui.util.SubProgressMonitor;
class Analyzer extends Thread {
private static final Log log = LogFactory.getLog(Analyzer.class);
private boolean accountForPolymorphism=false;
private final TaskProgressMonitor monitor;
private JSwingRipplesEIG eig;
public Analyzer(final JSwingRipplesEIG eig, final TaskProgressMonitor mon) {
this.monitor=mon;
this.eig = eig;
}
public void setAccountForPolymorphismMode(final boolean accountForPolymorphism) {
this.accountForPolymorphism=accountForPolymorphism;
}
public boolean getAccountForPolymorphismMode() {
return accountForPolymorphism;
}
@Override
public void run() {
try {
try {
final ICompilationUnit[] units = JavaDomUtils.getCompilationUnits(
eig.getJavaProject(), monitor);
if (units.length > 0) {
//initially add all nodes
for (final ICompilationUnit u : units) {
final List<IJavaElement> allNodes = JavaDomUtils.getAllNodes(u);
for (final IJavaElement el : allNodes) {
if (el instanceof IMember) {
eig.addNode((IMember) el);
}
}
}
final Map<IMethod, HashSet<IMethod>> overrides = loadMembers(units);
processEdges(units, overrides);
}
} catch (final Exception e) {
}
} catch (final Exception e) {
}
}
private Map<IMethod,HashSet <IMethod>> loadMembers(final ICompilationUnit[] units) {
final Map<IMethod, HashSet<IMethod>> overridesMap = new HashMap<IMethod, HashSet<IMethod>>();
try {
monitor.setTaskName("Looking for classes in the project");
final IType types[] = JavaDomUtils.getAllTypes(units);
final TaskProgressMonitor typesMonitor=new SubProgressMonitor(monitor);
final TypeHierarchySupport hierarchy = new TypeHierarchySupport(types);
final MethodOverrideTester tester=new MethodOverrideTester(null, hierarchy);
final HashSet <IMethod> overrides=new HashSet <IMethod>();
try {
typesMonitor.beginTask("Populating database", types.length);
for (int i = 0; i < types.length; i++) {
final IType type = types[i];
if (!type.isBinary() && !(type.isMember())) {
typesMonitor.setTaskName("Process class " + type.getElementName());
final IMethod[] methods=type.getMethods();
final TaskProgressMonitor tmpMonitor = new SubProgressMonitor(typesMonitor);
tmpMonitor.beginTask("Process methods of "
+ type.getFullyQualifiedName() , methods.length);
try {
for (int j= 0;j < methods.length;j++) {
tmpMonitor.setTaskName("Process method " + methods[j] + " of " + type.getElementName());
if (accountForPolymorphism) {
if (hierarchy.getSuperclass(type) != null) {
tester.setFocusType(type);
tester.findAllDeclaringMethods(methods[j],true,overrides);
tmpMonitor.worked(1);
if (overrides.size()>0) {
for (final IMethod m : overrides) {
if (!overridesMap.containsKey(m)) overridesMap.put(m, new HashSet<IMethod> ());
overridesMap.get(m).add(methods[j]);
}
}
tmpMonitor.worked(2);
overrides.clear();
}
}
tmpMonitor.worked(j);
}
} finally {
tmpMonitor.done();
}
}
if (monitor.isCanceled()) {
return overridesMap;
}
typesMonitor.worked(i);
}
}
finally {
typesMonitor.done();
}
} catch (final Exception e) {
log.error(e);
}
return overridesMap;
}
private void processEdges(final ICompilationUnit[] units,
final Map<IMethod, HashSet<IMethod>> overrides) {
final TaskProgressMonitor subMonitor= new SubProgressMonitor(JSwingRipplesApplication.getInstance().getProgressMonitor());
try {
subMonitor.beginTask("Analysing files",units.length);
//----------------------
for (int i=0;i<units.length;i++) {
final ICompilationUnit unit = units[i];
processEdges(unit, eig.getJavaProject().getName(), units, overrides);
subMonitor.worked(i);
subMonitor.setTaskName("Analyzing "+unit.getElementName()+" ("+ i +" out of "+units.length+")");
}
subMonitor.done();
} catch (final Exception e) {
log.error(e);
}
}
/**
* @param unit
* @param projectName
* @param units
* @param overrides
* @throws JavaModelException
*/
public void processEdges(final ICompilationUnit unit, final String projectName,
final ICompilationUnit[] units, final Map<IMethod, HashSet<IMethod>> overrides) throws JavaModelException {
if (monitor.isCanceled()) {
return;
}
final Set<Edge> edges = EdgesCalculator.getEdges(eig.getJavaProject(), unit, units);
final Iterator<Edge> iter = edges.iterator();
while (iter.hasNext()) {
final Edge edge = iter.next();
final IMember mem1= edge.getFrom();
final IMember mem2= edge.getTo();
final JSwingRipplesEIGNode node1= eig.getNode(mem1);
final JSwingRipplesEIGNode node2= eig.getNode(mem2);
if (node1!=null && node2!=null) {
eig.addEdge(node1, node2);
if (accountForPolymorphism)
if ((mem1 instanceof IMethod) && (mem2 instanceof IMethod)) {
if (overrides.containsKey(mem2))
for (final IMethod m : overrides.get(mem2)) {
eig.addEdge(node1, eig.getNode(m));
}
}
}
}
}
}
| [
"francisco.peters@ing.uchile.cl"
] | francisco.peters@ing.uchile.cl |
34e9b60a51c271cc69ea36b56840dd81634f2024 | ea544a9bf56ff56063047b8b6965643bf16c754a | /Pieces.java | 6554fea9eb83abfee77bbde50299ff57c011dda4 | [] | no_license | chrislogo/stratego | 5eb8672bfbbb75bd75d5a9baba900c7ee7444469 | 823abd7d029f47cf38d16739509c55ba689e4e4e | refs/heads/master | 2021-01-10T13:04:08.227649 | 2016-04-07T23:45:47 | 2016-04-07T23:45:47 | 55,735,512 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,994 | java | package components;
// This class stores the fixed values of ranks of pieces
// It also stores the amount of pieces a player sets and
// how many of their pieces are removed from the board.
public class Pieces
{
// rank
public static final int FLAG = 0;
public static final int SPY = 1;
public static final int SCOUT = 2;
public static final int MINER = 3;
public static final int SERGEANT = 4;
public static final int LIEUTENANT = 5;
public static final int CAPTAIN = 6;
public static final int MAJOR = 7;
public static final int COLONEL = 8;
public static final int GENERAL = 9;
public static final int MARSHALL = 10;
public static final int BOMB = 11;
// max allowed on board for 1 player
public static final int MAX_FLAG = 1;
public static final int MAX_SPY = 1;
public static final int MAX_SCOUT = 8;
public static final int MAX_MINER = 5;
public static final int MAX_SERGEANT = 4;
public static final int MAX_LIEUTENANT = 4;
public static final int MAX_CAPTAIN = 4;
public static final int MAX_MAJOR = 3;
public static final int MAX_COLONEL = 2;
public static final int MAX_GENERAL = 1;
public static final int MAX_MARSHALL = 1;
public static final int MAX_BOMB = 6;
// stores array of set and removed pieces
public int[] set;
public int[] removed;
public Pieces()
{
int i;
set = new int[12];
removed = new int[12];
for(i = 0; i < 12; i++)
{
set[i] = 0;
removed[i] = 0;
}
}
//subtracts an available piece for a play to set on the board
// since it is being set now
public void Sub_Piece_Set(int slot)
{
switch (slot)
{
case FLAG: set[FLAG]++;
break;
case SPY: set[SPY]++;
break;
case SCOUT: set[SCOUT]++;
break;
case MINER: set[MINER]++;
break;
case SERGEANT: set[SERGEANT]++;
break;
case LIEUTENANT: set[LIEUTENANT]++;
break;
case CAPTAIN: set[CAPTAIN]++;
break;
case MAJOR: set[MAJOR]++;
break;
case COLONEL: set[COLONEL]++;
break;
case GENERAL: set[GENERAL]++;
break;
case MARSHALL: set[MARSHALL]++;
break;
case BOMB: set[BOMB]++;
break;
}
}
// increment player's piece removed
public void Add_Piece_Removed(int slot)
{
switch (slot)
{
case FLAG: removed[FLAG]++;
break;
case SPY: removed[SPY]++;
break;
case SCOUT: removed[SCOUT]++;
break;
case MINER: removed[MINER]++;
break;
case SERGEANT: removed[SERGEANT]++;
break;
case LIEUTENANT: removed[LIEUTENANT]++;
break;
case CAPTAIN: removed[CAPTAIN]++;
break;
case MAJOR: removed[MAJOR]++;
break;
case COLONEL: removed[COLONEL]++;
break;
case GENERAL: removed[GENERAL]++;
break;
case MARSHALL: removed[MARSHALL]++;
break;
case BOMB: removed[BOMB]++;
break;
}
}
// reset player pieces upon restart of game
public void Reset_Pieces()
{
int i;
for(i = 0; i < 12; i++)
{
set[i] = 0;
removed[i] = 0;
}
}
} | [
"chris7775@hotmail.com"
] | chris7775@hotmail.com |
09175a92dd9ab0e97f9992b39b2ec6bbbd0672b9 | bd1b58e7a5c31cb56d760105a287d60b58fbae35 | /src/main/java/com/fourbears/mall/mapper/UmsRolePermissionRelationMapper.java | 0b9e690cc6ab9d194b30d06b1a3c11898265fbd0 | [] | no_license | DataseekCN/pricetag | 43fd3eb6a24d515fcadfefadd735cf28449663bc | 6faa67564e8c2f2c0151df4461b0e1037afedb6a | refs/heads/master | 2020-04-16T17:16:54.335742 | 2019-02-18T02:27:31 | 2019-02-18T02:27:31 | 165,770,266 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,167 | java | package com.fourbears.mall.mapper;
import com.fourbears.mall.model.UmsRolePermissionRelation;
import com.fourbears.mall.model.UmsRolePermissionRelationExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface UmsRolePermissionRelationMapper {
int countByExample(UmsRolePermissionRelationExample example);
int deleteByExample(UmsRolePermissionRelationExample example);
int deleteByPrimaryKey(Long id);
int insert(UmsRolePermissionRelation record);
int insertSelective(UmsRolePermissionRelation record);
List<UmsRolePermissionRelation> selectByExample(UmsRolePermissionRelationExample example);
UmsRolePermissionRelation selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") UmsRolePermissionRelation record, @Param("example") UmsRolePermissionRelationExample example);
int updateByExample(@Param("record") UmsRolePermissionRelation record, @Param("example") UmsRolePermissionRelationExample example);
int updateByPrimaryKeySelective(UmsRolePermissionRelation record);
int updateByPrimaryKey(UmsRolePermissionRelation record);
} | [
"18602552505@126.com"
] | 18602552505@126.com |
ddb62369d707065256258eb1c2078f41a0398a76 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/22/22_e1c639a21e31ffa618bab7cc197c965eac338909/Invoice/22_e1c639a21e31ffa618bab7cc197c965eac338909_Invoice_t.java | 41bb7dc0fb2c19279c9b4fe91464a0af78fa7254 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 10,546 | java | //
// Copyright (c) 2011 Linkeos.
//
// This file is part of Elveos.org.
// Elveos.org 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.
//
// Elveos.org 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 Elveos.org. If not, see http://www.gnu.org/licenses/.
//
package com.bloatit.model;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.Date;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.bloatit.data.DaoBug.Level;
import com.bloatit.data.DaoInvoice;
import com.bloatit.framework.utils.datetime.DateUtils;
import com.bloatit.model.invoicePdf.InvoicePdfGenerator;
import com.bloatit.model.right.Action;
import com.bloatit.model.right.RgtInvoice;
import com.bloatit.model.right.UnauthorizedPrivateAccessException;
/**
* This is a invoice.
*/
public final class Invoice extends Identifiable<DaoInvoice> {
// /////////////////////////////////////////////////////////////////////////////////////////
// CONSTRUCTION
// /////////////////////////////////////////////////////////////////////////////////////////
/**
* This class implements the method pattern, implementing the doCreate
* method. See the base class for more informations: {@link Creator}.
*/
private static final class MyCreator extends Creator<DaoInvoice, Invoice> {
/*
* (non-Javadoc)
* @see
* com.bloatit.model.Creator#doCreate(com.bloatit.data.DaoIdentifiable)
*/
@SuppressWarnings("synthetic-access")
@Override
public Invoice doCreate(final DaoInvoice dao) {
return new Invoice(dao);
}
}
/**
* Find a bug in the cache or create an new one.
*
* @param dao the dao
* @return null if dao is null. Else return the new invoice.
*/
@SuppressWarnings("synthetic-access")
public static Invoice create(final DaoInvoice dao) {
return new MyCreator().create(dao);
}
/**
* Instantiates a new invoice.
*
* @param dao the dao
*/
private Invoice(final DaoInvoice dao) {
super(dao);
}
/**
* Create a new Invoice.
*
* @param member is the author of the bug.
* @param milestone is the milestone on which this bug has been set.
* @param title is the title of the bug.
* @param description is a complete description of the bug.
* @param locale is the language in which this description has been written.
* @param errorLevel is the estimated level of the bug. see {@link Level}.
* @throws UnauthorizedPrivateAccessException
*/
Invoice(final Actor<?> recipientActor, final BigDecimal totalPrice, final String deliveryName) throws UnauthorizedPrivateAccessException {
super(generateInvoice(recipientActor, totalPrice, deliveryName));
}
public String getFile() throws UnauthorizedPrivateAccessException {
tryAccess(new RgtInvoice.File(), Action.READ);
return getDao().getFile();
}
public String getInvoiceNumber() throws UnauthorizedPrivateAccessException {
tryAccess(new RgtInvoice.InvoiceNumber(), Action.READ);
return getDao().getInvoiceNumber();
}
// /////////////////////////////////////////////////////////////////////////////////////////
// Visitor
// /////////////////////////////////////////////////////////////////////////////////////////
private static DaoInvoice generateInvoice(final Actor<?> recipientActor, final BigDecimal totalPrice, final String deliveryName)
throws UnauthorizedPrivateAccessException {
final String invoiceType = "Elveos's fee invoice";
BigDecimal internalInvoiceNumber = BigDecimal.ZERO;
final BigDecimal lastInternalInvoiceNumber = DaoInvoice.getMaxInvoiceNumber();
if (lastInternalInvoiceNumber != null) {
internalInvoiceNumber = lastInternalInvoiceNumber.add(BigDecimal.ONE);
}
final String invoiceId = generateInvoiceId(ModelConfiguration.getLinkeosInvoiceTemplate(), internalInvoiceNumber);
final String sellerName = ModelConfiguration.getLinkeosName();
final String sellerStreet = ModelConfiguration.getLinkeosStreet();
final String sellerExtras = ModelConfiguration.getLinkeosExtras();
final String sellerCity = ModelConfiguration.getLinkeosCity();
final String sellerCountry = ModelConfiguration.getLinkeosCountry();
final String sellerTaxId = ModelConfiguration.getLinkeosTaxIdentification();
final String sellerLegalId = ModelConfiguration.getLinkeosLegalIdentification();
final BigDecimal taxRate = ModelConfiguration.getLinkeosTaxesRate();
final BigDecimal priceExcludingTax = totalPrice.divide(BigDecimal.ONE.add(taxRate), BigDecimal.ROUND_HALF_EVEN);
final BigDecimal taxAmount = totalPrice.subtract(priceExcludingTax);
Contact recipientContact = recipientActor.getContactUnprotected();
final String receiverName = recipientContact.getName();
final String receiverStreet = recipientContact.getStreet();
final String receiverExtras = recipientContact.getExtras();
final String receiverCity = recipientContact.getPostalCode() + " " + recipientContact.getCity();
final String receiverCountry = recipientContact.getCountry();
final Date invoiceDate = DateUtils.now();
final InvoicePdfGenerator pdfGenerator = new InvoicePdfGenerator(invoiceType,
invoiceId,
sellerName,
sellerStreet,
sellerExtras,
sellerCity,
sellerCountry,
receiverName,
receiverStreet,
receiverExtras,
receiverCity,
receiverCountry,
invoiceDate,
deliveryName,
priceExcludingTax,
taxRate,
taxAmount,
totalPrice,
sellerLegalId,
sellerTaxId);
return DaoInvoice.createAndPersist(recipientActor.getDao(),
pdfGenerator.getPdfUrl(),
invoiceType,
invoiceId,
sellerName,
sellerStreet,
sellerExtras,
sellerCity,
sellerCountry,
receiverName,
receiverStreet,
receiverExtras,
receiverCity,
receiverCountry,
invoiceDate,
deliveryName,
priceExcludingTax,
taxRate.multiply(new BigDecimal("100")),
taxAmount,
totalPrice,
internalInvoiceNumber,
sellerLegalId,
sellerTaxId);
}
private static String generateInvoiceId(final String linkeosInvoiceTemplate, final BigDecimal internalInvoiceNumber) {
final Pattern p = Pattern.compile("^(.*)\\{invoice_number\\|length=([0-9]+)}(.*)$");
final Matcher m = p.matcher(linkeosInvoiceTemplate);
if (m.matches()) {
final int size = Integer.valueOf(m.group(2));
final int intValue = internalInvoiceNumber.intValue();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < size; i++) {
sb.append("0");
}
final NumberFormat nf = new DecimalFormat(sb.toString());
return m.group(1) + nf.format(intValue) + m.group(3);
}
return linkeosInvoiceTemplate;
}
@Override
public <ReturnType> ReturnType accept(final ModelClassVisitor<ReturnType> visitor) {
return visitor.visit(this);
}
// ///////////////////////////
// Unprotected methods
/**
* This method is used only in the authentication process. You should never
* used it anywhere else.
*
* @return the actor unprotected
* @see #getActor()
*/
final Actor<?> getRecipientActorUnprotected() {
return (Actor<?>) getDao().getRecipientActor().accept(new DataVisitorConstructor());
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
9bafa26d0cc41517101795bdd99fb86ad0306a00 | ef87f1c3398d033e2e880f8fdfb8c2410e79f553 | /abce36/src/main/java/com/fastcode/abce36/domain/core/country/ICountryRepository.java | 04b03621faa35e850aa7a06515eab505ac584335 | [] | no_license | musman013/musman013-sampleApplication-1 | b40662ad1b3f78b2898381834012dd2bb17ed16a | 493966ae8e5aa8666b298f7c302679bea4be9625 | refs/heads/master | 2023-02-08T16:28:42.116109 | 2021-01-01T08:46:00 | 2021-01-01T08:46:00 | 325,945,469 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 432 | java | package com.fastcode.abce36.domain.core.country;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
import org.springframework.stereotype.Repository;
import java.util.*;
import java.time.*;
@Repository("countryRepository")
public interface ICountryRepository extends JpaRepository<CountryEntity, Integer>,QuerydslPredicateExecutor<CountryEntity> {
}
| [
"info@nfinityllc.com"
] | info@nfinityllc.com |
1c08d1c470d3522f7147f8977ee4b0f06dd2457d | b464bb959f73f1e8de4c9d6422b8cd789c3eac01 | /JIRA plugins/project-indicators/src/main/java/dbaccess/DAO.java | d471bdb5d4a827c79375f57b73fe86da05183811 | [] | no_license | erikgotera/codes | b84b815332bc04efb0abb9ec33e465d24894a55a | b8ec84567f250428cac9472a7ab577a32b522dc8 | refs/heads/master | 2020-05-17T08:31:28.407851 | 2013-07-10T17:42:11 | 2013-07-10T17:42:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 755 | java | package dbaccess;
import java.sql.*;
public class DAO {
private Connection connexio;
private Statement sentencia;
public DAO() throws Exception{
String user = "in2_int";
String password = "jiraint";
//Class.forName("com.oracle.jdbc.driver.OracleDriver").newInstance();
DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
connexio = DriverManager.getConnection("jdbc:oracle:thin:@bd01prod:1521:bdqportal", user, password);
sentencia = connexio.createStatement();
}
//Executa consultes
public ResultSet executarSQL(String query) throws SQLException{
return sentencia.executeQuery(query);
}
public void desconnectarBD() throws SQLException{
sentencia.close();
connexio.close();
}
} | [
"egl55@yahoo.es"
] | egl55@yahoo.es |
fcbdb94a3cc0f505eec1ec2e0c60b797a7c106d8 | 139960e2d7d55e71c15e6a63acb6609e142a2ace | /mobile_app1/module1255/src/main/java/module1255packageJava0/Foo24.java | 5d9a05edfbc5608d12204a273fbc036c96ae6874 | [
"Apache-2.0"
] | permissive | uber-common/android-build-eval | 448bfe141b6911ad8a99268378c75217d431766f | 7723bfd0b9b1056892cef1fef02314b435b086f2 | refs/heads/master | 2023-02-18T22:25:15.121902 | 2023-02-06T19:35:34 | 2023-02-06T19:35:34 | 294,831,672 | 83 | 7 | Apache-2.0 | 2021-09-24T08:55:30 | 2020-09-11T23:27:37 | Java | UTF-8 | Java | false | false | 431 | java | package module1255packageJava0;
import java.lang.Integer;
public class Foo24 {
Integer int0;
Integer int1;
public void foo0() {
new module1255packageJava0.Foo23().foo6();
}
public void foo1() {
foo0();
}
public void foo2() {
foo1();
}
public void foo3() {
foo2();
}
public void foo4() {
foo3();
}
public void foo5() {
foo4();
}
public void foo6() {
foo5();
}
}
| [
"oliviern@uber.com"
] | oliviern@uber.com |
f461fc6c1559694585e3160b3e49c944c0b1788e | f3f93c4ea9a4996eacf1ef1d643aef5fa214e6f9 | /src/main/java/com/ankamagames/dofus/core/network/Crypto.java | e454dbc8941ad57cad91a73529e675505872d63a | [
"MIT"
] | permissive | ProjectBlackFalcon/BlackFalconAPI | fb94774056eacd053b3daf0931a9ef9c0fb477f6 | b038f2f1bc300e549b5f6469c82530b6245f54e2 | refs/heads/master | 2022-12-05T09:58:36.499535 | 2019-10-02T21:58:54 | 2019-10-02T21:58:54 | 188,725,082 | 6 | 0 | MIT | 2022-11-16T12:22:14 | 2019-05-26T19:49:10 | Java | UTF-8 | Java | false | false | 4,291 | java | package com.ankamagames.dofus.core.network;
import java.io.ByteArrayOutputStream;
import java.nio.charset.Charset;
import java.security.KeyFactory;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.X509EncodedKeySpec;
import java.util.Base64;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import com.ankamagames.dofus.network.utils.DofusDataWriter;
public class Crypto {
private static final int AES_KEY_LENGTH = 32;
private static byte[] AES_KEY;
private static final String PUBLIC_KEY =
"MIIBUzANBgkqhkiG9w0BAQEFAAOCAUAAMIIBOwKCATIAgucoka9J2PXcNdjcu6CuDmgteIMB+rih"+
"2UZJIuSoNT/0J/lEKL/W4UYbDA4U/6TDS0dkMhOpDsSCIDpO1gPG6+6JfhADRfIJItyHZflyXNUj"+
"WOBG4zuxc/L6wldgX24jKo+iCvlDTNUedE553lrfSU23Hwwzt3+doEfgkgAf0l4ZBez5Z/ldp9it"+
"2NH6/2/7spHm0Hsvt/YPrJ+EK8ly5fdLk9cvB4QIQel9SQ3JE8UQrxOAx2wrivc6P0gXp5Q6bHQo"+
"ad1aUp81Ox77l5e8KBJXHzYhdeXaM91wnHTZNhuWmFS3snUHRCBpjDBCkZZ+CxPnKMtm2qJIi57R"+
"slALQVTykEZoAETKWpLBlSm92X/eXY2DdGf+a7vju9EigYbX0aXxQy2Ln2ZBWmUJyZE8B58CAwEA"+
"AQ==";
public static byte[] encrypt(byte[] encryptedKey, String login, String password, String salt) throws Exception {
byte[] decryptedKey = decryptReceivedKey(encryptedKey);
return encryptCredentials(decryptedKey, login, password, salt);
}
private static byte[] decryptReceivedKey(byte[] receivedKey) {
byte[] resultKey = null;
try {
byte[] decodedKey = Base64.getDecoder().decode(PUBLIC_KEY);
X509EncodedKeySpec spec = new X509EncodedKeySpec(decodedKey);
KeyFactory kf = KeyFactory.getInstance("RSA");
RSAPublicKey pk = (RSAPublicKey) kf.generatePublic(spec);
Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
cipher.init(Cipher.DECRYPT_MODE, pk);
resultKey = cipher.doFinal(receivedKey);
} catch (Exception e) {
e.printStackTrace();
}
return resultKey;
}
private static byte[] encryptCredentials(byte[] key, String login, String password, String salt) throws Exception {
byte[] encryptedCredentials = null;
ByteArrayOutputStream ous = new ByteArrayOutputStream();
DofusDataWriter buffer = new DofusDataWriter(ous);
buffer.write(salt.getBytes());
buffer.write(generateRandomAESKey());
buffer.writeByte((byte)login.length());
buffer.write(login.getBytes());
buffer.write(password.getBytes());
try {
KeyFactory kf = KeyFactory.getInstance("RSA");
X509EncodedKeySpec x509 = new X509EncodedKeySpec(key);
RSAPublicKey publicKey = (RSAPublicKey) kf.generatePublic(x509);
Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
encryptedCredentials = cipher.doFinal(ous.toByteArray());
} catch (Exception e) {
e.printStackTrace();
}
return encryptedCredentials;
}
private static byte[] generateRandomAESKey() throws Exception {
ByteArrayOutputStream ous = new ByteArrayOutputStream();
DofusDataWriter array = new DofusDataWriter(ous);
for(int i = 0; i < AES_KEY_LENGTH; ++i)
array.writeByte((byte)Math.floor(Math.random() * 256));
AES_KEY = ous.toByteArray();
return ous.toByteArray();
}
public static String decryptAESkey(byte[] encryptedData)
{
try
{
Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");
byte[] iv = new byte[cipher.getBlockSize()];
System.arraycopy(AES_KEY, 0, iv, 0, 16);
IvParameterSpec ivParameterSpec = new IvParameterSpec(iv);
SecretKeySpec secretKey = new SecretKeySpec(AES_KEY, "AES");
cipher.init(Cipher.DECRYPT_MODE, secretKey,ivParameterSpec);
byte[] resultbytes = cipher.doFinal(encryptedData);
return new String(resultbytes,Charset.forName("utf-8"));
}
catch (Exception e)
{
e.printStackTrace();
}
return null;
}
}
| [
"baptiste.beduneau@reseau.eseo.fr"
] | baptiste.beduneau@reseau.eseo.fr |
0f148290df83732004f4df790c41ef69b95c6f6b | a9c022acee71ec7e875639b56835bee606036d69 | /src/main/java/com/macro/mall/cms/bean/CMS000003.java | cec3ab75b60e9a7f0ba11935641bf4e70add79ef | [] | no_license | barve616/mall-admin | 04eea681b6d4c1707cac5e10ec90f4bf48ac75ce | aee39759a4a5b4aeacc2d07879a4c1bfbccb63ad | refs/heads/master | 2022-12-06T22:48:12.603677 | 2020-08-21T01:38:09 | 2020-08-21T01:38:09 | 288,946,877 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,515 | java | package com.macro.mall.cms.bean;
public class CMS000003 {
/**
*客户端查询
*/
private static final long serialVersionUID = -6664637872592223125L;
private String userPlt;
private String cityId;
private String peopleType;
private String state;
private String startTime;
private String endTime;
private String type;
private String pageId;
private String pSortId;
public String getpSortId() {
return pSortId;
}
public void setpSortId(String pSortId) {
this.pSortId = pSortId;
}
public String getUserPlt() {
return userPlt;
}
public void setUserPlt(String userPlt) {
this.userPlt = userPlt;
}
public String getCityId() {
return cityId;
}
public void setCityId(String cityId) {
this.cityId = cityId;
}
public String getPeopleType() {
return peopleType;
}
public void setPeopleType(String peopleType) {
this.peopleType = peopleType;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getStartTime() {
return startTime;
}
public void setStartTime(String startTime) {
this.startTime = startTime;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getPageId() {
return pageId;
}
public void setPageId(String pageId) {
this.pageId = pageId;
}
}
| [
"120108758@qq.com"
] | 120108758@qq.com |
35e9774132e5feb0e7de93a5a33d694914d08b82 | a2881dfb3246eebda78c695ede7f5aa0b426aec9 | /1.7.10 obfuscated/s/sj.java | 6b03c7dde378d175b13d08db0d0b7d53300bd463 | [] | no_license | Jckf/mc-dev | ca03c1907b4b33c94a7bcb7a2067e3963bbf05d2 | 128dae1fe7e2b7772d89dcf130a49210bfd06aa3 | refs/heads/master | 2016-09-05T11:14:19.324416 | 2014-10-01T00:53:05 | 2014-10-01T00:53:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 112 | java |
public interface sj {
sj a = new sk();
sj b = new sl();
sj c = new sm();
boolean a(sa var1);
}
| [
"jckf@jckf.no"
] | jckf@jckf.no |
c8815acd302c89eb01ed95e589bb10cae2fb66a0 | 731555a98d91c7a33c1d1d5ab4d2466aa2e6262f | /app/src/main/java/com/sunnyweather/android/logic/model/PlaceResponse.java | 67fd2512a806b80b8bc8554038f068ca31d80e46 | [] | no_license | Comic-dot/SunnyWeather | 16a425864643d9a2665962de63e57d8937750dbe | 3d4c53bf2295f2921f7bf4fd08b6936c511418c8 | refs/heads/main | 2023-02-12T10:49:19.763561 | 2021-01-08T13:05:47 | 2021-01-08T13:05:47 | 326,633,387 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 495 | java | package com.sunnyweather.android.logic.model;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class PlaceResponse {
String status;
List<Place> places;
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public List<Place> getPlaces() {
return places;
}
public void setPlaces(List<Place> places) {
this.places = places;
}
}
| [
"2216960672@qq.com"
] | 2216960672@qq.com |
15ec62e3097370a73584ad994b46e82aa424af40 | cd7a414b4e8833bf5b10addaae454139b41fd000 | /assignment4/src/test/java/com/utm/csc/ToolPanelTest.java | c2ccba70532915d042d809845da87e46d5509a50 | [] | no_license | ktajali/TicTacToe | 18338773ef90d6621bab0a7979c83647637d1a09 | 33a9f030114fa30c439273fe35e86f53ec074227 | refs/heads/master | 2020-09-23T12:58:22.774839 | 2016-04-03T20:53:31 | 2016-04-03T20:53:31 | 65,947,210 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 825 | java | package com.utm.csc;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
import javax.swing.JButton;
public class ToolPanelTest {
private ToolPanel toolPanel;
@Before
public void setUp()
{
}
@Test
public void testReset()
{
TicTacToe game = mock(TicTacToe.class);
GamePanel gp = mock(GamePanel.class);
toolPanel = new ToolPanel(game,gp);
//get one of the buttons in the panel
JButton myReset = toolPanel.getResetButton();
JButton myQuit = toolPanel.getQuitButton();
//click one of the buttons in the panel
myReset.doClick();
verify(gp).reset();
}
}
| [
"k.tajalizadekhoob@mail.utoronto.ca"
] | k.tajalizadekhoob@mail.utoronto.ca |
6e68b0db39c883c7eb2e737ceee4d8cab58d3d40 | 2773708f64e7a66d23733603e3207717ceb63da9 | /src/main/java/com/geekzhang/demo/controller/api/NoticeController.java | 7a262006cf6c5277a06dc18b41a3f9759c2d8415 | [] | no_license | geekzhi/online-disk | 29b8a575d641aa50dfd4d03c1207d8eec565c88e | c3ca2f2afa86adc9fdc07b3cfd8192fb49e20d61 | refs/heads/master | 2021-09-14T13:28:51.356088 | 2018-05-14T11:34:32 | 2018-05-14T11:34:32 | 114,967,936 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,650 | java | package com.geekzhang.demo.controller.api;
import com.geekzhang.demo.controller.AbstractController;
import com.geekzhang.demo.enums.ResponseCode;
import com.geekzhang.demo.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
/**
* @Description:
* @author: zhangpengzhi<geekzhang @ 1 6 3 . com>
* @date: 2018/4/20 下午1:13
* @version: V1.0
*/
@RestController
@Slf4j
@RequestMapping("/notice")
public class NoticeController extends AbstractController{
@Autowired
UserService userService;
@GetMapping("/friend")
public Map<String, Object> getFriendNotice(){
Map<String, Object> map = new HashMap<>();
try {
String userId = getUserId();
log.info("获取用户好友申请列表,用户ID:[{}]", userId);
map = userService.getFriendNotice(userId);
} catch (Exception e) {
log.error("获取用户好友申请列表", e);
map.put("code", ResponseCode.WRONG.getCode());
map.put("msg", ResponseCode.WRONG.getDesc());
}
return map;
}
@GetMapping("/friend/{friendId}/{agree}")
public Map<String, Object> agreeFiend(@PathVariable String friendId, @PathVariable Boolean agree) {
Map<String, Object> map = new HashMap<>();
try {
String userId = getUserId();
log.info("批准好友申请,用户ID:[{}],申请人ID:[{}], 是否同意:【{}】", userId, friendId, agree);
map = userService.dealFriend(userId, friendId, agree);
} catch (Exception e) {
log.error("批准好友申请", e);
map.put("code", ResponseCode.WRONG.getCode());
map.put("msg", ResponseCode.WRONG.getDesc());
}
return map;
}
@GetMapping("/system")
public Map<String, Object> getSystemNotice(){
Map<String, Object> map = new HashMap<>();
try {
String userId = getUserId();
log.info("获取系统通知,用户ID:[{}]", userId);
map = userService.getSystemNotice();
} catch (Exception e) {
log.error("获取系统通知", e);
map.put("code", ResponseCode.WRONG.getCode());
map.put("msg", ResponseCode.WRONG.getDesc());
}
return map;
}
}
| [
"zhang_pz@suixingpay.com"
] | zhang_pz@suixingpay.com |
6f5f2e1c3578aeef1ddfbb18b895ba42bf516885 | 5352d8eb2153c60483343f0e94f50ce1ae8dbebb | /app/src/main/java/com/velvetcase/app/material/ForgotPasswordActivty.java | cad55d62b19edf598fa229500474ae40f7d85bd5 | [] | no_license | prashant-Ascra/Velvetcase | a5546a8bc14a2dca9b17cac517172f9a546cc298 | 8e3894a1bd14018fb1e3757e580637c05cd90759 | refs/heads/master | 2020-03-30T20:46:15.489790 | 2015-08-14T06:41:24 | 2015-08-14T06:41:24 | 34,100,489 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,452 | java | package com.velvetcase.app.material;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.velvetcase.app.material.Models.AllProductsModelBase;
import com.velvetcase.app.material.util.AlertDialogManager;
import com.velvetcase.app.material.util.Constants;
import com.velvetcase.app.material.util.GetResponse;
import com.velvetcase.app.material.util.SessionManager;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Created by Prashant Patil on 29-05-2015.
*/
public class ForgotPasswordActivty extends ActionBarActivity implements GetResponse {
EditText email_edt_text;
Button reset_email_btn;
String RequestType="reset";
AsyncReuse asyncReuse;
SessionManager session;
AlertDialogManager alert;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.reset_password_screen);
alert = new AlertDialogManager();
setupUI();
}
public void setupUI(){
email_edt_text=(EditText)findViewById(R.id.edt_email);
reset_email_btn=(Button)findViewById(R.id.btn_reset_email);
reset_email_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(emailValidator(email_edt_text.getText().toString())){
ExecuteServerRequest(email_edt_text.getText().toString());
}else{
runOnUiThread(new Runnable() {
@Override
public void run() {
alert.showAlertDialog(ForgotPasswordActivty.this,"Alert","Please confirm email",false);
}
});
}
}
});
}
public boolean emailValidator(String email)
{
Pattern pattern;
Matcher matcher;
final String EMAIL_PATTERN = "^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
pattern = Pattern.compile(EMAIL_PATTERN);
matcher = pattern.matcher(email);
return matcher.matches();
}
public void ExecuteServerRequest(String email){
List<NameValuePair> paramslist = null;
if(RequestType.equalsIgnoreCase("reset")){
paramslist = new ArrayList<NameValuePair>();
paramslist.add(new BasicNameValuePair("email",email));
asyncReuse = new AsyncReuse(ForgotPasswordActivty.this,Constants.APP_MAINURL+"tokens/forgot_password", Constants.POST,paramslist,true);
}else{
asyncReuse = new AsyncReuse(ForgotPasswordActivty.this,Constants.APP_MAINURL+"productjsons/product_list.json", Constants.GET,paramslist,true);
}
asyncReuse.getResponse = this;
asyncReuse.execute();
}
@Override
public void GetData(String response) {
if (response != null){
if(RequestType.equalsIgnoreCase("reset")){
try {
JSONObject jobj = new JSONObject(response);
if (jobj.getString("status").equalsIgnoreCase("Success")) {
// session.createLoginSession(jobj.getString("email"),jobj.getString("user_id"),""+jobj.getString("full_name"));
Toast.makeText(ForgotPasswordActivty.this,"Password reset link has been sent on register mail",Toast.LENGTH_SHORT).show();
Intent i = new Intent(ForgotPasswordActivty.this,SignActivity.class);
startActivity(i);
// RequestType ="AllProduct";
// ExecuteServerRequest(email_edt_text.getText().toString());
}else{
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(ForgotPasswordActivty.this,"Please check email",Toast.LENGTH_SHORT).show();
// alert.showAlertDialog(ForgotPasswordActivty.this,"Alert","Please confirm email or passsword",false);
}
});
}
} catch (JSONException e) {
e.printStackTrace();
}
}else{
AllProductsModelBase.getInstance().GetProductDataFromServer(response);
if(AllProductsModelBase.getInstance().getProductsList().size() > 0){
Intent i = new Intent(ForgotPasswordActivty.this,MainActivity.class);
startActivity(i);
finish();
}else{
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(ForgotPasswordActivty.this,"Please check email",Toast.LENGTH_SHORT).show();
}
});
}
}
}
}
}
| [
"prashant@ascratech.com"
] | prashant@ascratech.com |
d1a15693728a10ce5f399072878b452f2da984ff | c3707ccd2a970bda5a94f688bc6b887adb46d672 | /foodTruck/src/main/java/food/foodTruck/repository/TypeRepasRepository.java | 386e15c3f06ee4dbfe9ebedb1855f05229962bc7 | [] | no_license | SteeveMRTL/AJC-ProjetFoodTruck | eed9d61c3aa8e9b092df3644e9da6338317f0cbd | 23252b1e02384a33d507550943f79a9e3e359475 | refs/heads/master | 2023-01-10T18:44:05.381930 | 2020-03-11T16:16:09 | 2020-03-11T16:16:09 | 246,271,746 | 0 | 0 | null | 2023-01-07T15:49:54 | 2020-03-10T10:29:48 | TypeScript | UTF-8 | Java | false | false | 223 | java | package food.foodTruck.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import food.foodTruck.model.TypeRepas;
public interface TypeRepasRepository extends JpaRepository<TypeRepas, Integer> {
}
| [
"59841109+AnisHDLY@users.noreply.github.com"
] | 59841109+AnisHDLY@users.noreply.github.com |
e07c1781eae616606ca3475e2bcb240a49316962 | 720fe0b423f7a83171dddfa09198ed4f176cab0f | /src/main/java/com/rkhd/ienterprise/apps/ingage/wx/feed/action/FeedAction.java | 93c319669b5c1b6bb182c1f32a3fc5c5bfbb97b7 | [] | no_license | xrogzu/mobile-crm | a44bcc244a16095ba8b68b8618e07dd071a13b67 | d459d6678307c41430fdfe64e35fe52fe619453e | refs/heads/master | 2021-01-12T06:57:04.922927 | 2016-10-19T07:28:28 | 2016-10-19T07:28:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,643 | java | package com.rkhd.ienterprise.apps.ingage.wx.feed.action;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.rkhd.ienterprise.apps.ingage.dingtalk.dto.EntityReturnData;
import com.rkhd.ienterprise.apps.ingage.services.ActivityRecordService;
import com.rkhd.ienterprise.apps.ingage.services.FeedService;
import com.rkhd.ienterprise.apps.ingage.dingtalk.util.CodeFilter;
import com.rkhd.ienterprise.apps.ingage.wx.base.WxBaseAction;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
@Namespace("/wx/feed")
public class FeedAction extends WxBaseAction {
private static Logger LOG = LoggerFactory.getLogger(FeedAction.class);
long belongId = 1;
long objectId = 0;
@Autowired
private FeedService feedService;
@Action(value = "list", results = {@Result(name = SUCCESS, location = PAGES_ROOT+"/jsondata.jsp")})
public String getFeedList() {
EntityReturnData ret = null;
try{
ret = feedService.findFeedList(getAccessToken(),getBelongId(),getObjectId(),getPageNo(),getPagesize());
if(ret.isSuccess()){
// 防止xss攻击
ret.setEntity(CodeFilter.xddTerminator(ret.getEntity()));
}else{
LOG.error("authorization={},user_token="+getAccessToken()+";belongid="+getBelongId()+";objectid="+getObjectId()+"; ret={}",getAccessToken(),JSON.toJSONString(ret));
}
}catch (Exception e){
ret = new EntityReturnData();
e.printStackTrace();
}
getRequest().setAttribute("jsondata",ret);
return SUCCESS;
}
public JSONArray getActivityRecordType(){
HttpServletRequest request = getRequest();
JSONArray busiparamsArray = (JSONArray) request.getSession().getAttribute("rctivityRecordTypes");
if(busiparamsArray == null){
EntityReturnData entityReturnData = new ActivityRecordService().getDesc(getAccessToken());
if(entityReturnData.isSuccess()){
JSONObject descJSONObject = (JSONObject) entityReturnData.getEntity();
busiparamsArray = descJSONObject.getJSONArray("busiparams");
JSONObject paramsJSONObject = null;
for(int i=0;i<busiparamsArray.size();i++){
paramsJSONObject = busiparamsArray.getJSONObject(i);
// LOG.info("{}", JSON.toJSONString(paramsJSONObject));
if(paramsJSONObject.getString("fieldname").equals("type")){
busiparamsArray = paramsJSONObject.getJSONArray("params");
break;
}
}
request.getSession().setAttribute("rctivityRecordTypes",busiparamsArray);
}else {
LOG.error("search activity record fail ,authorization={},apiReturnData is:{}",getAccessToken(),JSONObject.toJSONString(entityReturnData));
}
}
return busiparamsArray;
}
public long getBelongId() {
return belongId;
}
public void setBelongId(long belongId) {
this.belongId = belongId;
}
public long getObjectId() {
return objectId;
}
public void setObjectId(long objectId) {
this.objectId = objectId;
}
}
| [
"dengfang@xiaoshouyi.com"
] | dengfang@xiaoshouyi.com |
a45b2cc918e0257619307acfe516acb3f23300a8 | 22e38fb0b78e1fc8ba9c0f90fd18bb339e2692d4 | /Otros/generarletranif/MiInterfaz.java | 0d41f64087076e21e832d238d47db346cbfc26ed | [] | no_license | Perju/DAM | 34dc35373cd4567545575debeeb2ef1899f89133 | fe91108549bacde9c86ba56d9e02a11ba14e1fdb | refs/heads/master | 2021-01-20T01:23:23.239523 | 2018-07-09T09:17:04 | 2018-07-09T09:17:04 | 83,805,010 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,861 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package generarletranif;
import java.awt.Container;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
/**
*
* @author jupa
*/
public class MiInterfaz extends JFrame implements ActionListener{
private static final long serialVersionUID = 1L;
private JPanel panel = new JPanel();
private JButton obtenerLetra;
private JTextField textDNI = new JTextField();
private JLabel labelNIF = new JLabel();
public MiInterfaz(){
setTitle("Obtener letra NIF");
setSize(500,400);
addWindowListener(new ManejadorInterfaz());
Container contentpane= getContentPane();
obtenerLetra = new JButton("Obtener Letra");
obtenerLetra.addActionListener(this);
panel.setLayout(new GridLayout(3,1));
textDNI.setHorizontalAlignment(JTextField.CENTER);
panel.add(textDNI);
panel.add(obtenerLetra);
labelNIF.setHorizontalAlignment(JTextField.CENTER);
panel.add(labelNIF);
contentpane.add(panel);
}
@Override
public void actionPerformed(ActionEvent e) {
String accion = e.getActionCommand();
if(accion == "Obtener Letra"){
String texto = "";
try {
texto = textDNI.getText()+"-"+DNI.obtenerLetra(textDNI.getText());
} catch (Exception ex) {
texto=ex.getMessage();
}
labelNIF.setText(texto);
}
}
}
| [
"yohanam.paulus@gmail.com"
] | yohanam.paulus@gmail.com |
478d1ff26314a4091e0b984459292f07bb734e5c | d0b2e7a5886252cbbaad9f44599eac7e3576e7a8 | /src/main/java/student_eduards_jasvins/lesson_5/day_1/Task_8.java | e9500cc02fc16632645651d404b18b50acd5be5a | [] | no_license | Dmitryyyyo/java_1_tuesday_2020_online | ac1b44822a2aed40a6e12e6909e9b8c699e57d4c | 7e3bba7ead444d0b2bf1b6715289b2fcc4d22c54 | refs/heads/master | 2023-01-02T11:21:40.223345 | 2020-10-21T18:02:55 | 2020-10-21T18:02:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 479 | java | package student_eduards_jasvins.lesson_5.day_1;
/*
class ArrayLength2 {
public static void main(String[] args) {
int numbers = new int[2];
System.out.println(numbers[0]);
System.out.println(numbers[1]);
System.out.println(numbers[2]);
}
}
*/
public class Task_8 {
public static void main(String[] args) {
int[] numbers = new int[2];
System.out.println(numbers[0]);
System.out.println(numbers[1]);
}
}
| [
"eduards.jasvins@gmail.com"
] | eduards.jasvins@gmail.com |
493fc7d699d7ad97ecc67077c9f9e4df9304cc3c | 1e0b7e5d8968cff016da2042af541e653ce6b46a | /app/src/main/java/com/zeenko/serializablevsparcelable/utility/ExtraKeysGeneratorUtility.java | b7cb3a9944db7422ada3d8e85744e8a612c2c24d | [] | no_license | zeienko-vitalii/serializable-vs-parcelable | 20d3e8c07e67df4f91ea4b84c1d78d070964ce71 | 55a21743492c4d21c86f08aaf76aaf6cfa6a51db | refs/heads/master | 2020-04-30T03:46:52.592559 | 2019-03-26T19:09:53 | 2019-03-26T19:09:53 | 176,594,874 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 696 | java | package com.zeenko.serializablevsparcelable.utility;
import java.util.ArrayList;
import java.util.List;
public class ExtraKeysGeneratorUtility {
public static int SIZE = 300;
private List<String> parcelableKeys = new ArrayList<>();
private List<String> serializableKeys = new ArrayList<>();
public ExtraKeysGeneratorUtility() {
for (int i = 0; i < SIZE; i++) {
parcelableKeys.add("PARCELABLE_EXTRA_" + i);
serializableKeys.add("SERIALIZABLE_EXTRA_" + i);
}
}
public List<String> getParcelableKeys() {
return parcelableKeys;
}
public List<String> getSerializableKeys() {
return serializableKeys;
}
}
| [
"zedted048@gmail.com"
] | zedted048@gmail.com |
1fd5937d4225a2b364ce521bbbf7185ccb7bb184 | 2b995501080ad6a1d129a624a3c67091198bd0ad | /chapter_002/src/main/java/ru/job4j/chess/figures/white/KingWhite.java | 8eaf34d477ded84bf02545a9801f76df7f2e8a1d | [
"Apache-2.0"
] | permissive | alexeykuzhelev/akuzhelev | 0dc414b434b83810d8b32337856880af68faa55c | a341582cbacc783f479761c52c1352bc00de61ef | refs/heads/master | 2023-08-24T17:04:16.334999 | 2023-08-12T22:48:51 | 2023-08-12T22:48:51 | 117,867,525 | 0 | 0 | Apache-2.0 | 2023-04-14T18:03:01 | 2018-01-17T17:13:02 | Java | UTF-8 | Java | false | false | 1,013 | java | package ru.job4j.chess.figures.white;
import ru.job4j.chess.figures.Cell;
import ru.job4j.chess.figures.Figure;
/**
* @author Alexey Kuzhelev (aleks2kv1977@gmail.com)
* @version $Id$
* @since 20.09.2018
*/
/**
* Класс описывает фигуру Король и расширяет абстрактный класс Figure.
*/
public class KingWhite extends Figure {
/**
* Конструктор фигуры Король.
* @param position позиция, на которой создать фигуру.
*/
public KingWhite(final Cell position) {
super(position);
}
/**
* Метод возвращает текущую позицию фигуры на доске.
*/
@Override
public Cell position() {
return this.position;
}
@Override
public Cell[] way(Cell source, Cell dest) {
return new Cell[] {dest};
}
@Override
public Figure copy(Cell dest) {
return new KingWhite(dest);
}
}
| [
"aleks2kv1977@gmail.com"
] | aleks2kv1977@gmail.com |
592c9e92cd807447c5902c481045ae8197376086 | f98002d6186eb2079730f6a41782a808b15fa407 | /src/meshi/energy/hydrogenBond/GoodResiduesForHB.java | 47b31659770ef784cdc1b8793b75cf57661b2a9c | [] | no_license | ZivBA/CrysHomModeling | 7d6a79fbbdd9d0c0191cd41bc01b679534bf1feb | 3df2ec6dcd35586568d190497af6a4d9e40535fd | refs/heads/master | 2021-06-28T18:35:24.297893 | 2017-07-31T07:16:36 | 2017-07-31T07:16:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,548 | java | package meshi.energy.hydrogenBond;
import meshi.geometry.Distance;
import meshi.geometry.DistanceList;
import meshi.molecularElements.Atom;
import meshi.util.filters.Filter;
import java.util.Iterator;
public class GoodResiduesForHB implements Filter {
private final IsHO isHO = new IsHO();
private final IsNot13 isNot13 = new IsNot13();
private final GoodSS goodSS = new GoodSS();
private boolean firstTimeWornning = true;
private DistanceList specialDis = null;
public GoodResiduesForHB(){}
public GoodResiduesForHB(DistanceList disList){
specialDis = disList;
}
public boolean accept(Object obj) {
Distance distance = (Distance)obj;
boolean ans = isHO.accept(obj) && isNot13.accept(obj) && goodSS.accept(obj);
if (!ans)
return ans;
boolean frozen = distance.atom1() .frozen() & distance.atom2() .frozen() ;
if (ans & frozen){
if(firstTimeWornning ) //TODO check this - maybe frozen atoms should be looked at ?
{
System.out.println("*****************************************************************************************************\n" +
"*** NOTE: frozen atoms does not consider as GoodResiduesForHB !!! *****\n" +
"*****************************************************************************************************");
firstTimeWornning = false;
}
return false;
}
if(ans & specialDis != null && !specialDis.isEmpty() ){
Distance pair;
Iterator specDisIter = specialDis.iterator() ;
Atom atom1,atom2;
while( (pair = (Distance) specDisIter .next()) != null){
atom1 = pair.atom1() ;
int atom1Num = atom1.number();
atom2 = pair.atom2() ;
int atom2Num = atom2.number();
if(distance.isDistanceOf(atom1) | distance.isDistanceOf(atom2)){
return (distance.atom1().number() == atom1Num & distance.atom2() .number() == atom2Num) |
(distance.atom1().number() == atom2Num & distance.atom2() .number() == atom1Num);
}
}
}
return ans;
}
//--------------------------- internal class IsNot13 ----------------------------------
/* this filter Accept Distance between Atoms just if there are at list 3 atoms away on the sequense,
* (atomes that are less then 3 atoms away on the sequense never create Hydrogen bonds with each other)
*/
static class IsNot13 implements Filter {
public boolean accept(Object obj) {
Distance dis = (Distance)obj;
if (!dis.atom1().chain().equalsIgnoreCase(dis.atom1().chain()))
return true;
int residueNumber1 = dis.atom1().residueNumber();
int residueNumber2 = dis.atom2().residueNumber();
return (!(Math.abs(residueNumber1-residueNumber2) < 3));
}
}
//--------------------------- internal class GoodSS ---------------------------
static class GoodSS implements Filter {
public boolean accept(Object obj) {
Distance dis = (Distance)obj;
String atom1SS = dis.atom1().residue().secondaryStructure();
String atom2SS = dis.atom2().residue().secondaryStructure();
if (atom1SS.equals("COIL") || atom2SS.equals("COIL"))
return false;
if ((atom1SS.equals("HELIX") || atom1SS .equals("HELIX_OR_COIL")) && (atom2SS.equals("HELIX") | atom2SS .equals("HELIX_OR_COIL") ))
{
int residueNumber1 = dis.atom1().residueNumber();
int residueNumber2 = dis.atom2().residueNumber();
return (Math.abs(residueNumber1-residueNumber2) == 4);
}
// return !(((atom1SS.equals("HELIX") || atom1SS .equals("HELIX_OR_COIL")) && (atom2SS.equals("SHEET") | atom2SS .equals("SHEET_OR_COIL") )) ||
// ((atom1SS.equals("SHEET") | atom1SS .equals("SHEET_OR_COIL")) && (atom2SS.equals("HELIX") | atom2SS .equals("HELIX_OR_COIL") )));
return (atom1SS.equals("SHEET") || atom1SS .equals("SHEET_OR_COIL")) && (atom2SS.equals("SHEET") | atom2SS .equals("SHEET_OR_COIL"));
}
}
}
| [
"ziv.benaharon1@mai.huji.ac.il"
] | ziv.benaharon1@mai.huji.ac.il |
945bc74b9e347998c809028ba2d0b67dd9c47798 | 29505f13c11086649d5f6165225ac06c37864725 | /src/com/dao/AgendamentoDAO.java | 319e104df2c952484a3dab8090896b7364c27ba8 | [] | no_license | vinicionagel/intranetifc | ad96fb8153a68f13b235dbb9c6fefb118ae68012 | 2e4a24a5876f9dfd36f9b3cadc11972df8d9c153 | refs/heads/master | 2020-03-23T22:01:56.651044 | 2018-08-22T11:31:49 | 2018-08-22T11:31:49 | 142,148,594 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,359 | java |
package com.dao;
import com.core.GenericDAO;
import static com.dao.AndamentoDAO.logger;
import com.dto.AgendamentoDTO;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.persistence.EntityManager;
public class AgendamentoDAO extends GenericDAO<AgendamentoDTO>{
private static final long serialVersionUID = 20018L;
private volatile static AgendamentoDAO uniqueInstance;
static final Logger logger = Logger.getLogger(AgendamentoDAO.class.getName());
public static AgendamentoDAO getInstance(){
if (uniqueInstance == null){
synchronized (AgendamentoDAO.class){
if (uniqueInstance == null){
uniqueInstance = new AgendamentoDAO();
}
}
}
return uniqueInstance;
}
public AgendamentoDAO() {
super(AgendamentoDTO.class);
}
public List<AgendamentoDTO> findAllOrdenadoPorDia(){
EntityManager em = emf.createEntityManager();
try {
return em.createQuery("SELECT a FROM AgendamentoDTO a ORDER BY a.diaSemanaDTO.codigo, a.horario").getResultList();
} catch (Exception e) {
logger.log(Level.SEVERE, e.getMessage(), e);
return null;
} finally {
em.close();
}
}
} | [
"vinicio@192.168.1.5"
] | vinicio@192.168.1.5 |
6c0c7ff5cda010e26a5602f12d1e4cbd1be5bb14 | 208ba847cec642cdf7b77cff26bdc4f30a97e795 | /di/dh/src/main/java/org.wp.dh/ui/suggestion/util/SuggestionUtils.java | 9fa47f3c306f0ee7e18497aaf21719d6545841ce | [] | no_license | kageiit/perf-android-large | ec7c291de9cde2f813ed6573f706a8593be7ac88 | 2cbd6e74837a14ae87c1c4d1d62ac3c35df9e6f8 | refs/heads/master | 2021-01-12T14:00:19.468063 | 2016-09-27T13:10:42 | 2016-09-27T13:10:42 | 69,685,305 | 0 | 0 | null | 2016-09-30T16:59:49 | 2016-09-30T16:59:48 | null | UTF-8 | Java | false | false | 2,676 | java | package org.wp.dh.ui.suggestion.util;
import android.content.Context;
import org.wp.dh.WordPress;
import org.wp.dh.datasets.SuggestionTable;
import org.wp.dh.models.Blog;
import org.wp.dh.models.Suggestion;
import org.wp.dh.models.Tag;
import org.wp.dh.ui.suggestion.adapters.SuggestionAdapter;
import org.wp.dh.ui.suggestion.adapters.TagSuggestionAdapter;
import java.util.List;
public class SuggestionUtils {
public static SuggestionAdapter setupSuggestions(final int remoteBlogId, Context context, SuggestionServiceConnectionManager serviceConnectionManager) {
Blog blog = WordPress.wpDB.getBlogForDotComBlogId(Integer.toString(remoteBlogId));
boolean isDotComFlag = (blog != null && blog.isDotcomFlag());
return SuggestionUtils.setupSuggestions(remoteBlogId, context, serviceConnectionManager, isDotComFlag);
}
public static SuggestionAdapter setupSuggestions(final int remoteBlogId, Context context, SuggestionServiceConnectionManager serviceConnectionManager, boolean isDotcomFlag) {
if (!isDotcomFlag) {
return null;
}
SuggestionAdapter suggestionAdapter = new SuggestionAdapter(context);
List<Suggestion> suggestions = SuggestionTable.getSuggestionsForSite(remoteBlogId);
// if the suggestions are not stored yet, we want to trigger an update for it
if (suggestions.isEmpty()) {
serviceConnectionManager.bindToService();
}
suggestionAdapter.setSuggestionList(suggestions);
return suggestionAdapter;
}
public static TagSuggestionAdapter setupTagSuggestions(final int remoteBlogId, Context context, SuggestionServiceConnectionManager serviceConnectionManager) {
Blog blog = WordPress.wpDB.getBlogForDotComBlogId(Integer.toString(remoteBlogId));
boolean isDotComFlag = (blog != null && blog.isDotcomFlag());
return SuggestionUtils.setupTagSuggestions(remoteBlogId, context, serviceConnectionManager, isDotComFlag);
}
public static TagSuggestionAdapter setupTagSuggestions(final int remoteBlogId, Context context, SuggestionServiceConnectionManager serviceConnectionManager, boolean isDotcomFlag) {
if (!isDotcomFlag) {
return null;
}
TagSuggestionAdapter tagSuggestionAdapter = new TagSuggestionAdapter(context);
List<Tag> tags = SuggestionTable.getTagsForSite(remoteBlogId);
// if the tags are not stored yet, we want to trigger an update for it
if (tags.isEmpty()) {
serviceConnectionManager.bindToService();
}
tagSuggestionAdapter.setTagList(tags);
return tagSuggestionAdapter;
}
}
| [
"cedric.champeau@gmail.com"
] | cedric.champeau@gmail.com |
4f9ccfe635ac9d852990a16221cf37fc24e5a3c7 | 93d68e603a9bec238bd11110879b37017e3d89ff | /src/Medium/preorderTrave.java | ea56a80fd40794388af86b5c309c6adc7d13d5ba | [] | no_license | qsong4/leetcode | 90e647d4aeede2001e88d8382e898882ba4505d8 | 155fd437c3216596ad42173ceae169a177e0d35e | refs/heads/master | 2021-01-19T00:10:59.340293 | 2017-06-27T03:12:00 | 2017-06-27T03:12:00 | 72,934,500 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 574 | java | package Medium;
import java.util.*;
/**
* Created by songqingyuan on 5/10/17.
*/
public class preorderTrave {
public List<Integer> preorderTraversal(TreeNode root) {
List<Integer> res = new LinkedList<Integer>();
Stack<TreeNode> stack = new Stack<TreeNode>();
stack.push(root);
while(!stack.empty()){
TreeNode node = stack.pop();
if(node!=null){
res.add(node.val);
stack.push(node.right);
stack.push(node.left);
}
}
return res;
}
}
| [
"qsong4@hawk.iit.edu"
] | qsong4@hawk.iit.edu |
9b3ed4c249d5a8fd17f4d4448556cce26d1a9047 | 678a3d58c110afd1e9ce195d2f20b2531d45a2e0 | /sources/com/google/android/gms/internal/zzaal.java | 385186e7bbdef1ab485b686bcbde5ac708987bec | [] | no_license | jasonnth/AirCode | d1c37fb9ba3d8087efcdd9fa2103fb85d13735d5 | d37db1baa493fca56f390c4205faf5c9bbe36604 | refs/heads/master | 2020-07-03T08:35:24.902940 | 2019-08-12T03:34:56 | 2019-08-12T03:34:56 | 201,842,970 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,680 | java | package com.google.android.gms.internal;
import com.google.android.gms.common.api.PendingResult;
import com.google.android.gms.common.api.Result;
import com.google.android.gms.common.api.Status;
import com.google.android.gms.common.api.zza;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.android.gms.tasks.TaskCompletionSource;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.WeakHashMap;
public class zzaal {
/* access modifiers changed from: private */
public final Map<zzaaf<?>, Boolean> zzaBc = Collections.synchronizedMap(new WeakHashMap());
/* access modifiers changed from: private */
public final Map<TaskCompletionSource<?>, Boolean> zzaBd = Collections.synchronizedMap(new WeakHashMap());
private void zza(boolean z, Status status) {
HashMap hashMap;
HashMap hashMap2;
synchronized (this.zzaBc) {
hashMap = new HashMap(this.zzaBc);
}
synchronized (this.zzaBd) {
hashMap2 = new HashMap(this.zzaBd);
}
for (Entry entry : hashMap.entrySet()) {
if (z || ((Boolean) entry.getValue()).booleanValue()) {
((zzaaf) entry.getKey()).zzC(status);
}
}
for (Entry entry2 : hashMap2.entrySet()) {
if (z || ((Boolean) entry2.getValue()).booleanValue()) {
((TaskCompletionSource) entry2.getKey()).trySetException(new zza(status));
}
}
}
/* access modifiers changed from: 0000 */
public void zza(final zzaaf<? extends Result> zzaaf, boolean z) {
this.zzaBc.put(zzaaf, Boolean.valueOf(z));
zzaaf.zza((PendingResult.zza) new PendingResult.zza() {
public void zzy(Status status) {
zzaal.this.zzaBc.remove(zzaaf);
}
});
}
/* access modifiers changed from: 0000 */
public <TResult> void zza(final TaskCompletionSource<TResult> taskCompletionSource, boolean z) {
this.zzaBd.put(taskCompletionSource, Boolean.valueOf(z));
taskCompletionSource.getTask().addOnCompleteListener(new OnCompleteListener<TResult>() {
public void onComplete(Task<TResult> task) {
zzaal.this.zzaBd.remove(taskCompletionSource);
}
});
}
/* access modifiers changed from: 0000 */
public boolean zzvY() {
return !this.zzaBc.isEmpty() || !this.zzaBd.isEmpty();
}
public void zzvZ() {
zza(false, zzaax.zzaCn);
}
public void zzwa() {
zza(true, zzaby.zzaDu);
}
}
| [
"thanhhuu2apc@gmail.com"
] | thanhhuu2apc@gmail.com |
078dddda0980e5dc2137e0ddb321905aef1dafef | d4ed822ca9c2b13b33510598a7087289e94d1d50 | /MViewerBlanceOne/src/com/ctfo/mvapi/entities/PixelPoint.java | a1b8b05b01f9f002379d888755607b86cf337636 | [] | no_license | 1000ren/ctfoMap | 501c7200e6bef756c72d26de649456a07877dbb5 | 09c64d8a8a5ada85169d6d734a4ecd247e550cbc | refs/heads/master | 2020-06-02T03:42:31.894871 | 2014-08-04T03:13:28 | 2014-08-04T03:13:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 371 | java | package com.ctfo.mvapi.entities;
/**
* @author fangwei
*
* 标准格网坐标系下的像素点坐标
*
*/
public class PixelPoint
{
public int x;
public int y;
public PixelPoint()
{
x = 0;
y = 0;
}
public PixelPoint(int i, int j)
{
x = i;
y = j;
}
public void SetData(int nX, int nY)
{
x = nX;
y = nY;
}
}
| [
"fanwei1207@163.com"
] | fanwei1207@163.com |
f3ead3e44527d4873a73a2fbe683ec16c5e67e58 | 99c7c7b18a9d94f94f39a84120b4631c2545bbb3 | /services/allscenariosdb/src/com/angularjsdependencyinjection9_4/allscenariosdb/service/SequenceAutoIncService.java | 2b1cc05fee9f955a34a0c0168cbb8c3c24840a36 | [] | no_license | SaraswathiRekhala/AngularJsDependencyInjection9_4 | f480a134996844979ea306951732e021b170664b | 1a84b9180978cfa1009c999a3e720c5fb699cba4 | refs/heads/master | 2020-05-07T13:46:10.562114 | 2019-04-10T10:51:50 | 2019-04-10T10:51:50 | 180,561,857 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,005 | java | /*Copyright (c) 2016-2017 wavemaker.com All Rights Reserved.
This software is the confidential and proprietary information of wavemaker.com You shall not disclose such Confidential Information and shall use it only in accordance
with the terms of the source code license agreement you entered into with wavemaker.com*/
package com.angularjsdependencyinjection9_4.allscenariosdb.service;
/*This is a Studio Managed File. DO NOT EDIT THIS FILE. Your changes may be reverted by Studio.*/
import java.io.OutputStream;
import java.util.List;
import java.util.Map;
import javax.validation.Valid;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import com.wavemaker.runtime.data.exception.EntityNotFoundException;
import com.wavemaker.runtime.data.export.DataExportOptions;
import com.wavemaker.runtime.data.export.ExportType;
import com.wavemaker.runtime.data.expression.QueryFilter;
import com.wavemaker.runtime.data.model.AggregationInfo;
import com.wavemaker.runtime.file.model.Downloadable;
import com.angularjsdependencyinjection9_4.allscenariosdb.SequenceAutoInc;
/**
* Service object for domain model class {@link SequenceAutoInc}.
*/
public interface SequenceAutoIncService {
/**
* Creates a new SequenceAutoInc. It does cascade insert for all the children in a single transaction.
*
* This method overrides the input field values using Server side or database managed properties defined on SequenceAutoInc if any.
*
* @param sequenceAutoInc Details of the SequenceAutoInc to be created; value cannot be null.
* @return The newly created SequenceAutoInc.
*/
SequenceAutoInc create(@Valid SequenceAutoInc sequenceAutoInc);
/**
* Returns SequenceAutoInc by given id if exists.
*
* @param sequenceautoincId The id of the SequenceAutoInc to get; value cannot be null.
* @return SequenceAutoInc associated with the given sequenceautoincId.
* @throws EntityNotFoundException If no SequenceAutoInc is found.
*/
SequenceAutoInc getById(Integer sequenceautoincId);
/**
* Find and return the SequenceAutoInc by given id if exists, returns null otherwise.
*
* @param sequenceautoincId The id of the SequenceAutoInc to get; value cannot be null.
* @return SequenceAutoInc associated with the given sequenceautoincId.
*/
SequenceAutoInc findById(Integer sequenceautoincId);
/**
* Find and return the list of SequenceAutoIncs by given id's.
*
* If orderedReturn true, the return List is ordered and positional relative to the incoming ids.
*
* In case of unknown entities:
*
* If enabled, A null is inserted into the List at the proper position(s).
* If disabled, the nulls are not put into the return List.
*
* @param sequenceautoincIds The id's of the SequenceAutoInc to get; value cannot be null.
* @param orderedReturn Should the return List be ordered and positional in relation to the incoming ids?
* @return SequenceAutoIncs associated with the given sequenceautoincIds.
*/
List<SequenceAutoInc> findByMultipleIds(List<Integer> sequenceautoincIds, boolean orderedReturn);
/**
* Updates the details of an existing SequenceAutoInc. It replaces all fields of the existing SequenceAutoInc with the given sequenceAutoInc.
*
* This method overrides the input field values using Server side or database managed properties defined on SequenceAutoInc if any.
*
* @param sequenceAutoInc The details of the SequenceAutoInc to be updated; value cannot be null.
* @return The updated SequenceAutoInc.
* @throws EntityNotFoundException if no SequenceAutoInc is found with given input.
*/
SequenceAutoInc update(@Valid SequenceAutoInc sequenceAutoInc);
/**
* Deletes an existing SequenceAutoInc with the given id.
*
* @param sequenceautoincId The id of the SequenceAutoInc to be deleted; value cannot be null.
* @return The deleted SequenceAutoInc.
* @throws EntityNotFoundException if no SequenceAutoInc found with the given id.
*/
SequenceAutoInc delete(Integer sequenceautoincId);
/**
* Deletes an existing SequenceAutoInc with the given object.
*
* @param sequenceAutoInc The instance of the SequenceAutoInc to be deleted; value cannot be null.
*/
void delete(SequenceAutoInc sequenceAutoInc);
/**
* Find all SequenceAutoIncs matching the given QueryFilter(s).
* All the QueryFilter(s) are ANDed to filter the results.
* This method returns Paginated results.
*
* @deprecated Use {@link #findAll(String, Pageable)} instead.
*
* @param queryFilters Array of queryFilters to filter the results; No filters applied if the input is null/empty.
* @param pageable Details of the pagination information along with the sorting options. If null returns all matching records.
* @return Paginated list of matching SequenceAutoIncs.
*
* @see QueryFilter
* @see Pageable
* @see Page
*/
@Deprecated
Page<SequenceAutoInc> findAll(QueryFilter[] queryFilters, Pageable pageable);
/**
* Find all SequenceAutoIncs matching the given input query. This method returns Paginated results.
* Note: Go through the documentation for <u>query</u> syntax.
*
* @param query The query to filter the results; No filters applied if the input is null/empty.
* @param pageable Details of the pagination information along with the sorting options. If null returns all matching records.
* @return Paginated list of matching SequenceAutoIncs.
*
* @see Pageable
* @see Page
*/
Page<SequenceAutoInc> findAll(String query, Pageable pageable);
/**
* Exports all SequenceAutoIncs matching the given input query to the given exportType format.
* Note: Go through the documentation for <u>query</u> syntax.
*
* @param exportType The format in which to export the data; value cannot be null.
* @param query The query to filter the results; No filters applied if the input is null/empty.
* @param pageable Details of the pagination information along with the sorting options. If null exports all matching records.
* @return The Downloadable file in given export type.
*
* @see Pageable
* @see ExportType
* @see Downloadable
*/
Downloadable export(ExportType exportType, String query, Pageable pageable);
/**
* Exports all SequenceAutoIncs matching the given input query to the given exportType format.
*
* @param options The export options provided by the user; No filters applied if the input is null/empty.
* @param pageable Details of the pagination information along with the sorting options. If null exports all matching records.
* @param outputStream The output stream of the file for the exported data to be written to.
*
* @see DataExportOptions
* @see Pageable
* @see OutputStream
*/
void export(DataExportOptions options, Pageable pageable, OutputStream outputStream);
/**
* Retrieve the count of the SequenceAutoIncs in the repository with matching query.
* Note: Go through the documentation for <u>query</u> syntax.
*
* @param query query to filter results. No filters applied if the input is null/empty.
* @return The count of the SequenceAutoInc.
*/
long count(String query);
/**
* Retrieve aggregated values with matching aggregation info.
*
* @param aggregationInfo info related to aggregations.
* @param pageable Details of the pagination information along with the sorting options. If null exports all matching records.
* @return Paginated data with included fields.
*
* @see AggregationInfo
* @see Pageable
* @see Page
*/
Page<Map<String, Object>> getAggregatedValues(AggregationInfo aggregationInfo, Pageable pageable);
} | [
"saraswathi.rekhala+8@wavemaker.com"
] | saraswathi.rekhala+8@wavemaker.com |
d3364a8bf33584130760d465da126d327c7e3a7c | fa02eaa873d5f3c3dcbfe7599e91dde86bd77358 | /thinkjoy-upms/thinkjoy-upms-server/src/main/java/com/thinkjoy/upms/server/controller/manage/UpmsRoleController.java | 98f7cd1563ae504fd5224ad0bfaaeb20877c68e9 | [
"MIT"
] | permissive | josephfourier/admin | 27942c8a1be8ac460201117b69d7df67ee3a887a | 1bcebbbedece08847ea83ed4910b50d964aec01c | refs/heads/master | 2021-04-06T06:34:21.841180 | 2018-03-10T07:07:33 | 2018-03-10T07:07:33 | 124,630,923 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,890 | java | package com.thinkjoy.upms.server.controller.manage;
import com.alibaba.fastjson.JSONArray;
import com.baidu.unbiz.fluentvalidator.ComplexResult;
import com.baidu.unbiz.fluentvalidator.FluentValidator;
import com.baidu.unbiz.fluentvalidator.ResultCollectors;
import com.thinkjoy.common.base.BaseController;
import com.thinkjoy.common.validator.LengthValidator;
import com.thinkjoy.upms.common.constant.UpmsResult;
import com.thinkjoy.upms.common.constant.UpmsResultConstant;
import com.thinkjoy.upms.dao.model.UpmsRole;
import com.thinkjoy.upms.dao.model.UpmsRoleExample;
import com.thinkjoy.upms.rpc.api.UpmsRolePermissionService;
import com.thinkjoy.upms.rpc.api.UpmsRoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 角色controller
* Created by on 2017/2/6.
*/
@Controller
@Api(value = "角色管理", description = "角色管理")
@RequestMapping("/manage/role")
public class UpmsRoleController extends BaseController {
private static Logger _log = LoggerFactory.getLogger(UpmsRoleController.class);
@Autowired
private UpmsRoleService upmsRoleService;
@Autowired
private UpmsRolePermissionService upmsRolePermissionService;
@ApiOperation(value = "角色首页")
@RequiresPermissions("upms:role:read")
@RequestMapping(value = "/index", method = RequestMethod.GET)
public String index() {
return "/manage/role/index.jsp";
}
@ApiOperation(value = "角色权限")
@RequiresPermissions("upms:role:permission")
@RequestMapping(value = "/permission/{id}", method = RequestMethod.GET)
public String permission(@PathVariable("id") int id, ModelMap modelMap) {
UpmsRole role = upmsRoleService.selectByPrimaryKey(id);
modelMap.put("role", role);
return "/manage/role/permission.jsp";
}
@ApiOperation(value = "角色权限")
@RequiresPermissions("upms:role:permission")
@RequestMapping(value = "/permission/{id}", method = RequestMethod.POST)
@ResponseBody
public Object permission(@PathVariable("id") int id, HttpServletRequest request) {
JSONArray datas = JSONArray.parseArray(request.getParameter("datas"));
int result = upmsRolePermissionService.rolePermission(datas, id);
return new UpmsResult(UpmsResultConstant.SUCCESS, result);
}
@ApiOperation(value = "角色列表")
@RequiresPermissions("upms:role:read")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public Object list(
@RequestParam(required = false, defaultValue = "0", value = "offset") int offset,
@RequestParam(required = false, defaultValue = "10", value = "limit") int limit,
@RequestParam(required = false, defaultValue = "", value = "search") String search,
@RequestParam(required = false, value = "sort") String sort,
@RequestParam(required = false, value = "order") String order) {
UpmsRoleExample upmsRoleExample = new UpmsRoleExample();
if (!StringUtils.isBlank(sort) && !StringUtils.isBlank(order)) {
upmsRoleExample.setOrderByClause(sort + " " + order);
}
if (StringUtils.isNotBlank(search)) {
upmsRoleExample.or()
.andTitleLike("%" + search + "%");
}
List<UpmsRole> rows = upmsRoleService.selectByExampleForOffsetPage(upmsRoleExample, offset, limit);
long total = upmsRoleService.countByExample(upmsRoleExample);
Map<String, Object> result = new HashMap<>();
result.put("rows", rows);
result.put("total", total);
return result;
}
@ApiOperation(value = "新增角色")
@RequiresPermissions("upms:role:create")
@RequestMapping(value = "/create", method = RequestMethod.GET)
public String create() {
return "/manage/role/create.jsp";
}
@ApiOperation(value = "新增角色")
@RequiresPermissions("upms:role:create")
@ResponseBody
@RequestMapping(value = "/create", method = RequestMethod.POST)
public Object create(UpmsRole upmsRole) {
ComplexResult result = FluentValidator.checkAll()
.on(upmsRole.getName(), new LengthValidator(1, 20, "名称"))
.on(upmsRole.getTitle(), new LengthValidator(1, 20, "标题"))
.doValidate()
.result(ResultCollectors.toComplex());
if (!result.isSuccess()) {
return new UpmsResult(UpmsResultConstant.INVALID_LENGTH, result.getErrors());
}
long time = System.currentTimeMillis();
upmsRole.setCtime(time);
upmsRole.setOrders(time);
int count = upmsRoleService.insertSelective(upmsRole);
return new UpmsResult(UpmsResultConstant.SUCCESS, count);
}
@ApiOperation(value = "删除角色")
@RequiresPermissions("upms:role:delete")
@RequestMapping(value = "/delete/{ids}",method = RequestMethod.GET)
@ResponseBody
public Object delete(@PathVariable("ids") String ids) {
int count = upmsRoleService.deleteByPrimaryKeys(ids);
return new UpmsResult(UpmsResultConstant.SUCCESS, count);
}
@ApiOperation(value = "修改角色")
@RequiresPermissions("upms:role:update")
@RequestMapping(value = "/update/{id}", method = RequestMethod.GET)
public String update(@PathVariable("id") int id, ModelMap modelMap) {
UpmsRole role = upmsRoleService.selectByPrimaryKey(id);
modelMap.put("role", role);
return "/manage/role/update.jsp";
}
@ApiOperation(value = "修改角色")
@RequiresPermissions("upms:role:update")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public Object update(@PathVariable("id") int id, UpmsRole upmsRole) {
ComplexResult result = FluentValidator.checkAll()
.on(upmsRole.getName(), new LengthValidator(1, 20, "名称"))
.on(upmsRole.getTitle(), new LengthValidator(1, 20, "标题"))
.doValidate()
.result(ResultCollectors.toComplex());
if (!result.isSuccess()) {
return new UpmsResult(UpmsResultConstant.INVALID_LENGTH, result.getErrors());
}
upmsRole.setRoleId(id);
int count = upmsRoleService.updateByPrimaryKeySelective(upmsRole);
return new UpmsResult(UpmsResultConstant.SUCCESS, count);
}
}
| [
"2779429237@qq.com"
] | 2779429237@qq.com |
7c54071791022adb42a838005c8caef90f7125c2 | 67081693797bdfc4f615d671af0fd5fb74f851a4 | /leetcode/src/main/java/L0944_Delete_Columns_to_Make_Sorted.java | 58cb7f27913db23955f8eef41e835efa58158d9a | [] | no_license | zzsoszz/LeetCode | 1e32f4a3270bb892df02c3c8f93fca79b769bf71 | 982147ecfd988b97b48a280df74a5f6bb38de92f | refs/heads/master | 2023-03-23T13:58:09.190892 | 2021-02-24T02:50:17 | 2021-02-24T02:50:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 165 | java |
// https://leetcode-cn.com/problems/delete-columns-to-make-sorted/
class L0944_Delete_Columns_to_Make_Sorted {
public int minDeletionSize(String[] A) {
}
} | [
"15822882820@163.com"
] | 15822882820@163.com |
857a674a11f9deaef4ab6b29e8ccd8a4724e3e86 | b94c49d4c4389992868dab90756b38b1b12351d4 | /src/com/github/cuter44/muuga/contract/servlet/LoanCreate.java | e040360d7bfa4cce75d6ef2ed08e81241de75fd2 | [] | no_license | cuter44/muuga | a6f67940c4ba428d05ccf9d7e69377e352173f7b | e49ab73fbae29373b8b691bc08baf0a03a811da8 | HEAD | 2016-09-11T03:43:00.339838 | 2015-03-23T16:39:09 | 2015-03-23T16:39:09 | 24,768,952 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,862 | java | package com.github.cuter44.muuga.contract.servlet;
import java.io.*;
import java.security.PrivateKey;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import com.github.cuter44.nyafx.dao.*;
import static com.github.cuter44.nyafx.dao.EntityNotFoundException.entFound;
import com.github.cuter44.nyafx.servlet.*;
import static com.github.cuter44.nyafx.servlet.Params.notNull;
import static com.github.cuter44.nyafx.servlet.Params.getLong;
import static com.github.cuter44.nyafx.servlet.Params.needLong;
//import com.github.cuter44.muuga.util.conf.*;
import static com.github.cuter44.muuga.Constants.*;
import com.github.cuter44.muuga.contract.model.*;
import com.github.cuter44.muuga.contract.core.*;
import com.github.cuter44.muuga.desire.core.*;
/** 应征别人的心愿, 发起借阅
* <pre style="font-size:12px">
<strong>请求</strong>
POST /contract/loan/create.api
<strong>参数</strong>
uid :long, 自己的 uid, 作为交易的参与方
desire :long, 应答的 desire id,
book :long, 在应答一个想借心愿时可选, 要出售的书的id, 用于标记为已借出
<i>鉴权</i>
uid :long , 必需, uid
s :hex , 必需, session key
<strong>响应</strong>
application/json, class={@link Json#jsonizeContractBase(ContractBase, JSONObject) contract.model.LoanContract}
<strong>例外</strong>
parsed by {@link com.github.cuter44.muuga.sys.servlet.ExceptionHandler ExceptionHandler}
<strong>样例</strong>暂无
* </pre>
*
*/
@WebServlet("/contract/loan/create.api")
public class LoanCreate extends HttpServlet
{
private static final String UID = "uid";
private static final String DESIRE = "desire";
private static final String BOOK = "book";
protected TradeContractDao tradeDao = TradeContractDao.getInstance();
protected TradeController tradeCtl = TradeController.getInstance();
@Override
public void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException
{
req.setCharacterEncoding("utf-8");
try
{
Long uid = needLong(req, UID);
Long desire = needLong(req, DESIRE);
Long book = getLong(req, BOOK);
this.tradeDao.begin();
TradeContract trade = this.tradeCtl.create(desire, uid, book);
this.tradeDao.commit();
Json.writeContractBase(trade, resp);
}
catch (Exception ex)
{
req.setAttribute(KEY_EXCEPTION, ex);
req.getRequestDispatcher(URI_ERROR_HANDLER).forward(req, resp);
}
finally
{
this.tradeDao.close();
}
return;
}
}
| [
"cuter44@foxmail.com"
] | cuter44@foxmail.com |
3fde8812ec67426228c370e995833f14f77934b3 | 243ff64ebc9440ee44547ae08e3891cf93f98b12 | /HonGong/chap08/src/sec02/exam02/Taxi.java | 352a0da2cfab4f778b23c428969c6ca112b0b911 | [] | no_license | aranparrk/hongong | a5034a8b51a2d5a6af3f777c62c20764743a87b7 | b5372d294fc29afdc92e59299b29cd40b76f3694 | refs/heads/main | 2023-05-09T11:18:17.154241 | 2021-04-25T12:17:00 | 2021-04-25T12:17:00 | 356,853,858 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 150 | java | package sec02.exam02;
public class Taxi implements Vehicle {
@Override
public void run() {
System.out.println("택시가 달립니다.");
}
}
| [
"aranparrk@gmail.com"
] | aranparrk@gmail.com |
ce4f5158c6a59959f2f85230d5ef3e5566c801a1 | c46cd24dac02ab3bdcaa2d66631d042bacbb9cab | /src/main/java/com/tang/tiny/generator/MyBatisPlusGenerator.java | 98f8eb20c81cb67de11e053110f1b369d8ae8edb | [] | no_license | tangjiadong/tang-server-tiny | 6dd7cab925f2451f1d7008cb6d949c810f01a34e | 0d0fee247105cbc89cbb9d65bcf09351e752cd75 | refs/heads/master | 2023-05-10T07:51:11.405684 | 2021-06-04T10:33:05 | 2021-06-04T10:33:05 | 344,779,736 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,410 | java | package com.tang.tiny.generator;
import cn.hutool.core.util.StrUtil;
import cn.hutool.setting.dialect.Props;
import com.baomidou.mybatisplus.core.exceptions.MybatisPlusException;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.generator.AutoGenerator;
import com.baomidou.mybatisplus.generator.InjectionConfig;
import com.baomidou.mybatisplus.generator.config.*;
import com.baomidou.mybatisplus.generator.config.po.LikeTable;
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
import com.baomidou.mybatisplus.generator.config.rules.DateType;
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
import com.baomidou.mybatisplus.generator.engine.VelocityTemplateEngine;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
/**
* MyBatisPlus代码生成器
* Created by Tang on 2020/8/20.
*/
public class MyBatisPlusGenerator {
public static void main(String[] args) {
String projectPath = System.getProperty("user.dir");
String moduleName = scanner("模块名");
String[] tableNames = scanner("表名,多个英文逗号分割").split(",");
// 代码生成器
AutoGenerator autoGenerator = new AutoGenerator();
autoGenerator.setGlobalConfig(initGlobalConfig(projectPath));
autoGenerator.setDataSource(initDataSourceConfig());
autoGenerator.setPackageInfo(initPackageConfig(moduleName));
autoGenerator.setCfg(initInjectionConfig(projectPath, moduleName));
autoGenerator.setTemplate(initTemplateConfig());
autoGenerator.setStrategy(initStrategyConfig(tableNames));
autoGenerator.setTemplateEngine(new VelocityTemplateEngine());
autoGenerator.execute();
}
/**
* 读取控制台内容信息
*/
private static String scanner(String tip) {
Scanner scanner = new Scanner(System.in);
System.out.println(("请输入" + tip + ":"));
if (scanner.hasNext()) {
String next = scanner.next();
if (StrUtil.isNotEmpty(next)) {
return next;
}
}
throw new MybatisPlusException("请输入正确的" + tip + "!");
}
/**
* 初始化全局配置
*/
private static GlobalConfig initGlobalConfig(String projectPath) {
GlobalConfig globalConfig = new GlobalConfig();
globalConfig.setOutputDir(projectPath + "/src/main/java");
globalConfig.setAuthor("Tang");
globalConfig.setOpen(false);
globalConfig.setSwagger2(true);
globalConfig.setBaseResultMap(true);
globalConfig.setFileOverride(true);
globalConfig.setDateType(DateType.ONLY_DATE);
globalConfig.setEntityName("%s");
globalConfig.setMapperName("%sMapper");
globalConfig.setXmlName("%sMapper");
globalConfig.setServiceName("%sService");
globalConfig.setServiceImplName("%sServiceImpl");
globalConfig.setControllerName("%sController");
return globalConfig;
}
/**
* 初始化数据源配置
*/
private static DataSourceConfig initDataSourceConfig() {
Props props = new Props("generator.properties");
DataSourceConfig dataSourceConfig = new DataSourceConfig();
dataSourceConfig.setUrl(props.getStr("dataSource.url"));
dataSourceConfig.setDriverName(props.getStr("dataSource.driverName"));
dataSourceConfig.setUsername(props.getStr("dataSource.username"));
dataSourceConfig.setPassword(props.getStr("dataSource.password"));
return dataSourceConfig;
}
/**
* 初始化包配置
*/
private static PackageConfig initPackageConfig(String moduleName) {
Props props = new Props("generator.properties");
PackageConfig packageConfig = new PackageConfig();
packageConfig.setModuleName(moduleName);
packageConfig.setParent(props.getStr("package.base"));
packageConfig.setEntity("model");
return packageConfig;
}
/**
* 初始化模板配置
*/
private static TemplateConfig initTemplateConfig() {
TemplateConfig templateConfig = new TemplateConfig();
//可以对controller、service、entity模板进行配置
//mapper.xml模板需单独配置
templateConfig.setXml(null);
return templateConfig;
}
/**
* 初始化策略配置
*/
private static StrategyConfig initStrategyConfig(String[] tableNames) {
StrategyConfig strategyConfig = new StrategyConfig();
strategyConfig.setNaming(NamingStrategy.underline_to_camel);
strategyConfig.setColumnNaming(NamingStrategy.underline_to_camel);
strategyConfig.setEntityLombokModel(true);
strategyConfig.setRestControllerStyle(true);
//当表名中带*号时可以启用通配符模式
if (tableNames.length == 1 && tableNames[0].contains("*")) {
String[] likeStr = tableNames[0].split("_");
String likePrefix = likeStr[0] + "_";
strategyConfig.setLikeTable(new LikeTable(likePrefix));
} else {
strategyConfig.setInclude(tableNames);
}
return strategyConfig;
}
/**
* 初始化自定义配置
*/
private static InjectionConfig initInjectionConfig(String projectPath, String moduleName) {
// 自定义配置
InjectionConfig injectionConfig = new InjectionConfig() {
@Override
public void initMap() {
// 可用于自定义属性
}
};
// 模板引擎是Velocity
String templatePath = "/templates/mapper.xml.vm";
// 自定义输出配置
List<FileOutConfig> focList = new ArrayList<>();
// 自定义配置会被优先输出
focList.add(new FileOutConfig(templatePath) {
@Override
public String outputFile(TableInfo tableInfo) {
// 自定义输出文件名 , 如果你 Entity 设置了前后缀、此处注意 xml 的名称会跟着发生变化!!
return projectPath + "/src/main/resources/mapper/" + moduleName
+ "/" + tableInfo.getEntityName() + "Mapper" + StringPool.DOT_XML;
}
});
injectionConfig.setFileOutConfigList(focList);
return injectionConfig;
}
} | [
"tang897396324@163.com"
] | tang897396324@163.com |
476052e4c081eb87bdb84d78a805f76164fe4964 | f0a142263a8dc0d31af25e526ddfbf51d65e2b37 | /Cspebank/src/main/java/com/cspebank/www/utils/PreferencesUtils.java | 9b2a216b787101d72a66a4b8c62c0eb2bcaaa400 | [] | no_license | 837434136/test_git | 89069dffedc114cc1e6c05c02e493c814658bbbe | 51b60ccd45c2e4954db740401378021621d15c84 | refs/heads/master | 2021-01-13T13:05:24.245956 | 2016-03-01T03:50:32 | 2016-03-01T03:50:59 | 52,845,340 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,450 | java | package com.cspebank.www.utils;
import android.content.Context;
import android.content.SharedPreferences;
/**
* @author yisinian.deng
* 2015.11.18
*/
public class PreferencesUtils {
public static String PREFERENCE_NAME = "Cspe";
/**
* put string preferences
*
* @param context
* @param key
* The name of the preference to modify
* @param value
* The new value for the preference
* @return True if the new values were successfully written to persistent
* storage.
*/
public static boolean putString(Context context, String key, String value) {
return putString(context, PREFERENCE_NAME, key, value);
}
public static boolean putString(Context context, String preferencesName, String key, String value) {
SharedPreferences settings = context.getSharedPreferences(preferencesName, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = settings.edit();
editor.putString(key, value);
return editor.commit();
}
/**
* get string preferences
*
* @param context
* @param key
* The name of the preference to retrieve
* @param defaultValue
* Value to return if this preference does not exist
* @return The preference value if it exists, or defValue. Throws
* ClassCastAppException if there is a preference with this name that
* is not a string
*/
public static String getString(Context context, String key, String defaultValue) {
return getString(context, PREFERENCE_NAME, key, defaultValue);
}
public static String getString(Context context, String preferencesName, String key, String defaultValue) {
SharedPreferences settings = context.getSharedPreferences(preferencesName, Context.MODE_PRIVATE);
return settings.getString(key, defaultValue);
}
/**
* put int preferences
*
* @param context
* @param key
* The name of the preference to modify
* @param value
* The new value for the preference
* @return True if the new values were successfully written to persistent
* storage.
*/
public static boolean putInt(Context context, String key, int value) {
return putInt(context, PREFERENCE_NAME, key, value);
}
public static boolean putInt(Context context, String preferencesName, String key, int value) {
SharedPreferences settings = context.getSharedPreferences(preferencesName, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = settings.edit();
editor.putInt(key, value);
return editor.commit();
}
/**
* get int preferences
*
* @param context
* @param key
* The name of the preference to retrieve
* @param defaultValue
* Value to return if this preference does not exist
* @return The preference value if it exists, or defValue. Throws
* ClassCastAppException if there is a preference with this name that
* is not a int
*/
public static int getInt(Context context, String key, int defaultValue) {
return getInt(context, PREFERENCE_NAME, key, defaultValue);
}
public static int getInt(Context context, String preferencesName, String key, int defaultValue) {
SharedPreferences settings = context.getSharedPreferences(preferencesName, Context.MODE_PRIVATE);
return settings.getInt(key, defaultValue);
}
/**
* put long preferences
*
* @param context
* @param key
* The name of the preference to modify
* @param value
* The new value for the preference
* @return True if the new values were successfully written to persistent
* storage.
*/
public static boolean putLong(Context context, String key, long value) {
return putLong(context, PREFERENCE_NAME, key, value);
}
public static boolean putLong(Context context, String preferencesName, String key, long value) {
SharedPreferences settings = context.getSharedPreferences(preferencesName, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = settings.edit();
editor.putLong(key, value);
return editor.commit();
}
/**
* get long preferences
*
* @param context
* @param key
* The name of the preference to retrieve
* @param defaultValue
* Value to return if this preference does not exist
* @return The preference value if it exists, or defValue. Throws
* ClassCastAppException if there is a preference with this name that
* is not a long
*/
public static long getLong(Context context, String key, long defaultValue) {
return getLong(context, PREFERENCE_NAME, key, defaultValue);
}
public static long getLong(Context context, String preferencesName, String key, long defaultValue) {
SharedPreferences settings = context.getSharedPreferences(preferencesName, Context.MODE_PRIVATE);
return settings.getLong(key, defaultValue);
}
/**
* put float preferences
*
* @param context
* @param key
* The name of the preference to modify
* @param value
* The new value for the preference
* @return True if the new values were successfully written to persistent
* storage.
*/
public static boolean putFloat(Context context, String key, float value) {
return putFloat(context, PREFERENCE_NAME, key, value);
}
public static boolean putFloat(Context context, String preferencesName, String key, float value) {
SharedPreferences settings = context.getSharedPreferences(preferencesName, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = settings.edit();
editor.putFloat(key, value);
return editor.commit();
}
/**
* get float preferences
*
* @param context
* @param key
* The name of the preference to retrieve
* @param defaultValue
* Value to return if this preference does not exist
* @return The preference value if it exists, or defValue. Throws
* ClassCastAppException if there is a preference with this name that
* is not a float
*/
public static float getFloat(Context context, String key, float defaultValue) {
return getFloat(context, PREFERENCE_NAME, key, defaultValue);
}
public static float getFloat(Context context, String preferencesName, String key, float defaultValue) {
SharedPreferences settings = context.getSharedPreferences(preferencesName, Context.MODE_PRIVATE);
return settings.getFloat(key, defaultValue);
}
/**
* put boolean preferences
*
* @param context
* @param key
* The name of the preference to modify
* @param value
* The new value for the preference
* @return True if the new values were successfully written to persistent
* storage.
*/
public static boolean putBoolean(Context context, String key, boolean value) {
return putBoolean(context, PREFERENCE_NAME, key, value);
}
public static boolean putBoolean(Context context, String preferencesName, String key, boolean value) {
SharedPreferences settings = context.getSharedPreferences(preferencesName, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = settings.edit();
editor.putBoolean(key, value);
return editor.commit();
}
/**
* get boolean preferences
*
* @param context
* @param key
* The name of the preference to retrieve
* @param defaultValue
* Value to return if this preference does not exist
* @return The preference value if it exists, or defValue. Throws
* ClassCastAppException if there is a preference with this name that
* is not a boolean
*/
public static boolean getBoolean(Context context, String key, boolean defaultValue) {
return getBoolean(context, PREFERENCE_NAME, key, defaultValue);
}
public static boolean getBoolean(Context context, String preferencesName, String key, boolean defaultValue) {
SharedPreferences settings = context.getSharedPreferences(preferencesName, Context.MODE_PRIVATE);
return settings.getBoolean(key, defaultValue);
}
/**
* clear the preferences
*
* @param context
* @param preferenceName
*/
public static void clear(Context context) {
clear(context, PREFERENCE_NAME);
}
/**
* clear the preferences
*
* @param context
* @param preferenceName
*/
public static void clear(Context context, String preferenceName) {
SharedPreferences settings = context.getSharedPreferences(preferenceName, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = settings.edit();
editor.clear();
editor.commit();
}
} | [
"tx16bing@163.com"
] | tx16bing@163.com |
97f8d33c5932469603021d3c56afc0b93981704e | a43bf399b62b9ca17eb95c80c99067b925fdd2ad | /Other Practice/AndroidPractice/UI/app/src/test/java/com/example/jing/ui/ExampleUnitTest.java | cd000453e457029cdaaf3786cbbb2e609021317f | [] | no_license | imjinghun/university | d4bdf80ae6ed3d5a88c5a8b38c7640f19b0efe2c | 1f5e9c0301ab4d38e4504d6c9cae4b5a187ce26b | refs/heads/master | 2021-01-01T16:13:34.426161 | 2017-09-11T13:00:40 | 2017-09-11T13:00:40 | 97,788,115 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 401 | java | package com.example.jing.ui;
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);
}
} | [
"1377525269@qq.com"
] | 1377525269@qq.com |
2eaac27f3d72dd7067e2221face5b3876408ed36 | a54ac8f00726b3e2b8c47739f6c9e2a4b1e20e18 | /src/main/java/com/google/android/exoplayer/multitv/util/FlacStreamInfo.java | 2112e8e6368567ed51dbfc882dfb7e865ffd29d5 | [] | no_license | akashanjana08/Vikram_Player_Sdk_Android | f939af2833965c64226c6eece77dc7477f70f389 | d23184f43cf66364dc713994f76660b1237e3fca | refs/heads/master | 2020-06-07T03:59:55.757875 | 2019-06-20T12:42:12 | 2019-06-20T12:42:12 | 192,917,835 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,648 | java | /*
* Copyright (C) 2016 The Android Open Source 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.google.android.exoplayer.multitv.util;
/**
* Holder for FLAC stream info.
*/
public final class FlacStreamInfo {
public final int minBlockSize;
public final int maxBlockSize;
public final int minFrameSize;
public final int maxFrameSize;
public final int sampleRate;
public final int channels;
public final int bitsPerSample;
public final long totalSamples;
/**
* Constructs a FlacStreamInfo parsing the given binary FLAC stream info metadata structure.
*
* @param data An array holding FLAC stream info metadata structure
* @param offset Offset of the structure in the array
* @see <a href="https://xiph.org/flac/format.html#metadata_block_streaminfo">FLAC format
* METADATA_BLOCK_STREAMINFO</a>
*/
public FlacStreamInfo(byte[] data, int offset) {
ParsableBitArray scratch = new ParsableBitArray(data);
scratch.setPosition(offset * 8);
this.minBlockSize = scratch.readBits(16);
this.maxBlockSize = scratch.readBits(16);
this.minFrameSize = scratch.readBits(24);
this.maxFrameSize = scratch.readBits(24);
this.sampleRate = scratch.readBits(20);
this.channels = scratch.readBits(3) + 1;
this.bitsPerSample = scratch.readBits(5) + 1;
this.totalSamples = scratch.readBits(36);
// Remaining 16 bytes is md5 value
}
public FlacStreamInfo(int minBlockSize, int maxBlockSize, int minFrameSize, int maxFrameSize,
int sampleRate, int channels, int bitsPerSample, long totalSamples) {
this.minBlockSize = minBlockSize;
this.maxBlockSize = maxBlockSize;
this.minFrameSize = minFrameSize;
this.maxFrameSize = maxFrameSize;
this.sampleRate = sampleRate;
this.channels = channels;
this.bitsPerSample = bitsPerSample;
this.totalSamples = totalSamples;
}
public int maxDecodedFrameSize() {
return maxBlockSize * channels * 2;
}
public int bitRate() {
return bitsPerSample * sampleRate;
}
public long durationUs() {
return (totalSamples * 1000000L) / sampleRate;
}
}
| [
"akashanjana08@gmail.com"
] | akashanjana08@gmail.com |
c9fbb1768409e02fb7eedee40a7be7803497132f | b28a09b631b435eddd9202829f92debe95f23a7c | /mall-business/thirdparty-provider/src/main/java/com/lcchain/mall/thirdparty/provider/service/impl/trafficService/TrafficFactory.java | f4d3ea05b7ab08643d0b7b94a23620983fab0c7a | [] | no_license | yiwenluohx/mall-platform | 2ab5c61f3b53700a5dda3ec2b53688843f0b03d1 | 688ed04714e6efac9cca44ace5b02ace9c59fd2d | refs/heads/master | 2023-08-30T03:06:21.078599 | 2023-08-17T05:54:17 | 2023-08-17T05:54:17 | 277,691,598 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 771 | java | package com.lcchain.mall.thirdparty.provider.service.impl.trafficService;
import com.lcchain.mall.thirdparty.provider.service.impl.trafficService.concrete.ThirdPartyTraffic;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
/**
* @author luohx
* @desc
* @date 2020/07/06
*/
public class TrafficFactory {
private static Map<Integer, ThirdPartyTraffic> trafficMap = new HashMap();
public static void put(int trafficType, ThirdPartyTraffic partyTraffic){
trafficMap.put(trafficType, partyTraffic);
}
public static ThirdPartyTraffic getClientPay(int type) {
ThirdPartyTraffic partyTraffic = trafficMap.get(type);
return Optional.ofNullable(partyTraffic).orElse(null);
}
}
| [
"Lhongxiao@lcchain.com"
] | Lhongxiao@lcchain.com |
2c9beb7c84892386552a117d29fec87cd0d6831b | 52d004eabd95fa6f5912aae364dc3d95285f9640 | /designer/src/main/java/com/baidu/rigel/biplatform/ma/resource/UpdateDataResource.java | fa3a5e3755a0ba145c6c879e31006c2fd7962a38 | [
"Apache-2.0"
] | permissive | fjfd/bi-platform | f92d521b051812e4a2ee0bae7da1b284901c9ffd | 00b6c2e9e3a467e85cd4ba998c7852f34b5207fa | refs/heads/new_master | 2021-01-13T09:10:19.911399 | 2015-07-01T02:32:18 | 2015-07-01T02:32:18 | 38,604,972 | 2 | 4 | null | 2015-07-06T07:49:14 | 2015-07-06T07:49:13 | null | UTF-8 | Java | false | false | 6,422 | java | /**
* Copyright (c) 2014 Baidu, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* 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.baidu.rigel.biplatform.ma.resource;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.baidu.rigel.biplatform.ac.query.MiniCubeConnection;
import com.baidu.rigel.biplatform.ac.query.data.DataSourceInfo;
import com.baidu.rigel.biplatform.ma.ds.service.DataSourceConnectionService;
import com.baidu.rigel.biplatform.ma.ds.service.DataSourceConnectionServiceFactory;
import com.baidu.rigel.biplatform.ma.ds.service.DataSourceService;
import com.baidu.rigel.biplatform.ma.model.ds.DataSourceDefine;
import com.baidu.rigel.biplatform.ma.model.utils.GsonUtils;
//import com.baidu.rigel.biplatform.ma.report.service.ReportNoticeByJmsService;
import com.google.common.collect.Maps;
import com.google.gson.reflect.TypeToken;
/**
*
* 同步更新数据rest接口,用于提供同步数据更新支持
* @author david.wang
*
*/
@RestController
@RequestMapping("/silkroad/reports/dataupdate")
public class UpdateDataResource extends BaseResource {
/**
* LOG
*/
private static final Logger LOG = LoggerFactory.getLogger(UpdateDataResource.class);
/**
* dsService
*/
@Resource
private DataSourceService dsService;
// @Resource
// private ReportNoticeByJmsService reportNoticeByJmsService;
/**
*
* @param request HttpServletRequest
* @param response HttpServletResponse
* @return ResponseResult
*/
@RequestMapping(method = { RequestMethod.GET, RequestMethod.POST })
public ResponseResult updateData(HttpServletRequest request, HttpServletResponse response) throws Exception {
LOG.info("[INFO] --- --- begin update index meta with new request");
long begin = System.currentTimeMillis();
String dsName = request.getParameter("dsName");
String factTables = request.getParameter("factTables");
if (StringUtils.isEmpty(dsName) || StringUtils.isEmpty(factTables)) {
ResponseResult rs = new ResponseResult();
rs.setStatus(1);
rs.setStatusInfo("请求中需要包含dsName, factTables信息。"
+ "其中dsName为数据源名称,factTables为更新的事实表列表,多张表以’,‘分割");
return rs;
}
String[] factTableArray = factTables.split(",");
ResponseResult rs = new ResponseResult();
DataSourceDefine ds = dsService.getDsDefine(Integer.toString(dsName.hashCode()));
DataSourceConnectionService<?> dsConnService = DataSourceConnectionServiceFactory.
getDataSourceConnectionServiceInstance(ds.getDataSourceType().toString ());
DataSourceInfo dsInfo = dsConnService.parseToDataSourceInfo(ds, securityKey);
Map<String, Map<String, String>> conds = Maps.newHashMap();
for (String factTable : factTableArray) {
String str = request.getParameter(factTable);
LOG.info("[INFO] --- --- conditions for {} is : {}", factTable, str);
if (isValidate(str)) {
conds.put(factTable, GsonUtils.fromJson(str, new TypeToken<Map<String, String>>() {}.getType()));
}
}
String condsStr = null;
if (conds.size() > 0) {
condsStr = GsonUtils.toJson(conds);
}
LOG.info("[INFO] --- --- conds : {}", conds);
LOG.info("[INFO] --- --- request params list ----------------------------------");
LOG.info("[INFO] --- --- dsName = {}", dsName);
LOG.info("[INFO] --- --- factTables = {}", factTables);
LOG.info("[INFO] --- --- conds = {}", condsStr);
LOG.info("[INFO] --- --- --- ---- ---- end pring param list --- --- --- --- ---- ");
boolean result = MiniCubeConnection.ConnectionUtil.refresh(dsInfo, factTableArray, condsStr);
// reportNoticeByJmsService.refreshIndex(dsInfo, factTableArray, condsStr);
if (result) {
rs.setStatus(0);
rs.setStatusInfo("successfully");
} else {
rs.setStatus(1);
rs.setStatusInfo("failed");
}
LOG.info("[INFO] -- --- update index meta result : {}", result);
LOG.info("[INFO] --- --- end update index meta, cost {} ms", (System.currentTimeMillis() - begin));
return rs;
}
private boolean isValidate(String str) {
if (StringUtils.isEmpty(str)) {
return false;
}
try {
JSONObject json = new JSONObject(str);
if (StringUtils.isEmpty(json.getString("begin")) || StringUtils.isEmpty(json.getString("end"))) {
throw new IllegalStateException("request param status incorrected");
}
Long begin = Long.valueOf(json.getString("begin"));
if (begin <= 0) {
throw new IllegalStateException("begin value need bigger than zero");
}
Long end = Long.valueOf(json.getString("end"));
if (end < begin) {
throw new IllegalStateException("end value must larger than begin");
}
} catch (Exception e) {
LOG.info(e.getMessage(), e);
throw new IllegalStateException("request param must be json style");
}
return true;
}
}
| [
"sishuiliunian2004@163.com"
] | sishuiliunian2004@163.com |
b6b55dce717f4cb183ce97a6b1def18d621dbe81 | 810ad4fb4bbbd9985f05be83f2dd3a7f701d2a00 | /back/src/back/Main1225.java | dac05dbceff204aa10411ce773e9bd18ed6c90e5 | [] | no_license | witness0109/backJun | 1383f15b36f5cb04312b0b4c3d7ae73a0df624ab | 0f5faf9c98934b744de41983317a235701ca80ce | refs/heads/master | 2022-11-18T02:22:38.019753 | 2020-07-22T08:24:54 | 2020-07-22T08:24:54 | 276,302,537 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 751 | java | package back;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main1225 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
String a = st.nextToken();
String b = st.nextToken();
String aa[] = a.split("");
String bb[] = b.split("");
int n = aa.length;
int m = bb.length;
long sumA=0, sumB=0;
for(int i=0; i<n; i++){
sumA += Integer.parseInt(aa[i]);
}
for(int i = 0; i<m; i++) {
sumB += Integer.parseInt(bb[i]);
}
long res = sumA*sumB;
System.out.println(res);
}
}
| [
"witness0109@gmail.com"
] | witness0109@gmail.com |
5ee54ab26875e84e5698626ebdf615a149327925 | 0b927196000dd96ac708dd842216f889ed4fd2f0 | /mylist/src/com/luv2code/mylist/mvc/service/ProductServiceImpl.java | 7b7f2ab400ae9708a78934023032b10fa1234109 | [] | no_license | GertRoux/myshoppinglist | 29e0a43c59cc3f248ca7d8ba37e0eef480e2d49c | cc0cc814a1b3c1670dbc1528f366e3b7d83ffa2b | refs/heads/master | 2023-01-07T13:40:51.070666 | 2020-11-23T07:13:04 | 2020-11-23T07:13:04 | 257,510,402 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,075 | java | package com.luv2code.mylist.mvc.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.luv2code.mylist.hibernate.model.Product;
import com.luv2code.mylist.mvc.dao.ProductDAO;
@Service
public class ProductServiceImpl implements ProductService {
@Autowired
private ProductDAO productDAO;
@Override
@Transactional
public List<Product> getAllProducts() {
return productDAO.getAllProducts();
}
@Override
@Transactional
public Product getProductForId(int productId) {
return productDAO.getProductForId(productId);
}
@Override
@Transactional
public List<Product> searchProducts(String theSearchName) {
return productDAO.searchProducts(theSearchName);
}
@Override
@Transactional
public void deleteProductForId(int productId) {
productDAO.deleteProductForId(productId);
}
@Override
@Transactional
public void saveProduct(Product product) {
productDAO.saveProduct(product);
}
}
| [
"gert.roux@estalea.com"
] | gert.roux@estalea.com |
71918565577cf2d353af4e58e0e322944dea5d27 | 33fc75e370bfb6cde2c656ebbe8c4fa45868e2e1 | /BankSystem.phase5_collections/src/bank/core/Logger.java | 786de3b3005ed755aaab67528409af3950327f3b | [] | no_license | eldarba/822-130 | d6a9f001dff1789a67e680396dee450e9bc73c7a | 43d3c83f5d73b0e0d8bbc21ffb5ef18ca5736e3a | refs/heads/master | 2023-04-28T00:06:00.613703 | 2021-05-10T12:04:36 | 2021-05-10T12:04:36 | 313,205,642 | 2 | 3 | null | null | null | null | UTF-8 | Java | false | false | 558 | java | package bank.core;
import java.util.ArrayList;
import java.util.List;
public class Logger {
// we can save the log instances in a collection
private static List<Log> logs = new ArrayList<Log>();
// will be in use when working with database
private String driverName;
public Logger(String driverName) {
super();
this.driverName = driverName;
}
public static void log(Log log) {
System.out.println(log);
logs.add(log);
}
public static List<Log> getLogs() {
return logs;
}
public String getDriverName() {
return driverName;
}
}
| [
"eldarba@gmail.com"
] | eldarba@gmail.com |
5e626bd3a5c2666fc2e07d9b79286c15ea0f0c1f | 0f947503acb46a3895b8f2742eb87aa7f9f6cdb3 | /test42/app/src/main/java/ru/underground/test42/InnerThings/Step.java | c25c83c57b19479d5449074b9f9cd6b61ccdc2a2 | [] | no_license | IgorAnohin/Uderground_team | 69f6a54420e4bd3f4ab74122a9c1193f70f915af | d29e45ff5e8ca7d31d658bc26d3c304214e16e19 | refs/heads/master | 2021-01-25T14:23:25.253914 | 2018-03-04T11:16:13 | 2018-03-04T11:23:22 | 123,692,301 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,797 | java | package ru.underground.test42.InnerThings;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import java.net.URL;
import java.util.ArrayList;
public class Step {
//типо enum
public static int BASE = 0;
public static int TIMER = 1;
private String m_pictureUrl;
private int m_time;
private ArrayList<Integer> m_lastSteps;
private int m_type;
private String m_desc;
private boolean m_done;
public Bitmap loadedDrawable;
public boolean Initialize(String url, int time,ArrayList<Integer> lastSteps, int type, String desc) {
//Проверка url картинки
if (URLChecker.checkURL(url) && URLChecker.checkForPicture(url))
m_pictureUrl = url;
else
return false;
m_time = time;
m_lastSteps = lastSteps;
m_type = type;
m_desc = desc;
m_done = false;
Thread t = new Thread() {
@Override
public void run() {
try {
final Bitmap bitmap = BitmapFactory.decodeStream(new URL(getUrl()).openStream());
loadedDrawable=bitmap;
} catch (Exception e) {
e.printStackTrace();
}
}
};
t.start();
return true;
}
public String getUrl() {
return m_pictureUrl;
}
public int getTime() {
return m_time;
}
public ArrayList<Integer> getLastSteps() {
return m_lastSteps;
}
public int getType() {
return m_type;
}
public String getDesc() {
return m_desc;
}
public boolean isDone() {
return m_done;
}
public void setDone(boolean done) {
m_done = done;
}
}
| [
"igor.anohin@emlid.com"
] | igor.anohin@emlid.com |
ef9de623ea6d76bca799e50bf98f0b53e70a372f | 8603c7b5de8ef256e26728d22bd4a780d0dca436 | /spring-boot-react-example/server/demo/src/test/java/com/kati/demo/DemoApplicationTests.java | 4bee133ecd39316ac7d5a9503e188b8f496581a3 | [] | no_license | katalinkovacs/entando-react | e7551c0b9e44623df7b0ace7233ac531da2132f4 | cb3bd9d77be14f4d086c095e70b5fbe45b65332d | refs/heads/master | 2020-03-09T14:58:24.400405 | 2018-04-10T00:44:32 | 2018-04-10T00:44:32 | 128,848,415 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 328 | java | package com.kati.demo;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class DemoApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"katalinkovacsnz@gmail.com"
] | katalinkovacsnz@gmail.com |
2758c1b997a7a056197bc61e6fa35d7547e1381e | 3f83c998284dd6003c9ff578ac94e58dd8176ee8 | /src/br/usjt/arqsw/entity/Fila.java | fc92bd4bb4553c3a63957aba44ee6c45e1ce6af2 | [] | no_license | anamacedo01/teste | c7c5debd49064b29530538bc8b3bffd904f8d5cc | afbdafa78a4c32d3049b0cc9403ccf356c2a56f2 | refs/heads/master | 2020-03-16T13:06:06.125554 | 2018-05-09T00:48:28 | 2018-05-09T00:48:28 | 132,681,332 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 1,166 | java | package br.usjt.arqsw.entity;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
/**
*
* @author 817119056 - Tainá Monteiro Gomes - SIN3AN MCA
*/
@Entity
public class Fila implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
@Column(name="id_fila")
@NotNull(message="A fila não pode ser vazia")
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private int id;
@NotNull
@Size(min=5, max=45, message="O nome da fila deve estar entre 5 e 45 caracteres.")
@Column(name="nm_fila")
private String nome;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
@Override
public String toString() {
return "Fila [id=" + id + ", nome=" + nome + "]";
}
}
| [
"anapaulasilvademacedo@yahoo.com.br"
] | anapaulasilvademacedo@yahoo.com.br |
2529e1afa8e633c099979d24d1bcd34cae1d7065 | afab72f0209764c956d609873b7f2b517d67ad5f | /WebServiceClients/src/zw/co/esolutions/ewallet/process/ProcessService_Service.java | 9fdf3a20f5243dc7cf9ff2c5b07784a25c56c6ab | [] | no_license | wasadmin/ewallet | 899e66d4d03e77a8f85974d9d2cba8940cf2018a | e132a5e569f4bb67a83df0c3012bb341ffaaf2ed | refs/heads/master | 2021-01-23T13:48:34.618617 | 2012-11-15T10:47:55 | 2012-11-15T10:47:55 | 6,703,145 | 3 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,571 | java | //
// Generated By:JAX-WS RI 2.2.4-b01 (JAXB RI IBM 2.2.4)
//
package zw.co.esolutions.ewallet.process;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import javax.xml.ws.WebEndpoint;
import javax.xml.ws.WebServiceClient;
import javax.xml.ws.WebServiceException;
import javax.xml.ws.WebServiceFeature;
@WebServiceClient(name = "ProcessService", targetNamespace = "http://process.ewallet.esolutions.co.zw/", wsdlLocation = "META-INF/wsdl/ProcessService.wsdl")
public class ProcessService_Service
extends Service
{
private final static URL PROCESSSERVICE_WSDL_LOCATION;
private final static WebServiceException PROCESSSERVICE_EXCEPTION;
private final static QName PROCESSSERVICE_QNAME = new QName("http://process.ewallet.esolutions.co.zw/", "ProcessService");
static {
PROCESSSERVICE_WSDL_LOCATION = zw.co.esolutions.ewallet.process.ProcessService_Service.class.getClassLoader().getResource("META-INF/wsdl/ProcessService.wsdl");
WebServiceException e = null;
if (PROCESSSERVICE_WSDL_LOCATION == null) {
e = new WebServiceException("Cannot find 'META-INF/wsdl/ProcessService.wsdl' wsdl. Place the resource correctly in the classpath.");
}
PROCESSSERVICE_EXCEPTION = e;
}
public ProcessService_Service() {
super(__getWsdlLocation(), PROCESSSERVICE_QNAME);
}
public ProcessService_Service(URL wsdlLocation, QName serviceName) {
super(wsdlLocation, serviceName);
}
/**
*
* @return
* returns ProcessService
*/
@WebEndpoint(name = "ProcessServiceSOAP")
public ProcessService getProcessServiceSOAP() {
return super.getPort(new QName("http://process.ewallet.esolutions.co.zw/", "ProcessServiceSOAP"), ProcessService.class);
}
/**
*
* @param features
* A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values.
* @return
* returns ProcessService
*/
@WebEndpoint(name = "ProcessServiceSOAP")
public ProcessService getProcessServiceSOAP(WebServiceFeature... features) {
return super.getPort(new QName("http://process.ewallet.esolutions.co.zw/", "ProcessServiceSOAP"), ProcessService.class, features);
}
private static URL __getWsdlLocation() {
if (PROCESSSERVICE_EXCEPTION!= null) {
throw PROCESSSERVICE_EXCEPTION;
}
return PROCESSSERVICE_WSDL_LOCATION;
}
}
| [
"stanfordbangaba@gmail.com"
] | stanfordbangaba@gmail.com |
59bcad0f029480a9bd7d2bc0f2b3d7e9fb0034b0 | 263647ed93c470da0a21b7b68e5a1f604821a03a | /src/main/java/com/neuedu/sell/controller/ProductController.java | 231842946bd56b61d13996a130350aa6921ae7bd | [] | no_license | tsy310573643/sell-boot | 612554aa2f08baf9343447865ebe6e4fbb6037d6 | 115023cf115ce4f1bb96a4e4262f9379bb6d49b4 | refs/heads/master | 2020-04-04T17:52:32.963018 | 2018-11-07T07:28:59 | 2018-11-07T07:28:59 | 156,139,889 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,785 | java | package com.neuedu.sell.controller;
import com.neuedu.sell.VO.ProductCategoryVO;
import com.neuedu.sell.VO.ProductInfoVO;
import com.neuedu.sell.VO.ResultVO;
import com.neuedu.sell.entity.ProductCategory;
import com.neuedu.sell.entity.ProductInfo;
import com.neuedu.sell.service.ProductCategroyService;
import com.neuedu.sell.service.ProductInfoService;
import com.neuedu.sell.utils.ResultVOUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
@RestController
@RequestMapping("/buyer/product")
public class ProductController {
@Autowired
private ProductInfoService productInfoService;
@Autowired
private ProductCategroyService productCategroyService;
@GetMapping("/list")
public ResultVO list(){
//1.查询所有上架商品
List<ProductInfo> productInfoList = productInfoService.findUpAll();
//2.根据商品集合构建一个商品类别编号的集合
List<Integer> categoryTypeList = new ArrayList<>();
for (ProductInfo productInfo : productInfoList) {
categoryTypeList.add(productInfo.getCategoryType());
}
//3查询所有商品类别编号对应的类别
List<ProductCategory> productCategoryList = productCategroyService.findByCategoryTypeIn(categoryTypeList);
//4.数据拼接
List<ProductCategoryVO> productCategoryVOList = new ArrayList<>();
for (ProductCategory productCategory : productCategoryList) {
//1.创建vo对象
ProductCategoryVO productCategoryVO = new ProductCategoryVO();
//2.将源类目对象赋值给vo对象,spring提供了方法
BeanUtils.copyProperties(productCategory,productCategoryVO);
//将商品源数据转化成上架的vo商品集合
List<ProductInfoVO> productInfoVOList = new ArrayList<>();
for (ProductInfo productInfo : productInfoList) {
if (productInfo.getCategoryType().equals(productCategory.getCategoryType())) {
ProductInfoVO productInfoVO = new ProductInfoVO();
BeanUtils.copyProperties(productInfo, productInfoVO);
productInfoVOList.add(productInfoVO);
}
}
productCategoryVO.setProductInfoVOList(productInfoVOList);
//3.将vo对象添加到vo集合中
productCategoryVOList.add(productCategoryVO);
}
return ResultVOUtils.success(productCategoryVOList);
}
}
| [
"310573643@qq.com"
] | 310573643@qq.com |
5a614029e1eaf125a1165c409684429ff177fea5 | 178f502b90104635a1630408269a7bf8a944518b | /src/main/java/edu/cueb/degree/model/Discipline.java | db86b9cc7c64afe46474815808f07bf0ec90ed9a | [] | no_license | CUEBer/degree_evaluate_server | 963116da7c4384688d56c197c911b9915ae22bc9 | 004f6e131ad5338b3f50ca8bb804e8c7591c2a97 | refs/heads/master | 2021-07-18T05:50:36.356175 | 2017-10-26T07:04:47 | 2017-10-26T07:04:47 | 105,489,614 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,206 | java | package edu.cueb.degree.model;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToOne;
@Entity
public class Discipline {
@Id
@Column(length = 6)
private String id;
@Column(length = 30)
private String name;
@OneToOne
private School school;
private boolean master;
private boolean doctor;
private boolean keyDiscipline;
public String getSchoolName() {
return school.getName();
}
public void setMaster(boolean master) {
this.master = master;
}
public void setDoctor(boolean doctor) {
this.doctor = doctor;
}
public void setKeyDiscipline(boolean keyDiscipline) {
this.keyDiscipline = keyDiscipline;
}
public void setKeyDate(Date keyDate) {
this.keyDate = keyDate;
}
public String getId() {
return id;
}
public String getName() {
return name;
}
public boolean isMaster() {
return master;
}
public boolean isDoctor() {
return doctor;
}
public boolean isKeyDiscipline() {
return keyDiscipline;
}
public Date getKeyDate() {
return keyDate;
}
public Account getUser() {
return user;
}
private Date keyDate;
@OneToOne
private Account user;
}
| [
"jxq0816@126.com"
] | jxq0816@126.com |
8e8bc313d13099225b1a39eb8b63e611e9991629 | 8ca108156f1249d1d336fcbbc9cbc5fa92597b85 | /programhorizon_gathering/src/main/java/com/dillon/GatheringApplication.java | 5c5fe18fd860a4ac911f869ed2410e813f65f75a | [] | no_license | peterxkl/programhorizon_parent | c8de18abb30c393510b42a85f0c99f6cfdbc368e | c3f38707c46573ab91418d39a39d687fb8ef9273 | refs/heads/master | 2020-09-28T01:52:18.521713 | 2020-03-24T12:38:32 | 2020-03-24T12:38:32 | 226,660,623 | 0 | 1 | null | 2020-01-11T01:09:24 | 2019-12-08T12:01:19 | Java | UTF-8 | Java | false | false | 804 | java | package com.dillon;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import util.IdWorker;
/**
* @author DillonXie
* @version 1.0
* @date 12/22/2019 11:42 AM
*/
@SpringBootApplication
@EnableJpaAuditing
@EnableCaching
@EnableEurekaClient
public class GatheringApplication {
public static void main(String[] args) {
SpringApplication.run(GatheringApplication.class, args);
}
@Bean
public IdWorker idWorker() {
return new IdWorker(1,1);
}
}
| [
"dillon.xie@oocl.com"
] | dillon.xie@oocl.com |
fbc77324aa4533f04f3e5bd15641174ff105c2fd | 719539e25b0c2d5d4a3c04cb007b3f8eb4d3fb77 | /src/chapter5/list_insertion_sort/ListInsertionSortApp.java | 5664348d162069051d9da0012937e0deb2af6038 | [] | no_license | caosena5101/Algorithm | 1c8ef1b550228f07735db613a705b229b9edf355 | 74d36187742749a40c6dff367de523001c73046d | refs/heads/master | 2021-01-25T10:06:35.073413 | 2014-03-03T06:20:57 | 2014-03-03T06:20:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,052 | java | package chapter5.list_insertion_sort;
class ListInsertionSortApp {
public static void main(String[] args) {
int size = 10;
// create array of links
Link[] linkArray = new Link[size];
for (int j = 0; j < size; j++) // fill array with links
{ // random number
int n = (int) (java.lang.Math.random() * 99);
Link newLink = new Link(n); // make link
linkArray[j] = newLink; // put in array
}
// display array contents
System.out.print("Unsorted array: ");
for (int j = 0; j < size; j++)
System.out.print(linkArray[j].dData + " ");
System.out.println("");
// create new list,
// initialized with array
SortedList theSortedList = new SortedList(linkArray);
for (int j = 0; j < size; j++)
// links from list to array
linkArray[j] = theSortedList.remove();
// display array contents
System.out.print("Sorted Array: ");
for (int j = 0; j < size; j++)
System.out.print(linkArray[j].dData + " ");
System.out.println("");
} // end main()
} // end class ListInsertionSortApp
| [
"caosena5101@163.com"
] | caosena5101@163.com |
1d6ba4c19944aadcec8f7fddf459342f7f8d2f7d | c6700994f14151af48ab1a65d15d37b7d4fc75c8 | /src/main/java/com/ly/auth/conf/AuthenticationEntryPointImpl.java | a35add8867e5df0e7e436bd185f426bf400d9da6 | [] | no_license | LinHuanTanLy/securityAuth | 1a449bbf75f355436f0df80a6ed1e75283b23c8e | 4a7b4143c118b9258470b7b792dc00d6ed3abf0f | refs/heads/master | 2020-04-23T01:54:01.671415 | 2019-02-15T08:23:31 | 2019-02-15T08:23:31 | 170,828,186 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 769 | java | package com.ly.auth.conf;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.stereotype.Service;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@Service("authenticationEntryPointImpl")
class AuthenticationEntryPointImpl implements AuthenticationEntryPoint {
@Override
public void commence(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, AuthenticationException e) throws IOException, ServletException {
httpServletResponse.sendError(HttpServletResponse.SC_UNAUTHORIZED, e.getMessage());
}
}
| [
"linhuantan@foreveross.com"
] | linhuantan@foreveross.com |
b27d98767c905954fc48f8949a1968f45336be75 | 63f6a86a4a63ab6c973bd44689c4c619eb73a505 | /keystudy3/src/main/java/model/Service.java | d2e71e63736755a35cd41802d0fe2dbff4e7d4c9 | [] | no_license | quocnguyen14051991/C0620G1-NguyenTienQuoc-Module3 | 97c6ad3df3c8880ff725616832ab1c021a585b6d | 8904f8dd4d2644c539ef03d300ffec13dc8f2eef | refs/heads/master | 2022-12-26T21:16:56.874669 | 2020-10-13T06:28:10 | 2020-10-13T06:28:10 | 295,580,527 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,852 | java | package model;
public class Service {
private Integer service_Id ;
private String service_Name;
private int area;
private double service_Cost;
private int service_Max_Peole;
private Integer rent_Type_ID;
private Integer service_Type_Id;
private String standard_Room;
private String description_Other;
private double pool_Area;
private int number_Of_Floor;
public Service(Integer service_Id, String service_Name, int area, double service_Cost, int service_Max_Peole, Integer rent_Type_ID, Integer service_Type_Id,
String standard_Room, String description_Other, double pool_Area, int number_Of_Floor) {
this.service_Id = service_Id;
this.service_Name = service_Name;
this.area = area;
this.service_Cost = service_Cost;
this.service_Max_Peole = service_Max_Peole;
this.rent_Type_ID = rent_Type_ID;
this.service_Type_Id = service_Type_Id;
this.standard_Room = standard_Room;
this.description_Other = description_Other;
this.pool_Area = pool_Area;
this.number_Of_Floor = number_Of_Floor;
}
public Service() {
}
public Integer getService_Id() {
return service_Id;
}
public void setService_Id(Integer service_Id) {
this.service_Id = service_Id;
}
public String getService_Name() {
return service_Name;
}
public void setService_Name(String service_Name) {
this.service_Name = service_Name;
}
public int getArea() {
return area;
}
public void setArea(int area) {
this.area = area;
}
public double getService_Cost() {
return service_Cost;
}
public void setService_Cost(double service_Cost) {
this.service_Cost = service_Cost;
}
public int getService_Max_Peole() {
return service_Max_Peole;
}
public void setService_Max_Peole(int service_Max_Peole) {
this.service_Max_Peole = service_Max_Peole;
}
public Integer getRent_Type_ID() {
return rent_Type_ID;
}
public void setRent_Type_ID(Integer rent_Type_ID) {
this.rent_Type_ID = rent_Type_ID;
}
public Integer getService_Type_Id() {
return service_Type_Id;
}
public void setService_Type_Id(Integer service_Type_Id) {
this.service_Type_Id = service_Type_Id;
}
public String getStandard_Room() {
return standard_Room;
}
public void setStandard_Room(String standard_Room) {
this.standard_Room = standard_Room;
}
public String getDescription_Other() {
return description_Other;
}
public void setDescription_Other(String description_Other) {
this.description_Other = description_Other;
}
public double getPool_Area() {
return pool_Area;
}
public void setPool_Area(double pool_Area) {
this.pool_Area = pool_Area;
}
public int getNumber_Of_Floor() {
return number_Of_Floor;
}
public void setNumber_Of_Floor(int number_Of_Floor) {
this.number_Of_Floor = number_Of_Floor;
}
@Override
public String toString() {
return "Service{" +
"service_Id=" + service_Id +
", service_Name='" + service_Name + '\'' +
", area=" + area +
", service_Cost=" + service_Cost +
", service_Max_Peole=" + service_Max_Peole +
", rent_Type_ID=" + rent_Type_ID +
", service_Type_Id=" + service_Type_Id +
", standard_Room='" + standard_Room + '\'' +
", description_Other='" + description_Other + '\'' +
", pool_Area=" + pool_Area +
", number_Of_Floor=" + number_Of_Floor +
'}';
}
}
| [
"quocnguyen1405@gmail.com"
] | quocnguyen1405@gmail.com |
61bfa3c8095b667d60a48695e8c60d6241dd615f | 1658416b56bf45bd0a6be55f3459391213e1b995 | /api-gateway-zuul/src/main/java/com/wangsonglin/zuul/ServiceApplication.java | 95290082ea729b19632d29b9116ddf7aa07789d2 | [] | no_license | songlinwang/microservice | 15fafd13689287e30da45c676880e1872a5f57ec | 3c7fb04ad488262b4737772e9e2015125d7f60fe | refs/heads/master | 2020-03-28T23:42:17.519084 | 2018-09-18T14:45:24 | 2018-09-18T14:45:24 | 148,628,184 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 406 | java | package com.wangsonglin.zuul;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
@SpringBootApplication
@EnableZuulProxy
public class ServiceApplication {
public static void main(String args[]) {
SpringApplication.run(ServiceApplication.class, args);
}
}
| [
"songlin_wangyo@163.com"
] | songlin_wangyo@163.com |
ed6939f5d34c4d153d203e33f4de48352f27e617 | 8179712760a0466ccd23c9165297a54a3f34dd4a | /src/main/java/fly/annotation/Fly.java | b9d8406cbaba4434d248f83e382f69844b5ee450 | [
"MIT"
] | permissive | kielhong/dataset-yaml | 2267df60aacfd81cf98a43c32491269e0f1bad65 | fd0984adc525f2a58a3dfd46dd815f35897b58f4 | refs/heads/master | 2016-09-06T17:55:46.498651 | 2015-05-19T06:19:48 | 2015-05-19T06:19:48 | 35,662,065 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 441 | java | package fly.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Created by 1001982(kielhong@sk.com)
* Date : 15. 5. 15.
*/
@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Fly {
String defaultString = "";
String dataSet() default defaultString;
}
| [
"kielhong@sk.com"
] | kielhong@sk.com |
6e2abf0a3c7152a53086825836e3dadfa7b0e9a2 | f66f57ece4d32d449f797bee52a8eb2e1fed1be3 | /dewdrops/src/main/java/com/coopsrc/xandroid/dewdrops/task/TaskCallback.java | f8d52d5f7da993f5a093cfed5a8a64e71299beda | [
"Apache-2.0"
] | permissive | coopsrc/xAndroid | eb4b7ce5990db3449aaea44759f889d0916fe1bb | 7e9aeeaa385e62f617abf3142a79818f0eab9aaf | refs/heads/master | 2021-06-27T02:44:05.793302 | 2020-11-02T02:37:02 | 2020-11-02T02:37:02 | 205,337,383 | 1 | 0 | Apache-2.0 | 2020-08-20T13:00:05 | 2019-08-30T08:17:50 | C | UTF-8 | Java | false | false | 256 | java | package com.coopsrc.xandroid.dewdrops.task;
import android.graphics.Bitmap;
/**
* @author tingkuo
* <p>
* Datetime: 2019-10-08 18:05
*/
public interface TaskCallback {
void onBlurSuccess(Bitmap bitmap);
void onBlurFailed(Throwable error);
}
| [
"zhangtingkuo@gmail.com"
] | zhangtingkuo@gmail.com |
58a0a3cd990bac11b59040a9a80af01f6be31edf | 6bd9f872bd4f84969291d9a80d583c2310129f48 | /ev3code/src/org/r2d2/sensors/VisionSensor.java | a7f00045f6c4039c7ae6b0252c76d973f111090d | [] | no_license | rozandq/Mario | 0927e10301d58210ca521be73fb9b0930e7734b2 | a633911c4ff6b21684c4af2f0489426ab32bbf00 | refs/heads/master | 2021-04-09T14:19:18.844685 | 2018-04-11T08:28:10 | 2018-04-11T08:28:10 | 125,490,038 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 614 | java | package org.r2d2.sensors;
import org.r2d2.utils.R2D2Constants;
import lejos.hardware.ev3.LocalEV3;
import lejos.hardware.port.Port;
import lejos.hardware.sensor.EV3UltrasonicSensor;
public class VisionSensor {
private EV3UltrasonicSensor sonar = null;
private Port port = null;
public VisionSensor(){
port = LocalEV3.get().getPort(R2D2Constants.IR_SENSOR);
sonar = new EV3UltrasonicSensor(port);
}
/**
*
* @return la distance lue par le capteur ultrason
*/
public float[] getRaw() {
float[] sample = new float[1];
sonar.fetchSample(sample, 0);
return sample;
}
}
| [
"lucas.albarede4b@laposte.net"
] | lucas.albarede4b@laposte.net |
91412aade9cfcbf3a0edabcf10848f646b4eb9d2 | b7a0671a10b39a038d4bd5a3d0d0456d1bab2094 | /src/main/java/factory/service/GestionnaireService.java | 4357c77e4468b349f61955a0b3739cac5fb7221d | [] | no_license | Deante/Factory | d55a418cbb9f253066eff4c8a3ab2701df807d11 | f9cb87c606159036a6d3b09e3fd404e7d4327fe3 | refs/heads/master | 2021-01-25T13:41:30.637065 | 2018-03-12T18:51:06 | 2018-03-12T18:51:06 | 123,585,588 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,068 | java | package factory.service;
import factory.domain.Gestionnaire;
import factory.repository.GestionnaireRepository;
import factory.repository.search.GestionnaireSearchRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import static org.elasticsearch.index.query.QueryBuilders.*;
/**
* Service Implementation for managing Gestionnaire.
*/
@Service
@Transactional
public class GestionnaireService {
private final Logger log = LoggerFactory.getLogger(GestionnaireService.class);
private final GestionnaireRepository gestionnaireRepository;
private final GestionnaireSearchRepository gestionnaireSearchRepository;
public GestionnaireService(GestionnaireRepository gestionnaireRepository, GestionnaireSearchRepository gestionnaireSearchRepository) {
this.gestionnaireRepository = gestionnaireRepository;
this.gestionnaireSearchRepository = gestionnaireSearchRepository;
}
/**
* Save a gestionnaire.
*
* @param gestionnaire the entity to save
* @return the persisted entity
*/
public Gestionnaire save(Gestionnaire gestionnaire) {
log.debug("Request to save Gestionnaire : {}", gestionnaire);
Gestionnaire result = gestionnaireRepository.save(gestionnaire);
gestionnaireSearchRepository.save(result);
return result;
}
/**
* Get all the gestionnaires.
*
* @param pageable the pagination information
* @return the list of entities
*/
@Transactional(readOnly = true)
public Page<Gestionnaire> findAll(Pageable pageable) {
log.debug("Request to get all Gestionnaires");
return gestionnaireRepository.findAll(pageable);
}
/**
* Get one gestionnaire by id.
*
* @param id the id of the entity
* @return the entity
*/
@Transactional(readOnly = true)
public Gestionnaire findOne(Long id) {
log.debug("Request to get Gestionnaire : {}", id);
return gestionnaireRepository.findOne(id);
}
/**
* Delete the gestionnaire by id.
*
* @param id the id of the entity
*/
public void delete(Long id) {
log.debug("Request to delete Gestionnaire : {}", id);
gestionnaireRepository.delete(id);
gestionnaireSearchRepository.delete(id);
}
/**
* Search for the gestionnaire corresponding to the query.
*
* @param query the query of the search
* @param pageable the pagination information
* @return the list of entities
*/
@Transactional(readOnly = true)
public Page<Gestionnaire> search(String query, Pageable pageable) {
log.debug("Request to search for a page of Gestionnaires for query {}", query);
Page<Gestionnaire> result = gestionnaireSearchRepository.search(queryStringQuery(query), pageable);
return result;
}
}
| [
"sonnyson95@gmail.com"
] | sonnyson95@gmail.com |
b8be48bcab6836243512786042dd0e4a9890f34c | f561de5c0b7e76afd852a9c3c26daa2688e6e3d4 | /loads/src/main/java/org/mousephenotype/cda/loads/create/extract/cdabase/steps/DummyWriter.java | 622c08addd7b5034a46495e400e5899dc5b64df7 | [
"Apache-2.0"
] | permissive | jwgwarren/PhenotypeData | bfac12c7cce2275cfb02f1ba9a9e8350da0a0f30 | a1a36fd0efacc6515ad843ff7ce4bebc3ae98393 | refs/heads/master | 2020-07-28T21:24:48.531732 | 2020-03-11T10:17:44 | 2020-03-11T10:17:44 | 209,541,600 | 0 | 0 | Apache-2.0 | 2020-03-11T10:17:45 | 2019-09-19T11:56:47 | TSQL | UTF-8 | Java | false | false | 1,055 | java | /*******************************************************************************
* Copyright © 2019 EMBL - European Bioinformatics Institute
* <p/>
* 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
* <p/>
* 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.mousephenotype.cda.loads.create.extract.cdabase.steps;
import org.springframework.batch.item.ItemWriter;
import java.util.List;
public class DummyWriter implements ItemWriter {
@Override
public void write(List list) throws Exception {
}
} | [
"“mrelac@ebi.ac.uk”"
] | “mrelac@ebi.ac.uk” |
806b41ba8d50a237bdad6875fd7dc040023bf4d7 | ffb8f9e270f86894234029f84daef5ac67375b46 | /src/datastructures/JavaDequeue.java | 2f6815ef0e91696970426322030c61cd4d51a7fc | [] | no_license | yahyakansu/HackerRank | f0229dfe33bb26281e8eb3024dc87912262e04ee | 45898120b5616f68d37edcb6fda43bdb184fda20 | refs/heads/master | 2020-12-26T09:05:24.551383 | 2020-03-04T21:10:51 | 2020-03-04T21:10:51 | 237,457,747 | 0 | 0 | null | 2020-02-07T01:19:29 | 2020-01-31T15:26:43 | Java | UTF-8 | Java | false | false | 836 | java | package datastructures;
import java.util.*;
public class JavaDequeue {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
Deque deque = new ArrayDeque<>();
HashSet<Integer> set = new HashSet<>();
int n = scan.nextInt();
int m = scan.nextInt();
int max = Integer.MIN_VALUE;
for (int i = 0; i < n; i++) {
int num = scan.nextInt();
deque.add(num);
set.add(num);
if (deque.size() == m) {
if (set.size() > max) max = set.size();
int first = (int) deque.remove();
if (!deque.contains(first))
set.remove(first);
}
}
System.out.println(max);
}
}
/*
Sample Input
6 3
5 3 5 2 3 2
Sample Output
3
*/ | [
"yahyakansusa@gmail.com"
] | yahyakansusa@gmail.com |
203a208a372b1b0de5c65b378301850d15df936e | fda4947037306dac0cefd170751e57243b1fa00a | /src/main/java/com/wf/springbootvue/repository/PaymentRepository.java | b36e50264f39d653c06f8df640ab6fd61147c567 | [] | no_license | JohnSnop/springboot-vue | d2b64f0763eb8c656578daa9f03d7e4407a76f90 | 9f102004c25b3853aa91c48136053b90ad60154b | refs/heads/master | 2023-01-02T17:33:02.069999 | 2020-10-29T09:09:59 | 2020-10-29T09:09:59 | 262,802,656 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 391 | java | package com.wf.springbootvue.repository;
import com.wf.springbootvue.domain.Payment;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.Optional;
/**
* @author wf
* @create 2020-05-10 21:16
* @desc
**/
public interface PaymentRepository extends JpaRepository<Payment, Long> {
// Optional<Payment> findById(Long id);
// void deleteById(Long id);
}
| [
"285682283@qq.com"
] | 285682283@qq.com |
573ee4ed176d57301b67c0c815acd9841860b7e5 | 0c2ad6f2b04b0626c5be597caab2c7e580ff161b | /graviton - game/src/main/java/org/graviton/network/game/protocol/MonsterPacketFormatter.java | 71cce07dc17457ecf281b10700a1cb0ca9b1de10 | [
"Apache-2.0"
] | permissive | cypox/GDCore | d4f9ff4e63eb1cf0904ecd4a9a8dcdf7ba0074ea | b4977f9dfc023166af7d0ffccdc34c6e2ab2acbf | refs/heads/master | 2021-01-13T16:56:31.078594 | 2017-01-08T12:22:10 | 2017-01-08T12:22:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,466 | java | package org.graviton.network.game.protocol;
import org.graviton.game.creature.monster.MonsterGroup;
/**
* Created by Botan on 03/12/2016. 10:35
*/
public class MonsterPacketFormatter {
public static String gmMessage(MonsterGroup monsterGroup) {
StringBuilder identity = new StringBuilder();
StringBuilder skins = new StringBuilder();
StringBuilder levels = new StringBuilder();
StringBuilder colors = new StringBuilder();
StringBuilder builder = new StringBuilder();
builder.append(monsterGroup.getCell()).append(';');
builder.append(monsterGroup.getOrientation().ordinal()).append(';');
builder.append(monsterGroup.getStarsPercent()).append(';');
builder.append(monsterGroup.getId()).append(';');
monsterGroup.getMonsters().forEach(monster -> {
identity.append(monster.getTemplate().getId()).append(",");
skins.append(monster.getTemplate().getSkin()).append(",");
levels.append(monster.getLevel()).append(",");
colors.append(monster.getTemplate().getColors()).append(";0,0,0,0;");
});
builder.append(identity.toString().substring(0, identity.length() - 1)).append(";-3;");
builder.append(skins.toString().substring(0, skins.length() - 1)).append(';');
builder.append(levels.toString().substring(0, levels.length() - 1)).append(';').append(colors);
return builder.toString();
}
}
| [
"ahmed.botan94@gmail.com"
] | ahmed.botan94@gmail.com |
2797c8dd2831b9011288f26bae0e119b6fd9945f | 372886fd341ccb3d4ae4c8992520d75baf777702 | /shoppingPjt/src/shopping/backend/ajax/model/UpdateCategoryStatusImplAction.java | 30feeff79c054e5fd2219f9d2491fd05451924a8 | [] | no_license | Lee-jaeyong/shoppingJspPjt | 23f414007fe7f8f2830424e0c177433752d3bcab | 6eb12d31c6ae20db72cdb14b365711da35b7ad86 | refs/heads/master | 2022-12-06T00:32:58.794309 | 2019-12-19T17:52:07 | 2019-12-19T17:52:07 | 223,929,522 | 0 | 0 | null | 2022-12-04T21:56:39 | 2019-11-25T11:10:55 | HTML | UTF-8 | Java | false | false | 999 | java | package shopping.backend.ajax.model;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import shopping.action.ShoppingService;
import shopping.database.dao.CategoryDAO;
public class UpdateCategoryStatusImplAction implements ShoppingService {
@Override
public void execute(HttpServletRequest request, HttpServletResponse response) {
try {
CategoryDAO categoryDAO = new CategoryDAO();
if(request.getParameter("type").equals("true"))
categoryDAO.updateCategoryStatus(Integer.parseInt(request.getParameter("categoryNumber")),
Integer.parseInt(request.getParameter("status")));
else
categoryDAO.updateSmallCategoryStatus(request.getParameter("data").split(","),Integer.parseInt(request.getParameter("status")));
response.getWriter().write("true");
} catch (Exception e) {
try {
response.getWriter().write("false");
} catch (IOException e1) {
}
}
}
}
| [
"wodyd202@naver.com"
] | wodyd202@naver.com |
804702c7ca4bc62ab796331425a941d30f8ac6c7 | 026cd8426c638a875762917144dc2ba86164a112 | /RandomCircles.java | b7e9bfdce4fd565398b6c8225bd4dc8a3296a6e7 | [] | no_license | MelendezIvelis/Week-2-Assignments | 704f207d791d8252950172ffd29be0949b96346f | 36c92c934a894c149d9d6ea8468e6f1bab123d6e | refs/heads/master | 2023-04-11T04:22:11.162429 | 2021-04-17T15:13:52 | 2021-04-17T15:13:52 | 358,906,282 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 643 | java | package week2;
import acm.graphics.GOval;
import acm.program.*;
import acm.util.RandomGenerator;
public class RandomCircles extends GraphicsProgram {
int minRad = 5;
int maxRad = 50;
public void run() {
for (int i = 0; i < 10; i++) {
drawCircle();
}
}
public void drawCircle() {
int radius = rgen.nextInt(minRad, maxRad);
int x = rgen.nextInt(0, getWidth() - radius * 2);
int y = rgen.nextInt(0, getHeight() - radius * 2);
GOval circle = new GOval(x, y, radius, radius);
circle.setFilled(true);
circle.setColor(rgen.nextColor());
add(circle);
}
public RandomGenerator rgen = RandomGenerator.getInstance();
}
| [
"MelendezIvelis@gmail.com"
] | MelendezIvelis@gmail.com |
c9e4239d0c3887bfd8cd70e7eadb001cd35d1d60 | 01a3d6028b55e0447d862c778e7878208144436f | /src/test/java/RegisterNewKKKUserTest.java | 58784630341531e66cb6405dcfa58a8fbf8b083c | [] | no_license | astaroththedevil/Selenium | acc4393f8eb5950d41e690fbf0a9b4d2328ccc6f | 79cc32ecfee737dfcd5194ae9c9d9905188b7f0f | refs/heads/master | 2023-08-28T01:20:15.957212 | 2021-10-27T10:11:50 | 2021-10-27T10:11:50 | 406,825,179 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,003 | java | import io.github.bonigarcia.wdm.WebDriverManager;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.*;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import java.util.ArrayList;
public class RegisterNewKKKUserTest {
WebDriver driver;
WebDriverWait wait;
WebElement newMail, userFirstName, userLastName, phoneNum, mail;
String address = new String();
ArrayList<String> tabs;
@Before
public void setup() throws InterruptedException {
System.setProperty("webdriver.chrome.driver", "resources/chromedriver");
WebDriverManager.chromedriver().setup();
ChromeOptions options = new ChromeOptions();
options.addArguments("--incognito");
driver = new ChromeDriver(options);
driver.get("https://cryptogmail.com/");
driver.manage().window().maximize();
Thread.sleep(2000);
}
String success = "Finished with success!";
public void printSuccess() {
System.out.println(success);
}
@After
public void tearDown() {
driver.quit();
}
@Test
public void test() throws InterruptedException {
createNewEmailAddress();
openNewTabInBrowser();
shouldClosePopup();
shouldOpenKKKForm();
shouldFillTheForm();
shouldSelectCheckboxes();
shouldConfirmSubscription();
sleep();
switchBackToTabWithMail();
sleep();
printSuccess();
}
public void createNewEmailAddress() {
wait = new WebDriverWait(driver, 15);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("/html/body/div/div/div[1]/div/div[1]/div")));
newMail = driver.findElement(By.xpath("/html/body/div/div/div[1]/div/div[1]/div"));
address = newMail.getText();
}
public void openNewTabInBrowser() {
((JavascriptExecutor) driver).executeScript("window.open()");
tabs = new ArrayList<String>(driver.getWindowHandles());
driver.switchTo().window(tabs.get(1));
driver.get("https://www.moliera2.com/");
}
private void shouldClosePopup() {
wait = new WebDriverWait(driver, 15);
wait.until(ExpectedConditions.elementToBeClickable(By.className("close-cookie-info")));
driver.findElement(By.className("close-cookie-info")).click();
}
public void shouldOpenKKKForm() {
driver.navigate().to("https://www.moliera2.com/k-k-form");
}
public void shouldFillTheForm() {
userFirstName = driver.findElement(By.id("kkuser-name"));
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("kkuser-name")));
userFirstName.sendKeys("Janusz");
userFirstName.sendKeys(Keys.TAB);
userLastName = driver.switchTo().activeElement();
userLastName.sendKeys("Nosacz");
userLastName.sendKeys(Keys.TAB);
phoneNum = driver.switchTo().activeElement();
phoneNum.sendKeys("000111222");
phoneNum.sendKeys(Keys.TAB);
mail = driver.switchTo().activeElement();
mail.sendKeys(address);
}
public void shouldSelectCheckboxes() {
driver.findElement(By.xpath("//*[@id=\"kkuserdesigner-feature_value_id_top\"]/div[4]/div/label/div[1]/span")).click();
driver.findElement(By.xpath("//*[@id=\"kkuserdesigner-feature_value_id_top\"]/div[7]/div/label/div[1]/span")).click();
driver.findElement(By.xpath("//*[@id=\"kk-form\"]/div[5]/div/ul/li[1]/div/label/div[1]/span")).click();
}
public void shouldConfirmSubscription() {
driver.findElement(By.className("btn-widget")).click();
}
public void switchBackToTabWithMail() {
driver.switchTo().window(tabs.get(0));
}
public void sleep() throws InterruptedException {
Thread.sleep(4000);
}
}
| [
"r.sypniewski@moliera2.com"
] | r.sypniewski@moliera2.com |
22e1606e1fd3859b3c2aae585e3dc21bfbfc1ba1 | e5f592af890f2431e5134e5d9f3fc948ac6f52a7 | /jackson_learn/jackson_learn/src/main/java/com/oogie/jackson/affiliate/FeeScheduleType.java | 6e3be154d83bdb23a3ad79a6e4e3e32f0f460892 | [] | no_license | shnooga/json | 75d4cd19b81c7a2ac746404c28443987559f0ce3 | d7e066a77b167c3fa3fd49972dff2068b8ba5573 | refs/heads/master | 2021-04-15T12:39:17.843702 | 2016-07-30T07:06:56 | 2016-07-30T07:06:56 | 64,154,161 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 171 | java | package com.oogie.jackson.affiliate;
/**
* Created by hueyng on 7/29/2016.
*/
public class FeeScheduleType
{
public String codeType;
public String codeValue;
}
| [
"hueyng@vsp.com"
] | hueyng@vsp.com |
8e9c20ae87f2ad787f3d72c177ab47a7389790a4 | 7ca63a85455cc15e87cd2ed4a6b707686f35d9d8 | /MortgageCalculator/app/src/main/java/com/example/mortgagecalculator/Datafields.java | 35a038b4d49fdaf47aacde7e04f84af7e97a3288 | [] | no_license | joshinachiket/Mortgage-Calculator | f8233980a911f0f25cd72b42c78555e2dd47c04e | 1b88ed2f27249858006b9209038a4cb1d774ba44 | refs/heads/master | 2020-05-24T21:55:19.637631 | 2017-03-22T06:28:52 | 2017-03-22T06:28:52 | 84,884,696 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,403 | java | package com.example.mortgagecalculator;
/**
* Created by Student on 3/17/17.
*/
public class Datafields {
private String type;
private String address;
private String city;
private String state;
private String zip;
private String propertyprice;
private String downpayment;
private String rate;
private String terms;
private String monthlyPayments;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public void setAddress(String address) {
this.address = address;
}
public String getCity() {
return city;
}
public String getAddress() {
return address;
}
public void setCity(String city) {
this.city = city;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getZip() {
return zip;
}
public void setZip(String zip) {
this.zip = zip;
}
public String getPropertyprice() {
return propertyprice;
}
public void setPropertyprice(String propertyprice) {
this.propertyprice = propertyprice;
}
public String getDownpayment() {
return downpayment;
}
public void setDownpayment(String downpayment) {
this.downpayment = downpayment;
}
public String getRate() {
return rate;
}
public void setRate(String rate) {
this.rate = rate;
}
public String getTerms() {
return terms;
}
public void setTerms(String terms) {
this.terms = terms;
}
public String getMonthlyPayments() {
return monthlyPayments;
}
public void setMonthlyPayments(String monthlyPayments) {
this.monthlyPayments = monthlyPayments;
}
public void setFields(String[] fields){
type = fields[0];
address = fields[1];
city = fields[2];
state = fields[3];
zip = fields[4];
propertyprice = fields[5];
downpayment = fields[6];
rate = fields[7];
terms = fields[8];
monthlyPayments = fields[9];
}
public Datafields getFields()
{
return this;
}
public String getFullAddress(){
return address + "," + city + "," + state + "," + zip;
}
}
| [
"nachiket.r.joshi@gmail.com"
] | nachiket.r.joshi@gmail.com |
13cd147a2298568e95dc05ca3edb2600cca3bab6 | 64b828acda982ecd194ff14d4a41b8bed613c698 | /riskgamebot/src/main/java/com/sukratkashyap/riskgamebot/Player.java | 4e87284379daa375531a0f79be9dccaffd170532 | [] | no_license | sukratkashyap/risk-game | 0c359f9d57892802d1b2fcb899e0a815a29ec9bf | 3df8d0b283e2e123c62e13b516dcb01a84a27c5b | refs/heads/master | 2022-12-27T21:49:51.368551 | 2020-10-07T20:38:27 | 2020-10-07T20:38:27 | 79,240,540 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,405 | java | package com.sukratkashyap.riskgamebot;
import java.util.*;
import java.util.Collections;
public class Player implements PlayerAPI {
private int id;
private String name = "";
private int numUnits = 0;
private ArrayList<Integer> dice = new ArrayList<Integer>();
private int battleLoss = 0;
private ArrayList<Card> cards = new ArrayList<Card>();
private boolean isBot = false;
private Bot bot;
Player (int inId) {
id = inId;
return;
}
public void setName (String inName) {
name = inName;
return;
}
public void setBot (Bot inBot) {
isBot = true;
bot = inBot;
return;
}
public Bot getBot () {
return bot;
}
public void rollDice (int numDice) {
dice.clear();
for (int j=0; j<numDice; j++) {
dice.add(1 + (int)(Math.random() * 6));
}
Collections.sort(dice, Collections.reverseOrder());
return;
}
public void addUnits (int inNum) {
numUnits = numUnits + inNum;
return;
}
public void subtractUnits (int inNum) {
numUnits = numUnits - inNum;
return;
}
public void addCard (Card inCard) {
cards.add(inCard);
return;
}
public void addCards (ArrayList<Card> inCards) {
cards.addAll(inCards);
return;
}
private Card subtractCard (int cardInsigniaId) {
Card discard = new Card();
boolean currentFound = false;
for (int j=0; (j<cards.size()) && !currentFound; j++) {
if (cardInsigniaId == cards.get(j).getInsigniaId()) {
discard = cards.remove(j);
currentFound = true;
}
}
return discard;
}
public ArrayList<Card> subtractCards (int[] cardInsigniaIds) {
// precondition: check the cards are available
ArrayList<Card> discards = new ArrayList<Card>();
for (int i=0; i<cardInsigniaIds.length; i++) {
discards.add(subtractCard(cardInsigniaIds[i]));
}
return discards;
}
public boolean isCardsAvailable (int[] cardInsigniaIds) {
boolean currentFound = true; // just to start the loop
ArrayList<Card> copyCards = new ArrayList<Card>(cards);
for (int i=0; (i<cardInsigniaIds.length) && currentFound; i++) {
currentFound = false;
for (int j=0; (j<copyCards.size()) && !currentFound; j++) {
if (cardInsigniaIds[i] == copyCards.get(j).getInsigniaId()) {
copyCards.remove(j);
currentFound = true;
}
}
}
return currentFound;
}
public boolean isForcedExchange () {
return (cards.size()>=GameData.MAX_NUM_CARDS);
}
public boolean isOptionalExchange () {
boolean found = false;
int[] set = new int[Deck.SET_SIZE];
for (int i=0; (i<Deck.NUM_SETS) && !found; i++) {
for (int j=0; j<Deck.SET_SIZE; j++) {
set[j] = Deck.SETS[i][j];
}
found = isCardsAvailable(set);
}
return found;
}
public boolean isBot () {
return isBot;
}
public int getId () {
return id;
}
public String getName () {
return name;
}
public int getNumUnits () {
return numUnits;
}
public ArrayList<Integer> getDice () {
return dice;
}
public int getDie (int dieId) {
return dice.get(dieId);
}
public void resetBattleLoss () {
battleLoss = 0;
return;
}
public void addBattleLoss () {
battleLoss++;
return;
}
public int getBattleLoss () {
return battleLoss;
}
public ArrayList<Card> getCards () {
ArrayList<Card> copyCards = new ArrayList<Card>(cards);
return copyCards;
}
public ArrayList<Card> removeCards () {
ArrayList<Card> allCards = new ArrayList<Card>(cards);
cards.clear();
return allCards;
}
}
| [
"sukraat021195@gmail.com"
] | sukraat021195@gmail.com |
e2c9177d85e3ed097d63fd97a447da784957c118 | 54cc27964f602bec014d7b206996557db7a2c7b7 | /程序代码/Windows Hello Log System/src/cn/leafspace/ToolBean/ChangeCharset.java | 639735c1fd5a556f21eb9e08dbc58f5fe10946e9 | [] | no_license | ztkbigdick/Windows-Hello-VPR | a54fad12e4a5f89325e81af4fb07c5dc1c205201 | 4e41d4aa841737b6e176cbd68fadffb80f85db28 | refs/heads/master | 2022-09-08T18:20:20.986057 | 2020-06-01T01:43:27 | 2020-06-01T01:43:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,168 | java | package cn.leafspace.ToolBean;
import java.io.UnsupportedEncodingException;
public class ChangeCharset {
/** 7位ASCII字符,也叫作ISO646-US、Unicode字符集的基本拉丁块 */
public static final String US_ASCII = "US-ASCII";
/** ISO 拉丁字母表 No.1,也叫作 ISO-LATIN-1 */
public static final String ISO_8859_1 = "ISO-8859-1";
/** 8 位 UCS 转换格式 */
public static final String UTF_8 = "UTF-8";
/** 16 位 UCS 转换格式,Big Endian(最低地址存放高位字节)字节顺序 */
public static final String UTF_16BE = "UTF-16BE";
/** 16 位 UCS 转换格式,Little-endian(最高地址存放低位字节)字节顺序 */
public static final String UTF_16LE = "UTF-16LE";
/** 16 位 UCS 转换格式,字节顺序由可选的字节顺序标记来标识 */
public static final String UTF_16 = "UTF-16";
/** 中文超大字符集 */
public static final String GBK = "GBK";
/**
* 将字符编码转换成US-ASCII码
*/
public String toASCII(String str) throws UnsupportedEncodingException {
return this.changeCharset(str, US_ASCII);
}
/**
* 将字符编码转换成ISO-8859-1码
*/
public String toISO_8859_1(String str) throws UnsupportedEncodingException {
return this.changeCharset(str, ISO_8859_1);
}
/**
* 将字符编码转换成UTF-8码
*/
public String toUTF_8(String str) throws UnsupportedEncodingException {
return this.changeCharset(str, UTF_8);
}
/**
* 将字符编码转换成UTF-16BE码
*/
public String toUTF_16BE(String str) throws UnsupportedEncodingException {
return this.changeCharset(str, UTF_16BE);
}
/**
* 将字符编码转换成UTF-16LE码
*/
public String toUTF_16LE(String str) throws UnsupportedEncodingException {
return this.changeCharset(str, UTF_16LE);
}
/**
* 将字符编码转换成UTF-16码
*/
public String toUTF_16(String str) throws UnsupportedEncodingException {
return this.changeCharset(str, UTF_16);
}
/**
* 将字符编码转换成GBK码
*/
public String toGBK(String str) throws UnsupportedEncodingException {
return this.changeCharset(str, GBK);
}
/**
* 字符串编码转换的实现方法
*
* @param str
* 待转换编码的字符串
* @param newCharset
* 目标编码
* @return
* @throws UnsupportedEncodingException
*/
public String changeCharset(String str, String newCharset) throws UnsupportedEncodingException {
if (str != null) {
// 用默认字符编码解码字符串。
byte[] bs = str.getBytes();
printByteArray(bs);
System.out.print("\n");
// 用新的字符编码生成字符串
return new String(bs, newCharset);
}
return null;
}
/**
* 字符串编码转换的实现方法
*
* @param str
* 待转换编码的字符串
* @param oldCharset
* 原编码
* @param newCharset
* 目标编码
* @return
* @throws UnsupportedEncodingException
*/
public String changeCharset(String str, String oldCharset, String newCharset) throws UnsupportedEncodingException {
if (str != null) {
// 用旧的字符编码解码字符串。解码可能会出现异常。
byte[] bs = str.getBytes(oldCharset);
printByteArray(bs);
System.out.println("");
// 用新的字符编码生成字符串
return new String(bs, newCharset);
}
return null;
}
public void tempshow(String[] args) throws UnsupportedEncodingException {
ChangeCharset test = new ChangeCharset();
String str = "This is a 中文的 String!";
System.out.println("str: " + str);
String gbk = test.toGBK(str);
System.out.println("转换成GBK码: " + gbk);
System.out.println();
String ascii = test.toASCII(str);
System.out.println("转换成US-ASCII码: " + ascii);
gbk = test.changeCharset(ascii, ChangeCharset.US_ASCII, ChangeCharset.GBK);
System.out.println("再把ASCII码的字符串转换成GBK码: " + gbk);
System.out.println();
String iso88591 = test.toISO_8859_1(str);
System.out.println("转换成ISO-8859-1码: " + iso88591);
gbk = test.changeCharset(iso88591, ChangeCharset.ISO_8859_1, ChangeCharset.GBK);
System.out.println("再把ISO-8859-1码的字符串转换成GBK码: " + gbk);
System.out.println();
String utf8 = test.toUTF_8(str);
System.out.println("转换成UTF-8码: " + utf8);
gbk = test.changeCharset(utf8, ChangeCharset.UTF_8, ChangeCharset.GBK);
System.out.println("再把UTF-8码的字符串转换成GBK码: " + gbk);
System.out.println();
String utf16be = test.toUTF_16BE(str);
System.out.println("转换成UTF-16BE码:" + utf16be);
gbk = test.changeCharset(utf16be, ChangeCharset.UTF_16BE, ChangeCharset.GBK);
System.out.println("再把UTF-16BE码的字符串转换成GBK码: " + gbk);
System.out.println();
String utf16le = test.toUTF_16LE(str);
System.out.println("转换成UTF-16LE码:" + utf16le);
gbk = test.changeCharset(utf16le, ChangeCharset.UTF_16LE, ChangeCharset.GBK);
System.out.println("再把UTF-16LE码的字符串转换成GBK码: " + gbk);
System.out.println();
String utf16 = test.toUTF_16(str);
System.out.println("转换成UTF-16码:" + utf16);
gbk = test.changeCharset(utf16, ChangeCharset.UTF_16LE, ChangeCharset.GBK);
System.out.println("再把UTF-16码的字符串转换成GBK码: " + gbk);
String s = new String("中文".getBytes("UTF-8"), "UTF-8");
System.out.println(s);
}
void printByteArray(byte[] bs){
for(int i = 0,sz = bs.length;i<sz;i++)
System.out.print(Integer.toHexString((int)bs[i])+"\t");
}
}
| [
"18852923073@163.com"
] | 18852923073@163.com |
5e78be888e4f90a13e278d69d39cd80cdd7b699e | a5ae5e37d196fd3fd14bed5da9677d62d9803ce5 | /jOOQ/src/main/java/org/jooq/UDTField.java | 37143d0171ccda9d100d468057a54f409c96582a | [
"Apache-2.0"
] | permissive | srinivaskarre/jOOQ | ae6262a412e70e90e89837c3a1bc52c7ec110c46 | dfe0464c4367a4d6914ff20a68221c7a4487442d | refs/heads/master | 2020-09-14T16:51:12.753079 | 2019-11-21T13:53:23 | 2019-11-21T13:53:23 | 223,186,678 | 1 | 0 | NOASSERTION | 2019-11-21T13:59:11 | 2019-11-21T13:59:10 | null | UTF-8 | Java | false | false | 1,370 | java | /*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Other licenses:
* -----------------------------------------------------------------------------
* Commercial licenses for this work are available. These replace the above
* ASL 2.0 and offer limited warranties, support, maintenance, and commercial
* database integrations.
*
* For more information, please visit: http://www.jooq.org/licenses
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package org.jooq;
/**
* A field contained in a UDT.
* <p>
* Instances of this type cannot be created directly. They are available from
* generated code.
*
* @param <R> The record type
* @param <T> The field type
* @author Lukas Eder
*/
public interface UDTField<R extends UDTRecord<R>, T> extends Field<T> {
/**
* @return The UDT this field is contained in
*/
UDT<R> getUDT();
}
| [
"lukas.eder@gmail.com"
] | lukas.eder@gmail.com |
c04ebe110976314e417e257c5aa3afab56d4a016 | 180e78725121de49801e34de358c32cf7148b0a2 | /dataset/protocol1/mapstruct/learning/4626/FreeBuilderAccessorNamingStrategy.java | fac5079fbfe054bbb1b5cc73aac9f8251378deae | [] | no_license | ASSERT-KTH/synthetic-checkstyle-error-dataset | 40e8d1e0a7ebe7f7711def96a390891a6922f7bd | 40c057e1669584bfc6fecf789b5b2854660222f3 | refs/heads/master | 2023-03-18T12:50:55.410343 | 2019-01-25T09:54:39 | 2019-01-25T09:54:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,224 | java | /*
* Copyright MapStruct Authors.
*
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package org.mapstruct.ap.spi;
import javax.lang.model.element.ExecutableElement;
/**
* Accessor naming strategy for FreeBuilder.
* FreeBuilder adds a lot of other methods that can be considered as fluent setters. Such as:
* <ul>
* <li>{@code from(Target)}</li>
* <li>{@code mapXXX(UnaryOperator)}</li>
* <li>{@code mutateXXX(Consumer)}</li>
* <li>{@code mergeFrom(Target)}</li>
* <li>{@code mergeFrom(Target.Builder)}</li>
* </ul>
* <p>
* When the JavaBean convention is not used with FreeBuilder then the getters are non standard and MapStruct
* won't recognize them. Therefore one needs to use the JavaBean convention in which the fluent setters
* start with {@code set}.
*
* @author Filip Hrisafov
*/
public class FreeBuilderAccessorNamingStrategy extends DefaultAccessorNamingStrategy {
@Override
protected boolean isFluentSetter(ExecutableElement method) {
// When using FreeBuilder one needs to use the JavaBean convention, which means that all setters will start
// with set
return false;
}
}
| [
"bloriot97@gmail.com"
] | bloriot97@gmail.com |
41b0c064439cb8cb6f48eaab54db2b0e7f35a350 | 10324d9e2d0323bbdc1f0d25b902d857e653bafb | /new111/src/com/web/OnLineUser.java | 336f9199211604c9e72b8417412e9a0a43ef0fde | [] | no_license | EasyBuy-Team/easybuy | 1ff9e14522737a087be442eac582d5b3e30c15ed | 17668fd2a266c6b095ec719cc05110aef3b8b2a4 | refs/heads/master | 2021-07-03T02:25:32.889218 | 2017-09-23T03:52:57 | 2017-09-23T03:52:57 | 104,325,910 | 0 | 0 | null | 2017-09-23T02:53:48 | 2017-09-21T09:06:44 | Java | UTF-8 | Java | false | false | 1,126 | java | package com.web;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpSessionBindingEvent;
import javax.servlet.http.HttpSessionBindingListener;
import com.entity.User;
public class OnLineUser implements HttpSessionBindingListener{
private User user=null;
@Override
public void valueBound(HttpSessionBindingEvent arg0) {
ServletContext application=arg0.getSession().getServletContext();
List<User> userList=(List<User>)application.getAttribute("user");
if(userList==null){
userList=new ArrayList<User>();
}
userList.add(user);
application.setAttribute("user",userList);
}
@Override
public void valueUnbound(HttpSessionBindingEvent arg0) {
ServletContext application=arg0.getSession().getServletContext();
List<User> userList=(List<User>)application.getAttribute("user");
if(userList!=null){
userList.remove(user);
}
application.setAttribute("user",userList);
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
}
| [
"15212215231@163.com"
] | 15212215231@163.com |
9427bce6b3e8965a387f554100e7139326f4d3ce | 8b12148d3fae2dec672c7ebf72208831ed5ac384 | /src/main/java/com/ph/vuelx02/entity/Role.java | 85bac1a54253e8fa7e8c1e4882504575906a7832 | [] | no_license | ph680580/aaa | 5bf51f6188f610983dc925c6921df612f019af57 | 2ede3fb58c42de7242d1c22212b6c65974478169 | refs/heads/master | 2020-05-13T23:02:07.066609 | 2019-04-16T10:55:32 | 2019-04-16T10:55:32 | 181,671,211 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 464 | java | package com.ph.vuelx02.entity;
import java.io.Serializable;
public class Role implements Serializable {
private Integer roleId;
private String name;
public Integer getRoleId() {
return roleId;
}
public void setRoleId(Integer roleId) {
this.roleId = roleId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
} | [
"pangheng000"
] | pangheng000 |
327cd62af4b5c0d877db1df40afc3640165062ee | 39625c67dbe45b148fc089856e51f6c0370ef202 | /webcrawl/src/crawlControler.java | a616f6312a23aac3d4dff3ee23e8aeb62f275601 | [] | no_license | zengyh/JavaApp | 7d1c5c424a31778de1a60d6fc33b2c1937fd4f14 | a5e3faf67d1a903f490facb1ade7028dc36e9122 | refs/heads/master | 2021-01-18T20:40:24.647336 | 2013-06-25T05:11:50 | 2013-06-25T05:11:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,234 | java | import java.io.File;
import java.io.FileOutputStream;
import java.util.LinkedList;
public class crawlControler {
public static LinkedList<String> URLList = new LinkedList<String>();
public static LinkedList<String> IMGList = new LinkedList<String>();
public static LinkedList<String> MissionList = new LinkedList<String>();
public static int nThreadCount = 0;
public final static int nMaxThread = 50;
public final static int nMaxURLLink = 10000;
public static String saveLoc = "";
public crawlControler() {
}
public static void start() {
String strlinktext = "";
boolean bsavetofile = false;
int nAutoStopSignal = 0;
while (true) {
try {
System.out.println("Current threads:" + nThreadCount
+ "; missions:" + crawlControler.MissionList.size());
if ((nThreadCount == 0)
&& (crawlControler.MissionList.size() == 0)) {
nAutoStopSignal++;
if (nAutoStopSignal >= 60) {
System.out
.println("No more mission, will terminate in 60s...");
break;
}
}
if ((nThreadCount < nMaxThread)) {
strlinktext = (String) crawlControler.MissionList
.pollFirst();
if (null == strlinktext || strlinktext.length() <= 0) {
System.out.println("Mission list is empty");
Thread.sleep(1000);
continue;
}
strlinktext = strlinktext.toLowerCase();
System.out.println("------------------------>"
+ strlinktext);
if (strlinktext.endsWith(".css")
|| strlinktext.equals("../"))
continue;
if (strlinktext.endsWith(".jpg")
|| strlinktext.endsWith(".bmp")
|| strlinktext.endsWith(".jpeg")) {
// savetofile
bsavetofile = true;
new File(saveLoc).mkdirs();
FileOutputStream fos = new FileOutputStream(
saveLoc+"savetofile.txt", true);
String strfile = strlinktext + "\r\n";
fos.write(strfile.getBytes());
fos.close();
} else {
bsavetofile = false;
crawlControler.URLList.add(strlinktext);
new File(saveLoc).mkdirs();
FileOutputStream fos = new FileOutputStream(
saveLoc+"Processed URL.txt", true);
String strfile = strlinktext + "\r\n";
fos.write(strfile.getBytes());
fos.close();
}
if (strlinktext.length() > 0) {
Thread g = new crawlThread(strlinktext, bsavetofile);
g.start();//
}
} else {
Thread.sleep(1000);
}
} catch (Exception e) {
// System.out.println("ERROR: controler_start_"+e);
}
}
System.out.println("all complete");
}
public static void main(String[] args) {
String str = "";
try {
// str="http://www.chinatuku.com/fg/dongxuemeijing/index.htm";
// str="http://www.8825.com/6_Class.asp";
str = "http://www.ivsky.com/";
// str = "http://www.bzkoo.com/";
// str = "http://www.mydeskcity.com/";
// str = "http://www.tuhai.org/Untitled-1.html";
// str = "http://www.ivsky.com/Photo/835/87278.html";
crawlControler.MissionList.add(str);
crawlControler.start();
} catch (Exception e) {
System.out.println("Current nRunCount:" + crawlThread.nRunCount);
e.printStackTrace();
}
}
}
| [
"zerosumi@gmail.com"
] | zerosumi@gmail.com |
c012e58a6df7dfd0db87b5dd448f20475fd58dd8 | 95d39438833a92a14d8715c9d71dd6428aa19508 | /PPTP3_Compilation/src/analyseur/AnalyseurSyntaxiqueCup.java | 9f8975545f5d427a1efdedb9428bb115f395b125 | [] | no_license | Thomas7388/compil | 62b1d1ffe4ebc5908a60cb030ea8556af2d18877 | 62f15d2a24e9cc11c6988bc3c41b82759a1cbb42 | refs/heads/master | 2016-09-06T12:58:11.829495 | 2013-05-05T16:11:34 | 2013-05-05T16:11:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,944 | java |
//----------------------------------------------------
// The following code was generated by CUP v0.11a beta 20060608
// Sun May 05 18:03:32 CEST 2013
//----------------------------------------------------
package analyseur;
import java_cup.runtime.*;
import java.util.*;
/** CUP v0.11a beta 20060608 generated parser.
* @version Sun May 05 18:03:32 CEST 2013
*/
public class AnalyseurSyntaxiqueCup extends java_cup.runtime.lr_parser {
/** Default constructor. */
public AnalyseurSyntaxiqueCup() {super();}
/** Constructor which sets the default scanner. */
public AnalyseurSyntaxiqueCup(java_cup.runtime.Scanner s) {super(s);}
/** Constructor which sets the default scanner. */
public AnalyseurSyntaxiqueCup(java_cup.runtime.Scanner s, java_cup.runtime.SymbolFactory sf) {super(s,sf);}
/** Production table. */
protected static final short _production_table[][] =
unpackFromStrings(new String[] {
"\000\012\000\002\002\004\000\002\002\004\000\002\002" +
"\003\000\002\005\002\000\002\003\005\000\002\003\004" +
"\000\002\004\003\000\002\004\003\000\002\004\003\000" +
"\002\004\003" });
/** Access to production table. */
public short[][] production_table() {return _production_table;}
/** Parse-action table. */
protected static final short[][] _action_table =
unpackFromStrings(new String[] {
"\000\016\000\014\003\006\004\004\005\013\006\007\010" +
"\010\001\002\000\004\007\ufffa\001\002\000\004\002\020" +
"\001\002\000\004\007\017\001\002\000\004\007\ufff8\001" +
"\002\000\004\007\ufffb\001\002\000\004\007\ufffe\001\002" +
"\000\016\002\uffff\003\006\004\004\005\013\006\007\010" +
"\010\001\002\000\004\007\ufff9\001\002\000\004\002\001" +
"\001\002\000\004\007\016\001\002\000\016\002\ufffd\003" +
"\ufffd\004\ufffd\005\ufffd\006\ufffd\010\ufffd\001\002\000\016" +
"\002\ufffc\003\ufffc\004\ufffc\005\ufffc\006\ufffc\010\ufffc\001" +
"\002\000\004\002\000\001\002" });
/** Access to parse-action table. */
public short[][] action_table() {return _action_table;}
/** <code>reduce_goto</code> table. */
protected static final short[][] _reduce_table =
unpackFromStrings(new String[] {
"\000\016\000\010\002\004\003\011\004\010\001\001\000" +
"\002\001\001\000\002\001\001\000\002\001\001\000\002" +
"\001\001\000\002\001\001\000\004\005\014\001\001\000" +
"\010\002\013\003\011\004\010\001\001\000\002\001\001" +
"\000\002\001\001\000\002\001\001\000\002\001\001\000" +
"\002\001\001\000\002\001\001" });
/** Access to <code>reduce_goto</code> table. */
public short[][] reduce_table() {return _reduce_table;}
/** Instance of action encapsulation class. */
protected CUP$AnalyseurSyntaxiqueCup$actions action_obj;
/** Action encapsulation object initializer. */
protected void init_actions()
{
action_obj = new CUP$AnalyseurSyntaxiqueCup$actions(this);
}
/** Invoke a user supplied parse action. */
public java_cup.runtime.Symbol do_action(
int act_num,
java_cup.runtime.lr_parser parser,
java.util.Stack stack,
int top)
throws java.lang.Exception
{
/* call code in generated class */
return action_obj.CUP$AnalyseurSyntaxiqueCup$do_action(act_num, parser, stack, top);
}
/** Indicates start state. */
public int start_state() {return 0;}
/** Indicates start production. */
public int start_production() {return 1;}
/** <code>EOF</code> Symbol index. */
public int EOF_sym() {return 0;}
/** <code>error</code> Symbol index. */
public int error_sym() {return 1;}
public void report_error(String message, Object info) {
String m = "Erreur de syntaxe";
if (info instanceof Symbol) {
Symbol s = ((Symbol) info);
if (s.left >= 0) /* Numero de ligne */
m = m + " ligne : " + (s.left+1);
}
System.out.println(m);
}
}
/** Cup generated class to encapsulate user supplied action code.*/
class CUP$AnalyseurSyntaxiqueCup$actions {
private static Boolean isC = false;
private static Boolean isT = false;
private static Boolean isS = false;
private static Boolean isL = false;
private final AnalyseurSyntaxiqueCup parser;
/** Constructor */
CUP$AnalyseurSyntaxiqueCup$actions(AnalyseurSyntaxiqueCup parser) {
this.parser = parser;
}
/** Method with the actual generated action code. */
public final java_cup.runtime.Symbol CUP$AnalyseurSyntaxiqueCup$do_action(
int CUP$AnalyseurSyntaxiqueCup$act_num,
java_cup.runtime.lr_parser CUP$AnalyseurSyntaxiqueCup$parser,
java.util.Stack CUP$AnalyseurSyntaxiqueCup$stack,
int CUP$AnalyseurSyntaxiqueCup$top)
throws java.lang.Exception
{
/* Symbol object for return from actions */
java_cup.runtime.Symbol CUP$AnalyseurSyntaxiqueCup$result;
/* select the action based on the action number */
switch (CUP$AnalyseurSyntaxiqueCup$act_num)
{
/*. . . . . . . . . . . . . . . . . . . .*/
case 9: // expr ::= SOUS
{
Object RESULT =null;
int cleft = ((java_cup.runtime.Symbol)CUP$AnalyseurSyntaxiqueCup$stack.peek()).left;
int cright = ((java_cup.runtime.Symbol)CUP$AnalyseurSyntaxiqueCup$stack.peek()).right;
String c = (String)((java_cup.runtime.Symbol) CUP$AnalyseurSyntaxiqueCup$stack.peek()).value;
//System.out.println("<h2>" + c + "</h2>");
isS = true;
RESULT = c;
CUP$AnalyseurSyntaxiqueCup$result = parser.getSymbolFactory().newSymbol("expr",2, ((java_cup.runtime.Symbol)CUP$AnalyseurSyntaxiqueCup$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalyseurSyntaxiqueCup$stack.peek()), RESULT);
}
return CUP$AnalyseurSyntaxiqueCup$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 8: // expr ::= TITRE
{
Object RESULT =null;
int cleft = ((java_cup.runtime.Symbol)CUP$AnalyseurSyntaxiqueCup$stack.peek()).left;
int cright = ((java_cup.runtime.Symbol)CUP$AnalyseurSyntaxiqueCup$stack.peek()).right;
String c = (String)((java_cup.runtime.Symbol) CUP$AnalyseurSyntaxiqueCup$stack.peek()).value;
//System.out.println("<h1>" + c + "</h1>");
isT = true;
RESULT = c;
CUP$AnalyseurSyntaxiqueCup$result = parser.getSymbolFactory().newSymbol("expr",2, ((java_cup.runtime.Symbol)CUP$AnalyseurSyntaxiqueCup$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalyseurSyntaxiqueCup$stack.peek()), RESULT);
}
return CUP$AnalyseurSyntaxiqueCup$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 7: // expr ::= LI
{
Object RESULT =null;
int cleft = ((java_cup.runtime.Symbol)CUP$AnalyseurSyntaxiqueCup$stack.peek()).left;
int cright = ((java_cup.runtime.Symbol)CUP$AnalyseurSyntaxiqueCup$stack.peek()).right;
String c = (String)((java_cup.runtime.Symbol) CUP$AnalyseurSyntaxiqueCup$stack.peek()).value;
//System.out.println("<li>" + c + "</li>");
isL = true;
RESULT = c;
CUP$AnalyseurSyntaxiqueCup$result = parser.getSymbolFactory().newSymbol("expr",2, ((java_cup.runtime.Symbol)CUP$AnalyseurSyntaxiqueCup$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalyseurSyntaxiqueCup$stack.peek()), RESULT);
}
return CUP$AnalyseurSyntaxiqueCup$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 6: // expr ::= CHAINE
{
Object RESULT =null;
int cleft = ((java_cup.runtime.Symbol)CUP$AnalyseurSyntaxiqueCup$stack.peek()).left;
int cright = ((java_cup.runtime.Symbol)CUP$AnalyseurSyntaxiqueCup$stack.peek()).right;
String c = (String)((java_cup.runtime.Symbol) CUP$AnalyseurSyntaxiqueCup$stack.peek()).value;
//System.out.println("<p>" + c + "</p>");
isC = true;
RESULT = c;
CUP$AnalyseurSyntaxiqueCup$result = parser.getSymbolFactory().newSymbol("expr",2, ((java_cup.runtime.Symbol)CUP$AnalyseurSyntaxiqueCup$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalyseurSyntaxiqueCup$stack.peek()), RESULT);
}
return CUP$AnalyseurSyntaxiqueCup$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 5: // expression ::= error SAUT
{
Object RESULT =null;
CUP$AnalyseurSyntaxiqueCup$result = parser.getSymbolFactory().newSymbol("expression",1, ((java_cup.runtime.Symbol)CUP$AnalyseurSyntaxiqueCup$stack.elementAt(CUP$AnalyseurSyntaxiqueCup$top-1)), ((java_cup.runtime.Symbol)CUP$AnalyseurSyntaxiqueCup$stack.peek()), RESULT);
}
return CUP$AnalyseurSyntaxiqueCup$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 4: // expression ::= expr NT$0 SAUT
{
Object RESULT =null;
// propagate RESULT from NT$0
RESULT = (Object) ((java_cup.runtime.Symbol) CUP$AnalyseurSyntaxiqueCup$stack.elementAt(CUP$AnalyseurSyntaxiqueCup$top-1)).value;
int eleft = ((java_cup.runtime.Symbol)CUP$AnalyseurSyntaxiqueCup$stack.elementAt(CUP$AnalyseurSyntaxiqueCup$top-2)).left;
int eright = ((java_cup.runtime.Symbol)CUP$AnalyseurSyntaxiqueCup$stack.elementAt(CUP$AnalyseurSyntaxiqueCup$top-2)).right;
Object e = (Object)((java_cup.runtime.Symbol) CUP$AnalyseurSyntaxiqueCup$stack.elementAt(CUP$AnalyseurSyntaxiqueCup$top-2)).value;
CUP$AnalyseurSyntaxiqueCup$result = parser.getSymbolFactory().newSymbol("expression",1, ((java_cup.runtime.Symbol)CUP$AnalyseurSyntaxiqueCup$stack.elementAt(CUP$AnalyseurSyntaxiqueCup$top-2)), ((java_cup.runtime.Symbol)CUP$AnalyseurSyntaxiqueCup$stack.peek()), RESULT);
}
return CUP$AnalyseurSyntaxiqueCup$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 3: // NT$0 ::=
{
Object RESULT =null;
int eleft = ((java_cup.runtime.Symbol)CUP$AnalyseurSyntaxiqueCup$stack.peek()).left;
int eright = ((java_cup.runtime.Symbol)CUP$AnalyseurSyntaxiqueCup$stack.peek()).right;
Object e = (Object)((java_cup.runtime.Symbol) CUP$AnalyseurSyntaxiqueCup$stack.peek()).value;
if(isC)
System.out.println("<p>"+e+"</p>");
if(isL)
System.out.println(" <li>"+e+"</li>");
if(isT)
System.out.println("<h1>"+e+"</h1>");
if(isS)
System.out.println("<h2>"+e+"</h2>");
isC = false; isL = false; isT = false; isS = false;
CUP$AnalyseurSyntaxiqueCup$result = parser.getSymbolFactory().newSymbol("NT$0",3, ((java_cup.runtime.Symbol)CUP$AnalyseurSyntaxiqueCup$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalyseurSyntaxiqueCup$stack.peek()), RESULT);
}
return CUP$AnalyseurSyntaxiqueCup$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 2: // seq_expressions ::= expression
{
Object RESULT =null;
CUP$AnalyseurSyntaxiqueCup$result = parser.getSymbolFactory().newSymbol("seq_expressions",0, ((java_cup.runtime.Symbol)CUP$AnalyseurSyntaxiqueCup$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalyseurSyntaxiqueCup$stack.peek()), RESULT);
}
return CUP$AnalyseurSyntaxiqueCup$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 1: // $START ::= seq_expressions EOF
{
Object RESULT =null;
int start_valleft = ((java_cup.runtime.Symbol)CUP$AnalyseurSyntaxiqueCup$stack.elementAt(CUP$AnalyseurSyntaxiqueCup$top-1)).left;
int start_valright = ((java_cup.runtime.Symbol)CUP$AnalyseurSyntaxiqueCup$stack.elementAt(CUP$AnalyseurSyntaxiqueCup$top-1)).right;
Object start_val = (Object)((java_cup.runtime.Symbol) CUP$AnalyseurSyntaxiqueCup$stack.elementAt(CUP$AnalyseurSyntaxiqueCup$top-1)).value;
RESULT = start_val;
CUP$AnalyseurSyntaxiqueCup$result = parser.getSymbolFactory().newSymbol("$START",0, ((java_cup.runtime.Symbol)CUP$AnalyseurSyntaxiqueCup$stack.elementAt(CUP$AnalyseurSyntaxiqueCup$top-1)), ((java_cup.runtime.Symbol)CUP$AnalyseurSyntaxiqueCup$stack.peek()), RESULT);
}
/* ACCEPT */
CUP$AnalyseurSyntaxiqueCup$parser.done_parsing();
return CUP$AnalyseurSyntaxiqueCup$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 0: // seq_expressions ::= expression seq_expressions
{
Object RESULT =null;
CUP$AnalyseurSyntaxiqueCup$result = parser.getSymbolFactory().newSymbol("seq_expressions",0, ((java_cup.runtime.Symbol)CUP$AnalyseurSyntaxiqueCup$stack.elementAt(CUP$AnalyseurSyntaxiqueCup$top-1)), ((java_cup.runtime.Symbol)CUP$AnalyseurSyntaxiqueCup$stack.peek()), RESULT);
}
return CUP$AnalyseurSyntaxiqueCup$result;
/* . . . . . .*/
default:
throw new Exception(
"Invalid action number found in internal parse table");
}
}
}
| [
"t.bosviel@gmail.com"
] | t.bosviel@gmail.com |
415351fd6cf5957fbc98c9e003a56042b85bda30 | 9da0e47302a68aebb1816d64365e7c3d2b216719 | /src/array/SortedArray.java | 13730a17970fd8ad89af4e4e34cd88e9da963108 | [] | no_license | 13030509/algorithm | 09c311c20ec26a6bb39ee71bd6c79a1de4fb09d6 | 0bd130b24760ee17a6c754cb64f1fa5eff156255 | refs/heads/master | 2020-05-07T08:29:33.084045 | 2019-08-08T05:50:01 | 2019-08-08T05:50:01 | 180,331,229 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,628 | java | package array;
public class SortedArray {
private int lastIndex = 0;
private final int capacity = 10;
int[] sortedArray = new int[capacity];
public void add(int num) {
if (lastIndex == capacity) {
return;
}
if (lastIndex == 0) sortedArray[lastIndex] = num;
else {
int i = lastIndex;
for (; i > 0 && num < sortedArray[i - 1]; i--) {
sortedArray[i] = sortedArray[i - 1];
}
sortedArray[i] = num;
}
lastIndex++;
}
public boolean remove(int index) {
if (index > capacity || index > lastIndex) {
return false;
} else {
for (int i = index; i < lastIndex; i++) {
sortedArray[i] = sortedArray[i + 1];
}
lastIndex--;
}
return true;
}
public int get(int index) {
if (index > capacity || index > lastIndex) {
return -1;
} else {
return sortedArray[index];
}
}
public void printAll() {
for (int i = 0; i < lastIndex; i++) {
System.out.print(sortedArray[i] + " ");
}
}
public static void main(String[] args) {
SortedArray sortedArray = new SortedArray();
sortedArray.add(5);
sortedArray.add(3);
sortedArray.add(10);
sortedArray.add(1);
sortedArray.add(2);
System.out.println(sortedArray.get(3));
sortedArray.printAll();
System.out.println(sortedArray.remove(2));
sortedArray.printAll();
}
}
| [
"597349771@qq.com"
] | 597349771@qq.com |
3eb57fbae3b19e2303a759247b27d6bd52994cf0 | 308b7ddeefe161fa82e1d6af18032f2bdda33642 | /gwt-framework/gwt-framework-client/src/main/java/org/googlecode/gwt/client/rpc/UntrackedResponseCallback.java | 7b5cbe9508b798e8e5d41b70e34f89936fd797f9 | [] | no_license | masini/productive-gwt | 2e95ac22f8725ba0eed5b270d8ded606f01cd36c | 4bb2d3b7f820d1bd7d2980f754498caf0e0976c1 | refs/heads/master | 2021-01-10T07:22:02.120379 | 2015-05-26T12:35:04 | 2015-05-26T12:35:04 | 50,906,042 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,841 | java | package org.googlecode.gwt.client.rpc;
import com.google.gwt.http.client.Response;
import com.google.gwt.user.client.rpc.AsyncCallback;
import org.jboss.errai.common.client.api.ErrorCallback;
import org.jboss.errai.enterprise.client.jaxrs.MarshallingWrapper;
import org.jboss.errai.enterprise.client.jaxrs.api.ResponseCallback;
public abstract class UntrackedResponseCallback<T> implements AsyncCallback<T> {
private Class<?> clazz;
public UntrackedResponseCallback(Class<?> clazz) {
super();
this.clazz = clazz;
}
public UntrackedResponseCallback() {
super();
}
public ResponseCallback asRemoteCallback() {
return new ResponseCallback() {
@Override
public void callback(Response response) {
String text;
T body = null;
if (response != null) {
text = (response).getText();
if (text != null && !text.equals("")){
body = (T)(MarshallingWrapper.fromJSON(
response.getText(), clazz));
}
}
onSuccess(body);
userOnSuccess(response);
}
};
}
public ErrorCallback asErrorCallback() {
return new ErrorCallback() {
@Override
public boolean error(Object message, Throwable throwable) {
onFailure(throwable);
return false;
}
};
}
/**
* Implement this method in order to access both the response header and the
* <p/>
* response body.
*
* @param response rpc response.
*/
protected abstract void userOnSuccess(Response response);
}
| [
"luca.masini@0ae46c31-5d43-0410-b0ff-25ec9014f3a9"
] | luca.masini@0ae46c31-5d43-0410-b0ff-25ec9014f3a9 |
d0ecbd9cabf764c723334cf04ff6ed904d871dd9 | f7cf46c128d08811b27aad47fe06bed42c20ef37 | /src/main/java/br/com/sicredi/votacaoapi/application/error/DetalhesDoErro.java | 9d4904293349e4a3deec0d4c0f82246b2cd685bc | [
"MIT"
] | permissive | ruddypersivo/jobs | cf1572536665b1edc11cde1624676018493f6f3c | d8e930841cd20cd5d4ea62accb72c466d726d738 | refs/heads/master | 2020-09-16T18:33:49.918196 | 2019-11-25T12:10:30 | 2019-11-25T12:10:30 | 222,963,016 | 0 | 0 | MIT | 2019-11-20T15:01:42 | 2019-11-20T15:01:42 | null | UTF-8 | Java | false | false | 1,389 | java | package br.com.sicredi.votacaoapi.application.error;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
@Getter
@AllArgsConstructor(access = AccessLevel.PROTECTED)
public class DetalhesDoErro {
private String titulo;
private int status;
private String detalhes;
private long timestamp;
private String mensagemParaDesenvolvedor;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public static final class Builder {
private String titulo;
private int status;
private String detalhes;
private long timestamp;
private String mensagemParaDesenvolvedor;
public static Builder newBuilder() {
return new Builder();
}
public Builder comTitulo(String titulo) {
this.titulo = titulo;
return this;
}
public Builder comStatus(int status) {
this.status = status;
return this;
}
public Builder comDetalhes(String detalhes) {
this.detalhes = detalhes;
return this;
}
public Builder comTimestamp(long timestamp) {
this.timestamp = timestamp;
return this;
}
public Builder comMensagemParaDesenvolvedor(String mensagemParaDesenvolvedor) {
this.mensagemParaDesenvolvedor = mensagemParaDesenvolvedor;
return this;
}
public DetalhesDoErro constroi() {
return new DetalhesDoErro(titulo, status, detalhes, timestamp, mensagemParaDesenvolvedor);
}
}
}
| [
"ruddy.persivo@gmail.com"
] | ruddy.persivo@gmail.com |
e5eb0d14880c49f9f134ca627f75b3cce3cbbcc7 | e863b542fd5d2631df46a9c5028130968e29fe82 | /src/test/java/com/asher/bootdemo/BootDemoApplicationTests.java | 298fbff974e76699d9081f5b368e7329903f9680 | [] | no_license | DengMFJ/boot-demo | 554670f45def31626eb735f8657742f5049263a1 | 11b0e6ad1fb62d90ae71b1686951a09d0f1892e2 | refs/heads/master | 2021-03-17T10:04:32.182282 | 2020-03-13T03:38:59 | 2020-03-13T03:38:59 | 246,981,955 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 221 | java | package com.asher.bootdemo;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class BootDemoApplicationTests {
@Test
void contextLoads() {
}
}
| [
"asher_java@outlook.com"
] | asher_java@outlook.com |
1b32941c7cfd4610dce86d379044ce53300e12a3 | cc92fbf2a87e0cba8717d4523a74d5402d8b5973 | /listas_sala/Aula13_MVC/MVC_MVP/mvp/presenter/PersonDetailPresenterImpl.java | 607f0e51f189ae3bb0e58fd39f7fe6231e18ee2a | [] | no_license | dicksiano/ces28_2017_dicksiano.melo | 2505a93935930d063ad33302023820b042b9cc90 | c2ba4f06c1f07adc015f74671e79164534ee1ad8 | refs/heads/master | 2021-08-20T00:54:36.334074 | 2017-11-27T21:28:21 | 2017-11-27T21:28:21 | 100,269,947 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,955 | java | package presenter;
import java.util.ArrayList;
import java.util.List;
import model.PersonMVC;
import model.Person.PersonListener;
import view.PersonDetailViewMVC;
import view.PersonDetailViewListenerMVC;
public class PersonDetailPresenterImpl implements PersonDetailViewListenerMVC {
public PersonDetailPresenterImpl(PersonMVC person)
{
this.setModel(person);
this.setView(person);
}
@Override
public void changedButtonPressed() {
final String newName = _view.getNameFromTextField();
if (isNotEmpty(newName))
{
this.getModel().setName(getSizedName(getValidName(newName)));
}
}
@Override
public void windowClosed() {
System.exit(0);
}
protected PersonDetailViewMVC getView() {
return _view;
}
protected void setView(PersonMVC person){
_view = new PersonDetailViewMVC(person, this);
this.getView().display();
}
protected PersonMVC getModel() {
return _model;
}
protected void setModel(PersonMVC model) {
_model = model;
}
private Boolean isNotEmpty(String s){
return !s.trim().isEmpty();
}
private String getValidName(String name) {
name = name.replaceAll("[^a-zA-Z]+","");
name = name.substring(0,1).toUpperCase() + name.substring(1).toLowerCase();
return name;
}
private String getSizedName(String name) {
if(name.length() <= 6) {
return "VERMELHO" + name;
} else if(name.length() <= 10) {
return "VERDE" + name;
} else {
return "AMARELO" + name;
}
}
public void addListener(PersonListener l)
{
this.listeners.add(l);
}
public void removeListener(PersonListener l)
{
this.listeners.remove(l);
}
public void fireOnNameChanged() {
for(PersonListener l:this.listeners)
{
l.onPersonNameChanged();
}
}
private PersonMVC _model;
private PersonDetailViewMVC _view;
private List<PersonListener> listeners = new ArrayList<PersonListener>();
}
| [
"dicksianomelo@gmail.com"
] | dicksianomelo@gmail.com |
afe8c630e696fef9a8e9b98d5d494be53f941d7b | bd1ffaf12d4a1f5baf1c5e23381aace226111166 | /JavaTest/src/test01/Rectangle.java | 0539797249566177a353594d30d339bc2bf7d052 | [] | no_license | NoClay/JAVA_TEST | 2320d35f498b6d36ca415b4271a4de4d8b91b3f7 | 8d93cfbfff6c246dead288f1796409116f3c31e4 | refs/heads/master | 2020-06-23T20:05:12.889641 | 2017-01-02T13:55:23 | 2017-01-02T13:55:23 | 74,638,276 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 927 | java | package test01;
/**
* Created by 82661 on 2016/9/29.
*/
public class Rectangle {
private int width;
private int height;
public Rectangle(int width, int height) {
this.width = width;
this.height = height;
}
public Rectangle() {
this.width = this.height = 1;
}
public double getArea() {
return width * height;
}
public double getPerimeter(){
return 2 * (width + height);
}
@Override
public String toString() {
return "矩形(" + width + "," + height + ')';
}
public boolean equals(Rectangle rectangle) {
return this.getArea() == rectangle.getArea();
}
public static void main(String [] args){
Rectangle rectangle = new Rectangle(1, 3);
System.out.println(rectangle.toString()
+ "\n周长:" + rectangle.getPerimeter()
+ "\n面积:" + rectangle.getArea());
}
}
| [
"826611389@qq.com"
] | 826611389@qq.com |
742f19922a239ba1b77169287e4ee10d76fe0f34 | abe427fff8cd9e51d566939d6b3fe5257b731913 | /bigdata/HBase/src/main/java/definitiveGuide/chapter03/GetListExample.java | 35d84c5fc6430ea490d109aec219264f2fba2586 | [] | no_license | pirateatpiracy/edge_old | 5828b7f4e0d12ca499868e6d9ee2a576c64c316a | 6780a945025ad5024ef1e0b4633ff255cfb6033d | refs/heads/master | 2021-09-29T14:05:49.175077 | 2018-08-26T15:33:51 | 2018-08-26T15:33:51 | 119,120,788 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,382 | java | package definitiveGuide.chapter03;
// cc GetListExample Example of retrieving data from HBase using lists of Get instances
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellUtil;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.ConnectionFactory;
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.util.Bytes;
import definitiveGuide.util.HBaseHelper;
public class GetListExample {
public static void main(String[] args) throws IOException {
Configuration conf = HBaseConfiguration.create();
HBaseHelper helper = HBaseHelper.getHelper(conf);
if (!helper.existsTable("testtable")) {
helper.createTable("testtable", "colfam1");
}
Connection connection = ConnectionFactory.createConnection(conf);
Table table = connection.getTable(TableName.valueOf("testtable"));
// vv GetListExample
byte[] cf1 = Bytes.toBytes("colfam1");
byte[] qf1 = Bytes.toBytes("qual1");
byte[] qf2 = Bytes.toBytes("qual2"); // co GetListExample-1-Prepare Prepare commonly used byte arrays.
byte[] row1 = Bytes.toBytes("row1");
byte[] row2 = Bytes.toBytes("row2");
List<Get> gets = new ArrayList<Get>(); // co GetListExample-2-CreateList Create a list that holds the Get instances.
Get get1 = new Get(row1);
get1.addColumn(cf1, qf1);
gets.add(get1);
Get get2 = new Get(row2);
get2.addColumn(cf1, qf1); // co GetListExample-3-AddGets Add the Get instances to the list.
gets.add(get2);
Get get3 = new Get(row2);
get3.addColumn(cf1, qf2);
gets.add(get3);
Result[] results = table.get(gets); // co GetListExample-4-DoGet Retrieve rows with selected columns from HBase.
System.out.println("First iteration...");
for (Result result : results) {
String row = Bytes.toString(result.getRow());
System.out.print("Row: " + row + " ");
byte[] val = null;
if (result.containsColumn(cf1, qf1)) { // co GetListExample-5-GetValue1 Iterate over results and check what values are available.
val = result.getValue(cf1, qf1);
System.out.println("Value: " + Bytes.toString(val));
}
if (result.containsColumn(cf1, qf2)) {
val = result.getValue(cf1, qf2);
System.out.println("Value: " + Bytes.toString(val));
}
}
System.out.println("Second iteration...");
for (Result result : results) {
for (Cell cell : result.listCells()) { // co GetListExample-6-GetValue2 Iterate over results again, printing out all values.
System.out.println(
"Row: " + Bytes.toString(
cell.getRowArray(), cell.getRowOffset(), cell.getRowLength()) + // co GetListExample-7-GetValue2 Two different ways to access the cell data.
" Value: " + Bytes.toString(CellUtil.cloneValue(cell)));
}
}
System.out.println("Third iteration...");
for (Result result : results) {
System.out.println(result);
}
// ^^ GetListExample
table.close();
connection.close();
helper.close();
}
}
| [
"koushikpaul1@gmail.com"
] | koushikpaul1@gmail.com |
5eacf99e676ce1dbe16d6b33382a6fa570086735 | 9dc35b777e18197c4c30f750ab75cbce9c165ad8 | /mapper-gateway/src/main/java/com/mattfirtion/mapper/web/rest/UserJWTController.java | 4bb13bc2e8d457e71f1b96dcbb9d187f77eb88e4 | [] | no_license | mattfirtion/mapit | 6e290c11cece03a90939091f0bbcbfb669592f1a | a0f7843dbf5a1c3d116ba9d1a5c9063477618075 | refs/heads/master | 2021-01-21T12:16:30.637772 | 2017-09-01T01:15:58 | 2017-09-01T01:15:58 | 102,059,796 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,051 | java | package com.mattfirtion.mapper.web.rest;
import com.mattfirtion.mapper.security.jwt.JWTConfigurer;
import com.mattfirtion.mapper.security.jwt.TokenProvider;
import com.mattfirtion.mapper.web.rest.vm.LoginVM;
import com.codahale.metrics.annotation.Timed;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.Collections;
/**
* Controller to authenticate users.
*/
@RestController
@RequestMapping("/api")
public class UserJWTController {
private final Logger log = LoggerFactory.getLogger(UserJWTController.class);
private final TokenProvider tokenProvider;
private final AuthenticationManager authenticationManager;
public UserJWTController(TokenProvider tokenProvider, AuthenticationManager authenticationManager) {
this.tokenProvider = tokenProvider;
this.authenticationManager = authenticationManager;
}
@PostMapping("/authenticate")
@Timed
public ResponseEntity authorize(@Valid @RequestBody LoginVM loginVM, HttpServletResponse response) {
UsernamePasswordAuthenticationToken authenticationToken =
new UsernamePasswordAuthenticationToken(loginVM.getUsername(), loginVM.getPassword());
try {
Authentication authentication = this.authenticationManager.authenticate(authenticationToken);
SecurityContextHolder.getContext().setAuthentication(authentication);
boolean rememberMe = (loginVM.isRememberMe() == null) ? false : loginVM.isRememberMe();
String jwt = tokenProvider.createToken(authentication, rememberMe);
response.addHeader(JWTConfigurer.AUTHORIZATION_HEADER, "Bearer " + jwt);
return ResponseEntity.ok(new JWTToken(jwt));
} catch (AuthenticationException ae) {
log.trace("Authentication exception trace: {}", ae);
return new ResponseEntity<>(Collections.singletonMap("AuthenticationException",
ae.getLocalizedMessage()), HttpStatus.UNAUTHORIZED);
}
}
/**
* Object to return as body in JWT Authentication.
*/
static class JWTToken {
private String idToken;
JWTToken(String idToken) {
this.idToken = idToken;
}
@JsonProperty("id_token")
String getIdToken() {
return idToken;
}
void setIdToken(String idToken) {
this.idToken = idToken;
}
}
}
| [
"matt.firtion@gmail.com"
] | matt.firtion@gmail.com |
6b7cef9e68b6c5875b8433828929ae4af075da26 | ee1ec426553fdbed379795a84c330fb13a696ac2 | /src/main/java/common/TreeNode.java | b24867c5a538fe7059609b7a0e70748106114a03 | [] | no_license | zhumingyuan-2019/leetcode | 26673903c8d7d6329f8f52c46778f9db30e8047d | b114cfde9da407ff445eeafdd88d0e37e870c7fa | refs/heads/master | 2022-11-18T23:44:19.884965 | 2022-11-13T17:15:48 | 2022-11-13T17:15:48 | 197,484,524 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 796 | java | package common;
/**
* @author :zhumingyuan
* @description:TODO
* @date :2022/10/28 8:12 PM
*/
public class TreeNode {
public int val;
public TreeNode left;
public TreeNode right;
TreeNode() {}
TreeNode(int val) { this.val = val; }
TreeNode(int val, TreeNode left, TreeNode right) {
this.val = val;
this.left = left;
this.right = right;
}
public static TreeNode create() {
TreeNode root= new TreeNode(1);
root.left = new TreeNode(2);
root.right = new TreeNode(3);
root.left.left = new TreeNode(4);
root.left.right = new TreeNode(5);
root.right.left = new TreeNode(6);
root.right.right = new TreeNode(7);
return root;
}
}
| [
"zhumingyuan@buaa.edu.cn"
] | zhumingyuan@buaa.edu.cn |
fa1dcbde039978b5f1b2dddd0bad8a0a5c5e3ae7 | b0d9b9bbe9d7d88e0d341d74c2a55ba7d965fedf | /AgendaFragments/app/src/androidTest/java/com/example/agendafragments/ExampleInstrumentedTest.java | 55b14a72aa64cd5730348f87dcfc00c63a27660b | [] | no_license | jhanmaicol/Clases | d2067e849e4d4d9e3179a53d1a733f022977fec8 | 552b31384588d73dcb8809f83b2909a7b5550376 | refs/heads/master | 2020-04-21T22:31:27.634389 | 2019-04-06T23:29:11 | 2019-04-06T23:29:11 | 169,912,285 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 738 | java | package com.example.agendafragments;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.agendafragments", appContext.getPackageName());
}
}
| [
"jhanmaicol_jesus@hotmail.com"
] | jhanmaicol_jesus@hotmail.com |
71730526aa5468d269c1b72c7763ca0ca2cb03f1 | d9127daf13d162448a2076069051de73d2a9995b | /app/src/androidTest/java/pl/mikolajlen/whereami/mainActivity/TestMainActivityModule.java | b790ff249185595d435af5ad1923b37d244479d6 | [] | no_license | MikolajLen/WhereAmI | fdd98e3623e9f3fb88f0519da9e22e21e33c45fd | c999e6a52690bd9902b1df525dd1f87a10e6028b | refs/heads/master | 2021-08-22T17:24:08.531513 | 2017-11-30T20:15:35 | 2017-11-30T20:15:35 | 112,655,558 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 587 | java | package pl.mikolajlen.whereami.mainActivity;
import android.app.Activity;
import dagger.Binds;
import dagger.Module;
import dagger.android.ActivityKey;
import dagger.android.AndroidInjector;
import dagger.multibindings.IntoMap;
/**
* Created by mikolaj on 09.07.2017.
*/
@Module(subcomponents = TestMainActivitySubcomponent.class)
public abstract class TestMainActivityModule {
@Binds
@IntoMap
@ActivityKey(MainActivity.class)
abstract AndroidInjector.Factory<? extends Activity>
bindYourActivityInjectorFactory(TestMainActivitySubcomponent.Builder builder);
}
| [
"nycoolay@o2.pl"
] | nycoolay@o2.pl |
df3fd9d06e6727289dc0b7d64afb292d067ec364 | 805c0c8f73f488f309f1cef33b0652fce36322b8 | /pinyougou-gateway/src/main/java/com/pinyougou/zuul/config/Swagger2Config.java | dc64d723ff73368885e1c1a04759c04c48b531fd | [] | no_license | oneboat/pinyougou-master | 713cec2e62208358a48531ee11e44b6a7d39a1bc | 46515e289342df971ac3c8e1cf3f284c63c26d31 | refs/heads/master | 2020-05-02T12:33:50.777186 | 2019-03-18T17:04:43 | 2019-03-18T17:04:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,040 | java | package com.pinyougou.zuul.config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
* ┏┓ ┏┓
* ┏┛┻━━━┛┻┓
* ┃ ┃
* ┃ ━ ┃
* ┃ ┳┛ ┗┳ ┃
* ┃ ┃
* ┃ ┻ ┃
* ┃ ┃
* ┗━┓ ┏━┛
* ┃ ┃神兽保佑
* ┃ ┃代码无BUG!
* ┃ ┗━━━┓
* ┃ ┣┓
* ┃ ┏┛
* ┗┓┓┏━┳┓┏┛
* ┃┫┫ ┃┫┫
* ┗┻┛ ┗┻┛
*
* @program: pinyougou-master
* @description:
* @author: 徐子楼
* @create: 2019-01-20 20:13
**/
@Configuration
@EnableSwagger2
public class Swagger2Config {
@Value("${swagger.enabled}")
private boolean swaggerEnabled;
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.enable(swaggerEnabled)
.apiInfo(apiInfo());
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("品优购API文档")
.description("品优购接口文档说明")
.termsOfServiceUrl("http://localhost:8888")
.contact(new Contact("徐子楼", "", "qq1215855088@gmail.com"))
.version("1.0")
.build();
}
}
| [
"1215855088@qq.com"
] | 1215855088@qq.com |
903de3be46f58bcf77f730cdeb0b18e36e459d5f | 6ceada0d6310f41ebd2387eed1413975f611ab55 | /icy/gui/main/MainListener.java | 37a69b8df361478aa6c73d1072335dbd71ab2db4 | [] | no_license | zeb/Icy-Kernel | 441484a5f862e50cf4992b5a06f35447cd748eda | d2b296e043c77da31d27b8f0242d007b3e5e17e2 | refs/heads/master | 2021-01-16T22:46:48.889696 | 2013-03-18T13:30:43 | 2013-03-18T13:30:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,149 | java | /*
* Copyright 2010, 2011 Institut Pasteur.
*
* This file is part of ICY.
*
* ICY 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.
*
* ICY 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 ICY. If not, see <http://www.gnu.org/licenses/>.
*/
package icy.gui.main;
import java.util.EventListener;
public interface MainListener extends EventListener
{
/**
* A plugin has been started
*/
public void pluginOpened(MainEvent event);
/**
* A plugin has ended
*/
public void pluginClosed(MainEvent event);
/**
* A viewer has been opened
*/
public void viewerOpened(MainEvent event);
/**
* A viewer just got the focus
*/
public void viewerFocused(MainEvent event);
/**
* A viewer has been closed
*/
public void viewerClosed(MainEvent event);
/**
* A sequence has been opened
*/
public void sequenceOpened(MainEvent event);
/**
* A sequence just got the focus
*/
public void sequenceFocused(MainEvent event);
/**
* A sequence has been closed
*/
public void sequenceClosed(MainEvent event);
/**
* A ROI has been added to its first sequence
*/
public void roiAdded(MainEvent event);
/**
* A ROI has been removed from its last sequence
*/
public void roiRemoved(MainEvent event);
/**
* A painter has been added to its first sequence
*/
public void painterAdded(MainEvent event);
/**
* A painter has been removed from its last sequence
*/
public void painterRemoved(MainEvent event);
}
| [
"stephane.dallongeville@pasteur.fr"
] | stephane.dallongeville@pasteur.fr |
2a75a222d546df487ac834b59553e3a9117a6c70 | f96fe513bfdf2d1dbd582305e1cbfda14a665bec | /net.sf.smbt.jazzmutant.diagram/src/net/sf/smbt/jzmui/diagram/edit/parts/JZSurfaceLCD2EditPart.java | 28323711df61250d18f06753f1ad22df056a25b7 | [] | no_license | lucascraft/ubq_wip | 04fdb727e7b2dc384ba1d2195ad47e895068e1e4 | eff577040f21be71ea2c76c187d574f1617703ce | refs/heads/master | 2021-01-22T02:28:20.687330 | 2015-06-10T12:38:47 | 2015-06-10T12:38:47 | 37,206,324 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,256 | java | package net.sf.smbt.jzmui.diagram.edit.parts;
import net.sf.smbt.jazzmutant.diagram.figures.JZSurfaceLCDFigure;
import net.sf.smbt.jazzmutant.diagram.parts.JZUIShapeNodeEditPart;
import net.sf.smbt.jzmui.JZSurfaceLCD;
import net.sf.smbt.jzmui.diagram.edit.policies.JZSurfaceLCD2ItemSemanticEditPolicy;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.PositionConstants;
import org.eclipse.draw2d.Shape;
import org.eclipse.draw2d.StackLayout;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPolicy;
import org.eclipse.gef.Request;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.editpolicies.LayoutEditPolicy;
import org.eclipse.gef.editpolicies.ResizableEditPolicy;
import org.eclipse.gef.requests.CreateRequest;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.swt.graphics.Color;
/**
* @generated NOT
*/
public class JZSurfaceLCD2EditPart extends JZUIShapeNodeEditPart {
/**
* @generated
*/
public static final int VISUAL_ID = 3035;
/**
* @generated
*/
protected IFigure contentPane;
/**
* @generated
*/
protected IFigure primaryShape;
/**
* @generated
*/
public JZSurfaceLCD2EditPart(View view) {
super(view);
}
/**
* @generated
*/
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE,
new JZSurfaceLCD2ItemSemanticEditPolicy());
installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
// XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
// removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
}
/**
* @generated NOT
*/
protected LayoutEditPolicy createLayoutEditPolicy() {
org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() {
protected EditPolicy createChildEditPolicy(EditPart child) {
EditPolicy result = child
.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
if (result == null) {
result = new ResizableEditPolicy();
}
return result;
}
protected Command getMoveChildrenCommand(Request request) {
return null;
}
protected Command getCreateCommand(CreateRequest request) {
return null;
}
};
return lep;
}
/**
* @generated NOT
*/
public EditPolicy getPrimaryDragEditPolicy() {
EditPolicy result = super.getPrimaryDragEditPolicy();
if (result instanceof ResizableEditPolicy) {
ResizableEditPolicy ep = (ResizableEditPolicy) result;
ep.setResizeDirections(PositionConstants.NSEW);
}
return result;
}
/**
* @generated
*/
protected IFigure createNodeShape() {
return primaryShape = new JZSurfaceLCDFigureDescriptor();
}
/**
* @generated
*/
public JZSurfaceLCDFigureDescriptor getPrimaryShape() {
return (JZSurfaceLCDFigureDescriptor) primaryShape;
}
/**
* @generated
*/
protected NodeFigure createNodePlate() {
DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(40, 40);
return result;
}
/**
* Creates figure for this edit part.
*
* Body of this method does not depend on settings in generation model
* so you may safely remove <i>generated</i> tag and modify it.
*
* @generated
*/
protected NodeFigure createNodeFigure() {
NodeFigure figure = createNodePlate();
figure.setLayoutManager(new StackLayout());
IFigure shape = createNodeShape();
figure.add(shape);
contentPane = setupContentPane(shape);
return figure;
}
/**
* Default implementation treats passed figure as content pane.
* Respects layout one may have set for generated figure.
* @param nodeShape instance of generated figure class
* @generated
*/
protected IFigure setupContentPane(IFigure nodeShape) {
return nodeShape; // use nodeShape itself as contentPane
}
/**
* @generated
*/
public IFigure getContentPane() {
if (contentPane != null) {
return contentPane;
}
return super.getContentPane();
}
/**
* @generated
*/
protected void setForegroundColor(Color color) {
if (primaryShape != null) {
primaryShape.setForegroundColor(color);
}
}
/**
* @generated
*/
protected void setBackgroundColor(Color color) {
if (primaryShape != null) {
primaryShape.setBackgroundColor(color);
}
}
/**
* @generated
*/
protected void setLineWidth(int width) {
if (primaryShape instanceof Shape) {
((Shape) primaryShape).setLineWidth(width);
}
}
/**
* @generated
*/
protected void setLineType(int style) {
if (primaryShape instanceof Shape) {
((Shape) primaryShape).setLineStyle(style);
}
}
/**
* @generated
*/
public class JZSurfaceLCDFigureDescriptor extends JZSurfaceLCDFigure {
/**
* @generated NOT
*/
public JZSurfaceLCDFigureDescriptor() {
super((JZSurfaceLCD) ((Node) getModel()).getElement());
this.setSize(getMapMode().DPtoLP(60), getMapMode().DPtoLP(60));
}
}
}
| [
"lucas.bigeardel@gmail.com"
] | lucas.bigeardel@gmail.com |
d319114b06788350ae90d649e6920bf19ea08197 | 07ac1841b4abd360f7ab8096df295bc78a651d3d | /src/main/java/org/yueli/userinterface/primarycareworkarea/PrimaryCareWorkArea.java | b58b37f23292e143f49098fafb4ad06dfa1b5cc5 | [] | no_license | Lydia0310/App_Final | ce3df751459979eae54027fc8b44f1e8482852dc | 8001e73d6e506ffb926c3564986d904516df9803 | refs/heads/master | 2016-09-05T10:25:50.771507 | 2014-12-10T04:12:43 | 2014-12-10T04:12:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,447 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.yueli.userinterface.primarycareworkarea;
import java.awt.CardLayout;
import javax.swing.JPanel;
import org.yueli.business.Business;
import org.yueli.business.network.Network;
import org.yueli.business.useraccount.UserAccount;
import org.yueli.userinterface.AppEntrance;
/**
*
* @author Lydia
*/
public class PrimaryCareWorkArea extends javax.swing.JPanel {
/**
* Creates new form PrimaryCareWorkArea
*/
private JPanel userProcessContainer;
private Business business;
private Network network;
private UserAccount userAccount;
public PrimaryCareWorkArea() {
initComponents();
this.userProcessContainer = AppEntrance.getSlide();
this.business = AppEntrance.getBusiness();
this.userAccount = AppEntrance.getLoginUser();
userAccount.getNetwork();
}
/**
* 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() {
viewInventoryJButton = new javax.swing.JButton();
viewDeviceRequestJButton = new javax.swing.JButton();
browserDeviceJButton = new javax.swing.JButton();
viewOrderJButton = new javax.swing.JButton();
viewInventoryJButton.setText("View Inventory");
viewInventoryJButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
viewInventoryJButtonActionPerformed(evt);
}
});
viewDeviceRequestJButton.setText("View Device Request");
viewDeviceRequestJButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
viewDeviceRequestJButtonActionPerformed(evt);
}
});
browserDeviceJButton.setText("Browser Device");
browserDeviceJButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
browserDeviceJButtonActionPerformed(evt);
}
});
viewOrderJButton.setText("View Order");
viewOrderJButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
viewOrderJButtonActionPerformed(evt);
}
});
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(206, 206, 206)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(browserDeviceJButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(viewDeviceRequestJButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(viewInventoryJButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 207, Short.MAX_VALUE)
.addComponent(viewOrderJButton, javax.swing.GroupLayout.DEFAULT_SIZE, 207, Short.MAX_VALUE))
.addGap(260, 260, 260))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(74, 74, 74)
.addComponent(browserDeviceJButton, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(64, 64, 64)
.addComponent(viewOrderJButton, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(59, 59, 59)
.addComponent(viewInventoryJButton, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(66, 66, 66)
.addComponent(viewDeviceRequestJButton, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(103, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
private void viewInventoryJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_viewInventoryJButtonActionPerformed
// TODO add your handling code here:
ViewInventory viewInventory = new ViewInventory(userProcessContainer, network,business, userAccount);
userProcessContainer.add("View Inventory", viewInventory);
CardLayout layout = (CardLayout)userProcessContainer.getLayout();
layout.next(userProcessContainer);
}//GEN-LAST:event_viewInventoryJButtonActionPerformed
private void viewDeviceRequestJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_viewDeviceRequestJButtonActionPerformed
// TODO add your handling code here:
ViewDeviceRequest viewDeviceRequest = new ViewDeviceRequest(userProcessContainer, business, userAccount);
userProcessContainer.add("View Device Request", viewDeviceRequest);
CardLayout layout = (CardLayout)userProcessContainer.getLayout();
layout.next(userProcessContainer);
}//GEN-LAST:event_viewDeviceRequestJButtonActionPerformed
private void browserDeviceJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browserDeviceJButtonActionPerformed
// TODO add your handling code here:
BrowseDevice browseDevice = new BrowseDevice(userProcessContainer, business.getMasterOrderDirectory(), userAccount, business, network, business);
userProcessContainer.add("Browser Device", browseDevice);
CardLayout layout = (CardLayout)userProcessContainer.getLayout();
layout.next(userProcessContainer);
}//GEN-LAST:event_browserDeviceJButtonActionPerformed
private void viewOrderJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_viewOrderJButtonActionPerformed
// TODO add your handling code here:
ViewOrder viewOrder = new ViewOrder(userProcessContainer, business.getMasterOrderDirectory(), userAccount);
userProcessContainer.add("View Order", viewOrder);
CardLayout layout = (CardLayout)userProcessContainer.getLayout();
layout.next(userProcessContainer);
}//GEN-LAST:event_viewOrderJButtonActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton browserDeviceJButton;
private javax.swing.JButton viewDeviceRequestJButton;
private javax.swing.JButton viewInventoryJButton;
private javax.swing.JButton viewOrderJButton;
// End of variables declaration//GEN-END:variables
}
| [
"li.yue4@husky.neu.edu"
] | li.yue4@husky.neu.edu |
93dbd3e697837e8fe6aa36b533e1d346dd4cecda | c2b1aaf6a9d302b8fef93ab372c9b77bb947643b | /SSMDemo/src/main/java/com/demo/org/service/impl/AccountImpl.java | 02eeb48a448927e11702c132e13776453f1607fc | [] | no_license | Konoha-orz/2014-S7-Java0708 | e437cc3e0d748f168d00597fd0898b2fe0f9e8ac | e2ef18cb3d4d2b66a3ec764c7bf45a0556d7c4c4 | refs/heads/master | 2021-01-04T02:33:32.530516 | 2017-12-30T12:47:18 | 2017-12-30T12:47:18 | 101,141,917 | 0 | 0 | null | 2017-08-23T05:40:03 | 2017-08-23T05:40:03 | null | UTF-8 | Java | false | false | 307 | java | package com.demo.org.service.impl;
import org.springframework.stereotype.Service;
import com.demo.org.service.IAccount;
@Service("accountService")
public class AccountImpl implements IAccount {
@Override
public int getCount() {
// TODO Auto-generated method stub
return 233;
}
}
| [
"517136675@qq.com"
] | 517136675@qq.com |
f6abf534deb823db44ae3d99a402e453fc2fd263 | 24738df005f41c18872034f5117ab7d06439e4f7 | /homework/src/main/java/task1/Time.java | 74a1d6b2642826a5dc3a8754979c4c7d373c2019 | [] | no_license | Andrii-Smit/JavaAdvanced_Lesson-01 | 8e27d55cf78271f3cde97d0b40cb90525a5b2326 | 37ac4c019b765fe09e426f96bc1e895effa976e7 | refs/heads/master | 2023-02-26T09:23:18.013778 | 2021-02-01T18:36:48 | 2021-02-01T18:36:48 | 335,046,693 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,604 | java | package task1;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.Scanner;
public class Time implements Comparable<Time>, Serializable {
private static final long serialVersionUID = 4487194286130673625L;
private int min;
private int hour;
public Time(int hour, int min) throws IllegalTimeFormatException {
if ((hour >= 0 && hour < 24) && (min >= 0 && min < 60)) {
this.setHour(hour);
this.setMin(min);
} else
throw new IllegalTimeFormatException();
}
public int getHour() {
return hour;
}
public void setHour(int hour) {
this.hour = hour;
}
public int getMin() {
return min;
}
public void setMin(int min) {
this.min = min;
}
public String toLiteral() {
if (hour == 0)
return min + " мин.";
else if (min == 0)
return hour + " час. ";
else
return hour + " час. " + min + " мин.";
}
public static Time inputTime() throws IllegalTimeFormatException {
@SuppressWarnings("resource")
Scanner scanner = new Scanner(System.in).useDelimiter("[:,./\\s]");
List<Integer> time = new ArrayList<Integer>(Arrays.asList(null, null));
System.out.print("Введите время (часы/минуты): ");
for (int i = 0; scanner.hasNextInt(); i++) {
if (scanner.hasNextInt())
time.add(i, scanner.nextInt());
}
if (time.size() - 2 < 2)
System.err.println("Время введено некорректно!");
int hour = Optional.ofNullable(time.get(0)).orElse(0);
int min = Optional.ofNullable(time.get(1)).orElse(0);
return new Time(hour, min);
}
public static Time sumTime(Time time1, Time time2) throws IllegalTimeFormatException {
int hour = time1.getHour() + time2.getHour();
int min = time1.getMin() + time2.getMin();
if (min >= 60) {
hour = hour + 1;
min = min - 60;
} else if (hour >= 24) {
hour = hour - 24;
}
return new Time(hour, min);
}
public static Integer timeToMinutes(Time time) {
return time.getHour() * 60 + time.getMin();
}
public static Time minutesToTime(Integer minutes) throws IllegalTimeFormatException {
int hour = minutes / 60;
int min = minutes - hour * 60;
return new Time(hour, min);
}
public static final Time getMinValue() throws IllegalTimeFormatException {
return new Time(0, 0);
}
public static final Time getMaxValue() throws IllegalTimeFormatException {
return new Time(23, 59);
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + hour;
result = prime * result + min;
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Time other = (Time) obj;
if (hour != other.hour)
return false;
if (min != other.min)
return false;
return true;
}
@Override
public String toString() {
return String.format("%2d", hour) + ":" + String.format("%02d", min);
}
@Override
public int compareTo(Time anotherTime) {
return timeToMinutes(this).compareTo(timeToMinutes(anotherTime));
}
}
class IllegalTimeFormatException extends Exception {
private static final long serialVersionUID = 7568427077693695817L;
static final String message = "Input time must be within 0...24 for hours and 0..60 for minutes!";
public IllegalTimeFormatException() {
super(message);
}
}
| [
"lovak_000@Koval"
] | lovak_000@Koval |
3712b2d40cca1d98bc50653b7735a93bd316600e | ec720d2be49f451f9c29c02a4639886c757fe45a | /src/main/java/com/builtbroken/armory/content/sentry/imp/ISentryHost.java | 1ccaa6fcb80426e535ac7b967fe46a9d0de437cc | [] | no_license | notoriousgtw/Armory | 4e60db514d55d84241d5e530d67d4ae476ad5784 | 40a2702b68037c64b9a2319f1b1bd496f99f1091 | refs/heads/master | 2021-01-22T06:19:23.278815 | 2017-05-24T04:57:56 | 2017-05-24T04:57:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 573 | java | package com.builtbroken.armory.content.sentry.imp;
import com.builtbroken.armory.content.sentry.Sentry;
import com.builtbroken.mc.api.IWorldPosition;
import java.util.UUID;
/**
* Applied to objects that host a sentry gun
*
* @see <a href="https://github.com/BuiltBrokenModding/VoltzEngine/blob/development/license.md">License</a> for what you can and can't do with the code.
* Created by Dark(DarkGuardsman, Robert) on 4/11/2017.
*/
public interface ISentryHost extends IWorldPosition
{
Sentry getSentry();
String getOwnerName();
UUID getOwnerID();
}
| [
"rseifert.phone@gmail.com"
] | rseifert.phone@gmail.com |
1dcc999be3034a7f1a324cd182061d1fc4688a02 | 11e3b1a2a710c41329b47bc6b8d214c264071f0d | /src/com/mytest/demoone/HelloWorld.java | 85b5f2c15082843491c181ddc5f6f301afa39bd2 | [
"MIT"
] | permissive | lby2018/github_test | 1aca6d1165c1a36fa2353c272a471723b74aba88 | 959895350b60053c148d7ec87abb3a811657aabb | refs/heads/master | 2022-04-23T04:37:23.292767 | 2020-04-18T01:20:37 | 2020-04-18T01:20:37 | 256,533,586 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 151 | java | package com.mytest.demoone;
public class HelloWorld {
public static void main(String[] args) {
System.out.println("HelloWorld");
}
}
| [
"libaoyu@dhcc.com.cn"
] | libaoyu@dhcc.com.cn |
8a55d3f999239206251e0078d70c50348a04836a | 7251a3b5dd93b9becb1a3a91a5042e6536ac8ef7 | /Zozmom/src/com/zozmom/ui/fragment/UserShowFragment.java | dcf8cb781817df39db2599bef625cc5349d83ada | [] | no_license | CQBOBOZHU/zozmom | 55d69e70938466de9572f692af867641e5fd6d5b | 0ec056f53552bc51100fdfa508dbf0e7567a9f18 | refs/heads/master | 2021-07-07T19:10:14.447940 | 2020-12-08T03:32:14 | 2020-12-08T03:32:14 | 73,664,545 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,573 | java | package com.zozmom.ui.fragment;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.json.JSONArray;
import com.handmark.pulltorefresh.library.PullToRefreshBase;
import com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener2;
import com.handmark.pulltorefresh.library.PullToRefreshScrollView;
import com.handmark.pulltorefresh.library.PullToRefreshBase.Mode;
import com.chasedream.zhumeng.R;
import com.zozmom.constants.Constant;
import com.zozmom.cuview.CuListView;
import com.zozmom.model.ShowModel;
import com.zozmom.net.XHttp;
import com.zozmom.ui.ShowActivity;
import com.zozmom.ui.adapter.ShowListViewAdapter;
import com.zozmom.util.JsonUtil;
import com.zozmom.util.NetWorkUtil;
import com.zozmom.util.RequestErrorUtil;
import com.zozmom.util.ToastUtil;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ScrollView;
import android.widget.AdapterView.OnItemClickListener;
/**
* 别人的晒单列表
*
* @author Administrator
*
*/
public class UserShowFragment extends BaseTaskFragment {
CuListView listView;
PullToRefreshScrollView pullToRefreshScrollView;
View view;
boolean isVisible = false;
int userId;
List<ShowModel> mData = new ArrayList<ShowModel>();
ShowListViewAdapter adapter;
public static final int maxSize = 10;
private int pageNum = 0;
private boolean isFresh = true;// 下拉为true 上拉为false
public UserShowFragment(int userId) {
this.userId = userId;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
Log.v("this", "onCreateView");
view = LayoutInflater.from(getActivity()).inflate(
R.layout.user_show_fragment, container, false);
initView();
return view;
}
public void initView() {
pullToRefreshScrollView = (PullToRefreshScrollView) view
.findViewById(R.id.user_showlist_scrollview);
listView = (CuListView) view.findViewById(R.id.user_showlist_view);
pullToRefreshScrollView.setMode(Mode.PULL_FROM_START);
pullToRefreshScrollView.setOnRefreshListener(listener2);
listView.setSelector(new ColorDrawable(Color.TRANSPARENT));
listView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
Intent intent = new Intent(getActivity(), ShowActivity.class);
ShowModel model = mData.get(position);
intent.putExtra("data", model);
startActivity(intent);
}
});
}
OnRefreshListener2<ScrollView> listener2 = new OnRefreshListener2<ScrollView>() {
@Override
public void onPullDownToRefresh(
PullToRefreshBase<ScrollView> refreshView) {
isFresh = true;
request();
}
@Override
public void onPullUpToRefresh(PullToRefreshBase<ScrollView> refreshView) {
isFresh = false;
request();
}
};
public void request() {
Map<String, Object> map = new HashMap<String, Object>();
if(!NetWorkUtil.isNetworkAvailable(m_activity)){
pullToRefreshScrollView.postDelayed(new Runnable() {
@Override
public void run() {
pullToRefreshScrollView.onRefreshComplete();
}
}, 300);
return;
}
if(!isFresh){
int size=mData.size();
if(size==0){
isFresh=true;
}else{
if(size<pageNum*maxSize){
pullToRefreshScrollView.postDelayed(new Runnable() {
@Override
public void run() {
ToastUtil.show(m_activity, "没有更多数据");
pullToRefreshScrollView.onRefreshComplete();
}
}, 300);
return;
}else{
map.put("shareId", mData.get(size-1).getId());
}
}
}
XHttp.Post(Constant.shareOrderList + "/" + userId, map,
new CommonCallback<JSONArray>() {
@Override
public void onCancelled(CancelledException arg0) {
}
@Override
public void onError(Throwable arg0, boolean arg1) {
pullToRefreshScrollView.onRefreshComplete();
RequestErrorUtil.judge(arg0, m_activity);
}
@Override
public void onFinished() {
}
@Override
public void onSuccess(JSONArray arg0) {
pullToRefreshScrollView.onRefreshComplete();
Log.v("this", arg0.toString());
List<ShowModel> list = JsonUtil.JsonToModel(arg0,
ShowModel.class);
if (list != null && list.size()>0) {
if(isFresh){
pageNum=1;
mData=list;
if(mData.size()>10){
pullToRefreshScrollView.setMode(Mode.BOTH);
}
adapter = new ShowListViewAdapter(m_activity,
mData,listView);
listView.setAdapter(adapter);
}else{
pageNum++;
mData.addAll(list);
adapter.setmDatas(mData);
adapter.notifyDataSetChanged();
}
}
}
});
}
@Override
public void setUserVisibleHint(boolean isVisibleToUser) {
super.setUserVisibleHint(isVisibleToUser);
Log.v("this", "UserVisibleHint" + isVisibleToUser);
if (isVisibleToUser) {
if (mData == null || mData.size() == 0) {
isFresh=true;
request();
}
}
}
}
| [
"347370269@qq.com"
] | 347370269@qq.com |
277372a1e72fbddc67794dae9931ad619689f3a0 | 00386a12c20db70a4817a526dd12df096f8a79b3 | /src/main/java/com/capitalone/dashboard/logging/LoggingFilter.java | 289b7b0315d7977de493380f4b59a7e7c131c9c7 | [
"Apache-2.0"
] | permissive | cschristine/hygieia-whitesource-collector | 478ab566f9e9b420f78ddb95a46dcb9eb20eaae6 | 41a468645c2d87cca066370bed1aa24bf40edce0 | refs/heads/main | 2023-01-21T09:22:16.014760 | 2020-12-03T20:44:04 | 2020-12-03T20:44:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,353 | java | package com.capitalone.dashboard.logging;
import com.capitalone.dashboard.collector.WhiteSourceSettings;
import com.capitalone.dashboard.misc.HygieiaException;
import com.capitalone.dashboard.model.RequestLog;
import com.capitalone.dashboard.repository.RequestLogRepository;
import com.mongodb.util.JSON;
import org.apache.commons.io.output.TeeOutputStream;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
import org.tmatesoft.svn.core.internal.io.dav.http.HTTPStatus;
import javax.activation.MimeType;
import javax.activation.MimeTypeParseException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ReadListener;
import javax.servlet.ServletException;
import javax.servlet.ServletInputStream;
import javax.servlet.ServletOutputStream;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.WriteListener;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Collection;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
@Component
@Order(1)
public class LoggingFilter implements Filter {
private static final Logger LOGGER = Logger.getLogger("LoggingFilter");
private static final String API_USER_KEY = "apiUser";
private static final String UNKNOWN_USER = "unknown";
@Autowired
private RequestLogRepository requestLogRepository;
@Autowired
private WhiteSourceSettings settings;
@Override
public void init(FilterConfig filterConfig) throws ServletException {
}
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
HttpServletRequest httpServletRequest = (HttpServletRequest) request;
HttpServletResponse httpServletResponse = (HttpServletResponse) response;
if (httpServletRequest.getMethod().equals(HttpMethod.PUT.toString()) ||
(httpServletRequest.getMethod().equals(HttpMethod.POST.toString())) ||
(httpServletRequest.getMethod().equals(HttpMethod.DELETE.toString()))) {
Map<String, String> requestMap = this.getTypesafeRequestMap(httpServletRequest);
BufferedRequestWrapper bufferedRequest = new BufferedRequestWrapper(httpServletRequest);
BufferedResponseWrapper bufferedResponse = new BufferedResponseWrapper(httpServletResponse);
String apiUser = bufferedRequest.getHeader(API_USER_KEY);
String endPointURI = httpServletRequest.getRequestURI();
if (settings.checkIgnoreEndPoint(endPointURI) || settings.checkIgnoreApiUser(apiUser)) {
chain.doFilter(bufferedRequest, bufferedResponse);
return;
}
long startTime = System.currentTimeMillis();
RequestLog requestLog = new RequestLog();
requestLog.setClient(httpServletRequest.getRemoteAddr());
requestLog.setEndpoint(httpServletRequest.getRequestURI());
requestLog.setMethod(httpServletRequest.getMethod());
requestLog.setParameter(requestMap.toString());
requestLog.setApiUser(StringUtils.isNotEmpty(apiUser) ? apiUser : UNKNOWN_USER);
requestLog.setRequestSize(httpServletRequest.getContentLengthLong());
requestLog.setRequestContentType(httpServletRequest.getContentType());
try {
chain.doFilter(bufferedRequest, bufferedResponse);
requestLog.setResponseContentType(httpServletResponse.getContentType());
boolean skipBody = settings.checkIgnoreBodyEndPoint(endPointURI);
if ((httpServletRequest.getContentType() != null) && (new MimeType(httpServletRequest.getContentType()).match(new MimeType(APPLICATION_JSON_VALUE)))) {
requestLog.setRequestBody(JSON.parse(bufferedRequest.getRequestBody()));
}
if ((bufferedResponse.getContentType() != null) && (new MimeType(bufferedResponse.getContentType()).match(new MimeType(APPLICATION_JSON_VALUE)))) {
requestLog.setResponseBody( skipBody ? StringUtils.EMPTY : bufferedResponse.getContent());
}
requestLog.setResponseSize(bufferedResponse.getContent().length());
requestLog.setResponseCode(bufferedResponse.getStatus());
} catch (MimeTypeParseException e) {
LOGGER.error("Invalid MIME Type detected. Request MIME type=" + httpServletRequest.getContentType() + ". Response MIME Type=" + bufferedResponse.getContentType());
}catch (Exception e){
LOGGER.error("Internal Error =" + e.getMessage());
requestLog.setResponseBody(ExceptionUtils.getMessage(e));
requestLog.setResponseSize(bufferedResponse.getContent().length());
if(e instanceof HygieiaException){
requestLog.setResponseCode(HttpStatus.BAD_REQUEST.value());
}else{
requestLog.setResponseCode(HttpStatus.INTERNAL_SERVER_ERROR.value());
}
throw e;
}
finally {
long endTime = System.currentTimeMillis();
requestLog.setResponseTime(endTime - startTime);
requestLog.setTimestamp(endTime);
try {
requestLogRepository.save(requestLog);
} catch (RuntimeException re) {
LOGGER.error("Encountered exception while saving request log - " + requestLog.toString(), re);
}
}
} else {
if (settings.isCorsEnabled()) {
String clientOrigin = httpServletRequest.getHeader("Origin");
String corsWhitelist = settings.getCorsWhitelist();
if (!StringUtils.isEmpty(corsWhitelist)) {
List<String> incomingURLs = Arrays.asList(corsWhitelist.trim().split(","));
if (incomingURLs.contains(clientOrigin)) {
//adds headers to response to allow CORS
httpServletResponse.addHeader("Access-Control-Allow-Origin", clientOrigin);
httpServletResponse.addHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE");
httpServletResponse.addHeader("Access-Control-Allow-Headers", "Content-Type");
httpServletResponse.addHeader("Access-Control-Max-Age", "1");
}
}
}
chain.doFilter(httpServletRequest, httpServletResponse);
}
}
private Map<String, String> getTypesafeRequestMap(HttpServletRequest request) {
Map<String, String> typesafeRequestMap = new HashMap<>();
Enumeration<?> requestParamNames = request.getParameterNames();
if (requestParamNames != null) {
while (requestParamNames.hasMoreElements()) {
String requestParamName = (String) requestParamNames.nextElement();
String requestParamValue = request.getParameter(requestParamName);
typesafeRequestMap.put(requestParamName, requestParamValue);
}
}
return typesafeRequestMap;
}
@Override
public void destroy() {
}
private static final class BufferedRequestWrapper extends HttpServletRequestWrapper {
private ByteArrayInputStream bais = null;
private ByteArrayOutputStream baos = null;
private BufferedServletInputStream bsis = null;
private byte[] buffer = null;
public BufferedRequestWrapper(HttpServletRequest req) throws IOException {
super(req);
// Read InputStream and store its content in a buffer.
this.baos = new ByteArrayOutputStream();
byte[] buf = new byte[1024];
int letti;
try (InputStream is = req.getInputStream()) {
while ((letti = is.read(buf)) > 0) {
this.baos.write(buf, 0, letti);
}
}
this.buffer = this.baos.toByteArray();
}
@Override
public ServletInputStream getInputStream() {
this.bais = new ByteArrayInputStream(this.buffer);
this.bsis = new BufferedServletInputStream(this.bais);
return this.bsis;
}
String getRequestBody() throws IOException {
String line;
StringBuilder inputBuffer = new StringBuilder();
try (BufferedReader reader = new BufferedReader(new InputStreamReader(this.getInputStream()))) {
do {
line = reader.readLine();
if (null != line) {
inputBuffer.append(line);
}
} while (line != null);
}
return inputBuffer.toString();
}
}
private static final class BufferedServletInputStream extends ServletInputStream {
private ByteArrayInputStream bais;
public BufferedServletInputStream(ByteArrayInputStream bais) {
this.bais = bais;
}
@Override
public int available() {
return this.bais.available();
}
@Override
public int read() {
return this.bais.read();
}
@Override
public int read(byte[] buf, int off, int len) {
return this.bais.read(buf, off, len);
}
@Override
public boolean isFinished() {
return false;
}
@Override
public boolean isReady() {
return false;
}
@Override
public void setReadListener(ReadListener readListener) {
}
}
public class TeeServletOutputStream extends ServletOutputStream {
private final TeeOutputStream targetStream;
public TeeServletOutputStream(OutputStream one, OutputStream two) {
targetStream = new TeeOutputStream(one, two);
}
@Override
public void write(int arg0) throws IOException {
this.targetStream.write(arg0);
}
public void flush() throws IOException {
super.flush();
this.targetStream.flush();
}
public void close() throws IOException {
super.close();
this.targetStream.close();
}
@Override
public boolean isReady() {
return false;
}
@Override
public void setWriteListener(WriteListener writeListener) {
}
}
public class BufferedResponseWrapper implements HttpServletResponse {
private HttpServletResponse original;
private TeeServletOutputStream teeStream;
private ByteArrayOutputStream bos;
private PrintWriter teeWriter;
public BufferedResponseWrapper(HttpServletResponse response) {
original = response;
}
public String getContent() {
return (bos == null) ? "" : bos.toString();
}
@Override
public PrintWriter getWriter() throws IOException {
if (this.teeWriter == null) {
this.teeWriter = new PrintWriter(new OutputStreamWriter(getOutputStream()));
}
return this.teeWriter;
}
@Override
public ServletOutputStream getOutputStream() throws IOException {
if (BufferedResponseWrapper.this.teeStream == null) {
bos = new ByteArrayOutputStream();
BufferedResponseWrapper.this.teeStream = new TeeServletOutputStream(original.getOutputStream(), bos);
}
return BufferedResponseWrapper.this.teeStream;
}
@Override
public String getCharacterEncoding() {
return original.getCharacterEncoding();
}
@Override
public String getContentType() {
return original.getContentType();
}
@Override
public void setCharacterEncoding(String charset) {
original.setCharacterEncoding(charset);
}
@Override
public void setContentLength(int len) {
original.setContentLength(len);
}
@Override
public void setContentLengthLong(long l) {
}
@Override
public void setContentType(String type) {
original.setContentType(type);
}
@Override
public void setBufferSize(int size) {
original.setBufferSize(size);
}
@Override
public int getBufferSize() {
return original.getBufferSize();
}
@Override
public void flushBuffer() throws IOException {
if (teeStream != null) {
teeStream.flush();
}
if (this.teeWriter != null) {
this.teeWriter.flush();
}
}
@Override
public void resetBuffer() {
original.resetBuffer();
}
@Override
public boolean isCommitted() {
return original.isCommitted();
}
@Override
public void reset() {
original.reset();
}
@Override
public void setLocale(Locale loc) {
original.setLocale(loc);
}
@Override
public Locale getLocale() {
return original.getLocale();
}
@Override
public void addCookie(Cookie cookie) {
if(cookie != null) {
cookie.setSecure(Boolean.TRUE);
original.addCookie(cookie);
}
}
@Override
public boolean containsHeader(String name) {
return original.containsHeader(name);
}
@Override
public String encodeURL(String url) {
return original.encodeURL(url);
}
@Override
public String encodeRedirectURL(String url) {
return original.encodeRedirectURL(url);
}
@SuppressWarnings("deprecation")
@Override
public String encodeUrl(String url) {
return original.encodeUrl(url);
}
@SuppressWarnings("deprecation")
@Override
public String encodeRedirectUrl(String url) {
return original.encodeRedirectUrl(url);
}
@Override
public void sendError(int sc, String msg) throws IOException {
original.sendError(sc, msg);
}
@Override
public void sendError(int sc) throws IOException {
original.sendError(sc);
}
@Override
public void sendRedirect(String location) throws IOException {
original.sendRedirect(location);
}
@Override
public void setDateHeader(String name, long date) {
original.setDateHeader(name, date);
}
@Override
public void addDateHeader(String name, long date) {
original.addDateHeader(name, date);
}
@Override
public void setHeader(String name, String value) {
original.setHeader(name, value);
}
@Override
public void addHeader(String name, String value) {
original.addHeader(name, value);
}
@Override
public void setIntHeader(String name, int value) {
original.setIntHeader(name, value);
}
@Override
public void addIntHeader(String name, int value) {
original.addIntHeader(name, value);
}
@Override
public void setStatus(int sc) {
original.setStatus(sc);
}
@SuppressWarnings("deprecation")
@Override
public void setStatus(int sc, String sm) {
original.setStatus(sc, sm);
}
@Override
public int getStatus() {
return original.getStatus();
}
@Override
public String getHeader(String s) {
return null;
}
@Override
public Collection<String> getHeaders(String s) {
return null;
}
@Override
public Collection<String> getHeaderNames() {
return null;
}
}
}
| [
"nireesh.thiruveedula@capitalone.com"
] | nireesh.thiruveedula@capitalone.com |
4785c5263ed6479209f8c27e32596891ec018e92 | 7ca799689e3d6a77806b17b547b7bbeb6c5c28f5 | /HealthCareSupportSystem/src/UserInterface/ReceptionistRole/PatientListJPanel.java | a58989cc63f8910e8ead8eb8f33dfb744cf0ea13 | [] | no_license | pamnanidipti/HealthCareSupportSystem_IoT | 3abc436ec50ebb52b45ae8691b982a0e7791d0e2 | 0180dae65fd042816723a50feb7dfec07f9973b1 | refs/heads/master | 2021-01-01T06:26:02.414297 | 2017-07-17T02:33:13 | 2017-07-17T02:33:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,329 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package UserInterface.ReceptionistRole;
import Business.Enterprise.Enterprise;
import Business.Organization.Organization;
import static Business.Organization.Organization.Type.Patient;
import Business.Organization.PatientOrganization;
import Business.Patient.Patient;
import Business.Person.Person;
import Business.UserAccount.UserAccount;
import java.awt.CardLayout;
import java.util.ArrayList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.table.DefaultTableModel;
/**
*
* @author Pamnani
*/
public class PatientListJPanel extends javax.swing.JPanel {
private JPanel userProcessContainer;
private PatientOrganization organization;
private Enterprise enterprise;
private UserAccount userAccount;
/**
* Creates new form PatientListJPanel
*/
public PatientListJPanel(JPanel userProcessContainer, UserAccount account, PatientOrganization organization, Enterprise enterprise) {
initComponents();
this.userProcessContainer = userProcessContainer;
this.organization = organization;
this.enterprise = enterprise;
this.userAccount = account;
// System.out.print(enterprise.getOrganizationDirectory().getOrganizationList());
populatePatientTable();
}
public void populatePatientTable()
{
DefaultTableModel model = (DefaultTableModel) patientJTable.getModel();
model.setRowCount(0);
Organization org = null;
Object row[] = new Object[2];
for (Organization organization : enterprise.getOrganizationDirectory().getOrganizationList()) {
/* if(organization instanceof PatientOrganization)
{
org = organization;
break;
}
}
if(org!=null)
{*/
for(Patient patient:organization.getPatientDirectory().getPatientHistory())
{
row[0]=patient;
row[1]=patient.getHealthStatus();
model.addRow(row);
}
}
}
/**
* 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() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
patientJTable = new javax.swing.JTable();
viewDetailsJButton = new javax.swing.JButton();
createPatientJButton = new javax.swing.JButton();
jLabel3 = new javax.swing.JLabel();
searchTxtField = new javax.swing.JTextField();
searchJButton = new javax.swing.JButton();
backJButton = new javax.swing.JButton();
dischargeJButton = new javax.swing.JButton();
readmitJButton = new javax.swing.JButton();
setBackground(new java.awt.Color(255, 255, 255));
setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel1.setFont(new java.awt.Font("Monotype Corsiva", 3, 36)); // NOI18N
jLabel1.setText("Patient List");
add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 11, -1, -1));
jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Resources/Patient-List.png"))); // NOI18N
add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(395, 55, -1, 261));
patientJTable.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"Name", "Status"
}
) {
boolean[] canEdit = new boolean [] {
false, false
};
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
patientJTable.setGridColor(new java.awt.Color(255, 255, 255));
patientJTable.setOpaque(false);
patientJTable.setSelectionBackground(new java.awt.Color(51, 255, 204));
jScrollPane1.setViewportView(patientJTable);
add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 71, 367, 91));
viewDetailsJButton.setFont(new java.awt.Font("Times New Roman", 3, 14)); // NOI18N
viewDetailsJButton.setText("View Details");
viewDetailsJButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
viewDetailsJButtonActionPerformed(evt);
}
});
add(viewDetailsJButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 239, -1, -1));
createPatientJButton.setFont(new java.awt.Font("Times New Roman", 3, 14)); // NOI18N
createPatientJButton.setText("Create Patient Record >>");
createPatientJButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
createPatientJButtonActionPerformed(evt);
}
});
add(createPatientJButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 282, -1, -1));
jLabel3.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
jLabel3.setText("Search Donor by Name:");
add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 186, -1, -1));
add(searchTxtField, new org.netbeans.lib.awtextra.AbsoluteConstraints(154, 183, 112, -1));
searchJButton.setFont(new java.awt.Font("Times New Roman", 3, 14)); // NOI18N
searchJButton.setText("Search");
searchJButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
searchJButtonActionPerformed(evt);
}
});
add(searchJButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(304, 180, -1, -1));
backJButton.setFont(new java.awt.Font("Times New Roman", 3, 14)); // NOI18N
backJButton.setText("<< Back");
backJButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
backJButtonActionPerformed(evt);
}
});
add(backJButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 445, -1, -1));
dischargeJButton.setFont(new java.awt.Font("Times New Roman", 3, 14)); // NOI18N
dischargeJButton.setText("Discharge");
dischargeJButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
dischargeJButtonActionPerformed(evt);
}
});
add(dischargeJButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(286, 239, -1, -1));
readmitJButton.setFont(new java.awt.Font("Times New Roman", 3, 14)); // NOI18N
readmitJButton.setText("Re-admit");
readmitJButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
readmitJButtonActionPerformed(evt);
}
});
add(readmitJButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 240, -1, -1));
}// </editor-fold>//GEN-END:initComponents
private void backJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_backJButtonActionPerformed
// TODO add your handling code here:
userProcessContainer.remove(this);
CardLayout layout= (CardLayout)userProcessContainer.getLayout();
layout.previous(userProcessContainer);
}//GEN-LAST:event_backJButtonActionPerformed
private void createPatientJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_createPatientJButtonActionPerformed
// TODO add your handling code here:
int selectedRow= patientJTable.getSelectedRow();
if (selectedRow < 0) {
JOptionPane.showMessageDialog(this, "Please select a row from table.", "Error", JOptionPane.ERROR_MESSAGE);
return;
}
Patient patient=(Patient)patientJTable.getValueAt(selectedRow, 0);
if(patient.getGender()!=null)
{
JOptionPane.showMessageDialog(this, "Patient details have been entered.Click on View Details to edit.", "Information", JOptionPane.INFORMATION_MESSAGE);
return;
}
CreatePatientJPanel panel = new CreatePatientJPanel(userProcessContainer,patient, enterprise, organization);
userProcessContainer.add("CreatePatient", panel);
CardLayout layout = (CardLayout) userProcessContainer.getLayout();
layout.next(userProcessContainer);
}//GEN-LAST:event_createPatientJButtonActionPerformed
private void viewDetailsJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_viewDetailsJButtonActionPerformed
// TODO add your handling code here:
int selectedRow= patientJTable.getSelectedRow();
if (selectedRow < 0) {
JOptionPane.showMessageDialog(this, "Please select a row from table.", "Error", JOptionPane.ERROR_MESSAGE);
return;
}
Patient patient = (Patient)patientJTable.getValueAt(selectedRow, 0);
ViewPatientDetailsJPanel panel= new ViewPatientDetailsJPanel(userProcessContainer, patient,enterprise.getPatientDirectory(),enterprise);
userProcessContainer.add("ViewPatientDetails", panel);
CardLayout layout=(CardLayout) userProcessContainer.getLayout();
layout.next(userProcessContainer);
}//GEN-LAST:event_viewDetailsJButtonActionPerformed
private void searchJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchJButtonActionPerformed
// TODO add your handling code here:
String key= searchTxtField.getText().trim();
DefaultTableModel model = (DefaultTableModel) patientJTable.getModel();
model.setRowCount(0);
Object row[] = new Object[1];
if(key.length()==0)
{
JOptionPane.showMessageDialog(this, "Please enter key.", "Error", JOptionPane.ERROR_MESSAGE);
populatePatientTable();
return;
}
//ArrayList<Patient> searchPatients;
for (Organization organization : enterprise.getOrganizationDirectory().getOrganizationList()) {
for(Patient patient:organization.getPatientDirectory().getPatientHistory())
{
if(!patient.getPersonName().equals(key))
{
JOptionPane.showMessageDialog(this, "No such patient found. Please add Patient", "Warning", JOptionPane.INFORMATION_MESSAGE);
searchTxtField.setText("");
populatePatientTable();
return;
}
if(patient.getPersonName().equals(key))
{
row[0]=patient;
((DefaultTableModel) patientJTable.getModel()).addRow(row);
searchTxtField.setText("");
return;
}
}
}
}//GEN-LAST:event_searchJButtonActionPerformed
private void dischargeJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dischargeJButtonActionPerformed
// TODO add your handling code here:
int selectedRow= patientJTable.getSelectedRow();
if (selectedRow < 0) {
JOptionPane.showMessageDialog(this, "Please select a row from table", "Error", JOptionPane.ERROR_MESSAGE);
return;
}
Patient patient = (Patient)patientJTable.getValueAt(selectedRow, 0);
if(patient.getHealthStatus().equalsIgnoreCase("Admitted"))
{
JOptionPane.showMessageDialog(this, "Patient Health is not Normal yet.Cannot be Discharged", "Error", JOptionPane.ERROR_MESSAGE);
return;
}
readmitJButton.setEnabled(true);
patient.setHealthStatus("Discharged");
populatePatientTable();
}//GEN-LAST:event_dischargeJButtonActionPerformed
private void readmitJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_readmitJButtonActionPerformed
// TODO add your handling code here:
int selectedRow= patientJTable.getSelectedRow();
if (selectedRow < 0) {
JOptionPane.showMessageDialog(this, "Please select a row from table", "Error", JOptionPane.ERROR_MESSAGE);
return;
}
Patient patient = (Patient)patientJTable.getValueAt(selectedRow, 0);
if(!patient.getHealthStatus().equalsIgnoreCase("Discharged"))
{
JOptionPane.showMessageDialog(this, "Patient is already admitted", "Error", JOptionPane.ERROR_MESSAGE);
return;
}
if(patient.getHealthStatus().equalsIgnoreCase("Discharged"))
{
patient.setHealthStatus("Admitted");
populatePatientTable();
}
}//GEN-LAST:event_readmitJButtonActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton backJButton;
private javax.swing.JButton createPatientJButton;
private javax.swing.JButton dischargeJButton;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable patientJTable;
private javax.swing.JButton readmitJButton;
private javax.swing.JButton searchJButton;
private javax.swing.JTextField searchTxtField;
private javax.swing.JButton viewDetailsJButton;
// End of variables declaration//GEN-END:variables
}
| [
"pamnanidipti@gmail.com"
] | pamnanidipti@gmail.com |
14990478f24e117e4e679ccc1bc81ab89bb272ba | a0caa255f3dbe524437715adaee2094ac8eff9df | /HOLD/sources/defpackage/cjo.java | c1289153ecd8217ec38f6ba623a18759ea3079c0 | [] | no_license | AndroidTVDeveloper/com.google.android.tvlauncher | 16526208b5b48fd48931b09ed702fe606fe7d694 | 0f959c41bbb5a93e981145f371afdec2b3e207bc | refs/heads/master | 2021-01-26T07:47:23.091351 | 2020-02-26T20:58:19 | 2020-02-26T20:58:19 | 243,363,961 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 694 | java | package defpackage;
import android.database.ContentObserver;
import android.net.Uri;
import android.os.Handler;
import com.google.android.tvlauncher.clock.ClockView;
/* renamed from: cjo reason: default package */
/* compiled from: PG */
public final class cjo extends ContentObserver {
private final /* synthetic */ ClockView a;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public cjo(ClockView clockView, Handler handler) {
super(handler);
this.a = clockView;
}
public final void onChange(boolean z) {
this.a.a();
}
public final void onChange(boolean z, Uri uri) {
this.a.a();
}
}
| [
"eliminater74@gmail.com"
] | eliminater74@gmail.com |
c5d23095b2554ab72897d63a9ea00a58ae515922 | cc1fd66f11ebf534750694e029f792068fb0571c | /src/main/java/org/codebite/springmediamanager/rest/MediaController.java | 293fbfb8ffdecd51889b96132575ce468a48bf38 | [] | no_license | glromeo/spring-media-manager | 37380fe59f48e26a1584ed6cb665a93ce76daea7 | d00c67b2557bc6fb93ac3a47f8f7ae8529ca6db6 | refs/heads/master | 2022-09-19T12:17:34.919142 | 2022-02-14T13:05:32 | 2022-02-14T13:05:32 | 166,548,016 | 0 | 0 | null | 2022-09-01T23:05:57 | 2019-01-19T13:10:50 | Java | UTF-8 | Java | false | false | 3,554 | java | package org.codebite.springmediamanager.rest;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.codebite.springmediamanager.data.Media;
import org.codebite.springmediamanager.data.SearchResultsPage;
import org.codebite.springmediamanager.data.mongodb.MediaRepository;
import org.codebite.springmediamanager.data.tmdb.MovieService;
import org.codebite.springmediamanager.media.DownloadService;
import org.codebite.springmediamanager.media.MediaService;
import org.codebite.springmediamanager.media.PosterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
@Controller
@Slf4j
public class MediaController {
@Autowired
MediaRepository mediaRepository;
@GetMapping("/media")
@ResponseBody
public List<Media> listAll() {
return mediaRepository.findAll();
}
@GetMapping("/media/{id}")
@ResponseBody
public Media getMedia(@PathVariable Long id) {
List<Media> list = mediaRepository.findByMovie_Id(id);
return list.isEmpty() ? null : list.get(0);
}
@PutMapping("/media/{id}")
public void putMedia(@PathVariable Long id, @RequestBody Media media) {
mediaService.save(media, id);
mediaRepository.save(media);
}
@Autowired
MediaService mediaService;
@PostMapping(value = "/discover/media")
public void discover(@RequestParam String path) throws IOException {
try (DirectoryStream<Path> paths = Files.newDirectoryStream(Paths.get(path))) {
mediaService.discover(paths).forEach(mediaRepository::save);
}
}
@PostMapping(value = "/refresh/media")
public void refresh(@RequestParam String path) throws IOException {
try (DirectoryStream<Path> paths = Files.newDirectoryStream(Paths.get(path))) {
mediaService.refresh(paths);
}
}
@Autowired
PosterService posterService;
@PostMapping(value = "/populate/media/color")
public void populateMediaColor() throws IOException {
posterService.populateMediaColor();
}
@Autowired
MovieService movieService;
@Autowired
private ObjectMapper objectMapper;
@GetMapping("/search/multi")
@ResponseBody
public SearchResultsPage searchMulti(@RequestParam String query) {
return movieService.multiSearch(query);
}
@Autowired
private DownloadService downloadService;
private enum DownloadActions {
START,
STOP,
DELETE
}
@PostMapping(value = "/download/magnet", consumes = "text/plain")
@ResponseStatus(code = HttpStatus.OK)
public void download(@RequestBody String magnetUri,
@RequestParam(required = true) String action,
@RequestParam(required = false, defaultValue = "false") boolean keepSeeding) {
switch (DownloadActions.valueOf(action.toUpperCase())) {
case START:
downloadService.downloadTorrent(magnetUri, keepSeeding);
return;
case STOP:
downloadService.stopTorrent(magnetUri);
return;
case DELETE:
downloadService.deleteTorrent(magnetUri);
}
}
}
| [
"glromeo@gmail.com"
] | glromeo@gmail.com |
7bff6f8ec78531834252d5c6b185f933135ad506 | 8699b6842091823d72a4cc27e57a3b078e93bbf3 | /Week_5/Optional/src/Catalog.java | a0318809f3147045b0bc5668e063486dd305792a | [] | no_license | Cr34TIVv3/ProgramareAvansata | cbcf269b0ebb2acf808c168ee51f9388cc043020 | 26312a7bf9f3039855fd6c477d7e3a22807317e1 | refs/heads/main | 2023-04-29T10:35:11.598345 | 2021-05-23T18:33:13 | 2021-05-23T18:33:13 | 338,872,294 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 635 | java | import java.util.ArrayList;
import java.util.List;
public class Catalog implements java.io.Serializable{
List<Item> itemList;
public Catalog () {
itemList = new ArrayList<>();
}
public void add(Item entry) {
itemList.add(entry);
}
public List<Item> getItemList() {
return itemList;
}
public void setItemList(List<Item> itemList) {
this.itemList = itemList;
}
public void makeCopy(Catalog original) {
this.itemList = original.itemList;
}
public void list() {
for(var item : itemList) {
item.describe();
}
}
}
| [
"rafael.burck1@gmail.com"
] | rafael.burck1@gmail.com |
3e641a2d3bb09293ac078ecf42b96296e3b89cc1 | 88b63a879ebfa112d6d10bb648428f609b050852 | /src/gui/Notepad.java | 10cef73418b4e213154fb06c36f484eb26264d56 | [] | no_license | Nancy2018319/MyNoteBook | 962bcf2d689c6f5ff774f03e679240404bd312db | 34869fa0fe57d4f316bfb8a82d9f9c447c4e84af | refs/heads/master | 2020-03-28T11:43:10.317228 | 2018-09-11T01:28:51 | 2018-09-11T01:28:51 | 148,241,187 | 2 | 0 | null | null | null | null | GB18030 | Java | false | false | 24,080 | java | package gui;
import java.awt.*;
import java.awt.event.*;
import java.text.*;
import java.util.*;
import java.io.*;
import java.net.URISyntaxException;
import javax.swing.undo.*;
import javax.swing.border.*;
import javax.swing.*;
import javax.swing.text.*;
import javax.swing.event.*;
import java.awt.datatransfer.*;
/**
* 需求:模仿Window自带的记事本,实现90%以上功能的类似记事本,记事本界面从总体布局上 分为菜单栏、工具栏、文本编辑区和状态栏。
* 分析:
* 1、Notepad类继承了JFrame,ActionListener, DocumentListener类,用于创建图形化界面。
* 2、由最小的组件开始创建,逐渐添加到他的上一级组件中,最终拼成一个完整的界面。
* 步骤:
* 1、引入需要用到的类。
* 2、在main()中创建Notepad的对象,调用其构造函数,对其进行初始化。
* 3、JMenuBar创建菜单栏,JMenu和JMenuItem创建其下拉菜单项,并将菜单项添加到JMenuBar中。
* 4、JToolBar创建工具栏。
* 5、JTextArea创建文本编辑区,实现监听功能,并实现右键弹出菜单功能。
* 6、JLabel创建状态栏,实现编辑状态的可视化。
* 7、将这些组件放入容器Container中,组成完整的界面。
* 8、定义监听器,实现菜单栏、工具栏及文本编辑区执行相应操作时触发的事件。
* 9、定义方法,实现监听器事件的处理方法。
*
* @author Nancy
* @version 1.0
* @since jdk1.8
*/
public class Notepad extends JFrame implements ActionListener, DocumentListener {
// 菜单
JMenu fileMenu, editMenu, formatMenu, viewMenu, helpMenu;
// 右键弹出菜单项
JPopupMenu popupMenu;
JMenuItem popupMenu_Undo, popupMenu_Cut, popupMenu_Copy, popupMenu_Paste, popupMenu_Delete, popupMenu_SelectAll;
// “文件”的菜单项
JMenuItem fileMenu_New, fileMenu_Open, fileMenu_Save, fileMenu_SaveAs, fileMenu_Exit;
// “编辑”的菜单项
JMenuItem editMenu_Undo, editMenu_Cut, editMenu_Copy, editMenu_Paste, editMenu_Delete, editMenu_Find,
editMenu_Replace, editMenu_GoTo, editMenu_SelectAll, editMenu_TimeDate;
// “格式”的菜单项
JCheckBoxMenuItem formatMenu_LineWrap;
JMenuItem formatMenu_Font;
JMenuItem formatMenu_Color;
// “查看”的菜单项
JCheckBoxMenuItem viewMenu_Status, viewMenu_ToolBar;
// "工具栏"按钮
JButton newButton, openButton, saveButton, copyButton, cutButton, pasteButton;
JPanel toolBar;
// “帮助”的菜单项
JMenuItem helpMenu_HelpTopics, helpMenu_AboutNotepad;
// “文本”编辑区域
JTextArea editArea;
// 状态栏标签
JLabel statusLabel;
// JToolBar statusBar;
// 系统剪贴板
Toolkit toolkit = Toolkit.getDefaultToolkit();
Clipboard clipBoard = toolkit.getSystemClipboard();
// 创建撤销操作管理器(与撤销操作有关)
protected UndoManager undo = new UndoManager();
protected UndoableEditListener undoHandler = new UndoHandler();
// 其他变量
String oldValue;// 存放编辑区原来的内容,用于比较文本是否有改动
boolean isNewFile = true;// 是否新文件(未保存过的)
File currentFile;// 当前文件名
// 无参构造函数开始
public Notepad() {
super("无标题 - 记事本");
// 改变系统默认字体
Font font = new Font("Dialog", Font.PLAIN, 12);
java.util.Enumeration keys = UIManager.getDefaults().keys();
while (keys.hasMoreElements()) {
Object key = keys.nextElement();
Object value = UIManager.get(key);
if (value instanceof javax.swing.plaf.FontUIResource) {
UIManager.put(key, font);
}
}
// ----------------------------设置图标
Icon newIcon = new ImageIcon("src/gui/resource/new.gif");
Icon openIcon = new ImageIcon("src/gui/resource/open.gif");
Icon saveIcon = new ImageIcon("src/gui/resource/save.gif");
Icon copyIcon = new ImageIcon("src/gui/resource/copy.gif");
Icon cutIcon = new ImageIcon("src/gui/resource/cut.gif");
Icon pasteIcon = new ImageIcon("src/gui/resource/paste.gif");
// ----------------------------创建菜单条
JMenuBar menuBar = new JMenuBar();
// ----------------------------创建文件菜单及菜单项并注册事件监听
fileMenu = new JMenu("文件(F)");
fileMenu.setMnemonic('F');// 设置快捷键ALT+F
fileMenu_New = new JMenuItem("新建(N)", newIcon);
fileMenu_New.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, InputEvent.CTRL_MASK));
fileMenu_New.addActionListener(this);
fileMenu_Open = new JMenuItem("打开(O)...", openIcon);
fileMenu_Open.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_MASK));
fileMenu_Open.addActionListener(this);
fileMenu_Save = new JMenuItem("保存(S)", saveIcon);
fileMenu_Save.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_MASK));
fileMenu_Save.addActionListener(this);
fileMenu_SaveAs = new JMenuItem("另存为(A)...");
fileMenu_SaveAs.addActionListener(this);
fileMenu_Exit = new JMenuItem("退出(X)");
fileMenu_Exit.addActionListener(this);
// ----------------------------创建编辑菜单及菜单项并注册事件监听
editMenu = new JMenu("编辑(E)");
editMenu.setMnemonic('E');// 设置快捷键ALT+E
// 当选择编辑菜单时,设置剪切、复制、粘贴、删除等功能的可用性
editMenu.addMenuListener(new MenuListener() {
public void menuCanceled(MenuEvent e)// 取消菜单时调用
{
checkMenuItemEnabled();// 设置剪切、复制、粘贴、删除等功能的可用性
}
public void menuDeselected(MenuEvent e)// 取消选择某个菜单时调用
{
checkMenuItemEnabled();// 设置剪切、复制、粘贴、删除等功能的可用性
}
public void menuSelected(MenuEvent e)// 选择某个菜单时调用
{
checkMenuItemEnabled();// 设置剪切、复制、粘贴、删除等功能的可用性
}
});
editMenu_Undo = new JMenuItem("撤销(U)");
editMenu_Undo.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Z, InputEvent.CTRL_MASK));
editMenu_Undo.addActionListener(this);
editMenu_Undo.setEnabled(false);
editMenu_Cut = new JMenuItem("剪切(T)", cutIcon);
editMenu_Cut.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_MASK));
editMenu_Cut.addActionListener(this);
editMenu_Copy = new JMenuItem("复制(C)", copyIcon);
editMenu_Copy.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK));
editMenu_Copy.addActionListener(this);
editMenu_Paste = new JMenuItem("粘贴(P)", pasteIcon);
editMenu_Paste.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_MASK));
editMenu_Paste.addActionListener(this);
editMenu_Delete = new JMenuItem("删除(D)");
editMenu_Delete.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0));
editMenu_Delete.addActionListener(this);
editMenu_Find = new JMenuItem("查找(F)...");
editMenu_Find.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F, InputEvent.CTRL_MASK));
editMenu_Find.addActionListener(this);
editMenu_Replace = new JMenuItem("替换(R)...", 'R');
editMenu_Replace.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_H, InputEvent.CTRL_MASK));
editMenu_Replace.addActionListener(this);
editMenu_GoTo = new JMenuItem("转到(G)...", 'G');
editMenu_GoTo.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_G, InputEvent.CTRL_MASK));
editMenu_GoTo.addActionListener(this);
editMenu_SelectAll = new JMenuItem("全选", 'A');
editMenu_SelectAll.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, InputEvent.CTRL_MASK));
editMenu_SelectAll.addActionListener(this);
editMenu_TimeDate = new JMenuItem("时间/日期(D)", 'D');
editMenu_TimeDate.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0));
editMenu_TimeDate.addActionListener(this);
// ----------------------------创建格式菜单及菜单项并注册事件监听
formatMenu = new JMenu("格式(O)");
formatMenu.setMnemonic('O');// 设置快捷键ALT+O
formatMenu_LineWrap = new JCheckBoxMenuItem("自动换行(W)");
formatMenu_LineWrap.setMnemonic('W');// 设置快捷键ALT+W
formatMenu_LineWrap.setState(true);
formatMenu_LineWrap.addActionListener(this);
formatMenu_Font = new JMenuItem("字体(F)...");
formatMenu_Font.addActionListener(this);
formatMenu_Color = new JMenuItem("颜色(C)...");
formatMenu_Color.addActionListener(this);
// ----------------------------创建查看菜单及菜单项并注册事件监听
viewMenu = new JMenu("查看(V)");
viewMenu.setMnemonic('V');// 设置快捷键ALT+V
viewMenu_Status = new JCheckBoxMenuItem("状态栏(S)");
viewMenu_Status.setMnemonic('S');// 设置快捷键ALT+S
viewMenu_Status.setState(true);
viewMenu_Status.addActionListener(this);
viewMenu_ToolBar = new JCheckBoxMenuItem("工具栏(T)");
viewMenu_ToolBar.setMnemonic('T');// 设置快捷键ALT+S
viewMenu_ToolBar.setState(true);
viewMenu_ToolBar.addActionListener(this);
// ----------------------------创建帮助菜单及菜单项并注册事件监听
helpMenu = new JMenu("帮助(H)");
helpMenu.setMnemonic('H');// 设置快捷键ALT+H
helpMenu_HelpTopics = new JMenuItem("帮助主题(H)");
helpMenu_HelpTopics.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));
helpMenu_HelpTopics.addActionListener(this);
helpMenu_AboutNotepad = new JMenuItem("关于记事本(A)");
helpMenu_AboutNotepad.addActionListener(this);
// 向菜单条添加"文件"菜单及菜单项
menuBar.add(fileMenu);
fileMenu.add(fileMenu_New);
fileMenu.add(fileMenu_Open);
fileMenu.add(fileMenu_Save);
fileMenu.add(fileMenu_SaveAs);
fileMenu.addSeparator(); // 分隔线
fileMenu.add(fileMenu_Exit);
// 向菜单条添加"编辑"菜单及菜单项
menuBar.add(editMenu);
editMenu.add(editMenu_Undo);
editMenu.addSeparator(); // 分隔线
editMenu.add(editMenu_Cut);
editMenu.add(editMenu_Copy);
editMenu.add(editMenu_Paste);
editMenu.add(editMenu_Delete);
editMenu.addSeparator(); // 分隔线
editMenu.add(editMenu_Find);
editMenu.add(editMenu_Replace);
editMenu.add(editMenu_GoTo);
editMenu.addSeparator(); // 分隔线
editMenu.add(editMenu_SelectAll);
editMenu.add(editMenu_TimeDate);
// 向菜单条添加"格式"菜单及菜单项
menuBar.add(formatMenu);
formatMenu.add(formatMenu_LineWrap);
formatMenu.add(formatMenu_Font);
formatMenu.add(formatMenu_Color);
// 向菜单条添加"查看"菜单及菜单项
menuBar.add(viewMenu);
viewMenu.add(viewMenu_Status);
viewMenu.add(viewMenu_ToolBar);
// 向菜单条添加"帮助"菜单及菜单项
menuBar.add(helpMenu);
helpMenu.add(helpMenu_HelpTopics);
helpMenu.addSeparator();
helpMenu.add(helpMenu_AboutNotepad);
// 向窗口添加菜单条
this.setJMenuBar(menuBar);
// ----------------------------创建文本编辑区并添加滚动条
editArea = new JTextArea(20, 50);
JScrollPane scroller = new JScrollPane(editArea);
scroller.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
scroller.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
this.add(scroller, BorderLayout.CENTER);// 向窗口添加文本编辑区
editArea.setWrapStyleWord(true);// 设置单词在一行不足容纳时换行
editArea.setLineWrap(true);// 设置文本编辑区自动换行默认为true,即会"自动换行"
oldValue = editArea.getText();// 获取原文本编辑区的内容
// 编辑区注册事件监听(与撤销操作有关)
editArea.getDocument().addUndoableEditListener(undoHandler);
editArea.getDocument().addDocumentListener(this);
// 创建右键弹出菜单
popupMenu = new JPopupMenu();
popupMenu_Undo = new JMenuItem("撤销(U)");
popupMenu_Cut = new JMenuItem("剪切(T)");
popupMenu_Copy = new JMenuItem("复制(C)");
popupMenu_Paste = new JMenuItem("粘帖(P)");
popupMenu_Delete = new JMenuItem("删除(D)");
popupMenu_SelectAll = new JMenuItem("全选(A)");
popupMenu_Undo.setEnabled(false);
// 向右键菜单添加菜单项和分隔符
popupMenu.add(popupMenu_Undo);
popupMenu.addSeparator();
popupMenu.add(popupMenu_Cut);
popupMenu.add(popupMenu_Copy);
popupMenu.add(popupMenu_Paste);
popupMenu.add(popupMenu_Delete);
popupMenu.addSeparator();
popupMenu.add(popupMenu_SelectAll);
// 文本编辑区注册右键菜单事件
popupMenu_Undo.addActionListener(this);
popupMenu_Cut.addActionListener(this);
popupMenu_Copy.addActionListener(this);
popupMenu_Paste.addActionListener(this);
popupMenu_Delete.addActionListener(this);
popupMenu_SelectAll.addActionListener(this);
// 文本编辑区注册右键菜单事件
editArea.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
if (e.isPopupTrigger())// 返回此鼠标事件是否为该平台的弹出菜单触发事件
{
popupMenu.show(e.getComponent(), e.getX(), e.getY());// 在组件调用者的坐标空间中的位置X、Y
}
checkMenuItemEnabled();// 设置剪切,复制,粘帖,删除等功能的可用性
editArea.requestFocus();// 编辑区获取焦点
}
public void mouseReleased(MouseEvent e) {
if (e.isPopupTrigger())// 返回此鼠标事件是否为该平台的弹出菜单触发事件
{
popupMenu.show(e.getComponent(), e.getX(), e.getY());// 在组件调用者的坐标空间中的位置X、Y
}
checkMenuItemEnabled();// 设置剪切,复制,粘帖,删除等功能的可用性
editArea.requestFocus();// 编辑区获取焦点
}
});// 文本编辑区注册右键菜单事件结束
// ----------------------------创建工具栏
toolBar = new JPanel();
toolBar.setLayout(new FlowLayout(FlowLayout.LEFT));
newButton = new JButton(newIcon);
openButton = new JButton(openIcon);
saveButton = new JButton(saveIcon);
copyButton = new JButton(copyIcon);
copyButton.setEnabled(false);
cutButton = new JButton(cutIcon);
cutButton.setEnabled(false);
pasteButton = new JButton(pasteIcon);
pasteButton.setEnabled(false);
newButton.setPreferredSize(new Dimension(26, 22));
openButton.setPreferredSize(new Dimension(26, 22));
saveButton.setPreferredSize(new Dimension(26, 22));
copyButton.setPreferredSize(new Dimension(26, 22));
cutButton.setPreferredSize(new Dimension(26, 22));
pasteButton.setPreferredSize(new Dimension(26, 22));
// 注册工具栏按钮事件
newButton.addActionListener(this);
openButton.addActionListener(this);
saveButton.addActionListener(this);
copyButton.addActionListener(this);
cutButton.addActionListener(this);
pasteButton.addActionListener(this);
// 向工具栏添加按钮
toolBar.add(newButton);
toolBar.add(openButton);
toolBar.add(saveButton);
toolBar.add(copyButton);
toolBar.add(cutButton);
toolBar.add(pasteButton);
// 向容器添加工具栏
this.add(toolBar, BorderLayout.NORTH);
// -----------------------------------创建和添加状态栏
statusLabel = new JLabel("状态栏");
this.add(statusLabel, BorderLayout.SOUTH);// 向窗口添加状态栏标签
// 改变标题栏窗口左侧默认图标
Toolkit tk = Toolkit.getDefaultToolkit();
Image image = tk.createImage("src/gui/resource/logo.png");
this.setIconImage(image);
// 设置窗口在屏幕上的位置、大小和可见性
this.setLocation(100, 100);
this.setSize(650, 550);
this.setVisible(true);
// 添加窗口监听器
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
QuitMethod quitmethod = new QuitMethod();
quitmethod.exitWindowChoose(editArea, oldValue, currentFile, isNewFile, statusLabel);
}
});
checkMenuItemEnabled();
editArea.requestFocus();
}// 构造方法结束
/**
* 设置菜单项的可用性:剪切,复制,粘帖,删除功能
*/
public void checkMenuItemEnabled() {
String selectText = editArea.getSelectedText();
if (selectText == null) {
editMenu_Cut.setEnabled(false);
popupMenu_Cut.setEnabled(false);
editMenu_Copy.setEnabled(false);
popupMenu_Copy.setEnabled(false);
editMenu_Delete.setEnabled(false);
popupMenu_Delete.setEnabled(false);
cutButton.setEnabled(false);
copyButton.setEnabled(false);
} else {
editMenu_Cut.setEnabled(true);
popupMenu_Cut.setEnabled(true);
editMenu_Copy.setEnabled(true);
popupMenu_Copy.setEnabled(true);
editMenu_Delete.setEnabled(true);
popupMenu_Delete.setEnabled(true);
cutButton.setEnabled(true);
copyButton.setEnabled(true);
}
// 粘帖功能可用性判断
Transferable contents = clipBoard.getContents(this);
if (contents == null) {
editMenu_Paste.setEnabled(false);
popupMenu_Paste.setEnabled(false);
pasteButton.setEnabled(false);
} else {
editMenu_Paste.setEnabled(true);
popupMenu_Paste.setEnabled(true);
pasteButton.setEnabled(true);
}
}
/**
* 所有按钮的事件处理
*/
public void actionPerformed(ActionEvent e) {
// 新建
if (e.getSource() == fileMenu_New || e.getSource() == newButton) {
OpenMethod openmethod = new OpenMethod();
openmethod.openNewFile(editArea, oldValue, currentFile, isNewFile, statusLabel, undo, editMenu_Undo);
} // 新建结束
// 打开
else if (e.getSource() == fileMenu_Open || e.getSource() == openButton) {
OpenMethod openmethod = new OpenMethod();
openmethod.openFile(editArea, oldValue, currentFile, isNewFile, statusLabel);
} // 打开结束
// 保存
else if (e.getSource() == fileMenu_Save || e.getSource() == saveButton) {
editArea.requestFocus();
SaveMethod savemethod = new SaveMethod();
savemethod.Save(editArea, oldValue, currentFile, isNewFile, statusLabel);
} // 保存结束
// 另存为
else if (e.getSource() == fileMenu_SaveAs) {
SaveMethod savemethod = new SaveMethod();
savemethod.SaveAs(editArea, oldValue, currentFile, statusLabel);
} // 另存为结束
// 退出
else if (e.getSource() == fileMenu_Exit) {
int exitChoose = JOptionPane.showConfirmDialog(this, "确定要退出吗?", "退出提示", JOptionPane.OK_CANCEL_OPTION);
if (exitChoose == JOptionPane.OK_OPTION) {
System.exit(0);
} else {
return;
}
} // 退出结束
// 撤销
else if (e.getSource() == editMenu_Undo || e.getSource() == popupMenu_Undo) {
editArea.requestFocus();
if (undo.canUndo()) {
try {
undo.undo();
} catch (CannotUndoException ex) {
System.out.println("Unable to undo:" + ex);
}
}
if (!undo.canUndo()) {
editMenu_Undo.setEnabled(false);
}
} // 撤销结束
// 剪切
else if (e.getSource() == editMenu_Cut || e.getSource() == popupMenu_Cut || e.getSource() == cutButton) {
editArea.requestFocus();
String text = editArea.getSelectedText();
StringSelection selection = new StringSelection(text);
clipBoard.setContents(selection, null);
editArea.replaceRange("", editArea.getSelectionStart(), editArea.getSelectionEnd());
checkMenuItemEnabled();// 设置剪切,复制,粘帖,删除功能的可用性
} // 剪切结束
// 复制
else if (e.getSource() == editMenu_Copy || e.getSource() == popupMenu_Copy || e.getSource() == copyButton) {
editArea.requestFocus();
String text = editArea.getSelectedText();
StringSelection selection = new StringSelection(text);
clipBoard.setContents(selection, null);
checkMenuItemEnabled();// 设置剪切,复制,粘帖,删除功能的可用性
} // 复制结束
// 粘帖
else if (e.getSource() == editMenu_Paste || e.getSource() == popupMenu_Paste || e.getSource() == pasteButton) {
editArea.requestFocus();
Transferable contents = clipBoard.getContents(this);
if (contents == null)
return;
String text = "";
try {
text = (String) contents.getTransferData(DataFlavor.stringFlavor);
} catch (Exception exception) {
}
editArea.replaceRange(text, editArea.getSelectionStart(), editArea.getSelectionEnd());
checkMenuItemEnabled();
} // 粘帖结束
// 删除
else if (e.getSource() == editMenu_Delete || e.getSource() == popupMenu_Delete) {
editArea.requestFocus();
editArea.replaceRange("", editArea.getSelectionStart(), editArea.getSelectionEnd());
checkMenuItemEnabled(); // 设置剪切、复制、粘贴、删除等功能的可用性
} // 删除结束
// 查找
else if (e.getSource() == editMenu_Find) {
editArea.requestFocus();
findDialog f = new findDialog();
f.find(editArea);
} // 查找结束
// 替换
else if (e.getSource() == editMenu_Replace) {
editArea.requestFocus();
replaceDialog r = new replaceDialog();
r.replace(editArea);
} // 替换结束
// 转到
else if (e.getSource() == editMenu_GoTo) {
Go_toDialog go_to = new Go_toDialog();
go_to.Go_toMethod(editArea);
} // 转到结束
// 时间日期
else if (e.getSource() == editMenu_TimeDate) {
editArea.requestFocus();
Calendar rightNow = Calendar.getInstance();
Date date = rightNow.getTime();
editArea.insert(date.toString(), editArea.getCaretPosition());
} // 时间日期结束
// 全选
else if (e.getSource() == editMenu_SelectAll || e.getSource() == popupMenu_SelectAll) {
editArea.selectAll();
} // 全选结束
// 自动换行(已在前面设置)
else if (e.getSource() == formatMenu_LineWrap) {
if (formatMenu_LineWrap.getState()) {
editArea.setLineWrap(true);
viewMenu_Status.setState(false);
statusLabel.setVisible(false);
} else
editArea.setLineWrap(false);
} // 自动换行结束
// 字体设置
else if (e.getSource() == formatMenu_Font) {
editArea.requestFocus();
fontDialog fon = new fontDialog();
fon.font(editArea);
} // 字体设置结束
// 颜色设置
else if (e.getSource() == formatMenu_Color) {
editArea.requestFocus();
Color color = JColorChooser.showDialog(this, "更改字体颜色", Color.black);
if (color != null) {
editArea.setForeground(color);
} else
return;
} // 颜色设置结束
// 设置状态栏可见性
else if (e.getSource() == viewMenu_Status) {
if (viewMenu_Status.getState())
statusLabel.setVisible(true);
else
statusLabel.setVisible(false);
} // 设置状态栏可见性结束
// 设置工具栏可见性
else if (e.getSource() == viewMenu_ToolBar) {
if (viewMenu_ToolBar.getState())
toolBar.setVisible(true);
else
toolBar.setVisible(false);
} // 设置工具栏可见性结束
// 帮助主题
else if (e.getSource() == helpMenu_HelpTopics) {
editArea.requestFocus();
JOptionPane.showMessageDialog(this, "路漫漫其修远兮,吾将上下而求索。", "帮助主题", JOptionPane.INFORMATION_MESSAGE);
} // 帮助主题结束
// 关于
else if (e.getSource() == helpMenu_AboutNotepad) {
editArea.requestFocus();
JOptionPane.showMessageDialog(this, "&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&\n" + " 编写者:Nancy \n"
+ " 编写时间:2018-06-23 \n" + " e-mail:Nancy2018319@163.com \n"
+ " 一些地方借鉴他人,不足之处希望大家能提出意见,谢谢! \n" + "&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&\n", "记事本",
JOptionPane.INFORMATION_MESSAGE);
} // 关于结束
}// 方法actionPerformed()结束
// 实现DocumentListener接口中的方法(与撤销操作有关)
public void removeUpdate(DocumentEvent e) {
editMenu_Undo.setEnabled(true);
}
public void insertUpdate(DocumentEvent e) {
editMenu_Undo.setEnabled(true);
}
public void changedUpdate(DocumentEvent e) {
editMenu_Undo.setEnabled(true);
}// DocumentListener结束
// 实现接口UndoableEditListener的类UndoHandler(与撤销操作有关)
class UndoHandler implements UndoableEditListener {
public void undoableEditHappened(UndoableEditEvent uee) {
undo.addEdit(uee.getEdit());
}
}
/**
* main 方法
*
* @param args-String
*/
public static void main(String args[]) {
Notepad notepad = new Notepad();
// 使用 System exit 方法退出应用程序
notepad.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
| [
"nancy2018319@163.com"
] | nancy2018319@163.com |
1325e078a9e7fe55638c9d70ff5168eaa13b6bee | 1fefd7ac7faf457d53b029dd4f4b6221f4b93e1d | /src/B1Review.java | df1e4268b04f7f0ed795727417ba3dbde058ae4a | [] | no_license | yuyi1024/javaSE_practice1 | 5a6fdb8de50263ecee75ec034597f1b9400a8953 | 030405dec641be52d747c95b76f22608ba18b0f0 | refs/heads/master | 2020-04-15T20:03:15.055668 | 2019-01-15T07:19:28 | 2019-01-15T07:19:28 | 164,976,850 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,688 | java | import java.util.Scanner;
/**
* 題目編號 Java-B1:
*
* @author Yuyi Lee
* @version 1.0 Jan-02-2019
* @since 1.0
*/
public class B1Review {
public static void main(String args[]){
String sentance = "ABCDEFABCCFEG";
String subsentance = "AB";
System.out.print(" S NA IL ".replaceAll("^\\s+", "").replaceAll("\\s+$", ""));
System.out.println(sentance.indexOf(subsentance)); // 0
// 從第六個字元開始找
System.out.println(sentance.indexOf(subsentance, 6)); // 6
// 從後面開始找
System.out.println(sentance.lastIndexOf(subsentance)); // 6
// trim() 頭尾去空白
System.out.println(" I am a pan. ".trim());
// startsWith()
System.out.println(sentance.startsWith("AB")); // true
System.out.println(sentance.startsWith("BA")); // false
// endsWith()
System.out.println(sentance.endsWith("EG")); // true
System.out.println(sentance.endsWith("GE")); // false
// substring(m, m) 從 m(包含) 到 n(不包含)
System.out.println(sentance.substring(3)); // DEFABCCFEG
System.out.println(sentance.substring(3, 6)); // DEF
// String class equals() overrides Object class equals()
// 比較 value,而非 memory 位置
System.out.println("QWQ".equals("QWQ")); // true
System.out.println("QWQ".equals("qwq")); // false
// contains() vs. indexOf()
System.out.println(sentance.contains(subsentance)); // true
// convert int to string
System.out.println(String.valueOf(1234).getClass()); // String
}
}
| [
"bonnie831024@gmail.com"
] | bonnie831024@gmail.com |
2f0948a58fa7988c2b86cf8c7dc438400125217a | f41908aef99d13e828d1f0998c8564642be07ed9 | /java/workspace/structure/src/com/sopra/pox3/structure/Player.java | 44d06cf9a2c374ebfb122c5cbf92bbe8ec2320ad | [] | no_license | jeroboby/mes_sauvegardes | 1dccd34f42ce09d2cc124d38f48585da34f64092 | ff81882b5ee9255f98fbdf9d73159d3b8e164b59 | refs/heads/master | 2021-01-02T22:34:27.029039 | 2017-08-04T13:29:35 | 2017-08-04T13:29:35 | 99,343,857 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 253 | java | package com.sopra.pox3.structure;
public class Player implements Comparable<Player> {
String name;
@Override
public String toString(){
return name;
}
@Override
public int compareTo(Player other) {
return name.compareTo(other.name);
}
}
| [
"jerome.mmetge@gmail.com"
] | jerome.mmetge@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.