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
11237ecc243592f1de482b6dd8f8a558b642e168
d6a5da3794ef8a79b2cc8e58caf7a9915ef741b4
/src/main/java/agents/org/apache/commons/lang/text/StrLookup.java
fff9e37be6b4e0bfdd4f316e31e547a7e2778c6e
[]
no_license
Shaobo-Xu/ANAC2019
67d70b52217a28129a6c1ccd3d23858e81c64240
6f47514a4b8ee5bc81640692030c6ed976804500
refs/heads/master
2020-05-16T22:26:14.655595
2019-07-28T15:29:49
2019-07-28T15:29:49
183,329,259
2
0
null
null
null
null
UTF-8
Java
false
false
5,758
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package agents.org.apache.commons.lang.text; import java.util.Map; /** * Lookup a String key to a String value. * <p> * This class represents the simplest form of a string to string map. * It has a benefit over a map in that it can create the result on * demand based on the key. * <p> * This class comes complete with various factory methods. * If these do not suffice, you can subclass and implement your own matcher. * <p> * For example, it would be possible to implement a lookup that used the * key as a primary key, and looked up the value on demand from the database * * @author Apache Software Foundation * @since 2.2 * @version $Id: StrLookup.java 905636 2010-02-02 14:03:32Z niallp $ */ public abstract class StrLookup { /** * Lookup that always returns null. */ private static final StrLookup NONE_LOOKUP; /** * Lookup that uses System properties. */ private static final StrLookup SYSTEM_PROPERTIES_LOOKUP; static { NONE_LOOKUP = new MapStrLookup(null); StrLookup lookup = null; try { lookup = new MapStrLookup(System.getProperties()); } catch (SecurityException ex) { lookup = NONE_LOOKUP; } SYSTEM_PROPERTIES_LOOKUP = lookup; } //----------------------------------------------------------------------- /** * Returns a lookup which always returns null. * * @return a lookup that always returns null, not null */ public static StrLookup noneLookup() { return NONE_LOOKUP; } /** * Returns a lookup which uses {@link System#getProperties() System properties} * to lookup the key to value. * <p> * If a security manager blocked access to system properties, then null will * be returned from every lookup. * <p> * If a null key is used, this lookup will throw a NullPointerException. * * @return a lookup using system properties, not null */ public static StrLookup systemPropertiesLookup() { return SYSTEM_PROPERTIES_LOOKUP; } /** * Returns a lookup which looks up values using a map. * <p> * If the map is null, then null will be returned from every lookup. * The map result object is converted to a string using toString(). * * @param map the map of keys to values, may be null * @return a lookup using the map, not null */ public static StrLookup mapLookup(Map map) { return new MapStrLookup(map); } //----------------------------------------------------------------------- /** * Constructor. */ protected StrLookup() { super(); } /** * Looks up a String key to a String value. * <p> * The internal implementation may use any mechanism to return the value. * The simplest implementation is to use a Map. However, virtually any * implementation is possible. * <p> * For example, it would be possible to implement a lookup that used the * key as a primary key, and looked up the value on demand from the database * Or, a numeric based implementation could be created that treats the key * as an integer, increments the value and return the result as a string - * converting 1 to 2, 15 to 16 etc. * <p> * The {@link #lookup(String)} method always returns a String, regardless of * the underlying data, by converting it as necessary. For example: * <pre> * Map map = new HashMap(); * map.put("number", new Integer(2)); * assertEquals("2", StrLookup.mapLookup(map).lookup("number")); * </pre> * @param key the key to be looked up, may be null * @return the matching value, null if no match */ public abstract String lookup(String key); //----------------------------------------------------------------------- /** * Lookup implementation that uses a Map. */ static class MapStrLookup extends StrLookup { /** Map keys are variable names and value. */ private final Map map; /** * Creates a new instance backed by a Map. * * @param map the map of keys to values, may be null */ MapStrLookup(Map map) { this.map = map; } /** * Looks up a String key to a String value using the map. * <p> * If the map is null, then null is returned. * The map result object is converted to a string using toString(). * * @param key the key to be looked up, may be null * @return the matching value, null if no match */ public String lookup(String key) { if (map == null) { return null; } Object obj = map.get(key); if (obj == null) { return null; } return obj.toString(); } } }
[ "601115401@qq.com" ]
601115401@qq.com
4b5079c12a342d9940d17b0377a1c8879a3123e8
6baf1fe00541560788e78de5244ae17a7a2b375a
/hollywood/com.oculus.browser-base/sources/defpackage/FG1.java
0129c299ae26b6e135871ea21420494a3aaeaf09
[]
no_license
phwd/quest-tracker
286e605644fc05f00f4904e51f73d77444a78003
3d46fbb467ba11bee5827f7cae7dfeabeb1fd2ba
refs/heads/main
2023-03-29T20:33:10.959529
2021-04-10T22:14:11
2021-04-10T22:14:11
357,185,040
4
2
null
2021-04-12T12:28:09
2021-04-12T12:28:08
null
UTF-8
Java
false
false
1,091
java
package defpackage; import android.os.IBinder; import android.os.IInterface; import android.os.Parcel; /* renamed from: FG1 reason: default package */ /* compiled from: chromium-OculusBrowser.apk-stable-281887347 */ public final class FG1 implements AbstractC2328eG1, IInterface { /* renamed from: a reason: collision with root package name */ public final IBinder f8006a; public final String b = "com.google.android.auth.IAuthManagerService"; public FG1(IBinder iBinder) { this.f8006a = iBinder; } public IBinder asBinder() { return this.f8006a; } public final Parcel c() { Parcel obtain = Parcel.obtain(); obtain.writeInterfaceToken(this.b); return obtain; } public final Parcel d(int i, Parcel parcel) { parcel = Parcel.obtain(); try { this.f8006a.transact(i, parcel, parcel, 0); parcel.readException(); return parcel; } catch (RuntimeException e) { throw e; } finally { parcel.recycle(); } } }
[ "cyuubiapps@gmail.com" ]
cyuubiapps@gmail.com
069b93c355f833f127fc136436f63b2478b6125f
bf6e4f1e721d44085c9e4de12ad9de627b6485ce
/algorithm/src/main/java/org/songdan/tij/algorithm/sort/InsertSort.java
c30451af41c8123d6a156b6bfa57dc3e531b491c
[]
no_license
sd1990/TIJ
17f5745246c7d2c9b7d491df0a37d3af1291a0a1
44fa4127fb2a35b1dfbface7e8f45173b45df796
refs/heads/master
2022-11-24T18:10:38.531956
2022-09-10T10:55:29
2022-09-10T10:55:29
58,509,568
3
1
null
2022-11-16T08:50:56
2016-05-11T02:56:08
Java
UTF-8
Java
false
false
649
java
package org.songdan.tij.algorithm.sort; /** * @author: Songdan * @create: 2019-03-10 20:27 **/ public class InsertSort { private int[] arr; public void sort() { int length = arr.length; for (int i = 1; i < length; i++) { //在前面的数组中查找要插入的位置 int value = arr[i]; int k = i-1; for (; k >= 0; k--) { if (arr[k] > value) { //向后移动 arr[k + 1] = arr[k]; } else { break; } } arr[k] = value; } } }
[ "songdan_obj@126.com" ]
songdan_obj@126.com
7c5fe0c9ea443b9471db5e453695323bae51e682
b60da22bc192211b3978764e63af23e2e24081f5
/cdc/test/share/gunit/classes/gunit/lister/BaseTestLister.java
d0c540c84028fbf9cc935a1f3cfa43d282970016
[]
no_license
clamp03/JavaAOTC
44d566927c057c013538ab51e086c42c6348554e
0ade633837ed9698cd74a3f6928ebde3d96bd3e3
refs/heads/master
2021-01-01T19:33:51.612033
2014-12-02T14:29:58
2014-12-02T14:29:58
27,435,591
5
4
null
null
null
null
UTF-8
Java
false
false
4,853
java
/* * @(#)BaseTestLister.java 1.5 06/10/10 * * Copyright 1990-2006 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License version * 2 only, as published by the Free Software Foundation. * * 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 version 2 for more details (a copy is * included at /legal/license.txt). * * You should have received a copy of the GNU General Public License * version 2 along with this work; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA * * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa * Clara, CA 95054 or visit www.sun.com if you need additional * information or have any questions. */ package gunit.lister ; import java.util.* ; import java.io.* ; import java.lang.reflect.* ; import junit.framework.Test ; import junit.framework.TestCase ; import junit.framework.TestSuite ; import junit.textui.TestRunner ; import gunit.framework.TestFactory ; /** * <code>BaseTestLister</code> is a base class for listing testcases */ public abstract class BaseTestLister { List testcases ; protected PrintStream out ; protected BaseTestLister() { this.testcases = new ArrayList() ; setStream(System.out) ; } protected final void addTestcases(Test test) { if ( test instanceof TestSuite ) { addTestcases((TestSuite)test) ; } else if ( test instanceof TestCase ) { addTestcase((TestCase)test); } else { addTestcases(test.getClass()) ; } } protected final void setStream(PrintStream stream) { this.out = stream ; } void addTestcases(TestSuite suite) { Enumeration e = suite.tests() ; while ( e.hasMoreElements() ) { Test t = (Test) e.nextElement() ; addTestcases(t) ; } } void addTestcase(TestCase testcase) { try { Method method = testcase.getClass().getMethod(testcase.getName(), null) ; if ( isPublicTestMethod(method)) { this.testcases.add(method) ; } } catch ( Exception ex ) { } } void addTestcases(Class cls) { try { Method[] methods = cls.getMethods() ; for ( int i = 0 ; i < methods.length ; i ++ ) { if ( isPublicTestMethod(methods[i])) { this.testcases.add(methods[i]) ; } } } catch (Exception ex) { } } private boolean isPublicTestMethod(Method m) { return isTestMethod(m) && Modifier.isPublic(m.getModifiers()); } private boolean isTestMethod(Method m) { String name= m.getName(); Class[] parameters= m.getParameterTypes(); Class returnType= m.getReturnType(); return parameters.length == 0 && name.startsWith("test") && returnType.equals(Void.TYPE); } /** * List the testcase methods contained within the lister */ public void list() { Iterator iter = this.testcases.iterator() ; while ( iter.hasNext() ) { listTestCase((Method)iter.next()); } } // --tb | --testbundle <filename> protected void usage() { System.err.println("Usage : java "+ getClass().getName() + " --tb <filename>|<testcaseclass>") ; } /** * Start the lister to list tests specified in args */ protected void start(String args[]) { if ( args.length == 0) { usage() ; return ; } String test_bundle = null ; if ( "--tb".equals(args[0]) || "--testbundle".equals(args[0]) ) { if ( args.length > 1 ) { test_bundle = args[1] ; } else { usage() ; return ; } } Test test = null ; if ( test_bundle != null ) { test = TestFactory.createTest(test_bundle) ; } else { TestRunner runner = new TestRunner() ; test = runner.getTest(args[0]) ; } addTestcases(test) ; list() ; } /** * List the testcase method specified */ public abstract void listTestCase(Method method) ; }
[ "clamp03@gmail.com" ]
clamp03@gmail.com
6ba5fc131aaec75ac99bf6af9b41cb706289b7fc
759875368cd9f444120df0ac415e1d9bed8d27fd
/src/edu/uncc/ad/problems/array/PlusOne.java
e884dc8842e54f672e08e198d30cb034aec06a84
[]
no_license
Vinay0809/Algorithms-Datastructure-in-Java
acfef757ce4f307dea03b923f71620b7e937beda
275384786f1f39e1e9dfb854e9a91399f73c5d96
refs/heads/master
2021-01-02T03:44:03.884071
2019-04-26T19:59:28
2019-04-26T19:59:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,885
java
package edu.uncc.ad.problems.array; /** * Given a non-empty array of digits representing a non-negative integer, plus one to the integer. * * The digits are stored such that the most significant digit is at the head of the list, and each element in the array contain a single digit. * * You may assume the integer does not contain any leading zero, except the number 0 itself. * * Example 1: * * Input: [1,2,3] * Output: [1,2,4] * Explanation: The array represents the integer 123. * Example 2: * * Input: [4,3,2,1] * Output: [4,3,2,2] * Explanation: The array represents the integer 4321. */ import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class PlusOne { public static void main(String[] args) { int[] digits = {9,9,9}; for ( int i: addOne (digits)){ System.out.println (i); } } public static int[] plusOne(int[] digits) { // convert array to array list List<Integer> digitsList = new ArrayList<> (); for ( int i:digits ) digitsList.add (i); int length = digitsList.size (); //add 1 to last digit and find the carry forward digitsList.set (length-1,digitsList.get (length-1) + 1); int carry = digitsList.get (length-1) / 10; // setting the unit digit digitsList.set (length-1, digitsList.get (length-1) % 10); // looping the list from second last end to add the carry for ( int i = length-2; i >=0; i-- ){ if(carry == 1) { digitsList.set (i, digitsList.get (i) + carry); // adding carry to next digit. carry = digitsList.get (i) / 10; // update the carry with respect to next digit. digitsList.set (i, digitsList.get (i) % 10); // set the unit digit. } } // if there a carry forward after looping all element add that to first position if(carry == 1) digitsList.add (0, carry); // convert arrayList to array digits = new int[digitsList.size ()]; for(int i=0; i< digitsList.size (); i++) digits[i] = digitsList.get (i); return digits; } public static int[] addOne(int[] digits){ // add 1 to last digit. int len = digits.length; digits[len-1] += 1; int carry = 0; // loop from end of the array for ( int i = len-1; i>=0; i-- ){ digits[i] += carry; if(digits[i] >= 10){ carry = 1; digits[i] = digits[i] % 10; } else{ carry = 0; } } if(carry == 1){ int[] temp = new int[len+1]; System.arraycopy (digits,0,temp,1,len); temp[0] = carry; return temp; } else { return digits; } } }
[ "vshantha@uncc.edu" ]
vshantha@uncc.edu
fae6174fcd0c052d887b650140d05b379433ff48
ce7f55f18999ca539f93a1584c5c3862eac04fef
/src/lesson_1/task_3.java
c692f86875b6837387a3e9419878565ccb5e7e33
[]
no_license
hardex/oop
980728a094fdda3c70b413e816b30a50caf55b76
55e5e66f79111b6249513f3666da458b4c43af23
refs/heads/master
2020-06-05T02:14:32.709237
2015-05-19T20:23:35
2015-05-19T20:23:35
33,080,507
0
0
null
null
null
null
UTF-8
Java
false
false
817
java
package lesson_1; /** * Created by odogryk on 28.03.2015. * Написать класс «автомобиль», который должен уметь заводится, глушить мотор, ехать и держать необходимую скорость. */ public class task_3 { public static void main(String[] args) { car c = new car(); c.moving(60); System.out.println("машина едет = " + c.isMoving() + " со скоростью - " + c.getSpeed()); c.start(); System.out.println("машина едет = " + c.isMoving() + " со скоростью - " + c.getSpeed()); c.moving(34); System.out.println("машина едет = "+c.isMoving()+" со скоростью - "+c.getSpeed()); } }
[ "hard_alex@ukr.net" ]
hard_alex@ukr.net
5731eda19dfae475e90218fa2460bd93a2378208
2391262caaa54f91b9ab0ff48682863f6f2af2f5
/a2i contacts/src/main/java/com/example/a2icontacts/dao/ContactsAccessor.java
5eb8cf6f45fe7b5ec9c53b8b2407e66ea88ce39b
[ "Apache-2.0" ]
permissive
iftekhar-ahmed/A2I-Contacts
cbbfb2ad7b511bd9624a214cbca02f47f73249d1
035ef37be168e06b0f3134d97724ebe694d97f98
refs/heads/master
2021-01-22T07:27:41.216972
2014-04-30T14:51:27
2014-04-30T14:51:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,268
java
package com.example.a2icontacts.dao; import com.example.a2icontacts.model.raw.A2IContact; import com.example.a2icontacts.model.raw.A2ITeam; import java.util.ArrayList; import java.util.List; /** * Created by mukla on 4/24/14. */ public final class ContactsAccessor { static List<A2IContact> a2iContacts = new ArrayList<A2IContact>(); static List<A2ITeam>a2ITeams=new ArrayList<A2ITeam>(); static { a2iContacts.add(new A2IContact("+8801911320311","Anir Chowdhury","anirchowdhury@pmo.gov.bd")); a2iContacts.add(new A2IContact("+8801921694123","Md. Mazedul Islam","islam.mazedul@gmail.com")); a2iContacts.add(new A2IContact("+8801713244359","Hasanuzzaman","zaman.h1984@gmail.com")); a2iContacts.add(new A2IContact("+8801715578194","Sohana Samrin Chowdhury","sohanasamrin@a2i.pmo.gov.bd")); a2iContacts.add(new A2IContact("+8801729298989","Asad Ur Rahman Nile","asadrahman@a2i.pmo.gov.bd")); a2iContacts.add(new A2IContact("+8801913760134","Sami Ahmed","sami.ahmed@a2i.pmo.gov.bd")); a2iContacts.add(new A2IContact("+8801741039412","Rezwanul Islam","rezwan@gmail.com")); a2iContacts.add(new A2IContact("+8801712236211","Mohammed Naser Miah","naser@pmo.gov.bd")); a2iContacts.add(new A2IContact("+8801716422362","Md. Habibullah","mdhabibullah97@yahoo.com")); a2iContacts.add(new A2IContact("+8801726297993","Mahfuza Haque","mahfuzahaque@a2i.pmo.gov.bd")); a2iContacts.add(new A2IContact("+8801819804689","Md. Ullah Rabbi","ullah.rabbi@undp.org")); a2iContacts.add(new A2IContact("+8801711074083","Shohel Aman Chowdhhury","shohelaman@gmail.com")); a2ITeams.add(new A2ITeam("Policy")); a2ITeams.add(new A2ITeam("Innovation")); a2ITeams.add(new A2ITeam("Operation")); a2ITeams.add(new A2ITeam("Capacity Development")); a2ITeams.add(new A2ITeam("Communication & Partnership")); a2ITeams.add(new A2ITeam("E-Service Implementation")); a2ITeams.add(new A2ITeam("Ness Development")); a2ITeams.add(new A2ITeam("E-Office")); } public static List<A2ITeam> getA2ITeams() { return a2ITeams; } public static List<A2IContact> geta2iContacts() { return a2iContacts; } }
[ "bit0220iftekhar@hotmail.com" ]
bit0220iftekhar@hotmail.com
13442a50c8862388a6332c14f2192003718edc78
809b0558865e718785b84946b62a633edfa5bc3b
/src/zad1/Service.java
2e90855f484cbf34e641f54094889f4efc6248fa
[]
no_license
s18714/Network_services_clients
1535ec4a67fcfab978dd34be9968fea193c5f418
40456d849cbdde4da351f9fcd78fd4e4dab9f527
refs/heads/main
2023-03-27T03:00:44.567036
2021-03-21T13:21:02
2021-03-21T13:21:02
350,002,489
0
0
null
null
null
null
UTF-8
Java
false
false
4,849
java
/** * @author Kryzhanivskyi Denys S18714 */ package zad1; import org.codehaus.jackson.map.ObjectMapper; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.URL; import java.nio.charset.StandardCharsets; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Service { private String countryCurrency; private String countryCode; public Service(String country) { Locale.setDefault(Locale.ENGLISH); Map<String, String> map = new HashMap<>(); for (Locale locale : Locale.getAvailableLocales()) { try { if(locale.getDisplayCountry().equals(country)) countryCode = locale.getCountry().toLowerCase(); Currency currency = Currency.getInstance(locale); map.putIfAbsent(locale.getDisplayCountry(), currency.getCurrencyCode()); } catch (IllegalArgumentException ignored) { } } this.countryCurrency = map.get(country); } public String getWeather(String city) { String url = "https://api.openweathermap.org/data/2.5/weather?q=" + city + "," + countryCode + "&appid=5a4db7d723273927d687ef784a6d55dc"; return readJsonFromUrl(url); } public Double getRateFor(String currency) { String url = "https://api.exchangeratesapi.io/latest?base=" + currency + "&symbols=" + countryCurrency; String json = readJsonFromUrl(url); Matcher matcher = Pattern.compile("\\d+\\.\\d+").matcher(json); if (matcher.find()) return Double.parseDouble(matcher.group(0)); return null; } public Double getNBPRate() { Double rate = countryCurrency.equals("PLN") ? 1.0 : null; if (rate != null) return rate; try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document document1 = builder.parse(new URL("http://www.nbp.pl/kursy/xml/a062z200330.xml").openStream()); Document document2 = builder.parse(new URL("http://www.nbp.pl/kursy/xml/b012z200325.xml").openStream()); NodeList nodeList1 = document1.getDocumentElement().getChildNodes(); NodeList nodeList2 = document2.getDocumentElement().getChildNodes(); NodeList[] lists = {nodeList1, nodeList2}; for (NodeList list : lists) { for (int i = 0; i < list.getLength(); i++) { if (list.item(i) instanceof Element && ((Element) list.item(i)).getTagName().equals("pozycja")) { Element element = (Element) list.item(i); if (element.getElementsByTagName("kod_waluty").item(0).getTextContent().equals(countryCurrency)) rate = new Double(element.getElementsByTagName("kurs_sredni").item(0) .getTextContent().replace(",", ".")); } } } } catch (ParserConfigurationException | SAXException | IOException e) { e.printStackTrace(); } return rate; } public Map<String, List<String>> getReadableWeather(String city) { Map<String, List<String>> finalMap = null; try { finalMap = new LinkedHashMap<>(); ObjectMapper mapper = new ObjectMapper(); Map<String, Object> map = mapper.readValue(getWeather(city), Map.class); for (Map.Entry<String, Object> m : map.entrySet()) { map.replace(m.getKey(), map.get(m.getKey()).toString().replaceAll("[{\\[}\\]]", " ")); String[] parts = map.get(m.getKey()).toString().split(","); List<String> list = new LinkedList<>(Arrays.asList(parts)); finalMap.put(m.getKey(), list); } } catch (IOException e) { e.printStackTrace(); } return finalMap; } private String readJsonFromUrl(String urlString) { StringBuilder sb = new StringBuilder(); try { URL url = new URL(urlString); BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream(), StandardCharsets.UTF_8)); String line; while ((line = reader.readLine()) != null) sb.append(line); } catch (IOException e) { e.printStackTrace(); } return sb.toString(); } }
[ "s18714@pjwstk.edu.pl" ]
s18714@pjwstk.edu.pl
21b0b2b2fe2e6d8affabe6889d0e7a7a167a7d44
d9f2be589358eaee379a799c017a3e6e1f43e2d2
/LiveServer/src/main/java/com/t4/LiveServer/business/imp/CommentBusinessImp.java
776e7cb0887d1b6ff8914c9d5538175410565e17
[]
no_license
tayduivn/Livestream-platform-with-android-and-spring
480ac07caf24d1e5234ff483508defec67896e2e
20ad286b0871b44bc1a8bdbf968c521b8d37cded
refs/heads/master
2023-02-19T12:53:37.602544
2020-01-12T07:17:36
2020-01-12T07:17:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
384
java
package com.t4.LiveServer.business.imp; import com.t4.LiveServer.business.interfaze.CommentBusiness; import com.t4.LiveServer.core.ApiResponse; import com.t4.LiveServer.entryParam.base.CommentEntryParams; public class CommentBusinessImp implements CommentBusiness { @Override public ApiResponse commentToTopic(CommentEntryParams entryParams) { return null; } }
[ "16130586@st.hcmuaf.edu.vn" ]
16130586@st.hcmuaf.edu.vn
3508c4ed9678dc0997110e4cacbb06aed552ae8e
71f80e192b59f2e11c8e10651e589556a8773e25
/universities/src/ORMclasses/university/CountryORM.java
6ab1487226ff697b051c3931255f973d663376a6
[]
no_license
sxl147/universities
13f853fd6a52cabd1baa0a923f20e43c811035e1
3e3444bf7f727c7ee7b8eb8ba8a05e10d1d9b880
refs/heads/master
2020-06-12T18:03:09.960078
2018-05-28T22:06:32
2018-05-28T22:06:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
939
java
package ORMclasses.university; import java.util.Date; public class CountryORM { private Long Id; private String countryCode; // country_code private String countryName; // country_name private Date evntTmeStmp; // evnt_tmestmp private String evntOperId; // evnt_oper_id public Long getId() { return Id; } public void setId(Long id) { Id = id; } public String getCountryCode() { return countryCode; } public void setCountryCode(String countryCode) { this.countryCode = countryCode; } public String getCountryName() { return countryName; } public void setCountryName(String countryName) { this.countryName = countryName; } public Date getEvntTmeStmp() { return evntTmeStmp; } public void setEvntTmeStmp(Date evntTmeStmp) { this.evntTmeStmp = evntTmeStmp; } public String getEvntOperId() { return evntOperId; } public void setEvntOperId(String evntOperId) { this.evntOperId = evntOperId; } }
[ "dylnksslr53@gmail.com" ]
dylnksslr53@gmail.com
f0d4be363f47f9da8fae530ed778a506c6d98ae8
cbdac43c470bf7e1c1a1410cefa4716c228c5b9d
/src/controllers/DuckInfo.java
59f6cad71dcc471fd90f10b1bf5c65578f2c5bf0
[]
no_license
Alexalegon/ChickenFunRun-Game-Code
59f1bca516805979b74397a9bcd1fb06833e0ed8
a96cb51e7ca5296c6481267c94bfcb76c0eb59c4
refs/heads/master
2021-01-19T16:59:56.840012
2017-04-14T21:19:53
2017-04-14T21:19:53
88,297,203
0
0
null
null
null
null
UTF-8
Java
false
false
537
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 controllers; import com.jme3.math.Vector3f; /** * * @author Miguel Martrinez */ public class DuckInfo { static Vector3f duckLocation = Vector3f.ZERO; public static void registerDuck(Vector3f location){ duckLocation = location; } public static Vector3f getDuckLocation(){ return duckLocation; } }
[ "alegon368@gmail.com" ]
alegon368@gmail.com
b279a0421e0f3cf971f84aa5440954425c1d7fd9
e205598cebca66d5a8cb84895dc2b65df11b2e5a
/user-service/src/main/java/com/mood/userservice/decode/DecodeUserToken.java
192944dda8223978d83f96e82f0a143498298b5b
[]
no_license
KimIlJun/Mood-Web
3e26caa8453db18a38b5caeb33c06b4784b62389
fe4123570482756e3aa8411881cd5d915fc4daa5
refs/heads/main
2023-08-10T16:36:15.462665
2021-09-14T07:50:57
2021-09-14T07:50:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
850
java
package com.mood.userservice.decode; import io.jsonwebtoken.Jwts; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; public class DecodeUserToken { public String getUserUidByUserToken(String userToken, Environment env){ if(userToken.isEmpty()){ return null; } String userUid = null; try { userUid = Jwts.parser().setSigningKey(env.getProperty("token.secret")) .parseClaimsJws(userToken).getBody() .getSubject(); }catch (Exception ex){ return null; } if(userUid ==null || userUid.isEmpty()){ return null; } return userUid; } }
[ "seojeonghyeon0630@gmail.com" ]
seojeonghyeon0630@gmail.com
872d77ecb03e63bbf83c57d79a01823ce24005ca
47395b5bd86ed270371445226610ec03630f01fc
/antlr-example/src/main/java/AntlrMain.java
7f374be80e41d0ec2a03299713ed4ff23ec8233d
[]
no_license
gergelyszaz/antlr4-example
45cd8102dfc278203c8e9836e077bf60b5f0c82d
ee6a3d791d57f73e697d6023d9761a7cc04d8a84
refs/heads/master
2020-03-17T18:50:22.518643
2018-05-17T15:39:46
2018-05-18T10:14:39
133,835,542
0
0
null
null
null
null
UTF-8
Java
false
false
234
java
public class AntlrMain { public static void main(String[] args) { System.out.println(Calculator.calculate("1+2+3")); System.out.println(Calculator.calculate("23-4")); System.out.println(Calculator.calculate("6-4+3-2")); } }
[ "gergely.szaz@liferay.com" ]
gergely.szaz@liferay.com
3c8f4303f3cc879609b60c8aa11c85b8b7f37da2
81be244813d0ab5872dc34c112b2a92842642a33
/src/core/com/develhack/lombok/eclipse/handlers/feature/UtilityHandler.java
d776b3faf673154b97d58b365870c6f316b7b2c5
[ "MIT" ]
permissive
develhack/develhacked-lombok
29eb07cb71b9765f953d87b423f6aaab87a41a08
a0d00aeecdf8ce5bf40feca05aaa19285b0be6f7
refs/heads/master
2021-01-21T06:06:16.332930
2016-03-28T13:04:13
2016-03-28T13:13:02
39,473,521
0
0
null
null
null
null
UTF-8
Java
false
false
1,119
java
package com.develhack.lombok.eclipse.handlers.feature; import lombok.core.AST.Kind; import lombok.core.AnnotationValues; import lombok.core.HandlerPriority; import lombok.eclipse.EclipseAnnotationHandler; import lombok.eclipse.EclipseNode; import org.eclipse.jdt.internal.compiler.ast.Annotation; import org.mangosdk.spi.ProviderFor; import com.develhack.annotation.feature.Utility; @ProviderFor(EclipseAnnotationHandler.class) @HandlerPriority(UtilityHandler.PRIORITY) public class UtilityHandler extends AbstractFeatureHandler<Utility> { public static final int PRIORITY = VOHandler.PRIORITY + 1; public UtilityHandler() { super(Utility.class); } @Override public void handle(AnnotationValues<Utility> annotationValues, Annotation ast, EclipseNode annotationNode) { super.handle(annotationValues, ast, annotationNode); EclipseNode typeNode = annotationNode.up(); if (typeNode.getKind() != Kind.TYPE) { annotationNode.addWarning(String.format("@%s is only applicable to the type.", getAnnotationName())); return; } supplementFinalModifier(); supplementUncallableConstructor(); } }
[ "yosuke.otsuka@develhack.com" ]
yosuke.otsuka@develhack.com
d067601f0828790f793277b29c50a375f33c5d2a
80e37f69d30f23308ed58291178a00d2e004898e
/zith-toolkit-dao-build/src/main/java/org/zith/toolkit/dao/build/dsl/element/SqlTypeDictionaryItemElement.java
1bcf526ccc099946c54e84fd4f194759dafa16b8
[ "BSD-2-Clause" ]
permissive
sherwoodwang/zith-toolkit-dao
504fa2eeeac7db1aae0499d18451f7337d6acb61
3352d4a5889538fe6c6cb48f0900b6eaee72ebc8
refs/heads/master
2021-09-10T10:35:51.529723
2018-03-24T15:16:31
2018-03-24T15:16:31
111,402,510
0
0
null
null
null
null
UTF-8
Java
false
false
1,330
java
package org.zith.toolkit.dao.build.dsl.element; import javax.annotation.Nullable; import java.util.Objects; import java.util.Optional; public class SqlTypeDictionaryItemElement { private final String handlerName; private final JavaReferenceElement type; public SqlTypeDictionaryItemElement( @Nullable String handlerName, JavaReferenceElement type ) { this.handlerName = handlerName; this.type = Objects.requireNonNull(type); } public Optional<String> getHandlerName() { return Optional.ofNullable(handlerName); } public JavaReferenceElement getType() { return type; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SqlTypeDictionaryItemElement that = (SqlTypeDictionaryItemElement) o; return Objects.equals(handlerName, that.handlerName) && Objects.equals(type, that.type); } @Override public int hashCode() { return Objects.hash(handlerName, type); } @Override public String toString() { return "SqlTypeDictionaryItemElement{" + "handlerName='" + handlerName + '\'' + ", type=" + type + '}'; } }
[ "sherwood@wang.onl" ]
sherwood@wang.onl
d80a3cfc3fe4faa3298d6270b5478b96a079ddc6
939bc9b579671de84fb6b5bd047db57b3d186aca
/java.xml/com/sun/org/apache/xerces/internal/xs/XSValue.java
806fccbdb136bb8877c6dcaff4868c6544db9c23
[]
no_license
lc274534565/jdk11-rm
509702ceacfe54deca4f688b389d836eb5021a17
1658e7d9e173f34313d2e5766f4f7feef67736e8
refs/heads/main
2023-01-24T07:11:16.084577
2020-11-16T14:21:37
2020-11-16T14:21:37
313,315,578
1
1
null
null
null
null
UTF-8
Java
false
false
4,506
java
/* * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.sun.org.apache.xerces.internal.xs; /** * Represents an actual value of a simple type. */ public interface XSValue { /** * The schema normalized value. * @return The normalized value. */ public String getNormalizedValue(); /** * The actual value. <code>null</code> if the value is in error. * @return The actual value. */ public Object getActualValue(); /** * The declared simple type definition used to validate this value. * It can be a union type. * @return The declared simple type definition */ public XSSimpleTypeDefinition getTypeDefinition(); /** * If the declared simple type definition is a union, return the member * type actually used to validate the value. Otherwise null. * @return The member type */ public XSSimpleTypeDefinition getMemberTypeDefinition(); /** * If <code>getTypeDefinition()</code> returns a list type whose item type * is a union type, then this method returns a list with the same length * as the value list, for simple types that actually validated * the corresponding item in the value. * @return A list of type definitions */ public XSObjectList getMemberTypeDefinitions(); /** * The actual value built-in datatype, e.g. * <code>STRING_DT, SHORT_DT</code>. If the type definition of this * value is a list type definition, this method returns * <code>LIST_DT</code>. If the type definition of this value is a list * type definition whose item type is a union type definition, this * method returns <code>LISTOFUNION_DT</code>. To query the actual value * of the list or list of union type definitions use * <code>itemValueTypes()</code>. * @return The actual value type */ public short getActualValueType(); /** * In the case the actual value represents a list, i.e. the * <code>actualNormalizedValueType</code> is <code>LIST_DT</code>, the * returned array consists of one type kind which represents the itemType * . For example: * <pre> &lt;simpleType name="listtype"&gt; &lt;list * itemType="positiveInteger"/&gt; &lt;/simpleType&gt; &lt;element * name="list" type="listtype"/&gt; ... &lt;list&gt;1 2 3&lt;/list&gt; </pre> * * The <code>schemaNormalizedValue</code> value is "1 2 3", the * <code>actualNormalizedValueType</code> value is <code>LIST_DT</code>, * and the <code>itemValueTypes</code> is an array of size 1 with the * value <code>POSITIVEINTEGER_DT</code>. * <br> If the actual value represents a list type definition whose item * type is a union type definition, i.e. <code>LISTOFUNION_DT</code>, * for each actual value in the list the array contains the * corresponding memberType kind. For example: * <pre> &lt;simpleType * name='union_type' memberTypes="integer string"/&gt; &lt;simpleType * name='listOfUnion'&gt; &lt;list itemType='union_type'/&gt; * &lt;/simpleType&gt; &lt;element name="list" type="listOfUnion"/&gt; * ... &lt;list&gt;1 2 foo&lt;/list&gt; </pre> * The * <code>schemaNormalizedValue</code> value is "1 2 foo", the * <code>actualNormalizedValueType</code> is <code>LISTOFUNION_DT</code> * , and the <code>itemValueTypes</code> is an array of size 3 with the * following values: <code>INTEGER_DT, INTEGER_DT, STRING_DT</code>. * @return The list value types */ public ShortList getListValueTypes(); }
[ "274534565@qq.com" ]
274534565@qq.com
78f7170e3e8c42a89eb34134809a1bad8a7a5c33
03b316d5189346195d4d7fdfc002267a822e2b57
/src/main/java/intro.java
d921523afa6f5f9a1ad4f8c60be3ca4ee2557b0d
[]
no_license
kajalkujur/demo1
063115f5166ad1f7c5bfa45773afff51542451d6
7ad26cf1cf9374c7936bdc3c2dc6309ca2d1264f
refs/heads/master
2023-04-24T05:29:37.314371
2021-05-15T13:39:46
2021-05-15T13:39:46
367,631,644
0
0
null
null
null
null
UTF-8
Java
false
false
125
java
public class intro { public void hello() { System.out.println("Hello World"); System.out.println("Welcome"); } }
[ "kajalkujur99@gmail.com" ]
kajalkujur99@gmail.com
20412426b2ad57811168c4f29ee39e956482dcfb
7bc975c929eedca0d2254360360b7f021749ae7f
/src/main/java/com/redxun/bpm/core/dao/ActHiTaskinstDao.java
b0e887b469ccbadeb4eb552ca66bab3a7fcc478c
[]
no_license
liaosheng2018/jsaas-1
7d6e5a10b9bf22e4e6793a4efe3c783fb4afc621
0fd2df00b4680c92500429bd800b1806b816002d
refs/heads/master
2022-03-10T12:22:51.907294
2019-11-29T07:11:11
2019-11-29T07:11:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
529
java
/** * * <pre> * 描述:act_hi_taskinst DAO接口 * 作者:ray * 日期:2019-04-02 09:26:35 * 版权:广州红迅软件 * </pre> */ package com.redxun.bpm.core.dao; import java.util.List; import com.redxun.bpm.core.entity.ActHiTaskinst; import org.springframework.stereotype.Repository; import com.redxun.core.dao.mybatis.BaseMybatisDao; @Repository public class ActHiTaskinstDao extends BaseMybatisDao<ActHiTaskinst> { @Override public String getNamespace() { return ActHiTaskinst.class.getName(); } }
[ "18037459447@163.com" ]
18037459447@163.com
624bfabf6f4bf07df7928ac280bc96f7c17b1628
b5e2aa66c9cd950e53e58a8b7b9cc85637947613
/src/main/java/earthquakes/geoson/Properties.java
a2964a467aee48093e01637ab441d46ae0666dbe
[]
no_license
ucsb-cs56-f19/proj02-aeshapar
dca9eb20987bde353c40d92b0082ecfb5dccb2f5
2fbbb3fa36e3e02426ceb6e88071a960bd5efa3b
refs/heads/master
2022-11-26T11:53:20.853218
2019-12-05T21:51:21
2019-12-05T21:51:21
224,749,287
0
0
null
2022-11-16T00:40:28
2019-11-29T00:32:27
Java
UTF-8
Java
false
false
175
java
package earthquakes.geojson; public class Properties { public double mag; public String place; public String type; public String title; public String url; }
[ "aeshaparekh@csil-21.cs.ucsb.edu" ]
aeshaparekh@csil-21.cs.ucsb.edu
1c90022572b7f6096f909b2ef65d5a8962c5257c
9a031e8d2716aea8ceb51044965111978fdca570
/pa/pa-ejb/src/java/gov/nih/nci/pa/service/TrialDataVerificationServiceRemote.java
48ca87a5df0f6070f12ebcb34db10e426b1dafda
[]
no_license
polavarapup2/CTRP_4x_PA
040423608334115dad9b2c441c2a27daa9716ae2
08b9615840d81cf9d85eae1d7ae7ed6c33883d47
refs/heads/master
2021-01-23T12:32:49.287585
2017-06-02T13:29:26
2017-06-02T13:29:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
221
java
package gov.nih.nci.pa.service; import javax.ejb.Local; /** * * @author Reshma.Koganti * */ @Local public interface TrialDataVerificationServiceRemote extends TrialDataVerificationServiceLocal { }
[ "vamshikasubagha@yahoo.com" ]
vamshikasubagha@yahoo.com
636da2ec4361dc3b128ac8b7be5e543d3ce947a9
d60e287543a95a20350c2caeabafbec517cabe75
/LACCPlus/Hadoop/1237_1.java
c96568fb93935123e810fe4cede474dd1bc78a12
[ "MIT" ]
permissive
sgholamian/log-aware-clone-detection
242067df2db6fd056f8d917cfbc143615c558b2c
9993cb081c420413c231d1807bfff342c39aa69a
refs/heads/main
2023-07-20T09:32:19.757643
2021-08-27T15:02:50
2021-08-27T15:02:50
337,837,827
0
0
null
null
null
null
UTF-8
Java
false
false
859
java
//,temp,FsDatasetImpl.java,1266,1285,temp,FsDatasetImpl.java,824,846 //,3 public class xxx { private void bumpReplicaGS(ReplicaInfo replicaInfo, long newGS) throws IOException { long oldGS = replicaInfo.getGenerationStamp(); File oldmeta = replicaInfo.getMetaFile(); replicaInfo.setGenerationStamp(newGS); File newmeta = replicaInfo.getMetaFile(); // rename meta file to new GS if (LOG.isDebugEnabled()) { LOG.debug("Renaming " + oldmeta + " to " + newmeta); } try { NativeIO.renameTo(oldmeta, newmeta); } catch (IOException e) { replicaInfo.setGenerationStamp(oldGS); // restore old GS throw new IOException("Block " + replicaInfo + " reopen failed. " + " Unable to move meta file " + oldmeta + " to " + newmeta, e); } } };
[ "sgholami@uwaterloo.ca" ]
sgholami@uwaterloo.ca
87d833162c5660f5bcafdff56a4eb8c6b3aea58f
14dbc432f4a41cdfdba63c7403d9d042f1689362
/src/carritopelis/Pelicula.java
662a1d8d7e7ea34dba0c7b786b8ce105cf6c03b8
[]
no_license
U-Lee/PSP1-Carrito
de9425d9503eaa71e056615e347f6d97a5f7db3b
c5aab75a69d7f9c554bc535ac95ab326371a8b3a
refs/heads/master
2021-08-24T15:36:24.289410
2017-12-10T08:06:12
2017-12-10T08:06:12
113,731,327
0
0
null
null
null
null
UTF-8
Java
false
false
1,706
java
package carritopelis; /* * Clase que contiene la creación del objeto pelicula * * @versión 1.0 Fecha 10/12/2017 * @author Omar Ulises Hernández Cervantes, Oswaldo Josue Hernández Juárez */ public class Pelicula { String ID, titulo, actor, genero, precio; // Declaración de variables /** * * @param ID Cadena que almacena del ID de la película * @param titulo Cadena que almacena el nombre de la película * @param actor Cadena que almacena el nombre del actor principal de la * película * @param genero Cadena que almacena el género al que pertenece la película * @param precio Cadena que almacena el precio de venta de la película */ public Pelicula(String ID, String titulo, String actor, String genero, String precio) { this.ID = ID; this.titulo = titulo; this.actor = actor; this.genero = genero; this.precio = precio; } public String getID() { return ID; } public String getTitulo() { return titulo; } public String getActor() { return actor; } public String getGenero() { return genero; } public String getPrecio() { return precio; } public void setID(String ID) { this.ID = ID; } public void setTitulo(String titulo) { this.titulo = titulo; } public void setActor(String actor) { this.actor = actor; } public void setGenero(String genero) { this.genero = genero; } public void setPrecio(String precio) { this.precio = precio; } }
[ "hecotlaloc@gmail.com" ]
hecotlaloc@gmail.com
89cf6c285eb5b3b341c53f73b1090d7372da9378
adba6e20f5f4e0ed1995549e96b497d8f8516de2
/src/main/java/com/neology/ws_titulos/dtos/AutosSoatDTO.java
53f47c746e4bf4601c44a1a17c9df8bda02df3a8
[]
no_license
cesarborrego/back_java
b7975756aee774257ac9d4f7b070a9ecda46ee2a
aa595978ad70b82553cddd13d11855c4a4f170d5
refs/heads/master
2021-01-21T07:20:06.235441
2017-04-06T00:07:17
2017-04-06T00:07:17
91,608,852
0
0
null
null
null
null
UTF-8
Java
false
false
591
java
package com.neology.ws_titulos.dtos; import java.io.Serializable; public class AutosSoatDTO implements Serializable{ /** * */ private static final long serialVersionUID = 1934498135000199814L; private String strFolio; private String dtmFechaExpiracion; public String getStrFolio() { return strFolio; } public void setStrFolio(String strFolio) { this.strFolio = strFolio; } public String getDtmFechaExpiracion() { return dtmFechaExpiracion; } public void setDtmFechaExpiracion(String dtmFechaExpiracion) { this.dtmFechaExpiracion = dtmFechaExpiracion; } }
[ "csegura@neology-rfid.com" ]
csegura@neology-rfid.com
5b11ccba5af0e777eb8505fa4d39a6a28cf90b5b
d28d31a687f653bf033892e8c84b55d61882741a
/assignments/mortensene/unit2/HW22Inheritance/GroseryStoreModel/src/ec/edu/espe/groseryStoreModel/model/Cereals.java
00c151a4bb48cf95a16d9ea64b7e583825300256
[]
no_license
elascano/ESPE202105-OOP-SW-3682
02debcbd73540438ac39e04eb5ed2c4c99c72eb0
6198fb3b90faeee6ea502f3eb80532a67cf5739f
refs/heads/main
2023-08-29T12:30:09.487090
2021-09-20T14:40:03
2021-09-20T14:40:03
369,223,490
0
0
null
null
null
null
UTF-8
Java
false
false
885
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 ec.edu.espe.groseryStoreModel.model; /** * * @author Paul Mena The Programmers ESPE-DCCO */ public class Cereals extends Inventory { private float weight; {} public Cereals(float weight,int id, float price, String type, String brand) { super(id, price, type, brand); this.weight=weight; } public String toString(){ return "Cereals{" + super.toString()+"weight=" + getWeight() + '}'; } /** * @return the weight */ public float getWeight() { return weight; } /** * @param weight the weight to set */ public void setWeight(float weight) { this.weight = weight; } }
[ "84451615+EDUARDOMORTENSEN@users.noreply.github.com" ]
84451615+EDUARDOMORTENSEN@users.noreply.github.com
7410d0f506ad93a7cd2e146413fd1911de101da9
2b6bc08d9693820e1b2d687bfa2f1260fa74a5ca
/small-sso-core/src/main/java/com/small/sso/core/util/JedisUtil.java
6af15b18cf220605446fc707d817a333954a15b8
[]
no_license
Fi-Null/small-sso
bbb094347d8983bf51dbf536cebbfd3f1d462653
eb224362356f569366931ddaaa1fc128b7bceee0
refs/heads/master
2021-06-27T06:38:38.581944
2020-01-06T08:12:54
2020-01-06T08:12:54
231,534,329
0
1
null
2021-06-04T02:24:25
2020-01-03T07:17:58
Java
UTF-8
Java
false
false
12,577
java
package com.small.sso.core.util; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import redis.clients.jedis.JedisPoolConfig; import redis.clients.jedis.JedisShardInfo; import redis.clients.jedis.ShardedJedis; import redis.clients.jedis.ShardedJedisPool; import java.io.*; import java.util.LinkedList; import java.util.List; import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.ReentrantLock; /** * @author null * @version 1.0 * @title * @description * @createDate 1/3/20 4:05 PM */ public class JedisUtil { private static Logger logger = LoggerFactory.getLogger(JedisUtil.class); /** * redis address, like "{ip}"、"{ip}:{port}"、"{redis/rediss}://small-sso:{password}@{ip}:{port:6379}/{db}";Multiple "," separated */ private static String address; public static void init(String address) { JedisUtil.address = address; getInstance(); } // ------------------------ ShardedJedisPool ------------------------ /** * 方式01: Redis单节点 + Jedis单例 : Redis单节点压力过重, Jedis单例存在并发瓶颈 》》不可用于线上 * new Jedis("127.0.0.1", 6379).get("cache_key"); * 方式02: Redis单节点 + JedisPool单节点连接池 》》 Redis单节点压力过重,负载和容灾比较差 * new JedisPool(new JedisPoolConfig(), "127.0.0.1", 6379, 10000).getResource().get("cache_key"); * 方式03: Redis分片(通过client端集群,一致性哈希方式实现) + Jedis多节点连接池 》》Redis集群,负载和容灾较好, ShardedJedisPool一致性哈希分片,读写均匀,动态扩充 * new ShardedJedisPool(new JedisPoolConfig(), new LinkedList<JedisShardInfo>()); * 方式03: Redis集群; * new JedisCluster(jedisClusterNodes); // TODO */ private static ShardedJedisPool shardedJedisPool; private static ReentrantLock INSTANCE_INIT_LOCL = new ReentrantLock(false); /** * 获取ShardedJedis实例 * * @return */ private static ShardedJedis getInstance() { if (shardedJedisPool == null) { try { if (INSTANCE_INIT_LOCL.tryLock(2, TimeUnit.SECONDS)) { try { if (shardedJedisPool == null) { // JedisPoolConfig JedisPoolConfig config = new JedisPoolConfig(); config.setMaxTotal(200); config.setMaxIdle(50); config.setMinIdle(8); config.setMaxWaitMillis(10000); // 获取连接时的最大等待毫秒数(如果设置为阻塞时BlockWhenExhausted),如果超时就抛异常, 小于零:阻塞不确定的时间, 默认-1 config.setTestOnBorrow(true); // 在获取连接的时候检查有效性, 默认false config.setTestOnReturn(false); // 调用returnObject方法时,是否进行有效检查 config.setTestWhileIdle(true); // Idle时进行连接扫描 config.setTimeBetweenEvictionRunsMillis(30000); // 表示idle object evitor两次扫描之间要sleep的毫秒数 config.setNumTestsPerEvictionRun(10); // 表示idle object evitor每次扫描的最多的对象数 config.setMinEvictableIdleTimeMillis(60000); // 表示一个对象至少停留在idle状态的最短时间,然后才能被idle object evitor扫描并驱逐;这一项只有在timeBetweenEvictionRunsMillis大于0时才有意义 // JedisShardInfo List List<JedisShardInfo> jedisShardInfos = new LinkedList<>(); String[] addressArr = address.split(","); for (int i = 0; i < addressArr.length; i++) { JedisShardInfo jedisShardInfo = new JedisShardInfo(addressArr[i]); jedisShardInfos.add(jedisShardInfo); } shardedJedisPool = new ShardedJedisPool(config, jedisShardInfos); logger.info(">>>>>>>>>>> small-sso, JedisUtil.ShardedJedisPool init success."); } } finally { INSTANCE_INIT_LOCL.unlock(); } } } catch (InterruptedException e) { logger.error(e.getMessage(), e); } } if (shardedJedisPool == null) { throw new NullPointerException(">>>>>>>>>>> small-sso, JedisUtil.ShardedJedisPool is null."); } ShardedJedis shardedJedis = shardedJedisPool.getResource(); return shardedJedis; } public static void close() throws IOException { if (shardedJedisPool != null) { shardedJedisPool.close(); } } // ------------------------ serialize and unserialize ------------------------ /** * 将对象-->byte[] (由于jedis中不支持直接存储object所以转换成byte[]存入) * * @param object * @return */ private static byte[] serialize(Object object) { ObjectOutputStream oos = null; ByteArrayOutputStream baos = null; try { // 序列化 baos = new ByteArrayOutputStream(); oos = new ObjectOutputStream(baos); oos.writeObject(object); byte[] bytes = baos.toByteArray(); return bytes; } catch (Exception e) { logger.error(e.getMessage(), e); } finally { try { oos.close(); baos.close(); } catch (IOException e) { logger.error(e.getMessage(), e); } } return null; } /** * 将byte[] -->Object * * @param bytes * @return */ private static Object unserialize(byte[] bytes) { ByteArrayInputStream bais = null; try { // 反序列化 bais = new ByteArrayInputStream(bytes); ObjectInputStream ois = new ObjectInputStream(bais); return ois.readObject(); } catch (Exception e) { logger.error(e.getMessage(), e); } finally { try { bais.close(); } catch (IOException e) { logger.error(e.getMessage(), e); } } return null; } // ------------------------ jedis util ------------------------ /** * 存储简单的字符串或者是Object 因为jedis没有分装直接存储Object的方法,所以在存储对象需斟酌下 * 存储对象的字段是不是非常多而且是不是每个字段都用到,如果是的话那建议直接存储对象, * 否则建议用集合的方式存储,因为redis可以针对集合进行日常的操作很方便而且还可以节省空间 */ /** * Set String * * @param key * @param value * @param seconds 存活时间,单位/秒 * @return */ public static String setStringValue(String key, String value, int seconds) { String result = null; ShardedJedis client = getInstance(); try { result = client.setex(key, seconds, value); } catch (Exception e) { logger.error(e.getMessage(), e); } finally { if (client != null) { client.close(); } } return result; } /** * Set Object * * @param key * @param obj * @param seconds 存活时间,单位/秒 */ public static String setObjectValue(String key, Object obj, int seconds) { String result = null; ShardedJedis client = getInstance(); try { result = client.setex(key.getBytes(), seconds, serialize(obj)); } catch (Exception e) { logger.error(e.getMessage(), e); } finally { if (client != null) { client.close(); } } return result; } /** * Get String * * @param key * @return */ public static String getStringValue(String key) { String value = null; ShardedJedis client = getInstance(); try { value = client.get(key); } catch (Exception e) { logger.error(e.getMessage(), e); } finally { if (client != null) { client.close(); } } return value; } /** * Get Object * * @param key * @return */ public static Object getObjectValue(String key) { Object obj = null; ShardedJedis client = getInstance(); try { byte[] bytes = client.get(key.getBytes()); if (bytes != null && bytes.length > 0) { obj = unserialize(bytes); } } catch (Exception e) { logger.error(e.getMessage(), e); } finally { if (client != null) { client.close(); } } return obj; } /** * Delete key * * @param key * @return Integer reply, specifically: * an integer greater than 0 if one or more keys were removed * 0 if none of the specified key existed */ public static Long del(String key) { Long result = null; ShardedJedis client = getInstance(); try { result = client.del(key); } catch (Exception e) { logger.error(e.getMessage(), e); } finally { if (client != null) { client.close(); } } return result; } /** * incrBy i(+i) * * @param key * @param i * @return new value after incr */ public static Long incrBy(String key, int i) { Long result = null; ShardedJedis client = getInstance(); try { result = client.incrBy(key, i); } catch (Exception e) { logger.error(e.getMessage(), e); } finally { if (client != null) { client.close(); } } return result; } /** * exists valid * * @param key * @return Boolean reply, true if the key exists, otherwise false */ public static boolean exists(String key) { Boolean result = null; ShardedJedis client = getInstance(); try { result = client.exists(key); } catch (Exception e) { logger.error(e.getMessage(), e); } finally { if (client != null) { client.close(); } } return result; } /** * expire reset * * @param key * @param seconds 存活时间,单位/秒 * @return Integer reply, specifically: * 1: the timeout was set. * 0: the timeout was not set since the key already has an associated timeout (versions lt 2.1.3), or the key does not exist. */ public static long expire(String key, int seconds) { Long result = null; ShardedJedis client = getInstance(); try { result = client.expire(key, seconds); } catch (Exception e) { logger.error(e.getMessage(), e); } finally { if (client != null) { client.close(); } } return result; } /** * expire at unixTime * * @param key * @param unixTime * @return */ public static long expireAt(String key, long unixTime) { Long result = null; ShardedJedis client = getInstance(); try { result = client.expireAt(key, unixTime); } catch (Exception e) { logger.error(e.getMessage(), e); } finally { if (client != null) { client.close(); } } return result; } public static void main(String[] args) { String smallSsoRedisAddress = "redis://small-sso:password@127.0.0.1:6379/0"; smallSsoRedisAddress = "redis://127.0.0.1:6379/0"; init(smallSsoRedisAddress); setObjectValue("key", "666", 2 * 60 * 60); System.out.println(getObjectValue("key")); } }
[ "xiangke6@jd.com" ]
xiangke6@jd.com
811e2d07a9e96b1bc4e12ee65aad0069b5999554
be73270af6be0a811bca4f1710dc6a038e4a8fd2
/crash-reproduction-moho/results/XWIKI-13377-13-24-MOEAD-WeightedSum:TestLen:CallDiversity/com/xpn/xwiki/user/impl/xwiki/XWikiAuthServiceImpl_ESTest_scaffolding.java
b97addcf8b5b00114a4e0af3f29de28d04a09a4d
[]
no_license
STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application
cf118b23ecb87a8bf59643e42f7556b521d1f754
3bb39683f9c343b8ec94890a00b8f260d158dfe3
refs/heads/master
2022-07-29T14:44:00.774547
2020-08-10T15:14:49
2020-08-10T15:14:49
285,804,495
0
0
null
null
null
null
UTF-8
Java
false
false
454
java
/** * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite * Tue Apr 07 19:29:29 UTC 2020 */ package com.xpn.xwiki.user.impl.xwiki; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; import org.junit.Before; import org.junit.After; @EvoSuiteClassExclude public class XWikiAuthServiceImpl_ESTest_scaffolding { // Empty scaffolding for empty test suite }
[ "pouria.derakhshanfar@gmail.com" ]
pouria.derakhshanfar@gmail.com
b164feea2e5980cc882e77c57f5351068fc4109a
96234dedce91a66489233d519ae470566cafce7b
/src/ThreadTest/SynFunctionDemo.java
41574b1915d03e61da14f4bfb5f0bc545a37397e
[]
no_license
linj21a/java
edb434ffb921390b47c52f2a4a99cd3aefe70c2c
eb95568495b5af1100939681a066b1b3220222a1
refs/heads/master
2023-03-31T06:39:01.122102
2021-03-12T02:56:41
2021-03-12T02:56:41
256,404,199
0
0
null
null
null
null
UTF-8
Java
false
false
3,080
java
package ThreadTest; /** * 验证同步函数使用的是哪一个锁 */ class Tick2 implements Runnable { private static int num = 100;//票数,也代表票的号码或者座位 //使用同步代码块的时候,琐是固定的,但是可以是任意对象 final Object ob = new Object();//常常定义为只允许赋值一次的对象锁! public boolean flag = true; public void run() { if (flag) { while (true) //修改如下 // synchronized (this){//同步代码块 ob就是锁!!!!!!! synchronized (this.getClass()) {//同步代码块 if (num > 0) { try { Thread.sleep(10); } catch (InterruptedException ignored) { }//注意这里可能抛出异常,要么使用try'catch普抓或者声明!注意run无法声明异常 System.out.println(Thread.currentThread().getName() + "obj:。。。" + num--); } } } else { while (true) show(); } } synchronized static void show() {//同步函数 // synchronized void show(){//同步函数 if (num > 0) { try { Thread.sleep(10); } catch (InterruptedException ignored) { }//注意这里可能抛出异常,要么使用try'catch普抓或者声明!注意run无法声明异常 System.out.println(Thread.currentThread().getName() + "show:。。。" + num--); } } } public class SynFunctionDemo { public static void main(String[] args) { Tick2 t1 = new Tick2(); Thread s1 = new Thread(t1); Thread s2 = new Thread(t1); s1.start(); //未加延时之前,主线程执行到这里,还具备cpu的执行权,瞬间就执行完这三条语句,修改了flag,所以我们看到的全是show //现在我们修改一下让主线程延时,使得cpu能够进行切换,就能看到show与obj一起买票,但是线程不安全 try { Thread.sleep(10); } catch (InterruptedException ignore) { } //这个时候,我们就能发现有show与obj了。 //因为发现obj竟然这个时候能卖出0票,而且show与obj都卖出了第98张票,说明同步代码块与同步函数使用的不是同一把锁。 //现在我们修改同步代码块为this的锁,此时obj与show抢夺资源,一起卖出了100张票,实现同步,多线程安全。 t1.flag = false; //现在我们修改同步函数为静态同步函数,那它肯定无法使用this,又锁一定要是对象,——只能是类加载进方法区时虚拟机创建的类字节码文件对象 //我们使用this.getClass或者Ticket2.class验证 _此时obj与show抢夺资源,一起卖出了100张票,实现同步,多线程安全。 s2.start(); //s3.start(); } }
[ "604178275@qq.com" ]
604178275@qq.com
5ae14a1ef65153e178cd964dc3eb6dc1373bd369
16f763390158e69119dcaf44d60601c41df7fe84
/src/ru/vsu/cs/course1/Main.java
b98ffd04e98a33390787bf97bed848acccdbf536
[]
no_license
pressEm/KG2020_G21_Task3
f8dda2a2c7c737e85e948098991f706bbb8f0129
3b38e8e39bad46e4e15e3649126708b95792481d
refs/heads/main
2023-01-05T04:44:13.614350
2020-11-07T09:47:19
2020-11-07T09:47:19
308,692,870
0
0
null
null
null
null
UTF-8
Java
false
false
295
java
package ru.vsu.cs.course1; import javax.swing.*; public class Main { public static void main(String[] args) { MainWindow mw = new MainWindow(); mw.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); mw.setSize(800, 600); mw.setVisible(true); } }
[ "filonova2001v@gmail.com" ]
filonova2001v@gmail.com
a1edafba588fc93527f68eaacc326793b1ef5b68
8eda4a7de1aa03084c6ad3f93d4b4a6c2d754d0b
/app/src/main/java/com/floatingreels/grocerylist/ui/util/BSectionAdapter.java
d5d7421d3fdafb2600b5423b09acd4f422c3e537
[]
no_license
floatingreels/GroceryListJava
20d3ba2e7af74db21e16f0b85571392eb9107b91
8af6209dcd1f30f1ef75b31b07366193f82a1fbf
refs/heads/master
2022-11-19T03:07:06.246677
2020-07-11T11:35:11
2020-07-11T11:35:11
260,038,257
0
0
null
null
null
null
UTF-8
Java
false
false
5,436
java
package com.floatingreels.grocerylist.ui.util; import android.app.Application; import android.content.DialogInterface; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.appcompat.app.AlertDialog; import androidx.cardview.widget.CardView; import androidx.recyclerview.widget.RecyclerView; import com.floatingreels.grocerylist.R; import com.floatingreels.grocerylist.model.Product; import com.floatingreels.grocerylist.model.ProductViewModel; import java.util.ArrayList; import java.util.List; public class BSectionAdapter extends RecyclerView.Adapter<BSectionAdapter.BSectionHolder> { private static final String TAG = "Checked state is :"; private Application mApplication; private List<Product> itemsFromSectionB; private List<CardView>cardViewList = new ArrayList<>(); private ProductViewModel productViewModel = new ProductViewModel(mApplication); public BSectionAdapter(Application application) { this.mApplication = application; itemsFromSectionB = new ArrayList<>(); } @NonNull @Override public BSectionHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { CardView cardView = (CardView) LayoutInflater.from(parent.getContext()).inflate(R.layout.card_product, parent, false); return new BSectionHolder(cardView); } @Override public void onBindViewHolder(@NonNull final BSectionHolder holder, int position) { int CARD_TEXT_COLOUR_UNCHECKED = mApplication.getResources().getColor(R.color.primaryTextColor); int CARD_TEXT_COLOUR_CHECKED = mApplication.getResources().getColor(R.color.primaryColor); final Product currentProduct = itemsFromSectionB.get(position); CardView currentCardView = holder.cardView; cardViewList.add(currentCardView); holder.nameTV.setText(currentProduct.getName()); holder.qtyTV.setText("( x" +currentProduct.getQuantity() + ")" ); if (currentProduct.isTicked()) { holder.nameTV.setTextColor(CARD_TEXT_COLOUR_CHECKED); holder.qtyTV.setTextColor(CARD_TEXT_COLOUR_CHECKED); holder.addToCartIV.setImageResource(R.drawable.ic_check_box_primary_color); holder.addToCartIV.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { currentProduct.setTicked(false); productViewModel.update(currentProduct); Log.d(TAG, String.valueOf(currentProduct.isTicked()).toUpperCase()); } }); } else { holder.nameTV.setTextColor(CARD_TEXT_COLOUR_UNCHECKED); holder.qtyTV.setTextColor(CARD_TEXT_COLOUR_UNCHECKED); holder.addToCartIV.setImageResource(R.drawable.ic_check_box_outline_blank); holder.addToCartIV.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { currentProduct.setTicked(true); productViewModel.update(currentProduct); Log.d(TAG, String.valueOf(currentProduct.isTicked()).toUpperCase()); } }); } currentCardView.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { new AlertDialog.Builder(v.getContext()) .setTitle(R.string.product_remove_item) .setMessage(R.string.confirm_delete) .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }) .setPositiveButton(R.string.delete, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { productViewModel.delete(currentProduct); Toast.makeText(mApplication, R.string.product_removed, Toast.LENGTH_SHORT).show(); } }) .create() .show(); return false; } }); } @Override public int getItemCount() { return itemsFromSectionB.size(); } public void setProducts(List<Product> products) { itemsFromSectionB.clear(); itemsFromSectionB.addAll(products); notifyDataSetChanged(); } class BSectionHolder extends RecyclerView.ViewHolder { final TextView nameTV, qtyTV; final ImageView addToCartIV; CardView cardView; public BSectionHolder(@NonNull View itemView) { super(itemView); nameTV = itemView.findViewById(R.id.tv_card_name); qtyTV = itemView.findViewById(R.id.tv_card_qty); addToCartIV = itemView.findViewById(R.id.iv_card_add_to_cart); cardView = itemView.findViewById(R.id.cv_product); } } }
[ "david.gunzburg@gmail.com" ]
david.gunzburg@gmail.com
c205ca98d4c01efcfa74a38247981aa32e9e2bd0
1d77e63f7ebebf1be1c000511886a58b9bae198f
/src/java3d/Pick.java
7d29f3c08219965048eb5b45dad1af0176cf9f6b
[]
no_license
jjjava/Java3D
ed5f22d9ff2e1db79fc7c2c51ed5fb071122cacb
0b6e72a05b1dce1daed1d40350b02ec364293268
refs/heads/master
2021-01-01T17:42:20.413664
2014-11-19T16:42:28
2014-11-19T16:42:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,037
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package java3d; import com.sun.j3d.utils.picking.*; import com.sun.j3d.utils.universe.SimpleUniverse; import com.sun.j3d.utils.geometry.*; import javax.media.j3d.*; import javax.vecmath.*; import java.awt.event.*; import java.awt.*; public class Pick extends MouseAdapter { private PickCanvas pickCanvas; public Pick() { Frame frame = new Frame("Box and Sphere"); GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration(); Canvas3D canvas = new Canvas3D(config); canvas.setSize(400, 400); SimpleUniverse universe = new SimpleUniverse(canvas); BranchGroup group = new BranchGroup(); // create a color cube Vector3f vector = new Vector3f(-0.3f, 0.0f, 0.0f); Transform3D transform = new Transform3D(); transform.setTranslation(vector); TransformGroup transformGroup = new TransformGroup(transform); ColorCube cube = new ColorCube(0.3); transformGroup.addChild(cube); group.addChild(transformGroup); //create a sphere Vector3f vector2 = new Vector3f(+0.3f, 0.0f, 0.0f); Transform3D transform2 = new Transform3D(); transform2.setTranslation(vector2); TransformGroup transformGroup2 = new TransformGroup(transform2); Appearance appearance = new Appearance(); appearance.setPolygonAttributes( new PolygonAttributes(PolygonAttributes.POLYGON_LINE, PolygonAttributes.CULL_BACK, 0.0f)); Sphere sphere = new Sphere(0.3f, appearance); transformGroup2.addChild(sphere); group.addChild(transformGroup2); universe.getViewingPlatform().setNominalViewingTransform(); universe.addBranchGraph(group); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent winEvent) { System.exit(0); } }); frame.add(canvas); pickCanvas = new PickCanvas(canvas, group); pickCanvas.setMode(PickCanvas.BOUNDS); canvas.addMouseListener(this); frame.pack(); frame.show(); } public static void main(String[] args) { new Pick(); } public void mouseClicked(MouseEvent e) { pickCanvas.setShapeLocation(e); PickResult result = pickCanvas.pickClosest(); if (result == null) { System.out.println("Nothing picked"); } else { Primitive p = (Primitive) result.getNode(PickResult.PRIMITIVE); Shape3D s = (Shape3D) result.getNode(PickResult.SHAPE3D); if (p != null) { System.out.println(p.getClass().getName()); } else if (s != null) { System.out.println(s.getClass().getName()); } else { System.out.println("null"); } } } }
[ "hudson.sales@SPW9712NTW7P.sondait.com.br" ]
hudson.sales@SPW9712NTW7P.sondait.com.br
ef591cfeb071c102345f96cca6a91e0a9f7a47ae
000aaf5d0dc5271860bf2a6f1ab327652697c0ef
/Practice_day10.java
7520770f762a2851c0226c1ea11f9d9b0b6f6181
[]
no_license
caoliduoer/java_code1
17f6570d642ade6462ced623bad835457d8f5f36
389a43b6faf7145cea9a74d435047f3dfe1ea9ec
refs/heads/master
2023-06-03T04:34:32.231292
2021-06-16T14:12:36
2021-06-16T14:12:36
309,994,771
0
0
null
null
null
null
UTF-8
Java
false
false
509
java
import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); while(sc.hasNext()){ int num=sc.nextInt(); for(int i=1;i<=num;i++){ for(int j=1;j<=num;j++){ if(i==j||i==num-j+1){ System.out.print("*"); }else{ System.out.print(" "); } }System.out.println(); } } } }
[ "894871274@qq.com" ]
894871274@qq.com
7da39fc093a961d5d714f579468a4cc15790b0c0
3a9270e6edca1224bca757bcfa5618ab89699dd1
/src/factoryPattern/secondStage/creator/Impl/NyPizzaStore.java
2d0c9040d813125d3db2abfc5868f34ce6f402f0
[]
no_license
icbjayasinghe/designing-patterns
425d91efff2e3bff907a4f392fe67180d99d1db1
93f0f4c524622765c5d1ad55f43f1dcf4b89b400
refs/heads/master
2023-08-27T14:31:50.467344
2021-10-09T06:15:24
2021-10-09T06:15:24
415,218,036
0
0
null
null
null
null
UTF-8
Java
false
false
958
java
package factoryPattern.secondStage.creator.Impl; import factoryPattern.secondStage.creator.PizzaStoreSS; import factoryPattern.secondStage.product.Impl.NyStyle.NyStyleCheesePizza; import factoryPattern.secondStage.product.Impl.NyStyle.NyStyleClamPizza; import factoryPattern.secondStage.product.Impl.NyStyle.NyStylePepperoniPizza; import factoryPattern.secondStage.product.Impl.NyStyle.NyStyleVeggiePizza; import factoryPattern.secondStage.product.PizzaSS; public class NyPizzaStore extends PizzaStoreSS { @Override protected PizzaSS createPizza(String type) { if (type.equals("cheese")) { return new NyStyleCheesePizza(); } else if (type.equals("veggie")) { return new NyStyleVeggiePizza(); } else if (type.equals("clam")) { return new NyStyleClamPizza(); } else if (type.equals("pepperoni")) { return new NyStylePepperoniPizza(); } else return null; } }
[ "icbjayasinghe@gmail.com" ]
icbjayasinghe@gmail.com
5d0326807d59f0b5853db41f37af617f17998806
9b03089fd13f497e0407332ea60df12307bb6737
/src/org/herac/tuxguitar/song/models/TGTrack.java
0cc78a896652756185c43a6119aa14ea0180c547
[]
no_license
McSimB/TabConverter
d259214d808fa744824195e371e8af9e89b7122c
d2f77c7ea8b8f6694376f4b927e5fe4e74053ca1
refs/heads/master
2020-04-06T07:27:45.416522
2018-11-12T20:32:44
2018-11-12T20:32:44
157,273,484
0
0
null
null
null
null
UTF-8
Java
false
false
2,684
java
package org.herac.tuxguitar.song.models; import org.herac.tuxguitar.song.factory.TGFactory; import java.util.ArrayList; import java.util.List; public abstract class TGTrack { public static final int MAX_STRINGS = 25; public static final int MIN_STRINGS = 1; public static final int MAX_OFFSET = 24; public static final int MIN_OFFSET = -24; private int number; private int offset; private int channelId; private boolean solo; private boolean mute; private String name; private List<TGMeasure> measures; private List<TGString> strings; private TGColor color; private TGLyric lyrics; private TGSong song; public TGTrack(TGFactory factory) { this.number = 0; this.offset = 0; this.channelId = -1; this.solo = false; this.mute = false; this.name = ""; this.measures = new ArrayList<TGMeasure>(); this.strings = new ArrayList<TGString>(); this.color = factory.newColor(); this.lyrics = factory.newLyric(); } public int getNumber() { return this.number; } public void setNumber(int number) { this.number = number; } public List<TGMeasure> getMeasures() { return this.measures; } public void addMeasure(TGMeasure measure) { measure.setTrack(this); this.measures.add(measure); } public TGMeasure getMeasure(int index) { if (index >= 0 && index < countMeasures()) { return this.measures.get(index); } return null; } public int countMeasures() { return this.measures.size(); } public List<TGString> getStrings() { return this.strings; } public void setStrings(List<TGString> strings) { this.strings = strings; } public TGColor getColor() { return this.color; } public void setColor(TGColor color) { this.color = color; } public String getName() { return this.name; } public void setName(String name) { this.name = name; } public int getOffset() { return this.offset; } public void setOffset(int offset) { this.offset = offset; } public boolean isSolo() { return this.solo; } public void setSolo(boolean solo) { this.solo = solo; } public boolean isMute() { return this.mute; } public void setMute(boolean mute) { this.mute = mute; } public int getChannelId() { return this.channelId; } public void setChannelId(int channelId) { this.channelId = channelId; } public TGLyric getLyrics() { return this.lyrics; } public void setLyrics(TGLyric lyrics) { this.lyrics = lyrics; } public TGString getString(int number) { return this.strings.get(number - 1); } public int stringCount() { return this.strings.size(); } public TGSong getSong() { return this.song; } public void setSong(TGSong song) { this.song = song; } }
[ "mcsim.bril@gmail.com" ]
mcsim.bril@gmail.com
8e61bef727e9cea7b8365fd31c05c7733af16d7f
427918b8abac399952ef3ded0d16f0ce22957875
/app/src/main/java/com/example/android/newsapplication/QueryUtils.java
a2cb788a2992ea3cb7a5a1c2614d44c2b803d0c9
[]
no_license
hindabdullah/NewsApplication-2-
74138d16e37b1b5808398898ac8380fea891e437
e1df02fc64f21ee40956de8328fbc0b114d1a782
refs/heads/master
2020-03-14T21:16:36.438802
2018-05-02T03:31:59
2018-05-02T03:31:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,049
java
package com.example.android.newsapplication; import android.text.TextUtils; import android.util.Log; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.nio.charset.Charset; import java.util.ArrayList; import java.util.List; /** * Created by hind on 26/01/18. */ public final class QueryUtils { public static final String LOG_TAG = QueryUtils.class.getName(); private QueryUtils() { } public static List<News> fetchData(String requestUrl) throws JSONException { URL url = createUrl(requestUrl); String jsonResponse = null; try { jsonResponse = makeHttpRequest(url); } catch (IOException e) { Log.e(LOG_TAG, "Problem making the HTTP request.", e); } List<News> News = extractFeatureFromJson(jsonResponse); return News; } private static URL createUrl(String stringUrl) { URL url = null; try { url = new URL(stringUrl); } catch (MalformedURLException e) { Log.e(LOG_TAG, "Problem building the URL ", e); } return url; } private static String makeHttpRequest(URL url) throws IOException { String jsonResponse = ""; // If the URL is null, then return early. if (url == null) { return jsonResponse; } HttpURLConnection urlConnection = null; InputStream inputStream = null; try { urlConnection = (HttpURLConnection) url.openConnection(); urlConnection.setReadTimeout(10000 /* milliseconds */); urlConnection.setConnectTimeout(15000 /* milliseconds */); urlConnection.setRequestMethod("GET"); urlConnection.connect(); if (urlConnection.getResponseCode() == 200) { // If the request was successful (response code 200),// then read the input stream and parse the response. inputStream = urlConnection.getInputStream(); jsonResponse = readFromStream(inputStream); } else { Log.e(LOG_TAG, "Error response code: " + urlConnection.getResponseCode()); } } catch (IOException e) { Log.e(LOG_TAG, "Problem retrieving the news JSON results.", e); } finally { if (urlConnection != null) { urlConnection.disconnect(); } if (inputStream != null) { inputStream.close(); } } return jsonResponse; } private static String readFromStream(InputStream inputStream) throws IOException { StringBuilder output = new StringBuilder(); if (inputStream != null) { InputStreamReader inputStreamReader = new InputStreamReader(inputStream, Charset.forName("UTF-8")); BufferedReader reader = new BufferedReader(inputStreamReader); String line = reader.readLine(); while (line != null) { output.append(line); line = reader.readLine(); } } return output.toString(); } private static List<News> extractFeatureFromJson(String newsJSON) throws JSONException { if (TextUtils.isEmpty(newsJSON)) { return null; } List<News> newsItems = new ArrayList<>(); try { JSONObject baseJSONObject = new JSONObject(newsJSON); JSONObject response = baseJSONObject.getJSONObject("response"); JSONArray newsResults = response.getJSONArray("results"); for (int i = 0; i < newsResults.length(); i++) { JSONObject news = newsResults.getJSONObject(i); String webTitle = news.getString("webTitle"); String Date = news.getString("webPublicationDate"); String Section = news.getString("sectionName"); String WebURL = news.getString("webUrl"); JSONArray tagsArray = news.getJSONArray("tags"); // Extract the value for the key called "byline" (author) String Author = ""; if (news.has("tags")) { if (tagsArray.length() > 0) { for (int author = 0; author < 1; author++) { JSONObject tags = tagsArray.getJSONObject(author); if (tags.has("webTitle")) { Author = tags.getString("webTitle"); } } } } newsItems.add(new News(webTitle, Date, Author, Section, WebURL)); } } catch (JSONException e) { Log.e("QueryUtils", "Problem parsing the news JSON results", e); } return newsItems; } }
[ "hind@youremail.com" ]
hind@youremail.com
80902469f6ca5c35eedfaef1121c0d5e16660776
d8dbfda849cf451a9e67c6d46a260960aa05861d
/ui/test-src/org/pentaho/di/ui/repository/repositoryexplorer/controllers/ConnectionsControllerTest.java
433942e058d13063b8882733bdbd07370a995b1e
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
JustGOGO/pentaho-kettle
72a92c6aa502b9ebdfa21b5f68e94fc42eceaeeb
c579d7ecadaecc9bc18b26f57a5741c9380f96e5
refs/heads/master
2021-01-14T09:29:07.115305
2015-11-02T21:19:25
2015-11-02T21:19:25
45,448,556
2
0
null
2015-11-03T07:13:55
2015-11-03T07:13:55
null
UTF-8
Java
false
false
7,064
java
/*! ****************************************************************************** * * Pentaho Data Integration * * Copyright (C) 2002-2015 by Pentaho : http://www.pentaho.com * ******************************************************************************* * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ******************************************************************************/ package org.pentaho.di.ui.repository.repositoryexplorer.controllers; import org.apache.commons.lang.reflect.FieldUtils; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import org.pentaho.di.core.KettleEnvironment; import org.pentaho.di.core.ProgressMonitorListener; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.repository.Repository; import org.pentaho.di.repository.StringObjectId; import org.pentaho.di.ui.core.database.dialog.DatabaseDialog; import org.pentaho.di.ui.repository.repositoryexplorer.model.UIDatabaseConnection; import org.pentaho.ui.xul.containers.XulTree; import java.util.List; import static java.util.Collections.singletonList; import static org.mockito.Mockito.*; /** * @author Andrey Khayrutdinov */ public class ConnectionsControllerTest { @BeforeClass public static void initKettle() throws Exception { KettleEnvironment.init(); } private ConnectionsController controller; private DatabaseDialog databaseDialog; private Repository repository; private XulTree connectionsTable; @Before public void setUp() throws Exception { // a tricky initialisation - first inject private fields controller = new ConnectionsController(); connectionsTable = mock( XulTree.class ); FieldUtils.writeDeclaredField( controller, "connectionsTable", connectionsTable, true ); // and then spy the controller controller = spy( controller ); databaseDialog = mock( DatabaseDialog.class ); doReturn( databaseDialog ).when( controller ).getDatabaseDialog(); doNothing().when( controller ).refreshConnectionList(); doNothing().when( controller ).showAlreadyExistsMessage(); repository = mock( Repository.class ); controller.init( repository ); } @Test public void createConnection_EmptyName() throws Exception { when( databaseDialog.open() ).thenReturn( "" ); controller.createConnection(); // repository was not accessed verify( repository, never() ).getDatabaseID( anyString() ); verify( repository, never() ).save( any( DatabaseMeta.class ), anyString(), any( ProgressMonitorListener.class ) ); } @Test public void createConnection_NameExists() throws Exception { final String dbName = "name"; when( databaseDialog.open() ).thenReturn( dbName ); when( repository.getDatabaseID( dbName ) ).thenReturn( new StringObjectId( "existing" ) ); controller.createConnection(); assertShowedAlreadyExistsMessage(); } @Test public void createConnection_NewName() throws Exception { final String dbName = "name"; when( databaseDialog.open() ).thenReturn( dbName ); when( databaseDialog.getDatabaseMeta() ).thenReturn( new DatabaseMeta() ); when( repository.getDatabaseID( dbName ) ).thenReturn( null ); controller.createConnection(); assertRepositorySavedDb(); } @Test public void editConnection_EmptyName() throws Exception { final String dbName = "name"; List<UIDatabaseConnection> selectedConnection = createSelectedConnectionList( dbName ); when( connectionsTable.<UIDatabaseConnection>getSelectedItems() ).thenReturn( selectedConnection ); when( repository.getDatabaseID( dbName ) ).thenReturn( new StringObjectId( "existing" ) ); when( databaseDialog.open() ).thenReturn( "" ); controller.editConnection(); // repository.save() was not invoked verify( repository, never() ).save( any( DatabaseMeta.class ), anyString(), any( ProgressMonitorListener.class ) ); } @Test public void editConnection_NameExists_Same() throws Exception { final String dbName = "name"; List<UIDatabaseConnection> selectedConnection = createSelectedConnectionList( dbName ); when( connectionsTable.<UIDatabaseConnection>getSelectedItems() ).thenReturn( selectedConnection ); when( repository.getDatabaseID( dbName ) ).thenReturn( new StringObjectId( "existing" ) ); when( databaseDialog.open() ).thenReturn( dbName ); controller.editConnection(); assertRepositorySavedDb(); } @Test public void editConnection_NameDoesNotExist() throws Exception { final String dbName = "name"; List<UIDatabaseConnection> selectedConnection = createSelectedConnectionList( dbName ); when( connectionsTable.<UIDatabaseConnection>getSelectedItems() ).thenReturn( selectedConnection ); when( repository.getDatabaseID( dbName ) ).thenReturn( new StringObjectId( "existing" ) ); when( databaseDialog.open() ).thenReturn( "non-existing-name" ); controller.editConnection(); assertRepositorySavedDb(); } @Test public void editConnection_NameExists_Different() throws Exception { final String dbName = "name"; List<UIDatabaseConnection> selectedConnection = createSelectedConnectionList( dbName ); when( connectionsTable.<UIDatabaseConnection>getSelectedItems() ).thenReturn( selectedConnection ); final String anotherName = "anotherName"; when( repository.getDatabaseID( dbName ) ).thenReturn( new StringObjectId( "existing" ) ); when( repository.getDatabaseID( anotherName ) ).thenReturn( new StringObjectId( "another-existing" ) ); when( databaseDialog.open() ).thenReturn( anotherName ); controller.editConnection(); assertShowedAlreadyExistsMessage(); } private List<UIDatabaseConnection> createSelectedConnectionList( String selectedDbName ) { DatabaseMeta meta = new DatabaseMeta(); meta.setName( selectedDbName ); return singletonList( new UIDatabaseConnection( meta, repository ) ); } private void assertShowedAlreadyExistsMessage() throws KettleException { // repository.save() was not invoked verify( repository, never() ).save( any( DatabaseMeta.class ), anyString(), any( ProgressMonitorListener.class ) ); // instead the error dialog was shown verify( controller ).showAlreadyExistsMessage(); } private void assertRepositorySavedDb() throws KettleException { // repository.save() was invoked verify( repository ).save( any( DatabaseMeta.class ), anyString(), any( ProgressMonitorListener.class ) ); } }
[ "andrey_khayrutdinov@epam.com" ]
andrey_khayrutdinov@epam.com
eb041af93c97d6ad7ba120a452d955d546fbfd3c
05c277cbb304b06086b714a1fd28a2d691f6d2bc
/src/test/java/thrift/model/transaction/DescriptionOrRemarkContainsKeywordsPredicateTest.java
e49d15fc47b0e22cc1fa5762c3e34a7556f2f82d
[ "MIT" ]
permissive
lye-jw/main
0c737c26e0b7730c79c83adf74a23ea331511605
f3442b7397ba352daf7083b4fd385143915a1e47
refs/heads/master
2020-07-23T06:36:51.445857
2019-11-04T06:06:41
2019-11-04T06:06:41
207,475,061
1
0
NOASSERTION
2019-09-10T05:46:34
2019-09-10T05:46:32
null
UTF-8
Java
false
false
3,505
java
package thrift.model.transaction; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.junit.jupiter.api.Test; import thrift.testutil.ExpenseBuilder; public class DescriptionOrRemarkContainsKeywordsPredicateTest { @Test public void equals() { List<String> firstPredicateKeywordList = Collections.singletonList("first"); List<String> secondPredicateKeywordList = Arrays.asList("first", "second"); DescriptionOrRemarkContainsKeywordsPredicate firstPredicate = new DescriptionOrRemarkContainsKeywordsPredicate( firstPredicateKeywordList); DescriptionOrRemarkContainsKeywordsPredicate secondPredicate = new DescriptionOrRemarkContainsKeywordsPredicate( secondPredicateKeywordList); // same object -> returns true assertTrue(firstPredicate.equals(firstPredicate)); // same values -> returns true DescriptionOrRemarkContainsKeywordsPredicate firstPredicateCopy = new DescriptionOrRemarkContainsKeywordsPredicate(firstPredicateKeywordList); assertTrue(firstPredicate.equals(firstPredicateCopy)); // different types -> returns false assertFalse(firstPredicate.equals(1)); // null -> returns false assertFalse(firstPredicate.equals(null)); // different transaction -> returns false assertFalse(firstPredicate.equals(secondPredicate)); } @Test public void test_descriptionContainsKeywords_returnsTrue() { // One keyword DescriptionOrRemarkContainsKeywordsPredicate predicate = new DescriptionOrRemarkContainsKeywordsPredicate( Collections.singletonList("Alice")); assertTrue(predicate.test(new ExpenseBuilder().withDescription("Alice Bob").build())); // Multiple keywords predicate = new DescriptionOrRemarkContainsKeywordsPredicate(Arrays.asList("Alice", "Bob")); assertTrue(predicate.test(new ExpenseBuilder().withDescription("Alice Bob").build())); // Only one matching keyword predicate = new DescriptionOrRemarkContainsKeywordsPredicate(Arrays.asList("Bob", "Carol")); assertTrue(predicate.test(new ExpenseBuilder().withDescription("Alice Carol").build())); // Mixed-case keywords predicate = new DescriptionOrRemarkContainsKeywordsPredicate(Arrays.asList("aLIce", "bOB")); assertTrue(predicate.test(new ExpenseBuilder().withDescription("Alice Bob").build())); } @Test public void test_descriptionDoesNotContainKeywords_returnsFalse() { // Zero keywords DescriptionOrRemarkContainsKeywordsPredicate predicate = new DescriptionOrRemarkContainsKeywordsPredicate( Collections.emptyList()); assertFalse(predicate.test(new ExpenseBuilder().withDescription("Alice").build())); // Non-matching keyword predicate = new DescriptionOrRemarkContainsKeywordsPredicate(Arrays.asList("Carol")); assertFalse(predicate.test(new ExpenseBuilder().withDescription("Alice Bob").build())); // Keywords match value, but does not match name predicate = new DescriptionOrRemarkContainsKeywordsPredicate(Arrays.asList("12345", "Hearing", "$999")); assertFalse(predicate.test(new ExpenseBuilder().withDescription("Airpods").withValue("12345").build())); } }
[ "45726091+lightz96@users.noreply.github.com" ]
45726091+lightz96@users.noreply.github.com
0c8da18dc719d49b5968e9cbcdccfcebf0d9c7f9
465c23635015145347f21bcc02b857be9c8bb536
/src/test/java/com/joesea/codebuilder/CodeBuilderApplicationTests.java
3b7cbd4f985b400efcf3fc8315a6f24359a852c4
[]
no_license
JoeseaLea/code-builder
d3a5b84dc940b6aca96c0bac8dd423bef463f7f1
c6cb9acde75143c072339553f403968c666fd0d5
refs/heads/master
2021-01-03T17:20:35.165306
2020-02-24T02:50:50
2020-02-24T02:50:50
240,166,687
0
0
null
null
null
null
UTF-8
Java
false
false
228
java
package com.joesea.codebuilder; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class CodeBuilderApplicationTests { @Test void contextLoads() { } }
[ "joesealea@JoeseadeMacBook-Pro.local" ]
joesealea@JoeseadeMacBook-Pro.local
a64b0eb4d1f9354d5c3716804fc51c8ddb4cbb29
77c213bc5afddde9e0ce0b8b5125d94eab5ddc43
/app/femr/ui/models/medical/UpdateVitalsModel.java
58601876b0e9d62a563d40c5efa496b234c6c1f7
[ "MIT" ]
permissive
NJR44/femr
799bd4bb61d8d49f35fe576bc94d0d54071416c2
35c4b2827a43bc7e7d0c65e02e983679ab29baae
refs/heads/master
2021-01-21T17:50:51.456889
2013-12-07T22:02:47
2013-12-07T22:02:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,768
java
package femr.ui.models.medical; public class UpdateVitalsModel { private double bpSystolic; private double bpDiastolic; private double heartRate; private double temperature; private double oxygen; private double respRate; private double heightFt; private double heightIn; private double weight; public double getBpSystolic() { return bpSystolic; } public void setBpSystolic(double bpSystolic) { this.bpSystolic = bpSystolic; } public double getBpDiastolic() { return bpDiastolic; } public void setBpDiastolic(double bpDiastolic) { this.bpDiastolic = bpDiastolic; } public double getHeartRate() { return heartRate; } public void setHeartRate(double heartRate) { this.heartRate = heartRate; } public double getTemperature() { return temperature; } public void setTemperature(double temperature) { this.temperature = temperature; } public double getOxygen() { return oxygen; } public void setOxygen(double oxygen) { this.oxygen = oxygen; } public double getRespRate() { return respRate; } public void setRespRate(double respRate) { this.respRate = respRate; } public double getHeightFt() { return heightFt; } public void setHeightFt(double heightFt) { this.heightFt = heightFt; } public double getHeightIn() { return heightIn; } public void setHeightIn(double heightIn) { this.heightIn = heightIn; } public double getWeight() { return weight; } public void setWeight(double weight) { this.weight = weight; } }
[ "stephencavaliere@gmail.com" ]
stephencavaliere@gmail.com
4a4715a5688c11e6ec3f39fc62a7db6c229604df
41ffa8f2677e2d425e88da12d8c655ba06dd1231
/app/src/test/java/com/thekhaeng/library/uiadjustlibrary/ExampleUnitTest.java
6df28efc46fe2fcf763f3c80d4ee99394ba2ecdd
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
nontravis/ui-adjustment-library
4fefab43988e16edbb03ce63d07cf00275e7bbb9
258776d9cc557c48739c6c196894d8e2ec353ed1
refs/heads/master
2022-04-28T21:54:13.466229
2018-03-17T09:33:35
2018-03-17T09:33:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
415
java
package com.thekhaeng.library.uiadjustlibrary; 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 ); } }
[ "nonthawit.kub@gmail.com" ]
nonthawit.kub@gmail.com
405c68ad4d85f120ac06d7c025a0f4d84cc72d92
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/5/5_93a052a0208acb5ad0ad4cb81fbc13469f9b5901/GenbankFormat/5_93a052a0208acb5ad0ad4cb81fbc13469f9b5901_GenbankFormat_s.java
52a9ab52fbfb2b9903dcb37d88fc5270cf66dc16
[]
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
35,839
java
/* * BioJava development code * * This code may be freely distributed and modified under the * terms of the GNU Lesser General Public Licence. This should * be distributed with the code. If you do not have a copy, * see: * * http://www.gnu.org/copyleft/lesser.html * * Copyright for this code is held jointly by the individual * authors. These should be listed in @author doc comments. * * For more information on the BioJava project and its aims, * or to join the biojava-l mailing list, visit the home page * at: * * http://www.biojava.org/ * */ package org.biojavax.bio.seq.io; import java.io.BufferedReader; import java.io.IOException; import java.io.PrintStream; import java.util.ArrayList; import java.util.TreeSet; import java.util.Iterator; import java.util.List; import java.util.Set; import java.util.Vector; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.biojava.bio.seq.Sequence; import org.biojava.bio.seq.io.ParseException; import org.biojava.bio.seq.io.SeqIOListener; import org.biojava.bio.seq.io.SymbolTokenization; import org.biojava.bio.symbol.AlphabetManager; import org.biojava.bio.symbol.IllegalSymbolException; import org.biojava.bio.symbol.SimpleSymbolList; import org.biojava.bio.symbol.Symbol; import org.biojava.bio.symbol.SymbolList; import org.biojava.utils.ChangeVetoException; import org.biojava.utils.ParseErrorListener; import org.biojavax.Comment; import org.biojavax.CrossRef; import org.biojavax.DocRef; import org.biojavax.Note; import org.biojavax.RankedCrossRef; import org.biojavax.RankedDocRef; import org.biojavax.SimpleComment; import org.biojavax.SimpleCrossRef; import org.biojavax.SimpleDocRef; import org.biojavax.SimpleRankedCrossRef; import org.biojavax.SimpleRankedDocRef; import org.biojavax.SimpleRichAnnotation; import org.biojavax.bio.db.RichObjectFactory; import org.biojavax.bio.seq.RichFeature; import org.biojavax.bio.seq.RichLocation; import org.biojavax.bio.seq.RichSequence; import org.biojavax.bio.taxa.NCBITaxon; import org.biojavax.bio.taxa.SimpleNCBITaxon; import org.biojavax.ontology.ComparableTerm; /** * Format reader for GenBank files. Converted from the old style io to * the new by working from <code>EmblLikeFormat</code>. * * @author Thomas Down * @author Thad Welch * Added GenBank header info to the sequence annotation. The ACCESSION header * tag is not included. Stored in sequence.getName(). * @author Greg Cox * @author Keith James * @author Matthew Pocock * @author Ron Kuhn * Implemented nice RichSeq stuff. * @author Richard Holland */ public class GenbankFormat implements RichSequenceFormat { public static final String DEFAULT_FORMAT = "GENBANK"; protected static final String LOCUS_TAG = "LOCUS"; protected static final String ACCESSION_TAG = "ACCESSION"; protected static final String VERSION_TAG = "VERSION"; protected static final String DEFINITION_TAG = "DEFINITION"; protected static final String SOURCE_TAG = "SOURCE"; protected static final String ORGANISM_TAG = "ORGANISM"; protected static final String REFERENCE_TAG = "REFERENCE"; protected static final String KEYWORDS_TAG = "KEYWORDS"; protected static final String AUTHORS_TAG = "AUTHORS"; protected static final String TITLE_TAG = "TITLE"; protected static final String JOURNAL_TAG = "JOURNAL"; protected static final String PUBMED_TAG = "PUBMED"; protected static final String MEDLINE_TAG = "MEDLINE"; protected static final String REMARK_TAG = "REMARK"; protected static final String COMMENT_TAG = "COMMENT"; protected static final String FEATURE_TAG = "FEATURES"; protected static final String BASE_COUNT_TAG = "BASE"; protected static final String START_SEQUENCE_TAG = "ORIGIN"; protected static final String END_SEQUENCE_TAG = "//"; private static ComparableTerm ACCESSION_TERM = null; public static ComparableTerm getAccessionTerm() { if (ACCESSION_TERM==null) ACCESSION_TERM = RichObjectFactory.getDefaultOntology().getOrCreateTerm("ACCESSION"); return ACCESSION_TERM; } private static ComparableTerm KERYWORDS_TERM = null; private static ComparableTerm getKeywordsTerm() { if (KERYWORDS_TERM==null) KERYWORDS_TERM = RichObjectFactory.getDefaultOntology().getOrCreateTerm("KEYWORDS"); return KERYWORDS_TERM; } private static ComparableTerm MODIFICATION_TERM = null; private static ComparableTerm getModificationTerm() { if (MODIFICATION_TERM==null) MODIFICATION_TERM = RichObjectFactory.getDefaultOntology().getOrCreateTerm("MDAT"); return MODIFICATION_TERM; } private static ComparableTerm MOLTYPE_TERM = null; public static ComparableTerm getMolTypeTerm() { if (MOLTYPE_TERM==null) MOLTYPE_TERM = RichObjectFactory.getDefaultOntology().getOrCreateTerm("MOLTYPE"); return MOLTYPE_TERM; } private static ComparableTerm STRANDED_TERM = null; private static ComparableTerm getStrandedTerm() { if (STRANDED_TERM==null) STRANDED_TERM = RichObjectFactory.getDefaultOntology().getOrCreateTerm("STRANDED"); return STRANDED_TERM; } private static ComparableTerm GENBANK_TERM = null; private static ComparableTerm getGenBankTerm() { if (GENBANK_TERM==null) GENBANK_TERM = RichObjectFactory.getDefaultOntology().getOrCreateTerm("GenBank"); return GENBANK_TERM; } private boolean elideSymbols = false; /** * The line width for output. */ protected int lineWidth = 80; /** * Retrive the current line width. * * @return the line width */ public int getLineWidth() { return lineWidth; } /** * Set the line width. * <p> * When writing, the lines of sequence will never be longer than the line * width. * * @param width the new line width */ public void setLineWidth(int width) { this.lineWidth = width; } public boolean readSequence(BufferedReader reader, SymbolTokenization symParser, SeqIOListener listener) throws IllegalSymbolException, IOException, ParseException { if (!(listener instanceof RichSeqIOListener)) throw new IllegalArgumentException("Only accepting RichSeqIOListeners today"); return this.readRichSequence(reader,symParser,(RichSeqIOListener)listener); } /** * Reads a sequence from the specified reader using the Symbol * parser and Sequence Factory provided. The sequence read in must * be in Genbank format. * * @return boolean True if there is another sequence in the file; false * otherwise */ public boolean readRichSequence(BufferedReader reader, SymbolTokenization symParser, RichSeqIOListener rlistener) throws IllegalSymbolException, IOException, ParseException { String line; boolean hasAnotherSequence = true; boolean hasInternalWhitespace = false; rlistener.startSequence(); rlistener.setNamespace(RichObjectFactory.getGenbankNamespace()); // Get an ordered list of key->value pairs in array-tuples String sectionKey = null; NCBITaxon tax = null; String organism = null; String accession = null; do { List section = this.readSection(reader); sectionKey = ((String[])section.get(0))[0]; // process section-by-section if (sectionKey.equals(LOCUS_TAG)) { String loc = ((String[])section.get(0))[1]; String regex = "^(\\S+)\\s+\\d+\\s+bp\\s+([dms]s-)?(\\S+)\\s+(circular|linear)?\\s+(\\S+)\\s+(\\S+)$"; Pattern p = Pattern.compile(regex); Matcher m = p.matcher(loc); if (m.matches()) { rlistener.setName(m.group(1)); rlistener.setDivision(m.group(5)); rlistener.addSequenceProperty(getMolTypeTerm(),m.group(3)); rlistener.addSequenceProperty(getModificationTerm(),m.group(6)); // Optional extras String stranded = m.group(2); String circular = m.group(4); if (stranded!=null) rlistener.addSequenceProperty(getStrandedTerm(),stranded); if (circular!=null && circular.equals("circular")) rlistener.setCircular(true); } else { throw new ParseException("Bad locus line found: "+loc); } } else if (sectionKey.equals(DEFINITION_TAG)) { rlistener.setDescription(((String[])section.get(0))[1]); } else if (sectionKey.equals(ACCESSION_TAG)) { // if multiple accessions, store only first as accession, // and store rest in annotation String[] accs = ((String[])section.get(0))[1].split("\\s+"); accession = accs[0].trim(); rlistener.setAccession(accession); for (int i = 1; i < accs.length; i++) { rlistener.addSequenceProperty(getAccessionTerm(),accs[i].trim()); } } else if (sectionKey.equals(VERSION_TAG)) { String ver = ((String[])section.get(0))[1]; String regex = "^(\\S+?)\\.(\\d+)\\s+GI:(\\S+)$"; Pattern p = Pattern.compile(regex); Matcher m = p.matcher(ver); if (m.matches()) { rlistener.setVersion(Integer.parseInt(m.group(2))); rlistener.setIdentifier(m.group(3)); } else { throw new ParseException("Bad version line found: "+ver); } } else if (sectionKey.equals(KEYWORDS_TAG)) { rlistener.addSequenceProperty(getKeywordsTerm(), ((String[])section.get(0))[1]); } else if (sectionKey.equals(SOURCE_TAG)) { // ignore - can get all this from the first feature } else if (sectionKey.equals(REFERENCE_TAG)) { // first line of section has rank and location int ref_rank; int ref_start = -999; int ref_end = -999; String ref = ((String[])section.get(0))[1]; String regex = "^(\\d+)\\s*(\\(bases\\s+(\\d+)\\s+to\\s+(\\d+)\\)|\\(sites\\))?"; Pattern p = Pattern.compile(regex); Matcher m = p.matcher(ref); if (m.matches()) { ref_rank = Integer.parseInt(m.group(1)); if(m.group(2) != null){ if (m.group(3)!= null) ref_start = Integer.parseInt(m.group(3)); if(m.group(4) != null) ref_end = Integer.parseInt(m.group(4)); } } else { throw new ParseException("Bad reference line found: "+ref); } // rest can be in any order String authors = null; String title = null; String journal = null; String medline = null; String pubmed = null; String remark = null; for (int i = 1; i < section.size(); i++) { String key = ((String[])section.get(i))[0]; String val = ((String[])section.get(i))[1]; if (key.equals("AUTHORS")) authors = val; if (key.equals("TITLE")) title = val; if (key.equals("JOURNAL")) journal = val; if (key.equals("MEDLINE")) medline = val; if (key.equals("PUBMED")) pubmed = val; if (key.equals("REMARK")) authors = val; } // create the pubmed crossref and assign to the bioentry CrossRef pcr = null; if (pubmed!=null) { pcr = (CrossRef)RichObjectFactory.getObject(SimpleCrossRef.class,new Object[]{"PUBMED", pubmed}); RankedCrossRef rpcr = new SimpleRankedCrossRef(pcr, 0); rlistener.setRankedCrossRef(rpcr); } // create the medline crossref and assign to the bioentry CrossRef mcr = null; if (medline!=null) { mcr = (CrossRef)RichObjectFactory.getObject(SimpleCrossRef.class,new Object[]{"MEDLINE", medline}); RankedCrossRef rmcr = new SimpleRankedCrossRef(mcr, 0); rlistener.setRankedCrossRef(rmcr); } // create the docref object try { DocRef dr = (DocRef)RichObjectFactory.getObject(SimpleDocRef.class,new Object[]{authors,journal}); if (title!=null) dr.setTitle(title); // assign either the pubmed or medline to the docref if (pcr!=null) dr.setCrossref(pcr); else if (mcr!=null) dr.setCrossref(mcr); // assign the remarks dr.setRemark(remark); // assign the docref to the bioentry RankedDocRef rdr = new SimpleRankedDocRef(dr, (ref_start != -999 ? new Integer(ref_start) : null), (ref_end != -999 ? new Integer(ref_end) : null), ref_rank); rlistener.setRankedDocRef(rdr); } catch (ChangeVetoException e) { throw new ParseException(e); } } else if (sectionKey.equals(COMMENT_TAG)) { // Set up some comments rlistener.setComment(((String[])section.get(0))[1]); } else if (sectionKey.equals(FEATURE_TAG)) { // starting from second line of input, start a new feature whenever we come across // a key that does not start with / boolean seenAFeature = false; for (int i = 1 ; i < section.size(); i++) { String key = ((String[])section.get(i))[0]; String val = ((String[])section.get(i))[1]; if (key.startsWith("/")) { key = key.substring(1); // strip leading slash val = val.replaceAll("\"","").trim(); // strip quotes // parameter on old feature if (key.equals("db_xref")) { String regex = "^(\\S+?):(\\S+)$"; Pattern p = Pattern.compile(regex); Matcher m = p.matcher(val); if (m.matches()) { String dbname = m.group(1); String raccession = m.group(2); if (dbname.equals("taxon")) { // Set the Taxon instead of a dbxref tax = (NCBITaxon)RichObjectFactory.getObject(SimpleNCBITaxon.class, new Object[]{Integer.valueOf(raccession)}); rlistener.setTaxon(tax); try { if (organism!=null) tax.addName(NCBITaxon.SCIENTIFIC,organism); } catch (ChangeVetoException e) { throw new ParseException(e); } } else { try { CrossRef cr = (CrossRef)RichObjectFactory.getObject(SimpleCrossRef.class,new Object[]{dbname, raccession}); RankedCrossRef rcr = new SimpleRankedCrossRef(cr, 0); rlistener.getCurrentFeature().addRankedCrossRef(rcr); } catch (ChangeVetoException e) { throw new ParseException(e); } } } else { throw new ParseException("Bad dbxref found: "+val); } } else if (key.equals("organism")) { try { organism = val; if (tax!=null) tax.addName(NCBITaxon.SCIENTIFIC,organism); } catch (ChangeVetoException e) { throw new ParseException(e); } } else { if (key.equals("translation")) { // strip spaces from sequence val = val.replaceAll("\\s+",""); } rlistener.addFeatureProperty(RichObjectFactory.getDefaultOntology().getOrCreateTerm(key),val); } } else { // new feature! // end previous feature if (seenAFeature) rlistener.endFeature(); // start next one, with lots of lovely info in it RichFeature.Template templ = new RichFeature.Template(); templ.annotation = new SimpleRichAnnotation(); templ.sourceTerm = getGenBankTerm(); templ.typeTerm = RichObjectFactory.getDefaultOntology().getOrCreateTerm(key); templ.featureRelationshipSet = new TreeSet(); templ.rankedCrossRefs = new TreeSet(); String tidyLocStr = val.replaceAll("\\s+",""); templ.location = GenbankLocationParser.parseLocation(RichObjectFactory.getDefaultLocalNamespace(), accession, tidyLocStr); rlistener.startFeature(templ); seenAFeature = true; } } if (seenAFeature) rlistener.endFeature(); } else if (sectionKey.equals(BASE_COUNT_TAG)) { // ignore - can calculate from sequence content later if needed } else if (sectionKey.equals(START_SEQUENCE_TAG) && !this.elideSymbols) { // our first line is ignorable as it is the ORIGIN tag // the second line onwards conveniently have the number as // the [0] tuple, and sequence string as [1] so all we have // to do is concat the [1] parts and then strip out spaces, // and replace '.' and '~' with '-' for our parser. StringBuffer seq = new StringBuffer(); for (int i = 1 ; i < section.size(); i++) seq.append(((String[])section.get(i))[1]); try { SymbolList sl = new SimpleSymbolList(symParser, seq.toString().replaceAll("\\s+","").replaceAll("[\\.|~]","-")); rlistener.addSymbols(symParser.getAlphabet(), (Symbol[])(sl.toList().toArray(new Symbol[0])), 0, sl.length()); } catch (Exception e) { throw new ParseException(e); } } } while (!sectionKey.equals(END_SEQUENCE_TAG)); // Allows us to tolerate trailing whitespace without // thinking that there is another Sequence to follow while (true) { reader.mark(1); int c = reader.read(); if (c == -1) { hasAnotherSequence = false; break; } if (Character.isWhitespace((char) c)) { hasInternalWhitespace = true; continue; } if (hasInternalWhitespace) System.err.println("Warning: whitespace found between sequence entries"); reader.reset(); break; } // Finish up. rlistener.endSequence(); return hasAnotherSequence; } private List readSection(BufferedReader br) throws ParseException { List section = new ArrayList(); String line; String currKey = null; StringBuffer currVal = new StringBuffer(); boolean done = false; int linecount = 0; //s0-8 word s1-7 value //s21 /word = value //s21 /word String regex = "^(\\s{0,8}(\\S+)\\s{1,7}(.*)|\\s{21}(/\\S+?)=(.*)|\\s{21}(/\\S+))$"; Pattern p = Pattern.compile(regex); try { while (!done) { br.mark(160); line = br.readLine(); if (line==null || line.equals("") || (line.charAt(0)!=' ' && linecount++>0)) { // dump out last part of section section.add(new String[]{currKey,currVal.toString()}); br.reset(); done = true; } else { Matcher m = p.matcher(line); if (m.matches()) { // new key if (currKey!=null) section.add(new String[]{currKey,currVal.toString()}); // key = group(2) or group(4) or group(6) - whichever is not null currKey = m.group(2)==null?(m.group(4)==null?m.group(6):m.group(4)):m.group(2); currVal = new StringBuffer(); // val = group(3) if group(2) not null, group(5) if group(4) not null, "" otherwise, trimmed currVal.append((m.group(2)==null?(m.group(4)==null?"":m.group(5)):m.group(3)).trim()); } else { line = line.trim(); // concatted line or SEQ START/END line? if (line.equals(START_SEQUENCE_TAG) || line.equals(END_SEQUENCE_TAG)) currKey = line; else { currVal.append("\n"); // newline in between lines - can be removed later currVal.append(line); } } } } } catch (IOException e) { throw new ParseException(e); } return section; } public void writeSequence(Sequence seq, PrintStream os) throws IOException { if (!(seq instanceof RichSequence)) throw new IllegalArgumentException("Sorry, only RichSequence objects accepted"); this.writeRichSequence((RichSequence)seq, os); } public void writeRichSequence(RichSequence seq, PrintStream os) throws IOException { writeRichSequence(seq, getDefaultFormat(), os); } public void writeSequence(Sequence seq, String format, PrintStream os) throws IOException { if (!(seq instanceof RichSequence)) throw new IllegalArgumentException("Sorry, only RichSequence objects accepted"); this.writeRichSequence((RichSequence)seq, format, os); } /** * <code>writeSequence</code> writes a sequence to the specified * <code>PrintStream</code>, using the specified format. * * @param seq a <code>Sequence</code> to write out. * @param format a <code>String</code> indicating which sub-format * of those available from a particular * <code>SequenceFormat</code> implemention to use when * writing. * @param os a <code>PrintStream</code> object. * * @exception IOException if an error occurs. * @deprecated use writeSequence(Sequence seq, PrintStream os) */ public void writeRichSequence(RichSequence rs, String format, PrintStream os) throws IOException { // Genbank only really - others are treated identically for now if (!( format.equalsIgnoreCase("GENBANK") )) throw new IllegalArgumentException("Unknown format: "+format); SymbolTokenization tok; try { tok = rs.getAlphabet().getTokenization("token"); } catch (Exception e) { throw new RuntimeException("Unable to get alphabet tokenizer",e); } Set notes = rs.getNoteSet(); String accession = rs.getAccession(); String accessions = accession; String stranded = ""; String mdat = ""; String moltype = rs.getAlphabet().getName(); for (Iterator i = notes.iterator(); i.hasNext(); ) { Note n = (Note)i.next(); if (n.getTerm().equals(getStrandedTerm())) stranded=n.getValue(); else if (n.getTerm().equals(getModificationTerm())) mdat=n.getValue(); else if (n.getTerm().equals(getMolTypeTerm())) moltype=n.getValue(); else if (n.getTerm().equals(getAccessionTerm())) accessions = accessions+" "+n.getValue(); } // locus(name) + length + alpha + div + date line StringBuffer locusLine = new StringBuffer(); locusLine.append(RichSequenceFormat.Tools.rightPad(rs.getName(),10)); locusLine.append(RichSequenceFormat.Tools.leftPad(""+rs.length(),7)); locusLine.append(" bp "); locusLine.append(RichSequenceFormat.Tools.leftPad(stranded,3)); locusLine.append(RichSequenceFormat.Tools.rightPad(moltype,6)); locusLine.append(RichSequenceFormat.Tools.rightPad(rs.getCircular()?"circular":"",10)); locusLine.append(RichSequenceFormat.Tools.rightPad(rs.getDivision()==null?"":rs.getDivision(),10)); locusLine.append(mdat); this.writeWrappedLine(LOCUS_TAG, 12, locusLine.toString(), os); // definition line this.writeWrappedLine(DEFINITION_TAG, 12, rs.getDescription(), os); // accession line this.writeWrappedLine(ACCESSION_TAG, 12, accessions, os); // version + gi line String version = accession+"."+rs.getVersion(); if (rs.getIdentifier()!=null) version = version + " GI:"+rs.getIdentifier(); this.writeWrappedLine(VERSION_TAG, 12, version, os); // keywords line String keywords = null; for (Iterator n = notes.iterator(); n.hasNext(); ) { Note nt = (Note)n.next(); if (nt.getTerm().equals(getKeywordsTerm())) { if (keywords==null) keywords = nt.getValue(); else keywords = keywords+" "+nt.getValue(); } } if (keywords==null) keywords ="."; this.writeWrappedLine(KEYWORDS_TAG, 12, keywords, os); // source line (from taxon) // organism line NCBITaxon tax = rs.getTaxon(); if (tax!=null) { String[] sciNames = (String[])tax.getNames(NCBITaxon.SCIENTIFIC).toArray(new String[0]); if (sciNames.length>0) { this.writeWrappedLine(SOURCE_TAG, 12, sciNames[0], os); this.writeWrappedLine(" "+ORGANISM_TAG, 12, sciNames[0], os); } } // references - rank (bases x to y) for (Iterator r = rs.getRankedDocRefs().iterator(); r.hasNext(); ) { RankedDocRef rdr = (RankedDocRef)r.next(); DocRef d = rdr.getDocumentReference(); this.writeWrappedLine(REFERENCE_TAG, 12, rdr.getRank()+" (bases "+rdr.getStart()+" to "+rdr.getEnd()+")", os); if (d.getAuthors()!=null) this.writeWrappedLine(" "+AUTHORS_TAG, 12, d.getAuthors(), os); this.writeWrappedLine(" "+TITLE_TAG, 12, d.getTitle(), os); this.writeWrappedLine(" "+JOURNAL_TAG, 12, d.getLocation(), os); CrossRef c = d.getCrossref(); if (c!=null) this.writeWrappedLine(" "+c.getDbname().toUpperCase(), 12, c.getAccession(), os); if (d.getRemark()!=null) this.writeWrappedLine(" "+REMARK_TAG, 12, d.getRemark(), os); } // comments - if any if (!rs.getComments().isEmpty()) { StringBuffer sb = new StringBuffer(); for (Iterator i = rs.getComments().iterator(); i.hasNext(); ) { Comment c = (SimpleComment)i.next(); sb.append(c.getComment()); if (i.hasNext()) sb.append("\n"); } this.writeWrappedLine(COMMENT_TAG, 12, sb.toString(), os); } os.println("FEATURES Location/Qualifiers"); // feature_type location for (Iterator i = rs.getFeatureSet().iterator(); i.hasNext(); ) { RichFeature f = (RichFeature)i.next(); this.writeWrappedLocationLine(" "+f.getTypeTerm().getName(), 21, GenbankLocationParser.writeLocation((RichLocation)f.getLocation()), os); for (Iterator j = f.getNoteSet().iterator(); j.hasNext(); ) { Note n = (Note)j.next(); // /key="val" or just /key if val=="" if (n.getValue()==null || n.getValue().equals("")) this.writeWrappedLine("",21,"/"+n.getTerm(),os); else this.writeWrappedLine("",21,"/"+n.getTerm().getName()+"=\""+n.getValue()+"\"", os); } // add-in to source feature only db_xref="taxon:xyz" where present if (f.getType().equals("source") && tax!=null) { this.writeWrappedLine("",21,"/db_xref=\"taxon:"+tax.getNCBITaxID()+"\"", os); } // add-in other dbxrefs where present for (Iterator j = f.getRankedCrossRefs().iterator(); j.hasNext(); ) { RankedCrossRef rcr = (RankedCrossRef)j.next(); CrossRef cr = rcr.getCrossRef(); this.writeWrappedLine("",21,"/db_xref=\""+cr.getDbname()+":"+cr.getAccession()+"\"", os); } } if (rs.getAlphabet()==AlphabetManager.alphabetForName("DNA")) { // BASE COUNT 1510 a 1074 c 835 g 1609 t int aCount = 0; int cCount = 0; int gCount = 0; int tCount = 0; int oCount = 0; for (int i = 1; i <= rs.length(); i++) { char c; try { c = tok.tokenizeSymbol(rs.symbolAt(i)).charAt(0); } catch (Exception e) { throw new RuntimeException("Unable to get symbol at position "+i,e); } switch (c) { case 'a': case 'A': aCount++; break; case 'c': case 'C': cCount++; break; case 'g': case 'G': gCount++; break; case 't': case 'T': tCount++; break; default: oCount++; } } os.print("BASE COUNT "); os.print(aCount + " a "); os.print(cCount + " c "); os.print(gCount + " g "); os.print(tCount + " t "); os.println(oCount + " others"); } os.println(START_SEQUENCE_TAG); // sequence stuff Symbol[] syms = (Symbol[])rs.toList().toArray(new Symbol[0]); int lines = 0; int symCount = 0; for (int i = 0; i < syms.length; i++) { if (symCount % 60 == 0) { if (lines > 0) os.print("\n"); // newline from previous line int lineNum = (lines*60) + 1; os.print(RichSequenceFormat.Tools.leftPad(""+lineNum,9)); lines++; } if (symCount % 10 == 0) os.print(" "); try { os.print(tok.tokenizeSymbol(syms[i])); } catch (IllegalSymbolException e) { throw new RuntimeException("Found illegal symbol: "+syms[i]); } symCount++; } os.print("\n"); os.println(END_SEQUENCE_TAG); } private void writeWrappedLine(String key, int indent, String text, PrintStream os) throws IOException { this._writeWrappedLine(key,indent,text,os,"\\s"); } private void writeWrappedLocationLine(String key, int indent, String text, PrintStream os) throws IOException { this._writeWrappedLine(key,indent,text,os,","); } private void _writeWrappedLine(String key, int indent, String text, PrintStream os, String sep) throws IOException { text = text.trim(); StringBuffer b = new StringBuffer(); b.append(RichSequenceFormat.Tools.rightPad(key, indent)); String[] lines = RichSequenceFormat.Tools.writeWordWrap(text, sep, this.getLineWidth()-indent); for (int i = 0; i<lines.length; i++) { if (i==0) b.append(lines[i]); else b.append(RichSequenceFormat.Tools.leftIndent(lines[i],indent)); // print line before continuing to next one os.println(b.toString()); b.setLength(0); } } /** * <code>getDefaultFormat</code> returns the String identifier for * the default format. * * @return a <code>String</code>. * @deprecated */ public String getDefaultFormat() { return DEFAULT_FORMAT; } public boolean getElideSymbols() { return elideSymbols; } /** * Use this method to toggle reading of sequence data. If you're only * interested in header data set to true. * @param elideSymbols set to true if you don't want the sequence data. */ public void setElideSymbols(boolean elideSymbols) { this.elideSymbols = elideSymbols; } private Vector mListeners = new Vector(); /** * Adds a parse error listener to the list of listeners if it isn't already * included. * * @param theListener Listener to be added. */ public synchronized void addParseErrorListener(ParseErrorListener theListener) { if (mListeners.contains(theListener) == false) { mListeners.addElement(theListener); } } /** * Removes a parse error listener from the list of listeners if it is * included. * * @param theListener Listener to be removed. */ public synchronized void removeParseErrorListener(ParseErrorListener theListener) { if (mListeners.contains(theListener) == true) { mListeners.removeElement(theListener); } } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
7347b377187ed46029bfe84fc16c04e9dabe6b98
326278b1f2d5702bc9a3b8d821b9dc9cdf78cd5f
/Midterm/src/ListArrayBasedPlus.java
ea1996a90c99d8dbcb7219aa1c5a090172750647
[]
no_license
Kiimab/DSA
60abb69ae1a6b4d6eb1496a9c2f5be663ccc7351
df82f07166decd2746b6486810aa5bea3511d46e
refs/heads/master
2020-04-07T01:02:10.947359
2018-11-16T23:45:44
2018-11-16T23:45:44
157,928,353
0
0
null
2018-11-17T00:10:03
2018-11-16T22:29:44
Java
UTF-8
Java
false
false
441
java
public class ListArrayBasedPlus<T> extends ListArrayBased<T> { public ListArrayBasedPlus () { super(); } public void reverse() { for(int i=0; i < items.length/2; i++) { T temp = items[i]; items[i] = items[items.length -i -1]; items[items.length -i -1] = temp; } } public String toString() { String s=""; for(int index= 0; index <items.length; index++) { s = s + items[index]; index++; } return s; } }
[ "kiimaballantyne@gmail.com" ]
kiimaballantyne@gmail.com
0d7fd705a91af3b924273abc5c797be9feab7112
eadedaf59ba8c2ac37c268bbd3baf31635504ea9
/src/main/java/com/psawesome/testcodeproject/userInfo/repo/UserInfoRepository.java
db57b2156b56689052c0739f0898afe7245567e7
[]
no_license
wiv33/test-code-project
9288b57b4221b46f59b5cebeb5ced3b6420b0d79
993d82b530b4c374a9e91f939e5f59f1b56fae47
refs/heads/master
2023-06-01T17:55:10.794340
2021-06-27T15:32:23
2021-06-27T15:32:23
234,860,509
1
0
null
null
null
null
UTF-8
Java
false
false
395
java
package com.psawesome.testcodeproject.userInfo.repo; import com.psawesome.testcodeproject.userInfo.entity.UserInfo; import org.springframework.data.repository.reactive.ReactiveCrudRepository; /** * package: com.psawesome.testcodeproject.domains.repo * author: PS * DATE: 2020-01-19 일요일 15:39 */ public interface UserInfoRepository extends ReactiveCrudRepository<UserInfo, Long> { }
[ "wiv821253@gmail.com" ]
wiv821253@gmail.com
91cd30f4679f03b0bc82fe6ec25f1b4ab4e38de2
11babced1f48d7a4d9353da64f278b25384d5acd
/CSEIII/CSEIII-Web/src/VO/stockVO/TwentyStockVO.java
3badc354cff36aa7332fc3f08dca801ed8430a32
[]
no_license
Apocalpyse/NJU-SE3
08daf05f9f98569b892fa41cd706f7445eb9baf2
27ae6915830a4087d2eb9350257fb5513c6d8692
refs/heads/master
2020-03-11T02:04:58.892123
2018-04-16T08:43:37
2018-04-16T08:43:37
129,316,413
0
0
null
null
null
null
UTF-8
Java
false
false
1,360
java
package VO.stockVO; import java.util.ArrayList; /** * Created by A on 2017/5/21. */ public class TwentyStockVO { private String start;//开始日期 private String end;//结束日期 private ArrayList<String> name;//股票名字 private ArrayList<String> code;//股票代码 private ArrayList<GoalVO> goal;//股票得分 public TwentyStockVO(){ } public TwentyStockVO(String start, String end, ArrayList<String> name, ArrayList<String> code, ArrayList<GoalVO> goal) { this.start = start; this.end = end; this.name = name; this.code = code; this.goal = goal; } public String getStart() { return start; } public void setStart(String start) { this.start = start; } public String getEnd() { return end; } public void setEnd(String end) { this.end = end; } public ArrayList<String> getName() { return name; } public void setName(ArrayList<String> name) { this.name = name; } public ArrayList<String> getCode() { return code; } public void setCode(ArrayList<String> code) { this.code = code; } public ArrayList<GoalVO> getGoal() { return goal; } public void setGoal(ArrayList<GoalVO> goal) { this.goal = goal; } }
[ "2578931175@qq.com" ]
2578931175@qq.com
a1f91abbff50ed121f2ce1c520a53342f3aab75d
fcdd741ae3b885528c8983742d0742c153891c58
/app/src/main/java/com/example/login/ui/login/warmup.java
fb86962568f0b17e483fe79d5ffccb0cbeae55b0
[]
no_license
healthy-heartbeat/Healthy_heartbeat_project
c9dac20b0b027fde032b73b9f7cc2465d36a47af
98f6f091133a6f8b9af274293c69c14695142825
refs/heads/main
2023-04-02T08:05:08.569158
2021-03-31T06:09:38
2021-03-31T06:09:38
353,131,587
0
0
null
null
null
null
UTF-8
Java
false
false
2,222
java
package com.example.login.ui.login; import android.os.Bundle; import android.os.CountDownTimer; import android.widget.Button; import androidx.appcompat.app.AppCompatActivity; import com.example.login.R; public class warmup extends AppCompatActivity { private int counterMin = 5; private int counterSec = 0; private long num = 300000; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.warmup); Button warmupTimer = findViewById(R.id.warmup_timer); Button minusb = findViewById(R.id.warmup_minus); Button plusb = findViewById(R.id.warmup_plus); Button resetb = findViewById(R.id.warmup_reset); resetb.setOnClickListener((v) -> { num = 300000; counterMin = 5; counterSec = 0; warmupTimer.setText(String.valueOf(counterMin) + " : " + String.valueOf(counterSec)); }); minusb.setOnClickListener((v) -> { if (counterMin > 0) { num = num - 60000; counterMin--; } warmupTimer.setText(String.valueOf(counterMin) + " : " + String.valueOf(counterSec)); }); plusb.setOnClickListener(v -> { if (counterMin < 30) { num = num + 60000; counterMin = counterMin + 1; } warmupTimer.setText(counterMin + " : " + counterSec); }); warmupTimer.setOnClickListener(v -> { new CountDownTimer(num, 1000) { public void onTick(long millisUntilFinished) { if (counterSec == 0) { counterMin--; counterSec = 60; } if (counterMin < 0) { warmupTimer.setText("FINISH!!"); } else { counterSec--; warmupTimer.setText(String.valueOf(counterMin) + " : " + String.valueOf(counterSec)); } } @Override public void onFinish() { } }.start(); }); } }
[ "hanakafri6@gmail.com" ]
hanakafri6@gmail.com
3cbd2777b4d6f2094f92d7346068557b000a2226
4cbf90102bf4f59540e115c21fd703269d716b52
/src/main/java/fi/linuxbox/neo4j/Serve.java
b810a3cf4bd6b72dac180218563d432626d5c77e
[]
no_license
vmj/neo4j-serve
42f817cae9fb5a3f6fce760516825cb1ee5b76ef
448b78c35f3fa719aa8d36d171dff85d4938322d
refs/heads/master
2020-12-30T17:11:27.817438
2017-11-08T16:57:16
2017-11-08T16:57:16
91,066,307
0
0
null
null
null
null
UTF-8
Java
false
false
1,936
java
package fi.linuxbox.neo4j; import org.apache.commons.cli.ParseException; import org.neo4j.graphdb.GraphDatabaseService; import org.neo4j.graphdb.factory.GraphDatabaseFactory; import org.neo4j.kernel.configuration.BoltConnector; import static java.lang.Runtime.getRuntime; import static org.neo4j.graphdb.factory.GraphDatabaseSettings.allow_upgrade; import static org.neo4j.graphdb.factory.GraphDatabaseSettings.read_only; /** * Main class. */ public class Serve { /** * The main entry point. * * @param args Command line options and arguments. * @throws InterruptedException if the CTRL-C is pressed. * @throws ParseException if there are any problems encountered * while parsing the command line tokens. */ public static void main(String... args) throws InterruptedException, ParseException { final CLI cli = new ApacheCommonsCLI(args); if (cli.helpShown()) return; final BoltConnector bolt = new BoltConnector( "0" ); final GraphDatabaseService graph = new GraphDatabaseFactory() // Where is it? .newEmbeddedDatabaseBuilder(cli.getPath()) // Allow connections via BOLT .setConfig(bolt.type, "BOLT") .setConfig(bolt.enabled, "true") .setConfig(bolt.listen_address, cli.getAddress()) // Read-only .setConfig(read_only, cli.getReadOnly()) // Automatically upgrade storage format .setConfig(allow_upgrade, "true") .newGraphDatabase(); getRuntime().addShutdownHook(new Thread(graph::shutdown)); System.out.println("Listening for connections at " + cli.getAddress() + "; Use CTRL-C to exit..."); synchronized (lock) { lock.wait(); } } /** * Poor man's deamon thread. */ private static final Object lock = new Object(); }
[ "vmj@linuxbox.fi" ]
vmj@linuxbox.fi
1c4fe240d18b0af8a3ce9df08e43095d51166929
bdf46496656472ad08ea0cd40ba49ea6f28eee3a
/JAVA_DSA/src/com/dsa/string/EncryptString.java
7e5e33d55dd412bd47b38efaad54f6e058771c82
[]
no_license
ashish-/Test-Repo
bd26de903668aa2dfd3ac6281bff2f9d205f0f0c
e41cfb24704fb2b6fcde10ec7558383c9dd771bc
refs/heads/master
2021-01-17T18:00:20.826380
2016-07-11T19:06:18
2016-07-11T19:06:18
60,577,060
0
0
null
null
null
null
UTF-8
Java
false
false
1,068
java
package com.dsa.string; import java.util.Arrays; public class EncryptString { public static String reverse(char array[]){ int left,right; left = 0; right = array.length-1; for(left=0;left<right; left++,right--){ char temp =array[left]; array[left] = array[right]; array[right]= temp; } return String.valueOf(array); } public static String encrypt(String strs){ int n= strs.length(); int d=(strs.length()+1)/2; if(n>1){ String left = strs.substring(0,d); left =reverse(left.toCharArray()); left=encrypt(left); String right = strs.substring(d,n); right = reverse(right.toCharArray()); right=encrypt(right); return left+right; } else{ return strs; } } public static void main(String[] args) { String str ="hello"; int n= str.length(); int d=(str.length()+1)/2; //System.out.println(d); //System.out.println(str.substring(0, d)); //System.out.println(str.substring(d, n)); System.out.println(encrypt(str)); //System.out.println(reverse(str.toCharArray())); } }
[ "khandelwal.ashish24@gmail.com" ]
khandelwal.ashish24@gmail.com
c097231b21314fce42279467e45eeeb8aae903c4
db27e4af6fb3f7993b868e4d1ea007d3f343cc01
/idea_day1/maven_web/src/main/java/com/baizhi/service/impl/ArticleServiceImpl.java
00a32f91f6a2bf37573f7e8fc384c0fd902352c7
[]
no_license
008aodi/testGit
4448196ddf13ad1e0d2b1e4a606898f20f9ec2a3
047d0a90b9cbffb526b12ff461b75e2387f87c78
refs/heads/master
2022-12-21T23:15:44.045420
2019-04-12T07:21:56
2019-04-12T07:21:56
179,464,433
0
0
null
2022-12-16T08:18:07
2019-04-04T09:19:44
CSS
WINDOWS-1252
Java
false
false
1,998
java
package com.baizhi.service.impl; import java.io.File; import java.util.Date; import java.util.List; import java.util.UUID; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; import com.baizhi.dao.ArticleDao; import com.baizhi.entity.Article; import com.baizhi.entity.Banner; import com.baizhi.service.ArticleService; @Service @Transactional(propagation=Propagation.REQUIRED) public class ArticleServiceImpl implements ArticleService { @Autowired private ArticleDao articleDao; @Override @Transactional(propagation=Propagation.SUPPORTS) public List<Article> findAllArticle(int page, int rows) { int begin = (page-1)*rows; int end = rows; return articleDao.findAllArticle(begin, end); } @Override public Integer findCount() { return articleDao.findCount(); } @Override public void addArticle(Article article,String filename,String realpath,MultipartFile upfile) { String uuid = UUID.randomUUID().toString().replaceAll("-", ""); article.setId(uuid); Date date = new Date(); article.setPublicTime(date); article.setArticlePic("/articleImg/"+uuid+filename); filename=uuid+filename; //ÎļþÉÏ´« try { upfile.transferTo(new File(realpath+"\\"+filename)); } catch (Exception e) { } articleDao.addArticle(article); } @Override public void deleteArticle(String id,String realpath) { articleDao.deleteArticle(id); File file = new File(realpath); file.delete(); } @Override public Article findArticleById(String id) { return articleDao.findArticleById(id); } }
[ "008aodi@163.com" ]
008aodi@163.com
e1f39e561f6a993f41c4cc64e6eb5868d8f66513
4f9482c484e29d04ff7633fd93a0d5475d54ad2f
/Microservice_Feign/src/main/java/com/hand/feign/FeignApplication.java
61718f17c836f5c17f93a9d523f4cfb43a5fafc1
[]
no_license
liuling6021/Microserver_Project
e4d789893b32f7ecfc44e46a3b779862d3daa812
1e2f2bbbd6f7633e9a8a352a97ce038c97ff5c7a
refs/heads/master
2021-07-14T05:47:48.501104
2020-08-03T13:19:19
2020-08-03T13:19:19
191,895,181
0
0
null
null
null
null
UTF-8
Java
false
false
498
java
package com.hand.feign; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.openfeign.EnableFeignClients; @EnableDiscoveryClient @SpringBootApplication @EnableFeignClients public class FeignApplication { public static void main(String[] args) { SpringApplication.run(FeignApplication.class, args); } }
[ "ling.liu04@hand-china.com" ]
ling.liu04@hand-china.com
a71e059954c3b0b570594a55bff139a2dcfca668
187b64de9f69c7b91216828b6668c978ce583a04
/test/org/jivesoftware/smackx/MessageEventManagerTest.java
c676b3d73058c44717fc48267d0875277c09df12
[]
no_license
LiamDGray/smack-linklocal
0530ebbb63dca9d0b7ef42b02dd403ddc88caadc
405a3a75c938eba0c65aed661fe34bb7321c813c
refs/heads/master
2023-03-17T23:05:17.147620
2009-07-13T06:08:18
2009-07-13T06:08:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
11,922
java
/** * $RCSfile$ * $Revision: 6213 $ * $Date: 2006-11-23 06:55:37 +0800 (Thu, 23 Nov 2006) $ * * Copyright (C) 2002-2003 Jive Software. All rights reserved. * ==================================================================== * The Jive Software License (based on Apache Software License, Version 1.1) * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by * Jive Software (http://www.jivesoftware.com)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Smack" and "Jive Software" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please * contact webmaster@jivesoftware.com. * * 5. Products derived from this software may not be called "Smack", * nor may "Smack" appear in their name, without prior written * permission of Jive Software. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL JIVE SOFTWARE OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== */ package org.jivesoftware.smackx; import java.util.ArrayList; import org.jivesoftware.smack.*; import org.jivesoftware.smack.packet.*; import org.jivesoftware.smack.test.SmackTestCase; /** * * Test the MessageEvent extension using the high level API. * * @author Gaston Dombiak */ public class MessageEventManagerTest extends SmackTestCase { public MessageEventManagerTest(String name) { super(name); } /** * High level API test. * This is a simple test to use with a XMPP client and check if the client receives the * message * 1. User_1 will send a message to user_2 requesting to be notified when any of these events * occurs: offline, composing, displayed or delivered */ public void testSendMessageEventRequest() { // Create a chat for each connection Chat chat1 = getConnection(0).getChatManager().createChat(getBareJID(1), null); // Create the message to send with the roster Message msg = new Message(); msg.setSubject("Any subject you want"); msg.setBody("An interesting body comes here..."); // Add to the message all the notifications requests (offline, delivered, displayed, // composing) MessageEventManager.addNotificationsRequests(msg, true, true, true, true); // Send the message that contains the notifications request try { chat1.sendMessage(msg); } catch (Exception e) { fail("An error occured sending the message"); } } /** * High level API test. * This is a simple test to use with a XMPP client, check if the client receives the * message and display in the console any notification * 1. User_1 will send a message to user_2 requesting to be notified when any of these events * occurs: offline, composing, displayed or delivered * 2. User_2 will use a XMPP client (like Exodus) to display the message and compose a reply * 3. User_1 will display any notification that receives */ public void testSendMessageEventRequestAndDisplayNotifications() { // Create a chat for each connection Chat chat1 = getConnection(0).getChatManager().createChat(getBareJID(1), null); MessageEventManager messageEventManager = new MessageEventManager(getConnection(0)); messageEventManager .addMessageEventNotificationListener(new MessageEventNotificationListener() { public void deliveredNotification(String from, String packetID) { System.out.println("From: " + from + " PacketID: " + packetID + "(delivered)"); } public void displayedNotification(String from, String packetID) { System.out.println("From: " + from + " PacketID: " + packetID + "(displayed)"); } public void composingNotification(String from, String packetID) { System.out.println("From: " + from + " PacketID: " + packetID + "(composing)"); } public void offlineNotification(String from, String packetID) { System.out.println("From: " + from + " PacketID: " + packetID + "(offline)"); } public void cancelledNotification(String from, String packetID) { System.out.println("From: " + from + " PacketID: " + packetID + "(cancelled)"); } }); // Create the message to send with the roster Message msg = new Message(); msg.setSubject("Any subject you want"); msg.setBody("An interesting body comes here..."); // Add to the message all the notifications requests (offline, delivered, displayed, // composing) MessageEventManager.addNotificationsRequests(msg, true, true, true, true); // Send the message that contains the notifications request try { chat1.sendMessage(msg); // Wait a few seconds so that the XMPP client can send any event Thread.sleep(200); } catch (Exception e) { fail("An error occured sending the message"); } } /** * High level API test. * 1. User_1 will send a message to user_2 requesting to be notified when any of these events * occurs: offline, composing, displayed or delivered * 2. User_2 will receive the message * 3. User_2 will simulate that the message was displayed * 4. User_2 will simulate that he/she is composing a reply * 5. User_2 will simulate that he/she has cancelled the reply */ public void testRequestsAndNotifications() { final ArrayList<String> results = new ArrayList<String>(); ArrayList<String> resultsExpected = new ArrayList<String>(); resultsExpected.add("deliveredNotificationRequested"); resultsExpected.add("composingNotificationRequested"); resultsExpected.add("displayedNotificationRequested"); resultsExpected.add("offlineNotificationRequested"); resultsExpected.add("deliveredNotification"); resultsExpected.add("displayedNotification"); resultsExpected.add("composingNotification"); resultsExpected.add("cancelledNotification"); // Create a chat for each connection Chat chat1 = getConnection(0).getChatManager().createChat(getBareJID(1), null); MessageEventManager messageEventManager1 = new MessageEventManager(getConnection(0)); messageEventManager1 .addMessageEventNotificationListener(new MessageEventNotificationListener() { public void deliveredNotification(String from, String packetID) { results.add("deliveredNotification"); } public void displayedNotification(String from, String packetID) { results.add("displayedNotification"); } public void composingNotification(String from, String packetID) { results.add("composingNotification"); } public void offlineNotification(String from, String packetID) { results.add("offlineNotification"); } public void cancelledNotification(String from, String packetID) { results.add("cancelledNotification"); } }); MessageEventManager messageEventManager2 = new MessageEventManager(getConnection(1)); messageEventManager2 .addMessageEventRequestListener(new DefaultMessageEventRequestListener() { public void deliveredNotificationRequested( String from, String packetID, MessageEventManager messageEventManager) { super.deliveredNotificationRequested(from, packetID, messageEventManager); results.add("deliveredNotificationRequested"); } public void displayedNotificationRequested( String from, String packetID, MessageEventManager messageEventManager) { super.displayedNotificationRequested(from, packetID, messageEventManager); results.add("displayedNotificationRequested"); } public void composingNotificationRequested( String from, String packetID, MessageEventManager messageEventManager) { super.composingNotificationRequested(from, packetID, messageEventManager); results.add("composingNotificationRequested"); } public void offlineNotificationRequested( String from, String packetID, MessageEventManager messageEventManager) { super.offlineNotificationRequested(from, packetID, messageEventManager); results.add("offlineNotificationRequested"); } }); // Create the message to send with the roster Message msg = new Message(); msg.setSubject("Any subject you want"); msg.setBody("An interesting body comes here..."); // Add to the message all the notifications requests (offline, delivered, displayed, // composing) MessageEventManager.addNotificationsRequests(msg, true, true, true, true); // Send the message that contains the notifications request try { chat1.sendMessage(msg); messageEventManager2.sendDisplayedNotification(getBareJID(0), msg.getPacketID()); messageEventManager2.sendComposingNotification(getBareJID(0), msg.getPacketID()); messageEventManager2.sendCancelledNotification(getBareJID(0), msg.getPacketID()); // Wait up to 2 seconds long initial = System.currentTimeMillis(); while (System.currentTimeMillis() - initial < 2000 && (!results.containsAll(resultsExpected))) { Thread.sleep(100); } assertTrue( "Test failed due to bad results (1)" + resultsExpected, resultsExpected.containsAll(results)); assertTrue( "Test failed due to bad results (2)" + results, results.containsAll(resultsExpected)); } catch (Exception e) { fail("An error occured sending the message"); } } protected int getMaxConnections() { return 2; } }
[ "jadahl@gmail.com" ]
jadahl@gmail.com
1ac99095462f179fc048b7935bb36901e1892ada
7c73da0b531bb380cc6efe546afcd048221b207c
/spring-test/src/test/java/org/springframework/test/context/support/TestPropertySourceUtilsTests.java
8f6c8d7efb0311ea4c0dd91b5f081b85ba40ef91
[ "Apache-2.0" ]
permissive
langtianya/spring4-understanding
e8d793b9fe6ef9c39e9aeaf8a4101c0adb6b7bc9
0b82365530b106a935575245e1fc728ea4625557
refs/heads/master
2021-01-19T04:01:04.034096
2016-08-07T06:16:34
2016-08-07T06:16:34
63,202,955
46
27
null
null
null
null
UTF-8
Java
false
false
9,055
java
/* * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.test.context.support; import java.util.Map; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.core.annotation.AnnotationConfigurationException; import org.springframework.core.env.ConfigurableEnvironment; import org.springframework.core.env.MutablePropertySources; import org.springframework.mock.env.MockEnvironment; import org.springframework.mock.env.MockPropertySource; import org.springframework.test.context.TestPropertySource; import static org.hamcrest.CoreMatchers.*; import static org.junit.Assert.*; import static org.mockito.Mockito.mock; import static org.springframework.test.context.support.TestPropertySourceUtils.*; /** * Unit tests for {@link TestPropertySourceUtils}. * * @author Sam Brannen * @since 4.1 */ public class TestPropertySourceUtilsTests { private static final String[] EMPTY_STRING_ARRAY = new String[0]; private static final String[] KEY_VALUE_PAIR = new String[] { "key = value" }; @Rule public ExpectedException expectedException = ExpectedException.none(); private void assertMergedTestPropertySources(Class<?> testClass, String[] expectedLocations, String[] expectedProperties) { MergedTestPropertySources mergedPropertySources = buildMergedTestPropertySources(testClass); assertNotNull(mergedPropertySources); assertArrayEquals(expectedLocations, mergedPropertySources.getLocations()); assertArrayEquals(expectedProperties, mergedPropertySources.getProperties()); } @Test public void emptyAnnotation() { expectedException.expect(IllegalStateException.class); expectedException.expectMessage(startsWith("Could not detect default properties file for test")); expectedException.expectMessage(containsString("EmptyPropertySources.properties")); buildMergedTestPropertySources(EmptyPropertySources.class); } @Test public void extendedEmptyAnnotation() { expectedException.expect(IllegalStateException.class); expectedException.expectMessage(startsWith("Could not detect default properties file for test")); expectedException.expectMessage(containsString("ExtendedEmptyPropertySources.properties")); buildMergedTestPropertySources(ExtendedEmptyPropertySources.class); } @Test public void value() { assertMergedTestPropertySources(ValuePropertySources.class, new String[] { "classpath:/value.xml" }, EMPTY_STRING_ARRAY); } @Test public void locationsAndValueAttributes() { expectedException.expect(AnnotationConfigurationException.class); buildMergedTestPropertySources(LocationsAndValuePropertySources.class); } @Test public void locationsAndProperties() { assertMergedTestPropertySources(LocationsAndPropertiesPropertySources.class, new String[] { "classpath:/foo1.xml", "classpath:/foo2.xml" }, new String[] { "k1a=v1a", "k1b: v1b" }); } @Test public void inheritedLocationsAndProperties() { assertMergedTestPropertySources(InheritedPropertySources.class, new String[] { "classpath:/foo1.xml", "classpath:/foo2.xml" }, new String[] { "k1a=v1a", "k1b: v1b" }); } @Test public void extendedLocationsAndProperties() { assertMergedTestPropertySources(ExtendedPropertySources.class, new String[] { "classpath:/foo1.xml", "classpath:/foo2.xml", "classpath:/bar1.xml", "classpath:/bar2.xml" }, new String[] { "k1a=v1a", "k1b: v1b", "k2a v2a", "k2b: v2b" }); } @Test public void overriddenLocations() { assertMergedTestPropertySources(OverriddenLocationsPropertySources.class, new String[] { "classpath:/baz.properties" }, new String[] { "k1a=v1a", "k1b: v1b", "key = value" }); } @Test public void overriddenProperties() { assertMergedTestPropertySources(OverriddenPropertiesPropertySources.class, new String[] { "classpath:/foo1.xml", "classpath:/foo2.xml", "classpath:/baz.properties" }, KEY_VALUE_PAIR); } @Test public void overriddenLocationsAndProperties() { assertMergedTestPropertySources(OverriddenLocationsAndPropertiesPropertySources.class, new String[] { "classpath:/baz.properties" }, KEY_VALUE_PAIR); } /** * @since 4.1.5 */ @Test public void addInlinedPropertiesToEnvironmentWithNullContext() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("context"); addInlinedPropertiesToEnvironment((ConfigurableApplicationContext) null, KEY_VALUE_PAIR); } /** * @since 4.1.5 */ @Test public void addInlinedPropertiesToEnvironmentWithContextAndNullInlinedProperties() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("inlined"); addInlinedPropertiesToEnvironment(mock(ConfigurableApplicationContext.class), null); } /** * @since 4.1.5 */ @Test public void addInlinedPropertiesToEnvironmentWithNullEnvironment() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("environment"); addInlinedPropertiesToEnvironment((ConfigurableEnvironment) null, KEY_VALUE_PAIR); } /** * @since 4.1.5 */ @Test public void addInlinedPropertiesToEnvironmentWithEnvironmentAndNullInlinedProperties() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("inlined"); addInlinedPropertiesToEnvironment(new MockEnvironment(), null); } /** * @since 4.1.5 */ @Test public void addInlinedPropertiesToEnvironmentWithMalformedUnicodeInValue() { expectedException.expect(IllegalStateException.class); expectedException.expectMessage("Failed to load test environment property"); addInlinedPropertiesToEnvironment(new MockEnvironment(), new String[] { "key = \\uZZZZ" }); } /** * @since 4.1.5 */ @Test public void addInlinedPropertiesToEnvironmentWithMultipleKeyValuePairsInSingleInlinedProperty() { expectedException.expect(IllegalStateException.class); expectedException.expectMessage("Failed to load exactly one test environment property"); addInlinedPropertiesToEnvironment(new MockEnvironment(), new String[] { "a=b\nx=y" }); } /** * @since 4.1.5 */ @Test @SuppressWarnings("rawtypes") public void addInlinedPropertiesToEnvironmentWithEmptyProperty() { ConfigurableEnvironment environment = new MockEnvironment(); MutablePropertySources propertySources = environment.getPropertySources(); propertySources.remove(MockPropertySource.MOCK_PROPERTIES_PROPERTY_SOURCE_NAME); assertEquals(0, propertySources.size()); addInlinedPropertiesToEnvironment(environment, new String[] { " " }); assertEquals(1, propertySources.size()); assertEquals(0, ((Map) propertySources.iterator().next().getSource()).size()); } @Test public void convertInlinedPropertiesToMapWithNullInlinedProperties() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("inlined"); convertInlinedPropertiesToMap(null); } // ------------------------------------------------------------------- @TestPropertySource static class EmptyPropertySources { } @TestPropertySource static class ExtendedEmptyPropertySources extends EmptyPropertySources { } @TestPropertySource(locations = "/foo", value = "/bar") static class LocationsAndValuePropertySources { } @TestPropertySource("/value.xml") static class ValuePropertySources { } @TestPropertySource(locations = { "/foo1.xml", "/foo2.xml" }, properties = { "k1a=v1a", "k1b: v1b" }) static class LocationsAndPropertiesPropertySources { } static class InheritedPropertySources extends LocationsAndPropertiesPropertySources { } @TestPropertySource(locations = { "/bar1.xml", "/bar2.xml" }, properties = { "k2a v2a", "k2b: v2b" }) static class ExtendedPropertySources extends LocationsAndPropertiesPropertySources { } @TestPropertySource(locations = "/baz.properties", properties = "key = value", inheritLocations = false) static class OverriddenLocationsPropertySources extends LocationsAndPropertiesPropertySources { } @TestPropertySource(locations = "/baz.properties", properties = "key = value", inheritProperties = false) static class OverriddenPropertiesPropertySources extends LocationsAndPropertiesPropertySources { } @TestPropertySource(locations = "/baz.properties", properties = "key = value", inheritLocations = false, inheritProperties = false) static class OverriddenLocationsAndPropertiesPropertySources extends LocationsAndPropertiesPropertySources { } }
[ "hansongjy@gmail.com" ]
hansongjy@gmail.com
e2593c10035d6209215828138ef799168871ccea
d24d3bab9631d287cdecc1455e018d5897e1dbb5
/app/src/main/java/com/example/mariaadelaidameramiguens/taskapp/vista/TareaActivity.java
db4a1942d0e9223c77cbc23b00aec4427ce7cfcb
[]
no_license
mariamera/TaskApp
83b851013d6701457a3191c72047ae091a595171
2fbe4bbcd31a182ca3890f8af53fff45633ea876
refs/heads/master
2020-03-19T15:29:01.232949
2018-08-04T14:46:55
2018-08-04T14:46:55
136,672,640
0
0
null
null
null
null
UTF-8
Java
false
false
2,197
java
package com.example.mariaadelaidameramiguens.taskapp.vista; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.widget.TextView; import com.example.mariaadelaidameramiguens.taskapp.R; import com.example.mariaadelaidameramiguens.taskapp.entitdades.Categoria; import com.example.mariaadelaidameramiguens.taskapp.entitdades.DataHolder; import com.example.mariaadelaidameramiguens.taskapp.entitdades.Tarea; import com.example.mariaadelaidameramiguens.taskapp.entitdades.Usuario; import com.example.mariaadelaidameramiguens.taskapp.repositorio.TareaRepositorio; public class TareaActivity extends AppCompatActivity { private static final String LOG_TAG = "TareaActivity"; private TareaRepositorio tareaRepositorio; private Tarea tar; final Usuario currentUser = DataHolder.getInstance().getData(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_tarea); TextView catgoriaText = findViewById(R.id.categoriatxt); TextView tareaFecha= findViewById(R.id.datelbl); TextView usuarioAsignado = findViewById(R.id.asigntxt); TextView estado= findViewById(R.id.estadotxt); TextView descripcion = findViewById(R.id.descripciontxt); TextView by = findViewById(R.id.asignLbl); Bundle paraBundle = getIntent().getExtras(); // parametros del intento if( paraBundle != null && paraBundle.containsKey("tarea")) { tar = (Tarea) paraBundle.getSerializable("tarea"); if (currentUser.getTipoUsuario() == Usuario.TipoUsuario.NORMAL ){ by.setText("Asignado A:"); usuarioAsignado.setText(tar.getUsuarioAsignado().getNombre() ); } descripcion.setText(tar.getDescription()); tareaFecha.setText(tar.getFecha().toString()); catgoriaText.setText(Integer.toString(tar.getCategoriaID())); if(tar.getEstado() != null) { Log.i(LOG_TAG,"STATE NOT NULL"); estado.setText(tar.getEstado().name()); } } } }
[ "mmera@intellisys.com.do" ]
mmera@intellisys.com.do
3feffb321855e32c106c0f1122cb0f41ebb39ffb
7559bead0c8a6ad16f016094ea821a62df31348a
/src/com/vmware/vim25/HostExtraNetworksEvent.java
fa9277e8772222ab2f03457c87e64b0ee81cf2be
[]
no_license
ZhaoxuepengS/VsphereTest
09ba2af6f0a02d673feb9579daf14e82b7317c36
59ddb972ce666534bf58d84322d8547ad3493b6e
refs/heads/master
2021-07-21T13:03:32.346381
2017-11-01T12:30:18
2017-11-01T12:30:18
109,128,993
1
1
null
null
null
null
UTF-8
Java
false
false
1,344
java
package com.vmware.vim25; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for HostExtraNetworksEvent complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="HostExtraNetworksEvent"> * &lt;complexContent> * &lt;extension base="{urn:vim25}HostDasEvent"> * &lt;sequence> * &lt;element name="ips" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;/sequence> * &lt;/extension> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "HostExtraNetworksEvent", propOrder = { "ips" }) public class HostExtraNetworksEvent extends HostDasEvent { protected String ips; /** * Gets the value of the ips property. * * @return * possible object is * {@link String } * */ public String getIps() { return ips; } /** * Sets the value of the ips property. * * @param value * allowed object is * {@link String } * */ public void setIps(String value) { this.ips = value; } }
[ "495149700@qq.com" ]
495149700@qq.com
563984c5415ba0507101d3604391b338332638e0
275a686ea9e6cbd6756f2a1f52e7c4597b00e309
/app/src/main/java/tools/DialogBorrowUserInfoLayout.java
a9a9e7d9b44435b429e30f2a0aaa0b4c737f6368
[]
no_license
Jack-WangZhe/NeuLibrary
9a11dc5b254435f7feefa4c10f4d18491df2d852
9aae9d17d5f311f1c3fc206e93c11f4c6d9aa376
refs/heads/master
2020-03-14T08:04:42.436728
2018-04-29T17:55:57
2018-04-29T17:55:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,955
java
package tools; import android.content.Context; import android.view.LayoutInflater; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.android.volley.RequestQueue; import com.android.volley.toolbox.ImageLoader; import com.android.volley.toolbox.Volley; import nl.neulibrary.R; /** * 推荐=>借阅用户中的用户信息 */ public class DialogBorrowUserInfoLayout extends LinearLayout { private ImageView userPhoto; private TextView borrowUserName; private TextView borrowTime; private Context context; public DialogBorrowUserInfoLayout(Context context,String userPhotoURL,String userName,String userBorrowTime) { super(context); this.context=context; initViews(context); setUserPhoto(userPhotoURL); setUserName(userName); setUserBorrowTime(userBorrowTime); } public void initViews(Context context){ LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); inflater.inflate(R.layout.recommend_dialog_borrow_user,this); userPhoto = (ImageView)findViewById(R.id.userPhoto); borrowUserName = (TextView)findViewById(R.id.borrowUserName); borrowTime = (TextView)findViewById(R.id.borrowTime); } public void setUserPhoto(String userPhotoURL){ //利用volley设置用户头像 RequestQueue mQueue = Volley.newRequestQueue(context); ImageLoader imageLoader = new ImageLoader(mQueue, new BitmapCache()); ImageLoader.ImageListener listener = ImageLoader.getImageListener(userPhoto, R.drawable.loading_on, R.drawable.loading_wrong); imageLoader.get(userPhotoURL, listener); } public void setUserName(String userName){ borrowUserName.setText(userName); } public void setUserBorrowTime(String userBorrowTime){ borrowTime.setText(userBorrowTime); } }
[ "985825337@qq.com" ]
985825337@qq.com
48d68ed1b44585dca924f0500330d00082092c29
194e4fd325cd9da1ee73fe95fa846627da2dab9c
/src/com/examples/ezoo/model/Animal.java
d09f27dc076f5d53fc6c7d2f58bb5883e6e88020
[ "MIT" ]
permissive
IncarnateGaming/Revature-eZoo
344c120105cf353e7bcb65bafc36c7b04aeb9249
083c23a2116156dc4159ff37908fdd6379161884
refs/heads/master
2021-01-16T10:36:33.867410
2020-02-22T15:53:42
2020-02-22T15:53:42
243,085,266
0
0
null
null
null
null
UTF-8
Java
false
false
5,507
java
package com.examples.ezoo.model; import java.sql.ResultSet; import java.sql.SQLException; public class Animal{ private long animalID = 0L; private String name = ""; private String taxKingdom = ""; private String taxPhylum = ""; private String taxClass = ""; private String taxOrder = ""; private String taxFamily = ""; private String taxGenus = ""; private String taxSpecies = ""; private double height = 0D; private double weight = 0D; private String type = ""; private String healthStatus = ""; private int feedingScheduleId = FeedingSchedule.getNotFedId(); public Animal(){} //TODO backwards compatibility constructor, remove after we are sure all references to animal generation include a feeding schedule //Added February 15, 2020 public Animal(long animalID, String name, String taxKingdom, String taxPhylum, String taxClass, String taxOrder, String taxFamily, String taxGenus, String taxSpecies, double height, double weight, String type, String healthStatus) { super(); this.animalID = animalID; this.name = name; this.taxKingdom = taxKingdom; this.taxPhylum = taxPhylum; this.taxClass = taxClass; this.taxOrder = taxOrder; this.taxFamily = taxFamily; this.taxGenus = taxGenus; this.taxSpecies = taxSpecies; this.height = height; this.weight = weight; this.type = type; this.healthStatus = healthStatus; this.feedingScheduleId = FeedingSchedule.getNotFedId(); } public Animal(long animalID, String name, String taxKingdom, String taxPhylum, String taxClass, String taxOrder, String taxFamily, String taxGenus, String taxSpecies, double height, double weight, String type, String healthStatus, int feedingScheduleId) { super(); setAnimalID(animalID); setName(name); setTaxKingdom(taxKingdom); setTaxPhylum(taxPhylum); setTaxClass(taxClass); setTaxOrder(taxOrder); setTaxFamily(taxFamily); setTaxGenus(taxGenus); setTaxSpecies(taxSpecies); setHeight(height); setWeight(weight); setType(type); setHealthStatus(healthStatus); setFeedingScheduleId(feedingScheduleId); } public Animal(ResultSet rs){ super(); try { setAnimalID(rs.getLong("animalid")); setName(rs.getString("name")); setTaxKingdom(rs.getString("taxkingdom")); setTaxPhylum(rs.getString("taxphylum")); setTaxClass(rs.getString("taxclass")); setTaxOrder(rs.getString("taxorder")); setTaxFamily(rs.getString("taxfamily")); setTaxGenus(rs.getString("taxgenus")); setTaxSpecies(rs.getString("taxspecies")); setHeight(rs.getDouble("height")); setWeight(rs.getDouble("weight")); setType(rs.getString("type")); setHealthStatus(rs.getString("healthstatus")); setFeedingScheduleId(rs.getInt("feeding_schedule")); } catch (SQLException e) { e.printStackTrace(); } } public long getAnimalID() { return animalID; } public Animal setAnimalID(long animalID) { this.animalID = animalID; return this; } public String getName() { return name; } public Animal setName(String name) { this.name = name; return this; } public String getTaxKingdom() { return taxKingdom; } public Animal setTaxKingdom(String taxKingdom) { this.taxKingdom = taxKingdom; return this; } public String getTaxPhylum() { return taxPhylum; } public Animal setTaxPhylum(String taxPhylum) { this.taxPhylum = taxPhylum; return this; } public String getTaxClass() { return taxClass; } public Animal setTaxClass(String taxClass) { this.taxClass = taxClass; return this; } public String getTaxOrder() { return taxOrder; } public Animal setTaxOrder(String taxOrder) { this.taxOrder = taxOrder; return this; } public String getTaxFamily() { return taxFamily; } public Animal setTaxFamily(String taxFamily) { this.taxFamily = taxFamily; return this; } public String getTaxGenus() { return taxGenus; } public Animal setTaxGenus(String taxGenus) { this.taxGenus = taxGenus; return this; } public String getTaxSpecies() { return taxSpecies; } public Animal setTaxSpecies(String taxSpecies) { this.taxSpecies = taxSpecies; return this; } public double getHeight() { return height; } public Animal setHeight(double height) { this.height = height; return this; } public double getWeight() { return weight; } public Animal setWeight(double weight) { this.weight = weight; return this; } public String getType() { return type; } public Animal setType(String type) { this.type = type; return this; } public String getHealthStatus() { return healthStatus; } public Animal setHealthStatus(String healthStatus) { this.healthStatus = healthStatus; return this; } public int getFeedingScheduleId() { return this.feedingScheduleId; } //TODO add a feeding schedule getter that looks up the schedule by this.feedingScheduleId // public FeedingSchedule getFeedingSchedule() { // } public Animal setFeedingScheduleId(int feedingScheduleId) { this.feedingScheduleId = feedingScheduleId; return this; } @Override public String toString() { return "Animal [animalID=" + animalID + ", name=" + name + ", taxKingdom=" + taxKingdom + ", taxPhylum=" + taxPhylum + ", taxClass=" + taxClass + ", taxOrder=" + taxOrder + ", taxFamily=" + taxFamily + ", taxGenus=" + taxGenus + ", taxSpecies=" + taxSpecies + ", height=" + height + ", weight=" + weight + ", type=" + type + ", healthStatus=" + healthStatus + ", feedingScheduleId=" + getFeedingScheduleId() + "]"; } }
[ "philip.lawrence.1992@gmail.com" ]
philip.lawrence.1992@gmail.com
96cfc7d68683ba88a361034308e2bdd40cb18b3c
a7fff1a12d1f81ed909dd77b1a2c45b808f7c6ad
/src/concurrentutils/Dispatcher.java
1497f891c0b0c44e8a76f6c6e9f8c43b4cd62dae
[]
no_license
axyonovleonid/NetConcurrency
055b87614a01bc74cb6aa177300ce3a5a97caded
eca367bb3fb65aa1b75d85b763ec04d5eb0d9b27
refs/heads/master
2021-01-23T08:21:11.953752
2017-05-18T18:07:46
2017-05-18T18:07:46
86,504,281
0
0
null
null
null
null
UTF-8
Java
false
false
611
java
package concurrentutils; import netutils.Session; /** * Created by лёня on 02.04.2017. */ public class Dispatcher implements Runnable { private final Channel<Session> channel; private final ThreadPool threadPool; private boolean isAlive; public Dispatcher(Channel<Session> channel, ThreadPool threadPool) { this.channel = channel; this.threadPool = threadPool; } public void run() { isAlive = true; while (isAlive) { threadPool.execute (channel.take ()); } } public void stop () { isAlive = false; } }
[ "axyonovl@gmail.com" ]
axyonovl@gmail.com
402fb434c48c1d8a728832b205ccd7c1533e1af4
2d2d9f584ac8a427acc1ec68834a951e36254e56
/src/main/java/com/javaworld/javachallengers/observable/Newsletter.java
6480a9a43fb4e12c07bb17ce6fc5231b597a9415
[]
no_license
rafadelnero/javaworld-challengers
4d8a98ae8e0a551bafcca5b4a83256d373834a72
f6625b2903c095c0da8e6513a7bfe80efcc74f23
refs/heads/master
2023-06-25T06:18:44.131413
2023-06-15T08:41:11
2023-06-15T08:41:11
140,938,206
27
22
null
null
null
null
UTF-8
Java
false
false
823
java
package com.javaworld.javachallengers.observable; import java.util.ArrayList; import java.util.List; public class Newsletter implements Subject { protected List<Observer> subscriber = new ArrayList<>(); protected String name; protected String newEmail; public Newsletter(String name) { this.name = name; } public void addNewEmail(String newEmail) { this.newEmail = newEmail; notifySubscribers(); } @Override public void addSubscriber(Observer subscriber) { this.subscriber.add(subscriber); } @Override public void removeSubscriber(Observer subscriber) { this.subscriber.remove(subscriber); } @Override public void notifySubscribers() { subscriber.forEach(subscriber -> subscriber.update(newEmail)); } }
[ "rafacdelnero@gmail.com" ]
rafacdelnero@gmail.com
c0553839efe766727a09ffbf9c88bae065fee6ec
62774e6de56acf8c4d4d014f1f5ee709feef6502
/employeeRegistry/src/main/java/domain/model/service/EmployeeRegisterServiceModel.java
e4220f9032075c932d318146c9e706417e022024
[]
no_license
Chris-Mk/Hibernate
35a9c42679ad6d20925c96d6d3929ad86649f700
eb338734c0136d5292e06f7ab2688e4fda31d93c
refs/heads/master
2023-07-24T00:20:36.222180
2023-07-19T19:29:16
2023-07-19T19:29:16
205,900,454
0
0
null
2023-07-19T19:29:18
2019-09-02T16:56:37
Java
UTF-8
Java
false
false
983
java
package domain.model.service; import java.math.BigDecimal; public class EmployeeRegisterServiceModel { private String firstName; private String lastName; private String position; private BigDecimal salary; private int age; public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getPosition() { return position; } public void setPosition(String position) { this.position = position; } public BigDecimal getSalary() { return salary; } public void setSalary(BigDecimal salary) { this.salary = salary; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } }
[ "chrismks23@gmail.com" ]
chrismks23@gmail.com
02ddbb94821eb34b5c38edc6b387967c52a85041
50017be6631a47a39f733477941d1f6592b36f6a
/andEngineExamples/src/main/java/org/andengine/examples/PVRCCZTextureExample.java
9d1a41e9b20d2ab29fe74b0aebcbe7abbaa9aa93
[]
no_license
sizeofint/AndEngineExamplesAndroidStudio
fcf03dc13ad86aaff05c92f9e87267ddcdadf846
33709752594e3adc28938ecb6a198a257c976de4
refs/heads/master
2020-05-19T18:55:54.019054
2014-12-29T13:55:22
2014-12-29T13:55:22
28,591,593
5
4
null
null
null
null
UTF-8
Java
false
false
5,030
java
package org.andengine.examples; import java.io.IOException; import java.io.InputStream; import org.andengine.engine.camera.Camera; import org.andengine.engine.camera.SmoothCamera; import org.andengine.engine.options.EngineOptions; import org.andengine.engine.options.ScreenOrientation; import org.andengine.engine.options.resolutionpolicy.RatioResolutionPolicy; import org.andengine.entity.scene.IOnSceneTouchListener; import org.andengine.entity.scene.Scene; import org.andengine.entity.scene.background.Background; import org.andengine.entity.sprite.Sprite; import org.andengine.entity.util.FPSLogger; import org.andengine.examples.adt.ZoomState; import org.andengine.input.touch.TouchEvent; import org.andengine.opengl.texture.ITexture; import org.andengine.opengl.texture.TextureOptions; import org.andengine.opengl.texture.compressed.pvr.PVRCCZTexture; import org.andengine.opengl.texture.compressed.pvr.PVRTexture.PVRTextureFormat; import org.andengine.opengl.texture.region.ITextureRegion; import org.andengine.opengl.texture.region.TextureRegionFactory; import org.andengine.ui.activity.SimpleBaseGameActivity; import org.andengine.util.debug.Debug; import android.widget.Toast; /** * (c) 2010 Nicolas Gramlich * (c) 2011 Zynga * * @author Nicolas Gramlich * @since 15:31:11 - 27.07.2011 */ public class PVRCCZTextureExample extends SimpleBaseGameActivity { // =========================================================== // Constants // =========================================================== private static final int CAMERA_WIDTH = 720; private static final int CAMERA_HEIGHT = 480; // =========================================================== // Fields // =========================================================== private ITexture mTexture; private ITextureRegion mHouseTextureRegion; private ZoomState mZoomState = ZoomState.NONE; // =========================================================== // Constructors // =========================================================== // =========================================================== // Getter & Setter // =========================================================== // =========================================================== // Methods for/from SuperClass/Interfaces // =========================================================== @Override public EngineOptions onCreateEngineOptions() { Toast.makeText(this, "Click the top half of the screen to zoom in or the bottom half to zoom out!", Toast.LENGTH_LONG); final Camera camera = new SmoothCamera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT, 0, 0, 0.1f) { @Override public void onUpdate(final float pSecondsElapsed) { switch (PVRCCZTextureExample.this.mZoomState) { case IN: this.setZoomFactor(this.getZoomFactor() + 0.1f * pSecondsElapsed); break; case OUT: this.setZoomFactor(this.getZoomFactor() - 0.1f * pSecondsElapsed); break; } super.onUpdate(pSecondsElapsed); } }; return new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), camera); } @Override public void onCreateResources() { try { this.mTexture = new PVRCCZTexture(this.getTextureManager(), PVRTextureFormat.RGBA_8888, TextureOptions.BILINEAR) { @Override protected InputStream onGetInputStream() throws IOException { return PVRCCZTextureExample.this.getResources().openRawResource(R.raw.house_pvrccz_argb_8888); } }; this.mTexture.load(); this.mHouseTextureRegion = TextureRegionFactory.extractFromTexture(this.mTexture, 0, 0, 512, 512); } catch (final Throwable e) { Debug.e(e); } } @Override public Scene onCreateScene() { this.mEngine.registerUpdateHandler(new FPSLogger()); final Scene scene = new Scene(); scene.setBackground(new Background(0.09804f, 0.6274f, 0.8784f)); final float centerX = (CAMERA_WIDTH - this.mHouseTextureRegion.getWidth()) / 2; final float centerY = (CAMERA_HEIGHT - this.mHouseTextureRegion.getHeight()) / 2; scene.attachChild(new Sprite(centerX, centerY, this.mHouseTextureRegion, this.getVertexBufferObjectManager())); scene.setOnSceneTouchListener(new IOnSceneTouchListener() { @Override public boolean onSceneTouchEvent(final Scene pScene, final TouchEvent pSceneTouchEvent) { if (pSceneTouchEvent.isActionDown() || pSceneTouchEvent.isActionMove()) { if(pSceneTouchEvent.getY() < CAMERA_HEIGHT / 2) { PVRCCZTextureExample.this.mZoomState = ZoomState.IN; } else { PVRCCZTextureExample.this.mZoomState = ZoomState.OUT; } } else { PVRCCZTextureExample.this.mZoomState = ZoomState.NONE; } return true; } }); return scene; } // =========================================================== // Methods // =========================================================== // =========================================================== // Inner and Anonymous Classes // =========================================================== }
[ "george.imerlishvili@gmail.com" ]
george.imerlishvili@gmail.com
69c220dd09a57b3cbf752296f55c72087df616bf
cb7ef29b19722521de308e94e805be232d01690c
/src/main/java/com/example/multidatasourcemysql/repository/db2/CommentRepository.java
41458bbde73f9c264aecedb8585f6c7c513319bf
[]
no_license
antoarundominic/multi-datasource-mysql
cdec6af0988ce8e14e93bbf60d5df1348c85f997
c454128effbbcfbe6e17961499de0dccf7104f8b
refs/heads/master
2023-02-17T15:20:20.536742
2021-01-09T14:21:25
2021-01-09T14:21:25
328,172,194
0
0
null
null
null
null
UTF-8
Java
false
false
267
java
package com.example.multidatasourcemysql.repository.db2; import com.example.multidatasourcemysql.model.db2.Comment; import org.springframework.data.jpa.repository.JpaRepository; public interface CommentRepository extends JpaRepository<Comment, Integer> { }
[ "antoarundominic@gmail.com" ]
antoarundominic@gmail.com
57af5c9d25ffda79237569cee488424089e55d17
a4b1a6f199c62b4a1cbf8b361aecc1e09be954ad
/src/com/dzg/driver/entity/ExamName.java
caf64a73d55b9bd9cd931694802329495e01ba2f
[]
no_license
dengzhouguang/driver
ac40e17920eafe97cf5ec189c74ca7cc2d8e7c09
620e8ec509923155867484829e9ce16b1757e25a
refs/heads/master
2021-01-23T08:48:27.901333
2017-09-06T01:44:12
2017-09-06T01:44:12
102,549,243
0
0
null
null
null
null
UTF-8
Java
false
false
423
java
package com.dzg.driver.entity; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name = "dbname") public class ExamName { private String name; @Id @Column(name = "name", length = 255, nullable = false, unique = true) public String getName() { return name; } public void setName(String name) { this.name = name; } }
[ "979611780@qq.com" ]
979611780@qq.com
8cdea3d71828790a25c0cb6e19d4293c2131c0d7
45a4ba7c5f5230fad21487df4c19706f0991ee74
/app/src/main/java/com/teamdoor/android/door/Util/bilingUtil/IabResult.java
81c5af51e18c1f18e7ac5cc8298bc6431114edf9
[]
no_license
GODueol/Door
d1de6116f37f396cdfea22d77066000239ca9557
72ebd08c8652d3cba54763d0a9c7402a44e35e29
refs/heads/master
2020-03-22T05:38:19.881954
2018-08-30T05:38:58
2018-08-30T05:38:58
139,580,298
0
0
null
null
null
null
UTF-8
Java
false
false
1,759
java
/* Copyright (c) 2012 Google 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. */ package com.teamdoor.android.door.Util.bilingUtil; /** * Represents the result of an in-app billing operation. * A result is composed of a response code (an integer) and possibly a * message (String). You can get those by calling * {@link #getResponse} and {@link #getMessage()}, respectively. You * can also inquire whether a result is a success or a failure by * calling {@link #isSuccess()} and {@link #isFailure()}. */ public class IabResult { int mResponse; String mMessage; public IabResult(int response, String message) { mResponse = response; if (message == null || message.trim().length() == 0) { mMessage = IabHelper.getResponseDesc(response); } else { mMessage = message + " (response: " + IabHelper.getResponseDesc(response) + ")"; } } public int getResponse() { return mResponse; } public String getMessage() { return mMessage; } public boolean isSuccess() { return mResponse == IabHelper.BILLING_RESPONSE_RESULT_OK; } public boolean isFailure() { return !isSuccess(); } public String toString() { return "IabResult: " + getMessage(); } }
[ "weogjw01@naver.com" ]
weogjw01@naver.com
ca46dde27aabea938f09e84330f88e5370852d05
1f29f7842e30d6265fb9dbb302fe9414755e7403
/src/main/java/com/eurodyn/okstra/ArtLeistungserbringerPflegeType.java
3b273f88debeeae381fce880c29859d94f37f9b2
[]
no_license
dpapageo/okstra-2018-classes
b4165aea3c84ffafaa434a3a1f8cf0fff58de599
fb908eabc183725be01c9f93d39268bb8e630f59
refs/heads/master
2021-03-26T00:22:28.205974
2020-03-16T09:16:31
2020-03-16T09:16:31
247,657,881
2
0
null
null
null
null
UTF-8
Java
false
false
2,657
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.11 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2020.03.09 at 04:49:50 PM EET // package com.eurodyn.okstra; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for Art_Leistungserbringer_PflegeType complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="Art_Leistungserbringer_PflegeType"&gt; * &lt;complexContent&gt; * &lt;extension base="{http://www.opengis.net/gml/3.2}AbstractFeatureType"&gt; * &lt;sequence&gt; * &lt;element name="Kennung" type="{http://www.w3.org/2001/XMLSchema}string"/&gt; * &lt;element name="Langtext" type="{http://www.w3.org/2001/XMLSchema}string"/&gt; * &lt;/sequence&gt; * &lt;/extension&gt; * &lt;/complexContent&gt; * &lt;/complexType&gt; * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "Art_Leistungserbringer_PflegeType", propOrder = { "kennung", "langtext" }) public class ArtLeistungserbringerPflegeType extends AbstractFeatureType { @XmlElement(name = "Kennung", required = true) protected String kennung; @XmlElement(name = "Langtext", required = true) protected String langtext; /** * Gets the value of the kennung property. * * @return * possible object is * {@link String } * */ public String getKennung() { return kennung; } /** * Sets the value of the kennung property. * * @param value * allowed object is * {@link String } * */ public void setKennung(String value) { this.kennung = value; } /** * Gets the value of the langtext property. * * @return * possible object is * {@link String } * */ public String getLangtext() { return langtext; } /** * Sets the value of the langtext property. * * @param value * allowed object is * {@link String } * */ public void setLangtext(String value) { this.langtext = value; } }
[ "Dimitrios.Papageorgiou@eurodyn.com" ]
Dimitrios.Papageorgiou@eurodyn.com
58090a8ee9cfcf14824c987196987c513261ac65
bc3c6ff149b49a2c24116dcaf2b5900596d99b16
/src/main/java/com/gasyz/spittr/domain/BaseRepository.java
99c55b407b553b70b098ea45405709e5f43ae1d8
[]
no_license
gao-ang/project-template
00fab107f0a153f98282df8d7050448eb53899c1
d9dcacbdc0cb49540005962de3b97383e2b4bcec
refs/heads/master
2020-03-21T02:18:13.904683
2018-06-20T12:02:20
2018-06-20T12:02:20
137,991,725
0
0
null
null
null
null
UTF-8
Java
false
false
150
java
package com.gasyz.spittr.domain; /*@NoRepositoryBean public interface BaseRepository<T, ID extends Serializable> extends JpaRepository<T, ID> { }*/
[ "ga@jxzcwealth.com" ]
ga@jxzcwealth.com
597c12475288fda20d8dc1f6ccd5d0352821fef2
21a636199a2f7714dffc50fe3205bc83d09742d5
/Ejercicios/src/paquetecinco/CondicionalAnidado.java
c7051655eb54afb8cc4077feb55b2f1ca17a5701
[]
no_license
fundamentosprogramacion-aa-2019/clase03-260419-MarjanCs
e0fb1eeacba0fad4658f83cbdfef395f111e55a3
983ec44ac8c5828e49754f28de69bcb356e27be6
refs/heads/master
2020-05-17T09:22:00.272458
2019-04-26T15:49:55
2019-04-26T15:49:55
183,632,021
0
0
null
null
null
null
UTF-8
Java
false
false
1,292
java
package paquetecinco; import paquetedos.MiMensaje2; import java.util.Scanner; public class CondicionalAnidado { public static void main(String[] args) { // documentacion Scanner sc = new Scanner(System.in); System.out.println("Ingrese la calificacion"); int calificacion = sc.nextInt(); String mensaje1 = MiMensaje2.anuncio1; String mensaje2 = MiMensaje2.anuncio2; String mensaje3 = MiMensaje2.anuncio3; String mensaje4 = MiMensaje2.anuncio4; String mensaje5 = MiMensaje2.anuncio5; if (calificacion >= 90) { System.out.printf("%s ( %s) con %d con puntos ",mensaje1,mensaje2, calificacion); } else { if (calificacion < 90 && calificacion >= 80) { System.out.printf("%s (%s) %d con puntos ",mensaje1,mensaje3, calificacion); } else { if (calificacion < 80 && calificacion >= 50) { System.out.printf("%s (%s) %d con puntos",mensaje1,mensaje4, calificacion); } else { System.out.printf("%s %d con puntos",mensaje5, calificacion); } } } } }
[ "marjanazliga@gmail.com" ]
marjanazliga@gmail.com
6371c34859a4311380b32aea7d0dd16a6337ac28
2ba865ef43a15e30d3bff27d8492cbc3572c26b4
/app/src/main/java/me/arulnadhan/androidultimate/AppIntro/SecondLayoutIntro.java
f9a0f492ec8f07e00e71ad4c5cce56f82847bf00
[]
no_license
Kimger/AndroidTemplate
c92c036a197d6fb5504ef29b2293a5ae83e0fe28
97828b43e906e8b37b7917da0218d63048c13386
refs/heads/master
2020-09-14T08:19:50.745234
2018-10-19T06:31:36
2018-10-19T06:31:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
842
java
package me.arulnadhan.androidultimate.AppIntro; import android.content.Intent; import android.os.Bundle; import android.view.View; import me.arulnadhan.androidultimate.R; import me.arulnadhan.appintro.AppIntro2; public class SecondLayoutIntro extends AppIntro2 { @Override public void init(Bundle savedInstanceState) { addSlide(SampleSlide.newInstance(R.layout.intro_2)); addSlide(SampleSlide.newInstance(R.layout.intro2_2)); addSlide(SampleSlide.newInstance(R.layout.intro3_2)); } private void loadMainActivity() { Intent intent = new Intent(this, AppIntroMainActivity.class); startActivity(intent); finish(); } @Override public void onDonePressed() { loadMainActivity(); } public void getStarted(View v) { loadMainActivity(); } }
[ "zhan9kun@qq.com" ]
zhan9kun@qq.com
63b8e962258111395ce3359de7825b0f3d6b9fd0
fa83065a406136cdecfb88b5c37badfd48887d6a
/avenue-net/src/main/java/com/quincysx/avenue/net/result/apiverify/IApiVerify.java
3e445a955c00e3fb10d066a131b10346b2bc4cb4
[ "Apache-2.0" ]
permissive
QuincySx/AvenueNet
1b2c1fd11ace536fff09f2b85f8f8c547854cfd5
604bcd0e22ea8d2cf87d3b6a9f6463d8d19bd6d3
refs/heads/master
2021-01-21T10:46:07.550656
2017-09-08T09:24:49
2017-09-08T09:24:49
101,985,224
9
2
null
null
null
null
UTF-8
Java
false
false
860
java
package com.quincysx.avenue.net.result.apiverify; /* * Copyright (C) 2017 QuincySx<quincysx@sina.com>. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import com.quincysx.avenue.net.result.exception.ApiException; /** * Created by wang.rongqiang on 2017/9/4. */ public interface IApiVerify { <T> void verify(T t) throws ApiException; }
[ "772804430@qq.com" ]
772804430@qq.com
3f6a7f0ac15f98a7aa5b9f91ac7152ad267cca49
36ad869af6280a83bcad4d23c332cca4aa6e2e9a
/zadaci_24_02_2017/Zadatak_01.java
6a1b6bebdf6be005cdcd0353a67d153c19d4c8e3
[]
no_license
zagi9/BILD-IT-Zadaci
6bcf9068ce6aaf1f1c1b2ed7273a2d4924913e7f
2efc329be3a1bf3c2c3d2280a5fa0bb12cf21e2c
refs/heads/master
2021-01-11T06:38:12.621085
2017-03-20T17:32:49
2017-03-20T17:32:49
81,354,599
0
0
null
null
null
null
UTF-8
Java
false
false
714
java
package zadaci_24_02_2017; import utils.Helper; public class Zadatak_01 { public static void main(String[] args) { Helper help = new Helper(); System.out.print("Unesite cijeli broj 0-127: "); int n; boolean isCorrect = false;; do { n = help.checkIntInput(); if (n >= 0 && n <= 127) isCorrect = true; else System.out.println("Uneseni broj mora biti u rasponu 0-127"); } while (!isCorrect); printChar(n); } /** * Method proslijedjeni cijeli broj mijenja u ASCII simbol i ispisuje * @param n */ public static void printChar(int n) { char c =(char) n; System.out.print("Broj " + n + " kao ASCII karakter je " + c); if (n == 32) System.out.println("space"); } }
[ "zagoracmilan@yahoo.com" ]
zagoracmilan@yahoo.com
9120d60e49f15a2971ae435c4a05b5c83d6fc649
f958c3ae3ea1a00f8997faaa026fa7874124f9b3
/smarthome_server_maven/src/main/java/Main.java
fc286cb2d310791316bebebc9027be0908ce4027
[]
no_license
thiensu1122/HomeIoT
d2695828b555e147e66b91766a99b6ee02a6eb1e
6c7d981e7bdf50c96c209193e24f36ed84e74db3
refs/heads/master
2022-12-28T05:06:46.319446
2020-10-15T14:44:30
2020-10-15T14:44:30
289,966,721
0
0
null
null
null
null
UTF-8
Java
false
false
1,840
java
import MQTT.MQTTConnection; import Utility.Utility; import database.DatabaseConnection; import model.Android; import model.Hub; import model.User; import java.util.List; public class Main { private static MQTTConnection mqttConnection; public static void main(String[] args) { List<User> users = getAllUsers(); mqttConnection = new MQTTConnection(); mqttConnection.connect(); subscribeChannels(users); } private static void subscribeChannels(List<User> users){ for(User user : users){ //Utility.printOut(user.getUser_id()); // List<Hub> hubs = getAllHubsFromUser(user); // for(Hub hub : hubs){ // mqttConnection.subscribeChannel(Utility.getChannelHubPrefix() + hub.getHub_id()); // } // List<Android> androids= getAllAndroidsFromUser(user); // for(Android android : androids){ // mqttConnection.subscribeChannel(Utility.getChannleAndroidPrefix()+ android.getAndroid_id()); // } mqttConnection.subscribeChannel(Utility.getChannelPrefix()+user.getUser_id()); } } private static List<Android> getAllAndroidsFromUser(User user){ DatabaseConnection databaseConnection = new DatabaseConnection(); List<Android> androids = databaseConnection.getAndroidsfromUser(user); return androids; } private static List<Hub> getAllHubsFromUser(User user){ DatabaseConnection databaseConnection = new DatabaseConnection(); List<Hub> hubs = databaseConnection.getHubfromUser(user); return hubs; } private static List<User> getAllUsers(){ DatabaseConnection databaseConnection = new DatabaseConnection(); List<User> users = databaseConnection.getAllUser(); return users; } }
[ "thiensuhoisinh2007@gmail.com" ]
thiensuhoisinh2007@gmail.com
b32bb0223f027b8f7a01b39e22c9b92392ee7d81
ff21c565f9eb8c519da4de78c3f9822dad5c2173
/app/src/main/java/com/campus/CampusCake/activity/DetailProductActivity.java
879d79570b721c6f3859ea9b6da32179fae56246
[]
no_license
adamsoro0321/CampusCake
2daf28af63c5230964292ab5f215973e57ba6a18
afb4921c0f982922c0bc6c59a7725aa290f1bf1e
refs/heads/master
2023-08-22T20:55:41.026834
2021-10-10T08:17:48
2021-10-10T08:17:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,204
java
package com.campus.CampusCake.activity; import androidx.appcompat.app.AppCompatActivity; import androidx.fragment.app.DialogFragment; import android.os.Bundle; import android.view.View; import android.widget.Toast; import com.bumptech.glide.Glide; import com.campus.CampusCake.databinding.ActivityDetailProductBinding; import com.campus.CampusCake.model.CommandDialog; import com.campus.CampusCake.model.ProductPrizeEtDes; import com.like.LikeButton; import com.like.OnLikeListener; public class DetailProductActivity extends AppCompatActivity implements CommandDialog.ListenerDialog { private String productId ; private ProductPrizeEtDes product ; private ActivityDetailProductBinding binding ; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); binding=ActivityDetailProductBinding.inflate(getLayoutInflater()) ; setContentView(binding.getRoot()); product= (ProductPrizeEtDes) getIntent().getSerializableExtra("product"); productId =getIntent().getStringExtra("product_id") ; inflate(); binding.starButton.setOnLikeListener(new OnLikeListener() { @Override public void liked(LikeButton likeButton) { Toast.makeText(getApplicationContext() ,"vous aimer ca" ,Toast.LENGTH_LONG).show(); } @Override public void unLiked(LikeButton likeButton) { } }); binding.comandBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { showDialog(); } }); } private void inflate(){ Glide.with(this).load(product.getImg()).into(binding.imgPro) ; binding.nameTitle.setText(product.getName()); binding.prizeTi.setText(product.getPrize() +" FCFA"); binding.desId.setText(product.getDescription()); } private void showDialog(){ DialogFragment dialog =new CommandDialog(this) ; dialog.show(getSupportFragmentManager(),"command dialog"); } @Override public ProductPrizeEtDes getProduct() { return this.product ; } }
[ "adamsoro0321@gmail.com" ]
adamsoro0321@gmail.com
2a8edf28d82e355fa55ad18598982cfe6d2bbf74
55b3651d0cb62c91816dbfb9c14324c01bd64b65
/Fianl Project/杨楠-151220142/Final_Project/src/main/java/FinalProject/Ground.java
7f987909fc38704e6e053f978c088ef2a7b960a6
[]
no_license
irishaha/java-2017f-homework
e942688ccc49213ae53c6cee01552cf15c7345f5
af9b2071de4896eebbb27da43d23e4d8a84c8b5d
refs/heads/master
2021-09-04T07:54:46.721020
2018-01-17T06:51:12
2018-01-17T06:51:12
103,260,952
2
0
null
2017-10-18T14:50:25
2017-09-12T11:17:27
Java
UTF-8
Java
false
false
974
java
package FinalProject; import javax.swing.JFrame; public final class Ground extends JFrame { private final int OFFSET = 30; private static Field field; private int level; private static boolean first; public Ground() { first = false; } public void InitUI() { field = new Field(); add(field); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(field.getBoardWidth() + OFFSET -10, field.getBoardHeight() + 2 * OFFSET -20); setLocationRelativeTo(null); setTitle("Round"+Level.getlevel()); } public static void flush() { field.restartLevel(); field.repaint(); } public void gamestart() { if(!first) { InitUI(); setVisible(true); first = true; } else { int i = Level.getlevel(); setTitle("Round"+i); } } public void gamestart(int i) { if(i==0) setTitle("Load Mode"); } }
[ "1158864287@qq.com" ]
1158864287@qq.com
52857534ef5f2917ba9b80626d830c7473affd79
e4defe6f5f85cf587adba7111adc279d6ab5c2fa
/src/main/java/com/example/ws/message/MethodInfo.java
6234ecd46dd8e3f65e2799996c35da494a72d722
[]
no_license
jackwang110/ws
c7c4fcd00351326f20eec2c03627cae06b9ff779
0d73425b0fe0dc84a2ef0425397e06b67ffd6344
refs/heads/main
2023-03-13T18:03:45.393981
2021-03-11T06:47:00
2021-03-11T06:47:00
304,182,743
0
0
null
null
null
null
UTF-8
Java
false
false
456
java
package com.example.ws.message; import java.lang.reflect.Method; public class MethodInfo { public Object obj; public Method method; public static MethodInfo valueOf(Method method, Object obj) { MethodInfo info = new MethodInfo(); info.method = method; info.obj = obj; return info; } public Object getObj() { return obj; } public Method getMethod() { return method; } }
[ "1003321465@qq.com" ]
1003321465@qq.com
b4e4371886a9e6f564955ca0edd03441b774ce6c
0d23925c43d5a8d5ee7b0ac6bf0de3dfe465e6d7
/src/main/java/ohtu/ohtuvarasto/Varasto.java
8895c766a5419fd69099e33b55bea2ed8ad7b930
[]
no_license
nagajaga/ohtu-2019-viikko1
f0dc67aa7e8af86b2944367567f71166b6420c6e
4dc061c83fefb7ec71ef596c0a8eb8ecd37d8227
refs/heads/master
2020-08-30T20:04:06.169198
2019-11-09T14:23:42
2019-11-09T14:23:42
218,476,069
0
0
null
null
null
null
UTF-8
Java
false
false
2,400
java
package ohtu.ohtuvarasto; public class Varasto { // --- piilotettu tietorakenteen toteutus: --- private double tilavuus; // paljonko varastoon mahtuu, > 0 private double saldo; // paljonko varastossa on nyt, >= 0 // --- konstruktorit: --- public Varasto(double tilavuus) { // tilavuus on annettava if (tilavuus > 0.0) { this.tilavuus = tilavuus; } else {// virheellinen, nollataan this.tilavuus = 0.0; // => käyttökelvoton varasto } saldo = 0; // oletus: varasto on tyhjä } public Varasto(double tilavuus, double alkuSaldo) { // kuormitetaan this(tilavuus); if (alkuSaldo < 0.0) { this.saldo = 0.0; } else if (alkuSaldo <= tilavuus) { this.saldo = alkuSaldo; } else { this.saldo = tilavuus; // täyteen ja ylimäärä hukkaan! } } // --- ottavat aksessorit eli getterit: --- public double getSaldo() { return saldo; } public double getTilavuus() { return tilavuus; } public double paljonkoMahtuu() { // huom: ominaisuus voidaan myös laskea return tilavuus - saldo; // ei tarvita erillistä kenttää vielaTilaa tms. } // --- asettavat aksessorit eli setterit: --- public void lisaaVarastoon(double maara) { if (maara < 0) { return; // tällainen pikapoistuminenkin! } if (maara <= paljonkoMahtuu()) { saldo = saldo + maara; // ihan suoraan sellaisinaan } else { saldo = tilavuus; // täyteen ja ylimäärä hukkaan! } } public double otaVarastosta(double maara) { if (maara < 0) { return 0.0; // tällainen pikapoistuminenkin! } if (maara > saldo) { // annetaan mitä voidaan double kaikkiMitaVoidaan = saldo; saldo = 0.0; // ja tyhjäksi menee return kaikkiMitaVoidaan; // poistutaan saman tien } // jos tänne päästään, kaikki pyydetty voidaan antaa saldo = saldo - maara; // vähennetään annettava saldosta return maara; } // --- Merkkijonoesitys Varasto-oliolle: ---- public String toString() { return ("saldo = " + saldo + ", vielä tilaa " + paljonkoMahtuu()); } }
[ "workworkjoel@gmail.com" ]
workworkjoel@gmail.com
8771074d4fd3462f78600822d4a5aa7685a05421
7d4851db76dff0231e123c770798dd650ae55fca
/src/application/UI.java
032e30377896a546b84534dcc0cd2dde6e6ad8d5
[]
no_license
Nadia-Hamid/chess-system-java
76aa32f6976d7eba34348fae2375e9c8be390ff2
94b295a13f0cac8f90a0ec242b9d282ec8f68d51
refs/heads/master
2020-12-04T04:07:58.383671
2020-01-05T18:20:28
2020-01-05T18:20:28
231,604,140
0
0
null
null
null
null
UTF-8
Java
false
false
3,907
java
package application; import java.util.Arrays; import java.util.InputMismatchException; import java.util.List; import java.util.Scanner; import java.util.stream.Collectors; import chess.ChessMatch; import chess.ChessPiece; import chess.ChessPosition; import chess.Color; public class UI { public static final String ANSI_RESET = "\u001B[0m"; public static final String ANSI_BLACK = "\u001B[30m"; public static final String ANSI_RED = "\u001B[31m"; public static final String ANSI_GREEN = "\u001B[32m"; public static final String ANSI_YELLOW = "\u001B[33m"; public static final String ANSI_BLUE = "\u001B[34m"; public static final String ANSI_PURPLE = "\u001B[35m"; public static final String ANSI_CYAN = "\u001B[36m"; public static final String ANSI_WHITE = "\u001B[37m"; public static final String ANSI_BLACK_BACKGROUND = "\u001B[40m"; public static final String ANSI_RED_BACKGROUND = "\u001B[41m"; public static final String ANSI_GREEN_BACKGROUND = "\u001B[42m"; public static final String ANSI_YELLOW_BACKGROUND = "\u001B[43m"; public static final String ANSI_BLUE_BACKGROUND = "\u001B[44m"; public static final String ANSI_PURPLE_BACKGROUND = "\u001B[45m"; public static final String ANSI_CYAN_BACKGROUND = "\u001B[46m"; public static final String ANSI_WHITE_BACKGROUND = "\u001B[47m"; // https://stackoverflow.com/questions/2979383/java-clear-the-console public static void clearScreen() { System.out.print("\033[H\033[2J"); System.out.flush(); } public static ChessPosition readChessPosition(Scanner sc) { try { String s = sc.nextLine(); char column = s.charAt(0); int row = Integer.parseInt(s.substring(1)); return new ChessPosition(column, row); } catch (RuntimeException e) { throw new InputMismatchException(" Error reading ChessPosition. Valid values are from a1 to h8. "); } } public static void printMatch(ChessMatch chessMatch, List<ChessPiece>captured) { printBoard(chessMatch.getPieces()); System.out.println(); printCapturedPieces(captured); System.out.println(); System.out.println("Turn : " + chessMatch.getTurn()); System.out.println("Waiting player: " + chessMatch.getCurrentPlayer()); } public static void printBoard(ChessPiece[][] pieces) { for (int i = 0; i < pieces.length; i++) { System.out.println((8 - i) + " "); for (int j = 0; j < pieces.length; j++) { printPiece(pieces[i][j], false); } System.out.println(); } System.out.println(" a, b, c, d, e, f, g, h"); } public static void printBoard(ChessPiece[][] pieces, boolean[][] possibleMoves) { for (int i = 0; i < pieces.length; i++) { System.out.println((8 - i) + " "); for (int j = 0; j < pieces.length; j++) { printPiece(pieces[i][j], possibleMoves[i][j]); } System.out.println(); } System.out.println(" a, b, c, d, e, f, g, h"); } private static void printPiece(ChessPiece piece, boolean background) { if(background) { System.out.print(ANSI_BLUE_BACKGROUND); } if (piece == null) { System.out.print(" -"); } else { if (piece.getColor() == Color.WHITE) { System.out.print(ANSI_WHITE + piece + ANSI_RESET); } else { System.out.print(ANSI_YELLOW + piece + ANSI_RESET); } } System.out.print(" "); } private static void printCapturedPieces(List<ChessPiece> captured) { //lambda List <ChessPiece> white = captured.stream().filter(x -> x.getColor() == Color.WHITE).collect(Collectors.toList()); List <ChessPiece> black = captured.stream().filter(x -> x.getColor() == Color.BLACK).collect(Collectors.toList()); System.out.println("Captured pieces: "); System.out.print("White: "); System.out.print(ANSI_WHITE); System.out.println(Arrays.toString(white.toArray())); System.out.println(ANSI_RESET); System.out.print("Black: "); System.out.print(ANSI_YELLOW); System.out.println(Arrays.toString(white.toArray())); System.out.println(ANSI_RESET); } }
[ "56875847+Nadia-Hamid@users.noreply.github.com" ]
56875847+Nadia-Hamid@users.noreply.github.com
3a596a4e769cdb0600f062f0db19bf42f3c748d9
1f2693e57a8f6300993aee9caa847d576f009431
/myfaces-csi/myfaces-skins/examples/src/main/java/org/apache/myfaces/examples/listexample/TreeTable.java
a2ac7b93d932dd065af2ed2039ce8d027348c4db
[]
no_license
mr-sobol/myfaces-csi
ad80ed1daadab75d449ef9990a461d9c06d8c731
c142b20012dda9c096e1384a46915171bf504eb8
refs/heads/master
2021-01-10T06:11:13.345702
2009-01-05T09:46:26
2009-01-05T09:46:26
43,557,323
0
0
null
null
null
null
UTF-8
Java
false
false
3,419
java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.myfaces.examples.listexample; import java.io.Serializable; import org.apache.myfaces.custom.tree.DefaultMutableTreeNode; import org.apache.myfaces.custom.tree.model.DefaultTreeModel; /** * <p> * Bean holding the tree hierarchy. * </p> * * @author <a href="mailto:dlestrat@apache.org">David Le Strat</a> */ public class TreeTable implements Serializable { /** * serial id for serialisation versioning */ private static final long serialVersionUID = 1L; private DefaultTreeModel treeModel; /** * @param treeModel The treeModel. */ public TreeTable(DefaultTreeModel treeModel) { this.treeModel = treeModel; } /** * <p> * Default constructor. * </p> */ public TreeTable() { DefaultMutableTreeNode root = new DefaultMutableTreeNode(new TreeItem( 1, "XY", "9001", "XY 9001")); DefaultMutableTreeNode a = new DefaultMutableTreeNode(new TreeItem(2, "A", "9001", "A 9001")); root.insert(a); DefaultMutableTreeNode b = new DefaultMutableTreeNode(new TreeItem(3, "B", "9001", "B 9001")); root.insert(b); DefaultMutableTreeNode c = new DefaultMutableTreeNode(new TreeItem(4, "C", "9001", "C 9001")); root.insert(c); DefaultMutableTreeNode node = new DefaultMutableTreeNode(new TreeItem( 5, "a1", "9002", "a1 9002")); a.insert(node); node = new DefaultMutableTreeNode(new TreeItem(6, "a2", "9002", "a2 9002")); a.insert(node); node = new DefaultMutableTreeNode(new TreeItem(7, "a3", "9002", "a3 9002")); a.insert(node); node = new DefaultMutableTreeNode( new TreeItem(8, "b", "9002", "b 9002")); b.insert(node); a = node; node = new DefaultMutableTreeNode(new TreeItem(9, "x1", "9003", "x1 9003")); a.insert(node); node = new DefaultMutableTreeNode(new TreeItem(9, "x2", "9003", "x2 9003")); a.insert(node); this.treeModel = new DefaultTreeModel(root); } /** * @return Returns the treeModel. */ public DefaultTreeModel getTreeModel() { return treeModel; } /** * @param treeModel The treeModel to set. */ public void setTreeModel(DefaultTreeModel treeModel) { this.treeModel = treeModel; } }
[ "lu4242@ea1d4837-9632-0410-a0b9-156113df8070" ]
lu4242@ea1d4837-9632-0410-a0b9-156113df8070
1e7312074b2b97a44d925ed2dfeed275892e6300
9e8f669d216211ed25cd7208d25f918d8031a335
/CCMS/src/main/java/com/kh/ccms/skill/controller/CommentSController.java
7e497057c1f181e4d2dab73a26aac4d8e33ac98e
[]
no_license
CleverCodeMonkeys/ALLIT
d3ce6dfde79a975a09de1e1877b71ca177ca4e6b
6aa7823e66b7409f8ed5bcc1f7f237600a21d585
refs/heads/master
2020-03-24T23:11:33.771249
2018-08-08T09:03:38
2018-08-08T09:03:38
143,122,443
0
0
null
2018-08-08T09:03:39
2018-08-01T07:50:20
JavaScript
UTF-8
Java
false
false
3,182
java
package com.kh.ccms.skill.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.SessionAttribute; import com.kh.ccms.member.model.vo.Member; import com.kh.ccms.skill.model.exception.SkillException; import com.kh.ccms.skill.model.service.CommentSService; import com.kh.ccms.skill.model.vo.CommentS; import com.kh.ccms.skill.model.vo.Skill; @Controller public class CommentSController { @Autowired CommentSService commentSService; @RequestMapping(value="skill/commentSInsert.comm") public String commentInsert(CommentS comment, Model model, @SessionAttribute(name = "m", required= false) Member m, Skill skill) { int result; System.out.println(comment); if(m == null) { model.addAttribute("msg", "로그인 해주세요.").addAttribute("loc", "/"); return "common/msg"; } comment.setWriter_id(m.getId()); try { result = commentSService.commentSInsert(comment); } catch (Exception e) { throw new SkillException("error"); } String loc = "/"; String msg = ""; if(result > 0) { loc = "/skill/skillOneView.ski?no=" + skill.getBoard_id(); msg = "댓글 등록 성공"; } else { msg = "댓글 등록 실패!!"; } model.addAttribute("msg", msg).addAttribute("loc", loc); return "common/msg"; } @RequestMapping(value="skill/commentSUpdat.comm") public String commentUpdate(@RequestParam("co") String comment, @RequestParam("bo") int comment_id ,Model model, Skill skill) { int result; CommentS co = new CommentS(); co.setComment_content(comment); co.setComment_id(comment_id); try { result = commentSService.commentSUpdate(co); } catch (Exception e) { throw new SkillException("error"); } String loc = "/"; String msg = ""; if(result < 0) { loc = "/skill/skill.ski"; msg = "수정 오류"; } model.addAttribute("msg", msg).addAttribute("loc", loc); return "common/msg"; } @RequestMapping(value="skill/commentSDelete.comm") public String commentDelete(@RequestParam("no") int comment_id, @RequestParam("bo") int board_id, Model model, Skill skill) { int result = 0; try{ result = commentSService.commentSDelete(comment_id); } catch (Exception e) { } String loc = "/"; String msg = ""; try{ if(result > 0) { msg = "댓글 삭제 성공!"; loc = "/skill/skillOneView.ski?no=" + board_id; } else { msg = "삭제 실패!"; } } catch (Exception e) { msg = "댓글이 있으면 삭제가 불가능합니다."; } model.addAttribute("loc", loc).addAttribute("msg", msg); return "common/msg"; } }
[ "user2@KH_H" ]
user2@KH_H
da977562d179ee304d7e9fc40f4a3b65c223c75d
3584c50b3121286db7d29c1bdc6e35a8b5d91797
/app/src/main/java/com/odev/proje/OrtaActivity.java
319a9d43448b9f73ce03325d757512cef47eebde
[]
no_license
Eliffdoruk/SoruUygulamasi
7a33833706b84ffac2450e939c9baf028e46fe9a
d211b329d2eb443e3954ab55ff3a9807efb6a72e
refs/heads/master
2022-10-15T13:31:27.390972
2020-06-04T20:22:33
2020-06-04T20:22:33
269,454,110
0
0
null
null
null
null
UTF-8
Java
false
false
5,586
java
package com.odev.proje; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.ImageButton; import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; import java.util.ArrayList; import java.util.Arrays; import java.util.Random; public class OrtaActivity extends AppCompatActivity { DataHelper dataHelper; TextView sorularr,puann,isim_oyun,gecsayi; ImageButton dogru,yanlis,anasayfayagit; RelativeLayout gec; int gecc; Random r=new Random(); int n; int points=0; int SKIP_NUMBER=3; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_orta); dataHelper=new DataHelper(this); gecsayi=(TextView) findViewById(R.id.gecsayi); sorularr=(TextView) findViewById(R.id.sorular); isim_oyun=(TextView) findViewById(R.id.isim_oyun); puann=(TextView) findViewById(R.id.puan); dogru=(ImageButton) findViewById(R.id.dogru); yanlis=(ImageButton) findViewById(R.id.yanlis); isim_oyun.setText(dataHelper.receiveDataString("İsim","Kullanici")); anasayfayagit=(ImageButton) findViewById(R.id.anasayfayagit); gec=(RelativeLayout) findViewById(R.id.gec); anasayfayagit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(OrtaActivity.this,MainActivity.class)); finish(); } }); gecsayi.setText(""+dataHelper.receiveDataInt("Geç",SKIP_NUMBER)); final String[]arrayQ={getString(R.string.o1),getString(R.string.o2),getString(R.string.o3),getString(R.string.o4),getString(R.string.o5),getString(R.string.o6),getString(R.string.o7),getString(R.string.o8),getString(R.string.o9),getString(R.string.o10),getString(R.string.o11),getString(R.string.o12),getString(R.string.o13),getString(R.string.o14),getString(R.string.o15),getString(R.string.o16),getString(R.string.o17),getString(R.string.o18),getString(R.string.o19),getString(R.string.o20),getString(R.string.o21),getString(R.string.o22),getString(R.string.o23),}; final Boolean[]arrayA={true,true,false,true,true,false,true,false,false,false,false,false,true,false,true,true,false,true,false,true,false,true,true}; final ArrayList<String> sorular=new ArrayList<String>(Arrays.asList(arrayQ)); final ArrayList<Boolean>cevaplar= new ArrayList<Boolean>(Arrays.asList(arrayA)); n=r.nextInt(sorular.size()); sorularr.setText(sorular.get(n)); //soruların karışık olmasını sağlar. gec.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { gecsayi.setText(""+dataHelper.receiveDataInt("Geç",SKIP_NUMBER)); gecc=dataHelper.receiveDataInt("Geç",SKIP_NUMBER); if (dataHelper.receiveDataInt("Geç",SKIP_NUMBER)==0) { Toast.makeText(OrtaActivity.this,"0 Geçme Hakkını Kaldı.", Toast.LENGTH_SHORT).show(); } else { gecc--; sorular.remove(n); cevaplar.remove(n); if (sorular.size()==0) { result(); } else { n=r.nextInt(sorular.size()); sorularr.setText(sorular.get(n)); dataHelper.saveDataInt("Geç",gecc); } } } }); dogru.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if(cevaplar.get(n)) { points++; sorular.remove(n); cevaplar.remove(n); puann.setText("Skor:"+points); if (sorular.size()==0) { result(); } else { n=r.nextInt(sorular.size()); sorularr.setText(sorular.get(n)); } } else { result(); } } }); yanlis.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if(!cevaplar.get(n)) { points++; sorular.remove(n); cevaplar.remove(n); puann.setText("Skor:"+points); if (sorular.size()==0) { result(); } else { n=r.nextInt(sorular.size()); sorularr.setText(sorular.get(n)); } } else { result(); } } }); } private void result() { dataHelper.saveDataInt("PUAN ORTA:",points); startActivity(new Intent(OrtaActivity.this,OrtaResultActivity.class)); finish(); } }
[ "66441885+Eliffdoruk@users.noreply.github.com" ]
66441885+Eliffdoruk@users.noreply.github.com
2220359340b73f6b923fc57529db6694b82ae5d6
f025984902808cc5d0b32d8f3b3fa9d6025e0a32
/src/test/java/me/june/academy/domain/teacher/repository/TeacherRepositoryTest.java
672a9fd8999a969d37a03b53aa43dae242a5a300
[]
no_license
ces518/JPA-Practice-AMS
8f00f56cdb00ba69e2b8eb3039e629611bb53d56
01de3ab30569ff0133e0a54b95ba9b8990e6c10b
refs/heads/master
2021-03-04T14:12:05.546721
2020-04-12T10:13:57
2020-04-12T10:13:57
246,040,730
1
0
null
null
null
null
UTF-8
Java
false
false
2,054
java
package me.june.academy.domain.teacher.repository; import me.june.academy.domain.teacher.Teacher; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.transaction.annotation.Transactional; import java.util.List; import static org.assertj.core.api.Assertions.assertThat; @SpringBootTest @Transactional class TeacherRepositoryTest { @Autowired TeacherRepository teacherRepository; @BeforeEach public void before() { teacherRepository.save(new Teacher("teacherA", "010-1234-1234")); teacherRepository.save(new Teacher("teacherB", "010-1234-1234")); teacherRepository.save(new Teacher("teacherC", "010-1234-1234")); } @Test public void findAll_no_search() throws Exception { // given PageRequest pageRequest = PageRequest.of(0, 10); TeacherSearch teacherSearch = new TeacherSearch(); // when Page<Teacher> page = teacherRepository.findAll(teacherSearch, pageRequest); List<Teacher> teachers = page.getContent(); long totalCount = page.getTotalElements(); // then assertThat(totalCount).isEqualTo(3); assertThat(teachers.size()).isEqualTo(3); } @Test public void findAll_search() throws Exception { // given PageRequest pageRequest = PageRequest.of(0, 10); TeacherSearch teacherSearch = new TeacherSearch("teacherB"); // when Page<Teacher> page = teacherRepository.findAll(teacherSearch, pageRequest); List<Teacher> teachers = page.getContent(); long totalCount = page.getTotalElements(); // then assertThat(totalCount).isEqualTo(1); assertThat(teachers.size()).isEqualTo(1); assertThat(teachers.get(0).getName()).isEqualTo("teacherB"); } }
[ "pupupee9@gmail.com" ]
pupupee9@gmail.com
94c0aa3ed6532958531151e6b30c45f543dda6c7
1f54712e7e7b4ebef73aa39ed677abc3678c225a
/src/main/java/com/revature/rit/reposistory/IssueActionRepository.java
008c7cec1f892ab9e1ebc0d433ef78c277aed35b
[]
no_license
ryanmohler17/RIT-Backend
e9abc69ce56ae5a157728c904fd10e9853abbac9
a0f5626ade3cf51fbead52d1bf0ceee28f4a3b6f
refs/heads/master
2023-08-30T19:50:49.458936
2021-11-01T23:25:44
2021-11-01T23:25:44
417,596,407
0
1
null
2021-10-24T01:59:02
2021-10-15T18:20:46
Java
UTF-8
Java
false
false
300
java
package com.revature.rit.reposistory; import com.revature.rit.models.issues.IssueAction; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; @Repository public interface IssueActionRepository extends CrudRepository<IssueAction, Integer> { }
[ "albert.figallo@gmail.com" ]
albert.figallo@gmail.com
f242151d2c992f9830db4661ef3ed5a619f01276
71b064b35f3b3d67e748bccd6bdd64a5d98f87c4
/xnet2/src/main/java/com/xnet/xnet2/bean/Fidbean.java
6482bd033a1d6af034337bf3c3d72015e202d74a
[]
no_license
sengeiou/SlideDrawer
f81d2759c7fefcfdb5ae26e2f73ea2563b9783e4
e6c9d6514e4b07abfea5887343879742290be955
refs/heads/master
2020-08-21T14:34:05.171921
2019-02-01T16:04:36
2019-02-01T16:04:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
282
java
package com.xnet.xnet2.bean; /* * Created by qianli.ma on 2019/1/9 0009. */ public class Fidbean { private String fid; public Fidbean() { } public String getFid() { return fid; } public void setFid(String fid) { this.fid = fid; } }
[ "wzhiqiang@jrdcom.com" ]
wzhiqiang@jrdcom.com
eaf87185e51e0c50215f335346d2d9f76341f0a3
3238c9f4aab45762901474bf1845a28e51b01800
/Leetcode/src/array/Dominator.java
6223c2dc4e8ba0f53751aebf1ffacce29f32fbbe
[]
no_license
jiw065/algorithm-practice
5062cbbffc65139bf9daf23f94c173ce0e56a921
7e53bfed035bfec0519422b94b6ff87a40c30b64
refs/heads/master
2020-06-04T16:26:56.058604
2019-09-26T19:21:17
2019-09-26T19:21:17
192,102,512
0
0
null
null
null
null
UTF-8
Java
false
false
1,405
java
package array; import java.util.Arrays; public class Dominator { public int solution(int[] A) { // write your code in Java SE 8 int half = A.length/2; if (A.length == 0){ return -1; } if (A.length == 1){ return 0; } int[] B = new int[A.length]; for (int i = 0;i<A.length;i++){ B[i] = A[i]; } Arrays.sort(B); int count = 1; int max = Integer.MIN_VALUE; int num = -1; for (int j=0 ;j <A.length -1 ;j++){ if (B[j] != B[j+1]){ count = 1; }else{ count++; } if(max < count){ max = count; num = B[j]; } } // System.out.println("this is a debug message "+max+" "+num+" "+half); if(max > half){ int i = 0; while(num != A[i] && i < A.length){ i++; } return i; }else{ return -1; } } public static void main(String[] args) { // TODO Auto-generated method stub } }
[ "wwjjjj0923@gmail.com" ]
wwjjjj0923@gmail.com
2d04b122f31077d7334f9214e3b2da88d4f038a1
f5f5d836c9a2fb7636d02283ccc6753678c273ad
/Enox Server/src/com/rs/game/minigames/PuroPuro.java
5334191d03e008d97ab03b8d29cb3cbb2d8c0cb0
[]
no_license
gnmmarechal/EnoxScapeReloaded
3a48c1925fef1bfb7969230f4258a65ae21c7bf2
ae9639be756b4adb139faa00553adf3e26c488fe
refs/heads/master
2020-04-22T12:54:40.777755
2019-06-28T20:46:34
2019-06-28T20:46:34
170,389,675
0
0
null
null
null
null
UTF-8
Java
false
false
173
java
package com.rs.game.minigames; import com.rs.game.player.controlers.Controler; public class PuroPuro extends Controler { @Override public void start() { } }
[ "mliberato@gs2012.xyz" ]
mliberato@gs2012.xyz
18ec5f1fed625e194758c6a26c02fa4ec457b4e3
54da5dbd545031185cdecd3072987ed96ad4351a
/curso_programacao/src/model/entities/Circle.java
c6b6f5ff39501ec758d6ca73f55a48b474737fdb
[]
no_license
devfelipesantiago/java-exercicios
74acf2cf13272f0474f30571d81bbad0c176a253
bbc425ab9434055f215492eb758508ac5ab3f1fb
refs/heads/main
2023-08-25T05:18:59.520174
2021-09-11T19:56:16
2021-09-11T19:56:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
512
java
package model.entities; import model.entities.enums.Color; public class Circle extends Shape { private Double radius; public Circle() { super(); } public Circle(Color color, Double radius) { super(color); this.radius = radius; } public Double getRadius() { return radius; } public void setRadius(Double radius) { this.radius = radius; } @Override public double area() { return Math.PI * radius * radius; } }
[ "felipesantiagolds@gmail.com" ]
felipesantiagolds@gmail.com
340d2cef10816ce98dbb196c89d1fffb012f3459
d10209e8560f7553e9ede0511f7f3fd6ef267691
/src/main/java/com/space/SpaceApplication.java
4d4e0ade3e7fee602827f79ee15d43b6247f2b90
[]
no_license
lgc-666/space
d9437ac93b9a45b27e39dd14b5657ae2d402b7bc
c70307ce57a8c66f72e47a8ead391de2757df60d
refs/heads/master
2022-12-09T11:44:15.794658
2020-09-10T16:01:00
2020-09-10T16:01:00
294,460,785
0
0
null
null
null
null
UTF-8
Java
false
false
927
java
package com.space; import com.space.util.PortUtil; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cache.annotation.EnableCaching; import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; @SpringBootApplication @EnableCaching @EnableElasticsearchRepositories(basePackages = "com.space.es") @EnableJpaRepositories(basePackages = {"com.space.dao", "com.space.pojo"}) public class SpaceApplication { static { PortUtil.checkPort(6379,"Redis 服务端",true); PortUtil.checkPort(9300,"ElasticSearch 服务端",true); PortUtil.checkPort(5601,"Kibana 工具", true); } public static void main(String[] args) { SpringApplication.run(SpaceApplication.class, args); } }
[ "lgc-888@qq.com" ]
lgc-888@qq.com
5060e13dee244507420dd0a0552ee1e303ca371b
113da6bb5de2f958650fe361360816fbfa345365
/main/java/javaIO流/Demo4字符输入输出流/BufferedReaderDemo.java
05f6dfcb4aea376fd991d973ece536c3d0cb76d9
[]
no_license
xuzaiya/javaCodeForInterview
b10eaca646fe020a369d657aa61146d94ab27224
d4f5033b5e4dd052e298568f40b29bfcfef98067
refs/heads/master
2022-12-01T22:07:01.643868
2020-08-09T10:38:56
2020-08-09T10:38:56
286,671,080
0
0
null
null
null
null
UTF-8
Java
false
false
1,728
java
package javaIO流.Demo4字符输入输出流; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; /* * 字符输入流缓冲流 * java.io.BufferedReader 继承 Reader * 读取功能 read() 单个字符,字符数组 * 构造方法: * BufferedReader(Reader r) * 可以任意的字符输入流 * FileReader InputStreamReader * * BufferedReader自己的功能 * String readLine() 读取文本行 \r\n * * 方法读取到流末尾,返回null * 小特点: * 获取内容的方法一般都有返回值 * int 没有返回的都是负数 * 引用类型 找不到返回null * boolean 找不到返回false * * String s = null * String s ="null" * * readLine()方法返回行的有效字符,没有\r\n */ public class BufferedReaderDemo { public static void main(String[] args) throws IOException { int lineNumber = 0; //创建字符输入流缓冲流对象,构造方法传递字符输入流,包装数据源文件 BufferedReader bfr = new BufferedReader(new FileReader("e:\\buffer.txt")); //调用缓冲流的方法 readLine()读取文本行 //循环读取文本行, 结束条件 readLine()返回null String line = null; while((line = bfr.readLine())!=null){ lineNumber++; System.out.println(lineNumber+" "+line); } bfr.close(); } } /* * String line = bfr.readLine(); System.out.println(line); line = bfr.readLine(); System.out.println(line); line = bfr.readLine(); System.out.println(line); line = bfr.readLine(); System.out.println(line); line = bfr.readLine(); System.out.println(line); */
[ "274404901@qq.com" ]
274404901@qq.com
e56394f37ff918fe33103d50f074952acd8d4f7b
deb2134df79ce428843c92711772f7d0e6166a25
/source/rmas/src/java/main/com/dl/rmas/web/vm/system/ConfigQueryVM.java
d87a9a63b36c0e14ccd2512fcbb479aa37777101
[]
no_license
zhiqsyr/rmas
773a87509b9cb03f3df2d8a9891ea0387f5e4ba3
fe33f29e09aaf73f8ae19027be5c6dd491b2cea4
refs/heads/master
2020-12-25T17:01:39.316742
2017-07-04T05:50:23
2017-07-04T05:50:23
58,859,415
0
0
null
null
null
null
UTF-8
Java
false
false
2,420
java
package com.dl.rmas.web.vm.system; import java.util.HashMap; import java.util.List; import java.util.Map; import org.zkoss.bind.annotation.Command; import org.zkoss.bind.annotation.Init; import org.zkoss.bind.annotation.NotifyChange; import org.zkoss.zk.ui.select.annotation.WireVariable; import com.dl.rmas.common.cache.Constants; import com.dl.rmas.entity.DictCode; import com.dl.rmas.entity.DictType; import com.dl.rmas.service.DictTypeCodeService; public class ConfigQueryVM extends BaseVM { public static final String KEY_CONFIG = "config"; public static final String KEY_TYPE_ID = "typeId"; @WireVariable private DictTypeCodeService dictTypeCodeService; private List<DictType> dictTypes; private List<DictCode> dictCodes; private DictType selectedType; private DictCode selectedCode; @Init public void init() { dictTypes = dictTypeCodeService.queryAllValid(DictType.class); } @Command @NotifyChange({"dictCodes", "selectedCode"}) public void onSelectType() { dictCodes = dictTypeCodeService.queryDictCodesByDictTypeId(selectedType.getTypeId()); selectedCode = null; } @Command @NotifyChange({"dictCodes"}) public void onShowAdd() { Map<String, Object> args = new HashMap<String, Object>(); args.put(KEY_TYPE_ID, selectedType.getTypeId()); showModal(ConfigEditVM.URL_CONFIG_EDIT, args); dictCodes = dictTypeCodeService.queryDictCodesByDictTypeId(selectedType.getTypeId()); } @Command @NotifyChange({"dictCodes"}) public void onShowEdit() { Map<String, Object> args = new HashMap<String, Object>(); args.put(KEY_CONFIG, selectedCode); showModal(ConfigEditVM.URL_CONFIG_EDIT, args); } @Command @NotifyChange({"dictCodes", "selectedCode"}) public void onDelete() { if (!showQuestionBox(Constants.CONFIRM_TO_DELETE)) { return; } dictTypeCodeService.doRemove(selectedCode); dictCodes = dictTypeCodeService.queryDictCodesByDictTypeId(selectedType.getTypeId()); selectedCode = null; } public DictType getSelectedType() { return selectedType; } public void setSelectedType(DictType selectedType) { this.selectedType = selectedType; } public DictCode getSelectedCode() { return selectedCode; } public void setSelectedCode(DictCode selectedCode) { this.selectedCode = selectedCode; } public List<DictType> getDictTypes() { return dictTypes; } public List<DictCode> getDictCodes() { return dictCodes; } }
[ "zhqisyr@163.com" ]
zhqisyr@163.com
9aeb162e6b38798d21edb91d88df0c4f94bc461b
a9f352a3adf240325ba4486d932380c10dd8454b
/src/main/java/edu/cpp/cs431/p1/ProcessTable.java
6496a6c5517662c1cb90b0ae608894309172f83c
[]
no_license
wlinnp/cs431-Projects
5bda657ae3ed69028d22ea073198b7a3e357ba20
d3934b9833dc5cf83aa9ccc2238696fe5aee0e22
refs/heads/master
2021-01-23T01:26:08.771562
2017-03-23T04:34:07
2017-03-23T04:34:07
85,907,281
0
0
null
null
null
null
UTF-8
Java
false
false
3,064
java
package edu.cpp.cs431.p1; import edu.cpp.cs431.p1.Commands.*; import edu.cpp.cs431.p1.Misc.Generator; import edu.cpp.cs431.p1.Process.ProcessTableEngine; import edu.cpp.cs431.p1.Process.ProcessTableEngineDetails; import java.util.HashMap; import java.util.Map; import java.util.Scanner; /** * @author Wai Phyo * CS-431 | Project-1 * <p></p> * Main Driver for Process Management Simulation Project */ public class ProcessTable { private static final String COMMAND_NOT_FOUND = "Invalid command, try again."; private static ProcessTableEngine processTableEngine; private static Map<String, ProcessCommand> mapSimpleProcessCommand = new HashMap<String, ProcessCommand>(); public static void main(String[] args) throws CloneNotSupportedException { processTableEngine = new ProcessTableEngineDetails(); Scanner scanner = new Scanner(System.in); String userCommand; fillCommandsInMap(); while (true) { System.out.println("Enter commands. Enter \"exit()\" to exit the program"); userCommand = scanner.nextLine().trim().toLowerCase(); if (processCommand(userCommand)) { break; } } } /** * Fill Hash Maps with respective commands */ private static void fillCommandsInMap() { mapSimpleProcessCommand.put(UserCommand.FORK.getUserCommand(), new ForkCommand(processTableEngine)); mapSimpleProcessCommand.put(UserCommand.PRINT.getUserCommand(), new PrintCommand(processTableEngine)); mapSimpleProcessCommand.put(UserCommand.BLOCKED.getUserCommand(), new BlockCommand(processTableEngine)); mapSimpleProcessCommand.put(UserCommand.YIELD.getUserCommand(), new YieldCommand(processTableEngine)); mapSimpleProcessCommand.put(UserCommand.EXIT.getUserCommand(), new ExitCommand(processTableEngine)); mapSimpleProcessCommand.put(UserCommand.KILL.getUserCommand(), new KillCommand(processTableEngine)); mapSimpleProcessCommand.put(UserCommand.UNBLOCK.getUserCommand(), new UnblockCommand(processTableEngine)); mapSimpleProcessCommand.put(UserCommand.EXECVE.getUserCommand(), new ExecveCommand(processTableEngine)); } /** * * @param userCommand user input * @return result whether to quit the program * @throws CloneNotSupportedException for clone process content to CPU */ private static boolean processCommand(final String userCommand) throws CloneNotSupportedException { String mainCommand = userCommand.split(Generator.SPACE)[0]; if (mapSimpleProcessCommand.get(mainCommand) != null) { if (!mapSimpleProcessCommand.get(mainCommand).operate(userCommand)) { System.out.println(COMMAND_NOT_FOUND); } } else if (mainCommand.equals(UserCommand.QUIT.getUserCommand())) { System.out.println("Exiting. Good day!"); return true; } else { System.out.println(COMMAND_NOT_FOUND); } return false; } }
[ "wlphyo@cpp.edu" ]
wlphyo@cpp.edu
3bda5d43292cd5f50813300273a1c85c536f016f
ba93ed0f36a7d1165e1438ece44f752d7aa1130b
/src/com/smellydog/android/perdiem/activities/MainMenuActivity.java
b4b18948641dc7d7826bf8f09e3c3b31a8c66b22
[]
no_license
ncapito/PerDiem
67c53e3fb0b6d325a92874f34513b73657c2f4b9
1a0c2f1ab4d81ca5b56b34afb4d4c6e699046015
refs/heads/master
2020-04-05T23:04:26.087311
2011-02-19T16:16:26
2011-02-19T16:16:26
1,329,401
0
0
null
null
null
null
UTF-8
Java
false
false
2,398
java
package com.smellydog.android.perdiem.activities; import com.smellydog.android.perdiem.R; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.TextView; public class MainMenuActivity extends BaseActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.mainmenu); ListView menuList = (ListView) findViewById(R.id.main_menu_options_LV); //Get menu options... String[] items = getResources().getStringArray(R.array.menu_items); //for each menu apply the menu template ArrayAdapter<String> adapt = new ArrayAdapter<String>(this, R.layout.menu_item, items); menuList.setAdapter(adapt); //Setup the transitions... menuList.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View itemClicked, int position, long id) { // Note: if the list was built "by hand" the id could be used. // As-is, though, each item has the same id TextView textView = (TextView) itemClicked; String strText = textView.getText().toString(); if (strText.equalsIgnoreCase(getResources().getString(R.string.menu_item_today))) { // Launch the Game Activity startActivity(new Intent(MainMenuActivity.this, TodayActivity.class)); } else if (strText.equalsIgnoreCase(getResources().getString(R.string.menu_item_calendar))) { // Launch the Help Activity startActivity(new Intent(MainMenuActivity.this, CalendarActivity.class)); } else if (strText.equalsIgnoreCase(getResources().getString(R.string.menu_item_settings))) { // Launch the Settings Activity startActivity(new Intent(MainMenuActivity.this, SettingsActivity.class)); } else if (strText.equalsIgnoreCase(getResources().getString(R.string.menu_item_exit))) { // Launch the Scores Activity finish(); } } }); } }
[ "ncapito@gmail.com" ]
ncapito@gmail.com
b05e31aa9372d8ef7f98a2817c397d7c44e322c8
60e6639c29d373b404fd1dfb64872bbc42fbd965
/src/main/java/com/numeryx/kafkaspring/KafkaSpringApplication.java
ced432b87c1cc95be50bac246b179a764a1f999b
[]
no_license
abdessmad/kafkaGit
829cd3813c06debd153aaf85e45386a91b059411
3008028fcfecc651fcf6225c5575001d380d9132
refs/heads/master
2023-03-16T00:25:26.956776
2021-03-09T08:50:14
2021-03-09T08:50:14
345,940,211
0
0
null
null
null
null
UTF-8
Java
false
false
408
java
package com.numeryx.kafkaspring; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.kafka.annotation.EnableKafka; @SpringBootApplication @EnableKafka public class KafkaSpringApplication { public static void main(String[] args) { SpringApplication.run(KafkaSpringApplication.class, args); } }
[ "a.barhoumi@numeryx.fr" ]
a.barhoumi@numeryx.fr
2a2b0b3fd9c3ccda735415b8187bf9a30989f73b
9f213bf023af918339e4ce70b21e31e056ab7185
/03-springboot-dubbo-interface/src/main/java/com/zfs/springboot/service/AdminService.java
c3bd28c21519b3df92e3729d6da0e40460f09ffc
[]
no_license
zfs1711/L-Springboot
b2608a6f5d512fe2f6c62deaa2bb627ceb81dd60
7fc40ef4e6adba60a99f35ddd8bd9f4d5fc00de2
refs/heads/master
2022-04-05T19:46:18.648727
2020-02-15T07:52:43
2020-02-15T07:52:43
240,659,160
0
0
null
null
null
null
UTF-8
Java
false
false
224
java
package com.zfs.springboot.service; import com.zfs.springboot.model.admininfo; public interface AdminService { //查询所有的admin public String sayHi (String name); public admininfo getadmininfo(int id); }
[ "357778109@qq.com" ]
357778109@qq.com
e0ea37ec8e4b25ba589e14c641d745d2d5097f73
d13973994e5692c30b48ee42875525f0a0d37049
/app/src/main/java/com/example/dm2/ejercicios/ejercicio2_ficheros.java
e78a5e7d5e9ff081be4a95c99df17c8dfe258369
[]
no_license
wevel1/SQLite_XMLS_Ficheros
1c6aa01de2e62e39dd96f1bf0ce0e6b19cd122e9
d2b43c3007f5e732754727f724b8cc1b00f378c0
refs/heads/master
2021-01-22T08:39:21.420251
2017-02-14T07:15:19
2017-02-14T07:15:19
81,916,849
0
0
null
null
null
null
UTF-8
Java
false
false
1,403
java
package com.example.dm2.ejercicios; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.ArrayAdapter; import android.widget.Spinner; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; public class ejercicio2_ficheros extends AppCompatActivity { private ArrayList<String> datos= new ArrayList<>(); protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.ejercicio2_ficheros); InputStream is = getResources().openRawResource(R.raw.ejercicio2_raw); BufferedReader br = new BufferedReader(new InputStreamReader(is)); try { String line = br.readLine(); while (line!=null) { datos.add(line); line = br.readLine(); } br.close(); is.close(); } catch (IOException e) { } ArrayAdapter<String> adaptador = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, datos); Spinner spiner = (Spinner)findViewById(R.id.spinner); adaptador.setDropDownViewResource( android.R.layout.simple_spinner_dropdown_item); spiner.setAdapter(adaptador); } }
[ "inigorojo96@gmail.com" ]
inigorojo96@gmail.com
1c18b782e239af56bb68494783b7f4d7caa487f5
bba610c038bec887a1e607d6ca316289335908e5
/src/main/java/br/com/api/data/service/DataService.java
9b8df808cae2914b3e87a0b0af6f1b77559c16fd
[]
no_license
abbarros/MBTC
8d1118009dbdcf7327393536a8acc41f77f11f54
285a640a7fba7ce1ef85586c86bc87f89384f21e
refs/heads/master
2020-03-29T20:34:45.286489
2018-09-26T21:51:17
2018-09-26T21:51:17
150,318,847
0
0
null
null
null
null
UTF-8
Java
false
false
425
java
package br.com.api.data.service; import org.springframework.stereotype.Service; import br.com.api.data.client.DataClient; import br.com.api.data.model.TickerData; import lombok.RequiredArgsConstructor; @Service @RequiredArgsConstructor public class DataService { private final DataClient data; public TickerData ticker() { return data.ticker(); } public TickerData lastTicker() { return data.ticker(); } }
[ "alexbarros@cvc.com.br" ]
alexbarros@cvc.com.br
c53ca767e7179d2999c4f2ac31d5ef218e4392ea
0ebaa4aa36743d4351a2a8dcaf73d33c1cd17d52
/src/main/java/com/jme3/lostVictories/structures/Pickable.java
70842f550f64aeced6ca1727a231981d3f6ea11c
[]
no_license
darthShana/lostVictoriesLauncher
26871e7270ae05cce8e349efb45218f805b1b811
28949bb0c374da1a0b055fe5ae72fe5c7e3c0852
refs/heads/master
2018-09-30T06:14:37.392388
2018-07-08T07:02:34
2018-07-08T07:02:34
112,646,773
0
0
null
null
null
null
UTF-8
Java
false
false
330
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.jme3.lostVictories.structures; import com.jme3.math.Vector3f; import java.util.UUID; /** * * @author dharshanar */ public interface Pickable { public UUID getId(); public Vector3f getLocation(); }
[ "darthShana@gmail.com" ]
darthShana@gmail.com
37e53a655b60c25e7dfe127ec823cda433523b48
1416b4532c8cd9d3961877d9ada3b5f8e3915494
/Maps/gen/de/workshop/fff/R.java
9a7923d1b4facbb24cfaa289b44021ecbd688db0
[]
no_license
rueckemann/WWM
7829d9ea61a8e073f6075793b4694f185a306f54
2711bb30a421680ab94fb21844be5db7e2cb2d6a
refs/heads/master
2021-01-10T20:36:52.855607
2012-02-21T10:39:40
2012-02-21T10:39:40
3,502,755
1
0
null
null
null
null
UTF-8
Java
false
false
966
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package de.workshop.fff; public final class R { public static final class attr { } public static final class drawable { public static final int icon=0x7f020000; public static final int marker=0x7f020001; } public static final class id { public static final int map=0x7f050001; public static final int mapButton=0x7f050000; } public static final class layout { public static final int main=0x7f030000; public static final int map=0x7f030001; } public static final class string { public static final int app_name=0x7f040001; public static final int hello=0x7f040000; public static final int lb_ort=0x7f040003; public static final int mapButtonLabel=0x7f040002; } }
[ "lars.rueckemann@codecentric.de" ]
lars.rueckemann@codecentric.de
f9dbe49f23282d8f9b1b26d91ed18c61cb1bdf84
5bc24ff3a6709cd20c07675190f165b25f17b82b
/src/main/java/com/matthewksc/phoneshop/init.java
9b7b5bd78a21107d230ab0d6a80a86e6bbf27304
[]
no_license
MatthewKsc/phone-shop
d4c2dae6325c55bafd1a213aa055b4013f44e1c1
c444471b40cc2f4bd22af19fa9f31bcb348a649e
refs/heads/master
2022-12-27T03:10:49.643068
2020-10-14T09:38:34
2020-10-14T09:38:34
265,553,000
1
0
null
2020-10-14T09:38:35
2020-05-20T12:06:25
Java
UTF-8
Java
false
false
1,763
java
package com.matthewksc.phoneshop; import com.matthewksc.phoneshop.dao.entity.Company; import com.matthewksc.phoneshop.dao.entity.Phone; import com.matthewksc.phoneshop.dao.entity.Reviews; import com.matthewksc.phoneshop.service.PhoneService; import org.springframework.boot.context.event.ApplicationReadyEvent; import org.springframework.context.event.EventListener; import org.springframework.stereotype.Service; import java.sql.Date; import java.time.LocalDate; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @Service public class init { private PhoneService phoneService; public init(PhoneService phoneService) { this.phoneService = phoneService; } @EventListener(ApplicationReadyEvent.class) public void initData(){ Phone honor20 = new Phone( "Honor20", 1500.00, new Company("Huawei", "China" ,"Shenzhen"), Arrays.asList( new Reviews("Matt", 4, Date.valueOf(LocalDate.now().minusDays(2))), new Reviews("Pat", 3, Date.valueOf(LocalDate.now())) ) ); Phone s20 = new Phone( "S20", 3500.00, new Company("Samsung", "South Korea" ,"Suwon"), Arrays.asList( new Reviews("Matt", 4, Date.valueOf(LocalDate.now().minusDays(2))), new Reviews("Pat", 3, Date.valueOf(LocalDate.now())) ) ); Phone k10 = new Phone( "K10", 700.00, new Company("LG", "South Korea" ,"Seul"), new ArrayList<>() ); phoneService.deleteAll(); List<Phone> phones = Arrays.asList(honor20, s20, k10); phoneService.insertAll(phones); } }
[ "ksciukmateusz@gmail.com" ]
ksciukmateusz@gmail.com
b10aef2b72d3e18b3b9bb2f3f23683831419082b
2b6d287619dc60e0b734a87b6a5421f6b8436d13
/spring-eureka-image/src/main/java/com/eureka/image/entities/Image.java
c08396ce28222773d472614344f4fe7df6ab3f94
[]
no_license
singhavinash123/micro-services-used-cases
8199ccb9ef0fa590eed8e1c0959c0b77b9f336e7
dd045816abe335e8550cfe302253b2f5b63397b9
refs/heads/master
2023-02-06T06:36:55.458581
2020-12-30T14:21:00
2020-12-30T14:21:00
325,568,949
0
0
null
null
null
null
UTF-8
Java
false
false
333
java
package com.eureka.image.entities; import javax.persistence.Entity; import javax.persistence.Id; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @AllArgsConstructor @NoArgsConstructor @Data @Entity public class Image { @Id private int id; private String name; private String url; }
[ "singhavinash857@gmail.com" ]
singhavinash857@gmail.com
3607e286fadd12f9b7a939a27e2f6ad3bd9f35f8
db535dfca5cf4759fc627ce1a2a7b930ee123cd5
/library-info-app/src/main/java/ru/nchernetsov/domain/Book.java
3367e73e5e6e24412598e372ce12a0df24e27d85
[]
no_license
ChernetsovNG/otus_spring_2018_06
d84944d7ac477a266dd57f6d21f870acd2275879
52832f97daaeeeaabdff9463abd7f6bb2141d405
refs/heads/master
2020-03-21T18:48:32.915226
2018-11-29T20:06:49
2018-11-29T20:06:49
138,914,397
0
0
null
2018-11-05T11:20:08
2018-06-27T17:44:45
Java
UTF-8
Java
false
false
3,078
java
package ru.nchernetsov.domain; import org.springframework.data.annotation.Id; import org.springframework.data.mongodb.core.index.Indexed; import org.springframework.data.mongodb.core.mapping.DBRef; import org.springframework.data.mongodb.core.mapping.Document; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.UUID; import java.util.stream.Collectors; @Document(collection = "books") public class Book { @Id private String bookId; @Indexed(unique = true) private String title; @DBRef private List<Author> authors = new ArrayList<>(); @DBRef private List<Genre> genres = new ArrayList<>(); @DBRef private List<Comment> comments = new ArrayList<>(); public Book() { this.bookId = UUID.randomUUID().toString(); } public Book(String title) { this(); this.title = title; } public Book(String title, List<Author> authors, List<Genre> genres) { this(); this.title = title; this.authors = authors; this.genres = genres; } public void addGenre(Genre genre) { genres.add(genre); } public void addComment(Comment comment) { comments.add(comment); } public String getBookId() { return bookId; } public void setBookId(String bookId) { this.bookId = bookId; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public List<Author> getAuthors() { return Collections.unmodifiableList(authors); } public void setAuthors(List<Author> authors) { this.authors = authors; } public List<Genre> getGenres() { return Collections.unmodifiableList(genres); } public void setGenres(List<Genre> genres) { this.genres = genres; } public List<Comment> getComments() { return Collections.unmodifiableList(comments); } public List<String> getCommentsIds() { return comments.stream().map(Comment::getId).collect(Collectors.toList()); } public void setComments(List<Comment> comments) { this.comments = comments; } public void removeComment(String commentText) { for (Comment comment : comments) { if (comment.getComment().equals(commentText)) { comments.remove(comment); break; } } } public void deleteAuthorByName(String name) { for (Author author : authors) { if (author.getName().equals(name)) { authors.remove(author); break; } } } public void deleteGenreByName(String name) { for (Genre genre : genres) { if (genre.getName().equals(name)) { genres.remove(genre); break; } } } @Override public String toString() { return "Book{" + "title='" + title + '\'' + '}'; } }
[ "n.chernetsov86@gmail.com" ]
n.chernetsov86@gmail.com
1f5373436f497f014954ce53584a18ef5422cb54
fb5452e16d2518b472470c29852a193eae0e13f2
/MultiProtocolDownloader/src/main/java/com/vaani/downloader/protocolhelper/TrustAllX509TrustManager.java
513a54a1eb11ab83651738f886548535ea1456d4
[]
no_license
kinshuk4/KodingProbs
50af302b9eee9f8e358057360c8c16792b615830
9d060b3bbae3f8c53ec57f7b025dfe65050321a3
refs/heads/master
2022-12-05T00:55:27.018919
2018-12-13T17:13:31
2019-02-14T17:13:31
78,401,566
0
0
null
2022-11-24T05:28:29
2017-01-09T06:47:13
Java
UTF-8
Java
false
false
703
java
package com.vaani.downloader.protocolhelper; import javax.net.ssl.X509TrustManager; import java.security.cert.X509Certificate; /** * DO NOT USE IN PRODUCTION!!!! * * This class will simply trust everything that comes along. * * @author frank * */ public class TrustAllX509TrustManager implements X509TrustManager { public X509Certificate[] getAcceptedIssuers() { return new X509Certificate[0]; } public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType) { } public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType) { } }
[ "kinshuk.ram@gmail.com" ]
kinshuk.ram@gmail.com
8fe60772b29d10e9e3360188a5a21f414898b645
ff3e2ae0c0fdc8e3629f7e1af0e2b7a098144b5d
/src/com/kaytec/Player.java
ead3573ab5d39a0a3bf8e46a0b5b7a67edd96b73
[]
no_license
keenanhumm/Generics
fef5c373dcfecce3a04c7edb585585cd59621d23
d42ae9d8f7a79571f19a8654ddcdce707ddcd771
refs/heads/master
2020-06-26T05:07:22.932401
2019-08-14T00:08:52
2019-08-14T00:08:52
199,542,153
0
0
null
null
null
null
UTF-8
Java
false
false
266
java
package com.kaytec; public class Player { private String name; public Player(String name) { this.name = name; } public String getName() { return name; } public void setName(String name) { this.name = name; } }
[ "keenan.humm@huskers.unl.edu" ]
keenan.humm@huskers.unl.edu
f00488b8b2f8611542ae10b328fd218d0fa5d287
f7bbf3ec53cbe7cdcb5cec571738aad0b6dea075
/openecomp-be/backend/openecomp-sdc-healthcheck-manager/src/main/java/org/openecomp/sdc/health/data/MonitoredModules.java
576f4c40762fb0665f711ebaa496608cbf115c13
[ "Apache-2.0" ]
permissive
infosiftr/sdc
450d65c6f03bf153bbd09975460651250227e443
a1f23ec5e7cd191b76271b5f33c237bad38c61c6
refs/heads/master
2020-04-15T19:43:14.670197
2018-11-28T09:49:51
2019-01-08T15:37:03
164,961,555
0
0
NOASSERTION
2019-01-10T00:43:14
2019-01-10T00:43:13
null
UTF-8
Java
false
false
536
java
package org.openecomp.sdc.health.data; public enum MonitoredModules { BE("BE"), CAS("Cassandra"), ZU("Zusammen"); private String name; MonitoredModules(String name) { this.name = name; } @Override public String toString() { return name; } public static final MonitoredModules toValue(String inVal) { for (MonitoredModules val : values()) { if (val.toString().equals(inVal)) { return val; } } return null; } }
[ "avi.ziv@amdocs.com" ]
avi.ziv@amdocs.com
220b0d710e996fd465212b1022c1b4deca4c7044
2963d07727d66c2d571ae04ae14fc11e25cdcd00
/SequenceN.java
4c800dd5e8715c08facd59944daa6624c52ee77c
[]
no_license
Qianheorgan/siyuetian
d1913fd15b61b9a2e13910592facb80b79c270b3
8e73174d1751578ce88efefdc669781140449ad3
refs/heads/master
2021-07-08T05:53:12.953448
2020-10-24T06:25:35
2020-10-24T06:25:35
197,773,562
0
0
null
null
null
null
UTF-8
Java
false
false
855
java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class SequenceN { public static void main(String[] args) throws IOException { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); long n = Long.parseLong(bf.readLine()); //one表示第n-1层的数字个数,two表示第n层的数字个数,sum表示第n层的总数字个数 // 如果 sum + two的个数大于等于n,则前一层所有个数就是sum,直接return long one = 0, two = 1, sum = 0; while (sum < n) { long temp = one + two; one = two; two = temp; if (sum + one >=n) { System.out.println(sum); return; } else { sum += one; } } } }
[ "2238571572@qq.com" ]
2238571572@qq.com