blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2
values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82
values | src_encoding stringclasses 28
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 7 5.41M | extension stringclasses 11
values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
d816dd10a60122831bddaaa623240a68f9ae1a9b | 7d98539272751bbafc0dd9c84400a8e424e5b968 | /jOOQ/src/main/java/org/jooq/impl/DropSequenceImpl.java | d164a24f2991cdc666603c06c436cd9ebf5788cb | [
"Apache-2.0"
] | permissive | GeorgiMinkov/jOOQ | 08e79a3b9231272d350e06ad45f09a071ad86df5 | 80d6967f1599c0a076ef47806958f35037cfb865 | refs/heads/main | 2023-09-03T02:24:19.666912 | 2021-11-19T16:15:16 | 2021-11-19T16:15:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,016 | 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.impl;
import static org.jooq.impl.DSL.*;
import static org.jooq.impl.Internal.*;
import static org.jooq.impl.Keywords.*;
import static org.jooq.impl.Names.*;
import static org.jooq.impl.SQLDataType.*;
import static org.jooq.impl.Tools.*;
import static org.jooq.impl.Tools.BooleanDataKey.*;
import static org.jooq.impl.Tools.DataExtendedKey.*;
import static org.jooq.impl.Tools.DataKey.*;
import static org.jooq.SQLDialect.*;
import org.jooq.*;
import org.jooq.Function1;
import org.jooq.Record;
import org.jooq.conf.*;
import org.jooq.impl.*;
import org.jooq.impl.QOM.*;
import org.jooq.tools.*;
import java.util.*;
import java.util.function.*;
import java.util.stream.*;
/**
* The <code>DROP SEQUENCE</code> statement.
*/
@SuppressWarnings({ "rawtypes", "unused" })
final class DropSequenceImpl
extends
AbstractDDLQuery
implements
QOM.DropSequence,
DropSequenceFinalStep
{
final Sequence<?> sequence;
final boolean ifExists;
DropSequenceImpl(
Configuration configuration,
Sequence<?> sequence,
boolean ifExists
) {
super(configuration);
this.sequence = sequence;
this.ifExists = ifExists;
}
// -------------------------------------------------------------------------
// XXX: QueryPart API
// -------------------------------------------------------------------------
private static final Clause[] CLAUSES = { Clause.DROP_SEQUENCE };
private static final Set<SQLDialect> NO_SUPPORT_IF_EXISTS = SQLDialect.supportedBy(DERBY, FIREBIRD);
private final boolean supportsIfExists(Context<?> ctx) {
return !NO_SUPPORT_IF_EXISTS.contains(ctx.dialect());
}
@Override
public final void accept(Context<?> ctx) {
if (ifExists && !supportsIfExists(ctx))
tryCatch(ctx, DDLStatementType.DROP_SEQUENCE, c -> accept0(c));
else
accept0(ctx);
}
private void accept0(Context<?> ctx) {
ctx.start(Clause.DROP_SEQUENCE_SEQUENCE)
.visit(K_DROP)
.sql(' ')
.visit(ctx.family() == CUBRID ? K_SERIAL : K_SEQUENCE)
.sql(' ');
if (ifExists && supportsIfExists(ctx))
ctx.visit(K_IF_EXISTS).sql(' ');
switch (ctx.family()) {
default: {
ctx.visit(sequence);
break;
}
}
if (ctx.family() == DERBY)
ctx.sql(' ').visit(K_RESTRICT);
ctx.end(Clause.DROP_SEQUENCE_SEQUENCE);
}
@Override
public final Clause[] clauses(Context<?> ctx) {
return CLAUSES;
}
// -------------------------------------------------------------------------
// XXX: Query Object Model
// -------------------------------------------------------------------------
@Override
public final Sequence<?> $sequence() {
return sequence;
}
@Override
public final boolean $ifExists() {
return ifExists;
}
@Override
public final QOM.DropSequence $sequence(Sequence<?> newValue) {
return constructor().apply(newValue, $ifExists());
}
@Override
public final QOM.DropSequence $ifExists(boolean newValue) {
return constructor().apply($sequence(), newValue);
}
public final Function2<? super Sequence<?>, ? super Boolean, ? extends QOM.DropSequence> constructor() {
return (a1, a2) -> new DropSequenceImpl(configuration(), a1, a2);
}
@Override
public final QueryPart $replace(
Predicate<? super QueryPart> recurse,
Function1<? super QueryPart, ? extends QueryPart> replacement
) {
return QOM.replace(
this,
$sequence(),
$ifExists(),
(a1, a2) -> constructor().apply(a1, a2),
recurse,
replacement
);
}
@Override
public final <R> R $traverse(Traverser<?, R> traverser) {
return QOM.traverse(traverser, this,
$sequence()
);
}
}
| [
"lukas.eder@gmail.com"
] | lukas.eder@gmail.com |
05e9d818b3db92dbc4a197121d93db7cde47249a | 065de1506a8ebaa33d853692a34b868e8175e94c | /src/main/java/com/matera/cursoferias/petstore/entity/TipoServico.java | 5c22f65673a9d260f8cc85b3ff5026448c22aa5e | [] | no_license | michelettocaio/curso_ferias_matera | 3f4015d7eda38e0ebdaf4499fd89d1f6eb83607f | d5db3515c30ea9b72f05915ee2582690e7746e4d | refs/heads/master | 2020-04-18T16:22:28.750892 | 2019-02-01T22:16:29 | 2019-02-01T22:16:29 | 167,632,555 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 588 | java | package com.matera.cursoferias.petstore.entity;
public enum TipoServico {
BANHO_TOSA(1, "Banho e Tosa"),
CIRURGIA(2, "Cirurgia"),
CONSULTA(3, "Consulta"),
VACINACAO(4, "Vacinação");
private int id;
private String descricao;
private TipoServico(int id, String descricao) {
this.id = id;
this.descricao = descricao;
}
public static TipoServico valueOf(int id) {
for(TipoServico tipo : values()) {
if(tipo.getId() == id) {
return tipo;
}
}
return null;
}
public int getId() {
return id;
}
public String getDescricao() {
return descricao;
}
}
| [
"caio.micheletto@gmail.com"
] | caio.micheletto@gmail.com |
8d65c4792b02170f75e80d9f104305dc089494e7 | 24c4a56863f66271f72f0ea917aace8dbf9ea9ff | /src/main/java/ninja/mattburgess/pentaho/di/extensionpoints/script/job/JobBeginProcessingExecutor.java | ed51b427aadd428c0de6115a3174d89158c7bc2a | [
"Apache-2.0"
] | permissive | Therigy/pdi-script-extension-points | 9d8bbdce222300625899a4a32672cb3e9158ca2a | 3de55299ed983d4572da1543086e99f545a2aebc | refs/heads/master | 2022-11-25T16:57:43.830124 | 2020-08-10T17:20:24 | 2020-08-10T17:20:24 | 272,789,778 | 0 | 0 | Apache-2.0 | 2020-08-10T17:20:25 | 2020-06-16T19:01:58 | Java | UTF-8 | Java | false | false | 547 | java | package ninja.mattburgess.pentaho.di.extensionpoints.script.job;
import ninja.mattburgess.pentaho.di.extensionpoints.script.BaseExtensionPointExecutor;
import org.pentaho.di.core.extension.ExtensionPoint;
@ExtensionPoint(
id = "JobBeginProcessingScript",
extensionPointId = "JobBeginProcessing",
description = "Executes script(s) when a job is started after log table handling"
)
public class JobBeginProcessingExecutor extends BaseExtensionPointExecutor {
public JobBeginProcessingExecutor() {
super( "JobBeginProcessing" );
}
}
| [
"mburgess@pentaho.com"
] | mburgess@pentaho.com |
8f0679f33cd137e4c6f747b577442bb6c49ec9f0 | 75c4712ae3f946db0c9196ee8307748231487e4b | /src/main/java/com/alipay/api/response/KoubeiMarketingCampaignMerchantActivityModifyResponse.java | 8d1f403c7aee63dbdbbafc658519aeab5d89c365 | [
"Apache-2.0"
] | permissive | yuanbaoMarvin/alipay-sdk-java-all | 70a72a969f464d79c79d09af8b6b01fa177ac1be | 25f3003d820dbd0b73739d8e32a6093468d9ed92 | refs/heads/master | 2023-06-03T16:54:25.138471 | 2021-06-25T14:48:21 | 2021-06-25T14:48:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 952 | java | package com.alipay.api.response;
import com.alipay.api.internal.mapping.ApiField;
import com.alipay.api.domain.MActivityDetailInfo;
import com.alipay.api.AlipayResponse;
/**
* ALIPAY API: koubei.marketing.campaign.merchant.activity.modify response.
*
* @author auto create
* @since 1.0, 2019-01-07 20:51:15
*/
public class KoubeiMarketingCampaignMerchantActivityModifyResponse extends AlipayResponse {
private static final long serialVersionUID = 4442422399242739777L;
/**
* 创建成功之后返回活动详情信息,包含活动activity_id和活动当前状态activity_status等信息。
*/
@ApiField("activity_detail_info")
private MActivityDetailInfo activityDetailInfo;
public void setActivityDetailInfo(MActivityDetailInfo activityDetailInfo) {
this.activityDetailInfo = activityDetailInfo;
}
public MActivityDetailInfo getActivityDetailInfo( ) {
return this.activityDetailInfo;
}
}
| [
"ben.zy@antfin.com"
] | ben.zy@antfin.com |
62fd157d7f5c2461cd02e8b63a8f12a8fcde588c | d8537b3fc4733e77cbc41546587b9fc6cd022968 | /4.JavaCollections/src/com/javarush/task/task38/task3809/LongPositive.java | 316353645a86f9b1b6ebef14023e132209e1c43d | [] | no_license | kostya-wolf/JavaRushTasks | ea99a5f415776811ea346185235fe4283305c6ac | cae10b23d43a80ecac6efc2a86a451b27358d19d | refs/heads/master | 2021-09-21T01:38:03.504059 | 2021-09-09T11:48:48 | 2021-09-09T11:48:48 | 187,481,714 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 312 | java | package com.javarush.task.task38.task3809;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(value = ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface LongPositive {
}
| [
"kostya-wolf@yandex.ru"
] | kostya-wolf@yandex.ru |
e70bb716f5a3a0f2dd0dd7f595729c39bc8adaf1 | d51547c913da5ee55d52928d6b1bb82ba1755d45 | /origional project/MyProject-master/src/main/java/model/Note.java | 619979fc295f28a6b01580a5070959347e945b04 | [] | no_license | shreyaspatil1008/cleanCode | 6fbd0d9d97f397540f4f71c7ba194bbc642b7e06 | f0c78ca8ac02f5fc0559d402aa024040048ec89a | refs/heads/master | 2020-05-07T14:08:58.197654 | 2019-04-10T12:49:50 | 2019-04-10T12:49:50 | 180,580,591 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,798 | java | package main.java.model;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToOne;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import main.java.model.base.BaseModel;
public class Note extends BaseModel {
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
@Column
private Long id;
@NotNull
@Size(min=1,max=50)
@Column
private String title;
@Size(max = 1000)
@Column
private String note;
@Column
private Date createdTime;
@Column
private Date lastUpdatedTime;
@ManyToOne(fetch=FetchType.EAGER)
@JoinTable(
name="user",
joinColumns=
@JoinColumn(name="user_id",referencedColumnName="id"),
inverseJoinColumns =
@JoinColumn(name="group_id",referencedColumnName="id")
)
private User user;
public Note(){
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getTitle() {
return title;
}
@Size(min=1,max=50)
public void setTitle(String title) {
this.title = title;
}
public String getNote() {
return note;
}
@Size(max=1000)
public void setNote(String note) {
this.note = note;
}
public Date getCreatedTime() {
return createdTime;
}
public void setCreatedTime(Date createdTime) {
this.createdTime = createdTime;
}
public Date getLastUpdatedTime() {
return lastUpdatedTime;
}
public void setLastUpdatedTime(Date lastUpdatedTime) {
this.lastUpdatedTime = lastUpdatedTime;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
}
| [
"shreyaspatil1008@gmail.com"
] | shreyaspatil1008@gmail.com |
b802335839d1d1a6003a6b92b001c8e0c0484392 | 6e8322eaaba960d9543753264c5d99c6b0f15c7c | /src/state/State.java | 93b63e05108796c834a9766af059d6759fce4094 | [] | no_license | FabioDevGomes/desingpatterns | 56de50e7ef2866dfe54f065a6b6180c9a6913719 | 43fda5025018bd3fe15e3f78237d252b135a6678 | refs/heads/master | 2021-01-19T11:17:34.971505 | 2016-06-29T17:46:26 | 2016-06-29T17:46:26 | 60,650,191 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 154 | java | package state;
public interface State {
//Ações
void inserirMoeda();
void acionarAlavanca();
void ejetarMoeda();
void entregarGoma();
}
| [
"mex6789@24046-4698.INFO"
] | mex6789@24046-4698.INFO |
2c82b1b067bad089097538d7c4f70b124fbad141 | f6d0350624a4cad263ba4d381d10a1f7113be2d0 | /src/appmarket/db/entidades/dal/ProductDal.java | 1b6a7fa6b503227d112affbcddaa99462da85ad3 | [] | no_license | Sylvn001/AppMarketJavaFX | 6b4a81f02a2bacf1752e5a3f46fbba52efc4a53b | acfdec9a32a5860607c86fb5cc1007f5de287676 | refs/heads/master | 2023-01-13T03:01:28.623041 | 2020-11-22T15:24:49 | 2020-11-22T15:24:49 | 310,487,227 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,314 | 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 appmarket.db.entidades.dal;
import appmarket.db.connect.DB;
import appmarket.db.entities.Categorie;
import appmarket.db.entities.Product;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author junio
*/
public class ProductDal {
public boolean create(Product p){
String sql="INSERT INTO products VALUES (default,'#1','#2' , '#3' , '#4')";
sql=sql.replace("#1",p.getName());
sql=sql.replace("#2",""+p.getPrice());
sql=sql.replace("#3",""+p.getStock());
sql=sql.replace("#4",""+p.getCategorie().getId());
//System.out.println(sql);
return DB.getCon().manipular(sql);
}
public int getStock(int id) throws SQLException{
int stock;
String sql = "SELECT pro_stock where pro_id = " + id;
ResultSet rs = DB.getCon().consultar(sql);
stock = rs.getInt("pro_stock");
return stock;
}
public void updateStock(int id, int stock){
String sql;
sql = "UPDATE products SET pro_stock = " +stock + " WHERE pro_id = " + id;
DB.getCon().manipular(sql);
}
public boolean update(Product p){
System.out.println(p.getId());
System.out.println(p.getCategorie().getId());
String sql="UPDATE products SET pro_name = '#1',pro_price = '#2', pro_stock = '#3', cat_id = '#4' WHERE pro_id = "+p.getId();
sql=sql.replace("#1",p.getName());
sql=sql.replace("#2",""+p.getPrice());
sql=sql.replace("#3",""+p.getStock());
sql=sql.replace("#4",""+p.getCategorie().getId());
return DB.getCon().manipular(sql);
}
public boolean delete (int id){
String sql = "DELETE FROM products WHERE pro_id = " + id;
return DB.getCon().manipular(sql);
}
public Product get(int id)
{ Product aux=null;
String sql="SELECT * FROM products WHERE pro_id="+id;
ResultSet rs = DB.getCon().consultar(sql);
try{
if(rs.next())
aux = new Product(rs.getInt("pro_id"),
rs.getString("pro_name"),
rs.getDouble("pro_price"),
rs.getInt("pro_stock"),
new CategorieDal().get(rs.getInt("cat_id"))) ;
}catch(SQLException e){}
return aux;
}
public List<Product> get(String filter)
{ List <Product> products=new ArrayList();
String sql="SELECT * FROM products";
if (!filter.isEmpty())
sql+=" WHERE "+filter;
ResultSet rs = DB.getCon().consultar(sql);
try{
while(rs.next())
products.add(new Product(rs.getInt("pro_id"),
rs.getString("pro_name"),
rs.getDouble("pro_price"),
rs.getInt("pro_stock"),
new CategorieDal().get(rs.getInt("cat_id"))));
}catch(SQLException e){}
return products;
}
}
| [
"juniorbaarros@gmail.com"
] | juniorbaarros@gmail.com |
70ffd9fae4c4d9c2b6836c75fa5cefa9118ac5ed | e5b767651c5b49a803a61ce0e96ed3e21aac71b3 | /src/java/org/apache/lucene/server/SVJSONPassageFormatter.java | 0e35f68306ad5d63b21aeb300bccc4b62757fd03 | [
"Apache-2.0"
] | permissive | mikemccand/luceneserver | 08e30fde9c9fca713e8ba32c66c0f74b3f3500a1 | 1ec0fc56047c6cbb6e5fbd40c76cd97ac34bf8e1 | refs/heads/master | 2023-05-11T19:26:58.409473 | 2023-05-09T14:35:15 | 2023-05-09T14:35:15 | 64,122,791 | 138 | 37 | Apache-2.0 | 2021-01-24T00:03:44 | 2016-07-25T09:45:10 | Java | UTF-8 | Java | false | false | 5,115 | java | package org.apache.lucene.server;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.text.BreakIterator;
import java.util.Locale;
import org.apache.lucene.search.postingshighlight.Passage;
import org.apache.lucene.search.postingshighlight.PassageFormatter;
import net.minidev.json.JSONArray;
import net.minidev.json.JSONObject;
// nocommit move something like this to Lucene?
/** Formats highlight hits for single-valued fields,
* trimming snippets that are too large at word
* boundaries. */
public class SVJSONPassageFormatter extends PassageFormatter {
private final int maxSnippetLength;
private final BreakIterator wordBI = BreakIterator.getWordInstance(Locale.ROOT);
/** Sole constructor. */
public SVJSONPassageFormatter(int maxSnippetLength) {
this.maxSnippetLength = maxSnippetLength;
}
@Override
public Object format(Passage[] passages, String content) {
JSONArray result = new JSONArray();
int pos = 0;
JSONArray snippet = null;
Passage lastPassage = null;
JSONObject lastSnippetObj = null;
int totLength = 0;
for (Passage passage : passages) {
if (snippet == null || passage.getStartOffset() > pos) {
if (lastPassage != null) {
lastSnippetObj.put("endOffset", lastPassage.getEndOffset());
}
// Make a new snippet
JSONObject snippetObj = new JSONObject();
lastSnippetObj = snippetObj;
snippetObj.put("startOffset", passage.getStartOffset());
snippet = new JSONArray();
snippetObj.put("parts", snippet);
result.add(snippetObj);
pos = passage.getStartOffset();
totLength = 0;
}
// TODO: make this 4 settable
int limit = Math.min(4, passage.getNumMatches());
for (int i = 0; i < limit; i++) {
int start = passage.getMatchStarts()[i];
// Must at least start within passage:
assert start < passage.getEndOffset();
int end = passage.getMatchEnds()[i];
// it's possible to have overlapping terms
if (start > pos) {
String s = trim(content.substring(pos, start), i>0, true);
totLength += s.length();
snippet.add(s);
pos = start;
}
if (end > pos) {
JSONObject hit = new JSONObject();
snippet.add(hit);
hit.put("term", passage.getMatchTerms()[i].utf8ToString());
String s = content.substring(Math.max(pos, start), end);
totLength += s.length();
hit.put("text", s);
pos = end;
}
// TODO: make this 3*maxSnippetLength settable
if (totLength > 3*maxSnippetLength) {
break;
}
}
if (totLength < 3*maxSnippetLength) {
// its possible a "term" from the analyzer could span a sentence boundary.
snippet.add(trim(content.substring(pos, Math.max(pos, passage.getEndOffset())), passage.getNumMatches() != 0, false));
}
pos = passage.getEndOffset();
lastPassage = passage;
}
if (lastPassage != null) {
lastSnippetObj.put("endOffset", lastPassage.getEndOffset());
}
return result;
}
/** Find last word boundary before offset. */
private int wordBack(int offset) {
int x = wordBI.preceding(offset);
if (x < offset-15) {
x = offset;
}
if (x < 0) {
x = 0;
}
return x;
}
/** Find next word boundary after offset. */
private int wordForwards(int offset) {
int x = wordBI.following(offset);
if (x > offset+15) {
x = offset;
}
return x;
}
private String trim(String in, boolean hasMatchBeforeStart, boolean hasMatchAfterEnd) {
if (in.length() <= maxSnippetLength) {
return in;
}
wordBI.setText(in);
if (hasMatchBeforeStart) {
if (hasMatchAfterEnd) {
if (in.length() <= 2*maxSnippetLength) {
return in;
} else {
return in.substring(0, wordBack(maxSnippetLength)) + " ... " + in.substring(wordForwards(in.length()-maxSnippetLength));
}
} else {
return in.substring(0, wordBack(maxSnippetLength)) + " ... ";
}
} else if (hasMatchAfterEnd) {
return " ... " + in.substring(wordForwards(in.length()-maxSnippetLength));
} else {
return in.substring(0, wordBack(maxSnippetLength)) + " ... ";
}
}
}
| [
"mikemccand@apache.org"
] | mikemccand@apache.org |
78a1690be33489a73066e02d886d1df243160fc6 | 3f9b9438f1c5958e838f775b3767089dd8033ea6 | /src/main/java/dao/UserDaoImpl.java | dca2ac181c85cea7e2a8cb1020f0d0cff59a77ec | [] | no_license | chanjin5219/ssh_maven_test | e036555fab77fbb475399dd69f61c34f86c09c30 | 6dd9387b7c86634bfea83c5edf74fb775e07dc23 | refs/heads/master | 2020-04-01T18:10:17.666497 | 2018-10-17T15:02:12 | 2018-10-17T15:02:20 | 153,475,861 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 848 | java | package dao;
import org.hibernate.HibernateException;
import org.hibernate.SessionFactory;
import pojo.User;
public class UserDaoImpl implements UserDao{
private SessionFactory sessionFactory;
public SessionFactory getSessionFactory() {
return sessionFactory;
}
public void setSessionFactory(SessionFactory sessionFactory) {
this.sessionFactory = sessionFactory;
}
public boolean register(User user) {
try {
sessionFactory.getCurrentSession().save(user);
return true;
} catch (HibernateException e) {
return false;
}
}
public User login(User user) {
User u = null;
u = (User)sessionFactory.getCurrentSession().createQuery("from User where username=:username and password=:password")
.setString("username", user.getName())
.setString("password", user.getPassword()).uniqueResult();
return u;
}
}
| [
"chanjin5219@163.com"
] | chanjin5219@163.com |
10f3065a21d70d123ea6a7caeabc3a7d14d4ce84 | 8c024740774ca3dcb7d385af5714f7aa2b5240a1 | /backend/src/main/java/de/viadee/bpmnai/ui/backend/service/dto/RunPipelinePayload.java | 13d90804860c33ed6cbe6225fbc078af38582943 | [
"BSD-3-Clause"
] | permissive | viadee/bpmn.ai-ui | 17ce54f741e3f158fd289740096b462f2dfad5f7 | f4c7a70ead60802f902cd0663a1bf08dad99f9f6 | refs/heads/master | 2023-01-10T16:02:57.099386 | 2022-01-17T07:01:39 | 2022-01-17T07:01:39 | 210,532,517 | 9 | 2 | NOASSERTION | 2023-01-07T10:16:53 | 2019-09-24T06:52:04 | TypeScript | UTF-8 | Java | false | false | 902 | java | package de.viadee.bpmnai.ui.backend.service.dto;
public class RunPipelinePayload {
private String dataLevel;
private String outputFormat;
private String csvDelimiter;
private String kafkaBroker;
public String getDataLevel() {
return dataLevel;
}
public void setDataLevel(String dataLevel) {
this.dataLevel = dataLevel;
}
public String getOutputFormat() {
return outputFormat;
}
public void setOutputFormat(String outputFormat) {
this.outputFormat = outputFormat;
}
public String getCsvDelimiter() {
return csvDelimiter;
}
public void setCsvDelimiter(String csvDelimiter) {
this.csvDelimiter = csvDelimiter;
}
public String getKafkaBroker() {
return kafkaBroker;
}
public void setKafkaBroker(String kafkaBroker) {
this.kafkaBroker = kafkaBroker;
}
}
| [
"mario.micudaj@viadee.de"
] | mario.micudaj@viadee.de |
eb412a5399c2b7cf14f3cfcf8b52ce0e96dd693d | 955660a3e4d08783a43d0f9e7e2100779a74e6ce | /newwork.java | 3e6c048f22232aa9c13d5fbf450ce93b6d83a4c8 | [] | no_license | sigodam/new-work | a66c56fe0c99d150fd4f9c204c2b5e9e1463cda7 | bbf7bd43aa75091633519332edd2af5ac8ceaf3b | refs/heads/main | 2022-12-28T01:22:49.194876 | 2020-10-14T12:44:45 | 2020-10-14T12:44:45 | 303,990,987 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17 | java | It is a new work. | [
"="
] | = |
2c45aee2efe6133091f5960d058b6a0555302aa9 | 93b271330ad955e70a2d24dca164731f7f63d02b | /src/main/java/ru/ponies/pink/web/dto/SubjectDto.java | 9231b18408e9c9c9570e115aa720ca5121322964 | [] | no_license | Vanadiiii/PinkPoniesCallCenterGame | 7bab4b1945760b6d998f893e54fc4ebf66ae2291 | 5cd7643ae5669c39d530b432d78a28575f64ad2e | refs/heads/master | 2023-08-01T11:14:31.878065 | 2021-09-04T17:31:47 | 2021-09-04T17:31:47 | 402,808,778 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 344 | java | package ru.ponies.pink.web.dto;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import ru.ponies.pink.domain.entity.enums.SubjectType;
import java.util.List;
import java.util.UUID;
@Data
@RequiredArgsConstructor
public class SubjectDto {
private UUID id;
private List<UUID> usersId;
private SubjectType subjectType;
}
| [
"Nikita.Eliseev@vsegda-da.com"
] | Nikita.Eliseev@vsegda-da.com |
a4a3c4b636ccfd86794179aca3e4fc1dd2d893a4 | b39157099058d9e84abe0975f864a4bd244ee9ee | /src/mx/store/programming/models/DVD.java | ba612a75ba881bbc36f6b9b756984ec45204abad | [] | no_license | tuxmex/MyBestStore | e3d32cbe00453077bffa74b8d129bb181d9a9ed7 | 2fdd2baa4ba9e479495047e577a6185be0b5cbc7 | refs/heads/master | 2022-07-20T00:21:42.766137 | 2020-05-18T16:10:13 | 2020-05-18T16:10:13 | 263,208,487 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,266 | java | package mx.store.programming.models;
public class DVD extends Product {
private int duration;
private int ageRange;
private String filmStudio;
public DVD(Product p, int duration, int ageRange, String filmStudio) {
super(p.getName(), p.getQtyInStock(), p.getPrice());
this.duration = duration;
this.ageRange = ageRange;
this.filmStudio = filmStudio;
}
public int getDuration() {
return duration;
}
public void setDuration(int duration) {
this.duration = duration;
}
public int getAgeRange() {
return ageRange;
}
public void setAgeRange(int ageRange) {
this.ageRange = ageRange;
}
public String getFilmStudio() {
return filmStudio;
}
public void setFilmStudio(String filmStudio) {
this.filmStudio = filmStudio;
}
@Override
public double getInventoryValue() {
return 1.05 * (super.getPrice() * super.getQtyInStock());
}
@Override
public String toString() {
return super.toString()
+ "\nDuration : " + this.duration + " min"
+ "\nAge range : " + this.ageRange + " years"
+ "\nStudio : " + this.filmStudio;
}
}
| [
"crackiman@gmail.com"
] | crackiman@gmail.com |
f8490db61c41248d60f9b66338ea405ce0ad699c | bfaa2f08593e5ab63f6380436b5b545f9b0c3751 | /corejava/data type/numeric/Twenty5.java | a3d9b3925a5c92694615c4ef152ce218b99eada8 | [] | no_license | pythoncircle/javacodeexample | 09ce1bb9ba3e72e2c9194f6ee9ab15ea0e8e54a0 | f0fb5502006a9bdc96935753dff29a56225f072b | refs/heads/master | 2023-04-15T21:26:30.110793 | 2021-04-22T07:23:39 | 2021-04-22T07:23:39 | 359,488,516 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 129 | java |
class Twenty5
{
public static void main(String[]args)
{
boolean ans;
ans=true;
ans=false;
System.out.println(ans);
}
}
| [
"futureinjava@gmail.com"
] | futureinjava@gmail.com |
88bf7d441958d92271f34dd3084de772940784df | 4d2569e90ca8051e5d385055d0ef59b98e1a8190 | /Music-Server/appdemo-server/demo-common-dao/src/main/java/com/netease/mmc/demo/httpdao/nim/NIMServerApiHttpDao.java | 64f6f3a8beb504992f6d237fb2971690e15f7a7a | [
"MIT"
] | permissive | wfb0902/Music | 4f6f9bda8c8008fa5eb63ca7677d110506c07ca3 | 252cb18a7a3f5251bb989d720df53545c4063658 | refs/heads/master | 2020-08-08T09:46:06.724567 | 2019-07-02T12:50:40 | 2019-07-02T12:50:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,153 | java | package com.netease.mmc.demo.httpdao.nim;
import java.util.Objects;
import javax.annotation.Nonnull;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import com.alibaba.fastjson.JSONObject;
import com.netease.mmc.demo.common.enums.HttpCodeEnum;
import com.netease.mmc.demo.common.enums.RoomAddressTypeEnum;
import com.netease.mmc.demo.common.exception.ChatroomException;
import com.netease.mmc.demo.common.exception.UserException;
import com.netease.mmc.demo.httpdao.AbstractApiHttpDao;
import com.netease.mmc.demo.httpdao.nim.dto.AddrResponseDTO;
import com.netease.mmc.demo.httpdao.nim.dto.ChatroomQueueResponseDTO;
import com.netease.mmc.demo.httpdao.nim.dto.ChatroomResponseDTO;
import com.netease.mmc.demo.httpdao.nim.dto.NimUserResponseDTO;
import com.netease.mmc.demo.httpdao.nim.util.NIMErrorCode;
/**
* 云信服务端api接口调用类.
*
* @author hzwanglin1
* @date 17-6-24
* @since 1.0
*/
@Component
public class NIMServerApiHttpDao extends AbstractApiHttpDao {
private static final Logger LOGGER = LoggerFactory.getLogger(NIMServerApiHttpDao.class);
@Value("${nim.server.api.url}")
private String nimServerUrl;
/**
* 创建IM用户账号.
*
* @param accid 用户名,最大长度32字符
* @param name 用户昵称,最大长度64字符
* @param token 云信token,最大长度128字符,如果未指定,会自动生成token,并在创建成功后返回
* @return
*/
public NimUserResponseDTO createUser(String accid, String name, String token) {
MultiValueMap<String, String> param = new LinkedMultiValueMap<>(3);
param.set("accid", accid);
param.set("name", name);
if (token != null) {
param.set("token", token);
}
String res = postFormData("user/create.action", param);
if (StringUtils.isBlank(res)) {
throw new UserException();
}
return JSONObject.parseObject(res, NimUserResponseDTO.class);
}
/**
* 更新用户账号token.
*
* @param accid 用户账号
* @param token 需要更新的token
* @return
*/
public boolean updateUserToken(String accid, String token) {
MultiValueMap<String, String> param = new LinkedMultiValueMap<>(2);
param.set("accid", accid);
param.set("token", token);
String res = postFormData("user/update.action", param);
if (StringUtils.isBlank(res)) {
throw new UserException();
}
NimUserResponseDTO responseDTO = JSONObject.parseObject(res, NimUserResponseDTO.class);
// 账号不存在
if (Objects.equals(responseDTO.getCode(), NIMErrorCode.ILLEGAL_PARAM.value())) {
throw new UserException(HttpCodeEnum.USER_NOT_FOUND_ON_SERVER);
} else if (!Objects.equals(responseDTO.getCode(), HttpCodeEnum.OK.value())) {
LOGGER.error("updateUserIMToken failed accid[{}] for reason[{}]", accid, responseDTO);
throw new UserException(responseDTO.getDesc());
}
return true;
}
/**
* 创建聊天室
*
* @param creator 房主账号
* @param roomName 聊天室房间名称
* @param announcement 聊天室公告
* @param broadcastUrl 广播地址
* @param ext 聊天室扩展字段(约定为json格式)
* @return
*/
public ChatroomResponseDTO createRoom(String creator, String roomName, String announcement, String broadcastUrl,
String ext) {
MultiValueMap<String, String> param = new LinkedMultiValueMap<>(5);
param.set("creator", creator);
param.set("name", roomName);
if (announcement != null) {
param.set("announcement", announcement);
}
if (broadcastUrl != null) {
param.set("broadcasturl", broadcastUrl);
}
if (ext != null) {
param.set("ext", ext);
}
String res = postFormData("chatroom/create.action", param);
if (StringUtils.isBlank(res)) {
throw new ChatroomException();
}
return JSONObject.parseObject(res, ChatroomResponseDTO.class);
}
/**
* 更新聊天室信息
*
* @param roomId 聊天室id
* @param roomName 聊天室房间名称
* @param announcement 聊天室公告
* @param broadcastUrl 广播地址
* @param ext 聊天室扩展字段(约定为json格式)
* @return
*/
public ChatroomResponseDTO updateRoom(long roomId, String roomName, String announcement, String broadcastUrl,
String ext) {
MultiValueMap<String, String> param = new LinkedMultiValueMap<>(5);
param.set("roomid", String.valueOf(roomId));
if (roomName != null) {
param.set("name", roomName);
}
if (announcement != null) {
param.set("announcement", announcement);
}
if (broadcastUrl != null) {
param.set("broadcasturl", broadcastUrl);
}
if (ext != null) {
param.set("ext", ext);
}
String res = postFormData("chatroom/update.action", param);
if (StringUtils.isBlank(res)) {
throw new ChatroomException();
}
return JSONObject.parseObject(res, ChatroomResponseDTO.class);
}
/**
* 修改聊天室开启/关闭状态
*
* @param roomId 聊天室房间名称
* @param operator 操作者账号,必须是创建者才可以操作
* @param valid true或false,false:关闭聊天室;true:打开聊天室
* @return
*/
public ChatroomResponseDTO changeRoomStatus(long roomId, String operator, boolean valid) {
MultiValueMap<String, String> param = new LinkedMultiValueMap<>(3);
param.set("roomid", String.valueOf(roomId));
param.set("operator", operator);
param.set("valid", String.valueOf(valid));
String res = postFormData("chatroom/toggleCloseStat.action", param);
if (StringUtils.isBlank(res)) {
throw new ChatroomException();
}
return JSONObject.parseObject(res, ChatroomResponseDTO.class);
}
/**
* 请求聊天室地址.
*
* @param roomId 聊天室房间id
* @param accid 请求进入聊天室的账号
* @param addressType 客户端类型 {@link RoomAddressTypeEnum}
* @return
*/
public AddrResponseDTO requestRoomAddress(long roomId, String accid, RoomAddressTypeEnum addressType) {
MultiValueMap<String, String> param = new LinkedMultiValueMap<>(3);
param.set("roomid", String.valueOf(roomId));
param.set("accid", accid);
if (addressType != null) {
param.set("clienttype", String.valueOf(addressType.getValue()));
}
String res = postFormData("chatroom/requestAddr.action", param);
if (StringUtils.isBlank(res)) {
throw new ChatroomException();
}
return JSONObject.parseObject(res, AddrResponseDTO.class);
}
/**
* 查询聊天室信息.
*
* @param roomId 聊天室房间id
* @param needOnlineUserCount 是否需要返回在线人数
* @return
*/
public ChatroomResponseDTO queryRoomInfo(long roomId, Boolean needOnlineUserCount) {
MultiValueMap<String, String> param = new LinkedMultiValueMap<>(2);
param.set("roomid", String.valueOf(roomId));
if (needOnlineUserCount != null) {
param.set("needOnlineUserCount", String.valueOf(needOnlineUserCount));
}
String res = postFormData("chatroom/get.action", param);
if (StringUtils.isBlank(res)) {
throw new ChatroomException();
}
return JSONObject.parseObject(res, ChatroomResponseDTO.class);
}
/**
* 往聊天室有序队列中新加或更新元素
*
* @param roomId
* @param key 连麦请求者
* @param value 连麦请求ext
* @return
*/
public ChatroomQueueResponseDTO pushQueue(long roomId, String key, String value) {
MultiValueMap<String, String> param = new LinkedMultiValueMap<>(3);
param.set("roomid", String.valueOf(roomId));
param.set("key", key);
param.set("value", value);
String res = postFormData("chatroom/queueOffer.action", param);
if (StringUtils.isBlank(res)) {
throw new ChatroomException();
}
return JSONObject.parseObject(res, ChatroomQueueResponseDTO.class);
}
/**
* 从队列中取出元素
*
* @param roomId
* @param key 指定取连麦请求者(可选)
* @return
*/
public ChatroomQueueResponseDTO popQueue(long roomId, String key) {
MultiValueMap<String, String> param = new LinkedMultiValueMap<>(2);
param.set("roomid", String.valueOf(roomId));
if (StringUtils.isNotBlank(key)) {
param.set("key", key);
}
String res = postFormData("chatroom/queuePoll.action", param);
if (StringUtils.isBlank(res)) {
throw new ChatroomException();
}
return JSONObject.parseObject(res, ChatroomQueueResponseDTO.class);
}
/**
* 排序列出队列中所有元素
*
* @param roomId
* @return
*/
public ChatroomQueueResponseDTO listQueue(long roomId) {
MultiValueMap<String, String> param = new LinkedMultiValueMap<>(1);
param.set("roomid", String.valueOf(roomId));
String res = postFormData("chatroom/queueList.action", param);
if (StringUtils.isBlank(res)) {
throw new ChatroomException();
}
return JSONObject.parseObject(res, ChatroomQueueResponseDTO.class);
}
@Nonnull
@Override
protected String createUrl(@Nonnull String path) {
return nimServerUrl + path;
}
}
| [
"williamw0825@gmail.com"
] | williamw0825@gmail.com |
cc8059a401a0ea93437d74e3049dd226fef4cea1 | 79d07e48c41fb559c00aee49ab86740464f9300b | /src/main/java/com/sm/direction/South.java | f601d46420f42b6681f8374ed0626b40f94d2489 | [] | no_license | meladEzzat/sm | a58242432041f69c7d8f265c77f25544c7a97cb8 | 4d102db654ee27effaaa7c94a19e71b44a0eecd3 | refs/heads/master | 2021-04-11T23:15:05.123836 | 2020-03-22T19:24:11 | 2020-03-22T19:24:11 | 249,063,225 | 0 | 0 | null | 2020-10-13T20:33:27 | 2020-03-21T21:22:28 | Java | UTF-8 | Java | false | false | 707 | java | package com.sm.direction;
import com.sm.movable_object.AbstractMovableObject;
public class South implements IDirectionState {
public void moveForward(AbstractMovableObject movableObject) {
movableObject.getCoordinates().setyCoordinate(movableObject.getCoordinates().getyCoordinate() + 1);
}
public void moveBackward(AbstractMovableObject movableObject) {
movableObject.getCoordinates().setyCoordinate(movableObject.getCoordinates().getyCoordinate() - 1);
}
public void rotateClockwise(AbstractMovableObject movableObject) {
movableObject.setDirection(new West());
}
public void rotateCounterClockwise(AbstractMovableObject movableObject) {
movableObject.setDirection(new East());
}
}
| [
"melad_ezzat@yahoo.com"
] | melad_ezzat@yahoo.com |
3082ba11dfdb201563820cf23bc0734316949221 | 5979994b215fabe125cd756559ef2166c7df7519 | /aimir-model/src/main/java/com/aimir/dao/mvm/RealTimeBillingEMDao.java | dfcd5910d1c625a21ec7cd89d41da30ceb49e5e5 | [] | no_license | TechTinkerer42/Haiti | 91c45cb1b784c9afc61bf60d43e1d5623aeba888 | debaea96056d1d4611b79bd846af8f7484b93e6e | refs/heads/master | 2023-04-28T23:39:43.176592 | 2021-05-03T10:49:42 | 2021-05-03T10:49:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,338 | java | package com.aimir.dao.mvm;
import java.util.List;
import java.util.Map;
import com.aimir.constants.CommonConstants.DeviceType;
import com.aimir.dao.GenericDao;
import com.aimir.model.device.Meter;
import com.aimir.model.mvm.RealTimeBillingEM;
import com.aimir.model.system.Contract;
public interface RealTimeBillingEMDao extends GenericDao<RealTimeBillingEM, Integer>{
/**
* Billing Data Current TOU 조회
*
* @param conditionMap
* @param isCount
* @return 조회 결과
*/
public List<Map<String, Object>> getBillingDataCurrent(Map<String, Object> conditionMap, boolean isCount);
/**
* Billing Data Current TOU 리포트 데이터 조회
*
* @param conditionMap
* @return 조회 결과
*/
public List<Map<String, Object>> getBillingDataReportCurrent(Map<String, Object> conditionMap);
/**
* Billing Data 일별 TOU 리포트 상세데이터 조회
*
* @param conditionMap
* @return 조회 결과
*/
public List<Map<String, Object>> getBillingDetailDataCurrent(Map<String, Object> conditionMap);
/**
* @Methodname getMonthlyMaxDemandByMeter
* @Date 2013. 11. 29.
* @Author scmitar1
* @ModifiedDate
* @Description 계약정보와 년월에 따른 최대 수요량
* @param meter
* @param yyyymm
* @return Map: maxDemand 최대수요량, writeDate 최대수요발생일
*/
public Map<String, Object> getMonthlyMaxDemandByMeter(Meter meter, String yyyymm);
/**
* 지정한 날짜보다 작은 데이터중 가장 최신의 CummAtvPwrDmdMaxImpRateTot 값을 가지고 온다.
* @param conditionMap
*/
public Map<String, Object> getCummAtvPwrDmdMaxImpRateTot(Map<String, Object> conditionMap);
public RealTimeBillingEM getNewestRealTimeBilling(String mdevId, DeviceType mdevType, String yyyymm);
/**
* method name : getSgdgXam1RealTimeData<b/>
* method Desc : SgdgXam1테이블에 넣을 데이터들을 조회해온다.
*
* @return
*/
public List<Map<String, Object>> getSgdgXam1RealTimeData(Map<String, Object> conditionMap);
/**
* 현재 빌링값을 삭제한다.
* @param meterId
* @param yyyymmdd
*/
public void delete(String meterId, String yyyymmdd);
}
| [
"marsr0913@nuritelecom.com"
] | marsr0913@nuritelecom.com |
86be020841fd9794062778ec1c656eea15a90ea2 | f3d57822bac53aa4d483dfd69a5d1ed7701a7c24 | /src/hr/algebra/controller/ClientChatController.java | aeefd27ed47ccf29a1829ee9e80a478928ae6317 | [] | no_license | ikvakan/ParliamentBrawl | 39ddb850baa4e944d76a61fe65e5c43d86783234 | a0860b7bc2b5484efd38210860df3813ccd2b765 | refs/heads/master | 2023-03-01T18:05:31.925104 | 2021-02-08T15:17:41 | 2021-02-08T15:17:41 | 308,993,895 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,905 | 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 hr.algebra.controller;
import hr.algebra.rmi.client.ChatClient;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.application.Platform;
import javafx.beans.binding.Bindings;
import javafx.beans.property.StringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.Node;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.TextField;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.scene.layout.VBox;
import javafx.scene.text.Font;
/**
* FXML Controller class
*
* @author IgorKvakan
*/
public class ClientChatController implements Initializable {
private static final int MESSAGE_LENGTH = 78;
private static final int FONT_SIZE = 15;
private ObservableList<Node> messages;
private ChatClient client;
@FXML
private TextField tfMessage;
@FXML
private ScrollPane spContainer;
@FXML
private VBox vbMessages;
@FXML
private Button btnSendMessage;
/**
* Initializes the controller class.
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
client= new ChatClient(this);
messages = FXCollections.observableArrayList();
Bindings.bindContentBidirectional(messages, vbMessages.getChildren());
tfMessage.textProperty().addListener(
(observable, oldValue, newValue) -> {
if (newValue.length() >= MESSAGE_LENGTH) {
((StringProperty) observable).setValue(oldValue);
}
}
);
}
@FXML
private void send(KeyEvent event) {
if (event.getCode() == KeyCode.ENTER) {
sendMessage();
}
}
@FXML
private void sendMessage() {
if (tfMessage.getText().trim().length() > 0) {
client.send(tfMessage.getText().trim());
addMessage(tfMessage.getText().trim());
tfMessage.clear();
}
}
public void postMessage(String message) {
Platform.runLater(() -> {
addMessage(message);
});
}
private void addMessage(String message) {
Label label = new Label();
label.setFont(new Font(FONT_SIZE));
label.setText(message);
messages.add(label);
moveScrollPane();
}
private void moveScrollPane() {
spContainer.applyCss();
spContainer.layout();
spContainer.setVvalue(1D);
}
}
| [
"37423910+ikvakan@users.noreply.github.com"
] | 37423910+ikvakan@users.noreply.github.com |
f0e1af2252a89b44479873e0f3adb8563a8fb48e | d3a23d145d90e4feb32ca18bd5be584fa4e10835 | /SpringBoot_BOQN_Demo/src/main/java/com/example/demo/audit/AppUserEntityListener.java | a1190cb64268cdc9fcc89236518185dca14b77c7 | [
"Apache-2.0"
] | permissive | mahasarathi/tutorial | 32163d31f684e26b27f0a3dc29dc1ed28311c589 | fd9e2cdf1786ab4b185ba9ecb8b71436e385ac1e | refs/heads/master | 2020-12-31T22:57:28.196290 | 2020-03-07T12:31:47 | 2020-03-08T10:54:58 | 239,064,741 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,033 | java | /**
*
*/
package com.example.demo.audit;
import javax.persistence.EntityManager;
import javax.persistence.PrePersist;
import javax.persistence.PreRemove;
import javax.persistence.PreUpdate;
import javax.transaction.Transactional;
import javax.transaction.Transactional.TxType;
import com.example.demo.entity.AppUser;
import com.example.demo.entity.AppUserHistory;
import com.example.demo.enums.Action;
import com.example.demo.utils.BeanUtil;
/**
* @author mahasarathi
*
*/
public class AppUserEntityListener {
@PrePersist
public void prePersist(AppUser target) {
perform(target, Action.INSERTED);
}
@PreUpdate
public void preUpdate(AppUser target) {
perform(target, Action.UPDATED);
}
@PreRemove
public void preRemove(AppUser target) {
perform(target, Action.DELETED);
}
@Transactional(value = TxType.MANDATORY)
private void perform(AppUser target, Action action) {
EntityManager entityManager = BeanUtil.getBean(EntityManager.class);
entityManager.persist(AppUserHistory.of(target, action));
}
}
| [
"44106840+mahasarathi@users.noreply.github.com"
] | 44106840+mahasarathi@users.noreply.github.com |
eaf818874b99b5c9c6fdf39f39471ac4c932a073 | a7db2a19f247dd95170510c02ad60a7f353932cd | /api/src/main/java/org/example/chronicle/model/FreeBusyRequest.java | ca54912f2ff502c1a4a7e89725fdb644c702420c | [] | no_license | hzbarcea/chronicle | 066d2422dfcf93b67d28b24265e8025608d8e853 | 74af7482f1016ebc66967f21ac2117e46a8504a5 | refs/heads/master | 2020-05-18T02:05:41.873774 | 2014-04-24T22:16:22 | 2014-04-24T22:16:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,283 | java | /**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.example.chronicle.model;
import java.util.LinkedList;
import java.util.List;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class FreeBusyRequest {
// TODO: use date instead of String
private String timeMin;
private String timeMax;
private String timeZone;
private int groupExpansionMax;
private int calendarExpansionMax;
private List<Identified> items = new LinkedList<Identified>();
public String getTimeMin() {
return timeMin;
}
public void setTimeMin(String timeMin) {
this.timeMin = timeMin;
}
public String getTimeMax() {
return timeMax;
}
public void setTimeMax(String timeMax) {
this.timeMax = timeMax;
}
public String getTimeZone() {
return timeZone;
}
public void setTimeZone(String timeZone) {
this.timeZone = timeZone;
}
public int getGroupExpansionMax() {
return groupExpansionMax;
}
public void setGroupExpansionMax(int groupExpansionMax) {
this.groupExpansionMax = groupExpansionMax;
}
public int getCalendarExpansionMax() {
return calendarExpansionMax;
}
public void setCalendarExpansionMax(int calendarExpansionMax) {
this.calendarExpansionMax = calendarExpansionMax;
}
public List<Identified> getItems() {
return items;
}
public void setItems(List<Identified> items) {
this.items = items;
}
}
| [
"hzbarcea@gmail.com"
] | hzbarcea@gmail.com |
484704600cf9dafbe421e02c7c17e2122a753ce4 | 48c7258da3e4ce2f79f842662d7acf622f2992a5 | /ex201900301070-4/Sdudata-s/src/main/java/com/example/sduManage/DemoApplication.java | 5c44e1d7cd0f015b7a2e60223c11f74065596d96 | [] | no_license | coolling/webAllProject | 8d851c21c846a711e095d2a77ebdf278faa05432 | 35bb17aca1671e0f07196c467855df09a833fb8a | refs/heads/main | 2023-02-17T00:17:46.107332 | 2021-01-17T11:43:33 | 2021-01-17T11:43:33 | 328,078,724 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 463 | java | package com.example.sduManage;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
@MapperScan(basePackages = "com.example.sduManage.mapper")//扫描mapper接口所在的包
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
| [
"2468448096@qq.com"
] | 2468448096@qq.com |
04864e9299bf528ff376e554d9409c437decadd0 | b8d046cd2f2a7e68777862784496491b338ef218 | /src/main/java/it/uniroma3/siw/taskmanager/service/CredentialsService.java | 2c370f32f4ee6d35081beb73ab6ba45d22c0f3cd | [] | no_license | MariaCarmelaPascale/Taskmanager | 68df043f02aa07a22d233b4da7a2b1b6bc4930a5 | 322fd5a6a1fcf11771bcb90f02e0daef8a9c1152 | refs/heads/master | 2022-10-24T22:32:23.484084 | 2020-06-18T16:54:00 | 2020-06-18T16:54:00 | 273,291,473 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,777 | java | package it.uniroma3.siw.taskmanager.service;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import javax.transaction.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
import it.uniroma3.siw.taskmanager.model.Credentials;
import it.uniroma3.siw.taskmanager.repository.CredentialsRepository;
@Service
public class CredentialsService {
@Autowired
private CredentialsRepository credentialsRepository;
@Autowired
private PasswordEncoder passwordEncoder;
@Transactional
public Credentials saveCredentials(Credentials c) {
c.setRole(Credentials.DEFAULT_ROLE); // setto le credenziali al ruolo di default -> se unno volesse promuovere un utente lo andrà a modificare direttamente col DB
// password encode
c.setPassword(this.passwordEncoder.encode(c.getPassword()));
return this.credentialsRepository.save(c);
}
@Transactional
public Credentials getCredentials(Long id) {
Optional<Credentials> result = this.credentialsRepository.findById(id);
return result.orElse(null);
}
@Transactional
public Credentials getCredentialsByUserName(String userName) {
Optional<Credentials> result = this.credentialsRepository.findByUserName(userName);
return result.orElse(null);
}
public List<Credentials> getAllCredentials() {
Iterable<Credentials> res = this.credentialsRepository.findAll();
List<Credentials> credentials = new ArrayList<Credentials>();
for(Credentials c: res) {
credentials.add(c);
}
return credentials;
}
public void deleteCredentials(String userName) {
this.credentialsRepository.delete(this.getCredentialsByUserName(userName));
}
}
| [
"61779407+MariaCarmelaPascale@users.noreply.github.com"
] | 61779407+MariaCarmelaPascale@users.noreply.github.com |
7bd9b05010aa3f04f4ec86e777d363fbd3cc99cc | 1a6911b58315d87360a3c3ca524d7fa228bee366 | /app/src/test/java/dev/prateek/com/newsapps2/ExampleUnitTest.java | 9decc1e0a6899dcbb05a9c7949893cf76a7f9aca | [] | no_license | prateek54/NewsAppS2 | 8f896b28ff695b27186d9a1eb4533789957c0754 | b9ff9fbe1b97382f1173ccba6099e581af8937cf | refs/heads/master | 2020-03-19T05:36:15.327916 | 2018-06-07T14:54:28 | 2018-06-07T14:54:28 | 135,947,070 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 403 | java | package dev.prateek.com.newsapps2;
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);
}
} | [
"you@example.com"
] | you@example.com |
2195deac1e2d9d1b7f3823f14e26bc35acd752b2 | e5f3fd623ed1e04139f2a66fd9e9273cf0204b71 | /src/interfaces/main.java | b5eb291ba93849acb1f6bebe4d2cf653d09de287 | [] | no_license | KernelWar/GraficadorOnda | 475fe4faf5d84785b353c2daaf4caa45f9c96a42 | 4237aa2591f6313f10d47afdaf3708d9a0a34a04 | refs/heads/main | 2023-01-04T10:07:37.464380 | 2020-10-29T04:12:50 | 2020-10-29T04:12:50 | 308,213,506 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,529 | 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 interfaces;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
/**
*
* @author Linux
*/
public class main extends javax.swing.JFrame {
private int A, B, C, D;
private float puntosCuadranteI[][] = new float[520][2];
private float puntosCuadranteII[][] = new float[520][2];
private float incrementoX = 0.01f;
public main() {
initComponents();
this.setLocationRelativeTo(null);
this.setSize(800, 600);
}
@Override
public void paint(Graphics g) {
super.paint(g);
//Dibuja el eje Y
int ejeYi = Plano.getWidth() / 2;
int ejeYf = Plano.getHeight();
g.drawLine(ejeYi, 0, ejeYi, ejeYf);
// System.out.println(ejeYi+",0 - "+ejeYi+","+ejeYf);
//Dibuja el eje X
int ejeXi = Plano.getHeight() / 2;
int ejeXf = Plano.getWidth();
g.drawLine(0, ejeXi, ejeXf, ejeXi);
// System.out.println("0,"+ejeXi+" - "+ejeXf+","+ejeXi);
//Dibujamos un punto en el origen del plano, restanto el tamaño del punto
g.setColor(Color.black);
g.fillOval(ejeYi - 2, ejeXi - 2, 5, 5);
//coordenadas exactas donde se ubica el origen
int origenX = ejeYi;
int origenY = ejeXi;
// System.out.println("x = "+origenX);
// System.out.println("y = "+origenY);
//partir de 5 en 5 cada eje
// eje X
int cx = origenX;
int cy = origenY;
//Negativo X
int longitudLineaCorte = 5;
for (int i = 0; i < 5; i++) {
cx -= 53;
//dibuja las lineas de corte
g.drawLine(cx, cy - longitudLineaCorte, cx, cy + longitudLineaCorte);
//dibuja los nuemeros en los cortes
g.drawString("-" + (i + 1) + "", cx - 7, (cy + 20));
}
//Positivo X
cx = origenX;
for (int i = 0; i < 5; i++) {
cx += 53;
g.drawLine(cx, cy - longitudLineaCorte, cx, cy + longitudLineaCorte);
g.drawString((i + 1) + "", cx - 3, cy + 20);
}
//Eje Y
//Positivo Y
cx = origenX;
longitudLineaCorte = 5;
for (int i = 0; i < 5; i++) {
cy -= 53;
g.drawLine(cx - longitudLineaCorte, cy, cx + longitudLineaCorte, cy);
g.drawString((i + 1) + "", cx + 10, cy + 5);
}
//Negativo Y
cx = origenX;
cy = origenY;
longitudLineaCorte = 5;
for (int i = 0; i < 5; i++) {
cy += 53;
g.drawLine(cx - longitudLineaCorte, cy, cx + longitudLineaCorte, cy);
g.drawString("-" + (i + 1) + "", cx + 10, cy + 4);
}
obtenerValoresSliders();
inicializarPuntosCuadrante();
CalcularYs();
GraficarFuncion(g);
}
public void GraficarFuncion(Graphics g) {
int xi = 0;
int yi = 0;
int xf = 0;
int yf = 0;
Graphics2D g2d = (Graphics2D) g;
for (int i = puntosCuadranteI.length - 1; i > 0; i--) {
xi = (int) ((int) 269 + ConvertirAMiEscala(puntosCuadranteI[i][0]));
yi = (int) ((int) 299 - ConvertirAMiEscala(puntosCuadranteI[i][1]));
// System.out.println(i+"= "+ConvertirAMiEscala(puntosCuadranteI[i][0], false)+","+ConvertirAMiEscala(puntosCuadranteI[i][1], true));
xf = (int) ((int) 269 + ConvertirAMiEscala(puntosCuadranteI[i - 1][0]));
yf = (int) ((int) 299 - ConvertirAMiEscala(puntosCuadranteI[i - 1][1]));
g2d.setColor(Color.blue);
//para el grosor de la linea
g2d.setStroke(new BasicStroke(2));
//se dibuja la onda
g2d.drawLine(xi, yi, xf, yf);
// System.out.println("xi = "+xi+",yi = "+yi);
// System.out.println("xf = "+xf+", yf = "+yf);
// g.fillOval(xi, yi, 2, 2);
// g.fillOval(xf, yf, 2, 2);
}
for (int i = 0; i < puntosCuadranteII.length - 1; i++) {
xi = (int) (269 + ConvertirAMiEscala(puntosCuadranteII[i][0]));
yi = (int) (299 - ConvertirAMiEscala(puntosCuadranteII[i][1]));
xf = (int) (269 + ConvertirAMiEscala(puntosCuadranteII[i + 1][0]));
yf = (int) (299 - ConvertirAMiEscala(puntosCuadranteII[i + 1][1]));
g2d.drawLine(xi, yi, xf, yf);
// g.fillOval(xi, yi, 2, 2);
// g.fillOval(xf, yf, 2, 2);
}
}
public float ConvertirAMiEscala(float valor) {
return valor * 53;
}
public void inicializarPuntosCuadrante() {
float decremento = 0;
//Cuadrante I
for (int i = 0; i < puntosCuadranteI.length; i++) {
puntosCuadranteI[i][0] = decremento;
decremento -= incrementoX;
}
//Cuadrante II
decremento = 0;
for (int i = 0; i < puntosCuadranteII.length; i++) {
puntosCuadranteII[i][0] = decremento;
decremento += incrementoX;
}
}
public void CalcularYs() {
//Cuadrante I
//System.out.println("Cuadrante I");
for (int i = 0; i < puntosCuadranteI.length; i++) {
puntosCuadranteI[i][1] = (float) (A * Math.sin(B * puntosCuadranteI[i][0] + C) + D);
// System.out.println(i + " = " + puntosCuadranteI[i][0] + "," + puntosCuadranteI[i][1]);
}
for (int i = 0; i < puntosCuadranteII.length; i++) {
puntosCuadranteII[i][1] = (float) (A * Math.sin(B * puntosCuadranteII[i][0] + C) + D);
// System.out.println(i + " = " + puntosCuadranteII[i][0] + "," + puntosCuadranteII[i][1]);
}
}
public void obtenerValoresSliders() {
A = slAmplitud.getValue();
B = slPeriodo.getValue();
C = slDesface.getValue();
D = slConstante.getValue();
}
/**
* 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() {
Contenedor = new javax.swing.JSplitPane();
jPanel4 = new javax.swing.JPanel();
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
slAmplitud = new javax.swing.JSlider();
jLabel2 = new javax.swing.JLabel();
slPeriodo = new javax.swing.JSlider();
jLabel3 = new javax.swing.JLabel();
slDesface = new javax.swing.JSlider();
jLabel4 = new javax.swing.JLabel();
slConstante = new javax.swing.JSlider();
jLabel5 = new javax.swing.JLabel();
Plano = new javax.swing.JPanel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Características de una onda");
setMinimumSize(new java.awt.Dimension(800, 600));
setResizable(false);
Contenedor.setDividerLocation(540);
Contenedor.setEnabled(false);
Contenedor.setMinimumSize(new java.awt.Dimension(800, 600));
Contenedor.setPreferredSize(new java.awt.Dimension(800, 600));
jPanel4.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jPanel1.setLayout(new java.awt.GridLayout(8, 1, 0, 10));
jLabel1.setText("Amplitud:");
jPanel1.add(jLabel1);
slAmplitud.setFont(new java.awt.Font("Dialog", 1, 10)); // NOI18N
slAmplitud.setMajorTickSpacing(1);
slAmplitud.setMaximum(6);
slAmplitud.setMinorTickSpacing(1);
slAmplitud.setPaintTicks(true);
slAmplitud.setSnapToTicks(true);
slAmplitud.setValue(1);
slAmplitud.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
slAmplitudStateChanged(evt);
}
});
jPanel1.add(slAmplitud);
jLabel2.setText("Periodo:");
jPanel1.add(jLabel2);
slPeriodo.setFont(new java.awt.Font("Dialog", 1, 10)); // NOI18N
slPeriodo.setMajorTickSpacing(1);
slPeriodo.setMaximum(6);
slPeriodo.setMinorTickSpacing(1);
slPeriodo.setValue(1);
slPeriodo.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
slPeriodoStateChanged(evt);
}
});
jPanel1.add(slPeriodo);
jLabel3.setText("Desface:");
jPanel1.add(jLabel3);
slDesface.setFont(new java.awt.Font("Dialog", 1, 10)); // NOI18N
slDesface.setMajorTickSpacing(1);
slDesface.setMaximum(5);
slDesface.setMinimum(-5);
slDesface.setMinorTickSpacing(1);
slDesface.setValue(1);
slDesface.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
slDesfaceStateChanged(evt);
}
});
jPanel1.add(slDesface);
jLabel4.setText("Constante:");
jPanel1.add(jLabel4);
slConstante.setFont(new java.awt.Font("Dialog", 1, 10)); // NOI18N
slConstante.setMajorTickSpacing(1);
slConstante.setMaximum(5);
slConstante.setMinimum(-5);
slConstante.setMinorTickSpacing(1);
slConstante.setPaintTicks(true);
slConstante.setValue(1);
slConstante.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
slConstanteStateChanged(evt);
}
});
jPanel1.add(slConstante);
jPanel4.add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 60, 230, 400));
jLabel5.setFont(new java.awt.Font("Dialog", 1, 18)); // NOI18N
jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel5.setText("Parámetros");
jPanel4.add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 20, 210, -1));
Contenedor.setRightComponent(jPanel4);
Plano.setBackground(new java.awt.Color(255, 255, 255));
Plano.setMinimumSize(new java.awt.Dimension(279, 540));
Plano.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
PlanoMouseClicked(evt);
}
});
javax.swing.GroupLayout PlanoLayout = new javax.swing.GroupLayout(Plano);
Plano.setLayout(PlanoLayout);
PlanoLayout.setHorizontalGroup(
PlanoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 0, Short.MAX_VALUE)
);
PlanoLayout.setVerticalGroup(
PlanoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 0, Short.MAX_VALUE)
);
Contenedor.setLeftComponent(Plano);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(Contenedor, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(Contenedor, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void slAmplitudStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_slAmplitudStateChanged
obtenerValoresSliders();
GraficarFuncion(this.getGraphics());
this.repaint();
}//GEN-LAST:event_slAmplitudStateChanged
private void slPeriodoStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_slPeriodoStateChanged
obtenerValoresSliders();
GraficarFuncion(this.getGraphics());
this.repaint();
}//GEN-LAST:event_slPeriodoStateChanged
private void slDesfaceStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_slDesfaceStateChanged
obtenerValoresSliders();
GraficarFuncion(this.getGraphics());
this.repaint();
}//GEN-LAST:event_slDesfaceStateChanged
private void slConstanteStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_slConstanteStateChanged
obtenerValoresSliders();
GraficarFuncion(this.getGraphics());
this.repaint();
}//GEN-LAST:event_slConstanteStateChanged
private void PlanoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_PlanoMouseClicked
int x = evt.getX();
int y = evt.getY();
System.out.println("x: "+x);
System.out.println("y: "+y);
}//GEN-LAST:event_PlanoMouseClicked
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Windows".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new main().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JSplitPane Contenedor;
private javax.swing.JPanel Plano;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel4;
private javax.swing.JSlider slAmplitud;
private javax.swing.JSlider slConstante;
private javax.swing.JSlider slDesface;
private javax.swing.JSlider slPeriodo;
// End of variables declaration//GEN-END:variables
}
| [
"josesocrateslopez@gmail.com"
] | josesocrateslopez@gmail.com |
7d60037ce511ab870c940f28a6ec55e6787259b7 | 81069a4daa9e3b55bf2f5a3760bbd22d832c485a | /Spring-Hibernate-Integration-Using-Maven/HibernateExamples/src/main/java/com/technicalkeeda/entity/TrnMovies.java | 804f1e74c61780f543aab9a5909d7dd58652d834 | [] | no_license | tuananh00473/SpringHibernateConfig2Tien | d7132ced96af43fd0b2b5d162ba8738c215c9858 | ea449fc1bacdcb3803c338bf5e29f4cf5588b6b6 | refs/heads/master | 2020-05-19T09:46:45.335185 | 2013-06-26T08:07:15 | 2013-06-26T08:07:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,578 | java | package com.technicalkeeda.entity;
import javax.persistence.Basic;
import javax.persistence.Entity;
import javax.persistence.Id;
/**
* Created with IntelliJ IDEA.
* User: anhnt
* Date: 6/26/13
* Time: 9:26 AM
* To change this template use File | Settings | File Templates.
*/
@javax.persistence.Table(name = "trn_movies", schema = "public", catalog = "technicalkeeda")
@Entity
public class TrnMovies
{
private long movieId;
private String director;
private Long releaseYear;
private String title;
@javax.persistence.Column(name = "movie_id")
@Id
public long getMovieId()
{
return movieId;
}
public void setMovieId(long movieId)
{
this.movieId = movieId;
}
@javax.persistence.Column(name = "director")
@Basic
public String getDirector()
{
return director;
}
public void setDirector(String director)
{
this.director = director;
}
@javax.persistence.Column(name = "release_year")
@Basic
public Long getReleaseYear()
{
return releaseYear;
}
public void setReleaseYear(Long releaseYear)
{
this.releaseYear = releaseYear;
}
@javax.persistence.Column(name = "title")
@Basic
public String getTitle()
{
return title;
}
public void setTitle(String title)
{
this.title = title;
}
@Override
public boolean equals(Object o)
{
if (this == o)
{
return true;
}
if (o == null || getClass() != o.getClass())
{
return false;
}
TrnMovies trnMovies = (TrnMovies) o;
if (movieId != trnMovies.movieId)
{
return false;
}
if (director != null ? !director.equals(trnMovies.director) : trnMovies.director != null)
{
return false;
}
if (releaseYear != null ? !releaseYear.equals(trnMovies.releaseYear) : trnMovies.releaseYear != null)
{
return false;
}
if (title != null ? !title.equals(trnMovies.title) : trnMovies.title != null)
{
return false;
}
return true;
}
@Override
public int hashCode()
{
int result = (int) (movieId ^ (movieId >>> 32));
result = 31 * result + (director != null ? director.hashCode() : 0);
result = 31 * result + (releaseYear != null ? releaseYear.hashCode() : 0);
result = 31 * result + (title != null ? title.hashCode() : 0);
return result;
}
}
| [
"anhnt@58PHP-NAMNT-PC.qsoft.com.vn"
] | anhnt@58PHP-NAMNT-PC.qsoft.com.vn |
23749d81e91b61f4cdbe40440697e52cceaf5fa3 | 93ea78374c4f7fc9f08ea83ff8232f5338c647c2 | /src/LanguageIdentification/CharNGramExtractor.java | 3295af7b01a8813569bdaa51b6dce7cb238109d5 | [] | no_license | manavs19/bilingual-identify-transliterate-FIRE-2014 | 65063e6691c1ac4e3e86f901356e148cb8097320 | 9df50f688166a5ed8fc336221648de8b919ddcdf | refs/heads/master | 2016-09-06T20:14:01.875621 | 2014-11-30T13:19:50 | 2014-11-30T13:19:50 | 26,351,657 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 722 | java | package LanguageIdentification;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
public class CharNGramExtractor
{
public static List<String> getGrams(String word, int gramLength)
{
List<String> grams = new ArrayList<String>();
if(gramLength > 1)
word = "_" + word + "_";
for(int i = 0; i <= word.length() - gramLength; ++i)
{
grams.add(word.substring(i, i+gramLength));
}
return grams;
}
public static Vector createNGramVector(String word, Set<Integer> gramLengths)
{
Vector v = new Vector();
for(int gramLength : gramLengths)
{
List<String> grams = getGrams(word, gramLength);
for(String gram : grams)
{
v.increment(gram);
}
}
return v;
}
}
| [
"manavcool.sethi@gmail.com"
] | manavcool.sethi@gmail.com |
7c46b40cde998042d7d714cec0d3b1daaba0bd45 | 4354111f5c6021e09cdb0539cdade085d014e2f4 | /app/src/main/java/com/derrick/park/criminalmind/CrimeFragment.java | a6327f725427f020c39b2293555a005d0d3d2477 | [] | no_license | yuria-n/CriminalMind | 73abea72d958bb2d20eb2554c5df34f3b8e0b8b4 | 4767753b0359313576fdca019939a0307c4f2a18 | refs/heads/master | 2021-06-18T15:50:47.050313 | 2017-06-08T22:41:45 | 2017-06-08T22:41:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,068 | java | package com.derrick.park.criminalmind;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import java.util.UUID;
import static android.widget.CompoundButton.OnCheckedChangeListener;
/**
* Created by park on 2017-05-31.
*/
public class CrimeFragment extends Fragment {
private Crime mCrime;
private EditText mTitleField;
private Button mDateButton;
private CheckBox mSolvedCheckBox;
// lifecycle
public static final String EXTRA_ID = "com.derrick.park.criminalmind.id";
// create and return intent with EXTRA_ID
public static Intent newIntent(Context context, String id) {
Intent intent = new Intent(context, CrimeActivity.class);
intent.putExtra(EXTRA_ID, id);
return intent;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mCrime = new Crime();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_crime, container, false);
// get id and convert to UUID
String mId = getActivity().getIntent().getStringExtra(CrimeListFragment.EXTRA_ID);
UUID id = UUID.fromString(mId);
CrimeLab crimes = CrimeLab.get(getContext());
mCrime = crimes.getCrime(id);
mTitleField = (EditText) v.findViewById(R.id.crime_title);
mTitleField.setText(mCrime.getTitle());
mTitleField.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
//
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
mCrime.setTitle(s.toString());
}
@Override
public void afterTextChanged(Editable s) {
//
}
});
mDateButton = (Button) v.findViewById(R.id.crime_date);
mDateButton.setText(mCrime.getDate().toString());
mDateButton.setEnabled(false);
mSolvedCheckBox = (CheckBox) v.findViewById(R.id.crime_solved);
// crime_solved check buttton
if (mCrime.isSolved()) {
mSolvedCheckBox.setChecked(true);
} else {
mSolvedCheckBox.setChecked(false);
}
mSolvedCheckBox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mCrime.setSolved(isChecked);
}
});
return v;
}
}
| [
"berrylily.0709@gmail.com"
] | berrylily.0709@gmail.com |
5e6facd8463468d42adb6bb45a984f93041b83fe | febf2d3b25fe0eb72bd8863e93afaa42cde41d90 | /src/main/java/me/kingtux/javalinvc/rg/ResourceGrabber.java | aa628cea59489ff5f0ff0709416e1d2709eac65d | [] | no_license | wyatt-herkamp/javalinvc | 506a0baaa3385c2fd22195a18916e3eef8c3d264 | b6b8ba2a8ff7b1b6f8db48e1ae37de91a17d22e4 | refs/heads/master | 2023-04-15T00:40:39.345870 | 2021-01-22T15:26:55 | 2021-01-22T15:26:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 507 | java | package me.kingtux.javalinvc.rg;
import java.net.URL;
import java.util.Optional;
/**
* What is a template grabber you may ask?
* Well it grabs the template file! and returns the file name
*
* @author KingTux
*/
public interface ResourceGrabber {
/**
* Returns a resource based on the path
* @param s the path to the file.
* @return The Resource null if not found
*/
Optional<Resource> getResource(String s);
String getLocation();
void setLocation(String s);
}
| [
"wherkamp@kingtux.me"
] | wherkamp@kingtux.me |
921f255b33e4b70c3bb0d3bab607681321e930ad | d847711f8fd52991015b4ba1d186f300ab0c3a84 | /ProjectEuler/pe4/PE4.java | a9849b992d0d067420a80c80d0ce62bc26f8d1e9 | [] | no_license | jchernjr/code | 702c29b802ff489347699643159ef22667c4d1a0 | 8b3706ecb8472b8c73cda5fdb26554c8d5cea74c | refs/heads/master | 2023-03-16T02:04:52.034845 | 2023-03-13T02:21:30 | 2023-03-13T02:21:30 | 21,483,805 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,327 | java | import java.util.ArrayList;
import java.util.List;
import java.util.Collections;
public class PE4 {
private static final int MAX_NUM = 9999;
private static final int MIN_NUM = 100;
public static void main(String[] args) {
doTest();
doProblem();
}
private static void doTest() {
verifyPalindrome(0, true);
verifyPalindrome(1, true);
verifyPalindrome(11, true);
verifyPalindrome(10, false);
verifyPalindrome(100, false);
verifyPalindrome(101, true);
verifyPalindrome(1001, true);
verifyPalindrome(1021, false);
verifyPalindrome(12321, true);
verifyPalindrome(12331, false);
verifyPalindrome(123321, true);
verifyPalindrome(123421, false);
verifyPalindrome(12344321, true);
verifyPalindrome(12343321, false);
verifyPalindrome(1222, false);
verifyPalindrome(111111, true);
}
private static void verifyPalindrome(int number, boolean expected) {
final boolean actual = isPalindrome(number);
System.out.println("Is " + number + " a palindrome? " + actual + " " + (actual == expected ? "OK" : "**ERROR**"));
}
private static void doProblem() {
List<Integer> sortedPals = palindromes(MIN_NUM, MAX_NUM);
System.out.println("Largest pal: " + sortedPals.get(sortedPals.size() - 1));
}
private static List<Integer> palindromes(int min, int max) {
final List<Integer> list = new ArrayList<>();
for (int i = max; i >= min; i--) {
for (int j = max; j >= i; j--) {
if (isPalindrome(i*j)) {
list.add(i*j);
}
}
}
Collections.sort(list);
return list;
}
private static boolean isPalindrome(int num) {
final int N_DIGITS = 10;
final int[] digits = new int[N_DIGITS]; // 32-bit integers can hold up to single billions, i.e. 10 digits
int highestDigit = 0; // index of the highest non-zero digit
// start from the right-most digit
for (int i = 0; i < N_DIGITS; i++) {
highestDigit = i;
digits[i] = num % 10;
num /= 10;
if (num == 0) { // no more non-zero digits
break;
}
}
// compare digits for symmetry
final int n = (highestDigit + 1); // 0-index to 1-index
for (int i = 0; i < n/2; i++) {
if (digits[i] != digits[n-i-1]) {
return false;
}
}
return true;
}
}
| [
"jchern@yahoo-inc.com"
] | jchern@yahoo-inc.com |
2a932cc4bfd1e2ca298678d8f37aad77e658c61f | 03f5a1282b4d66e70dc68a37d7811167443dd786 | /src/main/java/com/jinho/ex02/member/serviceImpl/MemberServiceImpl.java | 0db7890881119a7e8b6ff28ae943406bef254345 | [] | no_license | choqqd/ex02 | 9e230172651991db1cd110ed0a91434193caa413 | ad4a2d0f31bb70b63bca100b5f9887e399fa7031 | refs/heads/master | 2023-05-30T19:07:35.967523 | 2021-06-08T23:58:40 | 2021-06-08T23:58:40 | 374,942,879 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 981 | java | package com.jinho.ex02.member.serviceImpl;
import java.util.List;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import com.jinho.ex02.member.service.MemberService;
import com.jinho.ex02.member.vo.MemberVO;
// @Repository @Component @Service로 사용가능
@Repository("memberDao")
public class MemberServiceImpl implements MemberService{
@Autowired
private SqlSession sqlSession;
@Override
public List<MemberVO> memberSelectList() {
return sqlSession.selectList("memberListSelect");
}
@Override
public MemberVO memberSelect(MemberVO vo) {
return null;
}
@Override
public int memberInsert(MemberVO vo) {
return sqlSession.insert("memberInsert",vo);
}
@Override
public int memberUpdate(MemberVO vo) {
return 0;
}
@Override
public int memberDelete(MemberVO vo) {
return 0;
}
}
| [
"admin@DESKTOP-2NVHVIH"
] | admin@DESKTOP-2NVHVIH |
4687891fdf6b2b5c8c412021a661acf972d1bf01 | 342fb641b4b7f2581cc49e769edbfb87353dc8b5 | /src/com/sbs/example/demo/factory/Factory.java | cee47d57b6734a1a96b88fad6fc90e67909b163e | [] | no_license | dlagusgh1/java-ssg2 | 57f789342466b1bbb1a13bbc981d000d0f0c9c5c | bf55b40aa4d0da60cdcdeaba9c7799d5edf005f9 | refs/heads/master | 2022-11-10T22:41:15.135561 | 2020-06-19T11:55:29 | 2020-06-19T11:55:29 | 273,208,181 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,343 | java | package com.sbs.example.demo.factory;
import java.util.Scanner;
import com.sbs.example.demo.controller.Session;
import com.sbs.example.demo.dao.ArticleDao;
import com.sbs.example.demo.dao.CommentDao;
import com.sbs.example.demo.dao.MemberDao;
import com.sbs.example.demo.db.DBConnection;
import com.sbs.example.demo.service.ArticleService;
import com.sbs.example.demo.service.BuildService;
import com.sbs.example.demo.service.CommentService;
import com.sbs.example.demo.service.MemberService;
public class Factory {
private static Session session;
private static DBConnection dbConnection;
private static BuildService buildService;
private static ArticleService articleService;
private static ArticleDao articleDao;
private static MemberService memberService;
private static MemberDao memberDao;
private static CommentService commentService;
private static CommentDao commentDao;
private static Scanner scanner;
public static DBConnection getDBConnection() {
if (dbConnection == null) {
dbConnection = new DBConnection();
}
return dbConnection;
}
public static Session getSession() {
if (session == null) {
session = new Session();
}
return session;
}
public static Scanner getScanner() {
if (scanner == null) {
scanner = new Scanner(System.in);
}
return scanner;
}
public static ArticleService getArticleService() {
if (articleService == null) {
articleService = new ArticleService();
}
return articleService;
}
public static ArticleDao getArticleDao() {
if (articleDao == null) {
articleDao = new ArticleDao();
}
return articleDao;
}
public static MemberService getMemberService() {
if (memberService == null) {
memberService = new MemberService();
}
return memberService;
}
public static MemberDao getMemberDao() {
if (memberDao == null) {
memberDao = new MemberDao();
}
return memberDao;
}
public static BuildService getBuildService() {
if (buildService == null) {
buildService = new BuildService();
}
return buildService;
}
public static CommentService getCommentService() {
if (commentService == null) {
commentService = new CommentService();
}
return commentService;
}
public static CommentDao getCommentDao() {
if (commentDao == null) {
commentDao = new CommentDao();
}
return commentDao;
}
} | [
"dlagusgh1@naver.com"
] | dlagusgh1@naver.com |
d382037ec37c05d49692b3385bbbc75a5f8a47ff | 1b636c270d18ad364a16b1b9e43ffa1c3be439bf | /build/generated/jax-wsCache/WSCFDBuilderPlus/com/ekomercio/edixcfdisecure/GetCFDIFromCFDTokenResponse.java | aaa552c6eb5e5f21efc5cc5e986cd63936a63e93 | [] | no_license | luismontes/WebFac | 5a966a755617e264a38036372363212d3e9089db | bdd478433b3d779f93ead8b0120034e721967ae3 | refs/heads/master | 2020-05-17T23:53:04.235892 | 2014-03-09T02:01:49 | 2014-03-09T02:01:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,704 | java |
package com.ekomercio.edixcfdisecure;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Clase Java para anonymous complex type.
*
* <p>El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="getCFDI_FromCFDTokenResult" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"getCFDIFromCFDTokenResult"
})
@XmlRootElement(name = "getCFDI_FromCFDTokenResponse")
public class GetCFDIFromCFDTokenResponse {
@XmlElement(name = "getCFDI_FromCFDTokenResult")
protected String getCFDIFromCFDTokenResult;
/**
* Obtiene el valor de la propiedad getCFDIFromCFDTokenResult.
*
* @return
* possible object is
* {@link String }
*
*/
public String getGetCFDIFromCFDTokenResult() {
return getCFDIFromCFDTokenResult;
}
/**
* Define el valor de la propiedad getCFDIFromCFDTokenResult.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setGetCFDIFromCFDTokenResult(String value) {
this.getCFDIFromCFDTokenResult = value;
}
}
| [
"montesluis.30@gmail.com"
] | montesluis.30@gmail.com |
91492e4341231e62b21400c523509d215d429cc2 | bb34d1f3b4f4b8678c4f56b51e2b073adb156269 | /P1/P01/src/java/com/ifsp/prova/model/Usuario.java | 06a17a7e231c8a35e510676df2424b8e45bd7982 | [] | no_license | danielfssz/sistemas-web-java | ca47e97fa9effb158014a38df76e6f6057c2b676 | 42eced30ede6327d73a63ee519cec147b8a42d2a | refs/heads/master | 2021-07-18T21:11:29.498464 | 2018-12-08T18:33:26 | 2018-12-08T18:33:26 | 143,554,434 | 0 | 1 | null | 2018-08-18T16:52:06 | 2018-08-04T18:53:45 | Java | UTF-8 | Java | false | false | 875 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.ifsp.prova.model;
/**
*
* @author aluno
*/
public class Usuario {
Integer id;
String Nome;
String Login;
String Senha;
public String getSenha() {
return Senha;
}
public void setSenha(String Senha) {
this.Senha = Senha;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getNome() {
return Nome;
}
public void setNome(String Nome) {
this.Nome = Nome;
}
public String getLogin() {
return Login;
}
public void setLogin(String Login) {
this.Login = Login;
}
}
| [
"danielfss98@gmail.com"
] | danielfss98@gmail.com |
87ad1247c35476737bf65d3419d15aaa0131d732 | 18ee16ea806c89058720346392b34735007e95ac | /src/com/wolf/wolfsafe/receiver/KillAllReceiver.java | 1ef1194b9021f7283fe184df9c4f08adcd64596d | [] | no_license | zlmone/SmartSafe | 6bc42bde07bb3d742b21474b994eb4594981f8da | e9bfe4dc5ab21a5b63a5d55fdf2463323aa97559 | refs/heads/master | 2021-05-31T10:51:26.624432 | 2016-04-26T10:30:31 | 2016-04-26T10:30:37 | null | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 715 | java | package com.wolf.wolfsafe.receiver;
import java.util.List;
import android.app.ActivityManager;
import android.app.ActivityManager.RunningAppProcessInfo;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
public class KillAllReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
System.out.println("自定义的广播消息接收到了");
ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
List<RunningAppProcessInfo> infos = am.getRunningAppProcesses();
for(RunningAppProcessInfo info : infos) {
am.killBackgroundProcesses(info.processName);
}
}
}
| [
"1106002609@qq.com"
] | 1106002609@qq.com |
fcf7235b12b355d17e3974e58efc32e16b4db311 | 413a4724151351a058cc7cf363fc2bb20592aea1 | /src/main/java/com/wehaul/controller/ClientController.java | 08c1ad22886aa929fc581ae13717251a24be136d | [] | no_license | peeyushy/WeHaul | 9bbf9fde60a2e5d23cd6c49b4b12585c0156be43 | f6d984e41bb480c968a6076483808e27d0cd3846 | refs/heads/master | 2020-04-27T20:23:17.535494 | 2019-08-05T10:42:28 | 2019-08-05T10:42:28 | 174,655,522 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,873 | java | package com.wehaul.controller;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.wehaul.constants.AppConstants;
import com.wehaul.model.Client;
import com.wehaul.service.*;
@Controller
public class ClientController {
@Autowired
ClientService clientService;
@Autowired
UserService userService;
@Autowired
VehicleTypeService vehicleService;
@Autowired
LoadTypeService loadService;
@Autowired
RequirementService reqService;
@RequestMapping(value = "/find-client", method = RequestMethod.GET)
public String getClientsByType(ModelMap model, @RequestParam String type) {
model.put("clients", clientService.getClientsByType(type));
model.put("clientTypeMap", AppConstants.getClientType());
model.put("cityMap", AppConstants.getCityMap());
return "find-client";
}
@RequestMapping(value = "/search-client", method = RequestMethod.GET)
public String getAllExceptAdminAndLoggedInClients(ModelMap model, @RequestParam String q) {
model.put("clients", clientService.getAllActiveExceptLoggedInANDAdminClients(
userService.getLoggedinUserObj().getClient().getClientid(), q));
model.put("cityMap", AppConstants.getCityMap());
model.put("clientTypeMap", AppConstants.getClientType());
return "find-client";
}
@RequestMapping(value = "/clients", method = RequestMethod.GET)
public String getAllClients(ModelMap model) {
if (userService.getLoggedinUserObj().getRole().getRolename().equals(AppConstants.RoleNames.ADMIN)) {
// Admin see all clients
model.put("clients", clientService.getAllClients());
} else {
model.put("clients", clientService.getAllActiveExceptLoggedInANDAdminClients(
userService.getLoggedinUserObj().getClient().getClientid()));
}
model.put("cityMap", AppConstants.getCityMap());
model.put("clientTypeMap", AppConstants.getClientType());
return "find-client";
}
@RequestMapping(value = "/delete-client", method = RequestMethod.GET)
public String deleteClient(ModelMap model, @RequestParam String type, @RequestParam String id,
final RedirectAttributes redirectAttributes) {
String msg = "Client " + clientService.getClient(id).getClientname() + " deleted successfully!";
clientService.deleteClient(id);
redirectAttributes.addFlashAttribute("msg", msg);
return "redirect:/clients";
}
@RequestMapping(value = "/add-client", method = RequestMethod.GET)
public String showAddClientPage(ModelMap model) {
model.put("action", "Add");
model.put("client", new Client());
model.put("clientTypeMap", AppConstants.getClientType());
model.put("cityMap", AppConstants.getCityMap());
return "client";
}
@RequestMapping(value = "/add-client", method = RequestMethod.POST)
public String addClient(ModelMap model, @Valid Client client, BindingResult result,
final RedirectAttributes redirectAttributes) {
model.put("action", "Add");
if (result.hasErrors()) {
return "client";
} else {
client.setWebuniquecode(client.getContactno());
client.setCreatedby(userService.getLoggedinUserObj().getUsername());
client.setLastupdatedby(userService.getLoggedinUserObj().getUsername());
clientService.addClient(client);
redirectAttributes.addFlashAttribute("msg", "Client " + client.getClientname() + " added successfully!");
return "redirect:/clients";
}
}
@RequestMapping(value = "/edit-client", method = RequestMethod.GET)
public String showEditClientPage(ModelMap model, @RequestParam String cid) {
model.put("action", "Edit");
Client client = clientService.getClient(cid);
model.put("requirements", reqService.getReqByClientId(cid));
model.put("clientTypeMap", AppConstants.getClientType());
model.put("cityMap", AppConstants.getCityMap());
model.put("client", client);
return "client";
}
@RequestMapping(value = "/edit-client", method = RequestMethod.POST)
public String updateClient(ModelMap model, @RequestParam String cid, @Valid Client client, BindingResult result,
final RedirectAttributes redirectAttributes) {
model.put("action", "Edit");
if (result.hasErrors()) {
return "client";
} else {
client.setWebuniquecode(client.getContactno());
client.setLastupdatedby(userService.getLoggedinUserObj().getUsername());
clientService.updateClient(cid, client);
// Add message to flash scope
redirectAttributes.addFlashAttribute("msg", "Client " + client.getClientname() + " updated successfully!");
return "redirect:/clients";
}
}
}
| [
"31182352+peeyushy@users.noreply.github.com"
] | 31182352+peeyushy@users.noreply.github.com |
130518446883fbc0129ed946f01bd0b6dbe8e048 | 7005a15d8beba8b60b40df0c6676d84251a3db38 | /src/nodes/RepeatNode.java | 6a6814d2f7e2c36ae72c8af849f97298bbc22d4d | [] | no_license | marcwue/CIP-HAW | 1de531102339d8ce48468fba0cf9fc7219e94de9 | 0ee6bdc61235c947ec737c9f651480ca9101e0d7 | refs/heads/master | 2016-09-05T15:12:28.128002 | 2012-06-24T18:40:14 | 2012-06-24T18:40:14 | 3,900,702 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,085 | java | /**
*
*/
package nodes;
import descriptoren.AbstractDescr;
import descriptoren.SymbolTable;
/**
* @author Marc Wüseke
*/
public class RepeatNode extends AbstractNode {
AbstractNode exp1 = null;
AbstractNode stateSeq1 = null;
/**
* @param exp1
* @param stateSeq1
*/
public RepeatNode(AbstractNode exp1, AbstractNode stateSeq1) {
super();
this.exp1 = exp1;
this.stateSeq1 = stateSeq1;
}
public AbstractDescr compile(SymbolTable table) {
int label = getNextLabelNumber();
write("LABEL, " + label);
stateSeq1.compile(table);
exp1.compile(table);
write("BF, " + label);
return null;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return indent() + "RepeatStatementNode " + exp1 + "\n" + stateSeq1
+ unindent();
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((exp1 == null) ? 0 : exp1.hashCode());
result = prime * result
+ ((stateSeq1 == null) ? 0 : stateSeq1.hashCode());
return result;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
RepeatNode other = (RepeatNode) obj;
if (exp1 == null) {
if (other.exp1 != null)
return false;
} else if (!exp1.equals(other.exp1))
return false;
if (stateSeq1 == null) {
if (other.stateSeq1 != null)
return false;
} else if (!stateSeq1.equals(other.stateSeq1))
return false;
return true;
}
}
| [
"ngk-ben@gmx.de"
] | ngk-ben@gmx.de |
09222f82c5ba6e1d6d679c1407ddc1b3419d5aef | 9a511080edb6a0b97eb0059572bc3026246d8a33 | /android/app/src/main/java/com/wealther_app/MainApplication.java | 3db7fcbe4d0980236563594ad69bbbbb1f46dc48 | [] | no_license | tonysodeep/rn-wealther-app | e352ca6ca1fe8f628d1c889cdfef6537126cbc4e | 67f13a51ad9465c989e52190ad7bc1ff3fbc8558 | refs/heads/master | 2023-08-03T01:06:24.337289 | 2021-09-18T09:50:10 | 2021-09-18T09:50:10 | 407,818,949 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,607 | java | package com.wealther_app;
import android.app.Application;
import android.content.Context;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost =
new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
return packages;
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
}
/**
* Loads Flipper in React Native templates. Call this in the onCreate method with something like
* initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
*
* @param context
* @param reactInstanceManager
*/
private static void initializeFlipper(
Context context, ReactInstanceManager reactInstanceManager) {
if (BuildConfig.DEBUG) {
try {
/*
We use reflection here to pick up the class that initializes Flipper,
since Flipper library is not available in release mode
*/
Class<?> aClass = Class.forName("com.wealther_app.ReactNativeFlipper");
aClass
.getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
.invoke(null, context, reactInstanceManager);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
}
| [
"hynguyen2727@gmail.com"
] | hynguyen2727@gmail.com |
30b7bc202682199ae69344b00b930d1220626bcf | 17215db25ba9fff4e7cb9614d7108e2642caaa93 | /src/test/java/base/TestBase.java | 65d85e18697c0b980034bbf80154eed72393e72a | [] | no_license | PawelPD/SeleniumTests | 8d5ccdccdebe214157fc90902d21e95e06808c8b | 078d9413d6e0d23c23102324e3f9a96fd823f5bd | refs/heads/master | 2023-06-02T05:19:34.471232 | 2021-06-14T22:59:11 | 2021-06-14T22:59:11 | 376,892,128 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,003 | java | package base;
import org.apache.commons.io.FileUtils;
import org.openqa.selenium.*;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.interactions.Actions;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.TimeUnit;
public class TestBase {
private static Properties prop;
public static ChromeDriver driver;
private static long PAGE_LOAD_TIMEOUT = 20;
public static void initialization() {
System.setProperty("webdriver.chrome.driver", "src\\main\\resources\\chromedriver.exe");
//ChromeOptions options = new ChromeOptions();
//options.addArguments("--window-size=1920,1080");
//options.addArguments("--headless", "--disable-gpu", "--window-size=1920,1200","--ignore-certificate-errors");
driver = new ChromeDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
}
/*
* Wczytanie ustawień z pliku properties
* */
public TestBase(){
try{
prop = new Properties();
FileInputStream ip = new FileInputStream("src\\config\\autoTests.properties");
prop.load(ip);
} catch (FileNotFoundException e){
e.printStackTrace();
} catch (IOException e){
e.printStackTrace();
}
}
public WebElement getElementById(String id){
return this.getElement(By.id(id));
}
public WebElement getElementByName(String name){
return this.getElement(By.name(name));
}
public WebElement getElementByCssSelector(String css){
return this.getElement(By.cssSelector(css));
}
public WebElement getElementByXpath(String xpath){
return this.getElement(By.xpath(xpath));
}
public WebElement getElement(By by){
WebElement element;
try{
element = driver.findElement(by);
}catch (Exception e){
element = null;
}
return element;
}
public List<WebElement> getSubElementsByCssSelector(WebElement parentElementm, String selector){
return this.getSubElements(parentElementm, By.cssSelector(selector));
}
public List<WebElement> getSubElements(WebElement parentElement, By by){
List<WebElement> elements;
try{
elements = parentElement.findElements(by);
}catch (Exception e){
elements = null;
}
return elements;
}
public boolean clickOnElement(WebElement element){
try {
element.click();
}catch (Exception e){
return false;
}
return true;
}
public String getElementText(WebElement element){
try{
return element.getText();
}catch (Exception e){
return "";
}
}
public boolean insertText(WebElement element, String textToInsert, long delayInMillis){
if(element != null){
for(char c : textToInsert.toCharArray()){
this.waitActionInMillis(delayInMillis);
element.sendKeys(""+c);
}
String textAfterInsert = element.getAttribute("value");
System.out.println("textToInsert: " + textToInsert + "\ntextAfterInsert: " + textAfterInsert);
return textToInsert.equals(textAfterInsert);
}
return false;
}
public void waitActionInMillis(long delayInMillis){
long startTime = System.currentTimeMillis();
long endTime = startTime + delayInMillis;
while(System.currentTimeMillis() < endTime){
;
}
}
public boolean waitForElement(boolean checkIfDisplayed, By by, long timeOutInSeconds){
long startTime = System.currentTimeMillis();
boolean isFound = false;
while(!isFound && !this.isTimeout(startTime, timeOutInSeconds)){
WebElement element = this.getElement(by);
if(checkIfDisplayed){
isFound = this.isElementDisplayed(element);
}
else {
isFound = element != null;
}
}
return isFound;
}
public boolean isElementDisplayed(WebElement element){
if(element == null)
return false;
return element.isDisplayed();
}
public boolean isTimeout(long oryginalTime, long timeOutInSeconds){
long waitTime = timeOutInSeconds *1000;
long endTime = oryginalTime + waitTime;
return (System.currentTimeMillis() > endTime);
}
public boolean waitForElementtoVanish(WebElement elementm, long timeOut){
long startTime = System.currentTimeMillis();
boolean isFound = this.isElementEnabled(elementm);
while (isFound && !this.isTimeout(startTime, timeOut)){
isFound = this.isElementEnabled(elementm);
}
return !isFound;
}
public boolean isElementEnabled(WebElement element){
if(element == null)
return false;
try{
return element.isEnabled();
}
catch(StaleElementReferenceException e){
return false;
}
}
public boolean waitForPageToLoadedOrInteractive(){
JavascriptExecutor js = (JavascriptExecutor) this.driver;
String pageLoadStatus = "";
boolean pageWasLoaded = false;
long startTime = System.currentTimeMillis();
do{
try{
/*
* zabezpiecznie jeśli wysyła za dużo requestów
* waitActionInMilliseconds(1000);
* */
pageLoadStatus = this.returnDocumentStatus();
} catch (Exception e){
e.printStackTrace();
}
if(pageLoadStatus.equals("complete") || pageLoadStatus.equals("interactive")){
pageWasLoaded = true;
}
System.out.println("pageLoadStatus: " + pageLoadStatus);
}while (!pageWasLoaded && !this.isTimeout(startTime,PAGE_LOAD_TIMEOUT));
return pageWasLoaded;
}
public String returnDocumentStatus(){
JavascriptExecutor js = (JavascriptExecutor) this.driver;
return (String) js.executeScript("return document.readyState");
}
public boolean scrollPageToElement(By endElement, long timeOutInSeconds){
boolean endOfPage = false;
long startTime = System.currentTimeMillis();
JavascriptExecutor js = (JavascriptExecutor) this.driver;
Actions actions = new Actions(driver);
while(!endOfPage && !isTimeout(startTime, timeOutInSeconds)){
actions.keyDown(Keys.CONTROL).sendKeys(Keys.END).perform();
endOfPage = this.waitForElement(true, endElement, 1);
waitActionInMillis(500);
}
return endOfPage;
}
public String getCurrentDate() {
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(Calendar.getInstance().getTime());
return timeStamp;
}
public void captureScreenshot() throws IOException {
try{
//((ChromeDriver) driver).executeScript("document.body.style.transform = 'scale(0.85)'");
TakesScreenshot ts = (TakesScreenshot) driver;
File source = ts.getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(source, new File("screenshots/"+getCurrentDate()+".png"));
System.out.println("Wykonano zrzut erkanu");
}catch (Exception e){
System.out.println("Wystapił wyjątek: " + e.getMessage());
}
}
public void openNewTab(WebDriver driver){
((JavascriptExecutor)driver).executeScript("window.open('about:blank','_blank');");
}
public ArrayList<String> getWindowHandlesAsArrayList(WebDriver driver){
Set windowHandles = driver.getWindowHandles();
return new ArrayList<String>(windowHandles);
}
public String getNewWindowHandle(WebDriver driver){
ArrayList<String> currentWindowHandles = getWindowHandlesAsArrayList(driver);
int lastPosition = currentWindowHandles.size()-1;
return currentWindowHandles.get(lastPosition);
}
public boolean clickUntilInteractable(WebElement element, long timeOutInSeconds){
long startTime = System.currentTimeMillis();
boolean success = false;
while(!success && !this.isTimeout(startTime, timeOutInSeconds))
try{
element.click();
success = true;
}catch (ElementNotInteractableException e){
try {
System.out.println("w pętli");
Thread.sleep(50);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
}
return success;
}
}
| [
"pawlo1508@o2.pl"
] | pawlo1508@o2.pl |
e3385e9365e62f87523b473bcb2808b4004fb648 | 3b5aa3cdc0a442548eae854956b9cefb76801c21 | /src/main/java/pl/draciel/j2csharp/translator/csharp/TryStatementTranslator.java | 72565d7e319624213e07f79c967331c114de15d9 | [
"Apache-2.0"
] | permissive | Draciel/j2csharp | 6512cc3e285c129b03ff796d3c15badb29e5eb14 | 0191c321e789c10eb20034ac1fd221054bbc4013 | refs/heads/master | 2020-07-15T01:58:25.625478 | 2019-08-30T21:02:48 | 2019-08-30T21:02:57 | 205,454,120 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,237 | java | package pl.draciel.j2csharp.translator.csharp;
import pl.draciel.j2csharp.data.Statement;
import pl.draciel.j2csharp.translator.ComponentTranslator;
import pl.draciel.j2csharp.utility.Nonnull;
final class TryStatementTranslator implements ComponentTranslator<Statement.TryStatement> {
private TryStatementTranslator() {
//no instance
}
public static TryStatementTranslator instance() {
return Holder.INSTANCE;
}
@Nonnull
@Override
public String translate(@Nonnull final Statement.TryStatement input, final int indentationCounter) {
final BlockTranslator blockTranslator = BlockTranslator.instance();
final CatchClauseTranslator catchClauseTranslator = CatchClauseTranslator.instance();
final StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(Utility.appendIndentation(indentationCounter))
.append("try")
.append(Codestyle.space())
.append("{")
.append(Codestyle.newLine())
.append(blockTranslator.translate(input.getTryBlock(), indentationCounter))
.append(Codestyle.newLine())
.append(Utility.appendIndentation(indentationCounter))
.append("}");
if (!input.getCatchClauseStatements().isEmpty()) {
input.getCatchClauseStatements()
.forEach(ccs -> stringBuilder.append(catchClauseTranslator.translate(ccs, indentationCounter)));
}
if (input.getFinallyBlock() != null) {
stringBuilder.append(Codestyle.space())
.append("finally")
.append(Codestyle.space())
.append("{")
.append(Codestyle.newLine())
.append(blockTranslator.translate(input.getFinallyBlock(), indentationCounter))
.append(Codestyle.newLine())
.append(Utility.appendIndentation(indentationCounter))
.append("}");
}
return stringBuilder.toString();
}
private static final class Holder {
private static final TryStatementTranslator INSTANCE = new TryStatementTranslator();
}
}
| [
"jakub.t.tyrka@gmail.com"
] | jakub.t.tyrka@gmail.com |
8752c3ee18af310ec456e135e2c614f611c495d4 | 244eb3631f797c93e95ec5cb055e8fd1cba90c13 | /src/himanshu/in/Entities/ForkTop.java | 835d47c35e60b9e02a4745fb33edf5d29b20382e | [] | no_license | Himkush/Mind-The-Bird | ba94e494c3bdca33fe5b23fdd41c97bfdb8cbb86 | 933f7dd847f345ead16c428100d870156ba988df | refs/heads/master | 2021-04-15T15:00:03.171349 | 2019-07-27T16:22:46 | 2019-07-27T16:22:46 | 126,628,000 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 299 | java | package himanshu.in.Entities;
import himanshu.in.resources.Resources;
public class ForkTop extends Entity {
public ForkTop(int x, int y) {
super(x, y);
this.height = 371;
this.width = 33;
this.xVel = -8;
this.image = Resources.forkHandleTop;
}
}
| [
"himkushwaha08@gmail.com"
] | himkushwaha08@gmail.com |
2acc446df3f3614561e57b2117dba7656e0b6b20 | eb8bb065fb731a8752c7d01477fefa8eb9c12474 | /javaagent/client_mock/src/main/java/org/wbq/javaagent/client/controller/Hello.java | ba1518be570097dd4327c7a83900fe5d2d8c992e | [] | no_license | wangbinquan/feature-demo | 5afcc8c7df7fce5f38ca192d28413a576042197f | 34f38e2f3a6a8dc27b61d29efcfd8c7b76f78154 | refs/heads/master | 2023-04-27T23:25:34.501668 | 2022-07-07T13:12:23 | 2022-07-07T13:12:23 | 103,749,473 | 4 | 3 | null | null | null | null | UTF-8 | Java | false | false | 358 | java | package org.wbq.javaagent.client.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class Hello {
@GetMapping(value = "/hello")
public String hello() {
System.out.println("Call Hello Func");
return "hello mock world";
}
}
| [
"wang_wbq@163.com"
] | wang_wbq@163.com |
e8891be90a1d15e70cd27d9dd0ee1d1ea6424f05 | c4f86ef2844f08d64b9e19e4667be12db88a2cd9 | /gui/src/main/java/org/jboss/as/console/client/shared/general/model/Interface.java | 2a44b6e7431f78124f98fe7227aa76a5e6a5c68e | [] | no_license | n1hility/console | c41a1bcdc0fee4331ff204f57a9f1417125b7d9f | d7b1f97d55f3a33aa3cb5ca0d6300dcf5248cb5b | refs/heads/master | 2021-01-18T22:32:41.799336 | 2012-02-10T20:58:34 | 2012-02-13T08:04:56 | 2,305,576 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,188 | java | /*
* JBoss, Home of Professional Open Source
* Copyright 2011 Red Hat Inc. and/or its affiliates and other contributors
* as indicated by the @author tags. All rights reserved.
* See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions
* of the GNU Lesser General Public License, v. 2.1.
* This program is distributed in the hope that it will be useful, but WITHOUT A
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public License,
* v.2.1 along with this distribution; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
package org.jboss.as.console.client.shared.general.model;
import org.jboss.as.console.client.widgets.forms.Address;
import org.jboss.as.console.client.widgets.forms.Binding;
/**
* @author Heiko Braun
* @date 5/17/11
*/
@Address("/interface={0}")
public interface Interface {
static String ANY_ADDRESS = "Any Address";
static String ANY_IP4 = "Any IP4";
static String ANY_IP6 = "Any IP6";
String getName();
void setName(String name);
@Binding(detypedName = "any-address")
boolean isAnyAddress();
void setAnyAddress(boolean b);
@Binding(detypedName = "any-ipv6-address")
boolean isAnyIP6Address();
void setAnyIP6Address(boolean b);
@Binding(detypedName = "any-ipv4-address")
boolean isAnyIP4Address();
void setAnyIP4Address(boolean b);
@Binding(expr = true, detypedName = "inet-address")
String getInetAddress();
void setInetAddress(String addr);
@Binding(detypedName = "loopback")
boolean isLoopback();
void setLoopback(boolean b);
@Binding(detypedName = "loopback-address", expr = true)
String getLoopbackAddress();
void setLoopbackAddress(String addr);
boolean isMulticast();
void setMulticast(boolean b);
@Binding(expr = true)
String getNic();
void setNic(String addr);
@Binding(expr = true, detypedName = "nic-match")
String getNicMatch();
void setNicMatch(String addr);
@Binding(detypedName = "point-to-point")
boolean isPointToPoint();
void setPointToPoint(boolean b);
@Binding(detypedName = "public-address")
boolean isPublicAddress();
void setPublicAddress(boolean b);
@Binding(detypedName = "site-local-address")
boolean isSiteLocal();
void setSiteLocal(boolean b);
@Binding(detypedName = "link-local-address")
boolean isLinkLocal();
void setLinkLocal(boolean b);
@Binding(expr = true, detypedName = "subnet-match")
String getSubnetMatch();
void setSubnetMatch(String addr);
boolean isUp();
void setUp(boolean b);
boolean isVirtual();
void setVirtual(boolean b);
// transient
@Binding(skip = true)
String getAddressWildcard();
void setAddressWildcard(String selector);
}
| [
"ike.braun@googlemail.com"
] | ike.braun@googlemail.com |
4c556cee7cca4dd9a4a7123bef9bbe6363cb2921 | 05fe12dae92848ca1cca8fcfd0c153338de2d219 | /PhoneApp/Messages.java | 182bed1286985607cbab7fec52bd73a6c9897494 | [] | no_license | mariagutierrezm/Java | 27b0f958ebf91f3d0434567bc5dfe69a215b9b3c | 4ba00c34400ccf0a06962d3d5f57b4206c69e000 | refs/heads/master | 2022-12-27T15:38:25.253818 | 2020-10-14T10:36:37 | 2020-10-14T10:36:37 | 274,881,576 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 633 | java | package org.mycode.phone;
public class Messages {
private int id;
private String message;
private String recipient;
public Messages(int id, String message, String recipient) {
super();
this.id = id;
this.message = message;
this.recipient = recipient;
}
void getDetails() {
System.out.println("Messages: " + message + "To: " + recipient);
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getRecipient() {
return recipient;
}
public void setRecipient(String recipient) {
this.recipient = recipient;
}
}
| [
"gutierrez.mari90@gmail.com"
] | gutierrez.mari90@gmail.com |
1182fc8a7359472d9dd7cc6c7a8ae16a0e5773f4 | 7a036a03179ea4dc07f2371e3a144b1c0857185a | /app/src/main/java/uk/ac/reading/cs2ja16/PDot.java | 8537bf5a82f45b7e2270726ec61c0abcd8224068 | [] | no_license | J3B60/Java-Android-Game-Final-Project | 5564c89cb7022cbbdd6daa56270aa0c0ee7795fc | dbf9cc5893a52e5367defd228136442d9fde1051 | refs/heads/master | 2023-05-10T19:17:14.348487 | 2021-05-20T10:41:13 | 2021-05-20T10:41:13 | 341,575,085 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 720 | java | package uk.ac.reading.cs2ja16;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
public class PDot extends Collectible {
public void incrementPDotCounter(){};
public Bitmap Sprite;
public int posx;
public int posy;
public PDot(GameView gv, int x, int y){
BitmapFactory.Options options = new BitmapFactory.Options();
options.inScaled = false;//remove blur
Sprite = (BitmapFactory.decodeResource(gv.getResources(), R.drawable.pacdot, options));//load sprite
posx = x;// set the x coord
posy = y;//set the y coord
}
@Override
void addToCounter() {
//+10
}
@Override
void collectedByPlayer() {
}
}
| [
"milan.lac@hotmail.com"
] | milan.lac@hotmail.com |
018a07d9819d47507fea4fecef24ec66dc8b4697 | 4e4379e9d15dde1de7b0481a5a7fa5aaaf84dff3 | /mvvmDagger/src/main/java/cz/lebedev/mvapp/DataViewModel.java | 37c9ba465a54f7f5ce78410edf41f29d0d44360c | [] | no_license | peterlebedev/mvxapps | 0ecbb5167a39507352fa8e58eb331766b5728ef4 | abe951d571d48623faee7ace70abb255fc4ab6c2 | refs/heads/master | 2020-04-05T13:53:40.201616 | 2018-12-10T11:37:01 | 2018-12-10T11:37:01 | 156,914,443 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,112 | java | package cz.lebedev.mvapp;
import android.app.Application;
import android.os.Handler;
import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import javax.inject.Inject;
public class DataViewModel extends AndroidViewModel {
public MutableLiveData<String> data = new MutableLiveData<String>();
DataModel dataModel;
@Inject
public DataViewModel(Application app){
super(app);
dataModel = new DataModel();
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
reload();
}
},2000); }
private void reload() {
String dataFromModel = dataModel.getData();
data.postValue(dataFromModel);
}
public LiveData<String> getData() {
return data;
}
public void setData(String s) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
dataModel.setData(s);
reload();
}
},2000);
}
}
| [
"lebede.peter@gmail.com"
] | lebede.peter@gmail.com |
eaf28a5cc90bdb0450a8292424c01de4d64b67af | 5312ec3caf7aa02968a7b0899f0ad4c8bc155674 | /kripton-processor/src/test/java/sqlite/feature/join/TestJoinFeatureSuite.java | 7f5d339fd3e552e1f24da1906201bd83f71a0c15 | [
"Apache-2.0"
] | permissive | xcesco/kripton | 90657215d5e4a37f694c82fbd25a4691091e2c65 | 1995bf462677d7de993c50de31f01c9e5f13603f | refs/heads/master | 2023-01-21T20:28:29.373376 | 2023-01-04T14:57:00 | 2023-01-04T14:57:00 | 31,342,939 | 134 | 19 | Apache-2.0 | 2023-01-04T14:57:01 | 2015-02-26T00:24:15 | Java | UTF-8 | Java | false | false | 1,129 | java | /*******************************************************************************
* Copyright 2015, 2017 Francesco Benincasa (info@abubusoft.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
package sqlite.feature.join;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import base.BaseProcessorTest;
/**
* The Class TestJoinFeatureSuite.
*/
@RunWith(Suite.class)
//@formatter:off
@Suite.SuiteClasses(
{
TestJoin.class
})
//@formatter:on
public class TestJoinFeatureSuite extends BaseProcessorTest {
}
| [
"abubusoft@gmail.com"
] | abubusoft@gmail.com |
9fbc9881df96e89f00cb6eb72f714c99b3374548 | d476bcc063f663d06ea29e52ffe4f8c5ac0762f4 | /mavcom/src/main/java/org/mavlink/messages/lquac/msg_play_tune_v2.java | 95b9615128ffef39ac0709a2f9247b571273577c | [] | no_license | Stevesies/mavcom | 1d80dd623cd1f543ef4f8dc46a8fb0c6f84783cf | b0cd1b921016658dafae2b4936b898c665784421 | refs/heads/master | 2023-01-23T05:57:10.648842 | 2020-11-30T08:53:20 | 2020-11-30T08:53:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,316 | java | /**
* Generated class : msg_play_tune_v2
* DO NOT MODIFY!
**/
package org.mavlink.messages.lquac;
import org.mavlink.messages.MAVLinkMessage;
import org.mavlink.IMAVLinkCRC;
import org.mavlink.MAVLinkCRC;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import org.mavlink.io.LittleEndianDataInputStream;
import org.mavlink.io.LittleEndianDataOutputStream;
/**
* Class msg_play_tune_v2
* Play vehicle tone/tune (buzzer). Supersedes message PLAY_TUNE.
**/
public class msg_play_tune_v2 extends MAVLinkMessage {
public static final int MAVLINK_MSG_ID_PLAY_TUNE_V2 = 400;
private static final long serialVersionUID = MAVLINK_MSG_ID_PLAY_TUNE_V2;
public msg_play_tune_v2() {
this(1,1);
}
public msg_play_tune_v2(int sysId, int componentId) {
messageType = MAVLINK_MSG_ID_PLAY_TUNE_V2;
this.sysId = sysId;
this.componentId = componentId;
payload_length = 254;
}
/**
* Tune format
*/
public long format;
/**
* System ID
*/
public int target_system;
/**
* Component ID
*/
public int target_component;
/**
* Tune definition as a NULL-terminated string.
*/
public char[] tune = new char[248];
public void setTune(String tmp) {
int len = Math.min(tmp.length(), 248);
for (int i=0; i<len; i++) {
tune[i] = tmp.charAt(i);
}
for (int i=len; i<248; i++) {
tune[i] = 0;
}
}
public String getTune() {
String result="";
for (int i=0; i<248; i++) {
if (tune[i] != 0) result=result+tune[i]; else break;
}
return result;
}
/**
* Decode message with raw data
*/
public void decode(LittleEndianDataInputStream dis) throws IOException {
format = (int)dis.readInt()&0x00FFFFFFFF;
target_system = (int)dis.readUnsignedByte()&0x00FF;
target_component = (int)dis.readUnsignedByte()&0x00FF;
for (int i=0; i<248; i++) {
tune[i] = (char)dis.readByte();
}
}
/**
* Encode message with raw data and other informations
*/
public byte[] encode() throws IOException {
byte[] buffer = new byte[12+254];
LittleEndianDataOutputStream dos = new LittleEndianDataOutputStream(new ByteArrayOutputStream());
dos.writeByte((byte)0xFD);
dos.writeByte(payload_length & 0x00FF);
dos.writeByte(incompat & 0x00FF);
dos.writeByte(compat & 0x00FF);
dos.writeByte(packet & 0x00FF);
dos.writeByte(sysId & 0x00FF);
dos.writeByte(componentId & 0x00FF);
dos.writeByte(messageType & 0x00FF);
dos.writeByte((messageType >> 8) & 0x00FF);
dos.writeByte((messageType >> 16) & 0x00FF);
dos.writeInt((int)(format&0x00FFFFFFFF));
dos.writeByte(target_system&0x00FF);
dos.writeByte(target_component&0x00FF);
for (int i=0; i<248; i++) {
dos.writeByte(tune[i]);
}
dos.flush();
byte[] tmp = dos.toByteArray();
for (int b=0; b<tmp.length; b++) buffer[b]=tmp[b];
int crc = MAVLinkCRC.crc_calculate_encode(buffer, 254);
crc = MAVLinkCRC.crc_accumulate((byte) IMAVLinkCRC.MAVLINK_MESSAGE_CRCS[messageType], crc);
byte crcl = (byte) (crc & 0x00FF);
byte crch = (byte) ((crc >> 8) & 0x00FF);
buffer[264] = crcl;
buffer[265] = crch;
dos.close();
return buffer;
}
public String toString() {
return "MAVLINK_MSG_ID_PLAY_TUNE_V2 : " + " format="+format
+ " target_system="+target_system
+ " target_component="+target_component
+ " tune="+getTune()
;}
}
| [
"ecm@gmx.de"
] | ecm@gmx.de |
e09aed59f497e4880b96bc74890c0e654ca55419 | 3ea09b1e3d6b4c6b173f503e7cada78578bba3f5 | /src/com/vsoued/gtd/GTDDB.java | 0aaefec6f0f7c4494182e62c34031b741e1784d9 | [] | no_license | vsoued/GTD | 5b542ad762c375d456525a81059e8a1ef9cc075b | 413d3284f9835b4ec1048bd64c3c3257d77b178f | refs/heads/master | 2021-01-20T12:16:57.510442 | 2013-05-24T19:10:01 | 2013-05-24T19:10:01 | 8,013,427 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,790 | java | package com.vsoued.gtd;
import java.util.HashMap;
import com.vsoued.gtd.Tasks.Accounts;
import com.vsoued.gtd.Tasks.Task;
import android.accounts.Account;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;
public class GTDDB {
private DBHelper helper;
private SQLiteDatabase db;
/**
*
* @param context
*/
public GTDDB(Context context){
helper = new DBHelper(context);
//db = helper.getWritableDatabase();
}
public void open() throws SQLException {
db = helper.getWritableDatabase();
}
public void close() {
helper.close();
}
public long createTask(String subject, String description, String folder, int priority, int project_id, String path){
Log.i("DB", "INSERTING IN = "+folder);
ContentValues values = new ContentValues();
values.put(Task.COLUMN_NAME_SUBJECT, subject);
values.put(Task.COLUMN_NAME_DESCRIPTION, description);
values.put(Task.COLUMN_NAME_FOLDER, folder);
values.put(Task.COLUMN_NAME_PATH, path);
// values.put(Task.COLUMN_NAME_TAG, tag);
values.put(Task.COLUMN_NAME_PRIORITY, priority);
values.put(Task.COLUMN_NAME_PROJECT_ID, project_id);
Long time = Long.valueOf(System.currentTimeMillis());
values.put(Task.COLUMN_NAME_CREATE_DATE, time);
values.put(Task.COLUMN_NAME_MODIFICATION_DATE, time);
return db.insert(Task.TABLE_NAME_TASKS, null, values);
}
public long addAccount(String user, String password, String imap_host, String imap_port, String smtp_host, String smtp_port){
ContentValues values = new ContentValues();
values.put(Accounts.COLUMN_NAME_USER, user);
values.put(Accounts.COLUMN_NAME_PASSWORD, password);
values.put(Accounts.COLUMN_NAME_IMAP_HOST, imap_host);
values.put(Accounts.COLUMN_NAME_IMAP_PORT, imap_port);
values.put(Accounts.COLUMN_NAME_SMTP_HOST, smtp_host);
values.put(Accounts.COLUMN_NAME_SMTP_PORT, smtp_port);
return db.insert(Accounts.TABLE_NAME_ACCOUNTS, null, values);
}
public Cursor getAccounts(){
String[] columns = new String[] {Accounts._ID, Accounts.COLUMN_NAME_USER, Accounts.COLUMN_NAME_PASSWORD};
Cursor cursor = db.query(Accounts.TABLE_NAME_ACCOUNTS,columns,null, null, null, null,null);
return cursor;
}
public long deleteAccount(long id){
return db.delete(Accounts.TABLE_NAME_ACCOUNTS,Accounts._ID+" = "+id ,null);
}
public Cursor listTask(String folder){
Log.i("DB", "LISTING "+folder);
String[] columns = new String[] {Task._ID, Task.COLUMN_NAME_SUBJECT, Task.COLUMN_NAME_PATH};
Cursor cursor = db.query(Task.TABLE_NAME_TASKS,columns,Task.COLUMN_NAME_FOLDER+" = '"+folder+"'", null
, null, null,Task.COLUMN_NAME_CREATE_DATE);
return cursor;
}
public Cursor showTask(long id){
Log.i("DB", "DETALS FOR ID = "+id);
String[] columns = new String[] {Task._ID, Task.COLUMN_NAME_SUBJECT, Task.COLUMN_NAME_DESCRIPTION, Task.COLUMN_NAME_FOLDER, Task.COLUMN_NAME_PRIORITY, Task.COLUMN_NAME_PATH, Task.COLUMN_NAME_PROJECT_ID};
Cursor cursor = db.query(Task.TABLE_NAME_TASKS,columns, Task._ID+" = "+id, null
, null, null,null);
return cursor;
}
public Cursor listProject(){
String[] columns = new String[] {Task._ID, Task.COLUMN_NAME_SUBJECT, Task.COLUMN_NAME_DESCRIPTION};
Cursor cursor = db.query(Task.TABLE_NAME_TASKS,columns,Task._ID+" != '0' AND "+Task.COLUMN_NAME_PROJECT_ID+" = '0' AND "+Task.COLUMN_NAME_FOLDER+" = '"+Task.FOLDER_PROJECTS+"'", null
, null, null,Task.COLUMN_NAME_PRIORITY+" desc");
return cursor;
}
public Cursor subProjectsById(long id){
String[] columns = new String[] {Task._ID, Task.COLUMN_NAME_SUBJECT, Task.COLUMN_NAME_DESCRIPTION};
Cursor cursor = db.query(Task.TABLE_NAME_TASKS,columns, Task.COLUMN_NAME_PROJECT_ID+" = '"+id+"'", null
, null, null,Task.COLUMN_NAME_PRIORITY+" desc");
return cursor;
}
public Cursor projectSpinner(){
String[] columns = new String[] {Task._ID, Task.COLUMN_NAME_SUBJECT};
Cursor cursor = db.query(Task.TABLE_NAME_TASKS,columns, Task.COLUMN_NAME_FOLDER+" = '"+Task.FOLDER_PROJECTS+"'", null
, null, null,null);
return cursor;
}
public Cursor oneProject(long id){
String[] columns = new String[] {Task._ID, Task.COLUMN_NAME_SUBJECT, Task.COLUMN_NAME_DESCRIPTION, Task.COLUMN_NAME_PRIORITY, Task.COLUMN_NAME_PROJECT_ID};
Cursor cursor = db.query(Task.TABLE_NAME_TASKS,columns,Task._ID+" = "+id , null
, null, null, null);
return cursor;
}
public Cursor filterTaskByTag(String tag){
String[] columns = new String[] {Task._ID, Task.COLUMN_NAME_SUBJECT, Task.COLUMN_NAME_DESCRIPTION};
Cursor cursor = db.query(Task.TABLE_NAME_TASKS,columns,Task.COLUMN_NAME_TAG+" = "+tag, null
, null, null,Task.COLUMN_NAME_PRIORITY);
return cursor;
}
public void deleteProject(long id){
recourseDelete(id);
}
public void recourseDelete(long id){
Cursor c = subProjectsById(id);
c.moveToFirst();
while(!c.isAfterLast()){
recourseDelete(c.getInt(c.getColumnIndex(Task._ID)));
c.moveToNext();
}
db.delete(Task.TABLE_NAME_TASKS,Task._ID+" = "+id ,null);
}
public long deleteTask(long id){
return db.delete(Task.TABLE_NAME_TASKS,Task._ID+" = "+id ,null);
}
public long updateTask(long id, ContentValues values){
Log.i("DB", "EDITING = "+id);
Long time = Long.valueOf(System.currentTimeMillis());
values.put(Task.COLUMN_NAME_MODIFICATION_DATE, time);
return db.update(Task.TABLE_NAME_TASKS, values, Task._ID+" = "+id, null);
}
public Cursor filter(CharSequence constraint, String folder) {
Cursor cursor;
Log.i("FILTER", constraint.toString()+" in "+folder);
String[] columns = new String[] {Task._ID, Task.COLUMN_NAME_SUBJECT, Task.COLUMN_NAME_PATH};
cursor = db.query(Task.TABLE_NAME_TASKS,columns,Task.COLUMN_NAME_SUBJECT+" LIKE '%"+constraint+"%' AND "+Task.COLUMN_NAME_FOLDER+" = '"+folder+"'", null
, null, null,Task.COLUMN_NAME_SUBJECT);
return cursor;
}
}
| [
"vsoued@brandeis.edu"
] | vsoued@brandeis.edu |
6c41210dae288bc44c1600523a84c55d7011e788 | 3bb2fef5dd6d6f1a1f3ea96a114cea374ebd4684 | /src/main/java/teachtheteensy/minigames/ddr/Note.java | b8d2428f393ef1128756722048248b0512c91d7f | [
"MIT",
"CC-BY-4.0"
] | permissive | INTechTeachTheTeensy/INTechTeachTheTeensy | dd6184367b0a8074f6b3658b845e658a96522cb5 | a3a6bcda06ff923cb6081bc7b8e6d8824906e234 | refs/heads/master | 2020-04-16T00:26:12.303946 | 2019-06-19T10:58:52 | 2019-06-19T10:58:52 | 165,138,102 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,034 | java | package teachtheteensy.minigames.ddr;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.effect.ColorAdjust;
import javafx.scene.effect.ColorInput;
import javafx.scene.image.Image;
import javafx.scene.paint.Color;
import teachtheteensy.Assets;
import teachtheteensy.Game;
public class Note {
private final Image imageNote;
private final Image imageMissed;
int x;
int y;
int col;
int v; // vitesse initiale note
public Note (int x, int y, int v){
this.x=x;
this.y=y;
this.v=v;
this.imageNote = Assets.getImage("ddr/note.png"); // Assets.getImage appelle une image préchargée
this.imageMissed = Assets.getImage("ddr/noteMissed.png");
}
public void render (GraphicsContext ctx) {
Image image=imageNote;
if (rate()){
image=imageMissed;
}
ctx.drawImage(image, x+10, y, 80, 80);
}
public boolean rate (){
return y > Game.getInstance().getScreenHeight()-100;
}
}
| [
"baptiste.ghirardi@telecom-sudparis.eu"
] | baptiste.ghirardi@telecom-sudparis.eu |
6b294e695e046818f3ff38fc062d3522a9c63281 | ca896319dbb30919314d9400cc3ede2c48399784 | /NaucnaCentrala/src/main/java/naucnaCentrala/service/UserService.java | a05daae4a1e12164bd52350f6d10aea0d6723946 | [] | no_license | dragandulic/NaucnaCentrala18 | 565f5d4ffb088b88f3dfd7449105843ca6068e28 | 3a46561be86bd3aaf16f8cf24dc0ea5652ec4416 | refs/heads/master | 2020-04-10T07:20:01.749814 | 2019-03-21T03:25:26 | 2019-03-21T03:25:26 | 160,878,020 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,685 | java | package naucnaCentrala.service;
import org.dom4j.dom.DOMNodeHelper.EmptyNodeList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
import naucnaCentrala.dto.PurchasedPropsDTO;
import naucnaCentrala.model.EditorReviewer;
import naucnaCentrala.model.EditorSA;
import naucnaCentrala.model.Labor;
import naucnaCentrala.model.Magazine;
import naucnaCentrala.model.Reviewer;
import naucnaCentrala.model.User;
import naucnaCentrala.repository.EditorReviewerRepository;
import naucnaCentrala.repository.EditorSARepository;
import naucnaCentrala.repository.ReviewerRepository;
import naucnaCentrala.repository.UserRepository;
import static java.util.Collections.emptyList;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@Service
public class UserService implements UserDetailsService{
@Autowired
private UserRepository userRepository;
@Autowired
private BCryptPasswordEncoder bCryptPasswordEncoder;
@Autowired
private EditorReviewerRepository editorReviewerRepository;
@Autowired
private EditorSARepository editorSARepository;
@Autowired
private ReviewerRepository reviewerRepository;
public String singup(User user) {
if(user.getPassword().equals(user.getConfirmpassword())) {
User use = userRepository.findByEmail(user.getEmail());
if(use==null) {
user.setPassword(bCryptPasswordEncoder.encode(user.getPassword()));
User u = userRepository.save(user);
return "Successful, please sign in";
}
else {
return "Email exist";
}
}
else {
return "Password incorrect";
}
}
//ova metoda se koristi prilikom logovanja. Ovaj metod primi koriscnicko ime, pretrazi bazu i vraca usera ako
// ga nadje.
@Override
public UserDetails loadUserByUsername(String email) throws UsernameNotFoundException {
User user = userRepository.findByEmail(email);
if(user == null) {
EditorReviewer er = editorReviewerRepository.findByEmail(email);
if(er == null) {
EditorSA e = editorSARepository.findByUsernameEquals(email);
if(e == null) {
Reviewer r = reviewerRepository.findByUsernameEquals(email);
if(r == null) {
throw new UsernameNotFoundException(email);
}
return new org.springframework.security.core.userdetails.User(r.getUsername(), r.getPassword(), getAuthorityeddd(r));
}
return new org.springframework.security.core.userdetails.User(e.getUsername(), e.getPassword(), getAuthorityedd(e));
}
return new org.springframework.security.core.userdetails.User(er.getEmail(), er.getPassword(), getAuthorityed(er));
}
return new org.springframework.security.core.userdetails.User(user.getEmail(), user.getPassword(), getAuthority(user));
}
//prvili smo ovde dve iste metode jer su nam editor ireviewre u jednoj klasi a user i author u drugoj
private Set<SimpleGrantedAuthority> getAuthority(User user){
Set<SimpleGrantedAuthority> authorities = new HashSet<>();
user.getRoles().forEach(role ->{
authorities.add(new SimpleGrantedAuthority("ROLE_" + role.getName()));
});
return authorities;
}
private Set<SimpleGrantedAuthority> getAuthorityed(EditorReviewer user){
Set<SimpleGrantedAuthority> authorities = new HashSet<>();
user.getRoles().forEach(role ->{
authorities.add(new SimpleGrantedAuthority("ROLE_" + role.getName()));
});
return authorities;
}
private Set<SimpleGrantedAuthority> getAuthorityedd(EditorSA user){
Set<SimpleGrantedAuthority> authorities = new HashSet<>();
user.getRoles().forEach(role ->{
authorities.add(new SimpleGrantedAuthority("ROLE_" + role.getName()));
});
return authorities;
}
private Set<SimpleGrantedAuthority> getAuthorityeddd(Reviewer user){
Set<SimpleGrantedAuthority> authorities = new HashSet<>();
user.getRoles().forEach(role ->{
authorities.add(new SimpleGrantedAuthority("ROLE_" + role.getName()));
});
return authorities;
}
public ArrayList<PurchasedPropsDTO> purchasedprops() {
String useremail = "";
Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
if (principal instanceof UserDetails) {
useremail = ((UserDetails)principal).getUsername();
} else {
useremail = principal.toString();
}
User u = userRepository.findByEmail(useremail);
ArrayList<PurchasedPropsDTO> res = new ArrayList<>();
boolean pom = false;
for(Labor l : u.getPurchasedlabors()) {
PurchasedPropsDTO p = new PurchasedPropsDTO();
p.setType("Labor");
p.setName(l.getTitle());
p.setDownloadurl("http://localhost:8038/dbfile/downloadFile=" + l.getDbfile().getId());
res.add(p);
pom=true;
}
for(Magazine m : u.getPurchasedmagazins()) {
PurchasedPropsDTO p = new PurchasedPropsDTO();
p.setType("Magazine");
p.setName(m.getName());
p.setDownloadurl("http://localhost:8038/dbfile/downloadFile=" + m.getDbfile().getId());
res.add(p);
pom=true;
}
if(pom) {
return res;
}
return null;
}
}
| [
"35114903+dragandulic@users.noreply.github.com"
] | 35114903+dragandulic@users.noreply.github.com |
241770023828b3a31518797822765d45a302a9c5 | 54aa5a362503a9a02670d1a67032824b6e179a42 | /app/src/androidTest/java/com/example/sharedpreferencesrsr2/ExampleInstrumentedTest.java | 994018c95c5ee003feacb8944f216cbac602f5d7 | [] | no_license | aman-sahai/SharedPreferencesRSR2 | 817e12f2dc932097d0aae43ffad26228cd940a32 | 72c878f546137faf64d03e110625967b67186749 | refs/heads/master | 2020-05-29T15:45:27.905062 | 2019-05-29T16:00:12 | 2019-05-29T16:00:12 | 189,230,099 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 750 | java | package com.example.sharedpreferencesrsr2;
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.sharedpreferencesrsr2", appContext.getPackageName());
}
}
| [
"sahaiaman.072@gmail.com"
] | sahaiaman.072@gmail.com |
9f423845ca037f8b1c6d8d84cdf55193a28079a2 | 6d03aa1ebbbee532dc0f883881b6ed05325fde6a | /src/MyName.java | 1097d30d1b2694bbe8a9d1cd9058c5bbcf4d10ae | [] | no_license | nightmaregirl/project | e87d11168cd4dcf38759bea1c320d4f18fe7a263 | 2fcd022d2fba4984907e600f632ee5066297a7a3 | refs/heads/master | 2020-03-14T14:10:06.654469 | 2018-02-09T23:32:21 | 2018-02-09T23:32:21 | 131,648,055 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,060 | java | import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
public class MyName {
public static void main(String[] args) throws IOException {
FileWriter fw = new FileWriter ("MyName.txt");
BufferedWriter bw= new BufferedWriter (fw);
PrintWriter myOutput = new PrintWriter(bw);
myOutput.println
("RRRR (◕‿◕✿) ôヮô MM MM \r\n" +
"RRRRRR (◕‿◕✿) ôヮô MMMM MMMM \r\n" +
"RR RR (◕‿◕✿) ôヮô MM MM MM MM \r\n" +
"RRRRR (◕‿◕✿) ôヮô MM MM MM MM \r\n" +
"RRR (◕‿◕✿)(ꈍ ˬ ꈍ✿) ôヮô MM MMM MM \r\n" +
"RR RR (◕‿◕✿) ôヮô MM MM MM \r\n" +
"RR RR (◕‿◕✿) ôヮô MM MM \r\n" +
"RR RR (◕‿◕✿) ôヮô MM MM \r\n" +
"RR RR(◕‿◕✿) ôヮô MM MM" );
myOutput.close();
}
}
| [
"KH037s@KH037-14.uncanet.unca.edu"
] | KH037s@KH037-14.uncanet.unca.edu |
2d5757b43f900ecfadf1841be95a9b5f290aff70 | 3f8f8043d0b98f95a641bca36ba3c9887cc22047 | /app/src/main/java/cn/cibnmp/ott/widgets/pmrecyclerview/holders/CommonListHolder.java | e2844c6d6c22feea4fcdbc4df9f45ef8debe24f0 | [] | no_license | beijingfengtuo/MpOTTProject | a496adc9f0d4bab0c91a814c55081b590e0893bb | fa11ed90023bdcde5960a8e39c20aa5e219a11ed | refs/heads/master | 2020-04-09T23:11:49.972324 | 2018-12-06T09:43:08 | 2018-12-06T09:43:08 | 160,649,765 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,360 | java | package cn.cibnmp.ott.widgets.pmrecyclerview.holders;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import cn.cibnhp.grand.R;
/**
* Created by wanqi on 2017/3/10.
*/
public class CommonListHolder extends RecyclerView.ViewHolder {
public RelativeLayout common_list_relativelayout;
public View common_list_mView;
public ImageView common_list_imagview;
public TextView common_list_text, common_list_text1;
public CommonListHolder(Context context, View itemView) {
super(itemView);
common_list_mView = itemView;
common_list_imagview = (ImageView) itemView.findViewById(R.id.common_list_imagview);
common_list_text = (TextView) itemView.findViewById(R.id.common_list_text);
common_list_text1 = (TextView) itemView.findViewById(R.id.common_list_text1);
common_list_relativelayout = (RelativeLayout)itemView.findViewById(R.id.common_list_relativelayout);
}
public CommonListHolder(ViewGroup parent) {
this(parent.getContext(),
LayoutInflater.from(parent.getContext()).inflate(R.layout.common_list_item, parent, false));
}
}
| [
"13264051120@163.com"
] | 13264051120@163.com |
c5db0f72d9b2068cd09a2d19a3312c692fe4e152 | b9d7681c55bc3a091bc261a7d47276779bcf0fac | /android-starter-pack/MADE/Codelab/codelab-dicoding-myunittesting/app/src/test/java/com/edsusantoo/bismillah/myunittesting/ExampleUnitTest.java | 7edb05c8042ad2acb6fa7fa6004152971cde2a96 | [] | no_license | edsusantoo/belajar-di-dicoding | 7fe7a5e9f6be33680e39f6ecb24f9cfcf2198e7d | 43dcb3ecdbc1a5afb80c042326babecf9936ad59 | refs/heads/master | 2020-07-03T19:35:46.439462 | 2019-09-10T07:54:53 | 2019-09-10T07:54:53 | 200,971,610 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 399 | java | package com.edsusantoo.bismillah.myunittesting;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"edsusantoo@gmail.com"
] | edsusantoo@gmail.com |
f1a984308b4281780b9b0119cfc88f187b8b18ed | ab9170489eb7635867d382b48b110b97cd3cd0e0 | /src/main/java/DraughtsMVC/models/Player.java | 7bf2195874f013641c070bb11a9998358f750473 | [] | no_license | fjfdepedro/Draugths_Junit | 6cee4a16e01463ad00c45dab2a194f24fd16216e | df9cb7b3be0981143fa99ef652f21e2c95470138 | refs/heads/master | 2021-07-19T03:46:41.280534 | 2019-11-03T22:17:57 | 2019-11-03T22:17:57 | 219,373,152 | 0 | 0 | null | 2020-10-13T17:11:14 | 2019-11-03T22:17:36 | Java | UTF-8 | Java | false | false | 256 | java | package DraughtsMVC.models;
public class Player {
private final Color color;
public Player(Color color) {
this.color = color;
}
public void movePiece(Board board, String movement){
board.moveTo(movement, color);
}
}
| [
"fjfdepedro@gmail.com"
] | fjfdepedro@gmail.com |
fc24fbb6102cea7a2e33e11938fa833de533e1a9 | 240c7e787f20568f82849acbbee3a57d8e2e0290 | /backend/src/test/java/com/rentit/sales/rest/SalesRestControllerTests.java | 9d23939aec8d0a369115796a139ee53159733c06 | [] | no_license | FottyM/RentIT-ESI-2016 | 323166b75aba5e6c1990659b7f2c353b363c1b10 | e6c1cb7e98a6145f9a86a950dded1266ddb13206 | refs/heads/master | 2021-01-20T18:52:32.047290 | 2016-05-29T01:17:51 | 2016-05-29T01:17:51 | 61,434,634 | 0 | 0 | null | 2019-02-23T20:07:55 | 2016-06-18T13:26:25 | Java | UTF-8 | Java | false | false | 4,798 | java | package com.rentit.sales.rest;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.rentit.RentitRefApplication;
import com.rentit.common.application.dto.BusinessPeriodDTO;
import com.rentit.inventory.application.dto.PlantInventoryEntryDTO;
import com.rentit.inventory.rest.PlantInventoryEntryRestController;
import com.rentit.sales.application.dto.PurchaseOrderDTO;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.hateoas.core.AnnotationMappingDiscoverer;
import org.springframework.hateoas.hal.Jackson2HalModule;
import org.springframework.http.MediaType;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.jdbc.Sql;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.result.MockMvcResultHandlers;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.util.UriTemplate;
import java.time.LocalDate;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.isEmptyOrNullString;
import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertThat;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = RentitRefApplication.class)
@WebAppConfiguration
@DirtiesContext
@ActiveProfiles("test")
public class SalesRestControllerTests {
@Autowired
private WebApplicationContext wac;
private MockMvc mockMvc;
@Autowired @Qualifier("_halObjectMapper")
ObjectMapper mapper;
@Before
public void setup() {
this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build();
}
@Test
@Sql("plants-dataset.sql")
public void testGetAllPlants() throws Exception {
MvcResult result = mockMvc.perform(get("/api/inventory/plants?name=Exc&startDate=2016-03-14&endDate=2016-03-25"))
.andExpect(status().isOk())
.andReturn();
List<PlantInventoryEntryDTO> plants = mapper.readValue(result.getResponse().getContentAsString(), new TypeReference<List<PlantInventoryEntryDTO>>() { });
assertThat(plants.size(), is(5));
PurchaseOrderDTO order = new PurchaseOrderDTO();
order.setPlant(plants.get(2));
order.setRentalPeriod(BusinessPeriodDTO.of(LocalDate.now(), LocalDate.now()));
result = mockMvc.perform(post("/api/sales/orders").content(mapper.writeValueAsString(order)).contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isCreated())
.andExpect(header().string("Location", not(isEmptyOrNullString())))
.andReturn();
order = mapper.readValue(result.getResponse().getContentAsString(), PurchaseOrderDTO.class);
//mockMvc.perform(post("/api/sales/orders/{id}/accept", order.get_id())).andReturn();
mockMvc.perform(post("/api/sales/orders/{id}/accept", 100)).andReturn();
AnnotationMappingDiscoverer discoverer = new AnnotationMappingDiscoverer(RequestMapping.class);
String mapping = discoverer.getMapping(PlantInventoryEntryRestController.class,
PlantInventoryEntryRestController.class.getMethod("show", Long.class));
UriTemplate uriTemplate = new UriTemplate(mapping);
Map<String, String> map = uriTemplate.match("http://localhost:8080/api/inventory/plants/123");
System.out.println(mapping);
System.out.println(map);
order = new PurchaseOrderDTO();
order.setPlant(plants.get(2));
order.setRentalPeriod(BusinessPeriodDTO.of(LocalDate.now(), LocalDate.now()));
result = mockMvc.perform(post("/api/sales/orders").content(mapper.writeValueAsString(order)).contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isCreated())
.andExpect(header().string("Location", not(isEmptyOrNullString())))
.andDo(MockMvcResultHandlers.print())
.andReturn();
// System.out.println(order.getId());
}
}
| [
"akaizat1@gmail.com"
] | akaizat1@gmail.com |
aa61adfe86551699f20f3574bfe7629a6940481b | ff2e69c6291dd6e7b31a554ab55aeb07c9b5328a | /aws-activity-collector-api-service/src/main/java/com/serverless/dal/Activity.java | 3fdb66ead0aa4ed36b3efd1f1719aef52497c155 | [] | no_license | dordika/activity-collector-serverless | 35fb0d4d980ca5b6249330d9558198438f2b389c | a722456bbcc1524c4c541ea22c089e1bad2ea0c4 | refs/heads/main | 2023-05-28T01:50:46.211678 | 2021-06-19T12:31:33 | 2021-06-19T12:31:33 | 375,053,707 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,086 | java | package com.serverless.dal;
import com.amazonaws.services.dynamodbv2.AmazonDynamoDB;
import com.amazonaws.services.dynamodbv2.datamodeling.*;
import org.apache.log4j.Logger;
import java.io.IOException;
import java.util.Date;
@DynamoDBTable(tableName = "activity-events-table-dev")
public class Activity {
private static final String ACTIVITY_TABLE_NAME = "activity-events-table-dev";
private String id;
String appSource;
String instance;
String appVersion;
String sessionIdentifier;
String activity;
String activityValue;
Date dateCreated;
private static DynamoDBAdapter db_adapter;
private final AmazonDynamoDB client;
private final DynamoDBMapper mapper;
private final Logger logger = Logger.getLogger(this.getClass());
public Activity() {
DynamoDBMapperConfig mapperConfig = DynamoDBMapperConfig.builder()
.withTableNameOverride(new DynamoDBMapperConfig.TableNameOverride(ACTIVITY_TABLE_NAME))
.build();
db_adapter = DynamoDBAdapter.getInstance();
this.client = db_adapter.getDbClient();
this.mapper = db_adapter.createDbMapper(mapperConfig);
}
@DynamoDBHashKey(attributeName = "id")
@DynamoDBAutoGeneratedKey
public String getId() {
return this.id;
}
public void setId(String id) {
this.id = id;
}
@DynamoDBRangeKey(attributeName = "appVersion")
public String getAppVersion() {
return appVersion;
}
public void setAppVersion(String appVersion) {
this.appVersion = appVersion;
}
@DynamoDBRangeKey(attributeName = "instance")
public String getInstance() {
return instance;
}
public void setInstance(String instance) {
this.instance = instance;
}
@DynamoDBRangeKey(attributeName = "activity")
public String getActivity() {
return activity;
}
public void setActivity(String activity) {
this.activity = activity;
}
@DynamoDBRangeKey(attributeName = "sessionIdentifier")
public String getSessionIdentifier() {
return sessionIdentifier;
}
public void setSessionIdentifier(String sessionIdentifier) {
this.sessionIdentifier = sessionIdentifier;
}
@DynamoDBRangeKey(attributeName = "dateCreated")
public Date getDateCreated() {
return dateCreated;
}
public void setDateCreated(Date dateCreated) {
this.dateCreated = dateCreated;
}
@DynamoDBRangeKey(attributeName = "activityValue")
public String getActivityValue() {
return activityValue;
}
public void setActivityValue(String activityValue) {
this.activityValue = activityValue;
}
public void save() throws IOException {
logger.info("Event - save(): " + this.toString());
this.mapper.save(this);
}
@DynamoDBRangeKey(attributeName = "appSource")
public String getAppSource() {
return appSource;
}
public void setAppSource(String appSource) {
this.appSource = appSource;
}
}
| [
"dorjan.dika@gmail.com"
] | dorjan.dika@gmail.com |
0e0f6d3ada6777ef79a91b80f742d32351fb9d71 | 09aac8c01424b67499a120716351513ebaef55ad | /android/app/src/main/java/com/infocorona/MainActivity.java | 485cab3acd1adfc7f628263fdc998ce498009569 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | sayyidisal/Info-Corona | 6e8982cac8ebf98d8ea36b8806833eef60f4c2cf | 44495ac3a182b77f38eeac5b75b7929b280d6e0c | refs/heads/master | 2023-08-14T19:26:26.050317 | 2021-10-03T11:02:58 | 2021-10-03T11:02:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 346 | java | package com.infocorona;
import com.facebook.react.ReactActivity;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript. This is used to schedule
* rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "covidNews";
}
}
| [
"rizbud20@gmail.com"
] | rizbud20@gmail.com |
1eaf59d43fae42b138e86b7115babbead8e65f41 | b4bef666eb3604db443df0a5d0f75b60bf53bbc7 | /Programa/src/ProgramaImprimeNome.java | 652c231b523594c59e04e84c76cd51e668132d90 | [
"Apache-2.0"
] | permissive | Cassiolucianoo/java-treino | 5d65e763d6f80ecd8bfd39f21c9326279e95ab10 | 5b17ea88cf0846bfece46c35de7fd5a886fbcc4b | refs/heads/master | 2023-04-09T19:54:05.080384 | 2021-04-17T12:47:23 | 2021-04-17T12:47:23 | null | 0 | 0 | null | null | null | null | MacCentralEurope | Java | false | false | 756 | java | import javax.swing.JOptionPane;
public class ProgramaImprimeNome {
public static void main (String []args){
int idade;
String nome;
String mensagem;
nome = JOptionPane.showInputDialog("infome o seu nome");
idade = Integer.parseInt(JOptionPane.showInputDialog(null,"Digite sua idade "+nome));
if(idade < 18){
mensagem = "Cara vocÍ ť meio novinho vai usar drogas";
}if (idade > 40){
mensagem = "Cara vocÍ estŠ meio velho!";
}else{
mensagem = "VocÍ aguenta trampa ainda";
}
JOptionPane.showMessageDialog(null,"Seu nome ť "+nome +"\n VocÍ tem :"+idade+" Anos \n"+mensagem );
System.out.println("Meu nome ť cassio\nMinha idade ť :"+idade+" Anos !!/n"+mensagem );
}
}
| [
"cassiolucianodasilva@gmail.com"
] | cassiolucianodasilva@gmail.com |
ea1ec7225ad29208d0bfbfca6079e3f81cc072a2 | ff8b3d2f1a45f9e2916554714a7f672bfadae2a2 | /FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/entity/RestaurantCategoryEntity.java | 4d741ca7afda9c52ce7f3812938338f15602a9f9 | [] | no_license | sundeeppjaiswal/FoodOrderingBackend-master-SundeepJaiswal | 7c95381c3933ebdac6963e57b28fbac4c4dafd0f | ae856b221db63979381d79a02a2df0affa9c18d6 | refs/heads/main | 2023-03-05T01:06:30.094732 | 2021-02-19T14:11:55 | 2021-02-19T14:11:55 | 340,388,847 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,178 | java | package com.upgrad.FoodOrderingApp.service.entity;
import javax.persistence.*;
import java.io.Serializable;
@Entity
@Table(name = "restaurant_category")
@NamedQueries(
{
@NamedQuery(name = "findRestaurantsByCategoryId", query = "select r from RestaurantCategoryEntity r where r.category.id=:categoryId"),
}
)
public class RestaurantCategoryEntity implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "ID")
private long id;
@ManyToOne
@JoinColumn(name = "RESTAURANT_ID")
private RestaurantEntity restaurant;
@ManyToOne
@JoinColumn(name = "CATEGORY_ID")
private CategoryEntity category;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public RestaurantEntity getRestaurant() {
return restaurant;
}
public void setRestaurant(RestaurantEntity restaurant) {
this.restaurant = restaurant;
}
public CategoryEntity getCategory() {
return category;
}
public void setCategory(CategoryEntity category) {
this.category = category;
}
}
| [
"sundeeppjaiswal@hotmail.com"
] | sundeeppjaiswal@hotmail.com |
8975a0b667920791cc3b758b043c0e67c048e57c | 84894e4ca79bff4a92c04b32009e5acf3993bd77 | /rdvmedecins-jsf2-ejb/mv-rdvmedecins-ejb-dao-jpa/src/main/java/rdvmedecins/dao/IPharmacyDAO.java | 1a7bbdcd7a6c77e0f11aa62ca6cb73ea9e22075b | [] | no_license | nlvq/Nurse | b21fa46a66f8b39391f112b5bffea7e713635a61 | ca5ff0954afe90ba8c8e7aad1b2958147b07d622 | refs/heads/master | 2021-01-01T18:29:36.112670 | 2013-03-16T17:39:01 | 2013-03-16T17:39:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 236 | java | package rdvmedecins.dao;
import javax.ejb.Local;
import rdvmedecins.jpa.Pharmacy;
/**
*
* @author Pradier
*/
@Local
public interface IPharmacyDAO extends IDAO<Long, Pharmacy> {
public Pharmacy findPharmacyById(long id);
}
| [
"patrick@faux.com"
] | patrick@faux.com |
6aa8f0379ca3019e49ce9cf92ed7fc678df2b13a | 84572d5d682bd7e6973b8105fb921b0c448ff1f7 | /projects/BouncyCastle/src/org/sandrob/bouncycastle/jce/provider/PKIXCRLUtil.java | aefd02ae4e3179fd290bf09e9c0a05a42363d154 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | liang47009/sandrop | 806169c72a516b3191aae07c234a225db5343888 | 28045e53cec0f043d3aaf426f7055fbf8ca38a76 | refs/heads/master | 2020-04-13T18:24:58.767107 | 2018-12-28T09:32:53 | 2018-12-28T09:33:14 | 163,373,426 | 0 | 0 | null | 2018-12-28T06:15:22 | 2018-12-28T06:15:22 | null | UTF-8 | Java | false | false | 4,727 | java | package org.sandrob.bouncycastle.jce.provider;
import java.security.cert.CertStore;
import java.security.cert.CertStoreException;
import java.security.cert.PKIXParameters;
import java.security.cert.X509CRL;
import java.security.cert.X509Certificate;
import java.util.Collection;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.sandrob.bouncycastle.util.StoreException;
import org.sandrob.bouncycastle.x509.ExtendedPKIXParameters;
import org.sandrob.bouncycastle.x509.X509CRLStoreSelector;
import org.sandrob.bouncycastle.x509.X509Store;
public class PKIXCRLUtil
{
public Set findCRLs(X509CRLStoreSelector crlselect, ExtendedPKIXParameters paramsPKIX, Date currentDate)
throws AnnotatedException
{
Set initialSet = new HashSet();
// get complete CRL(s)
try
{
initialSet.addAll(findCRLs(crlselect, paramsPKIX.getAdditionalStores()));
initialSet.addAll(findCRLs(crlselect, paramsPKIX.getStores()));
initialSet.addAll(findCRLs(crlselect, paramsPKIX.getCertStores()));
}
catch (AnnotatedException e)
{
throw new AnnotatedException("Exception obtaining complete CRLs.", e);
}
Set finalSet = new HashSet();
Date validityDate = currentDate;
if (paramsPKIX.getDate() != null)
{
validityDate = paramsPKIX.getDate();
}
// based on RFC 5280 6.3.3
for (Iterator it = initialSet.iterator(); it.hasNext();)
{
X509CRL crl = (X509CRL)it.next();
if (crl.getNextUpdate().after(validityDate))
{
X509Certificate cert = crlselect.getCertificateChecking();
if (cert != null)
{
if (crl.getThisUpdate().before(cert.getNotAfter()))
{
finalSet.add(crl);
}
}
else
{
finalSet.add(crl);
}
}
}
return finalSet;
}
public Set findCRLs(X509CRLStoreSelector crlselect, PKIXParameters paramsPKIX)
throws AnnotatedException
{
Set completeSet = new HashSet();
// get complete CRL(s)
try
{
completeSet.addAll(findCRLs(crlselect, paramsPKIX.getCertStores()));
}
catch (AnnotatedException e)
{
throw new AnnotatedException("Exception obtaining complete CRLs.", e);
}
return completeSet;
}
/**
* Return a Collection of all CRLs found in the X509Store's that are
* matching the crlSelect criteriums.
*
* @param crlSelect a {@link X509CRLStoreSelector} object that will be used
* to select the CRLs
* @param crlStores a List containing only
* {@link org.sandrob.bouncycastle.x509.X509Store X509Store} objects.
* These are used to search for CRLs
*
* @return a Collection of all found {@link java.security.cert.X509CRL X509CRL} objects. May be
* empty but never <code>null</code>.
*/
private final Collection findCRLs(X509CRLStoreSelector crlSelect,
List crlStores) throws AnnotatedException
{
Set crls = new HashSet();
Iterator iter = crlStores.iterator();
AnnotatedException lastException = null;
boolean foundValidStore = false;
while (iter.hasNext())
{
Object obj = iter.next();
if (obj instanceof X509Store)
{
X509Store store = (X509Store)obj;
try
{
crls.addAll(store.getMatches(crlSelect));
foundValidStore = true;
}
catch (StoreException e)
{
lastException = new AnnotatedException(
"Exception searching in X.509 CRL store.", e);
}
}
else
{
CertStore store = (CertStore)obj;
try
{
crls.addAll(store.getCRLs(crlSelect));
foundValidStore = true;
}
catch (CertStoreException e)
{
lastException = new AnnotatedException(
"Exception searching in X.509 CRL store.", e);
}
}
}
if (!foundValidStore && lastException != null)
{
throw lastException;
}
return crls;
}
}
| [
"supp.sandrob@gmail.com"
] | supp.sandrob@gmail.com |
9669cf20fa5183948d4134d5a8f78f970646575d | 0d9beaa7b69a60339f7a1bc7d399bafae7be2d3f | /src/main/java/sttp/nfm/block/WoodenFloorClassicBlock.java | fdc9a156db62cb9cc4881f098e921204b65986eb | [] | no_license | mael-bm/Natural-Force-Mod-1.16.5 | d6bc4ebb718b7111e2b1988740e720d65b478fa8 | 65207ec52e4b14733b2046cbef1e38d80c2e9c32 | refs/heads/master | 2023-04-07T21:23:34.402464 | 2021-04-10T16:37:43 | 2021-04-10T16:37:43 | 356,638,799 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,607 | java |
package sttp.nfm.block;
import sttp.nfm.itemgroup.NFMTabItemGroup;
import sttp.nfm.NfmModElements;
import net.minecraftforge.registries.ObjectHolder;
import net.minecraft.loot.LootContext;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Item;
import net.minecraft.item.BlockItem;
import net.minecraft.block.material.Material;
import net.minecraft.block.SoundType;
import net.minecraft.block.BlockState;
import net.minecraft.block.Block;
import java.util.List;
import java.util.Collections;
@NfmModElements.ModElement.Tag
public class WoodenFloorClassicBlock extends NfmModElements.ModElement {
@ObjectHolder("nfm:wooden_floor_classic")
public static final Block block = null;
public WoodenFloorClassicBlock(NfmModElements instance) {
super(instance, 25);
}
@Override
public void initElements() {
elements.blocks.add(() -> new CustomBlock());
elements.items.add(() -> new BlockItem(block, new Item.Properties().group(NFMTabItemGroup.tab)).setRegistryName(block.getRegistryName()));
}
public static class CustomBlock extends Block {
public CustomBlock() {
super(Block.Properties.create(Material.ROCK).sound(SoundType.GROUND).hardnessAndResistance(1f, 10f).setLightLevel(s -> 0));
setRegistryName("wooden_floor_classic");
}
@Override
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
List<ItemStack> dropsOriginal = super.getDrops(state, builder);
if (!dropsOriginal.isEmpty())
return dropsOriginal;
return Collections.singletonList(new ItemStack(this, 1));
}
}
}
| [
"maelb@DESKTOP-FITPUDG"
] | maelb@DESKTOP-FITPUDG |
fad1f65ed6ce7caaeb9e13e9394b3c1e29667dda | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/30/30_de807610e85a2e682c2ee16588b8190827a186b8/MainScreen/30_de807610e85a2e682c2ee16588b8190827a186b8_MainScreen_t.java | b6a6a383b1b06d90b21220e5b2d3eae20d471398 | [] | 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 | 8,561 | java | package no.hist.gruppe5.pvu.mainroom;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.*;
import no.hist.gruppe5.pvu.Assets;
import no.hist.gruppe5.pvu.GameScreen;
import no.hist.gruppe5.pvu.PVU;
import no.hist.gruppe5.pvu.ScoreHandler;
import no.hist.gruppe5.pvu.book.BookScreen;
import no.hist.gruppe5.pvu.dialogdrawer.DialogDrawer;
import no.hist.gruppe5.pvu.dialogdrawer.PopupBox;
import no.hist.gruppe5.pvu.mainroom.objects.Player;
import no.hist.gruppe5.pvu.mainroom.objects.RayCastManager;
import no.hist.gruppe5.pvu.mainroom.objects.TeamMates;
/**
* Created with IntelliJ IDEA. User: karl Date: 8/26/13 Time: 10:56 PM
*/
public class MainScreen extends GameScreen {
private static final float WORLD_TO_BOX = 0.01f;
private static final float BOX_TO_WORLD = 100f;
public static final String TRYKK = "Trykk på E for å ";
public static final String PAA_PC = TRYKK + "jobbe på PC-en";
public static final String PAA_CART = TRYKK + "se på burndown-cart";
public static final String PAA_BORD = TRYKK + "se på fremgangen din";
public static final String PAA_BOK = TRYKK + "lese i boken";
public static final int OBJECT_PLAYER = 0;
public static final int OBJECT_ROOM = 1;
private PopupBox mPopupBox;
private World mWorld;
private Box2DDebugRenderer mDebugRenderer;
private Player mPlayer;
private TeamMates mTeammates;
private boolean mInputHandled = false;
private Sprite mBackground;
private Sprite mTables;
private Sprite[] mBurndownCarts;
private int mCurrentCart = 0;
private boolean burndownChecked = true;
private RayCastManager mRayCastManager;
// DEBUG
private ShapeRenderer mShapeDebugRenderer;
private boolean mShowingHint = false;
private int mCurrentHint = -1;
private DialogDrawer mDialog;
public MainScreen(PVU game) {
super(game);
mWorld = new World(new Vector2(0, 0), true);
mDialog = new DialogDrawer();
mDialog.setShow(true);
// DEBUG
mDebugRenderer = new Box2DDebugRenderer();
mShapeDebugRenderer = new ShapeRenderer();
mShapeDebugRenderer.setProjectionMatrix(camera.combined);
// DEBUG end
mRayCastManager = new RayCastManager();
mPopupBox = new PopupBox(batch);
createRoomBody();
mBackground = new Sprite(Assets.msBackground);
mTables = new Sprite(Assets.msTable);
mBurndownCarts = new Sprite[Assets.msBurndownCarts.length];
for (int i = 0; i < Assets.msBurndownCarts.length; i++) {
mBurndownCarts[i] = new Sprite(Assets.msBurndownCarts[i]);
mBurndownCarts[i].setPosition(15f, PVU.GAME_HEIGHT - 23f);
}
mBackground.setSize(PVU.GAME_WIDTH, PVU.GAME_HEIGHT);
mBackground.setPosition(0, 0);
mPlayer = new Player(mWorld);
mTeammates = new TeamMates();
for (int i = 0; i < Assets.msBurndownCarts.length; i++) {
mBurndownCarts[i] = new Sprite(Assets.msBurndownCarts[i]);
mBurndownCarts[i].setPosition(15f, PVU.GAME_HEIGHT - 23f);
}
}
private void createRoomBody() {
BodyEditorLoader loader = new BodyEditorLoader(Gdx.files.internal("data/pvugame.json"));
//Room Body
Body roomBody;
BodyDef bd = new BodyDef();
bd.position.set(0, 0);
bd.type = BodyDef.BodyType.StaticBody;
FixtureDef fd = new FixtureDef();
fd.density = 1;
fd.friction = 0.5f;
fd.restitution = 0.3f;
roomBody = mWorld.createBody(bd);
roomBody.setUserData(OBJECT_ROOM);
loader.attachFixture(roomBody, "main_room", fd, 192f);
}
@Override
protected void draw(float delta) {
clearCamera(1, 1, 1, 1);
batch.begin();
mBackground.draw(batch);
mBurndownCarts[mCurrentCart].draw(batch);
if (mPlayer.getPosition().y < PVU.GAME_HEIGHT / 2) {
mTables.draw(batch);
mTeammates.draw(batch);
mPlayer.draw(batch);
} else {
mPlayer.draw(batch);
mTables.draw(batch);
mTeammates.draw(batch);
}
if (mShowingHint && !mPlayer.isSitting()) {
mPopupBox.draw(delta);
}
batch.end();
if(mDialog.isShow())
mDialog.draw();
}
@Override
protected void update(float delta) {
checkCompletion();
mWorld.step(1 / 60f, 6, 2);
mTeammates.update();
mPlayer.update();
mPlayer.setMoveable(!mDialog.isShow());
mRayCastManager.update(delta);
for (RayCastManager.RayCast rc : mRayCastManager.getRayCasts()) {
mWorld.rayCast(rc.callBack, rc.from, rc.to);
}
if (mRayCastManager.getInfront() != -1 && !mShowingHint) {
mShowingHint = true;
mCurrentHint = mRayCastManager.getInfront();
switch (mRayCastManager.getInfront()) {
case RayCastManager.BOOK:
mPopupBox.setText(PAA_BOK);
mPopupBox.setXY(mPlayer.getPosition());
break;
case RayCastManager.PC:
mPopupBox.setText(PAA_PC);
mPopupBox.setXY(mPlayer.getPosition());
break;
case RayCastManager.CART:
mPopupBox.setText(PAA_CART);
mPopupBox.setXY(mPlayer.getPosition());
break;
case RayCastManager.TABLE:
mPopupBox.setText(PAA_BORD);
mPopupBox.setXY(mPlayer.getPosition());
break;
}
} else if (mRayCastManager.getInfront() == -1 && mShowingHint) {
mShowingHint = false;
}
if (mShowingHint) {
checkWithinRayCastInput();
}
if (!Gdx.input.isKeyPressed(Input.Keys.E)) {
mInputHandled = false;
}
updateMainScreenSoundButton();
mDialog.intro();
}
private void drawDebug(boolean onlyRayCasts) {
if (!onlyRayCasts) {
mDebugRenderer.render(mWorld, camera.combined);
}
mShapeDebugRenderer.begin(ShapeRenderer.ShapeType.Line);
mShapeDebugRenderer.setColor(Color.RED);
for (RayCastManager.RayCast rc : mRayCastManager.getRayCasts()) {
mShapeDebugRenderer.line(rc.from, rc.to);
}
mShapeDebugRenderer.end();
}
private void checkWithinRayCastInput() {
if (Gdx.input.isKeyPressed(Input.Keys.E) && !mInputHandled) {
switch (mRayCastManager.getInfront()) {
case RayCastManager.BOOK:
mInputHandled = true;
game.setScreen(new BookScreen(game));
break;
case RayCastManager.PC:
game.setScreen(new MinigameSelectorScreen(game));
mPlayer.sitDown();
mShowingHint = false;
mInputHandled = true;
burndownChecked = false;
break;
case RayCastManager.CART:
game.setScreen(new BurndownScreen(game));
mInputHandled = true;
break;
case RayCastManager.TABLE:
mInputHandled = true;
game.setScreen(new ScoreScreen(game));
break;
}
}
}
@Override
protected void cleanUp() {
}
private void checkCompletion() {
if (!burndownChecked) {
for (int i = 0; i < 5; i++) {
if (ScoreHandler.isMinigameCompleted(i)) {
setBurnDownCart(++mCurrentCart % 5);
}
}
burndownChecked = true;
}
}
private void setBurnDownCart(int num) {
if (num < 0) {
num = 0;
}
if (num > 4) {
num = 4;
}
mCurrentCart = num;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
e7d87d2f344ba6d20819c77a3dfdbfe1cfecb556 | c9d7b04276751b0ba53ce4d1df9aa7e3034208a4 | /app/src/test/java/android/example/com/jsoncolorsexercise/ExampleUnitTest.java | 660e91f1298f24fc7b1535600401a28969fa4767 | [] | no_license | donChelsea/JSON-RecyclerView-Exercise | d157c37e49be1f723ff366a321dd7c6be0b2d806 | 7849dc0f752d2d7939474ce63fefcf3209a25291 | refs/heads/master | 2020-04-15T13:19:21.403501 | 2019-01-08T18:47:47 | 2019-01-08T18:47:47 | 164,712,266 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 399 | java | package android.example.com.jsoncolorsexercise;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"chelseakatsidzira@pursuit.org"
] | chelseakatsidzira@pursuit.org |
e38410770cdb0210c5764ac2ed187695c4f54afa | 6381a36eb99480cb98a5e4a4934cc9d1d31d319f | /src/main/java/com/sanatkar/schoolerp/controller/UserRegistrationController.java | a7ae16bfc15591e73f28fa5c0411103a846bf81b | [] | no_license | ashkan-zs/school-manager | 006f47852f548fcea36bf77de79df0b4c82f8f76 | 49d110efc3a6f0cbd7dc52d1d5454fdafd046020 | refs/heads/master | 2020-11-25T13:43:59.717930 | 2020-02-18T11:37:15 | 2020-02-18T11:37:15 | 228,692,953 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,581 | java | package com.sanatkar.schoolerp.controller;
import com.sanatkar.schoolerp.controller.dto.UserRegistrationDto;
import com.sanatkar.schoolerp.model.entity.User;
import com.sanatkar.schoolerp.model.repository.RoleDao;
import com.sanatkar.schoolerp.model.repository.UserDao;
import com.sanatkar.schoolerp.model.service.UserService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
/**
* Create by ashkan on 2019/06/15
*/
@Controller
@RequestMapping("/users")
public class UserRegistrationController {
private UserService userService;
private UserDao userDao;
private RoleDao roleDao;
public UserRegistrationController(UserService userService, UserDao userDao, RoleDao roleDao) {
this.userService = userService;
this.userDao = userDao;
this.roleDao = roleDao;
}
@ModelAttribute("user")
private UserRegistrationDto userRegistrationDto() {
return new UserRegistrationDto();
}
@GetMapping
public String getUsers(Model model) {
model.addAttribute("users", userDao.findAll());
return "user/users";
}
@GetMapping("/{id}")
public String getUser(@PathVariable Long id, Model model) {
User user = userDao.findById(id)
.orElseThrow(() -> new IllegalArgumentException("Invalid user id:" + id));
model.addAttribute("user", user);
return "user/user-edit";
}
@GetMapping("/add")
public String showRegisterForm(Model model) {
model.addAttribute("auths", roleDao.findAll());
return "user/user-add";
}
@GetMapping("/edit/{id}")
public String editUser(@PathVariable Long id, Model model) {
User user = userDao.findById(id)
.orElseThrow(() -> new IllegalArgumentException("Invalid user id: " + id));
model.addAttribute("user", user);
return "user/user-edit";
}
@PostMapping
public String registerUserAccount(@ModelAttribute("user") @Valid UserRegistrationDto userDto, BindingResult result) {
User existUser = userService.findByUsername(userDto.getUsername());
if (existUser != null) {
result.reject("username", "There is already an account registered with this username");
}
if (result.hasErrors()) {
return "user/user-add";
}
userService.save(userDto);
return "redirect:/users?success";
}
}
| [
"zs.ashkan@yahoo.com"
] | zs.ashkan@yahoo.com |
ed58b111c6076a819b37fb0ae06d1a7666f4d3d0 | 26722af0a66760a8fe6835e4b1858056eea53e33 | /src/day42_Inharitance/Task02/DeviceObjects.java | d06afb68403383ac8b9e2d8b700fb83784050fa7 | [] | no_license | Adilet121286/Spring2020 | 0bf6f53d879ac34919dfe4652f47291c0d9f1964 | b8f163d25a47a74111835df5e5b633436d0f5d71 | refs/heads/master | 2022-11-20T17:26:56.766446 | 2020-07-20T19:43:44 | 2020-07-20T19:43:44 | 260,136,591 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 340 | java | package day42_Inharitance.Task02;
public class DeviceObjects {
public static void main(String[] args) {
TV tv = new TV("Samsung", "E250", 500, "40 inches");
tv.country = "USA";
System.out.println(tv);
Phone phone1 = new Phone("Iphone","11",1000,"large");
System.out.println(phone1);
}
} | [
"adilet1212bermet@gmail.com"
] | adilet1212bermet@gmail.com |
df9d66839f4f63349995a4d0f331f07c5c82151a | ee31ad62412a00ff6cad8cc52d1baba1ef71a567 | /Projet_Final/EmpruntDao.java | 3290b9d300b0e182351414e2c4e2721c8fbf860a | [] | no_license | AxelRoch/FinalProjectIN205 | 4f0c3937f69f85e4d69b620fd01bfb03e917f90b | b58c6250983c9f085bab152ad72de1ad60c85797 | refs/heads/master | 2022-01-25T22:02:51.845202 | 2020-03-24T23:04:08 | 2020-03-24T23:04:08 | 244,584,942 | 1 | 0 | null | 2022-01-21T23:38:51 | 2020-03-03T08:46:26 | Java | UTF-8 | Java | false | false | 707 | java | import java.time.LocalDate;
import java.util.List;
import com.excilys.librarymanager.exception.DaoException;
import com.excilys.librarymanager.modele.Emprunt;
public interface EmpruntDao {
public List<Emprunt> getList() throws DaoException;
public List<Emprunt> getListCurrent() throws DaoException;
public List<Emprunt> getListCurrentByMembre(int idMembre) throws DaoException;
public List<Emprunt> getListCurrentByLivre(int idLivre) throws DaoException;
public Emprunt getById(int id) throws DaoException;
public void create(int idMembre, int idLivre, LocalDate dateEmprunt) throws DaoException;
public void update(Emprunt emprunt) throws DaoException;
public int count() throws DaoException;
}
| [
"abasset@LAPTOP-TD2TKF7M.localdomain"
] | abasset@LAPTOP-TD2TKF7M.localdomain |
dc712f65b6d7de1808a6179a9c7373d2d39399fd | 0f792e82ccc1e7cf13310067a3c363092e0a4bec | /src/Misc/Links_count.java | 9c2eaabbcf5ad40685edb6113fe4414c5f34f484 | [] | no_license | arvindhmk/basicsSelenium | 8a88eac08273e506c8ccbc8def5e48e5dc3b6ee9 | b5d916ce70358d25a515f04353f0507151bc0d52 | refs/heads/master | 2022-06-20T09:22:29.551433 | 2020-05-13T09:54:54 | 2020-05-13T09:54:54 | 263,579,227 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,174 | java | package Misc;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
public class Links_count
{
public static void main(String[] args) throws InterruptedException
{
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver","C:\\Users\\user\\Downloads\\Compressed\\chromedriver.exe" );
ChromeOptions option = new ChromeOptions();
option.setExperimentalOption("useAutomationExtension", false);
option.setExperimentalOption("excludeSwitches", Collections.singletonList("enable-automation"));
option.addArguments("disable-notifications");
option.addArguments("disable-geolocation");
WebDriver driver = new ChromeDriver(option);
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS);
driver.get("http://www.qaclickacademy.com/practice.php");
int link_count = driver.findElements(By.tagName("a")).size();
System.out.println("Total link count ==>"+link_count);
//Links in Footer section
//limiting webdriver scope to footer section
WebElement Footer_section=driver.findElement(By.id("gf-BIG"));
int Footerlinkcount = Footer_section.findElements(By.tagName("a")).size();
System.out.println("Total Footer link count==>"+Footerlinkcount);
//limiting the section within footer
//WebElement Columnsection_footer = Footer_section.findElement(By.xpath("//table/tbody/tr/td[1]/ul"));
WebElement Columnsection_footer = Footer_section.findElement(By.xpath("//ul[1]"));
int Columnsectionfootercount = Columnsection_footer.findElements(By.tagName("a")).size();
System.out.println("FooterColumn section count==>"+ Columnsectionfootercount);
//To open all links in the footer section
for(int i=1;i<Columnsectionfootercount;i++)
{
String Clickontablinks = Keys.chord(Keys.CONTROL,Keys.ENTER);
Columnsection_footer.findElements(By.tagName("a")).get(i).sendKeys(Clickontablinks);
Thread.sleep(3000);
}
//String parentwin = driver.getWindowHandle();
Set<String> windows = driver.getWindowHandles();
List<String> allwindows = new ArrayList<>(windows);
System.out.println("window count ==>"+windows.size());
driver.switchTo().window(allwindows.get(0));
System.out.println("parentwindow==>"+driver.getTitle());
driver.switchTo().window(allwindows.get(1));
System.out.println("window1==>"+driver.getTitle());
driver.switchTo().window(allwindows.get(0));
driver.switchTo().window(allwindows.get(2));
System.out.println("window2==>"+driver.getTitle());
driver.switchTo().window(allwindows.get(0));
driver.switchTo().window(allwindows.get(3));
System.out.println("window3==>"+driver.getTitle());
driver.switchTo().window(allwindows.get(0));
driver.switchTo().window(allwindows.get(4));
System.out.println("window4==>"+driver.getTitle());
driver.switchTo().window(allwindows.get(0));
driver.quit();
}
}
| [
"mkarvindh@gmail.com"
] | mkarvindh@gmail.com |
c156e677f44929816f73229b6fe94c29a5867a24 | abec86446eef678b1db232a009af5a0d382b54f3 | /data/perfin/data/dao/MySQLDAOFactory.java | ef1ce22be553555042c87338298f6fcb62f03e32 | [] | no_license | skbiswas/perfin | a82516d52a4191fee970a244204068dc6951953b | 8006e119835323e6ab01d3d057b918cab65e51a7 | refs/heads/master | 2021-01-25T10:07:41.296874 | 2011-08-24T18:04:07 | 2011-08-24T18:04:07 | 2,262,006 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,179 | java | /**
*
*/
package perfin.data.dao;
import java.util.HashMap;
import java.util.Map;
import perfin.data.dao.expense.ExpenseDAO;
import perfin.data.dao.expense.MySQLExpenseDAOImpl;
import perfin.data.dao.investment.InvestmentDAO;
import perfin.data.dao.investment.InvestmentDAOImpl;
import perfin.data.dao.savings.SavingsDAO;
import perfin.data.dao.savings.SavingsDAOImpl;
/**
* @author skbiswas
*
*/
public class MySQLDAOFactory extends DAOFactory {
private static final String DRIVER = "com.mysql.jdbc.Driver";
private static final String DB_URL = "jdbc:mysql://localhost/perfin";
private static final String USER = "root";
private static final String PWD = "root1234";
@Override
public ExpenseDAO getExpenseDAO() {
Map<String,String> dbDetails = new HashMap<String,String> ();
dbDetails.put("driver", DRIVER);
dbDetails.put("url", DB_URL);
dbDetails.put("user", USER);
dbDetails.put("password", PWD);
return MySQLExpenseDAOImpl.getInstance(dbDetails);
}
@Override
public InvestmentDAO getInvestmentDAO() {
return InvestmentDAOImpl.getInstance();
}
@Override
public SavingsDAO getSavingsDAO() {
return SavingsDAOImpl.getInstance();
}
}
| [
"skbiswas@.(none)"
] | skbiswas@.(none) |
bc3c7b006c73ff052efaeb1c5a7573a75d3a014d | 542efb2d447273d5142ef92129bbbdd9914344a2 | /onedrivesdk/src/main/java/com/onedrive/sdk/generated/BaseSharingInvitation.java | 700c8c84ab5d45b0043db9e7cde6b236a55cd693 | [
"MIT"
] | permissive | spudi/onedrive-sdk-android | d8c58640345a7f7e6e35efc6e1c68384c93e21df | 1553371690e52d9b4ff9c9ee0b89c44879b43711 | refs/heads/master | 2021-04-27T00:22:41.735684 | 2018-03-05T14:32:55 | 2018-03-05T14:32:55 | 123,801,688 | 0 | 0 | MIT | 2018-03-04T15:25:44 | 2018-03-04T15:25:44 | null | UTF-8 | Java | false | false | 3,304 | java | // ------------------------------------------------------------------------------
// Copyright (c) 2015 Microsoft Corporation
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
// ------------------------------------------------------------------------------
package com.onedrive.sdk.generated;
import com.onedrive.sdk.concurrency.*;
import com.onedrive.sdk.core.*;
import com.onedrive.sdk.extensions.*;
import com.onedrive.sdk.http.*;
import com.onedrive.sdk.generated.*;
import com.onedrive.sdk.options.*;
import com.onedrive.sdk.serializer.*;
import java.util.*;
import com.google.gson.JsonObject;
import com.google.gson.annotations.*;
// **NOTE** This file was generated by a tool and any changes will be overwritten.
/**
* The class for the Base Sharing Invitation.
*/
public class BaseSharingInvitation implements IJsonBackedObject {
/**
* The Email.
*/
@SerializedName("email")
public String email;
/**
* The Invited By.
*/
@SerializedName("invitedBy")
public IdentitySet invitedBy;
/**
* The Sign In Required.
*/
@SerializedName("signInRequired")
public Boolean signInRequired;
/**
* The Send Invitation Status.
*/
@SerializedName("sendInvitationStatus")
public String sendInvitationStatus;
/**
* The Invite Error Resolve Url.
*/
@SerializedName("inviteErrorResolveUrl")
public String inviteErrorResolveUrl;
/**
* The raw representation of this class
*/
private transient JsonObject mRawObject;
/**
* The serializer
*/
private transient ISerializer mSerializer;
/**
* Gets the raw representation of this class
* @return the raw representation of this class
*/
public JsonObject getRawObject() {
return mRawObject;
}
/**
* Gets serializer
* @return the serializer
*/
protected ISerializer getSerializer() {
return mSerializer;
}
/**
* Sets the raw json object
*
* @param serializer The serializer
* @param json The json object to set this object to
*/
public void setRawObject(final ISerializer serializer, final JsonObject json) {
mSerializer = serializer;
mRawObject = json;
}
}
| [
"pnied@microsoft.com"
] | pnied@microsoft.com |
82f4d7b611990a7d9d7f3d12d06ab63feabf1ff4 | 8dc5b9b8ad0800fff921b21f3edef0bfa11fcee7 | /src/Sunum02/Sb03Ters.java | 19da5ebc0d8859ebfcc124be5ba33a65a9848483 | [] | no_license | jasiunes/JavaPractice | dfc7180a0cc585b9990c5b6d79658fa6aba38d56 | ec78b8369593650c7b8178652503e016dc11c985 | refs/heads/main | 2023-01-09T04:46:18.452115 | 2020-11-01T19:42:45 | 2020-11-01T19:42:45 | 309,172,532 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 722 | java | package Sunum02;
public class Sb03Ters {
public static void main(String[] args) {
// //String tersten yazdirma loop ile
StringBuilder stb5 = new StringBuilder("Java Learn");
String s = "";
for (int i = stb5.length()-1; i>=0; i--) {
s=s+stb5.charAt(i);
}
System.out.println(s);//relnüG ilsenüG
//String tersten yazdirma StringBuilder kullanarak
stb5.reverse();
System.out.println(stb5);//relnüG ilsenüG*/
StringBuilder s5 = new StringBuilder("Java Learn");
//capacity() ve length() farki?
s5.append("Gelsin");
s5.append(" Gelmesin caylar");
System.out.println(s5.capacity());
System.out.println(s5.length());
System.out.println(s5);
}
}
| [
"muazunes@gmail.com"
] | muazunes@gmail.com |
ab6bdd040e82ba448613c3bfe0e11f9f5c82e4cb | 440c4ba4f7aef0f3d2a2e7a01388f45df165c438 | /build/generated/jax-wsCache/Blog/com/simpleblog/UserModel.java | 41271bedb90363f7ede02002e96c2ce226d00056 | [] | no_license | darwin-prasetio/WebClient | 8b7f0ac941c6c7fcb6f58df4437ed50a99a0fc90 | 1b5ffa0e7223203a0b7ebba3b1314cadfd306a4e | refs/heads/master | 2020-11-26T20:58:21.211408 | 2014-12-13T13:41:44 | 2014-12-13T13:41:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,635 | java |
package com.simpleblog;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for userModel complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="userModel">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="email" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="id" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="nama" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="password" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="role" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "userModel", propOrder = {
"email",
"id",
"nama",
"password",
"role"
})
public class UserModel {
protected String email;
protected String id;
protected String nama;
protected String password;
protected String role;
/**
* Gets the value of the email property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getEmail() {
return email;
}
/**
* Sets the value of the email property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setEmail(String value) {
this.email = value;
}
/**
* Gets the value of the id property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getId() {
return id;
}
/**
* Sets the value of the id property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setId(String value) {
this.id = value;
}
/**
* Gets the value of the nama property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getNama() {
return nama;
}
/**
* Sets the value of the nama property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setNama(String value) {
this.nama = value;
}
/**
* Gets the value of the password property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPassword() {
return password;
}
/**
* Sets the value of the password property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPassword(String value) {
this.password = value;
}
/**
* Gets the value of the role property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRole() {
return role;
}
/**
* Sets the value of the role property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRole(String value) {
this.role = value;
}
}
| [
"yafithekid212@gmail.com"
] | yafithekid212@gmail.com |
4f9113772a074df720498ec51c6a9a7ab945db62 | 9230306e79d9ff05e4846fa590d277327f2deebf | /contracts/src/test/java/com/template/contracts/IssueTests.java | d11bfbd73cb4a5ba89c2de8c69e9415da94f2ae9 | [
"Apache-2.0"
] | permissive | KztTateyama/cordapp-sample-one | 2d92de1cee11c971338b1e3e9985b4f1f381d4ad | 8f2803113474e9b3038a9aebf81f47c13dca5778 | refs/heads/release-V4 | 2022-09-12T03:49:07.546593 | 2020-05-27T02:06:10 | 2020-05-27T02:06:10 | 267,194,268 | 0 | 0 | NOASSERTION | 2020-05-27T02:06:11 | 2020-05-27T01:47:45 | Java | UTF-8 | Java | false | false | 2,715 | java | package com.template.contracts;
import com.template.states.SampleState;
import net.corda.core.contracts.CommandData;
import net.corda.core.contracts.TypeOnlyCommandData;
import net.corda.testing.contracts.DummyState;
import net.corda.testing.node.MockServices;
import org.junit.Test;
import java.util.Arrays;
import static com.template.TestUtils.*;
import static net.corda.testing.node.NodeTestUtils.ledger;
public class IssueTests {
// A pre-defined dummy command.
public interface Commands extends CommandData {
class DummyCommand extends TypeOnlyCommandData implements Commands{}
}
static private final MockServices ledgerServices = new MockServices(
Arrays.asList("com.template", "net.corda.finance.contracts")
);
@Test
public void mustIncludeIssueCommand() {
SampleState iou =
new SampleState(ACity.getParty(),100);
ledger(ledgerServices, l -> {
l.transaction(tx -> {
tx.output(SampleContract.IOU_CONTRACT_ID, iou);
tx.command(ACity.getPublicKey(), new Commands.DummyCommand()); // Wrong type.
return tx.fails();
});
l.transaction(tx -> {
tx.output(SampleContract.IOU_CONTRACT_ID, iou);
tx.command(ACity.getPublicKey(), new SampleContract.Commands.Issue()); // Correct type.
return tx.verifies();
});
return null;
});
}
/**
* Task 2.
* Make sure States only sets output.
* If it doesn't include output,or the state contains input, throw an error.
*/
@Test
public void issueTransactionMustHaveNoInputs() {
SampleState iou =
new SampleState(ACity.getParty(),100);
ledger(ledgerServices, l -> {
l.transaction(tx -> {
tx.input(SampleContract.IOU_CONTRACT_ID, new DummyState());
tx.command(ACity.getPublicKey(), new SampleContract.Commands.Issue()); // Wrong type.
return tx.fails();
});
l.transaction(tx -> {
tx.input(SampleContract.IOU_CONTRACT_ID, new DummyState());
tx.output(SampleContract.IOU_CONTRACT_ID, iou);
tx.command(ACity.getPublicKey(), new SampleContract.Commands.Issue()); // Wrong type.
return tx.fails();
});
l.transaction(tx -> {
tx.output(SampleContract.IOU_CONTRACT_ID, iou);
tx.command(ACity.getPublicKey(), new SampleContract.Commands.Issue()); // Correct type.
return tx.verifies();
});
return null;
});
}
} | [
"kzt.tateyama@gmail.com"
] | kzt.tateyama@gmail.com |
2533201bfdfb019c0273baf9b5d5e3fb3ae9c8ee | 4d8289257523e5df359de165fd96ac8af4fca739 | /chapter3_exercise/PointPositionQuestion32.java | 251c802daa041c59793d89c30483842110b64f48 | [] | no_license | XieJing520/Java-programming-example | 251be3590f4d23c7cd12476fb9405b3d8938b04d | 7e36cb0fb5487e7413f36f11f93771f214de87ef | refs/heads/master | 2022-12-11T14:23:02.751946 | 2020-09-10T09:57:34 | 2020-09-10T09:57:34 | 283,196,984 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 881 | java | package chapter3_exercise;
import java.util.*;
public class PointPositionQuestion32 {
public static void main(String[] args) {
double xP0,yP0,xP1,yP1,xP2,yP2;
int discriminant;
// Prompt the user to enter the three points
System.out.print("Enter three points for p0, p1, and p2: ");
Scanner input = new Scanner(System.in);
xP0 = input.nextDouble();
yP0 = input.nextDouble();
xP1 = input.nextDouble();
yP1 = input.nextDouble();
xP2 = input.nextDouble();
yP2 = input.nextDouble();
discriminant = (int)((xP1 - xP0) * (yP2 - yP0) - (xP2 - xP0) * (yP1 - yP0));
if(discriminant > 0)
System.out.println("p2 is on the left side of the line");
else if(0 == discriminant)
System.out.println("p2 is on the same line");
else
System.out.println("p2 is on the right side of the line");
input.close();
}
}
| [
"noreply@github.com"
] | noreply@github.com |
70321e1c368a5b45c88d0e2cd14df5ca56d3d54a | 5a1f519ce8cf1eb2276e946725e6275dce3317cf | /src/java/MiriamCenter/CityController.java | 18bd8275ac622172211df5e07627113082660c06 | [] | no_license | zeinabrachidi/valeurC2_ZeinabRachidi | c06c2f87c6cca6bcd93899cb8fc637bcfc2f2bd2 | 68552a622eed62ec57cd43fea30d2ac7315e7299 | refs/heads/master | 2020-04-01T22:03:42.426728 | 2018-12-09T20:34:38 | 2018-12-09T20:34:38 | 153,689,281 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,940 | java | package MiriamCenter;
import MiriamCenter.util.JsfUtil;
import MiriamCenter.util.PaginationHelper;
import java.io.Serializable;
import java.util.ResourceBundle;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;
import javax.faces.model.SelectItem;
@ManagedBean(name = "cityController")
@SessionScoped
public class CityController implements Serializable {
private City current;
private DataModel items = null;
@EJB
private MiriamCenter.CityFacade ejbFacade;
private PaginationHelper pagination;
private int selectedItemIndex;
public CityController() {
}
public City getSelected() {
if (current == null) {
current = new City();
selectedItemIndex = -1;
}
return current;
}
private CityFacade getFacade() {
return ejbFacade;
}
public PaginationHelper getPagination() {
if (pagination == null) {
pagination = new PaginationHelper(10) {
@Override
public int getItemsCount() {
return getFacade().count();
}
@Override
public DataModel createPageDataModel() {
return new ListDataModel(getFacade().findRange(new int[]{getPageFirstItem(), getPageFirstItem() + getPageSize()}));
}
};
}
return pagination;
}
public String prepareList() {
recreateModel();
return "List";
}
public String prepareView() {
current = (City) getItems().getRowData();
selectedItemIndex = pagination.getPageFirstItem() + getItems().getRowIndex();
return "View";
}
public String prepareCreate() {
current = new City();
selectedItemIndex = -1;
return "Create";
}
public String create() {
try {
getFacade().create(current);
JsfUtil.addSuccessMessage(ResourceBundle.getBundle("/Bundle").getString("CityCreated"));
return prepareCreate();
} catch (Exception e) {
JsfUtil.addErrorMessage(e, ResourceBundle.getBundle("/Bundle").getString("PersistenceErrorOccured"));
return null;
}
}
public String prepareEdit() {
current = (City) getItems().getRowData();
selectedItemIndex = pagination.getPageFirstItem() + getItems().getRowIndex();
return "Edit";
}
public String update() {
try {
getFacade().edit(current);
JsfUtil.addSuccessMessage(ResourceBundle.getBundle("/Bundle").getString("CityUpdated"));
return "View";
} catch (Exception e) {
JsfUtil.addErrorMessage(e, ResourceBundle.getBundle("/Bundle").getString("PersistenceErrorOccured"));
return null;
}
}
public String destroy() {
current = (City) getItems().getRowData();
selectedItemIndex = pagination.getPageFirstItem() + getItems().getRowIndex();
performDestroy();
recreatePagination();
recreateModel();
return "List";
}
public String destroyAndView() {
performDestroy();
recreateModel();
updateCurrentItem();
if (selectedItemIndex >= 0) {
return "View";
} else {
// all items were removed - go back to list
recreateModel();
return "List";
}
}
private void performDestroy() {
try {
getFacade().remove(current);
JsfUtil.addSuccessMessage(ResourceBundle.getBundle("/Bundle").getString("CityDeleted"));
} catch (Exception e) {
JsfUtil.addErrorMessage(e, ResourceBundle.getBundle("/Bundle").getString("PersistenceErrorOccured"));
}
}
private void updateCurrentItem() {
int count = getFacade().count();
if (selectedItemIndex >= count) {
// selected index cannot be bigger than number of items:
selectedItemIndex = count - 1;
// go to previous page if last page disappeared:
if (pagination.getPageFirstItem() >= count) {
pagination.previousPage();
}
}
if (selectedItemIndex >= 0) {
current = getFacade().findRange(new int[]{selectedItemIndex, selectedItemIndex + 1}).get(0);
}
}
public DataModel getItems() {
if (items == null) {
items = getPagination().createPageDataModel();
}
return items;
}
private void recreateModel() {
items = null;
}
private void recreatePagination() {
pagination = null;
}
public String next() {
getPagination().nextPage();
recreateModel();
return "List";
}
public String previous() {
getPagination().previousPage();
recreateModel();
return "List";
}
public SelectItem[] getItemsAvailableSelectMany() {
return JsfUtil.getSelectItems(ejbFacade.findAll(), false);
}
public SelectItem[] getItemsAvailableSelectOne() {
return JsfUtil.getSelectItems(ejbFacade.findAll(), true);
}
@FacesConverter(forClass = City.class)
public static class CityControllerConverter implements Converter {
@Override
public Object getAsObject(FacesContext facesContext, UIComponent component, String value) {
if (value == null || value.length() == 0) {
return null;
}
CityController controller = (CityController) facesContext.getApplication().getELResolver().
getValue(facesContext.getELContext(), null, "cityController");
return controller.ejbFacade.find(getKey(value));
}
java.lang.Integer getKey(String value) {
java.lang.Integer key;
key = Integer.valueOf(value);
return key;
}
String getStringKey(java.lang.Integer value) {
StringBuilder sb = new StringBuilder();
sb.append(value);
return sb.toString();
}
@Override
public String getAsString(FacesContext facesContext, UIComponent component, Object object) {
if (object == null) {
return null;
}
if (object instanceof City) {
City o = (City) object;
return getStringKey(o.getIdcity());
} else {
throw new IllegalArgumentException("object " + object + " is of type " + object.getClass().getName() + "; expected type: " + City.class.getName());
}
}
}
}
| [
"zeinab.rachidi@isae.edu.lb"
] | zeinab.rachidi@isae.edu.lb |
011d9672d79963ccbf2ac8c3f5a3fd67ffffe32f | 743bdc5d599ef611b2b6c0559114a576225c1ebd | /src/com/geeks_for_geeks/array/array_rotations/Find_Index_Of_Min_Element_In_Rotated_Sorted_Array_USING_LinearSearch.java | b6f883270bcc9f9a0ac0f7a0c150f17ea21d0bdc | [] | no_license | prateek-bangre/DataStructure_Algorithms | c5988bb6c464f6952c0e8dfb55241efd92dfd7c7 | d20ac036c29a2a920e82a426c94a6a28b15d7a78 | refs/heads/master | 2023-04-29T22:27:24.418806 | 2021-05-21T09:55:54 | 2021-05-21T09:55:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,442 | java | package com.geeks_for_geeks.array.array_rotations;
/**
* @author prateek.bangre on 03/03/20.
* @Project DataStructure_Algorithms
*/
/*
https://www.geeksforgeeks.org/find-rotation-count-rotated-sorted-array/
Consider an array of distinct numbers sorted in increasing order. The array has been rotated (clockwise) k
number of times. Given such an array, find the value of k.
Examples:
Input : arr[] = {15, 18, 2, 3, 6, 12}
Output: 2
Explanation : Initial array must be {2, 3,
6, 12, 15, 18}. We get the given array after
rotating the initial array twice.
Input : arr[] = {7, 9, 11, 12, 5}
Output: 4
Input: arr[] = {7, 9, 11, 12, 15};
Output: 0
If we take closer look at examples, we can notice that the number of rotations is equal to index of
minimum element. A simple linear solution is to find minimum element and returns its index.
Time Complexity : O(n)
*/
public class Find_Index_Of_Min_Element_In_Rotated_Sorted_Array_USING_LinearSearch {
private static int countRotations(int[] arr, int length) {
int min = arr[0];
int minIndex = -1;
for (int i=0; i<length; ++i){
if (min >= arr[i]) {
min = arr[i];
minIndex = i;
}
}
return minIndex;
}
public static void main (String[] args)
{
int arr[] = {15, 18, 2, 3, 6, 12};
int n = arr.length;
System.out.println(countRotations(arr, n));
}
}
| [
"prateekbangre@gmail.com"
] | prateekbangre@gmail.com |
04d1c54c0a6021e625d71fb749c983994e91d5f5 | ef998e40ad60b9d071ff092736e0c728fa3dfb03 | /src/java/DAO/PersonaDAO.java | 233d15343012ff6b10cffcf0ac11dc4b6d37238c | [] | no_license | macc12/web-database | 0d63d52bccb0d7fe4b1d016d56faab82718bbfee | dafda96d3852117013bdd81a31e2ba252aa3d56d | refs/heads/master | 2020-03-31T00:56:02.408760 | 2018-10-12T16:11:24 | 2018-10-12T16:11:24 | 151,759,890 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,001 | 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 DAO;
import VO.Persona;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author Labing
*/
public class PersonaDAO implements IBaseDatos<Persona> {
@Override
public List<Persona> findAll() throws SQLException {
List<Persona> personas = null;
String query = "SELECT * FROM Persona";
Connection connection = Conexion.getConnection();
try {
Statement st = connection.createStatement();
ResultSet rs = st.executeQuery(query);
int id = 0;
String nombre = null;
String apelldio = null;
while (rs.next()) {
if (personas == null) {
personas = new ArrayList<Persona>();
}
Persona registro = new Persona();
id = rs.getInt("cedula");
registro.setCedula(id);
nombre = rs.getString("nombre");
registro.setNombre(nombre);
apelldio = rs.getString("apellido");
registro.setApellido(apelldio);
personas.add(registro);
}
st.close();
} catch (SQLException e) {
System.out.println("Problemas al obtener la lista de Persona");
e.printStackTrace();
}
return personas;
}
@Override
public boolean insert(Persona t) throws SQLException {
int result = 0;
Connection connection = Conexion.getConnection();
String query = " insert into Persona" + " values (?,?,?)";
PreparedStatement preparedStmt = null;
try {
preparedStmt = connection.prepareStatement(query);
preparedStmt.setInt(1, t.getCedula());
preparedStmt.setString(2, t.getNombre());
preparedStmt.setString(3, t.getApellido());
result = preparedStmt.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}
if(result==0){
return false;
}else{
return true;
}
}
@Override
public boolean update(Persona t) throws SQLException {
boolean result = false;
Connection connection = Conexion.getConnection();
String query = "update Persona set nombre = ?, apellido = ? where cedula = ?";
PreparedStatement preparedStmt = null;
try {
preparedStmt = connection.prepareStatement(query);
preparedStmt.setInt(1, t.getCedula());
preparedStmt.setString(2, t.getNombre());
preparedStmt.setString(3, t.getApellido());
if (preparedStmt.executeUpdate() > 0) {
result = true;
}
} catch (SQLException e) {
e.printStackTrace();
}
return result;
}
@Override
public boolean delete(Persona t) throws SQLException {
boolean result = false;
Connection connection = Conexion.getConnection();
String query = "delete from Persona where cedula = ?";
PreparedStatement preparedStmt = null;
try {
preparedStmt = connection.prepareStatement(query);
preparedStmt.setInt(1, t.getCedula());
result = preparedStmt.execute();
} catch (SQLException e) {
e.printStackTrace();
}
return result;
}
public Persona find(int cedula) throws SQLException {
Persona resultado = null;
PreparedStatement preparedStmt = null;
String query = "SELECT * FROM Persona where cedula = ?";
Connection connection = Conexion.getConnection();
try {
Statement st = connection.createStatement();
ResultSet rs = st.executeQuery(query);
preparedStmt.setInt(1, cedula);
int id = 0;
String nombre = null;
String apelldio = null;
if (rs.next()) {
resultado = new Persona();
id = rs.getInt("cedula");
resultado.setCedula(id);
nombre = rs.getString("nombre");
resultado.setNombre(nombre);
apelldio = rs.getString("apellido");
resultado.setApellido(apelldio);
}
st.close();
} catch (SQLException e) {
System.out.println("Problemas al obtener la lista de Persona");
e.printStackTrace();
}
return resultado;
}
}
| [
"Labing@LabingXEON-PC"
] | Labing@LabingXEON-PC |
a4fab8ee575a5f123f5927baf7216d0d8bdd7162 | ef4829b9f2a68d1d4c6b96d48081ebabe2f31082 | /app/src/main/java/com/example/final_example/ItemAdapter.java | 782f0ec1cf74bf62464dc7be35937fd5c4ce009f | [] | no_license | hmqiwtCode/Final | 7973443b1232c0d99b0f8a1e3bd5c63f0b461780 | e8443bf90fc77a9a669f49c72f17780dcd281dda | refs/heads/master | 2023-02-07T21:23:23.217747 | 2020-12-27T06:52:22 | 2020-12-27T06:52:22 | 324,704,855 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,744 | java | package com.example.final_example;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.Filter;
import android.widget.Filterable;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.cardview.widget.CardView;
import androidx.recyclerview.widget.RecyclerView;
import java.util.List;
public class ItemAdapter extends RecyclerView.Adapter<ItemAdapter.ItemHolder> implements Filterable {
private Context context;
public List<Animal> listAnimal;
private FilterAnimal filterAnimal;
public ItemAdapter(Context context,List<Animal> listAnimal ){
this.context = context;
this.listAnimal = listAnimal;
}
@NonNull
@Override
public ItemHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new ItemHolder(LayoutInflater.from(context).inflate(R.layout.custom_item,parent,false));
}
@Override
public void onBindViewHolder(@NonNull ItemHolder holder, int position) {
final Animal animal = listAnimal.get(position);
holder.button2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(context,DetailAnimal.class);
intent.putExtra("animal",animal);
context.startActivity(intent);
}
});
holder.img.setImageResource(animal.getBala());
holder.textView2.setText(animal.getName());
holder.textView3.setText(animal.getDes());
holder.textView4.setText(animal.getPrices()+"");
}
@Override
public int getItemCount() {
return listAnimal.size();
}
@Override
public Filter getFilter() {
if (filterAnimal == null){
filterAnimal = new FilterAnimal(listAnimal,this);
}
return filterAnimal;
}
public void setListAnimal(List<Animal> listAnimal) {
this.listAnimal = listAnimal;
this.notifyDataSetChanged();
}
class ItemHolder extends RecyclerView.ViewHolder{
private Button button2;
private ImageView img;
private TextView textView2, textView3, textView4;
public ItemHolder(@NonNull View view) {
super(view);
button2 = view.findViewById(R.id.button2);
img = view.findViewById(R.id.img);
textView2 = view.findViewById(R.id.textView2);
textView3 = view.findViewById(R.id.textView3);
textView4 = view.findViewById(R.id.textView4);
}
}
}
| [
"huynhminhquy1999@gmail.com"
] | huynhminhquy1999@gmail.com |
2414364d336fcbcfea461654db3b47565b6a4475 | 83b209dc9f3fd09545bde2debee9c8a5c6c5a46d | /app/src/main/java/com/bme/ecgidentification/BmobUtil.java | 1274f914b750cf45e2d8233a981718fbed890f15 | [] | no_license | hengtao24/ECGIdentification | 1a932157c858e9d0e51c8599dbadc00e94d08b9c | 780aaadb52a13969aadedc6bdb97cdcc3ff852f4 | refs/heads/master | 2021-01-21T22:44:30.788464 | 2017-09-21T11:23:02 | 2017-09-21T11:23:02 | 102,171,292 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 183 | java | package com.bme.ecgidentification;
/**
* Created by sht on 2017/9/5.
*/
public class BmobUtil {
public static final String ApplicationId = "c44541d4599f84fd0076f9c8208cc66d";
}
| [
"hengtao242gmail.com"
] | hengtao242gmail.com |
b8cbf18c7c6cac378f870f4c762db7a10f724eb0 | 3525c681b4b03f6aa0754bb3c0279ec72b607af9 | /src/main/java/com/akhaltech/robot/common/FileUtil.java | 714abe17cd542eedddbf84712faab0786745cede | [] | no_license | vincezzh/doctorrobot | 0012911784a7ab508476c4d5d090f9b977508d2d | fca7a081e33025436afa81f78d0433791a49c3e1 | refs/heads/master | 2021-01-13T01:41:03.180202 | 2016-03-03T18:15:30 | 2016-03-03T18:15:30 | 42,457,285 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,114 | java | package com.akhaltech.robot.common;
import org.apache.log4j.Logger;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
/**
* Created by vince on 2015-09-09.
*/
public class FileUtil {
private final static Logger log = Logger.getLogger(FileUtil.class);
public static void appendContent(String fileName, String data) {
BufferedWriter bufferWritter = null;
try {
File file =new File(fileName);
if(!file.exists()) {
file.createNewFile();
}
FileWriter fileWritter = new FileWriter(file, true);
bufferWritter = new BufferedWriter(fileWritter);
bufferWritter.write(data);
bufferWritter.write(",\n");
}catch(IOException e) {
log.error(e.getMessage());
}finally {
if(bufferWritter != null) {
try {
bufferWritter.close();
} catch (IOException e) {
log.error(e.getMessage());
}
}
}
}
}
| [
"vincezzh@gmail.com"
] | vincezzh@gmail.com |
6d7fda5eea7cbd3c14adb3613c256848f53e1709 | 89054f560da9d646ab17941366c8ff18f429a184 | /register_strutsmvc 2/src/com/shixun/online/action/UserAction.java | 088e28b72b92da7e07c9d6bcecc3d976005050da | [] | no_license | wenyoushixun/hpeu_shixun | a2e861b7eb79a25f4c5fa02cbc7b7a6c1bfe2a20 | ab0fdf9a395da2ffba2545722ba1ac60c9cba6cf | refs/heads/master | 2021-05-05T12:11:43.928178 | 2017-11-22T06:49:16 | 2017-11-22T06:49:16 | 104,723,318 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,177 | java | package com.shixun.online.action;
import java.sql.SQLException;
import com.shixun.online.model.User;
import com.shixun.online.service.UserService;
public class UserAction {
private User user;
private String message;
private String messages;
public String getMessages() {
return messages;
}
public void setMessages(String messages) {
this.messages = messages;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
UserService ser = new UserService();
public String login() {
if (ser.login(user) == 1) {
return "success";
} else if (ser.login(user) == -1) {
message = "用户名不存在";
return "fail";
}else{
message = "密码错误";
return "fail";
}
}
public String index() throws SQLException {
if(ser.index(user)==true){
messages = "注册成功!";
return "success";
}
messages = "用户名也存在,请换其它用户注册!";
return "fail";
}
}
| [
"wenyou@192.168.1.99"
] | wenyou@192.168.1.99 |
6801078f7dbadcdc3dccc8c4aa47cccffb52850c | 70fa1fd24ac8f18d98ba1981791726d578c7bdb5 | /src/main/java/cn/springmvc/model/EquCheckDetail.java | b3eff71cab70394214cc9ef320c17fd59a306fee | [
"Apache-2.0"
] | permissive | JoshEliYang/PriceTag | 9588b24954ab39107578ef65a48e344c9600b2ac | ea82f4f3a1106b8251f4ed5d5cbbb0bdf7cdeb6b | refs/heads/master | 2020-04-12T08:58:08.951613 | 2017-05-03T05:40:35 | 2017-05-03T05:40:35 | 48,784,338 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 981 | java | package cn.springmvc.model;
public class EquCheckDetail {
private int id;
private int equCheckId;
private String equName;
private int num;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getEquCheckId() {
return equCheckId;
}
public void setEquCheckId(int equCheckId) {
this.equCheckId = equCheckId;
}
public String getEquName() {
return equName;
}
public void setEquName(String equName) {
this.equName = equName;
}
public int getNum() {
return num;
}
public void setNum(int num) {
this.num = num;
}
public EquCheckDetail() {
super();
}
public EquCheckDetail(int id, int equCheckId, String equName, int num) {
super();
this.id = id;
this.equCheckId = equCheckId;
this.equName = equName;
this.num = num;
}
@Override
public String toString() {
return "EquCheckDetail [id=" + id + ", equCheckId=" + equCheckId
+ ", equName=" + equName + ", num=" + num + "]";
}
}
| [
"joshy@gobeta.com.cn"
] | joshy@gobeta.com.cn |
974cc87d41d4fe1ab05e702e966eef53f092ac36 | b92fbaede8d1e8ecda06e607bbacef48242c0f02 | /src/Form/GiamGiaForm.java | a8a74d3ffa8b0ab89ab4bd03290873ecfeaee23a | [] | no_license | DangTH112001/Qu-n-l-Nh-h-ng-buffet | 4023a04b4fe1bafb6fd4e97b9f4883ffbbac5b7e | 93cc832858c0bf8d1b73606afcfed94d9203ba32 | refs/heads/master | 2023-06-16T01:31:55.415073 | 2021-07-08T05:52:43 | 2021-07-08T05:52:43 | 368,715,066 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 18,694 | 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 Form;
import Controller.GiamGiaController;
import DBObject.SQLTable;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
/**
*
* @author DangT
*/
public class GiamGiaForm extends javax.swing.JFrame {
private Date date;
private int TAG;
private String ID;
private int RowID;
public GiamGiaForm() {
this.date = new Date();
this.TAG = 1;
initComponents();
}
public GiamGiaForm(Object[] data, int RowID) {
this.date = new Date();
this.TAG = 2;
this.RowID = RowID;
initComponents();
initInfo(data);
}
private void add() {
if (check()) {
GiamGiaController.add(getInfo());
dispose();
}
else
ErrorMessage();
}
private void update() {
if (check()) {
GiamGiaController.update(getInfo());
dispose();
}
else
ErrorMessage();
}
private boolean check() {
Object[] data = getInfo();
int[] idx = {1, 2, 3, 6};
for (int i = 0; i < idx.length; i++)
if (data[idx[i]].equals(""))
return false;
return true;
}
private void ErrorMessage() {
JOptionPane.showMessageDialog(null, "Invalid Input");
}
private Object[] getInfo() {
DateFormat format = new SimpleDateFormat("dd/MM/yyyy");
String Name = tf_TenGG.getText();
String Percent = tf_PhanTram.getText();
String Type = tf_LoaiKH.getText();
String Start= "01/01/0000";
String End= "31/12/9999";
if (dc_NGBD.getDate() != null)
Start = format.format(dc_NGBD.getDate());
if (dc_NGKT.getDate() != null)
End = format.format(dc_NGKT.getDate());
String Status = tf_TinhTrang.getText();
if (ID == null)
ID = SQLTable.getTableID("GIAMGIA", "GG");
Object[] data = {ID, Name, Percent, Type, Start, End, Status};
return data;
}
private void initInfo(Object[] data) {
DateFormat format = new SimpleDateFormat("dd/MM/yyyy");
ID = (String) data[0];
tf_TenGG.setText((String) data[1]);
tf_PhanTram.setText((String) data[2]);
tf_LoaiKH.setText((String) data[3]);
try {
dc_NGBD.setDate(format.parse((String) data[4]));
dc_NGKT.setDate(format.parse((String) data[5]));
} catch (ParseException ex) {
Logger.getLogger(GiamGiaForm.class.getName()).log(Level.SEVERE, null, ex);
}
tf_TinhTrang.setText((String) data[6]);
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
GiamGiaPanel = new javax.swing.JPanel();
lb_GiamGiaTitle = new javax.swing.JLabel();
lb_TenGG = new javax.swing.JLabel();
lb_NGAN = new javax.swing.JLabel();
lb_NGDV = new javax.swing.JLabel();
lb_TGBD = new javax.swing.JLabel();
lb_PhanTram = new javax.swing.JLabel();
lb_TGKT = new javax.swing.JLabel();
tf_TenGG = new javax.swing.JTextField();
tf_PhanTram = new javax.swing.JTextField();
tf_TinhTrang = new javax.swing.JTextField();
tf_LoaiKH = new javax.swing.JTextField();
btnConfirm = new javax.swing.JButton();
btnExit = new javax.swing.JButton();
dc_NGBD = new com.toedter.calendar.JDateChooser();
dc_NGKT = new com.toedter.calendar.JDateChooser();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("DISCOUNT FORM");
setResizable(false);
GiamGiaPanel.setBackground(new java.awt.Color(255, 255, 255));
GiamGiaPanel.setPreferredSize(new java.awt.Dimension(950, 380));
lb_GiamGiaTitle.setBackground(new java.awt.Color(255, 255, 255));
lb_GiamGiaTitle.setFont(new java.awt.Font("Liberation Sans", 1, 22)); // NOI18N
lb_GiamGiaTitle.setForeground(new java.awt.Color(120, 168, 252));
lb_GiamGiaTitle.setText("DISCOUNT INFO");
lb_TenGG.setFont(new java.awt.Font("Liberation Sans", 1, 18)); // NOI18N
lb_TenGG.setForeground(new java.awt.Color(120, 168, 252));
lb_TenGG.setText("NAME:");
lb_NGAN.setFont(new java.awt.Font("Liberation Sans", 1, 18)); // NOI18N
lb_NGAN.setForeground(new java.awt.Color(120, 168, 252));
lb_NGAN.setText("TYPE:");
lb_NGDV.setFont(new java.awt.Font("Liberation Sans", 1, 18)); // NOI18N
lb_NGDV.setForeground(new java.awt.Color(120, 168, 252));
lb_NGDV.setText("STATUS:");
lb_TGBD.setFont(new java.awt.Font("Liberation Sans", 1, 18)); // NOI18N
lb_TGBD.setForeground(new java.awt.Color(120, 168, 252));
lb_TGBD.setText("BEGIN AT:");
lb_PhanTram.setFont(new java.awt.Font("Liberation Sans", 1, 18)); // NOI18N
lb_PhanTram.setForeground(new java.awt.Color(120, 168, 252));
lb_PhanTram.setText("DISCOUNT:");
lb_TGKT.setFont(new java.awt.Font("Liberation Sans", 1, 18)); // NOI18N
lb_TGKT.setForeground(new java.awt.Color(120, 168, 252));
lb_TGKT.setText("END AT:");
tf_TenGG.setFont(new java.awt.Font("Liberation Sans", 0, 18)); // NOI18N
tf_TenGG.setForeground(new java.awt.Color(120, 168, 252));
tf_TenGG.setHorizontalAlignment(javax.swing.JTextField.CENTER);
tf_TenGG.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 1, 0, new java.awt.Color(120, 168, 252)));
tf_PhanTram.setFont(new java.awt.Font("Liberation Sans", 0, 18)); // NOI18N
tf_PhanTram.setForeground(new java.awt.Color(120, 168, 252));
tf_PhanTram.setHorizontalAlignment(javax.swing.JTextField.CENTER);
tf_PhanTram.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 1, 0, new java.awt.Color(120, 168, 252)));
tf_TinhTrang.setFont(new java.awt.Font("Liberation Sans", 0, 18)); // NOI18N
tf_TinhTrang.setForeground(new java.awt.Color(120, 168, 252));
tf_TinhTrang.setHorizontalAlignment(javax.swing.JTextField.CENTER);
tf_TinhTrang.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 1, 0, new java.awt.Color(120, 168, 252)));
tf_LoaiKH.setFont(new java.awt.Font("Liberation Sans", 0, 18)); // NOI18N
tf_LoaiKH.setForeground(new java.awt.Color(120, 168, 252));
tf_LoaiKH.setHorizontalAlignment(javax.swing.JTextField.CENTER);
tf_LoaiKH.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 1, 0, new java.awt.Color(120, 168, 252)));
btnConfirm.setBackground(new java.awt.Color(120, 168, 252));
btnConfirm.setFont(new java.awt.Font("Liberation Sans", 1, 15)); // NOI18N
btnConfirm.setForeground(new java.awt.Color(255, 255, 255));
btnConfirm.setText("CONFIRM");
btnConfirm.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
btnConfirmMouseClicked(evt);
}
});
btnExit.setBackground(new java.awt.Color(129, 0, 0));
btnExit.setFont(new java.awt.Font("Liberation Sans", 1, 15)); // NOI18N
btnExit.setForeground(new java.awt.Color(255, 255, 255));
btnExit.setText("CANCEL");
btnExit.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
btnExitMouseClicked(evt);
}
});
dc_NGBD.setDateFormatString("dd/MM/yyyy");
dc_NGKT.setDateFormatString("dd/MM/yyyy");
javax.swing.GroupLayout GiamGiaPanelLayout = new javax.swing.GroupLayout(GiamGiaPanel);
GiamGiaPanel.setLayout(GiamGiaPanelLayout);
GiamGiaPanelLayout.setHorizontalGroup(
GiamGiaPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(GiamGiaPanelLayout.createSequentialGroup()
.addGap(386, 386, 386)
.addComponent(lb_GiamGiaTitle)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(GiamGiaPanelLayout.createSequentialGroup()
.addGap(95, 95, 95)
.addGroup(GiamGiaPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(lb_TenGG)
.addComponent(lb_TGBD)
.addComponent(lb_TGKT))
.addGap(18, 18, 18)
.addGroup(GiamGiaPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(GiamGiaPanelLayout.createSequentialGroup()
.addComponent(tf_TenGG, javax.swing.GroupLayout.PREFERRED_SIZE, 213, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lb_NGAN))
.addGroup(GiamGiaPanelLayout.createSequentialGroup()
.addGroup(GiamGiaPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(dc_NGBD, javax.swing.GroupLayout.PREFERRED_SIZE, 213, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(dc_NGKT, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 213, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(143, 143, 143)
.addGroup(GiamGiaPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lb_NGDV, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(lb_PhanTram, javax.swing.GroupLayout.Alignment.TRAILING))))
.addGap(18, 18, 18)
.addGroup(GiamGiaPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(GiamGiaPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(tf_LoaiKH, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(tf_TinhTrang, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 213, Short.MAX_VALUE))
.addComponent(tf_PhanTram, javax.swing.GroupLayout.PREFERRED_SIZE, 213, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(0, 60, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, GiamGiaPanelLayout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btnConfirm)
.addGap(18, 18, 18)
.addComponent(btnExit)
.addGap(37, 37, 37))
);
GiamGiaPanelLayout.setVerticalGroup(
GiamGiaPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(GiamGiaPanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(GiamGiaPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(GiamGiaPanelLayout.createSequentialGroup()
.addComponent(lb_GiamGiaTitle)
.addGap(18, 18, 18)
.addGroup(GiamGiaPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lb_NGAN, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(tf_LoaiKH, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lb_TenGG, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(tf_TenGG, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(50, 50, 50)
.addGroup(GiamGiaPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lb_NGDV, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(tf_TinhTrang, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lb_TGBD, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(dc_NGBD, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(50, 50, 50)
.addGroup(GiamGiaPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(GiamGiaPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lb_PhanTram, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(tf_PhanTram, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lb_TGKT, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(dc_NGKT, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 45, Short.MAX_VALUE)
.addGroup(GiamGiaPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnConfirm, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnExit, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(74, 74, 74))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(GiamGiaPanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 954, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(GiamGiaPanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void btnExitMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnExitMouseClicked
dispose();
}//GEN-LAST:event_btnExitMouseClicked
private void btnConfirmMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnConfirmMouseClicked
switch (TAG) {
case 1: add(); break;
case 2: update(); break;
default: break;
}
}//GEN-LAST:event_btnConfirmMouseClicked
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(GiamGiaForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(GiamGiaForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(GiamGiaForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(GiamGiaForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new GiamGiaForm().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JPanel GiamGiaPanel;
private javax.swing.JButton btnConfirm;
private javax.swing.JButton btnExit;
private com.toedter.calendar.JDateChooser dc_NGBD;
private com.toedter.calendar.JDateChooser dc_NGKT;
private javax.swing.JLabel lb_GiamGiaTitle;
private javax.swing.JLabel lb_NGAN;
private javax.swing.JLabel lb_NGDV;
private javax.swing.JLabel lb_PhanTram;
private javax.swing.JLabel lb_TGBD;
private javax.swing.JLabel lb_TGKT;
private javax.swing.JLabel lb_TenGG;
private javax.swing.JTextField tf_LoaiKH;
private javax.swing.JTextField tf_PhanTram;
private javax.swing.JTextField tf_TenGG;
private javax.swing.JTextField tf_TinhTrang;
// End of variables declaration//GEN-END:variables
}
| [
"DangTH112001@gmail.com"
] | DangTH112001@gmail.com |
bc2e60487d6bfb09a77288ac2dadc85c4bcb2c82 | 56d1c5242e970ca0d257801d4e627e2ea14c8aeb | /src/com/csms/leetcode/number/n1300/n1360/Leetcode1363.java | 5c7a1f7cac192fb027cf7b2f4b4a6cdab6fca7e2 | [] | no_license | dai-zi/leetcode | e002b41f51f1dbd5c960e79624e8ce14ac765802 | 37747c2272f0fb7184b0e83f052c3943c066abb7 | refs/heads/master | 2022-12-14T11:20:07.816922 | 2020-07-24T03:37:51 | 2020-07-24T03:37:51 | 282,111,073 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,685 | java | package com.csms.leetcode.number.n1300.n1360;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
//形成三的最大倍数
//困难
public class Leetcode1363 {
public String largestMultipleOfThree(int[] digits) {
Arrays.sort(digits);
List<Integer> rem1Indexs = new ArrayList<>();
List<Integer> rem2Indexs = new ArrayList<>();
int sum = 0;
for(int i = 0; i < digits.length; i++){
sum += digits[i];
if(digits[i] % 3 == 1){
rem1Indexs.add(i);
} else if(digits[i] % 3 == 2){
rem2Indexs.add(i);
}
}
sum %= 3;
if(sum == 1){
if(!rem1Indexs.isEmpty()){
return constructRes(digits, rem1Indexs.get(0), -1);
} else {
return constructRes(digits, rem2Indexs.get(0), rem2Indexs.get(1));
}
} else if(sum == 2){
if(!rem2Indexs.isEmpty()){
return constructRes(digits, rem2Indexs.get(0), -1);
} else {
return constructRes(digits, rem1Indexs.get(0), rem1Indexs.get(1));
}
}
return constructRes(digits, -1, -1);
}
private String constructRes(int[] digits, int ignoreId1, int ignoreId2){
StringBuilder res = new StringBuilder();
for(int i = digits.length -1; i >= 0; i--){
if(i == ignoreId1 || i == ignoreId2){
continue;
}
res.append(digits[i]);
}
return res.length() > 0 && res.charAt(0) == '0' ? "0": res.toString();
}
public static void main(String[] args) {
}
} | [
"liuxiaotongdaizi@sina.com"
] | liuxiaotongdaizi@sina.com |
6edd75c429dea31543e89f3a0347ecb467502f32 | 1b0acd6cd3f9725993c744b874bb1c9713b7475c | /src/jmetal/metaheuristics/spea2/SPEA2_main.java | 73d15e84ec9fe0ca9f7833b9da924dccd3fbefb8 | [] | no_license | RicardoShaw/PaperTest | 718d6c4ddc9d697261de0b943363c01806676e68 | 191a357bc1f94d549657c41af6a41eee150ff711 | refs/heads/master | 2021-01-19T16:16:55.780519 | 2017-04-14T10:46:53 | 2017-04-14T10:46:53 | 88,259,829 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,736 | java | // SPEA2_main.java
//
// Author:
// Antonio J. Nebro <antonio@lcc.uma.es>
// Juan J. Durillo <durillo@lcc.uma.es>
//
// Copyright (c) 2011 Antonio J. Nebro, Juan J. Durillo
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package jmetal.metaheuristics.spea2;
import jmetal.core.Algorithm;
import jmetal.core.Operator;
import jmetal.core.Problem;
import jmetal.core.SolutionSet;
import jmetal.operators.crossover.CrossoverFactory;
import jmetal.operators.mutation.MutationFactory;
import jmetal.operators.selection.SelectionFactory;
import jmetal.problems.*;
import jmetal.problems.DTLZ.*;
import jmetal.problems.ZDT.*;
import jmetal.qualityIndicator.QualityIndicator;
import jmetal.util.Configuration;
import jmetal.util.JMException;
import java.io.IOException;
import java.util.HashMap;
import java.util.logging.FileHandler;
import java.util.logging.Logger;
/**
* Class for configuring and running the SPEA2 algorithm
*/
public class SPEA2_main {
public static Logger logger_ ; // Logger object
public static FileHandler fileHandler_ ; // FileHandler object
/**
* @param args Command line arguments. The first (optional) argument specifies
* the problem to solve.
* @throws JMException
* @throws IOException
* @throws SecurityException
* Usage: three options
* - jmetal.metaheuristics.mocell.MOCell_main
* - jmetal.metaheuristics.mocell.MOCell_main problemName
* - jmetal.metaheuristics.mocell.MOCell_main problemName ParetoFrontFile
*/
public static void main(String [] args) throws JMException, IOException, ClassNotFoundException {
Problem problem ; // The problem to solve
Algorithm algorithm ; // The algorithm to use
Operator crossover ; // Crossover operator
Operator mutation ; // Mutation operator
Operator selection ; // Selection operator
QualityIndicator indicators ; // Object to get quality indicators
HashMap parameters ; // Operator parameters
// Logger object and file to store log messages
logger_ = Configuration.logger_ ;
fileHandler_ = new FileHandler("SPEA2.log");
logger_.addHandler(fileHandler_) ;
indicators = null ;
if (args.length == 1) {
Object [] params = {"Real"};
problem = (new ProblemFactory()).getProblem(args[0],params);
} // if
else if (args.length == 2) {
Object [] params = {"Real"};
problem = (new ProblemFactory()).getProblem(args[0],params);
indicators = new QualityIndicator(problem, args[1]) ;
} // if
else { // Default problem
// problem = new Kursawe("Real", 3);
//problem = new Water("Real");
// problem = new ZDT4("ArrayReal", 1000);
// problem = new ZDT5("BinaryReal");
//problem = new WFG1("Real");
problem = new DTLZ7("Real");
//problem = new OKA2("Real") ;
} // else
algorithm = new SPEA2(problem);
// Algorithm parameters
algorithm.setInputParameter("populationSize",100);
algorithm.setInputParameter("archiveSize",100);
algorithm.setInputParameter("maxEvaluations",2500);
// Mutation and Crossover for Real codification
parameters = new HashMap() ;
parameters.put("probability", 0.9) ;
parameters.put("distributionIndex", 20.0) ;
crossover = CrossoverFactory.getCrossoverOperator("SBXCrossover", parameters);
parameters = new HashMap() ;
parameters.put("probability", 1.0/problem.getNumberOfVariables()) ;
parameters.put("distributionIndex", 20.0) ;
mutation = MutationFactory.getMutationOperator("PolynomialMutation", parameters);
// Selection operator
parameters = null ;
selection = SelectionFactory.getSelectionOperator("BinaryTournament", parameters) ;
// Add the operators to the algorithm
algorithm.addOperator("crossover",crossover);
algorithm.addOperator("mutation",mutation);
algorithm.addOperator("selection",selection);
// Execute the algorithm
long initTime = System.currentTimeMillis();
SolutionSet population = algorithm.execute();
long estimatedTime = System.currentTimeMillis() - initTime;
// Result messages
logger_.info("Total execution time: "+estimatedTime + "ms");
logger_.info("Objectives values have been writen to file FUN");
population.printObjectivesToFile("spea2_2500_DTLZ7");
logger_.info("Variables values have been writen to file VAR");
population.printVariablesToFile("VAR");
if (indicators != null) {
logger_.info("Quality indicators") ;
logger_.info("Hypervolume: " + indicators.getHypervolume(population)) ;
logger_.info("GD : " + indicators.getGD(population)) ;
logger_.info("IGD : " + indicators.getIGD(population)) ;
logger_.info("Spread : " + indicators.getSpread(population)) ;
logger_.info("Epsilon : " + indicators.getEpsilon(population)) ;
} // if
}//main
} // SPEA2_main.java
| [
"RicardoShaw@qq.com"
] | RicardoShaw@qq.com |
bc6297ff287282dfacd89b107cd247d8988ac5e5 | 7c24d00be64b56df818b24dbded10f99b786503c | /app/src/main/java/jorgeipn7/com/beurowntrainer/adapters/AdapterRutina.java | a55bf59f123976e341591954e42fed8ab4ace025 | [] | no_license | JorgeIPN7/BeUrOwnTrainer | d3abe9b7bfc570cd1f417aee9446fb6b21b064f0 | 2da82b255bce0d9da7397d1554be1e5b1ae55b74 | refs/heads/master | 2021-01-01T16:43:44.210535 | 2017-07-27T01:05:30 | 2017-07-27T01:05:30 | 97,902,759 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,376 | java | package jorgeipn7.com.beurowntrainer.adapters;
import android.app.Activity;
import android.support.constraint.ConstraintLayout;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.util.List;
import jorgeipn7.com.beurowntrainer.R;
import jorgeipn7.com.beurowntrainer.models.Ejercicio;
import jorgeipn7.com.beurowntrainer.models.Rutina;
/**
* Created by Jorge on 10/07/2017.
*/
public class AdapterRutina extends RecyclerView.Adapter<AdapterRutina.ViewHolder>{
List<Rutina> lista;
int layout;
Activity activity;
OnItemClickListener listener;
OnItemClickListener listenerBorrar;
OnItemClickListener listenerEditar;
OnItemClickListener listener2;
OnItemClickListener listenerBorrar2;
OnItemClickListener listenerEditar2;
public AdapterRutina(int layout, Activity activity, List<Rutina> lista, OnItemClickListener listener, OnItemClickListener listenerBorrar, OnItemClickListener listenerEditar, OnItemClickListener listener2, OnItemClickListener listenerBorrar2, OnItemClickListener listenerEditar2) {
this.lista = lista;
this.layout = layout;
this.activity = activity;
this.listener = listener;
this.listenerBorrar = listenerBorrar;
this.listenerEditar = listenerEditar;
this.listener2 = listener2;
this.listenerBorrar2 = listenerBorrar2;
this.listenerEditar2 = listenerEditar2;
}
public class ViewHolder extends RecyclerView.ViewHolder {
ImageView iv_cv_ejercicio_foto;
TextView tv_cv_ejercicio_titulo,
tv_cv_ejercicio_utilidad_valor,
tv_cv_ejercicio_mecanismo_valor,
tv_cv_ejercicio_fuerza_valor,
tv_cv_ejercicio_num_series_valor,
tv_cv_ejercicio_pesot_valor,
tv_cv_ejercicio_descanso_serie_valor,
tv_cv_ejercicio_descanso_final_valor;
ImageView iv_cv_ejercicio_borrar,
iv_cv_ejercicio_editar;
//-------------------------------------------
ImageView iv_cv_ejercicio_foto2;
TextView tv_cv_ejercicio_titulo2,
tv_cv_ejercicio_utilidad_valor2,
tv_cv_ejercicio_mecanismo_valor2,
tv_cv_ejercicio_fuerza_valor2,
tv_cv_ejercicio_num_series_valor2,
tv_cv_ejercicio_pesot_valor2,
tv_cv_ejercicio_descanso_serie_valor2;
ImageView iv_cv_ejercicio_borrar2,
iv_cv_ejercicio_editar2;
//---------------------------------------------
View viewCL, viewCL2, viewCL22;
TextView tv_cv_ejercicio_clasificacion2,
tv_cv_ejercicio_rutina_utilidad2,
tv_cv_ejercicio_rutina_mecanismo2,
tv_cv_ejercicio_rutina_fuerza2,
tv_cv_ejercicio_num_series2,
tv_cv_ejercicio_pesot2,
tv_cv_ejercicio_descanso_serie2;
public ViewHolder(View v) {
super(v);
iv_cv_ejercicio_foto = (ImageView) v.findViewById(R.id.iv_cv_ejercicio_rutina_foto);
tv_cv_ejercicio_titulo = (TextView) v.findViewById(R.id.tv_cv_ejercicio_rutina_titulo);
tv_cv_ejercicio_utilidad_valor = (TextView) v.findViewById(R.id.tv_cv_ejercicio_rutina_utilidad_valor);
tv_cv_ejercicio_mecanismo_valor = (TextView) v.findViewById(R.id.tv_cv_ejercicio_rutina_mecanismo_valor);
tv_cv_ejercicio_fuerza_valor = (TextView) v.findViewById(R.id.tv_cv_ejercicio_rutina_fuerza_valor);
tv_cv_ejercicio_num_series_valor = (TextView) v.findViewById(R.id.tv_cv_ejercicio_num_series_valor);
tv_cv_ejercicio_pesot_valor = (TextView) v.findViewById(R.id.tv_cv_ejercicio_pesot_valor);
tv_cv_ejercicio_descanso_serie_valor = (TextView) v.findViewById(R.id.tv_cv_ejercicio_descanso_serie_valor);
tv_cv_ejercicio_descanso_final_valor = (TextView) v.findViewById(R.id.tv_cv_ejercicio_descanso_final_valor);
iv_cv_ejercicio_borrar = (ImageView) v.findViewById(R.id.iv_cv_ejercicio_borrar);
iv_cv_ejercicio_editar = (ImageView) v.findViewById(R.id.iv_cv_ejercicio_editar);
//--------------------------------------------------------------------------------------
iv_cv_ejercicio_foto2 = (ImageView) v.findViewById(R.id.iv_cv_ejercicio_rutina_foto2);
tv_cv_ejercicio_titulo2 = (TextView) v.findViewById(R.id.tv_cv_ejercicio_rutina_titulo2);
tv_cv_ejercicio_utilidad_valor2 = (TextView) v.findViewById(R.id.tv_cv_ejercicio_rutina_utilidad_valor2);
tv_cv_ejercicio_mecanismo_valor2 = (TextView) v.findViewById(R.id.tv_cv_ejercicio_rutina_mecanismo_valor2);
tv_cv_ejercicio_fuerza_valor2 = (TextView) v.findViewById(R.id.tv_cv_ejercicio_rutina_fuerza_valor2);
tv_cv_ejercicio_num_series_valor2 = (TextView) v.findViewById(R.id.tv_cv_ejercicio_num_series_valor2);
tv_cv_ejercicio_pesot_valor2 = (TextView) v.findViewById(R.id.tv_cv_ejercicio_pesot_valor2);
tv_cv_ejercicio_descanso_serie_valor2 = (TextView) v.findViewById(R.id.tv_cv_ejercicio_descanso_serie_valor2);
iv_cv_ejercicio_borrar2 = (ImageView) v.findViewById(R.id.iv_cv_ejercicio_borrar2);
iv_cv_ejercicio_editar2 = (ImageView) v.findViewById(R.id.iv_cv_ejercicio_editar2);
viewCL= (View) v.findViewById(R.id.viewCL);
viewCL2= (View) v.findViewById(R.id.viewCL2);
viewCL22= (View) v.findViewById(R.id.viewCL22);
tv_cv_ejercicio_clasificacion2 = (TextView) v.findViewById(R.id.tv_cv_ejercicio_clasificacion2);
tv_cv_ejercicio_rutina_utilidad2 = (TextView) v.findViewById(R.id.tv_cv_ejercicio_rutina_utilidad2);
tv_cv_ejercicio_rutina_mecanismo2 = (TextView) v.findViewById(R.id.tv_cv_ejercicio_rutina_mecanismo2);
tv_cv_ejercicio_rutina_fuerza2 = (TextView) v.findViewById(R.id.tv_cv_ejercicio_rutina_fuerza2);
tv_cv_ejercicio_num_series2 = (TextView) v.findViewById(R.id.tv_cv_ejercicio_num_series2);
tv_cv_ejercicio_pesot2 = (TextView) v.findViewById(R.id.tv_cv_ejercicio_pesot2);
tv_cv_ejercicio_descanso_serie2 = (TextView) v.findViewById(R.id.tv_cv_ejercicio_descanso_serie2);
// itemView.setOnCreateContextMenuListener(this);
}
public void bind(final Rutina rutina, final OnItemClickListener listener, final OnItemClickListener listenerBorrar, final OnItemClickListener listenerEditar, final OnItemClickListener listener2, final OnItemClickListener listenerBorrar2, final OnItemClickListener listenerEditar2) {
/*** Rutina
private int series1;
private int series2;
private int repeticiones1;
private int repeticiones2;
private int peso1;
private int peso2;
private int descansoSerie;
private int descansoFinal;
private int descansoBiSerie;
private RealmList<Ejercicio> ejercicios; //Max 2.
*/
if(rutina.getEjercicios().size() == 1){
Ejercicio ejercicio= rutina.getEjercicios().get(0);
int numSeries= rutina.getSeries1();
int pesoTotal= rutina.getRepeticiones1() * rutina.getPeso1();
iv_cv_ejercicio_foto.setImageResource(ejercicio.getFoto());
tv_cv_ejercicio_titulo.setText(ejercicio.getNombre());
tv_cv_ejercicio_utilidad_valor.setText(ejercicio.getUtilidad());
tv_cv_ejercicio_mecanismo_valor.setText(ejercicio.getMecanismo());
tv_cv_ejercicio_fuerza_valor.setText(ejercicio.getTipoFuerza());
tv_cv_ejercicio_num_series_valor.setText(String.valueOf(numSeries));
tv_cv_ejercicio_pesot_valor.setText(String.valueOf(pesoTotal) + " Kgs");
tv_cv_ejercicio_descanso_serie_valor.setText(String.valueOf(rutina.getDescansoSerie()) + " Seg");
tv_cv_ejercicio_descanso_final_valor.setText(String.valueOf(rutina.getDescansoFinal()) + " Seg");
iv_cv_ejercicio_foto2.setVisibility(View.INVISIBLE);
tv_cv_ejercicio_titulo2.setHeight(0);
tv_cv_ejercicio_utilidad_valor2.setHeight(0);
tv_cv_ejercicio_mecanismo_valor2.setHeight(0);
tv_cv_ejercicio_fuerza_valor2.setHeight(0);
tv_cv_ejercicio_num_series_valor2.setHeight(0);
tv_cv_ejercicio_pesot_valor2.setHeight(0);
tv_cv_ejercicio_descanso_serie_valor2.setHeight(0);
//-----
viewCL.setVisibility(View.INVISIBLE);
viewCL2.setVisibility(View.INVISIBLE);
viewCL22.setVisibility(View.INVISIBLE);
ConstraintLayout.LayoutParams layoutParams = new ConstraintLayout.LayoutParams(0, 0);
iv_cv_ejercicio_editar2.setLayoutParams(layoutParams);
iv_cv_ejercicio_editar2.setVisibility(View.INVISIBLE);
iv_cv_ejercicio_borrar2.setLayoutParams(layoutParams);
iv_cv_ejercicio_borrar2.setVisibility(View.INVISIBLE);
tv_cv_ejercicio_clasificacion2.setHeight(0);
tv_cv_ejercicio_rutina_utilidad2.setHeight(0);
tv_cv_ejercicio_rutina_mecanismo2.setHeight(0);
tv_cv_ejercicio_rutina_fuerza2.setHeight(0);
tv_cv_ejercicio_num_series2.setHeight(0);
tv_cv_ejercicio_pesot2.setHeight(0);
tv_cv_ejercicio_descanso_serie2.setHeight(0);
}else if(rutina.getEjercicios().size() == 2){
Ejercicio ejercicio= rutina.getEjercicios().get(0);
Ejercicio ejercicio2= rutina.getEjercicios().get(1);
int numSeries= rutina.getSeries1();
int pesoTotal= rutina.getRepeticiones1() * rutina.getPeso1();
int numSeries2= rutina.getSeries2();
int pesoTotal2= rutina.getRepeticiones2() * rutina.getPeso2();
iv_cv_ejercicio_foto.setImageResource(ejercicio.getFoto());
tv_cv_ejercicio_titulo.setText(ejercicio.getNombre());
tv_cv_ejercicio_utilidad_valor.setText(ejercicio.getUtilidad());
tv_cv_ejercicio_mecanismo_valor.setText(ejercicio.getMecanismo());
tv_cv_ejercicio_fuerza_valor.setText(ejercicio.getTipoFuerza());
tv_cv_ejercicio_num_series_valor.setText(String.valueOf(numSeries));
tv_cv_ejercicio_pesot_valor.setText(String.valueOf(pesoTotal) + " Kgs");
tv_cv_ejercicio_descanso_serie_valor.setText(String.valueOf(rutina.getDescansoSerie()) + " Seg");
tv_cv_ejercicio_descanso_final_valor.setText(String.valueOf(rutina.getDescansoFinal()) + " Seg");
iv_cv_ejercicio_foto2.setImageResource(ejercicio2.getFoto());
tv_cv_ejercicio_titulo2.setText(ejercicio2.getNombre());
tv_cv_ejercicio_utilidad_valor2.setText(ejercicio2.getUtilidad());
tv_cv_ejercicio_mecanismo_valor2.setText(ejercicio2.getMecanismo());
tv_cv_ejercicio_fuerza_valor2.setText(ejercicio2.getTipoFuerza());
tv_cv_ejercicio_num_series_valor2.setText(String.valueOf(numSeries2));
tv_cv_ejercicio_pesot_valor2.setText(String.valueOf(pesoTotal2) + " Kgs");
tv_cv_ejercicio_descanso_serie_valor2.setText(String.valueOf(rutina.getDescansoBiSerie()) + " Seg");
//---
iv_cv_ejercicio_borrar.setVisibility(View.INVISIBLE);
iv_cv_ejercicio_borrar.setEnabled(false);
}
iv_cv_ejercicio_borrar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
listenerBorrar.onItemClick(rutina, getAdapterPosition());
}
});
iv_cv_ejercicio_editar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
listenerEditar.onItemClick(rutina, getAdapterPosition());
}
});
iv_cv_ejercicio_foto.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
listener.onItemClick(rutina, getAdapterPosition());
}
});
//--------------------------------
iv_cv_ejercicio_borrar2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
listenerBorrar2.onItemClick(rutina, getAdapterPosition());
}
});
iv_cv_ejercicio_editar2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
listenerEditar2.onItemClick(rutina, getAdapterPosition());
}
});
iv_cv_ejercicio_foto2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
listener2.onItemClick(rutina, getAdapterPosition());
}
});
//--------------------------------
}
}
@Override
public AdapterRutina.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v= LayoutInflater.from(parent.getContext()).inflate(layout, parent, false);
ViewHolder vh= new ViewHolder(v);
return vh;
}
@Override
public void onBindViewHolder(AdapterRutina.ViewHolder holder, int position) {
holder.bind(lista.get(position), listener, listenerBorrar, listenerEditar, listener2, listenerBorrar2, listenerEditar2);
}
@Override
public int getItemCount() {
return lista.size();
}
public interface OnItemClickListener{
void onItemClick(Rutina rutina, int position );
}
}
| [
"jorge.ipn.7@gmail.com"
] | jorge.ipn.7@gmail.com |
69a7a28ed741c93d3c288bb816f738d91f2a47fc | 3b08bca3f2067209fed3e2eae2103b164b8f71d7 | /src/app/core/controller/UserController.java | 247551e03a8a4a89599d2dd8e1ac71e186ee3399 | [] | no_license | Rshujian/STMIS | 1f79035c476c71cdb6cd04e6badd1b0c6334e130 | d7223d7ecb64afdceb84fa37ef440807721100ba | refs/heads/master | 2022-07-31T23:32:22.677187 | 2020-05-21T03:57:21 | 2020-05-21T03:57:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,959 | java | package app.core.controller;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import app.core.po.Course;
import app.core.po.CourseCollection;
import app.core.po.CourseFeedbackAll;
import app.core.po.CourseSelection;
import app.core.po.Department;
import app.core.po.Employee;
import app.core.po.Grade;
import app.core.po.Manager;
import app.core.po.Progress;
import app.core.po.Teacher;
import app.core.service.CourseService;
import app.core.service.DepartmentService_m;
import app.core.service.UserService;
import net.sf.json.JSONObject;
@Controller
public class UserController {
@Autowired
@Qualifier("userService")
private UserService userService;//自动注入userService
@Qualifier("courseService")
private CourseService courseService;//自动注入userService
@Autowired
public DepartmentService_m departmentService;
/**
* 8-29 程默
* @param session
* @return
*/
@RequestMapping(value="/user/updatePerson", method=RequestMethod.POST)
public String updatePerson(Model model,HttpSession session,Employee employee
){
employee.setYgzh( (String) session.getAttribute("username"));
userService.saveEmChange(employee);
return "redirect:/user/showMyCourse";
}
/**
* 8-29 程默
* @param session
* @return
*/
@RequestMapping("/user/person")
public String gotoPerson(Model model,HttpSession session){
List<Department> departmens = departmentService.getAllDepartment();
String ygzh = (String) session.getAttribute("username");
Employee employee = userService.findEm(ygzh);
for (Department d : departmens) {
if(d.getBmbh().equals(employee.getYgdwbh()))
employee.setYgdwbh(d.getBmmc());
}
System.out.println("employee"+employee);
model.addAttribute("employee", employee);
return "person";
}
/**
* 7-12 程默
* @param session
* @return
*/
@RequestMapping("/user/gradeAlert")
@ResponseBody
public Boolean gradeAlert(HttpSession session){
Boolean isXFalert=false;
Employee employee = new Employee();
String ygzh = (String) session.getAttribute("username");
employee.setYgzh(ygzh);
employee = userService.findEmployee(employee);
if(employee != null){
Department gradeRequirement = userService.getGradeRe(employee.getYgdwbh());
Grade gradeAcquire = userService.getGrade(ygzh);
if(gradeRequirement !=null && gradeAcquire !=null){
if(gradeAcquire.getYgzxf() < gradeRequirement.getZfyq()*0.75){
isXFalert = true;
}
if(gradeAcquire.getYgbxxf() < gradeRequirement.getBxxfyq()*0.75){
isXFalert = true;
}
}
}
return isXFalert;
}
@RequestMapping(value="/user/showMyCollection", method=RequestMethod.GET)
public String showMyCollection(
Model model,
HttpSession session
){
System.out.println("进入showMyCollection方法");
String ygzh = (String) session.getAttribute("username");
String jsbs = (String) session.getAttribute("jsbs");
System.out.println("jsbs"+jsbs);
if (jsbs.equals("2")){
return "redirect:/teacher/showCourse";
}
CourseCollection courseCollection=new CourseCollection();
courseCollection.setYgzh(ygzh);
List<Course> course_Collection = userService.showMyCollection(courseCollection);
int selectSize = course_Collection.size();
model.addAttribute("courses", course_Collection);
model.addAttribute("selectSize", selectSize);
return "STMIS_collection";
}
@RequestMapping(value="/user/proKCJD", method=RequestMethod.POST)
public @ResponseBody Boolean proKCJD(
@RequestParam(value = "kcbh") String kcbh,
@RequestParam(value = "zjxh") Integer zjxh,
@RequestParam(value = "username") String ygzh
){
System.out.println("进入proKCJD方法");
Progress progress =new Progress();
progress.setYgzh(ygzh);
progress.setKcbh(kcbh);
progress.setZjxh(zjxh);
userService.proKCJD(progress);
return true;
}
@RequestMapping(value="/user/gotoCredit")
public String gotoCredit(
HttpSession session,Model model
){
System.out.println("进入gotoCredit方法");
CourseSelection courseSelection=new CourseSelection();
CourseFeedbackAll courseFeedbackAll =new CourseFeedbackAll();
courseFeedbackAll.setYgzh((String) session.getAttribute("username"));
courseSelection.setYgzh((String) session.getAttribute("username"));
System.out.println(courseSelection.getYgzh());
List<Course> course_Selection = userService.gotoCredit(courseSelection);
System.out.println("学分课程"+course_Selection.size());
List<CourseFeedbackAll> course_feedbacks = userService.selectFeedbacks(courseFeedbackAll);
List<String> feedbacks =new ArrayList<String>();
for (CourseFeedbackAll cfb : course_feedbacks) {
feedbacks.add(cfb.getKcbh());
}
int totalCredit= 0;
for (Course course : course_Selection) {
String fraction = course.getCourseSelection().getFraction();
System.out.println(fraction);
if(fraction==null || fraction.equals("")){
if(course.getCourseSelection().getKcjd()==2){
course.getCourseSelection().setFraction("暂未考试");
}else{
course.getCourseSelection().setFraction("暂未结课");
}
course.getCourseSelection().setBxzd2("否");
}else{
if(Double.valueOf(fraction)>=60){
course.getCourseSelection().setBxzd2("是");
totalCredit += course.getKcxf();
}else{
course.getCourseSelection().setBxzd2("否");
}
}
if(!feedbacks.contains(course.getKcbh())){
course.getCourseSelection().setFraction("<a href='/STMIS/exam/gotoFeedBack?kcbh="+course.getKcbh()+"&ygzh="+courseSelection.getYgzh()+"'>请先填写反馈表</a>");
//<span style='cursor:pointer;' id='gotofeedback' onclick='gotoFeedback()' content='"+course.getKcbh()+"'> 请填写反馈表 </span>
//<a href='/STMIS/exam/gotoFeedBack?kcbh="+course.getKcbh()+"&ygzh="+courseSelection.getYgzh()+"'>请先填写反馈表</a>
}
}
model.addAttribute("course_Selection", course_Selection);
model.addAttribute("totalCredit", totalCredit);
return "STMIS_Credit";
}
@RequestMapping(value="/user/removeMyCourse", method=RequestMethod.GET)
public String removeMyCourse(
Model model,
@RequestParam(value = "kcbh") String kcbh,
@RequestParam(value = "username") String ygzh
){
System.out.println("进入removeMyCourse方法");
CourseSelection courseSelection=new CourseSelection();
courseSelection.setYgzh(ygzh);
courseSelection.setKcbh(kcbh);
userService.removeCourse(courseSelection);
return "redirect:/user/showMyCourse";
}
@RequestMapping(value="/user/removeMyCollection", method=RequestMethod.GET)
public String removeMyCollection(
@RequestParam(value = "kcbh") String kcbh,
@RequestParam(value = "username") String ygzh
){
System.out.println("进入removeMyCourse方法");
CourseCollection courseCollection=new CourseCollection();
courseCollection.setYgzh(ygzh);
courseCollection.setKcbh(kcbh);
userService.removeCollection(courseCollection);
return "redirect:/user/showMyCollection";
}
@RequestMapping(value="/user/checkCourse", method=RequestMethod.POST)
@ResponseBody
public String checkCourse(
Model model,
@RequestParam(value = "kcbh") String kcbh,
@RequestParam(value = "username") String ygzh
){
System.out.println("进入checkCourse方法");
CourseSelection courseSelection=new CourseSelection();
courseSelection.setYgzh(ygzh);
courseSelection.setKcbh(kcbh);
System.out.println(courseSelection.getKcbh());
boolean exitcourse = userService.checkCourse(courseSelection);
System.out.println(exitcourse);
model.addAttribute("exitcourse", exitcourse);
return "STMIS_NVideo";
}
@RequestMapping(value="/user/logout")
public String logout(
HttpSession session
){
System.out.println("进入logout方法");
session.removeAttribute("username");
session.removeAttribute("jsbs");
return "index";
}
// update by author Jaylin
@RequestMapping(value="/user/showMyCourse", method=RequestMethod.GET)
public String showMyCourse(
Model model,
HttpSession session
){
System.out.println("进入showCourse方法");
String ygzh = (String) session.getAttribute("username");
String jsbs = (String) session.getAttribute("jsbs");
System.out.println("jsbs"+jsbs);
if (jsbs.equals("2")){
return "redirect:/index.html";
}
CourseSelection courseSelection=new CourseSelection();
courseSelection.setYgzh(ygzh);
List<Course> course_Selection = userService.showMyCourse(courseSelection);
for (Course course : course_Selection) {
Progress progress =new Progress();
progress.setKcbh(course.getKcbh());
progress.setYgzh(ygzh);
CourseSelection cSelection =new CourseSelection();
cSelection.setKcbh(course.getKcbh());
cSelection.setYgzh(ygzh);
System.out.println("进度"+userService.selectCourseKCJD(progress));
int courseKCJD=userService.selectCourseKCJD(progress);
int courseCount=userService.selectCourseCount(progress);
course.setCourseKCJD(""+courseKCJD);
course.setCourseCount(""+courseCount);
if(courseKCJD==courseCount){
userService.updateKCJD(cSelection);
course.getCourseSelection().setKcjd(2);
}
}
int selectSize = course_Selection.size();
model.addAttribute("courses", course_Selection);
model.addAttribute("selectSize", selectSize);
return "STMIS_course";
}
@RequestMapping(value="/user/addCollectCourse", method=RequestMethod.POST)
public @ResponseBody Boolean addCollectCourse(
@RequestParam(value = "kcbh") String kcbh,
@RequestParam(value = "username") String ygzh
){
System.out.println("进入addMyCourse方法");
CourseCollection courseCollection=new CourseCollection();
courseCollection.setYgzh(ygzh);
courseCollection.setKcbh(kcbh);
boolean exitcourse = userService.checkCollectCourse(courseCollection);
System.out.println("exitcourse"+exitcourse);
if (exitcourse) {
userService.addCollectCourse(courseCollection);
return true;
}
return false;
}
@RequestMapping(value="/user/addMyCourse", method=RequestMethod.POST)
public @ResponseBody Boolean addMyCourse(
@RequestParam(value = "kcbh") String kcbh,
@RequestParam(value = "username") String ygzh
){
System.out.println("进入addMyCourse方法");
CourseSelection courseSelection=new CourseSelection();
courseSelection.setYgzh(ygzh);
courseSelection.setKcbh(kcbh);
boolean exitcourse = userService.checkCourse(courseSelection);
System.out.println("exitcourse"+exitcourse);
if (exitcourse) {
userService.addCartCourse(courseSelection);
return true;
}
return false;
}
//author by Jaylin_yang
//date:2019.5.16
@ResponseBody
@RequestMapping("/user/login")
public JSONObject login(
HttpServletRequest request,
HttpSession session,
@RequestParam("jsbs") String jsbs ,
@RequestParam("username") String username ,
@RequestParam("password") String password){
System.out.println("����login����");
//HashMap<String,String> json = new HashMap<String,String>();
JSONObject json=new JSONObject();
if (jsbs.equals("1")){
Employee employee=new Employee();
employee.setYgzh(username);
employee.setYgmm(password);
employee.setJsbs(jsbs);
System.out.println(password);
System.out.println("employee");
System.out.println("employee"+employee.getYgzh());
Employee user=userService.selectEmployee(employee);
if(user == null){
json.put("error", "用户名或密码错误!");
}
else if(user.getYgdlzt() == 2){ //if the account is not freeze
json.put("error", "该账户被冻结!");
}else{
session.setAttribute("username", username);
session.setAttribute("jsbs", jsbs);
json.put("redirect","/user/showMyCourse");
}
}else{
//change teacher to admin
Manager manager =new Manager();
System.out.println("����");
manager.setGlyzh(username);
manager.setGlymm(password);
manager.setJsbs(jsbs);
System.out.println("username:"+username+"password:"+password);
Manager user =userService.selectManager(manager);
System.out.println(user);
if(user == null){
json.put("error","用户名或密码错误!");
}
else if(user.getbxzd_1().equals("0")){
json.put("error", "该账户被冻结!");
}else{
session.setAttribute("username", user.getGlyzh());
session.setAttribute("jsbs", "2");
json.put("redirect", "/index.html");
}
}
return json;
}
}
| [
"it_chengmo@163.com"
] | it_chengmo@163.com |
70fd2cd30ef640c6b421be4603e1957dc8b12093 | 622259e01d8555d552ddeba045fafe6624d80312 | /edu.harvard.i2b2.eclipse.plugins.analysis/src/edu/harvard/i2b2/analysis/datavo/JAXBConstant.java | 8a7db86da914bbd1a12c588c30d2d3b4cd757a96 | [] | no_license | kmullins/i2b2-workbench-old | 93c8e7a3ec7fc70b68c4ce0ae9f2f2c5101f5774 | 8144b0b62924fa8a0e4076bf9672033bdff3b1ff | refs/heads/master | 2021-05-30T01:06:11.258874 | 2015-11-05T18:00:58 | 2015-11-05T18:00:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 931 | java | /*
* Copyright (c) 2006-2015 Massachusetts General Hospital
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the i2b2 Software License v2.1
* which accompanies this distribution.
*
* Contributors:
*
*
*/
package edu.harvard.i2b2.analysis.datavo;
/**
* Define JAXB constants here. For dynamic configuration, move these values to
* property file and read from it.
*
*/
public class JAXBConstant {
public static final String[] DEFAULT_PACKAGE_NAME = new String[] {
"edu.harvard.i2b2.crcxmljaxb.datavo.i2b2message",
"edu.harvard.i2b2.crcxmljaxb.datavo.vdo",
"edu.harvard.i2b2.common.datavo.pdo",
"edu.harvard.i2b2.crcxmljaxb.datavo.pdo.query",
"edu.harvard.i2b2.crcxmljaxb.datavo.psm.query",
"edu.harvard.i2b2.crcxmljaxb.datavo.dnd",
"edu.harvard.i2b2.crc.datavo.i2b2result" };
}
| [
"Janice@phs000774.partners.org"
] | Janice@phs000774.partners.org |
44f71a6446c119b262d36286ea8546e867776947 | 5c92bf550a1cae448d8fbac5d95cd9ec99a44a0c | /Notifier/src/com/signup/SignupServlet.java | a9a19dad221bc2ed9c289efe790aea4109de58bf | [] | no_license | Madhu-0211/Notifier | 56cd69664e9a29e6f2d42f2bf60cb0b8133513cd | 2962baebcdf6a682ccf59fefcd281b4b00cf2b99 | refs/heads/master | 2023-04-11T06:20:55.858006 | 2021-05-02T07:47:37 | 2021-05-02T07:47:37 | 363,592,006 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,921 | java | package com.signup;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.sql.*;
/**
* Servlet implementation class SignupServlet
*/
@WebServlet("/SignupServlet")
public class SignupServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public SignupServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Auto-generated method stub
String username = request.getParameter("username");
String no = request.getParameter("number");
String email = request.getParameter("email");
String password = request.getParameter("password");
String conform = request.getParameter("conform");
String url = "jdbc:mysql://localhost:3306/table1?allowPublicKeyRetrieval=true&useSSL=false";
String query = "INSERT INTO signup (username,number,email,password,conform) VALUES (?,?,?,?,?)";
Connection con = null;
try {
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection(url, "root", "examly");
PreparedStatement ps = con.prepareStatement(query);
ps.setString(1, username);
ps.setString(2, no);
ps.setString(3, email);
ps.setString(4, password);
ps.setString(5, conform);
int n = ps.executeUpdate();
if (n > 0) {
response.sendRedirect("index.jsp");
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"Win10@DESKTOP-EKDOANP"
] | Win10@DESKTOP-EKDOANP |
37c1a6ca485844075046beebe52c6a7ee9e610ff | ed68a9b0a920f1b12830aa91ccef4f3c9d7c66a5 | /src/RivestCipher4.java | d422ad3ab2099ab1c760d10aca50221848b2985b | [] | no_license | sethhostetler/rivest-cipher | 075119e97860e974f869f20a882c62bd569ccfbf | e32e00f68ae287513dc85408785a71b2e9d480d0 | refs/heads/master | 2021-01-12T15:04:06.783704 | 2016-10-29T03:21:13 | 2016-10-29T03:21:13 | 71,675,786 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,682 | java | /*
Author: Seth Hostetler
Date: 10/18/2016
Program: Rivest Cipher 4 implementation
*/
import java.lang.*;
import java.util.HashMap;
import java.util.Map;
public class RivestCipher4
{
public static void main(String[] args)
{
String inputKey = "DISCRETE";
int bitSize = 5;
int randNumCount = 5; //Represents size of output
int stateArraySize = (int) Math.pow(2, bitSize);
final String keyString = extendKey(inputKey, stateArraySize);
int[] key = stringToNumArray(keyString);
int[] state = new int[stateArraySize];
stateShuffle(state, key);
int[] answerAsNum = numberGen(state, randNumCount);
String[] binaryString = numberToBinary(answerAsNum, bitSize);
String message = "XNV@H";
int[] messageArray = stringToNumArray(message);
String[] messageString = numberToBinary(messageArray, bitSize);
String[] answerArray = new String[binaryString.length];
if( binaryString.length == messageString.length)
{
for(int i = 0; i < answerArray.length; i++)
{
answerArray[i] = binaryXOR(binaryString[i], messageString[i]);
}
}
int[] intOutput = binaryStringToInt(answerArray);
System.out.println(intArrayToString(intOutput));
}
public static String extendKey(String key, int arraySize)
{
/*
Description: This method takes in a string, key, and extends by
concatenating copies of the string until it reaches
length arraySize.
*/
String fullKey = "";
while (fullKey.length() < arraySize)
{
fullKey += key;
}
fullKey = fullKey.substring(0, arraySize);
return fullKey;
}
public static int[] stringToNumArray(String pass)
{
/*
Description: This method takes in a string, and converts each
character to its equivalent integer.
Ex: A = 1, D = 4, Z = 26
This method currently assumes that the characters
are captial letters only.
*/
int[] output = new int[pass.length()];
for(int i = 0; i < output.length; i++)
{
output[i] = pass.charAt(i) - 64;
}
return output;
}
public static void stateShuffle(int[] state, int[] key)
{
/*
Description: This method shuffles the state array, according
to the RC4 algorithm.
*/
for(int i = 0; i < state.length; i++) //Initialize the state array
{
state[i] = i;
}
int j = 0;
for(int i = 0; i < state.length; i++)
{
j = (j + state[i] + key[i]) % state.length;
int temp = state[i];
state[i] = state[j];
state[j] = temp;
}
}
public static int[] numberGen(int[] state, int size)
{
/*
Description: This method generates (size) random numbers from the
given state array.
*/
int j = 0;
int i = 0;
int[] outputNumList = new int[size];
while (i < size)
{
i++;
if(i > size) { break;}
j = (j + state[i]) % state.length;
int temp = state[i];
state[i] = state[j];
state[j] = temp;
outputNumList[i-1] = state[(state[i] + state[j]) % state.length];
}
return outputNumList;
}
public static String[] numberToBinary(int[] numList, int bitSize)
{
/*
Description: This method converts an array of integers
into binary numbers of the given bit size.
*/
String[] binaryString = new String[numList.length];
for (int count = 0; count < binaryString.length; count ++)
{
binaryString[count] = Integer.toBinaryString(numList[count]);
if (binaryString[count].length() < bitSize)
{
int lengthDifference = bitSize - binaryString[count].length();
String lengthFixed = new String(new char[lengthDifference]).replace("\0", "0");
binaryString[count] = lengthFixed + binaryString[count];
}
}
return binaryString;
}
public static String binaryXOR(String num1, String num2)
{
/*
Description: This method caluclates the binary XOR value
for two given strings.
*/
return Integer.toBinaryString(Integer.parseInt(num1, 2) ^ Integer.parseInt(num2, 2));
}
public static int[] binaryStringToInt(String[] binary)
{
/*
Description: This method converts the binary values back to integer
*/
int[] output = new int[binary.length];
for(int i = 0; i < output.length; i++)
{
output[i] = Integer.parseInt(binary[i], 2);
}
return output;
}
public static String intArrayToString(int[] numbers)
{
/*
Description: This method converts the integer array to one String.
*/
String output = "";
for(int i: numbers)
{
output += String.valueOf((char)(i + 64));
}
return output;
}
} | [
"sethahostetler@gmail.com"
] | sethahostetler@gmail.com |
32fde34381a3f2cb39c510801bdede1047b35b48 | 988d2f915a269dbe34c5724798e3148e3a6e4263 | /src/main/java/pp/word/WordUniqueFormUkrainianServiceImpl.java | 5866450ee31b4ef68a49561647d2b6b81bc54d31 | [] | no_license | anaksatot/zpp_kanboku_v02 | 865bedec33753fda6db9939b18fad4138dad477d | c3bdf5e7a28e0e666498d460643cc92b8f144cc5 | refs/heads/master | 2021-01-19T03:59:17.994870 | 2017-04-11T17:03:23 | 2017-04-11T17:03:23 | 87,344,535 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,869 | java | package pp.word;
import org.json.simple.parser.ParseException;
import pp.linguisticCategories.Language;
import pp.linguisticCategories.LinguisticCategory;
import pp.linguisticCategories.LinguisticCategoryForms;
import pp.linguisticCategories.linguisticCategoriesService.*;
import pp.textFileProcessing.JsonFileReadAndWriteServiceImpl;
import pp.textFileProcessing.TextFileReadAndWriteServiceImpl;
import pp.xmlFileProcessing.XMLfileReadAndWriteServiceImpl;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class WordUniqueFormUkrainianServiceImpl implements WordUniqueFormService {
public Map<WordUniqueForm,Integer> parsingTextIntoUniqueWords(List<String> textOfFileDivideOnListWords) {
System.out.println("Start text parsing into Unique Words!");
final File folder = new File(TextFileReadAndWriteServiceImpl.directoryForSaveJSONfilesWordUniqueForm());
JsonFileReadAndWriteServiceImpl jsonFileService = new JsonFileReadAndWriteServiceImpl();
Map<String, WordUniqueForm> allWordUniqueForm = jsonFileService.getAllWordUniqueFormFromJSONfiles(folder);
Map<WordUniqueForm,Integer> mapWordsOfCurrentText = listWordsOfCurrentTextAndCreateNewWordsUniqueForm(textOfFileDivideOnListWords, allWordUniqueForm);
jsonFileService.saveStatisticToJsonFilesForCurrentText(mapWordsOfCurrentText);
if (new XMLfileReadAndWriteServiceImpl().saveToXMLStatisticInformationCompleted()) {
System.out.println("Finish Text parsing into Unique Words! Statistic is written!");
}
return mapWordsOfCurrentText;
}
private Map<WordUniqueForm,Integer> listWordsOfCurrentTextAndCreateNewWordsUniqueForm(List<String> textOfFileDivideOnListWords, Map<String, WordUniqueForm> allWordUniqueForm){
WordUniqueForm wordUniqueForm;
TextFileReadAndWriteServiceImpl textFileReadAndWriteServiceImpl = new TextFileReadAndWriteServiceImpl();
Map<WordUniqueForm,Integer> listWordsOfCurrentText = new HashMap<WordUniqueForm,Integer>();
for (String word : textOfFileDivideOnListWords) {
if (!allWordUniqueForm.containsKey(word.toLowerCase())) {
try {
wordUniqueForm = createNewWordUniqueForm(word, modeIsInDetail());
textFileReadAndWriteServiceImpl.writeToJSONfile(new JsonFileReadAndWriteServiceImpl().stringForJSONParserWordUniqueForm(wordUniqueForm), word);
allWordUniqueForm.put(wordUniqueForm.getFormOfWord(),wordUniqueForm);
listWordsOfCurrentText.put(wordUniqueForm,1);
} catch (ParseException e) {
e.printStackTrace();
}
} else {
wordUniqueForm = allWordUniqueForm.get(word.toLowerCase());
wordUniqueForm.checkAndWriteFormsWithCapitalAndLowerLetters(word);
if (!listWordsOfCurrentText.containsKey(wordUniqueForm)) {
listWordsOfCurrentText.put(wordUniqueForm,1);
} else {
listWordsOfCurrentText.put(wordUniqueForm, listWordsOfCurrentText.get(wordUniqueForm) + 1);
}
}
}
return listWordsOfCurrentText;
}
public WordUniqueForm createNewWordUniqueForm(String word, boolean inDetail) {
WordUniqueForm WordUniqueForm = new WordUniqueForm(word, Language.UKRAINIAN);
ArrayList<LinguisticCategory> linguisticCategoriesOfWordUniqueForm = new ArrayList<LinguisticCategory>();
Scanner scanner2 = new Scanner(System.in);
while (true) {
System.out.println("Визнаення слова: " + word);
//System.out.println("Визнаення слова xivi system : " + firstXSystemOrthographyOfWord(word, Language.UKRAINIAN));
//new LinguisticCategoriesServiceImpl().listOfLinguisticCategoryInUkrainianOut();
//int n = scanner2.nextInt();
int n = 1;
switch (n) {
case 1:
linguisticCategoriesOfWordUniqueForm.add(new LcNounUkrainianServiceImpl().defineLcNounUniqueForm(word,inDetail));
break;
case 2:
linguisticCategoriesOfWordUniqueForm.add(new LcVerbUkrainianServiceImpl().defineLcVerbUniqueForm(word,inDetail));
break;
case 3:
linguisticCategoriesOfWordUniqueForm.add(new LcAdverbUkrainianServiceImpl().defineLcAdverb(word));
//System.out.println(new LcAdverbUkrainianServiceImpl().defineLcAdverb(word).toString());
break;
case 4:
linguisticCategoriesOfWordUniqueForm.add(new LcAdjectiveUkrainianServiceImpl().defineLcAdjective(word));
//System.out.println(new LcAdjectiveUkrainianServiceImpl().defineLcAdjective(word).toString());
break;
case 5:
linguisticCategoriesOfWordUniqueForm.add(new LcPronounUkrainianServiceImpl().defineLcPronoun(word));
//System.out.println(new LcPronounUkrainianServiceImpl().defineLcPronoun(word).toString());
break;
case 6:
linguisticCategoriesOfWordUniqueForm.add(new LcPrerositionUkrainianServiceImpl().defineLcPrerosition(word));
//System.out.println(new LcPrerositionUkrainianServiceImpl().defineLcPrerosition(word).toString());
break;
case 7:
linguisticCategoriesOfWordUniqueForm.add(new LcConjunctionUkrainianServiceImpl().defineLcConjunction(word));
//System.out.println(new LcConjunctionUkrainianServiceImpl().defineLcConjunction(word).toString());
break;
case 8:
linguisticCategoriesOfWordUniqueForm.add(new LcNumeralUkrainianServiceImpl().defineLcNumeral(word));
//System.out.println(new LcNumeralUkrainianServiceImpl().defineLcNumeral(word).toString());
break;
default:
System.out.println("некоректний номер частини мови! спробуйте ще раз!");
continue;
}
break;
}
WordUniqueForm.setLinguisticCategoryForms(new LinguisticCategoryForms(linguisticCategoriesOfWordUniqueForm));
return WordUniqueForm;
}
public Map<String,WordUniqueForm> mapWordsOfCurrentTextStringKey(Map<WordUniqueForm, Integer> mapWordsOfCurrentText){
Map<String,WordUniqueForm> mapWordsOfCurrentTextNewStructure =new HashMap<String, WordUniqueForm>();
for (WordUniqueForm keyWordUniqueForm : mapWordsOfCurrentText.keySet()) {
mapWordsOfCurrentTextNewStructure.put(keyWordUniqueForm.getFormOfWord(),keyWordUniqueForm);
}
return mapWordsOfCurrentTextNewStructure;
}
public boolean modeIsInDetail() {
return false;
// System.out.println("Визначати слова детально (з відмінками, числами та родами) чи текучу форму?");
// System.out.println("Якщо детально то введіть з клавіатури 'y', інакше введіть 'n'");
// while (true) {
// BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
// try
// {
// int ascii = br.read();
// System.out.println(" Value - "+ascii);
// if (ascii == 121) {
// return true;
// }
// if (ascii == 110) {
// return false;
// }
// System.out.println("спробуйте ввести ще раз!");
// }
// catch (IOException e)
// {
// e.printStackTrace();
// }
// }
}
public boolean wordIsNotCorrect(String word) {
System.out.println(word.toUpperCase() + " Якщо слово коректне просто натисніть Enter. Якщо некоректне тоді любу клавішу з літерою і тоді Enter");
while (true) {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try
{
int ascii = br.read();
System.out.println(" Value - "+ascii);
if (ascii == 10) {
return false;
}
return true;
}
catch (IOException e)
{
e.printStackTrace();
}
return true;
}
}
}
| [
"nazar.popovych1918@gmail.com"
] | nazar.popovych1918@gmail.com |
a34f3d7165ef80147b8307b8f2b46217d2f38f31 | 5259b552769f7d90ea5adcf86b7ec2b4a6048b03 | /src/test/java/com/example/itineraryservice/ItineraryServiceApplicationTests.java | 632a54e2404c5be2a0b082206b84caf5c9c39de5 | [] | no_license | alejandra21/itinerary-service | 184dcb68b2b432f218daa63075af449acc094b5f | 5687144a978bab38485deb77557fcda24b19da19 | refs/heads/master | 2022-12-20T18:18:08.193070 | 2020-10-01T21:19:22 | 2020-10-01T21:19:22 | 299,111,878 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 230 | java | package com.example.itineraryservice;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class ItineraryServiceApplicationTests {
@Test
void contextLoads() {
}
}
| [
"alejandra.corderogarcia21@gmail.com"
] | alejandra.corderogarcia21@gmail.com |
2ecf653e5ace8d2ad45d5d4bb429852a75b69482 | fcd6e3335c0c4830a28d9c19f99e9e6a7838bfe4 | /Article-Admin/src/com/ktds/jmj/util/Root.java | 2019afef5e0de9d5bd5afb4be30cbfd81c984374 | [] | no_license | min-jeong/JSP_WEB | d04d9571083084b0a81ba89bec2100377ec3ae0a | 4411122387e8a414550b23478877d0010e9e0320 | refs/heads/master | 2021-01-10T06:39:30.474647 | 2016-04-19T03:59:31 | 2016-04-19T04:02:43 | 52,416,549 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 200 | java | package com.ktds.jmj.util;
import javax.servlet.http.HttpServlet;
public class Root {
public static String get(HttpServlet servlet) {
return servlet.getServletContext().getContextPath();
}
}
| [
"minjung421@naver.com"
] | minjung421@naver.com |
d869497fc773e2468fd62ccc85f9c75993683026 | c6f3fbce0b7304c672fc99a94fe43b418eae9e6c | /src/main/java/com/junyou/bus/fuben/entity/MaiguFubenSourceTeam.java | 7ff6fe85bd33453d225f33221edc9ed3878d0573 | [] | no_license | hw233/cq_game-java | a6f1fa6526062c10a9ea322cc832b4c42e6b8f9a | c2384b58efa73472752742a93bf36ef02d65fe48 | refs/heads/master | 2020-04-27T11:24:29.835913 | 2018-06-03T14:03:36 | 2018-06-03T14:03:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,294 | java | package com.junyou.bus.fuben.entity;
import java.util.HashSet;
import java.util.Set;
import com.junyou.constants.GameConstants;
import com.junyou.utils.datetime.GameSystemTime;
/**
* 多人副本队伍(原服)
* @author LiuYu
* @date 2015-7-7 上午10:58:20
*/
public class MaiguFubenSourceTeam {
// 队伍ID
private int teamId;
// 成员列表list
private Set<Long> roleIdSet = new HashSet<>();
// 所属副本ID
private int belongFubenId;
private Object[] msg;
private long nextTime;
public MaiguFubenSourceTeam(Integer teamId,Integer fubenId) {
this.teamId = teamId;
belongFubenId = fubenId;
}
public int getTeamId() {
return teamId;
}
public Set<Long> getRoleIdSet() {
return roleIdSet;
}
public int getBelongFubenId() {
return belongFubenId;
}
public void addRole(Long userRoleId){
roleIdSet.add(userRoleId);
}
public void removeRole(Long userRoleId){
roleIdSet.remove(userRoleId);
}
public boolean isCanRemove(){
return roleIdSet.size() < 1;
}
public Object[] getMsg() {
if(GameSystemTime.getSystemMillTime() < nextTime){
return null;
}
nextTime = GameSystemTime.getSystemMillTime() + GameConstants.MAIGU_FUBEN_YAOQING_INTERVAL;
if(msg == null){
msg = new Object[]{null,belongFubenId,teamId};
}
return msg;
}
}
| [
"18221610336@163.com"
] | 18221610336@163.com |
9db5f7fbee700a76d9cde0f2ae02c8ea311865f8 | d1cd27b3054c0bc26792e2e33af366627849061d | /src/ru/ifmo/se/pokemon/attack/Refresh.java | dff89bf57f01cd40a008fae22dad7c8c1cef6adf | [] | no_license | KaluginaMarina/pokemon | ec363c894f52c1b4c61f351ace319d6aa79e43f8 | 770b66c4d8ede293a58cb33531a7e343f4b1a939 | refs/heads/master | 2021-05-12T12:31:03.081798 | 2018-01-18T15:21:38 | 2018-01-18T15:21:38 | 117,415,807 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 65 | java | package ru.ifmo.se.pokemon.attack;
public class Refresh {
}
| [
"noreply@github.com"
] | noreply@github.com |
7290ef6bbf71f1197d5c65d669b92dc73f3d512f | 1f87a8bfdfe31799e34fb7c6a5a307aa749912d1 | /quora-api/src/main/java/com/upgrad/quora/api/controller/AdminController.java | 2f9ea7678f83f304cb20131c1452a7451059697c | [] | no_license | SreedharPitta/Trello_quora | ccc0ecd9b5eb06658891837fad2764a06ecb187b | bf02cb4700bda97a2f930930c702874e5d49dd99 | refs/heads/master | 2023-03-27T05:15:13.333107 | 2021-03-29T14:55:19 | 2021-03-29T14:55:19 | 352,036,667 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,431 | java | package com.upgrad.quora.api.controller;
import com.upgrad.quora.api.model.UserDeleteResponse;
import com.upgrad.quora.service.business.UserDeleteBusinessService;
import com.upgrad.quora.service.entity.UserEntity;
import com.upgrad.quora.service.exception.AuthorizationFailedException;
import com.upgrad.quora.service.exception.UserNotFoundException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/")
public class AdminController {
@Autowired
private UserDeleteBusinessService userDeleteBusinessService;
@RequestMapping(method = RequestMethod.DELETE, path = "/admin/user/{userId}", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public ResponseEntity<UserDeleteResponse> userDelete(@PathVariable("userId") final String userId, @RequestHeader("authorization") final String authorization) throws AuthorizationFailedException, UserNotFoundException {
UserEntity userEntity = userDeleteBusinessService.userDelete(userId, authorization);
UserDeleteResponse userDeleteResponse = new UserDeleteResponse().id(userEntity.getUuid()).status("USER SUCCESSFULLY DELETED");
return new ResponseEntity<UserDeleteResponse>(userDeleteResponse, HttpStatus.OK);
}
}
| [
"sreedhar@Sreedhars-MacBook-Pro.local"
] | sreedhar@Sreedhars-MacBook-Pro.local |
68801750fa3931c64885588552b0ae91869ee87d | e39fe0573b0114533ff27b61ea1ee31ca6168d8a | /segmentedcontrolmodule/src/test/java/segmented_control/widget/custom/android/com/segmentedcontrol/ExampleUnitTest.java | b859c701610c6676932c868f84dd75e803291ae9 | [
"Apache-2.0"
] | permissive | naseemakhtar994/SegmentedControl | 1d622f6fc019b7a8d7d4826bda36a75c918fabf1 | 0e73f9d51eb1c6f62c649fe75d7f1ef199ef8b32 | refs/heads/master | 2020-03-27T10:03:58.195711 | 2018-08-26T06:35:18 | 2018-08-26T06:35:18 | 146,392,435 | 1 | 0 | Apache-2.0 | 2018-08-28T04:35:47 | 2018-08-28T04:35:46 | null | UTF-8 | Java | false | false | 438 | java | package segmented_control.widget.custom.android.com.segmentedcontrol;
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);
}
} | [
"robert.apikyan@volo.global"
] | robert.apikyan@volo.global |
c2b4e771607ba1d229dfcf87d6122cde7ea922a1 | edf3aa4f6b4a8afd265c96ba7aa1e9fa5d3d993c | /app/src/main/java/com/sarahjs/todolist/MainActivity.java | fc2435bb219a21fa99b65930b27721f2e0552236 | [] | no_license | SarahJS/ToDoList | 73da1b22a1dc832f77f5c96843f1cbb2d66d58b4 | 60cb9306232b04f465f0993007439bfa087ac286 | refs/heads/master | 2016-08-12T13:11:25.443624 | 2016-03-29T00:39:47 | 2016-03-29T00:39:47 | 54,933,817 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,570 | java | package com.sarahjs.todolist;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.util.Log;
import android.widget.EditText;
import android.app.AlertDialog;
import android.content.DialogInterface;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
switch (item.getItemId()) {
case R.id.action_add_task:
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Add a task");
builder.setMessage("Description:");
final EditText inputField = new EditText(this);
builder.setView(inputField);
builder.setPositiveButton("Add", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
Log.d("MainActivity", inputField.getText().toString());
}
});
builder.setNegativeButton("Cancel", null);
builder.create().show();
return true;
default:
return false;
}
}
}
| [
"sedky.sarah@gmail.com"
] | sedky.sarah@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.