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
e38c37a4d8efd7ef7dc81a54f366278e9b9db518
1f568b8e67952c2837c176339708cde4f235b018
/test/ru/job4j/array/SwitchArrayTest.java
d0cfe20dd1d9b07b33377af47c52dd4143c3c0d9
[]
no_license
AlexKennethMiles/job4j_elementary_practice
896cf452cff5695401bd0bcb395cff550994ee13
b2429e8ea8e74149fd907908bc0ea4cad94113ff
refs/heads/master
2023-05-21T09:54:19.426413
2021-06-14T19:59:37
2021-06-14T19:59:37
333,356,363
0
0
null
null
null
null
UTF-8
Java
false
false
1,026
java
package ru.job4j.array; import org.junit.Test; import static org.hamcrest.core.Is.is; import static org.junit.Assert.*; public class SwitchArrayTest { @Test public void whenSwap0to3() { int[] input = {1, 2, 3, 4}; int[] expect = {4, 2, 3, 1}; int[] rsl = SwitchArray.swap(input, 0, input.length - 1); assertThat(rsl, is(expect)); } @Test public void whenSwap1to3() { int[] input = {0, 1, 2, 3}; int[] expect = {0, 3, 2, 1}; int[] rsl = SwitchArray.swap(input, 1, 3); assertThat(rsl, is(expect)); } @Test public void whenSwap0to0() { int[] input = {0, 1, 2, 3, 4}; int[] expect = {0, 1, 2, 3, 4}; int[] rsl = SwitchArray.swap(input, 0, 0); assertThat(rsl, is(expect)); } @Test public void whenSwap4to1() { int[] input = {0, 1, 2, 3, 4}; int[] expect = {0, 4, 2, 3, 1}; int[] rsl = SwitchArray.swap(input, 4, 1); assertThat(rsl, is(expect)); } }
[ "apuchkov17@gmail.com" ]
apuchkov17@gmail.com
7c02f2d59de97820a16483350e4db67e1b1afe20
94bf529e7a4753e69c4a4841fdbeaac9041357ff
/app/src/main/java/com/example/punit/app/NewsActivity.java
f8bc3f0129607e4948d829ae7c9be0f3b5b9a113
[]
no_license
Raghu15/App
6382489f91e74d7fe8b6faa5fc380fb051c61df5
1f7f2b70940af80f51d3e82d6831622b5610e0bb
refs/heads/master
2021-01-10T16:14:51.434485
2016-02-22T11:24:12
2016-02-22T11:24:12
52,268,560
0
0
null
null
null
null
UTF-8
Java
false
false
792
java
package com.example.punit.app; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.widget.TextView; /** * Created by punit on 09/12/2015. */ public class NewsActivity extends AppCompatActivity { private TextView tvNews; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.news_activity_layout); tvNews = (TextView) findViewById(R.id.tvnews); Intent incommingIntentObject = getIntent(); setTitle(incommingIntentObject.getStringExtra(ActivityNavigator.NEWS_TYPE)); tvNews.setText(" I will show " + incommingIntentObject.getStringExtra(ActivityNavigator.NEWS_TYPE) + " news"); } }
[ "raghua1593@gmail.com" ]
raghua1593@gmail.com
6d5b1f353623e1b751a87b30628a219a98b13bdc
39cad3a0faad4d4c3dcb03686d52200bc56fba09
/src/main/java/com/test/taskmanager/domain/Process.java
f542da84324ffd958587b93fe3e8c8f4dbd691dd
[]
no_license
galegofer/taskmanager-test
2b39434a0f0af18341c1d5f47b4b2cb1348a6e83
8fb5c33799c783145bc1d670552b52f6166095b4
refs/heads/main
2023-07-01T04:41:13.187319
2021-08-04T14:16:54
2021-08-04T14:16:54
392,710,375
0
0
null
null
null
null
UTF-8
Java
false
false
1,904
java
package com.test.taskmanager.domain; import io.vavr.concurrent.Future; import java.time.LocalDateTime; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicLong; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode.Exclude; import lombok.NonNull; import lombok.ToString; import lombok.Value; import lombok.With; import lombok.extern.slf4j.Slf4j; @Slf4j @Value @AllArgsConstructor @EqualsAndHashCode public class Process implements Runnable { long pid; @Exclude Priority priority; @Exclude AtomicBoolean running; @Exclude LocalDateTime creationTime; @With @Exclude @ToString.Exclude Future<Void> future; @Builder public Process(@NonNull Priority priority) { this.pid = PIDGenerator.getPid(); this.priority = priority; this.creationTime = LocalDateTime.now(); this.running = new AtomicBoolean(false); this.future = null; } @Override public void run() { log.debug("Executing task with PID: {}", pid); running.set(true); while (running.get()) { try { Thread.sleep(2000); } catch (InterruptedException ex) { log.warn("Task with PID: {} was interrupted", pid); running.set(false); } } } public boolean getRunning() { return running.get(); } public Process kill() { running.set(false); future.cancel(); log.info("Killed process with PID: {}, priority: {}", pid, priority); return this; } private static final class PIDGenerator { private static final AtomicLong pidCounter = new AtomicLong(0); public static long getPid() { return pidCounter.incrementAndGet(); } } }
[ "damian.raul.fernandez@ing.com" ]
damian.raul.fernandez@ing.com
2126960b85c90db0bf90677e502f8cc61f3ec841
0bf686492a9fadafadd3b5ab2398f8a13f69e521
/DesignPattern/src/CafeExample/Packing.java
e22ae3753613dfc9744ac305a717a67b0e8f5904
[]
no_license
ultracake/design_patterns
dceda0ccfb332c99fc21834c421347b223b513bd
d927ae96f0bb730ca9639ba3cb349e2b6c5aa548
refs/heads/main
2023-01-22T23:35:02.780772
2020-12-01T09:32:51
2020-12-01T09:32:51
300,525,957
0
0
null
null
null
null
UTF-8
Java
false
false
70
java
package CafeExample; public interface Packing { String pack(); }
[ "jackievuong@live.dk" ]
jackievuong@live.dk
211d92508803273a6e09497bdbb5569749ab25ba
44e0b10a1e98587ea4cf9067b0de39937f5de081
/src/main/java/com/cdkj/ylq/dto/res/XN802167Res.java
431c38f42a33c5d34f78c72c61b256dcc608440d
[]
no_license
ibisTime/xn-ylq
96df9254746f4d7017865f45908a9d93269d3876
937e475780d80c1fb29659878effd060e28a1b94
refs/heads/master
2021-01-16T11:29:30.662194
2018-01-05T09:57:20
2018-01-05T09:57:20
99,996,279
0
6
null
null
null
null
UTF-8
Java
false
false
623
java
/** * @Title XN802166Res.java * @Package com.std.account.dto.res * @Description * @author leo(haiqing) * @date 2017年9月15日 下午12:54:59 * @version V1.0 */ package com.cdkj.ylq.dto.res; /** * @author: haiqingzheng * @since: 2017年9月15日 下午12:54:59 * @history: */ public class XN802167Res { private boolean isSuccess; public XN802167Res(boolean isSuccess) { super(); this.isSuccess = isSuccess; } public boolean isSuccess() { return isSuccess; } public void setSuccess(boolean isSuccess) { this.isSuccess = isSuccess; } }
[ "leo.zheng@hichengdai.com" ]
leo.zheng@hichengdai.com
6d56a48fe1a2033ca66c8c6d5af8edd89100e046
7569f9a68ea0ad651b39086ee549119de6d8af36
/cocoon-2.1.9/src/blocks/forms/java/org/apache/cocoon/forms/datatype/typeimpl/AbstractDatatype.java
00a039f97e2a7898680a78e5a9fa5ed4a566d063
[ "Apache-2.0" ]
permissive
tpso-src/cocoon
844357890f8565c4e7852d2459668ab875c3be39
f590cca695fd9930fbb98d86ae5f40afe399c6c2
refs/heads/master
2021-01-10T02:45:37.533684
2015-07-29T18:47:11
2015-07-29T18:47:11
44,549,791
0
0
null
null
null
null
UTF-8
Java
false
false
3,855
java
/* * Copyright 1999-2004 The Apache Software Foundation. * * 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.apache.cocoon.forms.datatype.typeimpl; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Locale; import org.apache.cocoon.forms.datatype.Datatype; import org.apache.cocoon.forms.datatype.DatatypeBuilder; import org.apache.cocoon.forms.datatype.ValidationRule; import org.apache.cocoon.forms.datatype.convertor.Convertor; import org.apache.cocoon.forms.datatype.convertor.ConversionResult; import org.apache.cocoon.forms.validation.ValidationError; import org.apache.cocoon.forms.FormsConstants; import org.apache.cocoon.xml.AttributesImpl; import org.outerj.expression.ExpressionContext; import org.xml.sax.ContentHandler; import org.xml.sax.SAXException; /** * Abstract base class for Datatype implementations. Most concreate datatypes * will derive from this class. * @version $Id: AbstractDatatype.java 370089 2006-01-18 09:26:09Z jbq $ */ public abstract class AbstractDatatype implements Datatype { private List validationRules = new ArrayList(); private boolean arrayType = false; private DatatypeBuilder builder; private Convertor convertor; public ValidationError validate(Object value, ExpressionContext expressionContext) { Iterator validationRulesIt = validationRules.iterator(); while (validationRulesIt.hasNext()) { ValidationRule validationRule = (ValidationRule)validationRulesIt.next(); ValidationError result = validationRule.validate(value, expressionContext); if (result != null) return result; } return null; } public void addValidationRule(ValidationRule validationRule) { validationRules.add(validationRule); } public boolean isArrayType() { return arrayType; } protected void setArrayType(boolean arrayType) { this.arrayType = arrayType; } public void setConvertor(Convertor convertor) { this.convertor = convertor; } protected void setBuilder(DatatypeBuilder builder) { this.builder = builder; } public Convertor getPlainConvertor() { return builder.getPlainConvertor(); } public DatatypeBuilder getBuilder() { return builder; } public Convertor getConvertor() { return convertor; } public ConversionResult convertFromString(String value, Locale locale) { return getConvertor().convertFromString(value, locale, null); } public String convertToString(Object value, Locale locale) { return getConvertor().convertToString(value, locale, null); } private static final String DATATYPE_EL = "datatype"; public void generateSaxFragment(ContentHandler contentHandler, Locale locale) throws SAXException { AttributesImpl attrs = new AttributesImpl(); attrs.addCDATAAttribute("type", getDescriptiveName()); contentHandler.startElement(FormsConstants.INSTANCE_NS, DATATYPE_EL, FormsConstants.INSTANCE_PREFIX_COLON + DATATYPE_EL, attrs); getConvertor().generateSaxFragment(contentHandler, locale); contentHandler.endElement(FormsConstants.INSTANCE_NS, DATATYPE_EL, FormsConstants.INSTANCE_PREFIX_COLON + DATATYPE_EL); } }
[ "ms@tpso.com" ]
ms@tpso.com
fea3efc31e29db7059e7c9d1bcb16d749afa2b66
e0538dd6c0498b08db57787352a3bdf4dedcdee9
/nsbaselibrary/src/test/java/com/red/dargon/nsbaselibrary/ExampleUnitTest.java
a0453f058c0ebe58d2d16ebb0fdddb3a00cd4677
[]
no_license
RedDargon/NSBaseProject
14b7275582169f23057b4fdb9f3a29e48f234edb
8d3fdcb33a0a4170a810e3e1efe4688f7564bdb0
refs/heads/master
2021-05-06T07:35:05.336743
2017-12-18T09:32:39
2017-12-18T09:32:39
113,954,843
0
0
null
null
null
null
UTF-8
Java
false
false
406
java
package com.red.dargon.nsbaselibrary; 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); } }
[ "814624641@qq.com" ]
814624641@qq.com
ff86ac24bf0a5409f26c27c97cee4e16f2517a95
36d818cbeda9fe07c3097e136beeaad33ab33cd9
/src/Design_Pattern/Implements/ConcreteProduct3.java
156baba8029658fbf3da7b1150973fc2d4945e7c
[]
no_license
XQLong/java_workplace
61a5cca83bc3da942779ececd1b871832d058d41
f8fd8a04c9a01f57a61efbd1e026fe6d83edd9b3
refs/heads/master
2020-03-28T19:23:16.464728
2019-10-22T02:35:37
2019-10-22T02:35:37
148,970,832
0
0
null
null
null
null
UTF-8
Java
false
false
192
java
package Design_Pattern.Implements; import Design_Pattern.Interface.Product; /** * @Author: xql * @Date: Created in 17:38 2019/7/10 */ public class ConcreteProduct3 implements Product { }
[ "xql820148218@gmail.com" ]
xql820148218@gmail.com
653e44fdd4108cef45f457ebf674618535c9656a
8a209eb061c755b8a09c2ab54158decc4213db8a
/src/main/java/com/luxoft/tradevalidator/repository/CCPairExceptionSpotTradeRepository.java
ed7ab037c536c872b20f5dd31c4f08d48e64bcab
[]
no_license
crafaelsouza/trade-validator
90fd070973acd254788b0ff337f9bd042db7143d
50295e1b8499ed1883bb4ec3774b4ab810f9500f
refs/heads/master
2020-03-27T02:14:13.282547
2018-08-28T15:03:38
2018-08-28T15:06:43
145,775,451
0
0
null
null
null
null
UTF-8
Java
false
false
292
java
package com.luxoft.tradevalidator.repository; import org.springframework.data.jpa.repository.JpaRepository; import com.luxoft.tradevalidator.domain.CCPairExceptionSpotTrade; public interface CCPairExceptionSpotTradeRepository extends JpaRepository<CCPairExceptionSpotTrade, Integer>{ }
[ "rafael.souza@accesstage.com.br" ]
rafael.souza@accesstage.com.br
5000481109114c2db18e97bae104596c8453caca
ae276ef4fa493b2b8b5035ea346ac5e04d1df48e
/app/src/main/java/com/example/camirwin/invoicetracker/model/Services.java
3fe53f381350f82533bb1f5489d260e1d7328955
[]
no_license
Camirwin/OverTime
bb7c0d5be632f26e851962ee1646009c7b98f5a9
9423c6d7c4f81a7d1a13d3f97a6fba8bf9dddba2
refs/heads/master
2020-04-20T17:31:53.120804
2014-08-02T19:38:10
2014-08-02T19:38:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,473
java
package com.example.camirwin.invoicetracker.model; import java.util.Date; public class Services { private Integer Id; private Integer ClientId; private Integer InvoiceId; private String Name; private Double Rate; private Long LastWorkedDate; private Double OutstandingBalance; public Integer getId() { return Id; } public void setId(Integer id) { Id = id; } public Integer getClientId() { return ClientId; } public void setClientId(Integer clientId) { ClientId = clientId; } public Integer getInvoiceId() { return InvoiceId; } public void setInvoiceId(Integer invoiceId) { InvoiceId = invoiceId; } public String getName() { return Name; } public void setName(String name) { Name = name; } public Double getRate() { return Rate; } public void setRate(Double rate) { Rate = rate; } public Long getLastWorkedDate() { return LastWorkedDate; } public void setLastWorkedDate(Long lastWorkedDate) { LastWorkedDate = lastWorkedDate; } public Double getOutstandingBalance() { return OutstandingBalance; } public void setOutstandingBalance(Double outstandingBalance) { OutstandingBalance = outstandingBalance; } public Date getLastWorkedAsDateObject() { return new Date(getLastWorkedDate()); } }
[ "cameron.irwinp@gmail.com" ]
cameron.irwinp@gmail.com
59ab41a80148aad45ecf4a70bda5149f912b5dc9
87f1f9bf6dd18e2b605133bbfb859a021bc696d9
/hw06/src/main/java/hr/fer/zemris/java/hw06/shell/Environment.java
d2a5ddf5969ad04ea92aa230ac31ebc6fe962fa3
[]
no_license
staverm/Java-Course-FER-2020
0c9a52aaa1983ecd60d5fc8c5e2b0b9397f91289
a243242d2b5f1f87d556dcf401077bc5ffeed3c4
refs/heads/main
2023-01-04T01:48:02.744501
2020-10-28T17:55:06
2020-10-28T17:55:06
300,356,888
0
0
null
null
null
null
UTF-8
Java
false
false
2,251
java
package hr.fer.zemris.java.hw06.shell; import java.util.SortedMap; /** * Interface that represents the environment used for interaction with the user. * The environment serves as an intermediary for interaction between the user and * the program. * * @author Mauro Staver * */ public interface Environment { /** * Reads from Environment's input stream until a new line char is detected. * Returns a String with the read text. * * @return String - the read line * @throws ShellIOException if unable to read line from the stream */ String readLine() throws ShellIOException; /** * Writes the specified String to Environment's output stream. * * @param text String to write * @throws ShellIOException if unable to write to the stream */ void write(String text) throws ShellIOException; /** * Writes the specified String to Environment's output stream and adds a new * line char at the end. * * @param text String to write * @throws ShellIOException if unable to write to the stream */ void writeln(String text) throws ShellIOException; /** * Returns an unmodifiable map of all supported commands of MyShell. * Map keys are command names, and values are actual ShellCommand objects. * * @return unmodifiable map of all supported commands of MyShell. */ SortedMap<String, ShellCommand> commands(); /** * Returns the current MULTILINE symbol. * * @return the current MULTILINE symbol */ Character getMultilineSymbol(); /** * Sets the MULTILINE symbol to the specified symbol. * * @param symbol symbol to set the MULTILINE symbol */ void setMultilineSymbol(Character symbol); /** * Returns the current PROMPT symbol. * * @return the current PROMPT symbol */ Character getPromptSymbol(); /** * Sets the PROMPT symbol to the specified symbol. * * @param symbol symbol to set the PROMPT symbol */ void setPromptSymbol(Character symbol); /** * Returns the current MORELINES symbol. * * @return the current MORELINES symbol */ Character getMorelinesSymbol(); /** * Sets the MORELINES symbol to the specified symbol. * * @param symbol symbol to set the MORELINES symbol */ void setMorelinesSymbol(Character symbol); }
[ "mauro.staver@gmail.com" ]
mauro.staver@gmail.com
badcb80b3815a4d3976527a94830c60926d4dc7a
46b85208c7dfd1249ff5c2f263cdb0e742bff8da
/solon/src/main/java/org/noear/solon/core/util/IoUtil.java
5a5858fb379863415ff3b6f3cf9cccd3156ac31e
[ "Apache-2.0" ]
permissive
noear/solon
1c0a78c5ab2bec45a67fcf772f582f9cb4894fab
63f3f49cddcbfa8bd6d596998735f0704e8d43f8
refs/heads/master
2023-08-31T09:10:32.303640
2023-08-30T14:13:27
2023-08-30T14:13:27
140,086,420
1,687
187
Apache-2.0
2023-09-10T10:31:54
2018-07-07T13:23:50
Java
UTF-8
Java
false
false
2,625
java
package org.noear.solon.core.util; import org.noear.solon.Solon; import org.noear.solon.Utils; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; /** * 输入输出工具 * * @author noear * @since 2.4 */ public class IoUtil { public static String transferToString(InputStream ins) throws IOException { return transferToString(ins, Solon.encoding()); } /** * 将输入流转换为字符串 * * @param ins 输入流 * @param charset 字符集 */ public static String transferToString(InputStream ins, String charset) throws IOException { if (ins == null) { return null; } ByteArrayOutputStream outs = transferTo(ins, new ByteArrayOutputStream()); if (Utils.isEmpty(charset)) { return outs.toString(); } else { return outs.toString(charset); } } /** * 将输入流转换为byte数组 * * @param ins 输入流 */ public static byte[] transferToBytes(InputStream ins) throws IOException { if (ins == null) { return null; } return transferTo(ins, new ByteArrayOutputStream()).toByteArray(); } /** * 将输入流转换为输出流 * * @param ins 输入流 * @param out 输出流 */ public static <T extends OutputStream> T transferTo(InputStream ins, T out) throws IOException { if (ins == null || out == null) { return null; } int len = 0; byte[] buf = new byte[512]; while ((len = ins.read(buf)) != -1) { out.write(buf, 0, len); } return out; } /** * 将输入流转换为输出流 * * @param ins 输入流 * @param out 输出流 * @param start 开始位 * @param length 长度 */ public static <T extends OutputStream> T transferTo(InputStream ins, T out, long start, long length) throws IOException { int len = 0; byte[] buf = new byte[512]; int bufMax = buf.length; if (length < bufMax) { bufMax = (int) length; } if (start > 0) { ins.skip(start); } while ((len = ins.read(buf, 0, bufMax)) != -1) { out.write(buf, 0, len); length -= len; if (bufMax > length) { bufMax = (int) length; if (bufMax == 0) { break; } } } return out; } }
[ "noear@live.cn" ]
noear@live.cn
9c4a06528801f7f04fe2d335cdeb5cffc5ef5083
588f7fbeda0bd597981bac6839c49c5299051b4a
/src/com/company/Main.java
5aa86aa4c57e73fe3b274220c4fd10be6e80ccb8
[]
no_license
UCGv2/StatesAndCapitalsMap-mthree-training
8419943a0fecaf5a27ccf6215b05a7bcdb144f61
313de41f3c574e107542798382cb286f8317fc70
refs/heads/main
2023-02-02T12:21:19.040294
2020-12-14T01:30:45
2020-12-14T01:30:45
321,199,465
0
0
null
null
null
null
UTF-8
Java
false
false
1,416
java
package com.company; import java.io.FileNotFoundException; import java.util.*; import java.io.File; public class Main { public static void main(String[] args) { Map<String, String> states = new HashMap<>(); populateMap(states); Set<String> skey = states.keySet(); System.out.println("States:"); System.out.println("======="); for(String s : skey){ System.out.println(s); } System.out.println(); System.out.println("Capitals:"); System.out.println("========="); for(String s : skey){ System.out.println(states.get(s)); } System.out.println(); System.out.println("States/Capital pairs:"); System.out.println("====================="); for(String s : skey){ System.out.println(s + " - " + states.get(s)); } } public static void populateMap(Map<String, String> map){ try { Scanner file = new Scanner(new File("Cities and Captials list.txt")); while(file.hasNextLine()){ String line = file.nextLine(); String[] thing = line.split(",", 3); map.put(thing[0],thing[1]); } file.close(); }catch(FileNotFoundException e){ System.out.println("Error"); e.printStackTrace(); } } }
[ "chrisglennii@yahoo.com" ]
chrisglennii@yahoo.com
ab4f0e6f1372d2424502a39e1664f38823a48255
a64fccb4ad2e2536d6d7959fcc8af27dcfe9f756
/src/main/java/com/example/demo/ProductoController.java
f6032f3641fe5abcae268b9beaffe08dbe49bbd5
[]
no_license
valenfv/gondola-rest-service
adfded1cf1ff0d008abe660b26237dc6cd7a617c
728b5b6874103a121910342a14a6701e713e9078
refs/heads/master
2020-09-16T06:18:37.422068
2019-11-26T15:57:38
2019-11-26T15:57:38
223,681,023
0
0
null
null
null
null
UTF-8
Java
false
false
1,098
java
package com.example.demo; import java.net.URISyntaxException; import java.util.ArrayList; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Example; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/productos") public class ProductoController { @Autowired private ProductoRepository pr; @RequestMapping("/") public String index() { return "index of Gondola"; } @RequestMapping("/barcode/{barCode}/lista/{lista}") public Producto get(@PathVariable String barCode, @PathVariable String lista) throws URISyntaxException{ return pr.findById(new ProductoId(barCode, lista)).orElse(null); } @PostMapping("/nuevo") public Producto nuevo(@RequestBody Producto nuevoProducto) { return pr.save(nuevoProducto); } }
[ "valentinfvazquez@gmail.com" ]
valentinfvazquez@gmail.com
d1bbb5df787a5ff13a7ab45ba6cc82957ba3df35
5ee3d519f28352139e79082e98dd67231fdc1aee
/src/main/java/com/nio/Marketing.java
91c9c1f37f67e6ef0f0e147ae9c7c347d1b9e829
[]
no_license
fruitfish/practice
305a684a24513c24af23820829e7aad494d19df9
bef0f8fa34a850443b67afcfe21f8a4d78321661
refs/heads/master
2022-06-16T06:19:18.959020
2020-08-26T14:53:54
2020-08-26T14:53:54
172,201,680
0
0
null
2022-06-10T19:57:14
2019-02-23T10:33:47
Java
UTF-8
Java
false
false
3,098
java
package com.nio; import java.nio.ByteBuffer; import java.nio.channels.GatheringByteChannel; import java.io.FileOutputStream; import java.util.Random; import java.util.List; import java.util.LinkedList; /** * Created by GanShu on 2018/12/10 0010. */ public class Marketing { private static final String DEMOGRAPHIC = "blahblah.txt"; // "Leverage frictionless methodologies" public static void main(String[] argv) throws Exception { int reps = 10; if (argv.length > 0) { reps = Integer.parseInt(argv[0]); } FileOutputStream fos = new FileOutputStream(DEMOGRAPHIC); GatheringByteChannel gatherChannel = fos.getChannel(); // Generate some brilliant marcom, er, repurposed content ByteBuffer[] bs = utterBS(reps); // Deliver the message to the waiting market while (gatherChannel.write(bs) > 0) { // Empty body // Loop until write( ) returns zero } System.out.println("Mindshare paradigms synergized to " + DEMOGRAPHIC); fos.close(); } // ------------------------------------------------ // These are just representative; add your own private static String[] col1 = { "Aggregate", "Enable", "Leverage", "Facilitate", "Synergize", "Repurpose", "Strategize", "Reinvent", "Harness" }; private static String[] col2 = { "cross-platform", "best-of-breed", "frictionless", "ubiquitous", "extensible", "compelling", "mission-critical", "collaborative", "integrated" }; private static String[] col3 = { "methodologies", "infomediaries", "platforms", "schemas", "mindshare", "paradigms", "functionalities", "web services", "infrastructures" }; private static String newline = System.getProperty("line.separator"); // The Marcom-atic 9000 private static ByteBuffer[] utterBS(int howMany) throws Exception { List list = new LinkedList(); for (int i = 0; i < howMany; i++) { list.add(pickRandom(col1, " ")); list.add(pickRandom(col2, " ")); list.add(pickRandom(col3, newline)); } ByteBuffer[] bufs = new ByteBuffer[list.size()]; list.toArray(bufs); return (bufs); } // The communications director private static Random rand = new Random(); // Pick one, make a buffer to hold it and the suffix, load it with // the byte equivalent of the strings (will not work properly for // non-Latin characters), then flip the loaded buffer so it's ready // to be drained private static ByteBuffer pickRandom(String[] strings, String suffix) throws Exception { String string = strings[rand.nextInt(strings.length)]; int total = string.length() + suffix.length(); ByteBuffer buf = ByteBuffer.allocate(total); buf.put(string.getBytes("US-ASCII")); buf.put(suffix.getBytes("US-ASCII")); buf.flip(); return (buf); } }
[ "ganshu@2dfire.com" ]
ganshu@2dfire.com
a31827248748cad353b1913f895b923591efc515
1046433f0d315bf905fef6ab3d78dfa5ff0c77ef
/src/Test/wordcountinstring.java
086f20e1bf7e14cdaeff18ed9f697a70ca956b51
[]
no_license
varalakshmi2005/SeleniumPractise
f561315ae614889b5ef9f9c93f7b17a71c80063a
69f23f0ce5b4f455f697d1f7d1960142e9cd9e24
refs/heads/master
2023-03-05T03:41:11.500153
2021-02-21T14:29:31
2021-02-21T14:29:31
340,914,063
0
0
null
null
null
null
UTF-8
Java
false
false
426
java
package Test; import java.util.Scanner; public class wordcountinstring { public static void main(String[] args) { System.out.println("Enter the string"); Scanner src=new Scanner(System.in); String s=src.nextLine(); int count=1; for(int i=0;i<s.length()-1;i++) { if((s.charAt(i)==' ') && (s.charAt(i+1)!=' ')) { count++; } } System.out.println("Count the words :"+count); } }
[ "varalakshmi.ponna13@gmail.com" ]
varalakshmi.ponna13@gmail.com
71adc535145f57e8692d5273f3df154a5d618fb6
48e835e6f176a8ac9ae3ca718e8922891f1e5a18
/benchmark/validation/uk/gov/gchq/gaffer/sketches/datasketches/frequencies/serialisation/StringsSketchSerialiserTest.java
91211a5dd55846dd424bf57f4469f4d5e9a9d490
[]
no_license
STAMP-project/dspot-experiments
f2c7a639d6616ae0adfc491b4cb4eefcb83d04e5
121487e65cdce6988081b67f21bbc6731354a47f
refs/heads/master
2023-02-07T14:40:12.919811
2019-11-06T07:17:09
2019-11-06T07:17:09
75,710,758
14
19
null
2023-01-26T23:57:41
2016-12-06T08:27:42
null
UTF-8
Java
false
false
1,198
java
/** * Copyright 2017-2019 Crown Copyright * * 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 uk.gov.gchq.gaffer.sketches.datasketches.frequencies.serialisation; import com.yahoo.sketches.frequencies.ItemsSketch; import org.junit.Assert; import org.junit.Test; import uk.gov.gchq.gaffer.sketches.clearspring.cardinality.serialisation.ViaCalculatedValueSerialiserTest; public class StringsSketchSerialiserTest extends ViaCalculatedValueSerialiserTest<ItemsSketch<String>, Long> { @Test public void testCanHandleItemsSketch() { Assert.assertTrue(serialiser.canHandle(ItemsSketch.class)); Assert.assertFalse(serialiser.canHandle(String.class)); } }
[ "benjamin.danglot@inria.fr" ]
benjamin.danglot@inria.fr
79c0346439a5aefecad5f9358ce4a31adfdcce81
bc3c96ec9312492b2f1784b106c5082f7cc2976c
/docroot/WEB-INF/service/com/lc/survey/NoSuchSurveyMainException.java
3ecc6981d7145d572a302d47cd5b638b1dbd7b74
[]
no_license
Whuzzup-design/LC-Survey
1c715438731a0a367640f88de1706122e138952b
b82a3913f89adce2a849c83fb0def331d2071b9c
refs/heads/master
2021-12-26T06:43:29.020753
2021-12-25T09:35:59
2021-12-25T09:35:59
240,186,947
0
0
null
null
null
null
UTF-8
Java
false
false
1,042
java
/** * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. */ package com.lc.survey; import com.liferay.portal.NoSuchModelException; /** * @author kevin */ public class NoSuchSurveyMainException extends NoSuchModelException { public NoSuchSurveyMainException() { super(); } public NoSuchSurveyMainException(String msg) { super(msg); } public NoSuchSurveyMainException(String msg, Throwable cause) { super(msg, cause); } public NoSuchSurveyMainException(Throwable cause) { super(cause); } }
[ "rockinskate@gmail.com" ]
rockinskate@gmail.com
da2e50e71af41f52d0086af2a2157ba4e776ec1b
fd2aa5f7ec060ccee8bf42505cd900f82c16e1d7
/org-zorkclone/src/main/java/org/zorkclone/core/ActionParserHelper.java
c60cd3236831a3e50b5a5874ec7b9c5951e40cc4
[]
no_license
DbImko/ZorkClone
08df4703c0b7fc51a8851d8ebad0918a4b36e33c
acdb2d493fe91854498574f0451f48054c338c85
refs/heads/master
2020-05-20T06:56:18.315947
2013-05-15T16:38:53
2013-05-15T16:38:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,339
java
package org.zorkclone.core; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.zorkclone.core.model.ActionModel; import org.zorkclone.core.model.ActionType; public class ActionParserHelper { private static final String UPDATE_PATTERN = "Update (\\w*) to (\\w*)"; private static final String DELETE_PATTERN = "Delete (\\w*)"; private static final String ADD_PATTERN = "Add (\\w*) to (\\w*)"; public static ActionModel parse(String action) { if (action == null || action.isEmpty()) { return null; } Pattern pattern = Pattern.compile(UPDATE_PATTERN, Pattern.CASE_INSENSITIVE); Matcher m = pattern.matcher(action); if (m.find()) { ActionModel result = new ActionModel(ActionType.UPDATE); result.setItem(m.group(1)); result.setStatus(m.group(2)); return result; } pattern = Pattern.compile(DELETE_PATTERN, Pattern.CASE_INSENSITIVE); m = pattern.matcher(action); if (m.find()) { ActionModel result = new ActionModel(ActionType.DELETE); result.setItem(m.group(1)); return result; } pattern = Pattern.compile(ADD_PATTERN, Pattern.CASE_INSENSITIVE); m = pattern.matcher(action); if (m.find()) { ActionModel result = new ActionModel(ActionType.ADD); result.setItem(m.group(1)); result.setOwner(m.group(2)); return result; } return null; } }
[ "dbimko@gmail.com" ]
dbimko@gmail.com
4a64717220befe3459bb40bb6b2f53fa3cf91936
a7140a62a8d147d77e358191a85c03005ca10d64
/leetcode-algorithm/src/main/java/com/ly/string/Case27.java
2e3b4e98ac065c12a4d097a3588efc1cf2834fae
[]
no_license
tinyLuo/leetcode
1d49b9b6ecd2ccae9dd778af8583bf375b858ac0
814d71b8114227c3307fc77ee221973b3960545a
refs/heads/master
2020-04-19T08:39:31.151497
2019-04-15T13:57:40
2019-04-15T13:57:40
168,085,071
1
0
null
null
null
null
UTF-8
Java
false
false
418
java
package com.ly.string; public class Case27 { public static int removeElement(int[] nums, int val) { int i = 0; for (int j = 0; j < nums.length; j++) { if (nums[j] != val) { nums[i] = nums[j]; i++; } } return i; } public static void main(String[] args) { removeElement(new int[] { 3, 2, 2, 3 }, 3); } }
[ "luoyao@didichuxing.com" ]
luoyao@didichuxing.com
112058daba7d5fe57e56a0fcc8ec446492421246
bd59f9a9b7bf598a1168299dce0b1e07b91c8729
/src/main/java/com/geekq/miaosha/service/rpchander/RpcCompensateService.java
43fd0ff0bceb731b86d8a835e584d9899ce14f75
[]
no_license
jiayangchen/miaosha
8425be8ad35d4a512c8a53302c03b43517d94b98
3dc731e70195176f49d5e021e0af954368e74270
refs/heads/master
2020-04-18T01:01:10.107267
2019-01-22T15:19:03
2019-01-22T15:19:03
167,101,943
3
0
null
2019-01-23T02:21:49
2019-01-23T02:21:49
null
UTF-8
Java
false
false
3,770
java
package com.geekq.miaosha.service.rpchander; import com.geekq.miaosha.common.SnowflakeIdWorker; import com.geekq.miaosha.common.resultbean.ResultGeekQ; import com.geekq.miaosha.service.rpchander.enums.PlanStepStatus; import com.geekq.miaosha.service.rpchander.enums.PlanStepType; import com.geekq.miaosha.service.rpchander.vo.HandlerParam; import com.geekq.miaosha.service.rpchander.vo.PlanOrder; import com.geekq.miaosha.service.rpchander.vo.PlanStep; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.Date; import java.util.List; @Service public class RpcCompensateService { public ResultGeekQ<String> recharge(){ ResultGeekQ<String> result = ResultGeekQ.build(); /** * 各种校验check */ /** * 需要可加redis分布式锁 */ /** * 拦截 * 校验状态 -- init 或 ROLLING_BACK则 返回 * * 成功则返回已处理状态 */ /** * 生成订单和处理步骤 */ /** * 获取订单 */ long orderId = SnowflakeIdWorker.getOrderId(1,1); /** * 创建订单步骤 可定义一个VO * 一个planorder 对应多个planstep * 创建 PlanOrder 创建 planStep * createOrderStep(vo); */ // PlanOrder planOrder = new PlanOrder(); // planOrder.setCreateTime(new Date()); // planOrder.setVersion(0); // planOrder.setUserId(inputVo.getUserId()); // planOrder.setOrderNo(inputVo.getOrderNo()); // planOrder.setType(PlanOrderType.X_RECHARGE.name()); // planOrder.setParams(params); // planOrder.setStatus(PlanOrderStatus.INIT.name()); // planOrderDao.insertSelective(planOrder); // // List<PlanStep> steps = new ArrayList<>(); // //第一步请求民生 // steps.add(planStepLogic.buildStep(planOrder.getId(), PlanStepType.X_RECHARGE_CMBC, PlanStepStatus.INIT)); // if (inputVo.getCouponId() != null) { // //第二步使用优惠券 // steps.add(planStepLogic.buildStep(planOrder.getId(), PlanStepType.X_RECHARGE_USE_COUPON, PlanStepStatus.INIT)); // } // //第三步减扣主账户 // steps.add(planStepLogic.buildStep(planOrder.getId(), PlanStepType.X_RECHARGE_POINT, PlanStepStatus.INIT)); // //第四部减扣子账户 // steps.add(planStepLogic.buildStep(planOrder.getId(), PlanStepType.X_RECHARGE_SUB_POINT, PlanStepStatus.INIT)); // //第五步发送通知 // steps.add(planStepLogic.buildStep(planOrder.getId(), PlanStepType.X_RECHARGE_NOTIFY, PlanStepStatus.INIT)); // // planStepDao.batchInsert(steps); /** * * 调用Rpc接口 第几步错误则回滚前几步 * 并更新step状态 * * 然后定时任务去处理 状态为INIT与ROLLBACK的 状态订单 * * */ // HandlerParam handlerParam = new HandlerParam(); // handlerParam.setPlanOrder(planOrder); // AutoInvestPlanRechargeOrderInputVo inputVo = JsonUtil.jsonToBean(planOrder.getParams(), AutoInvestPlanRechargeOrderInputVo.class); // handlerParam.setInputVo(inputVo); // for (int i = 0; i < planStepList.size(); i++) { // PlanStep planStep = planStepList.get(i); // PlanStepType stepType = PlanStepType.valueOf(planStep.getType()); // xxx handler = (xxx) xxxx.getApplicationContext().getBean(stepType.getHandler()); // boolean handlerResult = handler.handle(handlerParam); // if (!handlerResult) { // break; // } // } return result; } }
[ "qiurunze@youxin.com" ]
qiurunze@youxin.com
02eabb0269f54006c6b30c3974937413c3f8f409
c9ff26cd1055c64092b4fdefba860f8d4fb1ca82
/src/test/java/com/example/UndertowSSLDemo/UndertowSslDemoApplicationTests.java
11aa0ec21c45df8cc4e189bc9da9ad616758cc11
[]
no_license
JaxYoun/UndertowSSLDemo
607cd71b47d853095b562e215ae7425c4e82b426
98bfa31f3b440380de43322c6a1f0fbf066a476d
refs/heads/master
2021-04-27T03:57:36.965954
2019-07-31T03:59:38
2019-07-31T03:59:38
122,723,811
1
1
null
null
null
null
UTF-8
Java
false
false
353
java
package com.example.UndertowSSLDemo; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class UndertowSslDemoApplicationTests { @Test public void contextLoads() { } }
[ "gao88jie@qq.com" ]
gao88jie@qq.com
e390ae384cdefc69bc10db283288821c49291fb8
a0f280ce4a2aa529caf38539a82015c669e56280
/java project/src/Trees/NoOfNodes_BST.java
7389149a3f1bbd1d4b88ee89e5aa3ae7f4c1c494
[]
no_license
teja0404/hello-world
2eb0eb9475b5aa77fcce61b218f172a560339899
cc5b423bb720bdf5e167c100ab3189cd633ed3d3
refs/heads/master
2023-01-27T11:59:57.435661
2023-01-24T13:10:44
2023-01-24T13:10:44
128,071,714
0
0
null
2018-04-04T17:27:28
2018-04-04T14:10:45
null
UTF-8
Java
false
false
45
java
package Trees;public class NoOfNodes_BST { }
[ "durgai@workspot.com" ]
durgai@workspot.com
6ebea153472a1f1f7dc3f6f6e443a3e411daf18f
b61123abafe1fc7a11770216fd133bd3e4620dbc
/sapint/src/com/sapint/BapiReturnCollection.java
e574aae0be88c39e30c898b0d6a5397ba1c0533b
[]
no_license
wwsheng009/sap-dev-workspace
cefb099cf6bc0c31400bdf0ff89bf3e14e9cf5d4
6392cbedcd4c6a48da5aa4ef8c1fb491bd3d2e3e
refs/heads/master
2023-03-07T07:59:01.157866
2013-05-12T03:03:12
2013-05-12T03:03:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
330
java
/** * */ package com.sapint; import java.util.ArrayList; /** * @author vincent * */ public class BapiReturnCollection extends ArrayList<BapiReturn> { @Override public BapiReturn get(int i){ return (BapiReturn) super.get(i); } // public boolean add(BapiReturn bapiReturn){ // return super.add(bapiReturn); // } }
[ "vincentwwsheng@gmail.com" ]
vincentwwsheng@gmail.com
100b14f897dbdd81b61fdd046c9bc948a532a3ab
8e58b6359623231f513b044d96d724e6a498153b
/src/main/java/rosa/isabelle/inventorycontrol/dto/StockItemDTO.java
220bfc6dd2cc6f2431b4dece14abc11d1f8bcf53
[]
no_license
isabellerosa/controle-estoque-api
a6d388ef7bf8c89dc4f1e2574e5e5f32bf671cb8
dec93bbb175e676a578707b62e45d3b62390fb77
refs/heads/master
2020-09-09T19:31:49.127205
2019-11-16T04:53:50
2019-11-16T04:53:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
182
java
package rosa.isabelle.inventorycontrol.dto; import lombok.Data; @Data public class StockItemDTO { private ItemDTO item; private StoreDTO store; private int quantity; }
[ "ibell.pereira@gmail.com" ]
ibell.pereira@gmail.com
7a37f6bed18527b753f84d057cedc2613bb08203
39ca712287c78ac6ae55887fe857318bf23ac9d7
/trunk/src/factory/ranger/view/VendorPanel.java
3280202cca7465884f76353e6e1344df5827c14e
[]
no_license
BGCX067/factory-ranger-svn-to-git
4415a52d3c3c6efa1d1a0fde5edaab223a0df6a2
b19a9160d974754d0b57c93a4a05fb8a8235bb80
refs/heads/master
2016-09-01T08:55:03.339705
2015-12-28T14:39:12
2015-12-28T14:39:12
48,871,930
0
0
null
null
null
null
UTF-8
Java
false
false
3,532
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package factory.ranger.view; import factory.ranger.model.ListVendor; import factory.ranger.model.Machine; import factory.ranger.model.Vendor; import factory.ranger.utility.Input; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Rectangle; import java.io.IOException; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.ScrollPaneConstants; /** * * @author axioo */ public class VendorPanel extends JPanel{ public VendorPanel(){ } public String getString(Vendor vendor, int i){ String temp = ""; temp += "[vendor "+vendor.getName() +"]\n"; temp += " position\t\t: ("+vendor.getPosition().x+", "+vendor.getPosition().y+")\n"; temp += " available machines\t: "; Machine[] m = ListVendor.getSingleton().getListVendor().get(i).getListOfMachines(); for(int j=1; j<m.length; j++){ if(j<m.length-1) temp += vendor.getListOfMachines()[j].getNumber()+", "; else temp += vendor.getListOfMachines()[j].getNumber(); } temp += "\n"; return temp; } public JScrollPane getContent() throws IOException { Dimension d = new Dimension(570,360); JPanel panel = new JPanel(new GridBagLayout()); panel.setBounds(new Rectangle(d)); panel.setBackground(new Color(229, 224, 181)); //panel.setOpaque(false); GridBagConstraints gbc= new GridBagConstraints(); gbc.weightx = 1.0; gbc.gridx = 0; gbc.gridy = 0; gbc.anchor = GridBagConstraints.FIRST_LINE_START; //bottom of space for (int i=0;i<ListVendor.getSingleton().getListVendor().size();i++){ panel.add(getPanel(i, ListVendor.getSingleton().getListVendor().get(i)), gbc); gbc.gridy++; } return new JScrollPane(panel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED , ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); } private JPanel getPanel(int mesinke, Vendor vendor) throws IOException { JPanel panel = new JPanel(new GridBagLayout()); panel.setOpaque(false); GridBagConstraints gbc = new GridBagConstraints(); int x = 0; gbc.gridx = 0; gbc.gridy = 0; gbc.gridwidth = 2; gbc.anchor = GridBagConstraints.FIRST_LINE_START; //bottom of space gbc.insets.set(15, 10, 0, 0); JTextArea no_machine = new JTextArea(); no_machine.setEditable(false); no_machine.setOpaque(false); no_machine.setFont(new Font("Trebuchet MS", 1, 18)); no_machine.setText(getString(vendor, mesinke)); no_machine.setLineWrap(true); no_machine.setBounds(new Rectangle(570, 350)); panel.add(no_machine, gbc); return panel; } public static void main(String[] args) throws IOException { JFrame f = new JFrame(); Input input = new Input("coba.txt"); VendorPanel vpanel = new VendorPanel(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.add(vpanel.getContent()); f.setSize(400,400); f.setLocation(200,200); f.setVisible(true); } }
[ "you@example.com" ]
you@example.com
d28d82deb05bbd203d2943eebab51f76b340192f
1b6f94b3788b1592eaacbcf0ca474e1387ba98eb
/app/app/src/main/java/com/cppsystem/cppbus/util/OkhttpManager.java
28fd0b9d796d5222d2490a1166b0b42559b03cf9
[]
no_license
FandryNoutah/cpp-pay-tpe
09d294b4723b1979e1243a8f75a760975a98fbfe
43980787eea57fab18bd5b2f970f22db0ae1dadf
refs/heads/master
2023-07-01T10:36:38.289662
2021-08-03T11:07:21
2021-08-03T11:07:21
379,240,205
0
0
null
null
null
null
UTF-8
Java
false
false
4,882
java
/* * Copyright (c) 2021. * ******************************************************************************* * This software is full property of CPP-SYSTEM MADAGASCAR SARL * This project was initially developped by Andrinarivo Rakotozafinirina on 2020 * ************************************************************************************ */ package com.cppsystem.cppbus.util; import android.content.Context; import java.io.IOException; import java.io.InputStream; import java.security.GeneralSecurityException; import java.security.KeyStore; import java.security.cert.Certificate; import java.security.cert.CertificateFactory; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; import java.util.concurrent.TimeUnit; import javax.net.ssl.KeyManagerFactory; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSocketFactory; import javax.net.ssl.TrustManager; import javax.net.ssl.TrustManagerFactory; import javax.net.ssl.X509TrustManager; import okhttp3.ConnectionPool; import okhttp3.OkHttpClient; import okhttp3.Protocol; public class OkhttpManager { static private OkhttpManager mOkhttpManager=null; private InputStream mTrustrCertificate; static public OkhttpManager getInstance() { if(mOkhttpManager==null) { mOkhttpManager=new OkhttpManager(); } return mOkhttpManager; } private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException { try { KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); InputStream in = null; // By convention, 'null' creates an empty key store. keyStore.load(in, password); return keyStore; } catch (IOException e) { throw new AssertionError(e); } } private X509TrustManager trustManagerForCertificates(InputStream in) throws GeneralSecurityException { CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); Collection<? extends Certificate> certificates = certificateFactory.generateCertificates(in); if (certificates.isEmpty()) { throw new IllegalArgumentException("expected non-empty set of trusted certificates"); } // Put the certificates a key store. char[] password = "password".toCharArray(); // Any password will work. KeyStore keyStore = newEmptyKeyStore(password); int index = 0; for (Certificate certificate : certificates) { String certificateAlias = Integer.toString(index++); keyStore.setCertificateEntry(certificateAlias, certificate); } // Use it to build an X509 trust manager. KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); keyManagerFactory.init(keyStore, password); TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); trustManagerFactory.init(keyStore); TrustManager[] trustManagers = trustManagerFactory.getTrustManagers(); if (trustManagers.length != 1 || !(trustManagers[0] instanceof X509TrustManager)) { throw new IllegalStateException("Unexpected default trust managers:" + Arrays.toString(trustManagers)); } return (X509TrustManager) trustManagers[0]; } public void setTrustrCertificates(InputStream in) { mTrustrCertificate=in; } public InputStream getTrustrCertificates() { return mTrustrCertificate; } public OkHttpClient.Builder build() { OkHttpClient.Builder okHttpClient=null; if(getTrustrCertificates()!=null) { X509TrustManager trustManager; SSLSocketFactory sslSocketFactory; try { trustManager = trustManagerForCertificates(getTrustrCertificates()); SSLContext sslContext = SSLContext.getInstance("TLS"); sslContext.init(null, new TrustManager[] { trustManager }, null); sslSocketFactory = sslContext.getSocketFactory(); } catch (GeneralSecurityException e) { throw new RuntimeException(e); } List<Protocol> listprotocol = new ArrayList<Protocol>(); listprotocol.add(Protocol.HTTP_1_1); okHttpClient = new OkHttpClient.Builder() .sslSocketFactory(sslSocketFactory, trustManager) .connectionPool(new ConnectionPool(0, 1, TimeUnit.NANOSECONDS)) // .retryOnConnectionFailure(false) .protocols(listprotocol); } else { okHttpClient = new OkHttpClient.Builder(); } return okHttpClient; } }
[ "andrinarivo.rakotozafinirina@cpp-system.com" ]
andrinarivo.rakotozafinirina@cpp-system.com
83dc8a2b5042e85e380acc7f09348cc9c0c699c8
d8f33e3f86feba283790046dca3aac7fd205233d
/app/src/main/java/com/perawat/yacob/perawat/SessionLogin.java
4ccdaf3cf73d5b62f0f0e811bf6476bf3b092388
[]
no_license
yacob21/Perawat
cdc0ec2751133b9e359eb0b9e1881302f7762e0c
85a418e1dd405fc5223bbc16015f797f60464c1b
refs/heads/master
2020-03-25T04:54:19.813767
2018-08-03T11:30:39
2018-08-03T11:30:39
143,419,434
0
0
null
null
null
null
UTF-8
Java
false
false
3,737
java
package com.perawat.yacob.perawat; /** * Created by yacob on 12/10/2017. */ import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import java.util.HashMap; public class SessionLogin { // Shared Preferences SharedPreferences pref; // Editor for Shared preferences SharedPreferences.Editor editor; // Context Context _context; // Shared pref mode int PRIVATE_MODE = 0; // Sharedpref file name private static final String PREF_NAME = "YacobPref"; // All Shared Preferences Keys private static final String IS_LOGIN = "IsLoggedIn"; // User name (make variable public to access from outside) public static final String KEY_NIP = "nip"; public static final String KEY_KEPALA = "kepala"; public static final String KEY_SHIFT ="shift"; // Constructor public SessionLogin(Context context) { this._context = context; pref = _context.getSharedPreferences(PREF_NAME, PRIVATE_MODE); editor = pref.edit(); } public void createLoginSession(String nip,String kepala,String shift){ // Storing login value as TRUE editor.putBoolean(IS_LOGIN, true); // Storing name in pref editor.putString(KEY_NIP, nip); editor.putString(KEY_KEPALA, kepala); editor.putString(KEY_SHIFT, shift); // commit changes editor.commit(); } public void checkLogin() { // Check login status if (!this.isLoggedIn()) { // user is not logged in redirect him to Login Activity Intent i = new Intent(_context, LoginActivity.class); // Closing all the Activities i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); // Add new Flag to start new Activity i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // Staring Login Activity _context.startActivity(i); } } public void checkLogin2() { // Check login status if (this.isLoggedIn()) { // user is not logged in redirect him to Login Activity Intent i = new Intent(_context, HomeActivity.class); // Closing all the Activities i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); // Add new Flag to start new Activity i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // Staring Login Activity _context.startActivity(i); } } public HashMap<String, String> getUserDetails(){ HashMap<String, String> user = new HashMap<String, String>(); // user name user.put(KEY_NIP, pref.getString(KEY_NIP, null)); user.put(KEY_KEPALA, pref.getString(KEY_KEPALA, null)); user.put(KEY_SHIFT, pref.getString(KEY_SHIFT, null)); // return user return user; } public void logoutUser() { // Clearing all data from Shared Preferences editor.clear(); editor.commit(); // After logout redirect user to Loing Activity Intent i = new Intent(_context, LoginActivity.class); // Closing all the Activities i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); // Add new Flag to start new Activity i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // Staring Login Activity _context.startActivity(i); } public void cleanUser() { // Clearing all data from Shared Preferences editor.clear(); editor.commit(); } public boolean isLoggedIn() { return pref.getBoolean(IS_LOGIN, false); } }
[ "yacob21@yahoo.com" ]
yacob21@yahoo.com
8eec9cc4ca1df947658efcc170b06989d88e8c91
175abdc876b6dc645a40b46f08b3c96f4f7bbabc
/lab4P2_MansourRumman/src/lab4p2_mansourrumman/phev.java
365cca2eaf161885b1c1719cc8d9283e54e9a86f
[]
no_license
MansourRumman/lab4p2_masourrumman
f5b978334474b34edb50b9f8e0aa6c38169f33d6
e0b5c3ea0b52638e934af8b7a8efedf137c253ac
refs/heads/main
2023-07-11T09:10:02.223929
2021-08-13T23:29:29
2021-08-13T23:29:29
395,826,919
0
0
null
null
null
null
UTF-8
Java
false
false
1,620
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package lab4p2_mansourrumman; /** * * @author manso */ public class phev extends carros{ private String tipo; private int cank, cmotores, cremol; public phev() { super(); } public phev(String tipo, int cank, int cmotores, int cremol, String modelo, String caseria, int VIN, int cantp, int capm) { super(modelo, caseria, VIN, cantp, capm); this.tipo = tipo; this.cank = cank; this.cmotores = cmotores; this.cremol = cremol; } public String getTipo() { return tipo; } public void setTipo(String tipo) { this.tipo = tipo; } public int getCank() { return cank; } public void setCank(int cank) { this.cank = cank; } public int getCmotores() { return cmotores; } public void setCmotores(int cmotores) { this.cmotores = cmotores; } public int getCremol() { return cremol; } public void setCremol(int cremol) { this.cremol = cremol; } @Override public String toString() { return "phev{" + "es de 4x4=" + tipo + ", cank=" + cank + ", cmotores=" + cmotores + ", cremol=" + cremol + '}'; } public int calc()throws excepcion{ int x= 2021-((super.getCantp())*cmotores)+(cank/cremol); if(x>30){ throw new excepcion(" se desgasta muy rapido"); } return x; } }
[ "88175201+MansourRumman@users.noreply.github.com" ]
88175201+MansourRumman@users.noreply.github.com
cc496471de25baf162133435a6ab4bf7691f6ef8
df916e4d4bc27133d0913da30f5b1a308c45fd3c
/commonSources/src/message/RegisterAnswerMessage.java
a8f7cc428c35a9dcb8437e5aec8e3a5cb2c8cdef
[]
no_license
flisergio/CultureCenter
50a9df6fc83e3c23d8c94f4656f84263a6ef55a3
10f3a342f55160c82f42eccd3146d020da3ad2ff
refs/heads/master
2020-04-09T00:59:51.483871
2018-11-29T16:47:42
2018-11-29T16:47:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
549
java
package message; public class RegisterAnswerMessage extends Message { private static final long serialVersionUID = 577625073596981704L; private final boolean ok; private final int infoCode; public RegisterAnswerMessage(boolean ok) { this.ok = ok; this.infoCode = 0; } public RegisterAnswerMessage(boolean ok, int infoCode) { this.ok = ok; this.infoCode = infoCode; } public boolean isOk() { return ok; } public int getInfoCode() { return infoCode; } }
[ "wazxse5@gmail.com" ]
wazxse5@gmail.com
2ea70b854a34f965c43403bc4914abfed9c71039
6d0d0570086b285deeb29d44fd743f7bb189a73e
/src/com/willtaylor/Player.java
161eea597a1c7b16edaa7c91cdd6807b151473bb
[]
no_license
fire-at-will/Java_Snake
d6c4302c30084217e4391f3a66ef2172ec3bf572
c15b61f6818f09b7f61c67c9a6273aaf958911fd
refs/heads/master
2021-01-01T16:20:27.714682
2015-01-12T04:14:21
2015-01-12T04:14:21
29,115,701
0
0
null
null
null
null
UTF-8
Java
false
false
447
java
package com.willtaylor; import java.util.ArrayList; /** * Created by willtaylor on 9/5/14. */ public class Player { public Control control; public final int UP = 1; public final int DOWN = 0; public final int LEFT = 2; public final int RIGHT = 3; public volatile int direction = LEFT; public ArrayList<Integer> directions; public Player(Control control){ this.control = control; } }
[ "wtaylor151@gmail.com" ]
wtaylor151@gmail.com
9b4c694d973613e83e507f334e625dd678ddefc0
44e7adc9a1c5c0a1116097ac99c2a51692d4c986
/aws-java-sdk-cognitoidp/src/main/java/com/amazonaws/services/cognitoidp/model/transform/SoftwareTokenMFANotFoundExceptionUnmarshaller.java
c8a64529918e4a44b7f92a9e0b42b34f047ed44f
[ "Apache-2.0" ]
permissive
QiAnXinCodeSafe/aws-sdk-java
f93bc97c289984e41527ae5bba97bebd6554ddbe
8251e0a3d910da4f63f1b102b171a3abf212099e
refs/heads/master
2023-01-28T14:28:05.239019
2020-12-03T22:09:01
2020-12-03T22:09:01
318,460,751
1
0
Apache-2.0
2020-12-04T10:06:51
2020-12-04T09:05:03
null
UTF-8
Java
false
false
3,006
java
/* * Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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.amazonaws.services.cognitoidp.model.transform; import java.math.*; import javax.annotation.Generated; import com.amazonaws.services.cognitoidp.model.*; import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*; import com.amazonaws.transform.*; import com.fasterxml.jackson.core.JsonToken; import static com.fasterxml.jackson.core.JsonToken.*; /** * SoftwareTokenMFANotFoundException JSON Unmarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class SoftwareTokenMFANotFoundExceptionUnmarshaller extends EnhancedJsonErrorUnmarshaller { private SoftwareTokenMFANotFoundExceptionUnmarshaller() { super(com.amazonaws.services.cognitoidp.model.SoftwareTokenMFANotFoundException.class, "SoftwareTokenMFANotFoundException"); } @Override public com.amazonaws.services.cognitoidp.model.SoftwareTokenMFANotFoundException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception { com.amazonaws.services.cognitoidp.model.SoftwareTokenMFANotFoundException softwareTokenMFANotFoundException = new com.amazonaws.services.cognitoidp.model.SoftwareTokenMFANotFoundException( null); int originalDepth = context.getCurrentDepth(); String currentParentElement = context.getCurrentParentElement(); int targetDepth = originalDepth + 1; JsonToken token = context.getCurrentToken(); if (token == null) token = context.nextToken(); if (token == VALUE_NULL) { return null; } while (true) { if (token == null) break; if (token == FIELD_NAME || token == START_OBJECT) { } else if (token == END_ARRAY || token == END_OBJECT) { if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) { if (context.getCurrentDepth() <= originalDepth) break; } } token = context.nextToken(); } return softwareTokenMFANotFoundException; } private static SoftwareTokenMFANotFoundExceptionUnmarshaller instance; public static SoftwareTokenMFANotFoundExceptionUnmarshaller getInstance() { if (instance == null) instance = new SoftwareTokenMFANotFoundExceptionUnmarshaller(); return instance; } }
[ "" ]
98c61f8ee54265e23002eace5f8357efe4ee8b0c
effac7ce1d4d943b6328b8ae4ae95d9a145ca751
/Teacher/app/src/main/java/com/example/psyyf2/dissertation/fragment/FragmentHomework.java
bf46b632c62b95b0795d55b20e973609f6e518bd
[]
no_license
Moiravan/Dissertation
ef469d7cb4990e4278f2973fa40ef1f8430d549d
75d798f06bba4c8443b22f154ce481e6cb304485
refs/heads/master
2020-04-21T10:54:33.342895
2019-02-07T01:19:13
2019-02-07T01:19:13
130,514,109
0
0
null
null
null
null
UTF-8
Java
false
false
6,841
java
package com.example.psyyf2.dissertation.fragment; import android.app.DatePickerDialog; import android.content.Intent; import android.database.Cursor; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.text.InputType; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.DatePicker; import android.widget.EditText; import android.widget.ListView; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.TextView; import com.example.psyyf2.dissertation.activity.HomeworkEdit; import com.example.psyyf2.dissertation.adapter.MyAdapterName; import com.example.psyyf2.dissertation.database.MyProviderContract; import com.example.psyyf2.dissertation.R; import java.util.Calendar; public class FragmentHomework extends Fragment { View inflate; private EditText date; String hDate; MyAdapterName dataAdapter; String status= ""; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { inflate = inflater.inflate(R.layout.activity_fragment_homework, null); Calendar c = Calendar.getInstance(); date = (EditText) inflate.findViewById(R.id.homedate1); date.setText(c.get(Calendar.YEAR) + "/" + (c.get(Calendar.MONTH) + 1) + "/" + c.get(Calendar.DAY_OF_MONTH)); date.setInputType(InputType.TYPE_NULL); //不显示系统输入键盘</span> hDate = date.getText().toString(); check(hDate, status); date.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { // TODO Auto-generated method stub if (hasFocus) { showDatePickerDialog(); } } }); date.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub showDatePickerDialog(); } }); //use radio button to set limitations on listview RadioGroup radioGroup = (RadioGroup) inflate.findViewById(R.id.RadioGrade); final RadioButton all = (RadioButton) inflate.findViewById(R.id.buttonall1); final RadioButton release = (RadioButton) inflate.findViewById(R.id.buttonopen); final RadioButton notRelease = (RadioButton) inflate.findViewById(R.id.buttonclose); all.setChecked(true); radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { if(checkedId == all.getId()) { status = ""; } else if (checkedId == release.getId()) { status ="" + "and" + " " + MyProviderContract.REA + "=" + "'" + "open" + "'" + " "; } else if (checkedId == notRelease.getId()) { status = "" + "and" + " " + MyProviderContract.REA + "=" + "'" + "close" + "'" + " "; } check(hDate, status); } }); return inflate; } public void check(String s, String statu) { String[] projection = new String[]{ MyProviderContract.Home_ID, MyProviderContract.C_ID, MyProviderContract.TITLE, MyProviderContract.DESCRIPTION, MyProviderContract.HDate, MyProviderContract.hGROUP, MyProviderContract.REA }; //display the information from database layout String colsToDisplay[] = new String[]{ MyProviderContract.Home_ID, MyProviderContract.TITLE, MyProviderContract.DESCRIPTION, MyProviderContract.hGROUP, MyProviderContract.C_ID, }; int[] colResIds = new int[]{ R.id.homeID, R.id.hometitle, R.id.homedescription, R.id.homegroup, R.id.obtainclassid1 }; Cursor cursor = FragmentHomework.this.getActivity().getContentResolver().query(MyProviderContract.Homework_URI, projection, MyProviderContract.HDate + "=" + "'" + s + "'" + " " + statu, null, null); //obtain context objection //set the class name dataAdapter = new MyAdapterName( this.getContext(), R.layout.db_homework_layout, cursor, colsToDisplay, colResIds, 0, "homework"); //load the listview and use setOnItemClickListener to manage each line ListView listView = (ListView) inflate.findViewById(R.id.homelist1); listView.setAdapter(dataAdapter); // dataAdapter.notifyDataSetChanged(); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView<?> myAdapter, View myView, int myItemInt, long mylng) { Intent intent = new Intent(FragmentHomework.this.getContext(), HomeworkEdit.class); final String id = ((TextView) myView.findViewById(R.id.homeID)).getText().toString(); final String cid = ((TextView) myView.findViewById(R.id.obtainclassid1)).getText().toString(); final String groupname = ((TextView) myView.findViewById(R.id.homegroup)).getText().toString(); //get the text Bundle bundle = new Bundle(); bundle.putString("HID", id); bundle.putString("ID", cid); bundle.putString("GROUP", groupname); intent.putExtras(bundle); //send ID and Title to another activity startActivity(intent); } }); } private void showDatePickerDialog() { Calendar c = Calendar.getInstance(); new DatePickerDialog(FragmentHomework.this.getContext(), new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int month, int day) { // TODO Auto-generated method stub date.setText(year+"/"+(month+1)+ "/"+ day); hDate = year+"/"+(month+1)+ "/"+ day; check(hDate, status); } }, c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DAY_OF_MONTH)).show(); } }
[ "759832901@qq.com" ]
759832901@qq.com
636a05daf5298b6c9daf299e2c74c17bf2d56b5d
2858f7086704d802143c5e1ab702300ee975b166
/src/pilha/Pilha.java
d8da63bd78574a126e065f6efc4ae89828dfc95f
[]
no_license
nandostaroski/pilha
66c98593ad435879989e13029168645b963279cd
16dde41c7f81596e3bbb3d5e2b800f79613d66a8
refs/heads/master
2021-01-21T15:44:31.037451
2017-05-19T23:59:22
2017-05-19T23:59:22
91,853,771
1
0
null
null
null
null
UTF-8
Java
false
false
179
java
package pilha; public interface Pilha { void push(Float v) throws Exception; Float pop() throws Exception; Float top(); boolean vazia(); void libera(); }
[ "fernando.staroski@gmail.com" ]
fernando.staroski@gmail.com
97b3d3d003685f6cea1b1fcf703e78657b81e785
e4a38bb0be30d1eb86f86328bb89d53ff22eacce
/sensor-status/src/main/java/status/Splitter.java
6adf0d969a56789280c1119cf6b46dc5bc99a985
[]
no_license
ivishwa/sensor-status
a7d8c3be5dcc88b67c9f086d68c2b15e0f310dc0
9106886a4818fb2bbc13dc63026f75117ba429e4
refs/heads/master
2021-08-12T00:26:27.839047
2016-02-20T06:33:22
2016-02-20T06:33:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
868
java
package status; import cascading.operation.BaseOperation; import cascading.operation.Function; import cascading.operation.FunctionCall; import cascading.tuple.Tuple; import cascading.tuple.Fields; import cascading.flow.FlowProcess; import cascading.tuple.TupleEntry; public class Splitter extends BaseOperation implements Function{ public Splitter(Fields fieldDeclaration) { super(1,fieldDeclaration ); } public void operate( FlowProcess flowProcess, FunctionCall functionCall ) { // get the arguments TupleEntry TupleEntry arguments = functionCall.getArguments(); String[] tokens = arguments.getString(0).split(","); // create a Tuple to hold our result values Tuple result = new Tuple(); result.add(tokens[0]); result.add(tokens[1]); result.add(tokens[2]); // return the result Tuple functionCall.getOutputCollector().add( result ); } }
[ "azad26195@gmail.com" ]
azad26195@gmail.com
f33f563541f2944a4ad56aae17aac7c25357ea97
0cb4d62c207ab9de172a60445b9c23b1b1d4abf1
/src/main/java/com/bookshop01/cscenter/vo/Criteria.java
a64e82e1edb70aa1589cd7fc52b398249a7ad6c1
[]
no_license
fks0513/cinebox
6375566148681350c4c4790520e79d7d59b91d3e
f002a9d98e359179fb56842630f6ab67f7a10329
refs/heads/master
2023-06-27T02:04:37.188019
2021-07-31T02:46:39
2021-07-31T02:46:39
null
0
0
null
null
null
null
UHC
Java
false
false
1,192
java
package com.bookshop01.cscenter.vo; public class Criteria { private int page; //현재 페이지 번호 private int perPageNum; //한 페이지에 출력할 개수 private int rowStart; //시작페이지 번호 private int rowEnd; //끝페이지 번호. 시작페이지번호에서 몇개 보여줄지 결정 public Criteria() { this.page = 1; this.perPageNum = 10; } public void setPage(int page) { if (page <= 0) { this.page = 1; return; } this.page = page; } public void setPerPageNum(int perPageNum) { if (perPageNum <= 0 || perPageNum > 100) { this.perPageNum = 10; return; } this.perPageNum = perPageNum; } public int getPage() { return page; } public int getPageStart() { return (this.page - 1) * perPageNum; } public int getPerPageNum() { return this.perPageNum; } public int getRowStart() { rowStart = ((page - 1) * perPageNum) + 1; return rowStart; } public int getRowEnd() { rowEnd = rowStart + perPageNum - 1; return rowEnd; } @Override public String toString() { return "Criteria [page=" + page + ", perPageNum=" + perPageNum + ", rowStart=" + rowStart + ", rowEnd=" + rowEnd + "]"; } }
[ "khyjin00@gmail.com" ]
khyjin00@gmail.com
987eb08d623bec38d68e682d8263e00660dd1136
d27cee6ec3aa3f91d1905522b9e901f41daa68bd
/CarShowroom/src/com/practice/shop/client/CarShowroomApp.java
52de5d424d3ef03bdc84ad714e9b2137e5919751
[]
no_license
Chaitra-Reddy/caps
fbaa9495be4a832a84f0294a95bf6e69dfac63f5
fa052c36fab335bb47fd8119f17bab2543bac711
refs/heads/master
2023-04-03T13:35:43.959544
2021-04-05T03:24:47
2021-04-05T03:24:47
353,590,733
0
0
null
null
null
null
UTF-8
Java
false
false
9,246
java
package com.practice.shop.client; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Scanner; import java.util.Set; import com.practice.shop.entity.Car; import com.practice.shop.entity.Showroom; import com.practice.shop.exception.InvalidBrandException; import com.practice.shop.exception.InvalidIdException; public class CarShowroomApp { private static Scanner sc = new Scanner(System.in); private static List<Showroom> showrooms = new ArrayList<Showroom>(); public static void main(String[] args) { int choice = 0; //mock data***************************************** Set<Car> mockCars1 = new HashSet<Car>(); mockCars1.add(new Car(11, "car one", "maruti", 2022, 200000)); mockCars1.add(new Car(12, "car two", "hyundai", 2023, 200000)); mockCars1.add(new Car(13, "car three", "maruti", 2003, 200000)); Showroom s1 = new Showroom(1002, "sai motors", mockCars1); Set<Car> mockCars2 = new HashSet<Car>(); mockCars2.add(new Car(21, "car one", "maruti", 2013, 200000)); mockCars2.add(new Car(22, "car two", "hyundai", 2003, 200000)); mockCars2.add(new Car(23, "car three", "maruti", 2002, 200000)); Showroom s2 = new Showroom(1001, "krishna motors", mockCars2); showrooms.add(s1); showrooms.add(s2); //************************************************** do { System.out.println("\n\n-------------------WELCOME--------------------------"); System.out.println("Choose one from the options below:"); System.out.println("(1) Add showroom and cars."); System.out.println("(2) Search car by showroom name."); System.out.println("(3) Sort showroom by id and cars in it by model year."); System.out.println("(4) Add car to a existing showroom."); System.out.println("(5) Exit."); System.out.println("--------------------------------------------------"); choice = sc.nextInt(); switch(choice) { case 1: try { Showroom s = addShowroom(); displayShowroom(s); } catch(InvalidIdException e) { System.out.println("Duplicate ID is not allowed. Try again."); } catch(InvalidBrandException e) { System.out.println("Brand invalid. Only Maruti and Hyundai allowed. Try again."); } break; case 2: if(!showrooms.isEmpty()) { System.out.println("\nEnter showroom name: "); sc.nextLine(); String showroomName = sc.nextLine(); Set<Car> cars = searchCarByShowroomName(showroomName); if(cars == null) { System.out.println("\nNo cars found!"); } else { displayCar(cars); } } else { System.out.println("ERROR: No showrooms registered in the system."); } break; case 3: if(!showrooms.isEmpty()) { showrooms = sortShowrooms(showrooms); for(Showroom s:showrooms) { displayShowroom(s); System.out.println("\n--------------------------"); } } else { System.out.println("ERROR: No showrooms registered in the system."); } break; case 4: if(!showrooms.isEmpty()) { System.out.println("\nEnter the showroom ID you want to add a car to: "); int showroomId = sc.nextInt(); try { addCar(showroomId); } catch(InvalidIdException e) { System.out.println("Duplicate ID is not allowed. Try again."); } catch(InvalidBrandException e) { System.out.println("Brand invalid. Only Maruti and Hyundai allowed. Try again."); } } else { System.out.println("ERROR: No showrooms registered in the system."); } break; case 5: System.out.println("\nExited."); return; } } while(choice != 5); } //method to add showroom with cars public static Showroom addShowroom() throws InvalidIdException,InvalidBrandException { Set<Car> tempCars = new HashSet<Car>(); Set<Integer> carIds = new HashSet<Integer>(); System.out.println("\nEnter showroom ID:"); int tempShowroomId = sc.nextInt(); if(!showrooms.isEmpty()) { if(findShowroomById(tempShowroomId) != null) { throw new InvalidIdException(); } } System.out.println("\nEnter showroom name:"); sc.nextLine(); String tempShowroomName = sc.nextLine(); System.out.println("\nEnter number of cars you want to add:"); int noOfCars = sc.nextInt(); for(int i=0; i<noOfCars; i++) { System.out.println("\nCar " + (i+1) + " details----"); System.out.println("\nEnter car ID:"); int tempCarId = sc.nextInt(); if(!tempCars.isEmpty() && !carIds.isEmpty()) { if(carIds.contains(tempCarId)) { throw new InvalidIdException(); } } System.out.println("\nEnter car name:"); sc.nextLine(); String tempCarName = sc.nextLine(); System.out.println("\nEnter car brand:"); String tempCarBrand = sc.nextLine(); if(!checkBrand(tempCarBrand)) { throw new InvalidBrandException(); } System.out.println("\nEnter car model year:"); int tempCarYear = sc.nextInt(); System.out.println("\nEnter car price:"); double tempCarPrice = sc.nextDouble(); Car car = new Car(tempCarId,tempCarName,tempCarBrand,tempCarYear,tempCarPrice); carIds.add(tempCarId); tempCars.add(car); } Showroom s = new Showroom(tempShowroomId,tempShowroomName,tempCars); showrooms.add(s); return s; } //method to display a showroom public static void displayShowroom(Showroom s) { System.out.println("\nShowroom ID: " + s.getId()); System.out.println("\nShowroom name: " + s.getName()); Set<Car> cars = s.getCars(); System.out.println("\n==== Car Details ====="); for(Car c: cars) { System.out.println("\nCar ID: " + c.getId()); System.out.println("\nCar name: " + c.getName()); System.out.println("\nCar brand: " + c.getBrand()); System.out.println("\nCar model year: " + c.getModelYear()); System.out.println("\nCar price: $" + c.getPrice()); System.out.println("\n---------"); } } public static void displayCar(Set<Car> cars) { for(Car c: cars) { System.out.println("\nCar ID: " + c.getId()); System.out.println("\nCar name: " + c.getName()); System.out.println("\nCar brand: " + c.getBrand()); System.out.println("\nCar model year: " + c.getModelYear()); System.out.println("\nCar price: $" + c.getPrice()); System.out.println("\n---------"); } } //check if showroom id already exists public static Showroom findShowroomById(int id) { for(Showroom s:showrooms) { if(s.getId() == id) { return s; } } return null; } //check for brand validity public static boolean checkBrand(String brand) { brand = upperCase(brand); if(brand.equals("MARUTI") || brand.equals("HYUNDAI")) { return true; } return false; } //convert string to uppercase public static String upperCase(String s) { String res = ""; for (int i = 0; i < s.length(); i++) { if (s.charAt(i) >= 'a' && s.charAt(i) <= 'z') { res += (char) ((int) s.charAt(i) - 32); } else { res += s.charAt(i); } } return res; } //========================================================================== public static Set<Car> searchCarByShowroomName(String showroomName) { for(Showroom s:showrooms) { if(upperCase(s.getName()).equals(upperCase(showroomName))) { return s.getCars(); } } return null; } //=========================================================================== //method to sort the showrooms based on ID and then the cars in it based on model year public static List<Showroom> sortShowrooms(List<Showroom> showrooms) { Collections.sort(showrooms); return showrooms; } //============================================================================ //add a car to an existing showroom public static void addCar(int showroomId) throws InvalidIdException, InvalidBrandException { if(findShowroomById(showroomId) != null) { Showroom s = findShowroomById(showroomId); int index = showrooms.indexOf(s); Set<Integer> carIds = new HashSet<Integer>(); for(Car c:s.getCars()) { carIds.add(c.getId()); } System.out.println("\nEnter car ID:"); int tempCarId = sc.nextInt(); if(!(s.getCars()).isEmpty() && carIds.contains(tempCarId)) { throw new InvalidIdException(); } System.out.println("\nEnter car name:"); sc.nextLine(); String tempCarName = sc.nextLine(); System.out.println("\nEnter car brand:"); String tempCarBrand = sc.nextLine(); if(!checkBrand(tempCarBrand)) { throw new InvalidBrandException(); } System.out.println("\nEnter car model year:"); int tempCarYear = sc.nextInt(); System.out.println("\nEnter car price:"); double tempCarPrice = sc.nextDouble(); Car car = new Car(tempCarId,tempCarName,tempCarBrand,tempCarYear,tempCarPrice); s.getCars().add(car); showrooms.set(index, s); for(Showroom s1:showrooms) { displayShowroom(s1); System.out.println("\n--------------------------"); } } else { System.out.println("\nSorry! No showroom found having the entered ID."); } } }
[ "chaitra.nuthanakalva@mindtree.com" ]
chaitra.nuthanakalva@mindtree.com
06651adbc3fab56b81df847977405a82e742da13
464c329607720a410221a237198f8de4b7cc8e53
/src/lecture/controller/LectureUpdateFormServlet.java
4223fc4b294ae688de782fd944c8c382d43ad1fd
[]
no_license
GwakHuisu/eightedu
42595fcb965a20695dc755100902c5b7999b660e
93ac83e25583cc1e72b55964dec21ae0c4061fd4
refs/heads/master
2021-03-02T06:39:23.207142
2020-03-08T18:20:23
2020-03-08T18:20:23
245,843,983
0
0
null
null
null
null
UTF-8
Java
false
false
1,723
java
package lecture.controller; 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 lecture.model.service.LectureService; import lecture.model.vo.Lecture; /** * Servlet implementation class LectureUpdateFormServlet */ @WebServlet("/updateForm.le") public class LectureUpdateFormServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public LectureUpdateFormServlet() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { int l_code = Integer.parseInt(request.getParameter("l_code")); Lecture lecture = new LectureService().selectLecture(l_code); String page = ""; if(lecture != null) { request.setAttribute("lecture", lecture); page = "views/lectureAttendPage/lectureUpdateForm.jsp"; }else { request.setAttribute("msg", "강좌등록 조회에 실패하였습니다."); page = "views/common/error.jsp"; } request.getRequestDispatcher(page).forward(request, response); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub doGet(request, response); } }
[ "gwakhuisu8110@gmail.com" ]
gwakhuisu8110@gmail.com
9956242ffbaee8fd82f2c8326bab5aaa3b583582
ef8c2e1245093d1e086dd1f1fb683ef2c92a3b50
/src/com/javaex/ex02/Goods.java
c94e66d75ae632163719c660bde7459b51c5a062
[]
no_license
seungmi9191/chapter02
f5a25de84ed447f3ea4a6a25c6669972df54befe
c86413125bd03205b05f24ca2ca92ee4733b4014
refs/heads/master
2021-04-06T01:44:06.784665
2018-03-13T15:01:17
2018-03-13T15:01:17
125,017,139
0
0
null
null
null
null
UTF-8
Java
false
false
1,291
java
package com.javaex.ex02; public class Goods { private String name; private int price; public Goods(String n, int p) { name = n; price = p; } //메소드 public void setName(String n) { name = n; } public void setPrice(int p) { price = p; } public String getName() { return name; } public int getPrice() { return price; } //값을 넣고 출력하는것만 만드는 것이 아님 //필요하면 다 만들 수 있음 //한 번에 출력하는 메소드 public void showinfo() { //인스턴트화 된 name,price의 내용값 System.out.print("상품이름: " + "\""+name+"\""+"\t"); System.out.println("가격: " + price); //-------------------------------------------------------------------- /* * public Goods() {}라는 생성자가 숨겨져있음 * */ /*public Goods() {} public Goods(String name, int price) { this.name = name; this.price = price; }*/ //---------------------------------------------------------------------- /* * public Goods(String name) { * this.name = name; * * public Goods(String name, int price) { * this(name); //다른 생성자의 name을 부름 * this.price = price; * */ } }
[ "wooseungmi@DESKTOP-HLAEO9O" ]
wooseungmi@DESKTOP-HLAEO9O
86c42242f0a5198350a3881680fc8cc8c3f04d3c
336a92f3c98b0c5f76f9c9c208e1fcbe1a9c9166
/MyLMSSpring/src/main/java/com/gcit/training/lms/dao/Book_copiesDAO.java
5a61260d87fde67c0e77b47d96371a4e857f9883
[]
no_license
MerwanMajid/training
78e5f8bb99179d0520c0fdf793b3775266f6b163
36778a474da76f8550b9999003d0fde46bdf7d08
refs/heads/master
2021-01-10T16:20:24.578034
2015-06-01T18:08:49
2015-06-01T18:08:49
36,037,003
0
0
null
null
null
null
UTF-8
Java
false
false
2,478
java
package com.gcit.training.lms.dao; import java.io.Serializable; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import org.springframework.jdbc.core.ResultSetExtractor; import com.gcit.training.lms.entity.*; public class Book_copiesDAO extends BaseDAO<List<Book_copies>> implements Serializable,ResultSetExtractor<List<Book_copies>>{ /** * */ private static final long serialVersionUID = 1L; public void addBook_copies(Book_copies book_copies) throws Exception { template.update("insert into tbl_book_copies (bookId,branchId,noOfCopies) values (?,?,?)", new Object[] { book_copies.getBook().getBookId(),book_copies.getBranch().getBranchId(),book_copies.getNoOfCopies() }); } public void update(Book_copies book_copies) throws Exception { int bookId = book_copies.getBook().getBookId(); int branchId = book_copies.getBranch().getBranchId(); int noOfCopies = book_copies.getNoOfCopies(); template.update("update tbl_book_copies set noOfCopies = ? where bookId = ? and branchId = ?", new Object[] {noOfCopies,bookId,branchId}); } public void delete(Book_copies book_copies) throws Exception { template.update("delete from tbl_book_copies where bookId = ? and branchId = ?", new Object[] { book_copies.getBook().getBookId(),book_copies.getBranch().getBranchId()}); } public List<Book_copies> readAll() throws Exception { return (List<Book_copies>) template.query("select * from tbl_book_copies", this); } public Book_copies readOne(int bookId,int branchId) throws Exception { List<Book_copies> list = (List<Book_copies>) template.query( "select * from tbl_book_copies where bookId = ? and branchId = ?", new Object[] { bookId, branchId },this); if (list != null && list.size() > 0) { //System.out.println(list.get(0).getBook().getBookId()); return list.get(0); } else { return null; } } @Override public List<Book_copies> extractData(ResultSet rs) throws SQLException { List<Book_copies> list = new ArrayList<Book_copies>(); while (rs.next()) { Book_copies a = new Book_copies(); a.setBook(new Book()); a.setBranch(new Branch()); a.getBook().setBookId(rs.getInt("bookId")); a.getBranch().setBranchId(rs.getInt("branchId")); a.setNoOfCopies(rs.getInt("noOfCopies")); list.add(a); } return list; } }
[ "HappyGuy@HappyGuy-PC" ]
HappyGuy@HappyGuy-PC
f0920586925b2fec5ad81cbcec10260e05ea5373
5b9bf2d5f6a281dd103e524f27048c468f840816
/src/test/java/com/crud/tasks/mapper/TrelloMapperTestSuite.java
4b73edf2d39941db8e7595900e5104c3490f49aa
[]
no_license
kdabrowski8712/kodilla-task-app
de9ebc421411c4331d86946b3c6170850181d2b9
a5abf011d1d4fd4847200ba23dc7cda1aebd72b5
refs/heads/master
2020-04-21T20:37:26.527107
2019-05-31T22:04:12
2019-05-31T22:04:12
169,851,669
0
0
null
null
null
null
UTF-8
Java
false
false
4,613
java
package com.crud.tasks.mapper; import com.crud.tasks.domain.*; import org.hibernate.validator.constraints.br.TituloEleitoral; import org.junit.Assert; import org.junit.Test; import java.util.ArrayList; import java.util.List; public class TrelloMapperTestSuite { @Test public void testMapToBoards() { //Given TrelloListDto list1 = new TrelloListDto("1", "testList1",false); TrelloListDto list2 = new TrelloListDto("2", "testList2",true); List<TrelloListDto> testTrelloList = new ArrayList<>(); testTrelloList.add(list1); testTrelloList.add(list2); TrelloBoardDto boardDto = new TrelloBoardDto("1","myboard1",testTrelloList); List<TrelloBoardDto> boardDtoList = new ArrayList<>(); boardDtoList.add(boardDto); TrelloMapper trelloMapper = new TrelloMapper(); //When List<TrelloBoard> result = trelloMapper.mapToBoards(boardDtoList); //Then Assert.assertEquals("1",result.get(0).getId()); Assert.assertEquals("myboard1",result.get(0).getName()); Assert.assertEquals("testList1",result.get(0).getLists().get(0).getName()); Assert.assertEquals(false,result.get(0).getLists().get(0).isClosed()); } @Test public void testMapToBoardsDto() { //Given List<TrelloList> testTrelloList = new ArrayList<>(); testTrelloList.add(new TrelloList("1", "testList1",false)); testTrelloList.add(new TrelloList("2", "testList2",true)); TrelloBoard board = new TrelloBoard("1","myboard1",testTrelloList); List<TrelloBoard> boardList = new ArrayList<>(); boardList.add(board); TrelloMapper trelloMapper = new TrelloMapper(); //When List<TrelloBoardDto> trelloBoardDtoList = trelloMapper.mapToBoardsDto(boardList); // Then Assert.assertEquals("1",trelloBoardDtoList.get(0).getId()); Assert.assertEquals("myboard1",trelloBoardDtoList.get(0).getName()); Assert.assertEquals("testList1",trelloBoardDtoList.get(0).getLists().get(0).getName()); Assert.assertEquals(false,trelloBoardDtoList.get(0).getLists().get(0).isClosed()); } @Test public void testMapToList() { //given List<TrelloListDto> trelloListDtos = new ArrayList<>(); trelloListDtos.add(new TrelloListDto("1", "testList1",false)); trelloListDtos.add(new TrelloListDto("2", "testList2",true)); TrelloMapper trelloMapper = new TrelloMapper(); //when List<TrelloList> trelloList = trelloMapper.mapToList(trelloListDtos); //then Assert.assertEquals("2",trelloList.get(1).getId()); Assert.assertEquals("testList2",trelloList.get(1).getName()); Assert.assertEquals(true, trelloList.get(1).isClosed()); } @Test public void testMapToListDto() { //given List<TrelloList> trelloList = new ArrayList<>(); trelloList.add(new TrelloList("1", "testList1",false)); trelloList.add(new TrelloList("2", "testList2",true)); TrelloMapper trelloMapper = new TrelloMapper(); //when List<TrelloListDto> trelloListDtos = trelloMapper.mapToListDto(trelloList); //then Assert.assertEquals("2",trelloListDtos.get(1).getId()); Assert.assertEquals("testList2",trelloListDtos.get(1).getName()); Assert.assertEquals(true, trelloListDtos.get(1).isClosed()); } @Test public void testMapToCardDto() { //given TrelloCard trelloCard = new TrelloCard("testCard","testDesc","top","1"); TrelloMapper trelloMapper = new TrelloMapper(); //when TrelloCardDto trelloCardDto = trelloMapper.mapToCardDto(trelloCard); //then Assert.assertEquals("1",trelloCardDto.getListId()); Assert.assertEquals("testCard",trelloCardDto.getName()); Assert.assertEquals("top",trelloCardDto.getPos()); Assert.assertEquals("testDesc",trelloCardDto.getDescription()); } @Test public void testMapToCard() { //given TrelloCardDto trelloCardDto = new TrelloCardDto("testCard","testDesc","top","1"); TrelloMapper trelloMapper = new TrelloMapper(); //when TrelloCard trelloCard = trelloMapper.mapToCard(trelloCardDto); //then Assert.assertEquals("1",trelloCard.getListId()); Assert.assertEquals("testCard",trelloCard.getName()); Assert.assertEquals("top",trelloCard.getPos()); Assert.assertEquals("testDesc",trelloCard.getDescription()); } }
[ "k.dabrowski8712@gmail.com" ]
k.dabrowski8712@gmail.com
e4bf647361625432ea7843f1037698114b9f1b0f
d079765b7de19f21f321ec8b87547bb219844ff1
/2p-plugin/tags/REL-2.6.0/alice.tuprologx.eclipse/src/alice/tuprologx/eclipse/properties/EnginesManagement.java
89309296792955d312759b349bb0a23a393ebd27
[]
no_license
wvelandia/tuprolog
40cb91543fc48a18ee0ef85a5dea2a1c16f29a82
d4f15df382412613a8255e78683b13ffb52ccc47
refs/heads/master
2021-01-10T01:53:13.599010
2015-04-17T18:40:45
2015-04-17T18:40:45
47,853,071
0
0
null
null
null
null
UTF-8
Java
false
false
17,842
java
package alice.tuprologx.eclipse.properties; import java.util.Vector; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; import org.eclipse.jface.dialogs.InputDialog; import org.eclipse.swt.SWT; import org.eclipse.swt.events.MouseAdapter; import org.eclipse.swt.events.MouseEvent; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.layout.RowData; import org.eclipse.swt.layout.RowLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.List; import org.eclipse.ui.dialogs.PropertyPage; import alice.tuprologx.eclipse.core.PrologEngine; import alice.tuprologx.eclipse.core.PrologEngineFactory; public class EnginesManagement extends PropertyPage { List listEngine = null; Group libraryGroup = null; Group scopeGroup = null; List listLibrary = null; Button[] theoriesButtons = null; String motoreScelto = ""; Button deleteEngine; Button renameEngine; Button loadEngine; Button loadLibrary; Button unloadLibrary; // Costruttore public EnginesManagement() { super(); } // Crea i componenti grafici e ne gestisce la visualizzazione protected Control createContents(final Composite parent) { final String name = ((IResource) getElement()).getName(); final Composite container = new Composite(parent, SWT.NULL); container.setLayout(new RowLayout(SWT.VERTICAL)); final Group engineGroup = new Group(container, SWT.NONE); engineGroup.setText("Engines"); engineGroup.setLayout(new RowLayout(SWT.HORIZONTAL)); listEngine = new List(engineGroup, SWT.BORDER); final RowData rowData_1 = new RowData(); rowData_1.height = 120; rowData_1.width = 240; listEngine.setLayoutData(rowData_1); listEngine.setToolTipText("Loaded engines"); String[] items = new String[PrologEngineFactory.getInstance() .getProjectEngines(name).size()]; for (int j = 0; j < PrologEngineFactory.getInstance() .getProjectEngines(name).size(); j++) { items[j] = PrologEngineFactory.getInstance().getEngine(name, j) .getName(); } listEngine.setItems(items); final Composite compositeEngine = new Composite(engineGroup, SWT.NONE); compositeEngine.setLayout(new GridLayout()); final RowData rowData_2 = new RowData(); rowData_2.width = 80; rowData_2.height = 100; compositeEngine.setLayoutData(rowData_2); listEngine.addMouseListener(new MouseAdapter() { public void mouseUp(final MouseEvent e) { String[] selection = listEngine.getSelection(); if (selection.length != 0) { listLibrary.removeAll(); for (int j = 0; j < selection.length; j++) { motoreScelto = selection[j]; libraryGroup.setText("Libraries on: \"" + motoreScelto + "\""); listLibrary.setToolTipText("Loaded libraries on: \"" + motoreScelto + "\""); scopeGroup.setText("Default scope of: \"" + motoreScelto + "\""); for (int i = 0; i < PrologEngineFactory.getInstance() .getProjectEngines(name).size(); i++) { if (PrologEngineFactory.getInstance() .getEngine(name, i).getName() .equals(motoreScelto)) { Vector<String> lib = PropertyManager .getLibrariesFromProperties( (IProject) getElement(), motoreScelto); String[] librerie = new String[lib.size()]; for (int k = 0; k < librerie.length; k++) { librerie[k] = (String) lib.elementAt(k); } listLibrary.setItems(librerie); } } } for (int j = 0; j < theoriesButtons.length; j++) theoriesButtons[j].setSelection(false); Vector<String> theories = new Vector<String>(); try { IResource[] resources = ((IProject) getElement()) .members(); for (int j = 0; j < resources.length; j++) if ((resources[j] instanceof IFile) && (resources[j].getName().endsWith(".pl"))) theories.add(resources[j].getName()); } catch (CoreException e1) { } Vector<?> theoriesFromProperties = PropertyManager .getTheoriesFromProperties((IProject) getElement(), motoreScelto); for (int j = 0; j < theories.size(); j++) { theoriesButtons[j].setText(theories .elementAt(j)); if (PropertyManager.allTheories( (IProject) getElement(), motoreScelto)) theoriesButtons[j].setSelection(true); else for (int k = 0; k < theoriesFromProperties.size(); k++) if (((String) theoriesFromProperties .elementAt(k)).equals(theories .elementAt(j))) { theoriesButtons[j].setSelection(true); } } if (PrologEngineFactory.getInstance() .getProjectEngines(name).size() != 1) { deleteEngine.setEnabled(true); } else deleteEngine.setEnabled(false); loadLibrary.setEnabled(true); for (int j = 0; j < theoriesButtons.length; j++) theoriesButtons[j].setEnabled(true); renameEngine.setEnabled(true); } } }); loadEngine = new Button(compositeEngine, SWT.NONE); loadEngine.addMouseListener(new MouseAdapter() { public void mouseUp(final MouseEvent e) { String scelta = LoadEngine.show(null, "LoadEngine", (IProject) getElement(), listEngine.getItems()); if (scelta != null) { motoreScelto = ""; listLibrary.removeAll(); for (int j = 0; j < theoriesButtons.length; j++) theoriesButtons[j].setSelection(false); libraryGroup.setText("Libraries on: "); listLibrary.setToolTipText("Loaded libraries on: "); scopeGroup.setText("Default scope of: "); listEngine.add(scelta); PrologEngine engine = PrologEngineFactory.getInstance() .addEngine(name, scelta); Vector<String> v = new Vector<String>(); PropertyManager.setLibrariesOnEngine(v, engine); PropertyManager.setLibraryInProperties( (IProject) getElement(), scelta, new String[0]); listEngine.deselectAll(); deleteEngine.setEnabled(false); renameEngine.setEnabled(false); loadLibrary.setEnabled(false); unloadLibrary.setEnabled(false); for (int j = 0; j < theoriesButtons.length; j++) theoriesButtons[j].setEnabled(false); } } }); loadEngine .setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); loadEngine.setToolTipText("Click to create new engine"); loadEngine.setText("Create"); deleteEngine = new Button(compositeEngine, SWT.NONE); deleteEngine.addMouseListener(new MouseAdapter() { public void mouseUp(final MouseEvent e) { motoreScelto = ""; String[] selection = listEngine.getSelection(); listLibrary.removeAll(); for (int j = 0; j < theoriesButtons.length; j++) theoriesButtons[j].setSelection(false); libraryGroup.setText("Libraries on: "); listLibrary.setToolTipText("Loaded libraries on: "); scopeGroup.setText("Default scope of: "); for (int i = 0; i < selection.length; i++) { listEngine.remove(selection[i]); PrologEngineFactory.getInstance().deleteEngine(name, selection[i]); PropertyManager.deleteEngineInProperties( (IProject) getElement(), selection[i], listEngine.getItems()); } deleteEngine.setEnabled(false); loadLibrary.setEnabled(false); unloadLibrary.setEnabled(false); for (int j = 0; j < theoriesButtons.length; j++) theoriesButtons[j].setEnabled(false); renameEngine.setEnabled(false); } }); deleteEngine.setEnabled(false); deleteEngine.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); deleteEngine.setToolTipText("Click to remove the selected engine"); deleteEngine.setText("Remove"); renameEngine = new Button(compositeEngine, SWT.NONE); renameEngine.addMouseListener(new MouseAdapter() { public void mouseUp(final MouseEvent e) { InputDialog d = new InputDialog(null, "Rename Engine", "Engine name:", "", new EngineValidator(listEngine .getItems())); d.open(); String scelta = d.getValue(); if (scelta != null) { listLibrary.removeAll(); for (int j = 0; j < theoriesButtons.length; j++) theoriesButtons[j].setSelection(false); libraryGroup.setText("Libraries on: "); listLibrary.setToolTipText("Loaded libraries on: "); scopeGroup.setText("Default scope of: "); for (int i = 0; i < PrologEngineFactory.getInstance() .getProjectEngines(name).size(); i++) if (PrologEngineFactory.getInstance() .getEngine(name, i).getName() .equals(motoreScelto)) PrologEngineFactory.getInstance() .getEngine(name, i).rename(scelta); Vector<?> lib = PropertyManager.getLibrariesFromProperties( (IProject) getElement(), motoreScelto); String[] library = new String[lib.size()]; for (int i = 0; i < lib.size(); i++) library[i] = (String) lib.elementAt(i); Vector<?> theor = PropertyManager.getTheoriesFromProperties( (IProject) getElement(), motoreScelto); String[] theories = new String[theor.size()]; boolean all = false; if (PropertyManager.allTheories((IProject) getElement(), motoreScelto)) { all = true; } else { for (int i = 0; i < theor.size(); i++) { theories[i] = (String) theor.elementAt(i); } } listEngine.setItem(listEngine.getSelectionIndex(), scelta); PropertyManager.deleteEngineInProperties( (IProject) getElement(), motoreScelto, listEngine.getItems()); PropertyManager.setLibraryInProperties( (IProject) getElement(), scelta, library); if (all) PropertyManager.setTheoriesInProperty( (IProject) getElement(), scelta, null, true); else PropertyManager.setTheoriesInProperty( (IProject) getElement(), scelta, theories, false); listEngine.deselectAll(); deleteEngine.setEnabled(false); renameEngine.setEnabled(false); loadLibrary.setEnabled(false); unloadLibrary.setEnabled(false); for (int j = 0; j < theoriesButtons.length; j++) theoriesButtons[j].setEnabled(false); } } }); renameEngine.setEnabled(false); renameEngine.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); renameEngine.setToolTipText("Click to rename the selected engine"); renameEngine.setText("Rename"); libraryGroup = new Group(container, SWT.RIGHT); libraryGroup.setText("Libraries on: "); libraryGroup.setLayout(new RowLayout(SWT.HORIZONTAL)); listLibrary = new List(libraryGroup, SWT.BORDER); final RowData rowData_3 = new RowData(); rowData_3.height = 120; rowData_3.width = 240; listLibrary.setLayoutData(rowData_3); listLibrary.setToolTipText("Loaded libraries on: "); listLibrary.addMouseListener(new MouseAdapter() { public void mouseUp(final MouseEvent e) { if (listLibrary.getSelection().length != 0) unloadLibrary.setEnabled(true); } }); final Composite compositeLibrary = new Composite(libraryGroup, SWT.NONE); compositeLibrary.setLayout(new GridLayout()); final RowData rowData_4 = new RowData(); rowData_4.width = 80; rowData_4.height = 100; compositeLibrary.setLayoutData(rowData_4); loadLibrary = new Button(compositeLibrary, SWT.NONE); loadLibrary.addMouseListener(new MouseAdapter() { public void mouseUp(final MouseEvent e) { InputDialog d = new InputDialog(null, "Load Library on \"" + motoreScelto + "\"", "Library:", "alice.tuprolog.lib.", new LibraryValidator(listLibrary .getItems())); d.open(); String scelta = d.getValue(); if (scelta != null) { Vector<String> r = new Vector<String>(); String[] t = listLibrary.getItems(); for (int i = 0; i < t.length; i++) { r.add(t[i]); } r.add(scelta); for (int i = 0; i < PrologEngineFactory.getInstance() .getProjectEngines(name).size(); i++) { if (PrologEngineFactory.getInstance() .getEngine(name, i).getName() .equals(motoreScelto)) { PropertyManager.setLibrariesOnEngine(r, PrologEngineFactory.getInstance() .getEngine(name, i)); listLibrary.add(scelta); PropertyManager.setLibraryInProperties( (IProject) getElement(), motoreScelto, listLibrary.getItems()); } } listLibrary.deselectAll(); } } }); loadLibrary.setEnabled(false); loadLibrary .setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); loadLibrary .setToolTipText("Click to load new library on the selected engine"); loadLibrary.setText("Load"); unloadLibrary = new Button(compositeLibrary, SWT.NONE); unloadLibrary.addMouseListener(new MouseAdapter() { public void mouseUp(final MouseEvent e) { String[] selection = listLibrary.getSelection(); if (selection.length != 0) { for (int i = 0; i < selection.length; i++) { listLibrary.remove(selection[i]); PropertyManager.setLibraryInProperties( (IProject) getElement(), motoreScelto, listLibrary.getItems()); } Vector<String> r = new Vector<String>(); String[] t = listLibrary.getItems(); for (int i = 0; i < t.length; i++) { r.add(t[i]); } for (int i = 0; i < PrologEngineFactory.getInstance() .getProjectEngines(name).size(); i++) { if (PrologEngineFactory.getInstance() .getEngine(name, i).getName() == motoreScelto) { PropertyManager.setLibrariesOnEngine(r, PrologEngineFactory.getInstance() .getEngine(name, i)); } } } } }); unloadLibrary.setEnabled(false); unloadLibrary.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); unloadLibrary .setToolTipText("Click to remove the selected library from the selected engine"); unloadLibrary.setText("Remove"); scopeGroup = new Group(container, SWT.NONE); scopeGroup.setText("Default scope of: "); scopeGroup.setLayout(new RowLayout(SWT.HORIZONTAL)); Vector<String> theories = new Vector<String>(); try { IResource[] resources = ((IProject) getElement()).members(); for (int j = 0; j < resources.length; j++) if ((resources[j] instanceof IFile) && (resources[j].getName().endsWith(".pl"))) theories.add(resources[j].getName()); } catch (CoreException e) { } theoriesButtons = new Button[theories.size()]; for (int j = 0; j < theories.size(); j++) { theoriesButtons[j] = new Button(scopeGroup, SWT.CHECK); theoriesButtons[j].setEnabled(false); theoriesButtons[j].addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { } public void widgetSelected(SelectionEvent e) { onCheckChanged((Button) e.widget); } private void onCheckChanged(Button button) { int size = 0; for (int i = 0; i < theoriesButtons.length; i++) if (theoriesButtons[i].getSelection()) size++; String[] theories = new String[size]; for (int i = 0; i < size; i++) { boolean match = false; for (int j = i; j < theoriesButtons.length && match == false; j++) { if (theoriesButtons[j].getSelection()) { match = true; theories[i] = theoriesButtons[j].getText(); } } } PropertyManager.setTheoriesInProperty( (IProject) getElement(), motoreScelto, theories, false); } }); theoriesButtons[j].setText(theories.elementAt(j)); } return container; } // Setta i valori di default quando il bottone "Apply default" viene premuto protected void performDefaults() { final String name = ((IResource) getElement()).getName(); for (int i = 0; i < listEngine.getItems().length; i++) { PrologEngineFactory.getInstance().deleteEngine(name, listEngine.getItem(i)); listEngine.remove(listEngine.getItem(i)); PropertyManager.deleteEngineInProperties((IProject) getElement(), listEngine.getItem(i), listEngine.getItems()); } PrologEngine engine = PrologEngineFactory.getInstance().insertEntry( name, "Engine1"); String[] libs = engine.getLibrary(); for (int i = 0; i < libs.length; i++) engine.removeLibrary(libs[i]); String[] libraries = new String[4]; libraries[0] = "alice.tuprolog.lib.BasicLibrary"; libraries[1] = "alice.tuprolog.lib.IOLibrary"; libraries[2] = "alice.tuprolog.lib.ISOLibrary"; libraries[3] = "alice.tuprolog.lib.JavaLibrary"; for (int i = 0; i < libraries.length; i++) engine.addLibrary(libraries[i]); PropertyManager.addEngineInProperty((IProject) getElement(), engine.getName()); PropertyManager.setLibraryInProperties((IProject) getElement(), engine.getName(), libraries); PropertyManager.setTheoriesInProperty((IProject) getElement(), engine.getName(), null, true); listEngine.removeAll(); listEngine.add("Engine1"); listLibrary.removeAll(); } // Metodo invocato quando il bottone "Ok" viene premuto public boolean performOk() { return true; } }
[ "AleMonty88@gmail.com" ]
AleMonty88@gmail.com
d48b6912112d26cfdd22a86a9603088f28d8a882
a3f0e699f265688b4c5d75a26012eb42eb34db7b
/client/src/main/java/ua/nure/petryasya/core/user/package-info.java
313b6cd28c1583cada6a1b5e0f7c35b84d306e13
[]
no_license
happy0wnage/JAX-WS-Petrov-Yasenov
ddaac3c34ac9afbe3ea6b7cab52ceb92e6996d86
6b0b168184a689990388736722ce7f47c3531c11
refs/heads/master
2021-01-09T21:43:22.186703
2016-02-28T23:03:27
2016-02-28T23:03:27
52,731,952
0
0
null
null
null
null
UTF-8
Java
false
false
123
java
@javax.xml.bind.annotation.XmlSchema(namespace = "http://service.petryasya.nure.ua/") package ua.nure.petryasya.core.user;
[ "happy0wnage@gmail.com" ]
happy0wnage@gmail.com
d3b9aa5dc1fc33bcffb77cb1eae98bb3af6b22d5
225feb175edace5c25ab2ceb1323472613bb1de2
/app/src/main/java/com/liemi/seashellmallclient/widget/SpecsTagFlowLayout.java
4eadfe5d75f1ec33c458518a2479ea36a0912b9f
[]
no_license
xueyifei123/SeashellMallClient
33676bbaa7ae6cf19e5bab7ae2fac7821bf46ec6
ded24c6a54a290b591367ee7ec5168ea4977dac1
refs/heads/master
2022-11-18T15:09:58.916809
2020-07-09T05:10:47
2020-07-09T05:10:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,164
java
package com.liemi.seashellmallclient.widget; import android.content.Context; import android.content.res.TypedArray; import android.os.Bundle; import android.os.Parcelable; import android.text.TextUtils; import android.util.AttributeSet; import android.util.Log; import android.view.View; import com.liemi.seashellmallclient.ui.good.SpecsTagAdapter; import com.zhy.view.flowlayout.FlowLayout; import com.zhy.view.flowlayout.TagFlowLayout; import com.zhy.view.flowlayout.TagView; import java.util.HashSet; import java.util.Iterator; import java.util.Set; /** * 类描述: * 创建人:Simple * 创建时间:2018/9/27 18:43 * 修改备注: */ public class SpecsTagFlowLayout extends FlowLayout implements SpecsTagAdapter.OnDataChangedListener { private SpecsTagAdapter mTagAdapter; private int mSelectedMax = -1;//-1为不限制数量 private static final String TAG = "TagFlowLayout"; private Set<Integer> mSelectedView = new HashSet<Integer>(); private TagFlowLayout.OnSelectListener mOnSelectListener; private TagFlowLayout.OnTagClickListener mOnTagClickListener; public interface OnSelectListener { void onSelected(Set<Integer> selectPosSet); } public interface OnTagClickListener { boolean onTagClick(View view, int position, FlowLayout parent); } public SpecsTagFlowLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); TypedArray ta = context.obtainStyledAttributes(attrs, com.zhy.view.flowlayout.R.styleable.TagFlowLayout); mSelectedMax = ta.getInt(com.zhy.view.flowlayout.R.styleable.TagFlowLayout_max_select, -1); ta.recycle(); } public SpecsTagFlowLayout(Context context, AttributeSet attrs) { this(context, attrs, 0); } public SpecsTagFlowLayout(Context context) { this(context, null); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int cCount = getChildCount(); for (int i = 0; i < cCount; i++) { TagView tagView = (TagView) getChildAt(i); if (tagView.getVisibility() == View.GONE) { continue; } if (tagView.getTagView().getVisibility() == View.GONE) { tagView.setVisibility(View.GONE); } } super.onMeasure(widthMeasureSpec, heightMeasureSpec); } public void setOnSelectListener(TagFlowLayout.OnSelectListener onSelectListener) { mOnSelectListener = onSelectListener; } public void setOnTagClickListener(TagFlowLayout.OnTagClickListener onTagClickListener) { mOnTagClickListener = onTagClickListener; } public void setAdapter(SpecsTagAdapter adapter) { mTagAdapter = adapter; mTagAdapter.setOnDataChangedListener(this); mSelectedView.clear(); changeAdapter(); } @SuppressWarnings("ResourceType") private void changeAdapter() { removeAllViews(); SpecsTagAdapter adapter = mTagAdapter; TagView tagViewContainer = null; HashSet preCheckedList = mTagAdapter.getPreCheckedList(); for (int i = 0; i < adapter.getCount(); i++) { View tagView = adapter.getView(this, i, adapter.getItem(i)); tagViewContainer = new TagView(getContext()); tagView.setDuplicateParentStateEnabled(true); if (tagView.getLayoutParams() != null) { tagViewContainer.setLayoutParams(tagView.getLayoutParams()); } else { MarginLayoutParams lp = new MarginLayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); lp.setMargins(dip2px(getContext(), 5), dip2px(getContext(), 5), dip2px(getContext(), 5), dip2px(getContext(), 5)); tagViewContainer.setLayoutParams(lp); } LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); tagView.setLayoutParams(lp); tagViewContainer.addView(tagView); addView(tagViewContainer); if (preCheckedList.contains(i)) { setChildChecked(i, tagViewContainer); } if (mTagAdapter.setSelected(i, adapter.getItem(i))) { setChildChecked(i, tagViewContainer); preCheckedList.add(i); mSelectedView.add(i); } tagView.setClickable(false); final TagView finalTagViewContainer = tagViewContainer; final int position = i; tagViewContainer.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (mOnTagClickListener != null) { //可以拦截点击,做自己的业务处理 if (!mOnTagClickListener.onTagClick(finalTagViewContainer, position, SpecsTagFlowLayout.this)) { doSelect(finalTagViewContainer, position); } } else { doSelect(finalTagViewContainer, position); } } }); } mSelectedView.addAll(preCheckedList); } public void setMaxSelectCount(int count) { if (mSelectedView.size() > count) { Log.w(TAG, "you has already select more than " + count + " views , so it will be clear ."); mSelectedView.clear(); } mSelectedMax = count; } public Set<Integer> getSelectedList() { return new HashSet<Integer>(mSelectedView); } private void setChildChecked(int position, TagView view) { view.setChecked(true); mTagAdapter.onSelected(position, view.getTagView()); } private void setChildUnChecked(int position, TagView view) { view.setChecked(false); mTagAdapter.unSelected(position, view.getTagView()); } private void doSelect(TagView child, int position) { if (!child.isChecked()) { //处理max_select=1的情况 if (mSelectedMax == 1 && mSelectedView.size() == 1) { Iterator<Integer> iterator = mSelectedView.iterator(); Integer preIndex = iterator.next(); TagView pre = (TagView) getChildAt(preIndex); setChildUnChecked(preIndex, pre); setChildChecked(position, child); mSelectedView.remove(preIndex); mSelectedView.add(position); } else { if (mSelectedMax > 0 && mSelectedView.size() >= mSelectedMax) { return; } setChildChecked(position, child); mSelectedView.add(position); } if (mOnSelectListener != null) { mOnSelectListener.onSelected(mSelectedView); } } //设置无法取消选择 else { setChildUnChecked(position, child); mSelectedView.remove(position); } } public SpecsTagAdapter getAdapter() { return mTagAdapter; } private static final String KEY_CHOOSE_POS = "key_choose_pos"; private static final String KEY_DEFAULT = "key_default"; @Override protected Parcelable onSaveInstanceState() { Bundle bundle = new Bundle(); bundle.putParcelable(KEY_DEFAULT, super.onSaveInstanceState()); String selectPos = ""; if (mSelectedView.size() > 0) { for (int key : mSelectedView) { selectPos += key + "|"; } selectPos = selectPos.substring(0, selectPos.length() - 1); } bundle.putString(KEY_CHOOSE_POS, selectPos); return bundle; } @Override protected void onRestoreInstanceState(Parcelable state) { if (state instanceof Bundle) { Bundle bundle = (Bundle) state; String mSelectPos = bundle.getString(KEY_CHOOSE_POS); if (!TextUtils.isEmpty(mSelectPos)) { String[] split = mSelectPos.split("\\|"); for (String pos : split) { int index = Integer.parseInt(pos); mSelectedView.add(index); TagView tagView = (TagView) getChildAt(index); if (tagView != null) { setChildChecked(index, tagView); } } } super.onRestoreInstanceState(bundle.getParcelable(KEY_DEFAULT)); return; } super.onRestoreInstanceState(state); } @Override public void onChanged() { mSelectedView.clear(); changeAdapter(); } public static int dip2px(Context context, float dpValue) { final float scale = context.getResources().getDisplayMetrics().density; return (int) (dpValue * scale + 0.5f); } }
[ "1115052994@qq.com" ]
1115052994@qq.com
89060903d2e2757d0d745c6e5ac253a505bf6bc7
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/24/24_43c91dacd814b55542b120c2de94cab20f676716/StaticCallGraphBuilder/24_43c91dacd814b55542b120c2de94cab20f676716_StaticCallGraphBuilder_s.java
8451088e9c3d25cb395a61860d7d3b1babdff9fe
[]
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
6,044
java
package jkit.jil.stages; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.Stack; import jkit.jil.stages.NonNullInference.Location; import jkit.jil.tree.*; import jkit.util.*; import jkit.util.graph.*; /** * The purpose of this class is to build a static call graph. That is, a graph * whose edges represent potential calls between methods. More specifically, an * edge from method A to method B exists iff there is an invocation of method B * within method A. Observe that, since the construction process is static, the * edge will exist regardless of whether or not the method is ever be called (in * that context). * * @author djp * */ public class StaticCallGraphBuilder { public static class Node extends Triple<Type.Clazz, String, Type.Function> { public Node(Type.Clazz owner, String name, Type.Function type) { super(owner, name, type); } public Type.Clazz owner() { return first(); } public String name() { return second(); } public Type.Function type() { return third(); } public String toString() { return first() + "." + second() + ":" + type(); } } public static class Edge extends Pair<Node,Node> { public Edge(Node from, Node to) { super(from,to); } public Node from() { return first(); } public Node to() { return second(); } public String toString() { return first() + "->" + second(); } } /** * This represents the call graph. Each node in the call graph is identified * by a triple (O,N,T), where O=owner, N=name and T=type. */ private Graph<Node,Edge> callGraph = new DirectedAdjacencyList(); public void apply(JilClass owner) { // First, we identify all the problem cases. for (JilMethod method : owner.methods()) { build(method,owner); } } protected void build(JilMethod method, JilClass owner) { Node myNode = new Node(owner.type(), method.name(), method.type()); List<JilStmt> body = method.body(); // first, initialiser label map for(JilStmt s : body) { if(s instanceof JilExpr.Invoke) { addCallGraphEdges((JilExpr.Invoke)s, myNode); } } } protected void addCallGraphEdges(JilExpr expr, Node myNode) { if(expr instanceof JilExpr.ArrayIndex) { addCallGraphEdges((JilExpr.ArrayIndex) expr, myNode); } else if(expr instanceof JilExpr.BinOp) { addCallGraphEdges((JilExpr.BinOp) expr, myNode); } else if(expr instanceof JilExpr.UnOp) { addCallGraphEdges((JilExpr.UnOp) expr, myNode); } else if(expr instanceof JilExpr.Cast) { addCallGraphEdges((JilExpr.Cast) expr, myNode); } else if(expr instanceof JilExpr.Convert) { addCallGraphEdges((JilExpr.Convert) expr, myNode); } else if(expr instanceof JilExpr.ClassVariable) { addCallGraphEdges((JilExpr.ClassVariable) expr, myNode); } else if(expr instanceof JilExpr.Deref) { addCallGraphEdges((JilExpr.Deref) expr, myNode); } else if(expr instanceof JilExpr.Variable) { addCallGraphEdges((JilExpr.Variable) expr, myNode); } else if(expr instanceof JilExpr.InstanceOf) { addCallGraphEdges((JilExpr.InstanceOf) expr, myNode); } else if(expr instanceof JilExpr.Invoke) { addCallGraphEdges((JilExpr.Invoke) expr, myNode); } else if(expr instanceof JilExpr.New) { addCallGraphEdges((JilExpr.New) expr, myNode); } else if(expr instanceof JilExpr.Value) { addCallGraphEdges((JilExpr.Value) expr, myNode); } } public void addCallGraphEdges(JilExpr.ArrayIndex expr, Node myNode) { addCallGraphEdges(expr.target(), myNode); addCallGraphEdges(expr.index(), myNode); } public void addCallGraphEdges(JilExpr.BinOp expr, Node myNode) { addCallGraphEdges(expr.lhs(), myNode); addCallGraphEdges(expr.rhs(), myNode); } public void addCallGraphEdges(JilExpr.UnOp expr, Node myNode) { addCallGraphEdges(expr.expr(), myNode); } public void addCallGraphEdges(JilExpr.Cast expr, Node myNode) { addCallGraphEdges(expr.expr(), myNode); } public void addCallGraphEdges(JilExpr.Convert expr, Node myNode) { addCallGraphEdges(expr.expr(), myNode); } public void addCallGraphEdges(JilExpr.ClassVariable expr, Node myNode) { // do nothing! } public void addCallGraphEdges(JilExpr.Deref expr, Node myNode) { addCallGraphEdges(expr.target(), myNode); } public void addCallGraphEdges(JilExpr.Variable expr, Node myNode) { // do nothing! } public void addCallGraphEdges(JilExpr.InstanceOf expr, Node myNode) { addCallGraphEdges(expr.lhs(), myNode); } public void addCallGraphEdges(JilExpr.Invoke expr, Node myNode) { JilExpr target = expr.target(); addCallGraphEdges(target, myNode); for(JilExpr e : expr.parameters()) { addCallGraphEdges(e, myNode); } // Interesting issue here if target is not a class. Could be an array, // for example. Node targetNode = new Node((Type.Clazz) target.type(), expr.name(), expr.funType()); System.out.println("ADDING EDGE: " + myNode + "--> " + targetNode); // Add the call graph edge! callGraph.add(new Edge(myNode,targetNode)); } public void addCallGraphEdges(JilExpr.New expr, Node myNode) { for(JilExpr e : expr.parameters()) { addCallGraphEdges(e, myNode); } // Interesting issue here if target is not a class. Could be an array, // for example. Type.Clazz type = (Type.Clazz) expr.type(); Node targetNode = new Node(type, type.lastComponent().first(), expr .funType()); // Add the call graph edge! callGraph.add(new Edge(myNode,targetNode)); } public void addCallGraphEdges(JilExpr.Value expr, Node myNode) { if(expr instanceof JilExpr.Array) { JilExpr.Array ae = (JilExpr.Array) expr; for(JilExpr v : ae.values()) { addCallGraphEdges(v, myNode); } } } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
f158bfa009df01fdf481d8dfa876d66a51c9a1c7
c4a5ce8d1dfce033ae06468b54c37862ca8b60ec
/NUMAD13-DanKreymer/src/edu/neu/madcourse/dankreymer/multiplayer/DabbleMHighScores.java
79f37d07bef421c0e2ba0ff8912caa84767141a5
[]
no_license
Rubyj/NUMAD-ReubenJacobs
e4464eda0167467e9f234f802521c5cfe995ecc0
423448c5b40fc967f56c38ae2c43213bd130ff3d
refs/heads/master
2021-09-05T19:42:09.014315
2016-07-01T17:45:35
2016-07-01T17:45:35
119,562,505
0
0
null
null
null
null
UTF-8
Java
false
false
1,837
java
package edu.neu.madcourse.dankreymer.multiplayer; import android.app.Activity; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.TextView; import edu.neu.madcourse.dankreymer.R; import edu.neu.madcourse.dankreymer.keys.Keys; import edu.neu.madcourse.dankreymer.keys.ServerError; import edu.neu.mhealth.api.KeyValueAPI; public class DabbleMHighScores extends Activity implements OnClickListener{ private static String highScores = ""; private static final String NO_SCORES = "No Scores Reported"; private TextView text; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.dabble_high_scores); text = (TextView)findViewById(R.id.dabble_high_scores); new HighScoreTask().execute(); View instructionsButon = findViewById(R.id.dabble_back_button); instructionsButon.setOnClickListener(this); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.dabble_back_button: finish(); break; } } private String parseScores(String string) { if (string.equals(ServerError.NO_CONNECTION.getText()) || string.equals(ServerError.NO_SUCH_KEY.getText())) { string = NO_SCORES; } else { string = string.replace(";", "\n"); } return string; } private class HighScoreTask extends AsyncTask<String, String, String> { @Override protected void onPostExecute(String result) { highScores = parseScores(result); if (highScores == "") { text.setText(NO_SCORES); } else { text.setText(highScores); } text.invalidate(); } @Override protected String doInBackground(String... parameter) { return Keys.get(Keys.HIGHSCORES); } } }
[ "dkreymer@gmail.com" ]
dkreymer@gmail.com
70acf36618dd3d372ec2f45cf05f8ef675cdb47e
ec246206025220b4552ae9a069863dc66139835c
/src/main/java/psi/domain/user/entity/User.java
70df2f16eecf4e0fd857ae6aaea3673f34f58fef
[]
no_license
JaroslawPokropinski/PSI-TWWO
1cd000f04cb883d56f96475c9d03cfc5f1db9521
13d84e454f2d51e7edb07b8172ba85e65d35147c
refs/heads/main
2023-02-26T07:03:44.021768
2021-01-29T07:59:41
2021-01-29T07:59:41
306,083,151
0
0
null
2021-01-28T12:31:38
2020-10-21T16:25:02
Java
UTF-8
Java
false
false
2,764
java
package psi.domain.user.entity; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.experimental.SuperBuilder; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import org.hibernate.annotations.Loader; import org.hibernate.annotations.NaturalIdCache; import org.hibernate.annotations.Where; import org.hibernate.envers.Audited; import psi.domain.auditedobject.entity.AuditedObject; import javax.persistence.Cacheable; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EnumType; import javax.persistence.Enumerated; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.NamedQuery; import javax.persistence.Table; import javax.validation.constraints.Email; import javax.validation.constraints.NotBlank; import javax.validation.constraints.Size; import java.util.Objects; import static psi.infrastructure.jpa.CacheRegions.USER_ENTITY_CACHE; import static psi.infrastructure.jpa.CacheRegions.USER_NATURAL_ID_CACHE; import static psi.infrastructure.jpa.PersistenceConstants.ID_GENERATOR; @Entity @Table(name = "USER") @AllArgsConstructor @NoArgsConstructor @Getter @SuperBuilder @Cacheable @Audited @Loader(namedQuery = "findUserById") @NamedQuery(name = "findUserById", query = "SELECT u FROM User u WHERE u.id = ?1 AND u.objectState <> psi.domain.auditedobject.entity.ObjectState.REMOVED") @Where(clause = AuditedObject.IS_NOT_REMOVED_OBJECT) @Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = USER_ENTITY_CACHE) @NaturalIdCache(region = USER_NATURAL_ID_CACHE) public class User extends AuditedObject { @Id @GeneratedValue(generator = ID_GENERATOR) private Long id; @NotBlank @Size(max = 40) private String name; @NotBlank @Size(max = 40) private String surname; @NotBlank @Size(max = 40) private String username; @NotBlank @Size(max = 100) private String password; @Email @NotBlank @Size(max = 40) @Column(unique = true) private String email; @NotBlank private String phoneNumber; @Enumerated(EnumType.STRING) private UserRole role; public void setPassword(String password) { this.password = password; } public void setRole(UserRole role) { this.role = role; } @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof User)) { return false; } User otherUser = (User) obj; return Objects.equals(otherUser.id, id); } @Override public int hashCode() { return Objects.hash(id); } }
[ "matkimzag@wp.pl" ]
matkimzag@wp.pl
2f435dd250e45a1d71cd76250a106a51aded0908
e26fceb0c49ca5865fcf36bd161a168530ae4e69
/OpenAMASE/src/Core/avtas/properties/TestClass.java
e34aeb3071915198ccd1d1766a76a61d0c74ddb2
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-us-govt-public-domain" ]
permissive
sahabi/OpenAMASE
e1ddd2c62848f0046787acbb02b8d31de2f03146
b50f5a71265a1f1644c49cce2161b40b108c65fe
refs/heads/master
2021-06-17T14:15:16.366053
2017-05-07T13:16:35
2017-05-07T13:16:35
90,772,724
3
0
null
null
null
null
UTF-8
Java
false
false
3,682
java
// =============================================================================== // Authors: AFRL/RQQD // Organization: Air Force Research Laboratory, Aerospace Systems Directorate, Power and Control Division // // Copyright (c) 2017 Government of the United State of America, as represented by // the Secretary of the Air Force. No copyright is claimed in the United States under // Title 17, U.S. Code. All Other Rights Reserved. // =============================================================================== package avtas.properties; import java.awt.Color; import java.awt.Font; import java.awt.event.ActionEvent; import java.io.File; import java.util.ArrayList; import java.util.List; import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.JOptionPane; /** * * @author AFRL/RQQD */ public class TestClass { @UserProperty private int intVal = 5; @UserProperty( Description="Color") private Color color = Color.RED; @UserProperty( ) private File file = new File("../test"); @UserProperty( FileType = UserProperty.FileTypes.Directories) private File dir; @UserProperty private Font font = new Font("Arial", Font.PLAIN, 12); @UserProperty private TestEnum anEnum = TestEnum.One; @UserProperty private List list = new ArrayList(); @UserProperty Action push = new AbstractAction("Push") { @Override public void actionPerformed(ActionEvent e) { JOptionPane.showMessageDialog(null, "Hello"); } }; private Object ignoreMe; public TestClass() { list.add("one"); list.add("two"); list.add("three"); } /** * @return the intVal */ public int getIntVal() { return intVal; } /** * @param intVal the intVal to set */ //public void setIntVal(int intVal) { // this.intVal = intVal; //} /** * @return the color */ public Color getColor() { return color; } /** * @param color the color to set */ public void setColor(Color color) { this.color = color; } /** * @return the file */ public File getFile() { return file; } /** * @param file the file to set */ public void setFile(File file) { this.file = file; } /** * @return the font */ public Font getFont() { return font; } /** * @param font the font to set */ public void setFont(Font font) { this.font = font; } /** * @return the anEnum */ public TestEnum getAnEnum() { return anEnum; } /** * @param anEnum the anEnum to set */ public void setAnEnum(TestEnum anEnum) { this.anEnum = anEnum; } /** * @return the ignoreMe */ public Object getIgnoreMe() { return ignoreMe; } /** * @param ignoreMe the ignoreMe to set */ public void setIgnoreMe(Object ignoreMe) { this.ignoreMe = ignoreMe; } /** * @return the dir */ public File getDir() { return dir; } /** * @param dir the dir to set */ public void setDir(File dir) { this.dir = dir; } public static enum TestEnum { One, Two, Three } public List getList() { return list; } public void setList(List list) { System.out.println("a new list"); this.list = list; } } /* Distribution A. Approved for public release. * Case: #88ABW-2015-4601. Date: 24 Sep 2015. */
[ "derek.kingston@us.af.mil" ]
derek.kingston@us.af.mil
4aa9f98625af6fccbc8bec03e96c60eaea28f69e
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/7/7_e3898da94c8bb7d0ff52fddbc729daf9dbc5ba85/ExportPrivateKey/7_e3898da94c8bb7d0ff52fddbc729daf9dbc5ba85_ExportPrivateKey_t.java
ff4bf02915e864fdc9731ff3206f5227657aeb83
[]
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,340
java
package org.cujau.crypto; import java.io.File; import java.io.FileInputStream; import java.io.FileWriter; import java.security.Key; import java.security.KeyPair; import java.security.KeyStore; import java.security.KeyStoreException; import java.security.NoSuchAlgorithmException; import java.security.PrivateKey; import java.security.PublicKey; import java.security.UnrecoverableKeyException; import java.security.cert.Certificate; import org.cujau.utils.Base64; public class ExportPrivateKey { private File keystoreFile; private String keyStoreType; private char[] password; private String alias; private File exportedFile; public static KeyPair getPrivateKey( KeyStore keystore, String alias, char[] password ) { try { Key key = keystore.getKey( alias, password ); if ( key instanceof PrivateKey ) { Certificate cert = keystore.getCertificate( alias ); PublicKey publicKey = cert.getPublicKey(); return new KeyPair( publicKey, (PrivateKey) key ); } } catch ( UnrecoverableKeyException e ) { } catch ( NoSuchAlgorithmException e ) { } catch ( KeyStoreException e ) { } return null; } public void export() throws Exception { KeyStore keystore = KeyStore.getInstance( keyStoreType ); keystore.load( new FileInputStream( keystoreFile ), password ); KeyPair keyPair = getPrivateKey( keystore, alias, password ); PrivateKey privateKey = keyPair.getPrivate(); String encoded = Base64.encodeBytes( privateKey.getEncoded() ); FileWriter fw = new FileWriter( exportedFile ); fw.write( "-----BEGIN PRIVATE KEY-----\n" ); fw.write( encoded ); fw.write( "\n" ); fw.write( "-----END PRIVATE KEY-----" ); fw.close(); } public static void main( String args[] ) throws Exception { ExportPrivateKey export = new ExportPrivateKey(); export.keystoreFile = new File( args[0] ); export.keyStoreType = args[1]; export.password = args[2].toCharArray(); export.alias = args[3]; export.exportedFile = new File( args[4] ); export.export(); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
1589012de0f8802b57f928e2d6019416b86bdedf
10d3c5cb42595fe0356cfe9cb76f26fc05855b26
/src/com/sanluan/cms/admin/views/controller/system/SystemUserController.java
4c75ddff48db22a98563503b413a437cac5c7006
[ "BSD-2-Clause" ]
permissive
lcaminy/PublicCMS
ee0d7ccf4ababc6c09ba4cbe4c09115460144437
d8c6789ce8ef1c539b98b9cdc55fe4e81ff15a43
refs/heads/master
2021-01-23T02:15:39.901913
2015-05-14T08:35:21
2015-05-14T08:35:21
35,600,850
0
1
null
2015-05-14T08:41:51
2015-05-14T08:41:51
null
UTF-8
Java
false
false
1,762
java
package com.sanluan.cms.admin.views.controller.system; import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import com.sanluan.cms.common.tools.UserUtils; import com.sanluan.cms.entities.system.SystemUser; import com.sanluan.cms.logic.service.system.SystemUserService; import com.sanluan.common.base.BaseController; /** * @author zhangxd * */ @Controller @RequestMapping("systemuser") public class SystemUserController extends BaseController { @Autowired private SystemUserService service; @RequestMapping(value = { "enable" + DO_SUFFIX }, method = RequestMethod.POST) public String enable(HttpServletRequest request, Integer id, String repassword, ModelMap model) { if (virifyEquals("admin.operate", UserUtils.getAdminFromSession(request), id, model)) { return "common/ajaxError"; } service.updateStatus(id, false); return "common/ajaxDone"; } @RequestMapping(value = { "disable" + DO_SUFFIX }, method = RequestMethod.POST) public String disable(HttpServletRequest request, Integer id, String repassword, ModelMap model) { if (virifyEquals("admin.operate", UserUtils.getAdminFromSession(request), id, model)) { return "common/ajaxError"; } service.updateStatus(id, true); return "common/ajaxDone"; } protected boolean virifyEquals(String field, SystemUser user, Integer value2, ModelMap model) { if (null != user && user.getId().equals(value2)) { model.addAttribute(ERROR, "verify.equals." + field); return true; } return false; } }
[ "zyyy358@126.com" ]
zyyy358@126.com
94216864c118d12f112e1b29b8ec531936b61d9c
575acf52715b95f86a10b4e3c1b354c5cc34248b
/src/test/java/org/demo/data/record/SynopsisRecordTest.java
4339141f11c924e8ae4e96cd68eddbfa2f362d05
[]
no_license
t-soumbou/persistence-with-mongoDB
52a21b507551365f9f88e5adf2b6dd58f9b8ff62
67bfe4425cfe46360606390541b95007952658b0
refs/heads/master
2020-05-21T05:03:53.502360
2017-03-22T16:37:22
2017-03-22T16:37:22
84,574,135
0
0
null
null
null
null
UTF-8
Java
false
false
1,349
java
/* * Created on 2017-03-22 ( Date ISO 2017-03-22 - Time 17:28:47 ) * Generated by Telosys ( http://www.telosys.org/ ) version 3.0.0 */ package org.demo.data.record; import org.junit.Assert; import org.junit.Test; import java.util.logging.*; /** * JUnit test case for bean SynopsisRecord * * @author Telosys Tools Generator * */ public class SynopsisRecordTest { private static final Logger LOGGER = Logger.getLogger(SynopsisRecordTest.class.getName()); @Test public void testSettersAndGetters() { LOGGER.info("Checking class SynopsisRecord getters and setters ..." ); SynopsisRecord synopsisRecord = new SynopsisRecord(); //--- Test setter/getter for attribute "bookId" ( model type : Integer / wrapperType : Integer ) synopsisRecord.setBookId( Integer.valueOf(100) ) ; Assert.assertEquals( Integer.valueOf(100), synopsisRecord.getBookId() ) ; // Not primitive type in model //--- Test setter/getter for attribute "synopsis" ( model type : String / wrapperType : String ) synopsisRecord.setSynopsis( "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" ) ; Assert.assertEquals( "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", synopsisRecord.getSynopsis() ) ; // Not primitive type in model } }
[ "terrencesoumbou@gmail.com" ]
terrencesoumbou@gmail.com
3ec31f2afc75f8fe3ea3f28da4a0d0eccf264689
c1de27c2d97b3587c40ba89eb1539c4bd767598e
/build/project/src/capitals/FXMLAnswerController.java
a54100c3e1a96678531f16d8f05eabd96cae5231
[ "MIT" ]
permissive
n-eq/CapitalsFX
d39a0e961b3ada2df3ca8b8e860c396e66a65b9d
a1aa3d74112117118b19b215c95416eef34d5210
refs/heads/master
2021-06-13T18:04:26.266272
2017-04-22T12:06:32
2017-04-22T12:06:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,622
java
package capitals; import capitals.data.FactReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.net.URL; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Random; import java.util.ResourceBundle; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.fxml.Initializable; import javafx.geometry.Insets; import javafx.scene.Node; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.layout.VBox; import javafx.scene.layout.AnchorPane; import javafx.scene.paint.Color; import javafx.scene.text.Font; import javafx.scene.text.FontSmoothingType; import javafx.scene.text.FontWeight; import javafx.scene.text.Text; import javafx.stage.Stage; public class FXMLAnswerController implements Initializable { @FXML private Button playAgainButton; @FXML private Button exitButton; @FXML private Text resultStatement; @FXML private VBox factBox; @FXML private ImageView flag; @FXML private AnchorPane pane; private String[] greetings = {"Well done!", "Good job!", "Nice!", "Correct!", "Nice one!", "Awesome!", "Here you go!", "You rock!"}; private String[] consolations = {"What a pity!", "Wrong answer!", "False,", "Try again,", "Nope,"}; @FXML private void exit(ActionEvent e) { Stage stage = (Stage) exitButton.getScene().getWindow(); stage.close(); } @FXML private void restart(ActionEvent event) throws IOException { FXMLLoader loader = new FXMLLoader(getClass().getResource("FXMLDocument.fxml")); Parent parent = loader.load(); Scene scene = new Scene(parent); FXMLController controller = (FXMLController)loader.getController(); String countryNameChosen = Country.getCountry().getCountryName(); controller.build(countryNameChosen); Stage appStage = (Stage) ((Node) event.getSource()).getScene().getWindow(); appStage.setScene(scene); appStage.show(); } public void build(boolean answerIsCorrect, Country country) throws FileNotFoundException { setAnswerStatement(answerIsCorrect, country); setDisplay(country); setBackgroundImage(); } public void setAnswerStatement(boolean answerIsCorrect, Country country) { if (answerIsCorrect) { resultStatement.setText(greetings[new Random().nextInt(greetings.length)]); resultStatement.setFill(Color.CORAL); } else { resultStatement.setText(consolations[new Random().nextInt(consolations.length)] + " it's " + country.getCapitalName()); resultStatement.setFill(Color.BROWN); } setResultStatementStyle(); } private void setResultStatementStyle() { resultStatement.setFont(Font.font("Century Gothic", FontWeight.EXTRA_BOLD, 28)); } private void setDisplay(Country country) throws FileNotFoundException { if (!setFactBox(country)) setFlagCentered(country); else setFlag(country); } private boolean setFactBox(Country country) throws FileNotFoundException { this.factBox.setPadding(new Insets(10)); List<Text> factListText = new LinkedList<Text>(); String currentFact; List<String> readFacts = FactReader.getFacts(country); if (readFacts.isEmpty()) { return false; } setFactBoxSpacing(readFacts); Iterator<String> factIterator = readFacts.iterator(); while (factIterator.hasNext()) { currentFact = factIterator.next(); Text addedFact = new Text(currentFact); addedFact.setWrappingWidth(378); factListText.add(addedFact); } for (Text factText : factListText) { factText.setFont(Font.font("Trebuchet MS", FontWeight.BOLD, 21)); factText.autosize(); this.factBox.getChildren().add(factText); } return true; } /* this methods calculates the spacings and layout of the factBox * according to the number of facts read and their total size */ private void setFactBoxSpacing(List<String> readFacts) { int totalNumberOfCharacters = 0; for (String fact : readFacts) totalNumberOfCharacters += fact.length(); int numberOfFacts = readFacts.size(); if (totalNumberOfCharacters < 150) { if (numberOfFacts < 5) { this.factBox.setLayoutY(this.flag.getLayoutY()); this.factBox.setSpacing(3); } else { this.factBox.setLayoutY(this.flag.getLayoutY() - 8); this.factBox.setSpacing(5); } } else if (totalNumberOfCharacters < 200) { if (numberOfFacts > 4) { this.factBox.setLayoutY(this.flag.getLayoutY() - 10); this.factBox.setSpacing(3); } else { this.factBox.setLayoutY(this.flag.getLayoutY() - 5); this.factBox.setSpacing(5); } } else if (totalNumberOfCharacters >= 200) { this.factBox.setLayoutY(this.flag.getLayoutY() - 40); } } private void setFlag(Country country) { File flagFile = new File("data\\flags\\" + country.getCountryName().toLowerCase() + ".gif"); this.flag.setImage(new Image(flagFile.toURI().toString())); } private void setFlagCentered(Country country) { setFlag(country); this.flag.setLayoutX((this.pane.getPrefWidth() - 250) / 2); this.flag.setLayoutY((this.pane.getPrefHeight() - 154) / 2); } private void setBackgroundImage() { String bgImagePath = "answer_background.png"; this.pane.setStyle("-fx-background-image: url('" + bgImagePath + "'); " + "-fx-background-position: center; " + "-fx-background-repeat: repeat;"); } @Override public void initialize(URL arg0, ResourceBundle arg1) { } }
[ "nabilelqatib@gmail.com" ]
nabilelqatib@gmail.com
e832f2b42be50975d0ccc1fac41143e44a3cd81b
99461988a754f76a461775d6e6759cdbe3aafe45
/CardGameSpecs/PlayerTest.java
a5ce9e84745d86595577a0553db9d7ccdbae393b
[]
no_license
graeme81/blackjack-Fun-week-6
9e1295eb8a7a4958700d70b40433b41531f170fc
5b280588fc9019a46d39083d8dd18b1f4ae39d54
refs/heads/master
2021-01-13T14:28:06.486321
2017-01-16T00:33:03
2017-01-16T00:33:03
79,069,200
0
0
null
null
null
null
UTF-8
Java
false
false
863
java
import static org.junit.Assert.*; import org.junit.*; import cardGame.*; public class PlayerTest{ Deck deck; Card card; Player player; @Before public void before(){ deck = new Deck(1); player = new Player("Joe"); card = deck.topCard(); player.takeCard(card); card = deck.topCard(); player.takeCard(card); } @Test public void getPlayerName(){ assertEquals("Joe", player.getName()); } @Test public void cardsDeltFromDeckToHand(){ assertEquals(Suit.DIAMONDS, player.getCard(0).getSuit()); assertEquals(Value.ACE,player.getCard(0).getValue()); assertEquals(Suit.DIAMONDS, player.getSecondCard().getSuit()); assertEquals(Value.TWO,player.getSecondCard().getValue()); } @Test public void clearPlayerHand(){ player.clearHand(); assertEquals(0,player.getHandSize()); } }
[ "gcameron4981@gmail.com" ]
gcameron4981@gmail.com
7016a4887fc36658234b3361b8baf923f7b20d77
b96a40c236f0f829b341786e9dd03d81f0e05439
/src/MainApp.java
256322bc7cd3fdcb189038ab54648c7db0f5f551
[]
no_license
iwonder001/PlusTwo
cca1ca8bc38275ad2e380d0d882417df7c745e58
0841ce42d80aeb2ba3103cb6048ee852470426c7
refs/heads/master
2021-01-13T14:38:37.505638
2016-09-21T15:28:37
2016-09-21T15:28:37
68,821,059
0
0
null
null
null
null
UTF-8
Java
false
false
797
java
import java.util.Arrays; public class MainApp { public static void main(String[] args) { // make two arrays into one int[] test = { 1, 2 }; int[] test2 = { 3, 4 }; int[] trying = plusTwo(test, test2); System.out.println(Arrays.toString(trying)); }// main method // {1,2} and {3,4} are a fixed length and cannot be expanded or changed. So need to make a new array with length 4. public static int[] plusTwo(int[] a, int[] b) { // get first set of arrays int first1 = a[0]; int first2 = a[1]; // get last set of arrays int last1 = b[0]; int last2 = b[1]; // add together into a 4 array int[] together = { first1, first2, last1, last2 }; // for(int num:together) { // System.out.println(num); // } return together; }// plusTwo method close }// class
[ "kcarethers@gmail.com" ]
kcarethers@gmail.com
5e270cdd9e10b926adce2a4a34941f3282b870b9
7708ed31f68738e2151d93c52974372ffab0e614
/src/main/java/com/picklerick/schedule/rest/api/controller/FormController.java
b71e38eb42f7657c4e996ec699b859168365c68e
[]
no_license
AhsanManzoor/Pickle-Rick-Schedule
310f06382b0dccf17007989d046d2cfb3dc0f33d
b05f85bc0d9b26f63af260c5b256ebfe71eaeff4
refs/heads/develop
2023-05-06T01:08:01.967075
2021-05-28T20:20:59
2021-05-28T20:20:59
371,402,327
0
0
null
2021-05-27T14:29:39
2021-05-27T14:28:53
Java
UTF-8
Java
false
false
2,245
java
package com.picklerick.schedule.rest.api.controller; import com.picklerick.schedule.rest.api.model.Login; import com.picklerick.schedule.rest.api.model.User; import com.picklerick.schedule.rest.api.repository.RoleRepository; import com.picklerick.schedule.rest.api.repository.UserRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.access.annotation.Secured; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; @Controller public class FormController { private final RoleRepository roleRepository; private final UserRepository userRepository; private static final Logger LOGGER = LoggerFactory.getLogger(FormController.class); public FormController(RoleRepository roleRepository, UserRepository userRepository) { this.roleRepository = roleRepository; this.userRepository = userRepository; } /** * Create Models and load all Roles to select in the Add New User Form * * @author Clelia * */ @Secured("ROLE_ADMIN") @RequestMapping(value = "/user", method = RequestMethod.GET) public String newUser(Model model) { LOGGER.info("Attempt started to create new user"); User user = new User(); user.setLogin(new Login()); Login login = user.getLogin(); model.addAttribute("user", user); model.addAttribute("roles", roleRepository.findAll()); model.addAttribute("login", login); return "addNewUser"; } /** * Create Models and load all Roles to select in the Add New User Form * * @author Clelia * */ @Secured("ROLE_ADMIN") @RequestMapping(value = "/user/{id}", method = RequestMethod.GET) public String editUser(Model model, @PathVariable Long id) { LOGGER.info("Edit user"); User user = userRepository.findById(id).get(); Login login = user.getLogin(); model.addAttribute("user", user); model.addAttribute("roles", roleRepository.findAll()); model.addAttribute("login", login); model.addAttribute("selectedRole", user.getRoles().get(0)); return "editUser"; } }
[ "cmeneghi@adobe.com" ]
cmeneghi@adobe.com
883ac2a9692c9845654dc0911838c312a905a3cd
f50981b391d075e280fca88954caef5d42a21c35
/src/leetcode/array/LC_332_ReconstructItinerary.java
bdb64706688cd925b1902a10c5344a6a3c93014c
[]
no_license
fengjiny/algorithm
e2a953c56e3f3da048bf9bcc799a43060274d34a
9ca3fcd0447debff214ce53816a01131124f25fc
refs/heads/master
2020-03-10T17:25:41.691258
2018-05-09T07:59:19
2018-05-09T07:59:19
129,500,074
0
0
null
null
null
null
UTF-8
Java
false
false
1,027
java
package leetcode.array; import java.util.*; public class LC_332_ReconstructItinerary { public static List<String> findItinerary(String[][] tickets) { List<String> res = new LinkedList<>(); Map<String, PriorityQueue<String>> map = new HashMap<>(); for(String[] ticket : tickets) { map.computeIfAbsent(ticket[0], v -> new PriorityQueue()).add(ticket[1]); } Stack<String> stack = new Stack<String>(); stack.push("JFK"); while(!stack.isEmpty()) { while (map.containsKey(stack.peek()) && !map.get(stack.peek()).isEmpty()) stack.push(map.get(stack.peek()).poll()); res.add(0, stack.pop()); } return res; } public static void main(String[] args) { String[][] tickets = {{"MUC", "LHR"}, {"JFK", "MUC"}, {"SFO", "SJC"}, {"LHR", "SFO"}, {"JFK", "ATL"}}; List<String> list = findItinerary(tickets); list.forEach(s-> { System.out.println(s); }); } }
[ "fengjinyu@mobike.com" ]
fengjinyu@mobike.com
aa80ea4ef3100dec8842a98d3f9e035735e6c808
ffa02e500888c93d07babd4535049a05991e50ee
/src/main/java/espresso/validation/NamedEntityValidatorContext.java
47ddcb41fed290b19a30ef35c77c7e6dc5acd722
[]
no_license
maximenajim/espresso
634f50894ad5a901d383bc335824e564bf0b95d6
e6580bb35173c0a510a1f6034cb8a7c0e8686ff1
refs/heads/master
2020-04-10T09:22:52.790987
2012-04-19T04:54:57
2012-04-19T04:54:57
4,066,928
0
1
null
null
null
null
UTF-8
Java
false
false
1,611
java
package espresso.validation; import java.util.HashMap; import java.util.List; import java.util.Map; public class NamedEntityValidatorContext<Entity extends NamedEntity> { private List<Entity> existingEntities; private Map<Long,Entity> existingEntitiesIdMap; private Map<String,Entity> existingEntitiesNameMap; private NamedEntityValidatorContext(List<Entity> existingEntitiesList) { existingEntities = existingEntitiesList; existingEntitiesIdMap = new HashMap<Long,Entity>(); existingEntitiesNameMap = new HashMap<String,Entity>(); } public static <Entity extends NamedEntity> NamedEntityValidatorContext load(List<Entity> existingEntities) { NamedEntityValidatorContext<Entity> validatorContext = new NamedEntityValidatorContext<Entity>(existingEntities); for(Entity entity : existingEntities){ validatorContext.existingEntitiesIdMap.put(entity.getId(), entity); validatorContext.existingEntitiesNameMap.put(entity.getName(), entity); } return validatorContext; } public Entity getExistingEntityById(Long id){ Entity entity = null; if(existingEntitiesIdMap != null){ entity = existingEntitiesIdMap.get(id); } return entity; } public Entity getExistingEntityByName(String name){ Entity entity = null; if(existingEntitiesNameMap != null){ entity = existingEntitiesNameMap.get(name); } return entity; } public List<Entity> getExistingEntities() { return existingEntities; } }
[ "max_najim@yahoo.com" ]
max_najim@yahoo.com
97591bfc33a30dc258216f5ebccfc06c408cca1c
bca2a520e8d9a9f3d49d250bd0c2f7c3838da7f3
/src/main/java/com/boundlessgeo/gsr/model/map/TimeInfo.java
1f14eceb04da7d65637a78e773ae17c434a4fa2d
[]
no_license
geosolutions-it/gsr
1fd64db6b8db0557991b5059c1eb5615f1082b93
e6c442bc31d1d0cd59a677dc52730c6371c1523f
refs/heads/dynamic-table-test
2023-06-01T00:12:41.319200
2020-02-28T15:12:17
2020-02-28T15:12:17
196,354,454
2
6
null
2019-12-20T23:07:16
2019-07-11T08:38:05
Java
UTF-8
Java
false
false
1,362
java
package com.boundlessgeo.gsr.model.map; import org.geoserver.catalog.DimensionInfo; import org.geoserver.catalog.DimensionPresentation; import java.math.BigDecimal; /** * TimeInfo field, used by {@link LayerOrTable} */ public class TimeInfo { public final String startTimeField; public final String endTimeField; public final Object trackIdField = new Object(); public final BigDecimal timeInterval; public final String timeIntervalUnits; public final TimeReference timeReference; public TimeInfo(DimensionInfo time) { startTimeField = time.getAttribute(); if (time.getEndAttribute() != null) { endTimeField = time.getEndAttribute(); } else { endTimeField = time.getAttribute(); } if (time.getPresentation() == DimensionPresentation.DISCRETE_INTERVAL) { BigDecimal resolution = time.getResolution(); timeInterval = resolution; timeIntervalUnits = resolution == null ? null : "ms"; timeReference = new TimeReference(); } else { timeInterval = null; timeIntervalUnits = null; timeReference = null; } } public static class TimeReference { public final String timeZone = "UTC"; public final Boolean respectDaylightSaving = true; } }
[ "tbarsballe@boundlessgeo.com" ]
tbarsballe@boundlessgeo.com
10f106ed388dc146b49f8670d22135d9787b24f9
7f4d92acca3827da4778cbea6bfebd07824afd54
/src/main/java/com/example/backbirthday/User/User.java
dc09a4e99120ba8d6ad5c993aa80f0fcd9391966
[]
no_license
leanyanko/back-birthday
831d35f2b6c5965679afd30d85ba0296f2765046
5a3f7738ca1270880f07d884c9977a25e41f71a8
refs/heads/master
2021-09-18T01:32:06.426736
2018-07-08T18:13:16
2018-07-08T18:13:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,387
java
package com.example.backbirthday.User; import com.example.backbirthday.Birthday.Birthday; import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.*; import org.springframework.web.bind.annotation.CrossOrigin; import javax.persistence.*; import java.util.HashSet; import java.util.Set; @CrossOrigin @Data @AllArgsConstructor @NoArgsConstructor @Getter @Setter @Entity @Table(name = "USERS") public class User { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @OneToMany(mappedBy = "creator", cascade=CascadeType.ALL) @JsonIgnore private Set<Birthday> birthdays = new HashSet<> (); @ManyToMany(fetch = FetchType.LAZY, cascade = { CascadeType.PERSIST, CascadeType.MERGE }) @JoinTable(name = "DONATORS", joinColumns = { @JoinColumn(name = "user_id") }, inverseJoinColumns = { @JoinColumn(name = "birthday_id") }) private Set<Birthday> donators = new HashSet<>(); @Column(name = "USERNAME") private String username; @Column(name = "FIRST_NAME") private String firstName; @Column(name = "LAST_NAME") private String lastName; @Column(name = "EMAIL") private String email; @Column(name = "ABOUT_ME") private String aboutMe; @Column(name = "PASSWORD") private String password; }
[ "casey.r.harding@gmail.com" ]
casey.r.harding@gmail.com
40e44002619336d5e85429efc0b285d68d9fc1a2
31de966495ed5b5700bb3eabd27eca9a7e443f92
/app/src/androidTest/java/com/fitiwizz/mtbfollow/data/TestDb.java
d099cb76efc1ce9a93861859e3ddd7e3e4011631
[]
no_license
Fitiwizz/AndroidDevUdacityTuto
51cc18f6d9409a93ae45f6cb374db3db8d4641e2
46bf2737bd44f313254577730db82925e7249641
refs/heads/master
2021-01-10T17:22:27.629223
2015-10-08T11:11:15
2015-10-08T11:11:15
43,767,770
0
0
null
null
null
null
UTF-8
Java
false
false
8,771
java
/* * Copyright (C) 2014 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.fitiwizz.mtbfollow.data; import android.content.ContentValues; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.test.AndroidTestCase; import java.util.HashSet; public class TestDb extends AndroidTestCase { public static final String LOG_TAG = TestDb.class.getSimpleName(); // Since we want each test to start with a clean slate void deleteTheDatabase() { mContext.deleteDatabase(WeatherDbHelper.DATABASE_NAME); } /* This function gets called before each test is executed to delete the database. This makes sure that we always have a clean test. */ public void setUp() { deleteTheDatabase(); } /* Students: Uncomment this test once you've written the code to create the Location table. Note that you will have to have chosen the same column names that I did in my solution for this test to compile, so if you haven't yet done that, this is a good time to change your column names to match mine. Note that this only tests that the Location table has the correct columns, since we give you the code for the weather table. This test does not look at the */ public void testCreateDb() throws Throwable { // build a HashSet of all of the table names we wish to look for // Note that there will be another table in the DB that stores the // Android metadata (db version information) final HashSet<String> tableNameHashSet = new HashSet<String>(); tableNameHashSet.add(WeatherContract.LocationEntry.TABLE_NAME); tableNameHashSet.add(WeatherContract.WeatherEntry.TABLE_NAME); mContext.deleteDatabase(WeatherDbHelper.DATABASE_NAME); SQLiteDatabase db = new WeatherDbHelper( this.mContext).getWritableDatabase(); assertEquals(true, db.isOpen()); // have we created the tables we want? Cursor c = db.rawQuery("SELECT name FROM sqlite_master WHERE type='table'", null); assertTrue("Error: This means that the database has not been created correctly", c.moveToFirst()); // verify that the tables have been created do { tableNameHashSet.remove(c.getString(0)); } while( c.moveToNext() ); // if this fails, it means that your database doesn't contain both the location entry // and weather entry tables assertTrue("Error: Your database was created without both the location entry and weather entry tables", tableNameHashSet.isEmpty()); // now, do our tables contain the correct columns? c = db.rawQuery("PRAGMA table_info(" + WeatherContract.LocationEntry.TABLE_NAME + ")", null); assertTrue("Error: This means that we were unable to query the database for table information.", c.moveToFirst()); // Build a HashSet of all of the column names we want to look for final HashSet<String> locationColumnHashSet = new HashSet<String>(); locationColumnHashSet.add(WeatherContract.LocationEntry._ID); locationColumnHashSet.add(WeatherContract.LocationEntry.COLUMN_CITY_NAME); locationColumnHashSet.add(WeatherContract.LocationEntry.COLUMN_COORD_LAT); locationColumnHashSet.add(WeatherContract.LocationEntry.COLUMN_COORD_LONG); locationColumnHashSet.add(WeatherContract.LocationEntry.COLUMN_LOCATION_SETTING); int columnNameIndex = c.getColumnIndex("name"); do { String columnName = c.getString(columnNameIndex); locationColumnHashSet.remove(columnName); } while(c.moveToNext()); // if this fails, it means that your database doesn't contain all of the required location // entry columns assertTrue("Error: The database doesn't contain all of the required location entry columns", locationColumnHashSet.isEmpty()); db.close(); } /* Students: Here is where you will build code to test that we can insert and query the location database. We've done a lot of work for you. You'll want to look in TestUtilities where you can uncomment out the "createNorthPoleLocationValues" function. You can also make use of the ValidateCurrentRecord function from within TestUtilities. */ public void testLocationTable() { addToLocationTable(); } public long addToLocationTable() { // First step: Get reference to writable database SQLiteDatabase db = new WeatherDbHelper( this.mContext).getWritableDatabase(); // Create ContentValues of what you want to insert // (you can use the createNorthPoleLocationValues if you wish) ContentValues testValues = TestUtilities.createNorthPoleLocationValues(); // Insert ContentValues into database and get a row ID back Long locationRowId = db.insert(WeatherContract.LocationEntry.TABLE_NAME, null, testValues); assertTrue(locationRowId != -1); // Query the database and receive a Cursor back Cursor dbCursor = db.query( WeatherContract.LocationEntry.TABLE_NAME, null, null, null, null, null, null ); // Move the cursor to a valid database row assertTrue("Error: can't get record", dbCursor.moveToFirst()); // Validate data in resulting Cursor with the original ContentValues // (you can use the validateCurrentRecord function in TestUtilities to validate the // query if you like) TestUtilities.validateCurrentRecord("Location Entry don't match", dbCursor, testValues); assertFalse("More than one record", dbCursor.moveToNext()); // Finally, close the cursor and database dbCursor.close(); db.close(); return locationRowId; } /* Students: Here is where you will build code to test that we can insert and query the database. We've done a lot of work for you. You'll want to look in TestUtilities where you can use the "createWeatherValues" function. You can also make use of the validateCurrentRecord function from within TestUtilities. */ public void testWeatherTable() { String weatherTableName = WeatherContract.WeatherEntry.TABLE_NAME; // First insert the location, and then use the locationRowId to insert // the weather. Make sure to cover as many failure cases as you can. Long locationRowId = addToLocationTable(); // First step: Get reference to writable database SQLiteDatabase db = new WeatherDbHelper(this.mContext).getWritableDatabase(); // Create ContentValues of what you want to insert // (you can use the createWeatherValues TestUtilities function if you wish) ContentValues testValues = TestUtilities.createWeatherValues(locationRowId); // Insert ContentValues into database and get a row ID back Long weatherId = db.insert(weatherTableName, null, testValues); // Query the database and receive a Cursor back Cursor dbCursor = db.query(weatherTableName, null, null, null, null, null, null); // Move the cursor to a valid database row assertTrue("No data ??!", dbCursor.moveToFirst()); // Validate data in resulting Cursor with the original ContentValues // (you can use the validateCurrentRecord function in TestUtilities to validate the // query if you like) TestUtilities.validateCurrentRecord("Weather Entry don't match", dbCursor, testValues); assertFalse("Multiple data ??!", dbCursor.moveToNext()); // Finally, close the cursor and database dbCursor.close(); db.close(); } /* Students: This is a helper method for the testWeatherTable quiz. You can move your code from testLocationTable to here so that you can call this code from both testWeatherTable and testLocationTable. */ public long insertLocation() { return -1L; } }
[ "remi.garcia.pro@gmail.com" ]
remi.garcia.pro@gmail.com
75d8d67f0e14f88153f61a13f29d2765bd50e4df
1fb6f17c11aa932e3b63565bcfaa81d9c2645239
/src/Interface/P_1.java
5679187f3a70b509ef3ce538cf347e6132e7e941
[]
no_license
ARN-Test/CommandTest
53bf12c55a588d0c3e08eafe6d581d2f4c626b14
c4a303004f219db7289dcae3770cf7ea680049e6
refs/heads/master
2020-06-24T01:48:43.636033
2017-07-11T16:40:59
2017-07-11T16:40:59
96,915,254
0
0
null
null
null
null
UTF-8
Java
false
false
10,758
java
package Interface; /** * * @author A.R. Nobel */ public class P_1 extends javax.swing.JFrame { /** * Creates new form P_1 */ public P_1() { P.lookandfeel("Metal"); initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { Panel_1 = new javax.swing.JPanel(); Shutdown = new javax.swing.JButton(); Restart = new javax.swing.JButton(); Abort = new javax.swing.JButton(); TimeS = new javax.swing.JSlider(); jLabel1 = new javax.swing.JLabel(); TimerVV = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setBackground(new java.awt.Color(0, 0, 0)); Panel_1.setBackground(new java.awt.Color(153, 153, 153)); Shutdown.setBackground(new java.awt.Color(255, 102, 102)); Shutdown.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N Shutdown.setText("Shutdown"); Shutdown.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { ShutdownActionPerformed(evt); } }); Restart.setBackground(new java.awt.Color(102, 102, 255)); Restart.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N Restart.setText("Restart"); Restart.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { RestartActionPerformed(evt); } }); Abort.setBackground(new java.awt.Color(255, 255, 255)); Abort.setFont(new java.awt.Font("Tahoma", 3, 14)); // NOI18N Abort.setText("Abort"); Abort.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { AbortActionPerformed(evt); } }); TimeS.setMajorTickSpacing(1); TimeS.setMaximum(14400); TimeS.setValue(0); TimeS.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); TimeS.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { TimeSStateChanged(evt); } }); jLabel1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel1.setText("Set Timer:"); jLabel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); TimerVV.setText("0 Second"); javax.swing.GroupLayout Panel_1Layout = new javax.swing.GroupLayout(Panel_1); Panel_1.setLayout(Panel_1Layout); Panel_1Layout.setHorizontalGroup( Panel_1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(Panel_1Layout.createSequentialGroup() .addGap(0, 120, Short.MAX_VALUE) .addGroup(Panel_1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(Panel_1Layout.createSequentialGroup() .addComponent(Shutdown, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(Restart, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(123, 123, 123)) .addGroup(Panel_1Layout.createSequentialGroup() .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(Panel_1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(TimerVV) .addGroup(Panel_1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, Panel_1Layout.createSequentialGroup() .addComponent(Abort, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, Panel_1Layout.createSequentialGroup() .addComponent(TimeS, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(117, 117, 117))))))) ); Panel_1Layout.setVerticalGroup( Panel_1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(Panel_1Layout.createSequentialGroup() .addGap(72, 72, 72) .addGroup(Panel_1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(Restart, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(Shutdown, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 36, Short.MAX_VALUE) .addGroup(Panel_1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(TimeS, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(TimerVV) .addGap(9, 9, 9) .addComponent(Abort, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(Panel_1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(Panel_1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); pack(); }// </editor-fold>//GEN-END:initComponents private void ShutdownActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ShutdownActionPerformed // TODO add your handling code here: try{ Shutdown ST = new Shutdown(TimeS.getValue()); } catch(Exception e) { e.printStackTrace(); } }//GEN-LAST:event_ShutdownActionPerformed private void RestartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RestartActionPerformed // TODO add your handling code here: try{ Restart RT = new Restart(TimeS.getValue()); } catch(Exception e) { e.printStackTrace(); } }//GEN-LAST:event_RestartActionPerformed private void AbortActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AbortActionPerformed // TODO add your handling code here: try{ Abort AT = new Abort(); } catch(Exception e) { e.printStackTrace(); } }//GEN-LAST:event_AbortActionPerformed private void TimeSStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_TimeSStateChanged // TODO add your handling code here: TimerVV.setText(String.valueOf(TimeS.getValue()) + "Seconds"); }//GEN-LAST:event_TimeSStateChanged /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(P_1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(P_1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(P_1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(P_1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new P_1().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton Abort; private javax.swing.JPanel Panel_1; private javax.swing.JButton Restart; private javax.swing.JButton Shutdown; private javax.swing.JSlider TimeS; private javax.swing.JLabel TimerVV; private javax.swing.JLabel jLabel1; // End of variables declaration//GEN-END:variables }
[ "A.R. Nobel@Nobel001" ]
A.R. Nobel@Nobel001
981c8736b05e2dcaa3cca428f7d708259f653e7f
a40e8647d702acb405f8da205e7f6e7daa7856c0
/org.jenetics/src/test/java/org/jenetics/internal/math/probabilityTest.java
b805740d2040715628b7222ea60e5d93683ba42c
[ "Apache-2.0" ]
permissive
xiaoqshou/jenetics
ca8965d318f4147d23a98f9d0e908969c43d7799
b0bc2d4762873df8df9295cebc8728a4a87677b6
refs/heads/master
2021-01-21T08:44:31.782899
2015-01-12T17:51:33
2015-01-12T17:51:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,742
java
/* * Java Genetic Algorithm Library (@__identifier__@). * Copyright (c) @__year__@ Franz Wilhelmstötter * * 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. * * Author: * Franz Wilhelmstötter (franz.wilhelmstoetter@gmx.at) */ package org.jenetics.internal.math; import java.util.Random; import org.testng.Assert; import org.testng.annotations.Test; import org.jenetics.util.RandomRegistry; /** * @author <a href="mailto:franz.wilhelmstoetter@gmx.at">Franz Wilhelmstötter</a> * @version <em>$Date: 2013-09-01 $</em> */ public class probabilityTest { @Test public void toIntToFloat() { final Random random = RandomRegistry.getRandom(); for (int i = 0; i < 100000; ++i) { final float p = random.nextFloat(); final int ip = probability.toInt(p); final float fip = probability.toFloat(ip); Assert.assertEquals(fip, p, 0.000001F); } } @Test public void probabilityToInt() { Assert.assertEquals(probability.toInt(0), Integer.MIN_VALUE); Assert.assertEquals(probability.toInt(1), Integer.MAX_VALUE); Assert.assertEquals(probability.toInt(0.5), 0); Assert.assertEquals(probability.toInt(0.25), Integer.MIN_VALUE/2); Assert.assertEquals(probability.toInt(0.75), Integer.MAX_VALUE/2); } }
[ "franz.wilhelmstoetter@gmail.com" ]
franz.wilhelmstoetter@gmail.com
c63407a516a8d13a48cf06256c8b373ef90ab5cc
316e7708a53558173b40fb1fde39005cb06c749f
/backend/src/main/java/com/devsuperior/dscatalog/dto/ProductDTO.java
0406fc542089f6b941c6dc1f8ef5942027558759
[]
no_license
DaniloPolastri/dscatalog-bootcam-devsuperior
5ff8604ee41293cde2fa349ecd2fd60b341dab1c
900ee58571059d23a22372ad11d0707679b2c169
refs/heads/master
2023-05-02T20:06:08.487080
2021-05-12T22:25:46
2021-05-12T22:25:46
328,265,385
0
0
null
null
null
null
UTF-8
Java
false
false
2,456
java
package com.devsuperior.dscatalog.dto; import com.devsuperior.dscatalog.entities.Category; import com.devsuperior.dscatalog.entities.Product; import java.io.Serializable; import java.time.Instant; import java.util.ArrayList; import java.util.List; import java.util.Set; public class ProductDTO implements Serializable { private static final long serialVersionUID = 1L; private Long id; private String name; private String description; private Double price; private String img_URL; private Instant date; private List<CategoryDTO> categories = new ArrayList<>(); public ProductDTO(){} public ProductDTO(Long id, String name, String description, Double price, String img_URL, Instant date) { this.id = id; this.name = name; this.description = description; this.price = price; this.img_URL = img_URL; this.date = date; } public ProductDTO(Product entity) { this.id = entity.getId(); this.name = entity.getName(); this.description = entity.getDescription(); this.price = entity.getPrice(); this.img_URL = entity.getImg_URL(); this.date = entity.getDate(); } //popular a lista de categoria a categoria DTO public ProductDTO(Product entity, Set<Category> categories){ this(entity); categories.forEach(cat -> this.categories.add(new CategoryDTO(cat))); } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public Double getPrice() { return price; } public void setPrice(Double price) { this.price = price; } public String getImg_URL() { return img_URL; } public void setImg_URL(String img_URL) { this.img_URL = img_URL; } public Instant getDate() { return date; } public void setDate(Instant date) { this.date = date; } public List<CategoryDTO> getCategories() { return categories; } public void setCategories(List<CategoryDTO> categories) { this.categories = categories; } }
[ "danilopolastri.ti@gmail.com" ]
danilopolastri.ti@gmail.com
01291a6371188a439767f2831c33a187c6b6ac81
b30f6f815177defda41a26e1af14f9133a3e6c07
/app/src/main/java/com/example/kvedantam/sunshine/MainActivity.java
9c2ea0eecef47170506e2d5f771654da958cb305
[]
no_license
krishna123499/UdacitySun
a82ba01b0a6735decb8f82ee3c646369ab16c979
55e20b8fb8aa1f000fe907661ef78d40e8662d7c
refs/heads/master
2021-01-09T20:19:07.154814
2016-07-13T07:23:00
2016-07-13T07:23:00
63,223,485
0
0
null
null
null
null
UTF-8
Java
false
false
343
java
package com.example.kvedantam.sunshine; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } }
[ "vedantamkc@gmail.com" ]
vedantamkc@gmail.com
5c9c2838f71c1c2efb51d2090ca93e9b422da2bf
eb668d754f2d6182a64c4ca522cfb73406b1529d
/danmu_collector_server/src/main/java/cn/partytime/collector/service/DanmuCollectorDanmuService.java
f6fdd4a6a33505adcdd708c0bb879e01166652c5
[]
no_license
Sue0115/danmu_system
fb1b76ad09f08ee61f59ac3a2aeb95e0a4784d5f
0be93d54ff8abb904d8ef54e0d9a0cd8c78770d7
refs/heads/master
2021-06-04T20:10:04.758329
2016-06-23T07:31:01
2016-06-23T07:31:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
526
java
package cn.partytime.collector.service; import java.util.Date; /** * Created by user on 16/6/22. */ public interface DanmuCollectorDanmuService { /** * * @param msg 发送的消息 * @param color 颜色 * @param isBlockKey 是否是敏感词 * @param type 类型 * @param date 日期 * @param danmuPoolId 弹幕池编号 * @param userId 用户编号 */ void danmuSave(String msg,String color,boolean isBlockKey,int type,Date date,String danmuPoolId,String userId); }
[ "759620299@qq.com" ]
759620299@qq.com
1eb3e0e0e0f8f0d7583a142a2fef7de9ddaf937d
c7638e90501ea6df2d676ad7eb641c07f0377cf1
/src/main/java/coupon/web/app/service/User.java
f7346a099a67e2fa0838dc959cdb4686d6c37a24
[]
no_license
ilyashusterman/CouponWebApp-deprecated
8fcffbc2b130dfe887b3d5f04d26552f2c584aa0
fc3487c7fdc0ca1f4a727c1b703fa85fca8054a8
refs/heads/master
2021-05-01T13:56:28.393843
2016-11-25T23:26:14
2016-11-25T23:26:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
916
java
package coupon.web.app.service; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement public class User { private String username; private String password; private String clientType; public User() { super(); } public User(String username, String password, String clientType) { super(); this.username = username; this.password = password; this.clientType = clientType; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getClientType() { return clientType; } public void setClientType(String clientType) { this.clientType = clientType; } @Override public String toString() { return "User [username=" + username + ", password=" + password + ", clientType=" + clientType + "]"; } }
[ "ilyashusterman@outlook.com" ]
ilyashusterman@outlook.com
5affeaf481e4f5e87b90b32cb3f57ec11d0f128f
5a54bfa4f05274b4ca5caa907d7d0141b8e5c488
/src/oculusRoomTiny/rendering/glsl/FillCollection.java
effc956c429ef8361ae09681beefcde18a6a1eb9
[ "MIT" ]
permissive
elect86/JavaOculusRoomTiny
dff779a7c7aa46a373abd54235b9c0802947a7a7
978da34e72b1c03500849500756b6a84d21b40e6
refs/heads/master
2021-01-01T16:56:03.946509
2015-04-20T07:27:28
2015-04-20T07:27:28
17,250,333
1
1
null
null
null
null
UTF-8
Java
false
false
3,086
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package oculusRoomTiny.rendering.glsl; import com.jogamp.opengl.GL3; import jglm.Vec2i; import jglm.Vec4; import oculusRoomTiny.rendering.Texture; import static oculusRoomTiny.rendering.Texture.BuiltinTexture.tex_checker; import static oculusRoomTiny.rendering.Texture.BuiltinTexture.tex_count; import static oculusRoomTiny.rendering.Texture.BuiltinTexture.tex_panel; import oculusRoomTiny.rendering.TextureFormat; import oculusRoomTiny.rendering.glsl.shaders.BuiltinShaders; /** * * @author gbarbieri */ public class FillCollection { private ShaderFill litSolid; private ShaderFill[] litTextures; public FillCollection(GL3 gl3) { Texture[] builtinTextures = new Texture[tex_count.ordinal()]; /** * Create floor checkerboard texture. */ { Vec4 a = new Vec4(180f, 180f, 180f, 255f); Vec4 b = new Vec4(80f, 80f, 80f, 255f); byte[] checker = new byte[256 * 256 * 4]; for (int j = 0; j < 256; j++) { for (int i = 0; i < 256; i++) { Vec4 color = (((i / 4 >> 5) ^ (j / 4 >> 5)) & 1) == 1 ? b : a; checker[(j * 256 + i) * 4] = (byte) color.x; checker[(j * 256 + i) * 4 + 1] = (byte) color.y; checker[(j * 256 + i) * 4 + 2] = (byte) color.z; checker[(j * 256 + i) * 4 + 3] = (byte) color.w; } } builtinTextures[tex_checker.ordinal()] = Texture.create(gl3, TextureFormat.RGBA, new Vec2i(256, 256), checker); } /** * Ceiling panel texture. */ { Vec4 a = new Vec4(80f, 80f, 80f, 255f); Vec4 b = new Vec4(180f, 180f, 180f, 255f); byte[] panel = new byte[256 * 256 * 4]; for (int j = 0; j < 256; j++) { for (int i = 0; i < 256; i++) { Vec4 color = (i / 4 == 0 || j / 4 == 0) ? a : b; panel[(j * 256 + i) * 4] = (byte) color.x; panel[(j * 256 + i) * 4 + 1] = (byte) color.y; panel[(j * 256 + i) * 4 + 2] = (byte) color.z; panel[(j * 256 + i) * 4 + 3] = (byte) color.w; } } builtinTextures[tex_panel.ordinal()] = Texture.create(gl3, TextureFormat.RGBA, new Vec2i(256, 256), panel); } litTextures = new ShaderFill[tex_count.ordinal()]; LitTexturesProgram program = new LitTexturesProgram(gl3, BuiltinShaders.filepath, BuiltinShaders.standard_VS, BuiltinShaders.litTexture_FS); for (int i = 1; i < 3; i++) { litTextures[i] = new ShaderFill(program, builtinTextures[i]); } } public ShaderFill getLitSolid() { return litSolid; } public ShaderFill[] getLitTextures() { return litTextures; } }
[ "gbarbieri@reknow05" ]
gbarbieri@reknow05
176e7b731a48b5904237acecc55d3a7e3b74c73c
4b2b6fe260ba39f684f496992513cb8bc07dfcbc
/com/planet_ink/coffee_mud/Commands/Hold.java
45b7e22068808ae1d5cd13109fb0bb18bfb8dffe
[ "Apache-2.0" ]
permissive
vjanmey/EpicMudfia
ceb26feeac6f5b3eb48670f81ea43d8648314851
63c65489c673f4f8337484ea2e6ebfc11a09364c
refs/heads/master
2021-01-18T20:12:08.160733
2014-06-22T04:38:14
2014-06-22T04:38:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,052
java
package com.planet_ink.coffee_mud.Commands; import com.planet_ink.coffee_mud.core.interfaces.*; import com.planet_ink.coffee_mud.core.*; import com.planet_ink.coffee_mud.core.collections.*; import com.planet_ink.coffee_mud.Abilities.interfaces.*; import com.planet_ink.coffee_mud.Areas.interfaces.*; import com.planet_ink.coffee_mud.Behaviors.interfaces.*; import com.planet_ink.coffee_mud.CharClasses.interfaces.*; import com.planet_ink.coffee_mud.Commands.interfaces.*; import com.planet_ink.coffee_mud.Common.interfaces.*; import com.planet_ink.coffee_mud.Exits.interfaces.*; import com.planet_ink.coffee_mud.Items.interfaces.*; import com.planet_ink.coffee_mud.Locales.interfaces.*; import com.planet_ink.coffee_mud.MOBS.interfaces.*; import com.planet_ink.coffee_mud.Races.interfaces.*; import java.util.*; /* Copyright 2000-2014 Bo Zimmerman 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. */ @SuppressWarnings({"unchecked","rawtypes"}) public class Hold extends StdCommand { public Hold(){} private final String[] access=_i(new String[]{"HOLD","HOL","HO","H"}); @Override public String[] getAccessWords(){return access;} @Override public boolean execute(MOB mob, Vector commands, int metaFlags) throws java.io.IOException { if(commands.size()<2) { mob.tell(_("Hold what?")); return false; } commands.removeElementAt(0); final List<Item> items=CMLib.english().fetchItemList(mob,mob,null,commands,Wearable.FILTER_UNWORNONLY,false); if(items.size()==0) mob.tell(_("You don't seem to be carrying that.")); else for(int i=0;i<items.size();i++) if((items.size()==1)||(items.get(i).canWear(mob,Wearable.WORN_HELD))) { final Item item=items.get(i); int msgType=CMMsg.MSG_HOLD; String str=_("<S-NAME> hold(s) <T-NAME>."); if((mob.freeWearPositions(Wearable.WORN_WIELD,(short)0,(short)0)>0) &&((item.rawProperLocationBitmap()==Wearable.WORN_WIELD) ||(item.rawProperLocationBitmap()==(Wearable.WORN_HELD|Wearable.WORN_WIELD)))) { str=_("<S-NAME> wield(s) <T-NAME>."); msgType=CMMsg.MSG_WIELD; } final CMMsg newMsg=CMClass.getMsg(mob,item,null,msgType,str); if(mob.location().okMessage(mob,newMsg)) mob.location().send(mob,newMsg); } return false; } @Override public double combatActionsCost(final MOB mob, final List<String> cmds){return CMProps.getCombatActionCost(ID());} @Override public double actionsCost(final MOB mob, final List<String> cmds){return CMProps.getActionCost(ID());} @Override public boolean canBeOrdered(){return true;} }
[ "vjanmey@gmail.com" ]
vjanmey@gmail.com
f0a4ae10ea33dff69fd7f7301c83807f80d3fe68
f3beb239c1c70aaa0e458c0499161a05306cb1dc
/src/main/java/wisdom21/model/system/mapper/db1/User1Mapper.java
5ad0204b69d44a7d61a3393bb15ec371d8663d71
[]
no_license
wisdom-21/book-druid-mybatis_plus
ecc1d76b6f84bdc9a1cf02250a9b0d64a1832e63
bf0a686188d13bd0ff084d2822a4f92c94e92983
refs/heads/master
2022-06-30T08:12:48.844056
2019-08-16T09:11:50
2019-08-16T09:11:50
202,696,715
1
0
null
2022-06-21T01:40:55
2019-08-16T09:11:37
Java
UTF-8
Java
false
false
316
java
package wisdom21.model.system.mapper.db1; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; import wisdom21.model.system.entity.User1Entity; /** * @author Joaz * @date 2019/8/16 15:25 */ @Mapper public interface User1Mapper extends BaseMapper<User1Entity> { }
[ "wisdom_lhz@163.com" ]
wisdom_lhz@163.com
c4c360613f438cee42e393459fdeaac0dc63db99
f81c7375389103dc082663d71f1ab19a1d40688b
/app/src/main/java/example/codeclan/com/blackjack/BlackJackStartActivity.java
a0720522ae1e0400fa6f6bd14f44d6c555c12535
[]
no_license
CrawfordD1/BlackJack_Android
67ef30ea82d293be3e3cd20abdfb9948a97f6bf5
5050e665dd11d726a256fb4db4a7679884fd9fa9
refs/heads/master
2020-12-02T16:21:34.644906
2017-08-09T17:16:23
2017-08-09T17:16:23
96,540,259
0
0
null
null
null
null
UTF-8
Java
false
false
395
java
package example.codeclan.com.blackjack; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; public class BlackJackStartActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_black_jack_start); } }
[ "crawforddavidson@gmail.com" ]
crawforddavidson@gmail.com
0505845318049a755ff158f86a14c33113221134
4f83c12631cfd6b8594a9c99653d0a8df96db799
/app/src/test/java/com/eton/roomdb/ExampleUnitTest.java
08156629f1c9620ed47ace49395fe9c356596966
[]
no_license
CrossLeaf/RoomDb
6e8fbedf936db52f9d3e4885c22953d9624ebb89
3634878839e146385ced8109fc5558383fa5e7a0
refs/heads/master
2020-05-13T16:06:45.963732
2019-04-25T15:02:36
2019-04-25T15:02:36
181,637,000
0
0
null
null
null
null
UTF-8
Java
false
false
376
java
package com.eton.roomdb; 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); } }
[ "eton_tsai@paradise-soft.com.tw" ]
eton_tsai@paradise-soft.com.tw
9def95fab6ecf7d045f99a8ac8629e5e154d4266
1a0dbbe3a79436631c5b1620db5602e076dcd878
/CustomSpinnerTutorial/app/src/main/java/com/androideasily/customspinnertutorial/SpinnerData.java
2aaa312bad67e48dc3051bb7824dd3364c8decd6
[ "MIT" ]
permissive
a-anand-91119/Android-Easily-Projects
de8c7f6163743970cc0063c8b0b52f70fdd71ca1
f4e4cd3c99c5b9dbce8656b0c9b04056e45d4171
refs/heads/master
2021-04-28T05:13:17.792596
2020-04-21T06:13:20
2020-04-21T06:13:20
122,174,402
1
0
null
null
null
null
UTF-8
Java
false
false
414
java
package com.androideasily.customspinnertutorial; /** * Created by Anand on 28-06-2017. */ public class SpinnerData { private int icon; private String iconName; public SpinnerData(int icon, String iconName) { this.icon = icon; this.iconName = iconName; } public int getIcon() { return icon; } public String getIconName() { return iconName; } }
[ "a.anand.91119@gmail.com" ]
a.anand.91119@gmail.com
0f8f8a258c3fa5f3b3f9e55d2af30e5965e1a436
c62f0f7b407dc1c774ccb1a623cfee052b458f32
/inputview/src/main/java/com/agsw/FabricView/DrawableObjects/CDrawable.java
57808242deab07a5efa1d42c0b7220777a319777
[ "Apache-2.0" ]
permissive
whoze/FabricView
3c89a8a0cf79cb5a99f9af634b5d496b9eed5abb
05549effd9c207cb2159637302ee8a2f83e21fbe
refs/heads/master
2020-07-02T16:31:00.886994
2015-10-09T23:04:19
2015-10-09T23:04:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
364
java
package com.agsw.FabricView.DrawableObjects; import android.graphics.Canvas; import android.graphics.Paint; /** * Created by antwan on 10/3/2015. */ public interface CDrawable { Paint getPaint(); int getXcoords(); int getYcoords(); void setXcoords(int x); void setYcoords(int y); void setPaint(Paint p); void draw(Canvas canvas); }
[ "antwankakki@gmail.com" ]
antwankakki@gmail.com
9e642fe7468b33597e7bfce441e1a1ee6c96ad8d
5730a8865d01d09a662499f2ef2ff635e853c59f
/src/test/java/uk/co/maclon/claimant/repository/ClaimantRepositoryTest.java
21b28d62fd95fe26c4d858d5f6374e0b459b86b2
[]
no_license
philbarton/springReactive
28010ae63e1ec25b3a23929a029e745543100528
89d309b68e059d0a7c0ee45ae344bb5935add8a3
refs/heads/master
2020-03-20T05:52:33.925928
2018-06-18T09:29:34
2018-06-18T09:29:34
137,229,320
0
0
null
null
null
null
UTF-8
Java
false
false
2,071
java
package uk.co.maclon.claimant.repository; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.data.mongodb.core.ReactiveMongoTemplate; import org.springframework.test.context.junit4.SpringRunner; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; import uk.co.maclon.claimant.model.Claimant; import uk.co.maclon.claimant.model.Gender; import uk.co.maclon.claimant.model.RelationshipStatus; import uk.co.maclon.claimant.model.Title; import java.time.LocalDate; @RunWith(SpringRunner.class) @SpringBootTest public class ClaimantRepositoryTest { @Autowired ReactiveMongoTemplate template; @Autowired ClaimantRepository claimantRepository; @Before public void setUp() { StepVerifier.create(template.dropCollection(Claimant.class)).verifyComplete(); } @Test public void insertOneRepo() { Claimant claimant = createClaimant("QQ123456C"); Mono<Claimant> claimantMono = claimantRepository.save(claimant); StepVerifier.create(claimantMono).expectNextCount(1).verifyComplete(); } @Test public void insertOneTemplate() { Claimant claimant = createClaimant("QQ123456C"); Flux<Claimant> insertOne = template .insertAll(Flux.just(claimant).collectList()); StepVerifier.create(insertOne).expectNextCount(1).verifyComplete(); } private static Claimant createClaimant(String nino) { return Claimant .builder() .nino(nino) .dateOfBirth(LocalDate.now()) .title(Title.MR) .firstName("phil") .lastName("barton") .gender(Gender.MALE) .hasPartner(true) .relationshipStatus(RelationshipStatus.MARRIED) .hasSavings(false) .build(); } }
[ "philbart@mac.com" ]
philbart@mac.com
915985f1bd60c775cc3c5e2af4e85999c83823bd
603cd3e2be567331529672c2372b96ea295a54e9
/feign/basic-master/src/main/java/com/ZhaoChenheng/thread/ThreadPoolDemo.java
ff210b9bef7c60a378a2a09f48f9f66930db5209
[]
no_license
ZhaoChenheng/ZCH4
0393878ff640ff31618234ad47bfc3d0415aabee
e0bfe7405dff244fbd871302b4ed203e5313f75d
refs/heads/master
2022-06-27T21:08:17.613808
2020-11-04T03:27:40
2020-11-04T03:27:40
224,595,946
0
0
null
2022-06-17T02:44:22
2019-11-28T07:36:58
Java
UTF-8
Java
false
false
861
java
package com.ZhaoChenheng.thread; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; public class ThreadPoolDemo { public static class MyTask implements Runnable { public void run() { System.out.println(System.currentTimeMillis() // + ":Thread ID:" + Thread.currentThread().getId() + ":Thread Name: " + Thread.currentThread().getName()); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } } public static void main(String[] args) { MyTask task = new MyTask(); ExecutorService es = Executors.newFixedThreadPool(5); for (int i = 0; i < 10; i++) { es.submit(task); } es.shutdown(); } }
[ "3532803418@qq.com" ]
3532803418@qq.com
68f2fda3655c01837fa24a21cb08047adedd3003
e386d1153b65ef0d0076e154009db72b4beffdfb
/src/br/com/drummond/dal/ModuloConexao.java
253b34ddfa9442066ec29606b2ae4ecc7962a071
[]
no_license
Davimmr/ProjetoFaculdade
5b55f990116fbb5e71d097fc709e27c77ba4fcf7
c036f60f33f08c21031d9cbbec40deb61e3a87eb
refs/heads/main
2023-07-31T12:20:17.305964
2021-09-15T18:10:00
2021-09-15T18:10:00
406,878,197
0
0
null
null
null
null
UTF-8
Java
false
false
1,367
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package br.com.drummond.dal; import java.sql.*; /*data acess learn* * * @author Miticos */ public class ModuloConexao { //metodo responsavel por estabelecer a conexao com o bd public static Connection conector() { java.sql.Connection conexao = null; // a linha abaixo chama o driver //qual o tipo de bd String driver = "com.mysql.jdbc.Driver"; //qual o caminho e o nome do bd e dps qual usuario pode acessar o bd q // q seria do xampp o root e sem senha // armazenando informacoes referente ao banco String url = "jdbc:mysql://localhost:3306/dbTIO"; String user = "root"; String password = ""; //estabelecendo a conexao com o banco // vai exe a linha do drive, obtendo conexao pelo caminho usuario e senha // para poder ligar o bd com o java e entao returna a conexao "" try { Class.forName(driver); conexao = DriverManager.getConnection(url, user, password); return conexao; } catch (Exception e) { //System.out.println(e); return null; } } }
[ "davi.senac@hotmail.com" ]
davi.senac@hotmail.com
00ea3bab69e5ff8357997d5bd0065f5bd769b123
9a34516ec63144052b251b62fa7e9bdd0986adc4
/src/main/java/com/drag/tb1906/ms/resp/MsGoodsResp.java
417ae3a057c23f7deac6087aa62f3a3295fbbd67
[]
no_license
longyunbo/tb1906
ce8df105c5c50bdc98a3c465169c180e35b5f8f2
7129b5387d756a8ae13e5677723528da9d0dc6aa
refs/heads/master
2020-03-29T04:45:41.730224
2018-09-20T03:42:24
2018-09-20T03:42:24
149,546,902
0
0
null
null
null
null
UTF-8
Java
false
false
239
java
package com.drag.tb1906.ms.resp; import com.drag.tb1906.common.BaseResponse; import lombok.Data; @Data public class MsGoodsResp extends BaseResponse{ private static final long serialVersionUID = 5892514759638449628L; }
[ "longyunbo@guohuaigroup.com" ]
longyunbo@guohuaigroup.com
0da67bffbaa826ac31688c3ac8fa8c0f47a66884
d69101efcbce0e033d42a3e9ca82f81719728aa7
/bobo-mall/bobo-manager/bobo-manager-service/src/main/java/com/bobo/service/ItemCatService.java
d0f4ad90e02742a0c369d8c8cb4aacc6bd86bdf8
[]
no_license
a982338665/lf-project-java-mall
22bf23d6385bf9e887f6f1c73fcc58f99593c132
62af77cc795239200b9437d0c1ee1ea36d99bef3
refs/heads/master
2021-09-14T23:32:56.788897
2018-05-22T09:25:52
2018-05-22T09:25:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
257
java
package com.bobo.service; import com.bobo.common.pojo.EUTreeNode; import java.util.List; public interface ItemCatService { /** * 根据父类目id查询类目列表 * @param parentId * @return */ List<EUTreeNode> getCatList(long parentId); }
[ "982338665@qq.com" ]
982338665@qq.com
3e8a389b89e53237443c02ace8ee3a4daa0e046a
c3ee07d146f8f88aaa3e66ef4b7562b6dffc6c21
/src/main/java/in/nu/learn/patterns/creational/abstractfactory/DesktopFactory.java
667d37b4fbc288c68240661bd03d02e0828ce553
[]
no_license
krnbr/learning
4cfdd4d2861c09a3e07bcf66ef86de7b49c42821
8b86a3cfabdaad59616db77d7dac2e973282bd85
refs/heads/master
2020-04-14T06:21:32.439775
2019-10-13T19:46:13
2019-10-13T19:46:13
163,684,174
0
0
null
null
null
null
UTF-8
Java
false
false
473
java
package in.nu.learn.patterns.creational.abstractfactory; public class DesktopFactory implements ComputerAbstractFactory { private int ram; private int hdd; private OSTypes osType = OSTypes.WINDOWS; public DesktopFactory(int ram, int hdd, OSTypes osType){ this.ram=ram; this.hdd=hdd; this.osType=osType; } @Override public Computer setupComputer() { return new Desktop(this.hdd, this.ram, this.osType); } }
[ "krnbr@live.in" ]
krnbr@live.in
38a6e71931fa0b5d7249da1ca374d7321dcc7503
de8140d8e0752a0a842465845eddf1fe69537cfd
/TD - TP/imohamedraffique/Exo3TD1/src/Contenu.java
8da99dd0ffdc0b4113b7e81a47ad8c9852a62627
[]
no_license
Ssoap/IUT-Orsay-TP351-groupe-1
704a02b0c123243ed749b1ef04f2047154218a74
9f195f2f90dd9082fb526b697c041618a78fa7a1
refs/heads/master
2016-09-06T01:28:49.763633
2015-01-16T19:00:56
2015-01-16T19:00:56
26,429,360
0
0
null
null
null
null
UTF-8
Java
false
false
515
java
public class Contenu { Article article; Resume resume; public Contenu(Article a, Resume r) { article = a; resume = r; } public Contenu(Article a) { article = a; } public Contenu(Resume r) { resume = r; } public String toStringft() { return "article: " + article.getArticle() + ", resume: " + resume.getResume(); } public String toStringfto() { return "article: " + article.getArticle(); } public String toStringsms() { return "resume: " + resume.getResume(); } }
[ "k.randriani@gmail.com" ]
k.randriani@gmail.com
23c89ededb79356c31d0d55b5235ea733093b351
49e5c3fe24190171b856c6992ab1ef45dcd8ba2e
/src/main/java/com/dengzhanglin/xyeh/web/form/RegisterForm.java
706754ab5d71861dba6c869aa45db5fd5a8d2c2f
[ "MIT" ]
permissive
zhanglindeng/xyeh
cfea25a02d3eeebf5d8170020777b3852e93db99
0f1fbff5f34840fd97abeac18a619fe50223a25a
refs/heads/master
2021-01-24T17:49:34.586576
2018-05-06T12:29:16
2018-05-06T12:29:16
47,622,681
0
0
null
null
null
null
UTF-8
Java
false
false
1,473
java
package com.dengzhanglin.xyeh.web.form; import javax.validation.constraints.Email; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; public class RegisterForm { @NotBlank @Email private String email; @NotNull @Size(min = 6, max = 20) private String password; @NotNull @Size(min = 6, max = 20) private String password2; @NotNull @Size(min = 6, max = 6, message = "无效的验证码") private String verifyCode; 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 String getPassword2() { return password2; } public void setPassword2(String password2) { this.password2 = password2; } public String getVerifyCode() { return verifyCode; } public void setVerifyCode(String verifyCode) { this.verifyCode = verifyCode; } @Override public String toString() { return "RegisterForm{" + "email='" + email + '\'' + ", password='" + password + '\'' + ", password2='" + password2 + '\'' + ", verifyCode='" + verifyCode + '\'' + '}'; } }
[ "zhanglindeng@outlook.com" ]
zhanglindeng@outlook.com
b20d3c928bdd3d767da5ce2026351f1ae714c084
5c6cfd2f44672806fb8433c789cf4b1e63f6fc3f
/src/Main.java
d74ecfc6c2a6e49ce0544ccf5724cc25fff593ca
[]
no_license
IlyaKukarkin/JavaThreadGame
c1f0decf5ee0f810a5339715cd34bf55f37cfe3d
6f2f3b7f62635a30a50fad5e9d519886209b92c6
refs/heads/master
2020-03-09T15:28:18.757767
2018-04-10T02:16:21
2018-04-10T02:16:21
128,859,916
0
0
null
null
null
null
UTF-8
Java
false
false
7,495
java
import org.jetbrains.annotations.Contract; import java.awt.*; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.util.Random; import java.util.concurrent.Semaphore; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.locks.ReentrantLock; public class Main { private static Random rnd = new Random(); static CreateMainWindow window = new CreateMainWindow(new MyKeyListener(), 40, 40); static int gunX = 20, gunY = 39; private static final char gunSymbol = '¤'; static AtomicInteger hit = new AtomicInteger(0), miss = new AtomicInteger(0); static Semaphore bulletSemaphore = new Semaphore(3, true); private static ReentrantLock randomLock = new ReentrantLock(); public static void main(String[] args) { window.setSymbol(gunX, gunY, gunSymbol, Color.BLACK); new CreateEnemy().start(); } public static class MyKeyListener implements KeyListener { @Override public void keyTyped(KeyEvent e) { } @Override public void keyPressed(KeyEvent e) { switch (e.getExtendedKeyCode()){ case KeyEvent.VK_RIGHT: Main.stepRight(); break; case KeyEvent.VK_LEFT: Main.stepLeft(); break; case KeyEvent.VK_UP: Main.stepUp(); break; case KeyEvent.VK_DOWN: Main.stepDown(); break; case KeyEvent.VK_SPACE: Main.OpenFire(); } } @Override public void keyReleased(KeyEvent e) { } } public static class CreateMainWindow extends Frame{ private static final int screenOffset = 8, baseX = 8, baseY = 31, symbolWidth = 16, symbolHeight = 16; private Font defaultFont = new Font(Font.MONOSPACED, Font.PLAIN, symbolHeight); private ReentrantLock screenLock = new ReentrantLock(); CreateMainWindow(KeyListener keyListener, int screenWidth, int screenHeight){ setSize(baseX + screenOffset + screenWidth * symbolWidth, baseY + screenOffset + screenHeight * symbolHeight); setLayout(null); setVisible(true); addKeyListener(keyListener); } @Contract(pure = true) private int toPixelCoordinateX(int x){ return x * symbolWidth + baseX; } @Contract(pure = true) private int toPixelCoordinateY(int y){ return y * symbolHeight + baseY; } void setSymbol(int x, int y, char symbol, Color color){ Label label = new Label(String.valueOf(symbol)); label.setFont(defaultFont); label.setForeground(color); label.setBounds(toPixelCoordinateX(x), toPixelCoordinateY(y), symbolWidth, symbolHeight); screenLock.lock(); add(label); screenLock.unlock(); } void removeSymbol(int x, int y){ Component component = getComponentAt(toPixelCoordinateX(x),toPixelCoordinateY(y)); screenLock.lock(); remove(component); screenLock.unlock(); } boolean isNotFree(int x, int y){ return !getComponentAt(toPixelCoordinateX(x),toPixelCoordinateY(y)).getName().equals("frame0"); } } public static class CreateEnemy extends Thread { private static final int enemyDelation = 1200; @Override public void run() { do { if (Main.getNextRandomInt(2) == 1) new Enemy().start(); try { sleep(enemyDelation); } catch (InterruptedException e) { e.printStackTrace(); } } while (true); } } public static class Enemy extends Thread { private static final int enemySleepingTime = 400; static final char enemy = '-'; static final Color[] colorMas = {Color.BLUE, Color.GREEN, Color.RED}; private static Random rnd = new Random(); @Override public void run() { int enemyY = Main.getNextRandomInt(25); int increment, boundX, enemyX; if (enemyY % 2 == 0) { increment = 1; boundX = 39; enemyX = 1; } else { increment = -1; boundX = 0; enemyX = 39; } while (enemyX != boundX){ if (!Main.window.isNotFree(enemyX, enemyY)) { Main.window.setSymbol(enemyX, enemyY, enemy, colorMas[rnd.nextInt(3)]); } else { Main.window.removeSymbol(enemyX, enemyY); break; } try { sleep(enemySleepingTime); } catch (InterruptedException e) { e.printStackTrace(); } if (Main.window.isNotFree(enemyX, enemyY)) { Main.window.removeSymbol(enemyX, enemyY); } else { return; } enemyX += increment; } } } public static class Bullet extends Thread { private static final int bulletSleepPeriod = 25; static final char bullet = '^'; @Override public void run() { if (!Main.bulletSemaphore.tryAcquire()) return; int bulletX = Main.gunX, bulletY = Main.gunY - 1; while(bulletY >= 0) { if (bulletY == 0) Main.IncMiss(); if (!Main.window.isNotFree(bulletX, bulletY)) { Main.window.setSymbol(bulletX, bulletY, bullet, Color.BLACK); } else { Main.IncHit(); Main.window.removeSymbol(bulletX, bulletY); break; } try { sleep(bulletSleepPeriod); } catch (InterruptedException e) { e.printStackTrace(); } Main.window.removeSymbol(bulletX, bulletY); bulletY--; } Main.bulletSemaphore.release(); } } static void stepLeft() { if (gunX - 1 >= 0) { window.removeSymbol(gunX, gunY); window.setSymbol(--gunX, gunY, gunSymbol, Color.BLACK); } } static void stepRight() { if (gunX + 1 < 40) { window.removeSymbol(gunX, gunY); window.setSymbol(++gunX, gunY, gunSymbol, Color.BLACK); } } static void stepUp() { if (gunY + 1 > 25) { window.removeSymbol(gunX, gunY); window.setSymbol(gunX, --gunY, gunSymbol, Color.BLACK); } } static void stepDown() { if (gunY + 1 < 40) { window.removeSymbol(gunX, gunY); window.setSymbol(gunX, ++gunY, gunSymbol, Color.BLACK); } } static void OpenFire(){ new Bullet().start(); } static int getNextRandomInt(int limit){ randomLock.lock(); int randomInt = rnd.nextInt(limit); randomLock.unlock(); return randomInt; } static void IncHit(){ hit.addAndGet(1); } static void IncMiss(){ miss.addAndGet(1); } }
[ "ilya1196@yandex.ru" ]
ilya1196@yandex.ru
36ccc8b0fd27e61c7b1a8f5462b199a810d8ea4c
cc94380c744676115f5ca2af575f8dca6da38269
/src/main/java/com/google/cloud/compute/v1/AggregatedListTargetHttpsProxiesHttpRequest.java
142ac139c9a5f009a15c0fffb2f84c75da3da5ac
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
vchudnov-g/java-compute
cfb70898c5c220c2bafa7f24126b799235d7ab11
93041a581cd44b23afb085962b3eb56e9b34051b
refs/heads/master
2021-01-07T17:01:11.362233
2020-02-04T19:21:18
2020-02-04T19:21:18
241,762,450
0
0
null
2020-02-20T01:03:29
2020-02-20T01:03:28
null
UTF-8
Java
false
false
22,768
java
/* * Copyright 2020 Google LLC * * 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.google.cloud.compute.v1; import com.google.api.core.BetaApi; import com.google.api.gax.httpjson.ApiMessage; import java.util.List; import java.util.Objects; import javax.annotation.Generated; import javax.annotation.Nullable; @Generated("by GAPIC") @BetaApi /** * Request object for method compute.targetHttpsProxies.aggregatedList. Retrieves the list of all * TargetHttpsProxy resources, regional and global, available to the specified project. */ public final class AggregatedListTargetHttpsProxiesHttpRequest implements ApiMessage { private final String access_token; private final String callback; private final String fields; private final String filter; private final String key; private final Integer maxResults; private final String orderBy; private final String pageToken; private final String prettyPrint; private final String project; private final String quotaUser; private final String userIp; private AggregatedListTargetHttpsProxiesHttpRequest() { this.access_token = null; this.callback = null; this.fields = null; this.filter = null; this.key = null; this.maxResults = null; this.orderBy = null; this.pageToken = null; this.prettyPrint = null; this.project = null; this.quotaUser = null; this.userIp = null; } private AggregatedListTargetHttpsProxiesHttpRequest( String access_token, String callback, String fields, String filter, String key, Integer maxResults, String orderBy, String pageToken, String prettyPrint, String project, String quotaUser, String userIp) { this.access_token = access_token; this.callback = callback; this.fields = fields; this.filter = filter; this.key = key; this.maxResults = maxResults; this.orderBy = orderBy; this.pageToken = pageToken; this.prettyPrint = prettyPrint; this.project = project; this.quotaUser = quotaUser; this.userIp = userIp; } @Override public Object getFieldValue(String fieldName) { if ("access_token".equals(fieldName)) { return access_token; } if ("callback".equals(fieldName)) { return callback; } if ("fields".equals(fieldName)) { return fields; } if ("filter".equals(fieldName)) { return filter; } if ("key".equals(fieldName)) { return key; } if ("maxResults".equals(fieldName)) { return maxResults; } if ("orderBy".equals(fieldName)) { return orderBy; } if ("pageToken".equals(fieldName)) { return pageToken; } if ("prettyPrint".equals(fieldName)) { return prettyPrint; } if ("project".equals(fieldName)) { return project; } if ("quotaUser".equals(fieldName)) { return quotaUser; } if ("userIp".equals(fieldName)) { return userIp; } return null; } @Nullable @Override public ApiMessage getApiMessageRequestBody() { return null; } @Nullable @Override /** * The fields that should be serialized (even if they have empty values). If the containing * message object has a non-null fieldmask, then all the fields in the field mask (and only those * fields in the field mask) will be serialized. If the containing object does not have a * fieldmask, then only non-empty fields will be serialized. */ public List<String> getFieldMask() { return null; } /** OAuth 2.0 token for the current user. */ public String getAccessToken() { return access_token; } /** Name of the JavaScript callback function that handles the response. */ public String getCallback() { return callback; } /** Selector specifying a subset of fields to include in the response. */ public String getFields() { return fields; } /** * A filter expression that filters resources listed in the response. The expression must specify * the field name, a comparison operator, and the value that you want to use for filtering. The * value must be a string, a number, or a boolean. The comparison operator must be either =, !=, * &gt;, or &lt;. * * <p>For example, if you are filtering Compute Engine instances, you can exclude instances named * example-instance by specifying name != example-instance. * * <p>You can also filter nested fields. For example, you could specify * scheduling.automaticRestart = false to include instances only if they are not scheduled for * automatic restarts. You can use filtering on nested fields to filter based on resource labels. * * <p>To filter on multiple expressions, provide each separate expression within parentheses. For * example, (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake"). By default, each * expression is an AND expression. However, you can include AND and OR expressions explicitly. * For example, (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND * (scheduling.automaticRestart = true). */ public String getFilter() { return filter; } /** API key. Required unless you provide an OAuth 2.0 token. */ public String getKey() { return key; } /** * The maximum number of results per page that should be returned. If the number of available * results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to * get the next page of results in subsequent list requests. Acceptable values are 0 to 500, * inclusive. (Default: 500) */ public Integer getMaxResults() { return maxResults; } /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order * based on the resource name. * * <p>You can also sort results in descending order based on the creation timestamp using * orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in * reverse chronological order (newest result first). Use this to sort resources like operations * so that the newest operation is returned first. * * <p>Currently, only sorting by name or creationTimestamp desc is supported. */ public String getOrderBy() { return orderBy; } /** * Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list * request to get the next page of results. */ public String getPageToken() { return pageToken; } /** Returns response with indentations and line breaks. */ public String getPrettyPrint() { return prettyPrint; } /** * Name of the project scoping this request. It must have the format * `{project}/aggregated/targetHttpsProxies`. \`{project}\` must start with a letter, and contain * only letters (\`[A-Za-z]\`), numbers (\`[0-9]\`), dashes (\`-\`), &#42; underscores (\`_\`), * periods (\`.\`), tildes (\`~\`), plus (\`+\`) or percent &#42; signs (\`%\`). It must be * between 3 and 255 characters in length, and it &#42; must not start with \`"goog"\`. */ public String getProject() { return project; } /** Alternative to userIp. */ public String getQuotaUser() { return quotaUser; } /** IP address of the end user for whom the API call is being made. */ public String getUserIp() { return userIp; } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(AggregatedListTargetHttpsProxiesHttpRequest prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } public static AggregatedListTargetHttpsProxiesHttpRequest getDefaultInstance() { return DEFAULT_INSTANCE; } private static final AggregatedListTargetHttpsProxiesHttpRequest DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new AggregatedListTargetHttpsProxiesHttpRequest(); } public static class Builder { private String access_token; private String callback; private String fields; private String filter; private String key; private Integer maxResults; private String orderBy; private String pageToken; private String prettyPrint; private String project; private String quotaUser; private String userIp; Builder() {} public Builder mergeFrom(AggregatedListTargetHttpsProxiesHttpRequest other) { if (other == AggregatedListTargetHttpsProxiesHttpRequest.getDefaultInstance()) return this; if (other.getAccessToken() != null) { this.access_token = other.access_token; } if (other.getCallback() != null) { this.callback = other.callback; } if (other.getFields() != null) { this.fields = other.fields; } if (other.getFilter() != null) { this.filter = other.filter; } if (other.getKey() != null) { this.key = other.key; } if (other.getMaxResults() != null) { this.maxResults = other.maxResults; } if (other.getOrderBy() != null) { this.orderBy = other.orderBy; } if (other.getPageToken() != null) { this.pageToken = other.pageToken; } if (other.getPrettyPrint() != null) { this.prettyPrint = other.prettyPrint; } if (other.getProject() != null) { this.project = other.project; } if (other.getQuotaUser() != null) { this.quotaUser = other.quotaUser; } if (other.getUserIp() != null) { this.userIp = other.userIp; } return this; } Builder(AggregatedListTargetHttpsProxiesHttpRequest source) { this.access_token = source.access_token; this.callback = source.callback; this.fields = source.fields; this.filter = source.filter; this.key = source.key; this.maxResults = source.maxResults; this.orderBy = source.orderBy; this.pageToken = source.pageToken; this.prettyPrint = source.prettyPrint; this.project = source.project; this.quotaUser = source.quotaUser; this.userIp = source.userIp; } /** OAuth 2.0 token for the current user. */ public String getAccessToken() { return access_token; } /** OAuth 2.0 token for the current user. */ public Builder setAccessToken(String access_token) { this.access_token = access_token; return this; } /** Name of the JavaScript callback function that handles the response. */ public String getCallback() { return callback; } /** Name of the JavaScript callback function that handles the response. */ public Builder setCallback(String callback) { this.callback = callback; return this; } /** Selector specifying a subset of fields to include in the response. */ public String getFields() { return fields; } /** Selector specifying a subset of fields to include in the response. */ public Builder setFields(String fields) { this.fields = fields; return this; } /** * A filter expression that filters resources listed in the response. The expression must * specify the field name, a comparison operator, and the value that you want to use for * filtering. The value must be a string, a number, or a boolean. The comparison operator must * be either =, !=, &gt;, or &lt;. * * <p>For example, if you are filtering Compute Engine instances, you can exclude instances * named example-instance by specifying name != example-instance. * * <p>You can also filter nested fields. For example, you could specify * scheduling.automaticRestart = false to include instances only if they are not scheduled for * automatic restarts. You can use filtering on nested fields to filter based on resource * labels. * * <p>To filter on multiple expressions, provide each separate expression within parentheses. * For example, (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake"). By * default, each expression is an AND expression. However, you can include AND and OR * expressions explicitly. For example, (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel * Broadwell") AND (scheduling.automaticRestart = true). */ public String getFilter() { return filter; } /** * A filter expression that filters resources listed in the response. The expression must * specify the field name, a comparison operator, and the value that you want to use for * filtering. The value must be a string, a number, or a boolean. The comparison operator must * be either =, !=, &gt;, or &lt;. * * <p>For example, if you are filtering Compute Engine instances, you can exclude instances * named example-instance by specifying name != example-instance. * * <p>You can also filter nested fields. For example, you could specify * scheduling.automaticRestart = false to include instances only if they are not scheduled for * automatic restarts. You can use filtering on nested fields to filter based on resource * labels. * * <p>To filter on multiple expressions, provide each separate expression within parentheses. * For example, (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake"). By * default, each expression is an AND expression. However, you can include AND and OR * expressions explicitly. For example, (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel * Broadwell") AND (scheduling.automaticRestart = true). */ public Builder setFilter(String filter) { this.filter = filter; return this; } /** API key. Required unless you provide an OAuth 2.0 token. */ public String getKey() { return key; } /** API key. Required unless you provide an OAuth 2.0 token. */ public Builder setKey(String key) { this.key = key; return this; } /** * The maximum number of results per page that should be returned. If the number of available * results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to * get the next page of results in subsequent list requests. Acceptable values are 0 to 500, * inclusive. (Default: 500) */ public Integer getMaxResults() { return maxResults; } /** * The maximum number of results per page that should be returned. If the number of available * results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to * get the next page of results in subsequent list requests. Acceptable values are 0 to 500, * inclusive. (Default: 500) */ public Builder setMaxResults(Integer maxResults) { this.maxResults = maxResults; return this; } /** * Sorts list results by a certain order. By default, results are returned in alphanumerical * order based on the resource name. * * <p>You can also sort results in descending order based on the creation timestamp using * orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in * reverse chronological order (newest result first). Use this to sort resources like operations * so that the newest operation is returned first. * * <p>Currently, only sorting by name or creationTimestamp desc is supported. */ public String getOrderBy() { return orderBy; } /** * Sorts list results by a certain order. By default, results are returned in alphanumerical * order based on the resource name. * * <p>You can also sort results in descending order based on the creation timestamp using * orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in * reverse chronological order (newest result first). Use this to sort resources like operations * so that the newest operation is returned first. * * <p>Currently, only sorting by name or creationTimestamp desc is supported. */ public Builder setOrderBy(String orderBy) { this.orderBy = orderBy; return this; } /** * Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list * request to get the next page of results. */ public String getPageToken() { return pageToken; } /** * Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list * request to get the next page of results. */ public Builder setPageToken(String pageToken) { this.pageToken = pageToken; return this; } /** Returns response with indentations and line breaks. */ public String getPrettyPrint() { return prettyPrint; } /** Returns response with indentations and line breaks. */ public Builder setPrettyPrint(String prettyPrint) { this.prettyPrint = prettyPrint; return this; } /** * Name of the project scoping this request. It must have the format * `{project}/aggregated/targetHttpsProxies`. \`{project}\` must start with a letter, and * contain only letters (\`[A-Za-z]\`), numbers (\`[0-9]\`), dashes (\`-\`), &#42; underscores * (\`_\`), periods (\`.\`), tildes (\`~\`), plus (\`+\`) or percent &#42; signs (\`%\`). It * must be between 3 and 255 characters in length, and it &#42; must not start with \`"goog"\`. */ public String getProject() { return project; } /** * Name of the project scoping this request. It must have the format * `{project}/aggregated/targetHttpsProxies`. \`{project}\` must start with a letter, and * contain only letters (\`[A-Za-z]\`), numbers (\`[0-9]\`), dashes (\`-\`), &#42; underscores * (\`_\`), periods (\`.\`), tildes (\`~\`), plus (\`+\`) or percent &#42; signs (\`%\`). It * must be between 3 and 255 characters in length, and it &#42; must not start with \`"goog"\`. */ public Builder setProject(String project) { this.project = project; return this; } /** Alternative to userIp. */ public String getQuotaUser() { return quotaUser; } /** Alternative to userIp. */ public Builder setQuotaUser(String quotaUser) { this.quotaUser = quotaUser; return this; } /** IP address of the end user for whom the API call is being made. */ public String getUserIp() { return userIp; } /** IP address of the end user for whom the API call is being made. */ public Builder setUserIp(String userIp) { this.userIp = userIp; return this; } public AggregatedListTargetHttpsProxiesHttpRequest build() { String missing = ""; if (project == null) { missing += " project"; } if (!missing.isEmpty()) { throw new IllegalStateException("Missing required properties:" + missing); } return new AggregatedListTargetHttpsProxiesHttpRequest( access_token, callback, fields, filter, key, maxResults, orderBy, pageToken, prettyPrint, project, quotaUser, userIp); } public Builder clone() { Builder newBuilder = new Builder(); newBuilder.setAccessToken(this.access_token); newBuilder.setCallback(this.callback); newBuilder.setFields(this.fields); newBuilder.setFilter(this.filter); newBuilder.setKey(this.key); newBuilder.setMaxResults(this.maxResults); newBuilder.setOrderBy(this.orderBy); newBuilder.setPageToken(this.pageToken); newBuilder.setPrettyPrint(this.prettyPrint); newBuilder.setProject(this.project); newBuilder.setQuotaUser(this.quotaUser); newBuilder.setUserIp(this.userIp); return newBuilder; } } @Override public String toString() { return "AggregatedListTargetHttpsProxiesHttpRequest{" + "access_token=" + access_token + ", " + "callback=" + callback + ", " + "fields=" + fields + ", " + "filter=" + filter + ", " + "key=" + key + ", " + "maxResults=" + maxResults + ", " + "orderBy=" + orderBy + ", " + "pageToken=" + pageToken + ", " + "prettyPrint=" + prettyPrint + ", " + "project=" + project + ", " + "quotaUser=" + quotaUser + ", " + "userIp=" + userIp + "}"; } @Override public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof AggregatedListTargetHttpsProxiesHttpRequest) { AggregatedListTargetHttpsProxiesHttpRequest that = (AggregatedListTargetHttpsProxiesHttpRequest) o; return Objects.equals(this.access_token, that.getAccessToken()) && Objects.equals(this.callback, that.getCallback()) && Objects.equals(this.fields, that.getFields()) && Objects.equals(this.filter, that.getFilter()) && Objects.equals(this.key, that.getKey()) && Objects.equals(this.maxResults, that.getMaxResults()) && Objects.equals(this.orderBy, that.getOrderBy()) && Objects.equals(this.pageToken, that.getPageToken()) && Objects.equals(this.prettyPrint, that.getPrettyPrint()) && Objects.equals(this.project, that.getProject()) && Objects.equals(this.quotaUser, that.getQuotaUser()) && Objects.equals(this.userIp, that.getUserIp()); } return false; } @Override public int hashCode() { return Objects.hash( access_token, callback, fields, filter, key, maxResults, orderBy, pageToken, prettyPrint, project, quotaUser, userIp); } }
[ "chingor@google.com" ]
chingor@google.com
221c039af09d7012e980a90a5729e1b995f9b49e
5b7043c0020a1ffbc5f01150d76de461f3f919c6
/jOOQ/src/main/java/org/jooq/impl/DropIndexImpl.java
5c06027bbaa08b726ef2d001a595ba4ac09fae06
[ "Apache-2.0" ]
permissive
brmeyer/jOOQ
b8566ff3438c2cae57949c8a1575502945bd707a
33e616356d268d574eb52297c38176c8ed0cc247
refs/heads/master
2021-01-18T19:54:26.050884
2015-01-26T14:43:40
2015-01-26T14:43:40
29,864,793
0
1
null
2015-01-26T14:36:40
2015-01-26T14:36:39
null
UTF-8
Java
false
false
4,007
java
/** * Copyright (c) 2009-2015, Data Geekery GmbH (http://www.datageekery.com) * All rights reserved. * * This work is dual-licensed * - under the Apache Software License 2.0 (the "ASL") * - under the jOOQ License and Maintenance Agreement (the "jOOQ License") * ============================================================================= * You may choose which license applies to you: * * - If you're using this work with Open Source databases, you may choose * either ASL or jOOQ License. * - If you're using this work with at least one commercial database, you must * choose jOOQ License * * For more information, please visit http://www.jooq.org/licenses * * Apache Software License 2.0: * ----------------------------------------------------------------------------- * 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. * * jOOQ License and Maintenance Agreement: * ----------------------------------------------------------------------------- * Data Geekery grants the Customer the non-exclusive, timely limited and * non-transferable license to install and use the Software under the terms of * the jOOQ License and Maintenance Agreement. * * This library is distributed with a LIMITED WARRANTY. See the jOOQ License * and Maintenance Agreement for more details: http://www.jooq.org/licensing */ package org.jooq.impl; import static java.util.Arrays.asList; import static org.jooq.Clause.DROP_INDEX; // ... // ... import static org.jooq.SQLDialect.CUBRID; // ... import static org.jooq.SQLDialect.DERBY; import static org.jooq.SQLDialect.FIREBIRD; // ... // ... import static org.jooq.impl.DSL.name; import static org.jooq.impl.DropStatementType.INDEX; import org.jooq.Clause; import org.jooq.Configuration; import org.jooq.Context; import org.jooq.DropIndexFinalStep; /** * @author Lukas Eder */ class DropIndexImpl extends AbstractQuery implements // Cascading interface implementations for DROP INDEX behaviour DropIndexFinalStep { /** * Generated UID */ private static final long serialVersionUID = 8904572826501186329L; private static final Clause[] CLAUSES = { DROP_INDEX }; private final String index; private final boolean ifExists; DropIndexImpl(Configuration configuration, String index) { this(configuration, index, false); } DropIndexImpl(Configuration configuration, String index, boolean ifExists) { super(configuration); this.index = index; this.ifExists = ifExists; } // ------------------------------------------------------------------------ // XXX: QueryPart API // ------------------------------------------------------------------------ private final boolean supportsIfExists(Context<?> ctx) { return !asList(CUBRID, DERBY, FIREBIRD).contains(ctx.family()); } @Override public final void accept(Context<?> ctx) { if (ifExists && !supportsIfExists(ctx)) { Utils.executeImmediateBegin(ctx, INDEX); accept0(ctx); Utils.executeImmediateEnd(ctx, INDEX); } else { accept0(ctx); } } private void accept0(Context<?> ctx) { ctx.keyword("drop index").sql(" "); if (ifExists && supportsIfExists(ctx)) ctx.keyword("if exists").sql(" "); ctx.visit(name(index)); } @Override public final Clause[] clauses(Context<?> ctx) { return CLAUSES; } }
[ "lukas.eder@gmail.com" ]
lukas.eder@gmail.com
82eb3c23e30b9c8137f4d8d3df44b12e51b3d269
e3a493bb01f450d9106c12681be3fc9a7e913a5f
/encog-java-core-2.5.3/src/org/encog/bot/browse/range/DocumentRange.java
bd70e732e221f63bf4162f252a97524a2f326245
[ "BSD-3-Clause", "Apache-2.0" ]
permissive
cassandracomar/VAFusion2
aaf67a0560e89d750005bd9a89b02c33dc478c5d
ebf550f465a72525d2a2bd2fcc6f9f98796e029c
refs/heads/master
2021-05-28T01:17:38.452166
2011-05-17T16:01:21
2011-05-17T16:01:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,143
java
/* * Encog(tm) Core v2.5 - Java Version * http://www.heatonresearch.com/encog/ * http://code.google.com/p/encog-java/ * Copyright 2008-2010 Heaton Research, Inc. * * 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. * * For more information on Heaton Research copyrights, licenses * and trademarks visit: * http://www.heatonresearch.com/copyright */ package org.encog.bot.browse.range; import java.util.ArrayList; import java.util.List; import org.encog.bot.browse.WebPage; import org.encog.bot.dataunit.DataUnit; import org.encog.bot.dataunit.TextDataUnit; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Base class that represents a document range. A document range is a collection * of tags that all apply to one "concept". For example, a Form, or a Link. This * allows the form to collect the elements inside the form, or a link to collect * the text along with the link tag. * * @author jheaton * */ public class DocumentRange { /** * The beginning index for this range. */ private int begin; /** * The ending index for this range. */ private int end; /** * The source page for this range. */ private WebPage source; /** * The id attribute, on the source tag. Useful for DIV tags. */ private String idAttribute; /** * The class attribute. on the source tag. */ private String classAttribute; /** * Sub elements of this range. */ private final List<DocumentRange> elements = new ArrayList<DocumentRange>(); /** * The parent to this range, or null if top. */ private DocumentRange parent; /** * The logger. */ @SuppressWarnings("unused") private final Logger logger = LoggerFactory.getLogger(this.getClass()); /** * Construct a document range from the specified WebPage. * * @param source * The web page that this range belongs to. */ public DocumentRange(final WebPage source) { this.source = source; } /** * Add an element. * * @param element * The element to add. */ public void addElement(final DocumentRange element) { this.elements.add(element); element.setParent(this); } /** * @return The beginning index. */ public int getBegin() { return this.begin; } /** * @return the classAttribute */ public String getClassAttribute() { return this.classAttribute; } /** * @return The elements of this document range. */ public List<DocumentRange> getElements() { return this.elements; } /** * @return The ending index. */ public int getEnd() { return this.end; } /** * @return the idAttribute */ public String getIdAttribute() { return this.idAttribute; } /** * @return The web page that owns this class. */ public DocumentRange getParent() { return this.parent; } /** * @return The web page that this range is owned by. */ public WebPage getSource() { return this.source; } /** * Get the text from this range. * * @return The text from this range. */ public String getTextOnly() { final StringBuilder result = new StringBuilder(); for (int i = getBegin(); i < getEnd(); i++) { final DataUnit du = this.source.getData().get(i); if (du instanceof TextDataUnit) { result.append(du.toString()); result.append("\n"); } } return result.toString(); } /** * Set the beginning index. * * @param begin * The beginning index. */ public void setBegin(final int begin) { this.begin = begin; } /** * @param classAttribute * the classAttribute to set */ public void setClassAttribute(final String classAttribute) { this.classAttribute = classAttribute; } /** * Set the ending index. * * @param end * The ending index. */ public void setEnd(final int end) { this.end = end; } /** * @param idAttribute * the idAttribute to set */ public void setIdAttribute(final String idAttribute) { this.idAttribute = idAttribute; } /** * Set the parent. * * @param parent * The parent. */ public void setParent(final DocumentRange parent) { this.parent = parent; } /** * Set the source web page. * * @param source * The source web page. */ public void setSource(final WebPage source) { this.source = source; } /** * {@inheritDoc} */ @Override public String toString() { return getTextOnly(); } }
[ "arjun@yew.localdomain" ]
arjun@yew.localdomain
95c45b1a29e6ab7405379296c01b94a6a790396e
bd85dc52b99a18ae8a8200c3e6910cd13ab699fd
/design_patterns/command/command/LightOnCommand.java
1f8e70fa32d5fb48131db77a6ada5b1234d6d53d
[]
no_license
RyotaBannai/design-patterns
6e319a44e62f3bd0a57024786717826dd0bba420
cb699c0d2f9b69e38bf1ecea3a2ebd2d86dd104e
refs/heads/master
2022-12-17T20:45:40.815665
2020-09-24T14:04:50
2020-09-24T14:04:50
295,413,712
0
0
null
null
null
null
UTF-8
Java
false
false
313
java
package design_patterns.command.command; import design_patterns.command.vender.Light; public class LightOnCommand implements Command { Light light; public LightOnCommand(Light light) { this.light = light; } public void execute() { light.on(); } public void undo() { light.off(); } }
[ "ryotala0528@gmail.com" ]
ryotala0528@gmail.com
b3faa96b6b2598c905a9bf57a0dcc7a833d20a4b
ad60018d3c6ef8e77e8d3efcd872b0005531d26e
/Zeiterfassung_Core_Api/src/main/java/com/adcubum/timerecording/app/TimeRecorderFactory.java
49c022ef82a20ebc7dfced94651b29fdc817efdd
[]
no_license
brugalibre/Zeiterfassung
3df1ab57135b47e05a25fec4811f521a0b791fb1
47c4dc836bbbf2d22c97758a029f99b1727065be
refs/heads/master
2023-05-10T23:54:29.224470
2023-04-22T06:39:00
2023-04-22T07:27:37
118,165,522
5
1
null
2023-03-07T07:18:41
2018-01-19T18:56:56
Java
UTF-8
Java
false
false
818
java
package com.adcubum.timerecording.app; import com.adcubum.timerecording.core.factory.AbstractFactory; /** * Factory used to create and instantiate new {@link TimeRecorder} instances * * @author DStalder * */ public class TimeRecorderFactory extends AbstractFactory { private static final String BEAN_NAME = "timerecorder"; private static final TimeRecorderFactory INSTANCE = new TimeRecorderFactory(); private TimeRecorderFactory() { super("modul-configration.xml"); } /** * Creates a new Instance of the {@link TimeRecorder} or returns an already created instance * * @return a new Instance of the {@link TimeRecorder} or returns an already created instance */ public static TimeRecorder createNew() { return INSTANCE.createNewWithAgruments(BEAN_NAME); } }
[ "dominic.stalder89@gmail.com" ]
dominic.stalder89@gmail.com
7f0ac49900eca884a223d84d2704020daa16483d
ae177443e7cfe52e7a29dfa48a30ab64b635e813
/XvXvDoctor/app/src/main/java/cn/com/xxdoctor/bean/CardBean.java
6af7b04c15c01ba704464000da1dbb445e6efb1d
[]
no_license
Galvatron0521/XvXvDoctor
4b09a4549567f0b62e3b4f019f63c7920b49df43
27a4abdc525fa53ca94c03d4eb94dcf3f87d6a75
refs/heads/master
2022-01-15T10:08:35.377429
2019-06-03T03:30:52
2019-06-03T03:30:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,748
java
package cn.com.xxdoctor.bean; import com.bigkoo.pickerview.model.IPickerViewData; /** * Created by KyuYi on 2017/3/2. * E-Mail:kyu_yi@sina.com * 功能: */ public class CardBean implements IPickerViewData { public String cardItemId; public String cardItemName; public Object tag; //课题使用 public String id; public String isHaveChild; public String fieldName; public CardBean(String cardItemId, String cardItemName) { this.cardItemId = cardItemId; this.cardItemName = cardItemName; } public CardBean(String cardItemId, String cardItemName, String id, String isHaveChild,String fieldName) { this.cardItemId = cardItemId; this.cardItemName = cardItemName; this.id = id; this.isHaveChild = isHaveChild; this.fieldName = fieldName; } @Override public String toString() { return "CardBean{" + "cardItemId='" + cardItemId + '\'' + ", cardItemName='" + cardItemName + '\'' + ", tag=" + tag + ", id='" + id + '\'' + ", isHaveChild='" + isHaveChild + '\'' + ", fieldName='" + fieldName + '\'' + '}'; } public String getId() { return cardItemId; } public void setId(String id) { this.cardItemId = id; } public String getCardNo() { return cardItemName; } public void setCardNo(String cardNo) { this.cardItemName = cardNo; } public Object getTag() { return tag; } public void setTag(Object tag) { this.tag = tag; } @Override public String getPickerViewText() { return cardItemName; } }
[ "18353847303@163.com" ]
18353847303@163.com
8f7b265bde80ad9f4bb5df2d70ca6196d8472aa7
20eb9cf15903a0321782da267fc8d53eac513655
/src/main/java/com/qf/etl/util/ip/IPSeeker.java
5ed34c3e7933ef83c643ad208ba24d1fbbe1eba0
[]
no_license
banfusheng/logAnalystic
8158b6f10b7eee812af9de956b5fd4aac37167c4
33cd607ff35e637eed548bccc76ba7ef6bc58c95
refs/heads/master
2020-03-26T11:34:20.964471
2018-08-23T01:15:11
2018-08-23T01:15:11
144,849,443
0
0
null
null
null
null
UTF-8
Java
false
false
26,084
java
package com.qf.etl.util.ip; import java.io.FileNotFoundException; import java.io.IOException; import java.io.RandomAccessFile; import java.io.UnsupportedEncodingException; import java.nio.ByteOrder; import java.nio.MappedByteBuffer; import java.nio.channels.FileChannel; import java.util.ArrayList; import java.util.Hashtable; import java.util.List; /** */ /** * * 用来读取QQwry.dat文件,以根据ip获得好友位置,QQwry.dat的格式是 一. 文件头,共8字节 1. 第一个起始IP的绝对偏移, 4字节 * 2. 最后一个起始IP的绝对偏移, 4字节 二. "结束地址/国家/区域"记录区 四字节ip地址后跟的每一条记录分成两个部分 1. 国家记录 2. * 地区记录 但是地区记录是不一定有的。而且国家记录和地区记录都有两种形式 1. 以0结束的字符串 2. 4个字节,一个字节可能为0x1或0x2 a. * 为0x1时,表示在绝对偏移后还跟着一个区域的记录,注意是绝对偏移之后,而不是这四个字节之后 b. 为0x2时,表示在绝对偏移后没有区域记录 * 不管为0x1还是0x2,后三个字节都是实际国家名的文件内绝对偏移 * 如果是地区记录,0x1和0x2的含义不明,但是如果出现这两个字节,也肯定是跟着3个字节偏移,如果不是 则为0结尾字符串 三. * "起始地址/结束地址偏移"记录区 1. 每条记录7字节,按照起始地址从小到大排列 a. 起始IP地址,4字节 b. 结束ip地址的绝对偏移,3字节 * * 注意,这个文件里的ip地址和所有的偏移量均采用little-endian格式,而java是采用 big-endian格式的,要注意转换 * * */ public class IPSeeker { // 一些固定常量,比如记录长度等等 private static final int IP_RECORD_LENGTH = 7; private static final byte AREA_FOLLOWED = 0x01; private static final byte NO_AREA = 0x2; // 用来做为cache,查询一个ip时首先查看cache,以减少不必要的重复查找 private Hashtable ipCache; // 随机文件访问类 private RandomAccessFile ipFile; // 内存映射文件 private MappedByteBuffer mbb; // 单一模式实例 private static IPSeeker instance = null; // 起始地区的开始和结束的绝对偏移 private long ipBegin, ipEnd; // 为提高效率而采用的临时变量 private IPLocation loc; private byte[] buf; private byte[] b4; private byte[] b3; /** */ /** * 私有构造函数 */ protected IPSeeker() { ipCache = new Hashtable(); loc = new IPLocation(); buf = new byte[100]; b4 = new byte[4]; b3 = new byte[3]; try { String ipFilePath = IPSeeker.class.getResource("/qqwry.dat").getFile(); ipFile = new RandomAccessFile(ipFilePath, "r"); } catch (FileNotFoundException e) { System.out.println("IP地址信息文件没有找到,IP显示功能将无法使用"); ipFile = null; } // 如果打开文件成功,读取文件头信息 if (ipFile != null) { try { ipBegin = readLong4(0); ipEnd = readLong4(4); if (ipBegin == -1 || ipEnd == -1) { ipFile.close(); ipFile = null; } } catch (IOException e) { System.out.println("IP地址信息文件格式有错误,IP显示功能将无法使用"); ipFile = null; } } } /** */ /** * @return 单一实例 */ public static IPSeeker getInstance() { if (instance == null) { instance = new IPSeeker(); } return instance; } /** */ /** * 给定一个地点的不完全名字,得到一系列包含s子串的IP范围记录 * * @param s * 地点子串 * @return 包含IPEntry类型的List */ public List getIPEntriesDebug(String s) { List ret = new ArrayList(); long endOffset = ipEnd + 4; for (long offset = ipBegin + 4; offset <= endOffset; offset += IP_RECORD_LENGTH) { // 读取结束IP偏移 long temp = readLong3(offset); // 如果temp不等于-1,读取IP的地点信息 if (temp != -1) { IPLocation loc = getIPLocation(temp); // 判断是否这个地点里面包含了s子串,如果包含了,添加这个记录到List中,如果没有,继续 if (loc.country.indexOf(s) != -1 || loc.area.indexOf(s) != -1) { IPEntry entry = new IPEntry(); entry.country = loc.country; entry.area = loc.area; // 得到起始IP readIP(offset - 4, b4); entry.beginIp = IPSeekerUtils.getIpStringFromBytes(b4); // 得到结束IP readIP(temp, b4); entry.endIp = IPSeekerUtils.getIpStringFromBytes(b4); // 添加该记录 ret.add(entry); } } } return ret; } /** */ /** * 给定一个地点的不完全名字,得到一系列包含s子串的IP范围记录 * * @param s * 地点子串 * @return 包含IPEntry类型的List */ public List getIPEntries(String s) { List ret = new ArrayList(); try { // 映射IP信息文件到内存中 if (mbb == null) { FileChannel fc = ipFile.getChannel(); mbb = fc.map(FileChannel.MapMode.READ_ONLY, 0, ipFile.length()); mbb.order(ByteOrder.LITTLE_ENDIAN); } int endOffset = (int) ipEnd; for (int offset = (int) ipBegin + 4; offset <= endOffset; offset += IP_RECORD_LENGTH) { int temp = readInt3(offset); if (temp != -1) { IPLocation loc = getIPLocation(temp); // 判断是否这个地点里面包含了s子串,如果包含了,添加这个记录到List中,如果没有,继续 if (loc.country.indexOf(s) != -1 || loc.area.indexOf(s) != -1) { IPEntry entry = new IPEntry(); entry.country = loc.country; entry.area = loc.area; // 得到起始IP readIP(offset - 4, b4); entry.beginIp = IPSeekerUtils.getIpStringFromBytes(b4); // 得到结束IP readIP(temp, b4); entry.endIp = IPSeekerUtils.getIpStringFromBytes(b4); // 添加该记录 ret.add(entry); } } } } catch (IOException e) { System.out.println(e.getMessage()); } return ret; } /** */ /** * 从内存映射文件的offset位置开始的3个字节读取一个int * * @param offset * @return */ private int readInt3(int offset) { mbb.position(offset); return mbb.getInt() & 0x00FFFFFF; } /** */ /** * 从内存映射文件的当前位置开始的3个字节读取一个int * * @return */ private int readInt3() { return mbb.getInt() & 0x00FFFFFF; } /** */ /** * 根据IP得到国家名 * * @param ip * ip的字节数组形式 * @return 国家名字符串 */ public String getCountry(byte[] ip) { // 检查ip地址文件是否正常 if (ipFile == null) return "错误的IP数据库文件"; // 保存ip,转换ip字节数组为字符串形式 String ipStr = IPSeekerUtils.getIpStringFromBytes(ip); // 先检查cache中是否已经包含有这个ip的结果,没有再搜索文件 if (ipCache.containsKey(ipStr)) { IPLocation loc = (IPLocation) ipCache.get(ipStr); return loc.country; } else { IPLocation loc = getIPLocation(ip); ipCache.put(ipStr, loc.getCopy()); return loc.country; } } /** */ /** * 根据IP得到国家名 * * @param ip * IP的字符串形式 * @return 国家名字符串 */ public String getCountry(String ip) { return getCountry(IPSeekerUtils.getIpByteArrayFromString(ip)); } /** */ /** * 根据IP得到地区名 * * @param ip * ip的字节数组形式 * @return 地区名字符串 */ public String getArea(byte[] ip) { // 检查ip地址文件是否正常 if (ipFile == null) return "错误的IP数据库文件"; // 保存ip,转换ip字节数组为字符串形式 String ipStr = IPSeekerUtils.getIpStringFromBytes(ip); // 先检查cache中是否已经包含有这个ip的结果,没有再搜索文件 if (ipCache.containsKey(ipStr)) { IPLocation loc = (IPLocation) ipCache.get(ipStr); return loc.area; } else { IPLocation loc = getIPLocation(ip); ipCache.put(ipStr, loc.getCopy()); return loc.area; } } /** * 根据IP得到地区名 * * @param ip * IP的字符串形式 * @return 地区名字符串 */ public String getArea(String ip) { return getArea(IPSeekerUtils.getIpByteArrayFromString(ip)); } /** */ /** * 根据ip搜索ip信息文件,得到IPLocation结构,所搜索的ip参数从类成员ip中得到 * * @param ip * 要查询的IP * @return IPLocation结构 */ public IPLocation getIPLocation(byte[] ip) { IPLocation info = null; long offset = locateIP(ip); if (offset != -1) info = getIPLocation(offset); if (info == null) { info = new IPLocation(); info.country = "未知国家"; info.area = "未知地区"; } return info; } /** * 从offset位置读取4个字节为一个long,因为java为big-endian格式,所以没办法 用了这么一个函数来做转换 * * @param offset * @return 读取的long值,返回-1表示读取文件失败 */ private long readLong4(long offset) { long ret = 0; try { ipFile.seek(offset); ret |= (ipFile.readByte() & 0xFF); ret |= ((ipFile.readByte() << 8) & 0xFF00); ret |= ((ipFile.readByte() << 16) & 0xFF0000); ret |= ((ipFile.readByte() << 24) & 0xFF000000); return ret; } catch (IOException e) { return -1; } } /** * 从offset位置读取3个字节为一个long,因为java为big-endian格式,所以没办法 用了这么一个函数来做转换 * * @param offset * @return 读取的long值,返回-1表示读取文件失败 */ private long readLong3(long offset) { long ret = 0; try { ipFile.seek(offset); ipFile.readFully(b3); ret |= (b3[0] & 0xFF); ret |= ((b3[1] << 8) & 0xFF00); ret |= ((b3[2] << 16) & 0xFF0000); return ret; } catch (IOException e) { return -1; } } /** * 从当前位置读取3个字节转换成long * * @return */ private long readLong3() { long ret = 0; try { ipFile.readFully(b3); ret |= (b3[0] & 0xFF); ret |= ((b3[1] << 8) & 0xFF00); ret |= ((b3[2] << 16) & 0xFF0000); return ret; } catch (IOException e) { return -1; } } /** * 从offset位置读取四个字节的ip地址放入ip数组中,读取后的ip为big-endian格式,但是 * 文件中是little-endian形式,将会进行转换 * * @param offset * @param ip */ private void readIP(long offset, byte[] ip) { try { ipFile.seek(offset); ipFile.readFully(ip); byte temp = ip[0]; ip[0] = ip[3]; ip[3] = temp; temp = ip[1]; ip[1] = ip[2]; ip[2] = temp; } catch (IOException e) { System.out.println(e.getMessage()); } } /** * 从offset位置读取四个字节的ip地址放入ip数组中,读取后的ip为big-endian格式,但是 * 文件中是little-endian形式,将会进行转换 * * @param offset * @param ip */ private void readIP(int offset, byte[] ip) { mbb.position(offset); mbb.get(ip); byte temp = ip[0]; ip[0] = ip[3]; ip[3] = temp; temp = ip[1]; ip[1] = ip[2]; ip[2] = temp; } /** * 把类成员ip和beginIp比较,注意这个beginIp是big-endian的 * * @param ip * 要查询的IP * @param beginIp * 和被查询IP相比较的IP * @return 相等返回0,ip大于beginIp则返回1,小于返回-1。 */ private int compareIP(byte[] ip, byte[] beginIp) { for (int i = 0; i < 4; i++) { int r = compareByte(ip[i], beginIp[i]); if (r != 0) return r; } return 0; } /** * 把两个byte当作无符号数进行比较 * * @param b1 * @param b2 * @return 若b1大于b2则返回1,相等返回0,小于返回-1 */ private int compareByte(byte b1, byte b2) { if ((b1 & 0xFF) > (b2 & 0xFF)) // 比较是否大于 return 1; else if ((b1 ^ b2) == 0)// 判断是否相等 return 0; else return -1; } /** * 这个方法将根据ip的内容,定位到包含这个ip国家地区的记录处,返回一个绝对偏移 方法使用二分法查找。 * * @param ip * 要查询的IP * @return 如果找到了,返回结束IP的偏移,如果没有找到,返回-1 */ private long locateIP(byte[] ip) { long m = 0; int r; // 比较第一个ip项 readIP(ipBegin, b4); r = compareIP(ip, b4); if (r == 0) return ipBegin; else if (r < 0) return -1; // 开始二分搜索 for (long i = ipBegin, j = ipEnd; i < j;) { m = getMiddleOffset(i, j); readIP(m, b4); r = compareIP(ip, b4); // log.debug(Utils.getIpStringFromBytes(b)); if (r > 0) i = m; else if (r < 0) { if (m == j) { j -= IP_RECORD_LENGTH; m = j; } else j = m; } else return readLong3(m + 4); } // 如果循环结束了,那么i和j必定是相等的,这个记录为最可能的记录,但是并非 // 肯定就是,还要检查一下,如果是,就返回结束地址区的绝对偏移 m = readLong3(m + 4); readIP(m, b4); r = compareIP(ip, b4); if (r <= 0) return m; else return -1; } /** * 得到begin偏移和end偏移中间位置记录的偏移 * * @param begin * @param end * @return */ private long getMiddleOffset(long begin, long end) { long records = (end - begin) / IP_RECORD_LENGTH; records >>= 1; if (records == 0) records = 1; return begin + records * IP_RECORD_LENGTH; } /** * 给定一个ip国家地区记录的偏移,返回一个IPLocation结构 * * @param offset * @return */ private IPLocation getIPLocation(long offset) { try { // 跳过4字节ip ipFile.seek(offset + 4); // 读取第一个字节判断是否标志字节 byte b = ipFile.readByte(); if (b == AREA_FOLLOWED) { // 读取国家偏移 long countryOffset = readLong3(); // 跳转至偏移处 ipFile.seek(countryOffset); // 再检查一次标志字节,因为这个时候这个地方仍然可能是个重定向 b = ipFile.readByte(); if (b == NO_AREA) { loc.country = readString(readLong3()); ipFile.seek(countryOffset + 4); } else loc.country = readString(countryOffset); // 读取地区标志 loc.area = readArea(ipFile.getFilePointer()); } else if (b == NO_AREA) { loc.country = readString(readLong3()); loc.area = readArea(offset + 8); } else { loc.country = readString(ipFile.getFilePointer() - 1); loc.area = readArea(ipFile.getFilePointer()); } return loc; } catch (IOException e) { return null; } } /** * @param offset * @return */ private IPLocation getIPLocation(int offset) { // 跳过4字节ip mbb.position(offset + 4); // 读取第一个字节判断是否标志字节 byte b = mbb.get(); if (b == AREA_FOLLOWED) { // 读取国家偏移 int countryOffset = readInt3(); // 跳转至偏移处 mbb.position(countryOffset); // 再检查一次标志字节,因为这个时候这个地方仍然可能是个重定向 b = mbb.get(); if (b == NO_AREA) { loc.country = readString(readInt3()); mbb.position(countryOffset + 4); } else loc.country = readString(countryOffset); // 读取地区标志 loc.area = readArea(mbb.position()); } else if (b == NO_AREA) { loc.country = readString(readInt3()); loc.area = readArea(offset + 8); } else { loc.country = readString(mbb.position() - 1); loc.area = readArea(mbb.position()); } return loc; } /** * 从offset偏移开始解析后面的字节,读出一个地区名 * * @param offset * @return 地区名字符串 * @throws IOException */ private String readArea(long offset) throws IOException { ipFile.seek(offset); byte b = ipFile.readByte(); if (b == 0x01 || b == 0x02) { long areaOffset = readLong3(offset + 1); if (areaOffset == 0) return "未知地区"; else return readString(areaOffset); } else return readString(offset); } /** * @param offset * @return */ private String readArea(int offset) { mbb.position(offset); byte b = mbb.get(); if (b == 0x01 || b == 0x02) { int areaOffset = readInt3(); if (areaOffset == 0) return "未知地区"; else return readString(areaOffset); } else return readString(offset); } /** * 从offset偏移处读取一个以0结束的字符串 * * @param offset * @return 读取的字符串,出错返回空字符串 */ private String readString(long offset) { try { ipFile.seek(offset); int i; for (i = 0, buf[i] = ipFile.readByte(); buf[i] != 0; buf[++i] = ipFile.readByte()) ; if (i != 0) return IPSeekerUtils.getString(buf, 0, i, "GBK"); } catch (IOException e) { System.out.println(e.getMessage()); } return ""; } /** * 从内存映射文件的offset位置得到一个0结尾字符串 * * @param offset * @return */ private String readString(int offset) { try { mbb.position(offset); int i; for (i = 0, buf[i] = mbb.get(); buf[i] != 0; buf[++i] = mbb.get()) ; if (i != 0) return IPSeekerUtils.getString(buf, 0, i, "GBK"); } catch (IllegalArgumentException e) { System.out.println(e.getMessage()); } return ""; } public String getAddress(String ip) { String country = getCountry(ip).equals(" CZ88.NET") ? "" : getCountry(ip); String area = getArea(ip).equals(" CZ88.NET") ? "" : getArea(ip); String address = country + " " + area; return address.trim(); } /** * * 用来封装ip相关信息,目前只有两个字段,ip所在的国家和地区 * * * @author swallow */ public class IPLocation { public String country; public String area; public IPLocation() { country = area = ""; } public IPLocation getCopy() { IPLocation ret = new IPLocation(); ret.country = country; ret.area = area; return ret; } } /** * 一条IP范围记录,不仅包括国家和区域,也包括起始IP和结束IP * * * * @author gerry liu */ public class IPEntry { public String beginIp; public String endIp; public String country; public String area; public IPEntry() { beginIp = endIp = country = area = ""; } public String toString() { return this.area + " " + this.country + "IP Χ:" + this.beginIp + "-" + this.endIp; } } /** * 操作工具类 * * @author gerryliu * */ public static class IPSeekerUtils { /** * 从ip的字符串形式得到字节数组形式 * * @param ip * 字符串形式的ip * @return 字节数组形式的ip */ public static byte[] getIpByteArrayFromString(String ip) { byte[] ret = new byte[4]; java.util.StringTokenizer st = new java.util.StringTokenizer(ip, "."); try { ret[0] = (byte) (Integer.parseInt(st.nextToken()) & 0xFF); ret[1] = (byte) (Integer.parseInt(st.nextToken()) & 0xFF); ret[2] = (byte) (Integer.parseInt(st.nextToken()) & 0xFF); ret[3] = (byte) (Integer.parseInt(st.nextToken()) & 0xFF); } catch (Exception e) { System.out.println(e.getMessage()); } return ret; } /** * 对原始字符串进行编码转换,如果失败,返回原始的字符串 * * @param s * 原始字符串 * @param srcEncoding * 源编码方式 * @param destEncoding * 目标编码方式 * @return 转换编码后的字符串,失败返回原始字符串 */ public static String getString(String s, String srcEncoding, String destEncoding) { try { return new String(s.getBytes(srcEncoding), destEncoding); } catch (UnsupportedEncodingException e) { return s; } } /** * 根据某种编码方式将字节数组转换成字符串 * * @param b * 字节数组 * @param encoding * 编码方式 * @return 如果encoding不支持,返回一个缺省编码的字符串 */ public static String getString(byte[] b, String encoding) { try { return new String(b, encoding); } catch (UnsupportedEncodingException e) { return new String(b); } } /** * 根据某种编码方式将字节数组转换成字符串 * * @param b * 字节数组 * @param offset * 要转换的起始位置 * @param len * 要转换的长度 * @param encoding * 编码方式 * @return 如果encoding不支持,返回一个缺省编码的字符串 */ public static String getString(byte[] b, int offset, int len, String encoding) { try { return new String(b, offset, len, encoding); } catch (UnsupportedEncodingException e) { return new String(b, offset, len); } } /** * @param ip * ip的字节数组形式 * @return 字符串形式的ip */ public static String getIpStringFromBytes(byte[] ip) { StringBuffer sb = new StringBuffer(); sb.append(ip[0] & 0xFF); sb.append('.'); sb.append(ip[1] & 0xFF); sb.append('.'); sb.append(ip[2] & 0xFF); sb.append('.'); sb.append(ip[3] & 0xFF); return sb.toString(); } } /** * 获取全部ip地址集合列表 * * @return */ public List<String> getAllIp() { List<String> list = new ArrayList<String>(); byte[] buf = new byte[4]; for (long i = ipBegin; i < ipEnd; i += IP_RECORD_LENGTH) { try { this.readIP(this.readLong3(i + 4), buf); // 读取ip,最终ip放到buf中 String ip = IPSeekerUtils.getIpStringFromBytes(buf); list.add(ip); } catch (Exception e) { // nothing } } return list; } }
[ "1228147995@qq.com" ]
1228147995@qq.com
bb26f91c3bdb5e478d63c7b7d27f5b126e830999
77ed8ef81c623adac9e8604b96a22d4267c81e82
/Repuestos Comun/src/comun/DTOs/ProveedorDTO.java
d1f79263aed736e5a155b2bb48522d449123e177
[]
no_license
Matias-Bernal/tagle-gardien
bc67ffa4082135b90cc51452eb7ea750d99cc5fe
6f259defda353db597b01faeb39aab84c0a3903a
refs/heads/master
2021-01-23T11:40:20.457990
2014-07-10T07:45:33
2014-07-10T07:45:33
32,119,758
0
0
null
null
null
null
UTF-8
Java
false
false
1,354
java
/******************************************************** This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. *********************************************************/ package comun.DTOs; import java.io.Serializable; public class ProveedorDTO implements Serializable{ protected static final long serialVersionUID = 1L; protected Long id; protected String nombre; public ProveedorDTO(){} public ProveedorDTO(Long id, String nombre) { super(); this.id = id; this.nombre = nombre; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } }
[ "payomaty666@gmail.com@7b2b483b-7b46-f909-ec13-8b39806d40dd" ]
payomaty666@gmail.com@7b2b483b-7b46-f909-ec13-8b39806d40dd
16892a2302bfc93b85081692ab10195edc16d39b
e79020cc4ac0c9ef0d9ec3dc9a98bb31c0866bcb
/POO/TestaCliente.java
1198c48c7f9a6341aa8360ed05889b46a1c0658d
[]
no_license
AntLucas/Generation
bee7360c5a9bc76927f608a640ed8042737b769f
a721ca856a2bed2152d9c68f3680782739633be3
refs/heads/main
2023-05-04T20:14:58.625694
2021-05-21T22:24:52
2021-05-21T22:24:52
363,952,393
0
1
null
null
null
null
ISO-8859-1
Java
false
false
1,850
java
package POO; import java.util.Scanner; public class TestaCliente { public static void main(String[] args) { Scanner ler = new Scanner(System.in); double valorGasto=0.0; int resp; System.out.println("Digite o nome do cliente: "); String nomeCli = ler.nextLine(); System.out.println(nomeCli); System.out.println("Quantas compras esse cliente já fez nessa loja? "); int numCompras = ler.nextInt(); while(numCompras < 0) { System.out.println("Valor incorreto!\nQuantas compras esse cliente já fez nessa loja? "); numCompras = ler.nextInt(); } if(numCompras != 0) { System.out.println("Qual o valor total gasto nessas compras?"); valorGasto = ler.nextDouble(); while(valorGasto <= 0) { System.out.println("Valor incorreto!\nQual o valor total gasto nessas compras?"); valorGasto = ler.nextDouble(); } } Cliente cliente1 = new Cliente(nomeCli, numCompras, valorGasto); do { System.out.println("O cliente deseja fazer alguma compra? Digite 1 para sim e 2 para " + "não"); resp = ler.nextInt(); while(resp != 1 && resp != 2) { System.out.println("Resposta incorreta!\nO cliente deseja fazer alguma compra? " + "Digite 1 para sim e 2 para não"); resp = ler.nextInt(); } if(resp == 1) { cliente1.comprou(); System.out.println("\nQual o valor dessa compra?"); valorGasto = ler.nextDouble(); while(valorGasto <= 0) { System.out.println("Valor incorreto!\nQual o valor total gasto nessas compras?"); valorGasto = ler.nextDouble(); } cliente1.valorCompra(valorGasto); } }while(resp != 2); System.out.println("\n\nO cliente "+cliente1.getNome()+" realizou "+cliente1.getNumCompras()+ " compras e gastou R$"+cliente1.getValorGasto()+" no total."); } }
[ "antonio.lucas278@outlook.com" ]
antonio.lucas278@outlook.com
9b82fed750fdcab68cabeca7e353b5832d6268e6
10a08e5e00a1a3a16b41db868b13a03da2ce34d2
/src/Q402_RemoveKdigits.java
850b9007f661fb4e4d8c6dde600b134fe968e657
[]
no_license
Xprsh/LeetCodeSolution
fa1e1f1faffced0b3b4dafe9348489be1364d84b
ceba460460f7ba71388d17547bb57ab7a6c28922
refs/heads/master
2023-01-08T18:32:05.824859
2020-10-27T02:03:18
2020-10-27T02:03:18
294,639,371
0
0
null
null
null
null
UTF-8
Java
false
false
1,563
java
import java.util.LinkedList; /** * Q402. 移掉 K 位数字 * <p> * 给定一个以字符串表示的非负整数 num,移除这个数中的 k 位数字,使得剩下的数字最小。 */ public class Q402_RemoveKdigits { public String removeKdigits(String num, int k) { if (num == null || k >= num.length()) { return "0"; } LinkedList<Character> list = new LinkedList<>(); for (Character c : num.toCharArray()) { // 第一个数字,直接存入 if (list.isEmpty()) { list.addLast(c); } else { while (list.size() > 0 && c < list.peekLast() && k > 0) { list.removeLast(); k--; } list.addLast(c); } } // 遍历完一轮后仍然没有移除足够位数,需要删除最后k位 for (int i = 0; i < k; i++) { list.removeLast(); } // 移除前面的 0 while (!list.isEmpty()) { if (list.peekFirst() == '0') { list.removeFirst(); } else { break; } } StringBuilder newStr = new StringBuilder(); for (Character c : list) { newStr.append(c); } return list.isEmpty() ? "0" : newStr.toString(); } public static void main(String[] args) { Q402_RemoveKdigits obj = new Q402_RemoveKdigits(); System.out.println(obj.removeKdigits("1234567890", 9)); } }
[ "zhuxprsh@sina.com" ]
zhuxprsh@sina.com
f829440845f9e396e1d831d95f4542320b405f02
5e7783f03bb29d4c7429cfee3497402ea02305e9
/src/proyectoso/Estante.java
644381967f16a41892321e9c7ccbc03b50c7271b
[]
no_license
Someguy300/ProyectoSO
4c19609d79688a08ef2483f4bb27918cc281b73d
4ddfc2dd1692cc64ba2e13fa3ab57034baef8768
refs/heads/master
2022-10-21T18:20:33.527132
2020-06-15T22:34:46
2020-06-15T22:34:46
269,408,340
0
0
null
null
null
null
UTF-8
Java
false
false
7,349
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package proyectoso; import static java.lang.Math.random; import java.util.concurrent.Semaphore; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author Jesus Barrios */ public class Estante { //Variables //ints para darle precio a los productos y cuantos productos //se va a agarrar int randomInt, randomCost; //numero de productos en el estante y su capacidad //en un comienzo tienen el mismo valor private int nroProd,cap; //su semaforo private Semaphore semS; //el cliente es null porque bueno...el cliente que accede al //estante cambia cada rato public Estante(int nroProd){ this.nroProd = nroProd; this.cap = nroProd; this.semS = new Semaphore(1); } /*Este deberia ser el get de productor consumidor, por ahora..o para el momento de la entrega este proceso raro el cual estoy seguro no aplica productor consumidor*/ /** * Metodo para obtener productos del estante * @param cliente thread que va a usar el estante * @throws InterruptedException */ void get(Cliente cliente) throws InterruptedException { /*El cliente puede(decidir)agarrar productos(el gafo igual puede decidir agarrar 0 productos), si no hay productos ve al "else" de este "if" para mas detalles*/ if(nroProd!=0){ //se le asigna al cliente el semaforo de este estante cliente.setSemE(semS); //Se le pide permiso al semaforo para acceder al estante cliente.getSemE().acquire(); // System.out.println("-----------------"); // System.out.println(cliente.getNro()+" dice: Estoy en el estante"); //el tiempo que usa el cliente para decidir que va a agarrar cliente.sleep(Control.minuto); //Un switch dependiendo del nro de productos que hay en el estante switch(nroProd){ //no voy a explicar los 2 casos, hacen lo mismo, //solo que el case 1 hace un random entra 0...vea el caso default case 1: randomInt = (int)(2 * Math.random()); cliente.setNroItems(cliente.getNroItems()+randomInt); //System.out.println(cliente.getNro()+" dice: agarre "+randomInt+" productos"); nroProd = nroProd - randomInt; if(randomInt!=0){ randomCost= 1 + ((int)(10 * Math.random())); cliente.setTotal(cliente.getTotal()+randomCost); } break; default: //Se escoge cuandos productos va a agarrar el cliente randomInt = (int)(3 * Math.random()); /*se modifica el nro de prod que el cliente tiene ahora que escribo esto lo del nro de prod que el cliente tiene es inutil...¿tiene algo que ver con el enunciado del proyecto?*/ cliente.setNroItems(cliente.getNroItems()+randomInt); //sout de verificacion //System.out.println(cliente.getNro()+" dice: agarre "+randomInt+" productos"); /*Aqui si es importante el randomInt porque se le resta al total de productos que le quedan al estante despues de que el cliente agarro*/ nroProd = nroProd - randomInt; //Si el cliente agarro productos aqui se le asigna el //precio a c/producto que agarro el cliente if(randomInt!=0){ for (int i = 0; i < randomInt; i++) { //Se inventa el precio randomCost= 1 + ((int)(10 * Math.random())); //Se suma al total que tiene que pagar el cliente //y por lo tanto lo que iria al contador global cliente.setTotal(cliente.getTotal()+randomCost); } } break; } //verificacion // System.out.println("-----------------"); // System.out.println("PRODUCTOS RESTANTES:"+nroProd); //el cliente deja ir el semaforo cliente.getSemE().release(); } else { //Si el estante esta vacio se entra en un loop infinito hasta //que el empleado rellene el estante,luego de eso se vuelve a llamar //a la funcion //System.out.println(cliente.getNro()+" dice: Estante vacio,esperare"); while(nroProd==0){} get(cliente); } } /*Este deberia ser el put de productor consumidor, por ahora..o para el momento de la entrega este proceso raro el cual estoy seguro no aplica productor consumidor*/ /** * Metodo para reponer productos del estante * @param empleado thread que va a usar el estante * @throws InterruptedException */ void put (Empleado empleado) throws InterruptedException { //Si el empleado no tiene semaforo asignado, se le asigna el semaforo //de su respectivo estante...me da miedo cambiar esto if(empleado.getSem()==null){ empleado.setSem(semS); } //si el numero de productos es lo suficientemente pequeño como //para el empleado vaya a buscar una caja se ejecuta esto if(nroProd<=(cap-3)){ //verificando que el thread empleado funcione //System.out.println("Empleado dice: Oh no el estante tiene que ser repuesto"); //buscando la caja... Thread.sleep(Control.minuto*4); //se pide permiso para usar el estante empleado.getSem().acquire(); //El minuto en el que se repone el estante+verificacion por cout //System.out.println("Empleado dice: reponiendo estante"); empleado.sleep(Control.minuto); //Se repone el estante //System.out.println("Empleado dice: Estante repuesto con 3 productos"); nroProd = nroProd + 3; //verificacion+se suelta el permiso para usar el semaforo //del estante...me sigo preguntando si eso esta bien dicho //System.out.println("PRODUCTOS RESTANTES: "+nroProd); empleado.getSem().release(); } } //getters y setters public int getNroProd() { return nroProd; } public void setNroProd(int nroProd) { this.nroProd = nroProd; } public Semaphore getSemS() { return semS; } public void setSemS(Semaphore semS) { this.semS = semS; } }
[ "Someguy300@users.noreply.github.com" ]
Someguy300@users.noreply.github.com
6e1a1de1f9c52a48747aabd9f76280eed11a50e1
d92b622ddb9fd3d8f0c6bf521cbe62d8f4b6645d
/app/src/main/java/com/project/android/finanzm/viewmodel/ConfigurationViewModel.java
f56d07087bbc1c924197344ae0712d497571115b
[]
no_license
romstarjohn/Mydigit
2049b92720006298836634ca25f6edaea33086fa
395778a026e835459f61c9b15985bd2aa6c0d459
refs/heads/master
2022-02-28T08:43:08.096758
2019-10-23T21:38:25
2019-10-23T21:38:25
205,209,715
0
0
null
null
null
null
UTF-8
Java
false
false
2,626
java
package com.project.android.finanzm.viewmodel; import android.app.Application; import android.arch.lifecycle.AndroidViewModel; import android.arch.lifecycle.LiveData; import android.support.annotation.NonNull; import com.project.android.finanzm.database.AppRepository; import com.project.android.finanzm.database.Product; import com.project.android.finanzm.services.StoreInitService; import com.project.android.finanzm.utility.Constants; import com.project.android.finanzm.utility.NetworkUtil; import com.project.android.finanzm.utility.StoreInitData; import java.util.List; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; import retrofit2.Retrofit; import retrofit2.converter.gson.GsonConverterFactory; public class ConfigurationViewModel extends AndroidViewModel { private StoreInitService storeInitService; private LiveData<List<Product>> allProducts; StoreInitData storeInitData; private AppRepository mRepository; public ConfigurationViewModel(@NonNull Application application) { super(application); mRepository = AppRepository.getInstance(getApplication().getApplicationContext()); initAnonService(); } public LiveData<List<Product>> getAllProductsForCategories(int id){ if(id == 0){ return mRepository.getAllProducts(); } return mRepository.getProductByCategories(id); } // Configure Retrofit Instance public void initAnonService(){ Retrofit retrofit = new Retrofit.Builder().baseUrl(Constants.URL_SERVER) .addConverterFactory(GsonConverterFactory.create()) .build(); storeInitService = retrofit.create(StoreInitService.class); } public void startStoreInit(){ storeInitService.getAllStoresData().enqueue(new Callback<StoreInitData>() { @Override public void onResponse(Call<StoreInitData> call, Response<StoreInitData> response) { if (!response.isSuccessful()){ showError(NetworkUtil.onServerResponseError(response)); return; } if(response.body() != null){ if(storeInitData == null) storeInitData = new StoreInitData(); storeInitData = response.body(); } } @Override public void onFailure(Call<StoreInitData> call, Throwable t) { showError(t.getLocalizedMessage()); } }); } private void showError(String message) { } }
[ "romstarjohn@yahoo.fr" ]
romstarjohn@yahoo.fr
1752d4c4c5c913ae101e6900f5d91d1c9f688e24
740a27a38e91510f06069a204c612fd9ee26a55d
/src/main/java/algorithms/easy/E053_MaximumSubarray.java
fb9be51aa16ba736c3bbd19e646d27d8a211addc
[]
no_license
renguangqian1993/leetcode
88e4887fed8f7afc89bee3f72abcc6608b2a9422
d6a76f04f2b68cd51087723a06beea6e5b256c6d
refs/heads/master
2021-08-03T16:04:49.613965
2021-07-25T12:25:36
2021-07-25T12:25:36
168,274,106
0
0
null
2020-10-18T06:46:50
2019-01-30T03:39:13
Java
UTF-8
Java
false
false
3,139
java
package algorithms.easy; /** * Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. * * Example: * * Input: [-2,1,-3,4,-1,2,1,-5,4], * Output: 6 * Explanation: [4,-1,2,1] has the largest sum = 6. * * 来源:力扣(LeetCode) * 链接:https://leetcode-cn.com/problems/maximum-subarray * 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。 */ public class E053_MaximumSubarray { //TODO 动态规划,分治法 public int maxSubArray(int[] nums) { int ans = nums[0]; int sum = 0; for(int num: nums) { if(sum > 0) { sum += num; } else { sum = num; } ans = Math.max(ans, sum); } return ans; } /** * TODO 分治法 * 这种分治法有个问题,时间复杂度为O(n*log(n)) * 分治需要划分到一个组中只有一个节点,然后往上走,每次分组都要扫描组内每个节点 */ public int maxSubArray2(int[] nums) { int len = nums.length; if (len == 0) { return 0; } return maxSubArraySum(nums, 0, len - 1); } private int maxSubArraySum(int[] nums, int left, int right) { if (left == right) { return nums[left]; } int mid = (left + right) >>> 1; return Math.max( Math.max(maxSubArraySum(nums, left, mid), maxSubArraySum(nums, mid + 1, right)), maxCrossingSum(nums, left, mid, right)); } private int maxCrossingSum(int[] nums, int left, int mid, int right) { // 一定会包含 nums[mid] 这个元素 int sum = 0; int leftSum = Integer.MIN_VALUE; // 左半边包含 nums[mid] 元素,最多可以到什么地方 // 走到最边界,看看最值是什么 // 计算以 mid 结尾的最大的子数组的和 for (int i = mid; i >= left; i--) { sum += nums[i]; if (sum > leftSum) { leftSum = sum; } } sum = 0; int rightSum = Integer.MIN_VALUE; // 右半边不包含 nums[mid] 元素,最多可以到什么地方 // 计算以 mid+1 开始的最大的子数组的和 for (int i = mid + 1; i <= right; i++) { sum += nums[i]; if (sum > rightSum) { rightSum = sum; } } return leftSum + rightSum; } /** * 动态规划 * 执行用时 :2 ms, 在所有 Java 提交中击败了90.86%的用户 * 内存消耗 :38.9 MB, 在所有 Java 提交中击败了80.30%的用户 */ public int maxSubArray3(int[] nums) { int maxSum = Integer.MIN_VALUE; int tmpSum = 0; for (int num : nums) { if (tmpSum > 0) { tmpSum += num; } else { tmpSum = num; } maxSum = Math.max(maxSum, tmpSum); } return maxSum; } }
[ "13620613948@163.com" ]
13620613948@163.com
20906810d8a0b43fe92b37801defef0a38e5562a
bad527160d931e9a4421d9d985b15dfb82966f0b
/src/main/java/com/fps/mpits/modules/auth/eo/McasUserAppStatusEntityId.java
0f9ea435a6345872e15e6bd86325d25945d81d4c
[]
no_license
hieuboyfc/mpits_sync_data
ae37aa7750ae94ac4db3c5372df0a1360c5a8c68
86dc97889edefbabdbf0ca537ec7afa9aa703ca4
refs/heads/master
2023-01-13T09:52:16.537299
2020-11-12T05:37:56
2020-11-12T05:37:56
268,700,781
0
0
null
null
null
null
UTF-8
Java
false
false
850
java
package com.fps.mpits.modules.auth.eo; import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import lombok.experimental.Accessors; import javax.persistence.Embeddable; import java.io.Serializable; /** * @author HieuDT28 - (Hiếu Boy) * created 19/05/2020 - 17:30 * @see <a href="https://www.objectdb.com/java/jpa/entity/id"></a> */ @Accessors(fluent = true) @NoArgsConstructor @AllArgsConstructor @Data @JsonAutoDetect(fieldVisibility = Visibility.ANY) @Embeddable public class McasUserAppStatusEntityId implements Serializable { private static final long serialVersionUID = 1L; // Mã ứng dụng private String appCode; // Username private String username; }
[ "hieuboyfc@gmail.com" ]
hieuboyfc@gmail.com
70daaefad230415bde9e9f468ca35f1e5cb4db35
1421832092d6d5c380782bcde2510adf32bd87d7
/src/CollectionExample/CollectionTask14.java
2390c07a30dc5988e1bae552a7f35ebb848cc85e
[]
no_license
Victoria-Tkachova/Java-lessons
358509ed9e9a3acc6518914e587229a016774933
b0c20b6c7bf8fc3aa07918bdce5ad0b87d94821a
refs/heads/master
2020-09-08T14:25:03.666639
2020-01-27T15:22:23
2020-01-27T15:22:23
221,158,418
0
0
null
null
null
null
UTF-8
Java
false
false
5,245
java
package CollectionExample; import java.time.LocalDate; import java.util.*; class Transport { int price; int horses; List<LocalDate> list=new ArrayList<>(); void comparePriceHorses() { System.out.println("За " + price + " $ США Вы получите " + horses + " лошадиных сил."); } double length; double weight; double high; Transport(Transport ob) { length = ob.length; weight = ob.weight; high = ob.high; for (LocalDate temp:ob.list ) { this.list.add(temp); } } Transport(double length, double w, double h) { this.length = length; weight = w; high = h; parameters(); Iterator<Integer> qwe= new Iterator<Integer>() { @Override public boolean hasNext() { return false; } @Override public Integer next() { return null; } }; } Transport() { System.out.println("Это конструктор по умолчанию"); } void parameters() { System.out.println("Параментры транспорта: длинна - " + length + "; высота - " + high + "; вес - " + weight); } public static void main(String[] args) { Auto myAuto1 = new Auto(10, 20, 2.5, 4); Ship myShip1 = new Ship (35, 12, 2.7, 35); // конструкторы вызываются в порядке наследования; если метод super не вызывается, то используется конструктор по умолчанию Airplane myAirplane1 = new Airplane (57, 45, 5.6, 300); myAirplane1.parameters(); Transport myTransport1 = new Transport(); myTransport1 = myAuto1; // но у этого объекта нет доступа к полю doors, так как он не определён в суперклассе myTransport1.parameters(); Car myCar1 = new Car (5, 2, 1.5, 5, "Beetle"); Transport trans; trans = myAuto1; trans.parameters(); trans = myShip1; trans.parameters(); Set <String> newSet= new HashSet<>(); Collections.addAll(newSet,"sw","qwqwq","sdsd","sw"); System.out.println(newSet); String str=new String("sw"); String qwe="sw"; String asd="sw"; newSet.add(str); System.out.println(newSet); } } class Auto extends Transport { double doors; Auto (double l, double w, double h, double d) { super (l,w,h); // при вызове должен быть в первом операторе в конструкторе подкласса doors = d; System.out.println("Это параметры автомобиля: длинна - " + l + " высота - " + h + " вес - " + w + " количество дверей - " +d); } Auto () { System.out.println("Конструктор по молчанию для автотранспорта"); // от этого подкласса нельзя наследовать пока нет конструктора по умолчанию } void parameters() { System.out.println("Параментры автомобильного транспорта: длинна - " + length + "; высота - " + high + "; вес - " + weight); } } class Ship extends Transport { int speed; Ship (double l, double w, double h, int s) { length = l; weight = w; high = h; speed = s; System.out.println("Это параментры судна: длинна - " + l + " высота - " + h + " вес - " + w + " скорость - " + s); } void parameters() { System.out.println("Параментры водного транспорта: длинна - " + length + "; высота - " + high + "; вес - " + weight); } } class Airplane extends Transport { int passengers; Airplane (double l, double w, double h, int p) { length = l; weight = w; high = h; passengers = p; System.out.println("Это параментры самолёта: длинна - " + l + " высота - " + h + " вес - " + w + " количество пассажиров - " + p); } void parameters() { System.out.println("Параментры воздушного транспорта: длинна - " + length + "; высота - " + high + "; вес - " + weight); } } class Car extends Auto { String model; Car (double l, double w, double h, double d, String m) { super (l,w,h,d); model = m; System.out.println("Это параметры автомобиля: длинна - " + l + " высота - " + h + " вес - " + w + " количество дверей - " +d + "\nа для легкового автомобиля ещё и модель - " + m); } }
[ "graceful2193@gmail.com" ]
graceful2193@gmail.com
01508f1d6b2c800840df7bed612443f0b4553ada
26df6dd75086e0d6f8890c51613ae4538e231e0f
/mylibrary/src/androidTest/java/com/attiqrao/systemsltd/tree/ApplicationTest.java
a24fa5116dfc69dfd9ed0d74da97315b1958c07e
[]
no_license
attiqrehman1991/TreeviewForSystem
7995fbc092fdb6c74eb4eb1108510b4d6283470d
db4b876b3c6af0714348e26410e4392e073a0bac
refs/heads/master
2016-08-12T02:57:58.642630
2016-04-07T06:37:49
2016-04-07T06:37:49
55,664,899
2
1
null
null
null
null
UTF-8
Java
false
false
359
java
package com.attiqrao.systemsltd.tree; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
[ "attiq.ur.rehman1991@gmailcom" ]
attiq.ur.rehman1991@gmailcom
4eb23ee552cb455f7ad40b2feb667934fbc49b3a
e457d389727a51a0055c3ec04d0705e49cd292bb
/app/src/main/java/com/example/user/mvvmdemo/network/LiveDataCallAdapterFactory.java
70b133a2b13adbb5e271a77fea4ab96f3b56d46e
[]
no_license
AsadLeo14/MVVM-Demo
6d5ca5fb77d149dd14f1fb848b8402cac9e277a8
20566b475184d444f2016fe6c60d6d25782fa278
refs/heads/master
2020-03-25T18:58:24.562110
2018-08-10T19:23:25
2018-08-10T19:23:25
144,058,590
6
1
null
null
null
null
UTF-8
Java
false
false
1,127
java
package com.example.user.mvvmdemo.network; import android.arch.lifecycle.LiveData; import java.lang.annotation.Annotation; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import retrofit2.CallAdapter; import retrofit2.Retrofit; public class LiveDataCallAdapterFactory extends CallAdapter.Factory { @Override public CallAdapter<?, ?> get(Type returnType, Annotation[] annotations, Retrofit retrofit) { if (getRawType(returnType) != LiveData.class) { return null; } Type observableType = getParameterUpperBound(0, (ParameterizedType) returnType); Class<?> rawObservableType = getRawType(observableType); if (rawObservableType != ApiResponse.class) { throw new IllegalArgumentException("type must be a resource"); } if (! (observableType instanceof ParameterizedType)) { throw new IllegalArgumentException("resource must be parameterized"); } Type bodyType = getParameterUpperBound(0, (ParameterizedType) observableType); return new LiveDataCallAdapter<>(bodyType); } }
[ "asadleo1995@gmail.com" ]
asadleo1995@gmail.com
733a205b3c0e7e8040f391476f72e0ae3fe5c7f2
23325394ddc79dfaa50e78673858951007c293ae
/src/main/java/es/animal/protection/animalshelter/configuration/WebFluxConfiguration.java
01f31fb8e3ac9e95b309144042ece99e4bfb58ad
[]
no_license
vivicast/animal-shelter-spring
aaf09ded8c398595839d9e0e579cffb239ba2685
30293413851d3ac405f39e34b9ad52da39e73bca
refs/heads/master
2023-05-05T07:57:55.645213
2021-05-18T23:12:21
2021-05-18T23:12:21
363,427,725
0
0
null
null
null
null
UTF-8
Java
false
false
643
java
package es.animal.protection.animalshelter.configuration; import org.springframework.context.annotation.Configuration; import org.springframework.web.reactive.config.CorsRegistry; import org.springframework.web.reactive.config.EnableWebFlux; import org.springframework.web.reactive.config.WebFluxConfigurer; @Configuration @EnableWebFlux public class WebFluxConfiguration implements WebFluxConfigurer { @Override public void addCorsMappings(CorsRegistry registry) { registry .addMapping("/**") .allowedMethods("*") .allowedOrigins("*") .maxAge(3600); } }
[ "danieljesus.rosado@alumnos.upm.es" ]
danieljesus.rosado@alumnos.upm.es