blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 28 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
58e2cbc962cd3b2642592028127be652ca008d55 | 14fa6e5827cf6555d7f58a2336d9c439e0a4bbdf | /src/main/java/fi/hut/cs/treelib/stats/StatisticsPrinter.java | 7d5e179d90b57c1af11dd9fb2dde4b2a57c69492 | [] | no_license | thaapasa/treelib | cb3e5e090a02d9228763f16be74dd285ffd80e84 | 20ff50053c2faf9fb040733eeab0d3c41cc16dbe | refs/heads/master | 2022-11-13T08:41:51.445693 | 2020-06-23T12:11:35 | 2020-06-23T12:11:35 | 274,396,273 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 592 | java | package fi.hut.cs.treelib.stats;
import java.io.File;
import java.io.PrintStream;
import fi.hut.cs.treelib.Database;
public interface StatisticsPrinter {
void showStatistics(StatisticsLogger stats, Database<?, ?, ?> db, String title);
void showStatistics(Statistics stats, Database<?, ?, ?> db, String title);
void setTargetStream(PrintStream stream);
void setTargetFile(File file);
/**
* Extra information that will be output alongside the statistics. Set to
* null to disable.
*/
void setExtraTestInfo(String info);
}
| [
"tuukka.haapasalo@gmail.com"
] | tuukka.haapasalo@gmail.com |
f6e4ce359b677b197abb7d9a46a0ef31131df85c | a94ad6bee655d3082a9d126b97a20a584869fe69 | /demo_m/src/com/xiaoxiaowang/service/AlipaySetUpServvice.java | 81fb369ddbbaad4ec2435d4d808c6e2f672b52be | [] | no_license | begintogithub/1v1 | fb55035c8ac04abb5e646a12a9ad563c43d805e7 | 75b0332cbdb436e22f33f7072a3e9daf75b2f5b7 | refs/heads/master | 2023-04-19T03:08:12.805975 | 2021-04-30T07:19:43 | 2021-04-30T07:19:43 | 363,066,205 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 628 | java | package com.xiaoxiaowang.service;
import com.xiaoxiaowang.util.MessageUtil;
import net.sf.json.JSONObject;
public interface AlipaySetUpServvice {
/**
* 设置支付宝相关资料
* @param t_id
* @param t_alipay_appid
* @param t_alipay_private_key
* @param t_alipay_public_key
* @return
*/
MessageUtil setAlipaySetUp(Integer t_id,String t_alipay_appid,String t_alipay_private_key,String t_alipay_public_key);
/**
* 删除数据
* @param t_id
* @return
*/
MessageUtil delAlipaySetUp(int t_id);
/**
* 获取列表
* @param page
* @return
*/
JSONObject getAlipaySetUpList(int page);
}
| [
"87102040@qq.com"
] | 87102040@qq.com |
3605e969b4a9b53099c9e8e0dea41697b8edccb3 | 8bd4b9d52c4e5ce6cd2690cf0bb8e9cecb6991af | /03/src/Vektor.java | d63862201002b4986f031229228ca82561c60128 | [] | no_license | Programovanie4/Kod | be0c21241c6d735aa172badefc780fe3d69b99e5 | 6bd8ca18c04b6c4264ff2a64a0161d58cde5b916 | refs/heads/main | 2023-05-27T02:08:47.070453 | 2023-05-05T06:50:06 | 2023-05-05T06:50:06 | 50,527,388 | 1 | 4 | null | null | null | null | UTF-8 | Java | false | false | 737 | java | import java.util.Arrays;
public class Vektor {
private double[] v;
public Vektor(double[] a) {
v = Arrays.copyOf(a, a.length);
}
public String toString() {
String s = "[";
for(int i=0; i<v.length; i++)
s += v[i]+ ((i+1==v.length)?"]":",");
return s;
}
public void add(Vektor b) {
if (v.length == b.v.length) {
for(int i=0; i<v.length; i++)
v[i] += b.v[i];
} else
throw new VektorException("scitujes nerovnake vektory");
}
public static void main(String[] args) {
double[] p = {1,2,3,4};
double[] r = {2,3,4,5};
Vektor v1 = new Vektor(p);
Vektor v2 = new Vektor(r);
System.out.println(v1);
System.out.println(v2);
v1.add(v2);
System.out.println(v1);
System.out.println(v2);
}
}
| [
"peter.borovansky@microstep-mis.com"
] | peter.borovansky@microstep-mis.com |
9bbc6bfbb4744492e3ee396d7b02c0cc42a5d5ee | 8737bc43f56c37a231183c75c270b9b448d6f7bf | /src/test/java/tk/mybatis/mapper/test/rowbounds/TestSelectRowBounds.java | 901285e3e006bf8a3f7791e0f4efc0e34d4e462c | [
"MIT"
] | permissive | wanghengGit/tk-mybatis | ba204afa35b61f1c41db1143fd80913af4cf4e28 | fed658a5398b1f076542089f5dd65d0fd23ac1e9 | refs/heads/master | 2021-05-19T16:59:43.443257 | 2021-02-04T05:39:11 | 2021-02-04T05:39:11 | 252,038,933 | 0 | 0 | MIT | 2020-04-01T01:18:05 | 2020-04-01T01:18:04 | null | UTF-8 | Java | false | false | 2,254 | java | /*
* The MIT License (MIT)
*
* Copyright (c) 2014-2016 abel533@gmail.com
*
* 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 tk.mybatis.mapper.test.rowbounds;
import org.apache.ibatis.session.RowBounds;
import org.apache.ibatis.session.SqlSession;
import org.junit.Assert;
import org.junit.Test;
import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.mapper.CountryMapper;
import tk.mybatis.mapper.mapper.MybatisHelper;
import tk.mybatis.mapper.model.Country;
import java.util.List;
/**
* @author liuzh
*/
public class TestSelectRowBounds {
@Test
public void testSelectByExample() {
SqlSession sqlSession = MybatisHelper.getSqlSession();
try {
CountryMapper mapper = sqlSession.getMapper(CountryMapper.class);
Example example = new Example(Country.class);
example.createCriteria().andGreaterThan("id", 100).andLessThan("id", 151);
example.or().andLessThan("id", 41);
List<Country> countries = mapper.selectByExampleAndRowBounds(example, new RowBounds(10, 20));
//查询总数
Assert.assertEquals(20, countries.size());
} finally {
sqlSession.close();
}
}
}
| [
"wenzhiwei170313@credithc.com"
] | wenzhiwei170313@credithc.com |
970d8bbe0d128bf4b18eae7d2f0d9cac42e21fd7 | e02261fc4dc31e9e553f9ef10effa73974cf78b6 | /app/src/androidTest/java/com/pratikcodes/shopmerchant/ExampleInstrumentedTest.java | ded05804226e84946d10002cdcff5ffec01bb9a3 | [] | no_license | pratik-kate/Grocery-Shop-Merchant | cf1556aa8777302b58f08c9d254acfda8090cc76 | 01b02f58f041720282105c19da5f1fcc500ccafa | refs/heads/main | 2023-06-03T20:38:19.004071 | 2021-06-26T09:06:50 | 2021-06-26T09:06:50 | 338,969,623 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 786 | java | package com.pratikcodes.shopmerchant;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented shopmerchant, 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 shopmerchant.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.pratikcodes.shopmerchant", appContext.getPackageName());
}
} | [
"pratikrkate@gmail.com"
] | pratikrkate@gmail.com |
3db6993d2de31f2ad1b4c08b59c35a14828d2e83 | 8ced32b21f1be9511c256cb8b589d7976b4b98d6 | /alanmall-service/order-service/order-provider/src/main/java/com/itcrazy/alanmall/order/utils/MqFactory.java | a2550ff0f9e151e36e3c66bcfb2acc463aa899ee | [] | no_license | Yangliang266/Alanmall | e5d1e57441790a481ae5aa75aa9d091909440281 | 38c2bde86dab6fd0277c87f99bc860bfc0fbdc0a | refs/heads/master | 2023-06-13T05:01:25.747444 | 2021-07-10T12:18:58 | 2021-07-10T12:18:58 | 293,702,057 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,446 | java | package com.itcrazy.alanmall.order.utils;
import com.itcrazy.alanmall.order.context.CreateOrderContext;
import com.itcrazy.alanmall.order.context.TransHandlerContext;
import lombok.Data;
import org.apache.commons.lang3.time.FastDateFormat;
import org.springframework.stereotype.Component;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* @Auther: mathyoung
* @description: mq 请求封装
*/
@Component
@Data
public class MqFactory {
public volatile static MqTransCondition mqTransCondition = new MqTransCondition();
public static Map<String, MqTransCondition> pool = new ConcurrentHashMap<String, MqTransCondition>();
private static final FastDateFormat FAST_DATE_FORMAT = FastDateFormat.getInstance("yyyyMMddHHmmss");
public static MqTransCondition getFlyweight(TransHandlerContext context, String exchange, String queue) {
CreateOrderContext createOrderContext = (CreateOrderContext) context;
if (pool.containsKey(createOrderContext.getUserId().toString())) {
mqTransCondition.setMsgId(Long.valueOf(FAST_DATE_FORMAT.format(System.currentTimeMillis())));
} else {
MqTransCondition mqTransCondition1 = new MqTransCondition(createOrderContext, exchange, queue);
pool.put(mqTransCondition1.getUserId().toString(), mqTransCondition1);
mqTransCondition = mqTransCondition1;
}
return mqTransCondition;
}
}
| [
"546493589@qq.com"
] | 546493589@qq.com |
e6e079dbfe46b786ab779588be09859416adecda | 1adc03f2f41ab1ea93b89ee4de5fcfca70a449a1 | /src/main/java/com/algamoney/api/resource/PessoaResource.java | 6105b22daa97b39054427a97fa2e0792eeb82f24 | [] | no_license | cpsoneghett/algaworks | b457ab7f9999c03e084e64a306c5355b052cff73 | f6e8f650112f177f32cf2ea83c0d13fff8b088f4 | refs/heads/master | 2022-04-13T04:04:20.778675 | 2019-11-30T15:58:51 | 2019-11-30T15:58:51 | 210,693,165 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,501 | java | package com.algamoney.api.resource;
import java.util.Optional;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import com.algamoney.api.event.RecursoCriadoEvent;
import com.algamoney.api.model.Pessoa;
import com.algamoney.api.repository.PessoaRepository;
import com.algamoney.api.repository.filter.PessoaFilter;
import com.algamoney.api.service.PessoaService;
@RestController
@RequestMapping( "/pessoas" )
public class PessoaResource {
@Autowired
private PessoaRepository pessoaRepository;
@Autowired
private ApplicationEventPublisher publisher;
@Autowired
private PessoaService pessoaService;
@GetMapping
@PreAuthorize( "hasAuthority('ROLE_PESQUISAR_PESSOA') and #oauth2.hasScope('read')" )
public Page<Pessoa> listar( PessoaFilter pessoaFilter, Pageable pageable ) {
return pessoaRepository.filtrar( pessoaFilter, pageable );
}
@PostMapping
@PreAuthorize( "hasAuthority('ROLE_CADASTRAR_PESSOA') and #oauth2.hasScope('read')" )
public ResponseEntity<Pessoa> criar( @Valid @RequestBody Pessoa pessoa, HttpServletResponse response ) {
Pessoa pessoaSalva = pessoaRepository.save( pessoa );
publisher.publishEvent( new RecursoCriadoEvent( this, response, pessoaSalva.getId() ) );
return ResponseEntity.status( HttpStatus.CREATED ).body( pessoaSalva );
}
@GetMapping( "/{id}" )
@PreAuthorize( "hasAuthority('ROLE_PESQUISAR_PESSOA') and #oauth2.hasScope('read')" )
public ResponseEntity<Pessoa> buscarPorId( @PathVariable Long id ) {
Optional<Pessoa> pessoaObtida = pessoaRepository.findById( id );
return !pessoaObtida.isEmpty() ? ResponseEntity.ok( pessoaObtida.get() ) : ResponseEntity.notFound().build();
}
@DeleteMapping( "/{id}" )
@ResponseStatus( HttpStatus.NO_CONTENT )
@PreAuthorize( "hasAuthority('ROLE_REMOVER_PESSOA') and #oauth2.hasScope('write')" )
public void remover( @PathVariable Long id ) {
pessoaRepository.deleteById( id );
}
@PutMapping( "/{id}" )
@PreAuthorize( "hasAuthority('ROLE_CADASTRAR_PESSOA') and #oauth2.hasScope('write')" )
public ResponseEntity<Pessoa> atualiza( @PathVariable Long id, @Valid @RequestBody Pessoa pessoa ) {
Pessoa pessoaSalva = pessoaService.atualizarPessoa( id, pessoa );
return ResponseEntity.ok( pessoaSalva );
}
@PutMapping( "/{id}/ativo" )
@ResponseStatus( HttpStatus.NO_CONTENT )
@PreAuthorize( "hasAuthority('ROLE_CADASTRAR_PESSOA') and #oauth2.hasScope('write')" )
public void atualizarPropriedadeAtivo( @PathVariable Long id, @RequestBody Boolean ativo ) {
pessoaService.atualizarPropriedadeAtivo( id, ativo );
}
}
| [
"cpsoneghett@gmail.com"
] | cpsoneghett@gmail.com |
b54c2705a066562f07397c56adf858e5c25193bf | 26a5173a630b2d9c83f7f2f29f3bbdf1312d589c | /src/vistaGUI/CartaGrafica.java | fd53c0f2aa6730ab52695d0c6fa84577a988e63c | [] | no_license | leoduville/ChinchonRMI | 225d5feb72b5c5cab0c024212f148eef9bc8eef3 | 28cec51bb2fa31663439d2af0f44688e10aff272 | refs/heads/main | 2023-07-18T14:38:38.494579 | 2021-09-08T22:36:39 | 2021-09-08T22:36:39 | 404,514,664 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 223 | java | package vistaGUI;
import Imagenes.Imagen;
public class CartaGrafica extends Imagen {
/**
*
*/
private static final long serialVersionUID = 1L;
public CartaGrafica(String archivo) {
super(archivo,50,80);
}
}
| [
"71992403+leoduville@users.noreply.github.com"
] | 71992403+leoduville@users.noreply.github.com |
4c834e2c83344c77834ec99d42a5e8ee44d93f33 | 20eb62855cb3962c2d36fda4377dfd47d82eb777 | /IntroClassJava/dataset/digits/313d572e1f050451c688b97510efa105685fa275a8442f9119ce9b3f85f46e234cdf03593568e19798aed6b79c66f45c97be937d09b6ff9544f0f59162538575/000/mutations/1122/digits_313d572e_000.java | e873c2d7cebf87489a01b32ee856a895e8e0f500 | [] | no_license | ozzydong/CapGen | 356746618848065cce4e253e5d3c381baa85044a | 0ba0321b6b1191443276021f1997833342f02515 | refs/heads/master | 2023-03-18T20:12:02.923428 | 2020-08-21T03:08:28 | 2020-08-21T03:08:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,742 | java | package introclassJava;
class IntObj {
public int value;
public IntObj () {
} public IntObj (int i) {
value = i;
}
}
class FloatObj {
public float value;
public FloatObj () {
} public FloatObj (float i) {
value = i;
}
}
class LongObj {
public long value;
public LongObj () {
} public LongObj (long i) {
value = i;
}
}
class DoubleObj {
public double value;
public DoubleObj () {
} public DoubleObj (double i) {
value = i;
}
}
class CharObj {
public char value;
public CharObj () {
} public CharObj (char i) {
value = i;
}
}
public class digits_313d572e_000 {
public java.util.Scanner scanner;
public String output = "";
public static void main (String[]args) throws Exception {
digits_313d572e_000 mainClass = new digits_313d572e_000 ();
String output;
if (args.length > 0) {
mainClass.scanner = new java.util.Scanner (args[0]);
} else {
mainClass.scanner = new java.util.Scanner (System.in);
}
mainClass.exec ();
System.out.println (mainClass.output);
}
public void exec () throws Exception {
IntObj given = new IntObj (), digit10 = new IntObj (), digit9 =
new IntObj (), digit8 = new IntObj (), digit7 = new IntObj (), digit6 =
new IntObj (), digit5 = new IntObj (), digit4 = new IntObj (), digit3 =
new IntObj (), digit2 = new IntObj (), digit1 = new IntObj ();
output += (String.format ("\nEnter an interger > "));
given.value = scanner.nextInt ();
if (given.value >= 1 && given.value < 10) {
digit10.value = given.value % 10;
output +=
(String.format
("\n%d\nThat's all, have a nice day!\n", digit10.value));
}
if (given.value >= 10 && given.value < 100) {
digit10.value = given.value % 10;
digit9.value = (given.value / 10) % 10;
output +=
(String.format
("\n%d\n%d\nThat's all, have a nice day!\n", digit10.value,
digit9.value));
}
if (given.value >= 100 && given.value < 1000) {
digit10.value = given.value % 10;
digit9.value = (given.value / 10) % 10;
digit8.value = (given.value / 100) % 10;
output +=
(String.format ("\n%d\n%d\n%d\nThat's all, have a nice day!\n",
digit10.value, digit9.value, digit8.value));
}
if (given.value >= 1000 && given.value < 10000) {
digit10.value = given.value % 10;
digit9.value = (given.value / 10) % 10;
digit8.value = (given.value / 100) % 10;
digit7.value = (given.value / 1000) % 10;
output +=
(String.format ("\n%d\n%d\n%d\n%d\nThat's all, have a nice day!\n",
digit10.value, digit9.value, digit8.value,
digit7.value));
}
if (given.value >= 10000 && given.value < 100000) {
digit10.value = given.value % 10;
digit9.value = (given.value / 10) % 10;
digit8.value = (given.value / 100) % 10;
digit7.value = (given.value / 1000) % 10;
digit6.value = (given.value / 10000) % 10;
output +=
(String.format
("\n%d\n%d\n%d\n%d\n%d\nThat's all, have a nice day!\n",
digit10.value, digit9.value, digit8.value, digit7.value,
digit6.value));
}
if (given.value >= 100000 && given.value < 1000000) {
digit10.value = given.value % 10;
digit9.value = (given.value / 10) % 10;
digit8.value = (given.value / 100) % 10;
digit7.value = (given.value / 1000) % 10;
digit6.value = (given.value / 10000) % 10;
digit5.value = (given.value / 100000) % 10;
output +=
(String.format
("\n%d\n%d\n%d\n%d\n%d\n%d\nThat's all, have a nice day!\n",
digit10.value, digit9.value, digit8.value, digit7.value,
digit6.value, digit5.value));
}
if (given.value >= 1000000 && given.value < 10000000) {
digit10.value = given.value % 10;
digit9.value = (given.value / 10) % 10;
digit8.value = (given.value / 100) % 10;
digit7.value = (given.value / 1000) % 10;
digit6.value = (given.value / 10000) % 10;
digit5.value = (given.value / 100000) % 10;
digit4.value = (given.value / 1000000) % 10;
output +=
(String.format
("\n%d\n%d\n%d\n%d\n%d\n%d\n%d\nThat's all, have a nice day!\n",
digit10.value, digit9.value, digit8.value, digit7.value,
digit6.value, digit5.value, digit10.value));
}
if (given.value >= 10000000 && given.value < 100000000) {
digit10.value = given.value % 10;
digit9.value = (given.value / 10) % 10;
digit8.value = (given.value / 100) % 10;
digit7.value = (given.value / 1000) % 10;
digit6.value = (given.value / 10000) % 10;
digit5.value = (given.value / 100000) % 10;
digit4.value = (given.value / 1000000) % 10;
digit3.value = (given.value / 10000000) % 10;
output +=
(String.format
("\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\nThat's all, have a nice day!\n",
digit10.value, digit9.value, digit8.value, digit7.value,
digit6.value, digit5.value, digit4.value, digit3.value));
}
if (given.value >= 100000000 && given.value < 1000000000) {
digit10.value = given.value % 10;
digit9.value = (given.value / 10) % 10;
digit8.value = (given.value / 100) % 10;
digit7.value = (given.value / 1000) % 10;
digit6.value = (given.value / 10000) % 10;
digit5.value = (given.value / 100000) % 10;
digit4.value = (given.value / 1000000) % 10;
digit3.value = (given.value / 10000000) % 10;
digit2.value = (given.value / 100000000) % 10;
output +=
(String.format
("\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\nThat's all, have a nice day!\n",
digit10.value, digit9.value, digit8.value, digit7.value,
digit6.value, digit5.value, digit4.value, digit3.value,
digit2.value));
}
if (given.value >= 1000000000 && given.value < 10000000000L) {
digit10.value = given.value % 10;
digit9.value = (given.value / 10) % 10;
digit8.value = (given.value / 100) % 10;
digit7.value = (given.value / 1000) % 10;
digit6.value = (given.value / 10000) % 10;
digit5.value = (given.value / 100000) % 10;
digit4.value = (given.value / 1000000) % 10;
digit3.value = (given.value / 10000000) % 10;
digit2.value = (given.value / 100000000) % 10;
digit1.value = (given.value / 1000000000) % 10;
output +=
(String.format
("\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\nThat's all, have a nice day!\n",
digit10.value, digit9.value, digit8.value, digit7.value,
digit6.value, digit5.value, digit4.value, digit3.value,
digit2.value, digit1.value));
}
if (true)
return;;
}
}
| [
"justinwm@163.com"
] | justinwm@163.com |
6f81c21360730740783886199ef7160855b67c0c | b1d72147c59c766b2ca6f0ff371e9d9234b1ed3c | /src/str/main.java | b368946748b6e2bef15634897403212f7abfdb98 | [] | no_license | czqzju/JavaTest | 39bfcf30a65898473695d12f0645ed28b795282d | a9b9e8cc73b7cb7d9a832b06b91d7ef459c46708 | refs/heads/master | 2020-04-14T15:48:32.291203 | 2019-04-28T05:54:10 | 2019-04-28T05:54:10 | 163,932,932 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 853 | java | package str;
import java.util.StringTokenizer;
public class main {
public static void main(String[] args) {
String str = "This is String , split by StringTokenizer, created by runoob";
StringTokenizer st = new StringTokenizer(str);
System.out.println("----- 通过空格分隔 ------");
while (st.hasMoreElements()) {
System.out.println(st.nextElement());
}
System.out.println("----- 通过逗号分隔 ------");
StringTokenizer st2 = new StringTokenizer(str, ",");
while (st2.hasMoreElements()) {
System.out.println(st2.nextElement().toString().replaceFirst(" ", ""));
}
String upper = str.toUpperCase();
System.out.println(upper);
String lower = str.toLowerCase();
System.out.println(lower);
}
}
| [
"czqzju@gmail.com"
] | czqzju@gmail.com |
d321d344a0c8c8578f4000e3a3b80b0a69ab111b | 25be3f23b5b83e8baffd5ffb95880a149f3425cd | /custom_grouping/src/main/java/custom/grouping/CustomGroupingImpl.java | 44ed9e962240c7c86b90ab545d5209c894233f94 | [] | no_license | timowang1991/Learning-Apache-Storm-for-Big-Data-Processing | aaece74d92cbf4f89db2726a14160745324aef4f | b614bba30273f61433d5807aa0bacdc42a90d412 | refs/heads/master | 2023-07-16T08:41:17.861468 | 2021-09-04T13:01:05 | 2021-09-04T13:01:05 | 398,808,027 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,092 | java | package custom.grouping;
import org.apache.storm.Config;
import org.apache.storm.LocalCluster;
import org.apache.storm.topology.TopologyBuilder;
public class CustomGroupingImpl {
public static void main(String[] args) throws Exception {
TopologyBuilder builder = new TopologyBuilder();
builder.setSpout("Emit_Number", new NumberSpout());
// "allGrouping" ensures every stream emitted will go to all the bolt instances (aka broadcasting to all the bolts)
builder.setBolt("File_Write_Bolt", new FileWriterBolt(), 3)
.customGrouping("Emit_Number", new ManualGrouping());
Config config = new Config();
config.setDebug(true);
config.put("dirToWriter", "custom_grouping/data_output/shuffle_output");
config.put(Config.TOPOLOGY_MAX_SPOUT_PENDING, 1);
LocalCluster cluster = new LocalCluster();
try {
cluster.submitTopology("All-Grouping-Topology", config, builder.createTopology());
Thread.sleep(10000);
} finally {
cluster.shutdown();
}
}
}
| [
"chiuanw@verizonmedia.com"
] | chiuanw@verizonmedia.com |
09d527161802c4040301a645ab58274cf3d1ceef | d6b1aae22b93b19526b276c81a6405c02598e4ad | /src/com/xrtb/tests/TestRanges.java | af086d95c4f805e337ed791a6c83264ac81b1112 | [
"Apache-2.0"
] | permissive | aldrinleal/XRTB | 66dd4dacd199021c44bc20efdb0780f4c6b8e11a | 807b02da6a0435a74b6e777fa4855c8ed2953d31 | refs/heads/master | 2021-01-18T02:33:06.271302 | 2016-03-29T15:29:51 | 2016-03-29T15:29:51 | 55,517,786 | 0 | 0 | null | 2016-04-05T15:05:14 | 2016-04-05T15:05:13 | null | UTF-8 | Java | false | false | 5,859 | java | package com.xrtb.tests;
import static org.junit.Assert.*;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.xrtb.bidder.Controller;
import com.xrtb.bidder.WebCampaign;
import com.xrtb.common.Campaign;
import com.xrtb.common.Configuration;
import com.xrtb.common.HttpPostGet;
import com.xrtb.common.Node;
import com.xrtb.pojo.BidRequest;
/**
* Test Geo fencing
* @author Ben M. Faul
*
*/
public class TestRanges {
/**
* Setup the RTB server for the test
*/
@BeforeClass
public static void setup() {
try {
Config.setup();
Controller.getInstance().deleteCampaign("ben","ben:extended-device");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@AfterClass
public static void stop() {
Config.teardown();
}
/**
* Shut the RTB server down.
*/
@AfterClass
public static void testCleanup() {
Config.teardown();
}
/**
* Test distance calaculations
*/
@Test
public void testLosAngelesToSF() {
Number laLat = 34.05;
Number laLon = -118.25;
Number sfLat = 37.62;
Number sfLon = -122.38;
double dist = Node.getRange(laLat, laLon, sfLat, sfLon);
assertTrue(dist==544720.8629416309);
}
/**
* Test a single geo fence region in an isolated node.
* @throws Exception on I/O errors.
*/
@Test
public void testGeoInBidRequest() throws Exception {
InputStream is = Configuration.getInputStream("SampleBids/smaato.json");
BidRequest br = new BidRequest(is);
assertEquals(br.getId(),"K6t8sXXYdM");
Map m = new HashMap();
m.put("lat", 34.05);
m.put("lon",-118.25);
m.put("range",600000);
List list = new ArrayList();
list.add(m);
Node node = new Node("LATLON","device.geo", Node.INRANGE, list);
node.test(br);
ObjectNode map = (ObjectNode)node.getBRvalue();
assertTrue((Double)map.get("lat").doubleValue()==37.62);
assertTrue((Double)map.get("lon").doubleValue()==-122.38);
assertTrue((Double)map.get("type").doubleValue()==3);
List<Map>test = new ArrayList();
test.add(m);
node = new Node("LATLON","device.geo", Node.INRANGE, test);
node.test(br);
}
/**
* Test the geo fence on a valid bid request, but not in range
* @throws Exception on network errors.
*/
@Test
public void testGeoSingleFenceNotInRange() throws Exception {
HttpPostGet http = new HttpPostGet();
String s = Charset
.defaultCharset()
.decode(ByteBuffer.wrap(Files.readAllBytes(Paths
.get("SampleBids/nexage.txt")))).toString();
Map m = new HashMap();
m.put("lat", 34.05);
m.put("lon",-118.25);
m.put("range",600000);
List list = new ArrayList();
list.add(m);
Node node = new Node("LATLON","device.geo", Node.INRANGE, list);
Campaign camp = Configuration.getInstance().campaignsList.get(0);
camp.attributes.add(node);
try {
s = http.sendPost("http://" + Config.testHost + "/rtb/bids/nexage", s);
} catch (Exception error) {
fail("Error");
}
assertTrue(http.getResponseCode()==204);
System.out.println(s);
}
/**
* Test the bid when there is a geo object AND it is in range.
* @throws Exception on configuration file errors and on network errors to the biddewr.
*/
@Test
public void testGeoSingleFenceInRange() throws Exception {
HttpPostGet http = new HttpPostGet();
String s = Charset
.defaultCharset()
.decode(ByteBuffer.wrap(Files.readAllBytes(Paths
.get("SampleBids/nexage.txt")))).toString();
Map m = new HashMap();
m.put("lat", 42.05);
m.put("lon",-71.25);
m.put("range",600000);
List list = new ArrayList();
list.add(m);
Node node = new Node("LATLON","device.geo", Node.INRANGE, list);
System.out.println(Configuration.getInstance().getLoadedCampaignNames());
Campaign camp = Configuration.getInstance().campaignsList.get(0);
camp.attributes.add(node);
BidRequest.compile();
try {
s = http.sendPost("http://" + Config.testHost + "/rtb/bids/nexage", s);
} catch (Exception error) {
fail("Error");
}
if (http.getResponseCode() != 204) {
System.out.println("########## FUCKED UP: " + s);
fail("SHould have resolved");
}
assertTrue(http.getResponseCode()==204);
System.out.println(s);
}
/**
* Test a valid bid, but geo is not present in bid, and the campaign requires it.
* @throws Exception on file errors in the config file and network errors to the bidder.
*/
@Test
public void testGeoSingleFenceInRangeButNoGeoInBR() throws Exception {
HttpPostGet http = new HttpPostGet();
String s = Charset
.defaultCharset()
.decode(ByteBuffer.wrap(Files.readAllBytes(Paths
.get("SampleBids/nexageNoGeo.txt")))).toString();
Map m = new HashMap();
m.put("lat", 42.05);
m.put("lon",-71.25);
m.put("range",600000);
List list = new ArrayList();
list.add(m);
Node node = new Node("LATLON","device.geo", Node.INRANGE, list);
node.notPresentOk = false;
System.out.println("------------>" + Configuration.getInstance().getLoadedCampaignNames());
Campaign camp = Configuration.getInstance().campaignsList.get(0);
camp.attributes.add(node);
try {
s = http.sendPost("http://" + Config.testHost + "/rtb/bids/nexage", s);
} catch (Exception error) {
fail("Error");
}
assertTrue(http.getResponseCode()==204);
System.out.println(s);
}
}
| [
"ben.faul@gmail.com"
] | ben.faul@gmail.com |
cb54c7ba0b4cbd0fcf984a0b43a4b90c561ea1b1 | 672a13a93c845cc6d01964508759200e8cd48789 | /src/main/java/com/pkumar/blog/BloggyApplication.java | 37632cadbda7725dc143de21eefa2303be70de78 | [] | no_license | pkganthali/bloggy-spring-boot | 694d9de077e4110b9465028e4c6bbf5da6b8d7bb | 8ef98b6360ce5303a1da82d6b04a645e6be7bd18 | refs/heads/master | 2020-12-14T07:20:44.645164 | 2017-06-30T03:18:03 | 2017-06-30T03:18:03 | 95,546,472 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 307 | java | package com.pkumar.blog;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class BloggyApplication {
public static void main(String[] args) {
SpringApplication.run(BloggyApplication.class, args);
}
}
| [
"praveeng32109@gmail.com"
] | praveeng32109@gmail.com |
bc4002d41f92e93326bba8e40635ce6e0c4d1382 | 84c53b383554d50dd2edb03d2e0f9f56e4c23736 | /ID3v2TextFrameData.java | 3e5402b78da1b6dc2b5367ba6505ce1815bb470b | [] | no_license | VinceButler/ConvertM3UToTxt | 5630ec2113c5cd5bdced9a057475ac2b596701a6 | a37ccc9f5baffc5807821a2412d88eed8de111f1 | refs/heads/main | 2023-05-01T05:56:57.009699 | 2021-05-03T08:11:00 | 2021-05-03T08:11:00 | 362,290,939 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,829 | java | package Mp3File;
public class ID3v2TextFrameData extends AbstractID3v2FrameData {
protected EncodedText text;
public ID3v2TextFrameData(boolean unsynchronisation) {
super(unsynchronisation);
}
public ID3v2TextFrameData(boolean unsynchronisation, EncodedText text) {
super(unsynchronisation);
this.text = text;
}
public ID3v2TextFrameData(boolean unsynchronisation, byte[] bytes) throws InvalidDataException {
super(unsynchronisation);
synchroniseAndUnpackFrameData(bytes);
}
@Override
protected void unpackFrameData(byte[] bytes) throws InvalidDataException {
text = new EncodedText(bytes[0], BufferTools.copyBuffer(bytes, 1, bytes.length - 1));
}
@Override
protected byte[] packFrameData() {
byte[] bytes = new byte[getLength()];
if (text != null) {
bytes[0] = text.getTextEncoding();
byte[] textBytes = text.toBytes(true, false);
if (textBytes.length > 0) {
BufferTools.copyIntoByteBuffer(textBytes, 0, textBytes.length, bytes, 1);
}
}
return bytes;
}
@Override
protected int getLength() {
int length = 1;
if (text != null) length += text.toBytes(true, false).length;
return length;
}
public EncodedText getText() {
return text;
}
public void setText(EncodedText text) {
this.text = text;
}
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + ((text == null) ? 0 : text.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
if (getClass() != obj.getClass())
return false;
ID3v2TextFrameData other = (ID3v2TextFrameData) obj;
if (text == null) {
if (other.text != null)
return false;
} else if (!text.equals(other.text))
return false;
return true;
}
}
| [
"48537406+s3795444@users.noreply.github.com"
] | 48537406+s3795444@users.noreply.github.com |
10ae9ea09586fdea20e69c1aa1363ad63d0ff65c | 8c1731dc6f3ef179282e4fbada9f086cad6f0416 | /src/main/java/com/yiyi/tang/projectgen/config/GenConfig.java | 4e11a9f624918cef21a1f8c4a1b0034696b9ca91 | [] | no_license | tangmingjian/project-gen | e2719fc724d7e9bd6cf504a7300675b1d40028a4 | f0f43b3a86f9ddba7831b461c4e0c52c04c99fb9 | refs/heads/master | 2020-04-09T11:42:21.771035 | 2018-12-24T03:15:55 | 2018-12-24T03:15:55 | 160,320,850 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 498 | java | package com.yiyi.tang.projectgen.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
/**
* @author tangmingjian 2018-11-28 下午9:31
**/
@ConfigurationProperties(prefix = "gen")
@Configuration
@Data
public class GenConfig {
/**
* 生成项目的目录
*/
private String dirPath;
/**
* 模版文件的目录
*/
private String templatesPath;
}
| [
"tangmingjian@cs.sh.cn"
] | tangmingjian@cs.sh.cn |
e0cfbf97fbfe5b6cc95168ec95c14e2f6f2c53c7 | 9ff066d2260ceeaf1f3f3d9513b0ce86c2f30fa9 | /src/com/hsk/miniapi/xframe/api/daobbase/IorgApiDao.java | 19622b7dd3404f3ba133ba9725c71f1692bc8c62 | [] | no_license | Edison-zhu/dentistmall | eb0357a135334f700640713f861623756a0c9902 | 23537e7532d36a4626e98a886765b86e26818971 | refs/heads/master | 2023-01-23T04:56:06.470294 | 2020-11-22T16:06:42 | 2020-11-22T16:06:42 | 315,071,492 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,244 | java | package com.hsk.miniapi.xframe.api.daobbase;
import java.util.Map;
import com.hsk.exception.HSKDBException;
import com.hsk.xframe.api.persistence.SysOrgGx;
/**
* 组织关系dao业务类
* @author Administrator
*
*/
public interface IorgApiDao {
/**
* 添加组织信息对象
* @param sysOrgGx
* @return
* @throws HSKDBException
*/
public int saveOrgInfo(SysOrgGx sysOrgGx) throws HSKDBException ;
/**
* 获取下级组织id 字符串
* @param sysOrgGx
* @return
* @throws HSKDBException
*/
public String getOrgStr(SysOrgGx sysOrgGx) throws HSKDBException ;
/**
*
* @param sysOrgGx
* @return
* @throws HSKDBException
*/
public String getOldIdStr(SysOrgGx sysOrgGx) throws HSKDBException ;
public String getOldIdStrByParent(SysOrgGx sysOrgGx) throws HSKDBException ;
/**
* 根据组织ID查询后3级
* @param sysOrgGx
* @return
* @throws HSKDBException
*/
public Map<String,String> getOldThreeMap(SysOrgGx sysOrgGx) throws HSKDBException ;
/**
* 根据组织ID查询名称字符串集合
* @param sysOrgGx
* @return
* @throws HSKDBException
*/
public String getNameStr(SysOrgGx sysOrgGx) throws HSKDBException ;
}
| [
"8888@qq.com"
] | 8888@qq.com |
30cef3d739858f7ec60a45f87d46139d9f5ffd49 | 666cf477d902452c7ee4e28059ce8cd3130fd85b | /VehicleDecorator.java | 5a8eb532005326f13b571ba755ac766a677ec6d0 | [] | no_license | xslau/Decorator_Design_Pattern | d7ae443a29951638d5b51c2c152dd60b1c18572c | c7f5aeb579372d518ca88d4c36e9c03ecd27daee | refs/heads/main | 2023-02-22T09:11:55.032214 | 2021-01-27T19:20:24 | 2021-01-27T19:20:24 | 332,873,237 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 357 | java | /**
* Creates Abstract Class for extending VehicleDecorator
* @author Xzavian Slaughter
*/
public abstract class VehicleDecorator extends Vehicle{
/**
* Abstract method to return representation of Vehicle with VehicleDecorator
* @return representation of Vehicle with VehicleDecorator
*/
public abstract String toString();
}
| [
"xzavian@email.sc.edu"
] | xzavian@email.sc.edu |
a9aa83f1bc131397e045bdabb2d034f6a1acd821 | 2e4b587c266d03dc7a2945eb8da468b644c818e0 | /tp3/src/tp/pr3/control/JugadorAleatorioGravity.java | b0602e95761adc9461a0c927b02590e06c82e898 | [] | no_license | mappolo/TP-UCM | b62a0d8f6aa967111ed4c66d50d5fd49e510ba72 | a9022c764522c168cad390192fe105bd99db683b | refs/heads/master | 2021-01-21T02:30:44.352093 | 2015-12-14T20:47:12 | 2015-12-14T20:47:12 | 26,611,269 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 656 | java | package tp.pr3.control;
import tp.pr3.logica.Ficha;
import tp.pr3.logica.Movimiento;
import tp.pr3.logica.MovimientoGravity;
import tp.pr3.logica.Tablero;
public class JugadorAleatorioGravity implements Jugador {
/**
* Devuelve el siguiente movimiento a efectuar por el jugador
*/
public Movimiento getMovimiento(Tablero tab, Ficha color) {
Movimiento mov = null;
do {
int columna = (int)(Math.random()*tab.getAncho());
int fila = (int)(Math.random()*tab.getAlto());
if (tab.getCasilla(columna+1, fila+1) == Ficha.VACIA) {
mov = new MovimientoGravity(columna+1, fila+1, color);
}
}while (mov == null);
return mov;
}
}
| [
"mipere01@ucm.es"
] | mipere01@ucm.es |
ff2897de9e0512c303ceb7ad31b23d04e33c6fcb | 6ac298dc92c77548c33cc7378b6921836fe56eea | /app/src/main/java/za/co/thamserios/basilread/models/StandingTypes.java | d07625db88b77b0f79dd558ce11a2e7b3f163c53 | [] | no_license | rmukubvu/BasilRead | 06287a0c7b80553f86a1ec46ef2d6c8b1053115f | 07e42029081af5c228a739b6df79ce5d071aca2e | refs/heads/master | 2020-05-19T23:49:30.369801 | 2019-05-06T21:33:48 | 2019-05-06T21:33:48 | 185,275,332 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 625 | java | package za.co.thamserios.basilread.models;
/**
* Created by robson on 2017/02/27.
*/
public class StandingTypes {
public Long _id; // for cupboard
int standingTypesId;
String typeName;
public int getStandingTypesId() {
return standingTypesId;
}
public void setStandingTypesId(int standingTypesId) {
this.standingTypesId = standingTypesId;
}
public String getTypeName() {
return typeName;
}
public void setTypeName(String typeName) {
this.typeName = typeName;
}
@Override
public String toString(){
return typeName;
}
}
| [
"rmukubvu@gmail.com"
] | rmukubvu@gmail.com |
a54a2104c8cdf4fb32ed421b30b4334a2c5b1af9 | 736262308bea2d40d75e3991dfbc76ae289b24b5 | /src/NoComplete/CircleCrib_8.java | 04c37e435dbf067c0bf7f831ee23f36a6510709f | [] | no_license | children520/WangdaoAlgorithm2013 | 25975df919bf6f19afda484d3bbb0817e7e82236 | 36cca604e582ef547b51377625c21a437dd16f55 | refs/heads/master | 2021-05-18T02:05:55.168054 | 2020-11-16T14:07:54 | 2020-11-16T14:07:54 | 251,058,829 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,661 | java | package NoComplete;
import java.util.Scanner;
//输出一个边框花色交错的框
public class CircleCrib_8 {
public static void main(String[] args) {
/*
Scanner scanner=new Scanner(System.in);
String str="";
System.out.print("请输入:");
if(scanner.hasNextLine()){
str=scanner.nextLine();
}
int n=Integer.parseInt(str.split(" ")[0]);
String n1=str.split(" ")[1];
String n2=str.split(" ")[2];
String[][] res=new String[n/2+1][n];
for(int i=0;i<n;i++){
if(i==0||i==n-1){
res[0][i]=" ";
}
res[0][i]=n2;
}
String[] list=new String[n];
for(int i=1;i<n/2+1;i++){
if(i%2==0){
for (int j=i;j<list.length-i;j++){
list[j]=n2;
}
}else{
for (int j=i;j<list.length-i;j++){
list[j]=n1;
}
}
for(int k=0;k<list.length;k++){
System.out.print(list[k]);
res[i][k]=list[k];
}
System.out.println();
}
for(int i=n/2+1;i>=0;i--){
for(int j=0;j<n;j++){
System.out.print(res[i][j]);
}
System.out.println();
}
}
*/
Scanner scanner=new Scanner(System.in);
String str="";
System.out.print("请输入:");
if(scanner.hasNextLine()){
str=scanner.nextLine();
}
//输入一个三元组
int n=Integer.parseInt(str.split(" ")[0]);
String n1=str.split(" ")[1];
String n2=str.split(" ")[2];
String[][] outPutBuf=new String[82][82];
boolean firstCase=true;
//从里到外输出每个圈
for (int i=1,j=1;i<=n;i+=2,j++){
//计算每个圈右上角的坐标
int x=n/2+1,y=x;
x-=j-1;
y-=j-1;
//计算当前使用哪个字符
String c= j%2 ==1 ? n1 :n2;
for(int k=0;k<=i;k++){
outPutBuf[x+k-1][y]=c;
outPutBuf[x][y+k-1]=c;
outPutBuf[x+i-1][y+k-1]=c;
outPutBuf[x+k-1][y+i-1]=c;
}
}
if(n!=1){
outPutBuf[1][1]=" ";
outPutBuf[n][1]=" ";
outPutBuf[1][n]=" ";
outPutBuf[n][n]=" ";
}
for(int i=1;i<=n;i++){
for (int j=1;j<=n;j++){
System.out.print(outPutBuf[i][j]);
}
System.out.println();
}
}
}
| [
"1306410285@qq.com"
] | 1306410285@qq.com |
5cffe8c8962a916b4260aa0c29af823f4f23317d | d99eac5ed9f820ce58f7ca35db3f7b1d8829cb65 | /src/com/skilldistillery/common/cards/Suit.java | 5bb8d06134595a7be1fe365529e07bb566d14b33 | [] | no_license | dzmaj/BlackjackProject | ca9b42f35dd31250ac5a1e188f4b6a09dfa6d62a | f773806029e11d13bb4a4ddd467870b00988d858 | refs/heads/master | 2022-12-17T04:37:06.216002 | 2020-09-23T17:12:11 | 2020-09-23T17:12:11 | 296,695,356 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 415 | java | package com.skilldistillery.common.cards;
public enum Suit {
SPADES("Spades", "\u2660"),
HEARTS("Hearts", "\u2661"),
CLUBS("Clubs", "\u2663"),
DIAMONDS("Diamonds", "\u2662");
Suit(String n, String sym) {
name = n;
symbol = sym;
}
final private String name;
final private String symbol;
@Override
public String toString() {
return name;
}
public String getSymbol() {
return symbol;
}
}
| [
"d.majewski.3453@gmail.com"
] | d.majewski.3453@gmail.com |
acd26412879c93b133591b8783ea911225038233 | 40751b53bf70a8fd155d8836d4e2357b63028841 | /src/USSocketInterface.java | 50e35e26eafe2a2f59e3f529b084fa0cc16550dc | [] | no_license | chargeahead/StructuralDesignPatternAdaptor | 1b0bce52577fbdf8499ad46f3d094bfa9a5660fd | dc21aef5a7fc920e76db266f9ab299793ba4b209 | refs/heads/master | 2020-03-07T15:39:37.934678 | 2018-03-31T18:45:51 | 2018-03-31T18:45:51 | 127,560,973 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 59 | java |
public interface USSocketInterface {
void powerUp();
}
| [
"chargeahead@gmail.com"
] | chargeahead@gmail.com |
e42ccf4a8f41638a10467cb570ffc40aa48d7721 | 627ed4eb5b7acff1e98973b41d8aca2fd32cc1d3 | /src/com/poc/library/Service/LoggingService.java | dcd7217e27e0fe3788088e68a70283fd4acc45ac | [] | no_license | sandeepnjk/edial | 5d5a602d83e2e09e33d1f15ad6724e86b5d7b004 | 909ccb4825d0001119724168356f58aa8b2e6a54 | refs/heads/master | 2020-05-20T19:30:23.982028 | 2013-10-23T16:21:19 | 2013-10-23T16:21:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 138 | java | package com.poc.library.Service;
public class LoggingService {
public Trace getTrace() {
return new SystemTrace();
}
}
| [
"raghava.crl@gmail.com"
] | raghava.crl@gmail.com |
3915a9e98ee024e922fa66bedc0d14bf558f6902 | 2292eedc09f4ba73f4d21342555f951d88a2e9a7 | /kakaoeng/src/main/java/Kakao/kakaoeng/servlet/AdminViewTeacherStatusServlet.java | 4a5210573f26ce94675b1e52ad80c5ba139d290f | [] | no_license | ilover5555/cacaoeng | ee3c6d14939a37062059650a642a4dbca29380ea | 01df4da09ca04edf70cfceae23a08a549c2e44fa | refs/heads/master | 2021-01-10T10:18:02.159903 | 2016-04-06T11:46:26 | 2016-04-06T11:49:58 | 55,600,948 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,721 | java | package Kakao.kakaoeng.servlet;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.context.ApplicationContext;
import Kakao.kakaoeng.LoginChecker;
import Kakao.kakaoeng.LoginRequiredException;
import Kakao.kakaoeng.TeacherScheduleStateReader;
import Kakao.kakaoeng.Util;
import Kakao.kakaoeng.dao.TeacherDAO;
import Kakao.kakaoeng.domain.model.Teacher;
@SuppressWarnings("serial")
@WebServlet("/teacher/adminViewTeacherStatus.view")
public class AdminViewTeacherStatusServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
LoginChecker lc = new LoginChecker(req);
if(!lc.getAdminLogin() && !lc.getExecLogin())
throw new LoginRequiredException("./index.jsp");
String teacherId = req.getParameter("teacherId");
ApplicationContext applicationContext = (ApplicationContext) req.getServletContext().getAttribute("applicationContext");
TeacherDAO teacherDAO = (TeacherDAO) applicationContext.getBean("teacherDAO");
Teacher teacher = teacherDAO.getTeacherWithId(teacherId);
if(teacher == null){
Util.sendError(resp, teacherId+"(teacherId) is not exists.");
return;
}
TeacherScheduleStateReader reader = new TeacherScheduleStateReader();
reader.process(applicationContext, req, resp, teacher);
req.setAttribute("teacher", teacher);
req.getRequestDispatcher("./ScheduleStatusTableTeacherForAdmin.jsp").forward(req, resp);
}
}
| [
"ilover5555@naver.com"
] | ilover5555@naver.com |
b894ff02a1ca6534b2baf5569262619917d0ac43 | a881dd0bfa87f0c48ae40c3255a2474803eaf236 | /src/main/java/com/bolsadeideas/springboot/form/app/editors/NombreMayusculaEditor.java | 3496e7825c7db6f0b4af1672dc235af58bb78c26 | [] | no_license | HansFarro/spring-boot-form | dd69e88a1552425f2b42de2b11e83c5e554b24af | 18e5eaaf5eef2c585dbf853f8767114f66d3f77a | refs/heads/main | 2023-01-05T10:05:00.528015 | 2020-11-04T02:58:36 | 2020-11-04T02:58:36 | 309,866,055 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 291 | java | package com.bolsadeideas.springboot.form.app.editors;
import java.beans.PropertyEditorSupport;
public class NombreMayusculaEditor extends PropertyEditorSupport {
@Override
public void setAsText(String text) throws IllegalArgumentException {
setValue(text.toUpperCase().trim());
}
}
| [
"farrocastillohans@gmail.com"
] | farrocastillohans@gmail.com |
f22618988004cac52ef13f0d1a1681600a6ca880 | 516fb367430d4c1393f4cd726242618eca862bda | /sources/com/google/android/gms/internal/ads/zzew.java | 4423abc50316b56990b3df320add3ed6c456906e | [] | no_license | cmFodWx5YWRhdjEyMTA5/Gaana2 | 75d6d6788e2dac9302cff206a093870e1602921d | 8531673a5615bd9183c9a0466325d0270b8a8895 | refs/heads/master | 2020-07-22T15:46:54.149313 | 2019-06-19T16:11:11 | 2019-06-19T16:11:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,671 | java | package com.google.android.gms.internal.ads;
import android.os.IBinder;
import android.os.IInterface;
import android.os.Parcel;
import android.os.RemoteException;
public class zzew implements IInterface {
private final IBinder zzvd;
private final String zzve;
protected zzew(IBinder iBinder, String str) {
this.zzvd = iBinder;
this.zzve = str;
}
public IBinder asBinder() {
return this.zzvd;
}
/* Access modifiers changed, original: protected|final */
public final Parcel obtainAndWriteInterfaceToken() {
Parcel obtain = Parcel.obtain();
obtain.writeInterfaceToken(this.zzve);
return obtain;
}
/* Access modifiers changed, original: protected|final */
public final Parcel transactAndReadException(int e, Parcel parcel) throws RemoteException {
Parcel obtain = Parcel.obtain();
try {
this.zzvd.transact(e, parcel, obtain, 0);
obtain.readException();
} catch (RuntimeException e2) {
e = e2;
throw e;
} finally {
/*
Method generation error in method: com.google.android.gms.internal.ads.zzew.transactAndReadException(int, android.os.Parcel):android.os.Parcel, dex: classes2.dex
jadx.core.utils.exceptions.CodegenException: Error generate insn: 0x0018: INVOKE (wrap: android.os.Parcel
?: MERGE (r5_1 android.os.Parcel) = (r5_0 'parcel' android.os.Parcel), (r0_0 'obtain' android.os.Parcel)) android.os.Parcel.recycle():void type: VIRTUAL in method: com.google.android.gms.internal.ads.zzew.transactAndReadException(int, android.os.Parcel):android.os.Parcel, dex: classes2.dex
at jadx.core.codegen.InsnGen.makeInsn(InsnGen.java:228)
at jadx.core.codegen.InsnGen.makeInsn(InsnGen.java:205)
at jadx.core.codegen.RegionGen.makeSimpleBlock(RegionGen.java:102)
at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:52)
at jadx.core.codegen.RegionGen.makeSimpleRegion(RegionGen.java:89)
at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:55)
at jadx.core.codegen.RegionGen.makeRegionIndent(RegionGen.java:95)
at jadx.core.codegen.RegionGen.makeTryCatch(RegionGen.java:300)
at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:65)
at jadx.core.codegen.RegionGen.makeSimpleRegion(RegionGen.java:89)
at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:55)
at jadx.core.codegen.MethodGen.addInstructions(MethodGen.java:183)
at jadx.core.codegen.ClassGen.addMethod(ClassGen.java:321)
at jadx.core.codegen.ClassGen.addMethods(ClassGen.java:259)
at jadx.core.codegen.ClassGen.addClassBody(ClassGen.java:221)
at jadx.core.codegen.ClassGen.addClassCode(ClassGen.java:111)
at jadx.core.codegen.ClassGen.makeClass(ClassGen.java:77)
at jadx.core.codegen.CodeGen.visit(CodeGen.java:10)
at jadx.core.ProcessClass.process(ProcessClass.java:38)
at jadx.api.JadxDecompiler.processClass(JadxDecompiler.java:292)
at jadx.api.JavaClass.decompile(JavaClass.java:62)
at jadx.api.JadxDecompiler.lambda$appendSourcesSave$0(JadxDecompiler.java:200)
Caused by: jadx.core.utils.exceptions.CodegenException: Error generate insn: ?: MERGE (r5_1 android.os.Parcel) = (r5_0 'parcel' android.os.Parcel), (r0_0 'obtain' android.os.Parcel) in method: com.google.android.gms.internal.ads.zzew.transactAndReadException(int, android.os.Parcel):android.os.Parcel, dex: classes2.dex
at jadx.core.codegen.InsnGen.makeInsn(InsnGen.java:228)
at jadx.core.codegen.InsnGen.addArg(InsnGen.java:101)
at jadx.core.codegen.InsnGen.addArgDot(InsnGen.java:84)
at jadx.core.codegen.InsnGen.makeInvoke(InsnGen.java:634)
at jadx.core.codegen.InsnGen.makeInsnBody(InsnGen.java:340)
at jadx.core.codegen.InsnGen.makeInsn(InsnGen.java:222)
... 21 more
Caused by: jadx.core.utils.exceptions.CodegenException: MERGE can be used only in fallback mode
at jadx.core.codegen.InsnGen.fallbackOnlyInsn(InsnGen.java:539)
at jadx.core.codegen.InsnGen.makeInsnBody(InsnGen.java:511)
at jadx.core.codegen.InsnGen.makeInsn(InsnGen.java:213)
... 26 more
*/
/* Access modifiers changed, original: protected|final */
public final void zza(int i, Parcel parcel) throws RemoteException {
Parcel obtain = Parcel.obtain();
try {
this.zzvd.transact(i, parcel, obtain, 0);
obtain.readException();
} finally {
parcel.recycle();
obtain.recycle();
}
}
/* Access modifiers changed, original: protected|final */
public final void zzb(int i, Parcel parcel) throws RemoteException {
try {
this.zzvd.transact(2, parcel, null, 1);
} finally {
parcel.recycle();
}
}
}
| [
"master@master.com"
] | master@master.com |
2698e20c2f4222053ff4578a1c9a62ed6ce58e8c | 8229884a9bd15286a34cbd2e7b4624ee158be378 | /authrolibrary/src/main/java/com/example/authrolibrary/utils/DialogUtils.java | ad5059363b72319ab348f7f329ed6b6385a1d02c | [] | no_license | chengcdev/smarthome | 5ae58bc0ba8770598f83a36355b557c46f37b90c | 4edb33dcdfcab39a3bc6e5342a7973ac703f1344 | refs/heads/master | 2022-12-03T18:04:39.172431 | 2020-08-20T05:22:57 | 2020-08-20T05:22:57 | 288,909,136 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 695 | java | package com.example.authrolibrary.utils;
import android.app.AlertDialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import com.example.authrolibrary.R;
import com.example.authrolibrary.view.CustomDialog;
public class DialogUtils {
public AlertDialog loadingDialog(Context context) {
CustomDialog customDialog = new CustomDialog(context,0);
View view = LayoutInflater.from(context).inflate(R.layout.dialog_loading, null);
AlertDialog alertDialog = customDialog.showDialog(view);
alertDialog.setCanceledOnTouchOutside(false);
alertDialog.setCancelable(false);
return alertDialog;
}
}
| [
"1508592785@qq.com"
] | 1508592785@qq.com |
0d446d18b43e688fdca184cf4ad38a301fcade99 | 42126c8d1500b552f539c15978ee978e15d0b21c | /app/src/main/java/com/example/opinionpoll/LoginActivity.java | 80fb4a8dc811a895cd63e7f4f2dd2242a5ecfd97 | [] | no_license | gh-poursheikh/opinion-poll-client | fe226be8b35416eb7554845f459bcc87977f7dff | b617621393306b2625e9e18deedabfb8cf60aeaa | refs/heads/master | 2023-06-22T03:08:40.618139 | 2021-07-20T22:08:59 | 2021-07-20T22:08:59 | 382,691,881 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,854 | java | package com.example.opinionpoll;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import com.example.opinionpoll.model.Person;
import com.example.opinionpoll.utils.MyWebService;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class LoginActivity extends AppCompatActivity {
private static final String TAG = LoginActivity.class.getSimpleName();
private EditText usernameEditText;
private EditText passwordEditText;
private ProgressBar progressBar;
private Button loginButton;
private String username;
private String password;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
usernameEditText = findViewById(R.id.username_EditText);
passwordEditText = findViewById(R.id.password_EditText);
progressBar = findViewById(R.id.progressBar);
loginButton = findViewById(R.id.login_Button);
loginButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
username = usernameEditText.getText().toString();
password = passwordEditText.getText().toString();
login();
}
});
}
private void login() {
progressBar.setVisibility(View.VISIBLE);
MyWebService webService = MyWebService.retrofit.create(MyWebService.class);
Call<Person> call = webService.login(username, password);
call.enqueue(new Callback<Person>() {
@Override
public void onResponse(Call<Person> call, Response<Person> response) {
if (!response.isSuccessful()) {
Log.d(TAG, "onResponse: response.code(): " + response.code());
progressBar.setVisibility(View.GONE);
Toast.makeText(LoginActivity.this, getString(R.string.network_error_code) + response.code(), Toast.LENGTH_LONG).show();
return;
}
try {
Person person = response.body();
if (person.getPersonType().equalsIgnoreCase("Normal")) {
if (person.getVoted() == 0) {
Intent intent = new Intent(getBaseContext(), NormalUserActivity.class);
intent.putExtra("EXTRA_SESSION_ID", person);
progressBar.setVisibility(View.GONE);
startActivity(intent);
finish(); // When the users hit the back reportButton, they will not be able to return
// to the current activity because it has been killed off the Back Stack.)
} else {
usernameEditText.setText("");
passwordEditText.setText("");
usernameEditText.requestFocus();
progressBar.setVisibility(View.GONE);
Toast.makeText(LoginActivity.this, getString(R.string.sorry_you_have_already_voted), Toast.LENGTH_SHORT).show();
}
} else {
Intent intent = new Intent(getBaseContext(), SystemUserActivity.class);
intent.putExtra("EXTRA_SESSION_ID", person);
progressBar.setVisibility(View.GONE);
startActivity(intent);
finish(); // When the users hit the back reportButton, they will not be able to return
// to the current activity because it has been killed off the Back Stack.)
}
} catch (Exception e) {
e.printStackTrace();
Log.d(TAG, "onResponse: " + e.getMessage());
usernameEditText.setText("");
passwordEditText.setText("");
usernameEditText.requestFocus();
progressBar.setVisibility(View.GONE);
Toast.makeText(LoginActivity.this, getString(R.string.sorry_record_not_found), Toast.LENGTH_SHORT).show();
}
}
@Override
public void onFailure(Call<Person> call, Throwable t) {
Log.d(TAG, "onFailure: " + t.getMessage());
progressBar.setVisibility(View.GONE);
Toast.makeText(LoginActivity.this, t.getMessage(), Toast.LENGTH_LONG).show();
}
});
}
} | [
"gh.poursheikh@gmail.com"
] | gh.poursheikh@gmail.com |
60fbca3a6ce0d89d00829e741e9a43f52abb769e | 1314313c7161c7ed757d0ba8a8cadeab59df04a5 | /flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatNativeWindowBorderTest.java | 7ece92ddfbe48b0e840f450ad19e40850f972c36 | [
"Apache-2.0"
] | permissive | basix86/FlatLaf | 56f47666e5955a50a9abd874ce0eba9efc11f354 | 6f5a132279621336eed95e53a8eb76278ef17cd1 | refs/heads/master | 2021-07-13T16:00:43.635733 | 2021-03-31T06:51:48 | 2021-03-31T06:51:48 | 242,100,511 | 0 | 0 | Apache-2.0 | 2021-03-31T06:51:48 | 2020-02-21T09:21:00 | Java | UTF-8 | Java | false | false | 17,522 | java | /*
* Copyright 2021 FormDev Software GmbH
*
* 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
*
* https://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.formdev.flatlaf.testing;
import java.awt.*;
import java.awt.Dialog.ModalityType;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.awt.event.KeyEvent;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.util.WeakHashMap;
import javax.swing.*;
import javax.swing.plaf.metal.MetalLookAndFeel;
import javax.swing.plaf.nimbus.NimbusLookAndFeel;
import com.formdev.flatlaf.FlatClientProperties;
import com.formdev.flatlaf.FlatDarculaLaf;
import com.formdev.flatlaf.FlatDarkLaf;
import com.formdev.flatlaf.FlatIntelliJLaf;
import com.formdev.flatlaf.FlatLaf;
import com.formdev.flatlaf.FlatLightLaf;
import com.formdev.flatlaf.extras.FlatInspector;
import com.formdev.flatlaf.ui.FlatLineBorder;
import com.formdev.flatlaf.ui.FlatNativeWindowBorder;
import com.formdev.flatlaf.util.SystemInfo;
import net.miginfocom.swing.*;
/**
* @author Karl Tauber
*/
public class FlatNativeWindowBorderTest
extends JPanel
{
private static JFrame mainFrame;
private static WeakHashMap<Window, Object> hiddenWindowsMap = new WeakHashMap<>();
private static int nextWindowId = 1;
private final Window window;
private final int windowId;
public static void main( String[] args ) {
SwingUtilities.invokeLater( () -> {
FlatLightLaf.install();
FlatInspector.install( "ctrl shift alt X" );
mainFrame = showFrame();
} );
}
private static JFrame showFrame() {
JFrame frame = new MyJFrame( "FlatNativeWindowBorderTest" );
frame.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
frame.add( new FlatNativeWindowBorderTest( frame ) );
((JComponent) frame.getContentPane()).registerKeyboardAction( e -> {
frame.dispose();
}, KeyStroke.getKeyStroke( KeyEvent.VK_ESCAPE, 0, false ), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT );
frame.setSize( new Dimension( 800, 600 ) );
frame.setLocationRelativeTo( null );
int offset = 20 * Window.getWindows().length;
frame.setLocation( frame.getX() + offset, frame.getY() + offset );
frame.setVisible( true );
return frame;
}
private static void showDialog( Window owner ) {
JDialog dialog = new MyJDialog( owner, "FlatNativeWindowBorderTest Dialog", ModalityType.DOCUMENT_MODAL );
dialog.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
dialog.add( new FlatNativeWindowBorderTest( dialog ) );
((JComponent) dialog.getContentPane()).registerKeyboardAction( e -> {
dialog.dispose();
}, KeyStroke.getKeyStroke( KeyEvent.VK_ESCAPE, 0, false ), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT );
dialog.setSize( new Dimension( 800, 600 ) );
dialog.setLocationRelativeTo( owner );
dialog.setLocation( dialog.getX() + 20, dialog.getY() + 20 );
dialog.setVisible( true );
}
private FlatNativeWindowBorderTest( Window window ) {
this.window = window;
this.windowId = nextWindowId++;
initComponents();
if( mainFrame == null )
hideWindowButton.setEnabled( false );
setBorder( new FlatLineBorder( new Insets( 0, 0, 0, 0 ), Color.red ) );
updateInfo();
ComponentListener componentListener = new ComponentAdapter() {
@Override
public void componentMoved( ComponentEvent e ) {
updateInfo();
}
@Override
public void componentResized( ComponentEvent e ) {
updateInfo();
}
};
window.addComponentListener( componentListener );
addComponentListener( componentListener );
window.addWindowListener( new WindowListener() {
@Override
public void windowOpened( WindowEvent e ) {
System.out.println( windowId + " windowOpened" );
}
@Override
public void windowClosing( WindowEvent e ) {
System.out.println( windowId + " windowClosing" );
}
@Override
public void windowClosed( WindowEvent e ) {
System.out.println( windowId + " windowClosed" );
}
@Override
public void windowIconified( WindowEvent e ) {
System.out.println( windowId + " windowIconified" );
}
@Override
public void windowDeiconified( WindowEvent e ) {
System.out.println( windowId + " windowDeiconified" );
}
@Override
public void windowActivated( WindowEvent e ) {
System.out.println( windowId + " windowActivated" );
}
@Override
public void windowDeactivated( WindowEvent e ) {
System.out.println( windowId + " windowDeactivated" );
}
} );
window.addWindowStateListener( e -> {
System.out.println( windowId + " windowStateChanged " + e.getOldState() + " --> " + e.getNewState() );
} );
registerSwitchToLookAndFeel( "F1", FlatLightLaf.class.getName() );
registerSwitchToLookAndFeel( "F2", FlatDarkLaf.class.getName() );
registerSwitchToLookAndFeel( "F3", FlatIntelliJLaf.class.getName() );
registerSwitchToLookAndFeel( "F4", FlatDarculaLaf.class.getName() );
registerSwitchToLookAndFeel( "F8", FlatTestLaf.class.getName() );
if( SystemInfo.isWindows )
registerSwitchToLookAndFeel( "F9", "com.sun.java.swing.plaf.windows.WindowsLookAndFeel" );
else if( SystemInfo.isMacOS )
registerSwitchToLookAndFeel( "F9", "com.apple.laf.AquaLookAndFeel" );
else if( SystemInfo.isLinux )
registerSwitchToLookAndFeel( "F9", "com.sun.java.swing.plaf.gtk.GTKLookAndFeel" );
registerSwitchToLookAndFeel( "F12", MetalLookAndFeel.class.getName() );
registerSwitchToLookAndFeel( "F11", NimbusLookAndFeel.class.getName() );
}
private void updateInfo() {
Toolkit toolkit = Toolkit.getDefaultToolkit();
GraphicsConfiguration gc = window.getGraphicsConfiguration();
DisplayMode dm = gc.getDevice().getDisplayMode();
Rectangle screenBounds = gc.getBounds();
Rectangle windowBounds = window.getBounds();
Rectangle clientBounds = new Rectangle( isShowing() ? getLocationOnScreen() : getLocation(), getSize() );
StringBuilder buf = new StringBuilder( 1500 );
buf.append( "<html><style>" );
buf.append( "td { padding: 0 10 0 0; }" );
buf.append( "</style><table>" );
appendRow( buf, "Window bounds", toString( windowBounds ) );
appendRow( buf, "Client bounds", toString( clientBounds ) );
appendRow( buf, "Window / Panel gap", toString( diff( windowBounds, clientBounds ) ) );
if( window instanceof Frame && (((Frame)window).getExtendedState() & Frame.MAXIMIZED_BOTH) != 0 )
appendRow( buf, "Screen / Window gap", toString( diff( screenBounds, windowBounds ) ) );
appendEmptyRow( buf );
if( window instanceof Frame ) {
Rectangle maximizedBounds = ((Frame)window).getMaximizedBounds();
if( maximizedBounds != null ) {
appendRow( buf, "Maximized bounds", toString( maximizedBounds ) );
appendEmptyRow( buf );
}
}
appendRow( buf, "Physical screen size", dm.getWidth() + ", " + dm.getHeight() + " (" + dm.getBitDepth() + " Bit)" );
appendRow( buf, "Screen bounds", toString( screenBounds ) );
appendRow( buf, "Screen insets", toString( toolkit.getScreenInsets( gc ) ) );
appendRow( buf, "Scale factor", (int) (gc.getDefaultTransform().getScaleX() * 100) + "%" );
appendEmptyRow( buf );
appendRow( buf, "Java version", System.getProperty( "java.version" ) + " / " + System.getProperty( "java.vendor" ) );
buf.append( "</td></tr>" );
buf.append( "</table></html>" );
info.setText( buf.toString() );
}
private static void appendRow( StringBuilder buf, String key, String value ) {
buf.append( "<tr><td>" )
.append( key )
.append( ":</td><td>" )
.append( value )
.append( "</td></tr>" );
}
private static void appendEmptyRow( StringBuilder buf ) {
buf.append( "<tr><td></td><td></td></tr>" );
}
private static String toString( Rectangle r ) {
if( r == null )
return "null";
return r.x + ", " + r.y + ", " + r.width + ", " + r.height;
}
private static String toString( Insets insets ) {
return insets.top + ", " + insets.left + ", " + insets.bottom + ", " + insets.right;
}
private static Rectangle diff( Rectangle r1, Rectangle r2 ) {
return new Rectangle(
r2.x - r1.x,
r2.y - r1.y,
(r1.x + r1.width) - (r2.x + r2.width),
(r1.y + r1.height) - (r2.y + r2.height) );
}
private void registerSwitchToLookAndFeel( String keyStrokeStr, String lafClassName ) {
KeyStroke keyStroke = KeyStroke.getKeyStroke( keyStrokeStr );
if( keyStroke == null )
throw new IllegalArgumentException( "Invalid key stroke '" + keyStrokeStr + "'" );
((JComponent)((RootPaneContainer)window).getContentPane()).registerKeyboardAction(
e -> applyLookAndFeel( lafClassName ),
keyStroke,
JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT );
}
private void applyLookAndFeel( String lafClassName ) {
EventQueue.invokeLater( () -> {
try {
UIManager.setLookAndFeel( lafClassName );
FlatLaf.updateUI();
} catch( Exception ex ) {
ex.printStackTrace();
}
} );
}
private void resizableChanged() {
if( window instanceof Frame )
((Frame)window).setResizable( resizableCheckBox.isSelected() );
else if( window instanceof Dialog )
((Dialog)window).setResizable( resizableCheckBox.isSelected() );
}
private void undecoratedChanged() {
window.dispose();
if( window instanceof Frame )
((Frame)window).setUndecorated( undecoratedCheckBox.isSelected() );
else if( window instanceof Dialog )
((Dialog)window).setUndecorated( undecoratedCheckBox.isSelected() );
window.setVisible( true );
}
private void maximizedBoundsChanged() {
if( window instanceof Frame ) {
((Frame)window).setMaximizedBounds( maximizedBoundsCheckBox.isSelected()
? new Rectangle( 50, 100, 1000, 700 )
: null );
updateInfo();
}
}
private void fullScreenChanged() {
boolean fullScreen = fullScreenCheckBox.isSelected();
GraphicsDevice gd = getGraphicsConfiguration().getDevice();
gd.setFullScreenWindow( fullScreen ? window : null );
}
private void nativeChanged() {
FlatNativeWindowBorder.setHasCustomDecoration( window, nativeCheckBox.isSelected() );
}
private void native2Changed() {
((RootPaneContainer)window).getRootPane().putClientProperty( FlatClientProperties.USE_WINDOW_DECORATIONS, native2CheckBox.isSelected() );
window.dispose();
window.setVisible( true );
}
private void revalidateLayout() {
window.revalidate();
}
private void replaceRootPane() {
JRootPane rootPane = new JRootPane();
if( window instanceof RootPaneContainer )
rootPane.setWindowDecorationStyle( ((RootPaneContainer)window).getRootPane().getWindowDecorationStyle() );
rootPane.getContentPane().add( new FlatNativeWindowBorderTest( window ) );
if( window instanceof MyJFrame )
((MyJFrame)window).setRootPane( rootPane );
else if( window instanceof MyJDialog )
((MyJDialog)window).setRootPane( rootPane );
window.revalidate();
window.repaint();
}
private void openDialog() {
showDialog( window );
}
private void openFrame() {
showFrame();
}
private void hideWindow() {
window.setVisible( false );
hiddenWindowsMap.put( window, null );
}
private void showHiddenWindow() {
for( Window w : hiddenWindowsMap.keySet() ) {
hiddenWindowsMap.remove( w );
w.setVisible( true );
break;
}
}
private void reopen() {
window.dispose();
window.setVisible( true );
}
private void reshow() {
window.setVisible( false );
try {
Thread.sleep( 100 );
} catch( InterruptedException ex ) {
// ignore
}
window.setVisible( true );
}
private void close() {
window.dispose();
}
private void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
info = new JLabel();
resizableCheckBox = new JCheckBox();
maximizedBoundsCheckBox = new JCheckBox();
undecoratedCheckBox = new JCheckBox();
fullScreenCheckBox = new JCheckBox();
nativeCheckBox = new JCheckBox();
native2CheckBox = new JCheckBox();
openDialogButton = new JButton();
hideWindowButton = new JButton();
reopenButton = new JButton();
replaceRootPaneButton = new JButton();
openFrameButton = new JButton();
showHiddenWindowButton = new JButton();
reshowButton = new JButton();
revalidateButton = new JButton();
hSpacer1 = new JPanel(null);
closeButton = new JButton();
//======== this ========
setLayout(new MigLayout(
"insets dialog,hidemode 3",
// columns
"[]" +
"[]" +
"[grow,fill]",
// rows
"[grow,top]para" +
"[]0" +
"[]0" +
"[]" +
"[]" +
"[]"));
//---- info ----
info.setText("text");
add(info, "cell 0 0 2 1");
//---- resizableCheckBox ----
resizableCheckBox.setText("resizable");
resizableCheckBox.setSelected(true);
resizableCheckBox.setMnemonic('R');
resizableCheckBox.addActionListener(e -> resizableChanged());
add(resizableCheckBox, "cell 0 1");
//---- maximizedBoundsCheckBox ----
maximizedBoundsCheckBox.setText("maximized bounds (50,100, 1000,700)");
maximizedBoundsCheckBox.setMnemonic('M');
maximizedBoundsCheckBox.addActionListener(e -> maximizedBoundsChanged());
add(maximizedBoundsCheckBox, "cell 1 1");
//---- undecoratedCheckBox ----
undecoratedCheckBox.setText("undecorated");
undecoratedCheckBox.setMnemonic('U');
undecoratedCheckBox.addActionListener(e -> undecoratedChanged());
add(undecoratedCheckBox, "cell 0 2");
//---- fullScreenCheckBox ----
fullScreenCheckBox.setText("full screen");
fullScreenCheckBox.setMnemonic('F');
fullScreenCheckBox.addActionListener(e -> fullScreenChanged());
add(fullScreenCheckBox, "cell 1 2");
//---- nativeCheckBox ----
nativeCheckBox.setText("FlatLaf native window decorations");
nativeCheckBox.setSelected(true);
nativeCheckBox.addActionListener(e -> nativeChanged());
add(nativeCheckBox, "cell 0 3 3 1");
//---- native2CheckBox ----
native2CheckBox.setText("JRootPane.useWindowDecorations");
native2CheckBox.setSelected(true);
native2CheckBox.addActionListener(e -> native2Changed());
add(native2CheckBox, "cell 0 3 3 1");
//---- openDialogButton ----
openDialogButton.setText("Open Dialog");
openDialogButton.setMnemonic('D');
openDialogButton.addActionListener(e -> openDialog());
add(openDialogButton, "cell 0 4 3 1");
//---- hideWindowButton ----
hideWindowButton.setText("Hide");
hideWindowButton.addActionListener(e -> hideWindow());
add(hideWindowButton, "cell 0 4 3 1");
//---- reopenButton ----
reopenButton.setText("Dispose and Reopen");
reopenButton.addActionListener(e -> reopen());
add(reopenButton, "cell 0 4 3 1");
//---- replaceRootPaneButton ----
replaceRootPaneButton.setText("replace rootpane");
replaceRootPaneButton.addActionListener(e -> replaceRootPane());
add(replaceRootPaneButton, "cell 0 4 3 1");
//---- openFrameButton ----
openFrameButton.setText("Open Frame");
openFrameButton.setMnemonic('A');
openFrameButton.addActionListener(e -> openFrame());
add(openFrameButton, "cell 0 5 3 1");
//---- showHiddenWindowButton ----
showHiddenWindowButton.setText("Show hidden");
showHiddenWindowButton.addActionListener(e -> showHiddenWindow());
add(showHiddenWindowButton, "cell 0 5 3 1");
//---- reshowButton ----
reshowButton.setText("Hide and Show");
reshowButton.addActionListener(e -> reshow());
add(reshowButton, "cell 0 5 3 1");
//---- revalidateButton ----
revalidateButton.setText("revalidate");
revalidateButton.addActionListener(e -> revalidateLayout());
add(revalidateButton, "cell 0 5 3 1");
add(hSpacer1, "cell 0 5 3 1,growx");
//---- closeButton ----
closeButton.setText("Close");
closeButton.addActionListener(e -> close());
add(closeButton, "cell 0 5 3 1");
// JFormDesigner - End of component initialization //GEN-END:initComponents
}
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
private JLabel info;
private JCheckBox resizableCheckBox;
private JCheckBox maximizedBoundsCheckBox;
private JCheckBox undecoratedCheckBox;
private JCheckBox fullScreenCheckBox;
private JCheckBox nativeCheckBox;
private JCheckBox native2CheckBox;
private JButton openDialogButton;
private JButton hideWindowButton;
private JButton reopenButton;
private JButton replaceRootPaneButton;
private JButton openFrameButton;
private JButton showHiddenWindowButton;
private JButton reshowButton;
private JButton revalidateButton;
private JPanel hSpacer1;
private JButton closeButton;
// JFormDesigner - End of variables declaration //GEN-END:variables
//---- class MyJFrame -----------------------------------------------------
private static class MyJFrame
extends JFrame
{
MyJFrame( String title ) {
super( title );
}
@Override
public void setRootPane( JRootPane root ) {
super.setRootPane( root );
}
}
//---- class MyJDialog ----------------------------------------------------
private static class MyJDialog
extends JDialog
{
MyJDialog( Window owner, String title, Dialog.ModalityType modalityType ) {
super( owner, title, modalityType );
}
@Override
public void setRootPane( JRootPane root ) {
super.setRootPane( root );
}
}
}
| [
"karl@jformdesigner.com"
] | karl@jformdesigner.com |
b267a7104465dfaa34973f6cbb440702718a5a9f | c269d5912eaf1021d0591893f6a0c9132cf9d182 | /src/deprecated/leetcode/array/leetcode0016.java | 6d03d4e922dac509eb41684682e0fd76aac87546 | [] | no_license | nujnay/leetcode_java | f2db0aa72d5fa7626d59a2754790bba15faf26e2 | 21b5b02806c54ec48f51a12534dde00954fe60e1 | refs/heads/master | 2023-04-01T17:18:01.370551 | 2021-04-12T08:12:41 | 2021-04-12T08:12:41 | 264,396,327 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 66 | java | package deprecated.leetcode.array;
public class leetcode0016 {
}
| [
"1292015395@qq.com"
] | 1292015395@qq.com |
dfe9ccde6933704d46e0532cab0a015895091eda | 6a72996a104f3df29d0dc65a0d604cc2e0923f14 | /app/src/test/java/davidminaya/loginwithfacebook/ExampleUnitTest.java | 34e9a59cc88ddb5658effa989e1ed29166a9c35b | [] | no_license | david-minaya/LoginWithFacebook | 9fb8c34ab4bd43862318f7aedb4ef3901e714ddc | 906241f875caa429be736ccee9d4c6265f16ae3f | refs/heads/master | 2021-01-19T23:48:35.971834 | 2017-04-23T21:52:30 | 2017-04-23T21:52:30 | 88,905,083 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 407 | java | package davidminaya.loginwithfacebook;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"davidminaya04@gmail.com"
] | davidminaya04@gmail.com |
d7811b85bea5f5595d6760bb4537739ecb4c9cd7 | a8851776a3025b5831c2a4462da1cedf788362e1 | /app/src/main/java/com/example/animation/Top3Players.java | c6a13d91efcdfc6b07b1539ec0b993c5ee685cd9 | [] | no_license | saystoDJman/Animation | 4d68667447c24ec72dcd98738207ea869b2b4c5e | ec9474edd251ae2151f660f54155429293cbbd38 | refs/heads/master | 2023-05-31T16:49:24.216650 | 2021-06-18T15:35:28 | 2021-06-18T15:35:28 | 376,465,950 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,452 | java | package com.example.animation;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.app.AlertDialog;
import android.content.Intent;
import android.database.Cursor;
import android.location.Address;
import android.location.Geocoder;
import android.os.Bundle;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.CameraPosition;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import java.io.IOException;
import java.util.List;
import java.util.Locale;
public class Top3Players extends AppCompatActivity implements OnMapReadyCallback {
public boolean isPermissionGranted = StartGameActivity.permissionGranted;
GoogleMap mGoogleMap;
SupportMapFragment supportMapFragment;
TextView player1,player2,player3,score1,score2,score3;
DBHelper DB;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_top3_players);
player1 = findViewById(R.id.firstplayer);
score1 = findViewById(R.id.firstplayerscore);
player2 = findViewById(R.id.secondplayer);
score2 = findViewById(R.id.secondplayerscore);
player3 = findViewById(R.id.thirdplayer);
score3 = findViewById(R.id.thirdplayerscore);
DB = new DBHelper(this);
String[] players = new String[3];
String[] scores = new String[3];
Cursor res = DB.getTop3();
if(res.getCount() != 0){
int i = 0;
while (res.moveToNext() && i<3){
players[i] = res.getString(0);
scores[i] = String.valueOf(res.getInt(2));
i++;
}
}else{
Toast.makeText(getBaseContext(),"No Player Exists in DB",Toast.LENGTH_SHORT).show();
}
player1.setText(players[0]);
player2.setText(players[1]);
player3.setText(players[2]);
score1.setText(scores[0]);
score2.setText(scores[1]);
score3.setText(scores[2]);
if(isPermissionGranted){
supportMapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.fragment1);
supportMapFragment.getMapAsync(this::onMapReady);
}
}
@Override
public void onMapReady(@NonNull GoogleMap googleMap) {
mGoogleMap = googleMap;
Toast.makeText(getBaseContext(),"Map is Ready",Toast.LENGTH_SHORT).show();
String gAddress = "Rajahmundry";
Geocoder geocoder = new Geocoder(Top3Players.this, Locale.getDefault());
try {
List<Address> addresses = geocoder.getFromLocationName(gAddress, 1);
if (addresses.size() > 0){
Address address = addresses.get(0);
double lat = addresses.get(0).getLatitude();
double lon = addresses.get(0).getLongitude();
LatLng long_and_lat = new LatLng(lat, lon);
mGoogleMap.clear();
mGoogleMap.addMarker(new MarkerOptions().position(long_and_lat).title("Player-1"));
CameraPosition cameraPosition = new CameraPosition.Builder().target(new LatLng(long_and_lat.latitude, long_and_lat.longitude)).zoom(14).build();
mGoogleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
}else{
new AlertDialog.Builder(Top3Players.this)
.setTitle("Oops!!")
.setMessage("No Map found for given Player-1 Please provide correct Address")
.setNegativeButton("Ok", null).show();
}
}
catch (IOException e) {
e.printStackTrace();
}
String gAddress1 = "Morampudi";
Geocoder geocoder1 = new Geocoder(Top3Players.this, Locale.getDefault());
try {
List<Address> addresses = geocoder1.getFromLocationName(gAddress1, 1);
if (addresses.size() > 0){
Address address = addresses.get(0);
double lat = addresses.get(0).getLatitude();
double lon = addresses.get(0).getLongitude();
LatLng long_and_lat = new LatLng(lat, lon);
mGoogleMap.addMarker(new MarkerOptions().position(long_and_lat).title("Player-2"));
//CameraPosition cameraPosition = new CameraPosition.Builder().target(new LatLng(long_and_lat.latitude, long_and_lat.longitude)).zoom(16).build();
//mGoogleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
}else{
new AlertDialog.Builder(Top3Players.this)
.setTitle("Oops!!")
.setMessage("No Map found for given Address-1 Please provide correct Address")
.setNegativeButton("Ok", null).show();
}
}
catch (IOException e) {
e.printStackTrace();
}
String gAddress2 = "Vlpuram";
Geocoder geocoder2 = new Geocoder(Top3Players.this, Locale.getDefault());
try {
List<Address> addresses = geocoder2.getFromLocationName(gAddress2, 1);
if (addresses.size() > 0){
Address address = addresses.get(0);
double lat = addresses.get(0).getLatitude();
double lon = addresses.get(0).getLongitude();
LatLng long_and_lat = new LatLng(lat, lon);
mGoogleMap.addMarker(new MarkerOptions().position(long_and_lat).title("Player-3"));
}else{
new AlertDialog.Builder(Top3Players.this)
.setTitle("Oops!!")
.setMessage("No Map found for given Address-1 Please provide correct Address")
.setNegativeButton("Ok", null).show();
}
}
catch (IOException e) {
e.printStackTrace();
}
}
@Override
public void onBackPressed() {
Intent intent = new Intent(getBaseContext(),StartGameActivity.class);
startActivity(intent);
finish();
}
} | [
"shhekarchowdary@gmail.com"
] | shhekarchowdary@gmail.com |
a2cdb57f3ea08d7da160aa5c5b47824e91c551a8 | 0ad51dde288a43c8c2216de5aedcd228e93590ac | /com/vmware/converter/ReplicationVmInProgressFault.java | 4d8742fd204e00655944c75f8570b0660fa36428 | [] | no_license | YujiEda/converter-sdk-java | 61c37b2642f3a9305f2d3d5851c788b1f3c2a65f | bcd6e09d019d38b168a9daa1471c8e966222753d | refs/heads/master | 2020-04-03T09:33:38.339152 | 2019-02-11T15:19:04 | 2019-02-11T15:19:04 | 155,151,917 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,933 | java | /**
* ReplicationVmInProgressFault.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package com.vmware.converter;
public class ReplicationVmInProgressFault extends com.vmware.converter.ReplicationVmFault implements java.io.Serializable {
private java.lang.String requestedActivity;
private java.lang.String inProgressActivity;
public ReplicationVmInProgressFault() {
}
public ReplicationVmInProgressFault(
com.vmware.converter.LocalizedMethodFault faultCause,
com.vmware.converter.LocalizableMessage[] faultMessage,
java.lang.String reason,
java.lang.String state,
java.lang.String instanceId,
com.vmware.converter.ManagedObjectReference vm,
java.lang.String requestedActivity,
java.lang.String inProgressActivity) {
super(
faultCause,
faultMessage,
reason,
state,
instanceId,
vm);
this.requestedActivity = requestedActivity;
this.inProgressActivity = inProgressActivity;
}
/**
* Gets the requestedActivity value for this ReplicationVmInProgressFault.
*
* @return requestedActivity
*/
public java.lang.String getRequestedActivity() {
return requestedActivity;
}
/**
* Sets the requestedActivity value for this ReplicationVmInProgressFault.
*
* @param requestedActivity
*/
public void setRequestedActivity(java.lang.String requestedActivity) {
this.requestedActivity = requestedActivity;
}
/**
* Gets the inProgressActivity value for this ReplicationVmInProgressFault.
*
* @return inProgressActivity
*/
public java.lang.String getInProgressActivity() {
return inProgressActivity;
}
/**
* Sets the inProgressActivity value for this ReplicationVmInProgressFault.
*
* @param inProgressActivity
*/
public void setInProgressActivity(java.lang.String inProgressActivity) {
this.inProgressActivity = inProgressActivity;
}
private java.lang.Object __equalsCalc = null;
public synchronized boolean equals(java.lang.Object obj) {
if (!(obj instanceof ReplicationVmInProgressFault)) return false;
ReplicationVmInProgressFault other = (ReplicationVmInProgressFault) obj;
if (obj == null) return false;
if (this == obj) return true;
if (__equalsCalc != null) {
return (__equalsCalc == obj);
}
__equalsCalc = obj;
boolean _equals;
_equals = super.equals(obj) &&
((this.requestedActivity==null && other.getRequestedActivity()==null) ||
(this.requestedActivity!=null &&
this.requestedActivity.equals(other.getRequestedActivity()))) &&
((this.inProgressActivity==null && other.getInProgressActivity()==null) ||
(this.inProgressActivity!=null &&
this.inProgressActivity.equals(other.getInProgressActivity())));
__equalsCalc = null;
return _equals;
}
private boolean __hashCodeCalc = false;
public synchronized int hashCode() {
if (__hashCodeCalc) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = super.hashCode();
if (getRequestedActivity() != null) {
_hashCode += getRequestedActivity().hashCode();
}
if (getInProgressActivity() != null) {
_hashCode += getInProgressActivity().hashCode();
}
__hashCodeCalc = false;
return _hashCode;
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(ReplicationVmInProgressFault.class, true);
static {
typeDesc.setXmlType(new javax.xml.namespace.QName("urn:vim25", "ReplicationVmInProgressFault"));
org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("requestedActivity");
elemField.setXmlName(new javax.xml.namespace.QName("urn:vim25", "requestedActivity"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setNillable(false);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("inProgressActivity");
elemField.setXmlName(new javax.xml.namespace.QName("urn:vim25", "inProgressActivity"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setNillable(false);
typeDesc.addFieldDesc(elemField);
}
/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}
/**
* Get Custom Serializer
*/
public static org.apache.axis.encoding.Serializer getSerializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanSerializer(
_javaType, _xmlType, typeDesc);
}
/**
* Get Custom Deserializer
*/
public static org.apache.axis.encoding.Deserializer getDeserializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanDeserializer(
_javaType, _xmlType, typeDesc);
}
}
| [
"yuji_eda@dwango.co.jp"
] | yuji_eda@dwango.co.jp |
2d36ff8cd4fe1d52e30c4e865dce2ecd398a26fc | b66f563b4cb8d0101a0b53a9a92a81474b41f49a | /src/com/revature/ConnectionFactory.java | 2df4294865a52463c072465c2257788867cb8bcb | [] | no_license | amitchellrevature/Project-ERS | bdd048c076355c637604961bea8c2319e7f6f1e2 | b1532619e63bfdf2e55325604370c558834755ff | refs/heads/main | 2023-08-14T06:55:34.483324 | 2021-09-22T20:03:47 | 2021-09-22T20:03:47 | 402,901,733 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 643 | java |
import java.sql.*;
public class ConnectionFactory {
private static Connection connection = null;
private ConnectionFactory() {
}
public static Connection getConnection() throws SQLException {
if (connection == null) {
String url = "jdbc:mysql://localhost:3306/ers";
String username = "root";
String password = "root";
try {
Class.forName("com.mysql.cj.jdbc.Driver");
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
connection = DriverManager.getConnection(url, username, password);
}
return connection;
}
}
| [
"alec.mitchell@revature.net"
] | alec.mitchell@revature.net |
6946d4ca8e7bac1e23e202d9949d50a0ee11c55a | f3880607204c7e85b4bd6442acd8e4a829bac7fd | /src/util/GenerateSupertaggerCategoryList.java | 0d2470d3edc83eedfe0110f9a129ea7296b91a65 | [
"Apache-2.0"
] | permissive | ramusa2/CandCNFPerceptronParser | 63977500fd0d5858cfa93bf132a57fcc428f9539 | 15c04b0333241b56fc332f3e71ffac0c43b94a04 | refs/heads/master | 2021-01-11T12:08:55.819239 | 2016-12-15T05:24:02 | 2016-12-15T05:24:02 | 76,525,012 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,194 | java | package util;
import illinoisParser.CCGbankReader;
import illinoisParser.Sentence;
import java.io.File;
import java.io.PrintWriter;
import java.util.Collection;
import util.statistics.FrequencyList;
import util.statistics.FrequencyListEntry;
import util.statistics.GrammarStatistics;
/**
* Given an optional integer argument k (default k=10), prints a list of categories appearing
* at least k times in sections 2-21 to categories_freq=k.txt
* @author ramusa2
*
*/
public class GenerateSupertaggerCategoryList {
public static void main(String[] args) throws Exception {
int k = 1;
if(args.length > 0) {
k = Integer.parseInt(args[0]);
}
int lowSec = 2;
int highSec = 21;
String autoDir = "data/CCGbank/AUTO/";
Collection<Sentence> corpus = CCGbankReader.getCCGbankData(lowSec, highSec, autoDir);
GrammarStatistics stats = GrammarStatistics.readStatistics(corpus);
PrintWriter pw = new PrintWriter(new File("categories_freq="+k+".txt"));
FrequencyList<String> counts = stats.getLexicalCategoryCounts();
for(FrequencyListEntry<String> entry : counts.sortedList()) {
if(entry.frequency() >= k) {
pw.println(entry.value());
}
}
pw.close();
}
}
| [
"ramusa2@illinois.edu"
] | ramusa2@illinois.edu |
57190aae909d4863b1864ca86cd1a6191600bed4 | feea4687dffefb2d1e8b457d2ad7a2f1bdf3807a | /lab5/src/com/shevtsod/Ingredient.java | 0a22ad788ec252cccd075a9533c78f7addd410e3 | [] | no_license | shevtsod/ENSE470 | 142ecba63ede055f03593dda4fd4a46c70aaf766 | 374c4ae6d2e13e912d4fdce43ab574ecde555bee | refs/heads/master | 2021-01-11T11:33:41.260840 | 2017-04-06T03:18:06 | 2017-04-06T03:18:06 | 87,381,539 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,185 | java | package com.shevtsod;
/**
* @author Daniel Shevtsov (SID: 200351253)
*/
public class Ingredient {
private String name;
private int quantity;
/**
* Constructor to initialize a new Ingredient with given values
* @param name String name of this Ingredient
* @param quantity int quantity of this Ingredient
*/
public Ingredient(String name, int quantity) {
this.name = name;
this.quantity = quantity;
}
/**
* Get the name of this Ingredient
* @return String name of this Ingredient
*/
public String getName() {
return name;
}
/**
* Set the new name of this Ingredient
* @param name New String name of this Ingredient
*/
public void setName(String name) {
this.name = name;
}
/**
* Get the int quantity of this Ingredient
* @return int quantity of this Ingredient
*/
public int getQuantity() {
return quantity;
}
/**
* Set the new quantity of this Ingredient
* @param quantity New int quantity of this Ingredient
*/
public void setQuantity(int quantity) {
this.quantity = quantity;
}
}
| [
"daniel.shevtsov@gmail.com"
] | daniel.shevtsov@gmail.com |
024c225ed209e16a98005ad2f199d493c6a4e5e0 | 1a44073dd72992e958e5c0431d6b01d5d2b35a46 | /app/src/test/java/com/hellotheworld/mineclearance/ExampleUnitTest.java | 93ddfbcd7f7e342cac7e9edba4d4f44f66b32fcc | [] | no_license | ceasaw/MineClearance | 6c58f4b3e23e4123a7823f1b875f1ee0b21601fa | b5bb9e91d8d97e34dc41c9ff900c82bff6f2f74f | refs/heads/master | 2020-06-12T20:17:50.904417 | 2019-07-01T02:10:19 | 2019-07-01T02:10:19 | 194,412,776 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 392 | java | package com.hellotheworld.mineclearance;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"ceasawang98@gmail.com"
] | ceasawang98@gmail.com |
d7a74c1d376b3bdf439faadb4627cce50c1ebdf1 | c8ff75bff55be9b7d8269372e9dfbe24adf5057a | /OpenSigComercial/src/br/com/opensig/comercial/client/GerarPreco.java | ac97ee8816a817e19d8c78c7508741efb0a74e2c | [] | no_license | danimaribeiro/OpenSIG | ecfd45e6d66ed00b2b4ed03d441813476a850d91 | 0aa062bb9ea0762465daec01e33e656660e15762 | refs/heads/master | 2021-01-17T05:31:44.015988 | 2012-11-20T19:04:07 | 2012-11-20T19:04:07 | 6,895,633 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 9,127 | java | package br.com.opensig.comercial.client;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import br.com.opensig.comercial.shared.modelo.ComCompra;
import br.com.opensig.comercial.shared.modelo.ComCompraProduto;
import br.com.opensig.comercial.shared.modelo.ComValorArredonda;
import br.com.opensig.comercial.shared.modelo.ComValorProduto;
import br.com.opensig.core.client.OpenSigCore;
import br.com.opensig.core.client.UtilClient;
import br.com.opensig.core.client.controlador.filtro.ECompara;
import br.com.opensig.core.client.controlador.filtro.FiltroObjeto;
import br.com.opensig.core.client.servico.CoreProxy;
import br.com.opensig.fiscal.shared.modelo.FisIncentivoEstado;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.gwtext.client.data.ArrayReader;
import com.gwtext.client.data.FieldDef;
import com.gwtext.client.data.FloatFieldDef;
import com.gwtext.client.data.IntegerFieldDef;
import com.gwtext.client.data.Record;
import com.gwtext.client.data.RecordDef;
import com.gwtext.client.data.Store;
import com.gwtext.client.data.StringFieldDef;
import com.gwtext.client.data.event.StoreListenerAdapter;
import com.gwtextux.client.widgets.window.ToastWindow;
public class GerarPreco {
private ComCompra compra;
private AsyncCallback asyncCallback;
// geracao de preco
private Store storeValor;
private Store storeArredonda;
private Store storeIncentivo;
public GerarPreco(ComCompra compra) {
this.compra = compra;
// montando os stores
FieldDef[] fdValor = new FieldDef[] { new IntegerFieldDef("comValorProdutoId"), new IntegerFieldDef("empEmpresa.empEmpresaId"), new StringFieldDef("empEmpresa.empEntidade.empEntidadeNome1"),
new IntegerFieldDef("comValorProdutoDespesa"), new IntegerFieldDef("comValorProdutoMarkup"), new StringFieldDef("comValorProdutoFormula"), new IntegerFieldDef("empFornecedorId"),
new StringFieldDef("empEntidadeNome1"), new IntegerFieldDef("prodProdutoId"), new StringFieldDef("prodProdutoDescricao") };
FiltroObjeto fo = new FiltroObjeto("empEmpresa", ECompara.IGUAL, compra.getEmpEmpresa());
CoreProxy<ComValorProduto> proxy = new CoreProxy<ComValorProduto>(new ComValorProduto(), fo);
storeValor = new Store(proxy, new ArrayReader(new RecordDef(fdValor)), true);
storeValor.addStoreListener(new StoreListenerAdapter() {
public void onLoad(Store store, Record[] records) {
storeArredonda.load();
}
});
FieldDef[] fdArredonda = new FieldDef[] { new IntegerFieldDef("comValorArredondaId"), new IntegerFieldDef("comValorProdutoId"), new FloatFieldDef("comValorArredondaMin"),
new FloatFieldDef("comValorArredondaMax"), new FloatFieldDef("comValorArredondaFixo") };
CoreProxy<ComValorArredonda> proxy1 = new CoreProxy<ComValorArredonda>(new ComValorArredonda());
storeArredonda = new Store(proxy1, new ArrayReader(new RecordDef(fdArredonda)), true);
storeArredonda.addStoreListener(new StoreListenerAdapter() {
public void onLoad(Store store, Record[] records) {
storeIncentivo.load();
}
});
FieldDef[] fdIncentivo = new FieldDef[] { new IntegerFieldDef("fisIncentivoEstadoId"), new IntegerFieldDef("empEmpresa.empEmpresaId"),
new StringFieldDef("empEmpresa.empEntidade.empEntidadeNome1"), new IntegerFieldDef("empEstadoId"), new StringFieldDef("empEstadoDescricao"),
new FloatFieldDef("fisIncentivoEstadoIcms1"), new FloatFieldDef("fisIncentivoEstadoIcms2") };
CoreProxy<FisIncentivoEstado> proxy2 = new CoreProxy<FisIncentivoEstado>(new FisIncentivoEstado());
storeIncentivo = new Store(proxy2, new ArrayReader(new RecordDef(fdIncentivo)), false);
storeIncentivo.addStoreListener(new StoreListenerAdapter() {
public void onLoad(Store store, Record[] records) {
gerar();
}
});
}
public void gerar(AsyncCallback asyncCallback) {
this.asyncCallback = asyncCallback;
storeValor.load();
}
// gera o preço de cada de acordo com uma formula dinamica
private void gerar() {
// valor dos produtos
double total = compra.getComCompraValorProduto();
// faz os calculos percentuais dos outros tributos na NF
int frete = (int) (compra.getComCompraValorFrete() / total * 100);
int seguro = (int) (compra.getComCompraValorSeguro() / total * 100);
int outros = (int) (compra.getComCompraValorOutros() / total * 100);
int desconto = (int) (compra.getComCompraValorDesconto() / total * 100);
// coloca tudo em um Map para utilizar na formula
Map<String, String> vars = new HashMap<String, String>();
vars.put("FRETE", frete < 10 ? "0" + frete : frete + "");
vars.put("SEGURO", seguro < 10 ? "0" + seguro : seguro + "");
vars.put("OUTROS", outros < 10 ? "0" + outros : outros + "");
vars.put("DESCONTO", desconto < 10 ? "0" + desconto : desconto + "");
// variaveis
Record recProd, recInc;
String valor, despesa, markup, cst;
double dentro, icms, ipi, icmsMaior, icmsMenor;
// faz o loop em todos os registros
for (ComCompraProduto comProd : compra.getComCompraProdutos()) {
if (comProd.getComCompraProdutoPreco() == 0.00) {
try {
recProd = getValorProduto(comProd.getComCompraProdutoId(), compra.getEmpFornecedor().getEmpFornecedorId());
recInc = UtilClient.getRegistro(storeIncentivo, "empEstadoId", compra.getEmpEstado().getEmpEstadoId() + "");
// recupera os valores individuais de cada produto
valor = comProd.getComCompraProdutoValor() + "";
dentro = comProd.getProdProduto().getProdTributacao().getProdTributacaoDentro();
cst = comProd.getProdProduto().getProdTributacao().getProdTributacaoCst();
icms = comProd.getComCompraProdutoIcms();
ipi = comProd.getComCompraProdutoIpi();
despesa = recProd.getAsString("comValorProdutoDespesa");
markup = recProd.getAsString("comValorProdutoMarkup");
icmsMaior = recInc != null ? recInc.getAsDouble("fisIncentivoEstadoIcms1") : 0.00;
icmsMenor = recInc != null ? recInc.getAsDouble("fisIncentivoEstadoIcms2") : 0.00;
vars.put("BRUTO", valor);
vars.put("IPI", ipi >= 10 ? String.valueOf(ipi).replace(".", "") : "0" + String.valueOf(ipi).replace(".", ""));
vars.put("DESPESA", despesa.length() == 1 ? "0" + despesa.replace(".", "") : despesa.replace(".", ""));
vars.put("MARKUP", markup.length() == 1 ? "0" + markup.replace(".", "") : markup.replace(".", ""));
// verifica a tributacao pelo cst
if (cst.equals("00")) { // tributado integral
// caso a empresa nao tenha incentivo
if (icmsMaior == 0.00 || icmsMenor == 0.00) {
vars.put("ICMS", (dentro - icms) >= 10 ? "" + (dentro - icms) : "0" + (dentro - icms));
} else {
String icmsInc = "";
// tendo ver se o produto tem a menor taxa ou nao
if (comProd.getProdProduto().getProdProdutoIncentivo()) {
icmsInc = icmsMenor >= 10 ? "" + icmsMenor : "0" + icmsMenor;
} else {
icmsInc = icmsMaior >= 10 ? "" + icmsMaior : "0" + icmsMaior;
}
vars.put("ICMS", icmsInc);
}
} else if (cst.equals("10") || cst.equals("30") || cst.equals("40") || cst.equals("41") || cst.equals("60")) { // isento-substituicao
vars.put("ICMS", icms >= 10 ? String.valueOf(icms) : "0" + String.valueOf(icms));
}
vars.put("ICMS", vars.get("ICMS").replace(".", ""));
// utiliza a formula
double preco = executarFormula(recProd.getAsString("comValorProdutoFormula"), vars);
// arredonda
preco = arredondar(preco, storeArredonda);
comProd.setComCompraProdutoPreco(preco);
} catch (Exception ex) {
comProd.setComCompraProdutoPreco(0.00);
new ToastWindow(OpenSigCore.i18n.txtIcms(), OpenSigCore.i18n.errIcms()).show();
}
}
}
asyncCallback.onSuccess(compra);
}
private Record getValorProduto(int produtoId, int fornecedorId) {
// verifica se tem preco por produto
Record recProd = UtilClient.getRegistro(storeValor, "prodProdutoId", produtoId + "");
// case nao ache, procura pelo fornecedor
if (recProd == null) {
recProd = UtilClient.getRegistro(storeValor, "empFornecedorId", fornecedorId + "");
}
// caso nao ache pega o primeiro que e o geral
if (recProd == null) {
recProd = storeValor.getAt(0);
}
storeArredonda.filter("comValorProdutoId", recProd.getAsString("comValorProdutoId"));
return recProd;
}
public static double executarFormula(String formula, Map<String, String> vars) throws Exception {
for (Entry<String, String> entry : vars.entrySet()) {
formula = formula.toUpperCase().replaceAll(entry.getKey().toUpperCase(), entry.getValue());
}
return Double.parseDouble(UtilClient.eval(formula));
}
public static double arredondar(Double valor, Store store) {
int pos = valor.toString().indexOf(".");
int inteiro = Integer.valueOf(valor.toString().substring(0, pos));
double decimal = valor - inteiro;
for (Record rec : store.getRecords()) {
double min = rec.getAsDouble("comValorArredondaMin");
double max = rec.getAsDouble("comValorArredondaMax");
double fixo = rec.getAsDouble("comValorArredondaFixo");
if (min < decimal && decimal < max) {
decimal = fixo;
break;
}
}
return inteiro + decimal;
}
}
| [
"pedroh.lira@gmail.com"
] | pedroh.lira@gmail.com |
e0adfb8fab30c2ac6f09d22adcb32adf58706b4e | e79bb1a016ec98f45b797234985e036b6157a2eb | /jasdb_acl/src/main/java/com/oberasoftware/jasdb/acl/GrantObjectMeta.java | 345cc9382a2fde77147768c497720af7e7be741b | [
"MIT"
] | permissive | oberasoftware/jasdb | a13a3687bcb8fd0af9468778242016640758b04a | 15114fc69e53ef57d6f377985a8adc3da5cc90cf | refs/heads/master | 2023-06-09T12:21:59.171957 | 2023-05-23T19:25:22 | 2023-05-23T19:25:22 | 33,053,071 | 33 | 10 | NOASSERTION | 2023-04-30T11:54:30 | 2015-03-28T22:41:15 | Java | UTF-8 | Java | false | false | 3,769 | java | package com.oberasoftware.jasdb.acl;
import com.oberasoftware.jasdb.api.session.Entity;
import com.oberasoftware.jasdb.engine.metadata.Constants;
import com.oberasoftware.jasdb.core.EmbeddedEntity;
import com.oberasoftware.jasdb.core.SimpleEntity;
import com.oberasoftware.jasdb.api.security.AccessMode;
import com.oberasoftware.jasdb.api.model.Grant;
import com.oberasoftware.jasdb.api.model.GrantObject;
import com.oberasoftware.jasdb.core.properties.EntityValue;
import com.oberasoftware.jasdb.api.session.Property;
import com.oberasoftware.jasdb.api.session.Value;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* @author Renze de Vries
*/
public class GrantObjectMeta implements GrantObject {
private String objectName;
private Map<String, Grant> userGrants;
public GrantObjectMeta(String objectName, Map<String, Grant> userGrants) {
this.objectName = objectName;
this.userGrants = userGrants;
}
public GrantObjectMeta(String objectName, Grant... grants) {
this.objectName = objectName;
this.userGrants = new ConcurrentHashMap<>();
for(Grant grant : grants) {
userGrants.put(grant.getGrantedUsername(), grant);
}
}
public static GrantObject fromEntity(Entity entity) {
String grantObject = entity.getValue(Constants.GRANT_OBJECT).toString();
Map<String, Grant> userGrants = new ConcurrentHashMap<>();
Property grantsProperty = entity.getProperty(Constants.GRANTS);
for(Value grantValue : grantsProperty.getValues()) {
EntityValue entityValue = (EntityValue) grantValue;
String grantUser = entityValue.toEntity().getValue(Constants.GRANT_USER).toString();
String grantMode = entityValue.toEntity().getValue(Constants.GRANT_MODE).toString();
userGrants.put(grantUser, new GrantMeta(grantUser, AccessMode.fromMode(grantMode)));
}
return new GrantObjectMeta(grantObject, userGrants);
}
public static SimpleEntity toEntity(GrantObject grantObject) {
SimpleEntity entity = new SimpleEntity();
entity.addProperty(Constants.GRANT_OBJECT, grantObject.getObjectName());
for(Grant grant : grantObject.getGrants()) {
EmbeddedEntity grantEntity = new EmbeddedEntity();
grantEntity.setProperty(Constants.GRANT_USER, grant.getGrantedUsername());
grantEntity.setProperty(Constants.GRANT_MODE, grant.getAccessMode().getMode());
entity.addEntity(Constants.GRANTS, grantEntity);
}
return entity;
}
@Override
public String getObjectName() {
return objectName;
}
@Override
public void addGrant(Grant grant) {
userGrants.put(grant.getGrantedUsername(), grant);
}
@Override
public boolean isGranted(String userName, AccessMode mode) {
Grant grant = getGrant(userName);
if(grant != null) {
//check the the grants for the user has a higher rank than the desired access rank
return grant.getAccessMode().getRank() >= mode.getRank();
} else {
return false;
}
}
@Override
public Grant getGrant(String userName) {
return userGrants.get(userName);
}
@Override
public List<Grant> getGrants() {
return new ArrayList<>(userGrants.values());
}
@Override
public void removeGrant(String userName) {
userGrants.remove(userName);
}
@Override
public String toString() {
return "GrantObjectMeta{" +
"objectName='" + objectName + '\'' +
", userGrants=" + userGrants +
'}';
}
}
| [
"renze@renarj.nl"
] | renze@renarj.nl |
18428b0d59c9d02046e37f3f8a25847acf8479ec | a35aa8d7be9dc027e550f41088508830f9eaddf7 | /app/src/main/java/com/example/sahayam/ui/home/HomeFragment.java | 53eab15aff784a0e82dc4971fabe4079b663c567 | [] | no_license | miniam/sahayam | 18d87f5fdcf69fe50f4c5f975e2150500521dfd0 | 5303bd99e6cd9905792988d2768bcc530024c8ff | refs/heads/bran | 2020-12-26T07:19:38.376163 | 2020-09-10T16:06:53 | 2020-09-10T16:06:53 | 237,431,168 | 1 | 1 | null | 2020-02-01T03:01:55 | 2020-01-31T13:02:19 | Java | UTF-8 | Java | false | false | 1,161 | java | package com.example.sahayam.ui.home;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProviders;
import com.example.sahayam.R;
import com.example.sahayam.datasys;
public class HomeFragment extends Fragment {
Button but;
private HomeViewModel homeViewModel;
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
homeViewModel =ViewModelProviders.of(this).get(HomeViewModel.class);
View root = inflater.inflate(R.layout.fragment_home, container, false);
but=(Button)root.findViewById(R.id.btnRoundShape);
but.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent= new Intent(getActivity(), datasys.class);
startActivity(intent);
}
});
return root;
}
} | [
"malladisiddhu@gmail.com"
] | malladisiddhu@gmail.com |
1c695bbad788db0e7a0e1c6c137ba2077b478d68 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/1/1_b8d86330d1fadc645630416c3aaebf131bf749fc/AbstractTagTests/1_b8d86330d1fadc645630416c3aaebf131bf749fc_AbstractTagTests_t.java | 9ba07b2f65246551a850e0fe42818e41d8df372c | [] | 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 | 2,770 | java | /*
* Copyright 2002-2012 the original author or authors.
*
* 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.springframework.web.servlet.tags;
import junit.framework.TestCase;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.mock.web.MockPageContext;
import org.springframework.mock.web.MockServletContext;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.servlet.DispatcherServlet;
import org.springframework.web.servlet.LocaleResolver;
import org.springframework.web.servlet.SimpleWebApplicationContext;
import org.springframework.web.servlet.ThemeResolver;
import org.springframework.web.servlet.i18n.AcceptHeaderLocaleResolver;
import org.springframework.web.servlet.theme.FixedThemeResolver;
/**
* Abstract base class for testing tags; provides {@link #createPageContext()}.
*
* @author Alef Arendsen
* @author Juergen Hoeller
* @author Sam Brannen
*/
public abstract class AbstractTagTests extends TestCase {
protected MockPageContext createPageContext() {
MockServletContext sc = new MockServletContext();
sc.addInitParameter("springJspExpressionSupport", "true");
SimpleWebApplicationContext wac = new SimpleWebApplicationContext();
wac.setServletContext(sc);
wac.setNamespace("test");
wac.refresh();
MockHttpServletRequest request = new MockHttpServletRequest(sc);
MockHttpServletResponse response = new MockHttpServletResponse();
if (inDispatcherServlet()) {
request.setAttribute(DispatcherServlet.WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac);
LocaleResolver lr = new AcceptHeaderLocaleResolver();
request.setAttribute(DispatcherServlet.LOCALE_RESOLVER_ATTRIBUTE, lr);
ThemeResolver tr = new FixedThemeResolver();
request.setAttribute(DispatcherServlet.THEME_RESOLVER_ATTRIBUTE, tr);
request.setAttribute(DispatcherServlet.THEME_SOURCE_ATTRIBUTE, wac);
}
else {
sc.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac);
}
return new MockPageContext(sc, request, response);
}
protected boolean inDispatcherServlet() {
return true;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
e33c0f521f5275ad85fcf22c6c731c42f3764a05 | d64848ed1d9ff87179174135d73c2c5d138cc41d | /MotoActions/src/com/moto/actions/SensorHelper.java | 8a0d669be540b6eaae1b72f2354076d0a401b254 | [] | no_license | moto-sm6xxx/android_device_motorola_sofiar | 28f1fd6964142e51c0f4a3adef8ce044d29f4a2c | 244327ae4e2ce624fc208d907884d6aeeb334969 | refs/heads/android-11 | 2023-03-12T15:22:48.578360 | 2021-01-27T22:56:16 | 2021-01-27T23:37:39 | 268,601,690 | 7 | 25 | null | 2022-04-28T05:08:33 | 2020-06-01T18:32:21 | Java | UTF-8 | Java | false | false | 4,128 | java | /*
* Copyright (c) 2015 The CyanogenMod Project
* Copyright (c) 2017 The LineageOS 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.moto.actions;
import java.util.List;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.hardware.TriggerEventListener;
import android.util.Log;
public class SensorHelper {
private static final String TAG = "MotoActions";
private static final int SENSOR_TYPE_MMI_CAMERA_ACTIVATION = 65540;
private static final int SENSOR_TYPE_MMI_CHOP_CHOP = 65546;
private static final int SENSOR_TYPE_MMI_FLAT_UP = 65537;
private static final int SENSOR_TYPE_MMI_FLAT_DOWN = 65538;
private static final int SENSOR_TYPE_MMI_STOW = 65539;
private static final int BATCH_LATENCY_IN_MS = 100;
private final Context mContext;
private final SensorManager mSensorManager;
public SensorHelper(Context context) {
mContext = context;
mSensorManager = (SensorManager) mContext .getSystemService(Context.SENSOR_SERVICE);
dumpSensorsList();
}
private void dumpSensorsList() {
try {
FileOutputStream out = mContext.openFileOutput("sensors.txt", Context.MODE_PRIVATE);
OutputStreamWriter writer = new OutputStreamWriter(out);
List<Sensor> sensorList = mSensorManager.getSensorList(Sensor.TYPE_ALL);
for (Sensor sensor : sensorList) {
writer.write("sensor " + sensor.getType() + " = " + sensor.getName()
+ " max batch: " + sensor.getFifoMaxEventCount() + " isWakeUp: " + sensor.isWakeUpSensor() + "\n");
}
writer.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public Sensor getCameraActivationSensor() {
return mSensorManager.getDefaultSensor(SENSOR_TYPE_MMI_CAMERA_ACTIVATION, true);
}
public Sensor getChopChopSensor() {
return mSensorManager.getDefaultSensor(SENSOR_TYPE_MMI_CHOP_CHOP, true);
}
public Sensor getFlatUpSensor() {
return mSensorManager.getDefaultSensor(SENSOR_TYPE_MMI_FLAT_UP, true);
}
public Sensor getFlatDownSensor() {
return mSensorManager.getDefaultSensor(SENSOR_TYPE_MMI_FLAT_DOWN, true);
}
public Sensor getProximitySensor() {
return mSensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY, true);
}
public Sensor getStowSensor() {
return mSensorManager.getDefaultSensor(SENSOR_TYPE_MMI_STOW, true);
}
public void registerListener(Sensor sensor, SensorEventListener listener) {
if (!mSensorManager.registerListener(listener, sensor,
SensorManager.SENSOR_DELAY_NORMAL, BATCH_LATENCY_IN_MS * 1000)) {
throw new RuntimeException("Failed to registerListener for sensor " + sensor);
}
}
public void unregisterListener(SensorEventListener listener) {
mSensorManager.unregisterListener(listener);
}
/* TriggerSensor */
public void requestTriggerSensor(Sensor sensor, TriggerEventListener listener) {
if (!mSensorManager.requestTriggerSensor(listener, sensor)) {
throw new RuntimeException("Failed to requestTriggerSensor for sensor " + sensor);
}
}
public void cancelTriggerSensor(Sensor sensor, TriggerEventListener listener) {
mSensorManager.cancelTriggerSensor(listener, sensor);
}
}
| [
"vachounet@live.fr"
] | vachounet@live.fr |
59801acb9e5f257188fd093fd9ead539c8a08c43 | 7bcda5eb216f0c5c81f5e913501d5d7dc6deccad | /app/src/main/java/sg/edu/rp/c346/demotipsforexams/MainActivity.java | 1f1b7679a17a0d8a29c80653c257da84754de800 | [] | no_license | jaspermyrp/P07_DemoTipsForExams | 5ebbba861f60bff638c7a4d1fb44e43e034b4c83 | 1bd85a182a4d120a9554ac4417ea1e11519cae1b | refs/heads/master | 2020-05-31T05:08:42.195549 | 2019-06-04T02:19:06 | 2019-06-04T02:19:06 | 190,113,543 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,189 | java | package sg.edu.rp.c346.demotipsforexams;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity {
// Global Variables //
ListView lvExamTips;
String[] examTipsArray = new String[5];
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Bind UI Components //
lvExamTips = findViewById(R.id.listViewExamTips);
// examTipsArray data //
examTipsArray[0] = "Prepare way before the exam";
examTipsArray[1] = "Practice coding";
examTipsArray[2] = "Seek help from lecturer";
examTipsArray[3] = "Prepare template code";
examTipsArray[4] = "Create empty projects for MSA";
// ListView adapter //
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, examTipsArray);
lvExamTips.setAdapter(adapter);
}
}
| [
"17020202@myrp.edu.sg"
] | 17020202@myrp.edu.sg |
d8632f4c2b2d597a465b428a9a84c0202ff5390a | 88119ca018d602a6883cd54c5af416ea18dcdcba | /Java/src/leetcode/lc977.java | 22c80eecdb3c1efd34a7293690bc1bf6672a7d0f | [] | no_license | imzzf/leetcode | 50ab1aaa0a195dc1f9787e99e56653f27bf7f56e | 7fd6f6c4cf56dc1f058530fecbd70a20813aa43d | refs/heads/master | 2021-06-27T15:17:43.809463 | 2020-10-29T09:40:08 | 2020-10-29T09:40:08 | 174,289,058 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 513 | java | package leetcode;
/**
* @author zzf
* @date 2020/10/16
*/
public class lc977 {
public int[] sortedSquares(int[] A) {
int n = A.length;
int i = 0;
int j = n - 1;
int p = n - 1;
int[] ans = new int[n];
while (i <= j) {
if (A[i] * A[i] > A[j] * A[j]) {
ans[p--] = A[i] * A[i];
++i;
} else {
ans[p--] = A[j] * A[j];
--j;
}
}
return ans;
}
}
| [
"1260184712@qq.com"
] | 1260184712@qq.com |
5597d37675dc5f72e7b624d31b7f16fba9256d24 | 902d338eb4e38450b7a848289dcdb86aa86ae2b0 | /SpringBootJwtAuthentication/src/main/java/com/menondemand/jwtauthentication/message/request/SignUpForm.java | 7d463d40321382d0c3cde2a781f8ea045a964a4f | [] | no_license | susenjitdey/MentorOnDemandSusenjit | c1b68623212cb0102aac13738663ed7ea2d98bfc | c507254fe401fd9e8e0e5e2e6782b9039b7917ba | refs/heads/master | 2020-04-15T04:38:10.128023 | 2019-06-10T09:17:58 | 2019-06-10T09:17:58 | 164,390,288 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,261 | java | package com.menondemand.jwtauthentication.message.request;
import java.util.Set;
import javax.validation.constraints.*;
public class SignUpForm {
@NotBlank
@Size(min = 3, max = 50)
private String name;
@NotBlank
@Size(min = 3, max = 50)
private String username;
@NotBlank
@Size(max = 60)
@Email
private String email;
private Set<String> role;
@NotBlank
@Size(min = 6, max = 40)
private String password;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public Set<String> getRole() {
return this.role;
}
public void setRole(Set<String> role) {
this.role = role;
}
} | [
"susenjitdey@gmail.com"
] | susenjitdey@gmail.com |
3d7b693b7d6498db9115d52495bfe631357232b4 | 17afd9b0bd9c2c8fe19a1e3aae5e587fd16a371d | /hp-parent/hp-wx-pc/src/main/java/com/hp/modules/oss/cloud/AliyunCloudStorageService.java | bc5212ed56c67d3a54328c62029726e8766ffce3 | [] | no_license | hpwx/hpwx | cb6b3e9fc520d14c488f616bb5158528fe160b22 | 0ed3e274c6b5ebad381dc785b198538763db88b0 | refs/heads/master | 2022-07-12T06:41:29.183977 | 2022-06-26T02:51:48 | 2022-06-26T02:51:48 | 173,033,649 | 0 | 1 | null | 2019-03-01T07:36:21 | 2019-02-28T03:23:27 | Java | UTF-8 | Java | false | false | 2,210 | java | /**
* Copyright 2018 开源 http://www.renren.io
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.hp.modules.oss.cloud;
import com.aliyun.oss.OSSClient;
import com.hp.common.exception.RRException;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
/**
* 阿里云存储
* @author chenshun
* @email sunlightcs@gmail.com
* @date 2017-03-26 16:22
*/
public class AliyunCloudStorageService extends CloudStorageService {
private OSSClient client;
public AliyunCloudStorageService(CloudStorageConfig config){
this.config = config;
//初始化
init();
}
private void init(){
client = new OSSClient(config.getAliyunEndPoint(), config.getAliyunAccessKeyId(),
config.getAliyunAccessKeySecret());
}
@Override
public String upload(byte[] data, String path) {
return upload(new ByteArrayInputStream(data), path);
}
@Override
public String upload(InputStream inputStream, String path) {
try {
client.putObject(config.getAliyunBucketName(), path, inputStream);
} catch (Exception e){
throw new RRException("上传文件失败,请检查配置信息", e);
}
return config.getAliyunDomain() + "/" + path;
}
@Override
public String uploadSuffix(byte[] data, String suffix) {
return upload(data, getPath(config.getAliyunPrefix(), suffix));
}
@Override
public String uploadSuffix(InputStream inputStream, String suffix) {
return upload(inputStream, getPath(config.getAliyunPrefix(), suffix));
}
}
| [
"347117239@qq.com"
] | 347117239@qq.com |
ab577aba7b4cc29f5dcadc627606f6cd580f1c45 | 55cc3bd78412ec4982bd673eb7e2cd76fe2990e9 | /src/com/edu/agh/student/lakeproject/fish/impl/ArrayEyeView.java | a7f323349778437bb450d88d25172a383595f280 | [] | no_license | wilczogon/LakeProject | cc1a443c7f260342e4f023a15a9c66788d1c3a29 | b58b38a29c795770ba14855c29de63606248d9dd | refs/heads/master | 2016-09-05T13:35:26.144161 | 2015-01-13T07:16:28 | 2015-01-13T07:16:28 | 17,746,984 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 572 | java | package com.edu.agh.student.lakeproject.fish.impl;
import java.awt.Color;
import java.util.ArrayList;
import com.edu.agh.student.lakeproject.fish.EyeView;
public class ArrayEyeView extends EyeView {
private ArrayList<Color> viewArray;
public ArrayEyeView(int viewSize) {
this.viewArray = new ArrayList<Color>(viewSize);
}
public void appendPixel(Color pixel) {
this.viewArray.add(pixel);
}
@Override
public Object[] getPixels() {
return this.viewArray.toArray();
}
@Override
public void addPixel(Color color) {
this.viewArray.add(color);
}
}
| [
"pawele@vp.pl"
] | pawele@vp.pl |
cb97a30896853a3dcac0d88ee9e6c9ec7974426a | 665138a089b869058ea39aeaa0292f74d223bdb3 | /app/src/main/java/com/kaihuang/nansui/common/utils/JsonParser.java | 248dd8f42ff3546ffe468e39dc4d47dcb8d9d0da | [] | no_license | 512182401/kaihuang | 42a5418227fe3ab0e52c9869354d83f429a171a5 | 361061e293ab3b9839e3b6358a5df344d58cb503 | refs/heads/master | 2021-04-26T21:50:25.041825 | 2018-03-07T03:56:26 | 2018-03-07T03:56:26 | 124,164,252 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,708 | java | package com.kaihuang.nansui.common.utils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.json.JSONTokener;
/**
* Json结果解析类
*/
public class JsonParser {
public static String parseIatResult(String json) {
StringBuffer ret = new StringBuffer();
try {
JSONTokener tokener = new JSONTokener(json);
JSONObject joResult = new JSONObject(tokener);
JSONArray words = joResult.getJSONArray("ws");
for (int i = 0; i < words.length(); i++) {
// 转写结果词,默认使用第一个结果
JSONArray items = words.getJSONObject(i).getJSONArray("cw");
JSONObject obj = items.getJSONObject(0);
ret.append(obj.getString("w"));
// 如果需要多候选结果,解析数组其他字段
// for(int j = 0; j < items.length(); j++)
// {
// JSONObject obj = items.getJSONObject(j);
// ret.append(obj.getString("w"));
// }
}
} catch (Exception e) {
e.printStackTrace();
}
return ret.toString();
}
public static String parseGrammarResult(String json) {
StringBuffer ret = new StringBuffer();
try {
JSONTokener tokener = new JSONTokener(json);
JSONObject joResult = new JSONObject(tokener);
JSONArray words = joResult.getJSONArray("ws");
for (int i = 0; i < words.length(); i++) {
JSONArray items = words.getJSONObject(i).getJSONArray("cw");
for(int j = 0; j < items.length(); j++)
{
JSONObject obj = items.getJSONObject(j);
if(obj.getString("w").contains("nomatch"))
{
ret.append("没有匹配结果.");
return ret.toString();
}
ret.append("【结果】" + obj.getString("w"));
ret.append("【置信度】" + obj.getInt("sc"));
ret.append("\n");
}
}
} catch (Exception e) {
e.printStackTrace();
ret.append("没有匹配结果.");
}
return ret.toString();
}
public static String parseLocalGrammarResult(String json) {
StringBuffer ret = new StringBuffer();
try {
JSONTokener tokener = new JSONTokener(json);
JSONObject joResult = new JSONObject(tokener);
JSONArray words = joResult.getJSONArray("ws");
for (int i = 0; i < words.length(); i++) {
JSONArray items = words.getJSONObject(i).getJSONArray("cw");
for(int j = 0; j < items.length(); j++)
{
JSONObject obj = items.getJSONObject(j);
if(obj.getString("w").contains("nomatch"))
{
ret.append("没有匹配结果.");
return ret.toString();
}
ret.append("【结果】" + obj.getString("w"));
ret.append("\n");
}
}
ret.append("【置信度】" + joResult.optInt("sc"));
} catch (Exception e) {
e.printStackTrace();
ret.append("没有匹配结果.");
}
return ret.toString();
}
}
| [
"512182401@qq.com"
] | 512182401@qq.com |
5d6cba0201d7ff011dcf2ab803580f79c52b7fbf | e04f3bebf39ff6ea8be005182e0d98d395b15337 | /org.xtext.alma.sdmdsl/src/alma/hla/datamodel/meta/asdm/TableKey.java | a555e9fab613c5200cbbb70529a363ee87aff576 | [] | no_license | loriebi/SDMDSL | edb457caf440baa6638ba6997be3d81c613a0049 | 0a41e8d2c1b7c3f1eef1fbc39c793b347f7e9b2b | refs/heads/master | 2021-01-23T20:32:13.222533 | 2017-09-08T14:05:53 | 2017-09-08T14:05:53 | 102,865,767 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,358 | java | package alma.hla.datamodel.meta.asdm;
import java.util.ArrayList;
import java.util.List;
import org.xtext.alma.sdmdsl.sdmdsl.Field;
import alma.hla.datamodel.util.MMUtil;
public class TableKey extends ASDMAttribute{
/**
* This is the sequence of attributes in this table that make up the key.
* These attributes may either be intrinsic or extrinsic attributes.
* There is a 1-to-1 mapping between the field and base arrays.
*/
private ASDMAttribute[] field;
/**
* This is the sequence of attributes that form the basis for the key. These
* attributes may be in other tables. These references may also be null, which
* indicates there is no basis; i.e. they refer to attributes already in this table.
*/
private ASDMAttribute[] base;
/* -------------------- Constructor -------------------- */
public TableKey() {
key = true;
}
public TableKey(Field field) {
super(field);
key = true;
}
/* -------------------- Initialization -------------------- */
public void init(List<ASDMAttribute> keyAttributes){
super.name = "key";
int size = keyAttributes.size();
field = new ASDMAttribute[size];
base = new ASDMAttribute[size];
String keyName = null;
String tableName = null;
String baseAttribute = null;
for(int i=0;i<size;i++){
keyName = keyAttributes.get(0).getName();
if(keyAttributes.get(0).getRefersTo() != null){
tableName = keyAttributes.get(0).getRefersTo();
}
setReference(i,keyName,tableName,baseAttribute,keyAttributes);
}
}
/* -------------------- Functions -------------------- */
public void setReference(int index,String keyName,String tableName,String baseAttribute,List<ASDMAttribute> keyAttributes){
// 1. If baseTable and baseAttribute are both null, then it must refer to an
// attribute in this table.
if (tableName == null && baseAttribute == null) {
field[index] = keyAttributes.get(index);
return;
}
// 2. Otherwise, the base table name might be this one.
AlmaTable table = null;
if(tableName.equals(super.tableName)){
}
field[index] = keyAttributes.get(index);
}
public List<ASDMAttribute> getFieldSet() {
List<ASDMAttribute> res = new ArrayList<ASDMAttribute>();
for(int i=0; i<field.length;i++){
res.add(field[i]);
}
return res;
}
public String FieldNames1 () {
String result = "";
for (int i = 0; i < field.length; ++i) {
if (i == field.length - 1)
result += "\"" + field[i].getName() + "\"";
else
result += "\"" + field[i].getName() + "\", ";
}
return result;
}
/**
* List of field names: x.getName() + "|" + x.getSequence() + "|" + x.getVersion()
*/
public String FieldNames4 () {
String result = "";
for (int i = 0; i < field.length; ++i) {
if (i == field.length - 1)
result += "x.get" + MMUtil.UpperCaseName(field[i].getName()) + "()";
else
result += "x.get" + MMUtil.UpperCaseName(field[i].getName()) + "() + \"|\" + ";
}
return result;
}
/* -------------------- Setters and Getters -------------------- */
public ASDMAttribute[] getField() {
return field;
}
public void setField(ASDMAttribute[] field) {
this.field = field;
}
public ASDMAttribute[] getBase() {
return base;
}
public void setBase(ASDMAttribute[] base) {
this.base = base;
}
}
| [
"levan.l2ria@gmail.com"
] | levan.l2ria@gmail.com |
30885f8ed246cd529e291165c42a356d5571e854 | 37acbfd1f0fa0f50ab76f0d3e5e2a4d608e4a60a | /src/main/java/ru/sbt/test/refactoring/battlefield/Battlefield.java | b95c43e56bdbbf990a8cab8fc6eaa522e08eeb58 | [] | no_license | swatronik/SynergyTeamTest | b186ecfea89057817b08fe8b9c487d05c9493ea8 | 24cf50f9bb2aa214ebd49bbe2fddd64686876642 | refs/heads/main | 2023-05-13T09:39:49.812208 | 2021-06-02T20:04:46 | 2021-06-02T20:04:46 | 373,199,692 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,348 | java | package ru.sbt.test.refactoring.battlefield;
import ru.sbt.test.refactoring.exception.ExceptionCommand;
import ru.sbt.test.refactoring.unit.Unit;
public class Battlefield {
private final int X;
private final int Y;
private final Unit[][] map;
public Battlefield(int X, int Y) {
this.X = X;
this.Y = Y;
this.map = new Unit[X][Y];
}
public Boolean isCellEmpty(Coordinates coordinates) {
return map[coordinates.getX()][coordinates.getY()] == null;
}
public Boolean isCoordinateValid(Coordinates coordinates) {
return (coordinates.getX() < X && coordinates.getY() < Y) && (coordinates.getX() >= 0 && coordinates.getY() >= 0);
}
public void move(Coordinates oldCoordinates, Coordinates newCoordinates) {
if (isCoordinateValid(newCoordinates) && isCellEmpty(newCoordinates)) {
map[newCoordinates.getX()][newCoordinates.getY()] = map[oldCoordinates.getX()][oldCoordinates.getY()];
map[oldCoordinates.getX()][oldCoordinates.getY()] = null;
} else {
throw new ExceptionCommand();
}
}
public void placeUnit(Unit unit, Coordinates coordinates) {
if (isCellEmpty(coordinates) && isCoordinateValid(coordinates)) {
map[coordinates.getX()][coordinates.getY()] = unit;
}
}
}
| [
"d.polyakov@infomaximum.com"
] | d.polyakov@infomaximum.com |
fc2ff2bddb52f2280003ebbfe9409dd4e94ccb85 | 0974c54364c851e7b3f10c9d1d7999485eb8845c | /content/content/src/test/java/com/weirdduke/blogpad/posts/control/TitleNormalizerTest.java | 2fbc2546cad91051dca13eecf8de22469c3dbec5 | [] | no_license | florendg/blogpad-service | f563b458161cd3092cb20d9de24bbd3bbbf190b1 | 7e91ab6bfb6eb445f1d8cb3f69a36fd92a844d7f | refs/heads/master | 2023-01-07T10:55:09.188878 | 2020-11-16T06:30:16 | 2020-11-16T06:30:16 | 281,198,218 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 674 | java | package com.weirdduke.blogpad.posts.control;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
class TitleNormalizerTest {
private TitleNormalizer cut;
public static TitleNormalizer create() {
var test = new TitleNormalizerTest();
test.init();
return test.cut;
}
@BeforeEach
void init() {
cut = new TitleNormalizer();
cut.titleSeparator = "-";
cut.init();
}
@Test
void replaceInvalidCharacter() {
String input = "Hello%World";
assertEquals("Hello-World",cut.normalize(input));
}
} | [
"florendg@gmail.com"
] | florendg@gmail.com |
da05d6ec5843fde7508a2c22566c55facf29dec5 | 847d20d7ae13aa1f06980532796dce3b7e752a03 | /proyecto-final/src/main/java/com/springboot/controller/UsuarioController.java | 5f08d0b559eddbebfa0b5e7455e5aae1a6b2af6c | [] | no_license | claveroJuan/Crud-Spring-boot | 09f0f4a8e5c903307765a26fe1367d78b37da4a8 | 006094afdd052edef7437417052bc9eb5c3959a0 | refs/heads/master | 2021-06-29T17:18:25.741212 | 2020-02-28T14:26:41 | 2020-02-28T14:26:41 | 159,545,345 | 0 | 0 | null | 2020-10-13T19:55:52 | 2018-11-28T18:16:10 | Java | UTF-8 | Java | false | false | 3,930 | java | package com.springboot.controller;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.springboot.exception.ModeloNotFoundException;
import com.springboot.model.Usuario;
import com.springboot.service.impl.UsuarioServiceImpl;
@CrossOrigin(origins = { "http://localhost:4200" }) // se especifica el dominio, en este caso para la transferencia y
// envío de datos al puerto de angular, es un arreglo
@RestController
@RequestMapping("/usuario")
public class UsuarioController {
@Autowired
private UsuarioServiceImpl service;
@GetMapping
public ResponseEntity<List<Usuario>> listar(){
List<Usuario> lista = service.listar();
return new ResponseEntity<List<Usuario>>(lista, HttpStatus.OK);
}
@GetMapping("/{id}")
public ResponseEntity<Usuario> listarPorId(@PathVariable("id") Integer id){
Usuario obj = service.leerPorId(id);
if(obj.getIdUsuario() == null) {
throw new ModeloNotFoundException("ID NO ENCONTRADO " + id);
}
return new ResponseEntity<Usuario>(obj, HttpStatus.OK);
}
@GetMapping("/buscar/{username}")
public ResponseEntity<Usuario> listarPorUsername(@PathVariable("username") String username){
Usuario obj = service.findByUsername(username);
if(obj.getIdUsuario() == null) {
throw new ModeloNotFoundException("ID NO ENCONTRADO " + username);
}
return new ResponseEntity<Usuario>(obj, HttpStatus.OK);
}
@PostMapping
public ResponseEntity<?> registrar(@Valid @RequestBody Usuario usuario, BindingResult result) {
Usuario usuarioeNew = null;
Map<String, Object> response = new HashMap<>();
if(result.hasErrors()) {
List<String> errors = result.getFieldErrors()
.stream()
.map(err -> "El campo '" + err.getField() +"' "+ err.getDefaultMessage())
.collect(Collectors.toList());
response.put("errors", errors);
return new ResponseEntity<Map<String, Object>>(response, HttpStatus.BAD_REQUEST);
}
try {
usuarioeNew = service.registrar(usuario);
} catch(DataAccessException e) {
response.put("mensaje", "Error al realizar el insert en la base de datos");
response.put("error", e.getMessage().concat(": ").concat(e.getMostSpecificCause().getMessage()));
return new ResponseEntity<Map<String, Object>>(response, HttpStatus.INTERNAL_SERVER_ERROR);
}
response.put("mensaje", "El usuario ha sido creado con éxito!");
response.put("usuario", usuarioeNew);
return new ResponseEntity<Map<String, Object>>(response, HttpStatus.CREATED);
}
@PutMapping
public ResponseEntity<Usuario> modificar(@Valid @RequestBody Usuario usuario) {
Usuario obj = service.modificar(usuario);
return new ResponseEntity<Usuario>(obj, HttpStatus.OK);
}
@DeleteMapping("/{id}")
public ResponseEntity<Object> eliminar(@PathVariable("id") Integer id){
Usuario obj = service.leerPorId(id);
if(obj.getIdUsuario() == null) {
throw new ModeloNotFoundException("ID NO ENCONTRADO " + id);
}
service.eliminar(id);
return new ResponseEntity<Object>("usuario eliminado",HttpStatus.OK);
}
}
| [
"clavero.deoliveirar@gmail.com"
] | clavero.deoliveirar@gmail.com |
cdee2995eb542acff2d3553d3e55c8bfc94dc55d | 93d43e75cb6675d5434447b8aad7b98e78eb9557 | /src/dx_ball/DX_Ball.java | 1cd354751a14fe32b26f5674c3ecdc99a814bdd0 | [] | no_license | SaqlainAveiro/Arena | bbcb75eb91a17d6184760ca975736b8750a0f4f7 | 88e750f58878b1e9bf8487e74471f3f916ccd96b | refs/heads/master | 2023-03-18T20:24:27.821915 | 2020-03-22T00:07:34 | 2020-03-22T00:09:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 189 | java | package dx_ball;
import java.io.IOException;
import javax.swing.JFrame;
public class DX_Ball
{
public static void main(String[] args) throws IOException
{
}
}
| [
"abdulazizfahim98@gmail.com"
] | abdulazizfahim98@gmail.com |
bd98e08d06615856b6e0408b95842fcb97b323e4 | 40057a5fbfac9ec11979c36f6ab838afe460271d | /parent/sp-service-hystrix8001/src/main/java/com/lt/gzj/sp/service/hystrix8001/SpServiceHystrix8001Application.java | c63f58b0cccc18a17b74e01582311ed6ff3959c2 | [] | no_license | lufizz/springcloud-study0813 | 82ef8b63fc83e72ca3d461797ab204a605d21fb5 | f21909d194addc77c048d9d6ac8c235b01fa7bbd | refs/heads/master | 2022-12-06T04:31:57.431689 | 2020-08-27T06:58:29 | 2020-08-27T06:58:29 | 287,196,086 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,547 | java | package com.lt.gzj.sp.service.hystrix8001;
import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.Bean;
@SpringBootApplication
@EnableDiscoveryClient
@EnableCircuitBreaker
public class SpServiceHystrix8001Application {
public static void main(String[] args) {
SpringApplication.run(SpServiceHystrix8001Application.class, args);
}
/**
* 此配置是为了服务监控而配置,与服务容错本身无观,springCloud 升级之后的坑
* ServletRegistrationBean因为springboot的默认路径不是/hystrix.stream
* 只要在自己的项目中配置上下面的servlet即可
*
* @return
*/
@Bean
public ServletRegistrationBean getServlet() {
HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();
ServletRegistrationBean<HystrixMetricsStreamServlet> registrationBean = new ServletRegistrationBean<>(streamServlet);
registrationBean.setLoadOnStartup(1);
registrationBean.addUrlMappings("/hystrix.stream");
registrationBean.setName("HystrixMetricsStreamServlet");
return registrationBean;
}
}
| [
"weconex6666"
] | weconex6666 |
5bf0a8970f366dad04a3e14b7d5afac36052e13a | c41ca4f89517cab208c683e11d1b6223a2228760 | /student/src/cn/dao/ProDao.java | dbdcc5ddab3ada6ada283a95e2e5e2dcce7f9909 | [] | no_license | hqy208cn/LocalGit | 7f5ba6c498eceabeacb5858eabfbe18d8efe6dc7 | c422e10ccd8aee5ab5c577e9f8c9acd6817489d3 | refs/heads/master | 2022-12-22T17:26:28.346083 | 2019-11-22T08:42:43 | 2019-11-22T08:42:43 | 223,349,229 | 0 | 0 | null | 2022-12-16T03:32:18 | 2019-11-22T07:37:06 | Java | UTF-8 | Java | false | false | 221 | java | package cn.dao;
import java.sql.ResultSet;
import java.util.List;
import cn.entity.Project;
import cn.entity.User;
public interface ProDao {
public Project getPro(String proname);
public ResultSet selectAllPro();
}
| [
"690560218@qq.com"
] | 690560218@qq.com |
5a63a018795c886bbddb8197b88edddd9a0b6d1b | 6252c165657baa6aa605337ebc38dd44b3f694e2 | /org.eclipse.epsilon.egl.sync/Scalability-Tests/boiler-To-Generate-700-Files/boiler-To-Generate-700-Files/syncregions-700Files/TemperatureController259.java | e446ff82fe18d4682042ec2ee22d6e43a6974738 | [] | no_license | soha500/EglSync | 00fc49bcc73f7f7f7fb7641d0561ca2b9a8ea638 | 55101bc781349bb14fefc178bf3486e2b778aed6 | refs/heads/master | 2021-06-23T02:55:13.464889 | 2020-12-11T19:10:01 | 2020-12-11T19:10:01 | 139,832,721 | 0 | 1 | null | 2019-05-31T11:34:02 | 2018-07-05T10:20:00 | Java | UTF-8 | Java | false | false | 370 | java | package syncregions;
public class TemperatureController259 {
public execute(int temperature259, int targetTemperature259) {
//sync _bfpnFUbFEeqXnfGWlV2259, behaviour
LastTestif(temperatureDifference > 0 && boilerStatus == true) { return 1; } else if (temperatureDifference < 0 && boilerStatus == false) { return 2; } else return 0;
//endSync
}
}
| [
"sultanalmutairi@172.20.10.2"
] | sultanalmutairi@172.20.10.2 |
19f0dce22ded4c66648d833384640d971eee93f6 | 2d7136c8984fbcae92217d8607a981ff97170e19 | /src/answer/BSTIterator.java | 70adf108b66f6372d1e8b30d23b530df013c5d22 | [] | no_license | qunnn41/leetcode | f1f8dc8812a7ad3b4018b2b11ffa0923bf70b4b4 | 70c3919a05acd1bad52720fe1aac9ffeb316eee0 | refs/heads/master | 2021-01-19T03:13:34.145886 | 2016-10-13T11:17:11 | 2016-10-13T11:17:11 | 35,317,124 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 875 | java | package answer;
import java.util.Stack;
import auxiliary.TreeNode;
public class BSTIterator {
/**
* https://leetcode.com/problems/binary-search-tree-iterator/
*/
Stack<TreeNode> stack = new Stack<TreeNode>();
public BSTIterator(TreeNode root) {
TreeNode node = root;
while (node != null) {
stack.push(node);
if (node.left != null)
node = node.left;
else
break;
}
}
/** @return whether we have a next smallest number */
public boolean hasNext() {
return !stack.isEmpty();
}
/** @return the next smallest number */
public int next() {
TreeNode node = stack.pop();
if (node.right != null) {
TreeNode cur = node.right;
while (cur != null) {
stack.push(cur);
if (cur.left != null)
cur = cur.left;
else
break;
}
}
return node.val;
}
}
| [
"wyqun_work@163.com"
] | wyqun_work@163.com |
10df306d4524cdf6aca5c83f2f47ef5f6264d954 | a88404e860f9e81f175d80c51b8e735fa499c93c | /hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/model/codesystems/IHEFormatcodeCs.java | d0831a01f41d84648551f62443b527cdcd4b5ac2 | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | sabri0/hapi-fhir | 4a53409d31b7f40afe088aa0ee8b946860b8372d | c7798fee4880ee8ffc9ed2e42c29c3b8f6753a1c | refs/heads/master | 2020-06-07T20:02:33.258075 | 2019-06-18T09:40:00 | 2019-06-18T09:40:00 | 193,081,738 | 2 | 0 | Apache-2.0 | 2019-06-21T10:46:17 | 2019-06-21T10:46:17 | null | UTF-8 | Java | false | false | 34,976 | java | package org.hl7.fhir.r4.model.codesystems;
/*
Copyright (c) 2011+, HL7, Inc.
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 HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
// Generated on Thu, Dec 27, 2018 10:06-0500 for FHIR v4.0.0
import org.hl7.fhir.exceptions.FHIRException;
public enum IHEFormatcodeCs {
/**
* null
*/
URN_IHE_PCC_XPHR_2007,
/**
* null
*/
URN_IHE_PCC_APS_2007,
/**
* null
*/
URN_IHE_PCC_XDSMS_2007,
/**
* null
*/
URN_IHE_PCC_EDR_2007,
/**
* null
*/
URN_IHE_PCC_EDES_2007,
/**
* null
*/
URN_IHE_PCC_APR_HANDP_2008,
/**
* null
*/
URN_IHE_PCC_APR_LAB_2008,
/**
* null
*/
URN_IHE_PCC_APR_EDU_2008,
/**
* null
*/
URN_IHE_PCC_CRC_2008,
/**
* null
*/
URN_IHE_PCC_CM_2008,
/**
* null
*/
URN_IHE_PCC_IC_2008,
/**
* null
*/
URN_IHE_PCC_TN_2007,
/**
* null
*/
URN_IHE_PCC_NN_2007,
/**
* null
*/
URN_IHE_PCC_CTN_2007,
/**
* null
*/
URN_IHE_PCC_EDPN_2007,
/**
* null
*/
URN_IHE_PCC_HP_2008,
/**
* null
*/
URN_IHE_PCC_LDHP_2009,
/**
* null
*/
URN_IHE_PCC_LDS_2009,
/**
* null
*/
URN_IHE_PCC_MDS_2009,
/**
* null
*/
URN_IHE_PCC_NDS_2010,
/**
* null
*/
URN_IHE_PCC_PPVS_2010,
/**
* null
*/
URN_IHE_PCC_TRS_2011,
/**
* null
*/
URN_IHE_PCC_ETS_2011,
/**
* null
*/
URN_IHE_PCC_ITS_2011,
/**
* null
*/
URN_IHE_PCC_RIPT_2017,
/**
* null
*/
URN_IHE_ITI_BPPC_2007,
/**
* null
*/
URN_IHE_ITI_BPPCSD_2007,
/**
* null
*/
URN_IHE_ITI_XDSSD_PDF_2008,
/**
* null
*/
URN_IHE_ITI_XDSSD_TEXT_2008,
/**
* null
*/
URN_IHE_ITI_XDW_2011_WORKFLOWDOC,
/**
* null
*/
URN_IHE_ITI_DSG_DETACHED_2014,
/**
* null
*/
URN_IHE_ITI_DSG_ENVELOPING_2014,
/**
* null
*/
URN_IHE_ITI_APPC_2016_CONSENT,
/**
* Code to be used when the mimeType is sufficient to understanding the technical format. May be used when no more specific FormatCode is available and the mimeType is sufficient to identify the technical format
*/
URN_IHE_ITI_XDS_2017_MIMETYPESUFFICIENT,
/**
* null
*/
URN_IHE_LAB_XDLAB_2008,
/**
* null
*/
URN_IHE_RAD_TEXT,
/**
* null
*/
URN_IHE_RAD_PDF,
/**
* null
*/
URN_IHE_RAD_CDA_IMAGINGREPORTSTRUCTUREDHEADINGS_2013,
/**
* null
*/
URN_IHE_CARD_IMAGING_2011,
/**
* null
*/
URN_IHE_CARD_CRC_2012,
/**
* null
*/
URN_IHE_CARD_EPRCIE_2014,
/**
* null
*/
URN_IHE_DENT_TEXT,
/**
* null
*/
URN_IHE_DENT_PDF,
/**
* null
*/
URN_IHE_DENT_CDA_IMAGINGREPORTSTRUCTUREDHEADINGS_2013,
/**
* null
*/
URN_IHE_PAT_APSR_ALL_2010,
/**
* null
*/
URN_IHE_PAT_APSR_CANCER_ALL_2010,
/**
* null
*/
URN_IHE_PAT_APSR_CANCER_BREAST_2010,
/**
* null
*/
URN_IHE_PAT_APSR_CANCER_COLON_2010,
/**
* null
*/
URN_IHE_PAT_APSR_CANCER_PROSTATE_2010,
/**
* null
*/
URN_IHE_PAT_APSR_CANCER_THYROID_2010,
/**
* null
*/
URN_IHE_PAT_APSR_CANCER_LUNG_2010,
/**
* null
*/
URN_IHE_PAT_APSR_CANCER_SKIN_2010,
/**
* null
*/
URN_IHE_PAT_APSR_CANCER_KIDNEY_2010,
/**
* null
*/
URN_IHE_PAT_APSR_CANCER_CERVIX_2010,
/**
* null
*/
URN_IHE_PAT_APSR_CANCER_ENDOMETRIUM_2010,
/**
* null
*/
URN_IHE_PAT_APSR_CANCER_OVARY_2010,
/**
* null
*/
URN_IHE_PAT_APSR_CANCER_ESOPHAGUS_2010,
/**
* null
*/
URN_IHE_PAT_APSR_CANCER_STOMACH_2010,
/**
* null
*/
URN_IHE_PAT_APSR_CANCER_LIVER_2010,
/**
* null
*/
URN_IHE_PAT_APSR_CANCER_PANCREAS_2010,
/**
* null
*/
URN_IHE_PAT_APSR_CANCER_TESTIS_2010,
/**
* null
*/
URN_IHE_PAT_APSR_CANCER_URINARYBLADDER_2010,
/**
* null
*/
URN_IHE_PAT_APSR_CANCER_LIPORALCAVITY_2010,
/**
* null
*/
URN_IHE_PAT_APSR_CANCER_PHARYNX_2010,
/**
* null
*/
URN_IHE_PAT_APSR_CANCER_SALIVARYGLAND_2010,
/**
* null
*/
URN_IHE_PAT_APSR_CANCER_LARYNX_2010,
/**
* null
*/
URN_IHE_PHARM_PRE_2010,
/**
* null
*/
URN_IHE_PHARM_PADV_2010,
/**
* null
*/
URN_IHE_PHARM_DIS_2010,
/**
* null
*/
URN_IHE_PHARM_PML_2013,
/**
* null
*/
URN_HL7ORG_SDWG_CCDASTRUCTUREDBODY_1_1,
/**
* null
*/
URN_HL7ORG_SDWG_CCDANONXMLBODY_1_1,
/**
* null
*/
URN_HL7ORG_SDWG_CCDASTRUCTUREDBODY_2_1,
/**
* null
*/
URN_HL7ORG_SDWG_CCDANONXMLBODY_2_1,
/**
* added to help the parsers
*/
NULL;
public static IHEFormatcodeCs fromCode(String codeString) throws FHIRException {
if (codeString == null || "".equals(codeString))
return null;
if ("urn:ihe:pcc:xphr:2007".equals(codeString))
return URN_IHE_PCC_XPHR_2007;
if ("urn:ihe:pcc:aps:2007".equals(codeString))
return URN_IHE_PCC_APS_2007;
if ("urn:ihe:pcc:xds-ms:2007".equals(codeString))
return URN_IHE_PCC_XDSMS_2007;
if ("urn:ihe:pcc:edr:2007".equals(codeString))
return URN_IHE_PCC_EDR_2007;
if ("urn:ihe:pcc:edes:2007".equals(codeString))
return URN_IHE_PCC_EDES_2007;
if ("urn:ihe:pcc:apr:handp:2008".equals(codeString))
return URN_IHE_PCC_APR_HANDP_2008;
if ("urn:ihe:pcc:apr:lab:2008".equals(codeString))
return URN_IHE_PCC_APR_LAB_2008;
if ("urn:ihe:pcc:apr:edu:2008".equals(codeString))
return URN_IHE_PCC_APR_EDU_2008;
if ("urn:ihe:pcc:crc:2008".equals(codeString))
return URN_IHE_PCC_CRC_2008;
if ("urn:ihe:pcc:cm:2008".equals(codeString))
return URN_IHE_PCC_CM_2008;
if ("urn:ihe:pcc:ic:2008".equals(codeString))
return URN_IHE_PCC_IC_2008;
if ("urn:ihe:pcc:tn:2007".equals(codeString))
return URN_IHE_PCC_TN_2007;
if ("urn:ihe:pcc:nn:2007".equals(codeString))
return URN_IHE_PCC_NN_2007;
if ("urn:ihe:pcc:ctn:2007".equals(codeString))
return URN_IHE_PCC_CTN_2007;
if ("urn:ihe:pcc:edpn:2007".equals(codeString))
return URN_IHE_PCC_EDPN_2007;
if ("urn:ihe:pcc:hp:2008".equals(codeString))
return URN_IHE_PCC_HP_2008;
if ("urn:ihe:pcc:ldhp:2009".equals(codeString))
return URN_IHE_PCC_LDHP_2009;
if ("urn:ihe:pcc:lds:2009".equals(codeString))
return URN_IHE_PCC_LDS_2009;
if ("urn:ihe:pcc:mds:2009".equals(codeString))
return URN_IHE_PCC_MDS_2009;
if ("urn:ihe:pcc:nds:2010".equals(codeString))
return URN_IHE_PCC_NDS_2010;
if ("urn:ihe:pcc:ppvs:2010".equals(codeString))
return URN_IHE_PCC_PPVS_2010;
if ("urn:ihe:pcc:trs:2011".equals(codeString))
return URN_IHE_PCC_TRS_2011;
if ("urn:ihe:pcc:ets:2011".equals(codeString))
return URN_IHE_PCC_ETS_2011;
if ("urn:ihe:pcc:its:2011".equals(codeString))
return URN_IHE_PCC_ITS_2011;
if ("urn:ihe:pcc:ript:2017".equals(codeString))
return URN_IHE_PCC_RIPT_2017;
if ("urn:ihe:iti:bppc:2007".equals(codeString))
return URN_IHE_ITI_BPPC_2007;
if ("urn:ihe:iti:bppc-sd:2007".equals(codeString))
return URN_IHE_ITI_BPPCSD_2007;
if ("urn:ihe:iti:xds-sd:pdf:2008".equals(codeString))
return URN_IHE_ITI_XDSSD_PDF_2008;
if ("urn:ihe:iti:xds-sd:text:2008".equals(codeString))
return URN_IHE_ITI_XDSSD_TEXT_2008;
if ("urn:ihe:iti:xdw:2011:workflowDoc".equals(codeString))
return URN_IHE_ITI_XDW_2011_WORKFLOWDOC;
if ("urn:ihe:iti:dsg:detached:2014".equals(codeString))
return URN_IHE_ITI_DSG_DETACHED_2014;
if ("urn:ihe:iti:dsg:enveloping:2014".equals(codeString))
return URN_IHE_ITI_DSG_ENVELOPING_2014;
if ("urn:ihe:iti:appc:2016:consent".equals(codeString))
return URN_IHE_ITI_APPC_2016_CONSENT;
if ("urn:ihe:iti:xds:2017:mimeTypeSufficient".equals(codeString))
return URN_IHE_ITI_XDS_2017_MIMETYPESUFFICIENT;
if ("urn:ihe:lab:xd-lab:2008".equals(codeString))
return URN_IHE_LAB_XDLAB_2008;
if ("urn:ihe:rad:TEXT".equals(codeString))
return URN_IHE_RAD_TEXT;
if ("urn:ihe:rad:PDF".equals(codeString))
return URN_IHE_RAD_PDF;
if ("urn:ihe:rad:CDA:ImagingReportStructuredHeadings:2013".equals(codeString))
return URN_IHE_RAD_CDA_IMAGINGREPORTSTRUCTUREDHEADINGS_2013;
if ("urn:ihe:card:imaging:2011".equals(codeString))
return URN_IHE_CARD_IMAGING_2011;
if ("urn:ihe:card:CRC:2012".equals(codeString))
return URN_IHE_CARD_CRC_2012;
if ("urn:ihe:card:EPRC-IE:2014".equals(codeString))
return URN_IHE_CARD_EPRCIE_2014;
if ("urn:ihe:dent:TEXT".equals(codeString))
return URN_IHE_DENT_TEXT;
if ("urn:ihe:dent:PDF".equals(codeString))
return URN_IHE_DENT_PDF;
if ("urn:ihe:dent:CDA:ImagingReportStructuredHeadings:2013".equals(codeString))
return URN_IHE_DENT_CDA_IMAGINGREPORTSTRUCTUREDHEADINGS_2013;
if ("urn:ihe:pat:apsr:all:2010".equals(codeString))
return URN_IHE_PAT_APSR_ALL_2010;
if ("urn:ihe:pat:apsr:cancer:all:2010".equals(codeString))
return URN_IHE_PAT_APSR_CANCER_ALL_2010;
if ("urn:ihe:pat:apsr:cancer:breast:2010".equals(codeString))
return URN_IHE_PAT_APSR_CANCER_BREAST_2010;
if ("urn:ihe:pat:apsr:cancer:colon:2010".equals(codeString))
return URN_IHE_PAT_APSR_CANCER_COLON_2010;
if ("urn:ihe:pat:apsr:cancer:prostate:2010".equals(codeString))
return URN_IHE_PAT_APSR_CANCER_PROSTATE_2010;
if ("urn:ihe:pat:apsr:cancer:thyroid:2010".equals(codeString))
return URN_IHE_PAT_APSR_CANCER_THYROID_2010;
if ("urn:ihe:pat:apsr:cancer:lung:2010".equals(codeString))
return URN_IHE_PAT_APSR_CANCER_LUNG_2010;
if ("urn:ihe:pat:apsr:cancer:skin:2010".equals(codeString))
return URN_IHE_PAT_APSR_CANCER_SKIN_2010;
if ("urn:ihe:pat:apsr:cancer:kidney:2010".equals(codeString))
return URN_IHE_PAT_APSR_CANCER_KIDNEY_2010;
if ("urn:ihe:pat:apsr:cancer:cervix:2010".equals(codeString))
return URN_IHE_PAT_APSR_CANCER_CERVIX_2010;
if ("urn:ihe:pat:apsr:cancer:endometrium:2010".equals(codeString))
return URN_IHE_PAT_APSR_CANCER_ENDOMETRIUM_2010;
if ("urn:ihe:pat:apsr:cancer:ovary:2010".equals(codeString))
return URN_IHE_PAT_APSR_CANCER_OVARY_2010;
if ("urn:ihe:pat:apsr:cancer:esophagus:2010".equals(codeString))
return URN_IHE_PAT_APSR_CANCER_ESOPHAGUS_2010;
if ("urn:ihe:pat:apsr:cancer:stomach:2010".equals(codeString))
return URN_IHE_PAT_APSR_CANCER_STOMACH_2010;
if ("urn:ihe:pat:apsr:cancer:liver:2010".equals(codeString))
return URN_IHE_PAT_APSR_CANCER_LIVER_2010;
if ("urn:ihe:pat:apsr:cancer:pancreas:2010".equals(codeString))
return URN_IHE_PAT_APSR_CANCER_PANCREAS_2010;
if ("urn:ihe:pat:apsr:cancer:testis:2010".equals(codeString))
return URN_IHE_PAT_APSR_CANCER_TESTIS_2010;
if ("urn:ihe:pat:apsr:cancer:urinary_bladder:2010".equals(codeString))
return URN_IHE_PAT_APSR_CANCER_URINARYBLADDER_2010;
if ("urn:ihe:pat:apsr:cancer:lip_oral_cavity:2010".equals(codeString))
return URN_IHE_PAT_APSR_CANCER_LIPORALCAVITY_2010;
if ("urn:ihe:pat:apsr:cancer:pharynx:2010".equals(codeString))
return URN_IHE_PAT_APSR_CANCER_PHARYNX_2010;
if ("urn:ihe:pat:apsr:cancer:salivary_gland:2010".equals(codeString))
return URN_IHE_PAT_APSR_CANCER_SALIVARYGLAND_2010;
if ("urn:ihe:pat:apsr:cancer:larynx:2010".equals(codeString))
return URN_IHE_PAT_APSR_CANCER_LARYNX_2010;
if ("urn:ihe:pharm:pre:2010".equals(codeString))
return URN_IHE_PHARM_PRE_2010;
if ("urn:ihe:pharm:padv:2010".equals(codeString))
return URN_IHE_PHARM_PADV_2010;
if ("urn:ihe:pharm:dis:2010".equals(codeString))
return URN_IHE_PHARM_DIS_2010;
if ("urn:ihe:pharm:pml:2013".equals(codeString))
return URN_IHE_PHARM_PML_2013;
if ("urn:hl7-org:sdwg:ccda-structuredBody:1.1".equals(codeString))
return URN_HL7ORG_SDWG_CCDASTRUCTUREDBODY_1_1;
if ("urn:hl7-org:sdwg:ccda-nonXMLBody:1.1".equals(codeString))
return URN_HL7ORG_SDWG_CCDANONXMLBODY_1_1;
if ("urn:hl7-org:sdwg:ccda-structuredBody:2.1".equals(codeString))
return URN_HL7ORG_SDWG_CCDASTRUCTUREDBODY_2_1;
if ("urn:hl7-org:sdwg:ccda-nonXMLBody:2.1".equals(codeString))
return URN_HL7ORG_SDWG_CCDANONXMLBODY_2_1;
throw new FHIRException("Unknown IHEFormatcodeCs code '"+codeString+"'");
}
public String toCode() {
switch (this) {
case URN_IHE_PCC_XPHR_2007: return "urn:ihe:pcc:xphr:2007";
case URN_IHE_PCC_APS_2007: return "urn:ihe:pcc:aps:2007";
case URN_IHE_PCC_XDSMS_2007: return "urn:ihe:pcc:xds-ms:2007";
case URN_IHE_PCC_EDR_2007: return "urn:ihe:pcc:edr:2007";
case URN_IHE_PCC_EDES_2007: return "urn:ihe:pcc:edes:2007";
case URN_IHE_PCC_APR_HANDP_2008: return "urn:ihe:pcc:apr:handp:2008";
case URN_IHE_PCC_APR_LAB_2008: return "urn:ihe:pcc:apr:lab:2008";
case URN_IHE_PCC_APR_EDU_2008: return "urn:ihe:pcc:apr:edu:2008";
case URN_IHE_PCC_CRC_2008: return "urn:ihe:pcc:crc:2008";
case URN_IHE_PCC_CM_2008: return "urn:ihe:pcc:cm:2008";
case URN_IHE_PCC_IC_2008: return "urn:ihe:pcc:ic:2008";
case URN_IHE_PCC_TN_2007: return "urn:ihe:pcc:tn:2007";
case URN_IHE_PCC_NN_2007: return "urn:ihe:pcc:nn:2007";
case URN_IHE_PCC_CTN_2007: return "urn:ihe:pcc:ctn:2007";
case URN_IHE_PCC_EDPN_2007: return "urn:ihe:pcc:edpn:2007";
case URN_IHE_PCC_HP_2008: return "urn:ihe:pcc:hp:2008";
case URN_IHE_PCC_LDHP_2009: return "urn:ihe:pcc:ldhp:2009";
case URN_IHE_PCC_LDS_2009: return "urn:ihe:pcc:lds:2009";
case URN_IHE_PCC_MDS_2009: return "urn:ihe:pcc:mds:2009";
case URN_IHE_PCC_NDS_2010: return "urn:ihe:pcc:nds:2010";
case URN_IHE_PCC_PPVS_2010: return "urn:ihe:pcc:ppvs:2010";
case URN_IHE_PCC_TRS_2011: return "urn:ihe:pcc:trs:2011";
case URN_IHE_PCC_ETS_2011: return "urn:ihe:pcc:ets:2011";
case URN_IHE_PCC_ITS_2011: return "urn:ihe:pcc:its:2011";
case URN_IHE_PCC_RIPT_2017: return "urn:ihe:pcc:ript:2017";
case URN_IHE_ITI_BPPC_2007: return "urn:ihe:iti:bppc:2007";
case URN_IHE_ITI_BPPCSD_2007: return "urn:ihe:iti:bppc-sd:2007";
case URN_IHE_ITI_XDSSD_PDF_2008: return "urn:ihe:iti:xds-sd:pdf:2008";
case URN_IHE_ITI_XDSSD_TEXT_2008: return "urn:ihe:iti:xds-sd:text:2008";
case URN_IHE_ITI_XDW_2011_WORKFLOWDOC: return "urn:ihe:iti:xdw:2011:workflowDoc";
case URN_IHE_ITI_DSG_DETACHED_2014: return "urn:ihe:iti:dsg:detached:2014";
case URN_IHE_ITI_DSG_ENVELOPING_2014: return "urn:ihe:iti:dsg:enveloping:2014";
case URN_IHE_ITI_APPC_2016_CONSENT: return "urn:ihe:iti:appc:2016:consent";
case URN_IHE_ITI_XDS_2017_MIMETYPESUFFICIENT: return "urn:ihe:iti:xds:2017:mimeTypeSufficient";
case URN_IHE_LAB_XDLAB_2008: return "urn:ihe:lab:xd-lab:2008";
case URN_IHE_RAD_TEXT: return "urn:ihe:rad:TEXT";
case URN_IHE_RAD_PDF: return "urn:ihe:rad:PDF";
case URN_IHE_RAD_CDA_IMAGINGREPORTSTRUCTUREDHEADINGS_2013: return "urn:ihe:rad:CDA:ImagingReportStructuredHeadings:2013";
case URN_IHE_CARD_IMAGING_2011: return "urn:ihe:card:imaging:2011";
case URN_IHE_CARD_CRC_2012: return "urn:ihe:card:CRC:2012";
case URN_IHE_CARD_EPRCIE_2014: return "urn:ihe:card:EPRC-IE:2014";
case URN_IHE_DENT_TEXT: return "urn:ihe:dent:TEXT";
case URN_IHE_DENT_PDF: return "urn:ihe:dent:PDF";
case URN_IHE_DENT_CDA_IMAGINGREPORTSTRUCTUREDHEADINGS_2013: return "urn:ihe:dent:CDA:ImagingReportStructuredHeadings:2013";
case URN_IHE_PAT_APSR_ALL_2010: return "urn:ihe:pat:apsr:all:2010";
case URN_IHE_PAT_APSR_CANCER_ALL_2010: return "urn:ihe:pat:apsr:cancer:all:2010";
case URN_IHE_PAT_APSR_CANCER_BREAST_2010: return "urn:ihe:pat:apsr:cancer:breast:2010";
case URN_IHE_PAT_APSR_CANCER_COLON_2010: return "urn:ihe:pat:apsr:cancer:colon:2010";
case URN_IHE_PAT_APSR_CANCER_PROSTATE_2010: return "urn:ihe:pat:apsr:cancer:prostate:2010";
case URN_IHE_PAT_APSR_CANCER_THYROID_2010: return "urn:ihe:pat:apsr:cancer:thyroid:2010";
case URN_IHE_PAT_APSR_CANCER_LUNG_2010: return "urn:ihe:pat:apsr:cancer:lung:2010";
case URN_IHE_PAT_APSR_CANCER_SKIN_2010: return "urn:ihe:pat:apsr:cancer:skin:2010";
case URN_IHE_PAT_APSR_CANCER_KIDNEY_2010: return "urn:ihe:pat:apsr:cancer:kidney:2010";
case URN_IHE_PAT_APSR_CANCER_CERVIX_2010: return "urn:ihe:pat:apsr:cancer:cervix:2010";
case URN_IHE_PAT_APSR_CANCER_ENDOMETRIUM_2010: return "urn:ihe:pat:apsr:cancer:endometrium:2010";
case URN_IHE_PAT_APSR_CANCER_OVARY_2010: return "urn:ihe:pat:apsr:cancer:ovary:2010";
case URN_IHE_PAT_APSR_CANCER_ESOPHAGUS_2010: return "urn:ihe:pat:apsr:cancer:esophagus:2010";
case URN_IHE_PAT_APSR_CANCER_STOMACH_2010: return "urn:ihe:pat:apsr:cancer:stomach:2010";
case URN_IHE_PAT_APSR_CANCER_LIVER_2010: return "urn:ihe:pat:apsr:cancer:liver:2010";
case URN_IHE_PAT_APSR_CANCER_PANCREAS_2010: return "urn:ihe:pat:apsr:cancer:pancreas:2010";
case URN_IHE_PAT_APSR_CANCER_TESTIS_2010: return "urn:ihe:pat:apsr:cancer:testis:2010";
case URN_IHE_PAT_APSR_CANCER_URINARYBLADDER_2010: return "urn:ihe:pat:apsr:cancer:urinary_bladder:2010";
case URN_IHE_PAT_APSR_CANCER_LIPORALCAVITY_2010: return "urn:ihe:pat:apsr:cancer:lip_oral_cavity:2010";
case URN_IHE_PAT_APSR_CANCER_PHARYNX_2010: return "urn:ihe:pat:apsr:cancer:pharynx:2010";
case URN_IHE_PAT_APSR_CANCER_SALIVARYGLAND_2010: return "urn:ihe:pat:apsr:cancer:salivary_gland:2010";
case URN_IHE_PAT_APSR_CANCER_LARYNX_2010: return "urn:ihe:pat:apsr:cancer:larynx:2010";
case URN_IHE_PHARM_PRE_2010: return "urn:ihe:pharm:pre:2010";
case URN_IHE_PHARM_PADV_2010: return "urn:ihe:pharm:padv:2010";
case URN_IHE_PHARM_DIS_2010: return "urn:ihe:pharm:dis:2010";
case URN_IHE_PHARM_PML_2013: return "urn:ihe:pharm:pml:2013";
case URN_HL7ORG_SDWG_CCDASTRUCTUREDBODY_1_1: return "urn:hl7-org:sdwg:ccda-structuredBody:1.1";
case URN_HL7ORG_SDWG_CCDANONXMLBODY_1_1: return "urn:hl7-org:sdwg:ccda-nonXMLBody:1.1";
case URN_HL7ORG_SDWG_CCDASTRUCTUREDBODY_2_1: return "urn:hl7-org:sdwg:ccda-structuredBody:2.1";
case URN_HL7ORG_SDWG_CCDANONXMLBODY_2_1: return "urn:hl7-org:sdwg:ccda-nonXMLBody:2.1";
default: return "?";
}
}
public String getSystem() {
return "http://ihe.net/fhir/ValueSet/IHE.FormatCode.codesystem";
}
public String getDefinition() {
switch (this) {
case URN_IHE_PCC_XPHR_2007: return "";
case URN_IHE_PCC_APS_2007: return "";
case URN_IHE_PCC_XDSMS_2007: return "";
case URN_IHE_PCC_EDR_2007: return "";
case URN_IHE_PCC_EDES_2007: return "";
case URN_IHE_PCC_APR_HANDP_2008: return "";
case URN_IHE_PCC_APR_LAB_2008: return "";
case URN_IHE_PCC_APR_EDU_2008: return "";
case URN_IHE_PCC_CRC_2008: return "";
case URN_IHE_PCC_CM_2008: return "";
case URN_IHE_PCC_IC_2008: return "";
case URN_IHE_PCC_TN_2007: return "";
case URN_IHE_PCC_NN_2007: return "";
case URN_IHE_PCC_CTN_2007: return "";
case URN_IHE_PCC_EDPN_2007: return "";
case URN_IHE_PCC_HP_2008: return "";
case URN_IHE_PCC_LDHP_2009: return "";
case URN_IHE_PCC_LDS_2009: return "";
case URN_IHE_PCC_MDS_2009: return "";
case URN_IHE_PCC_NDS_2010: return "";
case URN_IHE_PCC_PPVS_2010: return "";
case URN_IHE_PCC_TRS_2011: return "";
case URN_IHE_PCC_ETS_2011: return "";
case URN_IHE_PCC_ITS_2011: return "";
case URN_IHE_PCC_RIPT_2017: return "";
case URN_IHE_ITI_BPPC_2007: return "";
case URN_IHE_ITI_BPPCSD_2007: return "";
case URN_IHE_ITI_XDSSD_PDF_2008: return "";
case URN_IHE_ITI_XDSSD_TEXT_2008: return "";
case URN_IHE_ITI_XDW_2011_WORKFLOWDOC: return "";
case URN_IHE_ITI_DSG_DETACHED_2014: return "";
case URN_IHE_ITI_DSG_ENVELOPING_2014: return "";
case URN_IHE_ITI_APPC_2016_CONSENT: return "";
case URN_IHE_ITI_XDS_2017_MIMETYPESUFFICIENT: return "Code to be used when the mimeType is sufficient to understanding the technical format. May be used when no more specific FormatCode is available and the mimeType is sufficient to identify the technical format";
case URN_IHE_LAB_XDLAB_2008: return "";
case URN_IHE_RAD_TEXT: return "";
case URN_IHE_RAD_PDF: return "";
case URN_IHE_RAD_CDA_IMAGINGREPORTSTRUCTUREDHEADINGS_2013: return "";
case URN_IHE_CARD_IMAGING_2011: return "";
case URN_IHE_CARD_CRC_2012: return "";
case URN_IHE_CARD_EPRCIE_2014: return "";
case URN_IHE_DENT_TEXT: return "";
case URN_IHE_DENT_PDF: return "";
case URN_IHE_DENT_CDA_IMAGINGREPORTSTRUCTUREDHEADINGS_2013: return "";
case URN_IHE_PAT_APSR_ALL_2010: return "";
case URN_IHE_PAT_APSR_CANCER_ALL_2010: return "";
case URN_IHE_PAT_APSR_CANCER_BREAST_2010: return "";
case URN_IHE_PAT_APSR_CANCER_COLON_2010: return "";
case URN_IHE_PAT_APSR_CANCER_PROSTATE_2010: return "";
case URN_IHE_PAT_APSR_CANCER_THYROID_2010: return "";
case URN_IHE_PAT_APSR_CANCER_LUNG_2010: return "";
case URN_IHE_PAT_APSR_CANCER_SKIN_2010: return "";
case URN_IHE_PAT_APSR_CANCER_KIDNEY_2010: return "";
case URN_IHE_PAT_APSR_CANCER_CERVIX_2010: return "";
case URN_IHE_PAT_APSR_CANCER_ENDOMETRIUM_2010: return "";
case URN_IHE_PAT_APSR_CANCER_OVARY_2010: return "";
case URN_IHE_PAT_APSR_CANCER_ESOPHAGUS_2010: return "";
case URN_IHE_PAT_APSR_CANCER_STOMACH_2010: return "";
case URN_IHE_PAT_APSR_CANCER_LIVER_2010: return "";
case URN_IHE_PAT_APSR_CANCER_PANCREAS_2010: return "";
case URN_IHE_PAT_APSR_CANCER_TESTIS_2010: return "";
case URN_IHE_PAT_APSR_CANCER_URINARYBLADDER_2010: return "";
case URN_IHE_PAT_APSR_CANCER_LIPORALCAVITY_2010: return "";
case URN_IHE_PAT_APSR_CANCER_PHARYNX_2010: return "";
case URN_IHE_PAT_APSR_CANCER_SALIVARYGLAND_2010: return "";
case URN_IHE_PAT_APSR_CANCER_LARYNX_2010: return "";
case URN_IHE_PHARM_PRE_2010: return "";
case URN_IHE_PHARM_PADV_2010: return "";
case URN_IHE_PHARM_DIS_2010: return "";
case URN_IHE_PHARM_PML_2013: return "";
case URN_HL7ORG_SDWG_CCDASTRUCTUREDBODY_1_1: return "";
case URN_HL7ORG_SDWG_CCDANONXMLBODY_1_1: return "";
case URN_HL7ORG_SDWG_CCDASTRUCTUREDBODY_2_1: return "";
case URN_HL7ORG_SDWG_CCDANONXMLBODY_2_1: return "";
default: return "?";
}
}
public String getDisplay() {
switch (this) {
case URN_IHE_PCC_XPHR_2007: return "Personal Health Records. Also known as HL7 CCD and HITSP C32";
case URN_IHE_PCC_APS_2007: return "IHE Antepartum Summary";
case URN_IHE_PCC_XDSMS_2007: return "XDS Medical Summaries";
case URN_IHE_PCC_EDR_2007: return "Emergency Department Referral (EDR)";
case URN_IHE_PCC_EDES_2007: return "Emergency Department Encounter Summary (EDES)";
case URN_IHE_PCC_APR_HANDP_2008: return "Antepartum Record (APR) - History and Physical";
case URN_IHE_PCC_APR_LAB_2008: return "Antepartum Record (APR) - Laboratory";
case URN_IHE_PCC_APR_EDU_2008: return "Antepartum Record (APR) - Education";
case URN_IHE_PCC_CRC_2008: return "Cancer Registry Content (CRC)";
case URN_IHE_PCC_CM_2008: return "Care Management (CM)";
case URN_IHE_PCC_IC_2008: return "Immunization Content (IC)";
case URN_IHE_PCC_TN_2007: return "PCC TN";
case URN_IHE_PCC_NN_2007: return "PCC NN";
case URN_IHE_PCC_CTN_2007: return "PCC CTN";
case URN_IHE_PCC_EDPN_2007: return "PCC EDPN";
case URN_IHE_PCC_HP_2008: return "PCC HP";
case URN_IHE_PCC_LDHP_2009: return "PCC LDHP";
case URN_IHE_PCC_LDS_2009: return "PCC LDS";
case URN_IHE_PCC_MDS_2009: return "PCC MDS";
case URN_IHE_PCC_NDS_2010: return "PCC NDS";
case URN_IHE_PCC_PPVS_2010: return "PCC PPVS";
case URN_IHE_PCC_TRS_2011: return "PCC TRS";
case URN_IHE_PCC_ETS_2011: return "PCC ETS";
case URN_IHE_PCC_ITS_2011: return "PCC ITS";
case URN_IHE_PCC_RIPT_2017: return "Routine Interfacility Patient Transport (RIPT)";
case URN_IHE_ITI_BPPC_2007: return "Basic Patient Privacy Consents";
case URN_IHE_ITI_BPPCSD_2007: return "Basic Patient Privacy Consents with Scanned Document";
case URN_IHE_ITI_XDSSD_PDF_2008: return "PDF embedded in CDA per XDS-SD profile";
case URN_IHE_ITI_XDSSD_TEXT_2008: return "Text embedded in CDA per XDS-SD profile";
case URN_IHE_ITI_XDW_2011_WORKFLOWDOC: return "XDW Workflow Document";
case URN_IHE_ITI_DSG_DETACHED_2014: return "DSG Detached Document";
case URN_IHE_ITI_DSG_ENVELOPING_2014: return "DSG Enveloping Document";
case URN_IHE_ITI_APPC_2016_CONSENT: return "Advanced Patient Privacy Consents";
case URN_IHE_ITI_XDS_2017_MIMETYPESUFFICIENT: return "mimeType Sufficient";
case URN_IHE_LAB_XDLAB_2008: return "CDA Laboratory Report";
case URN_IHE_RAD_TEXT: return "Radiology XDS-I Text";
case URN_IHE_RAD_PDF: return "Radiology XDS-I PDF";
case URN_IHE_RAD_CDA_IMAGINGREPORTSTRUCTUREDHEADINGS_2013: return "Radiology XDS-I Structured CDA";
case URN_IHE_CARD_IMAGING_2011: return "Cardiac Imaging Report";
case URN_IHE_CARD_CRC_2012: return "Cardiology CRC";
case URN_IHE_CARD_EPRCIE_2014: return "Cardiology EPRC-IE";
case URN_IHE_DENT_TEXT: return "Dental Text";
case URN_IHE_DENT_PDF: return "Dental PDF";
case URN_IHE_DENT_CDA_IMAGINGREPORTSTRUCTUREDHEADINGS_2013: return "Dental CDA";
case URN_IHE_PAT_APSR_ALL_2010: return "Anatomic Pathology Structured Report All";
case URN_IHE_PAT_APSR_CANCER_ALL_2010: return "Anatomic Pathology Structured Report Cancer All";
case URN_IHE_PAT_APSR_CANCER_BREAST_2010: return "Anatomic Pathology Structured Report Cancer Breast";
case URN_IHE_PAT_APSR_CANCER_COLON_2010: return "Anatomic Pathology Structured Report Cancer Colon";
case URN_IHE_PAT_APSR_CANCER_PROSTATE_2010: return "Anatomic Pathology Structured Report Cancer Prostate";
case URN_IHE_PAT_APSR_CANCER_THYROID_2010: return "Anatomic Pathology Structured Report Cancer Thyroid";
case URN_IHE_PAT_APSR_CANCER_LUNG_2010: return "Anatomic Pathology Structured Report Cancer Lung";
case URN_IHE_PAT_APSR_CANCER_SKIN_2010: return "Anatomic Pathology Structured Report Cancer Skin";
case URN_IHE_PAT_APSR_CANCER_KIDNEY_2010: return "Anatomic Pathology Structured Report Cancer Kidney";
case URN_IHE_PAT_APSR_CANCER_CERVIX_2010: return "Anatomic Pathology Structured Report Cancer Cervix";
case URN_IHE_PAT_APSR_CANCER_ENDOMETRIUM_2010: return "Anatomic Pathology Structured Report Cancer Endometrium";
case URN_IHE_PAT_APSR_CANCER_OVARY_2010: return "Anatomic Pathology Structured Report Cancer Ovary";
case URN_IHE_PAT_APSR_CANCER_ESOPHAGUS_2010: return "Anatomic Pathology Structured Report Cancer Esophagus";
case URN_IHE_PAT_APSR_CANCER_STOMACH_2010: return "Anatomic Pathology Structured Report Cancer Stomach";
case URN_IHE_PAT_APSR_CANCER_LIVER_2010: return "Anatomic Pathology Structured Report Cancer Liver";
case URN_IHE_PAT_APSR_CANCER_PANCREAS_2010: return "Anatomic Pathology Structured Report Cancer Pancreas";
case URN_IHE_PAT_APSR_CANCER_TESTIS_2010: return "Anatomic Pathology Structured Report Cancer Testis";
case URN_IHE_PAT_APSR_CANCER_URINARYBLADDER_2010: return "Anatomic Pathology Structured Report Cancer Urinary Bladder";
case URN_IHE_PAT_APSR_CANCER_LIPORALCAVITY_2010: return "Anatomic Pathology Structured Report Cancer Lip Oral Cavity";
case URN_IHE_PAT_APSR_CANCER_PHARYNX_2010: return "Anatomic Pathology Structured Report Cancer Pharynx";
case URN_IHE_PAT_APSR_CANCER_SALIVARYGLAND_2010: return "Anatomic Pathology Structured Report Cancer Salivary Gland";
case URN_IHE_PAT_APSR_CANCER_LARYNX_2010: return "Anatomic Pathology Structured Report Cancer Larynx";
case URN_IHE_PHARM_PRE_2010: return "Pharmacy Pre";
case URN_IHE_PHARM_PADV_2010: return "Pharmacy PADV";
case URN_IHE_PHARM_DIS_2010: return "Pharmacy DIS";
case URN_IHE_PHARM_PML_2013: return "Pharmacy PML";
case URN_HL7ORG_SDWG_CCDASTRUCTUREDBODY_1_1: return "For documents following C-CDA 1.1 constraints using a structured body.";
case URN_HL7ORG_SDWG_CCDANONXMLBODY_1_1: return "For documents following C-CDA 1.1 constraints using a non structured body.";
case URN_HL7ORG_SDWG_CCDASTRUCTUREDBODY_2_1: return "For documents following C-CDA 2.1 constraints using a structured body.";
case URN_HL7ORG_SDWG_CCDANONXMLBODY_2_1: return "For documents following C-CDA 2.1 constraints using a non structured body.";
default: return "?";
}
}
}
| [
"jamesagnew@gmail.com"
] | jamesagnew@gmail.com |
b62cdd61a6cbdcca30d8c1104e95fd693f021298 | e92604f5c7e6819b2f74df6c9276cc59e6ff84d8 | /src/main/java/media/platform/amf/rtpcore/core/scheduler/Task.java | f128115a464a5a430ebe73df7539b462fb8e22c4 | [] | no_license | tonylim01/AMFDummy | 8c05626e0e779dd063029fda29edeaa7fffeaf0f | 361df31822a3bc6fde5b47eaf3d2baa5e3adc68e | refs/heads/master | 2020-04-23T00:23:56.128286 | 2019-01-25T08:07:23 | 2019-01-25T08:07:23 | 170,778,208 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,661 | java |
package media.platform.amf.rtpcore.core.scheduler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
public abstract class Task implements Runnable {
private static AtomicInteger id=new AtomicInteger(0);
private volatile boolean isActive = true;
private volatile boolean isHeartbeat = true;
//error handler instance
protected TaskListener listener;
private final Object LOCK = new Object();
private AtomicBoolean inQueue0=new AtomicBoolean(false);
private AtomicBoolean inQueue1=new AtomicBoolean(false);
private static final Logger logger = LoggerFactory.getLogger( Task.class);
protected int taskId;
public Task() {
taskId=id.incrementAndGet();
}
public void storedInQueue0()
{
inQueue0.set(true);
}
public void storedInQueue1()
{
inQueue1.set(true);
}
public void removeFromQueue0()
{
inQueue0.set(false);
}
public void removeFromQueue1()
{
inQueue1.set(false);
}
public Boolean isInQueue0()
{
return inQueue0.get();
}
public Boolean isInQueue1()
{
return inQueue1.get();
}
/**
* Modifies task listener.
*
* @param listener the handler instance.
*/
public void setListener(TaskListener listener) {
this.listener = listener;
}
/**
* Current queue of this task.
*
* @return the value of queue
*/
public abstract int getQueueNumber();
/**
* Executes task.
*
* @return dead line of next execution
*/
public abstract long perform();
/**
* Cancels task execution
*/
public void cancel() {
synchronized(LOCK) {
this.isActive = false;
}
}
//call should not be synchronized since can run only once in queue cycle
public void run() {
if (this.isActive) {
try {
perform();
//notify listener
if (this.listener != null) {
this.listener.onTerminate();
}
} catch (Exception e) {
logger.error("Could not execute task " + this.taskId + ": "+ e.getMessage(), e);
if (this.listener != null) {
listener.handlerError(e);
}
}
}
}
protected void activate(Boolean isHeartbeat) {
synchronized(LOCK) {
this.isActive = true;
this.isHeartbeat=isHeartbeat;
}
}
}
| [
"conahuz@gmail.com"
] | conahuz@gmail.com |
3f744fb3fd034289e9029a27cefec7000b8bd2df | b035d2e20649b36d3bdee138f2d8de2e635917a9 | /app/src/main/java/com/example/dari/data/model/LoggedInUser.java | bf62daa1a50baff8047eb96795c8de40ec71a0f9 | [] | no_license | yosrbouslama/DariMobile | dcc9df1dc5723d0c59895dd49c99abb061c5707d | fffac5b462590eef465d096ae04636084dd1fe5f | refs/heads/master | 2023-08-17T09:33:42.350668 | 2021-10-11T14:18:53 | 2021-10-11T14:18:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 503 | java | package com.example.dari.data.model;
/**
* Data class that captures user information for logged in users retrieved from LoginRepository
*/
public class LoggedInUser {
private String userId;
private String displayName;
public LoggedInUser(String userId, String displayName) {
this.userId = userId;
this.displayName = displayName;
}
public String getUserId() {
return userId;
}
public String getDisplayName() {
return displayName;
}
} | [
"yosr.bouslama@esprit.tn"
] | yosr.bouslama@esprit.tn |
c2495377fb4ab7619be48e0da23460687deb4725 | c885ef92397be9d54b87741f01557f61d3f794f3 | /results/JacksonDatabind-110/com.fasterxml.jackson.databind.deser.impl.JavaUtilCollectionsDeserializers/BBC-F0-opt-30/tests/8/com/fasterxml/jackson/databind/deser/impl/JavaUtilCollectionsDeserializers_ESTest.java | 3bf57d72cb654e9702436d78e7e3e599c99ca55a | [
"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 | 4,415 | java | /*
* This file was automatically generated by EvoSuite
* Wed Oct 13 18:45:47 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.DeserializationContext;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.cfg.DeserializerFactoryConfig;
import com.fasterxml.jackson.databind.deser.BeanDeserializerFactory;
import com.fasterxml.jackson.databind.deser.DefaultDeserializationContext;
import com.fasterxml.jackson.databind.deser.impl.JavaUtilCollectionsDeserializers;
import com.fasterxml.jackson.databind.type.CollectionType;
import com.fasterxml.jackson.databind.type.TypeFactory;
import java.util.LinkedHashSet;
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 JavaUtilCollectionsDeserializers_ESTest extends JavaUtilCollectionsDeserializers_ESTest_scaffolding {
@Test(timeout = 4000)
public void test0() throws Throwable {
ObjectMapper objectMapper0 = new ObjectMapper();
DeserializationContext deserializationContext0 = objectMapper0.getDeserializationContext();
// Undeclared exception!
try {
JavaUtilCollectionsDeserializers.findForMap(deserializationContext0, (JavaType) null);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.fasterxml.jackson.databind.deser.impl.JavaUtilCollectionsDeserializers", e);
}
}
@Test(timeout = 4000)
public void test1() throws Throwable {
BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance;
DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0);
// Undeclared exception!
try {
JavaUtilCollectionsDeserializers.findForCollection(defaultDeserializationContext_Impl0, (JavaType) null);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.fasterxml.jackson.databind.deser.impl.JavaUtilCollectionsDeserializers", e);
}
}
@Test(timeout = 4000)
public void test2() throws Throwable {
DeserializerFactoryConfig deserializerFactoryConfig0 = new DeserializerFactoryConfig();
BeanDeserializerFactory beanDeserializerFactory0 = new BeanDeserializerFactory(deserializerFactoryConfig0);
DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0);
TypeFactory typeFactory0 = TypeFactory.defaultInstance();
Class<LinkedHashSet> class0 = LinkedHashSet.class;
CollectionType collectionType0 = typeFactory0.constructCollectionType(class0, class0);
JsonDeserializer<?> jsonDeserializer0 = JavaUtilCollectionsDeserializers.findForMap(defaultDeserializationContext_Impl0, collectionType0);
assertNull(jsonDeserializer0);
}
@Test(timeout = 4000)
public void test3() throws Throwable {
DeserializerFactoryConfig deserializerFactoryConfig0 = new DeserializerFactoryConfig();
BeanDeserializerFactory beanDeserializerFactory0 = new BeanDeserializerFactory(deserializerFactoryConfig0);
DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0);
TypeFactory typeFactory0 = TypeFactory.defaultInstance();
Class<LinkedHashSet> class0 = LinkedHashSet.class;
CollectionType collectionType0 = typeFactory0.constructCollectionType(class0, class0);
JsonDeserializer<?> jsonDeserializer0 = JavaUtilCollectionsDeserializers.findForCollection(defaultDeserializationContext_Impl0, collectionType0);
assertNull(jsonDeserializer0);
}
}
| [
"pderakhshanfar@serg2.ewi.tudelft.nl"
] | pderakhshanfar@serg2.ewi.tudelft.nl |
2a88186cd4bfbcde5fb7dd86b2838416559a4747 | e0da9702715e28c94cf10950f5954f03815f7ee2 | /src/com/lxt/Serializable/SerializableDemo5.java | c6c1c3cb06cb97c00cce476bec7620565aba5022 | [] | no_license | Leexxttt/JavaDemo | 34b7ebc98f07087c8819c1797ef5223f203805c1 | 81cd952e55bae1c264c1b5fa23e62f99e8d7102b | refs/heads/master | 2020-04-09T11:59:31.146068 | 2019-05-10T08:50:30 | 2019-05-10T08:50:30 | 160,331,656 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 593 | java | package com.lxt.Serializable;
import java.io.*;
public class SerializableDemo5 {
public static void main(String[] args) throws IOException {
//反序列化
File file =new File("tempFile");
ObjectInputStream ois =null;
try {
ois=new ObjectInputStream(new FileInputStream(file));
Person3 newP=(Person3)ois.readObject();
System.out.println(newP);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}finally {
ois.close();
file.deleteOnExit();
}
}
}
| [
"lixueteng@chiyue365.com"
] | lixueteng@chiyue365.com |
6a17743ea3937c8a55d2e5222199c8f4c4c6f1b5 | 860b28b9eea74d00498d89d936f929470e794dc2 | /src/com/web/controller/MenuController.java | b5bef13b7d33d70372268cb969ca076f0f89ae1c | [] | no_license | sminglin2011/ewsoft_spring | bd4c2b07f5e0b2e46ad93449182316ec864ea107 | 59e7dbcd86e504c1211cd92e55c5b9a514eacd3e | refs/heads/master | 2021-01-18T16:48:05.667731 | 2017-01-07T10:13:16 | 2017-01-07T10:13:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,601 | java | package com.web.controller;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import com.web.domain.Menu;
import com.web.domain.MenuCategory;
import com.web.domain.MenuItem;
import com.web.domain.MenuItemGroup;
import com.web.service.MenuService;
import com.web.service.StockService;
@Controller
public class MenuController {
Logger log = Logger.getLogger(MenuController.class);
@Autowired
private MenuService menuService;
@Autowired
private StockService stockService;
@RequestMapping(value="/menuMain.htm")
public ModelAndView menuMain() {
log.debug("menuMain");
List menuList = menuService.loadMenuList();
List menuCategoryList = menuService.loadMenuCategoryList();
Map model = new HashMap<>();
model.put("menuList", menuList);
model.put("menuCategoryList", menuCategoryList);
return new ModelAndView("menu/menu_main", "model", model);
}
/************************* Menu Category ****************************/
@RequestMapping(value="/menuCategoryMain.htm")
public ModelAndView menuCategoryMain() {
log.debug("menuCategoryMain");
List list = menuService.loadMenuCategoryList();
Map model = new HashMap<>();
model.put("list", list);
return new ModelAndView("menu/menu_category", "model", model);
}
@RequestMapping(value="/saveMenuCategory.htm")
public String saveMenuCategory(MenuCategory menuCategory) {
log.debug("saveMenuCategory" + menuCategory);
menuService.saveMenuCategory(menuCategory);
return "redirect:menuCategoryMain.htm";
}
/************************* Menu Category ****************************/
/************************* Menu ****************************/
@RequestMapping(value="/menuList.htm")
public ModelAndView menuList() {
log.debug("menuList" );
List list = menuService.loadMenuList();
List menuCategoryList = menuService.loadMenuCategoryList();
Map model = new HashMap<>();
model.put("list", list);
model.put("menuCategoryList", menuCategoryList);
return new ModelAndView("menu/menu_list", "model", model);
}
@RequestMapping(value="/saveMenu.htm")
public String saveMenu(Menu menu) {
log.debug("save menu");
menuService.saveMenu(menu);
return "redirect:menuList.htm";
}
/************************* Menu ****************************/
/************************* MenuItemGroup ****************************/
@RequestMapping(value="/menuItemGroupMain.htm")
public ModelAndView menuItemGroupMain() {
log.debug("menuItemGroupMain");
List list = menuService.loadMenuItemGroupList();
Map model = new HashMap<>();
model.put("list", list);
return new ModelAndView("menu/menuItem_group", "model", model);
}
@RequestMapping(value="/saveMenuItemGroup.htm")
public String saveMenuItemGroup(MenuItemGroup menuItemGroup) {
log.debug("saveMenuItemGroup" + menuItemGroup);
menuService.saveMenuItemGroup(menuItemGroup);
return "redirect:menuItemGroupMain.htm";
}
@RequestMapping(value="/deleteMenuItemGroup.htm")
public String deleteMenuItemGroup(String id) {
log.debug("deleteMenuItemGroup id = " + id);
menuService.deleteMenuItemGroup(id);
return "redirect:menuItemGroupMain.htm";
}
/************************* MenuItemGroup ****************************/
/************************* Menu Item ****************************/
@RequestMapping(value="/menuItemMain.htm")
public ModelAndView menuItemMain() {
log.debug("menuList" );
List list = menuService.loadMenuItemList();
List menuList = menuService.loadMenuList();
List menuItemGroupList = menuService.loadMenuItemGroupList();
List foodItemList = stockService.loadStockList();
Map model = new HashMap<>();
model.put("list", list);
model.put("menuList", menuList);
model.put("menuItemGroupList", menuItemGroupList);
model.put("foodItemList", foodItemList);
return new ModelAndView("menu/menu_item_main", "model", model);
}
@RequestMapping(value="saveMenuItem.htm")
public String saveMenuItem(MenuItem menuItem) {
log.debug("save menuItem = " + menuItem);
menuService.saveMenuItem(menuItem);
return "redirect:menuItemMain.htm";
}
@RequestMapping(value="deleteMenuItem.htm")
public String deleteMenuItem(String id) {
log.debug("deleteMenuItem = " + id);
menuService.deleteMenuItem(id);
return "redirect:menuItemMain.htm";
}
/************************* Menu Item ****************************/
}
| [
"sminglin2011@gmail.com"
] | sminglin2011@gmail.com |
14daf64112e85a8eaee90e4b86d37adc1132d156 | 17742531d3264053f9e52292433828939cfb1727 | /server/movieflix/src/main/java/io/egen/api/service/impl/UserServiceImpl.java | cb8e9702333f111374116e3182e1150509f0095c | [] | no_license | shobhit-sri/shobhit-movieflix | 415f174139d519ec336b009814f4a6a300e45fbf | 6b5e09628fc978bc87371afd504654b6e02020f8 | refs/heads/master | 2021-01-11T20:14:48.036506 | 2017-02-14T08:34:35 | 2017-02-14T08:34:35 | 79,073,420 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,854 | java | package io.egen.api.service.impl;
import java.util.List;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import io.egen.api.dto.RoleDto;
import io.egen.api.dto.UserDto;
import io.egen.api.entity.User;
import io.egen.api.exception.BadRequestException;
import io.egen.api.exception.EntityNotFoundException;
import io.egen.api.mapper.RoleMapper;
import io.egen.api.mapper.UserMapper;
import io.egen.api.repository.UserRepository;
import io.egen.api.service.RoleService;
import io.egen.api.service.UserService;
import io.egen.api.util.ApplicationConstants;
@Service
public class UserServiceImpl implements UserService {
@Autowired
private UserRepository repository;
@Autowired
private RoleService roleService;
@Autowired
private UserMapper mapper;
@Autowired
private RoleMapper roleMapper;
@Override
@Transactional(readOnly = true)
public List<UserDto> findAll() {
List<User> users = repository.findAll();
List<UserDto> userDtos = users.stream().map(u -> mapper.getDtoFromEntity(u)).collect(Collectors.toList());
return userDtos;
}
@Override
@Transactional(readOnly = true)
public UserDto findOne(String id) {
User user = repository.findOne(id);
if(user == null){
throw new EntityNotFoundException("User not found");
}
return mapper.getDtoFromEntity(user);
}
@Override
@Transactional(readOnly = true)
public UserDto findByEmail(String email) {
User user = repository.findByEmail(email);
if(user == null){
throw new EntityNotFoundException("User with this email is not found");
}
return mapper.getDtoFromEntity(user);
}
@Override
@Transactional
public UserDto create(UserDto userDto) {
User user = repository.findByEmail(userDto.getEmail());
if (user != null) {
throw new BadRequestException("User with this email already exists");
}
//Set role to USER
RoleDto roleDto = roleService.findAll().stream()
.filter(r -> r.getType().equalsIgnoreCase(ApplicationConstants.ROLE_USER))
.findFirst()
.get();
userDto.setRole(roleMapper.getEntityFromDto(roleDto));
user = mapper.getEntityFromDto(userDto, true);
return mapper.getDtoFromEntity(repository.create(user));
}
@Override
@Transactional
public UserDto update(String id, UserDto userDto) {
User user = repository.findOne(id);
if (user == null) {
throw new EntityNotFoundException("User not found");
}
user = mapper.getEntityFromDto(userDto);
return mapper.getDtoFromEntity(repository.update(user));
}
@Override
@Transactional
public void delete(String id) {
User user = repository.findOne(id);
if (user == null) {
throw new EntityNotFoundException("User not found");
}
repository.delete(user);
}
} | [
"ssriva14@asu.edu"
] | ssriva14@asu.edu |
62a2e1aead6303c9dece8c370477f250ca913ca1 | 3f17373ded65b3eb25764c261f3fe952bb54e7f7 | /app/src/main/java/com/whatsapp/ac2.java | ca6ce201d908acbbb65350647fa24cf1c0f0c6f0 | [] | no_license | Srivignesh04/WAMOD | b7ee9f94d492d10481ce1e7193005dae433cf78e | 5820469f096551ba8852975887bf392ce32e5acd | refs/heads/master | 2021-01-16T20:39:35.883943 | 2016-02-09T12:57:20 | 2016-02-09T12:57:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 299 | java | package com.whatsapp;
import android.view.View;
/**
* Created by brianvalente on 9/21/15.
*/
public class ac2 implements View.OnClickListener {
// GALLERY
@Override
public void onClick(View v) {
}
public ac2(Conversation conversation) {
}
public ac2() {
}
}
| [
"briannvalente@gmail.com"
] | briannvalente@gmail.com |
8569ebef73462d4f1ae6ed617f648bd6f60913f6 | cf746050cae1931a9490232f90aed31c54a1ed81 | /src/server/Constants.java | 6c55d6985aeb44cc256e3b0a14f815391a28e6a9 | [] | no_license | JoaoS/qcs | 20a2f098c76f7d4d721a23441100e041e5f3fafa | d536713442eeada34d55d620382f83160a0cbb10 | refs/heads/master | 2016-09-13T00:22:27.115600 | 2016-06-04T14:29:39 | 2016-06-04T14:29:39 | 58,070,958 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 828 | java | package server;
/**
* Created by joaosubtil on 11/05/16.
*/
public class Constants {
//url raul
public static String url1 = "http://qcsa1-beardsdei.rhcloud.com/qcsa1/InsulinDoseCalculator?wsdl";
public static String serviceName1 = "InsulinDoseCalculatorService";
public static String portName1 = "InsulinDoseCalculatorPort";
//url 6
public static String url2 = "http://qcs07.dei.uc.pt:8080/InsulinCalculator?wsdl";
public static String serviceName2 = "InsulinCalculatorService";
public static String portName2 = "InsulinCalculatorPort";
//url 2
public static String url3 = "http://qcsproject1-qcsproject.rhcloud.com/InsulinDoseCalculator?wsdl";
public static String serviceName3 = "InsulinDoseCalculator";
public static String portName3 = "InsulinDoseCalculatorPort";
}
| [
"joaosubtil@BigMac.local"
] | joaosubtil@BigMac.local |
ba644face52543cec877bb34f4ddd70908c2b90b | e977c424543422f49a25695665eb85bfc0700784 | /benchmark/icse15/1067172/buggy-version/lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/handler/admin/SystemInfoHandler.java | 8d0606ccef520906e6033e801797ff5834e3f0ae | [] | no_license | amir9979/pattern-detector-experiment | 17fcb8934cef379fb96002450d11fac62e002dd3 | db67691e536e1550245e76d7d1c8dced181df496 | refs/heads/master | 2022-02-18T10:24:32.235975 | 2019-09-13T15:42:55 | 2019-09-13T15:42:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,885 | 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.solr.handler.admin;
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.File;
import java.io.StringWriter;
import java.lang.management.ManagementFactory;
import java.lang.management.OperatingSystemMXBean;
import java.lang.management.RuntimeMXBean;
import java.lang.reflect.Method;
import java.net.InetAddress;
import java.text.DecimalFormat;
import java.util.Date;
import java.util.Locale;
import org.apache.commons.io.IOUtils;
import org.apache.lucene.LucenePackage;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.common.util.SimpleOrderedMap;
import org.apache.solr.common.util.XML;
import org.apache.solr.core.SolrCore;
import org.apache.solr.handler.RequestHandlerBase;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.response.SolrQueryResponse;
import org.apache.solr.schema.IndexSchema;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* This handler returns system info
*
* NOTE: the response format is still likely to change. It should be designed so
* that it works nicely with an XSLT transformation. Until we have a nice
* XSLT front end for /admin, the format is still open to change.
*
* @version $Id$
* @since solr 1.2
*/
public class SystemInfoHandler extends RequestHandlerBase
{
private static Logger log = LoggerFactory.getLogger(SystemInfoHandler.class);
@Override
public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception
{
rsp.add( "core", getCoreInfo( req.getCore() ) );
rsp.add( "lucene", getLuceneInfo() );
rsp.add( "jvm", getJvmInfo() );
rsp.add( "system", getSystemInfo() );
rsp.setHttpCaching(false);
}
/**
* Get system info
*/
private static SimpleOrderedMap<Object> getCoreInfo( SolrCore core ) throws Exception
{
SimpleOrderedMap<Object> info = new SimpleOrderedMap<Object>();
IndexSchema schema = core.getSchema();
info.add( "schema", schema != null ? schema.getSchemaName():"no schema!" );
// Host
InetAddress addr = InetAddress.getLocalHost();
info.add( "host", addr.getCanonicalHostName() );
// Now
info.add( "now", new Date() );
// Start Time
info.add( "start", new Date(core.getStartTime()) );
// Solr Home
SimpleOrderedMap<Object> dirs = new SimpleOrderedMap<Object>();
dirs.add( "instance", new File( core.getResourceLoader().getInstanceDir() ).getAbsolutePath() );
dirs.add( "data", new File( core.getDataDir() ).getAbsolutePath() );
dirs.add( "index", new File( core.getIndexDir() ).getAbsolutePath() );
info.add( "directory", dirs );
return info;
}
/**
* Get system info
*/
public static SimpleOrderedMap<Object> getSystemInfo() throws Exception
{
SimpleOrderedMap<Object> info = new SimpleOrderedMap<Object>();
OperatingSystemMXBean os = ManagementFactory.getOperatingSystemMXBean();
info.add( "name", os.getName() );
info.add( "version", os.getVersion() );
info.add( "arch", os.getArch() );
// Java 1.6
addGetterIfAvaliable( os, "systemLoadAverage", info );
// com.sun.management.UnixOperatingSystemMXBean
addGetterIfAvaliable( os, "openFileDescriptorCount", info );
addGetterIfAvaliable( os, "maxFileDescriptorCount", info );
// com.sun.management.OperatingSystemMXBean
addGetterIfAvaliable( os, "committedVirtualMemorySize", info );
addGetterIfAvaliable( os, "totalPhysicalMemorySize", info );
addGetterIfAvaliable( os, "totalSwapSpaceSize", info );
addGetterIfAvaliable( os, "processCpuTime", info );
try {
if( !os.getName().toLowerCase(Locale.ENGLISH).startsWith( "windows" ) ) {
// Try some command line things
info.add( "uname", execute( "uname -a" ) );
info.add( "ulimit", execute( "ulimit -n" ) );
info.add( "uptime", execute( "uptime" ) );
}
}
catch( Throwable ex ) {} // ignore
return info;
}
/**
* Try to run a getter function. This is useful because java 1.6 has a few extra
* useful functions on the <code>OperatingSystemMXBean</code>
*
* If you are running a sun jvm, there are nice functions in:
* UnixOperatingSystemMXBean and com.sun.management.OperatingSystemMXBean
*
* it is package protected so it can be tested...
*/
static void addGetterIfAvaliable( Object obj, String getter, NamedList<Object> info )
{
// This is a 1.6 function, so lets do a little magic to *try* to make it work
try {
String n = Character.toUpperCase( getter.charAt(0) ) + getter.substring( 1 );
Method m = obj.getClass().getMethod( "get" + n );
Object v = m.invoke( obj, (Object[])null );
if( v != null ) {
info.add( getter, v );
}
}
catch( Exception ex ) {} // don't worry, this only works for 1.6
}
/**
* Utility function to execute a function
*/
private static String execute( String cmd )
{
DataInputStream in = null;
BufferedReader reader = null;
try {
Process process = Runtime.getRuntime().exec(cmd);
in = new DataInputStream( process.getInputStream() );
return IOUtils.toString( in );
}
catch( Exception ex ) {
// ignore - log.warn("Error executing command", ex);
return "(error executing: " + cmd + ")";
}
finally {
IOUtils.closeQuietly( reader );
IOUtils.closeQuietly( in );
}
}
/**
* Get JVM Info - including memory info
*/
public static SimpleOrderedMap<Object> getJvmInfo()
{
SimpleOrderedMap<Object> jvm = new SimpleOrderedMap<Object>();
jvm.add( "version", System.getProperty("java.vm.version") );
jvm.add( "name", System.getProperty("java.vm.name") );
Runtime runtime = Runtime.getRuntime();
jvm.add( "processors", runtime.availableProcessors() );
long used = runtime.totalMemory() - runtime.freeMemory();
// not thread safe, but could be thread local
DecimalFormat df = new DecimalFormat("#.#");
double percentUsed = ((double)(used)/(double)runtime.maxMemory())*100;
SimpleOrderedMap<Object> mem = new SimpleOrderedMap<Object>();
mem.add("free", humanReadableUnits(runtime.freeMemory(), df));
mem.add("total", humanReadableUnits(runtime.totalMemory(), df));
mem.add("max", humanReadableUnits(runtime.maxMemory(), df));
mem.add("used", humanReadableUnits(used, df) + " (%" + df.format(percentUsed) + ")");
jvm.add("memory", mem);
// JMX properties -- probably should be moved to a different handler
SimpleOrderedMap<Object> jmx = new SimpleOrderedMap<Object>();
try{
RuntimeMXBean mx = ManagementFactory.getRuntimeMXBean();
jmx.add( "bootclasspath", mx.getBootClassPath());
jmx.add( "classpath", mx.getClassPath() );
// the input arguments passed to the Java virtual machine
// which does not include the arguments to the main method.
jmx.add( "commandLineArgs", mx.getInputArguments());
// a map of names and values of all system properties.
//jmx.add( "SYSTEM PROPERTIES", mx.getSystemProperties());
jmx.add( "startTime", new Date(mx.getStartTime()));
jmx.add( "upTimeMS", mx.getUptime() );
}
catch (Exception e) {
log.warn("Error getting JMX properties", e);
}
jvm.add( "jmx", jmx );
return jvm;
}
private static SimpleOrderedMap<Object> getLuceneInfo() throws Exception
{
SimpleOrderedMap<Object> info = new SimpleOrderedMap<Object>();
String solrImplVersion = "";
String solrSpecVersion = "";
String luceneImplVersion = "";
String luceneSpecVersion = "";
// ---
Package p = SolrCore.class.getPackage();
StringWriter tmp = new StringWriter();
solrImplVersion = p.getImplementationVersion();
if (null != solrImplVersion) {
XML.escapeCharData(solrImplVersion, tmp);
solrImplVersion = tmp.toString();
}
tmp = new StringWriter();
solrSpecVersion = p.getSpecificationVersion() ;
if (null != solrSpecVersion) {
XML.escapeCharData(solrSpecVersion, tmp);
solrSpecVersion = tmp.toString();
}
p = LucenePackage.class.getPackage();
tmp = new StringWriter();
luceneImplVersion = p.getImplementationVersion();
if (null != luceneImplVersion) {
XML.escapeCharData(luceneImplVersion, tmp);
luceneImplVersion = tmp.toString();
}
tmp = new StringWriter();
luceneSpecVersion = p.getSpecificationVersion() ;
if (null != luceneSpecVersion) {
XML.escapeCharData(luceneSpecVersion, tmp);
luceneSpecVersion = tmp.toString();
}
// Add it to the list
info.add( "solr-spec-version", solrSpecVersion );
info.add( "solr-impl-version", solrImplVersion );
info.add( "lucene-spec-version", luceneSpecVersion );
info.add( "lucene-impl-version", luceneImplVersion );
return info;
}
//////////////////////// SolrInfoMBeans methods //////////////////////
@Override
public String getDescription() {
return "Get System Info";
}
@Override
public String getVersion() {
return "$Revision$";
}
@Override
public String getSourceId() {
return "$Id$";
}
@Override
public String getSource() {
return "$URL$";
}
private static final long ONE_KB = 1024;
private static final long ONE_MB = ONE_KB * ONE_KB;
private static final long ONE_GB = ONE_KB * ONE_MB;
/**
* Return good default units based on byte size.
*/
private static String humanReadableUnits(long bytes, DecimalFormat df) {
String newSizeAndUnits;
if (bytes / ONE_GB > 0) {
newSizeAndUnits = String.valueOf(df.format((float)bytes / ONE_GB)) + " GB";
} else if (bytes / ONE_MB > 0) {
newSizeAndUnits = String.valueOf(df.format((float)bytes / ONE_MB)) + " MB";
} else if (bytes / ONE_KB > 0) {
newSizeAndUnits = String.valueOf(df.format((float)bytes / ONE_KB)) + " KB";
} else {
newSizeAndUnits = String.valueOf(bytes) + " bytes";
}
return newSizeAndUnits;
}
}
| [
"durieuxthomas@hotmail.com"
] | durieuxthomas@hotmail.com |
17e080194d99f1c416df563b2319c81d4c4b2daf | 0515c92e20d16acf522d7747beb4b80e7beac22e | /src/test/java/ru/rosbank/javaschool/crudapi/service/UserServiceTest.java | 9442313fbfeb808ae4214af394ea9864ec2db2c7 | [] | no_license | IvanD18/final-back | 6a5bff034e524629ab8c8edd3ad7daf33a8102dd | 395e743af5618166810db83a33e52826dc5e7f82 | refs/heads/master | 2020-11-26T21:53:04.546592 | 2019-12-20T07:36:21 | 2019-12-20T07:36:21 | 229,211,639 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,242 | java | package ru.rosbank.javaschool.crudapi.service;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.crypto.password.PasswordEncoder;
import ru.rosbank.javaschool.crudapi.entity.UserEntity;
import ru.rosbank.javaschool.crudapi.repository.UserRepository;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.Mockito.mock;
class UserServiceTest {
@Test
void loadUserByUsernameShouldWork() {
UserEntity user = new UserEntity();
user.setUsername("Vasya");
UserRepository repository = mock(UserRepository.class);
PasswordEncoder encoder = mock(PasswordEncoder.class);
final UserService service= new UserService(repository,encoder);
Mockito.when(repository.findByUsername("Vasya")).thenReturn(Optional.of(user));
assertEquals( user.getUsername(), service.loadUserByUsername("Vasya").getUsername());
}
} | [
"IvanD18@mail.ru"
] | IvanD18@mail.ru |
10975b1defbe08f00d19d8f81fad1fc76a558d6b | 69d69e572ed29578bbc119389824fb54a51c2371 | /src/test/java/utils/JavaUtil.java | 0bfdb777de0c2272a358bf85cae20ccaa0ba197b | [] | no_license | mustafaeser/HotelsFinal | 5e433e04d031db0004ccae2fb900c8b1fd608f31 | 7d424076b3f26d2313389d14a5eb33b44b8c7a99 | refs/heads/master | 2023-05-10T20:01:52.767349 | 2020-02-03T21:05:15 | 2020-02-03T21:05:15 | 238,061,925 | 0 | 0 | null | 2023-05-09T18:42:27 | 2020-02-03T21:05:06 | Java | UTF-8 | Java | false | false | 4,085 | java | package utils;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
public class JavaUtil {
public void flash(By locator) {
WebElement webElement=Driver.getDriver().findElement(locator);
String bgcolor = webElement.getCssValue("backgroundColor");
for (int i = 0; i < 4; i++) {
changeColor(webElement,"rgb(0,200,0)");// 1
changeColor(webElement, bgcolor);//
}
}
public void changeColor(WebElement element, String color) {
JavascriptExecutor js = ((JavascriptExecutor) Driver.getDriver());
js.executeScript("arguments[0].style.backgroundColor = '" + color + "'", element);
try {
Thread.sleep(20);
} catch (InterruptedException e) {
}
}
public void drawBorder(By locator) {
JavascriptExecutor js = ((JavascriptExecutor) Driver.getDriver());
WebElement webElement=Driver.getDriver().findElement(locator);
js.executeScript("arguments[0].style.border='2px solid red'", webElement);
}
public void generateAlert(String message) {
JavascriptExecutor js = ((JavascriptExecutor) Driver.getDriver());
js.executeScript("alert('" + message + "')");
}
public void clickOn(By locator) {
JavascriptExecutor js = ((JavascriptExecutor) Driver.getDriver());
WebElement webElement=Driver.getDriver().findElement(locator);
js.executeScript("arguments[0].click();", webElement);
}
public void clickWith(By locator) {
WebDriverWait wait = new WebDriverWait(Driver.getDriver(),
Long.parseLong(ConfigReader.getProperty("timeout")));
WebElement webElement=Driver.getDriver().findElement(locator);
wait.until(ExpectedConditions.elementToBeClickable(webElement));
((JavascriptExecutor) Driver.getDriver()).executeScript("arguments[0].scrollIntoView(true);", webElement);
((JavascriptExecutor) Driver.getDriver()).executeScript("arguments[0].click();", webElement);
}
public void refreshBrowser() {
JavascriptExecutor js = ((JavascriptExecutor) Driver.getDriver());
js.executeScript("history.go(0)");
}
public String getTitle() {
JavascriptExecutor js = ((JavascriptExecutor) Driver.getDriver());
String title = js.executeScript("return document.title;").toString();
return title;
}
public String getPageInnerText() {
JavascriptExecutor js = ((JavascriptExecutor) Driver.getDriver());
String pageText = js.executeScript("return document.documentElement.innerText;").toString();
return pageText;
}
public void scrollPageDown() {
JavascriptExecutor js = ((JavascriptExecutor) Driver.getDriver());
js.executeScript("window.scrollTo(0,document.body.scrollHeight)");
}
public void scrollByElement(By locator){
JavascriptExecutor js = (JavascriptExecutor) Driver.getDriver();
WebElement webElement=Driver.getDriver().findElement(locator);
js.executeScript("arguments[0].scrollIntoView();", webElement);
}
public void scrollByPixel(String xPixel, String yPixel){
String string = "window.scrollBy(" + xPixel +"," + yPixel + ")";
JavascriptExecutor js = (JavascriptExecutor) Driver.getDriver();
js.executeScript(string);
}
public String getBrowserInfo(){
JavascriptExecutor js = (JavascriptExecutor) Driver.getDriver();
String uAgent = js.executeScript("return navigator.userAgent;").toString();
return uAgent;
}
public void setAttributeValue(By locator, String atribute, String value){
JavascriptExecutor js = ((JavascriptExecutor) Driver.getDriver());
WebElement webElement=Driver.getDriver().findElement(locator);
js.executeScript("arguments[0].setAttribute('"+atribute+"', '"+value+"')",webElement);
}
}
| [
"esermusta@mail.com"
] | esermusta@mail.com |
d0d4493c93256cb45796a9f2a2c4dcfcedc7a5f6 | 122cd25a7aef70748eef1bd150af9101310b6c56 | /app/src/main/java/zxary/project/com/tw/battlecatsdatabasedemo/parse/data/download/IWebData.java | 47f31e5f7452da392a6823853cb29064cff61076 | [] | no_license | Zivxary/BattleCatsDataBaseDemo | d17e175df87919d5e00ac218962b6c336104813c | b33c06bd6d4085d280874ea1f366b39dee8bc38e | refs/heads/master | 2020-03-26T21:54:25.850721 | 2018-09-05T09:40:15 | 2018-09-05T09:40:24 | 145,396,671 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 149 | java | package zxary.project.com.tw.battlecatsdatabasedemo.parse.data.download;
import java.net.URL;
public interface IWebData<T> {
T get(URL url);
}
| [
"childbrozoo8@gmail.com"
] | childbrozoo8@gmail.com |
fc0363b34f7dcdd35a2bacba67b37a01b8f85fb7 | e31e86c879ac0c56fc476f9a40d478a2ecb72dbc | /app/src/main/java/com/zhide/app/wxapi/WXPayEntryActivity.java | 475622d9a0a34b136f6dac15882f787c219affb2 | [] | no_license | kotnekai/ZhiDeProject | e3e56566c1452158faa61b8ce1a5cfaf2d4df823 | 1c720cf58166e6637643afc84d219cfab2571d60 | refs/heads/master | 2020-03-26T15:39:30.358489 | 2018-12-12T13:54:54 | 2018-12-12T13:54:54 | 145,056,358 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,691 | java | package com.zhide.app.wxapi;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.tencent.mm.opensdk.constants.ConstantsAPI;
import com.tencent.mm.opensdk.modelbase.BaseReq;
import com.tencent.mm.opensdk.modelbase.BaseResp;
import com.tencent.mm.opensdk.openapi.IWXAPI;
import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler;
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
import com.zhide.app.R;
import com.zhide.app.common.CommonParams;
import com.zhide.app.eventBus.PayResultEvent;
import com.zhide.app.utils.PreferencesUtils;
import com.zhide.app.view.base.BaseActivity;
import org.greenrobot.eventbus.EventBus;
import butterknife.BindView;
public class WXPayEntryActivity extends BaseActivity implements IWXAPIEventHandler {
private static final String TAG = "MicroMsg.SDKSample.WXPayEntryActivity";
private IWXAPI api;
@BindView(R.id.tvResult)
TextView tvResult;
@BindView(R.id.ivIcon)
ImageView ivIcon;
@BindView(R.id.tvPayAmount)
TextView tvPayAmount;
@BindView(R.id.tvGoBack)
TextView tvGoBack;
@Override
protected int getCenterView() {
return R.layout.pay_result;
}
@Override
protected SmartRefreshLayout getRefreshView() {
return null;
}
@Override
protected void initHeader() {
setHeaderTitle("支付结果");
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
api = WXAPIFactory.createWXAPI(this, CommonParams.WECHAT_APPID);
// api = ApplicationHolder.getInstance().getMsgApi();
api.handleIntent(getIntent(), this);
Log.d("admin", "onCreate: api=" + api);
tvGoBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
api.handleIntent(intent, this);
}
@Override
public void onReq(BaseReq req) {
}
@Override
public void onResp(BaseResp resp) {
if (resp.getType() == ConstantsAPI.COMMAND_PAY_BY_WX) {
switch (resp.errCode) {
case -1:
ivIcon.setImageResource(R.mipmap.pay_failed);
tvResult.setText(getString(R.string.pay_failed));
if (resp.errStr == null) {
resp.errStr = "空";
}
tvPayAmount.setText(getString(R.string.failed_reson_tip) + resp.errStr);
break;
case 0:
ivIcon.setImageResource(R.mipmap.pay_success);
tvResult.setText(getString(R.string.pay_success));
float selectAmount = PreferencesUtils.getFloat("selectAmount");
tvPayAmount.setText(selectAmount+getString(R.string.yuan));
break;
case -2:
ivIcon.setImageResource(R.mipmap.pay_failed);
tvResult.setText(getString(R.string.pay_cancel));
if (resp.errStr == null) {
resp.errStr = "空";
}
tvPayAmount.setText(getString(R.string.failed_reson_tip)+ resp.errStr);
break;
}
EventBus.getDefault().post(new PayResultEvent(resp.errCode));
}
}
} | [
"xuyunchang@mzjmedia.net"
] | xuyunchang@mzjmedia.net |
0e4eb7d0d08dc35d03df0eb9ae3e927ff9b6b9ee | 3ced3b28421b53f8b71f24f07653cdaf6ac7e319 | /app/src/main/java/com/example/exercisemenu/Activity_kl_s3.java | e675e787cd0358f46b8f8c1f1c6ab4849ab34f03 | [] | no_license | adelina-sfr/Exercise_Menu | 102e08d231c0536343794d774234313706484bb1 | 6b1890b19b8aea24fd9edeb11e3851bb99fb80b0 | refs/heads/master | 2021-05-24T07:32:35.775621 | 2020-04-06T19:42:46 | 2020-04-06T19:42:46 | 253,452,397 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,707 | java | package com.example.exercisemenu;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class Activity_kl_s3 extends AppCompatActivity {
Button Btn;
EditText Als_s3;
EditText s3_t;
EditText msk_MRG_s3;
TextView TVhsl;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_kl_s3);
Als_s3 = findViewById(R.id.mskAls_s3);
s3_t = findViewById(R.id.mskTG_s3);
msk_MRG_s3 = findViewById(R.id.mskMRG_s3);
Btn = findViewById(R.id.btnhitung_k_s3);
TVhsl = findViewById(R.id.hsl_k_s3);
Btn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
double alas = Double.parseDouble(Als_s3.getText().toString());
double tinggi = Double.parseDouble(s3_t.getText().toString());
double miring = Double.parseDouble(msk_MRG_s3.getText().toString());
double keliling = alas + tinggi + miring;
StringBuilder sb = new StringBuilder();
sb.append("Keliling Segitiga dengan alas: ");
sb.append(alas);
sb.append(" dan tinggi: ");
sb.append(tinggi);
sb.append(" dan miring: ");
sb.append(miring);
sb.append(" adalah: ");
sb.append(keliling);
sb.append(BuildConfig.FLAVOR);
TVhsl.setText(sb.toString());
}
});
}
}
| [
"aaderina57@gmail.com"
] | aaderina57@gmail.com |
37928570021f9aa9dec2da064883780d361394fb | cc4e954a2fce90a835b648d5cb5a61097837749f | /projectlibre/openproj_core/src/com/projity/field/ObjectRef.java | ff8479b71b73f8cc63495f22074fdde07474e44a | [] | no_license | vmazurashu/lp-pl-integration | dc9cac67e12e85540ce5e4dffe5e73f414cf13b4 | f1eff6232a36a895b48d4cd6486aca822dab9ea2 | refs/heads/master | 2020-04-08T23:22:14.044103 | 2018-11-30T12:42:20 | 2018-11-30T12:42:20 | 159,821,841 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,562 | java | /*
The contents of this file are subject to the Common Public Attribution License
Version 1.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.projity.com/license . The License is based on the Mozilla Public
License Version 1.1 but Sections 14 and 15 have been added to cover use of
software over a computer network and provide for limited attribution for the
Original Developer. In addition, Exhibit A has been modified to be consistent
with Exhibit B.
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the
specific language governing rights and limitations under the License. The
Original Code is OpenProj. The Original Developer is the Initial Developer and
is Projity, Inc. All portions of the code written by Projity are Copyright (c)
2006, 2007. All Rights Reserved. Contributors Projity, Inc.
Alternatively, the contents of this file may be used under the terms of the
Projity End-User License Agreeement (the Projity License), in which case the
provisions of the Projity License are applicable instead of those above. If you
wish to allow use of your version of this file only under the terms of the
Projity License and not to allow others to use your version of this file under
the CPAL, indicate your decision by deleting the provisions above and replace
them with the notice and other provisions required by the Projity License. If
you do not delete the provisions above, a recipient may use your version of this
file under either the CPAL or the Projity License.
[NOTE: The text of this license may differ slightly from the text of the notices
in Exhibits A and B of the license at http://www.projity.com/license. You should
use the latest text at http://www.projity.com/license for your modifications.
You may not remove this license text from the source files.]
Attribution Information: Attribution Copyright Notice: Copyright (c) 2006, 2007
Projity, Inc. Attribution Phrase (not exceeding 10 words): Powered by OpenProj,
an open source solution from Projity. Attribution URL: http://www.projity.com
Graphic Image as provided in the Covered Code as file: openproj_logo.png with
alternatives listed on http://www.projity.com/logo
Display of Attribution Information is required in Larger Works which are defined
in the CPAL as a work which combines Covered Code or portions thereof with code
not governed by the terms of the CPAL. However, in addition to the other notice
obligations, all copies of the Covered Code in Executable and Source Code form
distributed must, as a form of attribution of the original author, include on
each user interface screen the "OpenProj" logo visible to all users. The
OpenProj logo should be located horizontally aligned with the menu bar and left
justified on the top left of the screen adjacent to the File menu. The logo
must be at least 100 x 25 pixels. When users click on the "OpenProj" logo it
must direct them back to http://www.projity.com.
*/
package com.projity.field;
import java.util.Collection;
import com.projity.grouping.core.Node;
import com.projity.grouping.core.model.NodeModelDataFactory;
import com.projity.grouping.core.model.WalkersNodeModel;
/**
*
*/
public interface ObjectRef {
public Node getNode();
public WalkersNodeModel getNodeModel();
public Object getObject();
Collection getCollection();
public NodeModelDataFactory getDataFactory();
}
| [
"mazurashuvadim@gmail.com"
] | mazurashuvadim@gmail.com |
cc855bfac022ad7151658aec9318b93dd74d4c61 | 4ef7a6389a533011c58aea5fd0db613e4ebe0460 | /base-java/src/main/java/top/wujinxing/java11/Ch2StringEnhanced.java | 4c737117b877fa8ffc30f31de7db7e5d6ed952ca | [] | no_license | kingstar718/Java-Learning | f83de105142ff21b3bf34a36c72b1e665f684a09 | 7b4e4ac5d934d4f523be578ef9c7cb2278b7a58b | refs/heads/master | 2023-08-31T13:20:55.645996 | 2023-08-18T10:52:50 | 2023-08-18T10:52:50 | 179,264,177 | 0 | 0 | null | 2023-06-14T22:36:36 | 2019-04-03T10:10:48 | Java | UTF-8 | Java | false | false | 1,060 | java | package top.wujinxing.java11;
import lombok.extern.slf4j.Slf4j;
/**
* @author wujinxing
* @date 2022-09-24
*/
@Slf4j
public class Ch2StringEnhanced {
public static void main(String[] args) {
String blank = " ";
// 字符串判空
var bool = blank.isBlank();
log.info("blank: {}", bool);
// 分割获取字符串流
var lines = "a\nb\nc";
var streamLine = lines.lines();
streamLine.forEach(s -> log.info("line:{}", s));
log.info("line count:{}", lines.lines().count());
// 复制字符串
var repeat = "repeat;";
var repeat3 = repeat.repeat(3);
log.info("repeat3:{}", repeat3);
// 去除空格
String strip = " https://www.wdbyte.com ";
log.info("1=={}==", strip.strip());
log.info("2=={}==", strip.stripTrailing());
log.info("3=={}==", strip.stripLeading());
// trim只能去除半角空格,strip可以去除各种空白字符
log.info("4=={}==", strip.trim());
}
}
| [
"kingstar718@foxmail.com"
] | kingstar718@foxmail.com |
b29fe98c552eebb63633bbf3d8e08d528e196e76 | ba4e62a44750dc17c294b60fc72a8cf9e34ce45b | /LeetCode1672.java | ff3bae45499e6acdeb3922e476a1507b756eb40b | [] | no_license | easternRainy/LeetCode | 927944043c8b3102c39c44c3d517cc4840b396fc | 3bff5a4322f6c482d42276e0373a39521b34eaec | refs/heads/master | 2023-07-16T17:33:16.660302 | 2021-09-03T18:16:41 | 2021-09-03T18:16:41 | 332,535,439 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 413 | java | public class LeetCode1672 {
public int maximumWealth(int[][] accounts) {
int max = -1;
for(int i=0; i<accounts.length; i++) {
int amount = 0;
for(int j=0; j<accounts[i].length; j++) {
amount += accounts[i][j];
if (amount > max) {
max = amount;
}
}
}
return max;
}
}
| [
"githubregister01@gmail.com"
] | githubregister01@gmail.com |
34ee25a222fdf6ad759715706167d83bd80759bd | 7d1328fb484c33771051a63b3f5b17defb5b1fc3 | /layout/LinearLayoutApp/app/src/main/java/cn/edu/bistu/cs/se/linearlayoutapp/MainActivity.java | 4b7ea40df13895fb4aaa551191955b82b110e702 | [] | no_license | caozichen/e66ily | 153e7e3fecc4cbf80ee50b8561a389e63df2a213 | b2a6f1f1f481d58b828284844a373d926b7e9442 | refs/heads/master | 2023-01-07T07:00:39.301472 | 2020-11-12T16:06:03 | 2020-11-12T16:06:03 | 295,570,640 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,792 | java | package cn.edu.bistu.cs.se.linearlayoutapp;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
| [
"zichencao522@126.com"
] | zichencao522@126.com |
ec00bfd785ddee8fd617efb4a5c624f1539fc0b6 | 85096a47a7b8e11f913591b5a0fbba4eaccb0f98 | /exchange/src/main/java/com/currency/exchange/Currency/Exchange/web/rest/util/ResponseUtil.java | 56600bfd1bd8929a5b1009ac866564b28b720743 | [] | no_license | luisfrsa/currency_exchange | 336dbccd52886a8bac17fd37fd6504431268ebd5 | c628a3111eb914bac1c2f6d142903a318a8adaaa | refs/heads/master | 2020-03-19T14:42:17.051043 | 2018-06-23T01:37:09 | 2018-06-23T01:37:09 | 136,636,091 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 827 | java | package com.currency.exchange.Currency.Exchange.web.rest.util;
import java.util.Optional;
import java.util.function.Function;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.http.ResponseEntity.BodyBuilder;
public interface ResponseUtil {
static <X> ResponseEntity<X> wrapOrNotFound(Optional<X> maybeResponse) {
return wrapOrNotFound(maybeResponse, (HttpHeaders) null);
}
static <X> ResponseEntity<X> wrapOrNotFound(Optional<X> maybeResponse, HttpHeaders header) {
return (ResponseEntity) maybeResponse.map((response) -> {
return ((BodyBuilder) ResponseEntity.ok().headers(header)).body(response);
}).orElse(new ResponseEntity(HttpStatus.NOT_FOUND));
}
} | [
"luis.alves@db1.com.br"
] | luis.alves@db1.com.br |
6ac69e3bb6c4abe23331eb270c1888e5607480f9 | 638f94502b54d79349b606940e284b0c45dfcade | /shopping-product-server/src/test/java/com/lanyang/product/services/TProductService.java | 2d363fd9b1089a7cd910a0cfbbe8488b166e8023 | [] | no_license | HiLany/shopping | c4b0414deb2d779be358add6911662d98aafa3e2 | a56e9e79a14ec4a8e781f9692dfff069dd0d2cf9 | refs/heads/master | 2020-04-05T02:42:17.767148 | 2019-05-13T13:55:46 | 2019-05-13T13:55:46 | 156,487,036 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,435 | java | package com.lanyang.product.services;
import com.lanyang.product.domain.entity.Product;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.domain.Page;
import org.springframework.test.context.junit4.SpringRunner;
import java.time.LocalDateTime;
/**
* Created by lany on 2019/3/29.
*/
@RunWith(SpringRunner.class)
@SpringBootTest
public class TProductService {
@Autowired
ProductService productService;
// @Test
public void testAdd(){
Product product = new Product();
product.setProductCode("1010");
product.setProductName("ChongQing");
product.setInventory(5000);
product.setLastUpdateTime(LocalDateTime.now().toString());
product.setPicAddr("");
product.setPrice(5000);
Assert.assertEquals(product,productService.saveAndUpdateProduct(product));
}
// @Test
public void testSearchByCondition(){
Product product = new Product();
product.setProductCode("1001");
Page<Product> products = productService.findProductCriteria(1,5,product);
System.out.println(products);
}
// @Test
public void testSearch(){
System.out.println(productService.findOne("f7e69dca-8725-4e8e-b3ea-4227d4515653"));
}
}
| [
"lanyang@pivotal.net.cn"
] | lanyang@pivotal.net.cn |
208b485208959bcc4db015e320ff6af9b2e9b495 | dc586394a5df096b8c4f0d24a73e01db69f8b660 | /src/main/java/org/taocaicai/App.java | d0da07b117d7eafebc22f404d8f0e477261abe22 | [] | no_license | jackdemos/taocaicai-activiti | 3e7c02166895391106b31f69773ea3a5e12c651a | 152d9d91077b0728638976684702844a8578f552 | refs/heads/master | 2023-07-10T23:18:57.016394 | 2021-08-07T00:01:40 | 2021-08-07T00:01:40 | 393,182,353 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 766 | java | package org.taocaicai;
import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.repository.Deployment;
/** Hello world! */
public class App {
public static void main(String[] args) {
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
RepositoryService repositoryService = processEngine.getRepositoryService();
Deployment deploy =
repositoryService
.createDeployment()
.addClasspathResource("bpmn/evection.bpmn")
.addClasspathResource("bpmn/evection.png")
.name("出差申请")
.deploy();
System.out.println(deploy.getId() + "\t" + deploy.getName());
}
}
| [
"cqfangchaoit@sina.com"
] | cqfangchaoit@sina.com |
34ae616e50994846750d5146a40302a764796fb2 | 1a814c6e1e29c9616584b87767c04e949e64fa00 | /logginghub-connector/src/main/java/com/logginghub/connector/log4j/Log4jDetailsSnapshot.java | 40ecbae809b67627ea4c9f4dd42884e47e5a981b | [] | no_license | logginghub/alternativeclient | 18c59e5b72ebe220782b83abf783701add362f92 | eddd22bcf011326ed1447e9ce633ad024802f75b | refs/heads/master | 2021-01-18T14:05:23.139076 | 2014-07-09T09:32:25 | 2014-07-09T09:32:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,356 | java | package com.logginghub.connector.log4j;
import java.util.Hashtable;
import org.apache.log4j.MDC;
import org.apache.log4j.NDC;
import org.apache.log4j.spi.LocationInfo;
import org.apache.log4j.spi.LoggingEvent;
import com.logginghub.utils.TimeProvider;
/**
* Captures some aspects of the log events so we can dispatch them
* correctly later on.
*
* @author James
*
*/
public class Log4jDetailsSnapshot {
private String className;
private String fileName;
private String lineNumber;
private String methodName;
private String threadName;
private LoggingEvent loggingEvent;
// Diagnostic contexts from log4j. Should we generalise them here?
private String ndc;
private Hashtable<String, Object> mdc;
private long timestamp;
@SuppressWarnings("unchecked") public static Log4jDetailsSnapshot fromLoggingEvent(LoggingEvent loggingEvent, TimeProvider timeProvider) {
Log4jDetailsSnapshot snapshot = new Log4jDetailsSnapshot();
LocationInfo locationInformation = loggingEvent.getLocationInformation();
snapshot.className = locationInformation.getClassName();
snapshot.fileName = locationInformation.getFileName();
snapshot.lineNumber = locationInformation.getLineNumber();
snapshot.methodName = locationInformation.getMethodName();
snapshot.threadName = loggingEvent.getThreadName();
snapshot.loggingEvent = loggingEvent;
snapshot.mdc = MDC.getContext();
snapshot.ndc = NDC.get();
if (timeProvider != null) {
snapshot.timestamp = timeProvider.getTime();
}
else {
snapshot.timestamp = loggingEvent.timeStamp;
}
return snapshot;
}
public long getTimestamp() {
return timestamp;
}
public Hashtable<String, Object> getMdc() {
return mdc;
}
public String getNdc() {
return ndc;
}
public LoggingEvent getLoggingEvent() {
return loggingEvent;
}
public String getClassName() {
return className;
}
public String getFileName() {
return fileName;
}
public String getMethodName() {
return methodName;
}
public String getLineNumber() {
return lineNumber;
}
public String getThreadName() {
return threadName;
}
}
| [
"james@vertexlabs.co.uk"
] | james@vertexlabs.co.uk |
fcb2d2112a144e3e5d43224ee2871183606f1910 | 2cde025062d5f88e27e82166a7e4b93a8bf10322 | /src/algorithm/HeapSort.java | 55d319bc81475476db84dfe58187208d9ecefad3 | [] | no_license | Mahedi-Masud/MahediExam | 13aea6222cd52babddeee7681957276bafe58311 | 3eb86d6d06577bb516d034d95c4cfc646e609b9a | refs/heads/master | 2020-12-02T08:33:14.828171 | 2016-08-20T19:58:55 | 2016-08-20T19:58:55 | 66,164,863 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,601 | java | package algorithm;
/**
* Created by mahedi on 8/20/2016.
*/
public class HeapSort {
private static int[] a;
private static int n;
private static int left;
private static int right;
private static int largest;
public static void buildheap(int []a){
n=a.length-1;
for(int i=n/2;i>=0;i--){
maxheap(a,i);
}
}
public static void maxheap(int[] a, int i){
left=2*i;
right=2*i+1;
if(left <= n && a[left] > a[i]){
largest=left;
}
else{
largest=i;
}
if(right <= n && a[right] > a[largest]){
largest=right;
}
if(largest!=i){
exchange(i,largest);
maxheap(a, largest);
}
}
public static void exchange(int i, int j){
int t=a[i];
a[i]=a[j];
a[j]=t;
}
public static void sort(int []a0){
a=a0;
buildheap(a);
for(int i=n;i>0;i--){
exchange(0, i);
n=n-1;
maxheap(a, 0);
}
}
public int[] MyHeapSort(int [] ArrayValue) {
int []a1=ArrayValue;
sort(a1);
return a1;
}
}
| [
"mahedi83@gmail.com"
] | mahedi83@gmail.com |
a913f8dcbb97e1953d030488f151c7f2e913dfd0 | a1826c2ed9c12cfc395fb1a14c1a2e1f097155cb | /polardbx-20200202/src/main/java/com/aliyun/polardbx20200202/models/DescribeDBInstanceHAResponse.java | 4b1c15ad8d0cd4984e13df761acf8458206be23f | [
"Apache-2.0"
] | permissive | aliyun/alibabacloud-java-sdk | 83a6036a33c7278bca6f1bafccb0180940d58b0b | 008923f156adf2e4f4785a0419f60640273854ec | refs/heads/master | 2023-09-01T04:10:33.640756 | 2023-09-01T02:40:45 | 2023-09-01T02:40:45 | 288,968,318 | 40 | 45 | null | 2023-06-13T02:47:13 | 2020-08-20T09:51:08 | Java | UTF-8 | Java | false | false | 1,422 | java | // This file is auto-generated, don't edit it. Thanks.
package com.aliyun.polardbx20200202.models;
import com.aliyun.tea.*;
public class DescribeDBInstanceHAResponse extends TeaModel {
@NameInMap("headers")
@Validation(required = true)
public java.util.Map<String, String> headers;
@NameInMap("statusCode")
@Validation(required = true)
public Integer statusCode;
@NameInMap("body")
@Validation(required = true)
public DescribeDBInstanceHAResponseBody body;
public static DescribeDBInstanceHAResponse build(java.util.Map<String, ?> map) throws Exception {
DescribeDBInstanceHAResponse self = new DescribeDBInstanceHAResponse();
return TeaModel.build(map, self);
}
public DescribeDBInstanceHAResponse setHeaders(java.util.Map<String, String> headers) {
this.headers = headers;
return this;
}
public java.util.Map<String, String> getHeaders() {
return this.headers;
}
public DescribeDBInstanceHAResponse setStatusCode(Integer statusCode) {
this.statusCode = statusCode;
return this;
}
public Integer getStatusCode() {
return this.statusCode;
}
public DescribeDBInstanceHAResponse setBody(DescribeDBInstanceHAResponseBody body) {
this.body = body;
return this;
}
public DescribeDBInstanceHAResponseBody getBody() {
return this.body;
}
}
| [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
36bdb4d9b089fc411cca0c684565733ce699b613 | ed5159d056e98d6715357d0d14a9b3f20b764f89 | /src/irvine/oeis/a042/A042346.java | 5f975929197ecc9487467d704f460532742b693d | [] | no_license | flywind2/joeis | c5753169cf562939b04dd246f8a2958e97f74558 | e5efd6971a0062ac99f4fae21a7c78c9f9e74fea | refs/heads/master | 2020-09-13T18:34:35.080552 | 2019-11-19T05:40:55 | 2019-11-19T05:40:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 586 | java | package irvine.oeis.a042;
// Generated by gen_seq4.pl cfsqnum 700 at 2019-07-04 11:03
// DO NOT EDIT here!
import irvine.oeis.ContinuedFractionOfSqrtSequence;
import irvine.math.z.Z;
/**
* A042346 Numerators of continued fraction convergents to <code>sqrt(700)</code>.
* @author Georg Fischer
*/
public class A042346 extends ContinuedFractionOfSqrtSequence {
/** Construct the sequence. */
public A042346() {
super(0, 700);
}
@Override
public Z next() {
final Z result = getNumerator();
iterate();
iterateConvergents();
return result;
} // next
}
| [
"sean.irvine@realtimegenomics.com"
] | sean.irvine@realtimegenomics.com |
7493008646e032ad6da5e54b8d12c8e5ab5e6d89 | a9434cb4c7f9d4572137fdd753c9d33d4ac9b0f3 | /Labs_IntellijIDE/Lab6_1/src/application/Main.java | 6ee8b189a4e80a43719688877735bb7e9336f471 | [] | no_license | shedinnmarble/A_MPP | c84e7367b8c81dff6738e6c8befe11cb9e2f3cfd | 2416584a35c6c8a3e5cf21b4f649a1de6196c78c | refs/heads/master | 2021-05-31T19:31:50.006806 | 2016-06-16T01:24:02 | 2016-06-16T01:24:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,466 | java | package application;
import java.awt.Font;
import java.awt.Insets;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import javafx.scene.text.FontWeight;
import javafx.scene.text.Text;
import javafx.stage.Stage;
public class Main extends Application {
@Override
public void start(Stage primaryStage) {
primaryStage.setTitle("Address Form");
GridPane grid = new GridPane();
grid.setAlignment(Pos.CENTER);
grid.setHgap(10);
grid.setVgap(10);
// grid.setPadding(new Insets(25, 25, 25, 25));
// Text scenetitle = new Text("Welcome");
// scenetitle.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
// grid.add(scenetitle, 0, 0, 2, 1);
Label lbName = new Label("Name:");
grid.add(lbName, 0, 1);
TextField txtName = new TextField();
grid.add(txtName, 0, 2);
Label lbStreet = new Label("Street");
grid.add(lbStreet, 1, 1);
TextField txtStreet = new TextField();
grid.add(txtStreet, 1, 2);
Label lbCity = new Label("City");
grid.add(lbCity, 2, 1);
TextField txtCity = new TextField();
grid.add(txtCity, 2, 2);
Label lbState = new Label("State");
grid.add(lbState, 0, 3);
TextField txtState = new TextField();
grid.add(txtState, 0, 4);
Label lbZip = new Label("Zip");
grid.add(lbZip, 1, 3);
TextField txtZip = new TextField();
grid.add(txtZip, 1, 4);
Button btn = new Button("Submit");
HBox hbBtn = new HBox(10);
hbBtn.setAlignment(Pos.BOTTOM_RIGHT);
hbBtn.getChildren().add(btn);
grid.add(hbBtn, 1, 5);
final Text actiontarget = new Text();
grid.add(actiontarget, 1, 6);
btn.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0) {
// TODO Auto-generated method stub
System.out.println(txtName.getText());
System.out.println(txtStreet.getText());
System.out.println(txtCity.getText() + ", " + txtState.getText() + ", " + txtZip.getText());
}
});
Scene scene = new Scene(grid, 500, 300);
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
| [
"yafengxiang@163.com"
] | yafengxiang@163.com |
c4c35e016fef162090cfee9b2ee9ccdbe0567ff4 | 0e26b937998e5612c8a4408dff6ce0b8cc440043 | /src/trees/TSChiefNode.java | 49a76365638b7a7757284ea1b37ad78dc78426cf | [] | no_license | dotnet54/TS-CHIEF | bd8931fd1ec57fc11f97853247ce8eab5f63c4e0 | 4a1f509b5bab51bb3a71f705ad7268e23323b81b | refs/heads/master | 2022-08-12T02:04:40.409766 | 2022-07-28T01:31:15 | 2022-07-28T01:31:15 | 168,066,854 | 48 | 12 | null | 2022-05-20T22:00:58 | 2019-01-29T01:24:47 | Java | UTF-8 | Java | false | false | 26,755 | java | package trees;
import application.AppConfig;
import core.exceptions.NotSupportedException;
import data.containers.TreeStatCollector;
import data.timeseries.*;
import gnu.trove.map.TIntIntMap;
import gnu.trove.map.TIntObjectMap;
import gnu.trove.map.hash.TIntObjectHashMap;
import trees.splitters.NodeSplitter;
import trees.splitters.boss.BossSplitter;
import trees.splitters.ee.ElasticDistanceSplitter;
import trees.splitters.ee.MultivariateElasticDistanceSplitter;
import distance.univariate.UnivarSimMeasure;
import trees.splitters.it.InceptionTimeSplitter;
import trees.splitters.randf.RandomForestSplitter;
import trees.splitters.rise.RISESplitter;
import trees.splitters.rotf.RotationForestSplitter;
import trees.splitters.rt.RocketTreeSplitter;
import trees.splitters.st.ForestShapeletTransformSplitter;
import trees.splitters.st.RandomShapeletTransformSplitter;
import util.Sampler;
import util.Util;
import java.util.ArrayList;
import java.util.List;
public class TSChiefNode {
protected transient TSChiefNode parent; //dont need this, but it helps to debug
public transient TSCheifTree tree;
protected int nodeID;
protected int nodeDepth = 0;
protected boolean isLeaf = false;
protected Integer label;
protected TIntObjectMap<TSChiefNode> children;
List<NodeSplitter> splitters;
List<NodeSplitter> topSplitters; //store the best ones to pick a random splitter if more than one are equal
NodeSplitter selectedBestsplitter;
//class distribution of data passed to this node during the training phase
protected TIntIntMap classDistribution;
protected String class_distribution_str = ""; //class distribution as a string, just for printing and debugging
public TSChiefNode(TSChiefNode parent, Integer label, int node_id, TSCheifTree tree) {
this.parent = parent;
this.nodeID = node_id;
this.tree = tree;
if (parent != null) {
nodeDepth = parent.nodeDepth + 1;
}
splitters = new ArrayList<NodeSplitter>(AppConfig.num_actual_splitters_needed);
topSplitters = new ArrayList<NodeSplitter>(2); //initial capacity is set to a small number, its unlikely that splitters would have same gini very often
}
public boolean isLeaf() {
return this.isLeaf;
}
public Integer label() {
return this.label;
}
public TIntObjectMap<TSChiefNode> getChildren() {
return this.children;
}
public String toString() {
return "d: " + class_distribution_str;// + this.data.toString();
}
public void fit(Dataset trainData, Indexer trainIndices) throws Exception {
// System.out.println(this.node_depth + ": " + (this.parent == null ? "r" : this.parent.node_id) +"->"+ this.node_id +":"+ data.toString());
//Debugging check
if (trainData == null) {
// throw new Exception("possible bug: empty node found");
// this.label = Util.majority_class(data);
this.isLeaf = true;
System.out.println("node data == null, returning");
return;
}
this.classDistribution = trainData.getClassDistribution(); //TODO do we need to clone it? nope
if (trainData.size() == 0) {
this.isLeaf = true;
System.out.println("node data.size == 0, returning");
return;
}
if (trainData.gini() == 0) {
this.label = trainData.getClass(0); //works if pure
this.isLeaf = true;
return;
}
// Minimum leaf size
if (trainData.size() <= AppConfig.min_leaf_size) {
this.label = Util.majority_class(trainData); //-- choose the majority class at the node
this.isLeaf = true;
return;
}
TIntObjectMap<Dataset> best_splits = fitSplitters(trainData, trainIndices);
//TODO refactor
if (best_splits == null || this.tree.has_empty_split(best_splits)) {
//stop training and create a new leaf
// throw new Exception("Empty leaf found");
this.label = Util.majority_class(trainData);
this.isLeaf = true;
// System.out.println("Empty split found...returning a leaf: " + this.class_distribution + " leaf_label: " + this.label);
return;
}
this.children = new TIntObjectHashMap<TSChiefNode>(best_splits.size());
// System.out.println(Arrays.toString(best_splits.keys()));
for (int key : best_splits.keys()) {
this.children.put(key, new TSChiefNode(this, key, ++tree.nodeCounter, tree));
this.children.get(key).class_distribution_str = best_splits.get(key).getClassDistribution().toString(); //TODO debug only mem- leak
}
for (int key : best_splits.keys()) {
TSChiefNode child = this.children.get(key);
// if (best_splits.get(key) == null || best_splits.get(key).size() == 0) {
//if this split has no data
//remove this child from the map
// System.out.println("removing empty or null node:" + key + " " + best_splits.get(key));
// this.children.remove(key);
// }else {
// double wgini_temp = Util.weighted_gini(best_splits, data.size());
//
// if (Math.abs(data.gini() - wgini_temp) < 0.00001) {
// System.out.println("\nWARN: best_split_wgini == parent gini: " + wgini_temp + " = " + best_splits.toString() + " --- " + data.toString());
// }
this.children.get(key).fit(best_splits.get(key), null);
// }
}
}
private TIntObjectMap<Dataset> fitSplitters(Dataset trainData, Indexer trainIndices) throws Exception {
long nodeFitStartTime = System.nanoTime();
int nodeSize = trainData.size();
TIntObjectMap<Dataset> splits = null;
TIntObjectMap<Dataset> bestSplit = null;
double weightedGini = Double.POSITIVE_INFINITY;
double bestWeightedGini = Double.POSITIVE_INFINITY;
TreeStatCollector stats = this.tree.stats;
RISESplitter temp_rif;
//TODO HIGH PRIORITY -- increases runtime a lot, can be avoided if using indices at all places
// but using indices always means we have to use double referencing to access data
// just measuring actual time taken to prepare indices at train time, if this grows with increasing
// training size this is an important bottleneck for training time.
long nodeDataPrepStartTime = System.nanoTime();
ArrayIndex nodeIndices = new ArrayIndex(this.tree.treeLevelTrainingData);
nodeIndices.sync(trainData);
this.tree.stats.data_fetch_time += (System.nanoTime() - nodeDataPrepStartTime);
// NOTE: each splitter may evaluate 1 or more candidate splits, depending on implementation of the splitter
initializeSplitters(trainData);
int numSplitters = splitters.size();
//if we are fitting on a sample, currently we use all data at the node, but this could be useful for large
//datasets
Dataset trainingSample;
if (AppConfig.gini_approx) {
trainingSample = sample(trainData, AppConfig.approx_gini_min, AppConfig.approx_gini_min_per_class);
}else {
trainingSample = trainData; //save time by not copying all the data, if we do gini on 100% data
}
for (int i = 0; i < numSplitters; i++) {
long startTime = System.nanoTime();
NodeSplitter currentSplitter = splitters.get(i);
if (currentSplitter instanceof ElasticDistanceSplitter ||
currentSplitter instanceof MultivariateElasticDistanceSplitter) {
//splitter.train(numSplitters)
splits = currentSplitter.fit(trainData, nodeIndices);
stats.ee_time += (System.nanoTime() - startTime);
}else if (currentSplitter instanceof RandomForestSplitter) {
//splitter.train(numSplitters)
splits = currentSplitter.fit(trainData, nodeIndices);
//splitter.test(numSplitters')
// splits = splitters[i].split(data, null);
stats.randf_time += (System.nanoTime() - startTime);
}else if (currentSplitter instanceof RotationForestSplitter) {
//splitter.train(numSplitters)
splits = currentSplitter.fit(trainData, nodeIndices);
//splitter.test(numSplitters')
// splits = splitters[i].split(data, null);
stats.rotf_time += (System.nanoTime() - startTime);
}else if (currentSplitter instanceof RandomShapeletTransformSplitter
|| currentSplitter instanceof ForestShapeletTransformSplitter) {
//TODO
splits = currentSplitter.fit(trainData, nodeIndices);
stats.st_time += (System.nanoTime() - startTime);
}else if (currentSplitter instanceof BossSplitter) {
//splitter.train(numSplitters)
splits = currentSplitter.fit(trainData, nodeIndices);
//splitter.test(numSplitters')
// splits = splitters[i].split(data, null);
stats.boss_time += (System.nanoTime() - startTime);
// }else if (currentSplitter instanceof TSFSplitter) {
// //splitter.train(numSplitters)
// splits = currentSplitter.fit(trainData, nodeIndices);
// //splitter.test(numSplitters')
//// splits = splitters[i].split(data, null);
// stats.tsf_time += (System.nanoTime() - startTime);
}else if (currentSplitter instanceof RISESplitter) {
//splitter.train(numSplitters)
splits = currentSplitter.fit(trainData, nodeIndices);
//splitter.test(numSplitters')
// splits = splitters[i].split(data, null);
long delta = System.nanoTime() - startTime;
stats.rif_time += (delta);
temp_rif = (RISESplitter) currentSplitter;
if (temp_rif.filterType.equals(AppConfig.RifFilters.ACF)) {
stats.rif_acf_time+=delta;
}else if (temp_rif.filterType.equals(AppConfig.RifFilters.PACF)) {
stats.rif_pacf_time+=delta;
}else if (temp_rif.filterType.equals(AppConfig.RifFilters.ARMA)) {
stats.rif_arma_time+=delta;
}else if (temp_rif.filterType.equals(AppConfig.RifFilters.PS)) {
stats.rif_ps_time+=delta;
}else if (temp_rif.filterType.equals(AppConfig.RifFilters.DFT)) {
stats.rif_dft_time+=delta;
}
}else {
//splitter.train(numSplitters)
splits = currentSplitter.fit(trainData, nodeIndices);
//splitter.test(numSplitters')
// splits = splitters[i].split(data, null);
//TODO stat update in constructor
// throw new Exception("Unsupported Splitter Type");
}
weightedGini = weighted_gini(nodeSize, splits);
if (AppConfig.verbosity > 4) {
System.out.print(" S" + i + ": " + currentSplitter.toString() + ", wgini=" + AppConfig.df.format(weightedGini) +", parent=" + trainingSample);
System.out.print( " -->splits =");
for (int key : splits.keys()) {
System.out.print(" " + splits.get(key).toString());
}
System.out.println();
}
//TODO if equal take a random choice? or is it fine without it
if (weightedGini < bestWeightedGini) {
bestWeightedGini = weightedGini;
bestSplit = splits;
selectedBestsplitter = currentSplitter;
topSplitters.clear();
topSplitters.add(currentSplitter);
}else if (weightedGini == bestWeightedGini) { //NOTE if we enable this then we need update bestSplit again -expensive
topSplitters.add(splitters.get(i));
}
}
//failed to find any valid split point
if (topSplitters.size() == 0) {
return null;
}else if (topSplitters.size() == 1) {
selectedBestsplitter = topSplitters.get(0); //then use stored best split
}else { //if we have more than one splitter with equal best gini
int r = AppConfig.getRand().nextInt(topSplitters.size());
selectedBestsplitter = topSplitters.get(r);
// then we need to find the best split again, can't reuse best split we stored before.
bestSplit = selectedBestsplitter.split(trainData, nodeIndices);
if (AppConfig.verbosity > 4) {
System.out.println("best_splitters.size() == " + topSplitters.size());
}
}
//split the whole dataset using the (approximately) best splitter
// bestSplit = best_splitter.split(data, null); //TODO check
//allow gc to deallocate unneeded memory
// for (int j = 0; j < splitters.length; j++) {
// if (splitters[j] != best_splitter) {
// splitters[j] = null;
// }
// }
splitters = null;
topSplitters.clear();//clear the memory
if (AppConfig.verbosity > 4) {
System.out.print(" BEST:" + selectedBestsplitter.toString() + ", wgini:" + AppConfig.df.format(bestWeightedGini) + ", splits:");
for (int key : bestSplit.keys()) {
System.out.print(" " + bestSplit.get(key).toString());
}
System.out.println();
}
// storeStatsForBestSplitter(); //TODO temp disabled
// if (has_empty_split(bestSplit)) {
// throw new Exception("empty splits found! check for bugs");//
// }
this.tree.stats.split_evaluator_train_time += (System.nanoTime() - nodeFitStartTime);
return bestSplit;
}
private void initializeSplitters(Dataset trainData) throws Exception {
int n = AppConfig.num_splitters_per_node;
int total_added = 0;
if (AppConfig.ee_enabled) {
for (int i = 0; i < AppConfig.ee_splitters_per_node; i++) {
if (trainData.isMultivariate()){
splitters.add(new MultivariateElasticDistanceSplitter(this));
}else{
splitters.add(new ElasticDistanceSplitter(this));
}
total_added++;
}
}
if (AppConfig.randf_enabled) {
for (int i = 0; i < AppConfig.randf_splitters_per_node; i++) {
// splitters[total_added++] = new RandomForestSplitter(node);
if (AppConfig.randf_feature_selection == AppConfig.FeatureSelectionMethod.ConstantInt) {
splitters.add(new RandomForestSplitter(this, AppConfig.randf_m));
}else {
splitters.add(new RandomForestSplitter(this, AppConfig.randf_feature_selection));
}
total_added++;
}
}
if (AppConfig.rotf_enabled) {
for (int i = 0; i < AppConfig.rotf_splitters_per_node; i++) {
splitters.add(new RotationForestSplitter(this));
total_added++;
}
}
if (AppConfig.st_enabled) {
for (int i = 0; i < AppConfig.st_splitters_per_node; i++) {
if (AppConfig.st_param_selection == AppConfig.ParamSelection.Random) {
splitters.add(new RandomShapeletTransformSplitter(this));
}else if (AppConfig.st_param_selection == AppConfig.ParamSelection.PreLoadedParams ||
AppConfig.st_param_selection == AppConfig.ParamSelection.PraLoadedDataAndParams) {
splitters.add(new ForestShapeletTransformSplitter(this));
total_added++;
break; //NOTE: if using ForestShapeletTransformSplitter -- FeatureSelectionMethod.ConstantInt is used to set m of the gini splitter to get the correct #gini required
}else {
throw new Exception("Unsupported parameter selection method for shapelet splitter -- invalid arg: -st_params ");
}
total_added++;
}
}
if (AppConfig.boss_enabled) {
for (int i = 0; i < AppConfig.boss_splitters_per_node; i++) {
if (AppConfig.boss_split_method == AppConfig.SplitMethod.RandomTreeStyle) {
// splitters.add(new BossBinarySplitter(this));
throw new NotSupportedException();
}else {
splitters.add(new BossSplitter(this));
}
total_added++;
}
}
if (AppConfig.tsf_enabled) {
throw new NotSupportedException();
// for (int i = 0; i < AppConfig.num_actual_tsf_splitters_needed; i++) {
// splitters.add(new TSFSplitter(this));
// total_added++;
// }
}
if (AppConfig.rif_enabled) {
//TODO if only FeatureSelectionMethod.ConstantInt
// if (AppContext.rif_feature_selection == FeatureSelectionMethod.ConstantInt) {
//
//// int num_gini_per_splitter = AppContext.rif_splitters_per_node / 4; // eg. if we need 12 gini per type 12 ~= 50/4
//// int num_intervals = (int) Math.ceil((float)num_gini_per_splitter / (float)AppContext.rif_min_interval); // 2 = ceil(12 / 9)
//// int max_attribs_needed_per_rif_type = (int) Math.ceil(num_gini_per_splitter / num_intervals);
//// binary_splitter.m = Math.min(trans.length(), max_attribs_needed_per_rif_type);// 6 = 12 / 2
//
// binary_splitter.m = Math.min(trans.length(), AppContext.rif_m);// 6 = 12 / 2
//
// if (AppContext.verbosity > 1) {
//// System.out.println("rif m updated to: " + binary_splitter.m);
// }
// }
// int approx_total_gini = 0;
// int min_gini_per_group = AppContext.rif_min_interval * 4;
// int min_splitters_per_type = (int) Math.ceil((float)AppContext.rif_splitters_per_node / (float)(min_gini_per_group));
// int estimated_max_gini = min_splitters_per_type * min_gini_per_group;
// int remaining_gini = estimated_max_gini;
//
// int num_gini_per_type = AppContext.rif_splitters_per_node / 4;
// int extra_gini = AppContext.rif_splitters_per_node % 4;
// int min_splitters_needed_per_type = (int) Math.ceil((float)num_gini_per_type / (float)AppContext.rif_min_interval);
// int max_attribs_to_use_per_splitter = (int) Math.ceil(num_gini_per_type / min_splitters_needed_per_type);
// AppContext.num_actual_rif_splitters_needed_per_type = min_splitters_needed_per_type;
// AppContext.rif_m = max_attribs_to_use_per_splitter;
// int approx_gini_estimated = 4 * max_attribs_to_use_per_splitter * min_splitters_needed_per_type;
// System.out.println("RISE: approx_gini_estimated: " + approx_gini_estimated);
//
int rif_total = AppConfig.num_actual_rif_splitters_needed_per_type * 4;
int reminder_gini = AppConfig.rif_splitters_per_node - (AppConfig.rif_m * rif_total);
int m;
for (int i = 0; i < rif_total; i++) {
if (AppConfig.rif_components == AppConfig.RifFilters.ACF_PACF_ARMA_PS_separately) {
RISESplitter splitter;
//TODO quick fix to make sure that rif_splitters_per_node of ginis are actually calculated
if (reminder_gini > 0) {
m = AppConfig.rif_m + 1;
reminder_gini--;
}else {
m = AppConfig.rif_m;
}
//divide appox equally (best if divisible by 4)
if (i % 4 == 0) {
RISESplitter sp = new RISESplitter(this, AppConfig.RifFilters.ACF, m);
splitters.add(sp);
}else if (i % 4 == 1) {
RISESplitter sp = new RISESplitter(this, AppConfig.RifFilters.PACF, m);
splitters.add(sp);
}else if (i % 4 == 2) {
RISESplitter sp = new RISESplitter(this, AppConfig.RifFilters.ARMA, m);
splitters.add(sp);
}else if (i % 4 == 3) {
RISESplitter sp = new RISESplitter(this, AppConfig.RifFilters.PS, m);
splitters.add(sp);
}
}else {
splitters.add(new RISESplitter(this, AppConfig.rif_components));
}
total_added++;
}
} //rise
if (AppConfig.it_enabled) {
for (int i = 0; i < AppConfig.it_splitters_per_node; i++) {
splitters.add(new InceptionTimeSplitter(this));
total_added++;
}
}
// if (AppConfig.rt_enabled) {
// for (int i = 0; i < AppConfig.rt_splitters_per_node; i++) {
// splitters.add(new RocketTreeSplitter(node));
// total_added++;
// }
// }
//ASSERT total_added == AppContext.num_actual_splitters_needed
}
private void storeStatsForBestSplitter() {
if (selectedBestsplitter instanceof ElasticDistanceSplitter
|| selectedBestsplitter instanceof MultivariateElasticDistanceSplitter) {
this.tree.stats.ee_win++;
UnivarSimMeasure dm = ((ElasticDistanceSplitter) selectedBestsplitter).getSimilarityMeasure();
switch (dm.distance_measure) {
case euclidean:
this.tree.stats.euc_win++;
break;
case dtw:
this.tree.stats.dtw_win++;
break;
case dtwcv:
this.tree.stats.dtwr_win++;
break;
case ddtw:
this.tree.stats.ddtw_win++;
break;
case ddtwcv:
this.tree.stats.ddtwr_win++;
break;
case wdtw:
this.tree.stats.wdtw_win++;
break;
case wddtw:
this.tree.stats.wddtw_win++;
break;
case lcss:
this.tree.stats.lcss_win++;
break;
case twe:
this.tree.stats.twe_win++;
break;
case erp:
this.tree.stats.erp_win++;
break;
case msm:
this.tree.stats.msm_win++;
break;
default:
break;
}
}else if (selectedBestsplitter instanceof RandomForestSplitter) {
this.tree.stats.randf_win++;
}else if (selectedBestsplitter instanceof RotationForestSplitter) {
this.tree.stats.rotf_win++;
}else if (selectedBestsplitter instanceof RandomShapeletTransformSplitter) {
this.tree.stats.st_win++;
//store shapelet that won
RandomShapeletTransformSplitter temp = (RandomShapeletTransformSplitter) selectedBestsplitter;
this.tree.getForest().getExpResultCollection().winShapelets.add(temp.best_shapelet.toString());
}else if (selectedBestsplitter instanceof ForestShapeletTransformSplitter) {
this.tree.stats.st_win++;
//store shapelet that won
ForestShapeletTransformSplitter temp = (ForestShapeletTransformSplitter) selectedBestsplitter;
this.tree.getForest().getExpResultCollection().winShapelets.add(temp.best_shapelet.toString());
}else if (selectedBestsplitter instanceof BossSplitter) {
this.tree.stats.boss_win++;
// }else if (selectedBestsplitter instanceof TSFSplitter) {
// this.tree.stats.tsf_win++;
}else if (selectedBestsplitter instanceof RISESplitter) {
this.tree.stats.rif_win++;
RISESplitter rif = (RISESplitter) selectedBestsplitter;
if (rif.filterType.equals(AppConfig.RifFilters.ACF)) {
this.tree.stats.rif_acf_win++;
}else if (rif.filterType.equals(AppConfig.RifFilters.PACF)) {
this.tree.stats.rif_pacf_win++;
}else if (rif.filterType.equals(AppConfig.RifFilters.ARMA)) {
this.tree.stats.rif_arma_win++;
}else if (rif.filterType.equals(AppConfig.RifFilters.PS)) {
this.tree.stats.rif_ps_win++;
}else if (rif.filterType.equals(AppConfig.RifFilters.DFT)) {
this.tree.stats.rif_dft_win++;
}
}else if (selectedBestsplitter instanceof InceptionTimeSplitter) {
this.tree.stats.it_win++;
}else if (selectedBestsplitter instanceof RocketTreeSplitter) {
this.tree.stats.rt_win++;
}
}
public static boolean has_empty_split(TIntObjectMap<Dataset> splits) throws Exception {
for (int key : splits.keys()) {
if (splits.get(key) == null || splits.get(key).size() == 0) {
return true;
}
}
return false;
}
//takes the min(gini_min * #class_root, n)
private Dataset sample(Dataset data, int approx_gini_min, boolean approx_gini_min_per_class) throws Exception {
Dataset sample;
int sample_size;
//use number of classes in the root
if (approx_gini_min_per_class) {
sample_size = Math.min(approx_gini_min * AppConfig.getTrainingSet().getNumClasses(), data.size());
}else {
sample_size = Math.min(approx_gini_min, data.size());
}
sample = Sampler.uniform_sample(data, sample_size);
return sample;
}
public int predict(Dataset testData, TimeSeries query, int queryIndex) throws Exception {
return selectedBestsplitter.predict(query, testData, queryIndex);
}
public double weighted_gini(double parent_size, TIntObjectMap<Dataset> splits) throws Exception {
double wgini = 0.0;
double gini;
double split_size = 0;
if (splits == null) {
return Double.POSITIVE_INFINITY;
}
for (int key : splits.keys()) {
if (splits.get(key) == null) { //NOTE
gini = 1;
split_size = 0;
}else {
gini = splits.get(key).gini();
split_size = (double) splits.get(key).size();
}
wgini = wgini + (split_size / parent_size) * gini;
}
return wgini;
}
}
| [
"dotnet54@gmail.com"
] | dotnet54@gmail.com |
31778e5981ad14adc6daaac8777bcd697e2398f7 | 1f0913862f4e1973ac512e82cd91503fe625a6f8 | /src/br/com/SIGEC/web/filter/FiltroAdminLogado.java | b885c4410856004fdc509c976f3584804ef0f286 | [] | no_license | humberto789/SIGEC | a370722100cf7573382ed00d11d5219ed7f815f0 | ad1fe16485e1a9a5ba9caf7d0aee58f2d541230d | refs/heads/master | 2021-06-19T18:38:38.429730 | 2021-05-31T23:58:00 | 2021-05-31T23:58:00 | 218,677,110 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,599 | java | package br.com.SIGEC.web.filter;
import java.io.IOException;
import javax.faces.bean.ManagedBean;
import javax.faces.context.FacesContext;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import br.com.SIGEC.model.Usuario;
@WebFilter(urlPatterns={"/admin/*"})
@ManagedBean
public class FiltroAdminLogado implements Filter{
@Override
public void destroy() {
// TODO Auto-generated method stub
}
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
HttpServletRequest httpServletRequest = (HttpServletRequest) request;
HttpSession session = httpServletRequest .getSession(true);
Usuario usuario = (Usuario) session.getAttribute("usuario_logado");
if(usuario!=null) {
if(usuario.getTipoUsuario().equals("admin")) {
chain.doFilter(request, response);
}else {
HttpServletResponse resp = (HttpServletResponse)response;
resp.sendRedirect("/SIGEC/error/403.jsf");
}
}else {
HttpServletResponse resp = (HttpServletResponse)response;
resp.sendRedirect("/SIGEC/login.jsf");
return;
}
}
@Override
public void init(FilterConfig arg0) throws ServletException {
// TODO Auto-generated method stub
}
} | [
"56692368+humberto789@users.noreply.github.com"
] | 56692368+humberto789@users.noreply.github.com |
2ecb59d709831bd13abe8eacaa5646f8b4de7aba | 0cd99e4d4139b1494a3268e72e9b9e4f42f2cfb9 | /2.0版本/ssmBuild/src/main/java/com/wzh/pojo/Books.java | af15aab9a75a745ce12fd55fc8b0d788a1341464 | [] | no_license | wangzh98/ssm-init | b9d1bfbb722456d28d4e9454ba98a7461ce136eb | d35f07f717ffde624c7e6c2471fbfb0ed7d50402 | refs/heads/master | 2023-03-28T02:36:32.934243 | 2021-03-07T16:43:35 | 2021-03-07T16:43:35 | 345,398,899 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 288 | java | package com.wzh.pojo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Books {
private int bookID;
private String bookName;
private int bookCounts;
private String detail;
}
| [
"78910421@qq.com"
] | 78910421@qq.com |
ddd527cfee422d87e42f41cda665362758ac62a5 | bccb412254b3e6f35a5c4dd227f440ecbbb60db9 | /hl7/model/V2_5/table/Table0533.java | 30a3608c5787cd16dde6dc2afadad2c19f93df19 | [] | no_license | nlp-lap/Version_Compatible_HL7_Parser | 8bdb307aa75a5317265f730c5b2ac92ae430962b | 9977e1fcd1400916efc4aa161588beae81900cfd | refs/heads/master | 2021-03-03T15:05:36.071491 | 2020-03-09T07:54:42 | 2020-03-09T07:54:42 | 245,967,680 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 347 | java | package hl7.model.V2_5.table;
import hl7.bean.table.Table;
public class Table0533 extends Table{
private static final String VERSION = "2.5";
public static Table getInstance(){
if(table==null) new Table0533();
return table;
}
private Table0533(){
setTableName("Application error code");
setOID("2.16.840.1.113883.12.533");
}
}
| [
"terminator800@hanmail.net"
] | terminator800@hanmail.net |
8e5f5a5c6b107e77b51cc14b4cc947e6783fa413 | bf6a45e816a586c03a98a8da9ac1363e9ebca4a3 | /src/main/java/com/leothon/bookAppoint/entity/Appointment.java | ff3c389ac887e3db923b01c6866cfdb610bcc192 | [] | no_license | Leothon/SSM- | 6347c0f6eae34a6b04d461d33861d4d5e667cc05 | 5eb5e6acd6baab6856ff00bada8f5802241daa79 | refs/heads/master | 2020-04-13T03:55:04.708461 | 2018-12-24T03:28:29 | 2018-12-24T03:28:29 | 162,945,710 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 984 | java | package com.leothon.bookAppoint.entity;
import java.util.Date;
public class Appointment {
private long bookId;
private long studentId;
private Date appointTime;
private Book book;
public long getBookId() {
return bookId;
}
public void setBookId(long bookId) {
this.bookId = bookId;
}
public long getStudentId() {
return studentId;
}
public void setStudentId(long studentId) {
this.studentId = studentId;
}
public Date getAppointTime() {
return appointTime;
}
public void setAppointTime(Date appointTime) {
this.appointTime = appointTime;
}
public Book getBook() {
return book;
}
public void setBook(Book book) {
this.book = book;
}
@Override
public String toString() {
return "预约内容:{ 图书ID" + bookId + ", 学生ID" + studentId +", 预约时间" + appointTime + ", 图书信息:" + book + "}";
}
}
| [
"langmancaizi@gmail.com"
] | langmancaizi@gmail.com |
de15769c5e7431ac5dc7cc326d97857b1edee6a9 | 37d044a16db17b463b21c05bd7a252bd889d8d56 | /OOP-Workspace/bookmarksversion2-app/src/com/techlabs/service/DataManger.java | 75d4c0057c4d25b3003795f40d02d9b1523fdcb1 | [] | no_license | vinodwalkunde/Swabhav | 2db1ac6ee002cba2a4b6dbec75d0560b3a1391dc | 8dce9aabf3d348886b6003c6c8d20f79d01d5aa7 | refs/heads/master | 2023-01-11T08:53:49.574444 | 2021-04-24T04:14:29 | 2021-04-24T04:14:29 | 164,393,705 | 0 | 1 | null | 2022-12-30T06:29:11 | 2019-01-07T07:22:11 | Java | UTF-8 | Java | false | false | 891 | java | package com.techlabs.service;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import com.techlabs.businesslogic.Bookmarks;
public class DataManger implements IBookMarks {
public static List<String> bookmarksList = new ArrayList<String>();
@Override
public void addBookmarks(String name, String url) throws IOException {
Bookmarks bookmarks = new Bookmarks(name, url);
FileWriter fw = new FileWriter("data//data.txt", true);
fw.write(name + "," + url + "\n");
fw.close();
}
@Override
public List<String> viewBookmarks() throws FileNotFoundException {
File file = new File("data//data.txt");
Scanner sc = new Scanner(file);
while (sc.hasNextLine()) {
bookmarksList.add(sc.nextLine());
}
return bookmarksList;
}
}
| [
"vinodwalkunde@gmail.com"
] | vinodwalkunde@gmail.com |
eda94163d6102f9795d311290d21f60d02570d97 | bea07d2b3b45846b0b89da6e70e8cbaae78bbf37 | /BOJ/J20437.java | d91dcfb6140dee4973891abfe2f8fc5350412a1f | [] | no_license | lee95292/AlgoGaza | 01fcd8d936673c4027bad1a1238c3e371f2a5251 | 2ff2540fa9a8243c341ad3fb14eef276b2c5840e | refs/heads/master | 2023-08-16T09:51:55.217911 | 2023-08-15T07:26:51 | 2023-08-15T07:26:51 | 210,504,292 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,696 | java | package BOJ;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class J20437 {
public static void main(String[] args)throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int tc = Integer.parseInt(br.readLine());
for(int t=0; t<tc; t++){
String s = br.readLine();
int k = Integer.parseInt(br.readLine());
Map<Character, List<Integer>> codeMap = new HashMap<>();
for(char a = 'a'; a <='z'; a++){
codeMap.put(a, new ArrayList<>());
}
int std = 0;
for(int i=0; i<s.length(); i++){
codeMap.get(s.charAt(i)).add(i);
std = Math.max(codeMap.get(s.charAt(i)).size(), std);
}
if(std < k){
System.out.println(-1);
continue;
}
int min = Integer.MAX_VALUE, max = Integer.MIN_VALUE;
for(char a = 'a';a<='z';a++){
List<Integer> idxs = codeMap.get(a);
if(idxs.size() <k ) continue;
for(int i=k-1; i<idxs.size(); i++){
int st = i-k+1, stval = idxs.get(i-k+1);
int ed = i, edval = idxs.get(i);
int len = edval - stval + 1;
if(min > len) min = len;
if(max < len) max = len;
}
}
System.out.println(min+" "+max);
// System.out.println(codeMap.toString());
}
}
}
| [
"lee95292@naver.com"
] | lee95292@naver.com |
9a6ad22bd0d926a816ebba761b95bcc1fbbbc24a | f604e736e8bb2d4065712efbd0ca60b4bbe8fb76 | /CodingExercise1/src/academy/learnprogramming/Main.java | ba509ab754cf19023015a56a2799d3ed079f4ad0 | [] | no_license | joaovfonsecad/AulasUdemyJava | 0559363da9344cd8a7327ca94a43c96f8408c30d | d03bedc22b68b95790f9171a1c62bf356f7ea318 | refs/heads/main | 2023-08-07T11:08:36.876216 | 2021-09-26T19:36:47 | 2021-09-26T19:36:47 | 410,644,216 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 708 | java | package academy.learnprogramming;
public class Main {
public static long toMilesPerHour (double kilometersPerHour){
double milesPerHour;
if (kilometersPerHour < 0){
return -1;
}
else {
milesPerHour = Math.round(kilometersPerHour / 1.609);
return (long) milesPerHour;
}
}
public static void printConversion (double kilometersPerHour){
long milesPerHour = toMilesPerHour(kilometersPerHour);
if (kilometersPerHour < 0 ){
System.out.println("Invalid Value");
}
else {
System.out.println(kilometersPerHour + " km/h = " + milesPerHour + " mi/h");
}
}
}
| [
"joaovfonsecad@gmail.com"
] | joaovfonsecad@gmail.com |
5455508c0f8c1555e53efb1e847a2dca46479930 | 50a2586d9b71ee4aa985881dd076cecec3b208ca | /src/com/training_session3/PracticeExcercice1.java | 971a9d392a557e20a70146ac918a134126ce10b7 | [] | no_license | mahe84b/excercise1 | eae3ddc2597d3f7fc8661ad99085f4d436f69199 | 6e182c6462752a0d2a007f1b6d9325cd73a77898 | refs/heads/main | 2023-02-23T12:22:01.803081 | 2021-01-29T17:22:20 | 2021-01-29T17:22:20 | 319,001,042 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 661 | java | package com.training_session3;
/*
Ex1)
Given an array A of 1 dim, find a new array formed by adding each element of the given array with the largest element in the new array to its left.
Examples:
Input: arr[] = {5, 1, 6, -3, 2}
Output: {5, 6, 12, 9, 14}
*/
public class PracticeExcercice1 extends Main {
int[] SummingElementsToLeft()
{
int[] input_array = {5, 1, 6, -3, 2};
int[] output_array = new int[input_array.length];
int incremental_sum = 0;
for(int i=0; i<input_array.length; i++)
{
output_array[i] = incremental_sum += input_array[i];
}
return output_array;
}
}
| [
"mahesh.kumar@adstate.com"
] | mahesh.kumar@adstate.com |
020869a55fae5a5bd2407ae637dc7ff53bda2fe6 | f8e0798b34a8772e6aa16d2a46de856fe3a2546e | /app/src/main/java/com/example/anjana/pescom/call/AudioEncoder.java | d4907cabdaef54a7e81b5bb17bd54e530d574e38 | [] | no_license | TeamSwagmunchkins/pescom-android | 2ceeceb964301c7ace30ff42e4c883822892f955 | b9e345996afbfb05010a3e94f82abeba9c566e5d | refs/heads/master | 2021-01-10T15:08:46.259256 | 2016-04-22T07:22:27 | 2016-04-22T07:28:13 | 54,314,280 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 993 | java | package com.example.anjana.pescom.call;
import android.util.Log;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;
public class AudioEncoder {
private DataOutputStream mOutputStream;
public AudioEncoder(OutputStream outputStream) {
mOutputStream = new DataOutputStream(outputStream);
}
public void write(short[] buffer, int offset, int bufLen) throws IOException {
// Log.d("PHILIP", "writing " + bufLen);
for(int i = offset; i< offset + bufLen; i++) {
byte b1 = (byte) (buffer[i] & 0xFF);
byte b2 = (byte) (buffer[i] >> 8);
// Log.d("PHILIP", "writing " + b1);
mOutputStream.write(b1);
// Log.d("PHILIP", "writing " + b2);
mOutputStream.write(b2);
}
}
public void flush() throws IOException {
mOutputStream.flush();
}
public void close() throws IOException {
mOutputStream.close();
}
}
| [
"adithyaphilip@gmail.com"
] | adithyaphilip@gmail.com |
8d2c865da5640221c9c7af8319c68de328427946 | 945a38d4fc4885a4db1c4e3a91cac07578d7dcfe | /g4-core/src/main/java/org/g4studio/core/net/examples/TelnetClientExample.java | f844d70ac0ce948abdb24be357d32fc94442c6d0 | [] | no_license | hongweichang/mg4 | 3b8a71809fb76193cb862a455fc2adc9d5804a72 | edb9a3d56a35cb77abfcf650967c65f3338c3aee | refs/heads/master | 2020-12-29T00:25:38.105899 | 2014-03-05T07:00:27 | 2014-03-05T07:00:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,221 | java | package org.g4studio.core.net.examples;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.StringTokenizer;
import org.g4studio.core.net.telnet.EchoOptionHandler;
import org.g4studio.core.net.telnet.InvalidTelnetOptionException;
import org.g4studio.core.net.telnet.SimpleOptionHandler;
import org.g4studio.core.net.telnet.SuppressGAOptionHandler;
import org.g4studio.core.net.telnet.TelnetClient;
import org.g4studio.core.net.telnet.TelnetNotificationHandler;
import org.g4studio.core.net.telnet.TerminalTypeOptionHandler;
/**
* This is a simple example of use of TelnetClient.
* An external option handler (SimpleTelnetOptionHandler) is used.
* Initial configuration requested by TelnetClient will be:
* WILL ECHO, WILL SUPPRESS-GA, DO SUPPRESS-GA.
* VT100 terminal type will be subnegotiated.
* <p/>
* Also, use of the sendAYT(), getLocalOptionState(), getRemoteOptionState()
* is demonstrated.
* When connected, type AYT to send an AYT command to the server and see
* the result.
* Type OPT to see a report of the state of the first 25 options.
* <p/>
*
* @author Bruno D'Avanzo
* *
*/
public class TelnetClientExample implements Runnable, TelnetNotificationHandler {
static TelnetClient tc = null;
/**
* Main for the TelnetClientExample.
* *
*/
public static void main(String[] args) throws IOException {
FileOutputStream fout = null;
if (args.length < 1) {
System.err.println("Usage: TelnetClientExample1 <remote-ip> [<remote-port>]");
System.exit(1);
}
String remoteip = args[0];
int remoteport;
if (args.length > 1) {
remoteport = (new Integer(args[1])).intValue();
} else {
remoteport = 23;
}
try {
fout = new FileOutputStream("spy.log", true);
} catch (Exception e) {
System.err.println(
"Exception while opening the spy file: "
+ e.getMessage());
}
tc = new TelnetClient();
TerminalTypeOptionHandler ttopt = new TerminalTypeOptionHandler("VT100", false, false, true, false);
EchoOptionHandler echoopt = new EchoOptionHandler(true, false, true, false);
SuppressGAOptionHandler gaopt = new SuppressGAOptionHandler(true, true, true, true);
try {
tc.addOptionHandler(ttopt);
tc.addOptionHandler(echoopt);
tc.addOptionHandler(gaopt);
} catch (InvalidTelnetOptionException e) {
System.err.println("Error registering option handlers: " + e.getMessage());
}
while (true) {
boolean end_loop = false;
try {
tc.connect(remoteip, remoteport);
Thread reader = new Thread(new TelnetClientExample());
tc.registerNotifHandler(new TelnetClientExample());
System.out.println("TelnetClientExample");
System.out.println("Type AYT to send an AYT telnet command");
System.out.println("Type OPT to print a report of status of options (0-24)");
System.out.println("Type REGISTER to register a new SimpleOptionHandler");
System.out.println("Type UNREGISTER to unregister an OptionHandler");
System.out.println("Type SPY to register the spy (connect to port 3333 to spy)");
System.out.println("Type UNSPY to stop spying the connection");
reader.start();
OutputStream outstr = tc.getOutputStream();
byte[] buff = new byte[1024];
int ret_read = 0;
do {
try {
ret_read = System.in.read(buff);
if (ret_read > 0) {
if ((new String(buff, 0, ret_read)).startsWith("AYT")) {
try {
System.out.println("Sending AYT");
System.out.println("AYT response:" + tc.sendAYT(5000));
} catch (Exception e) {
System.err.println("Exception waiting AYT response: " + e.getMessage());
}
} else if ((new String(buff, 0, ret_read)).startsWith("OPT")) {
System.out.println("Status of options:");
for (int ii = 0; ii < 25; ii++)
System.out.println("Local Option " + ii + ":" + tc.getLocalOptionState(ii) + " Remote Option " + ii + ":" + tc.getRemoteOptionState(ii));
} else if ((new String(buff, 0, ret_read)).startsWith("REGISTER")) {
StringTokenizer st = new StringTokenizer(new String(buff));
try {
st.nextToken();
int opcode = (new Integer(st.nextToken())).intValue();
boolean initlocal = (new Boolean(st.nextToken())).booleanValue();
boolean initremote = (new Boolean(st.nextToken())).booleanValue();
boolean acceptlocal = (new Boolean(st.nextToken())).booleanValue();
boolean acceptremote = (new Boolean(st.nextToken())).booleanValue();
SimpleOptionHandler opthand = new SimpleOptionHandler(opcode, initlocal, initremote,
acceptlocal, acceptremote);
tc.addOptionHandler(opthand);
} catch (Exception e) {
if (e instanceof InvalidTelnetOptionException) {
System.err.println("Error registering option: " + e.getMessage());
} else {
System.err.println("Invalid REGISTER command.");
System.err.println("Use REGISTER optcode initlocal initremote acceptlocal acceptremote");
System.err.println("(optcode is an integer.)");
System.err.println("(initlocal, initremote, acceptlocal, acceptremote are boolean)");
}
}
} else if ((new String(buff, 0, ret_read)).startsWith("UNREGISTER")) {
StringTokenizer st = new StringTokenizer(new String(buff));
try {
st.nextToken();
int opcode = (new Integer(st.nextToken())).intValue();
tc.deleteOptionHandler(opcode);
} catch (Exception e) {
if (e instanceof InvalidTelnetOptionException) {
System.err.println("Error unregistering option: " + e.getMessage());
} else {
System.err.println("Invalid UNREGISTER command.");
System.err.println("Use UNREGISTER optcode");
System.err.println("(optcode is an integer)");
}
}
} else if ((new String(buff, 0, ret_read)).startsWith("SPY")) {
try {
tc.registerSpyStream(fout);
} catch (Exception e) {
System.err.println("Error registering the spy");
}
} else if ((new String(buff, 0, ret_read)).startsWith("UNSPY")) {
tc.stopSpyStream();
} else {
try {
outstr.write(buff, 0, ret_read);
outstr.flush();
} catch (Exception e) {
end_loop = true;
}
}
}
} catch (Exception e) {
System.err.println("Exception while reading keyboard:" + e.getMessage());
end_loop = true;
}
}
while ((ret_read > 0) && (end_loop == false));
try {
tc.disconnect();
} catch (Exception e) {
System.err.println("Exception while connecting:" + e.getMessage());
}
} catch (Exception e) {
System.err.println("Exception while connecting:" + e.getMessage());
System.exit(1);
}
}
}
/**
* Callback method called when TelnetClient receives an option
* negotiation command.
* <p/>
*
* @param negotiation_code - type of negotiation command received
* (RECEIVED_DO, RECEIVED_DONT, RECEIVED_WILL, RECEIVED_WONT)
* <p/>
* @param option_code - code of the option negotiated
* <p/>
* *
*/
public void receivedNegotiation(int negotiation_code, int option_code) {
String command = null;
if (negotiation_code == TelnetNotificationHandler.RECEIVED_DO) {
command = "DO";
} else if (negotiation_code == TelnetNotificationHandler.RECEIVED_DONT) {
command = "DONT";
} else if (negotiation_code == TelnetNotificationHandler.RECEIVED_WILL) {
command = "WILL";
} else if (negotiation_code == TelnetNotificationHandler.RECEIVED_WONT) {
command = "WONT";
}
System.out.println("Received " + command + " for option code " + option_code);
}
/**
* Reader thread.
* Reads lines from the TelnetClient and echoes them
* on the screen.
* *
*/
public void run() {
InputStream instr = tc.getInputStream();
try {
byte[] buff = new byte[1024];
int ret_read = 0;
do {
ret_read = instr.read(buff);
if (ret_read > 0) {
System.out.print(new String(buff, 0, ret_read));
}
}
while (ret_read >= 0);
} catch (Exception e) {
System.err.println("Exception while reading socket:" + e.getMessage());
}
try {
tc.disconnect();
} catch (Exception e) {
System.err.println("Exception while closing telnet:" + e.getMessage());
}
}
}
| [
"javajiao@126.com"
] | javajiao@126.com |
09b90646ad3597546e0a59391352c860022590de | 8d7bb673c1c0ddd6a55449684f0dc68b34e70dd1 | /Oef_PieterMatthieu/oefeningen p15/oefening.java | 2b62e60c9ee699a7a8acf2e63d288f338a9a62cb | [] | no_license | ksoontjens/31_Pieter_Matthieu_Sasha_Meertens | a0795275756f99cf6f6e30a3d9ca0303b092ccf4 | 86f179111f727e34a8c6d3bf332cb866b93dc354 | refs/heads/master | 2016-09-14T13:42:37.409115 | 2016-05-27T21:07:45 | 2016-05-27T21:07:45 | 59,742,965 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 182 | java | import java.lang.*;
public class oefening {
public static void main(String args[])
{
int i=55;
while (i > 34) {
System.out.println(i);
i--;
}
}
} | [
"sacha.meertens@hotmail.com"
] | sacha.meertens@hotmail.com |
3818716bcfd99011c375283db01da53d693e85b7 | 3af1353455ffe55c2ad1b6ec397d91e88b33d10b | /app/src/main/java/enums/RunnerCardType.java | 5a77a79b88832ebf7fae0940634c951335f9f0e2 | [] | no_license | Duncan-Marjoribanks/Netrunner-Cards-Android-Studio-app- | 019f6414062a0880f1b25e2cc048b4baaace2138 | 44af55fea95296f11794ae621060e14e825fa59b | refs/heads/master | 2020-03-19T00:48:58.428218 | 2018-05-31T08:00:22 | 2018-05-31T08:00:22 | 135,503,426 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 113 | java | package enums;
public enum RunnerCardType {
IDENTITY,
PROGRAM,
EVENT,
HARDWARE,
RESOURCE
}
| [
"marjoribanks.d@gmail.com"
] | marjoribanks.d@gmail.com |
12ac73b7e47236a734edb4395eefab74f340ac17 | 17a5f58a1d92ec56d4291e00ea2c43171c0c37cd | /Cloud4ALL-MiniMatchMaker/src/com/cloud4all/minimatchmaker/Viewer.java | 8782424b59b25e7f86d9ad6c8cfd3a006289ff85 | [
"BSD-3-Clause"
] | permissive | adelga/AndroidCloud4All | 2c89485a8d83c469ec9dac054f6512fc477f7509 | 6cd1c20a1dc62cb405387fbad71dea06554079fc | refs/heads/master | 2021-01-02T09:09:34.743881 | 2015-11-11T11:27:56 | 2015-11-11T11:27:56 | 6,938,912 | 0 | 1 | null | 2015-11-11T11:17:12 | 2012-11-30T12:51:33 | Java | WINDOWS-1258 | Java | false | false | 7,301 | java | package com.cloud4all.minimatchmaker;
/*
Viewer
This class is a example of Mini Match Maker demo.
Copyright (c) 2013, Technosite R&D
All rights reserved.
The research leading to these results has received funding from the European Union's Seventh Framework Programme (FP7/2007-2013) under grant agreement n° 289016
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 Technosite R&D nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import org.json.JSONException;
import org.json.JSONObject;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.IBinder;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.TextView;
import com.cloud4all.minimatchmaker.MiniMatchMakerService.MiniMatchMakerListener;
public class Viewer extends Activity implements MiniMatchMakerListener {
private TextView monitor = null;
private TextView brightnessLabel = null;
private TextView noiseLabel = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_viewer);
monitor = (TextView) findViewById(R.id.monitorlabel);
brightnessLabel = (TextView) findViewById(R.id.brightnesslabel);
noiseLabel = (TextView) findViewById(R.id.noiselabel);
doBindService();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_viewer, menu);
return true;
}
// ** Service connection
private MiniMatchMakerService sMiniMatchMaker;
private void registerListener() {
if (sMiniMatchMaker!=null) {
sMiniMatchMaker.registerListener(this);
this.monitor.setText(monitor.getText() + "\nThis application has been registered as MiniMatchMaker listener.");
}else {
this.monitor.setText(monitor.getText() + "\nError\nThis application has not been registered as MiniMatchMaker listener.");
}
}
private ServiceConnection mConnection = new ServiceConnection() {
public void onServiceConnected(ComponentName className, IBinder binder) {
sMiniMatchMaker = ((MiniMatchMakerService.MyBinder) binder).getService();
if (sMiniMatchMaker != null) {
registerListener();
refreshInterface();
}
}
public void onServiceDisconnected(ComponentName className) {
sMiniMatchMaker = null;
}
};
// starts the service connection using bindings
void doBindService() {
bindService(new Intent(this, MiniMatchMakerService.class), mConnection,
Context.BIND_AUTO_CREATE);
}
// ** Triggers for demo
private float brightnessValue = 100;
private float noiseValue = 30;
private boolean sendEnvironmentalData() {
// Create a JSON object with data
JSONObject data = new JSONObject();
JSONObject sensorBrightness = new JSONObject();
JSONObject sensorNoise = new JSONObject();
try {
sensorBrightness.put("name", "brightness");
sensorBrightness.put("type", "float");
sensorBrightness.put("value", Float.valueOf(brightnessValue));
sensorNoise.put("name", "noise");
sensorNoise.put("type", "float");
sensorNoise.put("value", Float.valueOf(noiseValue));
data.put("type", "Environment");
data.put("parameters", Integer.valueOf(2));
data.put("parameter1", sensorBrightness.toString());
data.put("parameter2", sensorNoise.toString());
sMiniMatchMaker.insertData(data);
return true;
} catch (JSONException e) {
Log.e("Viewer error", "\nError creating data to send to Mini match maker.\n" +e);
return false;
}
}
// ** Events for interface
public void refreshInterface() {
this.brightnessLabel.setText(String.valueOf(brightnessValue));
this.noiseLabel.setText(String.valueOf(noiseValue));
}
public void pressBrightnessUp(View view) {
brightnessValue+=30;
if (brightnessValue>1000) brightnessValue=1000;
refreshInterface();
}
public void pressBrightnessDown(View view) {
brightnessValue-=30;
if (brightnessValue<0) brightnessValue=0;
refreshInterface();
}
public void pressNoiseUp(View view) {
noiseValue+=30;
if (noiseValue>1000) noiseValue=1000;
refreshInterface();
}
public void pressNoiseDown(View view) {
noiseValue-=30;
if (noiseValue<0) noiseValue=0;
refreshInterface();
}
public void pressSend(View view) {
if (sendEnvironmentalData() == false) this.monitor.setText(monitor.getText() + "\nError sending data to Mini match maker .");
}
// ** MiniMatchMaker event listener
public void manageJSONMessage(JSONObject data) {
try {
String typeData = data.getString("type");
if (typeData.equalsIgnoreCase("message")) {
String textMessage = data.getString("value");
this.monitor.setText(monitor.getText() + "\n\n"+ textMessage );
}
} catch (JSONException e) {
this.monitor.setText(monitor.getText() + "\nError parsing data from Mini Match maker. JSON data is not understandable.");
Log.e("Viewer error", "Error parsing JSON data \n" +e);
}
}
public void MiniMatchMakerResponse(JSONObject data){
try {
String typeData = data.getString("type");
if (typeData.equalsIgnoreCase("package")) {
this.monitor.setText(""); // clear the monitor
int n = Integer.valueOf(data.getString("operations"));
for (int i=1;i<=n;i++) {
String paramName = "operation" + String.valueOf(i);
JSONObject JSONtmp = new JSONObject(data.getString(paramName));
manageJSONMessage(JSONtmp);
}
} else if (typeData.equalsIgnoreCase("message")) {
manageJSONMessage(data);
}
} catch (JSONException e) {
this.monitor.setText(monitor.getText() + "\nError parsing data from Mini Match maker. JSON data is not understandable.");
Log.e("Viewer Error in MiniMatchMakerResponse", "Error in JSON from Mini Match Maker.\n" +e);
}
Log.i("Info", "\n\n\ndata received from Mini match maker");
}
} | [
"delgado.forni@gmail.com"
] | delgado.forni@gmail.com |
065e7fbe56da954051a58d3b828f5b310f296a87 | 9e0148245c3f6d714a5aaa0c57e5133527f06504 | /app/src/main/java/com/lsw/demo/PointToOffer.java | 8a2f6c0faabc462ea44c303bfaa1bb1a5bba0a4a | [] | no_license | SweeneyLiu/AlgorithmDemo | 2974168fe6cd27313ccfe7d0f605d48469d13824 | f3148d710cad5b7f69fee2dd38ba80985e988323 | refs/heads/master | 2021-01-20T01:56:58.228604 | 2019-03-11T12:02:46 | 2019-03-11T12:02:46 | 89,349,611 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,647 | java | package com.lsw.demo;
import android.util.Log;
import java.util.ArrayList;
import java.util.Stack;
/**
* Created by liushuwei on 2017/8/22.
*/
public class PointToOffer {
private static PointToOffer mPointToOffer = new PointToOffer();
private PointToOffer() {
}
public static PointToOffer getPointToOffer() {
return mPointToOffer;
}
/**
* 在一个二维数组中,每一行都按照从左到右递增的顺序排序,每一列都按照从上到下递增的顺序排序。
* 请完成一个函数,输入这样的一个二维数组和一个整数,判断数组中是否含有该整数。
* @param target
* @param array
* @return
*/
public boolean find(int target, int [][] array) {
int rowLen = array.length;
int columnLen = array[0].length;
int row = 0;
int column = columnLen -1;
while((row<rowLen)&&(column>=0)){
if(array[row][column]>target){
column--;
}else if(array[row][column]<target){
row++;
}else{
return true;
}
}
return false;
}
/**
* 请实现一个函数,将一个字符串中的空格替换成“%20”。例如,当字符串为We Are Happy.则经过替换之后的字符串为We%20Are%20Happy。
* @param str
* @return
*/
public String replaceSpace(StringBuffer str) {
if(str==null){
return null;
}
StringBuilder newStr = new StringBuilder();
for(int i=0;i<str.length();i++){
if(str.charAt(i)==' '){
newStr.append('%');
newStr.append('2');
newStr.append('0');
}else{
newStr.append(str.charAt(i));
}
}
return newStr.toString();
}
/**
* 输入一个链表,从尾到头打印链表每个节点的值
* @param listNode
* @return
*/
public ArrayList<Integer> printListFromTailToHead(ListNode listNode) {
Stack<Integer> stack = new Stack<>();
while (listNode != null) {
stack.push(listNode.val);
listNode = listNode.next;
}
ArrayList<Integer> list = new ArrayList<>();
while (!stack.isEmpty()) {
list.add(stack.pop());
}
return list;
}
public class ListNode {
int val;
ListNode next = null;
ListNode(int val) {
this.val = val;
}
}
/**
* 输入某二叉树的前序遍历和中序遍历的结果,请重建出该二叉树。
* 假设输入的前序遍历和中序遍历的结果中都不含重复的数字。
* 例如输入前序遍历序列{1,2,4,7,3,5,6,8}和中序遍历序列{4,7,2,1,5,3,8,6},则重建二叉树并返回。
* @param pre
* @param in
* @return
*/
public TreeNode reConstructBinaryTree(int [] pre,int [] in) {
TreeNode treeNode= constructBinaryTree(pre,0,pre.length-1,in,0,in.length-1);
return treeNode;
}
public TreeNode constructBinaryTree(int[] pre,int startPre,int endPre,int[] in,int startIn,int endIn){
if((startPre>endPre)||(startIn>endIn)){
return null;
}
TreeNode root=new TreeNode(pre[startPre]);
for(int i = 0;i<=endPre;i++){
if(pre[startPre] == in[i]){
root.left=constructBinaryTree(pre,startPre+1,startPre+i-startIn,in,startIn,i-1);
root.right=constructBinaryTree(pre,startPre+i-startIn+1,endPre,in,i+1,endIn);
}
}
return root;
}
public class TreeNode {
int val;
TreeNode left;
TreeNode right;
TreeNode(int x) {
val = x;
}
}
//用两个栈来实现一个队列,完成队列的Push和Pop操作。 队列中的元素为int类型。
Stack<Integer> stack1 = new Stack<Integer>();
Stack<Integer> stack2 = new Stack<Integer>();
public void push(int node) {
stack1.push(node);
}
public int pop() {
while(!stack1.isEmpty()){
stack2.push(stack1.pop());
}
int value = stack2.pop();
while(!stack2.isEmpty()){
stack1.push(stack2.pop());
}
return value;
}
/**
* 把一个数组最开始的若干个元素搬到数组的末尾,我们称之为数组的旋转。
* 输入一个非递减排序的数组的一个旋转,输出旋转数组的最小元素。
* 例如数组{3,4,5,1,2}为{1,2,3,4,5}的一个旋转,该数组的最小值为1。 NOTE:给出的所有元素都大于0,若数组大小为0,请返回0。
* @param array
* @return
*/
public int minNumberInRotateArray(int [] array) {
if (array.length == 0)
return 0;
for (int i = 0; i < array.length - 1; i++) {
if (array[i] > array[i + 1])
return array[i + 1];
}
return array[0];
}
/**
* 大家都知道斐波那契数列,现在要求输入一个整数n,请你输出斐波那契数列的第n项。n<=39
* @param n
* @return
*/
public int Fibonacci(int n) {
int num0 = 0;
int num1 = 1;
if(n <= 0) return num0;
if(n == 1) return num1;
int result = 0;
for(int i = 2; i <= n; i++){
result = num0 + num1;
num0 = num1;
num1 = result;
}
return result;
}
/**
* 题目:输入一个整数,输出该数二进制表示中1的个数。其中负数用补码表示
*
* 分析:
* 如果一个整数不为0,那么这个整数至少有一位是1。如果我们把这个整数减1,那么原来处在整数最右边的1就会变为0,原来在1后面的所有的0都会变成1(如果最右边的1后面还有0的话)。
* 其余所有位将不会受到影响。
* 举个例子:一个二进制数1100,从右边数起第三位是处于最右边的一个1。
* 减去1后,第三位变成0,它后面的两位0变成了1,而前面的1保持不变,因此得到的结果是1011.我们发现减1的结果是把最右边的一个1开始的所有位都取反了。
* 这个时候如果我们再把原来的整数和减去1之后的结果做与运算,从原来整数最右边一个1那一位开始所有位都会变成0。
* 如1100&1011=1000.也就是说,把一个整数减去1,再和原整数做与运算,会把该整数最右边一个1变成0.那么一个整数的二进制有多少个1,就可以进行多少次这样的操作。
* @param n
* @return
*/
public int NumberOf1(int n) {
int count = 0;
while(n!=0){
n=n&(n-1);
count++;
}
return count;
}
/**
* 给定一个double类型的浮点数base和int类型的整数exponent。求base的exponent次方。
* @param base
* @param exponent
* @return
*/
public double Power(double base, int exponent) {
double result = base;
int n = exponent;
if (exponent < 0) {
exponent = -exponent;
} else if (exponent == 0) {
return 1;
}
for (int i = 1; i < exponent; i++) {
result *= base;
}
return n < 0 ? 1 / result : result;
}
/**
* 打印1到最大的n位数
* 题目:输入数字n,按顺序打印出从1到最大的n位进制数。比如输入3则打印出 1、2、3 一直到999.
* @param n
*/
//方法一
public void printToMaxOfNDigits1(int n) {
int num = 1;
for (int j = 0; j < n; j++) {
num *= 10;
}
for (int k = 1; k < num; k++) {
Log.i("lsw---", k + "");
}
}
//方法二
public void printToMaxOfNDigits2(int n) {
int[] array = new int[n];
if (n <= 0)
return;
printArray(array, 0);
}
private void printArray(int[] array, int n) {
for (int i = 0; i < 10; i++) {
if (n != array.length) {
array[n] = i;
printArray(array, n + 1);
} else {
boolean isFirstNo0 = false;
for (int j = 0; j < array.length; j++) {
if (array[j] != 0) {
System.out.print(array[j]);
if (!isFirstNo0)
isFirstNo0 = true;
} else {
if (isFirstNo0)
System.out.print(array[j]);
}
}
System.out.println();
return;
}
}
}
/**
* 在 O(1)时间删除链表结点
* 题目:给定单向链表的头指针和一个结点指针,定义一个函数在 O(1)时间删除
* 该结点。
* @param head
* @param pToBeDeleted
*/
public void deleteNode(SingleListNode head, SingleListNode pToBeDeleted){
if(head == null || pToBeDeleted == null){
return;
}
SingleListNode q = pToBeDeleted.next;
//要删除的不是尾结点
if(q != null){
pToBeDeleted.value = q.value;
pToBeDeleted.next = q.next;
q = null;
} else if(head == pToBeDeleted){//链表只有一个结点,删除头结点(也是尾节点)
pToBeDeleted = null;
head = null;
}else{//链表中有多个结点,删除尾结点
SingleListNode q1 = head;
while(q1.next!=pToBeDeleted){
q1 = q1.next;
}
q1.next = null;
pToBeDeleted = null;
}
}
class SingleListNode{
int value;
SingleListNode next;
public SingleListNode(int v){value = v;}
}
public void order(int[] array) {
if (array == null || array.length == 0)
return;
int start = 0;
int end = array.length - 1;
while (start < end) {
while (start < end && !isEven(array[start])) {
start++;
}
while (start < end && isEven(array[end])) {
end--;
}
if (start < end) {
int temp = array[start];
array[start] = array[end];
array[end] = temp;
}
}
}
private boolean isEven(int n) {
return n%2 == 0;
}
}
| [
"liushuwei@qiyi.com"
] | liushuwei@qiyi.com |
f9ba5c09e6ca742a74c317b152eaddd980f53c69 | 012529dffa19a9146722e7ca5725e67178f656fe | /nuitinfo/nuitinfo/src/main/java/com/nuitinfo/controller/SurfeurController.java | ef3ddb7220435831a27afb3d398e79d4edd35f9d | [] | no_license | safadahmouni2/NuitInfoPolytech2020 | d667ba3e882cbf03a090ad69e234c17fb2accc07 | 5815f45c24cd47b4df3e1f2fac70f86a1e4f06cb | refs/heads/master | 2023-01-29T14:22:13.939430 | 2020-12-04T03:20:52 | 2020-12-04T03:20:52 | 318,307,639 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,204 | java | package com.nuitinfo.controller;
import com.nuitinfo.entity.Surfeur;
import com.nuitinfo.exception.ResourceNotFoundException;
import com.nuitinfo.repository.SurfeurRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("nuitinfo2020/surfeur")
public class SurfeurController {
@Autowired
private SurfeurRepository surfeurRepository;
// get all surfeurs
@GetMapping
public List<Surfeur> getAllSurfeurs() {
return this.surfeurRepository.findAll();
}
// get Surfeur by id
@GetMapping("/{id}")
public Surfeur getSurfeurById(@PathVariable(value = "id") long surfeurId) {
return this.surfeurRepository.findById(surfeurId)
.orElseThrow(() -> new ResourceNotFoundException("surfeur not found with id :" + surfeurId));
}
// create Surfeur
@PostMapping
public Surfeur createSurfeur(@RequestBody Surfeur surfeur) {
return this.surfeurRepository.save(surfeur);
}
// update Surfeur
@PutMapping("/{id}")
public Surfeur updateSurfeur(@RequestBody Surfeur surfeur, @PathVariable("id") long surfeurId) {
Surfeur existingSurfeur = this.surfeurRepository.findById(surfeurId)
.orElseThrow(() -> new ResourceNotFoundException("surfeur not found with id :" + surfeurId));
existingSurfeur.setNom(surfeur.getNom());
existingSurfeur.setDateNaissance(surfeur.getDateNaissance());
existingSurfeur.setAdresse(surfeur.getAdresse());
existingSurfeur.setTel(surfeur.getTel());
return this.surfeurRepository.save(existingSurfeur);
}
// delete surfeur by id
@DeleteMapping("/{id}")
public ResponseEntity< Surfeur > deleteSurfeur(@PathVariable("id") long surfeurId) {
Surfeur existingSurfeur = this.surfeurRepository.findById(surfeurId)
.orElseThrow(() -> new ResourceNotFoundException("surfeur not found with id :" + surfeurId));
this.surfeurRepository.delete(existingSurfeur);
return ResponseEntity.ok().build();
}
}
| [
"dahmounisafa3@gmail"
] | dahmounisafa3@gmail |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.