blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 689M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 131 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 32 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 313 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
59ff6e707f66d40517efbe168ee3b9de7b716cbc | 86c01941aa884489dc81e480e27b77f47b77529f | /vista/src/vista/graph/CurveLegendLine.java | 3242b53fe5884ef50fbd53dcc6226affa961b37c | [] | no_license | CADWRDeltaModeling/dsm2-vista | cdcb3135a4bc8ed2af0d9a5242411b9aadf3e986 | 5115fbae9edae5fa1d90ed795687fd74e69d5051 | refs/heads/master | 2023-05-25T13:01:31.466663 | 2023-05-18T18:51:40 | 2023-05-18T18:51:40 | 32,541,476 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,924 | java | /*
Copyright (C) 1996, 1997, 1998 State of California, Department of
Water Resources.
VISTA : A VISualization Tool and Analyzer.
Version 1.0beta
by Nicky Sandhu
California Dept. of Water Resources
Division of Planning, Delta Modeling Section
1416 Ninth Street
Sacramento, CA 95814
(916)-653-7552
nsandhu@water.ca.gov
Send bug reports to nsandhu@water.ca.gov
This program is licensed to you under the terms of the GNU General
Public License, version 2, as published by the Free Software
Foundation.
You should have received a copy of the GNU General Public License
along with this program; if not, contact Dr. Francis Chung, below,
or the Free Software Foundation, 675 Mass Ave, Cambridge, MA
02139, USA.
THIS SOFTWARE AND DOCUMENTATION ARE PROVIDED BY THE CALIFORNIA
DEPARTMENT OF WATER RESOURCES AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE CALIFORNIA
DEPARTMENT OF WATER RESOURCES OR ITS CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OR SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
For more information about VISTA, contact:
Dr. Francis Chung
California Dept. of Water Resources
Division of Planning, Delta Modeling Section
1416 Ninth Street
Sacramento, CA 95814
916-653-5601
chung@water.ca.gov
or see our home page: http://wwwdelmod.water.ca.gov/
Send bug reports to nsandhu@water.ca.gov or call (916)-653-7552
*/
package vista.graph;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Rectangle;
/**
* A line which represents the curve characterstics.
*
* @author Nicky Sandhu
* @version $Id: CurveLegendLine.java,v 1.1 2003/10/02 20:48:52 redwood Exp $
*/
public class CurveLegendLine extends GraphicElement {
/**
* A line with the same attributes as the curve
*/
public CurveLegendLine(Curve curve) {
super(curve.getAttributes());
_curve = curve;
}
/**
*
*/
public Dimension getPreferredSize() {
return new Dimension(50, 20);
}
/**
*
*/
public Dimension getMinimumSize() {
return getPreferredSize();
}
/**
*
*/
public void Draw() {
Graphics gc = getGraphics();
CurveAttr attr = (CurveAttr) getAttributes();
Rectangle r = getBounds();
int yPos = r.y + r.height / 2;
if (DEBUG)
System.out.println("Rectangle for legend item: " + r);
if (attr._thickness > 1)
GraphUtils.drawThickLine(gc, r.x, yPos, r.x + r.width, yPos,
attr._thickness);
else
gc.drawLine(r.x, yPos, r.x + r.width, yPos);
if (attr._drawSymbol) {
Symbol sym = _curve.getSymbol();
if (sym != null) {
Rectangle symbolBounds = sym.getBounds();
if (DEBUG)
System.out.println("Symbol for legend item: "
+ symbolBounds);
symbolBounds.x = r.x + r.width / 2;
symbolBounds.y = yPos;
sym.draw(gc, symbolBounds);
symbolBounds.x = r.x + r.width / 4;
symbolBounds.y = yPos;
sym.draw(gc, symbolBounds);
symbolBounds.x = r.x + (r.width * 3) / 4;
symbolBounds.y = yPos;
sym.draw(gc, symbolBounds);
}
}
}
/**
* The curve which is being represented
*/
protected Curve _curve;
/**
*
*/
private static final boolean DEBUG = false;
}
| [
"psandhu@water.ca.gov@103a348e-0cfb-11df-a5af-b38b39d06e06"
] | psandhu@water.ca.gov@103a348e-0cfb-11df-a5af-b38b39d06e06 |
b9a54bada6fd41da3ec7f5aebf871f1f2ffe40b6 | 44c38af38bf11fc6010a198fbf4166079cf3eabb | /src/main/java/com/example/demo/entity/ErrorStatus.java | e90815043a5db622514980a76c4ef02ca44f6acd | [] | no_license | thidaswezin1/SpringJPA | daa107c6e60b5a6e8f8d4d71db4c38f1f59471ee | 26901a91a2f2c51b626d95cd5098fa30affb177b | refs/heads/master | 2020-06-21T22:39:03.301625 | 2019-12-09T06:47:15 | 2019-12-09T06:47:15 | 197,568,914 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 490 | java | package com.example.demo.entity;
public class ErrorStatus {
private boolean error;
private String status;
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public boolean getError() {
return error;
}
public void setError(boolean error) {
this.error = error;
}
public ErrorStatus( String status,boolean error) {
super();
this.error = error;
this.status = status;
}
}
| [
"thidasewzin@gmail.com"
] | thidasewzin@gmail.com |
ea5ad0b6f56a3c66868622bcf12f8044e1fb97b2 | 14deebd39776b0c43ffdcb6d37d8a711acd75a09 | /SkQuery/src/com/w00tmast3r/skquery/util/IterableEnumeration.java | da06a91425c8aa63946cca26cf3fee26748629cc | [
"Apache-2.0"
] | permissive | JethroHotep/skquery | 5293e5fc36c8c769d161b365ee1cd8b294481a2b | a3f318f8d28fe04106ff935f7ac2bcac44236fb8 | refs/heads/master | 2020-03-16T20:22:50.599279 | 2017-10-09T05:12:36 | 2017-10-09T05:12:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 956 | java | package com.w00tmast3r.skquery.util;
import ch.njol.util.coll.iterator.EmptyIterator;
import java.util.Enumeration;
import java.util.Iterator;
public class IterableEnumeration<T> implements Iterable<T> {
final Enumeration<? extends T> e;
public IterableEnumeration(final Enumeration<? extends T> e) {
this.e = e;
}
@Override
public Iterator<T> iterator() {
final Enumeration<? extends T> e = this.e;
if (e == null)
return EmptyIterator.get();
return new Iterator<T>() {
@Override
public boolean hasNext() {
return e.hasMoreElements();
}
@Override
public T next() {
return e.nextElement();
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}
};
}
}
| [
"Sean Grover@Gladiator"
] | Sean Grover@Gladiator |
38e5180462a57d03203c19195391b227629909ed | a8b8d20a803b4e16b826aad6cf23991e20a86713 | /module11/module4/FromCToF/src/com/goitonline/mod4/temperatureConvertor/FormCelToFar.java | 4c3d03e5822b163b264f9752d58868df3062f210 | [] | no_license | svetalbd/MyHomeworks | 6614ca906bf1bf5b094dfe6310172a47ef2b95ca | de2a45b64ff1ccddc167406e04847be09b6c9b0a | refs/heads/master | 2021-01-10T03:09:20.374588 | 2016-04-07T08:20:49 | 2016-04-07T08:20:49 | 52,582,547 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,125 | java | package com.goitonline.mod4.temperatureConvertor;
import java.util.Scanner;
/**
* Created by Mykhailenko Svitlana on 08.03.2016.
*/
public class FormCelToFar {
static boolean exitValue = true;
public static void main (String[] args){
while (exitValue) {
System.out.println("\nMake your choice: 1 - convert from Celsius to Farrengeyt; 2 - from Farrengeyt to Celcium; 3 - break.");
Scanner sc = new Scanner(System.in);
int choice = sc.nextInt();
switch (choice) {
case 1:
double resultCF = ConvertFromCelsiusToFarrengeyt(readValue());
System.out.printf("The temperature according to Farrengeyt is %.3f\n", resultCF);
break;
case 2:
double resultFC = ConvertFromFarrengeytToCelsius(readValue());
System.out.printf("The temperature according to Celsius is %.3f\n", resultFC);
break;
case 3:
exitValue = false;
break;
default:
System.out.println("Unknown number\n");
break;
}
}
}
public static double ConvertFromCelsiusToFarrengeyt(double temperature){
double result;
result = temperature*9d/5d+32d;
return result;
}
public static double ConvertFromFarrengeytToCelsius(double temperature){
double result;
result = (temperature-32d)*(5d/9d);
return result;
}
private static double readValue (){
String newString;
Double value;
System.out.println("Input a temperature you need to convert: \n");
Scanner sc = new Scanner(System.in);
String phrase = sc.next();
String delims = "[ ]+";
String[] tokens = phrase.split(delims);
if (tokens[0].contains(",")) {
newString = tokens[0].replace(',', '.');
}
else newString = tokens[0];
value = Double.parseDouble(newString);
return value;
}
}
| [
"mykhailenko.s@ukr.net"
] | mykhailenko.s@ukr.net |
4564885a195a791b2eebdbe4ecd8d328e992ca1f | 86385842f9d949de5bc6c03e36fad08fb2b98671 | /oa/src/main/java/com/oa/html/AttendanceToShow.java | 7cad7557dc011cf2b3f4c82bb416c130c644b035 | [] | no_license | ls979012169/oa | 3baf0e0d18c356cbfdda61de7b953d08f66e6ae0 | 4403e6111a5aeb444101eab1befa19deae1ed388 | refs/heads/master | 2022-12-21T21:38:17.003580 | 2019-11-12T08:12:58 | 2019-11-12T08:12:58 | 221,164,159 | 0 | 0 | null | 2022-12-16T01:42:27 | 2019-11-12T08:11:04 | Java | UTF-8 | Java | false | false | 2,661 | java | package com.oa.html;
/**
* @author xxl
* @category 用来展示的实时考勤表
*/
public class AttendanceToShow {
/**
* 员工编号
*/
private int eid;
/**
* 员工姓名
*/
private String ename;
/**
* 员工部门
*/
private String dname;
/**
* 员工职务
*/
private String pname;
/**
* 第1天打卡情况
*/
private String state1;
/**
* 第2天打卡情况
*/
private String state2;
/**
* 第3天打卡情况
*/
private String state3;
/**
* 第4天打卡情况
*/
private String state4;
/**
* 第5天打卡情况
*/
private String state5;
/**
* 第6天打卡情况
*/
private String state6;
/**
* 第7天打卡情况
*/
private String state7;
public AttendanceToShow() {
super();
}
public AttendanceToShow(int eid, String ename, String dname, String pname, String state1, String state2,
String state3, String state4, String state5, String state6, String state7) {
super();
this.eid = eid;
this.ename = ename;
this.dname = dname;
this.pname = pname;
this.state1 = state1;
this.state2 = state2;
this.state3 = state3;
this.state4 = state4;
this.state5 = state5;
this.state6 = state6;
this.state7 = state7;
}
public int getEid() {
return eid;
}
public void setEid(int eid) {
this.eid = eid;
}
public String getEname() {
return ename;
}
public void setEname(String ename) {
this.ename = ename;
}
public String getDname() {
return dname;
}
public void setDname(String dname) {
this.dname = dname;
}
public String getPname() {
return pname;
}
public void setPname(String pname) {
this.pname = pname;
}
public String getState1() {
return state1;
}
public void setState1(String state1) {
this.state1 = state1;
}
public String getState2() {
return state2;
}
public void setState2(String state2) {
this.state2 = state2;
}
public String getState3() {
return state3;
}
public void setState3(String state3) {
this.state3 = state3;
}
public String getState4() {
return state4;
}
public void setState4(String state4) {
this.state4 = state4;
}
public String getState5() {
return state5;
}
public void setState5(String state5) {
this.state5 = state5;
}
public String getState6() {
return state6;
}
public void setState6(String state6) {
this.state6 = state6;
}
public String getState7() {
return state7;
}
public void setState7(String state7) {
this.state7 = state7;
}
}
| [
"Administrator@169.254.201.147"
] | Administrator@169.254.201.147 |
5f9b027bfe992967adb5254e0c9a0865d14ec62d | d13b22cfa7d20c70216365745bc890fb35640017 | /service/src/main/java/com/cj/scores/service/impl/RedissonLockImpl.java | afb95971e3f3c12aba04b9b475d03e673c7ac278 | [] | no_license | wycmiko/cj-push | 376622b458c1559b1f6f12e96a3a8bfafdcf80d2 | a5ffb704779b72bbbf6ce6020e29be68df27bc89 | refs/heads/master | 2022-07-10T21:33:04.653050 | 2022-06-27T09:47:00 | 2022-06-27T09:47:00 | 244,141,535 | 0 | 0 | null | 2022-06-27T09:47:01 | 2020-03-01T12:03:49 | Java | UTF-8 | Java | false | false | 1,570 | java | package com.cj.scores.service.impl;
/**
* @author
* @date 2018/9/17
* @since 1.0
*/
import com.cj.scores.service.cfg.DistributedLocker;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import java.util.concurrent.TimeUnit;
public class RedissonLockImpl implements DistributedLocker {
private RedissonClient redissonClient;
@Override
public RLock lock(String lockKey) {
RLock lock = redissonClient.getLock(lockKey);
lock.lock();
return lock;
}
@Override
public RLock lock(String lockKey, int leaseTime) {
RLock lock = redissonClient.getLock(lockKey);
lock.lock(leaseTime, TimeUnit.SECONDS);
return lock;
}
@Override
public RLock lock(String lockKey, TimeUnit unit ,int timeout) {
RLock lock = redissonClient.getLock(lockKey);
lock.lock(timeout, unit);
return lock;
}
@Override
public boolean tryLock(String lockKey, TimeUnit unit, int waitTime, int leaseTime) {
RLock lock = redissonClient.getLock(lockKey);
try {
return lock.tryLock(waitTime, leaseTime, unit);
} catch (InterruptedException e) {
return false;
}
}
@Override
public void unlock(String lockKey) {
RLock lock = redissonClient.getLock(lockKey);
lock.unlock();
}
@Override
public void unlock(RLock lock) {
lock.unlock();
}
public void setRedissonClient(RedissonClient redissonClient) {
this.redissonClient = redissonClient;
}
} | [
"wycmiko@foxmail.com"
] | wycmiko@foxmail.com |
4dd62d9b7a5b2cd263d41fb6010c28a7188aeb3b | f07b26c8e42f93b46ca86cdcf69a4a793927b55f | /acl/src/test/java/org/springframework/security/acls/domain/AccessControlImplEntryTests.java | 743f8ee3b8e3f4b01226b498f47e91d368959f06 | [
"Apache-2.0"
] | permissive | xxnjdg/spring-security-5.4.0 | 3e2d3bd53d736760731e757c662b03a294f4a7f9 | e5a8537e522460fe467f6a92caa7e10464ba90a9 | refs/heads/master | 2022-12-28T07:36:50.426653 | 2020-10-09T14:33:48 | 2020-10-09T14:33:48 | 302,667,169 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,317 | java | /*
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.security.acls.domain;
import org.junit.Test;
import org.springframework.security.acls.model.AccessControlEntry;
import org.springframework.security.acls.model.Acl;
import org.springframework.security.acls.model.AuditableAccessControlEntry;
import org.springframework.security.acls.model.ObjectIdentity;
import org.springframework.security.acls.model.Sid;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
/**
* Tests for {@link AccessControlEntryImpl}.
*
* @author Andrei Stefan
*/
public class AccessControlImplEntryTests {
@Test
public void testConstructorRequiredFields() {
// Check Acl field is present
try {
new AccessControlEntryImpl(null, null, new PrincipalSid("johndoe"), BasePermission.ADMINISTRATION, true,
true, true);
fail("It should have thrown IllegalArgumentException");
}
catch (IllegalArgumentException expected) {
}
// Check Sid field is present
try {
new AccessControlEntryImpl(null, mock(Acl.class), null, BasePermission.ADMINISTRATION, true, true, true);
fail("It should have thrown IllegalArgumentException");
}
catch (IllegalArgumentException expected) {
}
// Check Permission field is present
try {
new AccessControlEntryImpl(null, mock(Acl.class), new PrincipalSid("johndoe"), null, true, true, true);
fail("It should have thrown IllegalArgumentException");
}
catch (IllegalArgumentException expected) {
}
}
@Test
public void testAccessControlEntryImplGetters() {
Acl mockAcl = mock(Acl.class);
Sid sid = new PrincipalSid("johndoe");
// Create a sample entry
AccessControlEntry ace = new AccessControlEntryImpl(1L, mockAcl, sid, BasePermission.ADMINISTRATION, true, true,
true);
// and check every get() method
assertThat(ace.getId()).isEqualTo(1L);
assertThat(ace.getAcl()).isEqualTo(mockAcl);
assertThat(ace.getSid()).isEqualTo(sid);
assertThat(ace.isGranting()).isTrue();
assertThat(ace.getPermission()).isEqualTo(BasePermission.ADMINISTRATION);
assertThat(((AuditableAccessControlEntry) ace).isAuditFailure()).isTrue();
assertThat(((AuditableAccessControlEntry) ace).isAuditSuccess()).isTrue();
}
@Test
public void testEquals() {
final Acl mockAcl = mock(Acl.class);
final ObjectIdentity oid = mock(ObjectIdentity.class);
given(mockAcl.getObjectIdentity()).willReturn(oid);
Sid sid = new PrincipalSid("johndoe");
AccessControlEntry ace = new AccessControlEntryImpl(1L, mockAcl, sid, BasePermission.ADMINISTRATION, true, true,
true);
assertThat(ace).isNotNull();
assertThat(ace).isNotEqualTo(100L);
assertThat(ace).isEqualTo(ace);
assertThat(ace).isEqualTo(
new AccessControlEntryImpl(1L, mockAcl, sid, BasePermission.ADMINISTRATION, true, true, true));
assertThat(ace).isNotEqualTo(
new AccessControlEntryImpl(2L, mockAcl, sid, BasePermission.ADMINISTRATION, true, true, true));
assertThat(ace).isNotEqualTo(new AccessControlEntryImpl(1L, mockAcl, new PrincipalSid("scott"),
BasePermission.ADMINISTRATION, true, true, true));
assertThat(ace)
.isNotEqualTo(new AccessControlEntryImpl(1L, mockAcl, sid, BasePermission.WRITE, true, true, true));
assertThat(ace).isNotEqualTo(
new AccessControlEntryImpl(1L, mockAcl, sid, BasePermission.ADMINISTRATION, false, true, true));
assertThat(ace).isNotEqualTo(
new AccessControlEntryImpl(1L, mockAcl, sid, BasePermission.ADMINISTRATION, true, false, true));
assertThat(ace).isNotEqualTo(
new AccessControlEntryImpl(1L, mockAcl, sid, BasePermission.ADMINISTRATION, true, true, false));
}
}
| [
"1422570468@qq.com"
] | 1422570468@qq.com |
41b1ed3616ffd20b63c4244bbb3d654d4252ba24 | 13dd12fef979b268ae3bfb5a655e91f0f8ceb90a | /src/test/java/dev/liam/postcodesandnames/controllers/NameRequestHandlerTest.java | 98fa51b033e95fedd1585115a97a514b397cdefe | [] | no_license | Mandalorian5426/postcodes-and-names | 0dc0ac1482c09e4df762cc1f20cba949c54196c1 | a6e94deb8f1d02bb36dfbb51a85b9d1d1424c809 | refs/heads/master | 2023-06-25T01:55:52.602106 | 2021-07-24T07:54:45 | 2021-07-24T07:59:22 | 388,099,316 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,276 | java | package dev.liam.postcodesandnames.controllers;
import dev.liam.postcodesandnames.PostcodesAndNamesApplication;
import dev.liam.postcodesandnames.models.PostcodeName;
import dev.liam.postcodesandnames.repositories.PostcodeNameRepository;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
@RunWith(SpringRunner.class)
@SpringBootTest(
webEnvironment = SpringBootTest.WebEnvironment.MOCK,
classes = PostcodesAndNamesApplication.class)
@AutoConfigureMockMvc
public class NameRequestHandlerTest {
@Autowired
private MockMvc mvc;
@Autowired
private PostcodeNameRepository repository;
@Test
public void givenNoPostcodeNames_whenGetName_thenStatus200WithEmptyResponse() {
try {
mvc.perform(get("/name?start=6000&end=6999")
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
.andExpect(jsonPath("$.totalChars").value(0))
.andExpect(jsonPath("$.names").isArray())
.andExpect(jsonPath("$.names").isEmpty());
} catch (Exception e) {
Assert.fail(e.getMessage());
}
}
@Test
public void givenNoRequestParameters_whenGetName_thenStatus400() {
try {
mvc.perform(get("/name")
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().is4xxClientError());
} catch (Exception e) {
Assert.fail(e.getMessage());
}
}
@Test
public void givenStartPostcodeGreaterThanEndPostcode_whenGetName_thenStatus400() {
try {
mvc.perform(get("/name?start=6999&end=6000")
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().is4xxClientError());
} catch (Exception e) {
Assert.fail(e.getMessage());
}
}
@Test
public void givenPostCodeName_whenGetName_thenStatus200WithNameAndTotalCharsReturned() {
try {
repository.save(new PostcodeName(1, 6500, "Steve"));
mvc.perform(get("/name?start=6000&end=6999")
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
.andExpect(jsonPath("$.totalChars").value(5))
.andExpect(jsonPath("$.names").isArray())
.andExpect(jsonPath("$.names[0]").value("Steve"));
} catch (Exception e) {
Assert.fail(e.getMessage());
}
}
}
| [
"liam@hive9.systems"
] | liam@hive9.systems |
5387b7592d4bef657003dc277611c3eeb6630002 | 9b068e27b906e76a01b9dc80614eb94156ab7b29 | /zftal-questionnaire-core/src/java/com/zfsoft/wjdc_xc/query/InspectionTaskQuery.java | d1b79f4ec80e9d9e6799528ded1a7fe4495d6ad8 | [] | no_license | rogerfan2016/jxpj_zgmh | c3df18f8e29a5ac919bbedb2b350b639c619513d | 0c693004b9388a779b103a990689995fe2c76503 | refs/heads/master | 2021-01-15T15:27:37.919441 | 2016-09-02T05:10:57 | 2016-09-02T05:10:57 | 63,835,587 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,392 | java | package com.zfsoft.wjdc_xc.query;
import java.util.Date;
import com.zfsoft.dao.query.BaseQuery;
import com.zfsoft.orcus.lang.TimeUtil;
/**
*
* @author ChenMinming
* @date 2015-6-10
* @version V1.0.0
*/
public class InspectionTaskQuery extends BaseQuery{
private static final long serialVersionUID = -3590952749231554472L;
private String id;
private String wjText;
private String configType;
private String rwjb;
private String rwbm;
private String rwmc;
private String taskDate;
private Date start;
private Date end;
private String zt;
private String xy;
private String zy;
private String xm;
private String xzb;
private String kcmc;
private String kcjc;
private String kkxy;
private String xn;
private String xq;
private String condition;
/**
* 返回
*/
public String getWjText() {
return wjText;
}
/**
* 设置
* @param wjText
*/
public void setWjText(String wjText) {
this.wjText = wjText;
}
/**
* 返回
*/
public Date getStart() {
return start;
}
public String getStartText() {
if(start==null) return "";
return TimeUtil.format(start, TimeUtil.yyyy_MM_dd);
}
/**
* 设置
* @param start
*/
public void setStart(Date start) {
this.start = start;
}
/**
* 返回
*/
public Date getEnd() {
return end;
}
public String getEndText() {
if(end==null) return "";
return TimeUtil.format(end, TimeUtil.yyyy_MM_dd);
}
/**
* 设置
* @param end
*/
public void setEnd(Date end) {
this.end = end;
}
/**
* 返回
*/
public String getConfigType() {
return configType;
}
/**
* 设置
* @param configType
*/
public void setConfigType(String configType) {
this.configType = configType;
}
public String getZt() {
return zt;
}
public void setZt(String zt) {
this.zt = zt;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getXy() {
return xy;
}
public void setXy(String xy) {
this.xy = xy;
}
public String getZy() {
return zy;
}
public void setZy(String zy) {
this.zy = zy;
}
public String getXm() {
return xm;
}
public void setXm(String xm) {
this.xm = xm;
}
public String getXzb() {
return xzb;
}
public void setXzb(String xzb) {
this.xzb = xzb;
}
public String getRwjb() {
return rwjb;
}
public void setRwjb(String rwjb) {
this.rwjb = rwjb;
}
public String getRwbm() {
return rwbm;
}
public void setRwbm(String rwbm) {
this.rwbm = rwbm;
}
public String getRwmc() {
return rwmc;
}
public void setRwmc(String rwmc) {
this.rwmc = rwmc;
}
public String getTaskDate() {
return taskDate;
}
public void setTaskDate(String taskDate) {
this.taskDate = taskDate;
}
public String getKcmc() {
return kcmc;
}
public void setKcmc(String kcmc) {
this.kcmc = kcmc;
}
public String getKcjc() {
return kcjc;
}
public void setKcjc(String kcjc) {
this.kcjc = kcjc;
}
public String getKkxy() {
return kkxy;
}
public void setKkxy(String kkxy) {
this.kkxy = kkxy;
}
public String getXn() {
return xn;
}
public void setXn(String xn) {
this.xn = xn;
}
public String getXq() {
return xq;
}
public void setXq(String xq) {
this.xq = xq;
}
public String getCondition() {
return condition;
}
public void setCondition(String condition) {
this.condition = condition;
}
}
| [
"rogerfan@11wlw.com"
] | rogerfan@11wlw.com |
86d4e80212d791d5669564230b756040598c6aac | b86cf748a5c74a2aa75560dd3451b81a6b06f60c | /src/main/java/pl/coderslab/charity/Category/CategoryRepository.java | 9c044d265e67dad2d2cc02345538a089143716c3 | [] | no_license | monikamisiewicz/charity | 0211ed04ee0139fd006b699e4e828daf4d3d1ce9 | 0fc64f44e52f9921fa31c56d83e95cb7586887e2 | refs/heads/master | 2021-03-08T07:41:38.753537 | 2020-04-08T16:11:02 | 2020-04-08T16:11:02 | 246,311,441 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 181 | java | package pl.coderslab.charity.Category;
import org.springframework.data.jpa.repository.JpaRepository;
public interface CategoryRepository extends JpaRepository<Category, Long> {
}
| [
"zieba.monika@wp.pl"
] | zieba.monika@wp.pl |
249ce5ceadc3515d010b1403c7d24482debc162b | 3cae9b17a08406beb4fb31582b04742c37532028 | /src/main/java/com/svoeller/demo/WardemoApplication.java | c4402bf00df0aa2224564c86695ccc3194144783 | [] | no_license | svoeller99/springboot-war-demo | 7903e1cb19ba3df9dbabec113ff68064fdd98db3 | 2df726445b3e0e655ccefaf464a5bb5d2cc4e978 | refs/heads/master | 2022-10-27T08:26:07.489639 | 2022-10-23T20:38:07 | 2022-10-23T20:38:07 | 202,574,374 | 0 | 0 | null | 2019-08-15T17:19:46 | 2019-08-15T16:20:20 | Java | UTF-8 | Java | false | false | 310 | java | package com.svoeller.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class WardemoApplication {
public static void main(String[] args) {
SpringApplication.run(WardemoApplication.class, args);
}
}
| [
"sean.voeller@gmail.com"
] | sean.voeller@gmail.com |
8c6ad549aa9da1eb43a1fa0fc11e30726e5d636e | c0afd87a26ca796d38076235a4a26e688bdc24ce | /swing/sample/Slider.java | 8d98204296c3778170b7380ce8e4c6644a9e16f6 | [] | no_license | shika-sophia/sophia2021 | 8a0d0e4896d4300b29b7242162b01b06b434cef8 | 0d6619f6f900780ebb33c5464b666eb423a8a250 | refs/heads/main | 2023-06-30T09:06:09.466747 | 2021-07-25T01:17:34 | 2021-07-25T01:17:34 | 331,533,011 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,820 | java | /**
* @title swing / sample / Slider.java
* @reference 日向俊二『JavaGUIプログラミング
* ~Swingを使った今どきのアプリ開発』カットシステム, 2020
* @content List 12.1 / p235 / スライダー
* @author shika
* @date 2021-02-16
*/
package swing.sample;
import java.awt.Color;
import java.awt.GridLayout;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JSlider;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
public class Slider extends JFrame {
JSlider redSlider = new JSlider(0, 255, 128);
JSlider greenSlider = new JSlider(0, 255, 128);
JSlider blueSlider = new JSlider(0, 255, 128);
JPanel panel = new JPanel();
Slider() {
this.setLayout(new GridLayout(4, 1));
ChangeListener listener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
int red = redSlider.getValue();
int green = greenSlider.getValue();
int blue = blueSlider.getValue();
panel.setBackground(new Color(red, green, blue));
}
};//listener
redSlider.addChangeListener(listener);
greenSlider.addChangeListener(listener);
blueSlider.addChangeListener(listener);
add(redSlider);
add(greenSlider);
add(blueSlider);
add(panel);
listener.stateChanged(null); //初期値を表示
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setTitle("Slider");
this.setSize(250, 200);
this.setVisible(true);
}//constructor
public static void main(String[] args) {
new Slider();
}//main()
}//class
| [
"noreply@github.com"
] | shika-sophia.noreply@github.com |
12e67ca3b9f13dc9366dd239c96d01988d91110b | 17316c19fe021b018db2222060004b39d9063b79 | /Arrays and arraylists/PassingInFunctions.java | bb524b68b217e33c1ad9473535f019b581ebd350 | [] | no_license | using-namespace-ruhul/DSA-Bootcamp-in-JAVA | 0bda0633dc88a2703d0ae1f7e909c9a9c8f9fb6d | f9bbd95ea05e9e729cd130e37d06890d79c51b21 | refs/heads/master | 2023-08-23T22:25:04.978356 | 2021-09-18T08:13:44 | 2021-09-18T08:13:44 | 398,664,235 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 460 | java | package com.company;
import java.util.Arrays;
import java.util.Scanner;
public class PassingInFunctions {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
//int[] arr = new int[5];
int[] arr = {1,2,3,4,5};
System.out.println(Arrays.toString(arr));
change(arr);
System.out.print(Arrays.toString(arr));
}
static void change(int[] array) {
array[0] = 99;
}
}
| [
"ruhul.sardar143@gmail.com"
] | ruhul.sardar143@gmail.com |
86343b285d72a3d0fc5b5abd6e66f4a97df729d2 | 414f79b12e61147deabd8e01fd61bf61ab9b3292 | /src/java/races/filters/PageRedirectSecurityFilter.java | fb81e7302df54a7bb97ffafba779e8a4f7e05b32 | [] | no_license | Irbis691/Project-4-Horce-racing-totalizator- | 9709d053d1b2d481757420f19f4c15d2297a1712 | e3433a8d76493061470b5ae32e506c4c3a5eb361 | refs/heads/master | 2020-06-04T13:26:56.772139 | 2015-11-29T13:53:32 | 2015-11-29T13:53:32 | 37,206,751 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,497 | 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 races.filters;
import java.io.IOException;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebFilter;
import javax.servlet.annotation.WebInitParam;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Filter that redirect to index.jsp all direct requests to pages from jsp
* directory
*
* @version 1.0 7 Jun 2015
* @author Пазинич
*/
@WebFilter(filterName = "PageRedirectSecurityFilter", urlPatterns = {"/jsp/*"},
initParams = {@WebInitParam(name = "INDEX_PATH", value = "/index.jsp")})
public class PageRedirectSecurityFilter implements Filter {
private static final boolean debug = true;
// The filter configuration object we are associated with. If
// this value is null, this filter instance is not currently
// configured.
private FilterConfig filterConfig = null;
/**
* variable, to which address of index page is assign in init method
*/
private String indexPath;
/**
*
*/
public PageRedirectSecurityFilter() {
}
private void doBeforeProcessing(ServletRequest request, ServletResponse response)
throws IOException, ServletException {
if (debug) {
log("PageRedirectSecurityFilter:DoBeforeProcessing");
}
// Write code here to process the request and/or response before
// the rest of the filter chain is invoked.
// For example, a logging filter might log items on the request object,
// such as the parameters.
/*
for (Enumeration en = request.getParameterNames(); en.hasMoreElements(); ) {
String name = (String)en.nextElement();
String values[] = request.getParameterValues(name);
int n = values.length;
StringBuffer buf = new StringBuffer();
buf.append(name);
buf.append("=");
for(int i=0; i < n; i++) {
buf.append(values[i]);
if (i < n-1)
buf.append(",");
}
log(buf.toString());
}
*/
}
private void doAfterProcessing(ServletRequest request, ServletResponse response)
throws IOException, ServletException {
if (debug) {
log("PageRedirectSecurityFilter:DoAfterProcessing");
}
// Write code here to process the request and/or response after
// the rest of the filter chain is invoked.
// For example, a logging filter might log the attributes on the
// request object after the request has been processed.
/*
for (Enumeration en = request.getAttributeNames(); en.hasMoreElements(); ) {
String name = (String)en.nextElement();
Object value = request.getAttribute(name);
log("attribute: " + name + "=" + value.toString());
}
*/
// For example, a filter might append something to the response.
/*
PrintWriter respOut = new PrintWriter(response.getWriter());
respOut.println("<P><B>This has been appended by an intrusive filter.</B>");
*/
}
/**
*
* @param request The servlet request we are processing
* @param response The servlet response we are creating
* @param chain The filter chain we are processing
*
* @exception IOException if an input/output error occurs
* @exception ServletException if a servlet error occurs
*/
@Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain)
throws IOException, ServletException {
if (debug) {
log("PageRedirectSecurityFilter:doFilter()");
}
doBeforeProcessing(request, response);
HttpServletRequest httpRequest = (HttpServletRequest) request;
HttpServletResponse httpResponse = (HttpServletResponse) response;
httpResponse.sendRedirect(httpRequest.getContextPath() + indexPath);
Throwable problem = null;
try {
chain.doFilter(request, response);
} catch (IOException | ServletException t) {
// If an exception is thrown somewhere down the filter chain,
// we still want to execute our after processing, and then
// rethrow the problem after that.
problem = t;
t.printStackTrace();
}
doAfterProcessing(request, response);
// If there was a problem, we want to rethrow it if it is
// a known type, otherwise log it.
if (problem != null) {
if (problem instanceof ServletException) {
throw (ServletException) problem;
}
if (problem instanceof IOException) {
throw (IOException) problem;
}
sendProcessingError(problem, response);
}
}
/**
* Return the filter configuration object for this filter.
* @return
*/
public FilterConfig getFilterConfig() {
return (this.filterConfig);
}
/**
* Set the filter configuration object for this filter.
*
* @param filterConfig The filter configuration object
*/
public void setFilterConfig(FilterConfig filterConfig) {
this.filterConfig = filterConfig;
}
/**
* Destroy method for this filter
*/
@Override
public void destroy() {
}
/**
* Init method for this filter
* @param filterConfig
*/
@Override
public void init(FilterConfig filterConfig) {
this.filterConfig = filterConfig;
if (filterConfig != null) {
if (debug) {
log("PageRedirectSecurityFilter:Initializing filter");
}
}
indexPath = filterConfig.getInitParameter("INDEX_PATH");
}
/**
* Return a String representation of this object.
*/
@Override
public String toString() {
if (filterConfig == null) {
return ("PageRedirectSecurityFilter()");
}
StringBuilder sb = new StringBuilder("PageRedirectSecurityFilter(");
sb.append(filterConfig);
sb.append(")");
return (sb.toString());
}
private void sendProcessingError(Throwable t, ServletResponse response) {
String stackTrace = getStackTrace(t);
if (stackTrace != null && !stackTrace.equals("")) {
try {
response.setContentType("text/html");
try (PrintStream ps = new PrintStream(response.getOutputStream()); PrintWriter pw = new PrintWriter(ps)) {
pw.print("<html>\n<head>\n<title>Error</title>\n</head>\n<body>\n"); //NOI18N
// PENDING! Localize this for next official release
pw.print("<h1>The resource did not process correctly</h1>\n<pre>\n");
pw.print(stackTrace);
pw.print("</pre></body>\n</html>"); //NOI18N
}
response.getOutputStream().close();
} catch (Exception ex) {
}
} else {
try {
try (PrintStream ps = new PrintStream(response.getOutputStream())) {
t.printStackTrace(ps);
}
response.getOutputStream().close();
} catch (Exception ex) {
}
}
}
/**
*
* @param t
* @return
*/
public static String getStackTrace(Throwable t) {
String stackTrace = null;
try {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
t.printStackTrace(pw);
pw.close();
sw.close();
stackTrace = sw.getBuffer().toString();
} catch (Exception ex) {
}
return stackTrace;
}
/**
*
* @param msg
*/
public void log(String msg) {
filterConfig.getServletContext().log(msg);
}
}
| [
"irbis691@gmail.com"
] | irbis691@gmail.com |
51b1c1b73338dc98f04525769194826ba5349264 | 75bb9ee685597af08e0d334e1e58c3143f08f013 | /SoapLab/src/MenuItemResponse/Body.java | c3721aed18f0fdbafcb94c2f3acd9238308b8e72 | [] | no_license | JMichaelWatson/Watson_JMichael_CSC380 | 65cb02149e0e4ec2e568b88f70b7e0f80c680a8b | 512293cc4f33ab0c56690b2ffd8c3bb5804d4ab6 | refs/heads/master | 2020-05-29T18:37:25.722042 | 2013-08-12T10:00:33 | 2013-08-12T10:00:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,431 | java |
package MenuItemResponse;
import javax.xml.bind.annotation.*;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{http://local8080/soap/jwatson/lunch/restaurant}menuResponse"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"menuResponse"
})
@XmlRootElement(name = "Body", namespace = "http://www.w3.org/2001/12/soap-envelope")
public class Body {
@XmlElement(namespace = "http://local8080/soap/jwatson/lunch/restaurant", required = true)
protected MenuResponse menuResponse;
/**
* Gets the value of the menuResponse property.
*
* @return
* possible object is
* {@link MenuResponse }
*
*/
public MenuResponse getMenuResponse() {
return menuResponse;
}
/**
* Sets the value of the menuResponse property.
*
* @param value
* allowed object is
* {@link MenuResponse }
*
*/
public void setMenuResponse(MenuResponse value) {
this.menuResponse = value;
}
}
| [
"jwatson@student.neumont.edu"
] | jwatson@student.neumont.edu |
6676b45428d679fef3c735030326239f7758d6d6 | 0fc972481ce8b0755ef9c1f0f218c0887120c2fc | /src/main/java/com/simnectzbank/lbs/processlayer/termdeposit/model/TermDepositRateModel.java | 3f9458a9244604c15e8c6de7f20b9e2d5aeba68b | [] | no_license | 18729544877/termdeposit-process | 4dfa6b6c5a841133a94212940d271c5821c36dba | 8768d48cf651628609b9e4b6be07dd8046210b21 | refs/heads/master | 2022-07-14T11:01:26.047180 | 2019-08-26T10:18:04 | 2019-08-26T10:18:04 | 200,891,424 | 0 | 0 | null | 2022-06-29T19:42:52 | 2019-08-06T16:56:08 | Java | UTF-8 | Java | false | false | 1,048 | java | package com.simnectzbank.lbs.processlayer.termdeposit.model;
import java.math.BigDecimal;
public class TermDepositRateModel {
private String id;
private String depositrange;
private String tdperiod;
private BigDecimal tdinterestrate;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id == null ? null : id.trim();
}
public String getDepositrange() {
return depositrange;
}
public void setDepositrange(String depositrange) {
this.depositrange = depositrange == null ? null : depositrange.trim();
}
public String getTdperiod() {
return tdperiod;
}
public void setTdperiod(String tdperiod) {
this.tdperiod = tdperiod == null ? null : tdperiod.trim();
}
public BigDecimal getTdinterestrate() {
return tdinterestrate;
}
public void setTdinterestrate(BigDecimal tdinterestrate) {
this.tdinterestrate = tdinterestrate;
}
} | [
"Administrator@PC-20190717ZSCD"
] | Administrator@PC-20190717ZSCD |
b8bcdd5ba0c3282ee6f08eccfac3218ca8ffb1e5 | 0396ef14b9673afcdfd63bb6c05ff3b087d6feda | /vangogh/src/main/java/com/tv/vangogh/loader/DiskLruCache.java | 26dbc79aceddf0c8758b87721f43f63c31adcb3a | [] | no_license | chencong1254/vangogh | d41011ee4a2856e0267e4054ac08559295fdb856 | 8a9d8e483a772579075f72aa6ee7c3ceb20d5a19 | refs/heads/master | 2021-01-20T06:05:18.950858 | 2017-08-26T12:16:06 | 2017-08-26T12:16:06 | 101,483,185 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 33,288 | java | package com.tv.vangogh.loader;
import java.io.BufferedInputStream;
import java.io.BufferedWriter;
import java.io.Closeable;
import java.io.EOFException;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.StringWriter;
import java.io.Writer;
import java.lang.reflect.Array;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
/**
******************************************************************************
* Taken from the JB source code, can be found in:
* libcore/luni/src/main/java/libcore/io/DiskLruCache.java
* or direct link:
* https://android.googlesource.com/platform/libcore/+/android-4.1.1_r1/luni/src/main/java/libcore/io/DiskLruCache.java
******************************************************************************
*
* A cache that uses a bounded amount of space on a filesystem. Each cache
* entry has a string key and a fixed number of values. Values are byte
* sequences, accessible as streams or files. Each value must be between {@code
* 0} and {@code Integer.MAX_VALUE} bytes in length.
*
* <p>The cache stores its data in a directory on the filesystem. This
* directory must be exclusive to the cache; the cache may delete or overwrite
* files from its directory. It is an error for multiple processes to use the
* same cache directory at the same time.
*
* <p>This cache limits the number of bytes that it will store on the
* filesystem. When the number of stored bytes exceeds the limit, the cache will
* remove entries in the background until the limit is satisfied. The limit is
* not strict: the cache may temporarily exceed it while waiting for files to be
* deleted. The limit does not include filesystem overhead or the cache
* journal so space-sensitive applications should set a conservative limit.
*
* <p>Clients call {@link #edit} to create or update the values of an entry. An
* entry may have only one editor at one time; if a value is not available to be
* edited then {@link #edit} will return null.
* <ul>
* <li>When an entry is being <strong>created</strong> it is necessary to
* supply a full set of values; the empty value should be used as a
* placeholder if necessary.
* <li>When an entry is being <strong>edited</strong>, it is not necessary
* to supply data for every value; values default to their previous
* value.
* </ul>
* Every {@link #edit} call must be matched by a call to {@link Editor#commit}
* or {@link Editor#abort}. Committing is atomic: a read observes the full set
* of values as they were before or after the commit, but never a mix of values.
*
* <p>Clients call {@link #get} to read a snapshot of an entry. The read will
* observe the value at the time that {@link #get} was called. Updates and
* removals after the call do not impact ongoing reads.
*
* <p>This class is tolerant of some I/O errors. If files are missing from the
* filesystem, the corresponding entries will be dropped from the cache. If
* an error occurs while writing a cache value, the edit will fail silently.
* Callers should handle other problems by catching {@code IOException} and
* responding appropriately.
*/
public final class DiskLruCache implements Closeable {
static final String JOURNAL_FILE = "journal";
static final String JOURNAL_FILE_TMP = "journal.tmp";
static final String MAGIC = "libcore.io.DiskLruCache";
static final String VERSION_1 = "1";
static final long ANY_SEQUENCE_NUMBER = -1;
private static final String CLEAN = "CLEAN";
private static final String DIRTY = "DIRTY";
private static final String REMOVE = "REMOVE";
private static final String READ = "READ";
private static final Charset UTF_8 = Charset.forName("UTF-8");
private static final int IO_BUFFER_SIZE = 8 * 1024;
/*
* This cache uses a journal file named "journal". A typical journal file
* looks like this:
* libcore.io.DiskLruCache
* 1
* 100
* 2
*
* CLEAN 3400330d1dfc7f3f7f4b8d4d803dfcf6 832 21054
* DIRTY 335c4c6028171cfddfbaae1a9c313c52
* CLEAN 335c4c6028171cfddfbaae1a9c313c52 3934 2342
* REMOVE 335c4c6028171cfddfbaae1a9c313c52
* DIRTY 1ab96a171faeeee38496d8b330771a7a
* CLEAN 1ab96a171faeeee38496d8b330771a7a 1600 234
* READ 335c4c6028171cfddfbaae1a9c313c52
* READ 3400330d1dfc7f3f7f4b8d4d803dfcf6
*
* The first five lines of the journal form its header. They are the
* constant string "libcore.io.DiskLruCache", the disk cache's version,
* the application's version, the value count, and a blank line.
*
* Each of the subsequent lines in the file is a record of the state of a
* cache entry. Each line contains space-separated values: a state, a key,
* and optional state-specific values.
* o DIRTY lines track that an entry is actively being created or updated.
* Every successful DIRTY action should be followed by a CLEAN or REMOVE
* action. DIRTY lines without a matching CLEAN or REMOVE indicate that
* temporary files may need to be deleted.
* o CLEAN lines track a cache entry that has been successfully published
* and may be read. A publish line is followed by the lengths of each of
* its values.
* o READ lines track accesses for LRU.
* o REMOVE lines track entries that have been deleted.
*
* The journal file is appended to as cache operations occur. The journal may
* occasionally be compacted by dropping redundant lines. A temporary file named
* "journal.tmp" will be used during compaction; that file should be deleted if
* it exists when the cache is opened.
*/
private final File directory;
private final File journalFile;
private final File journalFileTmp;
private final int appVersion;
private final long maxSize;
private final int valueCount;
private long size = 0;
private Writer journalWriter;
private final LinkedHashMap<String, Entry> lruEntries
= new LinkedHashMap<String, Entry>(0, 0.75f, true);
private int redundantOpCount;
/**
* To differentiate between old and current snapshots, each entry is given
* a sequence number each time an edit is committed. A snapshot is stale if
* its sequence number is not equal to its entry's sequence number.
*/
private long nextSequenceNumber = 0;
/* From java.util.Arrays */
@SuppressWarnings("unchecked")
private static <T> T[] copyOfRange(T[] original, int start, int end) {
final int originalLength = original.length; // For exception priority compatibility.
if (start > end) {
throw new IllegalArgumentException();
}
if (start < 0 || start > originalLength) {
throw new ArrayIndexOutOfBoundsException();
}
final int resultLength = end - start;
final int copyLength = Math.min(resultLength, originalLength - start);
final T[] result = (T[]) Array
.newInstance(original.getClass().getComponentType(), resultLength);
System.arraycopy(original, start, result, 0, copyLength);
return result;
}
/**
* Returns the remainder of 'reader' as a string, closing it when done.
*/
public static String readFully(Reader reader) throws IOException {
try {
StringWriter writer = new StringWriter();
char[] buffer = new char[1024];
int count;
while ((count = reader.read(buffer)) != -1) {
writer.write(buffer, 0, count);
}
return writer.toString();
} finally {
reader.close();
}
}
/**
* Returns the ASCII characters up to but not including the next "\r\n", or
* "\n".
*
* @throws java.io.EOFException if the stream is exhausted before the next newline
* character.
*/
public static String readAsciiLine(InputStream in) throws IOException {
// TODO: support UTF-8 here instead
StringBuilder result = new StringBuilder(80);
while (true) {
int c = in.read();
if (c == -1) {
throw new EOFException();
} else if (c == '\n') {
break;
}
result.append((char) c);
}
int length = result.length();
if (length > 0 && result.charAt(length - 1) == '\r') {
result.setLength(length - 1);
}
return result.toString();
}
/**
* Closes 'closeable', ignoring any checked exceptions. Does nothing if 'closeable' is null.
*/
public static void closeQuietly(Closeable closeable) {
if (closeable != null) {
try {
closeable.close();
} catch (RuntimeException rethrown) {
throw rethrown;
} catch (Exception ignored) {
}
}
}
/**
* Recursively delete everything in {@code dir}.
*/
// TODO: this should specify paths as Strings rather than as Files
public static void deleteContents(File dir) throws IOException {
File[] files = dir.listFiles();
if (files == null) {
throw new IllegalArgumentException("not a directory: " + dir);
}
for (File file : files) {
if (file.isDirectory()) {
deleteContents(file);
}
if (!file.delete()) {
throw new IOException("failed to delete file: " + file);
}
}
}
/** This cache uses a single background thread to evict entries. */
private final ExecutorService executorService = new ThreadPoolExecutor(0, 1,
60L, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
private final Callable<Void> cleanupCallable = new Callable<Void>() {
@Override public Void call() throws Exception {
synchronized (DiskLruCache.this) {
if (journalWriter == null) {
return null; // closed
}
trimToSize();
if (journalRebuildRequired()) {
rebuildJournal();
redundantOpCount = 0;
}
}
return null;
}
};
private DiskLruCache(File directory, int appVersion, int valueCount, long maxSize) {
this.directory = directory;
this.appVersion = appVersion;
this.journalFile = new File(directory, JOURNAL_FILE);
this.journalFileTmp = new File(directory, JOURNAL_FILE_TMP);
this.valueCount = valueCount;
this.maxSize = maxSize;
}
/**
* Opens the cache in {@code directory}, creating a cache if none exists
* there.
*
* @param directory a writable directory
* @param appVersion
* @param valueCount the number of values per cache entry. Must be positive.
* @param maxSize the maximum number of bytes this cache should use to store
* @throws java.io.IOException if reading or writing the cache directory fails
*/
public static DiskLruCache open(File directory, int appVersion, int valueCount, long maxSize)
throws IOException {
if (maxSize <= 0) {
throw new IllegalArgumentException("maxSize <= 0");
}
if (valueCount <= 0) {
throw new IllegalArgumentException("valueCount <= 0");
}
// prefer to pick up where we left off
DiskLruCache cache = new DiskLruCache(directory, appVersion, valueCount, maxSize);
if (cache.journalFile.exists()) {
try {
cache.readJournal();
cache.processJournal();
cache.journalWriter = new BufferedWriter(new FileWriter(cache.journalFile, true),
IO_BUFFER_SIZE);
return cache;
} catch (IOException journalIsCorrupt) {
// System.logW("DiskLruCache " + directory + " is corrupt: "
// + journalIsCorrupt.getMessage() + ", removing");
cache.delete();
}
}
// create a new empty cache
directory.mkdirs();
cache = new DiskLruCache(directory, appVersion, valueCount, maxSize);
cache.rebuildJournal();
return cache;
}
private void readJournal() throws IOException {
InputStream in = new BufferedInputStream(new FileInputStream(journalFile), IO_BUFFER_SIZE);
try {
String magic = readAsciiLine(in);
String version = readAsciiLine(in);
String appVersionString = readAsciiLine(in);
String valueCountString = readAsciiLine(in);
String blank = readAsciiLine(in);
if (!MAGIC.equals(magic)
|| !VERSION_1.equals(version)
|| !Integer.toString(appVersion).equals(appVersionString)
|| !Integer.toString(valueCount).equals(valueCountString)
|| !"".equals(blank)) {
throw new IOException("unexpected journal header: ["
+ magic + ", " + version + ", " + valueCountString + ", " + blank + "]");
}
while (true) {
try {
readJournalLine(readAsciiLine(in));
} catch (EOFException endOfJournal) {
break;
}
}
} finally {
closeQuietly(in);
}
}
private void readJournalLine(String line) throws IOException {
String[] parts = line.split(" ");
if (parts.length < 2) {
throw new IOException("unexpected journal line: " + line);
}
String key = parts[1];
if (parts[0].equals(REMOVE) && parts.length == 2) {
lruEntries.remove(key);
return;
}
Entry entry = lruEntries.get(key);
if (entry == null) {
entry = new Entry(key);
lruEntries.put(key, entry);
}
if (parts[0].equals(CLEAN) && parts.length == 2 + valueCount) {
entry.readable = true;
entry.currentEditor = null;
entry.setLengths(copyOfRange(parts, 2, parts.length));
} else if (parts[0].equals(DIRTY) && parts.length == 2) {
entry.currentEditor = new Editor(entry);
} else if (parts[0].equals(READ) && parts.length == 2) {
// this work was already done by calling lruEntries.get()
} else {
throw new IOException("unexpected journal line: " + line);
}
}
/**
* Computes the initial size and collects garbage as a part of opening the
* cache. Dirty entries are assumed to be inconsistent and will be deleted.
*/
private void processJournal() throws IOException {
deleteIfExists(journalFileTmp);
for (Iterator<Entry> i = lruEntries.values().iterator(); i.hasNext(); ) {
Entry entry = i.next();
if (entry.currentEditor == null) {
for (int t = 0; t < valueCount; t++) {
size += entry.lengths[t];
}
} else {
entry.currentEditor = null;
for (int t = 0; t < valueCount; t++) {
deleteIfExists(entry.getCleanFile(t));
deleteIfExists(entry.getDirtyFile(t));
}
i.remove();
}
}
}
/**
* Creates a new journal that omits redundant information. This replaces the
* current journal if it exists.
*/
private synchronized void rebuildJournal() throws IOException {
if (journalWriter != null) {
journalWriter.close();
}
Writer writer = new BufferedWriter(new FileWriter(journalFileTmp), IO_BUFFER_SIZE);
writer.write(MAGIC);
writer.write("\n");
writer.write(VERSION_1);
writer.write("\n");
writer.write(Integer.toString(appVersion));
writer.write("\n");
writer.write(Integer.toString(valueCount));
writer.write("\n");
writer.write("\n");
for (Entry entry : lruEntries.values()) {
if (entry.currentEditor != null) {
writer.write(DIRTY + ' ' + entry.key + '\n');
} else {
writer.write(CLEAN + ' ' + entry.key + entry.getLengths() + '\n');
}
}
writer.close();
journalFileTmp.renameTo(journalFile);
journalWriter = new BufferedWriter(new FileWriter(journalFile, true), IO_BUFFER_SIZE);
}
private static void deleteIfExists(File file) throws IOException {
// try {
// Libcore.os.remove(file.getPath());
// } catch (ErrnoException errnoException) {
// if (errnoException.errno != OsConstants.ENOENT) {
// throw errnoException.rethrowAsIOException();
// }
// }
if (file.exists() && !file.delete()) {
throw new IOException();
}
}
/**
* Returns a snapshot of the entry named {@code key}, or null if it doesn't
* exist is not currently readable. If a value is returned, it is moved to
* the head of the LRU queue.
*/
public synchronized Snapshot get(String key) throws IOException {
checkNotClosed();
validateKey(key);
Entry entry = lruEntries.get(key);
if (entry == null) {
return null;
}
if (!entry.readable) {
return null;
}
/*
* Open all streams eagerly to guarantee that we see a single published
* snapshot. If we opened streams lazily then the streams could come
* from different edits.
*/
InputStream[] ins = new InputStream[valueCount];
try {
for (int i = 0; i < valueCount; i++) {
ins[i] = new FileInputStream(entry.getCleanFile(i));
}
} catch (FileNotFoundException e) {
// a file must have been deleted manually!
return null;
}
redundantOpCount++;
journalWriter.append(READ + ' ' + key + '\n');
if (journalRebuildRequired()) {
executorService.submit(cleanupCallable);
}
return new Snapshot(key, entry.sequenceNumber, ins);
}
/**
* Returns an editor for the entry named {@code key}, or null if another
* edit is in progress.
*/
public Editor edit(String key) throws IOException {
return edit(key, ANY_SEQUENCE_NUMBER);
}
private synchronized Editor edit(String key, long expectedSequenceNumber) throws IOException {
checkNotClosed();
validateKey(key);
Entry entry = lruEntries.get(key);
if (expectedSequenceNumber != ANY_SEQUENCE_NUMBER
&& (entry == null || entry.sequenceNumber != expectedSequenceNumber)) {
return null; // snapshot is stale
}
if (entry == null) {
entry = new Entry(key);
lruEntries.put(key, entry);
} else if (entry.currentEditor != null) {
return null; // another edit is in progress
}
Editor editor = new Editor(entry);
entry.currentEditor = editor;
// flush the journal before creating files to prevent file leaks
journalWriter.write(DIRTY + ' ' + key + '\n');
journalWriter.flush();
return editor;
}
/**
* Returns the directory where this cache stores its data.
*/
public File getDirectory() {
return directory;
}
/**
* Returns the maximum number of bytes that this cache should use to store
* its data.
*/
public long maxSize() {
return maxSize;
}
/**
* Returns the number of bytes currently being used to store the values in
* this cache. This may be greater than the max size if a background
* deletion is pending.
*/
public synchronized long size() {
return size;
}
private synchronized void completeEdit(Editor editor, boolean success) throws IOException {
Entry entry = editor.entry;
if (entry.currentEditor != editor) {
throw new IllegalStateException();
}
// if this edit is creating the entry for the first time, every index must have a value
if (success && !entry.readable) {
for (int i = 0; i < valueCount; i++) {
if (!entry.getDirtyFile(i).exists()) {
editor.abort();
throw new IllegalStateException("edit didn't create file " + i);
}
}
}
for (int i = 0; i < valueCount; i++) {
File dirty = entry.getDirtyFile(i);
if (success) {
if (dirty.exists()) {
File clean = entry.getCleanFile(i);
dirty.renameTo(clean);
long oldLength = entry.lengths[i];
long newLength = clean.length();
entry.lengths[i] = newLength;
size = size - oldLength + newLength;
}
} else {
deleteIfExists(dirty);
}
}
redundantOpCount++;
entry.currentEditor = null;
if (entry.readable | success) {
entry.readable = true;
journalWriter.write(CLEAN + ' ' + entry.key + entry.getLengths() + '\n');
if (success) {
entry.sequenceNumber = nextSequenceNumber++;
}
} else {
lruEntries.remove(entry.key);
journalWriter.write(REMOVE + ' ' + entry.key + '\n');
}
if (size > maxSize || journalRebuildRequired()) {
executorService.submit(cleanupCallable);
}
}
/**
* We only rebuild the journal when it will halve the size of the journal
* and eliminate at least 2000 ops.
*/
private boolean journalRebuildRequired() {
final int REDUNDANT_OP_COMPACT_THRESHOLD = 2000;
return redundantOpCount >= REDUNDANT_OP_COMPACT_THRESHOLD
&& redundantOpCount >= lruEntries.size();
}
/**
* Drops the entry for {@code key} if it exists and can be removed. Entries
* actively being edited cannot be removed.
*
* @return true if an entry was removed.
*/
public synchronized boolean remove(String key) throws IOException {
checkNotClosed();
validateKey(key);
Entry entry = lruEntries.get(key);
if (entry == null || entry.currentEditor != null) {
return false;
}
for (int i = 0; i < valueCount; i++) {
File file = entry.getCleanFile(i);
if (!file.delete()) {
throw new IOException("failed to delete " + file);
}
size -= entry.lengths[i];
entry.lengths[i] = 0;
}
redundantOpCount++;
journalWriter.append(REMOVE + ' ' + key + '\n');
lruEntries.remove(key);
if (journalRebuildRequired()) {
executorService.submit(cleanupCallable);
}
return true;
}
/**
* Returns true if this cache has been closed.
*/
public boolean isClosed() {
return journalWriter == null;
}
private void checkNotClosed() {
if (journalWriter == null) {
throw new IllegalStateException("cache is closed");
}
}
/**
* Force buffered operations to the filesystem.
*/
public synchronized void flush() throws IOException {
checkNotClosed();
trimToSize();
journalWriter.flush();
}
/**
* Closes this cache. Stored values will remain on the filesystem.
*/
public synchronized void close() throws IOException {
if (journalWriter == null) {
return; // already closed
}
for (Entry entry : new ArrayList<Entry>(lruEntries.values())) {
if (entry.currentEditor != null) {
entry.currentEditor.abort();
}
}
trimToSize();
journalWriter.close();
journalWriter = null;
}
private void trimToSize() throws IOException {
while (size > maxSize) {
// Map.Entry<String, Entry> toEvict = lruEntries.eldest();
final Map.Entry<String, Entry> toEvict = lruEntries.entrySet().iterator().next();
remove(toEvict.getKey());
}
}
/**
* Closes the cache and deletes all of its stored values. This will delete
* all files in the cache directory including files that weren't created by
* the cache.
*/
public void delete() throws IOException {
close();
deleteContents(directory);
}
private void validateKey(String key) {
if (key.contains(" ") || key.contains("\n") || key.contains("\r")) {
throw new IllegalArgumentException(
"keys must not contain spaces or newlines: \"" + key + "\"");
}
}
private static String inputStreamToString(InputStream in) throws IOException {
return readFully(new InputStreamReader(in, UTF_8));
}
/**
* A snapshot of the values for an entry.
*/
public final class Snapshot implements Closeable {
private final String key;
private final long sequenceNumber;
private final InputStream[] ins;
private Snapshot(String key, long sequenceNumber, InputStream[] ins) {
this.key = key;
this.sequenceNumber = sequenceNumber;
this.ins = ins;
}
/**
* Returns an editor for this snapshot's entry, or null if either the
* entry has changed since this snapshot was created or if another edit
* is in progress.
*/
public Editor edit() throws IOException {
return DiskLruCache.this.edit(key, sequenceNumber);
}
/**
* Returns the unbuffered stream with the value for {@code index}.
*/
public InputStream getInputStream(int index) {
return ins[index];
}
/**
* Returns the string value for {@code index}.
*/
public String getString(int index) throws IOException {
return inputStreamToString(getInputStream(index));
}
@Override public void close() {
for (InputStream in : ins) {
closeQuietly(in);
}
}
}
/**
* Edits the values for an entry.
*/
public final class Editor {
private final Entry entry;
private boolean hasErrors;
private Editor(Entry entry) {
this.entry = entry;
}
/**
* Returns an unbuffered input stream to read the last committed value,
* or null if no value has been committed.
*/
public InputStream newInputStream(int index) throws IOException {
synchronized (DiskLruCache.this) {
if (entry.currentEditor != this) {
throw new IllegalStateException();
}
if (!entry.readable) {
return null;
}
return new FileInputStream(entry.getCleanFile(index));
}
}
/**
* Returns the last committed value as a string, or null if no value
* has been committed.
*/
public String getString(int index) throws IOException {
InputStream in = newInputStream(index);
return in != null ? inputStreamToString(in) : null;
}
/**
* Returns a new unbuffered output stream to write the value at
* {@code index}. If the underlying output stream encounters errors
* when writing to the filesystem, this edit will be aborted when
* {@link #commit} is called. The returned output stream does not throw
* IOExceptions.
*/
public OutputStream newOutputStream(int index) throws IOException {
synchronized (DiskLruCache.this) {
if (entry.currentEditor != this) {
throw new IllegalStateException();
}
return new FaultHidingOutputStream(new FileOutputStream(entry.getDirtyFile(index)));
}
}
/**
* Sets the value at {@code index} to {@code value}.
*/
public void set(int index, String value) throws IOException {
Writer writer = null;
try {
writer = new OutputStreamWriter(newOutputStream(index), UTF_8);
writer.write(value);
} finally {
closeQuietly(writer);
}
}
/**
* Commits this edit so it is visible to readers. This releases the
* edit lock so another edit may be started on the same key.
*/
public void commit() throws IOException {
if (hasErrors) {
completeEdit(this, false);
remove(entry.key); // the previous entry is stale
} else {
completeEdit(this, true);
}
}
/**
* Aborts this edit. This releases the edit lock so another edit may be
* started on the same key.
*/
public void abort() throws IOException {
completeEdit(this, false);
}
private class FaultHidingOutputStream extends FilterOutputStream {
private FaultHidingOutputStream(OutputStream out) {
super(out);
}
@Override public void write(int oneByte) {
try {
out.write(oneByte);
} catch (IOException e) {
hasErrors = true;
}
}
@Override public void write(byte[] buffer, int offset, int length) {
try {
out.write(buffer, offset, length);
} catch (IOException e) {
hasErrors = true;
}
}
@Override public void close() {
try {
out.close();
} catch (IOException e) {
hasErrors = true;
}
}
@Override public void flush() {
try {
out.flush();
} catch (IOException e) {
hasErrors = true;
}
}
}
}
private final class Entry {
private final String key;
/** Lengths of this entry's files. */
private final long[] lengths;
/** True if this entry has ever been published */
private boolean readable;
/** The ongoing edit or null if this entry is not being edited. */
private Editor currentEditor;
/** The sequence number of the most recently committed edit to this entry. */
private long sequenceNumber;
private Entry(String key) {
this.key = key;
this.lengths = new long[valueCount];
}
public String getLengths() throws IOException {
StringBuilder result = new StringBuilder();
for (long size : lengths) {
result.append(' ').append(size);
}
return result.toString();
}
/**
* Set lengths using decimal numbers like "10123".
*/
private void setLengths(String[] strings) throws IOException {
if (strings.length != valueCount) {
throw invalidLengths(strings);
}
try {
for (int i = 0; i < strings.length; i++) {
lengths[i] = Long.parseLong(strings[i]);
}
} catch (NumberFormatException e) {
throw invalidLengths(strings);
}
}
private IOException invalidLengths(String[] strings) throws IOException {
throw new IOException("unexpected journal line: " + Arrays.toString(strings));
}
public File getCleanFile(int i) {
return new File(directory, key + "." + i);
}
public File getDirtyFile(int i) {
return new File(directory, key + "." + i + ".tmp");
}
}
}
| [
"chencong1254@163.com"
] | chencong1254@163.com |
ac301db665771d93e79e09694d3f94ebb07a2e56 | fa61b7acb2cab2c740ad8ce03ccc459ac288a07d | /src/Quiz.java | 5dd49d1dd65d66d7475cc734ed5d604964b49bd5 | [] | no_license | fredypuerto/Quiz | 678f9ca0a19cff37a18f906315420bc3d537b754 | 84cf7857e3217b2b34020aaf871f58ea93363266 | refs/heads/master | 2021-01-01T05:48:49.154519 | 2014-05-19T13:14:44 | 2014-05-19T13:14:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,493 | java | import java.util.Scanner;
public class Quiz {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner s =new Scanner(System.in);
System.out.println("Cuestionario");
System.out.println("¿Cuanto años estuvo Honduras sin ir a un mundial?");
int x = s.nextInt();
if (x==28)
System.out.println("Correcto");
else
System.out.println("Incorrecto");
System.out.println("¿A cuantos mundiales a ido Honduras?");
int f = s.nextInt();
if (f==3)
System.out.println("Correcto");
else
System.out.println("Incorrecto");
System.out.println("¿Cuantos años gobierna un presidente en Honduras?");
int b = s.nextInt();
if (b==4)
System.out.println("Correcto");
else
System.out.println("Incorrecto");
System.out.println("¿Cuantos titulos tiene olimpia?");
int w = s.nextInt();
if (w==28)
System.out.println("Correcto");
else
System.out.println("Incorrecto");
System.out.println("¿Cuantos equipos hay en liga nacional?");
int g = s.nextInt();
if (g==10)
System.out.println("Correcto");
else
System.out.println("Incorrecto");
int p1;
if (x==28)
p1=20;
else
p1=0;
int p2;
if (f==3)
p2=20;
else
p2=0;
int p3;
if (b==4)
p3=20;
else
p3=0;
int p4;
if (w==28)
p4=20;
else
p4=0;
int p5;
if (g==10)
p5=20;
else
p5=0;
System.out.println("Su porcentaje de respuestas es: ");
System.out.println(p1+p2+p3+p4+p5+("%"));
}
}
| [
"alumno@localhost.localdomain"
] | alumno@localhost.localdomain |
c2eb8cea2cd861a5532a25aa9545ffc0c3922832 | d61cbe04b46e3480d5f2acf356f8ccdbab28dbc7 | /Java Standard Edition APIs Core/03_Modulo3Genericos/src/com/icaballero/clases02/PackDoble.java | 449b6fbdb9317563cfe8c749dbb60f8fde2de5c8 | [] | no_license | decalion/Formaciones-Platzi-Udemy | d479548c50f3413eba5bad3d01bdd6a33ba75f60 | 3180d5062d847cc466d4a614863a731189137e50 | refs/heads/master | 2022-11-30T18:59:39.796599 | 2021-06-08T20:11:18 | 2021-06-08T20:11:18 | 200,000,005 | 1 | 2 | null | 2022-11-24T09:11:48 | 2019-08-01T07:27:00 | Java | UTF-8 | Java | false | false | 475 | java | package com.icaballero.clases02;
public class PackDoble<T> {
private T item1;
private T item2;
public PackDoble(T item1, T item2) {
super();
this.item1 = item1;
this.item2 = item2;
}
public T getItem1() {
return item1;
}
public void setItem1(T item1) {
this.item1 = item1;
}
public T getItem2() {
return item2;
}
public void setItem2(T item2) {
this.item2 = item2;
}
public boolean iguals() {
return item1.equals(item2);
}
}
| [
"icaballerohernandez@gmail.com"
] | icaballerohernandez@gmail.com |
fa50b8bf315dc0311f57ba07a2388444637f343e | 44e7adc9a1c5c0a1116097ac99c2a51692d4c986 | /aws-java-sdk-route53resolver/src/main/java/com/amazonaws/services/route53resolver/model/transform/DeleteResolverQueryLogConfigRequestMarshaller.java | e80fc92301b8e9c8c0d4d59ea9b8b80ce0bdfbdd | [
"Apache-2.0"
] | permissive | QiAnXinCodeSafe/aws-sdk-java | f93bc97c289984e41527ae5bba97bebd6554ddbe | 8251e0a3d910da4f63f1b102b171a3abf212099e | refs/heads/master | 2023-01-28T14:28:05.239019 | 2020-12-03T22:09:01 | 2020-12-03T22:09:01 | 318,460,751 | 1 | 0 | Apache-2.0 | 2020-12-04T10:06:51 | 2020-12-04T09:05:03 | null | UTF-8 | Java | false | false | 2,212 | java | /*
* Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.route53resolver.model.transform;
import javax.annotation.Generated;
import com.amazonaws.SdkClientException;
import com.amazonaws.services.route53resolver.model.*;
import com.amazonaws.protocol.*;
import com.amazonaws.annotation.SdkInternalApi;
/**
* DeleteResolverQueryLogConfigRequestMarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class DeleteResolverQueryLogConfigRequestMarshaller {
private static final MarshallingInfo<String> RESOLVERQUERYLOGCONFIGID_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("ResolverQueryLogConfigId").build();
private static final DeleteResolverQueryLogConfigRequestMarshaller instance = new DeleteResolverQueryLogConfigRequestMarshaller();
public static DeleteResolverQueryLogConfigRequestMarshaller getInstance() {
return instance;
}
/**
* Marshall the given parameter object.
*/
public void marshall(DeleteResolverQueryLogConfigRequest deleteResolverQueryLogConfigRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteResolverQueryLogConfigRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteResolverQueryLogConfigRequest.getResolverQueryLogConfigId(), RESOLVERQUERYLOGCONFIGID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
}
}
| [
""
] | |
6464e4f61e98968ddb19aa488ac5d60e30c9819f | ed5159d056e98d6715357d0d14a9b3f20b764f89 | /test/irvine/oeis/a210/A210678Test.java | f46203454a169c7a500df636b215914faff7b746 | [] | no_license | flywind2/joeis | c5753169cf562939b04dd246f8a2958e97f74558 | e5efd6971a0062ac99f4fae21a7c78c9f9e74fea | refs/heads/master | 2020-09-13T18:34:35.080552 | 2019-11-19T05:40:55 | 2019-11-19T05:40:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 195 | java | package irvine.oeis.a210;
import irvine.oeis.AbstractSequenceTest;
/**
* Tests the corresponding class.
* @author Sean A. Irvine
*/
public class A210678Test extends AbstractSequenceTest {
}
| [
"sairvin@gmail.com"
] | sairvin@gmail.com |
13b4d9d901c9ef78c0cd1b0302c2288e18f3c1b2 | 08c17ec05b4ed865c2b9be53f19617be7562375d | /aws-java-sdk-sagemaker/src/main/java/com/amazonaws/services/sagemaker/model/transform/DeleteTrialRequestProtocolMarshaller.java | 3ca240cd3874a9a3b7b3d142c195ba8e8f761f36 | [
"Apache-2.0"
] | permissive | shishir2510GitHub1/aws-sdk-java | c43161ac279af9d159edfe96dadb006ff74eefff | 9b656cfd626a6a2bfa5c7662f2c8ff85b7637f60 | refs/heads/master | 2020-11-26T18:13:34.317060 | 2019-12-19T22:41:44 | 2019-12-19T22:41:44 | 229,156,587 | 0 | 1 | Apache-2.0 | 2020-02-12T01:52:47 | 2019-12-19T23:45:32 | null | UTF-8 | Java | false | false | 2,639 | java | /*
* Copyright 2014-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.sagemaker.model.transform;
import javax.annotation.Generated;
import com.amazonaws.SdkClientException;
import com.amazonaws.Request;
import com.amazonaws.http.HttpMethodName;
import com.amazonaws.services.sagemaker.model.*;
import com.amazonaws.transform.Marshaller;
import com.amazonaws.protocol.*;
import com.amazonaws.protocol.Protocol;
import com.amazonaws.annotation.SdkInternalApi;
/**
* DeleteTrialRequest Marshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class DeleteTrialRequestProtocolMarshaller implements Marshaller<Request<DeleteTrialRequest>, DeleteTrialRequest> {
private static final OperationInfo SDK_OPERATION_BINDING = OperationInfo.builder().protocol(Protocol.AWS_JSON).requestUri("/")
.httpMethodName(HttpMethodName.POST).hasExplicitPayloadMember(false).hasPayloadMembers(true).operationIdentifier("SageMaker.DeleteTrial")
.serviceName("AmazonSageMaker").build();
private final com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory;
public DeleteTrialRequestProtocolMarshaller(com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory) {
this.protocolFactory = protocolFactory;
}
public Request<DeleteTrialRequest> marshall(DeleteTrialRequest deleteTrialRequest) {
if (deleteTrialRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
final ProtocolRequestMarshaller<DeleteTrialRequest> protocolMarshaller = protocolFactory.createProtocolMarshaller(SDK_OPERATION_BINDING,
deleteTrialRequest);
protocolMarshaller.startMarshalling();
DeleteTrialRequestMarshaller.getInstance().marshall(deleteTrialRequest, protocolMarshaller);
return protocolMarshaller.finishMarshalling();
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
}
}
| [
""
] | |
4bcab1bf68149262e231fe52d96d7e85dcd2fad4 | 972671a6972ea4a98796771961d76a9f7cbc7e69 | /app/src/main/java/com/yazhi1992/moon/dialog/FinishHopeDialog.java | b89687b0b202e926ac543b853df8f71fb453f169 | [] | no_license | yazhidev/Moon | c00a2079710f35b253e63fe3fe98a8c19f93e077 | 1bf14e0c1e1922d3cb645211ecb3ca161ab54f0a | refs/heads/master | 2022-02-20T23:50:34.633259 | 2018-10-16T05:35:25 | 2018-10-16T05:35:25 | 115,127,767 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,619 | java | package com.yazhi1992.moon.dialog;
import android.app.DialogFragment;
import android.app.FragmentManager;
import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import com.yazhi1992.moon.R;
import com.yazhi1992.moon.api.Api;
import com.yazhi1992.moon.api.DataCallback;
import com.yazhi1992.moon.constant.ActionConstant;
import com.yazhi1992.moon.databinding.DialogFinishHopeBinding;
import com.yazhi1992.moon.event.AddDataEvent;
import com.yazhi1992.yazhilib.utils.LibUtils;
import org.greenrobot.eventbus.EventBus;
/**
* Created by zengyazhi on 2018/1/26.
*/
public class FinishHopeDialog extends DialogFragment {
DialogFinishHopeBinding mBinding;
private String mHopeId;
private OnFinishListener mOnFinishListener;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE);
mBinding = DataBindingUtil.inflate(inflater, R.layout.dialog_finish_hope, null, false);
Window window = getDialog().getWindow();
WindowManager.LayoutParams lp = window.getAttributes();
lp.gravity = Gravity.CENTER;
window.setAttributes(lp);
return mBinding.getRoot();
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mBinding.btnFinish.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String content = mBinding.etInput.getText().toString();
if(content.isEmpty()) {
LibUtils.showToast(view.getContext(), getString(R.string.finish_hope_hint_empty));
return;
}
mBinding.btnFinish.setLoading(true);
Api.getInstance().finishHope(mHopeId, content, new DataCallback<Boolean>() {
@Override
public void onSuccess(Boolean data) {
mBinding.btnFinish.setLoading(false);
//通知刷新
EventBus.getDefault().post(new AddDataEvent(ActionConstant.ADD_HOPE));
if(mOnFinishListener != null) {
mOnFinishListener.onFinish(content);
}
dismiss();
}
@Override
public void onFailed(int code, String msg) {
mBinding.btnFinish.setLoading(false);
}
});
}
});
}
@Override
public void onStart() {
super.onStart();
//设置 dialog 的背景为 null
getDialog().getWindow().setBackgroundDrawable(null);
getDialog().setCanceledOnTouchOutside(false);
}
public interface OnFinishListener {
void onFinish(String content);
}
public void setOnFinishListener(OnFinishListener onFinishListener) {
mOnFinishListener = onFinishListener;
}
public void showDialog(FragmentManager manager, String hopeId) {
mHopeId = hopeId;
manager.executePendingTransactions();
if (!isAdded()) {
show(manager, FinishHopeDialog.class.getName());
}
}
}
| [
"yazhi1992@163.com"
] | yazhi1992@163.com |
d652e0bef43936ebc570e6cb5ae7c7be85e09831 | 9d6089379238e00c0a5fb2949c1a6e7c19b50958 | /bin/ext-content/importcockpit/testsrc/de/hybris/platform/importcockpit/daos/impl/DefaultImportCockpitCronJobLogDaoTest.java | 933d284054127b4fd493fdb038edc420180f0b02 | [] | no_license | ChintalaVenkat/learning_hybris | 55ce582b4796a843511d0ea83f4859afea52bd88 | 6d29f59578512f9fa44a3954dc67d0f0a5216f9b | refs/heads/master | 2021-06-18T17:47:12.173132 | 2021-03-26T11:00:09 | 2021-03-26T11:00:09 | 193,689,090 | 0 | 0 | null | 2019-06-25T10:46:40 | 2019-06-25T10:46:39 | null | UTF-8 | Java | false | false | 1,908 | java | /*
* [y] hybris Platform
*
* Copyright (c) 2000-2013 hybris AG
* All rights reserved.
*
* This software is the confidential and proprietary information of hybris
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with hybris.
*
*
*/
package de.hybris.platform.importcockpit.daos.impl;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import de.hybris.bootstrap.annotations.UnitTest;
import de.hybris.platform.importcockpit.model.ImportCockpitCronJobModel;
import de.hybris.platform.servicelayer.search.FlexibleSearchQuery;
import de.hybris.platform.servicelayer.search.FlexibleSearchService;
import de.hybris.platform.servicelayer.search.SearchResult;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Matchers;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
@UnitTest
public class DefaultImportCockpitCronJobLogDaoTest
{
private DefaultImportCockpitCronJobLogDao icDao;
@Mock
private ImportCockpitCronJobModel job;
@Mock
private FlexibleSearchService flexibleSearchService;
@Mock
private SearchResult searchResult;
@Before
public void setUp()
{
MockitoAnnotations.initMocks(this);
icDao = new DefaultImportCockpitCronJobLogDao();
icDao.setFlexibleSearchService(flexibleSearchService);
}
@Test
public void testFindRecentLogsByCronJob()
{
when(flexibleSearchService.search(Matchers.<FlexibleSearchQuery> any())).thenReturn(searchResult);
when(searchResult.getResult()).thenReturn(null);
when(job.getStartTime()).thenReturn(null);
when(job.getCreationtime()).thenReturn(null);
icDao.findRecentLogsByCronJob(job);
verify(flexibleSearchService).search(Matchers.<FlexibleSearchQuery> any());
verify(job).getCreationtime();
verify(job).getStartTime();
}
}
| [
"a.basov@aimprosoft.com"
] | a.basov@aimprosoft.com |
11baa98de330b101a27860b7ae16815cb79dee62 | 78f284cd59ae5795f0717173f50e0ebe96228e96 | /factura-negocio/src/cl/stotomas/factura/negocio/formulario_30/copy/copy/copy/TestingTry.java | e06ea2ec95dd80fa6a88833b815f2b933cbaad01 | [] | no_license | Pattricio/Factura | ebb394e525dfebc97ee2225ffc5fca10962ff477 | eae66593ac653f85d05071b6ccb97fb1e058502d | refs/heads/master | 2020-03-16T03:08:45.822070 | 2018-05-07T15:29:25 | 2018-05-07T15:29:25 | 132,481,305 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 1,271 | java | package cl.stotomas.factura.negocio.formulario_30.copy.copy.copy;
import java.applet.Applet;
public class TestingTry {
// Inclusión de funcionalidades de esfera de control que no es de confianza
// Un atacante puede insertar funcionalidades maliciosas dentro de este programa.
// Las Applet comprometen la seguridad. ya que sus funcionalidades se pueden adaptar a la Web
// Ademas la entrega de acceso de credenciales es engorrosa para el cliente.
public final class TestApplet extends Applet {
private static final long serialVersionUID = 1L;
}
//Comparación de referencias de objeto en lugar de contenido de objeto
// El if dentro de este código no se ejecutará.
// porque se prioriza el String a mostrar.
public final class compareStrings{
public String str1;
public String str2;
public void comparar()
{
if (str1 == str2)
{
System.out.println("str1 == str2");
}
}
// RECOMENDACIÓN VERACODE
// Utilizar equals para realizar la comparación.
// public void comprar()
// {
// if (str1.equals (str2))
// {
// System.out.println ("str1 es igual a str2");
// }
// }
}
}
| [
"Adriana Molano@DESKTOP-GQ96FK8"
] | Adriana Molano@DESKTOP-GQ96FK8 |
ab98bba450ffd3b85f52eb1a8442b53c137e1cf4 | ba2c3cf58b1a195df9a7cc17d485f78c47f24576 | /casa-do-codigo/src/main/java/br/com/casadocodigo/casadocodigo/autor/domain/AutorRepository.java | 632173fbd474c8b963982340d7e2c43069b7a7ba | [
"Apache-2.0"
] | permissive | AlvesF5/orange-talents-05-template-casa-do-codigo | 944dbb61275695ef1ccd9c615f14f93292a7d721 | 938b10d97e2b3a59e5b1b5c0de3538660b9cff5a | refs/heads/main | 2023-04-25T22:34:15.249795 | 2021-05-25T00:32:13 | 2021-05-25T00:32:13 | 368,166,865 | 0 | 0 | Apache-2.0 | 2021-05-17T11:51:18 | 2021-05-17T11:51:18 | null | UTF-8 | Java | false | false | 262 | java | package br.com.casadocodigo.casadocodigo.autor.domain;
import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
public interface AutorRepository extends JpaRepository<Autor, Long>{
Optional<Autor> findByEmail(String email);
}
| [
"matheus.cruz_@hotmail.com"
] | matheus.cruz_@hotmail.com |
8c6faf5efba66015fe00775e05bbec764377b0df | 0aff735c9a49ccf9c004ea07e94cd60f911c8338 | /net/minecraft/network/play/server/S2DPacketOpenWindow.java | 7920d299162950b556e6711de9818248fcad9394 | [] | no_license | a3535ed54a5ee6917a46cfa6c3f12679/a775b0d7_phenix_mc_InDev | 00be6df18da5ce388ba49d8c275ef664453e7bd8 | 9581b9fcf37b967a438ea7cfe1c58720268fd134 | refs/heads/master | 2021-09-06T10:02:23.512201 | 2018-02-05T08:50:24 | 2018-02-05T08:50:24 | 120,032,615 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,209 | java | package net.minecraft.network.play.server;
import java.io.IOException;
import net.minecraft.network.INetHandler;
import net.minecraft.network.Packet;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.INetHandlerPlayClient;
public class S2DPacketOpenWindow extends Packet
{
private int field_148909_a;
private int field_148907_b;
private String field_148908_c;
private int field_148905_d;
private boolean field_148906_e;
private int field_148904_f;
private static final String __OBFID = "CL_00001293";
public S2DPacketOpenWindow() {}
public S2DPacketOpenWindow(int p_i45184_1_, int p_i45184_2_, String p_i45184_3_, int p_i45184_4_, boolean p_i45184_5_)
{
this.field_148909_a = p_i45184_1_;
this.field_148907_b = p_i45184_2_;
this.field_148908_c = p_i45184_3_;
this.field_148905_d = p_i45184_4_;
this.field_148906_e = p_i45184_5_;
}
public S2DPacketOpenWindow(int p_i45185_1_, int p_i45185_2_, String p_i45185_3_, int p_i45185_4_, boolean p_i45185_5_, int p_i45185_6_)
{
this(p_i45185_1_, p_i45185_2_, p_i45185_3_, p_i45185_4_, p_i45185_5_);
this.field_148904_f = p_i45185_6_;
}
public void processPacket(INetHandlerPlayClient p_148903_1_)
{
p_148903_1_.handleOpenWindow(this);
}
/**
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer p_148837_1_) throws IOException
{
this.field_148909_a = p_148837_1_.readUnsignedByte();
this.field_148907_b = p_148837_1_.readUnsignedByte();
this.field_148908_c = p_148837_1_.readStringFromBuffer(32);
this.field_148905_d = p_148837_1_.readUnsignedByte();
this.field_148906_e = p_148837_1_.readBoolean();
if (this.field_148907_b == 11)
{
this.field_148904_f = p_148837_1_.readInt();
}
}
/**
* Writes the raw packet data to the data stream.
*/
public void writePacketData(PacketBuffer p_148840_1_) throws IOException
{
p_148840_1_.writeByte(this.field_148909_a);
p_148840_1_.writeByte(this.field_148907_b);
p_148840_1_.writeStringToBuffer(this.field_148908_c);
p_148840_1_.writeByte(this.field_148905_d);
p_148840_1_.writeBoolean(this.field_148906_e);
if (this.field_148907_b == 11)
{
p_148840_1_.writeInt(this.field_148904_f);
}
}
public int func_148901_c()
{
return this.field_148909_a;
}
public int func_148899_d()
{
return this.field_148907_b;
}
public String func_148902_e()
{
return this.field_148908_c;
}
public int func_148898_f()
{
return this.field_148905_d;
}
public boolean func_148900_g()
{
return this.field_148906_e;
}
public int func_148897_h()
{
return this.field_148904_f;
}
public void processPacket(INetHandler p_148833_1_)
{
this.processPacket((INetHandlerPlayClient)p_148833_1_);
}
}
| [
"unknowlk@tuta.io"
] | unknowlk@tuta.io |
7febd55501a42a647826349009b1a3b8029d63c5 | 129f48a42d3d056d77964eacecf8d18611f201f8 | /12_Collections_Generics/src/solution/zoo/ZooProgram.java | ea59e9c081271d9a597aa004a059849611c04b7f | [] | no_license | njbhorn/AEITJVFTBL3_83 | af497bcee1f4a3790c876bc44805e1e5e17cb6b1 | 93c8b560623ddb32585e40834b6e1f943e9729cc | refs/heads/master | 2020-04-22T17:21:21.034284 | 2019-07-12T07:03:36 | 2019-07-12T07:03:36 | 170,538,470 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,029 | java | package solution.zoo;
import java.util.*;
public class ZooProgram {
private static HashMap<String, Integer> animalMap = null;
private static String[] originalAnimals
= { "Zebra", "Lion", "Buffalo" };
private static String[] newAnimals
= { "Zebra", "Gazelle", "Buffalo", "Zebra" };
public static void main(String[] args) {
animalMap = new HashMap<>();
addAnimals(originalAnimals);
System.out.println("Original Animal Inventory");
System.out.println("-------------------------");
displayAnimalData();
addAnimals(newAnimals);
System.out.println("Final Animal Inventory");
System.out.println("----------------------");
displayAnimalData();
displaySortedListOfTypes();
}
private static void addAnimals(String[] animals) {
// iterate over the array passing each in turn
for (String type : animals) {
addNewOrReplaceExisting(type);
}
}
private static void addNewOrReplaceExisting(String type) {
// have we already processed an animal of this type?
if (animalMap.containsKey(type)) {
// increment value and put back
animalMap.put(type, animalMap.get(type) + 1);
}
// new sort of animal
else {
animalMap.put(type, 1);
}
}
private static void displayAnimalData() {
System.out.println("Type\t\tCount");
System.out.println("----\t\t-----");
// get the keySet of the map and iterate over it
// printing the type and the associated value
for (String type : animalMap.keySet()) {
System.out.printf("%s\t\t%d\n", type, animalMap.get(type));
}
System.out.println();
}
private static void displaySortedListOfTypes() {
// declare and create list using correct constructor
ArrayList<String> typesOnly
= new ArrayList<String>(animalMap.keySet());
// sort the collection
Collections.sort(typesOnly);
System.out.println("\nAnimals sorted by type");
System.out.println("----------------------");
// print them out
for (String type : typesOnly) {
System.out.println(type);
}
System.out.println();
}
}
| [
"njbhorn@hotmail.com"
] | njbhorn@hotmail.com |
a90b3140cb8ebfdabff84f94484c05a819022875 | 88d064e642e57f10dabb17c0c13627e91f2eea87 | /src/test/java/uk/gov/hmcts/payment/TestContextConfiguration.java | 0a3edeef4480aefa810bad5074ddb25730708d6d | [] | no_license | hmcts/ccpay-payment-app-acceptance-tests | e902c84ae45afdf407f302cde5e691b0c18e497f | bbedd673bff56ff9ba5ad2e4c4682f0de2902eb5 | refs/heads/master | 2023-02-26T13:34:57.864265 | 2018-05-10T09:15:13 | 2018-05-10T09:15:13 | 113,471,040 | 0 | 1 | null | 2021-02-04T05:20:27 | 2017-12-07T16:01:08 | Java | UTF-8 | Java | false | false | 390 | java | package uk.gov.hmcts.payment;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
@Configuration
@ComponentScan("uk.gov.hmcts.payment")
@PropertySource("classpath:application-${spring.profiles.active}.properties")
public class TestContextConfiguration {
}
| [
"kazys.sketrys@triad.co.uk"
] | kazys.sketrys@triad.co.uk |
25751ac6e9cdd8e1427fba3fec9e408c8e94e9bd | 2448d6c8338ea5328aa44da6ca27cb54d37a2196 | /broadleaf-framework/src/main/java/org/broadleafcommerce/core/order/service/manipulation/DiscreteOrderItemDecorator.java | 6eecd3b307de27b4a4904580ef37b3a7b5e353f6 | [] | no_license | RDeztroyer/StartUP-master | 8077240074816a3535eac309a009d9d0d5e36df6 | 5262bbd0a5225529a38e5a68eb651177b029050c | refs/heads/master | 2023-03-05T20:08:52.418953 | 2013-07-06T17:44:38 | 2013-07-06T17:44:38 | 338,304,002 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 10,049 | java | /*
* Copyright 2008-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.broadleafcommerce.core.order.service.manipulation;
import org.broadleafcommerce.common.money.Money;
import org.broadleafcommerce.core.catalog.domain.Category;
import org.broadleafcommerce.core.catalog.domain.Product;
import org.broadleafcommerce.core.catalog.domain.Sku;
import org.broadleafcommerce.core.catalog.domain.SkuBundleItem;
import org.broadleafcommerce.core.offer.domain.CandidateItemOffer;
import org.broadleafcommerce.core.offer.domain.OrderItemAdjustment;
import org.broadleafcommerce.core.order.domain.BundleOrderItem;
import org.broadleafcommerce.core.order.domain.DiscreteOrderItem;
import org.broadleafcommerce.core.order.domain.DiscreteOrderItemFeePrice;
import org.broadleafcommerce.core.order.domain.GiftWrapOrderItem;
import org.broadleafcommerce.core.order.domain.Order;
import org.broadleafcommerce.core.order.domain.OrderItem;
import org.broadleafcommerce.core.order.domain.OrderItemAttribute;
import org.broadleafcommerce.core.order.domain.PersonalMessage;
import org.broadleafcommerce.core.order.service.type.OrderItemType;
import org.broadleafcommerce.core.pricing.service.exception.PricingException;
import java.util.List;
import java.util.Map;
public class DiscreteOrderItemDecorator implements DiscreteOrderItem {
private static final long serialVersionUID = 1L;
private int quantity;
private DiscreteOrderItem discreteOrderItem;
public DiscreteOrderItemDecorator(DiscreteOrderItem discreteOrderItem, int quantity) {
this.discreteOrderItem = discreteOrderItem;
this.quantity = quantity;
}
public Sku getSku() {
return discreteOrderItem.getSku();
}
public void setSku(Sku sku) {
discreteOrderItem.setSku(sku);
}
public Product getProduct() {
return discreteOrderItem.getProduct();
}
public void setProduct(Product product) {
discreteOrderItem.setProduct(product);
}
public BundleOrderItem getBundleOrderItem() {
return discreteOrderItem.getBundleOrderItem();
}
public void setBundleOrderItem(BundleOrderItem bundleOrderItem) {
discreteOrderItem.setBundleOrderItem(bundleOrderItem);
}
/**
* If this item is part of a bundle that was created via a ProductBundle, then this
* method returns a reference to the corresponding SkuBundleItem.
* <p/>
* For manually created
* <p/>
* For all others, this method returns null.
*
* @return
*/
@Override
public SkuBundleItem getSkuBundleItem() {
return discreteOrderItem.getSkuBundleItem();
}
/**
* Sets the associated skuBundleItem.
*
* @param skuBundleItem
*/
@Override
public void setSkuBundleItem(SkuBundleItem skuBundleItem) {
discreteOrderItem.setSkuBundleItem(skuBundleItem);
}
public Money getTaxablePrice() {
return discreteOrderItem.getTaxablePrice();
}
public Map<String, String> getAdditionalAttributes() {
return discreteOrderItem.getAdditionalAttributes();
}
public void setAdditionalAttributes(Map<String, String> additionalAttributes) {
discreteOrderItem.setAdditionalAttributes(additionalAttributes);
}
public Money getBaseRetailPrice() {
return discreteOrderItem.getBaseRetailPrice();
}
public void setBaseRetailPrice(Money baseRetailPrice) {
discreteOrderItem.setBaseRetailPrice(baseRetailPrice);
}
public Long getId() {
return discreteOrderItem.getId();
}
public void setId(Long id) {
discreteOrderItem.setId(id);
}
public Money getBaseSalePrice() {
return discreteOrderItem.getBaseSalePrice();
}
public Order getOrder() {
return discreteOrderItem.getOrder();
}
public void setBaseSalePrice(Money baseSalePrice) {
discreteOrderItem.setBaseSalePrice(baseSalePrice);
}
public void setOrder(Order order) {
discreteOrderItem.setOrder(order);
}
public Money getRetailPrice() {
return discreteOrderItem.getRetailPrice();
}
public List<DiscreteOrderItemFeePrice> getDiscreteOrderItemFeePrices() {
return discreteOrderItem.getDiscreteOrderItemFeePrices();
}
public void setRetailPrice(Money retailPrice) {
discreteOrderItem.setRetailPrice(retailPrice);
}
public Money getSalePrice() {
return discreteOrderItem.getSalePrice();
}
public void setDiscreteOrderItemFeePrices(
List<DiscreteOrderItemFeePrice> orderItemFeePrices) {
discreteOrderItem.setDiscreteOrderItemFeePrices(orderItemFeePrices);
}
public void setSalePrice(Money salePrice) {
discreteOrderItem.setSalePrice(salePrice);
}
public Money getAdjustmentValue() {
return discreteOrderItem.getAdjustmentValue();
}
public Money getPrice() {
return discreteOrderItem.getPrice();
}
public void setPrice(Money price) {
discreteOrderItem.setPrice(price);
}
public void assignFinalPrice() {
discreteOrderItem.assignFinalPrice();
}
public Money getCurrentPrice() {
return discreteOrderItem.getCurrentPrice();
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
//do nothing
}
public Category getCategory() {
return discreteOrderItem.getCategory();
}
public void setCategory(Category category) {
discreteOrderItem.setCategory(category);
}
public List<CandidateItemOffer> getCandidateItemOffers() {
return discreteOrderItem.getCandidateItemOffers();
}
public void setCandidateItemOffers(
List<CandidateItemOffer> candidateItemOffers) {
discreteOrderItem.setCandidateItemOffers(candidateItemOffers);
}
public List<OrderItemAdjustment> getOrderItemAdjustments() {
return discreteOrderItem.getOrderItemAdjustments();
}
public PersonalMessage getPersonalMessage() {
return discreteOrderItem.getPersonalMessage();
}
public void setPersonalMessage(PersonalMessage personalMessage) {
discreteOrderItem.setPersonalMessage(personalMessage);
}
public boolean isInCategory(String categoryName) {
return discreteOrderItem.isInCategory(categoryName);
}
public GiftWrapOrderItem getGiftWrapOrderItem() {
return discreteOrderItem.getGiftWrapOrderItem();
}
public void setGiftWrapOrderItem(GiftWrapOrderItem giftWrapOrderItem) {
discreteOrderItem.setGiftWrapOrderItem(giftWrapOrderItem);
}
public OrderItemType getOrderItemType() {
return discreteOrderItem.getOrderItemType();
}
public void setOrderItemType(OrderItemType orderItemType) {
discreteOrderItem.setOrderItemType(orderItemType);
}
public boolean getIsOnSale() {
return discreteOrderItem.getIsOnSale();
}
public boolean getIsDiscounted() {
return discreteOrderItem.getIsDiscounted();
}
public boolean updatePrices() {
return discreteOrderItem.updatePrices();
}
public String getName() {
return discreteOrderItem.getName();
}
public void setName(String name) {
discreteOrderItem.setName(name);
}
public Money getPriceBeforeAdjustments(boolean allowSalesPrice) {
return discreteOrderItem.getPriceBeforeAdjustments(allowSalesPrice);
}
public OrderItem clone() {
return discreteOrderItem.clone();
}
public void setOrderItemAdjustments(List<OrderItemAdjustment> orderItemAdjustments) {
discreteOrderItem.setOrderItemAdjustments(orderItemAdjustments);
}
public void addCandidateItemOffer(CandidateItemOffer candidateItemOffer) {
discreteOrderItem.addCandidateItemOffer(candidateItemOffer);
}
public void removeAllCandidateItemOffers() {
discreteOrderItem.removeAllCandidateItemOffers();
}
public int removeAllAdjustments() {
return discreteOrderItem.removeAllAdjustments();
}
public void accept(OrderItemVisitor visitor) throws PricingException {
discreteOrderItem.accept(visitor);
}
/**
* A list of arbitrary attributes added to this item.
*/
@Override
public Map<String, OrderItemAttribute> getOrderItemAttributes() {
return discreteOrderItem.getOrderItemAttributes();
}
/**
* Sets the map of order item attributes.
*
* @param orderItemAttributes
*/
@Override
public void setOrderItemAttributes(Map<String, OrderItemAttribute> orderItemAttributes) {
discreteOrderItem.setOrderItemAttributes(orderItemAttributes);
}
@Override
public Boolean isTaxable() {
return discreteOrderItem.isTaxable();
}
@Override
public void setTaxable(Boolean taxable) {
discreteOrderItem.setTaxable(taxable);
}
/**
* If the system automatically split an item to accommodate the promotion logic (e.g. buy one get one free),
* then this value is set to the originalItemId.
* <p/>
* Returns null otherwise.
*
* @return
*/
@Override
public Long getSplitParentItemId() {
return discreteOrderItem.getSplitParentItemId();
}
@Override
public void setSplitParentItemId(Long id) {
discreteOrderItem.setSplitParentItemId(id);
}
}
| [
"bharath.abcom@gmail.com"
] | bharath.abcom@gmail.com |
f36a7da55c167ab700b377a844552caa4e65210c | fb3f91fb6c18bb93c5d51b58d13e201203833994 | /Desarrollo/AcmeParent/AcmeHibernateDomain/src/main/java/pe/com/acme/hibernate/service/ComprobanteItemRepository.java | 1948415b778d768f85f8b91978ebad4dc1234877 | [] | no_license | cgb-extjs-gwt/avgust-extjs-generator | d24241e594078eb8af8e33e99be64e56113a1c0c | 30677d1fef4da73e2c72b6c6dfca85d492e1a385 | refs/heads/master | 2023-07-20T04:39:13.928605 | 2018-01-16T18:17:23 | 2018-01-16T18:17:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 378 | java | package pe.com.acme.hibernate.service;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;
import pe.com.acme.hibernate.domain.ComprobanteItem;
/**
* Created by JRaffo on 23/03/17.
*/
@Repository
public interface ComprobanteItemRepository extends PagingAndSortingRepository<ComprobanteItem, Integer> {
}
| [
"raffo8924@gmail.com"
] | raffo8924@gmail.com |
9f963c06a162e6b12db7cb5097a8bb08972d338d | 95691bc01c4f483877dc6c86dea6a79e38b8532b | /StackUsingQueues.java | e2d231e0e6d707bf8d18994b5f14bb5b0a399216 | [] | no_license | Nehabisht773/DataStructuresAndAlgorithms | 2564d292b2461adac3a656bf4bc72873764740e0 | 3db22091200058ea824f68f8d7b75fecfbc10e1f | refs/heads/master | 2022-11-20T06:28:46.582654 | 2020-06-10T18:00:45 | 2020-06-10T18:00:45 | 271,347,484 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 67 | java | package com.Oracle;
public class StackUsingQueues {
}
| [
"noreply@github.com"
] | Nehabisht773.noreply@github.com |
6eb8b6d5937108427bbc31136b708b5a2c7801c6 | 952eaa1d71e0ee60a00697cf87704dfb2c95e3df | /CrimeRecordList.java | bd2b087c7cab658d77b5f3c73a40d4e8e7f88414 | [] | no_license | lindatxia/Crime-Record | 8e0c6a8bb03359e4f23c14afd108eb836d23b892 | fbb225a9fe106842de420f81601f532cb43d87d9 | refs/heads/master | 2020-06-20T12:07:04.916268 | 2016-11-27T04:49:27 | 2016-11-27T04:49:27 | 74,866,914 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,357 | java | package bstproject;
import java.io.*;
public class CrimeRecordList extends java.lang.Object {
// LINKED LIST IMPLEMENTATION
private int size; // Size of the array
private CrimeRecordListNode head;
private CrimeRecordListNode ptr; // This is the pointer
private CrimeRecordListNode ptrLast; // Points to the first element
CrimeRecordList kmlAnswer;
java.lang.String finalKML;
String kmlFirst = "<?xml version= \"1.0\" encoding=\"UTF-8\" ?><kml xmlns=\"http://earth.google.com/kml/2.2\"><Document><Style id=\"style1\"><IconStyle><Icon><href>http://maps.gstatic.com/intl/en_ALL/mapfiles/ms/micons/blue-dot.png</href></Icon></IconStyle></Style>";
String kmlLast = "</Document></kml>";
public CrimeRecordList()
{
size = 0;
head = null;
}
public int getSize()
{
return size;
}
// Add a crime record to the end of the list.
public void add(CrimeRecord cr)
{
if (head == null) // This is the first item
{
head = new CrimeRecordListNode(cr,null);
ptrLast = head;
size++;
start();
}
else
{
CrimeRecordListNode oldHead = head; // Save the reference first!
head = new CrimeRecordListNode(cr,null);
head.nextField = oldHead;
start(); // Set ptr to latest node added
size++;
}
}
// Sets the internal pointer to the top of the list.
public void start()
{
ptr = head;
}
// Return true if the internal pointer is not null.
public boolean hasNext()
{
if (ptr!=null)
{
return true;
}
return false;
}
// When next is called, the CrimeRecord pointed to by ptr (the most recent node) is returned;
// ptr is set to point to the next item on the list.
public CrimeRecord next()
{
if (ptr!=null) // Ptr is NOT null :)
{
CrimeRecord saveThis = ptr.dataField;
ptr = ptr.nextField; // Set reference to next linked node on list
return (saveThis);
}
return null; // return null if this reaches the end of the list
}
// My own method I wrote, returns the data field on the very top of the list
public CrimeRecord getHead()
{
start();
if (ptr != null)
{
return ptr.dataField;
}
return null;
}
// Returns a KML representation of this list of crime records for a single NODE.
public java.lang.String toKml()
{
String kmlMiddle = "";
CrimeRecord current;
kmlAnswer = BSTTreeDriver.updateKML();
while (true)
{
current = kmlAnswer.next();
if (current == null) break;
kmlMiddle = kmlMiddle + "<Placemark><name>" + current.newOffense + "</name><description>" + current.newStreet + "</description><styleUrl>#style1</styleUrl><Point><coordinates>" + current.newLon + "," + current.newLat + ",0.000000</coordinates></Point></Placemark>";
}
finalKML = "";
finalKML = kmlFirst + kmlMiddle + kmlLast;
return finalKML;
}
// Uses the PrintWriter package from java.io to read in the KML string and write it to the KML file.
public void toGoogleEarth(java.lang.String pathToFile) throws java.io.IOException
{
PrintWriter out = new PrintWriter(pathToFile);
out.println(finalKML);
out.close();
}
public CrimeRecordList concat(CrimeRecordList a, CrimeRecordList b)
{
CrimeRecordList newList = new CrimeRecordList(); // Create new object
newList = a; // Copy a so you don't lose original list
newList.ptr.nextField = b.ptrLast;
size++;
return newList;
}
}
| [
"lindatxia@gmail.com"
] | lindatxia@gmail.com |
099722d2efa0e36466edff182fd97b68e8e59bc8 | e609e4323359b5aa5a6ec01b39e16bcf2779782b | /app/src/main/java/com/pericappstudio/drawit/ViewPictureInfo.java | 32893c6ecf22efb35581fde56bcdbff5d379ab34 | [
"Apache-2.0"
] | permissive | fruitbraker/Draw-It-v1 | 78951e7cf36198d4e53834337ab6c850fef85ca7 | c1c416632485306f43d93a7dc5d63a9c1d83fb37 | refs/heads/master | 2021-01-10T11:06:32.947013 | 2016-03-05T01:51:53 | 2016-03-05T01:51:53 | 52,729,127 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,886 | java | package com.pericappstudio.drawit;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;
import android.widget.TextView;
import com.android.volley.Response;
import com.cloudmine.api.CMApiCredentials;
import com.cloudmine.api.db.LocallySavableCMObject;
import com.cloudmine.api.rest.response.CMObjectResponse;
import java.util.ArrayList;
/**
* Created by Eric P on 5/27/2015.
*/
public class ViewPictureInfo extends Activity {
public static final String APP_ID = "c048ef46cab04bb4b82e97fb480cba1b";
public static final String API_KEY = "6308fff67fe0477ba94a3a3deccb4987";
private TextView tvCurrentTurn, tvCurrentRound, tvTotalRound, tvTotalTurn, tvPictureName;
private ListView playerUsernamesListView;
private ArrayList<String> playerUsernames;
private String userLoggedID, pictureID, userUsername;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.picture_info_main);
CMApiCredentials.initialize(APP_ID, API_KEY, getApplicationContext());
userLoggedID = getIntent().getExtras().getString("UserID");
pictureID = getIntent().getExtras().getString("PictureID");
userUsername = getIntent().getExtras().getString("UserUsername");
playerUsernames = getIntent().getExtras().getStringArrayList("PlayerUsername");
playerUsernames.add(userUsername);
tvCurrentTurn = (TextView) findViewById(R.id.textViewPictureCurrentTurnInfo);
tvCurrentRound = (TextView) findViewById(R.id.textViewPictureCurrentRoundInfo);
tvTotalRound = (TextView) findViewById(R.id.textViewPictureTotalRoundInfo);
tvTotalTurn = (TextView) findViewById(R.id.textViewPictureTotalTurnsINfo);
tvPictureName = (TextView) findViewById(R.id.textViewPictureNameInfo);
playerUsernamesListView = (ListView) findViewById(R.id.listView);
populateActivity();
}
private void populateActivity() {
LocallySavableCMObject.loadObject(this, pictureID, new Response.Listener<CMObjectResponse>() {
@Override
public void onResponse(CMObjectResponse response) {
TheDrawing picture = (TheDrawing) response.getCMObject(pictureID);
tvCurrentTurn.setText("" + picture.getCurrentTurn());
tvCurrentRound.setText("" + picture.getCurrentRound());
tvTotalRound.setText("" + picture.getTotalRounds());
tvTotalTurn.setText("" + picture.getTotalTurns());
tvPictureName.setText(picture.getPictureName());
PictureInfoAdapter pictureInfoAdapter = new PictureInfoAdapter(getApplicationContext(), playerUsernames);
playerUsernamesListView.setAdapter(pictureInfoAdapter);
}
});
}
public void goBackDashboard(View view) {
Intent intent = new Intent("android.intent.action.DASHBOARD");
Bundle userID = new Bundle();
userID.putString("UserID", userLoggedID);
intent.putExtras(userID);
Bundle userUsername = new Bundle();
userUsername.putString("UserUsername", this.userUsername);
intent.putExtras(userUsername);
startActivity(intent);
}
public void seePicture(View view) {
Intent intent = new Intent(getApplicationContext(), ImageViewComplete.class);
Bundle pictureIDBundle = new Bundle();
pictureIDBundle.putString("PictureID", pictureID);
intent.putExtras(pictureIDBundle);
Bundle userID = new Bundle();
userID.putString("UserID", userLoggedID);
intent.putExtras(userID);
startActivity(intent);
}
@Override
protected void onPause() {
super.onPause();
finish();
}
}
| [
"pericappstudio@gmail.com"
] | pericappstudio@gmail.com |
f0798f7b7ad09b66bc9fb9e13095e57830fca306 | d78a3e985aacc16d332e1d6113b1a62af95a8252 | /src/main/java/com/example/usersapi/models/UserModel.java | 626dbee14f4618215ca570d12bbe2da9b5a1bd84 | [] | no_license | Faq-ndo/UsersApi | 721e87d201712cab1ab17a0234d2e5d0a3579408 | 099b864685d16c03cfdcf83b78799e4ee0e91db2 | refs/heads/master | 2023-07-08T20:35:20.784932 | 2021-08-11T10:46:38 | 2021-08-11T10:46:38 | 394,954,367 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 708 | java | package com.example.usersapi.models;
import javax.persistence.*;
import java.util.Date;
@Entity
@Table(name = "users")
public class UserModel {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(unique = true, nullable = false)
Long id;
String name;
Date birthDate;
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 Date getBirthDate() {
return birthDate;
}
public void setBirthDate(Date birthDate) {
this.birthDate = birthDate;
}
}
| [
"facundo@padelmanager.com"
] | facundo@padelmanager.com |
15a9ce63db09f953b2db7d24cacfefb40b269165 | 8ec2cbabd6125ceeb00e0c6192c3ce84477bdde6 | /com.alcatel.as.sipservlet10/javax/servlet/sip/annotation/SipSessionAttributeListener.java | 7367fd365f9e37ca747aa03f1fc440e4312c1787 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | nokia/osgi-microfeatures | 2cc2b007454ec82212237e012290425114eb55e6 | 50120f20cf929a966364550ca5829ef348d82670 | refs/heads/main | 2023-08-28T12:13:52.381483 | 2021-11-12T20:51:05 | 2021-11-12T20:51:05 | 378,852,173 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 521 | java | // Copyright 2000-2021 Nokia
//
// Licensed under the Apache License 2.0
// SPDX-License-Identifier: Apache-2.0
//
package javax.servlet.sip.annotation;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import java.lang.annotation.ElementType;
@Target({ElementType.TYPE})
@Retention(RUNTIME)
@Inherited
public @interface SipSessionAttributeListener {
String applicationName() default "";
} | [
"pierre.de_rop@nokia.com"
] | pierre.de_rop@nokia.com |
3067b3e9abbf71a83e2a6f89a24410a70a5bf29a | 8840e0e0576f3c7509d2379482eabe804ee51bb9 | /src/main/java/com/tontron/security/auth/dto/Result.java | f74b69f13f13fda6f6a2ec7f79e8d8ae44e7825e | [] | no_license | wangxulong/auth-security | c9dbb88d75a144192a2b29bda12d092c627cb912 | 4acdafce308f6bfc8582613bc87c158010e1ff00 | refs/heads/master | 2020-04-26T14:03:53.039075 | 2019-03-04T15:48:34 | 2019-03-04T15:48:34 | 173,599,935 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 169 | java | package com.tontron.security.auth.dto;
import lombok.Builder;
import lombok.Data;
@Data
@Builder
public class Result {
private int code;
private String msg;
}
| [
"duanxian0402@126.com"
] | duanxian0402@126.com |
776c3b8899ab9655974e1f26a728ead3bb917f0d | a1ec5dfba0b49f641adacea8fdecd677e45a61b8 | /CH09_Static/src/application/App.java | e519ea35ad4f0bf7cbaec474280c9da10b697deb | [
"MIT"
] | permissive | Taewoo-cho/java-study | 899aa30033ef3f11ce9b2a472bd2be6274e252ce | 398d3acd186c5565bf41989b3a8fc67fedd67ac3 | refs/heads/main | 2023-08-31T06:19:17.532320 | 2021-10-21T07:11:01 | 2021-10-21T07:11:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 719 | java | package application;
public class App {
public static void main(String[] args) {
// 고양이 클래스 불러오기
Cat cat1 = new Cat("마틸다"); // count++
Cat cat2 = new Cat("라이언"); // count++
System.out.println(cat1);
System.out.println(cat2.toString());
// 스태틱 변수는 객체와 상관없이 클래스.변수로 사용한다 객체 생성필요 없음
System.out.println(Cat.FOOD);
System.out.println(Math.PI);
System.out.println(cat1.getCount());
System.out.println(cat2.getCount());
Cat cat3 = new Cat("울버린"); // count++
System.out.println(cat1.getCount());
System.out.println(cat2.getCount());
System.out.println(cat3.getCount());
}
}
| [
"tojesus623@gmail.com"
] | tojesus623@gmail.com |
036f19af1d3a9cabec7e24acb84e1d394b4518c1 | 0eedd1155f6b714a160615cc64a73d0786de99a3 | /src/test/java/com/autumnutil/ditio/service/dtomapperservice/dto/FieldDto.java | 07d4c291665265ca7fa8d49abe8d72f545e79468 | [] | no_license | csu-anzai/ditio | f3412196e45a28bc95dc478adab4c7e84a533eb4 | f7d79deeba18975d7a15b75ffc89ebbda03f2c4a | refs/heads/master | 2020-07-18T18:36:16.781942 | 2019-08-09T08:06:43 | 2019-08-09T08:06:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 362 | java | package com.autumnutil.ditio.service.dtomapperservice.dto;
import com.autumnutil.ditio.dto.DtoModel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
@Getter
@Setter
@NoArgsConstructor
@Accessors(chain = true)
@DtoModel
public class FieldDto {
private String id;
private String name;
}
| [
"S3gur0.OK"
] | S3gur0.OK |
cf609e2f3b315be99e044b50bbb0d4bfb60ba864 | 648f2bb1e3cc1909eb2e7854ee42da291e2eed3a | /src/main/java/cn/demo/qr_code_generator/service/UserService.java | c11727394a960204fba728681370357834676d4f | [] | no_license | bisheng6/web | 7f5a7f1889fb5fa9cca3adf4a64dd7454cf9b73c | 834047da41159e27849ece32f257793b9e2ce83b | refs/heads/master | 2020-03-16T19:23:33.215643 | 2018-07-11T13:14:07 | 2018-07-11T13:14:07 | 132,913,887 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 875 | java | package cn.demo.qr_code_generator.service;
import cn.demo.qr_code_generator.bean.User;
import cn.demo.qr_code_generator.dao.UserDAO;
import cn.demo.qr_code_generator.util.MD5Util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.stereotype.Service;
@Service
public class UserService
{
@Autowired
private UserDAO userDAO;
public User getUser()
{
UserDetails userDetails = (UserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
return userDAO.findById(userDetails.getUsername()).get();
}
public void register(User user)
{
user.setPassword(MD5Util.encode(user.getPassword()));
userDAO.save(user);
}
}
| [
"565267339@qq.com"
] | 565267339@qq.com |
e94e8cafb3cea2e470e311815efad5ebcd70e474 | 068aaee669253d524f003b98ef87c340333a54cc | /src/com/userdefinedFunctions/Test1.java | b4d71efb60076b3060ed84ad93c508d24c9b794d | [] | no_license | SrinivasNarayan97/JavaForTester5days | 45b39c7536548842002de9b9388067de7ebaa410 | 75d0fb962f497964bc46f0f46033116a6f3c602e | refs/heads/master | 2023-01-05T21:16:18.200649 | 2020-10-30T14:38:16 | 2020-10-30T14:38:16 | 308,654,875 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 539 | java | package com.userdefinedFunctions;
public class Test1 {
String m;
int p;
//Function defination
public void login() {
//selenium code to login
System.out.println("Login statements");
}
public static void main(String[] args) {
System.out.println("A");
// login(); //Function call
System.out.println("B");
// login();
System.out.println("C");
//login();
System.out.println("D");
Test1 t= new Test1();
t.login();
};
}
| [
"snarayan2505@gmail.com"
] | snarayan2505@gmail.com |
1e13acebd5f6f9fa8ccb36d2f9bb2b1158eb45d3 | 0b1b73ee9ceab17c10d09d025729b268bc98ce02 | /src/main/java/com/example/database/entity/Contact.java | 7fff4aaadd70a4b4fbc75b7196506adf616d4783 | [] | no_license | AndreyKozlovskiy/Contacts_APP | 3204a6ef59c06f03988abde54292bdde081b1084 | b2038521a3c3db6af343322223a799856e93a5f3 | refs/heads/main | 2023-01-28T20:26:00.904569 | 2020-12-16T17:25:07 | 2020-12-16T17:25:07 | 316,176,461 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,067 | java | package com.example.database.entity;
import com.fasterxml.jackson.annotation.JsonManagedReference;
import lombok.*;
import javax.persistence.*;
@Entity
@Data
@Table(name = "CONTACTS")
public class Contact {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "CONTACT_ID", nullable = false)
private Long id;
@Column(name = "CONTACT_NAME", nullable = false)
private String contactName;
@Column(name = "CONTACT_SURNAME", nullable = true)
private String contactSurname;
@Column(name = "CONTACT_PHONE",nullable = false)
private String contactPhone;
@ManyToOne(optional = false, cascade = CascadeType.MERGE)
@JoinColumn(name = "USER_ID")
@JsonManagedReference
private User user;
@Override
public String toString() {
return "Contact{" +
"id: " + id + ", " +
"contactName: " + contactName + ", " +
"contactSurname:" + contactSurname + ", " +
"contactPhone:" + contactPhone + ", " +
"}";
}
}
| [
"caratosandre@gmail.com"
] | caratosandre@gmail.com |
a231f692f445436cb26e08ab3be6c575805d932f | 419e0607d4bb1ff298faca921447ee4b35e5b894 | /server/src/main/java/io/crate/metadata/functions/BoundSignature.java | fd1d1dbf676689931aa14eaffa341ec52c4e393b | [
"LicenseRef-scancode-generic-cla",
"Apache-2.0"
] | permissive | crate/crate | 7af793e2f709b77a5addc617d6e9dbba452d4e68 | 8acb044a7cdbab048b045854d0466fccc2492550 | refs/heads/master | 2023-08-31T07:17:42.891453 | 2023-08-30T15:09:09 | 2023-08-30T17:13:14 | 9,342,529 | 3,540 | 639 | Apache-2.0 | 2023-09-14T21:00:43 | 2013-04-10T09:17:16 | Java | UTF-8 | Java | false | false | 1,760 | java | /*
* Licensed to Crate.io GmbH ("Crate") under one or more contributor
* license agreements. See the NOTICE file distributed with this work for
* additional information regarding copyright ownership. Crate 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.
*
* However, if you have executed another commercial license agreement
* with Crate these terms will supersede the license and you may use the
* software solely pursuant to the terms of the relevant commercial agreement.
*/
package io.crate.metadata.functions;
import java.util.List;
import io.crate.types.DataType;
public final class BoundSignature {
private final List<DataType<?>> argTypes;
private final DataType<?> returnType;
public static BoundSignature sameAsUnbound(Signature signature) {
return new BoundSignature(
signature.getArgumentDataTypes(),
signature.getReturnType().createType()
);
}
public BoundSignature(List<DataType<?>> argTypes, DataType<?> returnType) {
this.argTypes = argTypes;
this.returnType = returnType;
}
public List<DataType<?>> argTypes() {
return argTypes;
}
public DataType<?> returnType() {
return returnType;
}
}
| [
"37929162+mergify[bot]@users.noreply.github.com"
] | 37929162+mergify[bot]@users.noreply.github.com |
ddf67bbe309b021bbba674fb4da1157fb5e83b49 | 272aae9f2b819e69f9b40f4ff8ce51fbdb3bacc3 | /app/src/main/java/com/example/usuario/codigo_reserva/Crypto_dos_nivel.java | ca899a4a67731502ee15f85d4f9b271ded980c90 | [] | no_license | DEUSTO-SPQ-1718-2/ITing | 6d5d59015d07b282671ad311e6eaff0feb8604fc | 547f8913ce11995071554fdf08c1b9c3b6b9023d | refs/heads/master | 2021-07-14T22:54:05.520985 | 2017-10-21T00:51:50 | 2017-10-21T00:51:51 | 104,736,546 | 0 | 0 | null | 2017-10-20T18:26:03 | 2017-09-25T10:32:11 | Java | UTF-8 | Java | false | false | 5,326 | java | package com.example.usuario.codigo_reserva;
import android.util.Base64;
import android.util.Log;
import java.io.UnsupportedEncodingException;
import java.security.GeneralSecurityException;
import java.security.SecureRandom;
import java.security.spec.KeySpec;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.SecretKeySpec;
public class Crypto_dos_nivel {
private static final String TAG = Crypto_dos_nivel.class.getSimpleName();
public static final String PKCS12_DERIVATION_ALGORITHM = "PBEWITHSHA256AND256BITAES-CBC-BC";
public static final String PBKDF2_DERIVATION_ALGORITHM = "PBKDF2WithHmacSHA1";
private static final String CIPHER_ALGORITHM = "AES/CBC/PKCS5Padding";
private static String DELIMITER = "]";
private static int KEY_LENGTH = 256;
// minimum values recommended by PKCS#5, increase as necessary
private static int ITERATION_COUNT = 1000;
private static final int PKCS5_SALT_LENGTH = 8;
private static SecureRandom random = new SecureRandom();
private Crypto_dos_nivel() {
}
public static SecretKey deriveKeyPbkdf2(byte[] salt, String password) {
try {
long start = System.currentTimeMillis();
KeySpec keySpec = new PBEKeySpec(password.toCharArray(), salt,
ITERATION_COUNT, KEY_LENGTH);
SecretKeyFactory keyFactory = SecretKeyFactory
.getInstance(PBKDF2_DERIVATION_ALGORITHM);
byte[] keyBytes = keyFactory.generateSecret(keySpec).getEncoded();
Log.d(TAG, "key bytes: " + toHex(keyBytes));
SecretKey result = new SecretKeySpec(keyBytes, "AES");
long elapsed = System.currentTimeMillis() - start;
Log.d(TAG, String.format("PBKDF2 key derivation took %d [ms].",
elapsed));
return result;
} catch (GeneralSecurityException e) {
throw new RuntimeException(e);
}
}
public static byte[] generateIv(int length) {
byte[] b = new byte[length];
random.nextBytes(b);
return b;
}
public static byte[] generateSalt() {
byte[] b = new byte[PKCS5_SALT_LENGTH];
random.nextBytes(b);
return b;
}
public static String encrypt(String plaintext, SecretKey key, byte[] salt) {
try {
Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM);
byte[] iv = generateIv(cipher.getBlockSize());
Log.d(TAG, "IV: " + toHex(iv));
IvParameterSpec ivParams = new IvParameterSpec(iv);
cipher.init(Cipher.ENCRYPT_MODE, key, ivParams);
Log.d(TAG, "Cipher IV: "
+ (cipher.getIV() == null ? null : toHex(cipher.getIV())));
byte[] cipherText = cipher.doFinal(plaintext.getBytes("UTF-8"));
if (salt != null) {
return String.format("%s%s%s%s%s", toBase64(salt), DELIMITER,
toBase64(iv), DELIMITER, toBase64(cipherText));
}
return String.format("%s%s%s", toBase64(iv), DELIMITER,
toBase64(cipherText));
} catch (GeneralSecurityException e) {
throw new RuntimeException(e);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
}
public static String toHex(byte[] bytes) {
StringBuffer buff = new StringBuffer();
for (byte b : bytes) {
buff.append(String.format("%02X", b));
}
return buff.toString();
}
public static String toBase64(byte[] bytes) {
return Base64.encodeToString(bytes, Base64.NO_WRAP);
}
public static byte[] fromBase64(String base64) {
return Base64.decode(base64, Base64.NO_WRAP);
}
public static String decrypt(byte[] cipherBytes, SecretKey key, byte[] iv) {
try {
Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM);
IvParameterSpec ivParams = new IvParameterSpec(iv);
cipher.init(Cipher.DECRYPT_MODE, key, ivParams);
Log.d(TAG, "Cipher IV: " + toHex(cipher.getIV()));
byte[] plaintext = cipher.doFinal(cipherBytes);
System.out.println("joder+"+"Texto descifrado");
String plainrStr = new String(plaintext, "UTF-8");
System.out.println(plainrStr+"Texto descifrado");
return plainrStr;
} catch (GeneralSecurityException e) {
throw new RuntimeException(e);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
}
public static String decryptPbkdf2(String ciphertext, String password) {
String[] fields = ciphertext.split(DELIMITER);
if (fields.length != 3) {
throw new IllegalArgumentException("Invalid encypted text format");
}
byte[] salt = fromBase64(fields[0]);
byte[] iv = fromBase64(fields[1]);
byte[] cipherBytes = fromBase64(fields[2]);
SecretKey key = deriveKeyPbkdf2(salt, password);
System.out.println("PASAAAAAAAAAAAA");
return decrypt(cipherBytes, key, iv);
}
}
| [
"asier.dorronsoro@opendeusto.es"
] | asier.dorronsoro@opendeusto.es |
e44d90baba554d230c6a0cd98b821770d9e6762c | a3557716924013565c813f825926c5a71184ce6a | /src/com/task2/ch1/Ex3.java | 72c9fcd83a3b516f5afac18cc72580f0c23f3006 | [] | no_license | Lumeus/tasksJava | acc7e78c7b159d90633fce22298f4d2af08a189c | 5f5254c83ffde65fd5eebc9baf44786c4d42d146 | refs/heads/master | 2023-04-24T12:35:16.233658 | 2021-05-09T17:53:39 | 2021-05-09T17:53:39 | 350,357,750 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 709 | java | package com.task2.ch1;
import sun.awt.geom.AreaOp;
import java.util.Scanner;
public class Ex3 {
public static void doIt() {
Scanner in = new Scanner(System.in);
System.out.print("Enter integer: ");
int num1 = in.nextInt(10);
System.out.print("Enter integer: ");
int num2 = in.nextInt(10);
System.out.print("Enter integer: ");
int num3 = in.nextInt(10);
int max1 = num1;
if (max1 < num2) max1 = num2;
if (max1 < num3) max1 = num3;
int max2 = Math.max(Math.max(num1, num2), num3);
System.out.println("Max by conditional operator: " + max1);
System.out.println("Max by Math.max: " + max2);
}
}
| [
"lumeus.cream@gmail.com"
] | lumeus.cream@gmail.com |
c996c28efa292113241ef569fe25a0e278b41a62 | 17ccc370d561e7f599f53261faf19886b5c7e453 | /app/src/main/java/com/example/sawsan/ma2tou3/MechanicActivity.java | e2463af43ff092227a80492e9dff7e14cb1a556f | [] | no_license | sawsanMohsen/ma2tou3 | 106b0f35aa3b3d08b64799ec89d0619be75a7674 | 8ce6f14c601524866fb57c9d8e169dfb87f6710a | refs/heads/master | 2020-06-14T20:50:28.276826 | 2019-07-04T11:29:43 | 2019-07-04T11:29:43 | 194,067,799 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,520 | java | package com.example.sawsan.ma2tou3;
import android.app.ListActivity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;
public class MechanicActivity extends AppCompatActivity {
File file = new File("sdcard/Android/data/com.Ma2tou3.app/Mechanics.txt");
String [] name = null;
Double distance[] = null;
String phone [] = null;
String email [] = null;
ListView list;
Double Longitudes [] = null, Latitudes[] =null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_mechanic);
list = (ListView) findViewById(R.id.listView_mech);
createList();
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1, name);
list.setAdapter(adapter);
list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int ii, long l) {
Intent i = new Intent(MechanicActivity.this, ProfileActivity.class);
i.putExtra("Name", name[ii]);
i.putExtra("Email", email[ii]);
i.putExtra("Phone", phone[ii]);
i.putExtra("Distance", distance[ii]);
i.putExtra("Longitude",Longitudes[ii]);
i.putExtra("Latitude", Latitudes[ii]);
startActivity(i);
}
});
}
public void createList()
{
int counter = 0;
String temp = "";
BufferedReader bf = null;
int longCount = 0, latCount = 0;
int counter2 = 0;
try {
bf = new BufferedReader(new FileReader(file));
while ((temp = bf.readLine()) != null) {
if (temp.contains("name")) {
counter2 = 0;
counter++;
}
counter2++;
if (counter2==4)
longCount++;
if (counter2 == 5)
latCount++;
}
Longitudes = new Double [longCount];
Latitudes = new Double[latCount];
distance = new Double [latCount];
phone = new String [counter];
email = new String [counter];
latCount = longCount = 0;
bf = new BufferedReader(new FileReader(file));
name = new String [counter];
counter = 0;
while ((temp = bf.readLine()) != null) {
if (temp.contains("name")) {
StringTokenizer st = new StringTokenizer(temp, ":");
st.nextToken();
name[counter++] = st.nextToken();
}
else if (temp.contains("Longitude"))
{
StringTokenizer st = new StringTokenizer(temp,":");
st.nextToken();
Longitudes[longCount++] = Double.parseDouble(st.nextToken());
}
else if (temp.contains("Latitude"))
{
StringTokenizer st = new StringTokenizer(temp,":");
st.nextToken();
Latitudes[latCount++] = Double.parseDouble(st.nextToken());
}
else if (!temp.contains("@") && temp.length()>=8)
phone[counter-1] = temp;
else
email[counter-1] = temp;
}
} catch (IOException e) {
e.printStackTrace();
}
SharedPreferences preferences = getSharedPreferences("myprefs", Context.MODE_PRIVATE);
double currentLong = Double.parseDouble(preferences.getString("currentLongitude","0"));
double currentLat = Double.parseDouble(preferences.getString("currentLatitude","0"));
for (int i =0; i<Longitudes.length; i++)
{
distance[i] = distance(currentLong,currentLat,Longitudes[i],Latitudes[i]);
}
double tempdis;
String tempname;
String tempEmail;
String tempPhone;
Double templongi, templati;
for (int i =0; i<distance.length; i++)
{
for (int j =0; j<distance.length-1; j++)
{
if (distance[j]>distance[j+1])
{
tempdis = distance[j];
distance[j] = distance[j+1];
distance[j+1] = tempdis;
tempname = name[j];
name[j] = name[j+1];
name[j+1] = tempname;
tempEmail = email[j];
email[j] = email [j+1];
email[j+1] = tempEmail;
tempPhone = phone[j];
phone[j] = phone[j+1];
phone[j+1] = tempPhone;
templongi = Longitudes[j];
Longitudes[j] = Longitudes[j+1];
Longitudes[j+1] = templongi;
templati = Latitudes[j];
Latitudes[j] = Latitudes[j+1];
Latitudes[j+1] = templati;
}
}
}
}
public Double distance(double lat1, double lon1, double lat2, double lon2) {
double dist;
final int R = 6371; // Radious of the earth
Double latDistance = Math.toRadians(lat2-lat1);
Double lonDistance = Math.toRadians(lon2-lon1);
Double a = Math.sin(latDistance / 2) * Math.sin(latDistance / 2) +
Math.cos(Math.toRadians(lat1)) * Math.cos(Math.toRadians(lat2)) *
Math.sin(lonDistance / 2) * Math.sin(lonDistance / 2);
Double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
Double distance = R * c;
return distance;
}
}
| [
"sawsan.m.mohsen@gmail.com"
] | sawsan.m.mohsen@gmail.com |
37cc64d59ea2e088459b5c1a226fba2e1b86d885 | 92f7ba1ebc2f47ecb58581a2ed653590789a2136 | /src/com/infodms/dms/po/TtAsWrActivityHoursPO.java | 114e0e9f342b176f9bc88e654accca90170d1d1f | [] | no_license | dnd2/CQZTDMS | 504acc1883bfe45842c4dae03ec2ba90f0f991ee | 5319c062cf1932f8181fdd06cf7e606935514bf1 | refs/heads/master | 2021-01-23T15:30:45.704047 | 2017-09-07T07:47:51 | 2017-09-07T07:47:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,447 | java | /*
* Copyright (c) 2005 Infoservice, Inc. All Rights Reserved.
* This software is published under the terms of the Infoservice Software
* License version 1.0, a copy of which has been included with this
* distribution in the LICENSE.txt file.
*
* CreateDate : 2017-07-24 11:06:34
* CreateBy : chenzheng
* Comment : generate by com.sgm.po.POGen
*/
package com.infodms.dms.po;
import com.infoservice.po3.bean.PO;
@SuppressWarnings("serial")
public class TtAsWrActivityHoursPO extends PO{
private String hoursName;
private String hoursCode;
private Long id;
private Float applyHoursCount;
private Long activityId;
private Long hoursId;
public void setHoursName(String hoursName){
this.hoursName=hoursName;
}
public String getHoursName(){
return this.hoursName;
}
public void setHoursCode(String hoursCode){
this.hoursCode=hoursCode;
}
public String getHoursCode(){
return this.hoursCode;
}
public void setId(Long id){
this.id=id;
}
public Long getId(){
return this.id;
}
public void setApplyHoursCount(Float applyHoursCount){
this.applyHoursCount=applyHoursCount;
}
public Float getApplyHoursCount(){
return this.applyHoursCount;
}
public void setActivityId(Long activityId){
this.activityId=activityId;
}
public Long getActivityId(){
return this.activityId;
}
public void setHoursId(Long hoursId){
this.hoursId=hoursId;
}
public Long getHoursId(){
return this.hoursId;
}
} | [
"wanghanxiancn@gmail.com"
] | wanghanxiancn@gmail.com |
8d59a915fc7ad0e8191c320194b1c5804635dbac | 8c96d2efdbcdde39909289b79128f3a037064069 | /smart-core/src/main/java/com/si/jupiter/smart/core/SmartSecurityFactory.java | f6a15a0da870c0770f6352e7704d62b59ace14d9 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | davidxiaozhi/smart | 618b8384f318086a04540fea717b287129b77c8d | f34d48bdc846ee52aaa04a620fc2270de1485480 | refs/heads/master | 2021-01-21T06:42:32.048808 | 2020-05-25T11:15:31 | 2020-05-25T11:15:31 | 82,870,372 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 781 | java | /*
* Copyright (C) 2012-2013 Facebook, 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.si.jupiter.smart.core;
public interface SmartSecurityFactory
{
SmartSecurityHandlers getSecurityHandlers(ThriftServerDef def, NettyServerConfig serverConfig);
}
| [
"lizhipeng@jd.com"
] | lizhipeng@jd.com |
1559b5741ea7a05ff9fa0b024bbbd4d60966e2b3 | a99855ea012cf007238da84b659b6acd387b9190 | /coding-problems/rock-paper-scissors/user-object.java | 7df2485ff3a709d81c0c219d42868235633031d5 | [] | no_license | leyohla/Java-problems | ba566b8c6dd0a559df6f2116c799c88496e542f1 | a400e4012e5e7ea62a7ff6b6bee3caad4d6926e2 | refs/heads/master | 2020-04-30T15:14:32.929897 | 2019-04-12T08:49:18 | 2019-04-12T08:49:18 | 176,915,329 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 384 | java | import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class User {
public String userInput(){
Scanner scanner = new Scanner(System.in);
String user = scanner.nextLine();
return user;
//validate user input and loop
//give something that will give what user is typing in.
//exception catching
}
}
| [
"noreply@github.com"
] | leyohla.noreply@github.com |
470cbb07f309abb69aeb2bc7959144eb62b4afae | 892b2b179a083c7e2a5b78667282ef3dd5ab1bb9 | /shiro-plus-loader/shiro-plus-loader-admin-server/src/main/java/org/codingeasy/shiroplus/loader/admin/server/dao/InstanceDao.java | ef764a2fabb934ea363787ed3c075e874265f07d | [
"Apache-2.0"
] | permissive | azkoss/shiro-plus | bf5c99165d01709b761d2a21c919c6d5f7a5db21 | f5aedbf06dae5072f67b8d3bbaeb119ad0cf8e3c | refs/heads/master | 2023-07-02T17:57:24.706700 | 2021-08-10T03:20:26 | 2021-08-10T03:20:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 442 | java | package org.codingeasy.shiroplus.loader.admin.server.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.codingeasy.shiroplus.loader.admin.server.models.entity.InstanceEntity;
import java.util.List;
/**
* 事件处理记录
* @author : KangNing Hu
*/
@Mapper
public interface InstanceDao extends BaseMapper<InstanceEntity> {
}
| [
"37797822+KangNHu@users.noreply.github.com"
] | 37797822+KangNHu@users.noreply.github.com |
1e178c4891e54b4d9e68484aa6bda057bb37c221 | 9cb11fe3085ab7a859c20a8dc7d7bfe6a371b40c | /src/AbstractFactoryPattern/ISlider.java | 20f8954128ce951854538168407062a7efa2a23a | [] | no_license | mertcannkocerr/DesignPatternsImplementations | 204201d00523a99f7e95334872d8959ac810ffea | 90e4dc5b6afc127919b4f88eec584450accbe02c | refs/heads/master | 2023-07-05T13:59:45.451828 | 2021-08-16T13:44:07 | 2021-08-16T13:44:07 | 371,530,815 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 107 | java | package AbstractFactoryPattern;
public interface ISlider {
String getColor();
float getWidth();
}
| [
"mertcanyedek2@gmail.com"
] | mertcanyedek2@gmail.com |
e57a1d3f7869b73c0e2555d51d995134b8c37035 | 2f70e8c32276fc6671189992d7dcde8c6e380f76 | /CoreJava/src/com/techchefs/javaapp/collections/Student.java | 958b2d611a719e26e3792f1570ce7754a9520895 | [] | no_license | SindhuKarnic/ELF-06June19-Techchefs-SindhuKarnic | 5dc73a472637b6ed650c128a40b9548b2dfcd115 | 31f2d0da44226d0186bd4ee0c63280d620320b3e | refs/heads/master | 2022-12-22T10:46:25.665558 | 2019-08-23T12:15:17 | 2019-08-23T12:15:17 | 192,526,785 | 0 | 0 | null | 2022-12-15T23:54:44 | 2019-06-18T11:28:51 | Rich Text Format | UTF-8 | Java | false | false | 722 | java | package com.techchefs.javaapp.collections;
public class Student implements Comparable<Student>{
String name;
int id;
int percent;
@Override
public int compareTo(Student o) {
String a = this.name;
String b = o.name;
int i = a.compareTo(b);
return i;
//return this.name.compareTo(o.name);
}
/* Logic to sort wrt id
* @Override public int compareTo(Student o) { if (this.id < o.id) { return -1;
* } else if (this.id > o.id) { return 1; } else { return 0; } }
*/
/* Logic to sort Student wrt percent
* public int compareTo(Student o) {
if (this.percent < o.percent) {
return -1;
} else if (this.percent > o.percent) {
return 1;
} else {
return 0;
}
}*/
}
| [
"sindhukarnic@gmail.com"
] | sindhukarnic@gmail.com |
878c1bcdcddb7bc277387eed06ee2fe618d6efda | 4df7d4bf0b549b78148777498d0e8bda31b881a6 | /Customer_Relation_Manager/target/tomcat/work/Tomcat/localhost/_/org/apache/jsp/WEB_002dINF/views/home_jsp.java | a6d63442708bc42b70f4539965b89a3f3333c48e | [] | no_license | prMaker/Customer_Relation_Manager | db827417f65dd053d778286eaa346f670cb1d945 | aea622f2bac626123bf4f27fa24a3b26943a976c | refs/heads/master | 2021-01-20T19:36:17.480367 | 2016-07-12T00:52:37 | 2016-07-12T00:52:37 | 63,064,615 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 26,053 | java | /*
* Generated by the Jasper component of Apache Tomcat
* Version: Apache Tomcat/7.0.47
* Generated at: 2016-07-11 05:30:43 UTC
* Note: The last modified time of this file was set to
* the last modified time of the source file after
* generation to assist with modification tracking.
*/
package org.apache.jsp.WEB_002dINF.views;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
public final class home_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static final javax.servlet.jsp.JspFactory _jspxFactory =
javax.servlet.jsp.JspFactory.getDefaultFactory();
private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants;
static {
_jspx_dependants = new java.util.HashMap<java.lang.String,java.lang.Long>(2);
_jspx_dependants.put("/WEB-INF/views/include/mainHeader.jsp", Long.valueOf(1468051335756L));
_jspx_dependants.put("/WEB-INF/views/include/leftSide.jsp", Long.valueOf(1468209037732L));
}
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fshiro_005fprincipal_0026_005fproperty_005fnobody;
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fshiro_005fhasAnyRoles_0026_005fname;
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fshiro_005fhasRole_0026_005fname;
private javax.el.ExpressionFactory _el_expressionfactory;
private org.apache.tomcat.InstanceManager _jsp_instancemanager;
public java.util.Map<java.lang.String,java.lang.Long> getDependants() {
return _jspx_dependants;
}
public void _jspInit() {
_005fjspx_005ftagPool_005fshiro_005fprincipal_0026_005fproperty_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_005fjspx_005ftagPool_005fshiro_005fhasAnyRoles_0026_005fname = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_005fjspx_005ftagPool_005fshiro_005fhasRole_0026_005fname = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
_jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig());
}
public void _jspDestroy() {
_005fjspx_005ftagPool_005fshiro_005fprincipal_0026_005fproperty_005fnobody.release();
_005fjspx_005ftagPool_005fshiro_005fhasAnyRoles_0026_005fname.release();
_005fjspx_005ftagPool_005fshiro_005fhasRole_0026_005fname.release();
}
public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response)
throws java.io.IOException, javax.servlet.ServletException {
final javax.servlet.jsp.PageContext pageContext;
javax.servlet.http.HttpSession session = null;
final javax.servlet.ServletContext application;
final javax.servlet.ServletConfig config;
javax.servlet.jsp.JspWriter out = null;
final java.lang.Object page = this;
javax.servlet.jsp.JspWriter _jspx_out = null;
javax.servlet.jsp.PageContext _jspx_page_context = null;
try {
response.setContentType("text/html;charset=UTF-8");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\r\n");
out.write("<!DOCTYPE html>\r\n");
out.write("<!--\r\n");
out.write("This is a starter template page. Use this page to start your new project from\r\n");
out.write("scratch. This page gets rid of all links and provides the needed markup only.\r\n");
out.write("-->\r\n");
out.write("<html>\r\n");
out.write("<head>\r\n");
out.write(" <meta charset=\"utf-8\">\r\n");
out.write(" <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\r\n");
out.write(" <title>AdminLTE 2 | Starter</title>\r\n");
out.write(" <!-- Tell the browser to be responsive to screen width -->\r\n");
out.write(" <meta content=\"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no\" name=\"viewport\">\r\n");
out.write(" <!-- Bootstrap 3.3.6 -->\r\n");
out.write(" <link rel=\"stylesheet\" href=\"/static/bootstrap/css/bootstrap.min.css\">\r\n");
out.write(" <!-- Font Awesome -->\r\n");
out.write(" <link rel=\"stylesheet\" href=\"/static/plugins/fontawesome/css/font-awesome.min.css\">\r\n");
out.write(" <!-- Theme style -->\r\n");
out.write(" <link rel=\"stylesheet\" href=\"/static/dist/css/AdminLTE.min.css\">\r\n");
out.write(" <!-- AdminLTE Skins. We have chosen the skin-blue for this starter\r\n");
out.write(" page. However, you can choose any other skin. Make sure you\r\n");
out.write(" apply the skin class to the body tag so the changes take effect.\r\n");
out.write(" -->\r\n");
out.write(" <link rel=\"stylesheet\" href=\"/static/dist/css/skins/skin-blue.min.css\">\r\n");
out.write("</head>\r\n");
out.write("<body class=\"hold-transition skin-blue sidebar-mini\">\r\n");
out.write("<div class=\"wrapper\">\r\n");
out.write("\r\n");
out.write(" ");
out.write("\r\n");
out.write("\r\n");
out.write("<!-- Main Header -->\r\n");
out.write("<header class=\"main-header\">\r\n");
out.write("\r\n");
out.write(" <!-- Logo -->\r\n");
out.write(" <a href=\"index2.html\" class=\"logo\">\r\n");
out.write(" <!-- mini logo for sidebar mini 50x50 pixels -->\r\n");
out.write(" <span class=\"logo-mini\">CRM</span>\r\n");
out.write(" <!-- logo for regular state and mobile devices -->\r\n");
out.write(" <span class=\"logo-lg\"><b>Kaisheng</b>CRM</span>\r\n");
out.write(" </a>\r\n");
out.write("\r\n");
out.write(" <!-- Header Navbar -->\r\n");
out.write(" <nav class=\"navbar navbar-static-top\" role=\"navigation\">\r\n");
out.write(" <!-- Sidebar toggle button-->\r\n");
out.write(" <a href=\"#\" class=\"sidebar-toggle\" data-toggle=\"offcanvas\" role=\"button\">\r\n");
out.write(" <span class=\"sr-only\">Toggle navigation</span>\r\n");
out.write(" </a>\r\n");
out.write(" <!-- Navbar Right Menu -->\r\n");
out.write(" <div class=\"navbar-custom-menu\">\r\n");
out.write(" <ul class=\"nav navbar-nav\">\r\n");
out.write(" <!-- Messages: style can be found in dropdown.less-->\r\n");
out.write(" <li class=\"dropdown messages-menu\">\r\n");
out.write(" <!-- Menu toggle button -->\r\n");
out.write(" <a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">\r\n");
out.write(" <i class=\"fa fa-envelope-o\"></i>\r\n");
out.write(" <span class=\"label label-success\">4</span>\r\n");
out.write(" </a>\r\n");
out.write(" <ul class=\"dropdown-menu\">\r\n");
out.write(" <li class=\"header\">You have 4 messages</li>\r\n");
out.write(" <li>\r\n");
out.write(" <!-- inner menu: contains the messages -->\r\n");
out.write(" <ul class=\"menu\">\r\n");
out.write(" <li><!-- start message -->\r\n");
out.write(" <a href=\"#\">\r\n");
out.write(" <div class=\"pull-left\">\r\n");
out.write(" <!-- User Image -->\r\n");
out.write(" <img src=\"/static/dist/img/user2-160x160.jpg\" class=\"img-circle\" alt=\"User Image\">\r\n");
out.write(" </div>\r\n");
out.write(" <!-- Message title and timestamp -->\r\n");
out.write(" <h4>\r\n");
out.write(" Support Team\r\n");
out.write(" <small><i class=\"fa fa-clock-o\"></i> 5 mins</small>\r\n");
out.write(" </h4>\r\n");
out.write(" <!-- The message -->\r\n");
out.write(" <p>Why not buy a new awesome theme?</p>\r\n");
out.write(" </a>\r\n");
out.write(" </li>\r\n");
out.write(" <!-- end message -->\r\n");
out.write(" </ul>\r\n");
out.write(" <!-- /.menu -->\r\n");
out.write(" </li>\r\n");
out.write(" <li class=\"footer\"><a href=\"#\">See All Messages</a></li>\r\n");
out.write(" </ul>\r\n");
out.write(" </li>\r\n");
out.write(" <!-- /.messages-menu -->\r\n");
out.write("\r\n");
out.write(" <!-- Notifications Menu -->\r\n");
out.write(" <li class=\"dropdown notifications-menu\">\r\n");
out.write(" <!-- Menu toggle button -->\r\n");
out.write(" <a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">\r\n");
out.write(" <i class=\"fa fa-bell-o\"></i>\r\n");
out.write(" <span class=\"label label-warning\">10</span>\r\n");
out.write(" </a>\r\n");
out.write(" <ul class=\"dropdown-menu\">\r\n");
out.write(" <li class=\"header\">You have 10 notifications</li>\r\n");
out.write(" <li>\r\n");
out.write(" <!-- Inner Menu: contains the notifications -->\r\n");
out.write(" <ul class=\"menu\">\r\n");
out.write(" <li><!-- start notification -->\r\n");
out.write(" <a href=\"#\">\r\n");
out.write(" <i class=\"fa fa-users text-aqua\"></i> 5 new members joined today\r\n");
out.write(" </a>\r\n");
out.write(" </li>\r\n");
out.write(" <!-- end notification -->\r\n");
out.write(" </ul>\r\n");
out.write(" </li>\r\n");
out.write(" <li class=\"footer\"><a href=\"#\">View all</a></li>\r\n");
out.write(" </ul>\r\n");
out.write(" </li>\r\n");
out.write(" <!-- Tasks Menu -->\r\n");
out.write(" <li class=\"dropdown tasks-menu\">\r\n");
out.write(" <!-- Menu Toggle Button -->\r\n");
out.write(" <a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">\r\n");
out.write(" <i class=\"fa fa-flag-o\"></i>\r\n");
out.write(" <span class=\"label label-danger\">9</span>\r\n");
out.write(" </a>\r\n");
out.write(" <ul class=\"dropdown-menu\">\r\n");
out.write(" <li class=\"header\">You have 9 tasks</li>\r\n");
out.write(" <li>\r\n");
out.write(" <!-- Inner menu: contains the tasks -->\r\n");
out.write(" <ul class=\"menu\">\r\n");
out.write(" <li><!-- Task item -->\r\n");
out.write(" <a href=\"#\">\r\n");
out.write(" <!-- Task title and progress text -->\r\n");
out.write(" <h3>\r\n");
out.write(" Design some buttons\r\n");
out.write(" <small class=\"pull-right\">20%</small>\r\n");
out.write(" </h3>\r\n");
out.write(" <!-- The progress bar -->\r\n");
out.write(" <div class=\"progress xs\">\r\n");
out.write(" <!-- Change the css width attribute to simulate progress -->\r\n");
out.write(" <div class=\"progress-bar progress-bar-aqua\" style=\"width: 20%\" role=\"progressbar\" aria-valuenow=\"20\" aria-valuemin=\"0\" aria-valuemax=\"100\">\r\n");
out.write(" <span class=\"sr-only\">20% Complete</span>\r\n");
out.write(" </div>\r\n");
out.write(" </div>\r\n");
out.write(" </a>\r\n");
out.write(" </li>\r\n");
out.write(" <!-- end task item -->\r\n");
out.write(" </ul>\r\n");
out.write(" </li>\r\n");
out.write(" <li class=\"footer\">\r\n");
out.write(" <a href=\"#\">View all tasks</a>\r\n");
out.write(" </li>\r\n");
out.write(" </ul>\r\n");
out.write(" </li>\r\n");
out.write(" <!-- User Account Menu -->\r\n");
out.write(" <li class=\"dropdown\">\r\n");
out.write(" <!-- Menu Toggle Button -->\r\n");
out.write(" <a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">\r\n");
out.write(" <span class=\"hidden-xs\">");
if (_jspx_meth_shiro_005fprincipal_005f0(_jspx_page_context))
return;
out.write("</span>\r\n");
out.write(" </a>\r\n");
out.write(" <ul class=\"dropdown-menu\">\r\n");
out.write(" <li><a href=\"/user/password\">修改密码</a></li>\r\n");
out.write(" <li><a href=\"/user/log\">登录日志</a></li>\r\n");
out.write(" <li class=\"divider\"></li>\r\n");
out.write(" <li><a href=\"/logout\">安全退出</a></li>\r\n");
out.write(" </ul>\r\n");
out.write(" </li>\r\n");
out.write("\r\n");
out.write(" </ul>\r\n");
out.write(" </div>\r\n");
out.write(" </nav>\r\n");
out.write("</header>");
out.write("\r\n");
out.write(" ");
out.write("\r\n");
out.write("\r\n");
out.write("<!-- Left side column. contains the logo and sidebar -->\r\n");
out.write("<aside class=\"main-sidebar\">\r\n");
out.write("\r\n");
out.write(" <!-- sidebar: style can be found in sidebar.less -->\r\n");
out.write(" <section class=\"sidebar\">\r\n");
out.write("\r\n");
out.write("\r\n");
out.write(" <!-- Sidebar Menu -->\r\n");
out.write(" <ul class=\"sidebar-menu\">\r\n");
out.write(" ");
out.write("\r\n");
out.write(" <!-- Optionally, you can add icons to the links -->\r\n");
out.write(" ");
if (_jspx_meth_shiro_005fhasAnyRoles_005f0(_jspx_page_context))
return;
out.write("\r\n");
out.write(" ");
if (_jspx_meth_shiro_005fhasRole_005f0(_jspx_page_context))
return;
out.write("\r\n");
out.write(" </ul>\r\n");
out.write(" <!-- /.sidebar-menu -->\r\n");
out.write(" </section>\r\n");
out.write(" <!-- /.sidebar -->\r\n");
out.write("</aside>");
out.write("\r\n");
out.write("\r\n");
out.write(" <!-- Content Wrapper. Contains page content -->\r\n");
out.write(" <div class=\"content-wrapper\">\r\n");
out.write(" <!-- Content Header (Page header) -->\r\n");
out.write(" <section class=\"content-header\">\r\n");
out.write(" <h1>\r\n");
out.write(" 首页\r\n");
out.write(" <small>客户关系管理系统</small>\r\n");
out.write(" </h1>\r\n");
out.write(" <ol class=\"breadcrumb\">\r\n");
out.write(" <li><a href=\"#\"><i class=\"fa fa-dashboard\"></i> Level</a></li>\r\n");
out.write(" <li class=\"active\">Here</li>\r\n");
out.write(" </ol>\r\n");
out.write(" </section>\r\n");
out.write("\r\n");
out.write(" <!-- Main content -->\r\n");
out.write(" <section class=\"content\">\r\n");
out.write("\r\n");
out.write(" <!-- Your Page Content Here -->\r\n");
out.write("\r\n");
out.write(" </section>\r\n");
out.write(" <!-- /.content -->\r\n");
out.write(" </div>\r\n");
out.write(" <!-- /.content-wrapper -->\r\n");
out.write("</div>\r\n");
out.write("<!-- ./wrapper -->\r\n");
out.write("\r\n");
out.write("<!-- REQUIRED JS SCRIPTS -->\r\n");
out.write("\r\n");
out.write("<!-- jQuery 2.2.0 -->\r\n");
out.write("<script src=\"/static/plugins/jQuery/jQuery-2.2.0.min.js\"></script>\r\n");
out.write("<!-- Bootstrap 3.3.6 -->\r\n");
out.write("<script src=\"/static/bootstrap/js/bootstrap.min.js\"></script>\r\n");
out.write("<!-- AdminLTE App -->\r\n");
out.write("<script src=\"/static/dist/js/app.min.js\"></script>\r\n");
out.write("\r\n");
out.write("<!-- Optionally, you can add Slimscroll and FastClick plugins.\r\n");
out.write(" Both of these plugins are recommended to enhance the\r\n");
out.write(" user experience. Slimscroll is required when using the\r\n");
out.write(" fixed layout. -->\r\n");
out.write("</body>\r\n");
out.write("</html>\r\n");
} catch (java.lang.Throwable t) {
if (!(t instanceof javax.servlet.jsp.SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
try { out.clearBuffer(); } catch (java.io.IOException e) {}
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
else throw new ServletException(t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
private boolean _jspx_meth_shiro_005fprincipal_005f0(javax.servlet.jsp.PageContext _jspx_page_context)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// shiro:principal
org.apache.shiro.web.tags.PrincipalTag _jspx_th_shiro_005fprincipal_005f0 = (org.apache.shiro.web.tags.PrincipalTag) _005fjspx_005ftagPool_005fshiro_005fprincipal_0026_005fproperty_005fnobody.get(org.apache.shiro.web.tags.PrincipalTag.class);
_jspx_th_shiro_005fprincipal_005f0.setPageContext(_jspx_page_context);
_jspx_th_shiro_005fprincipal_005f0.setParent(null);
// /WEB-INF/views/include/mainHeader.jsp(122,48) name = property type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_shiro_005fprincipal_005f0.setProperty("realname");
int _jspx_eval_shiro_005fprincipal_005f0 = _jspx_th_shiro_005fprincipal_005f0.doStartTag();
if (_jspx_th_shiro_005fprincipal_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005fshiro_005fprincipal_0026_005fproperty_005fnobody.reuse(_jspx_th_shiro_005fprincipal_005f0);
return true;
}
_005fjspx_005ftagPool_005fshiro_005fprincipal_0026_005fproperty_005fnobody.reuse(_jspx_th_shiro_005fprincipal_005f0);
return false;
}
private boolean _jspx_meth_shiro_005fhasAnyRoles_005f0(javax.servlet.jsp.PageContext _jspx_page_context)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// shiro:hasAnyRoles
org.apache.shiro.web.tags.HasAnyRolesTag _jspx_th_shiro_005fhasAnyRoles_005f0 = (org.apache.shiro.web.tags.HasAnyRolesTag) _005fjspx_005ftagPool_005fshiro_005fhasAnyRoles_0026_005fname.get(org.apache.shiro.web.tags.HasAnyRolesTag.class);
_jspx_th_shiro_005fhasAnyRoles_005f0.setPageContext(_jspx_page_context);
_jspx_th_shiro_005fhasAnyRoles_005f0.setParent(null);
// /WEB-INF/views/include/leftSide.jsp(14,12) name = name type = null reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_shiro_005fhasAnyRoles_005f0.setName("经理,员工");
int _jspx_eval_shiro_005fhasAnyRoles_005f0 = _jspx_th_shiro_005fhasAnyRoles_005f0.doStartTag();
if (_jspx_eval_shiro_005fhasAnyRoles_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
do {
out.write("\r\n");
out.write(" <li class=\"active\"><a href=\"#\"><i class=\"fa fa-home\"></i> <span>首页</span></a></li>\r\n");
out.write(" <li><a href=\"#\"><i class=\"fa fa-bullhorn\"></i> <span>公告</span></a></li>\r\n");
out.write(" <li><a href=\"#\"><i class=\"fa fa-building-o\"></i> <span>项目管理</span></a></li>\r\n");
out.write(" <li><a href=\"#\"><i class=\"fa fa-users\"></i> <span>客户管理</span></a></li>\r\n");
out.write(" <li><a href=\"#\"><i class=\"fa fa-bar-chart\"></i> <span>统计</span></a></li>\r\n");
out.write(" <li><a href=\"#\"><i class=\"fa fa-calendar-check-o\"></i> <span>代办事项</span></a></li>\r\n");
out.write(" <li><a href=\"#\"><i class=\"fa fa-file-text\"></i> <span>文档管理</span></a></li>\r\n");
out.write(" ");
int evalDoAfterBody = _jspx_th_shiro_005fhasAnyRoles_005f0.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
}
if (_jspx_th_shiro_005fhasAnyRoles_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005fshiro_005fhasAnyRoles_0026_005fname.reuse(_jspx_th_shiro_005fhasAnyRoles_005f0);
return true;
}
_005fjspx_005ftagPool_005fshiro_005fhasAnyRoles_0026_005fname.reuse(_jspx_th_shiro_005fhasAnyRoles_005f0);
return false;
}
private boolean _jspx_meth_shiro_005fhasRole_005f0(javax.servlet.jsp.PageContext _jspx_page_context)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// shiro:hasRole
org.apache.shiro.web.tags.HasRoleTag _jspx_th_shiro_005fhasRole_005f0 = (org.apache.shiro.web.tags.HasRoleTag) _005fjspx_005ftagPool_005fshiro_005fhasRole_0026_005fname.get(org.apache.shiro.web.tags.HasRoleTag.class);
_jspx_th_shiro_005fhasRole_005f0.setPageContext(_jspx_page_context);
_jspx_th_shiro_005fhasRole_005f0.setParent(null);
// /WEB-INF/views/include/leftSide.jsp(23,12) name = name type = null reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_shiro_005fhasRole_005f0.setName("管理员");
int _jspx_eval_shiro_005fhasRole_005f0 = _jspx_th_shiro_005fhasRole_005f0.doStartTag();
if (_jspx_eval_shiro_005fhasRole_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
do {
out.write("\r\n");
out.write(" <li class=\"treeview\">\r\n");
out.write(" <a href=\"#\"><i class=\"fa fa-cogs\"></i> <span>系统管理</span> <i class=\"fa fa-angle-left pull-right\"></i></a>\r\n");
out.write(" <ul class=\"treeview-menu\">\r\n");
out.write(" <li><a href=\"/admin/usermanager\">员工管理</a></li>\r\n");
out.write(" <li><a href=\"#\">系统设置</a></li>\r\n");
out.write(" </ul>\r\n");
out.write(" </li>\r\n");
out.write(" ");
int evalDoAfterBody = _jspx_th_shiro_005fhasRole_005f0.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
}
if (_jspx_th_shiro_005fhasRole_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005fshiro_005fhasRole_0026_005fname.reuse(_jspx_th_shiro_005fhasRole_005f0);
return true;
}
_005fjspx_005ftagPool_005fshiro_005fhasRole_0026_005fname.reuse(_jspx_th_shiro_005fhasRole_005f0);
return false;
}
}
| [
"prmaker@163.com"
] | prmaker@163.com |
bf491bf9cd1b5749339d5e1f539bca80a71c65a7 | b49081b8d8d5258d6d45ae4405fc12c40240d497 | /haitao-service/src/main/java/com/thinvent/basicpf/controller/MoudleController.java | 8e98de2ae1b5c0f98c720c7e5c3ee8c517669747 | [] | no_license | keercers/haitao | 33ef403e799c50c83bb9162e103d3e619e506a02 | 7fd47aa750563765ee1886f571be8f3dea3996b5 | refs/heads/master | 2020-03-21T12:35:06.752138 | 2018-06-27T10:07:36 | 2018-06-27T10:07:36 | 138,560,732 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,842 | java | package com.thinvent.basicpf.controller;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.thinvent.basicpf.handler.IMoudleHandler;
import com.thinvent.library.exception.ThinventBaseException;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
@RestController
@RequestMapping(value = "moudle")
public class MoudleController {
@Autowired
private IMoudleHandler moudleHandle;
@GetMapping(value = "/getMoudleByLevel")
@ApiOperation(value = "模块--模块等级查询", notes = "根据等级查询模块列表")
@ApiImplicitParam(name = "moudleLevel", required = true, value = "模块ID", dataType = "string", paramType = "query")
public Object getByLevel(@RequestParam(value = "moudleLevel") String moudleLevel, @RequestParam(value = "userId") String userId) throws ThinventBaseException {
return this.moudleHandle.findByMoudleLevelAndEnable(moudleLevel, userId);
}
@GetMapping(value = "/getMoudleTreeBySign")
@ApiOperation(value = "模块--模块子节点查询", notes = "根据模块sign查询模块列表")
@ApiImplicitParam(name = "moudleSign", required = true, value = "模块ID", dataType = "string", paramType = "query")
public Object getTreeBySign(@RequestParam(value = "moudleSign") String moudleSign, @RequestParam(value = "userId") String userId) {
return this.moudleHandle.findTreeByMoudleSignLike(moudleSign, userId);
}
@GetMapping(value = "/getAll")
@ApiOperation(value = "模块--模块查询", notes = "查询所有模块列表")
public Object getAll() {
return this.moudleHandle.findByEnable();
}
@GetMapping(value = "/getForbidList")
@ApiOperation(value = "模块--获取用户禁止权限", notes = "获取用户禁止权限")
@ApiImplicitParam(name = "userId", required = true, value = "禁止权限", dataType = "string")
public String getForbidList(@RequestParam(required = true, value = "userId") String userId) throws ThinventBaseException{
return this.moudleHandle.getForbidList(userId);
}
@GetMapping(value = "/getMoudleTree")
@ApiOperation(value = "模块--模块树查询", notes = "模块树查询")
@ApiImplicitParam(name = "moudleSign", required = true, value = "模块ID", dataType = "String", paramType = "query")
public List<Map> getMoudleTree(@RequestParam(value = "moudleSign") String moudleSign, @RequestParam(value = "userId") String userId) throws ThinventBaseException {
return this.moudleHandle.getMoudleTree(moudleSign, userId);
}
}
| [
"keercers@lookout.com"
] | keercers@lookout.com |
ad2b5eca9527a5ffde2ddb9cd4729f7c65f93067 | d55a1d67e5d2fd2d8550e8cda63dd0eb70b29341 | /SpringGitHubIntegration/src/main/java/com/example/demo/DemoApplication.java | 84ce7ffc7361dc0529b2255c90b17f2eeee3ab9b | [] | no_license | punya405/SpringGitHubIntegration | 03ddb02a0cef616101993a35b8c75b0a8f679232 | 6592ee104b47835aa821a42d2db51e26e108da90 | refs/heads/master | 2020-12-23T03:07:42.345199 | 2020-01-29T15:56:12 | 2020-01-29T15:56:12 | 237,014,573 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 337 | java | package com.example.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
System.out.println("Hello ");
SpringApplication.run(DemoApplication.class, args);
}
}
| [
"punsahoo@WKWIN3412183.global.publicisgroupe.net"
] | punsahoo@WKWIN3412183.global.publicisgroupe.net |
5728e5c02dabd695cfeabb648703ed6bd9fa4438 | bfa878a36cd67d3bd43ab5011d89334f9213dc4b | /LogManager/src/main/java/org/logmanager/model/InfoLog.java | a43fce4a4e7d14bc2ed607580f2f8b50b42114ad | [
"MIT"
] | permissive | IvTomi/logviewer | 0b8d384fd778155df94d54b1135a04d35cc701d9 | f28ff145a3d9a55097714fc25a866b768e222543 | refs/heads/main | 2023-04-07T00:58:50.431363 | 2021-04-12T16:29:58 | 2021-04-12T16:29:58 | 357,257,073 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 438 | java | package org.logmanager.model;
import org.logmanager.utils.Enums;
import java.text.ParseException;
public class InfoLog extends LogStringBase {
public InfoLog(String logString) throws Exception {
super(logString);
}
@Override
protected boolean init(String logString) throws ParseException {
setType(Enums.LogTypes.Info);
setTextColor("black");
setLevel(2);
return true;
}
}
| [
"noreply@github.com"
] | IvTomi.noreply@github.com |
adaa00db14876e34dcb66fc6fa39372a095c95b5 | 9dfd8aa3379ca62b581c4a00577b82fbc05949a9 | /src/FindMinOfArray.java | 84f38baa7d3b6007466a0927fa8dc01c2cb37a8d | [] | no_license | Vuthuylinh/TimGiaTriNhoNhatCuaMang | d038b782bd0a5ac373059da90d90e82520b8db70 | ef3d3faecac4c353e724fee7b3d00d987d661679 | refs/heads/master | 2020-06-25T09:44:37.967503 | 2019-07-28T10:55:32 | 2019-07-28T10:55:32 | 199,275,607 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,035 | java | import java.util.Scanner;
public class FindMinOfArray {
public static int MinValue(int[] array) {
int min = array[0];
int index = 0;
for ( int i= 0; i < array.length; i++) {
if (array[i] < min) {
min = array[i];
index = i;
}
}
return index;
}
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("Enter array size: ");
int size = input.nextInt();
int [] number = new int[size];
for (int i=0;i<size;i++){
System.out.println("Enter number of index "+ i + " is: ");
number[i]=input.nextInt();
}
System.out.println("\tNumber list is: ");
for(int i=0; i<number.length;i++){
System.out.print(number[i]+ "\t");
}
int indexOfMin= MinValue(number);
System.out.println();
System.out.println("Min of input array number is: "+ number[indexOfMin]);
}
}
| [
"thuylinh2490@gmail.com"
] | thuylinh2490@gmail.com |
cc70c32db89f8f57e9d51cdeeb21bd521ee9b590 | 387693265b21e878365a008907ea9d04debe5bab | /app/src/main/java/com/example/romaniatravel/MainActivity.java | 9da1bf083aaf5500846a5c26b922fa26f856ff8e | [] | no_license | MoneaSebastian/TravelApp-PMD | 8771a786946b7bdaa7f70b8bedca5883dc82d757 | 4db4d10fb5c46e5b5ceea69a8a6efb95f457aba3 | refs/heads/master | 2023-04-22T16:37:28.649266 | 2021-05-16T15:58:16 | 2021-05-16T15:58:16 | 357,869,298 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,257 | java | package com.example.romaniatravel;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void Paltinis(View view) {
Toast.makeText(this, "You have clicked Paltinis", Toast.LENGTH_LONG).show();
}
public void Ranca(View view) {
Toast.makeText(this, "You have clicked Ranca", Toast.LENGTH_LONG).show();
}
public void Sinaia(View view) {
Toast.makeText(this, "You have clicked Sinaia", Toast.LENGTH_LONG).show();
}
public void Straja(View view) {
Intent showDetailActivityStraja = new Intent(getApplicationContext(), DetailActivityStraja.class);
startActivity(showDetailActivityStraja);
}
public void Sureanu(View view) {
Toast.makeText(this, "You have clicked Sureanu", Toast.LENGTH_LONG).show();
}
public void Vartop(View view) {
Toast.makeText(this, "You have clicked Vartop", Toast.LENGTH_LONG).show();
}
} | [
"sebastian.monea00@e-uvt.ro"
] | sebastian.monea00@e-uvt.ro |
87f575f4d1f8bae8d432fd2ede21c6b3ff1340ff | eac050d169c31093d6de9854bcf25c335682c31e | /src/main/java/com/lida/es_book/exception/ESAuthorizeException.java | 9b57733f95962d104f50b558787401773daf89f1 | [] | no_license | yafey/es_book | 48d1c0e88ed3a9fae1b6f2c7941fa8220fe2148a | 32cce0ceccfb92b88946ad0196567a927433d517 | refs/heads/master | 2020-03-11T14:48:13.285380 | 2018-03-23T00:06:31 | 2018-03-23T00:06:31 | 130,065,559 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 395 | java | package com.lida.es_book.exception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
/*
*Created by LidaDu on 2018/2/7.
*/
@ResponseStatus(value= HttpStatus.UNAUTHORIZED,reason="Please Login")//返回401状态吗 表示未登录 再AppErrorController中返回/login
public class ESAuthorizeException extends RuntimeException {
}
| [
"1056262718@qq.com"
] | 1056262718@qq.com |
ec8de09101d16cc3d1a903a97e6ec3b7f79321cc | 2a3811b707b564619b9ce0b693c80ae0ade03829 | /RandomizedOptimization/Analysis/results/ABAGAIL/src/opt/test/AbaloneTest.java | f6387212fc2a0fea897be5fd81d82f22e8efb650 | [] | no_license | Strongtheory/Projects | de81e90359e2e2e63c50bfff620ac13023cea850 | b158ba0e2b9796cce2871f32c56ae4d62fa7cdef | refs/heads/master | 2020-06-01T01:57:33.388695 | 2017-04-05T23:02:28 | 2017-04-05T23:02:28 | 24,437,825 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 6,516 | java | package opt.test;
import func.nn.backprop.BackPropagationNetwork;
import func.nn.backprop.BackPropagationNetworkFactory;
import opt.OptimizationAlgorithm;
import opt.RandomizedHillClimbing;
import opt.SimulatedAnnealing;
import opt.example.NeuralNetworkOptimizationProblem;
import opt.ga.StandardGeneticAlgorithm;
import shared.DataSet;
import shared.ErrorMeasure;
import shared.Instance;
import shared.SumOfSquaresError;
import shared.filt.LabelSplitFilter;
import shared.reader.ArffDataSetReader;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.text.DecimalFormat;
import java.util.Scanner;
/**
* Implementation of randomized hill climbing, simulated annealing, and genetic algorithm to
* find optimal weights to a neural network that is classifying abalone as having either fewer
* or more than 15 rings.
*
* @author Hannah Lau
* @version 1.0
*/
public class AbaloneTest {
private static Instance[] instances = initializeInstances();
private static BackPropagationNetworkFactory factory = new BackPropagationNetworkFactory();
private static ErrorMeasure measure = new SumOfSquaresError();
private static DataSet set = new DataSet(instances);
private static DataSet solar = solarSet();
private static BackPropagationNetwork networks[] = new BackPropagationNetwork[3];
private static NeuralNetworkOptimizationProblem[] nnop = new NeuralNetworkOptimizationProblem[3];
private static OptimizationAlgorithm[] oa = new OptimizationAlgorithm[3];
private static String[] oaNames = {"RHC", "SA", "GA"};
private static String results = "";
private static DecimalFormat df = new DecimalFormat("0.000");
public static void main(String[] args) {
for(int i = 0; i < oa.length; i++) {
int inputLayer = 7;
int hiddenLayer = 5;
int outputLayer = 1;
networks[i] = factory.createClassificationNetwork(
new int[] {inputLayer, hiddenLayer, outputLayer});
nnop[i] = new NeuralNetworkOptimizationProblem(solar, networks[i], measure);
}
oa[0] = new RandomizedHillClimbing(nnop[0]);
oa[1] = new SimulatedAnnealing(1E11, .95, nnop[1]);
oa[2] = new StandardGeneticAlgorithm(200, 100, 10, nnop[2]);
for(int i = 0; i < oa.length; i++) {
double start = System.nanoTime(), end, trainingTime, testingTime, correct = 0, incorrect = 0;
train(oa[i], networks[i], oaNames[i]); //trainer.train();
end = System.nanoTime();
trainingTime = end - start;
trainingTime /= Math.pow(10,9);
Instance optimalInstance = oa[i].getOptimal();
networks[i].setWeights(optimalInstance.getData());
double predicted, actual;
start = System.nanoTime();
for (Instance instance : instances) {
networks[i].setInputValues(instance.getData());
networks[i].run();
predicted = Double.parseDouble(instance.getLabel().toString());
actual = Double.parseDouble(networks[i].getOutputValues().toString());
double trash = Math.abs(predicted - actual) < 0.5 ? correct++ : incorrect++;
}
end = System.nanoTime();
testingTime = end - start;
testingTime /= Math.pow(10,9);
results += "\nResults for " + oaNames[i] + ": \nCorrectly classified " + correct + " instances." +
"\nIncorrectly classified " + incorrect + " instances.\nPercent correctly classified: "
+ df.format(correct/(correct+incorrect)*100) + "%\nTraining time: " + df.format(trainingTime)
+ " seconds\nTesting time: " + df.format(testingTime) + " seconds\n";
}
System.out.println(results);
}
private static void train(OptimizationAlgorithm oa, BackPropagationNetwork network, String oaName) {
System.out.println("\nError results for " + oaName + "\n---------------------------");
int trainingIterations = 5000;
for(int i = 0; i < trainingIterations; i++) {
oa.train();
double error = 0;
for (Instance instance : instances) {
network.setInputValues(instance.getData());
network.run();
Instance output = instance.getLabel(), example = new Instance(network.getOutputValues());
example.setLabel(new Instance(Double.parseDouble(network.getOutputValues().toString())));
error += measure.value(output, example);
}
System.out.println(df.format(error));
}
}
////////////////////////////////////////////////////
private static DataSet solarSet() {
DataSet set = null;
try {
/* Alternate between training and testing here!!!!!!!!! */
set = (new ArffDataSetReader((new File(".")).getAbsolutePath() + "training.arff")).read();
LabelSplitFilter lsf = new LabelSplitFilter();
lsf.filter(set);
} catch (Exception e) {
e.printStackTrace();
}
return set;
}
////////////////////////////////////////////////////
private static Instance[] initializeInstances() {
double[][][] attributes = new double[4177][][];
try {
BufferedReader br = new BufferedReader(new FileReader(new File("src/opt/test/abalone.txt")));
for(int i = 0; i < attributes.length; i++) {
Scanner scan = new Scanner(br.readLine());
scan.useDelimiter(",");
attributes[i] = new double[2][];
attributes[i][0] = new double[7]; // 7 attributes
attributes[i][1] = new double[1];
for(int j = 0; j < 7; j++)
attributes[i][0][j] = Double.parseDouble(scan.next());
attributes[i][1][0] = Double.parseDouble(scan.next());
}
}
catch(Exception e) {
e.printStackTrace();
}
Instance[] instances = new Instance[attributes.length];
for(int i = 0; i < instances.length; i++) {
instances[i] = new Instance(attributes[i][0]);
// classifications range from 0 to 30; split into 0 - 14 and 15 - 30
instances[i].setLabel(new Instance(attributes[i][1][0] < 15 ? 0 : 1));
}
return instances;
}
}
| [
"Abhishek_Deo@msn.com"
] | Abhishek_Deo@msn.com |
97d08043da9bd24ce7a0dc71e95636df1b4c4a9b | 4484d9ea2eaa86b9e529e920d8813f3d11e9fe18 | /SearcherService/src/main/java/com/stackroute/swisit/log/LoggingAspect.java | f6be031e5f548f8607455923fb94feae861e5501 | [] | no_license | sripriya94/searcherservice | 0eb67d2ac5588438006dee64e886b062b89e0bc0 | 662ff8cf0e2596dbe25fcfb913915790fba90340 | refs/heads/master | 2020-12-07T00:36:50.805160 | 2017-06-27T04:56:25 | 2017-06-27T04:56:25 | 95,518,568 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 823 | java | package com.stackroute.swisit.log;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;
@Aspect
@Component
public class LoggingAspect {
// @Before("allServiceMethods()")
// public void loggingAdvice() {
// System.out.println("Aspect inside the Logging Advice");
// }
//
// @Pointcut("within(com.stackroute.swisit.searchservice.SearchServiceInterface)")
// public void allServiceMethods(){
// }
// @Before("execution(* getAll())")
// public void loggingAspect(){
// System.out.println("Inside advice");
// }
@Before("execution(public String getTitle())")
public void onBean()
{
System.out.println("inside bean advice");
}
}
| [
"sriharini229@gmail.com"
] | sriharini229@gmail.com |
c3b2fa3f095b6cf021fdebaa326665858eb55d45 | 0434fcbd08add10c838082aa6344b9881c68491f | /src/PermutationSequence60.java | b85a125b07ef9ddb206c8bf11fef112e0fe5a71e | [] | no_license | SesameSeaweed/lc2017 | 114f5366988cbed2e8cf01606fd9bf4e4bef08c0 | 885d38586eecfaddb532e92f8efc23296216055c | refs/heads/master | 2021-01-25T04:34:50.370083 | 2017-09-25T21:59:21 | 2017-09-25T21:59:21 | 93,447,000 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 116 | java |
public class PermutationSequence60 {
public String getPermutation(int n, int k) {
return null;
}
}
| [
"pxu@akamai.com"
] | pxu@akamai.com |
dc4fbfe0e88b8080c7e54e8bd86136f9775ef14d | f13cfb521be62b01c2cde88770dd7f224f3e83af | /tree/Find Bottom Left Tree Value.java | 00ebf97e7b337348cda2d707711d6ef06a30e515 | [] | no_license | weiting4802/leetcode | b4f006da1f4154013dbb1140e9c069d1610352ff | b12ab8a80ee3471c1a11c721b68b47f1133ef03a | refs/heads/master | 2020-04-08T10:31:38.788079 | 2019-01-10T08:00:54 | 2019-01-10T08:00:54 | 159,272,482 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 343 | java |
Find Bottom Left Tree Value
public int findBottomLeftValue(TreeNode root) {
Queue<TreeNode> queue = new LinkedList<>();
queue.add(root);
while (!queue.isEmpty()) {
root = queue.poll();
if (root.right != null) queue.add(root.right);
if (root.left != null) queue.add(root.left);
}
return root.val;
} | [
"q983320@gmail.com"
] | q983320@gmail.com |
7800ae3b110f8ec61fb58bcd87d1625bff77e0ba | 14ebaeda3189bc6d1d5f81674c806f5c33b5ab70 | /src/main/java/com/qiqi/community/util/RedisKeyUtil.java | 72d468600c353564d620cfab80a6626aa9b9b97a | [] | no_license | ZLi0111/community | be6e89c5613ad5d2ab98bd87713608ea93767850 | 630e9ea7018b63174c40ca4a91c0f868a73bcedf | refs/heads/master | 2023-06-29T19:45:13.146094 | 2021-08-11T00:08:13 | 2021-08-11T00:08:13 | 277,160,212 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,227 | java | package com.qiqi.community.util;
public class RedisKeyUtil {
private static final String SPLIT = ":";
private static final String PREFIX_ENTITY_LIKE = "like:entity";
private static final String PREFIX_USER_LIKE = "like:user";
private static final String PREFIX_FOLLOWEE = "followee";
private static final String PREFIX_FOLLOWER = "follower";
// 某个实体的赞
// like:entity:entityType:entityId -> set(userId)
public static String getEntitylikeKey(int entityType, int entityId) {
return PREFIX_ENTITY_LIKE + SPLIT + entityType + SPLIT + entityId;
}
//某个用户的赞
public static String getUserLikeKey(int userId){
return PREFIX_USER_LIKE + SPLIT + userId;
}
// 某个用户关注的实体
//key: followee:userId:entityType -> zset(entityId, now)
public static String getFolloweeKey(int userId, int entityType) {
return PREFIX_FOLLOWEE + SPLIT + userId + SPLIT + entityType;
}
// 某个用户拥有的粉丝
//key: follower:entityType:entityId -> zset(userId, now)
public static String getFollowerKey(int entityType, int entityId) {
return PREFIX_FOLLOWER + SPLIT + entityType + SPLIT + entityId;
}
}
| [
"johnli.lzr@gmail.com"
] | johnli.lzr@gmail.com |
09b69db477439677cb25dca8b28e7ea59fc8c61c | c458fe10e1d8aef4c53d0f6e3cacaf7617ca4e9d | /AdvanceJava_ntaj114_Final/FilterApp4-SessionCheckingFilter/src/com/nt/filter/LoginSessionCheckFilter.java | a048dea5df6aabd20f8732c94d64aee86127c773 | [] | no_license | aakulasaikiran/AdvanceJava | 53c64c75eaf7f8581bcf8f067f828402c4a3a6a8 | b702d4295b93ae82748cc2ca6052841c794208e6 | refs/heads/master | 2020-03-23T17:50:39.602290 | 2018-07-22T08:45:02 | 2018-07-22T08:45:02 | 141,878,302 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,016 | java | package com.nt.filter;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
@WebFilter("/inboxurl")
public class LoginSessionCheckFilter implements Filter {
@Override
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
throws IOException,ServletException {
HttpSession ses=null;
RequestDispatcher rd=null;
//get Access to Sesson
ses=((HttpServletRequest)req).getSession(false);
if(ses==null || ses.getAttribute("userDetails")==null){
req.setAttribute("errMsg","Please Login to access InBox");
rd=req.getRequestDispatcher("/login.jsp");
rd.forward(req, res);
}
else{
chain.doFilter(req,res);
}//else
}//doFilter
}//filter
| [
"aakulasaikiran@gmail.com"
] | aakulasaikiran@gmail.com |
e35b0191b01bb848f956321db1233ec28d2693a9 | f96289f980808c76a28f28e97fc30c7d8c993ce7 | /src/test/java/io/webnostic/citydata/web/rest/ProfileInfoResourceIntTest.java | 086e0be30ddf98c67516d77b2a0fb23d68984ae5 | [] | no_license | webnostic/io-webnostic-citydata-gateway | d91623ff62a1afed53c427a2bb4d705b96c2f13d | 2aa56e262959978df643b5b8eb8c58bfa8d8b21f | refs/heads/master | 2020-03-22T06:53:47.251300 | 2018-07-04T03:40:45 | 2018-07-04T03:40:45 | 139,664,826 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,228 | java | package io.webnostic.citydata.web.rest;
import io.github.jhipster.config.JHipsterProperties;
import io.webnostic.citydata.CityDataApp;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.core.env.Environment;
import org.springframework.http.MediaType;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import static org.mockito.Mockito.when;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
/**
* Test class for the ProfileInfoResource REST controller.
*
* @see ProfileInfoResource
**/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = CityDataApp.class)
public class ProfileInfoResourceIntTest {
@Mock
private Environment environment;
@Mock
private JHipsterProperties jHipsterProperties;
private MockMvc restProfileMockMvc;
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
String mockProfile[] = { "test" };
JHipsterProperties.Ribbon ribbon = new JHipsterProperties.Ribbon();
ribbon.setDisplayOnActiveProfiles(mockProfile);
when(jHipsterProperties.getRibbon()).thenReturn(ribbon);
String activeProfiles[] = {"test"};
when(environment.getDefaultProfiles()).thenReturn(activeProfiles);
when(environment.getActiveProfiles()).thenReturn(activeProfiles);
ProfileInfoResource profileInfoResource = new ProfileInfoResource(environment, jHipsterProperties);
this.restProfileMockMvc = MockMvcBuilders
.standaloneSetup(profileInfoResource)
.build();
}
@Test
public void getProfileInfoWithRibbon() throws Exception {
restProfileMockMvc.perform(get("/api/profile-info"))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE));
}
@Test
public void getProfileInfoWithoutRibbon() throws Exception {
JHipsterProperties.Ribbon ribbon = new JHipsterProperties.Ribbon();
ribbon.setDisplayOnActiveProfiles(null);
when(jHipsterProperties.getRibbon()).thenReturn(ribbon);
restProfileMockMvc.perform(get("/api/profile-info"))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE));
}
@Test
public void getProfileInfoWithoutActiveProfiles() throws Exception {
String emptyProfile[] = {};
when(environment.getDefaultProfiles()).thenReturn(emptyProfile);
when(environment.getActiveProfiles()).thenReturn(emptyProfile);
restProfileMockMvc.perform(get("/api/profile-info"))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE));
}
}
| [
"majid.bastani@gmail.com"
] | majid.bastani@gmail.com |
eba51f7ab1657f76e59edec15edc29b1d6910f08 | 9c87467e95b5b65c4f8fd7832279b1af60804115 | /app/models/Measurement.java | 504e2dc2465741a827a6d2b6cdcee3fa26e9acf1 | [
"Apache-2.0"
] | permissive | RSSchermer/arden-cdss-mini | 065b98324b8784f33a2660e2613c6a73117071e9 | 8bdb972885a4ec4dda30a8e47ae186354ce2d118 | refs/heads/master | 2021-01-23T00:34:30.252356 | 2018-01-10T11:32:40 | 2018-01-10T11:32:40 | 92,820,836 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,217 | java | package models;
import javax.persistence.*;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
@Embeddable
public class Measurement {
@Column(name = "sMemoCode")
public String memoCode;
@Column(name = "iLabCode")
public String labCode;
@Column(name = "sDescription")
public String description;
@Column(name = "sDescriptionShort")
public String descriptionShort;
@Column(name = "sMVResult")
public String measuredValue;
@Column(name = "iLowLimit")
public String lowerLimitOfNormal;
@Column(name = "iHighLimit")
public String higherLimitOfNormal;
@Column(name = "sMaterial")
public String material;
@Column(name = "sReqDate")
private String dateRaw;
@Column(name = "bNotNormal")
public boolean abnormal;
public Date getDate() {
if (dateRaw == null) {
return null;
} else {
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
return dateFormat.parse(dateRaw);
} catch (ParseException e) {
return null;
}
}
}
}
| [
"roland0507@gmail.com"
] | roland0507@gmail.com |
53845e0709c61ff5a80d5344fe3879b4c821b324 | a2df6764e9f4350e0d9184efadb6c92c40d40212 | /aliyun-java-sdk-sofa/src/main/java/com/aliyuncs/sofa/model/v20190815/GetLinkeBahamutApprovaltaskscountResponse.java | 87b255028041847eba3f039e43bd3b9ec95cc078 | [
"Apache-2.0"
] | permissive | warriorsZXX/aliyun-openapi-java-sdk | 567840c4bdd438d43be6bd21edde86585cd6274a | f8fd2b81a5f2cd46b1e31974ff6a7afed111a245 | refs/heads/master | 2022-12-06T15:45:20.418475 | 2020-08-20T08:37:31 | 2020-08-26T06:17:49 | 290,450,773 | 1 | 0 | NOASSERTION | 2020-08-26T09:15:48 | 2020-08-26T09:15:47 | null | UTF-8 | Java | false | false | 2,921 | java | /*
* 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.aliyuncs.sofa.model.v20190815;
import com.aliyuncs.AcsResponse;
import com.aliyuncs.sofa.transform.v20190815.GetLinkeBahamutApprovaltaskscountResponseUnmarshaller;
import com.aliyuncs.transform.UnmarshallerContext;
/**
* @author auto create
* @version
*/
public class GetLinkeBahamutApprovaltaskscountResponse extends AcsResponse {
private String requestId;
private String resultCode;
private String resultMessage;
private String errorMessage;
private String errorMsgParamsMap;
private String message;
private Long responseStatusCode;
private Long result;
private Boolean success;
public String getRequestId() {
return this.requestId;
}
public void setRequestId(String requestId) {
this.requestId = requestId;
}
public String getResultCode() {
return this.resultCode;
}
public void setResultCode(String resultCode) {
this.resultCode = resultCode;
}
public String getResultMessage() {
return this.resultMessage;
}
public void setResultMessage(String resultMessage) {
this.resultMessage = resultMessage;
}
public String getErrorMessage() {
return this.errorMessage;
}
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
public String getErrorMsgParamsMap() {
return this.errorMsgParamsMap;
}
public void setErrorMsgParamsMap(String errorMsgParamsMap) {
this.errorMsgParamsMap = errorMsgParamsMap;
}
public String getMessage() {
return this.message;
}
public void setMessage(String message) {
this.message = message;
}
public Long getResponseStatusCode() {
return this.responseStatusCode;
}
public void setResponseStatusCode(Long responseStatusCode) {
this.responseStatusCode = responseStatusCode;
}
public Long getResult() {
return this.result;
}
public void setResult(Long result) {
this.result = result;
}
public Boolean getSuccess() {
return this.success;
}
public void setSuccess(Boolean success) {
this.success = success;
}
@Override
public GetLinkeBahamutApprovaltaskscountResponse getInstance(UnmarshallerContext context) {
return GetLinkeBahamutApprovaltaskscountResponseUnmarshaller.unmarshall(this, context);
}
@Override
public boolean checkShowJsonItemName() {
return false;
}
}
| [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
8554f9c61465a91632a0cfb9e5e58f132000683b | 6c47436401b5b82a7a24a94837e3a9fc71c9df7d | /src/main/java/com/spring/dao/CustomerDao.java | c405d9622e14ccfb6cb0ee134b191cb9a162b78a | [] | no_license | jnat51/Ticket-dev | cf84e100f3f7d4f92445ce1d744dcc6a71c0b8bb | 60db22bef02a9883d3d0fb216810b24f2a2bd00f | refs/heads/master | 2020-05-20T10:19:45.351771 | 2019-07-10T10:57:48 | 2019-07-10T10:57:48 | 185,522,528 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,647 | java | package com.spring.dao;
import java.util.ArrayList;
import java.util.List;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import com.spring.model.agent.AgentLogin;
import com.spring.model.agent.AgentWithImage;
import com.spring.model.customer.Customer;
import com.spring.model.customer.CustomerLogin;
import com.spring.model.customer.CustomerWithImage;
@Repository
@Transactional
public class CustomerDao extends ParentDao{
public void saveCustomer(Customer customer) {
super.entityManager.merge(customer);
}
public void deleteCustomer(Customer customer) {
super.entityManager.remove(customer);
}
public Customer findCustomerById(String id) {
try {
System.out.println("find customer by id");
String query = "from Customer where id = :id";
Customer customer = (Customer) super.entityManager
.createQuery(query)
.setParameter("id",id).getSingleResult();
return customer;
}
catch(Exception e)
{
return null;
}
}
public CustomerWithImage findByIdWithImage(String id)
{
try {
String query = "SELECT tbl_customer.*, tbl_image.image "
+ "FROM tbl_customer "
+ "JOIN tbl_image ON tbl_customer.image_id = tbl_image.id "
+ "WHERE tbl_customer.id = :id";
CustomerWithImage customer = (CustomerWithImage) super.entityManager
.createNativeQuery(query)
.setParameter("id",id).getResultList().get(0);
return customer;
}
catch(Exception e)
{
return null;
}
}
public Customer findCustomerByBk(String email) {
try {
System.out.println("find customer by bk");
String query = "from Customer where email = :email";
Customer customer = (Customer) super.entityManager
.createQuery(query)
.setParameter("email", email).getSingleResult();
return customer;
}
catch(Exception e)
{
return null;
}
}
public boolean isCustomerIdExist(String id)
{
if(findCustomerById(id) == null)
{
return false;
}
else
{
return true;
}
}
public boolean isCustomerEmailExist(String email)
{
if(findByEmail(email)==null)
{
return false;
}
else {
return true;
}
}
public boolean isCustomerBkExist(String username)
{
if(findCustomerByBk(username) == null)
{
return false;
}
else
{
return true;
}
}
public boolean passwordVerification(String password) {
try {
String query = "from Customer where password = :password";
Customer customer = (Customer) super.entityManager.createQuery(query).setParameter("password", password)
.getSingleResult();
if (customer.getId() == null) {
return true;
} else {
return false;
}
} catch (Exception e) {
System.out.println("Wrong password.");
return false;
}
}
public Customer findByEmail(String email) {
try {
String query = "from Customer WHERE email = :email";
Customer customer = (Customer) super.entityManager.createQuery(query).setParameter("email", email)
.getSingleResult();
return customer;
}
catch (Exception e) {
return null;
}
}
public CustomerWithImage findWithImage(String id)
{
try {
String query = "SELECT tbl_customer.id, tbl_customer.username, tbl_customer.password, tbl_customer.name, tbl_customer.company_id, tbl_customer.position, tbl_customer.email, tbl_customer.status, "
+ "tbl_image.image, "
+ "tbl_company.company_name, tbl_company.company_code " +
"FROM tbl_customer " +
"LEFT JOIN tbl_image ON tbl_customer.image_id = tbl_image.id " +
"JOIN tbl_company ON tbl_customer.company_id = tbl_company.id " +
"WHERE tbl_customer.username = :username";
CustomerWithImage customer = (CustomerWithImage) super.entityManager
.createNativeQuery(query)
.setParameter("id",id).getSingleResult();
return customer;
}
catch(Exception e)
{
return null;
}
}
public List<Customer> findAll (){
try {
String query = "from Customer";
List<Customer> customers = new ArrayList<Customer>();
customers = super.entityManager.createQuery(query).getResultList();
return customers;
}
catch (Exception e) {
return null;
}
}
public List<Customer> findAllWithStatus(String status){
try {
String query = "SELECT * FROM tbl_customer WHERE status = :status";
List<Customer> customers = new ArrayList<Customer>();
customers = super.entityManager.createNativeQuery(query, Customer.class)
.setParameter("status", status)
.getResultList();
return customers;
}catch(Exception e){
return null;
}
}
}
| [
"jnat51@ymail.com"
] | jnat51@ymail.com |
200ff2890233c237dcd82df00fd84ee22d0ba2c6 | 87d7b6d56f0379166af2cabf7ffe3eeab194de0b | /app/src/main/java/com/bhumika29/myapplication/NatashaFragment.java | 4963c43b3f8af4c48e379e689746f29dfecffa9b | [] | no_license | Bhumik29/natashacode2-master | 21cefb727127428426daeff3c1e72c6a348cdf0e | cda5fb36311db7ff62bb3aa35a1221f0082c2de7 | refs/heads/master | 2020-04-02T19:28:41.945034 | 2016-06-06T00:13:01 | 2016-06-06T00:13:01 | 60,487,254 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 663 | java | package com.bhumika29.myapplication;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* A simple {@link Fragment} subclass.
*/
public class NatashaFragment extends Fragment {
public NatashaFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_natasha, container, false);
}
}
| [
"natasha.nehra2001@gmail.com"
] | natasha.nehra2001@gmail.com |
afa924fa091d0f877c302114352e135e33fc61b2 | f2eafdf0d2423cf420dde190fba1bb71650edc5a | /app/src/main/java/com/jiage/battle/util/SDViewBinder.java | 175593deca680f88c8aad27f2f60c632efee4bfe | [] | no_license | XinJiaGe/Battle | 676f7c411578e72ea646ebe62aa0acbe18ca5791 | 16b427b1962a993d9dd1c40463ff9502bf55a3f7 | refs/heads/master | 2021-06-15T02:24:15.191588 | 2019-12-17T09:31:01 | 2019-12-17T09:31:01 | 148,568,854 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,655 | java | package com.jiage.battle.util;
import android.text.Html;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RatingBar;
import android.widget.TextView;
import com.jiage.battle.common.ImgConfig;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.listener.ImageLoadingListener;
import com.nostra13.universalimageloader.core.listener.ImageLoadingProgressListener;
import java.io.File;
public class SDViewBinder {
public static boolean mCanLoadImageFromUrl = true;
public static void setRatingBar(RatingBar ratingBar, float rating) {
ratingBar.setRating(rating);
}
public static void setTextView(TextView textView, CharSequence content, CharSequence emptyTip) {
if (!TextUtils.isEmpty(content)) {
textView.setText(content);
} else {
if (!TextUtils.isEmpty(emptyTip)) {
textView.setText(emptyTip);
} else {
textView.setText("");
}
}
}
public static void setTextView(TextView textView, CharSequence content) {
setTextView(textView, content, null);
}
public static void setTextView(EditText editText, CharSequence content) {
if (!TextUtils.isEmpty(content)) {
editText.setText(content);
} else {
editText.setText("");
}
}
public static void setTextViewHtml(TextView textView, String contentHtml) {
setTextViewHtml(textView, contentHtml, null);
}
public static void setTextViewHtml(TextView textView, String contentHtml, String emptyTip) {
CharSequence content = contentHtml;
if (!TextUtils.isEmpty(contentHtml)) {
content = Html.fromHtml(contentHtml);
}
setTextView(textView, content, emptyTip);
}
public static void setTextViewsVisibility(TextView textView, CharSequence content) {
if (TextUtils.isEmpty(content)) {
SDViewUtil.hide(textView);
} else {
textView.setText(content);
SDViewUtil.show(textView);
}
}
public static void setImageViewsVisibility(ImageView imageView, int resId) {
if (resId <= 0) {
SDViewUtil.hide(imageView);
} else {
imageView.setImageResource(resId);
SDViewUtil.show(imageView);
}
}
public static boolean setViewsVisibility(View view, boolean visible) {
if (visible) {
SDViewUtil.show(view);
} else {
SDViewUtil.hide(view);
}
return visible;
}
public static boolean setViewsVisibility(View view, int visible) {
if (visible == 1) {
SDViewUtil.show(view);
return true;
} else {
SDViewUtil.hide(view);
return false;
}
}
private static boolean canLoadImageFromUrl(String url) {
if (mCanLoadImageFromUrl)// 可以从url加载图片
{
return true;
} else {
File cache = ImageLoader.getInstance().getDiskCache().get(url);
if (cache != null && cache.exists() && cache.length() > 0) {
return true;
} else {
return false;
}
}
}
public static void setImageViewResource(ImageView imageView, int resId, boolean setZeroResId) {
if (resId == 0) {
if (setZeroResId) {
imageView.setImageResource(resId);
} else {
}
} else {
imageView.setImageResource(resId);
}
}
@Deprecated
public static void setImageView(ImageView imageView, String url) {
setImageView(url, imageView, ImgConfig.getPortraitLargeOption(), null, null);
}
public static void setImageView(String url, ImageView imageView) {
setImageView(url, imageView, ImgConfig.getPortraitLargeOption(), null, null);
}
public static void setImageView(String uri, ImageView imageView, DisplayImageOptions options) {
setImageView(uri, imageView, options, null, null);
}
public static void setImageView(String uri, ImageView imageView, ImageLoadingListener listener) {
setImageView(uri, imageView, ImgConfig.getPortraitLargeOption(), listener, null);
}
public static void setImageView(String uri, ImageView imageView, ImageLoadingProgressListener progressListener) {
setImageView(uri, imageView, ImgConfig.getPortraitLargeOption(), null, progressListener);
}
public static void setImageView(String uri, ImageView imageView, ImageLoadingListener listener, ImageLoadingProgressListener progressListener) {
setImageView(uri, imageView, ImgConfig.getPortraitLargeOption(), listener, progressListener);
}
public static void setImageView(String uri, ImageView imageView, DisplayImageOptions options, ImageLoadingListener listener) {
setImageView(uri, imageView, options, listener, null);
}
public static void setImageView(String uri, ImageView imageView, DisplayImageOptions options, ImageLoadingListener listener,
ImageLoadingProgressListener progressListener) {
if (!canLoadImageFromUrl(uri)) {
return;
}
try {
ImageLoader.getInstance().displayImage(uri, imageView, options, listener, progressListener);
} catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"347292753@qq.com"
] | 347292753@qq.com |
46ac6a3e3fd168a13a8e9b6c95d1894fca2a2d4a | b28dc86becbcbdfdcdf40228893c491f743a2b37 | /designPatterns/src/designPatterns/observer/Impressora.java | 7410d61409e1f52a672e6f944c68294d7a7d19f5 | [] | no_license | diogofvieira/ModelsDP | eda1bfff7951450043e3d0fbeee364623fd35eca | d2f83bcfbf29a02a2d35d67123c3427895417446 | refs/heads/master | 2020-03-27T08:13:05.690199 | 2018-09-01T03:14:13 | 2018-09-01T03:14:13 | 146,232,818 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 232 | java | package designPatterns.observer;
import designPatterns.methodchain.builder.NotaFiscal;
public class Impressora implements AcaoAposGerarNota{
public void executa(NotaFiscal nf){
System.out.println("Imprimi");
}
}
| [
"diogof_vieira@yahoo.com.br"
] | diogof_vieira@yahoo.com.br |
1f14fc8f545f5113fd831a258933485a302455f4 | 3557b30b7aac3740c5b3e74412953ef74f26d998 | /app/src/main/java/com/cyanbirds/tanlove/activity/MoneyOutputActivity.java | 918bc2a9d076e316e38e35e07849a2eb123d0a9a | [] | no_license | wybilold1999/TanProject | 55a5baced00563e5121b263cf88631025b22489d | e13919a0b1e0aaa7f942d9749d4dfd80863c40a6 | refs/heads/master | 2021-01-23T06:20:26.617070 | 2018-07-16T08:01:37 | 2018-07-16T08:01:37 | 86,355,833 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,586 | java | package com.cyanbirds.tanlove.activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import com.cyanbirds.tanlove.R;
import com.cyanbirds.tanlove.activity.base.BaseActivity;
import com.cyanbirds.tanlove.config.ValueKey;
import com.cyanbirds.tanlove.entity.OutputMoney;
import com.cyanbirds.tanlove.eventtype.SnackBarEvent;
import com.cyanbirds.tanlove.manager.AppManager;
import com.cyanbirds.tanlove.net.request.OutputMoneyRequest;
import com.cyanbirds.tanlove.utils.PreferencesUtils;
import com.cyanbirds.tanlove.utils.ProgressDialogUtils;
import com.cyanbirds.tanlove.utils.ToastUtil;
import org.greenrobot.eventbus.EventBus;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import mehdi.sakout.fancybuttons.FancyButton;
/**
* 作者:wangyb
* 时间:2017/9/9 11:39
* 描述:
*/
public class MoneyOutputActivity extends BaseActivity {
@BindView(R.id.edt_name)
EditText mEdtName;
@BindView(R.id.edt_bank)
EditText mEdtBank;
@BindView(R.id.edt_bank_no)
EditText mEdtBankNo;
@BindView(R.id.edt_money)
EditText mEdtMoney;
@BindView(R.id.btn_get)
FancyButton mBtnGet;
private float mMoneyCount;
private View mInputView;
private TextView mMoney;
private EditText mPwd;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_money_output);
ButterKnife.bind(this);
Toolbar toolbar = getActionBarToolbar();
if (toolbar != null) {
toolbar.setNavigationIcon(R.mipmap.ic_up);
}
setupData();
}
private void setupData() {
mMoneyCount = getIntent().getFloatExtra(ValueKey.DATA, 0);
}
@OnClick(R.id.btn_get)
public void onViewClicked() {
if (mMoneyCount <= 0 ) {
ToastUtil.showMessage(R.string.money_count_zero);
} else if (!AppManager.getClientUser().is_vip){
showVipDialog();
} else if (AppManager.getClientUser().gold_num < 101) {
showGoldDialog();
} else if (checkInput()) {
initDialogView();
showInputDialog();
}
}
/**
* 验证输入
*/
private boolean checkInput() {
String message = "";
boolean bool = true;
if (TextUtils.isEmpty(mEdtName.getText().toString())) {
message = getResources().getString(R.string.input_name);
bool = false;
} else if (TextUtils.isEmpty(mEdtBank.getText().toString())) {
message = getResources().getString(R.string.input_bank);
bool = false;
} else if (TextUtils.isEmpty(mEdtBankNo.getText().toString())) {
message = getResources().getString(R.string.input_bank_no);
bool = false;
} else if (TextUtils.isEmpty(mEdtMoney.getText().toString())) {
message = getResources().getString(R.string.input_output_money);
bool = false;
} else if (Double.parseDouble(mEdtMoney.getText().toString()) > mMoneyCount) {
message = getResources().getString(R.string.output_money_beyond);
bool = false;
}
if (!bool)
ToastUtil.showMessage(message);
return bool;
}
private void showInputDialog(){
mMoney.setText("¥" + mEdtMoney.getText().toString());
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setCancelable(false);
builder.setView(mInputView);
builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
if (mPwd.getText().toString().length() == 6) {
OutputMoney outputMoney = new OutputMoney();
outputMoney.nickname = mEdtName.getText().toString();
outputMoney.bank = mEdtBank.getText().toString();
outputMoney.bankNo = mEdtBankNo.getText().toString();
outputMoney.money = mEdtMoney.getText().toString();
outputMoney.pwd = mPwd.getText().toString();
new OutputMoneyTask().request(outputMoney);
ProgressDialogUtils.getInstance(MoneyOutputActivity.this).show(R.string.wait);
} else {
ToastUtil.showMessage("密码长度不够");
}
}
});
builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
builder.show();
}
private void initDialogView(){
mInputView = LayoutInflater.from(this).inflate(R.layout.dialog_input_pwd, null);
mMoney = (TextView) mInputView.findViewById(R.id.input_money_count);
mPwd = (EditText) mInputView.findViewById(R.id.input_pwd);
}
class OutputMoneyTask extends OutputMoneyRequest {
@Override
public void onPostExecute(String s) {
ToastUtil.showMessage(R.string.output_success);
ProgressDialogUtils.getInstance(MoneyOutputActivity.this).dismiss();
PreferencesUtils.setMyMoney(MoneyOutputActivity.this, mMoneyCount - Float.parseFloat(mEdtMoney.getText().toString()));
EventBus.getDefault().post(new SnackBarEvent());
finish();
}
@Override
public void onErrorExecute(String error) {
ProgressDialogUtils.getInstance(MoneyOutputActivity.this).dismiss();
ToastUtil.showMessage(R.string.output_faile);
}
}
private void showVipDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(R.string.output_money_vip);
builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
Intent intent = new Intent(MoneyOutputActivity.this, VipCenterActivity.class);
startActivity(intent);
}
});
builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
builder.show();
}
private void showGoldDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(R.string.output_money_gold);
builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
Intent intent = new Intent(MoneyOutputActivity.this, MyGoldActivity.class);
startActivity(intent);
}
});
builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
builder.show();
}
}
| [
"395044952@qq.com"
] | 395044952@qq.com |
03d9788d0855a13e26181355aa34656ee19b6852 | 6cea940eb52d6451791472150b294e3f163b31d8 | /src/process/Main.java | b92bb7f870fe09021b8fd8fe8ba9a90f8486db57 | [] | no_license | utpalchattoraj/oms | 63d7578a21d79068a88e832d77aa6952961c0a8a | 5d1cd2af659819a83a0117dbf8533b566f2d6027 | refs/heads/master | 2020-06-01T10:13:22.917321 | 2019-06-17T03:17:48 | 2019-06-17T03:17:48 | 190,744,257 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 179 | java | package process;
public class Main {
public static void main (String args[]) {
Server server = new Server();
server.init();
server.start();
}
}
| [
"chattorajutpal@gmail.com"
] | chattorajutpal@gmail.com |
071cf4abcea327975883ade1fa91870f86743fa9 | 8c8c3dd4b1bfd0382670f5ed1c91240437cd93a0 | /src/marketProviders/marketNavigator/MarketNavigator.java | d8d634619ee54043b1efdb339cdd8f00645f14d9 | [] | no_license | rjpg/JBet | 91980a4eeca5c4559f3f5e028529de0913a42a79 | 725f4ae883d44a166cea8d30efb822e793e53a85 | refs/heads/master | 2021-01-21T20:07:21.051319 | 2017-05-23T16:32:08 | 2017-05-23T16:32:08 | 92,192,559 | 0 | 0 | null | null | null | null | WINDOWS-1252 | Java | false | false | 7,079 | java | package marketProviders.marketNavigator;
import generated.exchange.BFExchangeServiceStub.Market;
import generated.global.BFGlobalServiceStub.BFEvent;
import generated.global.BFGlobalServiceStub.EventType;
import generated.global.BFGlobalServiceStub.GetEventsResp;
import generated.global.BFGlobalServiceStub.MarketSummary;
import java.awt.BorderLayout;
import java.util.Vector;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTree;
import javax.swing.event.TreeExpansionEvent;
import javax.swing.event.TreeExpansionListener;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.text.html.HTMLDocument.HTMLReader.IsindexAction;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreePath;
import bfapi.handler.ExchangeAPI;
import bfapi.handler.GlobalAPI;
import bfapi.handler.ExchangeAPI.Exchange;
import logienvironment.LoginEnvironment;
import main.Parameters;
import marketProviders.MarketProvider;
import marketProviders.MarketProviderListerner;
import DataRepository.MarketData;
import GUI.MarketMainFrame;
import demo.util.APIContext;
public class MarketNavigator extends MarketProvider {
private APIContext apiContext=null;
private Exchange selectedExchange=null;
private JTree tree=null;
private JPanel panel =null;
private Market selectedMarket=null;
private Vector<MarketProviderListerner> listeners=new Vector<MarketProviderListerner>();
public JPanel getPanel() {
return panel;
}
public MarketNavigator(APIContext apiC, Exchange selectedExchangeA) {
apiContext=apiC;
selectedExchange=selectedExchangeA;
initialize();
}
public MarketNavigator(LoginEnvironment loginEnv) {
this(loginEnv.getApiContext(),loginEnv.getSelectedExchange());
}
private void initialize()
{
panel=new JPanel();
panel.setLayout(new BorderLayout());
DefaultMutableTreeNode dmtn=new DefaultMutableTreeNode("Event Types");
tree=new JTree(dmtn);
tree.addTreeExpansionListener(new TreeExpansionListener() {
@Override
public void treeExpanded(TreeExpansionEvent arg0) {
DefaultMutableTreeNode node=(DefaultMutableTreeNode) arg0.getPath().getPathComponent(arg0.getPath().getPathCount()-1);
System.out.println(node.getUserObject());
if(node.getUserObject() instanceof EventTypeObj)
{
GetEventsResp respin=null;
try {
respin=GlobalAPI.getEvents(apiContext, ((EventTypeObj)node.getUserObject()).eventType.getId());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if(respin== null)
return ;
node.removeAllChildren();
fillTree(respin, node);
tree.repaint();
return;
}
if(node.getUserObject() instanceof EventObj)
{
System.out.println("passei aqui ");
GetEventsResp respin=null;
try {
respin=GlobalAPI.getEvents(apiContext, ((EventObj)node.getUserObject()).event.getEventId());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if(respin== null)
return ;
node.removeAllChildren();
fillTree(respin, node);
tree.repaint();
return;
}
}
@Override
public void treeCollapsed(TreeExpansionEvent arg0) {
// TODO Auto-generated method stub
}
});
tree.addTreeSelectionListener(new TreeSelectionListener() {
@Override
public void valueChanged(TreeSelectionEvent arg) {
DefaultMutableTreeNode node=(DefaultMutableTreeNode) arg.getPath().getPathComponent(arg.getPath().getPathCount()-1);
if(node.getUserObject() instanceof MarketObj)
{
System.out.println("passei aqui é market");
Market m=null;
try {
m = ExchangeAPI.getMarket(selectedExchange, apiContext, ((MarketObj)node.getUserObject()).market.getMarketId());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if(m==null)
return;
if(selectedMarket!=null && m.getMarketId()==selectedMarket.getMarketId())
return;
selectedMarket=m;
warnListeners();
return;
}
}
});
EventType et[]=null;
try {
et=GlobalAPI.getActiveEventTypes(apiContext);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if(et!=null)
{
for(EventType evettype:et)
{
GetEventsResp respin=null;
try {
respin=GlobalAPI.getEvents(apiContext, evettype.getId());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
DefaultMutableTreeNode node=new DefaultMutableTreeNode(new EventTypeObj(evettype));
node.setAllowsChildren(true);
node.add(new DefaultMutableTreeNode());
dmtn.add(node);
//fillTree(respin, node);
}
}
tree.expandPath(new TreePath(dmtn.getPath()));
panel.add(tree,BorderLayout.CENTER);
}
private void fillTree(GetEventsResp resp,DefaultMutableTreeNode dmtn)
{
if(resp==null)
return;
BFEvent eventsArray[]=resp.getEventItems().getBFEvent();
if(eventsArray!=null)
{
for(BFEvent bfe:eventsArray)
{
DefaultMutableTreeNode d=new DefaultMutableTreeNode(new EventObj(bfe));
if(!bfe.getEventName().equals("Coupons"))
{
d.add(new DefaultMutableTreeNode());
System.out.println(d);
DefaultTreeModel model = (DefaultTreeModel) tree.getModel();
model.insertNodeInto(d, dmtn, dmtn.getChildCount());
model.reload(dmtn);
}
}
}
MarketSummary markets[]=resp.getMarketItems().getMarketSummary();
if(markets!=null)
{
for(MarketSummary m:markets)
{
DefaultMutableTreeNode d=new DefaultMutableTreeNode(new MarketObj(m));
DefaultTreeModel model = (DefaultTreeModel) tree.getModel();
model.insertNodeInto(d, dmtn, dmtn.getChildCount());
model.reload(dmtn);
}
}
}
public static void main(String[] args) throws Exception {
}
@Override
public void addMarketProviderListener(MarketProviderListerner mpl) {
listeners.add(mpl);
}
@Override
public void removeMarketProviderListener(MarketProviderListerner mpl) {
listeners.remove(mpl);
}
private void warnListeners()
{
if(selectedMarket==null) return;
for(MarketProviderListerner mpl:listeners)
mpl.newMarketSelected(this, selectedMarket);
}
@Override
public Market getCurrentSelectedMarket() {
return selectedMarket;
}
@Override
public Vector<Market> getCurrentSelectedMarkets() {
return null;
}
}
| [
"birinhos@93810a56-b664-4e73-961e-a365e8ead931"
] | birinhos@93810a56-b664-4e73-961e-a365e8ead931 |
fbc0a65c7fcf0b9028376f0abae5c82b476fb2ff | 53fa58d4406363f4a85021f0de18638171ed8b4f | /app/src/main/java/com/example/ashish/playbuddy/News.java | 9bf4235f82c81b38f226a502df1c466c17c88804 | [] | no_license | vikash18086/Play_Buddy-An_Android_App- | 98740f6519d6eed7620aa2ff45223e00dba77474 | 3bd397c55e454df7fbceabd3aacac4111e7f73b9 | refs/heads/master | 2020-11-27T01:28:34.923604 | 2019-12-20T12:15:48 | 2019-12-20T12:15:48 | 229,256,746 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,306 | java | package com.example.ashish.playbuddy;
import java.util.Date;
public class News {
private String newsId;
private String newsTitle;
private String newsDescription;
private Date newsDate;
public String sportId;
public News()
{
}
public News(String newsTitle, String newsDescription,Date newsDate, String sportId) {
this.newsTitle = newsTitle;
this.newsDescription = newsDescription;
this.newsDate=newsDate;
this.sportId=sportId;
}
public String getNewsId() {
return newsId;
}
public void setNewsId(String newsId) {
this.newsId = newsId;
}
public String getNewsTitle() {
return newsTitle;
}
public void setNewsTitle(String newsTitle) {
this.newsTitle = newsTitle;
}
public String getNewsDescription() {
return newsDescription;
}
public void setNewsDescription(String newsDescription) {
this.newsDescription = newsDescription;
}
public Date getNewsDate() {
return newsDate;
}
public void setNewsDate(Date newsDate) {
this.newsDate = newsDate;
}
public String getSportId() {
return sportId;
}
public void setSportId(String sportId) {
this.sportId = sportId;
}
}
| [
"vikascsepndey@gmail.com"
] | vikascsepndey@gmail.com |
5244e0186e79e2e0e99cd8400fb28b441b76ff46 | 8f600447ff0902e8bb4041e74e15f079b8975924 | /team_lg/src/main/java/electronic_library/core/database/reader/OrmReaderRepositoryImpl.java | 4e98fed654734d1a0e4374fa2ff49dba150b5705 | [] | no_license | olegs-volaks/java2_thursday_online_2020_autumn | befdadb84c9a4413b06a0db459572ca84136cd9c | cf1b9d65cd4174e9fc7ea8585408913be5c580fe | refs/heads/master | 2023-04-07T20:05:30.228298 | 2021-04-17T18:08:07 | 2021-04-17T18:08:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,044 | java | package electronic_library.core.database.reader;
import electronic_library.core.domain.Book;
import electronic_library.core.domain.Reader;
import org.hibernate.SessionFactory;
import org.hibernate.query.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Profile;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.stereotype.Component;
import javax.transaction.Transactional;
import java.util.List;
import java.util.Optional;
@Component
@Profile("orm")
@Transactional
public class OrmReaderRepositoryImpl implements ReaderRepository {
@Autowired
private SessionFactory sessionFactory;
@Override
public void saveReader(Reader reader) {
sessionFactory.getCurrentSession().save(reader);
}
@Override
public boolean deleteReader(Reader reader) {
Query query = sessionFactory.getCurrentSession().createQuery(
"DELETE Reader where readerFirstName = : readerFirstName AND readerLastName = : readerLastName AND readerPersonalCode = : readerPersonalCode");
query.setParameter("readerFirstName", reader.getReaderFirstName());
query.setParameter("readerLastName", reader.getReaderLastName());
query.setParameter("readerPersonalCode", reader.getReaderPersonalCode());
return query.executeUpdate() > 0;
}
@Override
public boolean deleteReaderById(Long id) {
Query query = sessionFactory.getCurrentSession().createQuery(
"DELETE Reader WHERE id = :id");
query.setParameter("id", id);
int result = query.executeUpdate();
return result == 1;
}
@Override
public boolean deleteReaderByFirstName(String readerFirstName) {
Query query = sessionFactory.getCurrentSession().createQuery(
"DELETE Reader WHERE readerFirstName = :readerFirstName");
query.setParameter("readerFirstName", readerFirstName);
int result = query.executeUpdate();
return result > 0;
}
@Override
public boolean deleteReaderByLastName(String readerLastName) {
Query query = sessionFactory.getCurrentSession().createQuery(
"DELETE Reader WHERE readerLastName = :readerLastName");
query.setParameter("readerLastName", readerLastName);
int result = query.executeUpdate();
return result > 0;
}
@Override
public Optional<Reader> findReaderById(Long id) {
try {
Reader reader = sessionFactory.getCurrentSession().find(Reader.class, id);
return Optional.ofNullable(reader);
} catch (EmptyResultDataAccessException e) {
return Optional.empty();
}
}
@Override
public List<Reader> findReaderByFirstName(String readerFirstName) {
Query query = sessionFactory.getCurrentSession().createQuery(
"SELECT r FROM Reader r WHERE readerFirstName = :readerFirstName");
query.setParameter("readerFirstName", readerFirstName);
return query.getResultList();
}
@Override
public List<Reader> findReaderByLastName(String readerLastName) {
Query query = sessionFactory.getCurrentSession().createQuery(
"SELECT r FROM Reader r WHERE readerLastName = :readerLastName");
query.setParameter("readerLastName", readerLastName);
return query.getResultList();
}
@Override
public List<Reader> findReaderByPersonalCode(String readerPersonalCode) {
Query query = sessionFactory.getCurrentSession().createQuery(
"SELECT r FROM Reader r WHERE readerPersonalCode = :readerPersonalCode");
query.setParameter("readerPersonalCode", readerPersonalCode);
return query.getResultList();
}
@Override
public List<Reader> findByFirstNameAndLastName(String readerFirstName, String readerLastName) {
Query query = sessionFactory.getCurrentSession().createQuery(
"SELECT r FROM Reader r WHERE readerFirstName = :readerFirstName AND readerLastName = :readerLastName");
query.setParameter("readerFirstName", readerFirstName);
query.setParameter("readerLastName", readerLastName);
return query.getResultList();
}
@Override
public List<Reader> getReaders() {
return sessionFactory.getCurrentSession().getSession().createQuery("FROM Reader").list();
}
@Override
public boolean containsReader(Reader reader) {
Query query = sessionFactory.getCurrentSession().createQuery(
"SELECT r FROM Reader r where readerFirstName = : readerFirstName AND readerLastName = : readerLastName AND readerPersonalCode = : readerPersonalCode");
query.setParameter("readerFirstName", reader.getReaderFirstName());
query.setParameter("readerLastName", reader.getReaderLastName());
query.setParameter("readerPersonalCode", reader.getReaderPersonalCode());
return query.getResultList().size() > 0;
}
}
| [
"lgj@inbox.lv"
] | lgj@inbox.lv |
58b96a9c9388c006ec678af722c4037e8b5aa3db | 971b612ebce77d352a2572e239bb16663503a1eb | /tests/com/bartek/LargestDifferenceTest.java | 540d956b8be0898e66eeab9c22701ee14cfd1562 | [] | no_license | bkraszewski/CodeWars | b6842572254e821fd3ce092a7dc654f8788c9e25 | eb53b910b20221c51d07e93da109bac1c1ef8564 | refs/heads/master | 2021-01-10T14:19:07.900103 | 2017-03-21T18:19:50 | 2017-03-21T18:19:50 | 52,994,243 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 431 | java | package com.bartek;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
/**
* Created by bartek on 12/12/16.
*/
public class LargestDifferenceTest {
@Test
public void test1() {
assertEquals(4, LargestDifference.largestDifference(new int[]{9,4,1,10,3,4,0,-1,-2}));
}
@Test
public void test2(){
assertEquals(0, LargestDifference.largestDifference(new int[]{3,2,1}));
}
}
| [
"bkraszewski@gmail.com"
] | bkraszewski@gmail.com |
beea86e7b048ad9b9fa37fd4f0d85b3b5fe13198 | 9be251dc812f27fae16a58860bef5929ea012ba2 | /src/main/java/com/se/datex2/schema/SpeedPercentile.java | 90860a85b6f22c3e82fa4926016965fe781758e1 | [] | no_license | Bralabee/DATEXIIToolkitJava | 6c31f64b93780063a02c9c1a2cb70bb938d7ebba | b63723e546e9cab924a24ff7b028436f55249993 | refs/heads/master | 2021-12-08T14:52:22.462476 | 2016-03-23T11:47:20 | 2016-03-23T11:47:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,514 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2015.11.30 at 10:48:06 AM GMT
//
package com.se.datex2.schema;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* Details of percentage (from an observation set) of vehicles whose speeds fall below a stated value.
*
* <p>Java class for SpeedPercentile complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="SpeedPercentile">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="vehiclePercentage" type="{http://datex2.eu/schema/2/2_0}PercentageValue"/>
* <element name="speedPercentile" type="{http://datex2.eu/schema/2/2_0}SpeedValue"/>
* <element name="speedPercentileExtension" type="{http://datex2.eu/schema/2/2_0}_ExtensionType" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SpeedPercentile", propOrder = {
"vehiclePercentage",
"speedPercentile",
"speedPercentileExtension"
})
public class SpeedPercentile {
@XmlElement(required = true)
protected PercentageValue vehiclePercentage;
@XmlElement(required = true)
protected SpeedValue speedPercentile;
protected ExtensionType speedPercentileExtension;
/**
* Gets the value of the vehiclePercentage property.
*
* @return
* possible object is
* {@link PercentageValue }
*
*/
public PercentageValue getVehiclePercentage() {
return vehiclePercentage;
}
/**
* Sets the value of the vehiclePercentage property.
*
* @param value
* allowed object is
* {@link PercentageValue }
*
*/
public void setVehiclePercentage(PercentageValue value) {
this.vehiclePercentage = value;
}
/**
* Gets the value of the speedPercentile property.
*
* @return
* possible object is
* {@link SpeedValue }
*
*/
public SpeedValue getSpeedPercentile() {
return speedPercentile;
}
/**
* Sets the value of the speedPercentile property.
*
* @param value
* allowed object is
* {@link SpeedValue }
*
*/
public void setSpeedPercentile(SpeedValue value) {
this.speedPercentile = value;
}
/**
* Gets the value of the speedPercentileExtension property.
*
* @return
* possible object is
* {@link ExtensionType }
*
*/
public ExtensionType getSpeedPercentileExtension() {
return speedPercentileExtension;
}
/**
* Sets the value of the speedPercentileExtension property.
*
* @param value
* allowed object is
* {@link ExtensionType }
*
*/
public void setSpeedPercentileExtension(ExtensionType value) {
this.speedPercentileExtension = value;
}
}
| [
"samuel.roberts@saturneclipse.com"
] | samuel.roberts@saturneclipse.com |
403fd14ac12b558bdde03e49efc1a94421ef9d66 | c68b74465e69debaeda99fc372d645fd894cd20b | /src/main/java/edu/cmu/andrew/karim/server/models/Booking.java | dd62d6fc41c55bcd091fab3d13b8fc457a1342d0 | [] | no_license | soleefede/KidzActivity | a7764f1a0c7ead197bdee31c07d0da9da4da418d | c4009881db18d83f6b257df6b38509c1b554cbc3 | refs/heads/master | 2020-08-24T20:23:05.310920 | 2019-12-04T07:05:14 | 2019-12-04T07:05:14 | 216,898,768 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,589 | java | package edu.cmu.andrew.karim.server.models;
public class Booking {
String bookingId;
String bookingDate;
String parentId;
String activityId;
String paymentId;
String availabilityId;
int noOfSeats;
String kidName;
String bookingStatus;
String confirmStatus;
public Booking(String bookingId, String bookingDate,String parentId, String activityId,
String availabilityId,String paymentId, int noOfSeats, String kidName, String bookingStatus,
String confirmStatus) {
this.bookingId = bookingId;
this.bookingDate = bookingDate;
this.parentId = parentId;
this.activityId = activityId;
this.paymentId = paymentId;
this.availabilityId = availabilityId;
this.noOfSeats = noOfSeats;
this.kidName = kidName;
this.bookingStatus = bookingStatus;
this.confirmStatus = confirmStatus;
}
public String getBookingId() {
return bookingId;
}
public void setBookingId(String bookingId) {
this.bookingId = bookingId;
}
public String getParentId() {
return parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
public String getActivityId() {
return activityId;
}
public void setActivityId(String activityId) {
this.activityId = activityId;
}
public String getPaymentId() {
return paymentId;
}
public void setPaymentId(String paymentId) {
this.paymentId = paymentId;
}
public String getAvailabilityId() {
return availabilityId;
}
public void setAvailabilityId(String availabilityId) {
this.availabilityId = availabilityId;
}
public int getNoOfSeats() {
return noOfSeats;
}
public void setNoOfSeats(int noOfSeats) {
this.noOfSeats = noOfSeats;
}
public String getKidName() {
return kidName;
}
public void setKidName(String kidName) {
this.kidName = kidName;
}
public String getBookingStatus() {
return bookingStatus;
}
public void setBookingStatus(String bookingStatus) {
this.bookingStatus = bookingStatus;
}
public String getConfirmStatus() {
return confirmStatus;
}
public void setConfirmStatus(String confirmStatus) {
this.confirmStatus = confirmStatus;
}
public void setBookingDate(String bookingDate) { this.bookingDate = bookingDate; }
public String getBookingDate() { return bookingDate; }
}
| [
"apoulose@gmail.com"
] | apoulose@gmail.com |
3fba2f8a55a792d79b6a3fcc8df8d42847131ede | 29a96add18ad8e8e647187021712c8309d0c88da | /app/src/main/java/com/hongplayer/util/CommonUtil.java | c5b6e6ffb301ac7623e0240dc85d33f0e32ee6d2 | [] | no_license | hong890823/HongPlayer | c2c16989b75db491868093703e7ff7ea14454da9 | a9ebe5af04e9d370dc241574e38ba06895b11aa5 | refs/heads/master | 2021-06-29T17:19:07.219564 | 2020-12-16T11:30:23 | 2020-12-16T11:30:23 | 195,746,454 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,541 | java | package com.hongplayer.util;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Rect;
import android.net.Uri;
import android.os.Environment;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.lang.reflect.Field;
public class CommonUtil {
public static int getStatusHeight(Activity activity) {
int statusBarHeight = 0;
try {
Class<?> c = Class.forName("com.android.internal.R$dimen");
Object o = c.newInstance();
Field field = c.getField("status_bar_height");
int x = (Integer) field.get(o);
statusBarHeight = activity.getResources().getDimensionPixelSize(x);
} catch (Exception e) {
e.printStackTrace();
Rect frame = new Rect();
activity.getWindow().getDecorView().getWindowVisibleDisplayFrame(frame);
statusBarHeight = frame.top;
}
return statusBarHeight;
}
private static int sp2px(Context context, float spValue) {
final float fontScale = context.getResources().getDisplayMetrics().scaledDensity;
return (int) (spValue * fontScale + 0.5f);
}
public static int dip2px(Context context, float dipValue) {
final float scale = context.getResources().getDisplayMetrics().density;
return (int) (dipValue * scale + 0.5f);
}
public static boolean saveImage(Context context, Bitmap bmp) {
// 首先保存图片
String storePath = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "wlplayer";
File appDir = new File(storePath);
if (!appDir.exists()) {
appDir.mkdirs();
}
String fileName = System.currentTimeMillis() + ".jpg";
File file = new File(appDir, fileName);
try {
FileOutputStream fos = new FileOutputStream(file);
//通过io流的方式来压缩保存图片
boolean isSuccess = bmp.compress(Bitmap.CompressFormat.JPEG, 100, fos);
fos.flush();
fos.close();
Uri uri = Uri.fromFile(file);
context.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, uri));
if (isSuccess) {
return true;
} else {
return false;
}
} catch (IOException e) {
e.printStackTrace();
}
return false;
}
}
| [
"lixh0870@zzstworld.com"
] | lixh0870@zzstworld.com |
00b7554736ea1d080f184123a87d08fb21536fbb | f29a0f6de5c3c7c00513eb49d42d47023df87ca2 | /DesignPatterns/src/main/java/com/dp/DesignPatterns/factory/Coffee.java | d8018805c4442acc8af25dff733557a74287aa53 | [] | no_license | Yuvraj2300/DesignPatterns | dfda1239dd161aa39517360d66d5b04247526a5e | 3dd77dab8919959d851861c3aab98d9c74d0d416 | refs/heads/master | 2020-03-22T01:41:49.024810 | 2018-08-29T08:10:08 | 2018-08-29T08:10:08 | 139,323,599 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 139 | java | package com.dp.DesignPatterns.factory;
public class Coffee implements Drink {
Coffee(){
System.out.println("Drink's a Coffee!!");
}
}
| [
"ysharma@localhost.localdomain"
] | ysharma@localhost.localdomain |
ded04b40fac252df413357ced4e415ebf56b8fec | 217ec851d58641283b34cb6034ae5290f3dde69d | /ManuVastra/app/src/main/java/com/manuvastra/BaseActivity.java | f1dbbef1861b67edee8023b10c2582d1daa75fd6 | [] | no_license | sriramprasad4u/shopping | 881aa345cc1acf8228917b3fd21177c747ab8d18 | 299717848ae70b5db71391040d468bcee71ecdb0 | refs/heads/master | 2021-04-09T11:52:27.064235 | 2018-03-24T08:50:13 | 2018-03-24T08:50:13 | 124,729,865 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 859 | java | package com.manuvastra;
import android.app.ProgressDialog;
import android.support.annotation.VisibleForTesting;
import android.support.v7.app.AppCompatActivity;
public class BaseActivity extends AppCompatActivity {
@VisibleForTesting
public ProgressDialog mProgressDialog;
public void showProgressDialog() {
if (mProgressDialog == null) {
mProgressDialog = new ProgressDialog(this);
mProgressDialog.setMessage(getString(R.string.loading));
mProgressDialog.setIndeterminate(true);
}
mProgressDialog.show();
}
public void hideProgressDialog() {
if (mProgressDialog != null && mProgressDialog.isShowing()) {
mProgressDialog.dismiss();
}
}
@Override
public void onStop() {
super.onStop();
hideProgressDialog();
}
}
| [
"sriramprasadsadineni1@gmail.com"
] | sriramprasadsadineni1@gmail.com |
7fcd4a924c236e5fbbfe03e29fdb0a761e1c6e6e | 8403dd9e5dee140b36338a86d1fae8c99f9366e3 | /cloud-api-commons/src/main/java/com/enjoy/springcloud/result/ResultCodeEnum.java | 159ae90e5f160d5c36989091c4542d07f06da0d3 | [] | no_license | liuruinian/cloud2021 | 87d46c1ee7dba002476e3c079a5f45c723cf8329 | 1fc7deebf04ef531306a7ea7e71ae4065c3b91cb | refs/heads/master | 2023-04-27T04:25:35.674901 | 2021-05-10T14:51:32 | 2021-05-10T14:51:32 | 361,782,041 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,617 | java | package com.enjoy.springcloud.result;
import lombok.Getter;
/**
* 统一返回结果状态信息类
*/
@Getter
public enum ResultCodeEnum {
SUCCESS(200,"成功"),
FAIL(201, "失败"),
PARAM_ERROR( 202, "参数不正确"),
SERVICE_ERROR(203, "服务异常"),
DATA_ERROR(204, "数据异常"),
DATA_UPDATE_ERROR(205, "数据版本异常"),
LOGIN_AUTH(208, "未登陆"),
PERMISSION(209, "没有权限"),
CODE_ERROR(210, "验证码错误"),
// LOGIN_MOBLE_ERROR(211, "账号不正确"),
LOGIN_DISABLED_ERROR(212, "改用户已被禁用"),
REGISTER_MOBLE_ERROR(213, "手机号已被使用"),
LOGIN_AURH(214, "需要登录"),
LOGIN_ACL(215, "没有权限"),
URL_ENCODE_ERROR( 216, "URL编码失败"),
ILLEGAL_CALLBACK_REQUEST_ERROR( 217, "非法回调请求"),
FETCH_ACCESSTOKEN_FAILD( 218, "获取accessToken失败"),
FETCH_USERINFO_ERROR( 219, "获取用户信息失败"),
//LOGIN_ERROR( 23005, "登录失败"),
PAY_RUN(220, "支付中"),
CANCEL_ORDER_FAIL(225, "取消订单失败"),
CANCEL_ORDER_NO(225, "不能取消预约"),
HOSCODE_EXIST(230, "医院编号已经存在"),
NUMBER_NO(240, "可预约号不足"),
TIME_NO(250, "当前时间不可以预约"),
SIGN_ERROR(300, "签名错误"),
HOSPITAL_OPEN(310, "医院未开通,暂时不能访问"),
HOSPITAL_LOCK(320, "医院被锁定,暂时不能访问"),
;
private Integer code;
private String message;
private ResultCodeEnum(Integer code, String message) {
this.code = code;
this.message = message;
}
}
| [
"1394329227@qq.com"
] | 1394329227@qq.com |
97a3a38aec907572954af972849f72798feb5011 | 6d07cbd75cc72c1b9bfb447dc20f2af09b360f94 | /src/java/com/udea/ejb/ClientesFacade.java | 42856300ccd977423af1ff197fbbf1ca18f2b9b9 | [] | no_license | zulu-bot/concesionario | 9d2ff91ae283c659fa6773aeceec44c06e48ad6f | 8da42a6d3093b149450301f73f0ae99c578c7313 | refs/heads/master | 2020-06-14T06:30:34.055284 | 2019-07-12T12:02:08 | 2019-07-12T12:02:08 | 194,934,184 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 768 | 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.udea.ejb;
import com.udea.entity.Clientes;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
/**
*
* @author hp
*/
@Stateless
public class ClientesFacade extends AbstractFacade<Clientes> implements ClientesFacadeLocal {
@PersistenceContext(unitName = "concesionarioArPU")
private EntityManager em;
@Override
protected EntityManager getEntityManager() {
return em;
}
public ClientesFacade() {
super(Clientes.class);
}
}
| [
"judazr@gmail.com"
] | judazr@gmail.com |
4cbe9bc7d10ae57c27528cb3bfe070c92b14c436 | 73ff56ced06b6e4d59c16d98fd13225328a56cd6 | /app/src/main/java/com/example/sidemenusakura/FoodDeliveryManagement/SingleDeliveryDetails.java | 9492ecbed97a923a1a224973604d06617366ed99 | [] | no_license | PasinduPerera10/MAD-Project-App-Runners | 6559832b03394a0414c14aaaceb55251056ade48 | 0d38c2ab01205ae9c551d8c9215812fb2dac2539 | refs/heads/master | 2023-08-25T18:05:24.209341 | 2021-09-26T10:17:21 | 2021-09-26T10:17:21 | 409,798,650 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 428 | java | package com.example.sidemenusakura.FoodDeliveryManagement;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import com.example.sidemenusakura.R;
public class SingleDeliveryDetails extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_single_delivery_details);
}
} | [
"pasinduperera9910@gmail.com"
] | pasinduperera9910@gmail.com |
f8ccf17dd529d521f4b0ad08c57f20a9e8ddc7ac | fb70889b57e35d8c560c02acb2f518d3435c4aa1 | /app/src/main/java/com/cdc/plugin/download/DownloadReceiver.java | 49714be1660a3476620a17b009ba68043f2eff12 | [] | no_license | ellen2212/webapp-android | bdbffc235e38b5e36110f6f0462f86e72ba33c69 | 62ddbd2632dab14f6cea2efd3da529b08712955b | refs/heads/master | 2021-06-13T05:45:40.873095 | 2017-03-17T07:35:53 | 2017-03-17T07:35:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,333 | java | package com.cdc.plugin.download;
import android.app.DownloadManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
/**
* 下载监听
*/
public class DownloadReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Bundle bundle = intent.getExtras();
long downId = bundle.getLong(DownloadManager.EXTRA_DOWNLOAD_ID, 0);
DownloadManager downloadManager = (DownloadManager) context
.getSystemService(Context.DOWNLOAD_SERVICE);
Uri fileUri = downloadManager.getUriForDownloadedFile(downId);
if (intent.getAction().equals(DownloadManager.ACTION_DOWNLOAD_COMPLETE)) {
// installApk(context, fileUri);
} else if (intent.getAction().equals(DownloadManager.ACTION_NOTIFICATION_CLICKED)) {
// installApk(context, fileUri);
}
}
//安装apk
private void installApk(Context context, Uri fileUri) {
Intent intent = new Intent();
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(fileUri, "application/vnd.android.package-archive");
context.startActivity(intent);
}
}
| [
"ainianyu854362212@163.com"
] | ainianyu854362212@163.com |
e32e1c11fb771e36ee5a4fa5dd4550f3858467df | 13c82eeb3d6caaa31d88b52429ea4239f54f30cd | /chap004/src/main/java/thisisjava/chap16_stream/sec12/_parallelism/MaleStudentExample.java | 6048634b53f2d7a46fbb9793dd8964ce22148db9 | [] | no_license | nekisse-lee/java_study | 9d8c3735cc02c66a2c66210c4e3859727fee860c | b661a3b22e61e90f9134bc3d1229954c5672f024 | refs/heads/master | 2020-05-22T13:59:48.844596 | 2019-08-04T08:18:06 | 2019-08-04T08:18:06 | 186,373,107 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 929 | java | package thisisjava.chap16_stream.sec12._parallelism;
import java.util.Arrays;
import java.util.List;
@SuppressWarnings("ALL")
public class MaleStudentExample {
public static void main(String[] args) {
List<Student> totalList = Arrays.asList(
new Student("홍길동", 10, Student.Sex.MALE),
new Student("김수애", 6, Student.Sex.FEMALE),
new Student("신용권", 10, Student.Sex.MALE),
new Student("박수미", 6, Student.Sex.FEMALE)
);
MaleStudent maleStudent = totalList.parallelStream()
.filter(student -> student.getSex() == Student.Sex.MALE)
.collect(
() -> new MaleStudent(),
(r, t) -> r.accumulate(t),
(r1, r2) -> r1.combine(r2)
);
maleStudent.getList().stream()
.forEach(student -> System.out.println(student.getName()));
}
}
| [
"lsh891224@gmail.com"
] | lsh891224@gmail.com |
3cb2f60c34ff75a670bca71964ed9ef958b4849f | dde30e949aedb909d6ac1c91674414451c613120 | /src/com/iv/logView/ui/SplashScreen.java | 6a7d67d62c9be1f98948927964a40a7460dcdb22 | [] | no_license | mpashka/logdigger | b60125ce98f3b190a91d1604b414a35f6724c52f | 185523c456a1cd7932616e1e961bb4694990fca3 | refs/heads/master | 2016-09-11T22:48:49.025248 | 2009-09-04T09:11:02 | 2009-09-04T09:11:02 | 32,588,837 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,601 | java | package com.iv.logView.ui;
import com.iv.logView.io.ProgressListener;
import info.clearthought.layout.TableLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.GraphicsEnvironment;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JWindow;
public class SplashScreen extends JWindow implements ProgressListener {
private final SplashProgress splashProgress;
public SplashScreen(Frame owner) {
setFocusable(true);
if (owner != null) requestFocus();
boolean closeOnClick = owner != null;
final JPanel content = (JPanel) getContentPane();
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double b = 5;
double[] cols = new double[]{b, f, b};
double[] rows = new double[]{b, p, p, p, p, b};
TableLayout layout = new TableLayout(cols, rows);
setLayout(layout);
content.setBorder(BorderFactory.createRaisedBevelBorder());
JLabel imgLbl = new JLabel(
new ImageIcon(getClass().getClassLoader().getResource("splash.png")),
JLabel.CENTER
);
imgLbl.setBorder(BorderFactory.createLoweredBevelBorder());
content.add(imgLbl, "1,1");
splashProgress = new SplashProgress();
splashProgress.setPreferredSize(new Dimension(getWidth(), 5));
content.add(splashProgress, "1,2");
String version = getClass().getPackage().getImplementationVersion();
content.add(new JLabel("LogViewer version " + version, JLabel.CENTER), "1,3");
content.add(new JLabel("Copyright (c) 2008 by P.A.S", JLabel.CENTER), "1,4");
centerOnScreen(owner);
if (closeOnClick) {
addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
close();
}
});
addKeyListener(new KeyAdapter() {
public void keyTyped(KeyEvent e) {
close();
}
});
addFocusListener(new FocusAdapter() {
public void focusLost(FocusEvent e) {
close();
}
});
}
}
public void close() {
setVisible(false);
dispose();
if (getOwner() != null) getOwner().requestFocus();
}
public void onBegin() {
splashProgress.reset();
}
public void onEnd() {
splashProgress.done();
}
public void onProgress(int percent) {
splashProgress.setPercent(percent);
}
private void centerOnScreen(Frame owner) {
pack();
final Point center;
if (owner == null) {
center = GraphicsEnvironment.getLocalGraphicsEnvironment().getCenterPoint();
} else {
Rectangle r = owner.getBounds();
center = new Point(r.x + r.width / 2, r.y + r.height / 2);
}
Dimension winSize = getSize();
int x = center.x - (winSize.width / 2);
int y = center.y - (winSize.height / 2);
setLocation(x, y);
}
private static class SplashProgress extends JComponent {
public static final int DEFAULT_STEP = 5;
private final int step;
private int percent = 0;
public SplashProgress() {
this(DEFAULT_STEP);
}
public SplashProgress(int step) {
this.step = step;
}
public void reset() {
this.percent = 0;
repaint();
}
public void done() {
this.percent = 100;
repaint();
}
public void setPercent(int percent) {
if (percent - this.percent > step) {
this.percent = percent - (percent % step);
repaint();
}
}
public void paint(Graphics g) {
int w = Math.round(getWidth() / 100f * percent);
g.setColor(Color.RED);
g.fillRect(0, 1, w - 2, getHeight());
}
}
}
| [
"pshmarev@13c310c5-bb1a-0410-a5e1-956baf766ac8"
] | pshmarev@13c310c5-bb1a-0410-a5e1-956baf766ac8 |
22975dcccd4e863beb65654132bd4d56a4ed39a7 | 75427e551c6cd92839a11e31678e84333f66e476 | /library/src/main/java/com/andexert/calendarlistview/library/DayData.java | 611a8b9d80848fc569ae63cc31f445a7d384746b | [
"MIT"
] | permissive | bjzhanghao/CalendarListview | add26c7a445080651118ee00ee2d5dd4bf0ea028 | 6a3479cda10aa1edc1fa80032aa01f54ae395ac5 | refs/heads/master | 2020-03-26T13:26:34.346420 | 2018-09-26T09:33:06 | 2018-09-26T09:33:06 | 144,939,354 | 0 | 0 | MIT | 2018-08-16T05:09:51 | 2018-08-16T05:09:51 | null | UTF-8 | Java | false | false | 590 | java | package com.andexert.calendarlistview.library;
/**
* Calendar data for individual day
*/
public class DayData {
private String text;
private double value;
private Object data;
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public double getValue() {
return value;
}
public void setValue(double value) {
this.value = value;
}
}
| [
"1891934@qq.com"
] | 1891934@qq.com |
70e9912beed95c3bd9efdfa547c17497e1d0217c | ae0721336d382f91ec1bd4be91a37e30ff482364 | /src/br/com/furb/comp/gals/ParserConstants.java | c916ef7e1c36cd8eedb5baa18df433f0e19194f5 | [] | no_license | aguilasa/compiladores_201301 | 6457f4fcccff6488e32d85cfc1e9e7d79dff048c | 532cc79139de4af2b41dd54b86a5d328c3a5b037 | refs/heads/master | 2021-01-23T12:10:05.156451 | 2013-07-01T01:56:08 | 2013-07-01T01:56:08 | null | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 12,269 | java | package br.com.furb.comp.gals;
public interface ParserConstants
{
int START_SYMBOL = 42;
int FIRST_NON_TERMINAL = 42;
int FIRST_SEMANTIC_ACTION = 78;
int[][] PARSER_TABLE =
{
{ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
{ -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, 1, -1, -1, -1, 2, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
{ -1, -1, 3, 3, 3, 3, -1, -1, -1, -1, -1, 3, 3, -1, -1, -1, -1, -1, -1, 3, -1, -1, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
{ -1, -1, 5, 5, 5, 5, -1, -1, -1, -1, -1, 5, 5, -1, -1, -1, -1, -1, -1, 5, -1, -1, 5, -1, -1, -1, -1, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
{ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
{ -1, -1, 8, 8, 8, 8, -1, -1, -1, -1, -1, 8, 8, -1, -1, -1, -1, -1, -1, 8, 7, -1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
{ -1, -1, 9, 10, 11, 12, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
{ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 13, -1, 14, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
{ -1, -1, 15, 15, 15, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
{ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 17, -1, 16, 16, -1, -1, 16, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
{ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 18, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
{ -1, -1, 19, 19, 19, 19, -1, -1, -1, -1, -1, 19, 19, -1, -1, -1, -1, -1, -1, 19, 19, -1, 19, -1, 20, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
{ -1, -1, 21, 21, 21, 21, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
{ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
{ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
{ -1, -1, 24, 24, 24, 24, 24, 24, 24, -1, 24, -1, -1, -1, -1, -1, -1, 24, -1, -1, -1, 24, -1, -1, -1, -1, -1, -1, 24, -1, 24, 24, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
{ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 26, -1, -1, -1, -1, -1, 25, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
{ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 27, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
{ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
{ -1, -1, 29, 29, 29, 29, -1, -1, -1, -1, -1, 29, 29, 30, -1, -1, -1, -1, -1, 29, 29, -1, 29, -1, -1, -1, -1, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
{ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 31, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
{ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
{ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 34, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
{ -1, -1, 35, 35, 35, 35, -1, -1, -1, -1, -1, 38, 36, -1, -1, -1, -1, -1, -1, 37, -1, -1, 39, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
{ -1, -1, 40, 40, 40, 40, 40, 40, 40, -1, 40, -1, -1, -1, -1, -1, -1, 40, -1, -1, -1, 40, -1, -1, -1, -1, -1, -1, 40, -1, 40, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
{ -1, -1, -1, -1, -1, -1, -1, -1, -1, 43, -1, -1, -1, -1, -1, -1, -1, -1, 42, -1, -1, -1, -1, 41, -1, 41, -1, -1, -1, 41, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
{ -1, -1, 44, 44, 44, 44, 44, 44, 44, -1, 46, -1, -1, -1, -1, -1, -1, 47, -1, -1, -1, 45, -1, -1, -1, -1, -1, -1, 44, -1, 44, 44, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
{ -1, -1, 48, 48, 48, 48, 48, 48, 48, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 48, -1, 48, 48, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
{ -1, -1, 57, 57, 57, 57, 57, 57, 57, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 57, -1, 57, 57, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
{ -1, -1, -1, -1, -1, -1, -1, -1, -1, 58, -1, -1, -1, -1, -1, -1, -1, -1, 58, -1, -1, -1, -1, 58, -1, 58, -1, -1, -1, 58, 59, 60, -1, -1, -1, 58, 58, 58, 58, 58, 58 },
{ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 51, 52, 53, 54, 55, 56 },
{ -1, -1, 61, 61, 61, 61, 61, 61, 61, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, -1, 61, 61, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
{ -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, -1, 62, -1, 62, -1, -1, -1, 62, 62, 62, 63, 64, -1, 62, 62, 62, 62, 62, 62 },
{ -1, -1, 65, 65, 65, 65, 66, 67, 68, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 69, -1, 70, 71, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
{ -1, -1, -1, -1, -1, -1, -1, -1, -1, 72, -1, -1, -1, -1, -1, -1, -1, -1, 72, -1, -1, -1, -1, 72, -1, 72, -1, -1, 73, 72, 72, 72, 72, 72, -1, 72, 72, 72, 72, 72, 72 },
{ -1, -1, -1, -1, -1, -1, -1, -1, -1, 49, -1, -1, -1, -1, -1, -1, -1, -1, 49, -1, -1, -1, -1, 49, -1, 49, -1, -1, -1, 49, -1, -1, -1, -1, -1, 50, 50, 50, 50, 50, 50 }
};
int[][] PRODUCTIONS =
{
{ 79, 16, 17, 27, 43, 80, 53, 44, 28, 81 },
{ 0 },
{ 46, 43 },
{ 65, 45 },
{ 0 },
{ 44 },
{ 17, 48, 82, 49, 83, 27, 53, 47, 21, 66, 26, 28, 84 },
{ 0 },
{ 65, 47 },
{ 3 },
{ 4 },
{ 5 },
{ 6 },
{ 25, 50, 85 },
{ 0 },
{ 48, 87, 51 },
{ 0 },
{ 24, 50 },
{ 25, 50, 86, 26 },
{ 0 },
{ 52, 53 },
{ 48, 87, 35, 66, 88, 26 },
{ 13, 29, 50, 30, 89, 26 },
{ 20, 29, 90, 57, 30, 26 },
{ 66, 91, 58 },
{ 0 },
{ 24, 57 },
{ 15, 25, 27, 44, 28 },
{ 14, 25, 27, 44, 28 },
{ 0 },
{ 94, 60 },
{ 12, 29, 66, 92, 30, 59, 61, 93 },
{ 15, 96, 25, 27, 44, 28 },
{ 14, 96, 25, 27, 44, 28 },
{ 23, 95, 29, 66, 30, 63, 97 },
{ 54 },
{ 55 },
{ 56 },
{ 62 },
{ 64 },
{ 68, 67 },
{ 0 },
{ 19, 68, 98, 67 },
{ 10, 68, 99, 67 },
{ 69 },
{ 22, 100 },
{ 11, 101 },
{ 18, 68, 102 },
{ 70, 77 },
{ 0 },
{ 72, 103, 70, 104 },
{ 36 },
{ 37 },
{ 38 },
{ 39 },
{ 40 },
{ 41 },
{ 73, 71 },
{ 0 },
{ 31, 73, 105, 71 },
{ 32, 73, 106, 71 },
{ 75, 74 },
{ 0 },
{ 33, 75, 107, 74 },
{ 34, 75, 108, 74 },
{ 48, 87, 76 },
{ 7, 112 },
{ 8, 113 },
{ 9, 114 },
{ 29, 66, 30 },
{ 31, 75, 115 },
{ 32, 75, 116 },
{ 109 },
{ 29, 110, 57, 30, 111 }
};
String[] PARSER_ERROR =
{
"",
"fim de programa", //"era esperado fim de programa",
"palavra reservada", //"era esperado palavra_reservada",
"identificador", //"era esperado id_int",
"identificador", //"era esperado id_float",
"identificador", //"era esperado id_string",
"identificador", //"era esperado id_bool",
"constante inteira", //"era esperado const_int",
"constante real", //"era esperado const_float",
"constante literal", //"era esperado const_string",
"and", //"era esperado and",
"false", //"era esperado false",
"if", //"era esperado if",
"in", //"era esperado in",
"isFalseDo", //"era esperado isFalseDo",
"isTrueDo", //"era esperado isTrueDo",
"main", //"era esperado main",
"module", //"era esperado module",
"not", //"era esperado not",
"or", //"era esperado or",
"out", //"era esperado out",
"return", //"era esperado return",
"true", //"era esperado true",
"while", //"era esperado while",
",", //"era esperado \",\"",
":", //"era esperado \":\"",
";", //"era esperado \";\"",
"[", //"era esperado \"[\"",
"]", //"era esperado \"]\"",
"(", //"era esperado \"(\"",
")", //"era esperado \")\"",
"+", //"era esperado \"+\"",
"-", //"era esperado \"-\"",
"*", //"era esperado \"*\"",
"/", //"era esperado \"/\"",
"<-", //"era esperado \"<-\"",
"=", //"era esperado \"=\"",
"!=", //"era esperado \"!=\"",
"<", //"era esperado \"<\"",
"<=", //"era esperado \"<=\"",
">", //"era esperado \">\"",
">=", //"era esperado \">=\"",
"main", //"<main_module> inv?lido",
"module", //"<lista_de_modulos> inv?lido",
"<-, in, out, if, while", //"<lista_comandos> inv?lido",
"<-, in, out, if, while", //"<lista_comandos1> inv?lido",
"module", //"<modulo> inv?lido",
"<-, in, out, if, while, return", //"<lista_cmd_mod> inv?lido",
"identificador", //"<identificador> inv?lido",
":", //"<parametros> inv?lido",
"identificador", //"<lista_de_identificadores> inv?lido",
",", //"<lista_de_identificadores1> inv?lido",
":", //"<declaracao_variavel> inv?lido",
":", //"<lista_de_variaveis> inv?lido",
"<-", //"<atribuicao> inv?lido",
"in", //"<entrada> inv?lido",
"out", //"<saida> inv?lido",
"expressão", //"<lista_de_expressoes> inv?lido",
"expressão", //"<lista_de_expressoes1> inv?lido",
"isTrueDo", //"<true_do> inv?lido",
"isFalseDo", //"<false_do> inv?lido",
"isFalseDo", //"<false_do_op> inv?lido",
"if", //"<if> inv?lido",
"isTrueDo, isFalseDo", //"<true_or_false_do> inv?lido",
"while", //"<while> inv?lido",
"<-, in, out, if, while", //"<comando> inv?lido",
"expressão", //"<expressao> inv?lido",
"expressão", //"<expressao1> inv?lido",
"expressão", //"<valor> inv?lido",
"expressão", //"<relacional> inv?lido",
"expressão", //"<aritmetica> inv?lido",
"expressão", //"<aritmetica1> inv?lido",
"expressão", //"<operador_relacional> inv?lido",
"expressão", //"<termo> inv?lido",
"expressão", //"<termo1> inv?lido",
"expressão", //"<fator> inv?lido",
"expressão", //"<fator1> inv?lido",
"expressão" //"<relacional1> inv?lido"
};
}
| [
"ingmar.aguiar@gmail.com"
] | ingmar.aguiar@gmail.com |
2d369c7b94efbfe40d34fad6e5008b332afcbc50 | 9a88c82e60ecd725fc5b97207afd55532039ee87 | /AlimentacionTest.java | 4f4dff0ee32190b209a62f0bfca7d80e49927886 | [] | no_license | premeromb/Java_DP_project | db2a7768a75e784647fad2d66fab82f63b189a2d | 3d28a7f40fdf89fc0529d28674c7baf66b0c7110 | refs/heads/master | 2023-01-06T14:49:41.295236 | 2020-11-06T23:20:32 | 2020-11-06T23:20:32 | 310,725,084 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 520 | java |
import static org.junit.Assert.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
/**
* The test class AlimentacionTest.
*
* @author (your name)
* @version (a version number or a date)
*/
public class AlimentacionTest
{
/**
* Default constructor for test class AlimentacionTest
*/
public AlimentacionTest()
{
}
/**
* Sets up the test fixture.
*
* Called before every test case method.
*/
@Test
public void nand()
{
}
}
| [
"promeromb@alumnos.unex.es"
] | promeromb@alumnos.unex.es |
27e1a1a0f01ea1c23582fa2c4f99ec78b98f0d61 | 7701247455e19e4a265a3c7dd0ea599c7e6a677f | /org/wbemservices/wbem/cimom/FilterActivation.java | 097eec62f476902f33059ec3f5bc3c6fb77cf196 | [] | no_license | acleasby/wbemservices | f3073fdb4ad5c8c87aabfc11ba50c00f58608fe3 | 86e5b7be0bba36bab696ac6ab05b8931f71cc408 | refs/heads/master | 2023-07-06T05:35:39.550360 | 2016-03-25T17:47:26 | 2016-03-25T17:47:26 | 41,431,630 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 50,848 | java | /*
*EXHIBIT A - Sun Industry Standards Source License
*
*"The contents of this file are subject to the Sun Industry
*Standards Source License Version 1.2 (the "License");
*You may not use this file except in compliance with the
*License. You may obtain a copy of the
*License at http://wbemservices.sourceforge.net/license.html
*
*Software distributed under the License is distributed on
*an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
*express or implied. See the License for the specific
*language governing rights and limitations under the License.
*
*The Original Code is WBEM Services.
*
*The Initial Developer of the Original Code is:
*Sun Microsystems, Inc.
*
*Portions created by: Sun Microsystems, Inc.
*are Copyright © 2001 Sun Microsystems, Inc.
*
*All Rights Reserved.
*
*Contributor(s): AppIQ, Inc.____________________________
*/
package org.wbemservices.wbem.cimom;
import javax.wbem.provider.EventProvider;
import javax.wbem.provider.CIMIndicationProvider;
import javax.wbem.provider.CIMProvider;
import javax.wbem.provider.Authorizable;
import javax.wbem.provider.CIMInstanceProvider;
import javax.wbem.cim.CIMException;
import javax.wbem.cim.CIMInstance;
import javax.wbem.cim.CIMObjectPath;
import javax.wbem.cim.CIMClass;
import javax.wbem.cim.CIMQualifier;
import javax.wbem.cim.CIMValue;
import javax.wbem.cim.CIMClassException;
import javax.wbem.client.CIMProviderException;
import javax.wbem.client.Debug;
import javax.wbem.query.SelectExp;
import javax.wbem.query.QueryExp;
import javax.wbem.query.BinaryRelQueryExp;
import javax.wbem.query.Query;
import javax.wbem.query.AndQueryExp;
import javax.wbem.query.NonJoinExp;
import javax.wbem.query.AttributeExp;
import javax.wbem.query.QualifiedAttributeExp;
import java.util.List;
import java.util.Iterator;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Vector;
import java.util.Set;
import java.util.TreeSet;
/*
* This class takes in input filters to determine what classes must be evented
* on. Once it determines what filters must be applied to what classes, it
* invokes the eventService with this information.
*/
public class FilterActivation {
// The three intrinsic instance level indications
public final static String INSTANCEADDITION = "cim_instcreation";
private final static int INSTANCEADDITIONTYPE = 0;
public final static String INSTANCEDELETION = "cim_instdeletion";
final static int INSTANCEDELETIONTYPE = 1;
public final static String INSTANCEMODIFICATION = "cim_instmodification";
final static int INSTANCEMODIFICATIONTYPE = 2;
public final static String INSTANCEREAD = "cim_instread";
final static int INSTANCEREADTYPE = 3;
public final static String INSTANCEMETHODCALL = "cim_instmethodcall";
public final static int INSTANCEMETHODCALLTYPE = 4;
public final static String CLASSCREATION = "cim_classcreation";
public final static String CLASSDELETION = "cim_classdeletion";
public final static String CLASSMODIFICATION = "cim_classmodification";
List result = null;
CIMException exception = null;
CIMInstance filterInstance = null;
CIMObjectPath filterOp = null;
CIMObjectPath targetNameSpace = null;
SelectExp parsedExp = null;
List canonizedExp = null;
EventService eventService = null;
// This is the base class for all requests to the event providers. Instances
// of these classes are created by the SubActivation sub classes, when they
// want to request information from a provider.
static class EventProviderRequest {
private SelectExp filter;
private String eventType;
private CIMObjectPath classPath;
EventProviderRequest(SelectExp filter, String eventType,
CIMObjectPath classPath) {
this.filter = filter;
this.eventType = eventType;
this.classPath = classPath;
}
// accessors
SelectExp getFilter() {
return filter;
}
String getEventType() {
return eventType;
}
CIMObjectPath getClassPath() {
return classPath;
}
}
static final class PollInfoRequest extends EventProviderRequest {
PollInfoRequest(SelectExp filter, String eventType,
CIMObjectPath classPath) {
super(filter, eventType, classPath);
}
}
static final class AuthorizeRequest extends EventProviderRequest {
private String owner;
AuthorizeRequest(SelectExp filter, String eventType,
CIMObjectPath classPath, String owner) {
super(filter, eventType, classPath);
this.owner = owner;
}
String getOwner() {
return owner;
}
}
static final class ActivateRequest extends EventProviderRequest {
private boolean firstActivation;
ActivateRequest(SelectExp filter, String eventType,
CIMObjectPath classPath, boolean firstActivation) {
super(filter, eventType, classPath);
this.firstActivation = firstActivation;
}
// accessors
boolean getFirstActivation() {
return firstActivation;
}
}
static final class DeactivateRequest extends EventProviderRequest {
private boolean lastActivation;
DeactivateRequest(SelectExp filter, String eventType,
CIMObjectPath classPath, boolean lastActivation) {
super(filter, eventType, classPath);
this.lastActivation = lastActivation;
}
// accessors
boolean getLastActivation() {
return lastActivation;
}
}
/*
* This class contains all the subactivations that the parent filter has
* been broken down into. If a request needs to be made to an event
* provider, the sub activation tells the parent activation what to ask
* the provider. The parent activation then lets the sub activation know
* the result through the process... methods. The reason for doing it this
* way, is that for smart event providers, the subactivation requests have
* to be merged together into one call.
* In case there is no event provider, the subactivation does not need
* to go through the above.
*
*/
abstract class SubActivation {
QueryExp expression;
String className;
boolean authorizable = false;
boolean polled = false;
SelectExp subSelectExp;
String subIndicationType;
int eventType = -1;
CIMProvider localep;
SelectExp getSubSelectExp() {
return subSelectExp;
}
QueryExp getExpression() {
return expression;
}
String getClassName() {
return className;
}
FilterActivation getParentActivation() {
return FilterActivation.this;
}
String getIndicationType() {
return subIndicationType;
}
int getEventType() {
return eventType;
}
SubActivation(String indicationTypeString, QueryExp expression,
String className) {
this.expression = expression;
this.className = className;
subSelectExp = new SelectExp(
parsedExp.getSelectList(),
new NonJoinExp(new
QualifiedAttributeExp(indicationTypeString, null, null)),
expression);
this.subIndicationType = indicationTypeString;
eventType = determineEventType(subIndicationType);
}
// This method gets information to determine if the events are generated
// by providers or need to be polled for. If providers need to be
// asked, this method returns a PollInfoRequest which is passed to
// providers. The result of the request is returned to processPollInfo.
abstract PollInfoRequest getPollInfo()
throws CIMException;
// This method is invoked by the parent filter activation. It provides
// the subactivation with the responses from the provider.
void processPollInfo(boolean hasResult, boolean pollFlag,
CIMException ce)
throws CIMException {
// do nothing. Subclass can override.
}
// Method to get check if the subscription is authorized.
// If providers need to be asked, this method returns a AuthorizeRequest
// which is passed to providers. The result is returned to
// processAuthorizeFailure.
abstract AuthorizeRequest authorize(String owner)
throws CIMException;
// Called by the parent activation to indicate success or failure from
// the provider. ce will be null if the call succeeded.
void processAuthorizeFailure(boolean hasResult, CIMException ce)
throws CIMException {
// do nothing. Subclass can override.
}
// Method to activate the filter
// If providers need to be asked, this method returns a ActivateRequest
// which is passed to providers. The result is returned to
// processActivateFailure.
abstract ActivateRequest activate() throws CIMException;
// Called by the parent activation to indicate success or failure from
// the provider. ce will be null if the call succeeded.
void processActivateFailure(boolean hasResult, CIMException ce)
throws CIMException {
// do nothing. Subclass can override.
}
// Method to reactivate the filter when a new subscription is made
// to an already activated filter
// If providers need to be asked, this method returns a ActivateRequest
// which is passed to providers. No result is returned, because
// currently we dont do anything with it.
abstract ActivateRequest activateSubscription() throws CIMException;
// Method to deactivate a subscription to a filter which has more
// pending subscription.
// If providers need to be asked, this method returns a
// DeactivateRequest. No result is passed back, we assume nothing
// further can/needs to be done in the event of a failure.
abstract DeactivateRequest deactivateSubscription() throws CIMException;
// Method to deactivate the filter
// If providers need to be asked, this method returns a
// DeactivateRequest. No result is passed back, we assume nothing
// further can/needs to be done in the event of a failure.
abstract DeactivateRequest deactivate() throws CIMException;
}
class PISubActivation extends SubActivation {
boolean isSmartIndicationProvider = false;
PISubActivation(String indicationTypeString, QueryExp expression,
String className) {
super(indicationTypeString, expression, className);
}
PollInfoRequest getPollInfo() throws CIMException {
CIMClass cc;
boolean checkedForSmartIP = false;
// This is a process indication, which must be in the same
// namespace as the filter
cc = eventService.ps.getClass(
filterOp.getNameSpace(), subIndicationType);
// Get the event provider
try {
localep =
CIMOMImpl.getProviderFactory().getEventProvider(
filterOp.getNameSpace(), cc);
} catch (CIMException e) {
// Ok look for the smart one
try {
checkedForSmartIP = true;
localep =
CIMOMImpl.getProviderFactory().getCIMIndicationProvider(
filterOp.getNameSpace(), cc);
} catch (CIMException ce) {
}
}
if (localep == null) {
// For process indications, an event provider must
// be present.
throw new CIMProviderException(
CIMProviderException.NO_EVENT_PROVIDER, subIndicationType,
"");
}
if (checkedForSmartIP) {
isSmartIndicationProvider = true;
}
// Lets see if this is authorizable
Authorizable tempAuth = null;
try {
tempAuth = CIMOMImpl.getProviderFactory().
getAuthorizableProvider(filterOp.getNameSpace(), cc);
} catch (CIMException ce) {
// if we get a NOT_AUTHORIZABLE_PROVIDER exception, it
// means the provider was found, but it doesnt want to do
// authorization - so we do the default check. Otherwise,
// we throw the exception.
if (!ce.getID().equals(
CIMProviderException.NOT_AUTHORIZABLE_PROVIDER)) {
throw ce;
}
}
if (tempAuth != null) {
authorizable = true;
} else {
authorizable = false;
}
// We dont need to get anything from the provider
return null;
}
AuthorizeRequest authorize(String owner)
throws CIMException {
CIMObjectPath classPath;
classPath = new CIMObjectPath("", filterOp.getNameSpace());
if (authorizable) {
// For now all filters are SelectExps
// Let the parent know that this filter needs to be authorized.
if (isSmartIndicationProvider) {
return new AuthorizeRequest(getSubSelectExp(),
subIndicationType, classPath, owner);
} else {
((EventProvider)localep).authorizeFilter(getSubSelectExp(),
subIndicationType, classPath, owner);
return null;
}
} else {
// Do the default check. This is really ugly. We need
// to move the capability check into CIMOMUtils.
eventService.cimom.delayedCapabilityCheck((CIMClass) null,
false, CIMOMImpl.READ,
classPath.getNameSpace());
// Dont need anything from the provider
return null;
}
}
ActivateRequest activate() throws CIMException {
boolean firstFilter = eventService.addClassFilter(
filterOp.getNameSpace()+":"+ subIndicationType, this, polled);
CIMObjectPath classPath;
classPath = new CIMObjectPath("",
filterOp.getNameSpace());
if (isSmartIndicationProvider) {
return new ActivateRequest(getSubSelectExp(),
subIndicationType, classPath, firstFilter);
// if activation fails, or is not done,
// processActivateFailure will be called
}
boolean failed = true;
EventProvider ep = (EventProvider)localep;
try {
ep.activateFilter(getSubSelectExp(),
subIndicationType, classPath, firstFilter);
failed = false;
return null;
} finally {
if (failed) {
processActivateFailure(false, null);
}
}
}
void processActivateFailure(boolean hasResult, CIMException ce)
throws CIMException {
eventService.removeClassFilter(
filterOp.getNameSpace()+":"+ subIndicationType, this,
polled);
}
ActivateRequest activateSubscription() throws CIMException {
CIMObjectPath classPath;
classPath = new CIMObjectPath("",
filterOp.getNameSpace());
// Only new providers need to do this
if (isSmartIndicationProvider) {
return new ActivateRequest(getSubSelectExp(),
subIndicationType, classPath, false);
// if activation fails, or is not done,
// processActivateFailure will be called
} else {
return null;
}
}
DeactivateRequest deactivateSubscription() throws CIMException {
if (isSmartIndicationProvider) {
CIMObjectPath classPath;
classPath = new CIMObjectPath("",
filterOp.getNameSpace());
return new DeactivateRequest(getSubSelectExp(),
subIndicationType, classPath, false);
} else {
return null;
}
}
DeactivateRequest deactivate() throws CIMException {
boolean lastFilter = eventService.removeClassFilter(
filterOp.getNameSpace()+":"+ subIndicationType, this, polled);
CIMObjectPath classPath;
classPath = new CIMObjectPath("",
filterOp.getNameSpace());
if (isSmartIndicationProvider) {
return new DeactivateRequest(getSubSelectExp(),
subIndicationType, classPath, lastFilter);
} else {
((EventProvider)localep).deActivateFilter(getSubSelectExp(),
subIndicationType, classPath, lastFilter);
return null;
}
}
}
// Currently this class just assumes that the repository handles class
// indications. However, we may want to get the provider for this
// from the provider checker in the future. Since the repository is the
// provider, it is not a CIMEventProvider. We just deal with it as a
// normal EventProvider.
class CISubActivation extends SubActivation {
EventProvider ep;
CISubActivation(String indicationTypeString, QueryExp expression,
String className) {
super(indicationTypeString, expression, className);
}
PollInfoRequest getPollInfo() throws CIMException {
// This is not being polled, the repository should
// handle this.
ep = eventService.ps;
// We dont need to get anything from a provider.
return null;
}
AuthorizeRequest authorize(String owner)
throws CIMException {
// Do the default check. This is really ugly. We need
// to move the capability check into CIMOMUtils.
eventService.cimom.delayedCapabilityCheck((CIMClass) null,
false, CIMOMImpl.READ,
targetNameSpace.getNameSpace());
// Nothing needed from the provider
return null;
}
ActivateRequest activate() throws CIMException {
boolean firstFilter;
firstFilter = eventService.addClassFilter(
targetNameSpace.getNameSpace()+":"+ subIndicationType,
this, polled);
CIMObjectPath classPath;
classPath = new CIMObjectPath("",
targetNameSpace.getNameSpace());
boolean failed = true;
try {
ep.activateFilter(getSubSelectExp(),
subIndicationType, classPath, firstFilter);
failed = false;
} finally {
if (failed) {
eventService.removeClassFilter(
targetNameSpace.getNameSpace()+":"+ subIndicationType, this,
polled);
}
}
// Nothing needed from the provider
return null;
}
ActivateRequest activateSubscription() {
// Dont need to do anything here.
return null;
}
DeactivateRequest deactivateSubscription() throws CIMException {
return null;
}
DeactivateRequest deactivate() throws CIMException {
boolean lastFilter;
lastFilter = eventService.removeClassFilter(
targetNameSpace.getNameSpace()+":"+ subIndicationType, this,
polled);
CIMObjectPath classPath;
classPath = new CIMObjectPath("",
targetNameSpace.getNameSpace());
ep.deActivateFilter(getSubSelectExp(),
subIndicationType, classPath, lastFilter);
// Nothing needed from the provider
return null;
}
}
class ILCSubActivation extends SubActivation {
boolean hasIndicationProvider = false;
boolean hasInstanceProvider = false;
CIMInstanceProvider instanceProvider = null;
boolean isSmartIndicationProvider = false;
ILCSubActivation(String indicationTypeString, QueryExp expression,
String className) {
super(indicationTypeString, expression, className);
}
PollInfoRequest getPollInfo() throws CIMException {
boolean checkForSmartIP = false;
CIMClass cc = eventService.ps.getClass(
targetNameSpace.getNameSpace(), className);
// <PJA> 1-August-2002
// Indication Provider need not be an instance provider - then getInstanceProvider
// will throw NOT_INSTANCE_PROVIDER rather than returning null
try {
instanceProvider = CIMOMImpl.getProviderFactory().getInstanceProvider(
targetNameSpace.getNameSpace(), cc);
if (instanceProvider != null) {
hasInstanceProvider = true;
}
}
catch (CIMException ce) {
if (!ce.getID().equals(CIMProviderException.NOT_INSTANCE_PROVIDER)) {
throw ce;
}
instanceProvider = null;
hasInstanceProvider = false;
}
try {
localep = CIMOMImpl.getProviderFactory().getEventProvider(
targetNameSpace.getNameSpace(), cc);
} catch (CIMException ce) {
// if we get a NOT_EVENT_PROVIDER exception, it
// means the provider was found, but it is not an event
// provider. Thats ok for now, ep will remain as null.
if (!ce.getID().equals(
CIMProviderException.NOT_EVENT_PROVIDER)) {
throw ce;
}
try {
checkForSmartIP = true;
localep =
CIMOMImpl.getProviderFactory().getCIMIndicationProvider(
targetNameSpace.getNameSpace(), cc);
} catch (CIMException ce2) {
// if we get a NOT_INDICATION_PROVIDER exception, it
// means the provider was found, but it is not an event
// provider. Thats ok for now, ep will remain as null.
if (!ce2.getID().equals(
CIMProviderException.NOT_INDICATION_PROVIDER)) {
throw ce2;
}
}
}
if (localep != null) {
hasIndicationProvider = true;
if (checkForSmartIP) {
isSmartIndicationProvider = true;
}
}
if (!hasInstanceProvider && !hasIndicationProvider) {
// There is no provider
LogFile.add(LogFile.DEVELOPMENT, "DEBUG_VALUE", "Handled by",
"repository");
if (eventType == INSTANCEMETHODCALLTYPE) {
// Method indications need a provider
throw new CIMProviderException(
CIMProviderException.NO_EVENT_PROVIDER, subIndicationType,
"");
}
// No need to ask the provider anything.
return null;
} else {
// ask the provider
if (!hasIndicationProvider && (eventType == INSTANCEREADTYPE ||
eventType == INSTANCEMETHODCALLTYPE)) {
// Read, method indications cannot be polled for
throw new CIMProviderException(
CIMProviderException.NOT_EVENT_PROVIDER,
subIndicationType,
instanceProvider.getClass().getName());
}
if (!hasIndicationProvider) {
// There is no event provider, we must poll.
LogFile.add(LogFile.DEVELOPMENT, "DEBUG_VALUE",
"Handled by", "poller, not an event provider");
polled = true;
// No need to ask the provider anything.
return null;
} else {
// Lets see if this is the provider handles authorization.
Authorizable tempAuth = null;
try {
tempAuth =
CIMOMImpl.getProviderFactory().getAuthorizableProvider(
filterOp.getNameSpace(), cc);
} catch (CIMException ce) {
// if we get a NOT_AUTHORIZABLE_PROVIDER exception, it
// means the provider was found, but it doesnt want to
// do authorization - so we do the default check.
// Otherwise, we throw the exception.
if (!ce.getID().equals(
CIMProviderException.NOT_AUTHORIZABLE_PROVIDER)) {
throw ce;
}
}
if (tempAuth == null) {
authorizable = true;
} else {
authorizable = false;
}
CIMObjectPath classPath = new CIMObjectPath(className,
targetNameSpace.getNameSpace());
if ((eventType != INSTANCEREADTYPE) &&
(eventType != INSTANCEMETHODCALLTYPE)) {
// Except for read/method events, we need to check if
// the provider wants us to poll. We cannot poll for
// reads/method calls.
if (isSmartIndicationProvider) {
return new PollInfoRequest(getSubSelectExp(),
getIndicationType(), classPath);
// The result will be returned in processPollInfo
} else {
boolean pollResult =
((EventProvider)localep).mustPoll(getSubSelectExp(),
getIndicationType(), classPath);
processPollInfo(true, pollResult, null);
return null;
}
} else {
// Dont need to ask the provider, we wont poll
return null;
}
}
}
}
void processPollInfo(boolean hasResult, boolean pollFlag,
CIMException ce)
throws CIMException {
if (!hasResult) {
// There is no result to process. Just return.
return;
}
if (ce != null) {
// There was an exception, nothing for us to do then.
return;
}
if (pollFlag) {
polled = true;
LogFile.add(LogFile.DEVELOPMENT, "DEBUG_VALUE",
"Handled by", "poller, event provider wants a poll");
if (EventService.pollInterval < 0) {
// No polling allowed
throw new CIMException(CIMException.CIM_ERR_FAILED);
}
if (!hasInstanceProvider) {
throw new CIMProviderException(
CIMProviderException.NO_INSTANCE_PROVIDER,
targetNameSpace.getNameSpace()+":"+className);
}
}
}
AuthorizeRequest authorize(String owner)
throws CIMException {
CIMObjectPath classPath = new CIMObjectPath(className,
targetNameSpace.getNameSpace());
if (authorizable == true) {
// For now all filters are SelectExps
if (isSmartIndicationProvider) {
return new AuthorizeRequest(getSubSelectExp(),
getIndicationType(), classPath, owner);
// No need to process the result.
} else {
((EventProvider)localep).authorizeFilter(getSubSelectExp(),
getIndicationType(), classPath, owner);
return null;
}
} else {
if (polled) {
// Ask the poller
IndicationPoller ip = eventService.getIndicationPoller();
ip.authorizeFilter(getSubSelectExp(), getIndicationType(),
classPath, owner);
// Nothing needed from the provider
return null;
} else {
// Do the default check. This is really ugly. We need
// to move the capability check into CIMOMUtils.
eventService.cimom.delayedCapabilityCheck((CIMClass) null,
false, CIMOMImpl.READ,
classPath.getNameSpace());
// Nothing needed from the provider
return null;
}
}
}
ActivateRequest activate() throws CIMException {
boolean shouldActivate = eventService.addClassFilter(
targetNameSpace.getNameSpace()+":"+ className, this, polled);
boolean repository = (!hasIndicationProvider &&
!hasInstanceProvider);
if (!shouldActivate) {
if (repository) {
// Repository has already been activated
return null;
}
if (polled) {
// Polling has already been activated
return null;
}
}
boolean failed = true;
try {
if (repository) {
// No provider - repository will handle this one
CIMObjectPath classPath = new CIMObjectPath(className,
targetNameSpace.getNameSpace());
switch (eventType) {
case INSTANCEADDITIONTYPE:
eventService.ps.additionTriggerActivate(
targetNameSpace.getNameSpace(), className);
break;
case INSTANCEMODIFICATIONTYPE:
eventService.ps.modificationTriggerActivate(
targetNameSpace.getNameSpace(), className);
break;
case INSTANCEDELETIONTYPE:
eventService.ps.deletionTriggerActivate(
targetNameSpace.getNameSpace(), className);
break;
case INSTANCEREADTYPE:
eventService.ps.activateFilter(getSubSelectExp(),
getIndicationType(), classPath, shouldActivate);
break;
}
failed = false;
// Nothing needed from the provider
return null;
} else {
if (!polled) {
// we've found an event provider
CIMObjectPath classPath = new CIMObjectPath(className,
targetNameSpace.getNameSpace());
if (isSmartIndicationProvider) {
// For now we have not failed. We'll process the
// result in processActivateFailure.
failed = false;
return new ActivateRequest (getSubSelectExp(),
getIndicationType(), classPath, shouldActivate);
} else {
((EventProvider)localep).activateFilter(
getSubSelectExp(), getIndicationType(), classPath,
shouldActivate);
failed = false;
return null;
}
}
IndicationPoller ip = eventService.getIndicationPoller();
switch (eventType) {
case INSTANCEADDITIONTYPE:
ip.additionTriggerActivate(this);
break;
case INSTANCEMODIFICATIONTYPE:
ip.modificationTriggerActivate(this);
break;
case INSTANCEDELETIONTYPE:
ip.deletionTriggerActivate(this);
break;
// Read events are not polled.
}
failed = false;
return null;
}
} finally {
if (failed) {
eventService.removeClassFilter(
targetNameSpace.getNameSpace()+":"+ className, this,
polled);
}
}
}
ActivateRequest activateSubscription() throws CIMException {
// Only new providers need to do this
boolean repository = (!hasIndicationProvider &&
!hasInstanceProvider);
if (repository || polled) {
return null;
}
if (isSmartIndicationProvider) {
CIMObjectPath classPath = new CIMObjectPath(className,
targetNameSpace.getNameSpace());
// For now we have not failed. We'll process the
// result in processActivateFailure.
return new ActivateRequest (getSubSelectExp(),
getIndicationType(), classPath, false);
} else {
return null;
}
}
void processActivateFailure(boolean hasResult, CIMException ce)
throws CIMException {
// We treat not having a result as well as an exception as a
// failure.
eventService.removeClassFilter(
targetNameSpace.getNameSpace()+":"+ className, this,
polled);
}
DeactivateRequest deactivateSubscription() throws CIMException {
boolean repository = (!hasIndicationProvider &&
!hasInstanceProvider);
if (repository || polled) {
return null;
}
if (isSmartIndicationProvider) {
CIMObjectPath classPath = new CIMObjectPath(className,
targetNameSpace.getNameSpace());
return new DeactivateRequest(
getSubSelectExp(), getIndicationType(), classPath,
false);
} else {
return null;
}
}
DeactivateRequest deactivate() throws CIMException {
boolean shouldDeActivate = eventService.removeClassFilter(
targetNameSpace.getNameSpace()+":"+ className, this, polled);
boolean repository = (!hasIndicationProvider &&
!hasInstanceProvider);
if (!shouldDeActivate) {
if (repository) {
// Repository shouldnt be deactivated yet
return null;
}
if (polled) {
// Polling shouldnt be deactivated yet
return null;
}
}
if (repository) {
// No provider - repository will handle this one
// eventService.ps.addTrigger(targetNameSpace.getNameSpace(),
// className, parsedExp.getFromClause());
switch (eventType) {
case INSTANCEADDITIONTYPE:
eventService.ps.additionTriggerDeActivate(
targetNameSpace.getNameSpace(), className);
break;
case INSTANCEMODIFICATIONTYPE:
eventService.ps.modificationTriggerDeActivate(
targetNameSpace.getNameSpace(), className);
break;
case INSTANCEDELETIONTYPE:
eventService.ps.deletionTriggerDeActivate(
targetNameSpace.getNameSpace(), className);
break;
}
return null;
} else {
// Stop polling
if (!polled) {
// we've found an event provider
CIMObjectPath classPath = new CIMObjectPath(className,
targetNameSpace.getNameSpace());
if (isSmartIndicationProvider) {
return new DeactivateRequest(
getSubSelectExp(), getIndicationType(), classPath,
shouldDeActivate);
} else {
((EventProvider)localep).deActivateFilter(
getSubSelectExp(), getIndicationType(), classPath,
shouldDeActivate);
return null;
}
}
IndicationPoller ip = eventService.getIndicationPoller();
switch (eventType) {
case INSTANCEADDITIONTYPE:
ip.additionTriggerDeActivate(this);
break;
case INSTANCEMODIFICATIONTYPE:
ip.modificationTriggerDeActivate(this);
break;
case INSTANCEDELETIONTYPE:
ip.deletionTriggerDeActivate(this);
break;
}
// No provider to notify
return null;
}
}
}
FilterActivation(CIMObjectPath filterOp, CIMInstance filterInstance,
EventService eventService) {
this.filterInstance = filterInstance;
this.filterOp = new CIMObjectPath();
this.filterOp.setKeys(filterOp.getKeys());
this.filterOp.setObjectName(filterOp.getObjectName());
this.filterOp.setNameSpace(filterOp.getNameSpace().toLowerCase());
this.eventService = eventService;
}
// will throw an exception if one is found.
List getSubActivations() throws CIMException {
if (exception != null) {
throw exception;
}
return result;
}
SelectExp getParsedExp() {
return parsedExp;
}
CIMInstance getFilterInstance() {
return filterInstance;
}
CIMObjectPath getFilterOp() {
return filterOp;
}
CIMObjectPath getTargetNameSpace() {
return targetNameSpace;
}
/* We're using the run method with the same signature as Runnable here
* Maybe we'll run it in a separate thread later when there is a better
* locking mechanism.
*
* Description: For the given input filter, we go through all the candidate
* providers and activate eventing on them. This may result in the providers
* being polled for results, or the providers letting the Event service
* know when changes occur.
*
*/
void run() {
String query = null;
try {
query =
(String)filterInstance.getProperty(EventService.QUERYPROP).
getValue().getValue();
} catch (NullPointerException e) {
// There is no filter!
exception = new
CIMException(CIMException.CIM_ERR_INVALID_PARAMETER);
}
int in = 0;
try {
/* Dont check this for now.
String n = (String)filterInstance.
getProperty(EventService.QUERYLANGPROP).getValue().getValue();
in = n.intValue();
*/
} catch (NullPointerException e) {
// we assume no value means WQL.
Debug.trace2("Caught NullPointerException in FilterActivation.run", e);
in = 0;
}
if (in != 0) {
exception = new CIMException(
CIMException.CIM_ERR_NOT_SUPPORTED, new Integer(in));
return;
}
try {
determineClasses(query);
} catch (CIMException e) {
exception = e;
} catch (Exception e) {
exception = new CIMException(CIMException.CIM_ERR_FAILED,
e);
}
return;
}
private CIMIndicationProvider getProvider(CIMObjectPath classPath,
String eventType) throws CIMException {
// Find the provider
CIMObjectPath cp = classPath;
String className = cp.getObjectName();
if ((className == null) || (className.length() == 0)) {
cp = new CIMObjectPath();
cp.setNameSpace(classPath.getNameSpace());
cp.setObjectName(eventType);
}
CIMClass cc = eventService.ps.getClass(
cp.getNameSpace(), cp.getObjectName());
// Get the event provider
CIMIndicationProvider localep =
CIMOMImpl.getProviderFactory().getCIMIndicationProvider(
filterOp.getNameSpace(), cc);
if (localep == null) {
// Huh? no provider - shouldnt happen
throw new CIMProviderException(
CIMProviderException.NO_INDICATION_PROVIDER, cp.getObjectName(),
cp.getNameSpace());
}
return localep;
}
// Get polling info for each subactivation. Some activations may result
// in the provider being polled, some may not.
void getPollInfo(final CIMInstance handler, final CIMInstance subscription)
throws CIMException {
IndicationRequestCollator irc =
new IndicationRequestCollator(
getSubActivations(),
new IndicationRequestCollator.Callback() {
int count = 0;
public FilterActivation.EventProviderRequest
doSubActivationOperation(SubActivation sa)
throws CIMException {
return sa.getPollInfo();
}
public Object doProviderOperation(String[] filters,
CIMObjectPath[] classPaths, String[] eventTypes)
throws CIMException {
// reset the count for the next set of mustPoll results.
count = 0;
CIMIndicationProvider localep =
getProvider(classPaths[0], eventTypes[0]);
return localep.mustPoll(filterInstance, handler, subscription,
filters, classPaths, eventTypes);
}
public void processSingleResult(FilterActivation.SubActivation sa,
Object result) throws CIMException {
boolean[] pollResult = (boolean[])result;
sa.processPollInfo(true, pollResult[count], null);
count++;
}
public void processSingleException(
FilterActivation.SubActivation sa, CIMException ce)
throws CIMException {
sa.processPollInfo(true, false, ce);
}
public void processSingleNoResult(FilterActivation.SubActivation sa)
throws CIMException {
sa.processPollInfo(false, false, null);
}
});
Object[] retVal = irc.processEventRequest();
if (retVal[0] != null) {
// there was an exception
throw ((CIMException)retVal[0]);
}
}
// Make sure that owner is authorized to use this particular activation.
// This is all or nothing. If any of the subactivations refuse, the owner
// is not authorized.
void authorize(final String owner, final CIMInstance handler,
final CIMInstance subscription) throws CIMException {
IndicationRequestCollator irc =
new IndicationRequestCollator(
getSubActivations(),
new IndicationRequestCollator.Callback() {
public FilterActivation.EventProviderRequest
doSubActivationOperation(SubActivation sa)
throws CIMException {
return sa.authorize(owner);
}
public Object doProviderOperation(String[] filters,
CIMObjectPath[] classPaths, String[] eventTypes)
throws CIMException {
CIMIndicationProvider localep =
getProvider(classPaths[0], eventTypes[0]);
localep.authorizeFilter(filterInstance, handler, subscription,
filters, classPaths, eventTypes);
// No result is expected.
return null;
}
public void processSingleResult(FilterActivation.SubActivation sa,
Object result) throws CIMException {
// No result is expected for authorization
}
public void processSingleException(
FilterActivation.SubActivation sa, CIMException ce)
throws CIMException {
sa.processAuthorizeFailure(true, ce);
}
public void processSingleNoResult(FilterActivation.SubActivation sa)
throws CIMException {
// Say there was no result
sa.processAuthorizeFailure(false, null);
}
});
Object[] retVal = irc.processEventRequest();
if (retVal[0] != null) {
// there was an exception
throw ((CIMException)retVal[0]);
}
}
void commonActivation(final CIMInstance handler,
final CIMInstance subscription, final boolean isSubscription)
throws CIMException {
IndicationRequestCollator irc =
new IndicationRequestCollator(
getSubActivations(),
new IndicationRequestCollator.Callback() {
public FilterActivation.EventProviderRequest
doSubActivationOperation(SubActivation sa)
throws CIMException {
if (isSubscription) {
return sa.activateSubscription();
} else {
return sa.activate();
}
}
public Object doProviderOperation(String[] filters,
CIMObjectPath[] classPaths, String[] eventTypes)
throws CIMException {
CIMIndicationProvider localep =
getProvider(classPaths[0], eventTypes[0]);
localep.activateFilter(filterInstance, handler, subscription,
filters, classPaths, eventTypes);
// No result is expected.
return null;
}
public void processSingleResult(FilterActivation.SubActivation sa,
Object result) throws CIMException {
// No result is expected for provider activation
}
public void processSingleException(
FilterActivation.SubActivation sa, CIMException ce)
throws CIMException {
if (!isSubscription) {
sa.processActivateFailure(true, ce);
}
}
public void processSingleNoResult(FilterActivation.SubActivation sa)
throws CIMException {
// Say there was no result
if (!isSubscription) {
sa.processActivateFailure(false, null);
}
}
});
Object[] retVal = irc.processEventRequest();
if (retVal[0] != null) {
// there was an exception. We need to deactivate those activations
// which were processed.
commonDeactivation((List)retVal[1], handler, subscription,
isSubscription);
// ok throw the exception
throw ((CIMException)retVal[0]);
}
}
void activate(CIMInstance handler, CIMInstance subscription) throws
CIMException {
commonActivation(handler, subscription, false);
}
void activateSubscription(CIMInstance handler, CIMInstance subscription)
throws CIMException {
commonActivation(handler, subscription, true);
}
private void commonDeactivation(List l, final CIMInstance handler,
final CIMInstance subscription, final boolean isSubscription) throws
CIMException {
if (l == null) {
l = getSubActivations();
}
IndicationRequestCollator irc =
new IndicationRequestCollator(
l, new IndicationRequestCollator.Callback() {
public FilterActivation.EventProviderRequest
doSubActivationOperation(SubActivation sa)
throws CIMException {
try {
if (isSubscription) {
return sa.deactivateSubscription();
} else {
return sa.deactivate();
}
} catch (Throwable th) {
// There isnt anything we can do about it, we should
// let deactivation continue;
Debug.trace2("Got deactivate exception", th);
return null;
}
}
public Object doProviderOperation(String[] filters,
CIMObjectPath[] classPaths, String[] eventTypes)
throws CIMException {
try {
CIMIndicationProvider localep =
getProvider(classPaths[0], eventTypes[0]);
localep.deActivateFilter(filterInstance, handler,
subscription, filters, classPaths, eventTypes);
} catch (Throwable th) {
// There isnt anything we can do about it, we should
// let deactivation continue;
Debug.trace2("Got deactivate exception", th);
}
// No result is expected.
return null;
}
public void processSingleResult(FilterActivation.SubActivation sa,
Object result) throws CIMException {
// No result is expected for provider deactivation
}
public void processSingleException(
FilterActivation.SubActivation sa, CIMException ce)
throws CIMException {
// Nothing can be done if there is an exception
}
public void processSingleNoResult(FilterActivation.SubActivation sa)
throws CIMException {
// No result is expected anyway
}
});
Object[] retVal = irc.processEventRequest();
if (retVal[0] != null) {
// there was an exception. Nothing we can do about it.
Debug.trace2("Got exception during deactivation",
(CIMException)retVal[0]);
}
}
void deactivateSubscription(CIMInstance handler, CIMInstance subscription)
throws CIMException {
commonDeactivation(null, handler, subscription, true);
}
void deactivate(CIMInstance handler, CIMInstance subscription)
throws CIMException {
commonDeactivation(null, handler, subscription, false);
}
private List removeIsas(List l) {
Iterator i = l.iterator();
List output = new ArrayList();
while (i.hasNext()) {
BinaryRelQueryExp br = (BinaryRelQueryExp)i.next();
int operator = br.getOperator();
if (operator == Query.ISA || operator == Query.NISA) {
continue;
}
output.add(br);
}
return output;
}
private QueryExp toQueryExp(List l) {
if (l.size() == 0) {
return null;
}
Iterator i = l.iterator();
if (l.size() == 1) {
return (BinaryRelQueryExp)i.next();
}
QueryExp lexp = (BinaryRelQueryExp)i.next();
QueryExp rexp = (BinaryRelQueryExp)i.next();
AndQueryExp finalExp = new AndQueryExp(lexp, rexp);
while (i.hasNext()) {
finalExp = new AndQueryExp(finalExp, (BinaryRelQueryExp)i.next());
}
return finalExp;
}
static int determineEventType(String eventTypeString) {
if (eventTypeString.equalsIgnoreCase(INSTANCEMODIFICATION)) {
return INSTANCEMODIFICATIONTYPE;
} else if (eventTypeString.equalsIgnoreCase(INSTANCEDELETION)) {
return INSTANCEDELETIONTYPE;
} else if (eventTypeString.equalsIgnoreCase(INSTANCEADDITION)) {
return INSTANCEADDITIONTYPE;
} else if (eventTypeString.equalsIgnoreCase(INSTANCEMETHODCALL)) {
return INSTANCEMETHODCALLTYPE;
} else if (eventTypeString.equalsIgnoreCase(INSTANCEREAD)) {
return INSTANCEREADTYPE;
}
return -1;
}
private boolean isAbstract(CIMClass cc) {
CIMQualifier qe =
cc.getQualifier("abstract");
if (qe == null) {
return false;
}
CIMValue Tmp = qe.getValue();
if ((Tmp == null) || !Tmp.equals(CIMValue.TRUE)) {
return false;
}
return true;
}
private boolean isClassIndication(String eventType) {
String testType = eventType.toLowerCase();
if (testType.equals(CLASSDELETION)) {
return true;
}
if (testType.equals(CLASSCREATION)) {
return true;
}
if (testType.equals(CLASSMODIFICATION)) {
return true;
}
return false;
}
// This method and the method it calls could be moved to a query optimizer
// class. That way we can have plugabble query optimization
private void determineClasses(String query) throws Exception {
parsedExp = new SelectExp(query);
String eventTypeString = ((NonJoinExp)parsedExp.getFromClause()).
getAttribute().getAttrClassName().toLowerCase();
targetNameSpace = new CIMObjectPath();
String targetNS = null;
try {
targetNS = (String)filterInstance.getProperty(
EventService.TARGETNSPROP).getValue().getValue();
} catch (NullPointerException e) {
// No value set
Debug.trace2("Caught NullPointerException in FilterActivation.determineClasses", e);
}
if (targetNS == null) {
// Ok we are operating in the same namespace as the filter
targetNameSpace.setNameSpace(filterOp.getNameSpace());
} else {
targetNameSpace.setNameSpace(targetNS.toLowerCase());
}
CIMClass indicationClass = eventService.ps.getClass(
filterOp.getNameSpace(), eventTypeString);
if (indicationClass == null) {
throw new CIMClassException(CIMException.CIM_ERR_NOT_FOUND,
eventTypeString);
}
CIMQualifier qe =
indicationClass.getQualifier(ClassChecker.INDICATIONQUALIFIER);
if (qe == null) {
throw new CIMClassException(CIMException.CIM_ERR_INVALID_CLASS,
eventTypeString);
}
CIMValue Tmp = qe.getValue();
if ((Tmp == null) || !Tmp.equals(CIMValue.TRUE)) {
throw new CIMClassException(CIMException.CIM_ERR_INVALID_CLASS,
eventTypeString);
}
CIMObjectPath eventTypePath = new CIMObjectPath();
eventTypePath.setNameSpace(filterOp.getNameSpace());
eventTypePath.setObjectName(eventTypeString);
Vector tempList =
eventService.ps.enumerateClasses(eventTypePath, true, false);
List indicationList = new ArrayList();
List intrinsicEventList = new ArrayList();
// We need to collect all the concrete indication classes
if (!isAbstract(indicationClass)) {
if (determineEventType(indicationClass.getName().toLowerCase())
!= -1) {
intrinsicEventList.add(indicationClass);
} else {
indicationList.add(indicationClass);
}
}
Enumeration e = tempList.elements();
while (e.hasMoreElements()) {
CIMClass tic = (CIMClass)e.nextElement();
if (!isAbstract(tic)) {
if (determineEventType(tic.getName().toLowerCase()) != -1) {
intrinsicEventList.add(tic);
} else {
indicationList.add(tic);
}
}
}
// Must do: to verify if the properties specified in the clause are
// valid
QueryExp whereClause = parsedExp.getWhereClause();
List cwc = null;
if (whereClause != null) {
// In the future we should have an expression optimizer here.
cwc = whereClause.canonizeDOC();
} else {
// empty expression
cwc = new ArrayList();
cwc.add(new ArrayList());
}
result = new ArrayList();
// Must handle the process indications here
Iterator ilIterator = indicationList.iterator();
while (ilIterator.hasNext()) {
CIMClass tic = (CIMClass)ilIterator.next();
// These checks should be in a factory which creates the
// apropriate subactivation
SubActivation subAct;
if (isClassIndication(tic.getName())) {
subAct = new CISubActivation(tic.getName().toLowerCase(),
whereClause, "");
} else {
subAct = new PISubActivation(tic.getName().toLowerCase(),
whereClause, "");
}
result.add(subAct);
}
// Each sublist will result in a different set of classes being
// 'evented' on
Iterator i = cwc.iterator();
canonizedExp = new ArrayList();
if (intrinsicEventList.size() == 0) {
// No life cycle indications to handle
return;
}
while (i.hasNext()) {
List subExpression = (List)i.next();
Set s = determineSublistClasses(subExpression);
Iterator is = s.iterator();
subExpression = removeIsas(subExpression);
canonizedExp.add(subExpression);
QueryExp subQueryExp = toQueryExp(subExpression);
while (is.hasNext()) {
String className = (String)is.next();
Iterator tempIterator = intrinsicEventList.iterator();
while (tempIterator.hasNext()) {
// Add a new subactivation for each life cycle indication
// type
CIMClass tic = (CIMClass)tempIterator.next();
SubActivation subAct = new ILCSubActivation(
tic.getName().toLowerCase(), subQueryExp,
className.toLowerCase());
result.add(subAct);
}
}
}
}
private Set determineSublistClasses(List l) throws Exception {
Iterator i = l.iterator();
// This set will contain the set of all classes that need to be
// evented on
Set s = new TreeSet();
List intersection = new ArrayList();
List difference = new ArrayList();
while (i.hasNext()) {
BinaryRelQueryExp br = (BinaryRelQueryExp)i.next();
// Need to do semantic checking - for e.g. the lhs should be
// of type Object
switch (br.getOperator()) {
case Query.ISA: AttributeExp aexp = (AttributeExp)br.
getRightValue();
String className = aexp.getAttributeName();
intersection.add(className);
break;
case Query.NISA: aexp = (AttributeExp)br.
getRightValue();
className = aexp.getAttributeName();
difference.add(className);
}
}
// We've collected the ISAs in intersection and NISAs in difference
CIMObjectPath path = new CIMObjectPath();
path.setNameSpace(targetNameSpace.getNameSpace());
if (intersection.size() == 0) {
// There is no ISA. That means this expression deals with all
// classes in the namespace (excluding, the difference classes)
path.setObjectName("");
Enumeration e = eventService.ps.enumerateClasses(path, true).
elements();
while (e.hasMoreElements()) {
s.add(((CIMObjectPath)e.nextElement()).getObjectName());
}
if (s.size() == 0) {
// There is nothing to be done, no classes to process
return s;
}
} else {
Iterator isaList = intersection.iterator();
// Get the classes for the first isa and then intersect
String className = (String)isaList.next();
path.setObjectName(className);
Enumeration e = eventService.ps.enumerateClasses(path, true).
elements();
// add the class itself
s.add(className);
while (e.hasMoreElements()) {
s.add(((CIMObjectPath)e.nextElement()).getObjectName());
}
while (s.size() > 0 && isaList.hasNext()) {
String intersectCN = (String)isaList.next();
path.setObjectName(intersectCN);
Vector v = eventService.ps.enumerateClasses(path, true);
// Add the class itself
v.insertElementAt(new CIMObjectPath(intersectCN), 0);
e = v.elements();
// Go through all the classes and remove those that
// do not exist in both.
while (e.hasMoreElements()) {
String intersectClass =
((CIMObjectPath)e.nextElement()).getObjectName();
if (!s.contains(intersectClass)) {
s.remove(intersectClass);
}
}
}
if (s.size() == 0) {
return s;
}
}
// Now handle the difference list
Iterator nisaList = difference.iterator();
while (nisaList.hasNext() && s.size() != 0) {
// Get the classes for the nisa and then take difference
String diffClassName = (String)nisaList.next();
path.setObjectName(diffClassName);
Vector v = eventService.ps.enumerateClasses(path, true);
v.insertElementAt(new CIMObjectPath(diffClassName), 0);
Enumeration e = v.elements();
while (e.hasMoreElements()) {
s.remove(((CIMObjectPath)e.nextElement()).getObjectName());
}
}
return s;
}
}
| [
"acleasby@infinio.com"
] | acleasby@infinio.com |
20b119a2ce2aba26c3288534217e350cba83f549 | 796843be6caa94cf6ed1adf2991a7a479d52a1cb | /src/DAO/TreinoDAO.java | 47ad177d26b9692a7e53baf6d24b035a41886591 | [] | no_license | willrockoliv/ProjetoATOM3.0_WEB | 6c2bda99c3f987ed2102d41e057fc773c30ce538 | 1cc73d6ad45f1ff0047f1ac1a73d45f8513043b6 | refs/heads/master | 2020-09-20T00:11:53.400347 | 2019-11-27T02:54:19 | 2019-11-27T02:54:19 | 224,330,351 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,545 | java | package DAO;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import VO.TreinoVO;
public class TreinoDAO {
private Connection connection;
public TreinoDAO() {
try {
this.connection = DBConnect.getConnection();
} catch (Exception e) {
e.printStackTrace();
}
} // TreinoDAO
public int ProximoId() {
int prox_id = 0;
try {
PreparedStatement preparedStatement = connection.prepareStatement("SELECT COUNT(*) AS ID FROM ATOM.TREINO");
ResultSet rs = preparedStatement.executeQuery();
if (rs.next())
prox_id = rs.getInt("ID") + 1;
} catch (SQLException e) {
e.printStackTrace();
}
return prox_id;
}
public ArrayList<TreinoVO> GetTotosTreinosAbertos() {
ArrayList<TreinoVO> listTreinoVO = new ArrayList<TreinoVO>();
try {
Statement statement = connection.createStatement();
ResultSet rs = statement.executeQuery("SELECT * FROM ATOM.TREINO WHERE AVALIACAO=-1");
while (rs.next()) {
TreinoVO treinoVO = new TreinoVO();
treinoVO.id = rs.getInt("ID");
treinoVO.id_aluno = rs.getInt("ID_ALUNO");
treinoVO.data = rs.getDate("DATA");
treinoVO.divisao = rs.getString("DIVISAO");
treinoVO.avaliacao = rs.getInt("AVALIACAO");
treinoVO.volume = rs.getDouble("VOLUME");
listTreinoVO.add(treinoVO);
}
} catch (SQLException e) {
e.printStackTrace();
}
return listTreinoVO;
}
public ArrayList<TreinoVO> GetTotosTreinos() {
ArrayList<TreinoVO> listTreinoVO = new ArrayList<TreinoVO>();
try {
Statement statement = connection.createStatement();
ResultSet rs = statement.executeQuery("SELECT * FROM ATOM.TREINO");
while (rs.next()) {
TreinoVO treinoVO = new TreinoVO();
treinoVO.id = rs.getInt("ID");
treinoVO.id_aluno = rs.getInt("ID_ALUNO");
treinoVO.data = rs.getDate("DATA");
treinoVO.divisao = rs.getString("DIVISAO");
treinoVO.avaliacao = rs.getInt("AVALIACAO");
treinoVO.volume = rs.getDouble("VOLUME");
listTreinoVO.add(treinoVO);
}
} catch (SQLException e) {
e.printStackTrace();
}
return listTreinoVO;
}
public TreinoVO GetTreinoPorID(int id) {
TreinoVO treinoVO = new TreinoVO();
try {
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * from ATOM.TREINO WHERE ID=?");
preparedStatement.setLong(1, id);
ResultSet rs = preparedStatement.executeQuery();
if (rs.next()) {
treinoVO.id = rs.getInt("ID");
treinoVO.id_aluno = rs.getInt("ID_ALUNO");
treinoVO.data = rs.getDate("DATA");
treinoVO.divisao = rs.getString("DIVISAO");
treinoVO.avaliacao = rs.getInt("AVALIACAO");
treinoVO.volume = rs.getDouble("VOLUME");
}
} catch (SQLException e) {
e.printStackTrace();
}
return treinoVO;
}
public ArrayList<TreinoVO> GetTreinoPorID_aluno(int id_aluno) {
ArrayList<TreinoVO> listTreinoVO = new ArrayList<TreinoVO>();
try {
PreparedStatement preparedStatement = connection
.prepareStatement("SELECT * from ATOM.TREINO WHERE ID_ALUNO=?");
preparedStatement.setLong(1, id_aluno);
ResultSet rs = preparedStatement.executeQuery();
while (rs.next()) {
TreinoVO treinoVO = new TreinoVO();
treinoVO.id = rs.getInt("ID");
treinoVO.id_aluno = rs.getInt("ID_ALUNO");
treinoVO.data = rs.getDate("DATA");
treinoVO.divisao = rs.getString("DIVISAO");
treinoVO.avaliacao = rs.getInt("AVALIACAO");
treinoVO.volume = rs.getDouble("VOLUME");
listTreinoVO.add(treinoVO);
}
} catch (SQLException e) {
e.printStackTrace();
}
return listTreinoVO;
}
public void Salvar(TreinoVO treinoVO) throws IOException {
try {
String sql = "INSERT INTO ATOM.TREINO (ID, ID_ALUNO, DATA, DIVISAO, AVALIACAO, VOLUME) VALUES(?,?,?,?,?,?)";
PreparedStatement preparedStatement = this.connection.prepareStatement(sql);
preparedStatement.setInt(1, treinoVO.id);
preparedStatement.setInt(2, treinoVO.id_aluno);
preparedStatement.setDate(3, treinoVO.data);
preparedStatement.setString(4, treinoVO.divisao);
preparedStatement.setInt(5, treinoVO.avaliacao);
preparedStatement.setDouble(6, treinoVO.volume);
preparedStatement.executeUpdate();
} catch (Exception e) {
e.printStackTrace();
} // try
}
public void Salvar(ArrayList<TreinoVO> listTreinoVO) throws IOException {
for (TreinoVO treinoVO : listTreinoVO)
Salvar(treinoVO);
}
public void Alterar(TreinoVO treinoVO) throws IOException {
try {
PreparedStatement preparedStatement = connection.prepareStatement(
"UPDATE ATOM.TREINO SET ID_ALUNO=?, DATA=?, DIVISAO=?, AVALIACAO=?, VOLUME=? WHERE ID=?");
// Parameters start with 1
preparedStatement.setInt(1, treinoVO.id_aluno);
preparedStatement.setDate(2, treinoVO.data);
preparedStatement.setString(3, treinoVO.divisao);
preparedStatement.setInt(4, treinoVO.avaliacao);
preparedStatement.setDouble(5, treinoVO.volume);
preparedStatement.setInt(6, treinoVO.id);
preparedStatement.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}
}
public void Alterar(ArrayList<TreinoVO> listTreinoVO) throws IOException {
for (TreinoVO treinoVO : listTreinoVO)
Alterar(treinoVO);
}
}
| [
"noreply@github.com"
] | willrockoliv.noreply@github.com |
83fb808976d5849a64db1f8b6e93b9714a8dae9c | 2c52f3c5e29bebc1b468ee1c203ae9a29b1b237d | /ads/src/main/java/shipper/com/ads/api/sender/BaseSender.java | 6e42cc4b61cd9856f472291b06e876961cbf3048 | [] | no_license | hanhbless/ship | 705e8bee00f933436eb6069b3c3120c263f903dd | 0ad890c63d606b2b68bdfb879ecc5618819ed9ac | refs/heads/master | 2021-01-10T11:04:58.538809 | 2016-01-08T14:13:45 | 2016-01-08T14:13:45 | 49,195,608 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 120 | java | package shipper.com.ads.api.sender;
public abstract class BaseSender {
public abstract String getParamsString();
}
| [
"hanhtv.dhgtvt@gmail.com"
] | hanhtv.dhgtvt@gmail.com |
4d2ba38d5f18ad255148d4d9d241a818f0f1364c | 4da2bb0c1fb189d8172e0210809063db5e59c079 | /src/main/java/com/springmvc/utils/WX/WechatUtil.java | a48dcd98949b8cd33f84b781a9c6ff92cbda99cc | [] | no_license | liuwuxiang/property_app | 59df70bcb2af4c8611e6c2a633836cbf52d9db58 | 08b35ff88511ba51aaf2638fa30c32cfb18fa421 | refs/heads/master | 2022-12-22T06:39:15.579385 | 2019-11-07T07:15:11 | 2019-11-07T07:15:11 | 220,174,067 | 0 | 0 | null | 2022-12-16T07:47:01 | 2019-11-07T07:12:08 | Java | UTF-8 | Java | false | false | 1,164 | java | package com.springmvc.utils.WX;
import com.springmvc.utils.HttpRequest;
import com.springmvc.utils.WechatEnterprisePay.WeChatConfig;
import net.sf.json.JSONObject;
import java.util.HashMap;
import java.util.Map;
public class WechatUtil {
/*
* 生成获取微信用户openid、refresh_token请求参数
* */
public static String obtainOpenIdParamts(String code){
String param = "appid="+WXPublicSettingUtil.appId+"&secret="+WXPublicSettingUtil.appSecret+"&code="+code+"&grant_type=authorization_code";
return param;
}
//获取公众号access_token
public static String obtainAccessToken(){
String paramts = "grant_type=client_credential&appid="+ WXPublicSettingUtil.appId+"&secret="+WXPublicSettingUtil.appSecret;
String data= HttpRequest.sendGet("https://api.weixin.qq.com/cgi-bin/token", paramts);
JSONObject dataJson = JSONObject.fromObject(data);
System.out.println("token获取结果:"+dataJson.toString());
if (dataJson.get("errcode") == null){
return (String)dataJson.get("access_token");
}
else{
return null;
}
}
}
| [
"494775947@qq.com"
] | 494775947@qq.com |
73d84c04775c8a91b992b58494fe9bc47dc30b7d | 83ffc825dcc201935dcffb948452858c9324bf51 | /src/com/vj/MySolrServer.java | 0b37c1d11f3d01b0781779878dac65f57d249083 | [] | no_license | icersummer/solr_learning | ff5e478a4169be6964c062877ac92641d71c6423 | d9ed073cd2603f7640a34d76ebd40e7e55791f7a | refs/heads/master | 2021-01-19T13:53:41.476194 | 2013-06-03T09:17:22 | 2013-06-03T09:17:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,495 | java | package com.vj;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.SolrServer;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.HttpSolrServer;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrDocument;
import org.apache.solr.common.SolrDocumentList;
import org.apache.solr.common.SolrInputDocument;
public class MySolrServer {
public static void main(String[] args) throws SolrServerException, IOException {
// method1();
// addingDataToSolr();
readingDataFromSolr();
highlighting();
queryWithMultipyParams();
}
/********************************************************************************************
*
********************************************************************************************/
static void method1(){
String url = "http://localhost:8983/solr";
HttpSolrServer server = new HttpSolrServer(url);
server.setMaxRetries(1);
server.setConnectionTimeout(5000);// 5s
// server.setParser(new XMLResponseParser()); // binary parser is used by default , what's it meaning?
server.setSoTimeout(1000);// socket read timeout
server.setDefaultMaxConnectionsPerHost(100);
server.setMaxTotalConnections(100);
server.setFollowRedirects(false); // what's used for ?
server.setAllowCompression(true);
// pass SolrRequest to SolrServer and return a SolrResponse
// org.apache.http.NoHttpResponseException a;
}
/********************************************************************************************
*
********************************************************************************************/
static void addingDataToSolr() throws SolrServerException, IOException{
System.out.println("creating solr server...");
SolrServer server = new HttpSolrServer("http://localhost:8983/solr");
// 1.
// server.deleteByQuery("*:*"); // delete everything
// System.out.println("clear all done.");
// construct a document
SolrInputDocument doc1 = new SolrInputDocument();
doc1.addField("id", "id1", 1.0f); // what's boost used for ?
doc1.addField("name", "doc1", 1.0f);
doc1.addField("price", 20);
SolrInputDocument doc2 = new SolrInputDocument();
doc2.addField("id", "id2", 1.0f);
doc2.addField("name", "doc2", 1.0f);
doc2.addField("price", 600);
/*
* Why add these 3 fields?
* "id", "name", and "price" are already included in Solr installation, we must add our new custom fields in SchemaXml (link: http://wiki.apache.org/solr/SchemaXml).
*/
// add docs to Solr
Collection<SolrInputDocument> docs = new ArrayList<SolrInputDocument>();
docs.add(doc1);
docs.add(doc2);
server.add(docs);
server.commit(); // commit should be called everytime after: delete, add, update.
System.out.println(" 2 docs added.");
}
/********************************************************************************************
* Steaming documents for an update
* haven't tested/used this method
********************************************************************************************/
void streamingDocumentsForUpdate(){
HttpSolrServer server = new HttpSolrServer("solr_server_url");
Iterator<SolrInputDocument> iter = new Iterator<SolrInputDocument>(){
@Override
public boolean hasNext() {
boolean result = false;
// set the result to true false to say if you have more documents
return result;
}
@Override
public SolrInputDocument next() {
SolrInputDocument result = null;
// construct a new document here and set it to result
return result;
}
@Override
public void remove() {
// TODO
}
};
}
/********************************************************************************************
* reading data from Solr
********************************************************************************************/
static void readingDataFromSolr(){
System.out.println(" reading Solr...");
try {
SolrServer server = new HttpSolrServer("http://localhost:8983/solr");
SolrQuery query = new SolrQuery();
query.setQuery("*:*");
query.addSortField("price", SolrQuery.ORDER.asc);
QueryResponse rsp = server.query(query);
SolrDocumentList docs = rsp.getResults();
Iterator<SolrDocument> it = docs.iterator();
while(it.hasNext()){
SolrDocument doc = it.next();
Collection<String> fields = doc.getFieldNames();
for(String field : fields){
Object value = doc.getFieldValue(field);
System.out.printf("field, value = [ %s, %s ] %n", field, value);
}
}
} catch (SolrServerException e) {
e.printStackTrace();
}
}
/********************************************************************************************
* advanced usage
********************************************************************************************/
static void advancedUsageOfQuery(){
try {
SolrServer server = null;
SolrQuery solrQuery = new SolrQuery().
setQuery("ipod").
setFacet(true).
setFacetMinCount(1).
setFacetLimit(8).
addFacetField("category").
addFacetField("inStock");
QueryResponse rsp = server.query(solrQuery);
} catch (SolrServerException e) {
e.printStackTrace();
}
}
/********************************************************************************************
* highlighting
********************************************************************************************/
static void highlighting(){
System.out.println("----------- highlighting ------");
try {
SolrServer server = new HttpSolrServer("http://localhost:8983/solr");
SolrQuery query = new SolrQuery();
query.setQuery("solr");
query
.setHighlight(true)
.setHighlightSnippets(1) // mean what?
.setHighlightSimplePre("<b>")
.setHighlightSimplePost("</b>");
query.setParam("hl.fl", "name"); //what field you want to highlight, ex. [<em>Solr</em>, the Enterprise Search Server]
// query.setParam("hl.fl", "features");
QueryResponse queryResponse = server.query(query);
Iterator<SolrDocument> iter = queryResponse.getResults().iterator();
while(iter.hasNext()){
SolrDocument resultDoc = iter.next();
String content = (String) resultDoc.getFieldValue("name");
String id = (String) resultDoc.getFieldValue("id");
if(queryResponse.getHighlighting().get(id) != null){
Map<String, Map<String, List<String>>> highlighting = queryResponse.getHighlighting();
Map<String, List<String>> idValue = highlighting.get(id);
List<String> contentValue = idValue.get("name");
System.out.println(contentValue);
}
}
} catch (SolrServerException e) {
e.printStackTrace();
}
}
static void queryWithMultipyParams(){
System.out.println("@queryWithMultipyParams...");
SolrServer solrServer = new HttpSolrServer("http://localhost:8983/solr");
SolrQuery params = new SolrQuery();
// common parameters for all search
params.set("q", "*:*");
params.set("fq", "age:[20 TO 30]", "grade:[70 TO *]"); // filter query
params.set("fl", "*,score");// field list
params.set("sort", "grade desc");// default : score desc
params.set("start", "0");
params.set("rows", "10");
params.set("timeAllowed", "30000"); // 30ms
params.set("omitHeader", "true");
params.set("cache", "false");
QueryResponse response = null;
try {
response = solrServer.query(params);
} catch (SolrServerException e) {
e.printStackTrace();
} finally {
solrServer.shutdown();
}
if(response != null){
System.out.println("time cost: " + response.getQTime());
System.out.println("result:\n" + response.toString());
}
}
}
/*
1, Jars needed: http://mvnrepository.com/artifact/org.apache.solr/solr-solrj/4.3.0
2. Race Condition meet again:
Solr Transactions
Solr implements transactions at the server level. This means that every commit, optimize, or rollback applies to all requests since the last commit/optimize/rollback.
The most appropriate way to update solr is with a single process in order to avoid race conditions when using commit and rollback. Also, ideally the application will use batch processing since commit and optimize can be expensive routines.
3.
*/ | [
"guofangsky@gmail.com"
] | guofangsky@gmail.com |
1febe4f863a877917d636241dcaa692dc8b33011 | 3c1c2436436e66b7201ba3f8ca7a00a1443d3731 | /src/main/java/com/tcs/fitnesstracker/Appointment.java | dd250f785314c5f6a49bacb561f1277ee0f5f667 | [] | no_license | PradeepHore123/Fitness-Tracker-Api | 85cda7e91ad2b93d29eaadaf350bbdd2eaa454e2 | b291693f1ebc8e1681704f3a04370e12f9c5e9f5 | refs/heads/main | 2023-07-23T09:13:24.184677 | 2021-08-26T11:10:05 | 2021-08-26T11:10:05 | 399,441,318 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 880 | java | package com.tcs.fitnesstracker;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Transient;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
@Setter
@Getter
@Entity
public class Appointment {
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Id
private Integer appointmentId;
@NotBlank(message = "Trainer Name is mandatory")
private String trainerName;
private boolean physioRequired;
@NotBlank(message = "Package name should be mentioned")
private String packageName;
private int amount;
@ManyToOne
@JoinColumn(name = "ID")
private User user;
} | [
"pradeephore2@gmail.com"
] | pradeephore2@gmail.com |
5e35a4ab4244ffc47d556c896d16cc2024f1b66e | c8faad383c490a37d1109d3ce802fff49e8fa072 | /src/main/java/org/springframework/data/solr/repository/support/SolrRepositoryFactoryBean.java | 2a5a698df34d7e9ec72df2816a1c98d9b0d6a793 | [
"Apache-2.0"
] | permissive | dynamicguy/spring-data-solr | 7bb1a132a814e227c6862a56ea027acee2abe301 | 66140c4d3c2dcf0ba0dc4d818ce8228afc8ce73b | refs/heads/master | 2021-08-28T15:52:31.026965 | 2012-10-03T03:54:44 | 2012-10-03T03:54:44 | 5,938,451 | 0 | 0 | Apache-2.0 | 2021-08-16T20:15:16 | 2012-09-24T18:01:03 | Java | UTF-8 | Java | false | false | 2,242 | java | /*
* Copyright 2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.solr.repository.support;
import java.io.Serializable;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.data.repository.Repository;
import org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport;
import org.springframework.data.repository.core.support.RepositoryFactorySupport;
import org.springframework.data.solr.core.SolrOperations;
import org.springframework.util.Assert;
/**
* Spring {@link FactoryBean} implementation to ease container based configuration for XML namespace and JavaConfig.
*
* @author Oliver Gierke
*/
public class SolrRepositoryFactoryBean<T extends Repository<S, ID>, S, ID extends Serializable> extends
RepositoryFactoryBeanSupport<T, S, ID> {
private SolrOperations operations;
/**
* Configures the {@link SolrOperations} to be used to create Solr repositories.
*
* @param operations the operations to set
*/
public void setSolrOperations(SolrOperations operations) {
Assert.notNull(operations);
this.operations = operations;
}
/*
* (non-Javadoc)
* @see org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport#createRepositoryFactory()
*/
@Override
protected RepositoryFactorySupport createRepositoryFactory() {
return new SolrRepositoryFactory(operations);
}
/*
* (non-Javadoc)
* @see org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport#afterPropertiesSet()
*/
@Override
public void afterPropertiesSet() {
super.afterPropertiesSet();
Assert.notNull(operations, "SolrOperations must be configured!");
}
}
| [
"info@olivergierke.de"
] | info@olivergierke.de |
728eba4fcb1ac44e1784c94600bbbaedb1c89b87 | bce89e2b1970c8d2119a6aa2e9f418d07f83b66f | /xbase-core/src/main/java/cr/ac/ucr/ecci/ci1312/xbase/core/exercise/stateChange/service/ExerciseStateChangeService.java | 3266b2a5cf51525e1c003326ea6a23c45a57e723 | [] | no_license | JosueCuberoSanchez/xBase | b96f65e8b59bd6594fc1a3d48bce7852aa1c7ee9 | 502c490f1d7c1d57c64cb867956f1439adad885c | refs/heads/master | 2021-07-24T02:35:27.329323 | 2017-11-03T15:15:09 | 2017-11-03T15:15:09 | 98,753,045 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,067 | java | package cr.ac.ucr.ecci.ci1312.xbase.core.exercise.stateChange.service;
import cr.ac.ucr.ecci.ci1312.xbase.model.Exercise;
import cr.ac.ucr.ecci.ci1312.xbase.model.ExerciseStateChange;
import cr.ac.ucr.ecci.ci1312.xbase.model.Student;
import cr.ac.ucr.ecci.ci1312.xbase.support.service.CrudService;
/**
* Universidad de Costa Rica
* Facultad de Ingenierías
* Escuela de Ciencias de la Computación e Informática
* Proyecto de Bases de Datos 1
* xBase
* Autores:
* Alemán Ramírez Esteban
* Borchgrevink Leiva Alexia
* Cubero Sánchez Josué
* Durán Gregory Ian
* Garita Centeno Alonso
* Hidalgo Campos Jose
* Mellado Xatruch Carlos
* Muñoz Miranda Roy
*
* Primer ciclo 2017
*/
public interface ExerciseStateChangeService extends CrudService<ExerciseStateChange, String> {
ExerciseStateChange getExerciseState(Student student, Exercise exercise);
void solveExercise(ExerciseStateChange stateChange, int rating);
void setExercisePending(ExerciseStateChange stateChange);
void startExercise(Student student, Exercise exercise);
}
| [
"josue.cubero@ucr.ac.cr"
] | josue.cubero@ucr.ac.cr |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.