blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
313
fd7ad0639c06856b5f84f65571d653df899318f0
237d4b0649c6ad2570ee59df538e6b88fddcfc32
/src/main/java/org/halvors/Game/Client/network/ClientHandler.java
0a6499da8ab2307200d205ddd4b1268b7ec6d923
[]
no_license
halvors/GameClient
30c5cabbe5c115330e00a7c8b983d0b522ac8b19
53e63622073b502aceb66f231553a7105ae83766
refs/heads/master
2020-05-05T07:02:22.007915
2012-05-01T02:58:59
2012-05-01T02:58:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,262
java
package org.halvors.Game.Client.network; import java.util.logging.Level; import org.halvors.Game.Client.Game; import org.halvors.Game.Client.gui.Chat; import org.halvors.Game.Client.network.packet.PacketChat; import org.halvors.Game.Client.network.packet.PacketDisconnect; import org.halvors.Game.Client.network.packet.PacketLogin; public class ClientHandler { private final Game client; private final NetworkManager networkManager; private Chat chat; public ClientHandler(Game client, NetworkManager networkManager) { this.client = client; this.networkManager = networkManager; } public void handlePacketLogin(PacketLogin packet) { chat = new Chat(client); client.log(Level.INFO, "Succesfully logged in."); } public void handlePacketChat(PacketChat packet) { String message = packet.getMessage(); chat.showMessage(message); client.log(Level.INFO, message); } public void handlePacketDisconnect(PacketDisconnect packet) { // try { // networkManager.shutdown(); // } catch (IOException e) { // e.printStackTrace(); // } client.log(Level.INFO, "Disconnected: " + packet.getReason()); } public NetworkManager getNetworkManager() { return networkManager; } }
[ "halvors@skymiastudios.com" ]
halvors@skymiastudios.com
f5370bdeb6a9a805ed24321dcd571e23a7356d90
bab312373c967caf5fe359b9c6a468bebf1f5d46
/canvas/src/main/java/gov/nasa/arc/mct/canvas/view/PanelInspector.java
770218e433c22572738830b6f38801717d4c05d8
[]
no_license
HugoGuarin/ochouno
15dd6f1feb04d28f298205e2ebb76c7a3be3c8e3
1ce702b45edf7554584fdc8efffa5a9a13a32807
refs/heads/master
2021-01-21T23:28:54.839678
2017-06-23T18:45:04
2017-06-23T18:45:04
95,246,195
0
0
null
null
null
null
UTF-8
Java
false
false
13,518
java
/******************************************************************************* * Mission Control Technologies, Copyright (c) 2009-2012, United States Government * as represented by the Administrator of the National Aeronautics and Space * Administration. All rights reserved. * * The MCT platform is 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. * * MCT includes source code licensed under additional open source licenses. See * the MCT Open Source Licenses file included with this distribution or the About * MCT Licenses dialog available at runtime from the MCT Help menu for additional * information. *******************************************************************************/ package gov.nasa.arc.mct.canvas.view; import gov.nasa.arc.mct.components.AbstractComponent; import gov.nasa.arc.mct.gui.SelectionProvider; import gov.nasa.arc.mct.gui.Twistie; import gov.nasa.arc.mct.gui.View; import gov.nasa.arc.mct.gui.ViewRoleSelection; import gov.nasa.arc.mct.services.component.ViewInfo; import gov.nasa.arc.mct.services.component.ViewType; import gov.nasa.arc.mct.util.LafColor; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.datatransfer.Transferable; import java.awt.event.ActionEvent; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionAdapter; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.util.Collection; import java.util.Set; import javax.swing.AbstractAction; import javax.swing.BorderFactory; import javax.swing.ButtonGroup; import javax.swing.ImageIcon; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JSplitPane; import javax.swing.JToggleButton; import javax.swing.ScrollPaneConstants; import javax.swing.TransferHandler; import javax.swing.event.AncestorEvent; import javax.swing.event.AncestorListener; @SuppressWarnings("serial") public class PanelInspector extends View { private static final Color BACKGROUND_COLOR = LafColor.WINDOW_BORDER.darker(); private static final Color FOREGROUND_COLOR = LafColor.WINDOW.brighter(); private static final ImageIcon BUTTON_ICON = new ImageIcon(PanelInspector.class.getResource("/images/infoViewButton-OFF.png")); private static final ImageIcon BUTTON_PRESSED_ICON = new ImageIcon(PanelInspector.class.getResource("/images/infoViewButton-ON.png")); private static final String PANEL_SPECIFIC = " (Panel-Specific)"; private static final String DASH = " - "; private final PropertyChangeListener selectionChangeListener = new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { @SuppressWarnings("unchecked") Collection<View> selectedViews = (Collection<View>) evt.getNewValue(); selectedManifestationChanged(selectedViews.isEmpty() || selectedViews.size() > 1 ? null : selectedViews.iterator().next()); } }; private JLabel viewTitle = new JLabel(); private JLabel space = new JLabel(" "); private JPanel emptyPanel = new JPanel(); private JComponent content; private View view; private JComponent viewControls; private JPanel titlebar = new JPanel(); private JPanel viewButtonBar = new JPanel(); private GridBagConstraints c = new GridBagConstraints(); private ControllerTwistie controllerTwistie; public PanelInspector(AbstractComponent ac, ViewInfo vi) { super(ac,vi); registerSelectionChange(); setLayout(new BorderLayout()); titlebar.setLayout(new GridBagLayout()); JLabel titleLabel = new JLabel("Panel Inspector: "); c.insets = new Insets(0, 0, 0, 0); c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.LINE_START; c.weightx = 0; c.gridwidth = 1; titlebar.add(titleLabel, c); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1; titlebar.add(viewTitle, c); c.fill = GridBagConstraints.NONE; c.weightx = 0; titlebar.add(space); titleLabel.setForeground(FOREGROUND_COLOR); viewTitle.setForeground(FOREGROUND_COLOR); viewTitle.addMouseMotionListener(new WidgetDragger()); titlebar.setBackground(BACKGROUND_COLOR); viewButtonBar.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0)); viewButtonBar.setBackground(BACKGROUND_COLOR); add(titlebar, BorderLayout.NORTH); add(emptyPanel, BorderLayout.CENTER); content = emptyPanel; setMinimumSize(new Dimension(0, 0)); } private ButtonGroup createViewSelectionButtons(AbstractComponent ac, ViewInfo selectedViewInfo) { ButtonGroup buttonGroup = new ButtonGroup(); final Set<ViewInfo> viewInfos = ac.getViewInfos(ViewType.EMBEDDED); for (ViewInfo vi : viewInfos) { ViewChoiceButton button = new ViewChoiceButton(vi); buttonGroup.add(button); viewButtonBar.add(button); if (vi.equals(selectedViewInfo)) buttonGroup.setSelected(button.getModel(), true); } return buttonGroup; } private void selectedManifestationChanged(View view) { remove(content); if (view == null) { viewTitle.setIcon(null); viewTitle.setText(""); viewTitle.setTransferHandler(null); content = emptyPanel; } else { viewTitle.setIcon(view.getManifestedComponent().getIcon()); viewTitle.setText(view.getManifestedComponent().getDisplayName() + DASH + view.getInfo().getViewName() + PANEL_SPECIFIC); viewTitle.setTransferHandler(new WidgetTransferHandler()); content = this.view = view.getInfo().createView(view.getManifestedComponent()); JComponent viewControls = getViewControls(); if (viewControls != null) { c.weightx = 0; controllerTwistie = new ControllerTwistie(); titlebar.add(controllerTwistie, c); } createViewSelectionButtons(view.getManifestedComponent(), view.getInfo()); c.anchor = GridBagConstraints.LINE_END; c.gridwidth = GridBagConstraints.REMAINDER; c.weightx = 0; titlebar.add(viewButtonBar, c); } Dimension preferredSize = content.getPreferredSize(); JScrollPane jp = new JScrollPane(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); preferredSize.height += jp.getHorizontalScrollBar().getPreferredSize().height; JScrollPane inspectorScrollPane = new JScrollPane(content, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); content = inspectorScrollPane; add(inspectorScrollPane, BorderLayout.CENTER); revalidate(); } private void registerSelectionChange() { // Register when the panel inspector is added to the window. addAncestorListener(new AncestorListener() { SelectionProvider selectionProvider; @Override public void ancestorAdded(AncestorEvent event) { selectionProvider = (SelectionProvider) event.getAncestorParent(); selectionProvider.addSelectionChangeListener(selectionChangeListener); } @Override public void ancestorMoved(AncestorEvent event) { } @Override public void ancestorRemoved(AncestorEvent event) { if (selectionProvider != null) { selectionProvider.removeSelectionChangeListener(selectionChangeListener); } } }); } private void showOrHideController(boolean toShow) { remove(content); JScrollPane scrollPane = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPane.setViewportView(view); if (toShow) { JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, getViewControls(), scrollPane); splitPane.setResizeWeight(.66); splitPane.setOneTouchExpandable(true); splitPane.setContinuousLayout(true); splitPane.setBorder(null); content = splitPane; // Overwrite lock state for the panel-specific view if (isLocked) view.exitLockedState(); else view.enterLockedState(); } else { content = scrollPane; } add(content, BorderLayout.CENTER); revalidate(); } protected JComponent getViewControls() { assert view != null; if (viewControls == null) viewControls = view.getControlManifestation(); return viewControls; } @Override public SelectionProvider getSelectionProvider() { return super.getSelectionProvider(); } private boolean isLocked = false; @Override public void enterLockedState() { isLocked = false; super.enterLockedState(); view.enterLockedState(); } @Override public void exitLockedState() { isLocked = true; super.exitLockedState(); if (view != null) view.exitLockedState(); } private static final class WidgetDragger extends MouseMotionAdapter { @Override public void mouseDragged(MouseEvent e) { JComponent c = (JComponent) e.getSource(); TransferHandler th = c.getTransferHandler(); th.exportAsDrag(c, e, TransferHandler.COPY); } } private final class WidgetTransferHandler extends TransferHandler { @Override public int getSourceActions(JComponent c) { return COPY; } @Override protected Transferable createTransferable(JComponent c) { if (view != null) { return new ViewRoleSelection(new View[] { view}); } else { return null; } } } private final class ViewChoiceButton extends JToggleButton { private static final String SWITCH_TO = "Switch to "; public ViewChoiceButton(final ViewInfo viewInfo) { setBorder(BorderFactory.createEmptyBorder()); setAction(new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { PanelInspector.this.remove(content); content = view = viewInfo.createView(view.getManifestedComponent()); Dimension preferredSize = content.getPreferredSize(); JScrollPane jp = new JScrollPane(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); preferredSize.height += jp.getHorizontalScrollBar().getPreferredSize().height; JScrollPane inspectorScrollPane = new JScrollPane(content, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); PanelInspector.this.add(inspectorScrollPane, BorderLayout.CENTER); PanelInspector.this.revalidate(); content = inspectorScrollPane; viewTitle.setText(view.getManifestedComponent().getDisplayName() + DASH + view.getInfo().getViewName() + PANEL_SPECIFIC); viewControls = null; if (controllerTwistie != null) controllerTwistie.changeState(false); } }); setIcon(viewInfo.getIcon() == null ? BUTTON_ICON : viewInfo.getIcon()); setPressedIcon(viewInfo.getIcon() == null ? BUTTON_ICON : viewInfo.getIcon()); setSelectedIcon(viewInfo.getSelectedIcon() == null ? BUTTON_PRESSED_ICON : viewInfo.getSelectedIcon()); setToolTipText(SWITCH_TO + viewInfo.getViewName() + PANEL_SPECIFIC); } } private final class ControllerTwistie extends Twistie { public ControllerTwistie() { super(); } @Override protected void changeStateAction(boolean state) { showOrHideController(state); } } }
[ "ricardo910821@gmail.com" ]
ricardo910821@gmail.com
6b43eaedfb9fbebd7b0686404ea9b78848e9145a
67a0f06b6dae373becec91ddccf7d53a521e076b
/src/main/java/com/geolocation/java/GeoIPTestController.java
8f45a30352e6dba5abc1f5f165302d0220e794af
[]
no_license
abhinaw27392/GeolocationByPublicIP
fad8df63577bfc5962a45c545c34733510e69874
29249317d61b5025969362f92128ddaef6f15f5e
refs/heads/master
2023-05-26T03:35:43.717016
2021-06-15T17:14:14
2021-06-15T17:14:14
377,232,191
0
0
null
null
null
null
UTF-8
Java
false
false
579
java
package com.geolocation.java; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; @RestController public class GeoIPTestController { private RawDBDemoGeoIPLocationService locationService; @PostMapping("/GeoIPTest") public GeoIP getLocation(@RequestParam(value = "ipAddress", required = true) String ipAddress) throws Exception { locationService = new RawDBDemoGeoIPLocationService(); return locationService.getLocation(ipAddress); } }
[ "abhinaw27392@gmail.com" ]
abhinaw27392@gmail.com
ea1099aa577bd0c29131ef2a2125a1ab911d2dc4
a0506c8e12e7c6c2ad9f9ef3db61ff77edb42d20
/Information-other-communication/src/main/java/com/lanjiu/im/communication/server/service/RegisteredGroupMemberUpdateRemarkService.java
3652905b789ed26c4e05c7a378dce95740a77f91
[]
no_license
zhangtao007/janissary
f3455431c672778c035ffc69e4726f10a32b2cd1
36f20de81e04140173209ae91a082bfdbc5abb34
refs/heads/master
2023-04-14T03:06:21.200752
2021-04-26T01:18:06
2021-04-26T01:18:06
352,592,849
0
0
null
null
null
null
UTF-8
Java
false
false
5,226
java
package com.lanjiu.im.communication.server.service; import com.lanjiu.im.communication.server.ResponseUtil; import com.lanjiu.im.communication.util.JCRC32; import com.lanjiu.im.communication.util.ResponseStatus; import com.lanjiu.im.grpc.*; import com.lanjiu.im.grpc.client.service.StorageAPI; import com.lanjiu.pro.business.BusinessProtocolEntities; import com.lanjiu.pro.business.BusinessProtocolMessageStandard; import com.lanjiu.pro.business.BusinessProtocolMessages; import io.netty.channel.ChannelHandlerContext; import java.sql.Timestamp; import java.time.LocalDateTime; import java.util.List; public class RegisteredGroupMemberUpdateRemarkService { public BusinessProtocolMessageStandard.CheckUnifiedEntranceMessage updateRegisteredGroupMemberRemark(BusinessProtocolMessageStandard.UnifiedEntranceMessage unifiedEntranceMessage, ChannelHandlerContext ctx) { //还需以被添加人的角色检索记录 JCRC32 jcrc32 = new JCRC32(); StorageAPI storageAPI = new StorageAPI(); BusinessProtocolMessageStandard.Head head = unifiedEntranceMessage.getHead(); BusinessProtocolEntities.RegisteredGroupMember groupMember = unifiedEntranceMessage.getGroupMemberSettingsProtocol().getRegisteredGroupMember(); BusinessProtocolEntities.RegisteredUser registeredUser = unifiedEntranceMessage.getGroupMemberSettingsProtocol().getRegisteredUser(); BusinessProtocolMessageStandard.CheckUnifiedEntranceMessage response ; TransmissionRequest transmissionRequest = TransmissionRequest.newBuilder() .setRegisteredGroupMember(RpcRegisteredGroupMember.newBuilder() .setRegisteredUserId(Integer.parseInt(groupMember.getGroupMemberUserId()))//被修改人ID .setGroupMemberId(Integer.parseInt(groupMember.getGroupMemberId()))//修改人成员ID .setGroupId(Integer.parseInt(groupMember.getGroup().getGroupId()))//群ID .setGroupRemarks(groupMember.getGroupMemberAlias())//成员备注 .build()) .setRegisteredUserFriend(RpcRegisteredUserFriend.newBuilder() .setRegisteredUserId(Integer.parseInt(registeredUser.getUserId()))//修改人ID .build()) .build(); RegisteredGroupMemberResponse registeredGroupMemberResponse = storageAPI.updateRegisteredGroupMemberRemark(transmissionRequest); List<RpcRegisteredGroupMember> responseDataList = registeredGroupMemberResponse.getResponseDataList(); if(null != responseDataList && responseDataList.size()>0){ BusinessProtocolMessages.GroupMemberSettingsProtocol groupMemberSettingsProtocol = BusinessProtocolMessages.GroupMemberSettingsProtocol.newBuilder() .setRegisteredGroupMember(BusinessProtocolEntities.RegisteredGroupMember.newBuilder() .setGroupMemberUserId(String.valueOf(responseDataList.get(0).getRegisteredUserId())) .setGroupMemberAlias(responseDataList.get(0).getGroupRemarks()) .setGroup(BusinessProtocolEntities.RegisteredGroup.newBuilder(). setGroupId(String.valueOf(responseDataList.get(0).getGroupId()))) .build()) .setUserType(unifiedEntranceMessage.getGroupMemberSettingsProtocol().getUserType()) .setRegisteredUser(unifiedEntranceMessage.getGroupMemberSettingsProtocol().getRegisteredUser()) .setOperation(unifiedEntranceMessage.getGroupMemberSettingsProtocol().getOperation()) .setStatusDetail(ResponseStatus.STATUS_REPORT_SUCCESS) .build(); BusinessProtocolMessageStandard.UnifiedEntranceMessage message = BusinessProtocolMessageStandard.UnifiedEntranceMessage .newBuilder() .setDataType(BusinessProtocolMessageStandard.UnifiedEntranceMessage.DataType.GroupMemberSettingsProtocol) .setGroupMemberSettingsProtocol(groupMemberSettingsProtocol) .setHead(BusinessProtocolMessageStandard.Head.newBuilder() .setMsgType(head.getMsgType()) .setStatusReport(ResponseStatus.STATUS_REPORT_SUCCESS) .setToId(head.getToId()) .setFromId(head.getFromId()) .setTimestamp(Timestamp.valueOf(LocalDateTime.now().withNano(0)).getTime()) .setToken(head.getToken()) .setUniqueIdentify(head.getUniqueIdentify()) .setMsgContentType(head.getMsgContentType()) .build() ).build(); response = jcrc32.packageCheckSum(message); return response; }else { ResponseUtil responseUtil = new ResponseUtil(); response = responseUtil.requestWithResponseFail(unifiedEntranceMessage); } return response; } }
[ "zha_gtao@126.com" ]
zha_gtao@126.com
113f1ea2292111d3a22f36c9116f2aa07e5ef96a
82bbe3c7f7dc164ddbc14db49075c2ddeeab036b
/FindKthToTail1.java
3347c351aa5cf5eeb091613f34f9c2c04cc45d21
[]
no_license
zqq234/test
6515ede7aaf2f538a88b7da39103573ab31496e5
2150b38e9f2739b252a40210a2d6f4453600866c
refs/heads/master
2022-06-25T17:49:22.953327
2020-09-19T12:26:39
2020-09-19T12:26:39
217,680,002
2
1
null
2022-06-21T03:14:59
2019-10-26T08:36:34
JavaScript
UTF-8
Java
false
false
572
java
/* public class ListNode { int val; ListNode next = null; ListNode(int val) { this.val = val; } }*/ public class FindKthToTail{ public ListNode FindKthToTail(ListNode head,int k) { if(head==null) return null; ListNode slow=head; ListNode fast=head; while(k!=1){ fast=fast.next; if(fast==null) return null; k--; } while(fast.next!=null){ slow=slow.next; fast=fast.next; } return slow; } }
[ "1544839503@qq.com" ]
1544839503@qq.com
cc98c2ed10930dee70d9b026a47c7d3da4501c4b
ad974a95b2f3501a739658cd7d3b2f10c1196727
/names/src/main/java/com/example/HourMessage.java
573e1fb28e263740a028a134326d080a4120bbd0
[]
no_license
mike-neck/spring-amqp-confirms-returns
c4d4b90f330af98acf4667dd656707e5f71c5ccd
8655af8539987b5a00e48294b236d3116e287b7d
refs/heads/master
2021-05-13T16:38:06.928545
2018-01-10T02:44:21
2018-01-10T02:44:21
116,795,958
0
0
null
null
null
null
UTF-8
Java
false
false
375
java
package com.example; import java.io.Serializable; import lombok.Data; import lombok.RequiredArgsConstructor; @Data @RequiredArgsConstructor @SuppressWarnings("WeakerAccess") public class HourMessage implements Serializable { private static final long serialVersionUID = -5760158911739920821L; private final int hour; private final TextMessage textMessage; }
[ "shinya.mochida@l-is-b.com" ]
shinya.mochida@l-is-b.com
09d50466795cd8c00e5c3edb6d34606db8cbec23
1887904c6f7aac86543693a71e81c3c7f38a85a8
/creational/factory/ShapeFactory.java
5c036eb0ed1999554dc0ed6cfdc148d2286f0525
[]
no_license
durgesh8/design-patterns
a107b3318ab74611a60f31488f645777d5d3b816
c3d51388b3142f97b03f849eae6a7b6029327854
refs/heads/master
2020-06-27T22:54:49.288994
2019-08-01T15:26:12
2019-08-01T15:26:12
200,074,940
0
0
null
null
null
null
UTF-8
Java
false
false
553
java
package creational.factory; /** * Concrete Product */ public abstract class ShapeFactory { @SuppressWarnings("incomplete-switch") public static GeometricShape getShape(ShapeType name) { GeometricShape shape = null; switch (name) { case LINE: shape = new Line(); break; case CIRCLE: shape = new Circle(); break; case RECTANGLE: shape = new Rectangle(); break; } return shape; } }
[ "durgesh.singh@tavant.com" ]
durgesh.singh@tavant.com
ec0d3b2ae548a6627c9f06b2b1bb54d19bc823b0
bdd20079bb2fca92fbc7219ca012fb8aefd79c28
/library-service/src/main/java/com/va/model/BookDTO.java
66a9a8b92ef5a0c9edf004d73f80b14bbee7b170
[]
no_license
pin2venky/springboot-microservices
b44f8bae7cf01ca5b999b28c07908cd3d2c69fc9
b1f2a131c330003f49b65e2ad6ac6e0ee5fe4461
refs/heads/main
2023-06-05T02:05:16.043797
2021-06-24T15:53:35
2021-06-24T15:53:35
377,260,220
0
0
null
2021-06-24T17:34:55
2021-06-15T18:32:35
Java
UTF-8
Java
false
false
262
java
package com.va.model; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @Data @NoArgsConstructor @AllArgsConstructor public class BookDTO { Long bookId; String title; String author; Integer publishedYear; }
[ "venky.pin2@gmail.com" ]
venky.pin2@gmail.com
5c1d180c5deb1f77a4a118760033a0e9da2ea3af
fadb7be3139596273f8741f895508e16cbbac2d4
/src/repline_tasks/verify_contains.java
a15f249b950d84047f30f9f8fab244f1fdd784ea
[]
no_license
Abasiyanik/SummerCamp
4b728f419864c9d0ed454f4cf0acf48c4097e30e
ff08719839b0fe59c236d4fa4672dbecf10c4a0e
refs/heads/master
2023-02-08T17:33:47.593143
2020-10-03T23:39:36
2020-10-03T23:39:36
285,593,430
0
0
null
null
null
null
UTF-8
Java
false
false
460
java
package repline_tasks; import java.util.Scanner; /* Write a program that will verify if word contains in the sentence. Print out the result as boolean value. */ public class verify_contains { public static void main(String[] args) { Scanner scan =new Scanner(System.in); String word = scan.nextLine(); String sentence = scan.nextLine(); boolean verfy=sentence.contains(word); System.out.println(verfy); } }
[ "abasiyanik@gmail.com" ]
abasiyanik@gmail.com
bbe1c71ddfda22aa704ab67f7a0375c91ec14ee6
4aa90348abcb2119011728dc067afd501f275374
/app/src/main/java/com/tencent/mm/ac/b.java
633a3438e16c8c8b1d6633c12de418bb1f77da06
[]
no_license
jambestwick/HackWechat
0d4ceb2d79ccddb45004ca667e9a6a984a80f0f6
6a34899c8bfd50d19e5a5ec36a58218598172a6b
refs/heads/master
2022-01-27T12:48:43.446804
2021-12-29T10:36:30
2021-12-29T10:36:30
249,366,791
0
0
null
2020-03-23T07:48:32
2020-03-23T07:48:32
null
UTF-8
Java
false
false
1,680
java
package com.tencent.mm.ac; import com.samsung.android.sdk.look.airbutton.SlookAirButtonRecentMediaAdapter; import com.tencent.mm.g.a.s; import com.tencent.mm.sdk.b.a; import com.tencent.mm.sdk.platformtools.ab; import com.tencent.mm.sdk.platformtools.x; public final class b { public static String Jx() { return new StringBuilder(SlookAirButtonRecentMediaAdapter.AUDIO_TYPE).append(ab.UZ(System.nanoTime())).toString(); } public static boolean a(String str, a aVar) { x.i("MicroMsg.AudioPlayerHelper", "resumeAudio, audioId:%s", new Object[]{str}); com.tencent.mm.sdk.b.b sVar = new s(); sVar.fnD.action = 1; sVar.fnD.fnF = str; sVar.fnD.fnH = aVar; a.xef.m(sVar); return sVar.fnE.fnI; } public static boolean iK(String str) { x.i("MicroMsg.AudioPlayerHelper", "pauseAudio, audioId:%s", new Object[]{str}); com.tencent.mm.sdk.b.b sVar = new s(); sVar.fnD.action = 2; sVar.fnD.fnF = str; a.xef.m(sVar); return sVar.fnE.fnI; } public static boolean iL(String str) { com.tencent.mm.sdk.b.b sVar = new s(); sVar.fnD.action = 7; sVar.fnD.fnF = str; a.xef.m(sVar); return sVar.fnE.fnI; } public static boolean iM(String str) { com.tencent.mm.sdk.b.b sVar = new s(); sVar.fnD.action = 8; sVar.fnD.fnF = str; a.xef.m(sVar); return sVar.fnE.fnI; } public static a iN(String str) { com.tencent.mm.sdk.b.b sVar = new s(); sVar.fnD.action = 16; sVar.fnD.fnF = str; a.xef.m(sVar); return sVar.fnD.fnH; } }
[ "malin.myemail@163.com" ]
malin.myemail@163.com
b1de271eda8af0cca7394b6d71e03cf0a98572e0
93f46991c2b4d80af57efedaeac066bd9ce736ae
/src/main/java/nl/ordina/bag/etl/loader/ExtractLoaderMT.java
7366fdddc9d95c4c347479368d4156af45ac9b93
[ "Apache-2.0" ]
permissive
eluinstra/bag-etl
63f96e54e3cb4371710483a2a46163806862fc47
60124aee9a96065f51463d0c5fac81727298b11f
refs/heads/master
2020-05-31T11:18:49.443136
2015-10-10T13:02:26
2015-10-10T13:02:26
13,243,434
0
0
null
null
null
null
UTF-8
Java
false
false
11,229
java
/** * Copyright 2013 Ordina * * 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 nl.ordina.bag.etl.loader; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.util.Map; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.ExecutorService; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import nl.kadaster.schemas.bag_verstrekkingen.extract_levering.v20090901.BAGExtractLevering; import nl.kadaster.schemas.imbag.lvc.v20090901.Ligplaats; import nl.kadaster.schemas.imbag.lvc.v20090901.Nummeraanduiding; import nl.kadaster.schemas.imbag.lvc.v20090901.OpenbareRuimte; import nl.kadaster.schemas.imbag.lvc.v20090901.Pand; import nl.kadaster.schemas.imbag.lvc.v20090901.Standplaats; import nl.kadaster.schemas.imbag.lvc.v20090901.Verblijfsobject; import nl.kadaster.schemas.imbag.lvc.v20090901.Woonplaats; import nl.ordina.bag.etl.Constants.BAGObjectType; import nl.ordina.bag.etl.dao.BAGDAO; import nl.ordina.bag.etl.dao.DAOException; import nl.ordina.bag.etl.model.BAGObjectFactory; import nl.ordina.bag.etl.processor.ProcessingException; import nl.ordina.bag.etl.processor.ProcessorException; import nl.ordina.bag.etl.util.BeanLocator; import nl.ordina.bag.etl.util.ZipStreamReader; import nl.ordina.bag.etl.validation.BAGExtractLeveringValidator; import nl.ordina.bag.etl.xml.BAGGeometrieHandler; import nl.ordina.bag.etl.xml.ExtractParser; import nl.ordina.bag.etl.xml.SimpleExtractParser; import nl.ordina.bag.etl.xml.HandlerException; import nl.ordina.bag.etl.xml.ParserException; public class ExtractLoaderMT extends ExtractLoader { public class ExceptionListener { private Exception exception; public boolean exception() { return exception != null; } public void onException(Exception exception) { synchronized (this) { if (this.exception == null) this.exception = exception; } } public Exception getException() { return exception; } } protected ExceptionListener exceptionListener = new ExceptionListener(); protected ExecutorService executorService; protected Integer maxThreads; protected Integer processorsScaleFactor; protected Integer queueScaleFactor; public void init() { if (maxThreads == null || maxThreads <= 0) { maxThreads = Runtime.getRuntime().availableProcessors() * processorsScaleFactor; logger.info("Using " + maxThreads + " threads"); } if (processorsScaleFactor == null || processorsScaleFactor <= 0) { processorsScaleFactor = 1; logger.info("Using processors scale factor " + processorsScaleFactor); } if (queueScaleFactor == null || queueScaleFactor <= 0) { queueScaleFactor = 1; logger.info("Using queue scale factor " + queueScaleFactor); } } protected void processBAGExtractFile(BAGExtractLevering levering, ZipFile zipFile) throws ProcessorException { //final Map<String,String> files = getFiles(levering); final Map<String,String> files = getFiles(zipFile); BAGObjectType[] objectTypes = new BAGObjectType[]{BAGObjectType.WOONPLAATS,BAGObjectType.OPENBARE_RUIMTE,BAGObjectType.NUMMERAANDUIDING,BAGObjectType.PAND,BAGObjectType.VERBLIJFSOBJECT,BAGObjectType.LIGPLAATS,BAGObjectType.STANDPLAATS}; for (final BAGObjectType objectType : objectTypes) { //executorService = Executors.newFixedThreadPool(maxThreads); executorService = new ThreadPoolExecutor(maxThreads - 1,maxThreads - 1,1,TimeUnit.MINUTES,new ArrayBlockingQueue<Runnable>(maxThreads * queueScaleFactor,true),new ThreadPoolExecutor.CallerRunsPolicy()); try { String filename = files.get(objectType.getCode()); ZipEntry entry = zipFile.getEntry(filename); ZipStreamReader zipStreamReader = new ZipStreamReader() { @Override public void handle(String filename, InputStream stream) throws IOException { if (filename.matches("\\d{4}(WPL|OPR|NUM|PND|VBO|LIG|STA)\\d{8}-\\d{6}\\.xml")) { logger.info("Processing file " + filename + " started"); processXML(stream); logger.info("Processing file " + filename + " finished"); } else logger.info("Skipping file " + filename); } }; logger.info("Processing file " + filename + " started"); zipStreamReader.read(zipFile.getInputStream(entry)); logger.info("Processing file " + filename + " finished"); try { executorService.shutdown(); executorService.awaitTermination(Long.MAX_VALUE,TimeUnit.DAYS); } catch (InterruptedException e) { logger.trace("",e); } } catch (ParserException | DAOException | IOException e) { try { executorService.shutdownNow(); executorService.awaitTermination(Long.MAX_VALUE,TimeUnit.DAYS); } catch (InterruptedException ignore) { logger.trace("",ignore); } throw new ProcessingException(e); } } } protected void processXML(InputStream stream) { ExtractParser reader = new SimpleExtractParser() { @Override public void handle(final Woonplaats woonplaats) throws HandlerException { if (exceptionListener.exception()) throw new HandlerException(exceptionListener.getException()); executorService.execute( new Runnable() { @Override public void run() { try { logger.debug("Inserting woonplaats " + woonplaats.getIdentificatie()); bagDAO.insert(bagObjectFactory.getWoonplaats(woonplaats)); } catch (Exception e) { exceptionListener.onException(e); } } } ); } @Override public void handle(final OpenbareRuimte openbareRuimte) throws HandlerException { if (exceptionListener.exception()) throw new HandlerException(exceptionListener.getException()); executorService.execute( new Runnable() { @Override public void run() { try { logger.debug("Inserting openbare ruimte " + openbareRuimte.getIdentificatie()); bagDAO.insert(bagObjectFactory.getOpenbareRuimte(openbareRuimte)); } catch (Exception e) { exceptionListener.onException(e); } } } ); } @Override public void handle(final Nummeraanduiding nummeraanduiding) throws HandlerException { if (exceptionListener.exception()) throw new HandlerException(exceptionListener.getException()); executorService.execute( new Runnable() { @Override public void run() { try { logger.debug("Inserting nummeraanduiding " + nummeraanduiding.getIdentificatie()); bagDAO.insert(bagObjectFactory.getNummeraanduiding(nummeraanduiding)); } catch (Exception e) { exceptionListener.onException(e); } } } ); } @Override public void handle(final Pand pand) throws HandlerException { if (exceptionListener.exception()) throw new HandlerException(exceptionListener.getException()); executorService.execute( new Runnable() { @Override public void run() { try { logger.debug("Inserting pand " + pand.getIdentificatie()); bagDAO.insert(bagObjectFactory.getPand(pand)); } catch (Exception e) { exceptionListener.onException(e); } } } ); } @Override public void handle(final Verblijfsobject verblijfsobject) throws HandlerException { if (exceptionListener.exception()) throw new HandlerException(exceptionListener.getException()); executorService.execute( new Runnable() { @Override public void run() { try { logger.debug("Inserting verblijfsobject " + verblijfsobject.getIdentificatie()); bagDAO.insert(bagObjectFactory.getVerblijfsobject(verblijfsobject)); } catch (Exception e) { exceptionListener.onException(e); } } } ); } @Override public void handle(final Ligplaats ligplaats) throws HandlerException { if (exceptionListener.exception()) throw new HandlerException(exceptionListener.getException()); executorService.execute( new Runnable() { @Override public void run() { try { logger.debug("Inserting ligplaats " + ligplaats.getIdentificatie()); bagDAO.insert(bagObjectFactory.getLigplaats(ligplaats)); } catch (Exception e) { exceptionListener.onException(e); } } } ); } @Override public void handle(final Standplaats standplaats) throws HandlerException { if (exceptionListener.exception()) throw new HandlerException(exceptionListener.getException()); executorService.execute( new Runnable() { @Override public void run() { try { logger.debug("Inserting standplaats " + standplaats.getIdentificatie()); bagDAO.insert(bagObjectFactory.getStandplaats(standplaats)); } catch (Exception e) { exceptionListener.onException(e); } } } ); } }; reader.parse(stream); } public void setMaxThreads(int maxThreads) { this.maxThreads = maxThreads; } public void setProcessorsScaleFactor(Integer processorsScaleFactor) { this.processorsScaleFactor = processorsScaleFactor; } public void setQueueScaleFactor(Integer queueScaleFactor) { this.queueScaleFactor = queueScaleFactor; } public static void main(String[] args) throws Exception { BeanLocator beanLocator = BeanLocator.getInstance("nl/ordina/bag/etl/applicationConfig.xml","nl/ordina/bag/etl/datasource.xml","nl/ordina/bag/etl/dao.xml"); ExtractLoaderMT loader = new ExtractLoaderMT(); loader.setMaxThreads(8); loader.setBagDAO((BAGDAO)beanLocator.get("bagDAO")); loader.setBagObjectFactory(new BAGObjectFactory(new BAGGeometrieHandler())); loader.setBagExtractLeveringValidator(new BAGExtractLeveringValidator("9990000000","DNLDLXEE02","NEDERLAND","LEVENSCYCLUS","XML","EENMALIG_EXTRACT","02")); loader.execute(new File("i:/BAGExtract/DNLDLXEE02-9990000000-999000006-01042011.zip")); System.exit(0); } }
[ "edwin.luinstra@clockwork.nl" ]
edwin.luinstra@clockwork.nl
ce2ac59a01f3f2bfcb554a6eb69ba504b27e783d
0a76a5ba3f49934a0a0678a8eadb9624faaaf8f1
/src/java/DAO/ProyectoDAO.java
9d7cfb364f1e58bdd7441555a808bbecdcccca95
[]
no_license
giampieer/isagen_jsp
ad5b964ac4975eed557ac560a817b26fdee7adf1
235dc0796c719e40a1f7a403fce89e22451faf65
refs/heads/master
2020-03-21T10:37:44.393359
2018-01-02T01:54:21
2018-01-02T01:54:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
11,839
java
package DAO; import BEAN.ProyectoBean; import UTIL.ConexionBD; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.ArrayList; public class ProyectoDAO { Connection cn=null; ProyectoBean objbean=null; ArrayList lista=null; PreparedStatement pt =null; ResultSet rs=null; //combobox para requisito public ArrayList<ProyectoBean> ProyectodeRequisito(){ try { ConexionBD objc=new ConexionBD(); cn=objc.getConexionBD(); pt=cn.prepareStatement("select * from proy pr left join requisito r on pr.numero=r.numproy where r.numproy is null"); rs=pt.executeQuery(); lista=new ArrayList<ProyectoBean>(); while(rs.next()){ objbean=new ProyectoBean(); objbean.setNumero(rs.getInt(1)); objbean.setTitulo(rs.getString(2)); objbean.setDuracion(rs.getString(3)); objbean.setDescripcion(rs.getString(4)); objbean.setTipo(rs.getString(5)); objbean.setFases(rs.getString(6)); objbean.setInicio(rs.getString(7)); objbean.setFin(rs.getString(8)); objbean.setGastos(rs.getString(9)); lista.add(objbean); } rs.close(); pt.close(); cn.close(); } catch (Exception e) { } return lista; } public ArrayList<ProyectoBean> ProyectodeProblema(){ try { ConexionBD objc=new ConexionBD(); cn=objc.getConexionBD(); pt=cn.prepareStatement("select * from proy pr left join problema p on pr.numero=p.numproy where p.numproy is null"); rs=pt.executeQuery(); lista=new ArrayList<ProyectoBean>(); while(rs.next()){ objbean=new ProyectoBean(); objbean.setNumero(rs.getInt(1)); objbean.setTitulo(rs.getString(2)); objbean.setDuracion(rs.getString(3)); objbean.setDescripcion(rs.getString(4)); objbean.setTipo(rs.getString(5)); objbean.setFases(rs.getString(6)); objbean.setInicio(rs.getString(7)); objbean.setFin(rs.getString(8)); objbean.setGastos(rs.getString(9)); lista.add(objbean); } rs.close(); pt.close(); cn.close(); } catch (Exception e) { } return lista; } public ArrayList<ProyectoBean> ProyectodeObjetivo(){ try { ConexionBD objc=new ConexionBD(); cn=objc.getConexionBD(); pt=cn.prepareStatement("select * from proy pr left join objetivo o on pr.numero=o.numproy where o.numproy is null"); rs=pt.executeQuery(); lista=new ArrayList<ProyectoBean>(); while(rs.next()){ objbean=new ProyectoBean(); objbean.setNumero(rs.getInt(1)); objbean.setTitulo(rs.getString(2)); objbean.setDuracion(rs.getString(3)); objbean.setDescripcion(rs.getString(4)); objbean.setTipo(rs.getString(5)); objbean.setFases(rs.getString(6)); objbean.setInicio(rs.getString(7)); objbean.setFin(rs.getString(8)); objbean.setGastos(rs.getString(9)); lista.add(objbean); } rs.close(); pt.close(); cn.close(); } catch (Exception e) { } return lista; } public ArrayList<ProyectoBean> cargartablaproyecto(){ try { ConexionBD objc=new ConexionBD(); cn=objc.getConexionBD(); pt=cn.prepareStatement("select p.numero,p.titulo,p.duracion,p.descripcion,p.tipo," + "p.fases,p.inicio,p.fin,p.gastos,j.nombjefe from proy p inner join jefe j on p.codjefe=j.codjefe"); rs=pt.executeQuery(); lista=new ArrayList<ProyectoBean>(); while(rs.next()){ objbean=new ProyectoBean(); objbean.setNumero(rs.getInt(1)); objbean.setTitulo(rs.getString(2)); objbean.setDuracion(rs.getString(3)); objbean.setDescripcion(rs.getString(4)); objbean.setTipo(rs.getString(5)); objbean.setFases(rs.getString(6)); objbean.setInicio(rs.getString(7)); objbean.setFin(rs.getString(8)); objbean.setGastos(rs.getString(9)); objbean.setNOMBJEFE(rs.getString(10)); lista.add(objbean); } rs.close(); pt.close(); cn.close(); } catch (Exception e) { } return lista; } public ArrayList<ProyectoBean> buscartablaproyecto1(ProyectoBean obj){ try { ConexionBD objc=new ConexionBD(); cn=objc.getConexionBD(); pt=cn.prepareStatement("select * from proy where titulo="+obj.getTitulo()); rs=pt.executeQuery(); lista=new ArrayList<ProyectoBean>(); while(rs.next()){ objbean=new ProyectoBean(); objbean.setNumero(rs.getInt(1)); objbean.setTitulo(rs.getString(2)); objbean.setDuracion(rs.getString(3)); objbean.setDescripcion(rs.getString(4)); objbean.setTipo(rs.getString(5)); objbean.setFases(rs.getString(6)); objbean.setInicio(rs.getString(7)); objbean.setFin(rs.getString(8)); objbean.setGastos(rs.getString(9)); objbean.setCODJEFE(rs.getInt(10)); lista.add(objbean); } rs.close(); pt.close(); cn.close(); } catch (Exception e) { } return lista; } public ArrayList<ProyectoBean> cargartablaproyecto1(){ try { ConexionBD objc=new ConexionBD(); cn=objc.getConexionBD(); pt=cn.prepareStatement("select p.numero,p.titulo,p.duracion,p.descripcion,p.tipo,p.fases,p.inicio,p.fin,p.gastos,p.codjefe from proy p inner join jefe j on p.codjefe=j.codjefe"); rs=pt.executeQuery(); lista=new ArrayList<ProyectoBean>(); while(rs.next()){ objbean=new ProyectoBean(); objbean.setNumero(rs.getInt(1)); objbean.setTitulo(rs.getString(2)); objbean.setDuracion(rs.getString(3)); objbean.setDescripcion(rs.getString(4)); objbean.setTipo(rs.getString(5)); objbean.setFases(rs.getString(6)); objbean.setInicio(rs.getString(7)); objbean.setFin(rs.getString(8)); objbean.setGastos(rs.getString(9)); objbean.setCODJEFE(rs.getInt(10)); lista.add(objbean); } rs.close(); pt.close(); cn.close(); } catch (Exception e) { } return lista; } public int eliminarproyecto(ProyectoBean objbean){ int i=0; try { cn=ConexionBD.getConexionBD(); pt=cn.prepareStatement("delete from proy where numero=?"); pt.setInt(1,objbean.getNumero()); i=pt.executeUpdate(); pt.close(); cn.close(); } catch (Exception e) { i=0; } return i; } public int grabarproyecto(ProyectoBean objbean){ int i=0; try { cn=ConexionBD.getConexionBD(); pt=cn.prepareStatement("insert into proy values (?,?,?,?,?,?,?,?,?,?)"); pt.setInt(1, objbean.getNumero()); pt.setString(2, objbean.getTitulo()); pt.setString(3, objbean.getDuracion()); pt.setString(4, objbean.getDescripcion()); pt.setString(5, objbean.getTipo()); pt.setString(6, objbean.getFases()); pt.setString(7, objbean.getInicio()); pt.setString(8, objbean.getFin()); pt.setString(9, objbean.getGastos()); pt.setInt(10,objbean.getCODJEFE()); i=pt.executeUpdate(); pt.close(); cn.close(); } catch (Exception e) { i=0; } return i; } public int modificarproyecto(ProyectoBean objbean){ int i=0; try { cn=ConexionBD.getConexionBD(); pt=cn.prepareStatement("update proy set titulo=? ,duracion=?, descripcion=?,tipo=?, fases=?, inicio=?, fin=? ,gastos=?,codjefe=? where numero=?;"); pt.setString(1,objbean.getTitulo()); pt.setString(2, objbean.getDuracion()); pt.setString(3, objbean.getDescripcion()); pt.setString(4, objbean.getTipo()); pt.setString(5, objbean.getFases()); pt.setString(6, objbean.getInicio()); pt.setString(7, objbean.getFin()); pt.setString(8, objbean.getGastos()); pt.setInt(9, objbean.getCODJEFE()); pt.setInt(10, objbean.getNumero()); i=pt.executeUpdate(); pt.close(); cn.close(); } catch (Exception e) { i=0; } return i; } public ProyectoBean CapturarProyecto(ProyectoBean obj) { ProyectoBean objeto=null; try { cn = ConexionBD.getConexionBD(); pt = cn.prepareStatement("select p.numero,p.titulo,p.duracion,p.descripcion,p.tipo,p.fases,p.inicio,p.fin,p.gastos,j.nombjefe,p.codjefe from proy p inner join jefe j on p.codjefe=j.codjefe where p.numero=?"); pt.setInt(1, obj.getNumero()); rs=pt.executeQuery(); while(rs.next()) { objeto=new ProyectoBean(); objeto.setNumero(rs.getInt(1)); objeto.setTitulo(rs.getString(2)); objeto.setDuracion(rs.getString(3)); objeto.setDescripcion(rs.getString(4)); objeto.setTipo(rs.getString(5)); objeto.setFases(rs.getString(6)); objeto.setInicio(rs.getString(7)); objeto.setFin(rs.getString(8)); objeto.setGastos(rs.getString(9)); objeto.setNOMBJEFE(rs.getString(10)); objeto.setCODJEFE(rs.getInt(11)); } pt.close(); rs.close(); cn.close(); } catch (Exception e) { } return objeto; } public int generarCodigo() { int CODIGO = 0; try { cn = ConexionBD.getConexionBD(); pt = cn.prepareStatement("SELECT MAX(NUMERO) FROM proy "); rs=pt.executeQuery(); rs.next(); int c=Integer.parseInt(rs.getString(1))+1; String id=""; if(c<10000000){id=""+c;} CODIGO=Integer.parseInt(id); } catch (Exception e) { } return CODIGO; } }
[ "giampieer24@gmail.com" ]
giampieer24@gmail.com
dc71f01a4ece2df6ddb4857edd076d5f1bd9b96c
50006f03d00e13e5988d10705499a7309114bf4a
/aop/src/main/java/com/aop/aop/apoConcept/HelloWorldAopExample.java
728c09bee7f521c1e346f81363dae4e4d7d41863
[]
no_license
mdyasinarif/spring
fa2d22d7035b1042bd0049dd23b42204bd05ab2f
079d75fa0be170ea7a1d155323d77cf7c61f1765
refs/heads/master
2020-06-12T18:28:47.801589
2019-09-04T12:57:47
2019-09-04T12:57:47
190,147,725
0
0
null
null
null
null
UTF-8
Java
false
false
512
java
package com.aop.aop.apoConcept; import org.springframework.aop.framework.ProxyFactory; public class HelloWorldAopExample { public static void main(String[] args) { MessageWriter target = new MessageWriter(); ProxyFactory pf = new ProxyFactory(); pf.addAdvice(new MessageDecorator()); pf.setTarget(target); MessageWriter proxy = (MessageWriter) pf.getProxy(); target.writeMessage(); System.out.println(""); proxy.writeMessage(); } }
[ "mdyasinarifidb49@gmail.com" ]
mdyasinarifidb49@gmail.com
fc0e385e7db782481394cbcb1c2c6096a3e1f1d2
f197af99a9e0bce2a9d7c46c772340745c4026c1
/app/src/main/java/com/janhavi/hydration/sync/WaterReminderFirebaseJobService.java
968b6307175d8723ec270d8ecab2afd132afaf52
[]
no_license
JanhaviDahihande/WaterHydration
5a2f6f51c65a97b654aad316b26d302e1809d487
6882fb2895647d8cb2b17403c9b0592db85bd1bd
refs/heads/master
2020-04-18T09:52:04.134415
2019-01-24T22:51:15
2019-01-24T22:59:46
167,449,599
0
0
null
null
null
null
UTF-8
Java
false
false
3,027
java
/* * Copyright (C) 2016 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.janhavi.hydration.sync; import android.content.Context; import android.os.AsyncTask; import com.firebase.jobdispatcher.Job; import com.firebase.jobdispatcher.JobParameters; import com.firebase.jobdispatcher.JobService; import com.firebase.jobdispatcher.RetryStrategy; public class WaterReminderFirebaseJobService extends JobService { private AsyncTask mBackgroundTask; /** * The entry point to your Job. Implementations should offload work to another thread of * execution as soon as possible. * <p> * This is called by the Job Dispatcher to tell us we should start our job. Keep in mind this * method is run on the application's main thread, so we need to offload work to a background * thread. * * @return whether there is more work remaining. */ @Override public boolean onStartJob(final JobParameters jobParameters) { mBackgroundTask = new AsyncTask() { @Override protected Object doInBackground(Object[] params) { Context context = WaterReminderFirebaseJobService.this; ReminderTasks.executeTask(context, ReminderTasks.ACTION_CHARGING_REMINDER); return null; } @Override protected void onPostExecute(Object o) { /* * Once the AsyncTask is finished, the job is finished. To inform JobManager that * you're done, you call jobFinished with the jobParamters that were passed to your * job and a boolean representing whether the job needs to be rescheduled. This is * usually if something didn't work and you want the job to try running again. */ jobFinished(jobParameters, false); } }; mBackgroundTask.execute(); return true; } /** * Called when the scheduling engine has decided to interrupt the execution of a running job, * most likely because the runtime constraints associated with the job are no longer satisfied. * * @return whether the job should be retried * @see Job.Builder#setRetryStrategy(RetryStrategy) * @see RetryStrategy */ @Override public boolean onStopJob(JobParameters jobParameters) { if (mBackgroundTask != null) mBackgroundTask.cancel(true); return true; } }
[ "janhavidahihande@gmail.com" ]
janhavidahihande@gmail.com
ea98d0f0980ebe1ec68346eb0b42a7f44d079471
b54d4fc90df4c5256a5d1ef8cf54745986f98d24
/src/main/java/leetcode/medium/PathSumII.java
40f5897c91884b22b3a15d06ed0f5841b8919c4f
[ "Apache-2.0" ]
permissive
subhash982/ds-coding-problems
ce6e4ee2cf7977ccdc113366ea125224b7fc1ed7
83675a05b497825e21c8c0285f45f70acc9225f3
refs/heads/master
2023-01-04T03:51:04.219041
2020-10-25T05:31:59
2020-10-25T05:31:59
243,163,499
0
0
null
null
null
null
UTF-8
Java
false
false
1,385
java
package leetcode.medium; import leetcode.ds.TreeNode; import java.util.ArrayList; import java.util.List; /** * 113. Path Sum II * Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum. * <p> * Note: A leaf is a node with no children. * <p> * Example: * <p> * Given the below binary tree and sum = 22, * <p> * 5 * / \ * 4 8 * / / \ * 11 13 4 * / \ / \ * 7 2 5 1 * Return: * <p> * [ * [5,4,11,2], * [5,8,4,5] * ] */ public class PathSumII { public List <List <Integer>> pathSum(TreeNode root, int sum) { List <List <Integer>> result = new ArrayList <>(); List <Integer> tempResult = new ArrayList <>(); helper(root, result, tempResult, sum); return result; } public void helper(TreeNode root, List <List <Integer>> result, List <Integer> tempResult, int target) { if (root == null) { return; } tempResult.add(root.val); target -= root.val; if (root.left == null && root.right == null) { if (target == 0) { result.add(new ArrayList <>(tempResult)); } } helper(root.left, result, tempResult, target); helper(root.right, result, tempResult, target); tempResult.remove(tempResult.size() - 1); target += root.val; } }
[ "subhash982@gmail.com" ]
subhash982@gmail.com
9be89bb37e81ced27ca60db2e8f40ee2f9a334fb
211e3b946f4de23556758d1c3c3b78c91391b16b
/src/rest-api/src/main/java/eu/modernmt/rest/actions/translation/CreateTranslationSession.java
2bf95df02054948377d9eb118c2743b6ab615a90
[ "Apache-2.0" ]
permissive
Blueprint-Marketing-llc/MMT
f5a8e98e72f0ff73483b946ac1b5d0244427c36d
088b01858ec01a45982173467b8428ad25bece21
refs/heads/master
2021-01-11T21:23:51.479650
2017-01-12T15:31:48
2017-01-12T15:31:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,356
java
package eu.modernmt.rest.actions.translation; import eu.modernmt.context.ContextScore; import eu.modernmt.decoder.TranslationSession; import eu.modernmt.facade.ModernMT; import eu.modernmt.rest.actions.util.ContextUtils; import eu.modernmt.rest.framework.HttpMethod; import eu.modernmt.rest.framework.Parameters; import eu.modernmt.rest.framework.RESTRequest; import eu.modernmt.rest.framework.actions.ObjectAction; import eu.modernmt.rest.framework.routing.Route; import java.util.List; /** * Created by davide on 15/12/15. */ @Route(aliases = "sessions", method = HttpMethod.POST) public class CreateTranslationSession extends ObjectAction<TranslationSession> { @Override protected TranslationSession execute(RESTRequest req, Parameters _params) { Params params = (Params) _params; return ModernMT.decoder.openSession(params.context); } @Override protected Parameters getParameters(RESTRequest req) throws Parameters.ParameterParsingException { return new Params(req); } public static class Params extends Parameters { public final List<ContextScore> context; public Params(RESTRequest req) throws ParameterParsingException { super(req); context = ContextUtils.parseParameter("context_weights", getString("context_weights", false)); } } }
[ "davide.caroselli@translated.net" ]
davide.caroselli@translated.net
cf1999a874e32caddc63b32e3e667ff6bc6b90dc
17cd9152983b7d34ad9b97b70a624b9c3c55e396
/mingrui-shop-service/mingrui-shop-service-user/src/main/java/com/baidu/shop/mapper/UserMapper.java
7ccdeebf3157dbb539a74be6e120a2639b647bf3
[]
no_license
huojiahuihh/shop
5fb4bd6dd80427ff700da444c24fd939016bc948
ea8da14c10867f0d0d253824804b7f666bc51c80
refs/heads/main
2023-03-26T00:02:34.112742
2021-03-22T01:33:07
2021-03-22T01:33:07
326,624,562
0
0
null
null
null
null
UTF-8
Java
false
false
173
java
package com.baidu.shop.mapper; import com.baidu.shop.entity.UserEntity; import tk.mybatis.mapper.common.Mapper; public interface UserMapper extends Mapper<UserEntity> { }
[ "huojiahuihh@163.com" ]
huojiahuihh@163.com
636e007fa9d74c4517ba83839420853c98d11551
190d4d81f8c9b83ef29aa30a85914ddeafd5afd0
/FinalProj/src/finalproj/Pandora/PandoraGraph.java
c92e49e3ab39aab4175461999aad0eb209da61b8
[]
no_license
MosheDamari/GmarProject
72f92e89f61c82e9df4af88927cdad9c29da46b1
90b86070769be675876a38c41a915831ded96633
refs/heads/master
2020-08-03T21:24:10.271914
2019-09-30T15:26:02
2019-09-30T15:26:02
202,886,564
0
0
null
2019-08-17T13:49:28
2019-08-17T13:49:28
null
UTF-8
Java
false
false
3,749
java
package Pandora; import finalproj.Edge; import finalproj.Graph; import finalproj.Node; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class PandoraGraph extends Graph{ List<PandoraEdge> edgeList; public PandoraGraph(int nDiscoverCost, List<Node> nodes, List<Edge> edges) { super(nDiscoverCost, nodes, edges); edgeList = new ArrayList<>(); convertGraphEdgeToPandoraGraphEdge(edges); convertGraphNodesToPandoraGraphNode(); } public PandoraGraph(Graph g) { super(g); edgeList = new ArrayList<>(); convertGraphEdgeToPandoraGraphEdge(g.getEdges()); convertGraphNodesToPandoraGraphNode(); } private void convertGraphEdgeToPandoraGraphEdge(List<Edge> edges) { HashMap<String,List<Edge>> edgeToNodeMap = new HashMap<>(); for(Edge e: edges){ String nodeKey = e.getNode1().getId() + "," + e.getNode2().getId(); if(!edgeToNodeMap.containsKey(nodeKey)){ ArrayList<Edge> tempList = new ArrayList<>(); tempList.add(e); edgeToNodeMap.put(nodeKey,tempList); }else{ edgeToNodeMap.get(nodeKey).add(e); } } for(Map.Entry<String,List<Edge>> entry : edgeToNodeMap.entrySet()){ HashMap<String, HashMap<Integer,Float>> nEdgeCostToPrecent = new HashMap<>(); String[] nodeID = entry.getKey().split(","); Node node1 = this.getNodeById(Integer.parseInt(nodeID[0].toString())); Node node2 = this.getNodeById(Integer.parseInt(nodeID[1].toString())); List<Edge> edgesP = entry.getValue(); HashMap<Integer,Integer> edgesPriceToAmount = new HashMap<>(); int totalEdges = entry.getValue().size(); for(Edge e : edgesP){ if(!edgesPriceToAmount.containsKey(e.getEdgeCost())){ edgesPriceToAmount.put(e.getEdgeCost(),1); }else { edgesPriceToAmount.put(e.getEdgeCost(),edgesPriceToAmount.get(e.getEdgeCost())+1); } } PandoraEdge pandoraEdge = new PandoraEdge(0,0 , node1, node2); for (Map.Entry<Integer,Integer> innerEntry :edgesPriceToAmount.entrySet()) { Float precent = (float) innerEntry.getValue() / totalEdges; String key = node1.getId() + "," + node2.getId() + "," + innerEntry.getKey(); HashMap<Integer,Float> tempMap = new HashMap<>(); tempMap.put(innerEntry.getKey(), precent); nEdgeCostToPrecent.put(key , tempMap); } pandoraEdge.setnEdgeCostToPrecent(nEdgeCostToPrecent); edgeList.add(pandoraEdge); } } private void convertGraphNodesToPandoraGraphNode(){ HashMap<Node,List<Edge>> nodesEdges = new HashMap<>(); for (Edge pEdge : this.edgeList){ if(!nodesEdges.containsKey(pEdge.getNode1())){ ArrayList<Edge> edges = new ArrayList<>(); edges.add(pEdge); nodesEdges.put(pEdge.getNode1(), edges); }else{ nodesEdges.get(pEdge.getNode1()).add(pEdge); } if(!nodesEdges.containsKey(pEdge.getNode2())){ ArrayList<Edge> edges = new ArrayList<>(); edges.add(pEdge); nodesEdges.put(pEdge.getNode2(), edges); }else { nodesEdges.get(pEdge.getNode2()).add(pEdge); } } for (Map.Entry<Node,List<Edge>> entry : nodesEdges.entrySet()) { entry.getKey().setLstEdges(entry.getValue()); } } }
[ "moshe711@icloud.com" ]
moshe711@icloud.com
9db24efa55543a0adfd65f9b6941ec91fbfc379d
342dc8e3241d2d358558d42566fd99814b9d8787
/src/main/java/com/example/demo/service/UserServiceImpl.java
39293389179791b38f03ad0702ef476ee772f5c6
[]
no_license
guoyu07/spring-boot-rest-1
a021cf032b26e12fc2d5982e2548728a16001444
7bda5bfaa6b7f6227d36b323096188dc2f37d397
refs/heads/master
2020-03-07T08:11:36.556660
2017-09-04T19:06:44
2017-09-04T19:06:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,075
java
package com.example.demo.service; import com.example.demo.domain.Role; import com.example.demo.domain.User; import com.example.demo.repository.UserRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; import java.util.Set; @Service public class UserServiceImpl implements UserService{ @Autowired UserRepository userRepository; @Override public Iterable<User> getAllUsers() { return userRepository.findAll(); } @Override public User getUserById(Long id) { return userRepository.findOne(id); } @Override public User saveUser(User user) { return userRepository.save(user); } @Override public void deleteUser(Long id) { userRepository.delete(id); } @Override public Set<User> getUsersByRoles(Role role) { return userRepository.getUsersByRoles(role); } @Override public User getUserByEmail(String email) { return userRepository.getByEmail(email); } }
[ "farukkirisci@gmail.com" ]
farukkirisci@gmail.com
65a1f6c063f9a15c6f96f26dc459de5624c7d494
46ff7f6366d9cd4cf33ced5dd04124d0dfabb507
/study/pro22/src/com/spring/member/controller/MemberControllerImpl.java
ba5f72e721865f8d297c616816c93bc37eba1f2f
[]
no_license
KIMJINMINININN/Spring
b43cc698b2a6e5c329b80f4f44ae7747129cf9bf
0f924f28d4ed0550844ed33c35ab5cfac4e9d89f
refs/heads/main
2023-05-06T20:23:42.988317
2021-05-29T04:36:28
2021-05-29T04:36:28
370,864,112
0
0
null
null
null
null
UHC
Java
false
false
1,851
java
package com.spring.member.controller; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.multiaction.MultiActionController; import com.spring.member.service.MemberService; public class MemberControllerImpl extends MultiActionController implements MemberController{ private MemberService memberService; public void setMemberService(MemberService memberService){ this.memberService = memberService; } public ModelAndView listMembers(HttpServletRequest request, HttpServletResponse response) throws Exception{ String viewName = getViewName(request); List memberList = memberService.listMembers(); ModelAndView mav = new ModelAndView(viewName); mav.addObject("memberList", memberList); return mav; } // request에서 내가 원하는 파일 이름만 골라서 반환하는 메소드 private String getViewName(HttpServletRequest request) throws Exception { String contextPath = request.getContextPath(); String uri = (String) request.getAttribute("javax.servlet.include.request_uri"); if (uri == null || uri.trim().equals("")) { uri = request.getRequestURI(); } int begin = 0; if (!((contextPath == null) || ("".equals(contextPath)))) { begin = contextPath.length(); } int end; if (uri.indexOf(";") != -1) { end = uri.indexOf(";"); } else if (uri.indexOf("?") != -1) { end = uri.indexOf("?"); } else { end = uri.length(); } String fileName = uri.substring(begin, end); if (fileName.indexOf(".") != -1) { fileName = fileName.substring(0, fileName.lastIndexOf(".")); } if (fileName.lastIndexOf("/") != -1) { fileName = fileName.substring(fileName.lastIndexOf("/"), fileName.length()); } return fileName; } }
[ "44963392+KIMJINMINININN@users.noreply.github.com" ]
44963392+KIMJINMINININN@users.noreply.github.com
e2c8c00ec39fee1439d039996d8811dcdc80519f
3c11e46284a841ea135923759ed42cfa34d3e227
/src/main/java/uz/pdp/dataRest/projection/CustomCurrency.java
683fa1e06321eec728e315e1d3dea46d5b5bf189
[]
no_license
Madinah11/data-rest-warehouse
58ff7a7788a8c30c1c8edd4a210b4b6edcea221a
ef39c9d3bf3b54fcf8219d8a983a2d64a77e092e
refs/heads/master
2023-07-08T06:54:20.467347
2021-08-10T11:53:27
2021-08-10T11:53:27
394,631,585
0
0
null
null
null
null
UTF-8
Java
false
false
255
java
package uz.pdp.dataRest.projection; import org.springframework.data.rest.core.config.Projection; import uz.pdp.dataRest.entity.Currency; @Projection(types = Currency.class) public interface CustomCurrency { Integer getId(); String getName(); }
[ "shahzadenishonova@gmail.com" ]
shahzadenishonova@gmail.com
9e3d9e6f33384ed3a8eb492f9b3b57b5a1c777ed
7abdb802ec8c53e3a7d05828e6b6b0869154c495
/src/data/Tile.java
083f3bc805e2d175a16bce22420beb3d3b775a81
[]
no_license
dtrajko/GameProject
b2f8e97b329c6a44d06e6dd9849627d37ae3fe24
75a138e20ad48c8152898bd1e4f78c803516cd7f
refs/heads/master
2020-06-11T11:18:03.673253
2018-04-28T21:32:24
2018-04-28T21:32:24
75,680,750
0
0
null
null
null
null
UTF-8
Java
false
false
1,482
java
package data; import static helpers.Artist.*; import org.newdawn.slick.opengl.Texture; public class Tile { private float x, y; private int width, height; private Texture texture; private TileType type; private boolean occupied; public Tile(float x, float y, int width, int height, TileType type) { this.x = x; this.y = y; this.width = width; this.height = height; this.type = type; this.texture = quickLoad(type.textureName); if (type.buildable) { occupied = false; } else { occupied = true; } } public void Draw() { drawQuadTex(texture, x, y, width, height); } public float getX() { return x; } public void setX(float x) { this.x = x; } public float getY() { return y; } public void setY(float y) { this.y = y; } public int getXPlace() { return (int) x / TILE_SIZE; } public int getYPlace() { return (int) y / TILE_SIZE; } public int getWidth() { return width; } public void setWidth(int width) { this.width = width; } public int getHeight() { return height; } public void setHeight(int height) { this.height = height; } public Texture getTexture() { return texture; } public void setTexture(Texture texture) { this.texture = texture; } public TileType getType() { return type; } public void setType(TileType type) { this.type = type; } public boolean getOccupied() { return occupied; } public void setOccupied(boolean occupied) { this.occupied = occupied; } }
[ "dtrajko@gmail.com" ]
dtrajko@gmail.com
cba2299e755fc1b476016edd83cc5d5823ab0664
f763e609dbf345ce65185f8aca4451d91c125a9a
/srsCode/src/com/hillel/lesson_20/thread/InteruptMet.java
a05861a25ca9c3eb685734a38ae1e52dd7bc3a69
[]
no_license
Zhygit1998/javaSprSum2021
9d682bb807e37c5876e7c2b9071b8b777d3f1d01
cb0d22f4391c3782c8b64f878d5861d3fde9a60c
refs/heads/main
2023-06-27T04:42:01.251129
2021-07-26T17:59:53
2021-07-26T17:59:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,232
java
package com.hillel.lesson_20.thread; public class InteruptMet { public static void main(String[] args) throws InterruptedException { Thread thread = new Thr(); thread.start(); while (true) { System.out.println(thread.isAlive()); Thread.sleep(1300); int rez = Count.getCount(); System.out.println(rez + " >> " + rez % 3); if (rez % 3 == 0) { thread.interrupt(); break; } } System.out.println("finish main thread"); Thread.sleep(2000); System.out.println(thread.isAlive()); } } class Thr extends Thread { @Override public void run() { for (int i = 0; i < 100; i++) { try { Thread.sleep(233); Count.increment(); System.out.println(Count.getCount()); } catch (InterruptedException e) { System.out.println("programm finish"); // break; } } } } class Count { private static int count = 0; public static void increment() { count++; } public static int getCount() { return count; } }
[ "stepurko.alexandr@gmail.com" ]
stepurko.alexandr@gmail.com
e54c69d221f7d64bc379e031b2a2e3b0f7d7ce8c
596a2f66bb709c4fa8b7400a733149ce789196ca
/src/main/java/com/sujiakeji/merchant/util/mybatis/MybatisUtils.java
ec9f9d5c4dfbec671539c8a3e746fc3bca173958
[]
no_license
sujiakeji/sujiakeji-merchant
dbfdc8ebb6e3a04e56e0b96d914fca8300b86eb7
0e8a354245a589e3f579d09ef2ee0eeaaf717c84
refs/heads/master
2020-05-22T13:34:46.965506
2019-05-13T07:05:09
2019-05-13T07:05:09
186,362,832
0
0
null
null
null
null
UTF-8
Java
false
false
3,739
java
package com.sujiakeji.merchant.util.mybatis; import com.sujiakeji.merchant.constant.CommonConstants; import com.sujiakeji.merchant.dto.common.QueryFilterDto; import com.google.common.base.CaseFormat; import com.google.common.base.Joiner; import com.google.common.base.Splitter; import com.google.common.base.Strings; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; @Component @Scope("prototype") public class MybatisUtils { private final Logger logger = LoggerFactory.getLogger(this.getClass()); private String regex; private String tableName; public void setRegex(String regex) { this.regex = regex; } public void setTableName(String tableName) { this.tableName = tableName; } public List<QueryFilterDto> convertQueryFilters(List<QueryFilterDto> dtoList) { List<QueryFilterDto> newDtoList = new ArrayList<>(); if (dtoList != null && dtoList.size() > 0) { newDtoList = new ArrayList<>(); for (QueryFilterDto dto : dtoList) { String field = dto.getField(); if (!Strings.isNullOrEmpty(field)) { String underscoreField = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, dto.getField()); String convertedField = convertField(underscoreField); String operator = dto.getOperator(); String condition = convertedField + CommonConstants.SPACE + operator + CommonConstants.SPACE; logger.debug("condition: {}", condition); Object value = dto.getValue(); if (value instanceof String) { value = CommonConstants.SINGLE_QUOTE + String.valueOf(value) + CommonConstants.SINGLE_QUOTE; logger.debug("value: {}", value); } QueryFilterDto newDto = new QueryFilterDto(condition, value); newDtoList.add(newDto); } } } return newDtoList; } public String convertPageOrder(String order) { String result = null; Splitter commaSplitter = Splitter.on(CommonConstants.COMMA).trimResults().omitEmptyStrings(); if (Strings.isNullOrEmpty(order)) { order = "id"; } String underscoreOrder = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, order); List<String> splitOrders = commaSplitter.splitToList(underscoreOrder); List<String> newOrders = new ArrayList<>(); for (String splitOrder : splitOrders) { String newOrder = convertField(splitOrder); if (!Strings.isNullOrEmpty(newOrder)) { if (splitOrder.startsWith(CommonConstants.MINUS)) { newOrder = convertField(splitOrder.substring(1)) + " desc"; } newOrders.add(newOrder); } } result = Joiner.on(CommonConstants.COMMA).join(newOrders); return result; } public String convertField(String field) { if (Strings.isNullOrEmpty(regex)) { return field; } String convertedField = null; Pattern pattern = Pattern.compile(regex); Matcher matcher = pattern.matcher(field); if (matcher.matches()) { convertedField = matcher.group(1) + "s." + matcher.group(2); } else { convertedField = tableName + "." + field; } return convertedField; } }
[ "sunjinliang@gmail.com" ]
sunjinliang@gmail.com
e3bb250e4ef67baf7075344808ff20ba40e843b7
5c338b58891ff172e4e5495e072348665b8fc06f
/src/org/ashleygwinnell/imageresizer/ImageResizer.java
aaed1a3b0a40e34b3e81080c84202a2b1ef8024c
[]
no_license
ashleygwinnell/ark2d-imageresizer
d77afa8aa86fa60960a8f39af491988276cf38dd
28d93aa54643fb3293e7367df914f2100270f668
refs/heads/master
2021-01-20T19:34:29.133880
2016-08-16T12:01:27
2016-08-16T12:01:27
65,816,583
0
0
null
null
null
null
UTF-8
Java
false
false
5,829
java
package org.ashleygwinnell.imageresizer; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.Transparency; import java.awt.image.BufferedImage; import java.io.File; import javax.imageio.ImageIO; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; public class ImageResizer { /** * Convenience method that returns a scaled instance of the * provided {@code BufferedImage}. * * @param img the original image to be scaled * @param targetWidth the desired width of the scaled instance, * in pixels * @param targetHeight the desired height of the scaled instance, * in pixels * @param hint one of the rendering hints that corresponds to * {@code RenderingHints.KEY_INTERPOLATION} (e.g. * {@code RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR}, * {@code RenderingHints.VALUE_INTERPOLATION_BILINEAR}, * {@code RenderingHints.VALUE_INTERPOLATION_BICUBIC}) * @param higherQuality if true, this method will use a multi-step * scaling technique that provides higher quality than the usual * one-step technique (only useful in downscaling cases, where * {@code targetWidth} or {@code targetHeight} is * smaller than the original dimensions, and generally only when * the {@code BILINEAR} hint is specified) * @return a scaled version of the original {@code BufferedImage} */ public static BufferedImage getScaledInstance(BufferedImage img, int targetWidth, int targetHeight, Object hint, boolean higherQuality) { int type = (img.getTransparency() == Transparency.OPAQUE) ? BufferedImage.TYPE_INT_RGB : BufferedImage.TYPE_INT_ARGB; BufferedImage ret = (BufferedImage)img; int w, h; if (higherQuality) { // Use multi-step technique: start with original size, then // scale down in multiple passes with drawImage() // until the target size is reached w = img.getWidth(); h = img.getHeight(); } else { // Use one-step technique: scale directly from original // size to target size with a single drawImage() call w = targetWidth; h = targetHeight; } do { if (higherQuality && w > targetWidth) { w /= 2; if (w < targetWidth) { w = targetWidth; } } if (higherQuality && h > targetHeight) { h /= 2; if (h < targetHeight) { h = targetHeight; } } BufferedImage tmp = new BufferedImage(w, h, type); Graphics2D g2 = tmp.createGraphics(); g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, hint); g2.drawImage(ret, 0, 0, w, h, null); g2.dispose(); ret = tmp; } while (w != targetWidth || h != targetHeight); return ret; } /* [ { "from": "filename.png", "to": [ { "filename": "new1.png", "width": 128, "height":128, "interpolation": "VALUE_INTERPOLATION_BICUBIC" nearest_neighbour, bilinear, bicubic (optional) } ] } ] */ public static void main(String[] args) { String jsonString = ""; try { jsonString = args[0]; JSONArray o = new JSONArray(jsonString); for(int i = 0; i < o.length(); i++) { JSONObject item = o.getJSONObject(i); String from = item.getString("from"); JSONArray to = item.getJSONArray("to"); for(int j = 0; j < to.length(); j++) { JSONObject itemTo = to.getJSONObject(j); String tofilename = itemTo.getString("filename"); File fromf = new File(from); if (!fromf.exists()) { System.err.println("File \"" + fromf + "\" does not exist."); return; } java.awt.Image img = ImageIO.read(fromf); int width = 0; int height = 0; if (itemTo.has("width") && itemTo.has("height")) { width = itemTo.getInt("width"); height = itemTo.getInt("height"); } else if (itemTo.has("scale")) { double scale = itemTo.getDouble("scale"); width = (int) (img.getWidth(null) * scale); height = (int) (img.getHeight(null) * scale); } if (width > img.getWidth(null) && height > img.getHeight(null)) { continue; } BufferedImage bi = new BufferedImage(img.getWidth(null), img.getHeight(null), BufferedImage.TYPE_4BYTE_ABGR); Graphics2D g2d = bi.createGraphics(); g2d.drawImage(img, 0, 0, null); String renderingHint = itemTo.getString("interpolation"); Object actualRenderingHint = RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR; if (renderingHint.equals("bicubic")) { actualRenderingHint = RenderingHints.VALUE_INTERPOLATION_BICUBIC; } else if (renderingHint.equals("bilinear")) { actualRenderingHint = RenderingHints.VALUE_INTERPOLATION_BILINEAR; } BufferedImage toImage = ImageResizer.getScaledInstance(bi, width, height, actualRenderingHint, true); ImageIO.write(toImage, "png", new File(tofilename)); } } } catch (ArrayIndexOutOfBoundsException e) { System.err.println("Missing command line JSON argument."); } catch (JSONException e) { System.err.println("Invalid JSON passed."); System.err.println(jsonString); e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } } }
[ "ashley@forceofhab.it" ]
ashley@forceofhab.it
0fdb1e708be4fe3fbb798be73596aaa818b2b2ee
0048caf33af9e7f30b7ac1b057b7a09d63bf2481
/orderapp/src/main/java/com/visa/prj/entity/Address.java
fa3841c89a2c1de9c41b8684cdce6f6ab46bc95f
[]
no_license
dhruv-kun/Java-Training
2cd547ccf7f33a1bbff33f55e8a4597627549dd3
d6c5396264068b47c27f507fb6cdcd224b79e2c6
refs/heads/master
2022-12-23T11:35:26.227167
2020-06-04T15:16:59
2020-06-04T15:16:59
199,440,558
1
0
null
2022-12-16T15:23:49
2019-07-29T11:33:22
Java
UTF-8
Java
false
false
806
java
package com.visa.prj.entity; public class Address { private int houseNo; private String street; private String city; private String zipcode; public Address() { } public Address(int houseNo, String street, String city, String zipcode) { this.houseNo = houseNo; this.street = street; this.city = city; this.zipcode = zipcode; } public int getHouseNo() { return houseNo; } public void setHouseNo(int houseNo) { this.houseNo = houseNo; } public String getStreet() { return street; } public void setStreet(String street) { this.street = street; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public String getZipcode() { return zipcode; } public void setZipcode(String zipcode) { this.zipcode = zipcode; } }
[ "dhruvsci30@gmail.com" ]
dhruvsci30@gmail.com
aa2ab72806200abd0ba5784effe262be691e0dbb
bf047d365d2386f2b4b77a5a4c3882d11f950ca8
/sap-r3/src/com/sap/r3/bapi/TesteSAP.java
2827522b67d2cfca67797bccea2a19dab0dd731c
[]
no_license
alexbcbr/my-samples
5f4c83a74ebc08ee4954fbe92626830a78c977a1
7a4f5262ab15722ca6faef99ba3a1c66cebad834
refs/heads/master
2016-09-08T01:16:24.493523
2013-10-21T13:01:11
2013-10-21T13:01:11
null
0
0
null
null
null
null
ISO-8859-1
Java
false
false
1,652
java
package com.sap.r3.bapi; import com.sap.mw.jco.IFunctionTemplate; import com.sap.mw.jco.JCO; public class TesteSAP { public static void main(String[] args) { //Declarando um objeto do tipo JCO.Client (Conexão) JCO.Client conexao; JCO.PoolManager.singleton().addClientPool("poolClient200", 100, "200", "BASIS00", "fiap2013", "EN", "192.168.60.17", "00"); conexao = JCO.PoolManager.singleton().getClient("poolClient200"); //Criação de repositório JCO.Repository repositorio; repositorio = new JCO.Repository("repExemplo", conexao); System.out.println("Dados de Conexão:" + conexao.getAttributes()); System.out.println("***********************************************"); //Criação de um objeto JCO.Function IFunctionTemplate functionTemplate = repositorio.getFunctionTemplate("BAPI_BANK_GETDETAIL"); JCO.Function function = functionTemplate.getFunction(); JCO.ParameterList parametrosEntrada = function.getImportParameterList(); parametrosEntrada.setValue("BR", "BANKCOUNTRY"); parametrosEntrada.setValue("123947598", "BANKKEY"); //Executando uma função conexao.execute(function); //Obtendo resultado da execução por meio da tabela TAB_PAIS JCO.ParameterList parametrosSaida = function.getExportParameterList(); JCO.Structure estruturaSaida = parametrosSaida.getStructure("BANK_ADDRESS"); System.out.println("Endereço do Banco Informado: " + estruturaSaida.getField("STREET").getString()); //Liberação de conexão com o SAP JCO.PoolManager.singleton().releaseClient(conexao); } }
[ "alexbcbr@gmail.com" ]
alexbcbr@gmail.com
91942c5efae3897d188999e516e5bd38a3ac753a
02f45d54c8c7a79a9ff373c0696cfaae9375cbe7
/ats-ApplicantTracking/src/main/java/com/mobileprogramming/ServletInitializer.java
f618ad797242355e4eb11814ba6ec2a44a6618f2
[]
no_license
vishalsingh2607/vishal
76465906f08df5cbe66e1ea1f7dcdaf131041879
2a12f184ff250094e106c062932f423c3339c4f7
refs/heads/master
2021-01-03T15:42:54.167171
2020-02-15T15:29:41
2020-02-15T15:29:41
240,136,147
0
0
null
null
null
null
UTF-8
Java
false
false
425
java
package com.mobileprogramming; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; public class ServletInitializer extends SpringBootServletInitializer { @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(AtsApplicantTrackingApplication.class); } }
[ "vishal267s@gmail.com" ]
vishal267s@gmail.com
a08c8ad1a7cd6467a879ac35bab94f884b96629d
8e967802051251cf42e0fbcd76280bf913e0528e
/src/de/mz/jk/plgs/data/Sample.java
f3522d7460adbbf0dfc299a8cc7df0fc66bbb1ba
[ "BSD-2-Clause" ]
permissive
jkuharev/PLGSDataAccess
8567481d158641b8b8b46d01d96b9638adfc0d62
905b546d45a76bb02d25d4ced35bf68a839a7180
refs/heads/master
2018-11-01T10:20:33.376934
2018-08-24T14:10:56
2018-08-24T14:10:56
116,658,779
1
0
null
null
null
null
UTF-8
Java
false
false
1,765
java
package de.mz.jk.plgs.data; import java.util.ArrayList; import java.util.List; import java.util.UUID; import de.mz.jk.plgs.Identifyable; public class Sample extends Identifyable { public int index=0; public int group_index=0; public String id = UUID.randomUUID().toString(); public String name=""; public Group group=null; public List<Workflow> workflows= new ArrayList<Workflow>(); /** empty sample */ public Sample(){} /** sample having given name */ public Sample(String name){this.name=name;} /** sample as part of given group having given name */ public Sample(Group g, String name) { this.name=name; g.addSample(this); } /** * sample as identical copy of given sample<br> * workflows are not copied!!! * */ public Sample( Sample s ) { super(s); this.name=s.name; this.group=s.group; this.id=s.id; this.index=s.index; this.group_index=s.group_index; } /** * remove run from its old sample and add it to this sample * @param w the run */ public void addWorkflow(Workflow w) { if( w.sample!=null ) w.sample.workflows.remove(w); w.sample = this; if( this.workflows.indexOf(w)<0 ) this.workflows.add(w); } /** * remove run from sample * @param w */ public void removeWorkflow(Workflow w) { workflows.remove( w ); w.sample = null; } /** * create identical clone and optionally move all workflows to clone * @param moveWorkflows * @return */ public Sample getClone(boolean moveWorkflows) { Sample res = new Sample(this); if(moveWorkflows) { List<Workflow> ws = new ArrayList<Workflow>(this.workflows); for(Workflow w : ws) res.addWorkflow(w); } return res; } }
[ "jkuharev@1041-mac-joerg.local" ]
jkuharev@1041-mac-joerg.local
03fae22ec8fe5a9a1e1a78df44d05a2f24419744
c34e03d8a9941cf983cc58f047a2b66dca3718e4
/src/Main5.java
3e313f82829b9a78490b731f374f74781bfd0eb8
[]
no_license
ZackW19/Kolekcje
6be91d67cb740d64d686c350a9cef95d5df56bf0
a9948afe0d8e65c1cf4ea1ca4c9b139153590966
refs/heads/master
2021-01-19T06:32:50.002575
2017-08-17T19:14:24
2017-08-17T19:14:24
100,637,038
0
0
null
null
null
null
UTF-8
Java
false
false
513
java
//Mapy import java.util.HashMap; import java.util.Map; public class Main5 { public static void main(String[] args) { Map<Integer, String> stringMap = new HashMap<>(); //może być Map<String, Integer> można dawać też inne typy generyczne stringMap.put (1, "Krowa"); //stringMap.put ("Krowa", 1); stringMap.put(2, "Pies"); stringMap.put(5, "Zając"); stringMap.put(10,"Jaskółka"); System.out.println(stringMap.get(10)); } }
[ "zwajdziak@gmail.com" ]
zwajdziak@gmail.com
725d6d5e1672f96e551a97c9421e06f1eaf0a288
658c1576758b1edb24144d7f1bfd8357397a640f
/src/main/java/com/searcher/entity/SearchData.java
b6e6197d27dbf0a8089e206a110583d34ac82fe1
[]
no_license
anatoliyck/searcher
9d1cf28a81680da422faa305ec21ed0e7944bb5e
ef649d7810aa104309bca59aee557e945d107963
refs/heads/master
2021-05-29T08:50:51.915669
2015-03-02T13:45:09
2015-03-02T13:45:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
871
java
package com.searcher.entity; public class SearchData { private String url; private String title; private String text; private float score; public SearchData(String url, String title, float score, String text) { this.url = url; this.title = title; this.score = score; this.text = text; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public float getScore() { return score; } public void setScore(float score) { this.score = score; } public String getText() { return text; } public void setText(String text) { this.text = text; } }
[ "anatoliy.ck@gmail.com" ]
anatoliy.ck@gmail.com
a7180b7ee0bdd5691db55389dff4b1d85ffafc8b
ae0ca800a90396d936dfa5c703f39e560c8600ff
/Encog Examples/src/main/java/org/encog/examples/neural/benchmark/FahlmanEncoder.java
7d23f8f3ee14e5580ec62db0940a4ab2034f7679
[ "BSD-3-Clause" ]
permissive
StuartGordonReidOld/timeseriesmodeller
22c6af4c7a55c9d2d8422469fae7f232ff08e07b
e86e6f0ea4b32bee2216781794f14df941200e00
refs/heads/master
2016-09-06T03:56:27.391783
2013-09-15T09:45:42
2013-09-15T09:45:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,654
java
/* * Encog(tm) Java Examples v3.2 * http://www.heatonresearch.com/encog/ * https://github.com/encog/encog-java-examples * * Copyright 2008-2013 Heaton Research, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * For more information on Heaton Research copyrights, licenses * and trademarks visit: * http://www.heatonresearch.com/copyright */ package org.encog.examples.neural.benchmark; import org.encog.Encog; import org.encog.ml.MLMethod; import org.encog.ml.data.MLDataSet; import org.encog.ml.data.basic.BasicMLDataSet; import org.encog.neural.networks.BasicNetwork; import org.encog.neural.networks.training.lma.LevenbergMarquardtTraining; import org.encog.util.simple.EncogUtility; /** * This example implements a Fahlman Encoder. Though probably not invented by Scott * Fahlman, such encoders were used in many of his papers, particularly: * * "An Empirical Study of Learning Speed in Backpropagation Networks" * (Fahlman,1988) * * It provides a very simple way of evaluating classification neural networks. * Basically, the input and output neurons are the same in count. However, * there is a smaller number of hidden neurons. This forces the neural * network to learn to encode the patterns from the input neurons to a * smaller vector size, only to be expanded again to the outputs. * * The training data is exactly the size of the input/output neuron count. * Each training element will have a single column set to 1 and all other * columns set to zero. You can also perform in "complement mode", where * the opposite is true. In "complement mode" all columns are set to 1, * except for one column that is 0. The data produced in "complement mode" * is more difficult to train. * * Fahlman used this simple training data to benchmark neural networks when * he introduced the Quickprop algorithm in the above paper. * */ public class FahlmanEncoder { public static final int INPUT_OUTPUT_COUNT = 10; public static final int HIDDEN_COUNT = 5; public static final int TRIES = 2500; public static final boolean COMPL = false; public static MLDataSet generateTraining(int inputCount, boolean compl) { double[][] input = new double[INPUT_OUTPUT_COUNT][INPUT_OUTPUT_COUNT]; double[][] ideal = new double[INPUT_OUTPUT_COUNT][INPUT_OUTPUT_COUNT]; for (int i = 0; i < inputCount; i++) { for (int j = 0; j < inputCount; j++) { if (compl) { input[i][j] = (j == i) ? 0.0 : 1.0; } else { input[i][j] = (j == i) ? 1.0 : 0.0; } ideal[i][j] = input[i][j]; } } return new BasicMLDataSet(input, ideal); } public static void main(String[] args) { MLDataSet trainingData = generateTraining(INPUT_OUTPUT_COUNT, COMPL); MLMethod method = EncogUtility.simpleFeedForward(INPUT_OUTPUT_COUNT, HIDDEN_COUNT, 0, INPUT_OUTPUT_COUNT, false); LevenbergMarquardtTraining train = new LevenbergMarquardtTraining((BasicNetwork) method, trainingData); EncogUtility.trainToError(train, 0.01); Encog.getInstance().shutdown(); } }
[ "stuart@sinkwa.com" ]
stuart@sinkwa.com
eb874448622dcfcb6cb276738449f945be9fd32d
909e95d15bef0a22c6e174825d84414bf6802f3d
/吕康捷-151220071/src/main/java/BalanceFormatter.java
6f4ec0ba99d0d7a1e7d6010e98d772661940cdd2
[]
no_license
WilliamLyu/Final-Project
5bd6a96548f71863da35216955bb03133afe3fe2
af13f6a584518936a35078a33a53d85dfb64486f
refs/heads/master
2020-04-13T09:53:36.068017
2018-12-26T03:03:13
2018-12-26T03:03:13
163,119,768
0
0
null
null
null
null
UTF-8
Java
false
false
2,600
java
import java.util.Random; public class BalanceFormatter implements Formatter { @Override public void format(BattleField field, int boyORgoblin) { // 0 1 2 3 4 5 6 7 8 9 a b c d e f //0 . . . . . . . . | . . . . . g . . //1 . . 6 . . . . . | . . . . . . g . //2 . 7 . . . . . . | . . . . . g . . //3 . . 4 . . . . . | . . . . . . g . //4 . 5 . . . . . . | . . . . . g . S //5 . . 3 . . . . . | . . . . . . g . //6 . 2 . . . . . . | . . . . . g . . //7 . . 1 . . . . . | . . . . . . g . //8 . G . . . . . . | . . . . . s . . //9 . . . . . . . . | . . . . . . g . if (boyORgoblin == 1) { //boy field.boys.clear(); field.boys.add(new Boy(1, 2, 7, field, "1.png")); field.boys.add(new Boy(2, 1, 6, field, "2.png")); field.boys.add(new Boy(3, 2, 5, field, "3.png")); field.boys.add(new Boy(4, 2, 3, field, "4.png")); field.boys.add(new Boy(5, 1, 4, field, "5.png")); field.boys.add(new Boy(6, 2, 1, field, "6.png")); field.boys.add(new Boy(7, 1, 2, field, "7.png")); field.grandpa = new Grandpa(1, 8, field, "grandpa.png"); } else if (boyORgoblin == 2) { //goblin field.goblins.clear(); field.goblins.add(new Goblin(13, 0, field, "goblin" + (new Random ().nextInt(3)) + ".png")); field.goblins.add(new Goblin(13, 2, field, "goblin" + (new Random ().nextInt(3)) + ".png")); field.goblins.add(new Goblin(13, 4, field, "goblin" + (new Random ().nextInt(3)) + ".png")); field.goblins.add(new Goblin(13, 6, field, "goblin" + (new Random ().nextInt(3)) + ".png")); field.goblins.add(new Goblin(14, 1, field, "goblin" + (new Random ().nextInt(3)) + ".png")); field.goblins.add(new Goblin(14, 3, field, "goblin" + (new Random ().nextInt(3)) + ".png")); field.goblins.add(new Goblin(14, 5, field, "goblin" + (new Random ().nextInt(3)) + ".png")); field.goblins.add(new Goblin(14, 7, field, "goblin" + (new Random ().nextInt(3)) + ".png")); field.goblins.add(new Goblin(14, 9, field, "goblin" + (new Random ().nextInt(3)) + ".png")); field.scorpion = new Scorpion(13, 8, field, "scorpion.png"); field.snake = new Snake(15, 4, field, "snake.png"); } } }
[ "william_lyu_1997@163.com" ]
william_lyu_1997@163.com
821b259f395e274bb33fe4650127430901a00475
d4a101c089952ccfea0b53eb88c152f98cd9a1cb
/src/it/unibo/deis/lia/ramp/service/application/MessageClient.java
07a9cd46eb1e8cf9d46fbdc3e5c61bea00f75247
[]
no_license
dami-gg/ramp
4a4611ca8a508f3da25c9d57c5f9c14a4ae1e97d
88f857b67e4db1bf2d2bc467fbbaee9ea4f2ca7a
refs/heads/master
2016-09-06T09:19:15.118535
2013-01-06T14:02:15
2013-01-06T14:02:15
7,468,213
1
0
null
null
null
null
UTF-8
Java
false
false
1,488
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package it.unibo.deis.lia.ramp.service.application; import it.unibo.deis.lia.ramp.core.e2e.*; /** * * @author useruser */ public class MessageClient{ private static MessageClient messageClient=null; private static MessageClientJFrame mcj; private MessageClient(){ mcj = new MessageClientJFrame(this); } public static synchronized MessageClient getInstance(){ if(messageClient==null){ messageClient=new MessageClient(); } mcj.setVisible(true); return messageClient; } public void stopClient(){ messageClient=null; } public void sendMessage(int destNodeId, String message, int packetDeliveryTimeout){ Message messageObject = new Message(message); try{ E2EComm.sendUnicast( null, destNodeId, MessageService.MESSAGGE_PORT, MessageService.MESSAGE_PROTOCOL, false, // ack GenericPacket.UNUSED_FIELD, // timeoutAck GenericPacket.UNUSED_FIELD, // bufferSize packetDeliveryTimeout, GenericPacket.UNUSED_FIELD, // connectTimeout E2EComm.serialize(messageObject) ); } catch(Exception e){ e.printStackTrace(); } } }
[ "damian.garciagarcia@gmail.com" ]
damian.garciagarcia@gmail.com
d6a2cb28cf57fa6c9e781b746da596494ff1b746
a9717fc777628e1cc1d847c23f5408679abfdf5a
/src/sicca-ejb/ejbModule/py/com/excelsis/sicca/session/form/CategoriaAnexoSearchListFormController.java
4b5be9ca42b97efe0922dae1f739cc57d23b9ede
[]
no_license
marcosd94/trabajo
da678b69dca30d31a0c167ee76194ea1f7fb62f0
00a7b110b4f5f70df7fb83af967d9dcc0e488053
refs/heads/master
2021-01-19T02:40:58.253026
2016-07-20T18:15:44
2016-07-20T18:15:44
63,803,756
0
0
null
null
null
null
UTF-8
Java
false
false
8,058
java
package py.com.excelsis.sicca.session.form; import java.io.Serializable; import java.util.ArrayList; import java.util.Calendar; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.Query; import org.jboss.seam.ScopeType; import org.jboss.seam.annotations.In; import org.jboss.seam.annotations.Name; import org.jboss.seam.annotations.Scope; import org.jboss.seam.international.StatusMessage.Severity; import org.jboss.seam.international.StatusMessages; import py.com.excelsis.sicca.entity.ConfiguracionUoCab; import py.com.excelsis.sicca.entity.SinAnx; import py.com.excelsis.sicca.entity.SinEntidad; import py.com.excelsis.sicca.entity.SinNivelEntidad; import py.com.excelsis.sicca.seguridad.entity.Usuario; import py.com.excelsis.sicca.session.SinAnxList; import py.com.excelsis.sicca.session.SinEntidadList; import py.com.excelsis.sicca.session.SinNivelEntidadList; import py.com.excelsis.sicca.session.util.UtilesFromController; import py.com.excelsis.sicca.util.SICCAAppHelper; /** * @author jmelgarejo Clase manejadora UC192 */ @Scope(ScopeType.CONVERSATION) @Name("categoriaAnexoSearchListFormController") public class CategoriaAnexoSearchListFormController implements Serializable { /** * */ private static final long serialVersionUID = 2991843744538615618L; @In StatusMessages statusMessages; @In(value = "entityManager") EntityManager em; @In(required = false) Usuario usuarioLogueado; @In(create = true) SinAnxList sinAnxList; @In(create = true) SinNivelEntidadList sinNivelEntidadList; @In(create = true) SinEntidadList sinEntidadList; @In(required = false, create = true) UtilesFromController utilesFromController; private SinAnx sinAnx = new SinAnx(); private SinNivelEntidad sinNivelEntidad = new SinNivelEntidad(); private SinEntidad sinEntidad = new SinEntidad(); private Integer anhoActual = null; private Boolean filtroSinar = false; private Long idSinNivelEntidad = null; private Long idSinEntidad = null; private boolean primeraEntrada=true; private String descNivelEntidad, descEntidad, fromToPage; public void init() { if (sinNivelEntidad.getIdSinNivelEntidad() != null && sinNivelEntidad.getNenNombre() == null) { sinNivelEntidad = em.find(SinNivelEntidad.class, sinNivelEntidad.getIdSinNivelEntidad()); } if (sinEntidad.getIdSinEntidad() != null && sinEntidad.getEntNombre() == null) { sinEntidad = em.find(SinEntidad.class, sinEntidad.getIdSinEntidad()); if (sinNivelEntidad.getNenCodigo() == null) { sinNivelEntidad.setNenCodigo(sinEntidad.getNenCodigo()); obtenerDescNivelEntidad(); } } if(primeraEntrada){ primeraEntrada=false; sinNivelEntidad = new SinNivelEntidad(); sinEntidad = new SinEntidad(); cargarAnhoActual(); sinAnx.setAniAniopre(anhoActual); } search(); } private String calcCodSinarh(Long idUsuario) { Query q = em.createQuery("SELECT cuo FROM ConfiguracionUoCab cuo, Usuario usu WHERE cuo = usu.configuracionUoCab " + "AND usu.idUsuario = " + idUsuario); List<ConfiguracionUoCab> lista = q.getResultList(); if (lista.size() == 1) { return lista.get(0).getCodigoSinarh(); } return null; } public void search() { sinAnxList.getSinAnx().setAniAniopre(sinAnx.getAniAniopre()); sinAnxList.getSinAnx().setVrsCodigo(50); if (filtroSinar) { String codSinarh = calcCodSinarh(usuarioLogueado.getIdUsuario()); //SinAnx sinAnx = utilesFromController.getSinAnx(codSinarh); List<String> listaSinAnxs=listarSin(codSinarh); if(listaSinAnxs.size()>0) sinAnxList.setCods(listaSinAnxs); else sinAnxList.setCods(null); } if(sinAnx.getAnxDescrip()!=null && !sinAnx.getAnxDescrip().trim().equals("")) sinAnxList.getSinAnx().setAnxDescrip(sinAnx.getAnxDescrip().trim()); if(sinAnx.getCtgCodigo()!=null && !sinAnx.getCtgCodigo().trim().equals("")) sinAnxList.getSinAnx().setCtgCodigo(sinAnx.getCtgCodigo().trim()); sinAnxList.buscarResultados(); } private List<String> listarSin(String cod){ String[] codsArr=cod.split("\\/"); List<String> c=new ArrayList<String>(); for (int i = 0; i < codsArr.length; i++) { c.add(codsArr[i]); } return c; } public void searchAll() { sinAnx = new SinAnx(); cargarAnhoActual(); sinAnx.setAniAniopre(anhoActual); sinNivelEntidad = new SinNivelEntidad(); sinEntidad = new SinEntidad(); sinAnxList.limpiarResultados(); } public void obtenerDescNivelEntidad() { descNivelEntidad = null; if (sinNivelEntidad.getNenCodigo() != null) { sinNivelEntidadList.getSinNivelEntidad().setNenCodigo(sinNivelEntidad.getNenCodigo()); SinNivelEntidad nEnt = sinNivelEntidadList.nivelEntidadMaxAnho(); sinNivelEntidad = nEnt != null ? nEnt : new SinNivelEntidad(); descNivelEntidad = nEnt != null ? nEnt.getNenNombre() : null; } } public void obtenerDescEntidad() { descEntidad = null; if (sinNivelEntidad.getNenCodigo() != null && sinEntidad.getEntCodigo() != null) { sinEntidadList.getSinEntidad().setNenCodigo(sinNivelEntidad.getNenCodigo()); sinEntidadList.getSinEntidad().setEntCodigo(sinEntidad.getEntCodigo()); SinEntidad ent = sinEntidadList.entidadMaxAnho(); sinEntidad = ent != null ? ent : new SinEntidad(); descEntidad = ent != null ? ent.getEntNombre() : null; } } public String getUrlToPageEntidad() { if (sinNivelEntidad.getIdSinNivelEntidad() == null) { statusMessages.add(Severity.ERROR, SICCAAppHelper.getBundleMessage("SinEntidad_msg_sin_nivel")); return null; } sinNivelEntidad = em.find(SinNivelEntidad.class, sinNivelEntidad.getIdSinNivelEntidad()); String page = "/planificacion/searchForms/FindNivelEntidad.xhtml?from=planificacion/searchForms/SinAnxList&codigoNivel=" + sinNivelEntidad.getNenCodigo(); if(fromToPage != null) page += "&fromToPage="+fromToPage+"&conversationPropagation=join"; return page; } // METODOS PRIVADOS private void cargarAnhoActual() { Calendar cal = Calendar.getInstance(); anhoActual = cal.get(Calendar.YEAR); } // GETTERS Y SETTERS public SinAnx getSinAnx() { return sinAnx; } public void setSinAnx(SinAnx sinAnx) { this.sinAnx = sinAnx; } public SinNivelEntidad getSinNivelEntidad() { return sinNivelEntidad; } public void setSinNivelEntidad(SinNivelEntidad sinNivelEntidad) { this.sinNivelEntidad = sinNivelEntidad; } public SinEntidad getSinEntidad() { return sinEntidad; } public void setSinEntidad(SinEntidad sinEntidad) { this.sinEntidad = sinEntidad; } public Integer getAnhoActual() { return anhoActual; } public void setAnhoActual(Integer anhoActual) { this.anhoActual = anhoActual; } public String getDescNivelEntidad() { return descNivelEntidad; } public void setDescNivelEntidad(String descNivelEntidad) { this.descNivelEntidad = descNivelEntidad; } public String getDescEntidad() { return descEntidad; } public void setDescEntidad(String descEntidad) { this.descEntidad = descEntidad; } public Boolean getFiltroSinar() { return filtroSinar; } public void setFiltroSinar(Boolean filtroSinar) { this.filtroSinar = filtroSinar; } public Long getIdSinNivelEntidad() { return idSinNivelEntidad; } public void setIdSinNivelEntidad(Long idSinNivelEntidad) { this.idSinNivelEntidad = idSinNivelEntidad; } public Long getIdSinEntidad() { return idSinEntidad; } public void setIdSinEntidad(Long idSinEntidad) { this.idSinEntidad = idSinEntidad; } public String getFromToPage() { return fromToPage; } public void setFromToPage(String fromToPage) { this.fromToPage = fromToPage; } public boolean isPrimeraEntrada() { return primeraEntrada; } public void setPrimeraEntrada(boolean primeraEntrada) { this.primeraEntrada = primeraEntrada; } }
[ "mrcperalta.mp@gmail.com" ]
mrcperalta.mp@gmail.com
4bc8b0399c852a6b82ea97e6deba66902d00892d
b094d16c7727430370154349eba49402afd73e61
/avro/JsonProperties.java
355c6da6592323b70e7f3b30f9733d20806b8458
[]
no_license
auroma/avrotest
2be9c7b6817cc1d383e8ddf80cd9759e0473b1e0
a9c89619d33ba19595b7581116609ee02a0c0020
refs/heads/master
2021-05-05T14:31:15.198476
2018-01-22T14:14:38
2018-01-22T14:14:38
118,461,477
0
0
null
null
null
null
UTF-8
Java
false
false
7,192
java
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.avro; import org.apache.avro.AvroRuntimeException; import org.codehaus.jackson.JsonGenerator; import org.codehaus.jackson.JsonNode; import org.codehaus.jackson.node.TextNode; import java.io.IOException; import java.util.Collections; import java.util.LinkedHashMap; import java.util.Map; import java.util.Set; /** * Base class for objects that have JSON-valued properties. Avro and JSON values are * represented in Java using the following mapping: * * <table> * <th> * <td>Avro type</td> * <td>JSON type</td> * <td>Java type</td> * </th> * <tr> * <td><code>null</code></td> * <td><code>null</code></td> * <td>{@link #NULL_VALUE}</td> * </tr> * <tr> * <td><code>boolean</code></td> * <td>Boolean</td> * <td><code>boolean</code></td> * </tr> * <tr> * <td><code>int</code></td> * <td>Number</td> * <td><code>int</code></td> * </tr> * <tr> * <td><code>long</code></td> * <td>Number</td> * <td><code>long</code></td> * </tr> * <tr> * <td><code>float</code></td> * <td>Number</td> * <td><code>float</code></td> * </tr> * <tr> * <td><code>double</code></td> * <td>Number</td> * <td><code>double</code></td> * </tr> * <tr> * <td><code>bytes</code></td> * <td>String</td> * <td><code>byte[]</code></td> * </tr> * <tr> * <td><code>string</code></td> * <td>String</td> * <td>{@link String}</td> * </tr> * <tr> * <td><code>record</code></td> * <td>Object</td> * <td>{@link Map}</td> * </tr> * <tr> * <td><code>enum</code></td> * <td>String</td> * <td>{@link String}</td> * </tr> * <tr> * <td><code>array</code></td> * <td>Array</td> * <td>{@link java.util.Collection}</td> * </tr> * <tr> * <td><code>map</code></td> * <td>Object</td> * <td>{@link Map}</td> * </tr> * <tr> * <td><code>fixed</code></td> * <td>String</td> * <td><code>byte[]</code></td> * </tr> * </table> * * @see org.apache.avro.data.Json */ public abstract class JsonProperties { public static class Null { private Null() {} } /** A value representing a JSON <code>null</code>. */ public static final Null NULL_VALUE = new Null(); Map<String,JsonNode> props = new LinkedHashMap<String,JsonNode>(1); private Set<String> reserved; JsonProperties(Set<String> reserved) { this.reserved = reserved; } /** * Returns the value of the named, string-valued property in this schema. * Returns <tt>null</tt> if there is no string-valued property with that name. */ public String getProp(String name) { JsonNode value = getJsonProp(name); return value != null && value.isTextual() ? value.getTextValue() : null; } /** * Returns the value of the named property in this schema. * Returns <tt>null</tt> if there is no property with that name. * @deprecated use {@link #getObjectProp(String)} */ @Deprecated public synchronized JsonNode getJsonProp(String name) { return props.get(name); } /** * Returns the value of the named property in this schema. * Returns <tt>null</tt> if there is no property with that name. */ public synchronized Object getObjectProp(String name) { return JacksonUtils.toObject(props.get(name)); } /** * Adds a property with the given name <tt>name</tt> and * value <tt>value</tt>. Neither <tt>name</tt> nor <tt>value</tt> can be * <tt>null</tt>. It is illegal to add a property if another with * the same name but different value already exists in this schema. * * @param name The name of the property to add * @param value The value for the property to add */ public void addProp(String name, String value) { addProp(name, TextNode.valueOf(value)); } /** * Adds a property with the given name <tt>name</tt> and * value <tt>value</tt>. Neither <tt>name</tt> nor <tt>value</tt> can be * <tt>null</tt>. It is illegal to add a property if another with * the same name but different value already exists in this schema. * * @param name The name of the property to add * @param value The value for the property to add * @deprecated use {@link #addProp(String, Object)} */ @Deprecated public synchronized void addProp(String name, JsonNode value) { if (reserved.contains(name)) throw new AvroRuntimeException("Can't set reserved property: " + name); if (value == null) throw new AvroRuntimeException("Can't set a property to null: " + name); JsonNode old = props.get(name); if (old == null) props.put(name, value); else if (!old.equals(value)) throw new AvroRuntimeException("Can't overwrite property: " + name); } public synchronized void addProp(String name, Object value) { addProp(name, JacksonUtils.toJsonNode(value)); } /** Return the defined properties that have string values. */ @Deprecated public Map<String,String> getProps() { Map<String,String> result = new LinkedHashMap<String,String>(); for (Map.Entry<String,JsonNode> e : props.entrySet()) if (e.getValue().isTextual()) result.put(e.getKey(), e.getValue().getTextValue()); return result; } /** Convert a map of string-valued properties to Json properties. */ Map<String,JsonNode> jsonProps(Map<String,String> stringProps) { Map<String,JsonNode> result = new LinkedHashMap<String,JsonNode>(); for (Map.Entry<String,String> e : stringProps.entrySet()) result.put(e.getKey(), TextNode.valueOf(e.getValue())); return result; } /** * Return the defined properties as an unmodifieable Map. * @deprecated use {@link #getObjectProps()} */ @Deprecated public Map<String,JsonNode> getJsonProps() { return Collections.unmodifiableMap(props); } /** Return the defined properties as an unmodifieable Map. */ public Map<String,Object> getObjectProps() { Map<String,Object> result = new LinkedHashMap<String,Object>(); for (Map.Entry<String,JsonNode> e : props.entrySet()) result.put(e.getKey(), JacksonUtils.toObject(e.getValue())); return result; } void writeProps(JsonGenerator gen) throws IOException { for (Map.Entry<String,JsonNode> e : props.entrySet()) gen.writeObjectField(e.getKey(), e.getValue()); } }
[ "amiya.mishra@bitwiseglobal.com" ]
amiya.mishra@bitwiseglobal.com
7dc47c0fde184970dfc03e8afbe34a42d4bd453f
8b04eb64502f63653b2f435e268019d42fd171e1
/alts/src/generated/main/java/io/grpc/alts/internal/ServerHandshakeParameters.java
3c733c6dd51de9154780a0d67d603731f913aa4c
[ "Apache-2.0" ]
permissive
grpc-nebula/grpc-nebula-java
de553e5d9d77dc28bb0ec78076d7dc5bd8caa41b
04f20585354e1994e70404535b048c9c188d5d95
refs/heads/master
2023-07-19T08:54:45.297237
2022-02-09T13:48:39
2022-02-09T13:48:39
188,228,592
140
63
Apache-2.0
2023-07-05T20:43:37
2019-05-23T12:20:14
Java
UTF-8
Java
false
true
38,418
java
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: grpc/gcp/handshaker.proto package io.grpc.alts.internal; /** * Protobuf type {@code grpc.gcp.ServerHandshakeParameters} */ public final class ServerHandshakeParameters extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:grpc.gcp.ServerHandshakeParameters) ServerHandshakeParametersOrBuilder { private static final long serialVersionUID = 0L; // Use ServerHandshakeParameters.newBuilder() to construct. private ServerHandshakeParameters(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { super(builder); } private ServerHandshakeParameters() { recordProtocols_ = com.google.protobuf.LazyStringArrayList.EMPTY; localIdentities_ = java.util.Collections.emptyList(); } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private ServerHandshakeParameters( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { this(); if (extensionRegistry == null) { throw new java.lang.NullPointerException(); } int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownFieldProto3( input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { java.lang.String s = input.readStringRequireUtf8(); if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) { recordProtocols_ = new com.google.protobuf.LazyStringArrayList(); mutable_bitField0_ |= 0x00000001; } recordProtocols_.add(s); break; } case 18: { if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) { localIdentities_ = new java.util.ArrayList<io.grpc.alts.internal.Identity>(); mutable_bitField0_ |= 0x00000002; } localIdentities_.add( input.readMessage(io.grpc.alts.internal.Identity.parser(), extensionRegistry)); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) { recordProtocols_ = recordProtocols_.getUnmodifiableView(); } if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) { localIdentities_ = java.util.Collections.unmodifiableList(localIdentities_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return io.grpc.alts.internal.HandshakerProto.internal_static_grpc_gcp_ServerHandshakeParameters_descriptor; } protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return io.grpc.alts.internal.HandshakerProto.internal_static_grpc_gcp_ServerHandshakeParameters_fieldAccessorTable .ensureFieldAccessorsInitialized( io.grpc.alts.internal.ServerHandshakeParameters.class, io.grpc.alts.internal.ServerHandshakeParameters.Builder.class); } public static final int RECORD_PROTOCOLS_FIELD_NUMBER = 1; private com.google.protobuf.LazyStringList recordProtocols_; /** * <pre> * The record protocols supported by the server, e.g., * "ALTSRP_GCM_AES128". * </pre> * * <code>repeated string record_protocols = 1;</code> */ public com.google.protobuf.ProtocolStringList getRecordProtocolsList() { return recordProtocols_; } /** * <pre> * The record protocols supported by the server, e.g., * "ALTSRP_GCM_AES128". * </pre> * * <code>repeated string record_protocols = 1;</code> */ public int getRecordProtocolsCount() { return recordProtocols_.size(); } /** * <pre> * The record protocols supported by the server, e.g., * "ALTSRP_GCM_AES128". * </pre> * * <code>repeated string record_protocols = 1;</code> */ public java.lang.String getRecordProtocols(int index) { return recordProtocols_.get(index); } /** * <pre> * The record protocols supported by the server, e.g., * "ALTSRP_GCM_AES128". * </pre> * * <code>repeated string record_protocols = 1;</code> */ public com.google.protobuf.ByteString getRecordProtocolsBytes(int index) { return recordProtocols_.getByteString(index); } public static final int LOCAL_IDENTITIES_FIELD_NUMBER = 2; private java.util.List<io.grpc.alts.internal.Identity> localIdentities_; /** * <pre> * (Optional) A list of local identities supported by the server, if * specified. Otherwise, the handshaker chooses a default local identity. * </pre> * * <code>repeated .grpc.gcp.Identity local_identities = 2;</code> */ public java.util.List<io.grpc.alts.internal.Identity> getLocalIdentitiesList() { return localIdentities_; } /** * <pre> * (Optional) A list of local identities supported by the server, if * specified. Otherwise, the handshaker chooses a default local identity. * </pre> * * <code>repeated .grpc.gcp.Identity local_identities = 2;</code> */ public java.util.List<? extends io.grpc.alts.internal.IdentityOrBuilder> getLocalIdentitiesOrBuilderList() { return localIdentities_; } /** * <pre> * (Optional) A list of local identities supported by the server, if * specified. Otherwise, the handshaker chooses a default local identity. * </pre> * * <code>repeated .grpc.gcp.Identity local_identities = 2;</code> */ public int getLocalIdentitiesCount() { return localIdentities_.size(); } /** * <pre> * (Optional) A list of local identities supported by the server, if * specified. Otherwise, the handshaker chooses a default local identity. * </pre> * * <code>repeated .grpc.gcp.Identity local_identities = 2;</code> */ public io.grpc.alts.internal.Identity getLocalIdentities(int index) { return localIdentities_.get(index); } /** * <pre> * (Optional) A list of local identities supported by the server, if * specified. Otherwise, the handshaker chooses a default local identity. * </pre> * * <code>repeated .grpc.gcp.Identity local_identities = 2;</code> */ public io.grpc.alts.internal.IdentityOrBuilder getLocalIdentitiesOrBuilder( int index) { return localIdentities_.get(index); } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { for (int i = 0; i < recordProtocols_.size(); i++) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, recordProtocols_.getRaw(i)); } for (int i = 0; i < localIdentities_.size(); i++) { output.writeMessage(2, localIdentities_.get(i)); } unknownFields.writeTo(output); } public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; { int dataSize = 0; for (int i = 0; i < recordProtocols_.size(); i++) { dataSize += computeStringSizeNoTag(recordProtocols_.getRaw(i)); } size += dataSize; size += 1 * getRecordProtocolsList().size(); } for (int i = 0; i < localIdentities_.size(); i++) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(2, localIdentities_.get(i)); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof io.grpc.alts.internal.ServerHandshakeParameters)) { return super.equals(obj); } io.grpc.alts.internal.ServerHandshakeParameters other = (io.grpc.alts.internal.ServerHandshakeParameters) obj; boolean result = true; result = result && getRecordProtocolsList() .equals(other.getRecordProtocolsList()); result = result && getLocalIdentitiesList() .equals(other.getLocalIdentitiesList()); result = result && unknownFields.equals(other.unknownFields); return result; } @java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (getRecordProtocolsCount() > 0) { hash = (37 * hash) + RECORD_PROTOCOLS_FIELD_NUMBER; hash = (53 * hash) + getRecordProtocolsList().hashCode(); } if (getLocalIdentitiesCount() > 0) { hash = (37 * hash) + LOCAL_IDENTITIES_FIELD_NUMBER; hash = (53 * hash) + getLocalIdentitiesList().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } public static io.grpc.alts.internal.ServerHandshakeParameters parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static io.grpc.alts.internal.ServerHandshakeParameters parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static io.grpc.alts.internal.ServerHandshakeParameters parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static io.grpc.alts.internal.ServerHandshakeParameters parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static io.grpc.alts.internal.ServerHandshakeParameters parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static io.grpc.alts.internal.ServerHandshakeParameters parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static io.grpc.alts.internal.ServerHandshakeParameters parseFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static io.grpc.alts.internal.ServerHandshakeParameters parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } public static io.grpc.alts.internal.ServerHandshakeParameters parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input); } public static io.grpc.alts.internal.ServerHandshakeParameters parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input, extensionRegistry); } public static io.grpc.alts.internal.ServerHandshakeParameters parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static io.grpc.alts.internal.ServerHandshakeParameters parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(io.grpc.alts.internal.ServerHandshakeParameters prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code grpc.gcp.ServerHandshakeParameters} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:grpc.gcp.ServerHandshakeParameters) io.grpc.alts.internal.ServerHandshakeParametersOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return io.grpc.alts.internal.HandshakerProto.internal_static_grpc_gcp_ServerHandshakeParameters_descriptor; } protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return io.grpc.alts.internal.HandshakerProto.internal_static_grpc_gcp_ServerHandshakeParameters_fieldAccessorTable .ensureFieldAccessorsInitialized( io.grpc.alts.internal.ServerHandshakeParameters.class, io.grpc.alts.internal.ServerHandshakeParameters.Builder.class); } // Construct using io.grpc.alts.internal.ServerHandshakeParameters.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3 .alwaysUseFieldBuilders) { getLocalIdentitiesFieldBuilder(); } } public Builder clear() { super.clear(); recordProtocols_ = com.google.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000001); if (localIdentitiesBuilder_ == null) { localIdentities_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000002); } else { localIdentitiesBuilder_.clear(); } return this; } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return io.grpc.alts.internal.HandshakerProto.internal_static_grpc_gcp_ServerHandshakeParameters_descriptor; } public io.grpc.alts.internal.ServerHandshakeParameters getDefaultInstanceForType() { return io.grpc.alts.internal.ServerHandshakeParameters.getDefaultInstance(); } public io.grpc.alts.internal.ServerHandshakeParameters build() { io.grpc.alts.internal.ServerHandshakeParameters result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public io.grpc.alts.internal.ServerHandshakeParameters buildPartial() { io.grpc.alts.internal.ServerHandshakeParameters result = new io.grpc.alts.internal.ServerHandshakeParameters(this); int from_bitField0_ = bitField0_; if (((bitField0_ & 0x00000001) == 0x00000001)) { recordProtocols_ = recordProtocols_.getUnmodifiableView(); bitField0_ = (bitField0_ & ~0x00000001); } result.recordProtocols_ = recordProtocols_; if (localIdentitiesBuilder_ == null) { if (((bitField0_ & 0x00000002) == 0x00000002)) { localIdentities_ = java.util.Collections.unmodifiableList(localIdentities_); bitField0_ = (bitField0_ & ~0x00000002); } result.localIdentities_ = localIdentities_; } else { result.localIdentities_ = localIdentitiesBuilder_.build(); } onBuilt(); return result; } public Builder clone() { return (Builder) super.clone(); } public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return (Builder) super.setField(field, value); } public Builder clearField( com.google.protobuf.Descriptors.FieldDescriptor field) { return (Builder) super.clearField(field); } public Builder clearOneof( com.google.protobuf.Descriptors.OneofDescriptor oneof) { return (Builder) super.clearOneof(oneof); } public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { return (Builder) super.setRepeatedField(field, index, value); } public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return (Builder) super.addRepeatedField(field, value); } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof io.grpc.alts.internal.ServerHandshakeParameters) { return mergeFrom((io.grpc.alts.internal.ServerHandshakeParameters)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(io.grpc.alts.internal.ServerHandshakeParameters other) { if (other == io.grpc.alts.internal.ServerHandshakeParameters.getDefaultInstance()) return this; if (!other.recordProtocols_.isEmpty()) { if (recordProtocols_.isEmpty()) { recordProtocols_ = other.recordProtocols_; bitField0_ = (bitField0_ & ~0x00000001); } else { ensureRecordProtocolsIsMutable(); recordProtocols_.addAll(other.recordProtocols_); } onChanged(); } if (localIdentitiesBuilder_ == null) { if (!other.localIdentities_.isEmpty()) { if (localIdentities_.isEmpty()) { localIdentities_ = other.localIdentities_; bitField0_ = (bitField0_ & ~0x00000002); } else { ensureLocalIdentitiesIsMutable(); localIdentities_.addAll(other.localIdentities_); } onChanged(); } } else { if (!other.localIdentities_.isEmpty()) { if (localIdentitiesBuilder_.isEmpty()) { localIdentitiesBuilder_.dispose(); localIdentitiesBuilder_ = null; localIdentities_ = other.localIdentities_; bitField0_ = (bitField0_ & ~0x00000002); localIdentitiesBuilder_ = com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? getLocalIdentitiesFieldBuilder() : null; } else { localIdentitiesBuilder_.addAllMessages(other.localIdentities_); } } } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } public final boolean isInitialized() { return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { io.grpc.alts.internal.ServerHandshakeParameters parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (io.grpc.alts.internal.ServerHandshakeParameters) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; private com.google.protobuf.LazyStringList recordProtocols_ = com.google.protobuf.LazyStringArrayList.EMPTY; private void ensureRecordProtocolsIsMutable() { if (!((bitField0_ & 0x00000001) == 0x00000001)) { recordProtocols_ = new com.google.protobuf.LazyStringArrayList(recordProtocols_); bitField0_ |= 0x00000001; } } /** * <pre> * The record protocols supported by the server, e.g., * "ALTSRP_GCM_AES128". * </pre> * * <code>repeated string record_protocols = 1;</code> */ public com.google.protobuf.ProtocolStringList getRecordProtocolsList() { return recordProtocols_.getUnmodifiableView(); } /** * <pre> * The record protocols supported by the server, e.g., * "ALTSRP_GCM_AES128". * </pre> * * <code>repeated string record_protocols = 1;</code> */ public int getRecordProtocolsCount() { return recordProtocols_.size(); } /** * <pre> * The record protocols supported by the server, e.g., * "ALTSRP_GCM_AES128". * </pre> * * <code>repeated string record_protocols = 1;</code> */ public java.lang.String getRecordProtocols(int index) { return recordProtocols_.get(index); } /** * <pre> * The record protocols supported by the server, e.g., * "ALTSRP_GCM_AES128". * </pre> * * <code>repeated string record_protocols = 1;</code> */ public com.google.protobuf.ByteString getRecordProtocolsBytes(int index) { return recordProtocols_.getByteString(index); } /** * <pre> * The record protocols supported by the server, e.g., * "ALTSRP_GCM_AES128". * </pre> * * <code>repeated string record_protocols = 1;</code> */ public Builder setRecordProtocols( int index, java.lang.String value) { if (value == null) { throw new NullPointerException(); } ensureRecordProtocolsIsMutable(); recordProtocols_.set(index, value); onChanged(); return this; } /** * <pre> * The record protocols supported by the server, e.g., * "ALTSRP_GCM_AES128". * </pre> * * <code>repeated string record_protocols = 1;</code> */ public Builder addRecordProtocols( java.lang.String value) { if (value == null) { throw new NullPointerException(); } ensureRecordProtocolsIsMutable(); recordProtocols_.add(value); onChanged(); return this; } /** * <pre> * The record protocols supported by the server, e.g., * "ALTSRP_GCM_AES128". * </pre> * * <code>repeated string record_protocols = 1;</code> */ public Builder addAllRecordProtocols( java.lang.Iterable<java.lang.String> values) { ensureRecordProtocolsIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll( values, recordProtocols_); onChanged(); return this; } /** * <pre> * The record protocols supported by the server, e.g., * "ALTSRP_GCM_AES128". * </pre> * * <code>repeated string record_protocols = 1;</code> */ public Builder clearRecordProtocols() { recordProtocols_ = com.google.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000001); onChanged(); return this; } /** * <pre> * The record protocols supported by the server, e.g., * "ALTSRP_GCM_AES128". * </pre> * * <code>repeated string record_protocols = 1;</code> */ public Builder addRecordProtocolsBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); ensureRecordProtocolsIsMutable(); recordProtocols_.add(value); onChanged(); return this; } private java.util.List<io.grpc.alts.internal.Identity> localIdentities_ = java.util.Collections.emptyList(); private void ensureLocalIdentitiesIsMutable() { if (!((bitField0_ & 0x00000002) == 0x00000002)) { localIdentities_ = new java.util.ArrayList<io.grpc.alts.internal.Identity>(localIdentities_); bitField0_ |= 0x00000002; } } private com.google.protobuf.RepeatedFieldBuilderV3< io.grpc.alts.internal.Identity, io.grpc.alts.internal.Identity.Builder, io.grpc.alts.internal.IdentityOrBuilder> localIdentitiesBuilder_; /** * <pre> * (Optional) A list of local identities supported by the server, if * specified. Otherwise, the handshaker chooses a default local identity. * </pre> * * <code>repeated .grpc.gcp.Identity local_identities = 2;</code> */ public java.util.List<io.grpc.alts.internal.Identity> getLocalIdentitiesList() { if (localIdentitiesBuilder_ == null) { return java.util.Collections.unmodifiableList(localIdentities_); } else { return localIdentitiesBuilder_.getMessageList(); } } /** * <pre> * (Optional) A list of local identities supported by the server, if * specified. Otherwise, the handshaker chooses a default local identity. * </pre> * * <code>repeated .grpc.gcp.Identity local_identities = 2;</code> */ public int getLocalIdentitiesCount() { if (localIdentitiesBuilder_ == null) { return localIdentities_.size(); } else { return localIdentitiesBuilder_.getCount(); } } /** * <pre> * (Optional) A list of local identities supported by the server, if * specified. Otherwise, the handshaker chooses a default local identity. * </pre> * * <code>repeated .grpc.gcp.Identity local_identities = 2;</code> */ public io.grpc.alts.internal.Identity getLocalIdentities(int index) { if (localIdentitiesBuilder_ == null) { return localIdentities_.get(index); } else { return localIdentitiesBuilder_.getMessage(index); } } /** * <pre> * (Optional) A list of local identities supported by the server, if * specified. Otherwise, the handshaker chooses a default local identity. * </pre> * * <code>repeated .grpc.gcp.Identity local_identities = 2;</code> */ public Builder setLocalIdentities( int index, io.grpc.alts.internal.Identity value) { if (localIdentitiesBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureLocalIdentitiesIsMutable(); localIdentities_.set(index, value); onChanged(); } else { localIdentitiesBuilder_.setMessage(index, value); } return this; } /** * <pre> * (Optional) A list of local identities supported by the server, if * specified. Otherwise, the handshaker chooses a default local identity. * </pre> * * <code>repeated .grpc.gcp.Identity local_identities = 2;</code> */ public Builder setLocalIdentities( int index, io.grpc.alts.internal.Identity.Builder builderForValue) { if (localIdentitiesBuilder_ == null) { ensureLocalIdentitiesIsMutable(); localIdentities_.set(index, builderForValue.build()); onChanged(); } else { localIdentitiesBuilder_.setMessage(index, builderForValue.build()); } return this; } /** * <pre> * (Optional) A list of local identities supported by the server, if * specified. Otherwise, the handshaker chooses a default local identity. * </pre> * * <code>repeated .grpc.gcp.Identity local_identities = 2;</code> */ public Builder addLocalIdentities(io.grpc.alts.internal.Identity value) { if (localIdentitiesBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureLocalIdentitiesIsMutable(); localIdentities_.add(value); onChanged(); } else { localIdentitiesBuilder_.addMessage(value); } return this; } /** * <pre> * (Optional) A list of local identities supported by the server, if * specified. Otherwise, the handshaker chooses a default local identity. * </pre> * * <code>repeated .grpc.gcp.Identity local_identities = 2;</code> */ public Builder addLocalIdentities( int index, io.grpc.alts.internal.Identity value) { if (localIdentitiesBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureLocalIdentitiesIsMutable(); localIdentities_.add(index, value); onChanged(); } else { localIdentitiesBuilder_.addMessage(index, value); } return this; } /** * <pre> * (Optional) A list of local identities supported by the server, if * specified. Otherwise, the handshaker chooses a default local identity. * </pre> * * <code>repeated .grpc.gcp.Identity local_identities = 2;</code> */ public Builder addLocalIdentities( io.grpc.alts.internal.Identity.Builder builderForValue) { if (localIdentitiesBuilder_ == null) { ensureLocalIdentitiesIsMutable(); localIdentities_.add(builderForValue.build()); onChanged(); } else { localIdentitiesBuilder_.addMessage(builderForValue.build()); } return this; } /** * <pre> * (Optional) A list of local identities supported by the server, if * specified. Otherwise, the handshaker chooses a default local identity. * </pre> * * <code>repeated .grpc.gcp.Identity local_identities = 2;</code> */ public Builder addLocalIdentities( int index, io.grpc.alts.internal.Identity.Builder builderForValue) { if (localIdentitiesBuilder_ == null) { ensureLocalIdentitiesIsMutable(); localIdentities_.add(index, builderForValue.build()); onChanged(); } else { localIdentitiesBuilder_.addMessage(index, builderForValue.build()); } return this; } /** * <pre> * (Optional) A list of local identities supported by the server, if * specified. Otherwise, the handshaker chooses a default local identity. * </pre> * * <code>repeated .grpc.gcp.Identity local_identities = 2;</code> */ public Builder addAllLocalIdentities( java.lang.Iterable<? extends io.grpc.alts.internal.Identity> values) { if (localIdentitiesBuilder_ == null) { ensureLocalIdentitiesIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll( values, localIdentities_); onChanged(); } else { localIdentitiesBuilder_.addAllMessages(values); } return this; } /** * <pre> * (Optional) A list of local identities supported by the server, if * specified. Otherwise, the handshaker chooses a default local identity. * </pre> * * <code>repeated .grpc.gcp.Identity local_identities = 2;</code> */ public Builder clearLocalIdentities() { if (localIdentitiesBuilder_ == null) { localIdentities_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000002); onChanged(); } else { localIdentitiesBuilder_.clear(); } return this; } /** * <pre> * (Optional) A list of local identities supported by the server, if * specified. Otherwise, the handshaker chooses a default local identity. * </pre> * * <code>repeated .grpc.gcp.Identity local_identities = 2;</code> */ public Builder removeLocalIdentities(int index) { if (localIdentitiesBuilder_ == null) { ensureLocalIdentitiesIsMutable(); localIdentities_.remove(index); onChanged(); } else { localIdentitiesBuilder_.remove(index); } return this; } /** * <pre> * (Optional) A list of local identities supported by the server, if * specified. Otherwise, the handshaker chooses a default local identity. * </pre> * * <code>repeated .grpc.gcp.Identity local_identities = 2;</code> */ public io.grpc.alts.internal.Identity.Builder getLocalIdentitiesBuilder( int index) { return getLocalIdentitiesFieldBuilder().getBuilder(index); } /** * <pre> * (Optional) A list of local identities supported by the server, if * specified. Otherwise, the handshaker chooses a default local identity. * </pre> * * <code>repeated .grpc.gcp.Identity local_identities = 2;</code> */ public io.grpc.alts.internal.IdentityOrBuilder getLocalIdentitiesOrBuilder( int index) { if (localIdentitiesBuilder_ == null) { return localIdentities_.get(index); } else { return localIdentitiesBuilder_.getMessageOrBuilder(index); } } /** * <pre> * (Optional) A list of local identities supported by the server, if * specified. Otherwise, the handshaker chooses a default local identity. * </pre> * * <code>repeated .grpc.gcp.Identity local_identities = 2;</code> */ public java.util.List<? extends io.grpc.alts.internal.IdentityOrBuilder> getLocalIdentitiesOrBuilderList() { if (localIdentitiesBuilder_ != null) { return localIdentitiesBuilder_.getMessageOrBuilderList(); } else { return java.util.Collections.unmodifiableList(localIdentities_); } } /** * <pre> * (Optional) A list of local identities supported by the server, if * specified. Otherwise, the handshaker chooses a default local identity. * </pre> * * <code>repeated .grpc.gcp.Identity local_identities = 2;</code> */ public io.grpc.alts.internal.Identity.Builder addLocalIdentitiesBuilder() { return getLocalIdentitiesFieldBuilder().addBuilder( io.grpc.alts.internal.Identity.getDefaultInstance()); } /** * <pre> * (Optional) A list of local identities supported by the server, if * specified. Otherwise, the handshaker chooses a default local identity. * </pre> * * <code>repeated .grpc.gcp.Identity local_identities = 2;</code> */ public io.grpc.alts.internal.Identity.Builder addLocalIdentitiesBuilder( int index) { return getLocalIdentitiesFieldBuilder().addBuilder( index, io.grpc.alts.internal.Identity.getDefaultInstance()); } /** * <pre> * (Optional) A list of local identities supported by the server, if * specified. Otherwise, the handshaker chooses a default local identity. * </pre> * * <code>repeated .grpc.gcp.Identity local_identities = 2;</code> */ public java.util.List<io.grpc.alts.internal.Identity.Builder> getLocalIdentitiesBuilderList() { return getLocalIdentitiesFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilderV3< io.grpc.alts.internal.Identity, io.grpc.alts.internal.Identity.Builder, io.grpc.alts.internal.IdentityOrBuilder> getLocalIdentitiesFieldBuilder() { if (localIdentitiesBuilder_ == null) { localIdentitiesBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< io.grpc.alts.internal.Identity, io.grpc.alts.internal.Identity.Builder, io.grpc.alts.internal.IdentityOrBuilder>( localIdentities_, ((bitField0_ & 0x00000002) == 0x00000002), getParentForChildren(), isClean()); localIdentities_ = null; } return localIdentitiesBuilder_; } public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFieldsProto3(unknownFields); } public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); } // @@protoc_insertion_point(builder_scope:grpc.gcp.ServerHandshakeParameters) } // @@protoc_insertion_point(class_scope:grpc.gcp.ServerHandshakeParameters) private static final io.grpc.alts.internal.ServerHandshakeParameters DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new io.grpc.alts.internal.ServerHandshakeParameters(); } public static io.grpc.alts.internal.ServerHandshakeParameters getDefaultInstance() { return DEFAULT_INSTANCE; } private static final com.google.protobuf.Parser<ServerHandshakeParameters> PARSER = new com.google.protobuf.AbstractParser<ServerHandshakeParameters>() { public ServerHandshakeParameters parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new ServerHandshakeParameters(input, extensionRegistry); } }; public static com.google.protobuf.Parser<ServerHandshakeParameters> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<ServerHandshakeParameters> getParserForType() { return PARSER; } public io.grpc.alts.internal.ServerHandshakeParameters getDefaultInstanceForType() { return DEFAULT_INSTANCE; } }
[ "cozyshu@qq.com" ]
cozyshu@qq.com
03a93a08368623fa7bce495b21016326dec931d8
dc793abf9ad9f401957ff0fc378cc3e219d94ed7
/src/main/java/de/beosign/quizzer/model/User.java
7ed68b0db66dbf7f986d371119ab2b85c16a25c3
[]
no_license
beosign/quizzer
2d68bed132a77706f408d85e84f59f491b660ee6
33fc2d8fa117efda491435bd11425cf6096dd05f
refs/heads/master
2016-09-10T19:17:57.306795
2015-08-21T08:56:53
2015-08-21T08:56:53
40,074,511
0
0
null
null
null
null
UTF-8
Java
false
false
756
java
package de.beosign.quizzer.model; import javax.persistence.Entity; import javax.persistence.Id; import javax.validation.constraints.NotNull; @Entity public class User { private String login; private String firstName; private String lastName; @NotNull @Id public String getLogin() { return login; } public void setLogin(String login) { this.login = login; } @NotNull public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } @NotNull public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } }
[ "florian.dahlmanns@freenet.de" ]
florian.dahlmanns@freenet.de
3b92cea26dde28229b1802f42e391ea129b51966
43f4bd6e5592c4884b54d2ef5a5f74ed0d11c79b
/app/src/main/java/com/smarthane/android/mvp/model/MainModel.java
4b45c36e4ac3470ed4d1646aaf80355aa3d0920a
[]
no_license
smarthane/smartframework-android
c3f8b82780ebb504f1aac81891fb4e37b5251602
634bc3d3c62f3ce66fa6696d70fbff34101ce9f4
refs/heads/master
2021-08-30T20:11:55.218280
2017-12-19T08:48:26
2017-12-19T08:48:26
112,591,132
23
1
null
null
null
null
UTF-8
Java
false
false
1,233
java
package com.smarthane.android.mvp.model; import android.app.Application; import com.google.gson.Gson; import com.jess.arms.integration.IRepositoryManager; import com.jess.arms.mvp.BaseModel; import com.jess.arms.di.scope.ActivityScope; import javax.inject.Inject; import com.smarthane.android.mvp.contract.MainContract; import com.smarthane.android.mvp.model.api.service.CommonService; import com.smarthane.android.mvp.model.entity.GankEntity; import io.reactivex.Observable; @ActivityScope public class MainModel extends BaseModel implements MainContract.Model { private Gson mGson; private Application mApplication; @Inject public MainModel(IRepositoryManager repositoryManager, Gson gson, Application application) { super(repositoryManager); this.mGson = gson; this.mApplication = application; } @Override public void onDestroy() { super.onDestroy(); this.mGson = null; this.mApplication = null; } @Override public Observable<GankEntity> getRandomGirl() { Observable<GankEntity> randomGirl = mRepositoryManager.obtainRetrofitService(CommonService.class) .getRandomGirl(); return randomGirl; } }
[ "leeyh.lee@zkteco.com" ]
leeyh.lee@zkteco.com
fbcd80320f1d5fbf3a7ae48afb7ee0c16aec2b13
c9baffd961b140ea137c7dc482850b341d7ed6aa
/src/main/java/edu/upc/dsa/models/User.java
9021bcf296e0532995fd908803fd4ffe92743a7c
[]
no_license
eperezcosano/DSA_Min1
ce17400b8afd1e22fff204c1c279dc00f5594872
e14ef5420df998ab37927a1aa9eff88b57456b36
refs/heads/master
2023-01-05T10:00:13.283590
2020-11-05T11:27:56
2020-11-05T11:27:56
180,572,559
0
0
null
2020-11-05T11:27:57
2019-04-10T12:02:20
Java
UTF-8
Java
false
false
1,634
java
package edu.upc.dsa.models; import java.util.LinkedList; import java.util.List; public class User { //Attributes private String idUser; private String name; private String surname; private List<Playlist> playlists; //Constructors public User() { } public User(String idUser, String name, String surname) { this.idUser = idUser; this.name = name; this.surname = surname; this.playlists = new LinkedList<>(); } //Methods @Override public String toString() { String string = "[id: " + idUser + ", " + "Name: " + name + ", " + "Surname: " + surname + " , " + "Playlists: "; for (Playlist playlist : playlists) { string += playlist.getTitle() + ", "; } string += "]"; return string; } public void addPlaylist(Playlist playlist) { this.playlists.add(playlist); } //Getters and setters public String getIdUser() { return idUser; } public void setIdUser(String idUser) { this.idUser = idUser; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getSurname() { return surname; } public void setSurname(String surname) { this.surname = surname; } public List<Playlist> getPlaylists() { return playlists; } public void setPlaylists(List<Playlist> playlists) { this.playlists = playlists; } }
[ "izanperez98@gmail.com" ]
izanperez98@gmail.com
56eab8363abaf20bf1dfb34202330faa401b65bd
68c8e5ad7a1d262867179ac1a45212ee4ca9fce8
/src 2/main/java/com/jwere/swingy/model/artifact/Helm.java
1718c94631310bc10afe90ab9865486b281db9b9
[]
no_license
jwere/swingy
d5a1b1ec500723cc53454d2760708302549049f1
f58fd6e2e74301455beeaebd89ad3f45460a14e7
refs/heads/master
2023-05-27T06:55:54.826735
2020-04-15T17:20:36
2020-04-15T17:20:36
205,657,681
0
0
null
2023-05-23T20:18:14
2019-09-01T09:53:06
Java
UTF-8
Java
false
false
156
java
package com.jwere.swingy.model.artifact; public class Helm extends Artifact{ public Helm(String name, int points){ super(name, points); } }
[ "jimmywere@Jimmys-MacBook-Pro.local" ]
jimmywere@Jimmys-MacBook-Pro.local
c1564456c736c7bdcb5ec4ab7b40cdfefb5b9bb3
732a6fa36e14baf7f828ef19a62b515312f9a109
/channels/trunk/src/main/java/com/mindalliance/channels/pages/components/help/HelpAjaxBehavior.java
a17456f49be65d31348c39225fad9bbd723e543c
[]
no_license
gauravbvt/test
4e991ad3e7dd5ea670ab88f3a74fe8a42418ec20
04e48c87ff5c2209fc4bc703795be3f954909c3a
refs/heads/master
2020-11-24T02:43:32.565109
2014-10-07T23:47:39
2014-10-07T23:47:39
100,468,202
0
0
null
null
null
null
UTF-8
Java
false
false
13,176
java
package com.mindalliance.channels.pages.components.help; import com.mindalliance.channels.core.nlp.SemanticMatcher; import com.mindalliance.channels.core.util.ChannelsUtils; import com.mindalliance.channels.engine.imaging.ImagingService; import com.mindalliance.channels.guide.Guide; import com.mindalliance.channels.guide.Topic; import com.mindalliance.channels.guide.TopicItem; import com.mindalliance.channels.guide.UserRole; import info.bliki.wiki.model.WikiModel; import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior; import org.apache.wicket.markup.ComponentTag; import java.io.BufferedReader; import java.io.IOException; import java.io.StringReader; import java.text.MessageFormat; import java.util.Map; import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * Copyright (C) 2008-2013 Mind-Alliance Systems. All Rights Reserved. * Proprietary and Confidential. * User: jf * Date: 1/15/14 * Time: 11:29 AM */ public abstract class HelpAjaxBehavior extends AbstractDefaultAjaxBehavior { public static final String IMAGE_PARAM = "image"; public static final String CAPTION_PARAM = "caption"; public static final String THUMBNAIL_CLASS = "thumbnail"; public static final String DEFINITION_CLASS = "definition"; public static final String SECTION_PARAM = "section"; public static final String TOPIC_PARAM = "topic"; // Group 1 = path to image file, 2 = image file name, 3= caption private static final Pattern IIMAGE_PATTERN = Pattern.compile( "<div\\s.*>\\n*\\s*<img src=\"images/([^\"]+/)(\\w+.\\w+)\".*alt=\"([^\"]*)\".*>\\n*\\s*</div>" ); private static final String GLOSSARY_TERM_PATTERN_FORMAT = "(\\W)({0})(\\W)"; private Guide guide; private UserRole userRole; private String topicId; private TopicItem topicItem; private StringBuilder htmlBuilder; private Map<String, String[]> glossary; private ImagingService imagingService; public HelpAjaxBehavior( StringBuilder htmlBuilder, Guide guide, UserRole userRole, String topicId, TopicItem topicItem, Map<String, String[]> glossary, ImagingService imagingService ) { this.guide = guide; this.userRole = userRole; this.topicId = topicId; this.topicItem = topicItem; this.htmlBuilder = htmlBuilder; this.glossary = glossary; this.imagingService = imagingService; } @Override protected void onComponentTag( ComponentTag tag ) { super.onComponentTag( tag ); htmlBuilder.append( wikimediaToHtml( topicItem.getDescription() ) ); } private String wikimediaToHtml( String string ) { String content = trimAllLines( string ); WikiModel wikiModel = new WikiModel( "images/doc/${image}", "" ); String html = wikiModel.render( content ); return processGlossary( processImages( html ) ); } private String processGlossary( String html ) { Set<String> terms = glossary.keySet(); for ( String term : terms ) { if ( term.matches( "[\\w\\s-]*" ) ) { // make sure it is a valid glossary term if ( !glossary.get( term )[1].equals( topicId ) ) // don't link a glossary term in itw own definition html = processGlossaryTerm( html, term ); } } return html; } private String processGlossaryTerm( String html, String term ) { StringBuilder sb = new StringBuilder(); int cursor = 0; String patternString = MessageFormat.format( GLOSSARY_TERM_PATTERN_FORMAT, makeTermRegex( term ) ); Pattern pattern = Pattern.compile( patternString, Pattern.CASE_INSENSITIVE ); Matcher matcher = pattern.matcher( html ); while ( matcher.find() ) { int begin = matcher.start(); int end = matcher.end(); if ( insideMarker( html, end ) ) { sb.append( html.substring( cursor, end ) ); } else { String[] glossaryEntry = glossary.get( term ); String glossarySectionId = glossaryEntry[0]; String glossaryTopicId = glossaryEntry[1]; Topic glossaryTopic = guide.findTopic( userRole, glossarySectionId, glossaryTopicId ); String glossaryTopicLink = makeGlossaryTopicLink( glossarySectionId, glossaryTopic, matcher.group( 2 ) ); sb.append( html.substring( cursor, begin ) ) .append( matcher.group( 1 ) ) .append( glossaryTopicLink ) .append( matcher.group( 3 ) ); } cursor = end; } sb.append( html.substring( cursor ) ); return sb.toString(); } private String makeTermRegex( String term ) { StringBuilder sb = new StringBuilder(); String[] words = term.split( " " ); for ( int i = 0; i < words.length; i++ ) { String word = words[i]; if ( com.mindalliance.channels.core.Matcher.same( "medium", word ) ) { sb.append( word ); sb.append( "|media" ); } else if ( word.endsWith( "y" ) ) { // sb.append( "(" ); sb.append( word ); sb.append( "|" ); sb.append( word.substring( 0, word.length() - 1 ) ).append( "ies" ); // sb.append( ")" ); } else if ( word.endsWith( "s" ) ) { sb.append( word ); } else { sb.append( word ) .append( "s?" ); } if ( i < words.length - 1 ) { sb.append( " " ); } } return sb.toString(); } private boolean insideMarker( String html, int end ) { int closeIndex = html.indexOf( ">", end ); int openIndex = html.indexOf( "<", end ); return closeIndex >= 0 && closeIndex < openIndex; } private String makeGlossaryTopicLink( String glossarySectionId, Topic glossaryTopic, String match ) { StringBuilder sb = new StringBuilder(); TopicItem definitionItem = glossaryTopic.getTopicItems().get( 0 ); String itemSpan = "<span title=\"" + firstParagraphOf( definitionItem.getDescription() ) + "\">" + match + "</span>"; sb.append( "<span class=\"" ).append( DEFINITION_CLASS ).append( "\">" ) .append( "<a href=\"" ) .append( makeGlossaryCallback( glossarySectionId, glossaryTopic.getId() ) ) .append( "\">" ) .append( itemSpan ) .append( "</a></span>" ); return sb.toString(); } private String firstParagraphOf( String string ) { StringBuilder sb = new StringBuilder(); BufferedReader reader = new BufferedReader( new StringReader( string ) ); int emptyLineCount = 0; try { String line; while ( emptyLineCount < 2 && ( line = reader.readLine() ) != null ) { String trimmed = line.trim(); if ( trimmed.isEmpty() ) { emptyLineCount++; sb.append( " " ); } else { sb.append( trimmed ).append( " " ); } } } catch ( IOException e ) { // do nothing } finally { try { reader.close(); } catch ( IOException e ) { // do nothing } } return sb.toString().trim(); } private String processImages( String html ) { StringBuilder sb = new StringBuilder(); // replace images elements by callback links surrounding thumbnails Matcher matcher = IIMAGE_PATTERN.matcher( html ); int cursor = 0; while ( matcher.find() ) { int begin = matcher.start(); int end = matcher.end(); String imagePath = matcher.group( 1 ); // path under images/ e.g. images/doc/bla.png => doc/ String imageName = matcher.group( 2 ); // file name with extension String caption = matcher.group( 3 ); String imageLink = makeImageLink( imagePath, imageName, caption ); sb.append( html.substring( cursor, begin ) ) .append( imageLink ); cursor = end; } sb.append( html.substring( cursor ) ); return sb.toString(); } private String makeImageLink( String imagePath, String imageName, String caption ) { StringBuilder sb = new StringBuilder(); int[] size = imagingService.getImageSize( imagePath, imageName ); int width = size[0]; int height = size[1]; if ( width != 0 && height != 0 ) { if ( height <= ImagingService.THUMBNAIL_HEIGHT ) { // Use image as is, no link to full image sb.append( "<span class=\"" ) .append( THUMBNAIL_CLASS ) .append( "\">" ) .append( "<img src=\"images/" ) .append( imagePath ) .append( "/" ) .append( imageName ) .append( "\" alt=\"" ) .append( caption ) .append( "\" title=\"" ) .append( caption ) .append( "\"/>" ) .append( "</span>" ); } else { // Use thumbnail linked to full image sb.append( "<span class=\"" ) .append( THUMBNAIL_CLASS ) .append( "\">" ) .append( "<a href=\"" ) .append( makeCallback( imagePath, imageName, caption ) ) .append( "\">" ) .append( "<img src=\"" ) .append( getThumbNail( imagePath, imageName ) ) .append( "\" alt=\"" ) .append( caption ) .append( "\" title=\"" ) .append( caption ) .append( "\"/>" ) .append( "</a>" ) .append( "</span>" ); } } return sb.toString(); } private String makeGlossaryCallback( String glossarySectionId, String glossaryTopicId ) { StringBuilder scriptBuilder = new StringBuilder(); scriptBuilder.append( "wicketAjaxGet('" ) .append( getCallbackUrl() ) .append( "&" ).append( SECTION_PARAM ).append( "=" ).append( glossarySectionId ).append( "" ) .append( "&" ).append( TOPIC_PARAM ).append( "=" ).append( glossaryTopicId ).append( "" ); scriptBuilder.append( "'" ); String script = scriptBuilder.toString(); CharSequence callbackScript = generateCallbackScript( script ); StringBuilder callbackBuilder = new StringBuilder(); callbackBuilder.append( "javascript:" ) .append( callbackScript ); return callbackBuilder.toString().replaceAll( "&amp;", "&" ); } private String makeCallback( String imagePath, String imageName, String caption ) { StringBuilder scriptBuilder = new StringBuilder(); scriptBuilder.append( "wicketAjaxGet('" ) .append( getCallbackUrl() ) .append( "&" ).append( IMAGE_PARAM ).append( "=" ).append( "images/" ).append( imagePath ).append( imageName ).append( "" ) .append( "&" ).append( CAPTION_PARAM ).append( "=" ).append( ChannelsUtils.sanitize( caption ) ).append( "" ); scriptBuilder.append( "'" ); String script = scriptBuilder.toString(); CharSequence callbackScript = generateCallbackScript( script ); StringBuilder callbackBuilder = new StringBuilder(); callbackBuilder.append( "javascript:" ) .append( callbackScript ); return callbackBuilder.toString().replaceAll( "&amp;", "&" ); } private String getThumbNail( String imagePath, String imageName ) { return "images/" + imagingService.getThumbnailPath( imagePath, imageName ); } private String trimAllLines( String string ) { StringBuilder sb = new StringBuilder(); BufferedReader reader = new BufferedReader( new StringReader( string ) ); try { String line; while ( ( line = reader.readLine() ) != null ) { sb.append( line.trim() ); sb.append( '\n' ); } } catch ( IOException e ) { // do nothing } finally { try { reader.close(); } catch ( IOException e ) { // do nothing } } return sb.toString(); } }
[ "jf@baad322d-9929-0410-88f0-f92e8ff3e1bd" ]
jf@baad322d-9929-0410-88f0-f92e8ff3e1bd
dc25009eb535d08a7a1ff28523c446407e047294
3c019a6a77b75a403bb5469d6325a3dfd9080a5e
/client/src/main/java/com/open/im/client/config/ChatClientProperties.java
35394cb3e0a5ee4c1dbb9dcee0555e4519394f9f
[]
no_license
rottenmu/chat
c357d7363070ad686f8ec10d29d7e942f5dd85ef
802b90365a0b6582c52f20b166a865b493771325
refs/heads/main
2023-08-16T09:56:47.606443
2021-09-27T09:41:09
2021-09-27T09:41:09
395,495,310
2
0
null
null
null
null
UTF-8
Java
false
false
969
java
package com.open.im.client.config; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Configuration; import java.io.Serializable; /** * <p>Title: OpenIm</p> * <p>Description: OpenIm</p> * <p>Copyright: Copyright (c) 2017-2050</p> * * @author rotten * @version 1.0 */ @Configuration @ConfigurationProperties(prefix = "client") public class ChatClientProperties implements Serializable { private String id; private String phone; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } @Override public String toString() { return "ChatClientProperties{" + "id='" + id + '\'' + ", phone='" + phone + '\'' + '}'; } }
[ "897976909@qq.com" ]
897976909@qq.com
910921f1760876b4ff600e64c9e3c5b5a10fdf94
4289fd0a013983fa10c2ee416fe091f16f7ab810
/src/org/droid2droid/ui/Notifications.java
f64f96257c87ab32028cd7b5459d894f416d336e
[ "Apache-2.0" ]
permissive
pprados/droid2droid.droid2droid
3d23fe8f220814ee387382568d5c5a3f4ffde2af
09ddc1fd4372f4ccae818f4d6b89ddcc71e1d884
refs/heads/master
2020-06-04T20:07:24.464716
2012-08-29T08:03:34
2012-08-29T08:03:34
32,317,746
0
0
null
null
null
null
UTF-8
Java
false
false
17,229
java
/****************************************************************************** * * droid2droid - Distributed Android Framework * ========================================== * * Copyright (C) 2012 by Atos (http://www.http://atos.net) * http://www.droid2droid.org * ****************************************************************************** * * 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.droid2droid.ui; import static org.droid2droid.Constants.SHOW_FINAL_NOTIF_AFTER_DOWNLOAD; import java.security.PrivilegedAction; import org.droid2droid.Constants; import org.droid2droid.R; import org.droid2droid.binder.AbstractSrvRemoteAndroid.DownloadFile; import org.droid2droid.install.DownloadApkActivity; import org.droid2droid.service.RemoteAndroidService; import android.annotation.TargetApi; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.app.Service; import android.content.Context; import android.content.Intent; import android.os.Build.VERSION; import android.os.Build.VERSION_CODES; import android.widget.RemoteViews; public final class Notifications { public static final String LABEL_NOTIF_DOWNLOAD="download"; private final Context mContext; public final NotificationManager mNotificationMgr; private int mInboundSuccNumber; private int mInboundFailNumber; public static final String EXTRA_ID="id"; private static final int ONGOING_NOTIFICATION=-1000001; private static int NOTIFICATION_ID_INBOUND=-1000006; private static int NOTIFICATION_INSTALL=-1000007; /** * Helper function to build the progress text. */ public static String formatProgressText(long totalBytes, long currentBytes) { if (totalBytes <= 0) { return "0%"; } long progress = currentBytes * 100 / totalBytes; return new StringBuilder() .append(progress) .append('%') .toString(); } public Notifications(Context context) { mContext=context; mNotificationMgr = (NotificationManager)mContext.getSystemService(Context.NOTIFICATION_SERVICE); } @SuppressWarnings("deprecation") public void serviceShow(final Service service) { Intent notificationIntent = new Intent(mContext, EditPreferenceActivity.class); Notification notification=null; // deprecated if (VERSION.SDK_INT>VERSION_CODES.ECLAIR_0_1) { new Runnable() { @Override public void run() { mNotificationMgr.cancel(LABEL_NOTIF_DOWNLOAD,NOTIFICATION_ID_INBOUND); } }.run(); } else mNotificationMgr.cancel(NOTIFICATION_ID_INBOUND); if (VERSION.SDK_INT<VERSION_CODES.HONEYCOMB) { notification = new Notification( R.drawable.ic_stat_droid2droid, mContext.getText(R.string.service_start_ticker), System.currentTimeMillis()); } else { notification=new PrivilegedAction<Notification>() { @TargetApi(11) @Override public Notification run() { return new Notification.Builder(mContext) .setSmallIcon(R.drawable.ic_stat_droid2droid) .setTicker(mContext.getText(R.string.service_start_ticker)) .setWhen(System.currentTimeMillis()) .getNotification(); } }.run(); } notification.setLatestEventInfo(mContext, mContext.getText(R.string.service_start_title), mContext.getText(R.string.service_start_message), PendingIntent.getActivity(mContext, 0, notificationIntent, 0)); final Notification fnotification=notification; new Runnable() { @Override public void run() { service.startForeground(ONGOING_NOTIFICATION, fnotification); } }.run(); } //---------------- // TODO: For 1.6 compatibility // private NotificationManager mNM; // private Method mSetForeground; // private Method mStartForeground; // private Method mStopForeground; // private Object[] sSetForegroundArgs = new Object[1]; // private Object[] mStartForegroundArgs = new Object[2]; // private Object[] mStopForegroundArgs = new Object[1]; // // void initStartForegroundCompat() // { // mNM = (NotificationManager)mContext.getSystemService(Context.NOTIFICATION_SERVICE); // try // { // mStartForeground = getClass().getMethod("startForeground",mStartForegroundSignature); // mStopForeground = getClass().getMethod("stopForeground",mStopForegroundSignature); // return; // } // catch (NoSuchMethodException e) // { // // Running on an older platform. // mStartForeground = mStopForeground = null; // } // try // { // mSetForeground = getClass().getMethod("setForeground",mSetForegroundSignature); // } // catch (NoSuchMethodException e) // { // // Should not happen. // throw new IllegalStateException("OS doesn't have Service.startForeground OR Service.setForeground!"); // } // } // // private void invokeMethod(Method method, Object[] args) // { // try // { // method.invoke(this, args); // } // catch (InvocationTargetException e) // { // // Should not happen. // if (W) Log.w(TAG_SERVER_BIND,"Unable to invoke method", e); // } // catch (IllegalAccessException e) // { // // Should not happen. // if (W) Log.w(TAG_SERVER_BIND, "Unable to invoke method", e); // } // } // // /** // * This is a wrapper around the new startForeground method, using the older // * APIs if it is not available. // */ // void startForegroundCompat(int id, Notification notification) // { // // If we have the new startForeground API, then use it. // if (mStartForeground != null) { // mStartForegroundArgs[0] = Integer.valueOf(id); // mStartForegroundArgs[1] = notification; // invokeMethod(mStartForeground, mStartForegroundArgs); // return; // } // // // Fall back on the old API. // mSetForegroundArgs[0] = Boolean.TRUE; // invokeMethod(mSetForeground, mSetForegroundArgs); // mNM.notify(id, notification); // } // // /** // * This is a wrapper around the new stopForeground method, using the older // * APIs if it is not available. // */ // void stopForegroundCompat(int id) // { // // If we have the new stopForeground API, then use it. // if (mStopForeground != null) { // mStopForegroundArgs[0] = Boolean.TRUE; // invokeMethod(mStopForeground, mStopForegroundArgs); // return; // } // // // Fall back on the old API. Note to cancel BEFORE changing the // // foreground state, since we could be killed at that point. // mNM.cancel(id); // mSetForegroundArgs[0] = Boolean.FALSE; // invokeMethod(mSetForeground, mSetForegroundArgs); // } //---------------- public void serviceCancel() { mNotificationMgr.cancel(NOTIFICATION_ID_INBOUND); } @SuppressWarnings("deprecation") @TargetApi(11) public void incomingApk(int id,String label,Intent intent,Intent cancelIntent) { String title = mContext.getString(R.string.incoming_apk_confirm_title,label); String caption = mContext.getString(R.string.incoming_apk_confirm_caption); Notification notification; if (VERSION.SDK_INT<VERSION_CODES.HONEYCOMB) { notification = new Notification(); notification.icon = R.drawable.ic_stat_notify_incomming_file; notification.flags |= Notification.FLAG_ONLY_ALERT_ONCE|Notification.FLAG_AUTO_CANCEL; notification.setLatestEventInfo(mContext, title, caption, PendingIntent.getActivity(mContext, 0, intent, 0)); notification.defaults = Notification.DEFAULT_ALL; notification.tickerText = title; notification.when = System.currentTimeMillis(); notification.deleteIntent=PendingIntent.getService(mContext, 0, cancelIntent, 0); } else { notification=new Notification.Builder(mContext) .setSmallIcon(R.drawable.ic_stat_notify_incomming_file) .setOnlyAlertOnce(true) .setAutoCancel(true) // TODO notification.setLatestEventInfo(mContext, title, caption, PendingIntent.getActivity(mContext, 0, intent, 0)); .setDefaults(Notification.DEFAULT_ALL) .setTicker(title) .setWhen(System.currentTimeMillis()) .setDeleteIntent(PendingIntent.getService(mContext, 0, cancelIntent, 0)) .getNotification(); } mNotificationMgr.notify(id, notification); } @SuppressWarnings("deprecation") @TargetApi(11) public void autoinstall(String label) { Notification notification; if (VERSION.SDK_INT<VERSION_CODES.HONEYCOMB) { notification = new Notification(); notification.icon = android.R.drawable.stat_sys_download; notification.setLatestEventInfo(mContext,label,mContext.getString(R.string.autoinstall_caption),PendingIntent.getService(mContext, 0, null, 0)); notification.when = System.currentTimeMillis(); notification.flags=Notification.FLAG_AUTO_CANCEL; notification.tickerText=mContext.getString(R.string.autoinstall_ticket,label); } else { notification=new Notification.Builder(mContext) .setSmallIcon(android.R.drawable.stat_sys_download) .setWhen(System.currentTimeMillis()) .setTicker(mContext.getString(R.string.autoinstall_ticket,label)) .setAutoCancel(true) // FIXME notification.setLatestEventInfo(mContext,label,mContext.getString(R.string.autoinstall_caption),PendingIntent.getService(mContext, 0, null, 0)); .getNotification(); } mNotificationMgr.notify(NOTIFICATION_INSTALL, notification); } @TargetApi(11) @SuppressWarnings("deprecation") public void install(String label,boolean success) { Notification notification; if (success) { if (VERSION.SDK_INT<VERSION_CODES.HONEYCOMB) { notification = new Notification(); notification.setLatestEventInfo(mContext,label,mContext.getString(R.string.installed_success_caption),PendingIntent.getService(mContext, 0, null, 0)); notification.icon = R.drawable.ic_stat_notify_install_complete; notification.when = System.currentTimeMillis(); notification.flags=Notification.FLAG_AUTO_CANCEL; notification.tickerText=mContext.getString(R.string.installed_success_ticket,label); } else { notification=new Notification.Builder(mContext) .setSmallIcon(R.drawable.ic_stat_notify_install_complete) // FIXME notification.setLatestEventInfo(mContext,label,mContext.getString(R.string.installed_success_caption),PendingIntent.getService(mContext, 0, null, 0)); .setWhen(System.currentTimeMillis()) .setAutoCancel(true) .setTicker(mContext.getString(R.string.installed_success_ticket,label)) .getNotification(); } mNotificationMgr.notify(NOTIFICATION_INSTALL, notification); } else { if (VERSION.SDK_INT<VERSION_CODES.HONEYCOMB) { notification = new Notification(); notification.icon = android.R.drawable.stat_sys_warning; notification.setLatestEventInfo(mContext,label,mContext.getString(R.string.installed_fail_caption),PendingIntent.getService(mContext, 0, null, 0)); notification.when = System.currentTimeMillis(); notification.flags=Notification.FLAG_AUTO_CANCEL; notification.tickerText=mContext.getString(R.string.installed_fail_ticket,label); } else { notification=new Notification.Builder(mContext) .setSmallIcon(android.R.drawable.stat_sys_warning) // FIXME: notification.setLatestEventInfo(mContext,label,mContext.getString(R.string.installed_fail_caption),PendingIntent.getService(mContext, 0, null, 0)); .setWhen(System.currentTimeMillis()) .setAutoCancel(true) .setTicker(mContext.getString(R.string.installed_fail_ticket,label)) .getNotification(); } mNotificationMgr.notify(NOTIFICATION_INSTALL, notification); } } public void clearDownloads() { mInboundFailNumber=mInboundSuccNumber=0; if (mNotificationMgr == null) return; if (VERSION.SDK_INT>VERSION_CODES.ECLAIR_0_1) { new Runnable() { @Override public void run() { mNotificationMgr.cancel(LABEL_NOTIF_DOWNLOAD,NOTIFICATION_ID_INBOUND); } }.run(); } else mNotificationMgr.cancel(NOTIFICATION_ID_INBOUND); } public void finishDownload(final DownloadFile df,boolean status) { if (mNotificationMgr == null) return; if (VERSION.SDK_INT>VERSION_CODES.ECLAIR_0_1) { new Runnable() { @Override public void run() { mNotificationMgr.cancel(LABEL_NOTIF_DOWNLOAD,df.id); } }.run(); } else mNotificationMgr.cancel(df.id); if (status) mInboundSuccNumber++; else mInboundFailNumber++; if (!SHOW_FINAL_NOTIF_AFTER_DOWNLOAD) { if (mInboundFailNumber==0) return; } long timeStamp=System.currentTimeMillis(); Intent intent = new Intent(mContext,RemoteAndroidService.class); intent.setAction(Constants.ACTION_COMPLETE_HIDE); Notification inNoti = new Notification(); if (status) { inNoti.icon = android.R.drawable.stat_sys_download_done; inNoti.tickerText=mContext.getString(R.string.finish_download_ok_ticket,df.label); } else { inNoti.icon = android.R.drawable.stat_sys_warning; inNoti.tickerText=mContext.getString(R.string.finish_download_fail_ticket,df.label); } inNoti.setLatestEventInfo(mContext, mContext.getString(R.string.finish_download_title), mContext.getString(R.string.finish_download_caption, mInboundSuccNumber,mInboundFailNumber), PendingIntent.getService(mContext, 0, intent, 0)); inNoti.deleteIntent = PendingIntent.getService(mContext, 0, intent, 0); inNoti.when = timeStamp; inNoti.flags=Notification.FLAG_AUTO_CANCEL; mNotificationMgr.notify(NOTIFICATION_ID_INBOUND, inNoti); } public void updateDownload(final DownloadFile df) { if (mNotificationMgr == null) return; final long now=System.currentTimeMillis(); if ((df.lastNotification!=0) && ((now-df.lastNotification)<1000)) // Too quickly return; df.lastNotification=now; RemoteViews expandedView = new RemoteViews(mContext.getPackageName(),R.layout.status_bar_ongoing_event_progress_bar); expandedView.setTextViewText(R.id.description, mContext.getString(R.string.update_download_title,df.label)); int total=1000; int progress = (int)(df.progress * total / df.size); expandedView.setProgressBar(R.id.progress_bar, total,progress, total == -1); expandedView.setTextViewText(R.id.progress_text,formatProgressText(df.size,df.progress)); expandedView.setImageViewResource(R.id.appIcon,android.R.drawable.stat_sys_download); // Intent when clic notification Intent intent = new Intent(mContext,DownloadApkActivity.class); intent.putExtra(EXTRA_ID, df.id); // Build the notification object final Notification notification = new Notification(); notification.icon = android.R.drawable.stat_sys_download; notification.flags = Notification.FLAG_ONGOING_EVENT; notification.contentView = expandedView; notification.tickerText=mContext.getString(R.string.update_download_ticket,df.label); notification.contentIntent = PendingIntent.getActivity(mContext, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); if (VERSION.SDK_INT>VERSION_CODES.ECLAIR_0_1) { new Runnable() { @Override public void run() { mNotificationMgr.notify(LABEL_NOTIF_DOWNLOAD,df.id, notification); } }.run(); } else mNotificationMgr.cancel(df.id); } }
[ "philippe.prados@gmail.com" ]
philippe.prados@gmail.com
cfe0a3bd62f351fd1ab69f0fa6f0bb34845ca400
0a8627e3679fa6e4b76649b68ca2e0d05a271ade
/sc-provider/sc-xzsd-app/src/main/java/com/xzsd/app/publicInterfince/service/PersonalService.java
a75c9c3f189c3012ce4a79f3da780ac4a6b9063b
[]
no_license
a1218694550/xzsd
19298fbe94f39b16070fb12622cf1484cca445a3
b7acfba6fede45fceaf88c1c47915a6e20057531
refs/heads/master
2022-06-09T11:19:22.346965
2020-05-08T09:53:25
2020-05-08T09:53:25
254,525,951
0
0
null
null
null
null
UTF-8
Java
false
false
2,702
java
package com.xzsd.app.publicInterfince.service; import com.neusoft.core.restful.AppResponse; import com.xzsd.app.customer.index.entity.UserInfo; import com.xzsd.app.publicInterfince.dao.PersonalDao; import com.xzsd.app.publicInterfince.entity.PasswordInfo; import com.xzsd.app.publicInterfince.entity.PersonalInfo; import com.xzsd.app.util.PasswordUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; @Service public class PersonalService { @Resource private PersonalDao personalDao; /** * 查询个人信息 * @param personalInfo * @return */ public AppResponse getPersonalInfo(PersonalInfo personalInfo){ //获取角色 UserInfo userInfo = personalDao.getUser(personalInfo.getUserCode()); personalInfo.setRole(userInfo.getRole()); //根据角色查询 PersonalInfo personalInfoRes = personalDao.getPersonalInfo(personalInfo); return AppResponse.success("查询个人信息成功!",personalInfoRes); } /** * 修改密码 * @param passwordInfo * @return */ @Transactional(rollbackFor = Exception.class) public AppResponse updatePassword(PasswordInfo passwordInfo){ //校验原密码 if(null != passwordInfo.getPassword() && !"".equals(passwordInfo.getPassword())) { //获取输入的原密码 String oldPwd = passwordInfo.getPassword(); // 获取用户信息 UserInfo userDetail = personalDao.getUser(passwordInfo.getUserCode()); if (null == userDetail) { return AppResponse.bizError("用户不存在或已被删除!"); } else { if (!PasswordUtils.PasswordMacth(oldPwd,userDetail.getUserPwd())) { System.out.println(" 输入的原密码:"+ oldPwd); System.out.println("数据库加密过的原密码:"+ userDetail.getUserPwd()); return AppResponse.bizError("原密码不匹配,请重新输入!"); } } }else { return AppResponse.bizError("原密码格式错误,请重新输入!"); } //修改密码 加密新密码 passwordInfo.setNewPassword(PasswordUtils.generatePassword(passwordInfo.getNewPassword())); int resultUpdate = personalDao.updatePassword(passwordInfo); if (0 == resultUpdate){ return AppResponse.bizError("修改密码失败!,原密码不匹配,请检查原密码是否正确!"); } return AppResponse.success("修改密码成功!"); } }
[ "1123843188@qq.com" ]
1123843188@qq.com
fd1eb19dd3b8b20078396e47138c6cdacfdb9482
af0cf6cb6343f0a758f8f061b916d1b65b319947
/src/main/java/com/theironyard/services/BeerRepository.java
5b8a1137694e74233075d405dbfee72590e66f01
[]
no_license
cpoakley1432/BeerTrackerSpring
faa5d897b94f0e71470c4e0134155ff2c9d49f84
c7de6b980004d4be5dab21513a73ccf96818cac5
refs/heads/master
2021-01-10T13:19:18.284380
2015-11-16T15:45:29
2015-11-16T15:45:29
45,927,791
0
0
null
null
null
null
UTF-8
Java
false
false
779
java
package com.theironyard.services; import com.theironyard.entities.Beer; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.CrudRepository; import java.util.List; /** * Created by cameronoakley on 11/10/15. */ public interface BeerRepository extends CrudRepository<Beer, Integer> { List<Beer> findByType(String type); List<Beer> findByTypeAndCalories(String type, Integer calories); List<Beer> findByTypeAndCaloriesIsLessThanEqual(String type, Integer calories); Beer findFirstByType(String type); int countByType(String type); List<Beer> findByTypeOrderByNameAsc(String type); @Query("SELECT b FROM Beer b WHERE Lower(name) LIKE '%'|| LOWER(?) || '%'") List<Beer> searchByName(String name); }
[ "cpoakley1432@gmail.com" ]
cpoakley1432@gmail.com
a30e8d57d32cbd13771b6d717b6516b358bb6df6
5b3044aa3572f7ae0d883c49db04fea8159678c1
/src/Iniciante/Teste.java
3080a2fca9d8ed10d249758a14f789f1dc47a371
[]
no_license
GiovanePSimoes/Exercicios_URI
bbbdcc950391f033d4314412f80bb04b3efa9813
0afc30f399eeb223418c7889eadde2725125d60e
refs/heads/master
2021-04-26T14:42:11.514144
2015-11-03T17:10:28
2015-11-03T17:10:28
45,287,697
0
0
null
null
null
null
UTF-8
Java
false
false
876
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 Iniciante; import java.util.Scanner; /** * * @author giovane.psimoes */ public class Teste { public static void main(String args[]) { int align=10; int a=1234; int b=34006; System.out.printf("%"+align+"d\n",a); System.out.printf("%"+align+"d\n",b); System.out.println("-------------------------"); // int res=a*b; // while(b!=0){ // int t=b%10; // System.out.printf("%"+(align--)+"d\n",t*a); // b/=10; // } // System.out.println("---------------------------"); // System.out.printf("%10d\n",res); } }
[ "giovane.psimoes@gmail.com" ]
giovane.psimoes@gmail.com
7630ea6b372698c7f135004990dd6b2a2cfe494a
22b1fe6a0af8ab3c662551185967bf2a6034a5d2
/experimenting-rounds/massive-count-of-annotated-classes/src/main/java/fr/javatronic/blog/massive/annotation1/sub1/Class_6797.java
ad8785b6707e459eda28f04e7f8b4a962fa21ecc
[ "Apache-2.0" ]
permissive
lesaint/experimenting-annotation-processing
b64ed2182570007cb65e9b62bb2b1b3f69d168d6
1e9692ceb0d3d2cda709e06ccc13290262f51b39
refs/heads/master
2021-01-23T11:20:19.836331
2014-11-13T10:37:14
2014-11-13T10:37:14
26,336,984
1
0
null
null
null
null
UTF-8
Java
false
false
151
java
package fr.javatronic.blog.massive.annotation1.sub1; import fr.javatronic.blog.processor.Annotation_001; @Annotation_001 public class Class_6797 { }
[ "sebastien.lesaint@gmail.com" ]
sebastien.lesaint@gmail.com
95fb76c9676622ee59eef59f4fa35b3070f2eb62
a1200ac895a26054abc34333f78bb6b1de91d960
/src/main/java/org/superbiz/javaee/qualifiers/New.java
6a67e612878ea4ecb9b943d5c2d70725d383d3b5
[ "Apache-2.0" ]
permissive
cchacin/javaee6-template
abbca687f37e9020ef47075bbc3a270b6ea48f6f
6c88b49374bbe21dc16966dd01939b3410313aba
refs/heads/master
2022-07-21T04:55:44.910306
2014-09-26T20:40:01
2014-09-26T20:40:01
20,568,393
0
0
Apache-2.0
2022-07-15T20:09:48
2014-06-06T15:20:43
Java
UTF-8
Java
false
false
1,116
java
/** * Copyright (C) 2014 Carlos Chacin (cchacin@gmail.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.superbiz.javaee.qualifiers; import javax.interceptor.InterceptorBinding; import java.lang.annotation.Retention; import java.lang.annotation.Target; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; @InterceptorBinding @Retention(RUNTIME) @Target({METHOD, TYPE, PARAMETER}) public @interface New { }
[ "cchacin@groupon.com" ]
cchacin@groupon.com
8a0f3753a15bf59188bdf3868d9b508aa82c5294
baa0148b322736687753268962b59e4a5872ee03
/src/Menu/Menu.java
7835c415e55af46c6bb8e57fca7a520ddd879d61
[]
no_license
Geva99/hopital102
a6d1f34be802ed96a89888fe49ffb9e6e923feec
3de879da472166ae9058280e17d4f2c771733361
refs/heads/master
2016-09-05T23:06:37.759362
2015-05-11T04:59:23
2015-05-11T04:59:23
34,797,506
1
0
null
null
null
null
UTF-8
Java
false
false
7,399
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 Menu; import Connexion.Connexion; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.sql.SQLException; import java.util.logging.Level; import java.util.logging.Logger; import javax.imageio.ImageIO; import javax.swing.JButton; import javax.swing.JFrame; import static javax.swing.JFrame.EXIT_ON_CLOSE; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; /** * * @author Gunness */ public class Menu extends JFrame implements ActionListener{ private final JFrame fenetremenu; // declaration d'une fenetre pour le menu private JPanel panelmenu; //declaration d'un panneau menu private final JButton OnlineNutton; //Bouton online private JButton OfflineNutton; //bouton offline private final JLabel titre; // declaration du titre private final JTextField nom;//decaration de textfield pour les noms et prenoms à rechercher private final JTextField mdp; private final JTextField nombdd; private final JTextField mdpbdd; private final JTextField nom2; private final JTextField mdp2; private final JLabel titre2; private final JLabel titre3; // declaration du titre private final JLabel titre4; private final JLabel titre5; // declaration du titre private final JLabel titre6; // declaration du titre private final JLabel titre7; // declaration du titre public Menu() throws IOException { fenetremenu=new JFrame();//creation d'une fenetre pour le menu fenetremenu.setTitle("Menu Hopital 102: Connexion"); // titre de la fenetre fenetremenu.setDefaultCloseOperation(EXIT_ON_CLOSE); panelmenu = new JPanel();//creation d'un panneau menu panelmenu = setImage(fenetremenu, new File("hop1.png")); panelmenu.setLayout(null); OnlineNutton = new JButton("Connexion Online"); OfflineNutton = new JButton("Connexion Offline"); String texttitre="Bienvenue dans le Menu d'Hopital 102"; titre = new JLabel(texttitre,JLabel.CENTER ); nom=new JTextField(); mdp=new JTextField(); nombdd=new JTextField(); mdpbdd=new JTextField(); nom2=new JTextField(); mdp2=new JTextField(); String texttitre2="nom base :"; titre2 = new JLabel(texttitre2,JLabel.LEFT ); String texttitre3=" mdp base :"; titre3 = new JLabel(texttitre3,JLabel.LEFT ); String texttitre4=" login ece :"; String texttitre5=" mdp ece :"; String texttitre6=" nom base :"; String texttitre7=" mdp base :"; titre4 = new JLabel(texttitre4,JLabel.LEFT ); titre5 = new JLabel(texttitre5,JLabel.LEFT ); titre6 = new JLabel(texttitre6,JLabel.LEFT ); titre7 = new JLabel(texttitre7,JLabel.LEFT ); titre.setBounds(175,20,300,100); titre2.setBounds(385,235,100,20); titre3.setBounds(385,265,100,20); titre4.setBounds(385,295,100,20); titre5.setBounds(385,325,100,20); titre6.setBounds(385,355,100,20); titre7.setBounds(385,385,100,20); nom2.setBounds(480, 235, 100, 20); nom2.addActionListener(this); mdp2.setBounds(480, 265, 100, 20); mdp2.addActionListener(this); nom.setBounds(480, 295, 100, 20); nom.addActionListener(this); mdp.setBounds(480, 325, 100, 20); mdp.addActionListener(this); nombdd.setBounds(480, 355, 100, 20); nombdd.addActionListener(this); mdpbdd.setBounds(480, 385, 100, 20); mdpbdd.addActionListener(this); OnlineNutton.setBounds(170,295,200,50); OnlineNutton.addActionListener(this); OfflineNutton.setBounds(170,225,200,50); OfflineNutton.addActionListener(this); panelmenu.add(titre2); panelmenu.add(titre3); panelmenu.add(titre4); panelmenu.add(titre5); panelmenu.add(titre6); panelmenu.add(titre7); panelmenu.add(nom); panelmenu.add(mdp); panelmenu.add(nombdd); panelmenu.add(mdpbdd); panelmenu.add(nom2); panelmenu.add(mdp2); panelmenu.add(OnlineNutton); panelmenu.add(OfflineNutton); panelmenu.add(titre); fenetremenu.pack(); fenetremenu.setResizable(true); fenetremenu.setSize(700, 700); fenetremenu.setLocationRelativeTo(null); fenetremenu.setVisible(true); } @Override public void actionPerformed(ActionEvent tada) { if(tada.getSource()==OnlineNutton) { try { String login= nom.getText(); String mdpf=mdp.getText(); String nombddf= nombdd.getText(); String mdpbddf=mdpbdd.getText(); // Connexion Connexion1=new Connexion(login,mdpf,nombddf,mdpbddf); Accueil acucu =new Accueil(); fenetremenu.setVisible(false); } catch (IOException ex) { Logger.getLogger(Menu.class.getName()).log(Level.SEVERE, null, ex); //} catch (SQLException ex) { Logger.getLogger(Menu.class.getName()).log(Level.SEVERE, null, ex); // } catch (ClassNotFoundException ex) { Logger.getLogger(Menu.class.getName()).log(Level.SEVERE, null, ex); } } if(tada.getSource()==OfflineNutton) { try { String nombdd= nom2.getText(); String mdp=mdp2.getText(); // Connexion Connexion1=new Connexion(nombdd,mdp); Accueil acucu =new Accueil(); } catch (IOException ex) { Logger.getLogger(Menu.class.getName()).log(Level.SEVERE, null, ex); //} catch (SQLException ex) { Logger.getLogger(Menu.class.getName()).log(Level.SEVERE, null, ex); // } catch (ClassNotFoundException ex) { Logger.getLogger(Menu.class.getName()).log(Level.SEVERE, null, ex); } fenetremenu.setVisible(false); } } /** * * @param frame * @param fichierimage * @return * @throws IOException */ public static JPanel setImage(JFrame frame, final File fichierimage) throws IOException { JPanel panel = new JPanel() { private static final long serialVersionUID = 1; private final BufferedImage buf = ImageIO.read(fichierimage); @Override protected void paintComponent(Graphics g) { super.paintComponent(g); g.drawImage(buf, 0, 0, null); } }; frame.setContentPane(panel); return panel; } }
[ "Gunness@Gunness-PC" ]
Gunness@Gunness-PC
10f41e62185f9c67b852351f89c5b5b5dc7420e3
d57b06da01d06f5f77540d61c994d83dfa9a63f5
/2018/MSD/GoogleMaps/app/src/test/java/com/happydevil/shivneelachari/googlemaps/ExampleUnitTest.java
fd52e7a2087e073e0ddbc9d8c29a0d96bd95e026
[ "MIT" ]
permissive
SaiyanShivvy/Unitec-Projects
c92179237df25f44cd37140d6f14524813ee076e
6f6e76bd5c5095aeaf8c695c3924f335144a7591
refs/heads/master
2021-06-06T04:36:06.050475
2019-11-25T01:38:55
2019-11-25T01:38:55
131,844,576
1
1
null
null
null
null
UTF-8
Java
false
false
401
java
package com.happydevil.shivneelachari.googlemaps; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
[ "hdiproductionsoffical@gmail.com" ]
hdiproductionsoffical@gmail.com
e73d17c1ada501e8c6d35f0ee163f8a4515852ea
a2272f1002da68cc554cd57bf9470322a547c605
/src/jdk/jdk.internal.vm.compiler/org.graalvm.compiler.jtt/src/org/graalvm/compiler/jtt/bytecode/BC_iadd_const0.java
6ab70f38447792f81d658579bf14afcfe69ddb80
[]
no_license
framework-projects/java
50af8953ab46c509432c467c9ad69cc63818fa63
2d131cb46f232d3bf909face20502e4ba4b84db0
refs/heads/master
2023-06-28T05:08:00.482568
2021-08-04T08:42:32
2021-08-04T08:42:32
312,414,414
2
0
null
null
null
null
UTF-8
Java
false
false
1,012
java
/* * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * */ package org.graalvm.compiler.jtt.bytecode; import org.graalvm.compiler.api.directives.GraalDirectives; import org.graalvm.compiler.jtt.JTTTest; import org.junit.Test; /* */ public class BC_iadd_const0 extends JTTTest { public static int test(int a, int b, boolean neg) { int x = GraalDirectives.opaque(a); if (!neg) { return x + b; } return x - b; } @Test public void run0() throws Throwable { runTest("test", 42, 1, false); } @Test public void run1() throws Throwable { runTest("test", 42, -1, false); } @Test public void run2() throws Throwable { runTest("test", 42, 1, true); } @Test public void run3() throws Throwable { runTest("test", 42, -1, true); } }
[ "chovavea@outlook.com" ]
chovavea@outlook.com
d97249b42c2b81bdd80c57ada6f5de25fb614700
9a89c34d01b3a477782c505239bf5022721b7e44
/practice/TreeNode.java
3c74e139a87b502a32d952a329a8de508ef643b9
[]
no_license
Ritwika94/Interview_Questions
56ffd42664a8eca24733cbce4b937c618555cda7
d4bf15f5bd8313aab2827b3c7958554b6087b47f
refs/heads/main
2023-02-19T19:26:59.073861
2021-01-18T19:19:26
2021-01-18T19:19:26
311,382,104
0
0
null
null
null
null
UTF-8
Java
false
false
321
java
package com.ritwika.practice; public class TreeNode { int val; TreeNode left; TreeNode right; TreeNode() {} TreeNode(int val) { this.val = val; } TreeNode(int val, TreeNode left, TreeNode right) { this.val = val; this.left = left; this.right = right; } }
[ "57855522+Ritwika94@users.noreply.github.com" ]
57855522+Ritwika94@users.noreply.github.com
5b080c1cedbf322057fb905caaad33796abee5a2
8f53667429c4eb4a6b87f322b972bf49a12e727b
/employee/src/main/java/com/employee/model/EmployeeEntity.java
5dec2cf911cd69e835a2cf2b15e3ba3d36edb92e
[]
no_license
NMittapally/MyPractice
06c4e781b014337b6710d717ae37432e81b05c48
857bfd7806a9bfd03d5052d5c36bd7690f8e2fa8
refs/heads/master
2023-01-04T05:54:17.110969
2020-10-21T12:01:51
2020-10-21T12:01:51
305,995,054
0
0
null
null
null
null
UTF-8
Java
false
false
1,336
java
package com.employee.model; import java.io.Serializable; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name="EMPLOYEES") public class EmployeeEntity implements Serializable { /** * */ private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long emp_id; @Column private String emp_name; @Column private int emp_age; @Column private String emp_email; @Column private String emp_sal; public Long getEmp_id() { return emp_id; } public void setEmp_id(Long emp_id) { this.emp_id = emp_id; } public String getEmp_name() { return emp_name; } public void setEmp_name(String emp_name) { this.emp_name = emp_name; } public int getEmp_age() { return emp_age; } public void setEmp_age(int emp_age) { this.emp_age = emp_age; } public String getEmp_email() { return emp_email; } public void setEmp_email(String emp_email) { this.emp_email = emp_email; } public String getEmp_sal() { return emp_sal; } public void setEmp_sal(String emp_sal) { this.emp_sal = emp_sal; } }
[ "krishna@Lenovo-PC" ]
krishna@Lenovo-PC
92db8a6b076e0f0401eaa56e67417d38b1b78d3d
ea5a5ca4009b64d374b6194600fd39481b737392
/AutomationTestBootcamp3/src/test/java/group/future/id/BlibliPackage/BlibliHomePageBehaviour.java
dec69efd82126632b904e9b14f21c4362099ed9c
[]
no_license
sofrie/AutomationFutureFase3Sofrie
4d8f51b747a48d5a8c6cc6aef7816e9dcab39971
044055f24d82e94ad20bc46fefc25df4e4fbf0ff
refs/heads/master
2021-06-21T11:48:58.388660
2017-08-14T12:56:22
2017-08-14T12:56:22
100,267,433
0
0
null
null
null
null
UTF-8
Java
false
false
2,484
java
package group.future.id.BlibliPackage; import group.future.id.pages.BlibliHomePage; import net.serenitybdd.jbehave.SerenityStories; import net.thucydides.core.annotations.Step; import net.thucydides.core.steps.ScenarioSteps; import java.util.concurrent.TimeUnit; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.hasItem; public class BlibliHomePageBehaviour extends ScenarioSteps { BlibliHomePage blibliHomePage; @Step public void open() { getDriver().get("https://www.blibli.com/"); } @Step public void clickUserLogin() { blibliHomePage.getLoginButton().click(); blibliHomePage.getPopopLoginForm().waitUntilPresent().withTimeoutOf(500,TimeUnit.SECONDS); blibliHomePage.getInputLoginEmail().type("jetz1996@gmail.com"); blibliHomePage.getInputLoginPassword().type("sqare0505"); blibliHomePage.getSubmitLoginButton().click(); } @Step public void chechUserAlreadyLogin() { blibliHomePage.getAlreadyLogin().isCurrentlyVisible(); } @Step public void searchMinyakGoreng() { blibliHomePage.getInputSearch().type("totoro"); blibliHomePage.getSearchButton().click(); blibliHomePage.getGojekButton().click(); } @Step public void chooseMinyakGoreng() { blibliHomePage.getListProduk().click(); } @Step public void addMinyakGorengToBag() { blibliHomePage.getCardButton().click(); } @Step public void goToBagPage() { blibliHomePage.getBlibliCart().isCurrentlyVisible(); blibliHomePage.getLanjutkanButton().click(); } @Step public void lanjutkanPembayaran() { blibliHomePage.getLanjutkan2Button().click(); } @Step public void chooseInternetBanking() { blibliHomePage.selectInternetBanking(); } @Step public void chooseKlikBCA() { blibliHomePage.getKlikBCA().selectByValue("KlikBCA"); } @Step public void inputUserBCA() { blibliHomePage.getBCAid().type("paymentuserid"); } @Step public void bayarSekarang() { blibliHomePage.getBayarSekarangButton().waitUntilPresent().withTimeoutOf(5, TimeUnit.SECONDS).click(); } @Step public void TerimaKasihPage() { blibliHomePage.getTerimaKasihTezt().isCurrentlyVisible(); } }
[ "nagimagi47@gmail.com" ]
nagimagi47@gmail.com
0b4ec4c42c81aa66cf6d255f703048e732b3871f
c0d092463225d0968a2488454eb5f7543b0a0627
/app/src/main/java/com/swifta/onerecharge/customer/customerregistration/loginresponsemodel/Wallet.java
9428f4e315f186332349b1f12039174375f45051
[]
no_license
Swifta/OneRecharge
d8824fd4f9bb1d1673a92894852090b211001153
ae63d199a03e817d0e21857db5cc0ee7659371e6
refs/heads/master
2021-03-24T10:21:44.016780
2017-02-23T22:32:55
2017-02-23T22:32:55
64,134,523
0
0
null
null
null
null
UTF-8
Java
false
false
1,531
java
package com.swifta.onerecharge.customer.customerregistration.loginresponsemodel; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; /** * Created by moyinoluwa on 11/4/16. */ public class Wallet { @SerializedName("promo") @Expose private Integer promo; @SerializedName("discounts") @Expose private Integer discounts; @SerializedName("recharged") @Expose private Integer recharged; @SerializedName("balance") @Expose private Integer balance; /** * @return The promo */ public Integer getPromo() { return promo; } /** * @param promo The promo */ public void setPromo(Integer promo) { this.promo = promo; } /** * @return The discounts */ public Integer getDiscounts() { return discounts; } /** * @param discounts The discounts */ public void setDiscounts(Integer discounts) { this.discounts = discounts; } /** * @return The recharged */ public Integer getRecharged() { return recharged; } /** * @param recharged The recharged */ public void setRecharged(Integer recharged) { this.recharged = recharged; } /** * @return The balance */ public Integer getBalance() { return balance; } /** * @param balance The balance */ public void setBalance(Integer balance) { this.balance = balance; } }
[ "moyinoluwaa@gmail.com" ]
moyinoluwaa@gmail.com
2d2fe8af5355392957a46d12e8a8552a97943168
aa58b0b32c457eb8c49add9baa7693068fa12680
/src/main/java/com/beyongx/echarts/charts/graph/blur/EdgeLabel.java
664e4da2384d10faf16071549ac749a5fae33980
[ "Apache-2.0" ]
permissive
wen501271303/java-echarts
045dcd41eee35b572122c9de27a340cf777a74b1
9eb611e8f964833e4dbb7360733a6ae7ac6eace1
refs/heads/master
2023-07-30T20:56:23.638092
2021-09-28T06:12:21
2021-09-28T06:12:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,471
java
/** * Created by java-echarts library. * @author: cattong <aronter@gmail.com> */ package com.beyongx.echarts.charts.graph.blur; import java.io.Serializable; import java.util.Map; //import lombok.Data; import lombok.EqualsAndHashCode; /** * * * {_more_} */ @lombok.Data @EqualsAndHashCode(callSuper = false) public class EdgeLabel implements Serializable { private static final long serialVersionUID = 1L; private String show; // Default: false private String position; // Default: 'middle' private Object formatter; //string|Function private String color; // Default: '"#fff"' private String fontStyle; // Default: 'normal' private Object fontWeight; //string|number Default: 'normal' private String fontFamily; // Default: 'sans-serif' private String fontSize; // Default: 12 private String align; // private String verticalAlign; // private Integer lineHeight; // private Object backgroundColor; //string|Object Default: 'transparent' private String borderColor; // private String borderWidth; // Default: 0 private Object borderType; //string|number|Array Default: 'solid' private String borderDashOffset; // Default: 0 private Object borderRadius; //number|Array Default: 0 private Object padding; //number|Array Default: 0 private String shadowColor; // Default: 'transparent' private String shadowBlur; // Default: 0 private String shadowOffsetX; // Default: 0 private String shadowOffsetY; // Default: 0 private Integer width; // private Integer height; // private String textBorderColor; // private Integer textBorderWidth; // private Object textBorderType; //string|number|Array Default: 'solid' private String textBorderDashOffset; // Default: 0 private String textShadowColor; // Default: 'transparent' private String textShadowBlur; // Default: 0 private String textShadowOffsetX; // Default: 0 private String textShadowOffsetY; // Default: 0 private String overflow; // Default: 'none' private String ellipsis; // Default: '...' private String lineOverflow; // Default: 'none' private Object[] rich; // public EdgeLabel() { } public EdgeLabel(Map<String, Object> property) { } }
[ "cattong@163.com" ]
cattong@163.com
5989a94081adf9b4680cf42c6c34edf014914eb4
25fdd1ddaf8efa91483f80160d7f31988a951758
/sesame-transport/src/main/java/com/sanxing/sesame/transport/util/SesameFTPClient.java
ba55f2f7d50853799eccacfb743dc2d3d5da3134
[]
no_license
auxgroup-sanxing/Sesame
5bab1678e3ad2ce43943e156597be2321dc63652
acef04b3225f88f2dc420e6d9e85082d01300d1e
refs/heads/master
2016-09-06T13:17:51.239490
2013-10-25T09:08:51
2013-10-25T09:08:51
9,709,766
1
1
null
null
null
null
UTF-8
Java
false
false
11,533
java
package com.sanxing.sesame.transport.util; import java.io.ByteArrayOutputStream; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.net.URI; import java.util.ArrayList; import java.util.List; import java.util.Map; import org.apache.commons.net.PrintCommandListener; import org.apache.commons.net.ftp.FTPClient; import org.apache.commons.net.ftp.FTPClientConfig; import org.apache.commons.net.ftp.FTPFile; import org.apache.commons.net.ftp.FTPReply; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class SesameFTPClient { private static Logger LOG = LoggerFactory.getLogger( SesameFTPClient.class ); private final FTPClient ftp = new FTPClient(); private URI uri; private String remoteGetPath; private String remoteBakPath; private String localBak; private String localBakPath; private String remotePutPath; private String ftpHost; private int ftpPort = 21; private String ftpUser; private String ftpPassword; private String binary = "true"; private String passive = "true"; private String debug = "true"; private final String encoding = "gbk"; private int timeout = 30; public boolean connectAddLogin() throws IOException { boolean result = false; if ( connect() ) { result = login(); } LOG.debug( "login result is:" + result ); return result; } public void logoutAddDisconnect() throws IOException { logout(); disconnect(); } private boolean connect() throws IOException { return connect( ftpHost, ftpPort ); } private boolean connect( String hostname, int port ) throws IOException { boolean result = false; ftp.setDefaultTimeout( timeout * 1000 ); ftp.setControlEncoding( "gbk" ); ftp.connect( hostname, port ); ftp.enterLocalActiveMode(); int reply = ftp.getReplyCode(); if ( !( FTPReply.isPositiveCompletion( reply ) ) ) { ftp.disconnect(); result = false; } else { result = true; } return result; } public void disconnect() throws IOException { if ( ftp.isConnected() ) { ftp.disconnect(); } } private boolean logout() throws IOException { return ftp.logout(); } private boolean login() throws IOException { boolean result = false; if ( login( ftpUser, ftpPassword ) ) { result = true; if ( binary.equals( "true" ) ) { setFileType(); } if ( passive.equals( "true" ) ) { setLocalModel(); } if ( debug.equals( "true" ) ) { setPrintListener(); } } return result; } private boolean login( String username, String password ) throws IOException { return ftp.login( username, password ); } private boolean setFileType() throws IOException { return ftp.setFileType( 2 ); } private void setLocalModel() { ftp.enterLocalPassiveMode(); } private void setPrintListener() { ftp.addProtocolCommandListener( new PrintCommandListener( new PrintWriter( System.out ) ) ); } public boolean isConnected() { return ftp.isConnected(); } private void reconnect() throws IOException { if ( ( isConnected() ) || ( connectAddLogin() ) ) { return; } throw new IOException( "can not connect and login to ftp server." ); } public boolean changeWorkingDirectory( String pathname ) throws IOException { reconnect(); return ftp.changeWorkingDirectory( pathname ); } public boolean changeToParentDirectory() throws IOException { reconnect(); return ftp.changeToParentDirectory(); } public boolean makeDirectory( String pathname ) throws IOException { reconnect(); return ftp.makeDirectory( pathname ); } public String printWorkingDirectory() throws IOException { reconnect(); return ftp.printWorkingDirectory(); } public boolean moveFile( String filename ) throws IOException { reconnect(); return moveFile( remoteGetPath + "/" + filename, remoteBakPath + "/" + filename ); } public boolean moveFile( String oldPath, String newPath ) throws IOException { LOG.debug( "....oldPath is:" + oldPath + ",newPath is:" + newPath ); reconnect(); return ftp.rename( oldPath, newPath ); } public Object[] getFileNames() throws IOException { reconnect(); return getFileNames( remoteGetPath ); } public Object[] getFileNames( String remote ) throws IOException { reconnect(); LOG.debug( ".................get files path is:" + remote ); List nameList = new ArrayList(); FTPFile[] files = ftp.listFiles( remote ); for ( FTPFile file : files ) { if ( file.isFile() ) { nameList.add( file.getName() ); } } return nameList.toArray(); } public byte[] getInputByte( InputStream in ) throws IOException { reconnect(); byte[] result = null; ByteArrayOutputStream output = new ByteArrayOutputStream(); byte[] temp = new byte[1024]; int len = 0; while ( ( len = in.read( temp ) ) != -1 ) { output.write( temp, 0, len ); len = 0; } in.close(); if ( !( ftp.completePendingCommand() ) ) { ftp.logout(); ftp.disconnect(); throw new IOException( "get file from ftp server error." ); } result = output.toByteArray(); output.close(); return result; } public InputStream processOneFile( String filename ) throws IOException { reconnect(); InputStream in; if ( localBak.equals( "true" ) ) { in = backupAndProcessOneFile( remoteBakPath + "/" + filename, localBakPath + "/" + filename ); } else { in = processOneFileByStream( remoteBakPath + "/" + filename ); } return in; } private InputStream processOneFileByStream( String filePath ) throws IOException { reconnect(); InputStream in = ftp.retrieveFileStream( filePath ); return in; } public boolean mkdirs( String pathname ) throws IOException { if ( ftp.makeDirectory( pathname ) ) { return true; } int index = pathname.lastIndexOf( 47 ); if ( index > 0 ) { if ( mkdirs( pathname.substring( 0, index ) ) ) { return ftp.makeDirectory( pathname ); } return false; } return false; } public boolean uploadFile( String pathname, InputStream in ) throws IOException { reconnect(); int index = pathname.lastIndexOf( 47 ); if ( index > 0 ) { mkdirs( pathname.substring( 0, index ) ); } ftp.storeFile( ( ( remotePutPath != null ) ? remotePutPath : "" ) + pathname, in ); String status = ftp.getStatus( pathname ); if ( LOG.isDebugEnabled() ) { LOG.debug( "Uploaded file status: " + status ); } return ( status != null ); } private InputStream backupAndProcessOneFile( String remoteFilePath, String localFilePath ) throws IOException { reconnect(); InputStream in = null; FileOutputStream out = new FileOutputStream( localFilePath ); if ( ftp.retrieveFile( remoteFilePath, out ) ) { out.close(); in = new FileInputStream( localFilePath ); } else { out.close(); throw new IOException( "backup file error!" ); } return in; } public boolean completePendingCommand() throws IOException { reconnect(); return ftp.completePendingCommand(); } public boolean deleteFile( String pathname ) throws IOException { reconnect(); return ftp.deleteFile( pathname ); } public boolean removeDirectory( String pathname ) throws IOException { reconnect(); return ftp.removeDirectory( pathname ); } public void setConnectorProperties( Map<?, ?> props ) { setProperties( props ); setBindingProperties( props ); } public void setProperties( Map<?, ?> props ) { ftpHost = uri.getHost(); ftpPort = uri.getPort(); ftpUser = ( (String) props.get( "ftpUser" ) ); ftpPassword = ( (String) props.get( "ftpPassword" ) ); binary = ( (String) props.get( "binary" ) ); passive = ( (String) props.get( "passive" ) ); debug = ( (String) props.get( "debug" ) ); if ( ( props.get( "timeout" ) != null ) && ( ( (String) props.get( "timeout" ) ).length() > 0 ) ) { timeout = Integer.parseInt( (String) props.get( "timeout" ) ); } } public void setBindingProperties( Map<?, ?> props ) { if ( props != null ) { remoteGetPath = ( (String) props.get( "remoteGetPath" ) ); localBak = ( (String) props.get( "localBak" ) ); remoteBakPath = ( (String) props.get( "remoteBakPath" ) ); remotePutPath = ( (String) props.get( "remotePutPath" ) ); localBakPath = ( (String) props.get( "localBakPath" ) ); } } public void setURI( URI uri ) { this.uri = uri; } public FTPClientConfig getFtpConfig() { FTPClientConfig config = new FTPClientConfig( "WINDOWS" ); return config; } public static void main( String[] args ) { try { SesameFTPClient client = new SesameFTPClient(); client.ftpHost = "10.14.3.73"; client.ftpPort = 21; client.ftpUser = "sesame"; client.ftpPassword = "password"; client.remoteGetPath = "ftptest/download"; client.localBak = "false"; client.remoteBakPath = "ftptest/upload"; client.processOneFile( "ftpget" ); client.logoutAddDisconnect(); } catch ( Exception e ) { e.printStackTrace(); } } }
[ "czzyz-21sj@163.com" ]
czzyz-21sj@163.com
386c0a1cadbecebaa0ef922e3c996aa2a7162fbb
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/13/13_14c0bdf7180a3e4974dd3c23fc1ea69212d8bcb9/Palava/13_14c0bdf7180a3e4974dd3c23fc1ea69212d8bcb9_Palava_s.java
d0060d9d45c4ed2a17d50987d36b7eead4f1dd9e
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
6,668
java
/** * Copyright 2010 CosmoCode GmbH * * 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 de.cosmocode.palava.core; import java.util.Properties; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.base.Preconditions; import com.google.inject.ConfigurationException; import com.google.inject.Module; import com.google.inject.ProvisionException; import com.google.inject.Stage; import de.cosmocode.palava.core.inject.Settings; /** * Static factory class for framework instances. * * @author Willi Schoenborn */ public final class Palava { private static final Logger LOG = LoggerFactory.getLogger(Palava.class); private Palava() { } /** * Constructs a new {@link Framework} using the specified properties. * <p> * This method assumes the specified properties contain the fully * qualified class name of the main module under the default configuration * key {@link CoreConfig#APPLICATION}. * </p> * <p> * The specified properties will be bound using the {@link Settings} annotation. * </p> * * @param properties the settings * @return a new configured {@link Framework} instance * @throws NullPointerException if properties is null * @throws IllegalArgumentException if the specified class does not exist * @throws ClassCastException if the addressed main module class is no subclass of {@link Module} * @throws ConfigurationException if guice configuration failed * @throws ProvisionException if providing an instance during creation failed */ public static Framework newFramework(Properties properties) { Preconditions.checkNotNull(properties, "Properties"); final String className = properties.getProperty(CoreConfig.APPLICATION); Preconditions.checkNotNull(className, CoreConfig.APPLICATION); final Class<? extends Module> mainModuleClass; try { mainModuleClass = Class.forName(className).asSubclass(Module.class); } catch (ClassNotFoundException e) { throw new IllegalArgumentException(e); } LOG.debug("Creating new framework using {}", properties); return newFramework(mainModuleClass, properties); } /** * Constructs a new {@link Framework} using the specified properties. * <p> * This method creates a new instance of the given module class using * {@link Class#newInstance()}. As a consequence this class must provide * a public no argument constructor. * </p> * <p> * The specified properties will be bound using the {@link Settings} annotation. * </p> * * @param mainModuleClass the class literal of the main module * @param properties the application properties * @return a new configured {@link Framework} instance * @throws NullPointerException if mainModuleClass or properties is null * @throws IllegalArgumentException if creating instance of mainModuleClass failed * @throws ConfigurationException if guice configuration failed * @throws ProvisionException if providing an instance during creation failed */ public static Framework newFramework(Class<? extends Module> mainModuleClass, Properties properties) { Preconditions.checkNotNull(mainModuleClass, "MainModuleClass"); Preconditions.checkNotNull(properties, "Properties"); final Module mainModule; try { mainModule = mainModuleClass.newInstance(); } catch (InstantiationException e) { throw new IllegalArgumentException(e); } catch (IllegalAccessException e) { throw new IllegalArgumentException(e); } return newFramework(mainModule, properties); } /** * Creates a {@link Framework} which loads the given {@link Module}. * <p> * The specified properties will be bound using the {@link Settings} annotation. * </p> * * @param mainModule the application main module * @param properties the application properties * @return a new configured {@link Framework} instance * @throws NullPointerException if mainModule or properties is null * @throws ConfigurationException if guice configuration failed * @throws ProvisionException if providing an instance during creation failed */ public static Framework newFramework(Module mainModule, Properties properties) { Preconditions.checkNotNull(mainModule, "MainModule"); Preconditions.checkNotNull(properties, "Properties"); final String stageName = properties.getProperty(CoreConfig.STAGE); final Stage stage = StringUtils.isBlank(stageName) ? Stage.PRODUCTION : Stage.valueOf(stageName); return newFramework(mainModule, stage, properties); } /** * Creates a {@link Framework} which loads the given {@link Module} using the specified * guice {@link Stage}. * <p> * The specified properties will be bound using the {@link Settings} annotation. * </p> * * @param mainModule the application main module * @param stage the desired injector stage * @param properties the application properties * @return a new configured {@link Framework} instance * @throws NullPointerException if mainModule, stage or properties is null * @throws ConfigurationException if guice configuration failed * @throws ProvisionException if providing an instance during creation failed */ public static Framework newFramework(Module mainModule, Stage stage, Properties properties) { Preconditions.checkNotNull(mainModule, "MainModule"); Preconditions.checkNotNull(stage, "Stage"); Preconditions.checkNotNull(properties, "Properties"); return new BootstrapFramework(mainModule, stage, properties); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
97b31668eea06092b8b88ef96988e422d1adbfe6
1a22f517d8f50e030b4489f33632e7b2d87e7024
/11_05/src/kr/ac/green/MyPanel.java
9e5960cb6e32700d15c1c94f7c4c055ea6a86496
[]
no_license
ksmas9/greenAc
ac6cb01c163fe260509adcc93c76ebf4362daf22
83c2cdc468805ca521ed28f89632fad6528c85be
refs/heads/master
2023-01-08T07:54:13.863019
2020-11-05T08:30:47
2020-11-05T08:30:47
310,234,662
0
0
null
null
null
null
UTF-8
Java
false
false
1,164
java
package kr.ac.green; import java.awt.Dimension; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JPasswordField; import javax.swing.JTextField; import javax.swing.text.JTextComponent; public class MyPanel extends JPanel { public static final int TEXT = 0; public static final int PASSWORD = 1; private static final Dimension LABEL_SIZE = new Dimension(70, 25); private static final Dimension FIELD_SIZE = new Dimension(110, 20); private JLabel lbl; private JTextComponent input; public MyPanel(String text, int kind) { lbl = new JLabel(text, JLabel.LEFT); lbl.setPreferredSize(LABEL_SIZE); if(kind == TEXT) { input = new JTextField(); } else { input = new JPasswordField(); } input.setPreferredSize(FIELD_SIZE); add(lbl); add(input); } public void setText(String text) { input.setText(text); } public String getText() { if(input instanceof JPasswordField) { JPasswordField pf = (JPasswordField)input; return String.valueOf(pf.getPassword()); } else { return input.getText(); } } public boolean isEmpty() { return input.getText().trim().length() == 0 ? true : false; } }
[ "xoals_2@naver.com" ]
xoals_2@naver.com
80a69e61894d6176f7729708672f1a8e2ec54751
025904936820215645b0fb9d3401e86bed89ba2f
/src/main/java/com/mcs/dao/CommentDao.java
6030644cadd54a6baa1bb8ec14902e6e112ebf09
[]
no_license
MCS5168/Blog
9ccc06845580b9d93fdfc4b18fea2067b35c7f93
f78f710a22e449dff9e2427bd1a33332a8331f8f
refs/heads/master
2023-03-08T21:53:53.591351
2021-02-22T02:53:15
2021-02-22T02:53:15
340,656,908
0
0
null
null
null
null
UTF-8
Java
false
false
380
java
package com.mcs.dao; import com.mcs.pojo.Comment; import org.springframework.data.domain.Sort; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import java.util.List; public interface CommentDao extends JpaRepository<Comment,Long>{ List<Comment> findByBlogIdAndParentCommentNull(Long blogId, Sort sort); }
[ "1763569073@qq.com" ]
1763569073@qq.com
dd5436252a68b0804b32c9010192397a3cedd258
f121e1749b4a26f233dda71d0acaaab762446790
/bigData-server/src/main/java/com/bigdata/bigdataserver/pojo/ExtData.java
3de1b4da7d6e6a9969d5a7a3327ce940204bed9c
[]
no_license
AuthorRight/big_data
5ebfbdde543e0a8e581979e7218c661cfa7fe095
9684d6a1082585efce1e96fa030d2c36eec58226
refs/heads/main
2023-06-18T09:37:22.714090
2021-07-10T09:46:51
2021-07-10T09:46:51
383,455,286
0
1
null
null
null
null
UTF-8
Java
false
false
374
java
/** * Copyright 2021 bejson.com */ package com.bigdata.bigdataserver.pojo; import lombok.Data; import lombok.NoArgsConstructor; /** * Auto-generated: 2021-07-08 17:23:51 * * @author bejson.com (i@bejson.com) * @website http://www.bejson.com/java2pojo/ */ @Data @NoArgsConstructor public class ExtData { private int noSymptom; private int incrNoSymptom; }
[ "2238782426@qq.com" ]
2238782426@qq.com
4a4db11645746ab062e9b44610605e23b58dbd20
f6a39a6249bf939a3caf4c37fc3dc4fa4c1b7a82
/leetcode-list/src/main/java/edu/university/leetcode/list/easy/P234_PalindromeLinkedList.java
92abcaa6472c59d37c5360509838897be76e50de
[]
no_license
Lillian1098536/LeetCode
86863a35f7f9acfa8d88aacc63a2deb7b77ea993
a380ca8a64ed82eaf4721cf6dca8af220337640f
refs/heads/master
2023-04-12T22:09:48.961381
2023-04-06T03:07:02
2023-04-06T03:07:02
87,339,878
0
1
null
2022-02-21T05:33:00
2017-04-05T17:53:25
Java
UTF-8
Java
false
false
896
java
package edu.university.leetcode.list.easy; import static edu.university.leetcode.list.medium.P2_AddTwoNumbers.ListNode; /** * 234. Palindrome Linked List * Given a singly linked list, determine if it is a palindrome. * O(n) time and O(1) space */ public class P234_PalindromeLinkedList { public static boolean isPalindrome(ListNode head) { if (head == null && head.next == null) return true; ListNode tmpHead = head, rev = new ListNode(head.val); while (tmpHead.next != null) { tmpHead = tmpHead.next; ListNode tmp = new ListNode(tmpHead.val); tmp.next = rev; rev = tmp; } if (head.val != rev.val) return false; while (head.next != null) { head = head.next; rev = rev.next; if (head.val != rev.val) return false; } return true; } }
[ "zheng.lillian@gmail.com" ]
zheng.lillian@gmail.com
0634b00aebf24e38561d433a817d63c777a7531a
0d21f4ecfe9a1bf323017afc7688f862f6ac3464
/GameEngine/src/com/studios/base/engine/framework/chat/ServerChatComponent.java
b709fd121fc94cf02d0148cf9c01b12ed7c3ef8b
[]
no_license
danyguag/3DGameEngine
5e52448756206c67ad413356f966a39a75ddfa37
ea2fde7fe6fcb1a7f26223d588d9e16e0e11ac8b
refs/heads/master
2020-12-24T20:33:45.052254
2016-05-22T01:35:16
2016-05-22T01:35:16
59,389,447
1
0
null
null
null
null
UTF-8
Java
false
false
3,100
java
package com.studios.base.engine.framework.chat; import com.studios.base.engine.framework.components.TextComponent; import com.studios.base.engine.framework.containers.util.EngineMap; import com.studios.base.engine.framework.font.Font; import com.studios.base.engine.framework.font.Message; import com.studios.base.engine.framework.font.Text; import com.studios.base.engine.framework.math.Vector2f; import com.studios.base.engine.framework.threading.Snapshot; public class ServerChatComponent extends TextComponent { public static final Vector2f FIRST_POSITION = new Vector2f(.01f, .21f); public static final Vector2f SECOND_POSITION = new Vector2f(.01f, .18f); public static final Vector2f THIRD_POSITION = new Vector2f(.01f, .15f); public static final Vector2f FOURTH_POSITION = new Vector2f(.01f, .12f); public static final Vector2f FIFTH_POSITION = new Vector2f(.01f, .09f); public static final Vector2f SIXTH_POSITION = new Vector2f(.01f, .06f); public static final Vector2f SEVENTH_POSITION = new Vector2f(.01f, .03f); public static final Vector2f EIGHTH_POSITION = new Vector2f(.01f, 0f); public ServerChatComponent(Font nFont, float MaxLineLength, boolean Centered) { super(nFont, MaxLineLength, Centered); } @Override public void Update(Snapshot CurrentGameShot) { super.Update(CurrentGameShot); if (CurrentGameShot.GetCoreEngine().GetLogicCore().ChatHandler.HashChanged && CurrentGameShot.GetCoreEngine().GetLogicCore().ChatHandler.GetMessages().size() > 0) { GetCoreEngine().GetLogicCore().ChatHandler.HashChanged = false; AddMessage(0, GetCoreEngine().GetLogicCore().ChatHandler.GetMessages().get(0)); GetCoreEngine().GetLogicCore().ChatHandler.GetMessages().clear(); } } public void AddMessage(int PASS_TEST, Message nMessage) { for (Text ChatMessage : m_texts.GetValues()) { boolean NotSet = true; if (ChatMessage.GetPosition().Equals(FIRST_POSITION)) { NotSet = false; ChatMessage.SetPosition(SECOND_POSITION); } if (ChatMessage.GetPosition().Equals(SECOND_POSITION) && NotSet) { NotSet = false; ChatMessage.SetPosition(THIRD_POSITION); } if (ChatMessage.GetPosition().Equals(THIRD_POSITION) && NotSet) { NotSet = false; ChatMessage.SetPosition(FOURTH_POSITION); } if (ChatMessage.GetPosition().Equals(FOURTH_POSITION) && NotSet) { NotSet = false; ChatMessage.SetPosition(FIFTH_POSITION); } if (ChatMessage.GetPosition().Equals(FIFTH_POSITION) && NotSet) { NotSet = false; ChatMessage.SetPosition(SIXTH_POSITION); } if (ChatMessage.GetPosition().Equals(SIXTH_POSITION) && NotSet) { NotSet = false; ChatMessage.SetPosition(SEVENTH_POSITION); } if (ChatMessage.GetPosition().Equals(SEVENTH_POSITION) && NotSet) { NotSet = false; ChatMessage.SetPosition(EIGHTH_POSITION); } if (ChatMessage.GetPosition().Equals(EIGHTH_POSITION) && NotSet) { NotSet = false; ChatMessage.SetRender(false); } } super.AddMessage(nMessage); } public EngineMap<Message, Text> GetTexts() { return m_texts; } }
[ "danyguag2@gmail.com" ]
danyguag2@gmail.com
64e5e0973d17c25c5186afba34db6ce9bfa3e0f6
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/28/28_fefc9533c81a921ec48c0f1feca513f09c2b9d26/ConfigurationManager/28_fefc9533c81a921ec48c0f1feca513f09c2b9d26_ConfigurationManager_t.java
55ee334737d09fdfc33d62f1f0d736a589cc1afe
[]
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
7,488
java
package net.slipcor.pvparena.managers; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Set; import org.bukkit.Bukkit; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.inventory.ItemStack; import net.slipcor.pvparena.PVPArena; import net.slipcor.pvparena.arena.Arena; import net.slipcor.pvparena.arena.ArenaTeam; import net.slipcor.pvparena.commands.PAA_Edit; import net.slipcor.pvparena.core.Config; import net.slipcor.pvparena.core.Config.CFG; import net.slipcor.pvparena.core.Debug; import net.slipcor.pvparena.core.Language; import net.slipcor.pvparena.core.Language.MSG; import net.slipcor.pvparena.core.StringParser; import net.slipcor.pvparena.loadables.ArenaGoal; import net.slipcor.pvparena.loadables.ArenaRegionShape; /** * <pre>Configuration Manager class</pre> * * Provides static methods to manage Configurations * * @author slipcor * * @version v0.9.6 */ public class ConfigurationManager { private static Debug db = new Debug(25); /** * create a config manager instance * * @param arena * the arena to load * @param cfg * the configuration */ public static void configParse(Arena arena, Config cfg) { cfg.load(); YamlConfiguration config = cfg.getYamlConfiguration(); if (cfg.getString(CFG.GENERAL_TYPE, "null") != null && !cfg.getString(CFG.GENERAL_TYPE, "null").equals("null")) { // opening existing arena arena.setFree(cfg.getString(CFG.GENERAL_TYPE).equals("free")); if (cfg.getUnsafe(CFG.MODULES_STANDARDSPECTATE_ACTIVE.getNode()) == null) { cfg.createDefaults(); } List<String> list = cfg.getStringList(CFG.LISTS_GOALS.getNode(), new ArrayList<String>()); for (String type : list) { ArenaGoal aType = PVPArena.instance.getAgm().getType(type); aType = aType.clone(); aType.setArena(arena); arena.goalAdd(aType); } } else { cfg.createDefaults(); } if (config.get("classitems") == null) { if (PVPArena.instance.getConfig().get("classitems") != null) { for (String key : PVPArena.instance.getConfig().getKeys(false)) { config.addDefault("classitems."+key, PVPArena.instance.getConfig().get("classitems."+key)); } } else { config.addDefault("classitems.Ranger", "261,262:64,298,299,300,301"); config.addDefault("classitems.Swordsman", "276,306,307,308,309"); config.addDefault("classitems.Tank", "272,310,311,312,313"); config.addDefault("classitems.Pyro", "259,46:3,298,299,300,301"); } } PVPArena.instance.getAgm().setDefaults(arena, config); config.options().copyDefaults(true); cfg.set(CFG.Z, "0.9.0.65"); cfg.save(); cfg.load(); Map<String, Object> classes = config.getConfigurationSection( "classitems").getValues(false); arena.getClasses().clear(); db.i("reading class items"); for (String className : classes.keySet()) { String s = ""; try { s = (String) classes.get(className); } catch (Exception e) { Bukkit.getLogger().severe("[PVP Arena] Error while parsing class, skipping: " + className); continue; } String[] ss = s.split(","); ItemStack[] items = new ItemStack[ss.length]; for (int i = 0; i < ss.length; i++) { items[i] = StringParser.getItemStackFromString(ss[i]); if (items[i] == null) { db.w("unrecognized item: " + items[i]); } } arena.addClass(className, items); db.i("adding class items to class " + className); } arena.addClass("custom", StringParser.getItemStacksFromString("0")); arena.setOwner(cfg.getString(CFG.GENERAL_OWNER)); arena.setLocked(!cfg.getBoolean(CFG.GENERAL_ENABLED)); arena.setFree(cfg.getString(CFG.GENERAL_TYPE).equals("free")); if (config.getConfigurationSection("arenaregion") != null) { db.i("arenaregion not null"); Map<String, Object> regs = config .getConfigurationSection("arenaregion").getValues(false); for (String rName : regs.keySet()) { db.i("arenaregion '"+rName+"'"); ArenaRegionShape region = Config.parseRegion(arena, config, rName); if (region == null) { PVPArena.instance.getLogger().severe("Error while loading arena, region null: " + rName); } else if (region.getWorld() == null) { PVPArena.instance.getLogger().severe("Error while loading arena, world null: " + rName); } else { arena.getRegions().add(region); } } } else { db.i("arenaregion null"); } arena.setRoundMap(config.getStringList("rounds")); cfg.save(); PVPArena.instance.getAgm().configParse(arena, config); PVPArena.instance.getAmm().configParse(arena, config); if (cfg.getYamlConfiguration().getConfigurationSection("teams") == null) { if (arena.isFreeForAll()) { config.set("teams.free", "WHITE"); } else { config.set("teams.red", "RED"); config.set("teams.blue", "BLUE"); } } cfg.reloadMaps(); Map<String, Object> tempMap = (Map<String, Object>) cfg .getYamlConfiguration().getConfigurationSection("teams") .getValues(true); if (arena.isFreeForAll()) { arena.getArenaConfig().set(CFG.PERMS_TEAMKILL, true); arena.getArenaConfig().save(); } else { for (String sTeam : tempMap.keySet()) { ArenaTeam team = new ArenaTeam(sTeam, (String) tempMap.get(sTeam)); arena.getTeams().add(team); db.i("added team " + team.getName() + " => " + team.getColorCodeString()); } } arena.setPrefix(cfg.getString(CFG.GENERAL_PREFIX)); } /** * check if an arena is configured completely * * @param arena * the arena to check * @return an error string if there is something missing, null otherwise */ public static String isSetup(Arena arena) { arena.getArenaConfig().load(); if (arena.getArenaConfig().getUnsafe("spawns") == null) { return "no spawns set"; } if (PAA_Edit.activeEdits.containsValue(arena)) { return "edit mode!"; } Set<String> list = arena.getArenaConfig().getYamlConfiguration() .getConfigurationSection("spawns").getValues(false).keySet(); String sExit = arena.getArenaConfig().getString(CFG.TP_EXIT); if (!sExit.equals("old") && !list.contains(sExit)) return "Exit Spawn ('"+sExit+"') not set!"; String sWin = arena.getArenaConfig().getString(CFG.TP_WIN); if (!sWin.equals("old") && !list.contains(sWin)) return "Win Spawn ('"+sWin+"') not set!"; String sLose = arena.getArenaConfig().getString(CFG.TP_LOSE); if (!sLose.equals("old") && !list.contains(sLose)) return "Lose Spawn ('"+sLose+"') not set!"; String sDeath = arena.getArenaConfig().getString(CFG.TP_DEATH); if (!sDeath.equals("old") && !list.contains(sDeath)) return "Death Spawn ('"+sDeath+"') not set!"; String error = PVPArena.instance.getAmm().checkForMissingSpawns(arena, list); if (error != null) { return Language.parse(MSG.ERROR_MISSING_SPAWN, error); } error = PVPArena.instance.getAgm().checkForMissingSpawns(arena, list); if (error != null) { return Language.parse(MSG.ERROR_MISSING_SPAWN, error); } return null; } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
1d3169723f048485a548919bb824e596387b1123
6e5034f7a1630b4a5567dcb8ee957adba9adca63
/src/main/java/com/kitcenter/runners/classwork/lesson10/Lesson10Runner.java
a2f767c9eef15036e7e02562aa2001fe25e6c8b8
[]
no_license
MomotiTamba/javacore
277b625b019c10b44e70753b5f06723e84633361
67beeb69cf37828c662190f2fec2de20d389914f
refs/heads/master
2021-01-20T00:08:36.214415
2017-07-26T19:01:42
2017-07-26T19:01:42
89,086,583
0
0
null
null
null
null
UTF-8
Java
false
false
2,678
java
package com.kitcenter.runners.classwork.lesson10; import com.kitcenter.app.classwork.lesson10.Palindrome; import com.kitcenter.app.classwork.lesson10.StringToDisplay; import java.util.Scanner; public class Lesson10Runner { public static void main(String[] args) { StringToDisplay stringToDisplay = new StringToDisplay(); stringToDisplay.setCharToString(); stringToDisplay.setCharToString(new char[]{'p', 'r', 'i', 'v', 'e', 't'}); stringToDisplay.setAutoCharToString(); /*String toFloat = "0.44"; float fir = Float.valueOf(toFloat); float fir1 = Float.parseFloat(toFloat); System.out.println(fir); System.out.println(fir1); String aString = "11"; int aInt = Integer.valueOf(aString); double aDouble = Double.valueOf(aString); long aLong = Long.valueOf(aString); boolean aBoolean = Boolean.valueOf(aString); System.out.println(aInt); System.out.println(aDouble); System.out.println(aLong); System.out.println(aBoolean); String center = new String("KIT"); String center2 = new String("KIT"); System.out.println(center == center2); System.out.println(center.equals(center2));*/ /*String center3 = "KIT"; //System.out.println(center.intern() == center3); String text = "3, 4, 5, 6, 7"; String[] splitText = text.split(","); System.out.println(splitText[0]); String trimText = text.trim(); System.out.println(trimText); int iText = text.hashCode(); System.out.println(iText); boolean matchesText = text.matches("3, 4, 5, 6, 7"); System.out.println(matchesText); int compareText = text.compareTo(", 4, 5, 6, 7"); System.out.println(compareText);*/ Scanner sc = new Scanner(System.in); Palindrome palindrome = new Palindrome(); /*System.out.print("1) Input your line: "); System.out.println("is palindrome: " + palindrome.isPalindromeBuilder1(sc.nextLine()));*/ System.out.print("2) Input your line: "); System.out.println("is palindrome: " + palindrome.isPalindromeString(sc.nextLine())); /* System.out.print("3) Input your line: "); System.out.println("is palindrome: " + palindrome.isPalindromeBuilder2(sc.nextLine())); System.out.print("4) Input your line: "); System.out.println("is palindrome: " + palindrome.isPalindromeReverse1(sc.nextLine())); System.out.print("5) Input your line: "); System.out.println("is palindrome: " + palindrome.isPalindromeReverse2(sc.nextLine()));*/ } }
[ "achilles910@gmail.com" ]
achilles910@gmail.com
4f00356cc4dddd1073b5c7014c5fc1e15b2f7ee1
5f804649c61f25e76f56055a797a7769f3b3b93d
/src/main/java/com/amazonaws/services/cloudsearch/model/OptionStatus.java
badcc1532a0ea88ce759611640dab9b4b067745f
[ "JSON", "Apache-2.0" ]
permissive
pbailis/aws-java-sdk-dynamodb-timestamp
5992dbd022ddcab55f8c50344df6edf34a47a12f
33d9beb9e8b8bf6965312c2c61c621ce96d054c8
refs/heads/master
2020-12-01T01:14:05.176666
2012-04-14T19:59:47
2012-04-14T19:59:47
4,027,256
2
4
null
null
null
null
UTF-8
Java
false
false
16,154
java
/* * Copyright 2010-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ package com.amazonaws.services.cloudsearch.model; /** * <p> * The status of an option, including when it was last updated and * whether it is actively in use for searches. * </p> */ public class OptionStatus { /** * A timestamp for when this option was created. */ private java.util.Date creationDate; /** * A timestamp for when this option was last updated. */ private java.util.Date updateDate; /** * A unique integer that indicates when this option was last updated. * <p> * <b>Constraints:</b><br/> * <b>Range: </b>0 - <br/> */ private Integer updateVersion; /** * The state of processing a change to an option. Possible values:<ul> * <li><code>RequiresIndexDocuments</code>: the option's latest value * will not be visible in searches until <a>IndexDocuments</a> has been * called and indexing is complete.</li> <li><code>Processing</code>: the * option's latest value is not yet visible in all searches but is in the * process of being activated. </li> <li><code>Active</code>: the * option's latest value is completely visible. Any warnings or messages * generated during processing are provided in * <code>Diagnostics</code>.</li> </ul> * <p> * <b>Constraints:</b><br/> * <b>Allowed Values: </b>RequiresIndexDocuments, Processing, Active */ private String state; /** * A timestamp for when this option was created. * * @return A timestamp for when this option was created. */ public java.util.Date getCreationDate() { return creationDate; } /** * A timestamp for when this option was created. * * @param creationDate A timestamp for when this option was created. */ public void setCreationDate(java.util.Date creationDate) { this.creationDate = creationDate; } /** * A timestamp for when this option was created. * <p> * Returns a reference to this object so that method calls can be chained together. * * @param creationDate A timestamp for when this option was created. * * @return A reference to this updated object so that method calls can be chained * together. */ public OptionStatus withCreationDate(java.util.Date creationDate) { this.creationDate = creationDate; return this; } /** * A timestamp for when this option was last updated. * * @return A timestamp for when this option was last updated. */ public java.util.Date getUpdateDate() { return updateDate; } /** * A timestamp for when this option was last updated. * * @param updateDate A timestamp for when this option was last updated. */ public void setUpdateDate(java.util.Date updateDate) { this.updateDate = updateDate; } /** * A timestamp for when this option was last updated. * <p> * Returns a reference to this object so that method calls can be chained together. * * @param updateDate A timestamp for when this option was last updated. * * @return A reference to this updated object so that method calls can be chained * together. */ public OptionStatus withUpdateDate(java.util.Date updateDate) { this.updateDate = updateDate; return this; } /** * A unique integer that indicates when this option was last updated. * <p> * <b>Constraints:</b><br/> * <b>Range: </b>0 - <br/> * * @return A unique integer that indicates when this option was last updated. */ public Integer getUpdateVersion() { return updateVersion; } /** * A unique integer that indicates when this option was last updated. * <p> * <b>Constraints:</b><br/> * <b>Range: </b>0 - <br/> * * @param updateVersion A unique integer that indicates when this option was last updated. */ public void setUpdateVersion(Integer updateVersion) { this.updateVersion = updateVersion; } /** * A unique integer that indicates when this option was last updated. * <p> * Returns a reference to this object so that method calls can be chained together. * <p> * <b>Constraints:</b><br/> * <b>Range: </b>0 - <br/> * * @param updateVersion A unique integer that indicates when this option was last updated. * * @return A reference to this updated object so that method calls can be chained * together. */ public OptionStatus withUpdateVersion(Integer updateVersion) { this.updateVersion = updateVersion; return this; } /** * The state of processing a change to an option. Possible values:<ul> * <li><code>RequiresIndexDocuments</code>: the option's latest value * will not be visible in searches until <a>IndexDocuments</a> has been * called and indexing is complete.</li> <li><code>Processing</code>: the * option's latest value is not yet visible in all searches but is in the * process of being activated. </li> <li><code>Active</code>: the * option's latest value is completely visible. Any warnings or messages * generated during processing are provided in * <code>Diagnostics</code>.</li> </ul> * <p> * <b>Constraints:</b><br/> * <b>Allowed Values: </b>RequiresIndexDocuments, Processing, Active * * @return The state of processing a change to an option. Possible values:<ul> * <li><code>RequiresIndexDocuments</code>: the option's latest value * will not be visible in searches until <a>IndexDocuments</a> has been * called and indexing is complete.</li> <li><code>Processing</code>: the * option's latest value is not yet visible in all searches but is in the * process of being activated. </li> <li><code>Active</code>: the * option's latest value is completely visible. Any warnings or messages * generated during processing are provided in * <code>Diagnostics</code>.</li> </ul> * * @see OptionState */ public String getState() { return state; } /** * The state of processing a change to an option. Possible values:<ul> * <li><code>RequiresIndexDocuments</code>: the option's latest value * will not be visible in searches until <a>IndexDocuments</a> has been * called and indexing is complete.</li> <li><code>Processing</code>: the * option's latest value is not yet visible in all searches but is in the * process of being activated. </li> <li><code>Active</code>: the * option's latest value is completely visible. Any warnings or messages * generated during processing are provided in * <code>Diagnostics</code>.</li> </ul> * <p> * <b>Constraints:</b><br/> * <b>Allowed Values: </b>RequiresIndexDocuments, Processing, Active * * @param state The state of processing a change to an option. Possible values:<ul> * <li><code>RequiresIndexDocuments</code>: the option's latest value * will not be visible in searches until <a>IndexDocuments</a> has been * called and indexing is complete.</li> <li><code>Processing</code>: the * option's latest value is not yet visible in all searches but is in the * process of being activated. </li> <li><code>Active</code>: the * option's latest value is completely visible. Any warnings or messages * generated during processing are provided in * <code>Diagnostics</code>.</li> </ul> * * @see OptionState */ public void setState(String state) { this.state = state; } /** * The state of processing a change to an option. Possible values:<ul> * <li><code>RequiresIndexDocuments</code>: the option's latest value * will not be visible in searches until <a>IndexDocuments</a> has been * called and indexing is complete.</li> <li><code>Processing</code>: the * option's latest value is not yet visible in all searches but is in the * process of being activated. </li> <li><code>Active</code>: the * option's latest value is completely visible. Any warnings or messages * generated during processing are provided in * <code>Diagnostics</code>.</li> </ul> * <p> * Returns a reference to this object so that method calls can be chained together. * <p> * <b>Constraints:</b><br/> * <b>Allowed Values: </b>RequiresIndexDocuments, Processing, Active * * @param state The state of processing a change to an option. Possible values:<ul> * <li><code>RequiresIndexDocuments</code>: the option's latest value * will not be visible in searches until <a>IndexDocuments</a> has been * called and indexing is complete.</li> <li><code>Processing</code>: the * option's latest value is not yet visible in all searches but is in the * process of being activated. </li> <li><code>Active</code>: the * option's latest value is completely visible. Any warnings or messages * generated during processing are provided in * <code>Diagnostics</code>.</li> </ul> * * @return A reference to this updated object so that method calls can be chained * together. * * @see OptionState */ public OptionStatus withState(String state) { this.state = state; return this; } /** * The state of processing a change to an option. Possible values:<ul> * <li><code>RequiresIndexDocuments</code>: the option's latest value * will not be visible in searches until <a>IndexDocuments</a> has been * called and indexing is complete.</li> <li><code>Processing</code>: the * option's latest value is not yet visible in all searches but is in the * process of being activated. </li> <li><code>Active</code>: the * option's latest value is completely visible. Any warnings or messages * generated during processing are provided in * <code>Diagnostics</code>.</li> </ul> * <p> * <b>Constraints:</b><br/> * <b>Allowed Values: </b>RequiresIndexDocuments, Processing, Active * * @param state The state of processing a change to an option. Possible values:<ul> * <li><code>RequiresIndexDocuments</code>: the option's latest value * will not be visible in searches until <a>IndexDocuments</a> has been * called and indexing is complete.</li> <li><code>Processing</code>: the * option's latest value is not yet visible in all searches but is in the * process of being activated. </li> <li><code>Active</code>: the * option's latest value is completely visible. Any warnings or messages * generated during processing are provided in * <code>Diagnostics</code>.</li> </ul> * * @see OptionState */ public void setState(OptionState state) { this.state = state.toString(); } /** * The state of processing a change to an option. Possible values:<ul> * <li><code>RequiresIndexDocuments</code>: the option's latest value * will not be visible in searches until <a>IndexDocuments</a> has been * called and indexing is complete.</li> <li><code>Processing</code>: the * option's latest value is not yet visible in all searches but is in the * process of being activated. </li> <li><code>Active</code>: the * option's latest value is completely visible. Any warnings or messages * generated during processing are provided in * <code>Diagnostics</code>.</li> </ul> * <p> * Returns a reference to this object so that method calls can be chained together. * <p> * <b>Constraints:</b><br/> * <b>Allowed Values: </b>RequiresIndexDocuments, Processing, Active * * @param state The state of processing a change to an option. Possible values:<ul> * <li><code>RequiresIndexDocuments</code>: the option's latest value * will not be visible in searches until <a>IndexDocuments</a> has been * called and indexing is complete.</li> <li><code>Processing</code>: the * option's latest value is not yet visible in all searches but is in the * process of being activated. </li> <li><code>Active</code>: the * option's latest value is completely visible. Any warnings or messages * generated during processing are provided in * <code>Diagnostics</code>.</li> </ul> * * @return A reference to this updated object so that method calls can be chained * together. * * @see OptionState */ public OptionStatus withState(OptionState state) { this.state = state.toString(); return this; } /** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (creationDate != null) sb.append("CreationDate: " + creationDate + ", "); if (updateDate != null) sb.append("UpdateDate: " + updateDate + ", "); if (updateVersion != null) sb.append("UpdateVersion: " + updateVersion + ", "); if (state != null) sb.append("State: " + state + ", "); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getCreationDate() == null) ? 0 : getCreationDate().hashCode()); hashCode = prime * hashCode + ((getUpdateDate() == null) ? 0 : getUpdateDate().hashCode()); hashCode = prime * hashCode + ((getUpdateVersion() == null) ? 0 : getUpdateVersion().hashCode()); hashCode = prime * hashCode + ((getState() == null) ? 0 : getState().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof OptionStatus == false) return false; OptionStatus other = (OptionStatus)obj; if (other.getCreationDate() == null ^ this.getCreationDate() == null) return false; if (other.getCreationDate() != null && other.getCreationDate().equals(this.getCreationDate()) == false) return false; if (other.getUpdateDate() == null ^ this.getUpdateDate() == null) return false; if (other.getUpdateDate() != null && other.getUpdateDate().equals(this.getUpdateDate()) == false) return false; if (other.getUpdateVersion() == null ^ this.getUpdateVersion() == null) return false; if (other.getUpdateVersion() != null && other.getUpdateVersion().equals(this.getUpdateVersion()) == false) return false; if (other.getState() == null ^ this.getState() == null) return false; if (other.getState() != null && other.getState().equals(this.getState()) == false) return false; return true; } }
[ "zachmu@zachmu-1.desktop.amazon.com" ]
zachmu@zachmu-1.desktop.amazon.com
d7411e0cbe99f03646af00895f798b99cd48f278
4459469adac330f81035f4b3fa218c57570ebc03
/app/build/generated/not_namespaced_r_class_sources/debug/processDebugResources/r/android/support/compat/R.java
f4841226d281150462305a8510ddf963ea30de75
[]
no_license
NAGARJUNAVINAYKUMAR/GHMCeEnforcement
62ee9d9f08c9eff09654ed40e568796a6e7df19b
3a3a61118bc2dcf5112aca49b0d1dfe312fddd96
refs/heads/master
2020-04-11T02:57:54.481048
2019-06-03T16:59:06
2019-06-03T16:59:06
161,462,981
0
0
null
null
null
null
UTF-8
Java
false
false
10,453
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * gradle plugin from the resource data it found. It * should not be modified by hand. */ package android.support.compat; public final class R { private R() {} public static final class attr { private attr() {} public static final int alpha = 0x7f040027; public static final int font = 0x7f0400d0; public static final int fontProviderAuthority = 0x7f0400d2; public static final int fontProviderCerts = 0x7f0400d3; public static final int fontProviderFetchStrategy = 0x7f0400d4; public static final int fontProviderFetchTimeout = 0x7f0400d5; public static final int fontProviderPackage = 0x7f0400d6; public static final int fontProviderQuery = 0x7f0400d7; public static final int fontStyle = 0x7f0400d8; public static final int fontVariationSettings = 0x7f0400d9; public static final int fontWeight = 0x7f0400da; public static final int ttcIndex = 0x7f0401cf; } public static final class color { private color() {} public static final int notification_action_color_filter = 0x7f06006b; public static final int notification_icon_bg_color = 0x7f06006c; public static final int ripple_material_light = 0x7f060078; public static final int secondary_text_default_material_light = 0x7f06007a; } public static final class dimen { private dimen() {} public static final int compat_button_inset_horizontal_material = 0x7f0702e7; public static final int compat_button_inset_vertical_material = 0x7f0702e8; public static final int compat_button_padding_horizontal_material = 0x7f0702e9; public static final int compat_button_padding_vertical_material = 0x7f0702ea; public static final int compat_control_corner_material = 0x7f0702eb; public static final int compat_notification_large_icon_max_height = 0x7f0702ec; public static final int compat_notification_large_icon_max_width = 0x7f0702ed; public static final int notification_action_icon_size = 0x7f070391; public static final int notification_action_text_size = 0x7f070392; public static final int notification_big_circle_margin = 0x7f070393; public static final int notification_content_margin_start = 0x7f070394; public static final int notification_large_icon_height = 0x7f070395; public static final int notification_large_icon_width = 0x7f070396; public static final int notification_main_column_padding_top = 0x7f070397; public static final int notification_media_narrow_margin = 0x7f070398; public static final int notification_right_icon_size = 0x7f070399; public static final int notification_right_side_padding_top = 0x7f07039a; public static final int notification_small_icon_background_padding = 0x7f07039b; public static final int notification_small_icon_size_as_large = 0x7f07039c; public static final int notification_subtext_size = 0x7f07039d; public static final int notification_top_pad = 0x7f07039e; public static final int notification_top_pad_large_text = 0x7f07039f; } public static final class drawable { private drawable() {} public static final int notification_action_background = 0x7f080085; public static final int notification_bg = 0x7f080086; public static final int notification_bg_low = 0x7f080087; public static final int notification_bg_low_normal = 0x7f080088; public static final int notification_bg_low_pressed = 0x7f080089; public static final int notification_bg_normal = 0x7f08008a; public static final int notification_bg_normal_pressed = 0x7f08008b; public static final int notification_icon_background = 0x7f08008c; public static final int notification_template_icon_bg = 0x7f08008d; public static final int notification_template_icon_low_bg = 0x7f08008e; public static final int notification_tile_bg = 0x7f08008f; public static final int notify_panel_notification_icon_bg = 0x7f080090; } public static final class id { private id() {} public static final int action_container = 0x7f09002f; public static final int action_divider = 0x7f090031; public static final int action_image = 0x7f090032; public static final int action_text = 0x7f090038; public static final int actions = 0x7f090039; public static final int async = 0x7f090048; public static final int blocking = 0x7f090050; public static final int chronometer = 0x7f09006b; public static final int forever = 0x7f0900ad; public static final int icon = 0x7f0900c8; public static final int icon_group = 0x7f0900c9; public static final int info = 0x7f0900d6; public static final int italic = 0x7f0900d8; public static final int line1 = 0x7f0900e2; public static final int line3 = 0x7f0900e3; public static final int normal = 0x7f090109; public static final int notification_background = 0x7f09010b; public static final int notification_main_column = 0x7f09010c; public static final int notification_main_column_container = 0x7f09010d; public static final int right_icon = 0x7f09017e; public static final int right_side = 0x7f09017f; public static final int tag_transition_group = 0x7f0901d1; public static final int tag_unhandled_key_event_manager = 0x7f0901d2; public static final int tag_unhandled_key_listeners = 0x7f0901d3; public static final int text = 0x7f0901d5; public static final int text2 = 0x7f0901d6; public static final int time = 0x7f0901e3; public static final int title = 0x7f0901e7; } public static final class integer { private integer() {} public static final int status_bar_notification_info_maxnum = 0x7f0a000f; } public static final class layout { private layout() {} public static final int notification_action = 0x7f0c004c; public static final int notification_action_tombstone = 0x7f0c004d; public static final int notification_template_custom_big = 0x7f0c0054; public static final int notification_template_icon_group = 0x7f0c0055; public static final int notification_template_part_chronometer = 0x7f0c0059; public static final int notification_template_part_time = 0x7f0c005a; } public static final class string { private string() {} public static final int status_bar_notification_info_overflow = 0x7f0d009a; } public static final class style { private style() {} public static final int TextAppearance_Compat_Notification = 0x7f0e0116; public static final int TextAppearance_Compat_Notification_Info = 0x7f0e0117; public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0e0119; public static final int TextAppearance_Compat_Notification_Time = 0x7f0e011c; public static final int TextAppearance_Compat_Notification_Title = 0x7f0e011e; public static final int Widget_Compat_NotificationActionContainer = 0x7f0e01c5; public static final int Widget_Compat_NotificationActionText = 0x7f0e01c6; } public static final class styleable { private styleable() {} public static final int[] ColorStateListItem = { 0x10101a5, 0x101031f, 0x7f040027 }; public static final int ColorStateListItem_android_color = 0; public static final int ColorStateListItem_android_alpha = 1; public static final int ColorStateListItem_alpha = 2; public static final int[] FontFamily = { 0x7f0400d2, 0x7f0400d3, 0x7f0400d4, 0x7f0400d5, 0x7f0400d6, 0x7f0400d7 }; public static final int FontFamily_fontProviderAuthority = 0; public static final int FontFamily_fontProviderCerts = 1; public static final int FontFamily_fontProviderFetchStrategy = 2; public static final int FontFamily_fontProviderFetchTimeout = 3; public static final int FontFamily_fontProviderPackage = 4; public static final int FontFamily_fontProviderQuery = 5; public static final int[] FontFamilyFont = { 0x1010532, 0x1010533, 0x101053f, 0x101056f, 0x1010570, 0x7f0400d0, 0x7f0400d8, 0x7f0400d9, 0x7f0400da, 0x7f0401cf }; public static final int FontFamilyFont_android_font = 0; public static final int FontFamilyFont_android_fontWeight = 1; public static final int FontFamilyFont_android_fontStyle = 2; public static final int FontFamilyFont_android_ttcIndex = 3; public static final int FontFamilyFont_android_fontVariationSettings = 4; public static final int FontFamilyFont_font = 5; public static final int FontFamilyFont_fontStyle = 6; public static final int FontFamilyFont_fontVariationSettings = 7; public static final int FontFamilyFont_fontWeight = 8; public static final int FontFamilyFont_ttcIndex = 9; public static final int[] GradientColor = { 0x101019d, 0x101019e, 0x10101a1, 0x10101a2, 0x10101a3, 0x10101a4, 0x1010201, 0x101020b, 0x1010510, 0x1010511, 0x1010512, 0x1010513 }; public static final int GradientColor_android_startColor = 0; public static final int GradientColor_android_endColor = 1; public static final int GradientColor_android_type = 2; public static final int GradientColor_android_centerX = 3; public static final int GradientColor_android_centerY = 4; public static final int GradientColor_android_gradientRadius = 5; public static final int GradientColor_android_tileMode = 6; public static final int GradientColor_android_centerColor = 7; public static final int GradientColor_android_startX = 8; public static final int GradientColor_android_startY = 9; public static final int GradientColor_android_endX = 10; public static final int GradientColor_android_endY = 11; public static final int[] GradientColorItem = { 0x10101a5, 0x1010514 }; public static final int GradientColorItem_android_color = 0; public static final int GradientColorItem_android_offset = 1; } }
[ "nagarjuna.vinaykumar@gmail.com" ]
nagarjuna.vinaykumar@gmail.com
f40de620bb6e4aa3951a7cd032966670629780af
be73270af6be0a811bca4f1710dc6a038e4a8fd2
/crash-reproduction-moho/results/XWIKI-12798-85-30-PESA_II-WeightedSum:TestLen:CallDiversity/com/xpn/xwiki/internal/template/InternalTemplateManager_ESTest_scaffolding.java
e87eb7e1f7adfb7a76f331344c50ddf391debe13
[]
no_license
STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application
cf118b23ecb87a8bf59643e42f7556b521d1f754
3bb39683f9c343b8ec94890a00b8f260d158dfe3
refs/heads/master
2022-07-29T14:44:00.774547
2020-08-10T15:14:49
2020-08-10T15:14:49
285,804,495
0
0
null
null
null
null
UTF-8
Java
false
false
459
java
/** * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite * Sat Apr 04 00:31:51 UTC 2020 */ package com.xpn.xwiki.internal.template; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; import org.junit.Before; import org.junit.After; @EvoSuiteClassExclude public class InternalTemplateManager_ESTest_scaffolding { // Empty scaffolding for empty test suite }
[ "pouria.derakhshanfar@gmail.com" ]
pouria.derakhshanfar@gmail.com
a518ec01453809b5128bd2331b2cf5703a28f98f
83b0792dd919187193fa05739bdbdd03cf4b40fd
/YRBW-FORUM-1.01/src/main/java/com/cgb1904/sys/controller/SysUserController.java
9c6104e3ab9763bb86d195cf0e2a22ccd8a15496
[]
no_license
yalin001/MyDongBa
32cd7f986c07e8a27f188d56a9b1bcf64e702a7a
3dd971ae9d74f969dfaa908779e39009db92cb90
refs/heads/master
2022-03-01T21:12:43.101586
2019-09-18T11:38:17
2019-09-18T11:38:17
209,288,205
0
0
null
2022-02-09T22:18:35
2019-09-18T11:08:19
JavaScript
UTF-8
Java
false
false
1,648
java
package com.cgb1904.sys.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.cgb1904.common.vo.JsonResult; import com.cgb1904.common.vo.PageObject; import com.cgb1904.sys.po.SysUser; import com.cgb1904.sys.service.SysUserService; @Controller @RequestMapping("/users/") public class SysUserController { @Autowired private SysUserService sysUserService; @RequestMapping("doFindPageObjects") @ResponseBody public JsonResult doFindPageObjects( String username,Integer pageCurrent){ PageObject<SysUser> pageObject= sysUserService.findPageObjects(username, pageCurrent); return new JsonResult(pageObject); } @RequestMapping("doValidById") @ResponseBody public JsonResult doValidById(Integer id,Integer valid){ sysUserService.validById(id,valid); return new JsonResult("update ok"); } @RequestMapping("doSaveObject") @ResponseBody public JsonResult doSaveObject( SysUser entity){ sysUserService.saveObject(entity); return new JsonResult("save ok"); } @RequestMapping("doFindObjectById") @ResponseBody public JsonResult doFindObjectById( Integer id){ SysUser sysUser= sysUserService.findObjectById(id); return new JsonResult(sysUser); } @RequestMapping("doUpdateObject") @ResponseBody public JsonResult doUpdateObject( SysUser entity){ sysUserService.updateObject(entity); return new JsonResult("update ok"); } }
[ "Tarena@Tarena-PC" ]
Tarena@Tarena-PC
3edaae6333fc3bb07dadb91da427001d3d345f16
181c87bc593b873881b576b40ed88a85ade17de1
/SanketXmlParser/src/com/sanket/xml/PrescribedMedicationType.java
f93d4dfd8e908fe00236cdb5cde02e28f6a9bcad
[]
no_license
KetanMirg/myproject
7d39d95ae7dff476600d35011fe9be899539ee32
d6a2f79f07be01c81f1a45c7e94a7349baccd315
refs/heads/master
2020-06-11T09:22:55.098421
2017-06-06T13:41:05
2017-06-06T13:41:05
75,700,913
0
0
null
2016-12-06T06:47:03
2016-12-06T06:17:39
null
UTF-8
Java
false
false
17,447
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2017.06.06 at 05:53:09 PM IST // package com.sanket.xml; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for PrescribedMedicationType complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="PrescribedMedicationType"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element ref="{http://www.surescripts.com/messaging}DrugDescription"/> * &lt;element ref="{http://www.surescripts.com/messaging}DrugCoded" minOccurs="0"/> * &lt;element name="Quantity" type="{http://www.surescripts.com/messaging}QuantityType"/> * &lt;element ref="{http://www.surescripts.com/messaging}DaysSupply" minOccurs="0"/> * &lt;element name="Directions" type="{http://www.surescripts.com/messaging}an..140M"/> * &lt;element ref="{http://www.surescripts.com/messaging}Note" minOccurs="0"/> * &lt;element ref="{http://www.surescripts.com/messaging}Refills"/> * &lt;element ref="{http://www.surescripts.com/messaging}Substitutions"/> * &lt;element ref="{http://www.surescripts.com/messaging}WrittenDate"/> * &lt;element ref="{http://www.surescripts.com/messaging}LastFillDate" minOccurs="0"/> * &lt;element ref="{http://www.surescripts.com/messaging}ExpirationDate" minOccurs="0"/> * &lt;element ref="{http://www.surescripts.com/messaging}EffectiveDate" minOccurs="0"/> * &lt;element ref="{http://www.surescripts.com/messaging}PeriodEnd" minOccurs="0"/> * &lt;element ref="{http://www.surescripts.com/messaging}DeliveredOnDate" minOccurs="0"/> * &lt;element ref="{http://www.surescripts.com/messaging}DateValidated" minOccurs="0"/> * &lt;element ref="{http://www.surescripts.com/messaging}Diagnosis" maxOccurs="2" minOccurs="0"/> * &lt;element name="PriorAuthorization" type="{http://www.surescripts.com/messaging}PriorAuthorizationType" minOccurs="0"/> * &lt;element ref="{http://www.surescripts.com/messaging}DrugUseEvaluation" maxOccurs="5" minOccurs="0"/> * &lt;element ref="{http://www.surescripts.com/messaging}DrugCoverageStatusCode" maxOccurs="5" minOccurs="0"/> * &lt;element ref="{http://www.surescripts.com/messaging}PriorAuthorizationStatus" minOccurs="0"/> * &lt;element ref="{http://www.surescripts.com/messaging}StructuredSIG" maxOccurs="unbounded" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "PrescribedMedicationType", propOrder = { "drugDescription", "drugCoded", "quantity", "daysSupply", "directions", "note", "refills", "substitutions", "writtenDate", "lastFillDate", "expirationDate", "effectiveDate", "periodEnd", "deliveredOnDate", "dateValidated", "diagnosis", "priorAuthorization", "drugUseEvaluation", "drugCoverageStatusCode", "priorAuthorizationStatus", "structuredSIG" }) public class PrescribedMedicationType { @XmlElement(name = "DrugDescription", required = true) protected String drugDescription; @XmlElement(name = "DrugCoded") protected DrugCodedType drugCoded; @XmlElement(name = "Quantity", required = true) protected QuantityType quantity; @XmlElement(name = "DaysSupply") protected String daysSupply; @XmlElement(name = "Directions", required = true) protected String directions; @XmlElement(name = "Note") protected String note; @XmlElement(name = "Refills", required = true) protected RefillsType refills; @XmlElement(name = "Substitutions", required = true) protected String substitutions; @XmlElement(name = "WrittenDate", required = true) protected DateType writtenDate; @XmlElement(name = "LastFillDate") protected DateType lastFillDate; @XmlElement(name = "ExpirationDate") protected DateType expirationDate; @XmlElement(name = "EffectiveDate") protected DateType effectiveDate; @XmlElement(name = "PeriodEnd") protected DateType periodEnd; @XmlElement(name = "DeliveredOnDate") protected DateType deliveredOnDate; @XmlElement(name = "DateValidated") protected DateType dateValidated; @XmlElement(name = "Diagnosis") protected List<Diagnosis> diagnosis; @XmlElement(name = "PriorAuthorization") protected PriorAuthorizationType priorAuthorization; @XmlElement(name = "DrugUseEvaluation") protected List<DrugUseEvaluationType> drugUseEvaluation; @XmlElement(name = "DrugCoverageStatusCode") protected List<String> drugCoverageStatusCode; @XmlElement(name = "PriorAuthorizationStatus") protected String priorAuthorizationStatus; @XmlElement(name = "StructuredSIG") protected List<SIGType> structuredSIG; /** * Gets the value of the drugDescription property. * * @return * possible object is * {@link String } * */ public String getDrugDescription() { return drugDescription; } /** * Sets the value of the drugDescription property. * * @param value * allowed object is * {@link String } * */ public void setDrugDescription(String value) { this.drugDescription = value; } /** * Gets the value of the drugCoded property. * * @return * possible object is * {@link DrugCodedType } * */ public DrugCodedType getDrugCoded() { return drugCoded; } /** * Sets the value of the drugCoded property. * * @param value * allowed object is * {@link DrugCodedType } * */ public void setDrugCoded(DrugCodedType value) { this.drugCoded = value; } /** * Gets the value of the quantity property. * * @return * possible object is * {@link QuantityType } * */ public QuantityType getQuantity() { return quantity; } /** * Sets the value of the quantity property. * * @param value * allowed object is * {@link QuantityType } * */ public void setQuantity(QuantityType value) { this.quantity = value; } /** * Gets the value of the daysSupply property. * * @return * possible object is * {@link String } * */ public String getDaysSupply() { return daysSupply; } /** * Sets the value of the daysSupply property. * * @param value * allowed object is * {@link String } * */ public void setDaysSupply(String value) { this.daysSupply = value; } /** * Gets the value of the directions property. * * @return * possible object is * {@link String } * */ public String getDirections() { return directions; } /** * Sets the value of the directions property. * * @param value * allowed object is * {@link String } * */ public void setDirections(String value) { this.directions = value; } /** * Gets the value of the note property. * * @return * possible object is * {@link String } * */ public String getNote() { return note; } /** * Sets the value of the note property. * * @param value * allowed object is * {@link String } * */ public void setNote(String value) { this.note = value; } /** * Gets the value of the refills property. * * @return * possible object is * {@link RefillsType } * */ public RefillsType getRefills() { return refills; } /** * Sets the value of the refills property. * * @param value * allowed object is * {@link RefillsType } * */ public void setRefills(RefillsType value) { this.refills = value; } /** * Gets the value of the substitutions property. * * @return * possible object is * {@link String } * */ public String getSubstitutions() { return substitutions; } /** * Sets the value of the substitutions property. * * @param value * allowed object is * {@link String } * */ public void setSubstitutions(String value) { this.substitutions = value; } /** * Gets the value of the writtenDate property. * * @return * possible object is * {@link DateType } * */ public DateType getWrittenDate() { return writtenDate; } /** * Sets the value of the writtenDate property. * * @param value * allowed object is * {@link DateType } * */ public void setWrittenDate(DateType value) { this.writtenDate = value; } /** * Gets the value of the lastFillDate property. * * @return * possible object is * {@link DateType } * */ public DateType getLastFillDate() { return lastFillDate; } /** * Sets the value of the lastFillDate property. * * @param value * allowed object is * {@link DateType } * */ public void setLastFillDate(DateType value) { this.lastFillDate = value; } /** * Gets the value of the expirationDate property. * * @return * possible object is * {@link DateType } * */ public DateType getExpirationDate() { return expirationDate; } /** * Sets the value of the expirationDate property. * * @param value * allowed object is * {@link DateType } * */ public void setExpirationDate(DateType value) { this.expirationDate = value; } /** * Gets the value of the effectiveDate property. * * @return * possible object is * {@link DateType } * */ public DateType getEffectiveDate() { return effectiveDate; } /** * Sets the value of the effectiveDate property. * * @param value * allowed object is * {@link DateType } * */ public void setEffectiveDate(DateType value) { this.effectiveDate = value; } /** * Gets the value of the periodEnd property. * * @return * possible object is * {@link DateType } * */ public DateType getPeriodEnd() { return periodEnd; } /** * Sets the value of the periodEnd property. * * @param value * allowed object is * {@link DateType } * */ public void setPeriodEnd(DateType value) { this.periodEnd = value; } /** * Gets the value of the deliveredOnDate property. * * @return * possible object is * {@link DateType } * */ public DateType getDeliveredOnDate() { return deliveredOnDate; } /** * Sets the value of the deliveredOnDate property. * * @param value * allowed object is * {@link DateType } * */ public void setDeliveredOnDate(DateType value) { this.deliveredOnDate = value; } /** * Gets the value of the dateValidated property. * * @return * possible object is * {@link DateType } * */ public DateType getDateValidated() { return dateValidated; } /** * Sets the value of the dateValidated property. * * @param value * allowed object is * {@link DateType } * */ public void setDateValidated(DateType value) { this.dateValidated = value; } /** * Gets the value of the diagnosis property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the diagnosis property. * * <p> * For example, to add a new item, do as follows: * <pre> * getDiagnosis().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link Diagnosis } * * */ public List<Diagnosis> getDiagnosis() { if (diagnosis == null) { diagnosis = new ArrayList<Diagnosis>(); } return this.diagnosis; } /** * Gets the value of the priorAuthorization property. * * @return * possible object is * {@link PriorAuthorizationType } * */ public PriorAuthorizationType getPriorAuthorization() { return priorAuthorization; } /** * Sets the value of the priorAuthorization property. * * @param value * allowed object is * {@link PriorAuthorizationType } * */ public void setPriorAuthorization(PriorAuthorizationType value) { this.priorAuthorization = value; } /** * Gets the value of the drugUseEvaluation property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the drugUseEvaluation property. * * <p> * For example, to add a new item, do as follows: * <pre> * getDrugUseEvaluation().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link DrugUseEvaluationType } * * */ public List<DrugUseEvaluationType> getDrugUseEvaluation() { if (drugUseEvaluation == null) { drugUseEvaluation = new ArrayList<DrugUseEvaluationType>(); } return this.drugUseEvaluation; } /** * Gets the value of the drugCoverageStatusCode property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the drugCoverageStatusCode property. * * <p> * For example, to add a new item, do as follows: * <pre> * getDrugCoverageStatusCode().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link String } * * */ public List<String> getDrugCoverageStatusCode() { if (drugCoverageStatusCode == null) { drugCoverageStatusCode = new ArrayList<String>(); } return this.drugCoverageStatusCode; } /** * Gets the value of the priorAuthorizationStatus property. * * @return * possible object is * {@link String } * */ public String getPriorAuthorizationStatus() { return priorAuthorizationStatus; } /** * Sets the value of the priorAuthorizationStatus property. * * @param value * allowed object is * {@link String } * */ public void setPriorAuthorizationStatus(String value) { this.priorAuthorizationStatus = value; } /** * Gets the value of the structuredSIG property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the structuredSIG property. * * <p> * For example, to add a new item, do as follows: * <pre> * getStructuredSIG().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link SIGType } * * */ public List<SIGType> getStructuredSIG() { if (structuredSIG == null) { structuredSIG = new ArrayList<SIGType>(); } return this.structuredSIG; } }
[ "ketan.mirg@DEL1-DHP-27538.synapse.com" ]
ketan.mirg@DEL1-DHP-27538.synapse.com
afeff1d43c5923d87d51a8276c9620819626510e
143d9814b3946131ce8745d22ec90888300bac40
/src/cx/fbn/nevernote/xml/ImportData.java
8a028d637451bdc10ed4afa954129b1c0ae4c926
[]
no_license
loochao/nevernote-1
2dc7d808e96665f9e696e4f0961f1188b0dc90d9
abe4b8aebdd5db2a41c453d520f742626503af9f
refs/heads/master
2021-04-29T09:19:08.057225
2010-07-25T01:58:33
2010-07-25T01:58:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
17,899
java
/* * This file is part of NeverNote * Copyright 2009 Randy Baumgarte * * This file may be licensed under the terms of of the * GNU General Public License Version 2 (the ``GPL''). * * Software distributed under the License is distributed * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either * express or implied. See the GPL for the specific language * governing rights and limitations. * * You should have received a copy of the GPL along with this * program. If not, go to http://www.gnu.org/licenses/gpl.html * or write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ package cx.fbn.nevernote.xml; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import com.evernote.edam.type.Data; import com.evernote.edam.type.Note; import com.evernote.edam.type.NoteAttributes; import com.evernote.edam.type.Notebook; import com.evernote.edam.type.Resource; import com.evernote.edam.type.ResourceAttributes; import com.evernote.edam.type.SavedSearch; import com.evernote.edam.type.Tag; import com.trolltech.qt.core.QByteArray; import com.trolltech.qt.core.QFile; import com.trolltech.qt.core.QIODevice; import com.trolltech.qt.xml.QXmlStreamAttributes; import com.trolltech.qt.xml.QXmlStreamReader; import cx.fbn.nevernote.sql.DatabaseConnection; import cx.fbn.nevernote.utilities.ApplicationLogger; public class ImportData { public int lastError; private String errorMessage; private String fileName; DatabaseConnection conn; QXmlStreamReader reader; private Note note; private boolean noteIsDirty; private Notebook notebook; private boolean notebookIsDirty; private boolean notebookIsLocal; private Tag tag; private boolean tagIsDirty; private final HashMap<String,Integer> titleColors; private SavedSearch search; private boolean searchIsDirty; public int highUpdateSequenceNumber; public long lastSequenceDate; private final ApplicationLogger logger; private final boolean backup; private String notebookGuid; public ImportData(DatabaseConnection c, boolean full) { logger = new ApplicationLogger("import.log"); backup = full; conn = c; titleColors = new HashMap<String,Integer>(); } public void importData(String f) { fileName = f; errorMessage = ""; lastError = 0; errorMessage = ""; QFile xmlFile = new QFile(fileName); if (!xmlFile.open(QIODevice.OpenModeFlag.ReadOnly)) { lastError = 16; errorMessage = "Cannot open file."; } reader = new QXmlStreamReader(xmlFile); while (!reader.atEnd()) { reader.readNext(); if (reader.hasError()) { errorMessage = reader.errorString(); logger.log(logger.LOW, "************************* ERROR READING BACKUP " +reader.errorString()); lastError = 16; return; } if (reader.name().equalsIgnoreCase("nevernote-export") && reader.isStartElement()) { QXmlStreamAttributes attributes = reader.attributes(); String version = attributes.value("version"); String type = attributes.value("exportType"); String application = attributes.value("application"); if (!version.equalsIgnoreCase("0.85") && !version.equalsIgnoreCase("0.86")) { lastError = 1; errorMessage = "Unknown backup version = " +version; return; } if (!application.equalsIgnoreCase("NeverNote")) { lastError = 2; errorMessage = "This backup is from an unknown application = " +application; return; } if (!type.equalsIgnoreCase("backup") && backup) { lastError = 4; errorMessage = "This is an export file, not a backup file"; return; } if (type.equalsIgnoreCase("export") && backup) { lastError = 5; errorMessage = "This is a backup file, not an export file"; return; } } if (reader.name().equalsIgnoreCase("Synchronization") && reader.isStartElement() && backup) { processSynchronizationNode(); conn.getSyncTable().setLastSequenceDate(lastSequenceDate); conn.getSyncTable().setUpdateSequenceNumber(highUpdateSequenceNumber); // Global.setSequenceDate(lastSequenceDate); // Global.setUpdateSequenceNumber(highUpdateSequenceNumber); } if (reader.name().equalsIgnoreCase("note") && reader.isStartElement()) { processNoteNode(); if (backup) conn.getNoteTable().addNote(note, noteIsDirty); else { note.setUpdateSequenceNum(0); if (notebookGuid != null) note.setNotebookGuid(notebookGuid); for (int i=0; i<note.getResourcesSize(); i++) { note.getResources().get(i).setUpdateSequenceNum(0); } conn.getNoteTable().addNote(note, true); } if (titleColors.containsKey(note.getGuid())) conn.getNoteTable().setNoteTitleColor(note.getGuid(), titleColors.get(note.getGuid())); } if (reader.name().equalsIgnoreCase("notebook") && reader.isStartElement() && backup) { processNotebookNode(); String existingGuid = conn.getNotebookTable().findNotebookByName(notebook.getName()); if (existingGuid == null) conn.getNotebookTable().addNotebook(notebook, notebookIsDirty, notebookIsLocal); else { conn.getNotebookTable().updateNotebookGuid(existingGuid, notebook.getGuid()); conn.getNotebookTable().updateNotebook(notebook, notebookIsDirty); } } if (reader.name().equalsIgnoreCase("tag") && reader.isStartElement() && backup) { processTagNode(); String testGuid = conn.getTagTable().findTagByName(tag.getName()); if (testGuid == null) conn.getTagTable().addTag(tag, tagIsDirty); else { conn.getTagTable().updateTagGuid(testGuid, tag.getGuid()); conn.getTagTable().updateTag(tag,tagIsDirty); } } if (reader.name().equalsIgnoreCase("savedsearch") && reader.isStartElement() && backup) { processSavedSearchNode(); conn.getSavedSearchTable().addSavedSearch(search, searchIsDirty); } } xmlFile.close(); } private void processNoteNode() { note = new Note(); note.setResources(new ArrayList<Resource>()); boolean atEnd = false; while(!atEnd) { if (reader.isStartElement()) { if (reader.name().equalsIgnoreCase("Guid")) note.setGuid(textValue()); if (reader.name().equalsIgnoreCase("UpdateSequenceNumber")) note.setUpdateSequenceNum(intValue()); if (reader.name().equalsIgnoreCase("Title")) note.setTitle(textValue()); if (reader.name().equalsIgnoreCase("Created")) note.setCreated(longValue()); if (reader.name().equalsIgnoreCase("Updated")) note.setUpdated(longValue()); if (reader.name().equalsIgnoreCase("Deleted")) note.setDeleted(longValue()); if (reader.name().equalsIgnoreCase("Active")) note.setActive(booleanValue()); if (reader.name().equalsIgnoreCase("NotebookGuid") && backup) note.setNotebookGuid(textValue()); if (reader.name().equalsIgnoreCase("Content")) note.setContent(textValue()); if (reader.name().equalsIgnoreCase("NoteTags") && backup) note.setTagGuids(processNoteTagList()); if (reader.name().equalsIgnoreCase("NoteAttributes")) note.setAttributes(processNoteAttributes()); if (reader.name().equalsIgnoreCase("NoteResource")) note.getResources().add(processResource()); if (reader.name().equalsIgnoreCase("Dirty")) { if (booleanValue()) noteIsDirty=true; } if (reader.name().equalsIgnoreCase("TitleColor")) titleColors.put(note.getGuid(), intValue()); } reader.readNext(); if (reader.name().equalsIgnoreCase("note") && reader.isEndElement()) atEnd = true; } return; } private Resource processResource() { Resource resource = new Resource(); boolean atEnd = false; boolean isDirty = false; while(!atEnd) { if (reader.isStartElement()) { if (reader.name().equalsIgnoreCase("Guid")) resource.setGuid(textValue()); if (reader.name().equalsIgnoreCase("NoteGuid")) resource.setNoteGuid(textValue()); if (reader.name().equalsIgnoreCase("UpdateSequenceNumber")) resource.setUpdateSequenceNum(intValue()); if (reader.name().equalsIgnoreCase("Active")) resource.setActive(booleanValue()); if (reader.name().equalsIgnoreCase("Mime")) resource.setMime(textValue()); if (reader.name().equalsIgnoreCase("Duration")) resource.setDuration(shortValue()); if (reader.name().equalsIgnoreCase("Height")) resource.setHeight(shortValue()); if (reader.name().equalsIgnoreCase("Width")) resource.setWidth(shortValue()); if (reader.name().equalsIgnoreCase("dirty")) isDirty = booleanValue(); if (reader.name().equalsIgnoreCase("Data")) resource.setData(processData("Data")); if (reader.name().equalsIgnoreCase("AlternateData")) resource.setAlternateData(processData("AlternateData")); if (reader.name().equalsIgnoreCase("RecognitionData")) resource.setRecognition(processData("NoteResourceAttribute")); if (reader.name().equalsIgnoreCase("NoteResourceAttribute")) resource.setAttributes(processResourceAttributes()); } reader.readNext(); if (reader.name().equalsIgnoreCase("noteresource") && reader.isEndElement()) atEnd = true; } conn.getNoteTable().noteResourceTable.saveNoteResource(resource, isDirty); return resource; } private Data processData(String nodeName) { Data data = new Data(); boolean atEnd = false; while(!atEnd) { if (reader.isStartElement()) { if (reader.name().equalsIgnoreCase("Size")) data.setSize(intValue()); if (reader.name().equalsIgnoreCase("Body")) { byte[] b = textValue().getBytes(); // data binary QByteArray hexData = new QByteArray(b); QByteArray binData = new QByteArray(QByteArray.fromHex(hexData)); data.setBody(binData.toByteArray()); } if (reader.name().equalsIgnoreCase("BodyHash")) { byte[] b = textValue().getBytes(); // data binary QByteArray hexData = new QByteArray(b); QByteArray binData = new QByteArray(QByteArray.fromHex(hexData)); data.setBodyHash(binData.toByteArray()); } reader.readNext(); if (reader.name().equalsIgnoreCase("data") && reader.isEndElement()) atEnd = true; } reader.readNext(); if (reader.name().equalsIgnoreCase(nodeName) && reader.isEndElement()) atEnd = true; } return data; } private ResourceAttributes processResourceAttributes() { ResourceAttributes attributes = new ResourceAttributes(); boolean atEnd = false; while(!atEnd) { if (reader.isStartElement()) { if (reader.name().equalsIgnoreCase("CameraMake")) attributes.setCameraMake(textValue()); if (reader.name().equalsIgnoreCase("CameraModel")) attributes.setCameraModel(textValue()); if (reader.name().equalsIgnoreCase("FileName")) attributes.setFileName(textValue()); if (reader.name().equalsIgnoreCase("RecoType")) attributes.setRecoType(textValue()); if (reader.name().equalsIgnoreCase("CameraModel")) attributes.setCameraMake(textValue()); if (reader.name().equalsIgnoreCase("SourceURL")) attributes.setSourceURL(textValue()); if (reader.name().equalsIgnoreCase("Altitude")) attributes.setAltitude(doubleValue()); if (reader.name().equalsIgnoreCase("Longitude")) attributes.setLongitude(doubleValue()); if (reader.name().equalsIgnoreCase("Latitude")) attributes.setLatitude(doubleValue()); if (reader.name().equalsIgnoreCase("Timestamp")) attributes.setTimestamp(longValue()); if (reader.name().equalsIgnoreCase("Attachment")) attributes.setAttachment(booleanValue()); if (reader.name().equalsIgnoreCase("ClientWillIndex")) attributes.setClientWillIndex(booleanValue()); } reader.readNext(); if (reader.name().equalsIgnoreCase("noteresourceattribute") && reader.isEndElement()) atEnd = true; } return attributes; } private List<String> processNoteTagList() { List<String> guidList = new ArrayList<String>(); boolean atEnd = false; while(!atEnd) { if (reader.isStartElement()) { if (reader.name().equalsIgnoreCase("guid")) guidList.add(textValue()); } reader.readNext(); if (reader.name().equalsIgnoreCase("notetags") && reader.isEndElement()) atEnd = true; } return guidList; } private NoteAttributes processNoteAttributes() { NoteAttributes attributes = new NoteAttributes(); boolean atEnd = false; while(!atEnd) { if (reader.isStartElement()) { if (reader.name().equalsIgnoreCase("Author")) attributes.setAuthor(textValue()); if (reader.name().equalsIgnoreCase("SourceURL")) attributes.setSourceURL(textValue()); if (reader.name().equalsIgnoreCase("Source")) attributes.setSource(textValue()); if (reader.name().equalsIgnoreCase("SourceApplication")) attributes.setSourceApplication(textValue()); if (reader.name().equalsIgnoreCase("Altitude")) attributes.setAltitude(doubleValue()); if (reader.name().equalsIgnoreCase("Longitude")) attributes.setLongitude(doubleValue()); if (reader.name().equalsIgnoreCase("Latitude")) attributes.setLatitude(doubleValue()); if (reader.name().equalsIgnoreCase("SubjectDate")) attributes.setSubjectDate(longValue()); } reader.readNext(); if (reader.name().equalsIgnoreCase("noteattributes") && reader.isEndElement()) atEnd = true; } return attributes; } private void processSynchronizationNode() { boolean atEnd = false; while(!atEnd) { if (reader.isStartElement()) { if (reader.name().equalsIgnoreCase("UpdateSequenceNumber")) highUpdateSequenceNumber = intValue(); if (reader.name().equalsIgnoreCase("LastSequenceDate")) lastSequenceDate = longValue(); } reader.readNext(); if (reader.name().equalsIgnoreCase("synchronization") && reader.isEndElement()) atEnd = true; } } private void processSavedSearchNode() { search = new SavedSearch(); searchIsDirty = false; boolean atEnd = false; while(!atEnd) { if (reader.isStartElement()) { if (reader.name().equalsIgnoreCase("Guid")) search.setGuid(textValue()); if (reader.name().equalsIgnoreCase("Name")) search.setName(textValue()); if (reader.name().equalsIgnoreCase("UpdateSequenceNumber")) search.setUpdateSequenceNum(intValue()); if (reader.name().equalsIgnoreCase("Query")) search.setQuery(textValue()); if (reader.name().equalsIgnoreCase("Dirty")) { if (booleanValue()) searchIsDirty = true; } } reader.readNext(); if (reader.name().equalsIgnoreCase("savedsearch") && reader.isEndElement()) atEnd = true; } return; } private void processNotebookNode() { notebook = new Notebook(); notebookIsDirty = false; notebookIsLocal = false; boolean atEnd = false; while(!atEnd) { if (reader.isStartElement()) { if (reader.name().equalsIgnoreCase("Guid")) notebook.setGuid(textValue()); if (reader.name().equalsIgnoreCase("Name")) notebook.setName(textValue()); if (reader.name().equalsIgnoreCase("UpdateSequenceNumber")) notebook.setUpdateSequenceNum(intValue()); if (reader.name().equalsIgnoreCase("ServiceCreated")) notebook.setServiceCreated(longValue()); if (reader.name().equalsIgnoreCase("ServiceUpdated")) notebook.setServiceUpdated(longValue()); if (reader.name().equalsIgnoreCase("DefaultNotebook")) { notebook.setDefaultNotebook(booleanValue()); } if (reader.name().equalsIgnoreCase("Dirty")) { if (booleanValue()) notebookIsDirty = true; } if (reader.name().equalsIgnoreCase("LocalNotebook")) { if (booleanValue()) notebookIsLocal = true; } } reader.readNext(); if (reader.name().equalsIgnoreCase("notebook") && reader.isEndElement()) atEnd = true; } return; } private void processTagNode() { tag = new Tag(); tagIsDirty = false; boolean atEnd = false; while(!atEnd) { if (reader.isStartElement()) { if (reader.name().equalsIgnoreCase("Guid")) tag.setGuid(textValue()); if (reader.name().equalsIgnoreCase("Name")) tag.setName(textValue()); if (reader.name().equalsIgnoreCase("UpdateSequenceNumber")) tag.setUpdateSequenceNum(intValue()); if (reader.name().equalsIgnoreCase("ParentGuid")) tag.setParentGuid(textValue()); if (reader.name().equalsIgnoreCase("Dirty")) { if (booleanValue()) tagIsDirty = true; } } reader.readNext(); if (reader.name().equalsIgnoreCase("tag") && reader.isEndElement()) atEnd = true; } return; } private String textValue() { return reader.readElementText(); } private int intValue() { return new Integer(textValue()); } private long longValue() { return new Long(textValue()); } private double doubleValue() { return new Double(textValue()); } private boolean booleanValue() { String value = textValue(); if (value.equalsIgnoreCase("true")) return true; else return false; } private short shortValue() { return new Short(textValue()); } public void setNotebookGuid(String g) { notebookGuid = g; } public String getErrorMessage() { return errorMessage; } }
[ "miurahr@linux.com" ]
miurahr@linux.com
55c0a9ff15c669887a0e09b769ce4b9b4c35eee7
a3270c3c6a48cba4e19fe7a2e574219af61e7206
/src/test/java/com/lextersoft/service/MailServiceIntTest.java
86afc556f7b97e1c008830054002d3bb4c76755d
[]
no_license
dmorales25/SysComArch
19164dd1c2c6c36a2aa16d9c1b5a3f2b421739a9
9fc8770555f99d3d7f04765120c3f585a5af3032
refs/heads/master
2020-05-04T12:59:02.022220
2019-04-02T21:24:56
2019-04-02T21:24:56
179,142,877
0
0
null
null
null
null
UTF-8
Java
false
false
8,899
java
package com.lextersoft.service; import com.lextersoft.config.Constants; import com.lextersoft.SysComArchApp; import com.lextersoft.domain.User; import io.github.jhipster.config.JHipsterProperties; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.MockitoAnnotations; import org.mockito.Spy; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.MessageSource; import org.springframework.mail.MailSendException; import org.springframework.mail.javamail.JavaMailSenderImpl; import org.springframework.test.context.junit4.SpringRunner; import org.thymeleaf.spring5.SpringTemplateEngine; import javax.mail.Multipart; import javax.mail.internet.MimeBodyPart; import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMultipart; import java.io.ByteArrayOutputStream; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.*; @RunWith(SpringRunner.class) @SpringBootTest(classes = SysComArchApp.class) public class MailServiceIntTest { @Autowired private JHipsterProperties jHipsterProperties; @Autowired private MessageSource messageSource; @Autowired private SpringTemplateEngine templateEngine; @Spy private JavaMailSenderImpl javaMailSender; @Captor private ArgumentCaptor<MimeMessage> messageCaptor; private MailService mailService; @Before public void setup() { MockitoAnnotations.initMocks(this); doNothing().when(javaMailSender).send(any(MimeMessage.class)); mailService = new MailService(jHipsterProperties, javaMailSender, messageSource, templateEngine); } @Test public void testSendEmail() throws Exception { mailService.sendEmail("john.doe@example.com", "testSubject", "testContent", false, false); verify(javaMailSender).send(messageCaptor.capture()); MimeMessage message = messageCaptor.getValue(); assertThat(message.getSubject()).isEqualTo("testSubject"); assertThat(message.getAllRecipients()[0].toString()).isEqualTo("john.doe@example.com"); assertThat(message.getFrom()[0].toString()).isEqualTo("test@localhost"); assertThat(message.getContent()).isInstanceOf(String.class); assertThat(message.getContent().toString()).isEqualTo("testContent"); assertThat(message.getDataHandler().getContentType()).isEqualTo("text/plain; charset=UTF-8"); } @Test public void testSendHtmlEmail() throws Exception { mailService.sendEmail("john.doe@example.com", "testSubject", "testContent", false, true); verify(javaMailSender).send(messageCaptor.capture()); MimeMessage message = messageCaptor.getValue(); assertThat(message.getSubject()).isEqualTo("testSubject"); assertThat(message.getAllRecipients()[0].toString()).isEqualTo("john.doe@example.com"); assertThat(message.getFrom()[0].toString()).isEqualTo("test@localhost"); assertThat(message.getContent()).isInstanceOf(String.class); assertThat(message.getContent().toString()).isEqualTo("testContent"); assertThat(message.getDataHandler().getContentType()).isEqualTo("text/html;charset=UTF-8"); } @Test public void testSendMultipartEmail() throws Exception { mailService.sendEmail("john.doe@example.com", "testSubject", "testContent", true, false); verify(javaMailSender).send(messageCaptor.capture()); MimeMessage message = messageCaptor.getValue(); MimeMultipart mp = (MimeMultipart) message.getContent(); MimeBodyPart part = (MimeBodyPart) ((MimeMultipart) mp.getBodyPart(0).getContent()).getBodyPart(0); ByteArrayOutputStream aos = new ByteArrayOutputStream(); part.writeTo(aos); assertThat(message.getSubject()).isEqualTo("testSubject"); assertThat(message.getAllRecipients()[0].toString()).isEqualTo("john.doe@example.com"); assertThat(message.getFrom()[0].toString()).isEqualTo("test@localhost"); assertThat(message.getContent()).isInstanceOf(Multipart.class); assertThat(aos.toString()).isEqualTo("\r\ntestContent"); assertThat(part.getDataHandler().getContentType()).isEqualTo("text/plain; charset=UTF-8"); } @Test public void testSendMultipartHtmlEmail() throws Exception { mailService.sendEmail("john.doe@example.com", "testSubject", "testContent", true, true); verify(javaMailSender).send(messageCaptor.capture()); MimeMessage message = messageCaptor.getValue(); MimeMultipart mp = (MimeMultipart) message.getContent(); MimeBodyPart part = (MimeBodyPart) ((MimeMultipart) mp.getBodyPart(0).getContent()).getBodyPart(0); ByteArrayOutputStream aos = new ByteArrayOutputStream(); part.writeTo(aos); assertThat(message.getSubject()).isEqualTo("testSubject"); assertThat(message.getAllRecipients()[0].toString()).isEqualTo("john.doe@example.com"); assertThat(message.getFrom()[0].toString()).isEqualTo("test@localhost"); assertThat(message.getContent()).isInstanceOf(Multipart.class); assertThat(aos.toString()).isEqualTo("\r\ntestContent"); assertThat(part.getDataHandler().getContentType()).isEqualTo("text/html;charset=UTF-8"); } @Test public void testSendEmailFromTemplate() throws Exception { User user = new User(); user.setLogin("john"); user.setEmail("john.doe@example.com"); user.setLangKey("en"); mailService.sendEmailFromTemplate(user, "mail/testEmail", "email.test.title"); verify(javaMailSender).send(messageCaptor.capture()); MimeMessage message = messageCaptor.getValue(); assertThat(message.getSubject()).isEqualTo("test title"); assertThat(message.getAllRecipients()[0].toString()).isEqualTo(user.getEmail()); assertThat(message.getFrom()[0].toString()).isEqualTo("test@localhost"); assertThat(message.getContent().toString()).isEqualToNormalizingNewlines("<html>test title, http://127.0.0.1:8080, john</html>\n"); assertThat(message.getDataHandler().getContentType()).isEqualTo("text/html;charset=UTF-8"); } @Test public void testSendActivationEmail() throws Exception { User user = new User(); user.setLangKey(Constants.DEFAULT_LANGUAGE); user.setLogin("john"); user.setEmail("john.doe@example.com"); mailService.sendActivationEmail(user); verify(javaMailSender).send(messageCaptor.capture()); MimeMessage message = messageCaptor.getValue(); assertThat(message.getAllRecipients()[0].toString()).isEqualTo(user.getEmail()); assertThat(message.getFrom()[0].toString()).isEqualTo("test@localhost"); assertThat(message.getContent().toString()).isNotEmpty(); assertThat(message.getDataHandler().getContentType()).isEqualTo("text/html;charset=UTF-8"); } @Test public void testCreationEmail() throws Exception { User user = new User(); user.setLangKey(Constants.DEFAULT_LANGUAGE); user.setLogin("john"); user.setEmail("john.doe@example.com"); mailService.sendCreationEmail(user); verify(javaMailSender).send(messageCaptor.capture()); MimeMessage message = messageCaptor.getValue(); assertThat(message.getAllRecipients()[0].toString()).isEqualTo(user.getEmail()); assertThat(message.getFrom()[0].toString()).isEqualTo("test@localhost"); assertThat(message.getContent().toString()).isNotEmpty(); assertThat(message.getDataHandler().getContentType()).isEqualTo("text/html;charset=UTF-8"); } @Test public void testSendPasswordResetMail() throws Exception { User user = new User(); user.setLangKey(Constants.DEFAULT_LANGUAGE); user.setLogin("john"); user.setEmail("john.doe@example.com"); mailService.sendPasswordResetMail(user); verify(javaMailSender).send(messageCaptor.capture()); MimeMessage message = messageCaptor.getValue(); assertThat(message.getAllRecipients()[0].toString()).isEqualTo(user.getEmail()); assertThat(message.getFrom()[0].toString()).isEqualTo("test@localhost"); assertThat(message.getContent().toString()).isNotEmpty(); assertThat(message.getDataHandler().getContentType()).isEqualTo("text/html;charset=UTF-8"); } @Test public void testSendEmailWithException() throws Exception { doThrow(MailSendException.class).when(javaMailSender).send(any(MimeMessage.class)); mailService.sendEmail("john.doe@example.com", "testSubject", "testContent", false, false); } }
[ "morales.david1997@gmail.com" ]
morales.david1997@gmail.com
82202b114971dc578cadac0d9c6d011fd2c523b0
0d3b15352dcbd424c479c09bf99d21d9d6d1f64c
/src/main/java/com/api/tobrasil/config/SwaggerConfig.java
280da60a0313a815534924381e29b62398e2cc05
[]
no_license
rafaelNob/testeTObrasil
96051d2fa52330a8121cb7571853bce9d763338b
897b435a5ff3ab5ba6cf5e3a2a5b703199af855b
refs/heads/master
2022-11-25T13:42:28.129977
2020-07-08T14:55:34
2020-07-08T14:55:34
278,118,066
0
0
null
null
null
null
UTF-8
Java
false
false
1,310
java
package com.api.tobrasil.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.service.ApiInfo; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.swagger2.annotations.EnableSwagger2; @Configuration @EnableSwagger2 public class SwaggerConfig { /** * * @link http://localhost:8000/aluno/swagger-ui.html */ @Bean public Docket api() { return new Docket(DocumentationType.SWAGGER_2).select().apis(RequestHandlerSelectors.basePackage("com.api.tobrasil.controller")) .paths(PathSelectors.any()).build().apiInfo(apiInfo()); } private ApiInfo apiInfo() { return new ApiInfoBuilder().title("Projeto Simples RestAPI") .description("Um exemplo de aplicação Spring Boot REST API").version("1.0.0") .license("Apache License Version 2.0").licenseUrl("https://www.apache.org/licenses/LICENSE-2.0") .contact(new springfox.documentation.service.Contact("Rafael Noberto", "", "nobertorafael9@gmail.com")).build(); } }
[ "Rafael.Franca@dellavolpe.com.br" ]
Rafael.Franca@dellavolpe.com.br
8c8b6d06c9b5ad764532a6962b1ef81b504788ad
fa93c9be2923e697fb8a2066f8fb65c7718cdec7
/sources/com/google/android/gms/internal/ads/zzln.java
446f491d482828ea86056e5ff27b61288fa772ff
[]
no_license
Auch-Auch/avito_source
b6c9f4b0e5c977b36d5fbc88c52f23ff908b7f8b
76fdcc5b7e036c57ecc193e790b0582481768cdc
refs/heads/master
2023-05-06T01:32:43.014668
2021-05-25T10:19:22
2021-05-25T10:19:22
370,650,685
0
0
null
null
null
null
UTF-8
Java
false
false
805
java
package com.google.android.gms.internal.ads; public final class zzln { public final int id; public final int type; public final zzho zzaht; public final long zzaid; public final int zzasn; public final long zzazz; public final int zzbaa; public final zzlq[] zzbab; public final long[] zzbac; public final long[] zzbad; public final long zzdg; public zzln(int i, int i2, long j, long j2, long j3, zzho zzho, int i3, zzlq[] zzlqArr, int i4, long[] jArr, long[] jArr2) { this.id = i; this.type = i2; this.zzdg = j; this.zzazz = j2; this.zzaid = j3; this.zzaht = zzho; this.zzbaa = i3; this.zzbab = zzlqArr; this.zzasn = i4; this.zzbac = jArr; this.zzbad = jArr2; } }
[ "auchhunter@gmail.com" ]
auchhunter@gmail.com
3ab33f4e878988dbd7fa9d5796711f9b6f298319
281195c4b6182d1d0c1420685bc04d6fb1916e7f
/MQ/fast-spring-boot-kafka/src/main/java/com/fast/kafka/consant/ResultCode.java
1824f32306a7bbf40915dfaf443ff5d5fd0dcbfd
[ "Apache-2.0" ]
permissive
ybw2016/fast-spring-boot
9f47cf4c07cd058844f15a05799f4e53ca2f4840
6e3f3377a32cfb88d6dcadf6139baaa2c8b05a2f
refs/heads/master
2022-12-22T01:21:11.575642
2022-11-07T09:13:55
2022-11-07T09:13:55
157,174,666
5
2
Apache-2.0
2022-12-16T08:59:47
2018-11-12T07:41:29
Java
UTF-8
Java
false
false
155
java
package com.fast.kafka.consant; public class ResultCode { public static final Integer SUCCESS = 0; public static final Integer EXCEPTION = 500; }
[ "yanbowen-pbj@sinosig.com" ]
yanbowen-pbj@sinosig.com
92154fbc8c2a094624338968288375e1dae38e96
f953d27154b77296f46554eda2ee406222373a53
/app/src/main/java/com/makatizen/makahanap/di/scopes/ActivityScope.java
a75e179e40a9ca6921d36f604383290dbd3e5fa1
[]
no_license
simpledescifrador/Makahanap-A-Lost-and-Found-App-in-Makati-City
4d717ad83e4400cbca48f84dfb3d138122e6155f
70c23fafd108dd960a503b1a16fb1ee466ed5c97
refs/heads/master
2020-05-16T05:36:31.548442
2019-06-23T18:31:58
2019-06-23T18:31:58
182,819,405
0
0
null
2019-06-19T13:25:16
2019-04-22T15:49:25
Java
UTF-8
Java
false
false
235
java
package com.makatizen.makahanap.di.scopes; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import javax.inject.Scope; @Scope @Retention(RetentionPolicy.RUNTIME) public @interface ActivityScope { }
[ "edtvillarta@outlook.com" ]
edtvillarta@outlook.com
491e2aaa3bb50e1c92377d1c1fe0398b93cd0be3
1bc25541e82763b3030761e32f2b3d5d535c0b0c
/src/main/java/com/pplt/m100/web/RegisterController.java
ac0ee8bc38b8539c77c60c8adf322c86925aa000
[]
no_license
gwei239/m100
ba1fa2092aeec36d102d0931b7904b1321b13459
dc69824f2483f15b28a54aef241158523247e8ea
refs/heads/master
2021-06-27T17:14:31.711921
2017-09-12T03:00:55
2017-09-12T03:00:55
103,115,676
0
0
null
null
null
null
UTF-8
Java
false
false
5,664
java
package com.pplt.m100.web; import java.io.InputStream; import java.util.HashMap; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import org.dom4j.Document; import org.dom4j.Element; import org.dom4j.io.SAXReader; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.pplt.m100.entity.UserEntity; import com.pplt.m100.entity.UserpayEntity; import com.pplt.m100.service.PayService; import com.pplt.m100.service.UserService; import com.pplt.m100.util.IdUtil; import com.pplt.m100.util.Md5Util; @Controller public class RegisterController { @Autowired private UserService userService; @Autowired private PayService payService; @RequestMapping("/register.php") public String register() { return "register"; } @RequestMapping("/registerValidate") @ResponseBody public String registerValidate(String username, String nickname) { boolean hasUser = userService.hasUser(nickname, username); return !hasUser+""; } @RequestMapping("/registerSubmit.do") @ResponseBody public Map<String,Object> registerSubmit(String username, String nickname, String password, HttpSession session) { Map<String,Object> result = new HashMap<String,Object>(); if(userService.hasUser(null, username)){ result.put("result", false); result.put("message", "该邮箱地址已经被注册,请使用其他的邮箱地址!"); return result; } if(userService.hasUser(nickname, null)){ result.put("result", false); result.put("message", "该名称已经被注册,请使用其他的名称!"); return result; } UserEntity user = new UserEntity(nickname, Md5Util.md5Hex(password), username); user.setEnable(1); userService.saveUser(user); session.setAttribute("userid", username); result.put("result", true); result.put("message", ""); return result; } @RequestMapping("/registerok.php") public String registerok(HttpSession session) { String username = (String)session.getAttribute("userid"); if(null == username)return ""; return "registerok"; } @RequestMapping("/downloadpacket.php") public String downloadpacket(Model model, HttpSession session) { String username = (String)session.getAttribute("userid"); if(null == username)return ""; String orderid = (String)session.getAttribute("orderid"); if(null == orderid){ model.addAttribute("statue", 0); }else{ UserpayEntity pay = payService.getUserpayByOrdid(orderid); if(null != pay && 1 == pay.getStatue()){ UserEntity user = userService.getUserByMail(username); model.addAttribute("statue", 1); model.addAttribute("paymoney", pay.getPaymoney()); model.addAttribute("out_trade_no", pay.getOrdid()); model.addAttribute("endtime", user.getEndtime()); }else{ model.addAttribute("statue", 0); } } model.addAttribute("clientinstallList", userService.getAllClientinstall()); return "downloadpacket"; } @RequestMapping("/advanceduser.php") public String advanceduser(Model model, HttpSession session, String userid) { if(null != userid && !"".equals(userid)){ session.setAttribute("userid", userid); } String username = (String)session.getAttribute("userid"); if(null == username)return ""; UserEntity user = userService.getUserByMail(username); model.addAttribute("userid",username); String orderid = IdUtil.getOrderId(user.getId()); model.addAttribute("orderid",orderid); session.setAttribute("orderid", orderid); return "advanceduser"; } @RequestMapping("/pay.php") public String pay(Model model, HttpSession session, Integer money, String ordid, String userid) { model.addAttribute("payUrl",payService.getPayUrl(userid, ordid, money)); return "pay"; } @RequestMapping("/paycheck.php") @ResponseBody public String paycheck(String ordid) { return "" + payService.isPayed(ordid); } @RequestMapping("/pay_notify.php") @ResponseBody public String payNotify(HttpServletRequest req) { try { InputStream xml = req.getInputStream(); SAXReader saxReader = new SAXReader(); Document document = saxReader.read(xml); // 获取根元素 Element root = document.getRootElement(); System.out.println("Root: " + root.getName()); Element payIdElement = root.element("payId"); String payId = payIdElement.getTextTrim(); Element orderIdElement = root.element("orderId"); String orderId = orderIdElement.getTextTrim(); Element payResultElement = root.element("payResult"); String payResult = payResultElement.getTextTrim(); if(this.payService.payed(orderId, payResult)){ return "<?xml version=\"1.0\" encoding=\"UTF-8\"?><msgResp><msgType>PayResultNotifyResp</msgType><msgVer>1.0</msgVer><returnCode>0</returnCode><returnMsg></returnMsg></msgResp>"; } return "<?xml version=\"1.0\" encoding=\"UTF-8\"?><msgResp><msgType>PayResultNotifyResp</msgType><msgVer>1.0</msgVer><returnCode>1</returnCode><returnMsg>fail</returnMsg></msgResp>"; } catch (Exception e) { e.printStackTrace(); return "<?xml version=\"1.0\" encoding=\"UTF-8\"?><msgResp><msgType>PayResultNotifyResp</msgType><msgVer>1.0</msgVer><returnCode>1</returnCode><returnMsg>fail</returnMsg></msgResp>"; } } // @RequestMapping(value="/delete/{id}") // public void delete(@PathVariable("id") Long id) { // userMapper.delete(id); // } }
[ "1107706970@qq.com" ]
1107706970@qq.com
c5241660d73b6134620b32568f9556abb994ef63
71e6c5fbd91647f0e9ea28242deb4c287495e691
/grails-datastore-gorm-hibernate4/src/main/groovy/org/codehaus/groovy/grails/orm/hibernate/proxy/GroovyAwareJavassistLazyInitializer.java
3695e37e24e59ece63e2c49456fa7f564be8c797
[ "Apache-2.0" ]
permissive
shushkevich/grails-data-mapping
29a549c4d5bd5f6b5c150943e948971e0767994c
6e39915e9fdd3d66b54f94de7db0c5b8bb66d845
refs/heads/master
2021-01-16T19:41:21.067339
2013-04-15T12:24:14
2013-04-15T12:24:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,041
java
/* Copyright 2004-2005 Graeme Rocher * * 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.codehaus.groovy.grails.orm.hibernate.proxy; import grails.util.CollectionUtils; import java.io.Serializable; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Set; import javassist.util.proxy.MethodFilter; import javassist.util.proxy.MethodHandler; import javassist.util.proxy.ProxyFactory; import javassist.util.proxy.ProxyObject; import org.apache.commons.logging.LogFactory; import org.codehaus.groovy.grails.orm.hibernate.cfg.HibernateUtils; import org.hibernate.HibernateException; import org.hibernate.engine.spi.SessionImplementor; import org.hibernate.internal.util.ReflectHelper; import org.hibernate.proxy.HibernateProxy; import org.hibernate.proxy.pojo.BasicLazyInitializer; import org.hibernate.proxy.pojo.javassist.SerializableProxy; import org.hibernate.type.CompositeType; /** * @author Graeme Rocher * @since 1.0 */ public class GroovyAwareJavassistLazyInitializer extends BasicLazyInitializer implements MethodHandler { private static final String WRITE_CLASSES_DIRECTORY = System.getProperty("javassist.writeDirectory"); private static final Set<String> GROOVY_METHODS = CollectionUtils.newSet( "invokeMethod", "getMetaClass", "setMetaClass", "metaClass", "getProperty", "setProperty", "$getStaticMetaClass"); private static final MethodFilter METHOD_FILTERS = new MethodFilter() { public boolean isHandled(Method m) { // skip finalize methods return m.getName().indexOf("super$") == -1 && !GROOVY_METHODS.contains(m.getName()) && !(m.getParameterTypes().length == 0 && (m.getName().equals("finalize"))); } }; private Class<?>[] interfaces; private boolean constructed = false; protected GroovyAwareJavassistLazyInitializer( final String entityName, final Class<?> persistentClass, final Class<?>[] interfaces, final Serializable id, final Method getIdentifierMethod, final Method setIdentifierMethod, final CompositeType componentIdType, final SessionImplementor session, final boolean overridesEquals) { super(entityName, persistentClass, id, getIdentifierMethod, setIdentifierMethod, componentIdType, session, overridesEquals); this.interfaces = interfaces; } public static HibernateProxy getProxy( final String entityName, final Class<?> persistentClass, final Class<?>[] interfaces, final Method getIdentifierMethod, final Method setIdentifierMethod, CompositeType componentIdType, final Serializable id, final SessionImplementor session) throws HibernateException { // note: interface is assumed to already contain HibernateProxy.class try { final GroovyAwareJavassistLazyInitializer instance = new GroovyAwareJavassistLazyInitializer( entityName, persistentClass, interfaces, id, getIdentifierMethod, setIdentifierMethod, componentIdType, session, ReflectHelper.overridesEquals(persistentClass)); ProxyFactory factory = createProxyFactory(persistentClass, interfaces); Class<?> proxyClass = factory.createClass(); HibernateUtils.enhanceProxyClass(proxyClass); final HibernateProxy proxy = (HibernateProxy)proxyClass.newInstance(); ((ProxyObject) proxy).setHandler(instance); HibernateUtils.enhanceProxy(proxy); instance.constructed = true; return proxy; } catch (Throwable t) { LogFactory.getLog(BasicLazyInitializer.class).error( "Javassist Enhancement failed: " + entityName, t); throw new HibernateException("Javassist Enhancement failed: " + entityName, t); } } public static HibernateProxy getProxy( final Class<?> factory, final String entityName, final Class<?> persistentClass, final Class<?>[] interfaces, final Method getIdentifierMethod, final Method setIdentifierMethod, final CompositeType componentIdType, final Serializable id, final SessionImplementor session) throws HibernateException { final GroovyAwareJavassistLazyInitializer instance = new GroovyAwareJavassistLazyInitializer( entityName, persistentClass, interfaces, id, getIdentifierMethod, setIdentifierMethod, componentIdType, session, ReflectHelper.overridesEquals(persistentClass)); final HibernateProxy proxy; try { proxy = (HibernateProxy)factory.newInstance(); } catch (Exception e) { throw new HibernateException("Javassist Enhancement failed: " + persistentClass.getName(), e); } ((ProxyObject) proxy).setHandler(instance); instance.constructed = true; HibernateUtils.enhanceProxy(proxy); return proxy; } public static Class<?> getProxyFactory(Class<?> persistentClass, Class<?>[] interfaces) throws HibernateException { // note: interfaces is assumed to already contain HibernateProxy.class try { ProxyFactory factory = createProxyFactory(persistentClass, interfaces); Class<?> proxyClass = factory.createClass(); HibernateUtils.enhanceProxyClass(proxyClass); return proxyClass; } catch (Throwable t) { LogFactory.getLog(BasicLazyInitializer.class).error( "Javassist Enhancement failed: " + persistentClass.getName(), t); throw new HibernateException("Javassist Enhancement failed: " + persistentClass.getName(), t); } } private static ProxyFactory createProxyFactory(Class<?> persistentClass, Class<?>[] interfaces) { ProxyFactory factory = new ProxyFactory(); factory.setSuperclass(interfaces.length == 1 ? persistentClass : null); factory.setInterfaces(interfaces); factory.setFilter(METHOD_FILTERS); if (WRITE_CLASSES_DIRECTORY != null) { factory.writeDirectory = WRITE_CLASSES_DIRECTORY; } return factory; } public Object invoke(final Object proxy, final Method thisMethod, final Method proceed, final Object[] args) throws Throwable { if (constructed) { Object result; try { result = invoke(thisMethod, args, proxy); } catch (Throwable t) { throw new Exception(t.getCause()); } if (result == INVOKE_IMPLEMENTATION) { Object target = getImplementation(); final Object returnValue; try { if (ReflectHelper.isPublic(persistentClass, thisMethod)) { if (!thisMethod.getDeclaringClass().isInstance(target)) { throw new ClassCastException(target.getClass().getName()); } returnValue = thisMethod.invoke(target, args); } else { if (!thisMethod.isAccessible()) { thisMethod.setAccessible(true); } returnValue = thisMethod.invoke(target, args); } return returnValue == target ? proxy : returnValue; } catch (InvocationTargetException ite) { throw ite.getTargetException(); } } return result; } // while constructor is running if (thisMethod.getName().equals("getHibernateLazyInitializer")) { return this; } return proceed.invoke(proxy, args); } @Override protected Object serializableProxy() { return new SerializableProxy( getEntityName(), persistentClass, interfaces, getIdentifier(), false, getIdentifierMethod, setIdentifierMethod, componentIdType); } }
[ "burt@burtbeckwith.com" ]
burt@burtbeckwith.com
573dc4d3eacab8f4bf30a4dd0da0ec1b1ad31158
7d429f9d6cb2252f01329f4575d4cdc8cf391d1d
/src/me/staartvin/utils/pluginlibrary/hooks/WorldGuardHook.java
1099cd589fdc4d273abb6ca9a2513e8347119a40
[]
no_license
Staartvin/PluginLibrary
2e73a7ba39163ddc2e632d94b6c2126d146e63cd
a0bbc5b2da5e8f79eec78482a4207f53690cfcd1
refs/heads/master
2021-06-22T10:23:43.638836
2021-01-19T15:36:37
2021-01-19T15:36:37
40,603,392
0
7
null
2020-10-13T05:26:17
2015-08-12T13:52:28
Java
UTF-8
Java
false
false
3,090
java
package me.staartvin.utils.pluginlibrary.hooks; import com.sk89q.worldguard.WorldGuard; import com.sk89q.worldguard.bukkit.WorldGuardPlugin; import com.sk89q.worldguard.protection.managers.RegionManager; import com.sk89q.worldguard.protection.regions.ProtectedRegion; import com.sk89q.worldguard.protection.regions.RegionContainer; import me.staartvin.utils.pluginlibrary.Library; import org.bukkit.Location; import org.bukkit.entity.Player; /** * WorldGuard library, * <a href="https://dev.bukkit.org/projects/worldguard">link</a>. * <p> * * @author Staartvin */ public class WorldGuardHook extends LibraryHook { private WorldGuardPlugin worldGuard; @Override public boolean isHooked() { return worldGuard != null; } /* * (non-Javadoc) * * @see me.staartvin.utils.pluginlibrary.LibraryHook#hook() */ @Override public boolean hook() { if (!isPluginAvailable(Library.WORLDGUARD)) return false; worldGuard = (WorldGuardPlugin) this.getServer().getPluginManager() .getPlugin(Library.WORLDGUARD.getInternalPluginName()); return worldGuard != null; } /** * Check to see if a player is in a specific WorldGuard region * * @param player * Player that needs to be checked * @param regionName * Name of the region to be checked * @return true if the player is in that region; false otherwise. */ public boolean isInRegion(final Player player, final String regionName) { if (!isHooked()) return false; if (player == null || regionName == null) return false; return this.isInRegion(player.getLocation(), regionName); } /** * @see #isInRegion(Player, String) * @param location * @param regionName * @return */ public boolean isInRegion(Location location, String regionName) { if (!this.isHooked()) { return false; } if (location == null) return false; RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer(); // Check all worlds (a region manager is applicable for a world) for (RegionManager regionManager : container.getLoaded()) { // Check if the region manager has the specified region. if (!regionManager.hasRegion(regionName)) { continue; } // Check all regions and see if the value is inside some region ProtectedRegion region = regionManager.getRegion(regionName); // We cannot find the region that was specified, so the player cannot be in it. if (region == null) { return false; } // Check whether the location is inside the region. return region.contains(location.getBlockX(), location.getBlockY(), location.getBlockZ()); } // We couldn't find the region, so it means the player cannot be in it. return false; } }
[ "mijnleraar@msn.com" ]
mijnleraar@msn.com
443d5aba52a9407b4b56bdd4b6d5141f9ca070e6
f96056f4de9eaf5c7b3cb57d4cfd3813fd40c09a
/src/main/java/interview/ch01/Practice.java
8ee106f7a849c58ac8d7e4e81ba80572cbde8cdc
[]
no_license
ksh901016/algorithmExam
c726d3cab917c099b3aa4b59d1dafce38b8208d5
fdd1c1ce2f14cf361f35cbcfbb02153511d75540
refs/heads/master
2020-03-22T08:36:24.958573
2018-09-29T05:15:16
2018-09-29T05:15:16
139,777,509
0
0
null
null
null
null
UTF-8
Java
false
false
383
java
package interview.ch01; public class Practice { // 1.1 public boolean checkStr(String str) { boolean[] ascii = new boolean[256]; char[] character = str.toCharArray(); for(char c : character) { if(ascii[c]) { return false; } ascii[c] = true; } return true; } }
[ "ksh901016@naver.com" ]
ksh901016@naver.com
700b3fa65eeee3ba59b8879df5cb2e0506f1cd98
403e8f9d5507cb73af596ffb5d6f00180ccd773d
/UnitTests/src/com/henrythompson/neuralnets/unittests/unittests/WeightsTest.java
8db92cc3dde8f3d247367a00bac63cc1e0d66f44
[]
no_license
henry-thompson/Neural-Network
a59dbd30f64fa24770086316376bea557160daf3
8788297a6161ad5e4572b419ba56735755e71fb7
refs/heads/master
2020-12-25T08:59:19.460347
2016-08-16T22:08:17
2016-08-16T22:08:17
65,856,301
0
0
null
null
null
null
UTF-8
Java
false
false
6,413
java
package com.henrythompson.neuralnets.unittests.unittests; import com.henrythompson.neuralnets.Weights; import org.junit.Assert; import org.junit.Test; import static org.junit.Assert.*; public class WeightsTest { @Test public void weightsWithNegativeSizeDisallowed() throws Exception { try { new Weights(-1, -1); } catch (IllegalArgumentException e) { return; } Assert.fail("Weights should not allow instantiation with negative sizes"); } @Test public void testSetAndGetWeight() throws Exception { Weights weights = new Weights(3, 3); Assert.assertNotEquals("Weight should not be 0.5 after instantiation", 0.5, weights.getWeight(0, 0), 0.0); weights.setWeight(0, 0, 0.5); Assert.assertEquals("Weight should be set to 0.5 after instantiation", 0.5, weights.getWeight(0, 0), 0.0); } @Test public void setWeightDisallowsSettingBiasAtIndexTooLarge() { Weights weights = new Weights(3, 3); try { weights.setWeight(3, 3, 0.1); } catch (IndexOutOfBoundsException e) { return; } Assert.fail("Weights should disallow setting a weight at an index which is too large"); } @Test public void setWeightDisallowsSettingBiasAtNegativeIndex() { Weights weights = new Weights(3, 3); try { weights.setWeight(-1, -1, 0.1); } catch (IndexOutOfBoundsException e) { return; } Assert.fail("Weights should disallow setting a weight at an index which is negative"); } @Test public void getWeightDisallowsSettingBiasAtIndexTooLarge() { Weights weights = new Weights(3, 3); try { weights.getWeight(3, 3); } catch (IndexOutOfBoundsException e) { return; } Assert.fail("Weights should disallow setting a weight at an index which is too large"); } @Test public void getWeightDisallowsSettingBiasAtNegativeIndex() { Weights weights = new Weights(3, 3); try { weights.getWeight(-1, -1); } catch (IndexOutOfBoundsException e) { return; } Assert.fail("Weights should disallow setting a weight at an index which is negative"); } @Test public void testSetAndGetBias() throws Exception { Weights weights = new Weights(3, 3); Assert.assertNotEquals("Weight should not be 0.5 after instantiation", 0.5, weights.getBias(0), 0.0); weights.setBias(0, 0.5); Assert.assertEquals("Weight should be set to 0.5 after instantiation", 0.5, weights.getBias(0), 0.0); } @Test public void setBiasDisallowsIndicesWhichAreTooLarge() { Weights weights = new Weights(3, 3); try { weights.setBias(3, 0.1); } catch (IndexOutOfBoundsException e) { return; } Assert.fail("Weights should disallow setting a weight at an index which is too large"); } @Test public void setBiasDisallowsNegativeIndices() { Weights weights = new Weights(3, 3); try { weights.setBias(-1, 0.1); } catch (IndexOutOfBoundsException e) { return; } Assert.fail("Weights should disallow setting a weight at an index which is too large"); } @Test public void getBiasDisallowsIndicesWhichAreTooLarge() { Weights weights = new Weights(3, 3); try { weights.getBias(3); } catch (IndexOutOfBoundsException e) { return; } Assert.fail("Weights should disallow setting a weight at an index which is too large"); } @Test public void getBiasDisallowsNegativeIndices() { Weights weights = new Weights(3, 3); try { weights.getBias(-1); } catch (IndexOutOfBoundsException e) { return; } Assert.fail("Weights should disallow setting a weight at an index which is too large"); } @Test public void testAdjustWeight() throws Exception { Weights weights = new Weights(3, 3); Assert.assertNotEquals("Weight should not be set to -0.5 when Weights object is initialised", -0.5, weights.getWeight(0, 0), 0.0); weights.adjustWeight(0, 0, -0.5); Assert.assertEquals("Method adjustWeight should adjust weight correctly", -0.5, weights.getWeight(0, 0), 0.0); } @Test public void testGetFromLayerSize() throws Exception { Weights weights = new Weights(3, 4); Assert.assertEquals("Method getFromLayerSize should correctly return supplied from layer size", 3, weights.getFromLayerSize()); } @Test public void testGetToLayerSize() throws Exception { Weights weights = new Weights(3, 4); Assert.assertEquals("Method getToLayerSize should correctly return supplied from layer size", 4, weights.getToLayerSize()); } @Test public void testRandomize() throws Exception { // Very hard to test the randomness of the values. Instead, we will test // to make sure that the weights are no longer all zero (statistically // this shouldn't occur) and that they lie within the amplitude. Since // this is random and statistically could by chance pass when it should // fail, we repeat this 100 times. for (int i = 0; i < 100; i++) { Weights weights = new Weights(1, 2); Assert.assertEquals("Wieghts should be initialised to zero", weights.getWeight(0, 0), 0.0, 0.0); Assert.assertEquals("Wieghts should be initialised to zero", weights.getWeight(0, 1), 0.0, 0.0); double amplitude = 3 * Math.random(); weights.randomize(amplitude); Assert.assertNotEquals("Weights should (statistically) not be exactly zero)", weights.getWeight(0, 0), 0.0, 0.0); Assert.assertNotEquals("Wieghts should (statistically) not be exactly zero", weights.getWeight(0, 1), 0.0, 0.0); Assert.assertTrue("Weights should be less than amplitude", Math.abs(weights.getWeight(0, 0)) < amplitude); Assert.assertTrue("Weights should be less than amplitude", Math.abs(weights.getWeight(0, 1)) < amplitude); } } }
[ "henrithompson@btinternet.com" ]
henrithompson@btinternet.com
d1b5f6ad79dbd6005961ef2609e69592fb4c6972
e389aa3c1a31ee9ff3666fb6e623bf1b91db1c9c
/src/main/java/com/bdqn/service/user/UserService.java
ebad6e0094e33e7a6f50ddee3400eec15abacf7f
[]
no_license
ZhangJingQi-Mr/demofreemaker
7bd08107f5ac922bab694e9b5730de3af35ef941
63c216d58bb03f72736709f2d8fb7af157346b75
refs/heads/master
2022-11-26T17:52:00.760929
2020-08-08T18:29:58
2020-08-08T18:29:58
286,098,135
0
0
null
null
null
null
UTF-8
Java
false
false
777
java
package com.bdqn.service.user; import com.bdqn.pojo.User; import com.bdqn.utils.PageSupport; public interface UserService { //登录 public User login(String userCode, String userPassword) throws Exception; //获取用户列表实现分页 public void getUsersPage(PageSupport pageSupport, String userName, int roleId) throws Exception; //添加用户 public int addUser(User user) throws Exception; //获取用户id public User getUserById(int uid) throws Exception; //通过用户id修改用户 public int modifyUser(User user) throws Exception; //删除用户 public int deleteUser(int id) throws Exception; //通过用户编码获取用户 public User getUserByUserCode(String userCode) throws Exception; }
[ "928109806@qq.com" ]
928109806@qq.com
e58878e4f1e2cb23692a5dd7d9789d3101786a4b
261af4be312f2af11b7e1688cc50a36943cf8184
/booking-api/src/main/java/com/crbs/security/JasyptEncDec.java
7666b76defc49824576b1800edeadefa3ac1d6b0
[]
no_license
bsp-incubation/booking-api
6cfd4271f341b48178ea466d696700fe65a6a1e6
7fffa4227369f18fd1c99703de8609ea6d3503e6
refs/heads/master
2022-07-08T14:21:06.613881
2020-03-27T05:06:27
2020-03-27T05:06:27
243,167,168
0
1
null
2022-06-21T02:53:55
2020-02-26T04:21:03
Java
UTF-8
Java
false
false
1,321
java
package com.crbs.security; import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.jasypt.encryption.pbe.StandardPBEStringEncryptor; public class JasyptEncDec { public JasyptEncDec() {} // Constructor public String encryptText(String text) { // Encrypting PlainText StandardPBEStringEncryptor enc = new StandardPBEStringEncryptor(); enc.setProvider(new BouncyCastleProvider()); enc.setAlgorithm("PBEWithMD5AndDES"); enc.setPassword("devops"); String encryptedText = enc.encrypt(text); return encryptedText; } public String decryptText(String enc) { // Decrypting EncryptedText StandardPBEStringEncryptor dec = new StandardPBEStringEncryptor(); dec.setProvider(new BouncyCastleProvider()); dec.setAlgorithm("PBEWithMD5AndDES"); dec.setPassword("devops"); String decryptedText = dec.decrypt(enc); return decryptedText; } public static void main(String [] args) { StandardPBEStringEncryptor enc = new StandardPBEStringEncryptor(); enc.setProvider(new BouncyCastleProvider()); enc.setAlgorithm("PBEWithMD5AndDES"); enc.setPassword("devops"); // String username = "root"; String password = "12345678"; // System.out.println("encrypted username : " + enc.encrypt(username)); System.out.println("encrypted password : " + enc.encrypt(password)); } }
[ "suhyeong.ahn@suhyeong-ahn.hwk.net" ]
suhyeong.ahn@suhyeong-ahn.hwk.net
4fed7ba93b800ec2fbdc8c5646e67144529056cb
2b67a392d02903f9d3c3671c2aef79368f71e9dc
/common/hobos_taco/hpermissions/commands/CommandDemote.java
441bc58a7019b8c1041c199f6486ff16705a7428
[]
no_license
HoBoS-TaCo/hPermissions
fb47ad56300da2f031aa6783f6565d620f37bb11
7021efeacc5d5b347feba2ebede8bb6b9088388d
refs/heads/master
2020-06-15T03:52:39.259383
2013-08-04T03:50:35
2013-08-04T03:50:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,747
java
package hobos_taco.hpermissions.commands; import hobos_taco.hpermissions.api.Permission; import hobos_taco.hpermissions.data.PermissionManager; import hobos_taco.hpermissions.data.Player; import hobos_taco.hpermissions.util.ChatHandler; import java.util.ArrayList; import java.util.List; import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; import net.minecraft.command.PlayerNotFoundException; @Permission("hpermissions.demote") public class CommandDemote extends CommandBase { @Override public String getCommandName() { return "hpermdemote"; } @Override public boolean canCommandSenderUseCommand(ICommandSender par1ICommandSender) { return true; } @Override public String getCommandUsage(ICommandSender par1ICommandSender) { return "/" + this.getCommandName() + " <player>"; } @Override public List<String> getCommandAliases() { ArrayList<String> list = new ArrayList<String>(); list.add("hpd"); list.add("hpdemote"); list.add("hpdem"); return list; } @Override public void processCommand(ICommandSender sender, String[] string) { if (string.length != 1) { ChatHandler.chatError(sender, "Incorrect parameters: " + "/" + this.getCommandName() + " <player>"); } else { Player hplayer = Player.getPlayer(string[0]); if (hplayer != null) { if (PermissionManager.demote(sender, string[0])) { Player.savePlayer(string[0]); } } else { throw new PlayerNotFoundException(); } } } }
[ "hobos_taco@hotmail.com" ]
hobos_taco@hotmail.com
dbd2a1a79e5c990f3fce318a1319b31bb2871736
03c9cd48899808de833fd0d9e3bb7cf0c8b0e7e7
/app/src/main/java/com/bogueratcreations/eaftoolkit/slope/Slope.java
ec3fa6eddb80a146ea19327fa7e84f5ea6c12b61
[]
no_license
TheBogueRat/EAF_Toolkit
cb66aeca8a9f75410c0ee666cdea7099cfc6e833
89086f1b41e36e105ebfbce016d6b8b57203da5d
refs/heads/master
2021-01-17T14:22:50.431848
2017-05-05T20:22:09
2017-05-05T20:22:09
36,835,253
1
0
null
null
null
null
UTF-8
Java
false
false
2,869
java
package com.bogueratcreations.eaftoolkit.slope; import android.os.Bundle; import android.support.design.widget.TabLayout; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; import android.support.v7.app.AppCompatActivity; import com.bogueratcreations.eaftoolkit.R; import java.util.ArrayList; import java.util.List; public class Slope extends AppCompatActivity { //} FragmentActivity{ // @Override // protected void onCreate(Bundle savedInstanceState) { // super.onCreate(savedInstanceState); // // Get the view from activity_main.xml // setContentView(R.layout.activity_slope); // // // Locate the viewpager in activity_slope.xml // ViewPager viewPager = (ViewPager) findViewById(R.id.pager); // // // Set the ViewPagerAdapter into ViewPager // viewPager.setAdapter(new SlopePagerAdapter(getSupportFragmentManager())); // } //private Toolbar toolbar; private TabLayout tabLayout; private ViewPager viewPager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_slope); //toolbar = (Toolbar) findViewById(R.id.slopeToolbar); //setSupportActionBar(toolbar); //getSupportActionBar().setDisplayHomeAsUpEnabled(true); viewPager = (ViewPager) findViewById(R.id.viewpager); setupViewPager(viewPager); tabLayout = (TabLayout) findViewById(R.id.tabs); tabLayout.setupWithViewPager(viewPager); } private void setupViewPager(ViewPager viewPager) { ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager()); adapter.addFragment(new SlopeFragment1(), "Simple"); adapter.addFragment(new SlopeFragment2(), "Diff"); adapter.addFragment(new SlopeFragment3(), "Convert"); viewPager.setAdapter(adapter); } class ViewPagerAdapter extends FragmentPagerAdapter { private final List<Fragment> mFragmentList = new ArrayList<>(); private final List<String> mFragmentTitleList = new ArrayList<>(); public ViewPagerAdapter(FragmentManager manager) { super(manager); } @Override public Fragment getItem(int position) { return mFragmentList.get(position); } @Override public int getCount() { return mFragmentList.size(); } public void addFragment(Fragment fragment, String title) { mFragmentList.add(fragment); mFragmentTitleList.add(title); } @Override public CharSequence getPageTitle(int position) { return mFragmentTitleList.get(position); } } }
[ "jodyroth@gmail.com" ]
jodyroth@gmail.com
5cbd8ec4937e25cc0993a7f4fcf8c3debc1d083c
da4b9883665d6f9ea01b7602dad77a4b5740f62e
/src/com/hlebon/messageHandlers/server/LoginMessageHandlerServer.java
5305a54776488edc412b8d63473c4d2410121030
[]
no_license
BiYiTuan/AIO_server
b9819db5905dfc2e1a29c017b6aac041dd9495b3
f8f5198bcbfd2c7dc9306c980c9b9a2f7a1ad2a3
refs/heads/master
2020-04-16T14:01:48.655854
2016-10-15T14:50:55
2016-10-15T14:50:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
825
java
package com.hlebon.messageHandlers.server; import com.hlebon.message.LoginMessage; import com.hlebon.message.Message; import com.hlebon.message.MessageWrapper; import com.hlebon.server.SenderServiceServer; public class LoginMessageHandlerServer implements MessageHandlerServer { private SenderServiceServer senderServiceServer; public LoginMessageHandlerServer(SenderServiceServer senderServiceServer) { this.senderServiceServer = senderServiceServer; } @Override public void handle(MessageWrapper messageWrapper) { Message message = messageWrapper.getMessage(); if (message instanceof LoginMessage) { LoginMessage loginMessage = (LoginMessage) message; senderServiceServer.addClient(loginMessage.getName(), messageWrapper.getFrom()); } } }
[ "hleb.bandarenka@gmail.com" ]
hleb.bandarenka@gmail.com
c3f6ec94d16201b057b55a4ec8f6edae4e11801f
f25f25253c0ad0e5014d33fd4b9db4b01cc44f91
/FirstSemestr/test3/src/test/java/ru/spbau/karlina/test3/SmartListTest.java
a900391b8f45c0ba55120fc4e5ed3c6e11b3fd1c
[]
no_license
LiubaKarlinaAU/JavaEducation
22f639d1e986b3994f3c07e457fd7ff99625144c
14244749cae0f023f13b8faa543be910ed2ba15d
refs/heads/master
2018-10-01T05:34:28.265008
2018-05-23T07:19:43
2018-05-23T07:19:43
103,315,327
0
0
null
null
null
null
UTF-8
Java
false
false
4,140
java
package ru.spbau.karlina.test3; import org.junit.Test; import java.lang.reflect.InvocationTargetException; import java.util.*; import static org.junit.Assert.*; public class SmartListTest { @Test public void testSimple() { List<Integer> list = newList(); assertEquals(Collections.<Integer>emptyList(), list); list.add(1); assertEquals(Collections.singletonList(1), list); list.add(2); assertEquals(Arrays.asList(1, 2), list); } @Test public void testGetSet() { List<Object> list = newList(); list.add(1); assertEquals(1, list.get(0)); assertEquals(1, list.set(0, 2)); assertEquals(2, list.get(0)); assertEquals(2, list.set(0, 1)); list.add(2); assertEquals(1, list.get(0)); assertEquals(2, list.get(1)); assertEquals(1, list.set(0, 2)); assertEquals(Arrays.asList(2, 2), list); } @Test public void testRemove() throws Exception { List<Object> list = newList(); list.add(1); list.remove(0); assertEquals(Collections.emptyList(), list); list.add(2); list.remove((Object) 2); assertEquals(Collections.emptyList(), list); list.add(1); list.add(2); assertEquals(Arrays.asList(1, 2), list); list.remove(0); assertEquals(Collections.singletonList(2), list); list.remove(0); assertEquals(Collections.emptyList(), list); } @Test public void testIteratorRemove() throws Exception { List<Object> list = newList(); assertFalse(list.iterator().hasNext()); list.add(1); Iterator<Object> iterator = list.iterator(); assertTrue(iterator.hasNext()); assertEquals(1, iterator.next()); iterator.remove(); assertFalse(iterator.hasNext()); assertEquals(Collections.emptyList(), list); list.addAll(Arrays.asList(1, 2)); iterator = list.iterator(); assertTrue(iterator.hasNext()); assertEquals(1, iterator.next()); iterator.remove(); assertTrue(iterator.hasNext()); assertEquals(Collections.singletonList(2), list); assertEquals(2, iterator.next()); iterator.remove(); assertFalse(iterator.hasNext()); assertEquals(Collections.emptyList(), list); } @Test public void testCollectionConstructor() throws Exception { assertEquals(Collections.emptyList(), newList(Collections.emptyList())); assertEquals( Collections.singletonList(1), newList(Collections.singletonList(1))); assertEquals( Arrays.asList(1, 2), newList(Arrays.asList(1, 2))); } @Test public void testAddManyElementsThenRemove() throws Exception { List<Object> list = newList(); for (int i = 0; i < 7; i++) { list.add(i + 1); } assertEquals(Arrays.asList(1, 2, 3, 4, 5, 6, 7), list); for (int i = 0; i < 7; i++) { list.remove(list.size() - 1); assertEquals(6 - i, list.size()); } assertEquals(Collections.emptyList(), list); } private static <T> List<T> newList() { try { return (List<T>) getListClass().getConstructor().newInstance(); } catch (InstantiationException | ClassNotFoundException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { throw new RuntimeException(e); } } private static <T> List<T> newList(Collection<T> collection) { try { return (List<T>) getListClass().getConstructor(Collection.class).newInstance(collection); } catch (InstantiationException | ClassNotFoundException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { throw new RuntimeException(e); } } private static Class<?> getListClass() throws ClassNotFoundException { return Class.forName("ru.spbau.karlina.test3.SmartList"); } }
[ "space_slona@mail.ru" ]
space_slona@mail.ru
ee450deb3b9483d323a589af11bb235ca35dc977
d4372738af081d0923a747dc7a8550c10e60d7e6
/QuanLyBanHang/src/com/company/Main.java
a82bc8320441ce9830cf3f5e28a51449f44cca4e
[]
no_license
khongtrunght/OOP
52ec2f815727749281fb8f179b7a5a29b1cf28e4
2efe3d205453c19c58482bba9192fbf4247023c4
refs/heads/master
2023-08-18T21:51:51.284896
2021-10-05T14:03:20
2021-10-05T14:03:20
408,769,531
0
0
null
null
null
null
UTF-8
Java
false
false
1,065
java
package com.company; import java.util.List; import java.util.Map; public class Main { public static Map<Integer, Catalog> catalogMap; public static void main(String[] args) { } public static void processForm(Form form, Map<Integer, Customer> map){ Customer customer = null; if (form.getCustomerId() == null){ boolean found = false; for (Customer c: map.values()){ if (c.getCustomerInfo().matches(form.getCustomerInfo())){ customer = c; found = true; } break; } if (! found){ customer = new Customer(form.getCustomerInfo()); map.put(customer.getId(), customer); } } else{ customer = map.get(form.getCustomerId()); customer.updateInfo(form.getCustomerInfo()); } Order order = new Order(customer, catalogMap.get(form.getCatalogId())); order.putOrder(form.getProductMap()); } }
[ "khongtrunght@gmail.com" ]
khongtrunght@gmail.com
2562af9cd8cbb42160abd0eed5bffc1e88756b6f
a639313fcbe74c348421ae4ff8bf9917effd6563
/src/main/java/com/heki1224/spring_data_jpa_sample/service/UserService.java
c1e38245d9e3651cdcce4488ab73eafe363e3413
[]
no_license
WangChengJie941209/spring-data-jpa-sample
e7b5fdc558864d8230a5227ca922aacae81b86e9
cdacd26341ac76e42d12f2328ade7f4191f837f0
refs/heads/master
2023-03-20T02:54:46.629552
2013-10-08T01:47:53
2013-10-08T01:47:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
514
java
package com.heki1224.spring_data_jpa_sample.service; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.heki1224.spring_data_jpa_sample.entity.User; import com.heki1224.spring_data_jpa_sample.repositories.UserRepository; @Service public class UserService { @Autowired private UserRepository userRepository; public List<User> getList() { return (List<User>) userRepository.findAll(); } }
[ "heki1224@gmail.com" ]
heki1224@gmail.com
6bdd90620745a568f4dcc70285c5edebe22c34c9
fa51687f6aa32d57a9f5f4efc6dcfda2806f244d
/jdk8-src/src/main/java/javax/management/openmbean/TabularType.java
51ddd6e31c585caa7652fe6f4918f30da1dd058b
[]
no_license
yida-lxw/jdk8
44bad6ccd2d81099bea11433c8f2a0fc2e589eaa
9f69e5f33eb5ab32e385301b210db1e49e919aac
refs/heads/master
2022-12-29T23:56:32.001512
2020-04-27T04:14:10
2020-04-27T04:14:10
258,988,898
0
1
null
2020-10-13T21:32:05
2020-04-26T09:21:22
Java
UTF-8
Java
false
false
13,898
java
/* * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ package javax.management.openmbean; // java import // import java.util.ArrayList; import java.util.Collections; import java.util.List; // jmx import // /** * The <code>TabularType</code> class is the <i> open type</i> class * whose instances describe the types of {@link TabularData TabularData} values. * * @since 1.5 */ public class TabularType extends OpenType<TabularData> { /* Serial version */ static final long serialVersionUID = 6554071860220659261L; /** * @serial The composite type of rows */ private CompositeType rowType; /** * @serial The items used to index each row element, kept in the order the user gave * This is an unmodifiable {@link ArrayList} */ private List<String> indexNames; private transient Integer myHashCode = null; // As this instance is immutable, these two values private transient String myToString = null; // need only be calculated once. /* *** Constructor *** */ /** * Constructs a <code>TabularType</code> instance, checking for the validity of the given parameters. * The validity constraints are described below for each parameter. * <p> * The Java class name of tabular data values this tabular type represents * (ie the class name returned by the {@link OpenType#getClassName() getClassName} method) * is set to the string value returned by <code>TabularData.class.getName()</code>. * <p> * * @param typeName The name given to the tabular type this instance represents; cannot be a null or empty string. * <br>&nbsp; * @param description The human readable description of the tabular type this instance represents; * cannot be a null or empty string. * <br>&nbsp; * @param rowType The type of the row elements of tabular data values described by this tabular type instance; * cannot be null. * <br>&nbsp; * @param indexNames The names of the items the values of which are used to uniquely index each row element in the * tabular data values described by this tabular type instance; * cannot be null or empty. Each element should be an item name defined in <var>rowType</var> * (no null or empty string allowed). * It is important to note that the <b>order</b> of the item names in <var>indexNames</var> * is used by the methods {@link TabularData#get(java.lang.Object[]) get} and * {@link TabularData#remove(java.lang.Object[]) remove} of class * <code>TabularData</code> to match their array of values parameter to items. * <br>&nbsp; * @throws IllegalArgumentException if <var>rowType</var> is null, * or <var>indexNames</var> is a null or empty array, * or an element in <var>indexNames</var> is a null or empty string, * or <var>typeName</var> or <var>description</var> is a null or empty string. * <br>&nbsp; * @throws OpenDataException if an element's value of <var>indexNames</var> * is not an item name defined in <var>rowType</var>. */ public TabularType(String typeName, String description, CompositeType rowType, String[] indexNames) throws OpenDataException { // Check and initialize state defined by parent. // super(TabularData.class.getName(), typeName, description, false); // Check rowType is not null // if (rowType == null) { throw new IllegalArgumentException("Argument rowType cannot be null."); } // Check indexNames is neither null nor empty and does not contain any null element or empty string // checkForNullElement(indexNames, "indexNames"); checkForEmptyString(indexNames, "indexNames"); // Check all indexNames values are valid item names for rowType // for (int i = 0; i < indexNames.length; i++) { if (!rowType.containsKey(indexNames[i])) { throw new OpenDataException("Argument's element value indexNames[" + i + "]=\"" + indexNames[i] + "\" is not a valid item name for rowType."); } } // initialize rowType // this.rowType = rowType; // initialize indexNames (copy content so that subsequent // modifs to the array referenced by the indexNames parameter // have no impact) // List<String> tmpList = new ArrayList<String>(indexNames.length + 1); for (int i = 0; i < indexNames.length; i++) { tmpList.add(indexNames[i]); } this.indexNames = Collections.unmodifiableList(tmpList); } /** * Checks that Object[] arg is neither null nor empty (ie length==0) * and that it does not contain any null element. */ private static void checkForNullElement(Object[] arg, String argName) { if ((arg == null) || (arg.length == 0)) { throw new IllegalArgumentException("Argument " + argName + "[] cannot be null or empty."); } for (int i = 0; i < arg.length; i++) { if (arg[i] == null) { throw new IllegalArgumentException("Argument's element " + argName + "[" + i + "] cannot be null."); } } } /** * Checks that String[] does not contain any empty (or blank characters only) string. */ private static void checkForEmptyString(String[] arg, String argName) { for (int i = 0; i < arg.length; i++) { if (arg[i].trim().equals("")) { throw new IllegalArgumentException("Argument's element " + argName + "[" + i + "] cannot be an empty string."); } } } /* *** Tabular type specific information methods *** */ /** * Returns the type of the row elements of tabular data values * described by this <code>TabularType</code> instance. * * @return the type of each row. */ public CompositeType getRowType() { return rowType; } /** * <p>Returns, in the same order as was given to this instance's * constructor, an unmodifiable List of the names of the items the * values of which are used to uniquely index each row element of * tabular data values described by this <code>TabularType</code> * instance.</p> * * @return a List of String representing the names of the index * items. */ public List<String> getIndexNames() { return indexNames; } /** * Tests whether <var>obj</var> is a value which could be * described by this <code>TabularType</code> instance. * * <p>If <var>obj</var> is null or is not an instance of * <code>javax.management.openmbean.TabularData</code>, * <code>isValue</code> returns <code>false</code>.</p> * * <p>If <var>obj</var> is an instance of * <code>javax.management.openmbean.TabularData</code>, say {@code * td}, the result is true if this {@code TabularType} is * <em>assignable from</em> {@link TabularData#getTabularType() * td.getTabularType()}, as defined in {@link * CompositeType#isValue CompositeType.isValue}.</p> * * @param obj the value whose open type is to be tested for * compatibility with this <code>TabularType</code> instance. * @return <code>true</code> if <var>obj</var> is a value for this * tabular type, <code>false</code> otherwise. */ public boolean isValue(Object obj) { // if obj is null or not a TabularData, return false // if (!(obj instanceof TabularData)) return false; // if obj is not a TabularData, return false // TabularData value = (TabularData) obj; TabularType valueType = value.getTabularType(); return isAssignableFrom(valueType); } @Override boolean isAssignableFrom(OpenType<?> ot) { if (!(ot instanceof TabularType)) return false; TabularType tt = (TabularType) ot; if (!getTypeName().equals(tt.getTypeName()) || !getIndexNames().equals(tt.getIndexNames())) return false; return getRowType().isAssignableFrom(tt.getRowType()); } /* *** Methods overriden from class Object *** */ /** * Compares the specified <code>obj</code> parameter with this <code>TabularType</code> instance for equality. * <p> * Two <code>TabularType</code> instances are equal if and only if all of the following statements are true: * <ul> * <li>their type names are equal</li> * <li>their row types are equal</li> * <li>they use the same index names, in the same order</li> * </ul> * <br>&nbsp; * * @param obj the object to be compared for equality with this <code>TabularType</code> instance; * if <var>obj</var> is <code>null</code>, <code>equals</code> returns <code>false</code>. * @return <code>true</code> if the specified object is equal to this <code>TabularType</code> instance. */ public boolean equals(Object obj) { // if obj is null, return false // if (obj == null) { return false; } // if obj is not a TabularType, return false // TabularType other; try { other = (TabularType) obj; } catch (ClassCastException e) { return false; } // Now, really test for equality between this TabularType instance and the other: // // their names should be equal if (!this.getTypeName().equals(other.getTypeName())) { return false; } // their row types should be equal if (!this.rowType.equals(other.rowType)) { return false; } // their index names should be equal and in the same order (ensured by List.equals()) if (!this.indexNames.equals(other.indexNames)) { return false; } // All tests for equality were successfull // return true; } /** * Returns the hash code value for this <code>TabularType</code> instance. * <p> * The hash code of a <code>TabularType</code> instance is the sum of the hash codes * of all elements of information used in <code>equals</code> comparisons * (ie: name, row type, index names). * This ensures that <code> t1.equals(t2) </code> implies that <code> t1.hashCode()==t2.hashCode() </code> * for any two <code>TabularType</code> instances <code>t1</code> and <code>t2</code>, * as required by the general contract of the method * {@link Object#hashCode() Object.hashCode()}. * <p> * As <code>TabularType</code> instances are immutable, the hash code for this instance is calculated once, * on the first call to <code>hashCode</code>, and then the same value is returned for subsequent calls. * * @return the hash code value for this <code>TabularType</code> instance */ public int hashCode() { // Calculate the hash code value if it has not yet been done (ie 1st call to hashCode()) // if (myHashCode == null) { int value = 0; value += this.getTypeName().hashCode(); value += this.rowType.hashCode(); for (String index : indexNames) value += index.hashCode(); myHashCode = Integer.valueOf(value); } // return always the same hash code for this instance (immutable) // return myHashCode.intValue(); } /** * Returns a string representation of this <code>TabularType</code> instance. * <p> * The string representation consists of the name of this class (ie <code>javax.management.openmbean.TabularType</code>), * the type name for this instance, the row type string representation of this instance, * and the index names of this instance. * <p> * As <code>TabularType</code> instances are immutable, the string representation for this instance is calculated once, * on the first call to <code>toString</code>, and then the same value is returned for subsequent calls. * * @return a string representation of this <code>TabularType</code> instance */ public String toString() { // Calculate the string representation if it has not yet been done (ie 1st call to toString()) // if (myToString == null) { final StringBuilder result = new StringBuilder() .append(this.getClass().getName()) .append("(name=") .append(getTypeName()) .append(",rowType=") .append(rowType.toString()) .append(",indexNames=("); String sep = ""; for (String index : indexNames) { result.append(sep).append(index); sep = ","; } result.append("))"); myToString = result.toString(); } // return always the same string representation for this instance (immutable) // return myToString; } }
[ "yida@caibeike.com" ]
yida@caibeike.com
9c2ebe39362c6c9247f73d6379150fca320f71b8
77336a77ba329b5cd1e692e783038c7e504a03ae
/gitHub_new/myfaces-extcdi-extcdi-1.0.6/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/util/CodiUtils.java
fa555457ace0d070371a339e8196a2f5c9ace6cd
[]
no_license
visionwang/RawData
bc78cd34912468fc04fc010f5077c02132470172
69f8ee5013bf04cbdfd5e04e74b9e85d10842bad
refs/heads/master
2021-04-15T10:27:00.140755
2018-03-22T08:51:42
2018-03-22T08:51:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
25,827
java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.myfaces.extensions.cdi.core.impl.util; import org.apache.myfaces.extensions.cdi.core.api.Advanced; import org.apache.myfaces.extensions.cdi.core.api.Aggregatable; import org.apache.myfaces.extensions.cdi.core.api.UnhandledException; import org.apache.myfaces.extensions.cdi.core.api.config.CodiConfig; import org.apache.myfaces.extensions.cdi.core.api.config.CodiCoreConfig; import org.apache.myfaces.extensions.cdi.core.api.provider.BeanManagerProvider; import org.apache.myfaces.extensions.cdi.core.api.util.ClassUtils; import javax.enterprise.context.spi.CreationalContext; import javax.enterprise.inject.spi.AnnotatedType; import javax.enterprise.inject.spi.Bean; import javax.enterprise.inject.spi.BeanManager; import javax.enterprise.inject.spi.InjectionTarget; import javax.enterprise.inject.Typed; import javax.enterprise.util.Nonbinding; import java.io.Serializable; import java.lang.annotation.Annotation; import java.lang.reflect.Method; import java.lang.reflect.Type; import java.util.List; import java.util.ArrayList; import java.util.Set; import java.util.Collections; import java.util.Arrays; /** * This is a collection of a few useful static helper functions. * <p/> */ @Typed() public abstract class CodiUtils { private static final Object[] EMPTY_OBJECT_ARRAY = new Object[0]; private CodiUtils() { // prevent instantiation } /** * Creates an instance for the given {@link Bean} and {@link CreationalContext} * @param creationalContext current context * @param bean current bean * @param <T> current type * @return created instance */ public static <T> T createNewInstanceOfBean(CreationalContext<T> creationalContext, Bean<T> bean) { return bean.create(creationalContext); } /** * Creates a scoped instance (a proxy for normal scoped beans) for the given bean-name and class * @param beanManager current bean-manager * @param beanName name of the bean * @param targetClass class of the bean * @param <T> target type * @return created or resolved instance */ public static <T> T getContextualReferenceByName( BeanManager beanManager, String beanName, Class<T> targetClass) { return getContextualReferenceByName(beanManager, beanName, false, targetClass); } /** * Creates a scoped instance (a proxy for normal scoped beans) for the given bean-name and class * @param beanManager current bean-manager * @param beanName name of the bean * @param optionalBeanAllowed flag which indicates if it's an optional bean * @param targetClass class of the bean * @param <T> target type * @return created or resolved instance */ public static <T> T getContextualReferenceByName( BeanManager beanManager, String beanName, boolean optionalBeanAllowed, Class<T> targetClass) { Set<Bean<?>> foundBeans = beanManager.getBeans(beanName); if(foundBeans.size() >= 1) { Bean<?> bean = beanManager.resolve(foundBeans); //noinspection unchecked return (T) getContextualReference(beanManager, targetClass, bean); } if(!optionalBeanAllowed) { throw new IllegalStateException("No bean found for type: " + targetClass.getName() + " and name " + beanName); } return null; } /** * Creates a scoped instance (a proxy for normal scoped beans) for the given bean-class and qualifiers * @param targetClass class of the bean * @param qualifier optional qualifiers * @param <T> target type * @return created or resolved instance */ public static <T> T getContextualReferenceByClass(Class<T> targetClass, Annotation... qualifier) { return getContextualReferenceByClass(BeanManagerProvider.getInstance().getBeanManager(), targetClass, qualifier); } /** * Creates a scoped instance (a proxy for normal scoped beans) for the given bean-class and qualifiers * @param beanManager current bean-manager * @param targetClass class of the bean * @param qualifier optional qualifiers * @param <T> target type * @return created or resolved instance */ public static <T> T getContextualReferenceByClass( BeanManager beanManager, Class<T> targetClass, Annotation... qualifier) { return getContextualReferenceByClass(beanManager, targetClass, false, qualifier); } /** * Creates a scoped instance (a proxy for normal scoped beans) for the given bean-class and qualifiers. * Compared to the other util methods it allows optional beans. * @param targetClass class of the bean * @param optionalBeanAllowed flag which indicates if it's an optional bean * @param qualifier optional qualifiers * @param <T> target type * @return created or resolved instance if such a bean exists, null otherwise */ public static <T> T getContextualReferenceByClass(Class<T> targetClass, boolean optionalBeanAllowed, Annotation... qualifier) { return getContextualReferenceByClass(BeanManagerProvider.getInstance().getBeanManager(), targetClass, optionalBeanAllowed, qualifier); } /** * Creates a scoped instance (a proxy for normal scoped beans) for the given bean-class and qualifiers. * Compared to the other util methods it allows optional beans. * @param beanManager current bean-manager * @param targetClass class of the bean * @param optionalBeanAllowed flag which indicates if it's an optional bean * @param qualifier optional qualifiers * @param <T> target type * @return created or resolved instance if such a bean exists, null otherwise */ public static <T> T getContextualReferenceByClass(BeanManager beanManager, Class<T> targetClass, boolean optionalBeanAllowed, Annotation... qualifier) { Bean<?> foundBean = getOrCreateBeanByClass(beanManager, targetClass, optionalBeanAllowed, qualifier); if(foundBean != null) { //noinspection unchecked return (T) getContextualReference(beanManager, targetClass, foundBean); } return null; } private static <T> Bean<T> getOrCreateBeanByClass(BeanManager beanManager, Class<T> targetClass, boolean optionalBeanAllowed, Annotation... qualifier) { Set<? extends Bean> foundBeans = beanManager.getBeans(targetClass, qualifier); if(foundBeans.size() >= 1) { return (Bean<T>) beanManager.resolve((Set<Bean<? extends Object>>) foundBeans); } if(!optionalBeanAllowed) { throw new IllegalStateException("No bean found for type: " + targetClass.getName()); } return null; } /** * Creates a scoped instance (a proxy for normal scoped beans) for the given bean-descriptor. * * @param beanManager current bean-manager * @param t type of the bean * @param bean bean-descriptor * @param <T> target type * @return created or resolved instance if such a bean exists, null otherwise */ public static <T> T getContextualReference(BeanManager beanManager, Type t, Bean<T> bean) { CreationalContext<T> cc = beanManager.createCreationalContext(bean); return (T) beanManager.getReference(bean, t, cc); } /** * Allows to perform dependency injection for instances which aren't managed by CDI * @param instance current instance * @param <T> current type * @return instance with injected fields (if possible) */ public static <T> T injectFields(T instance) { CodiCoreConfig codiCoreConfig = getContextualReferenceByClass(CodiCoreConfig.class); return injectFields(instance, codiCoreConfig.isAdvancedQualifierRequiredForDependencyInjection()); } /** * Allows to perform dependency injection for instances which aren't managed by CDI * @param instance current instance * @param requiresAdvancedQualifier flag which indicates if an instance has to be annotated with {@link Advanced} * to be eligible for dependency injection. * @param <T> current type * @return instance with injected fields (if possible) */ public static <T> T injectFields(T instance, boolean requiresAdvancedQualifier) { if(instance == null) { return null; } if(requiresAdvancedQualifier && instance.getClass().isAnnotationPresent(Advanced.class)) { return tryToInjectFields(instance); } else if(!requiresAdvancedQualifier) { return tryToInjectFields(instance); } return instance; } /** * Performes dependency injection for objects which aren't know as bean * * @param instance the target instance * @param <T> generic type * @return an instance produced by the {@link javax.enterprise.inject.spi.BeanManager} or * a manually injected instance (or null if the given instance is null) */ @SuppressWarnings({"unchecked"}) private static <T> T tryToInjectFields(T instance) { BeanManager beanManager = BeanManagerProvider.getInstance().getBeanManager(); T foundBean = (T) getContextualReferenceByClass(beanManager, instance.getClass(), true); if(foundBean != null) { return foundBean; } CreationalContext creationalContext = beanManager.createCreationalContext(null); AnnotatedType annotatedType = beanManager.createAnnotatedType(instance.getClass()); InjectionTarget injectionTarget = beanManager.createInjectionTarget(annotatedType); injectionTarget.inject(instance, creationalContext); return instance; } /** * Checks if the given qualifiers are equal. * * Qualifiers are equal if they have the same annotationType and all their * methods, except those annotated with @Nonbinding, return the same value. * * @param qualifier1 first qualifier * @param qualifier2 second qualifier * @return true if both qualifiers are equal, false otherwise */ public static boolean isQualifierEqual(Annotation qualifier1, Annotation qualifier2) { Class<? extends Annotation> qualifier1AnnotationType = qualifier1.annotationType(); // check if the annotationTypes are equal if (qualifier1AnnotationType == null || !qualifier1AnnotationType.equals(qualifier2.annotationType())) { return false; } // check the values of all qualifier-methods // except those annotated with @Nonbinding List<Method> bindingQualifierMethods = getBindingQualifierMethods(qualifier1AnnotationType); for (Method method : bindingQualifierMethods) { Object value1 = callMethod(qualifier1, method); Object value2 = callMethod(qualifier2, method); if (!checkEquality(value1, value2)) { return false; } } return true; } private static boolean checkEquality(Object value1, Object value2) { if ((value1 == null && value2 != null) || (value1 != null && value2 == null)) { return false; } if (value1 == null && value2 == null) { return true; } // now both values are != null Class<?> valueClass = value1.getClass(); if (!valueClass.equals(value2.getClass())) { return false; } if (valueClass.isPrimitive()) { // primitive types can be checked with == return value1 == value2; } else if (valueClass.isArray()) { Class<?> arrayType = valueClass.getComponentType(); if (arrayType.isPrimitive()) { if (Long.TYPE == arrayType) { return Arrays.equals(((long[]) value1), (long[]) value2); } else if (Integer.TYPE == arrayType) { return Arrays.equals(((int[]) value1), (int[]) value2); } else if (Short.TYPE == arrayType) { return Arrays.equals(((short[]) value1), (short[]) value2); } else if (Double.TYPE == arrayType) { return Arrays.equals(((double[]) value1), (double[]) value2); } else if (Float.TYPE == arrayType) { return Arrays.equals(((float[]) value1), (float[]) value2); } else if (Boolean.TYPE == arrayType) { return Arrays.equals(((boolean[]) value1), (boolean[]) value2); } else if (Byte.TYPE == arrayType) { return Arrays.equals(((byte[]) value1), (byte[]) value2); } else if (Character.TYPE == arrayType) { return Arrays.equals(((char[]) value1), (char[]) value2); } return false; } else { return Arrays.equals(((Object[]) value1), (Object[]) value2); } } else { return value1.equals(value2); } } /** * Calls the given method on the given instance. * Used to determine the values of annotation instances. * * @param instance current instance * @param method method which should be invoked * @return result of the called method */ private static Object callMethod(Object instance, Method method) { boolean accessible = method.isAccessible(); try { if (!accessible) { method.setAccessible(true); } return method.invoke(instance, EMPTY_OBJECT_ARRAY); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new UnhandledException("Exception in method call : " + method.getName(), e); } finally { // reset accessible value method.setAccessible(accessible); } } /** * Return a List of all methods of the qualifier, * which are not annotated with {@link Nonbinding}. * * @param qualifierAnnotationType annotation class which has to be inspected * @return methods which aren't annotated with Nonbinding */ private static List<Method> getBindingQualifierMethods(Class<? extends Annotation> qualifierAnnotationType) { Method[] qualifierMethods = qualifierAnnotationType.getDeclaredMethods(); if (qualifierMethods.length > 0) { List<Method> bindingMethods = new ArrayList<Method>(); for (Method qualifierMethod : qualifierMethods) { Annotation[] qualifierMethodAnnotations = qualifierMethod.getDeclaredAnnotations(); if (qualifierMethodAnnotations.length > 0) { // look for @Nonbinding boolean nonbinding = false; for (Annotation qualifierMethodAnnotation : qualifierMethodAnnotations) { if (Nonbinding.class.equals(qualifierMethodAnnotation.annotationType())) { nonbinding = true; break; } } if (!nonbinding) { // no @Nonbinding found - add to list bindingMethods.add(qualifierMethod); } } else { // no method-annotations - add to list bindingMethods.add(qualifierMethod); } } return bindingMethods; } // annotation has no methods return Collections.emptyList(); } /** * Resolves resources outside of CDI for the given class. * @param targetType target type * @param defaultImplementation default implementation * @param <T> current type * @return configured artifact or null if there is no result */ public static <T extends Serializable> T lookupFromEnvironment(Class<T> targetType, T... defaultImplementation) { return lookupFromEnvironment(targetType, null, defaultImplementation); } /** * Resolves resources outside of CDI for the given class. * @param targetType target type which is also used as key (the simple name of it) * @param aggregatable allows to aggregate multiple results * @param defaultImplementation default implementation * @param <T> current type * @return configured artifact or an aggregated instance if there are multiple results or null if there is no result */ public static <T extends Serializable> T lookupFromEnvironment(Class<T> targetType, Aggregatable<T> aggregatable, T... defaultImplementation) { return lookupFromEnvironment(targetType.getSimpleName(), targetType, aggregatable, defaultImplementation); } /** * Resolves resources outside of CDI for the given key and class. * @param key key for identifying the resource which has to be resolved * @param targetType target type * @param defaultImplementation default implementation * @param <T> current type * @return configured artifact or null if there is no result */ public static <T extends Serializable> T lookupFromEnvironment(String key, Class<T> targetType, T... defaultImplementation) { return lookupFromEnvironment(key, targetType, null, defaultImplementation); } /** * Resolves the configured value for the given key or uses the caller method-name as naming-convention, * if no key is provided. Example for the naming-convention: method-name: getAbcXyz -> config-key: abc_xyz. * * if the target-type is boolean or int, the values will be converted automatically. * otherwise the configured value gets returned as string. * * @param key optional key for the value in question * @param targetType type of the configured value - supported: string, boolean, integer * @param defaultValue the default value which will be returned if no configured value can be found * @param <T> current type * @return configured (optionally converted) value or the default value */ public static <T extends Serializable> T lookupConfigFromEnvironment(String key, Class<T> targetType, T defaultValue) { if(key == null) { @SuppressWarnings({"ThrowableInstanceNeverThrown"}) RuntimeException runtimeException = new RuntimeException(); String baseKey = runtimeException.getStackTrace()[1].getMethodName(); if(baseKey.startsWith("get")) { baseKey = baseKey.substring(3); } else if(baseKey.startsWith("is")) { baseKey = baseKey.substring(2); } baseKey = baseKey.substring(0, 1).toLowerCase() + baseKey.substring(1); String className = runtimeException.getStackTrace()[1].getClassName(); Class configClass = ClassUtils.tryToLoadClassForName(className); if(configClass != null && CodiConfig.class.isAssignableFrom(configClass.getSuperclass())) { //config class extends the default impl. -> use the name of the default impl. className = configClass.getSuperclass().getSimpleName(); } else { className = className.substring(className.lastIndexOf(".") + 1); } String convertedKey = StringUtils.replaceUpperCaseCharactersWithUnderscores(baseKey); key = className + "." + convertedKey; } String result = lookupFromEnvironment(key, String.class, null, null); if(result == null) { return defaultValue != null ? defaultValue : null; } if(String.class.isAssignableFrom(targetType)) { return targetType.cast(result); } if(Boolean.class.isAssignableFrom(targetType)) { return targetType.cast(Boolean.parseBoolean(result)); } if(Integer.class.isAssignableFrom(targetType)) { return targetType.cast(Integer.parseInt(result)); } throw new IllegalArgumentException(targetType.getName() + " isn't supported"); } /** * Resolves resources outside of CDI for the given key and class. * @param key key for identifying the resource which has to be resolved * @param targetType target type * @param aggregatable allows to aggregate multiple results * @param defaultImplementation default implementation * @param <T> current type * @return configured artifact or an aggregated instance if there are multiple results or null if there is no result */ public static <T extends Serializable> T lookupFromEnvironment(String key, Class<T> targetType, Aggregatable<T> aggregatable, T... defaultImplementation) { checkDefaultImplementation(defaultImplementation); List<T> results = ConfiguredArtifactUtils.getCachedArtifact(key, targetType); if(results == null) { T defaultInstance = null; if(defaultImplementation != null && defaultImplementation.length == 1) { //only one is supported defaultInstance = defaultImplementation[0]; } results = ConfiguredArtifactUtils .resolveFromEnvironment(key, targetType, aggregatable != null, defaultInstance); if(String.class.isAssignableFrom(targetType)) { ConfiguredArtifactUtils.processConfiguredArtifact(key, (List<String>)results); } else { ConfiguredArtifactUtils.processFoundArtifact(key, targetType, results); } } if(results.isEmpty()) { return null; } if(aggregatable != null) { for(T currentEntry : results) { aggregatable.add(currentEntry); } return aggregatable.create(); } else { return results.iterator().next(); } } private static void checkDefaultImplementation(Object[] defaultImplementation) { if(defaultImplementation != null && defaultImplementation.length > 1) { StringBuilder foundDefaultImplementations = new StringBuilder(); for(Object o : defaultImplementation) { foundDefaultImplementations.append(o.getClass()).append("\n"); } throw new IllegalStateException(defaultImplementation.length + " default implementations are provided. " + "CodiUtils#lookupFromEnvironment only allows one default implementation. Found implementations: " + foundDefaultImplementations.toString()); } } /** * Checks if CDI is up and running * @return true if CDI was bootstrapped, false otherwise */ public static boolean isCdiInitialized() { return BeanManagerProvider.isActive(); } }
[ "lzwneu@163.com" ]
lzwneu@163.com
0fadcb6b3a06a037c809c3540aeb31b543ecf77f
a48bcb97d819676dd1c5c2e61b473d5dcd752d9f
/src/test/java/com/test/sirisha/steps/StepsImpl.java
c46a4d0720ca3ed406c1e6492409e93b801c8b41
[]
no_license
SiriDunukGithub/selenium_cucumber
8f4c26ad2e45a3cb9ee4295461faf014975a3827
20e64104f4a7639a290a8cc4e76d983df0b73f40
refs/heads/main
2023-03-13T22:00:35.695877
2021-03-02T23:44:55
2021-03-02T23:44:55
343,219,588
0
0
null
null
null
null
UTF-8
Java
false
false
5,163
java
/** * */ package com.test.sirisha.steps; import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertEquals; import org.openqa.selenium.WebDriver; import org.openqa.selenium.support.PageFactory; import cucumber.api.java.After; import cucumber.api.java.Before; import cucumber.api.java.en.Given; import cucumber.api.java.en.Then; import cucumber.api.java.en.When; import com.test.sirisha.utils.ConfigurationParser; import com.test.sirisha.pages.Authentication; import com.test.sirisha.pages.Category; import com.test.sirisha.pages.Header; import com.test.sirisha.pages.MyAccount; import com.test.sirisha.pages.Order; import com.test.sirisha.pages.OrderConfirmation; import com.test.sirisha.pages.Payment; /** * @author Sirisha Dunukunala * */ public class StepsImpl { static WebDriver driver; String orderNumber; String expectedFirstName; String firstNameBeforeChange; @Before public void before() { ConfigurationParser.getInstance(); driver = ConfigurationParser.getChromeDriver(); orderNumber = ""; expectedFirstName = ""; firstNameBeforeChange = ""; } @After public void after() { driver.close(); } @Given("^I have Opened Webpage for AutomationPractice$") public void inBrowserEnterUrl() throws Throwable { driver.get(ConfigurationParser.getUrl()); } @Given("^Logged into Account using valid loging Credentials$") public void login() throws Throwable { Header header = PageFactory.initElements(driver, Header.class); header.clickSignIn(); Authentication auth = PageFactory.initElements(driver, Authentication.class); auth.LogIn(); } @When("^we select T-shirt tab$") public void selectTshirtTab() throws Throwable { Header header = PageFactory.initElements(driver, Header.class); header.clickTShirtTab(); } @When("^Add First Item to Cart$") public void selectFirstItemFromList() throws Throwable { Category category = PageFactory.initElements(driver, Category.class); category.addFirstProduct(); } @When("^Proceed to Checkout$") public void proceedToCheckoutPopup() throws Throwable { Category category = PageFactory.initElements(driver, Category.class); category.proceedToCheckout(); } @When("^Summary Proceed to Checkout$") public void summaryDetails() throws Throwable { Order order = PageFactory.initElements(driver, Order.class); order.summaryProceedToCheckout(); } @When("^Address Proceed to Checkout$") public void addressCheckout() throws Throwable { Order order = PageFactory.initElements(driver, Order.class); order.addressProceedToCheckout(); } @When("^Agree to Terms and Conditions and Proceed to Payment$") public void agreeTAndCAndShipmentCheckout() throws Throwable { Order order = PageFactory.initElements(driver, Order.class); order.agreeTAndCAndShipmentCheckout(); } @When("^Select Payment by Wire$") public void selectPaymentByWire() throws Throwable { Order order = PageFactory.initElements(driver, Order.class); order.selectPaymentByBankWire(); } @When("^Made a Payment$") public void makePayment() throws Throwable { Payment payment = PageFactory.initElements(driver, Payment.class); payment.clickConfirmOrderBtn(); } @Then("^Verify that Order is Confirmed$") public void verifyOrder() throws Throwable { OrderConfirmation orderDetails = PageFactory.initElements(driver, OrderConfirmation.class); orderNumber = orderDetails.getOrderNumber(); } @Then("^Verify Order in OrderHistory$") public void checkOrderNumberPresentInHistory() throws Throwable { Header header = PageFactory.initElements(driver, Header.class); header.clickMyAccount(); MyAccount myAccount = PageFactory.initElements(driver, MyAccount.class); myAccount.clickOrderHistory(); assertTrue(myAccount.isOrderPresent(orderNumber)); } @When("^Clicked My Account and Clicked On Personal Information$") public void click() throws Throwable { Header header = PageFactory.initElements(driver, Header.class); header.clickMyAccount(); MyAccount myAccount = PageFactory.initElements(driver, MyAccount.class); myAccount.clickPersonalInformationBtn(); firstNameBeforeChange = myAccount.getFirstName(); } @When("^Changed FirstName to \\\"([^\\\"]*)\\\" and save$") public void changeFirstNameWith(String firstName) throws Throwable { Header header = PageFactory.initElements(driver, Header.class); header.clickMyAccount(); MyAccount myAccount = PageFactory.initElements(driver, MyAccount.class); myAccount.clickPersonalInformationBtn(); myAccount.setFirstName(firstName); myAccount.clickSaveInPersonalInfo(); expectedFirstName = firstName; } @Then("^First Name is Updated Correctly$") public void FirstNameIsUpdatedCorrectly() throws Throwable { Header header = PageFactory.initElements(driver, Header.class); header.clickMyAccount(); MyAccount myAccount = PageFactory.initElements(driver, MyAccount.class); myAccount.clickPersonalInformationBtn(); String actualFirstName = myAccount.getFirstName(); assertEquals("FirstName has not changed", ConfigurationParser.capitalize(expectedFirstName), actualFirstName); changeFirstNameWith(firstNameBeforeChange); } }
[ "siri.rajravipati@gmail.com" ]
siri.rajravipati@gmail.com
8945d9ad3cbc95b48e241c1e434db41bcff55764
f321db1ace514d08219cc9ba5089ebcfff13c87a
/generated-tests/dynamosa/tests/s1040/5_la4j/evosuite-tests/org/la4j/decomposition/EigenDecompositor_ESTest.java
23352a7fc478dcdce9c1f35c3a814d667c67a6f6
[]
no_license
sealuzh/dynamic-performance-replication
01bd512bde9d591ea9afa326968b35123aec6d78
f89b4dd1143de282cd590311f0315f59c9c7143a
refs/heads/master
2021-07-12T06:09:46.990436
2020-06-05T09:44:56
2020-06-05T09:44:56
146,285,168
2
2
null
null
null
null
UTF-8
Java
false
false
8,451
java
/* * This file was automatically generated by EvoSuite * Fri Jul 05 17:02:25 GMT 2019 */ package org.la4j.decomposition; import org.junit.Test; import static org.junit.Assert.*; import static org.evosuite.runtime.EvoAssertions.*; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.evosuite.runtime.mock.java.util.MockRandom; import org.junit.runner.RunWith; import org.la4j.Matrix; import org.la4j.decomposition.EigenDecompositor; import org.la4j.matrix.ColumnMajorSparseMatrix; import org.la4j.matrix.RowMajorSparseMatrix; import org.la4j.matrix.SparseMatrix; import org.la4j.operation.ooplace.OoPlaceOuterProduct; import org.la4j.vector.DenseVector; import org.la4j.vector.SparseVector; @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true, useJEE = true) public class EigenDecompositor_ESTest extends EigenDecompositor_ESTest_scaffolding { @Test(timeout = 4000) public void test00() throws Throwable { SparseMatrix sparseMatrix0 = SparseMatrix.identity(3); EigenDecompositor eigenDecompositor0 = new EigenDecompositor(sparseMatrix0); Matrix[] matrixArray0 = eigenDecompositor0.decompose(); assertEquals(2, matrixArray0.length); } @Test(timeout = 4000) public void test01() throws Throwable { ColumnMajorSparseMatrix columnMajorSparseMatrix0 = ColumnMajorSparseMatrix.fromCSV(""); RowMajorSparseMatrix rowMajorSparseMatrix0 = RowMajorSparseMatrix.block(columnMajorSparseMatrix0, columnMajorSparseMatrix0, columnMajorSparseMatrix0, columnMajorSparseMatrix0); EigenDecompositor eigenDecompositor0 = new EigenDecompositor(columnMajorSparseMatrix0); boolean boolean0 = eigenDecompositor0.applicableTo(rowMajorSparseMatrix0); assertTrue(boolean0); } @Test(timeout = 4000) public void test02() throws Throwable { OoPlaceOuterProduct ooPlaceOuterProduct0 = new OoPlaceOuterProduct(); double[] doubleArray0 = new double[2]; doubleArray0[0] = (double) 6; doubleArray0[1] = Double.POSITIVE_INFINITY; SparseVector sparseVector0 = SparseVector.fromArray(doubleArray0); Matrix matrix0 = ooPlaceOuterProduct0.apply(sparseVector0, sparseVector0); EigenDecompositor eigenDecompositor0 = new EigenDecompositor(matrix0); // Undeclared exception! try { eigenDecompositor0.decompose(); fail("Expecting exception: NumberFormatException"); } catch(NumberFormatException e) { // // Infinite or NaN // verifyException("java.math.BigDecimal", e); } } @Test(timeout = 4000) public void test03() throws Throwable { DenseVector denseVector0 = DenseVector.unit(10); OoPlaceOuterProduct ooPlaceOuterProduct0 = new OoPlaceOuterProduct(); Matrix matrix0 = ooPlaceOuterProduct0.apply(denseVector0, denseVector0); EigenDecompositor eigenDecompositor0 = new EigenDecompositor(matrix0); eigenDecompositor0.matrix = null; // Undeclared exception! try { eigenDecompositor0.decompose(); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("org.la4j.decomposition.EigenDecompositor", e); } } @Test(timeout = 4000) public void test04() throws Throwable { MockRandom mockRandom0 = new MockRandom(); Matrix matrix0 = Matrix.random(5, 5, mockRandom0); EigenDecompositor eigenDecompositor0 = new EigenDecompositor(matrix0); // Undeclared exception! try { eigenDecompositor0.applicableTo((Matrix) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("org.la4j.decomposition.EigenDecompositor", e); } } @Test(timeout = 4000) public void test05() throws Throwable { EigenDecompositor eigenDecompositor0 = null; try { eigenDecompositor0 = new EigenDecompositor((Matrix) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("org.la4j.decomposition.EigenDecompositor", e); } } @Test(timeout = 4000) public void test06() throws Throwable { RowMajorSparseMatrix rowMajorSparseMatrix0 = RowMajorSparseMatrix.zero(3119, 3, 3119); EigenDecompositor eigenDecompositor0 = null; try { eigenDecompositor0 = new EigenDecompositor(rowMajorSparseMatrix0); fail("Expecting exception: IllegalArgumentException"); } catch(IllegalArgumentException e) { // // Given matrix can not be used with this decompositor. // verifyException("org.la4j.decomposition.AbstractDecompositor", e); } } @Test(timeout = 4000) public void test07() throws Throwable { MockRandom mockRandom0 = new MockRandom(); Matrix matrix0 = Matrix.random(9, 9, mockRandom0); EigenDecompositor eigenDecompositor0 = new EigenDecompositor(matrix0); Matrix[] matrixArray0 = eigenDecompositor0.decompose(); assertEquals(2, matrixArray0.length); } @Test(timeout = 4000) public void test08() throws Throwable { MockRandom mockRandom0 = new MockRandom(988L); mockRandom0.nextLong(); Matrix matrix0 = Matrix.random(6, 6, mockRandom0); EigenDecompositor eigenDecompositor0 = new EigenDecompositor(matrix0); Matrix[] matrixArray0 = eigenDecompositor0.decompose(); assertEquals(2, matrixArray0.length); } @Test(timeout = 4000) public void test09() throws Throwable { MockRandom mockRandom0 = new MockRandom(); mockRandom0.nextLong(); Matrix matrix0 = Matrix.random(8, 8, mockRandom0); EigenDecompositor eigenDecompositor0 = new EigenDecompositor(matrix0); Matrix[] matrixArray0 = eigenDecompositor0.decompose(); assertEquals(2, matrixArray0.length); } @Test(timeout = 4000) public void test10() throws Throwable { MockRandom mockRandom0 = new MockRandom(); Matrix matrix0 = Matrix.random(10, 10, mockRandom0); EigenDecompositor eigenDecompositor0 = new EigenDecompositor(matrix0); Matrix[] matrixArray0 = eigenDecompositor0.decompose(); assertEquals(2, matrixArray0.length); } @Test(timeout = 4000) public void test11() throws Throwable { Matrix matrix0 = Matrix.unit(5, 5); EigenDecompositor eigenDecompositor0 = new EigenDecompositor(matrix0); Matrix[] matrixArray0 = eigenDecompositor0.decompose(); assertEquals(2, matrixArray0.length); } @Test(timeout = 4000) public void test12() throws Throwable { DenseVector denseVector0 = DenseVector.unit(10); Matrix matrix0 = denseVector0.toDiagonalMatrix(); EigenDecompositor eigenDecompositor0 = new EigenDecompositor(matrix0); ColumnMajorSparseMatrix columnMajorSparseMatrix0 = ColumnMajorSparseMatrix.zero(1295, 10, 1295); Matrix matrix1 = columnMajorSparseMatrix0.transpose(); boolean boolean0 = eigenDecompositor0.applicableTo(matrix1); assertFalse(boolean0); } @Test(timeout = 4000) public void test13() throws Throwable { DenseVector denseVector0 = DenseVector.unit(10); Matrix matrix0 = Matrix.zero(10, 10); EigenDecompositor eigenDecompositor0 = new EigenDecompositor(matrix0); Matrix matrix1 = denseVector0.toColumnMatrix(); eigenDecompositor0.matrix = matrix1; // Undeclared exception! try { eigenDecompositor0.decompose(); fail("Expecting exception: IllegalArgumentException"); } catch(IllegalArgumentException e) { // // Can't decompose rectangle matrix // verifyException("org.la4j.decomposition.EigenDecompositor", e); } } @Test(timeout = 4000) public void test14() throws Throwable { Matrix matrix0 = Matrix.unit(13, 13); EigenDecompositor eigenDecompositor0 = new EigenDecompositor(matrix0); // Undeclared exception! eigenDecompositor0.decompose(); } }
[ "granogiovanni90@gmail.com" ]
granogiovanni90@gmail.com
8918614414f61b11b107756afa53b5866d7b227e
0aa6e5f414589d29f6daa2e39fba63dffab88302
/src/com/LeetCodeString/Solution49.java
88b554394e0d71350f5754c3a65687ecafb41223
[]
no_license
ShimanWang/JZoffer
37d836acf31cf2cf052be8ddb7a80a7afd83174e
b7ce55acb9d69e581b253e0cab68179b178834c6
refs/heads/master
2020-08-06T21:12:49.553876
2019-10-22T16:13:38
2019-10-22T16:21:22
213,156,935
0
0
null
null
null
null
UTF-8
Java
false
false
2,793
java
package com.LeetCodeString; import java.util.*; //字母异位词分组 /* *输入: ["eat", "tea", "tan", "ate", "nat", "bat"], 输出: [ ["ate","eat","tea"], ["nat","tan"], ["bat"] ] * 这是LeetCode中的返回值,是List<List<String>> * */ public class Solution49 { public static ArrayList<String> anagrams(String[] strs) { if(strs.length == 0){ return null; } ArrayList<String> list = new ArrayList<>(); //搞一个map,key是字典顺序的字符串,value是一个list,里面放原字符串(未计算字典顺序前的字符串) HashMap<String, ArrayList<String>> map = new HashMap<>(); for(String str : strs){ String key = sort(str); if(map.containsKey(key)){ map.get(key).add(str); }else { ArrayList<String> temp = new ArrayList<>(); temp.add(str); map.put(key,temp); } } //将map中的value放入一个list中返回 Set<String> set = map.keySet(); for(String str : set){ ArrayList<String> res = map.get(str); if(res.size()!=0){ list.addAll(res);//addAll()方法是按照位置逐条向原有的list中添加对象元素 } } return list; } public static String sort(String str) { char[] arr = str.toCharArray(); //将这个字符数组按照字典顺序排序 Arrays.sort(arr); String res = ""; for (int i = 0; i < arr.length; i++) { res = res + arr[i]; } return res; } //LeetCode 中要求返回值为List<List<String>> public static List<List<String>> groupAnagrams(String[] strs) { if(strs.length == 0){ return null; } List<List<String>> list = new ArrayList<>(); HashMap<String,ArrayList<String>> map = new HashMap<>(); // for(String str : strs){ // String key = sort(str); // if(map.containsKey(key)){ // map.get(key).add(str); // }else { // ArrayList<String> temp = new ArrayList<>(); // temp.add(str); // map.put(key,temp); // } // } //将map中的value放入一个List<List<String>> 中,返回 Set<String> set = map.keySet(); for(String str : set){ list.add(map.get(str)); } return list; } public static void main(String[] args) { // String[] arr1 = {""}; String[] arr1 = {"eat", "tea", "tan", "ate", "nat", "bat"}; ArrayList<String> list = anagrams(arr1); for(String s : list){ System.out.println(s); } } }
[ "wangshiman1995@163.com" ]
wangshiman1995@163.com
c0922890aabb70bc49a1f42853bbebf782ff95d7
b5464e90492a64905d7baa0fd197416eb29587c7
/app/src/main/java/cl/utem/dist/proyecto/vo/google/GeoCodeGoogleVO.java
f34b2e478c73b692d4341f226d04cb59d675ee3c
[]
no_license
sebasalazar/ParadasAPI
f6ec6cbef7914a57c2e517057141ea096dc820af
6a58a1aede057bb2b547dd513bcfc18e63fff69b
refs/heads/master
2020-08-06T15:39:52.325712
2019-11-22T19:56:04
2019-11-22T19:56:04
213,060,088
2
1
null
2019-11-22T19:56:05
2019-10-05T19:35:54
null
UTF-8
Java
false
false
1,477
java
package com.example.vo.google; import java.util.HashMap; import java.util.List; import java.util.Map; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonPropertyOrder({ "results", "status" }) public class GeoCodeGoogleVO { @JsonProperty("results") private List<Result> results = null; @JsonProperty("status") private String status; @JsonIgnore private Map<String, Object> additionalProperties = new HashMap<String, Object>(); @JsonProperty("results") public List<Result> getResults() { return results; } @JsonProperty("results") public void setResults(List<Result> results) { this.results = results; } @JsonProperty("status") public String getStatus() { return status; } @JsonProperty("status") public void setStatus(String status) { this.status = status; } @JsonAnyGetter public Map<String, Object> getAdditionalProperties() { return this.additionalProperties; } @JsonAnySetter public void setAdditionalProperty(String name, Object value) { this.additionalProperties.put(name, value); } }
[ "ssalazar@experti.cl" ]
ssalazar@experti.cl
5e37c73de6b44a2a8561b5db36e50ce557da9600
8cdd38dfd700c17d688ac78a05129eb3a34e68c7
/JVXML_HOME/org.jvoicexml/src/org/jvoicexml/documentserver/ExternalGrammarDocument.java
8fa7f93dc5475b9e0e57de84a23c8b6825d58941
[]
no_license
tymiles003/JvoiceXML-Halef
b7d975dbbd7ca998dc1a4127f0bffa0552ee892e
540ff1ef50530af24be32851c2962a1e6a7c9dbb
refs/heads/master
2021-01-18T18:13:56.781237
2014-05-13T15:56:07
2014-05-13T15:56:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,122
java
/* * File: $HeadURL: https://svn.code.sf.net/p/jvoicexml/code/trunk/org.jvoicexml/src/org/jvoicexml/documentserver/ExternalGrammarDocument.java $ * Version: $LastChangedRevision: 3231 $ * Date: $Date $ * Author: $LastChangedBy: schnelle $ * * JVoiceXML - A free VoiceXML implementation. * * Copyright (C) 2005-2012 JVoiceXML group - http://jvoicexml.sourceforge.net * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ package org.jvoicexml.documentserver; import java.io.UnsupportedEncodingException; import java.net.URI; import java.util.Arrays; import org.apache.log4j.Logger; import org.jvoicexml.GrammarDocument; import org.jvoicexml.xml.srgs.GrammarType; import org.jvoicexml.xml.srgs.ModeType; /** * Basic implementation of a {@link GrammarDocument}. * * @author Dirk Schnelle-Walka * @version $Revision: 3231 $ * @since 0.5.5 */ public final class ExternalGrammarDocument implements GrammarDocument { /** Logger for this class. */ private static final Logger LOGGER = Logger.getLogger(ExternalGrammarDocument.class); /** Base hash code. */ private static final int HASH_CODE_BASE = 13; /** Multiplier for hash code generation. */ private static final int HASH_CODE_MULTIPLIER = 31; /** The grammar type. */ private GrammarType type; /** The mode type. */ private ModeType mode; /** The grammar document. */ private String document; /** Guessed character set. */ private final String charset; /** <code>true</code> if the contents of {@link #buffer} is plain text. */ private final boolean isAscii; /** The grammar document buffer if the document is binary. */ private final byte[] buffer; /** URI of the grammar source. */ private final URI uri; /** * Creates a new grammar document. This constructor is intended to be * used to capture external grammars. * @param source URI of the grammar document * @param content the grammar itself * @param encoding guessed encoding of the grammar * @param ascii <code>true</code> if content is in ASCII format */ public ExternalGrammarDocument(final URI source, final byte[] content, final String encoding, final boolean ascii) { uri = source; charset = encoding; isAscii = ascii; document = null; buffer = content; } /** * {@inheritDoc} */ @Override public URI getURI() { return uri; } /** * {@inheritDoc} */ @Override public GrammarType getMediaType() { return type; } /** * {@inheritDoc} */ @Override public void setMediaType(final GrammarType grammartype) { type = grammartype; } /** * {@inheritDoc} */ @Override public boolean isAscii() { return isAscii; } /** * {@inheritDoc} */ @Override public byte[] getBuffer() { return buffer; } /** * {@inheritDoc} */ @Override public String getDocument() { if (document == null) { if (charset == null) { document = new String(buffer); } else { try { document = new String(buffer, charset); } catch (UnsupportedEncodingException ex) { LOGGER.warn("unable to use charset '" + charset + "' to convert grammar '" + uri + "'' Using default.", ex); document = new String(buffer); } } } return document; } /** * {@inheritDoc} */ @Override public String getTextContent() { return getDocument(); } /** * {@inheritDoc} */ @Override public boolean equals(final Object obj) { if (!(obj instanceof GrammarDocument)) { return false; } final GrammarDocument other = (GrammarDocument) obj; return equals(other); } /** * {@inheritDoc} * @return <code>true</code> if the {@link GrammarDocument}s share * the same buffer */ @Override public boolean equals(final GrammarDocument other) { final byte[] otherBuffer = other.getBuffer(); return Arrays.equals(buffer, otherBuffer); } /** * {@inheritDoc} */ @Override public int hashCode() { final int prime = HASH_CODE_MULTIPLIER; int result = HASH_CODE_BASE; result = prime * result + Arrays.hashCode(buffer); return result; } /** * {@inheritDoc} */ @Override public ModeType getModeType() { return mode; } /** * {@inheritDoc} */ @Override public void setModeType(final ModeType modeType) { mode = modeType; } /** * {@inheritDoc} */ @Override public String toString() { final StringBuilder str = new StringBuilder(); str.append(getClass().getCanonicalName()); str.append('['); str.append(uri); str.append(','); str.append(mode); str.append(','); str.append(type); str.append(','); str.append(charset); str.append(','); str.append(getDocument()); str.append(']'); return str.toString(); } }
[ "malatawy15@gmail.com" ]
malatawy15@gmail.com
48751d30d62a09593099a3103a89fe214779c2fe
dcc469d67ce0b256703b2a671aceecc7081cb743
/src/main/java/com/leetCode/strStr.java
6e0ed4f9c3df0e5aebedaa57fc0e98f884909f96
[]
no_license
dessy93/javabasecode
de855909208d6debecfd8c0f9d36da872399cb51
03491cc70f2e8fa8d0d7f30457ab9cd60b2f3cce
refs/heads/master
2021-07-17T03:16:05.358488
2020-04-12T14:20:04
2020-04-12T14:20:04
158,401,702
2
0
null
2020-04-12T14:20:26
2018-11-20T14:25:12
Java
UTF-8
Java
false
false
546
java
package com.leetCode; public class strStr { public static int strStr(String haystack, String needle) { for (int i=0;i<haystack.length() - needle.length()+1;i++) { int j=0; for (;j<needle.length();j++){ if (haystack.charAt(i+j) != needle.charAt(j)) break; } if (j == needle.length()) return i; } return -1; } public static void main(String[] args) { System.out.println(strStr("aabba","ba")); } }
[ "Cxy9976529!" ]
Cxy9976529!
031d70d800c56b320655145a083f8feac0166832
82831ebd512e445d5df32d7fb455faf45458f18f
/src/test/java/org/nextrtc/signalingserver/domain/ServerTest.java
366d88dbceae879921afbfa67382b048aeec5b5f
[ "MIT" ]
permissive
tonual/nextrtc-signaling-server
47eb91763b7ddaa981dbe736b78ef7ac255c35b2
6ea5fce6d8b79801a05236e42dcdcd52544b9b29
refs/heads/master
2020-12-13T19:12:46.287640
2015-12-23T08:25:33
2015-12-23T08:25:33
48,478,447
1
0
null
2015-12-23T08:16:17
2015-12-23T08:16:16
null
UTF-8
Java
false
false
11,410
java
package org.nextrtc.signalingserver.domain; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.nextrtc.signalingserver.BaseTest; import org.nextrtc.signalingserver.EventChecker; import org.nextrtc.signalingserver.MessageMatcher; import org.nextrtc.signalingserver.api.NextRTCEvents; import org.nextrtc.signalingserver.api.annotation.NextRTCEventListener; import org.nextrtc.signalingserver.api.dto.NextRTCEvent; import org.nextrtc.signalingserver.domain.ServerTest.LocalStreamCreated; import org.nextrtc.signalingserver.domain.ServerTest.ServerEventCheck; import org.nextrtc.signalingserver.exception.Exceptions; import org.nextrtc.signalingserver.exception.SignalingException; import org.nextrtc.signalingserver.repository.Members; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import javax.websocket.CloseReason; import javax.websocket.Session; import java.util.List; import static org.apache.commons.lang3.StringUtils.EMPTY; import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import static org.nextrtc.signalingserver.api.NextRTCEvents.CONVERSATION_CREATED; import static org.nextrtc.signalingserver.api.NextRTCEvents.SESSION_OPENED; @ContextConfiguration(classes = { ServerEventCheck.class, LocalStreamCreated.class }) public class ServerTest extends BaseTest { @NextRTCEventListener({ SESSION_OPENED, CONVERSATION_CREATED }) public static class ServerEventCheck extends EventChecker { } @Rule public ExpectedException expect = ExpectedException.none(); @Autowired private Server server; @Autowired private Members members; @Autowired private ServerEventCheck eventCheckerCall; @Test public void shouldThrowExceptionWhenMemberDoesntExists() throws Exception { // given Session session = mock(Session.class); when(session.getId()).thenReturn("s1"); // then expect.expect(SignalingException.class); expect.expectMessage(Exceptions.MEMBER_NOT_FOUND.name()); // when server.handle(mock(Message.class), session); } @Test public void shouldRegisterUserOnWebSocketConnection() throws Exception { // given Session session = mock(Session.class); when(session.getId()).thenReturn("s1"); // when server.register(session); // then assertTrue(members.findBy("s1").isPresent()); } @Test public void shouldCreateConversationOnCreateSignal() throws Exception { // given Session session = mockSession("s1"); server.register(session); // when server.handle(Message.create()// .signal("create")// .build(), session); // then List<NextRTCEvent> events = eventCheckerCall.getEvents(); assertThat(events.size(), is(2)); } @Test public void shouldCreateConversation() throws Exception { // given MessageMatcher s1Matcher = new MessageMatcher(); MessageMatcher s2Matcher = new MessageMatcher(); Session s1 = mockSession("s1", s1Matcher); Session s2 = mockSession("s2", s2Matcher); server.register(s1); server.register(s2); // when server.handle(Message.create()// .signal("create")// .build(), s1); // then assertThat(s1Matcher.getMessages().size(), is(1)); assertThat(s1Matcher.getMessage().getSignal(), is("created")); assertThat(s2Matcher.getMessages().size(), is(0)); } @Test public void shouldCreateConversationThenJoinAndSendOfferRequest() throws Exception { // given MessageMatcher s1Matcher = new MessageMatcher(); MessageMatcher s2Matcher = new MessageMatcher(); Session s1 = mockSession("s1", s1Matcher); Session s2 = mockSession("s2", s2Matcher); server.register(s1); server.register(s2); // when server.handle(Message.create()// .signal("create")// .build(), s1); String conversationKey = s1Matcher.getMessage().getContent(); // s1Matcher.reset(); server.handle(Message.create()// .signal("join")// .content(conversationKey)// .build(), s2); // then assertThat(s1Matcher.getMessages().size(), is(3)); assertMessage(s1Matcher, 0, EMPTY, "s1", "created", conversationKey); assertMessage(s1Matcher, 1, "s2", "s1", "joined", EMPTY); assertMessage(s1Matcher, 2, "s2", "s1", "offerRequest", EMPTY); assertThat(s2Matcher.getMessages().size(), is(1)); assertMessage(s2Matcher, 0, EMPTY, "s2", "joined", conversationKey); } @NextRTCEventListener({ NextRTCEvents.MEDIA_LOCAL_STREAM_CREATED }) public static class LocalStreamCreated extends EventChecker { } @Autowired private LocalStreamCreated eventLocalStream; @Test public void shouldCreateConversationJoinMemberAndPassOfferResponseToRestMembers() throws Exception { // given MessageMatcher s1Matcher = new MessageMatcher(); MessageMatcher s2Matcher = new MessageMatcher(); Session s1 = mockSession("s1", s1Matcher); Session s2 = mockSession("s2", s2Matcher); server.register(s1); server.register(s2); server.handle(Message.create()// .signal("create")// .build(), s1); String conversationKey = s1Matcher.getMessage().getContent(); server.handle(Message.create()// .signal("join")// .content(conversationKey)// .build(), s2); s1Matcher.reset(); s2Matcher.reset(); // when // s2 has to create local stream server.handle(Message.create()// .to("s2")// .signal("offerResponse")// .content("s2 spd")// .build(), s1); // then assertThat(s2Matcher.getMessages().size(), is(1)); assertMessage(s2Matcher, 0, "s1", "s2", "answerRequest", "s2 spd"); assertThat(s1Matcher.getMessages().size(), is(0)); } @Test public void shouldCreateConversationJoinMemberAndPassOfferResponseToRestTwoMembers() throws Exception { // given MessageMatcher s1Matcher = new MessageMatcher(); MessageMatcher s2Matcher = new MessageMatcher(); MessageMatcher s3Matcher = new MessageMatcher(); Session s1 = mockSession("s1", s1Matcher); Session s2 = mockSession("s2", s2Matcher); Session s3 = mockSession("s3", s3Matcher); server.register(s1); server.register(s2); server.register(s3); server.handle(Message.create()// .signal("create")// .build(), s1); String conversationKey = s1Matcher.getMessage().getContent(); server.handle(Message.create()// .signal("join")// .content(conversationKey)// .build(), s2); server.handle(Message.create()// .signal("join")// .content(conversationKey)// .build(), s3); s1Matcher.reset(); s2Matcher.reset(); s3Matcher.reset(); // when // s2 has to create local stream server.handle(Message.create()// .to("s1")// .signal("offerResponse")// .content("s2 spd")// .build(), s2); // s3 has to create local stream server.handle(Message.create()// .to("s1")// .signal("offerResponse")// .content("s3 spd")// .build(), s3); // then assertThat(s2Matcher.getMessages().size(), is(1)); assertMessage(s2Matcher, 0, "s1", "s2", "answerRequest", "s2 spd"); assertThat(s3Matcher.getMessages().size(), is(1)); assertMessage(s3Matcher, 0, "s1", "s3", "answerRequest", "s3 spd"); assertThat(s1Matcher.getMessages().size(), is(0)); } @Test public void shouldExchangeSpds() throws Exception { // given MessageMatcher s1Matcher = new MessageMatcher(); MessageMatcher s2Matcher = new MessageMatcher(); Session s1 = mockSession("s1", s1Matcher); Session s2 = mockSession("s2", s2Matcher); server.register(s1); server.register(s2); server.handle(Message.create()// .signal("create")// .build(), s1); // -> created String conversationKey = s1Matcher.getMessage().getContent(); server.handle(Message.create()// .signal("join")// .content(conversationKey)// .build(), s2); // -> joined // -> offerRequest server.handle(Message.create()// .to("s1")// .signal("offerResponse")// .content("s2 spd")// .build(), s2); // -> answerRequest s1Matcher.reset(); s2Matcher.reset(); // when server.handle(Message.create()// .to("s2")// .signal("answerResponse")// .content("s1 spd")// .build(), s1); // then assertThat(s1Matcher.getMessages().size(), is(1)); assertMessage(s1Matcher, 0, "s2", "s1", "finalize", "s1 spd"); assertThat(s2Matcher.getMessages().size(), is(0)); } @Test public void shouldExchangeCandidates() throws Exception { // given MessageMatcher s1Matcher = new MessageMatcher(); MessageMatcher s2Matcher = new MessageMatcher(); Session s1 = mockSession("s1", s1Matcher); Session s2 = mockSession("s2", s2Matcher); server.register(s1); server.register(s2); server.handle(Message.create()// .signal("create")// .build(), s1); // -> created String conversationKey = s1Matcher.getMessage().getContent(); server.handle(Message.create()// .signal("join")// .content(conversationKey)// .build(), s2); // -> joined // -> offerRequest server.handle(Message.create()// .to("s1")// .signal("offerResponse")// .content("s2 spd")// .build(), s2); // -> answerRequest server.handle(Message.create()// .to("s2")// .signal("answerResponse")// .content("s1 spd")// .build(), s1); // -> finalize s1Matcher.reset(); s2Matcher.reset(); server.handle(Message.create()// .to("s1")// .signal("candidate")// .content("candidate s2")// .build(), s2); server.handle(Message.create()// .to("s2")// .signal("candidate")// .content("candidate s1")// .build(), s1); // when // then assertThat(s1Matcher.getMessages().size(), is(1)); assertMessage(s1Matcher, 0, "s2", "s1", "candidate", "candidate s2"); assertThat(s2Matcher.getMessages().size(), is(1)); assertMessage(s2Matcher, 0, "s1", "s2", "candidate", "candidate s1"); } @Test public void shouldUnregisterSession() throws Exception { // given MessageMatcher s1Matcher = new MessageMatcher(); MessageMatcher s2Matcher = new MessageMatcher(); Session s1 = mockSession("s1", s1Matcher); Session s2 = mockSession("s2", s2Matcher); server.register(s1); server.register(s2); server.handle(Message.create()// .signal("create")// .build(), s1); // -> created String conversationKey = s1Matcher.getMessage().getContent(); server.handle(Message.create()// .signal("join")// .content(conversationKey)// .build(), s2); s1Matcher.reset(); s2Matcher.reset(); server.unregister(s1, mock(CloseReason.class)); // when // then assertThat(s1Matcher.getMessages().size(), is(0)); assertThat(s2Matcher.getMessages().size(), is(1)); assertMessage(s2Matcher, 0, "s1", "s2", "left", EMPTY); } private void assertMessage(MessageMatcher matcher, int number, String from, String to, String signal, String content) { assertThat(matcher.getMessage(number).getFrom(), is(from)); assertThat(matcher.getMessage(number).getTo(), is(to)); assertThat(matcher.getMessage(number).getSignal(), is(signal)); assertThat(matcher.getMessage(number).getContent(), is(content)); } @Before public void resetObjects() { eventCheckerCall.reset(); eventLocalStream.reset(); members.unregister("s1"); members.unregister("s2"); members.unregister("s3"); } }
[ "m.slosarz@ahej.pl" ]
m.slosarz@ahej.pl
c0cb10d1087646ee825ed35a22e41f237433858e
9a761a5920f24917bb727c0e3388f6b6529a89e9
/src/main/java/com/gmail/timatiblackstar666/SpringMVC/models/User.java
6cf38d714191ffa6a90426073aaa39f7c63eb58f
[]
no_license
TimiTeam/SpringMVC
549380d81e9a9a7f03f991f70bd96412162413c4
251827bc4ea709f21477fa740de139124682923b
refs/heads/main
2023-05-30T22:37:54.192414
2021-06-08T14:21:08
2021-06-08T14:21:08
373,281,101
0
0
null
null
null
null
UTF-8
Java
false
false
2,539
java
package com.gmail.timatiblackstar666.SpringMVC.models; import javax.persistence.*; import javax.print.Doc; import java.util.Set; @Entity @Table(name = "users") public class User { @Id @Column(name = "user_id") @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String name; private String email; private String password; private String role; private boolean enable; @OneToMany(mappedBy = "owner", fetch = FetchType.LAZY, cascade = CascadeType.ALL) private Set<Document> documents; public User() { } public User(String name, String email, String password, String role, boolean enable) { this.name = name; this.email = email; this.password = password; this.role = role; this.enable = enable; } public User(Long id, String name, String email, String password, String role, boolean enable) { this.id = id; this.name = name; this.email = email; this.password = password; this.role = role; this.enable = enable; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getRole() { return role; } public void setRole(String role) { this.role = role; } public boolean isEnable() { return enable; } public void setEnable(boolean enable) { this.enable = enable; } public Set<Document> getDocuments() { return documents; } public void setDocuments(Set<Document> documents) { documents.forEach(document -> document.setOwner(this)); this.documents = documents; } public void addToDocuments(Document document){ document.setOwner(this); this.documents.add(document); } @Override public String toString() { return "User{" + "id=" + id + ", name='" + name + '\'' + ", email='" + email + '\'' + ", password='" + password + '\'' + '}'; } }
[ "tymur.buialo@ionidea.com" ]
tymur.buialo@ionidea.com