hexsha
stringlengths
40
40
size
int64
3
1.05M
ext
stringclasses
1 value
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
5
1.02k
max_stars_repo_name
stringlengths
4
126
max_stars_repo_head_hexsha
stringlengths
40
78
max_stars_repo_licenses
list
max_stars_count
float64
1
191k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
5
1.02k
max_issues_repo_name
stringlengths
4
114
max_issues_repo_head_hexsha
stringlengths
40
78
max_issues_repo_licenses
list
max_issues_count
float64
1
92.2k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
5
1.02k
max_forks_repo_name
stringlengths
4
136
max_forks_repo_head_hexsha
stringlengths
40
78
max_forks_repo_licenses
list
max_forks_count
float64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
avg_line_length
float64
2.55
99.9
max_line_length
int64
3
1k
alphanum_fraction
float64
0.25
1
index
int64
0
1M
content
stringlengths
3
1.05M
3e03e2a99b80b4fee08ce0f8bda292fb3bad0808
17,207
java
Java
modules/appmanager/src/main/java/org/xito/appmanager/MainPanel.java
drichan/xito
811f29e8ecda8072ce2a0eb4373ec16f6b083c99
[ "Apache-2.0" ]
null
null
null
modules/appmanager/src/main/java/org/xito/appmanager/MainPanel.java
drichan/xito
811f29e8ecda8072ce2a0eb4373ec16f6b083c99
[ "Apache-2.0" ]
null
null
null
modules/appmanager/src/main/java/org/xito/appmanager/MainPanel.java
drichan/xito
811f29e8ecda8072ce2a0eb4373ec16f6b083c99
[ "Apache-2.0" ]
1
2018-10-19T07:49:02.000Z
2018-10-19T07:49:02.000Z
31.864815
119
0.618527
1,613
// Copyright 2007 Xito.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.xito.appmanager; import org.xito.dazzle.widget.DefaultStyle; import org.xito.dazzle.widget.button.ImageButton; import org.xito.dazzle.widget.panel.GradientPanel; import org.xito.dazzle.utilities.UIUtilities; import java.awt.*; import java.awt.event.*; import java.text.*; import java.util.Enumeration; import javax.swing.*; import javax.swing.tree.*; import javax.swing.border.*; import org.xito.dazzle.*; import org.xito.dazzle.worker.BusyWorker; import org.xito.dazzle.worker.BusyWorkerAdapter; import org.xito.dialog.*; import org.xito.launcher.*; import org.xito.appmanager.store.ApplicationNode; import org.xito.appmanager.store.GroupNode; import org.xito.boot.Boot; import org.xito.boot.OfflineListener; /** * * @author Deane Richan */ public class MainPanel extends GradientPanel { //private static Color topGradColor = new Color(100,100,100); //private static Color bottomGradColor = new Color(75,75,75); private static Color topGradColor = new Color(125,125,125); private static Color bottomGradColor = new Color(125,125,125); private static Color hoverColor = new Color(0xafbfed); private ImageButton addBtn; private ImageButton removeBtn; private JTextField commandTF; private JLabel statusLbl; private JPanel topPanel; private JPanel bottomPanel; private AppTree tree; private AppTreeModel model; private JPopupMenu addPopupMnu; private TableLayout layout; private String onlineText = Resources.bundle.getString("status.online"); private String offlineText = Resources.bundle.getString("status.offline"); /** Creates a new instance of MainPanel */ public MainPanel() { super(topGradColor, bottomGradColor, 1.0f, SwingConstants.SOUTH); init(); } private void init() { layout = new TableLayout(MainPanel.class.getResource("main_layout.html")); setLayout(layout); //Top Panel initTopPanel(); //Bottom Panel initBottomPanel(); //Tree buildTree(); } /** * Initialize the Top panel */ private void initTopPanel() { topPanel = new JPanel(new BorderLayout()); topPanel.setOpaque(false); commandTF = new JTextField(); commandTF.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { LauncherService.launch(commandTF.getText()); } }); topPanel.add(commandTF); add("top", topPanel); } private void initBottomPanel() { bottomPanel = new JPanel(new BorderLayout()); bottomPanel.setOpaque(false); //Buttons initPopupMenu(); JPanel buttonPanel = new JPanel(new FlowLayout(0,0, FlowLayout.LEFT)); buttonPanel.setOpaque(false); addBtn = new ImageButton( new ImageIcon(ImageManager.getImageByName("plus.png")), new ImageIcon(ImageManager.getImageByName("plus_pressed.png")), new ImageIcon(ImageManager.getImageByName("plus_off.png"))); addBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { int h=addPopupMnu.getHeight(); System.out.println(h); addPopupMnu.show(addBtn, 0, -1 * h); } }); buttonPanel.add(addBtn); removeBtn = new ImageButton(new ImageIcon(ImageManager.getImageByName("minus.png")), new ImageIcon(ImageManager.getImageByName("minus_pressed.png")), new ImageIcon(ImageManager.getImageByName("minus_off.png"))); removeBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { DefaultMutableTreeNode node = (DefaultMutableTreeNode)tree.getSelectionPath().getLastPathComponent(); deleteNode(node); } }); buttonPanel.add(removeBtn); bottomPanel.add(buttonPanel, BorderLayout.WEST); //status String status = (Boot.isOffline()?offlineText:onlineText); Boot.addOfflineListener(new OfflineListener() { public void offline() { statusLbl.setText(offlineText); } public void online() { statusLbl.setText(onlineText); } }); statusLbl = new JLabel(status); statusLbl.setFont(DefaultStyle.getDefaults().getFont(DefaultStyle.LABEL_FONT_KEY)); statusLbl.setForeground(Color.WHITE); statusLbl.setBorder(BorderFactory.createEmptyBorder(0,0,0,20)); bottomPanel.add(statusLbl, BorderLayout.EAST); add("bottom", bottomPanel); } private void initPopupMenu() { addPopupMnu = new JPopupMenu(); JMenuItem addAliasMI = new JMenuItem(new AbstractAction() { { putValue(Action.NAME, Resources.bundle.getString("add.app.menu")); } public void actionPerformed(ActionEvent e) { addApplication(); } }); JMenuItem addGroupMI = new JMenuItem(new AbstractAction() { { putValue(Action.NAME, Resources.bundle.getString("add.group.menu")); } public void actionPerformed(ActionEvent e) { addGroup(); } }); addPopupMnu.add(addAliasMI); addPopupMnu.add(addGroupMI); } /** * Build the Tree * */ private void buildTree() { UIManager.put("Tree.hash", UIManager.getColor("Tree.background")); tree = new AppTree("main.tree"); tree.setRootVisible(false); tree.setCellRenderer(new AppTreeCellRenderer()); tree.addMouseListener(new MyTreeMouseAdapter()); tree.setBorder(new EmptyBorder(3,3,3,3)); tree.setDragEnabled(true); JScrollPane sp = new JScrollPane(tree); sp.setBorder(null); //sp.getViewport().setBorder(null); //sp.setBorder(null); add("tree", sp); //new TreeDNDHandler(tree, this); //int h = Toolkit.getDefaultToolkit().getFontMetrics(UIManager.getFont("Label.font")).getHeight(); //tree.setRowHeight(h + 2); //start a background thread to load the AppTreeModel model = new AppTreeModel(); tree.setModel(model); } /** * Initialize the applications in the Tree * @param blockingWindow */ protected void initTree(final Window blockingWindow, final boolean launchStartupApps) { AppStoreFetchWorker worker = new AppStoreFetchWorker(blockingWindow, tree); worker.addBusyWorkerListener(new BusyWorkerAdapter() { @Override public void workerFinished(BusyWorker worker) { if(launchStartupApps) launchStartup(); } }); worker.invokeLater(); } /** * launch Startup Apps */ private void launchStartup() { GroupTreeNodeWrapper root = (GroupTreeNodeWrapper)model.getRoot(); Enumeration children = root.children(); while(children.hasMoreElements()) { Object node = children.nextElement(); if(node instanceof GroupTreeNodeWrapper) { if(node.toString().equalsIgnoreCase("startup")) { Enumeration startupNodes = ((GroupTreeNodeWrapper)node).children(); while(startupNodes.hasMoreElements()) { Object startupNode = startupNodes.nextElement(); if(startupNode instanceof ApplicationTreeNodeWrapper) { try { ((ApplicationTreeNodeWrapper)startupNode).getAction().actionPerformed(null); } catch(Throwable t) { t.printStackTrace(); } } } break; } } } } /** * Get the TreeModel */ public AppTreeModel getTreeModel() { return model; } /** * Add a Group to this Manager */ protected void addGroup() { DialogDescriptor desc = new DialogDescriptor(); desc.setTitle(Resources.bundle.getString("add.group.title")); desc.setSubtitle(Resources.bundle.getString("add.group.subtitle")); //desc.setGradiantColor(org.xito.boot.ui.Defaults.DIALOG_GRAD_COLOR); //desc.setGradiantOffsetRatio(org.xito.boot.ui.Defaults.DIALOG_GRAD_OFFSET); desc.setType(DialogManager.OK_CANCEL); desc.setIcon(new ImageIcon(MainPanel.class.getResource("/org/xito/launcher/images/folder_maji_32.png"))); desc.setWidth(350); JPanel p = new GroupNamePanel(); desc.setCustomPanel(p); int result = DialogManager.showDialog((Frame)null, desc); if(result == DialogManager.OK) { String name = p.getName(); GroupNode node = new GroupNode(null, name); TreePath parentPath = tree.getSelectionPath(); model.addNode(parentPath, node); } } private void editAction(ApplicationTreeNodeWrapper node) { LauncherAction action = (LauncherAction)((ApplicationTreeNodeWrapper)node).getAction(); boolean success = action.edit(null); if(success) { model.nodeChanged(node); } } private void editGroup(GroupTreeNodeWrapper treeNode) { DialogDescriptor desc = new DialogDescriptor(); desc.setTitle(Resources.bundle.getString("edit.group.title")); desc.setSubtitle(Resources.bundle.getString("edit.group.subtitle")); desc.setType(DialogManager.OK_CANCEL); desc.setIcon(new ImageIcon(MainPanel.class.getResource("/org/xito/launcher/images/folder_32.png"))); desc.setWidth(300); JPanel p = new GroupNamePanel(); p.setName(treeNode.getGroupNode().getName()); desc.setCustomPanel(p); int result = DialogManager.showDialog((Frame)null, desc); if(result == DialogManager.OK) { String name = p.getName(); treeNode.getGroupNode().setName(name); model.nodeChanged(treeNode); } } /** * Add an Application to this Manager */ protected void addApplication() { LauncherService.createAction((Frame)SwingUtilities.getWindowAncestor(this), new LauncherActionCreatedListener() { public void launcherActionCreated(LauncherAction action) { if(action != null) { TreePath parentPath = tree.getSelectionPath(); TreePath childPath = model.addNode(parentPath, new ApplicationNode(action, true)); tree.scrollPathToVisible(childPath); } } }); } /** * Edit Node on App Tree */ public void editNode(TreeNode node) { if(node instanceof ApplicationTreeNodeWrapper) { editAction((ApplicationTreeNodeWrapper)node); } else if(node instanceof GroupTreeNodeWrapper) { editGroup((GroupTreeNodeWrapper)node); } } /** * Delete a Node from the AppTree */ public void deleteNode(DefaultMutableTreeNode node) { Frame frame = (Frame)SwingUtilities.getWindowAncestor(MainPanel.this); String title = null; String subtitle = null; String msg = null; if(node instanceof ApplicationTreeNodeWrapper) { title = Resources.bundle.getString("delete.app.title"); subtitle = Resources.bundle.getString("delete.app.subtitle"); msg = Resources.bundle.getString("delete.app.message"); msg = MessageFormat.format(msg, node.toString()); } else if(node instanceof GroupTreeNodeWrapper) { title = Resources.bundle.getString("delete.group.title"); subtitle = Resources.bundle.getString("delete.group.subtitle"); msg = Resources.bundle.getString("delete.group.message"); msg = MessageFormat.format(msg, node.toString()); } else { //shouldn't happen return; } DialogDescriptor desc = new DialogDescriptor(); desc.setTitle(title); desc.setSubtitle(subtitle); desc.setMessage(msg); desc.setType(DialogManager.YES_NO); desc.setMessageType(DialogManager.WARNING_MSG); desc.setShowButtonSeparator(true); int result = DialogManager.showDialog((Frame)null, desc); if(result == DialogManager.YES) { model.removeNode(node); } } /** * Move a Tree Node to a new Path */ public void moveNode(MutableTreeNode node, TreePath destPath, boolean above) { //Default parent to Root Node MutableTreeNode newParentNode = null; MutableTreeNode oldParentNode = (MutableTreeNode)node.getParent(); //First remove from the Parent model.removeNodeFromParent(node); int index = 0; //If no path then use Root if(destPath == null) { newParentNode = (MutableTreeNode)model.getRoot(); index = newParentNode.getChildCount(); } //Find Parent node using Path else { MutableTreeNode selectedNode = (MutableTreeNode)destPath.getLastPathComponent(); if(selectedNode.getAllowsChildren() == false) { newParentNode = (MutableTreeNode)selectedNode.getParent(); if(newParentNode == null) { newParentNode = (MutableTreeNode)model.getRoot(); } index = newParentNode.getIndex(selectedNode); } else { newParentNode = selectedNode; } } //Fix index if above if(above && index>0) { index--; } System.out.println("moving to:"+newParentNode.toString()+" index:"+index); model.insertNodeInto(node, newParentNode, index); } public void storeTreeNodes() { model.storeDirtyNodes(); } /** * Tree Mouse Adapter */ public class MyTreeMouseAdapter extends MouseAdapter { @Override public void mouseClicked(MouseEvent evt) { TreePath path = tree.getPathForLocation(evt.getX(), evt.getY()); tree.setSelectionPath(path); //Get Selected Node path = tree.getSelectionPath(); if (path == null) { return; } final DefaultMutableTreeNode node = (DefaultMutableTreeNode)path.getLastPathComponent(); if(node instanceof ApplicationTreeNodeWrapper) { //If double click then perform Action if(evt.getClickCount() == 2 && !UIUtilities.isSecondaryMouseButton(evt)) { ActionEvent ae = new ActionEvent(tree, -1, null); ((ApplicationTreeNodeWrapper)node).getAction().actionPerformed(ae); return; } } if(UIUtilities.isSecondaryMouseButton(evt)) { MyPopupMenu m = new MyPopupMenu(node); m.show(tree, evt.getX(), evt.getY()); } } } /** * Popup Menu for Tree Nodes */ public class MyPopupMenu extends JPopupMenu { private DefaultMutableTreeNode node; private JMenuItem deleteMI; private JMenuItem editMI; public MyPopupMenu(DefaultMutableTreeNode node) { this.node = node; init(); } private void init() { deleteMI = new JMenuItem("Delete"); deleteMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { deleteNode(node); } }); editMI = new JMenuItem("Properties"); editMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { editNode(node); } }); add(deleteMI); add(new JPopupMenu.Separator()); add(editMI); } } /** * Edit Group Panel */ public class GroupNamePanel extends JPanel { private JTextField nameTF; public GroupNamePanel() { init(); } private void init() { setLayout(new TableLayout(MainPanel.class.getResource("add_group_layout.html"))); JLabel lbl = new JLabel(Resources.bundle.getString("add.group.name")); add("label", lbl); nameTF = new JTextField(); add("field", nameTF); } @Override public String getName() { return nameTF.getText(); } @Override public void setName(String name) { nameTF.setText(name); } } }
3e03e2cd4ace00736ebd41c5ae9e9fac3f1a67f4
1,221
java
Java
sentinel-dashboard-nacos/src/main/java/com/alibaba/csp/sentinel/dashboard/rule/nacos/RuleNacosProvider.java
137/sentinel-nacos
08f3b459936318c631b8e27dfe3b435a7f2e86ba
[ "Apache-2.0" ]
1
2022-03-15T08:48:47.000Z
2022-03-15T08:48:47.000Z
sentinel-dashboard-nacos/src/main/java/com/alibaba/csp/sentinel/dashboard/rule/nacos/RuleNacosProvider.java
137/sentinel-nacos
08f3b459936318c631b8e27dfe3b435a7f2e86ba
[ "Apache-2.0" ]
null
null
null
sentinel-dashboard-nacos/src/main/java/com/alibaba/csp/sentinel/dashboard/rule/nacos/RuleNacosProvider.java
137/sentinel-nacos
08f3b459936318c631b8e27dfe3b435a7f2e86ba
[ "Apache-2.0" ]
null
null
null
34.885714
105
0.741196
1,614
package com.alibaba.csp.sentinel.dashboard.rule.nacos; import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.RuleEntity; import com.alibaba.csp.sentinel.dashboard.rule.DynamicRuleProvider; import com.alibaba.csp.sentinel.datasource.Converter; import com.alibaba.csp.sentinel.util.StringUtil; import com.alibaba.nacos.api.config.ConfigService; import org.springframework.beans.factory.annotation.Autowired; import java.util.ArrayList; import java.util.List; public abstract class RuleNacosProvider <T extends RuleEntity> implements DynamicRuleProvider<List<T>> { @Autowired protected ConfigService configService; @Autowired protected Converter<String, List<T>> converter; @Override public List<T> getRules(String appName) throws Exception { String rules = configService.getConfig(appName + getDataIdPostfix(), NacosConfigUtil.GROUP_ID, 3000); if (StringUtil.isEmpty(rules)) { return new ArrayList<>(); } return converter.convert(rules); } /** * 文件后缀 参考 com.alibaba.csp.sentinel.dashboard.rule.nacos.NacosConfigUtil.FLOW_DATA_ID_POSTFIX * @return */ public abstract String getDataIdPostfix(); }
3e03e3190028bf764a7feb0f5560034aea6e11fe
6,093
java
Java
classlib/java.xml/src/main/resources/META-INF/modules/java.xml/classes/org/xml/sax/helpers/LocatorImpl.java
Suyashtnt/Bytecoder
d957081d50f2d30b3206447b805b1ca9da69c8c2
[ "Apache-2.0" ]
543
2017-06-14T14:53:33.000Z
2022-03-23T14:18:09.000Z
classlib/java.xml/src/main/resources/META-INF/modules/java.xml/classes/org/xml/sax/helpers/LocatorImpl.java
Suyashtnt/Bytecoder
d957081d50f2d30b3206447b805b1ca9da69c8c2
[ "Apache-2.0" ]
381
2017-10-31T14:29:54.000Z
2022-03-25T15:27:27.000Z
classlib/java.xml/src/main/resources/META-INF/modules/java.xml/classes/org/xml/sax/helpers/LocatorImpl.java
Suyashtnt/Bytecoder
d957081d50f2d30b3206447b805b1ca9da69c8c2
[ "Apache-2.0" ]
50
2018-01-06T12:35:14.000Z
2022-03-13T14:54:33.000Z
26.84141
79
0.596586
1,615
/* * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.xml.sax.helpers; import org.xml.sax.Locator; /** * Provide an optional convenience implementation of Locator. * * <p>This class is available mainly for application writers, who * can use it to make a persistent snapshot of a locator at any * point during a document parse:</p> * * <pre> * Locator locator; * Locator startloc; * * public void setLocator (Locator locator) * { * // note the locator * this.locator = locator; * } * * public void startDocument () * { * // save the location of the start of the document * // for future use. * Locator startloc = new LocatorImpl(locator); * } *</pre> * * <p>Normally, parser writers will not use this class, since it * is more efficient to provide location information only when * requested, rather than constantly updating a Locator object.</p> * * @since 1.4, SAX 1.0 * @author David Megginson * @see org.xml.sax.Locator Locator */ public class LocatorImpl implements Locator { /** * Zero-argument constructor. * * <p>This will not normally be useful, since the main purpose * of this class is to make a snapshot of an existing Locator.</p> */ public LocatorImpl () { } /** * Copy constructor. * * <p>Create a persistent copy of the current state of a locator. * When the original locator changes, this copy will still keep * the original values (and it can be used outside the scope of * DocumentHandler methods).</p> * * @param locator The locator to copy. */ public LocatorImpl (Locator locator) { setPublicId(locator.getPublicId()); setSystemId(locator.getSystemId()); setLineNumber(locator.getLineNumber()); setColumnNumber(locator.getColumnNumber()); } //////////////////////////////////////////////////////////////////// // Implementation of org.xml.sax.Locator //////////////////////////////////////////////////////////////////// /** * Return the saved public identifier. * * @return The public identifier as a string, or null if none * is available. * @see org.xml.sax.Locator#getPublicId * @see #setPublicId */ public String getPublicId () { return publicId; } /** * Return the saved system identifier. * * @return The system identifier as a string, or null if none * is available. * @see org.xml.sax.Locator#getSystemId * @see #setSystemId */ public String getSystemId () { return systemId; } /** * Return the saved line number (1-based). * * @return The line number as an integer, or -1 if none is available. * @see org.xml.sax.Locator#getLineNumber * @see #setLineNumber */ public int getLineNumber () { return lineNumber; } /** * Return the saved column number (1-based). * * @return The column number as an integer, or -1 if none is available. * @see org.xml.sax.Locator#getColumnNumber * @see #setColumnNumber */ public int getColumnNumber () { return columnNumber; } //////////////////////////////////////////////////////////////////// // Setters for the properties (not in org.xml.sax.Locator) //////////////////////////////////////////////////////////////////// /** * Set the public identifier for this locator. * * @param publicId The new public identifier, or null * if none is available. * @see #getPublicId */ public void setPublicId (String publicId) { this.publicId = publicId; } /** * Set the system identifier for this locator. * * @param systemId The new system identifier, or null * if none is available. * @see #getSystemId */ public void setSystemId (String systemId) { this.systemId = systemId; } /** * Set the line number for this locator (1-based). * * @param lineNumber The line number, or -1 if none is available. * @see #getLineNumber */ public void setLineNumber (int lineNumber) { this.lineNumber = lineNumber; } /** * Set the column number for this locator (1-based). * * @param columnNumber The column number, or -1 if none is available. * @see #getColumnNumber */ public void setColumnNumber (int columnNumber) { this.columnNumber = columnNumber; } //////////////////////////////////////////////////////////////////// // Internal state. //////////////////////////////////////////////////////////////////// private String publicId; private String systemId; private int lineNumber; private int columnNumber; } // end of LocatorImpl.java
3e03e333e907ce4d7f4a0f6cd7b67ca4639be143
4,094
java
Java
src/test/java/de/rub/nds/modifiablevariable/integer/IntegerModificationTest.java
RUB-NDS/ModifiableVariable
56d7a91a85b436a11e5c58ead5028a9749aa9209
[ "Apache-2.0" ]
3
2017-05-02T20:34:49.000Z
2019-05-23T19:30:05.000Z
src/test/java/de/rub/nds/modifiablevariable/integer/IntegerModificationTest.java
RUB-NDS/ModifiableVariable
56d7a91a85b436a11e5c58ead5028a9749aa9209
[ "Apache-2.0" ]
13
2017-05-02T10:39:48.000Z
2020-10-19T13:06:01.000Z
src/test/java/de/rub/nds/modifiablevariable/integer/IntegerModificationTest.java
RUB-NDS/ModifiableVariable
56d7a91a85b436a11e5c58ead5028a9749aa9209
[ "Apache-2.0" ]
1
2019-05-23T19:30:08.000Z
2019-05-23T19:30:08.000Z
31.251908
101
0.670982
1,616
/** * ModifiableVariable - A Variable Concept for Runtime Modifications * * Copyright 2014-2022 Ruhr University Bochum, Paderborn University, Hackmanit GmbH * * Licensed under Apache License, Version 2.0 * http://www.apache.org/licenses/LICENSE-2.0.txt */ package de.rub.nds.modifiablevariable.integer; import de.rub.nds.modifiablevariable.VariableModification; import static org.junit.Assert.assertEquals; import org.junit.Before; import org.junit.Test; public class IntegerModificationTest { private ModifiableInteger start; private Integer expectedResult, result; public IntegerModificationTest() { } @Before public void setUp() { start = new ModifiableInteger(); start.setOriginalValue(10); expectedResult = null; result = null; } /** * Test of add method, of class IntegerModification. */ @Test public void testAdd() { VariableModification<Integer> modifier = IntegerModificationFactory.add(1); start.setModification(modifier); expectedResult = 11; result = start.getValue(); assertEquals(expectedResult, result); assertEquals(new Integer(10), start.getOriginalValue()); } /** * Test of sub method, of class IntegerModification. */ @Test public void testSub() { VariableModification<Integer> modifier = IntegerModificationFactory.sub(1); start.setModification(modifier); expectedResult = 9; result = start.getValue(); assertEquals(expectedResult, result); assertEquals(new Integer(10), start.getOriginalValue()); } /** * Test of xor method, of class IntegerModification. */ @Test public void testXor() { VariableModification<Integer> modifier = IntegerModificationFactory.xor(2); start.setModification(modifier); expectedResult = 8; result = start.getValue(); assertEquals(expectedResult, result); assertEquals(new Integer(10), start.getOriginalValue()); } /** * Test of explicitValue method, of class IntegerModification. */ @Test public void testExplicitValue() { VariableModification<Integer> modifier = IntegerModificationFactory.explicitValue(7); start.setModification(modifier); expectedResult = 7; result = start.getValue(); assertEquals(expectedResult, result); assertEquals(new Integer(10), start.getOriginalValue()); } @Test public void testShiftLeft() { VariableModification<Integer> modifier = IntegerModificationFactory.shiftLeft(2); start.setModification(modifier); expectedResult = 40; result = start.getValue(); assertEquals(expectedResult, result); assertEquals(new Integer(10), start.getOriginalValue()); } @Test public void testShiftRight() { VariableModification<Integer> modifier = IntegerModificationFactory.shiftRight(2); start.setModification(modifier); expectedResult = 2; result = start.getValue(); assertEquals(expectedResult, result); assertEquals(new Integer(10), start.getOriginalValue()); } /** * Test of explicitValue from file method, of class IntegerModification. */ @Test public void testExplicitValueFromFile() { VariableModification<Integer> modifier = IntegerModificationFactory.explicitValueFromFile(0); start.setModification(modifier); expectedResult = -128; result = start.getValue(); assertEquals(expectedResult, result); modifier = IntegerModificationFactory.explicitValueFromFile(1); start.setModification(modifier); expectedResult = -1; result = start.getValue(); assertEquals(expectedResult, result); modifier = IntegerModificationFactory.explicitValueFromFile(26); start.setModification(modifier); expectedResult = 2147483647; result = start.getValue(); assertEquals(expectedResult, result); } }
3e03e3a7fd64f3cab6783b385e7de56df421c064
120
java
Java
java/src/com/nghiabui/bootstrap/usecases/Id_String_Usecase.java
katatunix/bootstrap
9d60769c401594ea756e41a9590d9a02e2d931aa
[ "Apache-2.0" ]
null
null
null
java/src/com/nghiabui/bootstrap/usecases/Id_String_Usecase.java
katatunix/bootstrap
9d60769c401594ea756e41a9590d9a02e2d931aa
[ "Apache-2.0" ]
null
null
null
java/src/com/nghiabui/bootstrap/usecases/Id_String_Usecase.java
katatunix/bootstrap
9d60769c401594ea756e41a9590d9a02e2d931aa
[ "Apache-2.0" ]
null
null
null
15
40
0.766667
1,617
package com.nghiabui.bootstrap.usecases; public interface Id_String_Usecase { void execute(int id, String str); }
3e03e4017e087de8ab5f7e5b30afcc79afaf3828
2,491
java
Java
cas-server-core-authentication/src/test/java/org/apereo/cas/authentication/principal/ChainingPrincipalResolverTest.java
mynameisgmg/passport
8dde52613aeef3e0942c8c03647431930cd9974c
[ "Apache-2.0" ]
null
null
null
cas-server-core-authentication/src/test/java/org/apereo/cas/authentication/principal/ChainingPrincipalResolverTest.java
mynameisgmg/passport
8dde52613aeef3e0942c8c03647431930cd9974c
[ "Apache-2.0" ]
null
null
null
cas-server-core-authentication/src/test/java/org/apereo/cas/authentication/principal/ChainingPrincipalResolverTest.java
mynameisgmg/passport
8dde52613aeef3e0942c8c03647431930cd9974c
[ "Apache-2.0" ]
null
null
null
38.323077
138
0.711361
1,618
package org.apereo.cas.authentication.principal; import org.apereo.cas.authentication.Credential; import org.junit.Test; import org.mockito.ArgumentMatcher; import java.util.Arrays; import java.util.Collections; import static org.junit.Assert.*; import static org.mockito.Mockito.*; /** * Unit test for {@link ChainingPrincipalResolver}. * * @author Marvin S. Addison * @since 4.0.0 */ public class ChainingPrincipalResolverTest { private PrincipalFactory principalFactory = new DefaultPrincipalFactory(); @Test public void examineSupports() throws Exception { final Credential credential = mock(Credential.class); when(credential.getId()).thenReturn("a"); final PrincipalResolver resolver1 = mock(PrincipalResolver.class); when(resolver1.supports(eq(credential))).thenReturn(true); final PrincipalResolver resolver2 = mock(PrincipalResolver.class); when(resolver2.supports(eq(credential))).thenReturn(false); final ChainingPrincipalResolver resolver = new ChainingPrincipalResolver(); resolver.setChain(Arrays.asList(resolver1, resolver2)); assertTrue(resolver.supports(credential)); } @Test public void examineResolve() throws Exception { final Credential credential = mock(Credential.class); when(credential.getId()).thenReturn("input"); final PrincipalResolver resolver1 = mock(PrincipalResolver.class); when(resolver1.supports(eq(credential))).thenReturn(true); when(resolver1.resolve(eq(credential))).thenReturn(principalFactory.createPrincipal("output")); final PrincipalResolver resolver2 = mock(PrincipalResolver.class); when(resolver2.supports(any(Credential.class))).thenReturn(false); when(resolver2.resolve(argThat(new ArgumentMatcher<Credential>() { @Override public boolean matches(final Object o) { return "output".equals(((Credential) o).getId()); } }))).thenReturn(principalFactory.createPrincipal("final", Collections.<String, Object>singletonMap("mail", "[email protected]"))); final ChainingPrincipalResolver resolver = new ChainingPrincipalResolver(); resolver.setChain(Arrays.asList(resolver1, resolver2)); final Principal principal = resolver.resolve(credential); assertEquals("final", principal.getId()); assertEquals("[email protected]", principal.getAttributes().get("mail")); } }
3e03e5812acb280a937f5caabf5cdbeacbc8b31c
1,764
java
Java
base-common/src/main/java/com/neoframework/biz/api/teaching/model/vo/SchoolClassVo.java
mingt/sys-version
ccdc55f406a906caa6de36c7ab2b388cbdb168de
[ "Apache-2.0" ]
null
null
null
base-common/src/main/java/com/neoframework/biz/api/teaching/model/vo/SchoolClassVo.java
mingt/sys-version
ccdc55f406a906caa6de36c7ab2b388cbdb168de
[ "Apache-2.0" ]
null
null
null
base-common/src/main/java/com/neoframework/biz/api/teaching/model/vo/SchoolClassVo.java
mingt/sys-version
ccdc55f406a906caa6de36c7ab2b388cbdb168de
[ "Apache-2.0" ]
null
null
null
18
71
0.548753
1,619
package com.neoframework.biz.api.teaching.model.vo; import com.neoframework.biz.api.common.vo.UserVo; import com.thinkgem.jeesite.modules.sys.entity.Office; import java.io.Serializable; /** * 用户机构信息表 VO. * * <p> * Created by think on 2017-10-30. * </p> */ public class SchoolClassVo implements Serializable { private static final long serialVersionUID = 1L; /** 用户信息 */ UserVo user; /** 学校信息 */ Office school; /** 班级信息 */ Office theClass; /** * Instantiates a new School class vo. */ public SchoolClassVo() {} /** * Instantiates a new School class vo. * * @param user the user * @param school the school * @param theClass the the class */ public SchoolClassVo(UserVo user, Office school, Office theClass) { this.user = user; this.school = school; this.theClass = theClass; } /** * Gets user. * * @return the user */ public UserVo getUser() { return user; } /** * Sets user. * * @param user the user */ public void setUser(UserVo user) { this.user = user; } /** * Gets school. * * @return the school */ public Office getSchool() { return school; } /** * Sets school. * * @param school the school */ public void setSchool(Office school) { this.school = school; } /** * Gets the class. * * @return the the class */ public Office getTheClass() { return theClass; } /** * Sets the class. * * @param theClass the the class */ public void setTheClass(Office theClass) { this.theClass = theClass; } }
3e03e64730238f54df8c290fc30d5faeab599855
4,128
java
Java
wmi-base/src/main/java/xyz/cofe/win/activex/SWbemSecurityImpl.java
gochaorg/wmi
3aea4397c358a5343257d0fa9f849c5e6c69251d
[ "MIT" ]
null
null
null
wmi-base/src/main/java/xyz/cofe/win/activex/SWbemSecurityImpl.java
gochaorg/wmi
3aea4397c358a5343257d0fa9f849c5e6c69251d
[ "MIT" ]
null
null
null
wmi-base/src/main/java/xyz/cofe/win/activex/SWbemSecurityImpl.java
gochaorg/wmi
3aea4397c358a5343257d0fa9f849c5e6c69251d
[ "MIT" ]
null
null
null
37.189189
94
0.673934
1,620
package xyz.cofe.win.activex; import com.jacob.activeX.ActiveXComponent; import com.jacob.com.Dispatch; import com.jacob.com.EnumVariant; import com.jacob.com.Variant; import java.util.ArrayList; import java.util.List; import java.util.function.Consumer; public class SWbemSecurityImpl implements SWbemSecurity { public SWbemSecurityImpl(){ } public SWbemSecurityImpl(ActiveXMethods ax){ if( ax==null )throw new IllegalArgumentException("ax==null"); init(ax); } protected void init(ActiveXMethods ax){ if( ax==null )throw new IllegalArgumentException("ax==null"); authenticationLevel = ax.getProperty("AuthenticationLevel").getInt(); impersonationLevel = ax.getProperty("ImpersonationLevel").getInt(); Variant vPrivileges = ax.getProperty("Privileges"); Dispatch dPrivileges = vPrivileges!=null && !vPrivileges.isNull() ? vPrivileges.toDispatch() : null; EnumVariant enPrivileges = dPrivileges!=null && dPrivileges.m_pDispatch!=0 ? new EnumVariant(dPrivileges) : null; List<SWbemPrivilege> privs = new ArrayList<>(); while( enPrivileges!=null && enPrivileges.hasMoreElements() ){ Variant evPrivilege = enPrivileges.nextElement(); //noinspection ConstantConditions Dispatch edPrivileges = enPrivileges!=null && !evPrivilege.isNull() ? evPrivilege.toDispatch() : null; ActiveXComponent axPrivilege = edPrivileges!=null && edPrivileges.m_pDispatch!=0 ? new ActiveXComponent(edPrivileges) : null; if( axPrivilege!=null ){ SWbemPrivilegeImpl priv = new SWbemPrivilegeImpl(axPrivilege); privs.add(priv); } } privileges = new SWbemPrivilegeSetImpl(privs); } public static SWbemSecurityImpl fromOwner(ActiveXComponent axOwner){ if( axOwner==null )throw new IllegalArgumentException("axOwner==null"); return fromOwner(ActiveXMethods.of(axOwner)); } public static SWbemSecurityImpl fromOwner(GetActiveXComponent axOwner){ if( axOwner==null )throw new IllegalArgumentException("axOwner==null"); return fromOwner(ActiveXMethods.of(axOwner.getActiveXComponent())); } public static SWbemSecurityImpl fromOwner(ActiveXMethods axOwner){ if( axOwner==null )throw new IllegalArgumentException("axOwner==null"); Variant vSecur = axOwner.getProperty("Security_"); Dispatch dSecur = vSecur!=null && !vSecur.isNull() ? vSecur.toDispatch() : null; ActiveXComponent ax = dSecur!=null && dSecur.m_pDispatch!=0 ? new ActiveXComponent(dSecur) : null; ActiveXMethods am = ax!=null ? ActiveXMethods.of(ax) : null; if( am==null ){ throw new RuntimeException("can't create SWbemSecurityImpl"); } SWbemSecurityImpl inst = new SWbemSecurityImpl(); inst.init(am); return inst; } //region configure() public SWbemSecurityImpl configure(Consumer<SWbemSecurityImpl> conf){ if( conf==null )throw new IllegalArgumentException("conf==null"); conf.accept(this); return this; } //endregion //region authenticationLevel protected int authenticationLevel; public int getAuthenticationLevel() { return authenticationLevel; } public void setAuthenticationLevel(int authenticationLevel) { this.authenticationLevel = authenticationLevel; } //endregion //region impersonationLevel protected int impersonationLevel; public int getImpersonationLevel() { return impersonationLevel; } public void setImpersonationLevel(int impersonationLevel) { this.impersonationLevel = impersonationLevel; } //endregion //region privileges protected SWbemPrivilegeSet privileges; public SWbemPrivilegeSet getPrivileges() { return privileges; } public void setPrivileges(SWbemPrivilegeSet privileges) { this.privileges = privileges; } //endregion }
3e03e732e79b67acc5e9c18c9781e6af40adf904
3,066
java
Java
consensus/poc-consensus/src/main/java/io/nuls/poc/storage/impl/AgentStorageServiceImpl.java
wangko27/nuls_2.0
09e95498909c01b85c07b604553eb6ed3577964f
[ "MIT" ]
1
2018-11-20T08:15:01.000Z
2018-11-20T08:15:01.000Z
consensus/poc-consensus/src/main/java/io/nuls/poc/storage/impl/AgentStorageServiceImpl.java
wangko27/nuls_2.0
09e95498909c01b85c07b604553eb6ed3577964f
[ "MIT" ]
null
null
null
consensus/poc-consensus/src/main/java/io/nuls/poc/storage/impl/AgentStorageServiceImpl.java
wangko27/nuls_2.0
09e95498909c01b85c07b604553eb6ed3577964f
[ "MIT" ]
1
2018-12-05T16:05:11.000Z
2018-12-05T16:05:11.000Z
29.480769
123
0.577299
1,621
package io.nuls.poc.storage.impl; import io.nuls.base.data.NulsDigestData; import io.nuls.db.model.Entry; import io.nuls.db.service.RocksDBService; import io.nuls.poc.constant.ConsensusConstant; import io.nuls.poc.model.po.AgentPo; import io.nuls.poc.storage.AgentStorageService; import io.nuls.tools.core.annotation.Service; import io.nuls.tools.log.Log; import java.util.ArrayList; import java.util.List; /** * 节点信息管理实现类 * Node Information Management Implementation Class * * @author tag * 2018/11/06 * */ @Service public class AgentStorageServiceImpl implements AgentStorageService{ @Override public boolean save(AgentPo agentPo,int chainID) { if(agentPo == null || agentPo.getHash() == null){ return false; } try { byte[] key = agentPo.getHash().serialize(); byte[] value = agentPo.serialize(); return RocksDBService.put(ConsensusConstant.DB_NAME_CONSENSUS_AGENT+chainID,key,value); }catch (Exception e){ Log.error(e); return false; } } @Override public AgentPo get(NulsDigestData hash,int chainID) { if(hash == null){ return null; } try { byte[] key = hash.serialize(); byte[] value = RocksDBService.get(ConsensusConstant.DB_NAME_CONSENSUS_AGENT+chainID,key); if(value == null){ return null; } AgentPo agentPo = new AgentPo(); agentPo.parse(value,0); agentPo.setHash(hash); return agentPo; }catch (Exception e){ Log.error(e); return null; } } @Override public boolean delete(NulsDigestData hash,int chainID) { if(hash == null){ return false; } try { byte[] key = hash.serialize(); return RocksDBService.delete(ConsensusConstant.DB_NAME_CONSENSUS_AGENT+chainID,key); }catch (Exception e){ Log.error(e); return false; } } @Override public List<AgentPo> getList(int chainID) throws Exception{ try { List<Entry<byte[], byte[]>> list = RocksDBService.entryList(ConsensusConstant.DB_NAME_CONSENSUS_AGENT+chainID); List<AgentPo> agentList = new ArrayList<>(); for (Entry<byte[], byte[]> entry:list) { AgentPo po = new AgentPo(); po.parse(entry.getValue(),0); NulsDigestData hash = new NulsDigestData(); hash.parse(entry.getKey(),0); po.setHash(hash); agentList.add(po); } return agentList; }catch (Exception e){ Log.error(e); throw e; } } @Override public int size(int chainID) { List<byte[]> keyList = RocksDBService.keyList(ConsensusConstant.DB_NAME_CONSENSUS_AGENT+chainID); if(keyList != null){ return keyList.size(); } return 0; } }
3e03e743f494c330752dc73bd6dfe047664fa33f
612
java
Java
refresh-header/src/main/java/com/scwang/smartrefresh/header/PhoenixHeader.java
bamboolife/SmartRefreshLayout
8e644db475acbe593fa689ccb19a01976493e8e9
[ "Apache-2.0" ]
25,355
2017-06-27T09:40:16.000Z
2022-03-31T10:55:57.000Z
refresh-header/src/main/java/com/scwang/smartrefresh/header/PhoenixHeader.java
Pillow520/SmartRefreshLayout
f094d87ce10858f9c37fa80deec8e09d26771d88
[ "Apache-2.0" ]
1,426
2017-06-20T02:56:49.000Z
2022-03-25T09:15:34.000Z
refresh-header/src/main/java/com/scwang/smartrefresh/header/PhoenixHeader.java
Pillow520/SmartRefreshLayout
f094d87ce10858f9c37fa80deec8e09d26771d88
[ "Apache-2.0" ]
5,268
2017-07-06T04:15:49.000Z
2022-03-31T07:46:11.000Z
21.857143
107
0.718954
1,622
package com.scwang.smartrefresh.header; import android.content.Context; import android.util.AttributeSet; import com.scwang.smartrefresh.layout.api.RefreshHeader; /** * Phoenix * Created by scwang on 2017/5/31. * from https://github.com/Yalantis/Phoenix */ public class PhoenixHeader extends com.scwang.smart.refresh.header.PhoenixHeader implements RefreshHeader { //<editor-fold desc="View"> public PhoenixHeader(Context context) { this(context, null); } public PhoenixHeader(Context context, AttributeSet attrs) { super(context, attrs); } //</editor-fold> }
3e03e79c597dc8baa3d3c8cd2c08d2dd0e0bfe08
235
java
Java
nakadi-producer/src/main/java/org/zalando/nakadiproducer/snapshots/Snapshot.java
johannesknauft/nakadi-producer-spring-boot-starter
22b9ba2675193e7d5838eac19487b4fc2ab84ba4
[ "MIT" ]
8
2017-07-18T07:56:36.000Z
2022-01-21T20:57:05.000Z
nakadi-producer/src/main/java/org/zalando/nakadiproducer/snapshots/Snapshot.java
johannesknauft/nakadi-producer-spring-boot-starter
22b9ba2675193e7d5838eac19487b4fc2ab84ba4
[ "MIT" ]
96
2017-07-07T14:56:52.000Z
2022-02-16T10:02:40.000Z
nakadi-producer/src/main/java/org/zalando/nakadiproducer/snapshots/Snapshot.java
johannesknauft/nakadi-producer-spring-boot-starter
22b9ba2675193e7d5838eac19487b4fc2ab84ba4
[ "MIT" ]
2
2019-03-14T08:15:39.000Z
2019-05-20T10:56:44.000Z
18.076923
45
0.782979
1,623
package org.zalando.nakadiproducer.snapshots; import lombok.AllArgsConstructor; import lombok.Getter; @AllArgsConstructor @Getter public class Snapshot { private Object id; private String dataType; private Object data; }
3e03e7af351e4d91cd0ba975d99694ed911d9227
314
java
Java
java_base/src/main/java/com/zhao/java_base/ThreadTest/ThreadMain1.java
Jackszhao/practice
fd8b1e25fccc54eec722e45a069beebddb1c0545
[ "Apache-2.0" ]
null
null
null
java_base/src/main/java/com/zhao/java_base/ThreadTest/ThreadMain1.java
Jackszhao/practice
fd8b1e25fccc54eec722e45a069beebddb1c0545
[ "Apache-2.0" ]
null
null
null
java_base/src/main/java/com/zhao/java_base/ThreadTest/ThreadMain1.java
Jackszhao/practice
fd8b1e25fccc54eec722e45a069beebddb1c0545
[ "Apache-2.0" ]
null
null
null
24.153846
44
0.601911
1,624
package com.zhao.java_base.ThreadTest; public class ThreadMain1 { public static void main(String[] args) { Thread turtle = new ThreadDemo1(); Thread rabbit = new ThreadDemo1(); turtle.setName("乌龟"); rabbit.setName("兔子"); turtle.start(); rabbit.start(); } }
3e03e9d3b928a4e417f8b8a1a5ae4a15b4eca65f
1,214
java
Java
imsdk/src/main/java/com/qunar/im/ui/schema/QOpenDomainSearchImpl.java
froyomu/imsdk-android
a800f75dc6653eeb932346f6c083f1c547ebd876
[ "MIT" ]
1
2019-10-17T03:05:44.000Z
2019-10-17T03:05:44.000Z
imsdk/src/main/java/com/qunar/im/ui/schema/QOpenDomainSearchImpl.java
yzxIOS/imsdk-android
222802136c78a1eb119abb80a45d7374628421a5
[ "MIT" ]
null
null
null
imsdk/src/main/java/com/qunar/im/ui/schema/QOpenDomainSearchImpl.java
yzxIOS/imsdk-android
222802136c78a1eb119abb80a45d7374628421a5
[ "MIT" ]
null
null
null
30.35
120
0.746293
1,625
package com.qunar.im.ui.schema; import android.content.Intent; import com.qunar.im.base.util.Constants; import com.qunar.im.core.services.QtalkNavicationService; import com.qunar.im.ui.activity.IMBaseActivity; import com.qunar.rn_service.activity.QtalkServiceRNActivity; import java.util.Map; /** * Created by froyomu on 2019/5/7 * <p> * Describe: */ public class QOpenDomainSearchImpl implements QChatSchemaService{ private QOpenDomainSearchImpl(){ } @Override public boolean startActivityAndNeedWating(IMBaseActivity context, Map<String, String> map) { Intent intent = new Intent(context, QtalkServiceRNActivity.class); intent.putExtra("module", QtalkServiceRNActivity.CONTACTS); intent.putExtra("Screen", "Search"); intent.putExtra(Constants.BundleKey.DOMAIN_LIST_URL, QtalkNavicationService.getInstance().getDomainSearchUrl()); context.startActivity(intent); return false; } private static class LazyHolder{ private static final QOpenDomainSearchImpl INSTANCE = new QOpenDomainSearchImpl(); } public static QOpenDomainSearchImpl getInstance(){ return QOpenDomainSearchImpl.LazyHolder.INSTANCE; } }
3e03ea5ab957cb54337ac8cc8d70e49064f698da
2,641
java
Java
modules/yardstick/src/main/java/org/apache/ignite/yardstick/upload/StreamerParams.java
DirectXceriD/gridgain
093e512a9147e266f83f6fe1cf088c0b037b501c
[ "Apache-2.0", "CC0-1.0" ]
1
2019-03-11T08:52:37.000Z
2019-03-11T08:52:37.000Z
modules/yardstick/src/main/java/org/apache/ignite/yardstick/upload/StreamerParams.java
DirectXceriD/gridgain
093e512a9147e266f83f6fe1cf088c0b037b501c
[ "Apache-2.0", "CC0-1.0" ]
null
null
null
modules/yardstick/src/main/java/org/apache/ignite/yardstick/upload/StreamerParams.java
DirectXceriD/gridgain
093e512a9147e266f83f6fe1cf088c0b037b501c
[ "Apache-2.0", "CC0-1.0" ]
null
null
null
38.838235
101
0.72624
1,626
/* * GridGain Community Edition Licensing * Copyright 2019 GridGain Systems, Inc. * * Licensed under the Apache License, Version 2.0 (the "License") modified with Commons Clause * Restriction; 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. * * Commons Clause Restriction * * The Software is provided to you by the Licensor under the License, as defined below, subject to * the following condition. * * Without limiting other conditions in the License, the grant of rights under the License will not * include, and the License does not grant to you, the right to Sell the Software. * For purposes of the foregoing, “Sell” means practicing any or all of the rights granted to you * under the License to provide to third parties, for a fee or other consideration (including without * limitation fees for hosting or consulting/ support services related to the Software), a product or * service whose value derives, entirely or substantially, from the functionality of the Software. * Any license notice or attribution required by the License must also include this Commons Clause * License Condition notice. * * For purposes of the clause above, the “Licensor” is Copyright 2019 GridGain Systems, Inc., * the “License” is the Apache License, Version 2.0, and the Software is the GridGain Community * Edition software provided with this notice. */ package org.apache.ignite.yardstick.upload; import org.jetbrains.annotations.Nullable; /** * Holds parameters to tweak streamer in upload benchmarks. * If any method returns <code>null</code>, no parameter passed to streamer. */ public interface StreamerParams { /** * @return Per-node buffer size. */ @Nullable public Integer streamerPerNodeBufferSize(); /** * @return Per-node parallel operations. */ @Nullable public Integer streamerPerNodeParallelOperations(); /** * @return Local batch size. */ @Nullable public Integer streamerLocalBatchSize(); /** * @return Allow overwrite flag. */ @Nullable public Boolean streamerAllowOverwrite(); /** * @return Ordered flag. */ public boolean streamerOrdered(); }
3e03ead13556eb8033542de924094260d2e0655d
3,101
java
Java
Chapter17_kiv/ATMGui/ATMFrame.java
freakygeeks/BigJavaCodeSolution
ed02f808cf61a1bf0f3af8bd5fb891d10229e3f3
[ "MIT" ]
3
2020-02-22T02:19:36.000Z
2021-07-26T06:06:52.000Z
Chapter17_kiv/ATMGui/ATMFrame.java
freakygeeks/BigJavaCodeSolution
ed02f808cf61a1bf0f3af8bd5fb891d10229e3f3
[ "MIT" ]
null
null
null
Chapter17_kiv/ATMGui/ATMFrame.java
freakygeeks/BigJavaCodeSolution
ed02f808cf61a1bf0f3af8bd5fb891d10229e3f3
[ "MIT" ]
null
null
null
17.227778
141
0.64979
1,627
//Chapter 17 - Example 17.5 import java.awt.FlowLayout; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTextArea; public class ATMFrame extends JFrame { private JButton aButton; private JButton bButton; private JButton cButton; private KeyPad pad; private JTextArea display; private ATM theATM; private static final int WIDTH = 300; private static final int HEIGHT = 400; //frame display components of ATM public ATMFrame(ATM anATM) { theATM = anATM; pad = new KeyPad(); display = new JTextArea(4, 20); aButton = new JButton(" A "); aButton.addActionListener(new aButtonListener()); bButton = new JButton (" B "); bButton.addActionListener(new bButtonListener()); cButton = new JButton(" C "); cButton.addActionListener(new cButtonListener()); //add components JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new GridLayout(3, 1)); buttonPanel.add(aButton); buttonPanel.add(bButton); buttonPanel.add(cButton); setLayout(new FlowLayout()); add(pad); add(display); add(buttonPanel); showState(); setSize(WIDTH, HEIGHT); } //updates display message public void showState() { int state = theATM.getState(); pad.clear(); if (state == ATM.START) { display.setText("Enter customer number\nA = OK"); } else if (state == ATM.PIN) { display.setText("Enter PIN\nA = OK"); } else if (state == ATM.ACCOUNT) { display.setText("Select account\n" + "A = Checking\nB = Savings\nC = Exit"); } else if (state == ATM.TRANSACT) { display.setText("Balance = " + theATM.getBalance() + "\nEnter amount and select transaction\n" + "A = Withdraw\nB = Deposit\nC = Cancel"); } } private class aButtonListener implements ActionListener { public void actionPerformed (ActionEvent event) { int state = theATM.getState(); if (state == ATM.START) { theATM.setCustomerNumber((int)pad.getValue()); } else if (state == ATM.PIN) { theATM.selectCustomer((int)pad.getValue()); } else if (state == ATM.ACCOUNT) { theATM.selectAccount(ATM.CHECKING); } else if (state == ATM.TRANSACT) { theATM.withdraw(pad.getValue()); theATM.back(); } showState(); } } private class bButtonListener implements ActionListener { public void actionPerformed(ActionEvent event) { int state = theATM.getState(); if (state == ATM.ACCOUNT) { theATM.selectAccount(ATM.SAVINGS); } else if (state == ATM.TRANSACT) { theATM.deposit(pad.getValue()); theATM.back(); } showState(); } } private class cButtonListener implements ActionListener { public void actionPerformed(ActionEvent event) { int state = theATM.getState(); if (state == ATM.ACCOUNT) { theATM.reset(); } else if (state == ATM.TRANSACT) { theATM.back(); } showState(); } } }
3e03eb011f6f25cb60b97f5a6c80ea36e90df560
417
java
Java
SPC/SPC_Base/src/main/java/frc/robot/RobotContainer.java
GokhanTkr/SP_PID_Control
a41ee1a4ce1bc4bc7ec3902ede9311643a9851b9
[ "MIT" ]
null
null
null
SPC/SPC_Base/src/main/java/frc/robot/RobotContainer.java
GokhanTkr/SP_PID_Control
a41ee1a4ce1bc4bc7ec3902ede9311643a9851b9
[ "MIT" ]
null
null
null
SPC/SPC_Base/src/main/java/frc/robot/RobotContainer.java
GokhanTkr/SP_PID_Control
a41ee1a4ce1bc4bc7ec3902ede9311643a9851b9
[ "MIT" ]
null
null
null
14.892857
46
0.709832
1,628
package frc.robot; import edu.wpi.first.wpilibj2.command.Command; import frc.robot.commands.SPCCommand; public class RobotContainer { SPCCommand SPCCommand = new SPCCommand(); public RobotContainer() { // Configure the button bindings configureButtonBindings(); } private void configureButtonBindings() { } public Command getAutonomousCommand(){ return SPCCommand; } }
3e03eb27561b24f203ae771d6aa6e704d71dc7de
6,035
java
Java
src/main/java/com/kalessil/phpStorm/phpInspectionsEA/inspectors/semanticalAnalysis/ClassReImplementsParentInterfaceInspector.java
angyvolin/phpinspectionsea
1043ee6f03917f8b95802f338f6f0ece917c36af
[ "MIT" ]
null
null
null
src/main/java/com/kalessil/phpStorm/phpInspectionsEA/inspectors/semanticalAnalysis/ClassReImplementsParentInterfaceInspector.java
angyvolin/phpinspectionsea
1043ee6f03917f8b95802f338f6f0ece917c36af
[ "MIT" ]
null
null
null
src/main/java/com/kalessil/phpStorm/phpInspectionsEA/inspectors/semanticalAnalysis/ClassReImplementsParentInterfaceInspector.java
angyvolin/phpinspectionsea
1043ee6f03917f8b95802f338f6f0ece917c36af
[ "MIT" ]
1
2020-10-07T09:18:04.000Z
2020-10-07T09:18:04.000Z
49.065041
146
0.5715
1,629
package com.kalessil.phpStorm.phpInspectionsEA.inspectors.semanticalAnalysis; import com.intellij.codeInspection.LocalQuickFix; import com.intellij.codeInspection.ProblemDescriptor; import com.intellij.codeInspection.ProblemHighlightType; import com.intellij.codeInspection.ProblemsHolder; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiElementVisitor; import com.intellij.psi.PsiWhiteSpace; import com.jetbrains.php.lang.psi.elements.ClassReference; import com.jetbrains.php.lang.psi.elements.ImplementsList; import com.jetbrains.php.lang.psi.elements.PhpClass; import com.kalessil.phpStorm.phpInspectionsEA.openApi.BasePhpElementVisitor; import com.kalessil.phpStorm.phpInspectionsEA.openApi.BasePhpInspection; import org.jetbrains.annotations.NotNull; import java.util.List; public class ClassReImplementsParentInterfaceInspector extends BasePhpInspection { private static final String messagePattern = "%i% is already announced in %c%."; @NotNull public String getShortName() { return "ClassReImplementsParentInterfaceInspection"; } @Override @NotNull public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) { return new BasePhpElementVisitor() { public void visitPhpClass(PhpClass clazz) { /* skip classes which we cannot report */ final PsiElement classNameNode = clazz.getNameIdentifier(); if (null == classNameNode) { return; } /* check if parent class and own implements are available */ final List<ClassReference> listImplements = clazz.getImplementsList().getReferenceElements(); if (listImplements.size() > 0) { for (PhpClass objParentClass : clazz.getSupers()) { /* do not process parent interfaces */ if (objParentClass.isInterface()) { continue; } /* ensure implements some interfaces and discoverable properly */ final List<ClassReference> listImplementsParents = objParentClass.getImplementsList().getReferenceElements(); if (listImplementsParents.size() > 0) { /* check interfaces of a parent class */ final String parentClassFQN = objParentClass.getFQN(); for (ClassReference parentInterfaceRef : listImplementsParents) { /* ensure we have all identities valid, or skip analyzing */ final String parentInterfaceFQN = parentInterfaceRef.getFQN(); final String parentInterfaceName = parentInterfaceRef.getName(); if (StringUtil.isEmpty(parentInterfaceFQN) || StringUtil.isEmpty(parentInterfaceName)) { continue; } /* match parents interfaces against class we checking */ for (ClassReference ownInterface : listImplements) { /* ensure FQNs matches */ final String ownInterfaceFQN = ownInterface.getFQN(); if (!StringUtil.isEmpty(ownInterfaceFQN) && ownInterfaceFQN.equals(parentInterfaceFQN)) { final String message = messagePattern .replace("%i%", parentInterfaceName) .replace("%c%", parentClassFQN); holder.registerProblem(ownInterface, message, ProblemHighlightType.LIKE_UNUSED_SYMBOL, new TheLocalFix()); break; } } } listImplementsParents.clear(); } } listImplements.clear(); } } }; } private static class TheLocalFix implements LocalQuickFix { @NotNull @Override public String getName() { return "Remove unnecessary implements entry"; } @NotNull @Override public String getFamilyName() { return getName(); } @Override public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) { final PsiElement expression = descriptor.getPsiElement(); if (expression.getParent() instanceof ImplementsList) { final ImplementsList implementsList = (ImplementsList) expression.getParent(); if (1 == implementsList.getReferenceElements().size()) { /* drop implements section completely; implementsList.delete() breaks further SCA */ expression.delete(); // <- interface implementsList.getFirstChild().delete(); // <- implements keyword } else { final boolean cleanupLeftHand = implementsList.getReferenceElements().get(0) != expression; PsiElement commaCandidate = cleanupLeftHand ? expression.getPrevSibling() : expression.getNextSibling(); if (commaCandidate instanceof PsiWhiteSpace) { commaCandidate = cleanupLeftHand ? commaCandidate.getPrevSibling() : commaCandidate.getNextSibling(); } /* drop single implements entry from the list */ expression.delete(); commaCandidate.delete(); } } } } }
3e03eca21f8345ea690defc0db55e2f9283db276
409
java
Java
src/ch/ethz/mc/model/rest/VariableAverageWithParticipant.java
schlegel11/MobileCoach
caedd1816c9536bceac4d3874cc53f1b20ed96a1
[ "Apache-2.0", "BSD-3-Clause" ]
6
2019-08-31T17:51:42.000Z
2022-03-15T14:19:45.000Z
src/ch/ethz/mc/model/rest/VariableAverageWithParticipant.java
schlegel11/MobileCoach
caedd1816c9536bceac4d3874cc53f1b20ed96a1
[ "Apache-2.0", "BSD-3-Clause" ]
null
null
null
src/ch/ethz/mc/model/rest/VariableAverageWithParticipant.java
schlegel11/MobileCoach
caedd1816c9536bceac4d3874cc53f1b20ed96a1
[ "Apache-2.0", "BSD-3-Clause" ]
null
null
null
15.730769
49
0.733496
1,630
package ch.ethz.mc.model.rest; /* ##LICENSE## */ import lombok.Getter; import lombok.Setter; /** * Wrapper for the average of variables with REST * * @author Andreas Filler */ public class VariableAverageWithParticipant { @Getter @Setter private String variable; @Getter @Setter private double average; @Getter @Setter private int size; @Getter @Setter private double valueOfParticipant; }
3e03ed420187a0ff78c51bac41f0614b5df92898
4,853
java
Java
services/src/main/java/org/keycloak/protocol/saml/SamlProtocolUtils.java
howcroft/keycloak
fae05c1cc5fd17bc8e47984e2aa9f964e5516b38
[ "Apache-2.0" ]
null
null
null
services/src/main/java/org/keycloak/protocol/saml/SamlProtocolUtils.java
howcroft/keycloak
fae05c1cc5fd17bc8e47984e2aa9f964e5516b38
[ "Apache-2.0" ]
null
null
null
services/src/main/java/org/keycloak/protocol/saml/SamlProtocolUtils.java
howcroft/keycloak
fae05c1cc5fd17bc8e47984e2aa9f964e5516b38
[ "Apache-2.0" ]
null
null
null
43.756757
139
0.722668
1,631
package org.keycloak.protocol.saml; import org.keycloak.common.VerificationException; import org.keycloak.models.ClientModel; import org.keycloak.saml.SignatureAlgorithm; import org.keycloak.saml.common.constants.GeneralConstants; import org.keycloak.saml.common.exceptions.ProcessingException; import org.keycloak.saml.processing.api.saml.v2.sig.SAML2Signature; import org.keycloak.saml.processing.web.util.RedirectBindingUtil; import org.keycloak.common.util.PemUtils; import org.w3c.dom.Document; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.UriBuilder; import javax.ws.rs.core.UriInfo; import java.security.PublicKey; import java.security.Signature; import java.security.cert.Certificate; /** * @author <a href="mailto:[email protected]">Bill Burke</a> * @version $Revision: 1 $ */ public class SamlProtocolUtils { public static void verifyDocumentSignature(ClientModel client, Document document) throws VerificationException { SamlClient samlClient = new SamlClient(client); if (!samlClient.requiresClientSignature()) { return; } PublicKey publicKey = getSignatureValidationKey(client); verifyDocumentSignature(document, publicKey); } public static void verifyDocumentSignature(Document document, PublicKey publicKey) throws VerificationException { SAML2Signature saml2Signature = new SAML2Signature(); try { if (!saml2Signature.validate(document, publicKey)) { throw new VerificationException("Invalid signature on document"); } } catch (ProcessingException e) { throw new VerificationException("Error validating signature", e); } } public static PublicKey getSignatureValidationKey(ClientModel client) throws VerificationException { return getPublicKey(new SamlClient(client).getClientSigningCertificate()); } public static PublicKey getEncryptionValidationKey(ClientModel client) throws VerificationException { return getPublicKey(client, SamlConfigAttributes.SAML_ENCRYPTION_CERTIFICATE_ATTRIBUTE); } public static PublicKey getPublicKey(ClientModel client, String attribute) throws VerificationException { String certPem = client.getAttribute(attribute); return getPublicKey(certPem); } private static PublicKey getPublicKey(String certPem) throws VerificationException { if (certPem == null) throw new VerificationException("Client does not have a public key."); Certificate cert = null; try { cert = PemUtils.decodeCertificate(certPem); } catch (Exception e) { throw new VerificationException("Could not decode cert", e); } return cert.getPublicKey(); } public static void verifyRedirectSignature(PublicKey publicKey, UriInfo uriInformation, String paramKey) throws VerificationException { MultivaluedMap<String, String> encodedParams = uriInformation.getQueryParameters(false); String request = encodedParams.getFirst(paramKey); String algorithm = encodedParams.getFirst(GeneralConstants.SAML_SIG_ALG_REQUEST_KEY); String signature = encodedParams.getFirst(GeneralConstants.SAML_SIGNATURE_REQUEST_KEY); String decodedAlgorithm = uriInformation.getQueryParameters(true).getFirst(GeneralConstants.SAML_SIG_ALG_REQUEST_KEY); if (request == null) throw new VerificationException("SAM was null"); if (algorithm == null) throw new VerificationException("SigAlg was null"); if (signature == null) throw new VerificationException("Signature was null"); // Shibboleth doesn't sign the document for redirect binding. // todo maybe a flag? UriBuilder builder = UriBuilder.fromPath("/") .queryParam(paramKey, request); if (encodedParams.containsKey(GeneralConstants.RELAY_STATE)) { builder.queryParam(GeneralConstants.RELAY_STATE, encodedParams.getFirst(GeneralConstants.RELAY_STATE)); } builder.queryParam(GeneralConstants.SAML_SIG_ALG_REQUEST_KEY, algorithm); String rawQuery = builder.build().getRawQuery(); try { byte[] decodedSignature = RedirectBindingUtil.urlBase64Decode(signature); SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.getFromXmlMethod(decodedAlgorithm); Signature validator = signatureAlgorithm.createSignature(); // todo plugin signature alg validator.initVerify(publicKey); validator.update(rawQuery.getBytes("UTF-8")); if (!validator.verify(decodedSignature)) { throw new VerificationException("Invalid query param signature"); } } catch (Exception e) { throw new VerificationException(e); } } }
3e03ed9546b58b3aaa910369ca3bc51babfe4c43
836
java
Java
app/src/main/java/com/guluweather/android/db/City.java
runningman725/coolweather
1faaf24e4c92d40ac80d2872898f411870aba4e7
[ "Apache-2.0" ]
1
2017-08-04T10:40:07.000Z
2017-08-04T10:40:07.000Z
app/src/main/java/com/guluweather/android/db/City.java
runningman725/coolweather
1faaf24e4c92d40ac80d2872898f411870aba4e7
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/guluweather/android/db/City.java
runningman725/coolweather
1faaf24e4c92d40ac80d2872898f411870aba4e7
[ "Apache-2.0" ]
null
null
null
17.787234
47
0.613636
1,632
package com.guluweather.android.db; import org.litepal.crud.DataSupport; /** * Created by Admin on 2017/8/1. */ public class City extends DataSupport { private int id; private String cityName; private int cityCode; private int provinceId; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getCityName() { return cityName; } public void setCityName(String cityName) { this.cityName = cityName; } public int getCityCode() { return cityCode; } public void setCityCode(int cityCode) { this.cityCode = cityCode; } public int getProvinceId() { return provinceId; } public void setProvinceId(int provinceId) { this.provinceId = provinceId; } }
3e03edb6536025cb588b302a4417c8e3432f6f06
703
java
Java
0-Java/JavaThread/src/main/java/cn/ervin/test/Test6.java
YizheZhang-Ervin/TMPL_Nginx_Webpack
14f1f98a54d4cc1079962ca398ab46e924eef980
[ "MIT" ]
1
2021-11-06T15:29:08.000Z
2021-11-06T15:29:08.000Z
0-Java/JavaThread/src/main/java/cn/ervin/test/Test6.java
YizheZhang-Ervin/BackEnd_Spring
14f1f98a54d4cc1079962ca398ab46e924eef980
[ "MIT" ]
null
null
null
0-Java/JavaThread/src/main/java/cn/ervin/test/Test6.java
YizheZhang-Ervin/BackEnd_Spring
14f1f98a54d4cc1079962ca398ab46e924eef980
[ "MIT" ]
null
null
null
22.677419
50
0.460882
1,633
package cn.ervin.test; import lombok.extern.slf4j.Slf4j; @Slf4j(topic = "c.Test6") public class Test6 { public static void main(String[] args) { Thread t1 = new Thread("t1") { @Override public void run() { try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } } }; t1.start(); log.debug("t1 state: {}", t1.getState()); try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } log.debug("t1 state: {}", t1.getState()); } }
3e03ee447c56db5bba2d42f91eabee063dd1ec72
272
java
Java
services/rest/src/main/java/mil/nga/giat/geowave/service/rest/field/RestFieldValue.java
cjw5db/geowave
3cf39ecb94263f60021641bc91f95f9a9d9c3c16
[ "Apache-2.0" ]
null
null
null
services/rest/src/main/java/mil/nga/giat/geowave/service/rest/field/RestFieldValue.java
cjw5db/geowave
3cf39ecb94263f60021641bc91f95f9a9d9c3c16
[ "Apache-2.0" ]
null
null
null
services/rest/src/main/java/mil/nga/giat/geowave/service/rest/field/RestFieldValue.java
cjw5db/geowave
3cf39ecb94263f60021641bc91f95f9a9d9c3c16
[ "Apache-2.0" ]
null
null
null
18.133333
48
0.764706
1,634
package mil.nga.giat.geowave.service.rest.field; import java.lang.reflect.Field; public interface RestFieldValue<T> extends RestField<T> { public void setValue( T value ) throws IllegalArgumentException, IllegalAccessException; public Field getField(); }
3e03ee7caa53113d4b06a623563995bbeed4cb37
478
java
Java
gulimall-order/src/main/java/com/atguigu/gulimall/order/service/OrderReturnReasonService.java
lphx/gulimall
0b4a0ea4ac78cc950428d0b5994b5cf3dbd00ad1
[ "Apache-2.0" ]
null
null
null
gulimall-order/src/main/java/com/atguigu/gulimall/order/service/OrderReturnReasonService.java
lphx/gulimall
0b4a0ea4ac78cc950428d0b5994b5cf3dbd00ad1
[ "Apache-2.0" ]
null
null
null
gulimall-order/src/main/java/com/atguigu/gulimall/order/service/OrderReturnReasonService.java
lphx/gulimall
0b4a0ea4ac78cc950428d0b5994b5cf3dbd00ad1
[ "Apache-2.0" ]
null
null
null
22.761905
85
0.780335
1,635
package com.atguigu.gulimall.order.service; import com.baomidou.mybatisplus.extension.service.IService; import com.atguigu.common.util.PageUtils; import com.atguigu.gulimall.order.entity.OrderReturnReasonEntity; import java.util.Map; /** * 退货原因 * * @author lipenghong * @email [email protected] * @date 2020-08-17 22:05:10 */ public interface OrderReturnReasonService extends IService<OrderReturnReasonEntity> { PageUtils queryPage(Map<String, Object> params); }
3e03ef078fd90595c4668ec862324ed6ee3e1136
1,732
java
Java
demosrc/graph/apps/TopologicalSortDemo.java
dkapil/datastructures
172b1d235dce7358731e31b14e516015d63aa13a
[ "MIT" ]
null
null
null
demosrc/graph/apps/TopologicalSortDemo.java
dkapil/datastructures
172b1d235dce7358731e31b14e516015d63aa13a
[ "MIT" ]
null
null
null
demosrc/graph/apps/TopologicalSortDemo.java
dkapil/datastructures
172b1d235dce7358731e31b14e516015d63aa13a
[ "MIT" ]
null
null
null
28.393443
110
0.646651
1,636
package graph.apps; import java.util.Arrays; import graph.models.Graph; import graph.models.GraphList; import graph.models.Vertex; // TODO: Auto-generated Javadoc /** * The Class TopologicalSortRunner. */ public class TopologicalSortDemo { /** * The main method. * * @param args * the arguments */ public static void main(String[] args) { Graph<String, Integer> graph = new GraphList<>(); Vertex<String> shirt = new Vertex<>(1, "shirt"); Vertex<String> tie = new Vertex<>(2, "tie"); Vertex<String> jacket = new Vertex<>(3, "jacket"); Vertex<String> belt = new Vertex<>(4, "belt"); Vertex<String> watch = new Vertex<>(5, "watch"); Vertex<String> undershorts = new Vertex<>(6, "undershorts"); Vertex<String> pants = new Vertex<>(7, "pants"); Vertex<String> shoes = new Vertex<>(8, "shoes"); Vertex<String> socks = new Vertex<>(9, "socks"); graph.initialize(Arrays.asList(shirt, tie, jacket, belt, watch, undershorts, pants, shoes, socks)); graph.addEdge(shirt, tie).addEdge(tie, jacket).addEdge(shirt, belt).addEdge(belt, jacket); graph.addEdge(undershorts, pants).addEdge(pants, belt).addEdge(pants, shoes).addEdge(undershorts, shoes); graph.addEdge(socks, shoes); graph.print(); TopologicalSort<String> dfs = new TopologicalSort<>(graph); for (Vertex<String> vertex : graph.getAllVertices()) { System.out.println(vertex.getValue() + "-" + vertex.getDiscoveredTime() + "-" + vertex.getFinishedTime()); } for (Vertex<String> vertex : dfs.getSortedVertices()) { System.out .print(vertex.getValue() + "-" + vertex.getDiscoveredTime() + "-" + vertex.getFinishedTime() + ","); } } }
3e03ef3c201a8a055d4f333f8411c842d72516b9
1,866
java
Java
src/com/github/btrekkie/reductions/planar/test/TestCrossoverGadget.java
btrekkie/reductions
b4e81a8f8fba11bdd3868dfba4e273e39675d60d
[ "MIT" ]
null
null
null
src/com/github/btrekkie/reductions/planar/test/TestCrossoverGadget.java
btrekkie/reductions
b4e81a8f8fba11bdd3868dfba4e273e39675d60d
[ "MIT" ]
null
null
null
src/com/github/btrekkie/reductions/planar/test/TestCrossoverGadget.java
btrekkie/reductions
b4e81a8f8fba11bdd3868dfba4e273e39675d60d
[ "MIT" ]
null
null
null
35.884615
120
0.728832
1,637
package com.github.btrekkie.reductions.planar.test; import java.util.Arrays; import java.util.List; import com.github.btrekkie.reductions.planar.IPlanarGadget; import com.github.btrekkie.reductions.planar.Point; /** A test gadget for I3SatPlanarGadgetFactory.createCrossover(). See the comments for that method. */ class TestCrossoverGadget implements IPlanarGadget { /** * The index of one of the entry ports - corresponding to EXIT_PORT1 and immediately counterclockwise from * ENTRY_PORT2 - as in I3SatPlanarGadgetFactory.firstCrossoverEntryPort or * I3SatPlanarGadgetFactory.secondCrossoverEntryPort. */ public static final int ENTRY_PORT1 = 0; /** * The index of one of the exit ports - corresponding to ENTRY_PORT1 and immediately counterclockwise from * EXIT_PORT2 - as in I3SatPlanarGadgetFactory.firstCrossoverExitPort or * I3SatPlanarGadgetFactory.secondCrossoverExitPort. */ public static final int EXIT_PORT1 = 2; /** * The index of one of the entry ports - corresponding to EXIT_PORT2 and immediately clockwise from ENTRY_PORT1 - as * in I3SatPlanarGadgetFactory.firstCrossoverEntryPort or I3SatPlanarGadgetFactory.secondCrossoverEntryPort. */ public static final int ENTRY_PORT2 = 1; /** * The index of one of the exit ports - corresponding to ENTRY_PORT2 and immediately clockwise from EXIT_PORT1 - as * in I3SatPlanarGadgetFactory.firstCrossoverExitPort or I3SatPlanarGadgetFactory.secondCrossoverExitPort. */ public static final int EXIT_PORT2 = 3; @Override public int width() { return 20; } @Override public int height() { return 20; } @Override public List<Point> ports() { return Arrays.asList(new Point(0, 10), new Point(10, 0), new Point(20, 10), new Point(10, 20)); } }
3e03ef70a982ddc7e8ef9b3fe1f89eb9b5f2de31
2,497
java
Java
app/src/main/java/com/droidyue/translate/core/Translator.java
androidyue/Akoi-Translator
16f8cb08e96f6ba570a85cc2f3f3ea77288e0120
[ "MIT" ]
52
2016-02-20T03:01:28.000Z
2021-05-30T04:12:28.000Z
app/src/main/java/com/droidyue/translate/core/Translator.java
ShirkerXuqing/Akoi-Translator
16f8cb08e96f6ba570a85cc2f3f3ea77288e0120
[ "MIT" ]
null
null
null
app/src/main/java/com/droidyue/translate/core/Translator.java
ShirkerXuqing/Akoi-Translator
16f8cb08e96f6ba570a85cc2f3f3ea77288e0120
[ "MIT" ]
20
2016-03-16T11:10:35.000Z
2021-05-30T04:12:32.000Z
28.375
116
0.75811
1,638
package com.droidyue.translate.core; import java.lang.ref.SoftReference; import java.util.WeakHashMap; import java.util.concurrent.ConcurrentHashMap; import android.os.Handler; import android.os.Message; import com.droidyue.translate.core.TranslateModels.OnTranslatedListener; import com.droidyue.translate.core.TranslateModels.TranslateRequest; import com.droidyue.translate.core.TranslateModels.TranslateResult; public abstract class Translator { private static final int MSG_ON_TRANSLATE_RESULT = 0; private final Object mWeakHashMapContent = new Object(); private final WeakHashMap<OnTranslatedListener,Object> mListener = new WeakHashMap<OnTranslatedListener,Object>(); private final ConcurrentHashMap<TranslateRequest, SoftReference<TranslateResult>> mCachedDict = new ConcurrentHashMap<TranslateRequest, SoftReference<TranslateResult>>(); private Handler mHandler = new Handler() { @Override public void handleMessage(Message msg) { if (shouldHandleMessage(msg)) { return; } if (MSG_ON_TRANSLATE_RESULT == msg.what) { for (OnTranslatedListener listener : mListener.keySet()) { if (null != listener) { listener.OnTranslateResult((TranslateResult)msg.obj); } } } } }; /** * This method does not run on UI Thread */ protected abstract TranslateResult doTranslateBackground(final TranslateRequest request); public abstract boolean isTargetLanguageSupport(String languageCode); protected boolean shouldHandleMessage(final Message msg) { return false; } public final Handler getHandler() { return mHandler; } public final void startTranslate(final TranslateRequest request) { new Thread() { @Override public void run() { TranslateResult result = getResultFromCache(request); if (null == result) { result = doTranslateBackground(request); } mHandler.sendMessage(mHandler.obtainMessage(MSG_ON_TRANSLATE_RESULT, result)); } }.start(); } public final void registerOnTranslateResultListener(OnTranslatedListener listener) { mListener.put(listener, mWeakHashMapContent); } public final void unregisterOnTranslateResultListener(OnTranslatedListener listener) { mListener.remove(mListener); } private final TranslateResult getResultFromCache(final TranslateRequest request) { TranslateResult result = null; SoftReference<TranslateResult> ref = mCachedDict.get(request); if (null != ref) { result = ref.get(); } return result; } }
3e03f0e8ed11a4f4dc545375aa46b02ca4a103ba
1,000
java
Java
sds-admin/src/test/java/com/didiglobal/sds/admin/test/dao/PointDictDaoTest.java
seasidesky/sds
76296e6ea5347c5023cc618a0f5e653c381ac095
[ "Apache-2.0" ]
362
2020-02-22T12:27:10.000Z
2022-03-28T15:54:19.000Z
sds-admin/src/test/java/com/didiglobal/sds/admin/test/dao/PointDictDaoTest.java
thinker1017/sds
da9bc8089ce6f020fe9d9428b82638d156ddae5c
[ "Apache-2.0" ]
18
2020-03-02T06:09:03.000Z
2022-01-12T23:05:14.000Z
sds-admin/src/test/java/com/didiglobal/sds/admin/test/dao/PointDictDaoTest.java
thinker1017/sds
da9bc8089ce6f020fe9d9428b82638d156ddae5c
[ "Apache-2.0" ]
118
2020-02-22T12:45:15.000Z
2022-02-21T08:08:00.000Z
27.027027
67
0.745
1,639
package com.didiglobal.sds.admin.test.dao; import com.didiglobal.sds.admin.dao.PointDictDao; import com.didiglobal.sds.admin.dao.bean.PointDictDO; import org.assertj.core.util.Lists; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; /** * Created by tianyulei on 2019/7/10 **/ @RunWith(SpringRunner.class) @SpringBootTest public class PointDictDaoTest { @Autowired private PointDictDao pointDictDao; @Test public void testInsert(){ PointDictDO pointDictDO = new PointDictDO(); pointDictDO.setAppName("t1"); pointDictDO.setAppGroupName("tg1"); pointDictDO.setPoint("testPointDict2"); pointDictDao.addPointDict(pointDictDO); } @Test public void testdelete(){ pointDictDao.deletePointDictList(Lists.newArrayList(442L)); } }
3e03f1d8aa77e87a76b4e83e4040da5c9b00d0c9
3,210
java
Java
BotGenie-Framework/src/com/genie/chatbot/conversation/smartmatch/QuestionTopicMapper.java
rajeshputta1983/BotGenie
2f1a419841c2ddee4e4e5e4fa84dae841dfb6577
[ "Apache-2.0" ]
1
2019-03-16T10:18:58.000Z
2019-03-16T10:18:58.000Z
BotGenie-Framework/src/com/genie/chatbot/conversation/smartmatch/QuestionTopicMapper.java
rajeshputta1983/BotGenie
2f1a419841c2ddee4e4e5e4fa84dae841dfb6577
[ "Apache-2.0" ]
null
null
null
BotGenie-Framework/src/com/genie/chatbot/conversation/smartmatch/QuestionTopicMapper.java
rajeshputta1983/BotGenie
2f1a419841c2ddee4e4e5e4fa84dae841dfb6577
[ "Apache-2.0" ]
null
null
null
24.135338
114
0.719938
1,640
package com.genie.chatbot.conversation.smartmatch; import java.util.Map; import com.genie.chatbot.solr.StandardSolrClient; /** * @author Rajesh Putta */ public class QuestionTopicMapper { private static QuestionTopicMapper instance=new QuestionTopicMapper(); private SmartMatcher smartMatcher=SmartMatcher.getInstance(); private Map<String, QuestionContent> questionTopicMap=null; private boolean useSolrForSmartMatchEnabled=true; private QuestionTopicMapper() { } public static QuestionTopicMapper getInstance() { return instance; } public void initialize(boolean useSolrForSmartMatchEnabled) { // pull all trained questions from Solr and cache this.useSolrForSmartMatchEnabled=useSolrForSmartMatchEnabled; if(this.useSolrForSmartMatchEnabled) { StandardSolrClient.getInstance().initialize(); } else { StandardSolrClient.getInstance().initialize(); this.questionTopicMap=StandardSolrClient.getInstance().pullTrainedQuestions(); } } public String getTopicIdForQuestion(String question) { QuestionContent content=this.questionTopicMap.get(question); if(content!=null) { return content.getTopicId(); } return null; } public String getTopicIdForQuestion(String question, Map<String, QuestionContent> questionTopicMapLocal) { if(questionTopicMapLocal==null) { return this.getTopicIdForQuestion(question); } QuestionContent content=questionTopicMapLocal.get(question); if(content!=null) { return content.getTopicId(); } return null; } public String getDocIdForQuestion(String question) { QuestionContent content=this.questionTopicMap.get(question); if(content!=null) { return content.getDocId(); } return null; } public String getHelpContentIdForQuestion(String question) { QuestionContent content=this.questionTopicMap.get(question); if(content!=null) { return content.getHelpContentId(); } return null; } public String getHelpContentIdForQuestion(String question, Map<String, QuestionContent> questionTopicMapLocal) { if(questionTopicMapLocal==null) { return this.getHelpContentIdForQuestion(question); } QuestionContent content=questionTopicMapLocal.get(question); if(content!=null) { return content.getHelpContentId(); } return null; } public synchronized void addQuestionTopic(String question, String docId, String topicId, String helpContentId) { this.questionTopicMap.put(question, new QuestionContent(docId, topicId, helpContentId)); this.smartMatcher.addQuestion(question); } public static class QuestionContent { private String docId=null; private String topicId=null; private String helpContentId=null; public QuestionContent(String docId, String topicId, String helpContentId) { this.docId=docId; this.topicId=topicId; this.helpContentId=helpContentId; } public String getTopicId() { return topicId; } public String getHelpContentId() { return helpContentId; } public String getDocId() { return docId; } } }
3e03f1eaab59155d1d9c403bbbab0a46c7081dde
763
java
Java
osworks-api/src/main/java/com/algaworks/osworks/api/model/OrdemServicoInputModel.java
Edufreitass/curso-spring-rest-para-iniciantes
c9e3fb8114eba9dd5c1a33b9effe62663e7834b1
[ "MIT" ]
null
null
null
osworks-api/src/main/java/com/algaworks/osworks/api/model/OrdemServicoInputModel.java
Edufreitass/curso-spring-rest-para-iniciantes
c9e3fb8114eba9dd5c1a33b9effe62663e7834b1
[ "MIT" ]
null
null
null
osworks-api/src/main/java/com/algaworks/osworks/api/model/OrdemServicoInputModel.java
Edufreitass/curso-spring-rest-para-iniciantes
c9e3fb8114eba9dd5c1a33b9effe62663e7834b1
[ "MIT" ]
null
null
null
16.586957
49
0.756225
1,641
package com.algaworks.osworks.api.model; import java.math.BigDecimal; import javax.validation.Valid; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; public class OrdemServicoInputModel { @NotBlank private String descricao; @NotNull private BigDecimal preco; @Valid @NotNull private ClienteIdInput cliente; public String getDescricao() { return descricao; } public void setDescricao(String descricao) { this.descricao = descricao; } public BigDecimal getPreco() { return preco; } public void setPreco(BigDecimal preco) { this.preco = preco; } public ClienteIdInput getCliente() { return cliente; } public void setCliente(ClienteIdInput cliente) { this.cliente = cliente; } }
3e03f371aa9e6861b7a4d033a030d6aec685ab2c
977
java
Java
opba-protocols/xs2a-protocol/src/main/java/de/adorsys/opba/protocol/xs2a/service/protocol/Xs2aFlowNameSelector.java
bartveenstra/open-banking-gateway
987f6dfae5b1dd6e276c12b6f6d8908fe6e58156
[ "Apache-2.0" ]
118
2019-11-05T14:32:48.000Z
2022-03-31T21:55:56.000Z
opba-protocols/xs2a-protocol/src/main/java/de/adorsys/opba/protocol/xs2a/service/protocol/Xs2aFlowNameSelector.java
bartveenstra/open-banking-gateway
987f6dfae5b1dd6e276c12b6f6d8908fe6e58156
[ "Apache-2.0" ]
844
2019-11-19T10:26:23.000Z
2022-02-02T19:28:36.000Z
opba-protocols/xs2a-protocol/src/main/java/de/adorsys/opba/protocol/xs2a/service/protocol/Xs2aFlowNameSelector.java
bartveenstra/open-banking-gateway
987f6dfae5b1dd6e276c12b6f6d8908fe6e58156
[ "Apache-2.0" ]
59
2019-11-12T13:10:30.000Z
2022-03-24T03:44:02.000Z
29.606061
117
0.723644
1,642
package de.adorsys.opba.protocol.xs2a.service.protocol; import de.adorsys.opba.protocol.xs2a.context.Xs2aContext; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; /** * Selects sub-process name to be executed using {@link Xs2aContext}. I.e.: calls different sub-processes for account * listing and transaction listing. */ @Service("xs2aFlowNameSelector") @RequiredArgsConstructor public class Xs2aFlowNameSelector { /** * Sub-process name for current context (PSU/FinTech input) validation. */ public String getNameForValidation(Xs2aContext ctx) { return actionName(ctx); } /** * Sub-process name for current context (PSU/FinTech input) execution (real calls to ASPSP API). */ public String getNameForExecution(Xs2aContext ctx) { return actionName(ctx); } private String actionName(Xs2aContext ctx) { return ctx.getFlowByAction().get(ctx.getAction()); } }
3e03f3becbb2d548a49a64119f0643452a245863
6,654
java
Java
src/testcases/CWE89_SQL_Injection/s01/CWE89_SQL_Injection__connect_tcp_executeUpdate_54a.java
diktat-static-analysis/juliet-benchmark-java
7e55922d154c26ef34ff3327073f030ff7393b2a
[ "MIT" ]
null
null
null
src/testcases/CWE89_SQL_Injection/s01/CWE89_SQL_Injection__connect_tcp_executeUpdate_54a.java
diktat-static-analysis/juliet-benchmark-java
7e55922d154c26ef34ff3327073f030ff7393b2a
[ "MIT" ]
null
null
null
src/testcases/CWE89_SQL_Injection/s01/CWE89_SQL_Injection__connect_tcp_executeUpdate_54a.java
diktat-static-analysis/juliet-benchmark-java
7e55922d154c26ef34ff3327073f030ff7393b2a
[ "MIT" ]
null
null
null
31.837321
170
0.519838
1,643
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE89_SQL_Injection__connect_tcp_executeUpdate_54a.java Label Definition File: CWE89_SQL_Injection.label.xml Template File: sources-sinks-54a.tmpl.java */ /* * @description * CWE: 89 SQL Injection * BadSource: connect_tcp Read data using an outbound tcp connection * GoodSource: A hardcoded string * Sinks: executeUpdate * GoodSink: Use prepared statement and executeUpdate (properly) * BadSink : data concatenated into SQL statement used in executeUpdate(), which could result in SQL Injection * Flow Variant: 54 Data flow: data passed as an argument from one method through three others to a fifth; all five functions are in different classes in the same package * * */ package testcases.CWE89_SQL_Injection.s01; import testcasesupport.*; import javax.servlet.http.*; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; import java.net.Socket; import java.util.logging.Level; public class CWE89_SQL_Injection__connect_tcp_executeUpdate_54a extends AbstractTestCase { public void bad() throws Throwable { String data; data = ""; /* Initialize data */ /* Read data using an outbound tcp connection */ { Socket socket = null; BufferedReader readerBuffered = null; InputStreamReader readerInputStream = null; try { /* Read data using an outbound tcp connection */ socket = new Socket("host.example.org", 39544); /* read input from socket */ readerInputStream = new InputStreamReader(socket.getInputStream(), "UTF-8"); readerBuffered = new BufferedReader(readerInputStream); /* POTENTIAL FLAW: Read data using an outbound tcp connection */ data = readerBuffered.readLine(); } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error with stream reading", exceptIO); } finally { /* clean up stream reading objects */ try { if (readerBuffered != null) { readerBuffered.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing BufferedReader", exceptIO); } try { if (readerInputStream != null) { readerInputStream.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing InputStreamReader", exceptIO); } /* clean up socket objects */ try { if (socket != null) { socket.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing Socket", exceptIO); } } } (new CWE89_SQL_Injection__connect_tcp_executeUpdate_54b()).badSink(data ); } public void good() throws Throwable { goodG2B(); goodB2G(); } /* goodG2B() - use goodsource and badsink */ private void goodG2B() throws Throwable { String data; /* FIX: Use a hardcoded string */ data = "foo"; (new CWE89_SQL_Injection__connect_tcp_executeUpdate_54b()).goodG2BSink(data ); } /* goodB2G() - use badsource and goodsink */ private void goodB2G() throws Throwable { String data; data = ""; /* Initialize data */ /* Read data using an outbound tcp connection */ { Socket socket = null; BufferedReader readerBuffered = null; InputStreamReader readerInputStream = null; try { /* Read data using an outbound tcp connection */ socket = new Socket("host.example.org", 39544); /* read input from socket */ readerInputStream = new InputStreamReader(socket.getInputStream(), "UTF-8"); readerBuffered = new BufferedReader(readerInputStream); /* POTENTIAL FLAW: Read data using an outbound tcp connection */ data = readerBuffered.readLine(); } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error with stream reading", exceptIO); } finally { /* clean up stream reading objects */ try { if (readerBuffered != null) { readerBuffered.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing BufferedReader", exceptIO); } try { if (readerInputStream != null) { readerInputStream.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing InputStreamReader", exceptIO); } /* clean up socket objects */ try { if (socket != null) { socket.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing Socket", exceptIO); } } } (new CWE89_SQL_Injection__connect_tcp_executeUpdate_54b()).goodB2GSink(data ); } /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException { mainFromParent(args); } }
3e03f3d3a5aa29aa1aeb60a2e6dc1a1ad975f06b
260
java
Java
plugin/src/main/java/org/websync/models/PageInstance.java
websyncio/websync-idea
4de57e519f06953eaf1f2c73c9dbb688017a2349
[ "Apache-2.0" ]
2
2020-03-05T20:04:09.000Z
2020-04-20T16:53:37.000Z
plugin/src/main/java/org/websync/models/PageInstance.java
websyncio/websync-idea
4de57e519f06953eaf1f2c73c9dbb688017a2349
[ "Apache-2.0" ]
152
2020-02-10T15:36:29.000Z
2021-02-12T07:40:58.000Z
plugin/src/main/java/org/websync/models/PageInstance.java
websyncio/websync-idea
4de57e519f06953eaf1f2c73c9dbb688017a2349
[ "Apache-2.0" ]
2
2020-02-20T06:36:49.000Z
2020-02-25T05:46:03.000Z
17.333333
55
0.757692
1,644
package org.websync.models; import org.websync.psi.models.AnnotationInstance; public interface PageInstance extends CodeModelWithId { String getName(); String getPageTypeId(); AnnotationInstance getAttributeInstance(); String getUrl(); }
3e03f3e00831b6acb10449c8bc686679fca8da9e
190
java
Java
sonarqube-companion-rest/src/main/java/pl/consdata/ico/sqcompanion/hook/trigger/SpringWebhookTrigger.java
maciej-consdata/sonarqube-companion
36748b08a7c7b83a1b9795ed30047d0c8cbda9f2
[ "MIT" ]
10
2017-07-28T11:06:55.000Z
2022-01-01T18:16:20.000Z
sonarqube-companion-rest/src/main/java/pl/consdata/ico/sqcompanion/hook/trigger/SpringWebhookTrigger.java
maciej-consdata/sonarqube-companion
36748b08a7c7b83a1b9795ed30047d0c8cbda9f2
[ "MIT" ]
127
2017-07-28T11:12:11.000Z
2022-02-26T09:57:11.000Z
sonarqube-companion-rest/src/main/java/pl/consdata/ico/sqcompanion/hook/trigger/SpringWebhookTrigger.java
maciej-consdata/sonarqube-companion
36748b08a7c7b83a1b9795ed30047d0c8cbda9f2
[ "MIT" ]
3
2017-08-01T10:09:33.000Z
2019-06-05T05:49:43.000Z
23.75
62
0.821053
1,645
package pl.consdata.ico.sqcompanion.hook.trigger; import org.springframework.scheduling.Trigger; public interface SpringWebhookTrigger extends WebhookTrigger { Trigger getTrigger(); }
3e03f5b0d03f5747749a7b0d9a7c8f982432e426
757
java
Java
gmall-pms/src/main/java/com/atguigu/gmall/pms/entity/SpuInfoDescEntity.java
lixu-love/gmall
748ea4dae1f4256369898718afeed25acd59f9c3
[ "Apache-2.0" ]
null
null
null
gmall-pms/src/main/java/com/atguigu/gmall/pms/entity/SpuInfoDescEntity.java
lixu-love/gmall
748ea4dae1f4256369898718afeed25acd59f9c3
[ "Apache-2.0" ]
1
2021-09-20T20:55:19.000Z
2021-09-20T20:55:19.000Z
gmall-pms/src/main/java/com/atguigu/gmall/pms/entity/SpuInfoDescEntity.java
lixu-love/gmall
748ea4dae1f4256369898718afeed25acd59f9c3
[ "Apache-2.0" ]
null
null
null
20.432432
56
0.740741
1,646
package com.atguigu.gmall.pms.entity; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.Serializable; import java.util.Date; import lombok.Data; /** * spu信息介绍 * * @author lixu * @email [email protected] * @date 2020-01-06 09:46:39 */ @ApiModel @Data @TableName("pms_spu_info_desc") public class SpuInfoDescEntity implements Serializable { private static final long serialVersionUID = 1L; /** * 商品id */ @TableId @ApiModelProperty(name = "spuId",value = "商品id") private Long spuId; /** * 商品介绍 */ @ApiModelProperty(name = "decript",value = "商品介绍") private String decript; }
3e03f5c85889baf71d4687b211026b3eef530697
1,669
java
Java
prospecto-runtime/src/main/java/org/soulwing/prospecto/runtime/discriminator/ConcreteDiscriminatorStrategyLocator.java
soulwing/prospecto
eedeead9bca1fe135103410b5cc5bdf730a9d8ee
[ "Apache-2.0" ]
5
2016-03-09T20:00:19.000Z
2019-11-26T21:41:25.000Z
prospecto-runtime/src/main/java/org/soulwing/prospecto/runtime/discriminator/ConcreteDiscriminatorStrategyLocator.java
soulwing/prospecto
eedeead9bca1fe135103410b5cc5bdf730a9d8ee
[ "Apache-2.0" ]
71
2016-03-17T15:00:46.000Z
2021-06-13T14:32:22.000Z
prospecto-runtime/src/main/java/org/soulwing/prospecto/runtime/discriminator/ConcreteDiscriminatorStrategyLocator.java
soulwing/prospecto
eedeead9bca1fe135103410b5cc5bdf730a9d8ee
[ "Apache-2.0" ]
2
2016-03-17T14:47:24.000Z
2019-08-28T21:02:47.000Z
30.907407
75
0.755542
1,647
/* * File created on Mar 31, 2016 * * Copyright (c) 2016 Carl Harris, Jr * and others as noted * * 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.soulwing.prospecto.runtime.discriminator; import org.soulwing.prospecto.api.discriminator.DiscriminatorStrategy; import org.soulwing.prospecto.api.template.ViewNode; import org.soulwing.prospecto.runtime.context.ScopedViewContext; /** * A {@link DiscriminatorStrategyLocator} implementation. * * @author Carl Harris */ class ConcreteDiscriminatorStrategyLocator implements DiscriminatorStrategyLocator { public static final ConcreteDiscriminatorStrategyLocator INSTANCE = new ConcreteDiscriminatorStrategyLocator(); private ConcreteDiscriminatorStrategyLocator() {} @Override public DiscriminatorStrategy findStrategy(ViewNode node, ScopedViewContext context) { DiscriminatorStrategy strategy = node.get(DiscriminatorStrategy.class); if (strategy == null) { strategy = context.get(DiscriminatorStrategy.class); } if (strategy == null) { throw new AssertionError("discriminator strategy is required"); } return strategy; } }
3e03f6c526bd8557d244f7c692bbdc4dfb9547c2
5,278
java
Java
com.ld.net.spider/src/main/java/io/spider/pojo/ServiceDefinition.java
2014shijina2014/io.spider
8c201458f3d86d447019ccb237cfff824778fd96
[ "Apache-2.0" ]
8
2018-11-01T03:37:20.000Z
2021-12-29T10:37:57.000Z
com.ld.net.spider/src/main/java/io/spider/pojo/ServiceDefinition.java
2014shijina2014/io.spider
8c201458f3d86d447019ccb237cfff824778fd96
[ "Apache-2.0" ]
null
null
null
com.ld.net.spider/src/main/java/io/spider/pojo/ServiceDefinition.java
2014shijina2014/io.spider
8c201458f3d86d447019ccb237cfff824778fd96
[ "Apache-2.0" ]
6
2018-10-02T19:03:22.000Z
2021-05-08T10:05:00.000Z
24.886792
158
0.719674
1,648
/** * Licensed under the Apache License, Version 2.0 */ package io.spider.pojo; import io.spider.meta.SpiderOtherMetaConstant; import io.spider.meta.SpiderPacketPosConstant; import java.lang.reflect.Method; import java.lang.reflect.Parameter; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.commons.lang3.StringUtils; import com.fasterxml.jackson.annotation.JsonIgnore; import com.ld.core.pack.LDConvert; /** * * spider 通信中间件 * @author [email protected] * {@link} http://www.cnblogs.com/zhjh256 */ public class ServiceDefinition { private String serviceId; private boolean needLog = false; private short broadcast = 0; private boolean his = false; private boolean batch = false; private short bizUserType = 1; public boolean isBatch() { return batch; } public ServiceDefinition setBatch(boolean batch) { this.batch = batch; return this; } public short getBizUserType() { return bizUserType; } public void setBizUserType(short bizUserType) { this.bizUserType = bizUserType; } private boolean isExport; public boolean isExport() { return isExport; } public ServiceDefinition setExport(boolean isExport) { this.isExport = isExport; return this; } private String desc; private int timeout = 0; private Class clz; private Method method; private Type retType; public String getSubSystemId() { return subSystemId; } public ServiceDefinition setSubSystemId(String subSystemId) { this.subSystemId = subSystemId; return this; } public Parameter[] paramTypes; private String clusterName; //启动完成后目标路由节点未被设置的话,代表该服务需要依赖于运行时信息动态计算,一般在spider作为NB或者PNP运行时为空 private String subSystemId; private Map<String,Method> ld2FieldNameMap = new HashMap<String,Method>(); /** * 拷贝原LDPack定义 */ public List<LDConvert> paramConverts; public List<String> paramNames; public boolean isList; public List<String> itemNames; public List<Method> itemGetters; public Class itemClass; public String getServiceId() { return serviceId; } public ServiceDefinition setServiceId(String serviceId) { this.serviceId = StringUtils.rightPad(serviceId,SpiderPacketPosConstant.SPIDER_SERVICE_ID_LEN, SpiderOtherMetaConstant.DEFAULT_SPIDER_PACKET_HEAD_PAD_CHAR); return this; } public String getDesc() { return desc; } public ServiceDefinition setDesc(String desc) { this.desc = desc; return this; } public int getTimeout() { return timeout; } public ServiceDefinition setTimeout(int timeout) { this.timeout = timeout; return this; } public String getClusterName() { return clusterName; } public ServiceDefinition setClusterName(String nodeName) { this.clusterName = nodeName; return this; } public Class getClz() { return clz; } public ServiceDefinition setClz(Class clz) { this.clz = clz; return this; } public Method getMethod() { return method; } public ServiceDefinition setMethod(Method method) { this.method = method; return this; } public Type getRetType() { return retType; } public ServiceDefinition setRetType(Type retType) { this.retType = retType; return this; } public Parameter getParamType() { return (paramTypes != null && paramTypes.length > 0) ? paramTypes[0] : null; } public ServiceDefinition setParamTypes(Parameter[] paramTypes) { this.paramTypes = paramTypes; return this; } public Parameter[] getParamTypes() { return this.paramTypes; } public List<String> getDisplayParamTypes() { List<String> typeNames = new ArrayList<String>(); for(int i=0;i<this.paramTypes.length;i++) { typeNames.add(paramTypes[i].getType().getCanonicalName()); } return typeNames; } @Override public String toString() { return "ServiceDefinition [serviceId=" + serviceId + ", needLog=" + needLog + ", broadcast=" + broadcast + ", isExport=" + isExport + ", desc=" + desc + ", timeout=" + timeout + ", clz=" + clz + ", method=" + method + ", retType=" + retType + ", paramTypes=" + Arrays.toString(paramTypes) + ", clusterName=" + clusterName + ", subSystemId=" + subSystemId + ", paramConverts=" + paramConverts + ", paramNames=" + paramNames + ", isList=" + isList + ", itemNames=" + itemNames + ", itemGetters=" + itemGetters + ", itemClass=" + itemClass + ", ld2FieldNameMap=" + ld2FieldNameMap + "]"; } @JsonIgnore public Method getSettByLdName(String name) { return ld2FieldNameMap.get(name); } public ServiceDefinition putFieldByLdName(String name,Method field) { ld2FieldNameMap.put(name, field); return this; } public boolean isNeedLog() { return needLog; } public ServiceDefinition setNeedLog(boolean needLog) { this.needLog = needLog; return this; } public short getBroadcast() { return broadcast; } public ServiceDefinition setBroadcast(short broadcast) { this.broadcast = broadcast; return this; } public boolean isHis() { return his; } public ServiceDefinition setHis(boolean his) { this.his = his; return this; } /** * @param name */ public int getParamIndex(String name) { for(int i=0;i<this.paramNames.size();i++) { if (this.paramNames.get(i).equals(name)) { return i; } } return -1; } }
3e03f7040662f8f7a5878ae9d996f36e989d0334
4,508
java
Java
dd-java-agent/instrumentation/slf4j-mdc/src/main/java/datadog/trace/instrumentation/slf4j/mdc/MDCInjectionInstrumentation.java
orekyuu/dd-trace-java
1bae0fb69508eaa9f8b1ff9238e0a662c12f7f2d
[ "Apache-2.0" ]
null
null
null
dd-java-agent/instrumentation/slf4j-mdc/src/main/java/datadog/trace/instrumentation/slf4j/mdc/MDCInjectionInstrumentation.java
orekyuu/dd-trace-java
1bae0fb69508eaa9f8b1ff9238e0a662c12f7f2d
[ "Apache-2.0" ]
null
null
null
dd-java-agent/instrumentation/slf4j-mdc/src/main/java/datadog/trace/instrumentation/slf4j/mdc/MDCInjectionInstrumentation.java
orekyuu/dd-trace-java
1bae0fb69508eaa9f8b1ff9238e0a662c12f7f2d
[ "Apache-2.0" ]
null
null
null
38.20339
100
0.740018
1,649
package datadog.trace.instrumentation.slf4j.mdc; import static java.util.Collections.singletonMap; import static net.bytebuddy.matcher.ElementMatchers.isTypeInitializer; import static net.bytebuddy.matcher.ElementMatchers.named; import com.google.auto.service.AutoService; import datadog.trace.agent.tooling.Instrumenter; import datadog.trace.agent.tooling.log.LogContextScopeListener; import datadog.trace.agent.tooling.log.ThreadLocalWithDDTagsInitValue; import datadog.trace.api.Config; import datadog.trace.api.GlobalTracer; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.security.ProtectionDomain; import java.util.HashMap; import java.util.Map; import net.bytebuddy.asm.Advice; import net.bytebuddy.description.method.MethodDescription; import net.bytebuddy.description.type.TypeDescription; import net.bytebuddy.matcher.BooleanMatcher; import net.bytebuddy.matcher.ElementMatcher; import net.bytebuddy.utility.JavaModule; @AutoService(Instrumenter.class) public class MDCInjectionInstrumentation extends Instrumenter.Default { public static final String MDC_INSTRUMENTATION_NAME = "mdc"; // Intentionally doing the string replace to bypass gradle shadow rename // mdcClassName = org.slf4j.MDC private static final String mdcClassName = "org.TMP.MDC".replaceFirst("TMP", "slf4j"); private boolean initialized = false; public MDCInjectionInstrumentation() { super(MDC_INSTRUMENTATION_NAME); } @Override protected boolean defaultEnabled() { return Config.get().isLogsInjectionEnabled(); } @Override public ElementMatcher<? super TypeDescription> typeMatcher() { return named(mdcClassName); } @Override public void postMatch( final TypeDescription typeDescription, final ClassLoader classLoader, final JavaModule module, final Class<?> classBeingRedefined, final ProtectionDomain protectionDomain) { if (classBeingRedefined != null && !initialized) { MDCAdvice.mdcClassInitialized(classBeingRedefined); } initialized = true; } @Override public Map<? extends ElementMatcher<? super MethodDescription>, String> transformers() { return singletonMap( new BooleanMatcher<MethodDescription>(false) { @Override public boolean matches(final MethodDescription target) { return initialized; } }.and(isTypeInitializer()), MDCInjectionInstrumentation.class.getName() + "$MDCAdvice"); } @Override public String[] helperClassNames() { return new String[] { "datadog.trace.agent.tooling.log.LogContextScopeListener", "datadog.trace.agent.tooling.log.ThreadLocalWithDDTagsInitValue", }; } public static class MDCAdvice { @Advice.OnMethodExit(suppress = Throwable.class) public static void mdcClassInitialized(@Advice.Origin final Class<?> mdcClass) { try { final Method putMethod = mdcClass.getMethod("put", String.class, String.class); final Method removeMethod = mdcClass.getMethod("remove", String.class); GlobalTracer.get().addScopeListener(new LogContextScopeListener(putMethod, removeMethod)); final Field mdcAdapterField = mdcClass.getDeclaredField("mdcAdapter"); mdcAdapterField.setAccessible(true); final Object mdcAdapterInstance = mdcAdapterField.get(null); final Field copyOnThreadLocalField = mdcAdapterInstance.getClass().getDeclaredField("copyOnThreadLocal"); if (!ThreadLocal.class.isAssignableFrom(copyOnThreadLocalField.getType())) { org.slf4j.LoggerFactory.getLogger(mdcClass) .debug("Can't find thread local field: {}", copyOnThreadLocalField); return; } copyOnThreadLocalField.setAccessible(true); Object copyOnThreadLocalFieldValue = ((ThreadLocal) copyOnThreadLocalField.get(mdcAdapterInstance)).get(); copyOnThreadLocalFieldValue = copyOnThreadLocalFieldValue != null ? copyOnThreadLocalFieldValue : new HashMap<>(); copyOnThreadLocalField.set( mdcAdapterInstance, ThreadLocalWithDDTagsInitValue.create(copyOnThreadLocalFieldValue)); } catch (final NoSuchMethodException | IllegalAccessException | NoSuchFieldException | InvocationTargetException e) { org.slf4j.LoggerFactory.getLogger(mdcClass).debug("Failed to add MDC span listener", e); } } } }
3e03f76cb76e6be4b26aa3491b9001e91016a42a
2,471
java
Java
actor-apps/core/src/main/java/im/actor/model/api/ServiceMessage.java
DragonStuff/actor-platform
d262e6bb3c18b20eb35551313bce16c471cd2928
[ "MIT" ]
null
null
null
actor-apps/core/src/main/java/im/actor/model/api/ServiceMessage.java
DragonStuff/actor-platform
d262e6bb3c18b20eb35551313bce16c471cd2928
[ "MIT" ]
null
null
null
actor-apps/core/src/main/java/im/actor/model/api/ServiceMessage.java
DragonStuff/actor-platform
d262e6bb3c18b20eb35551313bce16c471cd2928
[ "MIT" ]
null
null
null
27.455556
74
0.62849
1,650
package im.actor.model.api; /* * Generated by the Actor API Scheme generator. DO NOT EDIT! */ import im.actor.model.droidkit.bser.Bser; import im.actor.model.droidkit.bser.BserParser; import im.actor.model.droidkit.bser.BserObject; import im.actor.model.droidkit.bser.BserValues; import im.actor.model.droidkit.bser.BserWriter; import im.actor.model.droidkit.bser.DataInput; import im.actor.model.droidkit.bser.DataOutput; import im.actor.model.droidkit.bser.util.SparseArray; import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.NotNull; import com.google.j2objc.annotations.ObjectiveCName; import static im.actor.model.droidkit.bser.Utils.*; import java.io.IOException; import im.actor.model.network.parser.*; import java.util.List; import java.util.ArrayList; public class ServiceMessage extends Message { private String text; private ServiceEx ext; public ServiceMessage(@NotNull String text, @Nullable ServiceEx ext) { this.text = text; this.ext = ext; } public ServiceMessage() { } public int getHeader() { return 2; } @NotNull public String getText() { return this.text; } @Nullable public ServiceEx getExt() { return this.ext; } @Override public void parse(BserValues values) throws IOException { this.text = values.getString(1); if (values.optBytes(3) != null) { this.ext = ServiceEx.fromBytes(values.getBytes(3)); } if (values.hasRemaining()) { setUnmappedObjects(values.buildRemaining()); } } @Override public void serialize(BserWriter writer) throws IOException { if (this.text == null) { throw new IOException(); } writer.writeString(1, this.text); if (this.ext != null) { writer.writeBytes(3, this.ext.buildContainer()); } if (this.getUnmappedObjects() != null) { SparseArray<Object> unmapped = this.getUnmappedObjects(); for (int i = 0; i < unmapped.size(); i++) { int key = unmapped.keyAt(i); writer.writeUnmapped(key, unmapped.get(key)); } } } @Override public String toString() { String res = "struct ServiceMessage{"; res += "text=" + this.text; res += ", ext=" + (this.ext != null ? "set":"empty"); res += "}"; return res; } }
3e03f84689f173b35263d8b3c3d50ed5d6a31823
2,600
java
Java
src/main/java/br/com/agenciacodeplus/socialcron/SecurityConfiguration.java
geovannyAvelar/SocialCRON-CORE
dc60f76fa1a149c28550c440b0197f673a09f29c
[ "MIT" ]
1
2017-04-03T15:15:23.000Z
2017-04-03T15:15:23.000Z
src/main/java/br/com/agenciacodeplus/socialcron/SecurityConfiguration.java
geovannyAvelar/SocialCRON-CORE
dc60f76fa1a149c28550c440b0197f673a09f29c
[ "MIT" ]
null
null
null
src/main/java/br/com/agenciacodeplus/socialcron/SecurityConfiguration.java
geovannyAvelar/SocialCRON-CORE
dc60f76fa1a149c28550c440b0197f673a09f29c
[ "MIT" ]
null
null
null
40.625
109
0.834231
1,651
// Credits to Rajith Delantha https://github.com/rajithd package br.com.agenciacodeplus.socialcron; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.access.expression.method.MethodSecurityExpressionHandler; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; import org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration; import org.springframework.security.config.annotation.web.builders.WebSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.oauth2.provider.expression.OAuth2MethodSecurityExpressionHandler; @Configuration @EnableWebSecurity @EnableGlobalMethodSecurity(prePostEnabled=true) public class SecurityConfiguration extends WebSecurityConfigurerAdapter { @Autowired private UserDetailsService userDetailsService; @Bean public PasswordEncoder passwordEncoder() { return new BCryptPasswordEncoder(); } @Autowired public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { auth.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder()); } @Override public void configure(WebSecurity web) throws Exception { web.ignoring() .antMatchers("/favicon.ico") .antMatchers("/v1/posts/day/2014-11-18"); } @Override @Bean public AuthenticationManager authenticationManagerBean() throws Exception { return super.authenticationManagerBean(); } @EnableGlobalMethodSecurity(prePostEnabled = true, jsr250Enabled = true) private static class GlobalSecurityConfiguration extends GlobalMethodSecurityConfiguration { @SuppressWarnings("unused") public GlobalSecurityConfiguration() {}; @Override protected MethodSecurityExpressionHandler createExpressionHandler() { return new OAuth2MethodSecurityExpressionHandler(); } } }
3e03f95e3bb0f406ab46e008106b3271f35f9441
3,072
java
Java
src/com/sun/org/apache/xalan/internal/xsltc/compiler/UnaryOpExpr.java
yonxao/jdk202
a3b1e4e94cd9230052770cd42168e7bc19764e84
[ "MIT" ]
1,305
2018-03-11T15:04:26.000Z
2022-03-30T16:02:34.000Z
jdk/src/main/java/com/sun/org/apache/xalan/internal/xsltc/compiler/UnaryOpExpr.java
dibt/spring-framework
ce2dfa68e2331a07d36bdcf7aa92597c91a391ee
[ "Apache-2.0" ]
7
2019-03-20T09:43:08.000Z
2021-08-20T03:19:24.000Z
jdk/src/main/java/com/sun/org/apache/xalan/internal/xsltc/compiler/UnaryOpExpr.java
dibt/spring-framework
ce2dfa68e2331a07d36bdcf7aa92597c91a391ee
[ "Apache-2.0" ]
575
2018-03-11T15:15:41.000Z
2022-03-30T16:03:48.000Z
33.758242
79
0.659831
1,652
/* * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ /* * Copyright 2001-2004 The Apache Software Foundation. * * 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. */ /* * $Id: UnaryOpExpr.java,v 1.2.4.1 2005/09/05 09:21:00 pvedula Exp $ */ package com.sun.org.apache.xalan.internal.xsltc.compiler; import com.sun.org.apache.bcel.internal.generic.InstructionList; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodType; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ final class UnaryOpExpr extends Expression { private Expression _left; public UnaryOpExpr(Expression left) { (_left = left).setParent(this); } /** * Returns true if this expressions contains a call to position(). This is * needed for context changes in node steps containing multiple predicates. */ public boolean hasPositionCall() { return(_left.hasPositionCall()); } /** * Returns true if this expressions contains a call to last() */ public boolean hasLastCall() { return(_left.hasLastCall()); } public void setParser(Parser parser) { super.setParser(parser); _left.setParser(parser); } public Type typeCheck(SymbolTable stable) throws TypeCheckError { final Type tleft = _left.typeCheck(stable); final MethodType ptype = lookupPrimop(stable, "u-", new MethodType(Type.Void, tleft)); if (ptype != null) { final Type arg1 = (Type) ptype.argsType().elementAt(0); if (!arg1.identicalTo(tleft)) { _left = new CastExpr(_left, arg1); } return _type = ptype.resultType(); } throw new TypeCheckError(this); } public String toString() { return "u-" + '(' + _left + ')'; } public void translate(ClassGenerator classGen, MethodGenerator methodGen) { InstructionList il = methodGen.getInstructionList(); _left.translate(classGen, methodGen); il.append(_type.NEG()); } }
3e03fa5e7ec00628c55e3f53b682282be2664693
1,094
java
Java
regexlib/PoCs/Regexlib_Java_8/src/regexlib_8305.java
yetingli/ReDoS-Benchmarks
f5b5094d835649e957bf3fec6b8bd4f6efdb35fc
[ "MIT" ]
1
2022-01-24T14:43:23.000Z
2022-01-24T14:43:23.000Z
regexlib/PoCs/Regexlib_Java_8/src/regexlib_8305.java
yetingli/ReDoS-Benchmarks
f5b5094d835649e957bf3fec6b8bd4f6efdb35fc
[ "MIT" ]
null
null
null
regexlib/PoCs/Regexlib_Java_8/src/regexlib_8305.java
yetingli/ReDoS-Benchmarks
f5b5094d835649e957bf3fec6b8bd4f6efdb35fc
[ "MIT" ]
null
null
null
34.1875
86
0.508227
1,653
import java.util.regex.Matcher; import java.util.regex.Pattern; public class regexlib_8305 { /* 8305 * .+(?=((\\|\/).+){2}) * POLYNOMIAL * nums:2 * POLYNOMIAL AttackString:""+"1"*10000+"! _1SLQ_1" */ public static void main(String[] args) throws InterruptedException { String regex = ".+(?=((\\\\|\\/).+){2})"; for (int i = 0; i < 1000; i++) { StringBuilder attackString = new StringBuilder(); // 前缀 attackString.append(""); // 歧义点 for (int j = 0; j < i * 10000; j++) { attackString.append("1"); } // 后缀 attackString.append("! _1SLQ_1"); // System.out.println(attackString); long time1 = System.nanoTime(); // boolean isMatch = Pattern.matches(regex, attackString); boolean isMatch = Pattern.compile(regex).matcher(attackString).find(); long time2 = System.nanoTime(); System.out.println(i * 10000 + " " + isMatch + " " + (time2 - time1)/1e9); } } }
3e03fb06f5012e085d6a7fee4681a31e39aaf6c3
1,854
java
Java
admin-web/src/main/java/org/gourd/hu/admin/AdminWebApplication.java
GitHubCPP/spring-cloud-plus
f44194eb4fa2daa2fd645e3115c7c7888b4f7510
[ "BSD-3-Clause" ]
null
null
null
admin-web/src/main/java/org/gourd/hu/admin/AdminWebApplication.java
GitHubCPP/spring-cloud-plus
f44194eb4fa2daa2fd645e3115c7c7888b4f7510
[ "BSD-3-Clause" ]
null
null
null
admin-web/src/main/java/org/gourd/hu/admin/AdminWebApplication.java
GitHubCPP/spring-cloud-plus
f44194eb4fa2daa2fd645e3115c7c7888b4f7510
[ "BSD-3-Clause" ]
null
null
null
41.2
124
0.703883
1,654
package org.gourd.hu.admin; import lombok.extern.slf4j.Slf4j; import org.gourd.hu.core.constant.ConsoleColors; import org.springframework.boot.WebApplicationType; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.core.env.Environment; import java.net.InetAddress; import java.net.UnknownHostException; /** * 启动类 * * @author gour.hu */ @Slf4j @SpringBootApplication(scanBasePackages = {"org.gourd.hu.admin","org.gourd.hu.rbac","org.gourd.hu.demo","org.gourd.hu.sub"}) public class AdminWebApplication { public static void main(String[] args) throws UnknownHostException { /** * Springboot整合Elasticsearch 在项目启动前设置一下的属性,防止报错 * 解决netty冲突后初始化client时还会抛出异常 * java.lang.IllegalStateException: availableProcessors is already set to [4], rejecting [4] */ System.setProperty("es.set.netty.runtime.available.processors", "false"); // new application ConfigurableApplicationContext application = new SpringApplicationBuilder() .sources(AdminWebApplication.class) // default properties .properties("--spring.profiles.active=local") .web(WebApplicationType.SERVLET) .run(args); log.info(ConsoleColors.BLUE_BOLD + ">o< admin服务启动成功!温馨提示:代码千万行,注释第一行,命名不规范,同事泪两行 >o<" + ConsoleColors.RESET); Environment env = application.getEnvironment(); // 是否启用https boolean httpsFlag = Boolean.valueOf(env.getProperty("server.ssl.enabled")); log.info("接口文档: {}://{}:{}/doc.html",httpsFlag?"https":"http",InetAddress.getLocalHost().getHostAddress(), env.getProperty("server.port")); } }
3e03fb9c238e999a98371d06df1a60636bbf764f
391
java
Java
src/main/java/br/com/luizalabs/canalcomseller/wishlist/business/CustomerBusiness.java
caniss/wishlist
2f813845c4499fc562ae4cbef6a1c2470ca35f92
[ "Apache-2.0" ]
null
null
null
src/main/java/br/com/luizalabs/canalcomseller/wishlist/business/CustomerBusiness.java
caniss/wishlist
2f813845c4499fc562ae4cbef6a1c2470ca35f92
[ "Apache-2.0" ]
null
null
null
src/main/java/br/com/luizalabs/canalcomseller/wishlist/business/CustomerBusiness.java
caniss/wishlist
2f813845c4499fc562ae4cbef6a1c2470ca35f92
[ "Apache-2.0" ]
null
null
null
26.066667
63
0.772379
1,655
package br.com.luizalabs.canalcomseller.wishlist.business; import br.com.luizalabs.canalcomseller.wishlist.model.Customer; import java.util.List; public interface CustomerBusiness { public List<Customer> findAll(); public Customer findById(Long id); public Customer create(Customer customer); public Customer update(Customer customer); public void delete(Long id); }
3e03fbdf3b473ddbea0419e4fd610ac03a99706b
720
java
Java
src/main/java/net/yangboyu/pslang/Paser/ast/expressions/AssignStmt.java
jerryyangboyu/PseudoScript-programming-language
1b3f2e54a13592c98b6ed4cbbaf939e87f59172c
[ "MIT" ]
null
null
null
src/main/java/net/yangboyu/pslang/Paser/ast/expressions/AssignStmt.java
jerryyangboyu/PseudoScript-programming-language
1b3f2e54a13592c98b6ed4cbbaf939e87f59172c
[ "MIT" ]
null
null
null
src/main/java/net/yangboyu/pslang/Paser/ast/expressions/AssignStmt.java
jerryyangboyu/PseudoScript-programming-language
1b3f2e54a13592c98b6ed4cbbaf939e87f59172c
[ "MIT" ]
null
null
null
23.225806
77
0.673611
1,656
package net.yangboyu.pslang.Paser.ast.expressions; import net.yangboyu.pslang.Paser.ast.*; import net.yangboyu.pslang.Paser.util.ParseException; import net.yangboyu.pslang.Paser.util.PeekTokenIterator; public class AssignStmt extends Stmt { public AssignStmt() { super(ASTNodeTypes.ASSIGN_STMT, "assign"); } public static ASTNode parse(PeekTokenIterator it) throws ParseException { var stmt = new AssignStmt(); var factor = (Variable) Factor.parse(it, ASTNodeTypes.VARIABLE); stmt.addChild(factor); var lexeme = it.nextMatch("<-"); var expr = Expr.parse(it); stmt.addChild(expr); stmt.setLexeme(lexeme); return stmt; } }
3e03fc3db5181ac2e22b15b57baac10dab0b6d8b
2,938
java
Java
app/src/main/java/com/Devlex/iWifiFileTransfer/AnalyticsManager.java
FireNoid/Androd-Wifi-Transfer-
e3a4dfe5563e62b5fbd047a5ad99a5a780e78db4
[ "Apache-2.0" ]
1
2018-02-20T08:07:48.000Z
2018-02-20T08:07:48.000Z
app/src/main/java/com/Devlex/iWifiFileTransfer/AnalyticsManager.java
FireNoid/Androd-Wifi-Transfer
e3a4dfe5563e62b5fbd047a5ad99a5a780e78db4
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/Devlex/iWifiFileTransfer/AnalyticsManager.java
FireNoid/Androd-Wifi-Transfer
e3a4dfe5563e62b5fbd047a5ad99a5a780e78db4
[ "Apache-2.0" ]
2
2020-09-17T07:22:22.000Z
2022-02-03T08:52:27.000Z
31.255319
84
0.679714
1,657
/* * Copyright 2014 Google Inc. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.Devlex.iWifiFileTransfer; import android.app.Activity; import android.content.Context; import android.os.Bundle; import com.google.firebase.analytics.FirebaseAnalytics; import com.Devlex.iWifiFileTransfer.misc.LogUtils; import com.Devlex.iWifiFileTransfer.misc.Utils; import com.Devlex.iWifiFileTransfer.model.RootInfo; public class AnalyticsManager { private static Context sAppContext = null; private static FirebaseAnalytics mFirebaseAnalytics; private final static String TAG = LogUtils.makeLogTag(AnalyticsManager.class); public static String FILE_TYPE = "file_type"; public static String FILE_COUNT = "file_count"; public static String FILE_MOVE = "file_move"; private static boolean canSend() { return sAppContext != null && mFirebaseAnalytics != null && !BuildConfig.DEBUG ; } public static synchronized void intialize(Context context) { sAppContext = context; mFirebaseAnalytics = FirebaseAnalytics.getInstance(context); setProperty("DeviceType", Utils.getDeviceType(context)); setProperty("Rooted", Boolean.toString(Utils.isRooted())); } public static void setProperty(String propertyName, String propertyValue){ if (!canSend()) { return; } mFirebaseAnalytics.setUserProperty(propertyName, propertyValue); } public static void logEvent(String eventName){ if (!canSend()) { return; } mFirebaseAnalytics.logEvent(eventName, new Bundle()); } public static void logEvent(String eventName, Bundle params){ if (!canSend()) { return; } mFirebaseAnalytics.logEvent(eventName, params); } public static void logEvent(String eventName, RootInfo rootInfo, Bundle params){ if (!canSend()) { return; } if(null != rootInfo){ eventName = eventName + "_" + rootInfo.derivedTag; } mFirebaseAnalytics.logEvent(eventName, params); } public static void setCurrentScreen(Activity activity, String screenName){ if (!canSend()) { return; } if(null != screenName) { mFirebaseAnalytics.setCurrentScreen(activity, screenName, screenName); } } }
3e03feead770bbcb166757620bfdafb6a41e8688
1,012
java
Java
src/main/java/architecture/dashboard/Dashboard.java
AkshayModak/NextORM
9d6e5793d3e880ce2658fb9f117ad7ea5de29884
[ "MIT" ]
1
2018-01-30T18:31:56.000Z
2018-01-30T18:31:56.000Z
src/main/java/architecture/dashboard/Dashboard.java
AkshayModak/NextORM
9d6e5793d3e880ce2658fb9f117ad7ea5de29884
[ "MIT" ]
null
null
null
src/main/java/architecture/dashboard/Dashboard.java
AkshayModak/NextORM
9d6e5793d3e880ce2658fb9f117ad7ea5de29884
[ "MIT" ]
null
null
null
28.914286
79
0.655138
1,658
package architecture.dashboard; import architecture.ReadEntityDefinition; import java.util.Map; import java.util.List; import java.util.ArrayList; import java.util.stream.Collectors; public class Dashboard { public List<String> getTableNames() { ReadEntityDefinition red = new ReadEntityDefinition(); Map<String, Object> result = red.getEntityDefinition(); List<String> tableNames = new ArrayList<>(); result.forEach((key, value) -> { tableNames.add(key); }); return tableNames; } public Map<String, Object> getTableDetails(String tableName) { ReadEntityDefinition red = new ReadEntityDefinition(); Map<String, Object> result = red.getEntityDefinition(); Map<String, Object> filteredMap = result.entrySet().stream() .filter(map -> (tableName).equalsIgnoreCase(map.getKey())) .collect(Collectors.toMap(p -> p.getKey(), p -> p.getValue())); return filteredMap; } }
3e03fef7368eff030107af039060db7fed9fd035
407
java
Java
src/main/java/swing/ColumnDataSwap/src/com/js/main/TableSwapMain.java
JS3322/pattern_java
0435970a809c6845d5dedeeab0234605c6098f9c
[ "MIT" ]
null
null
null
src/main/java/swing/ColumnDataSwap/src/com/js/main/TableSwapMain.java
JS3322/pattern_java
0435970a809c6845d5dedeeab0234605c6098f9c
[ "MIT" ]
null
null
null
src/main/java/swing/ColumnDataSwap/src/com/js/main/TableSwapMain.java
JS3322/pattern_java
0435970a809c6845d5dedeeab0234605c6098f9c
[ "MIT" ]
null
null
null
18.5
52
0.700246
1,659
/** * @Process: complete * @Project_Name: module * @Package_Name: swing.ColumnDataSwap * @Made_By: JS * @The_creation_time: - * @File_Name: TableSwapMain.java * @Version : v11.0.12 * @contents: - */ package swing.ColumnDataSwap.src.com.js.main; import swing.ColumnDataSwap.src.com.js.ui.TableSwap; public class TableSwapMain { public static void main(String[] args) { new TableSwap(); } }
3e03ff562e1e84e562d3919c759b5e1279211015
1,073
java
Java
client/src/it/castelli/connection/messages/VoteKickClientMessage.java
LucaVaccari/MonopolyFX
a0e742745d64b68c6e765093df682cff1868850d
[ "MIT" ]
1
2021-04-20T11:11:07.000Z
2021-04-20T11:11:07.000Z
client/src/it/castelli/connection/messages/VoteKickClientMessage.java
LucaVaccari/MonopolyFX
a0e742745d64b68c6e765093df682cff1868850d
[ "MIT" ]
null
null
null
client/src/it/castelli/connection/messages/VoteKickClientMessage.java
LucaVaccari/MonopolyFX
a0e742745d64b68c6e765093df682cff1868850d
[ "MIT" ]
1
2021-03-14T16:51:20.000Z
2021-03-14T16:51:20.000Z
22.354167
119
0.71575
1,660
package it.castelli.connection.messages; import it.castelli.connection.Connection; import it.castelli.gameLogic.Player; /** * Message that adds a vote to the given player, if the number of votes is high enough the player will be removed (send * only) */ public class VoteKickClientMessage implements Message { /** * The player to kick */ private final Player player; /** * Is the request to kick the player? (if false this message will remove the vote previously added) */ private final boolean kick; /** * The game code */ private final int gameCode; /** * Constructor for VotekickClientMessage * * @param player The player to kick * @param kick Is the request to kick the player? (if false this message will remove the vote previously added) * @param gameCode The game code */ public VoteKickClientMessage(Player player, boolean kick, int gameCode) { this.player = player; this.kick = kick; this.gameCode = gameCode; } @Override public void onReceive(Connection connection, Player player) { // do nothing } }
3e04001c482a2ae2309383d437750d94a670f32e
224
java
Java
src/main/java/com/softwareverde/http/server/servlet/routed/Environment.java
SoftwareVerde/http-servlet
1789bbc6250856c9c987f5391eb35f347da0878d
[ "MIT" ]
4
2017-03-04T15:18:44.000Z
2021-07-22T04:41:18.000Z
src/main/java/com/softwareverde/http/server/servlet/routed/Environment.java
baby636/http-servlet
19154700b94d15773558cea6f268b94ccdf29807
[ "MIT" ]
null
null
null
src/main/java/com/softwareverde/http/server/servlet/routed/Environment.java
baby636/http-servlet
19154700b94d15773558cea6f268b94ccdf29807
[ "MIT" ]
1
2021-07-22T04:41:25.000Z
2021-07-22T04:41:25.000Z
28
127
0.772321
1,661
package com.softwareverde.http.server.servlet.routed; /** * <p>A container for any application-level objects and configuration, intended to be fully customized by each application.</p> */ public interface Environment { }
3e04001e27837f963b9855ca1dda85c95695d75f
1,255
java
Java
UltimateRecyclerView/ultimaterecyclerview/src/main/java/com/marshalchen/ultimaterecyclerview/dragsortadapter/NoForegroundShadowBuilder.java
vanshg/UltimateRecyclerView
301f80aae25997101aebff499c367d93e042cae9
[ "Apache-2.0" ]
8,454
2015-01-28T03:07:55.000Z
2022-03-31T08:53:53.000Z
UltimateRecyclerView/ultimaterecyclerview/src/main/java/com/marshalchen/ultimaterecyclerview/dragsortadapter/NoForegroundShadowBuilder.java
vanshg/UltimateRecyclerView
301f80aae25997101aebff499c367d93e042cae9
[ "Apache-2.0" ]
428
2015-02-15T16:26:41.000Z
2020-11-19T18:58:55.000Z
UltimateRecyclerView/ultimaterecyclerview/src/main/java/com/marshalchen/ultimaterecyclerview/dragsortadapter/NoForegroundShadowBuilder.java
vanshg/UltimateRecyclerView
301f80aae25997101aebff499c367d93e042cae9
[ "Apache-2.0" ]
1,868
2015-02-16T06:50:15.000Z
2022-02-16T08:38:07.000Z
28.522727
88
0.705179
1,662
package com.marshalchen.ultimaterecyclerview.dragsortadapter; import android.graphics.Canvas; import android.graphics.Point; import android.graphics.drawable.Drawable; import androidx.annotation.NonNull; import android.util.Log; import android.view.View; import android.widget.FrameLayout; import java.lang.ref.WeakReference; public class NoForegroundShadowBuilder extends DragSortShadowBuilder { private final WeakReference<View> viewRef; public NoForegroundShadowBuilder(View view, Point touchPoint) { super(view, touchPoint); this.viewRef = new WeakReference<>(view); } @Override public void onDrawShadow(@NonNull Canvas canvas) { final View view = viewRef.get(); if (view != null) { Drawable foreground = null; // remove foreground before canvas draw if (view instanceof FrameLayout && ((FrameLayout) view).getForeground() != null) { foreground = ((FrameLayout) view).getForeground(); ((FrameLayout) view).setForeground(null); } view.draw(canvas); // reset foreground if it was removed if (foreground != null) { ((FrameLayout) view).setForeground(foreground); } } else { Log.e(TAG, "Asked to draw drag shadow but no view"); } } }
3e040059de08fc021f5ccb72326c4e2e6711bc09
2,628
java
Java
component/module_home/src/main/java/com/component/preject/home/http/api/ApiService.java
youlongxifeng/NewComponent
a76c4df7f7739d9f73cde083daf43fa1ad11b622
[ "Apache-2.0" ]
null
null
null
component/module_home/src/main/java/com/component/preject/home/http/api/ApiService.java
youlongxifeng/NewComponent
a76c4df7f7739d9f73cde083daf43fa1ad11b622
[ "Apache-2.0" ]
null
null
null
component/module_home/src/main/java/com/component/preject/home/http/api/ApiService.java
youlongxifeng/NewComponent
a76c4df7f7739d9f73cde083daf43fa1ad11b622
[ "Apache-2.0" ]
null
null
null
26.019802
130
0.678082
1,663
package com.component.preject.home.http.api; import com.component.preject.home.bean.HomeArticleData; import com.component.preject.home.bean.HomeArticleListData; import com.component.preject.home.bean.HomePageBannerModel; import com.component.preject.home.bean.KnowledgeHierarchyData; import com.component.preject.home.bean.NavigationListData; import com.component.preject.home.bean.ProjectClassifyData; import com.component.preject.home.bean.ResponseBean; import java.util.List; import io.reactivex.Observable; import retrofit2.http.GET; import retrofit2.http.Path; import retrofit2.http.Query; /** * @ProjectName: NewComponent * @Package: com.component.preject.home.http.api * @ClassName: ApiService * @Author: xzg * @CreateDate: 2019-08-28 15:55 * @UpdateUser: 更新者 * @UpdateDate: 2019-08-28 15:55 * @UpdateRemark: 更新说明 * @Version: 1.0 * @description: (java类作用描述) */ public interface ApiService { /** * 获取公众号列表 * @return */ @GET("/wxarticle/chapters/json") Observable<ResponseBean<List<KnowledgeHierarchyData>>> getWxArticle(); /** * 项目分类 项目为包含一个分类,该接口返回整个分类。 * @return */ @GET("/project/tree/json") Observable<ResponseBean<List<ProjectClassifyData>>>getProjectClassifyData(); /** * 最新项目tab (首页的第二个tab) * @param pageNum 页码,拼接在连接中,从0开始。 * @return */ @GET("/article/listproject/{pageNum}/json") Observable<ResponseBean<HomeArticleListData>>getHomeArticleListProjectData(@Path("pageNum")int pageNum ); /** * 获取首页Banner数据 * @return */ @GET("/banner/json") Observable<ResponseBean<List<HomePageBannerModel>>>getHomePageBannerData(); /** * 置顶文章 * @return */ @GET("/article/top/json") Observable<ResponseBean<List<HomeArticleData>>>homeTopArticleData(); /** * 根据知识体系 id 获取知识体系下的文章 * @param pageNum 页码:拼接在链接上,从0开始 * @param cid 分类的id 上述二级目录的id * @return */ @GET("/article/list/{pageNum}/json") Observable<ResponseBean<HomeArticleListData>> getKnowledgeTreeDetailData(@Path("pageNum") int pageNum, @Query("cid") int cid); /** * 获取首页文章数据列表 * @return */ @GET("/article/list/{pageNum}/json") Observable<ResponseBean<HomeArticleListData>>getHomeArticleListData(@Path("pageNum")int pageNum ); /** * 体系数据 */ @GET("tree/json") Observable<ResponseBean<List<KnowledgeHierarchyData>>> getKnowledgeList(); /** * 导航数据 * @return */ /** * 获取导航数据 * @return */ @GET("/navi/json") Observable<ResponseBean<List<NavigationListData>>>getNavigationListData(); }
3e04016a9f20666d89eb66d9094dadcfd890178a
1,732
java
Java
gov.nasa.arc.verve.freeflyer.workbench/src/gov/nasa/arc/verve/freeflyer/workbench/widget/SetCheckObstaclesWidget.java
InnovativeDigitalSolution/NASA_astrobee_gds
1945c7cf63ef526efaf975137102cdc6cad4640f
[ "Apache-2.0" ]
9
2019-10-01T20:50:35.000Z
2022-02-24T10:45:55.000Z
gov.nasa.arc.verve.freeflyer.workbench/src/gov/nasa/arc/verve/freeflyer/workbench/widget/SetCheckObstaclesWidget.java
InnovativeDigitalSolution/NASA_astrobee_gds
1945c7cf63ef526efaf975137102cdc6cad4640f
[ "Apache-2.0" ]
null
null
null
gov.nasa.arc.verve.freeflyer.workbench/src/gov/nasa/arc/verve/freeflyer/workbench/widget/SetCheckObstaclesWidget.java
InnovativeDigitalSolution/NASA_astrobee_gds
1945c7cf63ef526efaf975137102cdc6cad4640f
[ "Apache-2.0" ]
10
2019-10-01T20:50:36.000Z
2021-06-13T01:37:46.000Z
32.679245
79
0.680716
1,664
/****************************************************************************** * Copyright © 2019, United States Government, as represented by the * Administrator of the National Aeronautics and Space Administration. All * rights reserved. * * The Astrobee Control Station 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. *****************************************************************************/ package gov.nasa.arc.verve.freeflyer.workbench.widget; import org.eclipse.core.databinding.observable.Realm; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; public class SetCheckObstaclesWidget extends AbstractFreeFlyerWidget { private Button checkCheckbox; public SetCheckObstaclesWidget(Composite parent, int style) { super(parent, style); } @Override void setupCustomControls() { checkCheckbox = new Button(this, SWT.CHECK); checkCheckbox.setText("Check Obstacles"); } @Override public boolean bindUI(Realm realm) { if (getModel() == null){ setBound(false); return false; } updateNonBoundFields(); boolean result = true; result &= bind("checkObstacles", checkCheckbox); return result; } }
3e040259b9db7982656d6c98d5ffd88962d1c91c
4,565
java
Java
src/main/java/br/edu/utfpr/cp/espjava/crudcidades/cidade/CidadeController.java
fpreviatti/Crud-Cidades
039eea056a14de33cb00f7f87a92e1012509fcbb
[ "MIT" ]
null
null
null
src/main/java/br/edu/utfpr/cp/espjava/crudcidades/cidade/CidadeController.java
fpreviatti/Crud-Cidades
039eea056a14de33cb00f7f87a92e1012509fcbb
[ "MIT" ]
null
null
null
src/main/java/br/edu/utfpr/cp/espjava/crudcidades/cidade/CidadeController.java
fpreviatti/Crud-Cidades
039eea056a14de33cb00f7f87a92e1012509fcbb
[ "MIT" ]
null
null
null
31.482759
117
0.601533
1,665
package br.edu.utfpr.cp.espjava.crudcidades.cidade; import java.security.Principal; import java.time.LocalDateTime; import java.util.HashSet; import java.util.Set; import java.util.stream.Collectors; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.*; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import javax.validation.Valid; @Controller public class CidadeController { private Set<Cidade> cidades; private final CidadeRepository repository; public CidadeController(CidadeRepository repository) { cidades = new HashSet<>(); this.repository = repository; } @GetMapping("/") public String listar(Model memoria, Principal usuario, HttpSession sessao, HttpServletResponse response) { memoria.addAttribute("listaCidades", repository .findAll() .stream() .map(cidade -> new Cidade(cidade.getNome(),cidade.getEstado())) .collect(Collectors.toList())); response.addCookie(new Cookie("listar", LocalDateTime.now().toString())); sessao.setAttribute("usuarioAtual", usuario.getName()); return "/crud"; } @PostMapping("/criar") public String criar(@Valid Cidade cidade, BindingResult validacao, Model memoria, HttpServletResponse response) { if (validacao.hasErrors()){ validacao .getFieldErrors() .forEach(error -> memoria.addAttribute( error.getField(), error.getDefaultMessage()) ); response.addCookie(new Cookie("criar", LocalDateTime.now().toString())); memoria.addAttribute("nomeInformado", cidade.getNome()); memoria.addAttribute("estadoInformado", cidade.getEstado()); memoria.addAttribute("listaCidades", cidades); return ("/crud"); } else{ var cidadeAtual = repository.findByNomeAndEstado(cidade.getNome(),cidade.getEstado()); if(!cidadeAtual.isPresent()){ repository.save(cidade.clonar()); } } return "redirect:/"; } @GetMapping("/excluir") public String excluir( @RequestParam String nome, @RequestParam String estado, HttpServletResponse response) { response.addCookie(new Cookie("excluir", LocalDateTime.now().toString())); var cidadeEstadoEncontrada = repository.findByNomeAndEstado(nome,estado); cidadeEstadoEncontrada.ifPresent(repository::delete); return "redirect:/"; } @GetMapping("/preparaAlterar") public String preparaAlterar( @RequestParam String nome, @RequestParam String estado, Model memoria) { var cidadeAtual = repository.findByNomeAndEstado(nome,estado); cidadeAtual.ifPresent(cidadeEncontrada -> { memoria.addAttribute("cidadeAtual", cidadeEncontrada); memoria.addAttribute("listaCidades", repository.findAll()); }); return "/crud"; } @PostMapping("/alterar") public String alterar( @RequestParam String nomeAtual, @RequestParam String estadoAtual, Cidade cidade, HttpServletResponse response) { response.addCookie(new Cookie("alterar", LocalDateTime.now().toString())); var cidadeAtual = repository.findByNomeAndEstado(nomeAtual, estadoAtual); if(cidadeAtual.isPresent()){ var cidadeEncontrada = cidadeAtual.get(); cidadeEncontrada.setNome(cidade.getNome()); cidadeEncontrada.setEstado(cidade.getEstado()); repository.saveAndFlush(cidadeEncontrada); } return "redirect:/"; } @GetMapping("/mostrar") @ResponseBody public String mostraCookieAlterar(@CookieValue String listar){ return "Último acesso ao método listar(): " +listar; } @PostMapping("/limpar") public String limpar(){ repository.deleteAll(); return "redirect:/"; } }
3e040261d6bb6d0a118776e9a17e2099fa86865e
1,015
java
Java
src/main/java/mcjty/immcraft/blocks/shelf/BookshelfTESR.java
McJty/ImmersiveCraft
cd7dbba7170be5c48b5c982be173e14b639cf0f9
[ "MIT" ]
7
2016-01-29T23:49:44.000Z
2017-11-09T00:18:07.000Z
src/main/java/mcjty/immcraft/blocks/shelf/BookshelfTESR.java
McJty/ImmersiveCraft
cd7dbba7170be5c48b5c982be173e14b639cf0f9
[ "MIT" ]
39
2016-02-04T20:08:10.000Z
2018-05-09T20:49:10.000Z
src/main/java/mcjty/immcraft/blocks/shelf/BookshelfTESR.java
McJty/ImmersiveCraft
cd7dbba7170be5c48b5c982be173e14b639cf0f9
[ "MIT" ]
10
2016-02-07T13:40:52.000Z
2018-01-22T15:26:50.000Z
26.710526
93
0.749754
1,666
package mcjty.immcraft.blocks.shelf; import mcjty.immcraft.ImmersiveCraft; import mcjty.immcraft.api.IImmersiveCraft; import mcjty.immcraft.api.rendering.HandleTESR; import mcjty.immcraft.blocks.ModBlocks; import net.minecraft.util.math.Vec3d; import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import javax.annotation.Nonnull; @SideOnly(Side.CLIENT) public class BookshelfTESR extends HandleTESR<BookshelfTE> { public BookshelfTESR() { super(ModBlocks.bookshelfBlock); textOffset = new Vec3d(0, 0, -.2); } @Nonnull @Override protected IImmersiveCraft getApi() { return ImmersiveCraft.api; } @Override protected void renderHandles(BookshelfTE tileEntity) { super.renderHandles(tileEntity); } public static void register() { ClientRegistry.bindTileEntitySpecialRenderer(BookshelfTE.class, new BookshelfTESR()); } }
3e0402cca9a30e20bd460e7c2cb22272536c1671
2,076
java
Java
src/controller/MobileSaveController.java
Horace-hr/poem
fae2c923238266b7d5c691655974a23a2618916b
[ "Apache-2.0" ]
2
2018-08-23T16:37:23.000Z
2019-07-08T16:36:59.000Z
src/controller/MobileSaveController.java
Horace-hr/poem
fae2c923238266b7d5c691655974a23a2618916b
[ "Apache-2.0" ]
null
null
null
src/controller/MobileSaveController.java
Horace-hr/poem
fae2c923238266b7d5c691655974a23a2618916b
[ "Apache-2.0" ]
null
null
null
25.317073
90
0.686898
1,667
package controller; import model.BuyRecord; import model.Comment; import model.History; import model.Novel; import model.OriginalPoem; import model.Recharge; import model.SignIn; import model.Statistic; import model.User; import com.alibaba.fastjson.JSONObject; import com.google.gson.JsonObject; import com.jfinal.aop.Clear; import config.BaseController; public class MobileSaveController extends BaseController { //保存用户阅读历史记录 public void history() { renderJson(History.dao.save(getUserCookie() , getPara("poemId") , getParaToInt("chapterNum",1) ,getParaToBoolean("isFavorite",false) )); } //保存用户的原创诗词 public void createPoem() { renderJson(OriginalPoem.dao.save(getModel(OriginalPoem.class,"x") , getUserCookie())); } //保存用户评论 public void comment() { renderJson(Comment.dao.save(getModel(Comment.class,"x") , getUserCookie() )); } //保存用户购买记录 public void buyRecord() { renderJson(enhance(BuyRecord.class).save(getPara("chapterId") , getUserCookie() )); } //保存用户签到记录,并奖励积分 public void signIn() { renderJson(SignIn.dao.save(getUserCookie())); } //积分兑换读书币 public void exchangeCoins() { renderJson(User.dao.exchangeCoins(getUserCookie())); } //充值订单 public void recharge() { System.out.println("进入充值方法"); System.out.println("getPara()----》"+getPara()); int amount = getParaToInt("amount") ; //String chapters = getPara("chapterId") ; //用户章节信息,此处接收的是章节的number-novelId int type = getParaToInt("type",1); int payType = getParaToInt("payType" , 2 ); String userId = getUserCookie() ; if (!User.dao.checkToken(User.dao.findByIdInCache(userId))) { renderHtml("账户信息异常,请联系管理员"); return ; } JSONObject jsonObject = Recharge.dao.save(getUserCookie() , amount, type ) ; jsonObject.put("payType", payType) ; renderJson(jsonObject); } //统计小说阅读次数 public void readTimes() { renderJson(Novel.dao.readTimes(getPara("id"))) ; } public void pv() { renderJson(Statistic.dao.savePvInCache(getUserCookie())) ; } }
3e0402d1b60eb5bd119d95d7e7ce144223d923f7
2,083
java
Java
extensions-core/s3-extensions/src/main/java/org/apache/druid/storage/s3/ServerSideEncryption.java
anshulsaini12/incubator-druid
7c19c92a81d33a510cd93f9bd4a448334204982d
[ "Apache-2.0" ]
5,813
2015-01-01T14:14:54.000Z
2018-07-06T11:13:03.000Z
extensions-core/s3-extensions/src/main/java/org/apache/druid/storage/s3/ServerSideEncryption.java
anshulsaini12/incubator-druid
7c19c92a81d33a510cd93f9bd4a448334204982d
[ "Apache-2.0" ]
4,320
2015-01-02T18:37:24.000Z
2018-07-06T14:51:01.000Z
extensions-core/s3-extensions/src/main/java/org/apache/druid/storage/s3/ServerSideEncryption.java
anshulsaini12/incubator-druid
7c19c92a81d33a510cd93f9bd4a448334204982d
[ "Apache-2.0" ]
1,601
2015-01-05T05:37:05.000Z
2018-07-06T11:13:04.000Z
33.596774
77
0.764282
1,668
/* * 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.druid.storage.s3; import com.amazonaws.services.s3.model.CopyObjectRequest; import com.amazonaws.services.s3.model.GetObjectMetadataRequest; import com.amazonaws.services.s3.model.GetObjectRequest; import com.amazonaws.services.s3.model.PutObjectRequest; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonSubTypes.Type; import com.fasterxml.jackson.annotation.JsonTypeInfo; /** * Server-side encryption decorator for Amazon S3. */ @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type") @JsonSubTypes(value = { @Type(name = "noop", value = NoopServerSideEncryption.class), @Type(name = "s3", value = S3ServerSideEncryption.class), @Type(name = "kms", value = KmsServerSideEncryption.class), @Type(name = "custom", value = CustomServerSideEncryption.class) }) public interface ServerSideEncryption { default PutObjectRequest decorate(PutObjectRequest request) { return request; } default GetObjectRequest decorate(GetObjectRequest request) { return request; } default GetObjectMetadataRequest decorate(GetObjectMetadataRequest request) { return request; } default CopyObjectRequest decorate(CopyObjectRequest request) { return request; } }
3e04037594a9ab81fb7a136bb1a8840cfadde983
1,299
java
Java
quickfixj-spring-boot-actuator/src/test/java/io/allune/quickfixj/spring/boot/actuate/config/QuickFixJClientEndpointAutoConfigurationTest.java
peyerroger/quickfixj-spring-boot-starter
86c791c126bdce915c2a670a479860dfb349926e
[ "Apache-2.0" ]
1
2020-12-06T04:24:59.000Z
2020-12-06T04:24:59.000Z
quickfixj-spring-boot-actuator/src/test/java/io/allune/quickfixj/spring/boot/actuate/config/QuickFixJClientEndpointAutoConfigurationTest.java
chrjohn/quickfixj-spring-boot-starter
b0941ce1ca7ae20d4358743b1b982b1b0f992bb0
[ "Apache-2.0" ]
null
null
null
quickfixj-spring-boot-actuator/src/test/java/io/allune/quickfixj/spring/boot/actuate/config/QuickFixJClientEndpointAutoConfigurationTest.java
chrjohn/quickfixj-spring-boot-starter
b0941ce1ca7ae20d4358743b1b982b1b0f992bb0
[ "Apache-2.0" ]
null
null
null
29.522727
80
0.817552
1,669
package io.allune.quickfixj.spring.boot.actuate.config; import static org.assertj.core.api.Assertions.assertThat; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.annotation.Configuration; import org.springframework.test.context.junit4.SpringRunner; import io.allune.quickfixj.spring.boot.actuate.endpoint.QuickFixJClientEndpoint; import io.allune.quickfixj.spring.boot.starter.EnableQuickFixJClient; /** * @author Eduardo Sanchez-Ros */ @RunWith(SpringRunner.class) @SpringBootTest( properties = { "quickfixj.client.autoStartup=false", "quickfixj.client.config=classpath:quickfixj.cfg", "quickfixj.client.jmx-enabled=true" }) public class QuickFixJClientEndpointAutoConfigurationTest { @Autowired private QuickFixJClientEndpoint quickfixjClientEndpoint; @Test public void testAutoConfiguredBeans() { assertThat(quickfixjClientEndpoint).isNotNull(); assertThat(quickfixjClientEndpoint.readProperties().size()).isEqualTo(0); } @Configuration @EnableAutoConfiguration @EnableQuickFixJClient public static class Config { } }
3e0404808de6c091f7aef0b0f980c3f04f042346
664
java
Java
fermat-api/src/main/java/com/bitdubai/fermat_api/layer/all_definition/money/CryptoMoney.java
nattyco/fermatold
2b43a5504ecaba747b8d54676b93c98d378ba5d6
[ "MIT" ]
3
2016-03-23T05:26:51.000Z
2016-03-24T14:33:05.000Z
fermat-api/src/main/java/com/bitdubai/fermat_api/layer/all_definition/money/CryptoMoney.java
yalayn/fermat
f0a912adb66a439023ec4e70b821ba397e0f7760
[ "MIT" ]
17
2015-11-20T20:43:17.000Z
2016-07-25T20:35:49.000Z
fermat-api/src/main/java/com/bitdubai/fermat_api/layer/all_definition/money/CryptoMoney.java
yalayn/fermat
f0a912adb66a439023ec4e70b821ba397e0f7760
[ "MIT" ]
26
2015-11-20T13:20:23.000Z
2022-03-11T07:50:06.000Z
23.714286
73
0.77259
1,670
package com.bitdubai.fermat_api.layer.all_definition.money; import com.bitdubai.fermat_api.layer.all_definition.enums.CryptoCurrency; /** * Created by ciencias on 22.12.14. */ public class CryptoMoney implements Money { private CryptoCurrency mCryptoCurrency; private double mCryptoAmount; public CryptoCurrency getmCryptoCurrency() { return mCryptoCurrency; } public void setmCryptoCurrency(CryptoCurrency mCryptoCurrency) { this.mCryptoCurrency = mCryptoCurrency; } public double getmCryptoAmount() { return mCryptoAmount; } public void setmCryptoAmount(double mCryptoAmount) { this.mCryptoAmount = mCryptoAmount; } }
3e040517c56212246c22bde2807bf44af0689a5d
6,636
java
Java
core/src/main/java/org/polypheny/db/adapter/DataContext.java
ppanopticon/Polypheny-DB
e76e0ad26634d6cd93fbbea187bbaac431f0bbea
[ "Apache-2.0" ]
75
2020-01-24T15:30:17.000Z
2022-03-30T02:01:13.000Z
core/src/main/java/org/polypheny/db/adapter/DataContext.java
ppanopticon/Polypheny-DB
e76e0ad26634d6cd93fbbea187bbaac431f0bbea
[ "Apache-2.0" ]
194
2019-12-06T19:24:48.000Z
2022-03-31T05:52:05.000Z
core/src/main/java/org/polypheny/db/adapter/DataContext.java
ppanopticon/Polypheny-DB
e76e0ad26634d6cd93fbbea187bbaac431f0bbea
[ "Apache-2.0" ]
44
2021-02-19T11:38:36.000Z
2022-03-31T06:11:54.000Z
27.308642
215
0.630199
1,671
/* * Copyright 2019-2020 The Polypheny 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 org.polypheny.db.adapter; import com.google.common.base.CaseFormat; import java.io.InputStream; import java.io.OutputStream; import java.io.Serializable; import java.lang.reflect.Modifier; import java.util.List; import java.util.Map; import java.util.TimeZone; import java.util.concurrent.atomic.AtomicBoolean; import lombok.Data; import org.apache.calcite.linq4j.QueryProvider; import org.apache.calcite.linq4j.tree.Expressions; import org.apache.calcite.linq4j.tree.ParameterExpression; import org.polypheny.db.adapter.java.JavaTypeFactory; import org.polypheny.db.rel.type.RelDataType; import org.polypheny.db.schema.SchemaPlus; import org.polypheny.db.sql.advise.SqlAdvisor; import org.polypheny.db.transaction.Statement; /** * Runtime context allowing access to the tables in a database. */ public interface DataContext { ParameterExpression ROOT = Expressions.parameter( Modifier.FINAL, DataContext.class, "root" ); /** * Returns a sub-schema with a given name, or null. */ SchemaPlus getRootSchema(); /** * Returns the type factory. */ JavaTypeFactory getTypeFactory(); /** * Returns the query provider. */ QueryProvider getQueryProvider(); /** * Returns a context variable. * * Supported variables include: "sparkContext", "currentTimestamp", "localTimestamp". * * @param name Name of variable */ Object get( String name ); void addAll( Map<String, Object> map ); Statement getStatement(); void addParameterValues( long index, RelDataType type, List<Object> data ); RelDataType getParameterType( long index ); List<Map<Long, Object>> getParameterValues(); default void resetParameterValues() { throw new UnsupportedOperationException(); } default Object getParameterValue( long index ) { if ( getParameterValues().size() != 1 ) { throw new RuntimeException( "Illegal number of parameter sets" ); } return getParameterValues().get( 0 ).get( index ); } @Data class ParameterValue { private final long index; private final RelDataType type; private final Object value; } /** * Variable that may be asked for in a call to {@link DataContext#get}. */ enum Variable { UTC_TIMESTAMP( "utcTimestamp", Long.class ), /** * The time at which the current statement started executing. In milliseconds after 1970-01-01 00:00:00, UTC. Required. */ CURRENT_TIMESTAMP( "currentTimestamp", Long.class ), /** * The time at which the current statement started executing. In milliseconds after 1970-01-01 00:00:00, in the time zone of the current * statement. Required. */ LOCAL_TIMESTAMP( "localTimestamp", Long.class ), /** * The Spark engine. Available if Spark is on the class path. */ SPARK_CONTEXT( "sparkContext", Object.class ), /** * A mutable flag that indicates whether user has requested that the current statement be canceled. Cancellation may not be immediate, but implementations of relational operators should check the flag fairly * frequently and cease execution (e.g. by returning end of data). */ CANCEL_FLAG( "cancelFlag", AtomicBoolean.class ), /** * Query timeout in milliseconds. When no timeout is set, the value is 0 or not present. */ TIMEOUT( "timeout", Long.class ), /** * Advisor that suggests completion hints for SQL statements. */ SQL_ADVISOR( "sqlAdvisor", SqlAdvisor.class ), /** * Writer to the standard error (stderr). */ STDERR( "stderr", OutputStream.class ), /** * Reader on the standard input (stdin). */ STDIN( "stdin", InputStream.class ), /** * Writer to the standard output (stdout). */ STDOUT( "stdout", OutputStream.class ), /** * Time zone in which the current statement is executing. Required; defaults to the time zone of the JVM if the connection does not specify a time zone. */ TIME_ZONE( "timeZone", TimeZone.class ); public final String camelName; public final Class clazz; Variable( String camelName, Class clazz ) { this.camelName = camelName; this.clazz = clazz; assert camelName.equals( CaseFormat.UPPER_UNDERSCORE.to( CaseFormat.LOWER_CAMEL, name() ) ); } /** * Returns the value of this variable in a given data context. */ public <T> T get( DataContext dataContext ) { //noinspection unchecked return (T) clazz.cast( dataContext.get( camelName ) ); } } /** * Implementation of {@link DataContext} that has few variables and is {@link Serializable}. For Spark. */ class SlimDataContext implements DataContext, Serializable { @Override public SchemaPlus getRootSchema() { return null; } @Override public JavaTypeFactory getTypeFactory() { return null; } @Override public QueryProvider getQueryProvider() { return null; } @Override public Object get( String name ) { return null; } @Override public void addAll( Map<String, Object> map ) { } @Override public Statement getStatement() { return null; } @Override public void addParameterValues( long index, RelDataType type, List<Object> data ) { } @Override public RelDataType getParameterType( long index ) { return null; } @Override public List<Map<Long, Object>> getParameterValues() { return null; } } }
3e04058f9a3dce06989d1e9871ea713ddffea294
410
java
Java
Java/99_All/CommentDemo.java
VisualAcademy/Java
3688045e68042c8eb80d8890fb811180ec2b214d
[ "MIT" ]
null
null
null
Java/99_All/CommentDemo.java
VisualAcademy/Java
3688045e68042c8eb80d8890fb811180ec2b214d
[ "MIT" ]
null
null
null
Java/99_All/CommentDemo.java
VisualAcademy/Java
3688045e68042c8eb80d8890fb811180ec2b214d
[ "MIT" ]
1
2020-11-19T07:12:02.000Z
2020-11-19T07:12:02.000Z
16.4
56
0.560976
1,672
/* 멀티라인 주석 제 목 : 주석문(Comment;코드설명문) 작성자 : 박용준 작성일 : 2011-05-10 */ // 싱글라인 주석 // 클래스 public class CommentDemo { // 메인 메서드 : 엔트리 포인트 : 자바 프로그램의 시작점 public static void main(String[] args) { // 특정 블록을 멀티라인 주석으로 => Ctrl+Shift+/ <=> Ctrl+Shift+\ System.out.println("안녕하세요."); int i = 1234; // 특정 블록을 싱글라인 주석으로 => Ctrl+/ <=> 동일 System.out.println("안녕하세요."); int j = 1234; } }
3e0405ac5f601331429e2dd884c221e4a447da68
3,769
java
Java
ViMixerUI/src/com/openthinks/vimixer/ui/controller/BaseController.java
daileyet/ViMixer
8ff0012f73fecd489207c6467186cf557fa19ef3
[ "Apache-2.0" ]
2
2016-06-06T06:43:32.000Z
2017-04-27T07:06:13.000Z
ViMixerUI/src/com/openthinks/vimixer/ui/controller/BaseController.java
daileyet/ViMixer
8ff0012f73fecd489207c6467186cf557fa19ef3
[ "Apache-2.0" ]
1
2015-08-20T13:34:28.000Z
2015-08-20T13:34:28.000Z
ViMixerUI/src/com/openthinks/vimixer/ui/controller/BaseController.java
daileyet/ViMixer
8ff0012f73fecd489207c6467186cf557fa19ef3
[ "Apache-2.0" ]
null
null
null
26.921429
87
0.722473
1,673
/** * */ package com.openthinks.vimixer.ui.controller; import java.io.File; import java.io.FileNotFoundException; import java.net.URL; import java.util.Locale; import java.util.Observable; import java.util.Observer; import java.util.ResourceBundle; import java.util.prefs.Preferences; import javax.xml.bind.JAXBException; import com.openthinks.libs.i18n.I18n; import com.openthinks.libs.i18n.I18nApplicationLocale; import com.openthinks.vimixer.ViMixerApp; import com.openthinks.vimixer.ViMixerApp.TransferData; import com.openthinks.vimixer.resources.bundles.ViMixerBundles; import com.openthinks.vimixer.ui.model.ViFile; import com.openthinks.vimixer.ui.model.configure.ViMixerConfigure; import javafx.application.Application; import javafx.beans.property.ObjectProperty; import javafx.collections.ObservableList; import javafx.fxml.Initializable; import javafx.stage.Stage; /** * Base controller for common method and attribute * @author minjdai * @since v1.0 */ public abstract class BaseController implements Initializable, Observer { private static final String PREF_FILE = "filePath"; private TransferData transfer; protected ResourceBundle resourceBundle; public final void setTransfer(final TransferData transfer) { this.beforeSetTransfer(); this.transfer = transfer; this.afterSetTransfer(); } @Override public void initialize(URL location, ResourceBundle resources) { I18nApplicationLocale.getInstance().addObserver(this); this.resourceBundle = resources; } @Override public void update(Observable o, Object newlocale) { this.resourceBundle = I18n.getResourceBundle(ViMixerBundles.UI, (Locale) newlocale); } protected String getBundleMessage(String bundleKey) { if (this.resourceBundle == null) { return ""; } return this.resourceBundle.getString(bundleKey); } protected void afterSetTransfer() { } protected void beforeSetTransfer() { } public final Application app() { return transfer.app(); } public final ObjectProperty<ObservableList<ViFile>> listProperty() { return transfer.listProperty(); } public final ViMixerConfigure configure() { return transfer.configure(); } public final Stage stage() { return transfer.stage(); } public final File lastConfigureFile() { Preferences preferences = Preferences.userNodeForPackage(ViMixerApp.class); String filePath = preferences.get(PREF_FILE, null); if (filePath != null) { return new File(filePath); } return null; } private final void storeConfigurePath(File file) { Preferences preferences = Preferences.userNodeForPackage(ViMixerApp.class); if (file != null) { preferences.put(PREF_FILE, file.getPath()); configure().setStoredFile(file.getAbsolutePath()); } else { preferences.remove(PREF_FILE); configure().setStoredFile(null); } } /** * @param file */ public final void loadConfigure(File file) { if (file != null) { try { ViMixerConfigure loadCconfigure = ViMixerConfigure.unmarshal(file); configure().setConfigureName(loadCconfigure.getConfigureName()); configure().setSecretKey(loadCconfigure.getSecretKey()); configure().setTempSecretKey(loadCconfigure.getSecretKey()); configure().setSegmentor(loadCconfigure.getSegmentor()); this.storeConfigurePath(file); } catch (Exception e) { e.printStackTrace(); } } } /** * @param file */ public final void saveConfigure(File file) { if (file != null) { try { ViMixerConfigure.marshal(this.configure(), file); this.storeConfigurePath(file); } catch (FileNotFoundException | JAXBException e) { e.printStackTrace(); } } } }
3e0405d0a80bca117baa26cbec762ea8c811fb0d
253
java
Java
app/com/learning/api/controllers/ProductController.java
frankhn/e-commerce-play
1ed0b220fb52ba3f3e1ef101f2f7223bb574e7a1
[ "CC0-1.0" ]
null
null
null
app/com/learning/api/controllers/ProductController.java
frankhn/e-commerce-play
1ed0b220fb52ba3f3e1ef101f2f7223bb574e7a1
[ "CC0-1.0" ]
null
null
null
app/com/learning/api/controllers/ProductController.java
frankhn/e-commerce-play
1ed0b220fb52ba3f3e1ef101f2f7223bb574e7a1
[ "CC0-1.0" ]
null
null
null
13.315789
51
0.644269
1,674
package com.learning.api.controllers; import play.mvc.Controller; import play.mvc.Result; import models.*; public class ProductController extends Controller{ public Result addProduct( ) { return TODO; } }
3e0405ed4ec9a347ce0fa2dac5d067f5421a1143
2,092
java
Java
src/main/generated/io/vertx/rabbitmq/RabbitMQConsumerOptionsConverter.java
Yaytay/vertx-rabbitmq
668dccb646c333f90db1c2b6adbd21abe2a2b455
[ "Apache-2.0" ]
null
null
null
src/main/generated/io/vertx/rabbitmq/RabbitMQConsumerOptionsConverter.java
Yaytay/vertx-rabbitmq
668dccb646c333f90db1c2b6adbd21abe2a2b455
[ "Apache-2.0" ]
null
null
null
src/main/generated/io/vertx/rabbitmq/RabbitMQConsumerOptionsConverter.java
Yaytay/vertx-rabbitmq
668dccb646c333f90db1c2b6adbd21abe2a2b455
[ "Apache-2.0" ]
null
null
null
36.068966
148
0.684034
1,675
package io.vertx.rabbitmq; import io.vertx.core.json.JsonObject; import io.vertx.core.json.JsonArray; import io.vertx.core.json.impl.JsonUtil; import java.time.Instant; import java.time.format.DateTimeFormatter; import java.util.Base64; /** * Converter and mapper for {@link io.vertx.rabbitmq.RabbitMQConsumerOptions}. * NOTE: This class has been automatically generated from the {@link io.vertx.rabbitmq.RabbitMQConsumerOptions} original class using Vert.x codegen. */ public class RabbitMQConsumerOptionsConverter { private static final Base64.Decoder BASE64_DECODER = JsonUtil.BASE64_DECODER; private static final Base64.Encoder BASE64_ENCODER = JsonUtil.BASE64_ENCODER; public static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, RabbitMQConsumerOptions obj) { for (java.util.Map.Entry<String, Object> member : json) { switch (member.getKey()) { case "autoAck": if (member.getValue() instanceof Boolean) { obj.setAutoAck((Boolean)member.getValue()); } break; case "keepMostRecent": if (member.getValue() instanceof Boolean) { obj.setKeepMostRecent((Boolean)member.getValue()); } break; case "maxInternalQueueSize": if (member.getValue() instanceof Number) { obj.setMaxInternalQueueSize(((Number)member.getValue()).intValue()); } break; case "reconnectInterval": if (member.getValue() instanceof Number) { obj.setReconnectInterval(((Number)member.getValue()).longValue()); } break; } } } public static void toJson(RabbitMQConsumerOptions obj, JsonObject json) { toJson(obj, json.getMap()); } public static void toJson(RabbitMQConsumerOptions obj, java.util.Map<String, Object> json) { json.put("autoAck", obj.isAutoAck()); json.put("keepMostRecent", obj.isKeepMostRecent()); json.put("maxInternalQueueSize", obj.getMaxInternalQueueSize()); json.put("reconnectInterval", obj.getReconnectInterval()); } }
3e0405fc158d249749d5b6c798e6592cd0cfc17c
2,672
java
Java
pepper-apis/src/main/java/org/broadinstitute/ddp/model/user/UserAnnouncement.java
ogii-test/ddp-study-server
fc24b081fbc0abb2fa37f11688903150e7a2c002
[ "BSD-3-Clause" ]
7
2019-12-12T20:17:25.000Z
2021-12-10T13:28:27.000Z
pepper-apis/src/main/java/org/broadinstitute/ddp/model/user/UserAnnouncement.java
ogii-test/ddp-study-server
fc24b081fbc0abb2fa37f11688903150e7a2c002
[ "BSD-3-Clause" ]
397
2019-12-12T20:15:20.000Z
2022-03-31T20:18:19.000Z
pepper-apis/src/main/java/org/broadinstitute/ddp/model/user/UserAnnouncement.java
ogii-test/ddp-study-server
fc24b081fbc0abb2fa37f11688903150e7a2c002
[ "BSD-3-Clause" ]
4
2021-04-19T18:43:57.000Z
2022-02-01T18:30:27.000Z
27.833333
121
0.641841
1,676
package org.broadinstitute.ddp.model.user; import java.util.NoSuchElementException; import java.util.function.Consumer; import com.google.gson.annotations.SerializedName; import org.broadinstitute.ddp.content.ContentStyle; import org.broadinstitute.ddp.content.HtmlConverter; import org.broadinstitute.ddp.content.Renderable; import org.jdbi.v3.core.mapper.reflect.ColumnName; import org.jdbi.v3.core.mapper.reflect.JdbiConstructor; public class UserAnnouncement implements Renderable { private transient long id; private transient long userId; private transient long studyId; private transient long msgTemplateId; private transient long createdAt; @SerializedName("guid") private String guid; @SerializedName("permanent") private boolean isPermanent; @SerializedName("message") private String message; @JdbiConstructor public UserAnnouncement(@ColumnName("user_announcement_id") long id, @ColumnName("guid") String guid, @ColumnName("user_id") long userId, @ColumnName("study_id") long studyId, @ColumnName("message_template_id") long msgTemplateId, @ColumnName("is_permanent") boolean isPermanent, @ColumnName("created_at") long createdAt) { this.id = id; this.guid = guid; this.userId = userId; this.studyId = studyId; this.msgTemplateId = msgTemplateId; this.isPermanent = isPermanent; this.createdAt = createdAt; } public long getId() { return id; } public String getGuid() { return guid; } public long getUserId() { return userId; } public long getStudyId() { return studyId; } public long getMsgTemplateId() { return msgTemplateId; } public boolean isPermanent() { return isPermanent; } public long getCreatedAt() { return createdAt; } public String getMessage() { return message; } @Override public void registerTemplateIds(Consumer<Long> registry) { registry.accept(msgTemplateId); } @Override public void applyRenderedTemplates(Provider<String> rendered, ContentStyle style) { message = rendered.get(msgTemplateId); if (message == null) { throw new NoSuchElementException("No rendered template found for message template with id " + msgTemplateId); } if (style == ContentStyle.BASIC) { message = HtmlConverter.getPlainText(message); } } }
3e0407f693cf2c51bd6abddb71dfcd067c170d1a
1,513
java
Java
src/main/java/br/com/zupacademy/giovannimoratto/desafiotransacao/messages/TransactionListener.java
GiovanniMoratto/orange-talents-06-transacao
b5e2828b27e0f77a47773feac080be3e9a93e4cf
[ "Apache-2.0" ]
null
null
null
src/main/java/br/com/zupacademy/giovannimoratto/desafiotransacao/messages/TransactionListener.java
GiovanniMoratto/orange-talents-06-transacao
b5e2828b27e0f77a47773feac080be3e9a93e4cf
[ "Apache-2.0" ]
null
null
null
src/main/java/br/com/zupacademy/giovannimoratto/desafiotransacao/messages/TransactionListener.java
GiovanniMoratto/orange-talents-06-transacao
b5e2828b27e0f77a47773feac080be3e9a93e4cf
[ "Apache-2.0" ]
null
null
null
42.027778
111
0.729015
1,677
package br.com.zupacademy.giovannimoratto.desafiotransacao.messages; import br.com.zupacademy.giovannimoratto.desafiotransacao.consulta.TransacaoRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.kafka.annotation.KafkaListener; import org.springframework.stereotype.Component; /** * @Author giovanni.moratto */ @Component public class TransactionListener { private final Logger logger = LoggerFactory.getLogger(TransactionListener.class); @Autowired private TransacaoRepository repository; @KafkaListener(topics = "${spring.kafka.topic.transactions}") public void ouvir(TransactionMessage message) { logger.info("----- Nova Transação! -----"); logger.info("ID da transação: {}", message.getId()); logger.info("Numero do cartão: {}", message.getCartaoId(message.getCartao())); logger.info("E-mail: {}", message.getCartaoEmail(message.getCartao())); logger.info("Valor: {}", message.getValor()); logger.info("Efetuado em: {}", message.getEfetivadaEm()); logger.info("Nome do estabelecimento: {}", message.getEstabNome(message.getEstabelecimento())); logger.info("Cidade do estabelecimento: {}", message.getEstabCidade(message.getEstabelecimento())); logger.info("Endereço do estabelecimento: {}", message.getEstabEndereco(message.getEstabelecimento())); repository.save(message.ToModel()); } }
3e0409176f6e6f915b7e2b2b01a6a8c49e1727a6
846
java
Java
src/Extra/mycalculator/CalcLogic.java
pritamkhose/PritamJava
fd20cc60bfa2c18907a5f8829c5acab870655259
[ "Apache-2.0" ]
null
null
null
src/Extra/mycalculator/CalcLogic.java
pritamkhose/PritamJava
fd20cc60bfa2c18907a5f8829c5acab870655259
[ "Apache-2.0" ]
null
null
null
src/Extra/mycalculator/CalcLogic.java
pritamkhose/PritamJava
fd20cc60bfa2c18907a5f8829c5acab870655259
[ "Apache-2.0" ]
null
null
null
26.4375
84
0.620567
1,678
package Extra.mycalculator; public class CalcLogic { //-- Instance variables. private double _currentTotal; // The current total is all we need to remember. /** Constructor */ public CalcLogic() { _currentTotal = 0; } public String getTotalString() { return "" + _currentTotal; } public void setTotal(String n) { _currentTotal = convertToNumber(n); } public void add(String n) { _currentTotal += convertToNumber(n); } public void subtract(String n) { _currentTotal -= convertToNumber(n); } public void multiply(String n) { _currentTotal *= convertToNumber(n); } public void divide(String n) { _currentTotal /= convertToNumber(n); } private int convertToNumber(String n) { return Integer.parseInt(n); } }
3e04094ebe997d5b4557b47b0f632c6ab40fa268
2,510
java
Java
src/br/com/waiso/recommender/data/RatingWaiso.java
fabianormatias/poc-recomendacao-metodo-delphi-v1
91d9066c4eb3e16fe8f391b5fb094e0e2ad6d5af
[ "Apache-1.1" ]
null
null
null
src/br/com/waiso/recommender/data/RatingWaiso.java
fabianormatias/poc-recomendacao-metodo-delphi-v1
91d9066c4eb3e16fe8f391b5fb094e0e2ad6d5af
[ "Apache-1.1" ]
null
null
null
src/br/com/waiso/recommender/data/RatingWaiso.java
fabianormatias/poc-recomendacao-metodo-delphi-v1
91d9066c4eb3e16fe8f391b5fb094e0e2ad6d5af
[ "Apache-1.1" ]
null
null
null
34.383562
115
0.708765
1,679
/* * ________________________________________________________________________________________ * * Y O O R E E K A * A library for data mining, machine learning, soft computing, and mathematical analysis * ________________________________________________________________________________________ * * The Yooreeka project started with the code of the book "Algorithms of the Intelligent Web " * (Manning 2009). Although the term "Web" prevailed in the title, in essence, the algorithms * are valuable in any software application. * * Copyright (c) 2007-2009 Haralambos Marmanis & Dmitry Babenko * Copyright (c) 2009-${year} Marmanis Group LLC and individual contributors as indicated by the @author tags. * * Certain library functions depend on other Open Source software libraries, which are covered * by different license agreements. See the NOTICE file distributed with this work for additional * information regarding copyright ownership and licensing. * * Marmanis Group LLC 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 br.com.waiso.recommender.data; import java.util.List; /** * Generic representation of a rating given by empresa to a product (produto). */ public class RatingWaiso implements java.io.Serializable { /** * SVUID */ private static final long serialVersionUID = 1438346522502387789L; private int rating; public RatingWaiso(int rating) { this.rating = rating; } public int getRating() { return rating; } public void setRating(int rating) { this.rating = rating; } public static double avarageRating(List<Compra> compras) { double rating = 0; for (Compra compra : compras) { rating += compra.getPontuacao(); } return rating/compras.size(); } @Override public String toString() { return this.getClass().getSimpleName() + "[rating: " + rating + "]"; } }
3e040b2dfc3c2c2536195ffca523cc4ffaa4d518
13,622
java
Java
netreflected/src/net461/system_version_4.0.0.0_culture_neutral_publickeytoken_b77a5c561934e089/system/net/configuration/NetSectionGroup.java
marcocappolimases/JCOReflector
4eddd66a21b334e26574dccef6914e035fc2fe99
[ "MIT" ]
null
null
null
netreflected/src/net461/system_version_4.0.0.0_culture_neutral_publickeytoken_b77a5c561934e089/system/net/configuration/NetSectionGroup.java
marcocappolimases/JCOReflector
4eddd66a21b334e26574dccef6914e035fc2fe99
[ "MIT" ]
null
null
null
netreflected/src/net461/system_version_4.0.0.0_culture_neutral_publickeytoken_b77a5c561934e089/system/net/configuration/NetSectionGroup.java
marcocappolimases/JCOReflector
4eddd66a21b334e26574dccef6914e035fc2fe99
[ "MIT" ]
1
2020-10-06T19:58:01.000Z
2020-10-06T19:58:01.000Z
52.191571
551
0.728381
1,680
/* * MIT License * * Copyright (c) 2021 MASES s.r.l. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /************************************************************************************** * <auto-generated> * This code was generated from a template using JCOReflector * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. * </auto-generated> *************************************************************************************/ package system.net.configuration; import org.mases.jcobridge.*; import org.mases.jcobridge.netreflection.*; import java.util.ArrayList; // Import section import system.configuration.ConfigurationSectionGroup; import system.net.configuration.NetSectionGroup; import system.configuration.Configuration; import system.net.configuration.AuthenticationModulesSection; import system.net.configuration.ConnectionManagementSection; import system.net.configuration.DefaultProxySection; import system.net.configuration.MailSettingsSectionGroup; import system.net.configuration.RequestCachingSection; import system.net.configuration.SettingsSection; import system.net.configuration.WebRequestModulesSection; /** * The base .NET class managing System.Net.Configuration.NetSectionGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089. Extends {@link NetObject}. * <p> * * See: <a href="https://docs.microsoft.com/en-us/dotnet/api/System.Net.Configuration.NetSectionGroup" target="_top">https://docs.microsoft.com/en-us/dotnet/api/System.Net.Configuration.NetSectionGroup</a> */ public class NetSectionGroup extends ConfigurationSectionGroup { /** * Fully assembly qualified name: System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 */ public static final String assemblyFullName = "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; /** * Assembly name: System */ public static final String assemblyShortName = "System"; /** * Qualified class name: System.Net.Configuration.NetSectionGroup */ public static final String className = "System.Net.Configuration.NetSectionGroup"; static JCOBridge bridge = JCOBridgeInstance.getInstance(assemblyFullName); /** * The type managed from JCOBridge. See {@link JCType} */ public static JCType classType = createType(); static JCEnum enumInstance = null; JCObject classInstance = null; static JCType createType() { try { String classToCreate = className + ", " + (JCOReflector.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName); if (JCOReflector.getDebug()) JCOReflector.writeLog("Creating %s", classToCreate); JCType typeCreated = bridge.GetType(classToCreate); if (JCOReflector.getDebug()) JCOReflector.writeLog("Created: %s", (typeCreated != null) ? typeCreated.toString() : "Returned null value"); return typeCreated; } catch (JCException e) { JCOReflector.writeLog(e); return null; } } void addReference(String ref) throws Throwable { try { bridge.AddReference(ref); } catch (JCNativeException jcne) { throw translateException(jcne); } } public NetSectionGroup(Object instance) throws Throwable { super(instance); if (instance instanceof JCObject) { classInstance = (JCObject) instance; } else throw new Exception("Cannot manage object, it is not a JCObject"); } public String getJCOAssemblyName() { return assemblyFullName; } public String getJCOClassName() { return className; } public String getJCOObjectName() { return className + ", " + (JCOReflector.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName); } public Object getJCOInstance() { return classInstance; } public void setJCOInstance(JCObject instance) { classInstance = instance; super.setJCOInstance(classInstance); } public JCType getJCOType() { return classType; } /** * Try to cast the {@link IJCOBridgeReflected} instance into {@link NetSectionGroup}, a cast assert is made to check if types are compatible. * @param from {@link IJCOBridgeReflected} instance to be casted * @return {@link NetSectionGroup} instance * @throws java.lang.Throwable in case of error during cast operation */ public static NetSectionGroup cast(IJCOBridgeReflected from) throws Throwable { NetType.AssertCast(classType, from); return new NetSectionGroup(from.getJCOInstance()); } // Constructors section public NetSectionGroup() throws Throwable { try { // add reference to assemblyName.dll file addReference(JCOReflector.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName); setJCOInstance((JCObject)classType.NewObject()); } catch (JCNativeException jcne) { throw translateException(jcne); } } // Methods section public static NetSectionGroup GetSectionGroup(Configuration config) throws Throwable, system.ArgumentNullException, system.ObjectDisposedException, system.threading.AbandonedMutexException, system.configuration.ConfigurationErrorsException, system.ArgumentException, system.NotImplementedException, system.resources.MissingManifestResourceException, system.InvalidOperationException, system.ArgumentOutOfRangeException, system.FormatException, system.TypeLoadException { if (classType == null) throw new UnsupportedOperationException("classType is null."); try { JCObject objGetSectionGroup = (JCObject)classType.Invoke("GetSectionGroup", config == null ? null : config.getJCOInstance()); return new NetSectionGroup(objGetSectionGroup); } catch (JCNativeException jcne) { throw translateException(jcne); } } // Properties section public AuthenticationModulesSection getAuthenticationModules() throws Throwable, system.ArgumentNullException, system.ArgumentException, system.NotImplementedException, system.globalization.CultureNotFoundException, system.IndexOutOfRangeException, system.ArgumentOutOfRangeException, system.resources.MissingManifestResourceException, system.ObjectDisposedException, system.InvalidOperationException, system.NotSupportedException, system.configuration.ConfigurationErrorsException, system.OutOfMemoryException, system.security.SecurityException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject val = (JCObject)classInstance.Get("AuthenticationModules"); return new AuthenticationModulesSection(val); } catch (JCNativeException jcne) { throw translateException(jcne); } } public ConnectionManagementSection getConnectionManagement() throws Throwable, system.ArgumentNullException, system.ArgumentException, system.NotImplementedException, system.globalization.CultureNotFoundException, system.IndexOutOfRangeException, system.ArgumentOutOfRangeException, system.resources.MissingManifestResourceException, system.ObjectDisposedException, system.InvalidOperationException, system.NotSupportedException, system.configuration.ConfigurationErrorsException, system.OutOfMemoryException, system.security.SecurityException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject val = (JCObject)classInstance.Get("ConnectionManagement"); return new ConnectionManagementSection(val); } catch (JCNativeException jcne) { throw translateException(jcne); } } public DefaultProxySection getDefaultProxy() throws Throwable, system.ArgumentNullException, system.ArgumentException, system.NotImplementedException, system.globalization.CultureNotFoundException, system.IndexOutOfRangeException, system.ArgumentOutOfRangeException, system.resources.MissingManifestResourceException, system.ObjectDisposedException, system.InvalidOperationException, system.NotSupportedException, system.configuration.ConfigurationErrorsException, system.OutOfMemoryException, system.security.SecurityException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject val = (JCObject)classInstance.Get("DefaultProxy"); return new DefaultProxySection(val); } catch (JCNativeException jcne) { throw translateException(jcne); } } public MailSettingsSectionGroup getMailSettings() throws Throwable, system.ArgumentNullException, system.ArgumentException, system.NotImplementedException, system.globalization.CultureNotFoundException, system.IndexOutOfRangeException, system.ArgumentOutOfRangeException, system.resources.MissingManifestResourceException, system.ObjectDisposedException, system.InvalidOperationException, system.NotSupportedException, system.configuration.ConfigurationErrorsException, system.TypeLoadException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject val = (JCObject)classInstance.Get("MailSettings"); return new MailSettingsSectionGroup(val); } catch (JCNativeException jcne) { throw translateException(jcne); } } public RequestCachingSection getRequestCaching() throws Throwable, system.ArgumentNullException, system.ArgumentException, system.NotImplementedException, system.globalization.CultureNotFoundException, system.IndexOutOfRangeException, system.ArgumentOutOfRangeException, system.resources.MissingManifestResourceException, system.ObjectDisposedException, system.InvalidOperationException, system.NotSupportedException, system.configuration.ConfigurationErrorsException, system.OutOfMemoryException, system.security.SecurityException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject val = (JCObject)classInstance.Get("RequestCaching"); return new RequestCachingSection(val); } catch (JCNativeException jcne) { throw translateException(jcne); } } public SettingsSection getSettings() throws Throwable, system.ArgumentNullException, system.ArgumentException, system.NotImplementedException, system.globalization.CultureNotFoundException, system.IndexOutOfRangeException, system.ArgumentOutOfRangeException, system.resources.MissingManifestResourceException, system.ObjectDisposedException, system.InvalidOperationException, system.NotSupportedException, system.configuration.ConfigurationErrorsException, system.OutOfMemoryException, system.security.SecurityException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject val = (JCObject)classInstance.Get("Settings"); return new SettingsSection(val); } catch (JCNativeException jcne) { throw translateException(jcne); } } public WebRequestModulesSection getWebRequestModules() throws Throwable, system.ArgumentNullException, system.ArgumentException, system.NotImplementedException, system.globalization.CultureNotFoundException, system.IndexOutOfRangeException, system.ArgumentOutOfRangeException, system.resources.MissingManifestResourceException, system.ObjectDisposedException, system.InvalidOperationException, system.NotSupportedException, system.configuration.ConfigurationErrorsException, system.OutOfMemoryException, system.security.SecurityException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject val = (JCObject)classInstance.Get("WebRequestModules"); return new WebRequestModulesSection(val); } catch (JCNativeException jcne) { throw translateException(jcne); } } // Instance Events section }
3e040bbf499471c0aa31ed996a170a02e6ada77d
1,380
java
Java
exareme-master/src/main/java/madgik/exareme/master/gateway/async/handler/HttpAsyncMainHandler.java
HBPSP8Repo/exareme
7f0d4f6a1856fd4b950a6dfe9700437300e15ff9
[ "MIT" ]
null
null
null
exareme-master/src/main/java/madgik/exareme/master/gateway/async/handler/HttpAsyncMainHandler.java
HBPSP8Repo/exareme
7f0d4f6a1856fd4b950a6dfe9700437300e15ff9
[ "MIT" ]
29
2019-11-24T10:29:13.000Z
2020-11-03T11:36:31.000Z
exareme-master/src/main/java/madgik/exareme/master/gateway/async/handler/HttpAsyncMainHandler.java
HBPSP8Repo/exareme
7f0d4f6a1856fd4b950a6dfe9700437300e15ff9
[ "MIT" ]
null
null
null
32.857143
83
0.713043
1,681
package madgik.exareme.master.gateway.async.handler; import org.apache.http.HttpException; import org.apache.http.HttpRequest; import org.apache.http.HttpResponse; import org.apache.http.nio.entity.NStringEntity; import org.apache.http.nio.protocol.*; import org.apache.http.protocol.HttpContext; import org.apache.log4j.Logger; import java.io.IOException; /** * @author alex */ public class HttpAsyncMainHandler implements HttpAsyncRequestHandler<HttpRequest> { private static final Logger log = Logger.getLogger(HttpAsyncMainHandler.class); private static final String msg = "{ " + "\"schema\":[[\"error\",\"text\"]], " + "\"errors\":[[null]] " + "}\n" + "[\"Not supported.\" ]"; @Override public HttpAsyncRequestConsumer<HttpRequest> processRequest( HttpRequest request, HttpContext context) throws HttpException, IOException { return new BasicAsyncRequestConsumer(); } @Override public void handle( HttpRequest httpRequest, HttpAsyncExchange httpExchange, HttpContext context) throws HttpException, IOException { log.debug("New request on main handler"); HttpResponse httpResponse = httpExchange.getResponse(); httpResponse.setEntity(new NStringEntity(msg)); httpExchange.submitResponse(new BasicAsyncResponseProducer(httpResponse)); } }
3e040c707700b1e6ceb2254bda93274b58abce96
3,684
java
Java
src/main/java/org/uast/astgen/parser/AbstractNodeParser.java
unified-ast/ast-generator
cacbd40c3ef5dcb76ad630c99c3e366322c7954f
[ "MIT" ]
null
null
null
src/main/java/org/uast/astgen/parser/AbstractNodeParser.java
unified-ast/ast-generator
cacbd40c3ef5dcb76ad630c99c3e366322c7954f
[ "MIT" ]
4
2022-03-02T12:23:59.000Z
2022-03-28T16:42:54.000Z
src/main/java/org/uast/astgen/parser/AbstractNodeParser.java
unified-ast/ast-generator
cacbd40c3ef5dcb76ad630c99c3e366322c7954f
[ "MIT" ]
2
2022-03-03T06:31:21.000Z
2022-03-03T07:15:41.000Z
33.189189
93
0.653909
1,682
/* * MIT License Copyright (c) 2022 unified-ast * https://github.com/unified-ast/ast-generator/blob/master/LICENSE.txt */ package org.uast.astgen.parser; import java.util.Collections; import java.util.LinkedList; import java.util.List; import org.uast.astgen.exceptions.ExpectedDescriptor; import org.uast.astgen.exceptions.ExpectedOnlyOneEntity; import org.uast.astgen.exceptions.ExpectedSimpleIdentifier; import org.uast.astgen.exceptions.ParserException; import org.uast.astgen.rules.Child; import org.uast.astgen.rules.Descriptor; import org.uast.astgen.rules.DescriptorAttribute; import org.uast.astgen.rules.Disjunction; import org.uast.astgen.scanner.TokenList; import org.uast.astgen.utils.LabelFactory; /** * Parses children list for abstract node. * * @since 1.0 */ public class AbstractNodeParser { /** * Text for exceptions. */ private static final String EXPLANATORY = "... | ... | ..."; /** * Text for exception with extension. */ private static final String EXT_EXPLANATORY = "& | ... | ..."; /** * The source token list. */ private final TokenList[] segments; /** * Constructor. * @param segments The list of segments divided by vertical bars. */ public AbstractNodeParser(final TokenList... segments) { this.segments = segments.clone(); } /** * Parses children list for abstract node. * @return A children list * @throws ParserException If the list of tokens can't be parsed as a children list. */ public List<Child> parse() throws ParserException { final List<Descriptor> composition = new LinkedList<>(); for (final TokenList segment : this.segments) { final List<Descriptor> descriptors = new DescriptorsListParser(segment, new LabelFactory()).parse(); checkListAbstract(descriptors); composition.add(descriptors.get(0)); } int extension = 0; for (final Descriptor descriptor : composition) { if (descriptor.getAttribute() == DescriptorAttribute.EXT) { extension += 1; } } if (extension > 1) { throw new ExpectedOnlyOneEntity(AbstractNodeParser.EXT_EXPLANATORY); } final Disjunction disjunction = new Disjunction(composition); return Collections.singletonList(disjunction); } /** * Checks descriptors list for abstract node. * @param descriptors Descriptors list * @throws ParserException If checking failed */ private static void checkListAbstract(final List<Descriptor> descriptors) throws ParserException { final int count = descriptors.size(); if (count == 0) { throw new ExpectedDescriptor(AbstractNodeParser.EXPLANATORY); } else if (count > 1) { throw new ExpectedOnlyOneEntity(AbstractNodeParser.EXPLANATORY); } checkDescriptor(descriptors.get(0)); } /** * Checks one descriptor for abstract node. * @param descriptor Descriptor * @throws ParserException If checking failed */ private static void checkDescriptor(final Descriptor descriptor) throws ParserException { final boolean attribute = descriptor.getAttribute() == DescriptorAttribute.NONE || descriptor.getAttribute() == DescriptorAttribute.EXT; if (!attribute || !descriptor.getTag().isEmpty() || !descriptor.getParameters().isEmpty() || descriptor.getData().isValid() ) { throw new ExpectedSimpleIdentifier(descriptor.getType()); } } }
3e040c773ab923580634dd5bdc3c43f79e686858
2,154
java
Java
securing-java-web-applications/terracotta-bank/src/main/java/com/joshcummings/codeplay/terracotta/xss/ContentSecurityPolicyViolationsServlet.java
DeloitteDigitalAT/pluralsight
c5444245aaf1668d13eac19d1b5a763c33a8ca6d
[ "Apache-2.0" ]
null
null
null
securing-java-web-applications/terracotta-bank/src/main/java/com/joshcummings/codeplay/terracotta/xss/ContentSecurityPolicyViolationsServlet.java
DeloitteDigitalAT/pluralsight
c5444245aaf1668d13eac19d1b5a763c33a8ca6d
[ "Apache-2.0" ]
null
null
null
securing-java-web-applications/terracotta-bank/src/main/java/com/joshcummings/codeplay/terracotta/xss/ContentSecurityPolicyViolationsServlet.java
DeloitteDigitalAT/pluralsight
c5444245aaf1668d13eac19d1b5a763c33a8ca6d
[ "Apache-2.0" ]
null
null
null
31.217391
119
0.798979
1,683
package com.joshcummings.codeplay.terracotta.xss; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.io.IOUtils; import org.apache.commons.io.input.BoundedInputStream; import org.owasp.esapi.ESAPI; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.gson.Gson; import com.google.gson.annotations.SerializedName; /** * Servlet implementation class ContentSecurityPolicyViolationsServlet */ @WebServlet("/cspViolation") public class ContentSecurityPolicyViolationsServlet extends HttpServlet { private static final long serialVersionUID = 1L; private static final Long CSP_MAX_SIZE = 5000L; private final Logger log = LoggerFactory.getLogger(this.getClass()); private final Gson gson = new Gson(); /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { InputStream body = new BoundedInputStream(request.getInputStream(), CSP_MAX_SIZE); InputStreamReader reader = new InputStreamReader(body); String reportJson = IOUtils.toString(reader); reportJson = ESAPI.encoder().canonicalize(reportJson); // any other validation we want to do ContentSecurityReportEnvelope envelope = gson.fromJson(reportJson, ContentSecurityReportEnvelope.class); log.error(gson.toJson(envelope)); } private class ContentSecurityReportEnvelope { @SerializedName("csp-report") private ContentSecurityReport cspReport; } private class ContentSecurityReport { @SerializedName("document-uri") private String documentUri; private String referrer; @SerializedName("blocked-uri") private String blockedUri; @SerializedName("violated-directive") private String violatedDirective; @SerializedName("original-policy") private String originalPolicy; } }
3e040d7bea7fa01c00dc5d6b6736c8b728416607
2,032
java
Java
SchoolManagement/src/main/java/dev/patika/mappers/PermanentInstructorMapper.java
113-GittiGidiyor-Java-Spring-Bootcamp/fifth-homework-bulutharunmurat
0f3616a721c94958d8158a445d9b3eb53d780371
[ "MIT" ]
null
null
null
SchoolManagement/src/main/java/dev/patika/mappers/PermanentInstructorMapper.java
113-GittiGidiyor-Java-Spring-Bootcamp/fifth-homework-bulutharunmurat
0f3616a721c94958d8158a445d9b3eb53d780371
[ "MIT" ]
null
null
null
SchoolManagement/src/main/java/dev/patika/mappers/PermanentInstructorMapper.java
113-GittiGidiyor-Java-Spring-Bootcamp/fifth-homework-bulutharunmurat
0f3616a721c94958d8158a445d9b3eb53d780371
[ "MIT" ]
1
2021-09-15T18:30:57.000Z
2021-09-15T18:30:57.000Z
33.866667
144
0.770669
1,684
package dev.patika.mappers; import dev.patika.datatransferobject.PermanentInstructorDTO; import dev.patika.entity.Course; import dev.patika.entity.PermanentInstructor; import dev.patika.service.CourseService; import lombok.RequiredArgsConstructor; import org.mapstruct.Mapper; import org.mapstruct.Mapping; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import java.util.ArrayList; import java.util.List; @Mapper(componentModel = "spring") @RequiredArgsConstructor public abstract class PermanentInstructorMapper { protected CourseService courseService; @Autowired public PermanentInstructorMapper(@Lazy CourseService courseService){ this.courseService = courseService; } @Mapping(target = "courseList", expression = "java(getCourseList(permanentInstructorDTO))") public abstract PermanentInstructor mapFromPermanentInstructorDTOtoPermanentInstructor(PermanentInstructorDTO permanentInstructorDTO); @Mapping(target = "courseIdList", expression = "java(getCourseIdList(permanentInstructor))") public abstract PermanentInstructorDTO mapFromPermanentInstructortoPermanentInstructorDTO(PermanentInstructor permanentInstructor); /** * * @param permanentInstructorDTO * @return courseList */ protected List<Course> getCourseList(PermanentInstructorDTO permanentInstructorDTO){ List<Course> courses = new ArrayList<>(); permanentInstructorDTO.getCourseIdList().iterator().forEachRemaining(permanent_id -> courses.add(courseService.findById(permanent_id))); return courses; } /** * * @param permanentInstructor * @return course'sIdList */ protected List<Integer> getCourseIdList(PermanentInstructor permanentInstructor){ List<Integer> courselists = new ArrayList<>(); permanentInstructor.getCourseList().iterator().forEachRemaining(permanent -> courselists.add(permanent.getId())); return courselists; } }
3e040e252b32b99da8bbd3d7a2247fdfe6067360
3,203
java
Java
src/main/java/com/microsoft/graph/requests/extensions/ManagedDeviceMobileAppConfigurationDeviceStatusCollectionRequestBuilder.java
ashwanikumar04/msgraph-sdk-java
9ed8de320a7b1af7792ba24e0fa0cd010c4e1100
[ "MIT" ]
1
2021-05-17T07:56:01.000Z
2021-05-17T07:56:01.000Z
src/main/java/com/microsoft/graph/requests/extensions/ManagedDeviceMobileAppConfigurationDeviceStatusCollectionRequestBuilder.java
ashwanikumar04/msgraph-sdk-java
9ed8de320a7b1af7792ba24e0fa0cd010c4e1100
[ "MIT" ]
21
2021-02-01T08:37:29.000Z
2022-03-02T11:07:27.000Z
src/main/java/com/microsoft/graph/requests/extensions/ManagedDeviceMobileAppConfigurationDeviceStatusCollectionRequestBuilder.java
ashwanikumar04/msgraph-sdk-java
9ed8de320a7b1af7792ba24e0fa0cd010c4e1100
[ "MIT" ]
null
null
null
49.276923
218
0.763035
1,685
// ------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. // ------------------------------------------------------------------------------ package com.microsoft.graph.requests.extensions; import com.microsoft.graph.http.IRequestBuilder; import com.microsoft.graph.core.ClientException; import com.microsoft.graph.concurrency.ICallback; import com.microsoft.graph.models.extensions.ManagedDeviceMobileAppConfiguration; import com.microsoft.graph.models.extensions.ManagedDeviceMobileAppConfigurationDeviceStatus; import java.util.Arrays; import java.util.EnumSet; import com.microsoft.graph.requests.extensions.IManagedDeviceMobileAppConfigurationDeviceStatusCollectionRequestBuilder; import com.microsoft.graph.requests.extensions.IManagedDeviceMobileAppConfigurationDeviceStatusRequestBuilder; import com.microsoft.graph.requests.extensions.IManagedDeviceMobileAppConfigurationDeviceStatusCollectionRequest; import com.microsoft.graph.http.BaseRequestBuilder; import com.microsoft.graph.core.IBaseClient; // **NOTE** This file was generated by a tool and any changes will be overwritten. /** * The class for the Managed Device Mobile App Configuration Device Status Collection Request Builder. */ public class ManagedDeviceMobileAppConfigurationDeviceStatusCollectionRequestBuilder extends BaseRequestBuilder implements IManagedDeviceMobileAppConfigurationDeviceStatusCollectionRequestBuilder { /** * The request builder for this collection of ManagedDeviceMobileAppConfiguration * * @param requestUrl the request URL * @param client the service client * @param requestOptions the options for this request */ public ManagedDeviceMobileAppConfigurationDeviceStatusCollectionRequestBuilder(final String requestUrl, final IBaseClient client, final java.util.List<? extends com.microsoft.graph.options.Option> requestOptions) { super(requestUrl, client, requestOptions); } /** * Creates the request * * @param requestOptions the options for this request * @return the IUserRequest instance */ public IManagedDeviceMobileAppConfigurationDeviceStatusCollectionRequest buildRequest(final com.microsoft.graph.options.Option... requestOptions) { return buildRequest(getOptions(requestOptions)); } /** * Creates the request * * @param requestOptions the options for this request * @return the IUserRequest instance */ public IManagedDeviceMobileAppConfigurationDeviceStatusCollectionRequest buildRequest(final java.util.List<? extends com.microsoft.graph.options.Option> requestOptions) { return new ManagedDeviceMobileAppConfigurationDeviceStatusCollectionRequest(getRequestUrl(), getClient(), requestOptions); } public IManagedDeviceMobileAppConfigurationDeviceStatusRequestBuilder byId(final String id) { return new ManagedDeviceMobileAppConfigurationDeviceStatusRequestBuilder(getRequestUrlWithAdditionalSegment(id), getClient(), getOptions()); } }
3e040e30bbb7bcba8a457276fc587ddbdab8ab8c
524
java
Java
marmot/src/main/java/com/st/myenuma/SwitchPrintEnum.java
inidcard/marmot
cd32e770df3f5c5c62409b0cb98f8d0eb39570f9
[ "MIT" ]
null
null
null
marmot/src/main/java/com/st/myenuma/SwitchPrintEnum.java
inidcard/marmot
cd32e770df3f5c5c62409b0cb98f8d0eb39570f9
[ "MIT" ]
null
null
null
marmot/src/main/java/com/st/myenuma/SwitchPrintEnum.java
inidcard/marmot
cd32e770df3f5c5c62409b0cb98f8d0eb39570f9
[ "MIT" ]
null
null
null
18.068966
51
0.507634
1,686
package com.st.myenuma; public class SwitchPrintEnum{ public static void main(String args[]){ for(Color c:Color.values()){ // ���ö���е�ȫ������ print(c) ; } } public static void print(Color color){ switch(color){ case RED:{ System.out.println("����ɫ") ; break ; } case GREEN:{ System.out.println("����ɫ") ; break ; } case BLUE:{ System.out.println("����ɫ") ; break ; } default:{ System.out.println("δ֪��ɫ") ; break ; } } } };
3e040e3d9f84a30f5ed7e15dce4109c497f71785
633
java
Java
src/main/proj/src/org/jcodec/platform/BaseInputStream.java
Nageek15/jcodec
667090bd44a72d3092ea5586307b0982ff4f3c18
[ "BSD-2-Clause" ]
980
2015-01-01T00:03:31.000Z
2022-03-24T20:26:42.000Z
src/main/java/org/jcodec/platform/BaseInputStream.java
quantum2947/jcodec
6ad0b21222becf19b9465346423eb435dfc32f31
[ "BSD-2-Clause" ]
353
2015-01-09T02:12:58.000Z
2022-03-24T02:42:00.000Z
src/main/java/org/jcodec/platform/BaseInputStream.java
quantum2947/jcodec
6ad0b21222becf19b9465346423eb435dfc32f31
[ "BSD-2-Clause" ]
319
2015-01-05T08:48:10.000Z
2022-03-24T03:36:35.000Z
22.607143
86
0.679305
1,687
package org.jcodec.platform; import java.io.IOException; import java.io.InputStream; public abstract class BaseInputStream extends InputStream { protected abstract int readByte() throws IOException; protected abstract int readBuffer(byte[] b, int from, int len) throws IOException; @Override public int read(byte[] b) throws IOException { return readBuffer(b, 0, b.length); } @Override public int read(byte[] b, int off, int len) throws IOException { return readBuffer(b, off, len); } @Override public int read() throws IOException { return readByte(); } }
3e040ebcdf183bb3ad82c7f131223e7236814dc9
153
java
Java
assessment/service/src/test/java/com/mediscreen/assessment/mock/TestConfig.java
np111/P9_mediscreen
4323212bd2be8334caa88bf93911fe1e40dd50c0
[ "MIT" ]
null
null
null
assessment/service/src/test/java/com/mediscreen/assessment/mock/TestConfig.java
np111/P9_mediscreen
4323212bd2be8334caa88bf93911fe1e40dd50c0
[ "MIT" ]
null
null
null
assessment/service/src/test/java/com/mediscreen/assessment/mock/TestConfig.java
np111/P9_mediscreen
4323212bd2be8334caa88bf93911fe1e40dd50c0
[ "MIT" ]
null
null
null
19.125
63
0.836601
1,688
package com.mediscreen.assessment.mock; import org.springframework.boot.test.context.TestConfiguration; @TestConfiguration public class TestConfig { }
3e040ee94a07f9e2b038fa35fc1d8fe22ab32a98
119
java
Java
src/Main.java
One-djey/IPlocation
d95460fb9aabc36cd3cda5d059481352a614a843
[ "MIT" ]
null
null
null
src/Main.java
One-djey/IPlocation
d95460fb9aabc36cd3cda5d059481352a614a843
[ "MIT" ]
null
null
null
src/Main.java
One-djey/IPlocation
d95460fb9aabc36cd3cda5d059481352a614a843
[ "MIT" ]
null
null
null
14.875
44
0.579832
1,689
import IHM.Win; public class Main { public static void main(String[] args) { Win win = new Win(); } }
3e040f338a98f66423cedf24d6810c51b96c9995
519
java
Java
com/ares/utils/render/Plane.java
jack-debug/Ares-1.0-Source-Leak
1dc3ef6c496599951fb004eca8ee2c387134d699
[ "MIT" ]
2
2020-11-18T16:14:40.000Z
2021-10-13T15:46:47.000Z
com/ares/utils/render/Plane.java
jack-debug/Ares-1.0-Source-Leak
1dc3ef6c496599951fb004eca8ee2c387134d699
[ "MIT" ]
null
null
null
com/ares/utils/render/Plane.java
jack-debug/Ares-1.0-Source-Leak
1dc3ef6c496599951fb004eca8ee2c387134d699
[ "MIT" ]
1
2020-10-15T20:25:13.000Z
2020-10-15T20:25:13.000Z
19.222222
70
0.554913
1,690
package com.ares.utils.render; public class Plane { private final double x; private final double y; private final boolean visible; public Plane(final double a1, final double a2, final boolean a3) { this.x = a1; this.y = a2; this.visible = a3; } public double getX() { /*SL:17*/return this.x; } public double getY() { /*SL:21*/return this.y; } public boolean isVisible() { /*SL:25*/return this.visible; } }
3e040f4db7ce42732b1470aba69aadef160189ce
1,342
java
Java
modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsOutOfMemoryTestSuite.java
oignatenko2/ignite-5535-1
7eff6a97e13f6d7a1fb2f790f0aa26950dc39b54
[ "CC0-1.0" ]
4
2016-05-17T07:10:07.000Z
2018-08-20T00:32:50.000Z
modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsOutOfMemoryTestSuite.java
oignatenko2/ignite-5535-1
7eff6a97e13f6d7a1fb2f790f0aa26950dc39b54
[ "CC0-1.0" ]
null
null
null
modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsOutOfMemoryTestSuite.java
oignatenko2/ignite-5535-1
7eff6a97e13f6d7a1fb2f790f0aa26950dc39b54
[ "CC0-1.0" ]
3
2016-05-25T22:41:11.000Z
2018-11-03T18:48:12.000Z
34.410256
90
0.73696
1,691
/* * 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.ignite.testsuites; import junit.framework.TestSuite; import org.apache.ignite.internal.processors.cache.persistence.db.wal.IgnitePdsWalTlbTest; /** * */ public class IgnitePdsOutOfMemoryTestSuite extends TestSuite { /** * @return Suite. * @throws Exception If failed. */ public static TestSuite suite() throws Exception { TestSuite suite = new TestSuite("Ignite Persistent Store OOM Test Suite"); suite.addTestSuite(IgnitePdsWalTlbTest.class); return suite; } }
3e040fe50e68d588ff10ea633ab6e3b36d95b33f
414
java
Java
BioMightWeb/src/biomight/system/vascular/TunicaMedia.java
SurferJim/BioMight
3dc2c2b21bc6ece2ca9ac44f0727a433ae9f9430
[ "Apache-2.0" ]
2
2020-05-03T07:43:18.000Z
2020-11-28T21:02:26.000Z
BioMightWeb/src/biomight/system/vascular/TunicaMedia.java
SurferJim/BioMight
3dc2c2b21bc6ece2ca9ac44f0727a433ae9f9430
[ "Apache-2.0" ]
null
null
null
BioMightWeb/src/biomight/system/vascular/TunicaMedia.java
SurferJim/BioMight
3dc2c2b21bc6ece2ca9ac44f0727a433ae9f9430
[ "Apache-2.0" ]
1
2020-11-07T01:36:49.000Z
2020-11-07T01:36:49.000Z
19.714286
73
0.673913
1,692
/* * Created on Jul 20, 2006 * Copyright 2006 - Biomight.org * * This code is the not to be used without written permission from * BioMight.org * */ package biomight.system.vascular; /** * @author SurferJim * * To change the template for this generated type comment go to * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments */ public class TunicaMedia { }
3e04102dd1b859c27f2497dbdd814c6b1d4fb2c5
846
java
Java
src/main/java/com/javacreed/api/domain/primitives/jackson/primitives/LongBasedDomainPrimitiveSerializer.java
javacreed/domain-primitives-api-jackson
37b1bd07882a786fd1209f393d57576891fced1a
[ "Apache-2.0" ]
null
null
null
src/main/java/com/javacreed/api/domain/primitives/jackson/primitives/LongBasedDomainPrimitiveSerializer.java
javacreed/domain-primitives-api-jackson
37b1bd07882a786fd1209f393d57576891fced1a
[ "Apache-2.0" ]
null
null
null
src/main/java/com/javacreed/api/domain/primitives/jackson/primitives/LongBasedDomainPrimitiveSerializer.java
javacreed/domain-primitives-api-jackson
37b1bd07882a786fd1209f393d57576891fced1a
[ "Apache-2.0" ]
null
null
null
35.25
98
0.803783
1,693
package com.javacreed.api.domain.primitives.jackson.primitives; import java.io.IOException; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.ser.std.StdSerializer; import com.javacreed.api.domain.primitives.lang.LongBasedDomainPrimitive; public class LongBasedDomainPrimitiveSerializer extends StdSerializer<LongBasedDomainPrimitive> { private static final long serialVersionUID = -7489666553908321118L; public LongBasedDomainPrimitiveSerializer() { super(LongBasedDomainPrimitive.class); } @Override public void serialize(final LongBasedDomainPrimitive object, final JsonGenerator generator, final SerializerProvider provider) throws IOException { generator.writeNumber(object.getValue()); } }
3e0410a7c3f457e67603be24c459cc43a420de5d
943
java
Java
src/main/java/org/virginiaso/roster_diff/Coach.java
IanEmmons/VasoRosterDiff
35c6371f7f1f4b6fc40a316773e82bd586a20643
[ "BSD-3-Clause" ]
null
null
null
src/main/java/org/virginiaso/roster_diff/Coach.java
IanEmmons/VasoRosterDiff
35c6371f7f1f4b6fc40a316773e82bd586a20643
[ "BSD-3-Clause" ]
null
null
null
src/main/java/org/virginiaso/roster_diff/Coach.java
IanEmmons/VasoRosterDiff
35c6371f7f1f4b6fc40a316773e82bd586a20643
[ "BSD-3-Clause" ]
null
null
null
22.452381
83
0.68929
1,694
package org.virginiaso.roster_diff; import java.util.Objects; public record Coach(String firstName, String lastName, String email, String school) implements Comparable<Coach> { public Coach(String fullName, String email, String school) { this("", fullName, email, school); } public String prettyEmail() { var name = String.join(" ", firstName, lastName); return "%1$s <%2$s>".formatted(name, email); } @Override public int hashCode() { return Objects.hash(email); } @Override public boolean equals(Object rhs) { if (this == rhs) { return true; } else if (!(rhs instanceof Coach coach)) { return false; } else { return Objects.equals(email, coach.email); } } @Override public int compareTo(Coach rhs) { return Objects.compare(this.email(), rhs.email(), String.CASE_INSENSITIVE_ORDER); } @Override public String toString() { return "Coach [%1$s, %2$s]".formatted(prettyEmail(), school); } }
3e0410ad8e4e8550a733343b69124f3a984da827
1,081
java
Java
src/main/java/io/github/liuziyuan/retrofit/resource/RetrofitServiceBean.java
liuziyuan/retrofit-spring-boot-starter
069ca27e6e95f037a34e76b332b52b52d7052695
[ "MIT" ]
12
2022-02-19T08:46:52.000Z
2022-03-10T01:32:54.000Z
src/main/java/io/github/liuziyuan/retrofit/resource/RetrofitServiceBean.java
liuziyuan/retrofit-spring-boot-starter
069ca27e6e95f037a34e76b332b52b52d7052695
[ "MIT" ]
null
null
null
src/main/java/io/github/liuziyuan/retrofit/resource/RetrofitServiceBean.java
liuziyuan/retrofit-spring-boot-starter
069ca27e6e95f037a34e76b332b52b52d7052695
[ "MIT" ]
null
null
null
28.447368
78
0.772433
1,695
package io.github.liuziyuan.retrofit.resource; import io.github.liuziyuan.retrofit.annotation.RetrofitBuilder; import io.github.liuziyuan.retrofit.annotation.RetrofitInterceptor; import lombok.AccessLevel; import lombok.Getter; import lombok.Setter; import java.util.Set; /** * Each API interface file corresponds to a RetrofitServiceBean * * @author liuziyuan */ @Getter @Setter(AccessLevel.PACKAGE) public class RetrofitServiceBean { private Class<?> selfClazz; private Class<?> parentClazz; private RetrofitUrl retrofitUrl; private RetrofitBuilder retrofitBuilder; /** * parent Interface interceptors */ private Set<RetrofitInterceptor> interceptors; private Set<RetrofitInterceptor> myInterceptors; private RetrofitClientBean retrofitClientBean; public void setRetrofitClientBean(RetrofitClientBean retrofitClientBean) { this.retrofitClientBean = retrofitClientBean; this.retrofitBuilder = retrofitClientBean.getRetrofitBuilder(); this.interceptors = retrofitClientBean.getInterceptors(); } }
3e0411595f67fd4c087af085f982d2442bd18618
673
java
Java
commercetools-sdk-base/src/main/java/io/sphere/sdk/queries/ContainsAnyPredicate.java
FL-K/commercetools-jvm-sdk
6c3ba0d2e29e2f9c1a4054d99ea1e3ba8cf323ac
[ "Apache-2.0" ]
null
null
null
commercetools-sdk-base/src/main/java/io/sphere/sdk/queries/ContainsAnyPredicate.java
FL-K/commercetools-jvm-sdk
6c3ba0d2e29e2f9c1a4054d99ea1e3ba8cf323ac
[ "Apache-2.0" ]
null
null
null
commercetools-sdk-base/src/main/java/io/sphere/sdk/queries/ContainsAnyPredicate.java
FL-K/commercetools-jvm-sdk
6c3ba0d2e29e2f9c1a4054d99ea1e3ba8cf323ac
[ "Apache-2.0" ]
null
null
null
29.26087
91
0.682021
1,696
package io.sphere.sdk.queries; import java.util.StringJoiner; import static io.sphere.sdk.utils.SphereInternalUtils.requireNonEmpty; final class ContainsAnyPredicate<T, V, M> extends QueryModelQueryPredicate<M> { private final Iterable<V> values; public ContainsAnyPredicate(final QueryModel<M> queryModel, final Iterable<V> values) { super(queryModel); requireNonEmpty(values); this.values = values; } @Override protected String render() { final StringJoiner joiner = new StringJoiner(", "); values.forEach(x -> joiner.add(x.toString())); return " contains any (" + joiner.toString() + ")"; } }
3e0412ab845852c7d57f0af1862e4a786bbeade9
542
java
Java
java-concurrent/src/main/java/com/wang/concurrent/forkjoin/sync/SumNormal.java
SeriousWatermelon/wang-wen-jun
408aeb71233b4e03e2ab8cea7133e2a45db000f6
[ "Apache-2.0" ]
4
2021-01-13T00:11:27.000Z
2022-03-21T01:03:03.000Z
java-concurrent/src/main/java/com/wang/concurrent/forkjoin/sync/SumNormal.java
SeriousWatermelon/wang-wen-jun
408aeb71233b4e03e2ab8cea7133e2a45db000f6
[ "Apache-2.0" ]
7
2020-11-05T09:42:29.000Z
2021-09-17T08:49:05.000Z
java-concurrent/src/main/java/com/wang/concurrent/forkjoin/sync/SumNormal.java
SeriousWatermelon/wang-wen-jun
408aeb71233b4e03e2ab8cea7133e2a45db000f6
[ "Apache-2.0" ]
7
2020-11-05T09:41:20.000Z
2022-02-22T13:41:29.000Z
24.636364
78
0.535055
1,697
package com.wang.concurrent.forkjoin.sync; /** * 对照方法 * 使用普通方法,计算数组元素之和 */ public class SumNormal { public static void main(String[] args) { int count = 0; int[] arr = MakeArrayUtil.makeArray(); long start = System.currentTimeMillis(); for (int i = 0; i < arr.length; i++) { // SleepTools.ms(1); count += arr[i]; } System.out.println("count=" + count); System.out.println("普通方法耗时:" + (System.currentTimeMillis() - start)); } }
3e04135c6f8c323c28b532c93b3c0da926525785
431
java
Java
src/test/java/com/adenki/smpp/message/SubmitSMRespTest.java
oranoceallaigh/smppapi
3d72641b2fe782a0ecf365868c1b473897237f42
[ "BSD-3-Clause" ]
8
2015-07-17T11:14:50.000Z
2020-05-06T12:05:57.000Z
src/test/java/com/adenki/smpp/message/SubmitSMRespTest.java
oranoceallaigh/smppapi
3d72641b2fe782a0ecf365868c1b473897237f42
[ "BSD-3-Clause" ]
null
null
null
src/test/java/com/adenki/smpp/message/SubmitSMRespTest.java
oranoceallaigh/smppapi
3d72641b2fe782a0ecf365868c1b473897237f42
[ "BSD-3-Clause" ]
8
2015-08-07T07:15:10.000Z
2020-05-22T20:46:09.000Z
22.684211
65
0.698376
1,698
package com.adenki.smpp.message; import org.testng.annotations.Test; @Test public class SubmitSMRespTest extends PacketTests<SubmitSMResp> { protected Class<SubmitSMResp> getPacketType() { return SubmitSMResp.class; } @Override protected SubmitSMResp getInitialisedPacket() { SubmitSMResp packet = new SubmitSMResp(); packet.setMessageId("messageId"); return packet; } }
3e0414b1d499b73dfe8b9b1724afe7e53bfa7dd2
737
java
Java
demo/product/product-api/src/main/java/io/mercy/cloud/product/api/feign/RemoteProductCategoryService.java
SundyHu/mercy-cloud
158e7fe15f2043b07e4a2b9c50f32e81c99aef16
[ "MIT" ]
null
null
null
demo/product/product-api/src/main/java/io/mercy/cloud/product/api/feign/RemoteProductCategoryService.java
SundyHu/mercy-cloud
158e7fe15f2043b07e4a2b9c50f32e81c99aef16
[ "MIT" ]
null
null
null
demo/product/product-api/src/main/java/io/mercy/cloud/product/api/feign/RemoteProductCategoryService.java
SundyHu/mercy-cloud
158e7fe15f2043b07e4a2b9c50f32e81c99aef16
[ "MIT" ]
null
null
null
33.5
180
0.767978
1,699
package io.mercy.cloud.product.api.feign; import io.mercy.cloud.product.api.feign.factory.RemoteProductCategoryServiceFallbackFactory; import io.mercy.cloud.product.api.model.ProductCategory; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; import java.util.List; /** * @author hkc * @version 1.0 * @date 2020-08-15 11:14 * @description */ @FeignClient(contextId = "remoteProductCategoryService", value = "product-service", fallbackFactory = RemoteProductCategoryServiceFallbackFactory.class, path = "/productCategory") public interface RemoteProductCategoryService { @GetMapping(value = "/list") List<ProductCategory> findList(); }
3e04163863bb17ce7914e78c56bc783418cd40ed
275
java
Java
app/src/main/java/com/neuron64/ftp/client/di/scope/FileScope.java
Neuron64/ftpclient
521ac00abde3e32452ad54b7fcdd1908024e4e24
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/neuron64/ftp/client/di/scope/FileScope.java
Neuron64/ftpclient
521ac00abde3e32452ad54b7fcdd1908024e4e24
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/neuron64/ftp/client/di/scope/FileScope.java
Neuron64/ftpclient
521ac00abde3e32452ad54b7fcdd1908024e4e24
[ "Apache-2.0" ]
null
null
null
18.333333
44
0.774545
1,700
package com.neuron64.ftp.client.di.scope; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import javax.inject.Scope; /** * Created by Neuron on 22.10.2017. */ @Scope @Retention(RetentionPolicy.RUNTIME) public @interface FileScope {}
3e04177b56991763438e66073ada6999dd64dc58
954
java
Java
Code/FIL A1 ACDC Partie2 Jallais Adrien/src/api/TasDescendant.java
Naedri/ACDC-TheGame
22d356fe201b9a8c3410caf627ee28805f561866
[ "MIT" ]
null
null
null
Code/FIL A1 ACDC Partie2 Jallais Adrien/src/api/TasDescendant.java
Naedri/ACDC-TheGame
22d356fe201b9a8c3410caf627ee28805f561866
[ "MIT" ]
null
null
null
Code/FIL A1 ACDC Partie2 Jallais Adrien/src/api/TasDescendant.java
Naedri/ACDC-TheGame
22d356fe201b9a8c3410caf627ee28805f561866
[ "MIT" ]
null
null
null
18.705882
86
0.645702
1,701
package api; public class TasDescendant extends Tas implements ITas { public TasDescendant() { super(); } @Override public Carte getDerniereCarte() { if (this.getTaille() != 0) { return super.getDerniereCarte(); } return new Carte(100); } /** * Est-ce que ce coup est valide ? * * @param carte Instance de carte * @return true ou false */ public boolean isCoupValide(Carte carte) { Carte derniereCarte = this.getDerniereCarte(); if (carte.getValeur() - derniereCarte.getValeur() == 10) { return true; } if (carte.getValeur() > derniereCarte.getValeur()) { return false; } if (carte.getValeur() > derniereCarte.getValeur()) { return false; } return true; } public String toString(int i) { return "Tas " + i + " (descendant) : " + this.getDerniereCarte().getValeur() + "\n"; } public String toString() { return "Tas descendant : " + this.getDerniereCarte().getValeur() + "\n"; } }
3e04179260a1f8ddad49d3e16ae02ce29b15cbd7
3,485
java
Java
p4actions/src/com/xakcop/p4actions/menu/CustomActionsMenu.java
rgerganov/p4actions
9a4c530727f8817c915cced84b902ee029ada4eb
[ "MIT" ]
null
null
null
p4actions/src/com/xakcop/p4actions/menu/CustomActionsMenu.java
rgerganov/p4actions
9a4c530727f8817c915cced84b902ee029ada4eb
[ "MIT" ]
1
2016-08-17T12:50:10.000Z
2016-09-30T16:34:42.000Z
p4actions/src/com/xakcop/p4actions/menu/CustomActionsMenu.java
rgerganov/p4actions
9a4c530727f8817c915cced84b902ee029ada4eb
[ "MIT" ]
null
null
null
43.5625
94
0.698996
1,702
package com.xakcop.p4actions.menu; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import com.perforce.team.core.p4java.P4DefaultChangelist; import com.perforce.team.core.p4java.P4PendingChangelist; import com.perforce.team.ui.views.PendingView; import com.xakcop.p4actions.Action; import com.xakcop.p4actions.Activator; import org.eclipse.jface.action.IContributionItem; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.swt.SWT; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.actions.CompoundContributionItem; import org.eclipse.ui.menus.CommandContributionItem; import org.eclipse.ui.menus.CommandContributionItemParameter; public class CustomActionsMenu extends CompoundContributionItem { // must match the params of the command in plugin.xml public static final String ID_PARAM = "p4cl.id"; public static final String CONN_ADDR_PARAM = "p4cl.conn.addr"; public static final String CLIENT_NAME_PARAM = "p4cl.client.name"; public static final String CLIENT_ROOT_PARAM = "p4cl.client.root"; public static final String ACTION = "p4cl.action"; @Override protected IContributionItem[] getContributionItems() { IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); IWorkbenchPart activePart = window.getPartService().getActivePart(); if (!(activePart instanceof PendingView)) { return new IContributionItem[0]; } PendingView pv = (PendingView) activePart; IStructuredSelection selection = (IStructuredSelection) pv.getViewer().getSelection(); if (selection.size() != 1) { return new IContributionItem[0]; } Object sel = selection.getFirstElement(); if (sel instanceof P4DefaultChangelist) { return new IContributionItem[0]; } if (sel instanceof P4PendingChangelist) { P4PendingChangelist changeList = (P4PendingChangelist) sel; return createItems(changeList); } else { return new IContributionItem[0]; } } CommandContributionItem[] createItems(P4PendingChangelist changeList) { ArrayList<CommandContributionItem> result = new ArrayList<CommandContributionItem>(); List<Action> actions = Activator.getAllActions(); for (Action action : actions) { CommandContributionItemParameter itemParam = new CommandContributionItemParameter( PlatformUI.getWorkbench().getActiveWorkbenchWindow(), "p4actions.contributionItem", "p4actions.command", SWT.NONE); Map<String, String> params = new HashMap<String, String>(); params.put(ID_PARAM, "" + changeList.getId()); params.put(CLIENT_ROOT_PARAM, changeList.getClient().getRoot()); params.put(CLIENT_NAME_PARAM, changeList.getClientName()); params.put(CONN_ADDR_PARAM, changeList.getConnection().getAddress()); params.put(ACTION, action.toString()); itemParam.parameters = params; itemParam.label = action.getName(); CommandContributionItem cci = new CommandContributionItem(itemParam); result.add(cci); } return result.toArray(new CommandContributionItem[result.size()]); } }
3e0418e902e3d84a807dbe4486c2d92110ce28c6
1,575
java
Java
clients/src/main/java/WOPRBot/clients/aws/dynamodb/DynamoDbModule.java
Taurvi/WOPRBot
9c0b129e536b03201104386faa3fabd4f7be8c19
[ "MIT" ]
null
null
null
clients/src/main/java/WOPRBot/clients/aws/dynamodb/DynamoDbModule.java
Taurvi/WOPRBot
9c0b129e536b03201104386faa3fabd4f7be8c19
[ "MIT" ]
null
null
null
clients/src/main/java/WOPRBot/clients/aws/dynamodb/DynamoDbModule.java
Taurvi/WOPRBot
9c0b129e536b03201104386faa3fabd4f7be8c19
[ "MIT" ]
null
null
null
32.8125
133
0.755556
1,703
package WOPRBot.clients.aws.dynamodb; import WOPRBot.clients.aws.dynamodb.models.WOPRRecord; import WOPRBot.clients.aws.secretsmanager.IWOPRSecretsManagerClient; import WOPRBot.clients.aws.secretsmanager.models.DynamoDbSecret; import com.google.inject.AbstractModule; import com.google.inject.Provides; import com.google.inject.Singleton; import software.amazon.awssdk.enhanced.dynamodb.DynamoDbEnhancedClient; import software.amazon.awssdk.enhanced.dynamodb.DynamoDbTable; import software.amazon.awssdk.regions.Region; import software.amazon.awssdk.services.dynamodb.DynamoDbClient; public class DynamoDbModule extends AbstractModule { @Override public void configure() { } @Provides @Singleton public DynamoDbEnhancedClient provideDynamoDbEnhancedClient() { DynamoDbClient dynamoDbClient = DynamoDbClient.builder() .region(Region.US_WEST_2) .build(); return DynamoDbEnhancedClient.builder() .dynamoDbClient(dynamoDbClient) .build(); } @Provides @Singleton public DynamoDbTable<WOPRRecord> provideWOPRTable(IWOPRSecretsManagerClient<DynamoDbSecret> dynamoDbSecretClient, DynamoDbEnhancedClient dynamoDbEnhancedClient) { var provider = new WOPRTableProvider(dynamoDbSecretClient, dynamoDbEnhancedClient); return provider.get(); } @Provides @Singleton public IWOPRDynamoDbClient<WOPRRecord> provideWOPRRecordDdbClient(DynamoDbTable<WOPRRecord> table) { return new WOPRRecordDdbClient(table); } }
3e0419d3a6ffd1ec2b0ff24aea2a1a6ec355c576
1,684
java
Java
web/src/test/java/com/navercorp/pinpoint/web/test/util/DataSourceTestUtils.java
wakdotta/pinpoint
ac2bed02b3067389bc0237258b41ec663830a5c1
[ "Apache-2.0" ]
1
2021-05-06T06:23:24.000Z
2021-05-06T06:23:24.000Z
web/src/test/java/com/navercorp/pinpoint/web/test/util/DataSourceTestUtils.java
gcxtx/pinpoint
8d945533aa0878f3b9e94da27bff0ce872de583e
[ "Apache-2.0" ]
1
2018-05-12T03:09:13.000Z
2018-05-12T03:09:13.000Z
web/src/test/java/com/navercorp/pinpoint/web/test/util/DataSourceTestUtils.java
gcxtx/pinpoint
8d945533aa0878f3b9e94da27bff0ce872de583e
[ "Apache-2.0" ]
3
2017-11-15T02:11:02.000Z
2019-03-08T07:53:34.000Z
32.384615
112
0.72209
1,704
/* * Copyright 2017 NAVER Corp. * * 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.navercorp.pinpoint.web.test.util; import com.navercorp.pinpoint.common.server.bo.stat.DataSourceBo; import java.util.ArrayList; import java.util.List; import java.util.Random; /** * @author Taejin Koo */ public class DataSourceTestUtils { private static final Random RANDOM = new Random(System.currentTimeMillis()); public static List<DataSourceBo> createDataSourceBoList(int id, int dataSourceSize, int maxConnectionSize) { List<DataSourceBo> result = new ArrayList<>(dataSourceSize); for (int i = 0; i < dataSourceSize; i++) { DataSourceBo dataSourceBo = createDataSourceBo(id, maxConnectionSize); result.add(dataSourceBo); } return result; } private static DataSourceBo createDataSourceBo(int id, int maxConnectionSize) { DataSourceBo dataSourceBo = new DataSourceBo(); dataSourceBo.setId(id); dataSourceBo.setActiveConnectionSize(RANDOM.nextInt(maxConnectionSize)); dataSourceBo.setMaxConnectionSize(maxConnectionSize); return dataSourceBo; } }
3e041aefee839e3023fed54f35d742f1568a3df7
747
java
Java
user/src/main/java/org/tessell/dispatch/server/ActionDispatch.java
Doriko/tessell
f2f2756ddf69cdca5da8e717bbb7ee314659b9e7
[ "Apache-2.0" ]
16
2015-02-12T13:57:39.000Z
2017-11-01T06:47:22.000Z
user/src/main/java/org/tessell/dispatch/server/ActionDispatch.java
Doriko/tessell
f2f2756ddf69cdca5da8e717bbb7ee314659b9e7
[ "Apache-2.0" ]
16
2015-02-25T02:39:43.000Z
2016-08-03T13:10:03.000Z
user/src/main/java/org/tessell/dispatch/server/ActionDispatch.java
Doriko/tessell
f2f2756ddf69cdca5da8e717bbb7ee314659b9e7
[ "Apache-2.0" ]
10
2015-07-05T12:35:03.000Z
2021-08-17T13:57:17.000Z
31.125
111
0.757697
1,705
package org.tessell.dispatch.server; import org.tessell.dispatch.shared.Action; import org.tessell.dispatch.shared.ActionException; import org.tessell.dispatch.shared.Result; /** * Server-side execution of the action and returns the results. * * @author David Peterson */ public interface ActionDispatch { /** * Executes the specified action and returns the appropriate result. * * @throws ActionException because it's best to not let arbitrary RuntimeExceptions attempt to be serialized */ <A extends Action<R>, R extends Result> R execute(A action, ExecutionContext context) throws ActionException; /** @return whether we should skip the CSRF check for the given action. */ boolean skipCSRFCheck(Action<?> action); }
3e041ba8f6b81d864af9b5e8948be141d266afc2
989
java
Java
spring-learn/src/main/java/com/yaoyong/beanPostProcessor/TestBeanPostProcessor2.java
yongyao2/springFramwork_study
11c7b93c2f642be2d9572234e36dffd326fc3604
[ "Apache-2.0" ]
null
null
null
spring-learn/src/main/java/com/yaoyong/beanPostProcessor/TestBeanPostProcessor2.java
yongyao2/springFramwork_study
11c7b93c2f642be2d9572234e36dffd326fc3604
[ "Apache-2.0" ]
null
null
null
spring-learn/src/main/java/com/yaoyong/beanPostProcessor/TestBeanPostProcessor2.java
yongyao2/springFramwork_study
11c7b93c2f642be2d9572234e36dffd326fc3604
[ "Apache-2.0" ]
null
null
null
26.72973
100
0.784631
1,706
package com.yaoyong.beanPostProcessor; import org.springframework.beans.BeansException; import org.springframework.beans.factory.config.BeanPostProcessor; import org.springframework.core.PriorityOrdered; import org.springframework.stereotype.Component; //BeanPostProcessor 一个扩展类点 Aop就是这样做的 // 还有很多扩展类点 spring 提供了很多这种扩展类 // 主要用来插手bean 干预做一些其他的事情 //@Component public class TestBeanPostProcessor2 implements BeanPostProcessor, PriorityOrdered { @Override public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { //System.out.println(beanName); if(beanName.equals("yaoyongDao")){ System.out.println("init之前2"); } return bean; } @Override public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { //System.out.println(beanName); if(beanName.equals("yaoyongDao")){ System.out.println("init之后2"); } return bean; } //扩展类加载顺序 @Override public int getOrder() { return 1; } }
3e041dc11f94e228a698c64ed9fdd164277260fc
6,193
java
Java
app/src/main/java/com/chad/baserecyclerviewadapterhelper/WOActivity.java
hellwu/BaseRecyclerViewAdapterHelper-2.9.50
2d37eaedd59c2c7e5844b07e9bb01e40fcc48ad5
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/chad/baserecyclerviewadapterhelper/WOActivity.java
hellwu/BaseRecyclerViewAdapterHelper-2.9.50
2d37eaedd59c2c7e5844b07e9bb01e40fcc48ad5
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/chad/baserecyclerviewadapterhelper/WOActivity.java
hellwu/BaseRecyclerViewAdapterHelper-2.9.50
2d37eaedd59c2c7e5844b07e9bb01e40fcc48ad5
[ "Apache-2.0" ]
null
null
null
36.863095
102
0.658808
1,707
package com.chad.baserecyclerviewadapterhelper; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.widget.Button; import android.widget.TextView; import com.chad.baserecyclerviewadapterhelper.base.BaseActivity; import com.chad.baserecyclerviewadapterhelper.voicecontrol.adapter.CapabilityNode; import com.chad.baserecyclerviewadapterhelper.voicecontrol.adapter.CapabilityNoteNode; import com.chad.baserecyclerviewadapterhelper.voicecontrol.adapter.VoiceCapabilityAdapter; import com.chad.baserecyclerviewadapterhelper.voicecontrol.adapter.VoiceCmdSynonymNode; import com.chad.baserecyclerviewadapterhelper.voicecontrol.adapter.VoiceCommandNode; import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.entity.MultiItemEntity; import com.flyco.tablayout.SlidingTabLayout; import java.util.ArrayList; import java.util.List; public class WOActivity extends AppCompatActivity { private RecyclerView mRecyclerView; private VoiceCapabilityAdapter mDapter; SlidingTabLayout stl; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_w_o); mRecyclerView = (RecyclerView) findViewById(R.id.rv); final ArrayList<MultiItemEntity> datas = new ArrayList<>(); CapabilityNode node1 = new CapabilityNode("Turn on/off device, you can say:", true); VoiceCommandNode node11 = new VoiceCommandNode("Turn on/off the air purifier", true); VoiceCmdSynonymNode node110 = new VoiceCmdSynonymNode("Open/Close the air purifie", true); VoiceCmdSynonymNode node112 = new VoiceCmdSynonymNode("Open/Close this", true); node112.setEnd(false); node112.setEndCapability(true); node11.addSubItem(node110); node11.addSubItem(node112); node11.setEnd(true); node1.addSubItem(node11); VoiceCommandNode node12 = new VoiceCommandNode("Open/Close the air purifier", true); node1.addSubItem(node12); CapabilityNode node2 = new CapabilityNode("Change the mode, you can say:", false); VoiceCommandNode node21 = new VoiceCommandNode("Set air purifier mode to auto", false); VoiceCommandNode node22 = new VoiceCommandNode("Set air purifier mode to manual", false); VoiceCommandNode node23 = new VoiceCommandNode("Set air purifier mode to sleep", false); node23.setEnd(true); node2.addSubItem(node21); // node2.addSubItem(node22); node2.addSubItem(node23); CapabilityNoteNode node_note1 = new CapabilityNoteNode("Note: Turn on/off device"); CapabilityNoteNode node_note2 = new CapabilityNoteNode("Note: the range supported 30%-80%"); // node1.setExpanded(true); node1.addSubItem(node_note1); // node2.addSubItem(node_note2); datas.add(node1); // datas.add(node11); // datas.add(node12); // datas.add(node_note1); datas.add(node2); // datas.add(node21); // datas.add(node22); // datas.add(node23); // datas.add(node_note2); mDapter = new VoiceCapabilityAdapter(datas); View headerView = initHeaderView("Air Purifier", false); mDapter.addHeaderView(headerView); mDapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() { @Override public void onItemChildClick(BaseQuickAdapter baseQuickAdapter, View view, int position) { if (datas.get(position) instanceof VoiceCommandNode) { VoiceCommandNode node = (VoiceCommandNode) datas.get(position); if(node.isExpanded()) { int count = mDapter.collapse(position + 1); Log.i("tag", "collapse count = "+count); } else { int count = mDapter.expand(position + 1); Log.i("tag", "expand count = "+count); } } } }); mRecyclerView.setLayoutManager(new LinearLayoutManager(this)); mRecyclerView.setAdapter(mDapter); collapseAllCapabilityNode(); // mDapter.expandAll(); // mDapter.expand(1); // mDapter.expand(5); } @Override protected void onResume() { super.onResume(); // collapseAllCapabilityNode(); } private void collapseAllCapabilityNode() { List<MultiItemEntity> data = new ArrayList(mDapter.getData()); int pos = 1; if(data != null && data.size() != 0) { CapabilityNode node; for(MultiItemEntity entity : data) { if(entity instanceof CapabilityNode) { node = (CapabilityNode) entity; mDapter.expand(pos); pos += node.getSubItems().size() + 1; } } mDapter.notifyDataSetChanged(); } } private View initHeaderView(String modelName, boolean isConnect) { View headerView = LayoutInflater.from(this).inflate(R.layout.item_voicedetail_header, null); final View rl_no_connect = headerView.findViewById(R.id.rl_no_connect); TextView tv_tips = (TextView)headerView.findViewById(R.id.tv_tips); Button bt_cancel = (Button)headerView.findViewById(R.id.bt_cancel_noconnect); String tips = String.format(getString(R.string.fm_platfrom_tips), modelName); tv_tips.setText(tips); if(!isConnect) { rl_no_connect.setVisibility(View.VISIBLE); } else { rl_no_connect.setVisibility(View.GONE); } bt_cancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { rl_no_connect.setVisibility(View.GONE); } }); return headerView; } }
3e041dd07ef54800c565156d1f465412c1283613
1,288
java
Java
arraysLab/src/explanationsArraysVsVariablesAuto.java
AnnaIvanova73/FundamentalsSoftUni-repo
888da7b31a1767ef5c963836119ed284baa18a9e
[ "MIT" ]
1
2022-03-15T22:44:10.000Z
2022-03-15T22:44:10.000Z
arraysLab/src/explanationsArraysVsVariablesAuto.java
AnnaIvanova73/FundamentalsSoftUni-repo
888da7b31a1767ef5c963836119ed284baa18a9e
[ "MIT" ]
null
null
null
arraysLab/src/explanationsArraysVsVariablesAuto.java
AnnaIvanova73/FundamentalsSoftUni-repo
888da7b31a1767ef5c963836119ed284baa18a9e
[ "MIT" ]
1
2022-03-01T10:31:46.000Z
2022-03-01T10:31:46.000Z
34.810811
111
0.546584
1,708
import java.util.Scanner; public class explanationsArraysVsVariablesAuto { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int[] numbers = new int[n]; // запазва числата при прочитане в себе си./динамична памет for (int i = 0; i < numbers.length; i++) { numbers[i] = scan.nextInt();// четем и запазваме } for (int i = numbers.length - 1; i >= 0; i--) { System.out.println(numbers[i]);// принтираме на обратно запазеното } int num = Integer.parseInt(scan.nextLine());// не може да запази числата// стекова памет //Мога да прочета числа наобратно или не и директно да ги принтирам, но не мога прочетените вече числа // да ги обърна, защото не ги пазя никъде. for (int i = 0; i < num; i++) { System.out.println(i + "от нула"); } for (int i = 1; i <= num; i++) { System.out.println(i + "от една"); } for (int i = num; i > 0; i--) { System.out.println(i + "от числото до като е по- голяма от нула"); } for (int i = num; i >= 1; i--) { System.out.println(i + "от числото до като е по- голяма от 1"); } } }
3e041e24fdcbc778185027f4b7321c4e52802e5a
1,823
java
Java
src/test/java/de/felixbrandt/ceva/metric/DataFactoryTest.java
fbrandt/Ceva
9a69e99dc0be22cef24ff62fbbf7b33ce127c618
[ "MIT" ]
1
2017-07-25T06:37:37.000Z
2017-07-25T06:37:37.000Z
src/test/java/de/felixbrandt/ceva/metric/DataFactoryTest.java
fbrandt/ceva
9a69e99dc0be22cef24ff62fbbf7b33ce127c618
[ "MIT" ]
23
2018-01-31T05:24:22.000Z
2022-02-16T01:13:41.000Z
src/test/java/de/felixbrandt/ceva/metric/DataFactoryTest.java
fbrandt/Ceva
9a69e99dc0be22cef24ff62fbbf7b33ce127c618
[ "MIT" ]
null
null
null
21.702381
66
0.701591
1,709
package de.felixbrandt.ceva.metric; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import org.junit.Before; import org.junit.Test; import de.felixbrandt.ceva.controller.MockCommand; import de.felixbrandt.ceva.entity.Data; import de.felixbrandt.ceva.entity.InstanceMetric; import de.felixbrandt.ceva.entity.Metric; import de.felixbrandt.ceva.entity.MetricType; import de.felixbrandt.ceva.metric.DataFactory; public class DataFactoryTest { class MockData extends Data<Metric, Object> { private static final long serialVersionUID = 1L; public Object input; public Object output; @Override public void setRawValue (final String input) { this.input = input; } @Override public Object getValue () { return this.output; } }; class MockDataFactory extends DataFactory<Metric, Object> { public MockData object; public MockDataFactory(final Metric metric) { super(metric); object = new MockData(); } @Override public Data<Metric, Object> doCreateData (final Metric metric) { return object; } } MockDataFactory factory; InstanceMetric metric; @Before public void setup () { metric = new InstanceMetric(); metric.setName("TEST"); metric.setType(MetricType.INT_METRIC); factory = new MockDataFactory(metric); } @Test public void testCreateResult () { final MockCommand result = new MockCommand(); factory.object.output = new Object(); final Data<Metric, Object> data = factory.create(result); assertEquals(factory.object, data); } @Test public void testCreateResultFail () { final MockCommand result = new MockCommand(); factory.object.output = null; assertNull(factory.create(result)); } }
3e041e66332d350223b5830064a37baf5106eb9b
5,280
java
Java
src/main/java/com/puresoltechnologies/i18n4java/data/SingleLanguageTranslations.java
PureSolTechnologies/i18n4java
b5eb1b22147f36e007776101a27322e29b344379
[ "Apache-2.0" ]
null
null
null
src/main/java/com/puresoltechnologies/i18n4java/data/SingleLanguageTranslations.java
PureSolTechnologies/i18n4java
b5eb1b22147f36e007776101a27322e29b344379
[ "Apache-2.0" ]
null
null
null
src/main/java/com/puresoltechnologies/i18n4java/data/SingleLanguageTranslations.java
PureSolTechnologies/i18n4java
b5eb1b22147f36e007776101a27322e29b344379
[ "Apache-2.0" ]
null
null
null
28.159574
100
0.653759
1,710
/**************************************************************************** * * SingleLanguageTranslations.java * ------------------- * copyright : (c) 2009-2011 by PureSol-Technologies * author : Rick-Rainer Ludwig * email : [email protected] * ****************************************************************************/ /**************************************************************************** * * Copyright 2009-2011 PureSol-Technologies * * 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.puresoltechnologies.i18n4java.data; import java.io.Serializable; import java.lang.reflect.Field; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; /** * This class is for storing translations for a single language. Therefore, it * is only a wrapper for a ConcurrentMap object. * * This class is thread safe. * * @author Rick-Rainer Ludwig * */ @XmlRootElement(name = "translations") @XmlAccessorType(XmlAccessType.FIELD) public class SingleLanguageTranslations implements Cloneable, Serializable { private static final long serialVersionUID = -8643091070908120175L; private final ConcurrentMap<String, String> translations = new ConcurrentHashMap<String, String>(); public SingleLanguageTranslations() { } /** * Sets a new translation. An old translation will be overwritten. * * @param source * @param translation */ public void set(String source, String translation) { translations.put(source, translation); } /** * Adds a translation if the origin is not present. Already existing * translations are not overwritten! * * @param source * @param translation */ public void add(String source, String translation) { translations.putIfAbsent(source, translation); } public String get(String source) { String string = translations.get(source); if (string == null) { return source; } return string; } @Override public String toString() { StringBuffer result = new StringBuffer(); for (String source : translations.keySet()) { result.append(source).append(" --> ") .append(translations.get(source)).append("\n"); } return result.toString(); } /* * (non-Javadoc) * * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((translations == null) ? 0 : translations.hashCode()); return result; } /* * (non-Javadoc) * * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } SingleLanguageTranslations other = (SingleLanguageTranslations) obj; if (translations == null) { if (other.translations != null) { return false; } } else if (!translations.equals(other.translations)) { return false; } return true; } @Override public Object clone() { try { SingleLanguageTranslations cloned = (SingleLanguageTranslations) super .clone(); Field translationsField; translationsField = cloned.getClass().getDeclaredField( "translations"); translationsField.setAccessible(true); translationsField.set(cloned, new ConcurrentHashMap<String, String>()); for (String source : this.translations.keySet()) { cloned.translations.put(source, this.translations.get(source)); } return cloned; } catch (SecurityException e) { throw new RuntimeException(e); } catch (NoSuchFieldException e) { throw new RuntimeException(e); } catch (IllegalArgumentException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } catch (CloneNotSupportedException e) { throw new RuntimeException(e); } } public void removeLineBreaks() { for (String source : translations.keySet()) { String translation = translations.get(source); translations.remove(source); source = source.replaceAll("\\n", "\\\\n"); translation = translation.replaceAll("\\n", "\\\\n"); translations.put(source, translation); } } public void addLineBreaks() { for (String source : translations.keySet()) { String translation = translations.get(source); translations.remove(source); source = source.replaceAll("\\\\n", "\n"); translation = translation.replaceAll("\\\\n", "\n"); translations.put(source, translation); } } }
3e041e6dd7eba1d96d4d90e03876d3540bd945fa
691
java
Java
spring-boot/src/main/java/io/micronaut/spring/boot/condition/RequiresSingleCandidateCondition.java
NicklasWallgren/micronaut-spring
01e77cf1a3afc6c64a712250e63bcd55eb7ee5a6
[ "Apache-2.0" ]
null
null
null
spring-boot/src/main/java/io/micronaut/spring/boot/condition/RequiresSingleCandidateCondition.java
NicklasWallgren/micronaut-spring
01e77cf1a3afc6c64a712250e63bcd55eb7ee5a6
[ "Apache-2.0" ]
null
null
null
spring-boot/src/main/java/io/micronaut/spring/boot/condition/RequiresSingleCandidateCondition.java
NicklasWallgren/micronaut-spring
01e77cf1a3afc6c64a712250e63bcd55eb7ee5a6
[ "Apache-2.0" ]
null
null
null
38.388889
154
0.735166
1,711
package io.micronaut.spring.boot.condition; import io.micronaut.context.BeanContext; import io.micronaut.context.condition.Condition; import io.micronaut.context.condition.ConditionContext; public class RequiresSingleCandidateCondition implements Condition { @Override public boolean matches(ConditionContext context) { final Class<?> type = context.getComponent().findAnnotation(RequiresSingleCandidate.class).flatMap(ann -> ann.getValue(Class.class)).orElse(null); if (type != null) { final BeanContext beanContext = context.getBeanContext(); return beanContext.findBeanDefinition(type).isPresent(); } return true; } }
3e041ef9c490705f3045cb076b1575b2c436c9f9
15,333
java
Java
interpreter/plot_addon/src/main/java/org/randoom/setlx/plot/utilities/ConnectJFreeChart.java
leonmutschke/setlX
a10333405cba3d9d814d7de9e160561bd5fa4f76
[ "BSD-3-Clause" ]
28
2015-01-14T11:12:02.000Z
2022-02-15T21:06:05.000Z
interpreter/plot_addon/src/main/java/org/randoom/setlx/plot/utilities/ConnectJFreeChart.java
leonmutschke/setlX
a10333405cba3d9d814d7de9e160561bd5fa4f76
[ "BSD-3-Clause" ]
6
2016-08-01T14:21:37.000Z
2018-06-03T17:15:00.000Z
interpreter/plot_addon/src/main/java/org/randoom/setlx/plot/utilities/ConnectJFreeChart.java
leonmutschke/setlX
a10333405cba3d9d814d7de9e160561bd5fa4f76
[ "BSD-3-Clause" ]
18
2015-02-11T21:10:18.000Z
2018-05-02T07:41:41.000Z
53.239583
230
0.694776
1,712
package org.randoom.setlx.plot.utilities; import org.jfree.chart.ChartColor; import org.jfree.chart.ChartPanel; import org.jfree.chart.axis.LogarithmicAxis; import org.jfree.chart.axis.NumberAxis; import org.randoom.setlx.exceptions.FileNotWritableException; import org.randoom.setlx.exceptions.IllegalRedefinitionException; import org.randoom.setlx.exceptions.SetlException; import org.randoom.setlx.exceptions.UndefinedOperationException; import org.randoom.setlx.plot.types.*; import org.randoom.setlx.utilities.State; import org.randoom.setlx.types.Value; import javax.imageio.ImageIO; import java.awt.*; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.util.List; public class ConnectJFreeChart implements SetlXPlot { private static ConnectJFreeChart connector; public static ConnectJFreeChart getInstance() { if (connector == null) { connector = new ConnectJFreeChart(); } return connector; } @Override public org.randoom.setlx.plot.types.Canvas createCanvas() { org.randoom.setlx.plot.types.Canvas canvas = new org.randoom.setlx.plot.types.Canvas(new FrameWrapper()); canvas.setTitle("Graphic output"); return canvas; } @Override public org.randoom.setlx.plot.types.Canvas createCanvas(String title) { org.randoom.setlx.plot.types.Canvas canvas = new org.randoom.setlx.plot.types.Canvas(new FrameWrapper()); canvas.setTitle(title); return canvas; } @Override public Graph addGraph(org.randoom.setlx.plot.types.Canvas canvas, String function, String name, State interpreterState, List<Integer> color, boolean plotArea) throws SetlException { if(canvas.getFrame().getFrameType() == FrameWrapper.VIRGIN_FRAME){ canvas.getFrame().setFrameType(FrameWrapper.DRAW_FRAME); canvas.getFrame().setFrame(new DrawFrame(canvas.getTitle(), canvas.getFrame().getWidth(), canvas.getFrame().getHeight())); } else if(canvas.getFrame().getFrameType() >= FrameWrapper.BAR_FRAME){ throw new IllegalRedefinitionException("This Canvas can only be used for Graphs, not for Charts. Create a new Canvas, to draw Graphs"); } return ((DrawFrame) canvas.getFrame().getFrame()).addDataset(name, function, interpreterState, plotArea, new ChartColor(color.get(0), color.get(1), color.get(2))); } @Override public Graph addListGraph(org.randoom.setlx.plot.types.Canvas canvas, List<List<Double>> function, String name, List<Integer> color, boolean plotArea) throws IllegalRedefinitionException { if(canvas.getFrame().getFrameType() == FrameWrapper.VIRGIN_FRAME){ canvas.getFrame().setFrameType(FrameWrapper.DRAW_FRAME); canvas.getFrame().setFrame(new DrawFrame(canvas.getTitle(), canvas.getFrame().getWidth(), canvas.getFrame().getHeight())); } else if(canvas.getFrame().getFrameType() >= FrameWrapper.BAR_FRAME){ throw new IllegalRedefinitionException("This Canvas can only be used for Graphs, not for Charts. Create a new Canvas, to draw Graphs"); } return ((DrawFrame)canvas.getFrame().getFrame()).addListDataset(name, function, plotArea, new ChartColor(color.get(0), color.get(1), color.get(2))); } @Override public Graph addParamGraph(org.randoom.setlx.plot.types.Canvas canvas, String xfunction, String yfunction, String name, State interpreterState, List<Integer> color, Boolean plotArea, List<Double> limits) throws SetlException { if(canvas.getFrame().getFrameType() == FrameWrapper.VIRGIN_FRAME){ canvas.getFrame().setFrameType(FrameWrapper.DRAW_FRAME); canvas.getFrame().setFrame(new DrawFrame(canvas.getTitle(), canvas.getFrame().getWidth(), canvas.getFrame().getHeight())); } else if(canvas.getFrame().getFrameType() >= FrameWrapper.BAR_FRAME){ throw new IllegalRedefinitionException("This Canvas can only be used for Graphs, not for Charts. Create a new Canvas, to draw Graphs"); } return ((DrawFrame)canvas.getFrame().getFrame()).addParamDataset(name, xfunction, yfunction, interpreterState, plotArea, new ChartColor(color.get(0), color.get(1), color.get(2)), limits); } @Override public Chart1D addBarChart(org.randoom.setlx.plot.types.Canvas canvas, List<Double> values, List<String> categories) throws IllegalRedefinitionException { if(canvas.getFrame().getFrameType() == FrameWrapper.DRAW_FRAME){ throw new IllegalRedefinitionException("This canvas is defined for graphs. Create a new canvas to draw charts"); } if(canvas.getFrame().getFrameType() == FrameWrapper.BOX_FRAME || canvas.getFrame().getFrameType() == FrameWrapper.PIE_FRAME){ throw new IllegalRedefinitionException("This canvas is defined for BarCharts. Create a new canvas to draw another type of charts"); } if(canvas.getFrame().getFrameType() == FrameWrapper.VIRGIN_FRAME){ canvas.getFrame().setFrame(new BarFrame(canvas.getTitle(), canvas.getFrame().getWidth(), canvas.getFrame().getHeight())); canvas.getFrame().setFrameType(FrameWrapper.BAR_FRAME); } return ((BarFrame)canvas.getFrame().getFrame()).addBarChart(values, categories, "series"+canvas.getFrame().getFrame().getChartCount()); } @Override public Chart1D addBarChart(org.randoom.setlx.plot.types.Canvas canvas, List<Double> values, List<String> categories, String name) throws IllegalRedefinitionException { if(canvas.getFrame().getFrameType() == FrameWrapper.DRAW_FRAME){ throw new IllegalRedefinitionException("This canvas is defined for graphs. Create a new canvas to draw charts"); } if(canvas.getFrame().getFrameType() == FrameWrapper.BOX_FRAME || canvas.getFrame().getFrameType() == FrameWrapper.PIE_FRAME){ throw new IllegalRedefinitionException("This canvas is defined for BarCharts. Create a new canvas to draw another type of charts"); } if(canvas.getFrame().getFrameType() == FrameWrapper.VIRGIN_FRAME){ canvas.getFrame().setFrame(new BarFrame(canvas.getTitle(), canvas.getFrame().getWidth(), canvas.getFrame().getHeight())); canvas.getFrame().setFrameType(FrameWrapper.BAR_FRAME); } return ((BarFrame)canvas.getFrame().getFrame()).addBarChart(values, categories, name); } @Override public Chart1D addPieChart(org.randoom.setlx.plot.types.Canvas canvas, List<Double> values, List<String> categories) throws IllegalRedefinitionException { if(canvas.getFrame().getFrameType() == FrameWrapper.DRAW_FRAME){ throw new IllegalRedefinitionException("This canvas is defined for graphs. Create a new canvas to draw charts"); } if(canvas.getFrame().getFrameType() == FrameWrapper.BOX_FRAME || canvas.getFrame().getFrameType() == FrameWrapper.BAR_FRAME){ throw new IllegalRedefinitionException("This canvas is defined for PieCharts. Create a new canvas to draw another type of charts"); } if(canvas.getFrame().getFrameType() == FrameWrapper.VIRGIN_FRAME){ canvas.getFrame().setFrame(new PieFrame(canvas.getTitle(), canvas.getFrame().getWidth(), canvas.getFrame().getHeight())); canvas.getFrame().setFrameType(FrameWrapper.PIE_FRAME); } return ((PieFrame)canvas.getFrame().getFrame()).addPieChart(values, categories); } @Override public Chart2D addBoxChart(org.randoom.setlx.plot.types.Canvas canvas, List<List<Double>> values, List<String> categories) throws IllegalRedefinitionException { if(canvas.getFrame().getFrameType() == FrameWrapper.DRAW_FRAME){ throw new IllegalRedefinitionException("This canvas is defined for graphs. Create a new canvas to draw charts"); } if(canvas.getFrame().getFrameType() == FrameWrapper.BAR_FRAME || canvas.getFrame().getFrameType() == FrameWrapper.PIE_FRAME){ throw new IllegalRedefinitionException("This canvas is defined for BoxCharts. Create a new canvas to draw another type of charts"); } if(canvas.getFrame().getFrameType() == FrameWrapper.VIRGIN_FRAME){ canvas.getFrame().setFrame(new BoxFrame(canvas.getTitle(), canvas.getFrame().getWidth(), canvas.getFrame().getHeight())); canvas.getFrame().setFrameType(FrameWrapper.BOX_FRAME); } return ((BoxFrame)canvas.getFrame().getFrame()).addBoxChart(values, categories, "series"+canvas.getFrame().getFrame().getChartCount() ); } @Override public Chart2D addBoxChart(org.randoom.setlx.plot.types.Canvas canvas, List<List<Double>> values, List<String> categories, String name) throws IllegalRedefinitionException { if(canvas.getFrame().getFrameType() == FrameWrapper.DRAW_FRAME){ throw new IllegalRedefinitionException("This canvas is defined for graphs. Create a new canvas to draw charts"); } if(canvas.getFrame().getFrameType() == FrameWrapper.BAR_FRAME || canvas.getFrame().getFrameType() == FrameWrapper.PIE_FRAME){ throw new IllegalRedefinitionException("This canvas is defined for BoxCharts. Create a new canvas to draw another type of charts"); } if(canvas.getFrame().getFrameType() == FrameWrapper.VIRGIN_FRAME){ canvas.getFrame().setFrame(new BoxFrame(canvas.getTitle(), canvas.getFrame().getWidth(), canvas.getFrame().getHeight())); canvas.getFrame().setFrameType(FrameWrapper.BOX_FRAME); } return ((BoxFrame)canvas.getFrame().getFrame()).addBoxChart(values, categories, name ); } @Override public void removeGraph(org.randoom.setlx.plot.types.Canvas canvas, Value value) throws SetlException { canvas.getFrame().getFrame().removeGraph(value); } @Override public void labelAxis(org.randoom.setlx.plot.types.Canvas canvas, String xLabel, String yLabel) throws IllegalRedefinitionException { canvas.getFrame().getFrame().setLabel(xLabel, yLabel); } @Override public Value addLabel(org.randoom.setlx.plot.types.Canvas canvas, List<Double> coordinates, String text) throws UndefinedOperationException { if(canvas.getFrame().getFrameType() == FrameWrapper.VIRGIN_FRAME){ throw new UndefinedOperationException("label cannot be added, if no Graph or Chart is defined. Please add a Graph or Chart first"); } return canvas.getFrame().getFrame().addTextLabel(coordinates, text); } @Override public void defineTitle(org.randoom.setlx.plot.types.Canvas canvas, String title) { canvas.setTitle(title); if(canvas.getFrame().getFrame() != null) { canvas.getFrame().getFrame().setTitle(title); } } @Override public void legendVisible(org.randoom.setlx.plot.types.Canvas canvas, Boolean visible) { ChartPanel chartPanel = canvas.getFrame().getFrame().chartPanel; canvas.getFrame().getFrame().setLegendVisible(visible); if (visible) { if (chartPanel.getChart().getLegend() == null) { chartPanel.getChart().addLegend(canvas.getFrame().getFrame().legend); } } else { canvas.getFrame().getFrame().legend = chartPanel.getChart().getLegend(); chartPanel.getChart().removeLegend(); } } @Override public void modScale(org.randoom.setlx.plot.types.Canvas canvas, double xMin, double xMax, double yMin, double yMax) throws SetlException { if(canvas.getFrame().getFrameType() >= FrameWrapper.BAR_FRAME){ throw new IllegalRedefinitionException("This Canvas can only be used for Graphs, not for Charts. Create a new Canvas, to draw Graphs"); } ((DrawFrame)canvas.getFrame().getFrame()).modyScale(yMin, yMax); ((DrawFrame)canvas.getFrame().getFrame()).modxScale(xMin, xMax); } @Override public void exportCanvas(org.randoom.setlx.plot.types.Canvas canvas, String path) throws FileNotWritableException { BufferedImage image = new BufferedImage(canvas.getFrame().getFrame().getWidth(), canvas.getFrame().getFrame().getHeight(), BufferedImage.TYPE_INT_RGB); Graphics2D graphics2D = image.createGraphics(); canvas.getFrame().getFrame().paint(graphics2D); try { ImageIO.write(image, "png", new File(path + ".png")); } catch (IOException except) { throw new FileNotWritableException("write couldnt be completed", except); } } @Override public void modScaleType(org.randoom.setlx.plot.types.Canvas canvas, String xType, String yType) throws UndefinedOperationException, IllegalRedefinitionException { if(canvas.getFrame().getFrameType() >= FrameWrapper.BAR_FRAME){ throw new IllegalRedefinitionException("This Canvas can only be used for Graphs, not for Charts. Create a new Canvas, to draw Graphs"); } LogarithmicAxis log = new LogarithmicAxis(canvas.getFrame().getFrame().getyAxis().getLabel()); log.setAllowNegativesFlag(true); if (xType.equalsIgnoreCase("log")) { ((DrawFrame)canvas.getFrame().getFrame()).setxAxis(log); } else if (xType.equalsIgnoreCase("num")) { ((DrawFrame)canvas.getFrame().getFrame()).setxAxis(new NumberAxis(canvas.getFrame().getFrame().getxAxis().getLabel())); } else { throw new UndefinedOperationException("Axis type for x-Axis can either be log or num"); } if (yType.equalsIgnoreCase("log")) { ((DrawFrame)canvas.getFrame().getFrame()).setyAxis(log); } else if (yType.equalsIgnoreCase("num")) { ((DrawFrame)canvas.getFrame().getFrame()).setyAxis(new NumberAxis(canvas.getFrame().getFrame().getyAxis().getLabel())); } else { throw new UndefinedOperationException("Axis type for y-Axis can either be log or num"); } } @Override public Graph addBullets(org.randoom.setlx.plot.types.Canvas canvas, List<List<Double>> bullets, List<Integer> color, Double bulletSize) throws IllegalRedefinitionException { if(canvas.getFrame().getFrameType() == FrameWrapper.VIRGIN_FRAME){ canvas.getFrame().setFrameType(FrameWrapper.DRAW_FRAME); canvas.getFrame().setFrame(new DrawFrame(canvas.getTitle(), canvas.getFrame().getWidth(), canvas.getFrame().getHeight())); } else if(canvas.getFrame().getFrameType() >= FrameWrapper.BAR_FRAME){ throw new IllegalRedefinitionException("This Canvas can only be used for Graphs, not for Charts. Create a new Canvas, to draw Graphs"); } return ((DrawFrame)canvas.getFrame().getFrame()).addBulletDataset("Bullets", bullets, new ChartColor(color.get(0), color.get(1), color.get(2)), bulletSize); } @Override public void modSize(org.randoom.setlx.plot.types.Canvas canvas, List<Double> size) { canvas.getFrame().setWidth(size.get(0)); canvas.getFrame().setHeight(size.get(1)); if(!(canvas.getFrame().getFrameType() == FrameWrapper.VIRGIN_FRAME)){ canvas.getFrame().getFrame().modSize(size.get(0), size.get(1)); } } }