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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
188b8c2761992301748ed826b645bdc529fec9c5 | 7038e25ce514d6024146e002e9fc0c868214d9ae | /java/jobs/jobs-toolkit/jobs-toolkit-common/src/main/java/jobs/toolkit/cache/AutoLoadingCache.java | 82d2b6af37b000ab64e4138a9c16ba1f4145b224 | [] | no_license | 3qwasd/jobs | d63f67ec08f9de36e32c4ab401ea0ab73b64636c | 8c21066062ecbb71d630c2f0cbebe0635547887d | refs/heads/master | 2023-01-02T11:24:43.780319 | 2019-07-22T16:49:13 | 2019-07-22T16:49:13 | 64,465,190 | 1 | 0 | null | 2022-12-16T02:53:31 | 2016-07-29T08:40:14 | Java | UTF-8 | Java | false | false | 278 | java | package jobs.toolkit.cache;
/**
* 能够自动加载的cache
* @author jobs
*
* @param <K>
* @param <V>
*/
public interface AutoLoadingCache<K, V> extends Cache<K, V>{
/**
* 加载新的值到缓存中
* @param k
*/
public void refresh(K k);
}
| [
"3qwasd@163.com"
] | 3qwasd@163.com |
5beaf5eaae4e81d6d0b480478a6d2271ba3b3013 | 60b243edf811fc43a3c410c06da5a44dbc8410a0 | /37-fungsi recursive/src/com/tutorial/Main.java | 450d92e62de16a87811aa4824958f16617355421 | [] | no_license | MHaidzirIsmail/Tugas13-14 | 186bfe7a3de903cf93ebd84ef24c2088b9286fa6 | fa19b62143796fe8cdfa6a7b006f7515e98902fa | refs/heads/master | 2020-11-27T15:18:06.316732 | 2019-12-22T02:31:42 | 2019-12-22T02:31:42 | 229,508,184 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,597 | 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.tutorial;
/**
*
* @author Ismail
* Nama : Muhammad Haidzir Ismail
* Kelas : TI-1C
* Pertemuan 13-14
*/
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner userInput = new Scanner(System.in);
System.out.print("masukan nilai:");
int nilai = userInput.nextInt();
System.out.println("anda memasukan nilai = " + nilai);
printNilai(nilai);
int jumlah = jumlahNilai(nilai);
System.out.println("jumlah = " + jumlah);
int faktorial = hitungFaktorial(nilai);
System.out.println("hasil faktorial = " + faktorial);
}
// fungsi rekursif sederhana
private static int hitungFaktorial(int parameter){
System.out.println("parameter = " + parameter);
if (parameter == 1){
return parameter;
}
return parameter * hitungFaktorial(parameter - 1);
}
private static int jumlahNilai(int parameter){
System.out.println("parameter = " + parameter);
if (parameter == 0){
return parameter;
}
return parameter + jumlahNilai(parameter - 1);
}
private static void printNilai (int parameter){
System.out.println("nilai = " + parameter);
if (parameter == 0){
return;
}
parameter--;
printNilai(parameter);
}
}
| [
"hidayativah@gmail.com"
] | hidayativah@gmail.com |
0bcd6edf31f323eb3b6b8e9642a64a09a03e1c6f | c82f89b0e6d1547c2829422e7de7664b378c1039 | /src/com/hongyu/service/impl/PayablesLineServiceImpl.java | ed65c1624cf053159fc938b0eb9fa39f4c32ac4a | [] | no_license | chenxiaoyin3/shetuan_backend | 1bab5327cafd42c8086c25ade7e8ce08fda6a1ac | e21a0b14a2427c9ad52ed00f68d5cce2689fdaeb | refs/heads/master | 2022-05-15T14:52:07.137000 | 2022-04-07T03:30:57 | 2022-04-07T03:30:57 | 250,762,749 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 619 | java | package com.hongyu.service.impl;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.grain.service.impl.BaseServiceImpl;
import com.hongyu.dao.PayablesLineDao;
import com.hongyu.entity.PayablesLine;
import com.hongyu.service.PayablesLineService;
@Service("payablesLineServiceImpl")
public class PayablesLineServiceImpl extends BaseServiceImpl<PayablesLine, Long> implements PayablesLineService {
@Resource(name = "payablesLineDaoImpl")
PayablesLineDao dao;
@Resource(name = "payablesLineDaoImpl")
public void setBaseDao(PayablesLineDao dao) {
super.setBaseDao(dao);
}
} | [
"925544714@qq.com"
] | 925544714@qq.com |
52f293a464efe48fc100d5584c945fe754593f3f | 987473099d8e05fae4a0fc5babd2e1416004880c | /example2/src/main/java/com/sbexamples/example2/domain/Foo.java | cbd8b610e287486cd74c15390f9cccc6cd9ed13a | [] | no_license | philipposgate/SpringBootExamples | afd5ce7ac44cb5ec3505460f81408b988ef5d6b5 | 22b7942967675da5e1c7359e692aebd57f6bb635 | refs/heads/master | 2022-02-05T10:25:06.453274 | 2021-05-27T17:22:56 | 2021-05-27T17:22:56 | 93,224,996 | 0 | 0 | null | 2022-01-21T23:10:57 | 2017-06-03T05:09:34 | Java | UTF-8 | Java | false | false | 1,044 | java | package com.sbexamples.example2.domain;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@Entity(name="Foo")
@ApiModel
public class Foo {
@Id
@GeneratedValue (strategy=GenerationType.IDENTITY)
@ApiModelProperty(example = "1", position = 1)
private Integer fooId;
@ApiModelProperty(example = "Philip", position = 2)
private String name;
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(example = "1972-03-30", position = 3)
private Date date;
public Integer getFooId() {
return fooId;
}
public void setFoo(Integer fooId) {
this.fooId = fooId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
}
| [
"philip.posgate@gmail.com"
] | philip.posgate@gmail.com |
d803ae73446920b4f354423d0434a3d32870b6aa | 132e19ea82d77199705e43c51d80c0a16fa82786 | /Palindrome/src/palindrome/Palindrome.java | f2bfa742f7284339c0acd782524b52036b9ac3ce | [] | no_license | Bizid/Java | 4c10a25ba1039206bd2cad618ec49f79c112c5f1 | 8d3b9fd14eda1753e2d28df19722346d5f125080 | refs/heads/master | 2021-07-20T02:27:06.830691 | 2017-10-27T12:02:39 | 2017-10-27T12:02:39 | 104,741,470 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,555 | 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 palindrome;
import java.io.*;
import java.util.*;
/**
*
* @author lassaad
*/
public class Palindrome {
public class Queuey {
LinkedList queue = new LinkedList();
public Queuey(){
queue = new LinkedList();
}
public void enqueueChar(char n){
queue.addLast(n);
}
public char dequeueChar(){
return (char) queue.remove(0);
}
public String peekString(){
return (String) queue.get(0);
}
}
// Queue<String> queue = new Queue<>();
Queuey numberQueue = new Queuey();
Stack<Character> stacky = new Stack<>();
public void pushCharacter(char ch){
stacky.push((char) ch);
}
public void enqueueCharacter(char ch){
numberQueue.enqueueChar(ch);
}
public char popCharacter() {
return (char) stacky.pop();
}
public char dequeueCharacter() {
return (char) numberQueue.dequeueChar();
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
String input = scan.nextLine();
scan.close();
// Convert input String to an array of characters:
char[] s = input.toCharArray();
// Create a Solution object:
Palindrome p = new Palindrome();
// Enqueue/Push all chars to their respective data structures:
for (char c : s) {
p.pushCharacter(c);
p.enqueueCharacter(c);
}
// Pop/Dequeue the chars at the head of both data structures and compare them:
boolean isPalindrome = true;
for (int i = 0; i < s.length/2; i++) {
if (p.popCharacter() != p.dequeueCharacter()) {
isPalindrome = false;
break;
}
}
//Finally, print whether string s is palindrome or not.
System.out.println( "The word, " + input + ", is "
+ ( (!isPalindrome) ? "not a palindrome." : "a palindrome." ) );
}
}
| [
"lassaad@VaultMRs-MBP.teaminternational.com"
] | lassaad@VaultMRs-MBP.teaminternational.com |
8c432b084e08c20cccb2a1444d297d4a57511a3b | 6833f68de67d99aa929cdaed2e99f78ba4d16322 | /com-idealo-checkout-api/src/main/java/com/idealo/checkout/clients/RuleInfoClient.java | 374e060b97b6f94fc72bba085bbeeb7eb42e234e | [] | no_license | aqib1/IdealoTask2 | b38957c3012332a43545d19dfc8db9a7f1ce2ad0 | 203976970ca6ab86e6952f21e5ce83ca7b5ee744 | refs/heads/main | 2023-04-10T06:21:06.406487 | 2021-04-21T05:41:17 | 2021-04-21T05:41:17 | 329,116,401 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 610 | java | package com.idealo.checkout.clients;
import com.idealo.checkout.clients.fallbacks.RuleInfoFallBack;
import com.idealo.checkout.model.RuleRequest;
import com.idealo.checkout.model.RuleResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import static com.idealo.checkout.utils.AppConst.PRICING_RULES_APPLY_URI;
@FeignClient(name = "${pricing.rules.api.baseurl}", fallbackFactory = RuleInfoFallBack.class)
public interface RuleInfoClient {
@PostMapping(PRICING_RULES_APPLY_URI)
RuleResponse pricingRules(RuleRequest request);
}
| [
"aqibbutt3078@gmail.com"
] | aqibbutt3078@gmail.com |
0eea8a3d0adb7b6f82d051d0ab48faff8fd383c1 | 6b9171fb7900f8aa24a75eaca4cb4c9de7e76e5b | /core/api/src/main/java/org/onosproject/net/meter/DefaultMeterRequest.java | 94cada47b98d1d30c8f6ff9f98c82a338eb6e67f | [
"Apache-2.0"
] | permissive | packet-tracker/onos | 0e5b1713c8aa4387daa5a537bf57fd925d21e0be | bd160a9685296bc1be25e7dfe3675e4058ca4428 | refs/heads/master | 2020-12-13T22:34:33.241067 | 2015-11-14T08:53:32 | 2015-11-18T14:35:42 | 46,148,361 | 1 | 1 | null | 2015-11-13T21:32:15 | 2015-11-13T21:32:15 | null | UTF-8 | Java | false | false | 4,743 | java | /*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.net.meter;
import com.google.common.collect.ImmutableSet;
import org.onosproject.core.ApplicationId;
import org.onosproject.net.DeviceId;
import java.util.Collection;
import java.util.Optional;
import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* A default implementation of a meter.
*/
public final class DefaultMeterRequest implements MeterRequest {
private final ApplicationId appId;
private final Meter.Unit unit;
private final boolean burst;
private final Collection<Band> bands;
private final DeviceId deviceId;
private final Optional<MeterContext> context;
private final Type op;
private DefaultMeterRequest(DeviceId deviceId, ApplicationId appId,
Meter.Unit unit, boolean burst,
Collection<Band> bands, MeterContext context, Type op) {
this.deviceId = deviceId;
this.appId = appId;
this.unit = unit;
this.burst = burst;
this.bands = bands;
this.context = Optional.ofNullable(context);
this.op = op;
}
@Override
public DeviceId deviceId() {
return deviceId;
}
@Override
public ApplicationId appId() {
return appId;
}
@Override
public Meter.Unit unit() {
return unit;
}
@Override
public boolean isBurst() {
return burst;
}
@Override
public Collection<Band> bands() {
return bands;
}
@Override
public Optional<MeterContext> context() {
return context;
}
public static Builder builder() {
return new Builder();
}
@Override
public String toString() {
return toStringHelper(this)
.add("device", deviceId)
.add("appId", appId.name())
.add("unit", unit)
.add("isBurst", burst)
.add("bands", bands).toString();
}
public static final class Builder implements MeterRequest.Builder {
private ApplicationId appId;
private Meter.Unit unit = Meter.Unit.KB_PER_SEC;
private boolean burst = false;
private Collection<Band> bands;
private DeviceId deviceId;
private MeterContext context;
@Override
public MeterRequest.Builder forDevice(DeviceId deviceId) {
this.deviceId = deviceId;
return this;
}
@Override
public MeterRequest.Builder fromApp(ApplicationId appId) {
this.appId = appId;
return this;
}
@Override
public MeterRequest.Builder withUnit(Meter.Unit unit) {
this.unit = unit;
return this;
}
@Override
public MeterRequest.Builder burst() {
this.burst = true;
return this;
}
@Override
public MeterRequest.Builder withBands(Collection<Band> bands) {
this.bands = ImmutableSet.copyOf(bands);
return this;
}
@Override
public MeterRequest.Builder withContext(MeterContext context) {
this.context = context;
return this;
}
@Override
public MeterRequest add() {
validate();
return new DefaultMeterRequest(deviceId, appId, unit, burst, bands,
context, Type.ADD);
}
@Override
public MeterRequest remove() {
validate();
return new DefaultMeterRequest(deviceId, appId, unit, burst, bands,
context, Type.REMOVE);
}
private void validate() {
checkNotNull(deviceId, "Must specify a device");
checkNotNull(bands, "Must have bands.");
checkArgument(bands.size() > 0, "Must have at least one band.");
checkNotNull(appId, "Must have an application id");
}
}
}
| [
"gerrit@onlab.us"
] | gerrit@onlab.us |
71d540930bc1ed3d61d8809fda2a2a81abb1a557 | 0915993ccd67bb9a1955d9640800353ed17a37d5 | /Desenvolvimento de Sistemas com Java/Desenvolvimento Java WEB/veiculos/JavaSource/br/edu/dsj/scv/entidade/Esporte.java | b3cb8d8c35c641e6077bacb485f375d1f23518f3 | [] | no_license | vquintanilha/UniversityCodes | ac93c0f9e6fd6ebc81080f3947ad218cb06fb48e | 3b5652b20d3b3d0ba122578ade19071978f203ea | refs/heads/main | 2023-08-06T08:04:48.545918 | 2021-09-27T22:41:49 | 2021-09-27T22:41:49 | 411,063,608 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,133 | java | package br.edu.dsj.scv.entidade;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.SequenceGenerator;
import javax.validation.constraints.NotBlank;
/**
* Representa um Esporte preferido
*
* @author 1829203
*
*/
@Entity
public class Esporte {
@Id
@SequenceGenerator(name = "NUM_SEQ_ESPORTE", sequenceName = "NUM_SEQ_ESPORTE", allocationSize = 0)
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "NUM_SEQ_ESPORTE")
private Integer id;
@NotBlank
private String nome;
@ManyToMany(fetch = FetchType.LAZY)
private List<Cliente> clientes;
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public List<Cliente> getClientes() {
return clientes;
}
public void setClientes(List<Cliente> clientes) {
this.clientes = clientes;
}
} | [
"victorjuan_7@hotmail.com"
] | victorjuan_7@hotmail.com |
ea8015f210073914aa98ed2c68756f88c6a02953 | a0fd05cb455cee8ea6840616939c95048d06c7cb | /src/main/java/com/gv/bean/DepartmentExample.java | 7f1fd47e3d4e694a6c0a7221d97419eb36818518 | [] | no_license | BalboZheng/IntegrationSSM | ec9116499cbb3bb72f28daa2070964c542d96141 | 1b8cc392c2a6c044f54e0e70d854e3b850f5c638 | refs/heads/master | 2020-05-07T22:36:47.825777 | 2019-04-12T07:13:56 | 2019-04-12T07:13:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,501 | java | package com.gv.bean;
import java.util.ArrayList;
import java.util.List;
public class DepartmentExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public DepartmentExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andDeptIdIsNull() {
addCriterion("dept_id is null");
return (Criteria) this;
}
public Criteria andDeptIdIsNotNull() {
addCriterion("dept_id is not null");
return (Criteria) this;
}
public Criteria andDeptIdEqualTo(Integer value) {
addCriterion("dept_id =", value, "deptId");
return (Criteria) this;
}
public Criteria andDeptIdNotEqualTo(Integer value) {
addCriterion("dept_id <>", value, "deptId");
return (Criteria) this;
}
public Criteria andDeptIdGreaterThan(Integer value) {
addCriterion("dept_id >", value, "deptId");
return (Criteria) this;
}
public Criteria andDeptIdGreaterThanOrEqualTo(Integer value) {
addCriterion("dept_id >=", value, "deptId");
return (Criteria) this;
}
public Criteria andDeptIdLessThan(Integer value) {
addCriterion("dept_id <", value, "deptId");
return (Criteria) this;
}
public Criteria andDeptIdLessThanOrEqualTo(Integer value) {
addCriterion("dept_id <=", value, "deptId");
return (Criteria) this;
}
public Criteria andDeptIdIn(List<Integer> values) {
addCriterion("dept_id in", values, "deptId");
return (Criteria) this;
}
public Criteria andDeptIdNotIn(List<Integer> values) {
addCriterion("dept_id not in", values, "deptId");
return (Criteria) this;
}
public Criteria andDeptIdBetween(Integer value1, Integer value2) {
addCriterion("dept_id between", value1, value2, "deptId");
return (Criteria) this;
}
public Criteria andDeptIdNotBetween(Integer value1, Integer value2) {
addCriterion("dept_id not between", value1, value2, "deptId");
return (Criteria) this;
}
public Criteria andDeptNameIsNull() {
addCriterion("dept_name is null");
return (Criteria) this;
}
public Criteria andDeptNameIsNotNull() {
addCriterion("dept_name is not null");
return (Criteria) this;
}
public Criteria andDeptNameEqualTo(String value) {
addCriterion("dept_name =", value, "deptName");
return (Criteria) this;
}
public Criteria andDeptNameNotEqualTo(String value) {
addCriterion("dept_name <>", value, "deptName");
return (Criteria) this;
}
public Criteria andDeptNameGreaterThan(String value) {
addCriterion("dept_name >", value, "deptName");
return (Criteria) this;
}
public Criteria andDeptNameGreaterThanOrEqualTo(String value) {
addCriterion("dept_name >=", value, "deptName");
return (Criteria) this;
}
public Criteria andDeptNameLessThan(String value) {
addCriterion("dept_name <", value, "deptName");
return (Criteria) this;
}
public Criteria andDeptNameLessThanOrEqualTo(String value) {
addCriterion("dept_name <=", value, "deptName");
return (Criteria) this;
}
public Criteria andDeptNameLike(String value) {
addCriterion("dept_name like", value, "deptName");
return (Criteria) this;
}
public Criteria andDeptNameNotLike(String value) {
addCriterion("dept_name not like", value, "deptName");
return (Criteria) this;
}
public Criteria andDeptNameIn(List<String> values) {
addCriterion("dept_name in", values, "deptName");
return (Criteria) this;
}
public Criteria andDeptNameNotIn(List<String> values) {
addCriterion("dept_name not in", values, "deptName");
return (Criteria) this;
}
public Criteria andDeptNameBetween(String value1, String value2) {
addCriterion("dept_name between", value1, value2, "deptName");
return (Criteria) this;
}
public Criteria andDeptNameNotBetween(String value1, String value2) {
addCriterion("dept_name not between", value1, value2, "deptName");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
} | [
"787549184@qq.com"
] | 787549184@qq.com |
7fb0989dc7607ce429a90a834c9b052f8cb5eb06 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/8/8_dd97818fb63b94d6f037c59c6c96fe39ceda5467/ExtraPackage/8_dd97818fb63b94d6f037c59c6c96fe39ceda5467_ExtraPackage_s.java | ab1436a9704583c3f6e57af8a290fdd30082c509 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 5,431 | java | /*
* Copyright (C) 2009 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.sdklib.internal.repository;
import com.android.sdklib.SdkConstants;
import com.android.sdklib.internal.repository.Archive.Arch;
import com.android.sdklib.internal.repository.Archive.Os;
import com.android.sdklib.repository.SdkRepository;
import org.w3c.dom.Node;
import java.io.File;
import java.util.Map;
/**
* Represents a extra XML node in an SDK repository.
*/
public class ExtraPackage extends Package {
private final String mPath;
/**
* Creates a new tool package from the attributes and elements of the given XML node.
* <p/>
* This constructor should throw an exception if the package cannot be created.
*/
ExtraPackage(RepoSource source, Node packageNode, Map<String,String> licenses) {
super(source, packageNode, licenses);
mPath = XmlParserUtils.getXmlString(packageNode, SdkRepository.NODE_PATH);
}
/**
* Manually create a new package with one archive and the given attributes.
* This is used to create packages from local directories in which case there must be
* one archive which URL is the actual target location.
*/
ExtraPackage(RepoSource source,
String path,
int revision,
String license,
String description,
String descUrl,
Os archiveOs,
Arch archiveArch,
String archiveOsPath) {
super(source,
revision,
license,
description,
descUrl,
archiveOs,
archiveArch,
archiveOsPath);
mPath = path;
}
/**
* Static helper to check if a given path is acceptable for an "extra" package.
*/
public boolean isPathValid() {
if (SdkConstants.FD_ADDONS.equals(mPath) ||
SdkConstants.FD_PLATFORMS.equals(mPath) ||
SdkConstants.FD_TOOLS.equals(mPath) ||
SdkConstants.FD_DOCS.equals(mPath)) {
return false;
}
return mPath != null && mPath.indexOf('/') == -1 && mPath.indexOf('\\') == -1;
}
/**
* The install folder name. It must be a single-segment path.
* The paths "add-ons", "platforms", "tools" and "docs" are reserved and cannot be used.
* This limitation cannot be written in the XML Schema and must be enforced here by using
* the method {@link #isPathValid()} *before* installing the package.
*/
public String getPath() {
return mPath;
}
/** Returns a short description for an {@link IDescription}. */
@Override
public String getShortDescription() {
return String.format("Extra %1$s package, revision %2$d", getPath(), getRevision());
}
/** Returns a long description for an {@link IDescription}. */
@Override
public String getLongDescription() {
return String.format("Extra %1$s package, revision %2$d.\n%3$s",
getPath(),
getRevision(),
super.getLongDescription());
}
/**
* Computes a potential installation folder if an archive of this package were
* to be installed right away in the given SDK root.
* <p/>
* A "tool" package should always be located in SDK/tools.
*
* @param osSdkRoot The OS path of the SDK root folder.
* @return A new {@link File} corresponding to the directory to use to install this package.
*/
@Override
public File getInstallFolder(String osSdkRoot) {
return new File(osSdkRoot, getPath());
}
/**
* Computes whether the given extra package is a suitable update for the current package.
* The base method checks the class type.
* The tools package also tests that the revision number is greater and the path is the
* same.
* <p/>
* An update is just that: a new package that supersedes the current one. If the new
* package has the same revision as the current one, it's not an update.
*
* @param replacementPackage The potential replacement package.
* @return True if the replacement package is a suitable update for this one.
*/
@Override
public boolean canBeUpdatedBy(Package replacementPackage) {
if (!super.canBeUpdatedBy(replacementPackage)) {
return false;
}
ExtraPackage newPkg = (ExtraPackage) replacementPackage;
return newPkg.getRevision() > this.getRevision() && newPkg.getPath().equals(this.getPath());
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
24b92a875697ba4b9b7398a10c38d2de5cf01f98 | 4c47463b1ebb7ec9efa01f913fae1567e10c8bb5 | /src/main/java/Department/TechnologyDepartment.java | 1c4e93793235726e6a2ffdf97c279a0b9fcb4613 | [] | no_license | YAWAL/ManufacturingPlant | 7cb907c0b198adf6fb2eeccc57d7a629e1f2237c | 354edec84badd898b233c7eda4894cf22c4fae18 | refs/heads/master | 2021-01-17T06:47:25.874723 | 2016-05-09T20:18:48 | 2016-05-09T20:18:48 | 58,401,686 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 126 | java | package Department;
/**
* Created by VYA on 02.04.2016.
*/
public class TechnologyDepartment extends BaseDepartment {
}
| [
"3dprinter.lviv@gmail.com"
] | 3dprinter.lviv@gmail.com |
2199658d2fcc037ea830c0b4b737c7b058aae340 | d1b867111bf2df4c015b5a44d481456712d9ff80 | /src/_de/hopfit/resource/LoginDAO.java | 76ac889d94086df4e5621df830c935a5f0a25d00 | [] | no_license | Hefezopf/PWS | 2cd44a58d868547bb768da8a032c7a7f5be413ef | beca1d7a84aeea8cae6c243820a7212a90043d64 | refs/heads/master | 2022-12-06T03:57:22.438436 | 2020-05-18T07:13:51 | 2020-05-18T07:13:51 | 21,453,982 | 0 | 0 | null | 2022-11-24T05:35:39 | 2014-07-03T07:43:00 | Java | UTF-8 | Java | false | false | 14,987 | java | package de.hopfit.resource;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Types;
import de.hopfit.model.BankAccount;
import de.hopfit.model.BasicTarif;
import de.hopfit.model.FreeTarif;
import de.hopfit.model.Partner;
import de.hopfit.model.Prefs;
import de.hopfit.model.ProTarif;
import de.hopfit.model.Tarif;
import de.hopfit.util.Const;
import de.hopfit.util.Date;
public class LoginDAO extends DAO{
private static final String GET_TARIF
= "SELECT description, create_date, expire_date, baseprice, tx_rate, min_tx_price FROM Tarife WHERE partner_id=?";
private static final String GET_PARTNER
= "SELECT partner_id, username, passwort, loggedin, email, partner_language, telefon, partnername, str, plz, ort, urlhomepage, ktoinhaber, bankname, blz, ktonr, iban, bic FROM Partners WHERE partner_id=?";
private static final String GET_PARTNER_PW
= "SELECT partner_id, username, passwort FROM Partners WHERE username=? and passwort=?";
private static final String GET_EXISTING_PARTNER
= "SELECT partner_id, username FROM Partners WHERE username=?";
private static final String GET_ALL_PARTNER_IDS
= "SELECT partner_id, username FROM Partners";
private static final String GET_PARTNER_NAME
= "SELECT partnername FROM Partners WHERE partner_id=?";
private static final String LOGIN_PARTNER
= "UPDATE Partners SET loggedin='1' WHERE username=? and passwort=?";
private static final String LOGOUT_PARTNER
= "UPDATE Partners SET loggedin='0' WHERE username=?";
private static final String CREATE_PARTNER
= "INSERT INTO Partners (partner_id, username, passwort, loggedin, email, date)"
+ " VALUES (?, ?, ?, ?, ?, ?)";
private static final String CREATE_PREFS
= "INSERT INTO Prefs (pref_id, partner_id, bgcolor, infotext, bestelltext, summerytext, agb, shop_open, currency, date, minorderamount, pic)"
+ " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
private static final String CREATE_TARIF
= "INSERT INTO Tarife (tarif_id, partner_id, description, create_date, expire_date, baseprice, tx_rate, min_tx_price)"
+ " VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
public int addPartner(String username, String password, String loggedin,
String email)
{
int partner_id = -1;
Connection con = null;
PreparedStatement ps = null;
try {
if(isUserExisting(username)>Const.INVALID_ID)
return partner_id;
partner_id = getNextID("Partners");
con = Const.getConnection();
ps = con.prepareStatement(CREATE_PARTNER);
ps.setInt(1, partner_id);
ps.setString(2, username);
ps.setString(3, password);
ps.setString(4, loggedin);
ps.setString(5, email);
// 2000-10-10 05:00:00
String s = Date.getCurrentDate();
ps.setString(6, s);
ps.executeUpdate();
} catch (SQLException se) {
se.printStackTrace();
partner_id = -1;
} finally {
if(ps != null) {
try { ps.close(); } catch (Exception e) { e.printStackTrace(); }
}
if(con != null) {
try { con.close(); } catch (Exception e) { e.printStackTrace(); }
}
}
return partner_id;
}
public boolean addTarif(String partner_id, Tarif tarif)
{
boolean result = true;
Connection con = null;
PreparedStatement ps = null;
try {
int tarif_id = getNextID("Tarife");
con = Const.getConnection();
ps = con.prepareStatement(CREATE_TARIF);
ps.setInt(1, tarif_id);
ps.setString(2, partner_id);
ps.setString(3, tarif.getDescription());
ps.setString(4, tarif.getCreate_date());
ps.setString(5, tarif.getExpire_date());
ps.setDouble(6, tarif.getBaseprice());
ps.setDouble(7, tarif.getTx_rate());
ps.setDouble(8, tarif.getMin_tx_price());
ps.executeUpdate();
} catch (SQLException se) {
se.printStackTrace();
result = false;
} finally {
if(ps != null) {
try { ps.close(); } catch (Exception e) { e.printStackTrace(); }
}
if(con != null) {
try { con.close(); } catch (Exception e) { e.printStackTrace(); }
}
}
return result;
}
public boolean addPreferences(String partner_id, Prefs prefs)
{
boolean result = true;
Connection con = null;
PreparedStatement ps = null;
try {
int id = getNextID("Prefs");
con = Const.getConnection();
ps = con.prepareStatement(CREATE_PREFS);
ps.setInt(1, id);
ps.setString(2, partner_id);
ps.setString(3, prefs.getBgcolor());
ps.setString(4, prefs.getInfotext());
ps.setString(5, prefs.getBestelltext());
ps.setString(6, prefs.getSummerytext());
ps.setString(7, prefs.getAgb());
ps.setString(8, prefs.getShop_open());
ps.setString(9, prefs.getCurrency());
// Calendar c = Calendar.getInstance();
// 2000-10-10 05:00:00
String s = Date.getCurrentDate();
// "" + c.get(Calendar.YEAR) + "-" +
// + (1+c.get(Calendar.MONTH)) + "-" +
// + c.get(Calendar.DAY_OF_MONTH) + " " +
// + c.get(Calendar.HOUR_OF_DAY) + ":" +
// + c.get(Calendar.MINUTE) + ":" +
// + c.get(Calendar.SECOND);
//
ps.setString(10, s);
ps.setString(11, prefs.getMinorderamount());
ps.setNull(12, Types.BLOB);
ps.executeUpdate();
} catch (SQLException se) {
se.printStackTrace();
result = false;
} finally {
if(ps != null) {
try { ps.close(); } catch (Exception e) { e.printStackTrace(); }
}
if(con != null) {
try { con.close(); } catch (Exception e) { e.printStackTrace(); }
}
}
return result;
}
public boolean isValidPassword(String username, String password)
{
boolean result = false;
Connection con = null;
PreparedStatement ps = null;
ResultSet rs = null;
try {
// Logger.log("LoginDAO:isValidPassword()");
con = Const.getConnection();
ps = con.prepareStatement(GET_PARTNER_PW);
ps.setString(1, username);
ps.setString(2, password);
rs = ps.executeQuery();
while(rs.next()) {
result = true;
}
} catch (SQLException se) {
se.printStackTrace();
} finally {
if(rs != null) {
try { rs.close(); } catch (Exception e) { e.printStackTrace(); }
}
if(ps != null) {
try { ps.close(); } catch (Exception e) { e.printStackTrace(); }
}
if(con != null) {
try { con.close(); } catch (Exception e) { e.printStackTrace(); }
}
}
return result;
}
public int isUserExisting(String username)
{
// Logger.log("LoginDAO:isUserExisting()username="+username);
int result = Const.INVALID_ID;
Connection con = null;
PreparedStatement ps = null;
ResultSet rs = null;
try {
con = Const.getConnection();
if(con==null)
return result;
ps = con.prepareStatement(GET_EXISTING_PARTNER);
ps.setString(1, username);
rs = ps.executeQuery();
while(rs.next()) {
int partner_id = rs.getInt("partner_id");
if(partner_id > Const.INVALID_ID)
result = partner_id;
}
} catch (SQLException se) {
se.printStackTrace();
} finally {
if(rs != null) {
try { rs.close(); } catch (Exception e) { e.printStackTrace(); }
}
if(ps != null) {
try { ps.close(); } catch (Exception e) { e.printStackTrace(); }
}
if(con != null) {
try { con.close(); } catch (Exception e) { e.printStackTrace(); }
}
}
return result;
}
public Partner getPartner(int partner_id)
{
Partner partner = null;
Connection con = null;
PreparedStatement ps = null;
ResultSet rs = null;
try {
// System.out.println("LoginDAO:getPartner():partner_id="+partner_id);
con = Const.getConnection();
ps = con.prepareStatement(GET_PARTNER);
ps.setInt(1, partner_id);
rs = ps.executeQuery();
while(rs.next()) {
partner = new Partner(rs.getString("partner_id"),
rs.getString("username"),
rs.getString("passwort"),
rs.getString("loggedin"),
rs.getString("email"),
rs.getString("partner_language"),
rs.getString("telefon"),
rs.getString("partnername"),
rs.getString("str"),
rs.getString("plz"),
rs.getString("ort"),
rs.getString("urlhomepage"),
new BankAccount(rs.getString("ktoinhaber"),
rs.getString("bankname"),
rs.getString("blz"),
rs.getString("ktonr"),
rs.getString("iban"),
rs.getString("bic")));
}
} catch (SQLException se) {
se.printStackTrace();
} finally {
if(rs != null) {
try { rs.close(); } catch (Exception e) { e.printStackTrace(); }
}
if(ps != null) {
try { ps.close(); } catch (Exception e) { e.printStackTrace(); }
}
if(con != null) {
try { con.close(); } catch (Exception e) { e.printStackTrace(); }
}
}
return partner;
}
public Tarif getTarif(int partner_id)
{
Tarif tarif = null;
Connection con = null;
PreparedStatement ps = null;
ResultSet rs = null;
try {
con = Const.getConnection();
ps = con.prepareStatement(GET_TARIF);
ps.setInt(1, partner_id);
rs = ps.executeQuery();
while(rs.next()) {
String desc_shoptarif = rs.getString("description");
if(desc_shoptarif.equals(Tarif.BASIC_TARIF_TEXT)){
tarif = new BasicTarif(rs.getString("description"),
rs.getString("create_date"),
rs.getString("expire_date"),
rs.getDouble("baseprice"),
rs.getDouble("tx_rate"),
rs.getDouble("min_tx_price"));
}else if(desc_shoptarif.equals(Tarif.PRO_TARIF_TEXT)){
tarif = new ProTarif(rs.getString("description"),
rs.getString("create_date"),
rs.getString("expire_date"),
rs.getDouble("baseprice"),
rs.getDouble("tx_rate"),
rs.getDouble("min_tx_price"));
}else{ // FREE
tarif = new FreeTarif(rs.getString("description"),
rs.getString("create_date"),
rs.getString("expire_date"),
rs.getDouble("baseprice"),
rs.getDouble("tx_rate"),
rs.getDouble("min_tx_price"));
}
}
} catch (SQLException se) {
se.printStackTrace();
} finally {
if(rs != null) {
try { rs.close(); } catch (Exception e) { e.printStackTrace(); }
}
if(ps != null) {
try { ps.close(); } catch (Exception e) { e.printStackTrace(); }
}
if(con != null) {
try { con.close(); } catch (Exception e) { e.printStackTrace(); }
}
}
return tarif;
}
public String getPartnerName(int partner_id)
{
String result = null;
Connection con = null;
PreparedStatement ps = null;
ResultSet rs = null;
try {
// Logger.log("LoginDAO:getPartnerName():partner_id="+partner_id);
con = Const.getConnection();
ps = con.prepareStatement(GET_PARTNER_NAME);
ps.setInt(1, partner_id);
rs = ps.executeQuery();
while(rs.next()) {
String name = rs.getString("partnername");
result = name;
}
} catch (SQLException se) {
se.printStackTrace();
} finally {
if(rs != null) {
try { rs.close(); } catch (Exception e) { e.printStackTrace(); }
}
if(ps != null) {
try { ps.close(); } catch (Exception e) { e.printStackTrace(); }
}
if(con != null) {
try { con.close(); } catch (Exception e) { e.printStackTrace(); }
}
}
return result;
}
public int login(String username, String password)
{
int result = Const.INVALID_ID;
Connection con = null;
PreparedStatement queryStmt = null;
PreparedStatement updateStmt = null;
ResultSet rs = null;
try {
con = Const.getConnection();
updateStmt = con.prepareStatement(LOGIN_PARTNER);
updateStmt.setString(1, username);
updateStmt.setString(2, password);
updateStmt.executeUpdate();
result = isUserExisting(username);
}catch (SQLException se) {
se.printStackTrace();
} finally {
if(rs != null) {
try { rs.close(); } catch (Exception e) { e.printStackTrace(); }
}
if(queryStmt != null) {
try { queryStmt.close(); } catch (Exception e) { e.printStackTrace(); }
}
if(updateStmt != null) {
try { updateStmt.close(); } catch (Exception e) { e.printStackTrace(); }
}
if(con != null) {
try { con.close(); } catch (Exception e) { e.printStackTrace(); }
}
}
return result;
}
public boolean logout(String username)
{
boolean result = false;
Connection con = null;
PreparedStatement queryStmt = null;
PreparedStatement updateStmt = null;
ResultSet rs = null;
try {
con = Const.getConnection();
updateStmt = con.prepareStatement(LOGOUT_PARTNER);
updateStmt.setString(1, username);
updateStmt.executeUpdate();
result = true;
}catch (SQLException se) {
se.printStackTrace();
} finally {
if(rs != null) {
try { rs.close(); } catch (Exception e) { e.printStackTrace(); }
}
if(queryStmt != null) {
try { queryStmt.close(); } catch (Exception e) { e.printStackTrace(); }
}
if(updateStmt != null) {
try { updateStmt.close(); } catch (Exception e) { e.printStackTrace(); }
}
if(con != null) {
try { con.close(); } catch (Exception e) { e.printStackTrace(); }
}
}
return result;
}
public String[][] getPartnerIds() {
String[][] s_array = new String[100][2];
Connection con = null;
PreparedStatement ps = null;
ResultSet rs = null;
try {
con = Const.getConnection();
if(con==null)
return null;
ps = con.prepareStatement(GET_ALL_PARTNER_IDS);
rs = ps.executeQuery();
int index = 0;
while(rs.next()) {
int partner_id = rs.getInt("partner_id");
String username = rs.getString("username");
s_array[index][0] = ""+partner_id;
s_array[index][1] = username;
index++;
}
} catch (SQLException se) {
se.printStackTrace();
} finally {
if(rs != null) {
try { rs.close(); } catch (Exception e) { e.printStackTrace(); }
}
if(ps != null) {
try { ps.close(); } catch (Exception e) { e.printStackTrace(); }
}
if(con != null) {
try { con.close(); } catch (Exception e) { e.printStackTrace(); }
}
}
return s_array;
}
}
| [
"info@hopf-it.de"
] | info@hopf-it.de |
e682e6510a607c7451496b69c6fbc53e5c37d546 | dbb0c7e9d4e79b55d3613315b4fbede5defee5b6 | /OSR/src/main/java/com/ocr/domain/Address.java | d9ee0be245c13e3167f11d438ed6efe4d80315f9 | [] | no_license | trushapatel/On-Request-Courses-Cordination | 5f74ffda4cb71457099c881dd50407df972dc17b | 0e27642506a4d3666a15cae12ff09c06f712ccb2 | refs/heads/master | 2023-06-21T23:52:49.447267 | 2023-06-07T13:12:57 | 2023-06-07T13:12:57 | 81,783,566 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 853 | java | package com.ocr.domain;
import lombok.Data;
import org.hibernate.validator.constraints.NotEmpty;
import javax.annotation.Generated;
import javax.persistence.*;
import java.lang.reflect.Method;
/**
* Created by Ankit on 27-12-2016.
*/
@Data
@Entity
@Table(name = "address")
public class Address {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@Column(name="address1",length = 100)
@NotEmpty(message="Address can not be blank.")
private String address1;
@Column(name="address2",length = 100)
private String address2;
@Column(name="city",length = 50)
private String city;
@Column(name="state",length = 50)
private String state;
@Column(name="country",length = 50)
private String country;
@Column(name="zipcode",length = 50)
private String zipcode;
}
| [
"trusha.be@gmail.com"
] | trusha.be@gmail.com |
25adfda25c59af99c700529b8780ec8606f0a4b1 | 369a935090d9430be96b44b916fe122c3e26cc3d | /raft-store/src/main/java/com/guman/raft/impl/DefaultNode.java | 852fb360b088296cf9e1f12f7b7e6fe5788f1544 | [] | no_license | haoranaaa/guman-raft | f6dd8dc153c567a602a11e710178ac88afeccae7 | 39c206683b58707232e7158a06d04a6d9ecff32a | refs/heads/master | 2022-12-28T13:26:55.504771 | 2020-10-12T08:43:56 | 2020-10-12T08:43:56 | 303,328,798 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 26,909 | java | package com.guman.raft.impl;
import com.google.common.base.Splitter;
import com.guman.raft.*;
import com.guman.raft.common.NodeConfig;
import com.guman.raft.common.current.RaftThreadPool;
import com.guman.raft.common.util.LongConvert;
import com.guman.raft.constant.ServerState;
import com.guman.raft.model.*;
import com.guman.raft.model.client.ClientKVAck;
import com.guman.raft.model.client.ClientPairReq;
import com.guman.raft.rpc.DefaultRpcServer;
import com.guman.raft.rpc.RpcClient;
import com.guman.raft.rpc.RpcServer;
import com.guman.raft.rpc.model.Request;
import com.guman.raft.rpc.model.Response;
import com.guman.raft.store.DefaultLogModule;
import com.guman.raft.store.DefaultStore;
import com.guman.raft.thread.DefaultThreadPool;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import java.util.*;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
import static com.guman.raft.constant.ServerState.LEADER;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
/**
* @author duanhaoran
* @since 2020/3/28 7:09 PM
*/
@Slf4j
@Data
public class DefaultNode<T> implements Node<T>, LifeCycle {
private AtomicBoolean start = new AtomicBoolean(Boolean.FALSE);
private static Splitter splitter = Splitter.on(":");
/**
* 选举时间间隔基数
*/
public volatile long electionTime = 15 * 1000;
/**
* 上一次选举时间
*/
public volatile long preElectionTime = 0;
/**
* 上次一心跳时间戳
*/
public volatile long preHeartBeatTime = 0;
/**
* 心跳间隔基数
*/
public final long heartBeatTick = 5 * 1000;
private HeartBeatJob heartBeatJob = new HeartBeatJob();
private ElectionJob electionJob = new ElectionJob();
private ReplicationFailQueueConsumer replicationFailQueueConsumer = new ReplicationFailQueueConsumer();
private LinkedBlockingQueue<ReplicationFailModel> replicationFailQueue = new LinkedBlockingQueue<>(2048);
/* -------------- 所有服务器上持久存在的 ----------- */
/**
* 服务器最后一次知道的任期号(初始化为 0,持续递增)
*/
volatile long currentTerm = 0;
/**
* 在当前获得选票的候选人的 Id
*/
volatile int votedFor = -1;
/**
* 日志条目集;每一个条目包含一个用户状态机执行的指令,和收到时的任期号
*/
LogModule logModule;
public Store stateMachine;
/* --------------- 所有服务器上经常变的 ------------- */
/**
* 已知的最大的已经被提交的日志条目的索引值
*/
volatile long commitIndex;
/**
* 最后被应用到状态机的日志条目索引值(初始化为 0,持续递增)
*/
volatile long lastApplied = 0;
/* --------------- 在领导人里经常改变的(选举后重新初始化) --------------- */
/**
* 对于每一个服务器,需要发送给他的下一个日志条目的索引值(初始化为领导人最后索引值加一)
*/
Map<Peer, Long> nextIndexs;
/**
* 对于每一个服务器,已经复制给他的日志的最高索引值
*/
Map<Peer, Long> matchIndexs;
/**
* 一致性实现
*/
Consensus consensus;
private NodeConfig nodeConfig;
private RpcServer rpcServer;
private RpcClient rpcClient;
private Store store;
private PeerSet peerSet;
/**
* 当前服务的状态
*/
private ServerState serverState = ServerState.FOLLOWER;
private static class DefaultNodeLazyHolder {
private static final DefaultNode INSTANCE = new DefaultNode();
}
public static DefaultNode getInstance() {
return DefaultNodeLazyHolder.INSTANCE;
}
@Override
public void init() {
if (!start.compareAndSet(Boolean.FALSE, Boolean.TRUE)) {
return;
}
synchronized (this) {
rpcServer.init();
DefaultThreadPool.scheduleWithFixedDelay(heartBeatJob, 500);
DefaultThreadPool.scheduleAtFixedRate(electionJob, 5000, 500);
}
}
@Override
public void setConfig(NodeConfig config) {
if (config == null) {
config = new NodeConfig();
}
this.nodeConfig = config;
this.store = DefaultStore.getInstance();
this.logModule = DefaultLogModule.getInstance();
List<String> otherAddresses = config.getOtherAddresses();
if (CollectionUtils.isEmpty(otherAddresses)) {
throw new RuntimeException("address can not be null !");
}
peerSet = PeerSet.getInstance();
try {
NodeConfig finalConfig = config;
List<Peer> peers = otherAddresses.stream().map(i -> splitter.splitToList(i))
.map(i -> new Peer(Integer.valueOf(i.get(0)), i.get(1), Integer.valueOf(i.get(2))))
.peek(i -> {
if (Objects.equals(i.getNodeId(), finalConfig.getNodeId())
&& Objects.equals(i.getPort(), i.getPort())) {
peerSet.setSelf(i);
}
}).collect(Collectors.toList());
peerSet.setList(peers);
} catch (Exception e) {
log.error("格式化节点地址失败! ", e);
throw e;
}
rpcServer = new DefaultRpcServer(config.getSelfPort(), this);
}
@Override
public VoteResult handleRequestVote(RemoteParam param) {
return consensus.requestForVote(param);
}
@Override
public EntryResult handleRequestAppendLog(BaseEntryParams entryParam) {
return consensus.appendLogEntries(entryParam);
}
/**
* 客户端的每一个请求都包含一条被复制状态机执行的指令。
* 领导人把这条指令作为一条新的日志条目附加到日志中去,然后并行的发起附加条目 RPCs 给其他的服务器,让他们复制这条日志条目。
* 当这条日志条目被安全的复制(下面会介绍),领导人会应用这条日志条目到它的状态机中然后把执行的结果返回给客户端。
* 如果跟随者崩溃或者运行缓慢,再或者网络丢包,
* 领导人会不断的重复尝试附加日志条目 RPCs (尽管已经回复了客户端)直到所有的跟随者都最终存储了所有的日志条目。
*
* @param request
* @return
*/
@Override
public ClientKVAck handleClientRequest(ClientPairReq request) {
log.warn("handlerClientRequest handler {} operation, and key : [{}], value : [{}]",
ClientPairReq.Type.value(request.getType()), request.getKey(), request.getValue());
if (serverState != LEADER) {
log.warn("I not am leader , only invoke redirect method, leader addr : {}, my nodeId : {}",
peerSet.getLeader(), peerSet.getSelf().getNodeId());
return redirect(request);
}
if (request.getType() == ClientPairReq.GET) {
EntryParam logEntry = stateMachine.get(request.getKey());
if (logEntry != null) {
return new ClientKVAck(logEntry.getPair());
}
return new ClientKVAck(null);
}
EntryParam logEntry = EntryParam.builder()
.pair(Pair.builder().
key(request.getKey()).
value(request.getValue()).
build())
.term(currentTerm)
.build();
// 预提交到本地日志, todo 预提交
logModule.write(logEntry);
log.info("write logModule success, logEntry info : {}, log index : {}", logEntry, logEntry.getIndex());
final AtomicInteger success = new AtomicInteger(0);
List<Future<Boolean>> futureList = new CopyOnWriteArrayList<>();
int count = 0;
// 复制到其他机器
for (Peer peer : peerSet.getPeersWithOutSelf()) {
count++;
// 并行发起 RPC 复制.
futureList.add(replication(peer, logEntry));
}
CountDownLatch latch = new CountDownLatch(futureList.size());
List<Boolean> resultList = new CopyOnWriteArrayList<>();
getRPCAppendResult(futureList, latch, resultList);
try {
latch.await(4000, MILLISECONDS);
} catch (InterruptedException e) {
e.printStackTrace();
}
for (Boolean aBoolean : resultList) {
if (aBoolean) {
success.incrementAndGet();
}
}
// 如果存在一个满足N > commitIndex的 N,并且大多数的matchIndex[i] ≥ N成立,
// 并且log[N].term == currentTerm成立,那么令 commitIndex 等于这个 N (5.3 和 5.4 节)
List<Long> matchIndexList = new ArrayList<>(matchIndexs.values());
// 小于 2, 没有意义
int median = 0;
if (matchIndexList.size() >= 2) {
Collections.sort(matchIndexList);
median = matchIndexList.size() / 2;
}
Long N = matchIndexList.get(median);
if (N > commitIndex) {
EntryParam entry = logModule.read(N);
if (entry != null && entry.getTerm() == currentTerm) {
commitIndex = N;
}
}
// 响应客户端(成功一半)
if (success.get() >= (count / 2)) {
// 更新
commitIndex = logEntry.getIndex();
// 应用到状态机
getStateMachine().apply(logEntry);
lastApplied = commitIndex;
log.info("success apply local state machine, logEntry info : {}", logEntry);
// 返回成功.
return ClientKVAck.ok();
} else {
// 回滚已经提交的日志.
logModule.removeOnStartIndex(logEntry.getIndex());
log.warn("fail apply local state machine, logEntry info : {}", logEntry);
// 这里应该返回错误, 因为没有成功复制过半机器.
return ClientKVAck.fail();
}
}
private void getRPCAppendResult(List<Future<Boolean>> futureList, CountDownLatch latch, List<Boolean> resultList) {
for (Future<Boolean> future : futureList) {
RaftThreadPool.execute(() -> {
try {
resultList.add(future.get(3000, MILLISECONDS));
} catch (CancellationException | TimeoutException | ExecutionException | InterruptedException e) {
e.printStackTrace();
resultList.add(false);
} finally {
latch.countDown();
}
});
}
}
private Future<Boolean> replication(Peer peer, EntryParam entry) {
return RaftThreadPool.submit(new Callable() {
@Override
public Boolean call() throws Exception {
long start = System.currentTimeMillis(), end = start;
// 20 秒重试时间
while (end - start < 20 * 1000L) {
BaseEntryParams baseEntryParams = new BaseEntryParams();
baseEntryParams.setTerm(currentTerm);
baseEntryParams.setServiceId(peer.getNodeId());
baseEntryParams.setLeaderId(peerSet.getSelf().getNodeId());
baseEntryParams.setLeaderCommit(commitIndex);
// 以我这边为准, 这个行为通常是成为 leader 后,首次进行 RPC 才有意义.
Long nextIndex = nextIndexs.get(peer);
LinkedList<EntryParam> logEntries = new LinkedList<>();
if (entry.getIndex() >= nextIndex) {
for (long i = nextIndex; i <= entry.getIndex(); i++) {
EntryParam l = logModule.read(i);
if (l != null) {
logEntries.add(l);
}
}
} else {
logEntries.add(entry);
}
// 最小的那个日志.
EntryParam preLog = getPreLog(logEntries.getFirst());
baseEntryParams.setPreLogTerm(preLog.getTerm());
baseEntryParams.setPrevLogIndex(preLog.getIndex());
baseEntryParams.setEntryParams(logEntries);
Request request = Request.builder()
.cmd(Request.A_ENTRIES)
.obj(baseEntryParams)
.nodeId(peer.getNodeId())
.build();
try {
Response response = getRpcClient().send(request);
if (response == null) {
return false;
}
EntryResult result = (EntryResult) response.getResult();
if (result != null && result.isSuccess()) {
log.info("append follower entry success , follower=[{}], entry=[{}]", peer, baseEntryParams.getEntryParams());
// update 这两个追踪值
nextIndexs.put(peer, entry.getIndex() + 1);
matchIndexs.put(peer, entry.getIndex());
return true;
} else if (result != null) {
// 对方比我大
if (result.getTerm() > currentTerm) {
log.warn("follower [{}] term [{}] than more self, and my term = [{}], so, I will become follower",
peer, result.getTerm(), currentTerm);
currentTerm = result.getTerm();
// 认怂, 变成跟随者
serverState = ServerState.FOLLOWER;
return false;
} // 没我大, 却失败了,说明 index 不对.或者 term 不对.
else {
// 递减
if (nextIndex == 0) {
nextIndex = 1L;
}
nextIndexs.put(peer, nextIndex - 1);
log.warn("follower {} nextIndex not match, will reduce nextIndex and retry RPC append, nextIndex : [{}]", peer.getNodeId(),
nextIndex);
// 重来, 直到成功.
}
}
end = System.currentTimeMillis();
} catch (Exception e) {
log.warn(e.getMessage(), e);
//放队列重试
ReplicationFailModel model = ReplicationFailModel.builder()
.callable(this)
.logEntry(entry)
.peer(peer)
.offerTime(System.currentTimeMillis())
.build();
replicationFailQueue.offer(model);
return false;
}
}
// 超时了,没办法了
return false;
}
});
}
private EntryParam getPreLog(EntryParam logEntry) {
EntryParam entry = logModule.read(logEntry.getIndex() - 1);
if (entry == null) {
log.warn("get perLog is null , parameter logEntry : {}", logEntry);
entry = EntryParam.builder().index(0L).term(0).pair(null).build();
}
return entry;
}
private ClientKVAck redirect(ClientPairReq request) {
Request<ClientPairReq> r = Request.<ClientPairReq>builder().
obj(request).nodeId(peerSet.getLeader().getNodeId()).cmd(Request.CLIENT_REQ).build();
Response response = rpcClient.send(r);
return (ClientKVAck) response.getResult();
}
@Override
public void destroy() {
}
/**
* 客户端和服务端之间的心跳
*/
class HeartBeatJob implements Runnable {
@Override
public void run() {
if (serverState != LEADER) {
return;
}
long current = System.currentTimeMillis();
if (current - preHeartBeatTime < heartBeatTick) {
return;
}
log.info("=========== NextIndex =============");
for (Peer peer : peerSet.getPeersWithOutSelf()) {
log.info("Peer {} nextIndex={}", peer.getNodeId(), nextIndexs.get(peer));
}
preHeartBeatTime = System.currentTimeMillis();
// 心跳只关心 term 和 leaderID
for (Peer peer : peerSet.getPeersWithOutSelf()) {
BaseEntryParams param = BaseEntryParams.builder()
.entryParams(null)// 心跳,空日志.
.leaderId(peerSet.getSelf().getNodeId())
.build();
param.setServiceId(peer.getNodeId());
param.setTerm(currentTerm);
Request<BaseEntryParams> request = new Request<>(
Request.A_ENTRIES,
peer.getNodeId(),
param
);
RaftThreadPool.execute(() -> {
try {
Response response = getRpcClient().send(request);
EntryResult entryResult = (EntryResult) response.getResult();
long term = entryResult.getTerm();
if (term > currentTerm) {
log.error("self will become follower, he's term : {}, my term : {}", term, currentTerm);
currentTerm = term;
votedFor = -1;
serverState = ServerState.FOLLOWER;
}
} catch (Exception e) {
log.error("HeartBeatTask RPC Fail, request URL : {} ", request.getNodeId());
}
}, false);
}
}
}
/**
* 1. 在转变成候选人后就立即开始选举过程
* 自增当前的任期号(currentTerm)
* 给自己投票
* 重置选举超时计时器
* 发送请求投票的 RPC 给其他所有服务器
* 2. 如果接收到大多数服务器的选票,那么就变成领导人
* 3. 如果接收到来自新的领导人的附加日志 RPC,转变成跟随者
* 4. 如果选举过程超时,再次发起一轮选举
*/
class ElectionJob implements Runnable {
@Override
public void run() {
if (serverState == LEADER) {
return;
}
long current = System.currentTimeMillis();
// 基于 RAFT 的随机时间,解决冲突.
electionTime = electionTime + ThreadLocalRandom.current().nextInt(50);
if (current - preElectionTime < electionTime) {
return;
}
serverState = ServerState.CANDIDATE;
log.error("node {} will become CANDIDATE and start election leader, current term : [{}], LastEntry : [{}]",
peerSet.getSelf(), currentTerm, logModule.getLast());
preElectionTime = System.currentTimeMillis() + ThreadLocalRandom.current().nextInt(200) + 150;
currentTerm = currentTerm + 1;
// 推荐自己.
votedFor = peerSet.getSelf().getNodeId();
List<Peer> peers = peerSet.getPeersWithOutSelf();
ArrayList<Future> futureArrayList = new ArrayList<>();
log.info("peerList size : {}, peer list content : {}", peers.size(), peers);
// 发送请求
for (Peer peer : peers) {
futureArrayList.add(RaftThreadPool.submit(() -> {
long lastTerm = 0L;
EntryParam last = logModule.getLast();
if (last != null) {
lastTerm = last.getTerm();
}
RemoteParam param = RemoteParam.builder().
candidateId(peerSet.getSelf().getNodeId()).
lastLogIndex(LongConvert.convert(logModule.getLastIndex())).
lastLogTerm(lastTerm).
build();
param.setTerm(currentTerm);
Request request = Request.builder()
.cmd(Request.R_VOTE)
.obj(param)
.nodeId(peer.getNodeId())
.build();
try {
@SuppressWarnings("unchecked")
Response<VoteResult> response = getRpcClient().send(request);
return response;
} catch (Exception e) {
log.error("ElectionTask RPC Fail , URL : " + request.getNodeId());
return null;
}
}));
}
AtomicInteger success2 = new AtomicInteger(0);
CountDownLatch latch = new CountDownLatch(futureArrayList.size());
log.info("futureArrayList.size() : {}", futureArrayList.size());
// 等待结果.
for (Future future : futureArrayList) {
RaftThreadPool.submit(() -> {
try {
@SuppressWarnings("unchecked")
Response<VoteResult> response = (Response<VoteResult>) future.get(3000, MILLISECONDS);
if (response == null) {
return -1;
}
boolean isVoteGranted = response.getResult().isVoteGranted();
if (isVoteGranted) {
success2.incrementAndGet();
} else {
// 更新自己的任期.
long resTerm = response.getResult().getTerm();
if (resTerm >= currentTerm) {
currentTerm = resTerm;
}
}
return 0;
} catch (Exception e) {
log.error("future.get exception , e : ", e);
return -1;
} finally {
latch.countDown();
}
});
}
try {
// 稍等片刻
latch.await(3500, MILLISECONDS);
} catch (InterruptedException e) {
log.warn("InterruptedException By Master election Task");
}
int success = success2.get();
log.info("node {} maybe become leader , success count = {} , status : {}", peerSet.getSelf(), success, serverState);
// 如果投票期间,有其他服务器发送 appendEntry , 就可能变成 follower ,这时,应该停止.
if (serverState == ServerState.FOLLOWER) {
return;
}
// 加上自身.
if (success >= peers.size() / 2) {
log.warn("node {} become leader ", peerSet.getSelf());
serverState = LEADER;
peerSet.setLeader(peerSet.getSelf());
votedFor = -1;
becomeLeaderToDoThing();
} else {
// else 重新选举
votedFor = -1;
}
}
}
/**
* 初始化所有的 nextIndex 值为自己的最后一条日志的 index + 1. 如果下次 RPC 时, 跟随者和leader 不一致,就会失败.
* 那么 leader 尝试递减 nextIndex 并进行重试.最终将达成一致.
*/
private void becomeLeaderToDoThing() {
nextIndexs = new ConcurrentHashMap<>();
matchIndexs = new ConcurrentHashMap<>();
for (Peer peer : peerSet.getPeersWithOutSelf()) {
nextIndexs.put(peer, logModule.getLastIndex() + 1);
matchIndexs.put(peer, 0L);
}
}
class ReplicationFailQueueConsumer implements Runnable {
/**
* 一分钟
*/
long intervalTime = 1000 * 60;
@Override
public void run() {
for (; ; ) {
try {
ReplicationFailModel model = replicationFailQueue.take();
if (serverState != LEADER) {
// 应该清空?
replicationFailQueue.clear();
continue;
}
log.warn("replication Fail Queue Consumer take a task, will be retry replication, content detail : [{}]", model.logEntry);
long offerTime = model.offerTime;
if (System.currentTimeMillis() - offerTime > intervalTime) {
log.warn("replication Fail event Queue maybe full or handler slow");
}
Callable callable = model.callable;
Future<Boolean> future = RaftThreadPool.submit(callable);
Boolean r = future.get(3000, MILLISECONDS);
// 重试成功.
if (r) {
// 可能有资格应用到状态机.
tryApplyStateMachine(model);
}
} catch (InterruptedException e) {
// ignore
} catch (ExecutionException | TimeoutException e) {
log.warn(e.getMessage());
}
}
}
}
private void tryApplyStateMachine(ReplicationFailModel model) {
String success = stateMachine.getString(model.successKey);
stateMachine.setString(model.successKey, String.valueOf(Integer.valueOf(success) + 1));
String count = stateMachine.getString(model.countKey);
if (Integer.valueOf(success) >= Integer.valueOf(count) / 2) {
stateMachine.apply(model.logEntry);
stateMachine.delString(model.countKey, model.successKey);
}
}
}
| [
"“haoran.duan@bianlifeng.com”"
] | “haoran.duan@bianlifeng.com” |
50882fd0b4fec1c2de183bdfe6888a528e31cef5 | b55c5e3000d50fc025f10aad5c69166b446eeb7e | /java/src/main/java/fr/soat/labs/rx/handler/AggregatorHandler.java | 0a01110ecd6375f37a255c30f7fc3f244f611efb | [] | no_license | dwursteisen/labs-rx | 9f26adc7e53d8294aee1b29f7e9beaf544cfd562 | b26108a47058322c460f51e877e36cec64b7dfa9 | refs/heads/master | 2016-09-09T19:33:57.907291 | 2014-03-20T09:49:14 | 2014-03-20T09:49:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,049 | java | package fr.soat.labs.rx.handler;
import fr.soat.labs.rx.model.Incident;
import fr.soat.labs.rx.model.Train;
import org.webbitserver.*;
import org.webbitserver.netty.WebSocketClient;
import rx.Observable;
import rx.Observer;
import rx.Subscription;
import rx.subjects.PublishSubject;
import rx.subjects.Subject;
import rx.subscriptions.Subscriptions;
import rx.util.functions.Func1;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Collection;
import java.util.LinkedList;
import java.util.logging.Logger;
/**
* Created by formation on 28/02/14.
*/
public class AggregatorHandler implements EventSourceHandler {
private final Collection<EventSourceConnection> connections = new LinkedList<>();
public AggregatorHandler() throws URISyntaxException {
Observable<Train> trainBroker = buildWebsocketObservable("ws://localhost:9000/trains")
.map(new Train()::deserialise);
Observable<Incident> incidentBroker = buildWebsocketObservable("ws://localhost:9001/incidents")
.map(new Incident()::deserialise);
Observable<String> fluxDeTrainEnJson = trainBroker.map(Train::serialise);
Observable<String> fluxIncidentsEnJson = incidentBroker.map(Incident::serialize);
Observable.merge(fluxDeTrainEnJson, fluxIncidentsEnJson)
.doOnNext((json) -> Logger.getLogger("Aggregator").info("json to send : " + json))
.map(EventSourceMessage::new)
.subscribe((msg) -> connections.forEach((c) -> c.send(msg)),
(ex) -> Logger.getLogger("Aggregator").warning(ex.getMessage())
);
}
private Observable<String> buildWebsocketObservable(String url) {
return Observable.create(new Observable.OnSubscribeFunc<String>() {
@Override
public Subscription onSubscribe(Observer<? super String> observer) {
try {
new WebSocketClient(new URI(url), new MessageHandler(observer)).start();
} catch (URISyntaxException e) {
observer.onError(e);
}
return Subscriptions.empty();
}
}).cache();
}
@Override
public void onOpen(EventSourceConnection eventSourceConnection) throws Exception {
connections.add(eventSourceConnection);
}
@Override
public void onClose(EventSourceConnection eventSourceConnection) throws Exception {
connections.remove(eventSourceConnection);
}
private static class MessageHandler extends BaseWebSocketHandler {
private final Observer<? super String> broker;
private MessageHandler(Observer<? super String> observer) {
this.broker = observer;
}
@Override
public void onMessage(WebSocketConnection connection, String msg) throws Throwable {
this.broker.onNext(msg);
}
}
}
| [
"david.wursteisen+git@gmail.com"
] | david.wursteisen+git@gmail.com |
6272ed32a4545751e302ff0c935d8b77ed02097e | b66c5f9c9a5260896c8eebde32b0d50590fd808d | /Homework6b/src/Avocado.java | 8c2ee3c460c2c8a97a99b225f4d88e44c20f98cb | [] | no_license | eefortunato/Java-Codes | 9bde691ed1bfc4ce580986074704a503bfe39a67 | b373d040ed4b760ab9f8dc643e57d6305623a5ed | refs/heads/master | 2021-01-17T06:16:05.705331 | 2016-12-06T16:05:44 | 2016-12-06T16:05:44 | 29,262,629 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,326 | java | /**
* Avocado.java
* This is the subclass Avocado where all the basic members and
* methods for Avocado are defined
*
* @version $Id: Comodity.java,v 1.0 2013/10/08 10:00pm $
*
* @author Pavan Kumar Pallerla
* @author Eric Fortunato
*
*
*/
public class Avocado extends Comodity{
int amountForDiscount = 4;
private final double weight = 0.5;
private double quantityRemaining = 200;
private double quantityPurchased;
/**
* Overloaded constructor to create an avocado initializing it with the price
* @param price receives a double for the price
*/
Avocado (double price) {
super();
setPrice(price);
}
/**
* This method sets the price for the avocado
* @param price it receives a double as a parameter for the price
*/
public void setPrice(double price) {
this.price = price;
}
/**
* This method returns true if the amount of avocado purchased is enough for the discount
* @return true if it is eligible
*/
public boolean isEligibleForDiscount(){
if(this.quantityPurchased > amountForDiscount){
return true;
}
return false;
}
/**
* This method gets the weight of the avocado
* @return weight the weight of the current avocado
*/
public double getWeight(){
return this.weight;
}
/**
* This method returns true if there are enough avocados to buy
* @param quantity receives a double for the quantity to purchase
* @return true if there are enough
*/
public boolean isQuantitySufficient(double quantity) {
return quantityRemaining >= quantity;
}
/**
* This method sets the quantity of avocado the customer ill buy and decreases the total
* @param quantity receives a double as quantity
*/
public void setQuantity(double quantity) {
this.quantityPurchased = quantity;
quantityRemaining -= quantity;
}
/**
* This method returns the quantity of avocados purchased by the customer
* @return quantityPurchased the quantity of apples purchased for the current avocado
*/
public double getQuantityPurchased() {
return this.quantityPurchased;
}
/**
* This method returns the remaining avocados
* @return quantityRamaining the remaining number of the current avocado
*/
public double getRemainingItems() {
return this.quantityRemaining;
}
}
| [
"noreply@github.com"
] | eefortunato.noreply@github.com |
46752534feff2f8b7bbca450965adbbbdee23d6d | b5858fdb38602f3656d929baf98fa79408c55e55 | /src/main/java/com/du/webservicetxt/service/TxtService.java | 856e40246c268462f18ef3265647f42f16074ffd | [] | no_license | duzining/webservicetxt | fa58fff8048c1306f113ea2950dec93a3bc7133b | a1ada6a30bbb6e4a8a764dc30b186a2fcace1a96 | refs/heads/master | 2022-03-23T13:19:03.678855 | 2019-12-24T03:31:41 | 2019-12-24T03:31:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 482 | java | package com.du.webservicetxt.service;
import javax.jws.WebMethod;
import javax.jws.WebService;
import java.io.BufferedReader;
import java.io.File;
@WebService(targetNamespace = "http://service.webservicetxt.du.com",name = "txt")
public interface TxtService {
@WebMethod
public void getTxt();
@WebMethod
public String readTxt();
@WebMethod
public void writeTxt(String newStr);
@WebMethod
public void replaceTxt(String oldStr,String newStr);
}
| [
"1211730587@qq.com"
] | 1211730587@qq.com |
9715dbee551d7e3c69cb63f8080ff0cb1c95e0c8 | 9af8aad2d711a165b7dde21fd633a34d80377ac0 | /app/src/main/java/com/example/a0134598r/pathfinder/obsolete/QuenumberFragment.java | 85d539b7a82612bef492b42ee023e107e124ec66 | [] | no_license | achyut92/PatientApp | 12c8bfbdec25a1a281b5cf63042717065d3d7f2e | c847e81186a022d4ef2bb1eac88fb683f31352c9 | refs/heads/master | 2016-09-15T21:24:02.746498 | 2015-09-18T09:08:54 | 2015-09-18T09:08:54 | 42,711,064 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,385 | java | package com.example.a0134598r.pathfinder.obsolete;
import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.a0134598r.pathfinder.R;
import com.google.android.gms.plus.PlusOneButton;
/**
* A fragment with a Google +1 button.
* Activities that contain this fragment must implement the
* {@link QuenumberFragment.OnFragmentInteractionListener} interface
* to handle interaction events.
* Use the {@link QuenumberFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class QuenumberFragment extends Fragment {
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;
// The URL to +1. Must be a valid URL.
private final String PLUS_ONE_URL = "http://developer.android.com";
// The request code must be 0 or greater.
private static final int PLUS_ONE_REQUEST_CODE = 0;
private PlusOneButton mPlusOneButton;
private OnFragmentInteractionListener mListener;
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment QuenumberFragment.
*/
// TODO: Rename and change types and number of parameters
public static QuenumberFragment newInstance(String param1, String param2) {
QuenumberFragment fragment = new QuenumberFragment();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}
public QuenumberFragment() {
// Required empty public constructor
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_quenumber, container, false);
//Find the +1 button
mPlusOneButton = (PlusOneButton) view.findViewById(R.id.plus_one_button);
return view;
}
@Override
public void onResume() {
super.onResume();
// Refresh the state of the +1 button each time the activity receives focus.
mPlusOneButton.initialize(PLUS_ONE_URL, PLUS_ONE_REQUEST_CODE);
}
// TODO: Rename method, update argument and hook method into UI event
public void onButtonPressed(Uri uri) {
if (mListener != null) {
mListener.onFragmentInteraction(uri);
}
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
try {
mListener = (OnFragmentInteractionListener) activity;
} catch (ClassCastException e) {
throw new ClassCastException(activity.toString()
+ " must implement OnFragmentInteractionListener");
}
}
@Override
public void onDetach() {
super.onDetach();
mListener = null;
}
/**
* This interface must be implemented by activities that contain this
* fragment to allow an interaction in this fragment to be communicated
* to the activity and potentially other fragments contained in that
* activity.
* <p/>
* See the Android Training lesson <a href=
* "http://developer.android.com/training/basics/fragments/communicating.html"
* >Communicating with Other Fragments</a> for more information.
*/
public interface OnFragmentInteractionListener {
// TODO: Update argument type and name
public void onFragmentInteraction(Uri uri);
}
}
| [
"nusseres@gmail.com"
] | nusseres@gmail.com |
1c5109aa9e73408ed3e410e01fceda606ea86bc0 | c885ef92397be9d54b87741f01557f61d3f794f3 | /results/Time-1/org.joda.time.Partial/BBC-F0-opt-50/tests/28/org/joda/time/Partial_ESTest_scaffolding.java | 445374225cf5b2f21fb72a3bf1c904d53ea4ba98 | [
"CC-BY-4.0",
"MIT"
] | permissive | pderakhshanfar/EMSE-BBC-experiment | f60ac5f7664dd9a85f755a00a57ec12c7551e8c6 | fea1a92c2e7ba7080b8529e2052259c9b697bbda | refs/heads/main | 2022-11-25T00:39:58.983828 | 2022-04-12T16:04:26 | 2022-04-12T16:04:26 | 309,335,889 | 0 | 1 | null | 2021-11-05T11:18:43 | 2020-11-02T10:30:38 | null | UTF-8 | Java | false | false | 21,115 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Sun Oct 24 01:38:38 GMT 2021
*/
package org.joda.time;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
import org.junit.AfterClass;
import org.evosuite.runtime.sandbox.Sandbox;
import org.evosuite.runtime.sandbox.Sandbox.SandboxMode;
@EvoSuiteClassExclude
public class Partial_ESTest_scaffolding {
@org.junit.Rule
public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone();
private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
@BeforeClass
public static void initEvoSuiteFramework() {
org.evosuite.runtime.RuntimeSettings.className = "org.joda.time.Partial";
org.evosuite.runtime.GuiSupport.initialize();
org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100;
org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000;
org.evosuite.runtime.RuntimeSettings.mockSystemIn = true;
org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED;
org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT();
org.evosuite.runtime.classhandling.JDKClassResetter.init();
setSystemProperties();
initializeClasses();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
}
@AfterClass
public static void clearEvoSuiteFramework(){
Sandbox.resetDefaultSecurityManager();
java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
}
@Before
public void initTestCase(){
threadStopper.storeCurrentThreads();
threadStopper.startRecordingTime();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler();
org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode();
setSystemProperties();
org.evosuite.runtime.GuiSupport.setHeadless();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
org.evosuite.runtime.agent.InstrumentingAgent.activate();
}
@After
public void doneWithTestCase(){
threadStopper.killAndJoinClientThreads();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks();
org.evosuite.runtime.classhandling.JDKClassResetter.reset();
resetClasses();
org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode();
org.evosuite.runtime.agent.InstrumentingAgent.deactivate();
org.evosuite.runtime.GuiSupport.restoreHeadlessMode();
}
public static void setSystemProperties() {
java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
java.lang.System.setProperty("user.timezone", "Etc/UTC");
}
private static void initializeClasses() {
org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(Partial_ESTest_scaffolding.class.getClassLoader() ,
"org.joda.time.DateTimeZone",
"org.joda.time.format.DateTimeFormatterBuilder$StringLiteral",
"org.joda.time.tz.DateTimeZoneBuilder$Recurrence",
"org.joda.time.format.ISODateTimeFormat$Constants",
"org.joda.time.DateTimeUtils$MillisProvider",
"org.joda.time.chrono.GJYearOfEraDateTimeField",
"org.joda.time.Seconds",
"org.joda.time.field.RemainderDateTimeField",
"org.joda.time.JodaTimePermission",
"org.joda.time.field.AbstractPartialFieldProperty",
"org.joda.time.chrono.BasicWeekOfWeekyearDateTimeField",
"org.joda.time.field.StrictDateTimeField",
"org.joda.time.DateTimeFieldType",
"org.joda.time.format.DateTimeFormatterBuilder$Fraction",
"org.joda.time.format.DateTimeFormatterBuilder$FixedNumber",
"org.joda.time.DateTimeFieldType$StandardDateTimeFieldType",
"org.joda.time.chrono.BasicChronology$HalfdayField",
"org.joda.time.ReadableInterval",
"org.joda.time.chrono.LimitChronology$LimitDateTimeField",
"org.joda.time.chrono.BasicChronology$YearInfo",
"org.joda.time.tz.DateTimeZoneBuilder$PrecalculatedZone",
"org.joda.time.LocalDate$Property",
"org.joda.time.field.UnsupportedDurationField",
"org.joda.time.field.LenientDateTimeField",
"org.joda.time.base.AbstractDateTime",
"org.joda.time.field.SkipUndoDateTimeField",
"org.joda.time.format.PeriodFormatterBuilder",
"org.joda.time.format.DateTimePrinter",
"org.joda.time.chrono.ISOChronology",
"org.joda.time.base.BaseLocal",
"org.joda.time.field.DelegatedDateTimeField",
"org.joda.time.chrono.BasicChronology",
"org.joda.time.chrono.LenientChronology",
"org.joda.time.chrono.BasicYearDateTimeField",
"org.joda.time.format.PeriodFormatterBuilder$FieldFormatter",
"org.joda.time.field.DividedDateTimeField",
"org.joda.time.chrono.ZonedChronology",
"org.joda.time.format.DateTimeFormatterBuilder$TimeZoneOffset",
"org.joda.time.field.BaseDateTimeField",
"org.joda.time.field.ZeroIsMaxDateTimeField",
"org.joda.time.format.DateTimeFormatterBuilder",
"org.joda.time.chrono.EthiopicChronology",
"org.joda.time.base.BaseInterval",
"org.joda.time.tz.CachedDateTimeZone$Info",
"org.joda.time.Duration",
"org.joda.time.format.FormatUtils",
"org.joda.time.format.PeriodFormatter",
"org.joda.time.PeriodType",
"org.joda.time.field.MillisDurationField",
"org.joda.time.chrono.GJChronology",
"org.joda.time.Interval",
"org.joda.time.chrono.IslamicChronology",
"org.joda.time.base.AbstractInstant",
"org.joda.time.LocalDateTime$Property",
"org.joda.time.chrono.BasicFixedMonthChronology",
"org.joda.time.tz.DateTimeZoneBuilder",
"org.joda.time.field.UnsupportedDateTimeField",
"org.joda.time.field.ScaledDurationField",
"org.joda.time.chrono.ISOYearOfEraDateTimeField",
"org.joda.time.ReadWritablePeriod",
"org.joda.time.field.PreciseDurationDateTimeField",
"org.joda.time.MonthDay",
"org.joda.time.LocalDateTime",
"org.joda.time.MutablePeriod",
"org.joda.time.tz.FixedDateTimeZone",
"org.joda.time.MutableDateTime",
"org.joda.time.base.BasePeriod$1",
"org.joda.time.format.PeriodPrinter",
"org.joda.time.field.PreciseDateTimeField",
"org.joda.time.tz.CachedDateTimeZone",
"org.joda.time.chrono.LimitChronology$LimitException",
"org.joda.time.ReadableDateTime",
"org.joda.time.format.PeriodFormatterBuilder$Literal",
"org.joda.time.format.PeriodParser",
"org.joda.time.base.BaseDuration",
"org.joda.time.DateMidnight",
"org.joda.time.field.DecoratedDateTimeField",
"org.joda.time.YearMonthDay",
"org.joda.time.format.DateTimeParser",
"org.joda.time.format.DateTimeFormatterBuilder$CharacterLiteral",
"org.joda.time.YearMonth",
"org.joda.time.chrono.GJChronology$CutoverField",
"org.joda.time.LocalTime$Property",
"org.joda.time.field.OffsetDateTimeField",
"org.joda.time.DateTime$Property",
"org.joda.time.chrono.GJMonthOfYearDateTimeField",
"org.joda.time.chrono.BasicWeekyearDateTimeField",
"org.joda.time.Days",
"org.joda.time.DateTimeField",
"org.joda.time.field.FieldUtils",
"org.joda.time.format.DateTimeFormatterBuilder$MatchingParser",
"org.joda.time.chrono.BasicSingleEraDateTimeField",
"org.joda.time.format.DateTimeFormat",
"org.joda.time.Partial",
"org.joda.time.format.ISODateTimeFormat",
"org.joda.time.field.SkipDateTimeField",
"org.joda.time.YearMonth$Property",
"org.joda.time.chrono.LimitChronology",
"org.joda.time.base.AbstractPeriod",
"org.joda.time.ReadableInstant",
"org.joda.time.base.BaseSingleFieldPeriod",
"org.joda.time.chrono.GJDayOfWeekDateTimeField",
"org.joda.time.DateTimeUtils$SystemMillisProvider",
"org.joda.time.IllegalFieldValueException",
"org.joda.time.IllegalInstantException",
"org.joda.time.tz.DefaultNameProvider",
"org.joda.time.format.DateTimeFormatterBuilder$Composite",
"org.joda.time.format.DateTimeFormatterBuilder$UnpaddedNumber",
"org.joda.time.tz.Provider",
"org.joda.time.field.ImpreciseDateTimeField$LinkedDurationField",
"org.joda.time.ReadablePeriod",
"org.joda.time.chrono.ZonedChronology$ZonedDateTimeField",
"org.joda.time.chrono.AssembledChronology$Fields",
"org.joda.time.chrono.GregorianChronology",
"org.joda.time.DurationFieldType",
"org.joda.time.ReadWritableInstant",
"org.joda.time.tz.NameProvider",
"org.joda.time.chrono.GJChronology$LinkedDurationField",
"org.joda.time.Minutes",
"org.joda.time.format.DateTimeFormatterBuilder$PaddedNumber",
"org.joda.time.chrono.BasicMonthOfYearDateTimeField",
"org.joda.time.base.AbstractPartial",
"org.joda.time.base.BasePartial",
"org.joda.time.base.BaseDateTime",
"org.joda.time.base.AbstractDuration",
"org.joda.time.DateTimeUtils",
"org.joda.time.Hours",
"org.joda.time.LocalTime",
"org.joda.time.base.AbstractInterval",
"org.joda.time.base.BasePeriod",
"org.joda.time.field.DecoratedDurationField",
"org.joda.time.tz.DateTimeZoneBuilder$DSTZone",
"org.joda.time.chrono.AssembledChronology",
"org.joda.time.chrono.StrictChronology",
"org.joda.time.format.DateTimeFormat$1",
"org.joda.time.TimeOfDay",
"org.joda.time.format.ISOPeriodFormat",
"org.joda.time.chrono.GJEraDateTimeField",
"org.joda.time.tz.ZoneInfoProvider",
"org.joda.time.DateTimeZone$1",
"org.joda.time.chrono.BaseChronology",
"org.joda.time.chrono.JulianChronology",
"org.joda.time.Partial$Property",
"org.joda.time.field.ImpreciseDateTimeField",
"org.joda.time.chrono.CopticChronology",
"org.joda.time.field.PreciseDurationField",
"org.joda.time.Period",
"org.joda.time.tz.DateTimeZoneBuilder$OfYear",
"org.joda.time.ReadableDuration",
"org.joda.time.chrono.BasicGJChronology",
"org.joda.time.format.DateTimeFormatterBuilder$NumberFormatter",
"org.joda.time.DurationField",
"org.joda.time.format.DateTimeFormatter",
"org.joda.time.Weeks",
"org.joda.time.chrono.IslamicChronology$LeapYearPatternType",
"org.joda.time.Chronology",
"org.joda.time.DateTime",
"org.joda.time.format.PeriodFormatterBuilder$Composite",
"org.joda.time.field.AbstractReadableInstantFieldProperty",
"org.joda.time.format.PeriodFormatterBuilder$PeriodFieldAffix",
"org.joda.time.format.PeriodFormatterBuilder$SimpleAffix",
"org.joda.time.LocalDate",
"org.joda.time.chrono.BasicDayOfMonthDateTimeField",
"org.joda.time.ReadWritableDateTime",
"org.joda.time.MonthDay$Property",
"org.joda.time.chrono.ZonedChronology$ZonedDurationField",
"org.joda.time.Instant",
"org.joda.time.format.PeriodFormatterBuilder$Separator",
"org.joda.time.ReadablePartial",
"org.joda.time.chrono.LimitChronology$LimitDurationField",
"org.joda.time.chrono.GJChronology$ImpreciseCutoverField",
"org.joda.time.chrono.BasicDayOfYearDateTimeField",
"org.joda.time.DurationFieldType$StandardDurationFieldType",
"org.joda.time.field.BaseDurationField",
"org.joda.time.chrono.BuddhistChronology"
);
}
private static void resetClasses() {
org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(Partial_ESTest_scaffolding.class.getClassLoader());
org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses(
"org.joda.time.base.AbstractPartial",
"org.joda.time.Partial",
"org.joda.time.field.AbstractPartialFieldProperty",
"org.joda.time.Partial$Property",
"org.joda.time.DateTimeUtils$SystemMillisProvider",
"org.joda.time.tz.FixedDateTimeZone",
"org.joda.time.tz.ZoneInfoProvider",
"org.joda.time.tz.DefaultNameProvider",
"org.joda.time.DateTimeZone",
"org.joda.time.tz.DateTimeZoneBuilder",
"org.joda.time.tz.DateTimeZoneBuilder$PrecalculatedZone",
"org.joda.time.tz.DateTimeZoneBuilder$DSTZone",
"org.joda.time.tz.DateTimeZoneBuilder$Recurrence",
"org.joda.time.tz.DateTimeZoneBuilder$OfYear",
"org.joda.time.tz.CachedDateTimeZone",
"org.joda.time.DateTimeUtils",
"org.joda.time.format.FormatUtils",
"org.joda.time.Chronology",
"org.joda.time.chrono.BaseChronology",
"org.joda.time.chrono.AssembledChronology",
"org.joda.time.DurationField",
"org.joda.time.field.MillisDurationField",
"org.joda.time.field.BaseDurationField",
"org.joda.time.field.PreciseDurationField",
"org.joda.time.DurationFieldType$StandardDurationFieldType",
"org.joda.time.DurationFieldType",
"org.joda.time.DateTimeField",
"org.joda.time.field.BaseDateTimeField",
"org.joda.time.field.PreciseDurationDateTimeField",
"org.joda.time.field.PreciseDateTimeField",
"org.joda.time.DateTimeFieldType$StandardDateTimeFieldType",
"org.joda.time.DateTimeFieldType",
"org.joda.time.field.DecoratedDateTimeField",
"org.joda.time.field.ZeroIsMaxDateTimeField",
"org.joda.time.chrono.BasicChronology$HalfdayField",
"org.joda.time.chrono.BasicChronology",
"org.joda.time.chrono.BasicGJChronology",
"org.joda.time.chrono.AssembledChronology$Fields",
"org.joda.time.field.ImpreciseDateTimeField",
"org.joda.time.chrono.BasicYearDateTimeField",
"org.joda.time.field.ImpreciseDateTimeField$LinkedDurationField",
"org.joda.time.chrono.GJYearOfEraDateTimeField",
"org.joda.time.field.OffsetDateTimeField",
"org.joda.time.field.DividedDateTimeField",
"org.joda.time.field.DecoratedDurationField",
"org.joda.time.field.ScaledDurationField",
"org.joda.time.field.RemainderDateTimeField",
"org.joda.time.chrono.GJEraDateTimeField",
"org.joda.time.chrono.GJDayOfWeekDateTimeField",
"org.joda.time.chrono.BasicDayOfMonthDateTimeField",
"org.joda.time.chrono.BasicDayOfYearDateTimeField",
"org.joda.time.chrono.BasicMonthOfYearDateTimeField",
"org.joda.time.chrono.GJMonthOfYearDateTimeField",
"org.joda.time.chrono.BasicWeekyearDateTimeField",
"org.joda.time.chrono.BasicWeekOfWeekyearDateTimeField",
"org.joda.time.field.UnsupportedDurationField",
"org.joda.time.chrono.GregorianChronology",
"org.joda.time.chrono.ISOYearOfEraDateTimeField",
"org.joda.time.chrono.ISOChronology",
"org.joda.time.format.DateTimeFormatterBuilder",
"org.joda.time.format.DateTimeFormatterBuilder$NumberFormatter",
"org.joda.time.format.DateTimeFormatterBuilder$PaddedNumber",
"org.joda.time.format.DateTimeFormatter",
"org.joda.time.format.DateTimeFormatterBuilder$CharacterLiteral",
"org.joda.time.format.DateTimeFormatterBuilder$Composite",
"org.joda.time.format.DateTimeFormatterBuilder$StringLiteral",
"org.joda.time.format.DateTimeFormatterBuilder$UnpaddedNumber",
"org.joda.time.format.DateTimeFormatterBuilder$Fraction",
"org.joda.time.format.DateTimeFormatterBuilder$TimeZoneOffset",
"org.joda.time.format.ISODateTimeFormat",
"org.joda.time.format.DateTimeFormatterBuilder$FixedNumber",
"org.joda.time.format.DateTimeFormatterBuilder$MatchingParser",
"org.joda.time.format.ISODateTimeFormat$Constants",
"org.joda.time.format.DateTimeFormat$1",
"org.joda.time.format.DateTimeFormat",
"org.joda.time.chrono.BasicSingleEraDateTimeField",
"org.joda.time.base.AbstractInstant",
"org.joda.time.Instant",
"org.joda.time.chrono.GJChronology",
"org.joda.time.field.DelegatedDateTimeField",
"org.joda.time.field.SkipDateTimeField",
"org.joda.time.chrono.JulianChronology",
"org.joda.time.chrono.BasicChronology$YearInfo",
"org.joda.time.field.FieldUtils",
"org.joda.time.chrono.GJChronology$CutoverField",
"org.joda.time.chrono.GJChronology$ImpreciseCutoverField",
"org.joda.time.chrono.GJChronology$LinkedDurationField",
"org.joda.time.field.SkipUndoDateTimeField",
"org.joda.time.base.AbstractDateTime",
"org.joda.time.base.BaseDateTime",
"org.joda.time.DateTime",
"org.joda.time.chrono.LimitChronology",
"org.joda.time.chrono.LimitChronology$LimitDurationField",
"org.joda.time.chrono.LimitChronology$LimitDateTimeField",
"org.joda.time.chrono.BuddhistChronology",
"org.joda.time.field.UnsupportedDateTimeField",
"org.joda.time.chrono.ZonedChronology",
"org.joda.time.chrono.ZonedChronology$ZonedDurationField",
"org.joda.time.chrono.ZonedChronology$ZonedDateTimeField",
"org.joda.time.chrono.BasicFixedMonthChronology",
"org.joda.time.chrono.EthiopicChronology",
"org.joda.time.chrono.CopticChronology",
"org.joda.time.base.BaseLocal",
"org.joda.time.LocalTime",
"org.joda.time.LocalDateTime",
"org.joda.time.tz.UTCProvider",
"org.joda.time.IllegalFieldValueException",
"org.joda.time.LocalDate",
"org.joda.time.base.AbstractPeriod",
"org.joda.time.base.BasePeriod$1",
"org.joda.time.base.BasePeriod",
"org.joda.time.PeriodType",
"org.joda.time.Period",
"org.joda.time.convert.ConverterManager",
"org.joda.time.convert.ConverterSet",
"org.joda.time.convert.AbstractConverter",
"org.joda.time.convert.ReadableInstantConverter",
"org.joda.time.convert.StringConverter",
"org.joda.time.convert.CalendarConverter",
"org.joda.time.convert.DateConverter",
"org.joda.time.convert.LongConverter",
"org.joda.time.convert.NullConverter",
"org.joda.time.convert.ReadablePartialConverter",
"org.joda.time.convert.ReadableDurationConverter",
"org.joda.time.convert.ReadableIntervalConverter",
"org.joda.time.convert.ReadablePeriodConverter",
"org.joda.time.convert.ConverterSet$Entry",
"org.joda.time.base.AbstractDuration",
"org.joda.time.base.BaseDuration",
"org.joda.time.Duration",
"org.joda.time.MutablePeriod",
"org.joda.time.base.BaseSingleFieldPeriod",
"org.joda.time.format.ISOPeriodFormat",
"org.joda.time.format.PeriodFormatterBuilder",
"org.joda.time.format.PeriodFormatterBuilder$Literal",
"org.joda.time.format.PeriodFormatterBuilder$FieldFormatter",
"org.joda.time.format.PeriodFormatterBuilder$SimpleAffix",
"org.joda.time.format.PeriodFormatterBuilder$Composite",
"org.joda.time.format.PeriodFormatterBuilder$Separator",
"org.joda.time.format.PeriodFormatter",
"org.joda.time.Days",
"org.joda.time.Minutes",
"org.joda.time.format.DateTimeParserBucket",
"org.joda.time.chrono.IslamicChronology$LeapYearPatternType",
"org.joda.time.chrono.IslamicChronology",
"org.joda.time.DateTimeZone$Stub",
"org.joda.time.chrono.StrictChronology",
"org.joda.time.field.StrictDateTimeField",
"org.joda.time.Seconds",
"org.joda.time.base.BasePartial",
"org.joda.time.YearMonth",
"org.joda.time.chrono.LenientChronology",
"org.joda.time.field.LenientDateTimeField",
"org.joda.time.DateTimeUtils$OffsetMillisProvider",
"org.joda.time.base.AbstractInterval",
"org.joda.time.base.BaseInterval",
"org.joda.time.Interval",
"org.joda.time.Hours",
"org.joda.time.MutableDateTime",
"org.joda.time.Weeks",
"org.joda.time.MutableInterval",
"org.joda.time.MonthDay",
"org.joda.time.format.DateTimeParserBucket$SavedState",
"org.joda.time.format.DateTimeFormatterBuilder$TimeZoneName",
"org.joda.time.format.DateTimeFormatterBuilder$TextField",
"org.joda.time.Months",
"org.joda.time.chrono.LimitChronology$LimitException",
"org.joda.time.field.AbstractReadableInstantFieldProperty",
"org.joda.time.LocalTime$Property",
"org.joda.time.Years",
"org.joda.time.DateTimeZone$1",
"org.joda.time.LocalDateTime$Property",
"org.joda.time.DateTimeUtils$FixedMillisProvider",
"org.joda.time.DateTime$Property",
"org.joda.time.chrono.GJLocaleSymbols",
"org.joda.time.format.DateTimeParserBucket$SavedField",
"org.joda.time.LocalDate$Property",
"org.joda.time.MutableDateTime$Property",
"org.joda.time.tz.CachedDateTimeZone$Info",
"org.joda.time.MonthDay$Property",
"org.joda.time.YearMonth$Property",
"org.joda.time.format.DateTimeFormatterBuilder$TwoDigitYear"
);
}
}
| [
"pderakhshanfar@serg2.ewi.tudelft.nl"
] | pderakhshanfar@serg2.ewi.tudelft.nl |
ad74685949e9d15e66aed41be22f7631c9ad3796 | 0609ef0346387be99787fea492f7502d8a8c89e2 | /src/com/yjy/edu/enterprise/basic/type/DecimalOperators.java | ecb287f6ef5a14ada6c64cde1c3aa56c4126b1de | [] | no_license | yaojiyuan/java_enterprise | a87a8b7e7504d0c44f324f7e0318650d4b1e05dd | 2a75a5a96fd57f959666d76b28db5f5726ab80aa | refs/heads/master | 2023-01-20T23:05:09.221124 | 2020-11-30T11:14:02 | 2020-11-30T11:14:02 | 259,807,197 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 938 | java | package com.yjy.edu.enterprise.basic.type;
public class DecimalOperators {
public static void main(String[] args) {
System.out.println("(23.5f + 15.6f):" + (23.5f + 15.6f));
System.out.println("(1.3434f + 2.55000001f):" + (1.3434f + 2.55000001f));
System.out.println("(1.1f * 5f):" + (1.1f * 5f));
System.out.println("(1.100012f * 5.33f):" + (1.100001f * 5.33f));
System.out.println("(1e308*10):" + 1e308 * 10);
System.out.println("(67.45/0f):" + (67.45 / 0f));
System.out.println("(0f/0f):" + (0f / 0f));
System.out.println("(1.3400000001f == 1.34f):" + (1.34f == 1.34f));
System.out.println("(NAN == NAN):" + (Float.NaN == Float.NaN));
System.out.println("((int)456.78):" + ((int) 456.78));
System.out.println("((int)-456.78):" + ((int) -456.78));
System.out.println("(1.2f%0.6f):" + (1.2f%0.6f));
System.out.println("(1.3f%0.6f):" + (1.3f%0.6f));
System.out.println("(-1.3f%0.6f):" + (-1.3f%0.6f));
}
}
| [
"sala223@msn.com"
] | sala223@msn.com |
f1f6787e6e34a71eab1c977835e6eaada46ca230 | dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9 | /data_defect4j/preprossed_method_corpus/Time/27/org/joda/time/Period_Period_450.java | 634e644cff7ef6568d7b70f116e88a40f1fc5c11 | [] | no_license | hvdthong/NetML | dca6cf4d34c5799b400d718e0a6cd2e0b167297d | 9bb103da21327912e5a29cbf9be9ff4d058731a5 | refs/heads/master | 2021-06-30T15:03:52.618255 | 2020-10-07T01:58:48 | 2020-10-07T01:58:48 | 150,383,588 | 1 | 1 | null | 2018-09-26T07:08:45 | 2018-09-26T07:08:44 | null | UTF-8 | Java | false | false | 2,659 | java |
org joda time
immut time period set durat field valu
time period divid number field hour second
field support defin period type periodtyp
standard period type support year month week dai
hour minut second milli
time period ad instant effect ad field turn
result take account daylight save time
ad time period dai dai daylight save start add
hour ensur time remain
behaviour link durat
definit period affect equal method period
dai equal period hour hour equal minut
period repres abstract definit time period
dai hour daylight
save boundari compar actual durat period convert
durat durat todur oper emphasis
result differ date choos
period thread safe immut provid period type periodtyp
standard period type periodtyp class suppli thread safe immut
author brian neill o'neil
author stephen colebourn
mutabl period mutableperiod
period
creat period interv endpoint standard
set field
param start instant startinst interv start millisecond
param end instant endinst interv end millisecond
param chrono chronolog mean iso zone
period start instant startinst end instant endinst chronolog chrono
start instant startinst end instant endinst chrono
| [
"hvdthong@gmail.com"
] | hvdthong@gmail.com |
c7bee851e67849ebabd228f3c058ae3484895b05 | 31dfd731b54d5ff0793be4fd8f07be434f5278a5 | /src/main/java/org/onetwo/ext/poi/excel/utils/TableRowMapper.java | f2e549ee82e35b5ec714c255be7347c7eaef2645 | [
"Apache-2.0"
] | permissive | oubayeung/onetw-poi | dd4342ca45e70fb9efa30356f8476132a0b255d9 | b0f6bd65163352c42b827ff773cef2d8ccbf660c | refs/heads/master | 2021-01-13T12:17:52.824660 | 2016-12-07T14:01:33 | 2016-12-07T14:01:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 691 | java | package org.onetwo.ext.poi.excel.utils;
import java.util.List;
public interface TableRowMapper<DATA, TABLE> {
public int getNumberOfRows(TABLE table);
// String getMapperName();
/******
* 读取标题行
* @param sheet
* @return
*/
public List<String> mapTitleRow(TABLE table);
// public CellValueConvertor getCellValueConvertor(String name);
/******
* 数据开始行号 0-based
* @return
*/
public int getDataRowStartIndex();
public DATA mapDataRow(TABLE sheet, List<String> names, int rowIndex);
/*public SSFRowMapper<T> register(String type, CellValueConvertor convertor);
public SSFRowMapper<T> register(Map<String, CellValueConvertor> convertors);*/
}
| [
"weishao.zeng@gmail.com"
] | weishao.zeng@gmail.com |
b093af94ae228aa1f251bff2473a0c438a22c2da | 774e3f434f9a61ea52874db821ef63e98342f527 | /backend_spring/src/main/java/com/forfresh/model/dto/kakaopay/KakaoPayReadyVO.java | 5dad22bbc85433a748cb40141e3f0efce8066417 | [] | no_license | Kwon-Nam-Boo/forFresh | 46ec92f5f9a9551c19da04510fdf205a6e52bd98 | cd3efe9e71650c74eb7e1f7cbaa3cb47b68052cd | refs/heads/master | 2023-01-30T19:25:37.741647 | 2020-12-14T14:32:29 | 2020-12-14T14:32:29 | 321,353,741 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 215 | java | package com.forfresh.model.dto.kakaopay;
import java.util.Date;
import lombok.Data;
@Data
public class KakaoPayReadyVO {
//response
private String tid, next_redirect_pc_url;
private Date created_at;
}
| [
"oks2238@gmail.com"
] | oks2238@gmail.com |
8b0d93ed66169e246499caa0a3265dacb9e3e3a3 | c81c2b0dddebacf7fb0f76f3c36973e4d336983b | /src/main/java/com/myspace/helloworld/Message.java | f1aca2cac6b226196b941c1892e6947804b2a718 | [] | no_license | esscott1/droolsdemo | b644de417bdc4b18275df8aaf71f4b9d4b3dc526 | 11bf96cc465517bc406ffe95497d63274219cbd5 | refs/heads/master | 2023-07-19T04:34:37.062998 | 2021-09-01T16:32:47 | 2021-09-01T16:32:47 | 393,428,958 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 707 | java | package com.myspace.helloworld;
/**
* This class was automatically generated by the data modeler tool.
*/
public class Message implements java.io.Serializable {
static final long serialVersionUID = 1L;
private int status;
private java.lang.String message;
public static final int HELLO = 0;
public static final int GOODBYE = 1;
public Message() {
}
public java.lang.String getMessage() {
return this.message;
}
public void setMessage(java.lang.String message) {
this.message = message;
}
public Message(java.lang.String message) {
this.message = message;
}
public int getStatus(){
return this.status;
}
public void setStatus(){
this.status = status;
}
} | [
""
] | |
31b319e57ede9259c92ceeb21f17c564cb6f8da1 | e1e5bd6b116e71a60040ec1e1642289217d527b0 | /H5/L2_Scripts_com/L2_Scripts_Revision_20720_2268/dist/gameserver/data/scripts/quests/_241_PossessorOfaPreciousSoul1.java | 897821a7b5a3ce2b2f7ec6963a6423c239b17d94 | [] | no_license | serk123/L2jOpenSource | 6d6e1988a421763a9467bba0e4ac1fe3796b34b3 | 603e784e5f58f7fd07b01f6282218e8492f7090b | refs/heads/master | 2023-03-18T01:51:23.867273 | 2020-04-23T10:44:41 | 2020-04-23T10:44:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,337 | java | package quests;
import l2s.commons.util.Rnd;
import l2s.gameserver.model.instances.NpcInstance;
import l2s.gameserver.model.quest.QuestState;
public class _241_PossessorOfaPreciousSoul1 extends QuestScript
{
private static final int LEGENG_OF_SEVENTEEN = 7587;
private static final int MALRUK_SUCCUBUS_CLAW = 7597;
private static final int ECHO_CRYSTAL = 7589;
private static final int FADED_POETRY_BOOK = 7588;
private static final int CRIMSON_MOSS = 7598;
private static final int MEDICINE = 7599;
private static final int VIRGILS_LETTER = 7677;
public _241_PossessorOfaPreciousSoul1()
{
super(PARTY_NONE, ONETIME);
addStartNpc(31739);
addTalkId(30753);
addTalkId(30754);
addTalkId(31042);
addTalkId(30692);
addTalkId(31742);
addTalkId(31744);
addTalkId(31336);
addTalkId(31743);
addTalkId(31740);
addKillId(21154);
addKillId(27113);
addKillId(20244);
addKillId(20245);
addKillId(21511);
addKillId(20669);
addQuestItem(new int[]{
LEGENG_OF_SEVENTEEN,
MALRUK_SUCCUBUS_CLAW,
FADED_POETRY_BOOK,
ECHO_CRYSTAL,
MEDICINE,
CRIMSON_MOSS
});
}
@Override
public String onEvent(String event, QuestState st, NpcInstance npc)
{
if(event.equalsIgnoreCase("31739-02.htm"))
{
st.setCond(1);
}
else if(event.equalsIgnoreCase("30753-02.htm"))
st.setCond(2);
else if(event.equalsIgnoreCase("30754-02.htm"))
st.setCond(3);
else if(event.equalsIgnoreCase("31739-04.htm"))
{
st.takeItems(LEGENG_OF_SEVENTEEN, -1);
st.setCond(5);
}
else if(event.equalsIgnoreCase("31042-02.htm"))
st.setCond(6);
else if(event.equalsIgnoreCase("31042-04.htm"))
{
st.takeItems(MALRUK_SUCCUBUS_CLAW, -1);
st.giveItems(ECHO_CRYSTAL, 1, false, false);
st.setCond(8);
}
else if(event.equalsIgnoreCase("31739-06.htm"))
{
st.takeItems(ECHO_CRYSTAL, -1);
st.setCond(9);
}
else if(event.equalsIgnoreCase("30692-02.htm"))
{
st.giveItems(FADED_POETRY_BOOK, 1, false, false);
st.setCond(10);
}
else if(event.equalsIgnoreCase("31739-08.htm"))
{
st.takeItems(FADED_POETRY_BOOK, -1);
st.setCond(11);
}
else if(event.equalsIgnoreCase("31742-02.htm"))
st.setCond(12);
else if(event.equalsIgnoreCase("31744-02.htm"))
st.setCond(13);
else if(event.equalsIgnoreCase("31336-02.htm"))
st.setCond(14);
else if(event.equalsIgnoreCase("31336-04.htm"))
{
st.takeItems(CRIMSON_MOSS, -1);
st.giveItems(MEDICINE, 1, false, false);
st.setCond(16);
}
else if(event.equalsIgnoreCase("31743-02.htm"))
{
st.takeItems(MEDICINE, -1);
st.setCond(17);
}
else if(event.equalsIgnoreCase("31742-04.htm"))
st.setCond(18);
else if(event.equalsIgnoreCase("31740-02.htm"))
st.setCond(19);
else if(event.equalsIgnoreCase("31740-04.htm"))
{
st.giveItems(VIRGILS_LETTER, 1, false, false);
st.addExpAndSp(263043, 0);
st.unset("cond");
st.finishQuest();
}
return event;
}
@Override
public String onTalk(NpcInstance npc, QuestState st)
{
if(!st.getPlayer().isSubClassActive())
return "31739-09.htm";
String htmltext = NO_QUEST_DIALOG;
int npcId = npc.getNpcId();
int cond = st.getCond();
if(npcId == 31739)
{
if(cond == 0)
{
if(st.getPlayer().getLevel() >= 50)
htmltext = "31739-01.htm";
else
htmltext = "31739-00.htm";
}
else if(cond == 1)
htmltext = "31739-02r.htm";
else if(cond == 4 && st.getQuestItemsCount(LEGENG_OF_SEVENTEEN) >= 1)
htmltext = "31739-03.htm";
else if(cond < 8 && st.getQuestItemsCount(ECHO_CRYSTAL) < 1)
htmltext = "31739-04r.htm";
else if(cond == 8 && st.getQuestItemsCount(ECHO_CRYSTAL) >= 1)
htmltext = "31739-05.htm";
else if(cond < 10 && st.getQuestItemsCount(FADED_POETRY_BOOK) < 1)
htmltext = "31739-06r.htm";
else if(cond == 10 && st.getQuestItemsCount(FADED_POETRY_BOOK) >= 1)
htmltext = "31739-07.htm";
else if(cond == 11)
htmltext = "31739-08r.htm";
}
else if(npcId == 30753)
{
if(cond == 1)
htmltext = "30753-01.htm";
else if(cond == 2)
htmltext = "30753-02r.htm";
}
else if(npcId == 30754)
{
if(cond == 2)
htmltext = "30754-01.htm";
else if(cond == 3 && st.getQuestItemsCount(LEGENG_OF_SEVENTEEN) < 1)
htmltext = "30754-02r.htm";
}
else if(npcId == 31042)
{
if(cond == 5)
htmltext = "31042-01.htm";
else if(cond == 6 && st.getQuestItemsCount(MALRUK_SUCCUBUS_CLAW) < 10)
htmltext = "31042-02r.htm";
else if(cond == 7 && st.getQuestItemsCount(MALRUK_SUCCUBUS_CLAW) >= 10)
htmltext = "31042-03.htm";
else if(cond == 8 && st.getQuestItemsCount(ECHO_CRYSTAL) >= 1)
htmltext = "31042-04r.htm";
else if(cond == 8 && st.getQuestItemsCount(ECHO_CRYSTAL) == 0)
{
st.giveItems(ECHO_CRYSTAL, 1, false, false);
htmltext = "31042-04r.htm";
}
}
else if(npcId == 30692)
{
if(cond == 9)
htmltext = "30692-01.htm";
else if(cond == 10)
htmltext = "30692-02r.htm";
}
else if(npcId == 31742)
{
if(cond == 11)
htmltext = "31742-01.htm";
else if(cond == 12)
htmltext = "31742-02r.htm";
else if(cond == 17)
htmltext = "31742-03.htm";
else if(cond >= 18)
htmltext = "31742-04r.htm";
}
else if(npcId == 31744)
{
if(cond == 12)
htmltext = "31744-01.htm";
}
else if(npcId == 31336)
{
if(cond == 13)
htmltext = "31336-01.htm";
else if(cond == 14 && st.getQuestItemsCount(CRIMSON_MOSS) < 5)
htmltext = "31336-02r.htm";
else if(cond == 15 && st.getQuestItemsCount(CRIMSON_MOSS) >= 5)
htmltext = "31336-03.htm";
else if(cond == 16 && st.getQuestItemsCount(MEDICINE) >= 1)
htmltext = "31336-04r.htm";
}
else if(npcId == 31743)
{
if(cond == 16 && st.getQuestItemsCount(MEDICINE) >= 1)
htmltext = "31743-01.htm";
}
else if(npcId == 31740)
{
if(cond == 18)
htmltext = "31740-01.htm";
else if(cond == 19)
htmltext = "31740-03.htm";
}
return htmltext;
}
@Override
public String onKill(NpcInstance npc, QuestState st)
{
if(!st.getPlayer().isSubClassActive())
return null;
int npcId = npc.getNpcId();
int cond = st.getCond();
if(cond == 3)
{
if(npcId == 21154 && Rnd.chance(10))
st.addSpawn(27113);
else if(npcId == 27113 && st.getQuestItemsCount(LEGENG_OF_SEVENTEEN) == 0)
{
st.giveItems(LEGENG_OF_SEVENTEEN, 1, false, false);
st.setCond(4);
st.playSound(SOUND_ITEMGET);
}
}
else if(cond == 6)
{
if((npcId == 20244 || npcId == 20245) && Rnd.chance(10))
{
if(st.getQuestItemsCount(MALRUK_SUCCUBUS_CLAW) <= 9)
st.giveItems(MALRUK_SUCCUBUS_CLAW, 1, true, true);
if(st.getQuestItemsCount(MALRUK_SUCCUBUS_CLAW) >= 10)
{
st.setCond(7);
}
else
st.playSound(SOUND_ITEMGET);
}
}
else if(cond == 14)
if(npcId == 20669 && Rnd.chance(10))
{
if(st.getQuestItemsCount(CRIMSON_MOSS) <= 4)
st.giveItems(CRIMSON_MOSS, 1, true, true);
if(st.getQuestItemsCount(CRIMSON_MOSS) >= 5)
{
st.setCond(15);
}
else
st.playSound(SOUND_ITEMGET);
}
return null;
}
} | [
"64197706+L2jOpenSource@users.noreply.github.com"
] | 64197706+L2jOpenSource@users.noreply.github.com |
8bd8d1ee82a138c0ae63a995b6e4a8e94f008d98 | 4ece41e6b83548b056fde44b61a546f766388701 | /modules/dummy/dummy-service-builder/dummy-service-builder-service/src/main/java/com/liferay/gs/test/service/impl/DummyServiceImpl.java | f6643a93af95b3880c36c098d01781db2cfb9f80 | [] | no_license | diegotomfurtado/lfrgs-test-framework | 0cd3bbbb3fd144dcb8c7f3c3adc872432f21ca3c | bc3717c6d59de17a260b2394bbce668aac32fade | refs/heads/master | 2020-03-24T23:40:41.384538 | 2018-12-04T22:05:14 | 2018-12-04T22:05:14 | 143,148,730 | 0 | 0 | null | 2018-08-01T11:46:33 | 2018-08-01T11:46:32 | null | UTF-8 | Java | false | false | 1,525 | java | /**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
package com.liferay.gs.test.service.impl;
import com.liferay.gs.test.service.base.DummyServiceBaseImpl;
/**
* The implementation of the dummy remote service.
*
* <p>
* All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy their definitions into the {@link com.liferay.gs.test.service.DummyService} interface.
*
* <p>
* This is a remote service. Methods of this service are expected to have security checks based on the propagated JAAS credentials because this service can be accessed remotely.
* </p>
*
* @author Brian Wing Shun Chan
* @see DummyServiceBaseImpl
* @see com.liferay.gs.test.service.DummyServiceUtil
*/
public class DummyServiceImpl extends DummyServiceBaseImpl {
/*
* NOTE FOR DEVELOPERS:
*
* Never reference this class directly. Always use {@link com.liferay.gs.test.service.DummyServiceUtil} to access the dummy remote service.
*/
} | [
"andrew.betts@liferay.com"
] | andrew.betts@liferay.com |
6d2db7fd0946f6442086082d08b3f7747ca1da9b | 60016285d6340245b4a847384d493aa4aa3e6a7a | /src/main/java/com/scalda/javales/config/Config.java | d806d3dcc1f4e972f8bdd9bd923d7285ae0f5621 | [
"MIT"
] | permissive | marc0tjevp/Animal-Kingdom | f86bb9d6f8eb4d174ce1bc97c6224bb9262063b0 | 596bcb95f64d29ebcf0bbf053189f82be6e31107 | refs/heads/master | 2021-06-16T14:34:32.688309 | 2017-03-24T10:01:14 | 2017-03-24T10:01:14 | 86,050,988 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,163 | java | package com.scalda.javales.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.view.JstlView;
import org.springframework.web.servlet.view.UrlBasedViewResolver;
@Configuration
@ComponentScan("com.scalda.javales")
@EnableWebMvc
public class Config extends WebMvcConfigurerAdapter {
@Bean
public UrlBasedViewResolver setupViewResolver() {
UrlBasedViewResolver resolver = new UrlBasedViewResolver();
resolver.setPrefix("/WEB-INF/jsp/");
resolver.setSuffix(".jsp");
resolver.setViewClass(JstlView.class);
return resolver;
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/resources/**").addResourceLocations("/resources/");
}
}
| [
"Marc0tjevp@gmail.com"
] | Marc0tjevp@gmail.com |
40eb18f2ca81c2be4e5b1cdbf692425568476038 | 425143ec1a1966558e123d80bc2a1b766834dd25 | /src/edu/gatech/cc/view/ShapeSurface.java | 9f5e8615aa5ee301559ccd3f5a57d81b4eeefff1 | [] | no_license | opmiss/Bending | 6989cd788f521e54069590fc22a604a3c7eae245 | b415cc6694a670a58e56f422e9fd6aa92e990c54 | refs/heads/master | 2021-01-23T11:02:22.645652 | 2014-10-20T21:17:52 | 2014-10-20T21:17:52 | 17,732,982 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,158 | java | package edu.gatech.cc.view;
import processing.core.PApplet;
import edu.gatech.cc.geo.v3d;
import edu.gatech.cc.geo.view;
import edu.gatech.cc.model.Surface;
import edu.gatech.cc.model.Shape3d;
public class ShapeSurface extends PApplet{
Shape3d S0 = new Shape3d(this);
Surface C0;
v3d[][] P;
boolean register = false;
boolean showobj = true;
public void setup() {
this.size(1280, 720, PApplet.P3D);
view.initView();
S0.declareVectors();
S0.loadMeshVTS(true, this);
S0 = S0.computeBox();
for (int i=0; i<3; i++) S0 = S0.refine();
P = new v3d[4][4];
for (int i=0; i<4; i++){
for (int j=0; j<4; j++){
P[i][j] = v3d.pt(S0.Wbox);
P[i][j].add((-0.9+i*0.6)*S0.rbox, view.J, (-0.9+j*0.6)*S0.rbox, view.I);
//P[i][j].print(i+", "+j); P[i][j].toScreen(this).print();
}
}
C0 = new Surface(P, 50);
textAlign(PApplet.LEFT, PApplet.TOP);
}
public void draw() {
background(255);
view.setupView(this);
fill(255,255, 0);
this.noStroke();
// scribe();
if (showobj) S0.showFront(this);
C0.show(this);
// this.sphere(30);
if (keyPressed && key=='r'&& mousePressed) {
view.rotate(this);
} // rotate E around F
else if (keyPressed && key=='z' && mousePressed){
view.zoom(this);
}
else if (keyPressed && key=='t' && mousePressed){
view.translate(this);
}
camera(); // 2D view to write help text
scribe();
}
public void scribe(){
this.textSize(32);
this.fill(0);
this.text("vol error: "+S0.volError(), 10, 10);
}
public void mouseDragged(){
if (keyPressed && key == 'p'){
C0.translate(this);
if (register) S0.transform(C0);
}
else{
C0.move(this);
if (register) S0.transform(C0);
}
}
public void mousePressed() {
C0.pick(this);
}
public void mouseReleased() {
C0.drop();
}
public void keyReleased() {
}
public void keyPressed() {
if (key=='s') {
S0.smoothen();
}
if (key=='f'){
S0.register(C0);
C0.saveFrames();
register = true;
}
if (key=='c'){
System.out.println("save a frame");
this.saveFrame("bunny_surface-####.png");
}
if (key==' '){
showobj = !showobj;
}
}
}
| [
"opmiss@gmail.com"
] | opmiss@gmail.com |
5debeb2cc1f70a898b3c571184ce4ecce344a3b9 | b4e1c36fecec3c653e60725e9a76f9133bbcd5a2 | /app/src/main/java/excelenta/edu/co/sanmateo/proyectocalculadora/MainActivity.java | 0b8e7c081ee7bf9b048ab0fb5f53e54f0843291f | [] | no_license | nayibjoan/ProyectoEducativo-CalculadoraAndroid | 933beb065c5c76563cde1076da2a157191a9de41 | 17ffa7474ce17589888ed5f78c9c984102f54a60 | refs/heads/master | 2022-03-15T01:24:06.883709 | 2019-11-18T12:58:23 | 2019-11-18T12:58:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,475 | java | package excelenta.edu.co.sanmateo.proyectocalculadora;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.text.InputType;
import android.view.MotionEvent;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
public class MainActivity extends AppCompatActivity {
private EditText txtTextoOperacion;
private Button btnButton0;
private Button btnButton1;
private Button btnButton2;
private Button btnButton3;
private Button btnButton4;
private Button btnButton5;
private Button btnButton6;
private Button btnButton7;
private Button btnButton8;
private Button btnButton9;
private Button btnButtonC;
private Button btnButtonNumMas;
private Button btnButtonNumMenos;
private Button btnButtonDivision;
private Button btnButtonMultiplica;
private Button btnButtonBorrar;
private Button btnButtonPunto;
private Button getBtnButtonNumIgual;
private ExpresionRegular expresionRegular;
private boolean clickSignoMas, clickSignoMenos, clickSignoMultiplica, clickSignoDivision, clickSeparadorDecimal;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
expresionRegular = new ExpresionRegular();
txtTextoOperacion = findViewById( R.id.txtOperacion );
txtTextoOperacion.setFocusable( true );
txtTextoOperacion.setFocusableInTouchMode( true );
txtTextoOperacion.setInputType( InputType.TYPE_NULL );
btnButton0 = findViewById(R.id.btnNum0 );
btnButton0.setOnClickListener( new View.OnClickListener(){
@Override
public void onClick(View v) {
String textAnterior = txtTextoOperacion.getText().toString();
txtTextoOperacion.setText(textAnterior + "0");
accionesAdionales( R.id.btnNum0 );
}
});
btnButton1 = findViewById( R.id.btnNum1 );
btnButton1.setOnClickListener( new View.OnClickListener(){
@Override
public void onClick(View v) {
String textAnterior = txtTextoOperacion.getText().toString();
txtTextoOperacion.setText(textAnterior + "1");
accionesAdionales( R.id.btnNum1 );
}
});
btnButton2 = findViewById( R.id.btnNum2 );
btnButton2.setOnClickListener( new View.OnClickListener(){
@Override
public void onClick(View v) {
String textAnterior = txtTextoOperacion.getText().toString();
txtTextoOperacion.setText(textAnterior + "2");
accionesAdionales( R.id.btnNum2 );
}
});
btnButton3 = findViewById( R.id.btnNum3 );
btnButton3.setOnClickListener( new View.OnClickListener(){
@Override
public void onClick(View v) {
String textAnterior = txtTextoOperacion.getText().toString();
txtTextoOperacion.setText(textAnterior + "3");
accionesAdionales( R.id.btnNum3 );
}
});
btnButton4 = findViewById( R.id.btnNum4 );
btnButton4.setOnClickListener( new View.OnClickListener(){
@Override
public void onClick(View v) {
String textAnterior = txtTextoOperacion.getText().toString();
txtTextoOperacion.setText(textAnterior + "4");
accionesAdionales( R.id.btnNum4 );
}
});
btnButton5 = findViewById( R.id.btnNum5 );
btnButton5.setOnClickListener( new View.OnClickListener(){
@Override
public void onClick(View v) {
String textAnterior = txtTextoOperacion.getText().toString();
txtTextoOperacion.setText(textAnterior + "5");
accionesAdionales( R.id.btnNum5 );
}
});
btnButton6 = findViewById( R.id.btnNum6 );
btnButton6.setOnClickListener( new View.OnClickListener(){
@Override
public void onClick(View v) {
String textAnterior = txtTextoOperacion.getText().toString();
txtTextoOperacion.setText(textAnterior + "6");
accionesAdionales( R.id.btnNum6 );
}
});
btnButton7 = findViewById( R.id.btnNum7 );
btnButton7.setOnClickListener( new View.OnClickListener(){
@Override
public void onClick(View v) {
String textAnterior = txtTextoOperacion.getText().toString();
txtTextoOperacion.setText(textAnterior + "7");
accionesAdionales( R.id.btnNum7 );
}
});
btnButton8 = findViewById( R.id.btnNum8 );
btnButton8.setOnClickListener( new View.OnClickListener(){
@Override
public void onClick(View v) {
String textAnterior = txtTextoOperacion.getText().toString();
txtTextoOperacion.setText(textAnterior + "8");
accionesAdionales( R.id.btnNum8 );
}
});
btnButton9 = findViewById( R.id.btnNum9 );
btnButton9.setOnClickListener( new View.OnClickListener(){
@Override
public void onClick(View v) {
String textAnterior = txtTextoOperacion.getText().toString();
txtTextoOperacion.setText(textAnterior + "9");
accionesAdionales( R.id.btnNum9 );
}
});
btnButtonC = findViewById( R.id.btnC );
btnButtonC.setOnClickListener( new View.OnClickListener(){
@Override
public void onClick(View v) {
txtTextoOperacion.setText("");
accionesAdionales( R.id.btnC );
}
});
btnButtonNumMas = findViewById( R.id.btnNumMas );
btnButtonNumMas.setOnClickListener( new View.OnClickListener(){
@Override
public void onClick(View v) {
String textAnterior = txtTextoOperacion.getText().toString();
//Si anteriormente he escrito algo
//Si existe alguna texto en mi componente EditText
if( textAnterior.trim().length() > 0 && clickSignoMas == false){
if( textAnterior.endsWith("*")
|| textAnterior.endsWith("/")
|| textAnterior.endsWith("-")){
textAnterior = textAnterior.substring(0, textAnterior.length() - 1);
txtTextoOperacion.setText( textAnterior );
}
txtTextoOperacion.setText(textAnterior + "+");
clickSignoMas = true;
accionesAdionales( R.id.btnNumMas);
}
}
});
btnButtonNumMenos = findViewById( R.id.btnNumMenos );
btnButtonNumMenos.setOnClickListener( new View.OnClickListener(){
@Override
public void onClick(View v) {
String textAnterior = txtTextoOperacion.getText().toString();
if( clickSignoMenos == false ){
if( textAnterior.endsWith("*")
|| textAnterior.endsWith("/")
|| textAnterior.endsWith("+")){
textAnterior = textAnterior.substring(0, textAnterior.length() - 1);
txtTextoOperacion.setText( textAnterior );
}
txtTextoOperacion.setText(textAnterior + "-");
clickSignoMenos = true;
accionesAdionales( R.id.btnNumMenos );
}
}
});
btnButtonDivision = findViewById( R.id.btnDivision );
btnButtonDivision.setOnClickListener( new View.OnClickListener(){
@Override
public void onClick(View v) {
String textAnterior = txtTextoOperacion.getText().toString();
//Si anteriormente he escrito algo
//Si existe alguna texto en mi componente EditText
if( textAnterior.trim().length() > 0 && clickSignoDivision == false){
if( textAnterior.endsWith("*")
|| textAnterior.endsWith("+")
|| textAnterior.endsWith("-")){
textAnterior = textAnterior.substring(0, textAnterior.length() - 1);
txtTextoOperacion.setText( textAnterior );
}
txtTextoOperacion.setText(textAnterior + "/");
clickSignoDivision = true;
accionesAdionales( R.id.btnDivision );
}
}
});
btnButtonMultiplica = findViewById( R.id.btnMultiplica );
btnButtonMultiplica.setOnClickListener( new View.OnClickListener(){
@Override
public void onClick(View v) {
String textAnterior = txtTextoOperacion.getText().toString();
//Si anteriormente he escrito algo
//Si existe alguna texto en mi componente EditText
if( textAnterior.trim().length() > 0 && clickSignoMultiplica == false){
if( textAnterior.endsWith("+")
|| textAnterior.endsWith("/")
|| textAnterior.endsWith("-")){
textAnterior = textAnterior.substring(0, textAnterior.length() - 1);
txtTextoOperacion.setText( textAnterior );
}
txtTextoOperacion.setText(textAnterior + "*");
clickSignoMultiplica = true;
accionesAdionales( R.id.btnMultiplica );
}
}
});
btnButtonBorrar = findViewById( R.id.btnBorrar );
btnButtonBorrar.setOnClickListener( new View.OnClickListener(){
@Override
public void onClick(View v) {
//123+5+8+4
String textAnterior = txtTextoOperacion.getText().toString();
if( textAnterior.length() > 0 ) {
String nuevaOperacion = textAnterior.substring(0, textAnterior.length() - 1);
txtTextoOperacion.setText( nuevaOperacion );
}
accionesAdionales( R.id.btnBorrar );
}
});
btnButtonPunto = findViewById( R.id.btnNumPunto );
btnButtonPunto.setOnClickListener( new View.OnClickListener(){
@Override
public void onClick(View v) {
String textAnterior = txtTextoOperacion.getText().toString();
if( clickSeparadorDecimal == false){
txtTextoOperacion.setText(textAnterior + ".");
clickSeparadorDecimal = true;
accionesAdionales( R.id.btnNumPunto );
}
}
});
getBtnButtonNumIgual = findViewById( R.id.btnNumIgual );
getBtnButtonNumIgual.setOnClickListener( new View.OnClickListener(){
@Override
public void onClick(View v) {
String textAnterior = txtTextoOperacion.getText().toString();
if( textAnterior.trim().length() > 0 ){
String resultado = expresionRegular.resolverFormula( textAnterior.trim() );
txtTextoOperacion.setText( resultado );
}
}
});
}
/**
*
* @param idBotonActual
*/
private void accionesAdionales( int idBotonActual ){
if( idBotonActual != R.id.btnNumMas ){
clickSignoMas = false;
}
if( idBotonActual != R.id.btnNumMenos ){
clickSignoMenos = false;
}
if( idBotonActual != R.id.btnMultiplica ){
clickSignoMultiplica = false;
}
if( idBotonActual != R.id.btnDivision ){
clickSignoDivision = false;
}
if( idBotonActual == R.id.btnNumMas
|| idBotonActual == R.id.btnNumMenos
|| idBotonActual == R.id.btnMultiplica
|| idBotonActual == R.id.btnDivision){
clickSeparadorDecimal = false;
}
}
}
| [
"mangelan03@gmail.com"
] | mangelan03@gmail.com |
40e9bd44ca6243630c4dab130a0d31b6c3aa5f02 | 38c4451ab626dcdc101a11b18e248d33fd8a52e0 | /identifiers/apache-ant-1.8.4/src/main/org/apache/tools/ant/taskdefs/optional/ssh/AbstractSshMessage.java | c9511376d10d344205869b56a87e22350122e685 | [] | no_license | habeascorpus/habeascorpus-data | 47da7c08d0f357938c502bae030d5fb8f44f5e01 | 536d55729f3110aee058ad009bcba3e063b39450 | refs/heads/master | 2020-06-04T10:17:20.102451 | 2013-02-19T15:19:21 | 2013-02-19T15:19:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,358 | java | org PACKAGE_IDENTIFIER false
apache PACKAGE_IDENTIFIER false
tools PACKAGE_IDENTIFIER false
ant PACKAGE_IDENTIFIER false
taskdefs PACKAGE_IDENTIFIER false
optional PACKAGE_IDENTIFIER false
ssh PACKAGE_IDENTIFIER false
com PACKAGE_IDENTIFIER false
jcraft PACKAGE_IDENTIFIER false
jsch PACKAGE_IDENTIFIER false
Channel TYPE_IDENTIFIER false
com PACKAGE_IDENTIFIER false
jcraft PACKAGE_IDENTIFIER false
jsch PACKAGE_IDENTIFIER false
ChannelExec TYPE_IDENTIFIER false
com PACKAGE_IDENTIFIER false
jcraft PACKAGE_IDENTIFIER false
jsch PACKAGE_IDENTIFIER false
JSchException TYPE_IDENTIFIER false
com PACKAGE_IDENTIFIER false
jcraft PACKAGE_IDENTIFIER false
jsch PACKAGE_IDENTIFIER false
Session TYPE_IDENTIFIER false
com PACKAGE_IDENTIFIER false
jcraft PACKAGE_IDENTIFIER false
jsch PACKAGE_IDENTIFIER false
ChannelSftp TYPE_IDENTIFIER false
com PACKAGE_IDENTIFIER false
jcraft PACKAGE_IDENTIFIER false
jsch PACKAGE_IDENTIFIER false
SftpProgressMonitor TYPE_IDENTIFIER false
java PACKAGE_IDENTIFIER false
io PACKAGE_IDENTIFIER false
IOException TYPE_IDENTIFIER false
java PACKAGE_IDENTIFIER false
io PACKAGE_IDENTIFIER false
OutputStream TYPE_IDENTIFIER false
java PACKAGE_IDENTIFIER false
io PACKAGE_IDENTIFIER false
InputStream TYPE_IDENTIFIER false
java PACKAGE_IDENTIFIER false
text PACKAGE_IDENTIFIER false
NumberFormat TYPE_IDENTIFIER false
org PACKAGE_IDENTIFIER false
apache PACKAGE_IDENTIFIER false
tools PACKAGE_IDENTIFIER false
ant PACKAGE_IDENTIFIER false
BuildException TYPE_IDENTIFIER false
AbstractSshMessage TYPE_IDENTIFIER true
ONE_SECOND VARIABLE_IDENTIFIER true
Session TYPE_IDENTIFIER false
session VARIABLE_IDENTIFIER true
verbose VARIABLE_IDENTIFIER true
LogListener TYPE_IDENTIFIER false
listener VARIABLE_IDENTIFIER true
LogListener TYPE_IDENTIFIER false
log METHOD_IDENTIFIER true
String TYPE_IDENTIFIER false
message VARIABLE_IDENTIFIER true
AbstractSshMessage METHOD_IDENTIFIER false
Session TYPE_IDENTIFIER false
session VARIABLE_IDENTIFIER true
session VARIABLE_IDENTIFIER false
AbstractSshMessage METHOD_IDENTIFIER false
verbose VARIABLE_IDENTIFIER true
Session TYPE_IDENTIFIER false
session VARIABLE_IDENTIFIER true
verbose VARIABLE_IDENTIFIER false
verbose VARIABLE_IDENTIFIER false
session VARIABLE_IDENTIFIER false
session VARIABLE_IDENTIFIER false
Channel TYPE_IDENTIFIER false
openExecChannel METHOD_IDENTIFIER true
String TYPE_IDENTIFIER false
command VARIABLE_IDENTIFIER true
JSchException TYPE_IDENTIFIER false
ChannelExec TYPE_IDENTIFIER false
channel VARIABLE_IDENTIFIER true
ChannelExec TYPE_IDENTIFIER false
session VARIABLE_IDENTIFIER false
openChannel METHOD_IDENTIFIER false
channel VARIABLE_IDENTIFIER false
setCommand METHOD_IDENTIFIER false
command VARIABLE_IDENTIFIER false
channel VARIABLE_IDENTIFIER false
ChannelSftp TYPE_IDENTIFIER false
openSftpChannel METHOD_IDENTIFIER true
JSchException TYPE_IDENTIFIER false
ChannelSftp TYPE_IDENTIFIER false
channel VARIABLE_IDENTIFIER true
ChannelSftp TYPE_IDENTIFIER false
session VARIABLE_IDENTIFIER false
openChannel METHOD_IDENTIFIER false
channel VARIABLE_IDENTIFIER false
sendAck METHOD_IDENTIFIER true
OutputStream TYPE_IDENTIFIER false
out VARIABLE_IDENTIFIER true
IOException TYPE_IDENTIFIER false
buf VARIABLE_IDENTIFIER true
buf VARIABLE_IDENTIFIER false
out VARIABLE_IDENTIFIER false
write METHOD_IDENTIFIER false
buf VARIABLE_IDENTIFIER false
out VARIABLE_IDENTIFIER false
flush METHOD_IDENTIFIER false
waitForAck METHOD_IDENTIFIER true
InputStream TYPE_IDENTIFIER false
in VARIABLE_IDENTIFIER true
IOException TYPE_IDENTIFIER false
BuildException TYPE_IDENTIFIER false
b VARIABLE_IDENTIFIER true
in VARIABLE_IDENTIFIER false
read METHOD_IDENTIFIER false
b VARIABLE_IDENTIFIER false
BuildException TYPE_IDENTIFIER false
b VARIABLE_IDENTIFIER false
StringBuffer TYPE_IDENTIFIER false
sb VARIABLE_IDENTIFIER true
StringBuffer TYPE_IDENTIFIER false
c VARIABLE_IDENTIFIER true
in VARIABLE_IDENTIFIER false
read METHOD_IDENTIFIER false
c VARIABLE_IDENTIFIER false
c VARIABLE_IDENTIFIER false
sb VARIABLE_IDENTIFIER false
append METHOD_IDENTIFIER false
c VARIABLE_IDENTIFIER false
c VARIABLE_IDENTIFIER false
in VARIABLE_IDENTIFIER false
read METHOD_IDENTIFIER false
b VARIABLE_IDENTIFIER false
BuildException TYPE_IDENTIFIER false
sb VARIABLE_IDENTIFIER false
toString METHOD_IDENTIFIER false
b VARIABLE_IDENTIFIER false
BuildException TYPE_IDENTIFIER false
sb VARIABLE_IDENTIFIER false
toString METHOD_IDENTIFIER false
BuildException TYPE_IDENTIFIER false
b VARIABLE_IDENTIFIER false
sb VARIABLE_IDENTIFIER false
toString METHOD_IDENTIFIER false
execute METHOD_IDENTIFIER true
IOException TYPE_IDENTIFIER false
JSchException TYPE_IDENTIFIER false
setLogListener METHOD_IDENTIFIER true
LogListener TYPE_IDENTIFIER false
aListener VARIABLE_IDENTIFIER true
listener VARIABLE_IDENTIFIER false
aListener VARIABLE_IDENTIFIER false
log METHOD_IDENTIFIER true
String TYPE_IDENTIFIER false
message VARIABLE_IDENTIFIER true
listener VARIABLE_IDENTIFIER false
log METHOD_IDENTIFIER false
message VARIABLE_IDENTIFIER false
logStats METHOD_IDENTIFIER true
timeStarted VARIABLE_IDENTIFIER true
timeEnded VARIABLE_IDENTIFIER true
totalLength VARIABLE_IDENTIFIER true
duration VARIABLE_IDENTIFIER true
timeEnded VARIABLE_IDENTIFIER false
timeStarted VARIABLE_IDENTIFIER false
ONE_SECOND VARIABLE_IDENTIFIER false
NumberFormat TYPE_IDENTIFIER false
format VARIABLE_IDENTIFIER true
NumberFormat TYPE_IDENTIFIER false
getNumberInstance METHOD_IDENTIFIER false
format VARIABLE_IDENTIFIER false
setMaximumFractionDigits METHOD_IDENTIFIER false
format VARIABLE_IDENTIFIER false
setMinimumFractionDigits METHOD_IDENTIFIER false
listener VARIABLE_IDENTIFIER false
log METHOD_IDENTIFIER false
format VARIABLE_IDENTIFIER false
format METHOD_IDENTIFIER false
duration VARIABLE_IDENTIFIER false
format VARIABLE_IDENTIFIER false
format METHOD_IDENTIFIER false
totalLength VARIABLE_IDENTIFIER false
duration VARIABLE_IDENTIFIER false
getVerbose METHOD_IDENTIFIER true
verbose VARIABLE_IDENTIFIER false
trackProgress METHOD_IDENTIFIER true
filesize VARIABLE_IDENTIFIER true
totalLength VARIABLE_IDENTIFIER true
percentTransmitted VARIABLE_IDENTIFIER true
percent VARIABLE_IDENTIFIER true
Math TYPE_IDENTIFIER false
round METHOD_IDENTIFIER false
Math TYPE_IDENTIFIER false
floor METHOD_IDENTIFIER false
totalLength VARIABLE_IDENTIFIER false
filesize VARIABLE_IDENTIFIER false
percent VARIABLE_IDENTIFIER false
percentTransmitted VARIABLE_IDENTIFIER false
filesize VARIABLE_IDENTIFIER false
percent VARIABLE_IDENTIFIER false
percent VARIABLE_IDENTIFIER false
System TYPE_IDENTIFIER false
out VARIABLE_IDENTIFIER false
println METHOD_IDENTIFIER false
System TYPE_IDENTIFIER false
out VARIABLE_IDENTIFIER false
print METHOD_IDENTIFIER false
percent VARIABLE_IDENTIFIER false
System TYPE_IDENTIFIER false
out VARIABLE_IDENTIFIER false
println METHOD_IDENTIFIER false
percent VARIABLE_IDENTIFIER false
System TYPE_IDENTIFIER false
out VARIABLE_IDENTIFIER false
println METHOD_IDENTIFIER false
System TYPE_IDENTIFIER false
out VARIABLE_IDENTIFIER false
print METHOD_IDENTIFIER false
percent VARIABLE_IDENTIFIER false
ProgressMonitor TYPE_IDENTIFIER false
monitor VARIABLE_IDENTIFIER true
SftpProgressMonitor TYPE_IDENTIFIER false
getProgressMonitor METHOD_IDENTIFIER true
monitor VARIABLE_IDENTIFIER false
monitor VARIABLE_IDENTIFIER false
ProgressMonitor TYPE_IDENTIFIER false
monitor VARIABLE_IDENTIFIER false
ProgressMonitor TYPE_IDENTIFIER true
SftpProgressMonitor TYPE_IDENTIFIER false
initFileSize VARIABLE_IDENTIFIER true
totalLength VARIABLE_IDENTIFIER true
percentTransmitted VARIABLE_IDENTIFIER true
init METHOD_IDENTIFIER true
op VARIABLE_IDENTIFIER true
String TYPE_IDENTIFIER false
src VARIABLE_IDENTIFIER true
String TYPE_IDENTIFIER false
dest VARIABLE_IDENTIFIER true
max VARIABLE_IDENTIFIER true
initFileSize VARIABLE_IDENTIFIER false
max VARIABLE_IDENTIFIER false
totalLength VARIABLE_IDENTIFIER false
percentTransmitted VARIABLE_IDENTIFIER false
count METHOD_IDENTIFIER true
len VARIABLE_IDENTIFIER true
totalLength VARIABLE_IDENTIFIER false
len VARIABLE_IDENTIFIER false
percentTransmitted VARIABLE_IDENTIFIER false
trackProgress METHOD_IDENTIFIER false
initFileSize VARIABLE_IDENTIFIER false
totalLength VARIABLE_IDENTIFIER false
percentTransmitted VARIABLE_IDENTIFIER false
end METHOD_IDENTIFIER true
getTotalLength METHOD_IDENTIFIER true
totalLength VARIABLE_IDENTIFIER false
| [
"pschulam@gmail.com"
] | pschulam@gmail.com |
49c580ba868324d89be142a923893ccd40b2f77f | eb0a0af62e2679e2fea8afb131f1ef51969b26f4 | /SocketSample/src/socketsample/impl/Hangman.java | fafce1f11efba1653ded4a9c926d3aa48ffa2b9a | [] | no_license | juanfer0002/PDP | d789cd07ab3e58cbd7dbfa7e1afb14c8fa5a6964 | 7a2ed926df61f0fe69022cd04c438b97ec92e3bc | refs/heads/master | 2020-05-04T19:19:29.959149 | 2019-07-25T01:05:28 | 2019-07-25T01:05:28 | 179,387,704 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,078 | 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 socketsample.impl;
import java.util.Arrays;
/**
*
* @author Juanfer
*/
public class Hangman {
private char[] word;
private char[] currentGuessing;
public Hangman(String word) {
if (word == null || word.trim().isEmpty()) {
throw new NotValidWord("Not word can't be empty or null");
}
this.word = word.trim().toLowerCase().toCharArray();
this.currentGuessing = new char[this.word.length];
Arrays.fill(this.currentGuessing, '-');
}
public void guess(char c) {
for (int i = 0; i < this.word.length; i++) {
this.currentGuessing[i] = this.word[i] == c ? c : this.currentGuessing[i];
}
}
public String getCurrentGuessing() {
return new String(currentGuessing);
}
public boolean isOver() {
return !new String(currentGuessing).contains("-");
}
}
| [
"juanfer0002@gmail.com"
] | juanfer0002@gmail.com |
2dd7c7e30eff57f5f1172ea8dd5d21236251cfea | 1c433decb55823aac414e087c46ff34644fc57dc | /Ramya'sJavaProject/src/com/collections/java/TreeSetTest.java | b305d737203c6b6ad784b60629bfc67f6984c937 | [] | no_license | kalluriramya/BasicJavaPrograms | 9542b941196682336fe2722f6596cf26cf7f13e5 | 73d1ece54976096f31a05f89ecc39595a59df621 | refs/heads/master | 2021-05-11T02:56:14.265184 | 2018-01-27T03:14:03 | 2018-01-27T03:14:03 | 117,898,468 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 580 | java | package com.collections.java;
import java.util.Iterator;
import java.util.TreeSet;
public class TreeSetTest {
public static void main(String[] args) {
TreeSet<String> ts= new TreeSet();
ts.add("Ramya");
ts.add("Suresh");
ts.add("Narmi");
ts.add("Gorri");
ts.add("Minnu");
System.out.println(ts);
System.out.println("Using Iterator, the contents of Tree set are: ");
Iterator<String> iterator= ts.iterator();
while(iterator.hasNext())
{
String element = (String) iterator.next();
System.out.println(element);
}
}
}
| [
"kalluri.ramya333@gmail.com"
] | kalluri.ramya333@gmail.com |
aad7571ccc21638aa565a4bc9eed5c4377ebc48d | ea5f85d8266f9c5e80e2b9518d9f79b3ca5a37d7 | /src/sample/Expressions/ExpressionFactory.java | 02831034fef2a21aaf4cfb36beb9f26f6fe8061e | [] | no_license | Cynnabarflower/CourseWork | 163f9d436614a5746ecb5449bf3cf058bacfecf5 | 7ea5d1582fc9bcd154994e55da8c5b35f6460283 | refs/heads/master | 2022-04-09T08:59:13.838603 | 2020-02-28T17:20:06 | 2020-02-28T17:20:06 | 231,903,854 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 41,622 | java | package sample.Expressions;
import sample.Main;
import sample.Pair;
import sample.UserSettings;
import sample.WrongExpressionException;
import java.util.*;
import java.util.stream.Collectors;
import static sample.WrongExpressionException.Type.INCORRECT_BRACKETS;
import static sample.WrongExpressionException.Type.OTHER;
public class ExpressionFactory {
/* public static Expression getExpression(char name) {
// not used
if (name >= '0' && name <= '9') {
return new Val(Double.parseDouble(""+name));
}
switch (name) {
case '+': return new Sum();
case '-': return new Pow.Sub(null, null);
case '*': return new Mul();
case '/': return new Div(null, null);
case '(': return new Bracket(true);
case ')': return new Bracket(false);
case '^': return new Pow(null, null);
default: return new Var(0, ""+name);
}
}*/
public static ArrayList<Expression> getExpressionTree(String inputString, ArrayList<Expression> vars, UserSettings userSettings) {
if (vars == null)
vars = new ArrayList<>();
ArrayList<Expression> expressions = new ArrayList<>();
inputString = inputString.replaceAll(" ", "");
String[] inputStrings = inputString.split(";");
for (String currentString : inputStrings) {
if (currentString.isEmpty()) {
continue;
}
try {
currentString = replaceComplexBrackets(currentString);
if (currentString.contains("=")) {
var parts = currentString.split("=");
if (parts.length != 2) {
throw new WrongExpressionException(WrongExpressionException.Type.INCORRECT_EQUALITY);
}
var left = getExpressionArray(parts[0], vars);
ArrayList<String> args = new ArrayList<>();
if (!(left.get(0) instanceof Var))
throw new WrongExpressionException(WrongExpressionException.Type.INCORRECT_NAME);
Var varExpression = (Var) left.get(0);
for (var j = 1; j < left.size(); j++) {
var childExpression = left.get(j);
if (childExpression.type == Expression.Type.VAR) {
childExpression.type = Expression.Type.FUNCTION;
childExpression.numberOfArgs = 1;
args.add(childExpression.name);
}
}
varExpression.type = Expression.Type.FUNCTION;
varExpression.argumentPosition = Expression.ArgumentPosition.RIGHT;
varExpression.numberOfArgs = args.size() + 1; // 1 extra for the foo expression
varExpression.setArgNames(args);
vars.add(varExpression);
var child = getExpressionTree(getExpressionArray(parts[1], vars));
/* var functionChildren = child.getChildren(Expression.Type.FUNCTION, new HashSet<>());
for (var functionChild : functionChildren) {
boolean contains = false;
for (var variable : vars) {
if (variable.equals(functionChild)) {
contains = true;
break;
}
if (!contains) {
}
}
}*/
varExpression.setChild(child, 0);
var reference = new Var("Reference", varExpression.getChild(0));
reference.setType(Expression.Type.REFERENCE);
varExpression.getChild(0).setExpression(new Var(varExpression.name, reference));
expressions.add(varExpression);
} else {
ArrayList<Expression> expressionsArray = getExpressionArray(currentString, vars);
var currentExpression = getExpressionTree(expressionsArray);
expressions.add(currentExpression);
}
} catch (WrongExpressionException e) {
Main.warnings.add(e);
e.printStackTrace();
}
}
ArrayList<Expression> expressionsToSet = new ArrayList<>();
for (Expression expression : expressions) {
if (expression.type == Expression.Type.EQUALITY) {
try {
expressionsToSet.add(expression.getChild(0).clone().setChild(expression.getChild(1).clone(), 0));
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}
;
} else {
expression.setExpressions(expressionsToSet);
}
}
for (var i = vars.size() - 1; i >= 0; i--) {
for (var j = 0; j < i; j++)
if (vars.get(i).name.equals(vars.get(j).name)) {
vars.remove(j);
j--;
i--;
}
}
for (var i = 0; i < expressions.size(); i++) {
for (var varExpression : vars) {
if (varExpression.getVars().isEmpty()) {
if (expressions.get(i).name.equals(varExpression.name)) {
expressions.set(i, varExpression.getChild(0));
} else {
expressions.get(i).replaceVar(varExpression);
}
} else {
expressions.get(i).setExpression(varExpression);
}
}
try {
System.out.println(expressions.get(i));
expressions.set(i, expressions.get(i));
} catch (Exception e) {
e.printStackTrace();
}
}
return expressions;
}
private static Expression getExpressionTree(ArrayList<Expression> expressionsArray) throws WrongExpressionException {
Stack<Expression> stack = new Stack<>();
ArrayList<Expression> postfixExpressions = new ArrayList<>();
for (int i = 0; i < expressionsArray.size(); i++) {
if (expressionsArray.get(i).type == Expression.Type.LEFT_BRACKET) {
int brackets = 1;
ArrayList<Expression> fooArgs = new ArrayList<>();
ArrayList<Expression> argParts = new ArrayList<>();
int j = i + 1;
while (brackets > 0) {
var currentArg = expressionsArray.get(j);
if (brackets == 1 && currentArg.type == Expression.Type.DIVIDER && currentArg.argumentPosition == Expression.ArgumentPosition.NONE) {
if (!argParts.isEmpty()) {
fooArgs.add(getExpressionTree(argParts));
argParts.clear();
}
} else {
if (currentArg.type == Expression.Type.LEFT_BRACKET) {
brackets++;
argParts.add(currentArg);
} else if (currentArg.type == Expression.Type.RIGHT_BRACKET) {
brackets--;
if (brackets > 0)
argParts.add(currentArg);
} else {
argParts.add(currentArg);
}
}
j++;
}
Expression foo = null;
boolean firstArg = true;
if (i > 0 && (expressionsArray.get(i - 1).argumentPosition == Expression.ArgumentPosition.RIGHT)) {
foo = expressionsArray.get(i - 1);
firstArg = true;
} else if (j < expressionsArray.size() && expressionsArray.get(j).argumentPosition == Expression.ArgumentPosition.LEFT) {
foo = expressionsArray.get(j);
firstArg = false;
} else {
if (argParts.size() > 2) {
var poly = getExpressionTree(argParts);
argParts.clear();
for (; j > i; j--)
expressionsArray.remove(i);
expressionsArray.add(i, new Bracket(true));
expressionsArray.add(i + 1, poly);
expressionsArray.add(i + 2, new Bracket(false));
}
continue;
}
if (!argParts.isEmpty()) {
fooArgs.add(getExpressionTree(argParts));
}
if (!fooArgs.isEmpty()) {
foo.addChildren(fooArgs);
if (foo.numberOfArgs > foo.getChildren().size()) {
if (!foo.fillExpressions()) {
throw new WrongExpressionException(WrongExpressionException.Type.WRONG_ARGS_QUAN, foo.toString());
}
} else if (foo.numberOfArgs < foo.getChildren().size()) {
throw new WrongExpressionException(WrongExpressionException.Type.WRONG_ARGS, foo.toString());
}
for (; j > i; j--)
expressionsArray.remove(i);
}
}
}
for (int i = 0; i < expressionsArray.size(); i++) {
Expression expression = expressionsArray.get(i);
if (expression.type == Expression.Type.VALUE || expression.type == Expression.Type.VAR) {
postfixExpressions.add(expression);
} else if (expression.numberOfArgs - expression.getChildren().size() == 1) {
if (expression.argumentPosition == Expression.ArgumentPosition.LEFT) {
postfixExpressions.add(expression);
} else if (expression.argumentPosition == Expression.ArgumentPosition.RIGHT) {
stack.push(expression);
} else if (expression.argumentPosition == Expression.ArgumentPosition.LEFT_AND_RIGHT) {
stack.push(expression);
} else {
throw new WrongExpressionException(WrongExpressionException.Type.WRONG_ARGS_QUAN, expression.toString());
}
} else if (expression.numberOfArgs - expression.getChildren().size() == 2) {
if (expression.argumentPosition == Expression.ArgumentPosition.LEFT_AND_RIGHT) {
while (!stack.empty()) {
if (((stack.peek().type == Expression.Type.FUNCTION && stack.peek().numberOfArgs == 1) || stack.peek().priority <= expression.priority)
&& stack.peek().type != Expression.Type.LEFT_BRACKET && stack.peek().type != Expression.Type.RIGHT_BRACKET) {
postfixExpressions.add(stack.pop());
} else {
break;
}
}
}
stack.push(expression);
} else if (expression.numberOfArgs - expression.getChildren().size() > 2) {
if (expression.argumentPosition == Expression.ArgumentPosition.RIGHT) {
stack.push(expression);
}
} else if (expression.type == Expression.Type.LEFT_BRACKET) {
stack.push(expression);
} else if (expression.type == Expression.Type.RIGHT_BRACKET) {
while (!stack.empty()) {
Expression temp = stack.pop();
if (temp.type == Expression.Type.LEFT_BRACKET) {
if (!stack.empty() &&
stack.peek().argumentPosition == Expression.ArgumentPosition.RIGHT) {
postfixExpressions.add(stack.pop());
}
break;
} else {
postfixExpressions.add(temp);
}
}
// postfixExpressions.add(new Bracket());
} else if (expression.type == Expression.Type.DIVIDER) {
if (expression.argumentPosition == Expression.ArgumentPosition.NONE)
while (!stack.empty() && stack.peek().type != Expression.Type.LEFT_BRACKET) {
postfixExpressions.add(stack.pop());
}
else {
postfixExpressions.add(expression);
}
} else {
postfixExpressions.add(expression);
}
}
while (!stack.empty()) {
postfixExpressions.add(stack.pop());
}
stack = new Stack();
for (int i = 0; i < postfixExpressions.size(); i++) {
Expression current = postfixExpressions.get(i);
try {
if (current.type == Expression.Type.FUNCTION) {
if (current.numberOfArgs - current.getChildren().size() > 1) {
Stack<Expression> args = new Stack<>();
int leftArgs = current.numberOfArgs - current.getChildren().size();
while (leftArgs > 0) {
if (stack.empty()) {
while (!args.isEmpty())
current.addChild(args.pop());
if (!current.fillExpressions()) {
throw new WrongExpressionException(WrongExpressionException.Type.WRONG_ARGS_QUAN, "(" + (current.numberOfArgs - leftArgs) + "/" + current.numberOfArgs + ") " + current.name);
} else {
break;
}
}
args.add(stack.pop());
leftArgs--;
}
while (!args.isEmpty())
current.addChild(args.pop());
stack.push(current);
} else if (current.numberOfArgs - current.getChildren().size() == 1) {
current.addChild(stack.pop());
stack.push(current);
} else {
stack.push(current);
}
} else if (current.type == Expression.Type.VALUE || current.type == Expression.Type.VAR) {
stack.push(current);
} else if (current.type == Expression.Type.EQUALITY) {
Expression right = stack.pop();
Expression left = stack.pop();
if (left.type != Expression.Type.VAR && left.type != Expression.Type.VALUE) {
throw new WrongExpressionException(WrongExpressionException.Type.INCORRECT_EQUALITY);
}
current.setChild(left, 0);
current.setChild(right, 1);
stack.push(current);
} else if (current.type == Expression.Type.DERIVATIVE) {
stack.push(stack.pop().getDerivative(current.getChild(0).name));
} else {
stack.push(current);
}
} catch (EmptyStackException e) {
throw new WrongExpressionException(WrongExpressionException.Type.WRONG_ARGS, current.toString());
}
}
var expressionToAdd = stack.pop();
if (expressionToAdd.type == Expression.Type.DIVIDER) {
ArrayList<Expression> points = new ArrayList<>();
points.add(expressionToAdd);
while (!stack.empty()) {
if (stack.peek().type == Expression.Type.DIVIDER) {
points.add(stack.pop());
} else {
throw new WrongExpressionException(WrongExpressionException.Type.OTHER, "Can\'t have points and expression in one line");
}
}
return getPolynom(points);//ExpressionFactory.optimize(getPolynom(points));
} else if (!stack.empty()) {
throw new WrongExpressionException(WrongExpressionException.Type.OPERATOR_MISSED, expressionToAdd.toString());
}
if (expressionToAdd.type == Expression.Type.EQUALITY) {
if (expressionToAdd.getChild(1).contains(expressionToAdd.getChild(0).name)) {
throw new WrongExpressionException(WrongExpressionException.Type.DUPLICATE_VAR_ASSIGNMENT, expressionToAdd.getChild(0).name);
}
} else {
/*if (expressionToAdd.contains(Expression.Type.EQUALITY)) {
throw new WrongExpressionException("Can only have one \"=\" in a sentence");
}*/
}
return expressionToAdd;
}
private static ArrayList<Expression> getExpressionArray(String s, ArrayList<Expression> vars) {
if (vars != null) {
vars.sort((s1, t1) -> t1.name.length() - s1.name.length());
} else {
vars = new ArrayList<>();
}
ArrayList<Expression> expressions = new ArrayList<>();
while (!s.isEmpty()) {
if (s.startsWith("log") && (s.length() == 3 || !Character.isAlphabetic(s.charAt(3)))) {
s = s.substring(3);
addExpression(expressions, new Log());
} else if (s.startsWith("ln") && (s.length() == 2 || !Character.isAlphabetic(s.charAt(2)))) {
s = s.substring(2);
addExpression(expressions, new Log(new Val(Math.E)));
} else if (s.startsWith("abs") && (s.length() == 3 || !Character.isAlphabetic(s.charAt(3)))) {
s = s.substring(3);
addExpression(expressions, new Abs());
} else if (s.startsWith("floor") && (s.length() == 5 || !Character.isAlphabetic(s.charAt(5)))) {
s = s.substring(5);
addExpression(expressions, new Floor());
} else if (s.startsWith("divider") && (s.length() == 7 || !Character.isAlphabetic(s.charAt(7)))) {
s = s.substring(7);
addExpression(expressions, new Divider(Expression.ArgumentPosition.RIGHT));
} else if (Character.isDigit(s.charAt(0))) {
StringBuilder str = new StringBuilder(s.charAt(0));
boolean frac = false;
while (!s.isEmpty() && (Character.isDigit(s.charAt(0)) || ((s.charAt(0) == '.')))) {
if (s.charAt(0) == '.') {
if (!frac) {
str.append(s.charAt(0));
frac = true;
}
} else {
str.append(s.charAt(0));
}
s = s.substring(1);
}
addExpression(expressions, new Val(Double.parseDouble(str.toString())));
} else {
boolean varFounded = false;
for (Expression varExpression : vars)
if (s.startsWith(varExpression.name) && (s.length() == varExpression.name.length() || !Character.isAlphabetic(s.charAt(varExpression.name.length())))) {
try {
addExpression(expressions, varExpression.clone());
} catch (CloneNotSupportedException e) {
e.printStackTrace();
//addExpression(expressions, new Var(0, varExpression.name));
}
s = s.substring(varExpression.name.length());
varFounded = true;
break;
}
if (!varFounded) {
char symb = s.charAt(0);
switch (symb) {
case '+':
addExpression(expressions, new Sum());
break;
case '-':
if (expressions.isEmpty() || expressions.get(expressions.size() - 1).type == Expression.Type.DIVIDER
|| expressions.get(expressions.size() - 1).type == Expression.Type.EQUALITY
|| expressions.get(expressions.size() - 1).type == Expression.Type.LEFT_BRACKET
|| (expressions.get(expressions.size() - 1).type == Expression.Type.FUNCTION) && expressions.get(expressions.size() - 1).argumentPosition == Expression.ArgumentPosition.LEFT_AND_RIGHT) {
if (s.length() > 1 && Character.isDigit(s.charAt(1))){
StringBuilder dig = new StringBuilder();
s = s.substring(1);
while (Character.isDigit(s.charAt(0)) || s.charAt(0) == '.') {
dig.append(s.charAt(0));
s = s.substring(1);
}
addExpression(expressions, new Val(-Double.parseDouble(dig.toString())));
continue;
} else
addExpression(expressions, new Mul(new Val(-1)));
} else {
addExpression(expressions, new Sub());
}
break;
case '*':
addExpression(expressions, new Mul());
break;
case '/':
addExpression(expressions, new Div());
break;
case '(':
addExpression(expressions, new Bracket(true));
break;
case ')':
addExpression(expressions, new Bracket(false));
break;
case '^':
addExpression(expressions, new Pow());
break;
case '=':
addExpression(expressions, new Equality());
break;
case ',':
addExpression(expressions, new Divider());
break;
case '\'':
addExpression(expressions, new Derivative());
break;
case '?':
addExpression(expressions, new Ternary());
break;
default:
StringBuilder varName = new StringBuilder();
while (Character.isAlphabetic(symb)) {
varName.append(symb);
s = s.substring(1);
if (s.isEmpty())
break;
symb = s.charAt(0);
}
var toAdd = new Var(varName.toString(), 0);
addExpression(expressions, toAdd);
if (s.startsWith("(")) {
addExpression(expressions, new Bracket(true));
int openBrackets = 1;
s = s.substring(1);
toAdd.setType(Expression.Type.FUNCTION);
toAdd.argumentPosition = Expression.ArgumentPosition.RIGHT;
int numberOfArgs = 0;
StringBuilder argBuilder = new StringBuilder();
while (openBrackets > 0) {
if (s.startsWith(")")) {
openBrackets--;
} else if (s.startsWith("(")) {
openBrackets++;
} else if (s.startsWith(",")) {
if (argBuilder.length() > 0) {
expressions.addAll(getExpressionArray(argBuilder.toString(), vars));
argBuilder = new StringBuilder();
numberOfArgs++;
}
} else {
argBuilder.append(s.charAt(0));
}
s = s.substring(1);
}
if (argBuilder.length() > 0) {
expressions.addAll(getExpressionArray(argBuilder.toString(), vars));
toAdd.numberOfArgs = numberOfArgs + 1;
}
addExpression(expressions, new Bracket(false));
}
//vars.add(new Var(0, varName.toString()));
continue;
}
s = s.substring(1);
}
}
}
return expressions;
}
;
private static void addExpression(ArrayList<Expression> expressions, Expression expression) {
if (expression.type == Expression.Type.LEFT_BRACKET && !expressions.isEmpty() && expressions.get(expressions.size() - 1).type == Expression.Type.RIGHT_BRACKET) {
expressions.add(new Mul());
}
expressions.add(expression);
}
private static String replaceComplexBrackets(String s) throws WrongExpressionException {
Stack<Character> brackets = new Stack();
StringBuilder formated = new StringBuilder();
int i = 0;
for (; i < s.length(); i++) {
char current = s.charAt(i);
if (current == '{' || current == '[' || current == '(') {
brackets.push(current);
formated.append(current);
} else if (current == '}') {
if (!brackets.empty() && brackets.peek() == '{') {
brackets.pop();
formated.insert(formated.lastIndexOf("{"), "divider(");
formated.deleteCharAt(formated.lastIndexOf("{"));
formated.append(")");
} else break;
} else if (!brackets.empty() && current == ']') {
if (brackets.peek() == '[') {
brackets.pop();
formated.insert(formated.lastIndexOf("["), "floor(");
formated.deleteCharAt(formated.lastIndexOf("["));
formated.append(")");
} else break;
} else if (!brackets.empty() && current == ')') {
if (brackets.peek() == '(') {
brackets.pop();
formated.append(current);
} else break;
} else if (current == '|') {
if (i == 0 || !(Character.isAlphabetic(s.charAt(i - 1)) || Character.isDigit(s.charAt(i - 1)))) {
brackets.push(current);
formated.append(current);
} else if (!brackets.empty() && brackets.peek() == '|') {
formated.insert(formated.lastIndexOf("|"), "abs(");
formated.deleteCharAt(formated.lastIndexOf("|"));
formated.append(")");
brackets.pop();
} else break;
} else {
formated.append(current);
}
}
if (i < s.length() - 1 || !brackets.isEmpty()) {
System.out.println("Incorrect brackets");
throw new WrongExpressionException(INCORRECT_BRACKETS, brackets.isEmpty() ? "" : " \'"+brackets.pop().toString()+"\'");
}
return formated.toString();
}
/*
public static Expression getPolynom(ArrayList<Double> xs, ArrayList<Double> ys) {
Expression mainExpression = new Val(0);
Expression expression = new Sub(new Var("x"), new Var("t"));
Expression expression2 = new Sub(new Var("x"), new Var("t"));
for (int i = 0; i < xs.size(); i++) {
Expression series = getSeries(expression, "t", xs, "*");
Expression temp = series;
while (temp != null &&
temp.rightExpression != null &&
temp.rightExpression.rightExpression != null) {
if (temp.rightExpression.rightExpression.val == xs.get(i)) {
temp.setRightExpression(new Val(1));
break;
}
temp = temp.leftExpression;
}
Expression series2 = getSeries(expression2, "t", xs, "*");
temp = series2;
while (temp != null && temp.rightExpression != null && temp.rightExpression.rightExpression != null) {
if (temp.rightExpression.rightExpression.val == xs.get(i)) {
temp.setRightExpression(new Val(1));
break;
}
temp = temp.leftExpression;
}
series2.setValue("x", xs.get(i)).replaceVar("x");
mainExpression = new Sum(mainExpression, new Mul(new Div(series, series2), new Val(ys.get(i))));
}
mainExpression.replaceVar("t");
return mainExpression;
}
*/
public static Expression getPolynom(ArrayList<Expression> points) throws WrongExpressionException {
boolean varIsUsed = false;
String varsToUse[] = {"x", "t","p", "u", "v", "q", "polynomArgument", "anotherPolynomArgument", "OneMorePolynomArgument"};
ArrayList<String> usedVars = new ArrayList<>();
for (Expression point : points) {
for (var point2 : points) {
if (point != point2 && point.getChild(0).equals(point2.getChild(0))) {
throw new WrongExpressionException(OTHER, "Incorrect polynom points");
}
}
usedVars.addAll(point.getVars());
}
usedVars = (ArrayList<String>) usedVars.stream().distinct().collect(Collectors.toList());
for (int i = 0; i < varsToUse.length; i++) {
varIsUsed = false;
for (String usedVar : usedVars) {
if (usedVar.equals(varsToUse[i])) {
varIsUsed = true;
break;
}
}
if (!varIsUsed) {
return getPolynom(points, varsToUse[i]);
}
}
throw new WrongExpressionException(OTHER, "Consider using different var names");
}
public static Expression getPolynom(ArrayList<Expression> points, String polynomVar) {
Expression mainExpression = new Val(0);
Expression expression = new Sub(new Var(polynomVar), new Var("polynomPar"));
Expression expression2 = new Sub(new Var(polynomVar), new Var("polynomPar"));
try {
for (int i = 0; i < points.size(); i++) {
ArrayList<Expression> copyPoints = new ArrayList<>();
for (int j = 0; j < i; j++) {
copyPoints.add(points.get(j).getChild(0).clone());
}
Expression series = getSeries(expression, "polynomPar", copyPoints, "*");
copyPoints = new ArrayList<>();
for (int j = i + 1; j < points.size(); j++) {
copyPoints.add(points.get(j).getChild(0).clone());
}
series = new Mul(series, getSeries(expression, "polynomPar", copyPoints, "*"));
copyPoints = new ArrayList<>();
for (int j = 0; j < i; j++) {
copyPoints.add(points.get(j).getChild(0).clone());
}
Expression series2 = getSeries(expression2, "polynomPar", copyPoints, "*");
copyPoints = new ArrayList<>();
for (int j = i + 1; j < points.size(); j++) {
copyPoints.add(points.get(j).getChild(0).clone());
}
series2 = new Mul(series2, getSeries(expression2, "polynomPar", copyPoints, "*"));
series2.setExpression(new Var(polynomVar, points.get(i).getChild(0)));
series2 = series2.replaceVar(polynomVar);
mainExpression = new Sum(mainExpression, new Mul(new Div(series, series2), points.get(i).getChild(1)));
}
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}
return mainExpression;
}
public static Expression getSeries(Expression expression, int from, int to, int step, String var, ArrayList<Expression> values, String operation) {
return getSeries(expression, from, to, step, var, values, operation.equals("*") ? new Mul() : operation.equals("+") ? new Sum() : new Sum());
}
public static Expression getSeries(Expression expression, int from, int to, int step, String var, ArrayList<Expression> values, Expression operation) {
if (var.isEmpty()) {
ArrayList<String> vars = expression.getVars();
if (vars.size() == 1) {
var = vars.get(0);
} else if (vars.size() == 0) {
} else {
for (String varName : vars) {
if (varName.equals("i") || varName.equals("n")) {
var = varName;
break;
}
}
}
}
if (values == null) {
values = new ArrayList<Expression>();
for (int i = from; i <= to; i++)
values.add(new Val(i));
to = to - from;
from = 0;
} else if (values.size() < from || values.size() < to) {
Main.showException("Error when making series");
return new Val(0);
}
Expression seriesExpression = null;
try {
seriesExpression = operation.clone();
} catch (CloneNotSupportedException e) {
e.printStackTrace();
Main.showException("Wrong series expression");
return new Val(0);
}
;
try {
for (; from <= to; from += step) {
Expression iterationExpression = expression.clone();
iterationExpression.setExpression(new Var(var, values.get(from)));
iterationExpression = iterationExpression.replaceVar(var);
seriesExpression.addChild(iterationExpression);
}
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}
;
if (seriesExpression.childExpressions.isEmpty()) {
if (seriesExpression.fillExpressions()) {
return seriesExpression;
}
Main.showException("Wrong series range");
return new Val(1);
} else if (seriesExpression.childExpressions.size() == 1) {
return seriesExpression.childExpressions.get(0);
}
return seriesExpression;
}
public static Expression getSeries(Expression expression, int depth, String var, String op) {
return getSeries(expression, 1, depth, 1, var, null, op);
}
public static Expression getSeries(Expression expression, int depth, String var, Expression op) {
return getSeries(expression, 1, depth, 1, var, null, op);
}
public static Expression getSeries(Expression expression, String var, ArrayList<Expression> values, String operation) {
return getSeries(expression, 0, values.size() - 1, 1, var, values, operation);
}
public static Expression optimize(Expression expression, UserSettings userSettings) {
var expression1 = expression;
for (int i = 0; i <= userSettings.getOptimizationLevel(); i++)
expression1 = optimize(open(expression1), userSettings, i, userSettings.needExtraOptimization());
return expression1;
}
private static Expression optimize(Expression expression, UserSettings userSettings, int level, boolean extra) {
int ops = expression.getExpressionCount(0);
int depth = expression.getMaxDepth(0);
int derivatives = expression.getChildren(Expression.Type.DERIVATIVE, new HashSet<>()).size() + (expression instanceof Derivative ? 1 : 0);
int depth1 = 0;
int ops1 = 0;
int derivatives1 = 0;
Expression toReturn = null;
Expression expression1 = expression.getOptimized(level);
ops1 = expression1.getExpressionCount(0);
depth1 = expression1.getMaxDepth(0);
derivatives1 = expression1.getChildren(Expression.Type.DERIVATIVE, new HashSet<>()).size() + (expression1 instanceof Derivative ? 1 : 0);
if (ops1 < ops || depth1 < depth || derivatives1 < derivatives) {
return optimize(expression1, userSettings, level, extra);
} else if (ops == ops1 && depth == depth1) {
toReturn = expression1;
ops = ops1;
derivatives = derivatives1;
depth = depth1;
} else {
toReturn = expression;
}
if (extra) {
var extraExpression = optimize(getExpressionTree(toReturn.toString(), userSettings.getExpressions(), userSettings).get(0), userSettings, level, false);
ops1 = extraExpression.getExpressionCount(0);
depth1 = extraExpression.getMaxDepth(0);
derivatives1 = extraExpression.getChildren(Expression.Type.DERIVATIVE, new HashSet<>()).size();
if (ops1 < ops || depth1 < depth || derivatives1 < derivatives) {
return optimize(extraExpression, userSettings, level, extra);
} else if (ops == ops1 && depth == depth1) {
return extraExpression;
} else {
return toReturn;
}
}
return toReturn;
}
public static Expression open(Expression expression) {
int depth = expression.getMaxDepth(0);
int ops = expression.getExpressionCount(0);
try {
Expression expression1 = expression.getOpen();
if (expression1.getMaxDepth(0) < depth || expression1.getExpressionCount(0) > ops) {
return open(expression1);
} else {
System.out.println("OPEN:");
System.out.println(expression);
return expression;
}
} catch (CloneNotSupportedException e) {
e.printStackTrace();
return null;
}
}
public static ArrayList<Pair<Double, Double>> getPoints(Expression expression, String varName, double from, double to, int minSize, double eps) {
double leng = Math.abs(to - from);
double step = leng / (minSize - 1);
Pair<Double, Double> pair;
int doubleAcc = 0;
ArrayList<Pair<Double, Double>> points = new ArrayList<>();
for (double i = 0; i < minSize || from <= to; i++) {
pair = new Pair<>(from, expression.getVal(new Var(varName, from)));
if (eps > 0 && !points.isEmpty() && !Double.isNaN(pair.value)) {
if (Math.abs(pair.value - points.get(points.size() - 1).value) > eps / step) {
if (doubleAcc < 3) {
i--;
step /= 2;
doubleAcc++;
continue;
}
} else if (doubleAcc > 0) {
doubleAcc--;
step *= 2;
}
}
points.add(pair);
from += step;
}
return points;
}
public static ArrayList<Pair<Double, Double>> getPoints(Expression expression, String varName, double from, double to, int minSize) {
return getPoints(expression, varName, from, to, minSize, 0);
}
public static ArrayList<Pair<Double, Double>> getPoints(ArrayList<Expression> expressions, String varName, double from, double to, int minSize, double eps) {
ArrayList<Pair<Double, Double>> points = new ArrayList<>();
for (Expression expression : expressions) {
points.addAll(getPoints(expression, varName, from, to, minSize, eps));
points.add(new Pair<>(Double.NaN, Double.NaN));
}
return points;
}
public static ArrayList<Pair<Double, Double>> getPoints(ArrayList<Expression> expressions, String varName, double from, double to) {
return getPoints(expressions, varName, from, to, Math.min((int) Math.abs(to - from), 50), 0);
}
}
| [
"Cinnabarflower@gmail.com"
] | Cinnabarflower@gmail.com |
e2075eef4468ff11342b6fcfbff1bfa7698bef81 | 944555ca306c140eff048442ba68aa269fc92875 | /src/com/nsc/dem/bean/system/TTemplete.java | e395c52b98b09cef5b80afcff284b138f38ebd63 | [] | no_license | Liuyangbiao/jyy | a1c2fdc36d4e0b15391346bfa14aeca07bbf362e | 68c188e4514bb0db66728c200b2d7fa1d32d2d99 | refs/heads/master | 2021-01-10T17:01:09.658749 | 2015-12-30T06:09:03 | 2015-12-30T06:09:03 | 48,788,028 | 30 | 31 | null | null | null | null | UTF-8 | Java | false | false | 2,014 | java | package com.nsc.dem.bean.system;
import java.util.Date;
import com.nsc.dem.bean.profile.TUser;
/**
* TTemplete entity. @author MyEclipse Persistence Tools
*/
@SuppressWarnings("serial")
public class TTemplete implements java.io.Serializable {
// Fields
private String name;
private TUser TUser;
private String description;
private String type;
private String path;
private Date uploadDate;
private String remark;
// Constructors
/** default constructor */
public TTemplete() {
}
/** minimal constructor */
public TTemplete(String name, TUser TUser, String description, String type,
String path, Date uploadDate) {
this.name = name;
this.TUser = TUser;
this.description = description;
this.type = type;
this.path = path;
this.uploadDate = uploadDate;
}
/** full constructor */
public TTemplete(String name, TUser TUser, String description, String type,
String path, Date uploadDate, String remark) {
this.name = name;
this.TUser = TUser;
this.description = description;
this.type = type;
this.path = path;
this.uploadDate = uploadDate;
this.remark = remark;
}
// Property accessors
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public TUser getTUser() {
return this.TUser;
}
public void setTUser(TUser TUser) {
this.TUser = TUser;
}
public String getDescription() {
return this.description;
}
public void setDescription(String description) {
this.description = description;
}
public String getType() {
return this.type;
}
public void setType(String type) {
this.type = type;
}
public String getPath() {
return this.path;
}
public void setPath(String path) {
this.path = path;
}
public Date getUploadDate() {
return this.uploadDate;
}
public void setUploadDate(Date uploadDate) {
this.uploadDate = uploadDate;
}
public String getRemark() {
return this.remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
} | [
"18612045235@163.com"
] | 18612045235@163.com |
aebb677dded4f6e9ec712f83011a4636494dc376 | d50d6334c4fac28047c1ba865947b3b1bd09d837 | /app/src/main/java/com/example/buildathon/MainActivity.java | 7df70bbc06d2f4f334f15e0cdcdafceb30120564 | [] | no_license | codebiet/Bencolite-s-Pannel | fafa8f6303d1809e211231d30dbef1f18957b3bb | b3026a3d49486bc3977662e8e3b30e32b32862fc | refs/heads/main | 2023-02-02T04:04:51.943635 | 2020-12-08T19:15:59 | 2020-12-08T19:15:59 | 319,724,555 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,031 | java | package com.example.buildathon;
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.core.view.GravityCompat;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.example.buildathon.Fragments.DiscussFragment;
import com.example.buildathon.Fragments.HomeFragment;
import com.example.buildathon.Fragments.ProfileFragment;
import com.example.buildathon.Fragments.SearchFragment;
import com.example.buildathon.Utils.LoadingBar;
import com.example.buildathon.Utils.SessionManagment;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.google.android.material.navigation.NavigationView;
import com.google.firebase.auth.FirebaseAuth;
import de.hdodenhof.circleimageview.CircleImageView;
import static com.example.buildathon.Utils.Constants.KEY_NAME;
import static com.example.buildathon.Utils.Constants.KEY_PROFILE_IMG;
import static com.example.buildathon.Utils.Constants.KEY_TITLE;
public class MainActivity extends AppCompatActivity {
LoadingBar loadingBar;
DrawerLayout drawerLayout;
ActionBarDrawerToggle actionBarDrawerToggle;
Fragment fragment = null;
Toolbar toolbar;
NavigationView navigationView;
BottomNavigationView bottomNavigationView;
SessionManagment sessionManagment;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
loadingBar = new LoadingBar(MainActivity.this);
setContentView(R.layout.activity_main);
toolbar=findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
drawerLayout=findViewById(R.id.drawerLayout);
sessionManagment = new SessionManagment(this);
navigationView=findViewById(R.id.nav_view);
View header = ((NavigationView) findViewById(R.id.nav_view)).getHeaderView(0);
CircleImageView imageView = header.findViewById(R.id.imgDrawerprofile);
TextView txtname = header.findViewById(R.id.txtDrawerName);
TextView txtTitle = header.findViewById(R.id.txtDrawerTitle);
if (sessionManagment.getUserDetails().get(KEY_PROFILE_IMG)!=null)
{
Glide.with(this).load(sessionManagment.getUserDetails().get(KEY_PROFILE_IMG)).into(imageView);
}
txtname.setText(sessionManagment.getUserDetails().get(KEY_NAME));
txtTitle.setText(sessionManagment.getUserDetails().get(KEY_TITLE));
navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
if (item.getItemId()==R.id.menu_logout)
{
if (drawerLayout.isDrawerOpen(GravityCompat.START))
drawerLayout.closeDrawer(GravityCompat.START);
loadingBar.show();
FirebaseAuth.getInstance().signOut();
sessionManagment.logoutSession();
startActivity(new Intent(getApplicationContext(),LoginActivity.class));
finish();
return true;
}
if (item.getItemId()==R.id.menu_post)
{
if (drawerLayout.isDrawerOpen(GravityCompat.START))
drawerLayout.closeDrawer(GravityCompat.START);
startActivity(new Intent(getApplicationContext(),MyPostActivity.class));
}
if (item.getItemId()==R.id.menu_liked)
{
if (drawerLayout.isDrawerOpen(GravityCompat.START))
drawerLayout.closeDrawer(GravityCompat.START);
startActivity(new Intent(getApplicationContext(),LikedPostsActivity.class));
}
return false;
}
});
actionBarDrawerToggle = new ActionBarDrawerToggle(this,drawerLayout,toolbar,R.string.open,R.string.close);
drawerLayout.addDrawerListener(actionBarDrawerToggle);
actionBarDrawerToggle.setDrawerIndicatorEnabled(true);
actionBarDrawerToggle.syncState();
bottomNavigationView = (BottomNavigationView)
findViewById(R.id.bottom_navigation);
if(savedInstanceState==null)
{
getSupportFragmentManager().beginTransaction().replace(R.id.container_fragment,new HomeFragment()).addToBackStack("home").commit();
}
bottomNavigationView.setOnNavigationItemSelectedListener(
new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_home:
getSupportFragmentManager().beginTransaction().replace(R.id.container_fragment,new HomeFragment()).addToBackStack("home").commit();
break;
case R.id.menu_search:
getSupportFragmentManager().beginTransaction().replace(R.id.container_fragment,new SearchFragment()).addToBackStack("search").commit();
break;
case R.id.menu_dash:
getSupportFragmentManager().beginTransaction().replace(R.id.container_fragment,new ProfileFragment()).addToBackStack("profile").commit();
break;
case R.id.menu_discuss:
getSupportFragmentManager().beginTransaction().replace(R.id.container_fragment,new DiscussFragment()).addToBackStack("discuss").commit();
break;
}
return true;
}
});
header.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (drawerLayout.isDrawerOpen(GravityCompat.START))
drawerLayout.closeDrawer(GravityCompat.START);
bottomNavigationView.setSelectedItemId(R.id.menu_dash);
getSupportFragmentManager().beginTransaction().replace(R.id.container_fragment,new ProfileFragment()).addToBackStack("profile").commit();
}
});
}
public void loadFragment(Fragment fm, Bundle args){
fm.setArguments(args);
FragmentManager fragmentManager = getSupportFragmentManager();
fragmentManager.beginTransaction().replace(R.id.container_fragment, fm)
.addToBackStack(null).commit();
HomeFragment home = new HomeFragment();
Log.e("frag_pos", String.valueOf(getSupportFragmentManager().getBackStackEntryCount()));
}
@Override
public void onBackPressed() {
super.onBackPressed();
}
@Override
protected void onStart() {
View header = navigationView.getHeaderView(0);
CircleImageView imageView = header.findViewById(R.id.imgDrawerprofile);
TextView txtname = header.findViewById(R.id.txtDrawerName);
TextView txtTitle = header.findViewById(R.id.txtDrawerTitle);
Glide.with(this).load(sessionManagment.getUserDetails().get(KEY_PROFILE_IMG)).into(imageView);
txtname.setText(sessionManagment.getUserDetails().get(KEY_NAME));
txtTitle.setText(sessionManagment.getUserDetails().get(KEY_TITLE));
super.onStart();
}
} | [
"yashchaturvedi10122000@gmail.com"
] | yashchaturvedi10122000@gmail.com |
32d3ebcacd03b6dbe017b4a6f16d8b3b497fd889 | 9b63d7f698de62eccb84b7854e40e69c791c4ed7 | /old_pos/app/src/main/java/com/gzdb/response/enums/PaymentTypeEnum.java | 84b2c643505f9895d795968df0602ba58999ee1d | [] | no_license | shuchongqj/one_pos | 8088fb8a53091c491ae68a73e8684f3374deb93e | d3c081d1a5b86f9a9b0fb249ab5574c6542711b5 | refs/heads/master | 2020-05-30T23:10:10.475413 | 2019-03-12T06:50:57 | 2019-03-12T06:50:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,362 | java | package com.gzdb.response.enums;
import java.util.HashMap;
import java.util.Map;
/**
* @author chinahuangxc on 2017/2/2.
*/
public enum PaymentTypeEnum {
/**
* UNKNOWN - 未知
*/
UNKNOWN(9999, "UNKNOWN", "未知"),
/**
* BALANCE - 余额
*/
BALANCE(10000, "BALANCE", "余额"),
/**
* VIP_BALANCE - 会员余额
*/
VIP_BALANCE(11000, "VIP_BALANCE", "会员余额"),
/**
* ALIPAY - 支付宝
*/
ALIPAY(20000, "ALIPAY", "支付宝"),
ALIPAY_JS(21000, "ALIPAY_JS", "支付宝"),
/**
* WEIXIN_NATIVE - 微信
*/
WEIXIN_NATIVE(30000, "WEIXIN_NATIVE", "微信"),
/**
* WEIXIN_JS - 微信公众号
*/
WEIXIN_JS(31000, "WEIXIN_JS", "微信公众号"),
/**
* DRAW_CASH - 提现
*/
DRAW_CASH(40000, "DRAW_CASH", "提现"),
//现金收款
CASH(50000, "CASH", "现金"),
//金融支付
NO1CREDIT(60000, "NO1CREDIT", "金融支付"),
NO1CREDIT_A(61000, "NO1CREDIT_A", "货到付款"),
NO1CREDIT_B(62000, "NO1CREDIT_B", "采购贷"),
// 红包
LUCKY_MONEY(70000, "LUCKY_MONEY", "红包"),
// 退款
REFUND(80000, "REFUND", "退款");
private int channelId;
private String key;
private String value;
PaymentTypeEnum(int channelId, String key, String value) {
this.channelId = channelId;
this.key = key;
this.value = value;
}
public int getChannelId() {
return channelId;
}
public String getKey() {
return key;
}
public String getValue() {
return value;
}
private static final Map<String, PaymentTypeEnum> PAYMENT_TYPE_ENUM_MAP = new HashMap<>();
static {
PaymentTypeEnum[] paymentTypeEnums = PaymentTypeEnum.values();
for (PaymentTypeEnum paymentTypeEnum : paymentTypeEnums) {
PAYMENT_TYPE_ENUM_MAP.put(paymentTypeEnum.getKey(), paymentTypeEnum);
}
}
public static PaymentTypeEnum getPaymentTypeEnum(String key) {
PaymentTypeEnum paymentTypeEnum = PAYMENT_TYPE_ENUM_MAP.get(key);
if (paymentTypeEnum == null) {
throw new IllegalArgumentException("支付类型异常,code : " + key);
}
return paymentTypeEnum;
}
@Override
public String toString() {
return key + " - " + value;
}
} | [
"javares@163.com"
] | javares@163.com |
b532af338107de16d78e52c78707f87fd9765579 | c885ef92397be9d54b87741f01557f61d3f794f3 | /results/JacksonDatabind-111/com.fasterxml.jackson.databind.deser.impl.FieldProperty/BBC-F0-opt-90/tests/30/com/fasterxml/jackson/databind/deser/impl/FieldProperty_ESTest.java | 1b6004aa5359b4f7c1cba745aa8128c5603d8e11 | [
"CC-BY-4.0",
"MIT"
] | permissive | pderakhshanfar/EMSE-BBC-experiment | f60ac5f7664dd9a85f755a00a57ec12c7551e8c6 | fea1a92c2e7ba7080b8529e2052259c9b697bbda | refs/heads/main | 2022-11-25T00:39:58.983828 | 2022-04-12T16:04:26 | 2022-04-12T16:04:26 | 309,335,889 | 0 | 1 | null | 2021-11-05T11:18:43 | 2020-11-02T10:30:38 | null | UTF-8 | Java | false | false | 1,349 | java | /*
* This file was automatically generated by EvoSuite
* Sat Oct 23 17:00:33 GMT 2021
*/
package com.fasterxml.jackson.databind.deser.impl;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.evosuite.runtime.EvoAssertions.*;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.deser.NullValueProvider;
import com.fasterxml.jackson.databind.deser.impl.FieldProperty;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true)
public class FieldProperty_ESTest extends FieldProperty_ESTest_scaffolding {
@Test(timeout = 4000)
public void test0() throws Throwable {
FieldProperty fieldProperty0 = null;
try {
fieldProperty0 = new FieldProperty((FieldProperty) null, (JsonDeserializer<?>) null, (NullValueProvider) null);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.fasterxml.jackson.databind.introspect.ConcreteBeanPropertyBase", e);
}
}
}
| [
"pderakhshanfar@serg2.ewi.tudelft.nl"
] | pderakhshanfar@serg2.ewi.tudelft.nl |
1998c088c80492e7e1dc0c6af225c37ae7e364b5 | 1c07dfaccd6fdf2083b361159d37838ea0858d69 | /src/main/java/com/deliveredtechnologies/shammer/pooling/SledgeHammerPoolAwareFactory.java | 7de3201e0f8aca859bcfe72913f60f92439191df | [] | no_license | Clayton7510/SledgeHammerCP | a9d88e3b72f279d9fe6c534756596aed55cd0cb4 | 413f5b7ef60124fa9af2548f869bce6e8f2ac79a | refs/heads/master | 2020-12-31T05:56:00.896315 | 2018-03-21T20:10:11 | 2018-03-21T20:10:11 | 80,625,747 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 430 | java | package com.deliveredtechnologies.shammer.pooling;
import org.apache.commons.pool2.PooledObjectFactory;
/**
* Created by clong on 1/29/17.
*/
public abstract class SledgeHammerPoolAwareFactory<T> implements PooledObjectFactory<T> {
private SledgeHammerPool<T> _pool = null;
protected void setPool(SledgeHammerPool<T> pool) {
_pool = pool;
}
protected SledgeHammerPool<T> getPool() { return _pool; }
}
| [
"Clayton7510@gmail.com"
] | Clayton7510@gmail.com |
802b4f4830feafdf6e561a69614168b168e38667 | 2a5989e5e39ba9543b809f611535230d0538987d | /PMFWeb/src/org/pmf/util/Pair.java | 44b1dc3d1d912685627b012416d84a145566c9c4 | [] | no_license | codedjw/PMF | 7d8d17c08c72a5d501e15b510ffdb14ecc9d6313 | e5b756fdf3a03801b6fb8add925bf7d314484219 | refs/heads/master | 2021-03-27T08:55:18.861698 | 2017-03-29T12:09:58 | 2017-03-29T12:09:58 | 32,617,520 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 932 | java | package org.pmf.util;
public class Pair<F, S> {
protected final S second;
protected final F first;
public Pair(F first, S second) {
this.first = first;
this.second = second;
}
public F getFirst() {
return first;
}
public S getSecond() {
return second;
}
private static boolean equals(Object x, Object y) {
return ((x == null) && (y == null)) || ((x != null) && x.equals(y));
}
@SuppressWarnings("unchecked")
@Override
public boolean equals(Object other) {
return (other instanceof Pair) && equals(first, ((Pair<F, S>) other).first)
&& equals(second, ((Pair<F, S>) other).second);
}
@Override
public int hashCode() {
if (first == null) {
return second == null ? 0 : second.hashCode() + 1;
} else {
return second == null ? first.hashCode() + 2 : first.hashCode() * 17 + second.hashCode();
}
}
@Override
public String toString() {
return "(" + first + "," + second + ")";
}
} | [
"jiaweidu.js@gmail.com"
] | jiaweidu.js@gmail.com |
ae168e50d71635d9048c1aed4d3e23e37d8f4e46 | d6b56658967b0614e27d7c2f4dd4d718bb5207df | /Apitesting/Tweeterserach.java | 2b714ee54e6c9e9e754f13651175605654aebe79 | [] | no_license | praveenbiradarpatil/APItesting | bf10c3697a8e8cbafcf5285d1dfe1c22924e867f | 2e9b524d96a66bc3159c75619f02518e30b36448 | refs/heads/master | 2020-08-16T16:50:50.256291 | 2019-10-26T04:21:28 | 2019-10-26T04:21:28 | 215,526,998 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,280 | java | package Api;
import static io.restassured.RestAssured.given;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import io.restassured.RestAssured;
import io.restassured.response.Response;
public class Tweeterserach {
Properties prop= new Properties();
@BeforeTest
public void start() throws IOException
{
FileInputStream fls= new FileInputStream("C:\\Users\\Online Test\\git\\APItesting\\Apitesting\\src\\data.properties");
prop.load(fls);
}
@Test
public void searchtweet()
{
String consumerKey = prop.getProperty("custermerKey");
String consumerSecret = prop.getProperty("cunsumerSecret");
String token = prop.getProperty("Token");
String tokenSecret = prop.getProperty("TokenSecret");
RestAssured.baseURI=prop.getProperty("twittersearch");
Response res=given().auth().oauth(consumerKey, consumerSecret, token, tokenSecret).
queryParam("q","#Qualitest").
when().get(resource.retweetResource()).then().extract().response();
String responce=res.asString();//to convert into string
System.out.println(responce);
}
} | [
"noreply@github.com"
] | praveenbiradarpatil.noreply@github.com |
a976122c7806fd67dbc8968367bf27c05a02c500 | 04355e028b59cdac7746d947931869ca3644b975 | /Week_01/FlowControlAndOpTest.java | d00a22cd2bdba2d1c141f1115bffa15d5b071103 | [] | no_license | solikego/JAVA-000 | 27bc8eb3b4173dcfcdd6bcd438d0768c57178700 | fb873bf437ce0b3899a2a3878affbef2fe640da2 | refs/heads/main | 2023-01-31T13:56:20.879747 | 2020-11-25T16:09:14 | 2020-11-25T16:09:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 783 | java | package jvm.week01.z4;
/**
* 第一课作业1
* @author deepin
*/
public class FlowControlAndOpTest {
public static void main(String[] args) {
int a = 5;
int b = 2;
int add = a + b;
int sub = a - b;
int mul = a * b;
int div = a / b;
int mod = a % b;
if (add % 2 != 0) {
add = add * 2;
}
int loopSum = 0;
for (int i = 0; i < add; i++) {
loopSum += i;
}
System.out.println("a:" + a);
System.out.println("b:" + b);
System.out.println("sub:" + sub);
System.out.println("mul:" + mul);
System.out.println("div:" + div);
System.out.println("mod:" + mod);
System.out.println("loopSum:" + loopSum);
}
}
| [
"solike_club@sina.com"
] | solike_club@sina.com |
e1b46df938c64a07dc57f4c8ac7eec06fcaad1d0 | 2f69f04db0c3da10a496df7b62d6f6288e8e944b | /shoppingcart/shoppingcart-admin/src/main/java/com/ecommerce/admin/web/controllers/CategoryController.java | d49305c1ced251f573143c3cd61eb7e4a4bec14c | [] | no_license | jaheersoft/shoppingcartapp | b70fa2ee79e1fbb7489e653a3e1d43b2d5ad9b2d | 0aee2c38415659f010ba4905ad806ab073e671e2 | refs/heads/master | 2021-07-08T13:26:56.388391 | 2020-02-20T14:45:30 | 2020-02-20T14:45:30 | 241,529,435 | 0 | 0 | null | 2021-04-26T19:58:17 | 2020-02-19T04:05:57 | HTML | UTF-8 | Java | false | false | 3,271 | java | /**
*
*/
package com.ecommerce.admin.web.controllers;
import java.util.List;
import javax.validation.Valid;
import com.ecommerce.admin.web.security.SecurityUtil;
import com.ecommerce.core.service.CatalogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.annotation.Secured;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.ecommerce.admin.web.validators.CategoryValidator;
import com.ecommerce.core.entities.Category;
/**
* @author Siva
*
*/
@Controller
@Secured(SecurityUtil.MANAGE_CATEGORIES)
@Slf4j
public class CategoryController extends SCartAdminBaseController
{
private static final String viewPrefix = "categories/";
@Autowired
private CatalogService catalogService;
@Autowired private CategoryValidator categoryValidator;
@Override
protected String getHeaderTitle()
{
return "Manage Categories";
}
@RequestMapping(value="/categories", method=RequestMethod.GET)
public String listCategories(Model model) {
List<Category> list = catalogService.getAllCategories();
model.addAttribute("categories",list);
return viewPrefix+"categories";
}
@RequestMapping(value="/categories/new", method=RequestMethod.GET)
public String createCategoryForm(Model model) {
Category category = new Category();
model.addAttribute("category",category);
return viewPrefix+"create_category";
}
@RequestMapping(value="/categories", method=RequestMethod.POST)
public String createCategory(@Valid @ModelAttribute("category") Category category, BindingResult result,
Model model, RedirectAttributes redirectAttributes) {
categoryValidator.validate(category, result);
if(result.hasErrors()){
return viewPrefix+"create_category";
}
Category persistedCategory = catalogService.createCategory(category);
log.debug("Created new category with id : {} and name : {}", persistedCategory.getId(), persistedCategory.getName());
redirectAttributes.addFlashAttribute("info", "Category created successfully");
return "redirect:/categories";
}
@RequestMapping(value="/categories/{id}", method=RequestMethod.GET)
public String editCategoryForm(@PathVariable Integer id, Model model) {
Category category = catalogService.getCategoryById(id);
model.addAttribute("category",category);
return viewPrefix+"edit_category";
}
@RequestMapping(value="/categories/{id}", method=RequestMethod.POST)
public String updateCategory(Category category, Model model, RedirectAttributes redirectAttributes) {
Category persistedCategory = catalogService.updateCategory(category);
log.debug("Updated category with id : {} and name : {}", persistedCategory.getId(), persistedCategory.getName());
redirectAttributes.addFlashAttribute("info", "Category updated successfully");
return "redirect:/categories";
}
}
| [
"Jaheer@host.docker.internal"
] | Jaheer@host.docker.internal |
12f07f8d36e75cdf007199c5b04a9092b41451bc | 86cd9738da28da50e357e0b7ed49ae00e83abfb0 | /src/main/java/rikka/api/util/DiscreteTransform3.java | 33aa16bea0e705fc831652591c70318c9b463b49 | [
"MIT"
] | permissive | Himmelt/Rikka | 000ba0c575463bef4af542334be25ae4131adfa6 | ddb3b6741edc0572c025fa8b8d3273785ff32012 | refs/heads/master | 2020-03-12T14:52:53.706274 | 2018-06-26T07:14:35 | 2018-06-26T07:14:35 | 130,678,362 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 22,703 | java | /*
* This file is part of SpongeAPI, licensed under the MIT License (MIT).
*
* Copyright (c) SpongePowered <https://www.spongepowered.org>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package rikka.api.util;
import com.flowpowered.math.GenericMath;
import com.flowpowered.math.imaginary.Quaterniond;
import com.flowpowered.math.matrix.Matrix3d;
import com.flowpowered.math.matrix.Matrix4d;
import com.flowpowered.math.vector.Vector2i;
import com.flowpowered.math.vector.Vector3d;
import com.flowpowered.math.vector.Vector3i;
import com.flowpowered.math.vector.Vector4d;
import com.google.common.base.Preconditions;
import java.util.Arrays;
import java.util.Optional;
/**
* Represents a transform. It is 3 dimensional and discrete.
* It will never cause aliasing.
*
* <p>Rotations are performed around block centers unless
* the block corner flags are set to true. To prevent
* aliasing, quarter turn rotations are only legal on
* block centers or corners. Half turns can be performed
* additionally on edge and face centers.</p>
*/
public class DiscreteTransform3 {
/**
* Represents an identity transformation. Does nothing!
*/
public static final DiscreteTransform3 IDENTITY = new DiscreteTransform3(Matrix4d.IDENTITY);
private final Matrix4d matrix;
private final Vector4d matrixRow0;
private final Vector4d matrixRow1;
private final Vector4d matrixRow2;
private DiscreteTransform3(Matrix4d matrix) {
this.matrix = matrix;
this.matrixRow0 = matrix.getRow(0);
this.matrixRow1 = matrix.getRow(1);
this.matrixRow2 = matrix.getRow(2);
}
/**
* Returns the matrix representation of the transform.
* It is 4D to allow it to include a translation.
*
* @return The matrix for this transform
*/
public Matrix4d getMatrix() {
return this.matrix;
}
/**
* Transforms a vector using this transforms.
*
* @param vector The original vector
* @return The transformed vector
*/
public Vector3i transform(Vector3i vector) {
return transform(vector.getX(), vector.getY(), vector.getZ());
}
/**
* Transform a vector represented as a pair of
* coordinates using this transform.
*
* @param x The x coordinate of the original vector
* @param y The y coordinate of the original vector
* @param z The z coordinate of the original vector
* @return The transformed vector
*/
public Vector3i transform(int x, int y, int z) {
return new Vector3i(transformX(x, y, z), transformY(x, y, z), transformZ(x, y, z));
}
/**
* Transforms the x coordinate of a vector
* using this transform. Only creates a new
* object on the first call.
*
* @param vector The original vector
* @return The transformed x coordinate
*/
public int transformX(Vector3i vector) {
return transformX(vector.getX(), vector.getY(), vector.getZ());
}
/**
* Transforms the x coordinate of a vector
* using this transform. Only creates a new
* object on the first call.
*
* @param x The x coordinate of the original vector
* @param y The y coordinate of the original vector
* @param z The z coordinate of the original vector
* @return The transformed x coordinate
*/
public int transformX(int x, int y, int z) {
return GenericMath.floor(this.matrixRow0.dot(x, y, z, 1) + GenericMath.FLT_EPSILON);
}
/**
* Transforms the y coordinate of a vector
* using this transform. Only creates a new
* object on the first call.
*
* @param vector The original vector
* @return The transformed y coordinate
*/
public int transformY(Vector3i vector) {
return transformY(vector.getX(), vector.getY(), vector.getZ());
}
/**
* Transforms the y coordinate of a vector
* using this transform. Only creates a new
* object on the first call.
*
* @param x The x coordinate of the original vector
* @param y The y coordinate of the original vector
* @param z The z coordinate of the original vector
* @return The transformed y coordinate
*/
public int transformY(int x, int y, int z) {
return GenericMath.floor(this.matrixRow1.dot(x, y, z, 1) + GenericMath.FLT_EPSILON);
}
/**
* Transforms the z coordinate of a vector
* using this transform. Only creates a new
* object on the first call.
*
* @param vector The original vector
* @return The transformed z coordinate
*/
public int transformZ(Vector3i vector) {
return transformZ(vector.getX(), vector.getY(), vector.getZ());
}
/**
* Transforms the z coordinate of a vector
* using this transform. Only creates a new
* object on the first call.
*
* @param x The x coordinate of the original vector
* @param y The y coordinate of the original vector
* @param z The z coordinate of the original vector
* @return The transformed z coordinate
*/
public int transformZ(int x, int y, int z) {
return GenericMath.floor(this.matrixRow2.dot(x, y, z, 1) + GenericMath.FLT_EPSILON);
}
/**
* Inverts the transform and returns it as a new transform.
*
* @return The inverse of this transform
*/
public DiscreteTransform3 invert() {
return new DiscreteTransform3(this.matrix.invert());
}
/**
* Returns a transform that is the composition of this transform and the
* given transform. The result will apply this transformation after the
* given one.
*
* @param that The transform to compose with
* @return The new composed transform
*/
public DiscreteTransform3 compose(DiscreteTransform3 that) {
return new DiscreteTransform3(this.matrix.mul(that.matrix));
}
/**
* Returns a transform that is the composition of the given transform with
* this transform. The result will apply the given transformation after this
* one.
*
* @param that The transform to compose with
* @return The new composed transform
*/
public DiscreteTransform3 andThen(DiscreteTransform3 that) {
return that.compose(this);
}
/**
* Adds a translation to this transform and returns
* it as a new transform.
*
* @param vector The translation vector
* @return The translated transform as a copy
*/
public DiscreteTransform3 withTranslation(Vector3i vector) {
return withTranslation(vector.getX(), vector.getY(), vector.getZ());
}
/**
* Adds a translation to this transform and returns
* it as a new transform.
*
* @param x The x coordinate of the translation
* @param y The y coordinate of the translation
* @param z The z coordinate of the translation
* @return The translated transform as a copy
*/
public DiscreteTransform3 withTranslation(int x, int y, int z) {
return new DiscreteTransform3(this.matrix.translate(x, y, z));
}
/**
* Adds a scale factor to this transform and returns
* it as a new transform. This factor must be non-zero.
*
* @param a The scale factor
* @return The scaled transform as a copy
*/
public DiscreteTransform3 withScale(int a) {
return withScale(a, a, a);
}
/**
* Adds a scale factor for each axis to this transform
* and returns it as a new transform. The factors must
* be non-zero.
*
* @param vector The scale vector
* @return The scaled transform as a copy
*/
public DiscreteTransform3 withScale(Vector3i vector) {
return withScale(vector.getX(), vector.getY(), vector.getZ());
}
/**
* Adds a scale factor for each axis to this transform
* and returns it as a new transform. The factors must
* be non-zero.
*
* @param x The scale factor on x
* @param y The scale factor on y
* @param z The scale factor on z
* @return The scaled transform as a copy
*/
public DiscreteTransform3 withScale(int x, int y, int z) {
Preconditions.checkArgument(x != 0, "x == 0");
Preconditions.checkArgument(y != 0, "y == 0");
Preconditions.checkArgument(z != 0, "z == 0");
return new DiscreteTransform3(this.matrix.scale(x, y, z, 1));
}
/**
* Adds a rotation to this transform, around an axis,
* around the origin and returns it as a new transform.
* The rotation is given is quarter turns.
* The actual rotation is {@code quarterTurns * 90}.
* The rotation is around the block center, not the corner.
*
* @param quarterTurns The number of quarter turns in this rotation
* @param axis The axis to rotate around
* @return The rotated transform as a copy
*/
public DiscreteTransform3 withRotation(int quarterTurns, Axis axis) {
return new DiscreteTransform3(this.matrix.rotate(Quaterniond.fromAngleDegAxis(quarterTurns * 90, axis.toVector3d())));
}
/**
* Adds a a rotation to this transform, around an axis,
* around a given point, and returns it as a new transform.
* The rotation is given is quarter turns. The actual rotation
* is {@code quarterTurns * 90}. The block corner flag changes
* the point to be the block upper corner instead of the center.
*
* @param quarterTurns The number of quarter turns in this rotation
* @param axis The axis to rotate around
* @param point The point of rotation, as block coordinates
* @param blockCorner Whether or not to use the corner of the block
* instead of the center
* @return The rotated transform as a copy
*/
public DiscreteTransform3 withRotation(int quarterTurns, Axis axis, Vector3i point, boolean blockCorner) {
Vector3d pointDouble = point.toDouble();
if (blockCorner) {
pointDouble = pointDouble.add(0.5, 0.5, 0.5);
}
return new DiscreteTransform3(
this.matrix.translate(pointDouble.negate()).rotate(Quaterniond.fromAngleDegAxis(quarterTurns * 90, axis.toVector3d()))
.translate(pointDouble));
}
/**
* Adds a a rotation to this transform, around an axis,
* around a given point. The rotation is given is half turns.
* The actual rotation is {@code halfTurns * 180}. The block corner
* flags change the point to be the block corner or edge instead
* of the center. When all flags are false, the center is used.
* When only one is true the face traversed by the axis of flag is used.
* When two are true the edge in the direction of the remaining flag
* is used. When all are true the upper corner is used.
*
* @param halfTurns The number of half turns in this rotation
* @param axis The axis to rotate around
* @param point The point of rotation, as block coordinates
* @param blockCornerX Whether or not to use the corner of the block
* instead of the center on the x axis
* @param blockCornerY Whether or not to use the corner of the block
* instead of the center on the y axis
* @param blockCornerZ Whether or not to use the corner of the block
* instead of the center on the z axis
* @return The rotated transform as a copy
*/
public DiscreteTransform3 withRotation(int halfTurns, Axis axis, Vector3i point, boolean blockCornerX, boolean blockCornerY,
boolean blockCornerZ) {
Vector3d pointDouble = point.toDouble();
if (blockCornerX) {
pointDouble = pointDouble.add(0.5, 0, 0);
}
if (blockCornerY) {
pointDouble = pointDouble.add(0, 0.5, 0);
}
if (blockCornerZ) {
pointDouble = pointDouble.add(0, 0, 0.5);
}
return new DiscreteTransform3(
this.matrix.translate(pointDouble.negate()).rotate(Quaterniond.fromAngleDegAxis(halfTurns * 180, axis.toVector3d()))
.translate(pointDouble));
}
/**
* Adds another transformation to this transformation and
* returns int as a new transform.
*
* @param transform The transformation to add
* @return The added transforms as a copy
*/
public DiscreteTransform3 withTransformation(DiscreteTransform3 transform) {
return new DiscreteTransform3(transform.getMatrix().mul(getMatrix()));
}
/**
* Returns a new transform from the given transformation matrix, if the
* resulting transform would be discrete.
*
* @param matrix The matrix to use for the transform
* @return The new transform, or {@link Optional#empty()}
*/
public static Optional<DiscreteTransform3> of(Matrix4d matrix) {
if (Arrays.stream(matrix.toArray())
.anyMatch(value -> Math.rint(value) != value)) {
return Optional.empty();
}
return Optional.of(new DiscreteTransform3(matrix));
}
/**
* Returns a new transform representing a translation.
*
* @param vector The translation vector
* @return The new translation transform
*/
public static DiscreteTransform3 fromTranslation(Vector3i vector) {
return fromTranslation(vector.getX(), vector.getY(), vector.getZ());
}
/**
* Returns a new transform representing a translation.
*
* @param x The x coordinate of the translation
* @param y The y coordinate of the translation
* @param z The z coordinate of the translation
* @return The new translation transform
*/
public static DiscreteTransform3 fromTranslation(int x, int y, int z) {
return new DiscreteTransform3(Matrix4d.createTranslation(x, y, z));
}
/**
* Returns a new transform representing a scaling.
* The scale factor must be non-zero.
*
* @param a The scale factor
* @return The new scale transform
*/
public static DiscreteTransform3 fromScale(int a) {
return fromScale(a, a, a);
}
/**
* Returns a new transform representing a scaling on each axis.
* The scale factors must be non-zero.
*
* @param vector The scale vector
* @return The new scale transform
*/
public static DiscreteTransform3 fromScale(Vector3i vector) {
return fromScale(vector.getX(), vector.getY(), vector.getZ());
}
/**
* Returns a new transform representing a scaling on each axis.
* The scale factors must be non-zero.
*
* @param x The scale factor on x
* @param y The scale factor on y
* @param z The scale factor on z
* @return The new scale transform
*/
public static DiscreteTransform3 fromScale(int x, int y, int z) {
Preconditions.checkArgument(x != 0, "x == 0");
Preconditions.checkArgument(y != 0, "y == 0");
Preconditions.checkArgument(z != 0, "z == 0");
return new DiscreteTransform3(Matrix4d.createScaling(x, y, z, 1));
}
/**
* Returns a new transform representing a rotation around an
* axis around the origin. The rotation is given is quarter turns.
* The actual rotation is {@code quarterTurns * 90}.
* The rotation is around the block center, not the corner.
*
* @param quarterTurns The number of quarter turns in this rotation
* @param axis The axis to rotate around
* @return The new rotation transform
*/
public static DiscreteTransform3 fromRotation(int quarterTurns, Axis axis) {
return new DiscreteTransform3(Matrix4d.createRotation(Quaterniond.fromAngleDegAxis(quarterTurns * 90, axis.toVector3d())));
}
/**
* Returns a new transform representing a rotation around an axis,
* around a given point. The rotation is given is quarter turns.
* The actual rotation is {@code quarterTurns * 90}. The block corner
* flag change the point to be the block corner instead of the center.
*
* @param quarterTurns The number of quarter turns in this rotation
* @param axis The axis to rotate around
* @param point The point of rotation, as block coordinates
* @param blockCorner Whether or not to use the corner of the block
* instead of the center
* @return The new rotation transform
*/
public static DiscreteTransform3 fromRotation(int quarterTurns, Axis axis, Vector3i point, boolean blockCorner) {
Vector3d pointDouble = point.toDouble();
if (blockCorner) {
pointDouble = pointDouble.add(0.5, 0.5, 0.5);
}
return new DiscreteTransform3(Matrix4d.createTranslation(pointDouble.negate()).rotate(Quaterniond.fromAngleDegAxis(quarterTurns * 90, axis
.toVector3d())).translate(pointDouble));
}
/**
* Returns a new transform representing a rotation around an axis,
* around a given point. The rotation is given in half turns.
* The actual rotation is {@code halfTurns * 180}. When all flags are
* false, the center is used. When only one is true the face traversed
* by the axis of flag is used. When two are true the edge in the
* direction of the remaining flag is used. When all are true the
* upper corner is used.
*
* @param halfTurns The number of half turns in this rotation
* @param axis The axis to rotate around
* @param point The point of rotation, as block coordinates
* @param blockCornerX Whether or not to use the corner of the block
* instead of the center on the x axis
* @param blockCornerY Whether or not to use the corner of the block
* instead of the center on the y axis
* @param blockCornerZ Whether or not to use the corner of the block
* instead of the center on the z axis
* @return The new rotation transform
*/
public static DiscreteTransform3 fromRotation(int halfTurns, Axis axis, Vector3i point, boolean blockCornerX, boolean blockCornerY,
boolean blockCornerZ) {
Vector3d pointDouble = point.toDouble();
if (blockCornerX) {
pointDouble = pointDouble.add(0.5, 0, 0);
}
if (blockCornerY) {
pointDouble = pointDouble.add(0, 0.5, 0);
}
if (blockCornerZ) {
pointDouble = pointDouble.add(0, 0, 0.5);
}
return new DiscreteTransform3(
Matrix4d.createTranslation(pointDouble.negate()).rotate(Quaterniond.fromAngleDegAxis(halfTurns * 180, axis.toVector3d())).translate(
pointDouble));
}
/**
* Returns a new transform representing a centered rotation of an volume
* of blocks. The rotation is given is quarter turns. The actual rotation
* is {@code quarterTurns * 90}. Volumes with differing parities on the
* axes can only be rotated by multiples of 180 degrees.
*
* @param quarterTurns The amount of quarter turns in this rotation
* @param axis Axis for rotation
* @param size The size of the volume to rotate
* @return The new rotation transform
*/
public static DiscreteTransform3 rotationAroundCenter(int quarterTurns, Axis axis, Vector3i size) {
Preconditions.checkArgument(size.getX() > 0, "The size on x must be positive");
Preconditions.checkArgument(size.getY() > 0, "The size on y must be positive");
Preconditions.checkArgument(size.getZ() > 0, "The size on z must be positive");
final Matrix4d rotation3;
switch (axis) {
case X: {
final Matrix3d rotation2 = DiscreteTransform2.rotationAroundCenter(quarterTurns, new Vector2i(size.getZ(), size.getY())).getMatrix();
rotation3 = new Matrix4d(
1, 0, 0, 0,
0, rotation2.get(1, 0), rotation2.get(1, 1), rotation2.get(1, 2),
0, rotation2.get(0, 0), rotation2.get(0, 1), rotation2.get(0, 2),
0, 0, 0, 1
);
break;
}
case Y: {
final Matrix3d rotation2 = DiscreteTransform2.rotationAroundCenter(quarterTurns, new Vector2i(size.getX(), size.getZ())).getMatrix();
rotation3 = new Matrix4d(
rotation2.get(0, 0), 0, rotation2.get(0, 1), rotation2.get(0, 2),
0, 1, 0, 0,
rotation2.get(1, 0), 0, rotation2.get(1, 1), rotation2.get(1, 2),
0, 0, 0, 1
);
break;
}
case Z: {
final Matrix3d rotation2 = DiscreteTransform2.rotationAroundCenter(quarterTurns, new Vector2i(size.getX(), size.getY())).getMatrix();
rotation3 = new Matrix4d(
rotation2.get(0, 0), rotation2.get(0, 1), 0, rotation2.get(0, 2),
rotation2.get(1, 0), rotation2.get(1, 1), 0, rotation2.get(1, 2),
0, 0, 1, 0,
0, 0, 0, 1
);
break;
}
default:
throw new UnsupportedOperationException(axis.name());
}
return new DiscreteTransform3(rotation3);
}
}
| [
"master@void-3.cn"
] | master@void-3.cn |
46a8cae7fe68c42e8d7b5fa376f98dbf6983674f | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/18/18_d3b715ea75cf069b99f3947b8a5d26e889b6309c/PreferencesEditor/18_d3b715ea75cf069b99f3947b8a5d26e889b6309c_PreferencesEditor_t.java | 97d68cf7d299109908d1088f46cb66a34d20104b | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 154,323 | java | /*
* Copyright (c) 2007-2011 by The Broad Institute, Inc. and the Massachusetts Institute of
* Technology. All Rights Reserved.
*
* This software is licensed under the terms of the GNU Lesser General Public License (LGPL),
* Version 2.1 which is available at http://www.opensource.org/licenses/lgpl-2.1.php.
*
* THE SOFTWARE IS PROVIDED "AS IS." THE BROAD AND MIT MAKE NO REPRESENTATIONS OR
* WARRANTES OF ANY KIND CONCERNING THE SOFTWARE, EXPRESS OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
* PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, WHETHER
* OR NOT DISCOVERABLE. IN NO EVENT SHALL THE BROAD OR MIT, OR THEIR RESPECTIVE
* TRUSTEES, DIRECTORS, OFFICERS, EMPLOYEES, AND AFFILIATES BE LIABLE FOR ANY DAMAGES
* OF ANY KIND, INCLUDING, WITHOUT LIMITATION, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
* ECONOMIC DAMAGES OR INJURY TO PROPERTY AND LOST PROFITS, REGARDLESS OF WHETHER
* THE BROAD OR MIT SHALL BE ADVISED, SHALL HAVE OTHER REASON TO KNOW, OR IN FACT
* SHALL KNOW OF THE POSSIBILITY OF THE FOREGOING.
*/
package org.broad.igv.ui;
import java.awt.*;
import java.awt.event.*;
import javax.swing.border.*;
import com.jidesoft.dialog.*;
import com.jidesoft.swing.*;
import org.broad.igv.PreferenceManager;
import org.broad.igv.feature.ProbeToLocusMap;
import org.broad.igv.batch.CommandListener;
import org.broad.igv.ui.legend.LegendDialog;
import org.broad.igv.ui.util.MessageUtils;
import org.broad.igv.util.IGVHttpUtils;
import org.broad.igv.util.Utilities;
import javax.swing.*;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import org.jdesktop.layout.GroupLayout;
import org.jdesktop.layout.LayoutStyle;
/**
* @author jrobinso
*/
public class PreferencesEditor extends javax.swing.JDialog {
private boolean canceled = false;
Map<String, String> updatedPreferenceMap = new HashMap();
PreferenceManager prefMgr = PreferenceManager.getInstance();
boolean updateOverlays = false;
boolean inputValidated = true;
private static int lastSelectedIndex = 0;
boolean proxySettingsChanged;
public PreferencesEditor(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
initValues();
tabbedPane.setSelectedIndex(lastSelectedIndex);
setLocationRelativeTo(parent);
}
/**
* 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.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
// Generated using JFormDesigner non-commercial license
private void initComponents() {
tabbedPane = new JTabbedPane();
generalPanel = new JPanel();
jPanel10 = new JPanel();
missingDataExplanation = new JLabel();
showMissingDataCB = new JCheckBox();
combinePanelsCB = new JCheckBox();
joinSegmentsCB = new JCheckBox();
showAttributesDisplayCheckBox = new JCheckBox();
searchZoomCB = new JCheckBox();
missingDataExplanation6 = new JLabel();
zoomToFeatureExplanation = new JLabel();
label4 = new JLabel();
geneListFlankingField = new JTextField();
zoomToFeatureExplanation2 = new JLabel();
searchZoomCB3 = new JCheckBox();
searchZoomCB2 = new JCheckBox();
label5 = new JLabel();
label6 = new JLabel();
seqResolutionThreshold = new JTextField();
tracksPanel = new JPanel();
jPanel6 = new JPanel();
jLabel5 = new JLabel();
defaultChartTrackHeightField = new JTextField();
trackNameAttributeLabel = new JLabel();
trackNameAttributeField = new JTextField();
missingDataExplanation2 = new JLabel();
jLabel8 = new JLabel();
defaultTrackHeightField = new JTextField();
missingDataExplanation4 = new JLabel();
missingDataExplanation5 = new JLabel();
missingDataExplanation3 = new JLabel();
expandCB = new JCheckBox();
normalizeCoverageCB = new JCheckBox();
missingDataExplanation8 = new JLabel();
expandIconCB = new JCheckBox();
label7 = new JLabel();
defaultFontSizeField = new JTextField();
overlaysPanel = new JPanel();
jPanel5 = new JPanel();
jLabel3 = new JLabel();
overlayAttributeTextField = new JTextField();
overlayTrackCB = new JCheckBox();
jLabel2 = new JLabel();
displayTracksCB = new JCheckBox();
jLabel4 = new JLabel();
colorOverlyCB = new JCheckBox();
chooseOverlayColorsButton = new JideButton();
chartPanel = new JPanel();
jPanel4 = new JPanel();
topBorderCB = new JCheckBox();
label1 = new Label();
chartDrawTrackNameCB = new JCheckBox();
bottomBorderCB = new JCheckBox();
jLabel7 = new JLabel();
colorBordersCB = new JCheckBox();
labelYAxisCB = new JCheckBox();
autoscaleCB = new JCheckBox();
jLabel9 = new JLabel();
showDatarangeCB = new JCheckBox();
alignmentPanel = new JPanel();
jPanel1 = new JPanel();
jPanel11 = new JPanel();
samMaxDepthField = new JTextField();
jLabel11 = new JLabel();
jLabel16 = new JLabel();
mappingQualityThresholdField = new JTextField();
jLabel14 = new JLabel();
jLabel13 = new JLabel();
jLabel15 = new JLabel();
samMaxWindowSizeField = new JTextField();
jLabel12 = new JLabel();
jLabel26 = new JLabel();
snpThresholdField = new JTextField();
jPanel12 = new JPanel();
samMinBaseQualityField = new JTextField();
samShadeMismatchedBaseCB = new JCheckBox();
samMaxBaseQualityField = new JTextField();
showCovTrackCB = new JCheckBox();
samFilterDuplicatesCB = new JCheckBox();
jLabel19 = new JLabel();
filterCB = new JCheckBox();
filterURL = new JTextField();
samFlagUnmappedPairCB = new JCheckBox();
filterFailedReadsCB = new JCheckBox();
label2 = new JLabel();
showSoftClippedCB = new JCheckBox();
showJunctionTrackCB = new JCheckBox();
panel2 = new JPanel();
isizeComputeCB = new JCheckBox();
jLabel17 = new JLabel();
insertSizeMinThresholdField = new JTextField();
jLabel20 = new JLabel();
insertSizeThresholdField = new JTextField();
jLabel30 = new JLabel();
jLabel18 = new JLabel();
insertSizeMinPercentileField = new JTextField();
insertSizeMaxPercentileField = new JTextField();
label8 = new JLabel();
label9 = new JLabel();
expressionPane = new JPanel();
jPanel8 = new JPanel();
expMapToGeneCB = new JRadioButton();
jLabel24 = new JLabel();
expMapToLociCB = new JRadioButton();
jLabel21 = new JLabel();
advancedPanel = new JPanel();
jPanel3 = new JPanel();
jPanel2 = new JPanel();
jLabel1 = new JLabel();
genomeServerURLTextField = new JTextField();
jLabel6 = new JLabel();
dataServerURLTextField = new JTextField();
editServerPropertiesCB = new JCheckBox();
jButton1 = new JButton();
clearGenomeCacheButton = new JButton();
genomeUpdateCB = new JCheckBox();
jPanel7 = new JPanel();
enablePortCB = new JCheckBox();
portField = new JTextField();
jLabel22 = new JLabel();
jPanel9 = new JPanel();
useByteRangeCB = new JCheckBox();
jLabel25 = new JLabel();
proxyPanel = new JPanel();
jPanel15 = new JPanel();
jPanel16 = new JPanel();
proxyUsernameField = new JTextField();
jLabel28 = new JLabel();
authenticateProxyCB = new JCheckBox();
jLabel29 = new JLabel();
proxyPasswordField = new JPasswordField();
jPanel17 = new JPanel();
proxyHostField = new JTextField();
proxyPortField = new JTextField();
jLabel27 = new JLabel();
jLabel23 = new JLabel();
useProxyCB = new JCheckBox();
label3 = new JLabel();
clearProxySettingsButton = new JButton();
okCancelButtonPanel = new ButtonPanel();
okButton = new JButton();
cancelButton = new JButton();
//======== this ========
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
setResizable(false);
Container contentPane = getContentPane();
contentPane.setLayout(new BorderLayout());
//======== tabbedPane ========
{
//======== generalPanel ========
{
generalPanel.setLayout(null);
//======== jPanel10 ========
{
jPanel10.setLayout(null);
//---- missingDataExplanation ----
missingDataExplanation.setFont(new Font("Lucida Grande", Font.ITALIC, 12));
missingDataExplanation.setText("<html>Distinguish regions with zero values from regions with no data on plots <br>(e.g. bar charts). Regions with no data are indicated with a gray background.");
jPanel10.add(missingDataExplanation);
missingDataExplanation.setBounds(41, 35, 644, missingDataExplanation.getPreferredSize().height);
//---- showMissingDataCB ----
showMissingDataCB.setText("Distinguish Missing Data");
showMissingDataCB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
showMissingDataCBActionPerformed(e);
}
});
jPanel10.add(showMissingDataCB);
showMissingDataCB.setBounds(new Rectangle(new Point(10, 6), showMissingDataCB.getPreferredSize()));
//---- combinePanelsCB ----
combinePanelsCB.setText("Combine Data and Feature Panels");
combinePanelsCB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
combinePanelsCBActionPerformed(e);
}
});
jPanel10.add(combinePanelsCB);
combinePanelsCB.setBounds(new Rectangle(new Point(10, 75), combinePanelsCB.getPreferredSize()));
//---- joinSegmentsCB ----
joinSegmentsCB.setText("Join Adjacent CopyNumber Segments");
joinSegmentsCB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
joinSegmentsCBActionPerformed(e);
}
});
jPanel10.add(joinSegmentsCB);
joinSegmentsCB.setBounds(new Rectangle(new Point(10, 115), joinSegmentsCB.getPreferredSize()));
//---- showAttributesDisplayCheckBox ----
showAttributesDisplayCheckBox.setText("Show Attribute Display");
showAttributesDisplayCheckBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
showAttributesDisplayCheckBoxActionPerformed(e);
}
});
jPanel10.add(showAttributesDisplayCheckBox);
showAttributesDisplayCheckBox.setBounds(new Rectangle(new Point(10, 195), showAttributesDisplayCheckBox.getPreferredSize()));
//---- searchZoomCB ----
searchZoomCB.setText("Zoom to features");
searchZoomCB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
searchZoomCBActionPerformed(e);
}
});
jPanel10.add(searchZoomCB);
searchZoomCB.setBounds(new Rectangle(new Point(10, 235), searchZoomCB.getPreferredSize()));
//---- missingDataExplanation6 ----
missingDataExplanation6.setFont(new Font("Lucida Grande", Font.ITALIC, 12));
missingDataExplanation6.setText("<html>This option applies to segmented copy number data only. When selected, gaps between<br>adjacent segments are filled by extending segment endpoints.");
jPanel10.add(missingDataExplanation6);
missingDataExplanation6.setBounds(41, 150, 644, missingDataExplanation6.getPreferredSize().height);
//---- zoomToFeatureExplanation ----
zoomToFeatureExplanation.setFont(new Font("Lucida Grande", Font.ITALIC, 12));
zoomToFeatureExplanation.setText("<html>This option controls the behavior of feature searchs. If true, the zoom level is changed as required to size the view to the feature size. If false the zoom level is unchanged.");
zoomToFeatureExplanation.setVerticalAlignment(SwingConstants.TOP);
jPanel10.add(zoomToFeatureExplanation);
zoomToFeatureExplanation.setBounds(41, 265, 644, 50);
//---- label4 ----
label4.setText("Feature flanking region (bp): ");
jPanel10.add(label4);
label4.setBounds(new Rectangle(new Point(10, 401), label4.getPreferredSize()));
//---- geneListFlankingField ----
geneListFlankingField.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
geneListFlankingFieldFocusLost(e);
}
});
geneListFlankingField.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
geneListFlankingFieldActionPerformed(e);
}
});
jPanel10.add(geneListFlankingField);
geneListFlankingField.setBounds(210, 395, 255, geneListFlankingField.getPreferredSize().height);
//---- zoomToFeatureExplanation2 ----
zoomToFeatureExplanation2.setFont(new Font("Lucida Grande", Font.ITALIC, 12));
zoomToFeatureExplanation2.setText("<html><i>Added before and after feature locus when zooming to a feature. Also used when defining panel extents in gene/loci list views.");
zoomToFeatureExplanation2.setVerticalAlignment(SwingConstants.TOP);
jPanel10.add(zoomToFeatureExplanation2);
zoomToFeatureExplanation2.setBounds(41, 430, 637, 61);
//---- searchZoomCB3 ----
searchZoomCB3.setText("Zoom to features");
searchZoomCB3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
searchZoomCBActionPerformed(e);
}
});
jPanel10.add(searchZoomCB3);
searchZoomCB3.setBounds(0, 524, 140, 23);
//---- searchZoomCB2 ----
searchZoomCB2.setText("Zoom to features");
searchZoomCB2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
searchZoomCBActionPerformed(e);
}
});
jPanel10.add(searchZoomCB2);
searchZoomCB2.setBounds(0, 552, 140, 23);
//---- label5 ----
label5.setText("<html><i>Resolution in base-pairs per pixel at which sequence track becomes visible. ");
jPanel10.add(label5);
label5.setBounds(new Rectangle(new Point(41, 350), label5.getPreferredSize()));
//---- label6 ----
label6.setText("Sequence Resolution Threshold (bp/pixel):");
jPanel10.add(label6);
label6.setBounds(new Rectangle(new Point(10, 315), label6.getPreferredSize()));
//---- seqResolutionThreshold ----
seqResolutionThreshold.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
seqResolutionThresholdFocusLost(e);
}
});
seqResolutionThreshold.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
seqResolutionThresholdActionPerformed(e);
}
});
jPanel10.add(seqResolutionThreshold);
seqResolutionThreshold.setBounds(300, 309, 105, seqResolutionThreshold.getPreferredSize().height);
{ // compute preferred size
Dimension preferredSize = new Dimension();
for(int i = 0; i < jPanel10.getComponentCount(); i++) {
Rectangle bounds = jPanel10.getComponent(i).getBounds();
preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
}
Insets insets = jPanel10.getInsets();
preferredSize.width += insets.right;
preferredSize.height += insets.bottom;
jPanel10.setMinimumSize(preferredSize);
jPanel10.setPreferredSize(preferredSize);
}
}
generalPanel.add(jPanel10);
jPanel10.setBounds(0, 0, 745, 490);
{ // compute preferred size
Dimension preferredSize = new Dimension();
for(int i = 0; i < generalPanel.getComponentCount(); i++) {
Rectangle bounds = generalPanel.getComponent(i).getBounds();
preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
}
Insets insets = generalPanel.getInsets();
preferredSize.width += insets.right;
preferredSize.height += insets.bottom;
generalPanel.setMinimumSize(preferredSize);
generalPanel.setPreferredSize(preferredSize);
}
}
tabbedPane.addTab("General", generalPanel);
//======== tracksPanel ========
{
tracksPanel.setLayout(null);
//======== jPanel6 ========
{
jPanel6.setLayout(null);
//---- jLabel5 ----
jLabel5.setText("Default Track Height, Charts (Pixels)");
jPanel6.add(jLabel5);
jLabel5.setBounds(new Rectangle(new Point(6, 12), jLabel5.getPreferredSize()));
//---- defaultChartTrackHeightField ----
defaultChartTrackHeightField.setText("40");
defaultChartTrackHeightField.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
defaultChartTrackHeightFieldActionPerformed(e);
}
});
defaultChartTrackHeightField.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
defaultChartTrackHeightFieldFocusLost(e);
}
});
jPanel6.add(defaultChartTrackHeightField);
defaultChartTrackHeightField.setBounds(271, 6, 57, defaultChartTrackHeightField.getPreferredSize().height);
//---- trackNameAttributeLabel ----
trackNameAttributeLabel.setText("Track Name Attribute");
jPanel6.add(trackNameAttributeLabel);
trackNameAttributeLabel.setBounds(new Rectangle(new Point(6, 162), trackNameAttributeLabel.getPreferredSize()));
//---- trackNameAttributeField ----
trackNameAttributeField.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
trackNameAttributeFieldActionPerformed(e);
}
});
trackNameAttributeField.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
trackNameAttributeFieldFocusLost(e);
}
});
jPanel6.add(trackNameAttributeField);
trackNameAttributeField.setBounds(147, 156, 216, trackNameAttributeField.getPreferredSize().height);
//---- missingDataExplanation2 ----
missingDataExplanation2.setFont(new Font("Lucida Grande", Font.ITALIC, 12));
missingDataExplanation2.setText("<html>Name of an attribute to be used to label tracks. If provided tracks will be labeled with the corresponding attribute values from the sample information file");
missingDataExplanation2.setVerticalAlignment(SwingConstants.TOP);
jPanel6.add(missingDataExplanation2);
missingDataExplanation2.setBounds(63, 190, 578, 54);
//---- jLabel8 ----
jLabel8.setText("Default Track Height, Other (Pixels)");
jPanel6.add(jLabel8);
jLabel8.setBounds(new Rectangle(new Point(5, 45), jLabel8.getPreferredSize()));
//---- defaultTrackHeightField ----
defaultTrackHeightField.setText("15");
defaultTrackHeightField.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
defaultTrackHeightFieldActionPerformed(e);
}
});
defaultTrackHeightField.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
defaultTrackHeightFieldFocusLost(e);
}
});
jPanel6.add(defaultTrackHeightField);
defaultTrackHeightField.setBounds(271, 39, 57, defaultTrackHeightField.getPreferredSize().height);
//---- missingDataExplanation4 ----
missingDataExplanation4.setFont(new Font("Lucida Grande", Font.ITALIC, 12));
missingDataExplanation4.setText("<html>Default height of chart tracks (barcharts, scatterplots, etc)");
jPanel6.add(missingDataExplanation4);
missingDataExplanation4.setBounds(350, 5, 354, 25);
//---- missingDataExplanation5 ----
missingDataExplanation5.setFont(new Font("Lucida Grande", Font.ITALIC, 12));
missingDataExplanation5.setText("<html>Default height of all other tracks");
jPanel6.add(missingDataExplanation5);
missingDataExplanation5.setBounds(350, 41, 1141, 25);
//---- missingDataExplanation3 ----
missingDataExplanation3.setFont(new Font("Lucida Grande", Font.ITALIC, 12));
missingDataExplanation3.setText("<html><i> If selected feature tracks are expanded by default.");
jPanel6.add(missingDataExplanation3);
missingDataExplanation3.setBounds(new Rectangle(new Point(876, 318), missingDataExplanation3.getPreferredSize()));
//---- expandCB ----
expandCB.setText("Expand Feature Tracks");
expandCB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
expandCBActionPerformed(e);
}
});
jPanel6.add(expandCB);
expandCB.setBounds(new Rectangle(new Point(6, 272), expandCB.getPreferredSize()));
//---- normalizeCoverageCB ----
normalizeCoverageCB.setText("Normalize Coverage Data");
normalizeCoverageCB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
normalizeCoverageCBActionPerformed(e);
}
});
normalizeCoverageCB.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
normalizeCoverageCBFocusLost(e);
}
});
jPanel6.add(normalizeCoverageCB);
normalizeCoverageCB.setBounds(new Rectangle(new Point(6, 372), normalizeCoverageCB.getPreferredSize()));
//---- missingDataExplanation8 ----
missingDataExplanation8.setFont(new Font("Lucida Grande", Font.ITALIC, 12));
missingDataExplanation8.setText("<html><i> Applies to coverage tracks computed with igvtools (.tdf files). If selected coverage values are scaled by (1,000,000 / totalCount), where totalCount is the total number of features or alignments.");
missingDataExplanation8.setVerticalAlignment(SwingConstants.TOP);
jPanel6.add(missingDataExplanation8);
missingDataExplanation8.setBounds(50, 413, 608, 52);
//---- expandIconCB ----
expandIconCB.setText("Show Expand Icon");
expandIconCB.setToolTipText("If checked displays an expand/collapse icon on feature tracks.");
expandIconCB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
expandIconCBActionPerformed(e);
}
});
jPanel6.add(expandIconCB);
expandIconCB.setBounds(new Rectangle(new Point(6, 318), expandIconCB.getPreferredSize()));
//---- label7 ----
label7.setText("Default Font Size");
jPanel6.add(label7);
label7.setBounds(new Rectangle(new Point(5, 75), label7.getPreferredSize()));
//---- defaultFontSizeField ----
defaultFontSizeField.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
defaultFontHeightFieldActionPerformed(e);
}
});
defaultFontSizeField.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
defaultFontHeightFieldFocusLost(e);
}
});
jPanel6.add(defaultFontSizeField);
defaultFontSizeField.setBounds(271, 70, 57, defaultFontSizeField.getPreferredSize().height);
{ // compute preferred size
Dimension preferredSize = new Dimension();
for(int i = 0; i < jPanel6.getComponentCount(); i++) {
Rectangle bounds = jPanel6.getComponent(i).getBounds();
preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
}
Insets insets = jPanel6.getInsets();
preferredSize.width += insets.right;
preferredSize.height += insets.bottom;
jPanel6.setMinimumSize(preferredSize);
jPanel6.setPreferredSize(preferredSize);
}
}
tracksPanel.add(jPanel6);
jPanel6.setBounds(40, 20, 725, 480);
{ // compute preferred size
Dimension preferredSize = new Dimension();
for(int i = 0; i < tracksPanel.getComponentCount(); i++) {
Rectangle bounds = tracksPanel.getComponent(i).getBounds();
preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
}
Insets insets = tracksPanel.getInsets();
preferredSize.width += insets.right;
preferredSize.height += insets.bottom;
tracksPanel.setMinimumSize(preferredSize);
tracksPanel.setPreferredSize(preferredSize);
}
}
tabbedPane.addTab("Tracks", tracksPanel);
//======== overlaysPanel ========
{
//======== jPanel5 ========
{
jPanel5.setLayout(null);
//---- jLabel3 ----
jLabel3.setText("Sample attribute column:");
jPanel5.add(jLabel3);
jLabel3.setBounds(new Rectangle(new Point(65, 86), jLabel3.getPreferredSize()));
//---- overlayAttributeTextField ----
overlayAttributeTextField.setText("LINKING_ID");
overlayAttributeTextField.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
overlayAttributeTextFieldActionPerformed(e);
}
});
overlayAttributeTextField.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
overlayAttributeTextFieldFocusLost(e);
}
});
overlayAttributeTextField.addKeyListener(new KeyAdapter() {
@Override
public void keyTyped(KeyEvent e) {
overlayAttributeTextFieldKeyTyped(e);
}
});
jPanel5.add(overlayAttributeTextField);
overlayAttributeTextField.setBounds(229, 80, 228, overlayAttributeTextField.getPreferredSize().height);
//---- overlayTrackCB ----
overlayTrackCB.setSelected(true);
overlayTrackCB.setText("Overlay mutation tracks");
overlayTrackCB.setActionCommand("overlayTracksCB");
overlayTrackCB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
overlayTrackCBActionPerformed(e);
}
});
jPanel5.add(overlayTrackCB);
overlayTrackCB.setBounds(new Rectangle(new Point(6, 51), overlayTrackCB.getPreferredSize()));
//---- jLabel2 ----
jLabel2.setFont(new Font("Lucida Grande", Font.ITALIC, 12));
jPanel5.add(jLabel2);
jLabel2.setBounds(new Rectangle(new Point(6, 6), jLabel2.getPreferredSize()));
//---- displayTracksCB ----
displayTracksCB.setText("Display mutation data as distinct tracks");
displayTracksCB.setActionCommand("displayTracksCB");
displayTracksCB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
displayTracksCBActionPerformed(e);
}
});
jPanel5.add(displayTracksCB);
displayTracksCB.setBounds(new Rectangle(new Point(5, 230), displayTracksCB.getPreferredSize()));
//---- jLabel4 ----
jLabel4.setFont(new Font("Lucida Grande", Font.ITALIC, 12));
jPanel5.add(jLabel4);
jLabel4.setBounds(new Rectangle(new Point(6, 12), jLabel4.getPreferredSize()));
//---- colorOverlyCB ----
colorOverlyCB.setText("Color code overlay");
colorOverlyCB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
colorOverlyCBActionPerformed(e);
}
});
jPanel5.add(colorOverlyCB);
colorOverlyCB.setBounds(new Rectangle(new Point(65, 114), colorOverlyCB.getPreferredSize()));
//---- chooseOverlayColorsButton ----
chooseOverlayColorsButton.setForeground(new Color(0, 0, 247));
chooseOverlayColorsButton.setText("Choose colors");
chooseOverlayColorsButton.setFont(new Font("Lucida Grande", Font.ITALIC, 12));
chooseOverlayColorsButton.setVerticalAlignment(SwingConstants.BOTTOM);
chooseOverlayColorsButton.setVerticalTextPosition(SwingConstants.BOTTOM);
chooseOverlayColorsButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
chooseOverlayColorsButtonActionPerformed(e);
}
});
jPanel5.add(chooseOverlayColorsButton);
chooseOverlayColorsButton.setBounds(new Rectangle(new Point(220, 116), chooseOverlayColorsButton.getPreferredSize()));
{ // compute preferred size
Dimension preferredSize = new Dimension();
for(int i = 0; i < jPanel5.getComponentCount(); i++) {
Rectangle bounds = jPanel5.getComponent(i).getBounds();
preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
}
Insets insets = jPanel5.getInsets();
preferredSize.width += insets.right;
preferredSize.height += insets.bottom;
jPanel5.setMinimumSize(preferredSize);
jPanel5.setPreferredSize(preferredSize);
}
}
GroupLayout overlaysPanelLayout = new GroupLayout(overlaysPanel);
overlaysPanel.setLayout(overlaysPanelLayout);
overlaysPanelLayout.setHorizontalGroup(
overlaysPanelLayout.createParallelGroup()
.add(overlaysPanelLayout.createSequentialGroup()
.add(28, 28, 28)
.add(jPanel5, GroupLayout.PREFERRED_SIZE, 673, GroupLayout.PREFERRED_SIZE)
.addContainerGap(80, Short.MAX_VALUE))
);
overlaysPanelLayout.setVerticalGroup(
overlaysPanelLayout.createParallelGroup()
.add(overlaysPanelLayout.createSequentialGroup()
.add(55, 55, 55)
.add(jPanel5, GroupLayout.PREFERRED_SIZE, 394, GroupLayout.PREFERRED_SIZE)
.addContainerGap(57, Short.MAX_VALUE))
);
}
tabbedPane.addTab("Mutations", overlaysPanel);
//======== chartPanel ========
{
chartPanel.setLayout(null);
//======== jPanel4 ========
{
//---- topBorderCB ----
topBorderCB.setText("Draw Top Border");
topBorderCB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
topBorderCBActionPerformed(e);
}
});
//---- label1 ----
label1.setFont(label1.getFont());
label1.setText("Default settings for barcharts and scatterplots:");
//---- chartDrawTrackNameCB ----
chartDrawTrackNameCB.setText("Draw Track Label");
chartDrawTrackNameCB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
chartDrawTrackNameCBActionPerformed(e);
}
});
//---- bottomBorderCB ----
bottomBorderCB.setText("Draw Bottom Border");
bottomBorderCB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
bottomBorderCBActionPerformed(e);
}
});
//---- jLabel7 ----
jLabel7.setText("<html><i>If selected charts are dynamically rescaled to the range of the data in view.");
//---- colorBordersCB ----
colorBordersCB.setText("Color Borders");
colorBordersCB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
colorBordersCBActionPerformed(e);
}
});
//---- labelYAxisCB ----
labelYAxisCB.setText("Label Y Axis");
labelYAxisCB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
labelYAxisCBActionPerformed(e);
}
});
//---- autoscaleCB ----
autoscaleCB.setText("Continuous Autoscale");
autoscaleCB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
autoscaleCBActionPerformed(e);
}
});
//---- jLabel9 ----
jLabel9.setText("<html><i>Draw a label centered over the track provided<br>the track height is at least 25 pixels. ");
//---- showDatarangeCB ----
showDatarangeCB.setText("Show Data Range");
showDatarangeCB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
showDatarangeCBActionPerformed(e);
}
});
showDatarangeCB.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
showDatarangeCBFocusLost(e);
}
});
GroupLayout jPanel4Layout = new GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup()
.add(jPanel4Layout.createParallelGroup()
.add(GroupLayout.TRAILING, jPanel4Layout.createSequentialGroup()
.addContainerGap(221, Short.MAX_VALUE)
.add(jLabel9, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.add(84, 84, 84)))
.add(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.add(jPanel4Layout.createParallelGroup()
.add(label1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.add(jPanel4Layout.createSequentialGroup()
.add(20, 20, 20)
.add(jPanel4Layout.createParallelGroup()
.add(jPanel4Layout.createSequentialGroup()
.add(jPanel4Layout.createParallelGroup()
.add(autoscaleCB)
.add(showDatarangeCB))
.add(18, 18, 18)
.add(jLabel7, GroupLayout.DEFAULT_SIZE, 371, Short.MAX_VALUE))
.add(jPanel4Layout.createSequentialGroup()
.add(jPanel4Layout.createParallelGroup()
.add(topBorderCB)
.add(colorBordersCB)
.add(bottomBorderCB)
.add(labelYAxisCB)
.add(chartDrawTrackNameCB))
.addPreferredGap(LayoutStyle.RELATED, 403, Short.MAX_VALUE)))))
.addContainerGap())
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup()
.add(jPanel4Layout.createParallelGroup()
.add(jPanel4Layout.createSequentialGroup()
.add(131, 131, 131)
.add(jLabel9, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addContainerGap(181, Short.MAX_VALUE)))
.add(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.add(label1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(LayoutStyle.RELATED)
.add(topBorderCB)
.addPreferredGap(LayoutStyle.RELATED)
.add(bottomBorderCB)
.add(7, 7, 7)
.add(colorBordersCB)
.add(18, 18, 18)
.add(chartDrawTrackNameCB)
.add(23, 23, 23)
.add(labelYAxisCB)
.add(18, 18, 18)
.add(jPanel4Layout.createParallelGroup(GroupLayout.BASELINE)
.add(autoscaleCB)
.add(jLabel7, GroupLayout.PREFERRED_SIZE, 50, GroupLayout.PREFERRED_SIZE))
.addPreferredGap(LayoutStyle.UNRELATED)
.add(showDatarangeCB)
.add(36, 36, 36))
);
}
chartPanel.add(jPanel4);
jPanel4.setBounds(20, 30, 590, 340);
{ // compute preferred size
Dimension preferredSize = new Dimension();
for(int i = 0; i < chartPanel.getComponentCount(); i++) {
Rectangle bounds = chartPanel.getComponent(i).getBounds();
preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
}
Insets insets = chartPanel.getInsets();
preferredSize.width += insets.right;
preferredSize.height += insets.bottom;
chartPanel.setMinimumSize(preferredSize);
chartPanel.setPreferredSize(preferredSize);
}
}
tabbedPane.addTab("Charts", chartPanel);
//======== alignmentPanel ========
{
alignmentPanel.setLayout(null);
//======== jPanel1 ========
{
jPanel1.setLayout(null);
//======== jPanel11 ========
{
jPanel11.setBorder(null);
jPanel11.setLayout(null);
//---- samMaxDepthField ----
samMaxDepthField.setText("jTextField1");
samMaxDepthField.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
samMaxLevelFieldActionPerformed(e);
}
});
samMaxDepthField.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
samMaxLevelFieldFocusLost(e);
}
});
jPanel11.add(samMaxDepthField);
samMaxDepthField.setBounds(new Rectangle(new Point(206, 40), samMaxDepthField.getPreferredSize()));
//---- jLabel11 ----
jLabel11.setText("Visibility range threshold (kb)");
jPanel11.add(jLabel11);
jLabel11.setBounds(new Rectangle(new Point(6, 12), jLabel11.getPreferredSize()));
//---- jLabel16 ----
jLabel16.setText("<html><i>Reads with qualities below the threshold are not shown.");
jPanel11.add(jLabel16);
jLabel16.setBounds(new Rectangle(new Point(296, 80), jLabel16.getPreferredSize()));
//---- mappingQualityThresholdField ----
mappingQualityThresholdField.setText("0");
mappingQualityThresholdField.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
mappingQualityThresholdFieldActionPerformed(e);
}
});
mappingQualityThresholdField.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
mappingQualityThresholdFieldFocusLost(e);
}
});
jPanel11.add(mappingQualityThresholdField);
mappingQualityThresholdField.setBounds(206, 74, 84, mappingQualityThresholdField.getPreferredSize().height);
//---- jLabel14 ----
jLabel14.setText("<html><i>Maximum read depth to load (approximate).");
jPanel11.add(jLabel14);
jLabel14.setBounds(296, 39, 390, 30);
//---- jLabel13 ----
jLabel13.setText("Maximum read depth:");
jPanel11.add(jLabel13);
jLabel13.setBounds(new Rectangle(new Point(6, 46), jLabel13.getPreferredSize()));
//---- jLabel15 ----
jLabel15.setText("Mapping quality threshold:");
jPanel11.add(jLabel15);
jLabel15.setBounds(new Rectangle(new Point(6, 80), jLabel15.getPreferredSize()));
//---- samMaxWindowSizeField ----
samMaxWindowSizeField.setText("jTextField1");
samMaxWindowSizeField.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
samMaxWindowSizeFieldActionPerformed(e);
}
});
samMaxWindowSizeField.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
samMaxWindowSizeFieldFocusLost(e);
}
});
jPanel11.add(samMaxWindowSizeField);
samMaxWindowSizeField.setBounds(new Rectangle(new Point(206, 6), samMaxWindowSizeField.getPreferredSize()));
//---- jLabel12 ----
jLabel12.setText("<html><i>Nominal window size at which alignments become visible");
jPanel11.add(jLabel12);
jLabel12.setBounds(new Rectangle(new Point(296, 12), jLabel12.getPreferredSize()));
//---- jLabel26 ----
jLabel26.setText("Coverage allele-freq threshold");
jPanel11.add(jLabel26);
jLabel26.setBounds(6, 114, 200, jLabel26.getPreferredSize().height);
//---- snpThresholdField ----
snpThresholdField.setText("0");
snpThresholdField.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
snpThresholdFieldActionPerformed(e);
}
});
snpThresholdField.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
snpThresholdFieldFocusLost(e);
}
});
jPanel11.add(snpThresholdField);
snpThresholdField.setBounds(206, 108, 84, snpThresholdField.getPreferredSize().height);
{ // compute preferred size
Dimension preferredSize = new Dimension();
for(int i = 0; i < jPanel11.getComponentCount(); i++) {
Rectangle bounds = jPanel11.getComponent(i).getBounds();
preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
}
Insets insets = jPanel11.getInsets();
preferredSize.width += insets.right;
preferredSize.height += insets.bottom;
jPanel11.setMinimumSize(preferredSize);
jPanel11.setPreferredSize(preferredSize);
}
}
jPanel1.add(jPanel11);
jPanel11.setBounds(5, 10, 755, 150);
//======== jPanel12 ========
{
jPanel12.setBorder(null);
jPanel12.setLayout(null);
//---- samMinBaseQualityField ----
samMinBaseQualityField.setText("0");
samMinBaseQualityField.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
samMinBaseQualityFieldActionPerformed(e);
}
});
samMinBaseQualityField.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
samMinBaseQualityFieldFocusLost(e);
}
});
jPanel12.add(samMinBaseQualityField);
samMinBaseQualityField.setBounds(380, 105, 50, samMinBaseQualityField.getPreferredSize().height);
//---- samShadeMismatchedBaseCB ----
samShadeMismatchedBaseCB.setText("Shade mismatched bases by quality. ");
samShadeMismatchedBaseCB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
samShadeMismatchedBaseCBActionPerformed(e);
}
});
jPanel12.add(samShadeMismatchedBaseCB);
samShadeMismatchedBaseCB.setBounds(6, 109, 264, samShadeMismatchedBaseCB.getPreferredSize().height);
//---- samMaxBaseQualityField ----
samMaxBaseQualityField.setText("0");
samMaxBaseQualityField.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
samMaxBaseQualityFieldActionPerformed(e);
}
});
samMaxBaseQualityField.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
samMaxBaseQualityFieldFocusLost(e);
}
});
jPanel12.add(samMaxBaseQualityField);
samMaxBaseQualityField.setBounds(505, 105, 50, samMaxBaseQualityField.getPreferredSize().height);
//---- showCovTrackCB ----
showCovTrackCB.setText("Show coverage track");
showCovTrackCB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
showCovTrackCBActionPerformed(e);
}
});
jPanel12.add(showCovTrackCB);
showCovTrackCB.setBounds(375, 10, 270, showCovTrackCB.getPreferredSize().height);
//---- samFilterDuplicatesCB ----
samFilterDuplicatesCB.setText("Filter duplicate reads");
samFilterDuplicatesCB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
samShowDuplicatesCBActionPerformed(e);
}
});
jPanel12.add(samFilterDuplicatesCB);
samFilterDuplicatesCB.setBounds(6, 10, 290, samFilterDuplicatesCB.getPreferredSize().height);
//---- jLabel19 ----
jLabel19.setText("Min: ");
jPanel12.add(jLabel19);
jLabel19.setBounds(new Rectangle(new Point(340, 110), jLabel19.getPreferredSize()));
//---- filterCB ----
filterCB.setText("Filter alignments by read group");
filterCB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
filterCBActionPerformed(e);
}
});
jPanel12.add(filterCB);
filterCB.setBounds(6, 142, 244, filterCB.getPreferredSize().height);
//---- filterURL ----
filterURL.setText("URL or path to filter file");
filterURL.setEnabled(false);
filterURL.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
filterURLActionPerformed(e);
}
});
filterURL.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
filterURLFocusLost(e);
}
});
jPanel12.add(filterURL);
filterURL.setBounds(275, 140, 440, filterURL.getPreferredSize().height);
//---- samFlagUnmappedPairCB ----
samFlagUnmappedPairCB.setText("Flag unmapped pairs");
samFlagUnmappedPairCB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
samFlagUnmappedPairCBActionPerformed(e);
}
});
jPanel12.add(samFlagUnmappedPairCB);
samFlagUnmappedPairCB.setBounds(6, 76, 310, samFlagUnmappedPairCB.getPreferredSize().height);
//---- filterFailedReadsCB ----
filterFailedReadsCB.setText("Filter vendor failed reads");
filterFailedReadsCB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
filterVendorFailedReadsCBActionPerformed(e);
}
});
jPanel12.add(filterFailedReadsCB);
filterFailedReadsCB.setBounds(new Rectangle(new Point(6, 43), filterFailedReadsCB.getPreferredSize()));
//---- label2 ----
label2.setText("Max:");
jPanel12.add(label2);
label2.setBounds(new Rectangle(new Point(455, 110), label2.getPreferredSize()));
//---- showSoftClippedCB ----
showSoftClippedCB.setText("Show soft-clipped bases");
showSoftClippedCB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
showSoftClippedCBActionPerformed(e);
}
});
jPanel12.add(showSoftClippedCB);
showSoftClippedCB.setBounds(new Rectangle(new Point(375, 76), showSoftClippedCB.getPreferredSize()));
//---- showJunctionTrackCB ----
showJunctionTrackCB.setText("Show splice junction track");
showJunctionTrackCB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
showJunctionTrackCBActionPerformed(e);
}
});
jPanel12.add(showJunctionTrackCB);
showJunctionTrackCB.setBounds(new Rectangle(new Point(375, 43), showJunctionTrackCB.getPreferredSize()));
{ // compute preferred size
Dimension preferredSize = new Dimension();
for(int i = 0; i < jPanel12.getComponentCount(); i++) {
Rectangle bounds = jPanel12.getComponent(i).getBounds();
preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
}
Insets insets = jPanel12.getInsets();
preferredSize.width += insets.right;
preferredSize.height += insets.bottom;
jPanel12.setMinimumSize(preferredSize);
jPanel12.setPreferredSize(preferredSize);
}
}
jPanel1.add(jPanel12);
jPanel12.setBounds(5, 145, 755, 175);
//======== panel2 ========
{
panel2.setBorder(new TitledBorder("Insert Size Options"));
panel2.setLayout(null);
//---- isizeComputeCB ----
isizeComputeCB.setText("Compute");
isizeComputeCB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
isizeComputeCBActionPerformed(e);
isizeComputeCBActionPerformed(e);
isizeComputeCBActionPerformed(e);
}
});
panel2.add(isizeComputeCB);
isizeComputeCB.setBounds(new Rectangle(new Point(360, 76), isizeComputeCB.getPreferredSize()));
//---- jLabel17 ----
jLabel17.setText("Maximum (bp):");
panel2.add(jLabel17);
jLabel17.setBounds(100, 110, 110, jLabel17.getPreferredSize().height);
//---- insertSizeMinThresholdField ----
insertSizeMinThresholdField.setText("0");
insertSizeMinThresholdField.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
insertSizeThresholdFieldActionPerformed(e);
insertSizeMinThresholdFieldActionPerformed(e);
insertSizeMinThresholdFieldActionPerformed(e);
insertSizeMinThresholdFieldActionPerformed(e);
}
});
insertSizeMinThresholdField.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
insertSizeThresholdFieldFocusLost(e);
insertSizeMinThresholdFieldFocusLost(e);
}
});
panel2.add(insertSizeMinThresholdField);
insertSizeMinThresholdField.setBounds(220, 75, 84, 28);
//---- jLabel20 ----
jLabel20.setText("Minimum (bp):");
panel2.add(jLabel20);
jLabel20.setBounds(100, 80, 110, 16);
//---- insertSizeThresholdField ----
insertSizeThresholdField.setText("0");
insertSizeThresholdField.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
insertSizeThresholdFieldActionPerformed(e);
insertSizeThresholdFieldActionPerformed(e);
}
});
insertSizeThresholdField.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
insertSizeThresholdFieldFocusLost(e);
}
});
panel2.add(insertSizeThresholdField);
insertSizeThresholdField.setBounds(220, 105, 84, insertSizeThresholdField.getPreferredSize().height);
//---- jLabel30 ----
jLabel30.setText("Minimum (percentile):");
panel2.add(jLabel30);
jLabel30.setBounds(460, 80, 155, 16);
//---- jLabel18 ----
jLabel18.setText("Maximum (percentile):");
panel2.add(jLabel18);
jLabel18.setBounds(460, 110, 155, 16);
//---- insertSizeMinPercentileField ----
insertSizeMinPercentileField.setText("0");
insertSizeMinPercentileField.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
insertSizeThresholdFieldActionPerformed(e);
insertSizeMinThresholdFieldActionPerformed(e);
insertSizeMinThresholdFieldActionPerformed(e);
insertSizeMinThresholdFieldActionPerformed(e);
insertSizeMinPercentileFieldActionPerformed(e);
}
});
insertSizeMinPercentileField.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
insertSizeThresholdFieldFocusLost(e);
insertSizeMinThresholdFieldFocusLost(e);
insertSizeMinPercentileFieldFocusLost(e);
}
});
panel2.add(insertSizeMinPercentileField);
insertSizeMinPercentileField.setBounds(625, 75, 84, 28);
//---- insertSizeMaxPercentileField ----
insertSizeMaxPercentileField.setText("0");
insertSizeMaxPercentileField.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
insertSizeThresholdFieldActionPerformed(e);
insertSizeThresholdFieldActionPerformed(e);
insertSizeMaxPercentileFieldActionPerformed(e);
}
});
insertSizeMaxPercentileField.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
insertSizeThresholdFieldFocusLost(e);
insertSizeMaxPercentileFieldFocusLost(e);
}
});
panel2.add(insertSizeMaxPercentileField);
insertSizeMaxPercentileField.setBounds(625, 105, 84, 28);
//---- label8 ----
label8.setText("<html><i>These options control the color coding of paired alignments by inferred insert size. Base pair values set default values. If \"compute\" is selected values are computed from the actual size distribution of each library.");
panel2.add(label8);
label8.setBounds(5, 15, 735, 55);
//---- label9 ----
label9.setText("Defaults ");
panel2.add(label9);
label9.setBounds(new Rectangle(new Point(15, 80), label9.getPreferredSize()));
{ // compute preferred size
Dimension preferredSize = new Dimension();
for(int i = 0; i < panel2.getComponentCount(); i++) {
Rectangle bounds = panel2.getComponent(i).getBounds();
preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
}
Insets insets = panel2.getInsets();
preferredSize.width += insets.right;
preferredSize.height += insets.bottom;
panel2.setMinimumSize(preferredSize);
panel2.setPreferredSize(preferredSize);
}
}
jPanel1.add(panel2);
panel2.setBounds(5, 350, 755, 145);
{ // compute preferred size
Dimension preferredSize = new Dimension();
for(int i = 0; i < jPanel1.getComponentCount(); i++) {
Rectangle bounds = jPanel1.getComponent(i).getBounds();
preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
}
Insets insets = jPanel1.getInsets();
preferredSize.width += insets.right;
preferredSize.height += insets.bottom;
jPanel1.setMinimumSize(preferredSize);
jPanel1.setPreferredSize(preferredSize);
}
}
alignmentPanel.add(jPanel1);
jPanel1.setBounds(0, 0, 760, 510);
{ // compute preferred size
Dimension preferredSize = new Dimension();
for(int i = 0; i < alignmentPanel.getComponentCount(); i++) {
Rectangle bounds = alignmentPanel.getComponent(i).getBounds();
preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
}
Insets insets = alignmentPanel.getInsets();
preferredSize.width += insets.right;
preferredSize.height += insets.bottom;
alignmentPanel.setMinimumSize(preferredSize);
alignmentPanel.setPreferredSize(preferredSize);
}
}
tabbedPane.addTab("Alignments", alignmentPanel);
//======== expressionPane ========
{
expressionPane.setLayout(null);
//======== jPanel8 ========
{
//---- expMapToGeneCB ----
expMapToGeneCB.setText("Map probes to genes");
expMapToGeneCB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
expMapToGeneCBActionPerformed(e);
}
});
//---- jLabel24 ----
jLabel24.setText("Expression probe mapping options: ");
//---- expMapToLociCB ----
expMapToLociCB.setText("<html>Map probes to target loci");
expMapToLociCB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
expMapToLociCBActionPerformed(e);
}
});
//---- jLabel21 ----
jLabel21.setText("<html><i>Note: Changes will not affect currently loaded datasets.");
GroupLayout jPanel8Layout = new GroupLayout(jPanel8);
jPanel8.setLayout(jPanel8Layout);
jPanel8Layout.setHorizontalGroup(
jPanel8Layout.createParallelGroup()
.add(jPanel8Layout.createSequentialGroup()
.add(jPanel8Layout.createParallelGroup()
.add(jPanel8Layout.createSequentialGroup()
.add(45, 45, 45)
.add(jPanel8Layout.createParallelGroup()
.add(expMapToLociCB, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.add(expMapToGeneCB)))
.add(jPanel8Layout.createSequentialGroup()
.addContainerGap()
.add(jPanel8Layout.createParallelGroup()
.add(jPanel8Layout.createSequentialGroup()
.add(24, 24, 24)
.add(jLabel21, GroupLayout.PREFERRED_SIZE, 497, GroupLayout.PREFERRED_SIZE))
.add(jLabel24))))
.addContainerGap(193, Short.MAX_VALUE))
);
jPanel8Layout.setVerticalGroup(
jPanel8Layout.createParallelGroup()
.add(jPanel8Layout.createSequentialGroup()
.addContainerGap()
.add(jLabel24)
.addPreferredGap(LayoutStyle.RELATED)
.add(jLabel21, GroupLayout.PREFERRED_SIZE, 44, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(LayoutStyle.RELATED)
.add(expMapToLociCB, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.add(14, 14, 14)
.add(expMapToGeneCB)
.addContainerGap(172, Short.MAX_VALUE))
);
}
expressionPane.add(jPanel8);
jPanel8.setBounds(10, 30, 720, 310);
{ // compute preferred size
Dimension preferredSize = new Dimension();
for(int i = 0; i < expressionPane.getComponentCount(); i++) {
Rectangle bounds = expressionPane.getComponent(i).getBounds();
preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
}
Insets insets = expressionPane.getInsets();
preferredSize.width += insets.right;
preferredSize.height += insets.bottom;
expressionPane.setMinimumSize(preferredSize);
expressionPane.setPreferredSize(preferredSize);
}
}
tabbedPane.addTab("Probes", expressionPane);
//======== advancedPanel ========
{
advancedPanel.setBorder(new EmptyBorder(1, 10, 1, 10));
advancedPanel.setLayout(null);
//======== jPanel3 ========
{
//======== jPanel2 ========
{
jPanel2.setLayout(null);
//---- jLabel1 ----
jLabel1.setText("Genome Server URL");
jPanel2.add(jLabel1);
jLabel1.setBounds(new Rectangle(new Point(35, 47), jLabel1.getPreferredSize()));
//---- genomeServerURLTextField ----
genomeServerURLTextField.setText("jTextField1");
genomeServerURLTextField.setEnabled(false);
genomeServerURLTextField.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
genomeServerURLTextFieldActionPerformed(e);
}
});
genomeServerURLTextField.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
genomeServerURLTextFieldFocusLost(e);
}
});
jPanel2.add(genomeServerURLTextField);
genomeServerURLTextField.setBounds(191, 41, 494, genomeServerURLTextField.getPreferredSize().height);
//---- jLabel6 ----
jLabel6.setText("Data Registry URL");
jPanel2.add(jLabel6);
jLabel6.setBounds(new Rectangle(new Point(35, 81), jLabel6.getPreferredSize()));
//---- dataServerURLTextField ----
dataServerURLTextField.setEnabled(false);
dataServerURLTextField.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dataServerURLTextFieldActionPerformed(e);
}
});
dataServerURLTextField.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
dataServerURLTextFieldFocusLost(e);
}
});
jPanel2.add(dataServerURLTextField);
dataServerURLTextField.setBounds(191, 75, 494, dataServerURLTextField.getPreferredSize().height);
//---- editServerPropertiesCB ----
editServerPropertiesCB.setText("Edit server properties");
editServerPropertiesCB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
editServerPropertiesCBActionPerformed(e);
}
});
jPanel2.add(editServerPropertiesCB);
editServerPropertiesCB.setBounds(new Rectangle(new Point(6, 7), editServerPropertiesCB.getPreferredSize()));
//---- jButton1 ----
jButton1.setText("Reset to Defaults");
jButton1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
jButton1ActionPerformed(e);
}
});
jPanel2.add(jButton1);
jButton1.setBounds(new Rectangle(new Point(190, 6), jButton1.getPreferredSize()));
//---- clearGenomeCacheButton ----
clearGenomeCacheButton.setText("Clear Genome Cache");
clearGenomeCacheButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
clearGenomeCacheButtonActionPerformed(e);
}
});
jPanel2.add(clearGenomeCacheButton);
clearGenomeCacheButton.setBounds(new Rectangle(new Point(6, 155), clearGenomeCacheButton.getPreferredSize()));
//---- genomeUpdateCB ----
genomeUpdateCB.setText("<html>Automatically check for updated genomes. <i>Most users should leave this checked.");
genomeUpdateCB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
genomeUpdateCBActionPerformed(e);
}
});
jPanel2.add(genomeUpdateCB);
genomeUpdateCB.setBounds(new Rectangle(new Point(14, 121), genomeUpdateCB.getPreferredSize()));
{ // compute preferred size
Dimension preferredSize = new Dimension();
for(int i = 0; i < jPanel2.getComponentCount(); i++) {
Rectangle bounds = jPanel2.getComponent(i).getBounds();
preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
}
Insets insets = jPanel2.getInsets();
preferredSize.width += insets.right;
preferredSize.height += insets.bottom;
jPanel2.setMinimumSize(preferredSize);
jPanel2.setPreferredSize(preferredSize);
}
}
//======== jPanel7 ========
{
//---- enablePortCB ----
enablePortCB.setText("Enable port");
enablePortCB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
enablePortCBActionPerformed(e);
}
});
//---- portField ----
portField.setText("60151");
portField.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
portFieldActionPerformed(e);
}
});
portField.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
portFieldFocusLost(e);
}
});
//---- jLabel22 ----
jLabel22.setFont(new Font("Lucida Grande", Font.ITALIC, 13));
jLabel22.setText("Enable port to send commands and http requests to IGV. ");
GroupLayout jPanel7Layout = new GroupLayout(jPanel7);
jPanel7.setLayout(jPanel7Layout);
jPanel7Layout.setHorizontalGroup(
jPanel7Layout.createParallelGroup()
.add(jPanel7Layout.createSequentialGroup()
.add(jPanel7Layout.createParallelGroup()
.add(jPanel7Layout.createSequentialGroup()
.addContainerGap()
.add(enablePortCB)
.add(39, 39, 39)
.add(portField, GroupLayout.PREFERRED_SIZE, 126, GroupLayout.PREFERRED_SIZE))
.add(jPanel7Layout.createSequentialGroup()
.add(48, 48, 48)
.add(jLabel22)))
.addContainerGap(330, Short.MAX_VALUE))
);
jPanel7Layout.setVerticalGroup(
jPanel7Layout.createParallelGroup()
.add(jPanel7Layout.createSequentialGroup()
.add(28, 28, 28)
.add(jPanel7Layout.createParallelGroup(GroupLayout.CENTER)
.add(enablePortCB)
.add(portField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addPreferredGap(LayoutStyle.UNRELATED)
.add(jLabel22)
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
}
GroupLayout jPanel3Layout = new GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup()
.add(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.add(jPanel3Layout.createParallelGroup()
.add(jPanel7, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(jPanel2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup()
.add(jPanel3Layout.createSequentialGroup()
.add(20, 20, 20)
.add(jPanel7, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(LayoutStyle.RELATED, 36, Short.MAX_VALUE)
.add(jPanel2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
);
}
advancedPanel.add(jPanel3);
jPanel3.setBounds(10, 0, 750, 330);
//======== jPanel9 ========
{
//---- useByteRangeCB ----
useByteRangeCB.setText("Use http byte-range requests");
useByteRangeCB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
useByteRangeCBActionPerformed(e);
}
});
//---- jLabel25 ----
jLabel25.setFont(new Font("Lucida Grande", Font.ITALIC, 13));
jLabel25.setText("<html>This option applies to certain \"Load from Server...\" tracks hosted at the Broad. Disable this option if you are unable to load the phastCons conservation track under the hg18 annotations.");
GroupLayout jPanel9Layout = new GroupLayout(jPanel9);
jPanel9.setLayout(jPanel9Layout);
jPanel9Layout.setHorizontalGroup(
jPanel9Layout.createParallelGroup()
.add(jPanel9Layout.createSequentialGroup()
.addContainerGap()
.add(jPanel9Layout.createParallelGroup()
.add(jPanel9Layout.createSequentialGroup()
.add(38, 38, 38)
.add(jLabel25, GroupLayout.PREFERRED_SIZE, 601, GroupLayout.PREFERRED_SIZE))
.add(useByteRangeCB))
.addContainerGap(65, Short.MAX_VALUE))
);
jPanel9Layout.setVerticalGroup(
jPanel9Layout.createParallelGroup()
.add(GroupLayout.TRAILING, jPanel9Layout.createSequentialGroup()
.add(59, 59, 59)
.add(useByteRangeCB, GroupLayout.PREFERRED_SIZE, 38, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(LayoutStyle.RELATED)
.add(jLabel25, GroupLayout.DEFAULT_SIZE, 16, Short.MAX_VALUE)
.addContainerGap())
);
}
advancedPanel.add(jPanel9);
jPanel9.setBounds(30, 340, 710, 120);
{ // compute preferred size
Dimension preferredSize = new Dimension();
for(int i = 0; i < advancedPanel.getComponentCount(); i++) {
Rectangle bounds = advancedPanel.getComponent(i).getBounds();
preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
}
Insets insets = advancedPanel.getInsets();
preferredSize.width += insets.right;
preferredSize.height += insets.bottom;
advancedPanel.setMinimumSize(preferredSize);
advancedPanel.setPreferredSize(preferredSize);
}
}
tabbedPane.addTab("Advanced", advancedPanel);
//======== proxyPanel ========
{
proxyPanel.setLayout(new BoxLayout(proxyPanel, BoxLayout.X_AXIS));
//======== jPanel15 ========
{
//======== jPanel16 ========
{
//---- proxyUsernameField ----
proxyUsernameField.setText("jTextField1");
proxyUsernameField.setEnabled(false);
proxyUsernameField.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
proxyUsernameFieldActionPerformed(e);
}
});
proxyUsernameField.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
proxyUsernameFieldFocusLost(e);
}
});
//---- jLabel28 ----
jLabel28.setText("Username");
//---- authenticateProxyCB ----
authenticateProxyCB.setText("Authentication required");
authenticateProxyCB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
authenticateProxyCBActionPerformed(e);
}
});
//---- jLabel29 ----
jLabel29.setText("Password");
//---- proxyPasswordField ----
proxyPasswordField.setText("jPasswordField1");
proxyPasswordField.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
proxyPasswordFieldFocusLost(e);
}
});
GroupLayout jPanel16Layout = new GroupLayout(jPanel16);
jPanel16.setLayout(jPanel16Layout);
jPanel16Layout.setHorizontalGroup(
jPanel16Layout.createParallelGroup()
.add(jPanel16Layout.createSequentialGroup()
.add(jPanel16Layout.createParallelGroup()
.add(jPanel16Layout.createSequentialGroup()
.add(28, 28, 28)
.add(jPanel16Layout.createParallelGroup()
.add(jLabel28)
.add(jLabel29))
.add(37, 37, 37)
.add(jPanel16Layout.createParallelGroup(GroupLayout.LEADING, false)
.add(proxyPasswordField)
.add(proxyUsernameField, GroupLayout.DEFAULT_SIZE, 261, Short.MAX_VALUE)))
.add(jPanel16Layout.createSequentialGroup()
.addContainerGap()
.add(authenticateProxyCB)))
.addContainerGap(381, Short.MAX_VALUE))
);
jPanel16Layout.setVerticalGroup(
jPanel16Layout.createParallelGroup()
.add(jPanel16Layout.createSequentialGroup()
.add(17, 17, 17)
.add(authenticateProxyCB)
.addPreferredGap(LayoutStyle.RELATED)
.add(jPanel16Layout.createParallelGroup(GroupLayout.BASELINE)
.add(jLabel28)
.add(proxyUsernameField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addPreferredGap(LayoutStyle.RELATED)
.add(jPanel16Layout.createParallelGroup(GroupLayout.BASELINE)
.add(jLabel29)
.add(proxyPasswordField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addContainerGap(70, Short.MAX_VALUE))
);
}
//======== jPanel17 ========
{
//---- proxyHostField ----
proxyHostField.setText("jTextField1");
proxyHostField.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
proxyHostFieldActionPerformed(e);
}
});
proxyHostField.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
proxyHostFieldFocusLost(e);
}
});
//---- proxyPortField ----
proxyPortField.setText("jTextField1");
proxyPortField.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
proxyPortFieldActionPerformed(e);
}
});
proxyPortField.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
proxyPortFieldFocusLost(e);
}
});
//---- jLabel27 ----
jLabel27.setText("Proxy port");
//---- jLabel23 ----
jLabel23.setText("Proxy host");
//---- useProxyCB ----
useProxyCB.setText("Use proxy");
useProxyCB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
useProxyCBActionPerformed(e);
}
});
GroupLayout jPanel17Layout = new GroupLayout(jPanel17);
jPanel17.setLayout(jPanel17Layout);
jPanel17Layout.setHorizontalGroup(
jPanel17Layout.createParallelGroup()
.add(jPanel17Layout.createSequentialGroup()
.add(jPanel17Layout.createParallelGroup()
.add(jPanel17Layout.createSequentialGroup()
.addContainerGap()
.add(jPanel17Layout.createParallelGroup()
.add(jLabel27)
.add(jLabel23))
.add(28, 28, 28)
.add(jPanel17Layout.createParallelGroup()
.add(proxyPortField, GroupLayout.PREFERRED_SIZE, 108, GroupLayout.PREFERRED_SIZE)
.add(proxyHostField, GroupLayout.PREFERRED_SIZE, 485, GroupLayout.PREFERRED_SIZE)))
.add(jPanel17Layout.createSequentialGroup()
.add(9, 9, 9)
.add(useProxyCB)))
.addContainerGap(21, Short.MAX_VALUE))
);
jPanel17Layout.setVerticalGroup(
jPanel17Layout.createParallelGroup()
.add(GroupLayout.TRAILING, jPanel17Layout.createSequentialGroup()
.addContainerGap(29, Short.MAX_VALUE)
.add(useProxyCB)
.add(18, 18, 18)
.add(jPanel17Layout.createParallelGroup(GroupLayout.BASELINE)
.add(jLabel23)
.add(proxyHostField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addPreferredGap(LayoutStyle.RELATED)
.add(jPanel17Layout.createParallelGroup(GroupLayout.BASELINE)
.add(jLabel27)
.add(proxyPortField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);
}
//---- label3 ----
label3.setText("<html>Note: do not use these settings unless you receive error or warning messages about server connections. On most systems the correct settings will be automatically copied from your web browser.");
//---- clearProxySettingsButton ----
clearProxySettingsButton.setText("Clear All");
clearProxySettingsButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
clearProxySettingsButtonActionPerformed(e);
}
});
GroupLayout jPanel15Layout = new GroupLayout(jPanel15);
jPanel15.setLayout(jPanel15Layout);
jPanel15Layout.setHorizontalGroup(
jPanel15Layout.createParallelGroup()
.add(jPanel15Layout.createSequentialGroup()
.add(jPanel15Layout.createParallelGroup()
.add(jPanel15Layout.createSequentialGroup()
.add(22, 22, 22)
.add(label3, GroupLayout.PREFERRED_SIZE, 630, GroupLayout.PREFERRED_SIZE))
.add(jPanel15Layout.createSequentialGroup()
.addContainerGap()
.add(jPanel15Layout.createParallelGroup()
.add(jPanel16, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(jPanel17, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
.add(jPanel15Layout.createSequentialGroup()
.addContainerGap()
.add(clearProxySettingsButton)))
.addContainerGap())
);
jPanel15Layout.setVerticalGroup(
jPanel15Layout.createParallelGroup()
.add(jPanel15Layout.createSequentialGroup()
.addContainerGap()
.add(label3, GroupLayout.PREFERRED_SIZE, 63, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(LayoutStyle.RELATED)
.add(jPanel17, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.add(18, 18, 18)
.add(jPanel16, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.add(18, 18, 18)
.add(clearProxySettingsButton)
.addContainerGap(50, Short.MAX_VALUE))
);
}
proxyPanel.add(jPanel15);
}
tabbedPane.addTab("Proxy", proxyPanel);
}
contentPane.add(tabbedPane, BorderLayout.CENTER);
//======== okCancelButtonPanel ========
{
//---- okButton ----
okButton.setText("OK");
okButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
okButtonActionPerformed(e);
}
});
okCancelButtonPanel.add(okButton);
//---- cancelButton ----
cancelButton.setText("Cancel");
cancelButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
cancelButtonActionPerformed(e);
}
});
okCancelButtonPanel.add(cancelButton);
}
contentPane.add(okCancelButtonPanel, BorderLayout.SOUTH);
pack();
setLocationRelativeTo(getOwner());
//---- buttonGroup1 ----
ButtonGroup buttonGroup1 = new ButtonGroup();
buttonGroup1.add(expMapToGeneCB);
buttonGroup1.add(expMapToLociCB);
}// </editor-fold>//GEN-END:initComponents
private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
canceled = true;
setVisible(false);
}//GEN-LAST:event_cancelButtonActionPerformed
private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed
if (inputValidated) {
checkForProbeChanges();
lastSelectedIndex = tabbedPane.getSelectedIndex();
// Store the changed preferences
prefMgr.putAll(updatedPreferenceMap);
if (updatedPreferenceMap.containsKey(PreferenceManager.PORT_ENABLED) ||
updatedPreferenceMap.containsKey(PreferenceManager.PORT_NUMBER)) {
CommandListener.halt();
if (enablePortCB.isSelected()) {
int port = Integer.parseInt(updatedPreferenceMap.get(PreferenceManager.PORT_NUMBER));
CommandListener.start(port);
}
}
checkForSAMChanges();
// Overlays
if (updateOverlays) {
IGV.getInstance().getTrackManager().resetOverlayTracks();
}
// Proxies
if (proxySettingsChanged) {
IGVHttpUtils.updateProxySettings();
}
updatedPreferenceMap.clear();
IGV.getInstance().repaint();
setVisible(false);
} else {
resetValidation();
}
}
private void expMapToLociCBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_expMapToLociCBActionPerformed
updatedPreferenceMap.put(PreferenceManager.PROBE_MAPPING_KEY, String.valueOf(expMapToGeneCB.isSelected()));
}
private void clearGenomeCacheButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clearGenomeCacheButtonActionPerformed
IGV.getInstance().getGenomeManager().clearGenomeCache();
JOptionPane.showMessageDialog(this, "<html>Cached genomes have been removed.");
}
private void editServerPropertiesCBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editServerPropertiesCBActionPerformed
boolean edit = editServerPropertiesCB.isSelected();
dataServerURLTextField.setEnabled(edit);
genomeServerURLTextField.setEnabled(edit);
}
private void dataServerURLTextFieldFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_dataServerURLTextFieldFocusLost
String attributeName = dataServerURLTextField.getText().trim();
updatedPreferenceMap.put(PreferenceManager.DATA_SERVER_URL_KEY, attributeName);
}
private void dataServerURLTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dataServerURLTextFieldActionPerformed
String attributeName = dataServerURLTextField.getText().trim();
updatedPreferenceMap.put(PreferenceManager.DATA_SERVER_URL_KEY, attributeName);
}
private void genomeServerURLTextFieldFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_genomeServerURLTextFieldFocusLost
String attributeName = genomeServerURLTextField.getText().trim();
updatedPreferenceMap.put(PreferenceManager.GENOMES_SERVER_URL, attributeName);
}
private void genomeServerURLTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_genomeServerURLTextFieldActionPerformed
String attributeName = genomeServerURLTextField.getText().trim();
updatedPreferenceMap.put(PreferenceManager.GENOMES_SERVER_URL, attributeName);
}
private void expandIconCBActionPerformed(ActionEvent e) {
updatedPreferenceMap.put(PreferenceManager.SHOW_EXPAND_ICON, String.valueOf(expandIconCB.isSelected()));
}
private void normalizeCoverageCBFocusLost(FocusEvent e) {
// TODO add your code here
}
private void insertSizeThresholdFieldFocusLost(java.awt.event.FocusEvent evt) {
this.insertSizeThresholdFieldActionPerformed(null);
}
private void insertSizeThresholdFieldActionPerformed(java.awt.event.ActionEvent evt) {
String insertThreshold = insertSizeThresholdField.getText().trim();
try {
Integer.parseInt(insertThreshold);
updatedPreferenceMap.put(PreferenceManager.SAM_MAX_INSERT_SIZE_THRESHOLD, insertThreshold);
} catch (NumberFormatException numberFormatException) {
inputValidated = false;
MessageUtils.showMessage("BlastMapping quality threshold must be an integer.");
}
}
private void insertSizeMinThresholdFieldFocusLost(FocusEvent e) {
insertSizeMinThresholdFieldActionPerformed(null);
}
private void insertSizeMinThresholdFieldActionPerformed(ActionEvent e) {
String insertThreshold = insertSizeMinThresholdField.getText().trim();
try {
Integer.parseInt(insertThreshold);
updatedPreferenceMap.put(PreferenceManager.SAM_MIN_INSERT_SIZE_THRESHOLD, insertThreshold);
} catch (NumberFormatException numberFormatException) {
inputValidated = false;
MessageUtils.showMessage("BlastMapping quality threshold must be an integer.");
}
}
private void mappingQualityThresholdFieldFocusLost(java.awt.event.FocusEvent evt) {
mappingQualityThresholdFieldActionPerformed(null);
}//GEN-LAST:event_mappingQualityThresholdFieldFocusLost
private void mappingQualityThresholdFieldActionPerformed(java.awt.event.ActionEvent evt) {
String qualityThreshold = mappingQualityThresholdField.getText().trim();
try {
Integer.parseInt(qualityThreshold);
updatedPreferenceMap.put(PreferenceManager.SAM_QUALITY_THRESHOLD, qualityThreshold);
} catch (NumberFormatException numberFormatException) {
inputValidated = false;
MessageUtils.showMessage(
"BlastMapping quality threshold must be an integer.");
}
}
private void samMaxLevelFieldFocusLost(java.awt.event.FocusEvent evt) {
samMaxLevelFieldActionPerformed(null);
}
private void samMaxLevelFieldActionPerformed(java.awt.event.ActionEvent evt) {
String maxLevelString = samMaxDepthField.getText().trim();
try {
Integer.parseInt(maxLevelString);
updatedPreferenceMap.put(PreferenceManager.SAM_MAX_LEVELS, maxLevelString);
} catch (NumberFormatException numberFormatException) {
inputValidated = false;
MessageUtils.showMessage("Maximum read count must be an integer.");
}
}//GEN-LAST:event_samMaxLevelFieldActionPerformed
private void samShadeMismatchedBaseCBActionPerformed(java.awt.event.ActionEvent evt) {
updatedPreferenceMap.put(
PreferenceManager.SAM_SHADE_BASE_QUALITY,
String.valueOf(samShadeMismatchedBaseCB.isSelected()));
samMinBaseQualityField.setEnabled(samShadeMismatchedBaseCB.isSelected());
samMaxBaseQualityField.setEnabled(samShadeMismatchedBaseCB.isSelected());
}
private void genomeUpdateCBActionPerformed(ActionEvent e) {
updatedPreferenceMap.put(
PreferenceManager.AUTO_UPDATE_GENOMES,
String.valueOf(this.genomeUpdateCB.isSelected()));
}
private void samFlagUnmappedPairCBActionPerformed(java.awt.event.ActionEvent evt) {
updatedPreferenceMap.put(
PreferenceManager.SAM_FLAG_UNMAPPED_PAIR,
String.valueOf(samFlagUnmappedPairCB.isSelected()));
}
private void samShowDuplicatesCBActionPerformed(java.awt.event.ActionEvent evt) {
updatedPreferenceMap.put(
PreferenceManager.SAM_SHOW_DUPLICATES,
String.valueOf(!samFilterDuplicatesCB.isSelected()));
}
private void showSoftClippedCBActionPerformed(ActionEvent e) {
updatedPreferenceMap.put(
PreferenceManager.SAM_SHOW_SOFT_CLIPPED,
String.valueOf(showSoftClippedCB.isSelected()));
}
private void isizeComputeCBActionPerformed(ActionEvent e) {
updatedPreferenceMap.put(
PreferenceManager.SAM_COMPUTE_ISIZES,
String.valueOf(isizeComputeCB.isSelected()));
}
private void insertSizeMinPercentileFieldFocusLost(FocusEvent e) {
insertSizeMinPercentileFieldActionPerformed(null);
}
private void insertSizeMinPercentileFieldActionPerformed(ActionEvent e) {
String valueString = insertSizeMinPercentileField.getText().trim();
try {
Double.parseDouble(valueString);
updatedPreferenceMap.put(PreferenceManager.SAM_MIN_INSERT_SIZE_PERCENTILE, valueString);
} catch (NumberFormatException numberFormatException) {
inputValidated = false;
MessageUtils.showMessage("Minimum insert size percentile must be a number.");
}
}
private void insertSizeMaxPercentileFieldFocusLost(FocusEvent e) {
insertSizeMaxPercentileFieldActionPerformed(null);
}
private void insertSizeMaxPercentileFieldActionPerformed(ActionEvent e) {
String valueString = insertSizeMaxPercentileField.getText().trim();
try {
Double.parseDouble(valueString);
updatedPreferenceMap.put(PreferenceManager.SAM_MAX_INSERT_SIZE_PERCENTILE, valueString);
} catch (NumberFormatException numberFormatException) {
inputValidated = false;
MessageUtils.showMessage("Maximum insert size percentile must be a number.");
}
}
private void samMaxWindowSizeFieldFocusLost(java.awt.event.FocusEvent evt) {
String maxSAMWindowSize = samMaxWindowSizeField.getText().trim();
try {
Float.parseFloat(maxSAMWindowSize);
updatedPreferenceMap.put(PreferenceManager.SAM_MAX_VISIBLE_RANGE, maxSAMWindowSize);
} catch (NumberFormatException numberFormatException) {
inputValidated = false;
MessageUtils.showMessage("Visibility range must be a number.");
}
}
private void samMaxWindowSizeFieldActionPerformed(java.awt.event.ActionEvent evt) {
String maxSAMWindowSize = String.valueOf(samMaxWindowSizeField.getText());
try {
Float.parseFloat(maxSAMWindowSize);
updatedPreferenceMap.put(PreferenceManager.SAM_MAX_VISIBLE_RANGE, maxSAMWindowSize);
} catch (NumberFormatException numberFormatException) {
inputValidated = false;
MessageUtils.showMessage("Visibility range must be a number.");
}
}
private void seqResolutionThresholdActionPerformed(ActionEvent e) {
samMaxWindowSizeFieldFocusLost(null);
}
private void seqResolutionThresholdFocusLost(FocusEvent e) {
String seqResolutionSize = String.valueOf(seqResolutionThreshold.getText());
try {
float value = Float.parseFloat(seqResolutionSize.replace(",", ""));
if (value < 1 || value > 10000) {
MessageUtils.showMessage("Visibility range must be a number between 1 and 10000.");
} else {
updatedPreferenceMap.put(PreferenceManager.MAX_SEQUENCE_RESOLUTION, seqResolutionSize);
}
} catch (NumberFormatException numberFormatException) {
inputValidated = false;
MessageUtils.showMessage("Visibility range must be a number between 1 and 10000.");
}
}
private void chartDrawTrackNameCBActionPerformed(java.awt.event.ActionEvent evt) {
updatedPreferenceMap.put(PreferenceManager.CHART_DRAW_TRACK_NAME,
String.valueOf(chartDrawTrackNameCB.isSelected()));
}
private void autoscaleCBActionPerformed(java.awt.event.ActionEvent evt) {
updatedPreferenceMap.put(PreferenceManager.CHART_AUTOSCALE, String.valueOf(autoscaleCB.isSelected()));
}
private void colorBordersCBActionPerformed(java.awt.event.ActionEvent evt) {
updatedPreferenceMap.put(
PreferenceManager.CHART_COLOR_BORDERS,
String.valueOf(colorBordersCB.isSelected()));
}//GEN-LAST:event_colorBordersCBActionPerformed
private void bottomBorderCBActionPerformed(java.awt.event.ActionEvent evt) {
updatedPreferenceMap.put(
PreferenceManager.CHART_DRAW_BOTTOM_BORDER,
String.valueOf(bottomBorderCB.isSelected()));
}//GEN-LAST:event_bottomBorderCBActionPerformed
private void topBorderCBActionPerformed(java.awt.event.ActionEvent evt) {
updatedPreferenceMap.put(
PreferenceManager.CHART_DRAW_TOP_BORDER,
String.valueOf(topBorderCB.isSelected()));
}//GEN-LAST:event_topBorderCBActionPerformed
private void chooseOverlayColorsButtonActionPerformed(java.awt.event.ActionEvent evt) {
(new LegendDialog(IGV.getMainFrame(), true)).setVisible(true);
}//GEN-LAST:event_chooseOverlayColorsButtonActionPerformed
private void colorOverlyCBActionPerformed(java.awt.event.ActionEvent evt) {
updatedPreferenceMap.put(PreferenceManager.COLOR_OVERLAY_KEY, String.valueOf(
colorOverlyCB.isSelected()));
}//GEN-LAST:event_colorOverlyCBActionPerformed
private void displayTracksCBActionPerformed(java.awt.event.ActionEvent evt) {
updatedPreferenceMap.put(PreferenceManager.DISPLAY_OVERLAY_TRACKS_KEY, String.valueOf(
displayTracksCB.isSelected()));
updateOverlays = true;
}//GEN-LAST:event_displayTracksCBActionPerformed
private void overlayTrackCBActionPerformed(java.awt.event.ActionEvent evt) {
updatedPreferenceMap.put(PreferenceManager.OVERLAY_TRACKS_KEY, String.valueOf(
overlayTrackCB.isSelected()));
overlayAttributeTextField.setEnabled(overlayTrackCB.isSelected());
colorOverlyCB.setEnabled(overlayTrackCB.isSelected());
chooseOverlayColorsButton.setEnabled(overlayTrackCB.isSelected());
updateOverlays = true;
}//GEN-LAST:event_overlayTrackCBActionPerformed
private void overlayAttributeTextFieldKeyTyped(java.awt.event.KeyEvent evt) {
// TODO add your handling code here:
}//GEN-LAST:event_overlayAttributeTextFieldKeyTyped
private void overlayAttributeTextFieldFocusLost(java.awt.event.FocusEvent evt) {
String attributeName = String.valueOf(overlayAttributeTextField.getText());
if (attributeName != null) {
attributeName = attributeName.trim();
}
updatedPreferenceMap.put(PreferenceManager.OVERLAY_ATTRIBUTE_KEY, attributeName);
updateOverlays = true;
}//GEN-LAST:event_overlayAttributeTextFieldFocusLost
private void overlayAttributeTextFieldActionPerformed(java.awt.event.ActionEvent evt) {
updatedPreferenceMap.put(PreferenceManager.OVERLAY_ATTRIBUTE_KEY, String.valueOf(
overlayAttributeTextField.getText()));
updateOverlays = true;
// TODO add your handling code here:
}//GEN-LAST:event_overlayAttributeTextFieldActionPerformed
private void defaultTrackHeightFieldFocusLost(java.awt.event.FocusEvent evt) {
String defaultTrackHeight = String.valueOf(defaultChartTrackHeightField.getText());
try {
Integer.parseInt(defaultTrackHeight);
updatedPreferenceMap.put(PreferenceManager.TRACK_HEIGHT_KEY, defaultTrackHeight);
} catch (NumberFormatException numberFormatException) {
inputValidated = false;
MessageUtils.showMessage("Track height must be an integer number.");
}
}//GEN-LAST:event_defaultTrackHeightFieldFocusLost
private void defaultTrackHeightFieldActionPerformed(java.awt.event.ActionEvent evt) {
String defaultTrackHeight = String.valueOf(defaultChartTrackHeightField.getText());
try {
Integer.parseInt(defaultTrackHeight);
updatedPreferenceMap.put(PreferenceManager.TRACK_HEIGHT_KEY, defaultTrackHeight);
} catch (NumberFormatException numberFormatException) {
inputValidated = false;
MessageUtils.showMessage("Track height must be an integer number.");
}
}
private void defaultFontHeightFieldFocusLost(FocusEvent e) {
defaultFontHeightFieldActionPerformed(null);
}
private void defaultFontHeightFieldActionPerformed(ActionEvent e) {
String defaultFontSize = String.valueOf(defaultFontSizeField.getText());
try {
Integer.parseInt(defaultFontSize);
updatedPreferenceMap.put(PreferenceManager.DEFAULT_FONT_SIZE, defaultFontSize);
} catch (NumberFormatException numberFormatException) {
inputValidated = false;
MessageUtils.showMessage("Font size must be an integer number.");
}
}
private void trackNameAttributeFieldFocusLost(java.awt.event.FocusEvent evt) {
String attributeName = String.valueOf(trackNameAttributeField.getText());
if (attributeName != null) {
attributeName = attributeName.toUpperCase().trim();
}
updatedPreferenceMap.put(PreferenceManager.TRACK_ATTRIBUTE_NAME_KEY, attributeName);
}
private void trackNameAttributeFieldActionPerformed(java.awt.event.ActionEvent evt) {
String attributeName = String.valueOf(trackNameAttributeField.getText());
if (attributeName != null) {
attributeName = attributeName.toUpperCase().trim();
}
updatedPreferenceMap.put(PreferenceManager.TRACK_ATTRIBUTE_NAME_KEY, attributeName);
}
private void defaultChartTrackHeightFieldFocusLost(java.awt.event.FocusEvent evt) {
defaultChartTrackHeightFieldActionPerformed(null);
}
private void defaultChartTrackHeightFieldActionPerformed(java.awt.event.ActionEvent evt) {
String defaultTrackHeight = String.valueOf(defaultChartTrackHeightField.getText());
try {
Integer.parseInt(defaultTrackHeight);
updatedPreferenceMap.put(PreferenceManager.CHART_TRACK_HEIGHT_KEY, defaultTrackHeight);
} catch (NumberFormatException numberFormatException) {
inputValidated = false;
MessageUtils.showMessage("Track height must be an integer number.");
}
}
private void geneListFlankingFieldFocusLost(FocusEvent e) {
// TODO add your code here
}
private void geneListFlankingFieldActionPerformed(ActionEvent e) {
String flankingRegion = String.valueOf(geneListFlankingField.getText());
try {
Integer.parseInt(flankingRegion);
updatedPreferenceMap.put(PreferenceManager.FLANKING_REGION, flankingRegion);
} catch (NumberFormatException numberFormatException) {
inputValidated = false;
MessageUtils.showMessage("Track height must be an integer number.");
}
}
private void showAttributesDisplayCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {
boolean state = ((JCheckBox) evt.getSource()).isSelected();
updatedPreferenceMap.put(PreferenceManager.SHOW_ATTRIBUTE_VIEWS_KEY, String.valueOf(state));
IGV.getInstance().doShowAttributeDisplay(state);
}
private void joinSegmentsCBActionPerformed(java.awt.event.ActionEvent evt) {
updatedPreferenceMap.put(PreferenceManager.JOIN_ADJACENT_SEGMENTS_KEY, String.valueOf(
joinSegmentsCB.isSelected()));
}
private void combinePanelsCBActionPerformed(java.awt.event.ActionEvent evt) {
updatedPreferenceMap.put(PreferenceManager.SHOW_SINGLE_TRACK_PANE_KEY, String.valueOf(
combinePanelsCB.isSelected()));
}
private void showMissingDataCBActionPerformed(java.awt.event.ActionEvent evt) {
updatedPreferenceMap.put(PreferenceManager.SHOW_MISSING_DATA_KEY, String.valueOf(
showMissingDataCB.isSelected()));
}
private void filterVendorFailedReadsCBActionPerformed(ActionEvent e) {
updatedPreferenceMap.put(
PreferenceManager.SAM_FILTER_FAILED_READS,
String.valueOf(filterFailedReadsCB.isSelected()));
}
private void samMinBaseQualityFieldActionPerformed(java.awt.event.ActionEvent evt) {
String baseQuality = samMinBaseQualityField.getText().trim();
try {
Integer.parseInt(baseQuality);
updatedPreferenceMap.put(PreferenceManager.SAM_BASE_QUALITY_MIN, baseQuality);
} catch (NumberFormatException numberFormatException) {
inputValidated = false;
MessageUtils.showMessage("Base quality must be an integer.");
}
}//GEN-LAST:event_samMinBaseQualityFieldActionPerformed
private void samMinBaseQualityFieldFocusLost(java.awt.event.FocusEvent evt) {
samMinBaseQualityFieldActionPerformed(null);
}//GEN-LAST:event_samMinBaseQualityFieldFocusLost
private void samMaxBaseQualityFieldActionPerformed(java.awt.event.ActionEvent evt) {
String baseQuality = samMaxBaseQualityField.getText().trim();
try {
Integer.parseInt(baseQuality);
updatedPreferenceMap.put(PreferenceManager.SAM_BASE_QUALITY_MAX, baseQuality);
} catch (NumberFormatException numberFormatException) {
inputValidated = false;
MessageUtils.showMessage("Base quality must be an integer.");
}
}//GEN-LAST:event_samMaxBaseQualityFieldActionPerformed
private void samMaxBaseQualityFieldFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_samMaxBaseQualityFieldFocusLost
samMaxBaseQualityFieldActionPerformed(null);
}//GEN-LAST:event_samMaxBaseQualityFieldFocusLost
private void expMapToGeneCBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_expMapToGeneCBActionPerformed
updatedPreferenceMap.put(PreferenceManager.PROBE_MAPPING_KEY, String.valueOf(expMapToGeneCB.isSelected()));
}//GEN-LAST:event_expMapToGeneCBActionPerformed
private void labelYAxisCBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_labelYAxisCBActionPerformed
updatedPreferenceMap.put(PreferenceManager.CHART_DRAW_Y_AXIS, String.valueOf(labelYAxisCB.isSelected()));
}
private void showCovTrackCBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showCovTrackCBActionPerformed
updatedPreferenceMap.put(PreferenceManager.SAM_SHOW_COV_TRACK, String.valueOf(showCovTrackCB.isSelected()));
}
private void showJunctionTrackCBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showCovTrackCBActionPerformed
updatedPreferenceMap.put(PreferenceManager.SAM_SHOW_JUNCTION_TRACK, String.valueOf(showJunctionTrackCB.isSelected()));
}
private void filterCBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_filterCBActionPerformed
updatedPreferenceMap.put(PreferenceManager.SAM_FILTER_ALIGNMENTS, String.valueOf(filterCB.isSelected()));
filterURL.setEnabled(filterCB.isSelected());
}
private void filterURLActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_filterURLActionPerformed
updatedPreferenceMap.put(
PreferenceManager.SAM_FILTER_URL,
String.valueOf(filterURL.getText()));
}//GEN-LAST:event_filterURLActionPerformed
private void filterURLFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_filterURLFocusLost
filterURLActionPerformed(null);
}//GEN-LAST:event_filterURLFocusLost
private void portFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_portFieldActionPerformed
String portString = portField.getText().trim();
try {
Integer.parseInt(portString);
updatedPreferenceMap.put(PreferenceManager.PORT_NUMBER, portString);
} catch (NumberFormatException numberFormatException) {
inputValidated = false;
MessageUtils.showMessage("Port must be an integer.");
}
}//GEN-LAST:event_portFieldActionPerformed
private void portFieldFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_portFieldFocusLost
portFieldActionPerformed(null);
}//GEN-LAST:event_portFieldFocusLost
private void enablePortCBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_enablePortCBActionPerformed
updatedPreferenceMap.put(PreferenceManager.PORT_ENABLED, String.valueOf(enablePortCB.isSelected()));
portField.setEnabled(enablePortCB.isSelected());
}//GEN-LAST:event_enablePortCBActionPerformed
private void expandCBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_expandCBActionPerformed
updatedPreferenceMap.put(
PreferenceManager.EXPAND_FEAUTRE_TRACKS,
String.valueOf(expandCB.isSelected()));
}//GEN-LAST:event_expandCBActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
PreferenceManager prefMgr = PreferenceManager.getInstance();
genomeServerURLTextField.setEnabled(true);
genomeServerURLTextField.setText(UIConstants.DEFAULT_SERVER_GENOME_ARCHIVE_LIST);
updatedPreferenceMap.put(PreferenceManager.GENOMES_SERVER_URL, null);
dataServerURLTextField.setEnabled(true);
dataServerURLTextField.setText(PreferenceManager.DEFAULT_DATA_SERVER_URL);
updatedPreferenceMap.put(PreferenceManager.DATA_SERVER_URL_KEY, null);
}//GEN-LAST:event_jButton1ActionPerformed
private void searchZoomCBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchZoomCBActionPerformed
updatedPreferenceMap.put(PreferenceManager.SEARCH_ZOOM, String.valueOf(searchZoomCB.isSelected()));
}//GEN-LAST:event_searchZoomCBActionPerformed
private void useByteRangeCBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_useByteRangeCBActionPerformed
updatedPreferenceMap.put(PreferenceManager.USE_BYTE_RANGE, String.valueOf(useByteRangeCB.isSelected()));
}//GEN-LAST:event_useByteRangeCBActionPerformed
private void showDatarangeCBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showDatarangeCBActionPerformed
updatedPreferenceMap.put(PreferenceManager.CHART_SHOW_DATA_RANGE, String.valueOf(showDatarangeCB.isSelected()));
}//GEN-LAST:event_showDatarangeCBActionPerformed
private void showDatarangeCBFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_showDatarangeCBFocusLost
showDatarangeCBActionPerformed(null);
}//GEN-LAST:event_showDatarangeCBFocusLost
private void snpThresholdFieldActionPerformed(java.awt.event.ActionEvent evt) {
String snpThreshold = snpThresholdField.getText().trim();
try {
Double.parseDouble(snpThreshold);
updatedPreferenceMap.put(PreferenceManager.SAM_ALLELE_THRESHOLD, snpThreshold);
} catch (NumberFormatException numberFormatException) {
inputValidated = false;
MessageUtils.showMessage("Allele frequency threshold must be a number.");
}
}
private void snpThresholdFieldFocusLost(java.awt.event.FocusEvent evt) {
snpThresholdFieldActionPerformed(null);
}
private void normalizeCoverageCBActionPerformed(java.awt.event.ActionEvent evt) {
updatedPreferenceMap.put(PreferenceManager.NORMALIZE_COVERAGE, String.valueOf(normalizeCoverageCB.isSelected()));
portField.setEnabled(enablePortCB.isSelected());
}
// Proxy settings
private void clearProxySettingsButtonActionPerformed(ActionEvent e) {
if (MessageUtils.confirm("This will immediately clear all proxy settings. Are you sure?")) {
this.proxyHostField.setText("");
this.proxyPortField.setText("");
this.proxyUsernameField.setText("");
this.proxyPasswordField.setText("");
this.useProxyCB.setSelected(false);
PreferenceManager.getInstance().clearProxySettings();
}
}
private void useProxyCBActionPerformed(java.awt.event.ActionEvent evt) {
proxySettingsChanged = true;
boolean useProxy = useProxyCB.isSelected();
boolean authenticateProxy = authenticateProxyCB.isSelected();
portField.setEnabled(enablePortCB.isSelected());
updateProxyState(useProxy, authenticateProxy);
updatedPreferenceMap.put(PreferenceManager.USE_PROXY, String.valueOf(useProxy));
}
private void authenticateProxyCBActionPerformed(java.awt.event.ActionEvent evt) {
proxySettingsChanged = true;
boolean useProxy = useProxyCB.isSelected();
boolean authenticateProxy = authenticateProxyCB.isSelected();
portField.setEnabled(enablePortCB.isSelected());
updateProxyState(useProxy, authenticateProxy);
updatedPreferenceMap.put(PreferenceManager.PROXY_AUTHENTICATE, String.valueOf(authenticateProxy));
}
// Host
private void proxyHostFieldFocusLost(java.awt.event.FocusEvent evt) {
proxyHostFieldActionPerformed(null);
}
private void proxyHostFieldActionPerformed(java.awt.event.ActionEvent evt) {
proxySettingsChanged = true;
updatedPreferenceMap.put(PreferenceManager.PROXY_HOST, proxyHostField.getText());
}
private void proxyPortFieldFocusLost(java.awt.event.FocusEvent evt) {
proxyPortFieldActionPerformed(null);
}
private void proxyPortFieldActionPerformed(java.awt.event.ActionEvent evt) {
try {
Integer.parseInt(proxyPortField.getText());
proxySettingsChanged = true;
updatedPreferenceMap.put(PreferenceManager.PROXY_PORT, proxyPortField.getText());
}
catch (NumberFormatException e) {
MessageUtils.showMessage("Proxy port must be an integer.");
}
}
// Username
private void proxyUsernameFieldFocusLost(java.awt.event.FocusEvent evt) {
proxyUsernameFieldActionPerformed(null);
}
private void proxyUsernameFieldActionPerformed(java.awt.event.ActionEvent evt) {
proxySettingsChanged = true;
String user = proxyUsernameField.getText();
updatedPreferenceMap.put(PreferenceManager.PROXY_USER, user);
}
// Password
private void proxyPasswordFieldFocusLost(java.awt.event.FocusEvent evt) {
proxyPasswordFieldActionPerformed(null);
}
private void proxyPasswordFieldActionPerformed(java.awt.event.ActionEvent evt) {
proxySettingsChanged = true;
String pw = proxyPasswordField.getText();
String pwEncoded = Utilities.base64Encode(pw);
updatedPreferenceMap.put(PreferenceManager.PROXY_PW, pwEncoded);
}
private void updateProxyState(boolean useProxy, boolean authenticateProxy) {
proxyHostField.setEnabled(useProxy);
proxyPortField.setEnabled(useProxy);
proxyUsernameField.setEnabled(useProxy && authenticateProxy);
proxyPasswordField.setEnabled(useProxy && authenticateProxy);
}
private void resetValidation() {
// Assume valid input until proven otherwise
inputValidated = true;
}
/*
* Object selection = geneMappingFile.getSelectedItem();
String filename = (selection == null ? null : selection.toString().trim());
updatedPreferenceMap.put(
PreferenceManager.USER_PROBE_MAP_KEY,
filename);
* */
private void initValues() {
combinePanelsCB.setSelected(prefMgr.getAsBoolean(PreferenceManager.SHOW_SINGLE_TRACK_PANE_KEY));
//drawExonNumbersCB.setSelected(preferenceManager.getDrawExonNumbers());
defaultChartTrackHeightField.setText(prefMgr.get(PreferenceManager.CHART_TRACK_HEIGHT_KEY));
defaultTrackHeightField.setText(prefMgr.get(PreferenceManager.TRACK_HEIGHT_KEY));
defaultFontSizeField.setText(prefMgr.get(PreferenceManager.DEFAULT_FONT_SIZE));
displayTracksCB.setSelected(prefMgr.getAsBoolean(PreferenceManager.DISPLAY_OVERLAY_TRACKS_KEY));
overlayAttributeTextField.setText(prefMgr.get(PreferenceManager.OVERLAY_ATTRIBUTE_KEY));
overlayTrackCB.setSelected(prefMgr.getAsBoolean(PreferenceManager.OVERLAY_TRACKS_KEY));
showMissingDataCB.setSelected(prefMgr.getAsBoolean(PreferenceManager.SHOW_MISSING_DATA_KEY));
joinSegmentsCB.setSelected(prefMgr.getAsBoolean(PreferenceManager.JOIN_ADJACENT_SEGMENTS_KEY));
colorOverlyCB.setSelected(prefMgr.getAsBoolean(PreferenceManager.COLOR_OVERLAY_KEY));
overlayAttributeTextField.setEnabled(overlayTrackCB.isSelected());
colorOverlyCB.setEnabled(overlayTrackCB.isSelected());
chooseOverlayColorsButton.setEnabled(overlayTrackCB.isSelected());
seqResolutionThreshold.setText(prefMgr.get(PreferenceManager.MAX_SEQUENCE_RESOLUTION));
geneListFlankingField.setText(prefMgr.get(PreferenceManager.FLANKING_REGION));
enablePortCB.setSelected(prefMgr.getAsBoolean(PreferenceManager.PORT_ENABLED));
portField.setText(String.valueOf(prefMgr.getAsInt(PreferenceManager.PORT_NUMBER)));
portField.setEnabled(enablePortCB.isSelected());
expandCB.setSelected(prefMgr.getAsBoolean(PreferenceManager.EXPAND_FEAUTRE_TRACKS));
searchZoomCB.setSelected(prefMgr.getAsBoolean(PreferenceManager.SEARCH_ZOOM));
useByteRangeCB.setSelected(prefMgr.getAsBoolean(PreferenceManager.USE_BYTE_RANGE));
showAttributesDisplayCheckBox.setSelected(prefMgr.getAsBoolean(PreferenceManager.SHOW_ATTRIBUTE_VIEWS_KEY));
trackNameAttributeField.setText(prefMgr.get(PreferenceManager.TRACK_ATTRIBUTE_NAME_KEY));
genomeServerURLTextField.setText(prefMgr.getGenomeListURL());
dataServerURLTextField.setText(prefMgr.getDataServerURL());
// Chart panel
topBorderCB.setSelected(prefMgr.getAsBoolean(PreferenceManager.CHART_DRAW_TOP_BORDER));
bottomBorderCB.setSelected(prefMgr.getAsBoolean(PreferenceManager.CHART_DRAW_BOTTOM_BORDER));
colorBordersCB.setSelected(prefMgr.getAsBoolean(PreferenceManager.CHART_COLOR_BORDERS));
chartDrawTrackNameCB.setSelected(prefMgr.getAsBoolean(PreferenceManager.CHART_DRAW_TRACK_NAME));
autoscaleCB.setSelected(prefMgr.getAsBoolean(PreferenceManager.CHART_AUTOSCALE));
showDatarangeCB.setSelected(prefMgr.getAsBoolean(PreferenceManager.CHART_SHOW_DATA_RANGE));
labelYAxisCB.setSelected(prefMgr.getAsBoolean(PreferenceManager.CHART_DRAW_Y_AXIS));
samMaxWindowSizeField.setText(prefMgr.get(PreferenceManager.SAM_MAX_VISIBLE_RANGE));
samMaxDepthField.setText(prefMgr.get(PreferenceManager.SAM_MAX_LEVELS));
mappingQualityThresholdField.setText(prefMgr.get(PreferenceManager.SAM_QUALITY_THRESHOLD));
insertSizeThresholdField.setText(prefMgr.get(PreferenceManager.SAM_MAX_INSERT_SIZE_THRESHOLD));
insertSizeMinThresholdField.setText(prefMgr.get(PreferenceManager.SAM_MIN_INSERT_SIZE_THRESHOLD));
insertSizeMinPercentileField.setText(prefMgr.get(PreferenceManager.SAM_MIN_INSERT_SIZE_PERCENTILE));
insertSizeMaxPercentileField.setText(prefMgr.get(PreferenceManager.SAM_MAX_INSERT_SIZE_PERCENTILE));
snpThresholdField.setText((String.valueOf(prefMgr.getAsFloat(PreferenceManager.SAM_ALLELE_THRESHOLD))));
//samShowZeroQualityCB.setSelected(samPrefs.isShowZeroQuality());
samFilterDuplicatesCB.setSelected(!prefMgr.getAsBoolean(PreferenceManager.SAM_SHOW_DUPLICATES));
filterFailedReadsCB.setSelected(prefMgr.getAsBoolean(PreferenceManager.SAM_FILTER_FAILED_READS));
showSoftClippedCB.setSelected(prefMgr.getAsBoolean(PreferenceManager.SAM_SHOW_SOFT_CLIPPED));
samFlagUnmappedPairCB.setSelected(prefMgr.getAsBoolean(PreferenceManager.SAM_FLAG_UNMAPPED_PAIR));
samShadeMismatchedBaseCB.setSelected(prefMgr.getAsBoolean(PreferenceManager.SAM_SHADE_BASE_QUALITY));
samMinBaseQualityField.setText((String.valueOf(prefMgr.getAsInt(PreferenceManager.SAM_BASE_QUALITY_MIN))));
samMaxBaseQualityField.setText((String.valueOf(prefMgr.getAsInt(PreferenceManager.SAM_BASE_QUALITY_MAX))));
samMinBaseQualityField.setEnabled(samShadeMismatchedBaseCB.isSelected());
samMaxBaseQualityField.setEnabled(samShadeMismatchedBaseCB.isSelected());
showCovTrackCB.setSelected(prefMgr.getAsBoolean(PreferenceManager.SAM_SHOW_COV_TRACK));
isizeComputeCB.setSelected(prefMgr.getAsBoolean(PreferenceManager.SAM_COMPUTE_ISIZES));
//dhmay adding 20110208
showJunctionTrackCB.setSelected(prefMgr.getAsBoolean(PreferenceManager.SAM_SHOW_JUNCTION_TRACK));
filterCB.setSelected(prefMgr.getAsBoolean(PreferenceManager.SAM_FILTER_ALIGNMENTS));
if (prefMgr.get(PreferenceManager.SAM_FILTER_URL) != null) {
filterURL.setText(prefMgr.get(PreferenceManager.SAM_FILTER_URL));
}
genomeUpdateCB.setSelected(prefMgr.getAsBoolean(PreferenceManager.AUTO_UPDATE_GENOMES));
final boolean mapProbesToGenes = PreferenceManager.getInstance().getAsBoolean(PreferenceManager.PROBE_MAPPING_KEY);
expMapToGeneCB.setSelected(mapProbesToGenes);
expMapToLociCB.setSelected(!mapProbesToGenes);
normalizeCoverageCB.setSelected(prefMgr.getAsBoolean(PreferenceManager.NORMALIZE_COVERAGE));
expandIconCB.setSelected(prefMgr.getAsBoolean(PreferenceManager.SHOW_EXPAND_ICON));
boolean useProxy = prefMgr.getAsBoolean(PreferenceManager.USE_PROXY);
useProxyCB.setSelected(useProxy);
boolean authenticateProxy = prefMgr.getAsBoolean(PreferenceManager.PROXY_AUTHENTICATE);
authenticateProxyCB.setSelected(authenticateProxy);
proxyHostField.setText(prefMgr.get(PreferenceManager.PROXY_HOST, ""));
proxyPortField.setText(prefMgr.get(PreferenceManager.PROXY_PORT, ""));
proxyUsernameField.setText(prefMgr.get(PreferenceManager.PROXY_USER, ""));
String pwCoded = prefMgr.get(PreferenceManager.PROXY_PW, "");
proxyPasswordField.setText(Utilities.base64Decode(pwCoded));
updateProxyState(useProxy, authenticateProxy);
}
private void checkForSAMChanges() {
WaitCursorManager.CursorToken token = WaitCursorManager.showWaitCursor();
try {
boolean reloadSAM = false;
for (String key : SAM_PREFERENCE_KEYS) {
if (updatedPreferenceMap.containsKey(key)) {
reloadSAM = true;
break;
}
}
if (reloadSAM) {
IGV.getInstance().getTrackManager().reloadSAMTracks();
}
} catch (NumberFormatException numberFormatException) {
} finally {
WaitCursorManager.removeWaitCursor(token);
}
}
private void checkForProbeChanges() {
if (updatedPreferenceMap.containsKey(PreferenceManager.PROBE_MAPPING_KEY)) {
ProbeToLocusMap.getInstance().clearProbeMappings();
}
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
PreferencesEditor dialog = new PreferencesEditor(new javax.swing.JFrame(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
//TODO move this to another class, or resource bundle
static String overlayText = "<html>These options control the treatment of mutation tracks. " +
"Mutation data may optionally<br>be overlayed on other tracks that have a matching attribute value " +
"from the sample info <br>file. " +
"This is normally an attribute that identifies a sample or patient. The attribute key <br>is specified in the" +
"text field below.";
public String getOverlayText() {
return overlayText;
}
// Variables declaration - do not modify//GEN-BEGIN:variables
// Generated using JFormDesigner non-commercial license
private JTabbedPane tabbedPane;
private JPanel generalPanel;
private JPanel jPanel10;
private JLabel missingDataExplanation;
private JCheckBox showMissingDataCB;
private JCheckBox combinePanelsCB;
private JCheckBox joinSegmentsCB;
private JCheckBox showAttributesDisplayCheckBox;
private JCheckBox searchZoomCB;
private JLabel missingDataExplanation6;
private JLabel zoomToFeatureExplanation;
private JLabel label4;
private JTextField geneListFlankingField;
private JLabel zoomToFeatureExplanation2;
private JCheckBox searchZoomCB3;
private JCheckBox searchZoomCB2;
private JLabel label5;
private JLabel label6;
private JTextField seqResolutionThreshold;
private JPanel tracksPanel;
private JPanel jPanel6;
private JLabel jLabel5;
private JTextField defaultChartTrackHeightField;
private JLabel trackNameAttributeLabel;
private JTextField trackNameAttributeField;
private JLabel missingDataExplanation2;
private JLabel jLabel8;
private JTextField defaultTrackHeightField;
private JLabel missingDataExplanation4;
private JLabel missingDataExplanation5;
private JLabel missingDataExplanation3;
private JCheckBox expandCB;
private JCheckBox normalizeCoverageCB;
private JLabel missingDataExplanation8;
private JCheckBox expandIconCB;
private JLabel label7;
private JTextField defaultFontSizeField;
private JPanel overlaysPanel;
private JPanel jPanel5;
private JLabel jLabel3;
private JTextField overlayAttributeTextField;
private JCheckBox overlayTrackCB;
private JLabel jLabel2;
private JCheckBox displayTracksCB;
private JLabel jLabel4;
private JCheckBox colorOverlyCB;
private JideButton chooseOverlayColorsButton;
private JPanel chartPanel;
private JPanel jPanel4;
private JCheckBox topBorderCB;
private Label label1;
private JCheckBox chartDrawTrackNameCB;
private JCheckBox bottomBorderCB;
private JLabel jLabel7;
private JCheckBox colorBordersCB;
private JCheckBox labelYAxisCB;
private JCheckBox autoscaleCB;
private JLabel jLabel9;
private JCheckBox showDatarangeCB;
private JPanel alignmentPanel;
private JPanel jPanel1;
private JPanel jPanel11;
private JTextField samMaxDepthField;
private JLabel jLabel11;
private JLabel jLabel16;
private JTextField mappingQualityThresholdField;
private JLabel jLabel14;
private JLabel jLabel13;
private JLabel jLabel15;
private JTextField samMaxWindowSizeField;
private JLabel jLabel12;
private JLabel jLabel26;
private JTextField snpThresholdField;
private JPanel jPanel12;
private JTextField samMinBaseQualityField;
private JCheckBox samShadeMismatchedBaseCB;
private JTextField samMaxBaseQualityField;
private JCheckBox showCovTrackCB;
private JCheckBox samFilterDuplicatesCB;
private JLabel jLabel19;
private JCheckBox filterCB;
private JTextField filterURL;
private JCheckBox samFlagUnmappedPairCB;
private JCheckBox filterFailedReadsCB;
private JLabel label2;
private JCheckBox showSoftClippedCB;
private JCheckBox showJunctionTrackCB;
private JPanel panel2;
private JCheckBox isizeComputeCB;
private JLabel jLabel17;
private JTextField insertSizeMinThresholdField;
private JLabel jLabel20;
private JTextField insertSizeThresholdField;
private JLabel jLabel30;
private JLabel jLabel18;
private JTextField insertSizeMinPercentileField;
private JTextField insertSizeMaxPercentileField;
private JLabel label8;
private JLabel label9;
private JPanel expressionPane;
private JPanel jPanel8;
private JRadioButton expMapToGeneCB;
private JLabel jLabel24;
private JRadioButton expMapToLociCB;
private JLabel jLabel21;
private JPanel advancedPanel;
private JPanel jPanel3;
private JPanel jPanel2;
private JLabel jLabel1;
private JTextField genomeServerURLTextField;
private JLabel jLabel6;
private JTextField dataServerURLTextField;
private JCheckBox editServerPropertiesCB;
private JButton jButton1;
private JButton clearGenomeCacheButton;
private JCheckBox genomeUpdateCB;
private JPanel jPanel7;
private JCheckBox enablePortCB;
private JTextField portField;
private JLabel jLabel22;
private JPanel jPanel9;
private JCheckBox useByteRangeCB;
private JLabel jLabel25;
private JPanel proxyPanel;
private JPanel jPanel15;
private JPanel jPanel16;
private JTextField proxyUsernameField;
private JLabel jLabel28;
private JCheckBox authenticateProxyCB;
private JLabel jLabel29;
private JPasswordField proxyPasswordField;
private JPanel jPanel17;
private JTextField proxyHostField;
private JTextField proxyPortField;
private JLabel jLabel27;
private JLabel jLabel23;
private JCheckBox useProxyCB;
private JLabel label3;
private JButton clearProxySettingsButton;
private ButtonPanel okCancelButtonPanel;
private JButton okButton;
private JButton cancelButton;
// End of variables declaration//GEN-END:variables
public boolean isCanceled() {
return canceled;
}
/**
* List of keys that affect the alignments loaded. This list is used to trigger a reload, if required.
* Not all alignment preferences need trigger a reload, this is a subset.
*/
static java.util.List<String> SAM_PREFERENCE_KEYS = Arrays.asList(
PreferenceManager.SAM_QUALITY_THRESHOLD,
PreferenceManager.SAM_FILTER_ALIGNMENTS,
PreferenceManager.SAM_FILTER_URL,
PreferenceManager.SAM_MAX_VISIBLE_RANGE,
PreferenceManager.SAM_SHOW_DUPLICATES,
PreferenceManager.SAM_SHOW_SOFT_CLIPPED,
PreferenceManager.SAM_MAX_LEVELS,
PreferenceManager.SAM_MAX_READS,
PreferenceManager.SAM_FILTER_FAILED_READS
);
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
1e77eddcdbb8f2d140cf3f3c419cc5257e59786d | bcaa31f92a97e66fa9ac817c04539cef20472be3 | /src/poker/handranking/util/HandRankingException.java | 99505fb4eb5a870f091db07e923af82fa4b703df | [
"MIT"
] | permissive | corintio/Poker_HandEvaluation | 0ad4c58a0551d75579a23fef99259e42e49bc3e9 | 616b2980c32ff53cf0ba11614dc0461e7cd15259 | refs/heads/master | 2020-04-11T20:25:28.671678 | 2016-10-05T17:04:31 | 2016-10-05T17:04:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 911 | java | package poker.handranking.util;
/*
* Copyright (C) 2016 gebruiker
*
* This program 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/>.
*/
/**
* Handranking exception class
* @author Jellen Vermeir
*/
public class HandRankingException extends Exception{
public HandRankingException(String msg){
super(msg);
}
}
| [
"jellenvermeir@gmail.com"
] | jellenvermeir@gmail.com |
ef6bfa4eadd36f0ee0a5852cebcdd30cf316095c | 182c7249858305bb2ffaa8223e1ba3b4194bc70f | /src/com/practice/InC.java | 592ad78cdb063ce75dd57b1685c3ec84c19dd00a | [] | no_license | Bhupesh168/InterviewPractice | 8d438c0a9f03200f50eee8a13592dca490094128 | 81a1d91c24846f904d669aac2e745bf7bd4bff03 | refs/heads/master | 2020-07-25T08:56:40.291113 | 2019-09-13T09:47:04 | 2019-09-13T09:47:04 | 208,237,960 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 125 | java | package com.practice;
public class InC {
public static void main(String [] args) {
InB a = new InB();
}
}
| [
"bhugupta1@WKWIN0997831"
] | bhugupta1@WKWIN0997831 |
dfe28d8cfe68bd4b9d31ba0a9389cddff57d725d | 2de257be8dc9ffc70dd28988e7a9f1b64519b360 | /tags/rds-0.26/src/datascript/tools/DataScriptTool.java | 21b92364ff83769ad83d9a823ca4e51441a26479 | [] | no_license | MichalLeonBorsuk/datascript-svn | f141e5573a1728b006a13a0852a5ebb0495177f8 | 8a89530c50cdfde43696eb7309767d45979e2f40 | refs/heads/master | 2020-04-13T03:11:45.133544 | 2010-04-06T13:04:03 | 2010-04-06T13:04:03 | 162,924,533 | 0 | 1 | null | 2018-12-23T21:18:53 | 2018-12-23T21:18:52 | null | UTF-8 | Java | false | false | 16,728 | java | /* BSD License
*
* Copyright (c) 2006, Harald Wellmann, Harman/Becker Automotive Systems
* All rights reserved.
*
* This software is derived from previous work
* Copyright (c) 2003, Godmar Back.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* * Neither the name of Harman/Becker Automotive Systems or
* Godmar Back nor the names of their contributors may be used to
* endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package datascript.tools;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.ServiceLoader;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.Parser;
import antlr.Token;
import antlr.TokenStreamHiddenTokenFilter;
import antlr.TokenStreamRecognitionException;
import antlr.collections.AST;
import datascript.antlr.DataScriptEmitter;
import datascript.antlr.DataScriptLexer;
import datascript.antlr.DataScriptParser;
import datascript.antlr.DataScriptParserTokenTypes;
import datascript.antlr.DataScriptWalker;
import datascript.antlr.ExpressionEvaluator;
import datascript.antlr.TypeEvaluator;
import datascript.antlr.util.FileNameToken;
import datascript.antlr.util.TokenAST;
import datascript.antlr.util.ToolContext;
import datascript.ast.DataScriptException;
import datascript.ast.Package;
import datascript.ast.ParserException;
import datascript.ast.Scope;
/**
* Entry point of rds.
* TODO: Refactor this class.
*
* @author HWellmann
*/
public class DataScriptTool implements Parameters
{
private static final String VERSION = "rds 0.26 (8 Aug 2008)";
private ToolContext context;
private TokenAST rootNode = null;
private DataScriptParser parser = null;
private final Scope globals = new Scope();
private final HashSet<String> allPackageFiles = new HashSet<String>();
private final DataScriptEmitter emitter = new DataScriptEmitter();
private final List<Extension> extensions = new ArrayList<Extension>();
/** Commandline options accepted by this tool. */
private final Options rdsOptionsToAccept = new Options();
/**
* All commandline options (some of these are handled by rds extensions,
* not by the main tool.
*/
private CommandLine cli = null;
/* Different Properties for holding values from the commandline */
private String fileName = null;
private String srcPathName = null;
private String outPathName = null;
private boolean checkSyntax = false;
class CmdLineParser extends org.apache.commons.cli.Parser
{
/**
* <p>This implementation of {@link Parser}'s abstract
* {@link Parser#flatten(Options,String[],boolean) flatten} method
* filters all arguments, that are defined in {@link Options}.
* </p>
*
* <p>
* <b>Note:</b> <code>stopAtNonOption</code> is not used in this
* <code>flatten</code> method.
* </p>
*
* @param options
* The command line {@link Option}
* @param arguments
* The command line arguments to be parsed
* @param stopAtNonOption
* Specifies whether to stop flattening when an non option is
* found.
* @return The <code>arguments</code> String array.
*/
@Override
protected String[] flatten(Options options, String[] arguments,
boolean stopAtNonOption)
{
boolean nextIsArg = false;
List<String> newArguments = new ArrayList<String>();
for (String argument : arguments)
{
if (nextIsArg)
{
nextIsArg = false;
}
else
{
if (!options.hasOption(argument))
continue;
Option opt = options.getOption(argument);
nextIsArg = opt.hasArg();
}
newArguments.add(argument);
}
String[] a = new String[0];
return newArguments.toArray(a);
}
}
public DataScriptTool()
{
Token token = new FileNameToken(DataScriptParserTokenTypes.ROOT, "ROOT");
rootNode = new TokenAST(token);
}
public void parseArguments(String[] args) throws ParseException
{
if (args.length > 0)
{
fileName = args[args.length-1];
}
Option rdsOption;
rdsOption = new Option("h", "help", false, "prints this help text and exit");
rdsOption.setRequired(false);
rdsOptionsToAccept.addOption(rdsOption);
rdsOption = new Option("c", false, "check syntax");
rdsOption.setRequired(false);
rdsOptionsToAccept.addOption(rdsOption);
rdsOption = new Option("out", true,
"path to the directory in which the generated code is stored");
rdsOption.setRequired(false);
rdsOptionsToAccept.addOption(rdsOption);
rdsOption = new Option("src", true, "path to DataScript source files");
rdsOption.setRequired(false);
rdsOptionsToAccept.addOption(rdsOption);
CmdLineParser cliParser = new CmdLineParser();
cli = cliParser.parse(rdsOptionsToAccept, args, true);
}
public boolean checkArguments()
{
if (cli == null)
return false;
checkSyntax = cli.hasOption('c');
srcPathName = cli.getOptionValue("src");
outPathName = cli.getOptionValue("out");
if (fileName == null)
return false;
// normalize slashes and backslashes
fileName = new File(fileName).getPath();
if (outPathName == null || outPathName.length() == 0)
{
outPathName = ".";
}
else
{
int i = outPathName.length();
while (outPathName.charAt(i - 1) == File.separatorChar)
--i;
if (i < outPathName.length())
outPathName = outPathName.substring(0, i);
}
return true;
}
/**
* Installs all extensions that are configured in the services manifest and
* detects all options of each extension installed.
*
* @throws IOException
* @throws InstantiationException
* @throws IllegalAccessException
*/
private void prepareExtensions()
{
ServiceLoader<Extension> loader =
ServiceLoader.load(Extension.class, getClass().getClassLoader());
Iterator<Extension> it = loader.iterator();
while (it.hasNext())
{
Extension extension = it.next();
extensions.add(extension);
extension.getOptions(rdsOptionsToAccept);
extension.setParameter(this);
}
}
private void printExtensions()
{
ServiceLoader<Extension> loader = ServiceLoader.load(Extension.class);
Iterator<Extension> it = loader.iterator();
while (it.hasNext())
{
Extension ext = it.next();
System.out.println("Extension: " + ext.getClass().getName());
}
}
/******** functions depend on the datascript compiler ********/
public void parseDatascript() throws Exception
{
// create tool context for information exchange between pipeline
// components
context = ToolContext.getInstance();
context.setFileName(fileName);
context.setPathName(srcPathName);
allPackageFiles.add(fileName);
AST unitRoot = parsePackage();
if (unitRoot != null)
{
rootNode.addChild(unitRoot);
parseImportedPackages(unitRoot);
}
// Validate the syntax tree - this has no side effects.
if (checkSyntax)
{
DataScriptWalker walker = new DataScriptWalker();
walker.setContext(context);
walker.root(rootNode);
if (context.getErrorCount() != 0)
throw new ParserException("Walker: Parser errors.");
}
// create name scopes and resolve references
TypeEvaluator typeEval = new TypeEvaluator();
typeEval.pushScope(globals);
typeEval.root(rootNode);
if (context.getErrorCount() != 0)
throw new ParserException("TypeEvaluator: Parser errors.");
Package.linkAll();
if (ToolContext.getInstance().getErrorCount() != 0)
throw new ParserException("TypeEvaluator: Linker errors.");
// check expression types and evaluate constant expressions
ExpressionEvaluator exprEval = new ExpressionEvaluator();
exprEval.setContext(context);
exprEval.pushScope(globals);
exprEval.root(rootNode);
if (context.getErrorCount() != 0)
throw new ParserException("ExpressionEvaluator: Parser errors.");
}
public void emitDatascript() throws Exception
{
if (rootNode == null)
return;
if (extensions.size() == 0)
{
System.out.println("No extensions found, nothing emitted.");
return;
}
for (Extension extension : extensions)
{
extension.generate(emitter, rootNode);
}
}
private void parseImportedPackages(AST unitNode) throws Exception
{
AST node = unitNode.getFirstChild();
if (node.getType() == DataScriptParserTokenTypes.PACKAGE)
{
while (true)
{
node = node.getNextSibling();
if (node == null
|| node.getType() != DataScriptParserTokenTypes.IMPORT)
break;
String pkgFileName = getPackageFile(node);
if (!allPackageFiles.contains(pkgFileName))
{
allPackageFiles.add(pkgFileName);
context.setFileName(pkgFileName);
AST unitRoot = parsePackage();
if (unitRoot != null)
{
rootNode.addChild(unitRoot);
parseImportedPackages(unitRoot);
}
}
}
}
}
private static String getPackageFile(AST node)
{
AST sibling = node.getFirstChild();
String fileName = sibling.getText();
File file = new File(fileName);
while (true)
{
sibling = sibling.getNextSibling();
if (sibling == null)
break;
file = new File(file, sibling.getText());
}
return file.getPath() + ".ds";
}
private AST parsePackage() throws Exception
{
String pkgFileName = ToolContext.getFullName();
System.out.println("Parsing " + pkgFileName);
// set up lexer, parser and token buffer
try
{
FileInputStream is = new FileInputStream(pkgFileName);
DataScriptLexer lexer = new DataScriptLexer(is);
lexer.setFilename(pkgFileName);
lexer.setTokenObjectClass("datascript.antlr.util.FileNameToken");
TokenStreamHiddenTokenFilter filter = new TokenStreamHiddenTokenFilter(
lexer);
filter.discard(DataScriptParserTokenTypes.WS);
filter.discard(DataScriptParserTokenTypes.COMMENT);
filter.hide(DataScriptParserTokenTypes.DOC);
parser = new DataScriptParser(filter);
}
catch (java.io.FileNotFoundException fnfe)
{
ToolContext.logError((parser == null) ? null : (TokenAST) parser
.getAST(), fnfe.getMessage());
}
if (parser == null)
return null;
parser.setContext(context);
// must call this to see file name in error messages
parser.setFilename(pkgFileName);
// use custom node class containing line information
parser.setASTNodeClass("datascript.antlr.util.TokenAST");
// parse file and get root node of syntax tree
parser.translationUnit();
AST retVal = parser.getAST();
if (context.getErrorCount() != 0 || retVal == null)
throw new ParserException("DataScriptParser: Parser errors.");
String pkgName = ToolContext.getFileName();
pkgName = pkgName.substring(0, pkgName.lastIndexOf(".ds"));
TokenAST node = (TokenAST) retVal.getFirstChild();
if (node.getType() != DataScriptParserTokenTypes.PACKAGE
|| node.getText().equals(pkgName))
ToolContext.logWarning(node,
"filename and package name do not match!");
return retVal;
}
/******** Implementation of Parameters interface ********/
public String getVersion()
{
return VERSION;
}
public boolean getCheckSyntax()
{
return checkSyntax;
}
public String getPathName()
{
return srcPathName;
}
public String getOutPathName()
{
return outPathName;
}
public String getFileName()
{
return fileName;
}
public DataScriptParser getParser()
{
return parser;
}
public boolean argumentExists(String key)
{
return cli.hasOption(key);
}
public String getCommandlineArg(String key) throws Exception
{
if (!cli.hasOption(key))
throw new Exception(key + " is non of the commandline arguments.");
return cli.getOptionValue(key);
}
/******** End of Parameters interface ******* */
private void execute(String[] args)
{
try
{
prepareExtensions();
parseArguments(args);
if (!checkArguments() || cli.hasOption('h'))
{
org.apache.commons.cli.HelpFormatter hf =
new org.apache.commons.cli.HelpFormatter();
hf.printHelp("rds <options> \"filename\"", "options are:",
rdsOptionsToAccept,
"\t\"filename\" main DataScript source file", false);
printExtensions();
}
else
{
parseDatascript();
emitDatascript();
}
}
catch (ParseException pe)
{
HelpFormatter hf = new HelpFormatter();
hf.printHelp(pe.getMessage(), rdsOptionsToAccept);
}
catch (DataScriptException exc)
{
System.err.println(exc);
}
catch (TokenStreamRecognitionException exc)
{
System.err.println(exc);
}
catch (Exception exc)
{
exc.printStackTrace();
}
}
public static void main(String[] args)
{
System.out.println(VERSION);
DataScriptTool dsTool = new DataScriptTool();
dsTool.execute(args);
System.out.println("done.");
}
}
| [
"hwellmann@7eccfe4a-4f19-0410-86c7-be9599f3b344"
] | hwellmann@7eccfe4a-4f19-0410-86c7-be9599f3b344 |
97893de18737948c6c4df2b94bcd50254ab982dc | fc49733b483e25105ed1a30c99641e4d4b8de065 | /gomall-ware/src/main/java/cn/jinterest/ware/config/MyRabbitConfig.java | b5bf80d356aadc720d2586905c2d4933f5ffaecc | [] | no_license | Jaredhi/GoMall | a1c8da9b0305992d94264828d05c430686f5d765 | 5f6ec50f799023c9390559681812b5d862a0c702 | refs/heads/master | 2023-04-16T08:50:33.796354 | 2021-04-30T05:22:52 | 2021-04-30T05:22:52 | 308,263,952 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,513 | java | package cn.jinterest.ware.config;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.Exchange;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.HashMap;
@Slf4j
@Configuration
public class MyRabbitConfig {
/**
* 定义RabbitMQ序列化器
* @return
*/
@Bean
public MessageConverter messageConverter() {
return new Jackson2JsonMessageConverter();
}
// @RabbitListener(queues = {"stock.release.stock.queue"})
// public void handle(Message message) {
// //服务第一次连上rabbitMQ会创建队列,如果没有就随便监听一个想要创建的队列,通知rabbitMQ
// }
/**
* 交换机
* @return
*/
@Bean
public Exchange stockEventExchange() {
return new TopicExchange("stock-event-exchange", true, false);
}
/**
* 普通队列
* @return
*/
@Bean
public Queue stockReleaseStockQueue() {
return new Queue("stock.release.stock.queue", true, false, false);
}
/**
* 延迟队列
* @return
*/
@Bean
public Queue stockDelayQueue() {
HashMap<String, Object> arguments = new HashMap<>();
arguments.put("x-dead-letter-exchange", "stock-event-exchange");
arguments.put("x-dead-letter-routing-key", "stock.release");
arguments.put("x-message-ttl", 120000); // 消息过期时间 2分钟
return new Queue("stock.delay.queue", true, false, false, arguments);
}
/**
* 交换机与普通队列绑定
* @return
*/
@Bean
public Binding stockReleaseBinding() {
return new Binding("stock.release.stock.queue",
Binding.DestinationType.QUEUE,
"stock-event-exchange",
"stock.release.#",
null);
}
/**
* 交换机与延迟队列绑定
* @return
*/
@Bean
public Binding stockLockedBinding() {
return new Binding("stock.delay.queue",
Binding.DestinationType.QUEUE,
"stock-event-exchange",
"stock.locked",
null);
}
}
| [
"hwj2586@163.com"
] | hwj2586@163.com |
dea81a81459ebec6f18341d2f5d05ba968914756 | 3dd8779754c58b5c89f2e6c3384464f2abcc4769 | /src/main/java/bots/HttpClient.java | 74e65b12ecf49e879c525513673fee0ee466cb61 | [] | no_license | lazermann111/Cookies | 530c401c5cbc5fa1c6a604381dcbc22e406d4f3b | eada3d6bae6944e9a15dfb732dc1c48a3cc6cfef | refs/heads/master | 2020-03-22T11:28:21.177466 | 2018-08-15T06:06:27 | 2018-08-15T06:06:27 | 139,972,776 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,827 | java | package bots;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.type.CollectionType;
import com.mashape.unirest.http.ObjectMapper;
import com.mashape.unirest.http.Unirest;
import model.CookieClone;
import model.CookieInfoDto;
import model.UserAgent;
import java.io.IOException;
import java.util.Set;
public class HttpClient
{
public static String BASE_URL = "https://coffee-shop-test.herokuapp.com/";
// public static String BASE_URL = "http://localhost:8081/";
static
{
Unirest.setConcurrency(10,10);
com.fasterxml.jackson.databind.ObjectMapper jacksonObjectMapper = new com.fasterxml.jackson.databind.ObjectMapper();
jacksonObjectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
Unirest.setObjectMapper(new ObjectMapper() {
public <T> T readValue(String value, Class<T> valueType) {
try {
return jacksonObjectMapper.readValue(value, valueType);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public String writeValue(Object value) {
try {
return jacksonObjectMapper.writeValueAsString(value);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
}
});
}
public static void addNewCookie(CookieInfoDto cookieInfoDto)
{
try
{
Unirest.post(BASE_URL + "/cookies/addCookie")
.field("proxy", cookieInfoDto.getProxy())
.field("cookie", cookieInfoDto.getCookie())
.field("userAgent", cookieInfoDto.getUserAgent())
.asString();
}
catch (Exception e)
{
e.printStackTrace();
AppiumLogger.log("addNewCookie exception: " + e.getMessage());
}
}
public static void main(String[] args) {
com.fasterxml.jackson.databind.ObjectMapper objectMapper = new com.fasterxml.jackson.databind.ObjectMapper();
CookieInfoDto res = new CookieInfoDto();
UserAgent ua = new UserAgent("sdsdsd", "300","200");
res.setProxy("217.23.3.169:20031");
res.setCookie("jasgdfjgb4b4btfhbvygyubegyfebfdgngnfgn");
try
{
res.setUserAgent(objectMapper.writeValueAsString(ua));
} catch (JsonProcessingException e)
{
e.printStackTrace();
}
HttpClient.addNewCookie(res);
res.setProxy("1");
HttpClient.addNewCookie(res);
res.setProxy("2");
HttpClient.addNewCookie(res);
res.setProxy("3");
HttpClient.addNewCookie(res);
CookieInfoDto a = HttpClient.getCookie("217.23.3.169:20031");
try {
CollectionType javaType = objectMapper.getTypeFactory().constructCollectionType(Set.class, CookieClone.class);
Set<CookieClone> asList = objectMapper.readValue(a.getCookie(), javaType);
// readValue = objectMapper.readValue(, Set.class);
} catch (IOException e)
{
e.printStackTrace();
}
}
public static CookieInfoDto getCookie(String proxy)
{
try
{
return Unirest.get(BASE_URL + "/cookies/getCookie?proxy={proxy}")
.routeParam("proxy", proxy)
.asObject(CookieInfoDto.class)
.getBody();
}
catch (Exception e)
{
//e.printStackTrace();
AppiumLogger.log("getCookie exception: " + e.getMessage());
return null;
}
}
}
| [
"lazermann111@gmail.com"
] | lazermann111@gmail.com |
7986acf9ab59311d6fb028878e2909013c4978ca | 7cc061852ad3d392eb501088b6d53ffdc0a6cd11 | /Map.java | c920153a1d818c49b1754fc1025a8f60fa99e964 | [] | no_license | Nuochen-xu/CP2406-PROJECT | 60d37453b07a60dbd92793333c1eea3251ce71cf | 6a720567af30b1cf8ec6ab3be3bb270fb5b8fc43 | refs/heads/master | 2020-11-29T19:34:26.882311 | 2020-01-22T07:21:05 | 2020-01-22T07:21:05 | 230,200,636 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 168 | java | import java.lang.reflect.Array;
public class Map {
int [] xline = new int[]{0,1,2,3,4,5,6,7,8,9,10};
int [] yline = new int[]{0,1,2,3,4,5,6,7,8,9,10};
}
| [
"noreply@github.com"
] | Nuochen-xu.noreply@github.com |
f52bfca5f8ecaffc06dc7d9a9ebe56e6dd85fc28 | db1cb6be09ad12b2d5d6f2b72ec84c029f89ad80 | /src/main/java/com/rubanlearning/springbootdb/entity/Book.java | 86aecb28ca3c0bb37230ad7c7f4fb08ceb123e8c | [] | no_license | varatharuban/spring-boot-database-access | a8ef2d63e2c7a602fe96c4ea9a353dce0fc84276 | 7691da12dbfd8fbd9599ec078f3f186c2875fd08 | refs/heads/master | 2023-02-01T19:33:50.905465 | 2020-12-20T09:58:51 | 2020-12-20T09:58:51 | 322,989,408 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,024 | java | package com.rubanlearning.springbootdb.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
@Entity
@Table(name = "BOOKS")
public class Book extends BaseEntity {
private static final long serialVersionUID = -8302338464277404827L;
@Column(name = "TITLE")
private String title;
@Column(name = "LANGUAGE")
private String language;
@Column(name = "AUTHOR")
private String author;
@Column(name = "PAGES")
private Integer pages;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getLanguage() {
return language;
}
public void setLanguage(String language) {
this.language = language;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public Integer getPages() {
return pages;
}
public void setPages(Integer pages) {
this.pages = pages;
}
} | [
"developer-at-398378596368"
] | developer-at-398378596368 |
6b21038ee516eec9960cfec173ff5af2e441e1e4 | 9cfa25f6f9547ccbeddf519061b569c52161c5e1 | /src/main/java/com/ingesup/labojava/controller/PublicationController.java | a3313a0317991fe774b1ed9b9e09adcd9f16e9bb | [] | no_license | hesrondev/JAVA-Un-Prof-pour-TOUS | 05f21ce436bb8bdb7029ab428f746106d33b7bee | 67182582a921172bb779657f258ad797117ef11c | refs/heads/master | 2020-12-03T10:28:10.768347 | 2016-04-27T12:33:05 | 2016-04-27T12:33:05 | 45,112,462 | 0 | 0 | null | 2015-10-28T12:58:40 | 2015-10-28T12:58:40 | null | ISO-8859-1 | Java | false | false | 3,620 | java | package com.ingesup.labojava.controller;
import java.util.ArrayList;
import java.util.List;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.SessionAttributes;
import org.springframework.web.context.request.WebRequest;
import org.springframework.web.servlet.ModelAndView;
import com.ingesup.labojava.bean.Annonce;
import com.ingesup.labojava.bean.AnnonceApplication;
import com.ingesup.labojava.bean.Publication;
import com.ingesup.labojava.bean.User;
import com.ingesup.labojava.factory.AnnonceApplicationFactory;
import com.ingesup.labojava.factory.AnnonceFactory;
import com.ingesup.labojava.factory.PublicationFactory;
import com.ingesup.labojava.form.AnnonceApplicationFormBean;
import com.ingesup.labojava.form.AnnonceFormBean;
import com.ingesup.labojava.form.Filter;
import com.ingesup.labojava.form.FilterCategory;
import com.ingesup.labojava.form.PublicationFormBean;
import com.ingesup.labojava.service.UserService;
import com.ingesup.labojava.service.UserServiceImpl;
@Controller
@SessionAttributes("currentUser")
public class PublicationController {
// List de publications
PublicationFormBean publicationfb = new PublicationFormBean();
List<Publication> publications = new ArrayList<Publication>();
// Injection des services
private UserService userService = new UserServiceImpl();
@Autowired(required = true)
@Qualifier(value = "userService")
public void setUserService(UserService us) {
this.userService = us;
}
@ModelAttribute("publiBean")
public PublicationFormBean addPublicationFormBean() {
return new PublicationFormBean();
}
// Méthode POST d'une publication
@RequestMapping(value = "/profile/publications", method = RequestMethod.POST)
public ModelAndView createPubliPost(WebRequest request,
@ModelAttribute("publiBean") @Valid final PublicationFormBean publiFormBean,
final BindingResult bindingResult) {
ModelAndView mView = new ModelAndView();
// S'il y'a des erreurs
if (bindingResult.hasErrors()) {
String formStatus = "Erreur: vérifiez les champs!";
mView.addObject("formStatus", formStatus);
mView.setViewName("profile-private");
return mView;
}
// Vérification de l'utilisateur
User currentUser = (User) request.getAttribute("currentUser", WebRequest.SCOPE_SESSION);
if (currentUser == null) {
String formStatus = "Vous n'êtes pas connecté! Connectez-vous pour publier une publication.";
mView.addObject("notConnectedStatus", formStatus);
mView.setViewName("redirect:/restriction-page");
return mView;
}
// Création de l'annonce
PublicationFactory publicationFactory = new PublicationFactory();
Publication publi = publicationFactory.createPublication(publiFormBean);
currentUser.addPublication(publi);
publi.setUser(currentUser);
System.out.println(currentUser.getPublications().size());
userService.updateUser(currentUser);
mView.addObject("currentUser", userService.getUser(currentUser.getId()));
mView.setViewName("redirect:/profile");
return mView;
}
}
| [
"hesron@live.fr"
] | hesron@live.fr |
f1983f1a6163c3e2b0fa079d12e29dc21218d4b9 | 6b40a92e34bc0ed4443a45ea70f8cbe8fd5c0e53 | /Library/src/androidTest/java/com/ngyb/onoff/ExampleInstrumentedTest.java | 005a4facf35dce540662dc03b400aa2b767498f2 | [] | no_license | nangongyibin/Android_OnOff | f30a5494ab45c79dbbeeb619636caf577ac457e7 | 1a4dfb2697ca081a535e6a5f41bf169d2ffcaf5a | refs/heads/master | 2020-08-21T14:40:31.557433 | 2020-01-04T10:49:55 | 2020-01-04T10:49:55 | 216,181,743 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 719 | java | package com.ngyb.onoff;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.ngyb.aswitch.test", appContext.getPackageName());
}
}
| [
"nangongyibin@gmail.com"
] | nangongyibin@gmail.com |
4fa6e3b85b66db1dfe93712c3a9c7a6d2dac4206 | f697ee873ae03fcebc56da45da3b934c1ef6857e | /src/main/java/br/com/btsoftware/algafood/auth/core/JpaUserDetailsService.java | 9d02bc4b2d8efb2bda0093a1c1d77acb01ce2555 | [] | no_license | Benjamim-Thiago/algafood-auth | 3ee363ede2c770c6b28cab80205ad7411bf27200 | 833c498f3bfcc7225aa9a90239f235f3b162a1cb | refs/heads/master | 2023-03-28T00:12:27.893743 | 2021-03-28T23:11:31 | 2021-03-28T23:11:31 | 341,267,987 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,553 | java | package br.com.btsoftware.algafood.auth.core;
import java.util.Collection;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import br.com.btsoftware.algafood.auth.domain.UserCredentials;
import br.com.btsoftware.algafood.auth.domain.UserRepository;
@Service
public class JpaUserDetailsService implements UserDetailsService {
@Autowired
private UserRepository userRepository;
@Transactional(readOnly = true)
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
UserCredentials user = userRepository.findByEmail(username)
.orElseThrow(() -> new UsernameNotFoundException("Usuário não encontrado com e-mail informado"));
return new AuthUser(user, getAuthorities(user));
}
private Collection<GrantedAuthority> getAuthorities(UserCredentials user) {
return user.getGroups().stream()
.flatMap(Group -> Group.getPermissions().stream())
.map(Permission -> new SimpleGrantedAuthority(Permission.getName().toUpperCase()))
.collect(Collectors.toSet());
}
}
| [
"bebenjamimthiago@gmail.com"
] | bebenjamimthiago@gmail.com |
8266adc9e6752f9a30716424d1688f081af9c53f | 421f0a75a6b62c5af62f89595be61f406328113b | /generated_tests/model_seeding/75_openhre-com.browsersoft.openhre.hl7.impl.config.HL7FieldRepeatableDependingProcessorImpl-0.5-2/com/browsersoft/openhre/hl7/impl/config/HL7FieldRepeatableDependingProcessorImpl_ESTest.java | 8bf4e52cc09efdc961b56a4c17a700bdf469db48 | [] | no_license | tigerqiu712/evosuite-model-seeding-empirical-evaluation | c78c4b775e5c074aaa5e6ca56bc394ec03c2c7c6 | 11a920b8213d9855082d3946233731c843baf7bc | refs/heads/master | 2020-12-23T21:04:12.152289 | 2019-10-30T08:02:29 | 2019-10-30T08:02:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 725 | java | /*
* This file was automatically generated by EvoSuite
* Tue Oct 29 09:56:48 GMT 2019
*/
package com.browsersoft.openhre.hl7.impl.config;
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(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true, useJEE = true)
public class HL7FieldRepeatableDependingProcessorImpl_ESTest extends HL7FieldRepeatableDependingProcessorImpl_ESTest_scaffolding {
@Test
public void notGeneratedAnyTest() {
// EvoSuite did not generate any tests
}
}
| [
"pderakhshanfar@bsr01.win.tue.nl"
] | pderakhshanfar@bsr01.win.tue.nl |
4feb37d029b19f13d7247365192fe0732f519e68 | 57e0fa7f10659a276fdfb2c74735e9ef0d23182b | /Spring-00-LooselyCoupled/src/service/MentorAccount.java | 03ceb6e09cba55e0ec73caf5dce63dd3fc494583 | [] | no_license | ieroglu251/SpringProject1 | 845db7a738d160025e35870c28d1171524743dc1 | 5091f62799c1fdcef0315cd0107e3c3733ebaff1 | refs/heads/main | 2023-03-21T01:18:21.884564 | 2021-03-07T14:07:51 | 2021-03-07T14:07:51 | 304,896,855 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 257 | java | package service;
import implementation.Mentor;
public class MentorAccount {
Mentor mentor;
public MentorAccount(Mentor mentor) {
this.mentor = mentor;
}
public void manageAcoount(){
this.mentor.createAccount();
}
}
| [
"ieroglu251@gmail.com"
] | ieroglu251@gmail.com |
93dc75aa400199e63ac12a12dbc8b73b618cf379 | d097f1526995a387e9adf4c30db7aa5b6b218fdd | /src/com/cqgy/bean/UserInfo.java | 4613aaf5a31b2065705cf3ecc1d6c27fe9f1c9f0 | [] | no_license | teaping/imitateQQ | 8da38825b7050144cfa756bc9bc0a333e495c333 | c08c4028d77a81ae1b34b75525d908f12598e08e | refs/heads/master | 2023-03-28T06:43:21.028212 | 2021-03-22T03:09:50 | 2021-03-22T03:09:50 | 350,189,085 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 2,403 | java | package com.cqgy.bean;
public class UserInfo {
//用户昵称
private String nickname;
//用户ID
private String Id;
//用户个性签名
private String Autograph;
//用户性别
private String Gender;
//用户生日
private String Birthday;
//用户所在地
private String Location;
//用户学校
private String School;
//用户公司
private String company;
//用户职业
private String job;
//状态
private String statu;
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public String getId() {
return Id;
}
public void setId(String id) {
Id = id;
}
public String getAutograph() {
return Autograph;
}
public void setAutograph(String autograph) {
Autograph = autograph;
}
public String getGender() {
return Gender;
}
public void setGender(String gender) {
Gender = gender;
}
public String getBirthday() {
return Birthday;
}
public void setBirthday(String birthday) {
Birthday = birthday;
}
public String getLocation() {
return Location;
}
public void setLocation(String location) {
Location = location;
}
public String getSchool() {
return School;
}
public void setSchool(String school) {
School = school;
}
public String getCompany() {
return company;
}
public void setCompany(String company) {
this.company = company;
}
public String getJob() {
return job;
}
public void setJob(String job) {
this.job = job;
}
public String getStatu() {
return statu;
}
public void setStatu(String statu) {
this.statu = statu;
}
public UserInfo(String nickname, String id, String autograph, String gender, String birthday, String location,
String school, String company, String job, String statu) {
super();
this.nickname = nickname;
Id = id;
Autograph = autograph;
Gender = gender;
Birthday = birthday;
Location = location;
School = school;
this.company = company;
this.job = job;
this.statu = statu;
}
public UserInfo() {
super();
}
public UserInfo( String id,String nickname, String autograph, String gender, String birthday, String location,
String school, String company, String job) {
super();
this.nickname = nickname;
Id = id;
Autograph = autograph;
Gender = gender;
Birthday = birthday;
Location = location;
School = school;
this.company = company;
this.job = job;
}
}
| [
"small_xia.126com"
] | small_xia.126com |
3c9233c6696d18d35131541333ff6acf19cd43e0 | 7838ffd4293d3ece34b570842fc3fff80278a469 | /src/main/java/twitter4j/http/PostParameter.java | 6c15d01f3ca6c2ee7af1d2bde1bfaddd891cd4a3 | [
"BSD-3-Clause",
"JSON"
] | permissive | huxi/twitter4j | 9c1c234c9fccfad4805be05ccf598dc7f9a24cbf | 7cc033a0e9b1f27aefa4a95a5213003a74d242c3 | refs/heads/master | 2021-01-16T21:11:36.003997 | 2009-12-31T07:56:57 | 2009-12-31T07:56:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,057 | java | /*
Copyright (c) 2007-2009, Yusuke Yamamoto
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the Yusuke Yamamoto nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY Yusuke Yamamoto ``AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL Yusuke Yamamoto BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package twitter4j.http;
import java.io.File;
import java.util.List;
/**
* A data class representing HTTP Post parameter
* @author Yusuke Yamamoto - yusuke at mac.com
*/
public class PostParameter implements Comparable, java.io.Serializable {
String name = null;
String value = null;
File file = null;
private static final long serialVersionUID = -8708108746980739212L;
public PostParameter(String name, String value) {
this.name = name;
this.value = value;
}
public PostParameter(String name, File file) {
this.name = name;
this.file = file;
}
public PostParameter(String name, double value) {
this.name = name;
this.value = String.valueOf(value);
}
public PostParameter(String name, int value) {
this.name = name;
this.value = String.valueOf(value);
}
public PostParameter(String name, boolean value) {
this.name = name;
this.value = String.valueOf(value);
}
public String getName(){
return name;
}
public String getValue(){
return value;
}
public boolean isFile(){
return null != file;
}
private static final String JPEG = "image/jpeg";
private static final String GIF = "image/gif";
private static final String PNG = "image/png";
private static final String OCTET = "application/octet-stream";
/**
*
* @return content-type
*/
public String getContentType() {
if (!isFile()) {
throw new IllegalStateException("not a file");
}
String contentType;
String extensions = file.getName();
int index = extensions.lastIndexOf(".");
if (-1 == index) {
// no extension
contentType = OCTET;
} else {
extensions = extensions.substring(extensions.lastIndexOf(".") + 1).toLowerCase();
if (extensions.length() == 3) {
if ("gif".equals(extensions)) {
contentType = GIF;
} else if ("png".equals(extensions)) {
contentType = PNG;
} else if ("jpg".equals(extensions)) {
contentType = JPEG;
} else {
contentType = OCTET;
}
} else if (extensions.length() == 4) {
if ("jpeg".equals(extensions)) {
contentType = JPEG;
} else {
contentType = OCTET;
}
} else {
contentType = OCTET;
}
}
return contentType;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof PostParameter)) return false;
PostParameter that = (PostParameter) o;
if (file != null ? !file.equals(that.file) : that.file != null)
return false;
if (!name.equals(that.name)) return false;
if (value != null ? !value.equals(that.value) : that.value != null)
return false;
return true;
}
/*package*/ static boolean containsFile(PostParameter[] params) {
boolean containsFile = false;
if(null == params){
return false;
}
for (PostParameter param : params) {
if (param.isFile()) {
containsFile = true;
break;
}
}
return containsFile;
}
/*package*/ static boolean containsFile(List<PostParameter> params) {
boolean containsFile = false;
for (PostParameter param : params) {
if (param.isFile()) {
containsFile = true;
break;
}
}
return containsFile;
}
@Override
public int hashCode() {
int result = name.hashCode();
result = 31 * result + (value != null ? value.hashCode() : 0);
result = 31 * result + (file != null ? file.hashCode() : 0);
return result;
}
@Override
public String toString() {
return "PostParameter{" +
"name='" + name + '\'' +
", value='" + value + '\'' +
", file=" + file +
'}';
}
public int compareTo(Object o) {
int compared;
PostParameter that = (PostParameter) o;
compared = name.compareTo(that.name);
if (0 == compared) {
compared = value.compareTo(that.value);
}
return compared;
}
}
| [
"yusuke@117b7e0d-5933-0410-9d29-ab41bb01d86b"
] | yusuke@117b7e0d-5933-0410-9d29-ab41bb01d86b |
fedc1e6a3e8c53d6577c704256af49e3b543a0f3 | c0e4f17244d8b5e38f9ee92cc56116216fbe07c9 | /Miinaharava/src/main/java/miinaharava/gui/PeliIkkuna.java | b5b0f5e18ac29f694029382681b409ae99597c76 | [] | no_license | anti-l/Miinaharava | b08d0df7106ff2a1da1874b5e4b18a93b548b4a9 | 1efdf8fcdbafedf2aaebb6f2360744b111c2c71d | refs/heads/master | 2021-01-10T21:28:18.927363 | 2014-10-17T15:26:06 | 2014-10-17T15:26:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,514 | java | package miinaharava.gui;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.io.InputStream;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.WindowConstants;
import miinaharava.domain.*;
import miinaharava.sovelluslogiikka.*;
/**
* PeliIkkuna on luokka, joka sisältää pelilaudan nappeineen. PeliIkkunan
* tekemät toiminnot ohjataan pelin SovellusLogiikalle.
*
* @author Antti
*/
public class PeliIkkuna implements Runnable {
private JFrame frame;
private Ruudukko ruudukko;
private Sovelluslogiikka sovelluslogiikka;
private RuutuNappi[][] napisto;
private ImageIcon lippuKuva = new ImageIcon(getClass().getResource("/flag.gif"));
private ImageIcon miinaKuva = new ImageIcon(getClass().getResource("/minesweeper.gif"));
private PeliKello peliKello;
private JLabel miinaTeksti;
/**
* Konstruktori, joka luo uuden pelilaudan. Konstruktori saa parametrinään
* pelin sovelluslogiikan, jonka kautta peli toimii.
* @param sovelluslogiikka Käytettävä sovelluslogiikka
*/
public PeliIkkuna(Sovelluslogiikka sovelluslogiikka) {
this.sovelluslogiikka = sovelluslogiikka;
this.ruudukko = sovelluslogiikka.getRuudukko();
}
/**
* Metodi, joka luo ikkunan komponentit, säätää sen koon sopivaksi siten,
* että pelilaudan napit ovat noin saman kokoisia eri vaikeustasoilla, ja
* säätää pelilaudan näkyväksi.
*/
@Override
public void run() {
frame = new JFrame("Miinaharava");
frame.setPreferredSize(new Dimension(ruudukko.getKorkeus()*40, ruudukko.getLeveys()*40+50));
frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
luoKomponentit(frame.getContentPane());
frame.pack();
frame.setVisible(true);
Thread kello = new Thread(peliKello);
kello.start();
peliKello.kelloKayntiin();
}
/**
* Metodi, joka luo PeliIkkunan komponentit eli pelilaudan napit ja muut
* ikkunan osat.
* @param container framen contentpane.
*/
public void luoKomponentit(Container container) {
BorderLayout leiska = new BorderLayout();
container.setLayout(leiska);
String vaikeustaso = "";
if (ruudukko.getLeveys() == 10) {
vaikeustaso = "(helppo)";
} else if (ruudukko.getLeveys() == 15) {
vaikeustaso = "(keskivaikea)";
} else if (ruudukko.getLeveys() == 20) {
vaikeustaso = "(vaikea)";
}
JPanel ylaPalkki = new JPanel();
JButton vihjeNappi = new JButton("Vihje");
JLabel aikaKentta = new JLabel("Aika: ");
JLabel kelloKentta = new JLabel("0:00");
peliKello = new PeliKello(kelloKentta, sovelluslogiikka);
vihjeNappi.addActionListener(new VihjeKuuntelija(vihjeNappi, sovelluslogiikka, this, peliKello));
JLabel miinaOtsikko = new JLabel("Miinoja:");
miinaTeksti = new JLabel("" + ruudukko.getMiinoja());
ylaPalkki.add(miinaOtsikko);
ylaPalkki.add(miinaTeksti);
ylaPalkki.add(vihjeNappi);
ylaPalkki.add(aikaKentta);
ylaPalkki.add(kelloKentta);
container.add(ylaPalkki, BorderLayout.NORTH);
JPanel nappiruudukko = luoNapit(ruudukko.getLeveys(), ruudukko.getKorkeus());
container.add(nappiruudukko);
}
/**
* Erillinen metodi pelilaudan nappien eli pelilaudan ruudukon luomiselle.
* Tätä kutsutaan luoKomponentit() -metodista pelilaudan muodostamisen
* yhteydessä.
*
* Metodi luo pelilaudan vaikeustason mukaisesti pelilaudan nappiruudukon
* ja asettaa niille kuuntelijat.
* @param x Nappiruudukon koko leveyssuunnassa
* @param y Nappiruudukon koko pystysuunnassa
* @return Valmis nappiruudukko.
*/
public JPanel luoNapit(int x, int y) {
JPanel miinanapit = new JPanel(new GridLayout(x, y));
this.napisto = new RuutuNappi[x][y];
for (int i = 0; i < x; i++) {
for (int j = 0; j < y; j++) {
this.napisto[i][j] = new RuutuNappi();
this.napisto[i][j].addMouseListener(new NapinKuuntelija(sovelluslogiikka, this, i, j));
miinanapit.add(this.napisto[i][j]);
}
}
return miinanapit;
}
/**
* Metodi, joka ilmoittaa pelaajalle häviöstä tämän osuttua miinaan.
*/
public void gameOver() {
peliKello.pysaytaKello();
JOptionPane.showMessageDialog(null, "Osuit miinaan ja hävisit!\nPeli on ohi.", "Miinaharava", JOptionPane.INFORMATION_MESSAGE, miinaKuva);
}
/**
* Metodi, joka pelilaudan ruudun tarkastettua poistaa sen käytöstä, jotta
* sitä ei voi valita enää uudelleen.
* @param x Napin x-koordinaatti
* @param y Napin y-koordinaatti
*/
public void painaNappiAlas(int x, int y) {
napisto[x][y].setEnabled(false);
}
/**
* Metodi asettaa peliruudukolle tarkastettuihin ruutuihin tekstin, joka
* kertoo, kuinka monta miinaa viereisissä ruuduissa yhteensä on.
* @param x Napin x-koordinaatti
* @param y Napin y-koordinaatti
* @param teksti Nappiin asetettava teksti
*/
public void asetaNapinTeksti(int x, int y, String teksti) {
napisto[x][y].setText(teksti);
}
/**
* Metodi asettaa pelilaudan nappiruudukkoon haluttuihin koordinaatteihin
* lipun, ja kertoo sovelluslogiikalle, että kyseinen ruutu on liputettu.
* @param x Liputettavan ruudun x-koordinaatti
* @param y Liputettavan ruudun y-koordinaatti
*/
public void liputa(int x, int y) {
if (ruudukko.getRuutu(x, y).getLiputettu() == false && ruudukko.getRuutu(x, y).getKatsottu() == false) {
napisto[x][y].setIcon(lippuKuva);
miinojaVahenna();
} else {
napisto[x][y].setIcon(null);
miinojaLisaa();
}
}
/**
* Pelaajan painettua pelilaudan nappia, joka sisältää miinan, kutsutaan
* tätä metodia. Se muuttaa napin taustan punaiseksi ja paljastaa miinalogon
* napin päälle.
* @param x Miinan sisältävän ruudun x-koordinaatti
* @param y Miinan sisältävän ruudun y-koordinaatti
*/
public void miinoita(int x, int y) {
napisto[x][y].setBackground(Color.RED);
napisto[x][y].setIcon(miinaKuva);
}
/**
* Metodi, joka kertoo pelaajalle hänen onnistuneen pelissä ja voittaneen
* sen. Pelaajalle kerrotaan myös pelikentän pelaamiseen kulunut aika.
*
* @param aika Pelin voittamiseen kulunut aika sekunneissa.
*/
public void peliVoitettu(long aika) {
peliKello.pysaytaKello();
if (sovelluslogiikka.paaseekoListalle() == false) {
JOptionPane.showMessageDialog(null, "Onneksi olkoon, voitit pelin!\nAika: " + aika + " sekuntia.", "Miinaharava", JOptionPane.INFORMATION_MESSAGE, lippuKuva);
} else {
String nimi = JOptionPane.showInputDialog(null, "Onneksi olkoon, voitit pelin ja pääsit parhaiden tulosten listalle! \nAikasi oli " + aika + " sekuntia.\n\nAnna nimesi:", "Miinaharava", JOptionPane.INFORMATION_MESSAGE);
if (nimi == null || nimi.isEmpty() ) {
nimi = "Anonymous";
}
sovelluslogiikka.sijoitaTulos((int) aika, nimi);
}
}
/**
* Tämä metodi käy läpi koko pelilaudan ja tarkastaa sen ruudut. Jos metodi
* löytää ruudun, joka on jo katsottu, se painaa sitä vastaavan napin alas.
* Tätä metodia kutsutaan NapinKuuntelijasta, kun nappia painetaan hiirellä.
*
*/
public void paivitaNapit() {
Ruutu ruutu;
for (int i = 0; i < ruudukko.getLeveys(); i++) {
for (int j = 0; j < ruudukko.getKorkeus(); j++) {
ruutu = ruudukko.getRuutu(i, j);
if (ruutu.getKatsottu()) {
if (ruutu.onkoMiinaa() == false) {
this.painaNappiAlas(i, j);
this.asetaNapinTeksti(i, j, sovelluslogiikka.ruudunTeksti(i, j));
}
}
}
}
}
/**
* Metodi, joka pelin loppuessa häviöön paljastaa ruudukossa olevien
* liputtamattomien miinojen paikat.
*/
public void naytaMiinat() {
Ruutu ruutu;
for (int i = 0; i < ruudukko.getLeveys(); i++) {
for (int j = 0; j < ruudukko.getKorkeus(); j++) {
ruutu = ruudukko.getRuutu(i, j);
if (ruutu.onkoMiinaa() && ruutu.getLiputettu() == false) {
napisto[i][j].setIcon(miinaKuva);
}
if (ruutu.getLiputettu() && ruutu.onkoMiinaa() == false) {
napisto[i][j].setBackground(Color.GRAY);
}
}
}
}
/**
* Metodi näyttää peliruudukolta yhden miinan, jota ei ole vielä löydetty.
* Miinan paikka näytetään muuttamalla sen väri oranssiksi.
* @param x napin x-koordinaatti
* @param y napin y-koordinaatti
*/
public void naytaVihje(int x, int y) {
if (x >= 0 && x <= napisto.length) {
if (y >= 0 && y <= napisto[0].length) {
napisto[x][y].setBackground(Color.ORANGE);
napisto[x][y].setIcon(lippuKuva);
}
}
}
/**
* Vähentää PeliIkkunan miinatekstikentästä yhden miinan.
*/
public void miinojaVahenna() {
int miinat = Integer.parseInt(miinaTeksti.getText());
miinat--;
miinaTeksti.setText("" + miinat);
}
/**
* Lisää PeliIkkunan miinatekstikenttään yhden miinan.
*/
public void miinojaLisaa() {
int miinat = Integer.parseInt(miinaTeksti.getText());
miinat++;
miinaTeksti.setText("" + miinat);
}
}
| [
"git@lun.fi"
] | git@lun.fi |
05a16f58f8bb638af3f0ed91aba4ba0b86ecf07d | d63362d78de90d5c37b75bc73ca77f241affafb3 | /src/LoanAssistantProject1/LoanAssistant.java | 191216e1ea410764bb481679c3db796e10e7b0e2 | [] | no_license | JadduMeghana123/InternshipJavaProject1 | 01ecaa7c4bf697c2b1d673ad418c356de0493b12 | c1ce2513034eb3060e1917829e9677a5696fce15 | refs/heads/main | 2023-08-12T22:52:19.094581 | 2021-10-02T05:42:46 | 2021-10-02T05:42:46 | 412,701,235 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,546 | java | package LoanAssistantProject1;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.text.*;
public class LoanAssistant extends JFrame {
JLabel balanceLabel = new JLabel();
JTextField balanceTextField = new JTextField();
JLabel interestLabel
= new JLabel();
JTextField interestTextField = new JTextField();
JLabel monthsLabel = new JLabel();
JTextField monthsTextField = new JTextField();
JLabel paymentLabel = new JLabel();
JTextField paymentTextField = new JTextField();
JLabel analysisLabel = new JLabel();
JTextArea analysisTextArea = new JTextArea();
JButton exitButton = new JButton();
JButton monthsButton = new JButton();
JButton paymentButton = new JButton();
JButton computeButton = new JButton();
JButton newLoanButton = new JButton();
Color lightYellow = new Color(255, 255,128);
boolean computePayment;
public static void main(String[] args) {
new LoanAssistant().show();
}
public LoanAssistant() {
setTitle("Loan Assistant");
setResizable(true);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent evt) {
exitForm(evt);
}
});
getContentPane().setLayout(new GridBagLayout());
GridBagConstraints gridConstraints;
pack();
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
setBounds((int) (0.5 * (screenSize.width - getWidth())), (int) (0.5 * (screenSize.height - getHeight())), getWidth(), getHeight());
Font myFont = new Font("Arial", Font.PLAIN, 16);
balanceLabel.setText("Loan Balance");
balanceLabel.setFont(myFont);
gridConstraints = new GridBagConstraints();
gridConstraints.gridx = 0;gridConstraints.gridy = 0;
gridConstraints.anchor = GridBagConstraints.WEST;
gridConstraints.insets = new Insets(10, 10, 0, 0);
getContentPane().add(balanceLabel, gridConstraints);
balanceTextField.setPreferredSize(new Dimension(100, 25));
balanceTextField.setHorizontalAlignment(SwingConstants.RIGHT);
balanceTextField.setFont(myFont);
balanceTextField.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
balanceTextFieldActionPerformed(e);
}
});
gridConstraints = new GridBagConstraints();
gridConstraints.gridx = 1;gridConstraints.gridy = 0;
gridConstraints.insets = new Insets(10, 10, 0, 10);
getContentPane().add(balanceTextField, gridConstraints);
interestLabel.setText("Interest Rate");
interestLabel.setFont(myFont);
gridConstraints = new GridBagConstraints();
gridConstraints.gridx = 0;gridConstraints.gridy = 1;
gridConstraints.anchor = GridBagConstraints.WEST;
gridConstraints.insets = new Insets(10, 10, 0, 0);
getContentPane().add(interestLabel, gridConstraints);
interestTextField.setPreferredSize(new Dimension(100, 25));
interestTextField.setHorizontalAlignment(SwingConstants.RIGHT);
interestTextField.setFont(myFont);
interestTextField.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
interestTextFieldActionPerformed(e);
}
});
gridConstraints = new GridBagConstraints();
gridConstraints.gridx = 1;
gridConstraints.gridy = 1;
gridConstraints.insets = new Insets(10, 10, 0, 10);
getContentPane().add(interestTextField, gridConstraints);
monthsLabel.setText("Number of Payments");
monthsLabel.setFont(myFont);
gridConstraints = new GridBagConstraints();
gridConstraints.gridx = 0;
gridConstraints.gridy = 2;
gridConstraints.anchor = GridBagConstraints.WEST;
gridConstraints.insets = new Insets(10, 10, 0, 0);
getContentPane().add(monthsLabel, gridConstraints);
monthsTextField.setPreferredSize(new Dimension(100, 25));
monthsTextField.setHorizontalAlignment(SwingConstants.RIGHT);
monthsTextField.setFont(myFont);
monthsTextField.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
monthsTextFieldActionPerformed(e);
}
});
gridConstraints = new GridBagConstraints();
gridConstraints.gridx = 1;
gridConstraints.gridy = 2;
gridConstraints.insets = new Insets(10, 10, 0, 10);
getContentPane().add(monthsTextField, gridConstraints);
paymentLabel.setText("Monthly Payment");
paymentLabel.setFont(myFont);
gridConstraints = new GridBagConstraints();
gridConstraints.gridx = 0;
gridConstraints.gridy = 3;
gridConstraints.anchor = GridBagConstraints.WEST;
gridConstraints.insets = new Insets(10, 10, 0, 0);
getContentPane().add(paymentLabel, gridConstraints);
paymentTextField.setPreferredSize(new Dimension(100, 25));
paymentTextField.setHorizontalAlignment(SwingConstants.RIGHT);
paymentTextField.setFont(myFont);
paymentTextField.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
paymentTextFieldActionPerformed(e);
}
});
gridConstraints = new GridBagConstraints();
gridConstraints.gridx = 1;
gridConstraints.gridy = 3;
gridConstraints.insets = new Insets(10, 10, 0, 10);
getContentPane().add(paymentTextField, gridConstraints);
computeButton.setText("Compute Monthly Payment");
gridConstraints = new GridBagConstraints();
gridConstraints.gridx = 0;
gridConstraints.gridy = 4;
gridConstraints.gridwidth = 2;
gridConstraints.insets = new Insets(10, 0, 0, 0);
getContentPane().add(computeButton, gridConstraints);
computeButton.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
computeButtonActionPerformed(e);
}
});
newLoanButton.setText("New Loan Analysis");
newLoanButton.setEnabled(false);
gridConstraints = new GridBagConstraints();
gridConstraints.gridx = 0;
gridConstraints.gridy = 5;
gridConstraints.gridwidth = 2;
gridConstraints.insets = new Insets(10, 0, 10, 0);
getContentPane().add(newLoanButton, gridConstraints);
newLoanButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
newLoanButtonActionPerformed(e);
}
});
monthsButton.setText("X");
monthsButton.setFocusable(false);
gridConstraints = new GridBagConstraints();
gridConstraints.gridx = 2;
gridConstraints.gridy = 2;
gridConstraints.insets = new Insets(10, 0, 0, 0);
getContentPane().add(monthsButton, gridConstraints);
monthsButton.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
monthsButtonActionPerformed(e);
}
});
paymentButton.setText("X");
paymentButton.setFocusable(false);
gridConstraints = new GridBagConstraints();
gridConstraints.gridx = 2;
gridConstraints.gridy = 3;
gridConstraints.insets = new Insets(10, 0, 0, 0);
getContentPane().add(paymentButton, gridConstraints);
paymentButton.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
paymentButtonActionPerformed(e);
}
});
analysisLabel.setText("Loan Analysis:");
analysisLabel.setFont(myFont);
gridConstraints = new GridBagConstraints();
gridConstraints.gridx = 3;
gridConstraints.gridy = 0;
gridConstraints.anchor = GridBagConstraints.WEST;
gridConstraints.insets = new Insets(0, 10, 0, 0);
getContentPane().add(analysisLabel, gridConstraints);
analysisTextArea.setPreferredSize(new Dimension(250, 150));
analysisTextArea.setFocusable(false);
analysisTextArea.setBorder(BorderFactory.createLineBorder(Color.BLACK));
analysisTextArea.setFont(new Font("Courier New", Font.PLAIN, 14));
analysisTextArea.setEditable(false);
analysisTextArea.setBackground(Color.WHITE);
gridConstraints = new GridBagConstraints();
gridConstraints.gridx = 3;
gridConstraints.gridy = 1;
gridConstraints.gridheight = 4;
gridConstraints.insets = new Insets(0, 10, 0, 10);
getContentPane().add(analysisTextArea, gridConstraints);
exitButton.setText("Exit");
exitButton.setFocusable(false);
gridConstraints = new GridBagConstraints();
gridConstraints.gridx = 3;
gridConstraints.gridy = 5;
getContentPane().add(exitButton, gridConstraints);
exitButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
exitButtonActionPerformed(e);
}
});
paymentButton.doClick();
setSize(700,400);
}
private void balanceTextFieldActionPerformed(ActionEvent e){
balanceTextField.transferFocus();
}
private void interestTextFieldActionPerformed(ActionEvent e){
interestTextField.transferFocus();
}
private void monthsTextFieldActionPerformed(ActionEvent e){
monthsTextField.transferFocus();
}
private void paymentTextFieldActionPerformed(ActionEvent e){
paymentTextField.transferFocus();
}
private void exitButtonActionPerformed(ActionEvent e)
{
System.exit(0);
}
private void monthsButtonActionPerformed(ActionEvent e)
{
computePayment = false;
paymentButton.setVisible(true);
monthsButton.setVisible(false);
monthsTextField.setText("");
monthsTextField.setEditable(false);
monthsTextField.setBackground(lightYellow);
paymentTextField.setEditable(true);
paymentTextField.setBackground(Color.WHITE);
paymentTextField.setFocusable(true);
computeButton.setText("Compute Number of Payments");
balanceTextField.requestFocus();
}
private void paymentButtonActionPerformed(ActionEvent e)
{
computePayment = true;
paymentButton.setVisible(false);
monthsButton.setVisible(true);
monthsTextField.setEditable(true);
monthsTextField.setBackground(Color.WHITE);
monthsTextField.setFocusable(true);
paymentTextField.setText("");
paymentTextField.setEditable(false);
paymentTextField.setBackground(lightYellow);
paymentTextField.setFocusable(false);
computeButton.setText("Compute Monthly Payment");
balanceTextField.requestFocus();
}
private void computeButtonActionPerformed(ActionEvent e)
{
double balance, interest, payment=0.0;
int months;
double monthlyInterest, multiplier;
double loanBalance, finalPayment;
if(validateDecimalNumber(balanceTextField)) {
balance = Double.valueOf(balanceTextField.getText()).doubleValue();
}
else{
JOptionPane.showConfirmDialog(null, "Invalid or empty Loan Balanceentry.\nPlease correct.", "Balance Input Error", JOptionPane.DEFAULT_OPTION,JOptionPane.INFORMATION_MESSAGE);
return;
}
if(validateDecimalNumber(interestTextField)){
interest =Double.valueOf(interestTextField.getText()).doubleValue();
}
else{
JOptionPane.showConfirmDialog(null, "Invalid or empty Interest Rate entry.\nPleasecorrect.", "Interest Input Error", JOptionPane.DEFAULT_OPTION,JOptionPane.INFORMATION_MESSAGE);
return;
}
monthlyInterest = interest / 1200;// Compute loan payment
if(computePayment)
{
if(validateDecimalNumber(monthsTextField))
months = Integer.valueOf(monthsTextField.getText()).intValue();
else{
JOptionPane.showConfirmDialog(null, "Invalid or empty Number of Paymentsentry.\nPlease correct.", "Number of Payments Input Error",JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE);
return;
}
if(interest == 0){
payment = balance / months;
}
else {
multiplier = Math.pow(1 + monthlyInterest, months);
payment = balance * monthlyInterest * multiplier / (multiplier - 1);
}
paymentTextField.setText(new DecimalFormat("0.00").format(payment));
}
else {
if(validateDecimalNumber(paymentTextField))
payment = Double.valueOf(paymentTextField.getText()).doubleValue();
if (payment <= (balance * monthlyInterest + 1.0))
{
if (JOptionPane.showConfirmDialog(null, "Minimum payment must be $" +new DecimalFormat("0.00").format((int)(balance * monthlyInterest + 1.0)) + "\n" + "Do youwant to use the minimum payment?", "Input Error", JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION)
{
paymentTextField.setText(new DecimalFormat("0.00").format((int)(balance * monthlyInterest + 1.0)));
payment =Double.valueOf(paymentTextField.getText()).doubleValue();
}
else
{
paymentTextField.requestFocus();return;
}
}
else {
JOptionPane.showConfirmDialog(null, "Invalid or empty Monthly Paymententry.\nPlease correct.", "Payment Input Error", JOptionPane.DEFAULT_OPTION,JOptionPane.INFORMATION_MESSAGE);
return;
}
if(interest == 0){
months = (int)(balance / payment);
}
else {
months = (int) ((Math.log(payment) - Math.log(payment - balance * monthlyInterest)) / Math.log(1 + monthlyInterest));
}
monthsTextField.setText(String.valueOf(months));
}
payment =Double.valueOf(paymentTextField.getText()).doubleValue();
analysisTextArea.setText("Loan Balance: $" + new DecimalFormat("0.00").format(balance));
analysisTextArea.append("\n" + "Interest Rate: " + new DecimalFormat("0.00").format(interest) + "%");// process all but last payment
loanBalance = balance;
for (int paymentNumber = 1; paymentNumber <= months - 1; paymentNumber++)
{
loanBalance += loanBalance * monthlyInterest - payment;
}// find final payment
finalPayment = loanBalance;
if (finalPayment > payment){// apply one more payment
loanBalance += loanBalance * monthlyInterest - payment;
finalPayment = loanBalance;months++;
monthsTextField.setText(String.valueOf(months));
}
analysisTextArea.append("\n\n" + String.valueOf(months - 1) + " Payments of $" + new DecimalFormat("0.00").format(payment));
analysisTextArea.append("\n" + "Final Payment of: $" + new DecimalFormat("0.00").format(finalPayment));
analysisTextArea.append("\n" + "Total Payments: $" + new DecimalFormat("0.00").format((months - 1) * payment + finalPayment));
analysisTextArea.append("\n" + "Interest Paid $" + new DecimalFormat("0.00").format((months - 1) * payment + finalPayment - balance));
computeButton.setEnabled(false);
newLoanButton.setEnabled(true);
newLoanButton.requestFocus();
}
private void newLoanButtonActionPerformed(ActionEvent e)
{
if(computePayment){
paymentTextField.setText("");
}
else{
monthsTextField.setText("");
}
analysisTextArea.setText("");
computeButton.setEnabled(true);
newLoanButton.setEnabled(false);
balanceTextField.requestFocus();
}
private void exitForm(WindowEvent evt){
System.exit(0);
}
public boolean validateDecimalNumber(JTextField tf){
String s = tf.getText().trim();
boolean hasDecimal = false;
boolean valid = true;
if(s.length() == 0){
valid = false;
}
else{
for(int i=0;i<s.length();i++){
char c = s.charAt(i);
if(c >= '0' && c <= '9'){
continue;
}
else if(c == '.' && !hasDecimal){
hasDecimal = true;
}
else{
valid = false;
}
}
}
tf.setText(s);
if(!valid){
tf.requestFocus();
}
return(valid);
}
}
| [
"noreply@github.com"
] | JadduMeghana123.noreply@github.com |
b2e5199526068a2cff9222bd3f2084fe3f721acf | d31b379ba69fd4ac3ed3744093a4ab7adf23c270 | /src/test/java/com/tw/fixture/ChildClassWithInjectField.java | b42d8475a817b060f47b0e04016d9f4bb6137933 | [] | no_license | aisensiy/injector | fb443c4e60a8e561a9a4715a59db490889d0dc96 | f0a944d8a7cbb2b8458c9ceb3ef41a6967dc7a50 | refs/heads/master | 2021-01-10T14:57:07.365284 | 2015-10-21T09:07:07 | 2015-10-21T09:07:07 | 44,288,454 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 237 | java | package com.tw.fixture;
import javax.inject.Inject;
public class ChildClassWithInjectField extends ParentClassWithInjectField {
@Inject
private Inner innerTwo;
public Inner getInnerTwo() {
return innerTwo;
}
}
| [
"aisensiy@163.com"
] | aisensiy@163.com |
6f7f0929e881a04b9498ad574d8e093d746a8447 | 9168fc4fd7da975198e638903a3fc0e3b5d5893d | /Ausentismo3/src/CIE10/CargarCVS.java | 244685b709fe66e830e717b073314ba248339fff | [] | no_license | luma2906/Ausentismo | af36fa9dcbbd8c3048af86a7bbc1edcd65a1940e | 7de3cf69fe1107b8721c6618016f49d1c87107a3 | refs/heads/master | 2021-06-20T23:45:50.044268 | 2017-08-03T18:30:14 | 2017-08-03T18:30:14 | 99,262,594 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,440 | 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 CIE10;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import com.csvreader.CsvReader;
/**
*
* @author usuario
*/
public class CargarCVS {
public static void main(String[] args) {
try {
List<CIE10> cie10 = new ArrayList<>();
CsvReader cie10_import = new CsvReader("src/CIE10/cie10.csv");
cie10_import.readHeaders();
while (cie10_import.readRecord())
{
String codigo = cie10_import.get("CODIGO");
String diagnostico = cie10_import.get("DIAGNOSTICO");
String apellidos = cie10_import.get("GRUPO");
cie10.add(new CIE10(codigo, diagnostico, apellidos));
}
cie10_import.close();
for(CIE10 c : cie10){
System.out.println("Codigo : "+c.getCodigo()+" Diagnostico: "+c.getDiagnostico()+" Grupo: "+c.getGrupo());
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
| [
"luma2906@gmail.com"
] | luma2906@gmail.com |
1e0daeec8993298c8cd0f7d91f0c5e636d74f777 | a91dfc9e0b66bf9a8b151f1317dc9ab0fcbb03fd | /branches/jchye/converter/java/org/unicode/cldr/test/DisplayAndInputProcessor.java | d941f49c28e77acc47e1e41a33ef959c03ca04b5 | [] | no_license | svn2github/CLDR | 8c28c7d33419b2cf82fa68658c2df400819548c6 | d41ba4ae267526a2bd1dd6ba21259e4dc1afcfa4 | refs/heads/master | 2020-03-10T16:23:08.329258 | 2019-01-17T18:03:40 | 2019-01-17T18:03:40 | 129,472,269 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,357 | java | /* Copyright (C) 2007-2010 Google and others. All Rights Reserved. */
/* Copyright (C) 2007-2010 IBM Corp. and others. All Rights Reserved. */
package org.unicode.cldr.test;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.unicode.cldr.test.CheckExemplars.ExemplarType;
import org.unicode.cldr.util.Builder;
import org.unicode.cldr.util.CLDRFile;
import org.unicode.cldr.util.CLDRLocale;
import org.unicode.cldr.util.CldrUtility;
import org.unicode.cldr.util.With;
import org.unicode.cldr.util.XPathParts;
import com.ibm.icu.dev.test.util.PrettyPrinter;
import com.ibm.icu.lang.UCharacter;
import com.ibm.icu.text.Collator;
import com.ibm.icu.text.DateTimePatternGenerator.FormatParser;
import com.ibm.icu.text.DecimalFormat;
import com.ibm.icu.text.Normalizer;
import com.ibm.icu.text.UnicodeSet;
import com.ibm.icu.text.UnicodeSetIterator;
import com.ibm.icu.util.ULocale;
/**
* Class for processing the input and output of CLDR data for use in the
* Survey Tool and other tools.
*/
public class DisplayAndInputProcessor {
public static final boolean DEBUG_DAIP = CldrUtility.getProperty("DEBUG_DAIP", false);
public static final UnicodeSet RTL = new UnicodeSet("[[:Bidi_Class=Arabic_Letter:][:Bidi_Class=Right_To_Left:]]").freeze();
public static final UnicodeSet TO_QUOTE = (UnicodeSet) new UnicodeSet(
"[[:Cn:]" +
"[:Default_Ignorable_Code_Point:]" +
"[:patternwhitespace:]" +
"[:Me:][:Mn:]]" // add non-spacing marks
).freeze();
public static final Pattern NUMBER_FORMAT_XPATH = Pattern.compile("//ldml/numbers/.*Format\\[@type=\"standard\"]/pattern.*");
private static final Pattern NON_DECIMAL_PERIOD = Pattern.compile("(?<![0#'])\\.(?![0#'])");
private Collator col;
private Collator spaceCol;
private FormatParser formatDateParser = new FormatParser();
private PrettyPrinter pp;
final private CLDRLocale locale;
private static final CLDRLocale MALAYALAM = CLDRLocale.getInstance("ml");
private boolean isPosix;
/**
* Constructor, taking cldrFile.
* @param cldrFileToCheck
*/
public DisplayAndInputProcessor(CLDRFile cldrFileToCheck) {
init(this.locale=CLDRLocale.getInstance(cldrFileToCheck.getLocaleID()));
}
void init(CLDRLocale locale) {
isPosix = locale.toString().indexOf("POSIX") >= 0;
col = Collator.getInstance(locale.toULocale());
spaceCol = Collator.getInstance(locale.toULocale());
pp = new PrettyPrinter().setOrdering(Collator.getInstance(ULocale.ROOT)).setSpaceComparator(Collator.getInstance(ULocale.ROOT).setStrength2(Collator.PRIMARY))
.setCompressRanges(true)
.setToQuote(new UnicodeSet(TO_QUOTE))
.setOrdering(col)
.setSpaceComparator(spaceCol);
}
/**
* Constructor, taking locale.
* @param locale
*/
public DisplayAndInputProcessor(ULocale locale) {
init(this.locale=CLDRLocale.getInstance(locale));
}
/**
* Constructor, taking locale.
* @param locale
*/
public DisplayAndInputProcessor(CLDRLocale locale) {
init(this.locale=locale);
}
/**
* Process the value for display. The result is a string for display in the
* Survey tool or similar program.
*
* @param path
* @param value
* @param fullPath
* @return
*/
public synchronized String processForDisplay(String path, String value) {
if (path.contains("exemplarCharacters")) {
if (value.startsWith("[") && value.endsWith("]")) {
value = value.substring(1, value.length() - 1);
}
value = replace(NEEDS_QUOTE1, value, "$1\\\\$2$3");
value = replace(NEEDS_QUOTE2, value, "$1\\\\$2$3");
// if (RTL.containsSome(value) && value.startsWith("[") && value.endsWith("]")) {
// return "\u200E[\u200E" + value.substring(1,value.length()-2) + "\u200E]\u200E";
// }
} else if (path.contains("stopword")) {
return value.trim().isEmpty() ? "NONE" : value;
} else {
NumericType numericType = NumericType.getNumericType(path);
if (numericType != NumericType.NOT_NUMERIC) {
// Canonicalize existing values that aren't canonicalized yet.
// New values will be canonicalized on input using processInput().
try {
value = getCanonicalPattern(value, numericType, isPosix);
} catch (IllegalArgumentException e) {
if(DEBUG_DAIP) System.err.println("Illegal pattern: " + value);
}
if (numericType != NumericType.CURRENCY) {
value = value.replace("'", "");
}
}
}
return value;
}
static final UnicodeSet WHITESPACE = new UnicodeSet("[:whitespace:]").freeze();
/**
* Process the value for input. The result is a cleaned-up value. For example,
* an exemplar set is modified to be in the normal format, and any missing [ ]
* are added (a common omission on entry). If there are any failures then the
* original value is returned, so that the proper error message can be given.
*
* @param path
* @param value
* @param internalException TODO
* @param fullPath
* @return
*/
public synchronized String processInput(String path, String value, Exception[] internalException) {
String original = value;
if (internalException != null) {
internalException[0] = null;
}
try {
// Normalise Malayalam characters.
if (locale.childOf(MALAYALAM)) {
String newvalue = normalizeMalayalam(value);
if(DEBUG_DAIP) System.out.println("DAIP: Normalized Malayalam '"+value+"' to '"+newvalue+"'");
value = newvalue;
}
// fix grouping separator if space
if (path.startsWith("//ldml/numbers/symbols/group")) {
if (value.equals(" ")) {
value = "\u00A0";
}
}
// all of our values should not have leading or trailing spaces, except insertBetween
if (!path.contains("/insertBetween") && !path.contains("/localeSeparator")) {
value = value.trim();
}
// fix grouping separator if space
if (path.startsWith("//ldml/numbers/symbols")) {
if (value.isEmpty()) {
value = "\u00A0";
}
value = value.replace(' ', '\u00A0');
}
// fix date patterns
if (hasDatetimePattern(path)) {
formatDateParser.set(value);
String newValue = formatDateParser.toString();
if (!value.equals(newValue)) {
value = newValue;
}
}
NumericType numericType = NumericType.getNumericType(path);
if (numericType != NumericType.NOT_NUMERIC) {
if (numericType != NumericType.CURRENCY) {
value = value.replaceAll("([%\u00A4]) ", "$1\u00A0")
.replaceAll(" ([%\u00A4])", "\u00A0$1");
value = replace(NON_DECIMAL_PERIOD, value, "'.'");
}
value = getCanonicalPattern(value, numericType, isPosix);
}
// check specific cases
if (path.contains("/exemplarCharacters")) {
final String iValue = value;
// clean up the user's input.
// first, fix up the '['
value = value.trim();
// remove brackets and trim again before regex
if(value.startsWith("[")) {
value = value.substring(1);
}
if(value.endsWith("]")) {
value = value.substring(0,value.length()-1);
}
value = value.trim();
value = replace(NEEDS_QUOTE1, value, "$1\\\\$2$3");
value = replace(NEEDS_QUOTE2, value, "$1\\\\$2$3");
// re-add brackets.
value = "[" + value + "]";
UnicodeSet exemplar = new UnicodeSet(value);
XPathParts parts = new XPathParts().set(path);
final String type = parts.getAttributeValue(-1, "type");
ExemplarType exemplarType = type == null ? ExemplarType.main : ExemplarType.valueOf(type);
value = getCleanedUnicodeSet(exemplar, pp, exemplarType);
} else if (path.contains("stopword")) {
if (value.equals("NONE")) {
value ="";
}
}
return value;
} catch (RuntimeException e) {
if (internalException != null) {
internalException[0] = e;
}
return original;
}
}
private String replace(Pattern pattern, String value, String replacement) {
String value2 = pattern.matcher(value).replaceAll(replacement);
if (!value.equals(value2)) {
System.out.println("\n" + value + " => " + value2);
}
return value2;
}
private static Pattern UNNORMALIZED_MALAYALAM = Pattern.compile(
"(\u0D23|\u0D28|\u0D30|\u0D32|\u0D33|\u0D15)\u0D4D\u200D");
private static Map<Character, Character> NORMALIZING_MAP =
Builder.with(new HashMap<Character, Character>())
.put('\u0D23', '\u0D7A').put('\u0D28', '\u0D7B')
.put('\u0D30', '\u0D7C').put('\u0D32', '\u0D7D')
.put('\u0D33', '\u0D7E').put('\u0D15', '\u0D7F').get();
/**
* Normalizes the Malayalam characters in the specified input.
* @param value the input to be normalized
* @return
*/
private String normalizeMalayalam(String value) {
// Normalize Malayalam characters.
Matcher matcher = UNNORMALIZED_MALAYALAM.matcher(value);
if (matcher.find()) {
StringBuffer buffer = new StringBuffer();
int start = 0;
do {
buffer.append(value.substring(start, matcher.start(0)));
char codePoint = matcher.group(1).charAt(0);
buffer.append(NORMALIZING_MAP.get(codePoint));
start = matcher.end(0);
} while (matcher.find());
buffer.append(value.substring(start));
value = buffer.toString();
}
return value;
}
static Pattern REMOVE_QUOTE1 = Pattern.compile("(\\s)(\\\\[-\\}\\]\\&])()");
static Pattern REMOVE_QUOTE2 = Pattern.compile("(\\\\[\\-\\{\\[\\&])(\\s)"); //([^\\])([\\-\\{\\[])(\\s)
static Pattern NEEDS_QUOTE1 = Pattern.compile("(\\s|$)([-\\}\\]\\&])()");
static Pattern NEEDS_QUOTE2 = Pattern.compile("([^\\\\])([\\-\\{\\[\\&])(\\s)"); //([^\\])([\\-\\{\\[])(\\s)
public static boolean hasDatetimePattern(String path) {
return path.indexOf("/dates") >= 0
&& ((path.indexOf("/pattern") >= 0 && path.indexOf("/dateTimeFormat") < 0)
|| path.indexOf("/dateFormatItem") >= 0
|| path.contains("/intervalFormatItem"));
}
public static String getCleanedUnicodeSet(UnicodeSet exemplar, PrettyPrinter prettyPrinter, ExemplarType exemplarType) {
String value;
prettyPrinter.setCompressRanges(exemplar.size() > 100);
value = exemplar.toPattern(false);
UnicodeSet toAdd = new UnicodeSet();
for (UnicodeSetIterator usi = new UnicodeSetIterator(exemplar); usi.next(); ) {
String string = usi.getString();
if (string.equals("ß") || string.equals("İ")) {
toAdd.add(string);
continue;
}
if (exemplarType.convertUppercase) {
string = UCharacter.toLowerCase(ULocale.ENGLISH, string);
}
toAdd.add(string);
String composed = Normalizer.compose(string, false);
if (!string.equals(composed)) {
toAdd.add(composed);
}
}
toAdd.removeAll(exemplarType.toRemove);
if (DEBUG_DAIP && !toAdd.equals(exemplar)) {
UnicodeSet oldOnly = new UnicodeSet(exemplar).removeAll(toAdd);
UnicodeSet newOnly = new UnicodeSet(toAdd).removeAll(exemplar);
System.out.println("Exemplar:\t" + exemplarType + ",\tremoved\t" + oldOnly + ",\tadded\t" + newOnly);
}
String fixedExemplar = prettyPrinter.format(toAdd);
UnicodeSet doubleCheck = new UnicodeSet(fixedExemplar);
if (!toAdd.equals(doubleCheck)) {
// something went wrong, leave as is
} else if (!value.equals(fixedExemplar)) { // put in this condition just for debugging
if (DEBUG_DAIP) {
System.out.println(TestMetadata.showDifference(
With.codePoints(value),
With.codePoints(fixedExemplar),
"\n"));
}
value = fixedExemplar;
}
return value;
}
/**
* @return a canonical numeric pattern, based on the type, and the isPOSIX flag. The latter is set for en_US_POSIX.
*/
public static String getCanonicalPattern(String inpattern, NumericType type, boolean isPOSIX) {
// TODO fix later to properly handle quoted ;
DecimalFormat df = new DecimalFormat(inpattern);
if (type == NumericType.DECIMAL_ABBREVIATED) {
return inpattern; // TODO fix when ICU bug is fixed
//df.setMaximumFractionDigits(df.getMinimumFractionDigits());
//df.setMaximumIntegerDigits(Math.max(1, df.getMinimumIntegerDigits()));
} else {
//int decimals = type == CURRENCY_TYPE ? 2 : 1;
int[] digits = isPOSIX ? type.posixDigitCount : type.digitCount;
df.setMinimumIntegerDigits(digits[0]);
df.setMinimumFractionDigits(digits[1]);
df.setMaximumFractionDigits(digits[2]);
}
String pattern = df.toPattern();
//int pos = pattern.indexOf(';');
//if (pos < 0) return pattern + ";-" + pattern;
return pattern;
}
/*
* This tests what type a numeric pattern is.
*/
public enum NumericType {
CURRENCY(new int[]{1,2,2}, new int[]{1,2,2}),
DECIMAL(new int[]{1,0,3}, new int[]{1,0,6}),
DECIMAL_ABBREVIATED(),
PERCENT(new int[]{1,0,0}, new int[]{1,0,0}),
SCIENTIFIC(new int[]{0,0,0}, new int[]{1,6,6}),
NOT_NUMERIC;
private static final Pattern NUMBER_PATH = Pattern.compile("//ldml/numbers/((currency|decimal|percent|scientific)Formats|currencies/currency).*");
private int[] digitCount;
private int[] posixDigitCount;
private NumericType() {};
private NumericType(int[] digitCount, int[] posixDigitCount) {
this.digitCount = digitCount;
this.posixDigitCount = posixDigitCount;
}
/**
* @return the numeric type of the xpath
*/
public static NumericType getNumericType(String xpath) {
Matcher matcher = NUMBER_PATH.matcher(xpath);
if (xpath.indexOf("/pattern") < 0) {
return NOT_NUMERIC;
} else if (matcher.matches()) {
if (matcher.group(1).equals("currencies/currency")) {
return CURRENCY;
} else {
NumericType type = NumericType.valueOf(matcher.group(2).toUpperCase());
if (type == DECIMAL && xpath.contains("=\"1000")) {
type = DECIMAL_ABBREVIATED;
}
return type;
}
} else {
return NOT_NUMERIC;
}
}
public int[] getDigitCount() {
return digitCount;
}
public int[] getPosixDigitCount() {
return posixDigitCount;
}
};
}
| [
"jchye@b1474bd8-1051-4aae-843b-7d7c63456b9e"
] | jchye@b1474bd8-1051-4aae-843b-7d7c63456b9e |
02ffa56228cad093f3a94da8acd0ce9aa4a7f316 | 12562751a6cbf17733fcc43ae2286c8dee36904d | /findme/src/main/java/kr/co/findme/common/file/controller/FileRenamePolicy.java | 2f506f605bf0ce928b28af5c19b8e8ed5ddf1775 | [] | no_license | da2707/findme | 756e6784574c3ef7c5b01c7af1b8f016b5f28077 | 426dcf35650172a63d5c6b27ab13f5e0aa2eb261 | refs/heads/master | 2020-03-17T13:36:55.624440 | 2018-06-14T05:54:48 | 2018-06-14T05:54:48 | 133,638,142 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 81 | java | package kr.co.findme.common.file.controller;
public class FileRenamePolicy {
}
| [
"kimbong30404@hanmail.net"
] | kimbong30404@hanmail.net |
6337f9516c6ab7fbfbcdbe3eff2706610e36021e | fa4e4208c8e797dd22980d9b537787b498ce98b0 | /src/test/java/com/crystalkey/pages/MT_006_Page.java | 9067a754384491116af84d01d55af66e64a77b44 | [] | no_license | MuratTANC/crystalKeyJenkins | 81680c9060ffd1671163a1941c8c394fb3153cb5 | 63395b44f34058a0b7efd74b2a21d13b3660f17c | refs/heads/master | 2023-02-11T08:28:06.778176 | 2021-01-09T11:46:59 | 2021-01-09T11:46:59 | 328,142,861 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,128 | java | package com.crystalkey.pages;
import com.crystalkey.utilities.Driver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
public class MT_006_Page {
public MT_006_Page(){
PageFactory.initElements(Driver.getDriver(), this);
}
@FindBy(linkText = "Log in")
public WebElement ilkLogIn;
@FindBy(id = "UserName")
public WebElement userNameTextBox;
@FindBy(id = "Password")
public WebElement passwordTextBox;
@FindBy(id="btnSubmit")
public WebElement ikinciLoginButonu;
@FindBy(linkText = "Hotel Management")
public WebElement hotelmanagementButonu;
@FindBy(linkText = "Hotel Rooms")
public WebElement hotelRoomsButonu;
@FindBy(className = "hidden-480")
public WebElement addHotelRoom;
@FindBy(id = "IDHotel")
public WebElement idDropDown;
@FindBy(id = "btnSubmit")
public WebElement saveButonu;
@FindBy(xpath = "//*[text()='HotelRoom was inserted successfully']")
public WebElement sonucYaziElementi;
} | [
"murattanc@gmail.com"
] | murattanc@gmail.com |
196f8663a3359618b0f179cf2329861eb097964b | a6b0f07bd373078e7e205be182d7a72aecb4a0ee | /Criando_entidades_com_banco_de_dados/src/main/java/com/challenge/SpringChallengeApplication.java | 42ab0a99ca9d5fa147431ca75db4416a0819bf7d | [] | no_license | johnealves/Java-AceleraDevCodenation | c3862964f3e8b5d259f086393e5be938f065f1e4 | f35b5da6cb615546a23cbe0c1b574c2902a3814c | refs/heads/master | 2023-08-11T13:09:15.932098 | 2021-10-09T15:23:21 | 2021-10-09T15:23:21 | 397,702,859 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 325 | java | package com.challenge;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringChallengeApplication {
public static void main(String[] args) {
SpringApplication.run(SpringChallengeApplication.class, args);
}
}
| [
"johne_alves@hotmail.com"
] | johne_alves@hotmail.com |
ede2ecab8596be371c5e3f830b9c8c37e7d3426d | ebe2b44faddebaf4cb17d6f35f5eb53556176b43 | /src/stericson/busybox/jobs/InitialChecksJob.java | 83d98c26f4b6af3573950dc2984368ba4af18c1f | [] | no_license | Stericson/busybox-free | 61b9489d99264c1cf5998853c72840caf4d863c2 | c73855c8decf45472ce138ada4e1f4c7d3e159ea | refs/heads/master | 2021-01-18T22:35:30.267824 | 2020-07-18T20:18:35 | 2020-07-18T20:18:35 | 16,189,346 | 41 | 16 | null | null | null | null | UTF-8 | Java | false | false | 840 | java | package stericson.busybox.jobs;
import android.app.Activity;
import stericson.busybox.R;
import stericson.busybox.interfaces.JobCallback;
import stericson.busybox.jobs.containers.JobResult;
import stericson.busybox.jobs.tasks.InitialChecksTask;
public class InitialChecksJob extends AsyncJob {
public final static int Checks = 456214;
private JobCallback cb;
public InitialChecksJob(Activity activity, JobCallback cb) {
super(activity, R.string.initialChecks, false, false);
this.cb = cb;
}
@Override
JobResult handle() {
return InitialChecksTask.execute(this);
}
@Override
protected void onProgressUpdate(Object... values) {
super.onProgressUpdate(values);
}
@Override
void callback(JobResult result) {
cb.jobFinished(result, Checks);
}
}
| [
"Stericson.g1@gmail.com"
] | Stericson.g1@gmail.com |
d2a4e124e95bbf9befc2d34fee1b2538c9924b8a | acc30bd108e01f61200439fa2ac92080af3a47c6 | /src/main/java/org/vsynytsyn/fidotestbackend/security/config/PasswordEncryptionConfig.java | 263313c73903398f9c36aba20533204bda85c19d | [] | no_license | BlaD200/FidoTestBackend | aaf50e10ce9de8d99923c2a35f55ca798d07dab8 | cecc3f4b9c2e15ac386fd8441cd4a70b850bcf78 | refs/heads/master | 2023-08-22T17:20:50.119551 | 2021-10-16T23:00:34 | 2021-10-16T23:00:34 | 417,831,385 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 420 | java | package org.vsynytsyn.fidotestbackend.security.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
@Configuration
public class PasswordEncryptionConfig {
@Bean
public BCryptPasswordEncoder bCryptPasswordEncoder(){
return new BCryptPasswordEncoder(8);
}
}
| [
"blad600@gmail.com"
] | blad600@gmail.com |
6e1e509a5e173c5134211fdee30cf3036c64fc40 | 48e835e6f176a8ac9ae3ca718e8922891f1e5a18 | /benchmark/training/org/apache/camel/processor/ThrottlingGroupingTest.java | 3300c393bbf7d915e9479f288d76e56289abf5b3 | [] | no_license | STAMP-project/dspot-experiments | f2c7a639d6616ae0adfc491b4cb4eefcb83d04e5 | 121487e65cdce6988081b67f21bbc6731354a47f | refs/heads/master | 2023-02-07T14:40:12.919811 | 2019-11-06T07:17:09 | 2019-11-06T07:17:09 | 75,710,758 | 14 | 19 | null | 2023-01-26T23:57:41 | 2016-12-06T08:27:42 | null | UTF-8 | Java | false | false | 4,854 | 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.camel.processor;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import org.apache.camel.ContextTestSupport;
import org.apache.camel.component.mock.MockEndpoint;
import org.junit.Test;
public class ThrottlingGroupingTest extends ContextTestSupport {
private static final int INTERVAL = 500;
private static final int MESSAGE_COUNT = 9;
private static final int TOLERANCE = 50;
@Test
public void testGroupingWithSingleConstant() throws Exception {
getMockEndpoint("mock:result").expectedBodiesReceived("Hello World", "Bye World");
getMockEndpoint("mock:dead").expectedBodiesReceived("Kaboom");
template.sendBodyAndHeader("seda:a", "Kaboom", "max", null);
template.sendBodyAndHeader("seda:a", "Hello World", "max", 2);
template.sendBodyAndHeader("seda:a", "Bye World", "max", 2);
assertMockEndpointsSatisfied();
}
@Test
public void testGroupingWithDynamicHeaderExpression() throws Exception {
getMockEndpoint("mock:result").expectedBodiesReceived("Hello World");
getMockEndpoint("mock:result2").expectedBodiesReceived("Bye World");
getMockEndpoint("mock:dead").expectedBodiesReceived("Kaboom", "Saloon");
getMockEndpoint("mock:resultdynamic").expectedBodiesReceived("Hello Dynamic World", "Bye Dynamic World");
Map<String, Object> headers = new HashMap<String, Object>();
template.sendBodyAndHeaders("seda:a", "Kaboom", headers);
template.sendBodyAndHeaders("seda:a", "Saloon", headers);
headers.put("max", "2");
template.sendBodyAndHeaders("seda:a", "Hello World", headers);
template.sendBodyAndHeaders("seda:b", "Bye World", headers);
headers.put("max", "2");
headers.put("key", "1");
template.sendBodyAndHeaders("seda:c", "Hello Dynamic World", headers);
headers.put("key", "2");
template.sendBodyAndHeaders("seda:c", "Bye Dynamic World", headers);
assertMockEndpointsSatisfied();
}
@Test
public void testSendLotsOfMessagesButOnly3GetThroughWithin2Seconds() throws Exception {
MockEndpoint resultEndpoint = resolveMandatoryEndpoint("mock:gresult", MockEndpoint.class);
resultEndpoint.expectedMessageCount(3);
resultEndpoint.setResultWaitTime(2000);
Map<String, Object> headers = new HashMap<String, Object>();
for (int i = 0; i < 9; i++) {
if ((i % 2) == 0) {
headers.put("key", "1");
} else {
headers.put("key", "2");
}
template.sendBodyAndHeaders("seda:ga", (("<message>" + i) + "</message>"), headers);
}
// lets pause to give the requests time to be processed
// to check that the throttle really does kick in
resultEndpoint.assertIsSatisfied();
}
@Test
public void testSendLotsOfMessagesSimultaneouslyButOnlyGetThroughAsConstantThrottleValue() throws Exception {
MockEndpoint resultEndpoint = resolveMandatoryEndpoint("mock:gresult", MockEndpoint.class);
long elapsed = sendMessagesAndAwaitDelivery(ThrottlingGroupingTest.MESSAGE_COUNT, "direct:ga", ThrottlingGroupingTest.MESSAGE_COUNT, resultEndpoint);
assertThrottlerTiming(elapsed, 5, ThrottlingGroupingTest.INTERVAL, ThrottlingGroupingTest.MESSAGE_COUNT);
}
@Test
public void testConfigurationWithHeaderExpression() throws Exception {
MockEndpoint resultEndpoint = resolveMandatoryEndpoint("mock:gresult", MockEndpoint.class);
resultEndpoint.expectedMessageCount(ThrottlingGroupingTest.MESSAGE_COUNT);
ExecutorService executor = Executors.newFixedThreadPool(ThrottlingGroupingTest.MESSAGE_COUNT);
try {
sendMessagesWithHeaderExpression(executor, resultEndpoint, 5, ThrottlingGroupingTest.INTERVAL, ThrottlingGroupingTest.MESSAGE_COUNT);
} finally {
executor.shutdownNow();
}
}
}
| [
"benjamin.danglot@inria.fr"
] | benjamin.danglot@inria.fr |
bc9e21406af099a73341605a4e2728da2d8b0726 | 510a0dc46e9607ae88455893322df34f00a295d6 | /TabelLogin[1].java | b1e9dc0f8b30d86b50aa9b85a76de5217e359b41 | [] | no_license | ClaudiaAnggiviEllora/PTI-SPTK2016 | dfc43f07638c0ab2602d13f931f5522421aeae54 | 54a30939e34dbb793a6e7b64b487c65bd695e13d | refs/heads/master | 2020-04-14T00:34:24.969922 | 2016-06-12T23:46:36 | 2016-06-12T23:46:36 | 54,526,902 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 705 | 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 PTI;
/**
*
* @author user
*/
class TabelLogin {
private String username, passwordUser;
public TabelLogin() {
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPasswordUser() {
return passwordUser;
}
public void setPasswordUser(String passwordUser) {
this.passwordUser = passwordUser;
}
}
| [
"claudiaanggivi@gmail.com"
] | claudiaanggivi@gmail.com |
47730b92affd004374f60d9bb566eb18c88e4d1e | e317555b665c7eee415f1dbf4381248a8b0f509a | /src/com/neotech/lesson19/EmployeeWithinPackage.java | b61f4d789443a1759872bf8808347641cebe005b | [] | no_license | Komronioste/JavaBasic | babf5a73e14eb4c5b4532e7fd8c492d4a082ebb2 | 208ddcf7731074a595e0a283b7f61db0c532749d | refs/heads/main | 2023-07-14T16:47:19.812308 | 2021-08-18T22:37:48 | 2021-08-18T22:37:48 | 397,751,455 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 685 | java | package com.neotech.lesson19;
public class EmployeeWithinPackage {
public static void main(String[] args) {
Employee emp = new Employee();
Employee.company = "neotech"; // even though company is static, its in different class, so we cant access it without specifying the class it belongs to.
emp.empName = "Sahin";
emp.empLastName = "Erol";
emp.salary = 70;
// emp.ssn = 1231; cannot be accessed because it is private. and private is visible only within the same class.
emp.method1();
emp.method2();
emp.method3();
// emp.method4(); error says that this method is not visible. it is not visible because it is private and in different class.
}
}
| [
"TestUser@gmail.com"
] | TestUser@gmail.com |
50b9291d66149888fc754b33fad5b6845bddcbb2 | 67b6129fe3b1caf4e14af93edf51647651f9bdf2 | /FunctionChecker/src/main/java/com/sample/function/OrientationManager.java | bce75bc3bda482d1a0025ad72f98e30831722140 | [] | no_license | baby518/CameraChecker | 9a746b3aa41dd4e2471fa8f3c56e31539998c131 | df730a3904ddfc6b8fa232f153356fa71eb59a90 | refs/heads/master | 2021-09-21T22:02:03.156886 | 2018-09-01T10:30:58 | 2018-09-01T10:30:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,954 | java | package com.sample.function;
import android.content.Context;
import android.util.Log;
import android.view.OrientationEventListener;
import android.view.Surface;
import android.view.WindowManager;
public class OrientationManager {
private static final String TAG = "OrientationManager";
// DeviceOrientation hysteresis amount used in rounding, in degrees
private static final int ORIENTATION_HYSTERESIS = 5;
private int mLastDeviceOrientation = 0;
private final Context mContext;
private final MyOrientationEventListener mOrientationListener;
public OrientationManager(Context context) {
mContext = context;
mOrientationListener = new MyOrientationEventListener(context);
}
public void resume() {
mOrientationListener.enable();
}
public void pause() {
mOrientationListener.disable();
}
public int getDeviceOrientation() {
return mLastDeviceOrientation;
}
protected int getDisplayRotation() {
WindowManager windowManager = (WindowManager) mContext
.getSystemService(Context.WINDOW_SERVICE);
int rotation = windowManager.getDefaultDisplay().getRotation();
switch (rotation) {
case Surface.ROTATION_0:
return 0;
case Surface.ROTATION_90:
return 90;
case Surface.ROTATION_180:
return 180;
case Surface.ROTATION_270:
return 270;
}
return 0;
}
// This listens to the device orientation, so we can update the compensation.
private class MyOrientationEventListener extends OrientationEventListener {
public MyOrientationEventListener(Context context) {
super(context);
}
@Override
public void onOrientationChanged(int orientation) {
if (orientation == ORIENTATION_UNKNOWN) {
return;
}
final int roundedDeviceOrientation =
roundOrientation(mLastDeviceOrientation, orientation);
if (roundedDeviceOrientation == mLastDeviceOrientation) {
return;
}
Log.i(TAG, "orientation changed (from:to) " + mLastDeviceOrientation +
":" + roundedDeviceOrientation);
mLastDeviceOrientation = roundedDeviceOrientation;
}
}
private static int roundOrientation(int oldDeviceOrientation,
int newRawOrientation) {
int dist = Math.abs(newRawOrientation - oldDeviceOrientation);
dist = Math.min(dist, 360 - dist);
boolean isOrientationChanged = (dist >= 45 + ORIENTATION_HYSTERESIS);
if (isOrientationChanged) {
int newRoundedOrientation = ((newRawOrientation + 45) / 90 * 90) % 360;
return newRoundedOrientation;
}
return oldDeviceOrientation;
}
}
| [
"ZhangCharles518@gmail.com"
] | ZhangCharles518@gmail.com |
1d70943d545b3ab51707d8a6f2b2ebf81d489af5 | b4c1e505a439db3cfec9f55148a4b22a48c97843 | /legacy/src/se/jbee/game/scs/gfx/Draw.java | a9bd890b091525c7a84403ff36ed472877e2143f | [] | no_license | spacecrafts/spacecrafts | 13d4f80ef6a78c6abe58e17ed113cb6bad936d5a | 85ad8481186338541f4fbacd8ddc82fa93ac0b7b | refs/heads/master | 2022-09-19T16:47:08.265689 | 2022-09-14T06:17:57 | 2022-09-14T06:17:57 | 40,433,107 | 1 | 2 | null | 2021-09-18T16:05:07 | 2015-08-09T10:44:36 | Java | UTF-8 | Java | false | false | 4,278 | java | package se.jbee.game.scs.gfx;
import static se.jbee.game.scs.gfx.Gfx.Align.NW;
import java.awt.Rectangle;
import se.jbee.game.any.gfx.Drawable;
import se.jbee.game.any.gfx.obj.Text;
import se.jbee.game.scs.gfx.obj.Background;
import se.jbee.game.scs.gfx.obj.Button;
import se.jbee.game.scs.gfx.obj.Icon;
import se.jbee.game.scs.gfx.obj.Path;
import se.jbee.game.scs.gfx.obj.Planet;
import se.jbee.game.scs.gfx.obj.Rect;
import se.jbee.game.scs.gfx.obj.Ring;
import se.jbee.game.scs.gfx.obj.Star;
import se.jbee.game.scs.gfx.obj.Techwheel;
/**
* A utility class to construct GFX objects.
*
* This is only to make code more readable and documenting the contract or
* expectation of each of the {@link Gfx}s.
*
* There are two rules:
* - index 0 holds the object type
* - index 1 holds the number of successive data elements that belong to the object
*/
public final class Draw implements Gfx {
//int[] colors = new int[] { 0x006600, 0x82633F, 0xFF5014 };
public static Text text(int key, int left, int top, FontStyle font, int size, Hue color) {
return text(key, left,top,font,size,color, NW, -1, -1);
}
public static Text text(int key, int left, int top, FontStyle font, int size, Hue color, Align align, int right, int bottom) {
return new Text(left,top, right, bottom, font, size, color, align, key, "");
}
public static Text label(int left, int top, FontStyle font, int size, Hue color, int[] text) {
return label(left, top, font, size, color, new String(text, 0, text.length));
}
public static Text label(int left, int top, FontStyle font, int size, Hue color, String text) {
return label(left,top,font,size,color, NW, -1, -1, text);
}
//TODO stretch (making size so that the text takes X/Y bounds given)
public static Text label(int left, int top, FontStyle font, int size, Hue color, Align align, int right, int bottom, int[] text) {
return label(left, top, font, size, color, align, right, bottom, new String(text, 0, text.length));
}
public static Text label(int left, int top, FontStyle font, int size, Hue color, Align align, int right, int bottom, String text) {
return new Text(left, top, right, bottom, font, size, color, align, 0, text);
}
public static Drawable button(int x, int y, int d, Hue piecolor, Hue textcolor) {
return new Button(x, y, d, piecolor);
}
public static Drawable icon(int type, int x, int y, int d, Hue color) { //TODO add color-effect
return new Icon(type,x,y,d,color);
}
public static Drawable techwheel(int xc, int yc, int d, Hue color) {
return new Techwheel(xc,yc,d,color);
}
public static Drawable ring(int xc, int yc, int d, int thickness, Hue fg) {
return new Ring(xc,yc,d, thickness, fg);
}
public static Drawable background(int x, int y, int w, int h, int no, long seed) {
return new Background(x,y,w,h, no, seed);
}
public static Drawable border(Rectangle area) {
return border(area.x, area.y, area.width, area.height);
}
public static Drawable border(int x, int y, int w, int h) {
return new Rect( x,y,w,h );
}
public static Drawable focusBox(int x, int y, int w, int h) {
return new Rect(x,y,w,h );
}
public static Drawable path(int type, Hue color, int stroke, int x1, int y1, int x2, int y2) {
return new Path(type, color, stroke, new int[] { x1, y1, x2, y2 });
}
public static Drawable path(int type, Hue color, int stroke, int x1, int y1, int x2, int y2, int x3, int y3) {
return new Path(type, color, stroke, new int[] { x1, y1, x2, y2, x3, y3 });
}
public static Drawable timeLine(int x1, int y1, int x2, int y2) {
return path(PATH_EDGY, Hue.TEXT_NORMAL, 1, x1,y1,x2,y2);
}
public static Drawable focusLine(int x1, int y1, int x2, int y2) {
return path(PATH_EDGY, Hue.TEXT_HIGHLIGHT, 1, x1,y1,x2,y2);
}
public static Drawable star(int x0, int y0, int dia, int rgba) {
return new Star(x0,y0,dia, rgba, 0L, false);
}
public static Drawable partialStar(int x0, int y0, int dia, int rgba, long seed) {
return new Star(x0,y0, dia, rgba, seed, true);
}
public static Drawable planet(int x0, int y0, int dia, int type, int rgba) {
return new Planet(x0,y0,dia,type,rgba, false);
}
public static Drawable planetCut(int x, int y, int dia, int c, int rgba) {
return new Planet(x,y,dia,c,rgba, true);
}
}
| [
"jaanbernitt@gmail.com"
] | jaanbernitt@gmail.com |
8092139d500ca7f95e93f14c67146f9d4a2d0245 | f86b2a011d971c0bf0cbcf886c699fa184dccb24 | /DarkDungeon4J-Utils/src/main/java/cz/dd4j/utils/config/BidirConfig.java | 99147918edf51bac90c7dbcd0ecc5d0b269d4a4f | [] | no_license | kefik/DarkDungeon4J | 3cac2990526ca816ef4c66941565d413610f49e6 | 679e2d3f0f27a9c32a7a2629a2ca26b1e9a0205c | refs/heads/master | 2021-01-18T23:34:58.593315 | 2018-03-12T15:28:34 | 2018-03-12T15:28:34 | 87,119,284 | 1 | 2 | null | 2017-07-13T13:19:40 | 2017-04-03T20:46:30 | C | UTF-8 | Java | false | false | 514 | java | package cz.dd4j.utils.config;
public class BidirConfig extends GenericConfig {
public DirLocation source = new DirLocation();
@Override
public void assign(GenericConfig from) {
if (from == null) return;
super.assign(from);
if (from instanceof BidirConfig) {
BidirConfig bidir = (BidirConfig)from;
if (bidir.source != null) {
if (bidir.source.dir != null) source.dir = bidir.source.dir;
if (bidir.source.filePrefix != null) source.filePrefix = bidir.source.filePrefix;
}
}
}
}
| [
"jakub.gemrot@gmail.com"
] | jakub.gemrot@gmail.com |
9ba0827987eaab87a4ad53f52f04cf735950ad8d | 4b051e1eaf5a4bd23f18f13382718fd4dfe87c11 | /deep-thought/src/main/java/com/epam/deepthought/DeepThought.java | 35c2088aea153704608e409c8ee0a97115e13876 | [] | no_license | SamuilOlegovich/Spring_Cloud_Eureka_Zuul_Feign_Client | ec77800790246dc4e96fd3aac949a537ee00f3c4 | efcf5c8da8d271dfe2da0a8f8d783960a7ecc793 | refs/heads/main | 2023-04-18T14:57:43.563374 | 2021-04-22T21:00:34 | 2021-04-22T21:00:34 | 359,136,617 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 276 | java | package com.epam.deepthought;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
public interface DeepThought {
@GetMapping("/convert/{hours}")
Integer convert(@PathVariable("hours") int hours);
}
| [
"47562089+SamuilOlegovich@users.noreply.github.com"
] | 47562089+SamuilOlegovich@users.noreply.github.com |
77630efbacc561f4c369d7e1199f038d9fba075c | 17989a434abc1a64257312ba715ec89f4929ba8c | /src/main/java/com/framework/qa/asserts/CustomAssertion.java | 7f73292061cbb11dc8af5c98bc67f4ac16656f8f | [
"Apache-2.0"
] | permissive | eldorajan/AutoWebDriver | a9b5a0768a21e7009a9de2143d6c811ab9660d1e | 39692c32c7836b826c4d6356e6ea2cd1ca72fc5f | refs/heads/master | 2023-02-21T06:18:01.101713 | 2021-11-17T10:23:55 | 2021-11-17T10:23:55 | 162,838,727 | 1 | 0 | Apache-2.0 | 2023-02-17T14:58:16 | 2018-12-22T19:49:23 | Java | UTF-8 | Java | false | false | 33,624 | java | package test.java.com.framework.qa.asserts;
import com.framework.qa.logger.Logger;
import com.google.common.collect.MapDifference;
import com.google.common.collect.MapDifference.ValueDifference;
import com.google.common.collect.Maps;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.hamcrest.Matcher;
import org.hamcrest.MatcherAssert;
import org.skyscreamer.jsonassert.JSONAssert;
import org.testng.Assert;
import org.testng.asserts.SoftAssert;
import java.math.BigInteger;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Consumer;
/**
* @author eldorajan
*/
public class CustomAssertion {
// CustomAssertion Methods
public static void assertEquals(final boolean actual, final boolean expected, final String message) {
try {
Logger.info("Expected: " + expected);
Logger.info("Actual : " + actual);
Assert.assertEquals(actual, expected, message);
} catch (AssertionError e) {
Logger.info("Assertion Error : " + actual + " is not equal to " + expected);
Logger.info("VALUE MISMATCH EXCEPTION");
throw e;
}
}
public static void assertEquals(final byte actual, final byte expected, final String message) {
try {
Logger.info("Expected: " + expected);
Logger.info("Actual : " + actual);
Assert.assertEquals(actual, expected, message);
} catch (AssertionError e) {
Logger.info("Assertion Error : " + actual + " is not equal to " + expected);
Logger.info("VALUE MISMATCH EXCEPTION");
throw e;
}
}
public static void assertEquals(final byte[] actual, final byte[] expected, final String message) {
try {
Logger.info("Expected: " + expected);
Logger.info("Actual : " + actual);
Assert.assertEquals(actual, expected, message);
} catch (AssertionError e) {
Logger.info("Assertion Error : " + actual + " is not equal to " + expected);
Logger.info("VALUE MISMATCH EXCEPTION");
throw e;
}
}
public static void assertEquals(final char actual, final char expected, final String message) {
try {
Logger.info("Expected: " + expected);
Logger.info("Actual : " + actual);
Assert.assertEquals(actual, expected, message);
} catch (AssertionError e) {
Logger.info("Assertion Error : " + actual + " is not equal to " + expected);
Logger.info("VALUE MISMATCH EXCEPTION");
throw e;
}
}
@SuppressWarnings("rawtypes")
public static void assertEquals(final Collection actual, final Collection expected, final String message) {
try {
Logger.info("Expected: " + expected);
Logger.info("Actual : " + actual);
Assert.assertEquals(actual, expected, message);
} catch (AssertionError e) {
Logger.info("Assertion Error : " + actual + " is not equal to " + expected);
Logger.info("VALUE MISMATCH EXCEPTION");
throw e;
}
}
public static void assertEquals(final double actual, final double expected, final String message) {
try {
Logger.info("Expected: " + expected);
Logger.info("Actual : " + actual);
Assert.assertEquals(actual, expected, message);
} catch (AssertionError e) {
Logger.info("Assertion Error : " + actual + " is not equal to " + expected);
Logger.info("VALUE MISMATCH EXCEPTION");
throw e;
}
}
public static void assertEquals(final float actual, final float expected, final String message) {
try {
Logger.info("Expected: " + expected);
Logger.info("Actual : " + actual);
Assert.assertEquals(actual, expected, message);
} catch (AssertionError e) {
Logger.info("Assertion Error : " + actual + " is not equal to " + expected);
Logger.info("VALUE MISMATCH EXCEPTION");
throw e;
}
}
public static void assertEquals(final int actual, final int expected, final String message) {
try {
Logger.info("Expected: " + expected);
Logger.info("Actual : " + actual);
Assert.assertEquals(actual, expected, message);
} catch (AssertionError e) {
Logger.info("Assertion Error : " + actual + " is not equal to " + expected);
Logger.info("VALUE MISMATCH EXCEPTION");
throw e;
}
}
public static void assertEquals(final int actual, final int expected, String field, final String message) {
try {
Logger.info("Expected: " + expected);
Assert.assertEquals(actual, expected, message);
Logger.info("Actual : " + actual);
} catch (AssertionError e) {
Logger.info("Actual : " + field + " is not equal to " + expected + ". It is " + actual);
Logger.info("VALUE MISMATCH EXCEPTION");
throw e;
}
}
public static void assertEquals(final Double actual, final Double expected, String field, final String message) {
try {
Logger.info("Expected: " + expected);
Assert.assertEquals(actual, expected, message);
Logger.info("Actual : " + actual);
} catch (AssertionError e) {
Logger.info("Actual : " + field + " is not equal to " + expected + ". It is " + actual);
Logger.info("VALUE MISMATCH EXCEPTION");
throw e;
}
}
public static void assertEquals(BigInteger actual, BigInteger expected, String field, final String message) {
try {
Logger.info("Expected: " + expected);
Assert.assertEquals(actual, expected, message);
Logger.info("Actual : " + actual);
} catch (AssertionError e) {
Logger.info("Actual : " + field + " is not equal to " + expected + ". It is " + actual);
Logger.info("VALUE MISMATCH EXCEPTION");
throw e;
}
}
public static void assertEquals(final long actual, final long expected, String field, final String message) {
try {
Logger.info("Expected: " + expected);
Assert.assertEquals(actual, expected, message);
Logger.info("Actual : " + actual);
} catch (AssertionError e) {
Logger.info("Actual : " + field + " is not equal to " + expected + ". It is " + actual);
Logger.info("VALUE MISMATCH EXCEPTION");
throw e;
}
}
public static void assertEquals(final Object actual, final Object expected, final String message) {
try {
Logger.info("Expected: " + expected);
Assert.assertEquals(actual, expected, message);
Logger.info("Actual : " + actual);
} catch (AssertionError e) {
Logger.info("Actual : " + actual + " is not equal to " + expected);
Logger.info("VALUE MISMATCH EXCEPTION");
throw e;
}
}
public static void assertEquals(final Object[] actual, final Object[] expected, final String message) {
try {
Logger.info("Expected: " + expected);
Assert.assertEquals(actual, expected, message);
Logger.info("Actual : " + actual);
} catch (AssertionError e) {
Logger.info("Actual : " + actual + " is not equal to " + expected);
Logger.info("VALUE MISMATCH EXCEPTION");
throw e;
}
}
public static void assertEquals(final short actual, final short expected, final String message) {
try {
Logger.info("Expected: " + expected);
Assert.assertEquals(actual, expected, message);
Logger.info("Actual : " + actual);
} catch (AssertionError e) {
Logger.info("Actual : " + actual + " is not equal to " + expected);
Logger.info("VALUE MISMATCH EXCEPTION");
throw e;
}
}
public static void assertEquals(final String actual, final String expected, final String message) {
try {
Logger.pass("Expected: " + expected);
Assert.assertEquals(actual, expected, message);
Logger.pass("Actual : " + actual);
} catch (AssertionError e) {
Logger.fail("Actual : " + actual + " is not equal to " + expected);
Logger.fail("VALUE MISMATCH EXCEPTION");
throw e;
}
}
public static void assertEquals(final List<String> actual, final List<String> expected, final String message) {
try {
Logger.info("Expected: " + expected);
Logger.info("Actual : " + actual);
Assert.assertTrue(ListUtils.isEqual(expected, actual), message);
try {
Logger.pass("Difference => " + CollectionUtils.subtract(expected, actual) + " | " + "Extra => "
+ CollectionUtils.subtract(actual, expected));
} catch (Exception e) {
}
} catch (AssertionError e) {
try {
Logger.pass("Difference => " + CollectionUtils.subtract(expected, actual) + " | " + "Extra => "
+ CollectionUtils.subtract(actual, expected));
} catch (Exception e1) {
}
Logger.info("Assertion Error : " + actual + " is not equal to " + expected);
Logger.info("VALUE MISMATCH EXCEPTION");
throw e;
}
}
public static void assertEquals(final Set<String> actual, final Set<String> expected, final String message) {
try {
Logger.info("Expected: " + expected);
Logger.info("Actual : " + actual);
Assert.assertTrue(ListUtils.isEqual(expected, actual), message);
try {
Logger.pass("Difference => " + CollectionUtils.subtract(expected, actual) + " | " + "Extra => "
+ CollectionUtils.subtract(actual, expected));
} catch (Exception e) {
}
} catch (AssertionError e) {
try {
Logger.pass("Difference => " + CollectionUtils.subtract(expected, actual) + " | " + "Extra => "
+ CollectionUtils.subtract(actual, expected));
} catch (Exception e1) {
}
Logger.info("Assertion Error : " + actual + " is not equal to " + expected);
Logger.info("VALUE MISMATCH EXCEPTION");
throw e;
}
}
public static void assertEquals(final Set<String> actual, final Set<String> expected, final String message,
String pdType, String fileCategory, String fileName, String fileId) {
try {
Logger.info("Expected: " + expected);
Logger.info("Actual : " + actual);
Assert.assertTrue(ListUtils.isEqual(expected, actual), message);
try {
Logger.pass("File Category: " + fileCategory + " | File Name: " + fileName + " | File Id: " + fileId
+ " | " + "Present => " + actual + " | " + "Difference => "
+ CollectionUtils.subtract(expected, actual) + " | " + "Extra => "
+ CollectionUtils.subtract(actual, expected) + " | " + pdType + "Pass Percentage => ["
+ getPassPercentage(actual, expected) + "]");
} catch (Exception e) {
}
} catch (AssertionError e) {
try {
Logger.fail("File Category: " + fileCategory + " | File Name: " + fileName + " | File Id: " + fileId
+ " | " + "Present => " + CollectionUtils.intersection(expected, actual) + " | "
+ "Difference => " + CollectionUtils.subtract(expected, actual) + " | " + "Extra => "
+ CollectionUtils.subtract(actual, expected) + " | " + pdType + "Pass Percentage => ["
+ getPassPercentage(actual, expected) + "]");
} catch (Exception e1) {
}
Logger.info("Assertion Error : " + actual + " is not equal to " + expected);
Logger.info("VALUE MISMATCH EXCEPTION");
throw e;
}
}
public static void assertEquals(final List<String> actual, final List<String> expected, final String message,
String pdType, String fileCategory, String fileName, String fileId) {
try {
Logger.info("Expected: " + expected);
Logger.info("Actual : " + actual);
Assert.assertTrue(ListUtils.isEqual(expected, actual), message);
try {
Logger.pass("File Category: " + fileCategory + " | File Name: " + fileName + " | File Id: " + fileId
+ " | " + "Present => " + actual + " | " + "Difference => "
+ CollectionUtils.subtract(expected, actual) + " | " + "Extra => "
+ CollectionUtils.subtract(actual, expected) + " | " + pdType + "Pass Percentage => ["
+ getPassPercentage(actual, expected) + "]");
} catch (Exception e) {
}
} catch (AssertionError e) {
try {
Logger.fail("File Category: " + fileCategory + " | File Name: " + fileName + " | File Id: " + fileId
+ " | " + "Present => " + CollectionUtils.intersection(expected, actual) + " | "
+ "Difference => " + CollectionUtils.subtract(expected, actual) + " | " + "Extra => "
+ CollectionUtils.subtract(actual, expected) + " | " + pdType + "Pass Percentage => ["
+ getPassPercentage(actual, expected) + "]");
} catch (Exception e1) {
}
Logger.info("Assertion Error : " + actual + " is not equal to " + expected);
Logger.info("VALUE MISMATCH EXCEPTION");
throw e;
}
}
public static void assertEquals(final String actual, final String expected, String fieldname,
final String message) {
try {
Logger.info("Expected: " + fieldname + " should be equals to " + expected);
Assert.assertEquals(actual, expected, message);
Logger.info("Actual : " + fieldname + " is equal to " + actual, LoggerEnricher.EnricherFactory.BOLD_GREEN);
} catch (AssertionError e) {
Logger.error("Actual : " + fieldname + " is not equal to " + expected,
LoggerEnricher.EnricherFactory.BOLD_RED);
Logger.info("VALUE MISMATCH EXCEPTION");
throw e;
}
}
public static void assertEquals(final String actual, final String expected, String fieldname, final String message,
boolean printHtml) {
try {
if (printHtml) {
Logger.info("Expected: " + fieldname + " should be equals to " + expected);
}
Assert.assertEquals(actual, expected, message);
if (printHtml) {
Logger.info("Actual : " + fieldname + " is equal to " + actual,
LoggerEnricher.EnricherFactory.BOLD_GREEN);
}
} catch (AssertionError e) {
if (printHtml) {
if (!(actual.contains("html") || expected.contains("html")))
Logger.error("Actual : " + fieldname + " is not equal to " + expected,
LoggerEnricher.EnricherFactory.BOLD_RED);
}
Logger.info("VALUE MISMATCH EXCEPTION");
throw e;
}
}
public static void assertEquals(final Map<String, String> actual, final Map<String, String> expected,
final String message) {
Map<String, String> actualTemp = StrUtils.sortMap(actual);
Map<String, String> expectedTemp = StrUtils.sortMap(expected);
try {
MapDifference<String, String> diff = Maps.difference(actualTemp, expectedTemp);
Map<String, ValueDifference<String>> entriesDiffering = diff.entriesDiffering();
Assert.assertTrue(entriesDiffering.size() == 0, message);
Logger.pass("Difference: " + diff.entriesDiffering());
} catch (AssertionError e) {
MapDifference<String, String> diff = Maps.difference(actualTemp, expectedTemp);
Logger.fail("Difference: " + diff.entriesDiffering());
Logger.info("Assertion Error : " + actual + " is not equal to " + expected);
Logger.info("VALUE MISMATCH EXCEPTION");
throw e;
}
}
public static void assertEquals(final List<String> actual, final List<String> expected, String fieldname,
final String message) {
try {
Logger.info("Expected: " + fieldname + " should be equals to " + expected);
Assert.assertTrue(ListUtils.isEqual(expected, actual), message);
Logger.info("Actual : " + fieldname + " is equal to " + actual);
} catch (AssertionError e) {
Logger.error("Actual : " + fieldname + " is not equal to " + expected);
Logger.info("VALUE MISMATCH EXCEPTION");
throw e;
}
}
public static void assertEquals(final Set<String> actual, final Set<String> expected, String fieldname,
final String message) {
try {
Logger.info("Expected: " + fieldname + " should be equals to " + expected);
Assert.assertTrue(ListUtils.isEqual(expected, actual), message);
Logger.info("Actual : " + fieldname + " is equal to " + actual);
} catch (AssertionError e) {
Logger.error("Actual : " + fieldname + " is not equal to " + expected);
Logger.info("VALUE MISMATCH EXCEPTION");
throw e;
}
}
public static void assertiEquals(final String actual, final String expected, String fieldname,
final String message) {
try {
Logger.info("Expected: " + fieldname + " should be equals to " + expected.toLowerCase());
Assert.assertEquals(actual.toLowerCase(), expected.toLowerCase(), message);
Logger.info("Actual : " + fieldname + " is equal to " + actual.toLowerCase());
} catch (AssertionError e) {
Logger.error("Actual : " + fieldname + " is not equal to " + expected.toLowerCase());
Logger.info("VALUE MISMATCH EXCEPTION");
throw e;
}
}
public static void assertFalse(final boolean condition, final String message) {
try {
Logger.info("Expected: " + condition);
Assert.assertFalse(condition, message);
Logger.info("Actual : " + condition);
} catch (AssertionError e) {
Logger.info("Actual : " + condition);
Logger.info("VALUE_NOT_FALSE EXCEPTION");
throw e;
}
}
public static void assertFalse(final boolean condition, String expectedLog, String actualLog,
final String message) {
try {
Logger.info("Expected: " + expectedLog);
Assert.assertFalse(condition, message);
Logger.info("Actual : " + actualLog);
} catch (AssertionError e) {
Logger.info("Actual : " + actualLog);
Logger.info("Actual and Expected should not match");
Logger.info("VALUE_NOT_TRUE EXCEPTION");
throw e;
}
}
public static void assertNotNull(final Object object, final String message) {
try {
Logger.info("Expected: Object not to be null.");
Assert.assertNotNull(object, message);
Logger.info("Actual: Object is not null.");
} catch (AssertionError e) {
Logger.info("Actual: Object is null.");
Logger.info("OBJECT NULL EXCEPTION");
throw e;
}
}
public static void assertNotNull(final Object object, String objectName, final String message) {
try {
Logger.info("Expected: " + objectName + " Should not be null.");
Assert.assertNotNull(object, message);
Logger.info("Actual: " + objectName + " is not null.");
} catch (AssertionError e) {
Logger.info("Actual: " + objectName + " is null.");
Logger.info("OBJECT NULL EXCEPTION");
throw e;
}
}
public static void assertEmpty(final String value1, String fieldname, final String message) {
try {
Logger.info("Expected: " + fieldname + " should be empty ");
Assert.assertEquals(value1.length(), 0, message);
Logger.info("Actual : " + fieldname + " is empty. It has the value of " + value1);
} catch (AssertionError e) {
Logger.info("Actual : " + fieldname + " is not empty.It has the value of " + value1);
Logger.info("OBJECT NULL EXCEPTION");
throw e;
}
}
public static void assertNotEmpty(final Integer intVal, final String message) {
try {
Logger.info("Expected: " + intVal + " should be not null and empty ");
Assert.assertTrue(intVal > 0 && intVal != null, message);
Logger.info("Actual : " + intVal + " is not null and empty.");
} catch (AssertionError e) {
Logger.info("Actual : " + intVal + " is null or not empty.");
Logger.info("OBJECT NULL EXCEPTION");
throw e;
}
}
public static void assertNotEmpty(final Long intVal, final String message) {
try {
Logger.info("Expected: " + intVal + " should be not null and empty ");
Assert.assertTrue(intVal > 0 && intVal != null, message);
Logger.info("Actual : " + intVal + " is not null and empty.");
} catch (AssertionError e) {
Logger.info("Actual : " + intVal + " is null or not empty.");
Logger.info("OBJECT NULL EXCEPTION");
throw e;
}
}
public static void assertNotEmpty(final String stringVal, final String message) {
try {
Logger.info("Expected: " + stringVal + " should be not null and empty ");
Assert.assertTrue(StringUtils.isNotBlank(stringVal), message);
Logger.info("Actual : " + stringVal + " is not null and empty.");
} catch (AssertionError e) {
Logger.info("Actual : " + stringVal + " is null or not empty.");
Logger.info("OBJECT NULL EXCEPTION");
throw e;
}
}
public static void assertEmpty(final String stringVal, final String message) {
try {
Logger.info("Expected: " + stringVal + " should be null and empty ");
Assert.assertTrue(StringUtils.isBlank(stringVal), message);
Logger.info("Actual : " + stringVal + " is null and empty.");
} catch (AssertionError e) {
Logger.info("Actual : " + stringVal + " is not null or empty.");
Logger.info("OBJECT NULL EXCEPTION");
throw e;
}
}
public static void assertNotEmpty(final Integer value, final String fieldname, final String message) {
try {
Logger.info("Expected: " + fieldname + " value " + value + " should be not null and empty ");
Assert.assertTrue(value > 0 && value != null, message);
Logger.info("Actual: " + fieldname + " value " + value + " is not null and empty ");
} catch (AssertionError e) {
Logger.info("Expected: " + fieldname + " value " + value + " is null and empty ");
Logger.info("OBJECT NULL EXCEPTION");
throw e;
}
}
public static void assertNotEmpty(final boolean value, final String fieldname, final String message) {
try {
Logger.info("Expected: " + fieldname + " value " + value + " should be not null and empty ");
String booleanValue = String.valueOf(value);
Assert.assertTrue(booleanValue != null && booleanValue.length() > 0, message);
Logger.info("Actual: " + fieldname + " value " + value + " is not null and empty ");
} catch (AssertionError e) {
Logger.info("Expected: " + fieldname + " value " + value + " is null and empty ");
Logger.info("OBJECT NULL EXCEPTION");
throw e;
}
}
public static void assertNotEmpty(final Double value, final String fieldname, final String message) {
try {
Logger.info("Expected: " + fieldname + " value " + value + " should be not null and empty ");
Assert.assertTrue(value > 0 && value != null, message);
Logger.info("Actual: " + fieldname + " value " + value + " is not null and empty ");
} catch (AssertionError e) {
Logger.info("Expected: " + fieldname + " value " + value + " is null and empty ");
Logger.info("OBJECT NULL EXCEPTION");
throw e;
}
}
public static void assertNotEmpty(final Long value, final String fieldname, final String message) {
try {
Logger.info("Expected: " + fieldname + " value " + value + " should be not null and empty ");
Assert.assertTrue(value > 0 && value != null, message);
Logger.info("Actual: " + fieldname + " value " + value + " is not null and empty ");
} catch (AssertionError e) {
Logger.info("Expected: " + fieldname + " value " + value + " is null and empty ");
Logger.info("OBJECT NULL EXCEPTION");
throw e;
}
}
public static void assertNotEmpty(final String val, String fieldname, final String message) {
try {
Logger.info("Expected: " + fieldname + " value " + val + " should be not null and empty ");
Assert.assertTrue(val != null && val.length() > 0, message);
Logger.info("Actual: " + fieldname + " value " + val + " is not null and empty ");
} catch (AssertionError e) {
Logger.info("Expected: " + fieldname + " value " + val + " is null and empty ");
Logger.info("OBJECT NULL EXCEPTION");
throw e;
}
}
public static void assertNotSame(final Object actual, final Object expected, final String message) {
try {
Assert.assertNotSame(actual, expected, message);
} catch (AssertionError e) {
Logger.info("OBJECT_NOT_SAME EXCEPTION");
throw e;
}
}
public static void assertNull(final Object object, final String message) {
try {
Assert.assertNull(object, message);
} catch (AssertionError e) {
Logger.info("OBJECT_NOT_NULL EXCEPTION");
throw e;
}
}
public static void assertSame(final Object actual, final Object expected, final String message) {
try {
Assert.assertSame(actual, expected, message);
} catch (AssertionError e) {
Logger.info("OBJECT_NOT_SAME EXCEPTION");
throw e;
}
}
public static void assertContains(final String actual, final String expected, final String message) {
try {
Logger.info("Expected: " + expected);
Logger.info("Actual: " + actual);
Assert.assertTrue(actual.contains(expected), message);
} catch (AssertionError e) {
Logger.info("OBJECT_DOES_NOT_CONTAIN EXCEPTION");
throw e;
}
}
public static void assertTrue(final boolean condition, final String message) {
try {
Logger.info("Expected: " + true);
Assert.assertTrue(condition, message);
Logger.info("Actual : " + condition);
} catch (AssertionError e) {
Logger.info("Actual : " + condition);
Logger.info("VALUE_NOT_TRUE EXCEPTION");
throw e;
}
}
public static void assertJsonEquals(String expected, String actual, boolean strictMode) {
try {
Logger.info("Expected: " + expected);
JSONAssert.assertEquals(expected, actual, strictMode);
Logger.info("Actual : " + actual);
Logger.info("Json Strings match");
} catch (AssertionError e) {
Logger.info("Json Strings not matching");
Logger.info("VALUE MISMATCH EXCEPTION");
throw e;
}
}
public static void assertTrue(final boolean condition, String logMessage, final String message) {
try {
Logger.info("Expected: " + true);
Assert.assertTrue(condition, message);
Logger.info("Actual : " + logMessage);
} catch (AssertionError e) {
Logger.info("Actual : " + condition);
Logger.info("VALUE_NOT_TRUE EXCEPTION");
throw e;
}
}
public static void assertTrue(final boolean condition, String expectedLog, String actualLog, final String message) {
try {
Logger.info("Expected: " + expectedLog);
Assert.assertTrue(condition, message);
Logger.info("Actual : " + actualLog);
} catch (AssertionError e) {
Logger.info("Actual : " + message);
Logger.info("VALUE_NOT_TRUE EXCEPTION");
throw e;
}
}
public static void fail(final String message) {
try {
Assert.fail(message);
} catch (AssertionError e) {
Logger.info("FAIL EXCEPTION");
throw e;
}
}
public static void assertContains(boolean condition, String actual, String expected, final String message) {
try {
Logger.info("Expected: " + actual + " should contain " + expected);
Assert.assertTrue(condition, message);
Logger.info("Actual : " + actual + " contains " + expected);
} catch (AssertionError e) {
Logger.info("Actual : " + actual + " not contains " + expected);
Logger.info("VALUE_NOT_TRUE EXCEPTION");
throw e;
}
}
public static void assertStartsWith(boolean condition, String actual, String expected, final String message) {
try {
Logger.info("Expected: " + actual + " should starts with " + expected);
Assert.assertTrue(condition, message);
Logger.info("Actual : " + actual + " starts with " + expected);
} catch (AssertionError e) {
Logger.info("Actual : " + actual + " not starts with " + expected);
Logger.info("VALUE_NOT_TRUE EXCEPTION");
throw e;
}
}
public static void assertStartsWith(String actual, String expected, final String message) {
try {
Logger.info("Expected: " + actual + " should starts with " + expected);
Assert.assertTrue(actual.startsWith(expected), message);
Logger.info("Actual : " + actual + " starts with " + expected);
} catch (AssertionError e) {
Logger.info("Actual : " + actual + " not starts with " + expected);
Logger.info("VALUE_NOT_TRUE EXCEPTION");
throw e;
}
}
public static void assertEndsWith(boolean condition, String actual, String expected, final String message) {
try {
Logger.info("Expected: " + actual + " should ends with " + expected);
Assert.assertTrue(condition, message);
Logger.info("Actual : " + actual + " ends with " + expected);
} catch (AssertionError e) {
Logger.info("Actual : " + actual + " not ends with " + expected);
Logger.info("VALUE_NOT_TRUE EXCEPTION");
throw e;
}
}
public static void assertEndsWith(String actual, String expected, final String message) {
try {
Logger.info("Expected: " + actual + " should ends with " + expected);
Assert.assertTrue(actual.endsWith(expected), message);
Logger.info("Actual : " + actual + " ends with " + expected);
} catch (AssertionError e) {
Logger.info("Actual : " + actual + " not ends with " + expected);
Logger.info("VALUE_NOT_TRUE EXCEPTION");
throw e;
}
}
public static void assertThat(final String reason, final boolean assertion) {
MatcherAssert.assertThat(reason, assertion);
}
// assertThat("myValue", allOf(startsWith("my"), containsString("Val")));
public static <T> void assertThat(final String reason, final T actual, final Matcher<? super T> matcher) {
MatcherAssert.assertThat(reason, actual, matcher);
}
public static <T> void assertThat(final T actual, final Matcher<? super T> matcher) {
MatcherAssert.assertThat(actual, matcher);
}
public static void assertSoftly(Consumer<SoftAssert> softly) {
SoftAssert assertions = new SoftAssert();
softly.accept(assertions);
assertions.assertAll();
}
}
| [
"eldorajan@gmail.com"
] | eldorajan@gmail.com |
53c3fb4ba34ab031b9e51c357b49866d8e4a4c87 | be291c62f3f582368f5c70c04ad101d708bd1dc5 | /ProjetS4/src/Stages/AudioPlayer.java | 82435aff104fe730a05ee4050c70bca5eb3730d9 | [] | no_license | elie-roure/Projet_S4 | 969c797273bf6580ba357aeaad7ac41ce7c2a77f | 9420cb61ce5a2b34c2bbe0368603fb2d77529266 | refs/heads/master | 2023-03-20T06:55:56.904900 | 2021-03-10T12:23:23 | 2021-03-10T12:24:45 | 337,742,769 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,468 | java | package Stages;
import javafx.scene.media.AudioClip;
import javafx.scene.media.Media;
import javafx.scene.media.MediaPlayer;
import javafx.util.Duration;
import java.io.File;
import java.io.IOException;
import java.nio.file.Paths;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;
import javax.sound.sampled.DataLine;
import javax.sound.sampled.LineEvent;
import javax.sound.sampled.LineListener;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.UnsupportedAudioFileException;
public class AudioPlayer implements LineListener {
/**
* this flag indicates whether the playback completes or not.
*/
private boolean playCompleted;
private Clip audioClip;
private File audioFile;
public AudioPlayer(File audioFile){
try {
this.audioFile = audioFile;
AudioInputStream audioStream = AudioSystem.getAudioInputStream(audioFile);
AudioFormat format = audioStream.getFormat();
DataLine.Info info = new DataLine.Info(Clip.class, format);
audioClip = (Clip) AudioSystem.getLine(info);
audioClip.addLineListener(this);
audioClip.open(audioStream);
}
catch (UnsupportedAudioFileException ex) {
System.out.println("The specified audio file is not supported.");
ex.printStackTrace();
} catch (LineUnavailableException ex) {
System.out.println("Audio line for playing back is unavailable.");
ex.printStackTrace();
} catch (IOException ex) {
System.out.println("Error playing the audio file.");
ex.printStackTrace();
}
}
/**
* Play a given audio file.
*/
public void play() {
audioClip.start();
}
public void arret(){
audioClip.stop();
}
public void boucle(){
audioClip.loop(100000);
}
/**
* Listens to the START and STOP events of the audio line.
*/
@Override
public void update(LineEvent event) {
LineEvent.Type type = event.getType();
if (type == LineEvent.Type.START) {
System.out.println("Playback started.");
} else if (type == LineEvent.Type.STOP) {
playCompleted = true;
System.out.println("Playback completed.");
}
}
} | [
"elie.roure@etu.umontpellier.fr"
] | elie.roure@etu.umontpellier.fr |
6af6b75de59f73ad4b93cddcd4a54fbad3bacea0 | 020201e39578dca9e49f66ec849eef6a950fd663 | /src/java/obj/Order.java | 64b34a19b6f80ccf90702f3e4ef8880c6523d96a | [] | no_license | nhatsangvn/web_app_retail | bfdeb97cfbe2d66ee4781bc3d035b2e03801561d | 383d98c8664cc6e87f0847c22ccee93e5812bdc1 | refs/heads/master | 2022-03-05T06:40:34.709242 | 2018-01-11T03:04:44 | 2018-01-11T03:04:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,593 | 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 obj;
import java.util.Date;
/**
*
* @author Cpt_Snag
*/
public class Order
{
private Integer oid;
private Integer pid;
private String uid;
private Double total;
private Date dateOrder;
private Date dateDelivery;
private String name;
private String address;
private String phone;
private String description;
private Integer quantity;
private Integer isSent;
public Order()
{
}
public Order(Integer pid, String uid, Double total, Date dateOrder, Date dateDelivery, String name, String address, String phone, String description, Integer quantity, Integer isSent)
{
this.pid = pid;
this.uid = uid;
this.total = total;
this.dateOrder = dateOrder;
this.dateDelivery = dateDelivery;
this.name = name;
this.address = address;
this.phone = phone;
this.description = description;
this.quantity = quantity;
this.isSent = isSent;
}
public Order(Integer oid, Integer pid, String uid, Double total, Date dateOrder, Date dateDelivery, String name, String address, String phone, String description, Integer quantity, Integer isSent)
{
this.oid = oid;
this.pid = pid;
this.uid = uid;
this.total = total;
this.dateOrder = dateOrder;
this.dateDelivery = dateDelivery;
this.name = name;
this.address = address;
this.phone = phone;
this.description = description;
this.quantity = quantity;
this.isSent = isSent;
}
public void setOid(Integer oid)
{
this.oid = oid;
}
public Integer getOid()
{
return oid;
}
public Integer getPid()
{
return pid;
}
public String getUid()
{
return uid;
}
public Double getTotal()
{
return total;
}
public Date getDateOrder()
{
return dateOrder;
}
public Date getDateDelivery()
{
return dateDelivery;
}
public String getName()
{
return name;
}
public String getAddress()
{
return address;
}
public String getPhone()
{
return phone;
}
public String getDescription()
{
return description;
}
public Integer getQuantity()
{
return quantity;
}
public Integer getIsSent()
{
return isSent;
}
public void setPid(Integer pid)
{
this.pid = pid;
}
public void setUid(String uid)
{
this.uid = uid;
}
public void setTotal(Double total)
{
this.total = total;
}
public void setDateOrder(Date dateOrder)
{
this.dateOrder = dateOrder;
}
public void setDateDelivery(Date dateDelivery)
{
this.dateDelivery = dateDelivery;
}
public void setName(String name)
{
this.name = name;
}
public void setAddress(String address)
{
this.address = address;
}
public void setPhone(String phone)
{
this.phone = phone;
}
public void setDescription(String description)
{
this.description = description;
}
public void setQuantity(Integer quantity)
{
this.quantity = quantity;
}
public void setIsSent(Integer isSent)
{
this.isSent = isSent;
}
}
| [
"Cpt_Snag@Cpt-Snag.local"
] | Cpt_Snag@Cpt-Snag.local |
d4fc7d35549810e10e1a0d366ae563c4e716de15 | fb59eb96b9a149d2ec0d6d7bb0c41b2ae9a282e4 | /app/src/main/java/com/dreamers/explorer/placedetail/modal/Place.java | f8a342e57aef319431248c05f694ce2d3dfae4cb | [
"Apache-2.0"
] | permissive | vansikrishna/Explorer | 62cdc21a2fbfc382776a1fc4198b637e4fc6efc3 | 22754dba6b351dc01fc47362255be02fef0c6b1b | refs/heads/master | 2021-04-30T09:33:55.229721 | 2018-02-22T22:34:33 | 2018-02-22T22:34:33 | 121,313,325 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,283 | java | package com.dreamers.explorer.placedetail.modal;
import android.os.Parcel;
import android.os.Parcelable;
import java.io.Serializable;
/**
* Created by c029312 on 2/7/18.
*/
public class Place implements Serializable, Parcelable{
public String id;
public String name;
public String place_id;
public String url;
public String[] types;
public String formatted_address;
public Geometry geometry;
public Photo[] photos;
public String reference;
public float rating;
public String icon;
public Place(){
}
@Override
public int describeContents() {
return 0;
}
/**
* Storing the Student data to Parcel object
**/
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(id);
dest.writeString(name);
dest.writeString(place_id);
dest.writeString(url);
dest.writeStringArray(types);
dest.writeString(formatted_address);
dest.writeParcelable(geometry, flags);
dest.writeParcelableArray(photos, flags);
dest.writeString(reference);
dest.writeString(icon);
dest.writeFloat(rating);
}
/**
* Retrieving Student data from Parcel object
* This constructor is invoked by the method createFromParcel(Parcel source) of
* the object CREATOR
**/
private Place(Parcel in){
this.id = in.readString();
this.name = in.readString();
this.place_id = in.readString();
this.url = in.readString();
this.types = (String[]) in.readArray(String.class.getClassLoader());
this.formatted_address = in.readString();
this.geometry = in.readParcelable(Geometry.class.getClassLoader());
this.photos = (Photo[]) in.readArray(Photo.class.getClassLoader());
this.reference = in.readString();
this.icon = in.readString();
this.rating = in.readFloat();
}
public static final Parcelable.Creator<Place> CREATOR = new Parcelable.Creator<Place>() {
@Override
public Place createFromParcel(Parcel source) {
return new Place(source);
}
@Override
public Place[] newArray(int size) {
return new Place[size];
}
};
}
| [
"bansi.prem@gmail.com"
] | bansi.prem@gmail.com |
05bb88900d3d6146025586f557b6e14a2fdeb76d | c3d87b3fa2ce2964a17931df9bb18b6297af464b | /src/com/tyut/sssy/base/domain/FirmRegType.java | 08d71accd5566718de6a74ead9c3af9ed662b03c | [] | no_license | LX-King/sssy.v.1.1 | 2aa3a4b3fab10a15d2ab11a70de34b7d755e8e73 | 34e91440d6c7c10c94ee01c1dd447f28a4c59474 | refs/heads/master | 2021-01-10T19:38:45.921356 | 2014-08-04T13:39:16 | 2014-08-04T13:39:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 679 | java | package com.tyut.sssy.base.domain;
/**
*
* 项目名称:sssy20120506
* 类名称:FirmRegType
* 类描述:企业注册类型
* 创建人:梁斌
* 创建时间:2012-5-10 下午08:34:58
* 修改人:梁斌
* 修改时间:2012-5-10 下午08:34:58
* 修改备注:
* @version
*
*/
public class FirmRegType {
private String qyzclxDm; // 企业注册类型代码
private String mc; // 企业注册类型名称
public String getQyzclxDm() {
return qyzclxDm;
}
public void setQyzclxDm(String qyzclxDm) {
this.qyzclxDm = qyzclxDm;
}
public String getMc() {
return mc;
}
public void setMc(String mc) {
this.mc = mc;
}
}
| [
"LXiang.tyut@gmail.com"
] | LXiang.tyut@gmail.com |
20776b1b73358a0a3aa27a925a9252f69d87d281 | da7140209a873b33db21ac9eedd83273612090d0 | /jpa-practice/src/main/java/me/torissi/jpapractice/common/enumerate/NationType.java | 7d487ae4770057cb58b6a27ef533848613b11c7f | [] | no_license | eehooj/jpa-practice | 09d413e0fff9c2316f629d7b0df98a25e416c243 | fbe9c4442f225af645a723877e387b757748f83b | refs/heads/master | 2023-09-01T12:08:38.065137 | 2021-07-15T16:01:35 | 2021-07-15T16:01:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 243 | java | package me.torissi.jpapractice.common.enumerate;
public enum NationType {
KOREA("Korea"),
AMERICA("America"),
CHINA("China"),
JAPAN("Japan");
private final String value;
NationType(String value) {
this.value = value;
}
}
| [
"joohee.jeong@emotion.co.kr"
] | joohee.jeong@emotion.co.kr |
fc9e57d2a1d36fbbc53624f9af11c006ab9f5d4c | deceb7a20161603e75413eb874915a5f8e0afd95 | /Previous Team Work/DeRiche Final Project/src/java/Business/Note.java | 316011b774ab0ab0657554ac51fad56164311378 | [] | no_license | Samistine/DeRiche | a72586f6c8700e5daf1ba8e1193437030d004d1a | 544445dd715b847d3ccecff038cb30f760eca26b | refs/heads/master | 2021-01-20T03:06:17.924039 | 2017-12-04T04:46:27 | 2017-12-04T04:46:27 | 101,348,287 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,797 | java | /******************************************************************************************
* @author Carl Moon II.
*@author Yasmina Rabhi added documentation
*@since 3-3-17.
*@description Note business object for DeRichie web app.
* @version 1.0
*****************************************************************************************/
package Business;
import dataAccess.db;
import dataAccess.Access;
import dataAccess.*;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
/******************************************************************************************
*
* @description Note main class for DeRichie web application.
*****************************************************************************************/
public class Note extends Access {
private String noteID;
private String notes;
private String Time_Started;
private String Last_Updated;
private String Time_Submitted;
private String Time_Accepted;
private String Comment;
private String Submitted;
private String TimeReviewer_Accepted;
private String NoteReviewer_Accepted;
private String patientID;
private String UserID;
/**
* @return the noteID
*/
public String getNoteID() {
return noteID;
}
/**
* @param noteID the noteID to set
*/
public void setNoteID(String noteID) {
this.noteID = noteID;
}
/**
* @return the notes
*/
public String getNotes() {
return notes;
}
/**
* @param notes the notes to set
*/
public void setNotes(String notes) {
this.notes = notes;
}
/**
* @return the Time_Started
*/
public String getTime_Started() {
return Time_Started;
}
/**
* @param Time_Started the Time_Started to set
*/
public void setTime_Started(String Time_Started) {
this.Time_Started = Time_Started;
}
/**
* @return the Last_Updated
*/
public String getLast_Updated() {
return Last_Updated;
}
/**
* @param Last_Updated the Last_Updated to set
*/
public void setLast_Updated(String Last_Updated) {
this.Last_Updated = Last_Updated;
}
/**
* @return the Time_Submitted
*/
public String getTime_Submitted() {
return Time_Submitted;
}
/**
* @param Time_Submitted the Time_Submitted to set
*/
public void setTime_Submitted(String Time_Submitted) {
this.Time_Submitted = Time_Submitted;
}
/**
* @return the Time_Accepted
*/
public String getTime_Accepted() {
return Time_Accepted;
}
/**
* @param Time_Accepted the Time_Accepted to set
*/
public void setTime_Accepted(String Time_Accepted) {
this.Time_Accepted = Time_Accepted;
}
/**
* @return the Comment
*/
public String getComment() {
return Comment;
}
/**
* @param Comment the Comment to set
*/
public void setComment(String Comment) {
this.Comment = Comment;
}
/**
* @return the Submitted
*/
public String getSubmitted() {
return Submitted;
}
/**
* @param Submitted the Submitted to set
*/
public void setSubmitted(String Submitted) {
this.Submitted = Submitted;
}
/**
* @return the TimeReviewer_Accepted
*/
public String getTimeReviewer_Accepted() {
return TimeReviewer_Accepted;
}
/**
* @param TimeReviewer_Accepted the TimeReviewer_Accepted to set
*/
public void setTimeReviewer_Accepted(String TimeReviewer_Accepted) {
this.TimeReviewer_Accepted = TimeReviewer_Accepted;
}
/**
* @return the NoteReviewer_Accepted
*/
public String getNoteReviewer_Accepted() {
return NoteReviewer_Accepted;
}
/**
* @param NoteReviewer_Accepted the NoteReviewer_Accepted to set
*/
public void setNoteReviewer_Accepted(String NoteReviewer_Accepted) {
this.NoteReviewer_Accepted = NoteReviewer_Accepted;
}
/**
* @return the patientID
*/
public String getPatientID() {
return patientID;
}
/**
* @param patientID the patientID to set
*/
public void setPatientID(String patientID) {
this.patientID = patientID;
}
/**
* @return the UserID
*/
public String getUserID() {
return UserID;
}
/**
* @param UserID the UserID to set
*/
public void setUserID(String UserID) {
this.UserID = UserID;
}
/******************************************************************************************
*
* @ description User display for testing.
*****************************************************************************************/
public void display()
{
System.out.println("Begin Note.java display ");
System.out.println("Note Id: "+getNoteID());
System.out.println("Notes: "+getNotes());
System.out.println("Time Started: "+getTime_Started());
System.out.println("Last Updated: "+getLast_Updated());
System.out.println("Time Submitted: "+getTime_Submitted());
System.out.println("Time Accepted: "+getTime_Accepted());
System.out.println("Comment: "+getComment());
System.out.println("Submitted: "+getSubmitted());
System.out.println("Time Reviewer Accepted: "+getTimeReviewer_Accepted());
System.out.println("Note Reviewer Accepted: "+getNoteReviewer_Accepted());
System.out.println("Patient ID: "+getPatientID());
System.out.println("User ID: "+getUserID());
System.out.println("End Note.java display ");
}//end display
/******************************************************************************************
* SelectDB() Method
* @description This selectDB method will go in to the Appointments table in the Dentist DB.
* @param nid note ID
* @deprecated
*****************************************************************************************/
public void selectDB(String nid) throws SQLException
{
noteID = nid;
Connection con1 = null;
PreparedStatement ps = null;
String sql = "Select * from note where NoteID = ?";
try
{
con1 = db.dbc();
ps = con1.prepareStatement(sql);
ps.setString(1, getNoteID());
//execute sql statement
ResultSet rs = ps.executeQuery();
while(rs.next())
{
//setUserId(rs.getString(1));
setNotes(rs.getString(2));
setTime_Started(rs.getString(3));
setLast_Updated(rs.getString(4));
setTime_Submitted(rs.getString(5));
setTime_Accepted(rs.getString(6));
setComment(rs.getString(7));
setSubmitted(rs.getString(8));
setTimeReviewer_Accepted(rs.getString(9));
setNoteReviewer_Accepted(rs.getString(10));
setPatientID(rs.getString(11));
setUserID(rs.getString(12));
}
}
catch(SQLException e)
{
e.printStackTrace();
}
finally
{
if (ps != null)
{
ps.close();
}
if(con1 != null)
{
con1.close();
}
}
}// end public void selectDB
/*******************************************************************************
*@description Insert method will put user info into the DeRichie web app.
*@description Inserts into the note table.
*@param n1 notes
*@param ts time started
*@param lu last update
*@param tus time submitted
*@param ta time accepted
*@param c Comments
*@param s submitted
*@param tra time reviewer accepted
*@param nra note reviewer accepted
*@param pid patient ID
*@param uid User ID
*@deprecated
*******************************************************************************/
public void insertDB(String n1, String ts, String lu, String tus, String ta, String c, String s, String tra, String nra, String pid, String uid) throws SQLException
{
notes = n1;
Time_Started = ts;
Last_Updated = lu;
Time_Submitted = tus;
Time_Accepted = ta;
Comment = c;
Submitted = s;
TimeReviewer_Accepted = tra;
NoteReviewer_Accepted = nra;
patientID =pid;
UserID = uid;
Connection con1 = null;
PreparedStatement ps = null;
String sql = "insert into note"
+"(notes, Time_Started, Last_Updated, Time_Submitted, Time_Accepted, Comment, Submitted, TimeReviewer_Accepted, NoteReviewer_Accepted, patientID, UserID) values"
+"(?,?,?,?,?,?,?,?,?,?,?)";
try
{
con1 = db.dbc();
ps = con1.prepareStatement(sql);
ps.setString(1, getNotes());
ps.setString(2, getTime_Started());
ps.setString(3, getLast_Updated());
ps.setString(4, getTime_Submitted());
ps.setString(5, getTime_Accepted());
ps.setString(6, getComment());
ps.setString(7, getSubmitted());
ps.setString(8, getTimeReviewer_Accepted());
ps.setString(9, getNoteReviewer_Accepted());
ps.setString(10, getPatientID());
ps.setString(11, getUserID());
//ps.setString(11, getUserID());
int n = ps.executeUpdate();
if(n==1)
{
System.out.println("Insert User.java Successful!!!");
}
else
{
System.out.println("Insert User.java Failed!!!");
}
}
catch(SQLException e)
{
e.printStackTrace();
}
finally
{
if(ps != null)
{
ps.close();
}
if(con1 != null)
{
con1.close();
}
}
}// end public void insertDB
/******************************************************************************************
** updateDBAdmin() Method
* @description This will allow the admin to update
* @description the note table in the in the DeRichie DB.
* @deprecated
*****************************************************************************************/
public void updateDBAdmin() throws SQLException
{
Connection con1 = null;
PreparedStatement ps = null;
String sql = "update note set notes =?, Time_Started = ?, Last_Updated = ?, Time_Submitted = ?, Time_Accepted = ?, Comment = ?, Submitted = ?, TimeReviewer_Accepted = ?, NoteReviewer_Accepted = ?, patientID = ?, UserID = ? Where NoteID = ?";
try
{
con1 = db.dbc();
ps = con1.prepareStatement(sql);
ps.setString(1, getNotes());
ps.setString(2, getTime_Started());
ps.setString(3, getLast_Updated());
ps.setString(4, getTime_Submitted());
ps.setString(5, getTime_Accepted());
ps.setString(6, getComment());
ps.setString(7, getSubmitted());
ps.setString(8, getTimeReviewer_Accepted());
ps.setString(9, getNoteReviewer_Accepted());
ps.setString(10, getPatientID());
ps.setString(11, getUserID());
ps.setString(12, getNoteID());
//System.out.println(sql);
int n = ps.executeUpdate();
if(n==1)
{
System.out.println("Admin Update Successful!!!");
}
else
{
System.out.println("Admin Update Failed!!!");
}
}
catch(SQLException e)
{
e.printStackTrace();
}
finally
{
if(ps != null)
{
ps.close();
}
if(con1 != null)
{
con1.close();
}
}
}//end updateDBAdmin
/******************************************************************************************
* @description deleteDB() Method
* @description This deleteDB method will go in to the table in the Dentist DB.
* @deprecated
*****************************************************************************************/
public void deleteDB() throws SQLException
{
PreparedStatement ps = null;
Connection con1 = null;
String sql = "delete from note where NoteID = ?";
try
{
con1 = db.dbc();
ps = con1.prepareStatement(sql);
ps.setString(1, getNoteID());
System.out.println(sql);
int n = ps.executeUpdate();
if(n==1)
{
System.out.println("Delete Successful!!!");
}
else
{
System.out.println("Delete Failed!!!");
}
}//end try
catch(SQLException e)
{
e.printStackTrace();
}
finally
{
try
{
if(ps != null)
{
ps.close();
}
if(con1 != null)
{
con1.close();
}
}
catch(SQLException sqle)
{
System.out.println(sqle);
}
}//end finally
}//end deleteDB
public static void main(String[] args)
{
/*
//Testing selectDB(String un)
try
{
Note n = new Note();
n.selectDB("6");
n.display();
}
catch(SQLException e)
{
System.out.println(e);
}
*/
/*
//Testing insertDB
try
{
Note n = new Note();
n.insertDB("this is a test", "2017-03-03 20:35:36", "2017-03-03 20:35:36", "2017-03-03 20:35:36", "2017-03-03 20:35:36", "comment test","1", "2017-04-03 7:35:36","1","3","73");
n.display();
}
catch(SQLException e)
{
System.out.println(e);
}
*/
/*
//Testing updateDBAdmin
try
{
Note n = new Note();
n.selectDB("43");
n.setSubmitted("0");
n.updateDBAdmin();
n.display();
}
catch(SQLException e)
{
System.out.println(e);
}
*/
//Testing deleteDB
try
{
Note n = new Note();
n.selectDB("43");
n.display();
n.deleteDB();
}
catch(SQLException e)
{
System.out.println(e);
}
}//end main method
}// end public class Note | [
"syvolt@gmail.com"
] | syvolt@gmail.com |
60a8a456f64f5372648699e53720bbec9d20d6f5 | 0388c185f3247f1df1b2d43e76121c6573f2f351 | /app/src/main/java/com/example/hpinteli7/reservarest/DeleteLaboratorioActivity.java | 5ac3ad96fd71885a55b13f8925108689ee0f8103 | [] | no_license | cristiancastillo74/reservaRest | 5eca960102b8283216202534ed83faddfaf94b22 | 2b61893fb584e315fad205cebe806348fde26f23 | refs/heads/master | 2020-03-20T08:57:40.373908 | 2018-06-18T17:29:06 | 2018-06-18T17:29:06 | 137,324,246 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,307 | java | package com.example.hpinteli7.reservarest;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.os.StrictMode;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
@SuppressLint("NewApi")
public class DeleteLaboratorioActivity extends Activity{
EditText codlabTxt;
private final String urlHostingGratuito = "http://cm12036pdm115.000webhostapp.com/ws_laboratorio_delete.php";
@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_delete_laboratorio);
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()
.permitAll().build();
StrictMode.setThreadPolicy(policy);
codlabTxt = (EditText) findViewById(R.id.codlab);
}
public void EliminarLab(View v) {
String cod = codlabTxt.getText().toString();
String url = null;
switch (v.getId()) {
case R.id.btn_cicloExterno:
url = urlHostingGratuito + "?codlaboratorio=" + cod;
ControladorServicio.eliminarLaboratorioExterno(url, this);
break;
}
}
}
| [
"30352688+cristiancastillo74@users.noreply.github.com"
] | 30352688+cristiancastillo74@users.noreply.github.com |
d741f340aec16a6939c095197d352ba76eb6b40a | 5451168bfc4ab3a0bc0e044c0e3fd3e003444ba0 | /jtqmusic_web/src/main/java/cn/hkf/controller/SongsMenuController.java | c1c95240d6402a9f109cd168218fa65599523175 | [] | no_license | hkfjava/jtqmusic | 88b0fd3d34a39b3914f38fc5f95f3dcfd03e627e | fba852b8c09537d658a53d1bcfd9489e42e8c4ff | refs/heads/master | 2023-03-15T11:26:46.657363 | 2021-03-12T11:55:09 | 2021-03-12T11:55:09 | 347,024,652 | 6 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,490 | java | package cn.hkf.controller;
import cn.hkf.domain.SongMenu;
import cn.hkf.domain.Songs;
import cn.hkf.domain.SongsAlbumSinger;
import cn.hkf.domain.User;
import cn.hkf.service.IAlbumService;
import cn.hkf.service.ISingerService;
import cn.hkf.service.ISongMenuService;
import cn.hkf.service.ISongsService;
import com.google.gson.Gson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.List;
@Controller
@RequestMapping("/songsmenu")
public class SongsMenuController {
@Autowired
private ISongMenuService songMenuService;
@Autowired
private ISongsService songsService;
@Autowired
private ISingerService singerService;
@Autowired
private IAlbumService albumService;
/**
* 歌单信息页面
*
* @return
* @throws Exception
*/
@RequestMapping(value = "/findBy_id.do")
public ModelAndView findBy_id(Integer songmenu_id) throws Exception {
ModelAndView mv = new ModelAndView();
// 1.根据歌单id查找歌单信息
SongMenu songMenu = songMenuService.findBy_id(songmenu_id);
// 2. 根据歌单id查找所有歌曲id 为数组
Integer[] songs_ids = songMenuService.findSongsIds_by_songmenu_id(songmenu_id);
// 根据歌手id找出所有歌曲信息
List<SongsAlbumSinger> user_coll_songs_ids_info = new ArrayList<>();
// 1. 歌曲信息 遍历用户的歌曲id 返回信息 SongsAlbumSinger
List<Songs> songsList = new ArrayList<>();
for (Integer songs_id : songs_ids) { //便利歌曲id
songsList.add(songsService.findById(songs_id));
}
user_coll_songs_ids_info = findSongs_info(songsList);
mv.addObject("user_coll_songs_ids_info",user_coll_songs_ids_info);
mv.addObject("songMenu",songMenu);
mv.addObject("songMenu_songs_size",songs_ids.length);
mv.setViewName("songmenu-detail");
return mv;
}
// 方法 根据 歌曲集合,返回排行榜歌曲信息集合
public List<SongsAlbumSinger> findSongs_info(List<Songs> songsList) throws Exception {
List<SongsAlbumSinger> songs_playCounts = new ArrayList<>();
// 获取专辑图片
for (Songs songs : songsList) {
SongsAlbumSinger s = new SongsAlbumSinger();
s.setSinger(singerService.findById(songs.getSinger_id()));
s.setAlbum(albumService.findById(songs.getAlbum_id()));
s.setSongs(songs);
songs_playCounts.add(s);
}
return songs_playCounts;
}
/**
* 保存 歌曲到歌单
*
* @return
* @throws Exception
*/
@ResponseBody
@RequestMapping(value = "/save_songmenu_songs.do", method = RequestMethod.POST)
public String save_songmenu_songs(Integer songsmenu_id, Integer songs_id) throws Exception {
int res = songMenuService.save_songmenu_songs(songsmenu_id,songs_id);
if (res == 1) {
return "101";
} else {
return "100";
}
}
/**
* 删除 歌单 的歌曲
*
* @return
* @throws Exception
*/
@ResponseBody
@RequestMapping(value = "/delete_songmenu_songs.do", method = RequestMethod.POST)
public String delete_songmenu_songs(Integer songsmenu_id, Integer songs_id) throws Exception {
int res = songMenuService.delete_songmenu_songs(songsmenu_id,songs_id);
if (res == 1) {
return "101";
} else {
return "100";
}
}
/**
* 保存 歌单
*
* @return
* @throws Exception
*/
@ResponseBody
@RequestMapping(value = "/save.do", method = RequestMethod.POST)
public String save(SongMenu songMenu, HttpSession session) throws Exception {
User user = (User) session.getAttribute("loginUser");
songMenu.setUser_id(user.getUser_id());
int res = songMenuService.save(songMenu);
if (res == 1) {
return "101";
} else {
return "100";
}
}
}
| [
"75961995+hkfjava@users.noreply.github.com"
] | 75961995+hkfjava@users.noreply.github.com |
f25b5b277d06baa1a10650d718b4c5adabd3c270 | a738a900a34f8f3066d7c763360961307fc6deab | /org.afplib/src/main/java/org/afplib/afplib/impl/EMMImpl.java | ca3dbd4cdd91a2d3f41c562d27c1a2ad7435aa31 | [
"Apache-2.0"
] | permissive | mbefokam/afplib | 4c9803bcad76b6212ad09ebcea951fb9614ed530 | da00fe52f4d996466c65ec0c63a1dd36fa711838 | refs/heads/master | 2021-01-20T15:13:29.275687 | 2017-05-08T10:45:17 | 2017-05-08T10:45:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,381 | java | /**
*/
package org.afplib.afplib.impl;
import org.afplib.afplib.AfplibPackage;
import org.afplib.afplib.EMM;
import org.afplib.base.impl.SFImpl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>EMM</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.afplib.afplib.impl.EMMImpl#getMMName <em>MM Name</em>}</li>
* </ul>
*
* @generated
*/
public class EMMImpl extends SFImpl implements EMM {
/**
* The default value of the '{@link #getMMName() <em>MM Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getMMName()
* @generated
* @ordered
*/
protected static final String MM_NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getMMName() <em>MM Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getMMName()
* @generated
* @ordered
*/
protected String mmName = MM_NAME_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EMMImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return AfplibPackage.Literals.EMM;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getMMName() {
return mmName;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setMMName(String newMMName) {
String oldMMName = mmName;
mmName = newMMName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AfplibPackage.EMM__MM_NAME, oldMMName, mmName));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case AfplibPackage.EMM__MM_NAME:
return getMMName();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case AfplibPackage.EMM__MM_NAME:
setMMName((String)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case AfplibPackage.EMM__MM_NAME:
setMMName(MM_NAME_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case AfplibPackage.EMM__MM_NAME:
return MM_NAME_EDEFAULT == null ? mmName != null : !MM_NAME_EDEFAULT.equals(mmName);
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (MMName: ");
result.append(mmName);
result.append(')');
return result.toString();
}
} //EMMImpl
| [
"yan@hcsystems.de"
] | yan@hcsystems.de |
d33ddbca32c5248346b63b8eefb4cab8f38912bf | acd5da068081b8c740753ffd297a73bdf2af1213 | /MizzileKommand/src/main/java/mizzilekommand/nodes/Ground.java | 5e1174222f3abd6f551b15b860d1829003fdd863 | [] | no_license | majormalfunk/otm-harjoitustyo | eddb8a0aaec8a087ff05812da49f13e89bce209f | 9affd46180517e07704dabd0be757526499c6cc6 | refs/heads/master | 2021-04-09T16:57:12.353700 | 2018-05-09T23:19:20 | 2018-05-09T23:19:20 | 125,620,813 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,605 | java | /*
* OTM-harjoitustyö kevät 2018
* Jaakko Vilenius
*/
package mizzilekommand.nodes;
import javafx.scene.paint.Color;
import javafx.scene.shape.Polygon;
import static mizzilekommand.logics.MizzileKommand.APP_WIDTH;
import static mizzilekommand.logics.MizzileKommand.SMALL_LENGTH;
/**
* This represents the ground in the bottom of the screen.
*
* @author jaakkovilenius
*/
public class Ground extends Polygon {
public Ground() {
//APP_WIDTH, (SMALL_LENGTH*2)
this.setId("GROUND");
this.getPoints().addAll(
0.0, SMALL_LENGTH * 2.0, // Lower left corner
APP_WIDTH, SMALL_LENGTH * 2.0, // Lower right corner
APP_WIDTH, SMALL_LENGTH, // Ground level right edge
APP_WIDTH - (SMALL_LENGTH * 1.0), SMALL_LENGTH, // Right mound
APP_WIDTH - (SMALL_LENGTH * 2.0), 0.0,
APP_WIDTH - (SMALL_LENGTH * 4.0), 0.0,
APP_WIDTH - (SMALL_LENGTH * 5.0), SMALL_LENGTH,
(APP_WIDTH / 2.0) + (SMALL_LENGTH * 2.0), SMALL_LENGTH, // Center mound
(APP_WIDTH / 2.0) + (SMALL_LENGTH * 1.0), 0.0,
(APP_WIDTH / 2.0) - (SMALL_LENGTH * 1.0), 0.0,
(APP_WIDTH / 2.0) - (SMALL_LENGTH * 2.2), SMALL_LENGTH,
(SMALL_LENGTH * 5.0), SMALL_LENGTH, // Left mound
(SMALL_LENGTH * 4.0), 0.0,
(SMALL_LENGTH * 2.0), 0.0,
(SMALL_LENGTH * 1.0), SMALL_LENGTH,
0.0, SMALL_LENGTH // Ground level left edge
);
this.setFill(Color.BLACK);
}
}
| [
"32271489+majormalfunk@users.noreply.github.com"
] | 32271489+majormalfunk@users.noreply.github.com |
72d2c0ba913f42b3b80a1d566f202267baf87cbc | dadb52bda0c001d3ee5ea9cf464d0f5cfaed763d | /java02hk/src/java02/test11/exam04/ChatClient03.java | 7ea2cd2a9c01595d9486d53de4e88bcebdc2177a | [] | no_license | HKCHO/Practice | 0f571913b5a85a73bd3ed69b64f6e96214c84d25 | 911a116b3c509b286aa93cd3ff1b9613084dbf5b | refs/heads/master | 2021-01-21T05:00:46.360428 | 2016-06-10T08:38:19 | 2016-06-10T08:38:19 | 26,308,856 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,558 | java | package java02.test11.exam04;
import java.awt.BorderLayout;
import java.awt.Button;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.Label;
import java.awt.Panel;
import java.awt.TextArea;
import java.awt.TextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class ChatClient03 extends Frame {
TextField serverAddr = new TextField(20);
TextField name = new TextField(10);
Button connectBtn = new Button("연결");
TextArea content = new TextArea();
TextField input = new TextField(30);
Button sendBtn = new Button("보내기");
public ChatClient03() {
// 윈도우 준비
Panel toolbar = new Panel(new FlowLayout(FlowLayout.LEFT));
toolbar.add(new Label("이름:"));
toolbar.add(name);
toolbar.add(new Label("서버:"));
toolbar.add(serverAddr);
toolbar.add(connectBtn);
this.add(toolbar, BorderLayout.NORTH);
this.add(content, BorderLayout.CENTER);
Panel bottom = new Panel(new FlowLayout(FlowLayout.LEFT));
bottom.add(input);
bottom.add(sendBtn);
this.add(bottom, BorderLayout.SOUTH);
// 리스너 등록
//1) 윈도우 이벤트를 처리할 리스너 객체 등록
// WindowListener 인터페이스를 구현한 객체여야 한다.
this.addWindowListener(new MyWindowListener());
// ActionEvent는 버튼을 눌렀을 때 발생하는 이벤트이다.
//connectBtn.addActionListener(new MyConnectListener());
// 실무에서는 한번 밖에 안 쓸 객체라면 익명 이너 클래스로 정의한다.
connectBtn.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
System.out.println("연결 버튼 눌렀네..");
}
});
// 보내기 버튼을 눌렀을 때,
//sendBtn.addActionListener(new MySendListener());
sendBtn.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
System.out.println("보내기 버튼 눌렀네..");
}
});
}
public static void main(String[] args) {
ChatClient03 wnd = new ChatClient03();
wnd.setSize(400, 600);
wnd.setVisible(true);
browseThreadInfo(
Thread.currentThread()
.getThreadGroup()
.getParent(),
0);
}
// WindowListener를 직접 구현하지 말고,
// 미리 구현한 WindowAdapter를 상속 받아라!
class MyWindowListener extends WindowAdapter {
// 다음 메서드는 윈도우에서 close 버튼을 눌렀을 때 호출된다.
@Override
public void windowClosing(WindowEvent e) {
System.exit(0);
}
}
public static void browseThreadInfo(ThreadGroup tg, int level) {
displaySpaces(level);
System.out.println("└--->[" + tg.getName() + "]");
ThreadGroup[] groups = new ThreadGroup[10];
int groupCount = 0;
groupCount = tg.enumerate(groups, false);
for (int i = 0; i < groupCount; i++) {
browseThreadInfo(groups[i], level + 1);
}
Thread[] threads = new Thread[10];
int threadCount = 0;
threadCount = tg.enumerate(threads, false);
for (int i = 0; i < threadCount; i++) {
displaySpaces(level + 1);
System.out.println("└--->" + threads[i].getName());
}
}
public static void displaySpaces(int count) {
for (int i = 0; i < count; i++)
System.out.print(" ");
}
}
| [
"j880825@gmail.com"
] | j880825@gmail.com |
9f0589f31d08a0d641cd94b992af025ec491a307 | e392b4010fcba59e158598754be39f3b2b1ace12 | /example_apps/AndroidStudioMinnie/sapphire/src/main/java/boofcv/alg/interpolate/impl/ImplBilinearPixel_S32.java | b7a347c6f923f598968dc41233b349f717857ffb | [
"MIT"
] | permissive | bladestery/Sapphire | f5a0efb180fa9c70a159c3223622f3e9ec8e8bd9 | 5ad2132ebd760a0c842004186652427bc8f498e6 | refs/heads/master | 2021-01-11T23:36:36.141976 | 2017-06-16T04:02:29 | 2017-06-16T04:02:29 | 78,609,801 | 0 | 0 | null | 2017-01-11T06:32:11 | 2017-01-11T06:32:11 | null | UTF-8 | Java | false | false | 2,581 | java | /*
* Copyright (c) 2011-2016, Peter Abeles. All Rights Reserved.
*
* This file is part of BoofCV (http://boofcv.org).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package boofcv.alg.interpolate.impl;
import boofcv.alg.interpolate.BilinearPixelS;
import boofcv.core.image.border.ImageBorder_S32;
import boofcv.struct.image.GrayS32;
import boofcv.struct.image.ImageType;
/**
* <p>
* Implementation of {@link BilinearPixelS} for a specific image type.
* </p>
*
* <p>
* NOTE: This code was automatically generated using {@link GenerateImplBilinearPixel}.
* </p>
*
* @author Peter Abeles
*/
public class ImplBilinearPixel_S32 extends BilinearPixelS<GrayS32> {
public ImplBilinearPixel_S32() {
}
public ImplBilinearPixel_S32(GrayS32 orig) {
setImage(orig);
}
@Override
public float get_fast(float x, float y) {
int xt = (int) x;
int yt = (int) y;
float ax = x - xt;
float ay = y - yt;
int index = orig.startIndex + yt * stride + xt;
int[] data = orig.data;
float val = (1.0f - ax) * (1.0f - ay) * (data[index] ); // (x,y)
val += ax * (1.0f - ay) * (data[index + 1] ); // (x+1,y)
val += ax * ay * (data[index + 1 + stride] ); // (x+1,y+1)
val += (1.0f - ax) * ay * (data[index + stride] ); // (x,y+1)
return val;
}
public float get_border(float x, float y) {
float xf = (float)Math.floor(x);
float yf = (float)Math.floor(y);
int xt = (int) xf;
int yt = (int) yf;
float ax = x - xf;
float ay = y - yf;
ImageBorder_S32 border = (ImageBorder_S32)this.border;
float val = (1.0f - ax) * (1.0f - ay) * border.get(xt,yt); // (x,y)
val += ax * (1.0f - ay) * border.get(xt + 1, yt);; // (x+1,y)
val += ax * ay * border.get(xt + 1, yt + 1);; // (x+1,y+1)
val += (1.0f - ax) * ay * border.get(xt,yt+1);; // (x,y+1)
return val;
}
@Override
public float get(float x, float y) {
if (x < 0 || y < 0 || x > width-2 || y > height-2)
return get_border(x,y);
return get_fast(x,y);
}
@Override
public ImageType<GrayS32> getImageType(ImageType IT) {
return IT.single(GrayS32.class);
}
}
| [
"benbeyblade@hotmail.com"
] | benbeyblade@hotmail.com |
9fc5d1a11f4d9d2b2a9aee039d5512344f6b7351 | 9450dd25e7f2171443f4201aae7a2e4702375bab | /commons/src/main/java/com/epam/eco/schemacatalog/fts/JsonSearchQuery.java | e96f0e02cd75dc97a3467667e6199d76a2e9b3e6 | [
"Apache-2.0"
] | permissive | SerafimovichEugene/eco-schema-catalog | 0b5c751253a928b0757b75bd8fa4459ceb279533 | 1183f5b22ed61b1aaf385b727806aa62e074dc50 | refs/heads/master | 2021-05-20T19:12:06.861063 | 2020-03-21T06:34:15 | 2020-03-21T06:34:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,136 | java | /*
* Copyright 2019 EPAM Systems
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.epam.eco.schemacatalog.fts;
import java.util.Objects;
import org.springframework.data.domain.Pageable;
/**
* @author Andrei_Tytsik
*/
public final class JsonSearchQuery extends AbstractPagedQuery{
private String json;
public JsonSearchQuery() {
}
public JsonSearchQuery(String json) {
this.json = json;
}
public JsonSearchQuery(String json, Pageable pageable) {
super(pageable);
this.json = json;
}
public JsonSearchQuery(String json, int page, int pageSize) {
super(page, pageSize);
this.json = json;
}
public String getJson() {
return json;
}
public void setJson(String json) {
this.json = json;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
JsonSearchQuery that = (JsonSearchQuery) obj;
return
Objects.equals(this.json, that.json) &&
Objects.equals(this.getPage(), that.getPage()) &&
Objects.equals(this.getPageSize(), that.getPageSize());
}
@Override
public int hashCode() {
return Objects.hash(json, getPage(), getPageSize());
}
@Override
public String toString() {
return
"{json: " + json +
", page: " + getPage() +
", pageSize: " + getPageSize() +
"}";
}
}
| [
"Raman_Babich@epam.com"
] | Raman_Babich@epam.com |
d627ec6758561ffbd123a0ed59f61546c373a837 | afc49362de62b789041bbcbf8532815060df9831 | /src/main/java/com/pcz/idworker/strategy/RandomCodeStrategy.java | 9bd4fc77633ee76b09fcb4dee15ab7c49d43accb | [] | no_license | picongzhi/chat-netty | c74a9d5b36e8b55ca46512105d852518d4f2b866 | ce5543415062f3b769ce2c7ff1f02ac195396334 | refs/heads/master | 2022-06-23T23:38:27.548921 | 2020-02-14T09:53:24 | 2020-02-14T09:53:24 | 236,270,442 | 0 | 0 | null | 2022-06-21T02:42:05 | 2020-01-26T05:18:53 | Java | UTF-8 | Java | false | false | 179 | java | package com.pcz.idworker.strategy;
/**
* @author picongzhi
*/
public interface RandomCodeStrategy {
void init();
int prefix();
int next();
void release();
}
| [
"picongzhi@gmail.com"
] | picongzhi@gmail.com |
ec0821e407da6c3bebf3969c47633a8d5fe8bd16 | f333b73ac12080ae5590758d26cc13b513304368 | /flickrsorter/src/main/java/org/ahuh/flickr/sorter/helper/DateHelper.java | 07c832c869b9c1abdc08c648a207445363ae09e0 | [
"MIT"
] | permissive | ahuh/flickrsorter | dc3c76d1a7b0b693abf5df9ec86b58d632893b6c | 18a192ea41b781384db898d2907b108b0e1f711c | refs/heads/master | 2021-01-10T20:55:31.630947 | 2014-11-23T19:12:31 | 2014-11-23T19:12:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 357 | java | package org.ahuh.flickr.sorter.helper;
import org.joda.time.DateTime;
/**
* Date Helper
* @author Julien
*
*/
public class DateHelper {
/**
* Convert JSON to Java Date
* @param jsonDate
* @return
*/
public static DateTime convertJsonToJava(String jsonDate) {
return new DateTime(Long.parseLong(jsonDate) * 1000);
}
}
| [
"ahuh@free.fr"
] | ahuh@free.fr |
a8953013b644cd50bf0eba891d7bff95f72df87b | 2ac31cdebd9ca0c2b712f1d5e6e193138366ae8f | /fx8/src/phone/controller/TablesController.java | 3707ad37966182f0b10579a97641e5df778d53b1 | [] | no_license | sukdongkim/crud4 | 629944eb85cdbfe6d8b36cd7f39ccb452ff48e17 | d9284cbba4e0e2c8075f055626284ef079b1d254 | refs/heads/master | 2023-03-17T17:32:23.659389 | 2021-02-27T13:22:58 | 2021-02-27T13:22:58 | 340,275,677 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,608 | java | package phone.controller;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javafx.scene.control.cell.PropertyValueFactory;
import phone.Tables;
import phone.mysqlconnect;
public class TablesController {
Connection conn = null;
// String newSelection,oldSelection,obs;
Tables tables;
@FXML
private TextField tfTableName;
@FXML
private Button btnUpdate;
@FXML
private Button btnDelete;
@FXML
private TableView<Tables> tableView;
ObservableList<Tables> tableList;
@FXML
private TableColumn<Tables, Integer> colId;
@FXML
private TableColumn<Tables, String> colName;
@FXML
private void initialize() {
addListenerForTable();
showTable();
}
@FXML
void deleteTable(ActionEvent event) {
conn = mysqlconnect.ConnectDb();
Tables table = tableView.getSelectionModel().getSelectedItem();
String query = "DELETE FROM tblTable WHERE id = '"+table.getId()+"'";
execteQuery(query);
showTable();
}
@FXML
void updateTable(ActionEvent event) {
conn = mysqlconnect.ConnectDb();
Tables table = tableView.getSelectionModel().getSelectedItem();
String query = "UPDATE tblTable SET name = '"+tfTableName.getText()+"' WHERE id = '"+table.getId()+"'";
execteQuery(query);
showTable();
}
private void addListenerForTable() {
tableView.getSelectionModel().selectedItemProperty().addListener((obs,oldSelection,newSelection) -> {
if(newSelection != null) {
btnUpdate.setDisable(false);
btnDelete.setDisable(false);
tfTableName.setText(newSelection.getName());
}else {
tfTableName.setText("");
btnUpdate.setDisable(true);
btnDelete.setDisable(true);
}
});
}
@FXML
void saveTable(ActionEvent event) {
insertRecord();
}
public void showTable() {
ObservableList<Tables> list = getTableList();
colId.setCellValueFactory(new PropertyValueFactory<Tables,Integer>("id"));
colName.setCellValueFactory(new PropertyValueFactory<Tables,String>("name"));
tableView.setItems(list);
}
private void insertRecord() {
String name = tfTableName.getText();
if(!name.isEmpty()) {
String query = "INSERT INTO tblTable (name) VALUES ('" + name +"')";
execteQuery(query);
showTable();
tfTableName.setText("");
}
}
private void execteQuery(String query) {
conn = mysqlconnect.ConnectDb();
Statement st;
try {
st = conn.createStatement();
st.executeUpdate(query);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// TODO Auto-generated method stub
}
private ObservableList<Tables> getTableList() {
tableList = FXCollections.observableArrayList();
conn = mysqlconnect.ConnectDb();
String query = "SELECT * FROM tblTable";
Statement st;
ResultSet rs;
try {
st = conn.createStatement();
rs = st.executeQuery(query);
while(rs.next()) {
tables = new Tables(rs.getInt("id"), rs.getString("name"));
tableList.add(tables);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return tableList;
}
}
| [
"73944038+sukdong-kim@users.noreply.github.com"
] | 73944038+sukdong-kim@users.noreply.github.com |
f08d2c17ba0b5d4b2ea45ef242fac2ea8dcb821f | b2cc9d22857bffa381d66f7631dc4b3ea066c2f8 | /src/tarea1_ingsoft/main2.java | 12e2b72366b8332884bd7105ad26ef488157b776 | [] | no_license | AlbertoIHP/Tarea-1---ING_SOFT | 3ae3097cd61d15514dc631adf07678e9c32d4e07 | 5199df522ca0dff1f704d75fafacd3177eb6ef74 | refs/heads/master | 2021-03-27T11:46:01.399303 | 2016-09-24T23:12:27 | 2016-09-24T23:12:27 | 69,125,326 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 836 | 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 tarea1_ingsoft;
/**
*
* @author Alberto
*/
public class main2 {
public static void main(String[] args) {
TableroAjedrezM tablero = new TableroAjedrezM();
tablero.mostrarTablero();
System.out.println("************************************");
tablero.insertarPieza("Alfil", "Blanco", 5, 3);
tablero.mostrarTablero();
System.out.println("************************************");
tablero.insertarPieza("Alfil", "Blanco", 6, 4);
tablero.consultarOpciones(5, 3);
tablero.mostrarTablero();
}
}
| [
"Alberto@192.168.1.6"
] | Alberto@192.168.1.6 |
a57f6a1fabf8f1e64c0cb51c420450930516e3d9 | a131474008f0e5eee81465ca387d9b0846ea2ffd | /app/src/main/java/cn/edu/gdmec/android/boxuegu/activity/LoginActivity.java | af8f7a2f77c0c855835787ca3dfac5f6ad9c95fb | [] | no_license | hainanss/Boxuegu | 05de78aa54c650abf0e1b770b31c6f8b685f0a5f | 3ff4d9b7575a4fcf382e6472212360a1f44b57f0 | refs/heads/master | 2020-05-09T12:58:07.462007 | 2018-03-07T09:37:45 | 2018-03-07T09:37:45 | 181,132,034 | 1 | 0 | null | 2019-04-13T06:44:52 | 2019-04-13T06:44:51 | null | UTF-8 | Java | false | false | 5,489 | java | package cn.edu.gdmec.android.boxuegu.activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import cn.edu.gdmec.android.boxuegu.MainActivity;
import cn.edu.gdmec.android.boxuegu.R;
import cn.edu.gdmec.android.boxuegu.utils.MD5Utils;
public class LoginActivity extends AppCompatActivity {
private TextView tv_back;
private TextView tv_register;
private TextView tv_find_psw;
private TextView btn_login;
private TextView tv_main_title;
private EditText et_user_name;
private EditText et_psw;
private String userName;
private String psw;
private String md5Psw;
private String spPsw;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
init();
}
/*
* 获取页面控件*/
private void init() {
tv_main_title = (TextView)findViewById(R.id.tv_main_title);
tv_main_title.setText("登录");
tv_back = (TextView)findViewById(R.id.tv_back);
tv_register = (TextView)findViewById(R.id.tv_register);
tv_find_psw = (TextView)findViewById(R.id.tv_find_psw);
btn_login = (TextView)findViewById(R.id.btn_login);
et_user_name = (EditText)findViewById(R.id.et_user_name);
et_psw = (EditText)findViewById(R.id.et_psw);
tv_back.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View view) {
LoginActivity.this.finish();
}
});
//立即注册按钮的点击事件
tv_register.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(LoginActivity.this,RegisterActivity.class);
startActivityForResult(intent,1);
}
});
//找回密码控件的点击事件
tv_find_psw.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//跳转到找回密码界面
Intent intent = new Intent(LoginActivity.this,FindPswActivity.class);
startActivity(intent);
}
});
//登录按钮的点击事件
btn_login.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
userName = et_user_name.getText().toString().trim();
psw = et_psw.getText().toString().trim();
md5Psw = MD5Utils.md5(psw);
spPsw = readPsw(userName);
if (TextUtils.isEmpty(userName)){
Toast.makeText(LoginActivity.this,"请输入用户名",Toast.LENGTH_LONG).show();
}else if (TextUtils.isEmpty(psw)){
Toast.makeText(LoginActivity.this,"请输入密码",Toast.LENGTH_LONG).show();
}else if (md5Psw.equals(spPsw)){
Toast.makeText(LoginActivity.this,"登录成功",Toast.LENGTH_LONG).show();
//保持登录状态和登录的用户名
saveLoginStatus(true,userName);
Intent data = new Intent();
data.putExtra("isLogin",true);
setResult(RESULT_OK,data);
//跳转到主页
LoginActivity.this.finish();
Intent intent = new Intent(LoginActivity.this,MainActivity.class);
startActivity(intent);
}else if (!TextUtils.isEmpty(spPsw) && !md5Psw.equals(spPsw)){
Toast.makeText(LoginActivity.this,"输入的用户名和密码不一致",Toast.LENGTH_LONG).show();
}else {
Toast.makeText(LoginActivity.this,"此用户名不存在",Toast.LENGTH_LONG).show();
}
}
});
}
private void saveLoginStatus(boolean status, String userName) {
//loginInfo表示文件名
SharedPreferences sp = getSharedPreferences("loginInfo",MODE_PRIVATE);
SharedPreferences.Editor editor = sp.edit(); //获取编辑器
editor.putBoolean("isLogin",status); //存入boolean类型的登录状态
editor.putString("loginUserName",userName); //存入登录时的用户名
editor.apply();
}
private String readPsw(String userName) {
SharedPreferences sp = getSharedPreferences("loginInfo",MODE_PRIVATE);
return sp.getString(userName,"");
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (data!=null){
//从注册界面传递过来的用户名
String userName = data.getStringExtra("userName");
if (!TextUtils.isEmpty(userName)){
et_user_name.setText(userName);
//设置光标的位置
et_user_name.setSelection(userName.length());
}
}
}
}
| [
"1274003356@qq.com"
] | 1274003356@qq.com |
13114bce4922151a5604757ead4c25cca8454e16 | 1a87bf5677eb5a04c2d82bdf19fb77fa843f783c | /src/Learn_Basic/Recursion/Test.java | 61c2023743d6b250c3c9f38fd51231f7830ad019 | [] | no_license | EvgenyKostyukov/myWorks | a3b90a0a45b62461b9b1b762954bf5736826bc0c | d21701598ad7d24cef5e70d12175f3c14bc6cb2a | refs/heads/master | 2023-01-08T15:13:19.999287 | 2020-10-21T09:55:17 | 2020-10-21T09:55:17 | 303,689,116 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 462 | java | package Learn_Basic.Recursion;
public class Test {
public static void main(String[] args) {
System.out.println(4);
}
private static int fac(int n){
if(n == 1)
return 1;
return n * fac(n-1);
}
// counter(3);
// }
//
// private static void counter(int n){
// if (n==0)
// return;
//
// System.out.println(n);
//
// counter(n-1);
//
//
}
| [
"evgenykostyukov97@mail.ru"
] | evgenykostyukov97@mail.ru |
41c1025ba0c6e42d315f9f3d87e93de9c29adcc0 | 30c312355026b22cef79730fa8145f304a56620e | /src/main/java/com/online/store/models/ItemSale.java | 338631b536f795c58aafd5968812fb5211b4d340 | [] | no_license | Pamela1606/online-store | bd09cd8adebe7cea4b38f2097ed62774a43ada2f | 75ce0e14ec97cf2b1e9566efc350ba56df8700f1 | refs/heads/master | 2020-04-30T04:06:40.993558 | 2019-03-25T20:50:21 | 2019-03-25T20:50:21 | 176,603,675 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 515 | java | package com.online.store.models;
import javax.persistence.*;
@Entity
public class ItemSale extends ModelBase {
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "id_sale")
private Sale sale;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "id_item")
private Item item;
public Sale getSale() { return sale; }
public void setSale(Sale sale) { this.sale = sale; }
public Item getItem() { return item; }
public void setItem(Item item) { this.item = item; }
}
| [
"pam16card@gmail.com"
] | pam16card@gmail.com |
21287171c4c873ec5bb83cfa062b5c11fa4ed424 | 58a8f0c721cb101202e4185bc3af5251c126a5e1 | /src/de/nxtlinx/anmelden/Anmelden.java | bbad5552747b7fd66cce0827d9620533774814a3 | [] | no_license | NxtLinx/AnmeldePlugin | d03872fb90b751da31cef2e7990a880fe70cb505 | efd719565cdeafeed798771bc6e60834bb1df037 | refs/heads/master | 2020-05-22T08:51:30.919335 | 2019-05-12T18:03:04 | 2019-05-12T18:03:04 | 186,287,664 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,063 | java | package de.nxtlinx.anmelden;
import de.nxtlinx.anmelden.listeners.PlayerConnection;
import de.nxtlinx.anmelden.mysql.MySQL;
import de.nxtlinx.anmelden.mysql.MySQLFile;
import org.bukkit.Bukkit;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
public class Anmelden extends JavaPlugin {
public static final String PREFIX ="§3Web-Account§7| §r";
private static Anmelden plugin;
private MySQL mySQL;
private MySQLFile mySQLFile;
@Override
public void onEnable() {
plugin = this;
mySQLFile = new MySQLFile();
mySQL = new MySQL();
PluginManager pm = Bukkit.getPluginManager();
pm.registerEvents(new PlayerConnection(),this);
}
@Override
public void onDisable() {
if (mySQL.isConnected()){
mySQL.disconnect();
}
}
public static Anmelden getPlugin() {
return plugin;
}
public MySQL getMySQL() {
return mySQL;
}
public MySQLFile getMySQLFile() {
return mySQLFile;
}
}
| [
"optitime6@gmail.com"
] | optitime6@gmail.com |
4f83be624efcd7227ba0cece7819834037df9d74 | 665110e99befea67ea7dcdd6939e313cff471654 | /examples/src/main/java/net/smert/frameworkgl/examples/gl1bulletphysics/Configuration.java | 17a25de3d1e8b31f0eceb56b5b0276058aeb10fb | [
"Apache-2.0"
] | permissive | kovertopz/Framework-GL | 187cd6771c5ed0192da3564a22c6281956bb2ce2 | 1504f4746c80bf0667f62ecea2569f8d37a46184 | refs/heads/master | 2021-06-07T08:22:46.693230 | 2017-07-08T09:10:17 | 2017-07-08T09:10:17 | 24,876,706 | 10 | 1 | null | null | null | null | UTF-8 | Java | false | false | 956 | java | /**
* Copyright 2014 Jason Sorensen (sorensenj@smert.net)
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package net.smert.frameworkgl.examples.gl1bulletphysics;
/**
*
* @author Jason Sorensen <sorensenj@smert.net>
*/
public class Configuration extends net.smert.frameworkgl.Configuration {
public Configuration(String[] args) {
super(args);
withOpenGLProfileAny();
setWindowTitle("OpenGL 1.5 Bullet Physics");
}
}
| [
"git@smert.net"
] | git@smert.net |
bacc6a87a9f159e2f031ab95041cb8e5f7c964be | 6d643786645fd00d501eafabaef7bc09d17cc15d | /Android/ProgressBarExample/app/src/androidTest/java/com/example/progressbarexample/ExampleInstrumentedTest.java | a25d287f0e3b96956c1088529d2f0c1aea608638 | [] | no_license | shivahegonde/ReaaltimeLocalization | 16c1298240ff943bce7ece804eebc5e9767944ae | c0987c580630a4541f18375facbee875ed6cd60b | refs/heads/master | 2020-07-23T12:21:08.428238 | 2019-09-10T12:07:39 | 2019-09-10T12:07:39 | 207,554,693 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 744 | java | package com.example.progressbarexample;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.progressbarexample", appContext.getPackageName());
}
}
| [
"stmsco.co@gmail.com"
] | stmsco.co@gmail.com |
ff681709343dd82b944bb891bcbc3eefa0f6ab57 | c7172b8ed15ceaadb9c47978bfb2a56a87b8d05a | /src/main/java/com/demo/Config/MyAppConfig.java | c806daed0bc9830b2d34f8335fc90d829207b5b6 | [] | no_license | LinMurrays/properties-demo | d8c4116cbbcbc94262b9d4a1a9551539729575fd | dda3803fe6b5fbde45ed51eadfcf8505d16853bc | refs/heads/master | 2023-03-13T09:15:41.848192 | 2021-02-20T09:14:07 | 2021-02-20T09:14:07 | 276,317,706 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 741 | java | package com.demo.Config;
import com.demo.Service.HelloService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @Configuration:指明当前类是一个配置类;就是来替代之前的Spring配置文件(bean.xml)
*
* 在配置文件中用<bean><bean/>标签添加组件
*Spring推荐使用全注解的方式
*/
@Configuration
public class MyAppConfig {
//将方法的返回值添加到容器中;容器中这个组件默认的id就是方法名,方法名默认和类名一致
@Bean
public HelloService helloService(){
System.out.println("配置类@Bean给容器中添加组件了...");
return new HelloService();
}
}
| [
"linmurrays@outlook.com"
] | linmurrays@outlook.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.