blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
d5e8d5946d42eb1cc5ac80e30d7e681723c271fc
116c4902f2706a4e69964dd9c88399e9afcef8cc
/src/main/java/com/kkagr/httpserver/core/WebParser.java
d81a38eda1c83e61e41d0b2acbd459efd09489ea
[]
no_license
kkagr/tomcatproject
a5edd95bedbe2ec7161d290cc4455e595c8b4b58
3eb8c375d9d86065471f1c6104f4feb0696c99ed
refs/heads/master
2020-04-25T04:44:51.006839
2019-03-06T14:44:33
2019-03-06T14:44:33
172,521,248
0
0
null
null
null
null
UTF-8
Java
false
false
2,526
java
package com.kkagr.httpserver.core; import org.dom4j.Document; import org.dom4j.DocumentException; import org.dom4j.Element; import org.dom4j.io.SAXReader; import java.io.File; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; public class WebParser { public static Map<String,Map<String,String>> servletMaps = new HashMap<>(); public static void parser(String[] webAppNames) throws DocumentException { for(String webAppName:webAppNames){ Map<String,String> servletMap = parser(webAppName); servletMaps.put(webAppName,servletMap); } } private static Map<String,String> parser(String webAppName) throws DocumentException { String webPath = webAppName + "/WEB-INF/web.xml"; SAXReader saxReader = new SAXReader(); Document document = saxReader.read(new File(webPath)); List<Element> servletNodes = document.selectNodes("/web-app/servlet"); Map<String,String> servletInfoMap = new HashMap<>(); for(Element servletNode:servletNodes){ Element servletNameElt = (Element) servletNode.selectSingleNode("servlet-name"); String servletName = servletNameElt.getStringValue(); Element servletClassElt = (Element) servletNode.selectSingleNode("servlet-class"); String servletClass = servletClassElt.getStringValue(); servletInfoMap.put(servletName,servletClass); } List<Element> servletMappingNodes = document.selectNodes("/web-app/servlet-mapping"); Map<String,String> servletMappingInfoMap = new HashMap<>(); for(Element servletMappingNode:servletMappingNodes){ Element servletMappingNameElt = (Element) servletMappingNode.selectSingleNode("servlet-name"); String servletMappingName = servletMappingNameElt.getStringValue(); Element urlPatternElt = (Element) servletMappingNode.selectSingleNode("url-pattern"); String urlPatternName = urlPatternElt.getStringValue(); servletMappingInfoMap.put(servletMappingName,urlPatternName); } Set<String> servletNames = servletInfoMap.keySet(); Map<String,String> servletMap = new HashMap<>(); for(String servletName:servletNames){ String urlPattern = servletMappingInfoMap.get(servletName); String className = servletInfoMap.get(servletName); servletMap.put(urlPattern,className); } return servletMap; } }
[ "774634128@qq.com" ]
774634128@qq.com
32ade1a9ce4ba59497da5fa7f12e7badff103f6e
0eee413b40b01b7dfbe29856f43fc351d662230a
/app/src/main/java/com/hfad/fortnitestats/HowToUse.java
9c3d538c3a532b394c0905077226130aca8fbb1e
[]
no_license
Ben-Pestana/FortniteStats
438bb6cb4adeb3f9cdb3b43c8b6ddc1095cd71e6
11a6c8aa0ebb6b68a9d44cc0ec897f744f9b39a6
refs/heads/master
2020-05-02T15:17:30.009077
2019-03-27T16:45:41
2019-03-27T16:45:41
178,036,425
0
0
null
null
null
null
UTF-8
Java
false
false
1,358
java
package com.hfad.fortnitestats; import android.media.MediaPlayer; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.ImageView; import android.widget.TextView; public class HowToUse extends AppCompatActivity { private TextView howTo; private ImageView boogie; private MediaPlayer mp; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_how_to_use); mp = MediaPlayer.create(this, R.raw.boogiebomb); wireWidgets(); setOnCompletionListener(); setOnClickListeners(); } private void setOnClickListeners() { boogie.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mp.start(); } }); } private void setOnCompletionListener() { mp.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { public void onCompletion(MediaPlayer mp) { mp.release(); finish(); } }); } private void wireWidgets() { howTo = findViewById(R.id.textView_howToUse_explanation); boogie = findViewById(R.id.imageView_howToUse_boogie); } }
[ "benrushpestana@gmail.com" ]
benrushpestana@gmail.com
dacb5c9e05e3b635a40ea6b7a21e9f2b8513a1be
e6ef96ec5a687ae8d5bdf77f36cc49d3b691a5f3
/src/Customer.java
48dbd7b4b711759b207997d1ece8c5d47eec08a2
[]
no_license
Crocy1104/Fowler
35ef1135ebe2074a7f90294a8d5247772a1c7b1b
3feb24381da24f6ea012f80f7be2b7d1b562da10
refs/heads/master
2021-01-20T09:42:17.908754
2017-05-10T13:53:49
2017-05-10T13:53:49
90,277,715
0
0
null
null
null
null
UTF-8
Java
false
false
2,320
java
import java.lang.*; import java.util.*; class Customer { private String name; private List<Rental> rentals = new ArrayList<Rental>(); public Customer (String name){ this.name = name; } public void addRental(Rental arg) { this.rentals.add(arg); } public String getName (){ return name; } public String statement() { double totalAmount = 0; int frequentRenterPoints = 0; Enumeration enum_rentals = (rentals).elements(); String result = "Rental Record for " + getName() + "\n"; result += "\t" + "Title" + "\t" + "\t" + "Days" + "\t" + "Amount" + "\n"; for (Rental r : rentals) { double thisAmount = 0; Rental each = (Rental) enum_rentals.nextElement(); //determine amounts for each line thisAmount = amountFor(each); // add frequent renter points frequentRenterPoints ++; // add bonus for a two day new release rental if (each.getMovie().getPriceCode() == Movie.NEW_RELEASE && each.getDaysRented() > 1) { frequentRenterPoints ++; } //show figures for this rental result += "\t" + each.getMovie().getTitle()+ "\t" + "\t" + each.getDaysRented() + "\t" + thisAmount + "\n"; totalAmount += thisAmount; } //add footer lines result += "Amount owed is " + totalAmount + "\n"; result += "You earned " + frequentRenterPoints + " frequent renter points"; return result; } private double amountFor(Rental each) { double thisAmount = 0; switch (each.getMovie().getPriceCode()) { case Movie.REGULAR: thisAmount += 2; if (each.getDaysRented() > 2) { thisAmount += (each.getDaysRented() - 2) * 1.5; } break; case Movie.NEW_RELEASE: thisAmount += each.getDaysRented() * 3; break; case Movie.CHILDRENS: thisAmount += 1.5; if (each.getDaysRented() > 3) { thisAmount += (each.getDaysRented() - 3) * 1.5; } break; } return thisAmount; } }
[ "marcocrocoll@gmx.de" ]
marcocrocoll@gmx.de
23145438713fae5c94badeebd8ec99df86856e84
21d6c260cf5d8a3cf6cb72008b53541b6fa22203
/src/main/java/com/daxiao/designpattern/designpattern/factory/YamlIRuleConfigParser.java
183d89b9c0109e6716458878a5b6be95ef63469d
[]
no_license
DaxiaoYang/designpattern
d9e56deb05ee504e2d56530842c989074e4e08d4
ebeded1c05a0b7c65873e51bb1c8cab8e2f7e63f
refs/heads/main
2023-07-13T21:59:43.848633
2021-08-22T10:26:23
2021-08-22T10:26:23
367,845,368
1
0
null
null
null
null
UTF-8
Java
false
false
280
java
package com.daxiao.designpattern.designpattern.factory; /** * @ description: * @ author: daxiao * @ date: 2021/5/10 */ public class YamlIRuleConfigParser implements IRuleConfigParser { @Override public RuleConfig parse(String filePath) { return null; } }
[ "906298909@qq.com" ]
906298909@qq.com
87e3c8708ada4ff867cb5fbdc887817a17713111
263a8a36623aa8e7d5f86912455b582fbbc0f4d8
/test/unit/src/org/openadaptor/auxil/connector/jms/JMSPropertiesMessageGeneratorTestCase.java
d278a39b00660f823c6e616771edeed374bb7cae
[ "MIT" ]
permissive
commpeter/openadaptor3
142aff5c02b2f4d1861dad1c2c070ce507cfc2d1
6a434ab58c2cb3cbcf8b02b79ba60de4aa3f328b
refs/heads/master
2020-12-07T19:14:36.209483
2012-01-17T15:37:48
2012-01-17T15:37:48
66,144,466
1
0
null
null
null
null
UTF-8
Java
false
false
10,869
java
/* Copyright (C) 2001 - 2008 The Software Conservancy as Trustee. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Nothing in this notice shall be deemed to grant any rights to trademarks, copyrights, patents, trade secrets or any other intellectual property of the licensor or any contributor except as expressly stated herein. No patent license is granted separate from the Software, for code that you delete from the Software, or for combinations of the Software with other software or hardware. */ package org.openadaptor.auxil.connector.jms; import java.util.HashMap; import java.util.Map; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.ObjectMessage; import javax.jms.Session; import javax.jms.TextMessage; import org.dom4j.Document; import org.dom4j.DocumentException; import org.dom4j.DocumentHelper; import org.jmock.Mock; import org.openadaptor.core.exception.ProcessingException; import org.openadaptor.core.exception.RecordFormatException; /* * File: $Header: $ * Rev: $Revision: $ * Created Sep 24, 2008 by oa3 Core Team */ public class JMSPropertiesMessageGeneratorTestCase extends AbstractMessageGeneratorTests { private static final String DEFAULT_MESSAGE_TEXT = "<root><field1>test</field1></root>"; protected IMessageGenerator createTestInstance() { return new JMSPropertiesMessageGenerator(); } protected void setUp() throws Exception { super.setUp(); messageText = DEFAULT_MESSAGE_TEXT; } /** * Tests that sending a random object produces that appropriate exception. */ public void testSendObject() { Mock sessionMock = new Mock(Session.class); Mock objectMessageMock = new Mock(ObjectMessage.class); ObjectMessage message = (ObjectMessage)objectMessageMock.proxy(); sessionMock.expects(once()).method("createObjectMessage").will(returnValue(message)); objectMessageMock.expects(once()).method("setObject").with(eq(messageObject)); Message generatedMessage = null; try { generatedMessage = testInstance.createMessage(messageObject, (Session) sessionMock.proxy()); } catch (JMSException e) { fail("Unexpected JMSException: " + e ); } catch (ProcessingException pe) { return; } assertEquals("Didn't return the expected ObjectMessage.", message, generatedMessage ); } /** * Ensure that the MessageGenerator's properties can be set. */ public void testSetProperties() { Map testMap = new HashMap(); testMap.put("key1", "//field1"); ((JMSPropertiesMessageGenerator)testInstance).setProperties(testMap); assertEquals(testMap, ((JMSPropertiesMessageGenerator)testInstance).getProperties()); } /** * Ensure that the JMS Message Properties are set when valid properties and message contents are used. */ public void testSetMessageProperties() { Map testMap = new HashMap(); testMap.put("key1", "//field1"); ((JMSPropertiesMessageGenerator)testInstance).setProperties(testMap); Mock sessionMock = new Mock(Session.class); Mock textMessageMock = new Mock(TextMessage.class); TextMessage message = (TextMessage)textMessageMock.proxy(); sessionMock.expects(once()).method("createTextMessage").will(returnValue(message)); textMessageMock.expects(once()).method("setText").with(eq(messageText)); textMessageMock.expects(once()).method("setStringProperty").with(eq("key1"), eq("test")); Message generatedMessage = null; try { generatedMessage = testInstance.createMessage(messageText, (Session)sessionMock.proxy()); } catch (JMSException e) { fail("Unexpected JMSException: " + e ); } assertEquals("Didn't return the expected TextMessage.", message, generatedMessage ); } /** * Ensure that a Dom4j Document can be used. */ public void testSendDocument() { Document doc = null; try { doc = DocumentHelper.parseText(messageText); } catch (DocumentException e) { fail("Test text isn't valid xml"); } Mock sessionMock = new Mock(Session.class); Mock textMessageMock = new Mock(TextMessage.class); TextMessage message = (TextMessage)textMessageMock.proxy(); sessionMock.expects(once()).method("createTextMessage").will(returnValue(message)); textMessageMock.expects(once()).method("setText").with(eq(doc.asXML())); Message generatedMessage = null; try { generatedMessage = testInstance.createMessage(doc, (Session)sessionMock.proxy()); } catch (JMSException e) { fail("Unexpected JMSException: " + e ); } assertEquals("Didn't return the expected TextMessage.", message, generatedMessage ); } /** * Ensure that a RecordFormatException is thrown when a string that is not valid XML is sent. */ public void testSendInvalidXML() { String invalidText = "This is not XML"; Mock sessionMock = new Mock(Session.class); Mock textMessageMock = new Mock(TextMessage.class); TextMessage message = (TextMessage)textMessageMock.proxy(); sessionMock.expects(once()).method("createTextMessage").will(returnValue(message)); textMessageMock.expects(once()).method("setText").with(eq(invalidText)); try { testInstance.createMessage(invalidText, (Session)sessionMock.proxy()); } catch (JMSException e) { fail("Unexpected JMSException: " + e ); } catch (RecordFormatException rfe) {return;} fail("Didn't throw expected RecordFormatException" ); } /** * Test that you get a sensible exception when the path to the property value in the xml is invalid. */ public void testInvalidMessageProperty() { Map testMap = new HashMap(); testMap.put("key1", "//InvalidPath"); ((JMSPropertiesMessageGenerator)testInstance).setProperties(testMap); Mock sessionMock = new Mock(Session.class); Mock textMessageMock = new Mock(TextMessage.class); TextMessage message = (TextMessage)textMessageMock.proxy(); sessionMock.expects(once()).method("createTextMessage").will(returnValue(message)); textMessageMock.expects(once()).method("setText").with(eq(messageText)); textMessageMock.expects(once()).method("setStringProperty").with(eq("key1"), eq("test")); Message generatedMessage = null; try { generatedMessage = testInstance.createMessage(messageText, (Session)sessionMock.proxy()); } catch (JMSException e) { fail("Unexpected JMSException: " + e ); } catch (ProcessingException pe) {return;} fail("Didn't throw expected ProcessingException" ); } /** * Test to ensure that a literal property is treated correctly. */ public void testLiteralMessageProperty() { Map testMap = new HashMap(); String literal = "A Literal String"; testMap.put("key1", literal); ((JMSPropertiesMessageGenerator)testInstance).setProperties(testMap); Mock sessionMock = new Mock(Session.class); Mock textMessageMock = new Mock(TextMessage.class); TextMessage message = (TextMessage)textMessageMock.proxy(); sessionMock.expects(once()).method("createTextMessage").will(returnValue(message)); textMessageMock.expects(once()).method("setText").with(eq(messageText)); textMessageMock.expects(once()).method("setStringProperty").with(eq("key1"), eq(literal)); Message generatedMessage = null; try { generatedMessage = testInstance.createMessage(messageText, (Session)sessionMock.proxy()); } catch (JMSException e) { fail("Unexpected JMSException: " + e ); } assertEquals("Didn't return the expected TextMessage.", message, generatedMessage ); } /** * Test to ensure that a mix of literal and xpath properties are treated correctly. */ public void testMixedMessageProperties() { Map testMap = new HashMap(); String literal = "A Literal String"; testMap.put("key1", literal); testMap.put("key2", "//field1"); ((JMSPropertiesMessageGenerator)testInstance).setProperties(testMap); Mock sessionMock = new Mock(Session.class); Mock textMessageMock = new Mock(TextMessage.class); TextMessage message = (TextMessage)textMessageMock.proxy(); sessionMock.expects(once()).method("createTextMessage").will(returnValue(message)); textMessageMock.expects(once()).method("setText").with(eq(messageText)); textMessageMock.expects(once()).method("setStringProperty").with(eq("key1"), eq(literal)); textMessageMock.expects(once()).method("setStringProperty").with(eq("key2"), eq("test")); Message generatedMessage = null; try { generatedMessage = testInstance.createMessage(messageText, (Session)sessionMock.proxy()); } catch (JMSException e) { fail("Unexpected JMSException: " + e ); } assertEquals("Didn't return the expected TextMessage.", message, generatedMessage ); } public void testIsXml() { JMSPropertiesMessageGenerator testGenerator = (JMSPropertiesMessageGenerator)testInstance; assertTrue("Initial value for isXml should be true", testGenerator.getIsXml()); testGenerator.setIsXml(false); assertFalse("Value for isXml should be false at this point", testGenerator.getIsXml()); String testText = "This is not XML"; Mock sessionMock = new Mock(Session.class); Mock textMessageMock = new Mock(TextMessage.class); TextMessage message = (TextMessage)textMessageMock.proxy(); sessionMock.expects(once()).method("createTextMessage").will(returnValue(message)); textMessageMock.expects(once()).method("setText").with(eq(testText)); try { testInstance.createMessage(testText, (Session)sessionMock.proxy()); } catch (JMSException e) { fail("Unexpected JMSException: " + e ); } catch (RecordFormatException rfe) { fail("Unexpected RecordFormatException: " + rfe ); } } }
[ "kscully@c0ec5643-5123-0410-b01b-e101a1959115" ]
kscully@c0ec5643-5123-0410-b01b-e101a1959115
0ab3d8b934e880688528426b33dee58a42ca5343
b4cb1360365f87466e6dfac915198a0e2810e0a3
/app/src/main/java/com/muziko/helpers/ItemTouchHelpers.java
4d1c8ed9a5acc7e488a5a5447bdb6b36e62c5efb
[]
no_license
Solunadigital/Muziko
9b7d38d441c5e41fdea17d07c3d0ab00e15c7c5a
8fb874c4e765949c32591b826baee1937e8d49ca
refs/heads/master
2021-09-09T01:55:13.063925
2018-03-13T08:13:20
2018-03-13T08:13:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
557
java
package com.muziko.helpers; import android.view.animation.Interpolator; /** * Created by Bradley on 28/02/2017. */ public class ItemTouchHelpers { public static final Interpolator sDragScrollInterpolator = t -> { // return t * t * t * t * t; // default return value, but it's too late for me return (int) Math.pow(2, (double) t); // optional whatever you like }; // default public static final Interpolator sDragViewScrollCapInterpolator = t -> { t -= 1.0f; return t * t * t * t * t + 1.0f; }; }
[ "lokeshmehta333@gmail.com" ]
lokeshmehta333@gmail.com
44524fb2b13f078bb14787e6b310ddc7086d7f89
a29690af8f21e398021b03c4068e02847f9f3631
/Competi_1/src/Detevtando_copiones.java
c6bbd8dcc2a7be0b8fb6fc9ae51948fc03b6e5e6
[]
no_license
Miguel-Quenaya/M3_DAW2
40590bdaa012ba0269f18c5e322bed5f8bff30d3
72d40aea3a40a80ff81f36ca8ae2c5db723ce211
refs/heads/main
2023-08-30T09:45:50.616142
2021-11-11T21:27:39
2021-11-11T21:27:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,171
java
import java.util.Arrays; import java.util.Scanner; public class Detevtando_copiones { static boolean casoDePrueba(Scanner sc) { int numN = sc.nextInt(), numK = sc.nextInt(); if(!sc.hasNext()) { sc.close(); return false; } int cont = 0; int [] vector = new int[numN]; for(int i = 0 ; i< vector.length ; i++) { vector[i] = sc.nextInt(); } for(int i = 0 ; i< vector.length ; i++) { if(i >= numK) { int num = i ; for (int j = 0 ; j < numK ; j++) { num--; if(vector[i] == vector[num]) { cont ++; } } }else if (i>0){ for(int j = i -1 ; j != 0 ; j--) { if(vector[i] == vector[j]) { cont++; } } } } Arrays.sort(vector); int dif = vector[0]; int cont2=0; for(int i = 1 ; i <vector.length ;i ++) { if(vector[i] == dif) { cont2++; }else { dif=vector[i]; } } System.out.println(cont2 + " "+ cont); return true; } public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner (System.in); while(casoDePrueba(sc)); } }
[ "mi.quenaya@gmail.com" ]
mi.quenaya@gmail.com
716b728f54bf771846e8b4c8084ba1d231a48cfb
0cff52eb1db610f896a1ccedc468f9ba944a6649
/src/main/java/br/geraldo/financial/factory/ConnectionFactory.java
4ecbf756a993146e92ace92ee67ce88e030f8139
[]
no_license
gsjunior86/CalculationModule
5db792f20e5af8381a036cb0b99a9e43e17a64ce
efb4cf482ac0e77b5b13f9134a0157da132d0d23
refs/heads/master
2021-01-19T06:38:48.425728
2016-06-28T06:16:04
2016-06-28T06:16:04
62,114,020
0
0
null
null
null
null
UTF-8
Java
false
false
587
java
package br.geraldo.financial.factory; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class ConnectionFactory { private final static String URL = "jdbc:h2:~/pltask;multi_threaded=true"; private final static String user = "SA"; private final static String passwd = ""; private static Connection con; static{ try { con = DriverManager.getConnection(URL,user,passwd); } catch (SQLException e) { System.out.println(e.getMessage()); } } public static Connection getConnection() throws SQLException{ return con; } }
[ "gsjunior86@gmail.com" ]
gsjunior86@gmail.com
9a392e37395417ae609de69d179434d39bd89b31
edd6d2c28f5e2b66170f25c337ad48beec3446b1
/src/main/java/com/oneCode/entity/QrcodeConfigWithBLOBs.java
0ca41704927a4381a04d40ebf2cd03992d1cb041
[]
no_license
scott-nodejs/one_code
0accdef2e5193873d37d60aa6888312bef380830
1102c740022101c5e0318e29aa55740187013f77
refs/heads/master
2023-07-09T03:09:10.910776
2021-08-13T09:12:32
2021-08-13T09:12:32
395,587,428
0
0
null
null
null
null
UTF-8
Java
false
false
489
java
package com.oneCode.entity; public class QrcodeConfigWithBLOBs extends QrcodeConfig { private String cData; private String cConfig; public String getcData() { return cData; } public void setcData(String cData) { this.cData = cData == null ? null : cData.trim(); } public String getcConfig() { return cConfig; } public void setcConfig(String cConfig) { this.cConfig = cConfig == null ? null : cConfig.trim(); } }
[ "lucong@kingsoft.com" ]
lucong@kingsoft.com
bdc6f1c2099ec61eb9b5a3bb44c5fc97de15e026
27b052c54bcf922e1a85cad89c4a43adfca831ba
/src/com/parse/ParseObject$30.java
a9469b1fa0b7c1e776d93600390be6c18f0321a8
[]
no_license
dreadiscool/YikYak-Decompiled
7169fd91f589f917b994487045916c56a261a3e8
ebd9e9dd8dba0e657613c2c3b7036f7ecc3fc95d
refs/heads/master
2020-04-01T10:30:36.903680
2015-04-14T15:40:09
2015-04-14T15:40:09
33,902,809
3
0
null
null
null
null
UTF-8
Java
false
false
464
java
package com.parse; import l; import m; class ParseObject$30 implements l<Void, m<Object>> { ParseObject$30(ParseObject paramParseObject, String paramString) {} public m<Object> then(m<Void> paramm) { return this.this$0.deleteAsync(this.val$sessionToken); } } /* Location: C:\Users\dreadiscool\Desktop\tools\classes-dex2jar.jar * Qualified Name: com.parse.ParseObject.30 * JD-Core Version: 0.7.0.1 */
[ "paras@protrafsolutions.com" ]
paras@protrafsolutions.com
e75c5db777b5203ebcce935a6566b14245da6434
87cdbc2a9d5137d0f1b4f4d774162792716b6caa
/Receptora/src/ar/com/receptora/main/Main.java
f7bcc2c72eb8ea2909a966413b476225e741b547
[]
no_license
matiasvighi/receptoraudp
a2e93ab5c74678cc95416a4eeea31df7acc1fed9
a9ec74fe35e8883253f1029e0e8cf23b81eedf18
refs/heads/master
2021-01-17T16:23:00.702280
2016-07-25T18:09:23
2016-07-25T18:09:23
64,159,198
0
0
null
null
null
null
UTF-8
Java
false
false
48,925
java
package ar.com.receptora.main; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.InetAddress; //import java.net.InetAddress; public class Main { public static void main(String argv[]) { DatagramSocket socket; // boolean fin = false; try { // Creamos el socket socket = new DatagramSocket(9230); byte[] mensaje_bytes = new byte[256]; String mensaje = ""; mensaje = new String(mensaje_bytes); // String mensajeComp = ""; DatagramPacket paquete = new DatagramPacket(mensaje_bytes, 256); DatagramPacket envpaquete = new DatagramPacket(mensaje_bytes, 256); int puerto; InetAddress address; byte[] mensaje2_bytes = new byte[256]; // Para prueba mierdosa de doble checksum byte[] mensaje3_bytes = new byte[256]; // Iniciamos el bucle do { // Recibimos el paquete socket.receive(paquete); // Lo formateamos mensaje = new String(mensaje_bytes).trim(); // Lo mostramos por pantalla System.out.println(mensaje); // Obtenemos IP Y PUERTO puerto = paquete.getPort(); address = paquete.getAddress(); CharSequence searchStr = "Caud1"; // 0kCaud1 CharSequence searchStr2 = "Caud2"; // 0k CharSequence searchStr3 = "156p"; // 0k CharSequence searchStr4 = "RIN52"; // OK CharSequence searchStr5 = "RIN19"; CharSequence searchStr6 = "RIN21"; // 0k CharSequence searchStr7 = "RIN43"; if (mensaje.contains(searchStr)) { System.out.println("Aca está el equipo 1 Guacho"); // escribe el log // File file = new // File("/home/matias/Logpaninotemp/GT0998log.txt"); // prueba FileWriter fichero = null; PrintWriter pw = null; try { fichero = new FileWriter("/var/www/Receptora/inputfile/Caud1.txt", true); pw = new PrintWriter(fichero); // int i = 0; // for ( ; i < 10; i++) pw.println(mensaje); } catch (Exception e) { e.printStackTrace(); } finally { // Nuevamente aprovechamos el finally para // asegurarnos que se cierra el fichero. if (null != fichero) fichero.close(); try { } catch (Exception e2) { e2.printStackTrace(); } } // Prueba de checsum 2 byte checksum = 0; int len = mensaje.length(); for (int i = 0; i < len; i++) { checksum ^= mensaje.charAt(i); String binaryValue = String.format("%8s", Integer.toBinaryString(checksum & 0xFF)).replace(' ', '0'); // System.out.println("Index: " + i // + " - Checksum: || ASCII Value:" // + ((checksum != 0) ? (char) checksum : '0') // + " || Int Value: " + (int) checksum // + " || Binary Value: " + binaryValue); if (i != 0) { if ((mensaje.charAt(i - 1) == ';') & (mensaje.charAt(i) == '*')) { break; } } } // esto es para separar los datos del caudalímetro del resto // del paquete // variable de la pos de gmaps String PosArmada = ""; CharSequence revTiPaq = "RCQ99"; if (mensaje.contains(revTiPaq)) { String[] datosMensaje1 = mensaje.split(";"); // Este es el dato de la fecha y hora String mensajeFechHor = mensaje; String FechaDia = mensajeFechHor.substring(6, 8); String FechaMes = mensajeFechHor.substring(8, 10); String FechaAno = mensajeFechHor.substring(10, 12); String HoraGmt = mensajeFechHor.substring(12, 14); String Min = mensajeFechHor.substring(14, 16); String Seg = mensajeFechHor.substring(16, 18); String Nev = mensajeFechHor.substring(3, 6); int HoraGmt1 = Integer.parseInt(HoraGmt); int menos3 = 3; int hora = HoraGmt1 - menos3; String Fechhor = FechaDia + "/" + FechaMes + "/" + FechaAno + "|" + hora + ":" + Min + ":" + Seg; System.out.println("Fecha y hora"); System.out.println(Fechhor); // este es el dato del caudalímetro String mensajeCaud = datosMensaje1[1]; System.out.println("mensajeCaud:"); System.out.println(mensajeCaud); // Subdividimos el dato del caudalímetro String[] mensajeCaudSubd = mensajeCaud.split(","); String DatoCaud1 = mensajeCaudSubd[0]; String DatoCaud2 = mensajeCaudSubd[1]; String DatoCaud3 = mensajeCaudSubd[2]; String DatoCaud4 = mensajeCaudSubd[3]; String DatoCaud5 = mensajeCaudSubd[4]; // Corto el label "TXT" String[] mensajeCaudSubd1 = mensajeCaudSubd[0].split("="); String NoTxtLabel = mensajeCaudSubd1[1]; System.out.println(NoTxtLabel); System.out.println(DatoCaud2); System.out.println(DatoCaud3); System.out.println(DatoCaud4); System.out.println(DatoCaud5); // Aca se selecionas si se usa css o el html crudo. // String DatoCaudComp = " Remito Camesa: "+ NoTxtLabel+ // " |Numero de ticket: "+ DatoCaud2+ " |Volumen // acumulado (litros): "+ DatoCaud3+ " |Temperatura: "+ // DatoCaud4; String DatoCaudComp = "|" + NoTxtLabel + "|" + DatoCaud2 + "|" + DatoCaud3 + "|" + DatoCaud4; // Porqueria para poner link Google String[] gmapPos = mensaje.split("-"); String LatGog = gmapPos[1]; String LongGog = gmapPos[2]; String LatGog1 = LatGog.substring(0, 2); String LongGog1 = LongGog.substring(1, 3); String LatGog2 = LatGog.substring(2, 7); String LongGog2 = LongGog.substring(3, 8); PosArmada = "http://maps.google.com/maps?f=q&q=-" + LatGog1 + "." + LatGog2 + "-" + LongGog1 + "." + LongGog2 + "&om=1&z=17"; String DatoCompleto = PosArmada + Nev + "|" + Fechhor; System.out.println(DatoCaudComp); System.out.println(Nev); FileWriter fichero2 = null; PrintWriter pw2 = null; try { fichero2 = new FileWriter("/mnt/Gps/Caudalimetros/Datosdelmismo/prueba1.txt", // "/var/www/Caudalimetros/inputfile/prueba1.txt", true); pw2 = new PrintWriter(fichero2); // int i = 0; // for ( ; i < 10; i++) pw2.println(DatoCompleto); } catch (Exception e) { e.printStackTrace(); } finally { // Nuevamente aprovechamos el finally para // asegurarnos que se cierra el fichero. if (null != fichero2) fichero2.close(); try { } catch (Exception e2) { e2.printStackTrace(); } } } // mensaje=">RCY00020205000000-2778467-06425658000000-000090;DFFFFFF;IGN1;IN00;XP00;#0021;ID=1234;*59<"; // Esto es para parcear ciertos datos ATENTI!!! String[] datosMensaje = mensaje.split(";"); // esto es para enviar el paquete de respuesta ACK String Checks1 = datosMensaje[1]; String Checks2 = datosMensaje[2]; if (mensaje.contains(revTiPaq)) { // checsum en caso de reporte extendido por el puto // caudalimetro Checks1 = datosMensaje[2]; Checks2 = datosMensaje[3]; System.out.println(Checks1); } System.out.println(PosArmada); String mensajeComp = ">" + "ACK;" + Checks1 + ";" + Checks2 + ";" + "*"; System.out.println(mensajeComp); byte checksum1 = 0; int len1 = mensajeComp.length(); for (int i = 0; i < len1; i++) { checksum1 ^= mensajeComp.charAt(i); String binaryValue = String.format("%8s", Integer.toBinaryString(checksum1 & 0xFF)).replace(' ', '0'); // System.out.println("Index: " + i // + " - Checksum: || ASCII Value:" // + ((checksum != 0) ? (char) checksum1 : '0') // + " || Int Value: " + (int) checksum1 // + " || Binary Value: " + binaryValue); if (i != 0) { if ((mensaje.charAt(i - 1) == ';') & (mensaje.charAt(i) == '*')) { break; } } } String Hex1 = Integer.toHexString(checksum1); String Hex = Hex1.toUpperCase(); String Banana = "checksumdesalida"; System.out.println(checksum1); System.out.println(Banana); System.out.println(Hex); //// String checksum2 = mensajeComp+ Hex+ "<" ; String checksum2 = mensajeComp + "<"; System.out.println(checksum2); // ACA VA ENVIAR!!! // Obtenemos IP Y PUERTO // puerto = paquete.getPort(); // address = paquete.getAddress(); // Creamos una instancia BuffererReader en la // que guardamos los datos introducido por el usuario // BufferedReader in = new BufferedReader(new // InputStreamReader(System.in)); // declaramos e instanciamos un objeto de tipo byte // byte[] mensaje_bytes3 = new byte[256]; // para checksum2 // byte[] mensaje_bytes4 = new byte[256]; // declaramos una variable de tipo string // mensajeComp=in.readLine(); // formateamos el mensaje de salida mensaje2_bytes = checksum2.getBytes(); // Preparamos el paquete que queremos enviar envpaquete = new DatagramPacket(mensaje2_bytes, checksum2.length(), address, puerto); // realizamos el envio socket.send(envpaquete); // } while (1>0); // } // Checsum doble de prueba chota // HASTA ACA!! // stop prueba // if file doesnt exists, then create it // if (!file.exists()) { // file.createNewFile(); // } // FileWriter fw = new FileWriter(file.getAbsoluteFile()); // BufferedWriter bw = new BufferedWriter(fw); // bw.write(mensaje); // bw.close(); System.out.println("Done"); } else { System.out.println("Este no es amigo"); if (mensaje.contains(searchStr2)) { System.out.println("Aca está el equipo 2 Guacho"); // escribe el log // prueba FileWriter fichero = null; PrintWriter pw = null; try { fichero = new FileWriter("/mnt/Gps/LogPanino/NGF422II.txt", true); pw = new PrintWriter(fichero); // int i = 0; // for ( ; i < 10; i++) pw.println(mensaje); } catch (Exception e) { e.printStackTrace(); } finally { // Nuevamente aprovechamos el finally para // asegurarnos que se cierra el fichero. if (null != fichero) fichero.close(); try { } catch (Exception e2) { e2.printStackTrace(); } } // stop prueba // Prueba de checsum 2 byte checksum = 0; int len = mensaje.length(); for (int i = 0; i < len; i++) { checksum ^= mensaje.charAt(i); String binaryValue = String.format("%8s", Integer.toBinaryString(checksum & 0xFF)) .replace(' ', '0'); // System.out.println("Index: " + i // + " - Checksum: || ASCII Value:" // + ((checksum != 0) ? (char) checksum : '0') // + " || Int Value: " + (int) checksum // + " || Binary Value: " + binaryValue); if (i != 0) { if ((mensaje.charAt(i - 1) == ';') & (mensaje.charAt(i) == '*')) { break; } } } // ----------_________________________________________---------------------------- // esto es para separar los datos del caudalímetro del // resto del paquete // variable de la pos de gmaps String PosArmada = ""; CharSequence revTiPaq = "RCQ99"; if (mensaje.contains(revTiPaq)) { String[] datosMensaje1 = mensaje.split(";"); // Este es el dato de la fecha y hora String mensajeFechHor = mensaje; String FechaDia = mensajeFechHor.substring(6, 8); String FechaMes = mensajeFechHor.substring(8, 10); String FechaAno = mensajeFechHor.substring(10, 12); String HoraGmt = mensajeFechHor.substring(12, 14); String Min = mensajeFechHor.substring(14, 16); String Seg = mensajeFechHor.substring(16, 18); String Nev = mensajeFechHor.substring(3, 6); int HoraGmt1 = Integer.parseInt(HoraGmt); int menos3 = 3; int hora = HoraGmt1 - menos3; String Fechhor = FechaDia + "/" + FechaMes + "/" + FechaAno + "|" + hora + ":" + Min + ":" + Seg; System.out.println("Fecha y hora"); System.out.println(Fechhor); // este es el dato del caudalímetro String mensajeCaud = datosMensaje1[1]; System.out.println("mensajeCaud:"); System.out.println(mensajeCaud); // Subdividimos el dato del caudalímetro String[] mensajeCaudSubd = mensajeCaud.split(","); String DatoCaud1 = mensajeCaudSubd[0]; String DatoCaud2 = mensajeCaudSubd[1]; String DatoCaud3 = mensajeCaudSubd[2]; String DatoCaud4 = mensajeCaudSubd[3]; String DatoCaud5 = mensajeCaudSubd[4]; String DatoCaud6 = mensajeCaudSubd[5]; String DatoCaud7 = mensajeCaudSubd[6]; String DatoCaud8 = mensajeCaudSubd[7]; String DatoCaud9 = mensajeCaudSubd[8]; String DatoCaud10 = mensajeCaudSubd[9]; String DatoCaud11 = mensajeCaudSubd[10]; // String DatoCaud12 = mensajeCaudSubd[11]; // Corto el label "TXT" String[] mensajeCaudSubd1 = mensajeCaudSubd[0].split("="); String NoTxtLabel = mensajeCaudSubd1[1]; System.out.println(NoTxtLabel); System.out.println(DatoCaud2); System.out.println(DatoCaud3); System.out.println(DatoCaud4); System.out.println(DatoCaud5); System.out.println(DatoCaud6); System.out.println(DatoCaud7); System.out.println(DatoCaud8); System.out.println(DatoCaud9); System.out.println(DatoCaud10); // System.out.println(DatoCaud11); // Aca se selecionas si se usa css o el html crudo. // String DatoCaudComp = " Remito Camesa: "+ // NoTxtLabel+ " |Numero de ticket: "+ DatoCaud2+ " // |Volumen acumulado (litros): "+ DatoCaud3+ " // |Temperatura: "+ DatoCaud4; String DatoCaudComp = "|" + NoTxtLabel + "|" + DatoCaud2 + "|" + DatoCaud3 + "|" + DatoCaud4 + DatoCaud5 + "|" + DatoCaud6 + "|" + DatoCaud7 + "|" + DatoCaud8 + "|" + DatoCaud9 + "|" + DatoCaud10 + "|"; // Porqueria para poner link Google String[] gmapPos = mensaje.split("-"); String LatGog = gmapPos[1]; String LongGog = gmapPos[2]; String LatGog1 = LatGog.substring(0, 2); String LongGog1 = LongGog.substring(1, 3); String LatGog2 = LatGog.substring(2, 7); String LongGog2 = LongGog.substring(3, 8); PosArmada = "http://maps.google.com/maps?f=q&q=-" + LatGog1 + "." + LatGog2 + "-" + LongGog1 + "." + LongGog2 + "&om=1&z=17"; String DatoCompleto = PosArmada + DatoCaudComp + "|" + Fechhor; System.out.println(DatoCaudComp); System.out.println(Nev); FileWriter fichero2 = null; PrintWriter pw2 = null; try { fichero2 = new FileWriter("/mnt/Gps/Caudalimetros/Datosdelmismo/prueba1.txt", // "/var/www/Caudalimetros/inputfile/prueba1.txt", true); pw2 = new PrintWriter(fichero2); // int i = 0; // for ( ; i < 10; i++) pw2.println(DatoCompleto); } catch (Exception e) { e.printStackTrace(); } finally { // Nuevamente aprovechamos el finally para // asegurarnos que se cierra el fichero. if (null != fichero2) fichero2.close(); try { } catch (Exception e2) { e2.printStackTrace(); } } } // ____________________--------------------------_______________________________----------- // CharSequence revTiPaq = "RCQ99"; // if (mensaje.contains(revTiPaq)) { // String temp1 = mensaje.substring(70,75); // String temp2 = mensaje.substring(77,82); // En ese caso, aux2 va a tener "stri" // String aux2 = aux.substring(4, 7); // En este otro caso va a tener "ngDe" // System.out.println(temp1); // System.out.println(temp2); // String temp = temp1+ ";"+ temp2; // System.out.println(temp); // FileWriter fichero2 = null; // PrintWriter pw2 = null; // try { // fichero2 = new FileWriter( // "/mnt/Gps/LogPanino/Temperaturas/NGF422.csv", // true); // pw2 = new PrintWriter(fichero2); // int i = 0; // for ( ; i < 10; i++) // pw2.println(temp); // } catch (Exception e) { // e.printStackTrace(); // } finally { // Nuevamente aprovechamos el finally para // asegurarnos que se cierra el fichero. // if (null != fichero2) // fichero2.close(); // try { // } catch (Exception e2) { // e2.printStackTrace(); // }} // } // aca se termina lo que separa la temp del resto del // paquete // comentar la linea siguiente para que ande como // corresponde // mensaje=">RCY00020205000000-2778467-06425658000000-000090;DFFFFFF;IGN1;IN00;XP00;#0021;ID=1234;*59<"; // Esto es para parcear ciertos datos ATENTI!!! System.out.println(checksum); String[] datosMensaje = mensaje.split(";"); // esto es para enviar el paquete de respuesta ACK String Checks1 = datosMensaje[1]; String Checks2 = datosMensaje[2]; if (mensaje.contains(revTiPaq)) { // checsum en caso de reporte extendido por el puto // caudalimetro Checks1 = datosMensaje[2]; Checks2 = datosMensaje[3]; System.out.println(Checks1); } // System.out.println(PosArmada); String mensajeComp = ">" + "ACK;" + Checks1 + ";" + Checks2 + ";" + "*"; System.out.println(mensajeComp); byte checksum1 = 0; int len1 = mensajeComp.length(); for (int i = 0; i < len1; i++) { checksum1 ^= mensajeComp.charAt(i); String binaryValue = String.format("%8s", Integer.toBinaryString(checksum1 & 0xFF)) .replace(' ', '0'); // System.out.println("Index: " + i // + " - Checksum: || ASCII Value:" // + ((checksum != 0) ? (char) checksum1 : '0') // + " || Int Value: " + (int) checksum1 // + " || Binary Value: " + binaryValue); if (i != 0) { if ((mensaje.charAt(i - 1) == ';') & (mensaje.charAt(i) == '*')) { break; } } } String Hex1 = Integer.toHexString(checksum1); String Hex = Hex1.toUpperCase(); String Banana = "checksumdesalida"; System.out.println(checksum1); System.out.println(Banana); System.out.println(Hex); String checksum2 = mensajeComp + Hex + "<"; System.out.println(checksum2); // ACA VA ENVIAR!!! // Obtenemos IP Y PUERTO // puerto = paquete.getPort(); // address = paquete.getAddress(); // Creamos una instancia BuffererReader en la // que guardamos los datos introducido por el usuario // BufferedReader in = new BufferedReader(new // InputStreamReader(System.in)); // declaramos e instanciamos un objeto de tipo byte byte[] mensaje_bytes3 = new byte[256]; // declaramos una variable de tipo string // mensajeComp=in.readLine(); // formateamos el mensaje de salida mensaje2_bytes = checksum2.getBytes(); // Preparamos el paquete que queremos enviar envpaquete = new DatagramPacket(mensaje2_bytes, checksum2.length(), address, puerto); // realizamos el envio socket.send(envpaquete); // } while (1>0); // } // HASTA ACA!! // File file = new // File("/home/matias/Logpaninotemp/GTO852log.txt"); // if file doesnt exists, then create it // if (!file.exists()) { // file.createNewFile(); // } // FileWriter fw = new // FileWriter(file.getAbsoluteFile()); // BufferedWriter bw = new BufferedWriter(fw); // bw.write(mensaje); // bw.close(); System.out.println("Done"); } else { System.out.println("Este no es amigo"); } if (mensaje.contains(searchStr3)) { System.out.println("Aca está el equipo 3 Guacho"); // escribe el log FileWriter fichero = null; PrintWriter pw = null; try { fichero = new FileWriter("/mnt/Gps/LogPanino/MSV209IIlog.txt", true); pw = new PrintWriter(fichero); // int i = 0; // for ( ; i < 10; i++) pw.println(mensaje); } catch (Exception e) { e.printStackTrace(); } finally { // Nuevamente aprovechamos el finally para // asegurarnos que se cierra el fichero. if (null != fichero) fichero.close(); try { } catch (Exception e2) { e2.printStackTrace(); } } // Prueba de checsum 2 byte checksum = 0; int len = mensaje.length(); for (int i = 0; i < len; i++) { checksum ^= mensaje.charAt(i); String binaryValue = String.format("%8s", Integer.toBinaryString(checksum & 0xFF)) .replace(' ', '0'); // System.out.println("Index: " + i // + " - Checksum: || ASCII Value:" // + ((checksum != 0) ? (char) checksum : '0') // + " || Int Value: " + (int) checksum // + " || Binary Value: " + binaryValue); if (i != 0) { if ((mensaje.charAt(i - 1) == ';') & (mensaje.charAt(i) == '*')) { break; } } } // ----------_________________________________________---------------------------- // esto es para separar los datos del caudalímetro del // resto del paquete // variable de la pos de gmaps String PosArmada = ""; CharSequence revTiPaq = "RCQ99"; if (mensaje.contains(revTiPaq)) { String[] datosMensaje1 = mensaje.split(";"); // Este es el dato de la fecha y hora String mensajeFechHor = mensaje; String FechaDia = mensajeFechHor.substring(6, 8); String FechaMes = mensajeFechHor.substring(8, 10); String FechaAno = mensajeFechHor.substring(10, 12); String HoraGmt = mensajeFechHor.substring(12, 14); String Min = mensajeFechHor.substring(14, 16); String Seg = mensajeFechHor.substring(16, 18); String Nev = mensajeFechHor.substring(3, 6); int HoraGmt1 = Integer.parseInt(HoraGmt); int menos3 = 3; int hora = HoraGmt1 - menos3; String Fechhor = FechaDia + "/" + FechaMes + "/" + FechaAno + "|" + hora + ":" + Min + ":" + Seg; System.out.println("Fecha y hora"); System.out.println(Fechhor); // este es el dato del caudalímetro String mensajeCaud = datosMensaje1[1]; System.out.println("mensajeCaud:"); System.out.println(mensajeCaud); // Subdividimos el dato del caudalímetro String[] mensajeCaudSubd = mensajeCaud.split(","); String DatoCaud1 = mensajeCaudSubd[0]; String DatoCaud2 = mensajeCaudSubd[1]; String DatoCaud3 = mensajeCaudSubd[2]; String DatoCaud4 = mensajeCaudSubd[3]; String DatoCaud5 = mensajeCaudSubd[4]; String DatoCaud6 = mensajeCaudSubd[5]; String DatoCaud7 = mensajeCaudSubd[6]; String DatoCaud8 = mensajeCaudSubd[7]; String DatoCaud9 = mensajeCaudSubd[8]; String DatoCaud10 = mensajeCaudSubd[9]; String DatoCaud11 = mensajeCaudSubd[10]; // String DatoCaud12 = mensajeCaudSubd[11]; // Corto el label "TXT" String[] mensajeCaudSubd1 = mensajeCaudSubd[0].split("="); String NoTxtLabel = mensajeCaudSubd1[1]; System.out.println(NoTxtLabel); System.out.println(DatoCaud2); System.out.println(DatoCaud3); System.out.println(DatoCaud4); System.out.println(DatoCaud5); System.out.println(DatoCaud6); System.out.println(DatoCaud7); System.out.println(DatoCaud8); System.out.println(DatoCaud9); System.out.println(DatoCaud10); // System.out.println(DatoCaud11); // Aca se selecionas si se usa css o el html crudo. // String DatoCaudComp = " Remito Camesa: "+ // NoTxtLabel+ " |Numero de ticket: "+ DatoCaud2+ " // |Volumen acumulado (litros): "+ DatoCaud3+ " // |Temperatura: "+ DatoCaud4; String DatoCaudComp = "|" + NoTxtLabel + "|" + DatoCaud2 + "|" + DatoCaud3 + "|" + DatoCaud4 + DatoCaud5 + "|" + DatoCaud6 + "|" + DatoCaud7 + "|" + DatoCaud8 + "|" + DatoCaud9 + "|" + DatoCaud10 + "|"; // Porqueria para poner link Google String[] gmapPos = mensaje.split("-"); String LatGog = gmapPos[1]; String LongGog = gmapPos[2]; String LatGog1 = LatGog.substring(0, 2); String LongGog1 = LongGog.substring(1, 3); String LatGog2 = LatGog.substring(2, 7); String LongGog2 = LongGog.substring(3, 8); PosArmada = "http://maps.google.com/maps?f=q&q=-" + LatGog1 + "." + LatGog2 + "-" + LongGog1 + "." + LongGog2 + "&om=1&z=17"; String DatoCompleto = PosArmada + DatoCaudComp + "|" + Fechhor; System.out.println(DatoCaudComp); System.out.println(Nev); FileWriter fichero2 = null; PrintWriter pw2 = null; try { fichero2 = new FileWriter("/mnt/Gps/Caudalimetros/Datosdelmismo/prueba1.txt", // "/var/www/Caudalimetros/inputfile/prueba1.txt", true); pw2 = new PrintWriter(fichero2); // int i = 0; // for ( ; i < 10; i++) pw2.println(DatoCompleto); } catch (Exception e) { e.printStackTrace(); } finally { // Nuevamente aprovechamos el finally para // asegurarnos que se cierra el fichero. if (null != fichero2) fichero2.close(); try { } catch (Exception e2) { e2.printStackTrace(); } } } // ____________________--------------------------_______________________________----------- // Esto es para parcear ciertos datos ATENTI!!! System.out.println(checksum); String[] datosMensaje = mensaje.split(";"); // esto es para enviar el paquete de respuesta ACK String Checks1 = datosMensaje[1]; String Checks2 = datosMensaje[2]; if (mensaje.contains(revTiPaq)) { // checsum en caso de reporte extendido por el puto // caudalimetro Checks1 = datosMensaje[2]; Checks2 = datosMensaje[3]; System.out.println(Checks1); } else { String mensajeComp = ">" + "ACK;" + datosMensaje[1] + ";" + datosMensaje[2] + ";" + "*"; // String mensajeComp= ">"+ "ACK;"+datosMensaje[5]+ // ";"+ datosMensaje[6]+ ";"+ "*"; System.out.println(mensajeComp); } // System.out.println(PosArmada); String mensajeComp = ">" + "ACK;" + Checks1 + ";" + Checks2 + ";" + "*"; System.out.println(mensajeComp); // calcula el checsum saliente (ack) byte checksum1 = 0; int len1 = mensajeComp.length(); for (int i = 0; i < len1; i++) { checksum1 ^= mensajeComp.charAt(i); String binaryValue = String.format("%8s", Integer.toBinaryString(checksum1 & 0xFF)) .replace(' ', '0'); // System.out.println("Index: " + i // + " - Checksum: || ASCII Value:" // + ((checksum != 0) ? (char) checksum1 : '0') // + " || Int Value: " + (int) checksum1 // + " || Binary Value: " + binaryValue); if (i != 0) { if ((mensaje.charAt(i - 1) == ';') & (mensaje.charAt(i) == '*')) { break; } } } String Hex1 = Integer.toHexString(checksum1); String Hex = Hex1.toUpperCase(); String Banana = "checksumdesalida"; System.out.println(checksum1); System.out.println(Banana); System.out.println(Hex); String checksum2 = mensajeComp + Hex + "<"; System.out.println(checksum2); // ACA VA ENVIAR!!! // Obtenemos IP Y PUERTO // puerto = paquete.getPort(); // address = paquete.getAddress(); // Creamos una instancia BuffererReader en la // que guardamos los datos introducido por el usuario // BufferedReader in = new BufferedReader(new // InputStreamReader(System.in)); // declaramos e instanciamos un objeto de tipo byte byte[] mensaje_bytes3 = new byte[256]; // declaramos una variable de tipo string // mensajeComp=in.readLine(); // formateamos el mensaje de salida mensaje2_bytes = checksum2.getBytes(); // Preparamos el paquete que queremos enviar envpaquete = new DatagramPacket(mensaje2_bytes, checksum2.length(), address, puerto); // realizamos el envio socket.send(envpaquete); // } while (1>0); // } // HASTA ACA!! // File file = new // File("/home/matias/Logpaninotemp/GT119log.txt"); // if file doesnt exists, then create it // if (!file.exists()) { // file.createNewFile(); // } // FileWriter fw = new // FileWriter(file.getAbsoluteFile()); // BufferedWriter bw = new BufferedWriter(fw); // bw.write(mensaje); // bw.close(); System.out.println("Done"); } else { System.out.println("Este no es amigo"); } if (mensaje.contains(searchStr4)) { System.out.println("Aca está el equipo 4 Guacho"); // escribe el log // prueba FileWriter fichero = null; PrintWriter pw = null; try { fichero = new FileWriter("/home/matias/Logpaninotemp/ORN704log.txt", true); pw = new PrintWriter(fichero); // int i = 0; // for ( ; i < 10; i++) pw.println(mensaje); } catch (Exception e) { e.printStackTrace(); } finally { // Nuevamente aprovechamos el finally para // asegurarnos que se cierra el fichero. if (null != fichero) fichero.close(); try { } catch (Exception e2) { e2.printStackTrace(); } } // Prueba de checsum 2 byte checksum = 0; int len = mensaje.length(); for (int i = 0; i < len; i++) { checksum ^= mensaje.charAt(i); String binaryValue = String.format("%8s", Integer.toBinaryString(checksum & 0xFF)) .replace(' ', '0'); // System.out.println("Index: " + i // + " - Checksum: || ASCII Value:" // + ((checksum != 0) ? (char) checksum : '0') // + " || Int Value: " + (int) checksum // + " || Binary Value: " + binaryValue); if (i != 0) { if ((mensaje.charAt(i - 1) == ';') & (mensaje.charAt(i) == '*')) { break; } } } // comentar la linea siguiente para que ande como // corresponde // mensaje=">RCY00020205000000-2778467-06425658000000-000090;DFFFFFF;IGN1;IN00;XP00;#0021;ID=1234;*59<"; // Esto es para parcear ciertos datos ATENTI!!! System.out.println(checksum); String[] datosMensaje = mensaje.split(";"); // esto es para enviar el paquete de respuesta ACK String mensajeComp = ">" + "ACK;" + datosMensaje[1] + ";" + datosMensaje[2] + ";" + "*"; // String mensajeComp= ">"+ "ACK;"+datosMensaje[5]+ ";"+ // datosMensaje[6]+ ";"+ "*"; System.out.println(mensajeComp); // calcula el checsum saliente (ack) byte checksum1 = 0; int len1 = mensajeComp.length(); for (int i = 0; i < len1; i++) { checksum1 ^= mensajeComp.charAt(i); String binaryValue = String.format("%8s", Integer.toBinaryString(checksum1 & 0xFF)) .replace(' ', '0'); // System.out.println("Index: " + i // + " - Checksum: || ASCII Value:" // + ((checksum != 0) ? (char) checksum1 : '0') // + " || Int Value: " + (int) checksum1 // + " || Binary Value: " + binaryValue); if (i != 0) { if ((mensaje.charAt(i - 1) == ';') & (mensaje.charAt(i) == '*')) { break; } } } String Hex1 = Integer.toHexString(checksum1); String Hex = Hex1.toUpperCase(); String Banana = "checksumdesalida"; System.out.println(checksum1); System.out.println(Banana); System.out.println(Hex); String checksum2 = mensajeComp + Hex + "<"; System.out.println(checksum2); // ACA VA ENVIAR!!! // Obtenemos IP Y PUERTO // puerto = paquete.getPort(); // address = paquete.getAddress(); // Creamos una instancia BuffererReader en la // que guardamos los datos introducido por el usuario // BufferedReader in = new BufferedReader(new // InputStreamReader(System.in)); // declaramos e instanciamos un objeto de tipo byte byte[] mensaje_bytes3 = new byte[256]; // declaramos una variable de tipo string // mensajeComp=in.readLine(); // formateamos el mensaje de salida mensaje2_bytes = checksum2.getBytes(); // Preparamos el paquete que queremos enviar envpaquete = new DatagramPacket(mensaje2_bytes, checksum2.length(), address, puerto); // realizamos el envio socket.send(envpaquete); // } while (1>0); // } // HASTA ACA!!// stop prueba // File file = new // File("/home/matias/Logpaninotemp/GT118log.txt"); // if file doesnt exists, then create it // if (!file.exists()) { // file.createNewFile(); // } // FileWriter fw = new // FileWriter(file.getAbsoluteFile()); // BufferedWriter bw = new BufferedWriter(fw); // bw.write(mensaje); // bw.close(); System.out.println("Done"); } else { System.out.println("Este no es amigo"); } if (mensaje.contains(searchStr5)) { System.out.println("Aca está el equipo 5 Guacho"); // escribe el log FileWriter fichero = null; PrintWriter pw = null; try { fichero = new FileWriter("/home/matias/Logpaninotemp/HPE505log.txt", true); pw = new PrintWriter(fichero); // int i = 0; // for ( ; i < 10; i++) pw.println(mensaje); } catch (Exception e) { e.printStackTrace(); } finally { // Nuevamente aprovechamos el finally para // asegurarnos que se cierra el fichero. if (null != fichero) fichero.close(); try { } catch (Exception e2) { e2.printStackTrace(); } } // Prueba de checsum 2 byte checksum = 0; int len = mensaje.length(); for (int i = 0; i < len; i++) { checksum ^= mensaje.charAt(i); String binaryValue = String.format("%8s", Integer.toBinaryString(checksum & 0xFF)) .replace(' ', '0'); // System.out.println("Index: " + i // + " - Checksum: || ASCII Value:" // + ((checksum != 0) ? (char) checksum : '0') // + " || Int Value: " + (int) checksum // + " || Binary Value: " + binaryValue); if (i != 0) { if ((mensaje.charAt(i - 1) == ';') & (mensaje.charAt(i) == '*')) { break; } } } // comentar la linea siguiente para que ande como // corresponde // mensaje=">RCY00020205000000-2778467-06425658000000-000090;DFFFFFF;IGN1;IN00;XP00;#0021;ID=1234;*59<"; // Esto es para parcear ciertos datos ATENTI!!! System.out.println(checksum); String[] datosMensaje = mensaje.split(";"); // esto es para enviar el paquete de respuesta ACK String mensajeComp = ">" + "ACK;" + datosMensaje[1] + ";" + datosMensaje[2] + ";" + "*"; // String mensajeComp= ">"+ "ACK;"+datosMensaje[5]+ ";"+ // datosMensaje[6]+ ";"+ "*"; System.out.println(mensajeComp); // calcula el checsum saliente (ack) byte checksum1 = 0; int len1 = mensajeComp.length(); for (int i = 0; i < len1; i++) { checksum1 ^= mensajeComp.charAt(i); String binaryValue = String.format("%8s", Integer.toBinaryString(checksum1 & 0xFF)) .replace(' ', '0'); // System.out.println("Index: " + i // + " - Checksum: || ASCII Value:" // + ((checksum != 0) ? (char) checksum1 : '0') // + " || Int Value: " + (int) checksum1 // + " || Binary Value: " + binaryValue); if (i != 0) { if ((mensaje.charAt(i - 1) == ';') & (mensaje.charAt(i) == '*')) { break; } } } String Hex1 = Integer.toHexString(checksum1); String Hex = Hex1.toUpperCase(); String Banana = "checksumdesalida"; System.out.println(checksum1); System.out.println(Banana); System.out.println(Hex); String checksum2 = mensajeComp + Hex + "<"; System.out.println(checksum2); // ACA VA ENVIAR!!! // Obtenemos IP Y PUERTO // puerto = paquete.getPort(); // address = paquete.getAddress(); // Creamos una instancia BuffererReader en la // que guardamos los datos introducido por el usuario // BufferedReader in = new BufferedReader(new // InputStreamReader(System.in)); // declaramos e instanciamos un objeto de tipo byte byte[] mensaje_bytes3 = new byte[256]; // declaramos una variable de tipo string // mensajeComp=in.readLine(); // formateamos el mensaje de salida mensaje2_bytes = checksum2.getBytes(); // Preparamos el paquete que queremos enviar envpaquete = new DatagramPacket(mensaje2_bytes, checksum2.length(), address, puerto); // realizamos el envio socket.send(envpaquete); // } while (1>0); // } // HASTA ACA!!// File file = new // File("/home/matias/Logpaninotemp/GT1136log.txt"); // if file doesnt exists, then create it // if (!file.exists()) { // file.createNewFile(); // } // // FileWriter fw = new // FileWriter(file.getAbsoluteFile()); // BufferedWriter bw = new BufferedWriter(fw); // bw.write(mensaje); // bw.close(); System.out.println("Done"); } else { System.out.println("Este no es amigo"); } if (mensaje.contains(searchStr6)) { System.out.println("Aca está el equipo 6 Guacho"); // escribe el log // prueba FileWriter fichero = null; PrintWriter pw = null; try { fichero = new FileWriter("/home/matias/Logpaninotemp/GTC627log.txt", true); pw = new PrintWriter(fichero); // int i = 0; // for ( ; i < 10; i++) pw.println(mensaje); } catch (Exception e) { e.printStackTrace(); } finally { // Nuevamente aprovechamos el finally para // asegurarnos que se cierra el fichero. if (null != fichero) fichero.close(); try { } catch (Exception e2) { e2.printStackTrace(); } } // stop prueba // File file = new // File("/home/matias/Logpaninotemp/GT118log.txt"); // if file doesnt exists, then create it // if (!file.exists()) { // file.createNewFile(); // } // FileWriter fw = new // FileWriter(file.getAbsoluteFile()); // BufferedWriter bw = new BufferedWriter(fw); // bw.write(mensaje); // bw.close(); // System.out.println("Done"); // char checksum = 0; // int len = mensaje.length(); // for (int i = 0; i < len; i++) { // checksum ^= mensaje.charAt(i); // if(i!=0){ // if ((mensaje.charAt(i-1) == ';') & (mensaje.charAt(i) // == '*')) break; // } // } // System.out.println(checksum); // Prueba de checsum 2 byte checksum = 0; int len = mensaje.length(); for (int i = 0; i < len; i++) { checksum ^= mensaje.charAt(i); String binaryValue = String.format("%8s", Integer.toBinaryString(checksum & 0xFF)) .replace(' ', '0'); System.out.println("Index: " + i + " - Checksum: || ASCII Value:" + ((checksum != 0) ? (char) checksum : '0') + " || Int Value: " + (int) checksum + " || Binary Value: " + binaryValue); if (i != 0) { if ((mensaje.charAt(i - 1) == ';') & (mensaje.charAt(i) == '*')) { break; } } } // comentar la linea siguiente para que ande como // corresponde // mensaje=">RCY00020205000000-2778467-06425658000000-000090;DFFFFFF;IGN1;IN00;XP00;#0021;ID=1234;*59<"; // Esto es para parcear ciertos datos ATENTI!!! System.out.println(checksum); String[] datosMensaje = mensaje.split(";"); // esto es para enviar el paquete de respuesta ACK String mensajeComp = ">" + "ACK;" + datosMensaje[1] + ";" + datosMensaje[2] + ";" + "*"; // String mensajeComp= ">"+ "ACK;"+datosMensaje[5]+ ";"+ // datosMensaje[6]+ ";"+ "*"; System.out.println(mensajeComp); // calcula el checsum saliente (ack) byte checksum1 = 0; int len1 = mensajeComp.length(); for (int i = 0; i < len1; i++) { checksum1 ^= mensajeComp.charAt(i); String binaryValue = String.format("%8s", Integer.toBinaryString(checksum1 & 0xFF)) .replace(' ', '0'); System.out.println("Index: " + i + " - Checksum: || ASCII Value:" + ((checksum != 0) ? (char) checksum1 : '0') + " || Int Value: " + (int) checksum1 + " || Binary Value: " + binaryValue); if (i != 0) { if ((mensaje.charAt(i - 1) == ';') & (mensaje.charAt(i) == '*')) { break; } } } String Hex1 = Integer.toHexString(checksum1); String Hex = Hex1.toUpperCase(); String Banana = "checksumdesalida"; System.out.println(checksum1); System.out.println(Banana); System.out.println(Hex); String checksum2 = mensajeComp + Hex + "<"; System.out.println(checksum2); // ACA VA ENVIAR!!! // Obtenemos IP Y PUERTO // puerto = paquete.getPort(); // address = paquete.getAddress(); // Creamos una instancia BuffererReader en la // que guardamos los datos introducido por el usuario // BufferedReader in = new BufferedReader(new // InputStreamReader(System.in)); // declaramos e instanciamos un objeto de tipo byte byte[] mensaje_bytes3 = new byte[256]; // declaramos una variable de tipo string // mensajeComp=in.readLine(); // formateamos el mensaje de salida mensaje2_bytes = checksum2.getBytes(); // Preparamos el paquete que queremos enviar envpaquete = new DatagramPacket(mensaje2_bytes, checksum2.length(), address, puerto); // realizamos el envio socket.send(envpaquete); // } while (1>0); // } // HASTA ACA!! } else { System.out.println("Este no es amigo"); } if (mensaje.contains(searchStr7)) { System.out.println("Aca está el equipo 7 (rinho) Guacho"); // escribe el log // File file = new // File("/home/matias/Logpaninotemp/GT0998log.txt"); // pruebamensajeComp=in.readLine(); FileWriter fichero = null; PrintWriter pw = null; try { fichero = new FileWriter("/home/matias/Logpaninotemp/NGF423log.txt", true); pw = new PrintWriter(fichero); // int i = 0; // for ( ; i < 10; i++) pw.println(mensaje); } catch (Exception e) { e.printStackTrace(); } finally { // Nuevamente aprovechamos el finally para // asegurarnos que se cierra el fichero. if (null != fichero) fichero.close(); try { } catch (Exception e2) { e2.printStackTrace(); } } // stop prueba // Prueba de checsum 2 byte checksum = 0; int len = mensaje.length(); for (int i = 0; i < len; i++) { checksum ^= mensaje.charAt(i); String binaryValue = String.format("%8s", Integer.toBinaryString(checksum & 0xFF)) .replace(' ', '0'); // System.out.println("Index: " + i // + " - Checksum: || ASCII Value:" // + ((checksum != 0) ? (char) checksum : '0') // + " || Int Value: " + (int) checksum // + " || Binary Value: " + binaryValue); if (i != 0) { if ((mensaje.charAt(i - 1) == ';') & (mensaje.charAt(i) == '*')) { break; } } } // comentar la linea siguiente para que ande como // corresponde // mensaje=">RCY00020205000000-2778467-06425658000000-000090;DFFFFFF;IGN1;IN00;XP00;#0021;ID=1234;*59<"; // Esto es para parcear ciertos datos ATENTI!!! System.out.println(checksum); String[] datosMensaje = mensaje.split(";"); // esto es para enviar el paquete de respuesta ACK String mensajeComp = ">" + "ACK;" + datosMensaje[1] + ";" + datosMensaje[2] + ";" + "*"; // String mensajeComp= ">"+ "ACK;"+datosMensaje[5]+ ";"+ // datosMensaje[6]+ ";"+ "*"; System.out.println(mensajeComp); // calcula el checsum saliente (ack) byte checksum1 = 0; int len1 = mensajeComp.length(); for (int i = 0; i < len1; i++) { checksum1 ^= mensajeComp.charAt(i); String binaryValue = String.format("%8s", Integer.toBinaryString(checksum1 & 0xFF)) .replace(' ', '0'); // System.out.println("Index: " + i // + " - Checksum: || ASCII Value:" // + ((checksum != 0) ? (char) checksum1 : '0') // + " || Int Value: " + (int) checksum1 // + " || Binary Value: " + binaryValue); if (i != 0) { if ((mensaje.charAt(i - 1) == ';') & (mensaje.charAt(i) == '*')) { break; } } } String Hex1 = Integer.toHexString(checksum1); String Hex = Hex1.toUpperCase(); String Banana = "checksumdesalida"; System.out.println(checksum1); System.out.println(Banana); System.out.println(Hex); String checksum2 = mensajeComp + Hex + "<"; System.out.println(checksum2); // ACA VA ENVIAR!!! // Obtenemos IP Y PUERTO // puerto = paquete.getPort(); // address = paquete.getAddress(); // Creamos una instancia BuffererReader en la // que guardamos los datos introducido por el usuario // BufferedReader in = new BufferedReader(new // InputStreamReader(System.in)); // declaramos e instanciamos un objeto de tipo byte byte[] mensaje_bytes3 = new byte[256]; // declaramos una variable de tipo string // mensajeComp=in.readLine(); // formateamos el mensaje de salida mensaje2_bytes = checksum2.getBytes(); // Preparamos el paquete que queremos enviar envpaquete = new DatagramPacket(mensaje2_bytes, checksum2.length(), address, puerto); // realizamos el envio socket.send(envpaquete); // } while (1>0); // } // HASTA ACA!! // if file doesnt exists, then create it // if (!file.exists()) { // file.createNewFile(); // } // FileWriter fw = new // FileWriter(file.getAbsoluteFile()); // BufferedWriter bw = new BufferedWriter(fw); // bw.write(mensaje); // bw.close(); System.out.println("Done"); } else { System.out.println("Este no es amigo"); } } // --------------------------------------------------------------------------------- // Reenvio a Geosystem // CharSequence SearchAck = "ACK"; // esto vino de geo no se por // que if (!mensaje.contains(SearchAck)) { // revisar el negador ! anda // mal. // mirar recep pasamanos // declaramos e instanciamos un objeto de tipo byte byte[] mensaje_bytes5 = new byte[256]; // formateamos el mensaje de salida mensaje3_bytes = mensaje.getBytes(); // Declaro IP De Geo int portcompgps = 9230; String diregeo = "190.210.181.22"; DatagramSocket socketCliente = null; try { socketCliente = new DatagramSocket(); } catch (IOException e) { System.out.println("Error al crear el objeto socket cliente"); System.exit(0); } InetAddress DireccionIP = null; try { DireccionIP = InetAddress.getByName(diregeo); } catch (IOException e) { System.out.println("Error al recuperar la IP del proceso"); System.exit(0); } System.out.println("Reenvié a Geo el paquete"); // Preparamos el paquete que queremos enviar // envpaquete = new // DatagramPacket(mensaje3_bytes,mensaje.length(),DireccionIP,puerto); DatagramPacket enviarPaquete = new DatagramPacket(mensaje_bytes, mensaje.length(), DireccionIP, portcompgps); // socketCliente.send(enviarPaquete); // realizamos el envio socket.send(enviarPaquete); } else { System.out.println("Paquete Ack"); // ----------------------------------------------------------------------------------- } } while (1 > 0); } catch (Exception e) { System.err.println(e.getMessage()); System.exit(1); } } }
[ "contacto@cogollosdeloeste.com.ar" ]
contacto@cogollosdeloeste.com.ar
5f912619af54dc000080ba26c5a22db8465b04d3
a1d77fdd515dad39abd78805c9c5b8ccfeb9d845
/src/main/java/com/google/cloud/teleport/templates/BigQueryToTFRecord.java
b2eaf6cbbd01294944dd7f24e1f31bd4f67d4b94
[ "Apache-2.0" ]
permissive
pabloem/DataflowTemplates
463a47b3984e855792b0ed7a44d99d7fb1165b65
708d888f726d461f874e1a28e0b4a97a9c56ea71
refs/heads/master
2023-04-16T12:07:13.077273
2020-04-01T21:49:43
2020-04-01T21:50:13
252,294,486
0
1
Apache-2.0
2020-04-01T21:53:30
2020-04-01T21:50:53
null
UTF-8
Java
false
false
12,325
java
/* * Copyright (C) 2019 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.google.cloud.teleport.templates; import avro.shaded.com.google.common.annotations.VisibleForTesting; import com.google.api.services.bigquery.model.TableFieldSchema; import com.google.cloud.teleport.templates.common.BigQueryConverters.BigQueryReadOptions; import com.google.protobuf.ByteString; import java.util.Iterator; import java.util.Random; import org.apache.avro.generic.GenericData; import org.apache.avro.generic.GenericRecord; import org.apache.avro.util.Utf8; import org.apache.beam.sdk.Pipeline; import org.apache.beam.sdk.PipelineResult; import org.apache.beam.sdk.coders.ByteArrayCoder; import org.apache.beam.sdk.io.FileIO; import org.apache.beam.sdk.io.TFRecordIO; import org.apache.beam.sdk.io.gcp.bigquery.BigQueryIO; import org.apache.beam.sdk.io.gcp.bigquery.SchemaAndRecord; import org.apache.beam.sdk.options.Default; import org.apache.beam.sdk.options.Description; import org.apache.beam.sdk.options.PipelineOptionsFactory; import org.apache.beam.sdk.options.ValueProvider; import org.apache.beam.sdk.transforms.Partition; import org.apache.beam.sdk.transforms.Reshuffle; import org.apache.beam.sdk.values.PCollection; import org.apache.beam.sdk.values.PCollectionList; import org.tensorflow.example.Example; import org.tensorflow.example.Feature; import org.tensorflow.example.Features; /** * Dataflow template which reads BigQuery data and writes it to GCS as a set of TFRecords. The * source is a SQL query. */ public class BigQueryToTFRecord { /** * The {@link BigQueryToTFRecord#buildFeatureFromIterator(Class, Object, Feature.Builder)} method * handles {@link GenericData.Array} that are passed into the {@link * BigQueryToTFRecord#buildFeature} method creating a TensorFlow feature from the record. */ private static final String TRAIN = "train/"; private static final String TEST = "test/"; private static final String VAL = "val/"; private static void buildFeatureFromIterator( Class<?> fieldType, Object field, Feature.Builder feature) { ByteString byteString; GenericData.Array f = (GenericData.Array) field; if (fieldType == Long.class) { Iterator<Long> longIterator = f.iterator(); while (longIterator.hasNext()) { Long longValue = longIterator.next(); feature.getInt64ListBuilder().addValue(longValue); } } else if (fieldType == double.class) { Iterator<Double> doubleIterator = f.iterator(); while (doubleIterator.hasNext()) { double doubleValue = doubleIterator.next(); feature.getFloatListBuilder().addValue((float) doubleValue); } } else if (fieldType == String.class){ Iterator<Utf8> stringIterator = f.iterator(); while (stringIterator.hasNext()) { String stringValue = stringIterator.next().toString(); byteString = ByteString.copyFromUtf8(stringValue); feature.getBytesListBuilder().addValue(byteString); } } else if (fieldType == boolean.class){ Iterator<Boolean> booleanIterator = f.iterator(); while (booleanIterator.hasNext()) { Boolean boolValue = booleanIterator.next(); int boolAsInt = boolValue ? 1 : 0; feature.getInt64ListBuilder().addValue(boolAsInt); } } } /** * The {@link BigQueryToTFRecord#buildFeature} method takes in an individual field * and type corresponding to a column value from a SchemaAndRecord Object * returned from a BigQueryIO.read() step. The method builds * a TensorFlow Feature based on the type of the object- ie: STRING, TIME, INTEGER etc.. */ private static Feature buildFeature(Object field, String type) { Feature.Builder feature = Feature.newBuilder(); ByteString byteString; switch (type) { case "STRING": case "TIME": case "DATE": if (field instanceof GenericData.Array){ buildFeatureFromIterator(String.class, field, feature); } else { byteString = ByteString.copyFromUtf8(field.toString()); feature.getBytesListBuilder().addValue(byteString); } break; case "BYTES": byteString = ByteString.copyFrom((byte[]) field); feature.getBytesListBuilder().addValue(byteString); break; case "INTEGER": case "INT64": case "TIMESTAMP": if (field instanceof GenericData.Array){ buildFeatureFromIterator(Long.class, field, feature); } else { feature.getInt64ListBuilder().addValue((long) field); } break; case "FLOAT": case "FLOAT64": if (field instanceof GenericData.Array){ buildFeatureFromIterator(double.class, field, feature); } else { feature.getFloatListBuilder().addValue((float) (double) field); } break; case "BOOLEAN": case "BOOL": if (field instanceof GenericData.Array){ buildFeatureFromIterator(boolean.class, field, feature); } else { int boolAsInt = (boolean) field ? 1 : 0; feature.getInt64ListBuilder().addValue(boolAsInt); } break; default: throw new RuntimeException("Unsupported type: " + type); } return feature.build(); } /** * The {@link BigQueryToTFRecord#record2Example(SchemaAndRecord)} method uses takes in * a SchemaAndRecord Object returned from a BigQueryIO.read() step and builds * a TensorFlow Example from the record. */ @VisibleForTesting protected static byte[] record2Example(SchemaAndRecord schemaAndRecord) { Example.Builder example = Example.newBuilder(); Features.Builder features = example.getFeaturesBuilder(); GenericRecord record = schemaAndRecord.getRecord(); for (TableFieldSchema field : schemaAndRecord.getTableSchema().getFields()) { Feature feature = buildFeature(record.get(field.getName()), field.getType()); features.putFeature(field.getName(), feature); } return example.build().toByteArray(); } /** * The {@link BigQueryToTFRecord#concatURI} method uses takes in a Cloud Storage URI and a * subdirectory name and safely concatenates them. The resulting String is used as a sink for * TFRecords. */ private static String concatURI(String dir, String folder) { if (dir.endsWith("/")) { return dir + folder; } else { return dir + "/" + folder; } } /** * The {@link BigQueryToTFRecord#applyTrainTestValSplit} method transforms the PCollection * by randomly partitioning it into PCollections for each dataset. */ static PCollectionList<byte[]> applyTrainTestValSplit(PCollection<byte[]> input, ValueProvider<Float> trainingPercentage, ValueProvider<Float> testingPercentage, ValueProvider<Float> validationPercentage, Random rand) { return input .apply(Partition.of( 3, (Partition.PartitionFn<byte[]>) (number, numPartitions) -> { Float train = trainingPercentage.get(); Float test = testingPercentage.get(); Float validation = validationPercentage.get(); Double d = rand.nextDouble(); if (train + test + validation != 1){ throw new RuntimeException(String.format("Train %.2f, Test %.2f, Validation" + " %.2f percentages must add up to 100 percent", train, test, validation)); } if (d < train){ return 0; } else if (d >= train && d < train + test){ return 1; } else { return 2; } })); } /** Run the pipeline. */ public static void main(String[] args) { Options options = PipelineOptionsFactory.fromArgs(args).withValidation().as(Options.class); run(options); } /** * Runs the pipeline to completion with the specified options. This method does not wait until the * pipeline is finished before returning. Invoke {@code result.waitUntilFinish()} on the result * object to block until the pipeline is finished running if blocking programmatic execution is * required. * * @param options The execution options. * @return The pipeline result. */ public static PipelineResult run(Options options) { Random rand = new Random(100); // set random seed Pipeline pipeline = Pipeline.create(options); PCollection<byte[]> bigQueryToExamples = pipeline .apply( "RecordToExample", BigQueryIO.read(BigQueryToTFRecord::record2Example) .fromQuery(options.getReadQuery()) .withCoder(ByteArrayCoder.of()) .withoutValidation() .usingStandardSql() .withMethod(BigQueryIO.TypedRead.Method.DIRECT_READ) // Enable BigQuery Storage API ).apply("ReshuffleResults", Reshuffle.viaRandomKey()); PCollectionList<byte[]> partitionedExamples = applyTrainTestValSplit( bigQueryToExamples, options.getTrainingPercentage(), options.getTestingPercentage(), options.getValidationPercentage(), rand); partitionedExamples.get(0).apply( "WriteTFTrainingRecord", FileIO.<byte[]>write() .via(TFRecordIO.sink()) .to(ValueProvider.NestedValueProvider.of( options.getOutputDirectory(), dir -> concatURI(dir, TRAIN))) .withNumShards(0) .withSuffix(options.getOutputSuffix())); partitionedExamples.get(1).apply( "WriteTFTestingRecord", FileIO.<byte[]>write() .via(TFRecordIO.sink()) .to(ValueProvider.NestedValueProvider.of( options.getOutputDirectory(), dir -> concatURI(dir, TEST))) .withNumShards(0) .withSuffix(options.getOutputSuffix())); partitionedExamples.get(2).apply( "WriteTFValidationRecord", FileIO.<byte[]>write() .via(TFRecordIO.sink()) .to(ValueProvider.NestedValueProvider.of( options.getOutputDirectory(), dir -> concatURI(dir, VAL))) .withNumShards(0) .withSuffix(options.getOutputSuffix())); return pipeline.run(); } /** Define command line arguments. */ public interface Options extends BigQueryReadOptions { @Description("The GCS directory to store output TFRecord files.") ValueProvider<String> getOutputDirectory(); void setOutputDirectory(ValueProvider<String> outputDirectory); @Description("The output suffix for TFRecord Files") @Default.String(".tfrecord") ValueProvider<String> getOutputSuffix(); void setOutputSuffix(ValueProvider<String> outputSuffix); @Description("The training percentage split for TFRecord Files") @Default.Float(1) ValueProvider<Float> getTrainingPercentage(); void setTrainingPercentage(ValueProvider<Float> trainingPercentage); @Description("The testing percentage split for TFRecord Files") @Default.Float(0) ValueProvider<Float> getTestingPercentage(); void setTestingPercentage(ValueProvider<Float> testingPercentage); @Description("The validation percentage split for TFRecord Files") @Default.Float(0) ValueProvider<Float> getValidationPercentage(); void setValidationPercentage(ValueProvider<Float> validationPercentage); } }
[ "cloud-teleport@google.com" ]
cloud-teleport@google.com
9667c0dccc5dedb97a900ed191ad6ee8db9b79a7
0feec9a847517c98651771c51f5945d50ef55d2e
/src/com/sportrecord/model/SportRecordDAO_interface.java
21f205b660762f2ea6686b1ddb1d4f2eca750938
[]
no_license
air-gi/EA102G4
d9fb111ae13b21ded94499c1527d683e1d656901
1657fc867df3f5657089bb9b663b504b37dd0e28
refs/heads/master
2023-04-18T19:11:12.639937
2021-05-06T12:53:14
2021-05-06T12:53:14
364,875,460
0
0
null
null
null
null
BIG5
Java
false
false
700
java
package com.sportrecord.model; import java.util.List; public interface SportRecordDAO_interface { public SportRecordVO insert(SportRecordVO sportRecordVO); public void update(SportRecordVO sportRecordVO); public void delete(String record_no); public List<SportRecordVO> findByPrimaryKeyMemId(String mem_id); public SportRecordVO findByPrimaryKeyMemIdLast(String mem_id); public SportRecordVO findByPrimaryKeyRecordNo(String record_no); public List<SportRecordVO> getAll(); //萬用複合查詢(傳入參數型態Map)(回傳 List) // public List<SportRecordVO> getAll(Map<String, String[]> map); }
[ "User@DESKTOP-JO81F50" ]
User@DESKTOP-JO81F50
ed1adef3dedf5f40f9cea9501647b42a8d016bcd
c84dc380ed149520681f6d6df4bc38e85558ddc2
/src/main/java/com/fiap/produto/domain/Categoria.java
c30ecfb8cdce25597fefea3a9843bae7a867e78c
[]
no_license
YuriAncelmo/MicroServicosSpringBoot
825dd5b99b7c0be805614752b880f4aaca008f91
0d8036ace4b06f470ee6daa69674872a08676f5d
refs/heads/master
2023-03-03T15:41:40.291252
2021-02-06T11:41:17
2021-02-06T11:41:17
336,523,962
1
0
null
null
null
null
UTF-8
Java
false
false
1,143
java
package com.fiap.produto.domain; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; @Entity public class Categoria { @Id @GeneratedValue(strategy = GenerationType.AUTO) private int id; private String nome; private String descricao; public Categoria(){ } public Categoria( final String nome, final String descricao){ this.nome=nome; this.descricao = descricao; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public String getDescricao() { return descricao; } public void setDescricao(String descricao) { this.descricao = descricao; } @Override public String toString() { return "Categoria{" + "id=" + id + ", nome='" + nome + '\'' + ", descricao='" + descricao + '\'' + '}'; } }
[ "yuriancelmo@hotmail.com" ]
yuriancelmo@hotmail.com
13b72981802fecca6175e06701bbb4864d57ee3a
88d785ca23def4ca733f7d52a146bc8d34c77429
/src/dev/zt/UpliftedVFFV/events/Floor3Offices/EastWingOffices/WarpBalconytoStairsRoom.java
77987ca3d4d193dea21744a915c596afe66f4c74
[]
no_license
Donpommelo/Uplifted.VFFV
30fe1e41a9aeefee16c1e224388af6ce55ebfcce
99b63eb2a00666eb4fdf84ac20cebebefad1a3dc
refs/heads/master
2020-12-24T17:44:19.147662
2016-06-01T21:46:13
2016-06-01T21:46:13
33,390,964
0
0
null
2015-08-25T01:57:41
2015-04-04T01:58:48
Java
UTF-8
Java
false
false
469
java
package dev.zt.UpliftedVFFV.events.Floor3Offices.EastWingOffices; import dev.zt.UpliftedVFFV.events.Event; import dev.zt.UpliftedVFFV.gfx.Assets; public class WarpBalconytoStairsRoom extends Event { public static int stagenum = 0; public WarpBalconytoStairsRoom(float x, float y, int idnum) { super(Assets.White,idnum,x, y, stagenum); } public void run(){ super.transport("/Worlds/Floor3Offices/EastWingOffices/EastOfficesLeft1Room1.txt",16,6,""); } }
[ "donpommelo@gmail" ]
donpommelo@gmail
94573262f21d788d70a4bb43d1d374171fa673d8
e2e9133bf21f7d26123ed9c834a9c4dd372dacd5
/src/com/example/fragmenttest/OnSeasonSelectedListener.java
9a3289405ecf6ebf1e81a4523fddcfd3d5b5abfa
[]
no_license
talhakosen/FragmentTest
7a6eca1ef7b3ed795bf2d72a4c29b6bedc1601c0
6a8746c6886d3b72be03784ca18fd991bcb2cd09
refs/heads/master
2021-01-10T19:24:33.622792
2012-12-28T16:47:18
2012-12-28T16:47:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
126
java
package com.example.fragmenttest; public interface OnSeasonSelectedListener { public void onSeasonSelected(Season season); }
[ "talhakosen@hotmail.com" ]
talhakosen@hotmail.com
7b363bf43383f7f674ec5c133c6040c1141771c9
e0a7db1b28b754b5ade662c9272b81624633e418
/src/main/java/com/nedogeek/holdem/server/adminCommands/SetGameDelayCommand.java
8fd22d6aba4847fb11050ce1b167d0b5418bae0b
[]
no_license
Demishev/HoldemDojo
ffcc06666b0755e2ce8b12fe8fce5f6577ecd605
07d80aef67c179a002ad28644e3adec0702e3f91
refs/heads/master
2022-07-27T04:23:13.861427
2020-07-31T17:52:43
2020-07-31T17:52:43
6,128,533
11
13
null
2022-07-07T22:04:48
2012-10-08T17:49:52
Java
UTF-8
Java
false
false
1,308
java
package com.nedogeek.holdem.server.adminCommands; /*- * #%L * Holdem dojo project is a server-side java application for playing holdem pocker in DOJO style. * %% * Copyright (C) 2016 Holdemdojo * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-3.0.html>. * #L% */ import com.nedogeek.holdem.server.AdminModel; /** * User: Konstantin Demishev * Date: 19.04.13 * Time: 4:19 */ public class SetGameDelayCommand extends AdminCommand { public SetGameDelayCommand(AdminModel adminModel) { super(adminModel); } @Override public void invoke(String[] params) { int delayValue = Integer.parseInt(params[0]); adminModel.setGameDelay(delayValue); } }
[ "demishev.k@gmail.com" ]
demishev.k@gmail.com
bfff417881a3abf407c35cb00c1f994203b36565
c2c33a239eebc00b6be9fb2bef785c0d15cc870c
/app/src/main/java/bscenter/tracnghiemlaptrinh/views/custom/BackgroundView.java
a55b0d896106fbbabe91ecb4d3cbc60ef5d0bf09
[]
no_license
nghianvbsc/javatest_full
ec773a869ff014121cb38bd2a44c358be43c0486
4010bfe33f21814f82677df39f87402d561063a8
refs/heads/master
2020-07-28T17:48:14.307954
2016-08-17T21:38:19
2016-08-17T21:38:19
65,943,678
0
0
null
null
null
null
UTF-8
Java
false
false
10,351
java
package bscenter.tracnghiemlaptrinh.views.custom; import android.content.Context; import android.os.Handler; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; import android.widget.RelativeLayout; import android.widget.TextView; import java.util.Random; import bscenter.tracnghiemlaptrinh.R; import bscenter.tracnghiemlaptrinh.model.Level; import bscenter.tracnghiemlaptrinh.views.activities.PlayActivity; /** * Created by NIT Admin on 04/06/2016 */ public class BackgroundView extends RelativeLayout implements View.OnClickListener { public static int scoreForATrueAnswer = 10; //view start game private View rlStartGame1, btnStartPlay1, rlStartGame2, btnStartPlay2; private TextView tvTitle1, tvTitle2; //view score private View rlScore; private TextView tvScore, tvTrueAnswer; //view pause game private View rlPause1, btnContinuePause1, btnExitPause1, rlPause2, btnContinuePause2, btnExitPause2; private TextView tvScorePause1, tvTrueAnswerPause1, tvLevelPause1, tvScorePause2, tvTrueAnswerPause2, tvLevelPause2; ///view finish private View rlFinish, btnExitFinish; private TextView tvScoreFinish, tvTrueAnswerFinish, tvLevelFinish, tvReviewFinish; private BackgroundListening mBackgroundListening; public BackgroundView(Context context) { this(context, null); } public BackgroundView(Context context, AttributeSet attrs) { this(context, attrs, 0); } public BackgroundView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); View view = LayoutInflater.from(context).inflate(R.layout.view_background, null); initViews(view); addView(view); } private void initViews(View view) { //init view start rlStartGame1 = view.findViewById(R.id.rlStartGame1); rlStartGame2 = view.findViewById(R.id.rlStartGame2); btnStartPlay1 = view.findViewById(R.id.btnStartPlay1); btnStartPlay2 = view.findViewById(R.id.btnStartPlay2); tvTitle1 = (TextView) view.findViewById(R.id.tvTitle1); tvTitle2 = (TextView) view.findViewById(R.id.tvTitle2); btnStartPlay1.setOnClickListener(this); btnStartPlay2.setOnClickListener(this); //init view pause rlScore = view.findViewById(R.id.rlScore); tvScore = (TextView) view.findViewById(R.id.tvScore); tvTrueAnswer = (TextView) view.findViewById(R.id.tvTrueAnswer); //init view pause rlPause1 = view.findViewById(R.id.rlPause1); rlPause2 = view.findViewById(R.id.rlPause2); btnContinuePause1 = view.findViewById(R.id.btnContinuePause1); btnExitPause1 = view.findViewById(R.id.btnExitPause1); btnContinuePause2 = view.findViewById(R.id.btnContinuePause2); btnExitPause2 = view.findViewById(R.id.btnExitPause2); tvScorePause1 = (TextView) view.findViewById(R.id.tvScorePause1); tvTrueAnswerPause1 = (TextView) view.findViewById(R.id.tvTrueAnswerPause1); tvLevelPause1 = (TextView) view.findViewById(R.id.tvLevelPause1); tvScorePause2 = (TextView) view.findViewById(R.id.tvScorePause2); tvTrueAnswerPause2 = (TextView) view.findViewById(R.id.tvTrueAnswerPause2); tvLevelPause2 = (TextView) view.findViewById(R.id.tvLevelPause2); btnContinuePause1.setOnClickListener(this); btnExitPause1.setOnClickListener(this); btnContinuePause2.setOnClickListener(this); btnExitPause2.setOnClickListener(this); //init view finish rlFinish = view.findViewById(R.id.rlFinish); btnExitFinish = view.findViewById(R.id.btnExitFinish); tvScoreFinish = (TextView) view.findViewById(R.id.tvScoreFinish); tvTrueAnswerFinish = (TextView) view.findViewById(R.id.tvTrueAnswerFinish); tvLevelFinish = (TextView) view.findViewById(R.id.tvLevelFinish); tvReviewFinish = (TextView) view.findViewById(R.id.tvReviewFinish); btnExitFinish.setOnClickListener(this); } public void setCallBack(BackgroundListening backgroundListening) { mBackgroundListening = backgroundListening; } public void onStartGame(Level level) { if (randInt(1, 2) == 1) { rlStartGame1.setVisibility(View.VISIBLE); if (level == Level.medium) { tvTitle1.setText("Bạn có " + PlayActivity.timeMenium + " giây."); } else if (level == Level.difficult) { tvTitle1.setText("Bạn có " + PlayActivity.timeDif + " giây."); } rlStartGame2.setVisibility(View.GONE); } else { rlStartGame2.setVisibility(View.VISIBLE); if (level == Level.medium) { tvTitle2.setText("Thời gian là " + PlayActivity.timeMenium + " giây."); } else if (level == Level.difficult) { tvTitle2.setText("Thời gian là " + PlayActivity.timeDif + " giây."); } rlStartGame1.setVisibility(View.GONE); } rlScore.setVisibility(View.GONE); rlPause1.setVisibility(View.GONE); rlPause2.setVisibility(View.GONE); rlFinish.setVisibility(View.GONE); } public void onAnswerChange(int countTrueAnswer, int size, Level level) { rlScore.setVisibility(View.VISIBLE); rlPause1.setVisibility(View.GONE); rlPause2.setVisibility(View.GONE); rlFinish.setVisibility(View.GONE); rlStartGame1.setVisibility(View.GONE); rlStartGame2.setVisibility(View.GONE); tvScore.setText("Điểm: " + getScore(countTrueAnswer, size, level)); tvTrueAnswer.setText("Đúng : " + countTrueAnswer + "/" + size + " câu"); } public void onPauseAnswer(int countTrueAnswer, int size, Level level) { if (randInt(1, 2) == 1) { rlPause1.setVisibility(View.VISIBLE); rlPause2.setVisibility(View.GONE); } else { rlPause2.setVisibility(View.VISIBLE); rlPause1.setVisibility(View.GONE); } rlScore.setVisibility(View.GONE); rlFinish.setVisibility(View.GONE); rlStartGame1.setVisibility(View.GONE); rlStartGame2.setVisibility(View.GONE); tvScorePause1.setText("Điểm hiện tại: " + getScore(countTrueAnswer, size, level)); tvScorePause2.setText("Điểm hiện tại: " + getScore(countTrueAnswer, size, level)); tvTrueAnswerPause1.setText("Trả lời đúng: " + countTrueAnswer + "/" + size); tvTrueAnswerPause2.setText("Trả lời đúng: " + countTrueAnswer + "/" + size); tvLevelPause1.setText("Mức độ: " + getLevel(level)); tvLevelPause2.setText("Mức độ: " + getLevel(level)); } public void onFinishAnswer(int countTrueAnswer, int size, Level level) { rlPause2.setVisibility(View.GONE); rlPause1.setVisibility(View.GONE); rlScore.setVisibility(View.GONE); rlFinish.setVisibility(View.VISIBLE); rlStartGame1.setVisibility(View.GONE); rlStartGame2.setVisibility(View.GONE); tvScoreFinish.setText("Điểm : " + getScore(countTrueAnswer, size, level)); tvTrueAnswerFinish.setText("Trả lời đúng: " + countTrueAnswer + "/" + size); tvLevelFinish.setText("Mức độ: " + getLevel(level)); tvReviewFinish.setText(getReview(countTrueAnswer, size, level)); btnExitFinish.setVisibility(View.GONE); new Handler().postDelayed(new Runnable() { @Override public void run() { btnExitFinish.setVisibility(View.VISIBLE); } }, 2500); } private String getReview(int countTrueAnswer, int size, Level level) { if (level.getValue() == 1) { if (getScore(countTrueAnswer, size, level) < 60) { return "Thầy sẽ kiểm tra lại kiến thứ của em lần sau!"; } else if (getScore(countTrueAnswer, size, level) < 80) { return "Khá, nhưng cần có gắng th!"; } else { return "Rất tôt! thầy sẽ gửi cho em một bài test khó hơn."; } } else if (level.getValue() == 2) { if (getScore(countTrueAnswer, size, level) < 80) { return "Em đã có gắng để chinh phuc mức độ này, nhưng nỗ lực của em vẫn chưa "; } else if (getScore(countTrueAnswer, size, level) < 120) { return "Em hy chinh mức độ khó hơn xem sao."; } else { return "Thầy tin em sẽ có kết quả tốt nếu tiếp tục như vậy"; } } else { if (getScore(countTrueAnswer, size, level) < 120) { return "Hãy suy nghĩ kỹ hơn trước khi chọn đáp án nhé!"; } else if (getScore(countTrueAnswer, size, level) < 180) { return "Thầy và em sẽ gặp nhau ở bài test tiếp."; } else { return "Thật không thể tin nỗi, em đã qua môn thầy. Chúc em thanh công"; } } } public int getScore(int countTrueAnswer, int size, Level level) { return countTrueAnswer * scoreForATrueAnswer; } public static String getLevel(Level level) { if (level == Level.easy) { return "Dễ"; } else if (level == Level.medium) { return "Trung bình"; } else { return "Khó"; } } private int randInt(int min, int max) { return new Random().nextInt((max - min) + 1) + min; } @Override public void onClick(View v) { if (v == btnStartPlay1 || v == btnStartPlay2) { mBackgroundListening.onStartGame(); } else if (v == btnContinuePause1 || v == btnContinuePause2) { mBackgroundListening.onContinueGame(); } else if (v == btnExitPause1 || v == btnExitPause2) { mBackgroundListening.onExitGame(); } else if (v == btnExitFinish) { mBackgroundListening.onExitGame(); } } public interface BackgroundListening { void onStartGame(); void onContinueGame(); void onExitGame(); } }
[ "nghianv.dev@@gmail.com" ]
nghianv.dev@@gmail.com
1ebeb0e5dc4f3c29ab59376f86c0e3a43a35a17e
bee16ca0e7bb7be39f80d5ff9e66d57daf189e5d
/src/main/java/acidoth/thrift/xa/InvalidParameters.java
585712f78420fff1044075ca43ba02a1d3497874
[]
no_license
pirinthapan/Coordinator
e19840b4bac48573a93ee4bc335a9f23ff385148
f2542319888a1025a50717af2644a376e73545e8
refs/heads/master
2021-01-24T02:11:51.352626
2015-04-20T05:33:24
2015-04-20T05:33:24
10,701,410
0
0
null
null
null
null
UTF-8
Java
false
true
17,415
java
/** * Autogenerated by Thrift Compiler (0.9.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ package acidoth.thrift.xa; import org.apache.thrift.scheme.IScheme; import org.apache.thrift.scheme.SchemeFactory; import org.apache.thrift.scheme.StandardScheme; import org.apache.thrift.scheme.TupleScheme; import org.apache.thrift.protocol.TTupleProtocol; import org.apache.thrift.protocol.TProtocolException; import org.apache.thrift.EncodingUtils; import org.apache.thrift.TException; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.util.HashMap; import java.util.EnumMap; import java.util.Set; import java.util.HashSet; import java.util.EnumSet; import java.util.Collections; import java.util.BitSet; import java.nio.ByteBuffer; import java.util.Arrays; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class InvalidParameters extends TException implements org.apache.thrift.TBase<InvalidParameters, InvalidParameters._Fields>, java.io.Serializable, Cloneable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("InvalidParameters"); private static final org.apache.thrift.protocol.TField CODE_FIELD_DESC = new org.apache.thrift.protocol.TField("code", org.apache.thrift.protocol.TType.STRING, (short)1); private static final org.apache.thrift.protocol.TField SUBCODE_FIELD_DESC = new org.apache.thrift.protocol.TField("subcode", org.apache.thrift.protocol.TType.STRING, (short)2); private static final org.apache.thrift.protocol.TField REASON_FIELD_DESC = new org.apache.thrift.protocol.TField("reason", org.apache.thrift.protocol.TType.STRING, (short)3); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { schemes.put(StandardScheme.class, new InvalidParametersStandardSchemeFactory()); schemes.put(TupleScheme.class, new InvalidParametersTupleSchemeFactory()); } public String code; // required public String subcode; // required public String reason; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { CODE((short)1, "code"), SUBCODE((short)2, "subcode"), REASON((short)3, "reason"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); static { for (_Fields field : EnumSet.allOf(_Fields.class)) { byName.put(field.getFieldName(), field); } } /** * Find the _Fields constant that matches fieldId, or null if its not found. */ public static _Fields findByThriftId(int fieldId) { switch(fieldId) { case 1: // CODE return CODE; case 2: // SUBCODE return SUBCODE; case 3: // REASON return REASON; default: return null; } } /** * Find the _Fields constant that matches fieldId, throwing an exception * if it is not found. */ public static _Fields findByThriftIdOrThrow(int fieldId) { _Fields fields = findByThriftId(fieldId); if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); return fields; } /** * Find the _Fields constant that matches name, or null if its not found. */ public static _Fields findByName(String name) { return byName.get(name); } private final short _thriftId; private final String _fieldName; _Fields(short thriftId, String fieldName) { _thriftId = thriftId; _fieldName = fieldName; } public short getThriftFieldId() { return _thriftId; } public String getFieldName() { return _fieldName; } } // isset id assignments public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; static { Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); tmpMap.put(_Fields.CODE, new org.apache.thrift.meta_data.FieldMetaData("code", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.SUBCODE, new org.apache.thrift.meta_data.FieldMetaData("subcode", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.REASON, new org.apache.thrift.meta_data.FieldMetaData("reason", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(InvalidParameters.class, metaDataMap); } public InvalidParameters() { } public InvalidParameters( String code, String subcode, String reason) { this(); this.code = code; this.subcode = subcode; this.reason = reason; } /** * Performs a deep copy on <i>other</i>. */ public InvalidParameters(InvalidParameters other) { if (other.isSetCode()) { this.code = other.code; } if (other.isSetSubcode()) { this.subcode = other.subcode; } if (other.isSetReason()) { this.reason = other.reason; } } public InvalidParameters deepCopy() { return new InvalidParameters(this); } @Override public void clear() { this.code = null; this.subcode = null; this.reason = null; } public String getCode() { return this.code; } public InvalidParameters setCode(String code) { this.code = code; return this; } public void unsetCode() { this.code = null; } /** Returns true if field code is set (has been assigned a value) and false otherwise */ public boolean isSetCode() { return this.code != null; } public void setCodeIsSet(boolean value) { if (!value) { this.code = null; } } public String getSubcode() { return this.subcode; } public InvalidParameters setSubcode(String subcode) { this.subcode = subcode; return this; } public void unsetSubcode() { this.subcode = null; } /** Returns true if field subcode is set (has been assigned a value) and false otherwise */ public boolean isSetSubcode() { return this.subcode != null; } public void setSubcodeIsSet(boolean value) { if (!value) { this.subcode = null; } } public String getReason() { return this.reason; } public InvalidParameters setReason(String reason) { this.reason = reason; return this; } public void unsetReason() { this.reason = null; } /** Returns true if field reason is set (has been assigned a value) and false otherwise */ public boolean isSetReason() { return this.reason != null; } public void setReasonIsSet(boolean value) { if (!value) { this.reason = null; } } public void setFieldValue(_Fields field, Object value) { switch (field) { case CODE: if (value == null) { unsetCode(); } else { setCode((String)value); } break; case SUBCODE: if (value == null) { unsetSubcode(); } else { setSubcode((String)value); } break; case REASON: if (value == null) { unsetReason(); } else { setReason((String)value); } break; } } public Object getFieldValue(_Fields field) { switch (field) { case CODE: return getCode(); case SUBCODE: return getSubcode(); case REASON: return getReason(); } throw new IllegalStateException(); } /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case CODE: return isSetCode(); case SUBCODE: return isSetSubcode(); case REASON: return isSetReason(); } throw new IllegalStateException(); } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof InvalidParameters) return this.equals((InvalidParameters)that); return false; } public boolean equals(InvalidParameters that) { if (that == null) return false; boolean this_present_code = true && this.isSetCode(); boolean that_present_code = true && that.isSetCode(); if (this_present_code || that_present_code) { if (!(this_present_code && that_present_code)) return false; if (!this.code.equals(that.code)) return false; } boolean this_present_subcode = true && this.isSetSubcode(); boolean that_present_subcode = true && that.isSetSubcode(); if (this_present_subcode || that_present_subcode) { if (!(this_present_subcode && that_present_subcode)) return false; if (!this.subcode.equals(that.subcode)) return false; } boolean this_present_reason = true && this.isSetReason(); boolean that_present_reason = true && that.isSetReason(); if (this_present_reason || that_present_reason) { if (!(this_present_reason && that_present_reason)) return false; if (!this.reason.equals(that.reason)) return false; } return true; } @Override public int hashCode() { return 0; } public int compareTo(InvalidParameters other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; InvalidParameters typedOther = (InvalidParameters)other; lastComparison = Boolean.valueOf(isSetCode()).compareTo(typedOther.isSetCode()); if (lastComparison != 0) { return lastComparison; } if (isSetCode()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.code, typedOther.code); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetSubcode()).compareTo(typedOther.isSetSubcode()); if (lastComparison != 0) { return lastComparison; } if (isSetSubcode()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.subcode, typedOther.subcode); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetReason()).compareTo(typedOther.isSetReason()); if (lastComparison != 0) { return lastComparison; } if (isSetReason()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.reason, typedOther.reason); if (lastComparison != 0) { return lastComparison; } } return 0; } public _Fields fieldForId(int fieldId) { return _Fields.findByThriftId(fieldId); } public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { schemes.get(iprot.getScheme()).getScheme().read(iprot, this); } public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { schemes.get(oprot.getScheme()).getScheme().write(oprot, this); } @Override public String toString() { StringBuilder sb = new StringBuilder("InvalidParameters("); boolean first = true; sb.append("code:"); if (this.code == null) { sb.append("null"); } else { sb.append(this.code); } first = false; if (!first) sb.append(", "); sb.append("subcode:"); if (this.subcode == null) { sb.append("null"); } else { sb.append(this.subcode); } first = false; if (!first) sb.append(", "); sb.append("reason:"); if (this.reason == null) { sb.append("null"); } else { sb.append(this.reason); } first = false; sb.append(")"); return sb.toString(); } public void validate() throws org.apache.thrift.TException { // check for required fields if (code == null) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'code' was not present! Struct: " + toString()); } if (subcode == null) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'subcode' was not present! Struct: " + toString()); } if (reason == null) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'reason' was not present! Struct: " + toString()); } // check for sub-struct validity } private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { try { write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); } } private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { try { read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); } } private static class InvalidParametersStandardSchemeFactory implements SchemeFactory { public InvalidParametersStandardScheme getScheme() { return new InvalidParametersStandardScheme(); } } private static class InvalidParametersStandardScheme extends StandardScheme<InvalidParameters> { public void read(org.apache.thrift.protocol.TProtocol iprot, InvalidParameters struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; iprot.readStructBegin(); while (true) { schemeField = iprot.readFieldBegin(); if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { break; } switch (schemeField.id) { case 1: // CODE if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.code = iprot.readString(); struct.setCodeIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 2: // SUBCODE if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.subcode = iprot.readString(); struct.setSubcodeIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 3: // REASON if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.reason = iprot.readString(); struct.setReasonIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } iprot.readFieldEnd(); } iprot.readStructEnd(); // check for required fields of primitive type, which can't be checked in the validate method struct.validate(); } public void write(org.apache.thrift.protocol.TProtocol oprot, InvalidParameters struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.code != null) { oprot.writeFieldBegin(CODE_FIELD_DESC); oprot.writeString(struct.code); oprot.writeFieldEnd(); } if (struct.subcode != null) { oprot.writeFieldBegin(SUBCODE_FIELD_DESC); oprot.writeString(struct.subcode); oprot.writeFieldEnd(); } if (struct.reason != null) { oprot.writeFieldBegin(REASON_FIELD_DESC); oprot.writeString(struct.reason); oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); } } private static class InvalidParametersTupleSchemeFactory implements SchemeFactory { public InvalidParametersTupleScheme getScheme() { return new InvalidParametersTupleScheme(); } } private static class InvalidParametersTupleScheme extends TupleScheme<InvalidParameters> { @Override public void write(org.apache.thrift.protocol.TProtocol prot, InvalidParameters struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; oprot.writeString(struct.code); oprot.writeString(struct.subcode); oprot.writeString(struct.reason); } @Override public void read(org.apache.thrift.protocol.TProtocol prot, InvalidParameters struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; struct.code = iprot.readString(); struct.setCodeIsSet(true); struct.subcode = iprot.readString(); struct.setSubcodeIsSet(true); struct.reason = iprot.readString(); struct.setReasonIsSet(true); } } }
[ "mpirinthapan@gmail.com" ]
mpirinthapan@gmail.com
f3dacadf39df296325299f6cd9a7444627af7d9b
141a965ad17f63e9995de6073a99a9fbc8383b08
/group10代码/src/com/logout/action/LogoutAction.java
1d75d6b2511f0c71c53962954d9de6350f348f25
[]
no_license
GochenRyan/short_semester
439398215830fd5d6de518c92925116ff6aa3551
9504a9966a3cc7db07a7aa200f3940f963c45162
refs/heads/master
2021-06-22T15:41:50.646023
2017-07-17T13:56:07
2017-07-17T13:56:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
403
java
package com.logout.action; import java.util.Map; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionSupport; public class LogoutAction extends ActionSupport{ @Override public String execute() throws Exception { ActionContext ctx = ActionContext.getContext(); Map<String, Object> session = ctx.getSession(); session.remove("user"); return "logout"; } }
[ "jongkhurun@gmail.com" ]
jongkhurun@gmail.com
a2bd0f197707adbae610a46cd9b74f5f50a58851
812be6b9d1ba4036652df166fbf8662323f0bdc9
/java/Dddml.Wms.JavaCommon/src/generated/java/org/dddml/wms/domain/partyrole/AbstractPartyRoleStateCommandConverter.java
bd4c597a551aad5f7efd3c9c268126628c2c5bbd
[]
no_license
lanmolsz/wms
8503e54a065670b48a15955b15cea4926f05b5d6
4b71afd80127a43890102167a3af979268e24fa2
refs/heads/master
2020-03-12T15:10:26.133106
2018-09-27T08:28:05
2018-09-27T08:28:05
130,684,482
0
0
null
2018-04-23T11:11:24
2018-04-23T11:11:24
null
UTF-8
Java
false
false
2,966
java
package org.dddml.wms.domain.partyrole; import java.util.*; import java.util.Date; import org.dddml.wms.domain.*; public abstract class AbstractPartyRoleStateCommandConverter<TCreatePartyRole extends PartyRoleCommand.CreatePartyRole, TMergePatchPartyRole extends PartyRoleCommand.MergePatchPartyRole, TDeletePartyRole extends PartyRoleCommand.DeletePartyRole> { public PartyRoleCommand toCreateOrMergePatchPartyRole(PartyRoleState state) { //where TCreatePartyRole : ICreatePartyRole, new() //where TMergePatchPartyRole : IMergePatchPartyRole, new() boolean bUnsaved = state.isStateUnsaved(); if (bUnsaved) { return toCreatePartyRole(state); } else { return toMergePatchPartyRole(state); } } public TDeletePartyRole toDeletePartyRole(PartyRoleState state) //where TDeletePartyRole : IDeletePartyRole, new() { TDeletePartyRole cmd = newDeletePartyRole(); cmd.setPartyRoleId(state.getPartyRoleId()); cmd.setVersion(state.getVersion()); return cmd; } public TMergePatchPartyRole toMergePatchPartyRole(PartyRoleState state) //where TMergePatchPartyRole : IMergePatchPartyRole, new() { TMergePatchPartyRole cmd = newMergePatchPartyRole(); cmd.setVersion(state.getVersion()); cmd.setPartyRoleId(state.getPartyRoleId()); cmd.setActive(state.getActive()); if (state.getActive() == null) { cmd.setIsPropertyActiveRemoved(true); } return cmd; } public TCreatePartyRole toCreatePartyRole(PartyRoleState state) //where TCreatePartyRole : ICreatePartyRole, new() { TCreatePartyRole cmd = newCreatePartyRole(); cmd.setVersion(state.getVersion()); cmd.setPartyRoleId(state.getPartyRoleId()); cmd.setActive(state.getActive()); return cmd; } protected abstract TCreatePartyRole newCreatePartyRole(); protected abstract TMergePatchPartyRole newMergePatchPartyRole(); protected abstract TDeletePartyRole newDeletePartyRole(); public static class SimplePartyRoleStateCommandConverter extends AbstractPartyRoleStateCommandConverter<AbstractPartyRoleCommand.SimpleCreatePartyRole, AbstractPartyRoleCommand.SimpleMergePatchPartyRole, AbstractPartyRoleCommand.SimpleDeletePartyRole> { @Override protected AbstractPartyRoleCommand.SimpleCreatePartyRole newCreatePartyRole() { return new AbstractPartyRoleCommand.SimpleCreatePartyRole(); } @Override protected AbstractPartyRoleCommand.SimpleMergePatchPartyRole newMergePatchPartyRole() { return new AbstractPartyRoleCommand.SimpleMergePatchPartyRole(); } @Override protected AbstractPartyRoleCommand.SimpleDeletePartyRole newDeletePartyRole() { return new AbstractPartyRoleCommand.SimpleDeletePartyRole(); } } }
[ "yangjiefeng@gmail.com" ]
yangjiefeng@gmail.com
c93a5556b1d194354919395da1b59019d84a63dd
7f9b2b8ffa4a29df03901c579e16684709afa907
/Item1/src/main/java/ClassB.java
a1c7c3a60f9bb59a835d36b384ab3a42db82ce52
[]
no_license
mrdigerati/EffectiveJava
0091c733feceb869dcc2a0b615701e980adc1a59
d532f63f408f979ad341ad384582165ab1fd173a
refs/heads/master
2021-01-13T02:06:18.386350
2013-08-29T06:26:16
2013-08-29T06:26:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
716
java
import com.sun.corba.se.impl.presentation.rmi.StubFactoryStaticImpl; /** * Created with IntelliJ IDEA. * User: nikunj * Date: 10/7/13 * Time: 12:33 AM * To change this template use File | Settings | File Templates. */ public class ClassB { private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } public void print() { System.out.println(name); } private ClassB(String name) { this.name = name; } public static ClassB newInstance() { return new ClassB("Default"); } public static ClassB newInstance(String name) { return new ClassB(name); } }
[ "me@nikunjlahoti.com" ]
me@nikunjlahoti.com
6d4148809865879645d9a62382facbb3afbd5b3e
9a16a59a79ad17a1c01debcbdff433623de61d5c
/HW5/src/main/java/FileDao.java
ffa2214cc33a2c8816c29e8acc528d3b9a4183ba
[]
no_license
Spolutrean/OOPs
3c6db16e018cc450cf47f90e9b11ffe136fbe304
d860f8fded1d70f2a0efd86233e4e208d3e6d06f
refs/heads/master
2020-07-23T00:25:32.386068
2019-12-23T06:18:58
2019-12-23T06:18:58
207,382,637
0
0
null
null
null
null
UTF-8
Java
false
false
1,771
java
import java.io.*; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; public class FileDao implements Dao { private String itemsFilePath, shopsFilePath; public FileDao(String itemsFilePath, String shopsFilePath) { this.itemsFilePath = itemsFilePath; this.shopsFilePath = shopsFilePath; } @Override public void insertItem(Item item) throws IOException { BufferedWriter writer = new BufferedWriter(new FileWriter(itemsFilePath, true)); writer.newLine(); writer.write(item.toString()); writer.close(); } @Override public void insertShop(Shop shop) throws IOException { BufferedWriter writer = new BufferedWriter(new FileWriter(shopsFilePath, true)); writer.newLine(); writer.write(shop.toString()); writer.close(); } @Override public List<Item> getAllItems() throws IOException { return readAllLines(itemsFilePath).stream() .map(Item::new) .collect(Collectors.toList()); } @Override public List<Shop> getAllShops() throws IOException { return readAllLines(shopsFilePath).stream() .map(Shop::new) .collect(Collectors.toList()); } private List<String> readAllLines(String filePath) throws IOException { List<String> result = new ArrayList<>(); try(BufferedReader reader = new BufferedReader(new FileReader(filePath))) { String line = reader.readLine(); while (line != null) { if(line.length() != 0) { result.add(line); } line = reader.readLine(); } } return result; } }
[ "ys9617890962@gmail.com" ]
ys9617890962@gmail.com
2c9e29954bb29ece721c691e2695c71f1e6a7021
ffe055694ea55a6645654331ff78e472e339fbff
/stateful/parser-injector/org.xtext.firewall.iptables.ui/src-gen/org/xtext/example/iptables/ui/contentassist/antlr/IptablesParser.java
0683cab153df27c94e7a6e6d59b916af1414bcaa
[]
no_license
jgalfaro/mirrored-mirage
cd873c09f85e025abd95e789e3fc88edb07fce56
44edc0bec1dc0b6d94199e7a984d2fa59ed1a281
refs/heads/master
2021-07-13T18:15:27.005659
2021-06-27T01:01:19
2021-06-27T01:01:19
93,852,317
0
0
null
null
null
null
UTF-8
Java
false
false
8,805
java
/* * generated by Xtext */ package org.xtext.example.iptables.ui.contentassist.antlr; import java.util.Collection; import java.util.Map; import java.util.HashMap; import org.antlr.runtime.RecognitionException; import org.eclipse.xtext.AbstractElement; import org.eclipse.xtext.ui.editor.contentassist.antlr.AbstractContentAssistParser; import org.eclipse.xtext.ui.editor.contentassist.antlr.FollowElement; import org.eclipse.xtext.ui.editor.contentassist.antlr.internal.AbstractInternalContentAssistParser; import com.google.inject.Inject; import org.xtext.example.iptables.services.IptablesGrammarAccess; public class IptablesParser extends AbstractContentAssistParser { @Inject private IptablesGrammarAccess grammarAccess; private Map<AbstractElement, String> nameMappings; @Override protected org.xtext.example.iptables.ui.contentassist.antlr.internal.InternalIptablesParser createParser() { org.xtext.example.iptables.ui.contentassist.antlr.internal.InternalIptablesParser result = new org.xtext.example.iptables.ui.contentassist.antlr.internal.InternalIptablesParser(null); result.setGrammarAccess(grammarAccess); return result; } @Override protected String getRuleName(AbstractElement element) { if (nameMappings == null) { nameMappings = new HashMap<AbstractElement, String>() { private static final long serialVersionUID = 1L; { put(grammarAccess.getRuleAccess().getAlternatives(), "rule__Rule__Alternatives"); put(grammarAccess.getFilterSpecAccess().getOptionAlternatives_1_0(), "rule__FilterSpec__OptionAlternatives_1_0"); put(grammarAccess.getMatchAccess().getNameAlternatives_0(), "rule__Match__NameAlternatives_0"); put(grammarAccess.getStateAccess().getNameAlternatives_0(), "rule__State__NameAlternatives_0"); put(grammarAccess.getStateFulMatchStatesAccess().getAlternatives(), "rule__StateFulMatchStates__Alternatives"); put(grammarAccess.getTCPFlagAccess().getNameAlternatives_0(), "rule__TCPFlag__NameAlternatives_0"); put(grammarAccess.getProtocolAccess().getAlternatives(), "rule__Protocol__Alternatives"); put(grammarAccess.getFilterSpecAccess().getGroup(), "rule__FilterSpec__Group__0"); put(grammarAccess.getFilterSpecAccess().getGroup_3(), "rule__FilterSpec__Group_3__0"); put(grammarAccess.getFilterSpecAccess().getGroup_4(), "rule__FilterSpec__Group_4__0"); put(grammarAccess.getFilterSpecAccess().getGroup_5(), "rule__FilterSpec__Group_5__0"); put(grammarAccess.getFilterSpecAccess().getGroup_6(), "rule__FilterSpec__Group_6__0"); put(grammarAccess.getFilterSpecAccess().getGroup_7(), "rule__FilterSpec__Group_7__0"); put(grammarAccess.getFilterSpecAccess().getGroup_8(), "rule__FilterSpec__Group_8__0"); put(grammarAccess.getFilterSpecAccess().getGroup_11(), "rule__FilterSpec__Group_11__0"); put(grammarAccess.getFilterSpecAccess().getGroup_12(), "rule__FilterSpec__Group_12__0"); put(grammarAccess.getFilterSpecAccess().getGroup_12_2(), "rule__FilterSpec__Group_12_2__0"); put(grammarAccess.getFilterSpecAccess().getGroup_13(), "rule__FilterSpec__Group_13__0"); put(grammarAccess.getFilterSpecAccess().getGroup_14(), "rule__FilterSpec__Group_14__0"); put(grammarAccess.getFilterSpecAccess().getGroup_15(), "rule__FilterSpec__Group_15__0"); put(grammarAccess.getFilterSpecAccess().getGroup_15_2(), "rule__FilterSpec__Group_15_2__0"); put(grammarAccess.getFilterSpecAccess().getGroup_16(), "rule__FilterSpec__Group_16__0"); put(grammarAccess.getFilterSpecAccess().getGroup_16_2(), "rule__FilterSpec__Group_16_2__0"); put(grammarAccess.getFilterSpecAccess().getGroup_16_4(), "rule__FilterSpec__Group_16_4__0"); put(grammarAccess.getFilterSpecAccess().getGroup_19(), "rule__FilterSpec__Group_19__0"); put(grammarAccess.getChainDeclarationAccess().getGroup(), "rule__ChainDeclaration__Group__0"); put(grammarAccess.getIPExprAccess().getGroup(), "rule__IPExpr__Group__0"); put(grammarAccess.getIpRangeExprAccess().getGroup(), "rule__IpRangeExpr__Group__0"); put(grammarAccess.getModelAccess().getRulesAssignment(), "rule__Model__RulesAssignment"); put(grammarAccess.getRuleAccess().getDeclarationAssignment_0(), "rule__Rule__DeclarationAssignment_0"); put(grammarAccess.getRuleAccess().getFilterAssignment_1(), "rule__Rule__FilterAssignment_1"); put(grammarAccess.getFilterDeclarationAccess().getFilterAssignment(), "rule__FilterDeclaration__FilterAssignment"); put(grammarAccess.getFilterSpecAccess().getOptionAssignment_1(), "rule__FilterSpec__OptionAssignment_1"); put(grammarAccess.getFilterSpecAccess().getChainAssignment_2(), "rule__FilterSpec__ChainAssignment_2"); put(grammarAccess.getFilterSpecAccess().getProtocolAssignment_3_1(), "rule__FilterSpec__ProtocolAssignment_3_1"); put(grammarAccess.getFilterSpecAccess().getIpAssignment_4_1(), "rule__FilterSpec__IpAssignment_4_1"); put(grammarAccess.getFilterSpecAccess().getInterfaceAssignment_5_1(), "rule__FilterSpec__InterfaceAssignment_5_1"); put(grammarAccess.getFilterSpecAccess().getIpDstAssignment_6_1(), "rule__FilterSpec__IpDstAssignment_6_1"); put(grammarAccess.getFilterSpecAccess().getSourcePortAssignment_7_1(), "rule__FilterSpec__SourcePortAssignment_7_1"); put(grammarAccess.getFilterSpecAccess().getDestinationPortAssignment_8_1(), "rule__FilterSpec__DestinationPortAssignment_8_1"); put(grammarAccess.getFilterSpecAccess().getNegAssignment_9(), "rule__FilterSpec__NegAssignment_9"); put(grammarAccess.getFilterSpecAccess().getSynAssignment_10(), "rule__FilterSpec__SynAssignment_10"); put(grammarAccess.getFilterSpecAccess().getMatchesAssignment_11_1(), "rule__FilterSpec__MatchesAssignment_11_1"); put(grammarAccess.getFilterSpecAccess().getStatesAssignment_12_1(), "rule__FilterSpec__StatesAssignment_12_1"); put(grammarAccess.getFilterSpecAccess().getStatesAssignment_12_2_1(), "rule__FilterSpec__StatesAssignment_12_2_1"); put(grammarAccess.getFilterSpecAccess().getDirAssignment_13_1(), "rule__FilterSpec__DirAssignment_13_1"); put(grammarAccess.getFilterSpecAccess().getStatusAssignment_14_1(), "rule__FilterSpec__StatusAssignment_14_1"); put(grammarAccess.getFilterSpecAccess().getStatesAssignment_15_1(), "rule__FilterSpec__StatesAssignment_15_1"); put(grammarAccess.getFilterSpecAccess().getStatesAssignment_15_2_1(), "rule__FilterSpec__StatesAssignment_15_2_1"); put(grammarAccess.getFilterSpecAccess().getExamFlagsAssignment_16_1(), "rule__FilterSpec__ExamFlagsAssignment_16_1"); put(grammarAccess.getFilterSpecAccess().getExamFlagsAssignment_16_2_1(), "rule__FilterSpec__ExamFlagsAssignment_16_2_1"); put(grammarAccess.getFilterSpecAccess().getFlagsAssignment_16_3(), "rule__FilterSpec__FlagsAssignment_16_3"); put(grammarAccess.getFilterSpecAccess().getFlagsAssignment_16_4_1(), "rule__FilterSpec__FlagsAssignment_16_4_1"); put(grammarAccess.getFilterSpecAccess().getTargetAssignment_18(), "rule__FilterSpec__TargetAssignment_18"); put(grammarAccess.getFilterSpecAccess().getLpAssignment_19_1(), "rule__FilterSpec__LpAssignment_19_1"); put(grammarAccess.getInterfaceAccess().getNameAssignment(), "rule__Interface__NameAssignment"); put(grammarAccess.getLPAccess().getNameAssignment(), "rule__LP__NameAssignment"); put(grammarAccess.getMatchAccess().getNameAssignment(), "rule__Match__NameAssignment"); put(grammarAccess.getStateAccess().getNameAssignment(), "rule__State__NameAssignment"); put(grammarAccess.getTCPFlagAccess().getNameAssignment(), "rule__TCPFlag__NameAssignment"); put(grammarAccess.getChainAccess().getChainNameAssignment(), "rule__Chain__ChainNameAssignment"); put(grammarAccess.getCustomChainAccess().getNameAssignment(), "rule__CustomChain__NameAssignment"); put(grammarAccess.getChainNameAccess().getNameAssignment(), "rule__ChainName__NameAssignment"); } }; } return nameMappings.get(element); } @Override protected Collection<FollowElement> getFollowElements(AbstractInternalContentAssistParser parser) { try { org.xtext.example.iptables.ui.contentassist.antlr.internal.InternalIptablesParser typedParser = (org.xtext.example.iptables.ui.contentassist.antlr.internal.InternalIptablesParser) parser; typedParser.entryRuleModel(); return typedParser.getFollowElements(); } catch(RecognitionException ex) { throw new RuntimeException(ex); } } @Override protected String[] getInitialHiddenTokens() { return new String[] { "RULE_WS", "RULE_ML_COMMENT", "RULE_SL_COMMENT" }; } public IptablesGrammarAccess getGrammarAccess() { return this.grammarAccess; } public void setGrammarAccess(IptablesGrammarAccess grammarAccess) { this.grammarAccess = grammarAccess; } }
[ "joaquim.garcia@gmail.com" ]
joaquim.garcia@gmail.com
9ca50af1a754ca89aeb80548e8c343639bb8b5d9
5575391dc7225e2b399904eb7c6f64e01078a8f7
/RemoteSystemsTempFiles/GaoXiaoXiaoMing/RemoteSystemsTempFiles/src/com/xiaoming/domain/Message.java
1749ce7d7f0e6e09ec873c9c5db62f552412ce0d
[]
no_license
GarvenZhang/GaoxiaoXiaoming
79c83e5d28610fdc2cf16056aa0da7c5e9229994
1454d51eb64e201b778012a462ccdce0904be7a7
refs/heads/master
2021-01-22T03:33:19.338501
2017-05-25T11:33:07
2017-05-25T11:37:57
92,386,819
0
0
null
null
null
null
UTF-8
Java
false
false
1,973
java
package com.xiaoming.domain; import java.util.Date; import java.util.Set; /** * 通知类 * * @author LiuRui * */ public class Message { /** * 主键 */ private Long id; /** * 通知内容 */ private String content; /** * 创建时间 */ private Date publishTime; /** * 最后更新的时间 */ private Date updateTime; /** * 创建者 */ private Member publisher; /** * 是否刪除了 */ private Boolean deleted; /** * 用户阅读情况 */ private Set<UsersMessage> usersMessage; /** * @return the id */ public Long getId() { return id; } /** * @param id * the id to set */ public void setId(Long id) { this.id = id; } /** * @return the content */ public String getContent() { return content; } /** * @param content * the content to set */ public void setContent(String content) { this.content = content; } /** * @return the publishTime */ public Date getPublishTime() { return publishTime; } /** * @param publishTime * the publishTime to set */ public void setPublishTime(Date publishTime) { this.publishTime = publishTime; } /** * @return the publisher */ public Member getPublisher() { return publisher; } /** * @param publisher * the publisher to set */ public void setPublisher(Member publisher) { this.publisher = publisher; } /** * @return the usersMessage */ public Set<UsersMessage> getUsersMessage() { return usersMessage; } /** * @param usersMessage * the usersMessage to set */ public void setUsersMessage(Set<UsersMessage> usersMessage) { this.usersMessage = usersMessage; } public Date getUpdateTime() { return updateTime; } public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } public Boolean getDeleted() { return deleted; } public void setDeleted(Boolean deleted) { this.deleted = deleted; } }
[ "jf00258jf@hotmail.com" ]
jf00258jf@hotmail.com
2c7fab7da0b66aff86667a907b2092abc0280d4d
b2d27de9dc18a2f4b7c64ccd2b7bd31628a545ae
/src/main/java/kwikdesk/partner/api/ChannelResult.java
a41d1e12fd91feeb871d0e9d6e4f55f7793f18cd
[ "MIT" ]
permissive
chico/kwikdesk-partner-java
2d309791400680e74810184bb210fa78ad330dc7
454fd330b05a94286d06f2d95a8614e1b85c20ae
refs/heads/master
2021-01-22T11:46:27.208680
2014-03-27T21:11:40
2014-03-27T21:11:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,043
java
/* Copyright (c) 2014 Chico Charlesworth, MIT License */ package kwikdesk.partner.api; import java.io.Serializable; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; public class ChannelResult implements Serializable { private static final long serialVersionUID = 1L; private String content; private Integer createdAt; private Integer expires; public String getContent() { return content; } public void setContent(String content) { this.content = content; } public Integer getCreatedAt() { return createdAt; } public void setCreatedAt(Integer createdAt) { this.createdAt = createdAt; } public Integer getExpires() { return expires; } public void setExpires(Integer expires) { this.expires = expires; } @Override public boolean equals(Object obj) { return EqualsBuilder.reflectionEquals(this, obj); } @Override public int hashCode() { return HashCodeBuilder.reflectionHashCode(this); } }
[ "chico.charlesworth@googlemail.com" ]
chico.charlesworth@googlemail.com
df4399b152e0c5d34909326e428ec05c0dfa5d04
7ed4e65b24224bbed18788dfc44be7d883713091
/src/TrajectoryOptimiser.java
9d184890b5f487f76c2c04b4ae25ba6f25d37fe6
[]
no_license
jakeywatson/spacecraft_trajectory
3479b39c71528612b425ee753ea5a5df1399f3a6
c73da46cc400dbf5abfac0bb9743f8654e54c499
refs/heads/master
2023-04-03T17:55:05.737840
2021-04-16T11:16:56
2021-04-16T11:16:56
358,573,383
0
0
null
null
null
null
UTF-8
Java
false
false
1,867
java
import java.io.*; public class TrajectoryOptimiser { public static void main(String [] args) throws IOException { Console console = System.console(); int end_year = console.readLine("Enter the end year of the period to be considered: \n"); end_year = DateHandler.daysBetween(end_year); //Instantiate trajectories with randomised values List<Trajectory> trajectories = new List<Trajectory>(); for (int i = 0; i < 100; i++){ trajectories.add(new Trajectory(end_year)); } //Generate Ephemerides Ephemerides ephemerides = new Ephemerides(end_year, 1); //Set vectors of start position and end position for each trajectory from ephemerides for (int i = 0; i < 100; i++){ double start_date = trajectories.get(i).getStart_Date(); Vector3D start_position = ephemerides.getEarthEphemerides(start_date); trajectories.get(i).setStart_Position(start_position); double end_date = trajectories.get(i).getEnd_Date(); Vector3D end_position = ephemerides.getMarsEphemerides(end_date); trajectories.get(i).setEnd_Position(end_position); } //Use Lambert Solver to find start/end velocities for (int i = 0; i < 100; i++){ List<Vector3D> v_pos = LambertSolver.solve(trajectories.get(i), 1); List<Vector3D> v_neg = LambertSolver.solve(trajectories.get(i), -1); if (vpos.get(0) = 0 && vneg.get(0) = 0){ } else { double deltaV = FindDeltaV.solve(ephemerides, trajectories.get(i), v_pos, v_neg); trajectories.get(i).setDeltaV(deltaV); } } //Output to file Filewriter fileWriter = new Filewriter("Trajectories.txt"); PrintWriter printWriter = new PrintWriter(fileWriter); for (int i = 0; i < 100; i++){ printWriter.print("%s %d %.6f\n", DateHandler.outputDate(trajectories.get(i).getStart_Date()), trajectories(i).getDuration(), trajectories(i).getDeltaV); } } } }
[ "jakeywatson@googlemail.com" ]
jakeywatson@googlemail.com
432b8a07cd7c84da211acf7a1a3a32e53b73f5f8
503712c1b63c7225d0abdd6c376d971fc4c8ab74
/31_maven/src/main/java/examples/LoggerInterface.java
7e2d2116fdd48acb34cafba05770e056e08fd9ec
[]
no_license
saschalippert/java_demo
f5e9d4d7af3b19b769f7b235fc34cc13e1a81984
af3653653276bd95f33e5fc4d0b0e3efdadf1554
refs/heads/master
2022-02-13T09:54:19.782389
2020-05-07T12:03:14
2020-05-07T12:03:14
251,525,333
0
5
null
2022-02-10T03:00:35
2020-03-31T07:01:54
Java
UTF-8
Java
false
false
82
java
package examples; public interface LoggerInterface { void print(String text); }
[ "sascha.lippert@gmail.com" ]
sascha.lippert@gmail.com
2aa1495bfa1286308a6c494fd83af3bf57e265db
119726b8c9aac41b7486524de1daa54e3a32d133
/app/src/main/java/ir/taghizadeh/dagger2/di/scope/TvShowsActivityScope.java
d7746015ae19cf1429e0ce0a4f02fecda3984357
[ "Apache-2.0" ]
permissive
ali-taghizadeh/Dagger2
b9b1d4ac22933797515610a0422e278f8c6da12c
e9ad1805c977b07cb09223588fa9b28cfde3cb7b
refs/heads/master
2020-04-09T05:43:10.029091
2018-12-04T17:13:31
2018-12-04T17:13:31
160,076,153
1
0
null
null
null
null
UTF-8
Java
false
false
119
java
package ir.taghizadeh.dagger2.di.scope; import javax.inject.Scope; @Scope public @interface TvShowsActivityScope { }
[ "ali.taghizadeh@outlook.com" ]
ali.taghizadeh@outlook.com
fa8e61e110599005faa406a54adf08d318b0a1b9
15ac9096b6a9f6dff84657de62dfd1b6d72f542d
/src/test/java/com/stroganova/ioc/service/SomeService.java
9cbca77cb255b3eba73a460e4d274bee97f37f2a
[]
no_license
alyoona/ioc
21d251a9a79a6a04fff6c95c98f466f8dfd6eb01
d8ea9f86a83e7777055346af2d2052e34a3a868e
refs/heads/master
2020-04-05T17:13:06.453529
2018-11-27T22:07:04
2018-11-27T22:07:04
157,049,708
0
0
null
null
null
null
UTF-8
Java
false
false
68
java
package com.stroganova.ioc.service; public class SomeService { }
[ "alenastr12@gmail.com" ]
alenastr12@gmail.com
1310b5556f5eedfd13d7df31613f97db04bb634f
588c9edb773b6b4af679c207ea7d634923d1e77f
/app/src/androidTest/java/com/example/android/adventurersofarldem/ExampleInstrumentedTest.java
76086cc7857bec21405c65899e87a7d11e46f2d2
[]
no_license
MrRisca/AdventurersofArldem-master
7e4eb5f3e9c77ce8c17052d98af62e77cfc32dbc
7547911b3342d5bf777a0e67de960c80ed828171
refs/heads/master
2021-06-21T21:35:24.943870
2020-12-04T15:42:39
2020-12-04T15:42:39
148,704,434
0
1
null
2020-12-04T15:42:40
2018-09-13T22:19:01
Java
UTF-8
Java
false
false
762
java
package com.example.android.adventurersofarldem; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.example.android.adventurersofarldem", appContext.getPackageName()); } }
[ "mormegil@hotmail.co.uk" ]
mormegil@hotmail.co.uk
630d1c22bd4ec2874fe7bc4fe274b6ad7e1f9c51
4c8e87b9ac5bc76d22c16cdabe178e09f65c059c
/253LoggerSDK/src/edu/aub/cmps253/loggers/sdk/LoggingLevel.java
16b99cc9e735f9cdb48693ea5d3e7de17206eab1
[]
no_license
AUB-CMPS/cmps253
8649c06c3bf1d43a96b06c907a3c1588bc3768d3
925f23cd27acf716300184c4811fca61f25df549
refs/heads/master
2021-01-20T03:46:08.801825
2017-04-27T09:51:43
2017-04-27T09:51:43
89,579,966
1
0
null
null
null
null
UTF-8
Java
false
false
120
java
package edu.aub.cmps253.loggers.sdk; public enum LoggingLevel { All, Severe, Error, Warning, Info, Off }
[ "noreply@github.com" ]
noreply@github.com
8c4feabef908d688eb79adff8495e37d54f26630
fa1408365e2e3f372aa61e7d1e5ea5afcd652199
/src/testcases/CWE643_Xpath_Injection/CWE643_Xpath_Injection__Environment_66b.java
2789f7b992bc7e82c82cc154c6725709d3cdc92a
[]
no_license
bqcuong/Juliet-Test-Case
31e9c89c27bf54a07b7ba547eddd029287b2e191
e770f1c3969be76fdba5d7760e036f9ba060957d
refs/heads/master
2020-07-17T14:51:49.610703
2019-09-03T16:22:58
2019-09-03T16:22:58
206,039,578
1
2
null
null
null
null
UTF-8
Java
false
false
5,625
java
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE643_Xpath_Injection__Environment_66b.java Label Definition File: CWE643_Xpath_Injection.label.xml Template File: sources-sinks-66b.tmpl.java */ /* * @description * CWE: 643 Xpath Injection * BadSource: Environment Read data from an environment variable * GoodSource: A hardcoded string * Sinks: * GoodSink: validate input through StringEscapeUtils * BadSink : user input is used without validate * Flow Variant: 66 Data flow: data passed in an array from one method to another in different source files in the same package * * */ package testcases.CWE643_Xpath_Injection; import testcasesupport.*; import javax.servlet.http.*; import javax.xml.xpath.*; import org.xml.sax.InputSource; import org.apache.commons.lang.StringEscapeUtils; public class CWE643_Xpath_Injection__Environment_66b { public void badSink(String dataArray[] ) throws Throwable { String data = dataArray[2]; String xmlFile = null; if(System.getProperty("os.name").toLowerCase().indexOf("win") >= 0) { /* running on Windows */ xmlFile = "\\src\\testcases\\CWE643_Xpath Injection\\CWE643_Xpath_Injection__Helper.xml"; } else { /* running on non-Windows */ xmlFile = "./src/testcases/CWE643_Xpath Injection/CWE643_Xpath_Injection__Helper.xml"; } if (data != null) { /* assume username||password as source */ String [] tokens = data.split("||"); if (tokens.length < 2) { return; } String username = tokens[0]; String password = tokens[1]; /* build xpath */ XPath xPath = XPathFactory.newInstance().newXPath(); InputSource inputXml = new InputSource(xmlFile); /* INCIDENTAL: CWE180 Incorrect Behavior Order: Validate Before Canonicalize * The user input should be canonicalized before validation. */ /* POTENTIAL FLAW: user input is used without validate */ String query = "//users/user[name/text()='" + username + "' and pass/text()='" + password + "']" + "/secret/text()"; String secret = (String)xPath.evaluate(query, inputXml, XPathConstants.STRING); } } /* goodG2B() - use goodsource and badsink */ public void goodG2BSink(String dataArray[] ) throws Throwable { String data = dataArray[2]; String xmlFile = null; if(System.getProperty("os.name").toLowerCase().indexOf("win") >= 0) { /* running on Windows */ xmlFile = "\\src\\testcases\\CWE643_Xpath Injection\\CWE643_Xpath_Injection__Helper.xml"; } else { /* running on non-Windows */ xmlFile = "./src/testcases/CWE643_Xpath Injection/CWE643_Xpath_Injection__Helper.xml"; } if (data != null) { /* assume username||password as source */ String [] tokens = data.split("||"); if (tokens.length < 2) { return; } String username = tokens[0]; String password = tokens[1]; /* build xpath */ XPath xPath = XPathFactory.newInstance().newXPath(); InputSource inputXml = new InputSource(xmlFile); /* INCIDENTAL: CWE180 Incorrect Behavior Order: Validate Before Canonicalize * The user input should be canonicalized before validation. */ /* POTENTIAL FLAW: user input is used without validate */ String query = "//users/user[name/text()='" + username + "' and pass/text()='" + password + "']" + "/secret/text()"; String secret = (String)xPath.evaluate(query, inputXml, XPathConstants.STRING); } } /* goodB2G() - use badsource and goodsink */ public void goodB2GSink(String dataArray[] ) throws Throwable { String data = dataArray[2]; String xmlFile = null; if(System.getProperty("os.name").toLowerCase().indexOf("win") >= 0) { /* running on Windows */ xmlFile = "\\src\\testcases\\CWE643_Xpath Injection\\CWE643_Xpath_Injection__Helper.xml"; } else { /* running on non-Windows */ xmlFile = "./src/testcases/CWE643_Xpath Injection/CWE643_Xpath_Injection__Helper.xml"; } if (data != null) { /* assume username||password as source */ String [] tokens = data.split("||"); if( tokens.length < 2 ) { return; } /* FIX: validate input using StringEscapeUtils */ String username = StringEscapeUtils.escapeXml(tokens[0]); String password = StringEscapeUtils.escapeXml(tokens[1]); /* build xpath */ XPath xPath = XPathFactory.newInstance().newXPath(); InputSource inputXml = new InputSource(xmlFile); String query = "//users/user[name/text()='" + username + "' and pass/text()='" + password + "']" + "/secret/text()"; String secret = (String)xPath.evaluate(query, inputXml, XPathConstants.STRING); } } }
[ "bqcuong2212@gmail.com" ]
bqcuong2212@gmail.com
f93e3f68975978246382de5dbd9c42555208f403
c1b417a2dc4bf1643f72f9e8ef46757e197b8810
/BegToDiffer/Word.java
ba51ca098f1bdbbb96fda9f29bed50c41affd013
[]
no_license
Tanner/Newsbox
815174cbe700ab7ea36ae92c8c24d42bf750ebd4
c40c0899cd8edf6edd3cf26334e9e8a42e3c72e0
refs/heads/master
2021-05-01T04:44:11.636931
2011-02-09T07:12:39
2011-02-09T07:12:39
1,260,684
0
0
null
null
null
null
UTF-8
Java
false
false
2,217
java
/** * The Word class. * * Represents a word (usually in the English language) and a value. The value is an integer that can represent anything a integer can represent. * * @author Tanner Smith and Ryan Ashcraft */ public class Word implements Comparable { private String word = ""; private int value = 0; /** * Create a new Word with the given word value. * @param word Word value. */ public Word(String word) { //Some pre-processing things to do before we set the field variable word = word.toLowerCase(); word = word.replaceAll("\\W", ""); this.word = word; } /** * Create a new Word with the given word value and value. * @param word Word value. * @param value Value value (confusing, eh?). */ public Word(String word, int value) { this(word); setValue(value); } /** * Set the value of this word to a given value. * @param value New value to set this word to. */ public void setValue(int value) { this.value = value; } /** * Gets the value of the value. * @return The value. */ public int getValue() { return value; } /** * Get the word that this Word represents. * @return The Word's word (more confusion). */ public String getWord() { return word; } /* (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) */ public boolean equals(Object o) { if (o instanceof Word) { Word objectWord = (Word)o; return objectWord.word.equals(word); } else if (o instanceof String) { String objectString = (String)o; return objectString.equals(word); } return false; } /* (non-Javadoc) * @see java.lang.Object#toString() */ public String toString() { return word+" ("+value+")"; } /* (non-Javadoc) * @see java.lang.Comparable#compareTo(java.lang.Object) */ public int compareTo(Object o) { //Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object. if (o instanceof Word) { Word comparisonWord = (Word)o; if (value < comparisonWord.value) { return 1; } else if (value > comparisonWord.value) { return -1; } else { return 0; } } else { return -1; } } }
[ "tanner@tssoftware.net" ]
tanner@tssoftware.net
2d7bb395c4ff107e30e8d9217bba0de4ae8c5ca3
75ab502990dcae6ae88f36f9261f4d5de2c12d52
/src/lezioni/enumerated/OverrideConstantSpecific.java
192df19c62fad826d455c99a5487d2a299457a87
[]
no_license
aguero90/JAVA_TLP
cb0d9dc4b39484bebe2411b633e481a055ab29b4
9802de8db38e8d26e797040bcd69f1ed2f1b876b
refs/heads/master
2021-01-18T14:02:13.241978
2015-03-15T19:21:18
2015-03-15T19:21:18
32,279,186
2
0
null
null
null
null
UTF-8
Java
false
false
500
java
package enumerated; //: enumerated/OverrideConstantSpecific.java import static net.mindview.util.Print.*; public enum OverrideConstantSpecific { NUT, BOLT, WASHER { void f() { print("Overridden method"); } }; void f() { print("default behavior"); } public static void main(String[] args) { for(OverrideConstantSpecific ocs : values()) { printnb(ocs + ": "); ocs.f(); } } } /* Output: NUT: default behavior BOLT: default behavior WASHER: Overridden method *///:~
[ "a.univaq@hotmail.it" ]
a.univaq@hotmail.it
8fbf13a5995093a868f42a9df96ee09db2009e17
d6bb0bc1c522554b1e2a0a7916b3f533d5551c64
/app/src/main/java/com/example/gymmanagment/ProfileActivity.java
7aeba7a142b35dd210c97ffe5767c33170096268
[]
no_license
Galib24/GYMMANAGMENT
411f7be581bf83555496c39a910f2dc587ff8d88
937c0f8b4685ea9998cd3d37dc9475cac6b59f3b
refs/heads/master
2023-07-28T01:57:05.789346
2021-09-14T03:14:18
2021-09-14T03:14:18
406,206,686
1
0
null
null
null
null
UTF-8
Java
false
false
2,495
java
package com.example.gymmanagment; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; import com.google.android.gms.dynamic.IFragmentWrapper; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; public class ProfileActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_profile); Button logout = (Button) findViewById(R.id.Logout); logout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { FirebaseAuth.getInstance().signOut(); startActivity(new Intent(ProfileActivity.this,MainActivity.class)); } }); FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser(); DatabaseReference reference = FirebaseDatabase.getInstance().getReference("users"); String userID = user.getUid(); final TextView fullnamebtnTextView =(TextView) findViewById(R.id.fullnamebtn); final TextView EmailbtntnTextView =(TextView) findViewById(R.id.Emailbtn); final TextView AgeTextView =(TextView) findViewById(R.id.Agebtn); reference.child(userID).addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot snapshot) { user userProfile =snapshot.getValue(user.class); if (userProfile !=null){ String fullname = userProfile.fullName; String Emailbtn = userProfile.email; String age = userProfile.age; fullnamebtnTextView.setText(fullname); EmailbtntnTextView.setText(Emailbtn); AgeTextView.setText(age); } } @Override public void onCancelled(@NonNull DatabaseError error) { Toast.makeText(ProfileActivity.this,"Something Wrong Happened",Toast.LENGTH_LONG).show(); } }); } }
[ "abuyeahia24@gmail.com" ]
abuyeahia24@gmail.com
272ad3526058a8b5e403086fd5e9b705524cb2ca
e3e036e421b00810aa5d8f72b0705615e70a1022
/src/servlets/CadastrarUsuario.java
79157d607a328d291908425bf2198711e651383c
[]
no_license
marceloUSJT/TasksManager
240c6d4338527e21dbdae9984b713b99b0a18edd
8347693493890387bdcc37598f5f670ed32569e1
refs/heads/master
2022-07-12T18:37:01.938562
2020-05-14T01:49:06
2020-05-14T01:49:06
263,788,066
0
0
null
null
null
null
ISO-8859-1
Java
false
false
1,234
java
package servlets; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import model.Usuario; import service.UsuarioService; @WebServlet("/CadastrarUsuario.do") public class CadastrarUsuario extends HttpServlet { private static final long serialVersionUID = 1L; public CadastrarUsuario() { super(); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter saida = response.getWriter(); saida.println("Você precisa passar pelo formulário primeiro!"); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String email = request.getParameter("email"); String nome = request.getParameter("nome"); String senha = request.getParameter("senha"); Usuario usuario = new Usuario(email, nome, senha); UsuarioService service = new UsuarioService(); service.cadastrarUsuario(usuario); response.sendRedirect("./jsp/login.jsp"); } }
[ "marcelo.s01@hotmail.com" ]
marcelo.s01@hotmail.com
82b60be21700e8c19f58e6ed958f0ea898fbdec1
9a024b64f20c4fda4d73b2d32c949d81a40d3902
/seltaf/src/com/aqm/staf/library/databin/Exten2DetailsMiscEntity.java
61ddb8ca2b7008b0b0b4eeb45ba84c032559f060
[]
no_license
Khaire/NIA
1d25a8f66761a8ca024b05417a73b9d82b3acd28
876d5d1a5fe4f9953bd1d0ef8911ffc8aafa16b6
refs/heads/master
2022-12-01T01:40:40.690861
2019-05-24T06:25:14
2019-05-24T06:25:14
188,364,339
0
0
null
2022-11-24T06:12:23
2019-05-24T06:22:50
Java
UTF-8
Java
false
false
230
java
package com.aqm.staf.library.databin; public class Exten2DetailsMiscEntity extends GenericEntity{ public Exten2DetailsMiscEntity() { super("Exten2DetailsMiscEntity"); // TODO Auto-generated constructor stub } }
[ "Temp@AQMIT-DSK-10231" ]
Temp@AQMIT-DSK-10231
152dce507294060efb8ba924d526a639f196a4f2
611093b4a6b6a8d0a79482d091de9e0304cc0071
/4/exercises/Ex_435.java
48dcf83caf5db79b0b16c6dbe2b1a6ce239fae14
[]
no_license
markediez/LearningJava
7339ec04d25c60bb3e8aed1fa488fc101faa274e
7c5d8573b81ef79321930d56ae280e6e15d0675a
refs/heads/master
2020-04-13T16:09:20.904820
2016-01-09T18:50:24
2016-01-09T18:50:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
981
java
/* * Author: Mark Diez * Date: 25 Nov 2015 * Exericse 4.35 * Decides whether 3 lengths can make a triangle */ import java.util.Scanner; public class Ex_435 { public static void main(String[] args) { Scanner scn = new Scanner(System.in); System.out.print("Enter first integer: "); int s1 = scn.nextInt(); System.out.print("Enter second integer: "); int s2 = scn.nextInt(); System.out.print("Enter third integer: "); int s3 = scn.nextInt(); System.out.printf("Integers entered are: %d %d %d%n", s1, s2, s3); boolean triangle = true; if ((s1 + s2) < s3) triangle = false; if ((s1 + s3) < s2) triangle = false; if ((s2 + s3) < s1) triangle = false; if (triangle == true) { System.out.println("It makes a triangle!"); } else { System.out.println("It doesn't make a triangle!"); } } }
[ "markediez@gmail.com" ]
markediez@gmail.com
a4e3fe66f53077ddac9b4e63f8de504ca8882741
31699a39d2fe1c53dd13eed68d26877d1c16fd5a
/core/src/states/GameStateManager.java
ff393d754ab770ca09bf95c437fef636e5e9ed21
[]
no_license
shabab477/FlappyBirdClone
5425ee6de8bf910fe4e02487b51d6fc136bb95c0
b9c2afca0936d0c5304780342b087a2829ca05f7
refs/heads/master
2021-01-19T06:03:20.796488
2016-07-06T21:54:57
2016-07-06T21:54:57
62,755,197
0
0
null
null
null
null
UTF-8
Java
false
false
702
java
package states; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import java.util.Stack; /** * Created by Shabab on 7/5/2016. */ public class GameStateManager { private Stack<State> stackStates; public GameStateManager() { stackStates = new Stack<State>(); } public void push(State state) { stackStates.push(state); } public void pop() { stackStates.pop(); } public void setState(State state) { pop(); push(state); } public void update(float dt) { stackStates.peek().update(dt); } public void render(SpriteBatch batch) { stackStates.peek().render(batch); } }
[ "shababkarim93@gmail.com" ]
shababkarim93@gmail.com
7c68e1240d21a1694443e5dc036e01ad94d7b5f4
5857d4709dd4d1e03dcc103b280bfd8e6c0daafa
/src/main/java/ru/sewaiper/smokehouse/model/tobacco/TobaccoManufacturer.java
364da36d1ad64d0ca8224773a1e9bd868ce38793
[]
no_license
sewaiper/QR-Smoke-house
cdd4003c52146050572de63db51c23e1f68a5e69
c87bf0fb14fd3c5d7656cd8aa09127d9a15aca54
refs/heads/master
2023-04-27T13:40:57.458017
2021-05-19T17:36:25
2021-05-19T17:36:25
363,738,242
0
0
null
null
null
null
UTF-8
Java
false
false
792
java
package ru.sewaiper.smokehouse.model.tobacco; import javax.persistence.*; import java.util.Collection; @Entity @Table(name = "tobacco_manufacturer") public class TobaccoManufacturer { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) protected long id; @Basic @Access(AccessType.PROPERTY) @Column(name = "name") protected String name; @OneToMany(mappedBy = "manufacturer", fetch = FetchType.LAZY, cascade = CascadeType.ALL) protected Collection<Tobacco> tobaccos; public long getId() { return id; } public String getName() { return name; } public void setName(String name) { this.name = name; } @Override public String toString() { return "manufacturer='" + name + "'"; } }
[ "sewaiper@bk.ru" ]
sewaiper@bk.ru
2438d9c213270b10e9cebcf5277e627cd155c798
292f32c89b247eea59449ed227ced92969bcd813
/.svn/pristine/24/2438d9c213270b10e9cebcf5277e627cd155c798.svn-base
2c596b8731bc233195bf0655200acb1736844296
[]
no_license
orchid0809/bjbxtest
b0b57e0b1c86ae0cfe227d57529ca9f43e254feb
2580ea18d49fbda5e5dab2b124050103aa79c1bf
refs/heads/master
2020-12-25T11:06:07.921381
2016-07-21T09:30:39
2016-07-21T09:30:39
63,856,092
0
0
null
null
null
null
UTF-8
Java
false
false
19,239
package com.shopping.foundation.domain; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import java.util.TreeSet; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.JoinTable; import javax.persistence.ManyToMany; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.OneToOne; import javax.persistence.Table; import javax.persistence.Transient; import org.apache.commons.lang.StringUtils; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import org.springframework.security.GrantedAuthority; import org.springframework.security.GrantedAuthorityImpl; import org.springframework.security.userdetails.UserDetails; import com.shopping.core.annotation.Lock; import com.shopping.core.domain.IdEntity; @Cache(usage = CacheConcurrencyStrategy.READ_WRITE) @Entity @Table(name = "shopping_user") public class User extends IdEntity implements UserDetails { private static final long serialVersionUID = 8026813053768023527L; // 用户名 private String userName; // 真实名称 private String trueName; // 密码 @Lock private String password; // 用户角色 private String userRole; // 生日 private Date birthday; // 电话 private String telephone; private String QQ; private String WW; // 年龄 @Column(columnDefinition = "int default 0") private int years; private String MSN; // 地址 private String address; // 性别 private int sex; // 有限 private String email; private String mobile; // 照片 @OneToOne private Accessory photo; // 地区 @OneToOne private Area area; // 状态 private int status; //会员等级(0-注册级别,1-铜牌会员,2-银牌会员,3-金牌会员) @Column(name = "rank", columnDefinition = "int default 0") private int rank; // 角色 @ManyToMany(targetEntity = Role.class, fetch = FetchType.LAZY) @JoinTable(name = "shopping_user_role", joinColumns = { @javax.persistence.JoinColumn(name = "user_id") }, inverseJoinColumns = { @javax.persistence.JoinColumn(name = "role_id") }) private Set<Role> roles = new TreeSet(); // 角色资源 @Transient private Map<String, List<Res>> roleResources; // 上次登录时间 private Date lastLoginDate; // 登录时间 private Date loginDate; // 上次登录IP private String lastLoginIp; // 登录IP private String loginIp; // 登录次数 private int loginCount; // 报道 private int report; @Lock @Column(precision = 12, scale = 2) private BigDecimal availableBalance; @Lock @Column(precision = 12, scale = 2) private BigDecimal freezeBlance; @Lock private int integral; // 金币 @Lock private int gold; // 配置 @OneToOne(mappedBy = "user") private UserConfig config; // 文件附件 @OneToMany(mappedBy = "user") private List<Accessory> files = new ArrayList(); // 商店 @OneToOne(cascade = { javax.persistence.CascadeType.REMOVE }) private Store store; // 工厂 @OneToOne(cascade = { javax.persistence.CascadeType.REMOVE }) private Storefactory factory; // 父用户 @ManyToOne private User parent; // 子用户 @OneToMany(mappedBy = "parent") private List<User> childs = new ArrayList(); // 用户信用 @Lock private int user_credit; @Transient private GrantedAuthority[] authorities = new GrantedAuthority[0]; private String qq_openid; private String sina_openid; // 商店快捷菜单 @Column(columnDefinition = "LongText") private String store_quick_menu; @OneToMany(mappedBy = "pd_user", cascade = { javax.persistence.CascadeType.REMOVE }) private List<Predeposit> posits = new ArrayList(); @OneToMany(mappedBy = "pd_log_user", cascade = { javax.persistence.CascadeType.REMOVE }) private List<PredepositLog> user_predepositlogs = new ArrayList(); @OneToMany(mappedBy = "pd_log_admin", cascade = { javax.persistence.CascadeType.REMOVE }) private List<PredepositLog> admin_predepositlogs = new ArrayList(); // 地址 @OneToMany(mappedBy = "user", cascade = { javax.persistence.CascadeType.REMOVE }) private List<Address> addrs = new ArrayList(); // 相册 @OneToMany(mappedBy = "user", cascade = { javax.persistence.CascadeType.REMOVE }) private List<Album> albums = new ArrayList(); // 最喜欢 @OneToMany(mappedBy = "user", cascade = { javax.persistence.CascadeType.REMOVE }) private List<Favorite> favs = new ArrayList(); // 用户商品类型 @OneToMany(mappedBy = "user", cascade = { javax.persistence.CascadeType.REMOVE }) private List<UserGoodsClass> ugcs = new ArrayList(); // 来源信息 @OneToMany(mappedBy = "fromUser", cascade = { javax.persistence.CascadeType.REMOVE }) private List<Message> from_msgs = new ArrayList(); // 目标信息 @OneToMany(mappedBy = "toUser", cascade = { javax.persistence.CascadeType.REMOVE }) private List<Message> to_msgs = new ArrayList(); // 金币记录 @OneToMany(mappedBy = "gold_user", cascade = { javax.persistence.CascadeType.REMOVE }) private List<GoldRecord> gold_record = new ArrayList(); // 金币记录管理 @OneToMany(mappedBy = "gold_admin", cascade = { javax.persistence.CascadeType.REMOVE }) private List<GoldRecord> gold_record_admin = new ArrayList(); @OneToMany(mappedBy = "integral_user", cascade = { javax.persistence.CascadeType.REMOVE }) private List<IntegralLog> integral_logs = new ArrayList(); @OneToMany(mappedBy = "operate_user", cascade = { javax.persistence.CascadeType.REMOVE }) private List<IntegralLog> integral_admin_logs = new ArrayList(); // 系统记录 @OneToMany(mappedBy = "user", cascade = { javax.persistence.CascadeType.REMOVE }) private List<SysLog> syslogs = new ArrayList(); @OneToMany(mappedBy = "user", cascade = { javax.persistence.CascadeType.REMOVE }) private List<Accessory> accs = new ArrayList(); // 订单表 @OneToMany(mappedBy = "user", cascade = { javax.persistence.CascadeType.REMOVE }) private List<OrderForm> ofs = new ArrayList(); // 用户商议 @OneToMany(mappedBy = "consult_user", cascade = { javax.persistence.CascadeType.REMOVE }) private List<Consult> user_consults = new ArrayList(); // 商家商议 @OneToMany(mappedBy = "reply_user", cascade = { javax.persistence.CascadeType.REMOVE }) private List<Consult> seller_consults = new ArrayList(); // 商家评价 @OneToMany(mappedBy = "evaluate_seller_user", cascade = { javax.persistence.CascadeType.REMOVE }) private List<Evaluate> seller_evaluate = new ArrayList(); // 用户评价 @OneToMany(mappedBy = "evaluate_user", cascade = { javax.persistence.CascadeType.REMOVE }) private List<Evaluate> user_evaluate = new ArrayList(); // 订单记录 @OneToMany(mappedBy = "log_user", cascade = { javax.persistence.CascadeType.REMOVE }) private List<OrderFormLog> ofls = new ArrayList(); // 资源返还记录 @OneToMany(mappedBy = "refund_user", cascade = { javax.persistence.CascadeType.REMOVE }) private List<RefundLog> rls = new ArrayList(); // 闲置商品 @OneToMany(mappedBy = "user", cascade = { javax.persistence.CascadeType.REMOVE }) private List<SpareGoods> sgs = new ArrayList(); // 商品商标 @OneToMany(mappedBy = "user", cascade = { javax.persistence.CascadeType.REMOVE }) private List<GoodsBrand> brands = new ArrayList(); // 发送人 @OneToMany(mappedBy = "user", cascade = { javax.persistence.CascadeType.REMOVE }) private List<MessageBoard> send_send = new ArrayList(); // 接收人 @OneToMany(mappedBy = "user", cascade = { javax.persistence.CascadeType.REMOVE }) private List<MessageBoard> receive_mbs = new ArrayList(); public List<MessageBoard> getSend_send() { return send_send; } public void setSend_send(List<MessageBoard> send_send) { this.send_send = send_send; } public List<MessageBoard> getReceive_mbs() { return receive_mbs; } public void setReceive_mbs(List<MessageBoard> receive_mbs) { this.receive_mbs = receive_mbs; } public List<GoodsBrand> getBrands() { return this.brands; } public void setBrands(List<GoodsBrand> brands) { this.brands = brands; } public List<SpareGoods> getSgs() { return this.sgs; } public void setSgs(List<SpareGoods> sgs) { this.sgs = sgs; } public int getYears() { return this.years; } public void setYears(int years) { this.years = years; } public Area getArea() { return this.area; } public void setArea(Area area) { this.area = area; } public List<OrderFormLog> getOfls() { return this.ofls; } public void setOfls(List<OrderFormLog> ofls) { this.ofls = ofls; } public List<RefundLog> getRls() { return this.rls; } public void setRls(List<RefundLog> rls) { this.rls = rls; } public List<Evaluate> getSeller_evaluate() { return this.seller_evaluate; } public void setSeller_evaluate(List<Evaluate> seller_evaluate) { this.seller_evaluate = seller_evaluate; } public List<Evaluate> getUser_evaluate() { return this.user_evaluate; } public void setUser_evaluate(List<Evaluate> user_evaluate) { this.user_evaluate = user_evaluate; } public List<Consult> getUser_consults() { return this.user_consults; } public void setUser_consults(List<Consult> user_consults) { this.user_consults = user_consults; } public List<Consult> getSeller_consults() { return this.seller_consults; } public void setSeller_consults(List<Consult> seller_consults) { this.seller_consults = seller_consults; } public List<OrderForm> getOfs() { return this.ofs; } public void setOfs(List<OrderForm> ofs) { this.ofs = ofs; } public List<SysLog> getSyslogs() { return this.syslogs; } public void setSyslogs(List<SysLog> syslogs) { this.syslogs = syslogs; } public List<Accessory> getAccs() { return this.accs; } public void setAccs(List<Accessory> accs) { this.accs = accs; } public List<IntegralLog> getIntegral_logs() { return this.integral_logs; } public void setIntegral_logs(List<IntegralLog> integral_logs) { this.integral_logs = integral_logs; } public List<IntegralLog> getIntegral_admin_logs() { return this.integral_admin_logs; } public void setIntegral_admin_logs(List<IntegralLog> integral_admin_logs) { this.integral_admin_logs = integral_admin_logs; } public List<GoldRecord> getGold_record() { return this.gold_record; } public void setGold_record(List<GoldRecord> gold_record) { this.gold_record = gold_record; } public List<GoldRecord> getGold_record_admin() { return this.gold_record_admin; } public void setGold_record_admin(List<GoldRecord> gold_record_admin) { this.gold_record_admin = gold_record_admin; } public List<Message> getFrom_msgs() { return this.from_msgs; } public void setFrom_msgs(List<Message> from_msgs) { this.from_msgs = from_msgs; } public List<Message> getTo_msgs() { return this.to_msgs; } public void setTo_msgs(List<Message> to_msgs) { this.to_msgs = to_msgs; } public List<UserGoodsClass> getUgcs() { return this.ugcs; } public void setUgcs(List<UserGoodsClass> ugcs) { this.ugcs = ugcs; } public List<Favorite> getFavs() { return this.favs; } public void setFavs(List<Favorite> favs) { this.favs = favs; } public List<Album> getAlbums() { return this.albums; } public void setAlbums(List<Album> albums) { this.albums = albums; } public List<Address> getAddrs() { return this.addrs; } public void setAddrs(List<Address> addrs) { this.addrs = addrs; } public List<Predeposit> getPosits() { return this.posits; } public void setPosits(List<Predeposit> posits) { this.posits = posits; } public String getSina_openid() { return this.sina_openid; } public void setSina_openid(String sina_openid) { this.sina_openid = sina_openid; } public String getQq_openid() { return this.qq_openid; } public void setQq_openid(String qq_openid) { this.qq_openid = qq_openid; } public void setStore(Store store) { this.store = store; } public Date getLoginDate() { return this.loginDate; } public void setLoginDate(Date loginDate) { this.loginDate = loginDate; } public String getLastLoginIp() { return this.lastLoginIp; } public void setLastLoginIp(String lastLoginIp) { this.lastLoginIp = lastLoginIp; } public String getLoginIp() { return this.loginIp; } public void setLoginIp(String loginIp) { this.loginIp = loginIp; } public Date getLastLoginDate() { return this.lastLoginDate; } public void setLastLoginDate(Date lastLoginDate) { this.lastLoginDate = lastLoginDate; } public Date getBirthday() { return this.birthday; } public void setBirthday(Date birthday) { this.birthday = birthday; } public int getSex() { return this.sex; } public void setSex(int sex) { this.sex = sex; } public String getEmail() { return this.email; } public void setEmail(String email) { this.email = email; } public String getMobile() { return this.mobile; } public void setMobile(String mobile) { this.mobile = mobile; } public GrantedAuthority[] get_all_Authorities() { List grantedAuthorities = new ArrayList(this.roles.size()); for (Role role : this.roles) { grantedAuthorities .add(new GrantedAuthorityImpl(role.getRoleCode())); } return (GrantedAuthority[]) grantedAuthorities .toArray(new GrantedAuthority[this.roles.size()]); } public GrantedAuthority[] get_common_Authorities() { List grantedAuthorities = new ArrayList(this.roles.size()); for (Role role : this.roles) { if (!role.getType().equals("ADMIN")) grantedAuthorities.add(new GrantedAuthorityImpl(role .getRoleCode())); } return (GrantedAuthority[]) grantedAuthorities .toArray(new GrantedAuthority[grantedAuthorities.size()]); } public String getAuthoritiesString() { List authorities = new ArrayList(); for (GrantedAuthority authority : getAuthorities()) { authorities.add(authority.getAuthority()); } return StringUtils.join(authorities.toArray(), ","); } public String getPassword() { return this.password; } public String getUsername() { return this.userName; } public String getUserName() { return this.userName; } public void setUserName(String userName) { this.userName = userName; } public boolean isAccountNonExpired() { return true; } public boolean isAccountNonLocked() { return true; } public boolean isCredentialsNonExpired() { return true; } public Map<String, List<Res>> getRoleResources() { if (this.roleResources == null) { this.roleResources = new HashMap(); for (Role role : this.roles) { String roleCode = role.getRoleCode(); List<Res> ress = role.getReses(); for (Res res : ress) { String key = roleCode + "_" + res.getType(); if (!this.roleResources.containsKey(key)) { this.roleResources.put(key, new ArrayList()); } ((List) this.roleResources.get(key)).add(res); } } } return this.roleResources; } public void setPassword(String password) { this.password = password; } public Set<Role> getRoles() { return this.roles; } public void setRoles(Set<Role> roles) { this.roles = roles; } public static long getSerialVersionUID() { return 8026813053768023527L; } public void setRoleResources(Map<String, List<Res>> roleResources) { this.roleResources = roleResources; } public int getStatus() { return this.status; } public void setStatus(int status) { this.status = status; } public boolean isEnabled() { return true; } public String getTrueName() { return this.trueName; } public void setTrueName(String trueName) { this.trueName = trueName; } public String getUserRole() { return this.userRole; } public void setUserRole(String userRole) { this.userRole = userRole; } public String getTelephone() { return this.telephone; } public void setTelephone(String telephone) { this.telephone = telephone; } public String getQQ() { return this.QQ; } public void setQQ(String qq) { this.QQ = qq; } public String getMSN() { return this.MSN; } public void setMSN(String msn) { this.MSN = msn; } public String getAddress() { return this.address; } public void setAddress(String address) { this.address = address; } public Accessory getPhoto() { return this.photo; } public void setPhoto(Accessory photo) { this.photo = photo; } public BigDecimal getAvailableBalance() { return this.availableBalance; } public void setAvailableBalance(BigDecimal availableBalance) { this.availableBalance = availableBalance; } public BigDecimal getFreezeBlance() { return this.freezeBlance; } public void setFreezeBlance(BigDecimal freezeBlance) { this.freezeBlance = freezeBlance; } public UserConfig getConfig() { return this.config; } public void setConfig(UserConfig config) { this.config = config; } public List<Accessory> getFiles() { return this.files; } public void setFiles(List<Accessory> files) { this.files = files; } public int getIntegral() { return this.integral; } public void setIntegral(int integral) { this.integral = integral; } public int getLoginCount() { return this.loginCount; } public void setLoginCount(int loginCount) { this.loginCount = loginCount; } public String getWW() { return this.WW; } public void setWW(String ww) { this.WW = ww; } public GrantedAuthority[] getAuthorities() { return this.authorities; } public void setAuthorities(GrantedAuthority[] authorities) { this.authorities = authorities; } public int getGold() { return this.gold; } public void setGold(int gold) { this.gold = gold; } public int getReport() { return this.report; } public void setReport(int report) { this.report = report; } public int getUser_credit() { return this.user_credit; } public void setUser_credit(int user_credit) { this.user_credit = user_credit; } public List<PredepositLog> getUser_predepositlogs() { return this.user_predepositlogs; } public void setUser_predepositlogs(List<PredepositLog> user_predepositlogs) { this.user_predepositlogs = user_predepositlogs; } public List<PredepositLog> getAdmin_predepositlogs() { return this.admin_predepositlogs; } public void setAdmin_predepositlogs(List<PredepositLog> admin_predepositlogs) { this.admin_predepositlogs = admin_predepositlogs; } public void setParent(User parent) { this.parent = parent; } public List<User> getChilds() { return this.childs; } public void setChilds(List<User> childs) { this.childs = childs; } public Store getStore() { if (getParent() == null) { return this.store; } return getParent().getStore(); } public Storefactory getFactory() { return this.factory; } public void setFactory(Storefactory factory) { this.factory = factory; } public User getParent() { return this.parent; } public String getStore_quick_menu() { return this.store_quick_menu; } public void setStore_quick_menu(String store_quick_menu) { this.store_quick_menu = store_quick_menu; } public int getRank() { return rank; } public void setRank(int rank) { this.rank = rank; } }
[ "danranyixiao3@163.com" ]
danranyixiao3@163.com
1ce8c3f333b0f7b941d2c7d7e2a83fcb79fc8f93
9053aaa60258301339cf4d4fbc2d339b89c9b51f
/NerdyPig/app/src/main/java/com/dugsolutions/nerdypig/game/Game.java
64c35cb37f227c472ea8b4b74cdc8d89711e982f
[]
no_license
douglasselph/dug-projects
c5c899876009886e308dbd3ad3da2354fc3a2928
1c3e2ce251b5a008895f55768e5020de51faa5b2
refs/heads/master
2023-07-20T06:12:55.506689
2023-06-07T14:43:03
2023-06-07T14:43:03
25,180,143
0
0
null
null
null
null
UTF-8
Java
false
false
4,500
java
package com.dugsolutions.nerdypig.game; import android.util.Log; import com.dugsolutions.nerdypig.db.GameEnd; import com.dugsolutions.nerdypig.db.GlobalInt; import java.util.ArrayList; import java.util.List; import static com.dugsolutions.nerdypig.MyApplication.TAG; /** * Created by dug on 12/20/16. */ public class Game { public enum ResultReport { ONE_ROLLED, GAME_WON, AI_CONTINUE, AI_STOP, HUMAN_CONTINUE; } protected int mTurn; protected int mPlayerScore[]; protected int mCurScore; protected int mCurCount; protected int mActivePlayer; protected final GameEnd mGameEnd; protected final int mMaxTurns; protected final int mMaxScore; protected ArrayList<Integer> mRolls = new ArrayList<>(); public Game(int numPlayers) { mPlayerScore = new int[numPlayers]; mTurn = 0; mGameEnd = GlobalInt.getGameEnd(); mMaxTurns = GlobalInt.getMaxTurns(); mMaxScore = GlobalInt.getEndPoints(); } public int getTurn() { return mTurn; } public int getTotalScore() { return getTotalScore(getActivePlayer()); } public int getTotalScore(int i) { return mPlayerScore[i]; } public boolean isGameRunning() { if (mGameEnd == GameEnd.MAX_TURNS) { return (mTurn < mMaxTurns); } for (int score : mPlayerScore) { if (score >= mMaxScore) { return false; } } return true; } protected void restart() { for (int playerI = 0; playerI < mPlayerScore.length; playerI++) { mPlayerScore[playerI] = 0; } } protected boolean didWin(int score) { return (mGameEnd == GameEnd.END_POINTS) && (score >= mMaxScore); } public void chkIncTurn() { if (mActivePlayer == getNumPlayers() - 1) { mTurn++; } } public boolean isTie() { int maxScore = 0; boolean isTie = false; for (int playerI = 0; playerI < mPlayerScore.length; playerI++) { if (mPlayerScore[playerI] > maxScore) { isTie = false; maxScore = mPlayerScore[playerI]; } else if (mPlayerScore[playerI] == maxScore) { isTie = true; } } return isTie; } public int getWinner() { int maxScore = 0; int winner = -1; for (int playerI = 0; playerI < mPlayerScore.length; playerI++) { if (mPlayerScore[playerI] > maxScore) { winner = playerI; maxScore = mPlayerScore[playerI]; } } return winner; } public int getCurScore() { return mCurScore; } public int getActivePlayer() { return mActivePlayer; } int getNumPlayers() { return mPlayerScore.length; } public void setNextActivePlayer() { if (++mActivePlayer >= getNumPlayers()) { mActivePlayer = 0; } mCurCount = 0; mCurScore = 0; } public void setActivePlayer(int i) { mActivePlayer = i; mCurCount = 0; mCurScore = 0; } /** * * @param strategy * @param roll * @return true if the player gets another roll. */ public ResultReport applyRoll(StrategyHolder strategy, int roll) { mRolls.add(roll); if (roll == 1) { mCurScore = 0; return ResultReport.ONE_ROLLED; } mCurScore += roll; if (didWin(getTotalScore() + mCurScore)) { return ResultReport.GAME_WON; } if (strategy != null) { if (strategy.getStrategy() == Strategy.STOP_AFTER_NUM_ROLLS) { mCurCount++; if (mCurCount < strategy.getCount()) { return ResultReport.AI_CONTINUE; } else { return ResultReport.AI_STOP; } } else if (strategy.getStrategy() == Strategy.STOP_AFTER_REACHED_SUM) { if (mCurScore < strategy.getCount()) { return ResultReport.AI_CONTINUE; } else { return ResultReport.AI_STOP; } } else if (strategy.getStrategy() == Strategy.STOP_AFTER_REACHED_EVEN) { if (roll % 2 == 0) { mCurCount++; } if (mCurCount < strategy.getCount()) { return ResultReport.AI_CONTINUE; } else { return ResultReport.AI_STOP; } } } return ResultReport.HUMAN_CONTINUE; } public void applyStop() { mPlayerScore[mActivePlayer] += mCurScore; mCurScore = 0; mCurCount = 0; } public List<Integer> getRolls() { return mRolls; } public void clearRolls() { mRolls.clear(); } public boolean isHuman() { return isHuman(getActivePlayer()); } public boolean isHuman(int pos) { if (pos == 0) { if (GlobalInt.isAIFirst()) { return false; } else { return true; } } else { if (GlobalInt.isAIFirst()) { return true; } else { return false; } } } }
[ "doug@tipsolutions.com" ]
doug@tipsolutions.com
3779f35814482377b73cf8b8a75e631036d31afc
e20d93d9271a8ae6b73300a9595610f90341f20a
/SpiralMatrix.java
41176e55109bd4c18415f046f482d93d9a690f66
[]
no_license
emil011/Java-codes
6c83d4634d0842730769a1ecc1fde50cc6e1e401
787c2b6e5c7a7c52b9d8a41cea22b3d22e8e43e7
refs/heads/master
2020-06-13T12:34:35.665374
2019-07-29T09:20:04
2019-07-29T09:20:04
194,654,993
0
0
null
null
null
null
UTF-8
Java
false
false
1,195
java
import java.util.Scanner; public class SpiralMatrix { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("Enter size of array: "); int n = input.nextInt(); int[][] array = new int[n][n]; int k = 1, minRow = 0, maxRow = n - 1, minCol = 0, maxCol = n - 1; while(k <= n * n){ for(int i = minCol; i <= maxCol; i++) { array[minRow][i]=k++; } for(int j = minRow + 1;j <= maxRow; j++) { array[j][maxCol]=k++; } for(int i = maxCol - 1; i >= minCol; i--) { array[maxRow][i]=k++; } for(int j = maxRow - 1; j >= minRow + 1; j--) { array[j][minCol]=k++; } minCol++; maxCol--; minRow++; maxRow--; } System.out.println("The Spiral Matrix is:"); for(int i = 0; i < array.length; i++) { for(int j = 0; j < array.length; j++) { System.out.print(array[i][j]+ " "); } System.out.println(); } } }
[ "noreply@github.com" ]
noreply@github.com
86bd9cfc21982f4bf66b03efd339b33bf234a99c
3d2b292dd1c70c84c0d024530020cc9b2a867ad4
/src/logic/FirstPageLogic.java
8334cdab52bfb81e2c41160b9bf30350c9e8db9b
[]
no_license
wangyx0055/TbServer
b0b9e9d2a8617e220b27698f13217d26e601251a
d8ad6ddab443cf0b31cf7c305a0d198bfa7be774
refs/heads/master
2023-08-31T01:23:11.697219
2013-04-23T01:58:10
2013-04-23T01:58:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
258
java
/** * */ package logic; import parser.ProtocolParser; import util.TextContent; /** * @author Administrator * */ public class FirstPageLogic extends AuthenLogic { public String logic(ProtocolParser parser) { return TextContent.MAIN_MENU; } }
[ "guoyang100@yahoo.com.cn" ]
guoyang100@yahoo.com.cn
ef147ca10c734a2d06f1f6391e3badc57cb76209
aaa771eb4497a017d44b911a0e5cb7beb721b8b7
/src/flowshop/PermBlockShift.java
408e19ba6c33ade877b8655934398921577d0799
[]
no_license
grzes314/Algorytmy-Ewolucyjne
14cd3fcace844d354bc43e0ce75315f13b8a4013
493f18c9c9db9e152213a84780936f16b020d8ef
refs/heads/master
2020-04-05T23:25:10.657451
2015-06-14T14:01:40
2015-06-14T14:01:40
26,065,790
0
0
null
null
null
null
UTF-8
Java
false
false
2,802
java
package flowshop; import optimization.Permutation; import optimization.RandomnessSource; import optimization.ValuedIndividual; import sga.MutationPerformer; import sga.Population; import sga.SimplePopulation; /** * * @author Grzegorz Los */ public class PermBlockShift implements MutationPerformer<Permutation> { @Override public Population<Permutation> mutation(Population<Permutation> population, double thetaM) { SimplePopulation<Permutation> mutated = new SimplePopulation<>(); int N = population.getSize(); for (int i = 0; i < N; ++i) { mutated.addIndividual( mutate(population.getIndividual(i), thetaM) ); } return mutated; } private ValuedIndividual<Permutation> mutate(ValuedIndividual<Permutation> individual, double thetaM) { if (thetaM < RandomnessSource.rand.nextDouble()) return new ValuedIndividual<>(reallyMutate(individual.ind)); else return individual; } private Permutation reallyMutate(Permutation individual) { int n = individual.getSize(); int a = RandomnessSource.rand.nextInt(n); int b = RandomnessSource.rand.nextInt(n); if (b < a) { int pom = b; b = a; a = pom; } int k = RandomnessSource.rand.nextInt(n - (b-a)); return shift(individual, n, a, b, k); } private Permutation shift(Permutation p, int n, int a, int b, int k) { if (k < a) return shiftWhenKsmallerA(p, n, a, b, k); else return shiftWhenKgreaterEqA(p, n, a, b, k); } private Permutation shiftWhenKsmallerA(Permutation p, int n, int a, int b, int k) { int[] r = new int[n]; int l = b - a + 1; for (int i = 0; i < n; ++i) { if (i < k) r[i] = p.at(i); else if (i < k + l) r[i] = p.at(a+i-k); else if (i < a + l) r[i] = p.at(i-l); else r[i] = p.at(i); } return new Permutation(r); } private Permutation shiftWhenKgreaterEqA(Permutation p, int n, int a, int b, int k) { int[] r = new int[n]; int l = b - a + 1; for (int i = 0; i < n; ++i) { try { if (i < a) r[i] = p.at(i); else if (i < k) r[i] = p.at(i+l); else if (i < k + l) r[i] = p.at(i + a - k); else r[i] = p.at(i); } catch (Exception ex) { int dfsg = 9; } } return new Permutation(r); } @Override public void reset() { } }
[ "grzegorz314@gmail.com" ]
grzegorz314@gmail.com
e72411560ea9772bd7359f506b043692bdf338eb
4a47c37bcea65b6b852cc7471751b5239edf7c94
/src/academy/everyonecodes/java/week5/set1/exercise4/DoubleListMinimumFinderTest.java
61094394e958106994caba29726d5a9d247d4b67
[]
no_license
uanave/java-module
acbe808944eae54cfa0070bf8b80edf453a3edcf
f98e49bd05473d394329602db82a6945ad1238b5
refs/heads/master
2022-04-07T15:42:36.210153
2020-02-27T14:43:29
2020-02-27T14:43:29
226,831,034
0
0
null
null
null
null
UTF-8
Java
false
false
1,136
java
package academy.everyonecodes.java.week5.set1.exercise4; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import java.util.List; import java.util.Optional; public class DoubleListMinimumFinderTest { DoubleListMinimumFinder doubleListMinimumFinder = new DoubleListMinimumFinder(); @Test void find() { List<Double> input = List.of(2.3, 1.3, 0.8); Optional<Double> oResult = doubleListMinimumFinder.find(input); double expected = 0.8; Assertions.assertTrue(oResult.isPresent()); Assertions.assertEquals(expected, oResult.get()); } @Test void findEmpty() { List<Double> input = List.of(); Optional<Double> oResult = doubleListMinimumFinder.find(input); Assertions.assertTrue(oResult.isEmpty()); } @Test void findZero() { List<Double> input = List.of(-0.0, -1.9, -1.2); Optional<Double> oResult = doubleListMinimumFinder.find(input); double expected = -1.9; Assertions.assertTrue(oResult.isPresent()); Assertions.assertEquals(expected, oResult.get()); } }
[ "uanavasile@gmail.com" ]
uanavasile@gmail.com
6b49bbe01f2f5af5447309a30a73c02d9c335760
d7d28cd8df75fea56d8c1106738be4176b98e183
/src/test/java/com/slxy/www/SelectApplicationTests.java
95c7e9d2165c417110e355ff64ce58d36ad2a7df
[ "Apache-2.0" ]
permissive
lyhani82475/LYselect
43c35fcb7f3a6a88087ebfc1ef34369eddafca18
186ebcb3065d1853384410505d2de819f94b3f1e
refs/heads/boot
2022-09-09T19:08:23.558371
2019-06-20T10:50:01
2019-06-20T10:50:01
190,498,218
0
0
Apache-2.0
2022-06-29T17:25:29
2019-06-06T02:09:58
Java
UTF-8
Java
false
false
329
java
package com.slxy.www; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class SelectApplicationTests { @Test public void contextLoads() { } }
[ "zhengql@senthink.com" ]
zhengql@senthink.com
0f3b8cb2969b9adc0b308a841fe73d1a23331485
6ff9f6a5af01765a8333ac6ff198189380671e0a
/leetcode/src/main/java/contest/no96/ProjectionAreaOf3DShapes.java
cf59546db9aa29614f87546f002cb899b0b84afb
[]
no_license
deep20jain/algorithms-datastructures
067da69e41e8533347c16e0d6c1fc0d07d5e10bb
5b592f516d30b6fb39892607ea86f755e87dc60e
refs/heads/master
2021-04-06T08:28:54.916308
2018-11-24T16:30:12
2018-11-24T16:30:12
124,649,235
0
0
null
null
null
null
UTF-8
Java
false
false
1,029
java
package contest.no96; /** * Created by deep20jain on 05-08-2018. */ public class ProjectionAreaOf3DShapes { public int projectionArea(int[][] grid) { int n = grid.length; int m = grid[0].length; int xyplane = 0, yzplane = 0, xzplane = 0; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { if(grid[i][j]!=0) xyplane++; } } for (int i = 0; i < n; i++) { int max = 0; for (int j = 0; j < m; j++) { if(grid[i][j] > max) { max = grid[i][j]; } } yzplane+=max; } for (int i = 0; i < m; i++) { int max=0; for (int j = 0; j < n; j++) { if(grid[j][i] > max) { max = grid[j][i]; } } xzplane+=max; } return xyplane+xzplane+yzplane; } }
[ "deepjain.iitr@yahoo.in" ]
deepjain.iitr@yahoo.in
5edfefe51b026a418e5afccac725a17ef9387687
ca030864a3a1c24be6b9d1802c2353da4ca0d441
/classes10.dex_source_from_JADX/com/google/android/gms/wearable/zze.java
67a845ed5f53a98bf092fcaab6d67eacb2c593b5
[]
no_license
pxson001/facebook-app
87aa51e29195eeaae69adeb30219547f83a5b7b1
640630f078980f9818049625ebc42569c67c69f7
refs/heads/master
2020-04-07T20:36:45.758523
2018-03-07T09:04:57
2018-03-07T09:04:57
124,208,458
4
0
null
null
null
null
UTF-8
Java
false
false
1,579
java
package com.google.android.gms.wearable; import android.net.Uri; import android.os.Parcel; import android.os.ParcelFileDescriptor; import android.os.Parcelable.Creator; import com.google.android.gms.common.internal.safeparcel.zza; public class zze implements Creator<Asset> { public Object createFromParcel(Parcel parcel) { Uri uri = null; int b = zza.b(parcel); int i = 0; ParcelFileDescriptor parcelFileDescriptor = null; String str = null; byte[] bArr = null; while (parcel.dataPosition() < b) { int a = zza.a(parcel); switch (zza.a(a)) { case 1: i = zza.e(parcel, a); break; case 2: bArr = zza.q(parcel, a); break; case 3: str = zza.n(parcel, a); break; case 4: parcelFileDescriptor = (ParcelFileDescriptor) zza.a(parcel, a, ParcelFileDescriptor.CREATOR); break; case 5: uri = (Uri) zza.a(parcel, a, Uri.CREATOR); break; default: zza.a(parcel, a); break; } } if (parcel.dataPosition() == b) { return new Asset(i, bArr, str, parcelFileDescriptor, uri); } throw new zza.zza("Overread allowed size end=" + b, parcel); } public Object[] newArray(int i) { return new Asset[i]; } }
[ "son.pham@jmango360.com" ]
son.pham@jmango360.com
a0281f79f99032a2ba4a520aaac49a026226e773
afc757cc5283b27982958d48fc41fa366a961c28
/src/main/java/com/el/betting/sdk/v2/common/FeedsFilterUtil.java
7b4a79dc1cb5d40ff7a1379880d2a542d2854432
[]
no_license
davithbul/sport-betting-api
c75b63013a1460d390e9c67923af88fd5c7fcd7a
943fc6defc2ead6e1e7767379f8ae1fa7bbd483c
refs/heads/master
2020-03-10T03:20:33.071695
2018-04-11T22:40:02
2018-04-11T22:40:02
129,162,169
0
0
null
null
null
null
UTF-8
Java
false
false
6,929
java
package com.el.betting.sdk.v2.common; import com.el.betting.sdk.v2.BookmakerFeeds; import com.el.betting.sdk.v2.Event; import com.el.betting.sdk.v2.League; import com.el.betting.sdk.v2.Sport; import com.el.betting.sdk.v2.criteria.FeedsFilter; import com.el.betting.sdk.v4.Participant; import org.slf4j.Logger;import org.slf4j.LoggerFactory; import org.springframework.util.CollectionUtils; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; public class FeedsFilterUtil { private final static Logger log = LoggerFactory.getLogger(FeedsFilterUtil.class); public static List<Event<? extends Participant>> searchEvents(BookmakerFeeds bookmakerFeeds, FeedsFilter feedsFilter) { if (bookmakerFeeds.getSports() == null) { return Collections.emptyList(); } Stream<League> leagueStream = applySportsFilters(bookmakerFeeds, feedsFilter) .filter(sport -> !CollectionUtils.isEmpty(sport.getLeagues())) .map(Sport::getLeagues) .flatMap(Collection::stream); Stream<Event<? extends Participant>> eventStream = applyLeagueFilters(leagueStream, feedsFilter) .filter(league -> !CollectionUtils.isEmpty(league.getEvents())) .map(League::getEvents) .flatMap(Collection::stream); return applyEventsFilter(eventStream, feedsFilter).collect(Collectors.toList()); } public static List<League> searchLeagues(BookmakerFeeds bookmakerFeeds, FeedsFilter feedsFilter) { if (bookmakerFeeds.getSports() == null) { return Collections.emptyList(); } //filter sports Stream<League> leagueStream = applySportsFilters(bookmakerFeeds, feedsFilter) .filter(sport -> !CollectionUtils.isEmpty(sport.getLeagues())) .map(Sport::getLeagues) .flatMap(Collection::stream); //filter leagues leagueStream = applyLeagueFilters(leagueStream, feedsFilter) .map(league -> { League clonedLeague = league.clone(); if (clonedLeague.getEvents() == null) { clonedLeague.setEvents(new ArrayList<>()); } List<Event<? extends Participant>> events = applyEventsFilter(clonedLeague.getEvents().stream(), feedsFilter) .collect(Collectors.toList()); clonedLeague.setEvents(events); return clonedLeague; }); if (containsEventFilters(feedsFilter)) { leagueStream = leagueStream.filter(league -> !CollectionUtils.isEmpty(league.getEvents())); } return leagueStream.collect(Collectors.toList()); } public static List<Sport> searchSports(BookmakerFeeds bookmakerFeeds, FeedsFilter feedsFilter) { if (bookmakerFeeds.getSports() == null) { return Collections.emptyList(); } Stream<Sport> sportStream = applySportsFilters(bookmakerFeeds, feedsFilter) .map(sport -> { Sport sportClone = sport.clone(); if (sportClone.getLeagues() == null) { sportClone.setLeagues(new ArrayList<>()); } //filter leagues Stream<League> leagueStream = applyLeagueFilters(sportClone.getLeagues().stream(), feedsFilter) .filter(league -> league.getEvents() != null) .map(league -> { Stream<Event<? extends Participant>> eventStream = applyEventsFilter(league.getEvents().stream(), feedsFilter); league.setEvents(eventStream.collect(Collectors.toList())); return league; }); if (containsEventFilters(feedsFilter)) { leagueStream = leagueStream.filter(league -> !CollectionUtils.isEmpty(league.getEvents())); } sportClone.setLeagues(leagueStream.collect(Collectors.toList())); return sportClone; }); //if there is league filters then check that leagues are not empty after applying filter if (containsLeagueFilters(feedsFilter)) { sportStream = sportStream.filter(sport -> !CollectionUtils.isEmpty(sport.getLeagues())); } return sportStream.collect(Collectors.toList()); } private static Stream<Sport> applySportsFilters(BookmakerFeeds bookmakerFeeds, FeedsFilter feedsFilter) { return bookmakerFeeds.getSports() .stream() .filter(sport -> feedsFilter.getSportType() == null || sport.getSportType() == feedsFilter.getSportType()); } private static Stream<League> applyLeagueFilters(Stream<League> leagues, FeedsFilter feedsFilter) { return leagues .filter(league -> { if (CollectionUtils.isEmpty(feedsFilter.getLeaguePredicates())) { return true; } return feedsFilter.getLeaguePredicates().stream().anyMatch(leaguePredicate -> leaguePredicate.test(league)); }); } public static Stream<Event<? extends Participant>> applyEventsFilter(Stream<Event<? extends Participant>> eventStream, FeedsFilter feedsFilter) { return eventStream.filter(event -> { if (CollectionUtils.isEmpty(feedsFilter.getEventPredicates())) { return true; } return feedsFilter.getEventPredicates().stream().anyMatch(eventPredicate -> eventPredicate.test(event)); }).filter(event -> { if (CollectionUtils.isEmpty(feedsFilter.getParticipantPredicates())) { return true; } if (event.getParticipants() == null) { log.error("Teams for event are null: " + event); return false; } if (event.getParticipants().size() < 2) { return false; } return feedsFilter.getParticipantPredicates().stream() .allMatch(teamPredicate -> event.getParticipants().stream().anyMatch(teamPredicate::test)); }); } public static boolean containsLeagueFilters(FeedsFilter feedsFilter) { return !CollectionUtils.isEmpty(feedsFilter.getLeaguePredicates()) || containsEventFilters(feedsFilter); } public static boolean containsEventFilters(FeedsFilter feedsFilter) { return !CollectionUtils.isEmpty(feedsFilter.getEventPredicates()) || !CollectionUtils.isEmpty(feedsFilter.getParticipantPredicates()); } }
[ "davithbul@gmail.com" ]
davithbul@gmail.com
d3da8b862a506fbc5ffcdbe1151696dfd1b35db8
a1d5746b175ac86b723ae9570dd55712347a7f08
/sdk/spring/azure-spring-boot/src/samples/java/com/azure/spring/aad/webapi/SampleController.java
1536e7528a6bcac0f31c9d1173d6d117507b5fa8
[ "LicenseRef-scancode-generic-cla", "MIT", "LicenseRef-scancode-warranty-disclaimer", "BSD-3-Clause", "CC0-1.0", "Apache-2.0", "LicenseRef-scancode-public-domain", "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference", "LGPL-2.1-or-later" ]
permissive
bergmeister/azure-sdk-for-java
09181e2962ec81c16744da39849d9a4402ea0db8
f24385455966a78877846637d97a4a4f3b62cec5
refs/heads/master
2022-05-01T11:13:10.179573
2022-03-28T20:00:16
2022-03-28T20:00:16
239,373,766
0
0
MIT
2020-02-09T21:05:36
2020-02-09T21:02:17
null
UTF-8
Java
false
false
6,284
java
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. package com.azure.spring.aad.webapi; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.oauth2.client.OAuth2AuthorizedClient; import org.springframework.security.oauth2.client.annotation.RegisteredOAuth2AuthorizedClient; import org.springframework.security.oauth2.client.web.OAuth2AuthorizedClientRepository; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.context.request.RequestAttributes; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.reactive.function.client.WebClient; import static org.springframework.security.oauth2.client.web.reactive.function.client.ServletOAuth2AuthorizedClientExchangeFilterFunction.clientRegistrationId; import static org.springframework.security.oauth2.client.web.reactive.function.client.ServletOAuth2AuthorizedClientExchangeFilterFunction.oauth2AuthorizedClient; @RestController public class SampleController { private static final Logger LOGGER = LoggerFactory.getLogger(SampleController.class); private static final String GRAPH_ME_ENDPOINT = "https://graph.microsoft.com/v1.0/me"; private static final String CUSTOM_LOCAL_FILE_ENDPOINT = "http://localhost:8082/webapiB"; private static final String CUSTOM_LOCAL_READ_ENDPOINT = "http://localhost:8083/webapiC"; @Autowired private WebClient webClient; @Autowired private OAuth2AuthorizedClientRepository oAuth2AuthorizedClientRepository; /** * Call the graph resource, return user information * * @return Response with graph data */ @PreAuthorize("hasAuthority('SCOPE_Obo.Graph.Read')") @GetMapping("call-graph-with-repository") public String callGraphWithRepository() { Authentication principal = SecurityContextHolder.getContext().getAuthentication(); RequestAttributes requestAttributes = RequestContextHolder.currentRequestAttributes(); ServletRequestAttributes sra = (ServletRequestAttributes) requestAttributes; OAuth2AuthorizedClient graph = oAuth2AuthorizedClientRepository .loadAuthorizedClient("graph", principal, sra.getRequest()); return callMicrosoftGraphMeEndpoint(graph); } /** * Call the graph resource with annotation, return user information * * @param graph authorized client for Graph * @return Response with graph data */ // BEGIN: readme-sample-callGraph @PreAuthorize("hasAuthority('SCOPE_Obo.Graph.Read')") @GetMapping("call-graph") public String callGraph(@RegisteredOAuth2AuthorizedClient("graph") OAuth2AuthorizedClient graph) { return callMicrosoftGraphMeEndpoint(graph); } // END: readme-sample-callGraph /** * Call custom resources, combine all the response and return. * * @param webapiBClient authorized client for Custom * @return Response Graph and Custom data. */ // BEGIN: readme-sample-callCustom @PreAuthorize("hasAuthority('SCOPE_Obo.WebApiA.ExampleScope')") @GetMapping("webapiA/webapiB") public String callCustom( @RegisteredOAuth2AuthorizedClient("webapiB") OAuth2AuthorizedClient webapiBClient) { return callWebApiBEndpoint(webapiBClient); } // END: readme-sample-callCustom /** * Call microsoft graph me endpoint * * @param graph Authorized Client * @return Response string data. */ private String callMicrosoftGraphMeEndpoint(OAuth2AuthorizedClient graph) { if (null != graph) { String body = webClient .get() .uri(GRAPH_ME_ENDPOINT) .attributes(oauth2AuthorizedClient(graph)) .retrieve() .bodyToMono(String.class) .block(); LOGGER.info("Response from Graph: {}", body); return "Graph response " + (null != body ? "success." : "failed."); } else { return "Graph response failed."; } } /** * Call custom local file endpoint * * @param webapiBClient Authorized Client * @return Response string data. */ private String callWebApiBEndpoint(OAuth2AuthorizedClient webapiBClient) { if (null != webapiBClient) { String body = webClient .get() .uri(CUSTOM_LOCAL_FILE_ENDPOINT) .attributes(oauth2AuthorizedClient(webapiBClient)) .retrieve() .bodyToMono(String.class) .block(); LOGGER.info("Response from webapiB: {}", body); return "webapiB response " + (null != body ? "success." : "failed."); } else { return "webapiB response failed."; } } /** * Access to protected data through client credential flow. The access token is obtained by webclient, or * <p>@RegisteredOAuth2AuthorizedClient("webapiC")</p>. In the end, these two approaches will be executed to * DefaultOAuth2AuthorizedClientManager#authorize method, get the access token. * * @return Respond to protected data. */ // BEGIN: readme-sample-callClientCredential @PreAuthorize("hasAuthority('SCOPE_Obo.WebApiA.ExampleScope')") @GetMapping("webapiA/webapiC") public String callClientCredential() { String body = webClient .get() .uri(CUSTOM_LOCAL_READ_ENDPOINT) .attributes(clientRegistrationId("webapiC")) .retrieve() .bodyToMono(String.class) .block(); LOGGER.info("Response from Client Credential: {}", body); return "client Credential response " + (null != body ? "success." : "failed."); } // END: readme-sample-callClientCredential }
[ "noreply@github.com" ]
noreply@github.com
3df641473423e3ef1336be4bd850558e0fa447df
4fdec25e8fb18424592d8075c1452c0ad06fe447
/system/eureka/src/main/java/com/tenio/mmorpg/eureka/EurekaApplication.java
a4ebd75d728a99b9039d2daf3d8be8aba9bd3bcf
[ "MIT" ]
permissive
congcoi123/tenio-mmorpg
da1f6f476bad9ab0be2c8772f32cd79c963244a4
2d30cf308734b1bfeb7beaddda68cc5bca9b1b74
refs/heads/master
2023-08-16T06:02:21.844367
2021-10-24T01:12:54
2021-10-24T01:12:54
420,264,581
6
0
null
null
null
null
UTF-8
Java
false
false
1,503
java
/* The MIT License Copyright (c) 2016-2021 kong <congcoi123@gmail.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package com.tenio.mmorpg.eureka; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; @SpringBootApplication @EnableEurekaServer public class EurekaApplication { public static void main(String[] args) { SpringApplication.run(EurekaApplication.class); } }
[ "congcoi123@gmail.com" ]
congcoi123@gmail.com
adaf121f0d833afcd776ff9edfd347d5736087cd
b5fffa76e53e3225a95d6df771dbda766eb9aa4f
/app/src/main/java/ucweb/video.player.listener/IControllerView.java
cb3674ab15ef91a9ff8a25a4106ae5785e45d718
[]
no_license
hepeixin/VideoPlayer
fc001a8191df3886be657f9b8ac37232b7a6a913
7fc537b9ba03e42446c23151dc34313e25ac6d8b
refs/heads/master
2021-01-10T10:43:21.917415
2015-10-29T02:04:07
2015-10-29T02:04:07
45,105,829
0
1
null
null
null
null
UTF-8
Java
false
false
1,395
java
package ucweb.video.player.listener; import android.view.View; /** * desc: all controller view video.video.player.listener * <br/> * author: zhichuanhuang * <br/> * date: 2015/9/6 * <br/> * mail: 670534823@qq.com * <br/> * phone: 15914375424 * <br/> * version: 1.0 */ public interface IControllerView { View getView(); void setMyCallback(ControllerCallback myControllerCallback); void setScreenType(int screenType); void init(); boolean isShowing(); void hide(); void updatePausePlay(); void showLoading(); void hideLoading(); void setNoNetworkErr(); void show(); void show(int timeout); void onDestroy(); int getVisibility(); void setVisibility(int visibility); void reset(); void setTitle(String title); void updateScaleButton(int screenType); void setEnabled(boolean enabled); /** 初始状态*/ void initState(); /** 准备状态*/ void prepareState(); /** 正在播放状态*/ void playingState(); /** 播放暂停状态*/ void pauseState(); void progressSeekPlayState(); void progressSeekPauseState(); void playErrorState(); /** 播放完成状态*/ void completeState(); /** 滑动屏幕拖动视频进度*/ void touch2seek(); }
[ "hepeixin@gmail.com" ]
hepeixin@gmail.com
06f3526eed7899471289fe3b05ae981613ed910a
f4ecfdc73060829787b38ad3570675eea5ed395a
/app/src/main/java/com/example/toycathon/dto/Questions.java
70785e0c521319508585f8e13579ea82f196d1c7
[]
no_license
RishiKetuChand/Toycathon
71b547f48c67164f7e45b962472fd7c8f57668bf
fa78d1b36aec054e31ea4c420e849858b3735045
refs/heads/master
2023-06-05T14:31:22.655747
2021-06-29T03:02:39
2021-06-29T03:02:39
378,591,863
0
1
null
null
null
null
UTF-8
Java
false
false
3,228
java
package com.example.toycathon.dto; import android.os.Parcel; import android.os.Parcelable; public class Questions implements Parcelable { public static final Parcelable.Creator<Questions> CREATOR = new Parcelable.Creator<Questions>() { @Override public Questions createFromParcel(Parcel in) { return new Questions(in); } @Override public Questions[] newArray(int size) { return new Questions[size]; } }; private String id; private String question; private String choice01; private String choice02; private String choice03; private String choice04; private String crtAns; private String thumb; private String categories; private String description; public Questions(Parcel in) { id = in.readString(); question = in.readString(); choice01 = in.readString(); choice02 = in.readString(); choice03 = in.readString(); choice04 = in.readString(); crtAns = in.readString(); categories = in.readString(); thumb = in.readString(); description = in.readString(); } public Questions() { } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getQuestion() { return question; } public void setQuestion(String question) { this.question = question; } public String getChoice01() { return choice01; } public void setChoice01(String choice01) { this.choice01 = choice01; } public String getChoice02() { return choice02; } public void setChoice02(String choice02) { this.choice02 = choice02; } public String getChoice03() { return choice03; } public void setChoice03(String choice03) { this.choice03 = choice03; } public String getChoice04() { return choice04; } public void setChoice04(String choice04) { this.choice04 = choice04; } public String getCrtAns() { return crtAns; } public void setCrtAns(String crtAns) { this.crtAns = crtAns; } public String getThumb() { return thumb; } public void setThumb(String thumb) { this.thumb = thumb; } public String getCategories() { return categories; } public void setCategories(String categories) { this.categories = categories; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel parcel, int i) { parcel.writeString(id); parcel.writeString(question); parcel.writeString(choice01); parcel.writeString(choice02); parcel.writeString(choice03); parcel.writeString(choice04); parcel.writeString(crtAns); parcel.writeString(categories); parcel.writeString(thumb); parcel.writeString(description); } }
[ "rishiketuchand64@gmail.com" ]
rishiketuchand64@gmail.com
6c90eaf70b4786e59a81c650bdb3631c28a4f3e4
db77695fff95df158f4a075c5d791ec6697cf1e4
/sweet-gateway/src/main/java/com/sea/gareway/SweetGateway.java
9d456c4aa9a411f8ad08aa2f7daed69011026f57
[]
no_license
liuzonghai8/sweet
fe68f2341a2d14327e78d49e424c238697ffb805
543905851eae2465795b8f47e3f3b1819f2de3d3
refs/heads/master
2022-07-08T01:26:30.468513
2019-06-17T12:36:36
2019-06-17T12:36:36
162,665,846
0
0
null
2022-06-21T00:54:27
2018-12-21T04:30:59
Java
UTF-8
Java
false
false
478
java
package com.sea.gareway; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.netflix.zuul.EnableZuulProxy; @SpringBootApplication @EnableDiscoveryClient @EnableZuulProxy public class SweetGateway { public static void main(String[] args) { SpringApplication.run(SweetGateway.class); } }
[ "369613662@qq.com" ]
369613662@qq.com
7b6868567826db36367ae5d62b1a893ce59bffb9
872967c9fa836eee09600f4dbd080c0da4a944c1
/source/com/sun/org/apache/xml/internal/security/utils/DOMNamespaceContext.java
5261d3e7265d22c6daf209555f608aee81a31cf0
[]
no_license
pangaogao/jdk
7002b50b74042a22f0ba70a9d3c683bd616c526e
3310ff7c577b2e175d90dec948caa81d2da86897
refs/heads/master
2021-01-21T02:27:18.595853
2018-10-22T02:45:34
2018-10-22T02:45:34
101,888,886
0
0
null
null
null
null
UTF-8
Java
false
false
2,560
java
/* * Copyright (c) 2007, 2017, 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.xml.internal.security.utils; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import javax.xml.namespace.NamespaceContext; import test.org.w3c.dom.Attr; import test.org.w3c.dom.Element; import test.org.w3c.dom.NamedNodeMap; import test.org.w3c.dom.Node; /** */ public class DOMNamespaceContext implements NamespaceContext { private Map<String, String> namespaceMap = new HashMap<String, String>(); public DOMNamespaceContext(Node contextNode) { addNamespaces(contextNode); } public String getNamespaceURI(String arg0) { return namespaceMap.get(arg0); } public String getPrefix(String arg0) { for (String key : namespaceMap.keySet()) { String value = namespaceMap.get(key); if (value.equals(arg0)) { return key; } } return null; } public Iterator<String> getPrefixes(String arg0) { return namespaceMap.keySet().iterator(); } private void addNamespaces(Node element) { if (element.getParentNode() != null) { addNamespaces(element.getParentNode()); } if (element instanceof Element) { Element el = (Element)element; NamedNodeMap map = el.getAttributes(); for (int x = 0; x < map.getLength(); x++) { Attr attr = (Attr)map.item(x); if ("xmlns".equals(attr.getPrefix())) { namespaceMap.put(attr.getLocalName(), attr.getValue()); } } } } }
[ "gaopanpan@meituan.com" ]
gaopanpan@meituan.com
7ecca5ce697963c25422c30c367605e58cb87986
558b22915011833f8da4283df8ecc8ec8c644c0b
/chapter_002/src/test/java/ru/job4j/tracker/TrackerSingleTest.java
1b697c38945339d03c59d71cb899973ec2d63276
[ "Apache-2.0" ]
permissive
t0l1k/job4j
3b942f0846bc76ab81e5ebb417d20ac2d22f4e35
6aaeb70a2527359239f6be9f8f51d3724bb98e3b
refs/heads/master
2021-07-08T21:14:26.050174
2019-10-24T21:20:26
2019-10-24T21:20:26
196,946,270
0
0
Apache-2.0
2020-10-13T14:35:42
2019-07-15T07:23:08
Java
UTF-8
Java
false
false
1,191
java
package ru.job4j.tracker; import org.junit.Assert; import org.junit.Test; public class TrackerSingleTest { @Test public void whenCreateSecondInstanceHasOneInstanceVar1() { TrackerSingle1 first = TrackerSingle1.INSTANCE; TrackerSingle1 second = TrackerSingle1.INSTANCE; Assert.assertTrue(first.INSTANCE == second.INSTANCE); } @Test public void whenCreateSecondInstanceHasOneInstanceVar2() { TrackerSingle2 first = TrackerSingle2.getInstance(); TrackerSingle2 second = TrackerSingle2.getInstance(); Assert.assertTrue(first.getInstance() == second.getInstance()); } @Test public void whenCreateSecondInstanceHasOneInstanceVar3() { TrackerSingle3 first = TrackerSingle3.getInstance(); TrackerSingle3 second = TrackerSingle3.getInstance(); Assert.assertTrue(first.getInstance() == second.getInstance()); } @Test public void whenCreateSecondInstanceHasOneInstanceVar4() { TrackerSingle4 first = TrackerSingle4.getInstance(); TrackerSingle4 second = TrackerSingle4.getInstance(); Assert.assertTrue(first.getInstance() == second.getInstance()); } }
[ "t0l1k@mail.ru" ]
t0l1k@mail.ru
de00af8994d0f717ab33ec1c15f77e610d927b6a
1784f2200e8c1fd14bdeb10f32f8173ee82569b9
/grade/tests/Validator.java
14c1608ced8642e4fc58871a54ba3fe663a196bf
[ "MIT" ]
permissive
junk0612/Orientation2015Problems
39eb23dae34421bb3d06ddd2866ed6c201ad7e55
cfd5cf13c41948d5880ad74ed0f46091529f4400
refs/heads/master
2021-01-15T13:06:58.056029
2015-06-24T13:19:46
2015-06-24T13:19:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
423
java
import java.util.Scanner; public class Validator { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); checkRange(n, 1, 1000); for (int i = 0; i < n; i++) { checkRange(sc.nextInt(), 0, 20); checkRange(sc.nextInt(), 0, 80); } sc.close(); } static void checkRange(int n, int min, int max) { if (n >= min && n <= max) return; System.exit(1); } }
[ "nnujabok@gmail.com" ]
nnujabok@gmail.com
c2fbf1442e33cd173a6cd32b849a5f380bd2c50c
ec47f17feac49c3ed67fec87b52d852bd56ce4b9
/src/crayon/typeracer/FXController.java
aca011f3bf7bfe37f516e7fd29c391898deeebf6
[]
no_license
vrizaldi/type-racer
a686e0370032e70adf417647ce6e7f3109f849ef
fd38036bfba366914d58560acda1e77e4734d464
refs/heads/master
2020-06-17T13:34:46.531868
2019-09-26T13:33:47
2019-09-26T13:33:47
195,939,748
0
0
null
null
null
null
UTF-8
Java
false
false
331
java
package crayon.typeracer; import crayon.typeracer.SceneController; import javafx.scene.Scene; public class FXController { protected SceneController sceneController; public void setSceneController(SceneController sceneController) { this.sceneController = sceneController; } public void stop() { } }
[ "vrizaldi@gmail.com" ]
vrizaldi@gmail.com
8c4544e617af49568ccf19e65e4918702c3fed91
fa9f9a444434d5b321a4dbe583336252e37b62ef
/src/main/java/com/hc/logic/deal/Deal.java
b19a99640e5245151d2dfe2962b3ed35411b4ced
[]
no_license
brucelevis/virtualProject
5e690680f29ed261c9dcf97defce15ccffe976bc
790e4e9596412e7d2214242fdbb48503644a100d
refs/heads/master
2020-05-17T00:33:56.869431
2018-11-28T09:21:31
2018-11-28T09:21:31
null
0
0
null
null
null
null
GB18030
Java
false
false
6,091
java
package com.hc.logic.deal; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import com.hc.frame.Context; import com.hc.logic.basicService.OrderVerifyService; import com.hc.logic.creature.Player; import com.hc.logic.domain.GoodsEntity; public class Deal { private String tpName; //交易另一方的名字 private String spName; //发起者名字 //交易双方交易的物品和数量。格式, key:物品id/gold ; value: 数量 private Map<String, Integer> tpDeal = new HashMap<>(); private Map<String, Integer> spDeal = new HashMap<>(); //发起者希望交易的物品和数量 private boolean tpAccep; //是否同意进行交换 private boolean spAccep; private Lock lock = new ReentrantLock(); //需要交换的物品 private List<GoodsEntity> exchange = new ArrayList<>(); private List<GoodsEntity> aexchange = new ArrayList<>(); public Deal(String p) { this.tpName = p; } public void acceptDeal(Player tPlayer, String sName) { lock.lock(); try { if(spName != null || !tPlayer.getName().equals(tpName)) { tPlayer.getSession().sendMessage("对方已经在交易中,组队失败"); return; } this.spName = sName; tPlayer.accDeal(this); }finally { lock.unlock(); } } /** * 当双方都同意交换后,开始交换物品 */ public void exchangeGoods() { System.out.println("-----开始交换-----" + tpDeal.toString() +", " + spDeal.toString()); System.out.println("---交易双方-----" + tpName + ", " + spName); lock.lock(); try { Player tPlayer = Context.getOnlinPlayer().getPlayerByName(tpName); Player sPlayer = Context.getOnlinPlayer().getPlayerByName(spName); //playerDelGoods(tPlayer, tpDeal, exchange); //playerAddGoods(tPlayer, spDeal); //playerAddGoods(sPlayer, tpDeal, exchange); //playerDelGoods(sPlayer, spDeal, exchange); playerDelGoods(tPlayer, tpDeal, exchange); playerDelGoods(sPlayer, spDeal, aexchange); System.out.println("---------前--exchange---" + exchange.size()); System.out.println("-----------前---" + aexchange.size()); playerAddGoods(tPlayer, spDeal, aexchange); playerAddGoods(sPlayer, tpDeal, exchange); System.out.println("----------后--exchange--" + exchange.size()); System.out.println("--------------" + aexchange.size()); notHopeDeal(tpName); }finally{ lock.unlock(); } } /** * * @param player 减少物品的玩家 * @param goods 减少的物品 * @param changex 如果减少的是物品,则放入这个里面,否则保持null */ private void playerDelGoods(Player player, Map<String, Integer> goods, List<GoodsEntity> changex) { for(Entry<String, Integer> ent : goods.entrySet()) { if(!OrderVerifyService.isDigit(ent.getKey())) { //金币 player.minusGold(ent.getValue()); }else { //物品 //this.exchange = new ArrayList<>(); int gid = Integer.parseInt(ent.getKey()); List<GoodsEntity> glist = player.delGoods(gid, ent.getValue()); for(GoodsEntity ge : glist) { //交换物品(玩家和工会之间) GoodsEntity nge = Context.getGoodsService().changeGoods(ge); changex.add(nge); } } } } /** * 获得交换的物品 * @param player 获得的玩家 * @param goods 获得的物品 * @param changex 如果获得的是物品,则再这里面,否则这个为null */ private void playerAddGoods(Player player, Map<String, Integer> goods, List<GoodsEntity> changes) { if(changes.size() == 0) { player.addGold(goods.get("gold")); return; } for(GoodsEntity ge : changes) { ge.setPlayerEntity(player.getPlayerEntity()); player.addGoods(ge); } changes = null; } private void playerAddGoods(Player player, Map<String, Integer> goods) { for(Entry<String, Integer> ent : goods.entrySet()) { if(ent.getKey().equals("gold")){ player.addGold(ent.getValue()); }else { player.addGoods(Integer.parseInt(ent.getKey()), ent.getValue()); } } } /** * 进入交易状态后,可以放置物品 * @param pName : 放置物品的玩家名 * @param args: deal 物品名 数量 */ public void showGoods(String pName, String[] args) { lock.lock(); try { if(pName.equals(tpName)) { tpDeal.put(args[1], Integer.parseInt(args[2])); }else { spDeal.put(args[1], Integer.parseInt(args[2])); } }finally { lock.unlock(); } } public String getTpName() { return tpName; } public String getSpName() { return spName; } public void setSpName(String spName) { this.spName = spName; } /** * 获得交易对方的名字 * @param name * @return */ public String getCounter(String name) { if(name.equals(spName)) return tpName; return spName; } /** * 同意进行交换 * @param pName 同意交换的玩家名 */ public void hopeDeal(String pName) { lock.lock(); try { if(pName.equals(spName)) { this.spAccep = true; }else if(pName.equals(tpName)) { this.tpAccep = true; } }finally { lock.unlock(); } } /** * 不同意交换 * @param pName */ public void notHopeDeal(String pName) { lock.lock(); try { tpAccep = false; spAccep = false; tpDeal.clear(); spDeal.clear(); }finally { lock.unlock(); } } /** * 是否已经可以开始进行交换确认 * @return */ public boolean isReadyVerify() { lock.lock(); try { if(tpDeal.size() == 0 || spDeal.size() == 0) { return false; } return true; }finally { lock.unlock(); } } /** * 是否可以开始交换了 * @return */ public boolean isReadyChange() { lock.lock(); try { if(!tpAccep || !spAccep) { return false; } return true; }finally { lock.unlock(); } } }
[ "huangchaophy@13.com" ]
huangchaophy@13.com
7136ae7ec3d61436d1157552831001e1031b90e5
8035961ba790354762d80c229019632e545365bc
/Demos/Lesson08/springbootthymeleaf/src/main/java/edu/mum/cs/springbootthymeleaf/MyWebMvcConfigurer.java
8b0caca56def5723a0a78e3c822222f5302a8009
[]
no_license
sarojthapa2019/WAA
ddecdf6170984803c116f19bd9cdd65a9a9d274f
b63d2a1dbbbbb51a12acc9bc75d7f3a2aed5e0c3
refs/heads/master
2022-12-27T05:51:52.638904
2019-12-19T22:56:56
2019-12-19T22:56:56
212,652,176
0
0
null
2022-12-16T00:41:00
2019-10-03T18:37:58
Java
UTF-8
Java
false
false
1,958
java
package edu.mum.cs.springbootthymeleaf; import org.springframework.context.MessageSource; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.support.ReloadableResourceBundleMessageSource; import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; import org.springframework.web.servlet.LocaleResolver; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.i18n.LocaleChangeInterceptor; import org.springframework.web.servlet.i18n.SessionLocaleResolver; import java.util.Locale; @Configuration public class MyWebMvcConfigurer implements WebMvcConfigurer { @Bean public LocaleResolver localeResolver() { SessionLocaleResolver slr = new SessionLocaleResolver(); slr.setDefaultLocale(Locale.US); return slr; } @Bean public LocaleChangeInterceptor localeChangeInterceptor() { LocaleChangeInterceptor lci = new LocaleChangeInterceptor(); lci.setParamName("lang"); return lci; } @Override public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(localeChangeInterceptor()); } @Bean public MessageSource messageSource() { ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource(); messageSource.setBasenames("classpath:errorMessages", "classpath:messages"); messageSource.setDefaultEncoding("UTF-8"); return messageSource; } @Bean public LocalValidatorFactoryBean validator() { LocalValidatorFactoryBean bean = new LocalValidatorFactoryBean(); bean.setValidationMessageSource(messageSource()); return bean; } }
[ "sarose301@gmail.com" ]
sarose301@gmail.com
b3db7c8c764b5dccd49137857c9fb9c83ae0d5ec
5d23e7f68eb05a50e6d799189b5b5f7dc3a9624e
/CommonsEntity/metamodel/com/bid4win/commons/persistence/entity/connection/ConnectionAbstract_.java
03980c649a5736ceb49d7aa80ccab30fa7a90276
[]
no_license
lanaflon-cda2/B4W
37d9f718bb60c1bf20c62e7d0c3e53fbf4a50c95
7ddad31425798cf817c5881dd13de5482431fc7b
refs/heads/master
2021-05-27T05:47:23.132341
2013-10-11T11:51:03
2013-10-11T11:51:03
null
0
0
null
null
null
null
ISO-8859-1
Java
false
false
1,677
java
package com.bid4win.commons.persistence.entity.connection; import javax.persistence.metamodel.SingularAttribute; import javax.persistence.metamodel.StaticMetamodel; import com.bid4win.commons.core.Bid4WinDate; import com.bid4win.commons.persistence.entity.Bid4WinEntity_; import com.bid4win.commons.persistence.entity.account.AccountBasedEntityMultipleGeneratedID_; /** * Metamodel de la classe ConnectionAbstract<BR> * <BR> * @author Emeric Fillâtre */ @StaticMetamodel(ConnectionAbstract.class) public class ConnectionAbstract_ extends AccountBasedEntityMultipleGeneratedID_ { /** Définition de l'adresse IP de connexion */ public static volatile SingularAttribute<ConnectionAbstract<?, ?, ?>, IpAddress> ipAddress; /** Définition de l'identifiant du process à l'origine de la connexion */ public static volatile SingularAttribute<ConnectionAbstract<?, ?, ?>, String> processId; /** Définition du flag indiquant la rémanence de la connexion */ public static volatile SingularAttribute<ConnectionAbstract<?, ?, ?>, Boolean> remanent; /** Définition du flag indiquant si la connexion est active */ public static volatile SingularAttribute<ConnectionAbstract<?, ?, ?>, Boolean> active; /** Définition de la raison de fin de connexion */ public static volatile SingularAttribute<ConnectionAbstract<?, ?, ?>, DisconnectionReason> disconnectionReason; /** Définition de la date de début de connexion */ public static volatile SingularAttribute<ConnectionAbstract<?, ?, ?>, Bid4WinDate> startDate; // Définition de la profondeur des relations static { Bid4WinEntity_.startProtection(); Bid4WinEntity_.stopProtection(); } }
[ "emeric.fillatre@gmail.com" ]
emeric.fillatre@gmail.com
d97d0e54874ef10920f9d5e59db94122b93a2bbc
b94cee16cf420f3c23980ff792ccd076c7505d84
/49. Group Anagrams^.java
4921ea16db1a78a86a5c01fb5035d26d3746b715
[]
no_license
qwertytoki/leetcode
54e17385539a491e2e71fcfa2e913cb18e12d4b6
6c48bf8c4c9cc86cc4fc4cf78a4f54466a4eb21d
refs/heads/master
2020-05-02T14:44:43.434370
2019-08-22T06:23:03
2019-08-22T06:23:03
178,019,531
0
0
null
null
null
null
UTF-8
Java
false
false
1,150
java
import java.util.HashMap; class Solution { public List<List<String>> groupAnagrams(String[] strs) { Map<String, List> groupMap = new HashMap<String, List>(); for (String s : strs) { System.out.println(s); boolean isMatch = false; for (String key : groupMap.keySet()) { if (isContainsSameChar(s, key)) { groupMap.get(key).add(s); isMatch = true; break; } } if(!isMatch){ groupMap.put(s,new ArrayList()); groupMap.get(s).add(s); } } return new ArrayList(groupMap.values()); } private boolean isContainsSameChar(String a, String b) { if(a.length()!=b.length()) return false; for(String aPart:a.split("")){ boolean bool = false; for(String bPart:b.split("")){ if(aPart.equals(bPart)){ bool = true; } } if(!bool){ return false; } } return true; } }
[ "qwertytoki@gmail.com" ]
qwertytoki@gmail.com
98176745b18e4e2b6810d90b1d04ace9fa3533a5
0e2a880bfe517643fc34324502043309ca112c63
/Source/workspace/PARROT/gen/dk/aau/cs/giraf/oasis/lib/R.java
8a5ca444ad7f4e41d6b6539be1e7bd3db5fb5d4e
[]
no_license
powerjacob/SW6Parrot
92e51848cd246efa71e24763d0a1236191e29532
29567f37b52d872320d1674cc536a9a7ccf82dd0
refs/heads/master
2020-04-11T12:21:03.740436
2013-02-28T10:28:42
2013-02-28T10:28:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
553
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 dk.aau.cs.giraf.oasis.lib; public final class R { public static final class string { public static final int hello = 0x7f040000; public static final int app_name = 0x7f040001; } public static final class layout { public static final int main = 0x7f030002; } public static final class drawable { public static final int ic_launcher = 0x7f02000a; } }
[ "anders.vinther1@gmail.com" ]
anders.vinther1@gmail.com
9fae6ef334198029897df6e31bc502d5f538ba24
09a51b629c19e909eeb0819bc7f8cb27a253972f
/src/main/java/com/example/SpringBackEnd/SpringBackEndApplication.java
79dd83410455270d5d098d78818d2c8e7f4abc5d
[]
no_license
RiscoBogdan/Spring-Boot---React-
d77d4bbbec932358d2e4c4b0a366fd6c470f6cc7
76ea67c22827e32ae9bbdff2498de79944647e99
refs/heads/main
2023-03-17T14:28:01.174953
2021-03-13T21:14:48
2021-03-13T21:14:48
347,479,884
0
0
null
null
null
null
UTF-8
Java
false
false
332
java
package com.example.SpringBackEnd; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class SpringBackEndApplication { public static void main(String[] args) { SpringApplication.run(SpringBackEndApplication.class, args); } }
[ "riscobogdan69@gmail.com" ]
riscobogdan69@gmail.com
f1c919d2ead83fc68fb218d72e9f7692fff01d3e
955490a6f04d32140c3d0312f91f3652fc45a5b4
/src/main/java/com/ms3/bootcamp/members/MemberRepository.java
df9d61ed32089287d8cb8a8577f8f639be4a394f
[]
no_license
AlexManax/MS3_BootCamp
a55944f9db3731c7dce72d8c50300301ef9d489d
d6b740fd8dbab5b60e46677d032352c2abe3124b
refs/heads/master
2022-07-09T04:01:08.004987
2019-08-05T19:31:55
2019-08-05T19:31:55
198,822,213
0
0
null
2022-06-21T01:36:15
2019-07-25T11:54:27
Java
UTF-8
Java
false
false
286
java
package com.ms3.bootcamp.members; import com.ms3.bootcamp.members.Member; import org.springframework.data.repository.CrudRepository; import java.util.List; public interface MemberRepository extends CrudRepository<Member, Integer> { List<Member> findAllByIdShip (int idShip); }
[ "AlexManax@gmail.com" ]
AlexManax@gmail.com
64baadd040a3490bed5ba3dad7a5582dbbcc758a
a9bebaf3337256cb3227cad54cdbafc5475bc0e4
/SourceCode/aqrsystem/src/main/java/eu/europa/ec/aqrsystem/action/PlanActionBean.java
d7e9cf4f00b95287d9d14b6be77d889bcfd244be
[]
no_license
eea/aqr-public
dcd80af5592548d566108512a12a2355d026bc31
f72f12e9c7dce5677cbcae23177217ad86c5f787
refs/heads/master
2023-09-05T09:31:28.464922
2018-06-11T10:45:30
2018-06-11T10:45:30
34,791,998
0
0
null
null
null
null
UTF-8
Java
false
false
7,588
java
/* * Copyright (c) 2010-2014 EUROPEAN UNION * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by * the European Commission - subsequent versions of the EUPL (the "Licence"); * You may not use this work except in compliance with the Licence. * You may obtain a copy of the Licence at: * http://ec.europa.eu/idabc/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. * * Date: __/__/____ * Authors: European Commission, Joint Research Centre * Lucasz Cyra, Emanuela Epure, Daniele Francioli * aq-dev@jrc.ec.europa.eu */ package eu.europa.ec.aqrsystem.action; import static eu.europa.ec.aqrsystem.action.BaseActionBean.planManager; import eu.europa.ec.plan.DeletePlanException; import eu.europa.ec.aqrsystem.xml.PlanXML; import eu.europa.ec.aqrsystem.xml.XMLManager; import eu.europa.ec.plan.PlanBean; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.List; import javax.annotation.security.RolesAllowed; import javax.xml.bind.JAXBException; import net.sourceforge.stripes.action.DefaultHandler; import net.sourceforge.stripes.action.ForwardResolution; import net.sourceforge.stripes.action.LocalizableMessage; import net.sourceforge.stripes.action.Resolution; import net.sourceforge.stripes.action.RedirectResolution; import net.sourceforge.stripes.util.HtmlUtil; /** * The action bean for handling the Plan tab of the system. */ @RolesAllowed({"user", "administrator", "superuser"}) public class PlanActionBean extends BasePlanActionBean { /** * Location of the tab view */ private static final String MAIN_VIEW = "WEB-INF/jsp/plan/tab.jsp"; /** * The default action of the controller, which displays the tab. * * @return Default Stripes object. */ @DefaultHandler public Resolution showTab() { return new ForwardResolution(MAIN_VIEW); } /** * The action for creating a new plan. * * @return Default Stripes object. * @throws java.lang.Exception */ @RolesAllowed({"user", "administrator"}) public Resolution create() throws Exception { plan = planManager.createPlanDraftForUser(email); context.getMessages().add(new LocalizableMessage("plan.create.message", HtmlUtil.encode(plan.getInspireidLocalid()))); return new RedirectResolution(EditPlanActionBean.class).addParameter("planId", plan.getUuid()); } /** * Exporting the content of the plan to an XML file. * * @return Default Stripes object. * @throws javax.xml.bind.JAXBException * @throws java.io.UnsupportedEncodingException */ public Resolution export() throws JAXBException, UnsupportedEncodingException, IOException { return XMLManager.export(PlanXML.class, new PlanXML().populate(getPlan()), "Plan_" + XMLManager.getFilename(getPlan())); } /** * The action for importing a new plan * * @return Default Stripes object. * @throws javax.xml.bind.JAXBException */ @RolesAllowed({"user", "administrator"}) public Resolution importData() throws JAXBException, Exception { XMLManager.importData(xmlFile, context, PlanXML.class, email, res); return new RedirectResolution(getClass()); } /** * The action for deleting a plan * * @return Default Stripes object. */ @RolesAllowed({"user if ${plan.editable}", "administrator if ${plan.editable}"}) public Resolution delete() { try { planManager.deletePlanByID(planId); } catch (DeletePlanException e) { return ajaxError("plan.error.delete"); } return ajaxSuccess(); } /** * The action for cloning a plan * * @return Default Stripes object. * @throws java.lang.Exception */ @RolesAllowed({"user", "administrator"}) public Resolution cloneItem() throws Exception { planManager.clonePlanByPlanIDAndUser(planId, email); return ajaxSuccess(); } /** * The location of the table content view. */ private static final String TABLE_CONTENT = "WEB-INF/jsp/plan/plansTableContent.jsp"; /** * An event handler that renders the table. * * @return The table view. */ public Resolution table() { return new ForwardResolution(TABLE_CONTENT); } /** * Location of the dialog view. */ private static final String DIALOG_VIEW = "WEB-INF/jsp/plan/exportallDialogContent.jsp"; /** * The main edit cost form. * * @return A standard Stripes object. */ public Resolution form() { return new ForwardResolution(DIALOG_VIEW); } /** * Exporting the content of all the plans to an XML file. * * @return Default Stripes object. * @throws javax.xml.bind.JAXBException * @throws java.io.UnsupportedEncodingException */ @RolesAllowed({"administrator", "user"}) public Resolution exportall() throws JAXBException, UnsupportedEncodingException, IOException { Calendar calendar = Calendar.getInstance(); SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy"); Date toDateDB = null; try { Date date = formatter.parse(to); toDateDB = date; } catch (ParseException e) { e.printStackTrace(); } calendar.setTime(toDateDB); calendar.add(Calendar.DATE, 1); Date nextDateToDate = calendar.getTime(); Date fromDateDB = null; try { Date date = formatter.parse(from); fromDateDB = date; } catch (ParseException e) { e.printStackTrace(); } String[] fromArray = from.split("-"); String dayFrom = fromArray[0]; String monthFrom = fromArray[1]; String yearFrom = fromArray[2]; String fromReverse = yearFrom + "-" + monthFrom + "-" + dayFrom; String[] toArray = to.split("-"); String dayTo = toArray[0]; String monthTo = toArray[1]; String yearTo = toArray[2]; String toReverse = yearTo + "-" + monthTo + "-" + dayTo; List<PlanBean> planBeanList = planManager.getAllCompletedPlansByCountryOfTheActualUser(email, completed, fromDateDB, nextDateToDate); return XMLManager.export(PlanXML.class, new PlanXML().populateMultiple(planBeanList, fromReverse, toReverse, email), "Plan_Multiple_" + new Date().toString() + ".xml"); } protected boolean completed; protected String radio; public void setRadio(String radio) { this.radio = radio; if (radio.equals("all")) { completed = false; } else { completed = true; } } public String getRadio() { return radio; } protected String from; protected String to; protected String fromDate; protected String toDate; public void setFrom(String from) { this.from = from; } public String getFrom() { return from; } public void setTo(String to) { this.to = to; } public String getTo() { return to; } }
[ "emanuela.epure@ext.jrc.ec.europa.eu" ]
emanuela.epure@ext.jrc.ec.europa.eu
3a73bac98144a23abcb640e28f057db7b1f2edc2
d79c1c94f6486b34d1909311ab681557c4be173c
/franca_webidl/org.waml.w3c.webidl/src/org/waml/w3c/webidl/postprocessing/Helper.java
2ddb1fd17c7696f3479f39393ac2897c5cdb6353
[]
no_license
francalab/francalab-misc
1e018d8fbdbbde1dca687272f79a25605a491d1b
cfb16324ce87621f18d27acf7b4b0da731dba212
refs/heads/master
2021-01-13T16:10:10.139411
2013-04-23T19:44:38
2013-04-23T19:44:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
75
java
package org.waml.w3c.webidl.postprocessing; public class Helper { }
[ "klaus.birken@gmail.com" ]
klaus.birken@gmail.com
bf752c2280831c2efe61917c1ea976dc62b846b4
74bc3a1fd6ded5fee51de40fb0822be155555c2c
/gasoline/src/java/com/stepup/gasoline/qt/vendor/oil/VendorFormAction.java
7a577f7a71bb4cec3ee2a8029bf470aef554c125
[]
no_license
phuongtu1983/quangtrung
0863f7a6125918faaaffb6e27fad366369885cb6
ece90b4876c8680ee6d386e950db2fbb0208a56a
refs/heads/master
2021-06-05T07:21:30.227630
2020-10-07T02:12:19
2020-10-07T02:12:19
130,137,918
0
0
null
null
null
null
UTF-8
Java
false
false
2,872
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.stepup.gasoline.qt.vendor.oil; import com.stepup.core.util.NumberUtil; import com.stepup.gasoline.qt.bean.VendorBean; import com.stepup.gasoline.qt.core.DynamicFieldValueAction; import com.stepup.gasoline.qt.dao.OrganizationDAO; import com.stepup.gasoline.qt.dao.VendorDAO; import com.stepup.gasoline.qt.util.Constants; import com.stepup.gasoline.qt.util.QTUtil; import com.stepup.gasoline.qt.vendor.VendorFormBean; import java.util.ArrayList; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.validator.GenericValidator; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMapping; /** * * @author phuongtu */ public class VendorFormAction extends DynamicFieldValueAction { /** * This is the action called from the Struts framework. * * @param mapping The ActionMapping used to select this instance. * @param form The optional ActionForm bean for this request. * @param request The HTTP Request we are processing. * @param response The HTTP Response we are processing. * @throws java.lang.Exception * @return */ @Override public boolean doMainAction(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { VendorOilFormBean formBean = null; String vendorid = request.getParameter("vendorId"); VendorDAO vendorDAO = new VendorDAO(); ArrayList arrStoreDetail = null; if (!GenericValidator.isBlankOrNull(vendorid)) { try { int id = NumberUtil.parseInt(vendorid, 0); VendorFormBean vendorBean = vendorDAO.getVendor(id); if (vendorBean != null) { formBean = new VendorOilFormBean(vendorBean); } arrStoreDetail = vendorDAO.getVendorOilStoreDetail(id); } catch (Exception ex) { } } if (formBean == null) { formBean = new VendorOilFormBean(); } request.setAttribute(Constants.VENDOR_OIL, formBean); if (arrStoreDetail == null) { arrStoreDetail = new ArrayList(); } request.setAttribute(Constants.VENDOR_OIL_STORE, arrStoreDetail); ArrayList arrStore = null; try { OrganizationDAO organizationDAO = new OrganizationDAO(); arrStore = organizationDAO.getStores(QTUtil.getOrganizationManageds(request.getSession()), VendorBean.IS_OIL); } catch (Exception ex) { } if (arrStore == null) { arrStore = new ArrayList(); } request.setAttribute(Constants.STORE_LIST, arrStore); return true; } }
[ "phuongtu1983@gmail.com" ]
phuongtu1983@gmail.com
e4fbb28ab5c617a683e2369adb0b02a52f15aefd
25850244bc3ea8faf259ad4725bdc13e7bc39517
/fusionchart_api/src/com/raisepartner/chartfusion/generator/metadata/MetaAttribute.java
458e0465bf9fd302cdf598dfff754a3b22fbe7cd
[]
no_license
xuzhf/gwt-fusionchart
f9cb2c2a9702bc0a29d2ad78f3ae61e3bf6b43a5
8bfff1896a22f9af12c8f9c23c7b900526d6875d
refs/heads/master
2020-04-30T13:56:39.550148
2010-01-12T09:59:55
2010-01-12T09:59:55
42,157,691
0
0
null
null
null
null
UTF-8
Java
false
false
2,347
java
/** * Copyright (c) 2008 Raise Partner * 22, av. Doyen Louis Weil, * 38000 Grenoble, France * All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Contact: sebastien@chassande.fr */ package com.raisepartner.chartfusion.generator.metadata; import com.raisepartner.chartfusion.generator.StringUtils; public class MetaAttribute { public String name; public String type; public String rangeValue; public String description; public MetaAttribute() { } public MetaAttribute(String name) { this.name = name; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getRangeValue() { return rangeValue == null ? "" : rangeValue; } public void setRangeValue(String rangeValue) { this.rangeValue = rangeValue; } public String getType() { return type == null ? "" : type; } public void setType(String type) { this.type = type; } public String getFirstUpperName() { return StringUtils.firstLetterUpper(name); } public String getUpperName() { return name.toUpperCase(); } public String get70WrappedDescription() { if (description == null) { return ""; } return StringUtils.wrap(description, 70, "\t * "); } public int hashCode() { return name.hashCode(); } public boolean equals(Object o) { if (!(o instanceof MetaAttribute)) { return false; } MetaAttribute a = (MetaAttribute) o; return name.equals(a.name); } }
[ "chassande@3e7d0e48-ab55-0410-a05d-cfcde8f17f65" ]
chassande@3e7d0e48-ab55-0410-a05d-cfcde8f17f65
64151ff22ed1a495c4ebb607596492732c0b001d
bdf23b69b1a6765bee8ef5097ebc850bc4740891
/app/src/main/java/com/charlottechia/cardatabase/DBHelper.java
3cbc7b461441622bbfec2f3ce87c69262440f0dd
[]
no_license
17010582/CarDatabase
5cb744c3e6183c19bfdbd6173e7be8be85809802
7f0346897519c27ed34b6e124ae2e8d43916c636
refs/heads/master
2020-05-23T01:04:30.117573
2019-05-14T08:44:15
2019-05-14T08:44:15
186,581,797
0
0
null
null
null
null
UTF-8
Java
false
false
2,673
java
package com.charlottechia.cardatabase; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.util.Log; import java.util.ArrayList; public class DBHelper extends SQLiteOpenHelper { private static final int DATABASE_VER = 1; private static final String DATABASE_NAME = "cars.db"; private static final String TABLE_CAR = "task"; private static final String COLUMN_ID = "_id"; private static final String COLUMN_BRAND = "brand"; private static final String COLUMN_LITRE = "litre"; public DBHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VER); } @Override public void onCreate(SQLiteDatabase db) { String createTableSql = "CREATE TABLE " + TABLE_CAR + "(" + COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT," + COLUMN_BRAND + " TEXT," + COLUMN_LITRE + " TEXT )"; db.execSQL(createTableSql); Log.i("info" ,"created tables"); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { // Drop older table if existed db.execSQL("DROP TABLE IF EXISTS " + TABLE_CAR); // Create table(s) again onCreate(db); } public void insertCar(String brand, double litre){ // Get an instance of the database for writing SQLiteDatabase db = this.getWritableDatabase(); // We use ContentValues object to store the values for // the db operation ContentValues values = new ContentValues(); values.put(COLUMN_BRAND, brand); values.put(COLUMN_LITRE, litre); db.insert(TABLE_CAR, null, values); // Close the database connection db.close(); } public ArrayList<Car> getCar() { ArrayList<Car> cars = new ArrayList<>(); String selectQuery = "SELECT " + COLUMN_ID + ", " + COLUMN_BRAND + ", " + COLUMN_LITRE + " FROM " + TABLE_CAR; SQLiteDatabase db = this.getReadableDatabase(); Cursor cursor = db.rawQuery(selectQuery, null); if (cursor.moveToFirst()) { do { int id = cursor.getInt(0); String brand = cursor.getString(1); double litre = cursor.getDouble(2); Car obj = new Car(id, brand, litre); cars.add(obj); } while (cursor.moveToNext()); } cursor.close(); db.close(); return cars; } }
[ "17010582@myrp.edu.sg" ]
17010582@myrp.edu.sg
0cd9b606942b39a6d4e47f5922cffd5bd2e95b03
faba4b56c5a11b4cf587c22cce1a361d5260d9db
/src/main/java/com/metropolitan/methotels727/services/FacebookServiceInformation.java
d76592cd77777846433bed0986e1612a70331bd1
[]
no_license
MiroslavStipanovic727/IT250DZMetHotels727
17273da84b165f70bf86d1d7d955a5d468c8195d
47f662bf8d55eed154b4b343e9f752ed25c5c1dc
refs/heads/master
2021-01-20T08:48:57.546414
2015-08-17T18:06:35
2015-08-17T18:07:05
33,380,303
0
0
null
null
null
null
UTF-8
Java
false
false
612
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.metropolitan.methotels727.services; /** * * @author Miroslav Stipanović 727 */ public class FacebookServiceInformation { private String actionToken; public boolean isLoggedIn() { return actionToken != null; } public String getAccessToken() { return actionToken; } public void setActionToken(String actionToken) { this.actionToken = actionToken; } }
[ "" ]
ba7d75907bba7a6b4bf4a437b5acde6ba5326243
bda443c34ee9aaa67e29678bdfbab42818f70f19
/src/ui/DialogPetImage.java
fffa6a1e6a45acfa2861188541e0d5fc660373be
[]
no_license
hufangzheng/PetServe
6fb05f2efd76de46c05f1d28f8dd7b8c9ecc55a8
181ce1ff395f1af92f6106a09176d9b79be42e2f
refs/heads/master
2020-04-02T08:37:07.450667
2018-10-23T02:55:37
2018-10-23T02:55:37
154,252,336
0
0
null
null
null
null
UTF-8
Java
false
false
775
java
package ui; import javax.swing.*; import java.awt.*; import java.sql.Blob; import java.sql.SQLException; import model.*; public class DialogPetImage extends JDialog { private ImageIcon petImage = null; private JLabel jbl = new JLabel(); public DialogPetImage(JDialog jDialog, String title, boolean modal, Blob image) { super(jDialog, title, modal); try { byte[] buff = image.getBytes(1, image.getBinaryStream().available()); petImage = new ImageIcon(buff); jbl.setIcon(petImage); this.setSize(petImage.getIconWidth(), petImage.getIconHeight()); this.getContentPane().add(jbl, BorderLayout.CENTER); } catch (Exception e) { e.printStackTrace(); } } }
[ "1154648074@qq.com" ]
1154648074@qq.com
4063035c54f75d3b4cd2a36b05660418a0fa6004
6de3fc42b03491ebb4874b68820f538250be47e2
/src/main/java/myRedis/commands/LRANGECommand.java
f549aee3f72fb626100fe7127741094b1a1d8254
[]
no_license
isstars/Medis
f47dd57cdd1fae5a37b263e64a807b223b565408
9d814ff9abd1f2d7c5b3c8895bf8491d6370b69d
refs/heads/master
2021-07-10T14:42:12.871323
2019-08-24T12:39:35
2019-08-24T12:39:35
203,994,632
0
0
null
null
null
null
UTF-8
Java
false
false
938
java
package myRedis.commands; import myRedis.Command; import myRedis.Database; import myRedis.Protocol; import java.io.IOException; import java.io.OutputStream; import java.util.List; public class LRANGECommand implements Command { private List<Object> args; @Override public void setArgs(List<Object> args) { this.args = args; } @Override public void run(OutputStream os) throws IOException { String key = new String((byte[])args.get(0)); int start = Integer.parseInt(new String((byte[])args.get(1))); int end = Integer.parseInt(new String((byte[])args.get(2))); List<String> list = Database.getList(key); if (end < 0){ end = list.size() + end; } List<String> result = list.subList(start,end+1); try { Protocol.writeArray(os,result); } catch (Exception e) { e.printStackTrace(); } } }
[ "sustmq@163.com" ]
sustmq@163.com
772255fea027d3f616a83c0b5eb29b6c1477a9e5
a9282c6dc10561eb98e122a37ef579ad17f249da
/app/src/main/java/com/youdu/zxing/app/CaptureActivity.java
8043cb5dc256051c934371a678d8d27682eee2ea
[]
no_license
aswddads/Client_Code
40345f9c9824ea077c072ba4badf38d0140b3888
3ef1c297be3661e1c6da41d7c9caefa68d1f3dc5
refs/heads/master
2020-12-02T21:22:12.751023
2017-07-05T09:37:52
2017-07-05T09:37:52
96,303,068
0
0
null
null
null
null
UTF-8
Java
false
false
23,958
java
/* * Copyright (C) 2008 ZXing 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 com.youdu.zxing.app; import android.app.Activity; import android.app.AlertDialog; import android.content.Intent; import android.content.SharedPreferences; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Rect; import android.net.Uri; import android.os.Bundle; import android.os.Handler; import android.os.Looper; import android.os.Message; import android.preference.PreferenceManager; import android.util.Log; import android.view.KeyEvent; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.view.View; import android.view.View.OnClickListener; import android.view.Window; import android.view.WindowManager; import android.widget.Button; import android.widget.Toast; import com.google.zxing.BarcodeFormat; import com.google.zxing.BinaryBitmap; import com.google.zxing.DecodeHintType; import com.google.zxing.EncodeHintType; import com.google.zxing.Result; import com.google.zxing.ResultMetadataType; import com.google.zxing.ResultPoint; import com.google.zxing.WriterException; import com.google.zxing.common.BitMatrix; import com.google.zxing.common.HybridBinarizer; import com.google.zxing.qrcode.QRCodeReader; import com.google.zxing.qrcode.QRCodeWriter; import com.youdu.R; import com.youdu.zxing.camera.CameraManager; import com.youdu.zxing.decode.BeepManager; import com.youdu.zxing.decode.CaptureActivityHandler; import com.youdu.zxing.decode.DecodeFormatManager; import com.youdu.zxing.decode.FinishListener; import com.youdu.zxing.decode.InactivityTimer; import com.youdu.zxing.decode.Intents; import com.youdu.zxing.decode.RGBLuminanceSource; import com.youdu.zxing.util.Util; import com.youdu.zxing.view.ViewfinderView; import java.io.IOException; import java.util.HashSet; import java.util.Hashtable; import java.util.Map; import java.util.Set; import java.util.Vector; /** * The barcode reader activity itself. This is loosely based on the * CameraPreview example included in the Android SDK. * * @author dswitkin@google.com (Daniel Switkin) * @author Sean Owen * * 项目中扫描的Activity * */ public final class CaptureActivity extends Activity implements SurfaceHolder.Callback { private static final String TAG = CaptureActivity.class.getSimpleName(); private static final long INTENT_RESULT_DURATION = 1500L; private static final long BULK_MODE_SCAN_DELAY_MS = 1000L; private static final String PRODUCT_SEARCH_URL_PREFIX = "http://www.google"; private static final String PRODUCT_SEARCH_URL_SUFFIX = "/m/products/scan"; private static final String ZXING_URL = "http://zxing.appspot.com/scan"; private static final String RETURN_URL_PARAM = "ret"; private static final Set<ResultMetadataType> DISPLAYABLE_METADATA_TYPES; static { DISPLAYABLE_METADATA_TYPES = new HashSet<ResultMetadataType>(5); DISPLAYABLE_METADATA_TYPES.add(ResultMetadataType.ISSUE_NUMBER); DISPLAYABLE_METADATA_TYPES.add(ResultMetadataType.SUGGESTED_PRICE); DISPLAYABLE_METADATA_TYPES.add(ResultMetadataType.ERROR_CORRECTION_LEVEL); DISPLAYABLE_METADATA_TYPES.add(ResultMetadataType.POSSIBLE_COUNTRY); } private enum Source { NATIVE_APP_INTENT, PRODUCT_SEARCH_LINK, ZXING_LINK, NONE } private CaptureActivityHandler handler; private ViewfinderView viewfinderView; private Button mButtonBack; private Button createBtn; private Button photoBtn; private Button flashBtn; private Result lastResult; private boolean hasSurface; private Source source; private String sourceUrl; private String returnUrlTemplate; private Vector<BarcodeFormat> decodeFormats; private String characterSet; private InactivityTimer inactivityTimer; private BeepManager beepManager; private boolean isFlash = false; private int REQUEST_CODE = 3; public ViewfinderView getViewfinderView() { return viewfinderView; } public Handler getHandler() { return handler; } @Override public void onCreate(Bundle icicle) { requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); super.onCreate(icicle); Window window = getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(R.layout.activity_qrcode_capture_layout); Util.currentActivity = this; CameraManager.init(getApplication()); viewfinderView = (ViewfinderView) findViewById(R.id.viewfinder_view); /** * 找到添加的按钮并注册点击事件 */ mButtonBack = (Button) findViewById(R.id.button_back); mButtonBack.setOnClickListener(click); createBtn = (Button) findViewById(R.id.qrcode_btn); createBtn.setOnClickListener(click); photoBtn = (Button) findViewById(R.id.photo_btn); photoBtn.setOnClickListener(click); flashBtn = (Button) findViewById(R.id.flash_btn); flashBtn.setOnClickListener(click); surfaceView = (SurfaceView) findViewById(R.id.preview_view); surfaceHolder = surfaceView.getHolder(); surfaceHolder.addCallback(this); surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); hasSurface = false; inactivityTimer = new InactivityTimer(this); handler = null; lastResult = null; hasSurface = false; inactivityTimer = new InactivityTimer(this); beepManager = new BeepManager(this); // showHelpOnFirstLaunch(); } SurfaceView surfaceView; SurfaceHolder surfaceHolder; /** * 闪光灯点击事件 */ private OnClickListener click = new OnClickListener() { @Override public void onClick(View v) { int id = v.getId(); if (id == R.id.button_back) { finish(); } else if (id == R.id.flash_btn) { if (!isFlash) { CameraManager.get().turnLightOn(); } else { CameraManager.get().turnLightOff(); } isFlash = !isFlash; } else if (id == R.id.photo_btn) { // 打开手机中的相册 Intent innerIntent = new Intent(Intent.ACTION_GET_CONTENT); // "android.intent.action.GET_CONTENT" innerIntent.setType("image/*"); Intent wrapperIntent = Intent.createChooser(innerIntent, "选择二维码图片"); startActivityForResult(wrapperIntent, REQUEST_CODE); } else if (id == R.id.qrcode_btn) { // 跳转到生成二维码页面 Bitmap b = createQRCode(); Intent intent = getIntent(); intent.putExtra("QR_CODE", b); setResult(200, intent); finish(); } } }; @SuppressWarnings("deprecation") @Override protected void onResume() { super.onResume(); resetStatusView(); if (hasSurface) { // The activity was paused but not stopped, so the surface still // exists. Therefore // surfaceCreated() won't be called, so init the camera here. initCamera(surfaceHolder); } else { // Install the callback and wait for surfaceCreated() to init the // camera. Log.e("CaptureActivity", "onResume"); } Intent intent = getIntent(); String action = intent == null ? null : intent.getAction(); String dataString = intent == null ? null : intent.getDataString(); if (intent != null && action != null) { if (action.equals(Intents.Scan.ACTION)) { // Scan the formats the intent requested, and return the result // to the calling activity. source = Source.NATIVE_APP_INTENT; decodeFormats = DecodeFormatManager.parseDecodeFormats(intent); } else if (dataString != null && dataString.contains(PRODUCT_SEARCH_URL_PREFIX) && dataString.contains(PRODUCT_SEARCH_URL_SUFFIX)) { // Scan only products and send the result to mobile Product // Search. source = Source.PRODUCT_SEARCH_LINK; sourceUrl = dataString; decodeFormats = DecodeFormatManager.PRODUCT_FORMATS; } else if (dataString != null && dataString.startsWith(ZXING_URL)) { // Scan formats requested in query string (all formats if none // specified). // If a return URL is specified, send the results there. // Otherwise, handle it ourselves. source = Source.ZXING_LINK; sourceUrl = dataString; Uri inputUri = Uri.parse(sourceUrl); returnUrlTemplate = inputUri.getQueryParameter(RETURN_URL_PARAM); decodeFormats = DecodeFormatManager.parseDecodeFormats(inputUri); } else { // Scan all formats and handle the results ourselves (launched // from Home). source = Source.NONE; decodeFormats = null; } characterSet = intent.getStringExtra(Intents.Scan.CHARACTER_SET); } else { source = Source.NONE; decodeFormats = null; characterSet = null; } beepManager.updatePrefs(); } @Override protected void onPause() { super.onPause(); if (handler != null) { handler.quitSynchronously(); handler = null; } CameraManager.get().closeDriver(); } @Override protected void onDestroy() { inactivityTimer.shutdown(); super.onDestroy(); } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { if (source == Source.NATIVE_APP_INTENT) { setResult(RESULT_CANCELED); finish(); return true; } else if ((source == Source.NONE || source == Source.ZXING_LINK) && lastResult != null) { resetStatusView(); if (handler != null) { handler.sendEmptyMessage(R.id.restart_preview); } return true; } } else if (keyCode == KeyEvent.KEYCODE_FOCUS || keyCode == KeyEvent.KEYCODE_CAMERA) { // Handle these events so they don't launch the Camera app return true; } return super.onKeyDown(keyCode, event); } @Override public void surfaceCreated(SurfaceHolder holder) { if (!hasSurface) { hasSurface = true; initCamera(holder); } } @Override public void surfaceDestroyed(SurfaceHolder holder) { hasSurface = false; } @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { } /** * A valid barcode has been found, so give an indication of success and show * the results. * * @param rawResult The contents of the barcode. * @param barcode A greyscale bitmap of the camera data which was decoded. */ public void handleDecode(Result rawResult, Bitmap barcode) { inactivityTimer.onActivity(); lastResult = rawResult; if (barcode == null) { // This is from history -- no saved barcode handleDecodeInternally(rawResult, null); } else { beepManager.playBeepSoundAndVibrate(); drawResultPoints(barcode, rawResult); switch (source) { case NATIVE_APP_INTENT: case PRODUCT_SEARCH_LINK: handleDecodeExternally(rawResult, barcode); break; case ZXING_LINK: if (returnUrlTemplate == null) { handleDecodeInternally(rawResult, barcode); } else { handleDecodeExternally(rawResult, barcode); } break; case NONE: SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); if (prefs.getBoolean(PreferencesActivity.KEY_BULK_MODE, false)) { Toast.makeText(this, R.string.msg_bulk_mode_scanned, Toast.LENGTH_SHORT).show(); // Wait a moment or else it will scan the same barcode // continuously about 3 times if (handler != null) { handler.sendEmptyMessageDelayed(R.id.restart_preview, BULK_MODE_SCAN_DELAY_MS); } resetStatusView(); } else { handleDecodeInternally(rawResult, barcode); } break; } } } /** * Superimpose a line for 1D or dots for 2D to highlight the key features of * the barcode. * * @param barcode A bitmap of the captured image. * @param rawResult The decoded results which contains the points to draw. */ private void drawResultPoints(Bitmap barcode, Result rawResult) { ResultPoint[] points = rawResult.getResultPoints(); if (points != null && points.length > 0) { Canvas canvas = new Canvas(barcode); Paint paint = new Paint(); paint.setColor(getResources().getColor(R.color.result_image_border)); paint.setStrokeWidth(3.0f); paint.setStyle(Paint.Style.STROKE); Rect border = new Rect(2, 2, barcode.getWidth() - 2, barcode.getHeight() - 2); canvas.drawRect(border, paint); paint.setColor(getResources().getColor(R.color.result_points)); if (points.length == 2) { paint.setStrokeWidth(4.0f); drawLine(canvas, paint, points[0], points[1]); } else if (points.length == 4 && (rawResult.getBarcodeFormat().equals(BarcodeFormat.UPC_A)) || (rawResult.getBarcodeFormat().equals(BarcodeFormat.EAN_13))) { // Hacky special case -- draw two lines, for the barcode and // metadata drawLine(canvas, paint, points[0], points[1]); drawLine(canvas, paint, points[2], points[3]); } else { paint.setStrokeWidth(10.0f); for (ResultPoint point : points) { canvas.drawPoint(point.getX(), point.getY(), paint); } } } } private static void drawLine(Canvas canvas, Paint paint, ResultPoint a, ResultPoint b) { canvas.drawLine(a.getX(), a.getY(), b.getX(), b.getY(), paint); } // Put up our own UI for how to handle the decoded contents. @SuppressWarnings("unchecked") private void handleDecodeInternally(Result rawResult, Bitmap barcode) { viewfinderView.setVisibility(View.GONE); Map<ResultMetadataType, Object> metadata = (Map<ResultMetadataType, Object>) rawResult.getResultMetadata(); if (metadata != null) { StringBuilder metadataText = new StringBuilder(20); for (Map.Entry<ResultMetadataType, Object> entry : metadata.entrySet()) { if (DISPLAYABLE_METADATA_TYPES.contains(entry.getKey())) { metadataText.append(entry.getValue()).append('\n'); } } if (metadataText.length() > 0) { metadataText.setLength(metadataText.length() - 1); } } } // Briefly show the contents of the barcode, then handle the result outside // Barcode Scanner. private void handleDecodeExternally(Result rawResult, Bitmap barcode) { viewfinderView.drawResultBitmap(barcode); // Since this message will only be shown for a second, just tell the // user what kind of // barcode was found (e.g. contact info) rather than the full contents, // which they won't // have time to read. if (source == Source.NATIVE_APP_INTENT) { // Hand back whatever action they requested - this can be changed to // Intents.Scan.ACTION when // the deprecated intent is retired. Intent intent = new Intent(getIntent().getAction()); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); intent.putExtra(Intents.Scan.RESULT, rawResult.toString()); intent.putExtra(Intents.Scan.RESULT_FORMAT, rawResult.getBarcodeFormat().toString()); Message message = Message.obtain(handler, R.id.return_scan_result); message.obj = intent; handler.sendMessageDelayed(message, INTENT_RESULT_DURATION); } else if (source == Source.PRODUCT_SEARCH_LINK) { // Reformulate the URL which triggered us into a query, so that the // request goes to the same // TLD as the scan URL. Message message = Message.obtain(handler, R.id.launch_product_query); // message.obj = sourceUrl.substring(0, end) + "?q=" + // resultHandler.getDisplayContents().toString() // + "&source=zxing"; handler.sendMessageDelayed(message, INTENT_RESULT_DURATION); } else if (source == Source.ZXING_LINK) { // Replace each occurrence of RETURN_CODE_PLACEHOLDER in the // returnUrlTemplate // with the scanned code. This allows both queries and REST-style // URLs to work. Message message = Message.obtain(handler, R.id.launch_product_query); // message.obj = returnUrlTemplate.replace(RETURN_CODE_PLACEHOLDER, // resultHandler.getDisplayContents() // .toString()); handler.sendMessageDelayed(message, INTENT_RESULT_DURATION); } } private void initCamera(SurfaceHolder surfaceHolder) { try { /** * use a CameraManager to manager the camera's life cycles */ CameraManager.get().openDriver(surfaceHolder); } catch (IOException ioe) { Log.w(TAG, ioe); displayFrameworkBugMessageAndExit(); return; } catch (RuntimeException e) { // Barcode Scanner has seen crashes in the wild of this variety: // java.?lang.?RuntimeException: Fail to connect to camera service Log.e(TAG, "Unexpected error initializating camera", e); displayFrameworkBugMessageAndExit(); return; } if (handler == null) { handler = new CaptureActivityHandler(this, decodeFormats, characterSet); } } private void displayFrameworkBugMessageAndExit() { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(getString(R.string.app_name)); builder.setMessage(getString(R.string.msg_camera_framework_bug)); builder.setPositiveButton(R.string.button_ok, new FinishListener(this)); builder.setOnCancelListener(new FinishListener(this)); builder.show(); } private void resetStatusView() { viewfinderView.setVisibility(View.VISIBLE); lastResult = null; } public void drawViewfinder() { viewfinderView.drawViewfinder(); } private Uri uri; @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == RESULT_OK) { uri = data.getData(); new Thread(new Runnable() { @Override public void run() { Result result = scanningImage(uri); if (result == null) { Looper.prepare(); Toast.makeText(getApplicationContext(), "图片格式有误", Toast.LENGTH_SHORT).show(); Looper.loop(); } else { // 数据返回,在这里去处理扫码结果 String recode = (result.toString()); Intent data = new Intent(); data.putExtra("result", recode); setResult(300, data); finish(); } } }).start(); } } protected Result scanningImage(Uri path) { if (path == null || path.equals("")) { return null; } // DecodeHintType 和EncodeHintType Hashtable<DecodeHintType, String> hints = new Hashtable<DecodeHintType, String>(); hints.put(DecodeHintType.CHARACTER_SET, "utf-8"); // 设置二维码内容的编码 try { Bitmap scanBitmap = BitmapFactory.decodeStream(getContentResolver().openInputStream(uri)); RGBLuminanceSource source = new RGBLuminanceSource(scanBitmap); BinaryBitmap bitmap1 = new BinaryBitmap(new HybridBinarizer(source)); QRCodeReader reader = new QRCodeReader(); return reader.decode(bitmap1, hints); } catch (Exception e) { e.printStackTrace(); } return null; } private Bitmap createQRCode() { int QR_WIDTH = 100; int QR_HEIGHT = 100; try { // 需要引入core包 QRCodeWriter writer = new QRCodeWriter(); String text = Util.getIMEI(this); if (text == null || "".equals(text) || text.length() < 1) { return null; } // 把输入的文本转为二维码 BitMatrix martix = writer.encode(text, BarcodeFormat.QR_CODE, QR_WIDTH, QR_HEIGHT); System.out.println("w:" + martix.getWidth() + "h:" + martix.getHeight()); Hashtable<EncodeHintType, String> hints = new Hashtable<EncodeHintType, String>(); hints.put(EncodeHintType.CHARACTER_SET, "utf-8"); BitMatrix bitMatrix = new QRCodeWriter().encode(text, BarcodeFormat.QR_CODE, QR_WIDTH, QR_HEIGHT, hints); int[] pixels = new int[QR_WIDTH * QR_HEIGHT]; for (int y = 0; y < QR_HEIGHT; y++) { for (int x = 0; x < QR_WIDTH; x++) { if (bitMatrix.get(x, y)) { pixels[y * QR_WIDTH + x] = 0xff000000; } else { pixels[y * QR_WIDTH + x] = 0xffffffff; } } } // cheng chen de er wei ma Bitmap bitmap = Bitmap.createBitmap(QR_WIDTH, QR_HEIGHT, Bitmap.Config.ARGB_8888); bitmap.setPixels(pixels, 0, QR_WIDTH, 0, 0, QR_WIDTH, QR_HEIGHT); return bitmap; } catch (WriterException e) { e.printStackTrace(); } return null; } }
[ "782759668@qq.com" ]
782759668@qq.com
2e2c9706d2c4f3cc782fd3b5c65ddb8437dfba46
97a965ebaf6eaf624e6cb40bb8fa604c5fe456aa
/src/main/java/pi/faktura/model/Carrier.java
8bd6aee28da470fb5aa8b46e532ead45274c7183
[]
no_license
MLazarevic36/pi-invoice
72e51d1008b9f417ec8355507d37c20b3a75dcff
eef3d5164e03cba1a564f66dbef459db93c494f8
refs/heads/master
2021-02-15T10:34:18.050409
2020-04-28T14:12:17
2020-04-28T14:12:17
244,889,838
0
0
null
null
null
null
UTF-8
Java
false
false
1,928
java
package pi.faktura.model; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import javax.persistence.*; import java.io.Serializable; import java.util.HashSet; import java.util.Set; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; import static javax.persistence.CascadeType.ALL; import static javax.persistence.FetchType.LAZY; @Entity @Table(name = "carriers") public class Carrier implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "carrier_id", unique = true, nullable = false) private Long id; @Column(name="name", unique=false, nullable=false, length = 50) private String name; @OneToMany(cascade = { ALL }, fetch = LAZY, mappedBy = "carrier") private Set<Dispatch_note> dispatch_notes = new HashSet<Dispatch_note>(); @Column(name="deleted", columnDefinition="BOOLEAN DEFAULT FALSE") private Boolean deleted; public Carrier() { } public Carrier(String name, Set<Dispatch_note> dispatch_notes, Boolean deleted) { this.name = name; this.dispatch_notes = dispatch_notes; this.deleted = deleted; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Set<Dispatch_note> getDispatch_notes() { return dispatch_notes; } public void setDispatch_notes(Set<Dispatch_note> dispatch_notes) { this.dispatch_notes = dispatch_notes; } public Boolean getDeleted() { return deleted; } public void setDeleted(Boolean deleted) { this.deleted = deleted; } }
[ "hrle96ab@gmail.com" ]
hrle96ab@gmail.com
ff10cb1a9ccc8a479ec2303246b4ad88078dacb6
fe784efd75f01a6c764375e0d3b17a3ba1f8ff3f
/src/main/java/com/ali/java/jalo/Logger.java
43efe6de9e8edf053b5df77a79c669c0c38b31a4
[]
no_license
AliOpenSourceSoftware/JaLo
b9c653dd040918cd78f6af016988a46d8ff5dfaf
3e23f6e2df4857021af31c6abef948c3600b15fa
refs/heads/master
2021-07-06T07:05:38.465326
2017-09-27T19:17:26
2017-09-27T19:17:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,156
java
package com.ali.java.jalo; import java.util.Vector; import java.util.logging.Level; public class Logger { public static java.util.logging.Logger jlogger = java.util.logging.Logger.getLogger(Logger.class.getCanonicalName()); public static String fileName=null; public Logger() { super(); init(); } public static boolean isInit = false; public static void init() { if(!isInit){ LoggerHandler handler = new LoggerHandler(fileName); Vector<Level> acceptableLevels = new Vector<Level>(); acceptableLevels.add(Level.INFO); acceptableLevels.add(Level.SEVERE); java.util.logging.Filter filter = new Filter(acceptableLevels); Formatter formatter = new Formatter(); handler.setFilter(filter); handler.setFormatter(formatter); jlogger.addHandler(handler); jlogger.setUseParentHandlers(true); isInit = true; } } /** * Info logging method * @param msg */ public void infop(String msg){ jlogger.log(Level.INFO ,msg); } /** * Info logging method * @param caller * @param method * @param msg */ public void infop(Object caller, String method,String msg){ if(caller!=null) { jlogger.logp(Level.INFO ,caller.getClass().getCanonicalName(),method,msg); }else { jlogger.logp(Level.INFO, this.getClass().getCanonicalName(), method, msg); } } /** * Static Info logging method * @param caller * @param method * @param msg */ public static void info(Object caller, String method,String msg){ if(caller!=null) { jlogger.logp(Level.INFO ,caller.getClass().getCanonicalName(),method,msg); }else { jlogger.logp(Level.INFO, Logger.class.getCanonicalName(), method, msg); } } /** * Static info logging * @param msg */ public static void info(String msg){ jlogger.log(Level.INFO ,msg); } /** * warning log * @param msg */ public void warningp(String msg){ jlogger.log(Level.WARNING, msg); } /** * warning log * @param msg */ public void warningp(Object caller, String method, String msg){ if(caller!=null) { jlogger.logp(Level.WARNING,caller.getClass().getCanonicalName(),method, msg); } else { jlogger.logp(Level.WARNING, Logger.class.getCanonicalName(), method, msg); } } /** * warning log * @param msg */ public static void warning(Object caller, String method, String msg){ if(caller!=null) { jlogger.logp(Level.WARNING,caller.getClass().getCanonicalName(),method, msg); } else { jlogger.logp(Level.WARNING, Logger.class.getCanonicalName(), method, msg); } } /** * Static Warning log * @param msg */ public static void warning(String msg){ jlogger.log(Level.WARNING, msg); } /** * error log * @param msg */ public static void error(String msg){ jlogger.severe(msg); } public static void error(Object caller, String method, String msg){ if(caller !=null) jlogger.logp(Level.SEVERE, caller.getClass().getCanonicalName(), method, msg); else { jlogger.logp(Level.SEVERE, Logger.class.getCanonicalName(), method, msg); } } /** * error log * @param msg */ public void errorp(String msg){ jlogger.severe(msg); } /** * error log * @param msg */ public void errorp(Object caller, String method, String msg){ if(caller!=null) { jlogger.logp(Level.SEVERE, caller.getClass().getCanonicalName(), method, msg); } else { jlogger.logp(Level.SEVERE, this.getClass().getCanonicalName(), method, msg); } } /** * error log * @param msg */ public void errorp(Object caller, String method, String msg, Exception e){ if(caller!=null) { jlogger.logp(Level.SEVERE, caller.getClass().getCanonicalName(), method, msg,e); } else { jlogger.logp(Level.SEVERE, this.getClass().getCanonicalName(), method, msg,e); } } public static void error(Object caller, String method, String msg, Exception e){ if(caller!=null) { jlogger.logp(Level.SEVERE, caller.getClass().getCanonicalName(), method, msg,e); } else { jlogger.logp(Level.SEVERE, Logger.class.getCanonicalName(), method, msg); } } public static void severe(Object o,String method, String msg,Exception ex){ if(o ==null){ jlogger.logp(Level.SEVERE,Logger.class.getCanonicalName().toString(),method, msg,ex); }else{ jlogger.logp(Level.SEVERE,o.getClass().getCanonicalName(),method, msg, msg+ex.getMessage()); } } public static void severep(Object o,String method, String msg,Exception ex){ if(o ==null){ jlogger.logp(Level.SEVERE,Logger.class.getCanonicalName().toString(),method, msg,ex); }else{ jlogger.logp(Level.SEVERE,Logger.class.getCanonicalName(),method, msg, msg+ex.getMessage()); } } public static java.util.logging.Logger getLogger(String string) { return java.util.logging.Logger.getLogger(string); } public void logp(Level level, String msg) { jlogger.log(level, msg); } public void logp( String msg) { jlogger.log(Level.INFO, msg); } public static void log(Level level, String msg) { jlogger.log(level, msg); } public static void log( String msg) { jlogger.log(Level.INFO, msg); } }
[ "aaronali@hotmail.com" ]
aaronali@hotmail.com
6d2ac641cb15513674961ed5f21f5a8463225b36
732ba8e2f97b16bd9d7d2d70aebf82978c88cfa2
/kanguan/src/main/java/com/kanguan/entity/po/Subscription.java
a0f8bfdea81ce9e4149e2b650ed267103249a648
[ "MIT" ]
permissive
ZSSXL/kanguan
8e6ef45b7957f5d85b11b71f32e586505fb0cefb
de054ac7f0e9fbe2813433d9ee6fcdbfa14a3fdc
refs/heads/master
2022-12-10T21:17:54.868859
2020-06-28T01:59:29
2020-06-28T01:59:29
247,619,295
0
0
MIT
2022-06-17T03:03:20
2020-03-16T05:35:24
JavaScript
UTF-8
Java
false
false
953
java
package com.kanguan.entity.po; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.extension.activerecord.Model; import lombok.*; import java.io.Serializable; /** * @author ZSS * @date 2020/3/16 15:38 * @description 订阅表 */ @EqualsAndHashCode(callSuper = true) @Data @Builder @NoArgsConstructor @AllArgsConstructor @TableName(value = "kg_subscription") public class Subscription extends Model<Subscription> implements Serializable { /** * 订阅Id */ @TableId private String subId; /** * 订阅人 */ private String subscriber; /** * 订阅对象 */ private String subObject; /** * 创建时间 */ private String createTime; /** * 更新时间 */ private String updateTime; @Override protected Serializable pkVal() { return subId; } }
[ "1271130458@qq.com" ]
1271130458@qq.com
f0e3b6a6c361c8db71fb1a302c45ef7d64b5cd47
43da9f9ec2b853c9b480299ece2d5e875509854b
/src/main/java/ir/sharif/ap/view/ChatsRoomView.java
a5d90babaa5fa2309cdeabca630685380dd7d9fc
[]
no_license
iheydardoost/fesenjoonClient
6534f0bea36c45f0467717447da1b1b0597ac1b4
c01243a973a1d9622795e4acecab7ce55725195d
refs/heads/master
2023-07-18T20:44:09.495087
2021-09-06T17:04:49
2021-09-06T17:04:49
396,647,693
0
0
null
null
null
null
UTF-8
Java
false
false
125
java
package ir.sharif.ap.view; import com.airhacks.afterburner.views.FXMLView; public class ChatsRoomView extends FXMLView { }
[ "iheydardoost@yahoo.com" ]
iheydardoost@yahoo.com
5801d629d3a46a392ed62be9ffa3a32a6e52b03c
61237c148ef5b03bab56116f738a60cfb2ce3906
/src/main/java/net/onrc/openvirtex/messages/statistics/OVXTableStatsRequest.java
e3c1bb9246f0af4e155cd02eaabea61d9ee672d9
[ "Apache-2.0" ]
permissive
JayM-Oh/V-Sight
57f6cc0531692089ef6de0c46f305babfd8e5a35
e7b26478bbae9043657891a6657545a0f54fb970
refs/heads/main
2023-06-09T23:45:40.560739
2021-06-24T08:09:11
2021-06-24T08:09:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,608
java
/******************************************************************************* * Copyright 2014 Open Networking Laboratory * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * **************************************************************************** * Libera HyperVisor development based OpenVirteX for SDN 2.0 * * OpenFlow Version Up with OpenFlowj * * This is updated by Libera Project team in Korea University * * Author: Seong-Mun Kim (bebecry@gmail.com) ******************************************************************************/ package net.onrc.openvirtex.messages.statistics; import net.onrc.openvirtex.elements.datapath.OVXSwitch; import net.onrc.openvirtex.messages.OVXStatisticsReply; import net.onrc.openvirtex.messages.OVXStatisticsRequest; import org.projectfloodlight.openflow.protocol.*; import org.projectfloodlight.openflow.types.TableId; import org.projectfloodlight.openflow.types.U64; import java.util.LinkedList; import java.util.List; public class OVXTableStatsRequest extends OVXStatistics implements DevirtualizableStatistic { protected OFTableStatsRequest ofTableStatsRequest; protected OFTableStatsEntry ofTableStatsEntry; int OFPFW_ALL = (1 << 22) - 1; int OFPFW_NW_DST_SHIFT = 14; int OFPFW_NW_DST_ALL = 32 << OFPFW_NW_DST_SHIFT; public OVXTableStatsRequest(OFMessage ofMessage) { super(OFStatsType.TABLE); this.ofTableStatsRequest = (OFTableStatsRequest)ofMessage; } @Override public void devirtualizeStatistic(final OVXSwitch sw, final OVXStatisticsRequest msg) { OFFactory ofFactory = OFFactories.getFactory(msg.getOFMessage().getVersion()); List<OFTableStatsEntry> tableStatsEntries = new LinkedList<OFTableStatsEntry>(); if(ofFactory.getVersion() == OFVersion.OF_10) { this.ofTableStatsEntry = ofFactory.buildTableStatsEntry() .setActiveCount(sw.getFlowTable().getFlowTable().size()) .setTableId(TableId.of(1)) .setWildcards(OFPFW_ALL & ~OFPFW_NW_DST_ALL & ~OFPFW_NW_DST_ALL) .setName("Libera vFlowTable (incomplete)") .setMaxEntries(100000) .build(); tableStatsEntries.add(this.ofTableStatsEntry); }else { this.ofTableStatsEntry = ofFactory.buildTableStatsEntry() .setActiveCount(sw.getFlowTable().getFlowTable().size()) .setMatchedCount(U64.of(0)) .setLookupCount(U64.of(0)) .setTableId(TableId.of(1)) .build(); tableStatsEntries.add(this.ofTableStatsEntry); } OVXStatisticsReply reply = new OVXStatisticsReply( ofFactory.buildTableStatsReply() .setXid(msg.getOFMessage().getXid()) .setEntries(tableStatsEntries) .build() ); sw.sendMsg(reply, sw); } @Override public int hashCode() { return this.ofTableStatsEntry.hashCode(); } }
[ "ksyang@os.korea.ac.kr" ]
ksyang@os.korea.ac.kr
e13cd30dc702c38a3cf67f541943e6dcb3ef1065
ad641efadde67f0a9d5047ae2063489a4533d844
/src/main/java/com/overu/conversion/fragment/QualityFragment.java
4040f4f06f9b5146c9a303059dc14993e13c5115
[]
no_license
ouyanghang/conversion
30f72a92c13f85725b459bc84d04ae8e89386739
c249deb7093e79980865eabd8377941a86b8e19d
refs/heads/master
2021-01-18T16:31:59.667853
2013-09-15T16:06:15
2013-09-15T16:06:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
662
java
package com.overu.conversion.fragment; import com.overu.conversion.R; import javax.inject.Singleton; import android.os.Bundle; @Singleton public class QualityFragment extends PubFragment { @Override public String getBaseMSK() { return "quality_MKS"; } @Override public String getConverType() { return resources.getString(R.string.quality); } @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); this.showSinnper(); } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } }
[ "fengjianok@gmail.com" ]
fengjianok@gmail.com
991beae2f24f647055d47d11ad5f92bdb5c92c41
d3c5213a38fa5a11781a603ff11ff1d363887c81
/react/src/main/java/com/oumar/react/web/rest/vm/package-info.java
50d9ea381386e1ed2f17176b7265b1c7a45daeb8
[]
no_license
oumar-sh/jhipster-sample-app
e43a6fd153431677f68a790c729a0b1465994cb4
895586021a1b1d8291d36008fa853567a1ac1c2f
refs/heads/main
2023-03-23T16:07:24.323978
2021-03-21T16:04:12
2021-03-21T16:04:12
347,192,980
0
0
null
2021-03-21T16:04:13
2021-03-12T20:43:44
TypeScript
UTF-8
Java
false
false
97
java
/** * View Models used by Spring MVC REST controllers. */ package com.oumar.react.web.rest.vm;
[ "oumarsharif@gmail.com" ]
oumarsharif@gmail.com
711cb990e2b0ef7179851d762422cbfe0698d7eb
13d750a9867dbd9527fe5e2205199b785ba08935
/T3_java/src/main/java/BinaryNode.java
1cf3393cb9d27851a5a027d70ac15cb6bd2ac638
[]
no_license
nikom1912/CC5114
0aea4817d818e010d2af356d2f098ce28c401205
f60ff9ac58e3e258fb35064fea8e23832cfa7d50
refs/heads/master
2020-07-09T01:21:28.769782
2019-12-15T23:54:53
2019-12-15T23:54:53
203,834,302
0
0
null
null
null
null
UTF-8
Java
false
false
952
java
import java.util.ArrayList; public class BinaryNode extends Node{ public BinaryNode(){ super(); arguments = new ArrayList<Node>(2); nums_arguments = 2; } public BinaryNode(MyFunction<Integer, Integer, Integer> fn){ super(fn); arguments = new ArrayList<Node>(2); nums_arguments = 2; } public BinaryNode(Node left, Node right){ left.parent = this; arguments.set(0, left); right.parent = this; arguments.set(1, right); } public BinaryNode(ArrayList<Node> args){ if(args.size() == 2){ arguments = args; for(Node n: arguments){ n.parent = this; } } } @Override public void setArgs(ArrayList<Node> args){ if(args.size() == 2){ arguments = args; for(Node n: arguments){ n.parent = this; } } } }
[ "nikom_1912@hotmail.com" ]
nikom_1912@hotmail.com
1c603e0ff488fd36f29539847abe000a5e7ecb2e
74a8dfb880951aa7491f4654bcaf87cd6200e361
/src/payroll/com/gui/HomeFrame.java
22323cc4b10501f9ff3fdb5ae9a826e30525f579
[]
no_license
jnvamanverma/Payroll-System
519ca57a1bdb5eac33a0776eda82903f830e812d
3d0e0c077a3d15842395556be735af14b74a77f0
refs/heads/master
2021-04-15T14:30:03.638201
2018-03-21T10:01:32
2018-03-21T10:01:32
126,157,711
0
0
null
null
null
null
UTF-8
Java
false
false
1,995
java
package payroll.com.gui; import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import javax.swing.JLabel; import java.awt.Font; import java.awt.Color; import javax.swing.JButton; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.ImageIcon; import java.awt.Toolkit; public class HomeFrame extends JFrame { /** * */ private static final long serialVersionUID = 1L; private JPanel contentPane; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { HomeFrame frame = new HomeFrame(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public HomeFrame() { setTitle("HOME"); setIconImage(Toolkit.getDefaultToolkit().getImage("C:\\elliot program\\java_pgm\\payrollSystem\\images\\Icon.png")); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 640, 405); contentPane = new JPanel(); contentPane.setBackground(new Color(30, 144, 255)); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JButton btnLogin = new JButton("LOGIN"); btnLogin.setBounds(279, 300, 89, 30); btnLogin.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { LoginFrame frame=new LoginFrame(); frame.setVisible(true); setVisible(false); } }); btnLogin.setFont(new Font("Tahoma", Font.BOLD, 12)); btnLogin.setForeground(Color.MAGENTA); contentPane.add(btnLogin); JLabel label = new JLabel(""); label.setIcon(new ImageIcon("C:\\elliot program\\java_pgm\\payrollSystem\\images\\HomeFrame.PNG")); label.setBounds(0, 0, 624, 366); contentPane.add(label); } }
[ "jnvamanverma@gmail.com" ]
jnvamanverma@gmail.com
276627065ede343ab9d0a242ff6fe14fc7ad4b91
5f9e7ca7723ee87c8defd8ce36dfef111893c9e6
/src/main/java/io/payrun/models/RtiJobInstruction.java
65d37e816b0dcea584ad76db8892c042e253367d
[ "Apache-2.0" ]
permissive
X-API/PayRunIO.Java.SDK
8765dc8d5629af169e735ebe69b47b36e0b306f7
b3acca57cd6535e61dbafbd5e7a5f2a62eb03299
refs/heads/master
2021-05-03T11:58:33.854992
2019-03-22T09:29:03
2019-03-22T09:29:03
120,490,898
0
1
Apache-2.0
2018-11-13T15:20:34
2018-02-06T16:47:41
Java
UTF-8
Java
false
false
2,247
java
package io.payrun.models; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName(value = "RtiJobInstruction") public class RtiJobInstruction { @JsonProperty(value="HoldingDate") public java.util.Date holdingDate; @JsonProperty(value="Generate") public Boolean generate = false; @JsonProperty(value="Transmit") public Boolean transmit = false; @JsonProperty(value="TaxYear") public java.lang.Integer taxYear; @JsonProperty(value="Employer") public Link employer; @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss") @JsonProperty(value="Timestamp") public java.util.Date timestamp; @JsonProperty(value="RtiType") public String rtiType; @JsonProperty(value="PaySchedule") public Link paySchedule; @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") @JsonProperty(value="PaymentDate") public java.util.Date paymentDate; @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") @JsonProperty(value="SchemeCeased") public java.util.Date schemeCeased; @JsonProperty(value="FinalSubmissionForYear") public Boolean finalSubmissionForYear; @JsonProperty(value="LateReason") public FpsLateReason lateReason; @JsonProperty(value="TaxMonth") public java.lang.Short taxMonth; @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") @JsonProperty(value="NoPaymentForPeriodFrom") public java.util.Date noPaymentForPeriodFrom; @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") @JsonProperty(value="NoPaymentForPeriodTo") public java.util.Date noPaymentForPeriodTo; @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") @JsonProperty(value="PeriodOfInactivityFrom") public java.util.Date periodOfInactivityFrom; @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") @JsonProperty(value="PeriodOfInactivityTo") public java.util.Date periodOfInactivityTo; @JsonProperty(value="EarlierTaxYear") public java.lang.Integer earlierTaxYear; }
[ "crispinparker@hotmail.com" ]
crispinparker@hotmail.com
f8b23e0dc238e5e9cb204ebb7a2dc32c19d3a64d
cac32baca3073a2d65db03cd183b821ea247a97b
/Glitch Survival-core/src/com/heidenreich/glitch/handlers/Scores.java
eeaf31d2b88fae856d5ef6bc22fecdfeff7f090e
[]
no_license
guitargodd97/GlitchSurvival
416c14cf52f7038d7305e3dfab1f9706739d0c6e
7a725f2b0cbb5e082a82f4ef441df8edf303962c
refs/heads/master
2021-01-23T09:29:02.030796
2014-06-27T02:16:27
2014-06-27T02:16:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,381
java
package com.heidenreich.glitch.handlers; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.files.FileHandle; public class Scores { public static int[] scoreValues; public static String[] stringScores; public Scores() { scoreValues = new int[5]; stringScores = new String[5]; FileHandle fileLocation = Gdx.files.local("data/scores.txt"); if (!fileLocation.exists()) fileLocation.writeString("0|0|0|0|0", false); String s = fileLocation.readString(); for (int i = 0; i < scoreValues.length - 1; i++) { scoreValues[i] = Integer.parseInt(s.substring(0, s.indexOf("|"))); s = s.substring(s.indexOf("|") + 1); } scoreValues[4] = Integer.parseInt(s); updateStringScores(); } public static void sendScore(int minutes, int seconds) { updateScoreValues(); int curValue = (minutes * 60) + seconds; int place = -1; for (int i = scoreValues.length - 1; i >= 0; i--) { if (curValue < scoreValues[i]) i = -1; else place = i; } if (place >= 0) { int[] temp = new int[scoreValues.length]; for (int i = 0; i < place; i++) temp[i] = scoreValues[i]; temp[place] = curValue; for (int i = place + 1; i < scoreValues.length; i++) temp[i] = scoreValues[i - 1]; scoreValues = temp; } updateStringScores(); } private static void updateScoreValues() { for (int i = 0; i < stringScores.length; i++) { int minutes = 0; int seconds = 0; minutes = Integer.parseInt(stringScores[i].substring(0, stringScores[i].indexOf(":"))); seconds = Integer.parseInt(stringScores[i] .substring(stringScores[i].indexOf(":") + 1)); scoreValues[i] = (minutes * 60) + seconds; } } private static void updateStringScores() { for (int i = 0; i < scoreValues.length; i++) { int minutes = (int) (scoreValues[i] / 60); int seconds = scoreValues[i] % 60; if (seconds < 10) stringScores[i] = minutes + ":0" + seconds; else stringScores[i] = minutes + ":" + seconds; } } public static void saveScores() { FileHandle fileLocation = Gdx.files.local("data/scores.txt"); if (!fileLocation.exists()) fileLocation.writeString("0|0|0|0|0", false); fileLocation.writeString(scoreValues[0] + "|" + scoreValues[1] + "|" + scoreValues[2] + "|" + scoreValues[3] + "|" + scoreValues[4], false); } }
[ "guitargodd97@gmail.com" ]
guitargodd97@gmail.com
5766bd1c870d580eb68be5761a6da4cb47336f1d
4c51d39bbae8de690c4c8bfca1dcf93acdd91234
/src/main/java/com/example/lijie/config/listener/MyApplicationCloseListener.java
d69cf01859440a8a553ecbdc964a8e20d668c616
[]
no_license
Hastemd/studySpring
980671e7954215d01fd796d443ca3f5115bf24e4
e569f37f1dcc09e64c4d05d9c65331b8d1212062
refs/heads/master
2023-03-07T12:04:00.694373
2022-05-21T06:09:28
2022-05-21T06:09:28
132,579,400
0
0
null
2023-02-22T06:22:08
2018-05-08T08:36:36
Java
UTF-8
Java
false
false
455
java
package com.example.lijie.config.listener; import org.springframework.context.ApplicationListener; import org.springframework.context.event.ContextClosedEvent; /** * auther lijie 2018/10/29. */ public class MyApplicationCloseListener implements ApplicationListener<ContextClosedEvent> { @Override public void onApplicationEvent(ContextClosedEvent event) { System.out.println("spring容器关闭了... : " + event.toString()); } }
[ "1246992412@qq.com" ]
1246992412@qq.com
63ae2149ed4d04aacc93aa73fe898ded3a4b0b8f
cc32bfac65d279ea6f81756fb22b4aea2f4b75d5
/Exam System/src/Instructor/ExamDetails.java
5053d9ef72815605d64f8ad43516d71f092554f4
[]
no_license
credibleashu/Exam-System
3bc0168ad0cdd12175406007f7bc8b380ced573c
a6307a055d82912b2e5b233292427ea488f22c4a
refs/heads/master
2021-01-20T06:36:40.557019
2017-05-02T17:14:37
2017-05-02T17:14:37
89,900,460
2
0
null
null
null
null
UTF-8
Java
false
false
4,711
java
package Instructor; import java.awt.Color; import java.awt.Dimension; import java.awt.List; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import javax.swing.DefaultComboBoxModel; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JSpinner; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.SpinnerNumberModel; import Login.dbConnector; public class ExamDetails extends JFrame{ Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); double width = screenSize.getWidth(); double height = screenSize.getHeight(); int panelwidth = ((int)width)*3/4; int panelheight = (int)height ; JButton date,group,save; static dbConnector dbc = new dbConnector(); JLabel ltime,lduration,lgroup; static JLabel ldate; JSpinner duration; JSpinner hh,mm; public static JFrame f; public ExamDetails() { f=this; setLayout(null); //setUndecorated(true); setSize(500,500); //setBackground(Color.GREEN); setLocationRelativeTo(null); duration = new JSpinner(); lduration = new JLabel("Duration : "); ldate = new JLabel("Date "); date = new JButton("Select Date "); lgroup = new JLabel("Group "); group = new JButton("Select Group "); save = new JButton("Save"); ltime = new JLabel("Time "); hh= new JSpinner(); mm= new JSpinner(); duration.setModel(new SpinnerNumberModel(15, 15, 180, 15)); hh.setModel(new SpinnerNumberModel(0, 0, 23, 1)); mm.setModel(new SpinnerNumberModel(0, 0, 59, 15)); duration.setBounds(100,10,150,30); lduration.setBounds(10,10,150,30); date.setBounds(100,50,150,30); ldate.setBounds(10,50,150,30); group.setBounds(100,100,150,30); lgroup.setBounds(10,100,150,30); hh.setBounds(60,150,50,30); mm.setBounds(150,150,50,30); ltime.setBounds(10,150,100,30); save.setBounds(50,250,80,30); // setBounds((int)(width/4),0,(int)((width*3)/4),(int)height); add(lduration); add(ldate); add(date); add(lgroup); add(group); add(duration); add(save); add(hh); add(mm); add(ltime); date.addActionListener(new eventAction()); save.addActionListener(new eventAction()); group.addActionListener(new eventAction()); //ShowCalendar ob = new ShowCalendar(); } int fetchGroups() { String qry,qry2; qry2 = "SELECT count(group_id) FROM instructor_group WHERE iid = "+Instructor.instructorid ; qry = "SELECT group_id FROM instructor_group WHERE iid = "+Instructor.instructorid;//Instructor.instructorid; ResultSet rs; Object gid[] = null; int num,i; try { Statement stmt =dbc.conn.createStatement(); rs = stmt.executeQuery(qry2); System.out.println("Instructor : " +Instructor.instructorid+""); if(rs.next()) { num = rs.getInt(1); gid = new Object[num]; // System.out.println("num : "+num); } stmt =dbc.conn.createStatement(); rs = stmt.executeQuery(qry); i=0; while(rs.next()) { gid[i] =(Object)("G"+ rs.getInt(1)); // System.out.println("gid[i] : "+gid[i]); i++; } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); }catch(Exception e) {} String s = (String)JOptionPane.showInputDialog(this,"Select Group : ","",JOptionPane.PLAIN_MESSAGE,null,gid,""); return(Integer.parseInt(s.substring(1))); //If a string was returned, say so. //if ((s != null) && (s.length() > 0)) { // return; //} } class eventAction implements ActionListener { @Override public void actionPerformed(ActionEvent e) { if(e.getSource() == (Object)date) { f.setEnabled(false); ShowCalendar ob = new ShowCalendar(); f.setEnabled(true); repaint(); } else if(e.getSource() == (Object)group) { int group = fetchGroups(); lgroup.setText("G"+group); } else if(e.getSource() == (Object)save) { f.dispose(); newExam.exam.setDuration(Integer.parseInt(duration.getValue().toString())); newExam.exam.setGroupId(Integer.parseInt(lgroup.getText().substring(1))); newExam.exam.setDateTime(ldate.getText()+" "+hh.getValue().toString()+"-"+mm.getValue().toString()+"-00"); Instructor.frame.setEnabled(true); } } } }
[ "noreply@github.com" ]
noreply@github.com
a1a4b9298cd46d3fc704ad801257ac7f85f20197
b2f60754eb747b947f0382b0e2065c83d20a6eaa
/src/test/java/com/hardcore/accounting/dao/provider/TagSqlProviderTest.java
145246b0a5fe0550dbe61bb65ca0b060721e0c98
[ "MIT" ]
permissive
zhangge208/HCAccountingService
7f7cdfd0c67a887c3efa72ac7a04eb4f21ae3be8
90c6aae34692c542ba2a2debb54c3c2f5c6ca8aa
refs/heads/master
2022-07-14T09:32:41.780850
2020-10-19T21:33:58
2020-10-19T21:33:58
245,910,784
7
15
MIT
2022-06-21T02:57:21
2020-03-09T00:27:55
Java
UTF-8
Java
false
false
1,513
java
package com.hardcore.accounting.dao.provider; import static org.junit.jupiter.api.Assertions.assertEquals; import com.google.common.collect.ImmutableList; import com.hardcore.accounting.model.persistence.Tag; import lombok.val; import org.junit.jupiter.api.Test; public class TagSqlProviderTest { private TagSqlProvider tagSqlProvider = new TagSqlProvider(); @Test void testUpdateTagSQL() { // Arrange val description = "eating"; Integer status = 1; Long userId = 10L; val tag = Tag.builder() .description(description) .status(status) .userId(userId) .build(); // Act val result = tagSqlProvider.updateTag(tag); // Assert String expectedSql = "UPDATE hcas_tag\n" + "SET description = #{description}, status = #{status}, user_id = #{userId}\n" + "WHERE (id = #{id})"; assertEquals(expectedSql, result); } @Test void testGetTagListByIds() { // Arrange val tagIdList = ImmutableList.of(1L, 10L, 20L, 30L); // Act val result = tagSqlProvider.getTagListByIds(tagIdList); // Assert String expectedSql = "SELECT id, description, user_id, status\n" + "FROM hcas_tag\n" + "WHERE (id in ('1','10','20','30'))"; assertEquals(expectedSql, result); } }
[ "zhanggz@amazon.com" ]
zhanggz@amazon.com
fbbcbbbe92d73aeea96fcf87032adf8ee2a8d31d
9c89827b24523e10780578a70730f3e034d6ce97
/accelerate-core/src/main/java/co/pishfa/accelerate/ui/phase/PhaseId.java
c954272e6c4e239a5fa59def7911c301cee0d55b
[ "Apache-2.0" ]
permissive
aliakbarRashidi/accelerate
6fbb2828b314b99286f5767a6d69ee798899ef9d
ddd2bae9872e72c661800c81d4ebab4321002911
refs/heads/master
2020-03-18T01:08:53.934710
2017-01-29T07:32:52
2017-01-29T07:32:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
370
java
package co.pishfa.accelerate.ui.phase; /** * * @author Taha Ghasemi <taha.ghasemi@gmail.com> * */ public enum PhaseId { ANY_PHASE, RESTORE_VIEW, APPLY_REQUEST_VALUES, PROCESS_VALIDATIONS, UPDATE_MODEL_VALUES, INVOKE_APPLICATION, RENDER_RESPONSE; public boolean equals(javax.faces.event.PhaseId phaseId) { return ordinal() == phaseId.getOrdinal(); } }
[ "taha.ghasemi@gmail.com" ]
taha.ghasemi@gmail.com
71d60bc56df812f14d95f977419f59578631660a
05a3daf6ba1533fd0b531d17ba530f6576086d25
/my-aktion/src/main/java/de/dpunkt/myaktion/controller/EditCampaignController.java
af6dca4f1b1d52cf09f94d7024e7500e41bd3832
[]
permissive
tweimer/my-aktion-2nd
c9af77a23b2b8b6cf6b6b00e24378f6caf054fd3
bbd1f191a5d775a408e1109f909e8fe377f3c612
refs/heads/advanced
2021-06-17T03:33:41.250152
2021-02-07T21:21:39
2021-02-08T18:52:51
164,109,041
0
0
MIT
2021-02-07T20:21:01
2019-01-04T13:11:17
Java
UTF-8
Java
false
false
1,114
java
package de.dpunkt.myaktion.controller; import de.dpunkt.myaktion.data.CampaignProducer; import de.dpunkt.myaktion.model.Campaign; import de.dpunkt.myaktion.util.Events.Added; import de.dpunkt.myaktion.util.Events.Updated; import javax.enterprise.event.Event; import javax.faces.view.ViewScoped; import javax.inject.Inject; import javax.inject.Named; import java.io.Serializable; @ViewScoped @Named public class EditCampaignController implements Serializable { private static final long serialVersionUID = 2815796004558360299L; @Inject @Added private Event<Campaign> campaignAddEvent; @Inject @Updated private Event<Campaign> campaignUpdateEvent; @Inject private CampaignProducer campaignProducer; public String doSave() { if (campaignProducer.isAddMode()) { campaignAddEvent.fire(campaignProducer.getSelectedCampaign()); } else { campaignUpdateEvent.fire(campaignProducer.getSelectedCampaign()); } return Pages.LIST_CAMPAIGNS; } public String doCancel() { return Pages.LIST_CAMPAIGNS; } }
[ "mail@marcusschiesser.de" ]
mail@marcusschiesser.de
ee5258093a19c1e9011b5c54c09e57b2ff24596e
71297d32b177ee8a89fb356851c7c04e701fa2bf
/app/src/main/java/com/js/shipper/di/ContextLife.java
792a08c8b0c86ddb13432f673ae6b3afb636b6d3
[]
no_license
jiangshenapp/JS_Shipper_Android
b91f490f93f637469ad670a7ebbed257c935927b
07fbea46828baa500b3a160200abe9cf60cf7fbf
refs/heads/master
2020-05-19T10:26:13.425091
2019-07-24T08:39:16
2019-07-24T08:39:16
172,444,949
0
0
null
null
null
null
UTF-8
Java
false
false
301
java
package com.js.shipper.di; import java.lang.annotation.Retention; import javax.inject.Scope; import static java.lang.annotation.RetentionPolicy.RUNTIME; /** * Created by huyg on 2018/8/22. */ @Scope @Retention(RUNTIME) public @interface ContextLife { String value() default "Application"; }
[ "742315209@qq.com" ]
742315209@qq.com
01d832c83e5f96207aa8d3386b80c47dc8f2801a
3a32225c09432590733f6667d14fdf031d23d907
/Lesson5.java
364b6bdfdb3bbed2254ccba9ff570292f45dc068
[]
no_license
FoxITeam/Level2-Lesson5
c024824817c6151bda85129f2a4308e26724e9fd
13a3efd5a8497d7b1491ea890fff833ce63d6efb
refs/heads/master
2020-03-13T21:32:19.451610
2018-04-27T13:18:34
2018-04-27T13:18:34
131,298,328
0
0
null
null
null
null
UTF-8
Java
false
false
5,847
java
package ru.foxit.grayfox; public class Lesson5 { // 1. Необходимо написать два метода, которые делают следующее: // 1) Создают одномерный длинный массив, например: // // static final int size = 10000000; // static final int h = size / 2; // float[] arr = new float[size]; // // 2) Заполняют этот массив единицами; // 3) Засекают время выполнения: long a = System.currentTimeMillis(); // 4) Проходят по всему массиву и для каждой ячейки считают новое значение по формуле: // arr[i] = (float)(arr[i] * Math.sin(0.2f + i / 5) * Math.cos(0.2f + i / 5) * Math.cos(0.4f + i / 2)); // 5) Проверяется время окончания метода System.currentTimeMillis(); // 6) В консоль выводится время работы: System.out.println(System.currentTimeMillis() - a); // // Отличие первого метода от второго: // Первый просто бежит по массиву и вычисляет значения. // Второй разбивает массив на два массива, в двух потоках высчитывает новые значения и потом склеивает эти массивы обратно в один. // // Пример деления одного массива на два: // // System.arraycopy(arr, 0, a1, 0, h); // System.arraycopy(arr, h, a2, 0, h); // // Пример обратной склейки: // // System.arraycopy(a1, 0, arr, 0, h); // System.arraycopy(a2, 0, arr, h, h); // // Примечание: // System.arraycopy() – копирует данные из одного массива в другой: // System.arraycopy(массив-источник, откуда начинаем брать данные из массива-источника, массив-назначение, откуда начинаем записывать данные в массив-назначение, сколько ячеек копируем) // По замерам времени: // Для первого метода надо считать время только на цикл расчета: // // for (int i = 0; i < size; i++) { // arr[i] = (float)(arr[i] * Math.sin(0.2f + i / 5) * Math.cos(0.2f + i / 5) * Math.cos(0.4f + i / 2)); // } // // Для второго метода замеряете время разбивки массива на 2, просчета каждого из двух массивов и склейки. // Создаем переменная размер и выдаем значение 10000000 private static final int SIZE = 10000000; // Создаем переменную половина размера - HALF_SIZE, где мы делим на 2. private static final int H_SIZE = SIZE / 2; //ALT + INSERT - getter and setter - но тут я их не использовал. // Запуск программы маин, где мы запускаем 2 метода public static void main(String[] s) { Lesson5 rune = new Lesson5(); rune.oneRunThread(); rune.twoRunThread(); } // Метод считалка reader public float[] reader(float[] arr) { for (int i = 0; i < arr.length; i++) // Проходят по всему массиву и для каждой ячейки считают новое значение по формуле arr[i] = (float) (arr[i] * Math.sin(0.2f + i / 5) * Math.cos(0.2f + i / 5) * Math.cos(0.4f + i / 2)); //Возвращает массив return arr; } // Первый метод public void oneRunThread () { // Создаем длинный одномерный массив float[] arr = new float[SIZE]; // Условие for (int i = 0; i < arr.length; i++) arr[i] = 1.0f; // Проверяется время окончания метода long a = System.currentTimeMillis(); // Запускаем считалку reader(arr); // Отображаем в консоль System.out.println("Первый метод потока завершился: " + (System.currentTimeMillis() - a)); } // Второй метод public void twoRunThread() { float[] arr = new float[SIZE]; float[] arr1 = new float[H_SIZE]; float[] arr2 = new float[H_SIZE]; for (int i = 0; i < arr.length; i++) arr[i] = 1.0f; // Проверяется время окончания метода long a = System.currentTimeMillis(); //Деления одного массива на два System.arraycopy(arr, 0, arr1, 0, H_SIZE); System.arraycopy(arr, H_SIZE, arr2, 0, H_SIZE); // Первый поток new Thread() { public void run() { float[] a1 = reader(arr1); System.arraycopy(a1, 0, arr1, 0, a1.length); } }.start(); // Второй поток new Thread() { public void run() { float[] a2 = reader(arr2); System.arraycopy(a2, 0, arr2, 0, a2.length); } }.start(); // Обратная склейка System.arraycopy(arr1, 0, arr, 0, H_SIZE); System.arraycopy(arr2, 0, arr, H_SIZE, H_SIZE); // Выводиться время работы. System.out.println("Второй метод потока завершился: " + (System.currentTimeMillis() - a)); } }
[ "admin@bukkit-minecraft.ru" ]
admin@bukkit-minecraft.ru
70b4f222e8a50ca3b83efa5d2ac19a82936d876a
89bf50b432df8a1525c7837577c180ec85809508
/src/main/java/util/JWTStore.java
44a455aadcf2102710f0a1fd768613e87c18b5ff
[]
no_license
willem810/Kwetter
00733feb01c44c2293baeab31ed2a57e305b9fda
3197fbe88964d5ac8213a90f63d24852e3864c13
refs/heads/master
2021-04-27T05:06:40.331206
2018-05-07T12:01:00
2018-05-07T12:01:00
122,591,088
0
0
null
null
null
null
UTF-8
Java
false
false
1,195
java
package util; import io.jsonwebtoken.JwtBuilder; import io.jsonwebtoken.Jwts; import io.jsonwebtoken.SignatureAlgorithm; import javax.crypto.KeyGenerator; import javax.crypto.spec.SecretKeySpec; import javax.inject.Inject; import javax.xml.bind.DatatypeConverter; import java.security.Key; import java.security.interfaces.RSAPrivateKey; import java.security.interfaces.RSAPublicKey; import java.time.Instant; import java.time.temporal.ChronoUnit; import java.util.Date; public class JWTStore { private static final Instant CURRENT_TIME = Instant.now(); private static final Instant EXPIRED_TIME = CURRENT_TIME.plus(3, ChronoUnit.MINUTES); private static byte[] key; public static byte[] getKey() throws Exception{ if(key == null) { key = generateKey(); } return key; // byte[] key = "secret".getBytes("UTF-8"); // return key; } private static byte[] generateKey() throws Exception { // String keyString = "simpleKeyForKwetter"; // Key key = new SecretKeySpec(keyString.getBytes(), 0, keyString.getBytes().length, "DES"); // return key; return "secret".getBytes("UTF-8"); } }
[ "willemtoemen@live.nl" ]
willemtoemen@live.nl
9393557342df3714ee0a5305621c912c2e57f30b
702fa4efeefb42584912eaed767aa11223111db9
/reactor/reactor-tcp/src/main/java/reactor/tcp/TcpClient.java
55b5a6b9c1cc7b62f103f173de7d8878b1bfb1ca
[ "Apache-2.0" ]
permissive
reallhy/reallhy
d93ca7d0637a62144778782a0e00ffb0832836b8
a54ba85bc9665e0a206d36230de14b8f56da824c
refs/heads/master
2021-01-23T12:15:34.176418
2016-01-14T01:47:30
2016-01-14T01:47:30
767,100
0
2
null
null
null
null
UTF-8
Java
false
false
7,926
java
/* * Copyright (c) 2011-2013 GoPivotal, Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * 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 reactor.tcp; import reactor.core.Environment; import reactor.core.Reactor; import reactor.core.composable.Deferred; import reactor.core.composable.Promise; import reactor.core.composable.Stream; import reactor.core.composable.spec.Promises; import reactor.core.spec.Reactors; import reactor.event.Event; import reactor.event.registry.CachingRegistry; import reactor.event.registry.Registration; import reactor.event.registry.Registry; import reactor.event.selector.Selector; import reactor.event.selector.Selectors; import reactor.function.Consumer; import reactor.io.Buffer; import reactor.tcp.config.ClientSocketOptions; import reactor.tcp.config.SslOptions; import reactor.io.encoding.Codec; import reactor.tuple.Tuple2; import reactor.util.Assert; import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.net.InetSocketAddress; import java.util.Iterator; /** * The base class for a Reactor-based TCP client. * * @param <IN> The type that will be received by this client * @param <OUT> The type that will be sent by this client * @author Jon Brisbin */ public abstract class TcpClient<IN, OUT> { private final Tuple2<Selector, Object> open = Selectors.$(); private final Tuple2<Selector, Object> close = Selectors.$(); private final Reactor reactor; private final Codec<Buffer, IN, OUT> codec; protected final Registry<TcpConnection<IN, OUT>> connections = new CachingRegistry<TcpConnection<IN, OUT>>(); protected final Environment env; protected TcpClient(@Nonnull Environment env, @Nonnull Reactor reactor, @Nonnull InetSocketAddress connectAddress, @Nullable ClientSocketOptions options, @Nullable SslOptions sslOptions, @Nullable Codec<Buffer, IN, OUT> codec) { Assert.notNull(env, "A TcpClient cannot be created without a properly-configured Environment."); Assert.notNull(reactor, "A TcpClient cannot be created without a properly-configured Reactor."); Assert.notNull(connectAddress, "A TcpClient cannot be created without a properly-configured connect InetSocketAddress."); this.env = env; this.reactor = reactor; this.codec = codec; } /** * Open a {@link TcpConnection} to the configured host:port and return a {@link reactor.core.composable.Promise} that * will be fulfilled when the client is connected. * * @return A {@link reactor.core.composable.Promise} that will be filled with the {@link TcpConnection} when * connected. */ public abstract Promise<TcpConnection<IN, OUT>> open(); /** * Open a {@link TcpConnection} to the configured host:port and return a {@link Stream} that will be passed a new * {@link TcpConnection} object every time the client is connected to the endpoint. The given {@link Reconnect} * describes how the client should attempt to reconnect to the host if the initial connection fails or if the client * successfully connects but at some point in the future gets cut off from the host. The {@code Reconnect} tells the * client where to try reconnecting and gives a delay describing how long to wait to attempt to reconnect. When the * connect is successfully made, the {@link Stream} is sent a new {@link TcpConnection} backed by the newly-connected * connection. * * @param reconnect * @return */ public abstract Stream<TcpConnection<IN, OUT>> open(Reconnect reconnect); /** * Close any open connections and disconnect this client. * * @return A {@link Promise} that will be fulfilled with {@literal null} when the connections have been closed. */ public Promise<Void> close() { final Deferred<Void, Promise<Void>> d = Promises.<Void>defer().env(env).dispatcher(reactor.getDispatcher()).get(); Reactors.schedule( new Consumer<Void>() { @Override public void accept(Void v) { for (Registration<? extends TcpConnection<IN, OUT>> reg : connections) { reg.getObject().close(); reg.cancel(); } doClose(d); } }, null, reactor ); return d.compose(); } /** * Subclasses should register the given channel and connection for later use. * * @param channel The channel object. * @param connection The {@link TcpConnection}. * @param <C> The type of the channel object. * @return {@link reactor.event.registry.Registration} of this connection in the {@link Registry}. */ protected <C> Registration<? extends TcpConnection<IN, OUT>> register(@Nonnull C channel, @Nonnull TcpConnection<IN, OUT> connection) { Assert.notNull(channel, "Channel cannot be null."); Assert.notNull(connection, "TcpConnection cannot be null."); return connections.register(Selectors.$(channel), connection); } /** * Find the {@link TcpConnection} for the given channel object. * * @param channel The channel object. * @param <C> The type of the channel object. * @return The {@link TcpConnection} associated with the given channel. */ protected <C> TcpConnection<IN, OUT> select(@Nonnull C channel) { Assert.notNull(channel, "Channel cannot be null."); Iterator<Registration<? extends TcpConnection<IN, OUT>>> conns = connections.select(channel).iterator(); if (conns.hasNext()) { return conns.next().getObject(); } else { TcpConnection<IN, OUT> conn = createConnection(channel); register(channel, conn); notifyOpen(conn); return conn; } } /** * Close the given channel. * * @param channel The channel object. * @param <C> The type of the channel object. */ protected <C> void close(@Nonnull C channel) { Assert.notNull(channel, "Channel cannot be null"); for (Registration<? extends TcpConnection<IN, OUT>> reg : connections.select(channel)) { TcpConnection<IN, OUT> conn = reg.getObject(); reg.getObject().close(); notifyClose(conn); reg.cancel(); } } /** * Subclasses should implement this method and provide a {@link TcpConnection} object. * * @param channel The channel object to associate with this connection. * @param <C> The type of the channel object. * @return The new {@link TcpConnection} object. */ protected abstract <C> TcpConnection<IN, OUT> createConnection(C channel); /** * Notify this client's consumers than a global error has occurred. * * @param error The error to notify. */ protected void notifyError(@Nonnull Throwable error) { Assert.notNull(error, "Error cannot be null."); reactor.notify(error.getClass(), Event.wrap(error)); } /** * Notify this client's consumers that the connection has been opened. * * @param conn The {@link TcpConnection} that was opened. */ protected void notifyOpen(@Nonnull TcpConnection<IN, OUT> conn) { reactor.notify(open.getT2(), Event.wrap(conn)); } /** * Notify this clients's consumers that the connection has been closed. * * @param conn The {@link TcpConnection} that was closed. */ protected void notifyClose(@Nonnull TcpConnection<IN, OUT> conn) { reactor.notify(close.getT2(), Event.wrap(conn)); } /** * Get the {@link Codec} in use. * * @return The codec. May be {@literal null}. */ @Nullable protected Codec<Buffer, IN, OUT> getCodec() { return codec; } protected abstract void doClose(Deferred<Void, Promise<Void>> d); }
[ "reallhy@gmail.com" ]
reallhy@gmail.com
73c1131a4f5ed49dece5e63ab7881211de83cdfe
f048adcebf11f874c0cbc04249bd9ae1a065d9e3
/src/com/mishiranu/dashchan/preference/AboutFragment.java
87511537acd4eeb6adebea827c46096bda669150
[ "Apache-2.0" ]
permissive
Snotbob/Dashchan
699814abe6a0641aa8b1d85bda0cbd13f72aaa53
ff51e98bbd893823656a8a110f5400ee0b081419
refs/heads/master
2021-01-15T11:02:48.166975
2016-07-13T09:13:37
2016-07-13T09:13:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
13,356
java
/* * Copyright 2014-2016 Fukurou Mishiranu * * 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.mishiranu.dashchan.preference; import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Locale; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import android.app.AlertDialog; import android.app.Dialog; import android.app.DialogFragment; import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.pm.ApplicationInfo; import android.net.Uri; import android.os.Bundle; import android.preference.Preference; import android.text.format.DateFormat; import android.util.Pair; import chan.content.ChanLocator; import chan.http.HttpException; import chan.http.HttpHolder; import chan.http.HttpRequest; import chan.text.GroupParser; import chan.text.ParseException; import chan.util.CommonUtils; import com.mishiranu.dashchan.R; import com.mishiranu.dashchan.app.PreferencesActivity; import com.mishiranu.dashchan.async.AsyncManager; import com.mishiranu.dashchan.async.ReadUpdateTask; import com.mishiranu.dashchan.content.BackupManager; import com.mishiranu.dashchan.content.model.ErrorItem; import com.mishiranu.dashchan.util.ToastUtils; public class AboutFragment extends BasePreferenceFragment { private Preference mBackupDataPreference; private Preference mChangelogPreference; private Preference mCheckForUpdatesPreference; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Preference statisticsPreference = makeButton(null, R.string.preference_statistics, 0, false); mBackupDataPreference = makeButton(null, R.string.preference_backup_data, R.string.preference_backup_data_summary, false); mChangelogPreference = makeButton(null, R.string.preference_changelog, 0, false); mCheckForUpdatesPreference = makeButton(null, R.string.preference_check_for_updates, 0, false); Preference licensePreference = makeButton(null, R.string.preference_licenses, R.string.preference_licenses_summary, false); makeButton(null, getString(R.string.preference_version), getBuildVersion() + " (" + getBuildDate() + ")", true); Intent intent = new Intent(getActivity(), PreferencesActivity.class); intent.putExtra(PreferencesActivity.EXTRA_SHOW_FRAGMENT, StatisticsFragment.class.getName()); intent.putExtra(PreferencesActivity.EXTRA_NO_HEADERS, true); statisticsPreference.setIntent(intent); intent = new Intent(getActivity(), PreferencesActivity.class); intent.putExtra(PreferencesActivity.EXTRA_SHOW_FRAGMENT, TextFragment.class.getName()); intent.putExtra(PreferencesActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS, TextFragment.createArguments(TextFragment.TYPE_LICENSES, null)); intent.putExtra(PreferencesActivity.EXTRA_NO_HEADERS, true); licensePreference.setIntent(intent); } private String getBuildVersion() { String version; Context context = getActivity(); try { version = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName; } catch (Exception e) { throw new RuntimeException(e); } return version; } private String getBuildDate() { long time; Context context = getActivity(); try { ApplicationInfo applicationInfo = context.getPackageManager() .getApplicationInfo(context.getPackageName(), 0); ZipFile zipFile = new ZipFile(applicationInfo.sourceDir); ZipEntry zipEntry = zipFile.getEntry("classes.dex"); time = zipEntry.getTime(); zipFile.close(); } catch (Exception e) { throw new RuntimeException(e); } return DateFormat.getDateFormat(getActivity()).format(time); } @Override public boolean onPreferenceClick(Preference preference) { if (preference == mBackupDataPreference) { new BackupDialog().show(getFragmentManager(), BackupDialog.class.getName()); return true; } else if (preference == mChangelogPreference) { new ReadDialog(ReadDialog.TYPE_CHANGELOG).show(getFragmentManager(), ReadDialog.class.getName()); return true; } else if (preference == mCheckForUpdatesPreference) { new ReadDialog(ReadDialog.TYPE_UPDATE).show(getFragmentManager(), ReadDialog.class.getName()); return true; } return super.onPreferenceClick(preference); } public static class BackupDialog extends DialogFragment implements DialogInterface.OnClickListener { @Override public Dialog onCreateDialog(Bundle savedInstanceState) { String[] items = getResources().getStringArray(R.array.preference_backup_data_choices); return new AlertDialog.Builder(getActivity()).setItems(items, this).create(); } @Override public void onClick(DialogInterface dialog, int which) { if (which == 0) { BackupManager.makeBackup(getActivity()); } else if (which == 1) { LinkedHashMap<File, String> filesMap = BackupManager.getAvailableBackups(getActivity()); if (filesMap != null && filesMap.size() > 0) { new RestoreFragment(filesMap).show(getFragmentManager(), RestoreFragment.class.getName()); } else ToastUtils.show(getActivity(), R.string.message_no_backups); } } } public static class RestoreFragment extends DialogFragment implements DialogInterface.OnClickListener { private static final String EXTRA_FILES = "files"; private static final String EXTRA_NAMES = "names"; public RestoreFragment() { } public RestoreFragment(LinkedHashMap<File, String> filesMap) { Bundle args = new Bundle(); ArrayList<String> files = new ArrayList<>(filesMap.size()); ArrayList<String> names = new ArrayList<>(filesMap.size()); for (LinkedHashMap.Entry<File, String> pair : filesMap.entrySet()) { files.add(pair.getKey().getAbsolutePath()); names.add(pair.getValue()); } args.putStringArrayList(EXTRA_FILES, files); args.putStringArrayList(EXTRA_NAMES, names); setArguments(args); } @Override public Dialog onCreateDialog(Bundle savedInstanceState) { ArrayList<String> names = getArguments().getStringArrayList(EXTRA_NAMES); String[] items = CommonUtils.toArray(names, String.class); return new AlertDialog.Builder(getActivity()).setSingleChoiceItems(items, 0, null).setNegativeButton (android.R.string.cancel, null).setPositiveButton(android.R.string.ok, this).create(); } @Override public void onClick(DialogInterface dialog, int which) { int index = ((AlertDialog) dialog).getListView().getCheckedItemPosition(); File file = new File(getArguments().getStringArrayList(EXTRA_FILES).get(index)); BackupManager.loadBackup(getActivity(), file); } } public static class ReadDialog extends DialogFragment implements AsyncManager.Callback { private static final String EXTRA_TYPE = "type"; private static final int TYPE_CHANGELOG = 0; private static final int TYPE_UPDATE = 1; private static final String TASK_READ_CHANGELOG = "read_changelog"; private static final String TASK_READ_UPDATE = "read_update"; public ReadDialog() { } public ReadDialog(int type) { Bundle args = new Bundle(); args.putInt(EXTRA_TYPE, type); setArguments(args); } @Override public Dialog onCreateDialog(Bundle savedInstanceState) { ProgressDialog dialog = new ProgressDialog(getActivity()); dialog.setMessage(getString(R.string.message_loading)); dialog.setCanceledOnTouchOutside(false); return dialog; } @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); switch (getArguments().getInt(EXTRA_TYPE)) { case TYPE_CHANGELOG: { AsyncManager.get(this).startTask(TASK_READ_CHANGELOG, this, null, false); break; } case TYPE_UPDATE: { AsyncManager.get(this).startTask(TASK_READ_UPDATE, this, null, false); break; } } } @Override public void onCancel(DialogInterface dialog) { super.onCancel(dialog); switch (getArguments().getInt(EXTRA_TYPE)) { case TYPE_CHANGELOG: { AsyncManager.get(this).cancelTask(TASK_READ_CHANGELOG, this); break; } case TYPE_UPDATE: { AsyncManager.get(this).cancelTask(TASK_READ_UPDATE, this); break; } } } private static class ReadUpdateHolder extends AsyncManager.Holder implements ReadUpdateTask.Callback { @Override public void onReadUpdateComplete(ReadUpdateTask.UpdateDataMap updateDataMap) { storeResult(updateDataMap); } } @Override public Pair<Object, AsyncManager.Holder> onCreateAndExecuteTask(String name, HashMap<String, Object> extra) { switch (getArguments().getInt(EXTRA_TYPE)) { case TYPE_CHANGELOG: { ReadChangelogTask task = new ReadChangelogTask(getActivity()); task.executeOnExecutor(ReadChangelogTask.THREAD_POOL_EXECUTOR); return task.getPair(); } case TYPE_UPDATE: { ReadUpdateHolder holder = new ReadUpdateHolder(); ReadUpdateTask task = new ReadUpdateTask(getActivity(), holder); task.executeOnExecutor(ReadChangelogTask.THREAD_POOL_EXECUTOR); return new Pair<Object, AsyncManager.Holder>(task, holder); } } return null; } @Override public void onFinishTaskExecution(String name, AsyncManager.Holder holder) { dismissAllowingStateLoss(); switch (getArguments().getInt(EXTRA_TYPE)) { case TYPE_CHANGELOG: { String content = holder.nextArgument(); ErrorItem errorItem = holder.nextArgument(); if (errorItem == null) { Intent intent = new Intent(getActivity(), PreferencesActivity.class); intent.putExtra(PreferencesActivity.EXTRA_SHOW_FRAGMENT, TextFragment.class.getName()); intent.putExtra(PreferencesActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS, TextFragment.createArguments(TextFragment.TYPE_CHANGELOG, content)); intent.putExtra(PreferencesActivity.EXTRA_NO_HEADERS, true); startActivity(intent); } else ToastUtils.show(getActivity(), errorItem); break; } case TYPE_UPDATE: { ReadUpdateTask.UpdateDataMap updateDataMap = holder.nextArgument(); startActivity(UpdateFragment.createUpdateIntent(getActivity(), updateDataMap)); break; } } } @Override public void onRequestTaskCancel(String name, Object task) { ((ReadChangelogTask) task).cancel(); } } private static class ReadChangelogTask extends AsyncManager.SimpleTask<Void, Void, Boolean> { private final HttpHolder mHolder = new HttpHolder(); private final Context mContext; private String mResult; private ErrorItem mErrorItem; public ReadChangelogTask(Context context) { mContext = context.getApplicationContext(); } @Override public Boolean doInBackground(Void... params) { String page = "Changelog-EN"; Locale locale = mContext.getResources().getConfiguration().locale; if (locale != null) { String language = locale.getLanguage(); if ("ru".equals(language)) page = "Changelog-RU"; } Uri uri = ChanLocator.getDefault().buildPathWithHost("github.com", "Mishiranu", "Dashchan", "wiki", page); try { String result = new HttpRequest(uri, mHolder).read().getString(); if (result != null) result = ChangelogGroupCallback.parse(result); if (result == null) { mErrorItem = new ErrorItem(ErrorItem.TYPE_UNKNOWN); return false; } else { mResult = result; return true; } } catch (HttpException e) { mErrorItem = e.getErrorItemAndHandle(); mHolder.disconnect(); return false; } } @Override protected void onStoreResult(AsyncManager.Holder holder, Boolean result) { holder.storeResult(mResult, mErrorItem); } @Override public void cancel() { cancel(true); mHolder.interrupt(); } } private static class ChangelogGroupCallback implements GroupParser.Callback { private String mResult; public static String parse(String source) { ChangelogGroupCallback callback = new ChangelogGroupCallback(); try { GroupParser.parse(source, callback); } catch (ParseException e) { } return callback.mResult; } @Override public boolean onStartElement(GroupParser parser, String tagName, String attrs) { return "div".equals(tagName) && "markdown-body".equals(parser.getAttr(attrs, "class")); } @Override public void onEndElement(GroupParser parser, String tagName) { } @Override public void onText(GroupParser parser, String source, int start, int end) throws ParseException { } @Override public void onGroupComplete(GroupParser parser, String text) throws ParseException { mResult = text; throw new ParseException(); } } }
[ "fukurou.mishiranu@gmail.com" ]
fukurou.mishiranu@gmail.com
de0f8fa08d339c74fd206d1b4ff5446b2fb9e786
7a2dcc203552bc27bf09323c972f4d56f581f294
/src/main/java/me/asv/coins/Solver.java
9ef3e37797a4f3fd8419f660818695e1fa307c46
[]
no_license
anitasv/coins
22a572866c184b80e07e7346b3bc4ddc9265372f
bf5e10c88304c619e69d7ad332bcfe9e56262031
refs/heads/master
2021-01-18T23:27:25.328327
2016-05-13T06:44:30
2016-05-13T06:44:30
13,876,163
0
0
null
null
null
null
UTF-8
Java
false
false
7,374
java
package me.asv.coins; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** */ public class Solver { public static final int DIM = 4; public static final int SIZE = DIM * DIM; public interface Move { public Board applyMove(Board b); } public static enum AlphaMove implements Move { LEFT(-1,0), RIGHT(+1, 0), TOP(0, 1), BOTTOM(0, -1); private final int xd; private final int yd; private AlphaMove(int xd, int yd) { this.xd = xd; this.yd = yd; } public Board applyMove(Board b) { return b.makeAlphaMove(this); } } private static class BetaMove implements Move { private final int pos; private final int val; BetaMove(int pos, int val) { this.pos = pos; this.val = val; } public Board applyMove(Board b) { return b.makeBetaMove(this); } } public static class Board { private final int b[]; private final boolean alphaTurn; private Board(int b[], boolean alphaTurn) { this.b = b; this.alphaTurn = alphaTurn; } public static class Builder { private int b[]; private boolean alphaTurn; public Builder fresh() { this.b = new int[SIZE]; return this; } public Builder copy(int[] b) { this.b = Arrays.copyOf(b, SIZE); return this; } public Builder turn(boolean alphaTurn) { this.alphaTurn = alphaTurn; return this; } public Builder at(int pos, int val) { this.b[pos] = val; return this; } public Board build() { return new Board(this.b, this.alphaTurn); } } public Board makeAlphaMove(AlphaMove alphaMove) { int startX = alphaMove.xd < 0 ? 0 : DIM - 1; int startY = alphaMove.yd < 0 ? 0 : DIM - 1; boolean moved = false; Board.Builder builder = new Builder().fresh(); for (int x = startX; isBound(x); x -= alphaMove.xd) { for (int y = startY; isBound(y); y -= alphaMove.yd) { int x2 = x + alphaMove.xd; int y2 = y + alphaMove.yd; if (isBound(x2) && isBound(y2)) { if (b[pos(x2, y2)] == b[pos(x, y)]) { builder.at(pos(x, y), b[pos(x2, y2) + b[pos(x,y)]]); moved = true; } else { builder.at(pos(x, y), b[pos(x2, y2) + b[pos(x,y)]]); } } } } if (!moved) { throw new IllegalStateException(); } return builder.build(); } public boolean isBound(int p) { return p >= 0 && p < DIM; } public List<Move> moveList() { List<Move> moveList = new ArrayList<>(); if (alphaTurn) { for (AlphaMove move : AlphaMove.values()) { boolean accept = false; for (int i = 0; i < DIM; i++) { for (int j = 0; j < DIM; j++) { int ii = i + move.xd; int jj = j + move.yd; if (isBound(ii) && isBound(jj)) { if (b[pos(ii, jj)] == b[pos(i, j)]) { accept = true; break; } } } if (accept) { break; } } if (accept) { moveList.add(move); } } } else { for (int i = 0; i < SIZE; i++) { if (b[i] == 0) { BetaMove lowMove = new BetaMove(i, 2); BetaMove highMove = new BetaMove(i, 2); moveList.add(lowMove); moveList.add(highMove); } } } return moveList; } public int score() { int sum = 0; for (int i = 0; i < SIZE; i++) { sum += b[i] * b[i]; } return alphaTurn ? -sum : sum; } public Board makeBetaMove(BetaMove betaMove) { int pos = betaMove.pos; if (b[pos] == 0) { return new Builder().copy(b).at(pos, betaMove.val).build(); } else { throw new IllegalStateException(toString() + " has position " + pos + " occupied"); } } } public static int pos(int x, int y) { return x * DIM + y; } public static class Engine { public int score(Board board, int depth) { if (depth == 0) { return board.score(); } List<Move> moveList = board.moveList(); int bestScore = Integer.MIN_VALUE; for (Move betaMove : moveList) { Board b = betaMove.applyMove(board); int score = score(b, depth - 1); if (bestScore < score) { bestScore = score; } } return -bestScore; } public AlphaMove bestAlphaMove(Board board, int depth) { int bestScore = Integer.MIN_VALUE; AlphaMove bestMove = null; for (AlphaMove alphaMove : AlphaMove.values()) { Board b = board.makeAlphaMove(alphaMove); if (b != null) { int sc = score(board, depth - 1); if (sc > bestScore) { bestScore = sc; bestMove = alphaMove; } } } return bestMove; } public AlphaMove bestAlphaMove(Board board) { return bestAlphaMove(board, 10); } } public static void main(String[] args) throws IOException { BufferedReader inputStreamReader = new BufferedReader(new InputStreamReader(System.in)); Board board = new Board.Builder() .at(pos(3, 0), 2) .at(pos(1, 2), 2) .build(); Engine engine = new Engine(); while (true) { AlphaMove alphaMove = engine.bestAlphaMove(board); System.out.println("Make Move: " + alphaMove); board = board.makeAlphaMove(alphaMove); int m = Integer.parseInt(inputStreamReader.readLine()); int n = Integer.parseInt(inputStreamReader.readLine()); int v = Integer.parseInt(inputStreamReader.readLine()); // BetaMove betaMove = new BetaMove(m, n); } } }
[ "anitasvasu@gmail.com" ]
anitasvasu@gmail.com
9bcdb19988ba03158fc32b8f801505f7ecfaa261
2683d39323d1df0f94cbbdbfad0743cda345738d
/backport-android-bluetooth/src/backport/android/bluetooth/samples/OBEXActivity.java
3af99b00aeac1f2cf69347ea37aafba40b7335d7
[]
no_license
chinnytp/backport-android-bluetooth
0acd3fc775b20e387591609fe1d9e7cc699391aa
5e9e55476bdac7661e89908076e17a428b1aee78
refs/heads/master
2016-09-05T08:44:49.250846
2015-07-08T23:57:53
2015-07-08T23:57:53
38,786,153
1
0
null
2015-07-08T23:57:53
2015-07-08T23:51:20
Java
UTF-8
Java
false
false
6,925
java
/* * Copyright (C) 2009, backport-android-bluetooth - http://code.google.com/p/backport-android-bluetooth/ * * 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 backport.android.bluetooth.samples; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Arrays; import backport.android.bluetooth.BluetoothAdapter; import backport.android.bluetooth.BluetoothServerSocket; import backport.android.bluetooth.BluetoothSocket; import backport.android.bluetooth.R; import backport.android.bluetooth.R.layout; import android.app.Activity; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.os.Handler; import android.provider.Contacts; import android.provider.Contacts.People; import android.util.Log; public class OBEXActivity extends Activity { private static final String TAG = "@MainActivity"; private Handler _handler = new Handler(); private BluetoothServerSocket _server; private BluetoothSocket _socket; private static final int OBEX_CONNECT = 0x80; private static final int OBEX_DISCONNECT = 0x81; private static final int OBEX_PUT = 0x02; private static final int OBEX_PUT_END = 0x82; private static final int OBEX_RESPONSE_OK = 0xa0; private static final int OBEX_RESPONSE_CONTINUE = 0x90; private static final int BIT_MASK = 0x000000ff; // "OBEX File Transfer" (0x1106) // "L2CAP" (0x0100) // "RFCOMM" (0x0003) // "OBEX" (0x0008) // private static final UUID RFCOMM = UUID. Thread t = new Thread() { @Override public void run() { try { _server = BluetoothAdapter.getDefaultAdapter() .listenUsingRfcommWithServiceRecord("OBEX", null); new Thread(){ public void run() { Log.d("@Rfcom", "begin close"); try { _socket.close(); } catch (IOException e) { Log.e(TAG, "", e); } Log.d("@Rfcom", "end close"); }; }.start(); _socket = _server.accept(); reader.start(); Log.d(TAG, "shutdown thread"); } catch (IOException e) { e.printStackTrace(); } }; }; Thread reader = new Thread() { @Override public void run() { try { Log.d(TAG, "getting inputstream"); InputStream inputStream = _socket.getInputStream(); OutputStream outputStream = _socket.getOutputStream(); Log.d(TAG, "got inputstream"); int read = -1; byte[] bytes = new byte[2048]; ByteArrayOutputStream baos = new ByteArrayOutputStream( bytes.length); while ((read = inputStream.read(bytes)) != -1) { baos.write(bytes, 0, read); byte[] req = baos.toByteArray(); int op = req[0] & BIT_MASK; Log.d(TAG, "read:" + Arrays.toString(req)); Log.d(TAG, "op:" + Integer.toHexString(op)); switch (op) { case OBEX_CONNECT: outputStream.write(new byte[] { (byte) OBEX_RESPONSE_OK, 0, 7, 16, 0, 4, 0 }); break; case OBEX_DISCONNECT: outputStream.write(new byte[] { (byte) OBEX_RESPONSE_OK, 0, 3, 0 }); break; case OBEX_PUT: outputStream.write(new byte[] { (byte) OBEX_RESPONSE_CONTINUE, 0, 3, 0 }); break; case OBEX_PUT_END: outputStream.write(new byte[] { (byte) OBEX_RESPONSE_OK, 0, 3, 0 }); break; default: outputStream.write(new byte[] { (byte) OBEX_RESPONSE_OK, 0, 3, 0 }); } Log.d(TAG, new String(baos.toByteArray(), "utf-8")); baos = new ByteArrayOutputStream(bytes.length); } Log.d(TAG, new String(baos.toByteArray(), "utf-8")); } catch (IOException e) { e.printStackTrace(); } }; }; private Thread put = new Thread() { public void run() { }; }; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.obex_server_socket); t.start(); // Intent i = new Intent(Intent.ACTION_PICK, People.CONTENT_URI); // Intent i = new Intent(Intent.ACTION_PICK); // i.setType("vnd.android.cursor.item/phone"); // i.setType("vnd.android.cursor.dir/phone"); // i.setType("image/*"); // startActivityForResult(i, 1); // try { // // BluetoothAdapter bluetooth = BluetoothAdapter.getDefaultAdapter(); // // Log.d(TAG, o.toString()); // Toast.makeText(this, bluetooth.getName(), Toast.LENGTH_LONG).show(); // } catch (Exception e) { // // Toast.makeText(this, e.toString(), Toast.LENGTH_LONG).show(); // } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { // super.onActivityResult(requestCode, resultCode, data); Log.d(TAG, data.getData().toString()); switch (requestCode) { case (1): if (resultCode == Activity.RESULT_OK) { Uri contactData = data.getData(); Cursor c = managedQuery(contactData, null, null, null, null); for (; c.moveToNext();) { Log.d(TAG, "c1---------------------------------------"); dump(c); Uri uri = Uri.withAppendedPath(data.getData(), Contacts.People.ContactMethods.CONTENT_DIRECTORY); Cursor c2 = managedQuery(uri, null, null, null, null); for (; c2.moveToNext();) { Log.d(TAG, "c2---------------------------------------"); dump(c2); } // String name = c.getString(c // .getColumnIndexOrThrow(People.NUMBER)); } // c.close(); } break; } // try { // InputStream is = getContentResolver().openInputStream( // data.getData()); // int read = -1; // byte[] b = new byte[4096]; // ByteArrayOutputStream baos = new ByteArrayOutputStream(b.length); // // try { // for (; (read = is.read(b)) > -1;) { // // baos.write(b, 0, read); // } // // Log.d(TAG, new String(baos.toByteArray(), "utf-8")); // is.close(); // } catch (IOException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // } // } catch (FileNotFoundException e) { // // e.printStackTrace(); // } finally { // // } } private void dump(Cursor c) { for (int i = 0, size = c.getColumnCount(); i < size; ++i) { String col = c.getColumnName(i); String s = c.getString(i); Log.d(TAG, col + "=" + s); } } }
[ "esmasui@gmail.com" ]
esmasui@gmail.com
a88ccb66408afbf84a9fea1788d6de2b621ffdd6
c1f59282d685eed21183ac864107d451d407d67b
/src/tools/Debug.java
70b53314a9a569409336c494a87ba87260863590
[]
no_license
0x00/bot-buchmacher
70697ad13e34509b263f870be7da6465708577d7
6aa7e5d7e0be707589bb3fd184a0efce9f88abf0
refs/heads/master
2016-09-06T16:21:46.808741
2012-08-14T08:47:30
2012-08-14T08:47:30
5,123,507
0
1
null
null
null
null
UTF-8
Java
false
false
573
java
package tools; import java.io.FileWriter; import java.io.IOException; public class Debug { public static boolean debug = false; public void print(Object n) { if (!debug) return; print(n.toString()); } public void print() { if (!debug) return; System.out.println(); } public void print(String n) { if (!debug) return; System.out.println(n); } public void debugSave(String c) { try { FileWriter w = new FileWriter("/Users/f/Desktop/debug.htm"); w.write(c); w.close(); } catch (IOException e) { e.printStackTrace(); } } }
[ "felix.fuellgraf@neuland-bfi.de" ]
felix.fuellgraf@neuland-bfi.de