blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
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
sequencelengths
1
1
author_id
stringlengths
0
313
f856ff58408a4d986c2014dd70f391d36abe089f
a026f5df043f1adb4945417d027ef7eab1d2bad8
/Workspace/LetsTagOn/LetsTagOnService/src/main/java/com/letstagon/enums/NotificationTypeEnum.java
b66eeedad1c21190c86d7c873e3f3e081f0c59f2
[]
no_license
Ranjitha1992/LetsTag-On
9a134790d9c325d0c1befba871b1b485dd65d24a
50400e9f2a25e4900bc6abfd34ff289e67b3f329
refs/heads/master
2021-06-22T07:48:01.737246
2017-08-16T07:02:42
2017-08-16T07:02:42
100,458,604
0
0
null
null
null
null
UTF-8
Java
false
false
1,907
java
package com.letstagon.enums; // TODO: Auto-generated Javadoc /** * The Enum NotificationTypeEnum. */ public enum NotificationTypeEnum { /** The connection accept. */ CONNECTION_ACCEPT("ConnectionAcceptEvent", "Your Connection has been accepted"), /** The connection request. */ CONNECTION_REQUEST( "ConnectionRequestEvent", "Connection has been requested"), /** The invite to opportunity. */ INVITE_TO_OPPORTUNITY( "OpportunityInviteEvent", "You have been invited for opportunity"), /** The message priint. */ MESSAGE_PRIINT( "MessagePrintEvent", "Message"), /** The new post on opportunity. */ NEW_POST_ON_OPPORTUNITY( "NewPostOnOppEvent", "New post on"), /** The opportunity application status change. */ OPPORTUNITY_APPLICATION_STATUS_CHANGE( "OppAppStatusChangeEvent", "Your Application status has been updated"), /** The opportunity attendence change. */ OPPORTUNITY_ATTENDENCE_CHANGE( "OppAttChangeEvent", "Attendence Marked"), /** The opportunity feedback change. */ OPPORTUNITY_FEEDBACK_CHANGE( "OppFeedBackEvent", "FeedBack"), /** The opportunity application sent. */ OPPORTUNITY_APPLICATION_SENT( "OppAppSentEvent", "Application Sent"), /** The password reset. */ PASSWORD_RESET( "PasswordResetEvent", "Password has been reset"); /** * Instantiates a new notification type enum. * * @param eventType the event type * @param message the message */ private NotificationTypeEnum(String eventType, String message) { this.eventType = eventType; this.message = message; } /** The event type. */ private final String eventType; /** The message. */ private final String message; /** * Gets the event type. * * @return the event type */ public String getEventType() { return eventType; } /** * Gets the message. * * @return the message */ public String getMessage() { return message; } }
02f4d281cc0cbcaef32230b4eec1356aa6bfadf4
67fbd11d809ad491edafd34b4fffb70483bffc72
/launcher/gen/com/example/launcher/R.java
7c2e39d7fedd374c10a1ca226f5c0b2631362d2c
[]
no_license
ImYeol/launcher_
f9de75d6db5b7b4c374c48821034ccad28295001
6a37ee96aa5bb24966157edc6846e159edb2d046
refs/heads/master
2016-09-01T18:42:38.855349
2015-01-27T06:40:37
2015-01-27T06:40:37
26,010,402
0
0
null
null
null
null
UTF-8
Java
false
false
2,959
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package com.example.launcher; public final class R { public static final class attr { } public static final class drawable { public static final int aim=0x7f020000; public static final int custom_progressbar=0x7f020001; public static final int ic_camera_50=0x7f020002; public static final int ic_delete_50=0x7f020003; public static final int ic_launcher=0x7f020004; public static final int ic_message_30=0x7f020005; public static final int ic_message_50=0x7f020006; public static final int ic_no_50=0x7f020007; public static final int ic_reply_50=0x7f020008; public static final int ic_request_50=0x7f020009; public static final int ic_search_50=0x7f02000a; public static final int ic_share_50=0x7f02000b; public static final int ic_warning_150=0x7f02000c; public static final int iron_man=0x7f02000d; } public static final class id { public static final int button1=0x7f060000; public static final int camera_catch_label=0x7f060004; public static final int camera_label=0x7f06000b; public static final int camera_overlayview=0x7f060002; public static final int camera_preview=0x7f060001; public static final int command_list_frame=0x7f06000a; public static final int comment_layout=0x7f060005; public static final int comment_text=0x7f060006; public static final int file_transfer_progressbar=0x7f060008; public static final int finish_label=0x7f06000f; public static final int imageView=0x7f060007; public static final int imageView1=0x7f060003; public static final int imageView2=0x7f06000c; public static final int imageView3=0x7f06000e; public static final int recognition_state_progressbar=0x7f060010; public static final int search_label=0x7f06000d; public static final int textView1=0x7f060009; } public static final class layout { public static final int activity_main=0x7f030000; public static final int camera=0x7f030001; public static final int custom_dialog=0x7f030002; public static final int image_viewer=0x7f030003; public static final int transfer_dialog=0x7f030004; public static final int voice_commands_list_layout=0x7f030005; public static final int voice_commands_list_view=0x7f030006; public static final int voice_recognition_state_dialog=0x7f030007; } public static final class raw { public static final int camera_click=0x7f040000; } public static final class string { public static final int app_name=0x7f050000; public static final int hello_world=0x7f050001; } }
ecdee94922ec62e07a34eb9bb7b1a604bb24d2bc
5b7b7ac935757f9ba4f4207decfce2c969c7721d
/Polestar/src/main/java/com/polestar/constants/HeaderConstants.java
482921f03648b6a0815fbc64b1cb45f9694df020
[]
no_license
AbhijitBiradar/Polestar
163998d90c3419df77916b0be81d3ff2b2ed34e0
8ec2173be49d19213dff23ab99dd4d0ab3bb1bf3
refs/heads/master
2022-11-22T18:26:14.643536
2020-07-19T08:29:25
2020-07-19T08:29:25
254,250,250
0
0
null
2022-11-16T00:46:28
2020-04-09T02:20:28
Java
UTF-8
Java
false
false
240
java
package com.polestar.constants; public class HeaderConstants { public static final String CONTENT_TYPE="Content-Type"; public static final String APPLICATION_JSON="application/json"; public static final String SERVER="server"; }
3271c8179e3c0c79da99c5140f27eae30a594dbc
2b97ebc4a4a5b96291ca994ef6f11f045c9fce68
/pet-clinic-data/src/main/java/jagrat/springframework/petclinic/model/Pet.java
4993e47cd1f715368cf681be9e93c0fc56c5ff8b
[]
no_license
foducoder/pet-clinic
350dbdcd908ab5638e699b7b214453fc4cec4449
fed51037c4ae51c4a26e1a176adc8a900d2b1a69
refs/heads/master
2022-12-02T09:59:18.072953
2020-08-11T11:24:00
2020-08-11T11:24:00
284,430,585
0
0
null
null
null
null
UTF-8
Java
false
false
809
java
package jagrat.springframework.petclinic.model; import java.time.LocalDate; public class Pet extends BaseEntity{ private String name; private PetType petType; private Owner owner; private LocalDate birthDate; public String getName() { return name; } public void setName(String name) { this.name = name; } public PetType getPetType() { return petType; } public void setPetType(PetType petType) { this.petType = petType; } public Owner getOwner() { return owner; } public void setOwner(Owner owner) { this.owner = owner; } public LocalDate getBirthDate() { return birthDate; } public void setBirthDate(LocalDate birthDate) { this.birthDate = birthDate; } }
6affb508bde243ca071a1812c1cac745966b4e49
17cf1597969504c3878eda785894bba838e2b934
/src/collections/teoria/modelo/ProdutoValorComparator.java
835df4ef84106c643c43538571b7a2f7a4124b06
[]
no_license
Jessica-Garcia/curso-java-13
ad8e92ce6a37310040fc7fc2899a1765d52c7835
5d23825e8fd6ca01b41a7b0d85a115fff1c63d3d
refs/heads/master
2022-11-22T01:22:15.993122
2020-07-29T07:10:21
2020-07-29T07:10:21
280,557,312
0
0
null
null
null
null
UTF-8
Java
false
false
261
java
package collections.teoria.modelo; import java.util.Comparator; public class ProdutoValorComparator implements Comparator<Produto> { @Override public int compare(Produto p1, Produto p2) { return p1.getValor().compareTo(p2.getValor()); } }
4bfb960462b3caa83553fa077c7ecc66bece401f
d040376ea3601d41f151a8972148d2f3c00e07f1
/src/com/srutkowski/facade/example1/MailContentGenerator.java
5fd33a827f435938feb66929e5581bbe41052f55
[]
no_license
sakovski/Design-Patterns
9454eabaa006c7595c1ea9e40328e34cae0fdc08
cb560e456df639c0e656ad0fcfa698ec6984acdf
refs/heads/master
2020-04-17T15:26:15.922203
2019-02-10T15:37:50
2019-02-10T15:37:50
166,698,576
0
0
null
null
null
null
UTF-8
Java
false
false
425
java
package com.srutkowski.facade.example1; public class MailContentGenerator { public String getWelcomeContent(String receiver, String template) { return String.format("%s HELLO %s! Long time no see :)", template, receiver); } public String getBusinessOfferContent(String receiver, String template) { return String.format("%s Hello %s! We have a nice offer for you!", template, receiver); } }
f4ef8545fc418a0e998bb43741ad2997cbd74096
3ef55e152decb43bdd90e3de821ffea1a2ec8f75
/large/module0254_internal/src/java/module0254_internal/a/Foo3.java
23f34bcff4c77c8bd00b1d2e2df22fc15b813593
[ "BSD-3-Clause" ]
permissive
salesforce/bazel-ls-demo-project
5cc6ef749d65d6626080f3a94239b6a509ef145a
948ed278f87338edd7e40af68b8690ae4f73ebf0
refs/heads/master
2023-06-24T08:06:06.084651
2023-03-14T11:54:29
2023-03-14T11:54:29
241,489,944
0
5
BSD-3-Clause
2023-03-27T11:28:14
2020-02-18T23:30:47
Java
UTF-8
Java
false
false
1,578
java
package module0254_internal.a; import javax.lang.model.*; import javax.management.*; import javax.naming.directory.*; /** * Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut * labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. * Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. * * @see java.nio.file.FileStore * @see java.sql.Array * @see java.util.logging.Filter */ @SuppressWarnings("all") public abstract class Foo3<X> extends module0254_internal.a.Foo2<X> implements module0254_internal.a.IFoo3<X> { java.util.zip.Deflater f0 = null; javax.annotation.processing.Completion f1 = null; javax.lang.model.AnnotatedConstruct f2 = null; public X element; public static Foo3 instance; public static Foo3 getInstance() { return instance; } public static <T> T create(java.util.List<T> input) { return module0254_internal.a.Foo2.create(input); } public String getName() { return module0254_internal.a.Foo2.getInstance().getName(); } public void setName(String string) { module0254_internal.a.Foo2.getInstance().setName(getName()); return; } public X get() { return (X)module0254_internal.a.Foo2.getInstance().get(); } public void set(Object element) { this.element = (X)element; module0254_internal.a.Foo2.getInstance().set(this.element); } public X call() throws Exception { return (X)module0254_internal.a.Foo2.getInstance().call(); } }
16fd9c0aa39dd60d6eeaa1b693dd6709d7bd0ed2
5111cd4d27e846053fc844335ab96b42f60e3b16
/zy-gis-service/src/main/java/com/zy/dzzw/gis/service/LayerInfoService.java
555a2e9c3f15ae48efde7dc65ce3d056ac6cf807
[]
no_license
wellsmitch/officeMap
d259b7cdd8cc2c22e1688b1c8b56f834c680ce78
9777a5066f5b9eb061a64efee7f263b831cbaa9e
refs/heads/master
2023-04-15T07:39:09.090910
2021-04-23T02:22:23
2021-04-23T02:22:23
360,738,366
0
0
null
null
null
null
UTF-8
Java
false
false
5,703
java
package com.zy.dzzw.gis.service; import com.zy.common.sys.entity.SysRole; import com.zy.common.sys.entity.SysUser; import com.zy.common.sys.service.CommonService; import com.zy.core.exception.ServiceRuntimeException; import com.zy.dzzw.gis.entity.BaseObject; import com.zy.dzzw.gis.entity.LayerInfo; import com.zy.dzzw.gis.entity.LayerRole; import com.zy.dzzw.gis.entity.TreeObject; import com.zy.dzzw.gis.listener.LayerInfoListener; import com.zy.dzzw.gis.repository.LayerInfoRepository; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.cache.annotation.Cacheable; import org.springframework.data.domain.Sort; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.Comparator; import java.util.List; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.function.Function; import java.util.function.Predicate; import java.util.stream.Collectors; /** * 图层服务 * * @Author wangxiaofeng * @Date 2020/3/28 9:42 */ @Service public class LayerInfoService { @Autowired(required = false) private List<LayerInfoListener> layerInfoListenerList; @Autowired LayerInfoRepository layerInfoRepository; @Autowired LayerRoleService layerRoleService; @Autowired(required = false) CommonService commonService; @Value("${sysId}") String sysId; // @Cacheable(value = "gis:layer", key = "'gis:layer:list'") public List<LayerInfo> find() { return layerInfoRepository.find(Sort.by(Sort.Order.asc("lft"))); } public LayerInfo findById(Long id) { return layerInfoRepository.findById(id); } public LayerInfo condition(LayerInfo layerInfo){ if (StringUtils.isNotBlank(layerInfo.getLayer())) { LayerInfo layerInfo1 = layerInfoRepository.findByLayer(layerInfo.getLayer()); if (layerInfo1 != null && !layerInfo1.getId().equals(layerInfo.getId())) { throw new ServiceRuntimeException("图层服务已存在"); } } String fullPathName; if (layerInfo.getId() == null && layerInfo.getPid() != null) { fullPathName = this.findParent(layerInfo.getPid()).stream().map(LayerInfo::getName).collect(Collectors.joining("/")); } else { fullPathName = this.findParent(layerInfo).stream().map(LayerInfo::getName).collect(Collectors.joining("/")); } if (StringUtils.isNotBlank(fullPathName) && !fullPathName.endsWith("/")) { fullPathName += "/"; } fullPathName += layerInfo.getName(); layerInfo.setFullPathName(fullPathName); return layerInfo; } public LayerInfo insert(LayerInfo layerInfo) { this.condition(layerInfo); layerInfoRepository.insert(layerInfo); return layerInfo; } public LayerInfo findByLayer(String layer) { return layerInfoRepository.findByLayer(layer); } public LayerInfo save(LayerInfo layerInfo) { this.condition(layerInfo); layerInfoRepository.save(layerInfo); return layerInfo; } public void remove(Long id) { layerInfoListenerList.forEach(layerInfoListener -> layerInfoListener.remove(findById(id))); layerInfoRepository.remove(id); } public void move(Long sourceId, Long targetId, String type) { LayerInfo ro = layerInfoRepository.findById(targetId); if ("inner".equals(type) && ro.getType() == 0) { throw new ServiceRuntimeException("目标节点不是分类"); } layerInfoRepository.move(sourceId, targetId, type); LayerInfo layerInfo = this.findById(sourceId); this.save(layerInfo); // 更新fullPathName List<LayerInfo> childrenList = this.findChildren(sourceId); childrenList.forEach(child -> { this.save(child); }); } public List<LayerInfo> findParent(Long id) { return layerInfoRepository.findParent(id); } public List<LayerInfo> findParent(LayerInfo layerInfo) { return layerInfoRepository.findParent(layerInfo); } public List<LayerInfo> findChildren(Long id) { return layerInfoRepository.findChildren(id); } public List<LayerInfo> findChildren(LayerInfo layerInfo) { return layerInfoRepository.findChildren(layerInfo); } public List<LayerInfo> find(SysUser sysUser) { List<LayerInfo> resultList = new ArrayList<>(256); List<SysRole> roleList = commonService.getUserRoleInfo(sysId, sysUser.getUserId()); List<String> roleIds = roleList.stream().map(sysRole -> sysRole.getOrgCode() + "_" + sysRole.getRoleId()).collect(Collectors.toList()); // 超级管理员查看所有 if (roleIds.contains("0_admin")) { return this.find(); } List<LayerRole> layerRoleList = layerRoleService.findByRoleIds(roleIds); layerRoleList.forEach(layerRole -> { LayerInfo layerInfo = layerRole.getLayerInfo(); resultList.addAll(this.findParent(layerInfo)); resultList.add(layerInfo); resultList.addAll(this.findChildren(layerInfo)); }); return resultList.stream().filter(distinctByKey(BaseObject::getId)).sorted(Comparator.comparing(TreeObject::getLft)).collect(Collectors.toList()); } private static <T> Predicate<T> distinctByKey(Function<? super T, Object> keyExtractor) { Set<Object> seen = ConcurrentHashMap.newKeySet(); return t -> seen.add(keyExtractor.apply(t)); } }
355e512f68e8424eddf19ba183bd42315a734285
85a912b7e7f46f0a8b828463075cba1c5a338065
/hello-eureka-client-service-consumer-feign/src/main/java/com/lee/springcloud/simple/ConsumerController.java
f19914c12ca15b188fd7ff1f114d9d138959583e
[]
no_license
BlueLeer/lee-springcloud-learn
0c6a810b24f94a584b0cca6bb095c95174ef9ccf
3cac1541bd4408a771bad2ac4a5457076cc8c4ec
refs/heads/master
2020-06-21T21:17:41.257789
2020-04-17T16:59:41
2020-04-17T16:59:41
197,554,499
1
0
null
null
null
null
UTF-8
Java
false
false
621
java
package com.lee.springcloud.simple; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; /** * Feign继承的特性 * * @author lee * @date 2020/4/16 16:27 */ @RestController public class ConsumerController { @Autowired private ConsumerService consumerService; @RequestMapping("/simple") public String simple() { String hi = consumerService.hi(); String name = consumerService.hiFeign("wangle"); return hi + "##########" + name; } }
069c85840c1be4c01ed5af33b60ef51ac652cd6a
b4ae50a27df77dece540ed79bbc0f3cfd3602680
/src/tests/Ex2Test.java
f7f5dc3d415cf9ea5cd5f2e572ecb3fb18dd7e4e
[]
no_license
NetanelAlbert/OopEx2-Maze-of-Waze
c181a2e66a2257c1d1f55639ac3bf0bfc99c94e0
2d2392157e145913c69b0552f042a3370c584450
refs/heads/master
2020-11-25T02:32:57.394021
2020-01-05T21:48:30
2020-01-05T21:48:30
228,454,835
0
0
null
null
null
null
UTF-8
Java
false
false
1,509
java
package tests; import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import algorithms.*; import dataStructure.*; import utils.*; import gui.*; /** * EX2 Structure test: * 1. make sure your code compile with this dummy test (DO NOT Change a thing in this test). * 2. the only change require is to run your GUI window (see line 64). * 3. EX2 auto-test will be based on such file structure. * 4. Do include this test-case in you submitted repository, in folder Tests (under src). * 5. Do note that all the required packages are imported - do NOT use other * * @author boaz.benmoshe * */ class Ex2Test { private static graph _graph; private static graph_algorithms _alg; public static final double EPS = 0.001; private static Point3D min = new Point3D(0,0,0); private static Point3D max = new Point3D(100,100,0); @BeforeAll static void setUpBeforeClass() throws Exception { _graph = tinyGraph(); } @BeforeEach void setUp() throws Exception { } @Test void testConnectivity() { _alg = new Graph_Algo(_graph); boolean con = _alg.isConnected(); if(!con) { fail("shoulbe be connected"); } } @Test void testgraph() { boolean ans = drawGraph(_graph); assertTrue(ans); } private static graph tinyGraph() { graph ans = new DGraph(); return ans; } boolean drawGraph(graph g) { // YOUR GUI graph draw new GraphGui(g); return true; } }
33f489d90fecf8ab1e446075f875113e650a3203
05a5bb2f14da29e67a086d0a0beb0863978663e9
/src/main/java/net/imglib2/blocks/TempArrayImpl.java
e3db8c4a9dc94fffe28e6a0a47e4f1f974eec9bc
[ "BSD-2-Clause" ]
permissive
imglib/imglib2
8239153419a862149cc8317ca27a185dbe07aeec
0f83262f6a1db0b131341fe28ec1d4f495c65a7a
refs/heads/master
2023-08-18T10:50:51.702443
2023-02-06T17:59:32
2023-07-14T12:01:47
2,996,011
260
79
NOASSERTION
2023-09-12T12:26:59
2011-12-16T16:36:19
Java
UTF-8
Java
false
false
2,532
java
/*- * #%L * ImgLib2: a general-purpose, multidimensional image processing library. * %% * Copyright (C) 2009 - 2023 Tobias Pietzsch, Stephan Preibisch, Stephan Saalfeld, * John Bogovic, Albert Cardona, Barry DeZonia, Christian Dietz, Jan Funke, * Aivar Grislis, Jonathan Hale, Grant Harris, Stefan Helfrich, Mark Hiner, * Martin Horn, Steffen Jaensch, Lee Kamentsky, Larry Lindsey, Melissa Linkert, * Mark Longair, Brian Northan, Nick Perry, Curtis Rueden, Johannes Schindelin, * Jean-Yves Tinevez and Michael Zinsmaier. * %% * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * #L% */ package net.imglib2.blocks; import java.lang.ref.WeakReference; class TempArrayImpl< T > implements TempArray< T > { private final PrimitiveTypeProperties< T, ? > props; private WeakReference< T > arrayRef; TempArrayImpl( PrimitiveTypeProperties< T, ? > props ) { arrayRef = new WeakReference<>( null ); this.props = props; } @Override public T get( final int minSize ) { T array = arrayRef.get(); if ( array == null || props.length( array ) < minSize ) { array = props.allocate( minSize ); arrayRef = new WeakReference<>( array ); } return array; } @Override public TempArray< T > newInstance() { return new TempArrayImpl<>( props ); } }
1614b245f49b9f9836dd728aee20394ff76fe855
a953ece8ff4a36e367d26d046d2ab056f2ccda4d
/2020/GTBIT/LevelUp/l001_Recursion/l002RecursionTrees.java
bb64bee4670602eb9d1412ab2630c2b728c51ae7
[]
no_license
SiyaKumari/pepcoding-Batches
2ae669bdae342159c408ca636a4ff9bfddad0e1d
59195aa355f704c0091b2f85bed200fb34c2448b
refs/heads/master
2023-05-06T08:58:37.784862
2021-05-22T07:58:47
2021-05-22T07:58:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
13,126
java
public class l002RecursionTrees { public static int permutationWithInfi(int[] arr, int tar, String ans) { if (tar == 0) { System.out.println(ans); return 1; } int count = 0; for (int ele : arr) { if (tar - ele >= 0) { count += permutationWithInfi(arr, tar - ele, ans + ele); } } return count; } public static int combinationWithInfi(int[] arr, int tar, int idx, String ans) { if (tar == 0) { System.out.println(ans); return 1; } int count = 0; for (int i = idx; i < arr.length; i++) { if (tar - arr[i] >= 0) count += combinationWithInfi(arr, tar - arr[i], i, ans + arr[i]); } return count; } public static int combinationWithSingle(int[] arr, int tar, int idx, String ans) { if (tar == 0) { System.out.println(ans); return 1; } int count = 0; for (int i = idx; i < arr.length; i++) { if (tar - arr[i] >= 0) count += combinationWithSingle(arr, tar - arr[i], i + 1, ans + arr[i]); } return count; } public static int permutationWithSingleCoin(int[] arr, int tar, String ans) { if (tar == 0) { System.out.println(ans); return 1; } int count = 0; for (int i = 0; i < arr.length; i++) { if (arr[i] > 0 && tar - arr[i] >= 0) { int val = arr[i]; arr[i] = -arr[i]; count += permutationWithSingleCoin(arr, tar - val, ans + val); arr[i] = -arr[i]; } } return count; } public static int permutationWithSingleCoin(int[] arr, boolean[] vis, int tar, String ans) { if (tar == 0) { System.out.println(ans); return 1; } int count = 0; for (int i = 0; i < arr.length; i++) { if (!vis[i] && tar - arr[i] >= 0) { vis[i] = true; count += permutationWithSingleCoin(arr, vis, tar - arr[i], ans + arr[i]); vis[i] = false; } } return count; } // ==================================================================================================== public static int permutationWithInfi_subSeq(int[] arr, int tar, int idx, String ans) { if (tar == 0 || idx == arr.length) { if (tar == 0) { System.out.println(ans); return 1; } return 0; } int count = 0; if (tar - arr[idx] >= 0) count += permutationWithInfi_subSeq(arr, tar - arr[idx], 0, ans + arr[idx]); count += permutationWithInfi_subSeq(arr, tar, idx + 1, ans); return count; } public static int combinationWithInfi_subSeq(int[] arr, int tar, int idx, String ans) { if (tar == 0 || idx == arr.length) { if (tar == 0) { System.out.println(ans); return 1; } return 0; } int count = 0; if (tar - arr[idx] >= 0) count += combinationWithInfi_subSeq(arr, tar - arr[idx], idx, ans + arr[idx]); count += combinationWithInfi_subSeq(arr, tar, idx + 1, ans); return count; } public static int combinationWithSingle_subSeq(int[] arr, int tar, int idx, String ans) { if (tar == 0 || idx == arr.length) { if (tar == 0) { System.out.println(ans); return 1; } return 0; } int count = 0; if (tar - arr[idx] >= 0) count += combinationWithSingle_subSeq(arr, tar - arr[idx], idx + 1, ans + arr[idx]); count += combinationWithSingle_subSeq(arr, tar, idx + 1, ans); return count; } public static int permutationWithSingleCoin_subSeq(int[] arr, int tar, int idx, String ans) { if (tar == 0 || idx == arr.length) { if (tar == 0) { System.out.println(ans); return 1; } return 0; } int count = 0; if (arr[idx] > 0 && tar - arr[idx] >= 0) { int val = arr[idx]; arr[idx] = -arr[idx]; count += permutationWithSingleCoin_subSeq(arr, tar - val, 0, ans + val); arr[idx] = -arr[idx]; } count += permutationWithSingleCoin_subSeq(arr, tar, idx + 1, ans); return count; } // 1D_Queen_Set================================================================================= // tboxes = total Bpxes, tqn = total queen, qpsf = queen placed so far, bn = // box_no, public static int queenCombination(int tboxe, int tqn, int qpsf, int bn, String ans) { if (qpsf == tqn) { System.out.println(ans); return 1; } int count = 0; for (int i = bn; i < tboxe; i++) { count += queenCombination(tboxe, tqn, qpsf + 1, i + 1, ans + "b" + i + "q" + qpsf + " "); } return count; } public static int queenPermutation(boolean[] tboxe, int tqn, int qpsf, int bn, String ans) { if (qpsf == tqn) { System.out.println(ans); return 1; } int count = 0; for (int i = bn; i < tboxe.length; i++) { if (!tboxe[i]) { tboxe[i] = true; count += queenPermutation(tboxe, tqn, qpsf + 1, 0, ans + "b" + i + "q" + qpsf + " "); tboxe[i] = false; } } return count; } // 2D_Queen_Set================================================================================= // tboxes = total Bpxes, tqn = total queen, qpsf = queen placed so far, bn = // box_no, public static int queenCombination2D(boolean[][] boxes, int tqn, int bn, String ans) { if (tqn == 0) { System.out.println(ans); return 1; } int n = boxes.length, m = boxes[0].length, count = 0; for (int i = bn; i < n * m; i++) { int r = i / m; int c = i % m; boxes[r][c] = true; count += queenCombination2D(boxes, tqn - 1, i + 1, ans + "(" + r + ", " + c + ") "); boxes[r][c] = false; } return count; } public static int queenPermutation2D(boolean[][] boxes, int tqn, int bn, String ans) { if (tqn == 0) { System.out.println(ans); return 1; } int n = boxes.length, m = boxes[0].length, count = 0; for (int i = bn; i < n * m; i++) { int r = i / m; int c = i % m; if (!boxes[r][c]) { boxes[r][c] = true; count += queenPermutation2D(boxes, tqn - 1, 0, ans + "(" + r + ", " + c + ") "); boxes[r][c] = false; } } return count; } // Nqueen Series.=================================================== public static boolean isSafeToPlaceQueen(boolean[][] boxes, int r, int c) { // int[][] dir = { { 0, -1 }, { -1, -1 }, { -1, 0 }, { -1, 1 } }; int[][] dir = { { 0, -1 }, { -1, -1 }, { -1, 0 }, { -1, 1 }, { 0, 1 }, { 1, 1 }, { 1, 0 }, { 1, -1 } }; int n = boxes.length, m = boxes[0].length; for (int d = 0; d < dir.length; d++) { for (int rad = 1; rad < n; rad++) { int x = r + rad * dir[d][0]; int y = c + rad * dir[d][1]; if (x >= 0 && y >= 0 && x < n && y < m) { if (boxes[x][y]) return false; } else break; } } return true; } public static int nqueen_Combination01(boolean[][] boxes, int tnq, int idx, String ans) { if (tnq == 0) { System.out.println(ans); return 1; } int n = boxes.length, m = boxes[0].length, count = 0; for (int i = idx; i < n * m; i++) { int r = i / m; int c = i % m; if (isSafeToPlaceQueen(boxes, r, c)) { boxes[r][c] = true; count += nqueen_Combination01(boxes, tnq - 1, i + 1, ans + "(" + r + ", " + c + ") "); boxes[r][c] = false; } } return count; } public static int nqueen_Permutation01(boolean[][] boxes, int tnq, int idx, String ans) { if (tnq == 0) { System.out.println(ans); return 1; } int n = boxes.length, m = boxes[0].length, count = 0; for (int i = idx; i < n * m; i++) { int r = i / m; int c = i % m; if (!boxes[r][c] && isSafeToPlaceQueen(boxes, r, c)) { boxes[r][c] = true; count += nqueen_Permutation01(boxes, tnq - 1, 0, ans + "(" + r + ", " + c + ") "); boxes[r][c] = false; } } return count; } public static int nqueen_Combination02(boolean[][] boxes, int tnq, int idx, String ans) { int n = boxes.length, m = boxes[0].length, count = 0; if (tnq == 0 || idx >= n * m) { if (tnq == 0) { System.out.println(ans); return 1; } return 0; } int r = idx / m; int c = idx % m; if (isSafeToPlaceQueen(boxes, r, c)) { boxes[r][c] = true; count += nqueen_Combination02(boxes, tnq - 1, idx + 1, ans + "(" + r + ", " + c + ") "); boxes[r][c] = false; } count += nqueen_Combination02(boxes, tnq, idx + 1, ans); return count; } static boolean[] rows; static boolean[] cols; static boolean[] diag; static boolean[] adiag; public static int nqueen_Combination03(int n, int m, int tnq, int idx, String ans) { if (tnq == 0) { System.out.println(ans); return 1; } int count = 0; for (int i = idx; i < n * m; i++) { int r = i / m; int c = i % m; if (!rows[r] && !cols[c] && !diag[r + c] && !adiag[r - c + m - 1]) { rows[r] = cols[c] = diag[r + c] = adiag[r - c + m - 1] = true; count += nqueen_Combination03(n, m, tnq - 1, i + 1, ans + "(" + r + ", " + c + ") "); rows[r] = cols[c] = diag[r + c] = adiag[r - c + m - 1] = false; } } return count; } public static int nqueen_Permutation03(int n, int m, int tnq, int idx, String ans) { if (tnq == 0) { System.out.println(ans); return 1; } int count = 0; for (int i = idx; i < n * m; i++) { int r = i / m; int c = i % m; if (!rows[r] && !cols[c] && !diag[r + c] && !adiag[r - c + m - 1]) { rows[r] = cols[c] = diag[r + c] = adiag[r - c + m - 1] = true; count += nqueen_Permutation03(n, m, tnq - 1, 0, ans + "(" + r + ", " + c + ") "); rows[r] = cols[c] = diag[r + c] = adiag[r - c + m - 1] = false; } } return count; } public static void Nqueen() { int n = 4, m = 4, q = 4; boolean[][] boxes = new boolean[n][m]; // System.out.println(nqueen_Combination01(boxes, q, 0, "")); // System.out.println(nqueen_Permutation01(boxes, q, 0, "")); // System.out.println(nqueen_Combination02(boxes, q, 0, "")); rows = new boolean[n]; cols = new boolean[m]; diag = new boolean[n + m - 1]; adiag = new boolean[n + m - 1]; System.out.println(nqueen_Combination03(n, m, q, 0, "")); } public static void coinChange() { int[] arr = { 2, 3, 5, 7 }; int tar = 10; // System.out.println(permutationWithInfi(arr, tar, "")); // System.out.println(coFmbinationWithInfi(arr, tar,0, "")); // System.out.println(combinationWithSingle(arr, tar, 0, "")); // System.out.println(permutationWithSingleCoin(arr, tar, "")); // System.out.println(permutationWithInfi_subSeq(arr, tar, 0, "")); // System.out.println(combinationWithInfi_subSeq(arr, tar, 0, "")); // System.out.println(combinationWithSingle_subSeq(arr, tar, 0, "")); // System.out.println(permutationWithSingleCoin_subSeq(arr, tar, 0, "")); } public static void queenSet() { // boolean[] boxes = new boolean[6]; // System.out.println(queenCombination(16, 4, 0, 0, "")); // System.out.println(queenPermutation(boxes, 4, 0, 0, "")); boolean[][] boxes = new boolean[4][4]; // System.out.println(queenCombination2D(boxes, 4, 0, "")); System.out.println(queenPermutation2D(boxes, 4, 0, "")); } public static void main(String[] args) { // queenSet(); Nqueen(); } }
bac83b147a8a237aac8d057df12cd541fe11e9d7
6c21ad59cb57e5cd525f79d880b12b0750179f27
/src/bloodmanagementmodels/Pessoa.java
45d720ff079e7b227433110ebd395c8599bba9b1
[]
no_license
IgorPereira1997/doa
7edab379c60151c5549bd0e4fdfe568082141eb3
5ee57f88af21e257d701cad6a8825571288ef710
refs/heads/master
2022-02-15T17:07:47.227143
2019-08-07T00:33:57
2019-08-07T00:33:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,820
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 bloodmanagementmodels; import java.time.LocalDate; /** * * @author Igor */ public class Pessoa { private double peso, altura; private String orgaoRG, adicionais, nome, uf, tipoS, fator_rh; private long cpf, rg, tel; private boolean doadorMedula, examesOK, fezExames; private LocalDate nascimento; public double getPeso() { return peso; } public void setPeso(double peso) { this.peso = peso; } public double getAltura() { return altura; } public void setAltura(double altura) { this.altura = altura; } public String getOrgaoRG() { return orgaoRG; } public void setOrgaoRG(String orgaoRG) { this.orgaoRG = orgaoRG; } public String getAdicionais() { return adicionais; } public void setAdicionais(String adicionais) { this.adicionais = adicionais; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public String getUf() { return uf; } public void setUf(String uf) { this.uf = uf; } public String getTipoS() { return tipoS; } public void setTipoS(String tipoS) { this.tipoS = tipoS; } public String getFator_rh() { return fator_rh; } public void setFator_rh(String fator_rh) { this.fator_rh = fator_rh; } public long getCpf() { return cpf; } public void setCpf(long cpf) { this.cpf = cpf; } public long getRg() { return rg; } public void setRg(long rg) { this.rg = rg; } public long getTel() { return tel; } public void setTel(long tel) { this.tel = tel; } public boolean isDoadorMedula() { return doadorMedula; } public void setDoadorMedula(boolean doadorMedula) { this.doadorMedula = doadorMedula; } public boolean isExamesOK() { return examesOK; } public void setExamesOK(boolean examesOK) { this.examesOK = examesOK; } public boolean isFezExames() { return fezExames; } public void setFezExames(boolean fezExames) { this.fezExames = fezExames; } public LocalDate getNascimento() { return nascimento; } public void setNascimento(LocalDate nascimento) { this.nascimento = nascimento; } }
f28e49187c24e0e1d2e362f7c34ccedf3c6338db
0af8b92686a58eb0b64e319b22411432aca7a8f3
/large-multiproject/project24/src/test/java/org/gradle/test/performance24_3/Test24_207.java
50dd68e1ca00914b44ccbbfb0805cbcac3ef84a6
[]
no_license
gradle/performance-comparisons
b0d38db37c326e0ce271abebdb3c91769b860799
e53dc7182fafcf9fedf07920cbbea8b40ee4eef4
refs/heads/master
2023-08-14T19:24:39.164276
2022-11-24T05:18:33
2022-11-24T05:18:33
80,121,268
17
15
null
2022-09-30T08:04:35
2017-01-26T14:25:33
null
UTF-8
Java
false
false
292
java
package org.gradle.test.performance24_3; import static org.junit.Assert.*; public class Test24_207 { private final Production24_207 production = new Production24_207("value"); @org.junit.Test public void test() { assertEquals(production.getProperty(), "value"); } }
9abd812ad0e2e3b7e916e83be939c2964c7ad80e
dc4b0c1cd5e45c779061ad477c6ff681206a7470
/app/src/main/java/com/example/ycx36/recruitment/view/activity/AddAttentionActivity.java
fe77c0e84f14b4844ac65662b741686fc22edd1c
[]
no_license
yangchengxue/Recruitmentxx
aa7def3275f1c3592e11d7ddbb5b58d211d35fe9
91bc0af49fb422b3afbc909fc3d463352f0e52aa
refs/heads/master
2020-05-09T14:04:47.284338
2019-05-17T14:33:30
2019-05-17T14:33:30
181,180,239
0
0
null
null
null
null
UTF-8
Java
false
false
5,262
java
package com.example.ycx36.recruitment.view.activity; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.inputmethod.InputMethodManager; import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; import com.avos.avoscloud.AVException; import com.avos.avoscloud.AVObject; import com.avos.avoscloud.AVQuery; import com.avos.avoscloud.AVUser; import com.avos.avoscloud.FindCallback; import com.avos.avoscloud.FollowCallback; import com.avos.avoscloud.GetCallback; import com.example.ycx36.recruitment.R; import com.example.ycx36.recruitment.util.LearnCloudSubclass_User; import com.example.ycx36.recruitment.util.learnCloudtest; import com.facebook.drawee.backends.pipeline.Fresco; import com.facebook.drawee.interfaces.DraweeController; import com.facebook.drawee.view.SimpleDraweeView; import com.facebook.imagepipeline.request.ImageRequest; import com.facebook.imagepipeline.request.ImageRequestBuilder; import java.util.List; import butterknife.BindView; import butterknife.ButterKnife; import scut.carson_ho.searchview.ICallBack; import scut.carson_ho.searchview.SearchView; import scut.carson_ho.searchview.bCallBack; public class AddAttentionActivity extends AppCompatActivity { @BindView(R.id.search_view) SearchView searchView; @BindView(R.id.userDraw) SimpleDraweeView userDraw; @BindView(R.id.tv_name) TextView tv_name; @BindView(R.id.tv_userNull) TextView tv_userNull; @BindView(R.id.userRelativeLayout) RelativeLayout userRelativeLayout; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_attention); ButterKnife.bind(this); searchView.setOnClickSearch(new ICallBack() { @Override public void SearchAciton(String string) { AVQuery<LearnCloudSubclass_User> query = AVObject.getQuery(LearnCloudSubclass_User.class); query.whereEqualTo("username",string); query.findInBackground(new FindCallback<LearnCloudSubclass_User>() { @Override public void done(List<LearnCloudSubclass_User> results, AVException e) { if (results.size() != 0) { for (final LearnCloudSubclass_User a : results) { final String userName = a.getUsername(); tv_name.setText(userName); tv_userNull.setVisibility(View.GONE); userRelativeLayout.setVisibility(View.VISIBLE); userDraw.setVisibility(View.VISIBLE); if (a.getuserPhotoUri() != null) { showUserPhoto(a.getuserPhotoUri(), userDraw); } userRelativeLayout.setOnClickListener(new View.OnClickListener(){ public void onClick(View view){ // FocusPerson(a.getObjectId()); //点击关注 Intent intent = new Intent(AddAttentionActivity.this,UserDetailInfoActivity.class); Bundle bundle = new Bundle(); bundle.putString("userObjectId",a.getObjectId()); bundle.putString("userName",userName); intent.putExtras(bundle); startActivity(intent); } }); } } else { tv_userNull.setVisibility(View.VISIBLE); userDraw.setVisibility(View.INVISIBLE); userRelativeLayout.setVisibility(View.INVISIBLE); } } }); InputMethodManager m=(InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); m.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS); } }); // 5. 设置点击返回按键后的操作(通过回调接口) searchView.setOnClickBack(new bCallBack() { @Override public void BackAciton() { finish(); } }); } public void showUserPhoto(String path, SimpleDraweeView Dview) { Uri uri = Uri.parse(path); ImageRequest request = ImageRequestBuilder.newBuilderWithSource(uri) .setLocalThumbnailPreviewsEnabled(true) .build(); DraweeController controller = Fresco.newDraweeControllerBuilder() .setImageRequest(request) .build(); Dview.setController(controller); } }
12166a404fdddd147a3abfeb06b0346d5479773c
701ed7de0862037fd09372e2365f608964889d3d
/src/empresa/EmpleadoTest.java
2f3d3def9feb287a7e40d90edbe3831bf74050b7
[]
no_license
Cristian2301/Objetos2Empresa
ef3e84d21071697a2fc4b2421871b611ca4a1000
9f9d073a1430c5179a151fcd4c99a96ee130e130
refs/heads/master
2020-05-05T05:00:03.408881
2019-04-08T20:04:58
2019-04-08T20:04:58
179,734,034
0
0
null
null
null
null
UTF-8
Java
false
false
1,175
java
package empresa; import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; class EmpleadoTest { Empleado empleado; @BeforeEach void setUp() throws Exception{ empleado = new Empleado("Jose", 212, true, 99, 12000); } @Test void testGetNombre() { assertTrue(empleado.getNombre() == "Jose"); } @Test void testSetNombre() { fail("Not yet implemented"); } @Test void testGetDireccion() { fail("Not yet implemented"); } @Test void testSetDireccion() { fail("Not yet implemented"); } @Test void testGetCasado() { fail("Not yet implemented"); } @Test void testSetCasado() { fail("Not yet implemented"); } @Test void testGetFechaNacimiento() { fail("Not yet implemented"); } @Test void testSetFechaNacimiento() { fail("Not yet implemented"); } @Test void testGetSueldoBasico() { fail("Not yet implemented"); } @Test void testSetSueldoBasico() { fail("Not yet implemented"); } @Test void testGetEdad() { fail("Not yet implemented"); } @Test void testEmpleado() { fail("Not yet implemented"); } }
3feb19d9d351bf1fc109ac2c19aff0470fd55e3e
fa1408365e2e3f372aa61e7d1e5ea5afcd652199
/src/testcases/CWE369_Divide_by_Zero/s02/CWE369_Divide_by_Zero__int_connect_tcp_modulo_61b.java
65ef67f9bf7ea2f11d8e7060333ccab03104fa79
[]
no_license
bqcuong/Juliet-Test-Case
31e9c89c27bf54a07b7ba547eddd029287b2e191
e770f1c3969be76fdba5d7760e036f9ba060957d
refs/heads/master
2020-07-17T14:51:49.610703
2019-09-03T16:22:58
2019-09-03T16:22:58
206,039,578
1
2
null
null
null
null
UTF-8
Java
false
false
7,085
java
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE369_Divide_by_Zero__int_connect_tcp_modulo_61b.java Label Definition File: CWE369_Divide_by_Zero__int.label.xml Template File: sources-sinks-61b.tmpl.java */ /* * @description * CWE: 369 Divide by zero * BadSource: connect_tcp Read data using an outbound tcp connection * GoodSource: A hardcoded non-zero, non-min, non-max, even number * Sinks: modulo * GoodSink: Check for zero before modulo * BadSink : Modulo by a value that may be zero * Flow Variant: 61 Data flow: data returned from one method to another in different classes in the same package * * */ package testcases.CWE369_Divide_by_Zero.s02; import testcasesupport.*; import javax.servlet.http.*; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; import java.net.Socket; import java.util.logging.Level; public class CWE369_Divide_by_Zero__int_connect_tcp_modulo_61b { public int badSource() throws Throwable { int data; data = Integer.MIN_VALUE; /* Initialize data */ /* Read data using an outbound tcp connection */ { Socket socket = null; BufferedReader readerBuffered = null; InputStreamReader readerInputStream = null; try { /* Read data using an outbound tcp connection */ socket = new Socket("host.example.org", 39544); /* read input from socket */ readerInputStream = new InputStreamReader(socket.getInputStream(), "UTF-8"); readerBuffered = new BufferedReader(readerInputStream); /* POTENTIAL FLAW: Read data using an outbound tcp connection */ String stringNumber = readerBuffered.readLine(); if (stringNumber != null) /* avoid NPD incidental warnings */ { try { data = Integer.parseInt(stringNumber.trim()); } catch(NumberFormatException exceptNumberFormat) { IO.logger.log(Level.WARNING, "Number format exception parsing data from string", exceptNumberFormat); } } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error with stream reading", exceptIO); } finally { /* clean up stream reading objects */ try { if (readerBuffered != null) { readerBuffered.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing BufferedReader", exceptIO); } try { if (readerInputStream != null) { readerInputStream.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing InputStreamReader", exceptIO); } /* clean up socket objects */ try { if (socket != null) { socket.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing Socket", exceptIO); } } } return data; } /* goodG2B() - use goodsource and badsink */ public int goodG2BSource() throws Throwable { int data; /* FIX: Use a hardcoded number that won't cause underflow, overflow, divide by zero, or loss-of-precision issues */ data = 2; return data; } /* goodB2G() - use badsource and goodsink */ public int goodB2GSource() throws Throwable { int data; data = Integer.MIN_VALUE; /* Initialize data */ /* Read data using an outbound tcp connection */ { Socket socket = null; BufferedReader readerBuffered = null; InputStreamReader readerInputStream = null; try { /* Read data using an outbound tcp connection */ socket = new Socket("host.example.org", 39544); /* read input from socket */ readerInputStream = new InputStreamReader(socket.getInputStream(), "UTF-8"); readerBuffered = new BufferedReader(readerInputStream); /* POTENTIAL FLAW: Read data using an outbound tcp connection */ String stringNumber = readerBuffered.readLine(); if (stringNumber != null) /* avoid NPD incidental warnings */ { try { data = Integer.parseInt(stringNumber.trim()); } catch(NumberFormatException exceptNumberFormat) { IO.logger.log(Level.WARNING, "Number format exception parsing data from string", exceptNumberFormat); } } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error with stream reading", exceptIO); } finally { /* clean up stream reading objects */ try { if (readerBuffered != null) { readerBuffered.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing BufferedReader", exceptIO); } try { if (readerInputStream != null) { readerInputStream.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing InputStreamReader", exceptIO); } /* clean up socket objects */ try { if (socket != null) { socket.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing Socket", exceptIO); } } } return data; } }
845aa1854c17cd943738c6dccbcf7febaf026516
082e4d7b73248fda2e39e742e7a59d5b3d8672ad
/src/main/java/com/community/gateway/logical/BusinessLogical.java
c344edccf24e49593502e77955cd24b92eda286d
[]
no_license
kannanr26/Gateway
6141fdfad75983e2f4dc4c36df86a428e4659642
b5592a631008f711d52544eceac00195dff57e65
refs/heads/master
2021-05-27T12:59:10.902341
2020-05-01T07:14:03
2020-05-01T07:14:03
254,268,987
0
1
null
2020-05-01T07:14:05
2020-04-09T04:14:03
Java
UTF-8
Java
false
false
601
java
package com.community.gateway.logical; import java.util.List; import javax.validation.Valid; import com.community.gateway.dto.BusinessDTO; import com.community.gateway.exception.ResourceNotFoundException; public interface BusinessLogical { List<BusinessDTO> findAll(); BusinessDTO findById(Long businessId)throws ResourceNotFoundException; BusinessDTO findByBusinessName(String business)throws ResourceNotFoundException; //BusinessDTO save(@Valid Business businessDTO); void delete(Long businessId) throws ResourceNotFoundException; BusinessDTO save(@Valid BusinessDTO businessDto); }
0581092d0cdd74b6b5eed300678f440b05152b86
961598004e7e103c0e9dfaf98fb5c611a73f9d38
/src/java/bladwin/web/videoMgrObjMenu.java
065fdef5a4f4a8ed3cda15773ddd15608246f8ee
[]
no_license
jozzell/CraftBeer
76092e56f72756903388ada9bbf8666e04b8648e
0d65ea924041a4a988434ac6238b49768ecf06b4
refs/heads/master
2021-01-01T05:25:59.290532
2016-04-14T15:21:14
2016-04-14T15:21:14
56,244,931
0
0
null
null
null
null
UTF-8
Java
false
false
5,478
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 bladwin.web; import java.io.Serializable; import jvp.obj.eNum.eNumVideoIDs; /** * * @author lmeans */ public class videoMgrObjMenu implements Serializable{ videoMgrObjMenuInterface iface; public videoMgrObjMenu(videoMgrObjMenuInterface i){ iface = i; } // ============================== public void setTrackClubIndoor(){ iface.setVideoType(eNumVideoIDs.TrackClubIndoor); //iface.setVideoType(97,"Baldwin Blazers (Indoor)"); } public void setTrackClubOutdoor(){ iface.setVideoType(eNumVideoIDs.TrackClubOutdoor); //iface.setVideoType(1113,"Baldwin Blazers (Outdoor)"); } public void setTrackClubAAU(){ iface.setVideoType(eNumVideoIDs.TrackClubAAU); //iface.setVideoType(1114,"Baldwin Blazers (AAU)"); } public void calEOC(){ iface.setVideoType(eNumVideoIDs.EOC); //iface.setVideoType(1107, "cal/church_EOC.xhtml"); } public void calFirst(){ iface.setVideoType(eNumVideoIDs.FirstBaptist); //iface.setVideoType(1106, "Royal Priesthool (Anniversary)"); } public void calFirst2009(){ iface.setVideoType(eNumVideoIDs.FirstBaptist2009); //iface.setVideoType(1206, "Gospel Concert (2010)"); } public void calFirst2014XMas(){ iface.setVideoType(eNumVideoIDs.FirstBaptist2014XMas); //iface.setVideoType(1206, "Gospel Concert (2010)"); } public void calMount(){ iface.setVideoType(eNumVideoIDs.MountOlive); //iface.setVideoType(1105, "cal/church_mtolive.xhtml"); } // ============================== public void setHearAndNow(){ iface.setVideoType(eNumVideoIDs.HearAndNow); //iface.setVideoType(107,"Jozzell Video Production"); } public void setShirley(){ iface.setVideoType(eNumVideoIDs.ShirleyPublicAccess); //iface.setVideoType(108,"Jozzell Video Production"); } // ============================== public void setVideoSports(){ iface.setVideoType(eNumVideoIDs.VideoSports); //iface.setVideoType(102,"Football Highlight Real"); } public void setVideoSportsGame(){ iface.setVideoType(eNumVideoIDs.VideoSportsGame); //iface.setVideoType(106,"Jozzell Video Production"); } // ============================== public void setHome(){ iface.setHome(); //iface.setVideoType(101,"Events"); } public void setVideoSweet16(){ iface.setVideoType(eNumVideoIDs.VideoSweet16); //iface.setVideoType(100,"Jozzell Video Production"); } public void setEventsRedCarpet(){ iface.setVideoType(eNumVideoIDs.EventsRedCarpet); // iface.setVideoType(105,"Jozzell Video Production"); } // ============================== public void setCommunityPicnic(){ iface.setVideoType(eNumVideoIDs.CommunityPicnic); // iface.setVideoType(103,"Jozzell Video Production"); } public void setCommunityAwardCeremony(){ iface.setVideoType(eNumVideoIDs.CommunityAwardCeremony); // iface.setVideoType(104,"Jozzell Video Production"); } // ============================== public void setMsRucker(){ iface.setVideoType(eNumVideoIDs.MsRucker); //iface.setVideoType(201,"Jozzell Video Production"); } public void setMrClean(){ iface.setVideoType(eNumVideoIDs.MrClean); //iface.setVideoType(200,"Jozzell Video Production"); } public void setAnaysha(){ iface.setVideoType(eNumVideoIDs.Anaysha); //iface.setVideoType(202,"Jozzell Video Production"); } public void set22nd(){ iface.setVideoType(eNumVideoIDs.VOI22nd); //iface.setVideoType(203,"22nd Anniversary (2011)" ); } public void set23nd(){ iface.setVideoType(eNumVideoIDs.VOI23nd); //iface.setVideoType(204,"23rd Anniversary (2012)"); } public void set24nd(){ iface.setVideoType(eNumVideoIDs.VOI24nd); //iface.setVideoType(205,"24th Anniversary (2013)"); } public void set25nd(){ iface.setVideoType(eNumVideoIDs.VOI25nd); //iface.setVideoType(99,"25th Anniversary (2014) Brooklyn Marriott"); } public void set26nd(){ iface.setVideoType(eNumVideoIDs.VOI26nd); //iface.setVideoType(98,"26th Anniversary (2015)"); } // ============================== public void setSpinMain(){ iface.setVideoType(eNumVideoIDs.SpinMain); //iface.setVideoType(206,"Jozzell Video Production"); } public void setSpinBonus(){ iface.setVideoType(eNumVideoIDs.SpinBonus); //iface.setVideoType(208,"Jozzell Video Production"); } public void setLeone(){ iface.setVideoType(eNumVideoIDs.Leone); //iface.setVideoType(207,"Jozzell Video Production"); } // ============================== public void setAdds(){ iface.setVideoType(eNumVideoIDs.Adds); //iface.setVideoType(210,"Jozzell Video Production"); } }
086072bcd5cda05ec257c4929dc563e996130964
801f14d01ac16144175e0c9f610ed9f6f6203f36
/demo-server-three/src/main/java/com/demo/demoserverthree/DemoServerThreeApplication.java
06c429b63f2e128fc0063a37b9858419bd8543bf
[]
no_license
javazk/CloudDemo
48c4ea9d30a91c06f70c6c3442c6eda4f379da38
671a916ee77ff677e68f55a7cc47c746cc01b14c
refs/heads/master
2020-05-18T05:26:57.626282
2019-05-17T08:15:30
2019-05-17T08:15:30
184,207,330
0
0
null
null
null
null
UTF-8
Java
false
false
435
java
package com.demo.demoserverthree; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.EnableEurekaClient; @SpringBootApplication @EnableEurekaClient public class DemoServerThreeApplication { public static void main(String[] args) { SpringApplication.run(DemoServerThreeApplication.class, args); } }
f0f7587ccb96b94196f4cec7ee213c0b681563b6
eea662c5b274ab75b9b982b63006ab5c7bda5b96
/src/main/java/fire/web/service/AssignmentService.java
2775a138c3106806f14c39d3415326f10939242f
[]
no_license
tynr426/fire
ebec94145eac9cd0aedd695f18426d35acf40c5d
0361380becad3a1526f50b2807606402638c5115
refs/heads/master
2021-09-12T23:19:20.071306
2018-04-22T14:24:17
2018-04-22T14:24:17
103,547,542
0
0
null
null
null
null
UTF-8
Java
false
false
877
java
package fire.web.service; import java.util.List; import fire.common.entity.Assignment; import fire.common.entity.AssignmentResult; import fire.common.entity.RepairrecordResult; import fire.common.entity.StatusStatistics; import fire.web.utils.PageInfo; public interface AssignmentService { public Assignment getAssignment(int id); public int deleteAssignment(int id); public PageInfo<AssignmentResult> getAssignmentPage(int companyId,int index,int size); public PageInfo<AssignmentResult> getAssignmentPageByManager(int companyId,int managerId,int index,int size,Integer status,String keyword); public List<StatusStatistics> getStatistics(int managerId,Integer status,String keyword); public int updateStatus(Integer id, Integer status); public int save(Assignment entity); public AssignmentResult getAssignmentByCheckId(int checkId); }
[ "pc@F0X0W2J6PRGKFTO" ]
pc@F0X0W2J6PRGKFTO
3f1a6c770b6daad2931caf43a76926af74d847cc
0da17db519564eea8851d7cbe8c8e1a1517fc098
/app/src/androidTest/java/com/example/dhaval/assignment2d/ExampleInstrumentedTest.java
f4321d046b6cf0b4828e38519118b603f8fde0e4
[]
no_license
appyshah08/Assignment2d
37b0ba49f39af8485c0daf562f5f246b70e1e991
0a869488ec8d6d94a3a95d4ab9f57cb6cd87c00a
refs/heads/master
2021-01-18T13:50:49.088016
2017-03-08T15:44:59
2017-03-08T15:44:59
84,337,620
0
0
null
null
null
null
UTF-8
Java
false
false
766
java
package com.example.dhaval.assignment2d; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumentation test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.example.dhaval.assignment2d", appContext.getPackageName()); } }
b5f2862473cdd2eafe7f87e6acf6f8c6d127b617
6d9ab866292db7e117973b7abc5ea68cd61ac988
/app/src/androidTest/java/com/example/ddizoya/cambiosactivitis/ApplicationTest.java
22668089883c32b6a0c834c7da32db72676fb1b8
[]
no_license
ddizoya/CambiosActivitisYFragments
a43953274397657d27fc2da2920641b9c3c80e58
a223978d99668df7e0b59e065e6019b72a241736
refs/heads/master
2021-01-10T11:54:27.543993
2015-12-02T09:53:19
2015-12-02T09:53:19
46,926,819
0
0
null
null
null
null
UTF-8
Java
false
false
367
java
package com.example.ddizoya.cambiosactivitis; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
e1066ff3afd6026ca4ec0c4af21d1ca77f3f96f4
ce7e36aab52cfbf7c331ad1a7b3bdaab325cfcfa
/hawkular-wildfly-agent/src/main/java/org/hawkular/agent/monitor/extension/RemoteJMXAttributes.java
19a666c49c97c63659686890003ddd39b70765b9
[ "Apache-2.0" ]
permissive
tsegismont/hawkular-agent
74fde96fbf4450cfd1dc4b1c3c613dba65e2087c
9e3f649e7d8a1aedb301abbbd17962cb9920b3f9
refs/heads/master
2021-01-15T11:57:51.506127
2016-01-29T22:15:57
2016-01-29T22:15:57
44,375,757
0
0
null
2015-10-16T09:32:30
2015-10-16T09:32:29
null
UTF-8
Java
false
false
3,027
java
/* * Copyright 2015 Red Hat, Inc. and/or its affiliates * and other contributors as indicated by the @author tags. * * 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.hawkular.agent.monitor.extension; import org.jboss.as.controller.AttributeDefinition; import org.jboss.as.controller.SimpleAttributeDefinition; import org.jboss.as.controller.SimpleAttributeDefinitionBuilder; import org.jboss.as.controller.registry.AttributeAccess; import org.jboss.dmr.ModelNode; import org.jboss.dmr.ModelType; public interface RemoteJMXAttributes { SimpleAttributeDefinition ENABLED = new SimpleAttributeDefinitionBuilder("enabled", ModelType.BOOLEAN) .setAllowNull(true) .setDefaultValue(new ModelNode(true)) .setAllowExpression(true) .addFlag(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .build(); SimpleAttributeDefinition URL = new SimpleAttributeDefinitionBuilder("url", ModelType.STRING) .setAllowNull(false) .setAllowExpression(true) .addFlag(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .build(); SimpleAttributeDefinition USERNAME = new SimpleAttributeDefinitionBuilder("username", ModelType.STRING) .setAllowNull(true) .setAllowExpression(true) .addFlag(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .build(); SimpleAttributeDefinition PASSWORD = new SimpleAttributeDefinitionBuilder("password", ModelType.STRING) .setAllowNull(true) .setAllowExpression(true) .addFlag(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .build(); SimpleAttributeDefinition SECURITY_REALM = new SimpleAttributeDefinitionBuilder("securityRealm", ModelType.STRING) .setAllowNull(true) .setAllowExpression(true) .addFlag(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .build(); SimpleAttributeDefinition RESOURCE_TYPE_SETS = new SimpleAttributeDefinitionBuilder( "resourceTypeSets", ModelType.STRING) .setAllowNull(true) .setAllowExpression(true) .addFlag(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .build(); AttributeDefinition[] ATTRIBUTES = { ENABLED, URL, USERNAME, PASSWORD, SECURITY_REALM, RESOURCE_TYPE_SETS }; }
815d2a052594d536dd572dc1df0a45ba0386a3a5
ddea8173323ac30db7f605fdc48de5452691048a
/src/testCases/Planner.java
33ce1d80082ebc029a90ac4e1965d20426ac33b9
[]
no_license
Hybrent-QA/Hybrent-Web
c4ab4cf2647fdd0f7013fd3058aefe71c1740369
502cd2391c9009e4df6dc73cb2906b5bd2ed0e9f
refs/heads/master
2020-03-24T20:37:38.653183
2018-08-01T10:03:22
2018-08-01T10:03:22
142,988,347
0
0
null
null
null
null
UTF-8
Java
false
false
3,532
java
package testCases; import java.io.File; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; import org.testng.annotations.Parameters; import org.testng.annotations.Test; import com.relevantcodes.extentreports.ExtentReports; import pageObject.Loginpage; import pageObject.PrefcardPageObject; import AutomationFramework.ApplicationKeyword; import AutomationFramework.Generickeywords; import AutomationFramework.OR; public class Planner extends ApplicationKeyword { public static String fullName; @Parameters({"siteName", "siteUrl"}) @BeforeTest public void startReport(String siteName, String siteUrl) { try { Loginpage.URL=siteUrl + "#/login/"; Generickeywords.SITENAME=siteName; Generickeywords.DashBoardURL=siteUrl + "#/dashboard"; String folderPath=OutputDirectory + "/" + siteName; File directory = new File(folderPath); if (! directory.exists()){ directory.mkdir(); // If you require it to make the entire directory path including parents, // use directory.mkdirs(); here instead. } extent = new ExtentReports(folderPath+"/planner.html", true); // extent.addSystemInfo("Environment","Environment Name") extent.addSystemInfo("User Name", "Ravneet"); extent.loadConfig(new File(System.getProperty("user.dir") + "/extent-config.xml")); } catch (Exception e) { System.out.println("--Start REPORT-Cases-Error---" + e.toString()); } } @Test public void Tc_Planner_01() throws InterruptedException { testStarts("Tc_Planner_01", "Verify that user can add patient using Add Patient option."); Loginpage.OpenBrowserAndLogin(); System.out.println("Tc_Planner_01"); PrefcardPageObject.plannerPageLinkandwait(); String facility_Name=getText(OR.Patient_getfacilityName); clickOn(OR.Planner_createPatient); //verifyElementText(OR.Planner_popUpText, "Create Patient "); String firstName="Test1"; String lastName="Patient1"; typeIn(OR.Patient_firstName, firstName); //typeIn(OR.Patient_middleName, "Pat"); typeIn(OR.Patient_lastName, lastName); typeIn(OR.Patient_mrnNumber, "00001"); typeIn(OR.Patient_accNumber, "465000"); typeIn(OR.Patient_dob, "11112017"); clickOn(OR.Patient_facDropDown); WebElement elem=driver.findElement(By.xpath("//li[@class='ui-select-choices-group']//span[text()='"+facility_Name+"']")); elem.click(); clickOn(OR.Planner_AddPatient); Thread.sleep(4000); //waitForElementToDisplayWithoutFail(OR.Patient_firstPatient, 10); PrefcardPageObject.patientsPageLinkandwait(); typeIn(OR.Patient_searchTextBox, firstName+" "+lastName); clickOn(OR.Patient_searchbutton); waitForElementToDisplayWithoutFail(OR.Patient_firstPatient, 20); verifyElement(OR.Patient_firstPatient); String patientName=getText(OR.Patient_firstPatient); String finalName=patientName.substring(2).trim(); if(finalName.equals(firstName+" "+lastName)) { testLogPass("New Patient is added"); } else { testLogFail("New Patient is not added"); } } @Test public void Tc_Planner_02() { testStarts("Tc_Planner_02", "Verify that case can be created by clicking on the calendar vie."); System.out.println("Tc_Planner_01"); NavigateUrl(DashBoardURL); PrefcardPageObject.plannerPageLinkandwait(); clickOn(OR.Planner_datatime630); verifyElementText(OR.Planner_createCaseHeading, "Schedule Case -"); } @AfterTest public void endReport() { closeBrowser(); extent.flush(); } }
cf9fea5bb74d88e39a84812e3f7a1179938676b0
7b8817da7eba394c6c2357a436b759b2f1894102
/kth-mybatis/src/main/java/org/kpu/myweb/controller/MemberController.java
b17df93b6f7b1259c34cd81d6bb5ed3eb15186e7
[]
no_license
thoonk/FrameworkProgramming
5ae466216e996ebbe6bbe98951e5bc666897ea53
ea760d559869d8801025f655b36e3d32b1823f4e
refs/heads/master
2022-12-21T11:28:37.792126
2020-06-13T05:03:14
2020-06-13T05:03:14
249,359,811
2
0
null
2022-12-16T15:26:39
2020-03-23T07:10:43
Java
UTF-8
Java
false
false
3,292
java
package org.kpu.myweb.controller; import java.util.List; import org.kpu.myweb.domain.StudentVO; import org.kpu.myweb.service.MemberService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; @Controller @RequestMapping(value="/member") public class MemberController { @Autowired private MemberService memberService; private static final Logger logger = LoggerFactory.getLogger(MemberController.class); @RequestMapping(value = {"/list"}, method = RequestMethod.GET) public String listMember(Model model) throws Exception { List<StudentVO> students = memberService.readMemberList(); logger.info(" /member/list URL called. then listMemebr method executed."); model.addAttribute("students", students); return "member/member_list"; } @RequestMapping(value = "/read", method = RequestMethod.GET) public String readMember(@RequestParam("id") String id, Model model) throws Exception { StudentVO student = memberService.readMember(id); logger.info(" /read?id=kang URL called. then readMemebr method executed."); model.addAttribute("student", student); return "member/member_read"; } @RequestMapping(value = {"/register"}, method = RequestMethod.GET) public String createMemberGet() throws Exception { logger.info(" /register URL GET method called. then forward member_register.jsp."); return "member/member_register"; } @RequestMapping(value = {"/register"}, method = RequestMethod.POST) public String createMemberPost( @ModelAttribute("student") StudentVO vo) throws Exception { memberService.addMember(vo); logger.info(vo.toString()); logger.info(" /register URL POST method called. then createMember method executed."); return "redirect:/member/list"; } @RequestMapping(value = "/modify", method = RequestMethod.GET) public String modifyMemberGet(@RequestParam("id") String id, Model model) throws Exception { StudentVO student = memberService.readMember(id); logger.info(" /modify?id=kang URL GET method called. then forward member_modify.jsp."); model.addAttribute("student", student); return "member/member_modify"; } @RequestMapping(value = "/modify", method = RequestMethod.POST) public String modifyMemberPost(@ModelAttribute("student") StudentVO vo) throws Exception { memberService.updateMember(vo); logger.info(vo.toString()); logger.info(" /modify?id=kang URL POST method called. then modifyMemberPost method executed."); return "redirect:/member/list"; } /* MemberControllerAdvice에 예외처리 기능적용 @ExceptionHandler(DataNotFoundException.class) public String handleException(DataNotFoundException e) { return "member/not_found"; } */ }
7c8e5612959a94fdfdd58fb78438a84615c4bff1
dfd7e70936b123ee98e8a2d34ef41e4260ec3ade
/analysis/reverse-engineering/decompile-fitts-20191031-2200/sources/com/crashlytics/android/core/AppMeasurementEventListenerRegistrar.java
a72268cb39027f0840668348dc2085c8a188b5ed
[ "Apache-2.0" ]
permissive
skkuse-adv/2019Fall_team2
2d4f75bc793368faac4ca8a2916b081ad49b7283
3ea84c6be39855f54634a7f9b1093e80893886eb
refs/heads/master
2020-08-07T03:41:11.447376
2019-12-21T04:06:34
2019-12-21T04:06:34
213,271,174
5
5
Apache-2.0
2019-12-12T09:15:32
2019-10-07T01:18:59
Java
UTF-8
Java
false
false
119
java
package com.crashlytics.android.core; interface AppMeasurementEventListenerRegistrar { boolean register(); }
23c808245640f159e57f8017ba03b607e20b2cf1
5e7c62c1940e9454f3fea7120eeb9e19354d5aac
/src/main/java/org/tuckey/web/filters/urlrewrite/RewrittenUrlClass.java
556833e9d9d6662cb79e89ac06ab5f5e2d9693b8
[ "BSD-3-Clause" ]
permissive
paultuckey/urlrewritefilter
554556a0636f90973376fd68693faa986dd100d3
2a672cd260a1f36088a5e6f2afbf6c808fc3b016
refs/heads/main
2023-08-28T18:28:13.578228
2023-07-17T22:52:35
2023-07-17T22:52:35
38,586,425
362
167
NOASSERTION
2023-07-17T22:52:37
2015-07-05T22:25:22
Java
UTF-8
Java
false
false
2,890
java
/** * Copyright (c) 2005-2023, Paul Tuckey * All rights reserved. * ==================================================================== * Licensed under the BSD License. Text as follows. * <p> * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * <p> * - Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * - Neither the name tuckey.org nor the names of its contributors * may be used to endorse or promote products derived from this * software without specific prior written permission. * <p> * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * ==================================================================== */ package org.tuckey.web.filters.urlrewrite; import org.tuckey.web.filters.urlrewrite.extend.RewriteMatch; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.FilterChain; import jakarta.servlet.ServletException; import java.io.IOException; /** * A rewrite target that is acually rewriting the url to a class a user has specified. */ class RewrittenUrlClass implements RewrittenUrl { RewriteMatch rewriteMatch; private String matchingUrl; protected RewrittenUrlClass(RewriteMatch rewriteMatch) { this.matchingUrl = rewriteMatch.getMatchingUrl(); this.rewriteMatch = rewriteMatch; } public boolean doRewrite(final HttpServletRequest hsRequest, final HttpServletResponse hsResponse, final FilterChain chain) throws IOException, ServletException { return rewriteMatch.execute(hsRequest, hsResponse); } public String getTarget() { return matchingUrl; } }
ec893af64b13f61fc2eb27a373116df40c5055be
cd066aa3e4122a944cfea92ad6d2a42a5001941e
/mainmodule/src/main/java/com/sxr/com/mainmodule/fragment/CircleFragment.java
3ce1c049f83d0a1a1c8303e189352c65ee4181a6
[]
no_license
sxrCode/adselflx1
b9c57616c619779ecae0dd1ecbb09ef67d42482c
9cd981237092222185c098563e88276ac39d5dd2
refs/heads/master
2021-10-10T18:41:04.704584
2019-01-15T12:15:34
2019-01-15T12:15:34
110,767,959
0
0
null
null
null
null
UTF-8
Java
false
false
762
java
package com.sxr.com.mainmodule.fragment; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.sxr.com.mainmodule.R; import com.sxr.com.mainmodule.view.CircleView; public class CircleFragment extends Fragment { private CircleView mCircleView; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_circle, container, false); mCircleView = view.findViewById(R.id.circle); mCircleView.setRate(80); return view; } }
7af614459f0cb73fbea873e46938793015ae9957
3449cc2feeaa0d6ffe5075032e424be3ccbd1733
/src/main/java/org/sonatype/nexus/plugins/crowd/client/rest/RestException.java
43698f6e1b963c5b16d1fa1250937d5f80fe0112
[]
no_license
PatrickRoumanoff/nexus-crowd-plugin
6018cf3a3e0a6a1096847a9a1f3424321b9b20fa
f01e277627dde36eed6413759340e63b66e5ab00
refs/heads/master
2023-07-06T19:36:47.922149
2023-06-28T16:55:52
2023-06-28T16:55:52
4,085,009
22
15
null
2021-09-27T13:06:32
2012-04-20T09:32:38
Java
UTF-8
Java
false
false
1,233
java
/* * This program is licensed to you under the Apache License Version 2.0, * and you may not use this file except in compliance with the Apache License Version 2.0. * You may obtain a copy of the Apache License Version 2.0 at http://www.apache.org/licenses/LICENSE-2.0. * * Unless required by applicable law or agreed to in writing, * software distributed under the Apache License Version 2.0 is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Apache License Version 2.0 for the specific language governing permissions and limitations there under. */ package org.sonatype.nexus.plugins.crowd.client.rest; public class RestException extends Exception { private static final long serialVersionUID = 8299574203640049391L; public RestException() { super(); } public RestException(String message) { super(message); } public RestException(Throwable cause) { super(cause); } public RestException(String message, Throwable cause) { super(message, cause); } public RestException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { super(message, cause, enableSuppression, writableStackTrace); } }
499392a493889c715806e7697105bb9358166172
7d8576d2276f952c466b99eb7ff978fbd3808beb
/src/main/java/com/how2java/tmall/pojo/Order.java
001b5e8321ce615d049605b8980d21111b1501bb
[]
no_license
dayo0107/tmall_ssm_generator
783cac45ad7bdbf3508eb04f4c5fbe616ce5bdce
b64469ae35bc09cc6b27daf421db4067d05c4022
refs/heads/master
2020-03-27T03:23:45.615423
2018-09-12T16:32:18
2018-09-12T16:32:18
145,859,377
0
0
null
null
null
null
UTF-8
Java
false
false
4,215
java
package com.how2java.tmall.pojo; import com.how2java.tmall.service.OrderService; import java.util.Date; import java.util.List; public class Order { private Integer id; private String orderCode; private String address; private String post; private String receiver; private String mobile; private String userMessage; private Date createDate; private Date payDate; private Date deliveryDate; private Date confirmDate; private Integer uid; private String status; /*非数据库字段*/ private List<OrderItem> orderItems; private User user; private float total; private int totalNumber; public String getStatusDesc(){ String desc ="未知"; switch(status){ case OrderService.waitPay: desc="待付款"; break; case OrderService.waitDelivery: desc="待发货"; break; case OrderService.waitConfirm: desc="待收货"; break; case OrderService.waitReview: desc="等评价"; break; case OrderService.finish: desc="完成"; break; case OrderService.delete: desc="刪除"; break; default: desc="未知"; } return desc; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getOrderCode() { return orderCode; } public void setOrderCode(String orderCode) { this.orderCode = orderCode == null ? null : orderCode.trim(); } public String getAddress() { return address; } public void setAddress(String address) { this.address = address == null ? null : address.trim(); } public String getPost() { return post; } public void setPost(String post) { this.post = post == null ? null : post.trim(); } public String getReceiver() { return receiver; } public void setReceiver(String receiver) { this.receiver = receiver == null ? null : receiver.trim(); } public String getMobile() { return mobile; } public void setMobile(String mobile) { this.mobile = mobile == null ? null : mobile.trim(); } public String getUserMessage() { return userMessage; } public void setUserMessage(String userMessage) { this.userMessage = userMessage == null ? null : userMessage.trim(); } public Date getCreateDate() { return createDate; } public void setCreateDate(Date createDate) { this.createDate = createDate; } public Date getPayDate() { return payDate; } public void setPayDate(Date payDate) { this.payDate = payDate; } public Date getDeliveryDate() { return deliveryDate; } public void setDeliveryDate(Date deliveryDate) { this.deliveryDate = deliveryDate; } public Date getConfirmDate() { return confirmDate; } public void setConfirmDate(Date confirmDate) { this.confirmDate = confirmDate; } public Integer getUid() { return uid; } public void setUid(Integer uid) { this.uid = uid; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status == null ? null : status.trim(); } public List<OrderItem> getOrderItems() { return orderItems; } public void setOrderItems(List<OrderItem> orderItems) { this.orderItems = orderItems; } public User getUser() { return user; } public void setUser(User user) { this.user = user; } public float getTotal() { return total; } public void setTotal(float total) { this.total = total; } public int getTotalNumber() { return totalNumber; } public void setTotalNumber(int totalNumber) { this.totalNumber = totalNumber; } }
bd5d4ef22705eaf57df97c5cf5c599567c42655a
dbd861703420a64b616c02d763746c589f282585
/src/main/java/com/bharti/domain/SeoKeynote.java
fbee580c90f92b3090f58abe0e8921dc35b1c86a
[]
no_license
amarlalbharti/bitejava
841e69e4b51182ed4e7607d68319dfbf14051555
8727872e3ff3bfccad8a017dd296f524e7a5f146
refs/heads/master
2020-04-15T12:46:30.836816
2019-04-23T14:05:18
2019-04-23T14:05:18
62,317,152
0
0
null
null
null
null
UTF-8
Java
false
false
1,720
java
package com.bharti.domain; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.OneToOne; import javax.persistence.PrimaryKeyJoinColumn; import javax.persistence.Table; @Entity @Table(name="seo_keynote") public class SeoKeynote extends CommonDomain{ @Id @Column(nullable=false) @GeneratedValue(strategy=GenerationType.AUTO) private long seoId; @Column private String Title; @Column(nullable=false) private String description; @Column(nullable=false) private String keywords; @Column private String imageUrl; @OneToOne(fetch = FetchType.LAZY) @JoinColumn(name="kid" , referencedColumnName="kid") private Keynote keynote; public long getSeoId() { return seoId; } public void setSeoId(long seoId) { this.seoId = seoId; } public String getTitle() { return Title; } public void setTitle(String title) { Title = title; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getKeywords() { return keywords; } public void setKeywords(String keywords) { this.keywords = keywords; } public String getImageUrl() { return imageUrl; } public void setImageUrl(String imageUrl) { this.imageUrl = imageUrl; } public Keynote getKeynote() { return keynote; } public void setKeynote(Keynote keynote) { this.keynote = keynote; } }
0419f1b5a6cfd8089d1bad49b7f5652f6236ab81
3affe07b7e7711248e4a57190e1c2bd7ce7041f5
/app/daos/TipoDireccionDAO.java
d6650f0697013620ad8906b20aab045ca205b73f
[ "Apache-2.0" ]
permissive
chandero/abrahamBackend
ca70c8762da3015a7d40a1151facda137b7f2399
88525cee70a2f9a6ace47c3e36d4acd1f1a361d6
refs/heads/master
2021-07-14T18:13:32.836798
2017-10-17T15:31:23
2017-10-17T15:31:23
107,286,959
0
0
null
null
null
null
UTF-8
Java
false
false
1,292
java
package daos; import java.util.List; import java.sql.PreparedStatement; import java.util.ArrayList; import java.sql.ResultSet; import models.TipoDireccion; import java.sql.Connection; import javax.inject.Inject; import play.db.*; public class TipoDireccionDAO{ private Database db; @Inject private TipoDireccionDAO(Database db) { this.db = db; } public List<TipoDireccion> getTipoDireccion(){ List<TipoDireccion> _dataList = new ArrayList<TipoDireccion>(); PreparedStatement stmt; Connection conn = db.getConnection(); try { String sql; sql = "SELECT t.ID_DIRECCION, t.DESCRIPCION_DIRECCION FROM \"gen$tiposdireccion\" t"; stmt = conn.prepareStatement(sql); ResultSet rs = stmt.executeQuery(); //Extract data from result set if (rs != null){ while(rs.next()){ TipoDireccion td = new TipoDireccion(); td.set_id(rs.getInt("ID_DIRECCION")); td.set_descripcion(rs.getString("DESCRIPCION_DIRECCION")); _dataList.add(td); } } } catch ( Exception e){ e.printStackTrace(); } return _dataList; } }
f277dc1cc7f398ec5bcf540a8248b74c81bc7da3
66ef826c4e5e578e1a4099aff69e335b8af1ef13
/src/task4/Task4.java
62c4080372c68c9567b5fe55b3decfa7d0b61fd9
[]
no_license
DEdKorolev/Zadanie3
2b58c32de342437f229f180d3ce2bbfbf879dae6
2de71b32f182cbad7794f448e7d52239357a7cf9
refs/heads/master
2023-07-27T02:00:23.566868
2021-09-06T10:01:31
2021-09-06T10:01:31
401,137,284
0
0
null
null
null
null
UTF-8
Java
false
false
2,466
java
/* Метод, который получает на вход Map<K, V> и возвращает Map, где ключи и значения поменяны местами. Так как значения исходной Map могут совпадать, то тип ключа в Map будет уже не K, а Collection<K>: Map<V, Collection<K>> */ package task4; import java.util.*; import java.util.Set; public class Task4 { public static void main(String[] args) { // Map для тестирования HashMap<String, Integer> map = new HashMap<>(); map.put("a", 1); map.put("b", 2); map.put("c", 2); map.put("d", 3); // Вызов метода перестановки и вывод данных в консоль System.out.println(inverse(map)); } // Метод перестановки ключей и значений с учётом возможного дублирования значений public static <K, V> Map<V, Collection<K>> inverse(Map<? extends K, ? extends V> map){ // Создаем карту, в которой ключем будут значения, а значения коллекций из ключей Map<V, Collection<K>> resultMap = new HashMap<>(); // Создаем сет ключей из map Set<K> keys = (Set<K>) map.keySet(); // Перебираем ключи for(K key : keys){ V value = map.get(key); // Запрашиваем значение у ключа из map и присваиваем значение переменной value // Сопоставляет новый ключ и новый сет значений // Если ключ (значение value) не повторяется keysSet обнуляется // Если ключ (значение value) повторяется keysSet не обнуляется resultMap.compute(value, (val, keysSet) -> { // Если keysSet не существует, то создать новый keysSet if(keysSet == null){ keysSet = new HashSet<>(); } keysSet.add(key); // Добавить в keysSet значение return keysSet; // Вернуть keysSet }); } return resultMap; // Вернуть resultMap } }
872007885f5eab747718ab556e9635d4ba01db38
63b5e372b693fae3554fa7ec968d378ab9f94e41
/sitae/src/main/java/com/cv/xaloc/gse/bl/wsappclient/type/ContentDocumentRequest.java
c48a9cbb7d77e27c9addd8559be2a739ba590fa9
[ "Apache-2.0" ]
permissive
dedalusgs/sitae
42d9fb038b8e42d7cd996b4d55cd3c1f4d01ff40
6f680c789a0693af362d45d94e986cb045a46c9f
refs/heads/master
2021-01-13T11:18:29.907292
2017-03-01T08:22:43
2017-03-01T08:22:43
76,947,262
1
0
null
null
null
null
UTF-8
Java
false
false
8,380
java
/** * ContentDocumentRequest.java * * This file was auto-generated from WSDL * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter. */ package com.cv.xaloc.gse.bl.wsappclient.type; public class ContentDocumentRequest implements java.io.Serializable { private byte[] content; private java.lang.String name; private java.lang.String mimeType; private com.cv.xaloc.gse.bl.wsappclient.type.Metadata[] arrayOfMetadata; public ContentDocumentRequest() { } public ContentDocumentRequest( byte[] content, java.lang.String name, java.lang.String mimeType, com.cv.xaloc.gse.bl.wsappclient.type.Metadata[] arrayOfMetadata) { this.content = content; this.name = name; this.mimeType = mimeType; this.arrayOfMetadata = arrayOfMetadata; } /** * Gets the content value for this ContentDocumentRequest. * * @return content */ public byte[] getContent() { return content; } /** * Sets the content value for this ContentDocumentRequest. * * @param content */ public void setContent(byte[] content) { this.content = content; } /** * Gets the name value for this ContentDocumentRequest. * * @return name */ public java.lang.String getName() { return name; } /** * Sets the name value for this ContentDocumentRequest. * * @param name */ public void setName(java.lang.String name) { this.name = name; } /** * Gets the mimeType value for this ContentDocumentRequest. * * @return mimeType */ public java.lang.String getMimeType() { return mimeType; } /** * Sets the mimeType value for this ContentDocumentRequest. * * @param mimeType */ public void setMimeType(java.lang.String mimeType) { this.mimeType = mimeType; } /** * Gets the arrayOfMetadata value for this ContentDocumentRequest. * * @return arrayOfMetadata */ public com.cv.xaloc.gse.bl.wsappclient.type.Metadata[] getArrayOfMetadata() { return arrayOfMetadata; } /** * Sets the arrayOfMetadata value for this ContentDocumentRequest. * * @param arrayOfMetadata */ public void setArrayOfMetadata(com.cv.xaloc.gse.bl.wsappclient.type.Metadata[] arrayOfMetadata) { this.arrayOfMetadata = arrayOfMetadata; } public com.cv.xaloc.gse.bl.wsappclient.type.Metadata getArrayOfMetadata(int i) { return this.arrayOfMetadata[i]; } public void setArrayOfMetadata(int i, com.cv.xaloc.gse.bl.wsappclient.type.Metadata _value) { this.arrayOfMetadata[i] = _value; } private java.lang.Object __equalsCalc = null; public synchronized boolean equals(java.lang.Object obj) { if (!(obj instanceof ContentDocumentRequest)) return false; ContentDocumentRequest other = (ContentDocumentRequest) obj; if (obj == null) return false; if (this == obj) return true; if (__equalsCalc != null) { return (__equalsCalc == obj); } __equalsCalc = obj; boolean _equals; _equals = true && ((this.content==null && other.getContent()==null) || (this.content!=null && java.util.Arrays.equals(this.content, other.getContent()))) && ((this.name==null && other.getName()==null) || (this.name!=null && this.name.equals(other.getName()))) && ((this.mimeType==null && other.getMimeType()==null) || (this.mimeType!=null && this.mimeType.equals(other.getMimeType()))) && ((this.arrayOfMetadata==null && other.getArrayOfMetadata()==null) || (this.arrayOfMetadata!=null && java.util.Arrays.equals(this.arrayOfMetadata, other.getArrayOfMetadata()))); __equalsCalc = null; return _equals; } private boolean __hashCodeCalc = false; public synchronized int hashCode() { if (__hashCodeCalc) { return 0; } __hashCodeCalc = true; int _hashCode = 1; if (getContent() != null) { for (int i=0; i<java.lang.reflect.Array.getLength(getContent()); i++) { java.lang.Object obj = java.lang.reflect.Array.get(getContent(), i); if (obj != null && !obj.getClass().isArray()) { _hashCode += obj.hashCode(); } } } if (getName() != null) { _hashCode += getName().hashCode(); } if (getMimeType() != null) { _hashCode += getMimeType().hashCode(); } if (getArrayOfMetadata() != null) { for (int i=0; i<java.lang.reflect.Array.getLength(getArrayOfMetadata()); i++) { java.lang.Object obj = java.lang.reflect.Array.get(getArrayOfMetadata(), i); if (obj != null && !obj.getClass().isArray()) { _hashCode += obj.hashCode(); } } } __hashCodeCalc = false; return _hashCode; } // Type metadata private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(ContentDocumentRequest.class, true); static { typeDesc.setXmlType(new javax.xml.namespace.QName("urn:castellon:sigex:alfresco:type:v1.0.0", ">ContentDocumentRequest")); org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc(); elemField.setFieldName("content"); elemField.setXmlName(new javax.xml.namespace.QName("urn:castellon:sigex:alfresco:type:v1.0.0", "content")); elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "base64Binary")); elemField.setNillable(false); typeDesc.addFieldDesc(elemField); elemField = new org.apache.axis.description.ElementDesc(); elemField.setFieldName("name"); elemField.setXmlName(new javax.xml.namespace.QName("urn:castellon:sigex:alfresco:type:v1.0.0", "name")); elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string")); elemField.setNillable(false); typeDesc.addFieldDesc(elemField); elemField = new org.apache.axis.description.ElementDesc(); elemField.setFieldName("mimeType"); elemField.setXmlName(new javax.xml.namespace.QName("urn:castellon:sigex:alfresco:type:v1.0.0", "mimeType")); elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string")); elemField.setNillable(false); typeDesc.addFieldDesc(elemField); elemField = new org.apache.axis.description.ElementDesc(); elemField.setFieldName("arrayOfMetadata"); elemField.setXmlName(new javax.xml.namespace.QName("urn:castellon:sigex:alfresco:type:v1.0.0", "arrayOfMetadata")); elemField.setXmlType(new javax.xml.namespace.QName("urn:castellon:sigex:alfresco:type:v1.0.0", "Metadata")); elemField.setNillable(false); elemField.setMaxOccursUnbounded(true); typeDesc.addFieldDesc(elemField); } /** * Return type metadata object */ public static org.apache.axis.description.TypeDesc getTypeDesc() { return typeDesc; } /** * Get Custom Serializer */ public static org.apache.axis.encoding.Serializer getSerializer( java.lang.String mechType, java.lang.Class _javaType, javax.xml.namespace.QName _xmlType) { return new org.apache.axis.encoding.ser.BeanSerializer( _javaType, _xmlType, typeDesc); } /** * Get Custom Deserializer */ public static org.apache.axis.encoding.Deserializer getDeserializer( java.lang.String mechType, java.lang.Class _javaType, javax.xml.namespace.QName _xmlType) { return new org.apache.axis.encoding.ser.BeanDeserializer( _javaType, _xmlType, typeDesc); } }
9f7526c6990da37c83741dbd0570937a093e45dd
8df98defb248c49324f1cfa54dc44d43556a187c
/src/Proje/Arama.java
28699727b6270ca2ef391d1ed6d26d28bd5d5659
[]
no_license
fatihhduygu/HashTableUsage
037c217558a24710519f0477ce0fc51e0d64d56a
c352ddaccb70f3b7e6bb012ffc2ba2c4c84ef21c
refs/heads/master
2021-09-09T01:52:59.533288
2018-03-13T08:02:06
2018-03-13T08:02:06
null
0
0
null
null
null
null
ISO-8859-16
Java
false
false
4,100
java
package Proje; import java.io.File; import java.io.FileReader; import java.io.BufferedReader; import java.util.Scanner; public class Arama { public static int[] hucre=new int[211]; //--------------------------------------------------------------------------------------// public static int ascii(String ad) { int Toplam = 0; int uzunluk=ad.length(); for(int i=0; i<uzunluk; i++) { char karakter=ad.charAt(i); int ascii=(int) karakter; Toplam +=Math.pow((i+1), 4)*ascii; } return Toplam; } //--------------------------------------------------------------------------------------// public static void dosyaOku() { File kayit=new File("kelimeler.txt"); try{ FileReader dosyaOku=new FileReader(kayit); String kucultme; BufferedReader dosya=new BufferedReader(dosyaOku); while((kucultme=dosya.readLine())!=null){ kucultme=kucultme.toLowerCase(); int mod1=0; int mod2=0; mod1=ascii(kucultme) % 212; if(hucre[mod1] == 0) { hucre[mod1]=ascii(kucultme); } else { for(int i=0; i<hucre.length; i++) { mod2=((i*i)+mod1) % 212; if(hucre[mod2]==0) { hucre[mod2]=ascii(kucultme); break; } } } } dosya.close(); } catch(Exception e){ e.printStackTrace(); } } //--------------------------------------------------------------------------------------// public static void arama(String ad) { int toplam=ascii(ad); int sayac=0; for(int i=0; i<hucre.length; i++) { if(toplam==hucre[i]) { System.out.println("Aradęginiz Kelime Bulunmustur"); sayac++; } } if(sayac==0) { System.out.println("Aradiginiz kelime Bulunamamistir!!!\n"); yerDegistirerekArama(ad); eksilterekArama(ad); } } //--------------------------------------------------------------------------------------// public static void yerDegistirerekArama(String ad) { char[] dizi=ad.toCharArray(); char a=' '; int toplam=0; for(int i=0; i<ad.length()-1; i++) { a=dizi[i]; dizi[i]=dizi[i+1]; dizi[i+1]=a; String temp=new String (dizi); for(int j=0; j<hucre.length; j++) { toplam=ascii(temp); if(toplam==hucre[j]) { System.out.print(temp); System.out.println(" mi demek istediniz ? \n"); } } dizi=ad.toCharArray(); } } //--------------------------------------------------------------------------------------// public static void eksilterekArama(String ad) { for(int i=0; i<ad.length(); i++) { char[] dizi=ad.toCharArray(); int toplam=0; for(int j=i; j<ad.length()-1; j++) { dizi[j]=dizi[j+1]; dizi[j+1]='\0'; } String temp=new String(dizi); for(int j=0; j<hucre.length; j++) { toplam=ascii(temp); if(toplam==hucre[j]) { System.out.println("\nyoksa \n"); System.out.print(temp); System.out.println(" mi demek istediniz ?"); } } } } //--------------------------------------------------------------------------------------// public static void main(String[] args) { Arama ara=new Arama(); Scanner oku=new Scanner(System.in); System.out.println(" _______ ______ _______ _______ _______ _______ _____ _______ _____ ______ _ _"); System.out.println(" |_____| |_____/ |_____| | | | |_____| | | | | | | | | |_____/ | |"); System.out.println(" | | | \\_ | | | | | | | | | | |_____| | |_____| | \\_ |_____|"); System.out.println(" ________________________________________________________________________________________________________________"); System.out.println("| |"); System.out.print(" "); String ad=oku.nextLine(); System.out.println("|________________________________________________________________________________________________________________| \n"); dosyaOku(); arama(ad); } }
07d7f5fa19ad2b8d83859dad932817a8655c0874
38c4451ab626dcdc101a11b18e248d33fd8a52e0
/identifiers/lucene-3.6.2/core/src/java/org/apache/lucene/index/TermInfo.java
4711506b8efe369b2ef785a51df695644326bdf1
[]
no_license
habeascorpus/habeascorpus-data
47da7c08d0f357938c502bae030d5fb8f44f5e01
536d55729f3110aee058ad009bcba3e063b39450
refs/heads/master
2020-06-04T10:17:20.102451
2013-02-19T15:19:21
2013-02-19T15:19:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,106
java
org PACKAGE_IDENTIFIER false apache PACKAGE_IDENTIFIER false lucene PACKAGE_IDENTIFIER false index PACKAGE_IDENTIFIER false TermInfo TYPE_IDENTIFIER true docFreq VARIABLE_IDENTIFIER true freqPointer VARIABLE_IDENTIFIER true proxPointer VARIABLE_IDENTIFIER true skipOffset VARIABLE_IDENTIFIER true TermInfo METHOD_IDENTIFIER false TermInfo METHOD_IDENTIFIER false df VARIABLE_IDENTIFIER true fp VARIABLE_IDENTIFIER true pp VARIABLE_IDENTIFIER true docFreq VARIABLE_IDENTIFIER false df VARIABLE_IDENTIFIER false freqPointer VARIABLE_IDENTIFIER false fp VARIABLE_IDENTIFIER false proxPointer VARIABLE_IDENTIFIER false pp VARIABLE_IDENTIFIER false TermInfo METHOD_IDENTIFIER false TermInfo TYPE_IDENTIFIER false ti VARIABLE_IDENTIFIER true docFreq VARIABLE_IDENTIFIER false ti VARIABLE_IDENTIFIER false docFreq VARIABLE_IDENTIFIER false freqPointer VARIABLE_IDENTIFIER false ti VARIABLE_IDENTIFIER false freqPointer VARIABLE_IDENTIFIER false proxPointer VARIABLE_IDENTIFIER false ti VARIABLE_IDENTIFIER false proxPointer VARIABLE_IDENTIFIER false skipOffset VARIABLE_IDENTIFIER false ti VARIABLE_IDENTIFIER false skipOffset VARIABLE_IDENTIFIER false set METHOD_IDENTIFIER true docFreq VARIABLE_IDENTIFIER true freqPointer VARIABLE_IDENTIFIER true proxPointer VARIABLE_IDENTIFIER true skipOffset VARIABLE_IDENTIFIER true docFreq VARIABLE_IDENTIFIER false docFreq VARIABLE_IDENTIFIER false freqPointer VARIABLE_IDENTIFIER false freqPointer VARIABLE_IDENTIFIER false proxPointer VARIABLE_IDENTIFIER false proxPointer VARIABLE_IDENTIFIER false skipOffset VARIABLE_IDENTIFIER false skipOffset VARIABLE_IDENTIFIER false set METHOD_IDENTIFIER true TermInfo TYPE_IDENTIFIER false ti VARIABLE_IDENTIFIER true docFreq VARIABLE_IDENTIFIER false ti VARIABLE_IDENTIFIER false docFreq VARIABLE_IDENTIFIER false freqPointer VARIABLE_IDENTIFIER false ti VARIABLE_IDENTIFIER false freqPointer VARIABLE_IDENTIFIER false proxPointer VARIABLE_IDENTIFIER false ti VARIABLE_IDENTIFIER false proxPointer VARIABLE_IDENTIFIER false skipOffset VARIABLE_IDENTIFIER false ti VARIABLE_IDENTIFIER false skipOffset VARIABLE_IDENTIFIER false
d90270ac02d39e6d46a41f97471a83262afc02ff
47851346e105eb1a4c0359603f3257450089bce6
/src/test/java/Pages/PolymerPage.java
40b4ab4e10ef0e431315b6c63ab9fe6405505713
[]
no_license
sinanaltuntas/Lingoda_QA_Task
75d843f6b5cbc242c1e87c1ecbed05384373341a
a9b8fbe86772bebaa59b9ca995d7d59241a99bd1
refs/heads/master
2023-03-05T16:06:10.806027
2021-02-18T19:04:08
2021-02-18T19:04:08
340,149,513
0
0
null
null
null
null
UTF-8
Java
false
false
376
java
package Pages; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; public class PolymerPage extends BasePage{ @FindBy(css = "[id='new-todo']") public WebElement todoAddBox; @FindBy(xpath = "(//label[@class='style-scope td-item'])[2]") public WebElement secondItem; @FindBy(id = "edit") public WebElement editItem; }
ee74957d915c57676c026161249cd1c1044f4de9
663f24b8829e6d673e136e1b88c596cc2e651acb
/src/ru/geekbrains/erp/DAO/PlanDAO.java
7d546daed4e110c978166947d7fa95ea85fbe389
[]
no_license
Valerych-gif/Patterns
95636d0d063073bddde1007123d4b60759a26cc0
8ede15a3dd0ebe2fc24d26c756398b0b304368cf
refs/heads/master
2023-02-02T19:36:31.560932
2020-12-09T15:39:48
2020-12-09T15:39:48
313,298,975
0
0
null
2020-12-10T16:20:04
2020-11-16T12:43:56
Java
UTF-8
Java
false
false
1,847
java
package ru.geekbrains.erp.DAO; import ru.geekbrains.erp.Plan; import ru.geekbrains.erp.Task; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; public class PlanDAO extends EntityDAO{ private static final String PLANS_TABLE_NAME = "plans"; private static final String ID_COLUMN_NAME = "id"; private static final String TITLE_COLUMN_NAME = "title"; private static final String STATUS_COLUMN_NAME = "status"; public PlanDAO() { super(); } public void insertPlan(Plan plan){ if (plan == null || plan.getTitle()== null) { return; } String sql = "INSERT INTO `" + PLANS_TABLE_NAME + "` " + "(`" + TITLE_COLUMN_NAME + "`, `" + STATUS_COLUMN_NAME + "`)" + " VALUES " + "('" + plan.getTitle() + "', '" + Plan.Status.NEW.getStatusName() + "')"; try (Statement statement = connection.createStatement()) { statement.execute(sql); } catch (SQLException e) { e.printStackTrace(); } } public Plan getPlanById(long id) { return null; } public Plan getPlanByTitle(String title) { Plan plan = null; String sql = "SELECT * FROM `" + PLANS_TABLE_NAME + "` WHERE `" + TITLE_COLUMN_NAME + "`='" + title + "'"; try (Statement statement = connection.createStatement()) { ResultSet rs = statement.executeQuery(sql); if (rs.next()) { plan = new Plan( rs.getLong(ID_COLUMN_NAME), rs.getString(TITLE_COLUMN_NAME)); } } catch (SQLException e){ e.printStackTrace(); } return plan; } public void updatePlan(Plan plan) { } public void deletePlan(int id) { } }
c29aa2ce844a28eab446c0c83054bcfe25fbd0df
5bfcb9cdad4f3be59d1570af7ed441b0f200a737
/src/main/java/com/webapp/lora/entity/DeviceDb.java
3a5ea6dc6d45703f1d47ceb9aaec8ebeab5eda9b
[]
no_license
re5pect123/lor2
eda616ea4192a8d37cbf40604bcc1403fd9ab436
193671ff53864901335d9e604292327afd9bae9a
refs/heads/master
2020-04-05T09:51:23.396023
2019-01-15T14:33:14
2019-01-15T14:33:14
156,778,287
0
0
null
null
null
null
UTF-8
Java
false
false
853
java
package com.webapp.lora.entity; import javax.persistence.*; import java.sql.Timestamp; @Entity @Table(name = "device_db") public class DeviceDb { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) int id; String devEUI; String payload_hex; Timestamp time; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getDevEUI() { return devEUI; } public void setDevEUI(String devEUI) { this.devEUI = devEUI; } public String getPayload_hex() { return payload_hex; } public void setPayload_hex(String payload_hex) { this.payload_hex = payload_hex; } public Timestamp getTime() { return time; } public void setTime(Timestamp time) { this.time = time; } }
7cb739f44404b8e34419d09231fb3377d29b3080
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/9/9_6b1d1ab0a27e9ed08a626e18319beb91d0a0d5ce/OtpMbox/9_6b1d1ab0a27e9ed08a626e18319beb91d0a0d5ce_OtpMbox_s.java
16369f5053fc874c378f018d5b80328d06921d6d
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
22,737
java
/* * %CopyrightBegin% * * Copyright Ericsson AB 2000-2009. All Rights Reserved. * * The contents of this file are subject to the Erlang Public License, * Version 1.1, (the "License"); you may not use this file except in * compliance with the License. You should have received a copy of the * Erlang Public License along with this software. If not, it can be * retrieved online at http://www.erlang.org/. * * 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. * * %CopyrightEnd% */ package com.ericsson.otp.erlang; /** * <p> * Provides a simple mechanism for exchanging messages with Erlang processes or * other instances of this class. * </p> * * <p> * Each mailbox is associated with a unique {@link OtpErlangPid pid} that * contains information necessary for delivery of messages. When sending * messages to named processes or mailboxes, the sender pid is made available to * the recipient of the message. When sending messages to other mailboxes, the * recipient can only respond if the sender includes the pid as part of the * message contents. The sender can determine his own pid by calling * {@link #self self()}. * </p> * * <p> * Mailboxes can be named, either at creation or later. Messages can be sent to * named mailboxes and named Erlang processes without knowing the * {@link OtpErlangPid pid} that identifies the mailbox. This is neccessary in * order to set up initial communication between parts of an application. Each * mailbox can have at most one name. * </p> * * <p> * Since this class was intended for communication with Erlang, all of the send * methods take {@link OtpErlangObject OtpErlangObject} arguments. However this * class can also be used to transmit arbitrary Java objects (as long as they * implement one of java.io.Serializable or java.io.Externalizable) by * encapsulating the object in a {@link OtpErlangBinary OtpErlangBinary}. * </p> * * <p> * Messages to remote nodes are externalized for transmission, and as a result * the recipient receives a <b>copy</b> of the original Java object. To ensure * consistent behaviour when messages are sent between local mailboxes, such * messages are cloned before delivery. * </p> * * <p> * Additionally, mailboxes can be linked in much the same way as Erlang * processes. If a link is active when a mailbox is {@link #close closed}, any * linked Erlang processes or OtpMboxes will be sent an exit signal. As well, * exit signals will be (eventually) sent if a mailbox goes out of scope and its * {@link #finalize finalize()} method called. However due to the nature of * finalization (i.e. Java makes no guarantees about when {@link #finalize * finalize()} will be called) it is recommended that you always explicitly * close mailboxes if you are using links instead of relying on finalization to * notify other parties in a timely manner. * </p> * * When retrieving messages from a mailbox that has received an exit signal, an * {@link OtpErlangExit OtpErlangExit} exception will be raised. Note that the * exception is queued in the mailbox along with other messages, and will not be * raised until it reaches the head of the queue and is about to be retrieved. * </p> * */ public class OtpMbox { OtpNode home; OtpErlangPid self; GenericQueue queue; String name; Links links; // package constructor: called by OtpNode:createMbox(name) // to create a named mbox OtpMbox(final OtpNode home, final OtpErlangPid self, final String name) { this.self = self; this.home = home; this.name = name; queue = new GenericQueue(); links = new Links(10); } // package constructor: called by OtpNode:createMbox() // to create an anonymous OtpMbox(final OtpNode home, final OtpErlangPid self) { this(home, self, null); } /** * <p> * Get the identifying {@link OtpErlangPid pid} associated with this * mailbox. * </p> * * <p> * The {@link OtpErlangPid pid} associated with this mailbox uniquely * identifies the mailbox and can be used to address the mailbox. You can * send the {@link OtpErlangPid pid} to a remote communicating part so that * he can know where to send his response. * </p> * * @return the self pid for this mailbox. */ public OtpErlangPid self() { return self; } /** * <p> * Register or remove a name for this mailbox. Registering a name for a * mailbox enables others to send messages without knowing the * {@link OtpErlangPid pid} of the mailbox. A mailbox can have at most one * name; if the mailbox already had a name, calling this method will * supercede that name. * </p> * * @param name * the name to register for the mailbox. Specify null to * unregister the existing name from this mailbox. * * @return true if the name was available, or false otherwise. */ public synchronized boolean registerName(final String name) { return home.registerName(name, this); } /** * Get the registered name of this mailbox. * * @return the registered name of this mailbox, or null if the mailbox had * no registerd name. */ public String getName() { return name; } /** * Block until a message arrives for this mailbox. * * @return an {@link OtpErlangObject OtpErlangObject} representing the body * of the next message waiting in this mailbox. * * @exception OtpErlangDecodeException * if the message can not be decoded. * * @exception OtpErlangExit * if a linked {@link OtpErlangPid pid} has exited or has * sent an exit signal to this mailbox. */ public OtpErlangObject receive() throws OtpErlangExit, OtpErlangDecodeException { try { return receiveMsg().getMsg(); } catch (final OtpErlangExit e) { throw e; } catch (final OtpErlangDecodeException f) { throw f; } } /** * Wait for a message to arrive for this mailbox. * * @param timeout * the time, in milliseconds, to wait for a message before * returning null. * * @return an {@link OtpErlangObject OtpErlangObject} representing the body * of the next message waiting in this mailbox. * * @exception OtpErlangDecodeException * if the message can not be decoded. * * @exception OtpErlangExit * if a linked {@link OtpErlangPid pid} has exited or has * sent an exit signal to this mailbox. */ public OtpErlangObject receive(final long timeout) throws OtpErlangExit, OtpErlangDecodeException { try { final OtpMsg m = receiveMsg(timeout); if (m != null) { return m.getMsg(); } } catch (final OtpErlangExit e) { throw e; } catch (final OtpErlangDecodeException f) { throw f; } catch (final InterruptedException g) { } return null; } /** * Block until a message arrives for this mailbox. * * @return a byte array representing the still-encoded body of the next * message waiting in this mailbox. * * @exception OtpErlangExit * if a linked {@link OtpErlangPid pid} has exited or has * sent an exit signal to this mailbox. * */ public OtpInputStream receiveBuf() throws OtpErlangExit { return receiveMsg().getMsgBuf(); } /** * Wait for a message to arrive for this mailbox. * * @param timeout * the time, in milliseconds, to wait for a message before * returning null. * * @return a byte array representing the still-encoded body of the next * message waiting in this mailbox. * * @exception OtpErlangExit * if a linked {@link OtpErlangPid pid} has exited or has * sent an exit signal to this mailbox. * * @exception InterruptedException * if no message if the method times out before a message * becomes available. */ public OtpInputStream receiveBuf(final long timeout) throws InterruptedException, OtpErlangExit { final OtpMsg m = receiveMsg(timeout); if (m != null) { return m.getMsgBuf(); } return null; } /** * Block until a message arrives for this mailbox. * * @return an {@link OtpMsg OtpMsg} containing the header information as * well as the body of the next message waiting in this mailbox. * * @exception OtpErlangExit * if a linked {@link OtpErlangPid pid} has exited or has * sent an exit signal to this mailbox. * */ public OtpMsg receiveMsg() throws OtpErlangExit { final OtpMsg m = (OtpMsg) queue.get(); switch (m.type()) { case OtpMsg.exitTag: case OtpMsg.exit2Tag: try { final OtpErlangObject o = m.getMsg(); throw new OtpErlangExit(o, m.getSenderPid()); } catch (final OtpErlangDecodeException e) { throw new OtpErlangExit("unknown", m.getSenderPid()); } default: return m; } } /** * Wait for a message to arrive for this mailbox. * * @param timeout * the time, in milliseconds, to wait for a message. * * @return an {@link OtpMsg OtpMsg} containing the header information as * well as the body of the next message waiting in this mailbox. * * @exception OtpErlangExit * if a linked {@link OtpErlangPid pid} has exited or has * sent an exit signal to this mailbox. * * @exception InterruptedException * if no message if the method times out before a message * becomes available. */ public OtpMsg receiveMsg(final long timeout) throws InterruptedException, OtpErlangExit { final OtpMsg m = (OtpMsg) queue.get(timeout); if (m == null) { return null; } switch (m.type()) { case OtpMsg.exitTag: case OtpMsg.exit2Tag: try { final OtpErlangObject o = m.getMsg(); throw new OtpErlangExit(o, m.getSenderPid()); } catch (final OtpErlangDecodeException e) { throw new OtpErlangExit("unknown", m.getSenderPid()); } default: return m; } } /** * Send a message to a remote {@link OtpErlangPid pid}, representing either * another {@link OtpMbox mailbox} or an Erlang process. * * @param to * the {@link OtpErlangPid pid} identifying the intended * recipient of the message. * * @param msg * the body of the message to send. * */ public void send(final OtpErlangPid to, final OtpErlangObject msg) { try { final String node = to.node(); if (node.equals(home.node())) { home.deliver(new OtpMsg(to, (OtpErlangObject) msg.clone())); } else { final OtpCookedConnection conn = home.getConnection(node); if (conn == null) { return; } conn.send(self, to, msg); } } catch (final Exception e) { } } /** * Send a message to a named mailbox created from the same node as this * mailbox. * * @param name * the registered name of recipient mailbox. * * @param msg * the body of the message to send. * */ public void send(final String name, final OtpErlangObject msg) { home.deliver(new OtpMsg(self, name, (OtpErlangObject) msg.clone())); } /** * Send a message to a named mailbox created from another node. * * @param name * the registered name of recipient mailbox. * * @param node * the name of the remote node where the recipient mailbox is * registered. * * @param msg * the body of the message to send. * */ public void send(final String name, final String node, final OtpErlangObject msg) { try { final String currentNode = home.node(); if (node.equals(currentNode)) { send(name, msg); } else if (node.indexOf('@', 0) < 0 && node.equals(currentNode.substring(0, currentNode .indexOf('@', 0)))) { send(name, msg); } else { // other node final OtpCookedConnection conn = home.getConnection(node); if (conn == null) { return; } conn.send(self, name, msg); } } catch (final Exception e) { } } /** * Close this mailbox with the given reason. * * <p> * After this operation, the mailbox will no longer be able to receive * messages. Any delivered but as yet unretrieved messages can still be * retrieved however. * </p> * * <p> * If there are links from this mailbox to other {@link OtpErlangPid pids}, * they will be broken when this method is called and exit signals will be * sent. * </p> * * @param reason * an Erlang term describing the reason for the exit. */ public void exit(final OtpErlangObject reason) { home.closeMbox(this, reason); } /** * Equivalent to <code>exit(new OtpErlangAtom(reason))</code>. * </p> * * @see #exit(OtpErlangObject) */ public void exit(final String reason) { exit(new OtpErlangAtom(reason)); } /** * <p> * Send an exit signal to a remote {@link OtpErlangPid pid}. This method * does not cause any links to be broken, except indirectly if the remote * {@link OtpErlangPid pid} exits as a result of this exit signal. * </p> * * @param to * the {@link OtpErlangPid pid} to which the exit signal * should be sent. * * @param reason * an Erlang term indicating the reason for the exit. */ // it's called exit, but it sends exit2 public void exit(final OtpErlangPid to, final OtpErlangObject reason) { exit(2, to, reason); } /** * <p> * Equivalent to <code>exit(to, new * OtpErlangAtom(reason))</code>. * </p> * * @see #exit(OtpErlangPid, OtpErlangObject) */ public void exit(final OtpErlangPid to, final String reason) { exit(to, new OtpErlangAtom(reason)); } // this function used internally when "process" dies // since Erlang discerns between exit and exit/2. private void exit(final int arity, final OtpErlangPid to, final OtpErlangObject reason) { try { final String node = to.node(); if (node.equals(home.node())) { home.deliver(new OtpMsg(OtpMsg.exitTag, self, to, reason)); } else { final OtpCookedConnection conn = home.getConnection(node); if (conn == null) { return; } switch (arity) { case 1: conn.exit(self, to, reason); break; case 2: conn.exit2(self, to, reason); break; } } } catch (final Exception e) { } } /** * <p> * Link to a remote mailbox or Erlang process. Links are idempotent, calling * this method multiple times will not result in more than one link being * created. * </p> * * <p> * If the remote process subsequently exits or the mailbox is closed, a * subsequent attempt to retrieve a message through this mailbox will cause * an {@link OtpErlangExit OtpErlangExit} exception to be raised. Similarly, * if the sending mailbox is closed, the linked mailbox or process will * receive an exit signal. * </p> * * <p> * If the remote process cannot be reached in order to set the link, the * exception is raised immediately. * </p> * * @param to * the {@link OtpErlangPid pid} representing the object to * link to. * * @exception OtpErlangExit * if the {@link OtpErlangPid pid} referred to does not * exist or could not be reached. * */ public void link(final OtpErlangPid to) throws OtpErlangExit { try { final String node = to.node(); if (node.equals(home.node())) { if (!home.deliver(new OtpMsg(OtpMsg.linkTag, self, to))) { throw new OtpErlangExit("noproc", to); } } else { final OtpCookedConnection conn = home.getConnection(node); if (conn != null) { conn.link(self, to); } else { throw new OtpErlangExit("noproc", to); } } } catch (final OtpErlangExit e) { throw e; } catch (final Exception e) { } links.addLink(self, to); } /** * <p> * Remove a link to a remote mailbox or Erlang process. This method removes * a link created with {@link #link link()}. Links are idempotent; calling * this method once will remove all links between this mailbox and the * remote {@link OtpErlangPid pid}. * </p> * * @param to * the {@link OtpErlangPid pid} representing the object to * unlink from. * */ public void unlink(final OtpErlangPid to) { links.removeLink(self, to); try { final String node = to.node(); if (node.equals(home.node())) { home.deliver(new OtpMsg(OtpMsg.unlinkTag, self, to)); } else { final OtpCookedConnection conn = home.getConnection(node); if (conn != null) { conn.unlink(self, to); } } } catch (final Exception e) { } } /** * <p> * Create a connection to a remote node. * </p> * * <p> * Strictly speaking, this method is not necessary simply to set up a * connection, since connections are created automatically first time a * message is sent to a {@link OtpErlangPid pid} on the remote node. * </p> * * <p> * This method makes it possible to wait for a node to come up, however, or * check that a node is still alive. * </p> * * <p> * This method calls a method with the same name in {@link OtpNode#ping * Otpnode} but is provided here for convenience. * </p> * * @param node * the name of the node to ping. * * @param timeout * the time, in milliseconds, before reporting failure. */ public boolean ping(final String node, final long timeout) { return home.ping(node, timeout); } /** * <p> * Get a list of all known registered names on the same {@link OtpNode node} * as this mailbox. * </p> * * <p> * This method calls a method with the same name in {@link OtpNode#getNames * Otpnode} but is provided here for convenience. * </p> * * @return an array of Strings containing all registered names on this * {@link OtpNode node}. */ public String[] getNames() { return home.getNames(); } /** * Determine the {@link OtpErlangPid pid} corresponding to a registered name * on this {@link OtpNode node}. * * <p> * This method calls a method with the same name in {@link OtpNode#whereis * Otpnode} but is provided here for convenience. * </p> * * @return the {@link OtpErlangPid pid} corresponding to the registered * name, or null if the name is not known on this node. */ public OtpErlangPid whereis(final String name) { return home.whereis(name); } /** * Close this mailbox. * * <p> * After this operation, the mailbox will no longer be able to receive * messages. Any delivered but as yet unretrieved messages can still be * retrieved however. * </p> * * <p> * If there are links from this mailbox to other {@link OtpErlangPid pids}, * they will be broken when this method is called and exit signals with * reason 'normal' will be sent. * </p> * * <p> * This is equivalent to {@link #exit(String) exit("normal")}. * </p> */ public void close() { home.closeMbox(this); } @Override protected void finalize() { close(); queue.flush(); } /** * Determine if two mailboxes are equal. * * @return true if both Objects are mailboxes with the same identifying * {@link OtpErlangPid pids}. */ @Override public boolean equals(final Object o) { if (!(o instanceof OtpMbox)) { return false; } final OtpMbox m = (OtpMbox) o; return m.self.equals(self); } @Override public int hashCode() { return self.hashCode(); } /* * called by OtpNode to deliver message to this mailbox. * * About exit and exit2: both cause exception to be raised upon receive(). * However exit (not 2) causes any link to be removed as well, while exit2 * leaves any links intact. */ void deliver(final OtpMsg m) { switch (m.type()) { case OtpMsg.linkTag: links.addLink(self, m.getSenderPid()); break; case OtpMsg.unlinkTag: links.removeLink(self, m.getSenderPid()); break; case OtpMsg.exitTag: links.removeLink(self, m.getSenderPid()); queue.put(m); break; case OtpMsg.exit2Tag: default: queue.put(m); break; } } // used to break all known links to this mbox void breakLinks(final OtpErlangObject reason) { final Link[] l = links.clearLinks(); if (l != null) { final int len = l.length; for (int i = 0; i < len; i++) { exit(1, l[i].remote(), reason); } } } }
7191e3afe90cc70d043951db33610a0d472b8555
f706b7f221cc0dc7a562d2683095abb66b035471
/examples/polyglot-zipkin/java-dropwizard/src/main/java/org/hawkular/apm/example/dropwizard/AppConfiguration.java
5adee2386c3db93e2631e37e77ba12fff034100e
[ "Apache-2.0" ]
permissive
mumutu/hawkular-apm
fff8383ec30db026bf8c371414eadacdce43ea0e
904565ff68bdd7d44c3603447d83d60031e8e59c
refs/heads/master
2021-01-24T10:09:26.396847
2016-09-22T10:24:05
2016-09-22T10:24:05
68,891,909
1
0
null
2016-09-22T06:35:04
2016-09-22T06:35:04
null
UTF-8
Java
false
false
1,597
java
/* * Copyright 2015-2016 Red Hat, Inc. and/or its affiliates * and other contributors as indicated by the @author tags. * * 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.hawkular.apm.example.dropwizard; import javax.validation.Valid; import javax.validation.constraints.NotNull; import com.fasterxml.jackson.annotation.JsonProperty; import com.smoketurner.dropwizard.zipkin.LoggingZipkinFactory; import com.smoketurner.dropwizard.zipkin.ZipkinFactory; import com.smoketurner.dropwizard.zipkin.client.ZipkinClientConfiguration; import io.dropwizard.Configuration; /** * @author Pavol Loffay */ public class AppConfiguration extends Configuration { @Valid @NotNull public final ZipkinFactory zipkin = new LoggingZipkinFactory(); @Valid @NotNull private final ZipkinClientConfiguration zipkinClient = new ZipkinClientConfiguration(); @JsonProperty public ZipkinFactory getZipkinFactory() { return zipkin; } @JsonProperty public ZipkinClientConfiguration getZipkinClient() { return zipkinClient; } }
2dd33db1951f307711669d3cae443b9750d83c7b
2f04e6ab1180569308b42dcba09d96bebd7e4bbd
/app/src/main/java/com/barefoot/easypass/GSS1103.java
9b31f113083a9dcac69d8fc16da306845a801edd
[]
no_license
VershimaKelvin/EasyPass
3bd121a57b5065d51b6a5cfc7a639dfa29c9d6c8
972f296a6662dfaa84535f85b36548832bff391d
refs/heads/master
2020-09-23T11:03:35.166152
2020-06-23T15:13:39
2020-06-23T15:13:39
256,256,227
1
0
null
null
null
null
UTF-8
Java
false
false
637
java
package com.barefoot.easypass; import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import com.github.barteksc.pdfviewer.PDFView; public class GSS1103 extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_gss1103); ActionBar actionBar =getSupportActionBar(); assert actionBar != null; actionBar.hide(); PDFView pdfView = findViewById(R.id.pdfView); pdfView.fromAsset("GSS1103.pdf").load(); } }
d05f4ab81748ca6ddb17a252d64e139ddbb0aa78
a59e619c8f96a8a059ed765b13e7ab878fca1e31
/src/test/java/org/springframework/data/jdbc/domain/movie/AmountDiscountStrategy.java
1c7dccbed2c84adb49d9dd132bd7d69ec7111e4f
[ "Apache-2.0" ]
permissive
jihwan/spring-data-jdbc
d687a42b6611c00af8c2abb4fed1130aa944c1c6
12171b869328302fe934c8ea83aff0b4243556f8
refs/heads/master
2021-01-01T05:06:07.149987
2016-06-08T02:11:00
2016-06-08T02:11:00
57,183,788
2
0
null
null
null
null
UTF-8
Java
false
false
234
java
package org.springframework.data.jdbc.domain.movie; public class AmountDiscountStrategy extends DiscountSupport { Money discountAmount; @Override protected Money getDiscountFee(Showing showing) { return discountAmount; } }
61139f8dce23b4dc028bc67f69f3fb1af0944d3c
0fe1edbb071f01ace58e190b66d94c77a1588e58
/src/main/java/com/learn/algo/graph/GraphApplication.java
88787d45c05cf079f7514dffab6d01d72d99d69c
[]
no_license
ravindraAmbati/graph
3832e6b4fbbd3d247134a8064e6b2cd434e58b41
3fe6704fefd14278d03ddafdeb7879790ce85eaf
refs/heads/master
2022-12-18T19:25:43.148219
2020-09-05T04:53:17
2020-09-05T04:53:17
283,825,427
0
0
null
null
null
null
UTF-8
Java
false
false
311
java
package com.learn.algo.graph; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class GraphApplication { public static void main(String[] args) { SpringApplication.run(GraphApplication.class, args); } }
d5c11e690d5fb37f81f6fde980cb8c0673d12718
4d188854bc8dd64499ee0377863e668b4d02a2f4
/src/test/java/com/restapi/service/NewspaperServiceTest.java
1bcc1ad1b04ff259615a246b448654eef0a5c61f
[]
no_license
analiahojman/javaProgramming
b2fd52206f099dd8c65db3e9f848ebae9273a484
3e222d1d84b447866c1a284484d873c24895f223
refs/heads/master
2021-01-01T17:42:14.756084
2015-05-17T17:59:18
2015-05-17T17:59:18
29,763,227
0
0
null
null
null
null
UTF-8
Java
false
false
3,212
java
package com.restapi.service; import static org.junit.Assert.assertFalse; import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; import java.util.ArrayList; import java.util.Date; import org.junit.Before; import org.junit.Test; import com.restapi.model.Newspaper; import com.restapi.model.Post; import com.restapi.repository.NewspaperRepository; import com.restapi.repository.PostRepository; /** * This class tests all the newspaper services * @author analia.hojman */ public class NewspaperServiceTest { private NewspaperRepository newspaperRepositoryMock; private PostRepository postRepositoryMock; private NewspaperService newspaperService; @Before public void setUp() { newspaperRepositoryMock = mock(NewspaperRepository.class); postRepositoryMock = mock(PostRepository.class); newspaperService = new NewspaperService(newspaperRepositoryMock,postRepositoryMock); } /** * This test verifies that a new newspaper was created and saved */ @Test public void addNewNewspaper() { when(newspaperRepositoryMock.save(any(Newspaper.class))).thenReturn(new Newspaper()); newspaperService.create(new Newspaper()); //verify that the newspaper repository has performed a save action to grab the new newspaper verify(newspaperRepositoryMock).save(any(Newspaper.class)); verifyNoMoreInteractions(newspaperRepositoryMock); } /** * This test verifies that a new post was added to a newspaper */ @Test public void addPostToNewspaper() { Newspaper newspaper = new Newspaper("Newspaper Name", "One Editorial Name", new Date(), new ArrayList<Post>()); when(newspaperRepositoryMock.save(any(Newspaper.class))).thenReturn(newspaper); when(newspaperRepositoryMock.findById(any(Long.class))).thenReturn(newspaper); when(postRepositoryMock.save(any(Post.class))).thenReturn(new Post()); newspaperService.addPost(new Long(1), any(Post.class)); //verify that the post repository has performed a save action to grab the new post verify(postRepositoryMock).save(any(Post.class)); //verify that the newspaper repository has performed a save action to grab the newspaper with new post verify(newspaperRepositoryMock).save(any(Newspaper.class)); //verify that the newspaper list of posts is not empty assertFalse(newspaper.getPosts().isEmpty()); } /** * This test verifies that two new newspapers were created and saved */ @Test public void addTwoNewNewspapers(){ when(newspaperRepositoryMock.save(any(Newspaper.class))).thenReturn(new Newspaper()); // Create first newspaper newspaperService.create(new Newspaper("newspaper1", "editorial1", new Date())); // Create second newspaper newspaperService.create(new Newspaper("newspaper2", "editorial2", new Date())); //verify that the newspaper repository has performed two times the save action to grab both newspapers verify(newspaperRepositoryMock, times(2)).save(any(Newspaper.class)); verifyNoMoreInteractions(newspaperRepositoryMock); } }
8fd69747eaa6806ce2f24e071b708851e424372b
b51e7e73026f3f6381b7e36bad77876ce47f712b
/application forms/abn amro/bank/JMSBankFrame.java
11e129af56b639d900418d2f28116e53e5408fcc
[]
no_license
miltonvandesanden/DPI6
fa6a68da9c1b27797f7f2c99db191b1b6c600feb
1bf8871c97ea3660efa366c7f558745a9f30330d
refs/heads/master
2020-04-21T07:04:57.890647
2019-02-06T10:44:15
2019-02-06T10:44:15
169,383,270
0
0
null
null
null
null
UTF-8
Java
false
false
3,786
java
package bank; import java.awt.EventQueue; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.DefaultListModel; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextField; import javax.swing.border.EmptyBorder; import model.bank.*; import messaging.requestreply.RequestReply; public class JMSBankFrame extends JFrame { private static final long serialVersionUID = 1L; private JPanel contentPane; private JTextField tfReply; private DefaultListModel<RequestReply<BankInterestRequest, BankInterestReply>> listModel = new DefaultListModel<>(); /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater ( () -> { try { JMSBankFrame frame = new JMSBankFrame(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } ); } /** * Create the frame. */ public JMSBankFrame() { setTitle("JMS Bank - ABN AMRO"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 450, 300); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); GridBagLayout gbl_contentPane = new GridBagLayout(); gbl_contentPane.columnWidths = new int[]{46, 31, 86, 30, 89, 0}; gbl_contentPane.rowHeights = new int[]{233, 23, 0}; gbl_contentPane.columnWeights = new double[]{1.0, 0.0, 1.0, 0.0, 0.0, Double.MIN_VALUE}; gbl_contentPane.rowWeights = new double[]{1.0, 0.0, Double.MIN_VALUE}; contentPane.setLayout(gbl_contentPane); JScrollPane scrollPane = new JScrollPane(); GridBagConstraints gbc_scrollPane = new GridBagConstraints(); gbc_scrollPane.gridwidth = 5; gbc_scrollPane.insets = new Insets(0, 0, 5, 5); gbc_scrollPane.fill = GridBagConstraints.BOTH; gbc_scrollPane.gridx = 0; gbc_scrollPane.gridy = 0; contentPane.add(scrollPane, gbc_scrollPane); JList<RequestReply<BankInterestRequest, BankInterestReply>> list = new JList<>(listModel); scrollPane.setViewportView(list); JLabel lblNewLabel = new JLabel("type reply"); GridBagConstraints gbc_lblNewLabel = new GridBagConstraints(); gbc_lblNewLabel.anchor = GridBagConstraints.EAST; gbc_lblNewLabel.insets = new Insets(0, 0, 0, 5); gbc_lblNewLabel.gridx = 0; gbc_lblNewLabel.gridy = 1; contentPane.add(lblNewLabel, gbc_lblNewLabel); tfReply = new JTextField(); GridBagConstraints gbc_tfReply = new GridBagConstraints(); gbc_tfReply.gridwidth = 2; gbc_tfReply.insets = new Insets(0, 0, 0, 5); gbc_tfReply.fill = GridBagConstraints.HORIZONTAL; gbc_tfReply.gridx = 1; gbc_tfReply.gridy = 1; contentPane.add(tfReply, gbc_tfReply); tfReply.setColumns(10); JButton btnSendReply = new JButton("send reply"); btnSendReply.addActionListener ( e -> { RequestReply<BankInterestRequest, BankInterestReply> rr = list.getSelectedValue(); double interest = Double.parseDouble((tfReply.getText())); BankInterestReply reply = new BankInterestReply(interest,"ABN AMRO"); if (rr!= null && reply != null) { rr.setReply(reply); list.repaint(); // todo: sent JMS message with the reply to Loan Broker } } ); GridBagConstraints gbc_btnSendReply = new GridBagConstraints(); gbc_btnSendReply.anchor = GridBagConstraints.NORTHWEST; gbc_btnSendReply.gridx = 4; gbc_btnSendReply.gridy = 1; contentPane.add(btnSendReply, gbc_btnSendReply); } }
cbe1d3a0e7771272d48865ce264b60ce790430b1
12416097ca80c97550022405fdf65507fea2f082
/src/test/java/com/att/test/jsontranformer/AppTest.java
6b85aed722fed2cc9981be65671168a917170388
[]
no_license
aagarwal9907/jsontranformer
0fa76626adf4ef1a2604df349557fc8dc66e8a6d
0b1ab6672d1e592467de7fd252a2a03d29ba2012
refs/heads/master
2021-07-03T18:58:53.385820
2017-09-24T18:10:53
2017-09-24T18:10:53
104,665,380
0
1
null
null
null
null
UTF-8
Java
false
false
655
java
package com.att.test.jsontranformer; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; /** * Unit test for simple App. */ public class AppTest extends TestCase { /** * Create the test case * * @param testName name of the test case */ public AppTest( String testName ) { super( testName ); } /** * @return the suite of tests being tested */ public static Test suite() { return new TestSuite( AppTest.class ); } /** * Rigourous Test :-) */ public void testApp() { assertTrue( true ); } }
e177ac6688b488e77957e585eab935c8afcd3dd0
fcf05db5c9183c308a7bf4ebae9688fc1eafe9b3
/app/src/main/java/com/example/JournalPerso/model/IndicateurCaseCochee.java
216e6937c4bd55be1bce34c92350d522e7ee524d
[]
no_license
nataire/JournalPersoAndroid
193a54c0b1e9abd76cb89d6a8592d781f4cdacdc
4f268e406220769b3940c7d02fdad0eccfc3a0fd
refs/heads/master
2022-09-21T19:24:23.483901
2020-06-06T15:19:21
2020-06-06T15:19:21
237,210,942
0
0
null
null
null
null
UTF-8
Java
false
false
1,679
java
package com.example.JournalPerso.model; import androidx.annotation.NonNull; public class IndicateurCaseCochee extends Indicateur implements Cloneable { private boolean etatBoutonSaisie; private boolean objectif; public IndicateurCaseCochee() { this.idIndicateur = java.lang.System.identityHashCode(this); } //region constructor public IndicateurCaseCochee(String nomIndicateur, boolean etatBoutonSaisie, boolean objectifCaseCochee, int idIndicateur) { this.nomIndicateur = nomIndicateur; this.typeIndicateur = "CaseCochee"; this.etatBoutonSaisie = etatBoutonSaisie; this.objectif = objectifCaseCochee; this.idIndicateur = idIndicateur; } public IndicateurCaseCochee(String nomIndicateur, boolean etatBoutonSaisie, boolean objectifCaseCochee) { this.nomIndicateur = nomIndicateur; this.typeIndicateur = "CaseCochee"; this.etatBoutonSaisie = etatBoutonSaisie; this.objectif = objectifCaseCochee; this.idIndicateur = java.lang.System.identityHashCode(this); } @NonNull @Override public Object clone() throws CloneNotSupportedException { return super.clone(); } //endregion //region getter setter public boolean isEtatBoutonSaisie() { return etatBoutonSaisie; } public void setEtatBoutonSaisie(boolean etatBoutonSaisie) { this.etatBoutonSaisie = etatBoutonSaisie; } public boolean isObjectifCaseCochee() { return objectif; } public void setObjectifCaseCochee(boolean objectifCaseCochee) { this.objectif = objectifCaseCochee; } //endregion }
948cdb5245a3c3be4137ed81c7b55031c41b0162
8baf6d5a65a7308fff4408c59ed797768e3eea22
/src/test/ConsProBenchmarkRunner.java
69741b28547c63021385878909b58c0764c92e01
[]
no_license
mengxi-chen/PHAULR
6d987179d03af87eb1da4ceb604076c51a847a64
11060de208b3997f357d1a1ed375e2ea0d1380d2
refs/heads/master
2021-05-27T07:35:54.829879
2014-11-14T08:52:13
2014-11-14T08:52:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,324
java
package test; import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingDeque; import messaging.message.IPMessage; import communication.Configuration; public class ConsProBenchmarkRunner { private int total_requests; private int rate; private int write_ratio; /** * @param total_requests total number of requests * @param rate the rate in which requests are generated and arrive * @param write_ratio the ratio of write requests in percentage */ public ConsProBenchmarkRunner(int total_requests, int rate, int write_ratio) { this.total_requests = total_requests; this.rate = rate; this.write_ratio = write_ratio; } public void GenerateBenchmark() { BlockingQueue<IPMessage> request_queue = new LinkedBlockingDeque<>(); new Thread(new PoissonWorkloadGenerator(request_queue, this.total_requests, this.rate, this.write_ratio)).start(); try { Thread.sleep(1000); } catch (InterruptedException ie) { ie.printStackTrace(); } new Thread(new ClientWithWorkload(request_queue, this.total_requests)).start(); } public void start() { // Configuration.INSTANCE.configSystem(); this.GenerateBenchmark(); } public static void main(String[] args) { Configuration.INSTANCE.configSystem(); new ConsProBenchmarkRunner(10000, 20, 90).start(); } }
[ "1102" ]
1102
8ccaed1997df44da6c47514ae9a620e131339715
db8a8bc86cb0d6a41f3595cce56c38a50ba00be0
/app/src/main/java/com/malong/sample/TestActivity.java
4b5b00eee325edceb8cef1177ac9c92be07470aa
[]
no_license
maxiaobu1999/DownloadAndroid
43649fba0a10424fafd0b198f6170d09efa6be66
033fc23e8726bca5188815aa11667b06d73420e4
refs/heads/master
2022-11-25T21:54:51.068832
2020-08-05T08:49:28
2020-08-05T08:49:28
277,808,400
2
0
null
null
null
null
UTF-8
Java
false
false
2,966
java
package com.malong.sample; import android.content.Context; import android.content.Intent; import android.database.ContentObserver; import android.net.Uri; import android.os.Bundle; import android.os.Handler; import android.util.Log; import androidx.appcompat.app.AppCompatActivity; import com.malong.moses.Constants; import com.malong.moses.Download; import com.malong.moses.DownloadService; import com.malong.moses.Request; import com.malong.moses.ProviderHelper; import com.malong.moses.utils.FileUtils; import com.malong.moses.utils.Utils; import java.io.File; public class TestActivity extends AppCompatActivity { public static final String TAG = "【TestActivity】"; private Context mContext; private ContentObserver mObserver; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_test); mContext = this; Intent intent = new Intent(); intent.setClass(mContext, DownloadService.class); mContext.startService(intent); mObserver = new ContentObserver(new Handler()) { @Override public void onChange(boolean selfChange, Uri uri) { super.onChange(selfChange, uri); Log.d(TAG, "onChange()" + uri.toString()); Log.d(TAG, "onChange()queryProcess=" + ProviderHelper.queryProcess(mContext,uri)); // Log.d(TAG, "onChange():queryStatus=" + DownloadManager.queryStatus(mContext,uri)); } }; findViewById(R.id.button).setOnClickListener(v -> { String pagkage = mContext.getPackageName(); String CONTENT_AUTHORITY = pagkage + ".downloads"; Uri BASE_CONTENT_URI = Uri.parse("content://" + CONTENT_AUTHORITY);// content://com.malong.downloadsample.downloads // String downloadUrl = Constants.BASE_URL+Constants.ZHU_XIAN_NAME; String downloadUrl = Constants.BASE_URL+Constants.TIK_NAME; String fileName = FileUtils.getFileNameFromUrl(downloadUrl); String filePath = mContext.getFilesDir() + File.separator + fileName;// /data/user/0/com.malong.downloadsample/files // 增 Request info = new Request(); info.status = Request.STATUS_PENDING; info. download_url= downloadUrl; info.destination_path = filePath; info.fileName = fileName; info.method = Request.METHOD_BREAKPOINT; int downloadId= Download.doDownload(mContext, info); getContentResolver().registerContentObserver(Utils.generateDownloadUri( mContext,downloadId), false, mObserver); }); findViewById(R.id.stop).setOnClickListener(v -> { Intent intent1 = new Intent(); intent1.setClass(mContext, DownloadService.class); mContext.stopService(intent1); }); } }
b23be155e83150e018acd34294a963f89e3c3ea8
02772e15bd04ee7104d7a62e2b1a9d50549d7739
/src/streams_demo/StreamDemo.java
6d0aa4913cd02e871952594e58abe0a2bea265c5
[]
no_license
rakesh-xor/Java-8-demos
23c83acc79eb2bdec6d2017f6f001bc6903363de
33e7fc52ee86aa9c8a625bcc7cf23db15b57a6a1
refs/heads/main
2023-03-17T21:53:43.048626
2021-03-12T11:00:10
2021-03-12T11:00:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
883
java
package streams_demo; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; public class StreamDemo { public static void main(String[] args) { List<Integer> arList =new ArrayList<Integer>(); arList.add(15); arList.add(25); arList.add(5); List<Integer> newAl =new ArrayList<Integer>(); newAl = arList.stream().filter(x -> x>=15).collect(Collectors.toList()); newAl.stream().forEach(x -> System.out.println(x)); //without streams: /*List<Integer> arListFromMEthod = findElements(arList); for (Integer i : arListFromMEthod) { System.out.println(i); } } public static List<Integer> findElements(List<Integer> arList){ List<Integer> newAl =new ArrayList<Integer>(); for(Integer i : arList) { if(i >= 15) { newAl.add(i); } } return newAl; }*/ } }
5227d4bf6b7a1831b4cb9da472e3024e53f0a9e3
7fdc730ec1ca5dfba595651c8a1df78436f7731b
/src/main/java/com/steven/hicks/logic/dao/VenueSearcher.java
84c33a8cada39e284c97a584649e9c83ef0cd6b0
[]
no_license
shicks255/SetlistFM_API
0c4e40f9edd7854d792115e903a663cd06bd23fb
21c0f815b475e14ffe4517614b13970999f19f27
refs/heads/master
2022-11-24T06:47:13.827664
2022-10-05T14:15:15
2022-10-05T14:15:15
142,797,927
0
0
null
2022-11-16T03:17:40
2018-07-29T21:50:52
Java
UTF-8
Java
false
false
5,229
java
package com.steven.hicks.logic.dao; import com.fasterxml.jackson.databind.ObjectMapper; import com.steven.hicks.beans.Venue; import com.steven.hicks.beans.VenueList; import com.steven.hicks.logic.queryBuilders.QueryBuilder; import com.steven.hicks.logic.queryBuilders.VenueQueryBuilder; import javax.net.ssl.HttpsURLConnection; import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.URL; public class VenueSearcher implements Searchable<Venue, VenueList> { private static ObjectMapper m_objectMapper = new ObjectMapper(); public VenueList m_venueList; @Override public int getNumberOfPages() { return m_venueList.getTotal() / m_venueList.getItemsPerPage(); } @Override public Venue get(String id) { Venue venue = null; String urlAddress = "https://api.setlist.fm/rest/1.0/venue/" + id; try { URL url = new URL(urlAddress); HttpsURLConnection connection = (HttpsURLConnection)url.openConnection(); connection.setRequestProperty("x-api-key", "692ab4ce-9835-4040-8bb8-d6bb77ba54f8"); connection.setRequestProperty("accept", "application/json"); connection.setRequestMethod("GET"); StringBuilder data = new StringBuilder(); String input2 = ""; BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); while ((input2 = in.readLine()) != null) data.append(input2); venue = m_objectMapper.readValue(data.toString(), Venue.class); } catch (Exception e) { System.out.println(e.getMessage()); } return venue; } @Override public void search(QueryBuilder queryBuilder, int pageNumber) { String urlAddress = "https://api.setlist.fm/rest/1.0/search/venues?"; StringBuilder queryString = new StringBuilder(); if (queryBuilder instanceof VenueQueryBuilder == false) { //throw exception } VenueQueryBuilder builder = (VenueQueryBuilder)queryBuilder; if (builder.getCityId().length() > 0) { if (queryString.length() > 0) queryString.append("&"); queryString.append("cityId=" + builder.getCityId()); } if (builder.getCityName().length() > 0) { if (queryString.length() > 0) queryString.append("&"); queryString.append("cityName=" + builder.getCityName()); } if (builder.getCountryName().length() > 0) { if (queryString.length() > 0) queryString.append("&"); queryString.append("country=" + builder.getCountryName()); } if (builder.getState().length() > 0) { if (queryString.length() > 0) queryString.append("&"); queryString.append("state=" + builder.getState()); } if (builder.getStateCode().length() > 0) { if (queryString.length() > 0) queryString.append("&"); queryString.append("stateCode=" + builder.getStateCode()); } if (builder.getName().length() > 0) { if (queryString.length() > 0) queryString.append("&"); queryString.append("name=" + builder.getName()); } if (queryString.length() > 0) { queryString.append("&"); queryString.append("p=" + pageNumber); } urlAddress += queryString.toString(); try { URL url = new URL(urlAddress); HttpsURLConnection connection = (HttpsURLConnection)url.openConnection(); connection.setRequestProperty("x-api-key", "692ab4ce-9835-4040-8bb8-d6bb77ba54f8"); connection.setRequestProperty("accept", "application/json"); connection.setRequestMethod("GET"); StringBuilder data = new StringBuilder(); String input2 = ""; BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); while ((input2 = in.readLine()) != null) data.append(input2); m_venueList = m_objectMapper.readValue(data.toString(), VenueList.class); } catch (Exception e) { System.out.println(e.getMessage()); } } @Override public boolean hasNextPage() { if (m_venueList == null) return false; int venuesSoFar = m_venueList.getPage() * m_venueList.getItemsPerPage(); if (m_venueList.getTotal() > venuesSoFar) return true; return false; } @Override public VenueList getNextPage(QueryBuilder queryBuilder) { int pageToGet = 1; if (m_venueList != null) pageToGet = m_venueList.getPage() + 1; return searchAndGet(queryBuilder, pageToGet); } @Override public VenueList searchAndGet(QueryBuilder queryBuilder, int pageNumber) { search(queryBuilder, pageNumber); return m_venueList; } @Override public VenueList getSearchResults() { return m_venueList; } }
f181c4718a61de28c129bb46cef00c2f4b8542fd
94e08513d1d4a2d0f29c85daba9dfc950c67295e
/lib/src/net/sf/jasperreports/web/util/DefaultWebRequestContext.java
d69e5648e7842314d2a859f188b8a279cb6c1fa0
[]
no_license
Rocky28/Assemble
20fd38f8e303459a6ccfc0665287043a0bfd486f
28c8d9b89c41c10137670c76f1b9e179674857c6
refs/heads/master
2020-04-18T03:45:02.699210
2014-09-01T15:54:50
2014-09-01T15:54:50
23,326,051
1
0
null
null
null
null
UTF-8
Java
false
false
1,959
java
/* * JasperReports - Free Java Reporting Library. * Copyright (C) 2001 - 2013 Jaspersoft Corporation. All rights reserved. * http://www.jaspersoft.com * * Unless you have purchased a commercial license agreement from Jaspersoft, * the following license terms apply: * * This program is part of JasperReports. * * JasperReports is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * JasperReports is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with JasperReports. If not, see <http://www.gnu.org/licenses/>. */ package net.sf.jasperreports.web.util; import javax.servlet.http.HttpServletRequest; import net.sf.jasperreports.engine.JasperReportsContext; /** * @author Lucian Chirita ([email protected]) * @version $Id: DefaultWebRequestContext.java 6853 2014-01-30 16:32:58Z lucianc $ */ public class DefaultWebRequestContext implements WebRequestContext { private JasperReportsContext jasperReportsContext; private HttpServletRequest request; @Override public JasperReportsContext getJasperReportsContext() { return jasperReportsContext; } public HttpServletRequest getRequest() { return request; } public void setJasperReportsContext(JasperReportsContext jasperReportsContext) { this.jasperReportsContext = jasperReportsContext; } public void setRequest(HttpServletRequest request) { this.request = request; } @Override public String getRequestContextPath() { return request == null ? null : request.getContextPath(); } }
65ea8dd8158c7585caa3fe0cd2836d95a6c91c63
8ae87351fecb06b1d1f4abd1b77660f44bc62097
/web-services workspace/SpringBootMicroservices/src/test/java/com/cjc/main/SpringBootMicroservicesApplicationTests.java
ecd534db1ccab813946048f846138e48670e801b
[]
no_license
omkar-falke/micro-web-service
d852791cc22a7d70a13cf30246f3df5318b80274
e11a90f3b03abfd72e12b73a4f818506ee680ebc
refs/heads/master
2023-04-11T07:23:14.388589
2019-07-25T15:22:20
2019-07-25T15:22:20
198,855,402
0
0
null
2023-03-27T22:22:25
2019-07-25T15:18:56
JavaScript
UTF-8
Java
false
false
346
java
package com.cjc.main; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class SpringBootMicroservicesApplicationTests { @Test public void contextLoads() { } }
1386dbed1c4279600f6fec2424668c180f24518c
885a722e3e5814ae4942ac5e8cf8d0091e734b4c
/BAEKJOON/2000~/2902_KMP는 왜 KMP일까(JAVA)/Main.java
8c38c64865837303692908c28ce515fe893c01dc
[]
no_license
ledpear/algorithm
52f3ea25842eee20b3bbd48e51825b9df4942e03
4922c6fe5ca0b98a90dee218b756006e7ba05d82
refs/heads/master
2023-06-09T17:47:45.674244
2023-06-03T13:47:11
2023-06-03T13:47:11
133,370,193
0
0
null
null
null
null
UTF-8
Java
false
false
459
java
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st; String input = br.readLine(), output = ""; String[] strSplit = input.split("-"); for(String item : strSplit){ output += item.charAt(0); } System.out.println(output); } }
93c144b5c788926679857280028b0ad9cb9a0b86
a353ad95103d6b43f7638fe212966279b825203a
/app/src/main/java/com/example/wtl/ttms/AllFilmTypeFragment/LoveFragment.java
d2e7a66ae6d329773ca289505b66a9e35fd733da
[]
no_license
WeiTianLiang/TTMS
49967176a9c5015de7c2b99398152ced12f0ffc1
1523eb831cb21a20a785c68eae39a2e764b4b7fb
refs/heads/master
2020-03-11T06:15:55.910639
2018-04-17T01:16:42
2018-04-17T01:16:42
129,825,929
0
0
null
null
null
null
UTF-8
Java
false
false
2,293
java
package com.example.wtl.ttms.AllFilmTypeFragment; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.example.wtl.ttms.Adapter.FilmAdapter; import com.example.wtl.ttms.Class.Film; import com.example.wtl.ttms.R; import java.util.ArrayList; import java.util.List; /** * 爱情片 * Created by WTL on 2018/4/16. */ public class LoveFragment extends Fragment{ private List<Film> filmList = new ArrayList<>(); private RecyclerView film_recycler; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.film_racycler,container,false); film_recycler = view.findViewById(R.id.film_recycler); init(); DefaultItemAnimator animator = new DefaultItemAnimator(); animator.setRemoveDuration(200); animator.setChangeDuration(400); animator.setAddDuration(200); film_recycler.getBackground().setAlpha(150); LinearLayoutManager manager = new LinearLayoutManager(getContext()); film_recycler.setLayoutManager(manager); film_recycler.setItemAnimator(animator); final FilmAdapter adapter = new FilmAdapter(filmList,getContext()); film_recycler.setAdapter(adapter); return view; } private void init() { Film film3 = new Film("爱情片","阿甘正传","100分钟","不知道","¥24"); filmList.add(film3); Film film33 = new Film("爱情片","阿甘正传","100分钟","不知道","¥24"); filmList.add(film33); Film film333 = new Film("爱情片","阿甘正传","100分钟","不知道","¥24"); filmList.add(film333); Film film332 = new Film("爱情片","阿甘正传","100分钟","不知道","¥24"); filmList.add(film332); Film film32 = new Film("爱情片","阿甘正传","100分钟","不知道","¥24"); filmList.add(film32); } }
060bf617bdcdf63738ef3714f261d1aaf4f0dac6
f0daa8b59ca5accb6920aa61007c6bd10d6e2961
/src/main/java/mutants/SequentialHeap/LOI_29/SequentialHeap.java
d66dec12f5757d88b3a0788788fc04b5d948817a
[]
no_license
phantomDai/cptiscas
09b211ff984c228471d9ab28f8c5c05f946c753c
83e3ef777b7677c913a0839f8dd8e4df1bc20e0e
refs/heads/master
2021-07-05T10:54:16.856267
2019-06-06T06:18:12
2019-06-06T06:18:12
143,225,040
0
0
null
null
null
null
UTF-8
Java
false
false
3,053
java
// This is a mutant program. // Author : ysma package mutants.SequentialHeap.LOI_29; public class SequentialHeap<T> implements PQueue<T> { private static final int ROOT = 1; int next; HeapNode<T>[] heap; public SequentialHeap( int capacity ) { next = 1; heap = (HeapNode<T>[]) new HeapNode[capacity + 1]; for (int i = 0; i < capacity + 1; i++) { heap[i] = new HeapNode<T>(); } } public void add( T item, int priority ) { int child = next++; heap[child].init( item, priority ); while (child > ROOT) { int parent = child / 2; int oldChild = child; if (heap[child].priority < heap[parent].priority) { swap( child, parent ); child = parent; } else { return; } } } public T getMin() { return heap[ROOT].item; } public synchronized T removeMin() { int bottom = --next; T item = heap[ROOT].item; swap( ROOT, bottom ); if (bottom == ROOT) { return item; } int child = 0; int parent = ROOT; while (parent < heap.length / 2) { int left = parent * 2; int right = parent * 2 + 1; if (left >= next) { break; } else { if (~right >= next || heap[left].priority < heap[right].priority) { child = left; } else { child = right; } } if (heap[child].priority < heap[parent].priority) { swap( parent, child ); parent = child; } else { break; } } return item; } private synchronized void swap( int i, int j ) { HeapNode<T> node = heap[i]; heap[i] = heap[j]; heap[j] = node; } public boolean isEmpty() { return next == 0; } public void sanityCheck() { int stop = next; for (int i = ROOT; i < stop; i++) { int left = i * 2; int right = i * 2 + 1; if (left < stop && heap[left].priority < heap[i].priority) { System.out.println( "Heap property violated:" ); System.out.printf( "\theap[%d] = %d, left child heap[%d] = %d\n", i, heap[i].priority, left, heap[left].priority ); } if (right < stop && heap[right].priority < heap[i].priority) { System.out.println( "Heap property violated:" ); System.out.printf( "\theap[%d] = %d, right child heap[%d] = %d\n", i, heap[i].priority, right, heap[right].priority ); } } } private static class HeapNode<S> { int priority; S item; public void init( S myItem, int myPriority ) { item = myItem; priority = myPriority; } } }
9e0edcf367b761115dd2b5a881ffa3f416851d60
7cef9fec88b8023f585c7cf2e01b0e5e764b13af
/src/main/java/com/libraryManagementSystem/serviceImpl/StudentServiceImpl.java
2ec23a36ff29eecb4717a0a7647f11d770c4f1dc
[]
no_license
sranjika/Library
3ad7242dd499afd7b9f4f71460f18c7199464d1a
f91d00e10f2261cb674fcd71907220876c058a34
refs/heads/master
2023-03-01T02:39:18.707725
2021-02-08T08:12:20
2021-02-08T08:12:20
337,002,631
0
0
null
null
null
null
UTF-8
Java
false
false
2,190
java
package com.libraryManagementSystem.serviceImpl; import com.libraryManagementSystem.beans.Book; import com.libraryManagementSystem.dao.IbookDao; import com.libraryManagementSystem.dao.IstudentDao; import com.libraryManagementSystem.daoImpl.BookDaoImpl; import com.libraryManagementSystem.daoImpl.StudentDaoImpl; import com.libraryManagementSystem.service.IstudentService; import java.util.Scanner; public class StudentServiceImpl implements IstudentService { Scanner sa=new Scanner(System.in); IbookDao bookDao = new BookDaoImpl(); IstudentDao studentDao = new StudentDaoImpl(); @Override public void searchBook() { System.out.print("Enter book name :"); String bookName = sa.nextLine(); bookDao.searchBook(bookName); } @Override public void issueBook() { System.out.println("Please enter the Book name which book you want to issue: "); String bookName = sa.nextLine(); Book book = bookDao.searchBook(bookName); bookDao.issueBook(book); System.out.println("...booko issued..\n"); } @Override public void returnBook() { System.out.println("Please enter the bookId , bookName, authName, subject,pages, price which book you want to return: "); System.out.println("Book id : "); int bookId = sa.nextInt(); sa.nextLine(); System.out.println("Book name : "); String bookName = sa.nextLine(); System.out.println("Author name : "); String authorName = sa.nextLine(); System.out.println("subject name : "); String subject = sa.nextLine(); System.out.println("Book pages : "); int pages = sa.nextInt(); System.out.println("Price : "); int price = sa.nextInt(); sa.nextLine(); bookDao.addBook( bookId, bookName, authorName, subject,pages, price); System.out.println("Book returned successfully\n "); System.out.println(".....Choose another task..... "); } @Override public void getAllBooks() { for (Book b :bookDao.getAllBooks() ) { System.out.println(b); } } }
0f042ba35d31873c1713850f58bbba3d1e11132f
810fb727187ea450a603e581a99854f8011bfaca
/treinar_7900/projeto/treinar/src/br/com/treinarminas/treinar/io/TestaEntrada.java
f831cb9cd2acdc67e6fca062c60492613cc17e11
[]
no_license
ggmoura/treinar
c97698cfc4cfb9024e2d790bcab64d9658541f2c
5c37e03981cb6d9e69fad0e5c3af8bdb4036e638
refs/heads/master
2022-12-01T04:17:09.451724
2019-10-19T00:53:56
2019-10-19T00:53:56
37,018,624
1
1
null
2022-11-24T07:39:41
2015-06-07T14:02:26
Java
UTF-8
Java
false
false
2,475
java
package br.com.treinarminas.treinar.io; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.text.Collator; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; public class TestaEntrada { public static void main(String[] args) throws IOException { File f = new File("arquivo.txt"); Map<Character, List<String>> mapNomes = new HashMap<Character, List<String>>(); String nome = null; Character primeiraLetra = null; List<String> listaNomes = null; if (f.exists()) { InputStream is = new FileInputStream(f); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); nome = br.readLine(); // primeira linha while (nome != null) { if (!nome.isEmpty()) { primeiraLetra = Character.toUpperCase(nome.charAt(0)); if (!mapNomes.containsKey(primeiraLetra)) { listaNomes = new ArrayList<String>(); mapNomes.put(primeiraLetra, listaNomes); } mapNomes.get(primeiraLetra).add(nome); } nome = br.readLine(); } br.close(); OutputStream os = new FileOutputStream("saida.txt"); OutputStreamWriter osw = new OutputStreamWriter(os); BufferedWriter bw = new BufferedWriter(osw); List<Entry<Character, List<String>>> entrysList = new ArrayList<>(mapNomes.entrySet()); Collections.sort(entrysList, new Comparator<Entry<Character, List<String>>>() { @Override public int compare(Entry<Character, List<String>> o1, Entry<Character, List<String>> o2) { return o1.getKey().compareTo(o2.getKey()); } }); //ordena sem acentuacao Collator collator = Collator.getInstance(); collator.setStrength(Collator.PRIMARY); StringBuilder sb = new StringBuilder(); for (Entry<Character, List<String>> entry : entrysList) { Collections.sort(entry.getValue(), collator); sb.append(entry.getKey()).append(" ").append(entry.getValue()).append("\n"); } bw.write(sb.toString()); bw.close(); } } }
[ "Usuario@SL05PROFESSOR" ]
Usuario@SL05PROFESSOR
593dec486f8d959dbbfe37343e40308368f23071
a1f2113f479d176eebc97a870523d7283dbbef02
/shoppingCart/src/main/java/com/mediaocean/shoppingcart/service/impl/CheckoutServiceImpl.java
f353f1cb1b7f4204c22e9139d663321bcd52a174
[]
no_license
mubshaikh/Assignments
3b57bf8475c3f41714c425288363cc8f437ece19
70551f0f3f896089fcdecd7b002110aefb271ee9
refs/heads/master
2021-01-10T06:52:24.491084
2016-02-11T16:17:21
2016-02-11T16:17:21
51,505,101
0
0
null
null
null
null
UTF-8
Java
false
false
89
java
package com.mediaocean.shoppingcart.service.impl; public class CheckoutServiceImpl { }
6f42ea47197ee8b2b1412259b670b44470a749ff
ffa798dbbc911e5582cfd75c856a218f974a4ac0
/main.java
6b296a57c2d7c033f63815f00721b4839e65db12
[]
no_license
sakshamagar/fun-java-pc
471ddcdefc4d0dae03bf6a80d228b5c9e5b1f3da
97c08050f9dd7a6f0f0c86ce1353c796bb1cfddb
refs/heads/master
2022-03-09T01:26:49.906335
2019-11-25T07:04:09
2019-11-25T07:04:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
116
java
import java.lang.*; import java.util.*; public static void main(String[] args){ System.out.println("Welcome!"); }
f7bb74f852ebbe49355f29da0f2cf7a0b0de414a
c6e9d89306da3dee1b2339014d8b8216309c052b
/src/org/adligo/fabricate_tests/models/dependencies/LibraryDependencyTrial.java
7d901bdada0749a1a7adebcef8e46a831584a715
[ "Apache-2.0" ]
permissive
adligo/fabricate_tests.adligo.org
70143d659c1cf50cc9ef23e1a0c1ac74ba87fa5a
b2d2c80d2c6fb84338fb1c1599888629b348abe0
refs/heads/master
2021-01-10T21:35:35.966080
2015-04-01T13:36:45
2015-04-01T13:36:45
33,228,690
0
0
null
null
null
null
UTF-8
Java
false
false
5,486
java
package org.adligo.fabricate_tests.models.dependencies; import org.adligo.fabricate.models.dependencies.LibraryDependency; import org.adligo.fabricate.models.dependencies.LibraryDependencyMutant; import org.adligo.fabricate.xml.io_v1.library_v1_0.LibraryReferenceType; import org.adligo.tests4j.shared.asserts.common.ExpectedThrowable; import org.adligo.tests4j.shared.asserts.common.I_Thrower; import org.adligo.tests4j.system.shared.trials.SourceFileScope; import org.adligo.tests4j.system.shared.trials.Test; import org.adligo.tests4j_4mockito.MockitoSourceFileTrial; import java.util.ArrayList; import java.util.List; @SourceFileScope (sourceClass=LibraryDependency.class, minCoverage=80.0) public class LibraryDependencyTrial extends MockitoSourceFileTrial { @Test public void testConstructorExceptions() { assertThrown(new ExpectedThrowable(NullPointerException.class), new I_Thrower() { @SuppressWarnings("unused") @Override public void run() throws Throwable { new LibraryDependency(null); } }); } @Test public void testConstructorCopy() { LibraryDependencyMutant pdm = new LibraryDependencyMutant(); pdm.setPlatform("platform"); pdm.setLibraryName("ln"); assertEquals("platform", pdm.getPlatform()); assertEquals("ln", pdm.getLibraryName()); LibraryDependency pdm2 = new LibraryDependency(pdm); assertEquals("platform", pdm2.getPlatform()); assertEquals("ln", pdm2.getLibraryName()); } @SuppressWarnings("boxing") @Test public void testMethodsEqualsHashCodeAndToString() { LibraryDependencyMutant pdm = new LibraryDependencyMutant(); pdm.setPlatform("platform"); pdm.setLibraryName("ln"); LibraryDependency pd = new LibraryDependency(pdm); LibraryDependencyMutant pdmA = new LibraryDependencyMutant(); pdmA.setPlatform("platform"); pdmA.setLibraryName("ln"); LibraryDependency pdA = new LibraryDependency(pdmA); LibraryDependencyMutant pdm2 = new LibraryDependencyMutant(); pdm2.setPlatform("platform"); pdm2.setLibraryName("ln2"); LibraryDependency pd2 = new LibraryDependency(pdm2); LibraryDependencyMutant pdm3 = new LibraryDependencyMutant(); pdm3.setPlatform("platform3"); pdm3.setLibraryName("ln"); LibraryDependency pd3 = new LibraryDependency(pdm3); LibraryDependencyMutant pdm4 = new LibraryDependencyMutant(); pdm4.setLibraryName("ln"); LibraryDependency pd4 = new LibraryDependency(pdm4); LibraryDependencyMutant pdm5 = new LibraryDependencyMutant(); pdm5.setPlatform("platform"); LibraryDependency pd5 = new LibraryDependency(pdm5); //LibraryDependency ld = new LibraryDependency() assertEquals(pd, pd); assertEquals(pd.hashCode(), pd.hashCode()); assertEquals("LibraryDependency [name=ln,platform=platform]", pd.toString()); assertEquals(pd, pdA); assertEquals(pd.hashCode(), pdA.hashCode()); assertNotEquals(pd, pd2); assertNotEquals(pd.hashCode(), pd2.hashCode()); assertNotEquals(pd, pd3); assertNotEquals(pd.hashCode(), pd3.hashCode()); assertNotEquals(pd, pd4); assertNotEquals(pd.hashCode(), pd4.hashCode()); assertNotEquals(pd, pd5); assertNotEquals(pd.hashCode(), pd5.hashCode()); assertEquals("LibraryDependency [name=ln2,platform=platform]", pd2.toString()); assertEquals("LibraryDependency [name=ln,platform=platform3]", pd3.toString()); assertNotEquals(pdA, pd2); assertNotEquals(pdA.hashCode(), pd2.hashCode()); assertNotEquals(pdA, pd3); assertNotEquals(pdA.hashCode(), pd3.hashCode()); assertNotEquals(pdA, pd4); assertNotEquals(pdA.hashCode(), pd4.hashCode()); assertNotEquals(pdA, pd5); assertNotEquals(pdA.hashCode(), pd5.hashCode()); assertEquals("LibraryDependency [name=ln]", pd4.toString()); assertNotEquals(pd3, pdA); assertNotEquals(pd3.hashCode(), pdA.hashCode()); assertNotEquals(pd3, pd2); assertNotEquals(pd3.hashCode(), pd2.hashCode()); assertNotEquals(pd3, pd4); assertNotEquals(pd3.hashCode(), pd4.hashCode()); assertNotEquals(pd3, pd5); assertNotEquals(pd3.hashCode(), pd5.hashCode()); assertEquals("LibraryDependency [name=null,platform=platform]", pd5.toString()); } @Test public void testStaticMethodsConvert() { LibraryReferenceType lrt = new LibraryReferenceType(); lrt.setPlatform("platform"); lrt.setValue("libA"); LibraryDependency ldm = LibraryDependency.convert(lrt); assertEquals("platform", ldm.getPlatform()); assertEquals("libA", ldm.getLibraryName()); LibraryReferenceType lrtB = new LibraryReferenceType(); lrtB.setPlatform("platformB"); lrtB.setValue("libB"); LibraryDependency ldmB = LibraryDependency.convert(lrtB); assertEquals("platformB", ldmB.getPlatform()); assertEquals("libB", ldmB.getLibraryName()); List<LibraryReferenceType> asList = new ArrayList<LibraryReferenceType>(); asList.add(lrt); asList.add(lrtB); List<LibraryDependency> convertedList = LibraryDependency.convert(asList); ldm = convertedList.get(0); assertEquals("platform", ldm.getPlatform()); assertEquals("libA", ldm.getLibraryName()); ldmB = convertedList.get(1); assertEquals("platformB", ldmB.getPlatform()); assertEquals("libB", ldmB.getLibraryName()); } }
3b1f0459848d3502d91215dccba2c376bcaf41c1
f94af9d8622ff0c1db6536d66693fdfb45cac0fe
/src/main/java/com/sc/interview/crudapp/CrudApplication.java
11567609532f912991e209bae396a47c24e4d792
[]
no_license
kevi793/UserCrud
3843b0749da3b3be1438695894e03c68c52f3bcf
b8c62a535deb23207bf995df1f3d030d2aea304d
refs/heads/master
2020-08-06T12:16:23.274334
2019-10-05T05:09:36
2019-10-05T05:09:36
212,972,117
0
0
null
null
null
null
UTF-8
Java
false
false
432
java
package com.sc.interview.crudapp; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; @SpringBootApplication public class CrudApplication extends SpringBootServletInitializer { public static void main(String[] args) { SpringApplication.run(CrudApplication.class, args); } }
fc9a01f0e3ba81e4d7b2d7ff363da49bba95f69e
ab8cefea4376953cf61fa3b820d9cdc302c6cc4d
/Temperature/src/ru/academits/bondyuk/model/KelvinConverter.java
f9a0f595315955f1f2bbacfb87b6de57e75e3e44
[]
no_license
asbondyuk/AcademItSchool
3d96f551032fd158c85943d8d2388ff0d178bd62
fc239673935e6d57969b4d8321efce6acddcdd17
refs/heads/master
2020-12-27T01:34:45.592103
2020-05-07T22:59:55
2020-05-07T22:59:55
237,721,099
0
0
null
null
null
null
UTF-8
Java
false
false
612
java
package ru.academits.bondyuk.model; public class KelvinConverter { private KelvinConverter() { } public static double convert(double value, TemperatureTypes types) { switch (types) { case FAHRENHEIT: return convertToFahrenheit(value); case CELSIUS: return convertToCelsius(value); } return value; } private static double convertToCelsius(double value) { return value - 273.15; } private static double convertToFahrenheit(double value) { return (value - 273.15) * 9 / 5 + 32; } }
9e17401ef1fdca8b4d9220af26c402f3bc6eeaf6
da53e363c07e16abb281c3e826f5ec3c8182db9a
/BookHub/app/src/main/java/com/androidexample/bookhub/KenBurnsView.java
6c6aca7462fa470e46d97a4230ab32d0ef12e0dd
[]
no_license
manmeet-22/BookHub-App
ba14989a1090d5a11471589375358d1e379a92a5
ec19afb9967e1051554115c960f66991c12289a4
refs/heads/master
2021-12-14T19:22:30.227412
2021-12-07T17:14:58
2021-12-07T17:14:58
85,737,026
1
0
null
null
null
null
UTF-8
Java
false
false
10,830
java
package com.androidexample.bookhub; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Matrix; import android.graphics.RectF; import android.graphics.drawable.Drawable; import android.net.Uri; import android.util.AttributeSet; import android.widget.ImageView; /** * {@link ImageView} extension that animates its image with the * <a href="http://en.wikipedia.org/wiki/Ken_Burns_effect">Ken Burns Effect</a>. * * @author Flavio Faria * @see Transition * @see TransitionGenerator */ public class KenBurnsView extends ImageView { /** * Delay between a pair of frames at a 60 FPS frame rate. */ private static final long FRAME_DELAY = 1000 / 60; /** * Matrix used to perform all the necessary transition transformations. */ private final Matrix mMatrix = new Matrix(); /** * The rect that holds the bounds of this view. */ private final RectF mViewportRect = new RectF(); /** * The {@link TransitionGenerator} implementation used to perform the transitions between * rects. The default {@link TransitionGenerator} is {@link RandomTransitionGenerator}. */ private TransitionGenerator mTransGen = new RandomTransitionGenerator(); /** * A {@link TransitionListener} to be notified when * a transition starts or ends. */ private TransitionListener mTransitionListener; /** * The ongoing transition. */ private Transition mCurrentTrans; /** * The rect that holds the bounds of the current {@link Drawable}. */ private RectF mDrawableRect; /** * The progress of the animation, in milliseconds. */ private long mElapsedTime; /** * The time, in milliseconds, of the last animation frame. * This is useful to increment {@link #mElapsedTime} regardless * of the amount of time the animation has been paused. */ private long mLastFrameTime; /** * Controls whether the the animation is running. */ private boolean mPaused; /** * Indicates whether the parent constructor was already called. * This is needed to distinguish if the image is being set before * or after the super class constructor returns. */ private boolean mInitialized; public KenBurnsView(Context context) { this(context, null); } public KenBurnsView(Context context, AttributeSet attrs) { this(context, attrs, 0); } public KenBurnsView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); mInitialized = true; // Attention to the super call here! super.setScaleType(ScaleType.MATRIX); } @Override public void setScaleType(ScaleType scaleType) { // It'll always be center-cropped by default. } @Override public void setVisibility(int visibility) { super.setVisibility(visibility); /* When not visible, onDraw() doesn't get called, but the time elapses anyway. */ switch (visibility) { case VISIBLE: resume(); break; default: pause(); break; } } @Override public void setImageBitmap(Bitmap bm) { super.setImageBitmap(bm); handleImageChange(); } @Override public void setImageResource(int resId) { super.setImageResource(resId); handleImageChange(); } @Override public void setImageURI(Uri uri) { super.setImageURI(uri); handleImageChange(); } @Override public void setImageDrawable(Drawable drawable) { super.setImageDrawable(drawable); handleImageChange(); } @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); restart(); } @Override protected void onDraw(Canvas canvas) { Drawable d = getDrawable(); if (!mPaused && d != null) { if (mDrawableRect.isEmpty()) { updateDrawableBounds(); } else if (hasBounds()) { if (mCurrentTrans == null) { // Starting the first transition. startNewTransition(); } if (mCurrentTrans.getDestinyRect() != null) { // If null, it's supposed to stop. mElapsedTime += System.currentTimeMillis() - mLastFrameTime; RectF currentRect = mCurrentTrans.getInterpolatedRect(mElapsedTime); float widthScale = mDrawableRect.width() / currentRect.width(); float heightScale = mDrawableRect.height() / currentRect.height(); // Scale to make the current rect match the smallest drawable dimension. float currRectToDrwScale = Math.min(widthScale, heightScale); // Scale to make the current rect match the viewport bounds. float currRectToVpScale = mViewportRect.width() / currentRect.width(); // Combines the two scales to fill the viewport with the current rect. float totalScale = currRectToDrwScale * currRectToVpScale; float translX = totalScale * (mDrawableRect.centerX() - currentRect.left); float translY = totalScale * (mDrawableRect.centerY() - currentRect.top); /* Performs matrix transformations to fit the content of the current rect into the entire view. */ mMatrix.reset(); mMatrix.postTranslate(-mDrawableRect.width() / 2, -mDrawableRect.height() / 2); mMatrix.postScale(totalScale, totalScale); mMatrix.postTranslate(translX, translY); setImageMatrix(mMatrix); // Current transition is over. It's time to start a new one. if (mElapsedTime >= mCurrentTrans.getDuration()) { fireTransitionEnd(mCurrentTrans); startNewTransition(); } } else { // Stopping? A stop event has to be fired. fireTransitionEnd(mCurrentTrans); } } mLastFrameTime = System.currentTimeMillis(); postInvalidateDelayed(FRAME_DELAY); } super.onDraw(canvas); } /** * Generates and starts a transition. */ private void startNewTransition() { if (!hasBounds()) { throw new UnsupportedOperationException("Can't start transition if the " + "drawable has no bounds!"); } mCurrentTrans = mTransGen.generateNextTransition(mDrawableRect, mViewportRect); mElapsedTime = 0; mLastFrameTime = System.currentTimeMillis(); fireTransitionStart(mCurrentTrans); } /** * Creates a new transition and starts over. */ public void restart() { int width = getWidth(); int height = getHeight(); if (width == 0 || height == 0) { throw new UnsupportedOperationException("Can't call restart() when view area is zero!"); } updateViewport(width, height); updateDrawableBounds(); if (hasBounds()) { startNewTransition(); } } /** * Checks whether this view has bounds. * * @return */ private boolean hasBounds() { return !mViewportRect.isEmpty(); } /** * Fires a start event on {@link #mTransitionListener}; * * @param transition the transition that just started. */ private void fireTransitionStart(Transition transition) { if (mTransitionListener != null && transition != null) { mTransitionListener.onTransitionStart(transition); } } /** * Fires an end event on {@link #mTransitionListener}; * * @param transition the transition that just ended. */ private void fireTransitionEnd(Transition transition) { if (mTransitionListener != null && transition != null) { mTransitionListener.onTransitionEnd(transition); } } /** * Sets the {@link TransitionGenerator} to be used in animations. * * @param transgen the {@link TransitionGenerator} to be used in animations. */ public void setTransitionGenerator(TransitionGenerator transgen) { mTransGen = transgen; if (hasBounds()) { startNewTransition(); } } /** * Updates the viewport rect. This must be called every time the size of this view changes. * * @param width the new viewport with. * @param height the new viewport height. */ private void updateViewport(float width, float height) { mViewportRect.set(0, 0, width, height); } /** * Updates the drawable bounds rect. This must be called every time the drawable * associated to this view changes. */ private void updateDrawableBounds() { if (mDrawableRect == null) { mDrawableRect = new RectF(); } Drawable d = getDrawable(); if (d != null) { mDrawableRect.set(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight()); } } /** * This method is called every time the underlying image * is changed. */ private void handleImageChange() { updateDrawableBounds(); /* Don't start a new transition if this event was fired during the super constructor execution. The view won't be ready at this time. Also, don't start it if this view size is still unknown. */ if (mInitialized && hasBounds()) { startNewTransition(); } } public void setTransitionListener(TransitionListener transitionListener) { mTransitionListener = transitionListener; } /** * Pauses the Ken Burns Effect animation. */ public void pause() { mPaused = true; } /** * Resumes the Ken Burns Effect animation. */ public void resume() { mPaused = false; // This will make the animation to continue from where it stopped. mLastFrameTime = System.currentTimeMillis(); invalidate(); } /** * A transition listener receives notifications when a transition starts or ends. */ public interface TransitionListener { /** * Notifies the start of a transition. * * @param transition the transition that just started. */ public void onTransitionStart(Transition transition); /** * Notifies the end of a transition. * * @param transition the transition that just ended. */ public void onTransitionEnd(Transition transition); } }
361980dee80e654809021484d13dc123a477dae3
ade519c18a67a4925c1dd1d9532c8eab3612f62a
/Employee.java
f156fdf21b1a64450a990666f4eb616e5db724da
[]
no_license
lrbell17/EmployeeManagementSystem
c73213fe8f199108812e229374167d0a941adc8b
67349269edf8389b87788f93ca489e4db58dda29
refs/heads/master
2022-07-01T08:34:52.995663
2020-05-09T17:56:22
2020-05-09T17:56:22
262,614,770
0
0
null
2020-05-09T16:42:05
2020-05-09T16:42:04
null
UTF-8
Java
false
false
3,312
java
package com.cognixia.jump.teamGarbage.employeeManagement; public class Employee { private String firstName; private String lastName; private Company company; private Department department; private String companyName; private String departmentName; // Constructor (Overloaded): public Employee(String firstName, String lastName, Company company, Department department) { this.firstName = firstName; this.lastName = lastName; this.company = company; this.department = department; this.companyName = company.getCompanyName(); this.departmentName = department.getDepartmentName(); } public Employee(String firstName, String lastName, Department department) { this.firstName = firstName; this.lastName = lastName; this.company = null; this.department = department; this.companyName = null; this.departmentName = department.getDepartmentName(); } public Employee(String firstName, String lastName, Company company) { this.firstName = firstName; this.lastName = lastName; this.company = company; this.department = null; this.companyName = company.getCompanyName(); this.departmentName = null; } public Employee(String firstName, String lastName) { this.firstName = firstName; this.lastName = lastName; this.company = null; this.department = null; this.companyName = null; this.departmentName = null; } // Methods: public String getEmployeeEmail() { if (departmentName == null && companyName != null) { return firstName.toLowerCase() + "." + lastName.toLowerCase() + "@" + companyName.toLowerCase().replaceAll("\\s+", "") + ".com"; } else if (departmentName != null && companyName != null) { return firstName.toLowerCase() + "." + lastName.toLowerCase() + "@" + departmentName.toLowerCase().replaceAll("\\s+", "") + "." + companyName.toLowerCase().replaceAll("\\s+", "") + ".com"; } else { return "This employee has no email."; } } // Getters/Setters public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public Department getDepartment() { return department; } public void setDepartment(Department department) { this.department = department; this.departmentName = department.getDepartmentName(); // sets department name as well } public Company getCompany() { return company; } public void setCompany(Company company) { this.company = company; this.companyName = company.getCompanyName(); // sets company name as well } public String getCompanyName() { return companyName; } public void setCompanyName(String companyName) { this.companyName = companyName; } public String getDepartmentName() { return departmentName; } public void setDepartmentName(String departmentName) { this.departmentName = departmentName; } // ToString: @Override public String toString() { return "Employee [firstName=" + firstName + ", lastName=" + lastName + ", company=" + companyName + ", department="+ departmentName + "]"; } }
852e312a4e9e0c2a63f77b3e620dcf03d97e1b64
28ba6bd6b0006be74530d3f3707f1e68a64d6b65
/src/main/java/com/sxt/utils/OSUtils.java
72ba8e012d06b085ec2339169708139828380d87
[]
no_license
tl2242464389/netty
e3d04a858c38f7da3b65715f294dffa4505b9988
d8522795748ccfac464b2ed56b30ec5793ac3428
refs/heads/master
2020-06-24T11:59:53.592444
2019-07-26T03:19:26
2019-07-26T03:19:26
198,957,909
0
0
null
null
null
null
UTF-8
Java
false
false
16,071
java
package com.sxt.utils; import java.net.InetAddress; import java.net.UnknownHostException; import java.util.Map; import java.util.Properties; import org.hyperic.sigar.CpuInfo; import org.hyperic.sigar.CpuPerc; import org.hyperic.sigar.FileSystem; import org.hyperic.sigar.FileSystemUsage; import org.hyperic.sigar.Mem; import org.hyperic.sigar.NetFlags; import org.hyperic.sigar.NetInterfaceConfig; import org.hyperic.sigar.NetInterfaceStat; import org.hyperic.sigar.OperatingSystem; import org.hyperic.sigar.Sigar; import org.hyperic.sigar.SigarException; import org.hyperic.sigar.Swap; import org.hyperic.sigar.Who; public class OSUtils { public static void main(String[] args) { try { // System信息,从jvm获取 property(); System.out.println("----------------------------------"); // cpu信息 cpu(); System.out.println("----------------------------------"); // 内存信息 memory(); System.out.println("----------------------------------"); // 操作系统信息 os(); System.out.println("----------------------------------"); // 用户信息 who(); System.out.println("----------------------------------"); // 文件系统信息 file(); System.out.println("----------------------------------"); // 网络信息 net(); System.out.println("----------------------------------"); // 以太网信息 ethernet(); System.out.println("----------------------------------"); } catch (Exception e1) { e1.printStackTrace(); } } private static void property() throws UnknownHostException { Runtime r = Runtime.getRuntime(); Properties props = System.getProperties(); InetAddress addr; addr = InetAddress.getLocalHost(); String ip = addr.getHostAddress(); Map<String, String> map = System.getenv(); String userName = map.get("USERNAME");// 获取用户名 String computerName = map.get("COMPUTERNAME");// 获取计算机名 String userDomain = map.get("USERDOMAIN");// 获取计算机域名 System.out.println("用户名: " + userName); System.out.println("计算机名: " + computerName); System.out.println("计算机域名: " + userDomain); System.out.println("本地ip地址: " + ip); System.out.println("本地主机名: " + addr.getHostName()); System.out.println("JVM可以使用的总内存: " + r.totalMemory()); System.out.println("JVM可以使用的剩余内存: " + r.freeMemory()); System.out.println("JVM可以使用的处理器个数: " + r.availableProcessors()); System.out.println("Java的运行环境版本: " + props.getProperty("java.version")); System.out.println("Java的运行环境供应商: " + props.getProperty("java.vendor")); System.out.println("Java供应商的URL: " + props.getProperty("java.vendor.url")); System.out.println("Java的安装路径: " + props.getProperty("java.home")); System.out.println("Java的虚拟机规范版本: " + props.getProperty("java.vm.specification.version")); System.out.println("Java的虚拟机规范供应商: " + props.getProperty("java.vm.specification.vendor")); System.out.println("Java的虚拟机规范名称: " + props.getProperty("java.vm.specification.name")); System.out.println("Java的虚拟机实现版本: " + props.getProperty("java.vm.version")); System.out.println("Java的虚拟机实现供应商: " + props.getProperty("java.vm.vendor")); System.out.println("Java的虚拟机实现名称: " + props.getProperty("java.vm.name")); System.out.println("Java运行时环境规范版本: " + props.getProperty("java.specification.version")); System.out.println("Java运行时环境规范供应商: " + props.getProperty("java.specification.vender")); System.out.println("Java运行时环境规范名称: " + props.getProperty("java.specification.name")); System.out.println("Java的类格式版本号: " + props.getProperty("java.class.version")); System.out.println("Java的类路径: " + props.getProperty("java.class.path")); System.out.println("加载库时搜索的路径列表: " + props.getProperty("java.library.path")); System.out.println("默认的临时文件路径: " + props.getProperty("java.io.tmpdir")); System.out.println("一个或多个扩展目录的路径: " + props.getProperty("java.ext.dirs")); System.out.println("操作系统的名称: " + props.getProperty("os.name")); System.out.println("操作系统的构架: " + props.getProperty("os.arch")); System.out.println("操作系统的版本: " + props.getProperty("os.version")); System.out.println("文件分隔符: " + props.getProperty("file.separator")); System.out.println("路径分隔符: " + props.getProperty("path.separator")); System.out.println("行分隔符: " + props.getProperty("line.separator")); System.out.println("用户的账户名称: " + props.getProperty("user.name")); System.out.println("用户的主目录: " + props.getProperty("user.home")); System.out.println("用户的当前工作目录: " + props.getProperty("user.dir")); } private static void memory() throws SigarException { Sigar sigar = new Sigar(); Mem mem = sigar.getMem(); // 内存总量 System.out.println("内存总量: " + mem.getTotal() / 1024L + "K av"); // 当前内存使用量 System.out.println("当前内存使用量: " + mem.getUsed() / 1024L + "K used"); // 当前内存剩余量 System.out.println("当前内存剩余量: " + mem.getFree() / 1024L + "K free"); Swap swap = sigar.getSwap(); // 交换区总量 System.out.println("交换区总量: " + swap.getTotal() / 1024L + "K av"); // 当前交换区使用量 System.out.println("当前交换区使用量: " + swap.getUsed() / 1024L + "K used"); // 当前交换区剩余量 System.out.println("当前交换区剩余量: " + swap.getFree() / 1024L + "K free"); } private static void cpu() throws SigarException { Sigar sigar = new Sigar(); CpuInfo infos[] = sigar.getCpuInfoList(); CpuPerc cpuList[] = null; cpuList = sigar.getCpuPercList(); for (int i = 0; i < infos.length; i++) {// 不管是单块CPU还是多CPU都适用 CpuInfo info = infos[i]; System.out.println("第" + (i + 1) + "块CPU信息"); System.out.println("CPU的总量MHz: " + info.getMhz());// CPU的总量MHz System.out.println("CPU生产商: " + info.getVendor());// 获得CPU的卖主,如:Intel System.out.println("CPU类别: " + info.getModel());// 获得CPU的类别,如:Celeron System.out.println("CPU缓存数量: " + info.getCacheSize());// 缓冲存储器数量 printCpuPerc(cpuList[i]); } } private static void printCpuPerc(CpuPerc cpu) { System.out.println("CPU用户使用率: " + CpuPerc.format(cpu.getUser()));// 用户使用率 System.out.println("CPU系统使用率: " + CpuPerc.format(cpu.getSys()));// 系统使用率 System.out.println("CPU当前等待率: " + CpuPerc.format(cpu.getWait()));// 当前等待率 System.out.println("CPU当前错误率: " + CpuPerc.format(cpu.getNice()));// System.out.println("CPU当前空闲率: " + CpuPerc.format(cpu.getIdle()));// 当前空闲率 System.out.println("CPU总的使用率: " + CpuPerc.format(cpu.getCombined()));// 总的使用率 } private static void os() { OperatingSystem OS = OperatingSystem.getInstance(); // 操作系统内核类型如: 386、486、586等x86 System.out.println("操作系统: " + OS.getArch()); System.out.println("操作系统CpuEndian(): " + OS.getCpuEndian());// System.out.println("操作系统DataModel(): " + OS.getDataModel());// // 系统描述 System.out.println("操作系统的描述: " + OS.getDescription()); // 操作系统类型 // System.out.println("OS.getName(): " + OS.getName()); // System.out.println("OS.getPatchLevel(): " + OS.getPatchLevel());// // 操作系统的卖主 System.out.println("操作系统的卖主: " + OS.getVendor()); // 卖主名称 System.out.println("操作系统的卖主名: " + OS.getVendorCodeName()); // 操作系统名称 System.out.println("操作系统名称: " + OS.getVendorName()); // 操作系统卖主类型 System.out.println("操作系统卖主类型: " + OS.getVendorVersion()); // 操作系统的版本号 System.out.println("操作系统的版本号: " + OS.getVersion()); } private static void who() throws SigarException { Sigar sigar = new Sigar(); Who who[] = sigar.getWhoList(); if (who != null && who.length > 0) { for (int i = 0; i < who.length; i++) { // System.out.println("当前系统进程表中的用户名" + String.valueOf(i)); Who _who = who[i]; System.out.println("用户控制台: " + _who.getDevice()); System.out.println("用户host: " + _who.getHost()); // System.out.println("getTime(): " + _who.getTime()); // 当前系统进程表中的用户名 System.out.println("当前系统进程表中的用户名: " + _who.getUser()); } } } private static void file() throws Exception { Sigar sigar = new Sigar(); FileSystem fslist[] = sigar.getFileSystemList(); try { for (int i = 0; i < fslist.length; i++) { System.out.println("分区的盘符名称" + i); FileSystem fs = fslist[i]; // 分区的盘符名称 System.out.println("盘符名称: " + fs.getDevName()); // 分区的盘符名称 System.out.println("盘符路径: " + fs.getDirName()); System.out.println("盘符标志: " + fs.getFlags());// // 文件系统类型,比如 FAT32、NTFS System.out.println("盘符类型: " + fs.getSysTypeName()); // 文件系统类型名,比如本地硬盘、光驱、网络文件系统等 System.out.println("盘符类型名: " + fs.getTypeName()); // 文件系统类型 System.out.println("盘符文件系统类型: " + fs.getType()); FileSystemUsage usage = null; usage = sigar.getFileSystemUsage(fs.getDirName()); switch (fs.getType()) { case 0: // TYPE_UNKNOWN :未知 break; case 1: // TYPE_NONE break; case 2: // TYPE_LOCAL_DISK : 本地硬盘 // 文件系统总大小 System.out.println(fs.getDevName() + "总大小: " + usage.getTotal() + "KB"); // 文件系统剩余大小 System.out.println(fs.getDevName() + "剩余大小: " + usage.getFree() + "KB"); // 文件系统可用大小 System.out.println(fs.getDevName() + "可用大小: " + usage.getAvail() + "KB"); // 文件系统已经使用量 System.out.println(fs.getDevName() + "已经使用量: " + usage.getUsed() + "KB"); double usePercent = usage.getUsePercent() * 100D; // 文件系统资源的利用率 System.out.println(fs.getDevName() + "资源的利用率: " + usePercent + "%"); break; case 3:// TYPE_NETWORK :网络 break; case 4:// TYPE_RAM_DISK :闪存 break; case 5:// TYPE_CDROM :光驱 break; case 6:// TYPE_SWAP :页面交换 break; } System.out.println(fs.getDevName() + "读出: " + usage.getDiskReads()); System.out.println(fs.getDevName() + "写入: " + usage.getDiskWrites()); } } catch (Exception e) { // TODO: handle exception e.printStackTrace(); } return; } private static void net() throws Exception { Sigar sigar = new Sigar(); String ifNames[] = sigar.getNetInterfaceList(); for (int i = 0; i < ifNames.length; i++) { String name = ifNames[i]; NetInterfaceConfig ifconfig = sigar.getNetInterfaceConfig(name); System.out.println("网络设备名: " + name);// 网络设备名 System.out.println("IP地址: " + ifconfig.getAddress());// IP地址 System.out.println("子网掩码: " + ifconfig.getNetmask());// 子网掩码 if ((ifconfig.getFlags() & 1L) <= 0L) { System.out.println("!IFF_UP...skipping getNetInterfaceStat"); continue; } NetInterfaceStat ifstat = sigar.getNetInterfaceStat(name); System.out.println(name + "接收的总包裹数:" + ifstat.getRxPackets());// 接收的总包裹数 System.out.println(name + "发送的总包裹数:" + ifstat.getTxPackets());// 发送的总包裹数 System.out.println(name + "接收到的总字节数:" + ifstat.getRxBytes());// 接收到的总字节数 System.out.println(name + "发送的总字节数:" + ifstat.getTxBytes());// 发送的总字节数 System.out.println(name + "接收到的错误包数:" + ifstat.getRxErrors());// 接收到的错误包数 System.out.println(name + "发送数据包时的错误数:" + ifstat.getTxErrors());// 发送数据包时的错误数 System.out.println(name + "接收时丢弃的包数:" + ifstat.getRxDropped());// 接收时丢弃的包数 System.out.println(name + "发送时丢弃的包数:" + ifstat.getTxDropped());// 发送时丢弃的包数 } } private static void ethernet() throws SigarException { Sigar sigar = null; sigar = new Sigar(); String[] ifaces = sigar.getNetInterfaceList(); for (int i = 0; i < ifaces.length; i++) { NetInterfaceConfig cfg = sigar.getNetInterfaceConfig(ifaces[i]); if (NetFlags.LOOPBACK_ADDRESS.equals(cfg.getAddress()) || (cfg.getFlags() & NetFlags.IFF_LOOPBACK) != 0 || NetFlags.NULL_HWADDR.equals(cfg.getHwaddr())) { continue; } System.out.println(cfg.getName() + "IP地址:" + cfg.getAddress());// IP地址 System.out.println(cfg.getName() + "网关广播地址:" + cfg.getBroadcast());// 网关广播地址 System.out.println(cfg.getName() + "网卡MAC地址:" + cfg.getHwaddr());// 网卡MAC地址 System.out.println(cfg.getName() + "子网掩码:" + cfg.getNetmask());// 子网掩码 System.out.println(cfg.getName() + "网卡描述信息:" + cfg.getDescription());// 网卡描述信息 System.out.println(cfg.getName() + "网卡类型" + cfg.getType());// } } }
a39962024f9b29127b010673d405f06d51ad520a
3c8c96e41b0af44b65779cfa95af5247c01922df
/src/main/java/io/vertx/ext/unit/report/impl/SimpleFormatter.java
24d4699e51896ec5fe22a72bb2d661b518b1c6e3
[]
no_license
alexlehm/vertx-unit
ec9e33b4d584f3ff3ffd5779df95037794f44cdb
c6b444454e1d9d46c5abd722f4f7731b4b7e3bd4
refs/heads/initial-work
2021-01-14T09:29:10.763743
2015-02-20T18:27:45
2015-02-20T18:27:45
29,323,669
0
0
null
2020-10-14T08:16:33
2015-01-15T23:37:37
Java
UTF-8
Java
false
false
2,110
java
package io.vertx.ext.unit.report.impl; import io.vertx.core.Handler; import io.vertx.core.buffer.Buffer; import io.vertx.ext.unit.report.TestResult; import io.vertx.ext.unit.report.Reporter; import java.util.function.BiConsumer; import java.util.function.Consumer; /** * @author <a href="mailto:[email protected]">Julien Viet</a> */ public class SimpleFormatter implements Reporter<SimpleFormatter.ReportImpl> { private final Consumer<Buffer> info; private final BiConsumer<Buffer, Throwable> error; private final Handler<Void> endHandler; public SimpleFormatter(Consumer<Buffer> info, BiConsumer<Buffer, Throwable> error, Handler<Void> endHandler) { this.info = info; this.error = error; this.endHandler = endHandler; } public static class ReportImpl { private int run; private int failures; private int errors; } @Override public ReportImpl createReport() { return new ReportImpl(); } @Override public void reportBeginTestSuite(ReportImpl report, String name) { info.accept(Buffer.buffer("Begin test suite " + name)); } @Override public void reportBeginTestCase(ReportImpl report, String name) { info.accept(Buffer.buffer("Begin test " + name)); report.run++; } @Override public void reportEndTestCase(ReportImpl report, String name, TestResult result) { if (result.succeeded()) { info.accept(Buffer.buffer("Passed " + result.name())); } else { if (result.failure().isError()) { report.errors++; } else { report.failures++; } error.accept(Buffer.buffer("Failed " + result.name()), result.failure().cause()); } } @Override public void reportEndTestSuite(ReportImpl report, String name, Throwable err) { if (err != null) { error.accept(Buffer.buffer("Test suite " + name + " failure"), err); } String msg = "End test suite " + name + " , run: " + report.run + ", Failures: " + report.failures + ", Errors: " + report.errors; info.accept(Buffer.buffer(msg)); if (endHandler != null) { endHandler.handle(null); } } }
08959026a68161f8326eccaeb14a6d9b4fa67cf4
a8eca0a546d09a13e86e0bcf00ba81f748e134ed
/app/src/androidTest/java/com/hcykj/mvpdemo/ExampleInstrumentedTest.java
e72a4ea94b4eb4bb2cf26c250495d7263d1d6f16
[]
no_license
SongJun973208/MvpDemo
be78cb4487b68675887277f3d6ea2df1de1b315d
49ac4405a639f96990a05884c37ed24c9ee210d8
refs/heads/master
2020-04-28T17:13:43.546742
2019-03-13T16:19:46
2019-03-13T16:19:46
175,438,260
1
0
null
null
null
null
UTF-8
Java
false
false
718
java
package com.hcykj.mvpdemo; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.hcykj.mvpdemo", appContext.getPackageName()); } }
[ "1090534619@qq/com" ]
1090534619@qq/com
81914089f2df3d05a6b325c21699fc9904565621
10d31f3c32040aa82a7ff3cfba7a73055704c12e
/methods/src/methods_week_2/GoogleSearch_Method.java
169c6645c0e62c92bb66ea173966a43de8509fdd
[]
no_license
AdnanRumi/Assignments
2c3d9c3573b570e5f09069e07fbd35d93c389fa9
c9f82e4c27b290a677140e34d477062094294db9
refs/heads/master
2023-05-07T09:51:14.455636
2021-05-25T07:28:09
2021-05-25T07:28:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
578
java
package methods_week_2; public class GoogleSearch_Method { public static void main(String[] args) { navigateGoogle(); searchForShoes(); printResults(); } public static void navigateGoogle() { System.out.println("launch safari browser"); System.out.println("navigate to google.com"); } public static void searchForShoes() { System.out.println("type shoe brand into search field"); System.out.println("click on search button"); } public static void printResults() { System.out.println("results for shoes"); } }
8cad0a5d487e5cdd3775a348bad69914916cc651
21871460820dba86a7e782a00348794854f0c89b
/app/src/main/java/com/pcassem/yunzhuangpei/home/adapter/CommentListAdapter.java
f26f8f5948b7c9657dc5bd9174a58ef90494cd86
[]
no_license
sengeiou/YunZhuangPei
56ffd204f08e336cb4d67ef2d59d7a5b423a8c1a
2e9da5c5bb2e3726b56bdf9c3a2f95d2587919cd
refs/heads/master
2022-04-27T14:44:42.314625
2020-04-29T02:58:10
2020-04-29T02:58:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,824
java
package com.pcassem.yunzhuangpei.home.adapter; import android.content.Context; import android.net.Uri; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView; import com.facebook.drawee.view.SimpleDraweeView; import com.pcassem.yunzhuangpei.R; import com.pcassem.yunzhuangpei.entity.CommentEntity; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; public class CommentListAdapter extends BaseAdapter { Context context; List<CommentEntity> commentListData; CommentEntity commentEntity; public CommentListAdapter(Context c, List<CommentEntity> data) { this.context = c; this.commentListData = data; } @Override public int getCount() { return commentListData.size(); } @Override public Object getItem(int i) { return commentListData.get(i); } @Override public long getItemId(int i) { return i; } @Override public View getView(int i, View convertView, ViewGroup viewGroup) { ViewHolder viewHolder; // 重用convertView if (convertView == null) { viewHolder = new ViewHolder(); convertView = LayoutInflater.from(context).inflate(R.layout.item_news_comment_list, null); viewHolder.userIcon = (SimpleDraweeView) convertView.findViewById(R.id.user_icon); viewHolder.userName = (TextView) convertView.findViewById(R.id.user_name); viewHolder.createTime = (TextView) convertView.findViewById(R.id.create_time); viewHolder.content = (TextView) convertView.findViewById(R.id.content); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } // 适配数据 commentEntity = commentListData.get(i); String url = commentEntity.getUserIcon(); viewHolder.userIcon.setImageURI(Uri.parse(url)); viewHolder.userName.setText(commentEntity.getUserName()); viewHolder.createTime.setText(formatDate(commentEntity.getCreateTime())); viewHolder.content.setText(commentEntity.getContent()); return convertView; } public void addComment(CommentEntity comment) { commentListData.add(comment); notifyDataSetChanged(); } public static class ViewHolder { SimpleDraweeView userIcon; TextView userName; TextView createTime; TextView content; } //时间戳转换 public String formatDate(long timeStamp) { SimpleDateFormat sdf=new SimpleDateFormat("yyyy年MM月dd日"); String sd = sdf.format(new Date(Long.parseLong(String.valueOf(timeStamp)))); return sd; } }
9e6eb136081a49fdc108bef4aa6591bdfc18209d
382656ecf2594660755afe29a5debb9c5253197b
/api/core/src/main/java/com/jd/core/annotation/NotLogin.java
b1c60fa204f0896192f0cad38997349cc991e302
[]
no_license
JDongKhan/java_app
78f43c3309005b01e5f53fd1142741b027e47b58
b92b91e548be7afe8cd813fafcafaf102afcd06c
refs/heads/main
2023-08-12T18:21:10.109950
2021-09-22T06:44:40
2021-09-22T06:44:40
407,485,455
0
0
null
null
null
null
UTF-8
Java
false
false
291
java
package com.jd.core.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) public @interface NotLogin { }
c6c06a8f3f45fa20d0190a19c73ffecbcf6c9c4f
e5e048e558af1b5e1d5f925d91bec468c9ae275a
/src/inheritance/InheritanceExample.java
8205d3ac7fb854c93d91342a6404cb7a7f6d79f2
[]
no_license
JaydeepUniverse/java_core
e1857a041ae8054066f87d7b8384ae722b4eb57b
ab74c920cca88ef315a51f54c52d93f9b37b2818
refs/heads/master
2021-10-09T11:32:49.525628
2018-12-27T05:52:22
2018-12-27T05:52:22
153,394,040
0
0
null
null
null
null
UTF-8
Java
false
false
1,325
java
package inheritance; class Box { double height; double width; double depth; // Construct clone of an object Box(Box obj) { height = obj.height; width = obj.width; depth = obj.depth; } // Constructor when all dimensions are specified Box(double h, double w, double d) { height = h; width = w; depth = d; } // Constructor when no dimensions are specified Box() { height = width = depth = -1; } // Constructor for cube Box(double length) { height = width = depth = length; } // Compute and return volume double volume() { return height * width * depth; } } class BoxWeight extends Box { double weight; // constructor for boxweight BoxWeight(double h, double w, double d, double we) { height = h; width = w; depth = d; weight = we; } double volumeWithWeight() { return height * width * depth * weight; } } class InheritanceExample { public static void main(String[] args) { BoxWeight a = new BoxWeight(1, 2, 3, 4); BoxWeight b = new BoxWeight(5, 6, 7, 8); System.out.println(a.volume()); System.out.println(a.weight); System.out.println(a.volumeWithWeight()); System.out.println(); System.out.println(b.volume()); System.out.println(b.weight); System.out.println(b.volumeWithWeight()); } }
daa9aefe73ebad4d56d34c57a1037ef7945d09b7
d0e61d767e3fae4a60fbc4f0ddb3b3a1aba0d34b
/experiments/flink-experiment/src/test/java/edu/upenn/flumina/pageview/GetOrUpdateTest.java
3610b650b1764bf813486292cbcbef00b7888743
[ "MIT" ]
permissive
angelhof/flumina
d53bddaecda4dc2f33a6aeac1fbc7c5fd9a73f0d
abc61255749e75ec147c0739a5ed0abc1b3e767a
refs/heads/master
2022-06-26T00:23:44.529797
2022-06-08T05:00:32
2022-06-08T05:00:48
239,618,776
14
1
null
null
null
null
UTF-8
Java
false
false
1,351
java
package edu.upenn.flumina.pageview; import edu.upenn.flumina.pageview.data.*; import org.junit.Test; import static org.junit.Assert.assertEquals; public class GetOrUpdateTest { @Test public void testGetOrUpdateOrHeartbeatMatch() { final GetOrUpdateOrHeartbeat get = new Get(1, 1); final GetOrUpdateOrHeartbeat update = new Update(1, 10000, 1); final GetOrUpdateOrHeartbeat heartbeat = new GetOrUpdateHeartbeat(1); final int getMatch = get.match(gou -> gou.match(g -> 1, u -> 2), hb -> 3); assertEquals("Get match should return 1", 1, getMatch); final int updateMatch = update.match(gou -> gou.match(g -> 1, u -> 2), hb -> 3); assertEquals("Update match should return 2", 2, updateMatch); final int heartbeatMatch = heartbeat.match(gou -> gou.match(g -> 1, u -> 2), hb -> 3); assertEquals("Heartbeat match should return 3", 3, heartbeatMatch); } @Test public void testGetOrUpdateMatch() { final GetOrUpdate get = new Get(1, 1); final GetOrUpdate update = new Update(1, 10000, 1); final int getMatch = get.match(g -> 1, u -> 2); assertEquals("Get match should return 1", 1, getMatch); final int updateMatch = update.match(g -> 1, u -> 2); assertEquals("Match should return 2", 2, updateMatch); } }
f00899dfee0f30d53fe2fa679589bd72f9dec78c
15aef5ed8bf19ba6a332f924887b364d7baf1aec
/src/gui/MainFrame.java
089e20cb0433d94a7551166490e2c003dbd4b0ff
[]
no_license
madchemist10/Euchre
3dbbead48f2424ec73650c97185267e0c3c4ec9a
4aa886032539b6eb48667e0d612f70f388659d11
refs/heads/master
2020-12-07T16:47:57.764083
2016-08-18T19:53:00
2016-08-18T19:53:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
681
java
package gui; import constants.Constants; import gamePlay.Euker; import javax.swing.*; import java.awt.*; /** * Top level frame for the gui. */ public class MainFrame extends JFrame{ public MainFrame(Euker eukerGame){ this.setLayout(new FlowLayout()); this.setSize(Constants.WIDTH_FRAME, Constants.HEIGHT_FRAME); this.setTitle(Constants.EUKER); this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); } /** * Helper method to validate drawn components. * @param c component that is to be validated. */ public static void validateComponent(Component c){ c.revalidate(); c.repaint(); } }
f2cde989ffcda8a39b1ee044cb4f9c084b64b36a
8ae0fcf8f835103f09171ad87a1ea7c3b3e11b1a
/classes/examples/VarArgsTwo.java
87b8a190ed98ffe2327ff4c2d0b1da702a07780a
[]
no_license
petreadorin/MyJava
e99fa84ac748ebf50bb4a1b02fa09fcc40397d41
f4713d68df2dd531f3461022e9e90b7a521867be
refs/heads/master
2023-02-23T04:28:36.799213
2021-01-29T10:55:06
2021-01-29T10:55:06
331,701,631
0
0
null
null
null
null
UTF-8
Java
false
false
543
java
package classes.examples; //Normal parameters and var args parameters public class VarArgsTwo { static void vaTest( String msg, int ... v) { System.out.println(msg + v.length); System.out.println("Contents: "); for (int i = 0; i < v.length; i++) System.out.println(" arg " + i + " : " + v[i]); System.out.println(); } public static void main(String[] args) { vaTest("One vararg: ", 10); vaTest("Three varargs: ", 3 , 7, 9); vaTest(("No varargs: ")); } }
8f1dffc7ba9051f01c6d7f4a82cb2005a82439f8
dce4ff9edbef476d218c79cec4acd8861b09642c
/xenon-android-library/src/main/java/com/abubusoft/xenon/animations/TextureAnimationLoader.java
c989f288c1cdb5402c92abd9e3684cc3f2887e92
[]
no_license
skykying/xenon
d3e1cdc79932892d2a396926f9d21962ddef0568
619cc533e602307a62ceaf739daea76f88c37994
refs/heads/master
2021-09-16T04:22:45.416370
2018-06-16T09:01:28
2018-06-16T09:01:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,847
java
package com.abubusoft.xenon.animations; import java.util.ArrayList; import java.util.HashMap; import com.abubusoft.xenon.texture.Texture; import com.abubusoft.xenon.texture.TextureManager; import com.abubusoft.xenon.texture.TextureOptions; import com.abubusoft.xenon.texture.AtlasTexture; import com.abubusoft.xenon.texture.AtlasTextureOptions; import com.abubusoft.xenon.texture.TextureRegion; import com.abubusoft.kripton.android.Logger; import com.abubusoft.xenon.core.util.IOUtility; import android.content.Context; /** * Classe di utilitaà per caricare animazioni in formato gdx * * @author Francesco Benincasa * */ class TextureAnimationLoader { /** * <p> * Carica la definizione di una texture animation. L'animazione si compone di 3 risorse: l'atlas, la definizione degli sprite e quella delle animazioni. Dato ad esempio un * baseName <b>heart</b> i nomi dei file dovrebbero essere rispettivamente <b>heart.png</b> <b>heart_sprites.txt</b> e <b>heart_animations.txt</b> * </p> * * @param context * context * @param spriteDefinitionResourceId * resource id della definizione dello sprite * @param animationDefinitionResourceId * resource id della definizione delle animazioni * @param imageResourceId * id dell'immagine * @param options * opzioni per il caricamento della texture * @return atlas */ static ArrayList<TextureAnimation> loadFromResources(Context context, int spriteDefinitionResourceId, int animationDefinitionResourceId, int imageResourceId, TextureOptions options) { try { Texture texture = TextureManager.instance().createTextureFromResourceId(context, imageResourceId, options); AtlasTexture atlasTexture = TextureManager.instance().createAtlasTexture(texture, AtlasTextureOptions.build()); String spriteDefinition = IOUtility.readRawTextFile(context, spriteDefinitionResourceId); HashMap<String, TextureRegion> tilesMap = GDXParserHelper.createTiles(spriteDefinition, atlasTexture); String animationDefinition = IOUtility.readRawTextFile(context, animationDefinitionResourceId); ArrayList<TextureAnimation> animationMap = GDXParserHelper.createAnimations(animationDefinition, tilesMap, atlasTexture); return animationMap; } catch (Exception e) { Logger.fatal(e.getMessage()); e.printStackTrace(); return null; } } /** * <p> * Carica la definizione di una texture animation. L'animazione si compone di 3 file: l'atlas, la definizione degli sprite e quella delle animazioni. Dato ad esempio un * baseName <b>heart</b> i nomi dei file dovrebbero essere rispettivamente <b>heart.png</b> <b>heart.sprites</b> e <b>heart.animations</b> * </p> * * @param context * context * @param baseName * nome di base dell'animazione * @param options * opzioni per il caricamento della texture * @return atlas */ static ArrayList<TextureAnimation> loadFromAssets(Context context, String baseName, TextureOptions options) { try { Texture texture = TextureManager.instance().createTextureFromAssetsFile(context, baseName + ".png", options); AtlasTexture atlasTexture = TextureManager.instance().createAtlasTexture(texture, AtlasTextureOptions.build()); String spriteDefinition = IOUtility.readTextFileFromAssets(context, baseName + ".sprites"); HashMap<String, TextureRegion> tilesMap = GDXParserHelper.createTiles(spriteDefinition, atlasTexture); String animationDefinition = IOUtility.readTextFileFromAssets(context, baseName + ".animations"); ArrayList<TextureAnimation> animationMap = GDXParserHelper.createAnimations(animationDefinition, tilesMap, atlasTexture); return animationMap; } catch (Exception e) { Logger.fatal(e.getMessage()); e.printStackTrace(); return null; } } }
3c023b0b39fd802ec482dd6504ef1f1910dc13bd
a06cafcdfa8541e70a064875a1a3425a228de740
/curator-recipes/src/main/java/com/netflix/curator/framework/recipes/locks/RevocationListener.java
6a75ff24aa0122820590bb075d0f14ecc8f7a9d5
[ "Apache-2.0" ]
permissive
artemip/curator
0e1312e9e6e624ce50b43c4befeaf7fa47c04a87
01104d219adb3cfdedf9304b57beaf13f11d79ff
refs/heads/master
2021-01-18T06:41:41.375901
2012-07-05T19:04:23
2012-07-05T19:04:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,010
java
/* * * Copyright 2011 Netflix, 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.netflix.curator.framework.recipes.locks; public interface RevocationListener<T> { /** * Called when a revocation request has been received. You should release the lock as soon * as possible. Revocation is cooperative. * * @param forLock the lock that should release */ public void revocationRequested(T forLock); }
06d252bf299dbd74f709ef496027c303dcc24143
054503556e1277f20f31da30149c2e863415dae5
/app/src/main/java/com/example/photogridapp/CatApi/CatAPI.java
47bdce1300a395cead5bfb99c7c94869921f9a39
[]
no_license
bara111/PhotoGridApp
ccb8df7d8722e551344368a4be8f4d4a8cc7086f
4fc96dfb4d5842d9107026a9eafa4a1d9b13b811
refs/heads/master
2020-06-08T16:51:42.472033
2019-06-22T18:40:01
2019-06-22T18:40:01
193,267,408
0
0
null
null
null
null
UTF-8
Java
false
false
208
java
package com.example.photogridapp.CatApi; import retrofit2.Call; import retrofit2.http.GET; import retrofit2.http.Query; public interface CatAPI { @GET("/v1/images/search") Call<CatResponse> get(); }
d2c42c2b4ec86f346b395480a262c52936073bb5
62aa0675b0f49531418298f943ce5d54d6b82a13
/decoder.java
8da1c3aa1175f1d078841ae08d32b10f1f5f59b7
[]
no_license
LIMONIC/Huffman-Encoding-with-4way-heap
a4e2b2ecac582f01c092df4a20be0458e6c002a1
cb921a0665835af7f4ae9e1c464a0a3cd4c4c7d9
refs/heads/master
2023-03-22T14:21:33.832671
2021-03-06T16:12:21
2021-03-06T16:12:21
316,046,419
0
0
null
null
null
null
UTF-8
Java
false
false
3,786
java
import java.io.*; import java.util.*; public class decoder { public static String binPath = null; public static String codeTablePath = null; public static void expand() throws IOException { Map<String, String> codeTable = new HashMap<>(); /* Convert code table to Map<code, data>*/ try { Scanner scanner = new Scanner(new File(codeTablePath)); while (scanner.hasNextLine()) { String line = scanner.nextLine(); String lineSplit[] = line.split(" "); codeTable.put(lineSplit[1], lineSplit[0]); } } catch (FileNotFoundException e) { e.printStackTrace(); } /* Build Huffman Tree with code table */ HuffmanNode root = buildHTree(codeTable); /* Using Huffman Tree to decode encoded.bin */ writeDecodedFile(root); } /* Build Huffman Tree with code table */ private static HuffmanNode buildHTree(Map<String, String> codeTable) { HuffmanNode root = new HuffmanNode('\0',-1,null,null); HuffmanNode current = root; int size = codeTable.keySet().size(); for (String ct : codeTable.keySet()) { char[] ch = ct.toCharArray(); for (int i = 0; i < ct.length(); i++) { if (ch[i] == '0') { if (current.left == null) { current.left = new HuffmanNode('\0',-1,null,null); current = current.left; } else { current = current.left; } } if (ch[i] == '1') { if (current.right == null) { current.right = new HuffmanNode('\0',-1,null,null); current = current.right; } else { current = current.right; } } } current.data = Integer.parseInt(codeTable.get(ct)); current = root; size--; if (size < 0) { break; } } return root; } /* Using Huffman Tree to decode encoded.bin */ private static void writeDecodedFile (HuffmanNode root) throws IOException { HuffmanNode current = root; BufferedWriter bw = new BufferedWriter(new FileWriter("decoded.txt")); File file = new File(binPath); byte[] data = new byte[(int) file.length()]; DataInputStream dis = new DataInputStream(new FileInputStream(file)); dis.readFully(data); dis.close(); String temp; for (int i = 0; i < data.length; i++) { temp = Integer.toBinaryString((data[i] & 0xFF) + 0x100).substring(1); for (int bit = 0; bit < temp.length(); bit++) { if (temp.charAt(bit) == '1') { current = current.right; } else if (temp.charAt(bit) == '0') { current = current.left; } if (current.isLeaf()) { bw.write(current.data + "\n"); current = root; } } } bw.close(); } public static void main(String[] args) { try { if (args.length < 1) { System.out.println("The Input File name is not specified!"); System.out.println("path:[encoded.bin] path:[code_table.txt]"); return; } binPath = args[0]; codeTablePath = args[1]; decoder.expand(); } catch (Exception e) { System.out.println("File not found at: " + args[0]); } } }
053ce08322c2202aa3452d3ce7c349886df9662a
7c235ac018e6b13dd8c7f0c07bfaced805e7300b
/src/main/java/com/monicseq/run/seq/MonicSeqHandle.java
ce0d703f6a53bd77b070dd301c4b722fb4e03cc2
[]
no_license
OpenDoing/algMonicSeqRunner
f67d63fa685d1f88502105ff6fa8ccf64bd0ec1c
f422a8443c229657e42f269f7d166adaa9fc6599
refs/heads/master
2022-07-31T05:13:43.309650
2019-12-16T12:34:19
2019-12-16T12:34:19
227,378,785
0
0
null
2022-06-17T02:46:45
2019-12-11T13:59:15
Java
UTF-8
Java
false
false
7,193
java
package com.monicseq.run.seq; import com.monicseq.run.data.TestDataGenerator; import com.monicseq.run.request.HttpRequest; import com.monicseq.run.request.Request; import com.monicseq.run.request.RequestBuilder; import com.monicseq.run.request.RequestExecutor; import com.monicseq.run.util.FileUtil; import com.monicseq.run.util.Util; import lombok.extern.slf4j.Slf4j; import java.io.IOException; import java.util.HashMap; import java.util.Iterator; import java.util.Map; /** * 单线测试序列处理 * * @author Duyining * @date 2019/12/5 */ @Slf4j public class MonicSeqHandle { /** * 单线测试序列的结果 */ public static Map<String,Object> result = new HashMap<>(16); public static String ISEQUAL = "isEq"; public static String ISSUBSET = "isSub"; public static String ISSAME = "isSame"; public static String EMPTY = ""; public static String DOT = "."; public static String LINE = "_"; public static String INTERGER = "Integer"; public static String ASSERT = "Assert"; public static String IS = "is"; public static String EQUAL = "="; public static String TRUE = "true"; /** * 序列中用到的所有参数 */ public static Map<String,Object> param = new HashMap<>(16); /** * 全局变量表 */ public static Map<String,String> reqs = new HashMap<>(16); public static void initGlobal(String s) { reqs = Util.getGlobalVar(s); } /** * 从文件中读取单线测试序列 * @param file 文件路径 * @throws IOException IO异常 */ public static void getSeq(String file) throws IOException{ String monicSequence = FileUtil.readFile(file); parseSeq(monicSequence); } public static void parseSeq(String mseq) { String[] seq = mseq.split("\n"); for (int i = 0;i<seq.length;i++) { if (!EMPTY.equals(seq[i])){ if (!handleSingleSeq(seq[i].trim())) { log.error("断言为假,无法继续执行"); break; } } } } private static boolean handleSingleSeq(String s) { if(s.startsWith(ASSERT)) { boolean b = handleAssert(s); if (b) { log.info("{} 结果为:{}", "AssertTrue", true); } else { log.info("{} 结果为:{}", "AssertTrue", false); } return b; } String[] ope = s.split(EQUAL); if (ope[1].trim().startsWith(IS)) { boolean cres = handleCompare(ope[1]); result.put(ope[0].trim(),cres); log.info("{} 结果为:{}",ope[0],result.get(ope[0].trim())); } else { String response = handleServiceReq(s,reqs,param); result.put(ope[0].trim(), response); log.info("{} 结果为:{}",ope[0],result.get(ope[0].trim())); } return true; } /** * 处理服务请求操作 * @param s 单线序列操作 getArray(greq) * @param reqs 全局变量的map,通过greq查询对应的类子结构 GetArrayReq * @param param 变量初始化map,已经初始化的map不应该被重复初始化 */ private static String handleServiceReq(String s, Map<String, String> reqs, Map<String, Object> param) { // getArray(greq) int left = s.indexOf("("); int right = s.indexOf(")"); String ps = s.substring(left+1,right); Request request = RequestBuilder.buildReq(ps,reqs, param); HttpRequest httpRequest = RequestExecutor.getReqRunner(request.getMethod()); String url = request.getUrl(); return httpRequest.sendRequest(url, request.getParams()); } private static boolean handleAssert(String s) { int left = s.indexOf("("); int right = s.indexOf(")"); String ps = s.substring(left+1,right); log.info("操作:{} 参数: {}","AssertTrue",ps); String temp = result.get(ps).toString(); return TRUE.equals(temp); } private static boolean handleCompare(String s) { int left = s.indexOf("("); int right = s.indexOf(")"); String type = s.substring(0,left).trim(); String ps = s.substring(left+1,right); String[] params = ps.split(","); log.info("操作: {} 参数1: {} 参数2: {}" , type,params[0],params[1]); if (ISEQUAL.equals(type)) { return handleIsEqual(params[0],params[1]); } else if(ISSUBSET.equals(type)) { } else if (ISSAME.equals(type)) { } else { // ...... } return true; } private static boolean handleIsEqual(String param1, String param2) { // System.out.println("param1:" + param1 + "param2:" + param2); // 两个都是服务请求参数 if (param1.contains(DOT) && param2.contains(DOT)) { // 参数没有进行初始化 if (!param.containsKey(param1) && !param.containsKey(param2)) { // 如果数据类型是整型 if (INTERGER.equals(getParamType(param1))) { String temp = Integer.toString(TestDataGenerator.getRandomInt(1,10)); param.put(param1, temp); param.put(param2, temp); return true; } else { // 其他数据类型的策略 } } else if (param.containsKey(param1) || param.containsKey(param2)) { // 如果其中一个参数已经初始化,则将初始化的值赋给未初始化的参数 if (param.containsKey(param1)) { param.put(param2,param.get(param1)); } else { param.put(param1,param.get(param2)); } return true; } } else if (param1.startsWith(LINE) && !param2.startsWith(LINE)) { /* 如果类似这种形式 isEq(_1,true) */ String pa1 = result.get(param1).toString(); return pa1.equals(param2); } else if (param1.startsWith(LINE) && param2.startsWith(LINE)) { // 如果类似这种形式 isEq(_7,_10) String pa1 = result.get(param1).toString(); String pa2 = result.get(param2).toString(); return pa1.equals(pa2); } return false; } private static String getParamType(String param1) { //1 return "Integer"; } public static void getPrams(){ Iterator iterator = param.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry entry = (Map.Entry) iterator.next(); String key = entry.getKey().toString(); String value = entry.getValue().toString(); log.info("参数:{} 参数的值:{}", key, value); } } public static void main(String[] args) throws IOException{ initGlobal("For all as:ArrayService,greq:GetArrReq,ireq:InsertReq,dreq:DelReq That"); getSeq("D:\\1NJUST\\大论文\\paper\\casestudy\\monicArray.txt"); getPrams(); } }
8d942c85a3e7f15387d6dd51638860475fe3a239
d58e269125ee0f58c6cf12019f9c7ee34383ff79
/springhateoas/src/main/java/com/sonic/controller/JSPController.java
04bd7d826d7ca2489221f138435df35ef6593c8c
[]
no_license
AK47Sonic/drive-in-spring-boot
7a011a878c21487d3e502f48b800721dba002752
403f67034b60c37082f0159e0ecc28cec5629e15
refs/heads/master
2022-12-25T20:29:32.694725
2020-06-21T01:22:42
2020-06-21T01:22:42
163,733,768
0
0
null
2022-12-16T03:39:56
2019-01-01T12:06:07
Java
UTF-8
Java
false
false
435
java
package com.sonic.controller; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; /** * JSPController * * @author Sonic * @since 2019/8/4 */ @Controller public class JSPController { @RequestMapping("/index") public String index(Model model){ model.addAttribute("message", "Sky"); return "index"; } }
eeb1c05be479fc12c339302347a676956ec3dd44
7d1eb5d034b2d55af90633b8789dfe9ea6255211
/src/main/java/org/akginara/controller/CommonController.java
f1813c2ce8f38da5c499a5ce2065ba4ea06a23b1
[]
no_license
BAEHANBIN/akginara
1afa25363a8dd9796dc8dd714bd62cdadbd975a7
0e47bcec9d1712f64e0744d91adaa5cc8f1c809c
refs/heads/master
2022-12-07T01:16:00.101707
2020-09-03T15:23:34
2020-09-03T15:23:34
286,487,267
0
0
null
null
null
null
UTF-8
Java
false
false
1,015
java
package org.akginara.controller; import org.springframework.security.core.Authentication; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import lombok.extern.log4j.Log4j; @Controller @Log4j @RequestMapping("/akginara/*") public class CommonController { @GetMapping("/accessError") public void accessDenied(Authentication auth, Model model) { log.info(("access Denied : " + auth)); model.addAttribute("msg", "Access Denied"); } @GetMapping("/login") public void loginInput(String error, String logout, Model model) { log.info("error : " + error); log.info("logout : " + logout); if (error != null) { model.addAttribute("error", "Login Error Check Your Account"); } if (logout != null) { model.addAttribute("logout", "Logout!!"); } } @GetMapping("/logout") public void logoutGet() { log.info("logout"); } }
7a50b378926a06a58feadb2993155202252115b8
0f4e9fee5752b4f417c2f0e04d417267520d703b
/app/src/main/java/com/kslimweb/one2many/client/ScanQRCodeActivity.java
1623628fb56db70cece615f35bcb752bce8c4e88
[ "MIT" ]
permissive
limkhashing/One2Many
7a5788003979d13f3c6fca794e53799bae2e0e0d
fef8478f7f1f7938cccc8a66f78039bda7909ad2
refs/heads/master
2021-08-16T02:59:39.681376
2020-02-22T09:23:11
2020-02-22T09:27:01
170,728,229
0
1
MIT
2020-02-22T09:27:03
2019-02-14T17:10:35
Java
UTF-8
Java
false
false
1,867
java
package com.kslimweb.one2many.client; import android.content.Intent; import android.os.Bundle; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; import android.util.Log; import com.google.zxing.Result; import me.dm7.barcodescanner.zxing.ZXingScannerView; public class ScanQRCodeActivity extends AppCompatActivity implements ZXingScannerView.ResultHandler { private static final String TAG = ScanQRCodeActivity.class.getSimpleName(); ZXingScannerView scannerView; // Class-Topic will become [test-test] for development public static String SUBSCRIBE_TOPIC; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); scannerView = new ZXingScannerView(this); setContentView(scannerView); } @Override public void handleResult(Result result) { Log.d(TAG, "handleResult: " + result.getText()); String qrCodeValue = result.getText(); if (qrCodeValue.contains("One2Many")) { SUBSCRIBE_TOPIC = qrCodeValue; startActivity(new Intent(ScanQRCodeActivity.this, ClientTranslationActivity.class)); } else { new AlertDialog.Builder(this) .setTitle("Invalid QR Code Scanned") .setMessage("Please make sure you scan the right QR code displayed by One2Many app") .setPositiveButton(android.R.string.yes, (dialog, which) -> scannerView.resumeCameraPreview(this)) .show(); } } @Override protected void onPause() { super.onPause(); scannerView.stopCamera(); } @Override protected void onResume() { super.onResume(); scannerView.setResultHandler(this); scannerView.startCamera(); } }
8fbf4beb3c72c6c307027d8d6a41b896c9cdc5b9
e7e8c3671f0c2aea64544c7510bac396f016a1e6
/src/main/java/cdbm/ucab/ingsw/response/CustomerResponse.java
777058210d077636efbb9cbc5e939249a5bc6c9f
[]
no_license
atag102/PruebaHeroku-2
47dd081254d9477b9ef4ee1863bd123cc0793787
bb64742b0a55c044ad56681b556d95921f73e5f1
refs/heads/master
2020-03-17T01:42:46.808461
2018-05-12T19:43:37
2018-05-12T19:43:37
133,163,327
0
0
null
null
null
null
UTF-8
Java
false
false
239
java
package cdbm.ucab.ingsw.response; import lombok.Data; import lombok.ToString; @Data @ToString public class CustomerResponse { private String id; private String firstName; private String lastName; private String email; }
d61abe6e26f22cb7debfcca3d886e149406c624b
296b34dce2f448f07479e8b02b4dfa37473a7113
/sunshine-security/sunshine-admin/src/main/java/com/sunshine/common/config/WebConfig.java
78f79fd74e037e8e35dd6f52d5e33de28cb56a84
[ "Apache-2.0" ]
permissive
Delevan24/sunshine
b0cc258b6f013dedbdc1a9fb9623b1900c9ff99b
6b88f42ccae1ca84f694cb2f6fb725d2dac2f673
refs/heads/master
2022-08-18T05:26:34.237316
2020-04-13T03:08:26
2020-04-13T03:08:26
160,441,875
0
0
null
2022-07-06T20:32:04
2018-12-05T01:29:53
JavaScript
UTF-8
Java
false
false
1,384
java
package com.sunshine.common.config; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; /** * WebMvc配置 * * @author Mark [email protected] * @since 3.0.0 2018-01-25 */ @Configuration public class WebConfig implements WebMvcConfigurer { @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/statics/**").addResourceLocations("classpath:/statics/"); } // @Override // public void extendMessageConverters(List<HttpMessageConverter<?>> converters) { // MappingJackson2HttpMessageConverter jackson2HttpMessageConverter = new MappingJackson2HttpMessageConverter(); // ObjectMapper objectMapper = jackson2HttpMessageConverter.getObjemctMapper(); // // //生成json时,将所有Long转换成String // SimpleModule simpleModule = new SimpleModule(); // simpleModule.addSerializer(Long.class, ToStringSerializer.instance); // simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance); // objectMapper.registerModule(simpleModule); // // jackson2HttpMessageConverter.setObjectMapper(objectMapper); // converters.add(0, jackson2HttpMessageConverter); // } }
f153c1b09667572626ddce752a1fcb11cf7b40e5
161f98b0af92924400450c6114be79bd66010cf1
/app/src/main/java/com/thanhcs/samplemvc/controller/Controller.java
c7f3975ffcdf88910ef2e41a2091a932b8d4e7ac
[]
no_license
thanhcs94/SampleMVC
e7206bc1553bee66e643a5bdaafec3a2bc0f4c4a
da2051b30d47779a0f7e6f60e0ee07bef4b82db4
refs/heads/master
2020-05-27T21:14:36.882304
2017-03-02T06:29:35
2017-03-02T06:29:35
83,642,700
0
0
null
null
null
null
UTF-8
Java
false
false
825
java
package com.thanhcs.samplemvc.controller; import android.app.Application; import com.thanhcs.samplemvc.models.ModelCart; import com.thanhcs.samplemvc.models.ModelProducts; import java.util.ArrayList; /** * Created by ThanhCS94 on 3/2/17. * I'm HIDING. Don't waste your time to find me. */ public class Controller extends Application { private ArrayList<ModelProducts> myProducts = new ArrayList<ModelProducts>(); private ModelCart myCart = new ModelCart(); public ModelProducts getProducts(int pPosition) { return myProducts.get(pPosition); } public void setProducts(ModelProducts Products) { myProducts.add(Products); } public ModelCart getCart() { return myCart; } public int getProductsArraylistSize() { return myProducts.size(); } }
c77256d26c6513ae6a490a5f76f2622984a079ec
7c10d55ff24a4d4ec519e5d30dc689c38352f587
/app/src/main/java/com/utad/kiran/dint_database_task/ClassDialog/Class_Fragment_Dialog.java
606d5a11cc6676004a71ca20827a6bbb4aefe6d3
[]
no_license
KiranLorenzoHoyos/DINT_Database_Task
afca4c9312f09ef0d008767cb69d4076cf50ffd7
499731d8c7c2e114d6b8bed0df2f74783b83f284
refs/heads/master
2020-04-09T09:41:35.494909
2018-12-03T19:29:43
2018-12-03T19:29:43
160,242,839
0
0
null
null
null
null
UTF-8
Java
false
false
3,421
java
package com.utad.kiran.dint_database_task.ClassDialog; import android.app.AlertDialog; import android.app.Dialog; import android.content.DialogInterface; import android.os.Bundle; import android.support.v4.content.res.ResourcesCompat; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.AppCompatDialogFragment; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.StaggeredGridLayoutManager; import android.view.LayoutInflater; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import com.utad.kiran.dint_database_task.R; import java.util.Objects; public class Class_Fragment_Dialog extends AppCompatDialogFragment { private ImageView classImg; private TextView className; private TextView classYear; private TextView classDescriptionTitle; private TextView classDescription; private DrawerLayout drawerLayout; private RecyclerView recyclerView; private RecyclerView.Adapter recyclerViewAdapter; private RecyclerView.LayoutManager recyclerViewManager; @Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); LayoutInflater inflater = Objects.requireNonNull(getActivity()).getLayoutInflater(); View view = inflater.inflate(R.layout.activity_classdialog, null); Class_Data_CardView n_students = new Class_Data_CardView(ResourcesCompat.getDrawable(getResources(), R.drawable.students, null), "Nº Students"); Class_Data_CardView professor = new Class_Data_CardView(ResourcesCompat.getDrawable(getResources(), R.drawable.professor, null), "Professor"); Class_Data_CardView average = new Class_Data_CardView(ResourcesCompat.getDrawable(getResources(), R.drawable.average, null), "Average"); Class_Data_CardView my_average = new Class_Data_CardView(ResourcesCompat.getDrawable(getResources(), R.drawable.myaverage, null), "My average"); Class_Data_CardView ranking = new Class_Data_CardView(ResourcesCompat.getDrawable(getResources(), R.drawable.ranking, null), "Ranking"); Class_Data_CardView[] classDataArray = {n_students, professor, average, my_average, ranking}; builder.setView(view).setNegativeButton("cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }).setPositiveButton("accept", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); classImg = view.findViewById(R.id.classImg); className = view.findViewById(R.id.className); classYear = view.findViewById(R.id.classYear); classDescriptionTitle = view.findViewById(R.id.descriptionTitle); classDescription = view.findViewById(R.id.descriptionText); drawerLayout = view.findViewById(R.id.drawerLayout); recyclerView = view.findViewById(R.id.recyclerView); recyclerViewAdapter = new Class_Recycler_Adapter(classDataArray); recyclerViewManager = new StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.HORIZONTAL); recyclerView.setAdapter(recyclerViewAdapter); recyclerView.setLayoutManager(recyclerViewManager); return builder.create(); } }
433a1b5f1c5b1adcf2ad8e8a316ec1d4eb1dcade
66c8b127214aff3289d248fa408a6c8eb22ffe81
/backend/src/main/java/com/fastcampus/mobility/dto/AbstractDto.java
293e9bbe0cd2d2a45a07840e6da32c470509f23a
[ "Apache-2.0" ]
permissive
SeungpilPark/fastcampus-monolithic
4bd15b367324da9486b5df12673591a1392fcbda
c5805f0112bf52be4e1132caae40794188e8b008
refs/heads/master
2023-06-24T15:14:39.748034
2021-02-02T22:26:43
2021-02-02T22:26:43
330,288,918
0
0
null
null
null
null
UTF-8
Java
false
false
1,580
java
package com.fastcampus.mobility.dto; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import java.io.IOException; import java.io.Serializable; import java.util.List; import java.util.stream.Collectors; public abstract class AbstractDto implements Serializable { private static final long serialVersionUID = 1L; public static <T extends AbstractDto> T fromEntity(final Class<T> type, final Object entity) { ObjectMapper objectMapper = createObjectMapper(); try { String json = objectMapper.writeValueAsString(entity); return objectMapper.readValue(json, type); } catch (IOException jpe) { throw new IllegalArgumentException(jpe); } } public static <T extends AbstractDto> List<T> fromListEntities(final Class<T> dtoType, final List<?> entities) { return entities.stream().sequential() .map(entity -> AbstractDto.fromEntity(dtoType, entity)) .collect(Collectors.toList()); } private static ObjectMapper createObjectMapper() { ObjectMapper objectMapper = new ObjectMapper(); objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); objectMapper.configure(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, true); objectMapper.registerModule(new JavaTimeModule()); objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); return objectMapper; } }
9332dc818f20e4acc87a7c59480eecc8f18b502f
2e269300a47b07a6e4d2cf9395ab27b1e4ecbe7a
/EclipseWorkspace/WCARE/src/com/enercon/struts/requestProcessor/ManageFeederMasterRP.java
b87a1d1c10385fc1777a357477a99806398586d0
[]
no_license
Mitzz/WWIL
694f81f916d622c6e8fb76cd17a00bcdfea63c39
e0bb3a11e558357d894e534c829b83a280f7dc28
refs/heads/master
2021-05-04T10:22:22.860253
2016-10-02T12:01:30
2016-10-02T12:01:30
44,241,840
0
0
null
null
null
null
UTF-8
Java
false
false
2,104
java
package com.enercon.struts.requestProcessor; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.log4j.Logger; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import com.enercon.model.master.SubstationMasterVo; import com.enercon.service.master.FeederMasterService; import com.enercon.service.master.SubstationMasterService; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ser.FilterProvider; import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter; import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider; public class ManageFeederMasterRP extends Action { private static Logger logger = Logger.getLogger(ManageSubstationMasterRP.class); @Override public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { logger.debug("enter"); List<SubstationMasterVo> substations = SubstationMasterService.getInstance().getAll(); FeederMasterService.getInstance().associateSubstations(substations); ObjectMapper objectMapper = new ObjectMapper(); SimpleBeanPropertyFilter substationFilter = SimpleBeanPropertyFilter.filterOutAllExcept("name","id", "feeders"); SimpleBeanPropertyFilter feederFilter = SimpleBeanPropertyFilter.filterOutAllExcept("name","id"); SimpleFilterProvider propertyFilter = new SimpleFilterProvider(); propertyFilter.addFilter("substationMasterVo", substationFilter); propertyFilter.addFilter("feederMasterVo", feederFilter); FilterProvider filters = propertyFilter; // Converting List of Java Object to List of Javascript Object String substationsJson = objectMapper.writer(filters).writeValueAsString(substations); request.setAttribute("substations", substationsJson); return mapping.findForward("success"); } }
63b4ddb42916f502cc5af91b2cfdee1fa558ec77
45da47fc0d2f4e925f2521248d8e791510e165bd
/hrms/src/main/java/hrmsproject/hrms/business/concretes/VerificationCodeManager.java
e2b980a532a70e831f7ee6ec2422e822798dcb6a
[]
no_license
OzgurKucet/JavaHrmsProject
2cd5debe0dd9b7330bfcdac160ae396ee1f60845
8ec134b2e7ec16aec7f17a2d18e1997ed90adf68
refs/heads/master
2023-06-25T05:45:44.260171
2021-07-24T22:39:29
2021-07-24T22:39:29
379,675,869
0
0
null
null
null
null
UTF-8
Java
false
false
1,610
java
package hrmsproject.hrms.business.concretes; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import hrmsproject.hrms.business.abstracts.VerificationCodeService; import hrmsproject.hrms.core.unilities.results.DataResult; import hrmsproject.hrms.core.unilities.results.Result; import hrmsproject.hrms.core.unilities.results.SuccessDataResult; import hrmsproject.hrms.core.unilities.results.SuccessResult; import hrmsproject.hrms.dataAccess.abstracts.VerificationCodeDao; import hrmsproject.hrms.entities.concretes.VerificationCode; @Service public class VerificationCodeManager implements VerificationCodeService{ private VerificationCodeDao verificationCodeDao; @Autowired public VerificationCodeManager(VerificationCodeDao verificationCodeDao) { this.verificationCodeDao = verificationCodeDao; } @Override public Result add(VerificationCode code) { this.verificationCodeDao.save(code); return new SuccessResult("VerificationCode eklendi"); } @Override public Result update(VerificationCode code) { this.verificationCodeDao.save(code); return new SuccessResult("VerificationCode güncellendi"); } @Override public Result delete(VerificationCode code) { this.verificationCodeDao.delete(code); return new SuccessResult("VerificationCode silindi"); } @Override public DataResult<VerificationCode> findByUserIdAndCode(int userId, String code) { return new SuccessDataResult<VerificationCode>(this.verificationCodeDao.findByUserIdAndCode(userId, code)); } }
51f2ef53634b11fd894a28ab275f4adb671ffef7
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/5/5_93071832040f1bec1a961c5a8d6990cc4ff50854/ClusterConnectionImpl/5_93071832040f1bec1a961c5a8d6990cc4ff50854_ClusterConnectionImpl_s.java
f9aafe9cd946188e31dfbf0b758a0c2da0293f9c
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
34,572
java
/* * Copyright 2009 Red Hat, Inc. * Red Hat licenses this file to you under the Apache License, version * 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or * implied. See the License for the specific language governing * permissions and limitations under the License. */ package org.hornetq.core.server.cluster.impl; import static org.hornetq.api.core.management.NotificationType.CONSUMER_CLOSED; import static org.hornetq.api.core.management.NotificationType.CONSUMER_CREATED; import java.util.*; import java.util.Map.Entry; import java.util.concurrent.ScheduledExecutorService; import org.hornetq.api.core.DiscoveryGroupConfiguration; import org.hornetq.api.core.Pair; import org.hornetq.api.core.SimpleString; import org.hornetq.api.core.TransportConfiguration; import org.hornetq.api.core.client.ClientMessage; import org.hornetq.api.core.client.HornetQClient; import org.hornetq.api.core.management.ManagementHelper; import org.hornetq.api.core.management.NotificationType; import org.hornetq.core.client.impl.ServerLocatorInternal; import org.hornetq.core.logging.Logger; import org.hornetq.core.postoffice.Binding; import org.hornetq.core.postoffice.Bindings; import org.hornetq.core.postoffice.PostOffice; import org.hornetq.core.postoffice.impl.PostOfficeImpl; import org.hornetq.core.server.HornetQComponent; import org.hornetq.core.server.HornetQServer; import org.hornetq.core.server.Queue; import org.hornetq.core.server.cluster.Bridge; import org.hornetq.core.server.cluster.ClusterConnection; import org.hornetq.core.server.cluster.MessageFlowRecord; import org.hornetq.core.server.cluster.RemoteQueueBinding; import org.hornetq.core.server.group.impl.Proposal; import org.hornetq.core.server.group.impl.Response; import org.hornetq.core.server.management.ManagementService; import org.hornetq.core.server.management.Notification; import org.hornetq.utils.ExecutorFactory; import org.hornetq.utils.TypedProperties; import org.hornetq.utils.UUID; /** * * A ClusterConnectionImpl * * @author <a href="mailto:[email protected]">Tim Fox</a> * * Created 21 Jan 2009 14:43:05 * * */ public class ClusterConnectionImpl implements ClusterConnection { private static final Logger log = Logger.getLogger(ClusterConnectionImpl.class); private final org.hornetq.utils.ExecutorFactory executorFactory; private final HornetQServer server; private final PostOffice postOffice; private final ManagementService managementService; private final SimpleString name; private final SimpleString address; private final long retryInterval; private final boolean useDuplicateDetection; private final boolean routeWhenNoConsumers; private final Map<String, MessageFlowRecord> records = new HashMap<String, MessageFlowRecord>(); private final ScheduledExecutorService scheduledExecutor; private final int maxHops; private final UUID nodeUUID; private boolean backup; private volatile boolean started; private final String clusterUser; private final String clusterPassword; private final ClusterConnector clusterConnector; private ServerLocatorInternal serverLocator; private final TransportConfiguration connector; private final boolean allowDirectConnectionsOnly; private final Set<TransportConfiguration> allowableConnections = new HashSet<TransportConfiguration>(); public ClusterConnectionImpl(final TransportConfiguration[] tcConfigs, final TransportConfiguration connector, final SimpleString name, final SimpleString address, final long retryInterval, final boolean useDuplicateDetection, final boolean routeWhenNoConsumers, final int confirmationWindowSize, final ExecutorFactory executorFactory, final HornetQServer server, final PostOffice postOffice, final ManagementService managementService, final ScheduledExecutorService scheduledExecutor, final int maxHops, final UUID nodeUUID, final boolean backup, final String clusterUser, final String clusterPassword, final boolean allowDirectConnectionsOnly) throws Exception { if (nodeUUID == null) { throw new IllegalArgumentException("node id is null"); } this.nodeUUID = nodeUUID; this.connector = connector; this.name = name; this.address = address; this.retryInterval = retryInterval; this.useDuplicateDetection = useDuplicateDetection; this.routeWhenNoConsumers = routeWhenNoConsumers; this.executorFactory = executorFactory; this.server = server; this.postOffice = postOffice; this.managementService = managementService; this.scheduledExecutor = scheduledExecutor; this.maxHops = maxHops; this.backup = backup; this.clusterUser = clusterUser; this.clusterPassword = clusterPassword; this.allowDirectConnectionsOnly = allowDirectConnectionsOnly; clusterConnector = new StaticClusterConnector(tcConfigs); if (tcConfigs != null && tcConfigs.length > 0) { // a cluster connection will connect to other nodes only if they are directly connected // through a static list of connectors or broadcasting using UDP. if(allowDirectConnectionsOnly) { allowableConnections.addAll(Arrays.asList(tcConfigs)); } } } public ClusterConnectionImpl(DiscoveryGroupConfiguration dg, final TransportConfiguration connector, final SimpleString name, final SimpleString address, final long retryInterval, final boolean useDuplicateDetection, final boolean routeWhenNoConsumers, final int confirmationWindowSize, final ExecutorFactory executorFactory, final HornetQServer server, final PostOffice postOffice, final ManagementService managementService, final ScheduledExecutorService scheduledExecutor, final int maxHops, final UUID nodeUUID, final boolean backup, final String clusterUser, final String clusterPassword, final boolean allowDirectConnectionsOnly) throws Exception { if (nodeUUID == null) { throw new IllegalArgumentException("node id is null"); } this.nodeUUID = nodeUUID; this.connector = connector; this.name = name; this.address = address; this.retryInterval = retryInterval; this.useDuplicateDetection = useDuplicateDetection; this.routeWhenNoConsumers = routeWhenNoConsumers; this.executorFactory = executorFactory; this.server = server; this.postOffice = postOffice; this.managementService = managementService; this.scheduledExecutor = scheduledExecutor; this.maxHops = maxHops; this.backup = backup; this.clusterUser = clusterUser; this.clusterPassword = clusterPassword; this.allowDirectConnectionsOnly = allowDirectConnectionsOnly; clusterConnector = new DiscoveryClusterConnector(dg); } public synchronized void start() throws Exception { if (started) { return; } started = true; if(!backup) { activate(); } } public void stop() throws Exception { if (!started) { return; } if (serverLocator != null) { serverLocator.removeClusterTopologyListener(this); } synchronized (this) { for (MessageFlowRecord record : records.values()) { try { record.close(); } catch (Exception ignore) { } } if (managementService != null) { TypedProperties props = new TypedProperties(); props.putSimpleStringProperty(new SimpleString("name"), name); Notification notification = new Notification(nodeUUID.toString(), NotificationType.CLUSTER_CONNECTION_STOPPED, props); managementService.sendNotification(notification); } if(serverLocator != null) { serverLocator.close(); serverLocator = null; } started = false; } } public boolean isStarted() { return started; } public SimpleString getName() { return name; } public String getNodeID() { return nodeUUID.toString(); } public synchronized Map<String, String> getNodes() { Map<String, String> nodes = new HashMap<String, String>(); for (Entry<String, MessageFlowRecord> record : records.entrySet()) { if (record.getValue().getBridge().getForwardingConnection() != null) { nodes.put(record.getKey(), record.getValue().getBridge().getForwardingConnection().getRemoteAddress()); } } return nodes; } public synchronized void activate() throws Exception { if (!started) { return; } backup = false; serverLocator = clusterConnector.createServerLocator(); if (serverLocator != null) { serverLocator.setNodeID(nodeUUID.toString()); serverLocator.setReconnectAttempts(-1); serverLocator.setClusterConnection(true); serverLocator.setClusterTransportConfiguration(connector); serverLocator.setBackup(server.getConfiguration().isBackup()); serverLocator.setInitialConnectAttempts(-1); if(retryInterval > 0) { this.serverLocator.setRetryInterval(retryInterval); } serverLocator.addClusterTopologyListener(this); serverLocator.start(server.getExecutorFactory().getExecutor()); } if (managementService != null) { TypedProperties props = new TypedProperties(); props.putSimpleStringProperty(new SimpleString("name"), name); Notification notification = new Notification(nodeUUID.toString(), NotificationType.CLUSTER_CONNECTION_STARTED, props); managementService.sendNotification(notification); } } public TransportConfiguration getConnector() { return connector; } // ClusterTopologyListener implementation ------------------------------------------------------------------ public synchronized void nodeDown(final String nodeID) { if (nodeID.equals(nodeUUID.toString())) { return; } //Remove the flow record for that node MessageFlowRecord record = records.get(nodeID); if (record != null) { try { record.reset(); } catch (Exception e) { log.error("Failed to close flow record", e); } } server.getClusterManager().notifyNodeDown(nodeID); } public synchronized void nodeUP(final String nodeID, final Pair<TransportConfiguration, TransportConfiguration> connectorPair, final boolean last, final int distance) { // discard notifications about ourselves unless its from our backup if (nodeID.equals(nodeUUID.toString())) { if(connectorPair.b != null) { server.getClusterManager().notifyNodeUp(nodeID, connectorPair, last, distance); } return; } // we propagate the node notifications to all cluster topology listeners server.getClusterManager().notifyNodeUp(nodeID, connectorPair, last, distance); // if the node is more than 1 hop away, we do not create a bridge for direct cluster connection if (allowDirectConnectionsOnly && distance > 1 && !allowableConnections.contains(connectorPair.a)) { return; } // FIXME required to prevent cluster connections w/o discovery group // and empty static connectors to create bridges... ulgy! if (serverLocator == null) { return; } try { MessageFlowRecord record = records.get(nodeID); if (record == null) { // New node - create a new flow record final SimpleString queueName = new SimpleString("sf." + name + "." + nodeID); Binding queueBinding = postOffice.getBinding(queueName); Queue queue; if (queueBinding != null) { queue = (Queue)queueBinding.getBindable(); } else { // Add binding in storage so the queue will get reloaded on startup and we can find it - it's never // actually routed to at that address though queue = server.createQueue(queueName, queueName, null, true, false); } createNewRecord(nodeID, connectorPair.a, queueName, queue, true); } else { // FIXME apple and orange comparison. I don't understand it... //if (!connectorPair.a.equals(record.getBridge().getForwardingConnection().getTransportConnection())) // { // // New live node - close it and recreate it - TODO - CAN THIS EVER HAPPEN? //} } } catch (Exception e) { log.error("Failed to update topology", e); } } private void createNewRecord(final String nodeID, final TransportConfiguration connector, final SimpleString queueName, final Queue queue, final boolean start) throws Exception { MessageFlowRecordImpl record = new MessageFlowRecordImpl(queue); Bridge bridge = new ClusterConnectionBridge(serverLocator, nodeUUID, nodeID, queueName, queue, executorFactory.getExecutor(), null, null, scheduledExecutor, null, useDuplicateDetection, clusterUser, clusterPassword, !backup, server.getStorageManager(), managementService.getManagementAddress(), managementService.getManagementNotificationAddress(), record, connector); record.setBridge(bridge); records.put(nodeID, record); if (start) { bridge.start(); } } // Inner classes ----------------------------------------------------------------------------------- private class MessageFlowRecordImpl implements MessageFlowRecord { private Bridge bridge; private final Queue queue; private final Map<SimpleString, RemoteQueueBinding> bindings = new HashMap<SimpleString, RemoteQueueBinding>(); private volatile boolean firstReset = false; public MessageFlowRecordImpl(final Queue queue) { this.queue = queue; } public String getAddress() { return address.toString(); } public int getMaxHops() { return maxHops; } public void close() throws Exception { bridge.stop(); clearBindings(); } public void reset() throws Exception { clearBindings(); } public void setBridge(final Bridge bridge) { this.bridge = bridge; } public Bridge getBridge() { return bridge; } public synchronized void onMessage(final ClientMessage message) { try { // Reset the bindings if (message.containsProperty(PostOfficeImpl.HDR_RESET_QUEUE_DATA)) { clearBindings(); firstReset = true; return; } if (!firstReset) { return; } // TODO - optimised this by just passing int in header - but filter needs to be extended to support IN with // a list of integers SimpleString type = message.getSimpleStringProperty(ManagementHelper.HDR_NOTIFICATION_TYPE); NotificationType ntype = NotificationType.valueOf(type.toString()); switch (ntype) { case BINDING_ADDED: { doBindingAdded(message); break; } case BINDING_REMOVED: { doBindingRemoved(message); break; } case CONSUMER_CREATED: { doConsumerCreated(message); break; } case CONSUMER_CLOSED: { doConsumerClosed(message); break; } case PROPOSAL: { doProposalReceived(message); break; } case PROPOSAL_RESPONSE: { doProposalResponseReceived(message); break; } default: { throw new IllegalArgumentException("Invalid type " + ntype); } } } catch (Exception e) { ClusterConnectionImpl.log.error("Failed to handle message", e); } } /* * Inform the grouping handler of a proposal * */ private synchronized void doProposalReceived(final ClientMessage message) throws Exception { if (!message.containsProperty(ManagementHelper.HDR_PROPOSAL_GROUP_ID)) { throw new IllegalStateException("proposal type is null"); } SimpleString type = message.getSimpleStringProperty(ManagementHelper.HDR_PROPOSAL_GROUP_ID); SimpleString val = message.getSimpleStringProperty(ManagementHelper.HDR_PROPOSAL_VALUE); Integer hops = message.getIntProperty(ManagementHelper.HDR_DISTANCE); Response response = server.getGroupingHandler().receive(new Proposal(type, val), hops + 1); if (response != null) { server.getGroupingHandler().send(response, 0); } } /* * Inform the grouping handler of a response from a proposal * * */ private synchronized void doProposalResponseReceived(final ClientMessage message) throws Exception { if (!message.containsProperty(ManagementHelper.HDR_PROPOSAL_GROUP_ID)) { throw new IllegalStateException("proposal type is null"); } SimpleString type = message.getSimpleStringProperty(ManagementHelper.HDR_PROPOSAL_GROUP_ID); SimpleString val = message.getSimpleStringProperty(ManagementHelper.HDR_PROPOSAL_VALUE); SimpleString alt = message.getSimpleStringProperty(ManagementHelper.HDR_PROPOSAL_ALT_VALUE); Integer hops = message.getIntProperty(ManagementHelper.HDR_DISTANCE); Response response = new Response(type, val, alt); server.getGroupingHandler().proposed(response); server.getGroupingHandler().send(response, hops + 1); } private synchronized void clearBindings() throws Exception { for (RemoteQueueBinding binding : new HashSet<RemoteQueueBinding>(bindings.values())) { removeBinding(binding.getClusterName()); } } private synchronized void doBindingAdded(final ClientMessage message) throws Exception { if (!message.containsProperty(ManagementHelper.HDR_DISTANCE)) { throw new IllegalStateException("distance is null"); } if (!message.containsProperty(ManagementHelper.HDR_ADDRESS)) { throw new IllegalStateException("queueAddress is null"); } if (!message.containsProperty(ManagementHelper.HDR_CLUSTER_NAME)) { throw new IllegalStateException("clusterName is null"); } if (!message.containsProperty(ManagementHelper.HDR_ROUTING_NAME)) { throw new IllegalStateException("routingName is null"); } if (!message.containsProperty(ManagementHelper.HDR_BINDING_ID)) { throw new IllegalStateException("queueID is null"); } Integer distance = message.getIntProperty(ManagementHelper.HDR_DISTANCE); SimpleString queueAddress = message.getSimpleStringProperty(ManagementHelper.HDR_ADDRESS); SimpleString clusterName = message.getSimpleStringProperty(ManagementHelper.HDR_CLUSTER_NAME); SimpleString routingName = message.getSimpleStringProperty(ManagementHelper.HDR_ROUTING_NAME); SimpleString filterString = message.getSimpleStringProperty(ManagementHelper.HDR_FILTERSTRING); Long queueID = message.getLongProperty(ManagementHelper.HDR_BINDING_ID); RemoteQueueBinding binding = new RemoteQueueBindingImpl(server.getStorageManager().generateUniqueID(), queueAddress, clusterName, routingName, queueID, filterString, queue, bridge.getName(), distance + 1); if (postOffice.getBinding(clusterName) != null) { // Sanity check - this means the binding has already been added via another bridge, probably max // hops is too high // or there are multiple cluster connections for the same address ClusterConnectionImpl.log.warn("Remote queue binding " + clusterName + " has already been bound in the post office. Most likely cause for this is you have a loop " + "in your cluster due to cluster max-hops being too large or you have multiple cluster connections to the same nodes using overlapping addresses"); return; } bindings.put(clusterName, binding); try { postOffice.addBinding(binding); } catch (Exception ignore) { } Bindings theBindings = postOffice.getBindingsForAddress(queueAddress); theBindings.setRouteWhenNoConsumers(routeWhenNoConsumers); } private void doBindingRemoved(final ClientMessage message) throws Exception { if (!message.containsProperty(ManagementHelper.HDR_CLUSTER_NAME)) { throw new IllegalStateException("clusterName is null"); } SimpleString clusterName = message.getSimpleStringProperty(ManagementHelper.HDR_CLUSTER_NAME); removeBinding(clusterName); } private synchronized void removeBinding(final SimpleString clusterName) throws Exception { RemoteQueueBinding binding = bindings.remove(clusterName); if (binding == null) { throw new IllegalStateException("Cannot find binding for queue " + clusterName); } postOffice.removeBinding(binding.getUniqueName()); } private synchronized void doConsumerCreated(final ClientMessage message) throws Exception { if (!message.containsProperty(ManagementHelper.HDR_DISTANCE)) { throw new IllegalStateException("distance is null"); } if (!message.containsProperty(ManagementHelper.HDR_CLUSTER_NAME)) { throw new IllegalStateException("clusterName is null"); } Integer distance = message.getIntProperty(ManagementHelper.HDR_DISTANCE); SimpleString clusterName = message.getSimpleStringProperty(ManagementHelper.HDR_CLUSTER_NAME); message.putIntProperty(ManagementHelper.HDR_DISTANCE, distance + 1); SimpleString filterString = message.getSimpleStringProperty(ManagementHelper.HDR_FILTERSTRING); RemoteQueueBinding binding = bindings.get(clusterName); if (binding == null) { throw new IllegalStateException("Cannot find binding for " + clusterName); } binding.addConsumer(filterString); // Need to propagate the consumer add TypedProperties props = new TypedProperties(); props.putSimpleStringProperty(ManagementHelper.HDR_ADDRESS, binding.getAddress()); props.putSimpleStringProperty(ManagementHelper.HDR_CLUSTER_NAME, clusterName); props.putSimpleStringProperty(ManagementHelper.HDR_ROUTING_NAME, binding.getRoutingName()); props.putIntProperty(ManagementHelper.HDR_DISTANCE, distance + 1); Queue theQueue = (Queue)binding.getBindable(); props.putIntProperty(ManagementHelper.HDR_CONSUMER_COUNT, theQueue.getConsumerCount()); if (filterString != null) { props.putSimpleStringProperty(ManagementHelper.HDR_FILTERSTRING, filterString); } Notification notification = new Notification(null, CONSUMER_CREATED, props); managementService.sendNotification(notification); } private synchronized void doConsumerClosed(final ClientMessage message) throws Exception { if (!message.containsProperty(ManagementHelper.HDR_DISTANCE)) { throw new IllegalStateException("distance is null"); } if (!message.containsProperty(ManagementHelper.HDR_CLUSTER_NAME)) { throw new IllegalStateException("clusterName is null"); } Integer distance = message.getIntProperty(ManagementHelper.HDR_DISTANCE); SimpleString clusterName = message.getSimpleStringProperty(ManagementHelper.HDR_CLUSTER_NAME); message.putIntProperty(ManagementHelper.HDR_DISTANCE, distance + 1); SimpleString filterString = message.getSimpleStringProperty(ManagementHelper.HDR_FILTERSTRING); RemoteQueueBinding binding = bindings.get(clusterName); if (binding == null) { throw new IllegalStateException("Cannot find binding for " + clusterName); } binding.removeConsumer(filterString); // Need to propagate the consumer close TypedProperties props = new TypedProperties(); props.putSimpleStringProperty(ManagementHelper.HDR_ADDRESS, binding.getAddress()); props.putSimpleStringProperty(ManagementHelper.HDR_CLUSTER_NAME, clusterName); props.putSimpleStringProperty(ManagementHelper.HDR_ROUTING_NAME, binding.getRoutingName()); props.putIntProperty(ManagementHelper.HDR_DISTANCE, distance + 1); Queue theQueue = (Queue)binding.getBindable(); props.putIntProperty(ManagementHelper.HDR_CONSUMER_COUNT, theQueue.getConsumerCount()); if (filterString != null) { props.putSimpleStringProperty(ManagementHelper.HDR_FILTERSTRING, filterString); } Notification notification = new Notification(null, CONSUMER_CLOSED, props); managementService.sendNotification(notification); } } public void handleReplicatedAddBinding(final SimpleString address, final SimpleString uniqueName, final SimpleString routingName, final long queueID, final SimpleString filterString, final SimpleString queueName, final int distance) throws Exception { Binding queueBinding = postOffice.getBinding(queueName); if (queueBinding == null) { throw new IllegalStateException("Cannot find s & f queue " + queueName); } Queue queue = (Queue)queueBinding.getBindable(); RemoteQueueBinding binding = new RemoteQueueBindingImpl(server.getStorageManager().generateUniqueID(), address, uniqueName, routingName, queueID, filterString, queue, queueName, distance); if (postOffice.getBinding(uniqueName) != null) { ClusterConnectionImpl.log.warn("Remoting queue binding " + uniqueName + " has already been bound in the post office. Most likely cause for this is you have a loop " + "in your cluster due to cluster max-hops being too large or you have multiple cluster connections to the same nodes using overlapping addresses"); return; } postOffice.addBinding(binding); Bindings theBindings = postOffice.getBindingsForAddress(address); theBindings.setRouteWhenNoConsumers(routeWhenNoConsumers); } // for testing only public Map<String, MessageFlowRecord> getRecords() { return records; } public String description() { String out = name + " connected to\n"; for (Entry<String, MessageFlowRecord> messageFlow : records.entrySet()) { String nodeID = messageFlow.getKey(); Bridge bridge = messageFlow.getValue().getBridge(); out += "\t" + nodeID + " -- " + bridge.isStarted() + "\n"; } return out; } interface ClusterConnector { ServerLocatorInternal createServerLocator(); } private class StaticClusterConnector implements ClusterConnector { private final TransportConfiguration[] tcConfigs; public StaticClusterConnector(TransportConfiguration[] tcConfigs) { this.tcConfigs = tcConfigs; } public ServerLocatorInternal createServerLocator() { if(tcConfigs != null && tcConfigs.length > 0) { return (ServerLocatorInternal) HornetQClient.createServerLocatorWithHA(tcConfigs); } else { return null; } } } private class DiscoveryClusterConnector implements ClusterConnector { private final DiscoveryGroupConfiguration dg; public DiscoveryClusterConnector(DiscoveryGroupConfiguration dg) { this.dg = dg; } public ServerLocatorInternal createServerLocator() { return (ServerLocatorInternal) HornetQClient.createServerLocatorWithHA(dg); } } }
4b419e709a9133ee65f6eb64017c837a441e6ce5
5f2af2198c11a447c8390de7c5a0675495c6e5af
/Parcial Recuperatorio/src/main/java/Repositorio/IRepositorioCrearEquipo.java
faaf940c32b319f0567826d2331c4594ee8180a0
[]
no_license
himuraxkenji/undec-prog3-2019
b43144f011a54a1aa89d5fc54e735e5303347a80
451395a6eb217fda5ba6287c210187581cdf28b6
refs/heads/master
2021-07-04T03:43:46.776880
2019-10-30T22:33:05
2019-10-30T22:33:05
181,970,607
0
0
null
2020-10-13T17:06:37
2019-04-17T21:26:13
Java
UTF-8
Java
false
false
166
java
package Repositorio; import Model.Equipo; public interface IRepositorioCrearEquipo { Equipo findByNombre(String nombre); Boolean guardar(Equipo equipo); }
46e97a4480ec56ddaad9ff3d5dccb883dee7779f
ff5547c329fc80f475229812520e30db7f413c78
/calendar-api/src/main/java/com/larry/fc/finalproject/api/dto/NotificationDto.java
faa03924a4383ffde5183b6303d372619b89a0b8
[]
no_license
wisdomme/final-project-calendar
deac988eaed80d4a35f7bb9fa957f553501ebf78
d4e2630b5abd2d88b43bf7fc959348dd68ab066a
refs/heads/main
2023-07-14T08:17:25.783109
2021-09-04T05:44:09
2021-09-04T05:44:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
501
java
package com.larry.fc.finalproject.api.dto; import com.larry.fc.finalproject.core.domain.ScheduleType; import lombok.Data; import java.time.LocalDateTime; /** * @author Larry */ @Data public class NotificationDto implements ForListScheduleDto { private final Long scheduleId; private final Long writerId; private final String title; private final LocalDateTime notifyAt; @Override public ScheduleType getScheduleType() { return ScheduleType.NOTIFICATION; } }
5270aed25bad7d1dddfe26a6417548278aabb435
2cbb1fc9ea123dc452cbd57b399ddf384c936388
/src/main/java/com/hisen/interview/math/LingXing.java
9ee21ec86ba7ba967064aecdf0733bf2f295b904
[]
no_license
xiamuzhen/IDEAPractice
88e8e0f7a5717d09cc91a628926b42456215554c
549928b9e1cf80b2d1d6a3fd394432ceec1c8dc6
refs/heads/master
2022-07-29T14:14:18.494990
2020-03-05T01:01:32
2020-03-05T01:01:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,050
java
package com.hisen.interview.math; /** * 观察规律,打印菱形的话是由空格跟*组成 * 每一行里面 空格个数+星号的个数都是相等的 * 所以在for循环里面加入两个并行的循环可以实现打印 */ public class LingXing { public static void main(String[] args) { printLX(5); } /** * 打印菱形的方法 * * @param n 菱形最宽处*的个数 */ public static void printLX(int n) { // 菱形的上半部分 for (int i = 1; i <= n; i++) { for (int k = 0; k < n - i; k++) { System.out.print("\t"); } for (int j = 1; j <= i; j++) { System.out.print("\t*\t"); } System.out.println(""); } // 菱形下半部分,x从1开始,否则会多一行 for (int x = 1; x <= n; x++) { for (int y = 0; y < x; y++) { System.out.print("\t"); } for (int z = 1; z <= n - x; z++) { System.out.print("\t*\t"); } System.out.println(""); } } }
c9a28b206e5802eb993a4564721b142f4654cf2a
c9eae5f5116e60cef12dcf26ef47bcb93e5dd3a8
/src/day11_MultiBranchIf/MaxMin1.java
6348aac546472f627ec08e726721d5b01808c413
[]
no_license
A1myra/JavaProgramming2020_B21
871bb5630f92db3a6c211b28b8f8c872a373e972
0e23000c9aac88c8cb66d75dfc09aada896b46ce
refs/heads/master
2023-02-26T07:51:03.634622
2021-02-01T20:33:26
2021-02-01T20:33:26
312,080,251
0
0
null
null
null
null
UTF-8
Java
false
false
1,549
java
package day11_MultiBranchIf; import org.w3c.dom.ls.LSOutput; public class MaxMin1 { public static void main(String[] args) { int num1 = 20; int num2= 50; String maxNum = ""; if(num1>num2){ maxNum = num1 + ": is the maximum number"; }else{ maxNum = num2 +" : is the maximum number"; } System.out.println(maxNum); System.out.println("=============================="); String maximumnumber = (num1>num2)? num1 + ": is the maximum number" : num2 + " : is the maximum number"; System.out.println(maximumnumber); System.out.println("==============================="); String minNum = ""; if (num1 < num2) { minNum = num1 + " : is the minimum number"; } else { minNum = num2 + " : is the minimum number"; } System.out.println(minNum); System.out.println("================================"); String minimumNum = (num1 < num2) ? num1 +" : is the minimum number" : num2 + " : is the minimum number"; System.out.println(minimumNum); } } /*Task: 1. write a program that can find the maximum number between two different numbers first solution: if & else statement second solution: do not use any if statement 2. write a program that can find the minimum number between two different numbers first solution: if & else statement second solution: do not use any if statement */
187a4eeb2a500ca82bde87d3fa72415d94894021
45c00f46940dbd54517933ed5376797ba100ddfd
/src/main/java/org/ccframe/client/module/bike/view/AgentAppWindowView.java
82fed117607e8b638acbc0487b91ecc9204e11bb
[]
no_license
hoku850/bike-server
1926a92c1ef69a2ec6e497b2a653de6f89b96d43
a75559e923849ab96319438cc45dfbe7115206ef
refs/heads/master
2021-07-01T03:56:16.995615
2017-09-21T07:31:28
2017-09-21T07:31:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,485
java
package org.ccframe.client.module.bike.view; import org.ccframe.client.base.BaseWindowView; import org.ccframe.client.commons.CcFormPanelHelper; import org.ccframe.client.commons.ClientManager; import org.ccframe.client.commons.RestCallback; import org.ccframe.client.components.CcLabelValueCombobox; import org.ccframe.client.components.CcTextField; import org.ccframe.client.components.CcVBoxLayoutContainer; import org.ccframe.subsys.bike.domain.entity.AgentApp; import org.fusesource.restygwt.client.Method; import com.google.gwt.core.client.GWT; import com.google.gwt.editor.client.Editor; import com.google.gwt.editor.client.SimpleBeanEditorDriver; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; import com.google.gwt.uibinder.client.UiHandler; import com.google.gwt.user.client.ui.Widget; import com.google.inject.Singleton; import com.sencha.gxt.widget.core.client.Component; import com.sencha.gxt.widget.core.client.button.TextButton; import com.sencha.gxt.widget.core.client.event.SelectEvent; import com.sencha.gxt.widget.core.client.form.FormPanelHelper; import com.sencha.gxt.widget.core.client.info.Info; @Singleton public class AgentAppWindowView extends BaseWindowView<Integer, AgentApp> implements Editor<AgentApp>{ interface AgentAppUiBinder extends UiBinder<Component, AgentAppWindowView> {} interface AgentAppDriver extends SimpleBeanEditorDriver<AgentApp, AgentAppWindowView> {} private static AgentAppUiBinder uiBinder = GWT.create(AgentAppUiBinder.class); private AgentAppDriver driver = GWT.create(AgentAppDriver.class); private Integer agentAppId; @UiField CcVBoxLayoutContainer vBoxLayoutContainer; @UiField CcTextField appNm; @UiField CcTextField iosUrl; @UiField CcTextField androidUrl; @UiField CcLabelValueCombobox orgId; @UiHandler("saveButton") public void handleSaveClick(SelectEvent e){ if(FormPanelHelper.isValid(vBoxLayoutContainer, false)){ final AgentApp agentApp = driver.flush(); agentApp.setAgentAppId(agentAppId); final TextButton button = ((TextButton)(e.getSource())); button.disable(); ClientManager.getAgentAppClient().saveOrUpdate(agentApp, new RestCallback<Void>(){ @Override public void onSuccess(Method method, Void response) { Info.display("操作完成", "运营商APP" + (agentAppId == null ? "新增" : "修改") + "成功"); AgentAppWindowView.this.retCallBack.onClose(agentApp); //保存并回传结果数据 button.enable(); window.hide(); } @Override protected void afterFailure(){ //如果采用按钮的disable逻辑,一定要在此方法enable按钮 button.enable(); } }); } } @Override protected Widget bindUi() { Widget widget = uiBinder.createAndBindUi(this); driver.initialize(this); driver.edit(new AgentApp()); return widget; } @Override protected void onLoadData(Integer agentAppId) { this.agentAppId = agentAppId; window.setHeadingText("运营商APP" + (agentAppId == null ? "增加" : "修改")); orgId.reset(); CcFormPanelHelper.clearInvalid(vBoxLayoutContainer); // 重置下拉框 if(agentAppId == null){ FormPanelHelper.reset(vBoxLayoutContainer); }else{ ClientManager.getAgentAppClient().getById(agentAppId, new RestCallback<AgentApp>(){ @Override public void onSuccess(Method method, AgentApp response) { driver.edit(response); } }); } vBoxLayoutContainer.forceLayout(); } }
308f97d57257e77f5dc12a1589957f2734e36a6b
a6f12fc5a796c02ec64fa3edc1e77def2828e32e
/AzuraJava/src/common/collections/buffer/DataArray.java
864236d63cb5ebd7dea2ac42efd8422886ab2901
[]
no_license
jixingrui/java
94b7a599175e572b6f4ef73686ecebfc21e165e2
347680e37a363ebf3b5d79e38718416de5f787f0
refs/heads/master
2021-06-27T15:12:16.180217
2017-09-19T18:59:56
2017-09-19T18:59:56
104,111,505
1
1
null
null
null
null
UTF-8
Java
false
false
2,331
java
package common.collections.buffer; public class DataArray { protected LogicalArray array; public DataArray(LogicalArray array) { this.array = array; } public void expand(int more) { LogicalArray la = LogicalArray.allocate(array.length + more); LogicalArray.copy(array, 0, la, 0, array.length); array = la; } public boolean getBoolean(int idx) { byte b = getByte(idx); return b != 0; } public byte getByte(int idx) { return array.get(idx); } public short getShort(int idx) { return (short) (array.get(idx) << 8 | array.get(idx + 1) & 0xFF); } public int getInt(int idx) { return (array.get(idx) & 0xff) << 24 | (array.get(idx + 1) & 0xff) << 16 | (array.get(idx + 2) & 0xff) << 8 | array.get(idx + 3) & 0xff; } public long getLong(int idx) { return ((long) array.get(idx) & 0xff) << 56 | ((long) array.get(idx + 1) & 0xff) << 48 | ((long) array.get(idx + 2) & 0xff) << 40 | ((long) array.get(idx + 3) & 0xff) << 32 | ((long) array.get(idx + 4) & 0xff) << 24 | ((long) array.get(idx + 5) & 0xff) << 16 | ((long) array.get(idx + 6) & 0xff) << 8 | (long) array.get(idx + 7) & 0xff; } public double getDouble(int idx) { return Double.longBitsToDouble(getLong(idx)); } public DataArray setBoolean(int idx, boolean value) { int b = (value) ? 1 : 0; return setByte(idx, b); } public DataArray setByte(int idx, int value) { array.set(idx, value); return this; } public DataArray setShort(int idx, int value) { array.set(idx, value >>> 8); array.set(idx + 1, value); return this; } public DataArray setInt(int idx, int value) { array.set(idx, value >>> 24); array.set(idx + 1, value >>> 16); array.set(idx + 2, value >>> 8); array.set(idx + 3, value); return this; } public DataArray setLong(int idx, long value) { array.set(idx, value >>> 56); array.set(idx + 1, value >>> 48); array.set(idx + 2, value >>> 40); array.set(idx + 3, value >>> 32); array.set(idx + 4, value >>> 24); array.set(idx + 5, value >>> 16); array.set(idx + 6, value >>> 8); array.set(idx + 7, value); return this; } public DataArray setDouble(int idx, double value) { return setLong(idx, Double.doubleToRawLongBits(value)); } }
c84df722173aea49af9eec2eefe6a6cfa1a14999
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/9/9_1cfa7abf65e45554fe308168e1678dd8d447b481/TokenRewriteStream/9_1cfa7abf65e45554fe308168e1678dd8d447b481_TokenRewriteStream_s.java
77050202e7f521cfabb711c9228354e55cffda9c
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
21,746
java
/* [The "BSD license"] Copyright (c) 2005-2009 Terence Parr All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.antlr.runtime; import java.util.*; /** Useful for dumping out the input stream after doing some * augmentation or other manipulations. * * You can insert stuff, replace, and delete chunks. Note that the * operations are done lazily--only if you convert the buffer to a * String. This is very efficient because you are not moving data around * all the time. As the buffer of tokens is converted to strings, the * toString() method(s) check to see if there is an operation at the * current index. If so, the operation is done and then normal String * rendering continues on the buffer. This is like having multiple Turing * machine instruction streams (programs) operating on a single input tape. :) * * Since the operations are done lazily at toString-time, operations do not * screw up the token index values. That is, an insert operation at token * index i does not change the index values for tokens i+1..n-1. * * Because operations never actually alter the buffer, you may always get * the original token stream back without undoing anything. Since * the instructions are queued up, you can easily simulate transactions and * roll back any changes if there is an error just by removing instructions. * For example, * * CharStream input = new ANTLRFileStream("input"); * TLexer lex = new TLexer(input); * TokenRewriteStream tokens = new TokenRewriteStream(lex); * T parser = new T(tokens); * parser.startRule(); * * Then in the rules, you can execute * Token t,u; * ... * input.insertAfter(t, "text to put after t");} * input.insertAfter(u, "text after u");} * System.out.println(tokens.toString()); * * Actually, you have to cast the 'input' to a TokenRewriteStream. :( * * You can also have multiple "instruction streams" and get multiple * rewrites from a single pass over the input. Just name the instruction * streams and use that name again when printing the buffer. This could be * useful for generating a C file and also its header file--all from the * same buffer: * * tokens.insertAfter("pass1", t, "text to put after t");} * tokens.insertAfter("pass2", u, "text after u");} * System.out.println(tokens.toString("pass1")); * System.out.println(tokens.toString("pass2")); * * If you don't use named rewrite streams, a "default" stream is used as * the first example shows. */ public class TokenRewriteStream extends CommonTokenStream { public static final String DEFAULT_PROGRAM_NAME = "default"; public static final int PROGRAM_INIT_SIZE = 100; public static final int MIN_TOKEN_INDEX = 0; // Define the rewrite operation hierarchy class RewriteOperation { /** What index into rewrites List are we? */ protected int instructionIndex; /** Token buffer index. */ protected int index; protected Object text; protected RewriteOperation(int index) { this.index = index; } protected RewriteOperation(int index, Object text) { this.index = index; this.text = text; } /** Execute the rewrite operation by possibly adding to the buffer. * Return the index of the next token to operate on. */ public int execute(StringBuffer buf) { return index; } @Override public String toString() { String opName = getClass().getName(); int $index = opName.indexOf('$'); opName = opName.substring($index+1, opName.length()); return "<"+opName+"@"+tokens.get(index)+ ":\""+text+"\">"; } } class InsertBeforeOp extends RewriteOperation { public InsertBeforeOp(int index, Object text) { super(index,text); } @Override public int execute(StringBuffer buf) { buf.append(text); if ( tokens.get(index).getType()!=Token.EOF ) { buf.append(tokens.get(index).getText()); } return index+1; } } /** I'm going to try replacing range from x..y with (y-x)+1 ReplaceOp * instructions. */ class ReplaceOp extends RewriteOperation { protected int lastIndex; public ReplaceOp(int from, int to, Object text) { super(from,text); lastIndex = to; } @Override public int execute(StringBuffer buf) { if ( text!=null ) { buf.append(text); } return lastIndex+1; } @Override public String toString() { if ( text==null ) { return "<DeleteOp@"+tokens.get(index)+ ".."+tokens.get(lastIndex)+">"; } return "<ReplaceOp@"+tokens.get(index)+ ".."+tokens.get(lastIndex)+":\""+text+"\">"; } } /** You may have multiple, named streams of rewrite operations. * I'm calling these things "programs." * Maps String (name) -> rewrite (List) */ protected Map<String, List<RewriteOperation>> programs = null; /** Map String (program name) -> Integer index */ protected Map<String, Integer> lastRewriteTokenIndexes = null; public TokenRewriteStream() { init(); } protected void init() { programs = new HashMap<String, List<RewriteOperation>>(); programs.put(DEFAULT_PROGRAM_NAME, new ArrayList<RewriteOperation>(PROGRAM_INIT_SIZE)); lastRewriteTokenIndexes = new HashMap<String, Integer>(); } public TokenRewriteStream(TokenSource tokenSource) { super(tokenSource); init(); } public TokenRewriteStream(TokenSource tokenSource, int channel) { super(tokenSource, channel); init(); } public void rollback(int instructionIndex) { rollback(DEFAULT_PROGRAM_NAME, instructionIndex); } /** Rollback the instruction stream for a program so that * the indicated instruction (via instructionIndex) is no * longer in the stream. UNTESTED! */ public void rollback(String programName, int instructionIndex) { List<RewriteOperation> is = programs.get(programName); if ( is!=null ) { programs.put(programName, is.subList(MIN_TOKEN_INDEX,instructionIndex)); } } public void deleteProgram() { deleteProgram(DEFAULT_PROGRAM_NAME); } /** Reset the program so that no instructions exist */ public void deleteProgram(String programName) { rollback(programName, MIN_TOKEN_INDEX); } public void insertAfter(Token t, Object text) { insertAfter(DEFAULT_PROGRAM_NAME, t, text); } public void insertAfter(int index, Object text) { insertAfter(DEFAULT_PROGRAM_NAME, index, text); } public void insertAfter(String programName, Token t, Object text) { insertAfter(programName,t.getTokenIndex(), text); } public void insertAfter(String programName, int index, Object text) { // to insert after, just insert before next index (even if past end) insertBefore(programName,index+1, text); } public void insertBefore(Token t, Object text) { insertBefore(DEFAULT_PROGRAM_NAME, t, text); } public void insertBefore(int index, Object text) { insertBefore(DEFAULT_PROGRAM_NAME, index, text); } public void insertBefore(String programName, Token t, Object text) { insertBefore(programName, t.getTokenIndex(), text); } public void insertBefore(String programName, int index, Object text) { RewriteOperation op = new InsertBeforeOp(index,text); List<? super RewriteOperation> rewrites = getProgram(programName); op.instructionIndex = rewrites.size(); rewrites.add(op); } public void replace(int index, Object text) { replace(DEFAULT_PROGRAM_NAME, index, index, text); } public void replace(int from, int to, Object text) { replace(DEFAULT_PROGRAM_NAME, from, to, text); } public void replace(Token indexT, Object text) { replace(DEFAULT_PROGRAM_NAME, indexT, indexT, text); } public void replace(Token from, Token to, Object text) { replace(DEFAULT_PROGRAM_NAME, from, to, text); } public void replace(String programName, int from, int to, Object text) { if ( from > to || from<0 || to<0 || to >= tokens.size() ) { throw new IllegalArgumentException("replace: range invalid: "+from+".."+to+"(size="+tokens.size()+")"); } RewriteOperation op = new ReplaceOp(from, to, text); List<? super RewriteOperation> rewrites = getProgram(programName); op.instructionIndex = rewrites.size(); rewrites.add(op); } public void replace(String programName, Token from, Token to, Object text) { replace(programName, from.getTokenIndex(), to.getTokenIndex(), text); } public void delete(int index) { delete(DEFAULT_PROGRAM_NAME, index, index); } public void delete(int from, int to) { delete(DEFAULT_PROGRAM_NAME, from, to); } public void delete(Token indexT) { delete(DEFAULT_PROGRAM_NAME, indexT, indexT); } public void delete(Token from, Token to) { delete(DEFAULT_PROGRAM_NAME, from, to); } public void delete(String programName, int from, int to) { replace(programName,from,to,null); } public void delete(String programName, Token from, Token to) { replace(programName,from,to,null); } public int getLastRewriteTokenIndex() { return getLastRewriteTokenIndex(DEFAULT_PROGRAM_NAME); } protected int getLastRewriteTokenIndex(String programName) { Integer I = lastRewriteTokenIndexes.get(programName); if ( I==null ) { return -1; } return I.intValue(); } protected void setLastRewriteTokenIndex(String programName, int i) { lastRewriteTokenIndexes.put(programName, new Integer(i)); } protected List<RewriteOperation> getProgram(String name) { List<RewriteOperation> is = programs.get(name); if ( is==null ) { is = initializeProgram(name); } return is; } private List<RewriteOperation> initializeProgram(String name) { List<RewriteOperation> is = new ArrayList<RewriteOperation>(PROGRAM_INIT_SIZE); programs.put(name, is); return is; } public String toOriginalString() { fill(); return toOriginalString(MIN_TOKEN_INDEX, size()-1); } public String toOriginalString(int start, int end) { StringBuilder buf = new StringBuilder(); for (int i=start; i>=MIN_TOKEN_INDEX && i<=end && i<tokens.size(); i++) { if ( get(i).getType()!=Token.EOF ) buf.append(get(i).getText()); } return buf.toString(); } @Override public String toString() { fill(); return toString(MIN_TOKEN_INDEX, size()-1); } public String toString(String programName) { fill(); return toString(programName, MIN_TOKEN_INDEX, size()-1); } @Override public String toString(int start, int end) { return toString(DEFAULT_PROGRAM_NAME, start, end); } public String toString(String programName, int start, int end) { List<RewriteOperation> rewrites = programs.get(programName); // ensure start/end are in range if ( end>tokens.size()-1 ) end = tokens.size()-1; if ( start<0 ) start = 0; if ( rewrites==null || rewrites.isEmpty() ) { return toOriginalString(start,end); // no instructions to execute } StringBuffer buf = new StringBuffer(); // First, optimize instruction stream Map<Integer, ? extends RewriteOperation> indexToOp = reduceToSingleOperationPerIndex(rewrites); // Walk buffer, executing instructions and emitting tokens int i = start; while ( i <= end && i < tokens.size() ) { RewriteOperation op = indexToOp.get(new Integer(i)); indexToOp.remove(new Integer(i)); // remove so any left have index size-1 Token t = tokens.get(i); if ( op==null ) { // no operation at that index, just dump token if ( t.getType()!=Token.EOF ) buf.append(t.getText()); i++; // move to next token } else { i = op.execute(buf); // execute operation and skip } } // include stuff after end if it's last index in buffer // So, if they did an insertAfter(lastValidIndex, "foo"), include // foo if end==lastValidIndex. if ( end==tokens.size()-1 ) { // Scan any remaining operations after last token // should be included (they will be inserts). Iterator<? extends RewriteOperation> it = indexToOp.values().iterator(); while (it.hasNext()) { RewriteOperation op = it.next(); if ( op.index >= tokens.size()-1 ) buf.append(op.text); } } return buf.toString(); } /** We need to combine operations and report invalid operations (like * overlapping replaces that are not completed nested). Inserts to * same index need to be combined etc... Here are the cases: * * I.i.u I.j.v leave alone, nonoverlapping * I.i.u I.i.v combine: Iivu * * R.i-j.u R.x-y.v | i-j in x-y delete first R * R.i-j.u R.i-j.v delete first R * R.i-j.u R.x-y.v | x-y in i-j ERROR * R.i-j.u R.x-y.v | boundaries overlap ERROR * * Delete special case of replace (text==null): * D.i-j.u D.x-y.v | boundaries overlap combine to max(min)..max(right) * * I.i.u R.x-y.v | i in (x+1)-y delete I (since insert before * we're not deleting i) * I.i.u R.x-y.v | i not in (x+1)-y leave alone, nonoverlapping * R.x-y.v I.i.u | i in x-y ERROR * R.x-y.v I.x.u R.x-y.uv (combine, delete I) * R.x-y.v I.i.u | i not in x-y leave alone, nonoverlapping * * I.i.u = insert u before op @ index i * R.x-y.u = replace x-y indexed tokens with u * * First we need to examine replaces. For any replace op: * * 1. wipe out any insertions before op within that range. * 2. Drop any replace op before that is contained completely within * that range. * 3. Throw exception upon boundary overlap with any previous replace. * * Then we can deal with inserts: * * 1. for any inserts to same index, combine even if not adjacent. * 2. for any prior replace with same left boundary, combine this * insert with replace and delete this replace. * 3. throw exception if index in same range as previous replace * * Don't actually delete; make op null in list. Easier to walk list. * Later we can throw as we add to index -> op map. * * Note that I.2 R.2-2 will wipe out I.2 even though, technically, the * inserted stuff would be before the replace range. But, if you * add tokens in front of a method body '{' and then delete the method * body, I think the stuff before the '{' you added should disappear too. * * Return a map from token index to operation. */ protected Map<Integer, ? extends RewriteOperation> reduceToSingleOperationPerIndex(List<? extends RewriteOperation> rewrites) { // System.out.println("rewrites="+rewrites); // WALK REPLACES for (int i = 0; i < rewrites.size(); i++) { RewriteOperation op = rewrites.get(i); if ( op==null ) continue; if ( !(op instanceof ReplaceOp) ) continue; ReplaceOp rop = (ReplaceOp)rewrites.get(i); // Wipe prior inserts within range List<? extends InsertBeforeOp> inserts = getKindOfOps(rewrites, InsertBeforeOp.class, i); for (int j = 0; j < inserts.size(); j++) { InsertBeforeOp iop = inserts.get(j); if ( iop.index == rop.index ) { // E.g., insert before 2, delete 2..2; update replace // text to include insert before, kill insert rewrites.set(iop.instructionIndex, null); rop.text = iop.text.toString() + (rop.text!=null?rop.text.toString():""); } else if ( iop.index > rop.index && iop.index <= rop.lastIndex ) { // delete insert as it's a no-op. rewrites.set(iop.instructionIndex, null); } } // Drop any prior replaces contained within List<? extends ReplaceOp> prevReplaces = getKindOfOps(rewrites, ReplaceOp.class, i); for (int j = 0; j < prevReplaces.size(); j++) { ReplaceOp prevRop = prevReplaces.get(j); if ( prevRop.index>=rop.index && prevRop.lastIndex <= rop.lastIndex ) { // delete replace as it's a no-op. rewrites.set(prevRop.instructionIndex, null); continue; } // throw exception unless disjoint or identical boolean disjoint = prevRop.lastIndex<rop.index || prevRop.index > rop.lastIndex; boolean same = prevRop.index==rop.index && prevRop.lastIndex==rop.lastIndex; // Delete special case of replace (text==null): // D.i-j.u D.x-y.v | boundaries overlap combine to max(min)..max(right) if ( prevRop.text==null && rop.text==null && !disjoint ) { //System.out.println("overlapping deletes: "+prevRop+", "+rop); rewrites.set(prevRop.instructionIndex, null); // kill first delete rop.index = Math.min(prevRop.index, rop.index); rop.lastIndex = Math.max(prevRop.lastIndex, rop.lastIndex); System.out.println("new rop "+rop); } else if ( !disjoint && !same ) { throw new IllegalArgumentException("replace op boundaries of "+rop+ " overlap with previous "+prevRop); } } } // WALK INSERTS for (int i = 0; i < rewrites.size(); i++) { RewriteOperation op = rewrites.get(i); if ( op==null ) continue; if ( !(op instanceof InsertBeforeOp) ) continue; InsertBeforeOp iop = (InsertBeforeOp)rewrites.get(i); // combine current insert with prior if any at same index List<? extends InsertBeforeOp> prevInserts = getKindOfOps(rewrites, InsertBeforeOp.class, i); for (int j = 0; j < prevInserts.size(); j++) { InsertBeforeOp prevIop = prevInserts.get(j); if ( prevIop.index == iop.index ) { // combine objects // convert to strings...we're in process of toString'ing // whole token buffer so no lazy eval issue with any templates iop.text = catOpText(iop.text,prevIop.text); // delete redundant prior insert rewrites.set(prevIop.instructionIndex, null); } } // look for replaces where iop.index is in range; error List<? extends ReplaceOp> prevReplaces = getKindOfOps(rewrites, ReplaceOp.class, i); for (int j = 0; j < prevReplaces.size(); j++) { ReplaceOp rop = prevReplaces.get(j); if ( iop.index == rop.index ) { rop.text = catOpText(iop.text,rop.text); rewrites.set(i, null); // delete current insert continue; } if ( iop.index >= rop.index && iop.index <= rop.lastIndex ) { throw new IllegalArgumentException("insert op "+iop+ " within boundaries of previous "+rop); } } } // System.out.println("rewrites after="+rewrites); Map<Integer, RewriteOperation> m = new HashMap<Integer, RewriteOperation>(); for (int i = 0; i < rewrites.size(); i++) { RewriteOperation op = rewrites.get(i); if ( op==null ) continue; // ignore deleted ops if ( m.get(new Integer(op.index))!=null ) { throw new Error("should only be one op per index"); } m.put(new Integer(op.index), op); } //System.out.println("index to op: "+m); return m; } protected String catOpText(Object a, Object b) { String x = ""; String y = ""; if ( a!=null ) x = a.toString(); if ( b!=null ) y = b.toString(); return x+y; } protected <T extends RewriteOperation> List<? extends T> getKindOfOps(List<? extends RewriteOperation> rewrites, Class<T> kind) { return getKindOfOps(rewrites, kind, rewrites.size()); } /** Get all operations before an index of a particular kind */ protected <T extends RewriteOperation> List<? extends T> getKindOfOps(List<? extends RewriteOperation> rewrites, Class<T> kind, int before) { List<T> ops = new ArrayList<T>(); for (int i=0; i<before && i<rewrites.size(); i++) { RewriteOperation op = rewrites.get(i); if ( op==null ) continue; // ignore deleted if ( kind.isInstance(op) ) ops.add(kind.cast(op)); } return ops; } public String toDebugString() { return toDebugString(MIN_TOKEN_INDEX, size()-1); } public String toDebugString(int start, int end) { StringBuilder buf = new StringBuilder(); for (int i=start; i>=MIN_TOKEN_INDEX && i<=end && i<tokens.size(); i++) { buf.append(get(i)); } return buf.toString(); } }