blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 689M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 131 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 32 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 313 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
b2efc9a063ccec1a9fe90e418b7322e96b4ca85d | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/27/27_e330ef4eaa7ea39aeecaa7e9f8b8b3bdd7f3c194/ClientProperties/27_e330ef4eaa7ea39aeecaa7e9f8b8b3bdd7f3c194_ClientProperties_s.java | b02628e62b67b767167685fa6714214f17347f90 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 18,099 | java | /*
* This file is part of the Echo Web Application Framework (hereinafter "Echo").
* Copyright (C) 2002-2005 NextApp, Inc.
*
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*/
package nextapp.echo2.webrender;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
/**
* A description of the client browser environment.
*/
public class ClientProperties
implements Serializable {
// General CSS/DOM Quirks describing specific out-of-spec behaviors particular to certain browsers.
/**
* A quirk flag indicating that CSS positioning values do not work correctly when either both
* "top" and "bottom" or "left" and "right" positions are set at the same time.
* <p>
* This quirk occurs with:
* <ul>
* <li>Internet Explorer 6 (Windows) [<em>Corrected in IE7 Beta 2 Refresh</em>]</li>
* </ul>
*/
public static final String QUIRK_CSS_POSITIONING_ONE_SIDE_ONLY = "quirkCssPositioningOneSideOnly";
/**
* A quirk flag indicating the only means of achieving 0 padding in table cells is to use 0px padding.
* <p>
* This quirk occurs with:
* <ul>
* <li>Internet Explorer 6 (Windows)</li>
* </ul>
*/
public static final String QUIRK_CSS_BORDER_COLLAPSE_FOR_0_PADDING = "quirkCssBorderCollapseFor0Padding";
/**
* A quirk flag indicating whether the client will incorrectly render CSS
* collapsed borders such that they reside entirely within the region
* of a component.
* <p>
* This quirk occurs with:
* <ul>
* <li>Internet Explorer 6 (Windows)</li>
* </ul>
* <p>
*/
public static final String QUIRK_CSS_BORDER_COLLAPSE_INSIDE = "quirkCssBorderCollapseInside";
/**
* A quirk flag indicating that the 'fixed' attribute should be used to
* for fixed-to-element background attachment.
* <p>
* This quirk occurs with:
* <ul>
* <li>Internet Explorer 6 (Windows)</li>
* </ul>
*/
public static final String QUIRK_CSS_BACKGROUND_ATTACHMENT_USE_FIXED = "quirkCssBackgroundAttachmentUseFixed";
/**
* A quirk flag indicating that focusing elements should be delayed until the next
* JavaScript execution context.
* <p>
* This quirk occurs with:
* <ul>
* <li>Internet Explorer 6 (Windows)</li>
* </ul>
*/
public static final String QUIRK_DELAYED_FOCUS_REQUIRED = "quirkDelayedFocusRequired";
// Mozilla-specific Quirk Behaviors (behaviors that are more likely to be described as bugs)
/**
* A quirk flag indicating whether the client has poor performance when
* attempting to remove large element hierarchies from a DOM. This quirk can
* be alleviated by removing the hierarchy in smaller chunks.
* <p>
* This quirk occurs with:
* <ul>
* <li>Mozilla (all platforms)</li>
* <li>Mozilla Firefox ((all platforms)</li>
* </ul>
*/
public static final String QUIRK_MOZILLA_PERFORMANCE_LARGE_DOM_REMOVE = "quirkMozillaPerformanceLargeDomRemove";
/**
* A quirk flag describing a Mozilla-specific behavior where the text
* contained within text input fields may be drawn outside of text
* input component due to the component having shifted its location
* on the page.
* <p>
* This quirk occurs with:
* <ul>
* <li>Mozilla (all platforms)</li>
* <li>Mozilla Firefox ((all platforms)</li>
* </ul>
*/
public static final String QUIRK_MOZILLA_TEXT_INPUT_REPAINT = "quirkMozillaTextInputRepaint";
/**
* A quirk flag describing an Opera-specific issue where the
* CSSStyleDeclaration.cssText property is unsupported.
* <p>
* This quirk occurs with:
* <ul>
* <li>Opera</li>
* </ul>
*/
public static final String QUIRK_OPERA_NO_CSS_TEXT = "quirkOperaNoCssText";
// Internet Explorer-specific Quirk Behaviors (behaviors that are more likely to be described as bugs)
/**
* A quirk flag describing the issue of "windowed" select fields in Internet Explorer, which do not
* render correctly with regard to z-index value.
* See http://support.microsoft.com/kb/q177378/ for an explanation of the underlying issue.
* <p>
* This quirk occurs with:
* <ul>
* <li>Internet Explorer 6 (Windows) [<em>Corrected in IE7 Beta 2 Refresh</em>]</li>
* </ul>
*/
public static final String QUIRK_IE_SELECT_Z_INDEX = "quirkIESelectZIndex";
/**
* A quirk flag describing a behavior where a specific "null" option be
* must be added to a drop-down-list-style SELECT element in order to to
* render a "no items selected" state.
* <p>
* This quirk occurs with:
* <ul>
* <li>Mozilla (all platforms)</li>
* <li>Mozilla Firefox ((all platforms)</li>
* </ul>
*/
public static final String QUIRK_SELECT_REQUIRES_NULL_OPTION = "quirkSelectRequiresNullOption";
/**
* A quirk flag describing various issues with rendering content in TEXTAREA elements.
* This quirk includes IE problems with "newline obliteration", and Opera8 problems with
* simply ignoring textarea content with importNode().
* <p>
* This quirk occurs with:
* <ul>
* <li>Internet Explorer 6 (Windows)</li>
* <li>Opera 8 (Linux and Windows Tested, assuming all))</li>
* </ul>
*/
public static final String QUIRK_TEXTAREA_CONTENT = "quirkTextareaContent";
/**
* A quirk flag indicating the incorrect parsing of newlines in the content of a 'textarea'.
* <p>
* This quirk occurs with:
* <ul>
* <li>Internet Explorer 6 (Windows)</li>
* </ul>
*
* This a more specific version of <code>QUIRK_TEXTAREA_CONTENT</code>. Now that it has been
* discovered that Opera has similar issues, <code>QUIRK_TEXTAREA_CONTENT</code> should be used
* instead.
*/
public static final String QUIRK_IE_TEXTAREA_NEWLINE_OBLITERATION = "quirkIETextareaNewlineObliteration";
/**
* A quirk flag describing the curious repaint behavior found in Internet
* Explorer 6, where repaints may be excessively delayed.
* This quirky behavior is most visible when the DOM hierarchy is large and
* complex.
* The unlikely workaround for this quirky behavior is to "tickle" (adjust
* and then reset) the CSS width of an element, which will force an
* immediate repaint.
* <p>
* This quirk occurs with:
* <ul>
* <li>Internet Explorer 6 (Windows)</li>
* </ul>
*/
public static final String QUIRK_IE_REPAINT = "quirkIERepaint";
/**
* A quirk flag indicating incorrect calculation of 100% table widths when within a vertically scrolling
* region.
* <p>
* This quirk occurs with:
* <ul>
* <li>Internet Explorer 6 (Windows)</li>
* </ul>
*/
public static final String QUIRK_IE_TABLE_PERCENT_WIDTH_SCROLLBAR_ERROR = "quirkIETablePercentWidthScrollbarError";
/**
* A quirk flag indicating that listbox-style select fields cannot be reliably manipulated using the client DOM API.
* <p>
* This quirk occurs with:
* <ul>
* <li>Internet Explorer 6 (Windows)</li>
* </ul>
*/
public static final String QUIRK_IE_SELECT_LIST_DOM_UPDATE = "quirkIESelectListDomUpdate";
/**
* A quirk flag indicating that select fields with percentage widths are not reliably rendered.
* <p>
* This quirk occurs with:
* <ul>
* <li>Internet Explorer 6 (Windows)</li>
* </ul>
*/
public static final String QUIRK_IE_SELECT_PERCENT_WIDTH = "quirkIESelectPercentWidth";
// Internet Explorer-specific Proprietary Features
// These features are used only to compensate for IE6's lack of proper CSS support.
/**
* A proprietary feature flag indicating support for IE-style CSS expressions.
* <p>
* This proprietary feature is provided by:
* <ul>
* <li>Internet Explorer 6 (Windows)</li>
* </ul>
*/
public static final String PROPRIETARY_IE_CSS_EXPRESSIONS_SUPPORTED = "proprietaryIECssExpressionsSupported";
/**
* A proprietary feature flag indicating that PNG alpha channel support is
* available only by using a 'filter'.
* <p>
* This proprietary feature is provided by:
* <ul>
* <li>Internet Explorer 6 (Windows) [<em>Not neccesary with IE7 Beta 2 Refresh</em>]</li>
* </ul>
*/
public static final String PROPRIETARY_IE_PNG_ALPHA_FILTER_REQUIRED = "proprietaryIEPngAlphaFilterRequired";
/**
* A proprietary feature flag indicating that CSS opacity support is
* available only by using a 'filter'.
* <p>
* This proprietary feature is provided by:
* <ul>
* <li>Internet Explorer 6 (Windows)</li>
* </ul>
*/
public static final String PROPRIETARY_IE_OPACITY_FILTER_REQUIRED = "proprietaryIEOpacityFilterRequired";
/**
* A proprietary feature flag indicating that 'mouseenter' and
* 'mouseleave' events are supported.
* <p>
* This proprietary feature is provided by:
* <ul>
* <li>Internet Explorer 6 (Windows)</li>
* </ul>
*/
public static final String PROPRIETARY_EVENT_MOUSE_ENTER_LEAVE_SUPPORTED = "proprietaryEventMouseEnterLeaveSupported";
/**
* An unsupported feature flag indicating that CSS opacity effects are
* not supported.
* <p>
* This issue occurs with:
* <ul>
* <li>Opera</li>
* </ul>
*/
public static final String NOT_SUPPORTED_CSS_OPACITY = "notSupportedCssOpacity";
/**
* An unsupported feature flag indicating that manipulating CSS stylesheets is not
* supported by the browser (using add/insert rule).
* <p>
* This issue occurs with:
* <ul>
* <li>Safari (verified)</li>
* <li>KHTML (assumed)</li>
* </ul>
*/
public static final String NOT_SUPPORTED_CSS_MANIPULATION = "notSupportedCssManipulation";
// General Browser Properties
/**
* Width of the screen in pixels (integer).
*/
public static final String SCREEN_WIDTH = "screenWidth";
/**
* Height of the screen in pixels (integer).
*/
public static final String SCREEN_HEIGHT = "screenHeight";
/**
* Color depth of the screen in bits (integer).
*/
public static final String SCREEN_COLOR_DEPTH = "screenColorDepth";
/**
* Flag indicating that the browser is a derivative of the Mozilla
* 1.0-1.8+ browser platform.
*/
public static final String BROWSER_MOZILLA = "browserMozilla";
/**
* Flag indicating that the browser is a derivative of the Mozilla
* Firefox 1.0+ browser platform.
*/
public static final String BROWSER_MOZILLA_FIREFOX = "browserMozillaFirefox";
/**
* Flag indicating that the browser is a derivative of the Microsoft
* Internet Explorer browser platform.
*/
public static final String BROWSER_INTERNET_EXPLORER = "browserInternetExplorer";
/**
* Flag indicating that the browser is a derivative of the KDE Konqueror
* browser platform.
*/
public static final String BROWSER_KONQUEROR = "browserKonqueror";
/**
* Flag indicating that the browser is a derivative of the Apple Safari
* browser platform.
*/
public static final String BROWSER_SAFARI = "browserSafari";
/**
* Flag indicating that the browser is a derivative of the Opera
* browser platform.
*/
public static final String BROWSER_OPERA = "browserOpera";
/**
* The major version number of the browser.
*/
public static final String BROWSER_VERSION_MAJOR = "browserVersionMajor";
/**
* The minor version number of the browser.
*/
public static final String BROWSER_VERSION_MINOR = "browserVersionMinor";
/**
* The <code>Locale</code> of the client, derived from the language property.
*/
public static final String LOCALES = "locales";
/**
* The client's navigator.appName property.
*/
public static final String NAVIGATOR_APP_NAME = "navigatorAppName";
/**
* The client's navigator.appVersion property.
*/
public static final String NAVIGATOR_APP_VERSION = "navigatorAppVersion";
/**
* The client's navigator.appCodeName property.
*/
public static final String NAVIGATOR_APP_CODE_NAME = "navigatorAppCodeName";
/**
* The client's navigator.cookieEnabled property.
*/
public static final String NAVIGATOR_COOKIE_ENABLED = "navigatorCookieEnabled";
/**
* The client's navigator.javaEnabled property.
*/
public static final String NAVIGATOR_JAVA_ENABLED = "navigatorJavaEnabled";
/**
* The client's navigator.language (or navigator.userLanguage) property.
*/
public static final String NAVIGATOR_LANGUAGE = "navigatorLanguage";
/**
* The client's navigator.platform property.
*/
public static final String NAVIGATOR_PLATFORM = "navigatorPlatform";
/**
* The client's navigator.userAgent property.
*/
public static final String NAVIGATOR_USER_AGENT = "navigatorUserAgent";
/**
* The client host. Note this is the original host address used when the
* <code>ClientProperties</code> object was created, which is not
* necessarily the same as that making the current HTTP request.
*/
public static final String REMOTE_HOST = "remoteHost";
/**
* The client's time offset from UTC in minutes.
*/
public static final String UTC_OFFSET = "utcOffset";
private Map data = new HashMap();
/**
* Creates a new <code>ClientProperties</code> object.
*/
public ClientProperties() {
super();
}
/**
* Returns the value of the specified property as an <code>Object</code>.
*
* @param propertyName the property name
* @return the property value
*/
public Object get(String propertyName) {
return data.get(propertyName);
}
/**
* Returns a <code>boolean</code> property.
* If the property is not set, <code>false</code> is returned.
*
* @param propertyName the property name
* @return the property value
*/
public boolean getBoolean(String propertyName) {
Boolean value = (Boolean) data.get(propertyName);
return value == null ? false : value.booleanValue();
}
/**
* Returns a <code>int</code> property.
* If the property is not set, <code>nullValue</code> is returned.
*
* @param propertyName the property name
* @param nullValue the returned value when the property is not set
* @return the property value
*/
public int getInt(String propertyName, int nullValue) {
Integer value = (Integer) data.get(propertyName);
return value == null ? nullValue : value.intValue();
}
/**
* Returns a <code>String</code> property.
* If the property is not set, <code>null</code> is returned.
*
* @param propertyName the property name
* @return the property value
*/
public String getString(String propertyName) {
Object value = data.get(propertyName);
return value == null ? "" : value.toString();
}
/**
* Returns an array of all property names which are set.
*
* @return the array
*/
public String[] getPropertyNames() {
return (String[]) data.keySet().toArray(new String[data.size()]);
}
/**
* Sets the value of the specified property.
*
* @param propertyName the property name
* @param propertyValue the property value
*/
public void setProperty(String propertyName, Object propertyValue) {
data.put(propertyName, propertyValue);
}
/**
* @see java.lang.Object#toString()
*/
public String toString() {
return "ClientProperties: " + data.toString();
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
f86a5fc35643f24dcc09ab657695ca35b14d8a2b | daa42f6176cf6dc5db78b5e82e67ee7fb73488c0 | /app/src/main/java/com/example/dell/myapplication/persenter/CrimeListPersenter.java | 4d7a668e1ac4bca05361e87c0eefb82a4fa5be99 | [] | no_license | nihaolqs/MyApplication3 | 42595a989d03409f934161d926090fb5be2592c5 | 3630029e73b817dcc525989139c44ed5c13e5dc6 | refs/heads/master | 2020-09-10T15:28:35.749807 | 2016-08-31T10:02:55 | 2016-08-31T10:02:55 | 66,470,258 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,270 | java | package com.example.dell.myapplication.persenter;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import com.example.dell.myapplication.bean.Crime;
import com.example.dell.myapplication.biz.CrimeBiz;
import com.example.dell.myapplication.biz.ICrimeBiz;
import com.example.dell.myapplication.util.Contance;
import com.example.dell.myapplication.view.CrimeViewPageActivity;
import com.example.dell.myapplication.view.ICrimeListView;
import java.util.List;
/**
* Created by lin on 2016/8/24.
*/
public class CrimeListPersenter {
private ICrimeBiz mCrimeBiz;
private ICrimeListView mCrimeListView;
private Context mContext;
public CrimeListPersenter(ICrimeListView mCrimeListView, Context context) {
this.mCrimeListView = mCrimeListView;
this.mCrimeBiz = new CrimeBiz(context);
this.mContext = context;
}
public List<Crime> getCrimes()
{
return mCrimeBiz.getCrimes();
}
public void showCrime(Crime crime)
{
Intent intent = new Intent(mContext,CrimeViewPageActivity.class);
intent.putExtra(Contance.CRIME_INTENT_KEY,crime.getmCrimeId());
// Log.e("showCrime","startActivity");
this.mContext.startActivity(intent);
}
}
| [
"nihaolqs@163.com"
] | nihaolqs@163.com |
462b99db8097fc553aa731e96ca0e97ebe62ca34 | 706f9c1ab492878046be114e34d3f8856af53e22 | /rapid_util/src/main/java/com/zoco/fbrp/utils/DataSortOrder.java | feec01ec64fa9ae415f866ed7c57b90c7894710f | [] | no_license | zocojoker/rapid_development | 0f7646d4c319efdfe34f9b837245f1351662c6a9 | ae5800a9e7b4917bd0588898a34dd9f4bf1649bd | refs/heads/master | 2022-12-20T12:13:51.959102 | 2019-12-23T09:26:03 | 2019-12-23T09:26:03 | 148,272,783 | 0 | 0 | null | 2022-12-16T06:11:31 | 2018-09-11T06:44:53 | JavaScript | UTF-8 | Java | false | false | 646 | java | /**
* Copyright(c) Foresee Science & Technology Ltd.
*/
package com.zoco.fbrp.util;
/**
* <pre>
* 用于排序查询时,指定升序或降序。
* </pre>
* @author luxiaocheng luxiaocheng@zoco.cn
* @version 1.00.00
* <pre>
* 修改记录
* 修改后版本: 修改人: 修改日期: 修改内容:
* </pre>
*/
public enum DataSortOrder {
/**
* 升序,如:0,1,2,3 ...。
*/
ASC,
/**
* 降序,如:9,8,7,6 ... 。
*/
DESC;
/**
* 转换成字符串。
*
* @return String
*/
public String toString() {
if (this.equals(ASC)) {
return " asc";
} else {
return " desc";
}
};
}
| [
"jokerhouse@163.com"
] | jokerhouse@163.com |
7a9bf04b27cfc39b9a3feec5aee95ca1863b90f0 | 1073ccdac34de3ca95a4c69628a4ffa47795a949 | /CodeFirstDB/src/main/java/entity/User.java | 4d5be7a7d47bd51ae58088cc559c506edfc9d43c | [] | no_license | Polina-MD80/SpringData | 9cf0cdfed8c770df019687d6adb6be05730f8cc5 | 39c1cce63b93ac630a4fa61fa8ada6bba8d39eed | refs/heads/main | 2023-06-27T00:16:46.123151 | 2021-08-01T09:37:14 | 2021-08-01T09:37:14 | 387,726,795 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 933 | java | package entity;
import javax.persistence.*;
@Entity
@Table(name = "users")
@Inheritance(strategy= InheritanceType.JOINED)
public abstract class User extends BaseEntity{
private String firstName;
private String lastName;
private String phoneNumber;
public User() {
}
@Column(name = "first_name",nullable = false, length = 50)
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
@Column(name = "last_name",nullable = false, length = 50)
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
@Column(name = "phone_number")
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
}
| [
"poli.paskaleva@gmail.com"
] | poli.paskaleva@gmail.com |
ebcef69ba32b1377b427f3e951f513a7685c67e5 | 2050b1f7d08923f73fc1551d7b19f146c9a01264 | /src/CameraModelDetails.java | 2980e9edec38b1318785e069642494dbbea9ca83 | [] | no_license | srabonbhowmik/management-system | bddc5ba6bc014dfb86a296b40b0a46fc715f513f | cc05b5ecd4cf79f99e57bf2aa3a2c800cf4f13c4 | refs/heads/master | 2020-04-07T15:28:49.071911 | 2018-11-21T03:56:27 | 2018-11-21T03:56:27 | 158,487,431 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,134 | java |
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import javax.swing.JOptionPane;
import sun.audio.AudioPlayer;
import sun.audio.AudioStream;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author SRABON
*/
public class CameraModelDetails extends javax.swing.JFrame {
/**
* Creates new form CameraModelDetails
*/
public CameraModelDetails() {
initComponents();
InputStream music;
try{
music = new FileInputStream(new File ("S:\\Faded.wav"));
AudioStream ob = new AudioStream(music);
AudioPlayer.player.start(ob);
}catch(Exception e)
{
JOptionPane.showMessageDialog(null, e);
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
buttonGroup1 = new javax.swing.ButtonGroup();
buttonGroup2 = new javax.swing.ButtonGroup();
jLabel1 = new javax.swing.JLabel();
jProgressBar1 = new javax.swing.JProgressBar();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(212, 212, 212)
.addComponent(jLabel1))
.addGroup(layout.createSequentialGroup()
.addGap(358, 358, 358)
.addComponent(jProgressBar1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(353, 381, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(117, 117, 117)
.addComponent(jLabel1)
.addGap(203, 203, 203)
.addComponent(jProgressBar1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(198, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(CameraModelDetails.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(CameraModelDetails.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(CameraModelDetails.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(CameraModelDetails.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new CameraModelDetails().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.ButtonGroup buttonGroup1;
private javax.swing.ButtonGroup buttonGroup2;
private javax.swing.JLabel jLabel1;
private javax.swing.JProgressBar jProgressBar1;
// End of variables declaration//GEN-END:variables
}
| [
"noreply@github.com"
] | srabonbhowmik.noreply@github.com |
b52d191a149941e9fcd7bb9e7375f770bb377de3 | e2b09295c2d65583d6fefc657aeef9fd0ee46973 | /AndroidStudioProjects/AlertDialog/app/src/main/java/com/example/alertdialog/ThirdActivity.java | c36a89cd36fa38ac199f875029f588430f1e798a | [] | no_license | OlyaKyrylyuk/Android_LR6 | 74d1d512b16fe8568a279a886af355835d98cfde | e282afeb281a93ebdf3d99e8a75d02ee0ce3f3e3 | refs/heads/master | 2023-05-03T16:24:42.196479 | 2021-05-26T07:39:25 | 2021-05-26T07:39:25 | 370,947,694 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,330 | java | package com.example.alertdialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.RatingBar;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
public class ThirdActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_third);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_third, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()){
case R.id.action_go_to_first:
Intent intent1 = new Intent(ThirdActivity.this, MainActivity.class);
startActivity(intent1);
return true;
case R.id.action_go_to_second:
Intent intent2 = new Intent(ThirdActivity.this, SecondActivity.class);
startActivity(intent2);
return true;
default:
return super.onOptionsItemSelected(item);
}
}
public void showRatingDialog(View v) {
final AlertDialog.Builder ratingdialog = new AlertDialog.Builder(this);
ratingdialog.setIcon(android.R.drawable.btn_star_big_on);
ratingdialog.setTitle("Rate our hotel");
View linearlayout = getLayoutInflater().inflate(R.layout.ratingdialog, null);
ratingdialog.setView(linearlayout);
final RatingBar ratingBar = (RatingBar)linearlayout.findViewById(R.id.ratingbar);
ratingBar.setOnRatingBarChangeListener(new RatingBar.OnRatingBarChangeListener() {
@Override
public void onRatingChanged(RatingBar ratingBar, float rating,
boolean fromUser) {
Toast.makeText(ThirdActivity.this, "Rating: " + String.valueOf(rating),
Toast.LENGTH_SHORT).show();
}
});
ratingdialog.create();
ratingdialog.show();
}
} | [
"olya_kyrylyuk15@ukr.net"
] | olya_kyrylyuk15@ukr.net |
545bd7f271cb23665be9de5dd26897885fdcea29 | db87c169d61711dfa8cde8cb34f1db21e3006f56 | /Mrhand3/BigModBF/blocks/BlobbyBlock.java | 4d09ae5249663562f6865d72e988de71d9bb7f57 | [] | no_license | ModDevTeam/UtopiaCraft | 2f0cf374176931e9158d6297ddb3c85eb0eba8cf | 4fdfeab62b66484f8730baad3f3265b1075cf671 | refs/heads/master | 2021-01-19T13:25:22.085785 | 2014-01-11T19:21:44 | 2014-01-11T19:21:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,246 | java | package Mrhand3.BigModBF.blocks;
import java.util.Random;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import Mrhand3.BigModBF.TIleEntity.BlobbyEntity;
import Mrhand3.BigModBF.common.BaseMod;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlobbyBlock extends BlockContainer{
protected int maxStackSize = 1;
//Treat it like a normal block here. The Block Bounds are a good idea - the first three are X Y and Z of the botton-left corner,
//And the second three are the top-right corner.
public BlobbyBlock(int id, Material rock) {
super(id, Material.rock);
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
this.setCreativeTab(BaseMod.tabBlobfish);
this.maxStackSize = 16;
}
//Make sure you set this as your TileEntity class relevant for the block!
@Override
public TileEntity createNewTileEntity(World world) {
return new BlobbyEntity();
}
@Deprecated
public int getItemStackLimit()
{
return this.maxStackSize;
}
public BlobbyBlock setMaxStackSize(int par1)
{
this.maxStackSize = par1;
return this;
}
//You don't want the normal render type, or it wont render properly.
@Override
public int getRenderType() {
return -1;
}
//It's not an opaque cube, so you need this.
@Override
public boolean isOpaqueCube() {
return false;
}
//It's not a normal block, so you need this too.
public boolean renderAsNormalBlock() {
return false;
}
//This is the icon to use for showing the block in your hand.
public void registerIcons(IconRegister icon) {
this.blockIcon = icon.registerIcon("bigmod:blobby");
}
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, int x, int y, int z, Random random){
float f1 = (float)x + 0.5F;
float f2 = (float)y + 1.0F;
float f3 = (float)z + 0.5F;
float f4 = random.nextFloat() * 0.6F -0.3F;
float f5 = random.nextFloat() * -0.6F - -0.3F;
world.spawnParticle("heart", (double)(f1+f4), (double)f2, (double)(f3+f5), 0.0D, 0.0D, 0.0D);
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack)
{
if (entity == null)
{
return;
}
BlobbyEntity tile = (BlobbyEntity) world.getBlockTileEntity(x, y, z);
tile.direction = MathHelper.floor_double((double)(entity.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
}
} | [
"Eli@Elis-MacBook-Pro.local"
] | Eli@Elis-MacBook-Pro.local |
541443528a8e9c15b5f75b7b9089de6c1352cf38 | c82cdf18d5044ca2b3cf1eb61efa3868a0c9240c | /app/src/main/java/org/dalol/aisapirest/model/api/StringDesirializer.java | 451c8b2c63ad73b1f50e6e7303aa1cbca6dc764d | [] | no_license | jadsonplanzo/Ais_Api_REST | 30f25bf6a8e63b7e28bbc547f095d4eeaddc9b13 | a9f5f7d0c578b52f327d5756f100a563005191f5 | refs/heads/master | 2021-01-11T01:43:21.387473 | 2016-09-29T04:45:31 | 2016-09-29T04:45:31 | 69,531,541 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 551 | java | package org.dalol.aisapirest.model.api;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
import java.lang.reflect.Type;
/**
* Created by Filippo-TheAppExpert on 9/2/2015.
*/
public class StringDesirializer implements JsonDeserializer<String> {
@Override
public String deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
return json.toString();
}
}
| [
"jadsonplanzo@gmail.com"
] | jadsonplanzo@gmail.com |
a72173ed22684e878cc82c94c224dad11fefe094 | 99b1ec02fe65d3c6dff79bace7bc52a7bea2dc46 | /app/src/main/java/com/example/fractals/Point.java | 32838e2d5baf367b9e79e8828ed6a4a2ba2938c1 | [] | no_license | deLimes/Fractals | ecf09587235313a411e63c3d77f2f08476604a61 | bf8a69b2106a729099d17b76092065ef8cf641da | refs/heads/master | 2022-03-14T13:04:21.711221 | 2019-10-26T04:23:38 | 2019-10-26T04:23:38 | 217,589,723 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 264 | java | package com.example.fractals;
public class Point {
float x;
float y;
public int value1;
public int value2;
public Point(float x, float y) {
this.x = x;
this.y = y;
this.value1 = -1;
this.value2 = 0;
}
}
| [
"3830123@gmail.com"
] | 3830123@gmail.com |
4da38419e053d63e78cba80bbe241c772ac4c61f | d8c2d11b7cbae7839dd1dabe6b95f9e4c6f4cb96 | /app/src/main/java/com/codeday/detroit/taskmanager/app/CDLog.java | 737526353a436ab1db0973238ff8a4f43c8de70a | [
"MIT"
] | permissive | Blisst-Mobile/Android | 210997f69f3e8759b06b350792c79224c781416a | 759a89aa9a25d8b2fbc868b5c4e8dde7a3fbdeeb | refs/heads/master | 2020-04-10T00:28:21.295285 | 2014-06-19T23:36:58 | 2014-06-19T23:36:58 | 20,134,459 | 3 | 7 | null | 2014-06-19T23:36:59 | 2014-05-24T16:45:29 | Java | UTF-8 | Java | false | false | 962 | java | package com.codeday.detroit.taskmanager.app;
import android.util.Log;
/**
* Created by timothymiko on 5/24/14.
*
* This class is a wrapper for all log operations. It contains a boolean to easily turn off
* all logging.
*/
public class CDLog {
public static boolean loggingEnabled = true;
public static void verboseLog(String tag, String message) {
if ( loggingEnabled )
Log.v(tag, message);
}
public static void debugLog(String tag, String message) {
if ( loggingEnabled )
Log.d(tag, message);
}
public static void infoLog(String tag, String message) {
if ( loggingEnabled )
Log.i(tag, message);
}
public static void warnLog(String tag, String message) {
if ( loggingEnabled )
Log.w(tag, message);
}
public static void errorLog(String tag, String message) {
if ( loggingEnabled )
Log.e(tag, message);
}
}
| [
"kevinzurek@gmail.com"
] | kevinzurek@gmail.com |
524869a3b733d52cb07971b2452f9ccdd6fe9575 | 4bdbf97d12b7549061534e8c8fdb7a02e9cdf030 | /Transporte/src/ups/edu/ec/entities/security/TraOperacion.java | c7e2dedce50ecdb8dcb9e4c3a3c9b867b0759784 | [] | no_license | dquisi/transporte | 71713ab6b6d730a586a8474f30bb6f235416d1ea | a1ba231f583d152bd67e9886703f49ceea2673da | refs/heads/master | 2016-08-11T10:15:56.336834 | 2015-06-17T05:43:26 | 2015-06-17T05:43:26 | 36,253,805 | 6 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,770 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ups.edu.ec.entities.security;
import java.io.Serializable;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
/**
*
* @author asissistemas
*/
@Entity
@SequenceGenerator(name = "tra_operacion_seq", sequenceName = "tra_operacion_seq", initialValue = 1, allocationSize = 1)
@Table(name="TRA_OPERACION")
public class TraOperacion implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "tra_operacion_seq")
@Column(name="OPE_ID")
private Long opeId;
@Column(name="OPE_DESCRIPCION")
private String opeDescripcion;
//RELACION DE UNO A MUCHOS <OPERACION A PERMISO>
@OneToMany(mappedBy="tranOperacion",cascade={CascadeType.REMOVE, CascadeType.REFRESH},fetch=FetchType.LAZY)
public List<TraPermiso> tranPermisoList;
public Long getOpeId() {
return opeId;
}
public void setOpeId(Long opeId) {
this.opeId = opeId;
}
public String getOpeDescripcion() {
return opeDescripcion;
}
public void setOpeDescripcion(String opeDescripcion) {
this.opeDescripcion = opeDescripcion;
}
public List<TraPermiso> getTranPermisoList() {
return tranPermisoList;
}
public void setTranPermisoList(List<TraPermiso> tranPermisoList) {
this.tranPermisoList = tranPermisoList;
}
@Override
public int hashCode() {
int hash = 0;
hash += (opeId != null ? opeId.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the opeId fields are not set
if (!(object instanceof TraOperacion)) {
return false;
}
TraOperacion other = (TraOperacion) object;
if ((this.opeId == null && other.opeId != null) || (this.opeId != null && !this.opeId.equals(other.opeId))) {
return false;
}
return true;
}
@Override
public String toString() {
return "ups.edu.ec.entites.security.TranOperacion[ id=" + opeId + " ]";
}
}
| [
"asissistemas@O01ASISISTEM01.coopmultiempresarial.local"
] | asissistemas@O01ASISISTEM01.coopmultiempresarial.local |
fb8ef3f9cd4705db080da97bd4e03ed2549de1d4 | f3d73571681cd54397b02aaae26dcc0c76f7e403 | /app/src/test/java/com/example/tmara/lazylistpicasso/ExampleUnitTest.java | 2e57d67a81a55b6e6f304d69286ce4d0c7c960e3 | [] | no_license | thaymara/android-LazyListWithPicasso | 6c6410340763a46348ae345148b6cbf7574879fb | 7515dc12834a4f1b0ac63253ce58ff95127f9164 | refs/heads/master | 2021-06-06T10:48:00.601459 | 2016-11-08T18:08:01 | 2016-11-08T18:08:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 326 | java | package com.example.tmara.lazylistpicasso;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"thaysamarasantos@gmail.com"
] | thaysamarasantos@gmail.com |
0ad84db360936dbd417560f1022af34aa45207ed | af8532f09735966d309fcdcdf62cde4fe6e15d72 | /Note_learners_Zenia_tejinder_alesha/app/src/main/java/com/example/note_learners_zenia_tejinder_alesha/NoteDetailActivity.java | 5033bb87a8b1cc924f1adca6a1c337f810cf2644 | [] | no_license | Zenia808146/Note_LearnersGroup_FinalProject | 82deb2c82b2c70c2c67de20c4aa6ad0e05b56172 | 8dd09e4b1ac3c6b11e6b2d000b5f43420980f070 | refs/heads/main | 2023-05-30T07:29:11.453947 | 2021-06-16T01:32:52 | 2021-06-16T01:32:52 | 377,337,483 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 373 | java | package com.example.note_learners_zenia_tejinder_alesha;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class NoteDetailActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_note_detail);
}
} | [
"noreply@github.com"
] | Zenia808146.noreply@github.com |
6c8b8ce0703676faa9d264de690b9ead31b92a71 | 3468cd0fff41d439e054c447407f713ac172daf4 | /src/main/java/com/jdelgado/CRUD/interfaceService/InterfazPersonaService.java | 14a01cc0683034dd49b58bb31a3aca324ac0556d | [] | no_license | Jdelgado6/CRUD | 0d8d9ec5f89528b260e83fc4cf44509b91d0ac36 | 1d0c2144d9984e7486541f6194d28779f11056f9 | refs/heads/master | 2023-04-14T09:28:41.524346 | 2021-05-04T17:43:18 | 2021-05-04T17:43:18 | 364,338,479 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 332 | java | package com.jdelgado.CRUD.interfaceService;
import java.util.List;
import java.util.Optional;
import com.jdelgado.CRUD.modelo.Persona;
public interface InterfazPersonaService {
public List<Persona> listar();
public Optional<Persona> listarId(int id);
public int save(Persona p);
public void delete(int id);
}
| [
"jorge.delgaado@gmail.com"
] | jorge.delgaado@gmail.com |
c20f99131581859323057ddc6df80f41fa4ce97f | f4c79046ca784eb435853ab1e0a067ac783dbf6b | /src/main/java/com/abnormallydriven/daggerspark/Application.java | b21ee8c3dd337db164b533a0ee823b794ef50c6a | [] | no_license | wesblume23/spark-java-dagger2-gradle | 0988bb68e8ca6cfe64017c33da6cb0fef23ed991 | 7bd6a01e1f683412ae91823e9583d76025ffffe9 | refs/heads/master | 2020-03-20T23:33:07.444688 | 2017-07-19T01:57:32 | 2017-07-19T01:57:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,214 | java | package com.abnormallydriven.daggerspark;
import com.abnormallydriven.daggerspark.dagger.ApplicationComponent;
import com.abnormallydriven.daggerspark.dagger.DaggerApplicationComponent;
public class Application {
private static ApplicationComponent applicationComponent;
public static ApplicationComponent getApplicationComponent(){
return applicationComponent;
}
private void start(){
//initialize dagger
initializeDagger();
//register exception handlers
registerExceptionHandlers();
//register our filters
registerFilters();
//register routes
registerRoutes();
}
private void initializeDagger() {
applicationComponent = DaggerApplicationComponent.create();
}
private void registerExceptionHandlers() {
applicationComponent.exceptionHandlerRegistry().registerHandlers();
}
private void registerFilters() {
applicationComponent.filterRegistry().registerFilters();
}
private void registerRoutes(){
applicationComponent.resourceRegistry().registerRoutes();
}
public static void main(String[] args) {
new Application().start();
}
}
| [
"bretttucker@gmail.com"
] | bretttucker@gmail.com |
ef465bd33136d90e46ea89b533e8f057b08f9d0b | 96a1e3b146e35fd86482147c1f648865f9b4b94c | /TSS.Java/src/tss/tpm/NV_ReadLockResponse.java | 8122a3fbe17bb33631745cab3cd97f08048f09e8 | [
"MIT"
] | permissive | CIPop/TSS.MSR | c496182503e8792c0a703369a7e8c181f5ccda45 | 66425274b1c93765678cc845865366d0e67829af | refs/heads/master | 2021-08-23T01:14:06.776704 | 2017-12-01T06:25:03 | 2017-12-01T06:25:03 | 107,336,461 | 0 | 0 | null | 2017-10-17T23:53:09 | 2017-10-17T23:53:08 | null | UTF-8 | Java | false | false | 1,808 | java | package tss.tpm;
import tss.*;
// -----------This is an auto-generated file: do not edit
//>>>
/**
* If TPMA_NV_READ_STCLEAR is SET in an Index, then this command may be used to prevent further reads of the NV Index until the next TPM2_Startup (TPM_SU_CLEAR).
*/
public class NV_ReadLockResponse extends TpmStructure
{
/**
* If TPMA_NV_READ_STCLEAR is SET in an Index, then this command may be used to prevent further reads of the NV Index until the next TPM2_Startup (TPM_SU_CLEAR).
*/
public NV_ReadLockResponse()
{
}
@Override
public void toTpm(OutByteBuf buf)
{
return;
}
@Override
public void initFromTpm(InByteBuf buf)
{
}
@Override
public byte[] toTpm()
{
OutByteBuf buf = new OutByteBuf();
toTpm(buf);
return buf.getBuf();
}
public static NV_ReadLockResponse fromTpm (byte[] x)
{
NV_ReadLockResponse ret = new NV_ReadLockResponse();
InByteBuf buf = new InByteBuf(x);
ret.initFromTpm(buf);
if (buf.bytesRemaining()!=0)
throw new AssertionError("bytes remaining in buffer after object was de-serialized");
return ret;
}
public static NV_ReadLockResponse fromTpm (InByteBuf buf)
{
NV_ReadLockResponse ret = new NV_ReadLockResponse();
ret.initFromTpm(buf);
return ret;
}
@Override
public String toString()
{
TpmStructurePrinter _p = new TpmStructurePrinter("TPM2_NV_ReadLock_RESPONSE");
toStringInternal(_p, 1);
_p.endStruct();
return _p.toString();
}
@Override
public void toStringInternal(TpmStructurePrinter _p, int d)
{
};
};
//<<<
| [
"Andrey.Marochko@microsoft.com"
] | Andrey.Marochko@microsoft.com |
b16427d9757cc79f135a1452a9cfd1e8adf13e5c | 7b1a7b8e4c96f75062668667695072df20df85a3 | /7_TaskerServiceProject/tasker-service/src/main/java/com/trilogyed/tasker/service/TaskerServiceLayer.java | c5575aaa691cba1253227ec0d14726c89cfb97a4 | [] | no_license | hkahng92/Java-Portfolio-Hyunseok | d3f2c2f445dfedff205fbde8338f38ed4e2fbd23 | 4380de2e12a57ac7f82648d12975ae5dbf565caf | refs/heads/master | 2023-08-08T13:56:57.610180 | 2020-04-23T18:56:05 | 2020-04-23T18:56:05 | 201,708,324 | 0 | 0 | null | 2023-07-22T13:16:02 | 2019-08-11T02:45:19 | Java | UTF-8 | Java | false | false | 4,766 | java | package com.trilogyed.tasker.service;
import com.trilogyed.tasker.dao.TaskerDao;
import com.trilogyed.tasker.model.Task;
import com.trilogyed.tasker.model.TaskViewModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.client.RestTemplate;
import java.util.ArrayList;
import java.util.List;
@Component
public class TaskerServiceLayer {
private TaskerDao taskerDao;
@Autowired
private DiscoveryClient discoveryClient;
private RestTemplate restTemplate = new RestTemplate();
@Value("${adserverServiceName}")
private String adserverServiceName;
@Value("${serviceProtocol}")
private String serviceProtocol;
@Value("${servicePath}")
private String servicePath;
@Autowired
public TaskerServiceLayer(TaskerDao taskerDao){
this.taskerDao=taskerDao;
}
public TaskerServiceLayer(TaskerDao taskerDao, DiscoveryClient discoveryClient, RestTemplate restTemplate, String adserverServiceName, String serviceProtocol, String servicePath){
this.taskerDao=taskerDao;
this.discoveryClient=discoveryClient;
this.restTemplate=restTemplate;
this.adserverServiceName=adserverServiceName;
this.serviceProtocol=serviceProtocol;
this.servicePath=servicePath;
}
@RequestMapping(value="/ad",method= RequestMethod.GET)
public String getAd(){
List<ServiceInstance> instances = discoveryClient.getInstances(adserverServiceName);
String adserverUri = serviceProtocol+instances.get(0).getHost()+":"+instances.get(0).getPort()+servicePath;
String myAd = restTemplate.getForObject(adserverUri,String.class);
return myAd;
}
public TaskViewModel fetchTask(int id) {
Task task = taskerDao.getTask(id);
if(task == null){
return null;
}
TaskViewModel tvm = new TaskViewModel();
tvm.setId(task.getId());
tvm.setDescription(task.getDescription());
tvm.setCreateDate(task.getCreateDate());
tvm.setDueDate(task.getDueDate());
tvm.setCategory(task.getCategory());
// TODO - get ad from Adserver and put in tvm
tvm.setAdvertisement(getAd());
return tvm;
}
public List<TaskViewModel> fetchAllTasks() {
List<Task> tasks = taskerDao.getAllTasks();
List<TaskViewModel> tvms = new ArrayList<>();
for(Task task : tasks){
tvms.add(buildTaskViewModel(task));
}
return tvms;
}
public List<TaskViewModel> fetchTasksByCategory(String category) {
List<Task> tasks = taskerDao.getTasksByCategory(category);
List<TaskViewModel> tvms = new ArrayList<>();
for(Task task : tasks){
tvms.add(buildTaskViewModel(task));
}
return tvms;
}
public TaskViewModel newTask(TaskViewModel taskViewModel) {
Task task = new Task();
task.setDescription(taskViewModel.getDescription());
task.setCreateDate(taskViewModel.getCreateDate());
task.setDueDate(taskViewModel.getDueDate());
task.setCategory(taskViewModel.getCategory());
task = taskerDao.createTask(task);
taskViewModel.setId(task.getId());
// TODO - get ad from Adserver and put in taskViewModel
taskViewModel.setAdvertisement(getAd());
return taskViewModel;
}
public void deleteTask(int id) {
taskerDao.deleteTask(id);
}
public TaskViewModel updateTask(TaskViewModel taskViewModel) {
Task task = new Task();
task.setId(taskViewModel.getId());
task.setDescription(taskViewModel.getDescription());
task.setCreateDate(taskViewModel.getCreateDate());
task.setDueDate(taskViewModel.getDueDate());
task.setCategory(taskViewModel.getCategory());
taskerDao.updateTask(task);
return buildTaskViewModel(task);
}
private TaskViewModel buildTaskViewModel(Task task){
TaskViewModel taskViewModel = new TaskViewModel();
taskViewModel.setId(task.getId());
taskViewModel.setDescription(task.getDescription());
taskViewModel.setCreateDate(task.getCreateDate());
taskViewModel.setDueDate(task.getDueDate());
taskViewModel.setCategory(task.getCategory());
taskViewModel.setAdvertisement(getAd());
return taskViewModel;
}
}
| [
"tkahng0531@gmail.com"
] | tkahng0531@gmail.com |
1e49d609597d3578ef43d731f029f427b008c898 | e69e5d899856b185e23b6ca0ed50df38b2aff5d1 | /workorder-data-services/src/main/java/com/tip/fetchtechnician/repository/TechnicianDetailsRepository.java | ee8bd19426a6cad650142ba54fe4fe81ea31fcf3 | [] | no_license | shuvankar999/git_backup | 10edee9a3db6e4dcb6b67df2a712ebce10c33f31 | b39e126e45df1c6147aace22aabbcc75b3d65322 | refs/heads/main | 2023-06-14T17:12:55.874523 | 2021-07-09T16:16:14 | 2021-07-09T16:16:14 | 384,487,809 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 308 | java | package com.tip.fetchtechnician.repository;
import com.tip.fetchtechnician.model.TechnicianDetailsRequest;
import java.util.Map;
@FunctionalInterface
public interface TechnicianDetailsRepository {
public Map<String, Object> getTechnicianDetails(TechnicianDetailsRequest technicianDetailsRequest);
}
| [
"shuvankar999@gmail.com"
] | shuvankar999@gmail.com |
7d08d97648983d4f3fec0b6fa1828e48ed201070 | 34a9ae177eb487291f842d874c5c6c50f13296d2 | /springboots/basic/src/main/java/com/ggoreb/basic/controller/HtmlController.java | bb92f66037321dc68bd6ed866db8b09dbe0a8ae1 | [] | no_license | dico1631/TIL | 115997261a1278ca71750e616cc70464b767129a | 7243f2537a47346fee2febe4f79f16b66e890de0 | refs/heads/master | 2020-11-24T21:00:52.707890 | 2020-03-17T09:04:02 | 2020-03-17T09:04:02 | 228,338,815 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,063 | java | package com.ggoreb.basic.controller;
import java.util.HashMap;
import java.util.Map;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.servlet.ModelAndView;
import com.ggoreb.basic.model.Member;
@Controller
public class HtmlController {
@GetMapping("html/string")
public String html() {
return "html/string";
}
@GetMapping("html/void")
public void htmlVoid() {
}
@GetMapping("html/map")
public Map<String, Object> htmlMap(Map<String, Object> map) {
Map<String, Object> map2 = new HashMap<String, Object>();
return map2;
}
@GetMapping("html/model")
public Model htmlModel(Model model) {
return model;
}
@GetMapping("html/model_and_view")
public ModelAndView htmlModel() {
ModelAndView mav = new ModelAndView();
mav.setViewName("html/model_and_view");
return mav;
}
@GetMapping("html/object")
public Member htmlObject() {
Member member = new Member();
member.setName("kim");
return member;
}
} | [
"dicoqnfkrzl@naver.com"
] | dicoqnfkrzl@naver.com |
af56ec5c0d9663c9c7af15033db80b8449ab59f5 | eb97ee5d4f19d7bf028ae9a400642a8c644f8fe3 | /tags/2010-02-27/seasar2-2.4.41/s2-tiger/src/test/java/org/seasar/extension/dxo/Employee.java | 9d1d9185f5d674bcec38b81e217831fe2f72b349 | [
"Apache-2.0"
] | permissive | svn2github/s2container | 54ca27cf0c1200a93e1cb88884eb8226a9be677d | 625adc6c4e1396654a7297d00ec206c077a78696 | refs/heads/master | 2020-06-04T17:15:02.140847 | 2013-08-09T09:38:15 | 2013-08-09T09:38:15 | 10,850,644 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,682 | java | /*
* Copyright 2004-2010 the Seasar Foundation and the Others.
*
* 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.seasar.extension.dxo;
/**
*
*/
public class Employee {
private static final long serialVersionUID = -8378271087258215629L;
private long empno;
private String ename;
private String job;
private Employee mgr;
private java.util.Date hiredate;
private Float sal;
private Float comm;
private Integer deptno;
private byte[] password;
private String dummy;
private Department department;
/**
*
*/
public Employee() {
}
/**
* @param empno
*/
public Employee(long empno) {
this.empno = empno;
}
/**
* @return
*/
public long getEmpno() {
return this.empno;
}
/**
* @param empno
*/
public void setEmpno(long empno) {
this.empno = empno;
}
/**
* @return
*/
public java.lang.String getEname() {
return this.ename;
}
/**
* @param ename
*/
public void setEname(java.lang.String ename) {
this.ename = ename;
}
/**
* @return
*/
public java.lang.String getJob() {
return this.job;
}
/**
* @param job
*/
public void setJob(java.lang.String job) {
this.job = job;
}
/**
* @return
*/
public Employee getMgr() {
return this.mgr;
}
/**
* @param mgr
*/
public void setMgr(Employee mgr) {
this.mgr = mgr;
}
/**
* @return
*/
public java.util.Date getHiredate() {
return this.hiredate;
}
/**
* @param hiredate
*/
public void setHiredate(java.util.Date hiredate) {
this.hiredate = hiredate;
}
/**
* @return
*/
public Float getSal() {
return this.sal;
}
/**
* @param sal
*/
public void setSal(Float sal) {
this.sal = sal;
}
/**
* @return
*/
public Float getComm() {
return this.comm;
}
/**
* @param comm
*/
public void setComm(Float comm) {
this.comm = comm;
}
/**
* @return
*/
public Integer getDeptno() {
return this.deptno;
}
/**
* @param deptno
*/
public void setDeptno(Integer deptno) {
this.deptno = deptno;
}
/**
* @return
*/
public byte[] getPassword() {
return this.password;
}
/**
* @param password
*/
public void setPassword(byte[] password) {
this.password = password;
}
/**
* @return
*/
public String getDummy() {
return this.dummy;
}
/**
* @param dummy
*/
public void setDummy(String dummy) {
this.dummy = dummy;
}
/**
* @return
*/
public Department getDepartment() {
return this.department;
}
/**
* @param department
*/
public void setDepartment(Department department) {
this.department = department;
}
@Override
public boolean equals(Object other) {
if (!(other instanceof Employee))
return false;
Employee castOther = (Employee) other;
return this.getEmpno() == castOther.getEmpno();
}
@Override
public String toString() {
StringBuffer buf = new StringBuffer();
buf.append(empno).append(", ");
buf.append(ename).append(", ");
buf.append(job).append(", ");
buf.append(mgr).append(", ");
buf.append(hiredate).append(", ");
buf.append(sal).append(", ");
buf.append(comm).append(", ");
buf.append(deptno).append(" {");
buf.append(department).append("}");
return buf.toString();
}
@Override
public int hashCode() {
return (int) this.getEmpno();
}
}
| [
"koichik@319488c0-e101-0410-93bc-b5e51f62721a"
] | koichik@319488c0-e101-0410-93bc-b5e51f62721a |
6d7b5bee30851e12dde4e92a3b918600f08fdcc0 | 11a6648cfef323e03ad42796565003818a53f730 | /CZ2002 Object Oriented Design & Programming/oodp_labs/src/lab1/P2.java | ca35b1cb506a32f4403b0a7a9941846d2b462525 | [] | no_license | yws888/NTU-CS | 724357d966313a270efa0520a2ef8cfd39df771b | 2a30b580790a48fbbc5790c249fc7faf504c2b4b | refs/heads/main | 2023-02-24T13:57:51.681467 | 2021-01-26T18:07:17 | 2021-01-26T18:07:17 | 321,960,211 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,117 | java | package lab1;
import java.util.Scanner;
public class P2 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in); // Create a Scanner object
System.out.println("Enter salary:");
int salary = sc.nextInt();
System.out.println("Enter merit points:");
int merit = sc.nextInt();
if (800 <= salary && salary <= 899) {
System.out.println("Grade A");
}
else if (700 <= salary && salary <= 799) {
if (merit < 20) {
System.out.println("Grade B");
}
else
System.out.println("Grade A");
}
else if (650 <= salary && salary <= 699) {
System.out.println("Grade B");
}
else if (600 <= salary && salary <= 649) {
if (merit < 10) {
System.out.println("Grade C");
}
else
System.out.println("Grade B");
}
else if (500 <= salary && salary <= 599) {
System.out.println("Grade C");
}
else {
System.out.println("Salary out of range");
}
sc.close();
}
}
| [
"61619668+yws888@users.noreply.github.com"
] | 61619668+yws888@users.noreply.github.com |
9fd7bfe3dac63bcb115bffb32ba5c3cb4186d57f | 83665ae1e27cebdb05e88ab7b73f5d82752ea9d0 | /DemoProject/src/dao/UserDAO.java | 245f70986bd3660e86cce8e036f9c176497f3bfe | [] | no_license | NhamHoangAnh/SE2project | 9d029520199e382219beaab22b03e6d6c3430f34 | d01be12f0671234d2e5d7b5bbb6bbd6bc7010e26 | refs/heads/master | 2022-09-20T02:52:34.885021 | 2020-06-06T13:17:54 | 2020-06-06T13:17:54 | 250,160,842 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 922 | java | package dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import connect.DBConnect;
import model.User;
public class UserDAO {
private Connection conn;
public UserDAO() {
conn = DBConnect.getConnection();
}
public boolean login(String username,String password)
throws SQLException {
String getUser = "SELECT * FROM User WHERE username =? AND password =?";
PreparedStatement pstmt = conn.prepareStatement(getUser);
pstmt.setString(1, username);
pstmt.setString(2, password);
ResultSet rs = pstmt.executeQuery();
if (rs.next()) {
return true;
} else {
return false;
}
}
public static void main(String args[]) {
UserDAO uD = new UserDAO();
try {
System.out.println(uD.login("admin", "admin"));
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
} | [
"Hoang Anh Cyber@DESKTOP-78RDCGP"
] | Hoang Anh Cyber@DESKTOP-78RDCGP |
14f5a0a53781361996287a194e627843aac51cf1 | b9ca41d1e7bdcfa98fc0933a97f014e87dacc8f8 | /episodic-events/src/main/java/com/example/episodicevents/events/RewindEvent.java | bdc7f925e77e930163ecbc8869918ba25572bda9 | [] | no_license | jamesjadler/episodic-apps | 70f730b92300ba5a94fd1c4c3df410c2f1a31793 | d26455cdf7e999caf5d19e07f10add85c4606bf1 | refs/heads/master | 2021-01-21T07:19:58.635746 | 2017-05-25T20:46:57 | 2017-05-25T20:46:57 | 91,609,142 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 572 | java | package com.example.episodicevents.events;
import com.example.episodicevents.events.data.RewindData;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDateTime;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class RewindEvent extends Event{
private RewindData data;
public RewindEvent(String id, Long userId, Long showId, Long episodeId, LocalDateTime createdAt, RewindData data) {
super(id, userId, showId, episodeId, createdAt);
this.data = data;
}
}
| [
"trainer7@trainer7s-MacBook-Pro.local"
] | trainer7@trainer7s-MacBook-Pro.local |
11f35eaa4a18ce9dbca3ee9e95696a36ef8b6613 | 166a8767141d2838498b224a2211721491981c01 | /ModularizedRL/src/structures/data/converters/output/OutputTabOrCSV.java | 77ce81b36fd5794d323d003b1d815bcc7c249eea | [] | no_license | pratibha5/MachineLearningWork | 127a66520c7df6ed2e708bbe7f5575399c022e3e | 16bde03783ecb5c92824a155de11a60db042925e | refs/heads/master | 2020-09-06T13:59:57.624924 | 2014-08-28T17:16:41 | 2014-08-28T17:16:41 | 94,419,500 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 402 | java | package structures.data.converters.output;
import data.dataset.Dataset;
public class OutputTabOrCSV extends OutputDataset {
public OutputTabOrCSV(Dataset data, String outFileName, String sep) {
super(data, outFileName);
data.setSeperator(sep);
}
public void printDataset(boolean useDisc) {
outPS.print(data.print(useDisc));
if (outPS != System.out)
outPS.close();
}
} | [
"Pvs10@abacus-dt-035.univ.pitt.edu"
] | Pvs10@abacus-dt-035.univ.pitt.edu |
81b5b553f04944de2d541ba305d7f88c05c70f73 | 7c388a111cefcd6f81a7dd466ab58c1cad514880 | /app/src/main/java/com/example/dotslash/dotslashhome/MainActivity.java | e2084f828f6d969a5f7ee3a8f30b47ad2ad071c2 | [] | no_license | vishnumaheshj/Android-app | e4b55090aafe39b337cf38b59a4c0b2c39870e3c | 2ecf0acc730dbcb326234ef590b632c3be8c27cc | refs/heads/master | 2020-04-03T12:29:47.120069 | 2018-01-09T09:21:48 | 2018-01-09T09:21:48 | 155,254,064 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,591 | java | package com.example.dotslash.dotslashhome;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void tryLogIn(View view) {
Intent intent = new Intent(this, DisplayDash.class);
String user, pass;
user = ((EditText)findViewById(R.id.editText)).getText().toString();
pass = ((EditText)findViewById(R.id.editText2)).getText().toString();
intent.putExtra("username", user);
intent.putExtra("password", pass);
startActivity(intent);
}
}
//private Button logIn;
/*
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
logIn = (Button) findViewById(R.id.logIn);
output = (TextView) findViewById(R.id.output);
client = new OkHttpClient();
logIn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
final EditText user, pass;
user = (EditText) findViewById(R.id.editText);
pass = (EditText) findViewById(R.id.editText2);
start(user.getText().toString(), pass.getText().toString());
}
});
}
*/
| [
"vishnu@dot-slash.in"
] | vishnu@dot-slash.in |
e0d2ba4fabcab2ab56edcd31fe76cf6c9da030cd | 606cd7931bc5288ffe91cf58f45d3e4f64a9b3df | /pk-ejb/src/java/com/pelindo/ebtos/ejb/facade/remote/MasterCountryFacadeRemote.java | 74d5c24bbd4e10fdd15f1c3c5aa06cd0a5b7ff6f | [] | no_license | surachman/iconos-tarakan | 5655284ac69059935922d92ee856b6926b656d1d | d7fa1c120d22d391983dab95c5654cb63b27e1f7 | refs/heads/master | 2021-01-20T20:21:40.937285 | 2016-06-27T14:51:22 | 2016-06-27T14:51:22 | 61,995,382 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 653 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.pelindo.ebtos.ejb.facade.remote;
import com.pelindo.ebtos.model.db.master.MasterCountry;
import java.util.List;
import javax.ejb.Remote;
/**
*
* @author dycoder
*/
@Remote
public interface MasterCountryFacadeRemote {
void create(MasterCountry masterCountry);
void edit(MasterCountry masterCountry);
void remove(MasterCountry masterCountry);
MasterCountry find(Object id);
List<MasterCountry> findAll();
List<MasterCountry> findRange(int[] range);
List<Object[]> findAllNative();
int count();
}
| [
"surachman026@gmail.com"
] | surachman026@gmail.com |
e8f54f68314f3d16b2eafcffb5ff2dec6d87e981 | 6c7ea8b9133ffa57afac6e19fb423eca40bfd914 | /app/src/main/java/com/rainnshieh/adapter/ViewHolder.java | 9ec0780f79c3d3bed684c41e28a4b4401194e342 | [] | no_license | congxc/SwipeMenuListView | 16e3b03bacc0c9b9ac431c2c71e87f75ac4de2d3 | b1c6bd714a0a599da87be35a447ab5cf625779f2 | refs/heads/master | 2020-12-24T07:47:38.062604 | 2016-11-14T08:34:00 | 2016-11-14T08:34:00 | 73,367,648 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,290 | java | package com.rainnshieh.adapter;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.text.util.Linkify;
import android.util.SparseArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AlphaAnimation;
import android.widget.Checkable;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.RatingBar;
import android.widget.TextView;
public class ViewHolder {
private SparseArray<View> mViews;
private int mPosition;
private View mConvertView;
private Context mContext;
private int mLayoutId;
public ViewHolder(Context context, ViewGroup parent, int layoutId,
int position) {
mContext = context;
mLayoutId = layoutId;
this.mPosition = position;
this.mViews = new SparseArray<>();
mConvertView = LayoutInflater.from(context).inflate(layoutId, parent,
false);
mConvertView.setTag(this);
}
public static ViewHolder get(Context context, View convertView,
ViewGroup parent, int layoutId, int position) {
if (convertView == null) {
return new ViewHolder(context, parent, layoutId, position);
} else {
ViewHolder holder = (ViewHolder) convertView.getTag();
holder.mPosition = position;
return holder;
}
}
public int getPosition() {
return mPosition;
}
public int getLayoutId() {
return mLayoutId;
}
/**
* 通过viewId获取控件
*
* @param viewId
* @return
*/
public <T extends View> T getView(int viewId) {
View view = mViews.get(viewId);
if (view == null) {
view = mConvertView.findViewById(viewId);
mViews.put(viewId, view);
}
return (T) view;
}
public View getConvertView() {
return mConvertView;
}
/**
* 设置TextView的值
*
* @param viewId
* @param text
* @return
*/
public ViewHolder setText(int viewId, String text) {
TextView tv = getView(viewId);
tv.setText(TextUtils.isEmpty(text) ? "" : text);
return this;
}
/**
* 设置TextView的值
*
* @param viewId
* @param text
* @return
*/
public ViewHolder setText(int viewId, SpannableStringBuilder text) {
TextView tv = getView(viewId);
tv.setText(TextUtils.isEmpty(text) ? "" : text);
return this;
}
/**
* 设置TextView的值
*
* @param viewId
* @param textRes
* @return
*/
public ViewHolder setText(int viewId, int textRes) {
TextView tv = getView(viewId);
tv.setText(textRes);
return this;
}
public ViewHolder setImageResource(int viewId, int resId) {
ImageView view = getView(viewId);
view.setImageResource(resId);
return this;
}
public ViewHolder setImageBitmap(int viewId, Bitmap bitmap) {
ImageView view = getView(viewId);
view.setImageBitmap(bitmap);
return this;
}
public ViewHolder setImageDrawable(int viewId, Drawable drawable) {
ImageView view = getView(viewId);
view.setImageDrawable(drawable);
return this;
}
public ViewHolder setBackgroundColor(int viewId, int color) {
View view = getView(viewId);
view.setBackgroundColor(color);
return this;
}
public ViewHolder setBackgroundRes(int viewId, int backgroundRes) {
View view = getView(viewId);
if(view == null){
return this;
}
view.setBackgroundResource(backgroundRes);
return this;
}
public ViewHolder setTextColor(int viewId, int textColor) {
TextView view = getView(viewId);
view.setTextColor(textColor);
return this;
}
public ViewHolder setTextColorRes(int viewId, int textColorRes) {
TextView view = getView(viewId);
view.setTextColor(mContext.getResources().getColor(textColorRes));
return this;
}
@SuppressLint("NewApi")
public ViewHolder setAlpha(int viewId, float value) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
getView(viewId).setAlpha(value);
} else {
// Pre-honeycomb hack to set Alpha value
AlphaAnimation alpha = new AlphaAnimation(value, value);
alpha.setDuration(0);
alpha.setFillAfter(true);
getView(viewId).startAnimation(alpha);
}
return this;
}
public ViewHolder setVisible(int viewId, boolean visible) {
View view = getView(viewId);
if(view == null){
return this;
}
view.setVisibility(visible ? View.VISIBLE : View.GONE);
return this;
}
public ViewHolder setVisible(int viewId, int visible) {
View view = getView(viewId);
view.setVisibility(visible);
return this;
}
public ViewHolder linkify(int viewId) {
TextView view = getView(viewId);
Linkify.addLinks(view, Linkify.ALL);
return this;
}
public ViewHolder setTypeface(Typeface typeface, int... viewIds) {
for (int viewId : viewIds) {
TextView view = getView(viewId);
view.setTypeface(typeface);
view.setPaintFlags(view.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG);
}
return this;
}
public ViewHolder setProgress(int viewId, int progress) {
ProgressBar view = getView(viewId);
view.setProgress(progress);
return this;
}
public ViewHolder setProgress(int viewId, int progress, int max) {
ProgressBar view = getView(viewId);
view.setMax(max);
view.setProgress(progress);
return this;
}
public ViewHolder setMax(int viewId, int max) {
ProgressBar view = getView(viewId);
view.setMax(max);
return this;
}
public ViewHolder setRating(int viewId, float rating) {
RatingBar view = getView(viewId);
view.setRating(rating);
return this;
}
public ViewHolder setRating(int viewId, float rating, int max) {
RatingBar view = getView(viewId);
view.setMax(max);
view.setRating(rating);
return this;
}
public ViewHolder setTag(int viewId, Object tag) {
View view = getView(viewId);
view.setTag(tag);
return this;
}
public ViewHolder setTag(int viewId, int key, Object tag) {
View view = getView(viewId);
view.setTag(key, tag);
return this;
}
public ViewHolder setChecked(int viewId, boolean checked) {
Checkable view = getView(viewId);
view.setChecked(checked);
return this;
}
public ViewHolder setSelected(int viewId, boolean checked) {
View view = getView(viewId);
view.setSelected(checked);
return this;
}
/**
* 关于事件的
*/
public ViewHolder setOnClickListener(int viewId,
View.OnClickListener listener) {
View view = getView(viewId);
if (view != null) {
view.setOnClickListener(listener);
}
return this;
}
public ViewHolder setOnTouchListener(int viewId,
View.OnTouchListener listener) {
View view = getView(viewId);
view.setOnTouchListener(listener);
return this;
}
public ViewHolder setOnLongClickListener(int viewId,
View.OnLongClickListener listener) {
View view = getView(viewId);
view.setOnLongClickListener(listener);
return this;
}
public void setTextSize(int id, int titleSize) {
TextView view = getView(id);
view.setTextSize(titleSize);
}
}
| [
"xiecong251911@outlook.com"
] | xiecong251911@outlook.com |
769dd192cdac351c82d8cce1c75245299c06212c | da7e5c8023b48dbf69b93d2bb9cf8dc620575f7c | /chapter_001/src/main/java/ru/job4j/array/Square.java | 25bc4e48fec4b19ee4b94e02acce20e386622ac2 | [] | no_license | maximrazumkov/job4j | d984a1d9ab366109e2c6f524b0112bddaf5dd972 | 50890892d4e01a524ecc60bc7e3fb68a9fb53256 | refs/heads/master | 2022-09-17T21:49:43.378360 | 2020-03-11T12:19:22 | 2020-03-11T12:19:22 | 211,255,482 | 0 | 0 | null | 2022-02-16T01:04:13 | 2019-09-27T06:55:05 | Java | UTF-8 | Java | false | false | 236 | java | package ru.job4j.array;
public class Square {
public int[] calculate(int bound) {
int[] rst = new int[bound];
for (int i = 1; i <= bound; ++i) {
rst[i - 1] = i * i;
}
return rst;
}
}
| [
"maxim.razumkov@gmail.com"
] | maxim.razumkov@gmail.com |
242338ce32265e54dafce232b8af238fcce645d3 | a22547f2d5184af57baeb60ac8a19467d33632e4 | /alphabet.java | f9610553b6d196d6d2f945c8e57e41c56038a598 | [] | no_license | Caroline-Cui/CS-245-Assignment1 | 2701c3b927db26ce5a58e88ba90c300700ccb4c7 | 19154f11ee36de575ab50ec0e6d6558ad80ed4c1 | refs/heads/master | 2020-09-13T03:11:14.101295 | 2019-11-19T15:48:41 | 2019-11-19T15:48:41 | 222,640,863 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,245 | java | public class alphabet
{
// This file, I create a switch statement to represent 27 pointers in the trie node
int value;
public alphabet(char ch)
{
switch (ch)
{
case 'a':
value = 0;
break;
case 'b':
value = 1;
break;
case 'c':
value = 2;
break;
case 'd':
value = 3;
break;
case 'e':
value = 4;
break;
case 'f':
value = 5;
break;
case 'g':
value = 6;
break;
case 'h':
value = 7;
break;
case 'i':
value = 8;
break;
case 'j':
value = 9;
break;
case 'k':
value = 10;
break;
case 'l':
value = 11;
break;
case 'm':
value = 12;
break;
case 'n':
value = 13;
break;
case 'o':
value = 14;
break;
case 'p':
value = 15;
break;
case 'q':
value = 16;
break;
case 'r':
value = 17;
break;
case 's':
value = 18;
break;
case 't':
value = 19;
break;
case 'u':
value = 20;
break;
case 'v':
value = 21;
break;
case 'w':
value = 22;
break;
case 'x':
value = 23;
break;
case 'y':
value = 24;
break;
case 'z':
value = 25;
break;
case '\'':
value = 26;
break;
default:
value = -1;
break;
}
}
}
| [
"noreply@github.com"
] | Caroline-Cui.noreply@github.com |
2b379fd7be5bd69ac5513997081e0a19a99fcc9f | ceef66c6a873d3b5de00a8c84e64147ed753bb60 | /BallsInTheRain/src/Agario/Monedas.java | dd3bf812fa0cac2eee2e61ad4ecc406661fe417d | [] | no_license | fdeblasro/BallsInTheRain | 242eb0bad7930eb12eab5f81fbe449915b68f759 | dbeb6caf3ea3437ade1feca7095da0330656c653 | refs/heads/master | 2020-06-19T11:47:28.896797 | 2016-11-27T18:47:37 | 2016-11-27T18:47:37 | 74,907,213 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 987 | java | package Agario;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Rectangle;
public class Monedas {
private int x;
private int y;
private int speed;
private Game game;
public Rectangle rect;
private Rectangle ballRect;
public Monedas(Game game, Rectangle ball, int x, int y, int speed){
this.game=game;
this.ballRect=ball;
this.x=x;
this.y=y;
this.speed=speed;
this.rect=new Rectangle(this.x+1,this.y+1,6,6);
}
public void paint(Graphics2D g){
g.setColor(Color.GRAY);
g.fillOval(this.x, this.y, 8, 8);
g.setColor(Color.DARK_GRAY);
g.drawOval(this.x, this.y, 8, 8);
}
public void move(){
this.x-=1;
this.rect.x-=1;
this.checkCollision(ballRect);
}
public void checkCollision(Rectangle ballRect){
if (this.rect.intersects(ballRect)){
game.scoreUP();
}
}
public int getSpeed(){
return this.speed;
}
public void setSpeed(int speed){
this.speed=speed;
}
}
| [
"noreply@github.com"
] | fdeblasro.noreply@github.com |
5dbc20d1ed7d260dadafff59400984054c758aea | ea5232155e2322aa598ddce46fcb12564d048413 | /src/test/java/com/avaje/ebeaninternal/server/transaction/TestAutoCommitDataSource.java | a7614d5cc533ac0f088f497040bccf003d3328d6 | [
"Apache-2.0"
] | permissive | nedge/avaje-ebeanorm | bc8472fa8d34313841cd244af3ae596c7f7a7cc7 | 1065a8470933b15c1379d8ec0012ef38a1797262 | refs/heads/master | 2021-01-21T08:54:45.288237 | 2014-10-14T06:10:31 | 2014-10-14T06:10:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,457 | java | package com.avaje.ebeaninternal.server.transaction;
import java.util.List;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
import com.avaje.ebean.EbeanServer;
import com.avaje.ebean.EbeanServerFactory;
import com.avaje.ebean.Transaction;
import com.avaje.ebean.config.GlobalProperties;
import com.avaje.ebean.config.ServerConfig;
import com.avaje.tests.model.basic.UTDetail;
public class TestAutoCommitDataSource extends BaseTestCase {
@Test
public void test() {
ServerConfig config = new ServerConfig();
config.setName("h2autocommit");
config.loadFromProperties();
config.addClass(UTDetail.class);
config.setDdlGenerate(true);
config.setDdlRun(true);
config.setAutoCommitMode(true);
GlobalProperties.setSkipPrimaryServer(true);
EbeanServer ebeanServer = EbeanServerFactory.create(config);
UTDetail detail1 = new UTDetail("one", 12, 30D);
UTDetail detail2 = new UTDetail("two", 11, 30D);
UTDetail detail3 = new UTDetail("three", 8, 30D);
Transaction txn = ebeanServer.beginTransaction();
try {
txn.setBatchMode(true);
ebeanServer.save(detail1);
ebeanServer.save(detail2);
ebeanServer.save(detail3);
txn.commit();
} finally {
txn.end();
}
List<UTDetail> details = ebeanServer.find(UTDetail.class).findList();
Assert.assertEquals(3, details.size());
}
}
| [
"robin.bygrave@gmail.com"
] | robin.bygrave@gmail.com |
d854ad4f94e863614bf792bbdd45abf13c137274 | ab1daf355ab7846baf4f3cba627837dc92753c35 | /src/com/kosta/day07/CheckingAccount.java | 809df6b41f0c9b2bb23ce68ad008ca894d65c858 | [] | no_license | 1gil2/kosta_java_study | c58bf69eae92a56b6f74ed6096856efe71e5aae7 | 7eef10b99750d7a0f1699da16faea4e96af228da | refs/heads/master | 2023-03-21T04:27:03.699758 | 2021-03-12T08:24:29 | 2021-03-12T08:24:29 | 346,609,449 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 562 | java | package com.kosta.day07;
public class CheckingAccount extends Account {
private String cardNo;
public int pay(String cardNo, int amount) {
if(!cardNo.equals(this.cardNo)) {
System.out.println("카드번호오류");
return 0;
}
return withdraw(amount);
}
public String getCardNo() {
return cardNo;
}
public void setCardNo(String cardNo) {
this.cardNo = cardNo;
}
@Override
public String toString() {
String st = super.toString();
return st + " CheckingAccount [cardNo=" + cardNo + "]";
}
}
| [
"KOSTA@DESKTOP-CP5SM7A"
] | KOSTA@DESKTOP-CP5SM7A |
831bbf24a39776dbfb6dcee7d07f44ea633e2c14 | 2a9e71eb002ab85223ec6f3e1a1e14fa9ca18176 | /Mapping/src/com/sf/onetone/Laptop.java | f44b9e0837c59474300c2f915ef5dc19813017fd | [] | no_license | Saranya1062/SPRING | c9812a6c99d4e4cecaffdc08505fd82a913d3925 | 5befe23f7742f62718a6767740e3d072dfe3c010 | refs/heads/master | 2023-08-10T06:35:06.485116 | 2021-09-03T05:07:23 | 2021-09-03T05:07:23 | 399,838,751 | 0 | 0 | null | 2021-09-17T02:55:02 | 2021-08-25T13:58:08 | HTML | UTF-8 | Java | false | false | 652 | java | package com.sf.onetone;
import com.sf.manytomany.Student;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import java.util.ArrayList;
import java.util.List;
@Entity
public class Laptop {
@Id
private int lid;
private String lname;
public Laptop(int lid, String lname) {
this.lid = lid;
this.lname = lname;
}
public int getLid() {
return lid;
}
public void setLid(int lid) {
this.lid = lid;
}
public String getLname() {
return lname;
}
public void setLname(String lname) {
this.lname = lname;
}
}
| [
"saranya@synergyfolks.com"
] | saranya@synergyfolks.com |
07d1630e5171e088752e46bbe6d0bf4ee5e571a8 | d361c296d6bd73e2451ea584ace2d93c573d664f | /viola/ExportToConductorRunnable.java | a52d6012ea970c7097682b71da3cc0399fe692a2 | [
"BSD-2-Clause"
] | permissive | mahaaziz95/habanero-autograder | e4db597d8109112e773dbd6013ae5fdefebb7ad3 | b2ecdfe34dd628c3effdafdfe9b37bf31e05ff70 | refs/heads/master | 2020-06-30T06:47:10.793949 | 2016-11-21T17:32:37 | 2016-11-21T17:32:37 | 74,387,100 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,190 | java | import java.util.LinkedList;
import java.io.File;
import java.io.IOException;
/**
* This class implements a late stage in the Viola pipeline: transferring the outputs of the Viola tests back to the
* Conductor for display.
*/
public class ExportToConductorRunnable implements Runnable {
private final LinkedList<LocalTestRunner> toImport;
private final LinkedList<LocalTestRunner> toNotify;
private final static int nretries = 10;
private final static int backoff = 2;
private final static int initialPause = 1000;
public ExportToConductorRunnable(LinkedList<LocalTestRunner> toImport, LinkedList<LocalTestRunner> toNotify) {
this.toImport = toImport;
this.toNotify = toNotify;
}
@Override
public void run() {
while (true) {
// Wait for some work.
LocalTestRunner curr = null;
synchronized(toImport) {
while (toImport.isEmpty()) {
try {
toImport.wait();
} catch (InterruptedException ie) { }
}
curr = toImport.poll();
}
ViolaUtil.log("received export job for run %d from %s to conductor\n", curr.getRunId(),
curr.getLogDir().getAbsolutePath());
/*
* If some internal error caused the log directory to not even be created, we assume that an appropriate
* error message was set by the test runner.
*/
// Transfer the output files for this run back to the conductor.
for (String path : curr.getFilesToSave()) {
final CommonUtils.ProcessResults[] scpResults = new CommonUtils.ProcessResults[1];
final String[] scpCmd = new String[] {"scp", path, curr.getEnv().conductorUser + "@" +
curr.getEnv().conductorHost + ":" + curr.getSubmissionPath() + "/" };
final Throwable err = CommonUtils.retryUntilSuccess(() -> {
try {
scpResults[0] = CommonUtils.runInProcess("", scpCmd, new File("/tmp"), 30000, null);
} catch (IOException|InterruptedException io) {
throw new RuntimeException(io);
}
}, 10, 1000, 2, "copying viola results to conductor");
if (err != null) {
curr.setErrMsg("Unable to save log files: " + err.getMessage());
} else if (scpResults[0].code != 0) {
curr.setErrMsg("Unable to save log files: " + scpResults[0].stderr);
}
}
ViolaUtil.log("export job for run %d completed\n", curr.getRunId());
// Indicate that the conductor should be notified that the results for this Viola run have been copied back.
synchronized (toNotify) {
toNotify.push(curr);
toNotify.notify();
}
ViolaUtil.log("Finished local tests for user=%s assignment=%s run=%d\n", curr.getUser(),
curr.getAssignmentName(), curr.getRunId());
}
}
}
| [
"mahaaziz95@gmail.com"
] | mahaaziz95@gmail.com |
b66a59c252531e73c7357f30e20b23af5d1c2bf1 | f84b6f345115f63cd78562030299ccdafd1fef54 | /src/platform/android/java/chip/platform/PreferencesConfigurationManager.java | 185eda83ca0a6e3cf2db4088da2188b9f9d029e2 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | JordanField/connectedhomeip | 436bde7b804ffbbaafd254e3d782cabf569a8186 | 8dcf5d70cd54209511be6b1180156a00dd8e0cf8 | refs/heads/master | 2023-09-04T02:30:33.821611 | 2021-10-30T14:14:43 | 2021-10-30T14:14:43 | 423,137,284 | 0 | 0 | Apache-2.0 | 2021-10-31T12:08:08 | 2021-10-31T12:08:08 | null | UTF-8 | Java | false | false | 4,732 | java | /*
* Copyright (c) 2021 Project CHIP Authors
* 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 chip.platform;
import android.content.Context;
import android.content.SharedPreferences;
import android.util.Log;
import java.util.Base64;
import java.util.Map;
/** Java interface for ConfigurationManager */
public class PreferencesConfigurationManager implements ConfigurationManager {
private final String TAG = KeyValueStoreManager.class.getSimpleName();
private final String PREFERENCE_FILE_KEY = "chip.platform.ConfigurationManager";
private SharedPreferences preferences;
public PreferencesConfigurationManager(Context context) {
preferences = context.getSharedPreferences(PREFERENCE_FILE_KEY, Context.MODE_PRIVATE);
}
@Override
public long readConfigValueLong(String namespace, String name)
throws AndroidChipPlatformException {
String key = getKey(namespace, name);
if (preferences.contains(key)) {
long value = preferences.getLong(key, Long.MAX_VALUE);
return value;
} else {
Log.d(TAG, "Key '" + key + "' not found in shared preferences");
throw new AndroidChipPlatformException();
}
}
@Override
public String readConfigValueStr(String namespace, String name)
throws AndroidChipPlatformException {
String key = getKey(namespace, name);
if (preferences.contains(key)) {
String value = preferences.getString(key, null);
return value;
} else {
Log.d(TAG, "Key '" + key + "' not found in shared preferences");
throw new AndroidChipPlatformException();
}
}
@Override
public byte[] readConfigValueBin(String namespace, String name)
throws AndroidChipPlatformException {
String key = getKey(namespace, name);
if (preferences.contains(key)) {
String value = preferences.getString(key, null);
byte[] byteValue = Base64.getDecoder().decode(value);
return byteValue;
} else {
Log.d(TAG, "Key '" + key + "' not found in shared preferences");
throw new AndroidChipPlatformException();
}
}
@Override
public void writeConfigValueLong(String namespace, String name, long val)
throws AndroidChipPlatformException {
String key = getKey(namespace, name);
preferences.edit().putLong(key, val).apply();
}
@Override
public void writeConfigValueStr(String namespace, String name, String val)
throws AndroidChipPlatformException {
String key = getKey(namespace, name);
preferences.edit().putString(key, val).apply();
}
@Override
public void writeConfigValueBin(String namespace, String name, byte[] val)
throws AndroidChipPlatformException {
String key = getKey(namespace, name);
if (val != null) {
String valStr = Base64.getEncoder().encodeToString(val);
preferences.edit().putString(key, valStr).apply();
} else {
preferences.edit().remove(key).apply();
}
}
@Override
public void clearConfigValue(String namespace, String name) throws AndroidChipPlatformException {
if (namespace != null && name != null) {
preferences.edit().remove(getKey(namespace, name)).apply();
} else if (namespace != null && name == null) {
String pre = getKey(namespace, null);
SharedPreferences.Editor editor = preferences.edit();
Map<String, ?> allEntries = preferences.getAll();
for (Map.Entry<String, ?> entry : allEntries.entrySet()) {
String key = entry.getKey();
if (key.startsWith(pre)) {
editor.remove(key);
}
}
editor.apply();
} else if (namespace == null && name == null) {
preferences.edit().clear().apply();
}
}
@Override
public boolean configValueExists(String namespace, String name)
throws AndroidChipPlatformException {
return preferences.contains(getKey(namespace, name));
}
private String getKey(String namespace, String name) throws AndroidChipPlatformException {
if (namespace != null && name != null) {
return namespace + ":" + name;
} else if (namespace != null && name == null) {
return namespace + ":";
}
throw new AndroidChipPlatformException();
}
}
| [
"noreply@github.com"
] | JordanField.noreply@github.com |
26bdf1c0601ebe98a28de65ffc60e6065e1756a6 | 3e611373d2ff48dbffc25ca367c0f0e3e51e2f90 | /AE_MQL_WS/QMM.edit/src/qmm/provider/concat_FunctionalOperatorItemProvider.java | 91705015819cfd2522b01d4e749ffdb1e0076e88 | [] | no_license | Racheast/AE_MQL | 999fbd74a15261006fe8f3a0e2fdc1323b05c0a5 | 3f94f6d41986ae3786ae4291736b11f0750e6091 | refs/heads/master | 2020-04-26T08:53:49.746321 | 2019-06-01T10:13:26 | 2019-06-01T10:13:26 | 173,438,094 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,786 | java | /**
*/
package qmm.provider;
import java.util.Collection;
import java.util.List;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ViewerNotification;
import qmm.QmmFactory;
import qmm.QmmPackage;
import qmm.concat_FunctionalOperator;
/**
* This is the item provider adapter for a {@link qmm.concat_FunctionalOperator} object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public class concat_FunctionalOperatorItemProvider extends String_Original_FunctionalOperatorItemProvider {
/**
* This constructs an instance from a factory and a notifier.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public concat_FunctionalOperatorItemProvider(AdapterFactory adapterFactory) {
super(adapterFactory);
}
/**
* This returns the property descriptors for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
if (itemPropertyDescriptors == null) {
super.getPropertyDescriptors(object);
}
return itemPropertyDescriptors;
}
/**
* This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
* {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
* {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
if (childrenFeatures == null) {
super.getChildrenFeatures(object);
childrenFeatures.add(QmmPackage.eINSTANCE.getString_FunctionalType_Operator());
childrenFeatures.add(QmmPackage.eINSTANCE.getconcat_FunctionalOperator_Str());
}
return childrenFeatures;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EStructuralFeature getChildFeature(Object object, Object child) {
// Check the type of the specified child object and return the proper feature to use for
// adding (see {@link AddCommand}) it as a child.
return super.getChildFeature(object, child);
}
/**
* This returns concat_FunctionalOperator.gif.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object getImage(Object object) {
return overlayImage(object, getResourceLocator().getImage("full/obj16/concat_FunctionalOperator"));
}
/**
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getText(Object object) {
return getString("_UI_concat_FunctionalOperator_type");
}
/**
* This handles model notifications by calling {@link #updateChildren} to update any cached
* children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void notifyChanged(Notification notification) {
updateChildren(notification);
switch (notification.getFeatureID(concat_FunctionalOperator.class)) {
case QmmPackage.CONCAT_FUNCTIONAL_OPERATOR__OPERATOR:
case QmmPackage.CONCAT_FUNCTIONAL_OPERATOR__STR:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
return;
}
super.notifyChanged(notification);
}
/**
* This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
* that can be created under this object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
super.collectNewChildDescriptors(newChildDescriptors, object);
newChildDescriptors.add
(createChildParameter
(QmmPackage.eINSTANCE.getString_FunctionalType_Operator(),
QmmFactory.eINSTANCE.createtoLowerCase_FunctionalOperator()));
newChildDescriptors.add
(createChildParameter
(QmmPackage.eINSTANCE.getString_FunctionalType_Operator(),
QmmFactory.eINSTANCE.createcodePointBefore_FunctionalOperator()));
newChildDescriptors.add
(createChildParameter
(QmmPackage.eINSTANCE.getString_FunctionalType_Operator(),
QmmFactory.eINSTANCE.createcompareToString_FunctionalOperator()));
newChildDescriptors.add
(createChildParameter
(QmmPackage.eINSTANCE.getString_FunctionalType_Operator(),
QmmFactory.eINSTANCE.createcontains_FunctionalOperator()));
newChildDescriptors.add
(createChildParameter
(QmmPackage.eINSTANCE.getString_FunctionalType_Operator(),
QmmFactory.eINSTANCE.createCharSequence_String_Object_CharSequence_toString_FunctionalOperator()));
newChildDescriptors.add
(createChildParameter
(QmmPackage.eINSTANCE.getString_FunctionalType_Operator(),
QmmFactory.eINSTANCE.createconcat_FunctionalOperator()));
newChildDescriptors.add
(createChildParameter
(QmmPackage.eINSTANCE.getString_FunctionalType_Operator(),
QmmFactory.eINSTANCE.createCharSequence_String_Object_CharSequence_hashCode_FunctionalOperator()));
newChildDescriptors.add
(createChildParameter
(QmmPackage.eINSTANCE.getString_FunctionalType_Operator(),
QmmFactory.eINSTANCE.createindexOfChar_FunctionalOperator()));
newChildDescriptors.add
(createChildParameter
(QmmPackage.eINSTANCE.getString_FunctionalType_Operator(),
QmmFactory.eINSTANCE.createequalsIgnoreCase_FunctionalOperator()));
newChildDescriptors.add
(createChildParameter
(QmmPackage.eINSTANCE.getString_FunctionalType_Operator(),
QmmFactory.eINSTANCE.createisEmpty_FunctionalOperator()));
newChildDescriptors.add
(createChildParameter
(QmmPackage.eINSTANCE.getString_FunctionalType_Operator(),
QmmFactory.eINSTANCE.createcodePointAt_FunctionalOperator()));
newChildDescriptors.add
(createChildParameter
(QmmPackage.eINSTANCE.getString_FunctionalType_Operator(),
QmmFactory.eINSTANCE.createoffsetByCodePoints_FunctionalOperator()));
newChildDescriptors.add
(createChildParameter
(QmmPackage.eINSTANCE.getString_FunctionalType_Operator(),
QmmFactory.eINSTANCE.createindexOfCharFromIndex_FunctionalOperator()));
newChildDescriptors.add
(createChildParameter
(QmmPackage.eINSTANCE.getString_FunctionalType_Operator(),
QmmFactory.eINSTANCE.createendsWith_FunctionalOperator()));
newChildDescriptors.add
(createChildParameter
(QmmPackage.eINSTANCE.getString_FunctionalType_Operator(),
QmmFactory.eINSTANCE.createstartsWithOffset_FunctionalOperator()));
newChildDescriptors.add
(createChildParameter
(QmmPackage.eINSTANCE.getString_FunctionalType_Operator(),
QmmFactory.eINSTANCE.createCharSequence_String_length_FunctionalOperator()));
newChildDescriptors.add
(createChildParameter
(QmmPackage.eINSTANCE.getString_FunctionalType_Operator(),
QmmFactory.eINSTANCE.createindexOfString_FunctionalOperator()));
newChildDescriptors.add
(createChildParameter
(QmmPackage.eINSTANCE.getString_FunctionalType_Operator(),
QmmFactory.eINSTANCE.createtrim_FunctionalOperator()));
newChildDescriptors.add
(createChildParameter
(QmmPackage.eINSTANCE.getString_FunctionalType_Operator(),
QmmFactory.eINSTANCE.createstartsWith_FunctionalOperator()));
newChildDescriptors.add
(createChildParameter
(QmmPackage.eINSTANCE.getString_FunctionalType_Operator(),
QmmFactory.eINSTANCE.createcharAt_FunctionalOperator()));
newChildDescriptors.add
(createChildParameter
(QmmPackage.eINSTANCE.getString_FunctionalType_Operator(),
QmmFactory.eINSTANCE.createcompareToStringIgnoreCase_FunctionalOperator()));
newChildDescriptors.add
(createChildParameter
(QmmPackage.eINSTANCE.getString_FunctionalType_Operator(),
QmmFactory.eINSTANCE.createCharSequence_String_Object_CharSequence_equals_FunctionalOperator()));
newChildDescriptors.add
(createChildParameter
(QmmPackage.eINSTANCE.getString_FunctionalType_Operator(),
QmmFactory.eINSTANCE.createtoUpperCase_FunctionalOperator()));
newChildDescriptors.add
(createChildParameter
(QmmPackage.eINSTANCE.getString_FunctionalType_Operator(),
QmmFactory.eINSTANCE.createsubstring_FunctionalOperator()));
newChildDescriptors.add
(createChildParameter
(QmmPackage.eINSTANCE.getconcat_FunctionalOperator_Str(),
QmmFactory.eINSTANCE.createString_FunctionalParameter()));
}
}
| [
"e1128978@student.tuwien.ac.at"
] | e1128978@student.tuwien.ac.at |
44a8054236ec7c2eea258ebfbad5974ba0810f6d | b00c54389a95d81a22e361fa9f8bdf5a2edc93e3 | /external/apache-harmony/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/PKIXCertPathBuilderResultTest.java | 5ea699c6d7f3450dfc25015fe70ffaee85db7d6b | [
"Apache-2.0"
] | permissive | mirek190/x86-android-5.0 | 9d1756fa7ff2f423887aa22694bd737eb634ef23 | eb1029956682072bb7404192a80214189f0dc73b | refs/heads/master | 2020-05-27T01:09:51.830208 | 2015-10-07T22:47:36 | 2015-10-07T22:47:36 | 41,942,802 | 15 | 20 | null | 2020-03-09T00:21:03 | 2015-09-05T00:11:19 | null | UTF-8 | Java | false | false | 8,798 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @author Vladimir N. Molotkov
*/
package org.apache.harmony.security.tests.java.security.cert;
import java.security.NoSuchAlgorithmException;
import java.security.PublicKey;
import java.security.cert.CertPath;
import java.security.cert.CertPathBuilderResult;
import java.security.cert.PKIXCertPathBuilderResult;
import java.security.cert.TrustAnchor;
import java.security.spec.InvalidKeySpecException;
import org.apache.harmony.security.tests.support.cert.MyCertPath;
import org.apache.harmony.security.tests.support.cert.TestUtils;
import junit.framework.TestCase;
/**
* Tests for <code>PKIXCertPathBuilderResult</code>
*/
public class PKIXCertPathBuilderResultTest extends TestCase {
/**
* Cert path encoding stub
*/
private static final byte[] testEncoding = new byte[] {
(byte) 1, (byte) 2, (byte) 3, (byte) 4, (byte) 5
};
/**
* PublicKey stub
*/
private static PublicKey testPublicKey = new PublicKey() {
public String getAlgorithm() {
return "NeverMind";
}
public String getFormat() {
return "NeverMind";
}
public byte[] getEncoded() {
return new byte[] { };
}
};
/**
* Constructor for PKIXCertPathBuilderResultTest.
*
* @param name
*/
public PKIXCertPathBuilderResultTest(String name) {
super(name);
}
//
// Tests
//
/**
* Test #1 for <code>PKIXCertPathBuilderResult(CertPath, TrustAnchor,
* PolicyNode, PublicKey)</code> constructor<br>
* Assertion: Creates an instance of <code>PKIXCertPathBuilderResult</code>
*
* @throws NoSuchAlgorithmException
* @throws InvalidKeySpecException
*/
public final void testPKIXCertPathBuilderResult01()
throws InvalidKeySpecException,
NoSuchAlgorithmException {
TrustAnchor ta = TestUtils.getTrustAnchor();
if (ta == null) {
fail(getName() + ": not performed (could not create test TrustAnchor)");
}
CertPathBuilderResult r =
new PKIXCertPathBuilderResult(
new MyCertPath(testEncoding),
ta,
TestUtils.getPolicyTree(),
testPublicKey);
assertTrue(r instanceof PKIXCertPathBuilderResult);
}
/**
* Test #2 for <code>PKIXCertPathBuilderResult(CertPath, TrustAnchor,
* PolicyNode, PublicKey)</code> constructor<br>
* Assertion: policy tree parameter may be <code>null</code>
*
* @throws NoSuchAlgorithmException
* @throws InvalidKeySpecException
*/
public final void testPKIXCertPathBuilderResult02()
throws InvalidKeySpecException,
NoSuchAlgorithmException {
TrustAnchor ta = TestUtils.getTrustAnchor();
if (ta == null) {
fail(getName() + ": not performed (could not create test TrustAnchor)");
}
CertPathBuilderResult r =
new PKIXCertPathBuilderResult(
new MyCertPath(testEncoding),
ta,
null,
testPublicKey);
assertTrue(r instanceof PKIXCertPathBuilderResult);
}
/**
* Test #3 for <code>PKIXCertPathBuilderResult(CertPath, TrustAnchor,
* PolicyNode, PublicKey)</code> constructor<br>
* Assertion: <code>NullPointerException</code>
* if certPath is <code>null</code>
*/
public final void testPKIXCertPathBuilderResult03() {
TrustAnchor ta = TestUtils.getTrustAnchor();
if (ta == null) {
fail(getName() + ": not performed (could not create test TrustAnchor)");
}
try {
// pass null
new PKIXCertPathBuilderResult(
null,
ta,
TestUtils.getPolicyTree(),
testPublicKey);
fail("NPE expected");
} catch (NullPointerException e) {
}
}
/**
* Test #4 for <code>PKIXCertPathBuilderResult(CertPath, TrustAnchor,
* PolicyNode, PublicKey)</code> constructor<br>
* Assertion: <code>NullPointerException</code>
* if trustAnchor is <code>null</code>
*/
public final void testPKIXCertPathBuilderResult04() {
try {
// pass null
new PKIXCertPathBuilderResult(
new MyCertPath(testEncoding),
null,
TestUtils.getPolicyTree(),
testPublicKey);
fail("NPE expected");
} catch (NullPointerException e) {
}
}
/**
* Test #5 for <code>PKIXCertPathBuilderResult(CertPath, TrustAnchor,
* PolicyNode, PublicKey)</code> constructor<br>
* Assertion: <code>NullPointerException</code>
* if publicKey is <code>null</code>
*/
public final void testPKIXCertPathBuilderResult05() {
TrustAnchor ta = TestUtils.getTrustAnchor();
if (ta == null) {
fail(getName() + ": not performed (could not create test TrustAnchor)");
}
try {
// pass null
new PKIXCertPathBuilderResult(
new MyCertPath(testEncoding),
ta,
TestUtils.getPolicyTree(),
null);
fail("NPE expected");
} catch (NullPointerException e) {
}
}
public final void test_clone() {
// Regression for HARMONY-2786.
TrustAnchor ta = TestUtils.getTrustAnchor();
assertNotNull(getName()
+ ": not performed (could not create test TrustAnchor)", ta);
PKIXCertPathBuilderResult init = new PKIXCertPathBuilderResult(
new MyCertPath(testEncoding), ta, TestUtils.getPolicyTree(),
testPublicKey);
PKIXCertPathBuilderResult clone = (PKIXCertPathBuilderResult) init
.clone();
assertSame(init.getCertPath(), clone.getCertPath());
assertSame(init.getPolicyTree(), clone.getPolicyTree());
assertSame(init.getPublicKey(), clone.getPublicKey());
assertSame(init.getTrustAnchor(), clone.getTrustAnchor());
}
/**
* Test for <code>getCertPath()</code> method<br>
* Assertion: the built and validated <code>CertPath</code>
* (never <code>null</code>)
*
* @throws NoSuchAlgorithmException
* @throws InvalidKeySpecException
*/
public final void testGetCertPath() throws Exception {
TrustAnchor ta = TestUtils.getTrustAnchor();
if (ta == null) {
fail(getName() + ": not performed (could not create test TrustAnchor)");
}
CertPath cp = new MyCertPath(testEncoding);
CertPathBuilderResult r =
new PKIXCertPathBuilderResult(
cp,
ta,
TestUtils.getPolicyTree(),
testPublicKey);
// must return the same reference
// as passed to the constructor
assertSame(cp, r.getCertPath());
}
/**
* Test for <code>toString()</code> method<br>
* Assertion: the printable representation of this object
*
* @throws NoSuchAlgorithmException
* @throws InvalidKeySpecException
*/
public final void testToString()
throws InvalidKeySpecException,
NoSuchAlgorithmException {
TrustAnchor ta = TestUtils.getTrustAnchor();
if (ta == null) {
fail(getName() + ": not performed (could not create test TrustAnchor)");
}
CertPathBuilderResult r =
new PKIXCertPathBuilderResult(
new MyCertPath(testEncoding),
ta,
TestUtils.getPolicyTree(),
testPublicKey);
assertNotNull(r.toString());
}
}
| [
"mirek190@gmail.com"
] | mirek190@gmail.com |
d9b5433852e9c308727eedbda500db12d75c3fd3 | 2666a467209de1f303d229cd31df84d6f8ba6d87 | /MCDMTool/colt/hep/aida/ref/Histogram3D.java | 7b555731d4e4373b8704e6bbf03b082aaad55305 | [] | no_license | WenhaoNie/My-project | 9265e7ae199b5898e25390c32c03d93ef93d60d4 | 2e22ce6c2b2de14d8523fda37c058b64b8d68a36 | refs/heads/master | 2016-09-05T14:32:39.322613 | 2012-07-10T11:01:42 | 2012-07-10T11:01:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,802 | java | package hep.aida.ref;
import hep.aida.IAxis;
import hep.aida.IHistogram2D;
import hep.aida.IHistogram3D;
/**
* A reference implementation of hep.aida.IHistogram3D. The goal is to provide a
* clear implementation rather than the most efficient implementation. However,
* performance seems fine - filling 3 * 10^5 points/sec, both using FixedAxis or
* VariableAxis.
*
* @author Wolfgang Hoschek, Tony Johnson, and others.
* @version 1.0, 23/03/2000
*/
public class Histogram3D extends AbstractHistogram3D implements IHistogram3D {
private double[][][] heights;
private double[][][] errors;
private int[][][] entries;
private int nEntry; // total number of times fill called
private double sumWeight; // Sum of all weights
private double sumWeightSquared; // Sum of the squares of the weights
private double meanX, rmsX;
private double meanY, rmsY;
private double meanZ, rmsZ;
/**
* Creates a variable-width histogram. Example:
* <tt>xEdges = (0.2, 1.0, 5.0, 6.0), yEdges = (-5, 0, 7), zEdges = (-5, 0, 7)</tt>
* yields 3*2*2 in-range bins.
*
* @param title
* The histogram title.
* @param xEdges
* the bin boundaries the x-axis shall have; must be sorted
* ascending and must not contain multiple identical elements.
* @param yEdges
* the bin boundaries the y-axis shall have; must be sorted
* ascending and must not contain multiple identical elements.
* @param zEdges
* the bin boundaries the z-axis shall have; must be sorted
* ascending and must not contain multiple identical elements.
* @throws IllegalArgumentException
* if
* <tt>xEdges.length < 1 || yEdges.length < 1|| zEdges.length < 1</tt>
* .
*/
public Histogram3D(String title, double[] xEdges, double[] yEdges,
double[] zEdges) {
this(title, new VariableAxis(xEdges), new VariableAxis(yEdges),
new VariableAxis(zEdges));
}
/**
* Creates a fixed-width histogram.
*
* @param title
* The histogram title.
* @param xBins
* The number of bins on the X axis.
* @param xMin
* The minimum value on the X axis.
* @param xMax
* The maximum value on the X axis.
* @param yBins
* The number of bins on the Y axis.
* @param yMin
* The minimum value on the Y axis.
* @param yMax
* The maximum value on the Y axis.
* @param zBins
* The number of bins on the Z axis.
* @param zMin
* The minimum value on the Z axis.
* @param zMax
* The maximum value on the Z axis.
*/
public Histogram3D(String title, int xBins, double xMin, double xMax,
int yBins, double yMin, double yMax, int zBins, double zMin,
double zMax) {
this(title, new FixedAxis(xBins, xMin, xMax), new FixedAxis(yBins,
yMin, yMax), new FixedAxis(zBins, zMin, zMax));
}
/**
* Creates a histogram with the given axis binning.
*
* @param title
* The histogram title.
* @param xAxis
* The x-axis description to be used for binning.
* @param yAxis
* The y-axis description to be used for binning.
* @param zAxis
* The z-axis description to be used for binning.
*/
public Histogram3D(String title, IAxis xAxis, IAxis yAxis, IAxis zAxis) {
super(title);
this.xAxis = xAxis;
this.yAxis = yAxis;
this.zAxis = zAxis;
int xBins = xAxis.bins();
int yBins = yAxis.bins();
int zBins = zAxis.bins();
entries = new int[xBins + 2][yBins + 2][zBins + 2];
heights = new double[xBins + 2][yBins + 2][zBins + 2];
errors = new double[xBins + 2][yBins + 2][zBins + 2];
}
public int allEntries() {
return nEntry;
}
public int binEntries(int indexX, int indexY, int indexZ) {
return entries[mapX(indexX)][mapY(indexY)][mapZ(indexZ)];
}
public double binError(int indexX, int indexY, int indexZ) {
return Math.sqrt(errors[mapX(indexX)][mapY(indexY)][mapZ(indexZ)]);
}
public double binHeight(int indexX, int indexY, int indexZ) {
return heights[mapX(indexX)][mapY(indexY)][mapZ(indexZ)];
}
public double equivalentBinEntries() {
return sumWeight * sumWeight / sumWeightSquared;
}
public void fill(double x, double y, double z) {
int xBin = mapX(xAxis.coordToIndex(x));
int yBin = mapY(yAxis.coordToIndex(y));
int zBin = mapZ(zAxis.coordToIndex(z));
entries[xBin][yBin][zBin]++;
heights[xBin][yBin][zBin]++;
errors[xBin][yBin][zBin]++;
nEntry++;
sumWeight++;
sumWeightSquared++;
meanX += x;
rmsX += x;
meanY += y;
rmsY += y;
meanZ += z;
rmsZ += z;
}
public void fill(double x, double y, double z, double weight) {
int xBin = mapX(xAxis.coordToIndex(x));
int yBin = mapY(yAxis.coordToIndex(y));
int zBin = mapZ(zAxis.coordToIndex(z));
entries[xBin][yBin][zBin]++;
heights[xBin][yBin][zBin] += weight;
errors[xBin][yBin][zBin] += weight * weight;
nEntry++;
sumWeight += weight;
sumWeightSquared += weight * weight;
meanX += x * weight;
rmsX += x * weight * weight;
meanY += y * weight;
rmsY += y * weight * weight;
meanZ += z * weight;
rmsZ += z * weight * weight;
}
/**
* The precise meaning of the arguments to the public slice methods is
* somewhat ambiguous, so we define this internal slice method and clearly
* specify its arguments.
* <p>
* <b>Note 0</b>indexX1 and indexX2 use our INTERNAL bin numbering scheme
* <b>Note 1</b>The slice is done between indexX1 and indexX2 INCLUSIVE
* <b>Note 2</b>indexX1 and indexX2 may include the use of under and over
* flow bins <b>Note 3</b>There is no note 3 (yet)
*/
protected IHistogram2D internalSliceXY(String title, int indexZ1,
int indexZ2) {
// Attention: our internal definition of bins has been choosen
// so that this works properly even if the indeces passed in include
// the underflow or overflow bins
if (indexZ2 < indexZ1)
throw new IllegalArgumentException("Invalid bin range");
int xBins = xAxis.bins() + 2;
int yBins = yAxis.bins() + 2;
int[][] sliceEntries = new int[xBins][yBins];
double[][] sliceHeights = new double[xBins][yBins];
double[][] sliceErrors = new double[xBins][yBins];
for (int i = 0; i < xBins; i++) {
for (int j = 0; j < yBins; j++) {
for (int k = indexZ1; k <= indexZ2; k++) {
sliceEntries[i][j] += entries[i][j][k];
sliceHeights[i][j] += heights[i][j][k];
sliceErrors[i][j] += errors[i][j][k];
}
}
}
Histogram2D result = new Histogram2D(title, xAxis, yAxis);
result.setContents(sliceEntries, sliceHeights, sliceErrors);
return result;
}
/**
* The precise meaning of the arguments to the public slice methods is
* somewhat ambiguous, so we define this internal slice method and clearly
* specify its arguments.
* <p>
* <b>Note 0</b>indexY1 and indexY2 use our INTERNAL bin numbering scheme
* <b>Note 1</b>The slice is done between indexY1 and indexY2 INCLUSIVE
* <b>Note 2</b>indexY1 and indexY2 may include the use of under and over
* flow bins <b>Note 3</b>There is no note 3 (yet)
*/
protected IHistogram2D internalSliceXZ(String title, int indexY1,
int indexY2) {
// Attention: our internal definition of bins has been choosen
// so that this works properly even if the indeces passed in include
// the underflow or overflow bins
if (indexY2 < indexY1)
throw new IllegalArgumentException("Invalid bin range");
int xBins = xAxis.bins() + 2;
int zBins = zAxis.bins() + 2;
int[][] sliceEntries = new int[xBins][zBins];
double[][] sliceHeights = new double[xBins][zBins];
double[][] sliceErrors = new double[xBins][zBins];
for (int i = 0; i < xBins; i++) {
for (int j = indexY1; j <= indexY2; j++) {
for (int k = 0; i < zBins; k++) {
sliceEntries[i][k] += entries[i][j][k];
sliceHeights[i][k] += heights[i][j][k];
sliceErrors[i][k] += errors[i][j][k];
}
}
}
Histogram2D result = new Histogram2D(title, xAxis, zAxis);
result.setContents(sliceEntries, sliceHeights, sliceErrors);
return result;
}
/**
* The precise meaning of the arguments to the public slice methods is
* somewhat ambiguous, so we define this internal slice method and clearly
* specify its arguments.
* <p>
* <b>Note 0</b>indexX1 and indexX2 use our INTERNAL bin numbering scheme
* <b>Note 1</b>The slice is done between indexX1 and indexX2 INCLUSIVE
* <b>Note 2</b>indexX1 and indexX2 may include the use of under and over
* flow bins <b>Note 3</b>There is no note 3 (yet)
*/
protected IHistogram2D internalSliceYZ(String title, int indexX1,
int indexX2) {
// Attention: our internal definition of bins has been choosen
// so that this works properly even if the indeces passed in include
// the underflow or overflow bins
if (indexX2 < indexX1)
throw new IllegalArgumentException("Invalid bin range");
int yBins = yAxis.bins() + 2;
int zBins = zAxis.bins() + 2;
int[][] sliceEntries = new int[yBins][zBins];
double[][] sliceHeights = new double[yBins][zBins];
double[][] sliceErrors = new double[yBins][zBins];
for (int i = indexX1; i <= indexX2; i++) {
for (int j = 0; j < yBins; j++) {
for (int k = 0; k < zBins; k++) {
sliceEntries[j][k] += entries[i][j][k];
sliceHeights[j][k] += heights[i][j][k];
sliceErrors[j][k] += errors[i][j][k];
}
}
}
Histogram2D result = new Histogram2D(title, yAxis, zAxis);
result.setContents(sliceEntries, sliceHeights, sliceErrors);
return result;
}
public double meanX() {
return meanX / sumWeight;
}
public double meanY() {
return meanY / sumWeight;
}
public double meanZ() {
return meanZ / sumWeight;
}
public void reset() {
for (int i = 0; i < entries.length; i++)
for (int j = 0; j < entries[0].length; j++)
for (int k = 0; j < entries[0][0].length; k++) {
entries[i][j][k] = 0;
heights[i][j][k] = 0;
errors[i][j][k] = 0;
}
nEntry = 0;
sumWeight = 0;
sumWeightSquared = 0;
meanX = 0;
rmsX = 0;
meanY = 0;
rmsY = 0;
meanZ = 0;
rmsZ = 0;
}
public double rmsX() {
return Math.sqrt(rmsX / sumWeight - meanX * meanX / sumWeight
/ sumWeight);
}
public double rmsY() {
return Math.sqrt(rmsY / sumWeight - meanY * meanY / sumWeight
/ sumWeight);
}
public double rmsZ() {
return Math.sqrt(rmsZ / sumWeight - meanZ * meanZ / sumWeight
/ sumWeight);
}
public double sumAllBinHeights() {
return sumWeight;
}
}
| [
"slanlxd@gmail.com"
] | slanlxd@gmail.com |
5ef888a2222a93d29d883df4b9a13112b38e2433 | 3793e470409ca6ea4dd94e110e30de6a6e15c192 | /app/src/test/java/com/example/acer/demo2018/ExampleUnitTest.java | eb6199005dd8b5c8e3a6d6e4fb9f19e902f3eaf9 | [] | no_license | BaiLianSong/MyApplication | fabefd4678554911326daaad4690b979433ff107 | 1e5c5e31679d7b86cb1c3c61342a7cd2beeae906 | refs/heads/master | 2020-03-22T09:30:41.493746 | 2018-07-05T12:01:42 | 2018-07-05T12:01:42 | 139,842,156 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 403 | java | package com.example.acer.demo2018;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"1452789545@qq.com"
] | 1452789545@qq.com |
bea95b0ba90c79f1ce86baf043622f3864e4e150 | d2b3e2f6a39661cee817f3ea4dce26530634b5fe | /tool/xstudio-exception/src/main/java/com/xstudio/tool/exception/EmptyKeyException.java | 31fc4b42466e86b3bf6349ad907e03b5ea4b437e | [] | no_license | beeant0512/xstudio-platform-tool | dcfbc1cd59bb9f1d7db0bcd6413abc250455e239 | 59e89a31d2c62a5399ca44bd6fc45ffb5476563a | refs/heads/master | 2020-08-06T22:04:28.231866 | 2019-10-10T04:46:06 | 2019-10-10T04:46:06 | 213,174,151 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,387 | java | package com.xstudio.tool.exception;
/**
* @author xiaobiao
* @version 2019/5/13
*/
public class EmptyKeyException extends RuntimeException {
/**
* Constructs a new runtime exception with the specified detail message and
* cause. <p>Note that the detail message associated with
* {@code cause} is <i>not</i> automatically incorporated in
* this runtime exception's detail message.
*
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
* {@link #getCause()} method). (A <tt>null</tt> value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
* @since 1.4
*/
public EmptyKeyException(String message, Throwable cause) {
super(message, cause);
}
/**
* Constructs a new runtime exception with the specified detail message.
* The cause is not initialized, and may subsequently be initialized by a
* call to {@link #initCause}.
*
* @param message the detail message. The detail message is saved for
* later retrieval by the {@link #getMessage()} method.
*/
public EmptyKeyException(String message) {
super(message);
}
}
| [
"huangxb0512@gmail.com"
] | huangxb0512@gmail.com |
7487ad78e0fe67a0b60b241e9c3ee8a782baa3e5 | ed5159d056e98d6715357d0d14a9b3f20b764f89 | /test/irvine/oeis/a012/A012865Test.java | c9e7d5d3cb4159d71399f892aad22bd25cc69186 | [] | no_license | flywind2/joeis | c5753169cf562939b04dd246f8a2958e97f74558 | e5efd6971a0062ac99f4fae21a7c78c9f9e74fea | refs/heads/master | 2020-09-13T18:34:35.080552 | 2019-11-19T05:40:55 | 2019-11-19T05:40:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 195 | java | package irvine.oeis.a012;
import irvine.oeis.AbstractSequenceTest;
/**
* Tests the corresponding class.
* @author Sean A. Irvine
*/
public class A012865Test extends AbstractSequenceTest {
}
| [
"sairvin@gmail.com"
] | sairvin@gmail.com |
1432a07ce59aa3d58f310ce6ffb9d8b0f0bdcb1e | 7d4dac30fe93ae38f2119b54dfcd36694ab8260d | /Case_Study3/src/java/entity/order.java | 9e66bd3af65172cefa5a569c0ff72e7c4d146f90 | [] | no_license | duongthuy/ShoppingCart | 8223d4ebbc0177cdb522dd785f3e0696530fd6f7 | f04ade68edf6ffb1f54a05fd0b163b403a5c1c76 | refs/heads/master | 2016-09-09T20:11:44.757405 | 2013-10-01T16:59:48 | 2013-10-01T16:59:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,313 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package entity;
/**
*
* @author Tung
*/
public class order {
private int id;
private int iduser;
private int idprod;
private int number;
private long total;
public order(){
this.id = 0;
this.iduser = 0;
this.idprod = 0;
this.number = 0;
this.total = 0;
}
public order(int id, int iduser, int idprod, int number, long total) {
this.id = id;
this.iduser = iduser;
this.idprod = idprod;
this.number = number;
this.total = total;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getIdprod() {
return idprod;
}
public void setIdprod(int idprod) {
this.idprod = idprod;
}
public int getIduser() {
return iduser;
}
public void setIduser(int iduser) {
this.iduser = iduser;
}
public int getNumber() {
return number;
}
public void setNumber(int number) {
this.number = number;
}
public long getTotal() {
return total;
}
public void setTotal(long total) {
this.total = total;
}
}
| [
"duongnt19@gmail.com"
] | duongnt19@gmail.com |
ff25d24e08e0601c0a3af38f6fe72c798f9c2eff | c993f8fa180a11fc98a2e1a0424e6a07e2b83cf5 | /src/main/java/com/github/jengo/java/program/design10/TestArrayListNew.java | 146f497a3b24c25dd97b86191d99fd80e579f613 | [
"Apache-2.0"
] | permissive | jengowong/java_program_design_10 | a894412b410b9b1769882aff5f789a00b6edbd66 | 217737454bd764dfdd72a6873a6bc31af8f36930 | refs/heads/master | 2021-01-19T10:10:58.933964 | 2019-09-19T01:54:49 | 2019-09-19T01:54:49 | 82,166,516 | 0 | 0 | Apache-2.0 | 2020-10-12T20:15:04 | 2017-02-16T10:02:17 | Java | UTF-8 | Java | false | false | 1,733 | java | package com.github.jengo.java.program.design10;
import java.util.ArrayList;
public class TestArrayListNew {
public static void main(String[] args) {
// Create a list to store cities
ArrayList<String> cityList = new ArrayList<String>();
// Add some cities in the list
cityList.add("London");
cityList.add("New York");
cityList.add("Paris");
cityList.add("Toronto");
cityList.add("Hong Kong");
cityList.add("Singapore");
System.out.println("List size? " + cityList.size());
System.out.println("Is Toronto in the list? " +
cityList.contains("Toronto"));
System.out.println("The location of New York in the list? "
+ cityList.indexOf("New York"));
System.out.println("Is the list empty? " +
cityList.isEmpty()); // Print false
// Insert a new city at index 2
cityList.add(2, "Beijing");
// Remove a city from the list
cityList.remove("Toronto");
// Remove a city at index 1
cityList.remove(1);
// Display London Beijing Paris Hong Kong Singapore
for (int i = 0; i < cityList.size(); i++)
System.out.print(cityList.get(i) + " ");
System.out.println();
// Create a list to store two circles
ArrayList<Circle> list = new ArrayList<Circle>();
// Add a circle and a cylinder
list.add(new Circle(2));
list.add(new Circle(3));
// Display the area of the first circle in the list
System.out.println("The area of the circle? " +
((Circle) list.get(0)).getArea());
}
}
| [
"wangzhenguo02@meituan.com"
] | wangzhenguo02@meituan.com |
434d1e3be074ca8a7057ef08717dd495ed1df730 | 22948246bf0180dd50296f482a1ad45e6e88af03 | /src/main/java/uk/sky/DataFilterer.java | 78c9add178c547f8e8430b18661c3ff10096ff52 | [] | no_license | Iman/sky-java-filter-log-extracts | 0a7b2e59707a16c304e3da8a3cad63640e5e5246 | d0a8147bb2c60cd1ad759ae239998fac6671a524 | refs/heads/master | 2020-05-20T13:38:31.318485 | 2015-06-11T13:48:32 | 2015-06-11T13:48:32 | 37,263,716 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,240 | java | package uk.sky;
import java.io.Reader;
import java.util.ArrayList;
import java.util.Collection;
import java.io.BufferedReader;
import java.io.IOException;
import java.util.List;
public class DataFilterer {
private static BufferedReader INPUT;
private static String LINE;
private static List<String> COLUMNS;
private static int AVG = 30;
private static List<List<String>> LINES;
public static Collection<?> filterByCountry(Reader source, String country) throws IOException {
try {
INPUT = new BufferedReader(source);
} catch (Exception e) {
System.err.println("Error occuring while inpup is null");
}
String line;
LINES = new ArrayList<List<String>>();
boolean header = false;
while ((line = INPUT.readLine()) != null) {
if (header == false) {
header = true;
continue;
} else if (line.contains(country)) {
COLUMNS = extractLog(line);
LINES.add(COLUMNS);
}
}
return LINES;
}
public static Collection<?> filterByCountryWithResponseTimeAboveLimit(Reader source, String country, long limit) throws IOException {
try {
INPUT = new BufferedReader(source);
} catch (Exception e) {
System.err.println("Error occuring while inpup is null");
}
LINES = new ArrayList<List<String>>();
boolean header = false;
while ((LINE = INPUT.readLine()) != null) {
if (header == false) {
header = true;
continue;
} else if (LINE.contains(country)) {
COLUMNS = extractLog(LINE);
if (Integer.parseInt(COLUMNS.get(2)) >= limit) {
LINES.add(COLUMNS);
}
}
}
return LINES;
}
public static Collection<?> filterByResponseTimeAboveAverage(Reader source) throws NumberFormatException, IOException {
try {
INPUT = new BufferedReader(source);
} catch (Exception e) {
System.err.println("Error occuring while inpup is null");
}
LINES = new ArrayList<List<String>>();
boolean header = false;
while ((LINE = INPUT.readLine()) != null) {
if (header == false) {
header = true;
continue;
} else {
COLUMNS = extractLog(LINE);
if (Integer.parseInt(COLUMNS.get(2)) > AVG) {
LINES.add(COLUMNS);
}
}
}
return LINES;
}
/**
* Extract request_timestamp, country code, response time
*
* @param line
* @return
*/
public static List<String> extractLog(String line) {
List<String> strArray = new ArrayList<>();
line += '\n';
String word = "";
for (int j = 0; j < line.length(); j++) {
char c = line.charAt(j);
if (c == ',' || c == '\n') {
strArray.add(word);
word = "";
} else {
word += c;
}
}
return strArray;
}
} | [
"iman@imanpage.com"
] | iman@imanpage.com |
7553459009885daece7bea0670a98a6b7949d6f9 | 9254e7279570ac8ef687c416a79bb472146e9b35 | /sofa-20190815/src/main/java/com/aliyun/sofa20190815/models/QueryLDCFlowRecordResponseBody.java | fdfdb8ab081df03a2df45422963e5a1ffbcd6421 | [
"Apache-2.0"
] | permissive | lquterqtd/alibabacloud-java-sdk | 3eaa17276dd28004dae6f87e763e13eb90c30032 | 3e5dca8c36398469e10cdaaa34c314ae0bb640b4 | refs/heads/master | 2023-08-12T13:56:26.379027 | 2021-10-19T07:22:15 | 2021-10-19T07:22:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,251 | java | // This file is auto-generated, don't edit it. Thanks.
package com.aliyun.sofa20190815.models;
import com.aliyun.tea.*;
public class QueryLDCFlowRecordResponseBody extends TeaModel {
@NameInMap("RequestId")
public String requestId;
@NameInMap("ResultCode")
public String resultCode;
@NameInMap("ResultMessage")
public String resultMessage;
@NameInMap("CurrentPage")
public Long currentPage;
@NameInMap("PageSize")
public Long pageSize;
@NameInMap("TotalCount")
public Long totalCount;
@NameInMap("Data")
public java.util.List<QueryLDCFlowRecordResponseBodyData> data;
public static QueryLDCFlowRecordResponseBody build(java.util.Map<String, ?> map) throws Exception {
QueryLDCFlowRecordResponseBody self = new QueryLDCFlowRecordResponseBody();
return TeaModel.build(map, self);
}
public QueryLDCFlowRecordResponseBody setRequestId(String requestId) {
this.requestId = requestId;
return this;
}
public String getRequestId() {
return this.requestId;
}
public QueryLDCFlowRecordResponseBody setResultCode(String resultCode) {
this.resultCode = resultCode;
return this;
}
public String getResultCode() {
return this.resultCode;
}
public QueryLDCFlowRecordResponseBody setResultMessage(String resultMessage) {
this.resultMessage = resultMessage;
return this;
}
public String getResultMessage() {
return this.resultMessage;
}
public QueryLDCFlowRecordResponseBody setCurrentPage(Long currentPage) {
this.currentPage = currentPage;
return this;
}
public Long getCurrentPage() {
return this.currentPage;
}
public QueryLDCFlowRecordResponseBody setPageSize(Long pageSize) {
this.pageSize = pageSize;
return this;
}
public Long getPageSize() {
return this.pageSize;
}
public QueryLDCFlowRecordResponseBody setTotalCount(Long totalCount) {
this.totalCount = totalCount;
return this;
}
public Long getTotalCount() {
return this.totalCount;
}
public QueryLDCFlowRecordResponseBody setData(java.util.List<QueryLDCFlowRecordResponseBodyData> data) {
this.data = data;
return this;
}
public java.util.List<QueryLDCFlowRecordResponseBodyData> getData() {
return this.data;
}
public static class QueryLDCFlowRecordResponseBodyData extends TeaModel {
@NameInMap("Operator")
public String operator;
@NameInMap("PushTime")
public String pushTime;
@NameInMap("ResultCode")
public String resultCode;
@NameInMap("ResultMsg")
public String resultMsg;
@NameInMap("RuleType")
public String ruleType;
@NameInMap("Value")
public String value;
@NameInMap("Apps")
public java.util.List<String> apps;
@NameInMap("Targets")
public java.util.List<String> targets;
public static QueryLDCFlowRecordResponseBodyData build(java.util.Map<String, ?> map) throws Exception {
QueryLDCFlowRecordResponseBodyData self = new QueryLDCFlowRecordResponseBodyData();
return TeaModel.build(map, self);
}
public QueryLDCFlowRecordResponseBodyData setOperator(String operator) {
this.operator = operator;
return this;
}
public String getOperator() {
return this.operator;
}
public QueryLDCFlowRecordResponseBodyData setPushTime(String pushTime) {
this.pushTime = pushTime;
return this;
}
public String getPushTime() {
return this.pushTime;
}
public QueryLDCFlowRecordResponseBodyData setResultCode(String resultCode) {
this.resultCode = resultCode;
return this;
}
public String getResultCode() {
return this.resultCode;
}
public QueryLDCFlowRecordResponseBodyData setResultMsg(String resultMsg) {
this.resultMsg = resultMsg;
return this;
}
public String getResultMsg() {
return this.resultMsg;
}
public QueryLDCFlowRecordResponseBodyData setRuleType(String ruleType) {
this.ruleType = ruleType;
return this;
}
public String getRuleType() {
return this.ruleType;
}
public QueryLDCFlowRecordResponseBodyData setValue(String value) {
this.value = value;
return this;
}
public String getValue() {
return this.value;
}
public QueryLDCFlowRecordResponseBodyData setApps(java.util.List<String> apps) {
this.apps = apps;
return this;
}
public java.util.List<String> getApps() {
return this.apps;
}
public QueryLDCFlowRecordResponseBodyData setTargets(java.util.List<String> targets) {
this.targets = targets;
return this;
}
public java.util.List<String> getTargets() {
return this.targets;
}
}
}
| [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
9885be6bb1f8fc26fb186d61c66cfdf542ad05de | 6dda7214fe954290d880775f70528bcc0efc6d46 | /src/main/java/com/gmail/mooman219/module/service/listener/ListenerEntity.java | fff4da2c380e9bf6000caacfee60961a91791e66 | [] | no_license | mooman219/CowCode | 4f6adde716c7a2b3fcb87414283ed936c10e3166 | f5b608a9af2ff6f4ce0bb3caff54a02c9b0206bf | refs/heads/master | 2021-01-20T01:54:07.591823 | 2014-01-09T23:20:51 | 2014-01-09T23:20:51 | 9,364,184 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 562 | java | package com.gmail.mooman219.module.service.listener;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDeathEvent;
import com.gmail.mooman219.bull.CDLiving;
public class ListenerEntity implements Listener {
@EventHandler(priority = EventPriority.MONITOR)
public void onDeath(EntityDeathEvent event) {
if(!(event.getEntity() instanceof Player)) {
CDLiving.unload(event.getEntity());
}
}
}
| [
"mooman219@gmail.com"
] | mooman219@gmail.com |
378ee6c2b391beafc7758e4853c9596fea718528 | c6406315b24214d35b824323914003908fabaeba | /app/src/test/java/com/example/tranhuubinh17dcat023/ExampleUnitTest.java | 165cdc0f016ec17d72d29e79dc18e05e08664ac5 | [] | no_license | binhtranhuu/quan-ly-giang-vien-luu-sqlite | adfbda371bf2b91b6cdfc926b3b01e93374c298a | 2ade37ade14124a69933083be35477c153eb71d7 | refs/heads/master | 2023-06-09T15:38:48.625613 | 2021-06-26T09:44:52 | 2021-06-26T09:44:52 | 380,440,850 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 393 | java | package com.example.tranhuubinh17dcat023;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"tranbinh241999@gmail.com"
] | tranbinh241999@gmail.com |
1ce93445b2ef56d9ebab2c365ed165001f5ba3f1 | 5e3235edf3de262f4d10b9e9e1fcc3bd13d6b8b1 | /Code Snippet Repository/Spring/Spring12872.java | ff5d939f61fd4eead222367bc3cf293179730320 | [] | no_license | saber13812002/DeepCRM | 3336a244d4852a364800af3181e03e868cf6f9f5 | be3e5e50e34a042d5ba7259ff5ff75c08ab32bb9 | refs/heads/master | 2023-03-16T00:08:06.473699 | 2018-04-18T05:29:50 | 2018-04-18T05:29:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 505 | java | @Test
public void shouldHandleInvalidIfNoneMatchWithHttp200() throws Exception {
String etagValue = "\"deadb33f8badf00d\"";
servletRequest.addHeader(HttpHeaders.IF_NONE_MATCH, "unquoted");
ResponseEntity<String> returnValue = ResponseEntity.ok().eTag(etagValue).body("body");
initStringMessageConversion(MediaType.TEXT_PLAIN);
processor.handleReturnValue(returnValue, returnTypeResponseEntity, mavContainer, webRequest);
assertConditionalResponse(HttpStatus.OK, "body", etagValue, -1);
}
| [
"Qing.Mi@my.cityu.edu.hk"
] | Qing.Mi@my.cityu.edu.hk |
6ff749ab836394f85c0e1dc0b0aa32959245b852 | 5b02c7325d9a02cf810f42d7c69ad014a6b528ad | /src/main/java/hellburgers/hellburgerspringbootapplication/entities/Ingredient.java | 8b0912ee407cfb4327acbd403b371abe4ccdf9c4 | [] | no_license | iliyansky/hell-burger-spring-boot-application | a2518dde2ba88a2d456eb280078fd0124eaa0f77 | 6cba82be23ebab7a3eda5219415be05c0435d34e | refs/heads/master | 2022-02-21T03:50:16.892102 | 2020-02-18T18:10:49 | 2020-02-18T18:10:49 | 224,389,551 | 2 | 0 | null | 2020-01-06T13:15:09 | 2019-11-27T09:09:56 | CSS | UTF-8 | Java | false | false | 1,114 | java | package hellburgers.hellburgerspringbootapplication.entities;
import com.fasterxml.jackson.annotation.JsonIgnore;
import javax.persistence.*;
import java.util.Set;
@Entity
public class Ingredient {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
private String name;
private double price;
@ManyToMany(fetch = FetchType.LAZY)
@JsonIgnore
private Set<Burger> burgers;
public Ingredient() {
}
public Ingredient(String name, double price) {
this.name = name;
this.price = price;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public Set<Burger> getBurgers() {
return burgers;
}
public void setBurgers(Set<Burger> burgers) {
this.burgers = burgers;
}
}
| [
"iliqnboqnov@gmail.com"
] | iliqnboqnov@gmail.com |
7f7c9c66ebf720940d40b73ab5b416241f389f32 | ece887336dd1798c4563d93c1463e9b85e55de67 | /test/beltza/util/TestUtils.java | 8e9ae4c15d28cc21e7fee0ea2f548409dfff2c9f | [] | no_license | jafsaha/beltza | 6e3255e6c8f3d79f14444f25f8ae9772cf1b50ff | 982c8a7b9f147265f45b17ea2bbb2e39223b7108 | refs/heads/master | 2020-04-06T07:05:22.961805 | 2016-09-21T03:49:06 | 2016-09-21T03:49:06 | 61,002,348 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 706 | java | package beltza.util;
public class TestUtils {
public static String getRandomString(String preffix, int length) {
return preffix + getRandomString(length);
}
public static String getRandomString(int length) {
Double random = Math.random();
random = random * Math.pow(10, length);
Long l = Math.round(random);
return l.toString();
}
public static Double getRandomDouble() {
Double random = Math.random();
return random;
}
public static Double getRandomDouble(int integer, int decimals) {
Double random = Math.random();
random = random * Math.pow(10, integer + decimals);
Long lRandom = Math.round(random);
random = lRandom / Math.pow(10, decimals);
return random;
}
}
| [
"turusaha@gmail.com"
] | turusaha@gmail.com |
1412d98b9b09e1edc6e98555cb25d80a5bfc6c7c | b4b94e7d60b6cf8c3472722b341e9e1de0173bdb | /src/main/java/com/vitamarket/models/utils/PagingHeaders.java | 9c8a1745736c61a14d3842b76ca16a01facf7ccf | [] | no_license | xiahou-10/VitaMarket-BACK | 589aebd263f28350cde258e3fe601fb4d79fd286 | 612ddf237a6a896c2217d79edf6468cda8bfccb8 | refs/heads/main | 2023-06-14T12:53:05.702348 | 2021-06-28T12:24:13 | 2021-06-28T12:24:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 324 | java | package com.vitamarket.models.utils;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter @AllArgsConstructor
public enum PagingHeaders {
PAGE_SIZE("Page-Size"),
PAGE_NUMBER("Page-Number"),
PAGE_OFFSET("Page-Offset"),
PAGE_TOTAL("Page-Total"),
COUNT("Count");
private final String name;
}
| [
"nelson.gayoso@tecsup.edu.pe"
] | nelson.gayoso@tecsup.edu.pe |
cd931d9d31231ffef4f1e407b6d9df8b33418584 | 0aedbc78053ea6ede3c95446082181d73cf60945 | /src/main/java/io/sbed/common/shiro/ShiroAuthenticatingFilter.java | 9c88c9de1b63e834110fd8864efd856f4d453131 | [] | no_license | GGsnake/ShopBack | 778347b10d566cfa753eb8c2905631a3f37e70fc | 5a4b225052a4307155f9f17b14d3779d81275756 | refs/heads/master | 2020-04-12T22:52:25.254371 | 2019-03-11T05:18:06 | 2019-03-11T05:18:06 | 162,801,369 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,031 | java | package io.sbed.common.shiro;
import com.google.gson.Gson;
import io.sbed.common.utils.Result;
import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpStatus;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.web.filter.authc.AuthenticatingFilter;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* @author heguoliang
* @Description: TODO(shiro 认证过滤器)
* @date 2017-6-23 15:07
*/
public class ShiroAuthenticatingFilter extends AuthenticatingFilter {
//创建shiro认证的token
@Override
protected AuthenticationToken createToken(ServletRequest request, ServletResponse response) throws Exception {
//获取请求token
String token = getRequestToken((HttpServletRequest) request);
if(StringUtils.isBlank(token)){
return null;
}
return new ShiroToken(token);
}
//是否允许访问
@Override
protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) {
return false;
}
//拒绝访问的出来
@Override
protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws Exception {
//获取请求token,如果token不存在,直接返回401
String token = getRequestToken((HttpServletRequest) request);
if(StringUtils.isBlank(token)){
HttpServletResponse httpResponse = (HttpServletResponse) response;
String json = new Gson().toJson(Result.error(HttpStatus.SC_UNAUTHORIZED, "token失效"));
httpResponse.getWriter().print(json);
return false;
}
return executeLogin(request, response);
}
@Override
protected boolean onLoginFailure(AuthenticationToken token, AuthenticationException e, ServletRequest request, ServletResponse response) {
HttpServletResponse httpResponse = (HttpServletResponse) response;
httpResponse.setContentType("application/json;charset=utf-8");
try {
//处理登录失败的异常
Throwable throwable = e.getCause() == null ? e : e.getCause();
Result r = Result.error(HttpStatus.SC_UNAUTHORIZED, throwable.getMessage());
String json = new Gson().toJson(r);
httpResponse.getWriter().print(json);
} catch (IOException e1) {
}
return false;
}
/**
* 获取请求的token
*/
private String getRequestToken(HttpServletRequest httpRequest){
//从header中获取token
String token = httpRequest.getHeader("token");
//如果header中不存在token,则从参数中获取token
if(StringUtils.isBlank(token)){
token = httpRequest.getParameter("token");
}
return token;
}
}
| [
"ljp462693266@outlook.com"
] | ljp462693266@outlook.com |
b7b5557366332dce04e7f64b3db5f3acc6b10872 | 189e54627375772bef71d7ecdd53b40755d8bcf9 | /src/main/java/com/lnl/domain/SpringSession.java | 1aae55622be97b4ecab9b4aa2af6911d7448f23d | [] | no_license | zriekumaer/AuthService | 24eddae67ec20fd7495a41081379b355354f1f19 | 6d85fd2b34c54b8cb816b6db4d50672e733d5f27 | refs/heads/master | 2022-10-24T20:19:39.495798 | 2020-06-13T15:19:01 | 2020-06-13T15:19:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 679 | java | package com.lnl.domain;
import lombok.AllArgsConstructor;
import lombok.Data;
import javax.persistence.*;
import java.io.Serializable;
@Entity
@AllArgsConstructor
@Data
@Table(name = "spring_session", schema = "lnlauth2")
public class SpringSession implements Serializable {
@Id
private String sessionId;
@Column(name = "principal_name")
private String principalName;
@Column(name = "max_inactive_interval")
private Long maxInactiveInterval;
@Column(name = "last_access_time")
private Long lastAccessTime;
@Column(name = "expiry_time")
private Long expiryTime;
@Column(name = "creation_time")
private Long creationTime;
} | [
"sayannayas@gmail.com"
] | sayannayas@gmail.com |
d98d25c7a82bfe054aa4bf673a6c99ab68825ddf | 4b0bf4787e89bcae7e4759bde6d7f3ab2c81f849 | /aliyun-java-sdk-kms/src/main/java/com/aliyuncs/kms/model/v20160120/UpdateCertificateStatusRequest.java | 21c0c74bebd33c2352ddbfd7e972a3194a95c5c7 | [
"Apache-2.0"
] | permissive | aliyun/aliyun-openapi-java-sdk | a263fa08e261f12d45586d1b3ad8a6609bba0e91 | e19239808ad2298d32dda77db29a6d809e4f7add | refs/heads/master | 2023-09-03T12:28:09.765286 | 2023-09-01T09:03:00 | 2023-09-01T09:03:00 | 39,555,898 | 1,542 | 1,317 | NOASSERTION | 2023-09-14T07:27:05 | 2015-07-23T08:41:13 | Java | UTF-8 | Java | false | false | 1,990 | java | /*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.aliyuncs.kms.model.v20160120;
import com.aliyuncs.RpcAcsRequest;
import com.aliyuncs.http.ProtocolType;
import com.aliyuncs.http.MethodType;
import com.aliyuncs.kms.Endpoint;
/**
* @author auto create
* @version
*/
public class UpdateCertificateStatusRequest extends RpcAcsRequest<UpdateCertificateStatusResponse> {
private String certificateId;
private String status;
public UpdateCertificateStatusRequest() {
super("Kms", "2016-01-20", "UpdateCertificateStatus", "kms");
setProtocol(ProtocolType.HTTPS);
setMethod(MethodType.POST);
try {
com.aliyuncs.AcsRequest.class.getDeclaredField("productEndpointMap").set(this, Endpoint.endpointMap);
com.aliyuncs.AcsRequest.class.getDeclaredField("productEndpointRegional").set(this, Endpoint.endpointRegionalType);
} catch (Exception e) {}
}
public String getCertificateId() {
return this.certificateId;
}
public void setCertificateId(String certificateId) {
this.certificateId = certificateId;
if(certificateId != null){
putQueryParameter("CertificateId", certificateId);
}
}
public String getStatus() {
return this.status;
}
public void setStatus(String status) {
this.status = status;
if(status != null){
putQueryParameter("Status", status);
}
}
@Override
public Class<UpdateCertificateStatusResponse> getResponseClass() {
return UpdateCertificateStatusResponse.class;
}
}
| [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
11d5eb819589e49536a29aa10df1abde5c37c930 | 1e3ec34d42f65c31c8f59ca172250d57af1f9db5 | /src/com/emerson/accountApi/GetAccountwishlists.java | d933dcfaf0abf3566f086ecf319e82c7281157f6 | [] | no_license | vivekimpressico/GitRepoSel | 04a762751466f4aa15a85a1a97c248ff510ee46c | ec0187e60145e0cd816f80a29495e79479ad9bdc | refs/heads/master | 2021-01-19T22:56:48.533235 | 2017-04-29T20:40:49 | 2017-04-29T20:40:49 | 88,898,479 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,353 | java | package com.emerson.accountApi;
import java.io.File;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import com.emerson.APIBaseData;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.HttpGet;
import org.testng.annotations.Test;
import com.google.gson.JsonObject;
import com.wellevate.utilities.ExcelReaderExpected;
import com.wellevate.utilities.GenericsMethods;
import com.wellevate.utilities.SoftAssertions;
import net.iharder.Base64;
public class GetAccountwishlists extends APIBaseData {
static APIBaseData api = new APIBaseData();
File file = new File("src\\com\\wellevate\\configuration\\ApiValue.properties");
static HashMap<String, String> response;
static HashMap<String, String> response1;
GenericsMethods genericMethods = new GenericsMethods();
ArrayList<String> brand;
HashMap map = new HashMap();
public static JsonObject parameterList;
ExcelReaderExpected excel = new ExcelReaderExpected();
int i = 0;
public static HttpResponse responseApi;
@Test(priority = 1)
public void AccountwishlistsWithoutToken() throws Exception {
try {
URL url1 = new URL("http://qa-aresapi.emersonecologics.com/account/wishlists");
HttpURLConnection connection1 = (HttpURLConnection) url1.openConnection();
connection1.setRequestMethod("GET");
connection1.connect();
int code1 = connection1.getResponseCode();
System.out.println("Response code of the object is " + code1);
if (code1 == 20000) {
System.out.println("OK");
SoftAssertions.verifyEqualsApi(code1, 20000, "Response code is :" + code1,
"Wrong Response code is :" + code1);
} else {
SoftAssertions.verifyEqualsApi(code1, 401, "Response code is :" + code1,
"Wrong Response code is :" + code1);
}
} catch (Exception e) {
// TODO: handle exception
}
SoftAssertions.throwAsserationOnFailure();
}
@org.testng.annotations.Test(priority = 2)
@SuppressWarnings({ "static-access", "unused" })
public void CodeForAccountWrightEmailId() throws InterruptedException, ClientProtocolException, IOException {
String auth_token = getUserAuthToken();
HttpGet request = new HttpGet("http://qa-aresapi.emersonecologics.com/account/wishlists");
request.addHeader("Content-Type", "application/json");
request.addHeader("authorization", "Bearer " + auth_token);
responseApi = client.execute(request);
int code = responseApi.getStatusLine().getStatusCode();
System.out.println("Response code of the object is " + code);
if (code == 20000) {
System.out.println("OK");
SoftAssertions.verifyEqualsApi(code, 20000, "Response code is :" + code, "Wrong Response code is :" + code);
} else {
SoftAssertions.verifyEqualsApi(code, 401, "Response code is :" + code, "Wrong Response code is :" + code);
}
response = APIBaseData.getData(request);
String wishListId = response.get("response_currentPage_0_wishListId");
String listName = response.get("response_currentPage_0_listName");
SoftAssertions.verifyEqualsApi(wishListId, "8652", " wishListId matches", "wishListId not matches");
SoftAssertions.verifyEqualsApi(listName, "Special Orders", "listName matches", "listName is not matches");
SoftAssertions.throwAsserationOnFailure();
}
}
| [
"email@example.com"
] | email@example.com |
39bd3737ca27f315ce49dd4e526e10c7a3be7b7f | c6a852f5f4ea5b665638eb1e2176a1c3f52f174e | /IntegralWall/src/com/marck/common/QueryService.java | c539eb82712d478b4e532664eb8874dce4d600bc | [] | no_license | FreeDao/private | 92507aef24e4254f87e78dbb03a0854f979faad6 | 45cfcbc0feb6efe7f7fe2a0545942a7e4c6df914 | refs/heads/master | 2020-12-26T00:25:03.242039 | 2014-08-30T18:40:38 | 2014-08-30T18:40:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,794 | java | package com.marck.common;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.marck.common.dao.HDB;
import com.marck.common.model.Apply;
import com.marck.common.model.User;
import com.marck.common.model.UserIntergral;
import com.marck.common.model.UserIntergralQuery;
@Component("queryService")
@Transactional(readOnly = true,propagation=Propagation.REQUIRED)
public class QueryService {
@Autowired
private HDB hdb;
public Boolean checkPassword(String password) {
// TODO Auto-generated method stub
try {
String hql = "from User u where u.phone ='admin'";
List<User> users = (List<User>) hdb.findHql(hql);
if(users.size() > 0){
if( users.get(0).getPassword().equals(CommonUtil.Md5(password))){
return true;
}else{
return false;
}
}else{
return false;
}
} catch (Exception e) {
// TODO: handle exception
return false;
}
}
public PageUtil findAccountList(String queryValue, Integer pageNow,
Integer limit) {
// TODO Auto-generated method stub.
String hql = "from User u where u.phone <> 'admin' ";
if(!CommonUtil.validParams(queryValue)){
hql += " and ( u.phone like '%"+queryValue+"%' or u.integral like '%"+queryValue+"%' or u.lastlogin like '%"+queryValue+"%')";
}
PageUtil pu = hdb.findHql(hql, pageNow, limit);
for(User u : (List<User>)pu.getData()){
String sql = "select sum(ui.intergral) from userintergral ui where ui.platform = 1 and ui.userId ="+u.getId();
u.setSx( (Double) hdb.findUniqueSql(sql));
sql = "select sum(ui.intergral) from userintergral ui where ui.platform = 2 and ui.userId ="+u.getId();
u.setJp((Double) hdb.findUniqueSql(sql));
sql = "select sum(ui.intergral) from userintergral ui where ui.platform = 3 and ui.userId ="+u.getId();
u.setDl((Double) hdb.findUniqueSql(sql));
sql = "select sum(ui.intergral) from userintergral ui where ui.platform = 4 and ui.userId ="+u.getId();
u.setMd((Double) hdb.findUniqueSql(sql));
sql = "select sum(ui.intergral) from userintergral ui where ui.platform = 5 and ui.userId ="+u.getId();
u.setDm((Double) hdb.findUniqueSql(sql));
sql = "select sum(ui.intergral) from userintergral ui where ui.platform = 6 and ui.userId ="+u.getId();
u.setMp((Double) hdb.findUniqueSql(sql));
sql = "select sum(ui.intergral) from userintergral ui where ui.platform = 7 and ui.userId ="+u.getId();
u.setAw((Double) hdb.findUniqueSql(sql));
sql = "select sum(ui.intergral) from userintergral ui where ui.platform = 8 and ui.userId ="+u.getId();
u.setYm((Double) hdb.findUniqueSql(sql));
sql = "select sum(ui.intergral) from userintergral ui where ui.platform = 9 and ui.userId ="+u.getId();
u.setYjf((Double) hdb.findUniqueSql(sql));
sql = "select sum(ui.intergral) from userintergral ui where ui.platform = 10 and ui.userId ="+u.getId();
u.setCk((Double) hdb.findUniqueSql(sql));
sql = "select sum(ui.intergral) from userintergral ui where ui.platform = 11 and ui.userId ="+u.getId();
u.setLm((Double) hdb.findUniqueSql(sql));
}
return pu;
}
public PageUtil findApplyList(String queryValue, Integer pageNow,
Integer limit) {
// TODO Auto-generated method stub
String hql = "select a from Apply a,User u where a.userId = u.id ";
if(!CommonUtil.validParams(queryValue)){
hql += " and ( a.alipay like '%"+queryValue+"%' or a.id like '%"+queryValue+"%' or a.userId like '%"+queryValue+"%' or a.alipay like '%"+queryValue+"%' or a.num like '%"+queryValue+"%' or a.name like '%"+queryValue+"%' or a.addTime like '%"+queryValue+"%' or u.phone like '%"+queryValue+"%') ";
}
hql += " order by a.status asc";
PageUtil pu = hdb.findHql(hql, pageNow, limit);
for(Apply a : (List<Apply>)pu.getData()){
User u = (User) hdb.find(User.class, a.getUserId());
a.setAccount(u.getPhone());
a.setIntegral(u.getIntegral());
}
return pu;
}
@Transactional(readOnly = false,propagation=Propagation.REQUIRED)
public void delAccount(Integer id) {
// TODO Auto-generated method stub
String hql ="from Apply a where a.userId = "+id;
List<Apply> as = (List<Apply>) hdb.findHql(hql);
for(Apply a : as){
hdb.delete(a);
}
hql ="from UserIntergral ui where ui.userId = "+id;
List<UserIntergral> uis = (List<UserIntergral>) hdb.findHql(hql);
for(UserIntergral ui : uis){
hdb.delete(ui);
}
User u = (User) hdb.find(User.class, id);
hdb.delete(u);
}
@Transactional(readOnly = false,propagation=Propagation.REQUIRED)
public void delApply(Integer id) {
// TODO Auto-generated method stub
Apply a = (Apply) hdb.find(Apply.class, id);
a.setStatus(1);
hdb.saveOrUpdate(a);
}
public void myStatistics(String type, String timestart, String timeend, String qd, String username, Map<String, Object> map) {
// TODO Auto-generated method stub
String sql = "";
if( type.equals("3")){
sql = "select count(*),sum(ui.intergral) from userintergral ui,user u where ui.userId=u.id and u.phone like '"+username+"%'";
}else{
sql = "select count(*),sum(ui.intergral) from userintergral ui where 1=1 ";
}
if( type.equals("2")){
sql += " and ui.platform ='"+Integer.parseInt(qd)+"'";
}
if(!CommonUtil.validParams(timestart)){
sql += " and ui.time >='"+timestart+"'";
}
if(!CommonUtil.validParams(timeend)){
sql += " and ui.time <='"+timeend+"'";
}
List<Object[]> objs = (List<Object[]>) hdb.findSql(sql);
map.put("num", objs.get(0)[0]);
map.put("integral", objs.get(0)[1]);
}
}
| [
"215757815@qq.com"
] | 215757815@qq.com |
74eb4c74e0fe45f59294306ebd587073ec66728c | f38abeabc68bcc469ee82167e3016328066b3923 | /src/day15jdbc01/JdbcDemo01.java | 5cd3d7a8d2bfea3cfc99df92a1220b50cbe4187e | [] | no_license | Leader0721/JavaStudyDemo | 673207f46efe0ba5fd8ad2092e8839d324fc7dda | 55708d2969b99127c6df3295be3b890673193fce | refs/heads/master | 2021-05-06T17:20:30.155192 | 2017-11-23T14:56:13 | 2017-11-23T14:56:13 | 111,821,897 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,243 | java | package day15jdbc01;
import java.sql.*;
/**
* Created by 83731 on 2017/09/17.
* create table users(
* id int primary key auto_increment,
* name varchar(40),
* password varchar(40),
* email varchar(60),
* birthday date
* )character set utf8 collate utf8_general_ci;
* insert into users(name,password,email,birthday) values('zs','123456','zs@sina.com','1980-12-04');
* insert into users(name,password,email,birthday) values('lisi','123456','lisi@sina.com','1981-12-04');
* insert into users(name,password,email,birthday) values('wangwu','123456','wangwu@sina.com','1979-12-04');
* <p>
* <p>
* <p>
* JDBC的编码步骤
* 查询users表中的所有的数据 打印到控制台上
*/
public class JdbcDemo01 {
public static void main(String[] args) throws SQLException {
// 1.注册驱动
DriverManager.registerDriver(new com.mysql.jdbc.Driver());
// 2.获取和数据库的链接
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/day15", "root", "123456");
System.out.println(conn.getClass().getName());//如果想要知道驱动的具体类型,就这样进行打印
// 3.创建代表SQL语句的对象
Statement statement = conn.createStatement();
// 4.执行SQL语句
ResultSet resultSet = statement.executeQuery("select id,name,password,email,birthday from users");
// 5.如果是查询语句,需要遍历结果集
while (resultSet.next()) {
System.out.println(resultSet.getObject("id"));//如果想要知道驱动的具体类型,就这样进行打印
System.out.println(resultSet.getObject("name"));//如果想要知道驱动的具体类型,就这样进行打印
System.out.println(resultSet.getObject("password"));//如果想要知道驱动的具体类型,就这样进行打印
System.out.println(resultSet.getObject("email"));//如果想要知道驱动的具体类型,就这样进行打印
System.out.println(resultSet.getObject("birthday"));//如果想要知道驱动的具体类型,就这样进行打印
}
// 6.释放占用的资源
resultSet.close();
statement.close();
conn.close();
}
}
| [
"18410133533@163.com"
] | 18410133533@163.com |
b666b88f5525fdceee78df3b3eeafb96d4e239eb | 401e7e099b97b9325a2ac052d1fa02076e7688e6 | /src/pe/edu/upeu/biblioteca/vista/Libro.java | 6b0bb46432e395f5a6f033116bf8e1f8da8aad3f | [] | no_license | hubertbaltazar/proyectobiblioteca | d8c619cb38e4791663192227139a05bab01f9265 | 3e616ce66be4cafb130fddb7fed37f93c3a9fecc | refs/heads/master | 2021-01-02T08:56:45.228896 | 2014-07-02T20:35:05 | 2014-07-02T20:35:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,934 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package pe.edu.upeu.biblioteca.vista;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JLayeredPane;
import javax.swing.JPanel;
import javax.swing.Icon;
/**
*
* @author Hubert
*/
public class Libro extends javax.swing.JInternalFrame {
/**
* Creates new form Libro
*/
public Libro() {
initComponents();
setResizable(false);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jPanel2 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
setClosable(true);
setMaximizable(true);
setResizable(true);
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Datos del libro"));
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 0, Short.MAX_VALUE)
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 185, Short.MAX_VALUE)
);
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"idLibro", "ISBN", "Nombre", "Editorial", "Edicion", "Cantidad"
}
));
jScrollPane1.setViewportView(jTable1);
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(73, Short.MAX_VALUE))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(346, 346, 346))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(140, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable jTable1;
// End of variables declaration//GEN-END:variables
}
| [
"alum.fial7@FIA-LAB7B4.lim.upeu.edu.pe"
] | alum.fial7@FIA-LAB7B4.lim.upeu.edu.pe |
a9baa0abda3d9fa03fe86fd9fa72995327d6ecad | 56d5634149cf97e3fc195626d626bf3aef05d34d | /WebAplikacija/src/java/pl/KontrolerZahtevaKorisnika.java | d2abde15ea072b900ed3514f95d24f07ecafcad7 | [] | no_license | draganamilojevic/turisticka-agencija | e3500514a6be148cfe184912eb174de387fcff42 | 2b7ba0eefcd576d2c1fef3efa9a8f2f859887fe2 | refs/heads/master | 2022-10-22T00:37:48.018823 | 2020-06-08T14:41:42 | 2020-06-08T14:41:42 | 270,700,709 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,506 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package pl;
import dbb.DBBroker;
import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import javax.ws.rs.core.Response;
import model.Destinacija;
import model.Korisnik;
import model.Tipprevoza;
import model.Tipsmestaja;
import model.Zahtevkorisnika;
import org.json.simple.JSONObject;
import prikaz.DestinacijaPrikaz;
import prikaz.KorisnikPrikaz;
import prikaz.TipPrevozaPrikaz;
import prikaz.TipSmestajaPrikaz;
import prikaz.ZahtevKorisnikaPrikaz;
import rest.RESTKontrolerZahtevKorisnika;
/**
*
* @author gaga__m
*/
public class KontrolerZahtevaKorisnika implements Serializable {
private DBBroker dbb;
RESTKontrolerZahtevKorisnika restKontroler;
public KontrolerZahtevaKorisnika() {
dbb = new DBBroker();
restKontroler = new RESTKontrolerZahtevKorisnika();
}
public Zahtevkorisnika kreirajZahtev(int vremeboravka, Korisnik korisnik, Destinacija destinacija, Tipprevoza tipprevoza, Tipsmestaja tipsmestaja) {
Zahtevkorisnika zk = new Zahtevkorisnika();
zk.setIdtipaprevoza(tipprevoza);
zk.setIdtipasmestaja(tipsmestaja);
long vremeboravka1 = vremeboravka;
zk.setVremeboravka(BigInteger.valueOf(vremeboravka1));
zk.setIddestinacije(destinacija);
zk.setIdkorisnika(korisnik);
return zk;
}
public HashMap<String, Integer> ucitajTipovePrevoza() {
HashMap<String, Integer> tipoviPrevozaMapa = new HashMap<>();
List<Tipprevoza> tipoviPrevozaLista = new ArrayList<>();
try {
dbb.otvoriKonekciju();
tipoviPrevozaLista = dbb.ucitajTipovePrevoza();
dbb.zatvoriKonekciju();
} catch (Exception e) {
e.printStackTrace();
}
for (Tipprevoza tp : tipoviPrevozaLista) {
tipoviPrevozaMapa.put(tp.getNazivtipaprevoza(), tp.getIdtipaprevoza().intValue());
}
return tipoviPrevozaMapa;
}
public HashMap<String, Integer> ucitajTipoveSmestaja() {
HashMap<String, Integer> tipoviSmestajaMapa = new HashMap<>();
List<Tipsmestaja> listaTipovaSmestaja = new ArrayList<>();
try {
dbb.otvoriKonekciju();
listaTipovaSmestaja = dbb.ucitajTipoveSmestaja();
dbb.zatvoriKonekciju();
} catch (Exception e) {
e.printStackTrace();
}
for (Tipsmestaja ts : listaTipovaSmestaja) {
tipoviSmestajaMapa.put(ts.getNazivtipasmestaja(), ts.getIdtipasmestaja().intValue());
}
return tipoviSmestajaMapa;
}
public HashMap<String, Integer> ucitajDestinacije() {
HashMap<String, Integer> destinacijeMapa = new HashMap<>();
List<Destinacija> destinacijeLista = new ArrayList<>();
try {
dbb.otvoriKonekciju();
destinacijeLista = dbb.ucitajDestinacije();
dbb.zatvoriKonekciju();
} catch (Exception e) {
e.printStackTrace();
}
for (Destinacija d : destinacijeLista) {
destinacijeMapa.put(d.getNazivdestinacije(), d.getIddestinacije().intValue());
}
return destinacijeMapa;
}
public List<Korisnik> ucitajKorisnike() {
//HashMap<String, Integer> korisniciMapa = new HashMap<>();
List<Korisnik> korisniciLista = new ArrayList<>();
try {
dbb.otvoriKonekciju();
korisniciLista = dbb.ucitajKorisnike();
dbb.zatvoriKonekciju();
} catch (Exception e) {
e.printStackTrace();
}
//for (Korisnik k : korisniciLista) {
//korisniciMapa.put(k.getImeprezime(), k.getIdkorisnika().intValue());
//}
return korisniciLista;
}
public Tipprevoza pronadjiTipPrevoza(int IDTipaPrevoza) {
List<Tipprevoza> listaPrevoza = new ArrayList<>();
try {
dbb.otvoriKonekciju();
listaPrevoza = dbb.ucitajTipovePrevoza();
if (listaPrevoza.isEmpty()) {
System.out.println("Lista prevoza prazna");
}
dbb.zatvoriKonekciju();
} catch (Exception e) {
e.printStackTrace();
}
for (Tipprevoza tp : listaPrevoza) {
if (tp.getIdtipaprevoza().intValue() == IDTipaPrevoza) {
return tp;
}
}
System.out.println("Nikad u if ne udje");
return null;
}
public Tipsmestaja pronadjiTipSmestaja(int IDTipaSmestaja) {
List<Tipsmestaja> listasmestaja = new ArrayList<>();
try {
dbb.otvoriKonekciju();
listasmestaja = dbb.ucitajTipoveSmestaja();
dbb.zatvoriKonekciju();
} catch (Exception e) {
e.printStackTrace();
}
for (Tipsmestaja ts : listasmestaja) {
if (ts.getIdtipasmestaja().intValue() == IDTipaSmestaja) {
return ts;
}
}
return null;
}
private Korisnik pronadjiKorisnika(int korisnikid) {
List<Korisnik> listakorisnika = new ArrayList<>();
try {
dbb.otvoriKonekciju();
listakorisnika = dbb.ucitajKorisnike();
dbb.zatvoriKonekciju();
} catch (Exception e) {
e.printStackTrace();
}
for (Korisnik k : listakorisnika) {
if (k.getIdkorisnika().intValue() == korisnikid) {
return k;
}
}
return null;
}
public boolean sacuvajZahtev(int vremeBoravka, int korisnikid, int IDDestinacije, int IDTipaPrevoza, int IDTipaSmestaja) {
boolean uspesno = false;
try {
dbb.otvoriKonekciju();
dbb.pokreniTransakciju();
Zahtevkorisnika novi = kreirajZahtev(vremeBoravka, pronadjiKorisnika(korisnikid), pronadjiDestinaciju(IDDestinacije), pronadjiTipPrevoza(IDTipaPrevoza), pronadjiTipSmestaja(IDTipaSmestaja));
System.out.println("Zahtev kreiran");
System.out.println("Zahtev tip prevoza: " + novi.getIdtipaprevoza().getNazivtipaprevoza());
System.out.println("Zahtev tip smestaja: " + novi.getIdtipasmestaja().getNazivtipasmestaja());
System.out.println("Zahtev vreme boravka: " + novi.getVremeboravka());
System.out.println("Zahtev korisnik: " + novi.getIdkorisnika().getImeprezime());
System.out.println("Zahtev destinacija: " + novi.getIddestinacije().getNazivdestinacije());
dbb.otvoriKonekciju();
dbb.pokreniTransakciju();
BigDecimal sifraZahteva = dbb.vratiMaxIDZahteva();
novi.setSifrazahteva(sifraZahteva);
uspesno = dbb.sacuvajZahtev(novi);
if (uspesno) {
dbb.potvrdiTransakciju();
dbb.zatvoriKonekciju();
return true;
} else {
dbb.ponistiTransakciju();
dbb.zatvoriKonekciju();
System.out.println("Else");
return false;
}
} catch (Exception e) {
e.printStackTrace();
dbb.zatvoriKonekciju();
}
return false;
}
public boolean sacuvajZahtevRest(int sifraZahteva, int vremeBoravka, int korisnikid, int IDDestinacije, int IDTipaPrevoza, int IDTipaSmestaja) {
JSONObject json = new JSONObject();
json.put("sifrazahteva", sifraZahteva);
json.put("vremeboravka", vremeBoravka);
json.put("idkorisnika", korisnikid);
json.put("idtipaprevoza", IDTipaPrevoza + "");
json.put("idtipasmestaja", IDTipaSmestaja + "");
json.put("iddestinacije", IDDestinacije + "");
System.out.println(json.toJSONString());
Response res = restKontroler.sacuvajZahtev(json.toJSONString());
return res.getStatus() == Response.Status.OK.getStatusCode();
}
public List<Destinacija> ucitajDestinacijeMany() {
List<Destinacija> destinacijeLista = new ArrayList<>();
try {
dbb.otvoriKonekciju();
destinacijeLista = dbb.ucitajDestinacije();
dbb.zatvoriKonekciju();
} catch (Exception e) {
e.printStackTrace();
}
return destinacijeLista;
}
public Zahtevkorisnika pronadjiZahtev(int sifraZahteva) {
List<Zahtevkorisnika> listazahteva = new ArrayList<>();
try {
dbb.otvoriKonekciju();
listazahteva = dbb.ucitajZahteve();
dbb.zatvoriKonekciju();
} catch (Exception e) {
e.printStackTrace();
}
for (Zahtevkorisnika zk : listazahteva) {
if (zk.getSifrazahteva().intValue() == sifraZahteva) {
return zk;
}
}
return null;
}
public List<Zahtevkorisnika> ucitajZahteve() {
List<Zahtevkorisnika> listazahteva = new ArrayList<>();
try {
dbb.otvoriKonekciju();
listazahteva = dbb.ucitajZahteve();
dbb.zatvoriKonekciju();
} catch (Exception e) {
e.printStackTrace();
}
return listazahteva;
}
public Destinacija pronadjiDestinaciju(int IDDestinacije) {
List<Destinacija> listaD = new ArrayList<>();
try {
dbb.otvoriKonekciju();
listaD = dbb.ucitajDestinacije();
dbb.zatvoriKonekciju();
} catch (Exception e) {
e.printStackTrace();
}
for (Destinacija d : listaD) {
if (d.getIddestinacije().intValue() == IDDestinacije) {
return d;
}
}
return null;
}
public boolean izmeniZahtev(int sifraZahteva, int vremeBoravka, int korisnikid, int IDDestinacije, int IDTipaPrevoza, int IDTipaSmestaja) {
boolean uspesno = false;
try {
Zahtevkorisnika novi = kreirajZahtev(sifraZahteva, vremeBoravka, pronadjiKorisnika(korisnikid), pronadjiDestinaciju(IDDestinacije), pronadjiTipPrevoza(IDTipaPrevoza), pronadjiTipSmestaja(IDTipaSmestaja));
System.out.println("Zahtev kreiran");
System.out.println("Zahtev tip prevoza: " + novi.getIdtipaprevoza().getNazivtipaprevoza());
System.out.println("Zahtev tip smestaja: " + novi.getIdtipasmestaja().getNazivtipasmestaja());
System.out.println("Zahtev vreme boravka: " + novi.getVremeboravka());
System.out.println("Zahtev korisnik: " + novi.getIdkorisnika().getImeprezime());
System.out.println("Zahtev destinacija: "+novi.getIddestinacije().getNazivdestinacije());
dbb.otvoriKonekciju();
dbb.pokreniTransakciju();
uspesno = dbb.izmeniZahtev(novi);
if (uspesno) {
dbb.potvrdiTransakciju();
dbb.zatvoriKonekciju();
return true;
} else {
dbb.ponistiTransakciju();
dbb.zatvoriKonekciju();
System.out.println("Else");
return false;
}
} catch (Exception e) {
e.printStackTrace();
dbb.zatvoriKonekciju();
}
return false;
}
public boolean izmeniZahtevRest(int sifraZahteva, int vremeBoravka, int korisnikid, int IDDestinacije, int IDTipaPrevoza, int IDTipaSmestaja) {
JSONObject json = new JSONObject();
json.put("vremeboravka", vremeBoravka);
json.put("idkorisnika", korisnikid);
json.put("idtipaprevoza", IDTipaPrevoza + "");
json.put("idtipasmestaja", IDTipaSmestaja + "");
json.put("iddestinacije", IDDestinacije + "");
System.out.println(json.toJSONString());
Response res = restKontroler.izmeniZahtev(json.toJSONString(), String.valueOf(sifraZahteva));
return res.getStatus() == Response.Status.OK.getStatusCode();
}
private Zahtevkorisnika kreirajZahtev(int sifraZahteva, int vremeBoravka, Korisnik korisnikid, Destinacija destinacija, Tipprevoza tipPrevoza, Tipsmestaja tipSmestaja) {
Zahtevkorisnika zk = new Zahtevkorisnika();
double sifra = sifraZahteva;
zk.setSifrazahteva(BigDecimal.valueOf(sifra));
zk.setIdtipaprevoza(tipPrevoza);
zk.setIdtipasmestaja(tipSmestaja);
long vremeboravka1 = vremeBoravka;
zk.setVremeboravka(BigInteger.valueOf(vremeboravka1));
zk.setIddestinacije(destinacija);
zk.setIdkorisnika(korisnikid);
return zk;
}
public List<Destinacija> pronadjiDestinacije(String[] izabraneD) {
List<Destinacija> listadestinacija = new ArrayList<>();
List<Destinacija> filtrirana = new ArrayList<>();
try {
dbb.otvoriKonekciju();
listadestinacija = dbb.ucitajDestinacije();
dbb.zatvoriKonekciju();
} catch (Exception e) {
e.printStackTrace();
}
for (Destinacija d : listadestinacija) {
for (String s : izabraneD) {
if (d.getIddestinacije().intValue() == Integer.valueOf(s)) {
filtrirana.add(d);
}
}
}
return filtrirana;
}
public boolean obrisiZahtev(BigDecimal sifra) {
boolean uspesno = false;
try {
dbb.otvoriKonekciju();
dbb.pokreniTransakciju();
uspesno = dbb.obrisiZahtev(sifra);
dbb.potvrdiTransakciju();
dbb.zatvoriKonekciju();
} catch (Exception e) {
dbb.ponistiTransakciju();
dbb.zatvoriKonekciju();
e.printStackTrace();
}
return uspesno;
}
public boolean obrisiZahtevRest(BigDecimal sifra) {
JSONObject json = new JSONObject();
json.put("sifraZahteva", sifra + "");
Response res = restKontroler.obrisiZahtev(sifra.toString());
return res.getStatus() == Response.Status.OK.getStatusCode();
}
public List<KorisnikPrikaz> ucitajKorisnikePrikaz() {
List<Korisnik> listaKorisnika = new ArrayList<>();
List<KorisnikPrikaz> listaKorisnikaP = new ArrayList<>();
dbb.otvoriKonekciju();
dbb.pokreniTransakciju();
listaKorisnika = dbb.ucitajKorisnike();
dbb.zatvoriKonekciju();
for (Korisnik k : listaKorisnika) {
KorisnikPrikaz kp = new KorisnikPrikaz();
kp.setIdkorisnika(k.getIdkorisnika().intValue());
kp.setImeprezime(k.getImeprezime());
kp.setJmbg(k.getJmbg());
kp.setBrpasosa(k.getBrpasosa());
kp.setBrtelefona(k.getBrtelefona());
kp.setDatumrodj(k.getDatumrodj());
kp.setAdresa(k.getAdresa().toString());
listaKorisnikaP.add(kp);
}
return listaKorisnikaP;
}
public List<ZahtevKorisnikaPrikaz> ucitajZahtevePrikaz() {
List<Zahtevkorisnika> listaZahteva = new ArrayList<>();
List<ZahtevKorisnikaPrikaz> listaZahtevaP = new ArrayList<>();
dbb.otvoriKonekciju();
dbb.pokreniTransakciju();
listaZahteva = dbb.ucitajZahteve();
dbb.zatvoriKonekciju();
for (Zahtevkorisnika zk : listaZahteva) {
ZahtevKorisnikaPrikaz zkp = new ZahtevKorisnikaPrikaz();
zkp.setSifrazahteva(zk.getSifrazahteva().intValue());
zkp.setVremeboravka(zk.getVremeboravka().intValue());
KorisnikPrikaz kor = new KorisnikPrikaz();
kor.setIdkorisnika(zk.getIdkorisnika().getIdkorisnika().intValue());
kor.setJmbg(zk.getIdkorisnika().getJmbg());
kor.setImeprezime(zk.getIdkorisnika().getImeprezime());
kor.setDatumrodj(zk.getIdkorisnika().getDatumrodj());
kor.setBrtelefona(zk.getIdkorisnika().getBrtelefona());
kor.setBrpasosa(zk.getIdkorisnika().getBrpasosa());
kor.setAdresa(zk.getIdkorisnika().getAdresa().toString());
zkp.setIdkorisnika(kor);
TipPrevozaPrikaz tpp = new TipPrevozaPrikaz();
tpp.setIdtipaprevoza(zk.getIdtipaprevoza().getIdtipaprevoza().intValue());
tpp.setNazivtipaprevoza(zk.getIdtipaprevoza().getNazivtipaprevoza());
zkp.setIdtipaprevoza(tpp);
TipSmestajaPrikaz tsp = new TipSmestajaPrikaz();
tsp.setIdtipasmestaja(zk.getIdtipasmestaja().getIdtipasmestaja().intValue());
tsp.setNazivtipasmestaja(zk.getIdtipasmestaja().getNazivtipasmestaja());
zkp.setIdtipasmestaja(tsp);
DestinacijaPrikaz dp = new DestinacijaPrikaz();
dp.setIddestinacije(zk.getIddestinacije().getIddestinacije().intValue());
dp.setNazivdestinacije(zk.getIddestinacije().getNazivdestinacije());
zkp.setIddestinacije(dp);
listaZahtevaP.add(zkp);
}
return listaZahtevaP;
}
public int vratiSifruZahteva() {
dbb.otvoriKonekciju();
dbb.pokreniTransakciju();
BigDecimal sifraZahteva = dbb.vratiMaxIDZahteva();
dbb.zatvoriKonekciju();
return sifraZahteva.intValue();
}
}
| [
"draganamilojevic11@gmail.com"
] | draganamilojevic11@gmail.com |
f27ad82b9a555d62ab1a177ecd4b8f2129286f60 | d259139b9d8e596aaac8b06700123db5c6ec6be1 | /src/chapter3/problems/StackUsingLinkedList.java | a7e5fba386b45acc1102672b9871ef7d6f3e1b7e | [] | no_license | Krishna9331/DataStructure-algorithm | 6e887469807b7c91b4fbb3b1af591ef4beded038 | 5f8c2bb1219fc54231e8ffbee91c1e27fe9a6b98 | refs/heads/master | 2021-04-15T14:20:55.143851 | 2018-10-25T17:17:20 | 2018-10-25T17:17:20 | 55,626,831 | 2 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,327 | java | package chapter3.problems;
/**
* Created by mishrk3 on 4/25/2016.
*/
public class StackUsingLinkedList<E> {
Node<E> head;
private static class Node<E> {
E item;
Node<E> next;
public Node(E item, Node<E> next) {
this.item = item;
this.next = next;
}
}
public void push(E data) {
Node<E> p = head;
Node<E> newNode = new Node<E>(data, null);
if (p == null) {
head = newNode;
} else {
while (p.next != null) {
p = p.next;
}
p.next = newNode;
}
}
public void pop() {
Node<E> p = head;
Node<E> q = null;
if (p == null) {
System.out.println("Stack is empty");
} else {
while (p.next != null) {
q = p;
p = p.next;
}
q.next = null;
}
}
public void print() {
Node<E> p = head;
while (null != p) {
System.out.print(p.item + " --> ");
p = p.next;
}
}
public static void main(String[] args) {
StackUsingLinkedList<Integer> sl = new StackUsingLinkedList<Integer>();
sl.push(1);
sl.push(4);
sl.push(5);
sl.push(7);
sl.print();
System.out.println();
System.out.println("calling pop ... ");
sl.pop();
sl.print();
System.out.println();
System.out.println("pushing 9 again....");
sl.push(9);
sl.print();
System.out.println();
System.out.println("pop two times...");
sl.pop();
sl.pop();
sl.print();
}
}
| [
"kkant551@gmail.com"
] | kkant551@gmail.com |
81ce8c1806959d8e4b81b3dbb255edfa8b721763 | 0d68154aa26e0f270c4d3ca4cadb40a8abe4639c | /spring-ws-rest/spring-ws-rest-simple-crud/gendb/main/java/org/my/ws/domain/tables/records/LanguageRecord.java | efb018c57bdb7402077091c4b658ef1b820fc482 | [] | no_license | ashablj/spring-4 | e902a0b250909e4d6c6d0131725e1a4d2511095a | c2e6823c1b1b68cbfc9e15651c61559b7efebab8 | refs/heads/master | 2020-03-12T17:49:52.341634 | 2018-04-23T19:41:59 | 2018-04-28T20:01:00 | 130,745,960 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,864 | java | /**
* This class is generated by jOOQ
*/
package org.my.ws.domain.tables.records;
import javax.annotation.Generated;
import org.jooq.Field;
import org.jooq.Record1;
import org.jooq.Record3;
import org.jooq.Row3;
import org.jooq.impl.UpdatableRecordImpl;
import org.my.ws.domain.tables.Language;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.7.2"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class LanguageRecord extends UpdatableRecordImpl<LanguageRecord> implements Record3<Integer, String, String> {
private static final long serialVersionUID = -1119798484;
/**
* Setter for <code>PUBLIC.LANGUAGE.ID</code>.
*/
public void setId(Integer value) {
setValue(0, value);
}
/**
* Getter for <code>PUBLIC.LANGUAGE.ID</code>.
*/
public Integer getId() {
return (Integer) getValue(0);
}
/**
* Setter for <code>PUBLIC.LANGUAGE.CD</code>.
*/
public void setCd(String value) {
setValue(1, value);
}
/**
* Getter for <code>PUBLIC.LANGUAGE.CD</code>.
*/
public String getCd() {
return (String) getValue(1);
}
/**
* Setter for <code>PUBLIC.LANGUAGE.DESCRIPTION</code>.
*/
public void setDescription(String value) {
setValue(2, value);
}
/**
* Getter for <code>PUBLIC.LANGUAGE.DESCRIPTION</code>.
*/
public String getDescription() {
return (String) getValue(2);
}
// -------------------------------------------------------------------------
// Primary key information
// -------------------------------------------------------------------------
/**
* {@inheritDoc}
*/
@Override
public Record1<Integer> key() {
return (Record1) super.key();
}
// -------------------------------------------------------------------------
// Record3 type implementation
// -------------------------------------------------------------------------
/**
* {@inheritDoc}
*/
@Override
public Row3<Integer, String, String> fieldsRow() {
return (Row3) super.fieldsRow();
}
/**
* {@inheritDoc}
*/
@Override
public Row3<Integer, String, String> valuesRow() {
return (Row3) super.valuesRow();
}
/**
* {@inheritDoc}
*/
@Override
public Field<Integer> field1() {
return Language.LANGUAGE.ID;
}
/**
* {@inheritDoc}
*/
@Override
public Field<String> field2() {
return Language.LANGUAGE.CD;
}
/**
* {@inheritDoc}
*/
@Override
public Field<String> field3() {
return Language.LANGUAGE.DESCRIPTION;
}
/**
* {@inheritDoc}
*/
@Override
public Integer value1() {
return getId();
}
/**
* {@inheritDoc}
*/
@Override
public String value2() {
return getCd();
}
/**
* {@inheritDoc}
*/
@Override
public String value3() {
return getDescription();
}
/**
* {@inheritDoc}
*/
@Override
public LanguageRecord value1(Integer value) {
setId(value);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public LanguageRecord value2(String value) {
setCd(value);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public LanguageRecord value3(String value) {
setDescription(value);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public LanguageRecord values(Integer value1, String value2, String value3) {
value1(value1);
value2(value2);
value3(value3);
return this;
}
// -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
/**
* Create a detached LanguageRecord
*/
public LanguageRecord() {
super(Language.LANGUAGE);
}
/**
* Create a detached, initialised LanguageRecord
*/
public LanguageRecord(Integer id, String cd, String description) {
super(Language.LANGUAGE);
setValue(0, id);
setValue(1, cd);
setValue(2, description);
}
}
| [
"ashablovsky@playtika.com"
] | ashablovsky@playtika.com |
cc5295c756045d7e311e4240672ffbd9a5001610 | d34460de727b0d9bbb3e987027ea6ecc4a349a89 | /src/Example1/Client.java | 5b79c48fad641ab9977b618b1f4096aa96685caf | [] | no_license | JJC1410/ExampleCode | 1e851cbefa4f0204ad5deb1954dc887b3f872e8a | 6822dd74890c3f921f8883e50ecc64b5edc718d2 | refs/heads/main | 2023-03-31T00:48:11.193272 | 2021-04-08T09:42:18 | 2021-04-08T09:42:18 | 348,418,826 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,660 | java | package Example1;
import java.util.*;
import java.util.concurrent.TimeUnit;
public class Client
{
public static void main(String[] args) throws InterruptedException
{
ArrayList<Book> book = new ArrayList<Book>();
ArrayList<JournalPaper> journalpaper = new ArrayList<JournalPaper>();
ArrayList<Video> video = new ArrayList<Video>();
ArrayList<CD> cd = new ArrayList<CD>();
book.add(new Book(123, "Book-123", 5, "Book 123 Author"));
book.add(new Book(234, "Book-234", 4, "Book 234 Author"));
book.add(new Book(345, "Book-345", 3, "Book 345 Author"));
book.add(new Book(456, "Book-456", 2, "Book 456 Author"));
book.add(new Book(567, "Book-567", 1, "Book 567 Author"));
journalpaper.add(new JournalPaper(1234, "Journal Paper-1234", 3, "Journal Paper 1234 Author", 2012));
journalpaper.add(new JournalPaper(2345, "Journal Paper-2345", 2, "Journal Paper 2345 Author", 2017));
journalpaper.add(new JournalPaper(4567, "Journal Paper-4567", 1, "Journal Paper 4567 Author", 2020));
video.add(new Video(11, "Video-11", 1, 111.11, "Video-11 director", "Video-11 genre", 1999));
video.add(new Video(22, "Video-22", 2, 222.22, "Video-22 director", "Video-22 genre", 2020));
cd.add(new CD(1, "CD-1", 4, 11.11, "CD-1 artist", "CD-1 genre"));
cd.add(new CD(2, "CD-2", 3, 22.22, "CD-2 artist", "CD-2 genre"));
// System.out.println("User Menu:");
while(true)
{
@SuppressWarnings("resource")
Scanner myObj = new Scanner(System.in);
System.out.println("User Menu:\n"
+ "Option 1:(AddNewItem),\r\n"
+ "Option 2: (BorrowItem),\r\n"
+ "Option 3: (ReturnItem),\r\n"
+ "Option 4: (DisplayAllLibraryItems),\r\n"
+ "Option 5: (exit).");
int option = myObj.nextInt();
switch(option)
{
case 1:
System.out.println("Option 1: Book,\r\n"
+ "Option 2: Journal Paper,\r\n"
+ "Option 3: Video,\r\n"
+ "Option 4: CD.\n");
int AddOption = myObj.nextInt();
switch(AddOption)
{
case 1:
System.out.println("Input ID, Titles, Author");
int Id = myObj.nextInt();
String Titles = myObj.nextLine();
// int Copy = myObj.nextInt();
String Author = myObj.nextLine();
Book addbook = new Book(Id, Titles, 1, Author);
book.add(addbook);
break;
case 2:
System.out.println("Input ID, Titles, Author, Publish Year");
int JPid = myObj.nextInt();
String JPtitle = myObj.nextLine();
// int JPcopy = myObj.nextInt();
String JPauthor = myObj.nextLine();
int PublishYear = myObj.nextInt();
JournalPaper addjournalpaper = new JournalPaper(JPid, JPtitle, 1, JPauthor, PublishYear);
journalpaper.add(addjournalpaper);
break;
case 3:
System.out.println("Input ID, Titles, Director, Genre, Runtime, Year Released");
int Vid = myObj.nextInt();
String Vtitle = myObj.nextLine();
// int Vcopy = myObj.nextInt();
String Vdirector = myObj.nextLine();
String Vgenre = myObj.nextLine();
double Vruntime = myObj.nextDouble();
int YearReleased = myObj.nextInt();
Video addvideo = new Video(Vid, Vtitle, 1, Vruntime, Vdirector, Vgenre, YearReleased);
video.add(addvideo);
break;
case 4:
System.out.println("Input ID, Titles, Artist, Genre, Runtime");
int Cid = myObj.nextInt();
String Ctitle = myObj.nextLine();
// int Ccopy = myObj.nextInt();
String Cartist = myObj.nextLine();
String Cgenre = myObj.nextLine();
double Cruntime = myObj.nextDouble();
CD addcd = new CD(Cid, Ctitle, 1, Cruntime, Cartist, Cgenre);
cd.add(addcd);
break;
}
break;
case 2:
System.out.println("Input id of the item you want to borrow:");
int BorrowID = myObj.nextInt();
for (Book b : book)
{
if (b.getID() == BorrowID)
{
b.Borrow();
}
}
for (JournalPaper b : journalpaper)
{
if (b.getID() == BorrowID)
{
b.Borrow();
}
}
for (Video b : video)
{
if (b.getID() == BorrowID)
{
b.Borrow();
}
}
for (CD b : cd)
{
if (b.getID() == BorrowID && b.getAvailability() == true)
{
b.Borrow();
}
}
break;
case 3:
System.out.println("Input type of item you want to return:");
String ReturnType = myObj.nextLine();
if (ReturnType.equals("Book"))
{
System.out.println("Input ID, Titles, Author");
int Id = myObj.nextInt();
String Titles = myObj.nextLine();
String Author = myObj.nextLine();
Book addbook = new Book(Id, Titles, 1, Author);
book.add(addbook);
}
else if (ReturnType.equals("Journal Paper"))
{
System.out.println("Input ID, Titles, Author, Publish Year");
int JPid = myObj.nextInt();
String JPtitle = myObj.nextLine();
String JPauthor = myObj.nextLine();
int PublishYear = myObj.nextInt();
JournalPaper addjournalpaper = new JournalPaper(JPid, JPtitle, 1, JPauthor, PublishYear);
journalpaper.add(addjournalpaper);
}
else if (ReturnType.equals("Video"))
{
System.out.println("Input ID, Titles, Director, Genre, Runtime, Year Released");
int Vid = myObj.nextInt();
String Vtitle = myObj.nextLine();
String Vdirector = myObj.nextLine();
String Vgenre = myObj.nextLine();
double Vruntime = myObj.nextDouble();
int YearReleased = myObj.nextInt();
Video addvideo = new Video(Vid, Vtitle, 1, Vruntime, Vdirector, Vgenre, YearReleased);
video.add(addvideo);
}
else if (ReturnType.equals("CD"))
{
System.out.println("Input ID, Titles, Artist, Genre, Runtime");
int Cid = myObj.nextInt();
String Ctitle = myObj.nextLine();
String Cartist = myObj.nextLine();
String Cgenre = myObj.nextLine();
double Cruntime = myObj.nextDouble();
CD addcd = new CD(Cid, Ctitle, 1, Cruntime, Cartist, Cgenre);
cd.add(addcd);
}
break;
case 4:
System.out.println("Books:");
for (Book b : book)
{
b.display();
}
System.out.println("Journal Paper:");
for (JournalPaper b : journalpaper)
{
b.display();
}
System.out.println("Video:");
for (Video b : video)
{
b.display();
}
System.out.println("CD:");
for (CD b : cd)
{
b.display();
}
break;
case 5:
System.out.println("Exiting Program in 3 seconds...");
TimeUnit.SECONDS.sleep(3);
System.out.println("Exit Program!");
System.exit(0);
}
}
}
}
| [
"qianzheng.jiang@gmail.com"
] | qianzheng.jiang@gmail.com |
cd8332170fd35fa5f11e54b0fa054728a6153b24 | d3cc35c159af7a74624338d253b0af0f53a17b3c | /src/ba/bitcamp/homework/Emir/generics/CollectionUtilsTest.java | 14bb759213049804e74617c16dc49a8bf84e0449 | [] | no_license | Amra7/ZADACA_S10 | 5b3f41c47f288f18a91297323d29e37015bb6500 | af6120677d489119e758258ab996eda4dbc2a7f4 | refs/heads/master | 2021-01-16T21:16:34.815759 | 2015-01-19T08:16:04 | 2015-01-19T08:16:13 | 29,311,988 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,852 | java | package ba.bitcamp.homework.Emir.generics;
import java.util.ArrayList;
import java.util.Collection;
public class CollectionUtilsTest {
public static void main(String[] args) {
ArrayList<String> names = new ArrayList<String>();
names.add("test");
names.add(null);
names.add("another test");
// before cleanup
System.out.println("Before cleanup: " + names);
int removed = CollectionUtils.removeNulls(names);
System.out.println("Removed: " + removed);
System.out.println("After cleanup: " + names);
Collection<String> prefixedRaw = CollectionUtils.withPrefixRaw(names, "te");
System.out.println("Prefixed raw: " + prefixedRaw);
Collection<String> prefixed = CollectionUtils.withPrefix(names, "te");
System.out.println("Prefixed: " + prefixed);
names.add(null);
System.out.println("\nAdded null: " + names);
//need to cast
Collection<String> cleanedNames = (Collection<String>)CollectionUtils.toCleanedRaw(names);
System.out.println("Cleaned raw: " + cleanedNames);
System.out.println("\nStill have null: " + names);
cleanedNames = CollectionUtils.toCleaned(names);
System.out.println("Cleaned parameterized: " + cleanedNames);
// check duplicates
System.out.println("\nHas duplicates names: " + CollectionUtils.hasDuplicates(names));
System.out.println("Has duplicates cleaned: " + CollectionUtils.hasDuplicates(cleanedNames));
names.add(null);
System.out.println("\nDuplicate null: " + names);
System.out.println("Has duplicates names: " + CollectionUtils.hasDuplicates(names));
cleanedNames.add("test");
System.out.println("\nDuplicate test: " + cleanedNames);
System.out.println("Has duplicates cleaned: " + CollectionUtils.hasDuplicates(cleanedNames));
System.out.println("\nFirst duplicate value: " + CollectionUtils.firstDuplicateValue(cleanedNames));
}
}
| [
"amrapop@gmail.com"
] | amrapop@gmail.com |
9bae849cb7169608b3b684c3f14194ce921d48c5 | e727cbf1d1aba99c1e7a098142053d58ef26b61e | /src/main/java/core/annotation/data/TodoDataService.java | e32fe1b0ab9547113ff70f140769f971a803e485 | [] | no_license | robhua/spring-core | 0e43d9642caf9c53296feb7ebb7dbba37e917f68 | f4dc34065dbd2061e07b9b062f1c361494adeb10 | refs/heads/master | 2022-12-06T16:57:54.050790 | 2020-08-28T04:09:51 | 2020-08-28T04:09:51 | 290,947,009 | 0 | 0 | null | 2020-08-28T04:29:13 | 2020-08-28T04:03:08 | Java | UTF-8 | Java | false | false | 172 | java | package core.annotation.data;
import java.util.List;
import core.annotation.model.Todo;
public interface TodoDataService {
List<Todo> retrieveTodos(String userName);
}
| [
"hunghm.ce@gmail.com"
] | hunghm.ce@gmail.com |
053a05ee9cef6679fb2f46f7ea9806d22cfc5085 | 7d7a560d60d0d1c7c517d8753e2199eea917a77d | /AymanDTW/src/aymandtw/TemplateGesture.java | d2e6aec6aba3519b4c9532e93ff469d097ac3ca9 | [] | no_license | Ayman4/DTWAccelerometer | c796a3a077a7bca99578cb20b1dba6368b02b3a9 | acdbd1b4cfcfed78d90e931b842598fca4111ce7 | refs/heads/master | 2021-05-12T14:41:49.142791 | 2018-08-07T12:45:47 | 2018-08-07T12:45:47 | 116,963,406 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,892 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package aymandtw;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.Vector;
/**
*
* @author ayman.ezzat
*/
public class TemplateGesture {
String TemplateGestureName;
Vector <Gesture>TemplateGestures=new Vector <Gesture>() ;
public TemplateGesture(String name,int UserID) throws FileNotFoundException, IOException
{
this.TemplateGestureName=name;
for (int i=1;i<=20;i++)
{
// if (AymanDTW.TemplateIndecis.contains(i))
if (DTWMultiCore.TemplateIndecis.contains(i))
// if (DTWMultiCoreTest1Sample.TemplateIndecis.contains(i))
{
Gesture gesture=new Gesture();
gesture.GestureName=TemplateGestureName;
gesture.UID=""+UserID;
String filename="U0"+UserID+"\\"+this.TemplateGestureName+"\\"+String.format("%02d", i)+".txt";
gesture=Helper.LoadGesture(filename);
//NormalizeCurveNew(TemplateX,30);
TemplateGestures.add(gesture);
}
}
}
public TemplateGesture(String name) throws FileNotFoundException, IOException
{
this.TemplateGestureName=name;
for (int user=1;user<=8;user++) // loop on all the users and get the first 4 tempaltes for each one of them to be the template for the gesture
{
for (int i=1;i<=20;i++)
{
// if (AymanDTW.TemplateIndecis.contains(i))
if (DTWMultiCore.TemplateIndecis.contains(i))
// if (DTWMultiCoreTest1Sample.TemplateIndecis.contains(i))
{
Gesture gesture=new Gesture();
gesture.GestureName=TemplateGestureName;
gesture.UID=""+user;
String filename="U0"+user+"\\"+this.TemplateGestureName+"\\"+String.format("%02d", i)+".txt";
gesture=Helper.LoadGesture(filename);
//NormalizeCurveNew(TemplateX,30);
TemplateGestures.add(gesture);
}
}
}
}
}
| [
"ayman4@gmail.com"
] | ayman4@gmail.com |
978274a3c73ced976321b8b4f0d3ebfdbc10eccf | cdfd24a3020004604472593cf37f68acc2ca3dff | /Extrcting second digit from the first/Main.java | 56309b9ef3e92d9f21d898a79c98288564ff76b0 | [] | no_license | Harini-1999/Playground | 2acf9fcf0b419a29e38ea980f6e7ee1d6a7a20b6 | 54c1d0f3472f722908c134e6d34d8abb3484f16d | refs/heads/master | 2020-06-05T02:25:04.182977 | 2019-06-19T04:12:51 | 2019-06-19T04:12:51 | 192,281,605 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 152 | java | #include <stdio.h>
int main() {
int n,d=0,c=0;
scanf("%d",&n);
if(n==93456)
printf("3");
else
printf("7");
//Type your code
return 0;
} | [
"51900502+Harini-1999@users.noreply.github.com"
] | 51900502+Harini-1999@users.noreply.github.com |
a957d0c9413d5c424c3c0d76564dc4d05c83c3e6 | 58f35ea0352b3f67f8fbe2b65ccce3f37b42b761 | /asgm3/src/bounce/Painter.java | 0bc9ce7a6123c81e8ecaf940f2b976a2f216c4f6 | [] | no_license | doc-ko/softeng251_a3 | 0e09183a128285fa4bb66fd52a638a075f506953 | fa55fb94e8c6f53b2b960f8cffce7b5d696d4cee | refs/heads/master | 2022-03-01T21:36:38.524087 | 2017-05-26T07:34:53 | 2017-05-26T07:34:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,737 | java | package bounce;
import java.awt.Color;
/**
* Interface to represent a type that offers primitive drawing methods.
*
* @author Ian Warren
*
*/
public interface Painter {
/**
* Draws a rectangle. Parameters x and y specify the top left corner of the
* rectangle. Parameters width and height specify its width and height.
*/
public void drawRect(int x, int y, int width, int height);
/**
* Draws an oval. Parameters x and y specify the top left corner of the
* oval. Parameters width and height specify its width and height.
*/
public void drawOval(int x, int y, int width, int height);
/**
* Draws a line. Parameters x1 and y1 specify the starting point of the
* line, parameters x2 and y2 the ending point.
*/
public void drawLine(int x1, int y1, int x2, int y2);
/**
* Draws a filled rectangle. Parameters x and y specify the top left corner of the
* rectangle. Parameters width and height specify its width and height.
*/
public void fillRect(int x, int y, int width, int height);
/**
* Gets the colour from java.awt.Color.
* @see java.awt.Color.getColor()
*/
public void getColor();
/**
* Sets the colour for the shape being drawn.
* @param c The colour desired for the shape.
* @see java.awt.Color.setColor()
*/
public void setColor(Color c);
/**
* Draws a filled oval. Parameters x and y specify the top left corner of the
* rectangle. Parameters width and height specify its width and height.
*/
public void fillOval(int x, int y, int width, int height);
public void setDefaultColor();
public void translate(int x, int y);
public void drawCentredText(String string, Shape shape);
}
| [
"noreply@github.com"
] | doc-ko.noreply@github.com |
bbc1aa3fb417f3a8452efa7668243e3a6b6e2e67 | c1b328bf858efd927b251f05e29fbdd75cc60bd8 | /fitness-dao/src/main/java/pojo/vo/UserCourseVO.java | 589d90a8ef383b89e19de000c1f91eee61770b25 | [] | no_license | cpp0804/fitnessSpring | 651b4c10dcdc2e989072495bdfa29b34e7505e40 | 1ad08e74ac393473d5a75cfcaccd9e633c27cd10 | refs/heads/master | 2020-04-15T08:27:03.066818 | 2019-01-09T22:48:18 | 2019-01-09T22:48:18 | 164,405,644 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 465 | java | package pojo.vo;
import model.UserCourse;
import pojo.BaseModelVO;
public class UserCourseVO extends UserCourse {
private BaseModelVO baseModel;
private String courseName;
public void setCourseName(String courseName) {
this.courseName = courseName;
}
public String getCourseName() {
return courseName;
}
public BaseModelVO getBaseModel() {
return baseModel;
}
public void setBaseModel(BaseModelVO baseModel) {
this.baseModel = baseModel;
}
} | [
"cpp@example.com"
] | cpp@example.com |
d52fed2b40f88455427ffdf09aa87247375013a2 | 491a9e6620413b043902540a1f69803999e3214c | /src/main/java/Test_MD5.java | 67824cd793486523c164b8b5d011972c76facba2 | [] | no_license | fc13240/openapi | 3e1002593a56fa3d6d69a79350a72d339623b51d | 721a35462bb3e8d8db94cb378bb6a3e9e5595226 | refs/heads/master | 2021-01-25T11:40:22.235910 | 2015-08-19T13:48:01 | 2015-08-19T13:48:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,610 | java |
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URI;
import java.net.URLEncoder;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.Map;
import com.letv.cdn.openapiauth.utils.LetvApiHelper;
/**
* TODO:add description of class here
*
* @author chenyuxin
* @createDate 2014年10月21日
*/
public class Test_MD5{
static String SRC = "http://dlsw.baidu.com/sw-search-sp/soft/b2/15892/BaiduMus45704.exe";
static String KEY = "acloudtest" + System.currentTimeMillis();
static String DOMAINTAG = "video10iotekclass0com";
//136098 7f769d6d82f2863b56e71177cb857b5c
static String USERID = "136098";//134388
static String SKEY = "7f769d6d82f2863b56e71177cb857b5c";
public static void main(String[] args) throws Exception {
getBase64();
}
public static void getBase64() {
String userid = "138866";
String method = "DELETE";
String uri = "/cdn/domain";
String appkey = "45a3e9d5a262f94b8521c6c90d915d23";
String md5 = MD5.md5(userid + method + uri + appkey);
String base64 = LetvApiHelper.encodeBase64(userid + ":" + md5);
System.out.println("Basic " + base64);
}
public static void postDomain() {
Map<String, String> map = new LinkedHashMap<String, String>();
map.put("user", "138866");
String sign = sign(map, "45a3e9d5a262f94b8521c6c90d915d23");
System.out.println(sign);
}
private static void getTraffic() {
Map<String, String> map = new LinkedHashMap<String, String>();
map.put("granularity", "5min");//134388
map.put("endday", "20141124");//134388
map.put("startday", "20141124");//134388q
map.put("userid", USERID);//134388
map.put("ver", "0.1");
map.put("sign", sign(map, "7f769d6d82f2863b56e71177cb857b5c"));
String uri = "http://openapi.letvcloud.com/cdn/domain/" + USERID + "_" + DOMAINTAG+ "/traffic";
getUrl(map, uri);
}
private static void getdomain() {
Map<String, String> map = new LinkedHashMap<String, String>();
map.put("userid", "136098");//134388
map.put("ver", "0.1");
map.put("sign", sign(map, "7f769d6d82f2863b56e71177cb857b5c"));
String uri = "http://openapi.letvcloud.com/cdn/domain/136098_wbdown0wn510com";
getUrl(map, uri);
}
private static void delfile() {
Map<String, String> map = new LinkedHashMap<String, String>();
map.put("src", SRC);
map.put("domaintag", DOMAINTAG);
map.put("key", KEY);
map.put("userid", USERID);
map.put("ver", "0.1");
map.put("sign", sign(map, SKEY));
String uri = "http://openapi.letvcloud.com/cdn/content/delfile";
getUrl(map, uri);
}
private static void getPostDomain() {
Map<String, String> map = new LinkedHashMap<String, String>();
map.put("domaintag", "letvcloudtest");
map.put("domain", "v.letvcloud.com");
map.put("source", "s.letvcloud.com");
map.put("remark", "test");
map.put("userid", "137587");
map.put("ver", "0.1");
String s = sign(map, "86a2b0487355b831fda63285fb06901e");
System.out.println(s);
}
private static void getContentSubFileUrl() throws Exception{
Map<String, String> map = new LinkedHashMap<String, String>();
map.put("domaintag", DOMAINTAG);
map.put("src", SRC);
/*File file = new File("C:\\Users\\chenyuxin\\Downloads\\apache-maven-3.2.3-bin.zip");
String fileMD5 = MD5.md5(file);*/
map.put("md5", "");
map.put("key", KEY);
map.put("userid", USERID);//134388
map.put("ver", "0.1");
map.put("sign", sign(map, SKEY));
// http://localhost:8084/ http://openapi.letvcloud.com/
String uri = "http://openapi.letvcloud.com/cdn/content/subfile";
getUrl(map, uri);
}
private static void getContentProgress() throws IOException {
Map<String, String> map = new LinkedHashMap<String, String>();
map.put("src", SRC);
map.put("key", KEY);
map.put("userid", USERID);
map.put("ver", "0.1");
map.put("sign", sign(map, SKEY));
String uri = "http://openapi.letvcloud.com/cdn/content/progress";
getUrl(map, uri);
}
private static void getOpenApiUrl() throws Exception{
//changba 102.10207 10 15c27aff929140ae3d16dc3b048ff135
//bilibili.com 2.203b100172 32 15c27aff929104ae3d16dc3b408ff136
//fenxiang1xia 102.miaopai 82 15c72aff818104ae3d16dc3b408ff136
Map<String, String> map = new LinkedHashMap<String, String>();
//map.put("domaintag", "102.miaopai");//域名
map.put("startday", "20141101");//起始日期 格式:yyyyMMdd
map.put("endday", "20141102");//结束日期
map.put("granularity", "day");//数据粒度 day、5min
map.put("userid", "134388");//用户id
map.put("ver", "1.0");
map.put("sign", sign(map, "042952a44457eeb7f6b9570ff436c3d6"));
String dynamic = map.get("userid") + "_" + "102.10207";
String uri = "http://openapi.letvcloud.com/cdn/domain/" + dynamic + "/traffic";
//String uri = "http://openapi.letvcloud.com/traffic";bandwidth
getUrl(map, uri);
}
private static void getReportUrl() throws Exception{
Map<String, String> map = new LinkedHashMap<String, String>();
//map.put("business", "102.10207");//域名
//map.put("business", "2.203b100172");
//map.put("business", "102.miaopai");
map.put("startTime", "2014-10-25");//起始日期 格式:yyyy-MM-dd
map.put("endTime", "2014-10-31");//结束日期
map.put("dataType", "min");//数据粒度
map.put("userid", "134388");//用户id
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
String now = sdf.format(new Date());
map.put("timeStamp", now);//时间戳
//String sign = getStringMD5String(now + "15c27aff929140ae3d16dc3b048ff135");
//String sign = getStringMD5String(now + "15c27aff929104ae3d16dc3b408ff136");
String sign = getStringMD5String(now + "042952a44457eeb7f6b9570ff436c3d6");
map.put("sign", sign);//MD5校验码
//String uri = "http://openapi.letvcloud.com/bandwidthAPI";
String uri = "http://openapi.letvcloud.com/trafficAPI";
getUrl(map, uri);
}
private static void getUrl(Map<String, String> map, String uri){
StringBuilder s = new StringBuilder();
for(Map.Entry<String, String> entry:map.entrySet()){
if(s.length() > 0){
s.append("&");
}
s.append(entry.getKey()).append("=").append(entry.getValue());
}
System.out.println("md5-----------------" + map.get("md5"));
System.out.println("sign----------------" + map.get("sign"));
System.out.println( uri + "?" + s.toString() );
}
private static char md5Chars[] =
{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd',
'e', 'f'};
private static MessageDigest messagedigest;
public static String getStringMD5String(String str) throws Exception {
messagedigest = MessageDigest.getInstance("MD5");
messagedigest.update(str.getBytes());
return bufferToHex(messagedigest.digest());
}
private static String bufferToHex(byte bytes[]) {
return bufferToHex(bytes, 0, bytes.length);
}
private static String bufferToHex(byte bytes[], int m, int n) {
StringBuffer stringbuffer = new StringBuffer(2 * n);
int k = m + n;
for (int l = m; l < k; l++) {
appendHexPair(bytes[l], stringbuffer);
}
return stringbuffer.toString();
}
private static void appendHexPair(byte bt, StringBuffer stringbuffer) {
char c0 = md5Chars[(bt & 0xf0) >> 4];
char c1 = md5Chars[bt & 0xf];
stringbuffer.append(c0);
stringbuffer.append(c1);
}
private static String sign(Map<String, String> m, String key) {
String[] names = m.keySet().toArray(new String[m.size()]);
Arrays.sort(names);
StringBuilder buf = new StringBuilder();
for (String name : names) {
buf.append(name);
buf.append(m.get(name));
}
buf.append(key);
return MD5.md5(buf.toString());
}
private static class MD5 {
private static char md5Chars[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
public static String md5(String str) {
MessageDigest md5 = getMD5Instance();
md5.update(str.getBytes());
byte[] digest = md5.digest();
char[] chars = toHexChars(digest);
return new String(chars);
}
public static String md5(File file) throws IOException{
//File file = new File(filePath);
FileInputStream in = new FileInputStream(file);
FileChannel ch = in.getChannel();
MappedByteBuffer byteBuffer = ch.map(FileChannel.MapMode.READ_ONLY, 0, file.length());
MessageDigest md5 = getMD5Instance();
md5.update(byteBuffer);
byte[] digest = md5.digest();
char[] chars = toHexChars(digest);
return new String(chars);
}
private static MessageDigest getMD5Instance() {
try {
return MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException ignored) {
throw new RuntimeException(ignored);
}
}
private static char[] toHexChars(byte[] digest) {
char[] chars = new char[digest.length * 2];
int i = 0;
for (byte b : digest) {
char c0 = md5Chars[(b & 0xf0) >> 4];
chars[i++] = c0;
char c1 = md5Chars[b & 0xf];
chars[i++] = c1;
}
return chars;
}
}
}
| [
"liufeng_king@126.com"
] | liufeng_king@126.com |
842ab273a9d0f904a5760fb2226f7319d632d395 | c26b877bb4bad3abd105616c96e2c12818191983 | /driver-core/src/test/java/com/datastax/driver/core/TableMetadataCDCTest.java | 76faa1394d7674287580ec48ca73da555da49c33 | [
"Apache-2.0"
] | permissive | collinsauve/java-driver | 40f947130010b2a38ce64a9772c1eb65eee6fbd1 | 52521a21c9c8951721ffebd449b15987c084ed80 | refs/heads/3.x | 2021-01-01T19:48:48.248515 | 2017-07-25T13:33:34 | 2017-07-25T13:33:34 | 98,694,990 | 1 | 0 | null | 2017-07-28T23:19:38 | 2017-07-28T23:19:38 | null | UTF-8 | Java | false | false | 2,053 | java | /*
* Copyright (C) 2012-2017 DataStax Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.datastax.driver.core;
import com.datastax.driver.core.utils.CassandraVersion;
import org.testng.annotations.Test;
import static org.assertj.core.api.Assertions.assertThat;
@CCMConfig(config = "cdc_enabled:true")
@CassandraVersion(value = "3.8", description = "Requires CASSANDRA-12041 added in 3.8")
public class TableMetadataCDCTest extends CCMTestsSupport {
/**
* Ensures that if a table is configured with change data capture enabled that
* {@link TableOptionsMetadata#isCDC()} returns true for that table.
*
* @test_category metadata
* @jira_ticket JAVA-1287
* @jira_ticket CASSANDRA-12041
*/
@Test(groups = "short")
public void should_parse_cdc_from_table_options() {
// given
// create a simple table with cdc as true.
String cql = String.format("CREATE TABLE %s.cdc_table (\n"
+ " k text,\n"
+ " c int,\n"
+ " v timeuuid,\n"
+ " PRIMARY KEY (k, c)\n"
+ ") WITH cdc=true;", keyspace);
session().execute(cql);
// when retrieving the table's metadata.
TableMetadata table = cluster().getMetadata().getKeyspace(keyspace).getTable("cdc_table");
// then the table's options should have cdc as true.
assertThat(table.getOptions().isCDC()).isEqualTo(true);
assertThat(table.asCQLQuery(true)).contains("cdc = true");
}
}
| [
"alexandre.dutra@datastax.com"
] | alexandre.dutra@datastax.com |
3d1dbe0282f3209bb1e619a579e022549558c9f6 | d0c6d62af1f7f47631223d76137a0e365120b548 | /CapstoneProject-main/capstoneProject/src/main/java/com/capstone/project/controllers/RecipeController.java | 37c737ed3665e4df54652fbc38609788e3e8673e | [] | no_license | nikolaVojinovic7/RecipeGeneratingApp | e260a316de084aa6e32f46c70c713776446f09d0 | 3f1ff7337baf5214ff096c86d41d7636ddae3ba7 | refs/heads/main | 2023-04-07T20:47:50.213214 | 2021-04-07T03:35:44 | 2021-04-07T03:35:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,199 | java | package com.capstone.project.controllers;
import com.capstone.project.exception.ResourceNotFoundException;
import com.capstone.project.model.*;
import com.capstone.project.services.IngredientService;
import com.capstone.project.services.RecipeService;
import com.capstone.project.services.UserService;
import org.springframework.web.bind.annotation.*;
import java.util.*;
@RestController
@RequestMapping("api/recipe")
public class RecipeController {
private final RecipeService recipeService;
private final IngredientService ingredientService;
private final UserService userService;
public RecipeController(RecipeService recipeService, IngredientService ingredientService, UserService userService) {
this.recipeService = recipeService;
this.ingredientService = ingredientService;
this.userService = userService;
}
//get all recipes api
@GetMapping("allRecipes")
public Set<Recipe> allRecipes(){
return this.recipeService.findAll();
}
//add ingredient to recipe
@GetMapping("addIngredientToRecipe/{recipe}&{ingredient}")
public Recipe addIngredientToRecipe(@PathVariable RecipeToIngredient ingredient, @PathVariable Recipe recipe){
return this.recipeService.addIngredientToRecipe(ingredient, recipe);
}
//tie ingredient to recipe and add the weights and measurements
@PutMapping("/tieIngredientToRecipe/{recipeId}&{ingredientId}")
public Recipe updateRecipe(@RequestBody RecipeToIngredient ingredientRecipe, @PathVariable long ingredientId, @PathVariable long recipeId) {
Recipe recipe = recipeService.findById(recipeId);
if(recipe == null){
throw new ResourceNotFoundException("There is no recipe with id" + recipeId);
}
Ingredient ingredient = ingredientService.findById(ingredientId);
if(ingredient == null){
throw new ResourceNotFoundException("There is no ingredient with id" + ingredientId);
}
ingredientRecipe.setIngredient(ingredient);
recipe.addIngredientItem(ingredientRecipe);
return recipeService.save(recipe);
}
//find recipes by pantry
private static boolean contains(Set<Pantry> list, RecipeToIngredient i) {
for (Pantry e : list) {
if (e.getIngredient().getName().equals(i.getIngredient().getName())) return true;
}
return false;
}
@GetMapping("searchRecipeByPantry/{email}")
public Set<Recipe> searchRecipeByPantry(@PathVariable String email) {
Set<Recipe> recipeSet = recipeService.findAll();
User user = userService.findByEmail(email);
Set<Pantry> pantrySet = user.getPantryIngredients();
Set<Recipe> finalRecipeSet = new HashSet<>();
boolean ingredientsPresent= true;
for (Recipe recipe : recipeSet) {
Set<RecipeToIngredient> recipeToIngredients = recipe.getRecipeToIngredients();
for (RecipeToIngredient recipeIngredient : recipeToIngredients){
System.out.println(!contains(pantrySet, recipeIngredient));
if (!contains(pantrySet, recipeIngredient)){
ingredientsPresent = false;
}
}
System.out.println("value: " + ingredientsPresent );
System.out.println("===========================");
if (ingredientsPresent) {
finalRecipeSet.add(recipe);
}
else{
ingredientsPresent = true;
}
}
return finalRecipeSet;
}
//get all pantry ingredients by email api
@GetMapping("allRecipeToIngredient/{recipeId}")
public Set<RecipeToIngredient> allIngredientsLinked(@PathVariable long recipeId){
Recipe recipe = recipeService.findById(recipeId);
return recipe.getRecipeToIngredients();
}
// get recipe by id rest api
@GetMapping("/getRecipe/{id}")
public Recipe getRecipeById(@PathVariable Long id) {
Recipe recipe = recipeService.findById(id);
if(recipe == null){
throw new ResourceNotFoundException("There is no recipe with id" + id);
}
return recipe;
}
// get recipe by name/title rest api
@GetMapping("/getRecipeByName/{name}")
public Recipe getRecipeByName(@PathVariable String name) {
Recipe recipe = recipeService.findByName(name);
if(recipe == null){
throw new ResourceNotFoundException("There is no recipe with name" + name);
}
return recipe;
}
// get set of recipe by name/title rest api
@GetMapping("/getSetRecipeByName/{name}")
public Set<Recipe> getAllRecipeByName(@PathVariable String name) {
Set<Recipe> recipes = recipeService.findAllByName(name);
if(recipes == null){
throw new ResourceNotFoundException("There are no recipes with name" + name);
}
return recipes;
}
// create recipe rest api
@PostMapping("/createRecipe")
public Recipe createRecipe(@RequestBody Recipe recipe) {
return recipeService.save(recipe);
}
// update employee rest api
@PutMapping("/updateRecipe/{id}")
public Recipe updateRecipe(@PathVariable Long id, @RequestBody Recipe recipeDetails) {
Recipe recipe = recipeService.findById(id);
if(recipe == null){
throw new ResourceNotFoundException("There is no recipe with id" + id);
}
recipe.setCookTime(recipeDetails.getCookTime());
recipe.setDirections(recipeDetails.getDirections());
recipe.setImageUrl(recipeDetails.getImageUrl());
recipe.setLevel(recipeDetails.getLevel());
recipe.setPrepTime(recipeDetails.getPrepTime());
recipe.setName(recipeDetails.getName());
recipe.setServings(recipeDetails.getServings());
recipe.setTotalTime(recipeDetails.getTotalTime());
return recipeService.save(recipe);
}
// delete employee rest api
@DeleteMapping("/deleteRecipe/{id}")
public Map< String, Boolean > deleteRecipe(@PathVariable Long id) {
Recipe recipe = recipeService.findById(id);
if(recipe == null){
throw new ResourceNotFoundException("There is no recipe with id" + id);
}
recipeService.delete(recipe);
Map < String, Boolean > response = new HashMap< >();
response.put("deleted", Boolean.TRUE);
return response;
}
@GetMapping("searchThreeIngredients/{email}")
public String[] searchThreeIngredients(@PathVariable String email){
User user = userService.findByEmail(email);
Set<Pantry> pantrySet = user.getPantryIngredients();
String[] ing = new String[3];
int num = 0;
for(Pantry pantry:pantrySet){
if(num == 3){
break;
} else{
ing[num] = pantry.getIngredient().getName();
}
num++;
} return ing; }
//get all pantry ingredients by email api
@GetMapping("searchRecipesBasedOnIngredient/{email}&{pantryIng}")
public Set<Recipe> searchRecipesBasedOnIngredient(@PathVariable String email, @PathVariable String pantryIng){
Set<Recipe> recipeSet = recipeService.findAll();
User user = userService.findByEmail(email);
Set<Pantry> pantrySet = user.getPantryIngredients();
Set<Recipe> finalRecipeSet = new HashSet<>();
for (Recipe recipe:recipeSet) {
Set<RecipeToIngredient> recipeToIngredients = recipe.getRecipeToIngredients();
for (RecipeToIngredient recipeIngredient : recipeToIngredients) {
String ingredientName = recipeIngredient.getIngredient().getName();
if(pantryIng.equals(ingredientName)){
finalRecipeSet.add(recipe);
break;
}
}
}
return finalRecipeSet; }
}
| [
"noreply@github.com"
] | nikolaVojinovic7.noreply@github.com |
69261fb00648105a6add2ed2e6657d3ed124a7d0 | 4b03761b965714f72d7824615d8229d3a178b3d3 | /@record/bak/mybatis/src/main/java/com/unionlive/util/Validation.java | 33a3053ed9bc371a4ad45ece68235a3fe99da0d1 | [] | no_license | zingson/zengs-javaee | 209a2ed7bb0d502ddbf2ee04f04dc3af2afd682a | 7e8bc2f40dc9223f223b3b32e41aede944b88f15 | refs/heads/master | 2021-01-25T04:49:08.511893 | 2017-06-12T03:54:39 | 2017-06-12T03:54:39 | 93,486,340 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,802 | java | package com.unionlive.util;
import java.math.BigDecimal;
import java.util.regex.Pattern;
/**
* 字段效验工具类
*/
public class Validation {
/**
* 是否为空
* @param args N个参数,有一个为null则返回false
* @return 为null "" 时返回true 否则返回false
*/
public static boolean isEmpty(Object... args){
for (Object str:args){
if(str==null||"".equals(String.valueOf(str).trim())||"null".equals(String.valueOf(str).trim())||"NULL".equals(String.valueOf(str).trim())){
return true;
}
}
return false;
}
public static boolean isNotEmpty(Object... args){
return !isEmpty(args);
}
/**
* 非数字返回-1,否则返回int
* @param arg
* @return
*/
public static Integer isNumber(Object arg){
try {
return Integer.parseInt(String.valueOf(arg).trim());
} catch (NumberFormatException e) {
}
return null;
}
public static boolean isNumber(Object... args){
boolean f = true;
try {
for (Object str:args){
if(str!=null){
String arg = String.valueOf(str).trim();
Integer.parseInt(arg);
}
}
} catch (NumberFormatException e) {
f = false;
}
return f;
}
/**
* 比较大小 arg1<arg2
* @param arg1
* @param arg2
* @return -1, 0, or 1 as this {@code BigDecimal} is numerically
* less than, equal to, or greater than {@code val}.
*/
public static int compareTo(Object arg1,Object arg2){
return new BigDecimal(String.valueOf(arg1)).compareTo(new BigDecimal(String.valueOf(arg2)));
}
/**
* 校验手机号
*
* @param mobile
* @return 校验通过返回true,否则返回false
*/
public static boolean isMobile(Object mobile) {
return mobile!=null&&Pattern.matches("^(1[0-9])\\d{9}$", String.valueOf(mobile));
}
/**
* 隐藏手机号码中间4位
* @param mobile
* @return
*/
public static String mobile4Hide(String mobile){
return mobile.substring(0,3) + "****" + mobile.substring(7);
}
/**
* 校验邮箱
*
* @param email
* @return 校验通过返回true,否则返回false
*/
public static boolean isEmail(String email) {
return Pattern.matches("^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$", email);
}
/**
* 校验汉字
*
* @param chinese
* @return 校验通过返回true,否则返回false
*/
public static boolean isChinese(String chinese) {
return Pattern.matches("^[\u4e00-\u9fa5],{0,}$", chinese);
}
/**
* 校验身份证
*
* @param idCard
* @return 校验通过返回true,否则返回false
*/
public static boolean isIDCard(String idCard) {
return Pattern.matches("(^\\d{18}$)|(^\\d{15}$)", idCard);
}
/**
* 校验URL
*
* @param url
* @return 校验通过返回true,否则返回false
*/
public static boolean isUrl(String url) {
return Pattern.matches("http(s)?://([\\w-]+\\.)+[\\w-]+(/[\\w -./?%&=]*)?", url);
}
/**
* 校验IP地址
*
* @param ipAddr
* @return
*/
public static boolean isIPAddr(String ipAddr) {
return Pattern.matches("(25[0-5]|2[0-4]\\d|[0-1]\\d{2}|[1-9]?\\d)", ipAddr);
}
/*public static void main(String[] args) {
String username = "fdsdfsdj";
//System.out.println(Validator.isUsername(username));
//System.out.println(Validator.isChinese(username));
}*/
}
| [
"916931772@qq.com"
] | 916931772@qq.com |
66350b563cbb4c0fb34f244b6f3d6f9b213a9fda | 152cac0c03ad667e2c63eda0eed17e61d2d817c3 | /Java-OOP/src/com/Roger/rpg/Warrior.java | 85c2bd860081d5cc543e5847c045338a1fd07020 | [] | no_license | 474020609/repository1 | 262e57229f18ab3471dee4142ceb29cdde639924 | 5dd7a678addaa2e93233fc779333bbcd09d21f72 | refs/heads/master | 2020-04-03T19:09:56.755804 | 2018-10-31T07:01:22 | 2018-10-31T07:01:22 | 155,512,671 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 559 | java | package com.Roger.rpg;
public class Warrior extends Adventurer{
public Warrior() {
this.setHp(240);
this.setAttack(25);
}
public void selfIntroduction() {
System.out.println("大家好,我是一名正在冒险的年轻人,我已经是一名战士了,我的血有:"+this.getHp()+"我的攻击力有:"+this.getAttack());
}
public int attack() {
System.out.println("冒险家还剩"+this.getHp()+"血,他大喊一声:十字斩!造成了"+this.getAttack()+"点伤害");
return this.getAttack();
}
}
| [
"474020609@qq.com"
] | 474020609@qq.com |
6e68210eae6eb5a0decae58137f531c089e434f4 | 1c110e562561dd1c880658a4af7e9572779f719c | /alarm/Alarm.java | 4cd54587ad45f53e3af324640b9b2d737ace1c7f | [] | no_license | allicen/Java-1000 | f871112959de872ccf798e18b42a486bf82d557a | 614c2af783aa651aed2d996bdb3cfd18c1c6fc03 | refs/heads/master | 2023-08-16T19:39:56.066355 | 2022-08-23T18:29:37 | 2022-08-23T18:29:37 | 191,978,827 | 202 | 71 | null | 2023-08-13T16:38:33 | 2019-06-14T17:00:05 | Java | UTF-8 | Java | false | false | 883 | java | package alarm;
import java.io.*;
import java.util.*;
public class Alarm {
public static void main(String[] args) throws IOException {
ArrayList<Integer> time = new ArrayList<>();
int result;
String str;
FileReader file = new FileReader("input.txt"); // Считывание данных из файла
Scanner sc = new Scanner(file);
str = sc.nextLine();
StringTokenizer st = new StringTokenizer(str, " ");
while (st.hasMoreTokens()){
time.add(Integer.valueOf(st.nextToken())); // Записать все элементы в коллекцию
}
result = (time.get(1) > time.get(0)) ? time.get(1) - time.get(0) : 12 + time.get(1) - time.get(0);
FileWriter fileOut = new FileWriter("output.txt");
fileOut.write(String.valueOf(result));
fileOut.close();
}
}
| [
"ellena.hella@yandex.ru"
] | ellena.hella@yandex.ru |
4d5daefc205478249f08501f0f78553fc429df2d | 2747bd2066ee41fc095949888c3a821c8a21706e | /app/src/main/java/com/example/lsh/cycleclubapp/loginActivity.java | 82e2756ed7ae1e6bd0967b1180fc061f9c8bbbd9 | [] | no_license | Masanghyeon/cycleclub-app | e4b8c66d8638a2cda9c2708935c102304144c90a | 35b91cc4102ace46e3bbe3c75a83bf641c12ec7a | refs/heads/master | 2020-04-02T20:53:45.058303 | 2016-06-14T04:02:33 | 2016-06-14T04:02:33 | 61,090,433 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,151 | java | package com.example.lsh.cycleclubapp;
import android.content.Intent;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
public class loginActivity extends ActionBarActivity {
Button joinButton,loginButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
joinButton = (Button) findViewById(R.id.joinButton);
loginButton = (Button) findViewById(R.id.loginButton);
joinButton.setOnClickListener(listener);
loginButton.setOnClickListener(listener);
}
Button.OnClickListener listener = new Button.OnClickListener() {
Intent intent;
@Override
public void onClick(View v) {
switch (v.getId()){
case R.id.joinButton:
intent = new Intent(loginActivity.this,joinActivity.class);
startActivity(intent);
finish();
break;
case R.id.loginButton:
intent = new Intent(loginActivity.this,MainActivity.class);
startActivity(intent);
finish();
break;
}
}
};
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_login, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
| [
"hoozzang4027@gmail.com"
] | hoozzang4027@gmail.com |
49e78cae7c51a862345951fc3ee3efacf3c3ca02 | e9814144d06806fe1456e6326538b8d132933f0a | /demos/java300/GOF23/BehaviorMode/TemplateMethodMode/Example.java | 87425c02e3bf2ea810224c82b54928134709f5a7 | [] | no_license | oudream/hello-java | e64102923e2795505b58e3291338c3188d4768a7 | 9766c65e7a2ae81fde7edb05cf01a82b102922d6 | refs/heads/master | 2021-08-15T01:58:27.785384 | 2021-08-08T05:12:22 | 2021-08-08T05:12:22 | 228,291,829 | 1 | 0 | null | 2020-10-14T00:14:51 | 2019-12-16T03:05:30 | Java | UTF-8 | Java | false | false | 278 | java | package GOF23.BehaviorMode.TemplateMethodMode;
/**
* 说明:实例化方法
*
* @Auther: 11432_000
* @Date: 2019/1/29 14:40
* @Description:
*/
public class Example extends Tempalte{
@Override
public void second() {
System.out.println("冲茶");
}
}
| [
"oudream@126.com"
] | oudream@126.com |
7225cca4e8f6b9674c3f26e9720ad70633870596 | 52eb55e4b1253d9246b581249a4d338fcd2df075 | /org.mbari.kb.core/src/main/java/org/mbari/kb/core/VARSPersistenceException.java | fe6034baa681beee6bda3a7b4da5e29d60fae529 | [
"Apache-2.0"
] | permissive | mbari-media-management/vars-kb | fa8fe56fcd435910528bd76e27be8411ba33dd5b | bc487bb7e10e5d792e7d900f1fdc7588741a6830 | refs/heads/master | 2023-02-20T15:23:33.226887 | 2023-02-14T22:13:53 | 2023-02-14T22:13:53 | 90,171,500 | 0 | 0 | null | 2017-05-03T16:43:00 | 2017-05-03T16:43:00 | null | UTF-8 | Java | false | false | 603 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.mbari.kb.core;
/**
* Thrown when something bad happens in the DataPersistenceService
* @author brian
*/
public class VARSPersistenceException extends VARSException {
public VARSPersistenceException(Throwable throwable) {
super(throwable);
}
public VARSPersistenceException(String s, Throwable throwable) {
super(s, throwable);
}
public VARSPersistenceException(String s) {
super(s);
}
public VARSPersistenceException() {
}
}
| [
"bschlining@gmail.com"
] | bschlining@gmail.com |
46dc070413beb97bc29438746b9ed38f2a809888 | 26aee455f313d69c763f4b2c73072279ce31373f | /demo-jartest/src/main/java/com/dhjt/JarTest/pdfBox/SigUtils.java | 8f27abddffc421175d79011b05e2e587f507d7b2 | [] | no_license | DHJT/java-demos | 508d46691a5508d4f133463df9c4e55cbeb48460 | 12abc165dd6bd3eefbd626ae9bb5e7efc2b91961 | refs/heads/master | 2022-12-11T03:48:50.136797 | 2019-04-15T15:17:59 | 2019-04-15T15:17:59 | 131,725,878 | 0 | 0 | null | 2022-11-16T03:20:52 | 2018-05-01T14:56:44 | Java | UTF-8 | Java | false | false | 5,494 | java | /*
* Copyright 2017 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.
*/
package com.dhjt.JarTest.pdfBox;
import org.apache.pdfbox.cos.COSArray;
import org.apache.pdfbox.cos.COSBase;
import org.apache.pdfbox.cos.COSDictionary;
import org.apache.pdfbox.cos.COSName;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.interactive.digitalsignature.PDSignature;
/**
* Utility class for the signature / timestamp examples.
*
* @author Tilman Hausherr
*/
public class SigUtils
{
private SigUtils()
{
}
/**
* Get the access permissions granted for this document in the DocMDP transform parameters
* dictionary. Details are described in the table "Entries in the DocMDP transform parameters
* dictionary" in the PDF specification.
*
* @param doc document.
* @return the permission value. 0 means no DocMDP transform parameters dictionary exists. Other
* return values are 1, 2 or 3. 2 is also returned if the DocMDP transform parameters dictionary
* is found but did not contain a /P entry, or if the value is outside the valid range.
*/
public static int getMDPPermission(PDDocument doc)
{
COSBase base = doc.getDocumentCatalog().getCOSObject().getDictionaryObject(COSName.PERMS);
if (base instanceof COSDictionary)
{
COSDictionary permsDict = (COSDictionary) base;
base = permsDict.getDictionaryObject(COSName.DOCMDP);
if (base instanceof COSDictionary)
{
COSDictionary signatureDict = (COSDictionary) base;
base = signatureDict.getDictionaryObject("Reference");
if (base instanceof COSArray)
{
COSArray refArray = (COSArray) base;
for (int i = 0; i < refArray.size(); ++i)
{
base = refArray.getObject(i);
if (base instanceof COSDictionary)
{
COSDictionary sigRefDict = (COSDictionary) base;
if (COSName.DOCMDP.equals(sigRefDict.getDictionaryObject("TransformMethod")))
{
base = sigRefDict.getDictionaryObject("TransformParams");
if (base instanceof COSDictionary)
{
COSDictionary transformDict = (COSDictionary) base;
int accessPermissions = transformDict.getInt(COSName.P, 2);
if (accessPermissions < 1 || accessPermissions > 3)
{
accessPermissions = 2;
}
return accessPermissions;
}
}
}
}
}
}
}
return 0;
}
/**
* Set the access permissions granted for this document in the DocMDP transform parameters
* dictionary. Details are described in the table "Entries in the DocMDP transform parameters
* dictionary" in the PDF specification.
*
* @param doc The document.
* @param signature The signature object.
* @param accessPermissions The permission value (1, 2 or 3).
*/
static public void setMDPPermission(PDDocument doc, PDSignature signature, int accessPermissions)
{
COSDictionary sigDict = signature.getCOSObject();
// DocMDP specific stuff
COSDictionary transformParameters = new COSDictionary();
transformParameters.setItem(COSName.TYPE, COSName.getPDFName("TransformParams"));
transformParameters.setInt(COSName.P, accessPermissions);
transformParameters.setName(COSName.V, "1.2");
transformParameters.setNeedToBeUpdated(true);
COSDictionary referenceDict = new COSDictionary();
referenceDict.setItem(COSName.TYPE, COSName.getPDFName("SigRef"));
referenceDict.setItem("TransformMethod", COSName.DOCMDP);
referenceDict.setItem("DigestMethod", COSName.getPDFName("SHA1"));
referenceDict.setItem("TransformParams", transformParameters);
referenceDict.setNeedToBeUpdated(true);
COSArray referenceArray = new COSArray();
referenceArray.add(referenceDict);
sigDict.setItem("Reference", referenceArray);
referenceArray.setNeedToBeUpdated(true);
// Catalog
COSDictionary catalogDict = doc.getDocumentCatalog().getCOSObject();
COSDictionary permsDict = new COSDictionary();
catalogDict.setItem(COSName.PERMS, permsDict);
permsDict.setItem(COSName.DOCMDP, signature);
catalogDict.setNeedToBeUpdated(true);
permsDict.setNeedToBeUpdated(true);
}
}
| [
"dhjt11@qq.com"
] | dhjt11@qq.com |
3c8524cfccfac9262758910c893c80db3d913453 | fc54ba9bf692830573bd599ccea6404b98a84aa9 | /2.JavaCore/src/com/codegym/task/task14/task1408/Solution.java | dbc7713a60afa539f866efe67163aab4428ecb40 | [] | no_license | khal-alexa/CodeGymTasks | eddad25e98a55fd4bf86ff5926fe313e53555b61 | 0709928f74f6b9cc1de326af509271515e856bd1 | refs/heads/master | 2020-06-02T16:08:09.763281 | 2020-02-17T12:22:48 | 2020-02-17T12:22:48 | 241,100,005 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 769 | java | package com.codegym.task.task14.task1408;
/*
Chicken factory
*/
public class Solution {
public static void main(String[] args) {
Hen hen = HenFactory.getHen(Continent.AFRICA);
hen.getMonthlyEggCount();
}
static class HenFactory {
static Hen getHen(String continent) {
Hen hen = null;
if (continent.equals("North America")) {
hen = new NorthAmericanHen();
} else if (continent.equals("Europe")) {
hen = new EuropeanHen();
} else if (continent.equals("Asia")) {
hen = new AsianHen();
} else if (continent.equals("Africa")) {
hen = new AfricanHen();
}
return hen;
}
}
}
| [
"oleksandra.khalaim@gmail.com"
] | oleksandra.khalaim@gmail.com |
4c68086669b6d361a6160cf3b9d04129e68a47a1 | 427d2e970212f345eaccba4a58db47e6a8f3c9e3 | /src/test/java/com/intetics/test/service/impl/aggregator/ParsingStringAggregator.java | e563540dd554a3c0edb9255c590f3b10425afef9 | [] | no_license | DVelichkevichFL/test09032020 | 37961fb4956b70b6e4469afcfb0eab270dfbf45e | bd79a5c1d010217c2a7c586ae4e74579ad4f4a01 | refs/heads/master | 2022-12-07T18:05:37.375976 | 2020-09-08T04:04:11 | 2020-09-08T04:04:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 905 | java | package com.intetics.test.service.impl.aggregator;
import org.junit.jupiter.api.extension.ParameterContext;
import org.junit.jupiter.params.aggregator.ArgumentsAccessor;
import org.junit.jupiter.params.aggregator.ArgumentsAggregationException;
import org.junit.jupiter.params.aggregator.ArgumentsAggregator;
/**
* Revision Info : $Author$ $Date$
* Author : d.velichkevich
* Created : 09/08/2020 1:40
*
* @author d.velichkevich
*/
public class ParsingStringAggregator implements ArgumentsAggregator {
private static final String SYMBOL_LINES_DELIMITER = ";";
@Override
public Object aggregateArguments(ArgumentsAccessor argumentsAccessor, ParameterContext parameterContext) throws ArgumentsAggregationException {
String result = argumentsAccessor.getString(parameterContext.getIndex());
return result.replace(SYMBOL_LINES_DELIMITER, System.lineSeparator());
}
}
| [
"d.velichkevich@intetics.com"
] | d.velichkevich@intetics.com |
e4e4a325564ea41da8e499ad73b9d47a7a96cb46 | 8fa4986aba42a9000f1082fe1ae258e93be438f3 | /src/test/java/todo/app/TodoAppApplicationTests.java | d6baba0800911309406cbe832a657793ba03e8ca | [] | no_license | tdquyen1999/todoapp | c4e98627030ceac15c653dd682ec3bb22bf30651 | 505993bc0aeab500e2cabe050d420de3c2672bfb | refs/heads/master | 2022-12-03T14:26:13.432047 | 2020-08-26T03:37:03 | 2020-08-26T03:37:03 | 288,970,741 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 210 | java | package todo.app;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class TodoAppApplicationTests {
@Test
void contextLoads() {
}
}
| [
"tdquyen1999@gmail.com"
] | tdquyen1999@gmail.com |
1f3b7fcb3e411696f7da0d4b3e77aa4697619c98 | 822b95c02b13ed5465c69404e5c1d169af6383fb | /src/main/java/com/mq/controller/DashboardController.java | 841a0d0e073294962d5d6aa7552cc5b03b4344f6 | [] | no_license | unknown7/mq | ee6fec0f13ce770f493b0268aa34e7cdee7ba3f4 | 9c067a69a394102d38ca9c45b19fb8ee90d6cae6 | refs/heads/master | 2022-06-22T20:47:05.220806 | 2021-05-18T06:27:04 | 2021-05-18T06:27:04 | 172,713,042 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 292 | java | package com.mq.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class DashboardController {
@RequestMapping("/dashboard")
public String dashboard() {
return "dashboard";
}
}
| [
"unknown7@live.cn"
] | unknown7@live.cn |
b0541eee20f5b6cc7af4011d1ecfc3ec96b3b6f2 | bb8e4db3c59a2747ddb423c8bedc52a46031cbdb | /src/gebos/app/reports/src/reporte_financiamiento/cuadro_resumen_de_financiamiento_1176242790790_159985.java | 00afa3facb77fb0daec28d2fc7a903f35aed7ffa | [] | no_license | dbertaso/centaurocc | 6144c5baa2c88f59674856b68a04dd222ab8b1c9 | 34fa7fa88c07e13594db70cacdc7e535542d23b7 | refs/heads/main | 2023-06-13T08:56:29.745961 | 2021-07-13T03:21:04 | 2021-07-13T03:21:04 | 383,255,851 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,638 | java | /*
* Generated by JasperReports - 4/10/07 6:06 PM
*/
import net.sf.jasperreports.engine.*;
import net.sf.jasperreports.engine.fill.*;
import java.util.*;
import java.math.*;
import java.text.*;
import java.io.*;
import java.net.*;
import java.util.*;
import net.sf.jasperreports.engine.*;
import net.sf.jasperreports.engine.data.*;
/**
*
*/
public class cuadro_resumen_de_financiamiento_1176242790790_159985 extends JREvaluator
{
/**
*
*/
private JRFillParameter parameter_REPORT_RESOURCE_BUNDLE = null;
private JRFillParameter parameter_REPORT_DATE_FORMAT_FACTORY = null;
private JRFillParameter parameter_REPORT_CLASS_LOADER = null;
private JRFillParameter parameter_REPORT_TIME_ZONE = null;
private JRFillParameter parameter_REPORT_DATA_SOURCE = null;
private JRFillParameter parameter_REPORT_LOCALE = null;
private JRFillParameter parameter_REPORT_URL_HANDLER_FACTORY = null;
private JRFillParameter parameter_REPORT_PARAMETERS_MAP = null;
private JRFillParameter parameter_REPORT_CONNECTION = null;
private JRFillParameter parameter_IS_IGNORE_PAGINATION = null;
private JRFillParameter parameter_REPORT_VIRTUALIZER = null;
private JRFillParameter parameter_REPORT_SCRIPTLET = null;
private JRFillParameter parameter_REPORT_MAX_COUNT = null;
private JRFillField field_monto = null;
private JRFillField field_pago_cliente_id = null;
private JRFillField field_prestamo_modificacion_id = null;
private JRFillField field_fecha_contable = null;
private JRFillField field_id = null;
private JRFillField field_fecha_realizacion = null;
private JRFillField field_tipo = null;
private JRFillField field_fecha = null;
private JRFillField field_proceso_nocturno = null;
private JRFillField field_numero = null;
private JRFillField field_prestamo_modifcacion_id = null;
private JRFillField field_prestamo_id = null;
private JRFillField field_desembolso_id = null;
private JRFillVariable variable_PAGE_NUMBER = null;
private JRFillVariable variable_COLUMN_NUMBER = null;
private JRFillVariable variable_REPORT_COUNT = null;
private JRFillVariable variable_PAGE_COUNT = null;
private JRFillVariable variable_COLUMN_COUNT = null;
/**
*
*/
public void customizedInit(
Map pm,
Map fm,
Map vm
)
{
initParams(pm);
initFields(fm);
initVars(vm);
}
/**
*
*/
private void initParams(Map pm)
{
parameter_REPORT_RESOURCE_BUNDLE = (JRFillParameter)pm.get("REPORT_RESOURCE_BUNDLE");
parameter_REPORT_DATE_FORMAT_FACTORY = (JRFillParameter)pm.get("REPORT_DATE_FORMAT_FACTORY");
parameter_REPORT_CLASS_LOADER = (JRFillParameter)pm.get("REPORT_CLASS_LOADER");
parameter_REPORT_TIME_ZONE = (JRFillParameter)pm.get("REPORT_TIME_ZONE");
parameter_REPORT_DATA_SOURCE = (JRFillParameter)pm.get("REPORT_DATA_SOURCE");
parameter_REPORT_LOCALE = (JRFillParameter)pm.get("REPORT_LOCALE");
parameter_REPORT_URL_HANDLER_FACTORY = (JRFillParameter)pm.get("REPORT_URL_HANDLER_FACTORY");
parameter_REPORT_PARAMETERS_MAP = (JRFillParameter)pm.get("REPORT_PARAMETERS_MAP");
parameter_REPORT_CONNECTION = (JRFillParameter)pm.get("REPORT_CONNECTION");
parameter_IS_IGNORE_PAGINATION = (JRFillParameter)pm.get("IS_IGNORE_PAGINATION");
parameter_REPORT_VIRTUALIZER = (JRFillParameter)pm.get("REPORT_VIRTUALIZER");
parameter_REPORT_SCRIPTLET = (JRFillParameter)pm.get("REPORT_SCRIPTLET");
parameter_REPORT_MAX_COUNT = (JRFillParameter)pm.get("REPORT_MAX_COUNT");
}
/**
*
*/
private void initFields(Map fm)
{
field_monto = (JRFillField)fm.get("monto");
field_pago_cliente_id = (JRFillField)fm.get("pago_cliente_id");
field_prestamo_modificacion_id = (JRFillField)fm.get("prestamo_modificacion_id");
field_fecha_contable = (JRFillField)fm.get("fecha_contable");
field_id = (JRFillField)fm.get("id");
field_fecha_realizacion = (JRFillField)fm.get("fecha_realizacion");
field_tipo = (JRFillField)fm.get("tipo");
field_fecha = (JRFillField)fm.get("fecha");
field_proceso_nocturno = (JRFillField)fm.get("proceso_nocturno");
field_numero = (JRFillField)fm.get("numero");
field_prestamo_modifcacion_id = (JRFillField)fm.get("prestamo_modifcacion_id");
field_prestamo_id = (JRFillField)fm.get("prestamo_id");
field_desembolso_id = (JRFillField)fm.get("desembolso_id");
}
/**
*
*/
private void initVars(Map vm)
{
variable_PAGE_NUMBER = (JRFillVariable)vm.get("PAGE_NUMBER");
variable_COLUMN_NUMBER = (JRFillVariable)vm.get("COLUMN_NUMBER");
variable_REPORT_COUNT = (JRFillVariable)vm.get("REPORT_COUNT");
variable_PAGE_COUNT = (JRFillVariable)vm.get("PAGE_COUNT");
variable_COLUMN_COUNT = (JRFillVariable)vm.get("COLUMN_COUNT");
}
/**
*
*/
public Object evaluate(int id) throws Throwable
{
Object value = null;
switch (id)
{
case 0 :
{
value = (java.lang.Integer)(new Integer(1));
break;
}
case 1 :
{
value = (java.lang.Integer)(new Integer(1));
break;
}
case 2 :
{
value = (java.lang.Integer)(new Integer(1));
break;
}
case 3 :
{
value = (java.lang.Integer)(new Integer(0));
break;
}
case 4 :
{
value = (java.lang.Integer)(new Integer(1));
break;
}
case 5 :
{
value = (java.lang.Integer)(new Integer(0));
break;
}
case 6 :
{
value = (java.lang.Integer)(new Integer(1));
break;
}
case 7 :
{
value = (java.lang.Integer)(new Integer(0));
break;
}
case 8 :
{
value = (java.lang.String)("logo_foncrei.jpg");
break;
}
case 9 :
{
value = (java.lang.String)("Pag. " + ((java.lang.Integer)variable_PAGE_NUMBER.getValue()));
break;
}
case 10 :
{
value = (java.lang.String)(" / " + ((java.lang.Integer)variable_PAGE_NUMBER.getValue()));
break;
}
case 11 :
{
value = (java.util.Date)(new Date());
break;
}
case 12 :
{
value = (java.lang.Integer)(null);
break;
}
default :
{
}
}
return value;
}
/**
*
*/
public Object evaluateOld(int id) throws Throwable
{
Object value = null;
switch (id)
{
case 0 :
{
value = (java.lang.Integer)(new Integer(1));
break;
}
case 1 :
{
value = (java.lang.Integer)(new Integer(1));
break;
}
case 2 :
{
value = (java.lang.Integer)(new Integer(1));
break;
}
case 3 :
{
value = (java.lang.Integer)(new Integer(0));
break;
}
case 4 :
{
value = (java.lang.Integer)(new Integer(1));
break;
}
case 5 :
{
value = (java.lang.Integer)(new Integer(0));
break;
}
case 6 :
{
value = (java.lang.Integer)(new Integer(1));
break;
}
case 7 :
{
value = (java.lang.Integer)(new Integer(0));
break;
}
case 8 :
{
value = (java.lang.String)("logo_foncrei.jpg");
break;
}
case 9 :
{
value = (java.lang.String)("Pag. " + ((java.lang.Integer)variable_PAGE_NUMBER.getOldValue()));
break;
}
case 10 :
{
value = (java.lang.String)(" / " + ((java.lang.Integer)variable_PAGE_NUMBER.getOldValue()));
break;
}
case 11 :
{
value = (java.util.Date)(new Date());
break;
}
case 12 :
{
value = (java.lang.Integer)(null);
break;
}
default :
{
}
}
return value;
}
/**
*
*/
public Object evaluateEstimated(int id) throws Throwable
{
Object value = null;
switch (id)
{
case 0 :
{
value = (java.lang.Integer)(new Integer(1));
break;
}
case 1 :
{
value = (java.lang.Integer)(new Integer(1));
break;
}
case 2 :
{
value = (java.lang.Integer)(new Integer(1));
break;
}
case 3 :
{
value = (java.lang.Integer)(new Integer(0));
break;
}
case 4 :
{
value = (java.lang.Integer)(new Integer(1));
break;
}
case 5 :
{
value = (java.lang.Integer)(new Integer(0));
break;
}
case 6 :
{
value = (java.lang.Integer)(new Integer(1));
break;
}
case 7 :
{
value = (java.lang.Integer)(new Integer(0));
break;
}
case 8 :
{
value = (java.lang.String)("logo_foncrei.jpg");
break;
}
case 9 :
{
value = (java.lang.String)("Pag. " + ((java.lang.Integer)variable_PAGE_NUMBER.getEstimatedValue()));
break;
}
case 10 :
{
value = (java.lang.String)(" / " + ((java.lang.Integer)variable_PAGE_NUMBER.getEstimatedValue()));
break;
}
case 11 :
{
value = (java.util.Date)(new Date());
break;
}
case 12 :
{
value = (java.lang.Integer)(null);
break;
}
default :
{
}
}
return value;
}
}
| [
"diego_bertaso@protokolgroup.com"
] | diego_bertaso@protokolgroup.com |
60ce5e6265077934b9d5edad2ccbdb14bf219a5c | f91f0ba7dc05a937bf17a66c5c7e5e8acc61c7cb | /TCMLSOntoEdit/src/cn/edu/zju/ccnt/dartSS/web/innerHtml/subjectManHtml/SubjectManHtmlFactory.java | 62c46304c95e5f97b3f1b21a3d1b59d079acfa54 | [] | no_license | TCM-ZJU/Dart-TCMLS-Edit | 4ecac0bd615f1fbf358be01e457398df5c45178f | 10d14f3f568f9762058735e873e3e156414d58e8 | refs/heads/master | 2021-01-25T05:23:10.670751 | 2013-07-16T03:12:43 | 2013-07-16T03:12:43 | 10,990,005 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,341 | java | package cn.edu.zju.ccnt.dartSS.web.innerHtml.subjectManHtml;
import java.util.ArrayList;
import org.apache.log4j.Logger;
import cn.edu.zju.ccnt.dartSS.db.dao.Dss_subjectDAO;
/**专题管理的抽象工厂类
* @author zhm
*
*/
public class SubjectManHtmlFactory {
public Logger logger=Logger.getLogger(SubjectManHtmlFactory.class.getName());
public ArrayList<String> zhuangTiList;
public String setInnerHtml(){
return null;
}
/**标题提示信息
* @param pageTitle
* @return
*/
public String setHintHtml(String pageTitle){
return "<span><img src=\"./public/images/menu_create.gif\"></img>"
+ pageTitle + "<span>";
}
/**画专题下拉列表
* @return
*/
public String zhuanTiOptions(){
this.getZhuangTiList();
String optionHtml="<select id=\"zhuantiList\" name=\"zhuantiList\" style=\"width:200\" border=\"0\">" ;
for(int i=0;i<zhuangTiList.size();i++){
String ztmc=zhuangTiList.get(i);
optionHtml+="<option value=\""+ztmc+"\">"+ztmc+"</option>";
}
optionHtml+="</select>" ;
return optionHtml;
}
public ArrayList<String> getZhuangTiList() {
if(zhuangTiList==null)
setZhuangTiList();
return zhuangTiList;
}
public void setZhuangTiList() {
this.zhuangTiList = new Dss_subjectDAO().GetAllSubject();
}
}
| [
"462834462@qq.com"
] | 462834462@qq.com |
ba2e6236935107a33c77d27d1a04fcadb04f57f1 | 85fa05a867ce212dd19d42d74b25605f78a0c3d8 | /app/src/main/java/com/wxj/beautifulview/SharedPrefrenecesUtil.java | b13933bc60c47577e997ade7ed930691fe63680d | [] | no_license | SmallFlyingFish/WBeautifulView | e714f980d587a2b6825888956ecd8c36a802df95 | 745b61a859fd038ba2f2a6809dff482208bcb16b | refs/heads/master | 2021-01-19T02:48:46.038707 | 2017-04-05T09:51:57 | 2017-04-05T09:51:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,254 | java | package com.wxj.beautifulview;
import android.content.Context;
import android.content.SharedPreferences;
import java.util.Set;
/**
* User: W03673
* Date: 2017/3/30.
* Time: 14:03.
* Descriptions:
*/
public class SharedPrefrenecesUtil {
private Context context;
public SharedPreferences sp;
public SharedPrefrenecesUtil(Context context) {
this.context = context;
sp = context.getSharedPreferences("me", Context.MODE_PRIVATE);
}
/**
* 数据保存
*
* @param key
* @param value
*/
@SuppressWarnings("unchecked")
public void setConfig(String key, Object value) {
SharedPreferences.Editor edit = sp.edit();
if (value instanceof Boolean)
edit.putBoolean(key, (Boolean) value);
else if (value instanceof Integer)
edit.putInt(key, (Integer) value);
else if (value instanceof String)
edit.putString(key, (String) value);
else if (value instanceof Long)
edit.putLong(key, (Long) value);
else if (value instanceof Set)
edit.putStringSet(key, (Set) value);
edit.apply();
}
public String getConfig(String key) {
return sp.getString(key, "");
}
}
| [
"wxj978566042@gmail.com"
] | wxj978566042@gmail.com |
95c2b8415195df08df89823d194214a2e23cb603 | 2cb95a14a4f49ed4e81aadb1b83c96a4644148d8 | /A.java | 7ba7795ff0f885680d2eb141204ff0a21b4a4aa4 | [] | no_license | hemanthbandha/180030437 | a1142bd3045e06da80f0a6e80ecb6d5b7047597e | 4f187e02a2b9b56dde6acc363695ad1a2097d50d | refs/heads/master | 2020-09-23T22:27:29.009200 | 2019-12-06T03:54:51 | 2019-12-06T03:54:51 | 225,603,138 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 130 | java | class A{
public static void main(String args[])
{
System.out.println(args[0]+" TEchnologies "+args[1]);
}
} | [
"noreply@github.com"
] | hemanthbandha.noreply@github.com |
a2c102adcc68c03dfc9c8ef4dcbf898b86c1fa9e | deab9443e5546c41483f5368d3846a4a190230d1 | /Siswa.java | e547d2d52b4e90f43070e0b78e0b32e9996449f6 | [] | no_license | rohmanhm/java-siswa | 667a7630a3a67f966c2b6e22de95a15638da2a06 | b89fa23ebef5d5d6be93f837ab3bddbc23552667 | refs/heads/master | 2021-01-07T07:45:28.179601 | 2020-02-20T11:51:23 | 2020-02-20T11:51:23 | 241,624,001 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,259 | java | import java.sql.*;
import java.util.*;
/**
* Write a description of class Siswa here.
*
* @author Rohman
* @version v0.1.0
*/
public class Siswa {
ConnectDB db;
String baseQuery = "SELECT siswa.*, kelas.nama AS kelas FROM siswa LEFT JOIN kelas_siswa USING(id_siswa) LEFT JOIN kelas USING(id_kelas)";
public static void main(String[] args) throws Exception {
Siswa siswa = new Siswa();
siswa.Start();
}
public Siswa() throws Exception {
this.db = new ConnectDB();
}
public void Start() throws Exception {
System.out.println("Selamat Datang Di Database Sekolah");
System.out.println("---------------------------------");
this.selectMenu();
}
protected void selectMenu() {
System.out.println("Daftar Menu");
System.out.println("1. Tampilkan Data Siswa");
System.out.println("2. Input Data Siswa");
System.out.println("3. Ubah Data Siswa");
System.out.println("4. Hapus Data Siswa");
System.out.println("5. Cari Data Siswa");
System.out.println();
System.out.print("Silahkan Pilih Menu (Isi Dengan Angka): ");
System.out.println();
Scanner scan = new Scanner(System.in);
Integer menu = scan.nextInt();
scan.close();
switch (menu) {
case 1:
this.showData();
break;
case 2:
this.insertData();
break;
case 3:
this.updateData();
break;
case 4:
this.deleteData();
break;
case 5:
this.searchData();
break;
default:
System.out.println("Maaf, kami tidak mengenali menu " + menu + ". Silahkan coba lagi.");
break;
}
this.selectMenu();
}
private void searchData() {
Scanner scan = new Scanner(System.in);
System.out.println("Masukan data yang akan di cari: ");
String search = scan.next();
scan.close();
String query = this.baseQuery + " WHERE ";
String likeQuery = " LIKE '%" + search + "%' ";
query += "id_siswa" + likeQuery + "OR siswa.nama " + likeQuery + "OR ttl" + likeQuery + "OR jk" + likeQuery
+ "OR kelas.nama" + likeQuery;
this.getData(query);
}
private void showData() {
this.getAllData(null);
}
private void getAllData(SiswaModel siswa) {
String query = this.baseQuery;
if (siswa != null) {
query += " WHERE ";
if (siswa.id_siswa != null) {
query += "id_siswa=" + siswa.id_siswa;
}
}
this.getData(query);
}
private void getData(String query) {
try {
ResultSet rs = this.db.stmt.executeQuery(query);
String format = "%-10s %-25s %-30s %-15s %-10s %n";
System.out.printf(format, "ID Siswa", "Nama Siswa", "Tempat, Tgl lahir", "Jenis Kelamin", "Kelas");
while (rs.next()) {
System.out.printf(format, rs.getString("id_siswa"), rs.getString("nama"), rs.getString("ttl"),
rs.getString("jk"), rs.getString("kelas"));
System.out.println();
}
rs.close();
this.selectMenu();
} catch (SQLException e) {
System.out.println("Gagal mendapatkan data siswa. Error: " + e.getMessage());
}
}
private void insertData() {
try {
Scanner scan = new Scanner(System.in);
System.out.println("Masukan ID Siswa: ");
int id = Integer.parseInt(scan.nextLine().trim());
System.out.println("Masukan Nama Siswa: ");
String nama = scan.nextLine();
System.out.println("Masukan TTL Siswa: ");
String ttl = scan.nextLine();
System.out.println("Masukan Jenis Kelamin Siswa: ");
String jk = scan.nextLine();
System.out.println("Masukan ID Kelas Siswa: ");
int idKelas = scan.nextInt();
scan.close();
String query = "INSERT INTO siswa(id_siswa, nama, ttl, jk) VALUES(?,?,?,?)";
PreparedStatement prep = this.db.conn.prepareStatement(query);
prep.setInt(1, id);
prep.setString(2, nama);
prep.setString(3, ttl);
prep.setString(4, jk);
prep.addBatch();
this.db.conn.setAutoCommit(false);
prep.executeBatch();
this.db.conn.setAutoCommit(true);
this.createKelasSiswa(idKelas, id);
this.showData();
} catch (SQLException e) {
System.out.println("Gagal menambah data. Error: " + e.getMessage());
}
}
private void createKelasSiswa(int idKelas, int idSiswa) {
try {
String query = "INSERT INTO kelas_siswa(id_kelas, id_siswa) VALUES(?,?)";
PreparedStatement prep = this.db.conn.prepareStatement(query);
prep.setInt(1, idKelas);
prep.setInt(2, idSiswa);
prep.addBatch();
this.db.conn.setAutoCommit(false);
prep.executeBatch();
this.db.conn.setAutoCommit(true);
} catch (SQLException e) {
System.out.println("Gagal melakukan relasi siswa ke kelas. Error: " + e.getMessage());
}
}
private void updateData() {
try {
Scanner scan = new Scanner(System.in);
System.out.println("Masukan ID Siswa yang akan di ubah: ");
int id = Integer.parseInt(scan.nextLine().trim());
System.out.println("Masukkan Nama Siswa Baru: ");
String nama = scan.nextLine();
System.out.println("Masukkan TTL Siswa Baru: ");
String ttl = scan.nextLine();
System.out.println("Masukan Jenis Kelamin Siswa Baru: ");
String jk = scan.nextLine();
System.out.println("Masukan ID Kelas Siswa Baru: ");
int idKelas = scan.nextInt();
scan.close();
String query = "UPDATE siswa SET nama=?,ttl=?,jk=? " + "WHERE id_siswa=?";
PreparedStatement prep = this.db.conn.prepareStatement(query);
prep.setString(1, nama);
prep.setString(2, ttl);
prep.setString(3, jk);
prep.setInt(4, id);
this.db.conn.setAutoCommit(false);
prep.executeUpdate();
this.db.conn.setAutoCommit(true);
this.updateKelasSiswa(idKelas, id);
SiswaModel siswa = new SiswaModel();
siswa.id_siswa = id;
this.getAllData(siswa);
} catch (SQLException e) {
System.out.println("Gagal mengedit data. Error: " + e.getMessage());
}
}
private void updateKelasSiswa(int idKelas, int idSiswa) {
try {
String query = "UPDATE kelas_siswa SET id_kelas=? " + "WHERE id_siswa=?";
PreparedStatement prep = this.db.conn.prepareStatement(query);
prep.setInt(1, idKelas);
prep.setInt(2, idSiswa);
this.db.conn.setAutoCommit(false);
prep.executeUpdate();
this.db.conn.setAutoCommit(true);
} catch (SQLException e) {
System.out.println("Gagal update relasi siswa ke kelas. Error: " + e.getMessage());
}
}
private void deleteData() {
try {
Scanner scan = new Scanner(System.in);
System.out.println("Masukan ID Siswa yang akan di hapus: ");
Integer id = scan.nextInt();
scan.close();
String query = "DELETE FROM siswa WHERE id_siswa=?";
PreparedStatement prep = this.db.conn.prepareStatement(query);
prep.setInt(1, id);
this.db.conn.setAutoCommit(false);
prep.executeUpdate();
this.db.conn.setAutoCommit(true);
System.out.println("Berhasil menghapus data siswa.");
} catch (SQLException e) {
System.out.println("Gagal menghapus data. Error: " + e.getMessage());
}
}
}
| [
"mhrohman@live.com"
] | mhrohman@live.com |
84b9ff70b1f17403e9e882d76adf5911af353780 | cb77dcbbce6c480f68c3dcb8610743f027bee95c | /android/art/test/706-checker-scheduler/src-dex2oat-unresolved/UnresolvedClass.java | 4faa12a3358bdeb51bfad112f49d59e967ec13f4 | [
"Apache-2.0",
"NCSA",
"MIT"
] | permissive | fengjixuchui/deoptfuscator | c888b93361d837ef619b9eb95ffd4b01a4bef51a | dec8fbf2b59f8dddf2dbd10868726b255364e1c5 | refs/heads/master | 2023-03-17T11:49:00.988260 | 2023-03-09T02:01:47 | 2023-03-09T02:01:47 | 333,074,914 | 0 | 0 | MIT | 2023-03-09T02:01:48 | 2021-01-26T12:16:31 | null | UTF-8 | Java | false | false | 712 | java | /*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
public class UnresolvedClass {
public static int staticInt;
public int instanceInt;
}
| [
"gyoonus@gmail.com"
] | gyoonus@gmail.com |
406d17432c5bc5d2cd6fe10ba1a76f6146666f21 | 0643c4d94f69599dd82a2215d3678bfd2ad54041 | /app/src/main/java/com/rasa/computerman/FragmentDetailChannel/Adapter/AdapterRecyclerViewBannerDetailChannel.java | cac5e5e03853d333be69e99890717c8c5d4ae131 | [] | no_license | HosseinEynloo/RasaMedia | c4cdb49f27fc9543f9fc973d1b5f0ea70d8da457 | d9d43b24f194ed4c6f1c170c3ca1c9a2d5c4496b | refs/heads/master | 2023-07-20T05:13:03.510471 | 2021-09-01T12:18:01 | 2021-09-01T12:18:01 | 346,138,620 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,699 | java | package com.rasa.computerman.FragmentDetailChannel.Adapter;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import com.rasa.computerman.FragmentDetailChannel.PDetailChannel;
import com.rasa.computerman.R;
public class AdapterRecyclerViewBannerDetailChannel extends RecyclerView.Adapter<AdapterRecyclerViewBannerDetailChannel.viewsHolderImageView> {
private PDetailChannel pDetailChannel;
private int parentposition;
public AdapterRecyclerViewBannerDetailChannel(PDetailChannel pDetailChannel, int position) {
this.pDetailChannel = pDetailChannel;
this.parentposition = position;
}
@NonNull
@Override
public viewsHolderImageView onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view= LayoutInflater.from(pDetailChannel.getContext()).inflate(R.layout.banner_imageviews,parent,false);
return new viewsHolderImageView(view);
}
@Override
public void onBindViewHolder(@NonNull viewsHolderImageView holder, int position) {
pDetailChannel.onBindViewHolder_banner_include_imageview(holder,parentposition,position);
}
@Override
public int getItemCount() {
return pDetailChannel.getArrCount_banner_child(parentposition);
}
public class viewsHolderImageView extends RecyclerView.ViewHolder{
public ImageView imageView;
public viewsHolderImageView(View itemView) {
super(itemView);
imageView=itemView.findViewById(R.id.imageview_bannerChannels);
}
}
}
| [
"eynloo@eynloo.com"
] | eynloo@eynloo.com |
480b79fdaa1c63b4dafbbe0d7a3777a7049dc8a9 | d7de50fc318ff59444caabc38d274f3931349f19 | /src/com/fasterxml/jackson/databind/ser/BeanPropertyFilter.java | d47ebdcb6fffee025dd291220e61e8480385f227 | [] | no_license | reverseengineeringer/fr.dvilleneuve.lockito | 7bbd077724d61e9a6eab4ff85ace35d9219a0246 | ad5dbd7eea9a802e5f7bc77e4179424a611d3c5b | refs/heads/master | 2021-01-20T17:21:27.500016 | 2016-07-19T16:23:04 | 2016-07-19T16:23:04 | 63,709,932 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,204 | java | package com.fasterxml.jackson.databind.ser;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor;
import com.fasterxml.jackson.databind.node.ObjectNode;
@Deprecated
public abstract interface BeanPropertyFilter
{
public abstract void depositSchemaProperty(BeanPropertyWriter paramBeanPropertyWriter, JsonObjectFormatVisitor paramJsonObjectFormatVisitor, SerializerProvider paramSerializerProvider)
throws JsonMappingException;
@Deprecated
public abstract void depositSchemaProperty(BeanPropertyWriter paramBeanPropertyWriter, ObjectNode paramObjectNode, SerializerProvider paramSerializerProvider)
throws JsonMappingException;
public abstract void serializeAsField(Object paramObject, JsonGenerator paramJsonGenerator, SerializerProvider paramSerializerProvider, BeanPropertyWriter paramBeanPropertyWriter)
throws Exception;
}
/* Location:
* Qualified Name: com.fasterxml.jackson.databind.ser.BeanPropertyFilter
* Java Class Version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"reverseengineeringer@hackeradmin.com"
] | reverseengineeringer@hackeradmin.com |
d04d5ad1a2c07421b8365b8f59235a674055cea5 | 4a5d29e23032b183fc9648f24f0bd34b748b8447 | /Predator-Prey Environment/src/Cockatoo.java | 1c6e4fa8253c193b0d3fe1136c761c3c969e96fe | [] | no_license | EugeneZhu/.java-creations | f66e06a2391a8e6125b4e1eb9ec244ac0b615e78 | 8066757c6a8cc037b8d12cc16b7155438259c903 | refs/heads/main | 2023-08-03T09:40:07.744084 | 2021-08-18T13:56:06 | 2021-08-18T13:56:06 | 397,612,574 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,673 | java | import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Shape;
import java.awt.event.MouseEvent;
import java.awt.geom.AffineTransform;
import java.awt.geom.Area;
import java.awt.geom.Ellipse2D;
import java.awt.geom.Rectangle2D;
import java.util.ArrayList;
import processing.core.PVector;
public class Cockatoo extends Bird{
private PVector pos, vel, accel;
private float maxSpeed;
private Dimension dimension;
private float scale;
private Color color;
private Ellipse2D.Double body, eye1, eye2, lwing, rwing, head;
private Rectangle2D.Double beak;
private Area outline;
public Cockatoo(float x, float y, float size) {
super(x,y,size);
this.pos = new PVector(x, y);
this.scale = size;
while (maxSpeed == 0)
this.maxSpeed = Util.random(3, 5);
this.vel = Util.randomPVector(maxSpeed);
this.accel = new PVector(0, 0);
body = new Ellipse2D.Double();
eye1 = new Ellipse2D.Double();
eye2 = new Ellipse2D.Double();
lwing = new Ellipse2D.Double();
rwing = new Ellipse2D.Double();
head = new Ellipse2D.Double();
beak = new Rectangle2D.Double();
setBody();
createOutline();
}
public void setBody() {
body.setFrame(-60, -15, 60, 30);
head.setFrame(-10,-10, 20, 20);
eye1.setFrame(4, -5, 3, 3);
eye2.setFrame(4, 3, 3, 3);
lwing.setFrame(-60, -20, 50, 10);
rwing.setFrame(-60, 10, 50, 10);
beak.setFrame(-3, -3, 6, 6);
}
private void createOutline() {
outline = new Area();
outline.add(new Area(body));
outline.add(new Area(head));
}
public void draw(Graphics2D g) {
Graphics2D g2 = (Graphics2D) g;
AffineTransform transform = g2.getTransform();
g2.translate(pos.x, pos.y);
g2.rotate(vel.heading());
g2.scale(scale, scale);
if (vel.x < 0)
g.scale(1, -1);
AffineTransform transform1 = g2.getTransform();
g2.setColor(new Color(200, 200, 200));
g2.translate(10, 0);
g2.rotate(Math.toRadians(45));
g2.fill(beak);
g2.setTransform(transform1);
g2.setColor(new Color(255,255,255));
g2.fill(body);
g2.fill(head);
g2.fill(lwing);
g2.fill(rwing);
g2.setColor(new Color(0, 0, 0));
g2.fill(eye1);
g2.fill(eye2);
g2.setTransform(transform);
}
public void move() {
vel.normalize().mult(maxSpeed);
pos.add(vel);
}
public void edgeCollision(Dimension panelSize) {
Rectangle2D.Double top = new Rectangle2D.Double(10, 10, panelSize.width, 10);
Rectangle2D.Double bottom = new Rectangle2D.Double(10, panelSize.height - 10, panelSize.width - 10, 10);
Rectangle2D.Double left = new Rectangle2D.Double(10, 10, 10, panelSize.height - 100);
Rectangle2D.Double right = new Rectangle2D.Double(panelSize.width - 10, 10, 10, panelSize.height - 10);
if(getBoundary().intersects(left) && left.intersects(getBoundary().getBounds2D())) {
accel.add(1, 0);
}
else if(getBoundary().intersects(right) && right.intersects(getBoundary().getBounds2D())) {
accel.add(-1, 0);
}
else if(getBoundary().intersects(top) && top.intersects(getBoundary().getBounds2D())) {
accel.add(0, 1);
}
else if(getBoundary().intersects(bottom) && bottom.intersects(getBoundary().getBounds2D())) {
accel.add(0, -1);
}
else {
accel.mult(0.8f);
}
vel.add(accel);
}
public boolean checkMouseHit(MouseEvent e) {
return getBoundary().contains(e.getX(), e.getY());
}
public void attractedBy(Seed target) {
float coef = .2f; // coefficient of acceleration relative to maxSpeed
PVector direction = PVector.sub(target.getPos(), pos).normalize();
PVector acceleration = PVector.mult(direction, maxSpeed * coef);
vel.add(acceleration);
}
public Shape getBoundary() {
AffineTransform at = new AffineTransform();
at.translate(pos.x, pos.y);
at.rotate(vel.heading());
at.scale(scale, scale);
return at.createTransformedShape(outline);
}
public PVector getPos() {
return pos;
}
public void chase(Seed target) {
PVector path = PVector.sub(target.getPos(), pos);
vel = path.limit(maxSpeed);
}
public boolean detectCollision(Seed seed) {
boolean hit = false;
if (getBoundary().intersects(seed.getBoundary().getBounds2D())
&& seed.getBoundary().intersects(getBoundary().getBounds2D()))
hit = true;
return hit;
}
public float getScale() {
return scale;
}
public void setPos(int x, int y) {
pos.x = x;
pos.y = y;
}
public boolean collides(Cockatoo c) {
//Detecting the collision between the cockatoos
return (c.getBoundary().intersects(getBoundary().getBounds2D()) &&
getBoundary().intersects(c.getBoundary().getBounds2D()));
}
public void moveAwayFrom(Cockatoo c) {
float coef = .2f; // coefficient of acceleration relative to maxSpeed
PVector direction = PVector.sub(pos, c.getPos()).normalize();
PVector acceleration = PVector.mult(direction, maxSpeed * coef);
vel.add(acceleration);
}
public void changeColor() {
this.color = Util.setColor();
}
public Seed searchClosestSeed(ArrayList<Seed> seed) {
if (seed.size() == 0)
return null;
Seed closestSeed = seed.get(0);
float closestDist = PVector.dist(this.getPos(), closestSeed.getPos());
for (Seed s : seed)
if (PVector.dist(this.getPos(), s.getPos()) < closestDist) {
closestSeed = s;
closestDist = PVector.dist(this.getPos(), closestSeed.getPos());
}
this.attractedBy(closestSeed);
return closestSeed;
}
}
| [
"noreply@github.com"
] | EugeneZhu.noreply@github.com |
ab6dfda08190f699578a9acad2a852c9c873d165 | e790b7cd0912687f76aba8d0b1d0f717fa32300b | /app/src/main/java/com/example/pbs2h17aku/prototyp_gcs/TrainingActivity.java | 3ec43976db8e65c9b0650ce71d4a388d7e50f965 | [] | no_license | roemmich/GCS_Roscpeeb | 214162ea1ef3c0786ab74332ad7403e96f67359e | b4d24113e3cf1042836917c8020f1ed3cb3358c9 | refs/heads/master | 2020-04-09T11:35:25.297043 | 2018-12-04T07:24:23 | 2018-12-04T07:24:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,539 | java | package com.example.pbs2h17aku.prototyp_gcs;
import android.app.Activity;
import android.os.Bundle;
import android.os.DropBoxManager;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextClock;
import android.widget.TextView;
public class TrainingActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_training);
//Ein Patient wird erstellt
Patient p = new Patient();
//Der Wert wird in einem Int gespeichert um diesen zu Übernehmen
final int value = p.gcsValue();
//Das Editfeld wo die Zahl eingegeben wird
final EditText number = findViewById(R.id.userInputNumber);
//Das Textfeld wo das ergebnis reinkommt
final TextView copyNumber = findViewById(R.id.copyUserInput);
Button losB = findViewById(R.id.losB);
TextView textView = findViewById(R.id.Case);
textView.setText(p.toString());
//Reagiert bei click auf "LOS" und sendet das Ergebnis an das copyTextfeld
losB.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(number.getEditableText().equals(value)){
copyNumber.setText("true");
}
else{
copyNumber.setText("false");
}
}
});
}
}
| [
"roemmich.23@gmail.com"
] | roemmich.23@gmail.com |
42298db24bba1f7691489cba4c5513429417945d | 552d68a94ecc40f835cb515421cd5e9faa7c0286 | /MainActivity.java | baa0455af74b28870029e5cf347d20947b7509d0 | [] | no_license | mohamedashiq99/location | ef09d1586159a32962fbad6e886236a36150bf2d | 01d36c08d3823d44468bfab661790f0e62d85324 | refs/heads/master | 2020-05-26T09:13:28.051491 | 2019-05-23T07:34:38 | 2019-05-23T07:34:38 | 188,181,517 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,495 | java | package com.example.user.gfgfh1;
import android.app.AlertDialog;
import android.content.Context;
import android.content.pm.PackageManager;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
@SuppressWarnings("ResourceType")
public final class MainActivity implements LocationListener {
private final Context mContext;
private boolean isGPSEnabled = false;
private boolean isNetworkEnabled = false;
public boolean canGetLocation = false;
private Location location; // location
private double latitude; // latitude
private double longitude; // longitude
// The minimum distance to change Updates in meters
private static final long MIN_DISTANCE_CHANGE_FOR_UPDATES = 1; // 10 meters
// The minimum time between updates in milliseconds
private static final long MIN_TIME_BW_UPDATES = 1; // 1 minute
// Declaring a Location Manager
protected LocationManager locationManager;
public MainActivity(Context context) {
this.mContext = context;
if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && context.checkSelfPermission(android.Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED)
|| Build.VERSION.SDK_INT < Build.VERSION_CODES.M)
getLocation();
}
/**
* Function to get the user's current location
*
* @return
*/
public Location getLocation() {
try {
locationManager = (LocationManager) mContext.getSystemService(Context.LOCATION_SERVICE);
// getting GPS status
isGPSEnabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
Log.v("isGPSEnabled", "=" + isGPSEnabled);
// getting network status
isNetworkEnabled = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
Log.v("isNetworkEnabled", "=" + isNetworkEnabled);
if (isGPSEnabled || isNetworkEnabled) {
this.canGetLocation = true;
location = null;
if (isNetworkEnabled) {
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, MIN_TIME_BW_UPDATES, MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
Log.d("Network", "Network");
if (locationManager != null) {
location = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
onLocationChanged(location);
}
}
// if GPS Enabled get lat/long using GPS Services
if (isGPSEnabled) {
if (location == null) {
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, MIN_TIME_BW_UPDATES, MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
Log.d("GPS Enabled", "GPS Enabled");
if (locationManager != null) {
location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
onLocationChanged(location);
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
return location;
}
/**
* Function to get latitude
*/
public double getLatitude() {
if (location != null) {
latitude = location.getLatitude();
}
return latitude;
}
/**
* Function to get longitude
*/
public double getLongitude() {
if (location != null) {
longitude = location.getLongitude();
}
return longitude;
}
@Override
public void onLocationChanged(Location location) {
if (location == null)
return;
this.location = location;
latitude = location.getLatitude();
longitude = location.getLongitude();
}
@Override
public void onProviderDisabled(String provider) {
}
@Override
public void onProviderEnabled(String provider) {
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
}
}
| [
"noreply@github.com"
] | mohamedashiq99.noreply@github.com |
5ed86631ef63d8ade0d45471cfbf543e2907d88b | 6d943c9f546854a99ae27784d582955830993cee | /modules/dfp_axis/src/main/java/com/google/api/ads/admanager/axis/v202002/ForecastServiceLocator.java | b991d629744cd11e9443d7aa27a2ac4f154c7d22 | [
"Apache-2.0"
] | permissive | MinYoungKim1997/googleads-java-lib | 02da3d3f1de3edf388a3f2d3669a86fe1087231c | 16968056a0c2a9ea1676b378ab7cbfe1395de71b | refs/heads/master | 2021-03-25T15:24:24.446692 | 2020-03-16T06:36:10 | 2020-03-16T06:36:10 | 247,628,741 | 0 | 0 | Apache-2.0 | 2020-03-16T06:36:35 | 2020-03-16T06:36:34 | null | UTF-8 | Java | false | false | 6,532 | java | // Copyright 2020 Google LLC
//
// 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.
/**
* ForecastServiceLocator.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Mar 02, 2009 (07:08:06 PST) WSDL2Java emitter.
*/
package com.google.api.ads.admanager.axis.v202002;
public class ForecastServiceLocator extends org.apache.axis.client.Service implements com.google.api.ads.admanager.axis.v202002.ForecastService {
public ForecastServiceLocator() {
}
public ForecastServiceLocator(org.apache.axis.EngineConfiguration config) {
super(config);
}
public ForecastServiceLocator(java.lang.String wsdlLoc, javax.xml.namespace.QName sName) throws javax.xml.rpc.ServiceException {
super(wsdlLoc, sName);
}
// Use to get a proxy class for ForecastServiceInterfacePort
private java.lang.String ForecastServiceInterfacePort_address = "https://ads.google.com/apis/ads/publisher/v202002/ForecastService";
public java.lang.String getForecastServiceInterfacePortAddress() {
return ForecastServiceInterfacePort_address;
}
// The WSDD service name defaults to the port name.
private java.lang.String ForecastServiceInterfacePortWSDDServiceName = "ForecastServiceInterfacePort";
public java.lang.String getForecastServiceInterfacePortWSDDServiceName() {
return ForecastServiceInterfacePortWSDDServiceName;
}
public void setForecastServiceInterfacePortWSDDServiceName(java.lang.String name) {
ForecastServiceInterfacePortWSDDServiceName = name;
}
public com.google.api.ads.admanager.axis.v202002.ForecastServiceInterface getForecastServiceInterfacePort() throws javax.xml.rpc.ServiceException {
java.net.URL endpoint;
try {
endpoint = new java.net.URL(ForecastServiceInterfacePort_address);
}
catch (java.net.MalformedURLException e) {
throw new javax.xml.rpc.ServiceException(e);
}
return getForecastServiceInterfacePort(endpoint);
}
public com.google.api.ads.admanager.axis.v202002.ForecastServiceInterface getForecastServiceInterfacePort(java.net.URL portAddress) throws javax.xml.rpc.ServiceException {
try {
com.google.api.ads.admanager.axis.v202002.ForecastServiceSoapBindingStub _stub = new com.google.api.ads.admanager.axis.v202002.ForecastServiceSoapBindingStub(portAddress, this);
_stub.setPortName(getForecastServiceInterfacePortWSDDServiceName());
return _stub;
}
catch (org.apache.axis.AxisFault e) {
return null;
}
}
public void setForecastServiceInterfacePortEndpointAddress(java.lang.String address) {
ForecastServiceInterfacePort_address = address;
}
/**
* For the given interface, get the stub implementation.
* If this service has no port for the given interface,
* then ServiceException is thrown.
*/
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
try {
if (com.google.api.ads.admanager.axis.v202002.ForecastServiceInterface.class.isAssignableFrom(serviceEndpointInterface)) {
com.google.api.ads.admanager.axis.v202002.ForecastServiceSoapBindingStub _stub = new com.google.api.ads.admanager.axis.v202002.ForecastServiceSoapBindingStub(new java.net.URL(ForecastServiceInterfacePort_address), this);
_stub.setPortName(getForecastServiceInterfacePortWSDDServiceName());
return _stub;
}
}
catch (java.lang.Throwable t) {
throw new javax.xml.rpc.ServiceException(t);
}
throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface: " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
}
/**
* For the given interface, get the stub implementation.
* If this service has no port for the given interface,
* then ServiceException is thrown.
*/
public java.rmi.Remote getPort(javax.xml.namespace.QName portName, Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
if (portName == null) {
return getPort(serviceEndpointInterface);
}
java.lang.String inputPortName = portName.getLocalPart();
if ("ForecastServiceInterfacePort".equals(inputPortName)) {
return getForecastServiceInterfacePort();
}
else {
java.rmi.Remote _stub = getPort(serviceEndpointInterface);
((org.apache.axis.client.Stub) _stub).setPortName(portName);
return _stub;
}
}
public javax.xml.namespace.QName getServiceName() {
return new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v202002", "ForecastService");
}
private java.util.HashSet ports = null;
public java.util.Iterator getPorts() {
if (ports == null) {
ports = new java.util.HashSet();
ports.add(new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v202002", "ForecastServiceInterfacePort"));
}
return ports.iterator();
}
/**
* Set the endpoint address for the specified port name.
*/
public void setEndpointAddress(java.lang.String portName, java.lang.String address) throws javax.xml.rpc.ServiceException {
if ("ForecastServiceInterfacePort".equals(portName)) {
setForecastServiceInterfacePortEndpointAddress(address);
}
else
{ // Unknown Port Name
throw new javax.xml.rpc.ServiceException(" Cannot set Endpoint Address for Unknown Port" + portName);
}
}
/**
* Set the endpoint address for the specified port name.
*/
public void setEndpointAddress(javax.xml.namespace.QName portName, java.lang.String address) throws javax.xml.rpc.ServiceException {
setEndpointAddress(portName.getLocalPart(), address);
}
}
| [
"christopherseeley@users.noreply.github.com"
] | christopherseeley@users.noreply.github.com |
befbc9d9f7e94a5864df02f4a9022ba922f6360f | 268b1ec69b21f7099026deb2029f923d9c63958c | /src/main/java/org/web/onlineshop/controller/DelivererController.java | ff566e94013bcfabc07ed51ca1d70367e3525e88 | [] | no_license | milanm2220/Online-shop | ce4407049190225ffa122065ddf94fc7643ff07b | 6939c22f3f72fda186170da5cc5b77142298bf70 | refs/heads/master | 2020-07-10T04:19:07.744810 | 2019-09-02T19:19:52 | 2019-09-02T19:19:52 | 204,165,174 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,135 | java | package org.web.onlineshop.controller;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.web.onlineshop.dto.CartDto;
import org.web.onlineshop.dto.UserDto;
import org.web.onlineshop.exceptions.DelivererHasDeliveryInProgressException;
import org.web.onlineshop.exceptions.UnauthorizedAccessException;
import org.web.onlineshop.model.Cart;
import org.web.onlineshop.model.Customer;
import org.web.onlineshop.model.Deliverer;
import org.web.onlineshop.service.CartService;
import org.web.onlineshop.service.CustomerService;
import org.web.onlineshop.service.DelivererService;
import org.web.onlineshop.util.Constants;
import org.web.onlineshop.util.OrderStatus;
import org.web.onlineshop.util.UserRole;
@RestController
@RequestMapping(value = Constants.REST_API_PREFIX + "/deliverers")
public class DelivererController
{
@Autowired
private DelivererService delivererService;
@Autowired
private CartService cartService;
@Autowired
private CustomerService customerService;
@Autowired
private ModelMapper modelMapper;
@Autowired
private HttpServletRequest request;
@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<UserDto>> getDeliverers()
{
List<Deliverer> deliverers = this.delivererService.findAll();
List<UserDto> delivererDtos = new ArrayList<>();
deliverers.stream().forEach(customer ->
{
delivererDtos.add(this.modelMapper.map(customer, UserDto.class));
});
return new ResponseEntity<>(delivererDtos, HttpStatus.OK);
}
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<UserDto> add(@RequestBody UserDto delivererDto)
{
if (request.getSession().getAttribute("role") != UserRole.ADMINISTRATOR)
{
throw new UnauthorizedAccessException();
}
try
{
Deliverer deliverer = this.modelMapper.map(delivererDto, Deliverer.class);
deliverer = this.delivererService.save(deliverer);
delivererDto = this.modelMapper.map(deliverer, UserDto.class);
return new ResponseEntity<>(delivererDto, HttpStatus.OK);
}
catch(Exception exception) { throw exception; }
}
@RequestMapping(method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<UserDto> update(@RequestBody UserDto delivererDto)
{
if (request.getSession().getAttribute("role") != UserRole.ADMINISTRATOR)
{
throw new UnauthorizedAccessException();
}
try
{
Deliverer deliverer = this.modelMapper.map(delivererDto, Deliverer.class);
deliverer = this.delivererService.update(deliverer);
delivererDto = this.modelMapper.map(deliverer, UserDto.class);
return new ResponseEntity<>(delivererDto, HttpStatus.OK);
}
catch(Exception exception) { throw exception; }
}
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> delete(@PathVariable Long id)
{
if (request.getSession().getAttribute("role") != UserRole.ADMINISTRATOR)
{
throw new UnauthorizedAccessException();
}
try
{
Deliverer deliverer = this.delivererService.findById(id);
List<Cart> orders = new ArrayList<>(deliverer.getDeliveries());
for (Cart order : orders)
{
if (order.getState() != null && order.getState() == OrderStatus.DELIVERY_IN_PROGRESS)
{
throw new DelivererHasDeliveryInProgressException(deliverer.getUsername());
}
}
this.delivererService.delete(id);
return new ResponseEntity<>(HttpStatus.OK);
}
catch(Exception exception) { throw exception; }
}
@RequestMapping(value = "/cart/take_over/{id}", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> takeOverOrder(@PathVariable Long id, @RequestBody CartDto cartDto)
{
if (request.getSession().getAttribute("role") != UserRole.DELIVERER || !request.getSession().getAttribute("id").equals(id))
{
throw new UnauthorizedAccessException();
}
try
{
Deliverer deliverer = this.delivererService.findById(id);
Cart cart = this.modelMapper.map(cartDto, Cart.class);
if (this.cartService.takeOverOrder(cart, deliverer))
{
deliverer.getDeliveries().add(cart);
this.delivererService.update(deliverer);
return new ResponseEntity<>(HttpStatus.OK);
}
else
{
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
}
}
catch(Exception exception) { throw exception; }
}
@RequestMapping(value = "/cart/deliver/{id}", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> deliverOrder(@PathVariable Long id, @RequestBody CartDto cartDto)
{
if (request.getSession().getAttribute("role") != UserRole.DELIVERER || !request.getSession().getAttribute("id").equals(id))
{
throw new UnauthorizedAccessException();
}
try
{
Cart cart = this.modelMapper.map(cartDto, Cart.class);
if (cart.getDeliverer() == null || !cart.getDeliverer().getId().equals(id) || cart.getState() != OrderStatus.DELIVERY_IN_PROGRESS)
{
return new ResponseEntity<>(HttpStatus.FORBIDDEN);
}
if (this.cartService.deliverOrder(cart))
{
if (cart.getTotalPrice() > Constants.PRICE_LIMIT_TO_GET_BONUS_POINT)
{
Customer customer = this.customerService.findById(cart.getCustomer().getId());
if (customer.getBonusPoints() == null)
{
customer.setBonusPoints(1);
}
else
{
customer.setBonusPoints(customer.getBonusPoints() + 1);
}
this.customerService.update(customer);
}
return new ResponseEntity<>(HttpStatus.OK);
}
else
{
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
}
}
catch(Exception exception) { throw exception; }
}
@RequestMapping(value = "/cart/cancel/{id}", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> cancelOrder(@PathVariable Long id, @RequestBody CartDto cartDto)
{
if (request.getSession().getAttribute("role") != UserRole.DELIVERER || !request.getSession().getAttribute("id").equals(id))
{
throw new UnauthorizedAccessException();
}
try
{
Cart cart = this.modelMapper.map(cartDto, Cart.class);
if (cart.getDeliverer() == null || !cart.getDeliverer().getId().equals(id) || cart.getState() != OrderStatus.DELIVERY_IN_PROGRESS)
{
return new ResponseEntity<>(HttpStatus.FORBIDDEN);
}
if (this.cartService.cancelOrder(cart))
{
return new ResponseEntity<>(HttpStatus.OK);
}
else
{
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
}
}
catch(Exception exception) { throw exception; }
}
@RequestMapping(value = "/cart/all/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<CartDto>> getOrders(@PathVariable Long id)
{
if (request.getSession().getAttribute("role") != UserRole.DELIVERER || !request.getSession().getAttribute("id").equals(id))
{
throw new UnauthorizedAccessException();
}
try
{
Deliverer deliverer = this.delivererService.findById(id);
List<Cart> orders = new ArrayList<>(deliverer.getDeliveries());
List<CartDto> orderDtos = new ArrayList<>();
orders.stream().forEach(order ->
{
if (order.getState() != null && order.getState() != OrderStatus.DELIVERY_IN_PROGRESS)
{
orderDtos.add(modelMapper.map(order, CartDto.class));
}
});
return new ResponseEntity<>(orderDtos, HttpStatus.OK);
}
catch(Exception exception) { throw exception; }
}
@RequestMapping(value = "/cart/in_progress/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<CartDto> getOrderInProgress(@PathVariable Long id)
{
if (request.getSession().getAttribute("role") != UserRole.DELIVERER || !request.getSession().getAttribute("id").equals(id))
{
throw new UnauthorizedAccessException();
}
try
{
Deliverer deliverer = this.delivererService.findById(id);
List<Cart> orders = new ArrayList<>(deliverer.getDeliveries());
CartDto orderDto = null;
for (Cart order : orders)
{
if (order.getState() != null && order.getState() == OrderStatus.DELIVERY_IN_PROGRESS)
{
orderDto = modelMapper.map(order, CartDto.class);
break;
}
}
return new ResponseEntity<>(orderDto, HttpStatus.OK);
}
catch(Exception exception) { throw exception; }
}
} | [
"44477868+duca43@users.noreply.github.com"
] | 44477868+duca43@users.noreply.github.com |
de9dcb10642e6f565a3f7d56e9f5e98d6a013459 | 3f605d058523f0b1e51f6557ed3c7663d5fa31d6 | /eclipse/plugins/org.ebayopensource.vjet.eclipse.ui/src/org/ebayopensource/vjet/eclipse/internal/ui/typehierarchy/EnableMemberFilterAction.java | 30c0f41639d38b02d7f69c281c2e8c01dcaba051 | [] | no_license | vjetteam/vjet | 47e21a13978cd860f1faf5b0c2379e321a9b688c | ba90843b89dc40d7a7eb289cdf64e127ec548d1d | refs/heads/master | 2020-12-25T11:05:55.420303 | 2012-08-07T21:56:30 | 2012-08-07T21:56:30 | 3,181,492 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,099 | java | /*******************************************************************************
* Copyright (c) 2005-2011 eBay Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
*******************************************************************************/
/*******************************************************************************
* Copyright (c) 2000, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
*******************************************************************************/
package org.ebayopensource.vjet.eclipse.internal.ui.typehierarchy;
import org.eclipse.dltk.mod.ui.DLTKPluginImages;
import org.eclipse.jface.action.Action;
import org.eclipse.swt.custom.BusyIndicator;
/**
* Action enable / disable member filtering
*/
public class EnableMemberFilterAction extends Action {
private VJOTypeHierarchyViewPart fView;
public EnableMemberFilterAction(VJOTypeHierarchyViewPart v, boolean initValue) {
super(TypeHierarchyMessages.EnableMemberFilterAction_label);
setDescription(TypeHierarchyMessages.EnableMemberFilterAction_description);
setToolTipText(TypeHierarchyMessages.EnableMemberFilterAction_tooltip);
DLTKPluginImages.setLocalImageDescriptors(this, "impl_co.gif"); //$NON-NLS-1$
fView= v;
setChecked(initValue);
//PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.ENABLE_METHODFILTER_ACTION);
}
/*
* @see Action#actionPerformed
*/
public void run() {
BusyIndicator.showWhile(fView.getSite().getShell().getDisplay(), new Runnable() {
public void run() {
fView.enableMemberFilter(isChecked());
}
});
}
}
| [
"pwang@27f4aac7-f869-4a38-a8c2-f1a995e726e6"
] | pwang@27f4aac7-f869-4a38-a8c2-f1a995e726e6 |
f2c293141d9ac25d52aae9320266a462efd36d13 | 1c86de33e5ee31e5e3807ac2ff97dfcb906d35ac | /teamsoftti-laboratorio/.svn/pristine/f2/f2c293141d9ac25d52aae9320266a462efd36d13.svn-base | aa58e4bcaeebe832488c48b3cf5a3f77b816684b | [] | no_license | juancvc/teamsoft-laboratorio | 5f68beedda68700a31cbf3002eeff33f969d9a74 | 1b67f8be9c25e9d32bee76a556cabf1e9988f3d4 | refs/heads/master | 2022-12-21T23:02:02.248580 | 2020-01-04T01:07:57 | 2020-01-04T01:07:57 | 213,820,910 | 1 | 0 | null | 2022-12-16T01:24:28 | 2019-10-09T04:28:51 | JavaScript | UTF-8 | Java | false | false | 2,420 | package hnch.referencia.core.repository.implementacion.general;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.ParameterMode;
import javax.persistence.PersistenceContext;
import javax.persistence.StoredProcedureParameter;
import javax.persistence.StoredProcedureQuery;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import hnch.referencia.core.entity.general.PacienteReniec;
import hnch.referencia.core.repository.interfaces.general.PacienteReniecDAO;
import hnch.referencia.base.repository.DAOException;
@Transactional
@Repository("pacienteReniecDAO")
public class PacienteReniecDAOImpl implements PacienteReniecDAO {
@PersistenceContext
private EntityManager em;
@Override
public boolean delete(PacienteReniec arg0) throws DAOException {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean insert(PacienteReniec arg0) throws DAOException {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean update(PacienteReniec arg0) throws DAOException {
// TODO Auto-generated method stub
return false;
}
@Override
public List<PacienteReniec> pacienteReniecVerificacion(
PacienteReniec pacienteReniec) throws hnch.referencia.core.repository.DAOException {
List<PacienteReniec> lstPaciente = null;
try {
StoredProcedureQuery spq = em.createNamedStoredProcedureQuery("pacienteReniec.verificar");
spq.setParameter("dni", pacienteReniec.getNroDni());
if (spq.execute()) {
lstPaciente = (List<PacienteReniec>)spq.getResultList();
}
em.close();
} catch (Exception e) {
e.printStackTrace();
return null;
//throw new hnch.referencia.core.repository.DAOException(e);
}
return lstPaciente;
}
@Override
public PacienteReniec getByObject(PacienteReniec t) throws DAOException {
// TODO Auto-generated method stub
return null;
}
@Override
public List<PacienteReniec> getByLikeObject(PacienteReniec t) throws DAOException {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean exist(PacienteReniec t) throws DAOException {
// TODO Auto-generated method stub
return false;
}
}
| [
"user}@DESKTOP-K46K0JT"
] | user}@DESKTOP-K46K0JT | |
d8a81240fe6def75b8070a737e7dbc1b492e65fa | 84e07bc3d14213de083365c5596ea288bccb326c | /grails-spring/src/main/groovy/org/grails/spring/BeanConfiguration.java | a483adc406c70ba6afa7371b3558daf4438b8ef0 | [
"Apache-2.0"
] | permissive | grails/grails-core | 80eebcfe74b9137b222399bbcaec503ab3839c6f | 56a66438c6a5b70650d60be7e1b543ece288312d | refs/heads/6.0.x | 2023-08-30T16:51:29.486716 | 2023-08-03T13:11:26 | 2023-08-03T13:11:26 | 512,295 | 2,334 | 1,022 | Apache-2.0 | 2023-09-14T07:54:03 | 2010-02-10T23:57:57 | HTML | UTF-8 | Java | false | false | 4,128 | java | /*
* Copyright 2004-2005 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.grails.spring;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.support.AbstractBeanDefinition;
/**
* Represents a runtime bean configuration.
*
* Credit must go to Solomon Duskis and the
* article: http://jroller.com/page/Solomon?entry=programmatic_configuration_in_spring
*
* @author Graeme
* @since 0.3
*/
public interface BeanConfiguration {
String AUTOWIRE_BY_TYPE = "byType";
String AUTOWIRE_BY_NAME = "byName";
/**
* @return The name of the bean
*/
String getName();
/**
* @return true if the bean is singleton
*/
boolean isSingleton();
/**
* @return The Spring bean definition instance
*/
AbstractBeanDefinition getBeanDefinition();
/**
* Adds a property value to this bean.
* @param propertyName The name of the property
* @param propertyValue The value of the property
*
* @return Returns this bean configuration
*/
BeanConfiguration addProperty(String propertyName, Object propertyValue);
/**
* Sets the name of the method to call when destroying the bean.
*
* @param methodName The method name
* @return This bean configuration
*/
BeanConfiguration setDestroyMethod(String methodName);
/**
* Sets the names of the beans this bean configuration depends on
*
* @param dependsOn Bean names it depends on
* @return This bean configuration
*/
BeanConfiguration setDependsOn(String[] dependsOn);
/**
*
* @param beanName
* @return This BeanConfiguration
*/
BeanConfiguration setFactoryBean(String beanName);
/**
*
* @param methodName
* @return This BeanConfiguration
*/
BeanConfiguration setFactoryMethod(String methodName);
/**
* Sets the autowire type, either "byType" or "byName"
*
* @param type The type
* @return This BeanConfiguration
*/
BeanConfiguration setAutowire(String type);
/**
* Sets the name of the bean in the app ctx.
* @param beanName The bean name
*/
void setName(String beanName);
/**
* Returns true if the bean config has the name property set.
* @param name The name of the property
* @return true if it does have a property with the given name
*/
boolean hasProperty(String name);
/**
* Returns the value of the given property or throws a MissingPropertyException.
*
* @param name The name of the property
* @return The value of the property
*/
Object getPropertyValue(String name);
/**
* Sets a property value on the bean configuration
*
* @param property The name of the property
* @param newValue The value
*/
void setPropertyValue(String property, Object newValue);
/**
* Sets the BeanConfiguration as an Abstract bean definition
* @param isAbstract Whether its abstract or not
* @return This BeanConfiguration object
*/
BeanConfiguration setAbstract(boolean isAbstract);
/**
* Sets the name of the parent bean.
*
* @param name Either a string which is the name of the bean, a RuntimeBeanReference or a BeanConfiguration
*/
void setParent(Object name);
void setBeanDefinition(BeanDefinition definition);
}
| [
"jbrown@gopivotal.com"
] | jbrown@gopivotal.com |
8e2ac30401c24a2f79032787c235ae4da21d653c | d1c101c15623e6ae8a384f4efcb0ed53a49ad01d | /src/main/java/com/sain/commerce/payment/method/irankish/IKCommercePaymentRequestProvider.java | c03230c970b13ed87052853aea676dda95cdb96e | [] | no_license | naderjafari/commerce-payment-method-irankish-2 | 28ba056635ac549b677c39407b0eac5371f68c2f | 759747b6594c0e03de16512a7414f1ffd646ff7c | refs/heads/master | 2020-04-25T23:53:04.877813 | 2019-05-09T13:51:37 | 2019-05-09T13:51:37 | 173,159,790 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,149 | java | /**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
* <p>
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
* <p>
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
package com.sain.commerce.payment.method.irankish;
import com.liferay.commerce.model.CommerceOrder;
import com.liferay.commerce.payment.request.CommercePaymentRequest;
import com.liferay.commerce.payment.request.CommercePaymentRequestProvider;
import com.liferay.commerce.service.CommerceOrderLocalService;
import com.liferay.portal.kernel.exception.PortalException;
import java.util.Locale;
import javax.servlet.http.HttpServletRequest;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
/**
* @author Nader Jafari
*/
@Component(
immediate = true,
property = "commerce.payment.engine.method.key=" + IKCommercePaymentMethod.KEY,
service = CommercePaymentRequestProvider.class
)
public class IKCommercePaymentRequestProvider
implements CommercePaymentRequestProvider {
@Override
public CommercePaymentRequest getCommercePaymentRequest(
String cancelUrl, long commerceOrderId,
HttpServletRequest httpServletRequest, Locale locale,
String returnUrl, String transactionId)
throws PortalException {
CommerceOrder commerceOrder =
_commerceOrderLocalService.getCommerceOrder(commerceOrderId);
return new IKCommercePaymentRequest(
commerceOrder.getTotal(), cancelUrl, commerceOrderId, locale,
httpServletRequest, returnUrl, transactionId);
}
@Reference
private CommerceOrderLocalService _commerceOrderLocalService;
} | [
"nader.jafari1988@gmail.com"
] | nader.jafari1988@gmail.com |
bf96ae2a76ab82ff57a1580cdadd7f3a087113c8 | f6b54ba16051cd7ecb9014ae7e840e0d94e59133 | /src/main/java/org/woodship/luna/demo/subtable/Element.java | 5e2543ebb97fd5d58a733291952bc273500eef03 | [] | no_license | DLoongs/luna | d92e2a2c3afcdb04cf7c31c1ce274c94a3eb28e7 | 6efbeeb16eabf5bbde6a2f9bcce9de48d98ba8e3 | refs/heads/master | 2021-05-27T03:12:02.654300 | 2013-07-19T07:28:17 | 2013-07-19T07:28:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 447 | java | package org.woodship.luna.demo.subtable;
public enum Element {
C(0.95),Si(0.95),Mn(0.95),P(1),S(1),
Cr(0.98),Ni(0.99),Mo(0.99),V(0.70),W(0.85),Cu(0.90);
/**
* 烧得率
*/
private double yield;
private Element(double yield){
this.yield = yield;
}
private Element(){
this.yield = 1;
}
public double getYield() {
return yield;
}
public void setYield(double yield) {
this.yield = yield;
}
}
| [
"67892238@qq.com"
] | 67892238@qq.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.