blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 689M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 131 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 32 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 313 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c0add0b385536662cedb2a6e25af34448b268590 | 82ba83b948e784d01e2e3b9bf3be5542a50dc69d | /app/src/main/java/net/greatsoft/main/db/helper/PersonDao.java | 9639e940eee39d81ee996b98243d197cf3e42b98 | [] | no_license | yike5868/Chss | 272d22d77a40e4d114baa69cb3bae7700072c987 | 6af590fb5f13510b89bc85c54a79e2e3e78b9f1d | refs/heads/master | 2020-03-12T08:49:32.139070 | 2018-04-22T05:05:21 | 2018-04-22T05:05:21 | 130,536,892 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,169 | java | package net.greatsoft.main.db.helper;
import android.database.Cursor;
import android.database.sqlite.SQLiteStatement;
import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.Property;
import org.greenrobot.greendao.internal.DaoConfig;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.database.DatabaseStatement;
import net.greatsoft.main.db.po.person.Person;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* DAO for table "PERSON".
*/
public class PersonDao extends AbstractDao<Person, Void> {
public static final String TABLENAME = "PERSON";
/**
* Properties of entity Person.<br/>
* Can be used for QueryBuilder and for referencing column names.
*/
public static class Properties {
public final static Property PersonId = new Property(0, String.class, "personId", false, "PERSON_ID");
public final static Property FamilyId = new Property(1, String.class, "familyId", false, "FAMILY_ID");
public final static Property Name = new Property(2, String.class, "name", false, "NAME");
public final static Property SexCode = new Property(3, String.class, "sexCode", false, "SEX_CODE");
public final static Property Birthday = new Property(4, java.util.Date.class, "birthday", false, "BIRTHDAY");
public final static Property IdNo = new Property(5, String.class, "idNo", false, "ID_NO");
public final static Property PersonStatusCode = new Property(6, String.class, "personStatusCode", false, "PERSON_STATUS_CODE");
public final static Property CancelReasonCode = new Property(7, String.class, "cancelReasonCode", false, "CANCEL_REASON_CODE");
public final static Property CancelTime = new Property(8, java.util.Date.class, "cancelTime", false, "CANCEL_TIME");
public final static Property CreateTime = new Property(9, java.util.Date.class, "createTime", false, "CREATE_TIME");
public final static Property ModifiedTime = new Property(10, java.util.Date.class, "modifiedTime", false, "MODIFIED_TIME");
public final static Property FatherPersonId = new Property(11, String.class, "fatherPersonId", false, "FATHER_PERSON_ID");
public final static Property SpousePersonId = new Property(12, String.class, "spousePersonId", false, "SPOUSE_PERSON_ID");
};
public PersonDao(DaoConfig config) {
super(config);
}
public PersonDao(DaoConfig config, DaoSession daoSession) {
super(config, daoSession);
}
/** Creates the underlying database table. */
public static void createTable(Database db, boolean ifNotExists) {
String constraint = ifNotExists? "IF NOT EXISTS ": "";
db.execSQL("CREATE TABLE " + constraint + "\"PERSON\" (" + //
"\"PERSON_ID\" TEXT," + // 0: personId
"\"FAMILY_ID\" TEXT," + // 1: familyId
"\"NAME\" TEXT," + // 2: name
"\"SEX_CODE\" TEXT," + // 3: sexCode
"\"BIRTHDAY\" INTEGER," + // 4: birthday
"\"ID_NO\" TEXT," + // 5: idNo
"\"PERSON_STATUS_CODE\" TEXT," + // 6: personStatusCode
"\"CANCEL_REASON_CODE\" TEXT," + // 7: cancelReasonCode
"\"CANCEL_TIME\" INTEGER," + // 8: cancelTime
"\"CREATE_TIME\" INTEGER," + // 9: createTime
"\"MODIFIED_TIME\" INTEGER," + // 10: modifiedTime
"\"FATHER_PERSON_ID\" TEXT," + // 11: fatherPersonId
"\"SPOUSE_PERSON_ID\" TEXT);"); // 12: spousePersonId
}
/** Drops the underlying database table. */
public static void dropTable(Database db, boolean ifExists) {
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"PERSON\"";
db.execSQL(sql);
}
@Override
protected final void bindValues(DatabaseStatement stmt, Person entity) {
stmt.clearBindings();
String personId = entity.getPersonId();
if (personId != null) {
stmt.bindString(1, personId);
}
String familyId = entity.getFamilyId();
if (familyId != null) {
stmt.bindString(2, familyId);
}
String name = entity.getName();
if (name != null) {
stmt.bindString(3, name);
}
String sexCode = entity.getSexCode();
if (sexCode != null) {
stmt.bindString(4, sexCode);
}
java.util.Date birthday = entity.getBirthday();
if (birthday != null) {
stmt.bindLong(5, birthday.getTime());
}
String idNo = entity.getIdNo();
if (idNo != null) {
stmt.bindString(6, idNo);
}
String personStatusCode = entity.getPersonStatusCode();
if (personStatusCode != null) {
stmt.bindString(7, personStatusCode);
}
String cancelReasonCode = entity.getCancelReasonCode();
if (cancelReasonCode != null) {
stmt.bindString(8, cancelReasonCode);
}
java.util.Date cancelTime = entity.getCancelTime();
if (cancelTime != null) {
stmt.bindLong(9, cancelTime.getTime());
}
java.util.Date createTime = entity.getCreateTime();
if (createTime != null) {
stmt.bindLong(10, createTime.getTime());
}
java.util.Date modifiedTime = entity.getModifiedTime();
if (modifiedTime != null) {
stmt.bindLong(11, modifiedTime.getTime());
}
String fatherPersonId = entity.getFatherPersonId();
if (fatherPersonId != null) {
stmt.bindString(12, fatherPersonId);
}
String spousePersonId = entity.getSpousePersonId();
if (spousePersonId != null) {
stmt.bindString(13, spousePersonId);
}
}
@Override
protected final void bindValues(SQLiteStatement stmt, Person entity) {
stmt.clearBindings();
String personId = entity.getPersonId();
if (personId != null) {
stmt.bindString(1, personId);
}
String familyId = entity.getFamilyId();
if (familyId != null) {
stmt.bindString(2, familyId);
}
String name = entity.getName();
if (name != null) {
stmt.bindString(3, name);
}
String sexCode = entity.getSexCode();
if (sexCode != null) {
stmt.bindString(4, sexCode);
}
java.util.Date birthday = entity.getBirthday();
if (birthday != null) {
stmt.bindLong(5, birthday.getTime());
}
String idNo = entity.getIdNo();
if (idNo != null) {
stmt.bindString(6, idNo);
}
String personStatusCode = entity.getPersonStatusCode();
if (personStatusCode != null) {
stmt.bindString(7, personStatusCode);
}
String cancelReasonCode = entity.getCancelReasonCode();
if (cancelReasonCode != null) {
stmt.bindString(8, cancelReasonCode);
}
java.util.Date cancelTime = entity.getCancelTime();
if (cancelTime != null) {
stmt.bindLong(9, cancelTime.getTime());
}
java.util.Date createTime = entity.getCreateTime();
if (createTime != null) {
stmt.bindLong(10, createTime.getTime());
}
java.util.Date modifiedTime = entity.getModifiedTime();
if (modifiedTime != null) {
stmt.bindLong(11, modifiedTime.getTime());
}
String fatherPersonId = entity.getFatherPersonId();
if (fatherPersonId != null) {
stmt.bindString(12, fatherPersonId);
}
String spousePersonId = entity.getSpousePersonId();
if (spousePersonId != null) {
stmt.bindString(13, spousePersonId);
}
}
@Override
public Void readKey(Cursor cursor, int offset) {
return null;
}
@Override
public Person readEntity(Cursor cursor, int offset) {
Person entity = new Person( //
cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0), // personId
cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // familyId
cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // name
cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // sexCode
cursor.isNull(offset + 4) ? null : new java.util.Date(cursor.getLong(offset + 4)), // birthday
cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // idNo
cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // personStatusCode
cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // cancelReasonCode
cursor.isNull(offset + 8) ? null : new java.util.Date(cursor.getLong(offset + 8)), // cancelTime
cursor.isNull(offset + 9) ? null : new java.util.Date(cursor.getLong(offset + 9)), // createTime
cursor.isNull(offset + 10) ? null : new java.util.Date(cursor.getLong(offset + 10)), // modifiedTime
cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // fatherPersonId
cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12) // spousePersonId
);
return entity;
}
@Override
public void readEntity(Cursor cursor, Person entity, int offset) {
entity.setPersonId(cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0));
entity.setFamilyId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
entity.setName(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
entity.setSexCode(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
entity.setBirthday(cursor.isNull(offset + 4) ? null : new java.util.Date(cursor.getLong(offset + 4)));
entity.setIdNo(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
entity.setPersonStatusCode(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
entity.setCancelReasonCode(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
entity.setCancelTime(cursor.isNull(offset + 8) ? null : new java.util.Date(cursor.getLong(offset + 8)));
entity.setCreateTime(cursor.isNull(offset + 9) ? null : new java.util.Date(cursor.getLong(offset + 9)));
entity.setModifiedTime(cursor.isNull(offset + 10) ? null : new java.util.Date(cursor.getLong(offset + 10)));
entity.setFatherPersonId(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11));
entity.setSpousePersonId(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12));
}
@Override
protected final Void updateKeyAfterInsert(Person entity, long rowId) {
// Unsupported or missing PK type
return null;
}
@Override
public Void getKey(Person entity) {
return null;
}
@Override
protected final boolean isEntityUpdateable() {
return true;
}
}
| [
"zhanglin@zhanglindeMacBook-Pro.local"
] | zhanglin@zhanglindeMacBook-Pro.local |
16be9467a7dafafd74eac0c72ec341f7620b48d4 | 1f7f5779f33fc99c835bd188440615993a80109f | /src/main/java/br/com/coretecnologia/cursomc/domain/Produto.java | 275766956d2da1eebfc3c0c27f011656c5204b3c | [] | no_license | ademarbarbosa/spring-boot-ionic-backend | dc003fb1a25a4eb3d995a5dedf13adbd9debef2d | 6c10e7c95703213ec805815ba2d60bf1a7f6703e | refs/heads/master | 2021-03-30T21:19:55.338279 | 2018-04-09T23:40:50 | 2018-04-09T23:40:50 | 124,962,111 | 0 | 0 | null | 2018-03-31T14:28:09 | 2018-03-12T23:02:38 | Java | UTF-8 | Java | false | false | 2,944 | java | package br.com.coretecnologia.cursomc.domain;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import com.fasterxml.jackson.annotation.JsonIgnore;
@Entity
public class Produto implements Serializable {
private static final long serialVersionUID = -503869815243723896L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private String nome;
private Double preco;
@JsonIgnore
@ManyToMany
@JoinTable(name = "PRODUTO_CATEGORIA",
joinColumns = @JoinColumn(name = "produto_id"),
inverseJoinColumns = @JoinColumn(name = "categoria_id"))
private List<Categoria> categorias = new ArrayList<>();
@JsonIgnore
@OneToMany(mappedBy = "id.produto")
private Set<ItemPedido> itens = new HashSet<>();
public Produto() {
}
public Produto(Integer id, String nome, Double preco) {
super();
this.id = id;
this.nome = nome;
this.preco = preco;
}
@JsonIgnore
public List<Pedido> getPedidos() {
List<Pedido> lista = new ArrayList<>();
for (ItemPedido x : itens) {
lista.add(x.getPedido());
}
return lista;
}
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 Double getPreco() {
return preco;
}
public void setPreco(Double preco) {
this.preco = preco;
}
public List<Categoria> getCategorias() {
return categorias;
}
public void setCategorias(List<Categoria> categorias) {
this.categorias = categorias;
}
public Set<ItemPedido> getItens() {
return itens;
}
public void setItens(Set<ItemPedido> itens) {
this.itens = itens;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((nome == null) ? 0 : nome.hashCode());
result = prime * result + ((preco == null) ? 0 : preco.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Produto other = (Produto) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
if (nome == null) {
if (other.nome != null)
return false;
} else if (!nome.equals(other.nome))
return false;
if (preco == null) {
if (other.preco != null)
return false;
} else if (!preco.equals(other.preco))
return false;
return true;
}
}
| [
"ademar.barbosa@gmail.com"
] | ademar.barbosa@gmail.com |
b87b0bdac77c6aceaa177ec66403a4a2289afd2d | f91290b43c675f3657994f0b0485c1fc1eac786a | /src/com/pdd/pop/ext/apache/http/impl/client/StandardHttpRequestRetryHandler.java | da03aff7adb39a9fd88a6920bf2ec45527f57ed3 | [] | no_license | lywx215/http-client | 49462178ebbbd3469f798f53b16f5cb52db56d72 | 29871ab097e2e6dfc1bd2ab5f1a63b6146797c5a | refs/heads/master | 2021-10-09T09:01:07.389764 | 2018-12-25T05:06:11 | 2018-12-25T05:06:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,119 | 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.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package com.pdd.pop.ext.apache.http.impl.client;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import com.pdd.pop.ext.apache.http.HttpRequest;
import com.pdd.pop.ext.apache.http.annotation.Contract;
import com.pdd.pop.ext.apache.http.annotation.ThreadingBehavior;
/**
* {@link com.pdd.pop.ext.apache.http.client.HttpRequestRetryHandler} which assumes
* that all requested HTTP methods which should be idempotent according
* to RFC-2616 are in fact idempotent and can be retried.
* <p>
* According to RFC-2616 section 9.1.2 the idempotent HTTP methods are:
* GET, HEAD, PUT, DELETE, OPTIONS, and TRACE
* </p>
*
* @since 4.2
*/
@Contract(threading = ThreadingBehavior.IMMUTABLE)
public class StandardHttpRequestRetryHandler extends DefaultHttpRequestRetryHandler {
private final Map<String, Boolean> idempotentMethods;
/**
* Default constructor
*/
public StandardHttpRequestRetryHandler(final int retryCount, final boolean requestSentRetryEnabled) {
super(retryCount, requestSentRetryEnabled);
this.idempotentMethods = new ConcurrentHashMap<String, Boolean>();
this.idempotentMethods.put("GET", Boolean.TRUE);
this.idempotentMethods.put("HEAD", Boolean.TRUE);
this.idempotentMethods.put("PUT", Boolean.TRUE);
this.idempotentMethods.put("DELETE", Boolean.TRUE);
this.idempotentMethods.put("OPTIONS", Boolean.TRUE);
this.idempotentMethods.put("TRACE", Boolean.TRUE);
}
/**
* Default constructor
*/
public StandardHttpRequestRetryHandler() {
this(3, false);
}
@Override
protected boolean handleAsIdempotent(final HttpRequest request) {
final String method = request.getRequestLine().getMethod().toUpperCase(Locale.ROOT);
final Boolean b = this.idempotentMethods.get(method);
return b != null && b.booleanValue();
}
}
| [
"lenzhao@yahoo.com"
] | lenzhao@yahoo.com |
dab6b28f9956bb1a494dfd7f066eb2e3fc69d15a | 6afafd946e0b48830ce42f6baac27265d014cb16 | /src/main/java/org/saccoware/controller/HomePageController.java | e5c43d64de006a881f903f39d558870d4850968a | [] | no_license | hilz041/Sacco-Financial-Management-System | 796d5c1c3a7d02b1f3ca3bfa4d45ea5b4139ae0f | 518e1cb09c8457321732fbd8e3864e6963e3e409 | refs/heads/master | 2021-04-06T10:52:00.901418 | 2018-03-15T09:53:27 | 2018-03-15T09:53:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,026 | java | package org.saccoware.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
public class HomePageController {
@RequestMapping(value="/biodata",method=RequestMethod.GET)
public String biodataPage() {
return "clientBioData";
}
@RequestMapping(value="/loan",method=RequestMethod.GET)
public String clientLoanPage() {
return "ClientLoan";
}
@RequestMapping(value="/enterSavings",method=RequestMethod.GET)
public String clientListPage() {
return "ClientSavingsForm";
}
@RequestMapping(value="/accounts",method=RequestMethod.GET)
public String saccoAccountsPage() {
return "SaccoAccounts";
}
@RequestMapping(value="/biodatalist",method=RequestMethod.GET)
public String biodataListPage() {
return "ClientList";
}
@RequestMapping(value="/savingslist",method=RequestMethod.GET)
public String savingsListPage() {
return "ClientSavingsList";
}
}
| [
"tmkmart@gmail.com"
] | tmkmart@gmail.com |
2f7288fe5e8602328e4d5159f93f5a673cb4ae62 | 09dcc67c72e2bd8e3f26edeb7602fffeceac7f5c | /src/main/java/me/sangmessi/soccer/configs/AppProperties.java | 102d995513f451591f8d8e440e1e085fd31f6a48 | [] | no_license | messi1913/soccer | 93751029e3bc12c1ea3a209669c2915eb4c83079 | c43b932e6d58bb1fc83fe4ace7e8e3958353f75f | refs/heads/master | 2020-04-17T14:51:43.840056 | 2019-01-20T15:09:28 | 2019-01-20T15:09:28 | 166,674,723 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 638 | java | package me.sangmessi.soccer.configs;
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import javax.validation.constraints.NotEmpty;
@Component
@ConfigurationProperties(prefix = "my-app")
@Getter @Setter
public class AppProperties {
@NotEmpty
private String adminUsername;
@NotEmpty
private String adminPassword;
@NotEmpty
private String userUsername;
@NotEmpty
private String userPassword;
@NotEmpty
private String clientId;
@NotEmpty
private String clientSecret;
}
| [
"messi1913@gmail.com"
] | messi1913@gmail.com |
f6bba4ee1a72a8b90523b42848d2a2b3ec8f2c6a | 3d4d5aec78b22223ee3e8045755ec96fc75f7f1c | /phoenix-core/src/test/java/org/apache/phoenix/index/VerifySingleIndexRowTest.java | 1e8a6cf7963de9064ccb976a13a69b95c9ae54a6 | [
"MIT",
"ISC",
"Apache-2.0",
"BSD-3-Clause",
"OFL-1.1",
"CPL-1.0"
] | permissive | sguggilam/phoenix | 954de0b16ae88aa8e74ad9f5b9e16db1e323b47c | dccc260413591a7ab3133f8040b8547b8e993750 | refs/heads/master | 2020-12-06T07:15:05.608546 | 2020-03-17T02:32:27 | 2020-04-20T21:21:12 | 232,384,828 | 0 | 0 | Apache-2.0 | 2020-01-07T18:01:52 | 2020-01-07T18:01:51 | null | UTF-8 | Java | false | false | 27,883 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.phoenix.index;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellUtil;
import org.apache.hadoop.hbase.DoNotRetryIOException;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.client.Delete;
import org.apache.hadoop.hbase.client.Mutation;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.Pair;
import org.apache.phoenix.coprocessor.IndexRebuildRegionScanner;
import org.apache.phoenix.coprocessor.IndexToolVerificationResult;
import org.apache.phoenix.jdbc.PhoenixConnection;
import org.apache.phoenix.query.BaseConnectionlessQueryTest;
import org.apache.phoenix.schema.PTable;
import org.apache.phoenix.schema.PTableKey;
import org.apache.phoenix.util.EnvironmentEdge;
import org.apache.phoenix.util.EnvironmentEdgeManager;
import org.apache.phoenix.util.PhoenixRuntime;
import org.apache.phoenix.util.SchemaUtil;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.mockito.Matchers;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.NavigableMap;
import java.util.Properties;
import static org.apache.phoenix.hbase.index.IndexRegionObserver.UNVERIFIED_BYTES;
import static org.apache.phoenix.hbase.index.IndexRegionObserver.VERIFIED_BYTES;
import static org.apache.phoenix.query.QueryConstants.EMPTY_COLUMN_BYTES;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.when;
public class VerifySingleIndexRowTest extends BaseConnectionlessQueryTest {
private static final int INDEX_TABLE_EXPIRY_SEC = 1;
private static final String UNEXPECTED_COLUMN = "0:UNEXPECTED_COLUMN";
public static final String FIRST_ID = "FIRST_ID";
public static final String SECOND_ID = "SECOND_ID";
public static final String FIRST_VALUE = "FIRST_VALUE";
public static final String SECOND_VALUE = "SECOND_VALUE";
public static final String
CREATE_TABLE_DDL = "CREATE TABLE IF NOT EXISTS %s (FIRST_ID BIGINT NOT NULL, "
+ "SECOND_ID BIGINT NOT NULL, FIRST_VALUE VARCHAR(20), "
+ "SECOND_VALUE INTEGER "
+ "CONSTRAINT PK PRIMARY KEY(FIRST_ID, SECOND_ID)) COLUMN_ENCODED_BYTES=0";
public static final String
CREATE_INDEX_DDL = "CREATE INDEX %s ON %s (SECOND_VALUE) INCLUDE (FIRST_VALUE)";
public static final String COMPLETE_ROW_UPSERT = "UPSERT INTO %s VALUES (?,?,?,?)";
public static final String PARTIAL_ROW_UPSERT = "UPSERT INTO %s (%s, %s, %s) VALUES (?,?,?)";
public static final String DELETE_ROW_DML = "DELETE FROM %s WHERE %s = ? AND %s = ?";
public static final String INCLUDED_COLUMN = "0:FIRST_VALUE";
@Rule
public ExpectedException exceptionRule = ExpectedException.none();
private enum TestType {
//set of mutations matching expected mutations
VALID_EXACT_MATCH,
//mix of delete and put mutations
VALID_MIX_MUTATIONS,
//only incoming unverified mutations
VALID_NEW_UNVERIFIED_MUTATIONS,
//extra mutations mimicking incoming mutations
VALID_MORE_MUTATIONS,
EXPIRED,
INVALID_EXTRA_CELL,
INVALID_EMPTY_CELL,
INVALID_CELL_VALUE,
INVALID_COLUMN
}
public static class UnitTestClock extends EnvironmentEdge {
long initialTime;
long delta;
public UnitTestClock(long delta) {
initialTime = System.currentTimeMillis() + delta;
this.delta = delta;
}
@Override
public long currentTime() {
return System.currentTimeMillis() + delta;
}
}
@Mock
Result indexRow;
@Mock
IndexRebuildRegionScanner rebuildScanner;
List<Mutation> actualMutationList;
String schema, table, dataTableFullName, index, indexTableFullName;
PTable pIndexTable, pDataTable;
Put put = null;
Delete delete = null;
PhoenixConnection pconn;
IndexToolVerificationResult.PhaseResult actualPR;
public Map<byte[], List<Mutation>> indexKeyToMutationMapLocal;
private IndexMaintainer indexMaintainer;
@Before
public void setup() throws SQLException, IOException {
MockitoAnnotations.initMocks(this);
createDBObject();
createMutationsWithUpserts();
initializeRebuildScannerAttributes();
initializeGlobalMockitoSetup();
}
public void createDBObject() throws SQLException {
try(Connection conn = DriverManager.getConnection(getUrl(), new Properties())) {
schema = generateUniqueName();
table = generateUniqueName();
index = generateUniqueName();
dataTableFullName = SchemaUtil.getQualifiedTableName(schema, table);
indexTableFullName = SchemaUtil.getQualifiedTableName(schema, index);
conn.createStatement().execute(String.format(CREATE_TABLE_DDL, dataTableFullName));
conn.createStatement().execute(String.format(CREATE_INDEX_DDL, index, dataTableFullName));
conn.commit();
pconn = conn.unwrap(PhoenixConnection.class);
pIndexTable = pconn.getTable(new PTableKey(pconn.getTenantId(), indexTableFullName));
pDataTable = pconn.getTable(new PTableKey(pconn.getTenantId(), dataTableFullName));
}
}
private void createMutationsWithUpserts() throws SQLException, IOException {
deleteRow(2, 3);
upsertPartialRow(2, 3, "abc");
upsertCompleteRow(2, 3, "hik", 8);
upsertPartialRow(2, 3, 10);
upsertPartialRow(2,3,4);
deleteRow(2, 3);
upsertPartialRow(2,3, "def");
upsertCompleteRow(2, 3, null, 20);
upsertPartialRow(2,3, "wert");
}
private void deleteRow(int key1, int key2) throws SQLException, IOException {
try(Connection conn = DriverManager.getConnection(getUrl(), new Properties())){
PreparedStatement ps =
conn.prepareStatement(
String.format(DELETE_ROW_DML, dataTableFullName, FIRST_ID, SECOND_ID));
ps.setInt(1, key1);
ps.setInt(2, key2);
ps.execute();
convertUpsertToMutations(conn);
}
}
private void upsertPartialRow(int key1, int key2, String val1)
throws SQLException, IOException {
try(Connection conn = DriverManager.getConnection(getUrl(), new Properties())){
PreparedStatement ps =
conn.prepareStatement(
String.format(PARTIAL_ROW_UPSERT, dataTableFullName, FIRST_ID, SECOND_ID,
FIRST_VALUE));
ps.setInt(1, key1);
ps.setInt(2, key2);
ps.setString(3, val1);
ps.execute();
convertUpsertToMutations(conn);
}
}
private void upsertPartialRow(int key1, int key2, int value1)
throws SQLException, IOException {
try(Connection conn = DriverManager.getConnection(getUrl(), new Properties())){
PreparedStatement
ps =
conn.prepareStatement(
String.format(PARTIAL_ROW_UPSERT, dataTableFullName, FIRST_ID, SECOND_ID,
SECOND_VALUE));
ps.setInt(1, key1);
ps.setInt(2, key2);
ps.setInt(3, value1);
ps.execute();
convertUpsertToMutations(conn);
}
}
private void upsertCompleteRow(int key1, int key2, String val1
, int val2) throws SQLException, IOException {
try(Connection conn = DriverManager.getConnection(getUrl(), new Properties())) {
PreparedStatement
ps = conn.prepareStatement(String.format(COMPLETE_ROW_UPSERT, dataTableFullName));
ps.setInt(1, key1);
ps.setInt(2, key2);
ps.setString(3, val1);
ps.setInt(4, val2);
ps.execute();
convertUpsertToMutations(conn);
}
}
private void convertUpsertToMutations(Connection conn) throws SQLException, IOException {
Iterator<Pair<byte[],List<Cell>>>
dataTableNameAndMutationKeyValuesIter = PhoenixRuntime.getUncommittedDataIterator(conn);
Pair<byte[], List<Cell>> elem = dataTableNameAndMutationKeyValuesIter.next();
byte[] key = CellUtil.cloneRow(elem.getSecond().get(0));
long mutationTS = EnvironmentEdgeManager.currentTimeMillis();
for (Cell kv : elem.getSecond()) {
Cell cell =
CellUtil.createCell(CellUtil.cloneRow(kv), CellUtil.cloneFamily(kv), CellUtil.cloneQualifier(kv),
mutationTS, kv.getTypeByte(), CellUtil.cloneValue(kv));
if (KeyValue.Type.codeToType(cell.getTypeByte()) == KeyValue.Type.Put) {
if (put == null ) {
put = new Put(key);
}
put.add(cell);
} else {
if (delete == null) {
delete = new Delete(key);
}
delete.addDeleteMarker(cell);
}
}
}
private void initializeRebuildScannerAttributes() {
when(rebuildScanner.setIndexTableTTL(Matchers.anyInt())).thenCallRealMethod();
when(rebuildScanner.setIndexMaintainer(Matchers.<IndexMaintainer>any())).thenCallRealMethod();
when(rebuildScanner.setIndexKeyToMutationMap(Matchers.<Map>any())).thenCallRealMethod();
rebuildScanner.setIndexTableTTL(HConstants.FOREVER);
indexMaintainer = pIndexTable.getIndexMaintainer(pDataTable, pconn);
rebuildScanner.setIndexMaintainer(indexMaintainer);
}
private void initializeGlobalMockitoSetup() throws IOException {
//setup
when(rebuildScanner.getIndexRowKey(put)).thenCallRealMethod();
when(rebuildScanner.prepareIndexMutations(put, delete)).thenCallRealMethod();
when(rebuildScanner.verifySingleIndexRow(Matchers.<Result>any(),
Matchers.<IndexToolVerificationResult.PhaseResult>any())).thenCallRealMethod();
doNothing().when(rebuildScanner)
.logToIndexToolOutputTable(Matchers.<byte[]>any(),Matchers.<byte[]>any(),
Mockito.anyLong(),Mockito.anyLong(), Mockito.anyString(),
Matchers.<byte[]>any(), Matchers.<byte[]>any());
doNothing().when(rebuildScanner)
.logToIndexToolOutputTable(Matchers.<byte[]>any(),Matchers.<byte[]>any(),
Mockito.anyLong(),Mockito.anyLong(), Mockito.anyString());
//populate the local map to use to create actual mutations
indexKeyToMutationMapLocal = Maps.newTreeMap(Bytes.BYTES_COMPARATOR);
rebuildScanner.setIndexKeyToMutationMap(indexKeyToMutationMapLocal);
rebuildScanner.prepareIndexMutations(put, delete);
//populate map to use in test code
Map<byte[], List<Mutation>> indexKeyToMutationMap = Maps.newTreeMap((Bytes.BYTES_COMPARATOR));
rebuildScanner.setIndexKeyToMutationMap(indexKeyToMutationMap);
rebuildScanner.prepareIndexMutations(put, delete);
}
private byte[] getValidRowKey() {
return indexKeyToMutationMapLocal.entrySet().iterator().next().getKey();
}
@Test
public void testVerifySingleIndexRow_validIndexRowCount_nonZero() throws IOException {
IndexToolVerificationResult.PhaseResult expectedPR = getValidPhaseResult();
for (Map.Entry<byte[], List<Mutation>>
entry : indexKeyToMutationMapLocal.entrySet()) {
initializeLocalMockitoSetup(entry, TestType.VALID_EXACT_MATCH);
//test code
rebuildScanner.verifySingleIndexRow(indexRow, actualPR);
assertTrue(actualPR.equals(expectedPR));
}
}
@Test
public void testVerifySingleIndexRow_validIndexRowCount_moreActual() throws IOException {
IndexToolVerificationResult.PhaseResult expectedPR = getValidPhaseResult();
for (Map.Entry<byte[], List<Mutation>>
entry : indexKeyToMutationMapLocal.entrySet()) {
initializeLocalMockitoSetup(entry, TestType.VALID_MORE_MUTATIONS);
//test code
rebuildScanner.verifySingleIndexRow(indexRow, actualPR);
assertTrue(actualPR.equals(expectedPR));
}
}
@Test
public void testVerifySingleIndexRow_allMix() throws IOException {
IndexToolVerificationResult.PhaseResult expectedPR = getValidPhaseResult();
for (Map.Entry<byte[], List<Mutation>>
entry : indexKeyToMutationMapLocal.entrySet()) {
initializeLocalMockitoSetup(entry, TestType.VALID_MIX_MUTATIONS);
//test code
rebuildScanner.verifySingleIndexRow(indexRow, actualPR);
assertTrue(actualPR.equals(expectedPR));
}
}
@Test
public void testVerifySingleIndexRow_allUnverified() throws IOException {
IndexToolVerificationResult.PhaseResult expectedPR = getValidPhaseResult();
for (Map.Entry<byte[], List<Mutation>>
entry : indexKeyToMutationMapLocal.entrySet()) {
initializeLocalMockitoSetup(entry, TestType.VALID_NEW_UNVERIFIED_MUTATIONS);
//test code
rebuildScanner.verifySingleIndexRow(indexRow, actualPR);
assertTrue(actualPR.equals(expectedPR));
}
}
@Test
public void testVerifySingleIndexRow_expiredIndexRowCount_nonZero() throws IOException {
IndexToolVerificationResult.PhaseResult
expectedPR = new IndexToolVerificationResult.PhaseResult(0, 1, 0, 0);
for (Map.Entry<byte[], List<Mutation>>
entry : indexKeyToMutationMapLocal.entrySet()) {
initializeLocalMockitoSetup(entry, TestType.EXPIRED);
expireThisRow();
//test code
rebuildScanner.verifySingleIndexRow(indexRow, actualPR);
assertTrue(actualPR.equals(expectedPR));
}
}
@Ignore
@Test
public void testVerifySingleIndexRow_invalidIndexRowCount_cellValue() throws IOException {
IndexToolVerificationResult.PhaseResult expectedPR = getInvalidPhaseResult();
for (Map.Entry<byte[], List<Mutation>>
entry : indexKeyToMutationMapLocal.entrySet()) {
initializeLocalMockitoSetup(entry, TestType.INVALID_CELL_VALUE);
//test code
rebuildScanner.verifySingleIndexRow(indexRow, actualPR);
assertTrue(actualPR.equals(expectedPR));
}
}
@Ignore
@Test
public void testVerifySingleIndexRow_invalidIndexRowCount_emptyCell() throws IOException {
IndexToolVerificationResult.PhaseResult expectedPR = getInvalidPhaseResult();
for (Map.Entry<byte[], List<Mutation>>
entry : indexKeyToMutationMapLocal.entrySet()) {
initializeLocalMockitoSetup(entry, TestType.INVALID_EMPTY_CELL);
//test code
rebuildScanner.verifySingleIndexRow(indexRow, actualPR);
assertTrue(actualPR.equals(expectedPR));
}
}
@Test
public void testVerifySingleIndexRow_invalidIndexRowCount_diffColumn() throws IOException {
IndexToolVerificationResult.PhaseResult expectedPR = getInvalidPhaseResult();
for (Map.Entry<byte[], List<Mutation>>
entry : indexKeyToMutationMapLocal.entrySet()) {
initializeLocalMockitoSetup(entry, TestType.INVALID_COLUMN);
//test code
rebuildScanner.verifySingleIndexRow(indexRow, actualPR);
assertTrue(actualPR.equals(expectedPR));
}
}
@Ignore
@Test
public void testVerifySingleIndexRow_invalidIndexRowCount_extraCell() throws IOException {
IndexToolVerificationResult.PhaseResult expectedPR = getInvalidPhaseResult();
for (Map.Entry<byte[], List<Mutation>>
entry : indexKeyToMutationMapLocal.entrySet()) {
initializeLocalMockitoSetup(entry, TestType.INVALID_EXTRA_CELL);
//test code
rebuildScanner.verifySingleIndexRow(indexRow, actualPR);
assertTrue(actualPR.equals(expectedPR));
}
}
@Test
public void testVerifySingleIndexRow_expectedMutations_null() throws IOException {
when(indexRow.getRow()).thenReturn(Bytes.toBytes(1));
exceptionRule.expect(DoNotRetryIOException.class);
exceptionRule.expectMessage(IndexRebuildRegionScanner.NO_EXPECTED_MUTATION);
rebuildScanner.verifySingleIndexRow(indexRow, actualPR);
}
@Test
public void testVerifySingleIndexRow_actualMutations_null() throws IOException {
byte [] validRowKey = getValidRowKey();
when(indexRow.getRow()).thenReturn(validRowKey);
when(rebuildScanner.prepareActualIndexMutations(indexRow)).thenReturn(null);
exceptionRule.expect(DoNotRetryIOException.class);
exceptionRule.expectMessage(IndexRebuildRegionScanner.ACTUAL_MUTATION_IS_NULL_OR_EMPTY);
rebuildScanner.verifySingleIndexRow(indexRow, actualPR);
}
@Test
public void testVerifySingleIndexRow_actualMutations_empty() throws IOException {
byte [] validRowKey = getValidRowKey();
when(indexRow.getRow()).thenReturn(validRowKey);
actualMutationList = new ArrayList<>();
when(rebuildScanner.prepareActualIndexMutations(indexRow)).thenReturn(actualMutationList);
exceptionRule.expect(DoNotRetryIOException.class);
exceptionRule.expectMessage(IndexRebuildRegionScanner.ACTUAL_MUTATION_IS_NULL_OR_EMPTY);
rebuildScanner.verifySingleIndexRow(indexRow, actualPR);
}
private IndexToolVerificationResult.PhaseResult getValidPhaseResult() {
return new IndexToolVerificationResult.PhaseResult(1,0,0,0);
}
private IndexToolVerificationResult.PhaseResult getInvalidPhaseResult() {
return new IndexToolVerificationResult.PhaseResult(0, 0, 0, 1);
}
private void initializeLocalMockitoSetup(Map.Entry<byte[], List<Mutation>> entry,
TestType testType)
throws IOException {
actualPR = new IndexToolVerificationResult.PhaseResult();
byte[] indexKey = entry.getKey();
when(indexRow.getRow()).thenReturn(indexKey);
actualMutationList = buildActualIndexMutationsList(testType);
when(rebuildScanner.prepareActualIndexMutations(indexRow)).thenReturn(actualMutationList);
}
private List<Mutation> buildActualIndexMutationsList(TestType testType) {
List<Mutation> actualMutations = new ArrayList<>();
actualMutations.addAll(indexKeyToMutationMapLocal.get(indexRow.getRow()));
if(testType.equals(TestType.EXPIRED)) {
return actualMutations;
}
if(testType.toString().startsWith("VALID")) {
return getValidActualMutations(testType, actualMutations);
}
if(testType.toString().startsWith("INVALID")) {
return getInvalidActualMutations(testType, actualMutations);
}
return null;
}
private List <Mutation> getValidActualMutations(TestType testType,
List<Mutation> actualMutations) {
List <Mutation> newActualMutations = new ArrayList<>();
if(testType.equals(TestType.VALID_EXACT_MATCH)) {
return actualMutations;
}
if (testType.equals(TestType.VALID_MIX_MUTATIONS)) {
newActualMutations.add(getUnverifiedPutMutation(actualMutations.get(0), null));
newActualMutations.add(getDeleteMutation(actualMutations.get(0), new Long(1)));
newActualMutations.add(getUnverifiedPutMutation(actualMutations.get(0), null));
}
if (testType.equals(TestType.VALID_NEW_UNVERIFIED_MUTATIONS)) {
newActualMutations.add(getUnverifiedPutMutation(actualMutations.get(0), null));
newActualMutations.add(getUnverifiedPutMutation(actualMutations.get(0), null));
newActualMutations.add(getUnverifiedPutMutation(actualMutations.get(0), null));
newActualMutations.add(getUnverifiedPutMutation(actualMutations.get(0), new Long(1)));
}
newActualMutations.addAll(actualMutations);
if(testType.equals(TestType.VALID_MORE_MUTATIONS)) {
newActualMutations.add(getUnverifiedPutMutation(actualMutations.get(0), null));
newActualMutations.add(getDeleteMutation(actualMutations.get(0), null));
newActualMutations.add(getDeleteMutation(actualMutations.get(0), new Long(1)));
newActualMutations.add(getUnverifiedPutMutation(actualMutations.get(0), new Long(1)));
}
return newActualMutations;
}
private List <Mutation> getInvalidActualMutations(TestType testType,
List<Mutation> actualMutations) {
List <Mutation> newActualMutations = new ArrayList<>();
newActualMutations.addAll(actualMutations);
for (Mutation m : actualMutations) {
newActualMutations.remove(m);
NavigableMap<byte[], List<Cell>> familyCellMap = m.getFamilyCellMap();
List<Cell> cellList = familyCellMap.firstEntry().getValue();
List<Cell> newCellList = new ArrayList<>();
byte[] fam = CellUtil.cloneFamily(cellList.get(0));
for (Cell c : cellList) {
infiltrateCell(c, newCellList, testType);
}
familyCellMap.put(fam, newCellList);
m.setFamilyCellMap(familyCellMap);
newActualMutations.add(m);
}
return newActualMutations;
}
private void infiltrateCell(Cell c, List<Cell> newCellList, TestType e) {
Cell newCell;
Cell emptyCell;
switch(e) {
case INVALID_COLUMN:
newCell =
CellUtil.createCell(CellUtil.cloneRow(c), CellUtil.cloneFamily(c),
Bytes.toBytes(UNEXPECTED_COLUMN),
EnvironmentEdgeManager.currentTimeMillis(),
KeyValue.Type.Put.getCode(), Bytes.toBytes("zxcv"));
newCellList.add(newCell);
newCellList.add(c);
break;
case INVALID_CELL_VALUE:
if (CellUtil.matchingQualifier(c, EMPTY_COLUMN_BYTES)) {
newCell = getCellWithPut(c);
emptyCell = getVerifiedEmptyCell(c);
newCellList.add(newCell);
newCellList.add(emptyCell);
} else {
newCellList.add(c);
}
break;
case INVALID_EMPTY_CELL:
if (CellUtil.matchingQualifier(c, EMPTY_COLUMN_BYTES)) {
newCell =
CellUtil.createCell(CellUtil.cloneRow(c), CellUtil.cloneFamily(c),
CellUtil.cloneQualifier(c), c.getTimestamp(),
KeyValue.Type.Delete.getCode(), VERIFIED_BYTES);
newCellList.add(newCell);
} else {
newCellList.add(c);
}
break;
case INVALID_EXTRA_CELL:
newCell = getCellWithPut(c);
emptyCell = getVerifiedEmptyCell(c);
newCellList.add(newCell);
newCellList.add(emptyCell);
newCellList.add(c);
}
}
private Cell getVerifiedEmptyCell(Cell c) {
return CellUtil.createCell(CellUtil.cloneRow(c), CellUtil.cloneFamily(c),
indexMaintainer.getEmptyKeyValueQualifier(),
EnvironmentEdgeManager.currentTimeMillis(),
KeyValue.Type.Put.getCode(), VERIFIED_BYTES);
}
private Cell getCellWithPut(Cell c) {
return CellUtil.createCell(CellUtil.cloneRow(c),
CellUtil.cloneFamily(c), Bytes.toBytes(INCLUDED_COLUMN),
c.getTimestamp(), KeyValue.Type.Put.getCode(),
Bytes.toBytes("zxcv"));
}
private void expireThisRow() {
rebuildScanner.setIndexTableTTL(INDEX_TABLE_EXPIRY_SEC);
UnitTestClock expiryClock = new UnitTestClock(5000);
EnvironmentEdgeManager.injectEdge(expiryClock);
}
private Mutation getDeleteMutation(Mutation orig, Long ts) {
Mutation m = new Delete(orig.getRow());
List<Cell> origList = orig.getFamilyCellMap().firstEntry().getValue();
ts = ts == null ? EnvironmentEdgeManager.currentTimeMillis() : ts;
Cell c = getNewPutCell(orig, origList, ts, KeyValue.Type.DeleteFamilyVersion);
Cell empty = getEmptyCell(orig, origList, ts, KeyValue.Type.Put, true);
byte[] fam = CellUtil.cloneFamily(origList.get(0));
List<Cell> famCells = Lists.newArrayList();
m.getFamilyCellMap().put(fam, famCells);
famCells.add(c);
famCells.add(empty);
return m;
}
private Mutation getUnverifiedPutMutation(Mutation orig, Long ts) {
Mutation m = new Put(orig.getRow());
if (orig.getAttributesMap() != null) {
for (Map.Entry<String,byte[]> entry : orig.getAttributesMap().entrySet()) {
m.setAttribute(entry.getKey(), entry.getValue());
}
}
List<Cell> origList = orig.getFamilyCellMap().firstEntry().getValue();
ts = ts == null ? EnvironmentEdgeManager.currentTimeMillis() : ts;
Cell c = getNewPutCell(orig, origList, ts, KeyValue.Type.Put);
Cell empty = getEmptyCell(orig, origList, ts, KeyValue.Type.Put, false);
byte[] fam = CellUtil.cloneFamily(origList.get(0));
List<Cell> famCells = Lists.newArrayList();
m.getFamilyCellMap().put(fam, famCells);
famCells.add(c);
famCells.add(empty);
return m;
}
private Cell getEmptyCell(Mutation orig, List<Cell> origList, Long ts, KeyValue.Type type,
boolean verified) {
return CellUtil.createCell(orig.getRow(), CellUtil.cloneFamily(origList.get(0)),
indexMaintainer.getEmptyKeyValueQualifier(),
ts, type.getCode(), verified ? VERIFIED_BYTES : UNVERIFIED_BYTES);
}
private Cell getNewPutCell(Mutation orig, List<Cell> origList, Long ts, KeyValue.Type type) {
return CellUtil.createCell(orig.getRow(),
CellUtil.cloneFamily(origList.get(0)), Bytes.toBytes(INCLUDED_COLUMN),
ts, type.getCode(), Bytes.toBytes("asdfg"));
}
}
| [
"kozdemir@salesforce.com"
] | kozdemir@salesforce.com |
cfd6b017800409ce49bf25b7d3243fcc549f0958 | 969fa793f091389ceecbd01e0bcba6deb7380467 | /branches/ldap/develop/src/de/deepamehta/TopicInitException.java | a5d908cb128bcd114619f08564cf4d20ec5f0f6c | [] | no_license | BackupTheBerlios/deepamehta-svn | ff1d281dad5e3e9eedc391a5516720dc6a5ef5c9 | dcf4450b1fd7e45f32c101528ad34309352692f1 | refs/heads/master | 2021-01-23T12:11:31.904460 | 2013-03-12T21:47:53 | 2013-03-12T21:47:53 | 40,670,713 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 307 | java | package de.deepamehta;
public class TopicInitException extends RuntimeException {
/**
* Constructs an <CODE>TopicInitException</CODE> with the specified
* detail message.
*
* @param s the detail message
*/
public TopicInitException(String s) {
super(s);
}
}
| [
"jri@ce15fd23-9a04-0410-ae48-de31837f27f4"
] | jri@ce15fd23-9a04-0410-ae48-de31837f27f4 |
ab97d169c01ab77b72ff21c42c94478eee8f892b | b0628c8502562a818132a4a58d09acd3dea1833c | /project/src/test/java/net/piotrl/music/modules/rescuetime/aggregation/RescueTimeAggregationTest.java | 00f23cdf642824fe37079842bdaa4d73c68aeaff | [] | no_license | piotrl/master-thesis | 9cb7f6d4f17caf95bcb8d4afe68eb2d5fe1295a6 | 98c94436bbe9c85a34db68fa64e34b0c9bde5e99 | refs/heads/master | 2021-03-27T13:27:34.610595 | 2017-06-14T23:16:21 | 2017-06-14T23:16:21 | 32,019,247 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,045 | java | package net.piotrl.music.modules.rescuetime.aggregation;
import net.piotrl.music.mocks.AggregationPropertiesMock;
import net.piotrl.music.modules.aggregation.AggregationContext;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.time.LocalDate;
import static org.assertj.core.api.Assertions.assertThat;
@SpringBootTest
@RunWith(SpringRunner.class)
public class RescueTimeAggregationTest {
@Autowired
private RescueTimeAggregation rescueTimeAggregation;
@Test
public void aggregationFromLastSixteenDays() throws Exception {
LocalDate recentDate = LocalDate.now().minusDays(16);
AggregationContext context = AggregationPropertiesMock.globalContext();
rescueTimeAggregation.startAggregation(context, recentDate);
assertThat(context.getResult().isFailed())
.isFalse();
}
} | [
"grovman@gmail.com"
] | grovman@gmail.com |
35a64bbe8e4cd9fbc54359bd1eada2df52973a75 | 86930ce4706f59ac1bb0c4b076106917d877fd99 | /src/main/java/com/hanyun/scm/api/domain/response/GoodsClassifyBrandRes.java | 440314b7d112f7e938d0ed5bfee802b3789e3e13 | [] | no_license | fengqingyuns/erp | 61efe476e8926f2df8324fc7af66b16d80716785 | bc6c654afe76fed0ba8eb515cc7ddd7acc577060 | refs/heads/master | 2022-07-13T11:18:10.661271 | 2019-12-05T14:21:30 | 2019-12-05T14:21:30 | 226,119,652 | 0 | 0 | null | 2022-06-29T17:49:35 | 2019-12-05T14:23:18 | Java | UTF-8 | Java | false | false | 666 | java | package com.hanyun.scm.api.domain.response;
import com.hanyun.scm.api.domain.GoodsClassifyBrand;
import java.util.List;
public class GoodsClassifyBrandRes {
private List<GoodsClassifyBrand> goodsClassifyBrandList;
private Integer count;
public List<GoodsClassifyBrand> getGoodsClassifyBrandList() {
return goodsClassifyBrandList;
}
public void setGoodsClassifyBrandList(List<GoodsClassifyBrand> goodsClassifyBrandList) {
this.goodsClassifyBrandList = goodsClassifyBrandList;
}
public Integer getCount() {
return count;
}
public void setCount(Integer count) {
this.count = count;
}
}
| [
"litao@winshang.com"
] | litao@winshang.com |
3660ada9b0229944837f43cf51d3ed8c406900d7 | 39ccb634a639cf3efdc01a200147d48b94ecc8e4 | /app/src/main/java/sea/com/seandroid/page_profile/PageProfileContract.java | a34e85016ef64ad077a2ad9f011a8738fc03ba19 | [] | no_license | claudiomarpda/SEAndroid | e65bd71b0c10d2032bce963b003bce72cb9eb7ff | 3d0448dfc4955e2e7ba8406d0bbfb21074743cd7 | refs/heads/master | 2020-03-11T15:44:49.086952 | 2018-04-30T01:09:28 | 2018-04-30T01:15:55 | 130,094,731 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 433 | java | package sea.com.seandroid.page_profile;
import java.util.List;
import sea.com.seandroid.BasePresenter;
import sea.com.seandroid.BaseView;
import sea.com.seandroid.data.model.Knowledge;
public interface PageProfileContract {
interface View extends BaseView<Presenter> {
void showKnowledge(List<Knowledge> knowledgeList);
}
interface Presenter extends BasePresenter {
void findKnowledge();
}
}
| [
"claudiomarpda@gmail.com"
] | claudiomarpda@gmail.com |
bc6ebe3d92202149dde8a76c0dc923caf1c0dbb5 | c1ce370bacb052539aa2ac55eff76f90e9d7b5dc | /ParcelableTutorial/src/com/example/parcelabletutorial/MainActivity.java | c559f052982bf246659220d6104cb8c1e50436e8 | [] | no_license | tselitsk/Android_Tutorials | 553d20d9953d54461b2e64522c775d607e9db875 | e77ccf7fabfdd16e8d8338b99b2b265e38d01ffc | refs/heads/master | 2021-01-25T10:22:05.547494 | 2013-04-07T23:05:39 | 2013-04-07T23:05:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,012 | java | package com.example.parcelabletutorial;
import android.os.Bundle;
import android.os.Parcel;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
public class MainActivity extends Activity {
//this tutorial is on parceables. Parceables are used when you want to transfer objects
//from one intent to another
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Quake quake1=new Quake();
quake1.setTitle("quake 1 title");
quake1.setUpdated("quake 1 updated");
Bundle bundle=new Bundle();
bundle.putParcelable("quake", quake1);
Intent intent=new Intent(this, ConsumeActivity.class);
intent.putExtras(bundle);
startActivity(intent);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}
| [
"talqsel@gmail.com"
] | talqsel@gmail.com |
c759edf402b65afb6925f4dd8f283d28684fd3cc | 563b017bfae37656a9d66804dc2d38685e1e17a0 | /app/src/main/java/com/example/recyclenev/PostAdapter.java | db29a9dd0c86bc2fc7c48d08ae2dba6d82c5d8dc | [] | no_license | karandeepsingh07/SocialAppLPU | 360c3cb9a39359fa238e45f0f31b968fab888d34 | fc12337dd3c7581d2a88081abb55a42a69adaa7a | refs/heads/master | 2023-05-06T10:00:51.900784 | 2021-05-22T17:44:17 | 2021-05-22T17:44:17 | 369,871,195 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,413 | java | package com.example.recyclenev;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.bumptech.glide.Glide;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import java.util.ArrayList;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import de.hdodenhof.circleimageview.CircleImageView;
public class PostAdapter extends RecyclerView.Adapter<PostAdapter.PostViewHolder> {
private ArrayList<PostDetailPC> items;
private Context context;
Boolean liked=false;
long like;
public PostAdapter(ArrayList<PostDetailPC> items, Context context) {
this.items = items;
this.context = context;
}
@NonNull
@Override
public PostViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
LayoutInflater inflater=LayoutInflater.from(context);
View view=inflater.inflate(R.layout.row_posts,parent,false);
return new PostViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull final PostViewHolder holder, final int position) {
final PostDetailPC postDetailPC=items.get(position);
holder.textViewTitle.setText(postDetailPC.getEventName());
holder.textViewTime.setText(postDetailPC.getEventUploadTime());
holder.textViewName.setText(postDetailPC.getOrganisationName());
holder.textViewLikes.setText(postDetailPC.getEventLikes());
Glide.with(context).load(postDetailPC.getEventImageUrl()).into(holder.imageViewPost);
Glide.with(context).load(postDetailPC.getOrganisationDP()).into(holder.imageViewOrgDp);
String ppuid=postDetailPC.getPpUid();
String puid=postDetailPC.getpUid();
FirebaseUser user=FirebaseAuth.getInstance().getCurrentUser();
final String uid=user.getUid();
final DatabaseReference databaseReference= FirebaseDatabase.getInstance().getReference().child("Posts").child("Likes").child(ppuid).child(puid).child(uid);
final DatabaseReference databaseReference2= FirebaseDatabase.getInstance().getReference().child("Posts").child("Details").child(ppuid).child(puid).child("eventLikes");
eventLike(ppuid,puid,holder.buttonLike);
like=Long.parseLong(postDetailPC.getEventLikes());
holder.imageViewPost.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent=new Intent(context,PostDescriptionActivity.class);
intent.putExtra("pid",postDetailPC.getpUid());
intent.putExtra("upid",postDetailPC.getPpUid());
intent.putExtra("epid",uid);
context.startActivity(intent);
}
});
holder.buttonComment.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent=new Intent(context,CommentActivity.class);
intent.putExtra("pid",postDetailPC.getpUid());
intent.putExtra("upid",postDetailPC.getPpUid());
context.startActivity(intent);
}
});
holder.buttonLike.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(!liked) {
holder.buttonLike.setCompoundDrawablesWithIntrinsicBounds( R.drawable.ic_thumb_up_blue_24dp, 0, 0, 0);
holder.buttonLike.setTextColor(Color.BLUE);
databaseReference.setValue(true);
like++;
databaseReference2.setValue(""+like);
holder.textViewLikes.setText(""+like);
liked=true;
}
else{
holder.buttonLike.setCompoundDrawablesWithIntrinsicBounds( R.drawable.ic_like_black, 0, 0, 0);
holder.buttonLike.setTextColor(Color.BLACK);
databaseReference.setValue(false);
if(like>0)
like--;
databaseReference2.setValue(""+like);
holder.textViewLikes.setText(""+like);
liked=false;
}
}
});
holder.buttonShare.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
try {
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("text/plain");
i.putExtra(Intent.EXTRA_SUBJECT, "CODS");
String sAux = "\nEventName- "+postDetailPC.getEventName()+"\nOrganised By- "+postDetailPC.getOrganisationName()+"\nImage Link- "+postDetailPC.getEventImageUrl()+"\nEvent Description"+postDetailPC.getEventDescription()+"" +
"\nEvent Date- "+postDetailPC.getEventDate()+"\nEvent Time- "+postDetailPC.getEventTime()+"\nLast date to register"+postDetailPC.getEventLastDate()+"" +
"\nDL Provided- "+postDetailPC.getEventDL()+"\nRegistration Link- "+postDetailPC.getEventLink()+"\nFee- "+postDetailPC.getEventFees()+"\nContact- "+postDetailPC.getEventContact();
i.putExtra(Intent.EXTRA_TEXT, sAux);
context.startActivity(Intent.createChooser(i, "choose one"));
} catch(Exception e) {
//e.toString();
}
}
});
}
public void eventLike(String ppuid, String puid, final Button likeBtn){
FirebaseUser user=FirebaseAuth.getInstance().getCurrentUser();
String uid=user.getUid();
DatabaseReference databaseReference= FirebaseDatabase.getInstance().getReference().child("Posts").child("Likes").child(ppuid).child(puid).child(uid);
databaseReference.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
try {
if (dataSnapshot.getValue().toString().equals("true")) {
liked = true;
likeBtn.setCompoundDrawablesWithIntrinsicBounds( R.drawable.ic_thumb_up_blue_24dp, 0, 0, 0);
likeBtn.setTextColor(Color.BLUE);
} else {
likeBtn.setCompoundDrawablesWithIntrinsicBounds( R.drawable.ic_like_black, 0, 0, 0);
likeBtn.setTextColor(Color.BLACK);
liked = false;
}
}catch (NullPointerException e){
liked=false;
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
@Override
public int getItemCount() {
return items.size();
}
public class PostViewHolder extends RecyclerView.ViewHolder{
TextView textViewName,textViewTime,textViewTitle,textViewLikes;
ImageView imageViewPost;
CircleImageView imageViewOrgDp;
Button buttonComment,buttonShare,buttonLike;
public PostViewHolder(@NonNull View itemView) {
super(itemView);
textViewName=itemView.findViewById(R.id.uNameTv);
textViewTime=itemView.findViewById(R.id.pTimeTv);
textViewTitle=itemView.findViewById(R.id.pTitleTV);
textViewLikes=itemView.findViewById(R.id.pLikesTv);
imageViewPost=itemView.findViewById(R.id.pImageIv);
buttonComment=itemView.findViewById(R.id.commentBt);
imageViewOrgDp=itemView.findViewById(R.id.uPictureIv);
buttonShare=itemView.findViewById(R.id.shareBt);
buttonLike=itemView.findViewById(R.id.likeBt);
}
}
}
| [
"karandeep.singh0703@gmaiil.com"
] | karandeep.singh0703@gmaiil.com |
cdf0c76bad36e0d203870dcf604226e24cb7a200 | 4c31c4a0f7f7b9e7b4831cb1654f36272e5bc56c | /Aulasjava/src/ProjetoPessoas/Funcionario.java | fb653c8da7f07d4a3c2b6c8bccd2103917dec31a | [] | no_license | MarcosJr1991/ExercicioJavaDHEntregavel | 991383828a34e0cbc2ced742a3dc440ae5859ccf | aa25b422569776e7569bbac7c2faa63c82fa0afb | refs/heads/master | 2020-03-21T01:32:51.170722 | 2018-06-19T21:29:38 | 2018-06-19T21:29:38 | 137,947,271 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 524 | java | package ProjetoPessoas;
public class Funcionario extends Pessoa {
private String setor;
private boolean trabalhando;
public void mudaTrabalho(){
this.trabalhando = ! this.trabalhando;
}
public String getSetor() {
return setor;
}
public void setSetor(String setor) {
this.setor = setor;
}
public boolean isTrabalhando() {
return trabalhando;
}
public void setTrabalhando(boolean trabalhando) {
this.trabalhando = trabalhando;
}
}
| [
"marcossouzacruzjunior@gmail.com"
] | marcossouzacruzjunior@gmail.com |
bc5b20fff68c22a1063db737387ab59f3269098c | 9e4349362af3b36dca83a3f4558cd3018dd16fde | /12-Java讲课笔记大汇总/workspace/xiti/src/com/icss/test/Player.java | 478c8385bcda681dcac8c80857a7962a7df84ae3 | [] | no_license | ChengsGitHub/ChinaSofti | df44348f5f40d0f4bde7ccc709216dd2c4b82226 | 5eef9a0f190aa7d04d361cd902aad55c13c8a5ca | refs/heads/master | 2020-05-22T18:34:00.189893 | 2017-03-12T08:57:50 | 2017-03-12T08:57:50 | 84,710,360 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 117 | java | package com.icss.test;
public class Player {
public void testPlay(Instrument ins){
ins.play();
}
}
| [
"bian451663644@163.com"
] | bian451663644@163.com |
64bd455855fa1c86c24b50af6cf85a626f14d727 | fe9dae9b7b44011d7a7e4db9db9132ab278165c7 | /src/h08/RekenMachine.java | a44935f3a1cc50f72a98ff0ad4b8a4ab49eace66 | [] | no_license | DarioNL/inleiding-java | fb76dcab6625327354f1aeeb531479f27fde480d | 62403ad1a90ae1a06ebb1273267af6c99c92330a | refs/heads/master | 2020-07-16T16:01:28.828040 | 2019-09-27T10:15:56 | 2019-09-27T10:15:56 | 205,820,100 | 0 | 0 | null | 2019-09-02T09:14:05 | 2019-09-02T09:14:05 | null | UTF-8 | Java | false | false | 3,428 | java | package h08;
import java.applet.Applet;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class RekenMachine extends Applet {
Button Knop;
Button Knop2;
Button Knop3;
Button Knop4;
TextField tekstvak;
TextField tekstvak2;
Label label2;
Label label;
String s;
double getal, getal2, antwoord;
String s2;
public void init() {
tekstvak = new TextField("", 20);
label = new Label("");
tekstvak.addActionListener(new Tekstvaklisterner() );
add(label);
add(tekstvak);
tekstvak2 = new TextField("", 20);
label2 = new Label("");
tekstvak2.addActionListener(new Tekstvaklisterner() );
add(label2);
add(tekstvak2);
Knop = new Button();
Knop.setLabel( "*" );
knoplisterner kl = new knoplisterner();
Knop.addActionListener( kl );
add(Knop);
Knop2 = new Button();
Knop2.setLabel( "/" );
knoplisterner2 kl2 = new knoplisterner2();
Knop2.addActionListener( kl2 );
add(Knop2);
Knop3 = new Button();
Knop3.setLabel( "+" );
knoplisterner3 kl3 = new knoplisterner3();
Knop3.addActionListener( kl2 );
add(Knop3);
Knop4 = new Button();
Knop4.setLabel( "-" );
knoplisterner4 kl4 = new knoplisterner4();
Knop4.addActionListener( kl4 );
add(Knop4);
}
@Override
public void paint(Graphics g)
{
g.drawString("= "+ antwoord, 500,60);
}
class Tekstvaklisterner implements ActionListener {
@Override
public void actionPerformed(ActionEvent e)
{
s2 = tekstvak.getText();
}
}
class Tekstvaklisterner2 implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
s2 = tekstvak.getText();
}
}
class knoplisterner implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
s = tekstvak.getText();
s2 = tekstvak2.getText();
getal = Double.parseDouble( s );
getal2 = Double.parseDouble( s2 );
antwoord = getal*getal2;
repaint();
}
}
class knoplisterner2 implements ActionListener{
@Override
public void actionPerformed (ActionEvent e) {
s = tekstvak.getText();
s2 = tekstvak2.getText();
getal = Double.parseDouble( s );
getal2 = Double.parseDouble( s2 );
antwoord = getal/getal2;
repaint();
}
}
class knoplisterner3 implements ActionListener{
@Override
public void actionPerformed (ActionEvent e) {
s = tekstvak.getText();
s2 = tekstvak2.getText();
getal = Double.parseDouble( s );
getal2 = Double.parseDouble( s2 );
antwoord = getal+getal2;
repaint();
}
}
class knoplisterner4 implements ActionListener{
@Override
public void actionPerformed (ActionEvent e) {
s = tekstvak.getText();
s2 = tekstvak2.getText();
getal = Double.parseDouble( s );
getal2 = Double.parseDouble( s2 );
antwoord = getal-getal2;
repaint();
}
}
}
| [
"Darioponzo03@gmail.com"
] | Darioponzo03@gmail.com |
ba546c58dcb129696d6093e7feb773aa67efca43 | 16a525df563e21ff3208f34b4d4898938153ccd5 | /Solucao Java/Maximização Simples/src/Problema_do_Artesao/artesao.java | a47ddb18134ab86ae0b094399ae5c0aa76c2c1fb | [] | no_license | FelipeEnne/Otimizacao_MaxSimples | adb02bba48195f4d12730630c838bd33f288eaf6 | e60759b4b391804ba28f5a6ec7f71d1978638364 | refs/heads/master | 2020-05-23T19:05:42.245869 | 2019-05-17T01:35:05 | 2019-05-17T01:35:05 | null | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 1,952 | java | package Problema_do_Artesao;
//Imports
import ilog.concert.IloException;
import ilog.concert.IloLinearNumExpr;
import ilog.concert.IloNumVar;
import ilog.cplex.IloCplex;
public class artesao {
public static void main(String[] args) {
int nv = 2;
int nr = 3;
double[] r= {8,5};
double[][] res = {{1,0},{0,1},{1.5,0.8333333}};
double[] rhs = {4,6,8};
solveModel(nv, nr, r, res, rhs);
}
/*Declarando
* n número de variáveis 2
* m número de restrição 3
*
* r receita das variáveis 5 3
*
* res restrições
*
* rhs RHS
*
* */
public static void solveModel(int nv, int nr, double[] r, double[][] res, double[] rhs) {
try {
//Iniciando o Modelo
IloCplex model = new IloCplex();
//Variáveis de decisão
IloNumVar[] x = new IloNumVar[nv];
// Para cada x atribui o valor
for (int i = 0; i < nv; i++) {
//x 1 arg maior que 0 e 2 arg máximo valor
x[i] = model.numVar(0, Double.MAX_VALUE);
}
//Função Objetivo
IloLinearNumExpr obj = model.linearNumExpr();
for (int i = 0; i < nv; i++) {
//x 1 arg receita e 2 arg variável
obj.addTerm(r[i], x[i]);
}
//Modelo - Maximizar
model.addMaximize(obj);
//Restrições
for (int i = 0; i < nr; i++) {
IloLinearNumExpr constraint = model.linearNumExpr();
for (int j = 0; j < nv; j++) {
constraint.addTerm(res[i][j], x[j]);
}
//>= Ge <= Le
model.addLe(constraint, rhs[i]);
}
//Print Solução
boolean isSolved = model.solve();
if(isSolved) {
double objValue = model.getObjValue();
System.out.println("Valor objetivo: "+ objValue);
for (int i = 0; i < nv; i++) {
System.out.println("x["+ (i+1) + "] = " + model.getValue(x[i]));
}
}else {
System.out.println("O modelo não resolveu");
}
}catch(IloException ex) {
ex.printStackTrace();
}
}
}
| [
"felipeenne@gmail.com"
] | felipeenne@gmail.com |
d4c3c3b98e0bb6908fe0a4e236cf003f387d3f13 | d3d7e7c9f3342f524f4a49295fafd3193888d59c | /db-service/src/main/java/com/github/johan/backstrom/Application.java | aaa9069beaba593a0629acd89736d9958e9a86a5 | [] | no_license | johan-backstrom/docker-workshop | 60f0946c2a630b77e518f83cbee484f805115944 | 17daf16d82bab284812d77033186860a9bf9eb29 | refs/heads/master | 2020-06-17T13:18:58.637087 | 2019-03-13T13:45:15 | 2019-03-13T13:45:15 | 75,004,882 | 2 | 3 | null | null | null | null | UTF-8 | Java | false | false | 383 | java | package com.github.johan.backstrom;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Application {
public static void main(String[] args) throws Exception {
Class.forName("org.postgresql.Driver");
SpringApplication.run(Application.class, args);
}
} | [
"johan.backstrom@bisnode.com"
] | johan.backstrom@bisnode.com |
ec920a5368adc083a0f8ee21dd095f653f1016ae | 17608fc8d3baa317a7667aac3027daef848d743b | /OOPS/Inheritance/Student.java | 326c6307d07b55ee15456c6d72732581eb071d9f | [] | no_license | chaitanyakulkarni21/JAVA | 48ddf3158d0acd20dc5616f5464462c1867ceace | ce08c364bec0a61d4b2bd587450e0bf078e294b9 | refs/heads/main | 2021-12-23T16:01:47.602183 | 2021-07-21T09:22:07 | 2021-07-21T09:22:07 | 249,199,663 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,307 | java | // Program to print Student information using Inheritance
import java.util.Scanner;
class Person {
protected String personName;
protected int personAge;
protected String personInstName;
void setInfo(String name, int age, String instName){
this.personAge = age;
this.personName = name;
this.personInstName = instName;
}
}
public class Student extends Person{
private int passingYear;
void setPassingYear(int year){
this.passingYear = year;
}
void getInfo(){
System.out.println("\nName: " + personName);
System.out.println("Age: " + personAge);
System.out.println("Institution Name: " + personInstName);
System.out.println("Year of Passing: " + passingYear);
}
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
Student st = new Student();
System.out.println("Enter Student name: ");
st.personName = sc.nextLine();
System.out.println("Enter Institution Name: ");
st.personInstName = sc.nextLine();
System.out.println("Enter Student Age: ");
st.personAge = sc.nextInt();
System.out.println("Enter Year of Passing: ");
st.passingYear = sc.nextInt();
st.setInfo(st.personName, st.personAge, st.personInstName);
st.setPassingYear(st.passingYear);
st.getInfo();
}
} | [
"chaitanyapk21@gmail.com"
] | chaitanyapk21@gmail.com |
6000d0cf112004c6764e75d8e47ae85a2baa9748 | 1258c238eaeb78b0fe88919bd063e9f37abc801e | /Visitor/src/visitor/EquiparArma.java | 4876ed9a36a0b16bd872a60eecefbf8c27eb98a0 | [] | no_license | manuelprogram/Parttern-Desing | 61779ec35e42f18d62ca5700d8bcc9a609817d53 | 5fe84951e07cb3206bdadf1c0052a75255a9e1a3 | refs/heads/master | 2021-05-15T11:11:05.883297 | 2017-10-10T21:27:02 | 2017-10-10T21:27:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 733 | 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 visitor;
import java.util.List;
/**
*
* @author manue
*/
public class EquiparArma implements IVisitor{
@Override
public void visit( Mago m )
{
m.setArma("DAGA");
}
// ------------------------------
@Override
public void visit( Guerrero g )
{
g.setArma("ESPADA");
}
// ------------------------------
@Override
public void visit( List<IPersonaje> personajes )
{
for( IPersonaje p : personajes )
{
p.accept(this);
}
}
}
| [
"man.hernandez@udla.edu.co"
] | man.hernandez@udla.edu.co |
58460f531f69ceda8ce88d4b4b9a8dec2f6e6787 | 40f9f3904fc3497cca37ac4f8a20ed97a35d0c63 | /تمرین 2/employeeServlet/src/main/java/ir/maktab/employeeServlet/filters/SaveFilter.java | 7db7b4079034a27fd1dd139862b73e573529562a | [] | no_license | M-Mosaiebzadeh/bus-terminal-servlet | 59b2fb02ae0204c8853867e117785edd0fd0a1e8 | 8e3d2a5ba4a2a977ff09de1b0dae462b43f9d089 | refs/heads/master | 2023-02-26T01:19:06.314567 | 2021-01-27T19:56:43 | 2021-01-27T19:56:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,425 | java | package ir.maktab.employeeServlet.filters;
import ir.maktab.employeeServlet.entities.Employee;
import javax.persistence.EntityManager;
import javax.persistence.TypedQuery;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root;
import javax.servlet.*;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
import static ir.maktab.employeeServlet.util.EntityManagerFactoryUtil.*;
public class SaveFilter implements Filter {
@Override
public void init(FilterConfig filterConfig) throws ServletException {
}
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
servletResponse.setContentType("text/html");
EntityManager entityManager = createEntityManagerFactory().createEntityManager();
PrintWriter out = servletResponse.getWriter();
// entityManager.getTransaction().begin();
String firstname = servletRequest.getParameter("firstname");
String lastname = servletRequest.getParameter("lastname");
String email = servletRequest.getParameter("email");
CriteriaBuilder builder = entityManager.getCriteriaBuilder();
CriteriaQuery<Employee> query = builder.createQuery(Employee.class);
Root<Employee> fromEmployee = query.from(Employee.class);
query.select(fromEmployee).where(builder.and(
builder.and(
builder.equal(fromEmployee.get("firstname"),firstname),
builder.equal(fromEmployee.get("lastname"),lastname)
),
builder.equal(fromEmployee.get("email"),email)
));
TypedQuery<Employee> typedQuery = entityManager.createQuery(query);
List<Employee> employee = typedQuery.getResultList();
if (employee.size() == 0){
filterChain.doFilter(servletRequest,servletResponse);
}
else {
out.println("<center");
out.println("<p style='font-size:40px;color:red;'>");
out.println("This Person now exist");
out.println("</p></center>");
servletRequest.getRequestDispatcher("save.html").include(servletRequest,servletResponse);
}
}
@Override
public void destroy() {
}
}
| [
"M_Mosaiebzadeh@yahoo.com"
] | M_Mosaiebzadeh@yahoo.com |
557cf147aa13e6e86fbb19866100bf2eab79cf3e | 09f035453f5fdcce7c0f66d9b6750dcf5ddc0e90 | /src/main/java/com/caw/math/group/AbelianGroupElement.java | 676b202e8106d35655ab98ea47340d62c311ad52 | [
"MIT"
] | permissive | charliewhitmore28/mathstructures | 60bf82c0412b4da4c159bcae5d6073850434b9a9 | 152c8800c13a08e0cc29c2942038340543a9e44d | refs/heads/master | 2023-05-05T05:15:13.805882 | 2021-05-20T00:06:38 | 2021-05-20T00:06:38 | 368,933,258 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 211 | java | package com.caw.math.group;
/**
* An extension of a {@link GroupElement} that is a member of an {@link AbelianGroup}.
*
* @author cwhitmore
*/
public interface AbelianGroupElement extends GroupElement {
}
| [
"charliewhitmore28@gmail.com"
] | charliewhitmore28@gmail.com |
c31a11df786ff7e55df2d203f3e7eef61124999a | 287d6d170530a04bff9f80460125993cb8c506b1 | /tl/src/main/java/com/github/badoualy/telegram/tl/api/TLUpdateBotCallbackQuery.java | 66c96844cb53da47d613882237e9130562278dda | [
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
] | permissive | thecodrr/kotlogram | c72fb8f81a422d5c3d067ef194faab6e20861d30 | dc692348229fed14b738f376f7a3af2c474e5737 | refs/heads/master | 2020-07-30T00:14:07.740929 | 2017-01-06T07:19:09 | 2017-01-06T07:19:09 | 210,013,661 | 0 | 0 | MIT | 2019-09-21T16:00:26 | 2019-09-21T16:00:25 | null | UTF-8 | Java | false | false | 5,688 | java | package com.github.badoualy.telegram.tl.api;
import com.github.badoualy.telegram.tl.TLContext;
import com.github.badoualy.telegram.tl.core.TLBytes;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import static com.github.badoualy.telegram.tl.StreamUtils.readInt;
import static com.github.badoualy.telegram.tl.StreamUtils.readLong;
import static com.github.badoualy.telegram.tl.StreamUtils.readTLBytes;
import static com.github.badoualy.telegram.tl.StreamUtils.readTLObject;
import static com.github.badoualy.telegram.tl.StreamUtils.readTLString;
import static com.github.badoualy.telegram.tl.StreamUtils.writeInt;
import static com.github.badoualy.telegram.tl.StreamUtils.writeLong;
import static com.github.badoualy.telegram.tl.StreamUtils.writeString;
import static com.github.badoualy.telegram.tl.StreamUtils.writeTLBytes;
import static com.github.badoualy.telegram.tl.StreamUtils.writeTLObject;
import static com.github.badoualy.telegram.tl.TLObjectUtils.SIZE_CONSTRUCTOR_ID;
import static com.github.badoualy.telegram.tl.TLObjectUtils.SIZE_INT32;
import static com.github.badoualy.telegram.tl.TLObjectUtils.SIZE_INT64;
import static com.github.badoualy.telegram.tl.TLObjectUtils.computeTLBytesSerializedSize;
import static com.github.badoualy.telegram.tl.TLObjectUtils.computeTLStringSerializedSize;
/**
* @author Yannick Badoual yann.badoual@gmail.com
* @see <a href="http://github.com/badoualy/kotlogram">http://github.com/badoualy/kotlogram</a>
*/
public class TLUpdateBotCallbackQuery extends TLAbsUpdate {
public static final int CONSTRUCTOR_ID = 0xe73547e1;
protected int flags;
protected long queryId;
protected int userId;
protected TLAbsPeer peer;
protected int msgId;
protected long chatInstance;
protected TLBytes data;
protected String gameShortName;
private final String _constructor = "updateBotCallbackQuery#e73547e1";
public TLUpdateBotCallbackQuery() {
}
public TLUpdateBotCallbackQuery(long queryId, int userId, TLAbsPeer peer, int msgId, long chatInstance, TLBytes data, String gameShortName) {
this.queryId = queryId;
this.userId = userId;
this.peer = peer;
this.msgId = msgId;
this.chatInstance = chatInstance;
this.data = data;
this.gameShortName = gameShortName;
}
private void computeFlags() {
flags = 0;
flags = data != null ? (flags | 1) : (flags & ~1);
flags = gameShortName != null ? (flags | 2) : (flags & ~2);
}
@Override
public void serializeBody(OutputStream stream) throws IOException {
computeFlags();
writeInt(flags, stream);
writeLong(queryId, stream);
writeInt(userId, stream);
writeTLObject(peer, stream);
writeInt(msgId, stream);
writeLong(chatInstance, stream);
if ((flags & 1) != 0) {
if (data == null) throwNullFieldException("data", flags);
writeTLBytes(data, stream);
}
if ((flags & 2) != 0) {
if (gameShortName == null) throwNullFieldException("gameShortName", flags);
writeString(gameShortName, stream);
}
}
@Override
@SuppressWarnings({"unchecked", "SimplifiableConditionalExpression"})
public void deserializeBody(InputStream stream, TLContext context) throws IOException {
flags = readInt(stream);
queryId = readLong(stream);
userId = readInt(stream);
peer = readTLObject(stream, context, TLAbsPeer.class, -1);
msgId = readInt(stream);
chatInstance = readLong(stream);
data = (flags & 1) != 0 ? readTLBytes(stream, context) : null;
gameShortName = (flags & 2) != 0 ? readTLString(stream) : null;
}
@Override
public int computeSerializedSize() {
computeFlags();
int size = SIZE_CONSTRUCTOR_ID;
size += SIZE_INT32;
size += SIZE_INT64;
size += SIZE_INT32;
size += peer.computeSerializedSize();
size += SIZE_INT32;
size += SIZE_INT64;
if ((flags & 1) != 0) {
if (data == null) throwNullFieldException("data", flags);
size += computeTLBytesSerializedSize(data);
}
if ((flags & 2) != 0) {
if (gameShortName == null) throwNullFieldException("gameShortName", flags);
size += computeTLStringSerializedSize(gameShortName);
}
return size;
}
@Override
public String toString() {
return _constructor;
}
@Override
public int getConstructorId() {
return CONSTRUCTOR_ID;
}
public long getQueryId() {
return queryId;
}
public void setQueryId(long queryId) {
this.queryId = queryId;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public TLAbsPeer getPeer() {
return peer;
}
public void setPeer(TLAbsPeer peer) {
this.peer = peer;
}
public int getMsgId() {
return msgId;
}
public void setMsgId(int msgId) {
this.msgId = msgId;
}
public long getChatInstance() {
return chatInstance;
}
public void setChatInstance(long chatInstance) {
this.chatInstance = chatInstance;
}
public TLBytes getData() {
return data;
}
public void setData(TLBytes data) {
this.data = data;
}
public String getGameShortName() {
return gameShortName;
}
public void setGameShortName(String gameShortName) {
this.gameShortName = gameShortName;
}
}
| [
"yann.badoual@gmail.com"
] | yann.badoual@gmail.com |
2376b143eff91bb72b9af8ed210ec27c4186477d | 8329acfadb93d99aa22756159cc75e185aa52dd6 | /src/main/java/com/futurell/test/Test.java | 2ad5230fd4d592d320136f001742f76ecd14f82b | [] | no_license | FutureLL/SpringAop | 9f6e52cdfbe3f5a866e322b1d5f3c687d2413159 | bdc91cbe6ff4813f6820cf17d51d7d28f3a86b2c | refs/heads/master | 2022-11-05T13:30:39.982517 | 2020-07-03T04:23:43 | 2020-07-03T04:23:43 | 276,806,354 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,231 | java | package com.futurell.test;
import com.futurell.app.Appconfig;
import com.futurell.dao.Dao;
import com.futurell.dao.IndexDao;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import java.lang.reflect.Proxy;
/**
* @description:
* @author: Mr.Li
* @date: Created in 2020/6/29 17:14
* @version: 1.0
* @modified By:
*
* 问: JDK动态代理为什么只能基于接口
* 答: JDK底层源码已经帮代理对象自动继承了Proxy这个类,由于Java是单继承语法,所以不可能再去继承目标对象,只能去实现目标对象
*/
public class Test {
public static void main(String[] args) {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(Appconfig.class);
// 此时目标对象为IndexDao,代理对象为Dao
// this: 当前对象,也就是代理对象
// target: 目标对象
Dao dao = (Dao) context.getBean("indexDao");
// System.out.println(dao instanceof IndexDao);
// System.out.println(dao instanceof Proxy);
dao.query("query");
// 测试@DeclareParents注解
// Dao dao = (Dao) context.getBean("orderDao");
// dao.query("orderDao");
}
}
| [
"13186102535@163.com"
] | 13186102535@163.com |
62fc68a574fca4a4b6fd6cc2c5e087fdd48dea96 | d805bffd66b1a86013e12f6b25b5f56ffe939135 | /src/main/java/com/kardex/core/controller/KardexController.java | 97288e6075d3af4c0a5374fd180e95e458222e57 | [] | no_license | pcaicedoCidenet/repositorioKardex | 9414243d0b59324a30797f3f2aa2c62e970fa756 | 48c6215379481e27a11e1a4b20dbd61465a656ea | refs/heads/master | 2022-06-22T17:19:57.145242 | 2019-09-02T20:21:37 | 2019-09-02T20:21:37 | 205,927,691 | 0 | 0 | null | 2022-06-21T01:47:57 | 2019-09-02T19:58:45 | JavaScript | UTF-8 | Java | false | false | 1,992 | java | package com.kardex.core.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.kardex.core.model.Product;
import com.kardex.core.services.ProductService;
@Controller
public class KardexController {
@Autowired
private ProductService productRepository;
@RequestMapping("/")
public ModelAndView home() {
ModelAndView modelAndView = new ModelAndView("index");
modelAndView.addObject("producto", this.productRepository.findAll());
return modelAndView;
}
@GetMapping("/findById")
@ResponseBody
public Product findProduct(@RequestParam int id) {
return this.productRepository.findById(id);
}
@PostMapping("/update")
public String update(@RequestParam int id, @RequestParam String name, @RequestParam int price, @RequestParam String category) {
Product product = productRepository.findById(id);
product.setPRODUCTNAME(name);
product.setPRODUCTPRICE(price);
product.setPRODUCTCATEGORY(category);
productRepository.update(product);
return "redirect:/";
}
@PostMapping("/new")
public String newProduct(@RequestParam String name, @RequestParam int price, @RequestParam String category) {
Product product = new Product();
product.setPRODUCTNAME(name);
product.setPRODUCTPRICE(price);
product.setPRODUCTCATEGORY(category);
productRepository.save(product);
return "redirect:/";
}
@GetMapping("/sell")
public String sellById(@RequestParam int id) {
productRepository.deleteById(id);
return "redirect:/";
}
}
| [
"pcaicedo@cidenet.com.co"
] | pcaicedo@cidenet.com.co |
b3d739e089a2aa92d5a90bd627ea0aa4c2992c22 | baa4dea7c32224fd5b92a242146e054807e5eed1 | /src/gen-java/com/cloudera/flume/conf/thrift/FlumeMasterCommandThrift.java | 8b9176637647f7e7a95132e139d07f54d4a9a98d | [
"Apache-2.0"
] | permissive | yongkun/flume-0.9.3-cdh3u0-rakuten | be35e8298466cf3331031f6df49dca70218a434d | 967013f5f16801249f583c6c013c7afe04e0af83 | refs/heads/master | 2021-01-10T21:04:27.426936 | 2014-08-03T14:54:16 | 2014-08-03T14:54:16 | 8,926,058 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | true | 13,174 | java | /**
* Autogenerated by Thrift Compiler (0.7.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
*/
package com.cloudera.flume.conf.thrift;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class FlumeMasterCommandThrift implements org.apache.thrift.TBase<FlumeMasterCommandThrift, FlumeMasterCommandThrift._Fields>, java.io.Serializable, Cloneable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("FlumeMasterCommandThrift");
private static final org.apache.thrift.protocol.TField COMMAND_FIELD_DESC = new org.apache.thrift.protocol.TField("command", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.thrift.protocol.TField ARGUMENTS_FIELD_DESC = new org.apache.thrift.protocol.TField("arguments", org.apache.thrift.protocol.TType.LIST, (short)2);
public String command; // required
public List<String> arguments; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
COMMAND((short)1, "command"),
ARGUMENTS((short)2, "arguments");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // COMMAND
return COMMAND;
case 2: // ARGUMENTS
return ARGUMENTS;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.COMMAND, new org.apache.thrift.meta_data.FieldMetaData("command", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.ARGUMENTS, new org.apache.thrift.meta_data.FieldMetaData("arguments", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(FlumeMasterCommandThrift.class, metaDataMap);
}
public FlumeMasterCommandThrift() {
}
public FlumeMasterCommandThrift(
String command,
List<String> arguments)
{
this();
this.command = command;
this.arguments = arguments;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public FlumeMasterCommandThrift(FlumeMasterCommandThrift other) {
if (other.isSetCommand()) {
this.command = other.command;
}
if (other.isSetArguments()) {
List<String> __this__arguments = new ArrayList<String>();
for (String other_element : other.arguments) {
__this__arguments.add(other_element);
}
this.arguments = __this__arguments;
}
}
public FlumeMasterCommandThrift deepCopy() {
return new FlumeMasterCommandThrift(this);
}
@Override
public void clear() {
this.command = null;
this.arguments = null;
}
public String getCommand() {
return this.command;
}
public FlumeMasterCommandThrift setCommand(String command) {
this.command = command;
return this;
}
public void unsetCommand() {
this.command = null;
}
/** Returns true if field command is set (has been assigned a value) and false otherwise */
public boolean isSetCommand() {
return this.command != null;
}
public void setCommandIsSet(boolean value) {
if (!value) {
this.command = null;
}
}
public int getArgumentsSize() {
return (this.arguments == null) ? 0 : this.arguments.size();
}
public java.util.Iterator<String> getArgumentsIterator() {
return (this.arguments == null) ? null : this.arguments.iterator();
}
public void addToArguments(String elem) {
if (this.arguments == null) {
this.arguments = new ArrayList<String>();
}
this.arguments.add(elem);
}
public List<String> getArguments() {
return this.arguments;
}
public FlumeMasterCommandThrift setArguments(List<String> arguments) {
this.arguments = arguments;
return this;
}
public void unsetArguments() {
this.arguments = null;
}
/** Returns true if field arguments is set (has been assigned a value) and false otherwise */
public boolean isSetArguments() {
return this.arguments != null;
}
public void setArgumentsIsSet(boolean value) {
if (!value) {
this.arguments = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case COMMAND:
if (value == null) {
unsetCommand();
} else {
setCommand((String)value);
}
break;
case ARGUMENTS:
if (value == null) {
unsetArguments();
} else {
setArguments((List<String>)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case COMMAND:
return getCommand();
case ARGUMENTS:
return getArguments();
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case COMMAND:
return isSetCommand();
case ARGUMENTS:
return isSetArguments();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof FlumeMasterCommandThrift)
return this.equals((FlumeMasterCommandThrift)that);
return false;
}
public boolean equals(FlumeMasterCommandThrift that) {
if (that == null)
return false;
boolean this_present_command = true && this.isSetCommand();
boolean that_present_command = true && that.isSetCommand();
if (this_present_command || that_present_command) {
if (!(this_present_command && that_present_command))
return false;
if (!this.command.equals(that.command))
return false;
}
boolean this_present_arguments = true && this.isSetArguments();
boolean that_present_arguments = true && that.isSetArguments();
if (this_present_arguments || that_present_arguments) {
if (!(this_present_arguments && that_present_arguments))
return false;
if (!this.arguments.equals(that.arguments))
return false;
}
return true;
}
@Override
public int hashCode() {
return 0;
}
public int compareTo(FlumeMasterCommandThrift other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
FlumeMasterCommandThrift typedOther = (FlumeMasterCommandThrift)other;
lastComparison = Boolean.valueOf(isSetCommand()).compareTo(typedOther.isSetCommand());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetCommand()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.command, typedOther.command);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetArguments()).compareTo(typedOther.isSetArguments());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetArguments()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.arguments, typedOther.arguments);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField field;
iprot.readStructBegin();
while (true)
{
field = iprot.readFieldBegin();
if (field.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (field.id) {
case 1: // COMMAND
if (field.type == org.apache.thrift.protocol.TType.STRING) {
this.command = iprot.readString();
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
break;
case 2: // ARGUMENTS
if (field.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
this.arguments = new ArrayList<String>(_list0.size);
for (int _i1 = 0; _i1 < _list0.size; ++_i1)
{
String _elem2; // required
_elem2 = iprot.readString();
this.arguments.add(_elem2);
}
iprot.readListEnd();
}
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
validate();
oprot.writeStructBegin(STRUCT_DESC);
if (this.command != null) {
oprot.writeFieldBegin(COMMAND_FIELD_DESC);
oprot.writeString(this.command);
oprot.writeFieldEnd();
}
if (this.arguments != null) {
oprot.writeFieldBegin(ARGUMENTS_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, this.arguments.size()));
for (String _iter3 : this.arguments)
{
oprot.writeString(_iter3);
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("FlumeMasterCommandThrift(");
boolean first = true;
sb.append("command:");
if (this.command == null) {
sb.append("null");
} else {
sb.append(this.command);
}
first = false;
if (!first) sb.append(", ");
sb.append("arguments:");
if (this.arguments == null) {
sb.append("null");
} else {
sb.append(this.arguments);
}
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
}
| [
"yongkun.wang@mail.rakuten.com"
] | yongkun.wang@mail.rakuten.com |
f12d9873833466b039f74abfea9852ab51410b97 | 037e4f7e212b99bc4d6bf6975171727f94c3e87a | /src/main/java/com/kaleido/klinops/service/ShipmentService.java | bed9f9998551413bfddbe52d8fb762c5932bfe54 | [
"BSD-3-Clause"
] | permissive | Kaleido-Biosciences/klinops | bdf40bea256e1082f0d95364a8855ec02502cbcb | f7a725d43302e33158a43fd36de6859906d986de | refs/heads/master | 2022-12-21T14:44:50.709608 | 2019-12-23T14:11:48 | 2019-12-23T14:11:48 | 228,701,746 | 0 | 0 | BSD-3-Clause | 2022-12-16T05:06:41 | 2019-12-17T21:07:16 | Java | UTF-8 | Java | false | false | 2,953 | java | package com.kaleido.klinops.service;
import com.kaleido.klinops.domain.Shipment;
import com.kaleido.klinops.repository.ShipmentRepository;
import com.kaleido.klinops.repository.search.ShipmentSearchRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Optional;
import static org.elasticsearch.index.query.QueryBuilders.*;
/**
* Service Implementation for managing {@link Shipment}.
*/
@Service
@Transactional
public class ShipmentService {
private final Logger log = LoggerFactory.getLogger(ShipmentService.class);
private final ShipmentRepository shipmentRepository;
private final ShipmentSearchRepository shipmentSearchRepository;
public ShipmentService(ShipmentRepository shipmentRepository, ShipmentSearchRepository shipmentSearchRepository) {
this.shipmentRepository = shipmentRepository;
this.shipmentSearchRepository = shipmentSearchRepository;
}
/**
* Save a shipment.
*
* @param shipment the entity to save.
* @return the persisted entity.
*/
public Shipment save(Shipment shipment) {
log.debug("Request to save Shipment : {}", shipment);
Shipment result = shipmentRepository.save(shipment);
shipmentSearchRepository.save(result);
return result;
}
/**
* Get all the shipments.
*
* @param pageable the pagination information.
* @return the list of entities.
*/
@Transactional(readOnly = true)
public Page<Shipment> findAll(Pageable pageable) {
log.debug("Request to get all Shipments");
return shipmentRepository.findAll(pageable);
}
/**
* Get one shipment by id.
*
* @param id the id of the entity.
* @return the entity.
*/
@Transactional(readOnly = true)
public Optional<Shipment> findOne(Long id) {
log.debug("Request to get Shipment : {}", id);
return shipmentRepository.findById(id);
}
/**
* Delete the shipment by id.
*
* @param id the id of the entity.
*/
public void delete(Long id) {
log.debug("Request to delete Shipment : {}", id);
shipmentRepository.deleteById(id);
shipmentSearchRepository.deleteById(id);
}
/**
* Search for the shipment corresponding to the query.
*
* @param query the query of the search.
* @param pageable the pagination information.
* @return the list of entities.
*/
@Transactional(readOnly = true)
public Page<Shipment> search(String query, Pageable pageable) {
log.debug("Request to search for a page of Shipments for query {}", query);
return shipmentSearchRepository.search(queryStringQuery(query), pageable); }
}
| [
"mark.schreiber@kaleido.com"
] | mark.schreiber@kaleido.com |
7d990a92ba63e32b6e5142e0236bc9e17e694248 | b4893f54e524d61c6035ffd70804ca2d7537a2b7 | /deps/lib/code/google/pojomvcc/CacheExpiry.java | c0608194d67b8c2e8384f0dd039e4ba32ead5f49 | [] | no_license | lzimm/vurs | 96553ed5a54359699e4dc44eed062048ba7e7ce3 | 8e9c035538ff27f5368359f177ec37cb3700d1ba | refs/heads/master | 2021-01-01T05:33:24.743946 | 2012-12-07T04:11:23 | 2012-12-07T04:11:23 | 7,047,447 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,468 | java | package code.google.pojomvcc;
/**
* A {@code CacheExpiry} dictates how long revision history (tracked as a {@link CacheElementRevision})
* should be kept in the {@code code.google.pojomvcc.RootObjectCache}. Once the {@link CacheExpiryPolicy}
* has determined that a {@link CacheElementRevision} should no longer be kept an optional
* {@code code.google.pojomvcc.CacheExpirationHandler} can be used to keep the {@link CacheElementRevision}
* somewhere else.
*
* @author Aidan Morgan
*/
public class CacheExpiry<K, V> {
/**
* The default {@link CacheExpiry} to use
*/
public static <K, V> CacheExpiry<K, V> DEFAULT() {
return new CacheExpiry<K, V>(CacheExpiryPolicy.<K,V>NO_LONGER_USED());
}
/**
* The {@link CacheExpiryPolicy} to use.
*/
private CacheExpiryPolicy<K, V> policy;
/**
* The {@link CacheExpirationHandler} to use, defaults to {@link CacheExpiry.NoOpCacheExpirationHandler}.
*/
private CacheExpirationHandler<K, V> handler = new NoOpCacheExpirationHandler<K, V>();
/**
* Creates a new {@link CacheExpiry} with a no-op {@link CacheExpirationHandler}
* handler.
*
* @param policy The cache expiration policy.
*/
public CacheExpiry(CacheExpiryPolicy<K, V> policy) {
this.policy = policy;
}
/**
* Creates a new {@link CacheExpiry} with the provided {@link CacheExpiryPolicy}
* and the provided {@link CacheExpirationHandler}.
*
* @param policy The cache expiration policy.
* @param handler The expiration handler.
*/
public CacheExpiry(CacheExpiryPolicy<K, V> policy, CacheExpirationHandler<K, V> handler) {
this.policy = policy;
this.handler = handler;
}
/**
* Returns the cache's expiration policy.
*
* @return The expiration policy.
*/
public CacheExpiryPolicy<K, V> getPolicy() {
return policy;
}
/**
* Returns the cache's expiration handler.
*
* @return The cache's expiration handler.
*/
public CacheExpirationHandler<K, V> getHandler() {
return handler;
}
/**
* A no-op implementation of {@link CacheExpirationHandler}.
*/
private static class NoOpCacheExpirationHandler<K, V> implements CacheExpirationHandler<K, V> {
public void expired(RevisionKeyList<K> rev) {
// No-op
}
public CacheElementRevision<K, V> retrieve(K key, long revision) {
return null; // No-op
}
}
}
| [
"lewis@lzimm.com"
] | lewis@lzimm.com |
e328bc9d2b4b697c1390c9ce3884ec264a0c4e80 | a09c6ecac5fc9956dd5d974db90a4f05d6dd8ed4 | /easytravel-users-manager/src/main/java/com/armandorv/easytravel/usersmanager/view/util/UsersListModel.java | 7e1120c6b2d673d0773c2731263dc6b6f60bed17 | [] | no_license | vs70/easytravel | 7c843b7604ebdfb93f39b4ea36d7dfe47032242a | 5b2efe142fe7196f3d916942491a11ee70b2eb27 | refs/heads/master | 2021-01-18T00:10:53.260476 | 2014-03-15T21:45:16 | 2014-03-15T21:45:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 854 | java | package com.armandorv.easytravel.usersmanager.view.util;
import java.util.List;
import javax.swing.ListModel;
import javax.swing.event.ListDataListener;
import com.armandorv.easytravel.userswsclient.model.UserDetails;
/**
* Swing list model for a list users.
*
* @author armandorv
*
*/
public class UsersListModel implements ListModel<UserDetails>
{
private List<UserDetails> users;
public UsersListModel(List<UserDetails> users)
{
super();
this.users = users;
}
@Override
public int getSize()
{
return users.size();
}
@Override
public UserDetails getElementAt(int index)
{
return users.get(index);
}
@Override
public void addListDataListener(ListDataListener l)
{
}
@Override
public void removeListDataListener(ListDataListener l)
{
}
}
| [
"armando.ramirez.vila@gmail.com"
] | armando.ramirez.vila@gmail.com |
01bfe059567e965e4c9d0bf82da8c3e8d2813c42 | baf3065415d8128700f16b4ea353855d27c8fe3c | /OcrDemo/app/src/main/java/com/ocrdemo/IDCardActivity.java | 4c30f4b6182de1482d00d5d9cbf016fdad81922e | [] | no_license | DoubleLinnn/OcrDemo | acf750d6a1fa1302c6560af3e97cd6f3f8378ceb | 00bfedb731a63be11f2e4a750e90b63adb15361b | refs/heads/master | 2020-04-01T09:17:08.256066 | 2018-10-15T07:12:15 | 2018-10-15T07:12:15 | 153,068,568 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,117 | java | /*
* Copyright (C) 2017 Baidu, Inc. All Rights Reserved.
*/
package com.ocrdemo;
import java.io.File;
import com.baidu.ocr.sdk.OCR;
import com.baidu.ocr.sdk.OnResultListener;
import com.baidu.ocr.sdk.exception.OCRError;
import com.baidu.ocr.sdk.model.IDCardParams;
import com.baidu.ocr.sdk.model.IDCardResult;
import com.baidu.ocr.ui.camera.CameraActivity;
import com.baidu.ocr.ui.camera.CameraNativeHelper;
import com.baidu.ocr.ui.camera.CameraView;
import android.Manifest;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;
public class IDCardActivity extends AppCompatActivity {
private static final int REQUEST_CODE_PICK_IMAGE_FRONT = 201;
private static final int REQUEST_CODE_PICK_IMAGE_BACK = 202;
private static final int REQUEST_CODE_CAMERA = 102;
private TextView infoTextView;
private AlertDialog.Builder alertDialog;
private boolean checkGalleryPermission() {
int ret = ActivityCompat.checkSelfPermission(IDCardActivity.this, Manifest.permission
.READ_EXTERNAL_STORAGE);
if (ret != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(IDCardActivity.this,
new String[] {Manifest.permission.READ_EXTERNAL_STORAGE},
1000);
return false;
}
return true;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_idcard);
alertDialog = new AlertDialog.Builder(this);
infoTextView = (TextView) findViewById(R.id.info_text_view);
// 初始化本地质量控制模型,释放代码在onDestory中
// 调用身份证扫描必须加上 intent.putExtra(CameraActivity.KEY_NATIVE_MANUAL, true); 关闭自动初始化和释放本地模型
CameraNativeHelper.init(this, OCR.getInstance(this).getLicense(),
new CameraNativeHelper.CameraNativeInitCallback() {
@Override
public void onError(int errorCode, Throwable e) {
String msg;
switch (errorCode) {
case CameraView.NATIVE_SOLOAD_FAIL:
msg = "加载so失败,请确保apk中存在ui部分的so";
break;
case CameraView.NATIVE_AUTH_FAIL:
msg = "授权本地质量控制token获取失败";
break;
case CameraView.NATIVE_INIT_FAIL:
msg = "本地质量控制";
break;
default:
msg = String.valueOf(errorCode);
}
infoTextView.setText("本地质量控制初始化错误,错误原因: " + msg);
}
});
findViewById(R.id.gallery_button_front).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (checkGalleryPermission()) {
Intent intent = new Intent(Intent.ACTION_PICK);
intent.setType("image/*");
startActivityForResult(intent, REQUEST_CODE_PICK_IMAGE_FRONT);
}
}
});
findViewById(R.id.gallery_button_back).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (checkGalleryPermission()) {
Intent intent = new Intent(Intent.ACTION_PICK);
intent.setType("image/*");
startActivityForResult(intent, REQUEST_CODE_PICK_IMAGE_BACK);
}
}
});
// 身份证正面拍照
findViewById(R.id.id_card_front_button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(IDCardActivity.this, CameraActivity.class);
intent.putExtra(CameraActivity.KEY_OUTPUT_FILE_PATH,
FileUtil.getSaveFile(getApplication()).getAbsolutePath());
intent.putExtra(CameraActivity.KEY_CONTENT_TYPE, CameraActivity.CONTENT_TYPE_ID_CARD_FRONT);
startActivityForResult(intent, REQUEST_CODE_CAMERA);
}
});
// 身份证正面扫描
findViewById(R.id.id_card_front_button_native).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(IDCardActivity.this, CameraActivity.class);
intent.putExtra(CameraActivity.KEY_OUTPUT_FILE_PATH,
FileUtil.getSaveFile(getApplication()).getAbsolutePath());
intent.putExtra(CameraActivity.KEY_NATIVE_ENABLE,
true);
// KEY_NATIVE_MANUAL设置了之后CameraActivity中不再自动初始化和释放模型
// 请手动使用CameraNativeHelper初始化和释放模型
// 推荐这样做,可以避免一些activity切换导致的不必要的异常
intent.putExtra(CameraActivity.KEY_NATIVE_MANUAL,
true);
intent.putExtra(CameraActivity.KEY_CONTENT_TYPE, CameraActivity.CONTENT_TYPE_ID_CARD_FRONT);
startActivityForResult(intent, REQUEST_CODE_CAMERA);
}
});
// 身份证反面拍照
findViewById(R.id.id_card_back_button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(IDCardActivity.this, CameraActivity.class);
intent.putExtra(CameraActivity.KEY_OUTPUT_FILE_PATH,
FileUtil.getSaveFile(getApplication()).getAbsolutePath());
intent.putExtra(CameraActivity.KEY_CONTENT_TYPE, CameraActivity.CONTENT_TYPE_ID_CARD_BACK);
startActivityForResult(intent, REQUEST_CODE_CAMERA);
}
});
// 身份证反面扫描
findViewById(R.id.id_card_back_button_native).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(IDCardActivity.this, CameraActivity.class);
intent.putExtra(CameraActivity.KEY_OUTPUT_FILE_PATH,
FileUtil.getSaveFile(getApplication()).getAbsolutePath());
intent.putExtra(CameraActivity.KEY_NATIVE_ENABLE,
true);
// KEY_NATIVE_MANUAL设置了之后CameraActivity中不再自动初始化和释放模型
// 请手动使用CameraNativeHelper初始化和释放模型
// 推荐这样做,可以避免一些activity切换导致的不必要的异常
intent.putExtra(CameraActivity.KEY_NATIVE_MANUAL,
true);
intent.putExtra(CameraActivity.KEY_CONTENT_TYPE, CameraActivity.CONTENT_TYPE_ID_CARD_BACK);
startActivityForResult(intent, REQUEST_CODE_CAMERA);
}
});
}
private void recIDCard(String idCardSide, String filePath) {
IDCardParams param = new IDCardParams();
param.setImageFile(new File(filePath));
// 设置身份证正反面
param.setIdCardSide(idCardSide);
// 设置方向检测
param.setDetectDirection(true);
// 设置图像参数压缩质量0-100, 越大图像质量越好但是请求时间越长。 不设置则默认值为20
param.setImageQuality(20);
OCR.getInstance(this).recognizeIDCard(param, new OnResultListener<IDCardResult>() {
@Override
public void onResult(IDCardResult result) {
if (result != null) {
alertText("", result.toString());
}
}
@Override
public void onError(OCRError error) {
alertText("", error.getMessage());
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_CODE_PICK_IMAGE_FRONT && resultCode == Activity.RESULT_OK) {
Uri uri = data.getData();
String filePath = getRealPathFromURI(uri);
recIDCard(IDCardParams.ID_CARD_SIDE_FRONT, filePath);
}
if (requestCode == REQUEST_CODE_PICK_IMAGE_BACK && resultCode == Activity.RESULT_OK) {
Uri uri = data.getData();
String filePath = getRealPathFromURI(uri);
recIDCard(IDCardParams.ID_CARD_SIDE_BACK, filePath);
}
if (requestCode == REQUEST_CODE_CAMERA && resultCode == Activity.RESULT_OK) {
if (data != null) {
String contentType = data.getStringExtra(CameraActivity.KEY_CONTENT_TYPE);
String filePath = FileUtil.getSaveFile(getApplicationContext()).getAbsolutePath();
if (!TextUtils.isEmpty(contentType)) {
if (CameraActivity.CONTENT_TYPE_ID_CARD_FRONT.equals(contentType)) {
recIDCard(IDCardParams.ID_CARD_SIDE_FRONT, filePath);
} else if (CameraActivity.CONTENT_TYPE_ID_CARD_BACK.equals(contentType)) {
recIDCard(IDCardParams.ID_CARD_SIDE_BACK, filePath);
}
}
}
}
}
private void alertText(final String title, final String message) {
this.runOnUiThread(new Runnable() {
@Override
public void run() {
alertDialog.setTitle(title)
.setMessage(message)
.setPositiveButton("确定", null)
.show();
}
});
}
private String getRealPathFromURI(Uri contentURI) {
String result;
Cursor cursor = getContentResolver().query(contentURI, null, null, null, null);
if (cursor == null) { // Source is Dropbox or other similar local file path
result = contentURI.getPath();
} else {
cursor.moveToFirst();
int idx = cursor.getColumnIndex(MediaStore.Images.ImageColumns.DATA);
result = cursor.getString(idx);
cursor.close();
}
return result;
}
@Override
protected void onDestroy() {
// 释放本地质量控制模型
CameraNativeHelper.release();
super.onDestroy();
}
}
| [
"1936452757@qq.com"
] | 1936452757@qq.com |
6dae8d67000031870aca76756a8a3d1f6d04fb18 | a0cd546101594e679544d24f92ae8fcc17013142 | /refactorit-core/src/main/java/net/sf/refactorit/audit/rules/modifiers/FinalMethodProposalRule.java | 2928ef9d794b25935aec5206a6ae923999229bcd | [] | no_license | svn2github/RefactorIT | f65198bb64f6c11e20d35ace5f9563d781b7fe5c | 4b1fc1ebd06c8e192af9ccd94eb5c2d96f79f94c | refs/heads/master | 2021-01-10T03:09:28.310366 | 2008-09-18T10:17:56 | 2008-09-18T10:17:56 | 47,540,746 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 7,556 | java | /*
* Copyright 2001-2008 Aqris Software AS. All rights reserved.
*
* This program is dual-licensed under both the Common Development
* and Distribution License ("CDDL") and the GNU General Public
* License ("GPL"). You may elect to use one or the other of these
* licenses.
*/
package net.sf.refactorit.audit.rules.modifiers;
import net.sf.refactorit.audit.AuditRule;
import net.sf.refactorit.audit.AwkwardMember;
import net.sf.refactorit.audit.MultiTargetCorrectiveAction;
import net.sf.refactorit.audit.RuleViolation;
import net.sf.refactorit.classmodel.BinCIType;
import net.sf.refactorit.classmodel.BinMember;
import net.sf.refactorit.classmodel.BinMethod;
import net.sf.refactorit.classmodel.BinModifier;
import net.sf.refactorit.classmodel.CompilationUnit;
import net.sf.refactorit.source.edit.ModifierEditor;
import net.sf.refactorit.transformations.TransformationManager;
import net.sf.refactorit.ui.module.TreeRefactorItContext;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.Stack;
/**
*
* @author Arseni Grigorjev
*/
public class FinalMethodProposalRule extends AuditRule{
public static final String NAME = "finalize_methods";
Stack stack = new Stack();
ArrayList methodsToFinalize = null;
public void init() {
super.init();
// slow, but makes BinTypeRef.getDirectSubclasses() return correct results
getProject().discoverAllUsedTypes();
}
public void visit(final BinCIType type){
stack.push(methodsToFinalize);
methodsToFinalize = new ArrayList(10);
}
public void leave(final BinCIType type){
int alreadyFinalMethods = 0;
final BinMethod[] declaredMethods = type.getDeclaredMethods();
for (int i = 0; i < declaredMethods.length; i++){
if (declaredMethods[i].isFinal()){
alreadyFinalMethods++;
}
}
final boolean proposeFinalizeClass;
if (!type.isFinal()
&& !type.isAbstract()
&& !type.isInterface()
&& !type.isAnonymous()
&& !type.isTypeParameter()
&& (type.getOwner() == null || !type.getOwner().getBinCIType().isEnum())
&& type.getTypeRef().getDirectSubclasses().size() == 0
&& declaredMethods.length == (alreadyFinalMethods + methodsToFinalize
.size())){
addViolation(new FinalClassProposal(type));
proposeFinalizeClass = true;
} else {
proposeFinalizeClass = false;
}
for (int i = 0, max = methodsToFinalize.size(); i < max; i++){
addViolation(new FinalMethodProposal((BinMethod) methodsToFinalize.get(i),
proposeFinalizeClass));
}
methodsToFinalize.clear();
methodsToFinalize = (ArrayList) stack.pop();
}
public void visit(final BinMethod method){
final BinCIType ownerType = method.getOwner().getBinCIType();
if (!method.isFinal()
&& !method.isAbstract()
&& !method.isMain()
&& !ownerType.isFinal()
&& !ownerType.isInterface()
&& (ownerType.getOwner() == null
|| !ownerType.getOwner().getBinCIType().isEnum())
&& ownerType.getSubMethods(method).size() == 0){
methodsToFinalize.add(method);
}
}
}
class FinalClassProposal extends AwkwardMember {
public FinalClassProposal(final BinMember member){
super(member, "Class " + member.getName() + " should be " +
"'final': neither it nor its methods are overriden.", "refact.audit.finalize_methods");
}
public List getCorrectiveActions(){
return Collections.singletonList(AddFinalModifierForClass.INSTANCE);
}
}
class FinalMethodProposal extends AwkwardMember {
final boolean proposeFinalizeClass;
public FinalMethodProposal(final BinMethod method,
final boolean proposeFinalizeClass){
super(method, method.getName() + "() is never overriden - "
+ "should be 'final'", "refact.audit.finalize_methods");
this.proposeFinalizeClass = proposeFinalizeClass;
}
public List getCorrectiveActions(){
final ArrayList result = new ArrayList(2);
if (proposeFinalizeClass){
result.add(AddFinalModifierForClass.INSTANCE);
}
result.add(AddFinalModifierForMethod.INSTANCE);
return result;
}
public boolean hasProposeFinalizeClass() {
return this.proposeFinalizeClass;
}
}
class AddFinalModifierForClass extends MultiTargetCorrectiveAction {
static final AddFinalModifierForClass INSTANCE
= new AddFinalModifierForClass();
public String getKey() {
return "refactorit.audit.action.final.add_to_class";
}
public String getName() {
return "Accept suggested final modifier for class";
}
public String getMultiTargetName() {
return "Accept suggested final modifier(s) for class(es)";
}
protected Set process(TreeRefactorItContext context, final TransformationManager manager, final RuleViolation violation) {
if (!(violation instanceof FinalMethodProposal)
&& !(violation instanceof FinalClassProposal)) {
return Collections.EMPTY_SET; // foreign violation - do nothing
}
if (violation instanceof FinalMethodProposal
&& !((FinalMethodProposal) violation).hasProposeFinalizeClass()){
return Collections.EMPTY_SET;
}
final CompilationUnit compilationUnit = violation.getCompilationUnit();
final BinMember ownerMember = violation.getOwnerMember();
final BinCIType type;
if (ownerMember instanceof BinMethod){
type = ownerMember.getOwner().getBinCIType();
} else {
type = (BinCIType) ownerMember;
}
// add 'final' modifier to Class
int modifiers = type.getModifiers();
modifiers = BinModifier.setFlags(modifiers, BinModifier.FINAL);
manager.add(new ModifierEditor(type, modifiers));
// remove 'final' modifiers from methods
final BinMethod[] declaredMethods = type.getDeclaredMethods();
int newModifiers;
for (int i = 0; i < declaredMethods.length; i++){
modifiers = declaredMethods[i].getModifiers();
newModifiers = BinModifier.clearFlags(modifiers, BinModifier.FINAL);
if (modifiers != newModifiers){
manager.add(new ModifierEditor(declaredMethods[i], newModifiers));
}
}
return Collections.singleton(compilationUnit);
}
}
class AddFinalModifierForMethod extends MultiTargetCorrectiveAction {
static final AddFinalModifierForMethod INSTANCE
= new AddFinalModifierForMethod();
public String getKey() {
return "refactorit.audit.action.final.add_to_method";
}
public String getName() {
return "Accept suggested final modifier for method";
}
public String getMultiTargetName() {
return "Accept suggested final modifier(s) for method(s)";
}
protected Set process(TreeRefactorItContext context, final TransformationManager manager, final RuleViolation violation) {
if (!(violation instanceof FinalMethodProposal)) {
return Collections.EMPTY_SET; // foreign violation - do nothing
}
final CompilationUnit compilationUnit = violation.getCompilationUnit();
final BinMember method = violation.getOwnerMember();
int modifiers = method.getModifiers();
modifiers = BinModifier.setFlags(modifiers, BinModifier.FINAL);
manager.add(new ModifierEditor(method, modifiers));
return Collections.singleton(compilationUnit);
}
}
| [
"l950637@285b47d1-db48-0410-a9c5-fb61d244d46c"
] | l950637@285b47d1-db48-0410-a9c5-fb61d244d46c |
1abf171c964df038ae16e85bcdcfadc71e41532b | f535e423cb30f4ffc59465b03a421bc9bfe34636 | /src/main/java/team/gfr/phone/controller/TbUserController.java | 37391f9ee2776819a014d3f9045e8bcd4e0eb868 | [] | no_license | ZKQevin/PhoneShop | 8008d16aefd86f9534c470d3f2865ffd16e36b74 | cb1ab0fdc3ce7b757fe1d78d853a5f8b49a2d86b | refs/heads/master | 2023-02-28T23:06:42.331418 | 2021-02-06T02:05:24 | 2021-02-06T02:05:24 | 336,430,037 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,483 | java | package team.gfr.phone.controller;
import org.springframework.web.bind.annotation.*;
import team.gfr.phone.Dto.UpdateData;
import team.gfr.phone.entity.TbUser;
import team.gfr.phone.result.ExceptionMsg;
import team.gfr.phone.result.ResponseData;
import team.gfr.phone.service.TbUserService;
import javax.annotation.Resource;
import java.util.List;
/**
* (TbUser)表控制层
*
* @author makejava
* @since 2021-01-05 01:22:59
*/
@RestController
@RequestMapping("tbUser")
public class TbUserController {
/**
* 服务对象
*/
@Resource
private TbUserService tbUserService;
/*
* 接口描述:通过主键查询
* 请求方式:get
* Url地址:http://localhost:8080/tbUser/queryById?id=
* 参数:id 主键
* 返回值(封装):{ExceptionMsg.SUCCESS,tbPhone}
* */
@GetMapping("queryById")
public ResponseData queryById(Integer id) {
TbUser tbPhone = tbUserService.queryById(id);
return new ResponseData(ExceptionMsg.SUCCESS,tbPhone);
}
/*
* 接口描述:列表展示页
* 请求方式:get
* Url地址:http://localhost:8080/tbUser/queryByLimit/1/10
* 参数:page 开始页 limit 查询条数
* 返回值(封装):{"0","操作成功",tbPhones,phonecount}
* */
@GetMapping("queryAllByLimit")
public ResponseData queryAllByLimit(Integer page,Integer limit){
List<TbUser> tbPhones = tbUserService.queryAllByLimit(page, limit);
Long usercount = tbUserService.usercount();
return new ResponseData("0","操作成功",tbPhones,usercount);
}
/*
* 接口描述:新增用户
* 请求方式:post
* Url地址:http://localhost:8080/tbUser/upuser
* 参数:用户对象
* 返回值(封装):{ExceptionMsg.SUCCESS/ExceptionMsg.FAILED}
* */
@PostMapping("upuser")
public ResponseData upuser(@RequestBody TbUser tbUser){
Boolean status = tbUserService.insert(tbUser);
if(status){
return new ResponseData(ExceptionMsg.SUCCESS);
}
else{
return new ResponseData(ExceptionMsg.FAILED);
}
}
/*
* 接口描述:通过主键删除用户
* 请求方式:Delete
* Url地址:http://localhost:8080/tbUser/deleteById
* 参数:手机对象
* 返回值(封装):{ExceptionMsg.SUCCESS/ExceptionMsg.FAILED}
* */
@DeleteMapping("deleteById/{id}")
public ResponseData deleteById(@PathVariable Integer id){
boolean status = tbUserService.deleteById(id);
if (status) {
return new ResponseData(ExceptionMsg.SUCCESS);
}
else{
return new ResponseData(ExceptionMsg.FAILED);
}
}
/* 接口描述:通过主键修改指定信息
* Url地址:http://localhost:8080/tbUser/updateuser
* 请求方式:put
* 参数:{"filed":"password","value":"admin","id":"2"}
* update tb_phone set password = "admin" where id = 2
* 返回值(封装):{"code":200,"msg":"操作成功"},{"code":500,"msg":"操作失败"}
* */
@PatchMapping("updateuser")
public ResponseData updateuser(@RequestBody UpdateData updateData){
Boolean status = tbUserService.updateuser(updateData);
if(status){
return new ResponseData(ExceptionMsg.SUCCESS);
}
else{
return new ResponseData(ExceptionMsg.FAILED);
}
}
} | [
"773116395@qq.com"
] | 773116395@qq.com |
4bab5ca93e9adff8d842f56a3296523e978c88aa | 4febc3fe16cf2b2c34ec773c704c59b788118ba1 | /app/src/main/java/srinivasu/sams/helper/DBHelper.java | 1136c17d24c35cbdae531729ca02b1591f25e96d | [] | no_license | srinivasudadi9000/Samples | 3bea33fd254bfd5d76d82fc35715299cab4a463c | 700d221f3089ef8f997f6952ddfdf0a67ae00b57 | refs/heads/master | 2021-06-29T02:00:55.056609 | 2017-09-13T12:12:51 | 2017-09-13T12:12:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,199 | java | package srinivasu.sams.helper;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;
import java.util.List;
import srinivasu.sams.model.Installation;
import srinivasu.sams.model.Products;
import srinivasu.sams.model.Projects;
import srinivasu.sams.model.Recce;
/**
* Created by venky on 20-Aug-17.
*/
public class DBHelper {
static SQLiteDatabase db;
static Context context;
public DBHelper(String x,String y,String z,String a,String b,Context context){
db = context.openOrCreateDatabase("SAMS", Context.MODE_PRIVATE, null);
db.execSQL("CREATE TABLE IF NOT EXISTS project(project_id VARCHAR unique,project_name VARCHAR,vendor_id VARCHAR);");
db.execSQL("CREATE TABLE IF NOT EXISTS product(product_id VARCHAR unique,product_name VARCHAR,vendor_id VARCHAR);");
db.execSQL("CREATE TABLE IF NOT EXISTS recce(recce_id VARCHAR unique,project_id VARCHAR,key VARCHAR,userid VARCHAR,crewpersonid VARCHAR," +
"product_name VARCHAR,zone_id VARCHAR,uom_id VARCHAR,uom_name VARCHAR," +
"recce_date VARCHAR,outlet_name VARCHAR,outlet_owner_name VARCHAR," +
"outlet_address VARCHAR,longitude VARCHAR,latitude VARCHAR,width VARCHAR," +
"height VARCHAR,width_feet VARCHAR,height_feet VARCHAR,width_inches VARCHAR," +
"height_inches VARCHAR,recce_image VARCHAR,recce_image_1 VARCHAR,recce_image_2 VARCHAR," +
"recce_image_3 VARCHAR,recce_image_4 VARCHAR," +
"product0 VARCHAR,uoms VARCHAR,recce_image_upload_status VARCHAR);");
db.execSQL("CREATE TABLE IF NOT EXISTS install(recce_id VARCHAR unique,project_id VARCHAR," +
"vendor_id VARCHAR,crew_person_id VARCHAR,recce_date VARCHAR," +
"outlet_name VARCHAR,outlet_owner_name VARCHAR," +
"outlet_address VARCHAR,longitude VARCHAR,latitude VARCHAR,recce_image VARCHAR,installation_date VARCHAR" +
",installation_image VARCHAR,installation_remarks VARCHAR ,width VARCHAR," +
"height VARCHAR,width_feet VARCHAR,height_feet VARCHAR,width_inches VARCHAR," +
"height_inches VARCHAR,product_name VARCHAR,product0 VARCHAR,installation_image_upload_status VARCHAR," +
"recce_image_path VARCHAR,key VARCHAR,userid VARCHAR);");
}
public DBHelper(List<Projects> projects, Context context, String project, String constru_one) {
this.context = context;
db = context.openOrCreateDatabase("SAMS", Context.MODE_PRIVATE, null);
db.execSQL("CREATE TABLE IF NOT EXISTS project(project_id VARCHAR unique,project_name VARCHAR,vendor_id VARCHAR);");
String size = String.valueOf(projects.size());
// Toast.makeText(context.getApplicationContext(), size, Toast.LENGTH_SHORT).show();
for (int i = 0; i < projects.size(); i++) {
if (validaterecord(projects.get(i).getProject_id(), "project").equals("notvalidate")) {
// Log.d("projects",projects.get(i).getProject_id().toString());
insertProject(projects.get(i).getProject_id(), projects.get(i).getProject_name(),Preferences.getVendorid());
}else {
// Log.d("projects","no ra");
}
}
//viewmydb();
}
private void insertProject(String project_id, String project_name,String vendor_id) {
db.execSQL("INSERT INTO project VALUES('" + project_id + "','" + project_name+ "','"+vendor_id+"');");
}
public DBHelper(List<Products> productses, Context context, String produts, String constru_one, String products) {
this.context = context;
db = context.openOrCreateDatabase("SAMS", Context.MODE_PRIVATE, null);
db.execSQL("CREATE TABLE IF NOT EXISTS product(product_id VARCHAR unique,product_name VARCHAR,vendor_id VARCHAR);");
// Toast.makeText(context.getApplicationContext(), size, Toast.LENGTH_SHORT).show();
for (int i = 0; i < productses.size(); i++) {
if (validaterecord(productses.get(i).getProduct_id(), "product").equals("notvalidate")) {
// Log.d("projects",productses.get(i).getProduct_id().toString());
insertProduct(productses.get(i).getProduct_id(), productses.get(i).getProduct_name(),Preferences.getVendorid());
}else {
// Log.d("projects","no ra");
}
}
//viewmydb();
}
private void insertProduct(String product_id, String product_name,String vendor_id) {
db.execSQL("INSERT INTO product VALUES('" + product_id + "','" + product_name+"','"+vendor_id+ "');");
}
public DBHelper(List<Recce> recces, Context context) {
this.context = context;
db = context.openOrCreateDatabase("SAMS", Context.MODE_PRIVATE, null);
db.execSQL("CREATE TABLE IF NOT EXISTS recce(recce_id VARCHAR unique,project_id VARCHAR,key VARCHAR,userid VARCHAR,crewpersonid VARCHAR," +
"product_name VARCHAR,zone_id VARCHAR,uom_id VARCHAR,uom_name VARCHAR," +
"recce_date VARCHAR,outlet_name VARCHAR,outlet_owner_name VARCHAR," +
"outlet_address VARCHAR,longitude VARCHAR,latitude VARCHAR,width VARCHAR," +
"height VARCHAR,width_feet VARCHAR,height_feet VARCHAR,width_inches VARCHAR," +
"height_inches VARCHAR,recce_image VARCHAR,recce_image_1 VARCHAR,recce_image_2 VARCHAR," +
"recce_image_3 VARCHAR,recce_image_4 VARCHAR," +
"product0 VARCHAR,uoms VARCHAR,recce_image_upload_status VARCHAR);");
String size = String.valueOf(recces.size());
// Toast.makeText(context.getApplicationContext(), size, Toast.LENGTH_SHORT).show();
for (int i = 0; i < recces.size(); i++) {
;
if (validaterecord(recces.get(i).getRecce_id(), "recce").equals("notvalidate")) {
String index = String.valueOf(i);
// Toast.makeText(getApplicationContext(), index.toString() + " r= " + recces.get(i).getRecce_id(), Toast.LENGTH_SHORT).show();
insertRecce(recces.get(i).getRecce_id(), recces.get(i).getProject_id(), Preferences.getKey(), Preferences.getUserid(), Preferences.getCrewPersonid_project(), recces.get(i).getProduct_name().replaceAll("'", ""), recces.get(i).getZone_id()
, recces.get(i).getUom_id(), recces.get(i).getUom_name(), recces.get(i).getRecce_date(), recces.get(i).getOutlet_name().replaceAll("'", "")
, recces.get(i).getOutlet_owner_name(), recces.get(i).getOutlet_address().replaceAll("'", ""), recces.get(i).getLongitude()
, recces.get(i).getLatitude(), recces.get(i).getWidth(), recces.get(i).getHeight(), recces.get(i).getWidth_feet()
, recces.get(i).getHeight_feet(), recces.get(i).getWidth_inches(), recces.get(i).getHeight_inches(), recces.get(i).getRecce_image()
, recces.get(i).getRecce_image_1(), recces.get(i).getRecce_image_2(), recces.get(i).getRecce_image_3()
, recces.get(i).getRecce_image_4(), recces.get(i).getProduct0(), recces.get(i).getHeight()
, recces.get(i).getRecce_image_upload_status());
}
}
//viewmydb();
}
public DBHelper(List<Installation> installations, Context context, String install) {
this.context = context;
db = context.openOrCreateDatabase("SAMS", Context.MODE_PRIVATE, null);
db.execSQL("CREATE TABLE IF NOT EXISTS install(recce_id VARCHAR unique,project_id VARCHAR," +
"vendor_id VARCHAR,crew_person_id VARCHAR,recce_date VARCHAR," +
"outlet_name VARCHAR,outlet_owner_name VARCHAR," +
"outlet_address VARCHAR,longitude VARCHAR,latitude VARCHAR,recce_image VARCHAR,installation_date VARCHAR" +
",installation_image VARCHAR,installation_remarks VARCHAR ,width VARCHAR," +
"height VARCHAR,width_feet VARCHAR,height_feet VARCHAR,width_inches VARCHAR," +
"height_inches VARCHAR,product_name VARCHAR,product0 VARCHAR,installation_image_upload_status VARCHAR," +
"recce_image_path VARCHAR,key VARCHAR,userid VARCHAR);");
String size = String.valueOf(installations.size());
// Toast.makeText(context.getApplicationContext(), size, Toast.LENGTH_SHORT).show();
for (int i = 0; i < installations.size(); i++) {
;
if (validaterecord(installations.get(i).getRecce_id(), "install").equals("notvalidate")) {
String index = String.valueOf(i);
// Toast.makeText(getApplicationContext(), index.toString() + " r= " + recces.get(i).getRecce_id(), Toast.LENGTH_SHORT).show();
insertInstall(installations.get(i).getRecce_id(), installations.get(i).getProject_id(),
installations.get(i).getVendor_id(), installations.get(i).getCrew_person_id()
, installations.get(i).getRecce_date(), installations.get(i).getOutlet_name(),
installations.get(i).getOutlet_owner_name(), installations.get(i).getOutlet_address().replaceAll("'", "")
, installations.get(i).getLongitude(), installations.get(i).getLatitude().replaceAll("'", ""),
installations.get(i).getRecce_image(), installations.get(i).getInstallation_date(),
installations.get(i).getInstallation_image(), installations.get(i).getInstallation_remarks(),
installations.get(i).getWidth(), installations.get(i).getHeight(), installations.get(i).getWidth_feet(),
installations.get(i).getHeight_feet(), installations.get(i).getWidth_inches(),
installations.get(i).getHeight_inches(), installations.get(i).getProduct_name(),
installations.get(i).getProduct0(), installations.get(i).getInstallation_image_upload_status(),
installations.get(i).getRecce_image(),Preferences.getKey(),Preferences.getUserid());
}
}
//viewmydb();
}
public void insertRecce(String recce_id, String project_id, String key, String userid, String crewpersonid, String product_name, String zone_id, String uom_id, String uom_name,
String recce_date, String outlet_name, String outlet_owner_name, String outlet_address, String longitude,
String latitude, String width, String height, String width_feet, String height_feet, String width_inches,
String height_inches, String recce_image, String recce_image_1, String recce_image_2, String recce_image_3,
String recce_image_4, String product0, String uoms, String recce_image_upload_status) {
db.execSQL("INSERT INTO recce VALUES('" + recce_id + "','" + project_id + "','" + key + "','" + userid + "','" + crewpersonid + "','" + product_name + "','" + zone_id + "','" +
uom_id + "','" + uom_name + "','" + recce_date + "','" + outlet_name + "','" + outlet_owner_name + "','" + outlet_address
+ "','" + longitude + "','" + latitude + "','" + width + "','" + height + "','" + width_feet + "','" + height_feet
+ "','" + width_inches + "','" + height_inches + "','" + recce_image + "','" + recce_image_1 + "','" + recce_image_2 + "','" +
recce_image_3 + "','" + recce_image_4 + "','" + product0 + "','" + uoms + "','" + recce_image_upload_status + "');");
}
public void insertInstall(String recce_id, String project_id, String vendor_id, String crew_person_id, String recce_date,
String outlet_name, String outlet_owner_name, String outlet_address, String longitude, String latitude,
String recce_image, String installation_date, String installation_image, String installation_remarks,
String width, String height, String width_feet, String height_feet, String width_inches,
String height_inches, String product_name, String product0, String installation_image_upload_status,
String recce_image_path,String key,String userid) {
String outletname,outletaddress,prod_name;
if (outlet_name.length()>0){outletname = outlet_name.replaceAll("'", "");}else {outletname=outlet_name;}
if (outlet_address.length()>0){outletaddress = outlet_address.replaceAll("'", "");}else {outletaddress=outlet_address;}
if (product_name.length()>0){prod_name = product_name.replaceAll("'", "");}else {prod_name=product_name;}
db.execSQL("INSERT INTO install VALUES('" + recce_id + "','" + project_id + "','" + vendor_id + "','" + crew_person_id + "','" +
recce_date + "','" + outletname + "','" + outlet_owner_name + "','" + outletaddress + "','" + longitude
+ "','" + latitude + "','" + recce_image + "','" + installation_date + "','" + installation_image + "','" + installation_remarks
+ "','" + width + "','" + height + "','" + width_feet + "','" + height_feet + "','" + width_inches + "','" +
height_inches + "','" + prod_name + "','" + product0 + "','" + installation_image_upload_status + "','" + recce_image_path + "','" + key + "','" + userid + "');");
}
public String validaterecord(String recceid, String instal) {
if (instal.equals("install")) {
Cursor c = db.rawQuery("SELECT * FROM install WHERE recce_id='" + recceid + "'", null);
if (c.moveToFirst()) {
return "validate";
} else {
return "notvalidate";
}
} else if (instal.equals("project")){
Cursor c = db.rawQuery("SELECT * FROM project WHERE project_id='" + recceid + "'", null);
if (c.moveToFirst()) {
return "validate";
} else {
return "notvalidate";
}
}
else if (instal.equals("product")){
Cursor c = db.rawQuery("SELECT * FROM product WHERE product_id='" + recceid + "'", null);
if (c.moveToFirst()) {
return "validate";
} else {
return "notvalidate";
}
}else {
Cursor c = db.rawQuery("SELECT * FROM recce WHERE recce_id='" + recceid + "'", null);
if (c.moveToFirst()) {
return "validate";
} else {
return "notvalidate";
}
}
}
public static void updateRecce_Localdb(String uom_id, String width, String key, String userid, String crewpersonid, String height, String width_feet, String height_feet,
String width_inches, String height_inches, String recce_id, String recce_image,
String recce_image_1, String recce_image_2, String recce_image_3, String recce_image_4,
String latitude, String longitude, String outlet_address, String project_id, String uoms, String status,Context mycontext) {
db = mycontext.openOrCreateDatabase("SAMS", Context.MODE_PRIVATE, null);
db.execSQL("UPDATE recce SET uom_id='" + uom_id + "',width='" + width + "',key='" + key + "',userid='" + userid
+ "',crewpersonid='" + crewpersonid +
"',height='" + height + "',width_feet='" + width_feet + "',uoms='" + uoms +
"',height_feet='" + height_feet + "',width_inches='" + width_inches +
"',height_inches='" + height_inches +
"',recce_image='" + recce_image + "',recce_image_1='" + recce_image_1 +
"',recce_image_2='" + recce_image_2 + "',recce_image_3='" + recce_image_3 +
"',recce_image_4='" + recce_image_4 + "',latitude='" + latitude
+ "',recce_image_upload_status='" + status + "',longitude='" + longitude + "',outlet_address='" + outlet_address + "'" + "WHERE recce_id=" + recce_id);
Log.d("success", "successfully updated recce");
}
public static void updateInstall_Localdb(String install_date, String install_remark, String key, String userid, String crewpersonid,
String recce_id, String project_id, String imagefilepart1, String mode, Context mycontext) {
db = mycontext.openOrCreateDatabase("SAMS", Context.MODE_PRIVATE, null);
db.execSQL("UPDATE install SET installation_date='" + install_date + "',installation_remarks='" + install_remark + "',key='" + key + "',userid='" + userid
+ "',crew_person_id='" + crewpersonid +
"',project_id='" + project_id + "',installation_image='" + imagefilepart1 + "',product0='" + mode +"'"+
" WHERE recce_id=" + recce_id);
db.close();
Log.d("success", "successfully updated recce");
}
}
| [
"srinivasdadi9000@gmail.com"
] | srinivasdadi9000@gmail.com |
7442788f14f2bd44854d82cbd83da0369e9daf5b | f04de1d586b4fac0c36e729de7ee8c0950c2fbda | /code/jyhProject-core/src/main/java/com/jyh/multiThread/thread/instMethod/TestInterrupt.java | 941e11fc12842aec244fbb6cfc623a566c854f5b | [] | no_license | jiangyuhang1/jyhProject | f1cf5f7f7cedf16cd13d0a90dd7ff6fb056a610f | 523710f38ad50ba875fecef2de27dc96407a674a | refs/heads/master | 2023-03-17T05:35:26.009717 | 2021-03-10T10:37:09 | 2021-03-10T10:37:09 | 291,971,870 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 694 | java | package com.jyh.multiThread.thread.instMethod;
//测试interrupt()和isInterrupted()
public class TestInterrupt extends Thread{
@Override
public void run() {
for(int i = 0; i < 1000; i++){
System.out.println(i);
}
}
public static void main(String[] args){
TestInterrupt ti = new TestInterrupt();
ti.start();
try{
Thread.sleep(20);
}catch (InterruptedException e){
e.printStackTrace();
}
//意图在线程执行20ms之后中断,事实上run一直执行完了
//真正作用是线程阻塞的时候,给个中断信号,退出阻塞
ti.interrupt();
}
}
| [
"jiang.yuhang2@iwhalecloud.com"
] | jiang.yuhang2@iwhalecloud.com |
6f25dbb7b63967db1026150136c2005ee97a5361 | d5b573b58d8f9a58b7c1a5a4b2143985630e7aca | /app/src/main/java/com/example/longyuan/websockettest/pojo/receive/ButtonsItem.java | e117df7a593bc1c60bd9770d2bfc2f2fb73b4e11 | [] | no_license | pyrotechnist/WebSocketTest | ab566ea35fc294896806e46f6eab469943d528d9 | 61c0cc60753140525c839bca364390cf88e0d156 | refs/heads/master | 2021-04-26T23:39:21.904669 | 2018-03-19T21:18:16 | 2018-03-19T21:18:16 | 123,832,527 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,310 | java | package com.example.longyuan.websockettest.pojo.receive;
import javax.annotation.Generated;
import com.google.gson.annotations.SerializedName;
@Generated("com.robohorse.robopojogenerator")
public class ButtonsItem{
@SerializedName("displayText")
private String displayText;
@SerializedName("text")
private String text;
@SerializedName("type")
private String type;
@SerializedName("title")
private String title;
@SerializedName("value")
private String value;
public void setDisplayText(String displayText){
this.displayText = displayText;
}
public String getDisplayText(){
return displayText;
}
public void setText(String text){
this.text = text;
}
public String getText(){
return text;
}
public void setType(String type){
this.type = type;
}
public String getType(){
return type;
}
public void setTitle(String title){
this.title = title;
}
public String getTitle(){
return title;
}
public void setValue(String value){
this.value = value;
}
public String getValue(){
return value;
}
@Override
public String toString(){
return
"ButtonsItem{" +
"displayText = '" + displayText + '\'' +
",text = '" + text + '\'' +
",type = '" + type + '\'' +
",title = '" + title + '\'' +
",value = '" + value + '\'' +
"}";
}
} | [
"xulongyuan@gmail.com"
] | xulongyuan@gmail.com |
8ab2a83ccd6ee25c2a33074cb52bbcd3f35f0def | 3d3f6f81ed4b8a036c067b6f016a3b906ef3a696 | /src/main/java/arrays/Arrayss.java | b1fe8be8599f6a08017aa47cfa2ac4bc3aff0b0d | [] | no_license | nimishsingh11/java-practice | c020ebc84e2fdeb9b10f0e7db13919f642226799 | 3af2916af8279ef798ea77bd18505da4e9d0b012 | refs/heads/master | 2023-07-05T08:39:55.181811 | 2021-08-12T08:03:30 | 2021-08-12T08:03:30 | 377,409,876 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 383 | java | package arrays;
public class Arrayss {
int a[]=new int[5];
A ab[]=new A[3];
public static void main(String[] args) {
Arrayss i =new Arrayss();
for (int m=0 ; m<i.a.length ;m++) {
i.a[m]=m;
System.out.println(i.a[m]);
}
//i.a[5]=4;
int n=10;
for (int m=0; m<i.ab.length; m++) {
i.ab[m]=new A(n);
System.out.println(i.ab[m].geta());
n=n+10;
}
}
}
| [
"76872529+nimishsumo@users.noreply.github.com"
] | 76872529+nimishsumo@users.noreply.github.com |
059950cb6ff20989ace62b8cc00288f993404dc9 | ece7aa825be3e5b97b3cfcf84efa71b71c787c7f | /src/main/java/pl/allegier/controller/frontend/dto/BaseDto.java | ec8f7f8bff6874029a93ea2be9452dc3abbd9ea2 | [] | no_license | jgore/allegier | 230cdff58b988beeb51b195a54210da323085cd6 | d9dfdff6130bfa338a52a812b9506147bf60276e | refs/heads/master | 2021-01-18T22:44:49.571110 | 2018-11-02T15:13:09 | 2018-11-02T15:13:09 | 87,066,880 | 2 | 2 | null | 2017-04-20T07:12:31 | 2017-04-03T11:30:24 | Java | UTF-8 | Java | false | false | 1,016 | java | package pl.allegier.controller.frontend.dto;
import pl.allegier.model.timestamp.ITimestamp;
import java.util.Date;
/**
* Generic for DTO's to be timestamped
*/
public class BaseDto implements ITimestamp, Linked {
/**
* created timestamp
*/
private Date created;
/**
* updated timestamp
*/
private Date updated;
/**
* String Return Source Link
*
* @return
*/
private String link;
@Override
public final String getLink() {
return link;
}
@Override
public final void setLink(final String aLink) {
this.link = aLink;
}
@Override
public final Date getCreated() {
return created;
}
@Override
public final Date getUpdated() {
return updated;
}
@Override
public final void setCreated(final Date aCreated) {
this.created = aCreated;
}
@Override
public final void setUpdated(final Date aUpdated) {
this.updated = aUpdated;
}
}
| [
"p.szczepkowski87@gmail.com"
] | p.szczepkowski87@gmail.com |
8faf309c7c2cb9a322810301c522cf82868efe42 | 6e1c8235c1260f0c2c84d76d90e99c04b159e569 | /src/main/java/com/paypal/sre/snap/LogManager1.java | 3761527c16200d69415a42589f58c5b8cff50966 | [] | no_license | rajimitara/springKafka | 4e5d21be9d6905797d80e91eab526f538c7e56cc | 09b9b14d451da8df7ab6737c330a3c429706e36c | refs/heads/master | 2021-06-26T13:13:00.876022 | 2020-10-20T08:29:50 | 2020-10-20T08:29:50 | 158,530,860 | 0 | 0 | null | 2018-11-24T20:54:33 | 2018-11-21T10:27:55 | Java | UTF-8 | Java | false | false | 1,999 | java | package com.paypal.sre.snap;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class LogManager1 {
final Logger logger;
public LogManager1(Object obj) {
this.logger = LoggerFactory.getLogger(obj.getClass());
}
public void logInfo(String logMsg) {
logger.info(logMsg);
}
public void logInfo(String threadName, String logMsg) {
logger.info("ThreadName=" + threadName + " - " + logMsg);
}
public void logInfo(String triageId, String runId, String logMsg) {
logger.info(triageId + "-" + runId + "-" + logMsg);
}
public void logDebug(String logMsg) {
logger.debug(logMsg);
}
public void logDebug(String threadName, String logMsg) {
logger.debug("ThreadName=" + threadName + " - " + logMsg);
}
public void logDebug(long triageId, long runId, String logMsg) {
logger.debug(triageId + "-" + runId + "-" + logMsg);
}
public void logError(String logMsg) {
logger.error(logMsg);
}
public void logError(String threadName, String logMsg) {
logger.error("ThreadName=" + threadName + " - " + logMsg);
}
public void logError(String threadName, String logMsg, Exception ex) {
logger.error("ThreadName=" + threadName + " - " + logMsg + " - Exception: " + ex.getMessage() + " - Stacktrace: " + Arrays.toString(ex.getStackTrace()));
}
public void logError(long triageId, long runId, String logMsg) {
logger.error(triageId + "-" + runId + "-" + logMsg);
}
public void logError(long triageId, long runId, String logMsg, Exception ex) {
logger.error(triageId + "-" + runId + "-" + logMsg + " - Exception: " + ex.getMessage() + " - Stacktrace: " + Arrays.toString(ex.getStackTrace()));
}
public void logWarning(String logMsg) {
logger.warn(logMsg);
}
public void logWarning(String threadName, String logMsg) {
logger.warn("ThreadName=" + threadName + " - " + logMsg);
}
public void logWarning(long triageId, long runId, String logMsg) {
logger.warn(triageId + "-" + runId + "-" + logMsg);
}
}
| [
"rajvenkatasubram@paypal.com"
] | rajvenkatasubram@paypal.com |
bb218e8d394d83972b7edb0e2e9a4344d8b6916f | 1b1d3816fb6f2e352c2d0889e3019993a2b4305c | /app/src/main/java/com/shapps/mintubeapp/AsyncTask/ImageLoadTask.java | f191a292b11ae229f0b047bc18137a04a5d809bb | [
"MIT"
] | permissive | SonNguyenMinh123/MinYoutube | e5971c43622bb5925f4f4d6dab1c71785adaae3b | 2669b48a211f693d6efe4d65584c85a7b5913f8b | refs/heads/master | 2020-03-25T03:09:11.521395 | 2018-08-02T17:27:56 | 2018-08-02T17:27:56 | 143,325,448 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,118 | java | package com.shapps.mintubeapp.AsyncTask;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
/**
* Created by shyam on 23/2/16.
*/
public class ImageLoadTask extends AsyncTask<Void, Void, Bitmap> {
private String url;
public ImageLoadTask(String url) {
this.url = url;
}
@Override
protected Bitmap doInBackground(Void... params) {
try {
URL urlConnection = new URL(url);
HttpURLConnection connection = (HttpURLConnection) urlConnection
.openConnection();
connection.setDoInput(true);
connection.connect();
InputStream input = connection.getInputStream();
Bitmap myBitmap = BitmapFactory.decodeStream(input);
return myBitmap;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Bitmap result) {
super.onPostExecute(result);
}
} | [
"sonnm@ikame.vn"
] | sonnm@ikame.vn |
4218e9b99039edbcfbbe9a5e61a7b141cf8b8db4 | 902f7ac12fbaeea5cde6176179c2e7b3379d3712 | /스프링관련/springworkspace/SpringDay04_AOP/src/aop_proxy/CAfterThrowing.java | f6538ae8e38836e5eb4b4d9ce68683207872f121 | [] | no_license | Yuni-Q/muticampus_sds1103_spring | 66ae90247410b45444d1f89c2eb01da4458e80ff | 652da35704c966f9bce636746bb6d793b066c075 | refs/heads/master | 2021-10-09T08:27:53.156634 | 2018-12-24T07:32:25 | 2018-12-24T07:32:25 | 112,411,001 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 169 | java | package aop_proxy;
public class CAfterThrowing implements AfterThrowing {
@Override
public void doAfterThrow() {
System.out.println("엄마를 부른다!!!");
}
}
| [
"carnotcycle2@naver.com"
] | carnotcycle2@naver.com |
6bfc2337697c3bc35072600660e99954a3f30ce7 | 1ad90f69d8bb9fc5f438f2e6910a70764a77f25c | /backend/src/main/java/ai/verta/modeldb/experimentRun/subtypes/ArtifactHandlerBase.java | 4fcbd68e320e2a5e5287c50391b28c2e86ebeb19 | [
"Apache-2.0"
] | permissive | efrenbl-alt/modeldb | 535ea042883ad34f415d76a4c32f2c3ea89f607f | 7a108fd46715971f55bfe5674f4de31c8f219adf | refs/heads/master | 2023-05-28T09:12:10.832702 | 2021-06-11T18:03:44 | 2021-06-11T18:03:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,147 | java | package ai.verta.modeldb.experimentRun.subtypes;
import ai.verta.common.Artifact;
import ai.verta.modeldb.common.exceptions.InternalErrorException;
import ai.verta.modeldb.common.futures.FutureJdbi;
import ai.verta.modeldb.common.futures.InternalFuture;
import ai.verta.modeldb.config.Config;
import ai.verta.modeldb.exceptions.AlreadyExistsException;
import ai.verta.modeldb.exceptions.InvalidArgumentException;
import java.util.AbstractMap;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.Executor;
import java.util.stream.Collectors;
public class ArtifactHandlerBase {
protected final Executor executor;
protected final FutureJdbi jdbi;
protected final String fieldType;
protected final String entityName;
protected final String entityIdReferenceColumn;
protected String getTableName() {
return "artifact";
}
public ArtifactHandlerBase(
Executor executor, FutureJdbi jdbi, String fieldType, String entityName) {
this.executor = executor;
this.jdbi = jdbi;
this.fieldType = fieldType;
this.entityName = entityName;
switch (entityName) {
case "ProjectEntity":
this.entityIdReferenceColumn = "project_id";
break;
case "ExperimentRunEntity":
this.entityIdReferenceColumn = "experiment_run_id";
break;
default:
throw new InternalErrorException("Invalid entity name: " + entityName);
}
}
protected InternalFuture<Optional<Long>> getArtifactId(String entityId, String key) {
return InternalFuture.runAsync(
() -> {
if (key.isEmpty()) {
throw new InvalidArgumentException("Key must be provided");
}
},
executor)
.thenCompose(
unused ->
jdbi.withHandle(
handle ->
handle
.createQuery(
"select id from "
+ getTableName()
+ " where entity_name=:entity_name and field_type=:field_type and "
+ entityIdReferenceColumn
+ "=:entity_id and ar_key=:ar_key")
.bind("entity_id", entityId)
.bind("field_type", fieldType)
.bind("entity_name", entityName)
.bind("ar_key", key)
.mapTo(Long.class)
.findOne()),
executor);
}
public InternalFuture<List<Artifact>> getArtifacts(String entityId, Optional<String> maybeKey) {
var currentFuture =
InternalFuture.runAsync(
() -> {
if (entityId == null || entityId.isEmpty()) {
throw new InvalidArgumentException("Entity id is empty");
}
},
executor);
return currentFuture.thenCompose(
unused ->
jdbi.withHandle(
handle -> {
var queryStr =
"select ar_key as k, ar_path as p, artifact_type as at, path_only as po, linked_artifact_id as lai, filename_extension as fe from "
+ getTableName()
+ " where entity_name=:entity_name and field_type=:field_type and "
+ entityIdReferenceColumn
+ "=:entity_id";
if (maybeKey.isPresent()) {
queryStr = queryStr + " AND ar_key=:ar_key ";
}
var query =
handle
.createQuery(queryStr)
.bind("entity_id", entityId)
.bind("field_type", fieldType)
.bind("entity_name", entityName);
maybeKey.ifPresent(s -> query.bind("ar_key", s));
return query
.map(
(rs, ctx) ->
Artifact.newBuilder()
.setKey(rs.getString("k"))
.setPath(rs.getString("p"))
.setArtifactTypeValue(rs.getInt("at"))
.setPathOnly(rs.getBoolean("po"))
.setLinkedArtifactId(rs.getString("lai"))
.setFilenameExtension(rs.getString("fe"))
.build())
.list();
}),
executor);
}
public InternalFuture<MapSubtypes<Artifact>> getArtifactsMap(Set<String> entityIds) {
return jdbi.withHandle(
handle -> {
var queryStr =
"select ar_key as k, ar_path as p, artifact_type as at, path_only as po, linked_artifact_id as lai, filename_extension as fe, "
+ entityIdReferenceColumn
+ " as entity_id from "
+ getTableName()
+ " where entity_name=:entity_name and field_type=:field_type and "
+ entityIdReferenceColumn
+ " in (<entity_ids>)";
var query =
handle
.createQuery(queryStr)
.bindList("entity_ids", entityIds)
.bind("field_type", fieldType)
.bind("entity_name", entityName);
return query
.map(
(rs, ctx) ->
new AbstractMap.SimpleEntry<>(
rs.getString("entity_id"),
Artifact.newBuilder()
.setKey(rs.getString("k"))
.setPath(rs.getString("p"))
.setArtifactTypeValue(rs.getInt("at"))
.setPathOnly(rs.getBoolean("po"))
.setLinkedArtifactId(rs.getString("lai"))
.setFilenameExtension(rs.getString("fe"))
.build()))
.list();
})
.thenApply(MapSubtypes::from, executor);
}
public InternalFuture<Void> logArtifacts(
String entityId, List<Artifact> artifacts, boolean overwrite) {
// Validate input
return InternalFuture.runAsync(
() -> {
if (entityId == null || entityId.isEmpty()) {
throw new InvalidArgumentException("Entity id is empty");
}
for (final var artifact : artifacts) {
String errorMessage = null;
if (artifact.getKey().isEmpty()
&& (artifact.getPathOnly() && artifact.getPath().isEmpty())) {
errorMessage = "Artifact key and Artifact path not found in request";
} else if (artifact.getKey().isEmpty()) {
errorMessage = "Artifact key not found in request";
} else if (artifact.getPathOnly() && artifact.getPath().isEmpty()) {
errorMessage = "Artifact path not found in request";
}
if (errorMessage != null) {
throw new InvalidArgumentException(errorMessage);
}
}
},
executor)
.thenCompose(
unused ->
// Check for conflicts
jdbi.useHandle(
handle -> {
if (overwrite) {
handle
.createUpdate(
"delete from "
+ getTableName()
+ " where entity_name=:entity_name and field_type=:field_type and ar_key in (<keys>) and "
+ entityIdReferenceColumn
+ "=:entity_id")
.bindList(
"keys",
artifacts.stream()
.map(Artifact::getKey)
.collect(Collectors.toList()))
.bind("field_type", fieldType)
.bind("entity_name", entityName)
.bind("entity_id", entityId)
.execute();
} else {
for (final var artifact : artifacts) {
handle
.createQuery(
"select id from "
+ getTableName()
+ " where entity_name=:entity_name and field_type=:field_type and ar_key=:key and "
+ entityIdReferenceColumn
+ "=:entity_id")
.bind("key", artifact.getKey())
.bind("field_type", fieldType)
.bind("entity_name", entityName)
.bind("entity_id", entityId)
.mapTo(Long.class)
.findOne()
.ifPresent(
present -> {
throw new AlreadyExistsException(
"Key '" + artifact.getKey() + "' already exists");
});
}
}
}),
executor)
.thenCompose(
unused ->
// Log
jdbi.useHandle(
handle -> {
for (final var artifact : artifacts) {
var storeTypePath =
!artifact.getPathOnly()
? Config.getInstance().artifactStoreConfig.storeTypePathPrefix()
+ artifact.getPath()
: "";
handle
.createUpdate(
"insert into "
+ getTableName()
+ " (entity_name, field_type, ar_key, ar_path, artifact_type, path_only, linked_artifact_id, filename_extension, store_type_path,"
+ entityIdReferenceColumn
+ ") "
+ "values (:entity_name, :field_type, :key, :path, :type,:path_only,:linked_artifact_id,:filename_extension,:store_type_path, :entity_id)")
.bind("key", artifact.getKey())
.bind("path", artifact.getPath())
.bind("type", artifact.getArtifactTypeValue())
.bind("path_only", artifact.getPathOnly())
.bind("linked_artifact_id", artifact.getLinkedArtifactId())
.bind("filename_extension", artifact.getFilenameExtension())
.bind("store_type_path", storeTypePath)
.bind("entity_id", entityId)
.bind("field_type", fieldType)
.bind("entity_name", entityName)
.execute();
}
}),
executor);
}
public InternalFuture<Void> deleteArtifacts(String entityId, Optional<List<String>> maybeKeys) {
var currentFuture =
InternalFuture.runAsync(
() -> {
if (entityId == null || entityId.isEmpty()) {
throw new InvalidArgumentException("Entity id is empty");
}
},
executor);
return currentFuture.thenCompose(
unused ->
jdbi.useHandle(
handle -> {
var sql =
"delete from "
+ getTableName()
+ " where entity_name=:entity_name and field_type=:field_type and "
+ entityIdReferenceColumn
+ "=:entity_id";
if (maybeKeys.isPresent()) {
sql += " and ar_key in (<keys>)";
}
var query =
handle
.createUpdate(sql)
.bind("entity_id", entityId)
.bind("field_type", fieldType)
.bind("entity_name", entityName);
if (maybeKeys.isPresent()) {
query = query.bindList("keys", maybeKeys.get());
}
query.execute();
}),
executor);
}
}
| [
"noreply@github.com"
] | efrenbl-alt.noreply@github.com |
f1d305b10bdd185e0a64146d6fb9a666e6773585 | 625eb2155fdec9b3b33d596425dce4430f2949eb | /src/test/java/com/dfh/demo/EntertainApplicationTests.java | f253e3ffea477a17c8b22f4daaad86d7b3e76589 | [] | no_license | FlyTigerDuan/Entertain | 71433f81625fb8e25acb278b1fca44618f3af154 | dec964db3b7bf125e98ac77e7f5ebfe5d7d6957f | refs/heads/master | 2022-11-27T13:55:53.624695 | 2019-09-19T15:47:29 | 2019-09-19T15:47:29 | 173,958,998 | 1 | 0 | null | 2022-11-16T12:23:37 | 2019-03-05T14:12:15 | Java | UTF-8 | Java | false | false | 332 | java | package com.dfh.demo;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class EntertainApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"flytigerduan@163.com"
] | flytigerduan@163.com |
cc198a458c3041e7ac68a6610cca995500254856 | ae5307f7b17b478d271de509ca4a8b06af901b83 | /src/gui/GuiExample3/VertexListModel.java | c36b3f0728da8d64a6fc14405c4e196ccdc7c7b3 | [] | no_license | samuelblattner/ftoop-notes | a66fefb22a37d3a75db4360fe4741c6b27fecc06 | 38ce1d8d9723c45d1a2b08edc10ae9bc22ae6848 | refs/heads/master | 2021-01-19T11:57:20.175247 | 2016-09-27T08:41:05 | 2016-09-27T08:41:05 | 68,952,794 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 768 | java | package gui.GuiExample3;
import javax.swing.*;
import java.util.ArrayList;
import java.util.List;
/**
* Example of a custom list model
*/
public class VertexListModel extends AbstractListModel {
private List<Vertex> vertices;
public VertexListModel(List<Vertex> vertices) {
if (vertices == null) {
this.vertices = new ArrayList<>();
}
else {
this.vertices = vertices;
}
}
@Override
public int getSize() {
return vertices.size();
}
@Override
public Object getElementAt(int index) {
return vertices.get(index);
}
public void addEntry(Vertex newVertex) {
vertices.add(newVertex);
fireIntervalAdded(this, 0, vertices.size());
}
}
| [
"samworks@gmx.net"
] | samworks@gmx.net |
b3f22d2d201569a14a1873d8ec38dfccff15f35e | b4b977328044cce66cf73bc0c2752f4c73e79c07 | /app/src/main/java/com/example/muziq/Playable.java | 7491ad1febb98970d765ec28cab3dfee2defeabf | [] | no_license | Ritik126/Moood | 7db660354d66c9da94620420e429ff441a9817dc | 1181637fda12bc0cb6639932febd2f871a160b5a | refs/heads/master | 2023-01-03T17:09:55.433207 | 2020-10-19T13:32:38 | 2020-10-19T13:32:38 | 305,389,509 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 159 | java | package com.example.muziq;
public interface Playable {
void onTrackPrevious();
void onTrackPlay();
void onTrackPause();
void onTrackNext();
}
| [
"rkapsime126@gmail.com"
] | rkapsime126@gmail.com |
2ac4bad760c2c1d9ade79f7a5926d3baac2d56d1 | 3e4ec986955d0b637b197a9e94f8be3247bab057 | /Final Submission/DaveOSullivan_T00139303/CA/src/InterestCalculator.java | 290fcb2b89a5722cfe8e9e38ecef0c97bf8f0d13 | [] | no_license | GodofMunch/Software-Testing | 461cfa5fea4b6bb14258f47ab9cead0c30ae4829 | 247ea60bce469f96073f3536886a7b730dc9c16f | refs/heads/master | 2021-04-09T10:42:03.370603 | 2018-03-23T09:41:07 | 2018-03-23T09:41:07 | 125,391,414 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 868 | java | import javax.swing.JOptionPane;
public class InterestCalculator {
public static void main(String[] args) {
double amount = Double.parseDouble(JOptionPane.showInputDialog("Please enter amount"));
double rate = Double.parseDouble(JOptionPane.showInputDialog("please enter percentage"));
int years = Integer.parseInt(JOptionPane.showInputDialog("How many years"));
calcLoan(years, amount, rate);
}
public static double[] calcLoan(int years, double amount, double rate){
double monthly;
double total;
double monthlyRate = (rate / 12)/100;
monthly = (amount * monthlyRate) / (1 - Math.pow(1 / (1 + monthlyRate),(years * 12)));
total = monthly * (years * 12);
JOptionPane.showMessageDialog(null, "Total = " + total + "\nMonthly = " + monthly);
double[] costs = new double[2];
costs[0] = monthly;
costs[1] = total;
return costs;
}
} | [
"david.osullivan5@students.ittralee.ie"
] | david.osullivan5@students.ittralee.ie |
d80b096e9e7bc23c24f320e159506ca5224ee178 | ee3cd33e386e55cb9baf4bbc1515a0f113987b0d | /src/test/java/com/fpq/acitvity/procdef/DeployProcdef.java | d1b021bae60f0c7220f47d53c5ee60e898599361 | [] | no_license | fupq/fpqActiviti | cca0b67e7c4c21be88f896677158c436ed38dfac | 1c8a2f48150d5da63356806bd25e9d9ffdc33ffb | refs/heads/master | 2020-03-25T18:22:14.561097 | 2018-08-19T10:34:22 | 2018-08-19T10:34:22 | 144,026,936 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,914 | java | /**
* 流程部署方式:1.addClass方式;2.zip流导入方式;
*/
package com.fpq.acitvity.procdef;
import static org.junit.jupiter.api.Assertions.*;
import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.repository.Deployment;
import org.junit.jupiter.api.Test;
import java.io.InputStream;
import java.util.zip.ZipInputStream;
/**
* @author fpq
*
*/
class DeployProcdef {
/**
* 通过默认方式获取工作流实例,会自动读取activiti.cfg.xml文件
*/
private ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
/**
* 部署工作流:addClass方式定义
* ACT_GE_BYTEARRAY (资源文件表)通用的流程定义和流程资源:存储流程定义的资源文件
* ACT_RE_DEPLOYMENT(部署信息表):用来存储部署时需要持久化保存下来的信息
* ACT_RE_PROCDEF(业务流程定义数据表:解析表):解析成功了,在该表保存一条记录。
* act_ge_property(系统配置表):dbid的取值会变化,记录指针
*/
@Test
public void deployWithAddClass() {
Deployment deployment = processEngine.getRepositoryService() //获取部署相关service
.createDeployment() //创建部署
.addClasspathResource("diagrams/activiti_applyLeave.bpmn") //加载工作流资源文件
.addClasspathResource("diagrams/activiti_applyLeave.png") //加载工作流资源文件
.name("请假审批工作流") //设置工作流程的名称
.deploy();//部署
System.out.println("流程部署ID:"+deployment.getId());
System.out.println("流程部署Name:"+deployment.getName());
}
/**
* 部署流程定义使用zip方式
* ACT_GE_BYTEARRAY (资源文件表)通用的流程定义和流程资源:存储流程定义的资源文件
* ACT_RE_DEPLOYMENT(部署信息表):用来存储部署时需要持久化保存下来的信息
* ACT_RE_PROCDEF(业务流程定义数据表:解析表):解析成功了,在该表保存一条记录。
* act_ge_property(系统配置表):dbid的取值会变化,记录指针
*/
@Test
public void deployWithZip(){
InputStream inputStream=this.getClass() // 取得当前class对象
.getClassLoader() // 获取类加载器
.getResourceAsStream("diagrams/activiti_applyLeave.zip"); // 获取指定文件资源流
ZipInputStream zipInputStream=new ZipInputStream(inputStream); // 实例化zip输入流
Deployment deployment=processEngine.getRepositoryService() // 获取部署相关Service
.createDeployment() // 创建部署
.addZipInputStream(zipInputStream) // 添加zip输入流
.name("请假审批工作流") // 流程名称
.deploy(); // 部署
System.out.println("流程部署ID:"+deployment.getId());
System.out.println("流程部署Name:"+deployment.getName());
}
}
| [
"850779566@qq.com"
] | 850779566@qq.com |
555643d9a929bec8e04cdc4120fca914e47d8b0d | eb167af618784cb7a311714c976fa2358b8fd1c9 | /tgi-api/src/main/java/com/example/tgiapi/model/Category.java | e0ef28d4a6b7c433683702cee2f3382a598c5394 | [] | no_license | PauloPimentel-github/token-authentication | a4180f2d8a0b3e2b207b9a4fb29890817d19712a | 4dcc8b63f9dca0304183cf2bb3c14df2fec954f5 | refs/heads/master | 2020-04-20T12:12:31.484732 | 2019-02-16T21:15:45 | 2019-02-16T21:15:45 | 168,837,319 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,342 | java | package com.example.tgiapi.model;
import java.util.Objects;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
@Entity
@Table(name = "categories")
public class Category {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "category_id")
private Long categoryId;
@Column(name = "category_name")
@NotNull
@Size(min = 3, max = 50)
private String categoryName;
public Long getCategoryId() {
return categoryId;
}
public void setCategoryId(Long categoryId) {
this.categoryId = categoryId;
}
public String getCategoryName() {
return categoryName;
}
public void setCategoryName(String categoryName) {
this.categoryName = categoryName;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Category category = (Category) o;
return Objects.equals(categoryId, category.categoryId);
}
@Override
public int hashCode() {
return Objects.hash(categoryId);
}
}
| [
"paulo.h.g.pimentel@gmail.com"
] | paulo.h.g.pimentel@gmail.com |
8ea4a2f8995dde4b4a2e5fe048011ed73007140c | a4b58f94ec48950ab733b51b2841c056f032fb6a | /Deneme2/src/tr/com/metasoft/CopyHeader.java | 5b902e9a82eeac70d3e5eefbb5229a45909164bb | [] | no_license | Gokcann/jpg2dicom | 4c868d234b7420042ba8ec1cdaaefc71289fa795 | b43e30ff3a64611e37bfc343c992afcf59daa679 | refs/heads/main | 2023-01-12T01:57:55.675790 | 2020-11-13T14:13:06 | 2020-11-13T14:13:06 | 301,664,722 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,953 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
//package org.dicom;
package tr.com.metasoft;
import org.dcm4che3.data.Attributes;
import org.dcm4che3.data.Tag;
import org.dcm4che3.data.UID;
import org.dcm4che3.data.VR;
import org.dcm4che3.io.DicomInputStream;
import org.dcm4che3.io.DicomOutputStream;
import java.io.File;
import java.io.IOException;
class Jpgdcm {
private static int jpgLen;
private String transferSyntax = UID.JPEGLossless;
public Jpgdcm(File file, File fileOutput) {
// try {
// //Mainden gelen jpg dosyasi jpegImage ismiyle bufferlaniyor
// jpgLen = (int) file.length();
// BufferedImage jpegImage = ImageIO.read(file);
// /*
// * We open a try block and then read our Jpeg into a BufferedImage through ImageIO.read() method. If this results in an invalid image so we may throw a new exception.
// * Else, we’ve got a valid image and therefore valuable information about it.
// * The BufferedImage class has a lot of useful methods for retrieving image data, then let’s save the number of color components (samples per pixel) of our image, the bits
// * per pixel and the bits allocated:
//
// */
// //exception kontrolu
// if (jpegImage == null) throw new Exception("Invalid file.");
//
//// DicomInputStream stream = new DicomInputStream(file);
//// Attributes att = null;
//// att.setString(Tag.SpecificCharacterSet, VR.CS, "ISO");
////
//// DicomOutputStream dos = new DicomOutputStream(fileOutput);
//
//
//
//
// /* We open a try block and then read our Jpeg into a BufferedImage through ImageIO.read() method.
// * If this results in an invalid image so we may throw a new exception.
// * Else, we’ve got a valid image and therefore valuable information about it.
// * The BufferedImage class has a lot of useful methods for retrieving image data,
// * then let’s save the number of color components (samples per pixel) of our image,
// * the bits per pixel and the bits allocated: */
//
// //jpg dosyamizin ozellikleri aliniyor
// int colorComponents = jpegImage.getColorModel().getNumColorComponents();
// int bitsPerPixel = jpegImage.getColorModel().getPixelSize();
// int bitsAllocated = (bitsPerPixel / colorComponents);
// int samplesPerPixel = colorComponents;
//
// /*It’s time to start building our Dicom dataset:*/
// //** Dicom dosyasinin verilerini (metadata) olusturmaya basliyoruz... **//
// Attributes dicom = new Attributes();
// dicom.setString(Tag.SpecificCharacterSet, VR.CS, "ISO_IR 100");
// dicom.setString(Tag.PhotometricInterpretation, VR.CS, samplesPerPixel == 3 ? "YBR_FULL_422" : "MONOCHROME2");
//
// /*The first line creates a new basic Dicom object defined by dcm4che2 toolkit.
// *The next one puts header information for Specific Character Set: ISO_IR 100 – it’s the same for ISO-8859-1 – the code for Latin alphabet.
// *Finally, the last line puts header information for photometric interpretation (read with or without colors).
// *So if our image has samples per pixel equals to 3, it has colors (YBR_FULL_422), else it’s a grayscale image (MONOCHROME2).
// The following lines add integer values to our Dicom header. Note that all of them comes from BufferedImage methods.
// These values are mandatory when encapsulating. For more information you can check Part 3.5 of Dicom Standard. */
//
// //Bu datalar jpg dosyasinin propertylerine gore sekilleniyor (orn: jpg dosyasinin yuksekligi, genisligi vs.)
// dicom.setInt(Tag.SamplesPerPixel, VR.US, samplesPerPixel);
// dicom.setInt(Tag.Rows, VR.US, jpegImage.getHeight());
// dicom.setInt(Tag.Columns, VR.US, jpegImage.getWidth());
// dicom.setInt(Tag.BitsAllocated, VR.US, bitsAllocated);
// dicom.setInt(Tag.BitsStored, VR.US, bitsAllocated);
// dicom.setInt(Tag.HighBit, VR.US, bitsAllocated-1);
// dicom.setInt(Tag.PixelRepresentation, VR.US, 0);
//
// /*Also, our Dicom header needs information about date and time of creation:*/
// dicom.setDate(Tag.InstanceCreationDate, VR.DA, new Date());
// dicom.setDate(Tag.InstanceCreationTime, VR.TM, new Date());
// /* Every Dicom file has a unique identifier.
// * Here we’re generating study, series and Sop instances UIDs.
// * You may want to modify these values, but you should to care about their uniqueness.
// */
// /**
// * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^!!!!!!!ONEMLİ!!!!!!!!^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// *
// * Burasi cok onemli: SOPCLassUID ile MediaStorageSOPClassUID ayni olmali!!!!!
// * Ayni sekilde SOPInstanceUID ile MediaStorageSOPInstanceUID ayni olmali!!!!!
// *
// * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// */
// dicom.setString(Tag.StudyInstanceUID, VR.UI, "1.2.840.20200805.162417.198.0.192168.010.10.20418");
// dicom.setString(Tag.SeriesInstanceUID, VR.UI, "1.2.840.20200805.162417.204.0.192168.010.10.20421");
// dicom.setString(Tag.SOPInstanceUID, VR.UI, "2.25.119224185080231306154911093447145543566");
// //dicom.setString(Tag.StudyInstanceUID, VR.UI, UIDUtils.createUID());
// //dicom.setString(Tag.SeriesInstanceUID, VR.UI, UIDUtils.createUID());
// //dicom.setString(Tag.SOPInstanceUID, VR.UI, UIDUtils.createUID());
// dicom.setInt(Tag.Rows, VR.US, jpegImage.getHeight());
// dicom.setInt(Tag.Columns, VR.US, jpegImage.getWidth());
//
// //Bu datalar disardan gelecek olan datalar (orn: tc kimlik numarasi, kisinin adi soyadi, study date/time vs..)
// dicom.setString(Tag.PatientID, VR.LO,"12345678900");
// dicom.setString(Tag.PatientName,VR.PN,"lionel messi");
// dicom.setString(Tag.PatientBirthDate, VR.DA, "19520812");
// dicom.setString(Tag.PatientSex, VR.CS, "M");
// dicom.setString(Tag.StudyDate, VR.DA, "20200612");
// dicom.setString(Tag.StudyTime, VR.TM, "103009.000000");
// dicom.setString(Tag.ReferringPhysicianName, VR.PN, "eskisehir2ADSM");
// dicom.setString(Tag.StudyID, VR.SH, "10");
// dicom.setString(Tag.AccessionNumber, VR.SH, "1498305");
// dicom.setString(Tag.SeriesNumber, VR.IS, "1");
// dicom.setString(Tag.Manufacturer, VR.LO, "eskisehirdeneme");
// dicom.setString(Tag.InstanceNumber, VR.IS, "2");
// dicom.setString(Tag.Modality, VR.CS, "XC");
// dicom.setString(Tag.ImageType, VR.CS, "ORIGINAL/PRIMARY//0001");
// dicom.setString(Tag.LossyImageCompression, VR.CS);
// dicom.setString(Tag.PatientOrientation, VR.CS,"LE");
// dicom.setString(Tag.QueryRetrieveLevel, VR.CS,"STUDY");
// dicom.setString(Tag.CreationDate, VR.CS,"STUDY");
// //dicom.setString(Tag.AcquisitionContextSequence, VR.SQ, "0");
//
// //new attributes // FileMetaInformationVersion arastirilacak string degil binary veri aliyor...
// //dicom.setString(Tag.FileMetaInformationVersion, VR.OB,"AAE=");
// dicom.setInt(Tag.FileMetaInformationVersion, VR.OB, 00020002);
// dicom.setString(Tag.SOPClassUID, VR.UI, "1.2.840.10008.5.1.4.1.1.7");
// dicom.setString(Tag.SeriesDate, VR.DA, "20200805");
// dicom.setString(Tag.ContentDate, VR.DA, "20200805");
// dicom.setString(Tag.ContentTime, VR.TM, "162417.174000");
// dicom.setString(Tag.InstitutionName, VR.LO, "BALGATADSM");
// dicom.setString(Tag.PlanarConfiguration, VR.US, "0");
//
//
//
//
//
//
// /*
// DataBufferByte buff = (DataBufferByte) jpegImage.getData().getDataBuffer();
// byte[] data = buff.getData();
// dicom.setBytes(Tag.PixelData, VR.OB, data);
// dicom.writeTo(dos);
// */
//
// //dicom.setString(Tag.PerformingPhysicianName, VR.PN, "Jean");
// //dicom.setString(Tag.AdmittingDiagnosesDescription, VR.LO, "CHU");
// //Sequence seq= dicom.newSequence(Tag.AnatomicRegionSequence,0);
// //Attributes dicom2 = new Attributes();
//
// //dicom2.setString(Tag.CodingSchemeDesignator, VR.SH, "SRT");
// //dicom2.setString(Tag.CodeValue, VR.SH, "T-AA000");
// //dicom2.setString(Tag.CodeMeaning, VR.LO, "Eye");
// //seq.add(dicom2);
//
//
//
//
//
// /*Our Dicom header is almost done.
// * The following command initiates Dicom metafile information considering JPEGBaseline1 as transfer syntax.
// * This means this file has Jpeg data encapsulated instead common medical image pixel data.
// * The most common Jpeg files use a subset of the Jpeg standard called baseline Jpeg.
// * A baseline Jpeg file contains a single image compressed with the baseline discrete cosine transformation (DCT) and Huffman encoding.
// */
// // dicom.initFileMetaInformation(UID.JPEGBaseline1);
// /*After initiate the header we can open an output stream for saving our Dicom dataset as follows:*/
//
// Attributes fmi = new Attributes();
//
// /**
// * .createUID olanlari dcm4che kendisi otomatik yaratiyor bunun yerine bu veriler
// * "Media Storage Standard SOP Classes" tarafindan atanmali yani buyuk ihtimalle modalite cihazindan gelecek bu veri.
// */
// //fmi.setString(Tag.ImplementationVersionName, VR.SH, "dcm4che-5.22.2");
// //fmi.setString(Tag.ImplementationClassUID, VR.UI, "1.2.40.0.13.1.3");
// //fmi.setString(Tag.TransferSyntaxUID, VR.UI, "1.2.840.10008.1.2.1");
// fmi.setString(Tag.MediaStorageSOPClassUID, VR.UI, "1.2.840.10008.5.1.4.1.1.7");
// fmi.setString(Tag.MediaStorageSOPInstanceUID, VR.UI, "2.25.119224185080231306154911093447145543566");
// //fmi.setString(Tag.FileMetaInformationVersion, VR.OB, "1");
// //fmi.setInt(Tag.FileMetaInformationGroupLength, VR.UL, dicom.size()+fmi.size());
// fmi.setString(Tag.ImplementationVersionName, VR.SH, "DCM4CHE3");
// fmi.setString(Tag.ImplementationClassUID, VR.UI, UIDUtils.createUID());
// fmi.setString(Tag.TransferSyntaxUID, VR.UI, transferSyntax);
// //fmi.setString(Tag.MediaStorageSOPClassUID, VR.UI, transferSyntax);
// //fmi.setString(Tag.MediaStorageSOPInstanceUID, VR.UI,UIDUtils.createUID());
// fmi.setString(Tag.FileMetaInformationVersion, VR.OB, "1");
// fmi.setInt(Tag.FileMetaInformationGroupLength, VR.UL, dicom.size()+fmi.size());
//
// DicomOutputStream dos = new DicomOutputStream(fileOutput);
// dos.writeDataset(fmi, dicom);
// dos.writeHeader(Tag.PixelData, VR.OB, -1);
//
// //ekleme
// //dicom.writeTo(dos);
// /*
// * The Item Tag (FFFE,E000) is followed by a 4 byte item length field encoding the explicit number of bytes of the item.
// * The first item in the sequence of items before the encoded pixel data stream shall be a basic item with length equals to zero:
// */
// dos.writeHeader(Tag.Item, null, 0);
// /*The next Item then keeps the length of our Jpeg file. */
// /*
// According to Gunter from dcm4che team we have to take care that
// the pixel data fragment length containing the JPEG stream has
// an even length.
// */
//
// dos.writeHeader(Tag.Item, null, (jpgLen+1)&~1);
// /* Now all we have to do is to fill this item with bytes taken from our Jpeg file*/
// FileInputStream fis = new FileInputStream(file);
// BufferedInputStream bis = new BufferedInputStream(fis);
// DataInputStream dis = new DataInputStream(bis);
//
// byte[] buffer = new byte[65536];
// int b;
// while ((b = dis.read(buffer)) > 0) {
// dos.write(buffer, 0, b);
// }
// /*Finally, the Dicom Standard tells that we have to put a last Tag:
// * a Sequence Delimiter Item (FFFE,E0DD) with length equals to zero.*/
//
//
// if ((jpgLen&1) != 0) dos.write(0);
// dos.writeHeader(Tag.SequenceDelimitationItem, null, 0);
// dos.close();
//
//
//
//
// } catch (Exception e) {
//
// e.printStackTrace();
// }
}
public void modifyTag() {
String pathFile ="C:\\a\\1.2.840.10008.114368.120408.1.1.72515569.20201113.90838000.dcm";
String accessionNumber = "1021189";
try {
File file = new File(pathFile);
DicomInputStream dis = new DicomInputStream(file);
Attributes fmi = dis.readFileMetaInformation();
Attributes attrs = dis.readDataset(-1,-1);
//Let's modify the patient name tag
attrs.setString(Tag.AccessionNumber, VR.SH, accessionNumber);
DicomOutputStream dos = new DicomOutputStream(file);
dos.writeDataset(fmi, attrs);
dos.flush();
dos.close();
}
catch(IOException e) {
e.printStackTrace();
}
}
}
| [
"gokcan.akoya@gmail.com"
] | gokcan.akoya@gmail.com |
7b6922346f0ebe5f1b0ab98cf94740772e52be1b | b737fe394724943cee42dc5b087fceb6103d35d9 | /app/src/main/java/com/mpi/root/mpi/Monitoring.java | efc7f619bd05ca5051341335c5b8f996939c7792 | [] | no_license | jokermt235/mpi | 0fec95a5b929eed582fb593ca487eff0cac90ed7 | 752bc42fc011b39ce60e1e0b400a8b727c33ce8c | refs/heads/master | 2021-01-10T09:21:54.763149 | 2015-08-11T10:48:00 | 2015-08-11T10:48:00 | 36,117,823 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 196 | java | package com.mpi.root.mpi;
/**
* Created by root on 5/23/15.
*/
/*
Monitoring class uses to do device
state, track state, system configuration.
*/
public class Monitoring extends Settings {
}
| [
"jokermt2357@gmail.com"
] | jokermt2357@gmail.com |
603b0c2bd30e53d5b342d88f7d83f490ce6b9191 | 97f1da04eaafa6d4256bb45d79d50477e564e612 | /src/main/java/me/jy/rds/common/base/EUTreeGridResult.java | c9be76f16541903fc8ee3ed8aa44c6eda26c8487 | [] | no_license | shuzhuoi/rds-sys-line | b0c4a399d8897f506f8ad5b729f60b2fcdfc73b7 | 9537333b254306a201b8ac98ea4caec47a273d47 | refs/heads/master | 2021-09-25T14:57:56.500870 | 2018-10-23T07:26:58 | 2018-10-23T07:26:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 579 | java | package me.jy.rds.common.base;
import java.util.List;
public class EUTreeGridResult extends BaseResult {
private long total;
private List<?> rows;
public EUTreeGridResult() {
}
public EUTreeGridResult(long total, List<?> rows) {
this.total = total;
this.rows = rows;
}
public long getTotal() {
return total;
}
public void setTotal(long total) {
this.total = total;
}
public List<?> getRows() {
return rows;
}
public void setRows(List<?> rows) {
this.rows = rows;
}
} | [
"1657428854@qq.com"
] | 1657428854@qq.com |
f6c79b225ff99345f30d0aee883294a196fbb4b9 | 597f7b5de9e73300db4d383e6c9f0f1f283afb1f | /src/CospaceOnlineAjaxSpring/src/grass/tree/util/FTPUtil.java | fc0024658848ee9804fcb5059764735c16a46aad | [] | no_license | figo645/cospace | 1bee56a761c707c8105ad406bc7a3cbd7fcfff48 | 046b28c48f0dd4af74063191fc805951932dceb0 | refs/heads/master | 2020-05-19T13:45:44.515226 | 2015-08-24T05:48:03 | 2015-08-24T05:48:03 | 41,281,532 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 6,686 | java | package grass.tree.util;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import sun.net.ftp.FtpClient;
/**
*
* @author xcf
* @version 1.0
*
* 2008-02-19
*
*/
public class FTPUtil {
private String ip = "web337788.host89.chinajsp.net";
private String username = "web337788";
private String password = "q0p6d6b2";
private String ftpDir = "/ROOT/images";
private String localFileFullName = "";// 待上传的文件全名
private String ftpFileName = ""; // 文件上传到FTP后的名称
FtpClient ftpClient = null;
OutputStream os = null;
FileInputStream is = null;
public static void main(String[] args) {
String ip = "web337788.host89.chinajsp.net";
String user = "web337788";
String password = "q0p6d6b2";
String ftpDir = "/ROOT/images";
FTPUtil ftp = new FTPUtil(ip, user, password, ftpDir);
for (int i=0;;i++){
try {
Thread.sleep(70000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try{
String returnStr = ftp.upload("d://6.jpg");
System.out.println(returnStr);
}catch(Exception e){
break;
}
}
}
public FTPUtil(){
ip = this.ip;
username = this.username;
password = this.password;
ftpDir = this.ftpDir;
localFileFullName = this.localFileFullName;
ftpFileName = this.ftpFileName;
}
public FTPUtil(String serverIP, String username, String password,
String ftpDir) {
this.ip = serverIP;
this.username = username;
this.password = password;
if (ftpDir == null) {
this.ftpDir = "/ftpfileload";
} else {
try {
this.ftpDir = "/"
+ new String(ftpDir.getBytes("ISO-8859-1"), "GBK")
.toString();
} catch (UnsupportedEncodingException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}
}
}
private void createDir(String dir, FtpClient ftpClient) {
System.out.println(this.ftpDir);
ftpClient.sendServer("MKD " + dir + "\r\n");
try {
ftpClient.readServerResponse();
} catch (IOException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}
}
private Boolean isDirExist(String dir, FtpClient ftpClient) {
try {
ftpClient.cd(dir);
} catch (Exception e) {
// TODO 自动生成 catch 块
return false;
}
return true;
}
/**
* New Upload
* @param input
* @param localFileFullName
* @return
*/
public String upload(InputStream input,String localFileFullName){
// 获取文件后缀名
String ext = localFileFullName.substring(localFileFullName
.lastIndexOf("."));
// System.out.println(ext);
// 产生新文件名,用系统当前时间+文件原有后缀名
long newFileName = System.currentTimeMillis();
String newFileFullName = newFileName + ext;
// System.out.println("new file name:"+newFileFullName);
this.ftpFileName = newFileFullName;
try {
String savefilename = new String(localFileFullName
.getBytes("ISO-8859-1"), "GBK");
// 新建一个FTP客户端连接
ftpClient = new FtpClient();
ftpClient.openServer(this.ip);
ftpClient.login(this.username, this.password);
// 判断并创建目录
if (!isDirExist(this.ftpDir, ftpClient)) {
createDir(this.ftpDir, ftpClient);
}
ftpClient.cd(this.ftpDir);// 切换到FTP目录
ftpClient.binary();
os = ftpClient.put(this.ftpFileName);
// 打开本地待长传的文件
// File file_in = new File(savefilename);
//is = new FileInputStream(input);
//is = (FileInputStream) input;
byte[] bytes = new byte[1024];
// 开始复制
int c;
// 暂未考虑中途终止的情况
while ((c = input.read(bytes)) != -1) {
os.write(bytes, 0, c);
}
} catch (Exception e) {
e.printStackTrace();
System.err.println("Exception e in Ftp upload(): " + e.toString());
} finally {
try {
if (input != null) {
input.close();
}
if (os != null) {
os.close();
}
if (ftpClient != null) {
ftpClient.closeServer();
}
} catch (Exception e) {
System.err.println("Exception e in Ftp upload() finally"
+ e.toString());
}
}
return this.ftpFileName;
}
public String upload(String localFileFullName) {
// this.ftpFileName = "aaa.test";
// 获取文件后缀名
String ext = localFileFullName.substring(localFileFullName
.lastIndexOf("."));
// System.out.println(ext);
// 产生新文件名,用系统当前时间+文件原有后缀名
long newFileName = System.currentTimeMillis();
String newFileFullName = newFileName + ext;
// System.out.println("new file name:"+newFileFullName);
this.ftpFileName = newFileFullName;
try {
String savefilename = new String(localFileFullName
.getBytes("ISO-8859-1"), "GBK");
// 新建一个FTP客户端连接
ftpClient = new FtpClient();
ftpClient.openServer(this.ip);
ftpClient.login(this.username, this.password);
// 判断并创建目录
if (!isDirExist(this.ftpDir, ftpClient)) {
createDir(this.ftpDir, ftpClient);
}
ftpClient.cd(this.ftpDir);// 切换到FTP目录
ftpClient.binary();
os = ftpClient.put(this.ftpFileName);
// 打开本地待长传的文件
File file_in = new File(savefilename);
is = new FileInputStream(file_in);
byte[] bytes = new byte[1024];
// 开始复制
int c;
// 暂未考虑中途终止的情况
while ((c = is.read(bytes)) != -1) {
os.write(bytes, 0, c);
}
} catch (Exception e) {
e.printStackTrace();
System.err.println("Exception e in Ftp upload(): " + e.toString());
} finally {
try {
if (is != null) {
is.close();
}
if (os != null) {
os.close();
}
if (ftpClient != null) {
ftpClient.closeServer();
}
} catch (Exception e) {
System.err.println("Exception e in Ftp upload() finally"
+ e.toString());
}
}
return this.ftpFileName;
}
public void delFile(String dir, String filename) {
ftpClient = new FtpClient();
try {
ftpClient.openServer(this.ip);
ftpClient.login(this.username, this.password);
if (dir.length() > 0) {
ftpClient.cd(dir);
}
ftpClient.sendServer("DELE " + filename + "\r\n");
ftpClient.readServerResponse();
} catch (IOException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}
}
}
| [
"figo645@126.com"
] | figo645@126.com |
4426201c28a0a369009c4c0ac6726b9306aa8d09 | c0948db7ff7958d7c3c9543b223c744df4864b6e | /AdditionCorrugated/ACFood/Block/BlockBlueberryPlant.java | 5afee4258cef6cf2b824dc806da4934ace212769 | [] | no_license | mochida/AdditionCorrugated_MC1.7.10 | 17b88abbf54526e5d533dd309e9443cf747a7a7d | 21d4463feb249086a5beaebb24e009b1d9d03ed6 | refs/heads/master | 2021-01-02T09:37:20.857120 | 2015-09-30T11:07:25 | 2015-09-30T11:07:25 | 27,947,187 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,815 | java | package AdditionCorrugated.ACFood.Block;
import java.util.Random;
import AdditionCorrugated.ACFood.Item.*;
import cpw.mods.fml.relauncher.*;
import net.minecraft.block.*;
import net.minecraft.client.renderer.texture.*;
import net.minecraft.item.*;
import net.minecraft.util.*;
import net.minecraft.world.*;
import net.minecraftforge.common.*;
public class BlockBlueberryPlant extends BlockCrops
{
@SideOnly(Side.CLIENT)
private IIcon[] icon;
public BlockBlueberryPlant()
{
super();
setBlockName("BlockBlueberryPlant");
setStepSound(soundTypeGrass);
}
@Override
public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z)
{
return EnumPlantType.Crop;
}
@Override
public int quantityDropped(int meta, int fortune, Random random)
{
if (meta == 5 || meta == 6)
{
int ret = 1;
for (int n = 0; n < 3 + fortune; n++)
{
if (random.nextInt(15) <= meta)
{
ret++;
}
}
return ret;
}
else
{
return 1;
}
}
@Override
public Item getItemDropped(int par1, Random par2random, int par3)
{
if (par1 >= 7)
{
return this.func_149865_P();
}
else
{
return this.func_149866_i();
}
}
@Override
protected Item func_149865_P()
{
return Items.Blueberry;
}
@Override
protected Item func_149866_i()
{
return Item.getItemFromBlock(Blocks.BlueberryPlant);
}
@Override
public IIcon getIcon(int par1, int par2)
{
if (par2 < 5)
{
return this.icon[par2 >> 1];
}
else if (par2 < 7)
{
return this.icon[3];
}
else
{
return this.icon[4];
}
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister par1)
{
icon = new IIcon[5];
for (int i = 0; i < this.icon.length; ++i)
{
this.icon[i] = par1.registerIcon("additioncorrugated:bbplant" + i);
}
}
} | [
"mochida.minecraft.mod@gmail.com"
] | mochida.minecraft.mod@gmail.com |
04d0386a6d006272ea98f51c8ee165b434545ec3 | 007da508c6605230b2c8c39f62d089657707aa12 | /Heaps/src/App.java | 956ebdf2c939db25302b377f01db2961d638e1f2 | [] | no_license | CuriousNikhil/data-structures | 110337d7415c0efd7043ab60eb21cf2ba3d34cac | 310cd8e8803e262c252c4c63c5138ffbf6119d51 | refs/heads/master | 2021-05-09T22:32:03.213083 | 2018-03-09T06:06:23 | 2018-03-09T06:06:23 | 118,756,752 | 7 | 0 | null | null | null | null | UTF-8 | Java | false | false | 402 | java | public class App {
public static void main(String[] a){
Heap heap = new Heap(10);
heap.insert(5);
heap.insert(2);
heap.insert(1);
heap.insert(10);
heap.insert(15);
System.out.println(heap.getMax());
System.out.println(heap.getMax());
System.out.println(heap.getMax());
System.out.println(heap.getMax());
}
}
| [
"nikhyl777@gmail.com"
] | nikhyl777@gmail.com |
0a0c2e2218ab32517553c271df40c157b1b1a15b | 9ec5fde69bc9e46a7fee61931708cffaa60ec5c8 | /src/test/java/com/medplum/fhir/r4/types/MolecularSequenceInnerTest.java | c7a34814200c0524246d3077c5456c7645357ab4 | [] | no_license | Monkfire/medplum-java-sdk | 588b942f2b1bff0ece98370a0080127f2d605d63 | 15bdb87e1dd7bc4eb0aca47bfc4fbb67a7d0a4d1 | refs/heads/main | 2023-08-23T22:09:56.169272 | 2021-08-08T19:14:55 | 2021-08-08T19:14:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,883 | java | /*
* Generated by com.medplum.generator.Generator
* Do not edit manually.
*/
package com.medplum.fhir.r4.types;
import static org.junit.jupiter.api.Assertions.*;
import jakarta.json.Json;
import org.junit.Test;
public class MolecularSequenceInnerTest {
@Test
public void testConstructor() {
assertNotNull(new MolecularSequence.MolecularSequenceInner(Json.createObjectBuilder().build()));
}
@Test
public void testBuilderFromJsonObject() {
assertNotNull(MolecularSequence.MolecularSequenceInner.create(Json.createObjectBuilder().build()).build());
}
@Test
public void testCopyAll() {
final MolecularSequence.MolecularSequenceInner x = MolecularSequence.MolecularSequenceInner.create().build();
final MolecularSequence.MolecularSequenceInner y = MolecularSequence.MolecularSequenceInner.create().copyAll(x).build();
assertEquals(x, y);
}
@Test
public void testId() {
assertEquals("x", MolecularSequence.MolecularSequenceInner.create().id("x").build().id());
}
@Test
public void testExtension() {
final java.util.List<Extension> value = java.util.Collections.emptyList();
assertEquals(value, MolecularSequence.MolecularSequenceInner.create().extension(value).build().extension());
}
@Test
public void testModifierExtension() {
final java.util.List<Extension> value = java.util.Collections.emptyList();
assertEquals(value, MolecularSequence.MolecularSequenceInner.create().modifierExtension(value).build().modifierExtension());
}
@Test
public void testStart() {
assertEquals(1, MolecularSequence.MolecularSequenceInner.create().start(1).build().start());
}
@Test
public void testEnd() {
assertEquals(1, MolecularSequence.MolecularSequenceInner.create().end(1).build().end());
}
}
| [
"cody@ebberson.com"
] | cody@ebberson.com |
e5cd0af74921649dbc84b2eb890c834337f11fff | 0bdcbfab025e0885eb5e0c8886dafed8792f1674 | /TallerII/TallerII/src/Grafica/controladora/ControladoraPartidaJugador.java | 849b9400a644f9657423b16636d69704913126fc | [] | no_license | topablit31/Taller-II-UDE | bacccaf38c8f2d4f1d0bacdd9886817db594fce1 | b27c67a061494b69c80305ac27f422897b3d219d | refs/heads/master | 2021-01-06T17:04:54.135564 | 2020-03-11T01:46:55 | 2020-03-11T01:46:55 | 241,241,231 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,581 | java | package Grafica.controladora;
import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import javax.swing.JOptionPane;
import Grafica.Jugador.FrmPartidaJugador;
import Logica.IFachada;
import Logica.JugadorException;
import ValueObjects.VOJugadorLogin;
import ValueObjects.VOPartida;
import ValueObjects.VOPartidaEsMayorMenor;
public class ControladoraPartidaJugador {
private FrmPartidaJugador vista;
private IFachada fachada;
public ControladoraPartidaJugador(FrmPartidaJugador vista) {
this.vista = vista;
try {
fachada = (IFachada) Naming.lookup("//localhost:1099/fachada");
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
JOptionPane.showMessageDialog(null, e.getMessage());
e.printStackTrace();
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (NotBoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void abandonarPartida(VOJugadorLogin credencial) {
try {
fachada.abandonarPartida(credencial);
vista.abandonar();
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (JugadorException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void iniciarNuevaPartida(VOJugadorLogin credencial) {
try {
fachada.iniciarNuevaPartida(credencial);
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (JugadorException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void realizarUnIntento(VOJugadorLogin credencial, int numero) {
VOPartidaEsMayorMenor respuesta=null;
try {
respuesta= fachada.realizarUnIntento(credencial, numero);
if(respuesta.isFinalizada())
vista.gano();
else
vista.mostrarResultado(respuesta);
} catch (RemoteException e) {
vista.errorMensaje("Problema de conexion");
e.printStackTrace();
} catch (JugadorException e) {
vista.errorMensaje(e.getMensaje());
e.printStackTrace();
} catch (InterruptedException e) {
vista.errorMensaje(e.getMessage());
e.printStackTrace();
}
}
}
| [
"compu31@gmail.com"
] | compu31@gmail.com |
6977786f7c9136a4a94a6c58331f1dcf134c74c7 | 19eb5064e0072e2f80ebd4a6fb016c064c6f18ee | /Lista1/src/br/edu/fatecfranca/ex3/Produto.java | 9ff74e1e5c22df5e2f7fa785fda14940156f7aca | [] | no_license | felipefontelas/java-POO-fsf | 772ec5a6c523cd75b1bc7c1673de4764c4560b98 | 44a4dab2965a17b529c47a8b63cd926235b5a088 | refs/heads/master | 2021-07-16T05:23:14.380172 | 2017-10-22T18:09:21 | 2017-10-22T18:09:21 | 107,890,207 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 703 | java | package br.edu.fatecfranca.ex3;
public class Produto {
public int id;
public String descricao;
public int qtde;
public float preco;
public Produto(int id, String descricao, int qtde, float preco) {
this.id = id;
this.descricao = descricao;
this.qtde = qtde;
this.preco = preco;
}
public Produto() {
}
public void comprar(int x) {
this.qtde += x;
}
public void vender(int x) {
this.qtde -= x;
}
public void subir(float x) {
this.preco += x;
}
public void descer(float x) {
this.preco -= x;
}
public String mostrar() {
return "ID: " + this.id +
"\nDescricão: " + this.descricao +
"\nQuantidade: " + this.qtde +
"\nPreço: " + this.preco;
}
}
| [
"noreply@github.com"
] | felipefontelas.noreply@github.com |
0d3483ef5103d808d701301e69a27f54389c3272 | 40a0f546bcf56cee5bce681fe173580c15f4066f | /bundles/org.scribble.infinispan/src/main/java/org/scribble/infinispan/osgi/Activator.java | 700647a68e5a981c7d14a713f28a3947ac364f6f | [] | no_license | objectiser/sgl | 6f141f95878e63fd99f88e91ff69c4ae40be20b6 | 1f2c97bd31f84042dff72ca967a26d525582ce2c | refs/heads/master | 2016-09-10T22:41:05.756757 | 2011-03-25T22:21:24 | 2011-03-25T22:21:24 | 1,527,516 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 759 | java | package org.scribble.infinispan.osgi;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
public class Activator implements BundleActivator {
private static BundleContext context;
static BundleContext getContext() {
return context;
}
/*
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext bundleContext) throws Exception {
Activator.context = bundleContext;
org.infinispan.Cache<String, String> cache=null;
}
/*
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext bundleContext) throws Exception {
Activator.context = null;
}
}
| [
"gary@pi4tech.com"
] | gary@pi4tech.com |
75995555fdd6a8dec2a3d0e9bc12de337d8298dd | 3c94f02a8c2d3b2219ea1062dc77ae134e6129d3 | /src/streams/StatelessStatefulOp.java | 43fb977b4dca7b49965448392314c6fcbf4a6359 | [] | no_license | cascandaliato/functional-reactive-java-udemy | 4e132ac017028bc860a1793361ca93c3d28e97d2 | 0c61ca6f25f8f9be08f67d26ef8995cb20b2d674 | refs/heads/main | 2023-03-01T23:47:37.747996 | 2021-02-09T07:34:56 | 2021-02-09T07:34:56 | 313,859,202 | 0 | 0 | null | 2021-01-06T19:43:31 | 2020-11-18T07:43:24 | Java | UTF-8 | Java | false | false | 348 | java | package streams;
import java.util.List;
import java.util.stream.Collectors;
public class StatelessStatefulOp {
public static void main(String[] args) {
List<Integer> list = List.of(1, 2, 4, 5, 6, 7, 9);
List<Integer> collect = list.parallelStream().skip(2).limit(5).collect(Collectors.toList());
System.out.println(collect);
}
}
| [
"8927157+cascandaliato@users.noreply.github.com"
] | 8927157+cascandaliato@users.noreply.github.com |
29f39b516f4cd072d3af3813b954f9000d5f68ab | af96ba86c63a327cbe6bb3cccd89b92c919cbdf7 | /Builder/src/builder/PizzaBuilderDemo.java | 3b259745af930cf6339efc3017dae4faa3e0499b | [] | no_license | Uridel/DesignPatternBuilder | b586461982c7306573b645a6eea77007aa1ca672 | 2c65ac4ecdc50c5610105f5998e38badeee230d0 | refs/heads/master | 2021-06-18T07:46:25.460383 | 2017-05-29T18:57:52 | 2017-05-29T18:57:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,899 | 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 builder;
/* "Product" */
class Pizza {
private String dough = "";
private String sauce = "";
private String topping = "";
private String pizzaType = "";
public void setDough(String dough) {
this.dough = dough;
}
public void setSauce(String sauce) {
this.sauce = sauce;
}
public void setTopping(String topping) {
this.topping = topping;
}
public void setPizzaType(String pizzaType){
this.pizzaType = pizzaType;
}
public String getPizzaType(){
return pizzaType;
}
}
/* "Abstract Builder" */
abstract class PizzaBuilder {
protected Pizza pizza;
public Pizza getPizza() {
return pizza;
}
public void createNewPizzaProduct() {
pizza = new Pizza();
}
public abstract void buildDough();
public abstract void buildSauce();
public abstract void buildTopping();
public abstract void declarePizza();
}
/* "ConcreteBuilder" */
class HawaiianPizzaBuilder extends PizzaBuilder {
public void buildDough() {
pizza.setDough("cross");
}
public void buildSauce() {
pizza.setSauce("mild");
}
public void buildTopping() {
pizza.setTopping("ham+pineapple");
}
public void declarePizza(){
pizza.setPizzaType("Hawai");
}
}
/* "ConcreteBuilder" */
class SpicyPizzaBuilder extends PizzaBuilder {
public void buildDough() {
pizza.setDough("pan baked");
}
public void buildSauce() {
pizza.setSauce("hot");
}
public void buildTopping() {
pizza.setTopping("pepperoni+salami");
}
public void declarePizza(){
pizza.setPizzaType("Spicy");
}
}
/* "Director" */
class Waiter {
private PizzaBuilder pizzaBuilder;
public void setPizzaBuilder(PizzaBuilder pb) {
pizzaBuilder = pb;
}
public Pizza getPizza() {
return pizzaBuilder.getPizza();
}
public void constructPizza() {
pizzaBuilder.createNewPizzaProduct();
pizzaBuilder.buildDough();
pizzaBuilder.buildSauce();
pizzaBuilder.buildTopping();
pizzaBuilder.declarePizza();
}
}
/* A customer ordering a pizza. */
public class PizzaBuilderDemo {
public static void main(String[] args) {
Waiter waiter = new Waiter();
PizzaBuilder hawaiianPizzabuilder = new HawaiianPizzaBuilder();
PizzaBuilder spicyPizzaBuilder = new SpicyPizzaBuilder();
waiter.setPizzaBuilder( hawaiianPizzabuilder );
waiter.constructPizza();
Pizza pizza = waiter.getPizza();
System.out.println(pizza.getPizzaType());
}
}
| [
"lion.drie@gmail.com"
] | lion.drie@gmail.com |
dd8eb59994200dafcd912f6ace3ed20c69175c01 | be73270af6be0a811bca4f1710dc6a038e4a8fd2 | /crash-reproduction-moho/results/XWIKI-12798-58-9-MOEAD-WeightedSum:TestLen:CallDiversity/org/xwiki/velocity/internal/DefaultVelocityEngine_ESTest.java | 697e571a6a43402d5838adecf35a831ed0e4cc7a | [] | no_license | STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application | cf118b23ecb87a8bf59643e42f7556b521d1f754 | 3bb39683f9c343b8ec94890a00b8f260d158dfe3 | refs/heads/master | 2022-07-29T14:44:00.774547 | 2020-08-10T15:14:49 | 2020-08-10T15:14:49 | 285,804,495 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 576 | java | /*
* This file was automatically generated by EvoSuite
* Wed Apr 08 21:03:21 UTC 2020
*/
package org.xwiki.velocity.internal;
import org.junit.Test;
import static org.junit.Assert.*;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(useVFS = true, useJEE = true)
public class DefaultVelocityEngine_ESTest extends DefaultVelocityEngine_ESTest_scaffolding {
@Test
public void notGeneratedAnyTest() {
// EvoSuite did not generate any tests
}
}
| [
"pouria.derakhshanfar@gmail.com"
] | pouria.derakhshanfar@gmail.com |
4d7175ea6684dce9c0a8603647b0fb6ef36c2943 | f5da3b63b734426b8e0807b95be15eee5e732177 | /src/zapposAPI/Product.java | cd6fb6d04d6af6c5d270328f035d70a2caf5a54a | [] | no_license | vinodhsa/ZapposApi | fec500e21fdcc7de63188069f8185f21a066113f | 76bd8a4c84bef7fd1cc69efd6c1d9a2082777bac | refs/heads/master | 2021-01-02T09:21:47.448559 | 2014-03-04T07:31:18 | 2014-03-04T07:31:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 745 | java | //
// Complete structure of a product
// Vinodh Sankaravadivel,USC
//
package zapposAPI;
import org.json.simple.*;
public class Product {
private double price;
private String id;
private String name;
private String styleId;
private String priceString;
public Product(JSONObject product)
{
price = Double.parseDouble(((String) product.get("price")).substring(1));
id = (String)product.get("productId");
name = (String)product.get("productName");
styleId = (String)product.get("styleId");
priceString = String.format("%.2f", price);
}
public String toString()
{
return name + ", $" + priceString + " (id:" + id + ", styleId:" + styleId + ")";
}
public double getPrice()
{
return price;
}
}
| [
"vinodhsa@usc.edu"
] | vinodhsa@usc.edu |
3d5191b2749aabbe20cde8eec56123b8ea233c0e | fff9f577e91b9f776976a944e513b6c846ce90b6 | /backend/liliyun/intapi/src/main/java/cn/com/liliyun/finance/model/FinanceReceipt.java | 415dcfe02be2607ef256c6c947182aeee2d41f2c | [] | no_license | lucifax301/clouddrive | 509adf99fbe65b2f3d009c06833e42bcb3a95167 | 3b2a58d10a2bef00526b03fd88278352ccb92b8c | refs/heads/master | 2021-09-14T13:57:25.739400 | 2018-05-14T15:37:26 | 2018-05-14T15:37:26 | 118,482,156 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 15,327 | java | package cn.com.liliyun.finance.model;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.jeecgframework.poi.excel.annotation.Excel;
import cn.com.liliyun.common.model.BaseModel;
public class FinanceReceipt extends BaseModel{
private static final long serialVersionUID = 1L;
private Integer id;
private Integer areaid;
private Integer storeid;
private Integer studentid;
@Excel(name = "学员姓名")
private String stuname;
@Excel(name = "身份证号")
private String stuidcard;
@Excel(name = "班别")
private String classinfo;
@Excel(name = "车型")
private String traintype;
private Date signupdate;
@Excel(name = "实际报名费用")
private BigDecimal signupcost;
private Integer type;
@Excel(name = "收据编号")
private String receiptnum;
@Excel(name = "收据日期", exportFormat = "yyyy-MM-dd")
private Date receiptdate;
@Excel(name = "收据金额")
private BigDecimal receiptmoney;
private BigDecimal cashmoney;
private Integer posid;
private String posnum;
private String poscompany;
private BigDecimal posmoney;
private Byte invoicetype;
@Excel(name = "发票名")
private String invoicename;
@Excel(name = "发票号")
private String invoicenum;
@Excel(name = "开票金额")
private BigDecimal invoicemoney;
@Excel(name = "发票日期")
private Date invoicedate;
private Byte isinvoice;
private Byte invoicestate;
private Integer state1uid;
private Date state1date;
private String state1name;
private Integer state2uid;
private Date state2date;
private String state2name;
private Integer state3uid;
private Date state3date;
private String state3name;
private Integer state4uid;
private Date state4date;
private String state4name;
@Excel(name = "批次号")
private String batchnum;
@Excel(name = "修改申请状态", replace = {"未申请_0","已申请未处理_1","已同意未修改_2","已处理未同意_3","已同意已修改_4"})
private Byte modifystate;
private Integer applierid;
private String applier;
private Date applydate;
private String applyreason;
private Integer reviewerid;
private String reviewer;
private Date reviewdate;
private String reviewremark;
@Excel(name = "是否结转", replace = {"是_1", "否_0"})
private Byte isconfirm;
@Excel(name = "结转日期", exportFormat = "yyyy-MM-dd")
private Date confirmdate;
private Integer confirmuid;
@Excel(name = "结转人")
private String confirmname;
private String remark;
private Date ctime;
private Integer cuid;
private String cname;
private Date mtime;
private Integer muid;
private String mname;
private String businessid;
private String transactionid;
//筛选字段
private Date receiptdatetop;
private Date receiptdatelow;
//导出字段
@Excel(name = "片区")
private String areastr;
@Excel(name = "门店")
private String storestr;
@Excel(name = "费用类型")
private String typestr;
//额外字段
private Boolean updateable;
private String newbatchnum; //设置新批次号
private String posbankname;
private Byte isdiff;
public String getTransactionid() {
return transactionid;
}
public void setTransactionid(String transactionid) {
this.transactionid = transactionid;
}
public String getBusinessid() {
return businessid;
}
public void setBusinessid(String businessid) {
this.businessid = businessid;
}
public Byte getIsdiff() {
return isdiff;
}
public void setIsdiff(Byte isdiff) {
this.isdiff = isdiff;
}
public String getPosbankname() {
return posbankname;
}
public void setPosbankname(String posbankname) {
this.posbankname = posbankname;
}
public String getPoscompany() {
return poscompany;
}
public void setPoscompany(String poscompany) {
this.poscompany = poscompany;
}
public String getNewbatchnum() {
return newbatchnum;
}
public void setNewbatchnum(String newbatchnum) {
this.newbatchnum = newbatchnum;
}
public String getReviewremark() {
return reviewremark;
}
public void setReviewremark(String reviewremark) {
this.reviewremark = reviewremark;
}
public Boolean getUpdateable() {
if (updateable != null) {
return updateable;
}
updateable = true;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
if (this.ctime == null || this.modifystate == null || (!sdf.format(this.ctime).equals(sdf.format(new Date())) && this.modifystate != 2)) {
this.updateable = false;
}
return updateable;
}
public void setUpdateable(Boolean updateable) {
this.updateable = updateable;
}
public String getTypestr() {
return typestr;
}
public void setTypestr(String typestr) {
this.typestr = typestr;
}
public String getAreastr() {
return areastr;
}
public void setAreastr(String areastr) {
this.areastr = areastr;
}
public String getStorestr() {
return storestr;
}
public void setStorestr(String storestr) {
this.storestr = storestr;
}
public Date getReceiptdatetop() {
return receiptdatetop;
}
public void setReceiptdatetop(Date receiptdatetop) {
this.receiptdatetop = receiptdatetop;
}
public Date getReceiptdatelow() {
return receiptdatelow;
}
public void setReceiptdatelow(Date receiptdatelow) {
this.receiptdatelow = receiptdatelow;
}
public Byte getIsinvoice() {
return isinvoice;
}
public void setIsinvoice(Byte isinvoice) {
this.isinvoice = isinvoice;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getAreaid() {
return areaid;
}
public void setAreaid(Integer areaid) {
this.areaid = areaid;
}
public Integer getStoreid() {
return storeid;
}
public void setStoreid(Integer storeid) {
this.storeid = storeid;
}
public Integer getStudentid() {
return studentid;
}
public void setStudentid(Integer studentid) {
this.studentid = studentid;
}
public String getStuname() {
return stuname;
}
public void setStuname(String stuname) {
this.stuname = stuname == null ? null : stuname.trim();
}
public String getStuidcard() {
return stuidcard;
}
public void setStuidcard(String stuidcard) {
this.stuidcard = stuidcard == null ? null : stuidcard.trim();
}
public String getClassinfo() {
return classinfo;
}
public void setClassinfo(String classinfo) {
this.classinfo = classinfo == null ? null : classinfo.trim();
}
public String getTraintype() {
return traintype;
}
public void setTraintype(String traintype) {
this.traintype = traintype == null ? null : traintype.trim();
}
public Date getSignupdate() {
return signupdate;
}
public void setSignupdate(Date signupdate) {
this.signupdate = signupdate;
}
public BigDecimal getSignupcost() {
return signupcost;
}
public void setSignupcost(BigDecimal signupcost) {
this.signupcost = signupcost;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public String getReceiptnum() {
return receiptnum;
}
public void setReceiptnum(String receiptnum) {
this.receiptnum = receiptnum == null ? null : receiptnum.trim();
}
public Date getReceiptdate() {
return receiptdate;
}
public void setReceiptdate(Date receiptdate) {
this.receiptdate = receiptdate;
}
public BigDecimal getReceiptmoney() {
return receiptmoney;
}
public void setReceiptmoney(BigDecimal receiptmoney) {
this.receiptmoney = receiptmoney;
}
public BigDecimal getCashmoney() {
return cashmoney;
}
public void setCashmoney(BigDecimal cashmoney) {
this.cashmoney = cashmoney;
}
public Integer getPosid() {
return posid;
}
public void setPosid(Integer posid) {
this.posid = posid;
}
public String getPosnum() {
return posnum;
}
public void setPosnum(String posnum) {
this.posnum = posnum == null ? null : posnum.trim();
}
public BigDecimal getPosmoney() {
return posmoney;
}
public void setPosmoney(BigDecimal posmoney) {
this.posmoney = posmoney;
}
public Byte getInvoicetype() {
return invoicetype;
}
public void setInvoicetype(Byte invoicetype) {
this.invoicetype = invoicetype;
}
public String getInvoicename() {
return invoicename;
}
public void setInvoicename(String invoicename) {
this.invoicename = invoicename == null ? null : invoicename.trim();
}
public String getInvoicenum() {
return invoicenum;
}
public void setInvoicenum(String invoicenum) {
this.invoicenum = invoicenum == null ? null : invoicenum.trim();
}
public BigDecimal getInvoicemoney() {
return invoicemoney;
}
public void setInvoicemoney(BigDecimal invoicemoney) {
this.invoicemoney = invoicemoney;
}
public Date getInvoicedate() {
return invoicedate;
}
public void setInvoicedate(Date invoicedate) {
this.invoicedate = invoicedate;
}
public Byte getInvoicestate() {
return invoicestate;
}
public void setInvoicestate(Byte invoicestate) {
this.invoicestate = invoicestate;
}
public Integer getState1uid() {
return state1uid;
}
public void setState1uid(Integer state1uid) {
this.state1uid = state1uid;
}
public Date getState1date() {
return state1date;
}
public void setState1date(Date state1date) {
this.state1date = state1date;
}
public String getState1name() {
return state1name;
}
public void setState1name(String state1name) {
this.state1name = state1name == null ? null : state1name.trim();
}
public Integer getState2uid() {
return state2uid;
}
public void setState2uid(Integer state2uid) {
this.state2uid = state2uid;
}
public Date getState2date() {
return state2date;
}
public void setState2date(Date state2date) {
this.state2date = state2date;
}
public String getState2name() {
return state2name;
}
public void setState2name(String state2name) {
this.state2name = state2name == null ? null : state2name.trim();
}
public Integer getState3uid() {
return state3uid;
}
public void setState3uid(Integer state3uid) {
this.state3uid = state3uid;
}
public Date getState3date() {
return state3date;
}
public void setState3date(Date state3date) {
this.state3date = state3date;
}
public String getState3name() {
return state3name;
}
public void setState3name(String state3name) {
this.state3name = state3name == null ? null : state3name.trim();
}
public Integer getState4uid() {
return state4uid;
}
public void setState4uid(Integer state4uid) {
this.state4uid = state4uid;
}
public Date getState4date() {
return state4date;
}
public void setState4date(Date state4date) {
this.state4date = state4date;
}
public String getState4name() {
return state4name;
}
public void setState4name(String state4name) {
this.state4name = state4name == null ? null : state4name.trim();
}
public String getBatchnum() {
return batchnum;
}
public void setBatchnum(String batchnum) {
this.batchnum = batchnum == null ? null : batchnum.trim();
}
public Byte getModifystate() {
return modifystate;
}
public void setModifystate(Byte modifystate) {
this.modifystate = modifystate;
}
public Integer getApplierid() {
return applierid;
}
public void setApplierid(Integer applierid) {
this.applierid = applierid;
}
public String getApplier() {
return applier;
}
public void setApplier(String applier) {
this.applier = applier == null ? null : applier.trim();
}
public Date getApplydate() {
return applydate;
}
public void setApplydate(Date applydate) {
this.applydate = applydate;
}
public String getApplyreason() {
return applyreason;
}
public void setApplyreason(String applyreason) {
this.applyreason = applyreason == null ? null : applyreason.trim();
}
public Integer getReviewerid() {
return reviewerid;
}
public void setReviewerid(Integer reviewerid) {
this.reviewerid = reviewerid;
}
public String getReviewer() {
return reviewer;
}
public void setReviewer(String reviewer) {
this.reviewer = reviewer == null ? null : reviewer.trim();
}
public Date getReviewdate() {
return reviewdate;
}
public void setReviewdate(Date reviewdate) {
this.reviewdate = reviewdate;
}
public Byte getIsconfirm() {
return isconfirm;
}
public void setIsconfirm(Byte isconfirm) {
this.isconfirm = isconfirm;
}
public Date getConfirmdate() {
return confirmdate;
}
public void setConfirmdate(Date confirmdate) {
this.confirmdate = confirmdate;
}
public Integer getConfirmuid() {
return confirmuid;
}
public void setConfirmuid(Integer confirmuid) {
this.confirmuid = confirmuid;
}
public String getConfirmname() {
return confirmname;
}
public void setConfirmname(String confirmname) {
this.confirmname = confirmname == null ? null : confirmname.trim();
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark == null ? null : remark.trim();
}
public Date getCtime() {
return ctime;
}
public void setCtime(Date ctime) {
this.ctime = ctime;
}
public Integer getCuid() {
return cuid;
}
public void setCuid(Integer cuid) {
this.cuid = cuid;
}
public String getCname() {
return cname;
}
public void setCname(String cname) {
this.cname = cname == null ? null : cname.trim();
}
public Date getMtime() {
return mtime;
}
public void setMtime(Date mtime) {
this.mtime = mtime;
}
public Integer getMuid() {
return muid;
}
public void setMuid(Integer muid) {
this.muid = muid;
}
public String getMname() {
return mname;
}
public void setMname(String mname) {
this.mname = mname == null ? null : mname.trim();
}
} | [
"232120641@qq.com"
] | 232120641@qq.com |
d53f4de78b5c915ccbd6c428a4328ae11b0c3c69 | aa2ee4b899cc19a2b8ca9f815a8d7784a24c891c | /src/main/java/org/olf/ncip/v1schema/UnstructuredAddress.java | feedb5a60494a46261fb1577aedc92e91013cc00 | [
"Apache-2.0"
] | permissive | openlibraryenvironment/ncip-tools | 7153b5d347abca58d69269da829e3f93ad752123 | d21b3d1d8c9ef41b9c40cd950babf2841e5ac5be | refs/heads/master | 2020-06-03T10:42:33.310243 | 2019-07-12T14:31:24 | 2019-07-12T14:31:24 | 191,538,520 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,353 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2019.07.08 at 10:19:21 AM BST
//
package org.olf.ncip.v1schema;
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;
/**
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"unstructuredAddressType",
"unstructuredAddressData"
})
@XmlRootElement(name = "UnstructuredAddress")
public class UnstructuredAddress {
@XmlElement(name = "UnstructuredAddressType", required = true)
protected UnstructuredAddressType unstructuredAddressType;
@XmlElement(name = "UnstructuredAddressData", required = true)
protected UnstructuredAddressData unstructuredAddressData;
/**
* Gets the value of the unstructuredAddressType property.
*
* @return
* possible object is
* {@link UnstructuredAddressType }
*
*/
public UnstructuredAddressType getUnstructuredAddressType() {
return unstructuredAddressType;
}
/**
* Sets the value of the unstructuredAddressType property.
*
* @param value
* allowed object is
* {@link UnstructuredAddressType }
*
*/
public void setUnstructuredAddressType(UnstructuredAddressType value) {
this.unstructuredAddressType = value;
}
/**
* Gets the value of the unstructuredAddressData property.
*
* @return
* possible object is
* {@link UnstructuredAddressData }
*
*/
public UnstructuredAddressData getUnstructuredAddressData() {
return unstructuredAddressData;
}
/**
* Sets the value of the unstructuredAddressData property.
*
* @param value
* allowed object is
* {@link UnstructuredAddressData }
*
*/
public void setUnstructuredAddressData(UnstructuredAddressData value) {
this.unstructuredAddressData = value;
}
}
| [
"ianibbo@googlemail.com"
] | ianibbo@googlemail.com |
0d8c1fcf5220d22063e59b0ef9785200e315b9f2 | 2c884528b6bdfb7ad4f241d78fb233f9be3525ba | /src/bitManipulation/SingleNumber.java | 033f2e680d50a7dd64d913c49660bb1419c0a0b0 | [] | no_license | bindisevak/PracticeInterviewExamples | 1a14e903a1881ba82e7b3eaad24e67d2eb2543a4 | 04ffee144e60608832f9c07e9b94b7141a1efb41 | refs/heads/master | 2021-01-23T08:21:36.693297 | 2017-10-30T06:08:17 | 2017-10-30T06:08:17 | 86,507,639 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 343 | java | package bitManipulation;
public class SingleNumber {
public static void main(String[] args) {
SingleNumber sn = new SingleNumber();
int[] A = {1,1,2,3,3};
System.out.println("Result: "+sn.singleNumber(A));
}
public int singleNumber(int[] A){
int x = 0;
for(int a: A){
x = x^a;
System.out.println(x);
}
return x;
}
}
| [
"bindisevak90@gmail.com"
] | bindisevak90@gmail.com |
a98e16f627dd82fdfc45a97f3ffa23566c4940e5 | 18cda072ef9889bcf23e954ac60fa2b3b67eb225 | /aopaspectjannotation/aopaspectjafterreturning/src/com/mycompany/Test.java | 53622715c4b68023b9d6bf31887fc0e0479287ee | [] | no_license | sumitup80/javaTraining | 2af4d251bf0ec849c9d07cd82fa70efc6da1a86f | 0645f7382ceca87017e5c75df7f41d73c30eed53 | refs/heads/master | 2021-01-17T20:27:51.756012 | 2015-11-27T10:47:28 | 2015-11-27T10:47:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 515 | java | package com.mycompany;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class Test{
public static void main(String[] args){
ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
Operation e = (Operation) context.getBean("opBean");
System.out.println("calling m...");
System.out.println(e.m());
System.out.println("calling k...");
System.out.println(e.k());
}
}
| [
"pesdguy@yahoo.co.in"
] | pesdguy@yahoo.co.in |
b40bf45811e8541ed9ffdbce56ed311a33845236 | 3c9c5bd4dbbe7149fa84d579f1f6f13832ce2474 | /src/main/java/mvn_customer/config/MyAbstractSecurityInitializer.java | 1e287f4ae8f312cb044a495892a84099641323a1 | [] | no_license | redikx/mvn-customer | eaf0eb93913761b44498d91894cbcbd10ecaff9e | 3bd30cf23fc1043597f34b22faa6f03bb9160a59 | refs/heads/master | 2020-03-30T08:21:22.067670 | 2018-10-22T19:46:52 | 2018-10-22T19:46:52 | 151,008,661 | 0 | 0 | null | 2018-10-13T21:55:54 | 2018-09-30T21:27:54 | Java | UTF-8 | Java | false | false | 219 | java | package mvn_customer.config;
import org.springframework.security.web.context.AbstractSecurityWebApplicationInitializer;
public class MyAbstractSecurityInitializer extends AbstractSecurityWebApplicationInitializer{
}
| [
"redikx@gmail.com"
] | redikx@gmail.com |
e950d956344e237eef72ef8c21f007e71c7c365d | ca7bd23419c01c1256d171273abe0b72fa9b59ed | /CoreJava/src/v1ch09/menu/MenuTest.java | 60288ae2bb6fa36fe748e2075830040e04d4ab35 | [] | no_license | oskycar/eclipseWorkSpace | ff688515037c0d0b1a1f5897ff3c4101b5db8b32 | 5a71685e8b7944a45042b951724f24dd9d11b03a | refs/heads/master | 2021-01-10T05:22:00.961718 | 2015-10-13T13:22:25 | 2015-10-13T13:22:25 | 44,177,792 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 590 | java | package v1ch09.menu; /* Added by AddEclipsePackageName.py */
import java.awt.*;
import javax.swing.*;
/**
* @version 1.23 2007-05-30
* @author Cay Horstmann
*/
public class MenuTest
{
public static void main(String[] args)
{
EventQueue.invokeLater(new Runnable()
{
public void run()
{
JFrame frame = new MenuFrame();
frame.setTitle("MenuTest");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
});
}
} | [
"allenyang1818@gmail.com"
] | allenyang1818@gmail.com |
82fbd83e3d776f73bed53673ab8991927fd0fd28 | 3b2ffca8de217525a95768e3eec9c7291ac912ad | /Java/CharAndBoolean/src/com/akshatshah/Main.java | d2a6e7fe0ce05669fa2c7103607d3b202637462b | [] | no_license | akshatdotcom/Projects | ebd06b574667b753f62f8d589e8607198e781a64 | 77661e0d957d2425585f1c75f90a15063ed8b6ff | refs/heads/master | 2022-11-02T14:02:56.855597 | 2020-05-22T17:25:35 | 2020-05-22T17:25:35 | 241,188,570 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 468 | java | package com.akshatshah;
public class Main {
public static void main(String[] args) {
char myChar = '\u00A9'; // copyright symbol
char yourChar = '\u00AE'; // registered symbol
System.out.println(myChar);
System.out.println(yourChar);
// width of char = 16 (2 bytes)
boolean myBoolean = false;
boolean isMale = true;
// byte
// short
// int
// float
// long
// boolean
// double
// char
// string
}
}
| [
"aksshah2004@gmail.com"
] | aksshah2004@gmail.com |
49b37a7504151beebbd775732db57151ea2d79b9 | f79a602837b655248aaee0e50e5ebb564b409ab8 | /src/main/java/com/shenke/service/PaymentPledgeServiceImpl.java | 34d313afdce000015afd7b158c1040a334338f05 | [] | no_license | chao3373/zzy | 537129cde309e35538f335c6b552e23f049b9e3f | 9d8360e204dd5f3a540675ac0c00850d3316ff43 | refs/heads/master | 2020-06-10T13:05:05.144745 | 2019-07-25T02:36:55 | 2019-07-25T02:36:55 | 193,648,661 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 513 | java | package com.shenke.service;
import com.shenke.Entity.PaymentPledge;
import com.shenke.repository.PaymentPledgeRepository;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Service("paymentPledgeService")
public class PaymentPledgeServiceImpl implements PaymentPledgeService{
@Resource
private PaymentPledgeRepository paymentPledgeRepository;
@Override
public void save(PaymentPledge paymentPledge) {
paymentPledgeRepository.save(paymentPledge);
}
}
| [
"337329389@qq.com"
] | 337329389@qq.com |
87a1311bec742c7be89d07e3c28e06aa0056f843 | 93f042d529b60a2a1644dee9c761e8117e0e4877 | /src/main/java/com/zqw/order/manage/service/QrcodeServiceImpl.java | e8c6acf964cb839f6b197fe79305a844470b2c4f | [] | no_license | zhuquanwen/zqh | 97c42594a9732b42c4c47819e816d85a5cb9fd8a | cd869d7fe06b1f607df10ea27f2f243a0a2a38a1 | refs/heads/master | 2021-09-01T19:20:52.907695 | 2017-12-28T11:59:10 | 2017-12-28T11:59:10 | 108,867,933 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,375 | java | package com.zqw.order.manage.service;
import com.zqw.order.manage.domain.p.Qrcode;
import com.zqw.order.manage.domain.p.QrcodeDao;
import com.zqw.order.manage.service.api.QrcodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class QrcodeServiceImpl implements QrcodeService {
@Autowired
private QrcodeDao qrcodeDao;
@Override
public Qrcode findByGoodsId(Long goodsId) {
return qrcodeDao.findByGoodsId(goodsId);
}
@Override
public Qrcode save(Qrcode qrcode) {
return qrcodeDao.save(qrcode);
}
@Override
public List<Qrcode> save(List<Qrcode> t) {
return qrcodeDao.save(t);
}
@Override
public void delete(Qrcode qrcode) {
qrcodeDao.delete(qrcode);
}
@Override
public void deleteInBatch(List<Qrcode> qrcodes) {
qrcodeDao.deleteInBatch(qrcodes);
}
@Override
public Page<Qrcode> findUsePage(Pageable pageable) {
return qrcodeDao.findAll(pageable);
}
@Override
public Qrcode findOne(Long id) {
return qrcodeDao.findOne(id);
}
@Override
public List<Qrcode> findAll() {
return qrcodeDao.findAll();
}
}
| [
"you@example.com"
] | you@example.com |
1fe2fc639ce3fc79172942f54aeb9f5d3045138b | e790976d9ed360b9f5a79e5e90117d827be0d365 | /app/src/main/java/com/gdut/myweather/base/BaseFragment.java | d4ba9a576ed0dfc4f09da3b4114fbef0e17f94c5 | [] | no_license | LixyAndroid/MyWeather | c1bd8aabeef190b6e42276467250c2817fd09e82 | e2d260c0f294c2ba79f0b833dd934792dab6f31d | refs/heads/master | 2020-06-22T02:12:47.641853 | 2019-07-18T15:35:19 | 2019-07-18T15:35:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,013 | java | package com.gdut.myweather.base;
import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* @author Mloong
*/
public class BaseFragment extends Fragment {
// private PublishSubject<FragmentLifecycleEvent> fragmentLifecycleSubject = PublishSubject.create();
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
return super.onCreateView(inflater, container, savedInstanceState);
}
@Override
public void onDestroyView() {
// fragmentLifecycleSubject.onNext(FragmentLifecycleEvent.DESTROY_VIEW);
super.onDestroyView();
}
@Override
public void onDestroy() {
super.onDestroy();
}
}
| [
"958607524@qq.com"
] | 958607524@qq.com |
a0189c236425e5999662aae8e021cd0154ed7901 | a901abdca092650e0eb277f04c988200796b1d7d | /aart-main/aart-web/src/main/java/edu/ku/cete/model/APIDashboardErrorMapper.java | 3d1b436572afa1b8eadc2472b14a4ebc9b32c338 | [] | no_license | krishnamohankaruturi/secret | 5acafbde49b9fa9e24f89534d14e7b01f863f775 | 4da83d113d3620d4c2c84002fecbe4bdd759c1a2 | refs/heads/master | 2022-03-24T22:09:41.325033 | 2019-11-15T12:14:07 | 2019-11-15T12:14:07 | 219,771,956 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,764 | java | package edu.ku.cete.model;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import edu.ku.cete.domain.api.APIDashboardError;
import edu.ku.cete.domain.apierrors.ApiAllErrorRecords;
import edu.ku.cete.domain.apierrors.ApiErrorsRecord;
public interface APIDashboardErrorMapper {
/**
* This method was generated by MyBatis Generator. This method corresponds to the database table apidashboarderror
* @mbg.generated Wed Aug 22 14:42:05 CDT 2018
*/
int insert(APIDashboardError record);
/**
* This method was generated by MyBatis Generator. This method corresponds to the database table apidashboarderror
* @mbg.generated Wed Aug 22 14:42:05 CDT 2018
*/
int insertSelective(APIDashboardError record);
/**
* This method was generated by MyBatis Generator. This method corresponds to the database table apidashboarderror
* @mbg.generated Wed Aug 22 14:42:05 CDT 2018
*/
APIDashboardError selectByPrimaryKey(Long id);
/**
* This method was generated by MyBatis Generator. This method corresponds to the database table apidashboarderror
* @mbg.generated Wed Aug 22 14:42:05 CDT 2018
*/
int updateByPrimaryKeySelective(APIDashboardError record);
/**
* This method was generated by MyBatis Generator. This method corresponds to the database table apidashboarderror
* @mbg.generated Wed Aug 22 14:42:05 CDT 2018
*/
int updateByPrimaryKey(APIDashboardError record);
List<ApiErrorsRecord> getApiErrorsToView(Map<String, Object> criteria);
List<String> getErrorRecordTypes();
List<String> getApiErrorsRequestTypes();
Integer getCountOfApiErrorsToView(Map<String, Object> criteria);
List<ApiAllErrorRecords> getAllApiErrorMessages(Map<String, Object> criteria);
} | [
"Venkatakrishna.k@CTL.local"
] | Venkatakrishna.k@CTL.local |
a4481a84add4e48cfe501e66b0e7a376414d69a2 | c34b18661c688ffeb645560db21411b3d398175f | /src/com/penggajian/view/DaftarPokokHonorView.java | 8d9fee555c13fbcc1a8ff1650d0e549493b84901 | [] | no_license | fridLaki/Sistem-Penggajian-Pegawai | 21bd608ff300268be2b2453f52d9d3abadf66350 | f95093f12dc315d97731922053f3fe175a91789a | refs/heads/master | 2021-01-20T20:52:11.175820 | 2019-09-07T15:59:20 | 2019-09-07T15:59:20 | 65,181,082 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,340 | 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.penggajian.view;
import com.penggajian.main.DialogView;
import com.penggajian.main.MainView;
import com.penggajian.entity.PokokHonor;
import com.penggajian.main.SpringManager;
import com.penggajian.service.MasterService;
import com.stripbandunk.jwidget.JDynamicTable;
import com.stripbandunk.jwidget.model.DynamicTableModel;
import java.awt.Window;
import org.springframework.dao.DataAccessException;
/**
*
* @author Windows
*/
public class DaftarPokokHonorView extends DialogView {
/**
* Creates new form DaftarDataPegawaiView
*/
private JDynamicTable dynamicTable;
private DynamicTableModel<PokokHonor> dynamicTableModel;
public DaftarPokokHonorView(MainView mainView) {
super(mainView);
initComponents();
dynamicTableModel = new DynamicTableModel<>(PokokHonor.class);
dynamicTable = new JDynamicTable(dynamicTableModel);
jScrollPane1.setViewportView(dynamicTable);
}
private void refreshTable(){
MasterService masterService = SpringManager.getInstance().getBean(MasterService.class);
dynamicTableModel.clear();
for (PokokHonor ph : masterService.getAllPokokHonor()) {
dynamicTableModel.add(ph);
}
}
//@Override
//public void display(Window formApp, Object parameter) {
//autoResizeColumn(tblMasterPegawai);
//isiTableDaftarKartuPembayaran();
//}
/**
* 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() {
jScrollPane1 = new javax.swing.JScrollPane();
tblMasterPegawai = new javax.swing.JTable();
btnHapus = new javax.swing.JButton();
btnUbah = new javax.swing.JButton();
btnTambah = new javax.swing.JButton();
btnKembali = new javax.swing.JButton();
setTitle("Daftar Pokok Honor");
tblMasterPegawai.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{},
{},
{},
{}
},
new String [] {
}
));
tblMasterPegawai.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
tblMasterPegawai.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
jScrollPane1.setViewportView(tblMasterPegawai);
btnHapus.setText("Hapus Pegawai");
btnHapus.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonAction(evt);
}
});
btnUbah.setText("Ubah Pegawai");
btnUbah.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonAction(evt);
}
});
btnTambah.setText("Tambah Pegawai");
btnTambah.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonAction(evt);
}
});
btnKembali.setText("Kembali");
btnKembali.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonAction(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 872, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(0, 390, Short.MAX_VALUE)
.addComponent(btnTambah)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(btnUbah)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(btnHapus)
.addGap(10, 10, 10)
.addComponent(btnKembali)))
.addContainerGap())
);
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {btnHapus, btnKembali, btnTambah, btnUbah});
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 348, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnHapus)
.addComponent(btnUbah)
.addComponent(btnTambah)
.addComponent(btnKembali))
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void buttonAction(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonAction
// TODO add your handling code here:
Object source = evt.getSource();
if (source == btnTambah) {
TambahPokokHonorDialog td = new TambahPokokHonorDialog(getMainView());
td.display(this, null);
refreshTable();
} else if(source == btnUbah){
if (dynamicTable.getSelectedRow() == -1) {
showWarning("Silahkan pilih salah satu");
} else {
PokokHonor ph = dynamicTableModel.get(
dynamicTable.convertRowIndexToModel(
dynamicTable.getSelectedRow()));
UbahPokokHonorDialog ubah = new UbahPokokHonorDialog(getMainView());
ubah.display(this, ph);
refreshTable();
}
} else if(source == btnHapus){
if (dynamicTable.getSelectedRow() == -1) {
showWarning("Silahkan pilih salah satu");
} else {
PokokHonor ph = dynamicTableModel.get(
dynamicTable.convertRowIndexToModel(
dynamicTable.getSelectedRow()));
MasterService masterService = SpringManager.getInstance().getBean(MasterService.class);
try {
masterService.delete(ph);
refreshTable();
} catch (DataAccessException ex) {
showError(ex.getRootCause().getMessage());
}
}
} else if (source == btnKembali){
dispose();
}
}//GEN-LAST:event_buttonAction
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnHapus;
private javax.swing.JButton btnKembali;
private javax.swing.JButton btnTambah;
private javax.swing.JButton btnUbah;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable tblMasterPegawai;
// End of variables declaration//GEN-END:variables
@Override
public void display(Window formApp, Object parameter) {
refreshTable();
setLocationRelativeTo(this);
setVisible(true);
}
}
| [
"wilfriduslaki@gmail.com"
] | wilfriduslaki@gmail.com |
027c2b0c5c9b827fb5fd900c38db4eb0e76fd591 | 758d7be0d78f7113c4a562d14e18241aeba72687 | /src/main/java/dev/ulman/restaurant/persistence/OrderDaoImpl.java | 1b374539460992bcac36a0d8d9dd033204907335 | [
"MIT"
] | permissive | MarcinUlman/xFormation_task1_FoodOrderingSystem | 4e694db6d7ca717ce840d9d3ed5811e7c739d096 | 0b8abac4d24a0c053d6f050f0e126ea8d9e0e29e | refs/heads/master | 2023-05-28T02:27:01.433689 | 2019-10-14T06:09:49 | 2019-10-14T06:09:49 | 214,894,137 | 0 | 0 | null | 2023-05-23T20:12:09 | 2019-10-13T21:08:42 | Java | UTF-8 | Java | false | false | 2,969 | java | package dev.ulman.restaurant.persistence;
import dev.ulman.restaurant.model.Order;
import dev.ulman.restaurant.model.Product;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
public class OrderDaoImpl implements OrderDao {
private final SessionFactory sessionFactory = HibernateUtils.getSessionFactory();
@Override
public Order getOrder(int id) {
Order order = null;
Transaction transaction = null;
try (Session session = sessionFactory.openSession()) {
transaction = session.beginTransaction();
order = session.get(Order.class, id);
transaction.commit();
} catch (Exception e){
e.printStackTrace();
if (transaction != null) transaction.rollback();
}
return order;
}
@Override
public void addOrder(Order order) {
Transaction transaction = null;
try (Session session = sessionFactory.openSession()) {
transaction = session.beginTransaction();
session.save(order);
transaction.commit();
} catch (Exception e){
e.printStackTrace();
if (transaction != null) transaction.rollback();
}
}
@Override
public void deleteOrder(int id) {
Transaction transaction = null;
try (Session session = sessionFactory.openSession()) {
transaction = session.beginTransaction();
Order order = session.get(Order.class, id);
if (order == null) {
transaction.commit();
System.out.println("Order does not exist.");
return;
}
session.delete(order);
transaction.commit();
System.out.println("Order successfully deleted");
} catch (Exception e){
e.printStackTrace();
if (transaction != null) transaction.rollback();
}
}
@Override
public void addProduct(int id, Product product, int quantity) {
Transaction transaction = null;
try (Session session = sessionFactory.openSession()){
transaction = session.beginTransaction();
Order order = session.get(Order.class, id);
if(order == null){
System.out.println("Order does not exist");
return;
}
ProductDao productDao = new ProductDaoImpl();
if (!productDao.isProductExist(product.getName())) {
System.out.println("Product does not exist. Add it first");
return;
}
order.addProduct(product, quantity);
session.merge(order);
transaction.commit();
System.out.println("Product successful add to order");
} catch (Exception e){
e.printStackTrace();
if (transaction != null) transaction.rollback();
}
}
}
| [
"marcin@ulman.dev"
] | marcin@ulman.dev |
41bc425cb6cad5676df05ad4c058b01c0b90e053 | 2a4ea5b153ea1671e3905d663451a5d0cd3f4a18 | /android/support/v7/widget/TooltipCompatHandler.java | d56b56b4f2bbbad3676d49dd5c4ec9067b2ef234 | [] | no_license | shubham172995/Intern_Project | a376eecd5444b14b6541d2c150c94a3927c1f4ae | 1eb446a829f04ae5a2ce1697d30d63b4e96c81c0 | refs/heads/master | 2023-06-23T11:59:20.482225 | 2018-07-10T02:07:41 | 2018-07-10T02:07:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,193 | java | package android.support.v7.widget;
import android.content.Context;
import android.support.annotation.RestrictTo;
import android.support.v4.view.ViewCompat;
import android.text.TextUtils;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnAttachStateChangeListener;
import android.view.View.OnHoverListener;
import android.view.View.OnLongClickListener;
import android.view.ViewConfiguration;
import android.view.accessibility.AccessibilityManager;
@RestrictTo({android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP})
class TooltipCompatHandler
implements View.OnLongClickListener, View.OnHoverListener, View.OnAttachStateChangeListener
{
private static final long HOVER_HIDE_TIMEOUT_MS = 15000L;
private static final long HOVER_HIDE_TIMEOUT_SHORT_MS = 3000L;
private static final long LONG_CLICK_HIDE_TIMEOUT_MS = 2500L;
private static final String TAG = "TooltipCompatHandler";
private static TooltipCompatHandler sActiveHandler;
private final View mAnchor;
private int mAnchorX;
private int mAnchorY;
private boolean mFromTouch;
private final Runnable mHideRunnable = new Runnable()
{
public void run()
{
TooltipCompatHandler.this.hide();
}
};
private TooltipPopup mPopup;
private final Runnable mShowRunnable = new Runnable()
{
public void run()
{
TooltipCompatHandler.this.show(false);
}
};
private final CharSequence mTooltipText;
private TooltipCompatHandler(View paramView, CharSequence paramCharSequence)
{
this.mAnchor = paramView;
this.mTooltipText = paramCharSequence;
this.mAnchor.setOnLongClickListener(this);
this.mAnchor.setOnHoverListener(this);
}
private void hide()
{
if (sActiveHandler == this)
{
sActiveHandler = null;
if (this.mPopup == null) {
break label63;
}
this.mPopup.hide();
this.mPopup = null;
this.mAnchor.removeOnAttachStateChangeListener(this);
}
for (;;)
{
this.mAnchor.removeCallbacks(this.mShowRunnable);
this.mAnchor.removeCallbacks(this.mHideRunnable);
return;
label63:
Log.e("TooltipCompatHandler", "sActiveHandler.mPopup == null");
}
}
public static void setTooltipText(View paramView, CharSequence paramCharSequence)
{
if (TextUtils.isEmpty(paramCharSequence))
{
if ((sActiveHandler != null) && (sActiveHandler.mAnchor == paramView)) {
sActiveHandler.hide();
}
paramView.setOnLongClickListener(null);
paramView.setLongClickable(false);
paramView.setOnHoverListener(null);
return;
}
new TooltipCompatHandler(paramView, paramCharSequence);
}
private void show(boolean paramBoolean)
{
if (!ViewCompat.isAttachedToWindow(this.mAnchor)) {
return;
}
if (sActiveHandler != null) {
sActiveHandler.hide();
}
sActiveHandler = this;
this.mFromTouch = paramBoolean;
this.mPopup = new TooltipPopup(this.mAnchor.getContext());
this.mPopup.show(this.mAnchor, this.mAnchorX, this.mAnchorY, this.mFromTouch, this.mTooltipText);
this.mAnchor.addOnAttachStateChangeListener(this);
long l;
if (this.mFromTouch) {
l = 2500L;
}
for (;;)
{
this.mAnchor.removeCallbacks(this.mHideRunnable);
this.mAnchor.postDelayed(this.mHideRunnable, l);
return;
if ((ViewCompat.getWindowSystemUiVisibility(this.mAnchor) & 0x1) == 1) {
l = 3000L - ViewConfiguration.getLongPressTimeout();
} else {
l = 15000L - ViewConfiguration.getLongPressTimeout();
}
}
}
public boolean onHover(View paramView, MotionEvent paramMotionEvent)
{
if ((this.mPopup != null) && (this.mFromTouch)) {}
do
{
do
{
return false;
paramView = (AccessibilityManager)this.mAnchor.getContext().getSystemService("accessibility");
} while ((paramView.isEnabled()) && (paramView.isTouchExplorationEnabled()));
switch (paramMotionEvent.getAction())
{
case 8:
case 9:
default:
return false;
}
} while ((!this.mAnchor.isEnabled()) || (this.mPopup != null));
this.mAnchorX = ((int)paramMotionEvent.getX());
this.mAnchorY = ((int)paramMotionEvent.getY());
this.mAnchor.removeCallbacks(this.mShowRunnable);
this.mAnchor.postDelayed(this.mShowRunnable, ViewConfiguration.getLongPressTimeout());
return false;
hide();
return false;
}
public boolean onLongClick(View paramView)
{
this.mAnchorX = (paramView.getWidth() / 2);
this.mAnchorY = (paramView.getHeight() / 2);
show(true);
return true;
}
public void onViewAttachedToWindow(View paramView) {}
public void onViewDetachedFromWindow(View paramView)
{
hide();
}
}
/* Location: C:\Users\lousy\Desktop\New folder\dex2jar\classes-dex2jar.jar
* Qualified Name: android.support.v7.widget.TooltipCompatHandler
* JD-Core Version: 0.7.0.1
*/ | [
"shubham.wheofficial@gmail.com"
] | shubham.wheofficial@gmail.com |
79af8c5d7307160ef79a6c34160e445334266090 | 2bfe88be3b9dd1de919124eedf7079d0ee4d43a7 | /PerfTestCenter/src/main/java/sme/perf/task/impl/anywhere/p1601/EshopSizingTestPreparation.java | b0d744ab0b4911fcaf959eb0c264f4d82726495a | [] | no_license | EysonZhao/SAP_Project | 23cb455437da5f7ced8af027f3a0a52bed1d8da3 | 660ab362bee3ec0ce334d7a89c73bbf25fe55f79 | refs/heads/master | 2021-01-17T18:45:17.579604 | 2016-08-16T12:23:47 | 2016-08-16T12:23:47 | 64,181,731 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,999 | java | package sme.perf.task.impl.anywhere.p1601;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import sme.perf.entity.Host;
import sme.perf.task.ParameterMissingException;
import sme.perf.task.Result;
import sme.perf.task.Status;
import sme.perf.task.Task;
import sme.perf.task.TaskParameterEntry;
import sme.perf.task.TaskParameterMap;
import sme.perf.utility.RunRemoteSSH;
public class EshopSizingTestPreparation extends Task {
private TaskParameterMap parameters;
private TaskParameterMap hostParameters;
private Status status=Status.New;
@SuppressWarnings("unchecked")
@Override
public Result execute() throws ParameterMissingException{
this.status=Status.Running;
logger.info("Start to Run Single Case.");
try {
//TODO Eshop Preparation Steps
// String PrepareCmd ="cmd /c set JVM_ARGS=-Xms512m -Xmx2048m && set JM_LAUNCH=\""
// + windowsJava
// + "\" && cd "
// + windowsFolder
// + "\\JmeterScript\\TestCase && call ..\\..\\Jmeter\\bin\\jmeter -n -t "
// + jmeterScriptName
// + "Parameters~~~~~~~";
//RunRemoteSSH.execute(windowsServer.getIP(), windowsServer.getUserName(), windowsServer.getUserPassword(), PrepareCmd);
logger.info("Finish to Run Single Case.");
this.status=Status.Finished;
return Result.Pass;
} catch (Exception e) {
logger.error(e.getMessage());
this.status=Status.Failed;
return Result.Fail;
}
}
@Override
public void setParameters(TaskParameterMap parameters) {
this.parameters = parameters;
}
@Override
public TaskParameterMap getParameters() {
if (null == parameters) {
parameters = EshopSizingTestPreparation.getParameterTemplate();
}
return parameters;
}
@Override
public Status getStatus() {
return this.status;
}
@Override
public void setHosts(TaskParameterMap hostList) {
this.hostParameters = hostList;
}
@Override
public TaskParameterMap getHosts() {
if (null == hostParameters) {
hostParameters = EshopSizingTestPreparation.getHostsTemplate();
}
return hostParameters;
}
@Override
public String getDescription() {
return "Task for Run Eshop Preparation step.";
}
public static TaskParameterMap getParameterTemplate() {
Map<String, TaskParameterEntry> parameters = new HashMap<String, TaskParameterEntry>();
//Common
//parameters.put("mainfolder", new TaskParameterEntry("/root/perftest/","Linux Main Folder"));
//parameters.put("windowsFolder", new TaskParameterEntry("C:\\","Windows Main Folder"));
TaskParameterMap template=new TaskParameterMap();
template.setParameters(parameters);
return template;
}
public static TaskParameterMap getHostsTemplate() {
Map<String, TaskParameterEntry> hostsParameter = new HashMap<String, TaskParameterEntry>();
TaskParameterMap template = new TaskParameterMap();
template.setParameters(hostsParameter);
return template;
}
public static String getDescriptionTemplate() {
return new EshopSizingTestPreparation().getDescription();
}
}
| [
"赵延松"
] | 赵延松 |
2430d36c936f871720722ead2ac37ca82e0ad59d | 92d4ad57bf54087523c3a9e46f24a1f715942bcd | /src/main/java/com/tfar/randomenchants/ench/enchantment/EnchantmentHoming.java | 1ad6c7daf53daf39570b0f489d9adb1d872c90c4 | [] | no_license | JuicyCosmos/RandomEnchantments | 50a0b0218c68666284433d51d0fad76fa5d1bab9 | d7c2f73fd012cb81843a098359874493aca50913 | refs/heads/master | 2023-07-31T05:33:06.409062 | 2021-09-27T02:31:44 | 2021-09-27T02:31:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,672 | java | package com.tfar.randomenchants.ench.enchantment;
import com.tfar.randomenchants.util.GlobalVars;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.enchantment.EnumEnchantmentType;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.Vec3d;
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import javax.annotation.Nonnull;
import static com.tfar.randomenchants.EnchantmentConfig.EnumAccessLevel.*;
import static com.tfar.randomenchants.EnchantmentConfig.weapons;
import static com.tfar.randomenchants.init.ModEnchantment.HOMING;
import static com.tfar.randomenchants.util.EventHandler.absValue;
import static com.tfar.randomenchants.util.EventHandler.homingarrows;
@Mod.EventBusSubscriber(modid= GlobalVars.MOD_ID)
public class EnchantmentHoming extends Enchantment {
public EnchantmentHoming() {
super(Rarity.RARE, EnumEnchantmentType.BOW, new EntityEquipmentSlot[]{
EntityEquipmentSlot.MAINHAND
});
this.setRegistryName("homing");
this.setName("homing");
}
@Override
public int getMinEnchantability(int level) {
return 15;
}
@Override
public int getMaxEnchantability(int level) {
return 100;
}
@Override
public int getMaxLevel() {
return 1;
}
@Override
public boolean canApply(@Nonnull ItemStack stack){
return weapons.enableHoming != DISABLED && super.canApply(stack);
}
@Override
public boolean isTreasureEnchantment() {
return weapons.enableHoming == ANVIL;
}
@Override
public boolean canApplyAtEnchantingTable(ItemStack stack) {
return weapons.enableHoming != DISABLED && super.canApplyAtEnchantingTable(stack);
}
@Override
public boolean isAllowedOnBooks() {
return weapons.enableHoming == NORMAL;
}
@SubscribeEvent
public static void arrowLoose(EntityJoinWorldEvent event) {
Entity entity = event.getEntity();
if (!(entity instanceof EntityArrow))return;
Entity shooter = ((EntityArrow) entity).shootingEntity;
if (!(shooter instanceof EntityPlayer))return;
EntityPlayer player = (EntityPlayer) shooter;
if (EnchantmentHelper.getMaxEnchantmentLevel(HOMING, player)==0)return;
entity.setNoGravity(true);
homingarrows.put((EntityArrow)entity,absValue(new Vec3d(entity.motionX, entity.motionY, entity.motionZ)));
}
}
| [
"44327798+Gimpler@users.noreply.github.com"
] | 44327798+Gimpler@users.noreply.github.com |
ed38aee3f88d760af9347d953e971651bb963be5 | 5bde94949b607400dc6b1e79498efcf7ed02aae7 | /MetanetProject(mobile)/src/main/java/kr/co/metanet/service/MemberService_Impl.java | 7dfba77dce9b4a6b70258df166c191fddd84e292 | [] | no_license | kmlee95/metanet-project | f91f222e172b3d757ac415e9186e867e3a025637 | 81351fe54d63a30db38636f640935ea4a67a2d18 | refs/heads/master | 2020-09-24T02:01:48.934599 | 2020-09-21T03:11:44 | 2020-09-21T03:11:44 | 225,633,273 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,369 | java | package kr.co.metanet.service;
import java.util.List;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import kr.co.metanet.dao.MemberDAO;
import kr.co.metanet.dto.AccountDTO;
import kr.co.metanet.dto.ApproveWrapperDTO;
import kr.co.metanet.dto.AuthorityDTO;
import kr.co.metanet.dto.EmployeeDTO;
import kr.co.metanet.dto.VacationApplyDTO;
import kr.co.metanet.dto.VacationCommonViewDTO;
import kr.co.metanet.dto.VacationDaysManageDTO;
@Service
public class MemberService_Impl implements MemberService{
@Autowired
MemberDAO dao;
@Override
public AccountDTO login(AccountDTO dto) throws Exception{
return dao.login(dto);
}
@Override
public void logout(HttpSession session) throws Exception{
session.invalidate();
}
@Override
public void vacationApply(VacationApplyDTO dto) throws Exception {
// TODO Auto-generated method stub
dao.vacationApply(dto);
}
@Override
public VacationDaysManageDTO vacationDaysManage(AccountDTO dto) throws Exception {
// TODO Auto-generated method stub
return dao.vacationDaysManage(dto);
}
@Override
public List<VacationCommonViewDTO> vacationApplyList(AccountDTO dto) throws Exception {
// TODO Auto-generated method stub
return dao.vacationApplyList(dto);
}
@Override
public List<VacationCommonViewDTO> vacationApplyApprove(AccountDTO dto) throws Exception {
// TODO Auto-generated method stub
return dao.vacationApplyApprove(dto);
}
@Override
public VacationCommonViewDTO vacationApplyDetail(String index) throws Exception {
// TODO Auto-generated method stub
return dao.vacationApplyDetail(index);
}
@Override
public int vacationApprove(ApproveWrapperDTO dto) throws Exception {
// TODO Auto-generated method stub
return dao.vacationApprove(dto.getIndexArray());
}
@Override
public int vacationReject(VacationApplyDTO dto) throws Exception {
// TODO Auto-generated method stub
return dao.vacationReject(dto);
}
@Override
public AuthorityDTO mapping(AccountDTO dto) throws Exception {
// TODO Auto-generated method stub
return dao.mapping(dto);
}
@Override
public EmployeeDTO getprofile(AccountDTO dto) throws Exception {
// TODO Auto-generated method stub
return dao.getprofile(dto);
}
@Override
public int selectCount(AccountDTO dto) throws Exception {
// TODO Auto-generated method stub
return dao.selectcount(dto);
}
@Override
public int selectApproveCount(AccountDTO dto) throws Exception {
// TODO Auto-generated method stub
return dao.selectapprovecount(dto);
}
@Override
public int selectRejectCount(AccountDTO dto) throws Exception {
// TODO Auto-generated method stub
return dao.selectrejectcount(dto);
}
@Override
public int selectStayCount(AccountDTO dto) throws Exception {
// TODO Auto-generated method stub
return dao.selectstaycount(dto);
}
@Override
public int deleteSubmit(ApproveWrapperDTO dto) throws Exception {
// TODO Auto-generated method stub
return dao.deletesubmit(dto.getIndexArray());
}
@Override
public int applyModify(VacationApplyDTO dto) throws Exception {
// TODO Auto-generated method stub
return dao.applyModify(dto);
}
}
| [
"kmlee95@naver.com"
] | kmlee95@naver.com |
a5d52eeff84a4297b74c64a36f46c7949270f8a6 | eaf724974e390a84b2c0e94dd7c32d8dc62d656e | /Fist.java | 0d0e9213898e9b0dd4b2f35ec897a0a15560bafe | [] | no_license | Fallinloveregin/Mirzayanova_11-807 | f0c2d7ab2785fe60317092aca34b937669858e06 | f095da73251ee6d2d8c6259a562912c86f33fb41 | refs/heads/master | 2020-03-28T17:55:10.812927 | 2019-05-20T00:29:21 | 2019-05-20T00:29:21 | 148,835,335 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 893 | java | import java.util.Scanner;
public class Fist {
public static void main (String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int minEven = 0;
int row;
int [][] matrix = new int [n][n];
int sum = 0;
for (int i = 0; i < matrix.length; i++) {
int count = 0;
for (int j = 0; j < matrix.length; j++) {
matrix[i][j] = sc.nextInt();
if (matrix[i][j] % 2 == 0) {
count++;
}
}
if (count < minEven) {
row = i;
}
}
for (int j = 0; j < matrix.length; j++) {
sum++;
}
System.out.println(sum);
}
}
| [
"noreply@github.com"
] | Fallinloveregin.noreply@github.com |
929ee368a8d01916a3bd6d9141dda60a437cd05f | ee60de1b71be1e5c9f97996d4b9a6f7b5ceef5df | /src/main/java/com/timokhov/web/chat_service/config/logger/models/AnnotatedDtoLogger.java | 8423edc6830875780e9f1fddd2ba7d9a9cecc4ff | [] | no_license | Timokhov/chat-service | 84c21271286d094325f3ea0ba218314026f11a44 | b096e38317069ff6430cbf30dade13bbd442abdc | refs/heads/master | 2022-12-28T14:30:54.981375 | 2020-10-14T16:15:32 | 2020-10-14T16:15:32 | 301,987,942 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 512 | java | package com.timokhov.web.chat_service.config.logger.models;
import com.timokhov.web.chat_service.config.logger.utils.LogToStringBuilder;
public class AnnotatedDtoLogger extends Logger {
@SuppressWarnings("UnusedDeclaration")
public AnnotatedDtoLogger(Class<?> clazz) {
super(clazz);
}
public AnnotatedDtoLogger(String name) {
super(name);
}
@Override
protected Object[] processArgs(Object... args) {
return LogToStringBuilder.toStringArgs(args);
}
}
| [
"timokhov@haulmont.com"
] | timokhov@haulmont.com |
c7a3a26a4cd42e5a020b11464149d8024d522d53 | a8c32185929d8b2c675b96466850175eaa165dee | /StorageDrive-Backend/RestServer/src/main/java/crio/vicara/controller/FileController.java | c39c548cec833d06ea5ab866c9f4844d5bbfe96a | [] | no_license | sahithreddy05/EnterpriseStorageDrive | 878a75191ca36ae1acef5a5159700df697b4f0dd | 10b8509e11700146ecf1fc404534b605ebd06b16 | refs/heads/main | 2023-04-03T01:27:13.583503 | 2021-04-14T15:23:13 | 2021-04-14T15:23:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,596 | java | package crio.vicara.controller;
import crio.vicara.File;
import crio.vicara.service.FileDetails;
import crio.vicara.service.StorageManager;
import crio.vicara.user.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.InputStreamResource;
import org.springframework.http.*;
import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.nio.file.FileAlreadyExistsException;
import java.nio.file.NotDirectoryException;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/api")
public class FileController {
@Autowired
StorageManager storageManager;
@Autowired
UserDao userDao;
@PostMapping(value = "/files/{parentId}", consumes = {MediaType.APPLICATION_JSON_VALUE})
public String createDirectory(@PathVariable String parentId,
@RequestBody Map<String, Object> payload,
Authentication authentication) throws FileAlreadyExistsException, FileNotFoundException {
String folderName = (String) payload.get("folderName");
String currUserEmail = authentication.getName();
return storageManager.createFolder(parentId, folderName, currUserEmail);
}
@PostMapping(value = "/files", consumes = {MediaType.APPLICATION_JSON_VALUE})
public String createDirectoryInsideUserRootFolder(@RequestBody Map<String, Object> payload,
Authentication authentication) throws FileAlreadyExistsException, FileNotFoundException {
String folderName = (String) payload.get("folderName");
String currUserEmail = authentication.getName();
return storageManager
.createFolderInsideUserRootFolder(
folderName,
userDao.findByEmail(currUserEmail).getStorageProvider(),
currUserEmail
);
}
@PostMapping(value = "/files/upload/{parentId}", consumes = {MediaType.MULTIPART_FORM_DATA_VALUE})
public String uploadFile(@PathVariable String parentId,
Authentication authentication,
@RequestParam("file") MultipartFile file) throws IOException {
String createdFileId;
String currUserEmail = authentication.getName();
createdFileId = storageManager.uploadFile(parentId, file.getOriginalFilename(), file.getInputStream(), file.getSize(), currUserEmail);
return createdFileId;
}
@PostMapping(value = "/files/upload", consumes = {MediaType.MULTIPART_FORM_DATA_VALUE})
public String uploadFileInsideUserRootFolder(Authentication authentication,
@RequestParam("file") MultipartFile file) throws IOException {
String currUserEmail = authentication.getName();
return storageManager.uploadFileInsideUserRootFolder(file.getOriginalFilename(),
file.getInputStream(),
file.getSize(),
userDao.findByEmail(currUserEmail).getStorageProvider(),
currUserEmail);
}
@GetMapping(value = "/files/{fileId}")
public Object getFileOrFolder(Authentication authentication,
@PathVariable String fileId,
HttpServletResponse servletResponse) throws FileNotFoundException {
String currUserEmail = authentication.getName();
Object res = storageManager.getFileOrFolder(fileId, currUserEmail);
if (res instanceof URL) {
servletResponse.setHeader("Location", ((URL) res).toExternalForm());
servletResponse.setStatus(302);
} else if (res instanceof InputStream) {
InputStreamResource isr = new InputStreamResource((InputStream) res);
HttpHeaders respHeaders = new HttpHeaders();
respHeaders.setContentLength(storageManager.getLength(fileId));
ContentDisposition disposition = ContentDisposition
.inline()
.filename(storageManager.getFileName(fileId))
.build();
return new ResponseEntity<>(isr, respHeaders, HttpStatus.OK);
} else if (res instanceof File) {
return res;
}
return null;
}
@GetMapping(value = "/files")
public File getUserHomeFolder(Authentication authentication) throws FileNotFoundException {
String currUserEmail = authentication.getName();
return storageManager.getUserRootFolder(currUserEmail,
userDao.findByEmail(currUserEmail).getStorageProvider());
}
@DeleteMapping(value = "/files/{fileId}")
public void deleteFile(Authentication authentication,
@PathVariable String fileId) throws FileNotFoundException {
storageManager.deleteFile(fileId, authentication.getName());
}
@PutMapping(value = "/files/move")
public void moveFileOrFolder(Authentication authentication,
@RequestBody Map<String, String> payload) throws FileAlreadyExistsException, NotDirectoryException, FileNotFoundException {
storageManager.move(
payload.get("fromId"),
payload.get("toId"),
Boolean.parseBoolean(payload.get("forced")),
authentication.getName()
);
}
@GetMapping(value = "/files/{fileId}/details")
public FileDetails getFileDetails(Authentication authentication, @PathVariable String fileId) throws FileNotFoundException {
return storageManager.getFileDetails(fileId, authentication.getName());
}
@PatchMapping(value = "/files/{fileId}/details")
public FileDetails patchFileDetails(Authentication authentication,
@PathVariable String fileId,
@RequestBody Map<String, String> payload) throws FileAlreadyExistsException, FileNotFoundException {
return storageManager.patchFileDetails(fileId, authentication.getName(), payload);
}
@GetMapping(value = "/files/favourites")
public List<FileDetails> getFavourites(Authentication authentication) {
return storageManager.getFavourites(authentication.getName());
}
}
| [
"edu.karthikch@gmail.com"
] | edu.karthikch@gmail.com |
2c63ed9e2bee89619e1043da3d343991f19b7b49 | 1d928c3f90d4a0a9a3919a804597aa0a4aab19a3 | /java/neo4j/2016/8/UnitOfWork.java | cd143ea2a22f539564f566b1d72bf9caf7320b40 | [] | no_license | rosoareslv/SED99 | d8b2ff5811e7f0ffc59be066a5a0349a92cbb845 | a062c118f12b93172e31e8ca115ce3f871b64461 | refs/heads/main | 2023-02-22T21:59:02.703005 | 2021-01-28T19:40:51 | 2021-01-28T19:40:51 | 306,497,459 | 1 | 1 | null | 2020-11-24T20:56:18 | 2020-10-23T01:18:07 | null | UTF-8 | Java | false | false | 882 | java | /*
* Copyright (c) 2002-2016 "Neo Technology,"
* Network Engine for Objects in Lund AB [http://neotechnology.com]
*
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.server.helpers;
public interface UnitOfWork
{
void doWork();
}
| [
"rodrigosoaresilva@gmail.com"
] | rodrigosoaresilva@gmail.com |
065b4b334a64af2e191aa21aec0a586e48508a40 | 0382dca68ad748bd316f8960066366d91cffc39b | /binding/src/main/java/com/excilys/cdb/binding/validator/ServiceValidator.java | 44bdb5619e1d1b1f47bd3717082d1cef0c18eac0 | [
"Apache-2.0"
] | permissive | jmouffron/cdb | b88356195861c4ec291002ef2bf4571f26b1191b | 79f7a6ff2c60b9f43af847a26d842ab23d13c2c0 | refs/heads/master | 2020-04-28T04:01:47.757293 | 2019-04-30T16:04:06 | 2019-04-30T16:04:06 | 174,961,972 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,714 | java | package com.excilys.cdb.binding.validator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.excilys.cdb.binding.dto.CompanyDTO;
import com.excilys.cdb.binding.dto.ComputerDTO;
import com.excilys.cdb.binding.exception.BadInputException;
import com.excilys.cdb.core.model.Company;
import com.excilys.cdb.core.model.Computer;
import com.excilys.cdb.binding.utils.DateUtils;
/**
* @author excilys
*
*/
public class ServiceValidator {
public static final Logger log = LoggerFactory.getLogger(ServiceValidator.class);
public static boolean companyValidator(Company newEntity, String entity) throws BadInputException {
if (newEntity == null) {
log.error("Null NewEntity for " + entity);
throw new BadInputException();
}
if (newEntity.getId() <= 0L) {
log.error("Bad Id for " + entity);
throw new BadInputException();
}
if (newEntity.getName() == null || newEntity.getName().isEmpty()) {
log.error("Null Name on NewEntity for " + entity);
throw new BadInputException();
}
return true;
}
public static boolean companyDTOValidator(CompanyDTO newEntity) throws BadInputException {
if (newEntity == null) {
log.error("Null NewEntity for company");
throw new BadInputException();
}
if (newEntity.getId() <= 0L) {
log.error("Bad Id for company");
throw new BadInputException();
}
if (newEntity.getName() == null || newEntity.getName().isEmpty()) {
log.error("Null Name on NewEntity for company");
throw new BadInputException();
}
return true;
}
public static boolean computerValidator(Computer newEntity, String entity) throws BadInputException {
if (newEntity == null) {
log.error("Null NewEntity for " + entity);
throw new BadInputException();
}
if (newEntity.getId() <= 0L) {
log.error("Bad Id on NewEntity for " + entity);
throw new BadInputException();
}
if (newEntity.getName() == null || newEntity.getName().equals("")) {
log.error("Null Name on NewEntity for " + entity);
throw new BadInputException();
}
if (newEntity.getIntroduced() == null && newEntity.getDiscontinued() != null) {
log.error("Discontinued Date on NewEntity without Introduced Date for " + entity);
throw new BadInputException();
}
if (newEntity.getIntroduced() != null && newEntity.getDiscontinued() != null) {
if (newEntity.getIntroduced().compareTo(newEntity.getDiscontinued()) > 0) {
log.error("Discontinued Date on NewEntity before Introduced Date for " + entity);
throw new BadInputException();
}
}
if (newEntity.getCompany() == null) {
log.error("Null Company on NewEntity for " + entity);
throw new BadInputException();
}
ServiceValidator.companyValidator(newEntity.getCompany(), entity);
return true;
}
public static boolean computerDTOValidator(ComputerDTO newEntity, String entity) throws BadInputException {
if (newEntity == null) {
log.error("Null NewEntity for " + entity);
throw new BadInputException();
}
if (newEntity.getId() <= 0L) {
log.error("Bad Id on NewEntity for " + entity);
throw new BadInputException();
}
if (newEntity.getName() == null || newEntity.getName().equals("")) {
log.error("Null Name on NewEntity for " + entity);
throw new BadInputException();
}
if (newEntity.getIntroduced() == null && newEntity.getDiscontinued() != null) {
log.error("Discontinued Date on NewEntity without Introduced Date for " + entity);
throw new BadInputException();
}
if (newEntity.getIntroduced() != null && newEntity.getDiscontinued() != null) {
if (DateUtils.stringToTimestamp( newEntity.getIntroduced() ).compareTo( DateUtils.stringToTimestamp( newEntity.getIntroduced() ) ) > 0 ) {
log.error("Discontinued Date on NewEntity before Introduced Date for " + entity);
throw new BadInputException();
}
}
if (newEntity.getCompanyName() == null || newEntity.getCompanyName().equals("") ) {
log.error("Null Company on NewEntity for " + entity);
throw new BadInputException();
}
return true;
}
public static boolean idValidator(Long id, String entity) throws BadInputException {
if (id <= 0L) {
log.error("Bad Id for " + entity);
throw new BadInputException();
}
if (id > Long.MAX_VALUE) {
log.error("Bad Input of id for " + entity);
throw new BadInputException("Id too big inputted!");
}
return true;
}
public static boolean nameValidator(String name, String entity) throws BadInputException {
if (name == null || name.equals("")) {
log.error("Bad Name for " + entity);
throw new BadInputException();
}
return true;
}
}
| [
"jmouffron@excilys.com"
] | jmouffron@excilys.com |
abac85007466a9db7fd59c16b876bbc15f5d4129 | db85b798adc12d99ccc2038e05f2b8d38959209c | /Cyclists/src/cyclists/forms/Cyclist/ModifyCiclyst.java | 19fcd29f94a13d1ea2d8244f4477d6c052195cf3 | [] | no_license | rsberrocal/programacionEugeni | 5a1a45da1b8c841ed485fc7824f4036c1ae69b0d | d3ca214aea9f1c005ef456cd68feca9f82256c00 | refs/heads/master | 2021-01-22T20:43:54.144858 | 2017-05-23T16:36:10 | 2017-05-23T16:36:10 | 85,344,635 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 33,321 | 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 cyclists.forms.Cyclist;
import cyclists.Database;
import cyclists.Entity.Cyclist;
import cyclists.forms.MainForm;
import java.awt.Toolkit;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
/**
*
* @author Richard
*/
public class ModifyCiclyst extends javax.swing.JFrame {
/**
* Creates new form AddCiclyst
*/
public ModifyCiclyst() {
initComponents();
setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("../../../images/icon.png")));
//Setting the global index for movement buttons
index = 0;
//Setting the Left buttons because we start with index ==0
btTotalLeft.setEnabled(false);
btLeft.setEnabled(false);
cbTeams.setEnabled(false);
tfDorsal.setEnabled(false);
tfAge.setEnabled(false);
//Filling up the list with all the data from cyclist
try {
addItemsCombo();
Cyclist c = new Cyclist();
cyclistData = c.cyclistData();
c.loadTable(pTableCyclist);
} catch (SQLException ex) {
Logger.getLogger(DeleteCiclyst.class.getName()).log(Level.SEVERE, null, ex);
}
//Setting up the width and aligning the cell of the table
// cellWidth();
// alignCells();
}
//Own variables
//Index to move the buttons
public int index;
//list with all the data from cyclist
public List<Cyclist> cyclistData;
//Booleans for movement buttons
public boolean btRightPressed = false;
public boolean btLeftPressed = false;
public boolean btTotalLeftPressed = false;
public boolean btSearchPressed = false;
/**
* 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() {
tfAge = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
tfDorsal = new javax.swing.JTextField();
btRight = new javax.swing.JButton();
jLabel4 = new javax.swing.JLabel();
btTotalRight = new javax.swing.JButton();
jLabel5 = new javax.swing.JLabel();
btLeft = new javax.swing.JButton();
btTotalLeft = new javax.swing.JButton();
btModify = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
tfName = new javax.swing.JTextField();
btSearch = new javax.swing.JButton();
cbTeams = new javax.swing.JComboBox<>();
pTableCyclist = new javax.swing.JPanel();
setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
setResizable(false);
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {
formWindowClosing(evt);
}
});
jLabel3.setText("Team");
btRight.setText(">");
btRight.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btRightActionPerformed(evt);
}
});
jLabel4.setText("Dorsal");
btTotalRight.setText(">>");
btTotalRight.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btTotalRightActionPerformed(evt);
}
});
jLabel5.setText("Age");
btLeft.setText("<");
btLeft.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btLeftActionPerformed(evt);
}
});
btTotalLeft.setText("<<");
btTotalLeft.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btTotalLeftActionPerformed(evt);
}
});
btModify.setText("Modify");
btModify.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btModifyActionPerformed(evt);
}
});
jLabel1.setText("Modify Cyclist");
jLabel2.setText("Name");
btSearch.setText("Search");
btSearch.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btSearchActionPerformed(evt);
}
});
cbTeams.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] {""}));
pTableCyclist.setMaximumSize(new java.awt.Dimension(32767, 234));
javax.swing.GroupLayout pTableCyclistLayout = new javax.swing.GroupLayout(pTableCyclist);
pTableCyclist.setLayout(pTableCyclistLayout);
pTableCyclistLayout.setHorizontalGroup(
pTableCyclistLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 459, Short.MAX_VALUE)
);
pTableCyclistLayout.setVerticalGroup(
pTableCyclistLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 0, Short.MAX_VALUE)
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(tfDorsal, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2)
.addComponent(jLabel3))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(tfName, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(16, 16, 16)
.addComponent(cbTeams, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(btSearch)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(tfAge, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel5, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
.addGroup(layout.createSequentialGroup()
.addComponent(btTotalLeft)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(btLeft)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(btRight))
.addComponent(btModify))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btTotalRight))))
.addGroup(layout.createSequentialGroup()
.addGap(87, 87, 87)
.addComponent(jLabel1)))
.addGap(18, 18, 18)
.addComponent(pTableCyclist, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(29, 29, 29)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(pTableCyclist, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(tfName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btSearch, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(cbTeams, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(17, 17, 17)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(tfDorsal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(tfAge, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btRight)
.addComponent(btLeft)
.addComponent(btTotalRight)
.addComponent(btTotalLeft))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(btModify)))
.addGap(37, 37, 37))
);
pack();
}// </editor-fold>//GEN-END:initComponents
public void enableFields() {
if (!cbTeams.isEnabled() && !tfDorsal.isEnabled() && !tfAge.isEnabled()) {
cbTeams.setEnabled(true);
tfDorsal.setEnabled(true);
tfAge.setEnabled(true);
}
}
//Function for set items on ComboBox
public void addItemsCombo() throws SQLException {
//Query
String query = "select nomeq from Equips;";
Database db = new Database();
//Connect
db.makeConnection();
try (
Statement st = db.getConnection().createStatement();
ResultSet rs = st.executeQuery(query);) {
while (rs.next()) {
cbTeams.addItem(rs.getString(1));
}
} catch (SQLException e) {
System.out.println("Error " + e.getMessage());
}
//Disconnect
db.closeConnection();
}
private void btRightActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btRightActionPerformed
// TODO add your handling code here:
//If any other button was pressed before set index++
if (btLeftPressed || btSearchPressed || btTotalLeftPressed) {
index++;
btLeftPressed = false;
btTotalLeftPressed = false;
btSearchPressed = false;
}
//If index is less than 0 set index == 0
if (index < 0) {
index = 0;
}
//Set the TextField with the data of cyclist(index)
tfName.setText(cyclistData.get(index).getNom());
tfDorsal.setText(String.valueOf(cyclistData.get(index).getDorsal()));
tfAge.setText(String.valueOf(cyclistData.get(index).getEdad()));
cbTeams.setSelectedItem(cyclistData.get(index).getNomeq());
//tfTeam.setText(cyclistData.get(index).getNomeq());
//Index increase
index++;
//If this button boolean wasn't pressed
if (!btRightPressed) {
btRightPressed = true;
}
//Enable left buttons if they are disabled
if (!btTotalLeft.isEnabled() && !btLeft.isEnabled()) {
btTotalLeft.setEnabled(true);
btLeft.setEnabled(true);
}
//Disable right buttons if index is equals to last position from the list
if (index == cyclistData.size()) {
btTotalRight.setEnabled(false);
btRight.setEnabled(false);
}
enableFields();
}//GEN-LAST:event_btRightActionPerformed
private void btTotalRightActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btTotalRightActionPerformed
//Set the TextFields with all the data from the last cyclist
tfName.setText(cyclistData.get(cyclistData.size() - 1).getNom());
tfDorsal.setText(String.valueOf(cyclistData.get(cyclistData.size() - 1).getDorsal()));
tfAge.setText(String.valueOf(cyclistData.get(cyclistData.size() - 1).getEdad()));
cbTeams.setSelectedItem(cyclistData.get(cyclistData.size() - 1).getNomeq());
// tfTeam.setText(cyclistData.get(cyclistData.size() - 1).getNomeq());
//Set index to last position from the list
index = cyclistData.size() - 1;
//Disable right buttons because is the last cyclist
btTotalRight.setEnabled(false);
btRight.setEnabled(false);
//Enable left buttons if they are disable
if (!btTotalLeft.isEnabled() && !btLeft.isEnabled()) {
btTotalLeft.setEnabled(true);
btLeft.setEnabled(true);
}
enableFields();
}//GEN-LAST:event_btTotalRightActionPerformed
private void btLeftActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btLeftActionPerformed
//If any other button was pressed before set index--
if ((btRightPressed) && index != 1 && index != cyclistData.size() - 1) {
index--;
btRightPressed = false;
}
//Set boolean true if this button wasn't pressed before
if (!btLeftPressed) {
btLeftPressed = true;
}
//Set index ==0 if this index is less than 0
if (index < 0) {
index = 0;
} else {
//Else reduce index
index--;
}
//Set the TextField with the data of cyclist(index)
tfName.setText(cyclistData.get(index).getNom());
tfDorsal.setText(String.valueOf(cyclistData.get(index).getDorsal()));
tfAge.setText(String.valueOf(cyclistData.get(index).getEdad()));
cbTeams.setSelectedItem(cyclistData.get(index).getNomeq());
// tfTeam.setText(cyclistData.get(index).getNomeq());
//Enable right buttons if they are disabled
if (!btTotalRight.isEnabled() && !btRight.isEnabled()) {
btTotalRight.setEnabled(true);
btRight.setEnabled(true);
}
//Disable left buttons if index is the first cyclist
if (index == 0) {
btTotalLeft.setEnabled(false);
btLeft.setEnabled(false);
}
enableFields();
}//GEN-LAST:event_btLeftActionPerformed
private void btTotalLeftActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btTotalLeftActionPerformed
//Set boolean true if this button wasn't pressed before
if (!btTotalLeftPressed) {
btTotalLeftPressed = true;
}
//Set the TextFields with all the data from the first cyclist
tfName.setText(cyclistData.get(0).getNom());
tfDorsal.setText(String.valueOf(cyclistData.get(0).getDorsal()));
tfAge.setText(String.valueOf(cyclistData.get(0).getEdad()));
//tfTeam.setText(cyclistData.get(0).getNomeq());
cbTeams.setSelectedItem(cyclistData.get(0).getNomeq());
//Set index to 0 because is the first cyclist
index = 0;
//Disable left buttons because is the first cyclist
btTotalLeft.setEnabled(false);
btLeft.setEnabled(false);
//Enable left buttons if they are disable
if (!btTotalRight.isEnabled() && !btRight.isEnabled()) {
btTotalRight.setEnabled(true);
btRight.setEnabled(true);
}
enableFields();
}//GEN-LAST:event_btTotalLeftActionPerformed
private void btModifyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btModifyActionPerformed
int oldDorsal = cyclistData.get(index).getDorsal();
// tfAlerts
if (tfDorsal.getText().isEmpty() && tfName.getText().isEmpty() && tfAge.getText().isEmpty()) {
MainForm.alertsWarning(this, "", "Name, Dorsal and Age are missing");
// putting focus on tfName
tfName.requestFocus();
} else if (tfDorsal.getText().isEmpty() && tfName.getText().isEmpty()) {
MainForm.alertsWarning(this, "", "Name and Dorsal are missing");
// putting focus on tfName
tfName.requestFocus();
} else if (tfAge.getText().isEmpty() && tfDorsal.getText().isEmpty()) {
MainForm.alertsWarning(this, "", "Age and Dorsal are missing");
// putting focus on tfDorsal
tfDorsal.requestFocus();
} else if (tfAge.getText().isEmpty() && tfName.getText().isEmpty()) {
MainForm.alertsWarning(this, "", "Age and Name are missing");
// putting focus on tfName
tfName.requestFocus();
} else if (tfName.getText().isEmpty()) {
MainForm.alertsWarning(this, "", "Name missing");
// putting focus on tfName
tfName.requestFocus();
} else if (tfDorsal.getText().isEmpty()) {
MainForm.alertsWarning(this, "", "Dorsal missing");
// putting focus on tfDorsal
tfDorsal.requestFocus();
} else if (tfAge.getText().isEmpty()) {
MainForm.alertsWarning(this, "", "Age missing");
// putting focus on tfAge
tfAge.requestFocus();
// End of tfAlerts
} else {
StringBuilder sqlUpdate = new StringBuilder();;
StringBuilder sqlSearchDorsal = new StringBuilder();;
sqlUpdate.append("update Ciclistes set ");
sqlUpdate.append("dorsal = ? ,");
sqlUpdate.append("nom = ? ,");
sqlUpdate.append("edad = ? ,");
sqlUpdate.append("nomeq = ? ");
sqlUpdate.append("where dorsal = ? ;");
Database db = new Database();
try {
//Connect
db.makeConnection();
PreparedStatement pst = db.getConnection().prepareStatement(sqlUpdate.toString());
pst.setInt(1, Integer.parseInt(tfDorsal.getText()));
pst.setString(2, tfName.getText());
pst.setInt(3, Integer.parseInt(tfAge.getText()));
pst.setString(4, cbTeams.getSelectedItem().toString());
pst.setInt(5, oldDorsal);
String n = pst.toString();
pst.execute();
//Disconnect
db.closeConnection();
MainForm.alertsInformation(this, "Row Modified", "Row Modified");
} catch (SQLException ex) {
Logger.getLogger(ModifyCiclyst.class.getName()).log(Level.SEVERE, null, ex);
}
this.setVisible(false);
}
}//GEN-LAST:event_btModifyActionPerformed
private void searchCyclist(String name) {
//Adding % to search any cyclist with this text
name = name + "%";
//Querys
//Query to know how many cyclist we got with the same name
String queryCount = "select count(*) from Ciclistes where nom like '" + name + "';";
//Query to know these names if we got more than 1 cyclist with the same name
String queryNames = "select nom from Ciclistes where nom like '" + name + "';";
Database db = new Database();
//If the TextField name is empty, it opens a dialog that inform the user
if (tfName.getText().isEmpty()) {
MainForm.alertsWarning(this, "Name Missing", "Name Missing");
} else {
try {
//Connect
db.makeConnection();
//Start the query
Statement stCount = db.getConnection().createStatement();
ResultSet rsCount = stCount.executeQuery(queryCount);
//See if we can put IF and not WHILE
while (rsCount.next()) {//Loop Count
//If we got more than 1 cyclist with the same name
if (rsCount.getInt(1) > 1) {
//Start the query to get these names
Statement stName = db.getConnection().createStatement();
ResultSet rsName = stName.executeQuery(queryNames);
//Array to save the names
String[] names = new String[rsCount.getInt(1)];
//index to navigate this array
int i = 0;
while (rsName.next()) {//Loop names to save the names on the array
names[i] = rsName.getString(1);
i++;
}//End loop names
//Create a new dialog to make the user chose one of the names below
String input = (String) JOptionPane.showInputDialog(null, "Choose Cyclist Team",
"Select a Team", JOptionPane.INFORMATION_MESSAGE, null,
names, // Array with names
names[0]); // Default choise
;//End dialog
//Query to get the data of cyclist choosed
String queryFinal = "select dorsal,edad,nomeq from Ciclistes where nom like '" + input + "';";
//Start the query
Statement stFinal = db.getConnection().createStatement();
ResultSet rsFinal = stFinal.executeQuery(queryFinal);
//Setting up the TextFields with all the data of this cyclist
while (rsFinal.next()) {//Loop
tfDorsal.setText(String.valueOf(rsFinal.getInt(1)));
tfAge.setText(String.valueOf(rsFinal.getInt(2)));
cbTeams.setSelectedItem(rsFinal.getString(3));
}//End loop
//Finally set the name of this cyclist
tfName.setText(input);
//If this cyclist doesn't exists
} else if (rsCount.getInt(1) == 0) {
//Create a new dialog informing the use that this Cyclist doesnt exist
MainForm.alertsInformation(this, "Cyclist doesn't exists", "Cyclist doesn't exists");
//If there is only 1 cyclist with this name
} else {
//Query to know all the data about this cyclist
String queryFinal = "select dorsal,edad,nomeq,nom from Ciclistes where nom like '" + name + "';";
//Start the query
Statement stFinal = db.getConnection().createStatement();
ResultSet rsFinal = stFinal.executeQuery(queryFinal);
//Setting up the TextFields with all the data of this cyclist
while (rsFinal.next()) {
tfDorsal.setText(String.valueOf(rsFinal.getInt(1)));
tfAge.setText(String.valueOf(rsFinal.getInt(2)));
// tfTeam.setText(rsFinal.getString(3));
cbTeams.setSelectedItem(rsFinal.getString(3));
tfName.setText(rsFinal.getString(4));
}
}
}
//Set the index == 0 to search exactly the index of this cyclist
index = 0;
//index = cyclistData.indexOf(tfDorsal.getText());
for (int j = 0; j < cyclistData.size(); j++) {//Loop index
//If dorsal of cyclist(j) is equals to the text of dorsal TextField
if (cyclistData.get(j).getDorsal() == Integer.parseInt(tfDorsal.getText())) {
//If is the last position, set index to the last position
if (j == cyclistData.size()) {
index = j - 1;
} else {
//else set index to j
index = j;
}
}
}//End loop
//Disconnect
db.closeConnection();
} catch (SQLException ex) {
Logger.getLogger(DeleteCiclyst.class.getName()).log(Level.SEVERE, null, ex);
}
//If index == 0 disable the left buttons and enable the right buttons
if (index == 0) {
btTotalLeft.setEnabled(false);
btLeft.setEnabled(false);
btTotalRight.setEnabled(true);
btRight.setEnabled(true);
//If index == 0 disable the right buttons and enable the left buttons
} else if (index == cyclistData.size() - 1) {
btTotalLeft.setEnabled(true);
btLeft.setEnabled(true);
btTotalRight.setEnabled(false);
btRight.setEnabled(false);
//If index is between 0 and cyclistData.size enable all the buttons
} else {
btTotalLeft.setEnabled(true);
btLeft.setEnabled(true);
btTotalRight.setEnabled(true);
btRight.setEnabled(true);
}
//Finally set true the boolean btSearchPressed to know that this buttons has been pressed
btSearchPressed = true;
//And set false the rest of booleans
btLeftPressed = false;
btRightPressed = false;
btTotalLeftPressed = false;
enableFields();
}
}//End function
private void btSearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btSearchActionPerformed
//Calling the function search to search the cyclist that the user put on the TextField name
searchCyclist(tfName.getText());
}//GEN-LAST:event_btSearchActionPerformed
private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
// TODO add your handling code here:
this.setVisible(false);
}//GEN-LAST:event_formWindowClosing
/**
* @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(ModifyCiclyst.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(ModifyCiclyst.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(ModifyCiclyst.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(ModifyCiclyst.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new ModifyCiclyst().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btLeft;
private javax.swing.JButton btModify;
private javax.swing.JButton btRight;
private javax.swing.JButton btSearch;
private javax.swing.JButton btTotalLeft;
private javax.swing.JButton btTotalRight;
private javax.swing.JComboBox<String> cbTeams;
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 pTableCyclist;
private javax.swing.JTextField tfAge;
private javax.swing.JTextField tfDorsal;
private javax.swing.JTextField tfName;
// End of variables declaration//GEN-END:variables
}
| [
"rsberrocal@gmail.com"
] | rsberrocal@gmail.com |
c1d1ea9a1be7e3bd35b5183a362b397a30c6bc34 | 722877318384266d06dbcff67738f5c5c7f16508 | /src/djm_lab7/Form1.java | b307305ca013b3d19eb250c70dc32bce78999966 | [
"Apache-2.0"
] | permissive | Dyusembayeva/DJM_Lab7 | 1d3cb61ba7479bf3821f3145aa2454c6baa8a973 | e6c68affe2aaacb0c727f0d99fb3f6e9bbb280fd | refs/heads/master | 2023-04-09T09:53:46.525820 | 2021-04-23T12:03:33 | 2021-04-23T12:03:33 | 360,869,895 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,570 | java | package djm_lab7;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Scanner;
import javax.swing.JFileChooser;
import javax.swing.filechooser.FileNameExtensionFilter;
public class Form1 extends javax.swing.JFrame {
public String FileName, DirName; // Имя входного файла с данными и его каталог
public int Row = 5, Col = 6;
public int myArray[][] = new int[Row][Col]; // Массив для обработки данных
public Form1() {
initComponents();
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
Upload = new javax.swing.JButton();
Solve = new javax.swing.JButton();
Save = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Работа с массивами и файлами в Java");
setIconImage(java.awt.Toolkit.getDefaultToolkit().createImage(getClass().getResource("icon.png")));
setResizable(false);
getContentPane().setLayout(null);
jTextArea1.setColumns(20);
jTextArea1.setFont(new java.awt.Font("Serif", 0, 15)); // NOI18N
jTextArea1.setRows(5);
jScrollPane1.setViewportView(jTextArea1);
getContentPane().add(jScrollPane1);
jScrollPane1.setBounds(30, 10, 260, 310);
Upload.setText("Загрузить");
Upload.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
UploadActionPerformed(evt);
}
});
getContentPane().add(Upload);
Upload.setBounds(340, 40, 180, 40);
Solve.setText("Обработать");
Solve.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
SolveActionPerformed(evt);
}
});
getContentPane().add(Solve);
Solve.setBounds(340, 100, 180, 40);
Save.setText("Сохранить");
Save.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
SaveActionPerformed(evt);
}
});
getContentPane().add(Save);
Save.setBounds(340, 160, 180, 40);
jLabel1.setText("<html> <p align=\"center\"> <strong> Задание: </strong> Если в третьей строке стоят все единицы, то увеличить максимальный элемент первого столбца в два раза, а максимальный элемент второго столбца в три раза. </p> </html>");
getContentPane().add(jLabel1);
jLabel1.setBounds(320, 220, 230, 90);
setSize(new java.awt.Dimension(584, 374));
setLocationRelativeTo(null);
}// </editor-fold>//GEN-END:initComponents
private void UploadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_UploadActionPerformed
JFileChooser choose = new JFileChooser(); // Объект выбора файла
choose.setCurrentDirectory(new File(".").getAbsoluteFile().getParentFile()); //выбираем текущий каталог
choose.setFileFilter(new FileNameExtensionFilter("TXT files", "txt")); //Фильтр только для текстовых файлов
choose.setDialogTitle("Выбрать");
choose.setAcceptAllFileFilterUsed(false); // Выкл "все файлы" в фильтре
int dialog = choose.showDialog(null, "Выбрать");
if (dialog != JFileChooser.APPROVE_OPTION)
{
return; // Если файл не был выбран, то выход
}
FileName = choose.getSelectedFile().getPath(); // Получить имя файла Например input.txt
DirName = choose.getSelectedFile().getParent() + System.getProperty("file.separator"); // Получение директорий файла
try{
Scanner fileInput = new Scanner(new FileInputStream(FileName));
for (int i = 0; i < Row; i++) // Загружаем данные с файла в массив
{
for (int j = 0; j < Col; j++)
{
myArray[i][j] = fileInput.nextInt(); //Записываем по символу в массив
}
}
jTextArea1.setText("Исходные данные из файла:\n");
for (int i = 0; i < Row; i++)
{
for(int j = 0; j < Col; j++)
{
jTextArea1.append(String.format("%5d", myArray[i][j]));
}
jTextArea1.append("\n");
}
Solve.setEnabled(true);
}
catch(Exception e){
jTextArea1.setText("Error Reading File");
Solve.setEnabled(false);
Save.setEnabled(false);
}
}//GEN-LAST:event_UploadActionPerformed
private void SolveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SolveActionPerformed
int countOne = 0;
for (int i = 0; i < Col; i++)
{
if (myArray[2][i] == 1)
{
countOne++;
}
}
if (countOne == Col)
{
int max1 = myArray[0][0], max2 = myArray[0][0], maxDouble = 0, maxTriple = 0;
for (int i = 0; i < Row; i++)
{
System.out.println(myArray[i][0]);
if(myArray[i][0] > max1) // Находим макс элемент в первом столбце
{
max1 = myArray[i][0];
}
if(myArray[i][1] > max2) //// Находим макс элемент во втором столбце
{
max2 = myArray[i][1];
}
}
for (int i = 0; i < Row; i++)
{
System.out.println(myArray[i][0]);
if(myArray[i][0] == max1)
{
myArray[i][0] = max1 * 2;
}
if(myArray[i][1] == max2)
{
myArray[i][1] = max2 * 3;
}
}
for (int i = 0; i < Row; i++)
{
System.out.println(myArray[i][1]);
}
Save.setEnabled(true);
}
else
{
jTextArea1.append("\n Третья строка не состоит только из единиц!");
}
}//GEN-LAST:event_SolveActionPerformed
private void SaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SaveActionPerformed
try
{
PrintWriter fileOutput = new PrintWriter(new OutputStreamWriter(new FileOutputStream(DirName + "output.txt")));
for (int i = 0; i < Row; i++) // Сохранение результата в выходной файл
{
fileOutput.println("");
for (int j = 0; j < Col; j++)
{
fileOutput.print(String.format("%5d", myArray[i][j]));
}
}
fileOutput.flush();// Метод Сохранения
fileOutput.close(); // Метод закрытия файла
jTextArea1.append("\n Результат: \n");
for(int i = 0; i < Row; i++)
{
for (int j = 0; j < Col; j++)
{
jTextArea1.append(String.format("%5d", myArray[i][j]));
}
jTextArea1.append("\n");
}
}
catch(Exception e)
{
jTextArea1.append("Ошибка чтения или записи в файле");
}
}//GEN-LAST:event_SaveActionPerformed
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(Form1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Form1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Form1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Form1.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 Form1().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton Save;
private javax.swing.JButton Solve;
private javax.swing.JButton Upload;
private javax.swing.JLabel jLabel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextArea jTextArea1;
// End of variables declaration//GEN-END:variables
}
| [
"qodandhod@gmail.com"
] | qodandhod@gmail.com |
2d6be774f68f4a5be83857934edd9b94e6fcce2a | 02db1343f5d5cbf365c4b00534dc4b40d6993571 | /03.Semestr/08/src/main/java/ru/javalab/servletshop/service/SignUpServiceImpl.java | 98ed7b81b7a45d7b55bd02e5389de5c27db44f38 | [] | no_license | ttr843/JavaLab | 2d3e80099a8cb7df436184f5f12d2b704a6ae42d | b54eadd2db0869cdffc43ed3e64703f9a55bdd82 | refs/heads/master | 2021-05-17T04:03:15.527146 | 2021-01-16T18:15:30 | 2021-01-16T18:15:30 | 250,612,163 | 0 | 0 | null | 2020-10-25T22:18:19 | 2020-03-27T18:21:13 | Java | UTF-8 | Java | false | false | 995 | java | package ru.javalab.servletshop.service;
import ru.javalab.context.Component;
import ru.javalab.servletshop.Helpers.PasswordHasher;
import ru.javalab.servletshop.dto.UserDto;
import ru.javalab.servletshop.model.User;
import ru.javalab.servletshop.repository.UserRepositoryImpl;
public class SignUpServiceImpl implements SignUpService, Component {
private UserRepositoryImpl userRepository;
public SignUpServiceImpl() {
}
@Override
public UserDto signUp(String login, String password) {
User user = userRepository.findByName(login);
if(user != null) {
if(PasswordHasher.checkPassword(password,user.getPassword())) {
return new UserDto(user.getId(),user.getLogin());
}
}else {
userRepository.save(new User(login,password));
User savedUser = userRepository.findByName(login);
return new UserDto(savedUser.getId(),savedUser.getLogin());
}
return null;
}
}
| [
"empty-15@mail.ru"
] | empty-15@mail.ru |
924048c0bc007d709db9dec8bf8309ad894d01fe | 62e330c99cd6cedf20bc162454b8160c5e1a0df8 | /basex-core/src/main/java/org/basex/query/func/array/ArrayFilter.java | b34322bd79fe72ad67a6e48817b4b2f554ff6151 | [
"BSD-3-Clause"
] | permissive | nachawati/basex | 76a717b069dcea3932fad5116e0a42a727052b58 | 0bc95648390ec3e91b8fd3e6ddb9ba8f19158807 | refs/heads/master | 2021-07-20T06:57:18.969297 | 2017-10-31T04:17:00 | 2017-10-31T04:17:00 | 106,351,382 | 0 | 0 | null | 2017-10-10T01:00:38 | 2017-10-10T01:00:38 | null | UTF-8 | Java | false | false | 830 | java | package org.basex.query.func.array;
import org.basex.query.*;
import org.basex.query.value.*;
import org.basex.query.value.array.*;
import org.basex.query.value.array.Array;
import org.basex.query.value.item.*;
import org.basex.util.*;
/**
* Function implementation.
*
* @author BaseX Team 2005-17, BSD License
* @author Christian Gruen
*/
public final class ArrayFilter extends ArrayFn {
@Override
public Item item(final QueryContext qc, final InputInfo ii) throws QueryException {
final Array array = toArray(exprs[0], qc);
final FItem fun = checkArity(exprs[1], 1, qc);
final ArrayBuilder builder = new ArrayBuilder();
for(final Value val : array.members()) {
if(toBoolean(fun.invokeItem(qc, info, val))) builder.append(val);
}
return builder.freeze();
}
}
| [
"mnachawa@gmu.edu"
] | mnachawa@gmu.edu |
22d80197b015e4056e4266ea0ac61cb0ae58badb | c2f0fb6d492ed703cb29741912d1228909f3b194 | /Proiect2OOP/src/App/Classes/CatalogClass.java | babb27f1db79036da9ad1ad377b902a3bcb8528d | [] | no_license | VasileBarabas/Proiect2OOP | ff3567b78cca95a9f6b9fe611b08fe27097ea8b6 | 1bd17e3b51e4c4fea0feb5a81ab309dd020e36d6 | refs/heads/main | 2023-08-28T08:39:52.432421 | 2021-10-20T06:05:18 | 2021-10-20T06:05:18 | 419,204,384 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,071 | java | package App.Classes;
import java.util.Arrays;
public class CatalogClass {
private GradebookClass[] _gradebooksClass=new GradebookClass[30];
private int _numberOfStudent;
public GradebookClass studentSearch(String CNP){
for(int i=0;i<_numberOfStudent;++i) {
if (_gradebooksClass[i].get_CNP().equals(CNP)) {
return _gradebooksClass[i];
}
}
return null;
}
public int get_numberOfStudent() {
return _numberOfStudent;
}
public void set_numberOfStudent(int _numberOfStudent) {
this._numberOfStudent = _numberOfStudent;
}
public GradebookClass get_gradebooksClass(int i) {
return _gradebooksClass[i];
}
public void set_gradebooksClass(GradebookClass _gradebooksClass, int i) {
this._gradebooksClass[i] = _gradebooksClass;
}
public String toString() {
return "CatalogClass{" +
"_gradebooksClass=" + Arrays.toString(_gradebooksClass) +
'}';
}
}
| [
"noreply@github.com"
] | VasileBarabas.noreply@github.com |
1816aeda650742570a0bd65860f3a5e04c9d3ed1 | 54f90d27401c961aa0d3a686a9590bd2766f02d6 | /Java/src/Codoacodo/codoacodo_EjOb_unidad4parte3ej4.java | c5ac8e80b2c50b78902a4080a5fe55be0332359b | [] | no_license | max-gs/CodoAcodo_v1 | a6e289c26da285516a931ebc11f6a59e20c5254e | bf5937600986d1f6204daf977baa0b4913b7ee7f | refs/heads/master | 2023-03-17T04:41:57.103064 | 2018-08-28T00:00:23 | 2018-08-28T00:00:23 | null | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 3,900 | java | package Codoacodo;
import java.awt.*;
import java.awt.Label;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.font.TextAttribute;
import java.util.Map;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JProgressBar;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
@SuppressWarnings("unused")
public class codoacodo_EjOb_unidad4parte3ej4 {
@SuppressWarnings("rawtypes")
private static Map attributes;
@SuppressWarnings("unchecked")
public static void main(String[] args) {
// TODO Auto-generated method stub
JFrame ventana = new JFrame();
// INGRESO DEL NOMBRE
JLabel lblNombre = new JLabel("Nombre:");
Font font = lblNombre.getFont();
setAttributes(font.getAttributes());
//subrayar
//attributes.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
lblNombre.setFont(font.deriveFont(getAttributes()));
JTextField texto_nombre = new JTextField(5);
// PROPIEDADES DE LOS CONTROLES JTextField texto_nombre
texto_nombre.setBounds(new Rectangle(25, 15, 250, 21));
texto_nombre.setText("");
texto_nombre.setEditable(true);
texto_nombre.setHorizontalAlignment(JTextField.LEFT);
// CREACION DEL ComboBox
String opciones[] = { "Border collie", "Pastor alemán", "Golden retriever", "Doberman pinscher", "Caniche" };
JComboBox<Object> Razas = new JComboBox<Object>(opciones);
// crea la ventana y las casillas de seleccion
JCheckBox checkbox = new JCheckBox("Gigante");
JCheckBox checkbox1 = new JCheckBox("Grande");
JCheckBox checkbox2 = new JCheckBox("Mediano");
JCheckBox checkbox3 = new JCheckBox("Pequeño");
JButton btnAceptar = new JButton("Aceptar");
// CREO METODO PARA EL BOTON ACEPTAR Y UN SI PARA QUE CAMBIE EL TITULO
btnAceptar.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent args) {
// nombre y apellido
if (args.getSource() == btnAceptar) {
String nombre = texto_nombre.getText();
String seleccion = "";
// elije los idiomas que sabe
if (checkbox.isSelected()) {
seleccion += "Gigante -";
}
if (checkbox1.isSelected()) {
seleccion += "Grande -";
}
if (checkbox2.isSelected()) {
seleccion += "Mediano -";
}
if (checkbox3.isSelected()) {
seleccion += "Pequeño -";
}
// Raza de Perro
if (args.getSource() == btnAceptar) {
String raza = Razas.getSelectedItem().toString();
JOptionPane.showMessageDialog(null,
"Nombre :" + nombre + "\nRaza :" + raza
+ "\nTamaño :" + seleccion + "\n");
}
}
}
});
JButton btnSalir = new JButton("Salir");
// CREO METODO PARA EL BOTON SALIR
btnSalir.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent args) {
System.exit(0);
}
});
// PROPIEDADES DE LA VENTANA
ventana.setSize(600, 600);
ventana.setTitle("Perros");
ventana.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
ventana.setLayout(new FlowLayout());
ventana.add(lblNombre);
ventana.add(texto_nombre);
ventana.add(Razas);
ventana.add(checkbox);
ventana.add(checkbox1);
ventana.add(checkbox2);
ventana.add(checkbox3);
ventana.add(btnAceptar);
ventana.add(btnSalir);
ventana.setVisible(true);
}
@SuppressWarnings("rawtypes")
public static Map getAttributes() {
return attributes;
}
@SuppressWarnings("rawtypes")
public static void setAttributes(Map attributes) {
codoacodo_EjOb_unidad4parte3ej4.attributes = attributes;
}
}
| [
"gabrielj82@gmail.com"
] | gabrielj82@gmail.com |
058dd350acd45dad8d763b704ab6f79a150ee2a4 | 863acb02a064a0fc66811688a67ce3511f1b81af | /sources/p005cm/aptoide/accountmanager/C1336s.java | aaed127c83e124f71d13ea252237096ddd5aeb91 | [
"MIT"
] | permissive | Game-Designing/Custom-Football-Game | 98d33eb0c04ca2c48620aa4a763b91bc9c1b7915 | 47283462b2066ad5c53b3c901182e7ae62a34fc8 | refs/heads/master | 2020-08-04T00:02:04.876780 | 2019-10-06T06:55:08 | 2019-10-06T06:55:08 | 211,914,568 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 711 | java | package p005cm.aptoide.accountmanager;
import p026rx.p027b.C0132p;
/* renamed from: cm.aptoide.accountmanager.s */
/* compiled from: lambda */
public final /* synthetic */ class C1336s implements C0132p {
/* renamed from: a */
private final /* synthetic */ AccountService f4230a;
/* renamed from: b */
private final /* synthetic */ AptoideCredentials f4231b;
public /* synthetic */ C1336s(AccountService accountService, AptoideCredentials aptoideCredentials) {
this.f4230a = accountService;
this.f4231b = aptoideCredentials;
}
public final Object call(Object obj) {
return AptoideSignUpAdapter.m6125a(this.f4230a, this.f4231b, (Throwable) obj);
}
}
| [
"tusharchoudhary0003@gmail.com"
] | tusharchoudhary0003@gmail.com |
1baf1f93c0a488a45bdefe0ddb31e8be30bc589a | b81d1df0562de9d4ff5c30bec90647402972f478 | /src/test/java/pl/pancordev/leak/eight/five/DummyControllerTest1.java | 23076f6552e2d8614a9b39788b0f4cf58cb69fa8 | [] | no_license | Pancor/leak | eea9fe401a7c9b543bf95a929f0bbf7ee6113dc9 | f060ff6a1a8c829b287cffb35b9d63040ca3c7ec | refs/heads/master | 2023-01-30T17:14:38.463089 | 2020-12-14T12:01:00 | 2020-12-14T12:01:00 | 321,322,490 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,969 | java | package pl.pancordev.leak.eight.five;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.http.MediaType;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
import pl.pancordev.leak.services.Service1;
import static org.springframework.security.test.web.servlet.setup.SecurityMockMvcConfigurers.springSecurity;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@SpringBootTest
@WebAppConfiguration
@RunWith(SpringRunner.class)
public class DummyControllerTest1 {
@Autowired
private WebApplicationContext webApplicationContext;
@MockBean
private Service1 service1;
private MockMvc mvc;
@Before
public void setUp() {
mvc = MockMvcBuilders.webAppContextSetup(webApplicationContext)
.defaultRequest(delete("/").contentType(MediaType.APPLICATION_JSON))
.alwaysDo(print())
.apply(springSecurity())
.build();
}
@Test
public void shouldReturnProperResponseFromIndexPage() throws Exception {
mvc.perform(delete("/"))
.andExpect(status().isOk())
.andExpect(content().string("It's dummy response from server"));
}
}
| [
"pancordev@gmail.com"
] | pancordev@gmail.com |
983b1e6c91fba70a5a319e0ccd86860195385159 | dcfc67609257bea7dc84f08285ea2930d068a3b9 | /studyJava/scripts/ioBasic/src/iobasic/CobyBytes.java | 2b952e6fcbf8e5f01d6e53564c9f1e86d6a7adf9 | [] | no_license | skyler-tao/languageStudy | f436ab9c369da46d70615f422be45ef651031ce5 | 823984aea10707d853f1af5a6514df1c1bd8ca60 | refs/heads/master | 2021-05-31T06:58:32.458808 | 2016-04-21T10:06:37 | 2016-04-21T10:06:37 | null | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 585 | java | package iobasic;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
public class CobyBytes {
public static void main(String[] args) throws IOException {
FileInputStream in = null;
FileOutputStream out = null;
try {
in = new FileInputStream("FixHand.stl"); //字节流,可以包含中文
out = new FileOutputStream("output_byte.stl");
int c;
while( (c = in.read()) != -1 ) {
out.write(c);
}
} finally {
if (in != null) {
in.close();
}
if (out != null) {
out.close();
}
}
}
}
| [
"chaoqiang@staff.weibo.com"
] | chaoqiang@staff.weibo.com |
fd57ecd36d3f98988751af4d498aa0d98329e8eb | 34deb2019b41cb59051fad1163c2e4503d3dc3a9 | /src/Sort/HeapSort.java | 44c1f7a0754a2394bf4e7929f0215c24fc3630fd | [] | no_license | lixiang0101/algorithm | 12d16e9a05dc67ec0216d38fe071cb41176865f8 | a54cf6ff1e0656bbbc50f093cc0d3efa6c875796 | refs/heads/master | 2020-12-27T03:03:05.119133 | 2020-04-12T12:38:01 | 2020-04-12T12:38:01 | 237,742,474 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,511 | java | package Sort;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
/**
* 堆排序
* 完全二叉堆:
* 结构性:结构上满足一个完全二叉树
* 堆序性:一个父结点的值要大于其孩子结点的值(最大堆),反之最小堆
* 往一个完全二叉堆末尾插入一个元素,不会破坏结构性,但可能会破坏堆序性
* 如果破坏了堆序性,把这个结点与其父结点调换一下,这样就可以解决当前结点的堆序性问题
* 但这样同样可能造成父节点的堆序性问题,所以要一层一层的向上调整,直到根结点,这个过程称为"上滤"
* 因为完全二叉树的深度为 roundDown(logn) + 1
* 所以这个上滤过程的时间复杂度为 O(logn)
* 其实如果按上面的过程执行,每次上滤都有一次调换的过程,调换的过程会执行3条语句,这里是可以优化的
* 具体优化看heapAdjust方法的实现
*/
public class HeapSort {
public static void main(String[] args) {
int [] arr = {4,6,8,5,9};
createHeap(arr);
System.out.println(Arrays.toString(arr));
heapSort(arr);
System.out.println(Arrays.toString(arr));
int[] nums = new int[8000000];
for (int i = 0; i < 8000000; i++) {
nums[i] = (int) (Math.random() * 8000000); // Math.random生成的是0~1之间的随机数
}
Date date = new Date();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH:mm:ss");
String start = simpleDateFormat.format(date);
heapSort(nums);
String end = simpleDateFormat.format(new Date());
System.out.println("排序开始时间:" + start);
System.out.println("排序结束时间:" + end);
}
/**
* 1、把无序数组调整成一个最大堆数组
* 2、把堆顶元素和二叉树最后一个叶子结点交换
* 3、调整堆顶元素,因为此时只有对顶元素不合格
* @param arr
*/
public static void heapSort(int[] arr){
createHeap(arr);
for (int i = arr.length - 1; i > 0; i --){
int tmp = arr[0];
arr[0] = arr[i];
arr[i] = tmp;
heapAdjust(arr,0,i);
}
}
/**
* 1、在一个完全二叉树中,所有序号大于 n/2(向下去整) 的结点都是叶子结点,因此,以这些结点为根的子树已经是堆,不用调整。
* 2、这样,只需用筛选法,从最后一个分之结点 n/2开始,依次将序号为n/2、n/2 - 1、n/2 - 2、n/2 - 3 ...、1的结点作为根
* 的子树都调整为堆即可。
* 3、在数组中,索引编号从0开始,所以上面的都要减1
* @param arr 无序数组
*/
public static void createHeap(int[] arr){
int n = arr.length;
for (int i = n / 2 - 1; i >= 0;i--){
heapAdjust(arr,i,n);
}
}
/**
* 1、从arr[2*i+1]和arr[2*i+2] 中选出较大者,假设arr[2*i+1]较大,比较arr[i]和arr[2*i+1]的大小
* 2、如果 arr[i] > arr[2*i+1],说明以arr[i]为根的子树已经是堆,不必要左任何调整
* 3、如果 arr[i] < arr[2*i+1],交换 arr[i] 和 arr[2*i+1]。交换后,以arr[2*i+2]为根的子树不受交换的影响,仍是堆。
* 如果以arr[2*i+1]为根的子树不是堆,则重复上述过程。将以arr[2*i+1]为根的子树调整为堆,直到进行到叶子结点为止。
* @param arr 需调整的数组
* @param i 调整的第i个子树
* @param n 数组中元素个数
*/
public static void heapAdjust(int[] arr,int i,int n){
int tmp = arr[i]; // 把要调整的记录做一个备份
for (int j = 2 * i + 1; j < n; j = j * 2 + 1){
// 1、从arr[2*i+1]和arr[2*i+2] 中选出较大者
if ( j + 1 < n && arr[j] < arr[j+1]){ // j + 1 < length 可以提高效率
j+=1;
}
// 2、如果 arr[i] < arr[2*i+1],交换 arr[i] 和 arr[2*i+1]
if (tmp < arr[j]){
arr[i] = arr[j];
// 交换后,做好继续调整以arr[j]为根的子树的准备,进入下一轮for循环
i = j;
}else { // 3、说明以arr[i]为根的子树已经是堆,不必要左任何调整
break;
}
}
arr[i] = tmp; // 最后再将备份放到最终的位置,这是一个优化
}
}
| [
"451711816@qq.com"
] | 451711816@qq.com |
c9a6aac4ddbc01a2a7d62477ec49c4ea4df9925f | 9572fdddd444c8deb1b82725baf802507996e97d | /project_jenk/src/test/java/jenkin1/AppTest.java | a905d8c580028acc34c76b653c7e356f861b270e | [] | no_license | Upendraj16/jenknew | 681dbf7984f42f34a4d6adf8674d31e979b0d92b | 5a59ddc7cf458f8f06f336c028108ad0a6adde2b | refs/heads/master | 2022-12-20T21:39:46.848779 | 2020-09-22T13:37:19 | 2020-09-22T13:37:19 | 297,656,203 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 279 | java | package jenkin1;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
/**
* Unit test for simple App.
*/
public class AppTest
{
/**
* Rigorous Test :-)
*/
@Test
public void shouldAnswerWithTrue()
{
assertTrue( true );
}
}
| [
"root@ip-172-31-21-221.eu-west-2.compute.internal"
] | root@ip-172-31-21-221.eu-west-2.compute.internal |
fbc42441d131948426c4e2e87f14236b9cb2f3c9 | 86f144e41bcfcc8c9b5cd9d090793f0a1ea2a660 | /datamodel/src/main/java/com/acme/brms/domain/SimpleFact.java | ea02db66eeb37dcb6fa86e46198119a5638d8d1a | [] | no_license | DuncanDoyle/dynamic-rules-test | f26233d78621f2b70915b02a707b8a21ce79b2cd | 35cead374b8695cc593bc310e5e0671235f9e8bf | refs/heads/master | 2020-05-01T02:22:31.343893 | 2016-03-28T11:09:56 | 2016-03-28T11:09:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 157 | java | /**
*
*/
package com.acme.brms.domain;
import java.io.Serializable;
/**
* @author clichybi
*
*/
public interface SimpleFact extends Serializable{
}
| [
"clichybi@redhat.com"
] | clichybi@redhat.com |
888155d6b18b9b5c06bb2419e77ae94722ba317b | 20224c76bff48a14a61170802cddcd4bdb1f793b | /《计算与软件工程》/ArrayList练习/exercise2/src/d/Test2.java | 8334c868fa5aeaa1f0e2c638fe2a6f10c78e2adb | [] | no_license | Leon-xc/NJU-SE-GraduateEntrance | 457f1514948822c63d650bb8255aa636e66048fe | 0414e4a2d04ab8c6dda472a444a5f5f291bb69e7 | refs/heads/master | 2021-01-08T23:13:21.012422 | 2019-04-20T13:24:11 | 2019-04-20T13:24:11 | 242,171,549 | 1 | 0 | null | 2020-02-21T15:33:20 | 2020-02-21T15:33:19 | null | UTF-8 | Java | false | false | 646 | java | package d;
import java.util.ArrayList;
import java.util.Iterator;
public class Test2 {
public static void main(String[] args) {
ArrayList l = new ArrayList();
l.add("a");
l.add("b");
l.add("c");
l.add("d");
l.add("e");
l.add("f");
ArrayList l2 = new ArrayList();
l2.add("g");
l2.add("h");
// Iterator i = l.iterator();
// while(i.hasNext()) {
// System.out.print(i.next().toString());
// }
// System.out.println();
//
// for(Object o : l) {
// System.out.print(o.toString());
// }
// System.out.println();
//
// for(int j=0;j<l.size();j++) {
// System.out.print(l.get(j).toString());
// }
}
}
| [
"yingpin_c@163.com"
] | yingpin_c@163.com |
f051648bf0367f603029433c9fa9402355b8a98e | 25bd78fae935000bd3c56d456bb217cae9a2dc32 | /app/src/main/java/com/yize/miniweather/view/adapter/SearchResultAdapter.java | af881542068c34babce0bdb5b8c03d4bd419b1db | [
"Apache-2.0"
] | permissive | VladimirSu/MiniMiniWeather | fa394295baa85a453d7711ff5636530d42930578 | 58d3649bede1510be146b387dafbcb6b48eb502d | refs/heads/master | 2023-03-06T22:16:06.716031 | 2021-02-21T13:11:22 | 2021-02-21T13:11:22 | 339,943,148 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,489 | java | package com.yize.miniweather.view.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.yize.miniweather.R;
import com.yize.miniweather.bean.CityShip;
import com.yize.miniweather.txweather.TxWeatherHelper;
import com.yize.miniweather.txweather.TxWeatherRequestListener;
import java.util.List;
public class SearchResultAdapter extends RecyclerView.Adapter<SearchResultAdapter.ViewHolder> {
private List<CityShip> cityShipList;
private Context context;
private TxWeatherRequestListener listener;
public SearchResultAdapter(List<CityShip> cityShipList) {
this.cityShipList = cityShipList;
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
if(context==null){
context=parent.getContext();
}
View view= LayoutInflater.from(context).inflate(R.layout.item_adapter_search_result,parent,false);
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
CityShip cityShip=cityShipList.get(position);
String cityShipInfo=cityShip.getProvince()+"/"+cityShip.getCity()+"/"+cityShip.getCountry()+"\t"+cityShip.getCurrentName();
holder.tv_search_result_adress.setText(cityShipInfo);
holder.ll_search_result.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
TxWeatherHelper.requestCity(cityShip,listener);
}
});
}
@Override
public int getItemCount() {
return cityShipList.size();
}
static class ViewHolder extends RecyclerView.ViewHolder{
private TextView tv_search_result_adress;
private LinearLayout ll_search_result;
public ViewHolder(@NonNull View itemView) {
super(itemView);
tv_search_result_adress=itemView.findViewById(R.id.tv_search_result_adress);
ll_search_result=itemView.findViewById(R.id.ll_search_result);
}
}
public TxWeatherRequestListener getListener() {
return listener;
}
public void setListener(TxWeatherRequestListener listener) {
this.listener = listener;
}
}
| [
"184201788@qq.com"
] | 184201788@qq.com |
0f9c6c9e8800822ca08e8a488ffec30630388606 | 6b0e77ee8d3c2d8acd40725ec68c20a09c4f8362 | /app/src/main/java/com/rusanova/todolist/MainActivity.java | 1eae603cbbcf16c91561cf869114619df7475788 | [] | no_license | RusanovaMaria/ToDoList | 37f30eac50b421f64a26a2121bb10a57e9a939fc | 462746a68c7416fd3914f87277223a252b4350eb | refs/heads/master | 2020-04-03T07:36:21.328361 | 2018-10-28T19:50:34 | 2018-10-28T19:50:34 | 155,107,589 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,937 | java | package com.rusanova.todolist;
import android.support.design.widget.NavigationView;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.view.View;
public class MainActivity extends AppCompatActivity {
private DrawerLayout mDrawerLayout;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ActionBar actionbar = getSupportActionBar();
actionbar.setDisplayHomeAsUpEnabled(true);
actionbar.setHomeAsUpIndicator(R.drawable.ic_menu);
mDrawerLayout = findViewById(R.id.drawer_layout);
mDrawerLayout.addDrawerListener(
new DrawerLayout.DrawerListener() {
@Override
public void onDrawerSlide(View drawerView, float slideOffset) {
// Respond when the drawer's position changes
}
@Override
public void onDrawerOpened(View drawerView) {
// Respond when the drawer is opened
}
@Override
public void onDrawerClosed(View drawerView) {
// Respond when the drawer is closed
}
@Override
public void onDrawerStateChanged(int newState) {
// Respond when the drawer motion state changes
}
}
);
NavigationView navigationView = findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(
new NavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(MenuItem menuItem) {
// set item as selected to persist highlight
menuItem.setChecked(true);
// close drawer when item is tapped
mDrawerLayout.closeDrawers();
// Add code here to update the UI based on the item selected
// For example, swap UI fragments here
return true;
}
});
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
mDrawerLayout.openDrawer(GravityCompat.START);
return true;
}
return super.onOptionsItemSelected(item);
}
}
| [
"mariarusanova1997@mail.ru"
] | mariarusanova1997@mail.ru |
6469ba3a836901f0b945c327fd0d016d3dd1fa5b | f9d8b48eed19569d478bbce70eee2eeb544d8cf6 | /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/CryptoException.java | fec624bc3d68ad90061584c89d0abc73fef47b3f | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | moorecoin/MooreClient | 52e3e822f65d93fc4c7f817a936416bfdf060000 | 68949cf6d1a650dd8dd878f619a874888b201a70 | refs/heads/master | 2021-01-10T06:06:26.239954 | 2015-11-14T15:39:44 | 2015-11-14T15:39:44 | 46,180,336 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 961 | java | package org.ripple.bouncycastle.crypto;
/**
* the foundation class for the hard exceptions thrown by the crypto packages.
*/
public class cryptoexception
extends exception
{
private throwable cause;
/**
* base constructor.
*/
public cryptoexception()
{
}
/**
* create a cryptoexception with the given message.
*
* @param message the message to be carried with the exception.
*/
public cryptoexception(
string message)
{
super(message);
}
/**
* create a cryptoexception with the given message and underlying cause.
*
* @param message message describing exception.
* @param cause the throwable that was the underlying cause.
*/
public cryptoexception(
string message,
throwable cause)
{
super(message);
this.cause = cause;
}
public throwable getcause()
{
return cause;
}
}
| [
"mooreccc@foxmail.com"
] | mooreccc@foxmail.com |
8b219ea2f21687b70dee9d2bcb6daaf0e6cf889c | 32a0ab3109af834284c079eea683bda567c802ca | /app/src/main/java/com/esprit/mypets/entyityResponse/AnimalResponse.java | d8ddf1d9b17c89c7bb1cb88f1f2c28dad25b81f3 | [] | no_license | oussamaMaaroufi/MyPetsAndroid | 5baf57e377f1145655d39d335b234d9526bbf7e4 | 37a89beedcb126c19c2f125b8115e0762afcf247 | refs/heads/master | 2023-02-13T06:56:39.859723 | 2021-01-11T08:11:17 | 2021-01-11T08:11:17 | 313,994,611 | 0 | 0 | null | 2020-11-18T23:43:26 | 2020-11-18T16:36:18 | Java | UTF-8 | Java | false | false | 884 | java | package com.esprit.mypets.entyityResponse;
import com.esprit.mypets.entity.Animal;
public class AnimalResponse {
private String success;
private String message;
private Animal Animal;
public String getSuccess() {
return success;
}
public void setSuccess(String success) {
this.success = success;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public Animal getAnimal() {
return Animal;
}
public void setAnimal(Animal animal) {
this.Animal = animal;
}
@Override
public String toString() {
return "AnimalResponse{" +
"success='" + success + '\'' +
", message='" + message + '\'' +
", animal=" + Animal +
'}';
}
}
| [
"oussama.maaroufi@esprit.tn"
] | oussama.maaroufi@esprit.tn |
f0b5c11fcaa88bc0450918894b08d5427107bf98 | c6fe426780ec63a957c651f796c8602d341964e7 | /Common/JavaTreeWrapper/java_src/src/UIExtrasTree/TreeTransferHandler.java | b85dd433c08e53b8e6a443ee9ed11906930ed3be | [
"MIT"
] | permissive | quai20/TOOTSEA | 1dba1a5d7fc7a80dc544ad4ffb3a690c35905912 | 96d0249479375de8b1dffdbafda970e950f55543 | refs/heads/master | 2022-01-25T09:01:22.701725 | 2022-01-04T09:03:35 | 2022-01-04T09:03:35 | 247,701,306 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,869 | java | package UIExtrasTree;
import UIExtrasTree.TreeNode;
import java.awt.datatransfer.*;
import java.util.*;
import javax.swing.*;
import javax.swing.tree.*;
/**
* Copyright 2012-2014 The MathWorks, Inc.
* @author rjackey
*/
public class TreeTransferHandler extends TransferHandler {
DataFlavor nodesFlavor;
DataFlavor[] flavors = new DataFlavor[1];
public TreeTransferHandler() throws ClassNotFoundException {
String mimeType;
mimeType = DataFlavor.javaJVMLocalObjectMimeType + ";class=\""
+ javax.swing.tree.DefaultMutableTreeNode[].class.getName() + "\"";
nodesFlavor = new DataFlavor(mimeType);
flavors[0] = nodesFlavor;
}
@Override
protected Transferable createTransferable(JComponent c) {
JTree tree = (JTree) c;
TreePath[] paths = tree.getSelectionPaths();
if (paths != null) {
// Make up a node array for transfer
List<TreeNode> nodeList =
new ArrayList<TreeNode>();
TreeNode node =
(TreeNode) paths[0].getLastPathComponent();
nodeList.add(node);
for (int i = 1; i < paths.length; i++) {
TreeNode next =
(TreeNode) paths[i].getLastPathComponent();
// Do not allow higher level nodes to be added to list.
if (next.getLevel() < node.getLevel()) {
break;
} else if (next.getLevel() > node.getLevel()) { // child node
nodeList.add(next);
// node already contains child
} else { // sibling
nodeList.add(next);
}
}
TreeNode[] nodes =
nodeList.toArray(new TreeNode[nodeList.size()]);
return new NodesTransferable(nodes);
}
return null;
}
@Override
public int getSourceActions(JComponent c) {
return COPY_OR_MOVE;
}
public class NodesTransferable implements Transferable {
TreeNode[] nodes;
public NodesTransferable(TreeNode[] nodes) {
this.nodes = nodes;
}
@Override
public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException {
if (!isDataFlavorSupported(flavor)) {
throw new UnsupportedFlavorException(flavor);
}
return nodes;
}
@Override
public DataFlavor[] getTransferDataFlavors() {
return flavors;
}
@Override
public boolean isDataFlavorSupported(DataFlavor flavor) {
return nodesFlavor.equals(flavor);
}
}
}
| [
"kevin.balem@ifremer.fr"
] | kevin.balem@ifremer.fr |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.