blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
24f136050ec32c9fb816e65eaeb34525c2060478
0650a8b6feaec0bc8b427acdf1d4e8a1707aeb82
/app/src/main/java/com/qing/browser/providers/HistoryUtil.java
8760058424ea9c5111e40593936957753d0c6dc7
[]
no_license
conseweb/browser
711f24c1c1a61095cf2efb32a8c9f7a1b3fe9fb4
e392fbb5e582aff8316677b69d175519e2209653
refs/heads/master
2020-04-10T06:36:50.940139
2015-08-12T12:47:44
2015-08-12T12:47:44
40,552,245
0
0
null
null
null
null
UTF-8
Java
false
false
4,170
java
package com.qing.browser.providers; import java.io.ByteArrayOutputStream; import android.content.ContentResolver; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.net.Uri; import com.qing.browser.R; public class HistoryUtil { static final String PARAMETER_NOTIFY = "notify"; public static final String HistoryColumns_TITTLE = "title"; public static final String HistoryColumns_URL = "url"; public static final String HistoryColumns_DATE = "date"; public static final String HistoryColumns_CREATED = "created"; public static final String HistoryColumns_VISITS = "visits"; public static final String HistoryColumns_USER_ENTERED = "user_entered"; public static final String HistoryColumns_FAVICON = "favicon"; public static final String HistoryColumns_SNAPSHOT= "snapshot"; public static int insert(Context context, ContentValues values) { int historyid = 0; final ContentResolver cr = context.getContentResolver(); Uri result = cr.insert(HistoryProvider.CONTENT_URI, values); if (result != null) { historyid = Integer.parseInt(result.getPathSegments().get(1)); } return historyid; } public static Cursor query(Context context, String[] projection, String selection, String[] selectionArgs, String sortOrder) { final ContentResolver cr = context.getContentResolver(); Cursor c = cr.query(HistoryProvider.CONTENT_URI, projection, selection, selectionArgs, sortOrder); return c; } public static void update(Context context, ContentValues values, long id) { final ContentResolver cr = context.getContentResolver(); cr.update(HistoryProvider.getContentUri(id), values, null, null); } public static void update(Context context, ContentValues values, String url) { final ContentResolver cr = context.getContentResolver(); String whereClause = HistoryColumns_URL + " = \'"+url+"\'"; cr.update(HistoryProvider.CONTENT_URI, values, whereClause, null); } /** * 保存 下载的具体信息 */ public static void saveName(Context context, String title, String url, long date, Bitmap icon) { if (icon == null) { icon = BitmapFactory.decodeResource(context.getResources(), R.drawable.hotseat_browser_bg); } final ByteArrayOutputStream os = new ByteArrayOutputStream(); // 将Bitmap压缩成PNG编码,质量为100%存储 icon.compress(Bitmap.CompressFormat.PNG, 100, os); ContentValues values = new ContentValues(); if (title != null) { values.put(HistoryColumns_TITTLE, title); } if (url != null) { values.put(HistoryColumns_URL, url); } values.put(HistoryColumns_DATE, date); values.put(HistoryColumns_FAVICON, os.toByteArray()); insert(context, values); } public static boolean isName(Context context, String url) { ContentResolver cr = context.getContentResolver(); String whereClause = HistoryColumns_URL + " = \'"+url+"\'"; Cursor c = cr.query(HistoryProvider.CONTENT_URI, null, whereClause, null, null); if (c != null) { if (c.moveToFirst() == true) { return true; } else { return false; } } else { return false; } } /** * 下载完成后删除数据库中的数据 */ public static void delete(Context context, String url) { ContentResolver cr = context.getContentResolver(); String whereClause = HistoryColumns_URL + " = \'"+url+"\'"; cr.delete(HistoryProvider.CONTENT_URI, whereClause, null); } public static void deleteAll(Context context) { ContentResolver cr = context.getContentResolver(); cr.delete(HistoryProvider.CONTENT_URI, null, null); } public static void updateHistory(Context context, String title, String url, long date) { if (url.equals("")) { return; } ContentResolver cr = context.getContentResolver(); String whereClause = HistoryColumns_URL + " = \'"+url+"\'"; ContentValues values = new ContentValues(); values.put(HistoryColumns_TITTLE, title); values.put(HistoryColumns_URL, url); values.put(HistoryColumns_DATE, date); cr.update(HistoryProvider.CONTENT_URI, values, whereClause, null); } }
[ "xbee@outlook.com" ]
xbee@outlook.com
cfe12da33f94bdd950bc84598d107256c6c16d9e
fb80e331f663f935999e416371e0cc8acfbb9713
/src/java/test/org/burroloco/butcher/fixture/database/InputDatabase.java
11ebd1f7d36644e68e96a44a1923c7a8cff1f2f0
[]
no_license
steshaw/donkey
8801340ec70e6a1b7ef8f7f7dd5570ed2326355d
8924e3d3da73c99ce748a4b123679b58f5053446
refs/heads/master
2021-08-28T04:49:25.708634
2017-12-11T07:55:02
2017-12-11T07:55:02
113,810,954
0
0
null
null
null
null
UTF-8
Java
false
false
105
java
package org.burroloco.butcher.fixture.database; public interface InputDatabase extends TestDatabase { }
[ "damien.bastin@gmail.com" ]
damien.bastin@gmail.com
e11a316e1022fb58cc9f00790ce9fbddc1544500
21c2bdbfe3d941d05e7bd46eee35f4f27dc6317d
/src/enums/EnumTest.java
87c336d6bf1fbdd5c865386d36963920195ebffa
[]
no_license
YHJ765/Test1
a421962061d74f0e1dd17a7a3efae8f3a1fdf62d
98e89b77a3c668e23598a7ad09242acc9d39aafa
refs/heads/master
2022-07-09T07:14:02.885277
2020-05-19T03:51:06
2020-05-19T03:51:06
257,187,373
1
0
null
null
null
null
UTF-8
Java
false
false
813
java
package enums; import java.util.*; public class EnumTest { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.println("Enter a size: (SMALL, MEDIUM, LARGE, EXTRA_LARGE)"); String input = in.next().toUpperCase(); Size size = Enum.valueOf(Size.class, input); System.out.println("size= " + size); System.out.println("abbreviation=" + size.getAbbreviation()); if(size == Size.EXTRA_LARGE) System.out.println("Good job-- you paid attention to the _."); } } enum Size { SMALL("S"), MEDIUM("M"), LARGE("L"), EXTRA_LARGE("XL"); private Size(String abbreviation){this.abbreviation = abbreviation;} public String getAbbreviation(){return abbreviation;} private String abbreviation; }
[ "765815153@qq.com" ]
765815153@qq.com
f99b29a88cd96040060ec266738684155c713e45
b8fae593d9345878897c12fae333c49bf437ffd4
/workspace/Week5/src/key/main.java
a9d7c2a7bff84517aca8375eacaa6cd8581b580b
[]
no_license
Alfxjx/JavaGym
97bb2aafe9a6aef495f9e17808df1c486c80552b
b3fb919c363f9291ad2b4e09e60f0f9964fe226c
refs/heads/master
2020-04-01T00:07:29.417540
2018-12-09T14:37:12
2018-12-09T14:37:12
152,682,891
0
0
null
null
null
null
GB18030
Java
false
false
1,747
java
package key; import java.util.Scanner; public class main{ private static void print(int[] c){ boolean Firstexist =false; for(int i = c.length-1; i>=0; i--) { if(c[i] !=0) { if(Firstexist &&c[i] >0)//判断是否为首位数 ,不需加符号 { System.out.print("+"); } if(c[i] !=1) //系数 != 1, 输出 { System.out.print(c[i]); if(i>0) //有x { System.out.print("x"); if(i!=1)//如次数为1,则省略,大余1则输出 { System.out.print(i); } } }else //系数 ==1 { System.out.print("x"); if(i!=1)//如次数为1,则省略,大余1则输出 { System.out.print(i); } } Firstexist = true;//进入一次则有输出,有了首位数. } } if(!Firstexist) { System.out.print(0); //如果此时未输出有较数字,输出0 } } public static void main(String [] args){ Scanner scan = new Scanner(System.in); int[] c = new int[101]; int t,k; for(int flags=0;flags<2 ;flags++) { do{ t =scan.nextInt(); k = scan.nextInt(); c[t] += k; }while(t!=0); } print(c); } }
[ "noreply@github.com" ]
noreply@github.com
715063cb6b7e4d2322461b6dd0928a45c3581d1d
24abd9fbc8399429020b25bf4242246499563e81
/实验数据和结果/kGenProg/kGenProg-File/Chart/21b/patch-seed5/patch-v22/org.jfree.data.Range.java
0dee81d6af9bed5f576391e59c631d8fb2989ddd
[]
no_license
RitaRuan/defects4j-repair
0dfc56809b96df0d7757918b388be1134892e23b
3b6fa4817dfd675765cd17f20ee7c83967ab06b7
refs/heads/main
2023-05-11T20:22:45.519984
2021-06-03T12:31:47
2021-06-03T12:31:47
330,844,690
2
0
null
null
null
null
UTF-8
Java
false
false
11,317
java
/* =========================================================== * JFreeChart : a free chart library for the Java(tm) platform * =========================================================== * * (C) Copyright 2000-2006, by Object Refinery Limited and Contributors. * * Project Info: http://www.jfree.org/jfreechart/index.html * * 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. * * 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. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, * USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * ---------- * Range.java * ---------- * (C) Copyright 2002-2006, by Object Refinery Limited and Contributors. * * Original Author: David Gilbert (for Object Refinery Limited); * Contributor(s): Chuanhao Chiu; * Bill Kelemen; * Nicolas Brodu; * * $Id: Range.java,v 1.6.2.2 2006/01/11 11:27:34 mungady Exp $ * * Changes (from 23-Jun-2001) * -------------------------- * 22-Apr-2002 : Version 1, loosely based by code by Bill Kelemen (DG); * 30-Apr-2002 : Added getLength() and getCentralValue() methods. Changed * argument check in constructor (DG); * 13-Jun-2002 : Added contains(double) method (DG); * 22-Aug-2002 : Added fix to combine method where both ranges are null, thanks * to Chuanhao Chiu for reporting and fixing this (DG); * 07-Oct-2002 : Fixed errors reported by Checkstyle (DG); * 26-Mar-2003 : Implemented Serializable (DG); * 14-Aug-2003 : Added equals() method (DG); * 27-Aug-2003 : Added toString() method (BK); * 11-Sep-2003 : Added Clone Support (NB); * 23-Sep-2003 : Fixed Checkstyle issues (DG); * 25-Sep-2003 : Oops, Range immutable, clone not necessary (NB); * 05-May-2004 : Added constrain() and intersects() methods (DG); * 18-May-2004 : Added expand() method (DG); * ------------- JFreeChart 1.0.0 --------------------------------------------- * 11-Jan-2006 : Added new method expandToInclude(Range, double) (DG); * */ package org.jfree.data; import java.io.Serializable; /** * Represents an immutable range of values. */ public strictfp class Range implements Serializable { /** For serialization. */ private static final long serialVersionUID = -906333695431863380L; /** The lower bound of the range. */ private double lower; /** The upper bound of the range. */ private double upper; /** * Creates a new range. * * @param lower the lower bound (must be <= upper bound). * @param upper the upper bound (must be >= lower bound). */ public Range(double lower, double upper) { if (lower > upper) this.lower = lower; this.upper = upper; } /** * Returns the lower bound for the range. * * @return The lower bound. */ public double getLowerBound() { return this.lower; } /** * Returns the upper bound for the range. * * @return The upper bound. */ public double getUpperBound() { return this.upper; } /** * Returns the length of the range. * * @return The length. */ public double getLength() { return this.upper - this.lower; } /** * Returns the central value for the range. * * @return The central value. */ public double getCentralValue() { return this.lower / 2.0 + this.upper / 2.0; } /** * Returns <code>true</code> if the range contains the specified value and * <code>false</code> otherwise. * * @param value the value to lookup. * * @return <code>true</code> if the range contains the specified value. */ public boolean contains(double value) { return (value >= this.lower && value <= this.upper); } /** * Returns <code>true</code> if the range intersects with the specified * range, and <code>false</code> otherwise. * * @param b0 the lower bound (should be <= b1). * @param b1 the upper bound (should be >= b0). * * @return A boolean. */ public boolean intersects(double b0, double b1) { if (b0 <= this.lower) { return (b1 > this.lower); } else { return (b0 < this.upper && b1 >= b0); } } /** * Returns the value within the range that is closest to the specified * value. * * @param value the value. * * @return The constrained value. */ public double constrain(double value) { double result = value; if (!contains(value)) { if (value > this.upper) { result = this.upper; } else if (value < this.lower) { result = this.lower; } } return result; } /** * Creates a new range by combining two existing ranges. * <P> * Note that: * <ul> * <li>either range can be <code>null</code>, in which case the other * range is returned;</li> * <li>if both ranges are <code>null</code> the return value is * <code>null</code>.</li> * </ul> * * @param range1 the first range (<code>null</code> permitted). * @param range2 the second range (<code>null</code> permitted). * * @return A new range (possibly <code>null</code>). */ public static Range combine(Range range1, Range range2) { if (range1 == null) { return range2; } else { if (range2 == null) { return range1; } else { double l = Math.min(range1.getLowerBound(), range2.getLowerBound()); double u = Math.max(range1.getUpperBound(), range2.getUpperBound()); return new Range(l, u); } } } /** * Returns a range that includes all the values in the specified * <code>range</code> AND the specified <code>value</code>. * * @param range the range (<code>null</code> permitted). * @param value the value that must be included. * * @return A range. * * @since 1.0.1 */ public static Range expandToInclude(Range range, double value) { if (range == null) { return new Range(value, value); } if (value < range.getLowerBound()) { return new Range(value, range.getUpperBound()); } else if (value > range.getUpperBound()) { return new Range(range.getLowerBound(), value); } else { return range; } } /** * Creates a new range by adding margins to an existing range. * * @param range the range (<code>null</code> not permitted). * @param lowerMargin the lower margin (expressed as a percentage of the * range length). * @param upperMargin the upper margin (expressed as a percentage of the * range length). * * @return The expanded range. */ public static Range expand(Range range, double lowerMargin, double upperMargin) { if (range == null) { throw new IllegalArgumentException("Null 'range' argument."); } double length = range.getLength(); double lower = length * lowerMargin; double upper = length * upperMargin; return new Range(range.getLowerBound() - lower, range.getUpperBound() + upper); } /** * Shifts the range by the specified amount. * * @param base the base range. * @param delta the shift amount. * * @return A new range. */ public static Range shift(Range base, double delta) { return shift(base, delta, false); } /** * Shifts the range by the specified amount. * * @param base the base range. * @param delta the shift amount. * @param allowZeroCrossing a flag that determines whether or not the * bounds of the range are allowed to cross * zero after adjustment. * * @return A new range. */ public static Range shift(Range base, double delta, boolean allowZeroCrossing) { if (allowZeroCrossing) { return new Range(base.getLowerBound() + delta, base.getUpperBound() + delta); } else { return new Range(shiftWithNoZeroCrossing(base.getLowerBound(), delta), shiftWithNoZeroCrossing(base.getUpperBound(), delta)); } } /** * Returns the given <code>value</code> adjusted by <code>delta</code> but * with a check to prevent the result from crossing <code>0.0</code>. * * @param value the value. * @param delta the adjustment. * * @return The adjusted value. */ private static double shiftWithNoZeroCrossing(double value, double delta) { if (value > 0.0) { return Math.max(value + delta, 0.0); } else if (value < 0.0) { return Math.min(value + delta, 0.0); } else { return value + delta; } } /** * Tests this object for equality with an arbitrary object. * * @param obj the object to test against (<code>null</code> permitted). * * @return A boolean. */ public boolean equals(Object obj) { if (!(obj instanceof Range)) { return false; } Range range = (Range) obj; if (!(this.lower == range.lower)) { return false; } if (!(this.upper == range.upper)) { return false; } return true; } /** * Returns a hash code. * * @return A hash code. */ public int hashCode() { int result; long temp; temp = Double.doubleToLongBits(this.lower); result = (int) (temp ^ (temp >>> 32)); temp = Double.doubleToLongBits(this.upper); result = 29 * result + (int) (temp ^ (temp >>> 32)); return result; } /** * Returns a string representation of this Range. * * @return A String "Range[lower,upper]" where lower=lower range and * upper=upper range. */ public String toString() { return ("Range[" + this.lower + "," + this.upper + "]"); } }
[ "1193563986@qq.com" ]
1193563986@qq.com
e5a1d3e93f25a1144cb8d25c03d00c64baf46642
d68b6e200de489651d0335835ddadd803405be51
/chicken-manage/src/main/java/io/renren/chick/chicken/service/MaterialService.java
e8411e1e346b0196b6d20fdb6ad214b2f673680b
[ "Apache-2.0" ]
permissive
XiangHuaZheng/ChickenManage
a9bdbd621d188ba6a08b4fd7700f936e28dbc3f7
af38f30b13e4957cc641e89eedbb3aeadf461081
refs/heads/master
2023-01-05T15:52:15.071616
2020-10-22T04:04:02
2020-10-22T04:04:02
299,990,380
5
1
null
null
null
null
UTF-8
Java
false
false
454
java
package io.renren.chick.chicken.service; import com.baomidou.mybatisplus.extension.service.IService; import io.renren.common.utils.PageUtils; import io.renren.chick.chicken.entity.MaterialEntity; import java.util.Map; /** * 原料信息 * * @author zhengXiangHua * @email 912358463@qq.com * @date 2020-10-01 15:30:45 */ public interface MaterialService extends IService<MaterialEntity> { PageUtils queryPage(Map<String, Object> params); }
[ "912358463@qq.com" ]
912358463@qq.com
a11e860aba81eb67d279507920d9e1e12523d1b3
53b6d1a859ff1989b0c0d1f3bc5224052a89c392
/src/test/java/businesslogic/processmngbl/noticebl/NoticeControllerTest.java
166201ce674621264a77bf24e8a9d4e2a454a7fc
[]
no_license
jingl-skywalker/njwu-css
3868041f61c20e52414ef539370187d3724acbfe
ef5ce0611c10ae0152c286e17fc033952cc6d923
refs/heads/master
2021-01-22T09:27:03.276955
2013-11-30T12:03:02
2013-11-30T12:03:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,495
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package businesslogic.processmngbl.noticebl; import junit.framework.TestCase; import businesslogicservice.processmngblservice.notice.ROLE; import static junit.framework.Assert.assertEquals; import vo.processmngvo.NoticeVO; /** * * @author Administrator */ public class NoticeControllerTest extends TestCase { NoticeController instance; NoticeUIDriver nuid; public NoticeControllerTest(String testName) { super(testName); } @Override protected void setUp() throws Exception { super.setUp(); instance = new NoticeController(); nuid = new NoticeUIDriver(instance); } @Override protected void tearDown() throws Exception { super.tearDown(); } /** * Test of send method, of class NoticeController. */ public void testSend_NoticeVO_ROLE() { System.out.println("send"); NoticeVO nvo = null; ROLE role = null; instance = new NoticeController(); boolean expResult = false; // boolean result = instance.send(nvo, role); // assertEquals(expResult, result); assertEquals(true, true); // TODO review the generated test code and remove the default call to fail. // fail("The test case is a prototype."); } /** * Test of send method, of class NoticeController. */ public void testSend_NoticeVO() { System.out.println("send"); NoticeVO nvo = null; instance = new NoticeController(); boolean expResult = false; // boolean result = instance.send(nvo); assertEquals(true, true); // assertEquals(expResult, result); // TODO review the generated test code and remove the default call to fail. // fail("The test case is a prototype."); } /** * Test of getNoticeList method, of class NoticeController. */ public void testGetNoticeList_0args() { System.out.println("getNoticeList"); instance = new NoticeController(); NoticeList expResult = null; // NoticeList result = instance.getNoticeList(); assertEquals(true, true); // assertEquals(expResult, result); // TODO review the generated test code and remove the default call to fail. // fail("The test case is a prototype."); } /** * Test of getNoticeList method, of class NoticeController. */ public void testGetNoticeList_ROLE() { System.out.println("getNoticeList"); ROLE role = null; instance = new NoticeController(); NoticeList expResult = null; // NoticeList result = instance.getNoticeList(role); assertEquals(true, true); // assertEquals(expResult, result); // TODO review the generated test code and remove the default call to fail. // fail("The test case is a prototype."); } /** * Test of getNoice method, of class NoticeController. */ public void testGetNoice() { System.out.println("getNoice"); int inde = 0; instance = new NoticeController(); NoticeVO expResult = null; // NoticeVO result = instance.getNoice(inde); assertEquals(true, true); // assertEquals(expResult, result); // TODO review the generated test code and remove the default call to fail. // fail("The test case is a prototype."); } }
[ "329632909@qq.com" ]
329632909@qq.com
0e19d405ce5ae94824a62ee8c7e457aefd10143b
da524cbaabf869f0c5c3e47318cde64e989a32e0
/pig-admin-service/src/main/java/com/huigege/pig/admin/dto/RouteConfig.java
6d6d3bc327a9da9d4d9b6bd3e53448622f98667d
[]
no_license
AaronQx/pig-my-test
0f2cbd6f2d478bf5514b0bf42760972303650b0a
23e94229426f72be75e3776c8ce73340cc7c8f85
refs/heads/master
2021-05-06T09:45:25.049250
2017-12-13T03:16:48
2017-12-13T03:16:48
114,067,597
0
0
null
null
null
null
UTF-8
Java
false
false
3,488
java
package com.huigege.pig.admin.dto; import java.io.Serializable; import java.util.Map; /** * @author lengleng * @date 2017/11/7 */ public class RouteConfig implements Serializable{ // @com.alibaba.fastjson.annotation.JSONField(name = "path") // private String path; // @com.alibaba.fastjson.annotation.JSONField(name = "component") // private String component; // @com.alibaba.fastjson.annotation.JSONField(name = "name") // private String name; // @com.alibaba.fastjson.annotation.JSONField(name = "components") // private String components; // @com.alibaba.fastjson.annotation.JSONField(name = "redirect") // private String redirect; // @com.alibaba.fastjson.annotation.JSONField(name = "props") // private String props; // @com.alibaba.fastjson.annotation.JSONField(name = "alias") // private String alias; // @com.alibaba.fastjson.annotation.JSONField(name = "children") // private String children; // @com.alibaba.fastjson.annotation.JSONField(name = "beforeEnter") // private String beforeEnter; // @com.alibaba.fastjson.annotation.JSONField(name = "meta") // private Map<String,String> meta; // @com.alibaba.fastjson.annotation.JSONField(name = "caseSensitive") // private Boolean caseSensitive; // @com.alibaba.fastjson.annotation.JSONField(name = "pathToRegexpOptions") // private String pathToRegexpOptions; // // public String getPath() { // return path; // } // // public void setPath(String path) { // this.path = path; // } // // public String getComponent() { // return component; // } // // public void setComponent(String component) { // this.component = component; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getComponents() { // return components; // } // // public void setComponents(String components) { // this.components = components; // } // // public String getRedirect() { // return redirect; // } // // public void setRedirect(String redirect) { // this.redirect = redirect; // } // // public String getProps() { // return props; // } // // public void setProps(String props) { // this.props = props; // } // // public String getAlias() { // return alias; // } // // public void setAlias(String alias) { // this.alias = alias; // } // // public String getChildren() { // return children; // } // // public void setChildren(String children) { // this.children = children; // } // // public String getBeforeEnter() { // return beforeEnter; // } // // public void setBeforeEnter(String beforeEnter) { // this.beforeEnter = beforeEnter; // } // // public Map<String, String> getMeta() { // return meta; // } // // public void setMeta(Map<String, String> meta) { // this.meta = meta; // } // // public Boolean isCaseSensitive() { // return caseSensitive; // } // // public void setCaseSensitive(Boolean caseSensitive) { // this.caseSensitive = caseSensitive; // } // // public String getPathToRegexpOptions() { // return pathToRegexpOptions; // } // // public void setPathToRegexpOptions(String pathToRegexpOptions) { // this.pathToRegexpOptions = pathToRegexpOptions; // } }
[ "lpz@newzqxq.com" ]
lpz@newzqxq.com
c887a48958184bedc2ee4045a4726e1a8ef64a40
814169b683b88f1b7498f1edf530a8d1bec2971f
/mall-auth/src/main/java/com/bootx/mall/auth/service/impl/AreaServiceImpl.java
a0afcb66feeff1dabdfb9d662e0f01fca23f79bb
[]
no_license
springwindyike/mall-auth
fe7f216c7241d8fd9247344e40503f7bc79fe494
3995d258955ecc3efbccbb22ef4204d148ec3206
refs/heads/master
2022-10-20T15:12:19.329363
2020-07-05T13:04:29
2020-07-05T13:04:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,930
java
package com.bootx.mall.auth.service.impl; import java.util.List; import javax.inject.Inject; import com.bootx.mall.auth.dao.AreaDao; import com.bootx.mall.auth.entity.Area; import com.bootx.mall.auth.service.AreaService; import org.springframework.cache.annotation.CacheEvict; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.Assert; /** * Service - 地区 * * @author BOOTX Team * @version 6.1 */ @Service public class AreaServiceImpl extends BaseServiceImpl<Area, Long> implements AreaService { @Inject private AreaDao areaDao; @Override @Transactional(readOnly = true) public List<Area> findRoots() { return areaDao.findRoots(null); } @Override @Transactional(readOnly = true) public List<Area> findRoots(Integer count) { return areaDao.findRoots(count); } @Override @Transactional(readOnly = true) public List<Area> findParents(Area area, boolean recursive, Integer count) { return areaDao.findParents(area, recursive, count); } @Override @Transactional(readOnly = true) public List<Area> findChildren(Area area, boolean recursive, Integer count) { return areaDao.findChildren(area, recursive, count); } @Override @Transactional @CacheEvict(value = "areaPage", allEntries = true) public Area save(Area area) { Assert.notNull(area, "[Assertion failed] - area is required; it must not be null"); setValue(area); return super.save(area); } @Override @Transactional @CacheEvict(value = "areaPage", allEntries = true) public Area update(Area area) { Assert.notNull(area, "[Assertion failed] - area is required; it must not be null"); setValue(area); for (Area children : areaDao.findChildren(area, true, null)) { setValue(children); } return super.update(area); } @Override @Transactional @CacheEvict(value = "areaPage", allEntries = true) public Area update(Area area, String... ignoreProperties) { return super.update(area, ignoreProperties); } @Override @Transactional @CacheEvict(value = "areaPage", allEntries = true) public void delete(Long id) { super.delete(id); } @Override @Transactional @CacheEvict(value = "areaPage", allEntries = true) public void delete(Long... ids) { super.delete(ids); } @Override @Transactional @CacheEvict(value = "areaPage", allEntries = true) public void delete(Area area) { super.delete(area); } /** * 设置值 * * @param area * 地区 */ private void setValue(Area area) { if (area == null) { return; } Area parent = area.getParent(); if (parent != null) { area.setFullName(parent.getFullName() + area.getName()); area.setTreePath(parent.getTreePath() + parent.getId() + Area.TREE_PATH_SEPARATOR); } else { area.setFullName(area.getName()); area.setTreePath(Area.TREE_PATH_SEPARATOR); } area.setGrade(area.getParentIds().length); } }
[ "a12345678" ]
a12345678
8f0d8a29280acb93ccfb448fc6cbf2ce048b21d5
1931c95e6308b8cb9b13c4077db16e95cb7c041b
/common_base_databing/src/main/java/com/goldze/common/dmvvm/utils/log/BaseLog.java
a55e399c254e6f08d8e4f592378ecb4f741bf7e6
[]
no_license
965310001/MPS
73f766ed29b4d0db080723607f432ef50f438d95
406a261b3bf7a4b3e97c404a55559cd769f9eb5f
refs/heads/master
2020-04-30T21:04:05.171587
2019-06-21T10:28:14
2019-06-21T10:28:14
177,085,675
3
0
null
null
null
null
UTF-8
Java
false
false
1,349
java
package com.goldze.common.dmvvm.utils.log; import android.util.Log; /** * Created by zhaokaiqiang on 15/11/18. */ public class BaseLog { private static final int MAX_LENGTH = 4000; public static void printDefault(int type, String tag, String msg) { int index = 0; int length = msg.length(); int countOfSub = length / MAX_LENGTH; if (countOfSub > 0) { for (int i = 0; i < countOfSub; i++) { String sub = msg.substring(index, index + MAX_LENGTH); printSub(type, tag, sub); index += MAX_LENGTH; } printSub(type, tag, msg.substring(index, length)); } else { printSub(type, tag, msg); } } private static void printSub(int type, String tag, String sub) { switch (type) { case QLog.V: Log.v(tag, sub); break; case QLog.D: Log.d(tag, sub); break; case QLog.I: Log.i(tag, sub); break; case QLog.W: Log.w(tag, sub); break; case QLog.E: Log.e(tag, sub); break; case QLog.A: Log.wtf(tag, sub); break; } } }
[ "965310001@qq.com" ]
965310001@qq.com
8632f363be73ea26750b912d0d8d78c27fe3bac5
0848f910be03aed795d83f0292a67736302116d1
/src/cn/itcast/store/domain/Cart.java
6b56ade99343ebd4cda860043051810b9adf646c
[]
no_license
SsM479/store_v5
33adc6313bdc3dde6cde70f38ab635fcad7912b9
7942eae196fda9125d4a534caf0d1d60718f5dad
refs/heads/master
2020-05-21T14:38:38.684340
2019-05-11T04:04:59
2019-05-11T04:04:59
186,085,759
0
0
null
null
null
null
UTF-8
Java
false
false
2,136
java
package cn.itcast.store.domain; import java.util.Collection; import java.util.HashMap; import java.util.Map; public class Cart { // 个数不确定的购物项 商品pid<==>CartItem Map<String,CartItem> map = new HashMap<String,CartItem>(); double total = 0; //总计/积分 //添加购物项到购物车 //当用户点击加入购物车按钮,可以将当前要购买的商品id,商品数量发送到服务端,服务端根据商品id查询到商品信息 //有了商品信息Product对象,有了要购买商品数量,当前的购物项也就可以获取到了 public void addCartItemToCart(CartItem newCartItem) { //获取到正在向购物车中添加的商品的pid String pid = newCartItem.getProduct().getPid(); //将当前的购物项加入购物车之前,判断之前是否买过这类商品 //如果没有买过 list.add(cartItem) //如果买过:获取到原先的数量,获取到本次的属相,相加之后设置到原先购物项上 if(map.containsKey(pid)) { //购物车已有该商品 //获取到原先的购物项 CartItem oldCartItem = map.get(pid); oldCartItem.setNum(oldCartItem.getNum() + newCartItem.getNum()); }else { //购物车没有该商品 map.put(pid, newCartItem); } } //返回map中所有的值 public Collection<CartItem> getCartItems() { return map.values(); } //移除购物项 public void removeCartItem(String pid) { map.remove(pid); } //清空购物车 public void clearCart() { map.clear(); } public Map<String, CartItem> getMap() { return map; } public void setMap(Map<String, CartItem> map) { this.map = map; } // 总计可以经过计算得到 public double getTotal() { //总计清0 total = 0; //获取到map中所有的购物项 Collection<CartItem> allCartItem = map.values(); //遍历所有的购物项,将购物项上的小计相加 for (CartItem cartItem : allCartItem) { total += cartItem.getSubTotal(); } return total; } public void setTotal(double total) { this.total = total; } }
[ "479372360@qq.com" ]
479372360@qq.com
dcb23532e1b1fe0d39160c3558cd16144abd3fc6
6505f539a87b874abaa980b132a63507c3530f3b
/src/main/java/hibernate/dao/impl/PackagesDaoImpl.java
af95983334554fc19d234daaa0bcb0dddf6dcabb
[]
no_license
Sviatoslav-Tymoshchuk/tour_database
963847420d41d8233fbe9b7333e2f625864b0d43
d590fa4da2d5e2258afed041583b074721a1711a
refs/heads/master
2020-04-30T01:47:05.468907
2019-03-19T15:10:24
2019-03-19T15:10:24
176,538,826
0
0
null
null
null
null
UTF-8
Java
false
false
2,383
java
package hibernate.dao.impl; import hibernate.dao.PackagesDao; import hibernate.model.Package; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import java.util.List; public class PackagesDaoImpl implements PackagesDao { private final SessionFactory sessionFactory; public PackagesDaoImpl(SessionFactory sessionFactory){ this.sessionFactory = sessionFactory; } @Override public List<Package> findAll() { try (Session session = sessionFactory.openSession()) { List<Package> packageList = session.createQuery("from Package", Package.class).list(); packageList.forEach(System.out::println); return packageList; } } @Override public Package getPackageById(String id) { Transaction transaction = null; try (Session session = sessionFactory.openSession()) { transaction = session.beginTransaction(); Package packAge = session.load(Package.class, id); System.out.println(packAge); transaction.commit(); return packAge; } catch (Exception e) { if (transaction != null) { transaction.rollback(); } e.printStackTrace(); return null; } } @Override public boolean insertPackage(Package packAge) { Transaction transaction = null; try (Session session = sessionFactory.openSession()) { transaction = session.beginTransaction(); session.save(packAge); transaction.commit(); return true; } catch (Exception e) { if (transaction != null) { transaction.rollback(); } e.printStackTrace(); return false; } } @Override public boolean deletePackage(String id) { Transaction transaction = null; try (Session session = sessionFactory.openSession()) { transaction = session.beginTransaction(); session.delete(deletePackage(id)); transaction.commit(); return true; } catch (Exception e) { if (transaction != null) { transaction.rollback(); } e.printStackTrace(); return false; } } }
[ "swiatoslaw_tymoszczuk@hotmail.com" ]
swiatoslaw_tymoszczuk@hotmail.com
5e5085898f36f45b81ad986f8e383ab4cd91d408
5765550f57af83ecaff8cdbe4270f552ffb4c34e
/src/code/FollowStrategy.java
235fd5aa97aec37f7401934c0442d0c1ea369de1
[]
no_license
shreypatel11/pirate-ship-game
859c22dc39572fdfdba0689b1c45af6ac52a23b5
35140f2cc00e218cf6985259585ad66192282b6b
refs/heads/master
2020-06-08T03:02:14.542086
2019-06-21T19:19:30
2019-06-21T19:19:30
193,147,308
0
0
null
null
null
null
UTF-8
Java
false
false
1,646
java
package code; import java.awt.Point; public class FollowStrategy implements ChaseStrategy { //follows CC ship around OceanMap oceanMap; public FollowStrategy(int dimensions, int islandCount) { oceanMap = OceanMap.getInstance(dimensions, islandCount); } public Point chase(Point pirateLoc, Point shipLoc) { if(pirateLoc.x > shipLoc.x) { //changed goEast() and goWest() so the ship would move around islands a little easier if(pirateLoc.x >0 && oceanMap.isOcean(pirateLoc.x-1, pirateLoc.y)){ pirateLoc.x--; } else { if(pirateLoc.y > shipLoc.y) { this.goNorth(pirateLoc); } else if(pirateLoc.y < shipLoc.y) { this.goSouth(pirateLoc); } } } else if(pirateLoc.x < shipLoc.x) { if(pirateLoc.x<oceanMap.getDimensions()-1 && oceanMap.isOcean(pirateLoc.x+1, pirateLoc.y)){ pirateLoc.x++; } else { if(pirateLoc.y > shipLoc.y) { this.goNorth(pirateLoc); } else if(pirateLoc.y < shipLoc.y) { this.goSouth(pirateLoc); } } } else if(pirateLoc.y > shipLoc.y) { this.goNorth(pirateLoc); } else if(pirateLoc.y < shipLoc.y) { this.goSouth(pirateLoc); } if(pirateLoc.x == shipLoc.x && pirateLoc.y == shipLoc.y) { System.out.println("Your ship has been caught!"); //used for test, alert pops up if caught now } return pirateLoc; } public void goNorth(Point pirateLoc) { if(pirateLoc.y>0 && oceanMap.isOcean(pirateLoc.x, pirateLoc.y-1)){ pirateLoc.y--; } } public void goSouth(Point pirateLoc) { if(pirateLoc.y<oceanMap.getDimensions()-1 && oceanMap.isOcean(pirateLoc.x, pirateLoc.y+1)){ pirateLoc.y++; } } }
[ "shreypatel11@github.com" ]
shreypatel11@github.com
ed629924cbd469ebf80e1d5cf08a815db75c80b4
30fd21a00f5276edef41c97a6eb4b84cd386634d
/2ano/2semestre/POO/POO-teste/POO-Ferraz/Veiculo.java
081e75fb47d5f8a4204b8f4bb47b2528557ca3b4
[]
no_license
JoaoPalmeira/MaterialLicenciaturaMIEINF
00b4639cb6ac0c094437e1bccc6c58e725757577
1f1d59e9010ad18e02e5dfb3b597330054e681a3
refs/heads/master
2020-07-02T12:05:37.430589
2019-08-09T18:25:42
2019-08-09T18:25:42
201,519,160
3
0
null
null
null
null
UTF-8
Java
false
false
4,079
java
public class Veiculo { // Variáveis de Instância private String matricula; private double kmsTotal; private double kmsParcial; private int capacidade; private int conteudo; private double consumoMedio; // Construtores public Veiculo() { this.matricula = "aa-00-00"; this.kmsTotal = 0; this.kmsParcial = 0; this.capacidade = 0; this.conteudo = 0; this.consumoMedio = 0; } public Veiculo(String matricula, double kmsTotal, double kmsParcial, int conteudo, int capacidade, double consumoMedio){ this.matricula = matricula; this.kmsTotal = kmsTotal; this.kmsParcial = kmsParcial; this.capacidade = capacidade; this.conteudo = conteudo; this.consumoMedio = consumoMedio; } public Veiculo(Veiculo veiculo){ this.matricula = veiculo.getMatricula(); this.kmsTotal = veiculo.getKmsTotal(); this.kmsParcial = veiculo.getKmsParcial(); this.capacidade = veiculo.getCapacidade(); this.conteudo = veiculo.getConteudo(); this.consumoMedio = veiculo.getConsumoMedio(); } // Métodos de Instância public String getMatricula(){ return this.matricula; } public double getKmsTotal(){ return this.kmsTotal; } public double getKmsParcial(){ return this.kmsParcial; } public int getCapacidade(){ return this.capacidade; } public int getConteudo(){ return this.conteudo; } public double getConsumoMedio(){ return this.consumoMedio; } public void setMatricula(String matricula){ this.matricula = matricula; } public void setKmsTotal(double kmsTotal){ this.kmsTotal = kmsTotal; } public void setKmsParcial(double kmsParcial){ this.kmsParcial = kmsParcial; } public void setCapacidade(int capacidade){ this.capacidade = capacidade; } public void setConteudo(int conteudo){ this.conteudo = conteudo; } public void setConsumoMedio(double consumoMedio){ this.consumoMedio = consumoMedio; } public boolean equals(Object o){ if (o == this) return true; if (o == null || o.getClass() != this.getClass()) return false; Veiculo n = (Veiculo) o; return n.getMatricula().equals(this.matricula) && n.getKmsTotal() == kmsTotal && n.getKmsParcial() == kmsParcial && n.getCapacidade() == capacidade && n.getConteudo() == conteudo && n.getConsumoMedio() == consumoMedio; } public String toString (){ return matricula+" "+kmsTotal+" "+kmsParcial+" "+capacidade+" "+conteudo+" "+consumoMedio; } public Veiculo clone(){ return new Veiculo(this); } // Exercícios public void abastecer(int litros){ if (litros + this.getConteudo() > this.getCapacidade()) this.setConteudo(this.getCapacidade()); else this.setConteudo(litros + this.getConteudo()); } public void resetKms(){ this.setKmsParcial (0); this.setConsumoMedio (0); } public double autonomia(){ return (this.getConteudo() * 100 / this.getConsumoMedio()); } public void registarViagem(int kms, double consumo){ double c = this.getConsumoMedio() * this.getKmsParcial() / 100 + consumo; this.setKmsParcial (this.getKmsParcial() + kms); this.setConsumoMedio (c / this.getKmsParcial() * 100); this.setConteudo (this.getConteudo() - (int) consumo); this.setKmsTotal (this.getKmsTotal() + kms); } public boolean naReserva(){ return (this.getConteudo() < 10); } public double totalCombustivel (double custoLitro){ return this.getKmsTotal() * this.getConsumoMedio() / 100 * custoLitro; } public double custoMedioKm (double custoLitro){ return this.getConsumoMedio() / 100 * custoLitro; } }
[ "a73864@alunos.uminho.pt" ]
a73864@alunos.uminho.pt
b13442df8820a0374fdbb7925607908363db3f78
5a99e84f149d373e6d90dacd2a5a2d548b435a10
/src/main/java/com/bergerkiller/generated/net/minecraft/server/MobEffectListHandle.java
a4c5236f83bf9693fbd6396f682ea399a3da7e97
[ "LicenseRef-scancode-other-permissive" ]
permissive
sgdc3/BKCommonLib
640c87ff15b380b9b7999e29c0f56fceddbae324
2f8af12a370105f97f26f0b3d3698e9aae77e51d
refs/heads/master
2020-04-05T23:09:55.433812
2018-11-20T20:32:32
2018-11-20T20:32:32
158,454,047
1
0
null
2018-11-20T21:34:35
2018-11-20T21:34:35
null
UTF-8
Java
false
false
1,845
java
package com.bergerkiller.generated.net.minecraft.server; import com.bergerkiller.mountiplex.reflection.util.StaticInitHelper; import com.bergerkiller.mountiplex.reflection.declarations.Template; /** * Instance wrapper handle for type <b>net.minecraft.server.MobEffectList</b>. * To access members without creating a handle type, use the static {@link #T} member. * New handles can be created from raw instances using {@link #createHandle(Object)}. */ public abstract class MobEffectListHandle extends Template.Handle { /** @See {@link MobEffectListClass} */ public static final MobEffectListClass T = new MobEffectListClass(); static final StaticInitHelper _init_helper = new StaticInitHelper(MobEffectListHandle.class, "net.minecraft.server.MobEffectList"); /* ============================================================================== */ public static MobEffectListHandle createHandle(Object handleInstance) { return T.createHandle(handleInstance); } /* ============================================================================== */ public static int getId(MobEffectListHandle mobeffectlist) { return T.getId.invoke(mobeffectlist); } public static MobEffectListHandle fromId(int id) { return T.fromId.invoke(id); } /** * Stores class members for <b>net.minecraft.server.MobEffectList</b>. * Methods, fields, and constructors can be used without using Handle Objects. */ public static final class MobEffectListClass extends Template.Class<MobEffectListHandle> { public final Template.StaticMethod.Converted<Integer> getId = new Template.StaticMethod.Converted<Integer>(); public final Template.StaticMethod.Converted<MobEffectListHandle> fromId = new Template.StaticMethod.Converted<MobEffectListHandle>(); } }
[ "irmo.vandenberge@ziggo.nl" ]
irmo.vandenberge@ziggo.nl
0c8d19d77ea390029bc1f1cbc022c9df2893d36c
eea495d843197b2dc0a7bdda1e0d59b2757a2472
/src/ru/u2r3y/java1/Pr2/Ex1/Main.java
636900f8333b2685b9521e115f18c138428e814c
[]
no_license
1u2r3y/JAVA2020
ab12c4342dc1fa75af5fccefc38d479e895f0471
9618b82f7a238bc6eaa500b577d8ea9131753bf1
refs/heads/master
2023-01-28T07:42:44.853769
2020-12-07T09:08:21
2020-12-07T09:08:21
293,440,688
0
0
null
null
null
null
UTF-8
Java
false
false
1,104
java
package ru.u2r3y.java1.Pr2.Ex1; public class Main { public static void main(String[] args) { // Shape shape = new Shape("Green", 5); // Shape shape2 = new Shape("Black", 3); // System.out.println(shape.getColor()); // shape.setColor("Blue"); // System.out.println(shape.getSidesCount()); Dog dog1 = new Dog("Charlie", 6); Dog dog2 = new Dog("Max", 5); Dog dog3 = new Dog("Bella", 4); Dog dog4 = new Dog("Molly", 3); Dog dog5 = new Dog("Boy", 2); DogKennel nursery = new DogKennel(); nursery.add(dog1, dog2, dog3); nursery.add(dog4, dog5); System.out.println("Age " + dog1.getName() + " into human = " + dog1.intoHuman()); System.out.println("Age " + dog2.getName() + " into human = " + dog2.intoHuman()); System.out.println("Age " + dog3.getName() + " into human = " + dog3.intoHuman()); System.out.println("Age " + dog4.getName() + " into human = " + dog4.intoHuman()); System.out.print("Age " + dog5.getName() + " into human = " + dog5.intoHuman()); } }
[ "1u2r3y@mail.ru" ]
1u2r3y@mail.ru
ce8e37c391db292c7b00936cd1d279ce14733114
3f67c1b31949f1ec5b9dd1648e1e61e51f033d48
/app/spring_demo/src/main/java/com/duke/sakura/demo/kingdom/repository/UserProfileRepository.java
86c148a6b42c7f1e44f0980371d8df1549282b91
[]
no_license
dukesward/SakuraDemo
18b46832f0ba9c9ce74849e3a5b698013e94e85c
bcaa2953dd80ad5075550080a46d14843ad46df9
refs/heads/master
2023-01-23T10:08:53.408913
2020-01-30T11:01:00
2020-01-30T11:01:00
236,928,024
0
0
null
2023-01-07T14:14:27
2020-01-29T07:37:09
TypeScript
UTF-8
Java
false
false
335
java
package com.duke.sakura.demo.kingdom.repository; import org.springframework.data.jpa.repository.JpaRepository; import com.duke.sakura.demo.kingdom.model.UserProfile; public interface UserProfileRepository extends JpaRepository<UserProfile, String> { UserProfile findByUuid(String uuid); UserProfile findByName(String name); }
[ "ychen18nj@sina.com" ]
ychen18nj@sina.com
44ee89eb367e282505d28f588b5b188a11833b84
12fb096ec5c47e3410f180d0e15af938e005b890
/src/com/lmq/tutorial/DisplayMessageActivity.java
cf7fe67aa3e494a59eb37b52a810ebd5ceb0cf4c
[]
no_license
hedy2009c/FilterStream
a7045c4c1779fd6941e265e21ca7290516de8fad
bcfad8bfcee3b1f2db1523d129ce16c678472d49
refs/heads/master
2021-01-22T07:32:47.876584
2013-05-12T05:52:45
2013-05-12T05:52:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,045
java
package com.lmq.tutorial; import android.annotation.TargetApi; import android.app.Activity; import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.support.v4.app.NavUtils; import android.view.Menu; import android.view.MenuItem; import android.widget.TextView; public class DisplayMessageActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Get the message from the intent Intent intent = getIntent(); String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE); // Create the text view TextView textView = new TextView(this); textView.setTextSize(40); textView.setText(message); // Set the text view as the activity layout setContentView(textView); // Show the Up button in the action bar. setupActionBar(); } /** * Set up the {@link android.app.ActionBar}, if the API is available. */ @TargetApi(Build.VERSION_CODES.HONEYCOMB) private void setupActionBar() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { getActionBar().setDisplayHomeAsUpEnabled(true); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.display_message, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: // This ID represents the Home or Up button. In the case of this // activity, the Up button is shown. Use NavUtils to allow users // to navigate up one level in the application structure. For // more details, see the Navigation pattern on Android Design: // // http://developer.android.com/design/patterns/navigation.html#up-vs-back // NavUtils.navigateUpFromSameTask(this); return true; } return super.onOptionsItemSelected(item); } }
[ "hedy2009c@gmail.com" ]
hedy2009c@gmail.com
6be22009a41e9be48166b8b843e2044cda087a4b
1dcb2853572d72c92b2b3831e6b30c44081b0109
/ThreadDemo/src/com/jhao/threaddemo/ch1/StartAndRun.java
1028a920a85d721e71d8db508f464a38916366ec
[]
no_license
jhao14/DataStructDemo
4b1a3a98a4501578f42b8283bb2b6d7b1bc5b5df
2b8b33d0477dd9a541a124a1fe82fda1add8174e
refs/heads/master
2023-04-13T10:21:53.073748
2021-04-07T15:25:32
2021-04-07T15:25:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
832
java
package com.jhao.threaddemo.ch1; /** * @author JiangHao * @date 2021/4/5 * @describe StartAndRun在执行上的区别 */ public class StartAndRun { public static class ThreadRun extends Thread { @Override public void run() { int i = 90; while (i > 0) { try { Thread.sleep(1000); } catch (InterruptedException e) { //e.printStackTrace(); } System.out.println("I am " + Thread.currentThread().getName() + " and now the i=" + i--); } } } public static void main(String[] args) { ThreadRun threadRun = new ThreadRun(); threadRun.setName("threadRun"); // threadRun.run(); threadRun.start(); } }
[ "776225930@qq.com" ]
776225930@qq.com
2fb671d5163a07acfd530a8eac90ef8394fe5ad4
25c702acb8c62267b5a7152fdb9f3e0a5f2e1897
/superlhttp/src/main/java/com/qpg/superlhttp/interceptor/GzipRequestInterceptor.java
303f81b6d09e606c41e0128c5257425bdffd8810
[ "Apache-2.0" ]
permissive
qiaodashaoye/SuperLHttp
beeb33cd344f49c34a16f61f7af4138af8f6fda7
152bf65fe019773dfbbe4752011719d42c89b219
refs/heads/master
2020-07-21T19:38:09.255948
2019-09-09T02:16:09
2019-09-09T02:16:09
206,957,571
6
0
null
null
null
null
UTF-8
Java
false
false
1,570
java
package com.qpg.superlhttp.interceptor; import androidx.annotation.NonNull; import java.io.IOException; import okhttp3.Interceptor; import okhttp3.MediaType; import okhttp3.Request; import okhttp3.RequestBody; import okhttp3.Response; import okio.BufferedSink; import okio.GzipSink; import okio.Okio; /** * @Description: 包含Gzip压缩的请求拦截 */ public class GzipRequestInterceptor implements Interceptor { @Override public Response intercept(@NonNull Chain chain) throws IOException { Request originalRequest = chain.request(); if (originalRequest.body() == null || originalRequest.header("Content-Encoding") != null) { return chain.proceed(originalRequest); } Request compressedRequest = originalRequest.newBuilder().header("Accept-Encoding", "gzip").method(originalRequest.method(), gzip (originalRequest.body())).build(); return chain.proceed(compressedRequest); } private RequestBody gzip(final RequestBody body) { return new RequestBody() { @Override public MediaType contentType() { return body.contentType(); } @Override public long contentLength() { return -1; } @Override public void writeTo(@NonNull BufferedSink sink) throws IOException { BufferedSink gzipSink = Okio.buffer(new GzipSink(sink)); body.writeTo(gzipSink); gzipSink.close(); } }; } }
[ "1451449315@qq.com" ]
1451449315@qq.com
fc384a30f1e59d3369944ac6c2d1a35c187aa711
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/5/5_aa6ed1ce33d5b89ee3915427708ed2549e0d35aa/SimplePostTool/5_aa6ed1ce33d5b89ee3915427708ed2549e0d35aa_SimplePostTool_t.java
13c827b9079a8ed4b5c4d597e4e48f6ed5be9190
[]
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
42,865
java
package org.apache.solr.util; /* * 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. */ import java.io.BufferedReader; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileFilter; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.ByteArrayInputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashSet; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.HashSet; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; import java.util.zip.GZIPInputStream; import java.util.zip.Inflater; import java.util.zip.InflaterInputStream; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.ProtocolException; import java.net.URL; import java.net.URLEncoder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpression; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; /** * A simple utility class for posting raw updates to a Solr server, * has a main method so it can be run on the command line. * View this not as a best-practice code example, but as a standalone * example built with an explicit purpose of not having external * jar dependencies. */ public class SimplePostTool { private static final String DEFAULT_POST_URL = "http://localhost:8983/solr/update"; private static final String VERSION_OF_THIS_TOOL = "1.5"; private static final String DEFAULT_COMMIT = "yes"; private static final String DEFAULT_OPTIMIZE = "no"; private static final String DEFAULT_OUT = "no"; private static final String DEFAULT_AUTO = "no"; private static final String DEFAULT_RECURSIVE = "0"; private static final int DEFAULT_WEB_DELAY = 10; private static final int MAX_WEB_DEPTH = 10; private static final String DEFAULT_CONTENT_TYPE = "application/xml"; private static final String DEFAULT_FILE_TYPES = "xml,json,csv,pdf,doc,docx,ppt,pptx,xls,xlsx,odt,odp,ods,ott,otp,ots,rtf,htm,html,txt,log"; static final String DATA_MODE_FILES = "files"; static final String DATA_MODE_ARGS = "args"; static final String DATA_MODE_STDIN = "stdin"; static final String DATA_MODE_WEB = "web"; static final String DEFAULT_DATA_MODE = DATA_MODE_FILES; // Input args boolean auto = false; int recursive = 0; int delay = 0; String fileTypes; URL solrUrl; OutputStream out = null; String type; String mode; boolean commit; boolean optimize; String[] args; private int currentDepth; static HashMap<String,String> mimeMap; GlobFileFilter globFileFilter; // Backlog for crawling List<LinkedHashSet<URL>> backlog = new ArrayList<LinkedHashSet<URL>>(); Set<URL> visited = new HashSet<URL>(); static final Set<String> DATA_MODES = new HashSet<String>(); static final String USAGE_STRING_SHORT = "Usage: java [SystemProperties] -jar post.jar [-h|-] [<file|folder|url|arg> [<file|folder|url|arg>...]]"; // Used in tests to avoid doing actual network traffic static boolean mockMode = false; static PageFetcher pageFetcher; static { DATA_MODES.add(DATA_MODE_FILES); DATA_MODES.add(DATA_MODE_ARGS); DATA_MODES.add(DATA_MODE_STDIN); DATA_MODES.add(DATA_MODE_WEB); mimeMap = new HashMap<String,String>(); mimeMap.put("xml", "text/xml"); mimeMap.put("csv", "text/csv"); mimeMap.put("json", "application/json"); mimeMap.put("pdf", "application/pdf"); mimeMap.put("rtf", "text/rtf"); mimeMap.put("html", "text/html"); mimeMap.put("htm", "text/html"); mimeMap.put("doc", "application/msword"); mimeMap.put("docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"); mimeMap.put("ppt", "application/vnd.ms-powerpoint"); mimeMap.put("pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation"); mimeMap.put("xls", "application/vnd.ms-excel"); mimeMap.put("xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); mimeMap.put("odt", "application/vnd.oasis.opendocument.text"); mimeMap.put("ott", "application/vnd.oasis.opendocument.text"); mimeMap.put("odp", "application/vnd.oasis.opendocument.presentation"); mimeMap.put("otp", "application/vnd.oasis.opendocument.presentation"); mimeMap.put("ods", "application/vnd.oasis.opendocument.spreadsheet"); mimeMap.put("ots", "application/vnd.oasis.opendocument.spreadsheet"); mimeMap.put("txt", "text/plain"); mimeMap.put("log", "text/plain"); } /** * See usage() for valid command line usage * @param args the params on the command line */ public static void main(String[] args) { info("SimplePostTool version " + VERSION_OF_THIS_TOOL); if (0 < args.length && ("-help".equals(args[0]) || "--help".equals(args[0]) || "-h".equals(args[0]))) { usage(); } else { final SimplePostTool t = parseArgsAndInit(args); t.execute(); } } /** * After initialization, call execute to start the post job. * This method delegates to the correct mode method. */ public void execute() { if (DATA_MODE_FILES.equals(mode) && args.length > 0) { doFilesMode(); } else if(DATA_MODE_ARGS.equals(mode) && args.length > 0) { doArgsMode(); } else if(DATA_MODE_WEB.equals(mode) && args.length > 0) { doWebMode(); } else if(DATA_MODE_STDIN.equals(mode)) { doStdinMode(); } else { usageShort(); return; } if (commit) commit(); if (optimize) optimize(); } /** * Parses incoming arguments and system params and initializes the tool * @param args the incoming cmd line args * @return an instance of SimplePostTool */ protected static SimplePostTool parseArgsAndInit(String[] args) { String urlStr = null; try { // Parse args final String mode = System.getProperty("data", DEFAULT_DATA_MODE); if (! DATA_MODES.contains(mode)) { fatal("System Property 'data' is not valid for this tool: " + mode); } String params = System.getProperty("params", ""); urlStr = System.getProperty("url", SimplePostTool.appendParam(DEFAULT_POST_URL, params)); URL url = new URL(urlStr); boolean auto = isOn(System.getProperty("auto", DEFAULT_AUTO)); String type = System.getProperty("type"); // Recursive int recursive = 0; String r = System.getProperty("recursive", DEFAULT_RECURSIVE); try { recursive = Integer.parseInt(r); } catch(Exception e) { if (isOn(r)) recursive = DATA_MODE_WEB.equals(mode)?1:999; } // Delay int delay = DATA_MODE_WEB.equals(mode) ? DEFAULT_WEB_DELAY : 0; try { delay = Integer.parseInt(System.getProperty("delay", ""+delay)); } catch(Exception e) { } OutputStream out = isOn(System.getProperty("out", DEFAULT_OUT)) ? System.out : null; String fileTypes = System.getProperty("filetypes", DEFAULT_FILE_TYPES); boolean commit = isOn(System.getProperty("commit",DEFAULT_COMMIT)); boolean optimize = isOn(System.getProperty("optimize",DEFAULT_OPTIMIZE)); return new SimplePostTool(mode, url, auto, type, recursive, delay, fileTypes, out, commit, optimize, args); } catch (MalformedURLException e) { fatal("System Property 'url' is not a valid URL: " + urlStr); return null; } } /** * Constructor which takes in all mandatory input for the tool to work. * Also see usage() for further explanation of the params. * @param mode whether to post files, web pages, params or stdin * @param url the Solr base Url to post to, should end with /update * @param auto if true, we'll guess type and add resourcename/url * @param type content-type of the data you are posting * @param recursive number of levels for file/web mode, or 0 if one file only * @param delay if recursive then delay will be the wait time between posts * @param fileTypes a comma separated list of file-name endings to accept for file/web * @param out an OutputStream to write output to, e.g. stdout to print to console * @param commit if true, will commit at end of posting * @param optimize if true, will optimize at end of posting * @param args a String[] of arguments, varies between modes */ public SimplePostTool(String mode, URL url, boolean auto, String type, int recursive, int delay, String fileTypes, OutputStream out, boolean commit, boolean optimize, String[] args) { this.mode = mode; this.solrUrl = url; this.auto = auto; this.type = type; this.recursive = recursive; this.delay = delay; this.fileTypes = fileTypes; this.globFileFilter = getFileFilterFromFileTypes(fileTypes); this.out = out; this.commit = commit; this.optimize = optimize; this.args = args; pageFetcher = new PageFetcher(); } public SimplePostTool() {} // // Do some action depending on which mode we have // private void doFilesMode() { currentDepth = 0; // Skip posting files if special param "-" given if (!args[0].equals("-")) { info("Posting files to base url " + solrUrl + (!auto?" using content-type "+(type==null?DEFAULT_CONTENT_TYPE:type):"")+".."); if(auto) info("Entering auto mode. File endings considered are "+fileTypes); if(recursive > 0) info("Entering recursive mode, max depth="+recursive+", delay="+delay+"s"); int numFilesPosted = postFiles(args, 0, out, type); info(numFilesPosted + " files indexed."); } } private void doArgsMode() { info("POSTing args to " + solrUrl + ".."); for (String a : args) { postData(stringToStream(a), null, out, type, solrUrl); } } private int doWebMode() { reset(); int numPagesPosted = 0; try { if(type != null) { fatal("Specifying content-type with \"-Ddata=web\" is not supported"); } if (args[0].equals("-")) { // Skip posting url if special param "-" given return 0; } // Set Extracting handler as default solrUrl = appendUrlPath(solrUrl, "/extract"); info("Posting web pages to Solr url "+solrUrl); auto=true; info("Entering auto mode. Indexing pages with content-types corresponding to file endings "+fileTypes); if(recursive > 0) { if(recursive > MAX_WEB_DEPTH) { recursive = MAX_WEB_DEPTH; warn("Too large recursion depth for web mode, limiting to "+MAX_WEB_DEPTH+"..."); } if(delay < DEFAULT_WEB_DELAY) warn("Never crawl an external web site faster than every 10 seconds, your IP will probably be blocked"); info("Entering recursive mode, depth="+recursive+", delay="+delay+"s"); } numPagesPosted = postWebPages(args, 0, out); info(numPagesPosted + " web pages indexed."); } catch(MalformedURLException e) { fatal("Wrong URL trying to append /extract to "+solrUrl); } return numPagesPosted; } private void doStdinMode() { info("POSTing stdin to " + solrUrl + ".."); postData(System.in, null, out, type, solrUrl); } private void reset() { fileTypes = DEFAULT_FILE_TYPES; globFileFilter = this.getFileFilterFromFileTypes(fileTypes); backlog = new ArrayList<LinkedHashSet<URL>>(); visited = new HashSet<URL>(); } // // USAGE // private static void usageShort() { System.out.println(USAGE_STRING_SHORT+"\n"+ " Please invoke with -h option for extended usage help."); } private static void usage() { System.out.println (USAGE_STRING_SHORT+"\n\n" + "Supported System Properties and their defaults:\n"+ " -Ddata=files|web|args|stdin (default=" + DEFAULT_DATA_MODE + ")\n"+ " -Dtype=<content-type> (default=" + DEFAULT_CONTENT_TYPE + ")\n"+ " -Durl=<solr-update-url> (default=" + DEFAULT_POST_URL + ")\n"+ " -Dauto=yes|no (default=" + DEFAULT_AUTO + ")\n"+ " -Drecursive=yes|no|<depth> (default=" + DEFAULT_RECURSIVE + ")\n"+ " -Ddelay=<seconds> (default=0 for files, 10 for web)\n"+ " -Dfiletypes=<type>[,<type>,...] (default=" + DEFAULT_FILE_TYPES + ")\n"+ " -Dparams=\"<key>=<value>[&<key>=<value>...]\" (values must be URL-encoded)\n"+ " -Dcommit=yes|no (default=" + DEFAULT_COMMIT + ")\n"+ " -Doptimize=yes|no (default=" + DEFAULT_OPTIMIZE + ")\n"+ " -Dout=yes|no (default=" + DEFAULT_OUT + ")\n\n"+ "This is a simple command line tool for POSTing raw data to a Solr\n"+ "port. Data can be read from files specified as commandline args,\n"+ "URLs specified as args, as raw commandline arg strings or via STDIN.\n"+ "Examples:\n"+ " java -jar post.jar *.xml\n"+ " java -Ddata=args -jar post.jar '<delete><id>42</id></delete>'\n"+ " java -Ddata=stdin -jar post.jar < hd.xml\n"+ " java -Ddata=web -jar post.jar http://example.com/\n"+ " java -Dtype=text/csv -jar post.jar *.csv\n"+ " java -Dtype=application/json -jar post.jar *.json\n"+ " java -Durl=http://localhost:8983/solr/update/extract -Dparams=literal.id=a -Dtype=application/pdf -jar post.jar a.pdf\n"+ " java -Dauto -jar post.jar *\n"+ " java -Dauto -Drecursive -jar post.jar afolder\n"+ " java -Dauto -Dfiletypes=ppt,html -jar post.jar afolder\n"+ "The options controlled by System Properties include the Solr\n"+ "URL to POST to, the Content-Type of the data, whether a commit\n"+ "or optimize should be executed, and whether the response should\n"+ "be written to STDOUT. If auto=yes the tool will try to set type\n"+ "and url automatically from file name. When posting rich documents\n"+ "the file name will be propagated as \"resource.name\" and also used\n"+ "as \"literal.id\". You may override these or any other request parameter\n"+ "through the -Dparams property. To do a commit only, use \"-\" as argument.\n"+ "The web mode is a simple crawler following links within domain, default delay=10s."); } /** Post all filenames provided in args * @param args array of file names * @param startIndexInArgs offset to start * @param out output stream to post data to * @param type default content-type to use when posting (may be overridden in auto mode) * @return number of files posted * */ public int postFiles(String [] args,int startIndexInArgs, OutputStream out, String type) { reset(); int filesPosted = 0; for (int j = startIndexInArgs; j < args.length; j++) { File srcFile = new File(args[j]); if(srcFile.isDirectory() && srcFile.canRead()) { filesPosted += postDirectory(srcFile, out, type); } else if (srcFile.isFile() && srcFile.canRead()) { filesPosted += postFiles(new File[] {srcFile}, out, type); } else { File parent = srcFile.getParentFile(); if(parent == null) parent = new File("."); String fileGlob = srcFile.getName(); GlobFileFilter ff = new GlobFileFilter(fileGlob, false); File[] files = parent.listFiles(ff); if(files == null || files.length == 0) { warn("No files or directories matching "+srcFile); continue; } filesPosted += postFiles(parent.listFiles(ff), out, type); } } return filesPosted; } /** Post all filenames provided in args * @param files array of Files * @param startIndexInArgs offset to start * @param out output stream to post data to * @param type default content-type to use when posting (may be overridden in auto mode) * @return number of files posted * */ public int postFiles(File[] files, int startIndexInArgs, OutputStream out, String type) { reset(); int filesPosted = 0; for (File srcFile : files) { if(srcFile.isDirectory() && srcFile.canRead()) { filesPosted += postDirectory(srcFile, out, type); } else if (srcFile.isFile() && srcFile.canRead()) { filesPosted += postFiles(new File[] {srcFile}, out, type); } else { File parent = srcFile.getParentFile(); if(parent == null) parent = new File("."); String fileGlob = srcFile.getName(); GlobFileFilter ff = new GlobFileFilter(fileGlob, false); File[] fileList = parent.listFiles(ff); if(fileList == null || fileList.length == 0) { warn("No files or directories matching "+srcFile); continue; } filesPosted += postFiles(fileList, out, type); } } return filesPosted; } /** * Posts a whole directory * @return number of files posted total */ private int postDirectory(File dir, OutputStream out, String type) { if(dir.isHidden() && !dir.getName().equals(".")) return(0); info("Indexing directory "+dir.getPath()+" ("+dir.listFiles(globFileFilter).length+" files, depth="+currentDepth+")"); int posted = 0; posted += postFiles(dir.listFiles(globFileFilter), out, type); if(recursive > currentDepth) { for(File d : dir.listFiles()) { if(d.isDirectory()) { currentDepth++; posted += postDirectory(d, out, type); currentDepth--; } } } return posted; } /** * Posts a list of file names * @return number of files posted */ int postFiles(File[] files, OutputStream out, String type) { int filesPosted = 0; for(File srcFile : files) { try { if(!srcFile.isFile() || srcFile.isHidden()) continue; postFile(srcFile, out, type); Thread.sleep(delay * 1000); filesPosted++; } catch (InterruptedException e) { throw new RuntimeException(); } } return filesPosted; } /** * This method takes as input a list of start URL strings for crawling, * adds each one to a backlog and then starts crawling * @param args the raw input args from main() * @param startIndexInArgs offset for where to start * @param out outputStream to write results to * @return the number of web pages posted */ public int postWebPages(String[] args, int startIndexInArgs, OutputStream out) { reset(); LinkedHashSet<URL> s = new LinkedHashSet<URL>(); for (int j = startIndexInArgs; j < args.length; j++) { try { URL u = new URL(normalizeUrlEnding(args[j])); s.add(u); } catch(MalformedURLException e) { warn("Skipping malformed input URL: "+args[j]); } } // Add URLs to level 0 of the backlog and start recursive crawling backlog.add(s); return webCrawl(0, out); } /** * Normalizes a URL string by removing anchor part and trailing slash * @return the normalized URL string */ protected static String normalizeUrlEnding(String link) { if(link.indexOf("#") > -1) link = link.substring(0,link.indexOf("#")); if(link.endsWith("?")) link = link.substring(0,link.length()-1); if(link.endsWith("/")) link = link.substring(0,link.length()-1); return link; } /** * A very simple crawler, pulling URLs to fetch from a backlog and then * recurses N levels deep if recursive>0. Links are parsed from HTML * through first getting an XHTML version using SolrCell with extractOnly, * and followed if they are local. The crawler pauses for a default delay * of 10 seconds between each fetch, this can be configured in the delay * variable. This is only meant for test purposes, as it does not respect * robots or anything else fancy :) * @param level which level to crawl * @param out output stream to write to * @return number of pages crawled on this level and below */ protected int webCrawl(int level, OutputStream out) { int numPages = 0; LinkedHashSet<URL> stack = backlog.get(level); int rawStackSize = stack.size(); stack.removeAll(visited); int stackSize = stack.size(); LinkedHashSet<URL> subStack = new LinkedHashSet<URL>(); info("Entering crawl at level "+level+" ("+rawStackSize+" links total, "+stackSize+" new)"); for(URL u : stack) { try { visited.add(u); PageFetcherResult result = pageFetcher.readPageFromUrl(u); if(result.httpStatus == 200) { u = (result.redirectUrl != null) ? result.redirectUrl : u; URL postUrl = new URL(appendParam(solrUrl.toString(), "literal.id="+URLEncoder.encode(u.toString(),"UTF-8") + "&literal.url="+URLEncoder.encode(u.toString(),"UTF-8"))); boolean success = postData(new ByteArrayInputStream(result.content), null, out, result.contentType, postUrl); if (success) { info("POSTed web resource "+u+" (depth: "+level+")"); Thread.sleep(delay * 1000); numPages++; // Pull links from HTML pages only if(recursive > level && result.contentType.equals("text/html")) { Set<URL> children = pageFetcher.getLinksFromWebPage(u, new ByteArrayInputStream(result.content), result.contentType, postUrl); subStack.addAll(children); } } else { warn("An error occurred while posting "+u); } } else { warn("The URL "+u+" returned a HTTP result status of "+result.httpStatus); } } catch (IOException e) { warn("Caught exception when trying to open connection to "+u+": "+e.getMessage()); } catch (InterruptedException e) { throw new RuntimeException(); } } if(!subStack.isEmpty()) { backlog.add(subStack); numPages += webCrawl(level+1, out); } return numPages; } /** * Reads an input stream into a byte array * @param is the input stream * @return the byte array * @throws IOException */ protected byte[] inputStreamToByteArray(InputStream is) throws IOException { ByteArrayOutputStream bos = new ByteArrayOutputStream(); int next = is.read(); while (next > -1) { bos.write(next); next = is.read(); } bos.flush(); is.close(); return bos.toByteArray(); } /** * Computes the full URL based on a base url and a possibly relative link found * in the href param of an HTML anchor. * @param baseUrl the base url from where the link was found * @param link the absolute or relative link * @return the string version of the full URL */ protected String computeFullUrl(URL baseUrl, String link) { if(link == null || link.length() == 0) { return null; } if(!link.startsWith("http")) { if(link.startsWith("/")) { link = baseUrl.getProtocol() + "://" + baseUrl.getAuthority() + link; } else { if(link.contains(":")) { return null; // Skip non-relative URLs } String path = baseUrl.getPath(); if(!path.endsWith("/")) { int sep = path.lastIndexOf("/"); String file = path.substring(sep+1); if(file.contains(".") || file.contains("?")) path = path.substring(0,sep); } link = baseUrl.getProtocol() + "://" + baseUrl.getAuthority() + path + "/" + link; } } link = normalizeUrlEnding(link); String l = link.toLowerCase(Locale.ROOT); // Simple brute force skip images if(l.endsWith(".jpg") || l.endsWith(".jpeg") || l.endsWith(".png") || l.endsWith(".gif")) { return null; // Skip images } return link; } /** * Uses the mime-type map to reverse lookup whether the file ending for our type * is supported by the fileTypes option * @param type what content-type to lookup * @return true if this is a supported content type */ protected boolean typeSupported(String type) { for(String key : mimeMap.keySet()) { if(mimeMap.get(key).equals(type)) { if(fileTypes.contains(key)) return true; } } return false; } /** * Tests if a string is either "true", "on", "yes" or "1" * @param property the string to test * @return true if "on" */ protected static boolean isOn(String property) { return("true,on,yes,1".indexOf(property) > -1); } static void warn(String msg) { System.err.println("SimplePostTool: WARNING: " + msg); } static void info(String msg) { System.out.println(msg); } static void fatal(String msg) { System.err.println("SimplePostTool: FATAL: " + msg); System.exit(2); } /** * Does a simple commit operation */ public void commit() { info("COMMITting Solr index changes to " + solrUrl + ".."); doGet(appendParam(solrUrl.toString(), "commit=true")); } /** * Does a simple optimize operation */ public void optimize() { info("Performing an OPTIMIZE to " + solrUrl + ".."); doGet(appendParam(solrUrl.toString(), "optimize=true")); } /** * Appends a URL query parameter to a URL * @param url the original URL * @param param the parameter(s) to append, separated by "&" * @return the string version of the resulting URL */ public static String appendParam(String url, String param) { String[] pa = param.split("&"); for(String p : pa) { if(p.trim().length() == 0) continue; String[] kv = p.split("="); if(kv.length == 2) { url = url + (url.indexOf('?')>0 ? "&" : "?") + kv[0] +"="+ kv[1]; } else { warn("Skipping param "+p+" which is not on form key=value"); } } return url; } /** * Opens the file and posts it's contents to the solrUrl, * writes to response to output. */ public void postFile(File file, OutputStream output, String type) { InputStream is = null; try { URL url = solrUrl; if(auto) { if(type == null) { type = guessType(file); } if(type != null) { if(type.equals("text/xml") || type.equals("text/csv") || type.equals("application/json")) { // Default handler } else { // SolrCell String urlStr = appendUrlPath(solrUrl, "/extract").toString(); if(urlStr.indexOf("resource.name")==-1) urlStr = appendParam(urlStr, "resource.name=" + URLEncoder.encode(file.getAbsolutePath(), "UTF-8")); if(urlStr.indexOf("literal.id")==-1) urlStr = appendParam(urlStr, "literal.id=" + URLEncoder.encode(file.getAbsolutePath(), "UTF-8")); url = new URL(urlStr); } } else { warn("Skipping "+file.getName()+". Unsupported file type for auto mode."); return; } } else { if(type == null) type = DEFAULT_CONTENT_TYPE; } info("POSTing file " + file.getName() + (auto?" ("+type+")":"")); is = new FileInputStream(file); postData(is, (int)file.length(), output, type, url); } catch (IOException e) { e.printStackTrace(); warn("Can't open/read file: " + file); } finally { try { if(is!=null) is.close(); } catch (IOException e) { fatal("IOException while closing file: "+ e); } } } /** * Appends to the path of the URL * @param url the URL * @param append the path to append * @return the final URL version * @throws MalformedURLException */ protected static URL appendUrlPath(URL url, String append) throws MalformedURLException { return new URL(url.getProtocol() + "://" + url.getAuthority() + url.getPath() + append + (url.getQuery() != null ? "?"+url.getQuery() : "")); } /** * Guesses the type of a file, based on file name suffix * @param file the file * @return the content-type guessed */ protected static String guessType(File file) { String name = file.getName(); String suffix = name.substring(name.lastIndexOf(".")+1); return mimeMap.get(suffix.toLowerCase(Locale.ROOT)); } /** * Performs a simple get on the given URL */ public static void doGet(String url) { try { doGet(new URL(url)); } catch (MalformedURLException e) { warn("The specified URL "+url+" is not a valid URL. Please check"); } } /** * Performs a simple get on the given URL */ public static void doGet(URL url) { try { if(mockMode) return; HttpURLConnection urlc = (HttpURLConnection) url.openConnection(); if (HttpURLConnection.HTTP_OK != urlc.getResponseCode()) { warn("Solr returned an error #" + urlc.getResponseCode() + " " + urlc.getResponseMessage() + " for url "+url); } } catch (IOException e) { warn("An error occured posting data to "+url+". Please check that Solr is running."); } } /** * Reads data from the data stream and posts it to solr, * writes to the response to output * @return true if success */ public boolean postData(InputStream data, Integer length, OutputStream output, String type, URL url) { if(mockMode) return true; boolean success = true; if(type == null) type = DEFAULT_CONTENT_TYPE; HttpURLConnection urlc = null; try { try { urlc = (HttpURLConnection) url.openConnection(); try { urlc.setRequestMethod("POST"); } catch (ProtocolException e) { fatal("Shouldn't happen: HttpURLConnection doesn't support POST??"+e); } urlc.setDoOutput(true); urlc.setDoInput(true); urlc.setUseCaches(false); urlc.setAllowUserInteraction(false); urlc.setRequestProperty("Content-type", type); if (null != length) urlc.setFixedLengthStreamingMode(length); } catch (IOException e) { fatal("Connection error (is Solr running at " + solrUrl + " ?): " + e); success = false; } OutputStream out = null; try { out = urlc.getOutputStream(); pipe(data, out); } catch (IOException e) { fatal("IOException while posting data: " + e); success = false; } finally { try { if(out!=null) out.close(); } catch (IOException x) { /*NOOP*/ } } InputStream in = null; try { if (HttpURLConnection.HTTP_OK != urlc.getResponseCode()) { warn("Solr returned an error #" + urlc.getResponseCode() + " " + urlc.getResponseMessage()); success = false; } in = urlc.getInputStream(); pipe(in, output); } catch (IOException e) { warn("IOException while reading response: " + e); success = false; } finally { try { if(in!=null) in.close(); } catch (IOException x) { /*NOOP*/ } } } finally { if(urlc!=null) urlc.disconnect(); } return success; } /** * Converts a string to an input stream * @param s the string * @return the input stream */ public static InputStream stringToStream(String s) { InputStream is = null; try { is = new ByteArrayInputStream(s.getBytes("UTF-8")); } catch (UnsupportedEncodingException e) { fatal("Shouldn't happen: UTF-8 not supported?!?!?!"); } return is; } /** * Pipes everything from the source to the dest. If dest is null, * then everything is read from source and thrown away. */ private static void pipe(InputStream source, OutputStream dest) throws IOException { byte[] buf = new byte[1024]; int read = 0; while ( (read = source.read(buf) ) >= 0) { if (null != dest) dest.write(buf, 0, read); } if (null != dest) dest.flush(); } public GlobFileFilter getFileFilterFromFileTypes(String fileTypes) { String glob; if(fileTypes.equals("*")) glob = ".*"; else glob = "^.*\\.(" + fileTypes.replace(",", "|") + ")$"; return new GlobFileFilter(glob, true); } // // Utility methods for XPath handing // /** * Gets all nodes matching an XPath */ public static NodeList getNodesFromXP(Node n, String xpath) throws XPathExpressionException { XPathFactory factory = XPathFactory.newInstance(); XPath xp = factory.newXPath(); XPathExpression expr = xp.compile(xpath); return (NodeList) expr.evaluate(n, XPathConstants.NODESET); } /** * Gets the string content of the matching an XPath * @param n the node (or doc) * @param xpath the xpath string * @param concatAll if true, text from all matching nodes will be concatenated, else only the first returned */ public static String getXP(Node n, String xpath, boolean concatAll) throws XPathExpressionException { NodeList nodes = getNodesFromXP(n, xpath); StringBuffer sb = new StringBuffer(); if (nodes.getLength() > 0) { for(int i = 0; i < nodes.getLength() ; i++) { sb.append(nodes.item(i).getNodeValue() + " "); if(!concatAll) break; } return sb.toString().trim(); } else return ""; } /** * Takes a string as input and returns a DOM */ public static Document makeDom(String in, String inputEncoding) throws SAXException, IOException, ParserConfigurationException { InputStream is = new ByteArrayInputStream(in .getBytes(inputEncoding)); Document dom = DocumentBuilderFactory.newInstance() .newDocumentBuilder().parse(is); return dom; } /** * Inner class to filter files based on glob wildcards */ class GlobFileFilter implements FileFilter { private String _pattern; private Pattern p; public GlobFileFilter(String pattern, boolean isRegex) { _pattern = pattern; if(!isRegex) { _pattern = _pattern .replace("^", "\\^") .replace("$", "\\$") .replace(".", "\\.") .replace("(", "\\(") .replace(")", "\\)") .replace("+", "\\+") .replace("*", ".*") .replace("?", "."); _pattern = "^" + _pattern + "$"; } try { p = Pattern.compile(_pattern,Pattern.CASE_INSENSITIVE); } catch(PatternSyntaxException e) { fatal("Invalid type list "+pattern+". "+e.getDescription()); } } public boolean accept(File file) { return p.matcher(file.getName()).find(); } } // // Simple crawler class which can fetch a page and check for robots.txt // class PageFetcher { Map<String, List<String>> robotsCache; final String DISALLOW = "Disallow:"; public PageFetcher() { robotsCache = new HashMap<String,List<String>>(); } public PageFetcherResult readPageFromUrl(URL u) { PageFetcherResult res = new PageFetcherResult(); try { if (isDisallowedByRobots(u)) { warn("The URL "+u+" is disallowed by robots.txt and will not be crawled."); res.httpStatus = 403; visited.add(u); return res; } res.httpStatus = 404; HttpURLConnection conn = (HttpURLConnection) u.openConnection(); conn.setRequestProperty("User-Agent", "SimplePostTool-crawler/"+VERSION_OF_THIS_TOOL+" (http://lucene.apache.org/solr/)"); conn.setRequestProperty("Accept-Encoding", "gzip, deflate"); conn.connect(); res.httpStatus = conn.getResponseCode(); if(!normalizeUrlEnding(conn.getURL().toString()).equals(normalizeUrlEnding(u.toString()))) { info("The URL "+u+" caused a redirect to "+conn.getURL()); u = conn.getURL(); res.redirectUrl = u; visited.add(u); } if(res.httpStatus == 200) { // Raw content type of form "text/html; encoding=utf-8" String rawContentType = conn.getContentType(); String type = rawContentType.split(";")[0]; if(typeSupported(type)) { String encoding = conn.getContentEncoding(); InputStream is; if (encoding != null && encoding.equalsIgnoreCase("gzip")) { is = new GZIPInputStream(conn.getInputStream()); } else if (encoding != null && encoding.equalsIgnoreCase("deflate")) { is = new InflaterInputStream(conn.getInputStream(), new Inflater(true)); } else { is = conn.getInputStream(); } // Read into memory, so that we later can pull links from the page without re-fetching res.content = inputStreamToByteArray(is); is.close(); } else { warn("Skipping URL with unsupported type "+type); res.httpStatus = 415; } } } catch(IOException e) { warn("IOException when reading page from url "+u+": "+e.getMessage()); } return res; } public boolean isDisallowedByRobots(URL url) { String host = url.getHost(); String strRobot = url.getProtocol() + "://" + host + "/robots.txt"; List<String> disallows = robotsCache.get(host); if(disallows == null) { disallows = new ArrayList<String>(); URL urlRobot; try { urlRobot = new URL(strRobot); disallows = parseRobotsTxt(urlRobot.openStream()); } catch (MalformedURLException e) { return true; // We cannot trust this robots URL, should not happen } catch (IOException e) { // There is no robots.txt, will cache an empty disallow list } } robotsCache.put(host, disallows); String strURL = url.getFile(); for (String path : disallows) { if (path.equals("/") || strURL.indexOf(path) == 0) return true; } return false; } /** * Very simple robots.txt parser which obeys all Disallow lines regardless * of user agent or whether there are valid Allow: lines. * @param is Input stream of the robots.txt file * @return a list of disallow paths * @throws IOException if problems reading the stream */ protected List<String> parseRobotsTxt(InputStream is) throws IOException { List<String> disallows = new ArrayList<String>(); BufferedReader r = new BufferedReader(new InputStreamReader(is, "UTF-8")); String l; while((l = r.readLine()) != null) { String[] arr = l.split("#"); if(arr.length == 0) continue; l = arr[0].trim(); if(l.startsWith(DISALLOW)) { l = l.substring(DISALLOW.length()).trim(); if(l.length() == 0) continue; disallows.add(l); } } is.close(); return disallows; } /** * Finds links on a web page, using /extract?extractOnly=true * @param u the URL of the web page * @param is the input stream of the page * @param type the content-type * @param postUrl the URL (typically /solr/extract) in order to pull out links * @return a set of URLs parsed from the page */ protected Set<URL> getLinksFromWebPage(URL u, InputStream is, String type, URL postUrl) { Set<URL> l = new HashSet<URL>(); URL url = null; try { ByteArrayOutputStream os = new ByteArrayOutputStream(); URL extractUrl = new URL(appendParam(postUrl.toString(), "extractOnly=true")); boolean success = postData(is, null, os, type, extractUrl); if(success) { String rawXml = os.toString("UTF-8"); Document d = makeDom(rawXml, "UTF-8"); String innerXml = getXP(d, "/response/str/text()[1]", false); d = makeDom(innerXml, "UTF-8"); NodeList links = getNodesFromXP(d, "/html/body//a/@href"); for(int i = 0; i < links.getLength(); i++) { String link = links.item(i).getTextContent(); link = computeFullUrl(u, link); if(link == null) continue; url = new URL(link); if(url.getAuthority() == null || !url.getAuthority().equals(u.getAuthority())) continue; l.add(url); } } } catch (MalformedURLException e) { warn("Malformed URL "+url); } catch (IOException e) { warn("IOException opening URL "+url+": "+e.getMessage()); } catch (Exception e) { throw new RuntimeException(); } return l; } } /** * Utility class to hold the result form a page fetch */ public class PageFetcherResult { int httpStatus = 200; String contentType = "text/html"; URL redirectUrl = null; byte[] content; } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
9ccf47fda624bc13636f291f5c138f5bcc74917e
e7a4d6068f276af6e17f0209d85b9496aacd2f5c
/code/java-concurrency/src/main/java/com/zync/ref/WeakReferenceDemo2.java
ee65632ddb367e62ce9aff09600383d07c56787f
[ "Apache-2.0" ]
permissive
luocong2013/study
be8e3d1b658e84734b02d64cf8506da80cf69747
7b2243a7e921671675d96d0b753c882762c5556f
refs/heads/master
2023-08-30T22:52:11.857988
2023-08-10T08:11:48
2023-08-10T08:11:48
148,992,527
0
1
Apache-2.0
2023-07-23T14:22:38
2018-09-16T12:16:22
HTML
UTF-8
Java
false
false
2,362
java
package com.zync.ref; import com.zync.common.User; import java.lang.ref.WeakReference; /** * 弱引用在GC之后不被回收的情况 * * @author luocong * @version v1.0 * @date 2022/6/30 13:04 */ public class WeakReferenceDemo2 { public static void main(String[] args) { //test1(); //test2(); //test3(); test4(); } /** * GC之后弱引用不会被垃圾回收 * 因为被弱引用持有的对象 是强引用 * 局部变量可作为 GC Roots 对象 */ private static void test1() { User user = new User("张三", "123", 11); WeakReference<User> weakReference = new WeakReference<>(user); System.out.println("GC之前,弱引用的值:" + weakReference.get()); System.gc(); System.out.println("GC之后,弱引用的值:" + weakReference.get()); } /** * 同 test1 */ private static void test2() { WeakReference<User> weakReference = new WeakReference<>(new User("张三", "123", 11)); User user = weakReference.get(); System.out.println("GC之前,弱引用的值:" + weakReference.get()); System.gc(); System.out.println("GC之后,弱引用的值:" + weakReference.get()); } /** * 同 test1 * ThreadLocalMap.Entry 里 key是弱引用, 指向的是 ThreadLocal 对象 * 这里 ThreadLocal 对象是强引用、局部变量 可作为 GC Roots 对象 */ private static void test3() { ThreadLocal<User> local = ThreadLocal.withInitial(User::new); local.set(new User("张三", "123", 11)); System.out.println("GC之前,弱引用的值:" + local.get()); System.gc(); System.out.println("GC之后,弱引用的值:" + local.get()); } /** * 我们一般这样使用,比如 Spring Security 里保存用户认证信息 * 同 test3 * 常量引用的对象 可作为 GC Roots 对象 */ private static final ThreadLocal<User> THREAD_LOCAL = ThreadLocal.withInitial(User::new); private static void test4() { THREAD_LOCAL.set(new User("张三", "123", 11)); System.out.println("GC之前,弱引用的值:" + THREAD_LOCAL.get()); System.gc(); System.out.println("GC之后,弱引用的值:" + THREAD_LOCAL.get()); } }
[ "luocong2013@outlook.com" ]
luocong2013@outlook.com
764c89b446d007d4ac9fa5354b3f688bd4fa51dd
db8b218ce406e20d2ef36a354db8513856542955
/Exercise_08_UnitTesting/src/test/java/BubbleTest.java
0de83d2cdf38368cc7e2460425d6c62cb5638b9f
[ "Apache-2.0" ]
permissive
s3valkov/JavaOOP
bbdcdf83d23a6a6a69ac218035a8dab02b30e776
0d9e0277d70b18a890669e2b29fe5d7dc0dd827e
refs/heads/master
2020-04-29T23:48:25.446156
2019-05-01T18:19:26
2019-05-01T18:19:26
176,488,321
0
1
null
null
null
null
UTF-8
Java
false
false
1,491
java
import org.junit.Assert; import org.junit.Test; import p04_BubbleSortTest.Bubble; public class BubbleTest { @Test public void bubbleShouldReturnTheSameArray(){ int[] actual = {1,2,3}; int[] expected = {1,2,3}; Bubble.sort(actual); Assert.assertArrayEquals(actual,expected); } @Test public void shouldReturnSortedArray(){ int[] actual = {3,2,1}; int[] expected = {1,2,3}; Bubble.sort(actual); Assert.assertArrayEquals(actual,expected); } @Test public void shouldReturnSortedArrayWithRepeatingElements(){ int[] actual = {3,2,1,3,3,2,2,}; int[] expected = {1,2,2,2,3,3,3}; Bubble.sort(actual); Assert.assertArrayEquals(actual,expected); } public void shouldReturnSortedArrayWithNegativeNumbers(){ int[] actual = {-3,-26,-7}; int[] expected = {-26,-7,-3}; Bubble.sort(actual); Assert.assertArrayEquals(actual,expected); } public void shouldReturnSortedArrayWithNegativeAndPositiveNumbers(){ int[] actual = {-3,-26,-7,25,321}; int[] expected = {-26,-7,-3,25,321}; Bubble.sort(actual); Assert.assertArrayEquals(actual,expected); } public void shouldReturnTheSameArray(){ int[] actual = {0,0,0}; int[] expected = {0,0,0}; Bubble.sort(actual); Assert.assertArrayEquals(actual,expected); } }
[ "noreply@github.com" ]
noreply@github.com
630b857369a37c321be924ef96b35214fba53ecb
6d3d202931fd49c86ec157c4d0f2688ecde4b767
/src/main/java/com/trein/gtfs/csv/reader/CSVHeaderAwareReader.java
19e0dce639fc0c30f623f32d7dae8ff3e5ffbfd0
[ "MIT" ]
permissive
moltamas93/gtfs2postgres
831d45356c19508c4e405cf2277874f6b164482e
e84f58c41165c3e78d96ac7dd9427e93e30d2ff0
refs/heads/master
2020-05-24T20:01:30.243371
2017-03-25T20:47:40
2017-03-25T20:47:40
84,876,572
0
0
null
null
null
null
UTF-8
Java
false
false
4,302
java
package com.trein.gtfs.csv.reader; import com.googlecode.jcsv.CSVStrategy; import com.googlecode.jcsv.reader.CSVEntryFilter; import com.googlecode.jcsv.reader.CSVEntryParser; import com.googlecode.jcsv.reader.CSVReader; import com.googlecode.jcsv.reader.CSVTokenizer; import com.googlecode.jcsv.reader.internal.CSVIterator; import java.io.BufferedReader; import java.io.IOException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; public class CSVHeaderAwareReader<E> implements CSVReader<E> { private final BufferedReader reader; private final CSVStrategy strategy; private final CSVEntryParser<E> entryParser; private final CSVEntryFilter<E> entryFilter; private final CSVTokenizer tokenizer; private CSVHeaderData headerData; private boolean firstLineRead = false; CSVHeaderAwareReader(CSVHeaderAwareReaderBuilder<E> builder) { this.reader = new BufferedReader(builder.reader); this.strategy = builder.strategy; this.entryParser = builder.entryParser; this.entryFilter = builder.entryFilter; this.tokenizer = builder.tokenizer; try { this.headerData = createHeaderMetadata(); } catch (IOException e) { throw new IllegalStateException("can not read header, readHeader() must be the first call on this reader"); } } @Override public List<E> readAll() throws IOException { List<E> entries = new ArrayList<E>(); E entry = null; while ((entry = readNext()) != null) { entries.add(entry); } return entries; } @Override public E readNext() throws IOException { E entry = null; boolean validEntry = false; do { String line = readLine(); if (line == null) { return null; } if (isEmptyLine(line)) { continue; } if (isCommentLine(line)) { continue; } entry = parseEntry(line); validEntry = isValidEntry(entry); } while (!validEntry); this.firstLineRead = true; return entry; } private CSVHeaderData createHeaderMetadata() throws IOException { return new CSVHeaderData(readHeader()); } private E parseEntry(String line) throws IOException { List<String> data = this.tokenizer.tokenizeLine(line, this.strategy, this.reader); CSVHeaderParsingContext context = new CSVHeaderParsingContext(this.headerData, data); return this.entryParser.parseEntry(context); } private boolean isValidEntry(E entry) { return this.entryFilter != null ? this.entryFilter.match(entry) : true; } private boolean isEmptyLine(String line) { return (line.trim().length() == 0) && this.strategy.isIgnoreEmptyLines(); } @Override public List<String> readHeader() throws IOException { if (this.firstLineRead) { throw new IllegalStateException( "can not read header, readHeader() must be the first call on this reader"); } String line = readLine(); if (line == null) { throw new IllegalStateException("reached EOF while reading the header"); } List<String> header = this.tokenizer.tokenizeLine(line, this.strategy, this.reader); return header; } /** * Returns the Iterator for this CSVReaderImpl. * * @return Iterator<E> the iterator */ @Override public Iterator<E> iterator() { return new CSVIterator<E>(this); } /** * {@link java.io.Closeable#close()} */ @Override public void close() throws IOException { this.reader.close(); } private boolean isCommentLine(String line) { return line.startsWith(String.valueOf(this.strategy.getCommentIndicator())); } /** * Reads a line from the given reader and sets the firstLineRead flag. * * @return the read line * @throws IOException */ private String readLine() throws IOException { String line = this.reader.readLine(); this.firstLineRead = true; return line; } }
[ "tamas.molnar@webvalto.hu" ]
tamas.molnar@webvalto.hu
4f4e46fc850ca2bf296e662b1c20809059e46305
64f0c48c3821da8adf98c08edc727d75605c5467
/weather-data-collect/src/main/java/cn/baron/weather/weatherdatacollect/weather/enums/CsgProvince.java
c2b3835bfa4ddbe5be40772bb5a44a6598f49181
[]
no_license
yxhsmartOpen/springBoot-family
6451450d5987b77f370d5406b348d9ccf960a2bd
eed9f79a357d3b6579ec0d0fca5176de89adfbb5
refs/heads/master
2023-04-21T20:55:39.932142
2021-05-09T18:35:56
2021-05-09T18:35:56
285,417,584
0
0
null
null
null
null
UTF-8
Java
false
false
2,941
java
package cn.baron.weather.weatherdatacollect.weather.enums; import java.util.*; /** * @Dsecription 南方五省全局天气枚举工具类 * @author Baron * @date 2017-3-25 */ public enum CsgProvince { /** 广东省 */ GuangDong("GUANGDONG", "广东省", City.GuangDongCity), /** 海南省 */ HaiNan("HAINAN", "海南省", City.HaiNanCity), /** 广西壮族自治区 */ GuangXi("GUANGXI", "广西壮族自治区", City.GuangXiCity), /** 贵州省 */ GuiZhou("GUIZHOU", "贵州省", City.GuiZhouCity), /** 云南省 */ YunNan("YUNNAN", "云南省", City.YunNanCity), /** 广州 */ GuangZhou("GUANGZHOU", "广州", City.GuangZhouCity), /** 深圳 */ ShenZhen("SHENZHEN", "深圳", City.ShenZhenCity); /** 省拼音 */ private final String code; /** 中文名称 */ private final String name; /** 城市 */ private final List<String> city; /** 字段map */ private static Map<String, CsgProvince> map; CsgProvince(String code, String name, List<String> city) { this.code = code; this.name = name; this.city = city; initMap(name, this); } @Override public String toString() { return code; } public String getName() { return name; } public String getCode() { return code; } public List<String> getCity() { return city; } public static CsgProvince getProvince(String name) { return map.get(name); } private void initMap(String name, CsgProvince province) { if (CsgProvince.map == null) { CsgProvince.map = new LinkedHashMap<String, CsgProvince>(); } CsgProvince.map.put(name, province); } public static Map<String, CsgProvince> getProvinceMap() { return map; } public static class City { public static List<String> GuangZhouCity = Collections.singletonList("广州"); public static List<String> ShenZhenCity = Collections.singletonList("深圳"); public static List<String> GuangDongCity = Arrays.asList("", "东莞", "潮州", "佛山", "河源", "惠州", "江门", "揭阳", "梅州", "茂名", "清远", "韶关", "汕尾", "汕头", "云浮", "阳江", "珠海", "中山", "肇庆", "湛江"); public static List<String> HaiNanCity = Arrays .asList("", "海口", "三亚", "儋州", "琼海", "文昌", "万宁", "澄迈", "定安", "屯昌", "陵水", "临高", "昌江", "东方", "五指山", "保亭", "乐东", "琼中", "白沙", "三沙"); public static List<String> GuangXiCity = Arrays.asList("", "南宁", "柳州", "桂林", "玉林", "河池", "钦州", "防城港", "梧州", "北海", "贵港", "崇左", "来宾", "百色", "贺州"); public static List<String> GuiZhouCity = Arrays.asList("", "安顺", "毕节", "都匀", "贵阳", "凯里", "六盘水", "铜仁", "兴义", "遵义"); public static List<String> YunNanCity = Arrays.asList("", "昆明", "曲靖", "玉溪", "保山", "昭通", "丽江", "临沧", "楚雄", "红河", "文山", "西双版纳", "大理", "德宏", "怒江", "迪庆", "瑞丽"); } }
[ "714841699" ]
714841699
edd06062e0d61df21c73328d87245fad5f51f565
71394e65f241bd38af7bc47b67da7a71e4f7b72a
/src/main/java/com/taiji/oauthplatform/config/ssoauth/WebConfig.java
619a63a2ac301846181070f41ac124fd1b39dcac
[]
no_license
superzhw/oauth-platform
e18357bdd87d1fa15f2b8fd7aa8520cff323889c
5fe4172037d683c8085bf8cded4fc36aae02be00
refs/heads/master
2022-07-16T03:15:12.461052
2019-12-10T09:23:07
2019-12-10T09:23:07
225,765,862
0
0
null
2022-06-17T02:44:29
2019-12-04T02:56:48
TSQL
UTF-8
Java
false
false
2,125
java
package com.taiji.oauthplatform.config.ssoauth; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; /** * 定义视图 */ @Configuration//相当于springmvc.xml配置文件 //@EnableWebMvc public class WebConfig implements WebMvcConfigurer { @Override public void addViewControllers(ViewControllerRegistry registry){ registry.addViewController("/").setViewName("redirect:/login"); registry.addViewController("/login").setViewName("/login"); registry.addViewController("/home").setViewName("/home"); } /** * 跨域支持 * @param registry */ @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**") .allowedOrigins("*") .allowCredentials(true) .allowedMethods("GET", "POST", "DELETE", "PUT") .maxAge(3600 * 24); } /** * 添加静态资源--过滤swagger-api (开源的在线API文档) * @param registry */ @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { //过滤swagger registry.addResourceHandler("swagger-ui.html") .addResourceLocations("classpath:/META-INF/resources/"); registry.addResourceHandler("/webjars/**") .addResourceLocations("classpath:/META-INF/resources/webjars/"); registry.addResourceHandler("/swagger-resources/**") .addResourceLocations("classpath:/META-INF/resources/swagger-resources/"); registry.addResourceHandler("/swagger/**") .addResourceLocations("classpath:/META-INF/resources/swagger*"); registry.addResourceHandler("/v2/api-docs/**") .addResourceLocations("classpath:/META-INF/resources/v2/api-docs/"); } }
[ "zhanghw_zhangsh@126.com" ]
zhanghw_zhangsh@126.com
c6fa9dcf0cd30deba65a587b8a0adc7122e108c2
ede5969986b5e3e5587b423c371b1c6adc031462
/src/main/java/facades/CourseFacade.java
ba40376e3db8773143158197a83fd5509544548a
[]
no_license
josefmarcc/exam_backend-startcode
e615415c94f54b6f2b2732b90f6055d14cf851bd
92aba7c9d816677b3052eddcebfa73f5f2881ad1
refs/heads/main
2023-02-24T16:39:43.247804
2021-01-27T23:44:05
2021-01-27T23:44:05
333,192,898
0
0
null
null
null
null
UTF-8
Java
false
false
6,017
java
package facades; import DTO.ClassEntityDTO; import DTO.CourseDTO; import entities.ClassEntity; import entities.Course; import errorhandling.DuplicateException; import errorhandling.NotFoundException; import java.util.ArrayList; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.TypedQuery; public class CourseFacade { private static EntityManagerFactory emf; private static CourseFacade instance; private CourseFacade() { } /** * * @param _emf * @return the instance of this facade. */ public static CourseFacade getCourseFacade(EntityManagerFactory _emf) { if (instance == null) { emf = _emf; instance = new CourseFacade(); } return instance; } public void addCourse(String courseName, String desc) throws DuplicateException { EntityManager em = emf.createEntityManager(); Course course = em.find(Course.class, courseName); if (course == null) { course = new Course(courseName, desc); try { em.getTransaction().begin(); em.persist(course); em.getTransaction().commit(); } finally { em.close(); } } else { throw new DuplicateException("Course already exsist"); } } public void addClassToCourse(int semester, int numOfStudents, String courseName) throws NotFoundException { EntityManager em = emf.createEntityManager(); Course course = em.find(Course.class, courseName); if (course == null) { throw new NotFoundException("Cannot find course"); } else { try { em.getTransaction().begin(); ClassEntity ce = new ClassEntity(semester, numOfStudents); ce.setCourse(course); em.persist(ce); em.getTransaction().commit(); } finally { em.close(); } } } public List<CourseDTO> getAllCourses() { EntityManager em = emf.createEntityManager(); try { TypedQuery<Course> q1 = em.createQuery("SELECT c from Course c", Course.class); List<Course> courseList = q1.getResultList(); List<CourseDTO> courseListDTO = new ArrayList(); for (Course course : courseList) { CourseDTO courseDTO = new CourseDTO(course); courseListDTO.add(courseDTO); } return courseListDTO; } finally { em.close(); } } public CourseDTO getCourseByName(String courseName) throws NotFoundException { EntityManager em = emf.createEntityManager(); Course course; try { course = em.find(Course.class, courseName); if (course == null) { throw new NotFoundException("Cannot find course"); } else { return new CourseDTO(course); } } finally { em.close(); } } public List<ClassEntityDTO> getClassBySemester(int semester) { EntityManager em = emf.createEntityManager(); try { TypedQuery<ClassEntity> q1 = em.createQuery("SELECT s FROM ClassEntity s WHERE s.semester LIKE :semester", ClassEntity.class); List<ClassEntity> classEntityList = q1.setParameter("semester", semester).getResultList(); List<ClassEntityDTO> classListDTO = new ArrayList(); for (ClassEntity classEntity : classEntityList) { ClassEntityDTO classEntityDTO = new ClassEntityDTO(classEntity); classListDTO.add(classEntityDTO); } return classListDTO; } finally { em.close(); } } public List<ClassEntityDTO> getAllClasses() { EntityManager em = emf.createEntityManager(); try { TypedQuery<ClassEntity> q1 = em.createQuery("SELECT c from ClassEntity c", ClassEntity.class); List<ClassEntity> classList = q1.getResultList(); List<ClassEntityDTO> classListDTO = new ArrayList(); for (ClassEntity classEntity : classList) { ClassEntityDTO classEntityDTO = new ClassEntityDTO(classEntity); classListDTO.add(classEntityDTO); } return classListDTO; } finally { em.close(); } } public void deleteCourse(String courseName) throws NotFoundException { EntityManager em = emf.createEntityManager(); Course course = em.find(Course.class, courseName); if (course == null) { System.out.println("Course er tom"); throw new NotFoundException("Course input missing"); } else { try { em.getTransaction().begin(); em.remove(course); em.getTransaction().commit(); } finally { em.close(); } } } public CourseDTO editCourse(CourseDTO c) throws NotFoundException { if ((c.getCourseName().length() == 0)) { throw new NotFoundException("Course input missing"); } EntityManager em = emf.createEntityManager(); try { em.getTransaction().begin(); Course course = em.find(Course.class, c.getCourseName()); if (course == null) { throw new NotFoundException(String.format("Course with course name: (%s) not found", c.getCourseName())); } else { course.setCourseName(c.getCourseName()); course.setDescription(c.getDescription()); } em.getTransaction().commit(); return new CourseDTO(course); } finally { em.close(); } } }
[ "56867995+josefmarcc@users.noreply.github.com" ]
56867995+josefmarcc@users.noreply.github.com
b0bd42d6542a585b4e2102557b38341d25ca6a93
92ba20a01a177e70fb19c557847afd35d1a6e5e6
/Attempt1/src/credentials/dao/EmployeeDao.java
ee8757bf2f99602a32ecd7038cf3a87c908804bd
[ "MIT" ]
permissive
BryanRonad/Online-Job-Portal
d65224a2588c52951bc005a8346a5fd4e6062eb6
84b03a260c5bbe7d0a77d9ad816804a8aace5ce9
refs/heads/main
2023-04-02T21:47:50.514686
2021-04-04T04:38:07
2021-04-04T04:38:07
317,580,690
0
0
null
null
null
null
UTF-8
Java
false
false
5,987
java
package credentials.dao; import java.io.InputStream; import java.sql.*; import java.util.ArrayList; import java.util.List; import employeeBean.Employee; import jobBean.Job; import sqlConnect.SqlConnection; public class EmployeeDao { static Connection con = null; public int registerUser(String Uemail, String Ufname, String Ulname, String Password, String gen, String exp, String PI, String skill) { try { con = SqlConnection.dbConnector(); String query = "insert into employee values(?,?,?,?,?,?,?,?,?)"; PreparedStatement st = con.prepareStatement(query); st.setString(1, Uemail); st.setString(2, Ufname); st.setString(3, Ulname); st.setString(4, Password); st.setString(5, gen); st.setString(6, exp); st.setString(7, PI); st.setString(8, skill); st.setNull(9, java.sql.Types.NULL); int i = st.executeUpdate(); return i; } catch (SQLException e) { System.out.println(e); } return 0; } public static int update(Employee e, String Umail) { int status = 0; try { System.out.println("mail from DAO"+Umail); con = SqlConnection.dbConnector(); PreparedStatement st = con.prepareStatement( "UPDATE employee SET FirstName= ?, LastName=?, Password=?, Gender= ?, Experience = ?, Industry= ?, keySkills =? WHERE email =? "); st.setString(1, e.getUfname()); st.setString(2, e.getUlname()); st.setString(3, e.getPassword()); st.setString(4, e.getGen()); st.setString(5, e.getExp()); st.setString(6, e.getPI()); st.setString(7, e.getSkill()); st.setString(8, Umail); status = st.executeUpdate(); if (status > 0) { System.out.println("Updated successfully"); } return status; } catch (Exception e1) { System.out.println(e1); } return 0; } public static Employee getEmployeeById(String Uemail) { Employee e = new Employee(); try { con = SqlConnection.dbConnector(); PreparedStatement ps = con.prepareStatement("select * from employee where Email=?"); ps.setString(1, Uemail); ResultSet rs = ps.executeQuery(); if (rs.next()) { e.setUemail(rs.getString((1))); e.setUfname(rs.getString(2)); e.setUlname(rs.getString(3)); e.setPassword(rs.getString(4)); e.setGen(rs.getString(5)); e.setExp(rs.getString(6)); e.setPI(rs.getString(7)); e.setSkill(rs.getString(8)); System.out.println("Get emp by id "+e); } } catch (Exception ex) { ex.printStackTrace(); } return e; } public static List<Employee> list() throws SQLException { List<Employee> employee = new ArrayList<Employee>(); try { con = SqlConnection.dbConnector(); Statement statement = con.createStatement(); ResultSet rs = statement.executeQuery("select * from employee where email!='admin@jobportal.com'"); while (rs.next()) { Employee e = new Employee(); e.setUemail(rs.getString((1))); e.setUfname(rs.getString(2)); e.setUlname(rs.getString(3)); e.setPassword(rs.getString(4)); e.setGen(rs.getString(5)); e.setExp(rs.getString(6)); e.setPI(rs.getString(7)); e.setSkill(rs.getString(8)); employee.add(e); } return employee; } catch (Exception e) {System.out.println(e);} return null; } public int uploadResume(String email,InputStream resume) { int status = 0; try { System.out.println(email); con = SqlConnection.dbConnector(); PreparedStatement st = con.prepareStatement("UPDATE employee SET resume=? WHERE email =?"); st.setBlob(1, resume); st.setString(2, email); status = st.executeUpdate(); return status; } catch(Exception e) {System.out.println(e);} return 0; } public Blob downloadResume(String Email) { try { System.out.println("download resume called"); System.out.println("DR1::"+Email); con = SqlConnection.dbConnector(); PreparedStatement st = con.prepareStatement("select resume from employee where email=?"); st.setString(1, Email); ResultSet result = st.executeQuery(); System.out.println(result); if(result.next()) { Blob EResume = result.getBlob("resume"); System.out.println("DR2::"+Email); return EResume; } } catch(Exception e) { } return null; } public int deleteUser(String email) { try { con=SqlConnection.dbConnector(); String Query="DELETE FROM employee WHERE Email = ?"; PreparedStatement st = con.prepareStatement(Query); st.setString(1, email); int i = st.executeUpdate(); return i; } catch (Exception e) {System.out.println(e);} return 0; } public int uploadCV(String email,InputStream cv) { int status = 0; try { System.out.println(email); con = SqlConnection.dbConnector(); PreparedStatement st = con.prepareStatement("UPDATE employee SET cv=? WHERE Email =?"); st.setBlob(1, cv); st.setString(2, email); status = st.executeUpdate(); return status; } catch(Exception e) {System.out.println(e);} return 0; } public Blob downloadCV(String Email) { try { System.out.println("download resume servlet called"); System.out.println("CV of "+Email); con = SqlConnection.dbConnector(); PreparedStatement st = con.prepareStatement("SELECT cv FROM employee WHERE Email=?"); st.setString(1, Email); ResultSet result = st.executeQuery(); System.out.println(result); if(result.next()) { Blob cv = result.getBlob("cv"); System.out.println("CV Received"); return cv; } } catch(Exception e) { } return null; } public int checkCV(String Uemail) { con = SqlConnection.dbConnector(); PreparedStatement st; try { st = con.prepareStatement("SELECT * FROM employee WHERE Email =? AND cv IS NOT NULL"); st.setString(1, Uemail); ResultSet result = st.executeQuery(); if(result.next()) { return 1; } else { return 0; } } catch (SQLException e) { e.printStackTrace(); return 0; } } }
[ "58883939+KronosOG1@users.noreply.github.com" ]
58883939+KronosOG1@users.noreply.github.com
1a86a58a827fd07c6a43cd730b532b7ee33c9216
6b9763ec3666483d8ec47666501e58e2e75fc98d
/src/Main.java
24b82916d96adb2d1b8fbfa0bfaa62ee47523e61
[]
no_license
misha-lavrov/Root-finding-Algoritghms
662ae2ddcdce4061ae67dba8199d9d3c7b94b817
1c3cdccdb2e620e5707c36067e9c295ff27dbd55
refs/heads/master
2020-06-12T06:51:11.323487
2019-06-28T07:06:19
2019-06-28T07:06:19
194,224,868
0
0
null
null
null
null
UTF-8
Java
false
false
714
java
public class Main { public static void main(String[] args) { Function f = (x) -> Math.pow(x, 5) + 4 * x + 4; Function g = (x) -> x - 0.1 * f.apply(x); Function f1 = (x) -> 5 * Math.pow(x, 4) + 4; Function f2 = (x) -> 20 * Math.pow(x, 3); double a = -2; double b = 2; double error = 0.001; BisectionMethod bisectionMethod = new BisectionMethod(f, a, b, error); NewtonsMethod newtonsMethod = new NewtonsMethod(f, f1, f2, a, b, error); JustIterationMethod justIterationMethod = new JustIterationMethod(f, g, a, b, error); bisectionMethod.solve(); newtonsMethod.solve(); justIterationMethod.solve(); } }
[ "misha.lavrov1999@gmail.com" ]
misha.lavrov1999@gmail.com
1f8cab8aff1b30157a8b69d1bea7fd5bee291946
eb9f655206c43c12b497c667ba56a0d358b6bc3a
/plugins/gradle/tooling-extension-api/src/org/jetbrains/plugins/gradle/tooling/serialization/internal/adapter/InternalIdeaSingleEntryLibraryDependency.java
206b2f527da06403c939aac1cc1b1bd0041fe223
[ "Apache-2.0" ]
permissive
JetBrains/intellij-community
2ed226e200ecc17c037dcddd4a006de56cd43941
05dbd4575d01a213f3f4d69aa4968473f2536142
refs/heads/master
2023-09-03T17:06:37.560889
2023-09-03T11:51:00
2023-09-03T12:12:27
2,489,216
16,288
6,635
Apache-2.0
2023-09-12T07:41:58
2011-09-30T13:33:05
null
UTF-8
Java
false
false
1,882
java
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.gradle.tooling.serialization.internal.adapter; import org.gradle.tooling.model.GradleModuleVersion; import org.gradle.tooling.model.idea.IdeaSingleEntryLibraryDependency; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.io.File; @ApiStatus.Internal public final class InternalIdeaSingleEntryLibraryDependency extends InternalIdeaDependency implements IdeaSingleEntryLibraryDependency { @NotNull private final File myFile; @Nullable private File mySource; @Nullable private File myJavadoc; private InternalGradleModuleVersion myModuleVersion; public InternalIdeaSingleEntryLibraryDependency(@NotNull File file) {myFile = file;} @NotNull @Override public File getFile() { return myFile; } @Nullable @Override public File getSource() { return mySource; } public void setSource(@Nullable File source) { mySource = source; } @Nullable @Override public File getJavadoc() { return myJavadoc; } @Override public boolean isExported() { return getExported(); } public void setJavadoc(@Nullable File javadoc) { myJavadoc = javadoc; } @Override public GradleModuleVersion getGradleModuleVersion() { return myModuleVersion; } public void setModuleVersion(InternalGradleModuleVersion moduleVersion) { myModuleVersion = moduleVersion; } @Override public String toString() { return "IdeaSingleEntryLibraryDependency{" + "myFile=" + myFile + ", mySource=" + mySource + ", myJavadoc=" + myJavadoc + ", myModuleVersion=" + myModuleVersion + "} " + super.toString(); } }
[ "intellij-monorepo-bot-no-reply@jetbrains.com" ]
intellij-monorepo-bot-no-reply@jetbrains.com
4a9fc9b441d80674890cffd0b7be908a30cf77b1
dc85680bfde6f28f468292da603c3b5670a3b340
/packages/mobile/android/hubapphost/src/main/java/com/microsoft/teams/sdk/models/SdkAppResource.java
eeb9a832bea4e0b5c1d5d97e3dd2e4ec1ace8ed7
[]
no_license
mganandraj/HubAppHost
452126bcb4fa448cbcaa40e34a7bcc16accce840
85be7cae522e9cd153c4f66347d40bd2a036d9f8
refs/heads/main
2023-09-01T16:19:59.547970
2021-10-12T15:46:48
2021-10-12T15:46:48
334,803,545
0
0
null
null
null
null
UTF-8
Java
false
false
2,780
java
/* * Copyright © Microsoft Corporation. All rights reserved. */ package com.microsoft.teams.sdk.models; import android.net.Uri; import android.util.Log; import androidx.annotation.Nullable; import com.microsoft.teams.utilities.java.StringUtils; /** * Represents a resource managed by an SDK app. */ public final class SdkAppResource { private static final String RESOURCE_SCHEME = "res"; private static final String FLUENT_SCHEME = "fluent"; private static final String STRINGS_RESOURCE_HOST = "strings"; private static final String IMAGES_RESOURCE_HOST = "images"; public final String id; public final ResourceType type; public static SdkAppResource fromUri(@Nullable String resourceUri) { if (StringUtils.isEmpty(resourceUri)) { return null; } Uri parsedResourceUri = Uri.parse(resourceUri); String scheme = parsedResourceUri.getScheme(); if (scheme == null) { return null; } try { switch (scheme) { case RESOURCE_SCHEME: String resourceType = parsedResourceUri.getHost(); String resourceId = parsedResourceUri.getPath(); if (resourceId == null) { throw new Exception("Invalid resource URI: " + parsedResourceUri.toString() + ". Path is null."); } if (resourceId.startsWith("/")) { resourceId = resourceId.substring(1); } if (STRINGS_RESOURCE_HOST.equalsIgnoreCase(resourceType)) { return new SdkAppResource(resourceId, ResourceType.STRING); } if (IMAGES_RESOURCE_HOST.equalsIgnoreCase(resourceType)) { return new SdkAppResource(resourceId, ResourceType.IMAGE); } throw new Exception("Unknown resource type: " + resourceType); case FLUENT_SCHEME: return new SdkAppResource(resourceUri.substring(FLUENT_SCHEME.length() + "://".length()), ResourceType.FLUENT_ICON); default: throw new Exception("Unknown resource scheme " + parsedResourceUri.getScheme()); } } catch (Exception ex) { //TODO: only alternative here is to add an ILogger member to this class. Log.e("SdkAppResource", String.format("Failed to parse resource uri %s.", resourceUri), ex); return null; } } private SdkAppResource(String id, ResourceType type) { this.id = id; this.type = type; } public enum ResourceType { STRING, IMAGE, FLUENT_ICON } }
[ "mganandraj@outlook.com" ]
mganandraj@outlook.com
526ba90fe06f73eb82cea375552ea2e5b0ab7f71
fea1222095e0a3d02dacc75f76505b6018c7509e
/lab9/DataSetReader.java
09a1efda4438c4d70eb95a15da36ceb14aa72fad
[]
no_license
ethanyc216/CSCI455_Introduction_to_Programming_Systems_Design
db445669c1f3e8bd522bff600e52b4d1390bf98e
69b66ba820d7dc9be79e66ea85dc5aeb788cc7b7
refs/heads/master
2020-07-26T14:21:27.619959
2020-01-13T19:22:13
2020-01-13T19:22:13
208,673,101
1
0
null
null
null
null
UTF-8
Java
false
false
1,695
java
import java.io.File; import java.io.IOException; import java.util.Scanner; /** Reads a data set from a file. The file must have the format numberOfValues value1 value2 . . . */ public class DataSetReader { private double[] data; /** Reads a data set. @param filename the name of the file holding the data @return the data in the file */ public double[] readFile(String filename) throws IOException { File inFile = new File(filename); Scanner in = new Scanner(inFile); try { readData(in); return data; } finally { in.close(); } } /** Reads all data. @param in the scanner that scans the data */ private void readData(Scanner in) throws BadDataException { if (!in.hasNextInt()) { throw new BadDataException("Length expected"); } int numberOfValues = in.nextInt(); data = new double[numberOfValues]; for (int i = 0; i < numberOfValues; i++) { readValue(in, i); } if (in.hasNext()) { throw new BadDataException("Too many data values given"); } } /** Reads one data value. @param in the scanner that scans the data @param i the position of the value to read */ private void readValue(Scanner in, int i) throws BadDataException { if (!in.hasNext()) { throw new BadDataException("Too few data values given"); } if (!in.hasNextDouble()) { throw new BadDataException("Non-floating point value given: " + in.next()); } data[i] = in.nextDouble(); } }
[ "ethanyc216@gmail.com" ]
ethanyc216@gmail.com
281c210e8b1601f8eb61d936c9c2c26d7bc9d0db
507955ae1ae8efc0b772a02399d15cced3d0442c
/spring1_0/src/main/java/com/gupao/gp16306/spring1_0/demo/mvc/action/DemoAction.java
218111b519ebb8c4f2e8aaaf805f6f809851ff87
[]
no_license
fire-feng/GP16306
0f302b8bc0492c9fba59f9db6fd02bace2d29ca2
8ae1f9278750e27b69dfc51513de51b42a0207bf
refs/heads/master
2022-12-24T23:27:26.797874
2019-06-25T16:10:23
2019-06-25T16:10:23
174,558,990
0
0
null
2022-12-16T04:24:32
2019-03-08T15:12:56
Java
UTF-8
Java
false
false
1,831
java
package com.gupao.gp16306.spring1_0.demo.mvc.action; import com.gupao.gp16306.spring1_0.demo.service.IDemoService; import com.gupao.gp16306.spring1_0.mvcframework.annotation.FFAutowired; import com.gupao.gp16306.spring1_0.mvcframework.annotation.FFController; import com.gupao.gp16306.spring1_0.mvcframework.annotation.FFRequestMapping; import com.gupao.gp16306.spring1_0.mvcframework.annotation.FFRequestParam; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; @FFController @FFRequestMapping("/demo") public class DemoAction { @FFAutowired private IDemoService demoService ; @FFRequestMapping("/query") public void query(HttpServletRequest req , HttpServletResponse resp, @FFRequestParam("name") String name){ String result = "My name is " + name; try { resp.getWriter().write(result); } catch (IOException e) { e.printStackTrace(); } } @FFRequestMapping("/add") public void add(HttpServletRequest req,HttpServletResponse resp, @FFRequestParam("a") Integer a,@FFRequestParam("b") Integer b){ try { resp.getWriter().write(a + "+" + b+ "=" + (a+b)); } catch (IOException e) { e.printStackTrace(); } } @FFRequestMapping("/sub") public void sub(HttpServletRequest req,HttpServletResponse resp, @FFRequestParam("a") Double a,@FFRequestParam("b" ) Double b){ try { resp.getWriter().write(a + "-" + b+ "=" + (a-b)); } catch (IOException e) { e.printStackTrace(); } } @FFRequestMapping("/remove") public String remove(@FFRequestParam("id") Integer id) { return "" + id; } }
[ "369596957@qq.com" ]
369596957@qq.com
30489be8775a522cffd063b70aca5587b703b18c
612b1b7f5201f3ff1a550b09c96218053e195519
/modules/global/src/com/haulmont/cuba/core/global/DeletePolicy.java
911e9e225eb14e15680ad696f91c42c9765909f1
[ "Apache-2.0" ]
permissive
cuba-platform/cuba
ffb83fe0b089056e8da11d96a40c596d8871d832
36e0c73d4e3b06f700173c4bc49c113838c1690b
refs/heads/master
2023-06-24T02:03:12.525885
2023-06-19T14:13:06
2023-06-19T14:13:06
54,624,511
1,434
303
Apache-2.0
2023-08-31T18:57:38
2016-03-24T07:55:56
Java
UTF-8
Java
false
false
974
java
/* * Copyright (c) 2008-2016 Haulmont. * * 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.haulmont.cuba.core.global; /** * This enum defines a behaviour to deal with linked objects in case of soft delete<br> * <ul> * <li>DENY - throw {@link DeletePolicyException} when linked object exists * <li>CASCADE - soft delete the linked object * <li>UNLINK - remove link * </ul> * */ public enum DeletePolicy { DENY, CASCADE, UNLINK }
[ "artamonov@haulmont.com" ]
artamonov@haulmont.com
6afd173a2f04f2b6cc6a89a515e9935d54b34058
4977db18e533a4eca3aa98884b3d4cdda0c0532c
/bundles/org.eclipse.wst.jsdt.chromium.debug.ui/src/org/eclipse/wst/jsdt/chromium/debug/ui/editors/JsSourceViewerConfiguration.java
59f3508863ff8a826a1d14ad93f627a92ed301ee
[]
no_license
ibuziuk/webtools.jsdt-1
cf8f9554611ed13f26bc4f5c032f046b291a1587
95ba82cb8f1cd03b45ce7abbe210389a69189a85
refs/heads/master
2020-12-25T17:05:05.602428
2016-01-30T16:34:08
2016-01-30T16:34:08
60,110,257
1
0
null
2016-05-31T17:38:24
2016-05-31T17:38:24
null
UTF-8
Java
false
false
2,653
java
// Copyright (c) 2009 The Chromium Authors. 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.eclipse.wst.jsdt.chromium.debug.ui.editors; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.ITextHover; import org.eclipse.jface.text.TextAttribute; import org.eclipse.jface.text.presentation.IPresentationReconciler; import org.eclipse.jface.text.presentation.PresentationReconciler; import org.eclipse.jface.text.rules.BufferedRuleBasedScanner; import org.eclipse.jface.text.rules.DefaultDamagerRepairer; import org.eclipse.jface.text.rules.Token; import org.eclipse.jface.text.source.ISourceViewer; import org.eclipse.ui.editors.text.TextSourceViewerConfiguration; /** * A JavaScript source viewer configuration. */ public class JsSourceViewerConfiguration extends TextSourceViewerConfiguration { private static class MultilineCommentScanner extends BufferedRuleBasedScanner { public MultilineCommentScanner(TextAttribute attr) { setDefaultReturnToken(new Token(attr)); } } private static final String[] CONTENT_TYPES = new String[] { IDocument.DEFAULT_CONTENT_TYPE, JsPartitionScanner.JSDOC, JsPartitionScanner.MULTILINE_COMMENT }; private final JsCodeScanner scanner = new JsCodeScanner(); @Override public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) { return new JsDebugTextHover(); } @Override public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) { PresentationReconciler pr = new PresentationReconciler(); pr.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer)); setDamagerRepairer(pr, new DefaultDamagerRepairer(scanner), IDocument.DEFAULT_CONTENT_TYPE); setDamagerRepairer( pr, new DefaultDamagerRepairer(new MultilineCommentScanner(scanner.getCommentAttribute())), JsPartitionScanner.MULTILINE_COMMENT); setDamagerRepairer( pr, new DefaultDamagerRepairer(new MultilineCommentScanner(scanner.getJsDocAttribute())), JsPartitionScanner.JSDOC); return pr; } private void setDamagerRepairer( PresentationReconciler pr, DefaultDamagerRepairer damagerRepairer, String tokenType) { pr.setDamager(damagerRepairer, tokenType); pr.setRepairer(damagerRepairer, tokenType); } @Override public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) { return CONTENT_TYPES; } }
[ "dgolovin@gmail.com" ]
dgolovin@gmail.com
7fda744475c3c746db97143ea724949008ce4188
325cc0bc83b6ab8413023d6b9b17f17a02317199
/app/src/main/java/com/testapp/sarvan/broadcastreceiver/view/MainActivity.java
199e40130490e98f6880568ebd61640259cd7fdd
[]
no_license
sarvan2shekar/BroadcastReceiver
20ce9983ed4682c467f2b1a3e17e555bbf1da753
057c7379aca918888c58c8f767c9923abd86180b
refs/heads/master
2021-06-21T19:48:26.391515
2017-08-14T22:33:24
2017-08-14T22:33:24
100,298,071
0
0
null
null
null
null
UTF-8
Java
false
false
1,012
java
package com.testapp.sarvan.broadcastreceiver.view; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.EditText; import com.testapp.sarvan.broadcastreceiver.R; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } public void broadcastCustomIntent(View v) { EditText editText = (EditText) findViewById(R.id.editText_broadcast); Intent intent = new Intent("MyCustomIntent"); if (editText != null && editText.getText() != null && !editText.getText().toString().trim().isEmpty()) { intent.putExtra("message", (CharSequence) editText.getText().toString()); intent.setAction(getString(R.string.receiver_intent_filter)); sendBroadcast(intent); } } }
[ "sarvan2shekar@gmail.com" ]
sarvan2shekar@gmail.com
0c97b0d3511966901214d35354f749114a714cae
e5353d48c89dc7fffacbf6bce83445d57e1df245
/cd-rems-api/src/main/java/com.cd.rems/entity/TCarparkdevice.java
e0dc0f419cd6ed5b500279754e6f74c5a7453d49
[]
no_license
errorxxx/cd-rems
519abafcea62645f51719a0c2cc667aef8b4835b
4623f7ece3ead8bbe872dd8b4b760394ed0b592c
refs/heads/master
2022-12-26T09:39:48.628846
2020-02-18T04:19:20
2020-02-18T04:19:20
218,788,656
0
0
null
2022-12-15T23:30:21
2019-10-31T14:44:13
JavaScript
UTF-8
Java
false
false
13,924
java
package com.cd.rems.entity; import java.io.Serializable; import java.util.Date; public class TCarparkdevice implements Serializable { /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column t_carparkDevice.carparkDeviceId * * @mbg.generated */ private Integer carparkdeviceid; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column t_carparkDevice.deviceBrand * * @mbg.generated */ private String devicebrand; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column t_carparkDevice.installDate * * @mbg.generated */ private Date installdate; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column t_carparkDevice.chargeSystemOwnTypeId * * @mbg.generated */ private Integer chargesystemowntypeid; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column t_carparkDevice.hasContract * * @mbg.generated */ private String hascontract; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column t_carparkDevice.contractStartDate * * @mbg.generated */ private Date contractstartdate; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column t_carparkDevice.contractEndDate * * @mbg.generated */ private Date contractenddate; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column t_carparkDevice.WLANTypeId * * @mbg.generated */ private Integer wlantypeid; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column t_carparkDevice.wiringMode * * @mbg.generated */ private String wiringmode; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column t_carparkDevice.network * * @mbg.generated */ private Integer network; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column t_carparkDevice.internetAccessId * * @mbg.generated */ private Integer internetaccessid; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column t_carparkDevice.otherGive * * @mbg.generated */ private String othergive; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column t_carparkDevice.carparkSurveyInfoId * * @mbg.generated */ private Integer carparksurveyinfoid; /** * This field was generated by MyBatis Generator. * This field corresponds to the database table t_carparkDevice * * @mbg.generated */ private static final long serialVersionUID = 1L; /** * This method was generated by MyBatis Generator. * This method returns the value of the database column t_carparkDevice.carparkDeviceId * * @return the value of t_carparkDevice.carparkDeviceId * * @mbg.generated */ public Integer getCarparkdeviceid() { return carparkdeviceid; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column t_carparkDevice.carparkDeviceId * * @param carparkdeviceid the value for t_carparkDevice.carparkDeviceId * * @mbg.generated */ public void setCarparkdeviceid(Integer carparkdeviceid) { this.carparkdeviceid = carparkdeviceid; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column t_carparkDevice.deviceBrand * * @return the value of t_carparkDevice.deviceBrand * * @mbg.generated */ public String getDevicebrand() { return devicebrand; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column t_carparkDevice.deviceBrand * * @param devicebrand the value for t_carparkDevice.deviceBrand * * @mbg.generated */ public void setDevicebrand(String devicebrand) { this.devicebrand = devicebrand == null ? null : devicebrand.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column t_carparkDevice.installDate * * @return the value of t_carparkDevice.installDate * * @mbg.generated */ public Date getInstalldate() { return installdate; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column t_carparkDevice.installDate * * @param installdate the value for t_carparkDevice.installDate * * @mbg.generated */ public void setInstalldate(Date installdate) { this.installdate = installdate; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column t_carparkDevice.chargeSystemOwnTypeId * * @return the value of t_carparkDevice.chargeSystemOwnTypeId * * @mbg.generated */ public Integer getChargesystemowntypeid() { return chargesystemowntypeid; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column t_carparkDevice.chargeSystemOwnTypeId * * @param chargesystemowntypeid the value for t_carparkDevice.chargeSystemOwnTypeId * * @mbg.generated */ public void setChargesystemowntypeid(Integer chargesystemowntypeid) { this.chargesystemowntypeid = chargesystemowntypeid; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column t_carparkDevice.hasContract * * @return the value of t_carparkDevice.hasContract * * @mbg.generated */ public String getHascontract() { return hascontract; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column t_carparkDevice.hasContract * * @param hascontract the value for t_carparkDevice.hasContract * * @mbg.generated */ public void setHascontract(String hascontract) { this.hascontract = hascontract == null ? null : hascontract.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column t_carparkDevice.contractStartDate * * @return the value of t_carparkDevice.contractStartDate * * @mbg.generated */ public Date getContractstartdate() { return contractstartdate; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column t_carparkDevice.contractStartDate * * @param contractstartdate the value for t_carparkDevice.contractStartDate * * @mbg.generated */ public void setContractstartdate(Date contractstartdate) { this.contractstartdate = contractstartdate; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column t_carparkDevice.contractEndDate * * @return the value of t_carparkDevice.contractEndDate * * @mbg.generated */ public Date getContractenddate() { return contractenddate; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column t_carparkDevice.contractEndDate * * @param contractenddate the value for t_carparkDevice.contractEndDate * * @mbg.generated */ public void setContractenddate(Date contractenddate) { this.contractenddate = contractenddate; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column t_carparkDevice.WLANTypeId * * @return the value of t_carparkDevice.WLANTypeId * * @mbg.generated */ public Integer getWlantypeid() { return wlantypeid; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column t_carparkDevice.WLANTypeId * * @param wlantypeid the value for t_carparkDevice.WLANTypeId * * @mbg.generated */ public void setWlantypeid(Integer wlantypeid) { this.wlantypeid = wlantypeid; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column t_carparkDevice.wiringMode * * @return the value of t_carparkDevice.wiringMode * * @mbg.generated */ public String getWiringmode() { return wiringmode; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column t_carparkDevice.wiringMode * * @param wiringmode the value for t_carparkDevice.wiringMode * * @mbg.generated */ public void setWiringmode(String wiringmode) { this.wiringmode = wiringmode == null ? null : wiringmode.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column t_carparkDevice.network * * @return the value of t_carparkDevice.network * * @mbg.generated */ public Integer getNetwork() { return network; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column t_carparkDevice.network * * @param network the value for t_carparkDevice.network * * @mbg.generated */ public void setNetwork(Integer network) { this.network = network; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column t_carparkDevice.internetAccessId * * @return the value of t_carparkDevice.internetAccessId * * @mbg.generated */ public Integer getInternetaccessid() { return internetaccessid; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column t_carparkDevice.internetAccessId * * @param internetaccessid the value for t_carparkDevice.internetAccessId * * @mbg.generated */ public void setInternetaccessid(Integer internetaccessid) { this.internetaccessid = internetaccessid; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column t_carparkDevice.otherGive * * @return the value of t_carparkDevice.otherGive * * @mbg.generated */ public String getOthergive() { return othergive; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column t_carparkDevice.otherGive * * @param othergive the value for t_carparkDevice.otherGive * * @mbg.generated */ public void setOthergive(String othergive) { this.othergive = othergive == null ? null : othergive.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column t_carparkDevice.carparkSurveyInfoId * * @return the value of t_carparkDevice.carparkSurveyInfoId * * @mbg.generated */ public Integer getCarparksurveyinfoid() { return carparksurveyinfoid; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column t_carparkDevice.carparkSurveyInfoId * * @param carparksurveyinfoid the value for t_carparkDevice.carparkSurveyInfoId * * @mbg.generated */ public void setCarparksurveyinfoid(Integer carparksurveyinfoid) { this.carparksurveyinfoid = carparksurveyinfoid; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table t_carparkDevice * * @mbg.generated */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(getClass().getSimpleName()); sb.append(" ["); sb.append("Hash = ").append(hashCode()); sb.append(", carparkdeviceid=").append(carparkdeviceid); sb.append(", devicebrand=").append(devicebrand); sb.append(", installdate=").append(installdate); sb.append(", chargesystemowntypeid=").append(chargesystemowntypeid); sb.append(", hascontract=").append(hascontract); sb.append(", contractstartdate=").append(contractstartdate); sb.append(", contractenddate=").append(contractenddate); sb.append(", wlantypeid=").append(wlantypeid); sb.append(", wiringmode=").append(wiringmode); sb.append(", network=").append(network); sb.append(", internetaccessid=").append(internetaccessid); sb.append(", othergive=").append(othergive); sb.append(", carparksurveyinfoid=").append(carparksurveyinfoid); sb.append(", serialVersionUID=").append(serialVersionUID); sb.append("]"); return sb.toString(); } }
[ "1010852016@qq.com" ]
1010852016@qq.com
42db89e2bc9719315345b28b2294bef9aac91e05
4035acf15482b6a7e35c50da2bc188a245102337
/src/main/java/com/scarabcoder/ereijan/gui/AuthGUI.java
13db7e2eec714cd029deab406441ed33ae2aa61d
[]
no_license
scarabcoder/TwitterMC
20cc636cc43292aae02eafcb63a2901aecfe33fb
feef5e9bab67d8d411691734aeed9a7adf5e6223
refs/heads/master
2021-01-10T04:04:19.336921
2016-03-28T20:54:36
2016-03-28T20:54:36
54,923,780
0
0
null
null
null
null
UTF-8
Java
false
false
5,123
java
package com.scarabcoder.ereijan.gui; import java.io.IOException; import com.scarabcoder.ereijan.Main; import com.scarabcoder.ereijan.ScarabUtil.ScarabUtil; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiTextField; import net.minecraft.util.ChatComponentText; import twitter4j.StatusUpdate; import twitter4j.Twitter; import twitter4j.TwitterException; import twitter4j.TwitterFactory; import twitter4j.auth.AccessToken; import twitter4j.auth.RequestToken; public class AuthGUI extends GuiScreen{ Minecraft mc = Minecraft.getMinecraft(); private boolean showText = false; private GuiTextField text; public static final int GUI_ID = 20; public AuthGUI(){ } public Twitter twitter; private AccessToken accessToken; private RequestToken requestToken; private boolean showTweet = false; private boolean showTweetBox; @Override public void drawScreen(int mouseX, int mouseY, float partialTicks){ this.drawDefaultBackground(); if(this.showText){ this.text.drawTextBox(); } if(!Main.isDoneAuth){ this.fontRendererObj.drawString("Press get PIN, then in web browser authorize app.", this.width / 2 - 120, this.height / 2, 0xFFFFFF); this.fontRendererObj.drawString("Paste pin in text box and press enter.", this.width / 2 - 120, this.height / 2 + 20, 0xFFFFFF); } //this.text2 = new GuiTextField(2, this.fontRendererObj, 0, this.height/2-46, this.width, 20); this.buttonList.clear(); if(!Main.isDoneAuth){ this.buttonList.add(new GuiButton(1,this.width / 2 - 68, this.height/5, 137, 20, "Get PIN")); } if(Main.isDoneAuth && !this.showTweet){ this.buttonList.add(new GuiButton(2, 10, 10, 160, 20, "Send Tweet")); } if(this.showText){ this.buttonList.add(new GuiButton(3, this.width / 2 - 70, this.height/6 * 4, 140, 20, "Authenticate")); } super.drawScreen(mouseX, mouseY, partialTicks); } @Override public void initGui(){ super.initGui(); this.text = new GuiTextField(1, this.fontRendererObj, this.width / 2 - 68, this.height/2-46, 137, 20); text.setMaxStringLength(7); text.setText(""); this.text.setFocused(true); } public boolean doesGuiPauseGame() { return false; } protected void keyTyped(char par1, int par2) { try { super.keyTyped(par1, par2); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println(par1); this.text.textboxKeyTyped(par1, par2); if(!Main.isDoneAuth){ } //Pressed enter } public void updateScreen() { super.updateScreen(); this.text.updateCursorCounter(); } protected void mouseClicked(int x, int y, int btn) { try { super.mouseClicked(x, y, btn); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } this.text.mouseClicked(x, y, btn); } protected void actionPerformed(GuiButton guibutton) { //id is the id you give your button switch(guibutton.id) { case 1: if(!Main.isAuth){ try{ this.twitter = TwitterFactory.getSingleton(); //Consumer key + consumer secret here. twitter.setOAuthConsumer("####################", "#########################################"); this.requestToken = twitter.getOAuthRequestToken(); this.accessToken = null; Main.url = requestToken.getAuthorizationURL(); Main.isAuth = true; this.showText = true; }catch(Exception e){ e.printStackTrace(); } } ScarabUtil.openWebpage(Main.url); this.showText = true; break; case 2: mc.thePlayer.closeScreen(); mc.displayGuiScreen(new TweetGUI()); break; case 3: if(this.text != null){ try{ accessToken = twitter.getOAuthAccessToken(requestToken, this.text.getText()); System.out.println(twitter.getScreenName()); mc.thePlayer.addChatComponentMessage(new ChatComponentText("Sucessfully connected to Twitter account \"" + twitter.getScreenName() + "\"!")); Main.isDoneAuth = true; Main.twitter = this.twitter; } catch (TwitterException te) { mc.thePlayer.addChatComponentMessage(new ChatComponentText("Error connecting to Twitter! Try restarting Minecraft and trying again.")); if(401 == te.getStatusCode()){ System.out.println("Unable to get the access token."); }else{ te.printStackTrace(); } } mc.thePlayer.closeScreen(); } break; } } }
[ "scarabcoder@gmail.com" ]
scarabcoder@gmail.com
603d883f1a286d6a4997af1bf826f16d4eadf7c9
3b4e141e428f7a693ed05aa16f90e0079bfc80a3
/wangxl/src/main/java/gof/ray/Mediator/A1/ColleagueTextField.java
51fcca2e0916559abae9e727ac8557b7229f88a7
[]
no_license
18612131753/wangxl
8bda332d4c5c4e04ce3b1eb08cbf2ccdcbd67f51
15e8c3a8990151047d9dbe93832047e3a134fb30
refs/heads/master
2021-01-21T21:05:32.770806
2018-05-10T03:27:25
2018-05-10T03:27:25
94,773,030
1
1
null
null
null
null
UTF-8
Java
false
false
902
java
package gof.ray.Mediator.A1; import java.awt.TextField; import java.awt.Color; import java.awt.event.TextListener; import java.awt.event.TextEvent; public class ColleagueTextField extends TextField implements TextListener, Colleague { private static final long serialVersionUID = 1L; private Mediator mediator; public ColleagueTextField(String text, int columns) { // 构造函数 super(text, columns); } public void setMediator(Mediator mediator) { // 保存Mediator this.mediator = mediator; } public void setColleagueEnabled(boolean enabled) { // Mediator下达启用/禁用的指示 setEnabled(enabled); setBackground(enabled ? Color.white : Color.lightGray); } public void textValueChanged(TextEvent e) { // 当文字发生变化时通知Mediator mediator.colleagueChanged(); } }
[ "32411043@qq.com" ]
32411043@qq.com
4d3406bbb054c651f239f87c3c0aad60d0009d8f
718fc28d72bf791396f218f33396951f5799cf03
/app/src/main/java/com/hagai/realitest/welcome/model/LabelInteractorImpl.java
76444316a39809ed5d478acb87d061496385c2e2
[]
no_license
hagaiy/RealiTest
473c8aacca91d00316b438f1ff6149035ec7fdc6
51afd1b5d5ab9a1513f72149f3e5de09743ffe4f
refs/heads/master
2021-01-23T12:57:07.887324
2017-09-06T21:53:58
2017-09-06T21:53:58
102,661,946
0
0
null
null
null
null
UTF-8
Java
false
false
702
java
package com.hagai.realitest.welcome.model; import com.hagai.realitest.utils.sharedPrefs.SharedPrefsUtil; import com.hagai.realitest.welcome.presenter.WelcomeContract; /** * Created by hagay on 9/4/2017. */ public class LabelInteractorImpl implements WelcomeContract.Model.LabelIntercator { WelcomeContract.Model.LabelIntercatorCallback mCallback; public LabelInteractorImpl(WelcomeContract.Model.LabelIntercatorCallback callback) { this.mCallback = callback; } @Override public void findLabel() { SharedPrefsUtil sharedPrefsUtil = new SharedPrefsUtil(); String label = sharedPrefsUtil.readLabel(); mCallback.onLabel(label); } }
[ "y.hagai@gmail.com" ]
y.hagai@gmail.com
fa82f9d10e0cbf5fd9d4cccdfabf99ce6d5bb980
2686c0aaa7693397a39e83b7adee4b6b898d35fc
/src/Divus/VelocidadeCollection.java
8d8e6a6ede0a4880d1ea4823f5cadee970eec9bf
[]
no_license
thomazsouzagomes/MeusTestes
ea52a1c49fcf57bbbb8aa5af8e8ec9392fbf3a0f
240a5cb9c3a1646c0aeda6f9daa6161a5f90fe7d
refs/heads/master
2020-03-26T15:56:32.637861
2015-04-20T10:08:33
2015-04-20T10:08:33
25,178,466
0
0
null
null
null
null
UTF-8
Java
false
false
566
java
package Divus; import java.util.List; import java.util.ArrayList; import java.util.HashSet; import java.util.Set; public class VelocidadeCollection { public static void main(String[] args) { Long inicio = System.currentTimeMillis(); List lista = new ArrayList(); Set set = new HashSet(); for(int i=0;i<30000;i++){ //lista.add(i); set.add(i); } for(int i=0;i<30000;i++){ //lista.contains(i); set.contains(i); } Long fim = System.currentTimeMillis(); System.out.println(fim - inicio + "ms"); } }
[ "thomazsouzagomes@gmail.com" ]
thomazsouzagomes@gmail.com
2cd149b3e3e4e270b32e412b48563cc8c962c98f
00bc420ac10eace88e3726f4f5c2bb15a4d024dc
/src/com/Briggeman/Tuples/Pair.java
b8615a76b77d24ca677eb66118a102dc52cc54f8
[ "MIT" ]
permissive
CBriggeman/Java-Tuples
d3ddb399ca3b2553d59d38feb9f3baecd828449d
aae9b4cc4491675f4d592924cab76ab69376fa1f
refs/heads/master
2021-01-02T09:20:26.427662
2012-11-13T06:05:19
2012-11-13T06:05:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,636
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.Briggeman.Tuples; /** * * @author Chris Briggeman */ public class Pair<T1, T2> { private T1 a; private T2 b; /* * Need wildcards for the next pair, so that the linked pairs * can be different types. */ Pair<? extends Object, ? extends Object> nextPair = null; boolean hasNext = false; public Pair() { } public Pair(T1 a1) { this.a = a1; this.b = null; } public Pair(Pair<?,?> aPair) { a = (T1)aPair.geta(); b = (T2)aPair.getb(); } public Pair(T1 a1, T2 b1) { this.a = a1; this.b = b1; nextPair = null; } protected Pair(T1 a1, Pair<? extends Object, ? extends Object> aPair) { this.a = a1; this.b = null; nextPair = aPair; hasNext = true; } public Pair get() { return this; } public T1 geta() { return this.a; } public T2 getb() { return this.b; } protected Pair<? extends Object, ? extends Object> getNext() { return nextPair; } protected boolean hasNext() { return hasNext; } @Override public String toString() { if(this.hasNext == false) { if(this.b ==null) { return String.format("%s ", a.toString()); } return String.format("%s %s", a.toString(), b.toString()); } else { return String.format("%s ", a.toString()); } } }
[ "cbriggeman06@gmail.com" ]
cbriggeman06@gmail.com
358f1351f72c60026d664099f10f365179eaaed9
dea6c027f80bbc7416bab8de0837846144fd569a
/StarNubServer/src/main/java/starnubserver/cache/wrappers/package-info.java
80b5d29bdf36d7c529efbf110a5cc517c78bd74c
[]
no_license
r00t-s/StarNubMain-1
d129d30ccbf44ea3d7049f41f8d27c7b24788a69
0883218ec3970bbe78f5bed9df452530649a9706
refs/heads/master
2020-05-17T19:21:17.517711
2015-01-02T18:34:18
2015-01-02T18:34:18
28,726,712
0
0
null
2015-01-02T21:22:53
2015-01-02T21:22:52
null
UTF-8
Java
false
false
185
java
/** * starnubserver.utilities.cache.wrappers is the package containing all of the Cache Wrappers each * wrapper may have a unique type of key */ package starnubserver.cache.wrappers;
[ "admin@myfu.net" ]
admin@myfu.net
5169c6461961add111ce5c616e52e50b5f6dc163
94e8d5dac32fb4c3a923713631a473ad2e4a7ad4
/src/main/java/com/spring/beans3/UserController.java
05c48338b890d50f7c28e3dfdae8e70f8ee86ecc
[]
no_license
yuandengfeng/springmvc
5a0d24757e519d1d40f4d22f696dde1e945e8576
bb3d00494e8ddfe1b0c8cb1a893b1de040d0e876
refs/heads/master
2021-01-20T19:19:17.083945
2018-04-23T07:34:19
2018-04-23T07:34:19
65,434,847
0
0
null
null
null
null
UTF-8
Java
false
false
265
java
package com.spring.beans3; import org.springframework.stereotype.Controller; /** * Created by Administrator on 2016/2/23. */ @Controller public class UserController { public void execute() { System.out.println("UserController execute..."); } }
[ "yuandengfeng@ambimmort.com" ]
yuandengfeng@ambimmort.com
d494be2080dbc144ef4b6feafaed14e9dc451835
1b342913d27a606ade7f8ae5aab14e6ef57dfbd3
/A3/code/lib-source/java/lang/Error.java
23ad0d468cbbb3410a5b9e0f056c5f7f39a0f2eb
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
bxio/csc360
4554d98c53f44881b86d4ad519fc5b18f3c0b369
894943f9e0cd7e4982cb0c907bd2524db7d4a58d
refs/heads/master
2021-01-01T06:32:31.402348
2013-08-17T12:01:42
2013-08-17T12:01:42
38,722,601
0
0
null
null
null
null
UTF-8
Java
false
false
655
java
/* ** simpleRTJ java language core library component. ** ** See the http://www.gnu.org/copyleft/gpl.html for ** details on usage and redistribution of this file. */ package java.lang; /** * An Error is a more serious problem that has been generated by the run-time * system. * * For detailed description of this class see the Java language documentation. */ public class Error extends Throwable { /** * Creates an Error class. */ public Error() { super(); } /** * Creates an Error with the detail message. */ public Error(String s) { super(s); } }
[ "billxiong99@gmail.com" ]
billxiong99@gmail.com
876336e2075353295859164f35cb398386c4895b
f4cc0bec5c4be2a937b4b688dc043391b3471c8e
/order/src/main/java/com/gsq/mall/order/OrderApplication.java
7be0b3b331d402564c2456b561fe66bc4d685337
[]
no_license
a569329637/mall
addaf9221c02936f507a0fe27c8f0ce3180b3684
4196a80a552240d64a94000fa57d810660f41260
refs/heads/master
2022-11-11T06:46:32.440457
2020-07-06T07:18:17
2020-07-06T07:18:17
277,213,407
0
0
null
null
null
null
UTF-8
Java
false
false
404
java
package com.gsq.mall.order; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.openfeign.EnableFeignClients; @EnableFeignClients @SpringBootApplication public class OrderApplication { public static void main(String[] args) { SpringApplication.run(OrderApplication.class, args); } }
[ "569329637@qq.com" ]
569329637@qq.com
fb81605765d023d620bd2e1478d06adcb5341ac5
a4d3b65156e6433a996efa2c550fdeb40af96a7e
/myJSP/build/generated/src/org/apache/jsp/signup_jsp.java
b4afb8bf97e3c73564e9d1936205416948c7e43e
[]
no_license
kayeew/Java-Web-App
85278389d9e3dbb3ea962e04c73c280df2384350
80c51a7b89afaa4581c1cec640b5bbab0a831b8e
refs/heads/master
2020-03-30T05:21:36.988352
2018-09-28T21:13:11
2018-09-28T21:13:11
150,794,214
0
0
null
null
null
null
UTF-8
Java
false
false
6,578
java
package org.apache.jsp; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; public final class signup_jsp extends org.apache.jasper.runtime.HttpJspBase implements org.apache.jasper.runtime.JspSourceDependent { private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory(); private static java.util.List<String> _jspx_dependants; static { _jspx_dependants = new java.util.ArrayList<String>(1); _jspx_dependants.add("/navbar.jsp"); } private org.glassfish.jsp.api.ResourceInjector _jspx_resourceInjector; public java.util.List<String> getDependants() { return _jspx_dependants; } public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page = this; JspWriter _jspx_out = null; PageContext _jspx_page_context = null; try { response.setContentType("text/html;charset=UTF-8"); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); _jspx_page_context = pageContext; application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; _jspx_resourceInjector = (org.glassfish.jsp.api.ResourceInjector) application.getAttribute("com.sun.appserv.jsp.resource.injector"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("<!DOCTYPE html>\n"); out.write("<html>\n"); out.write(" <head>\n"); out.write(" <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n"); out.write(" <title>Sign Up</title>\n"); out.write(" <link href=\"css/style.css\" rel=\"stylesheet\" type=\"text/css\">\n"); out.write(" </head>\n"); out.write(" <body>\n"); out.write(" "); out.write("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n"); out.write("<link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css\">\n"); out.write("\n"); out.write("</head>\n"); out.write("<body>\n"); out.write("\n"); out.write(" <nav>\n"); out.write(" <div class=\"container-fluid\">\n"); out.write(" <div class=\"navbar-header\">\n"); out.write(" <a class=\"navbar-brand\" href=\"index.jsp\">myJSP</a>\n"); out.write(" </div>\n"); out.write(" <ul class=\"nav navbar-nav\">\n"); out.write(" \n"); out.write(" "); if (session.getAttribute("username") == null) { out.write("\n"); out.write(" \n"); out.write(" <li class=\"active\"><a href=\"index.jsp\">Home</a></li>\n"); out.write(" <li><a href=\"about.jsp\">About</a></li>\n"); out.write(" <li><a href=\"#\">Page 1</a></li>\n"); out.write(" <li><a href=\"#\">Page 2</a></li>\n"); out.write(" </ul>\n"); out.write(" <ul class=\"nav navbar-nav navbar-right\">\n"); out.write(" <li><a href=\"signup.jsp\"><span class=\"glyphicon glyphicon-user\"></span> Sign Up</a></li>\n"); out.write(" <li><a href=\"login.jsp\"><span class=\"glyphicon glyphicon-log-in\"></span> Login</a></li>\n"); out.write(" </ul>\n"); out.write(" \n"); out.write(" "); } else { //visible for logged in users out.write("\n"); out.write(" \n"); out.write(" <li class=\"active\"><a href=\"welcomePage.jsp\">Home</a></li>\n"); out.write(" <li><a href=\"booking.jsp\">Make a Booking</a></li>\n"); out.write(" \n"); out.write(" "); if (session.getAttribute("user_type").equals("admin")) { //only admin user can see out.write(" \n"); out.write(" <li><a href=\"approveBooking.jsp\">Approve Booking</a></li>\n"); out.write(" <li><a href=\"userTable.jsp\">Users Table</a></li>\n"); out.write(" "); } out.write("\n"); out.write(" </ul>\n"); out.write(" <ul class=\"nav navbar-nav navbar-right\">\n"); out.write(" <li><a href=\"logout.jsp\">Logout</a></li>\n"); out.write(" </ul>\n"); out.write(" \n"); out.write(" "); } out.write("\n"); out.write(" </div>\n"); out.write(" </nav>\n"); out.write("\n"); out.write(" <br>\n"); out.write(" <div class=\"signup-container\">\n"); out.write(" <form action=\"signupServlet\" method=\"post\" class=\"signup-form\">\n"); out.write(" <h1>Sign Up</h1>\n"); out.write(" <p>Please fill in this form to create an account.</p>\n"); out.write(" <input type=\"text\" id=\"username\" name=\"username\" placeholder=\"Enter Username\" required>\n"); out.write(" <br>\n"); out.write(" <input type=\"email\" id=\"email\" name=\"email\" placeholder=\"Enter Email\" required>\n"); out.write(" <br>\n"); out.write(" <input type=\"password\" id=\"password\" name=\"password\" placeholder=\"Enter Password\" required> \n"); out.write(" <br>\n"); out.write(" <input type=\"submit\" value=\"Signup\">\n"); out.write(" </form> \n"); out.write(" </div>\n"); out.write(" </body>\n"); out.write("</html>\n"); } catch (Throwable t) { if (!(t instanceof SkipPageException)){ out = _jspx_out; if (out != null && out.getBufferSize() != 0) out.clearBuffer(); if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); else throw new ServletException(t); } } finally { _jspxFactory.releasePageContext(_jspx_page_context); } } }
[ "noreply@github.com" ]
noreply@github.com
89a00448ef0225c8e1eff4822c150789d3bf11ed
4796dd4886a80fc827d6c5b4d71996f865e5a648
/ssa/strategy/WithdrawBelowMin.java
d6093a653d0a3aca9811b0b3f4ca65f6558dfde7
[]
no_license
mdube9/MDA-EFSM
1f14995d92f6bbc07d8799f0a6dfec02ef00bad3
3625ccd0a89c759b64e102160bf4c7900508470d
refs/heads/master
2021-01-20T14:55:47.752465
2017-05-09T02:42:21
2017-05-09T02:42:21
90,694,006
2
0
null
null
null
null
UTF-8
Java
false
false
167
java
package com.ssa.strategy; //an abstract class for WithdrawBelowMin action public abstract class WithdrawBelowMin { public abstract void withdrawBelowMinMsg(); }
[ "noreply@github.com" ]
noreply@github.com
c974f817efebbbc2808ec01cddf32b94cea96dc5
06dcce94c84d8453aad67ecd664fe0f7dfc0d6e2
/jc-compchem-nwchem/src/test/java/org/xmlcml/cml/converters/compchem/nwchem/log/NWChemLog2CompchemConverterTest.java
404a114b2a00912ed6e8409be86493ca42edb0eb
[]
no_license
BlueObelisk/jumboconverters-compchem
c30c3412e223d1b46ca2da539ce74714dbad2df3
78120506c3846386081b3b38615e022261ee910e
refs/heads/master
2020-12-01T13:21:11.224781
2019-12-30T22:47:13
2019-12-30T22:47:13
230,638,839
0
0
null
null
null
null
UTF-8
Java
false
false
49,714
java
package org.xmlcml.cml.converters.compchem.nwchem.log; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import java.io.FileOutputStream; import java.io.InputStream; import java.util.List; import nu.xom.Document; import nu.xom.Element; import nu.xom.Node; import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; import org.xmlcml.cml.base.CMLConstants; import org.xmlcml.cml.base.CMLUtil; import org.xmlcml.cml.converters.compchem.nwchem.CompChemConventionTest; import org.xmlcml.cml.converters.util.ClassPathXIncludeResolver; public class NWChemLog2CompchemConverterTest { private static String URI_BASE = ClassPathXIncludeResolver .createClasspath(NWChemLog2CompchemConverterTest.class); private static String FILE_DIRECTORY="/compchem/nwchem/log/jens/"; public static Document convertFile(String filePath) throws Exception { InputStream in = CompChemConventionTest.class .getResourceAsStream(filePath); NWChemLog2XMLConverter converter1 = NWChemLog2XMLConverter.createDefaultConverter(); Element e1 = converter1.convertToXML(in); // CMLUtil.debug(e1, new FileOutputStream("debug1.xml"), 1); NWChemLogXML2CompchemConverter converter2 = NWChemLogXML2CompchemConverter.createDefaultConverter(); Element e2 = converter2.convertToXML(e1); CMLUtil.debug(e2, new FileOutputStream("debug2.xml"), 1); Document doc = CMLUtil.ensureDocument(e2); return doc; } @Test public void testH2oSto3gNoTitle() throws Exception { Document doc = convertFile( FILE_DIRECTORY+"h2o_sto3g_notitle.nwo" ); //compchem:method List<Node> nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:method']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("scf", nodes.get(0).getValue()); //compchem:task nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:task']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("energy", nodes.get(0).getValue()); //compchem:charge nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:charge']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("0.0", nodes.get(0).getValue()); //compchem:pointGroup nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:pointGroup']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("C2v", nodes.get(0).getValue()); //compchem:basisSetLabel nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:initialization']/cml:list[@dictRef='compchem:basisSet']/cml:scalar[@dictRef='compchem:basisSetLabel']/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("sto-3g", nodes.get(0).getValue()); //compchem:wavefunctionType nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:wavefunctionType']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("RHF", nodes.get(0).getValue()); // task for initialGuess nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']//cml:module[@dictRef='compchem:calculation' and @id='initialGuess']/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:task']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("initialGuess", nodes.get(0).getValue()); // e1Energy for initialGuess nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']//cml:module[@dictRef='compchem:calculation' and @id='initialGuess']/cml:module[@dictRef='compchem:finalization']/cml:propertyList/cml:property[@dictRef='compchem:e1Energy']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("-121.780484", nodes.get(0).getValue()); // 2nd SCF iteration totalEnergy nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']//cml:module[@dictRef='compchem:calculation'][position()=3]/cml:module[@dictRef='compchem:finalization']/cml:propertyList/cml:property[@dictRef='compchem:totalEnergy']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("-74.962154715", nodes.get(0).getValue()); //Final totalEnergy nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:finalization']/cml:propertyList/cml:property[@dictRef='compchem:totalEnergy']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("-74.962985614357", nodes.get(0).getValue()); // scf wallTime nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:finalization']/cml:propertyList/cml:property[@dictRef='compchem:wallTime']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("0.0", nodes.get(0).getValue()); } @Test public void testH2oSto3gUhf() throws Exception { Document doc = convertFile( FILE_DIRECTORY+"h2o_sto3g_uhf.nwo" ); //compchem:method List<Node> nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:method']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("scf", nodes.get(0).getValue()); //compchem:task nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:task']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("energy", nodes.get(0).getValue()); //compchem:charge nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:charge']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("0.0", nodes.get(0).getValue()); //compchem:pointGroup nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:pointGroup']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("C2v", nodes.get(0).getValue()); //compchem:basisSetLabel nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:initialization']/cml:list[@dictRef='compchem:basisSet']/cml:scalar[@dictRef='compchem:basisSetLabel']/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("sto-3g", nodes.get(0).getValue()); //compchem:wavefunctionType nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:wavefunctionType']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("UHF", nodes.get(0).getValue()); //compchem:numAlphaElectrons nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:numAlphaElectrons']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("5", nodes.get(0).getValue()); //compchem:numBetaElectrons - FIXME! // nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:numBetaElectrons']/cml:scalar/text()", CMLConstants.CML_XPATH); // assertFalse(nodes.isEmpty()); // assertEquals("5", nodes.get(0).getValue()); // task for initialGuess nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']//cml:module[@dictRef='compchem:calculation' and @id='initialGuess']/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:task']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("initialGuess", nodes.get(0).getValue()); // e1Energy for initialGuess nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']//cml:module[@dictRef='compchem:calculation' and @id='initialGuess']/cml:module[@dictRef='compchem:finalization']/cml:propertyList/cml:property[@dictRef='compchem:e1Energy']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("-121.780484", nodes.get(0).getValue()); // 2nd SCF iteration totalEnergy nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']//cml:module[@dictRef='compchem:calculation'][position()=3]/cml:module[@dictRef='compchem:finalization']/cml:propertyList/cml:property[@dictRef='compchem:totalEnergy']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("-74.9625138416", nodes.get(0).getValue()); //Final totalEnergy nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:finalization']/cml:propertyList/cml:property[@dictRef='compchem:totalEnergy']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("-74.962985614676", nodes.get(0).getValue()); // scf wallTime nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:finalization']/cml:propertyList/cml:property[@dictRef='compchem:wallTime']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("0.0", nodes.get(0).getValue()); } @Test public void testH2oSto3gDftB3lyp() throws Exception { Document doc = convertFile( FILE_DIRECTORY+"h2o_sto3g_dft_b3lyp.nwo" ); //compchem:method List<Node> nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:method']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("dft", nodes.get(0).getValue()); //compchem:task nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:task']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("energy", nodes.get(0).getValue()); //compchem:charge nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:charge']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("0.0", nodes.get(0).getValue()); //compchem:dftFunctionalLabel nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:initialization']/cml:list[@dictRef='compchem:dftFunctional']/cml:scalar[@dictRef='compchem:dftFunctionalLabel']/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("B3LYP", nodes.get(0).getValue()); //compchem:wavefunctionType nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:wavefunctionType']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("closed shell", nodes.get(0).getValue()); // task for initialGuess nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']//cml:module[@dictRef='compchem:calculation' and @id='initialGuess']/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:task']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("initialGuess", nodes.get(0).getValue()); // e1Energy for initialGuess nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']//cml:module[@dictRef='compchem:calculation' and @id='initialGuess']/cml:module[@dictRef='compchem:finalization']/cml:propertyList/cml:property[@dictRef='compchem:e1Energy']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("-121.780484", nodes.get(0).getValue()); // 2nd DFT iteration energy nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']//cml:module[@dictRef='compchem:calculation' and @id='iteration'][position()=3]/cml:module[@dictRef='compchem:finalization']/cml:propertyList/cml:property[@dictRef='compchem:totalEnergy']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("-75.3124327277", nodes.get(0).getValue()); // Final totalEnergy nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:finalization']/cml:propertyList/cml:property[@dictRef='compchem:totalEnergy']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("-75.312451071835", nodes.get(0).getValue()); // dft wallTime nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:finalization']/cml:propertyList/cml:property[@dictRef='compchem:wallTime']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("0.1", nodes.get(0).getValue()); } @Test public void testH2oSto3gOpt() throws Exception { Document doc = convertFile( FILE_DIRECTORY+"h2o_sto3g_opt.nwo" ); //compchem:method List<Node> nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:method']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("scf", nodes.get(0).getValue()); //compchem:task nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:task']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("geometry_optimization", nodes.get(0).getValue()); //compchem:charge nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:charge']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("0.0", nodes.get(0).getValue()); // Final Energy nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:finalization']/cml:propertyList/cml:property[@dictRef='compchem:totalEnergy']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("-74.96590119", nodes.get(0).getValue()); // Get z coordinate of first atom to test we have the correct molecule nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:finalization']/cml:molecule/cml:atomArray/cml:atom[position()=1]/@z3", CMLConstants.CML_XPATH); assertEquals(1, nodes.size()); assertEquals("0.15025565", nodes.get(0).getValue()); // optimisation wallTime nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:finalization']/cml:propertyList/cml:property[@dictRef='compchem:wallTime']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("0.7", nodes.get(0).getValue()); } @Test public void testH2oSto3gDftB3lypOpt() throws Exception { Document doc = convertFile( FILE_DIRECTORY+"h2o_sto3g_dft_b3lyp_opt.nwo" ); //compchem:method List<Node> nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:method']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("dft", nodes.get(0).getValue()); //compchem:task nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:task']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("geometry_optimization", nodes.get(0).getValue()); //compchem:charge nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:charge']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("0.0", nodes.get(0).getValue()); //compchem:dftFunctionalLabel nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:initialization']/cml:list[@dictRef='compchem:dftFunctional']/cml:scalar[@dictRef='compchem:dftFunctionalLabel']/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("B3LYP", nodes.get(0).getValue()); // Final Energy nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:finalization']/cml:propertyList/cml:property[@dictRef='compchem:totalEnergy']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("-75.3227749", nodes.get(0).getValue()); // Get z coordinate of first atom to test we have the correct molecule nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:finalization']/cml:molecule/cml:atomArray/cml:atom[position()=1]/@z3", CMLConstants.CML_XPATH); assertEquals(1, nodes.size()); assertEquals("0.17931911", nodes.get(0).getValue()); } @Test public void testBenzne321gMp2() throws Exception { Document doc = convertFile( FILE_DIRECTORY+"benzene_321g_mp2.nwo" ); //compchem:method List<Node> nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:method']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("mp2", nodes.get(0).getValue()); //compchem:task nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:task']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("energy", nodes.get(0).getValue()); //compchem:charge nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:charge']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("0.0", nodes.get(0).getValue()); //compchem:basisSetLabel nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:initialization']/cml:list[@dictRef='compchem:basisSet']/cml:scalar[@dictRef='compchem:basisSetLabel']/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("3-21g", nodes.get(0).getValue()); //compchem:pointGroup nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:pointGroup']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("D6h", nodes.get(0).getValue()); //compchem:wavefunctionType nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:wavefunctionType']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("RHF", nodes.get(0).getValue()); // task for initialGuess nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']//cml:module[@dictRef='compchem:calculation' and @id='initialGuess']/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:task']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("initialGuess", nodes.get(0).getValue()); // e1Energy for initialGuess nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']//cml:module[@dictRef='compchem:calculation' and @id='initialGuess']/cml:module[@dictRef='compchem:finalization']/cml:propertyList/cml:property[@dictRef='compchem:e1Energy']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("-709.201704", nodes.get(0).getValue()); // 2nd SCF iteration totalEnergy nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']//cml:module[@dictRef='compchem:calculation'][position()=3]/cml:module[@dictRef='compchem:finalization']/cml:propertyList/cml:property[@dictRef='compchem:totalEnergy']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("-229.4183271268", nodes.get(0).getValue()); //Final totalEnergy nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:finalization']/cml:propertyList/cml:property[@dictRef='compchem:totalEnergy']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("-229.94606251021", nodes.get(0).getValue()); } @Test public void testH2oSto3gMp2Opt() throws Exception { Document doc = convertFile( FILE_DIRECTORY+"h2o_sto3g_mp2_opt.nwo" ); //compchem:method List<Node> nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:method']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("mp2", nodes.get(0).getValue()); //compchem:task nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:task']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("geometry_optimization", nodes.get(0).getValue()); //compchem:charge nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:charge']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("0.0", nodes.get(0).getValue()); // Final Energy nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:finalization']/cml:propertyList/cml:property[@dictRef='compchem:totalEnergy']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("-75.00613631", nodes.get(0).getValue()); // Get z coordinate of first atom to test we have the correct molecule nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']/cml:module[@dictRef='compchem:finalization']/cml:molecule/cml:atomArray/cml:atom[position()=1]/@z3", CMLConstants.CML_XPATH); assertEquals(1, nodes.size()); assertEquals("0.17285474", nodes.get(0).getValue()); } @Test public void testArScfMp2Multi() throws Exception { Document doc = convertFile( FILE_DIRECTORY+"Ar_scf-mp2_cc-vqz.nwo" ); // Check we have three jobs List<Node> nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals(3, nodes.size()); //1st job: compchem:method nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job' and position()=1]/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:method']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("mp2", nodes.get(0).getValue()); //1st job: compchem:basisSetLabel nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job' and position()=1]/cml:module[@dictRef='compchem:initialization']/cml:list[@dictRef='compchem:basisSet']/cml:scalar[@dictRef='compchem:basisSetLabel']/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("cc-pvqz", nodes.get(0).getValue()); // 1st Job - Final Energy nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job' and position()=1]/cml:module[@dictRef='compchem:finalization']/cml:propertyList/cml:property[@dictRef='compchem:totalEnergy']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("-527.110448613487", nodes.get(0).getValue()); //2nd job: compchem:method nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job' and position()=1]/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:method']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("mp2", nodes.get(0).getValue()); //2nd job: compchem:basisSetLabel nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job' and position()=1]/cml:module[@dictRef='compchem:initialization']/cml:list[@dictRef='compchem:basisSet']/cml:scalar[@dictRef='compchem:basisSetLabel']/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("cc-pvqz", nodes.get(0).getValue()); // Get z coordinate of first atom to test we have the correct molecule nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job' and position()=2]/cml:module[@dictRef='compchem:initialization']/cml:molecule/cml:atomArray/cml:atom[position()=1]/@z3", CMLConstants.CML_XPATH); assertEquals(1, nodes.size()); assertEquals("0.0", nodes.get(0).getValue()); // 2nd Job - Final Energy nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job' and position()=2]/cml:module[@dictRef='compchem:finalization']/cml:propertyList/cml:property[@dictRef='compchem:totalEnergy']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("-527.110448613487", nodes.get(0).getValue()); //3rd job: compchem:method nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job' and position()=3]/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:method']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("mp2", nodes.get(0).getValue()); //3rd job: compchem:basisSetLabel nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job' and position()=3]/cml:module[@dictRef='compchem:initialization']/cml:list[@dictRef='compchem:basisSet']/cml:scalar[@dictRef='compchem:basisSetLabel']/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("user specified", nodes.get(0).getValue()); // Get z coordinate of first atom to test we have the correct molecule nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job' and position()=3]/cml:module[@dictRef='compchem:initialization']/cml:molecule/cml:atomArray/cml:atom[position()=1]/@z3", CMLConstants.CML_XPATH); assertEquals(1, nodes.size()); assertEquals("0.0", nodes.get(0).getValue()); // 3rd Job - Final Energy nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job' and position()=3]/cml:module[@dictRef='compchem:finalization']/cml:propertyList/cml:property[@dictRef='compchem:totalEnergy']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("-527.110443784669", nodes.get(0).getValue()); } @Test public void testMCSCF() throws Exception { Document doc = convertFile( FILE_DIRECTORY+"mcscf_ch2.nwo" ); // Check we have three jobs List<Node> nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals(3, nodes.size()); //1st job: compchem:method nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job' and position()=1]/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:method']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("scf", nodes.get(0).getValue()); //1st job: compchem:task nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job' and position()=1]/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:task']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("energy", nodes.get(0).getValue()); //1st job: compchem:basisSetLabel nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job' and position()=1]/cml:module[@dictRef='compchem:initialization']/cml:list[@dictRef='compchem:basisSet']/cml:scalar[@dictRef='compchem:basisSetLabel']/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("6-31g**", nodes.get(0).getValue()); // 1st Job - Final Energy nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job' and position()=1]/cml:module[@dictRef='compchem:finalization']/cml:propertyList/cml:property[@dictRef='compchem:totalEnergy']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("-38.857160053103", nodes.get(0).getValue()); //2nd job: compchem:method nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job' and position()=2]/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:method']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("mcscf", nodes.get(0).getValue()); //2nd job: compchem:task nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job' and position()=2]/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:task']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("geometry_optimization", nodes.get(0).getValue()); //2nd job: compchem:basisSetLabel nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job' and position()=2]/cml:module[@dictRef='compchem:initialization']/cml:list[@dictRef='compchem:basisSet']/cml:scalar[@dictRef='compchem:basisSetLabel']/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("6-31g**", nodes.get(0).getValue()); // Get z coordinate of first atom to test we have the correct molecule nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job' and position()=2]/cml:module[@dictRef='compchem:initialization']/cml:molecule/cml:atomArray/cml:atom[position()=1]/@z3", CMLConstants.CML_XPATH); assertEquals(1, nodes.size()); assertEquals("0.205", nodes.get(0).getValue()); // 2nd Job - Final Energy nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job' and position()=2]/cml:module[@dictRef='compchem:finalization']/cml:propertyList/cml:property[@dictRef='compchem:totalEnergy']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("-38.95876065", nodes.get(0).getValue()); // 2nd Job final molecule - Get z coordinate of first atom to test we have the correct molecule nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job' and position()=2]/cml:module[@dictRef='compchem:finalization']/cml:molecule/cml:atomArray/cml:atom[position()=1]/@z3", CMLConstants.CML_XPATH); assertEquals(1, nodes.size()); assertEquals("0.23336589", nodes.get(0).getValue()); //3rd job: compchem:method nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job' and position()=3]/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:method']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("mcscf", nodes.get(0).getValue()); // Get z coordinate of first atom to test we have the correct molecule nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job' and position()=3]/cml:module[@dictRef='compchem:initialization']/cml:molecule/cml:atomArray/cml:atom[position()=1]/@z3", CMLConstants.CML_XPATH); assertEquals(1, nodes.size()); assertEquals("0.23336589", nodes.get(0).getValue()); // 3rd Job - Final Energy nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job' and position()=3]/cml:module[@dictRef='compchem:finalization']/cml:propertyList/cml:property[@dictRef='compchem:totalEnergy']/cml:scalar/text()", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals("-38.916059261199", nodes.get(0).getValue()); } @Test public void testScfAndDftProperties() throws Exception { Document doc = convertFile( FILE_DIRECTORY+"h2o_props.nwo" ); // Check we have three jobs List<Node> nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job']", CMLConstants.CML_XPATH); assertFalse(nodes.isEmpty()); assertEquals(2, nodes.size()); // // //1st job: compchem:method // nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job' and position()=1]/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:method']/cml:scalar/text()", CMLConstants.CML_XPATH); // assertFalse(nodes.isEmpty()); // assertEquals("scf", nodes.get(0).getValue()); // // //1st job: compchem:task // nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job' and position()=1]/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:task']/cml:scalar/text()", CMLConstants.CML_XPATH); // assertFalse(nodes.isEmpty()); // assertEquals("energy", nodes.get(0).getValue()); // // //1st job: compchem:basisSetLabel // nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job' and position()=1]/cml:module[@dictRef='compchem:initialization']/cml:list[@dictRef='compchem:basisSet']/cml:scalar[@dictRef='compchem:basisSetLabel']/text()", CMLConstants.CML_XPATH); // assertFalse(nodes.isEmpty()); // assertEquals("6-31g**", nodes.get(0).getValue()); // // // 1st Job - Final Energy // nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job' and position()=1]/cml:module[@dictRef='compchem:finalization']/cml:propertyList/cml:property[@dictRef='compchem:totalEnergy']/cml:scalar/text()", CMLConstants.CML_XPATH); // assertFalse(nodes.isEmpty()); // assertEquals("-38.857160053103", nodes.get(0).getValue()); // // //2nd job: compchem:method // nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job' and position()=2]/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:method']/cml:scalar/text()", CMLConstants.CML_XPATH); // assertFalse(nodes.isEmpty()); // assertEquals("mcscf", nodes.get(0).getValue()); // // //2nd job: compchem:task // nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job' and position()=2]/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:task']/cml:scalar/text()", CMLConstants.CML_XPATH); // assertFalse(nodes.isEmpty()); // assertEquals("geometry_optimization", nodes.get(0).getValue()); // // //2nd job: compchem:basisSetLabel // nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job' and position()=2]/cml:module[@dictRef='compchem:initialization']/cml:list[@dictRef='compchem:basisSet']/cml:scalar[@dictRef='compchem:basisSetLabel']/text()", CMLConstants.CML_XPATH); // assertFalse(nodes.isEmpty()); // assertEquals("6-31g**", nodes.get(0).getValue()); // // // Get z coordinate of first atom to test we have the correct molecule // nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job' and position()=2]/cml:module[@dictRef='compchem:initialization']/cml:molecule/cml:atomArray/cml:atom[position()=1]/@z3", CMLConstants.CML_XPATH); // assertEquals(1, nodes.size()); // assertEquals("0.205", nodes.get(0).getValue()); // // // 2nd Job - Final Energy // nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job' and position()=2]/cml:module[@dictRef='compchem:finalization']/cml:propertyList/cml:property[@dictRef='compchem:totalEnergy']/cml:scalar/text()", CMLConstants.CML_XPATH); // assertFalse(nodes.isEmpty()); // assertEquals("-38.95876065", nodes.get(0).getValue()); // // // // 2nd Job final molecule - Get z coordinate of first atom to test we have the correct molecule // nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job' and position()=2]/cml:module[@dictRef='compchem:finalization']/cml:molecule/cml:atomArray/cml:atom[position()=1]/@z3", CMLConstants.CML_XPATH); // assertEquals(1, nodes.size()); // assertEquals("0.23336589", nodes.get(0).getValue()); // // //3rd job: compchem:method // nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job' and position()=3]/cml:module[@dictRef='compchem:initialization']/cml:parameterList/cml:parameter[@dictRef='compchem:method']/cml:scalar/text()", CMLConstants.CML_XPATH); // assertFalse(nodes.isEmpty()); // assertEquals("mcscf", nodes.get(0).getValue()); // // // // Get z coordinate of first atom to test we have the correct molecule // nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job' and position()=3]/cml:module[@dictRef='compchem:initialization']/cml:molecule/cml:atomArray/cml:atom[position()=1]/@z3", CMLConstants.CML_XPATH); // assertEquals(1, nodes.size()); // assertEquals("0.23336589", nodes.get(0).getValue()); // // // 3rd Job - Final Energy // nodes = CMLUtil.getQueryNodes(doc, "/cml:*[@convention='convention:compchem']/cml:module[@dictRef='compchem:jobList']/cml:module[@dictRef='compchem:job' and position()=3]/cml:module[@dictRef='compchem:finalization']/cml:propertyList/cml:property[@dictRef='compchem:totalEnergy']/cml:scalar/text()", CMLConstants.CML_XPATH); // assertFalse(nodes.isEmpty()); // assertEquals("-38.916059261199", nodes.get(0).getValue()); } }
[ "linucks42@gmail.com" ]
linucks42@gmail.com
a897251290bee0e019ebf082d318517678c00e70
9ba55de87881db1bdcadce64ff91e9a7ab49bdc8
/app/src/main/java/com/developer/calllogmanager/MissedCallsFragment.java
c1e3bf6f57f1250d3e0c119a1e9c717bee525e5b
[]
no_license
HamzaRajput007/CallLogNotes-931ba2c260834eaf8b90812f982f58cb0ff546a3
384431a32816338bbb95664a8135a5d5aec474ba
ace894bda4268a1ad00857f19a201d03949aa990
refs/heads/master
2022-11-08T16:41:09.041259
2020-07-06T13:26:06
2020-07-06T13:26:06
277,312,532
0
0
null
null
null
null
UTF-8
Java
false
false
2,232
java
package com.developer.calllogmanager; import android.databinding.DataBindingUtil; import android.content.Intent; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.developer.calllogmanager.databinding.CallLogFragmentBinding; public class MissedCallsFragment extends Fragment{ CallLogFragmentBinding binding; CallLogAdapter adapter; CallLogAdapter.OnCallLogItemClickListener onItemClickListener; @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { binding = DataBindingUtil.inflate(LayoutInflater.from(getContext()),R.layout.call_log_fragment,container,false); initComponents(); return binding.getRoot(); } public void initComponents(){ RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getContext()); binding.recyclerView.setLayoutManager(mLayoutManager); binding.recyclerView.setItemAnimator(new DefaultItemAnimator()); adapter = new CallLogAdapter(getContext()); binding.recyclerView.setAdapter(adapter); loadData(); } public void loadData(){ CallLogUtils callLogUtils = CallLogUtils.getInstance(getContext()); // adapter.addAllCallLog(callLogUtils.getMissedCalls()); adapter.notifyDataSetChanged(); onItemClickListener = new CallLogAdapter.OnCallLogItemClickListener() { @Override public void onItemClicked(CallLogInfo callLogInfo) { Intent intent = new Intent(getContext(),StatisticsActivity.class); intent.putExtra("number",callLogInfo.getNumber()); intent.putExtra("name",callLogInfo.getName()); startActivity(intent); } }; adapter.setOnItemClickListener(onItemClickListener); } }
[ "hamzabhai0004@gmail.com" ]
hamzabhai0004@gmail.com
e6c11d347150d4548d310010e9e21d8fc63ee01a
61317a9a74e940eb53ec814e363d3210c5b8a70b
/SS4/customer.java
eb112e44a298eedcb2c611c6f48fec0f3e8cd412
[]
no_license
tranduong12893/Java1
57b2359bec9922785ab53a5b13f70c74c56d3d08
fba47572378c22a1177585fc7c2c50fd8b98b448
refs/heads/main
2023-04-18T06:53:51.130961
2021-04-28T07:18:44
2021-04-28T07:18:44
353,641,705
1
0
null
null
null
null
UTF-8
Java
false
false
1,144
java
package SS4; public class customer { int customerId; String customerName; String customerAddress; int customerAge; public static void main(String[] args) { customer objcustomer1 = new customer(); objcustomer1.customerId= 100; objcustomer1.customerName="Tran van Thai"; objcustomer1.customerAddress="40 tran phu"; objcustomer1.customerAge=30; System.out.println("Customer Identification Number: "+ objcustomer1.customerId); System.out.println("Customer Name is: "+ objcustomer1.customerName); System.out.println("Customer Address is: "+ objcustomer1.customerAddress); System.out.println("Customer Age is: "+ objcustomer1.customerAge); } void changeCustomerAddress(String address){ customerAddress = address; } void displayCustomerInformation(){ System.out.println("Customer Identification Number: "+ customerId); System.out.println("Customer Name is: "+ customerName); System.out.println("Customer Address is: "+ customerAddress); System.out.println("Customer Age is: "+ customerAge); } }
[ "73330600+tranduong12893@users.noreply.github.com" ]
73330600+tranduong12893@users.noreply.github.com
316abe342c5c0296b9381ccb1aa0fac6140364c0
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/16/16_6406d051899a7b2e07bc91c1623dc65ee9ae4b53/JS_BlockFace/16_6406d051899a7b2e07bc91c1623dc65ee9ae4b53_JS_BlockFace_s.java
31bf3da4c84319654cba379971892b976f7bf32d
[]
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
1,445
java
package mave.minecraftjs; import org.bukkit.block.BlockFace; import org.mozilla.javascript.*; public class JS_BlockFace extends ScriptableObject { private static final long serialVersionUID = -5381627693919188543L; public BlockFace blockFace = null; public JS_BlockFace() { } public void initializeFunctionProperties() { defineFunctionProperties(new String[] { "toString" }, JS_BlockFace.class, DONTENUM); } public static void jsConstructor(Context cx, Object[] args, Function ctorObj, boolean inNewExpr) { if (MinecraftJS.m_bInternalConstruction) { return; } JS_BlockFace caller = (JS_BlockFace)ctorObj; if (args.length < 1) { throw new IllegalArgumentException(); } caller.blockFace = ConvertUtility.stringToBlockFace(Context.toString(args[0])); } @Override public String toString() { return blockFace.toString(); } @Override public String getClassName() { return "BlockFace"; } public int jsGet_modX() { return blockFace.getModX(); } public int jsGet_modY() { return blockFace.getModY(); } public int jsGet_modZ() { return blockFace.getModZ(); } public Scriptable jsGet_oppositeFace() { Context cx = Context.getCurrentContext(); Scriptable scope = ScriptableObject.getTopLevelScope(this); return ConvertUtility.toScriptable(blockFace.getOppositeFace(), cx, scope); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
bc84f372e5824ee386e44324427488c056cdd0a6
af63c06a724f4826ebfb76fa7d1d70cd544c30e9
/src/main/java/dev/controller/RoleCtrl.java
bb095881747956e70139d65b3f4a276eb214037c
[]
no_license
cqlv2/forum
e039692b88ae5028bac82e5243f499ffda608d46
92ed7187ba1383b0259d27eb0322d7ecc00c32d8
refs/heads/master
2023-02-06T07:37:37.684400
2020-12-18T13:08:47
2020-12-18T13:08:47
322,553,123
0
0
null
null
null
null
UTF-8
Java
false
false
651
java
package dev.controller; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import dev.services.RoleService; @RestController @CrossOrigin @RequestMapping("role") public class RoleCtrl { RoleService roleServ; public RoleCtrl(RoleService roleServ) { super(); this.roleServ = roleServ; } @GetMapping public ResponseEntity<?> getAll() { return ResponseEntity.ok().body(roleServ.getAll()); } }
[ "samianto@gmail.com" ]
samianto@gmail.com
0e600a25b53c92e82cb80bd0db7c792c6eacc730
6e2b0e34cc0f065919beb8938982d1362e8d53ea
/cloud_recruit/src/main/java/com/jbb/recruit/controller/EnterpriseController.java
fa29d13100d297faa1b09fe8c976454a20e6343f
[]
no_license
jbb892543969/springcloud
7e95931aa5a6521347bd62788e056e0e00f55bcf
a90ddb48004b77fc4a8f883ef892ce4f20476f6c
refs/heads/master
2020-04-29T06:14:24.040213
2019-04-15T13:11:30
2019-04-15T13:11:30
175,910,031
0
0
null
null
null
null
UTF-8
Java
false
false
3,314
java
package com.jbb.recruit.controller; import baseenum.StatusEnum; import com.jbb.recruit.pojo.Enterprise; import com.jbb.recruit.service.EnterpriseService; import entity.PageResult; import entity.Result; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.web.bind.annotation.*; import java.util.Map; /** * 控制器层 * * @author Administrator */ @RestController @CrossOrigin @RequestMapping("/enterprise") public class EnterpriseController { @Autowired private EnterpriseService enterpriseService; /** * 查询全部数据 * * @return */ @RequestMapping(method = RequestMethod.GET) public Result findAll() { return new Result(true, StatusEnum.SUCCESS.getCode(), "查询成功", enterpriseService.findAll()); } /** * 根据ID查询 * * @param id ID * @return */ @RequestMapping(value = "/{id}", method = RequestMethod.GET) public Result findById(@PathVariable String id) { return new Result(true, StatusEnum.SUCCESS.getCode(), "查询成功", enterpriseService.findById(id)); } /** * 分页+多条件查询 * * @param searchMap 查询条件封装 * @param page 页码 * @param size 页大小 * @return 分页结果 */ @RequestMapping(value = "/search/{page}/{size}", method = RequestMethod.POST) public Result findSearch(@RequestBody Map searchMap, @PathVariable int page, @PathVariable int size) { Page<Enterprise> pageList = enterpriseService.findSearch(searchMap, page, size); return new Result(true, StatusEnum.SUCCESS.getCode(), "查询成功", new PageResult<Enterprise>(pageList.getTotalElements(), pageList.getContent())); } /** * 根据条件查询 * * @param searchMap * @return */ @RequestMapping(value = "/search", method = RequestMethod.POST) public Result findSearch(@RequestBody Map searchMap) { return new Result(true, StatusEnum.SUCCESS.getCode(), "查询成功", enterpriseService.findSearch(searchMap)); } /** * 增加 * * @param enterprise */ @RequestMapping(method = RequestMethod.POST) public Result add(@RequestBody Enterprise enterprise) { enterpriseService.add(enterprise); return new Result(true, StatusEnum.SUCCESS.getCode(), "增加成功"); } /** * 修改 * * @param enterprise */ @RequestMapping(value = "/{id}", method = RequestMethod.PUT) public Result update(@RequestBody Enterprise enterprise, @PathVariable String id) { enterprise.setId(id); enterpriseService.update(enterprise); return new Result(true, StatusEnum.SUCCESS.getCode(), "修改成功"); } /** * 删除 * * @param id */ @RequestMapping(value = "/{id}", method = RequestMethod.DELETE) public Result delete(@PathVariable String id) { enterpriseService.deleteById(id); return new Result(true, StatusEnum.SUCCESS.getCode(), "删除成功"); } @GetMapping("/search/hotList") public Result hotList() { return new Result(true, StatusEnum.SUCCESS.getCode(), "查询成功", enterpriseService.hostList("1")); } }
[ "892543969@qq.com" ]
892543969@qq.com
cbffa94aa05e0f493f77bd35b07d48c146c5cc1d
53e1530d418dcda795cd140db4d736a65695f37b
/SpringInAction/src/main/java/sia/messaging/ConventionalReceiver.java
cee320ff02ad1bf87aea0937e1c63179c523f87c
[]
no_license
Zed180881/Zed_repo
a03bac736e3c61c0bea61b2f81624c4bc604870b
6e9499e7ec3cfa9dc11f9d7a92221522c56b5f61
refs/heads/master
2020-04-05T18:57:47.596468
2016-11-02T07:51:30
2016-11-02T07:51:30
52,864,144
0
0
null
null
null
null
UTF-8
Java
false
false
1,625
java
package sia.messaging; import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.Destination; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageConsumer; import javax.jms.Session; import javax.jms.TextMessage; import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.command.ActiveMQQueue; public class ConventionalReceiver { public static void main(String[] args) { //<start id="conventional_message_receiver"/> ConnectionFactory cf = new ActiveMQConnectionFactory("tcp://localhost:61616"); Connection conn = null; Session session = null; try { conn = cf.createConnection(); conn.start(); session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); Destination destination = new ActiveMQQueue("spitter.queue"); MessageConsumer consumer = session.createConsumer(destination); Message message = consumer.receive(); TextMessage textMessage = (TextMessage) message; System.out.println("GOT A MESSAGE: " + textMessage.getText()); conn.start(); } catch (JMSException e) { // handle exception? } finally { try { if (session != null) { session.close(); } if (conn != null) { conn.close(); } } catch (JMSException ex) { } } //<end id="conventional_message_receiver"/> } }
[ "zed180881@gmail.com" ]
zed180881@gmail.com
5140987955ec9935bbb7864e4b313d1d4fba9b65
08680691c776dcfad48ba7f6d4c3172fcef43c33
/DBMS-Session5-Assignment/src/assignment1/TestOrders.java
ce44448cce51b56c4a4bede5f4103813fa92bac2
[]
no_license
meta-nikhil-saxena/GET2018
76af0d30652c669f192dc642ef3ec54f0c2b2244
a9b5ebd8e1ea1b6cd0d3252ef1c92451d609c1b9
refs/heads/master
2020-03-23T05:05:14.754167
2018-10-24T05:17:12
2018-10-24T05:17:12
141,124,020
0
2
null
2018-10-24T05:17:12
2018-07-16T10:33:06
Java
UTF-8
Java
false
false
1,746
java
package assignment1; import static org.junit.Assert.*; import org.junit.Test; public class TestOrders { @Test public void testOrders() { OrderOperation operation = new OrderOperation(); assertEquals(1, operation.getOrderData(1).get(0).getId()); assertEquals("2018-08-17 22:48:19", operation.getOrderData(1).get(0) .getOrderdate()); assertEquals(200000, operation.getOrderData(1).get(0).getTotalcost()); } @Test public void testOrders2() { OrderOperation operation = new OrderOperation(); assertEquals(2, operation.getOrderData(2).get(0).getId()); assertEquals("2018-08-17 22:48:19", operation.getOrderData(2).get(0) .getOrderdate()); assertEquals(900000, operation.getOrderData(2).get(0).getTotalcost()); } @Test public void testOrders3() { OrderOperation operation = new OrderOperation(); assertEquals(3, operation.getOrderData(3).get(0).getId()); assertEquals("2018-08-17 22:48:19", operation.getOrderData(3).get(0) .getOrderdate()); assertEquals(10000, operation.getOrderData(3).get(0).getTotalcost()); } @Test public void testOrders4() { OrderOperation operation = new OrderOperation(); assertEquals(4, operation.getOrderData(4).get(0).getId()); assertEquals("2018-08-17 22:48:19", operation.getOrderData(4).get(0) .getOrderdate()); assertEquals(6750, operation.getOrderData(4).get(0).getTotalcost()); } @Test public void testOrders5() { OrderOperation operation = new OrderOperation(); assertEquals(5, operation.getOrderData(5).get(0).getId()); assertEquals("2018-08-17 22:48:19", operation.getOrderData(5).get(0) .getOrderdate()); assertEquals(5750, operation.getOrderData(5).get(0).getTotalcost()); } }
[ "noreply@github.com" ]
noreply@github.com
58314806b4457db79424ed23fd2640d440f21ec2
1a1f3a79bf8bf29d8fc41997a3569992cf547927
/EcomTracking/1.1/EcomTracking/src/com/paquetexpress/consultas/consultasucursalenvio/response/DatoAdicional.java
a9a3fdaa52469aa680b09670079ba2130fc5279c
[]
no_license
nesrob91/nesrob
bda624a7a9b0e13bfa54cc2601fca666d3d7f3af
b84cba3ec7870608dce3a184a614ff36dd948d46
refs/heads/main
2023-03-28T16:39:16.857896
2021-04-04T05:11:11
2021-04-04T05:11:11
303,464,208
0
0
null
null
null
null
UTF-8
Java
false
false
5,507
java
package com.paquetexpress.consultas.consultasucursalenvio.response; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * <p>Clase Java para anonymous complex type. * * <p>El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element ref="{http://www.paquetexpress.com/consultas/consultaSucursalEnvio/Response}claveDataAd"/> * &lt;element ref="{http://www.paquetexpress.com/consultas/consultaSucursalEnvio/Response}valorDataAd"/> * &lt;element ref="{http://www.paquetexpress.com/consultas/consultaSucursalEnvio/Response}dataAditional1"/> * &lt;element ref="{http://www.paquetexpress.com/consultas/consultaSucursalEnvio/Response}dataAditional2"/> * &lt;element ref="{http://www.paquetexpress.com/consultas/consultaSucursalEnvio/Response}dataAditional3"/> * &lt;element ref="{http://www.paquetexpress.com/consultas/consultaSucursalEnvio/Response}dataAditional4"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "claveDataAd", "valorDataAd", "dataAditional1", "dataAditional2", "dataAditional3", "dataAditional4" }) @XmlRootElement(name = "DatoAdicional") public class DatoAdicional { @XmlElement(required = true) protected String claveDataAd; @XmlElement(required = true) protected String valorDataAd; @XmlElement(required = true) protected String dataAditional1; @XmlElement(required = true) protected String dataAditional2; @XmlElement(required = true) protected String dataAditional3; @XmlElement(required = true) protected String dataAditional4; /** * Obtiene el valor de la propiedad claveDataAd. * * @return * possible object is * {@link String } * */ public String getClaveDataAd() { return claveDataAd; } /** * Define el valor de la propiedad claveDataAd. * * @param value * allowed object is * {@link String } * */ public void setClaveDataAd(String value) { this.claveDataAd = value; } /** * Obtiene el valor de la propiedad valorDataAd. * * @return * possible object is * {@link String } * */ public String getValorDataAd() { return valorDataAd; } /** * Define el valor de la propiedad valorDataAd. * * @param value * allowed object is * {@link String } * */ public void setValorDataAd(String value) { this.valorDataAd = value; } /** * Obtiene el valor de la propiedad dataAditional1. * * @return * possible object is * {@link String } * */ public String getDataAditional1() { return dataAditional1; } /** * Define el valor de la propiedad dataAditional1. * * @param value * allowed object is * {@link String } * */ public void setDataAditional1(String value) { this.dataAditional1 = value; } /** * Obtiene el valor de la propiedad dataAditional2. * * @return * possible object is * {@link String } * */ public String getDataAditional2() { return dataAditional2; } /** * Define el valor de la propiedad dataAditional2. * * @param value * allowed object is * {@link String } * */ public void setDataAditional2(String value) { this.dataAditional2 = value; } /** * Obtiene el valor de la propiedad dataAditional3. * * @return * possible object is * {@link String } * */ public String getDataAditional3() { return dataAditional3; } /** * Define el valor de la propiedad dataAditional3. * * @param value * allowed object is * {@link String } * */ public void setDataAditional3(String value) { this.dataAditional3 = value; } /** * Obtiene el valor de la propiedad dataAditional4. * * @return * possible object is * {@link String } * */ public String getDataAditional4() { return dataAditional4; } /** * Define el valor de la propiedad dataAditional4. * * @param value * allowed object is * {@link String } * */ public void setDataAditional4(String value) { this.dataAditional4 = value; } }
[ "72758876+nesrob91@users.noreply.github.com" ]
72758876+nesrob91@users.noreply.github.com
e73ac16588d3be2977c93de9f5427f382ab52311
ad786b4422e506847236e5a1ce2f9d2c1a391361
/budgetApp/src/main/java/budgetapp/banks/swedbank/client/SwedbankClient.java
e62f48ebbeffc30a2b638dbfe062aaf2a7cc064e
[]
no_license
steenstn/BudgetApp
06011e3db981acd99a729e913e49d953c7ad9b66
bdd8ec85ac14fd24283203e9aff27360bc016f8b
refs/heads/master
2021-01-20T11:25:30.001713
2018-05-19T08:54:17
2018-05-19T08:54:17
6,986,027
0
0
null
2013-03-05T07:02:10
2012-12-03T17:02:12
Java
UTF-8
Java
false
false
4,706
java
package budgetapp.banks.swedbank.client; import android.util.Base64; import org.apache.commons.lang3.RandomStringUtils; import org.apache.http.Header; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.CookieStore; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.impl.client.BasicCookieStore; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.impl.cookie.BasicClientCookie; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.util.UUID; import budgetapp.banks.BankHttpResponse; public class SwedbankClient { private CookieStore cookieStore; private String baseUrl = "https://auth.api.swedbank.se/TDE_DAP_Portal_REST_WEB/api/v2"; private DefaultHttpClient httpClient; public SwedbankClient() { httpClient = new DefaultHttpClient(); cookieStore = new BasicCookieStore(); httpClient.setCookieStore(cookieStore); } public void shutdown() { httpClient.getConnectionManager().shutdown(); } public BankHttpResponse post(String endPoint, HttpEntity entity) throws IOException { HttpPost postRequest = createPostRequest(endPoint, entity); return call(postRequest); } public BankHttpResponse get(String endPoint) throws IOException { HttpGet getRequest = createGetRequest(endPoint); return call(getRequest); } private HttpPost createPostRequest(String urlEndPoint, HttpEntity entity) { String dsId = dsId(); HttpPost request = new HttpPost(baseUrl + urlEndPoint + dsIdUrl(dsId)); request.setHeader("Authorization", getAuth()); request.setHeader("Accept", "application/json"); request.setHeader("Content-Type", "application/json"); request.setEntity(entity); addCookie(cookieStore, dsId); return request; } private HttpGet createGetRequest(String urlEndPoint) { String dsId = dsId(); HttpGet request = new HttpGet(baseUrl + urlEndPoint + dsIdUrl(dsId)); request.setHeader("Authorization", getAuth()); request.setHeader("Accept", "application/json"); request.setHeader("Content-Type", "application/json"); addCookie(cookieStore, dsId); return request; } private static void addCookie(CookieStore cs, String dsId) { BasicClientCookie cookie = new BasicClientCookie("dsid", dsId); cookie.setDomain(".api.swedbank.se"); cookie.setPath("/"); cookie.setVersion(0); cs.addCookie(cookie); } private BankHttpResponse call(HttpUriRequest request) throws IOException { System.out.println("Calling headers"); for (Header h : request.getAllHeaders()) { System.out.println(h.getName() + " " + h.getValue()); } System.out.println("Calling " + request.getURI().toString()); HttpResponse response = httpClient.execute(request); System.out.println(response.toString()); System.out.println("Response headers"); for (Header h : response.getAllHeaders()) { System.out.println(h); } String responseBody = parseResponse(response); return new BankHttpResponse(response.getStatusLine().getStatusCode(), responseBody); } private String getAuth() { String uuid = UUID.randomUUID().toString(); String auth = "HithYAGrzi8fu73j:" + uuid; try { return new String(Base64.encode(auth.getBytes("UTF-8"), Base64.NO_WRAP)); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return null; } private String dsIdUrl(String dsId) { return "?dsid=" + dsId; } private String dsId() { return RandomStringUtils.randomAlphabetic(4).toLowerCase() + RandomStringUtils.randomAlphabetic(4).toUpperCase(); } private String parseResponse(HttpResponse response) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader((response.getEntity().getContent()))); String output = ""; StringBuilder sb = new StringBuilder(); System.out.println("Output from Server .... \n"); System.out.println("Status: " + response.getStatusLine().getStatusCode()); while ((output = br.readLine()) != null) { System.out.println(output); sb.append(output).append("\n"); } return sb.toString(); } }
[ "alexander_steen@hotmail.com" ]
alexander_steen@hotmail.com
4650f4223957bbcae7232760df280a5ac80d59a5
8937b595420ff3417a3a3dc3be343971e243a8b8
/NetBeansProjects/java-swing-crud-master/src/testing1/latihan_image.java
e0541074a193c4fad41762636a2eb1492c57e3c6
[]
no_license
nioke-dev/full-projects-netbeans
f4bb227b3309dc38da78c5804277bea9f51c9e8e
c26e7a0b60d634ceb4ef626bb098aa77d6c9c4f1
refs/heads/main
2023-03-04T16:17:08.837848
2021-02-12T08:01:08
2021-02-12T08:01:08
338,255,648
0
0
null
null
null
null
UTF-8
Java
false
false
15,164
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 testing1; import java.awt.Image; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.ImageIcon; import javax.swing.JFileChooser; import javax.swing.JOptionPane; import javax.swing.filechooser.FileNameExtensionFilter; import javax.swing.table.DefaultTableModel; import static latihan_3.koneksi.conn; import testing_2.java_mysql_image_insert_update_delete_search; /** * * @author The Coders */ public class latihan_image extends javax.swing.JFrame { /** * Creates new form latihan_image */ private DefaultTableModel model; private Statement st; private ResultSet rs; public latihan_image() { initComponents(); iniTable(); getDataTable(); } String imgpath = null; private void iniTable(){ model = new DefaultTableModel(); tbl_image.setModel(model); model.addColumn("ID"); model.addColumn("IMAGE"); } private void getDataTable(){ //remove si table trus set lagi model.getDataVector().removeAllElements(); model.fireTableDataChanged(); try { String sql = "select * from tbl_images"; st = getConnection().createStatement(); rs = st.executeQuery(sql); while (rs.next()) { Object[] o = new Object[6]; o[0] = rs.getString("id"); o[1] = rs.getBytes("The_image"); model.addRow(o); } } catch (SQLException e) { } } public static Connection getConnection(){ Connection conn = null; try { conn = DriverManager.getConnection("jdbc:mysql://localhost/latihan_images_3", "root", ""); return conn; } catch (Exception e) { e.printStackTrace(); JOptionPane.showMessageDialog(null, "Not Connected"); return null; } } // Function To Resize The Image To Fit Into JLabel private ImageIcon ResizeImage(String ImagePath, byte[] pic){ ImageIcon MyImage = null; if(ImagePath != null) { MyImage = new ImageIcon(ImagePath); }else { MyImage = new ImageIcon(pic); } Image img = MyImage.getImage(); Image newImg = img.getScaledInstance(lbl_image.getWidth(), lbl_image.getHeight(), Image.SCALE_SMOOTH); ImageIcon image = new ImageIcon(newImg); return image; } /** * 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() { jLabel1 = new javax.swing.JLabel(); btn_add = new javax.swing.JButton(); btn_choose = new javax.swing.JButton(); lbl_image = new javax.swing.JLabel(); btn_edit = new javax.swing.JButton(); btn_delete = new javax.swing.JButton(); jSpinner1 = new javax.swing.JSpinner(); jButton5 = new javax.swing.JButton(); jScrollPane1 = new javax.swing.JScrollPane(); tbl_image = new javax.swing.JTable(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jLabel1.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel1.setText("LATIHAN IMAGES"); btn_add.setText("Add"); btn_add.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_addActionPerformed(evt); } }); btn_choose.setText("Choose images"); btn_choose.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_chooseActionPerformed(evt); } }); lbl_image.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); btn_edit.setText("Edit"); btn_delete.setText("Delete"); jButton5.setText("Search"); tbl_image.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null, null, null}, {null, null, null, null}, {null, null, null, null}, {null, null, null, null} }, new String [] { "Title 1", "Title 2", "Title 3", "Title 4" } )); tbl_image.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { tbl_imageMouseClicked(evt); } }); jScrollPane1.setViewportView(tbl_image); 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) .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap(16, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(btn_add, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(btn_choose, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(btn_edit, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(btn_delete, javax.swing.GroupLayout.Alignment.TRAILING)) .addGap(18, 18, 18) .addComponent(lbl_image, javax.swing.GroupLayout.PREFERRED_SIZE, 610, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap()) .addGroup(layout.createSequentialGroup() .addGap(271, 271, 271) .addComponent(jSpinner1, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jButton5) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(111, 111, 111)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel1) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(79, 79, 79) .addComponent(btn_add) .addGap(18, 18, 18) .addComponent(btn_choose) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(btn_edit) .addGap(18, 18, 18) .addComponent(btn_delete)) .addGroup(layout.createSequentialGroup() .addGap(26, 26, 26) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jSpinner1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton5)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(lbl_image, javax.swing.GroupLayout.PREFERRED_SIZE, 371, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(18, 18, 18) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); pack(); }// </editor-fold>//GEN-END:initComponents // Button Browse Image From Your Computer // 1 - Browse Image From Computer And Display It In JLabel // Using ResizeImage Function // 2 - Set The Image Path Into imgPath // To Check Later If An Image Was Selected private void btn_chooseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_chooseActionPerformed // TODO add your handling code here: //browse images JFileChooser file = new JFileChooser(); file.setCurrentDirectory(new File(System.getProperty("user.home"))); //filter the files FileNameExtensionFilter filter = new FileNameExtensionFilter("*.Images", "jpg", "png", "gif"); file.addChoosableFileFilter(filter); int result = file.showSaveDialog(null); //if the user click on save in jfilechooser if (result == JFileChooser.APPROVE_OPTION) { File selectedFile = file.getSelectedFile(); String path = selectedFile.getAbsolutePath(); lbl_image.setIcon(ResizeImage(path, null)); imgpath = path; }else if (result == JFileChooser.CANCEL_OPTION) { System.out.println("No File Select"); } }//GEN-LAST:event_btn_chooseActionPerformed // Button Insert Image Into MySQL Database // 1 - Check If The imgPath Is Not Null ( Select Image To Insert ) // 2 - Insert The Image private void btn_addActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_addActionPerformed // TODO add your handling code here: if (imgpath != null) { try { PreparedStatement ps = getConnection().prepareStatement("INSERT INTO tbl_images(The_image) VALUES(?)"); InputStream img = new FileInputStream(new File(imgpath)); ps.setBlob(1, img); if(ps.executeUpdate() == 1) { JOptionPane.showMessageDialog(null, "Image Inserted"); } } catch (Exception e) { JOptionPane.showMessageDialog(null, e.getMessage()); } }else{ JOptionPane.showMessageDialog(null, "No Image Selected"); } }//GEN-LAST:event_btn_addActionPerformed private void tbl_imageMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tbl_imageMouseClicked // TODO add your handling code here: // int id = Integer.parseInt(JSPINNER_ID.getValue().toString()); int baris = tbl_image.getSelectedRow(); String id = model.getValueAt(baris, 0).toString(); String SelectQuery = "SELECT * FROM tbl_images WHERE id = "+id; Statement st; ResultSet rs; try { st = getConnection().createStatement(); rs = st.executeQuery(SelectQuery); if(rs.next()) { lbl_image.setIcon(ResizeImage(null, rs.getBytes("The_image"))); }else{ JOptionPane.showMessageDialog(null, "ImageNot Found"); } } catch (SQLException ex) { Logger.getLogger(java_mysql_image_insert_update_delete_search.class.getName()).log(Level.SEVERE, null, ex); } }//GEN-LAST:event_tbl_imageMouseClicked /** * @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(latihan_image.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(latihan_image.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(latihan_image.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(latihan_image.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 latihan_image().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btn_add; private javax.swing.JButton btn_choose; private javax.swing.JButton btn_delete; private javax.swing.JButton btn_edit; private javax.swing.JButton jButton5; private javax.swing.JLabel jLabel1; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JSpinner jSpinner1; private javax.swing.JLabel lbl_image; private javax.swing.JTable tbl_image; // End of variables declaration//GEN-END:variables }
[ "nioke8090@gmail.com" ]
nioke8090@gmail.com
44b03a9d3563ab860d4e39313918567fafa3cd3f
dfcf12d0015a2bd1e8da5ebfd9add6585aee6414
/substance/src/main/java/org/pushingpixels/substance/api/SubstanceLookAndFeel.java
c413616e166d273eac300c3cbe811914893aabe6
[ "BSD-3-Clause" ]
permissive
https-ultronhouse-com/radiance
1176a6222ee3e765af599cb5e00eaefcee95f61f
0f4851821b311de7a92244565685817c46069f74
refs/heads/master
2020-06-25T20:05:09.965232
2019-07-21T14:29:46
2019-07-21T14:29:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
12,238
java
/* * Copyright (c) 2005-2019 Radiance Kirill Grouchnikov. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * o Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * o Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * o Neither the name of the copyright holder nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.pushingpixels.substance.api; import org.pushingpixels.neon.NeonCortex; import org.pushingpixels.neon.internal.contrib.jgoodies.looks.LookUtils; import org.pushingpixels.substance.api.colorscheme.SubstanceColorScheme; import org.pushingpixels.substance.internal.*; import org.pushingpixels.substance.internal.contrib.jgoodies.looks.common.ShadowPopupFactory; import org.pushingpixels.substance.internal.ui.*; import org.pushingpixels.substance.internal.utils.*; import javax.swing.*; import javax.swing.plaf.basic.BasicLookAndFeel; import java.awt.*; import java.awt.event.*; import java.awt.image.BufferedImage; import java.beans.*; import java.util.Map; /** * <p> * Base class for <b>Substance </b> look and feel. There are three options to use Substance in your * application: * </p> * * <ul> * <li>Use {@link UIManager#setLookAndFeel(javax.swing.LookAndFeel)} or * {@link UIManager#setLookAndFeel(String)} passing one of the core skin-based look-and-feels in the * <code>org.pushingpixels.substance.api.skin</code> package.</li> * <li>Extend this class, pass a skin instance to the {@link #SubstanceLookAndFeel(SubstanceSkin)} * constructor, and then use {@link UIManager#setLookAndFeel(javax.swing.LookAndFeel)}.</li> * <li>Call {@link SubstanceCortex.GlobalScope#setSkin(String)} or * {@link SubstanceCortex.GlobalScope#setSkin(SubstanceSkin)} static methods. These methods do not * require Substance to be the current look-and-feel.</li> * </ul> * * @author Kirill Grouchnikov */ public abstract class SubstanceLookAndFeel extends BasicLookAndFeel { /** * The skin of this look-and-feel instance. */ private SubstanceSkin skin; /** * The name of this look-and-feel instance. */ private String name; private AWTEventListener awtEventListener; /** * Creates a new skin-based Substance look-and-feel. * * @param skin Skin. */ protected SubstanceLookAndFeel(SubstanceSkin skin) { this.skin = skin; this.name = "Substance " + skin.getDisplayName(); } @Override public String getDescription() { return "Substance Look and Feel by Kirill Grouchnikov"; } @Override public String getID() { return this.name; } @Override public String getName() { return this.name; } @Override public boolean isNativeLookAndFeel() { return false; } @Override public boolean isSupportedLookAndFeel() { return true; } @Override protected void initClassDefaults(UIDefaults table) { super.initClassDefaults(table); Object[] uiDefaults = { "ButtonUI", SubstanceButtonUI.class.getName(), "CheckBoxUI", SubstanceCheckBoxUI.class.getName(), "ComboBoxUI", SubstanceComboBoxUI.class.getName(), "CheckBoxMenuItemUI", SubstanceCheckBoxMenuItemUI.class.getName(), "DesktopIconUI", SubstanceDesktopIconUI.class.getName(), "DesktopPaneUI", SubstanceDesktopPaneUI.class.getName(), "EditorPaneUI", SubstanceEditorPaneUI.class.getName(), "FileChooserUI", SubstanceFileChooserUI.class.getName(), "FormattedTextFieldUI", SubstanceFormattedTextFieldUI.class.getName(), "InternalFrameUI", SubstanceInternalFrameUI.class.getName(), "LabelUI", SubstanceLabelUI.class.getName(), "ListUI", SubstanceListUI.class.getName(), "MenuUI", SubstanceMenuUI.class.getName(), "MenuBarUI", SubstanceMenuBarUI.class.getName(), "MenuItemUI", SubstanceMenuItemUI.class.getName(), "OptionPaneUI", SubstanceOptionPaneUI.class.getName(), "PanelUI", SubstancePanelUI.class.getName(), "PasswordFieldUI", SubstancePasswordFieldUI.class.getName(), "PopupMenuUI", SubstancePopupMenuUI.class.getName(), "PopupMenuSeparatorUI", SubstancePopupMenuSeparatorUI.class.getName(), "ProgressBarUI", SubstanceProgressBarUI.class.getName(), "RadioButtonUI", SubstanceRadioButtonUI.class.getName(), "RadioButtonMenuItemUI", SubstanceRadioButtonMenuItemUI.class.getName(), "RootPaneUI", SubstanceRootPaneUI.class.getName(), "ScrollBarUI", SubstanceScrollBarUI.class.getName(), "ScrollPaneUI", SubstanceScrollPaneUI.class.getName(), "SeparatorUI", SubstanceSeparatorUI.class.getName(), "SliderUI", SubstanceSliderUI.class.getName(), "SpinnerUI", SubstanceSpinnerUI.class.getName(), "SplitPaneUI", SubstanceSplitPaneUI.class.getName(), "TabbedPaneUI", SubstanceTabbedPaneUI.class.getName(), "TableUI", SubstanceTableUI.class.getName(), "TableHeaderUI", SubstanceTableHeaderUI.class.getName(), "TextAreaUI", SubstanceTextAreaUI.class.getName(), "TextFieldUI", SubstanceTextFieldUI.class.getName(), "TextPaneUI", SubstanceTextPaneUI.class.getName(), "ToggleButtonUI", SubstanceToggleButtonUI.class.getName(), "ToolBarUI", SubstanceToolBarUI.class.getName(), "ToolBarSeparatorUI", SubstanceToolBarSeparatorUI.class.getName(), "ToolTipUI", SubstanceToolTipUI.class.getName(), "TreeUI", SubstanceTreeUI.class.getName(), "ViewportUI", SubstanceViewportUI.class.getName() }; table.putDefaults(uiDefaults); } @Override protected void initComponentDefaults(UIDefaults table) { super.initComponentDefaults(table); SubstanceCortex.GlobalScope.initFontDefaults(table); this.skin.addCustomEntriesToTable(table); Toolkit toolkit = Toolkit.getDefaultToolkit(); if ((NeonCortex.getPlatform() != NeonCortex.Platform.MACOS) || !LookUtils.IS_OS_MAC_MOJAVE_OR_LATER) { Map<Object, Object> desktopHints = (Map<Object, Object>) toolkit.getDesktopProperty("awt.font.desktophints"); Object aaHint = (desktopHints == null) ? null : desktopHints.get(RenderingHints.KEY_TEXT_ANTIALIASING); if (aaHint == null || aaHint == RenderingHints.VALUE_TEXT_ANTIALIAS_OFF || aaHint == RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT) { // do nothing } else { // This is needed for consistent text rendering / measurement, especially // in text components. table.put(RenderingHints.KEY_TEXT_ANTIALIASING, aaHint); table.put(RenderingHints.KEY_TEXT_LCD_CONTRAST, desktopHints.get(RenderingHints.KEY_TEXT_LCD_CONTRAST)); } } } @Override public UIDefaults getDefaults() { UIDefaults table = super.getDefaults(); SubstancePluginRepository.getInstance().processAllDefaultsEntriesComponentPlugins(table, this.skin); return table; } @Override public void initialize() { super.initialize(); ShadowPopupFactory.install(); SubstanceCortex.GlobalScope.setSkin(this.skin, false); // tracer for memory analysis String traceFilename = (String) UIManager.get(SubstanceSynapse.TRACE_FILE); if (traceFilename != null) { MemoryAnalyzer.commence(1000, traceFilename); for (SubstanceComponentPlugin plugin : SubstancePluginRepository.getInstance() .getComponentPlugins()) MemoryAnalyzer.enqueueUsage("Has plugin '" + plugin.getClass().getName() + "'"); } // to show heap status panel in title pane? String heapStatusTraceFilename = (String) UIManager.get(SubstanceSynapse.HEAP_STATUS_TRACE_FILE); SubstanceTitlePane.setHeapStatusLogfileName(heapStatusTraceFilename); // initialize component plugins SubstancePluginRepository.getInstance().initializeAllComponentPlugins(); this.awtEventListener = (AWTEvent event) -> { for (AWTEventListener awtEventListener : SubstanceCoreUtilities.getAwtEventListeners()) { awtEventListener.eventDispatched(event); } }; Toolkit.getDefaultToolkit().addAWTEventListener(this.awtEventListener, AWTEvent.KEY_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_WHEEL_EVENT_MASK); } @Override public void uninitialize() { super.uninitialize(); Toolkit.getDefaultToolkit().removeAWTEventListener(this.awtEventListener); SubstanceCortex.GlobalScope.unsetSkin(); ShadowPopupFactory.uninstall(); SubstanceCoreUtilities.stopThreads(); // fix for defect 109 - memory leak on watermarks if (this.skin.getWatermark() != null) { this.skin.getWatermark().dispose(); } // uninitialize component plugins SubstancePluginRepository.getInstance().uninitializeAllComponentPlugins(); // clear caches LazyResettableHashMap.reset(); } @Override public boolean getSupportsWindowDecorations() { return true; } @Override public Icon getDisabledIcon(JComponent component, Icon icon) { if (icon == null) { return null; } SubstanceColorScheme colorScheme = SubstanceColorSchemeUtilities.getColorScheme(component, ComponentState.DISABLED_UNSELECTED); BufferedImage result = SubstanceImageCreator.getColorSchemeImage(component, icon, colorScheme, 0.5f); float alpha = SubstanceColorSchemeUtilities.getAlpha(component, ComponentState.DISABLED_UNSELECTED); if (alpha < 1.0f) { BufferedImage intermediate = SubstanceCoreUtilities .getBlankUnscaledImage(result.getWidth(), result.getHeight()); Graphics2D g2d = intermediate.createGraphics(); g2d.setComposite(AlphaComposite.SrcOver.derive(alpha)); g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC); g2d.drawImage(result, 0, 0, result.getWidth(), result.getHeight(), null); g2d.dispose(); result = intermediate; } return new ImageWrapperIcon(result); } }
[ "kirill.grouchnikov@gmail.com" ]
kirill.grouchnikov@gmail.com
18a595e4fbdb002eb5e6e62e98b17cfce369516a
263da56edf57ff8913648d775390f92b23541750
/src/main/java/com/zeroten/javales/InnerClass/CalcMinMax.java
e3d3f0c98ef9d7ee91abf824bd2fa807a8d9c2aa
[]
no_license
Yumistage/Java_study
b15a01e236ae5fcce9c8ffbed0606fa18756a4e7
b98637dd2bb8a11a519eb9d28081f8de3ae5cc60
refs/heads/master
2022-05-30T13:38:28.009146
2020-03-05T03:47:24
2020-03-05T03:47:24
229,952,783
0
0
null
2022-05-25T06:54:09
2019-12-24T14:09:23
Java
UTF-8
Java
false
false
1,296
java
package com.zeroten.javales.InnerClass; public class CalcMinMax { public static class Pair { private int min; private int max; public Pair(int min, int max) { this.min = min; this.max = max; } public int getMin() { return min; } public int getMax() { return max; } } public static int[] calc(int... numbs) { Integer min = null; Integer max = null; if (numbs.length > 0) { for (int num : numbs ) { if (min == null || min > num) { min = num; } if (max == null || max < num) { max = num; } } } return new int[]{min, max}; } public static Pair calc2(int... numbs) { Integer min = null; Integer max = null; if (numbs.length > 0) { for (int num : numbs ) { if (min == null || min > num) { min = num; } if (max == null || max < num) { max = num; } } } return new Pair(min, max); } }
[ "235868521@qq.com" ]
235868521@qq.com
ec5a601cffe44f0ae27663264ce40672763a2133
e5f84fbe6450d87e2dd25e9b0cf2f5f4179b12c3
/src/xpathengine/XPathEngineImpl.java
848e987caa125067bf035328a6f7dfc76bf7312a
[]
no_license
natc221/XPathEngine
d71e663845c779001b261732f374fd039b6d0c44
249ee8b44c235a5e507ea2d8233e4155e1ca62a2
refs/heads/master
2021-01-19T00:58:00.540132
2016-08-09T19:02:46
2016-08-09T19:02:46
65,320,432
0
0
null
null
null
null
UTF-8
Java
false
false
6,561
java
/** * @author Nathaniel Chan */ package xpathengine; import org.w3c.dom.Document; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import xpathengine.Token.TestType; import xpathengine.Token.Type; public class XPathEngineImpl implements XPathEngine { private String[] xpaths = null; public XPathEngineImpl() {} public void setXPaths(String[] s) { this.xpaths = s; } public boolean isValid(int i) { if (this.xpaths == null || i >= xpaths.length || i < 0) { return false; } return XPathQuery.isValid(xpaths[i]); } public boolean[] evaluate(Document d) { if (xpaths == null) { return new boolean[0]; } // evaluate document for each XPath specified boolean[] result = new boolean[xpaths.length]; for (int i = 0; i < xpaths.length; i++) { String query = xpaths[i]; if (isValid(i)) { // tokenize XPath query Token[] tokens = XPathQuery.getCheckedTokens(query); result[i] = checkQueryMatch(d, tokens); } else { result[i] = false; } } return result; } /** * Checks whether a DOM document matches a tokenized XPath query. * Method invokes recursive descent algorithm. */ public static boolean checkQueryMatch(Document d, Token[] tokens) { TokenIterator it = new TokenIterator(tokens); return matchToken(d, it); } /** * Step in recursive descent parser * @param n * current node in DOM in consideration * @param it * tokens from XPath that are being evaluated. Method is responsible * for setting the pointer in the iterator to the appropriate position * for further parsing * @return * whether current token matches the given node */ public static boolean matchToken(Node n, TokenIterator it) { if (!it.hasCurr()) { return true; } Token curr = it.curr(); switch (curr.type) { // XPath -> axis step case XPATH: return matchAxisStep(n, it); // axis -> / case AXIS: it.step(); return curr.val.equals("/"); // step -> nodename([test])*(axis step)? case NODENAME: // check if current node equals node name required String nodeName = n.getNodeName(); boolean equals = curr.val.equals(nodeName); // if not equal then further checking is not necessary if (!equals) { return false; } // increment pointer to token after nodename it.step(); Token afterName = it.curr(); // perform tests (if they exist) until no more tests are present while (afterName != null && afterName.type != Type.AXIS) { if (afterName.type != Type.TEST) { break; } TestType tt = XPathQuery.getTestType(afterName); switch (tt) { /* * test -> text() = "..." * test -> contains(text(), "...") * test -> @attname = "..." */ case ATTNAME: case CONTAINS: case TEXT: if (!matchNonStepTest(n, afterName.val, tt)) { return false; } break; // test -> step case STEP: // treat step within test as an XPath of its own Token[] testTokens = XPathQuery.getAllTokens(afterName.val); TokenIterator testIt = new TokenIterator(testTokens); if (!matchStep(n, testIt)) { return false; } break; } // move pointer to next token it.step(); afterName = it.curr(); } // end of query if (afterName == null) { return true; // match path for lower levels in DOM tree } else { it.stepBack(); return matchAxisStep(n, it); } case TEST: // test should be considered directly after nodename return false; default: return false; } } /** * Performs test for tests that are a step */ private static boolean matchNonStepTest(Node n, String val, TestType testType) { switch (testType) { case ATTNAME: { String[] eqSplit = val.split("="); String attName = eqSplit[0].replace("@", ""); String expect = eqSplit[1]; expect = expect.substring(1, expect.length() - 1); NamedNodeMap attribs = n.getAttributes(); Node valNode = attribs.getNamedItem(attName); // attribute does not exist if (valNode == null) { return false; } String attVal = valNode.getNodeValue(); return attVal.equals(expect); } case CONTAINS: { String test = val.replace("contains", ""); test = test.substring(1, test.length() - 1); if (test.length() > 0) { String[] commaSplit = test.split(",", 2); String expected = commaSplit[1].trim(); expected = expected.substring(1, expected.length() - 1); String nodeText = getTextVal(n); // text for current node does not exist if (nodeText == null) { return false; } else { return nodeText.contains(expected); } } return false; } case TEXT: { String[] equalSplit = val.split("="); String expectText = equalSplit[1]; expectText = expectText.substring(1, expectText.length() - 1); String nodeText = getTextVal(n); return expectText.equals(nodeText); } default: return false; } } /** * Retrieves text value for a DOM node * @param n * @return * null if text does not exist */ private static String getTextVal(Node n) { NodeList children = n.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); if (child.getNodeType() == Node.TEXT_NODE) { return child.getNodeValue(); } } return null; } /** * Invokes matching a step for children of a given node */ private static boolean matchStep(Node n, TokenIterator it) { int currPos = it.getPos(); NodeList children = n.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); it.setPos(currPos); boolean step = matchToken(child, it); if (step) { return step; } } // none of the children match the query return false; } /** * Invokes matching an axis for the next token, then matching * a step for the children of the given node */ private static boolean matchAxisStep(Node n, TokenIterator it) { int currPos = it.getPos(); it.step(); boolean axis = matchToken(n, it); // if axis does not match, there is no need to check further if (!axis) { return false; } NodeList children = n.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); it.setPos(currPos); //reset pointer it.step(2); //set to step token boolean step = matchToken(child, it); if (step) { return axis && step; } } // none of the children match the query return false; } }
[ "channat@seas.upenn.edu" ]
channat@seas.upenn.edu
1982df9a09e52cccbdd2559e9a2e149711c8e09b
fea3f181e48bf3a43fec21fb91021a07b51bbb11
/EnterpriseSSP/src/org/EnterpriseSSP/Page/CreateStyleSetup.java
01138b36b32bdd9020800f61d3df793b0de003b8
[]
no_license
QAankit123/EntSSP
08e76ad5a7592e6602127578623ec94dcc3c59f8
d9ecd009ef28ae66902c60e87962016e5892e5f8
refs/heads/master
2020-05-01T03:52:42.007083
2019-03-23T07:25:44
2019-03-23T07:25:44
177,257,591
0
0
null
null
null
null
UTF-8
Java
false
false
73
java
package org.EnterpriseSSP.Page; public class CreateStyleSetup { }
[ "Ankit.Shrivastava@CO2289.resonate.co.uk" ]
Ankit.Shrivastava@CO2289.resonate.co.uk
9acb8f7cfb9746802615ef0368485c5c30256d4b
082e26b011e30dc62a62fae95f375e4f87d9e99c
/docs/weixin_7.0.4_source/反编译源码/未反混淆/src/main/java/android/support/constraint/a/d.java
eb98092135d3947d90442c1bbac7e5c4385e1ba8
[]
no_license
xsren/AndroidReverseNotes
9631a5aabc031006e795a112b7ac756a8edd4385
9202c276fe9f04a978e4e08b08e42645d97ca94b
refs/heads/master
2021-04-07T22:50:51.072197
2019-07-16T02:24:43
2019-07-16T02:24:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
207
java
package android.support.constraint.a; public final class d extends b { public d(c cVar) { super(cVar); } public final void e(h hVar) { super.e(hVar); hVar.gV--; } }
[ "alwangsisi@163.com" ]
alwangsisi@163.com
344c9f356de58fb8d9514e44a7b62532b4c48df2
f7e72225452aa9c4364e79ac1d72df87399f96a0
/SampleProject/src/Java/Sample/IntegersToWordsTest.java
97e535b05ceb576bf0be893300072239371bc5a9
[]
no_license
HemaSatish/JavaProject
6ef9b65e1473942c425d1ca7638961cd416ec099
7efbbcca9b133ecfc1f297bc662c5ee157036b47
refs/heads/master
2020-04-13T11:18:19.747169
2018-12-26T11:04:14
2018-12-26T11:04:14
163,149,303
0
0
null
null
null
null
UTF-8
Java
false
false
366
java
package Java.Sample; import static org.junit.Assert.assertEquals; import org.junit.Test; public class IntegersToWordsTest { @Test public void testconvertIntegersToWords() { IntergersToWords.convertIntegersToWords("234".toCharArray()); assertEquals("two hundred thirty four", "two hundred thirty four"); } }
[ "noreply@github.com" ]
noreply@github.com
52d119c12c4eb4daca922d9836b9fd04bc60f2ae
7f280f44f0b890ea11fadea9839e0fd4c9e41c52
/org/omg/DynamicAny/DynStructHelper.java
3aad5b0b90e0b327a71b9c54c54b070e59791065
[]
no_license
hoverzheng/jdk1.8_src_note
e5d0e6d4e5dc09f7e23fce31eff85f8e2057493d
93c9776ddd9e70cdc2378828d989972c4cd2cd91
refs/heads/main
2023-04-28T19:41:15.440364
2021-05-22T03:39:24
2021-05-22T03:39:24
369,705,587
0
0
null
null
null
null
UTF-8
Java
false
false
2,785
java
package org.omg.DynamicAny; /** * org/omg/DynamicAny/DynStructHelper.java . * Generated by the IDL-to-Java compiler (portable), version "3.2" * from /Users/java_re/workspace/8-2-build-macosx-x86_64/jdk8u151/9699/corba/src/share/classes/org/omg/DynamicAny/DynamicAny.idl * Tuesday, September 5, 2017 7:38:44 PM PDT */ /** * DynStruct objects support the manipulation of IDL struct and exception values. * Members of the exceptions are handled in the same way as members of a struct. */ abstract public class DynStructHelper { private static String _id = "IDL:omg.org/DynamicAny/DynStruct:1.0"; public static void insert (org.omg.CORBA.Any a, org.omg.DynamicAny.DynStruct that) { org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); a.type (type ()); write (out, that); a.read_value (out.create_input_stream (), type ()); } public static org.omg.DynamicAny.DynStruct extract (org.omg.CORBA.Any a) { return read (a.create_input_stream ()); } private static org.omg.CORBA.TypeCode __typeCode = null; synchronized public static org.omg.CORBA.TypeCode type () { if (__typeCode == null) { __typeCode = org.omg.CORBA.ORB.init ().create_interface_tc (org.omg.DynamicAny.DynStructHelper.id (), "DynStruct"); } return __typeCode; } public static String id () { return _id; } public static org.omg.DynamicAny.DynStruct read (org.omg.CORBA.portable.InputStream istream) { throw new org.omg.CORBA.MARSHAL (); } public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.DynamicAny.DynStruct value) { throw new org.omg.CORBA.MARSHAL (); } public static org.omg.DynamicAny.DynStruct narrow (org.omg.CORBA.Object obj) { if (obj == null) return null; else if (obj instanceof org.omg.DynamicAny.DynStruct) return (org.omg.DynamicAny.DynStruct)obj; else if (!obj._is_a (id ())) throw new org.omg.CORBA.BAD_PARAM (); else { org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate (); org.omg.DynamicAny._DynStructStub stub = new org.omg.DynamicAny._DynStructStub (); stub._set_delegate(delegate); return stub; } } public static org.omg.DynamicAny.DynStruct unchecked_narrow (org.omg.CORBA.Object obj) { if (obj == null) return null; else if (obj instanceof org.omg.DynamicAny.DynStruct) return (org.omg.DynamicAny.DynStruct)obj; else { org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate (); org.omg.DynamicAny._DynStructStub stub = new org.omg.DynamicAny._DynStructStub (); stub._set_delegate(delegate); return stub; } } }
[ "xiaohong@fintec.ai" ]
xiaohong@fintec.ai
ecc99c0d4b762cc423f244e077237a684acc8e16
d954830eaed02eb5152a746db732ca472d04490c
/src/main/java/com/example/demo/Controller/UserController.java
2f4dfbf7d028ac6b45b3f6f412a2e0de94677370
[]
no_license
d00721539/Spring-Boot-
fc3693b64f158839b54fe66925ad31c3bd03a35c
1cb344ccdda30022053cdf687109660453d8abcd
refs/heads/master
2022-07-09T06:03:35.175941
2019-11-03T22:48:41
2019-11-03T22:48:41
219,253,226
0
0
null
2022-06-21T02:09:50
2019-11-03T04:52:16
Java
UTF-8
Java
false
false
3,062
java
package com.example.demo.Controller; import com.example.demo.Dto.Error; import com.example.demo.Dto.ResponseInt; import com.example.demo.Entity.User; import com.example.demo.Service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import java.util.List; @RestController @RequestMapping("user") public class UserController { @Autowired public UserService userService; @GetMapping public Iterable<User> getUsers(){ return userService.getUsers(); } @GetMapping("/business") public List<User> getBusinessOwners(){ return userService.getBusinessOwners(); } @GetMapping("/global") public List<User> getUsersForGlobal(){ return userService.getUsersForGlobal(); } @GetMapping("/id") public User getUserById(@RequestParam Long id){ return userService.getUserById(id); } @GetMapping("/local") public List<User> getLocalUsers(@RequestParam String role, @RequestParam String businessName){ return userService.getLocalUsers(role,businessName); } @GetMapping("/admin/local/id") public User getLocalForAdmin(@RequestParam long id, @RequestParam String businessName, @RequestParam String role){ return userService.getLocalForAdmin(id,businessName,role); } @GetMapping("/local/id") public User getLocalUserById(@RequestParam long id, @RequestParam String role){ return userService.getLocalUserById(id,role); } @GetMapping("/business/id") public User getBusinessUserById(@RequestParam long id){ return userService.getBusinessUserById(id); } @PostMapping("/login") public ResponseEntity<?> login(@RequestBody User user){ User userObj ; ResponseInt res; try{ userObj = userService.loginUser(user); }catch (Exception e){ throw new RuntimeException("Check your email or password"); } if(userObj.isAccountDisabledStatus() == true){ throw new RuntimeException("Your account has been disabled!"); } return new ResponseEntity(userObj,HttpStatus.OK); } @PostMapping("/register") public void registerUser(@RequestBody User user){ userService.saveUser(user); } @PutMapping("/update") public void updateUser(@RequestBody User user){ userService.updateUser(user); } @DeleteMapping("/deletelocal") public void deleteLocalUser(@RequestParam long id, @RequestParam String role, @RequestParam String businessName){ userService.deleteLocalUser(id,role,businessName); } @DeleteMapping("/deletebusiness") public void deleteBusinessUser(@RequestParam long id, @RequestParam String role){ userService.deleteBusinessUser(id,role); } @DeleteMapping("/delete") public void deleteUser(@RequestParam long id){ userService.deleteUser(id); } }
[ "yilmazali325@gmail.com" ]
yilmazali325@gmail.com
f047345518d63dc083e2985ab69c4ab44a0dd581
5fb1c43ac76759c90294d1051b655cb020eec281
/Yazılım/src/com/lignanislore/mechanicsignin/DialogPencere/DuzenleDialogController.java
b64956572641fac94f668b3a3602d7953c78e799
[]
no_license
sinangilerol/MechanicSignIn
c5be4a0222e49dafb14d30d8d9d88d08a5269d25
c5184b36a87d2cbb4ace25c57c0d2255a8d9d780
refs/heads/master
2021-05-09T23:28:37.315259
2018-01-24T16:23:05
2018-01-24T16:23:05
118,787,075
0
0
null
null
null
null
UTF-8
Java
false
false
1,808
java
package com.lignanislore.mechanicsignin.DialogPencere; import com.lignanislore.mechanicsignin.Controller; import com.lignanislore.mechanicsignin.Datas.KısaYol; import com.lignanislore.mechanicsignin.Datas.VeriTabani; import com.lignanislore.mechanicsignin.Main; import javafx.fxml.FXML; import javafx.scene.control.TextField; public class DuzenleDialogController { @FXML private TextField textTyol; @FXML private TextField textweb; @FXML private TextField textTabsayisi; @FXML private TextField textkullanici; @FXML private TextField textparola; @FXML private TextField textsure; public void KisayolDuzenle(int id){ KısaYol kısaYol=new KısaYol(); kısaYol.setTarayiciPath(textTyol.getText().toString()); kısaYol.setWebYol(textweb.getText().toString()); kısaYol.setKullaniciAdi(textkullanici.getText().toString()); kısaYol.setParola(textparola.getText().toString()); kısaYol.setAcilisSuresi(Integer.parseInt(textsure.getText().toString())); kısaYol.setTabSayisi(Integer.parseInt(textTabsayisi.getText())); Main.kısaYols[id-1]=kısaYol; VeriTabani.getInstance().veriYaz(id,kısaYol); } public void initialize(){ textTyol.setText(Main.kısaYols[Controller.id-1].getTarayiciPath()); textweb.setText(Main.kısaYols[Controller.id-1].getWebYol()); textTabsayisi.setText(String.valueOf(Main.kısaYols[Controller.id-1].getTabSayisi())); textkullanici.setText(Main.kısaYols[Controller.id-1].getKullaniciAdi()); textparola.setText(Main.kısaYols[Controller.id-1].getParola()); textsure.setText(String.valueOf(Main.kısaYols[Controller.id-1].getAcilisSuresi())); } }
[ "erol.sinangil@gmail.com" ]
erol.sinangil@gmail.com
c77908c440a9266551b2de3a2fe3712b7438c296
cef9351a685c6cf0d75f9e4d584e309fbdbfbcd7
/src/main/java/com/github/chaoswang/book/headfirst/designpattern/factory/pizzaaf/BlackOlives.java
8ed1df19b61063b1062aa21a3e6fb1dc0ce06637
[]
no_license
chaoswang/learning
48e1bcb1e3ae33d008098fb00153808da3984061
8c5f67da5f23e921e2bfd7d7536e580f78274065
refs/heads/master
2020-05-19T07:49:02.443926
2018-07-16T13:58:47
2018-07-16T13:58:59
41,595,115
0
0
null
null
null
null
UTF-8
Java
false
false
181
java
package com.github.chaoswang.book.headfirst.designpattern.factory.pizzaaf; public class BlackOlives implements Veggies { public String toString() { return "Black Olives"; } }
[ "wang.chao29@zte.com.cn" ]
wang.chao29@zte.com.cn
102d5087c3c0a680ce7718994d52362e5a75076f
27835b326965575e47e91e7089b918b642a91247
/src/by/it/seroglazov/calc/Printer.java
055660d64887ed66c55c2d54ef7f0216be837c01
[]
no_license
s-karpovich/JD2018-11-13
c3bc03dc6268d52fd8372641b12c341aa3a3e11f
5f5be48cb1619810950a629c47e46d186bf1ad93
refs/heads/master
2020-04-07T19:54:15.964875
2019-04-01T00:37:29
2019-04-01T00:37:29
158,667,895
2
0
null
2018-11-22T08:40:16
2018-11-22T08:40:16
null
UTF-8
Java
false
false
125
java
package by.it.seroglazov.calc; class Printer { public void print(String res) { System.out.println(res); } }
[ "serahlazau@outlook.com" ]
serahlazau@outlook.com
d9cc4c1445a4c1861a4fb2f6c0347f3fe44114f7
74f2613a4c02e813f09856dd8bb47bf6e512ccab
/prototype/PizzaPrototype.java
b3c85a2346023318905bcf85eebccb2635b27430
[]
no_license
mohamed-elalem/HFDP
c397c865c73c9d921185cc5bd241280cd47682db
3e1db447d952ef5115d40b8acb2adad14c3f4fd8
refs/heads/master
2021-09-03T08:18:54.655820
2018-01-07T13:01:08
2018-01-07T13:01:08
104,520,831
0
0
null
null
null
null
UTF-8
Java
false
false
133
java
package com.company; public interface PizzaPrototype extends Cloneable { Pizza makePizza() throws CloneNotSupportedException; }
[ "mohamed.el.alem.2017@gmail.com" ]
mohamed.el.alem.2017@gmail.com
514174a480ce7bff7bd680d3fcbb1e6523b2ada6
0ee29b7900a97c367bb6a7fffaf2b8514fae22b7
/src/com/yes/ySprites/yFloor.java
13c6f791e4dd1a8066bfcfb913173288b17da705
[]
no_license
Viscorbus/RyanVersusTheHardR
c3e839995dd0edad6734f42e0979bebc1793543c
eca45b78d948dfe1c20e114e48d3e6072c18015a
refs/heads/master
2020-07-24T15:23:14.544144
2020-04-30T22:51:41
2020-04-30T22:51:41
207,968,155
0
0
null
null
null
null
UTF-8
Java
false
false
851
java
package com.yes.ySprites; import com.yes.yPhys.Point; import javafx.scene.canvas.GraphicsContext; import javafx.scene.image.Image; public class yFloor { private double floorNumber = 0; private Image floorImage; private Point currentTileLoc = new Point(0,0); void generateNewFloor() { } void getNextFloor(String currFloor) { } public void setFloorImage(Image floorImage) { this.floorImage = floorImage; } Image getFloorBackground() { return floorImage; } void setFloorNumber(double currFloorNumber) { floorNumber = floorNumber++; } double getFloorNumber() { return floorNumber; } public void render(GraphicsContext gc) { gc.drawImage(floorImage,0,0,64,64,currentTileLoc.getX(),currentTileLoc.getY(),64,64); } }
[ "40128824+Viscorbus@users.noreply.github.com" ]
40128824+Viscorbus@users.noreply.github.com
55499f91d12b42efd3ab7d07af76d23d21d20a1a
4cf512b9f02c0e9af4731a3a37516ce3615e8a7a
/src/main/java/com/dreamershaven/design/service/impl/DesignIncliedServiceImpl.java
8b3b3d5c66a209c5a3ff506bb3a452121989c085
[]
no_license
DreamersHaven/LifeGrows
8e4f6f715904b2caa5487fa7e51bf9c3870ecbe3
1488291f51df407e73e59d73366430437df256f5
refs/heads/master
2022-06-26T11:24:53.861194
2020-04-15T05:12:23
2020-04-15T05:12:23
166,914,578
0
0
null
2022-06-21T00:55:25
2019-01-22T02:38:39
Java
UTF-8
Java
false
false
1,520
java
package com.dreamershaven.design.service.impl; import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.dreamershaven.design.service.DesignIncliedService; import com.dreamershaven.wechat.bean.DesignIncliedDO; import com.dreamershaven.wechat.mapper.DesignIncliedMapper; @Service public class DesignIncliedServiceImpl implements DesignIncliedService { @Autowired private DesignIncliedMapper designIncliedDao; @Override public DesignIncliedDO get(Long id){ return designIncliedDao.get(id); } @Override public List<DesignIncliedDO> list(Map<String, Object> map){ return designIncliedDao.list(map); } @Override public int count(Map<String, Object> map){ return designIncliedDao.count(map); } @Override public int save(DesignIncliedDO designInclied){ return designIncliedDao.save(designInclied); } @Override public int update(DesignIncliedDO designInclied){ return designIncliedDao.update(designInclied); } @Override public int remove(Long id){ return designIncliedDao.remove(id); } @Override public int batchRemove(Long[] ids){ return designIncliedDao.batchRemove(ids); } public List<DesignIncliedDO> queryByDISC(String discType) { Map<String, Object> query = new HashMap<>(16); query.put("discType", discType); List<DesignIncliedDO> designIncliedDOs=designIncliedDao.list(query); return designIncliedDOs; } }
[ "dongyaxin@dreamershaven.cn" ]
dongyaxin@dreamershaven.cn
642a6c453ff3c567790e0479e2a572871e0ffa74
4e7beeed97b9c07a13ae930939bdc723256a3ec7
/app/src/main/java/com/jlkg/jzg/jzg_android/wxapi/WXEntryActivity.java
351da7e472fa02e86201e6374fb8181f7ceaaf28
[]
no_license
liwenpeng12/jianzhugangAPP
57cab40b90d70718b22c5b8445814ced59bfe895
11a6f859547825107c465370c6476f6bc6e55fa8
refs/heads/master
2020-03-19T18:37:27.533259
2018-06-10T14:34:17
2018-06-10T14:34:17
136,812,870
0
0
null
null
null
null
UTF-8
Java
false
false
4,736
java
package com.jlkg.jzg.jzg_android.wxapi; import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; import android.util.Log; import com.alibaba.fastjson.JSON; import com.jlkg.jzg.baselibrary.utils.ToastUtils; import com.jlkg.jzg.jzg_android.other.utils.WxUtils; import com.lzy.okgo.callback.StringCallback; import com.lzy.okgo.model.Response; import com.tencent.mm.opensdk.modelbase.BaseReq; import com.tencent.mm.opensdk.modelbase.BaseResp; import com.tencent.mm.opensdk.modelmsg.SendAuth; import com.tencent.mm.opensdk.openapi.IWXAPI; import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler; import com.tencent.mm.opensdk.openapi.WXAPIFactory; import org.greenrobot.eventbus.EventBus; public class WXEntryActivity extends AppCompatActivity implements IWXAPIEventHandler { private IWXAPI api; private WXinfoBean mBean; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); api = WXAPIFactory.createWXAPI(this, WxUtils.APP_ID, false); api.handleIntent(getIntent(), this); } @Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); api.handleIntent(getIntent(), this); } @Override public void onReq(BaseReq baseReq) { } @Override public void onResp(BaseResp baseResp) { // baseresp.getType 1:第三方授权, 2:分享 // Toast.makeText(this, "baseresp.getType = " + baseResp.getType(), Toast.LENGTH_SHORT).show(); Log.e("tag", JSON.toJSONString(baseResp)); int result = 0; switch (baseResp.errCode) { case BaseResp.ErrCode.ERR_OK: // result = R.string.errcode_success;//发送成功 String code = ((SendAuth.Resp) baseResp).code; WxUtils.getAccessToken(this, code, new StringCallback() { @Override public void onSuccess(Response<String> response) { mBean = JSON.parseObject(response.body(), WXEntryActivity.WXinfoBean.class); EventBus.getDefault().post(mBean); finish(); } @Override public void onError(Response<String> response) { super.onError(response); ToastUtils.showShort("授权失败"); finish(); } }); return; case BaseResp.ErrCode.ERR_USER_CANCEL://发送取消 break; case BaseResp.ErrCode.ERR_AUTH_DENIED://发送被拒绝 break; case BaseResp.ErrCode.ERR_UNSUPPORT: // result = R.string.errcode_unsupported;//不支持错误 break; default: // result = R.string.errcode_unknown;//发送返回 break; } finish(); } @Override protected void onDestroy() { super.onDestroy(); api.unregisterApp(); } public static class WXinfoBean { /** * access_token : ACCESS_TOKEN * expires_in : 7200 * refresh_token : REFRESH_TOKEN * openid : OPENID * scope : SCOPE * unionid : o6_bmasdasdsad6_2sgVt7hMZOPfL */ private String access_token; private int expires_in; private String refresh_token; private String openid; private String scope; private String unionid; public String getAccess_token() { return access_token; } public void setAccess_token(String access_token) { this.access_token = access_token; } public int getExpires_in() { return expires_in; } public void setExpires_in(int expires_in) { this.expires_in = expires_in; } public String getRefresh_token() { return refresh_token; } public void setRefresh_token(String refresh_token) { this.refresh_token = refresh_token; } public String getOpenid() { return openid; } public void setOpenid(String openid) { this.openid = openid; } public String getScope() { return scope; } public void setScope(String scope) { this.scope = scope; } public String getUnionid() { return unionid; } public void setUnionid(String unionid) { this.unionid = unionid; } } }
[ "15797890102@163,com" ]
15797890102@163,com
9e87fa660ded8610119d472b59f4d018a0f96736
cacd0d4fb8acb833e70989042cf36ff0b37f4919
/src/main/java/org/beymani/proximity/AverageDistance.java
3aed01839a97f622bd5eaa652fbde97999ccb3f1
[]
no_license
mt3/beymani
44a1c6ac61d7592c4c32ccc1b0f087e562f86e96
745d9abd104dcd5af127f77ddf0b171747ac67ed
refs/heads/master
2021-01-18T14:09:46.723482
2012-02-18T21:03:42
2012-02-18T21:03:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,390
java
/* * beymani: Outlier and anamoly detection * Author: Pranab Ghosh * * 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.beymani.proximity; import java.io.IOException; import org.apache.hadoop.conf.Configured; import org.apache.hadoop.fs.Path; import org.apache.hadoop.io.LongWritable; import org.apache.hadoop.io.NullWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.io.WritableComparable; import org.apache.hadoop.io.WritableComparator; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.mapreduce.Mapper; import org.apache.hadoop.mapreduce.Partitioner; import org.apache.hadoop.mapreduce.Reducer; import org.apache.hadoop.mapreduce.Reducer.Context; import org.apache.hadoop.mapreduce.lib.input.FileInputFormat; import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat; import org.apache.hadoop.util.Tool; import org.apache.hadoop.util.ToolRunner; import org.chombo.util.TextInt; import org.chombo.util.Utility; public class AverageDistance extends Configured implements Tool { @Override public int run(String[] args) throws Exception { Job job = new Job(getConf()); String jobName = "Nearest neighbour n avearge distance MR"; job.setJobName(jobName); job.setJarByClass(AverageDistance.class); FileInputFormat.addInputPath(job, new Path(args[0])); FileOutputFormat.setOutputPath(job, new Path(args[1])); job.setMapperClass(AverageDistance.TopMatchesMapper.class); job.setReducerClass(AverageDistance.TopMatchesReducer.class); job.setMapOutputKeyClass(TextInt.class); job.setMapOutputValueClass(Text.class); job.setOutputKeyClass(NullWritable.class); job.setOutputValueClass(Text.class); job.setGroupingComparatorClass(IdRankGroupComprator.class); job.setPartitionerClass(IdRankPartitioner.class); Utility.setConfiguration(job.getConfiguration()); job.setNumReduceTasks(job.getConfiguration().getInt("num.reducer", 1)); int status = job.waitForCompletion(true) ? 0 : 1; return status; } public static class TopMatchesMapper extends Mapper<LongWritable, Text, TextInt, Text> { private String srcEntityId; private String trgEntityId; private int rank; private TextInt outKey = new TextInt(); private Text outVal = new Text(); @Override protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException { String[] items = value.toString().split(","); srcEntityId = items[0]; trgEntityId = items[1]; rank = Integer.parseInt(items[items.length - 1]); outKey.set(srcEntityId, rank); outVal.set(trgEntityId + "," + items[items.length - 1]); context.write(outKey, outVal); } } public static class TopMatchesReducer extends Reducer<TextInt, Text, NullWritable, Text> { private int topMatchCount; private String srcEntityId; private int count; private int sum; private int dist; private Text outVal = new Text(); protected void setup(Context context) throws IOException, InterruptedException { topMatchCount = context.getConfiguration().getInt("top.match.count", 10); } protected void reduce(TextInt key, Iterable<Text> values, Context context) throws IOException, InterruptedException { srcEntityId = key.getFirst().toString(); count = 0; sum = 0; for (Text value : values){ dist = Integer.parseInt(value.toString().split(",")[1]); sum += dist; if (++count == topMatchCount){ break; } } int avg = sum / count; outVal.set(srcEntityId + "," + avg); context.write(NullWritable.get(), outVal); } } public static class IdRankPartitioner extends Partitioner<TextInt, Text> { @Override public int getPartition(TextInt key, Text value, int numPartitions) { //consider only base part of key Text id = key.getFirst(); return id.hashCode() % numPartitions; } } public static class IdRankGroupComprator extends WritableComparator { protected IdRankGroupComprator() { super(TextInt.class, true); } @Override public int compare(WritableComparable w1, WritableComparable w2) { //consider only the base part of the key Text t1 = ((TextInt)w1).getFirst(); Text t2 = ((TextInt)w2).getFirst(); int comp = t1.compareTo(t2); return comp; } } /** * @param args */ public static void main(String[] args) throws Exception { int exitCode = ToolRunner.run(new AverageDistance(), args); System.exit(exitCode); } }
[ "pkghosh99@gmail.com" ]
pkghosh99@gmail.com
b21c2747827030c80d006022fbea5bc19cd8f8d0
7f696b6d15205e829f630a6ba0fa3b755bd365c8
/0619/src/InstanceInnerTest.java
dc06659f8e3ace07bc9aff73b00807223fe2e107
[]
no_license
mochangyong/0619
9a67cdfe472516dc8d9ef0a881e0864ceb6edbee
417d09204e69b6366faaabb348251061092bbaa6
refs/heads/master
2021-01-21T22:26:00.632538
2014-08-11T09:14:10
2014-08-11T09:14:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,726
java
class OuterClass{ private int outVar=10;//OutClass 클래스의 멤버 변수를 정의한 부분이다. private static int outStaticVar =20; class InnerClass{//InnerClass를 OuterClass의 멤버 내부 클래스로 정의한 부분이다. 멤버 레벨로 정의되었기 때문에 일반 멤버 변수와 public void printInfo(){//같은 레벨로 인식된다. 컴파일 하게 되면 내부 클래스의 이름은 OuterClass$InnerClass로 생성된다. System.out.println("outVar =" +outVar);//OuterClass의 인스턴수 변수를 출력하는 부분이다. 인스턴스 내부 클래스도 멤버 //변수와 초기화 시점이 같기 때문에 , 즉 외부 클래스 객체가 생성될 때 초기화되기 때문에 인스턴스 내부 클래스는 //외부 클래스의 인스턴스 멤버 변수를 사용할 수 있다. System.out.println("outStaticVar =" +outStaticVar);//외부클래스의 static 변수를 사용하는 부분이다. static이 인스턴스보다 초기화 //시점이 더 빠르기 때문에 인스턴스 내부 클래스에서 외부 클래스의 static 변수를 사용할 수 있다. 내부 클래스에서는 외부 클래스의 변수가 //private으로 지정되어 있어도 사용할 수 있다. } } }// public class InstanceInnerTest { /** * 인스턴스 내부 클래스 테스트 */ public static void main(String[] args) { OuterClass oc = new OuterClass();//내부클래스 객체를 생성할때는 반드시 외부 클래스 객체를 생성한 후에 생성할 수 있다. OuterClass.InnerClass in = oc.new InnerClass(); in.printInfo();//내부클래스의 printInfo()메소드를 호출하는 부분이다. } }
[ "lee yunhee@my_computer" ]
lee yunhee@my_computer
948fee22243e2ff57cdfd8165f82fe4779d37bd9
3040ef5b6f7538edb2f60b801ba02bc25c77cb51
/app/src/main/java/triviality/example/com/mcq_test/Admin.java
24e81c130cb7acebdb6da17879accaf68ad2467c
[]
no_license
thapliyal28/Quiz-of-Knowledge-android-app
801bd7d9aefdc349d5d6c989d81f1112f8058b49
ce62af1ea2f8fa074b1fd03f66f49a80da01c35e
refs/heads/master
2021-05-05T19:02:57.436644
2017-12-27T01:46:59
2017-12-27T01:46:59
103,811,083
0
0
null
null
null
null
UTF-8
Java
false
false
1,201
java
package triviality.example.com.mcq_test; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class Admin extends Activity { Button b; EditText t; String s; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_admin); b = (Button) findViewById(R.id.button4); t = (EditText) findViewById(R.id.editText); // b1 = (Button) findViewById(R.id.button6); b.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { s=t.getText().toString(); if(s.equals("abhi")) { Intent i=new Intent(Admin.this, Score.class); startActivity(i);} else { Toast.makeText(getApplicationContext(), "Incorrect Password", Toast.LENGTH_SHORT).show(); } } }); } }
[ "abhishek.thapliyal28@gmail.com" ]
abhishek.thapliyal28@gmail.com
0ffb3b22ae5bdc7a34b3fecd838ee72a7b644860
079834626f6d1a2897b532174146d031ae27fd9c
/ServerSideHelpers/src/com/sjsu/cmpe295B/idiscoverit/main/LoginAction.java
ec01d1b2060abaef1fcc42b8b797d6cc33ad4ab7
[]
no_license
pallavisastry/iDiscoverit
87a3dad7b9124129149c10a07c4ee253e71594fd
c5c96d95276da3e737c8b3baf71326806b9507bf
refs/heads/master
2020-05-23T01:37:53.698219
2018-07-23T03:09:34
2018-07-23T03:09:34
38,912,306
0
0
null
null
null
null
UTF-8
Java
false
false
2,828
java
package com.sjsu.cmpe295B.idiscoverit.main; import java.util.Map; import org.apache.log4j.Logger; import org.apache.struts2.interceptor.SessionAware; import com.opensymphony.xwork2.ActionSupport; import com.sjsu.cmpe295B.idiscoverit.persistence.IdiscoveritDAOHandler; import com.sjsu.cmpe295B.idiscoverit.utilities.Constants; import com.sjsu.cmpe295B.idiscoverit.utilities.MD5HashGenerator; /** * This action class is used only when a user logs in from a web page. * @author pallavi * */ //TODO:1) Change result type to json for all and if the request comes from web then display web page!!! public class LoginAction extends ActionSupport implements SessionAware { private static final long serialVersionUID = 3921703242124204473L; private static final Logger logger = Logger.getLogger(LoginAction.class); private static final String TAG = "LoginAction"; private static int counter; private String userName; private String password; private String errorMessage; private String hashedPassword; private Map<String, Object> session; public String execute() { counter++; logger.info(TAG + "=============================================================================================="); logger.info(TAG + "---------SERVERSIDE-LoginAction Starts---------------"); logger.info(TAG + "---------------No. of hits so far ------------>>> "+ counter); session = this.getSession(); hashedPassword = MD5HashGenerator.getMD5(password); setPassword(hashedPassword); this.setPassword(hashedPassword); boolean result = authenticateUser(); logger.info(TAG + "Result of authenticateUser >>>>>>" + result); if (result) { session.put("loggedin", true); session.put("username", userName); return SUCCESS; } else { session.put("loggedin", false); setErrorMessage(Constants.LOGIN_FAIL); return ERROR; } } private boolean authenticateUser() { logger.info("-------------Inside authenticateUser()----------"); IdiscoveritDAOHandler daoHandler = new IdiscoveritDAOHandler(); boolean isAuthentic = daoHandler.isAuthenticated(userName, password); logger.info(TAG + "###### Result is ###### " + isAuthentic); if (isAuthentic) return true; else return false; } /* .....Getters/Setters..... */ public String getErrorMessage() { return errorMessage; } public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; } public void setUserName(String userName) { this.userName = userName; } public void setPassword(String password) { this.password = password; } @Override public void setSession(Map<String, Object> session) { this.session = session; } public Map<String, Object> getSession() { return session; } }
[ "pallavi@idiscoverit.com" ]
pallavi@idiscoverit.com
287f4b3e633aa8c2fc2f07b331bb13af06ca0b89
28ef2af689f2b4dbf2e076e5b23c83462faa8424
/app/src/main/java/com/tinkerdemo/MainActivity.java
147ece1c1ff78847148882796388fc2f3624eab7
[]
no_license
q876625596/TinkerDemo
e3bf9c7a962fe99cd2a787808447d5670188e86b
03ea6658111a160cf751f4384236e4e7d90f632f
refs/heads/master
2021-05-15T17:07:43.357713
2017-10-19T01:52:03
2017-10-19T01:52:03
107,484,281
0
0
null
null
null
null
UTF-8
Java
false
false
2,489
java
package com.tinkerdemo; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import com.tencent.tinker.lib.util.TinkerLog; import com.tencent.tinker.loader.shareutil.ShareTinkerInternals; import com.tinkerpatch.sdk.TinkerPatch; import com.tinkerpatch.sdk.server.callback.ConfigRequestCallback; import java.util.HashMap; public class MainActivity extends AppCompatActivity { private Button fetchButton; private Button fetchDynamicConfig; private Button cleanAll; private Button killAllOtherProcess; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); fetchButton = (Button) findViewById(R.id.fetchButton); fetchDynamicConfig = (Button) findViewById(R.id.fetchDynamicConfig); cleanAll = (Button) findViewById(R.id.cleanAll); killAllOtherProcess = (Button) findViewById(R.id.killAllOtherProcess); fetchButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { TinkerPatch.with().fetchPatchUpdate(true); } }); fetchDynamicConfig.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { TinkerPatch.with().fetchDynamicConfig(new ConfigRequestCallback() { @Override public void onSuccess(HashMap<String, String> configs) { TinkerLog.w("ly", "request config success, config:" + configs); } @Override public void onFail(Exception e) { TinkerLog.w("ly", "request config failed, exception:" + e); } }, true); } }); cleanAll.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { TinkerPatch.with().cleanAll(); } }); killAllOtherProcess.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ShareTinkerInternals.killAllOtherProcess(getApplicationContext()); android.os.Process.killProcess(android.os.Process.myPid()); } }); } }
[ "876625596@qq.com" ]
876625596@qq.com
16a93429161a3a2170d1f64bab80d9c951329af1
74bcf31259899b52f8d9976ad8e24a491ac86eb7
/test/AllTests.java
a3034c19e7732cc6f9fab86a155738749a8fd6f4
[]
no_license
mueller04/EverCraftKataJava
ce4b3bcc35d87fefbbdaeccf9edd6e3145344a7d
af8e2afd4de293bad8dd6e4a65748dc28b3bbc6a
refs/heads/master
2021-01-10T06:49:44.102388
2016-03-13T23:15:43
2016-03-13T23:15:43
52,015,720
0
0
null
null
null
null
UTF-8
Java
false
false
408
java
import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; @RunWith(Suite.class) @SuiteClasses({ AbilitiesTest.class, EverCraftCharacterTest.class, PlayTest.class, CharacterClassTest.class, RaceTest.class, IntegrationTests.class, WeaponTest.class, ArmorTest.class}) public class AllTests { }
[ "mikemueller04@hotmail.com" ]
mikemueller04@hotmail.com
92f25ffe567c52218d161f39527bef4a52ac8842
8358717b853f240843ffa56784773a29b1efc19e
/dev/.svn/pristine/7f/7fe6a57ce737d48a6d6f4251cb7218e1e9034ecd.svn-base
578032b959f1dcb56429bbf5a256b93780555006
[]
no_license
huanglongf/enterprise_project
65ec3e2c56e4a2909f0881a9276a9966857bb9c7
de1865e638c9620e702818124f0b2deac04028c9
refs/heads/master
2020-05-07T13:25:07.223338
2018-10-21T08:44:33
2018-10-21T08:44:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
428
package com.bt.lmis.controller.form; import com.bt.lmis.page.QueryParameter; public class InvitationQueryParam extends QueryParameter { private String storeName; private String hcNo; public String getStoreName() { return storeName; } public void setStoreName(String storeName) { this.storeName = storeName; } public String getHcNo() { return hcNo; } public void setHcNo(String hcNo) { this.hcNo = hcNo; } }
[ "lijg@many-it.com" ]
lijg@many-it.com
d72b1f7dd18176ddcfd05821fd23388f9220a1e9
91e2e7ab9c0f6a1d80a81869aba7b2db9780a7f9
/shinyleo-mcms-cms/src/main/java/com/shinyleo/mdiy/biz/impl/ModelTemplateBizImpl.java
2334bbe707aca5cd3cfdaf030964e763e232b296
[]
no_license
ShinyLeo/shinyleo-mcms
da6e33e99bc5ef7fcebf40986bc2ee54a7d40bef
6ce933c8f9896e821e79fba66937635c04f9cefd
refs/heads/master
2021-01-01T15:43:01.543242
2017-07-24T04:47:52
2017-07-24T04:47:53
76,178,776
0
0
null
null
null
null
UTF-8
Java
false
false
1,279
java
package com.shinyleo.mdiy.biz.impl; import com.shinyleo.base.biz.impl.BaseBizImpl; import com.shinyleo.base.dao.IBaseDao; import com.shinyleo.mdiy.biz.IModelTemplateBiz; import com.shinyleo.mdiy.dao.IModelTemplateDao; import com.shinyleo.mdiy.entity.ModelTemplateEntity; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; /** * Created by shinyleo on 17/7/20. */ @Service("modelTemplateBiz") public class ModelTemplateBizImpl extends BaseBizImpl implements IModelTemplateBiz { /** * 注入模块模版持久化层 */ @Autowired private IModelTemplateDao modelTemplateDao; @Override public ModelTemplateEntity getEntity(int appId, int modelId, String key) { return modelTemplateDao.getEntity(appId, modelId,key); } @Override public ModelTemplateEntity getEntity(int appId, String key) { return modelTemplateDao.getEntityByAppIdAndKey(appId, key); } /** * 获取模块模版持久化层 * @return modelTemplateDao 返回模块模版持久化层 */ @Override protected IBaseDao getDao() { return modelTemplateDao; } @Override public List queryByAppId(int appId) { // TODO Auto-generated method stub return modelTemplateDao.queryByAppId(appId); } }
[ "zhuguauanghui5@wanda.cn" ]
zhuguauanghui5@wanda.cn
c489c8e28e7d1962255a0ecc5dc5c47a3ee24a2f
71ee1c6cbda0af25d9700d1f64472414c49a36c0
/AngularRoomManagement/src/main/java/de/nak/ttmg/exceptions/EntityNotFoundException.java
bee89ec89c1623668d133434eab1a2536ce4ab64
[]
no_license
martineckardt/ttmg
07e4d61fb0d74cba03692b79ed0775d8247cf0cc
b117b3e80ce8e8a4044c191992806b69a68d0ef3
refs/heads/master
2021-01-17T06:38:34.378302
2016-03-05T19:02:02
2016-03-05T19:02:02
53,217,651
0
0
null
null
null
null
UTF-8
Java
false
false
852
java
package de.nak.ttmg.exceptions; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import de.nak.ttmg.util.Constants; /** * Created by felixb on 28/10/15. * This Exception is thrown if a requested object could not be found in the db. */ @JsonSerialize(include= JsonSerialize.Inclusion.NON_NULL) public class EntityNotFoundException extends ValidationException { private final String type; private final Long id; public EntityNotFoundException(String type, Long id) { super("Entity of type " + type + " with id " + id + " was not found."); this.type = type; this.id = id; } public String getType() { return type; } public Long getId() { return id; } @Override public String getLocalizableMessage() { return Constants.ENTITY_NOT_FOUND; } }
[ "felixbehrendt@me.com" ]
felixbehrendt@me.com
10b808627b69aa12f533d034776f71707611a712
1fef0da5745c7e731e6599f4589ac56beb90686d
/app/src/main/java/com/greedygame/moviebagnow/central/ReturnReviews.java
d3943455e1aa712bb4f7f228f32698affa7a9570
[]
no_license
NileshArnaiya/MovieBagNow
28d92e8d1e0356ebf06382dcc46cfb3f6fe66c26
5a492a8f2d3c20ed85aae8e47c7cb2533661691c
refs/heads/master
2023-07-14T06:01:56.149842
2021-08-25T13:15:52
2021-08-25T13:15:52
399,820,204
1
1
null
null
null
null
UTF-8
Java
false
false
1,479
java
package com.greedygame.moviebagnow.central; import androidx.lifecycle.MutableLiveData; import com.greedygame.moviebagnow.models.Resource; import com.greedygame.moviebagnow.models.ReviewResponse; import com.greedygame.moviebagnow.utility.Application; import com.greedygame.moviebagnow.utility.Constants; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; public class ReturnReviews { public MutableLiveData<Resource<ReviewResponse>> getReview(String movieId) { final MutableLiveData<Resource<ReviewResponse>> ReviewResponse = new MutableLiveData<>(); Call<ReviewResponse> call = Application.getInstance().getNetworkService() .getReview( movieId, Constants.API_KEY); call.enqueue(new Callback<ReviewResponse>() { @Override public void onResponse(Call<ReviewResponse> call, Response<ReviewResponse> response) { ReviewResponse body = response.body(); if (body != null) { ReviewResponse.setValue(Resource.success(body)); } else { ReviewResponse.setValue(Resource.<ReviewResponse>error("No Data", null)); } } @Override public void onFailure(Call<ReviewResponse> call, Throwable t) { ReviewResponse.setValue(Resource.<ReviewResponse>error(t.getMessage(),null)); } }); return ReviewResponse; } }
[ "nilesh@begenuin.com" ]
nilesh@begenuin.com
0c7955775db4aa33e9c16b9b405a7ffdf7c317a2
7398714c498444374047497fe2e9c9ad51239034
/android/support/v4/app/NotificationManagerCompat.java
1c6fbad4dde190d911622a08c4335553514fdc85
[]
no_license
CheatBoss/InnerCore-horizon-sources
b3609694df499ccac5f133d64be03962f9f767ef
84b72431e7cb702b7d929c61c340a8db07d6ece1
refs/heads/main
2023-04-07T07:30:19.725432
2021-04-10T01:23:04
2021-04-10T01:23:04
356,437,521
1
0
null
null
null
null
UTF-8
Java
false
false
23,203
java
package android.support.v4.app; import android.provider.*; import android.app.*; import android.content.*; import android.util.*; import android.content.pm.*; import android.os.*; import java.util.*; public final class NotificationManagerCompat { public static final String ACTION_BIND_SIDE_CHANNEL = "android.support.BIND_NOTIFICATION_SIDE_CHANNEL"; public static final String EXTRA_USE_SIDE_CHANNEL = "android.support.useSideChannel"; private static final Impl IMPL; static final int MAX_SIDE_CHANNEL_SDK_VERSION = 19; private static final String SETTING_ENABLED_NOTIFICATION_LISTENERS = "enabled_notification_listeners"; private static final int SIDE_CHANNEL_BIND_FLAGS; private static final int SIDE_CHANNEL_RETRY_BASE_INTERVAL_MS = 1000; private static final int SIDE_CHANNEL_RETRY_MAX_COUNT = 6; private static final String TAG = "NotifManCompat"; private static Set<String> sEnabledNotificationListenerPackages; private static String sEnabledNotificationListeners; private static final Object sEnabledNotificationListenersLock; private static final Object sLock; private static SideChannelManager sSideChannelManager; private final Context mContext; private final NotificationManager mNotificationManager; static { sEnabledNotificationListenersLock = new Object(); NotificationManagerCompat.sEnabledNotificationListenerPackages = new HashSet<String>(); sLock = new Object(); Impl impl; if (Build$VERSION.SDK_INT >= 14) { impl = new ImplIceCreamSandwich(); } else if (Build$VERSION.SDK_INT >= 5) { impl = new ImplEclair(); } else { impl = new ImplBase(); } IMPL = impl; SIDE_CHANNEL_BIND_FLAGS = NotificationManagerCompat.IMPL.getSideChannelBindFlags(); } private NotificationManagerCompat(final Context mContext) { this.mContext = mContext; this.mNotificationManager = (NotificationManager)this.mContext.getSystemService("notification"); } public static NotificationManagerCompat from(final Context context) { return new NotificationManagerCompat(context); } public static Set<String> getEnabledListenerPackages(final Context context) { final String string = Settings$Secure.getString(context.getContentResolver(), "enabled_notification_listeners"); if (string != null && !string.equals(NotificationManagerCompat.sEnabledNotificationListeners)) { final String[] split = string.split(":"); final HashSet sEnabledNotificationListenerPackages = new HashSet<String>(split.length); for (int length = split.length, i = 0; i < length; ++i) { final ComponentName unflattenFromString = ComponentName.unflattenFromString(split[i]); if (unflattenFromString != null) { sEnabledNotificationListenerPackages.add(unflattenFromString.getPackageName()); } } synchronized (NotificationManagerCompat.sEnabledNotificationListenersLock) { NotificationManagerCompat.sEnabledNotificationListenerPackages = (Set<String>)sEnabledNotificationListenerPackages; NotificationManagerCompat.sEnabledNotificationListeners = string; } } return NotificationManagerCompat.sEnabledNotificationListenerPackages; } private void pushSideChannelQueue(final Task task) { synchronized (NotificationManagerCompat.sLock) { if (NotificationManagerCompat.sSideChannelManager == null) { NotificationManagerCompat.sSideChannelManager = new SideChannelManager(this.mContext.getApplicationContext()); } // monitorexit(NotificationManagerCompat.sLock) NotificationManagerCompat.sSideChannelManager.queueTask(task); } } private static boolean useSideChannelForNotification(final Notification notification) { final Bundle extras = NotificationCompat.getExtras(notification); return extras != null && extras.getBoolean("android.support.useSideChannel"); } public void cancel(final int n) { this.cancel(null, n); } public void cancel(final String s, final int n) { NotificationManagerCompat.IMPL.cancelNotification(this.mNotificationManager, s, n); if (Build$VERSION.SDK_INT <= 19) { this.pushSideChannelQueue((Task)new CancelTask(this.mContext.getPackageName(), n, s)); } } public void cancelAll() { this.mNotificationManager.cancelAll(); if (Build$VERSION.SDK_INT <= 19) { this.pushSideChannelQueue((Task)new CancelTask(this.mContext.getPackageName())); } } public void notify(final int n, final Notification notification) { this.notify(null, n, notification); } public void notify(final String s, final int n, final Notification notification) { if (useSideChannelForNotification(notification)) { this.pushSideChannelQueue((Task)new NotifyTask(this.mContext.getPackageName(), n, s, notification)); NotificationManagerCompat.IMPL.cancelNotification(this.mNotificationManager, s, n); return; } NotificationManagerCompat.IMPL.postNotification(this.mNotificationManager, s, n, notification); } private static class CancelTask implements Task { final boolean all; final int id; final String packageName; final String tag; public CancelTask(final String packageName) { this.packageName = packageName; this.id = 0; this.tag = null; this.all = true; } public CancelTask(final String packageName, final int id, final String tag) { this.packageName = packageName; this.id = id; this.tag = tag; this.all = false; } @Override public void send(final INotificationSideChannel notificationSideChannel) throws RemoteException { if (this.all) { notificationSideChannel.cancelAll(this.packageName); return; } notificationSideChannel.cancel(this.packageName, this.id, this.tag); } @Override public String toString() { final StringBuilder sb = new StringBuilder("CancelTask["); sb.append("packageName:"); sb.append(this.packageName); sb.append(", id:"); sb.append(this.id); sb.append(", tag:"); sb.append(this.tag); sb.append(", all:"); sb.append(this.all); sb.append("]"); return sb.toString(); } } interface Impl { void cancelNotification(final NotificationManager p0, final String p1, final int p2); int getSideChannelBindFlags(); void postNotification(final NotificationManager p0, final String p1, final int p2, final Notification p3); } static class ImplBase implements Impl { @Override public void cancelNotification(final NotificationManager notificationManager, final String s, final int n) { notificationManager.cancel(n); } @Override public int getSideChannelBindFlags() { return 1; } @Override public void postNotification(final NotificationManager notificationManager, final String s, final int n, final Notification notification) { notificationManager.notify(n, notification); } } static class ImplEclair extends ImplBase { @Override public void cancelNotification(final NotificationManager notificationManager, final String s, final int n) { NotificationManagerCompatEclair.cancelNotification(notificationManager, s, n); } @Override public void postNotification(final NotificationManager notificationManager, final String s, final int n, final Notification notification) { NotificationManagerCompatEclair.postNotification(notificationManager, s, n, notification); } } static class ImplIceCreamSandwich extends ImplEclair { @Override public int getSideChannelBindFlags() { return 33; } } private static class NotifyTask implements Task { final int id; final Notification notif; final String packageName; final String tag; public NotifyTask(final String packageName, final int id, final String tag, final Notification notif) { this.packageName = packageName; this.id = id; this.tag = tag; this.notif = notif; } @Override public void send(final INotificationSideChannel notificationSideChannel) throws RemoteException { notificationSideChannel.notify(this.packageName, this.id, this.tag, this.notif); } @Override public String toString() { final StringBuilder sb = new StringBuilder("NotifyTask["); sb.append("packageName:"); sb.append(this.packageName); sb.append(", id:"); sb.append(this.id); sb.append(", tag:"); sb.append(this.tag); sb.append("]"); return sb.toString(); } } private static class ServiceConnectedEvent { final ComponentName componentName; final IBinder iBinder; public ServiceConnectedEvent(final ComponentName componentName, final IBinder iBinder) { this.componentName = componentName; this.iBinder = iBinder; } } private static class SideChannelManager implements Handler$Callback, ServiceConnection { private static final String KEY_BINDER = "binder"; private static final int MSG_QUEUE_TASK = 0; private static final int MSG_RETRY_LISTENER_QUEUE = 3; private static final int MSG_SERVICE_CONNECTED = 1; private static final int MSG_SERVICE_DISCONNECTED = 2; private Set<String> mCachedEnabledPackages; private final Context mContext; private final Handler mHandler; private final HandlerThread mHandlerThread; private final Map<ComponentName, ListenerRecord> mRecordMap; public SideChannelManager(final Context mContext) { this.mRecordMap = new HashMap<ComponentName, ListenerRecord>(); this.mCachedEnabledPackages = new HashSet<String>(); this.mContext = mContext; (this.mHandlerThread = new HandlerThread("NotificationManagerCompat")).start(); this.mHandler = new Handler(this.mHandlerThread.getLooper(), (Handler$Callback)this); } private boolean ensureServiceBound(final ListenerRecord listenerRecord) { if (listenerRecord.bound) { return true; } listenerRecord.bound = this.mContext.bindService(new Intent("android.support.BIND_NOTIFICATION_SIDE_CHANNEL").setComponent(listenerRecord.componentName), (ServiceConnection)this, NotificationManagerCompat.SIDE_CHANNEL_BIND_FLAGS); if (listenerRecord.bound) { listenerRecord.retryCount = 0; } else { final StringBuilder sb = new StringBuilder(); sb.append("Unable to bind to listener "); sb.append(listenerRecord.componentName); Log.w("NotifManCompat", sb.toString()); this.mContext.unbindService((ServiceConnection)this); } return listenerRecord.bound; } private void ensureServiceUnbound(final ListenerRecord listenerRecord) { if (listenerRecord.bound) { this.mContext.unbindService((ServiceConnection)this); listenerRecord.bound = false; } listenerRecord.service = null; } private void handleQueueTask(final Task task) { this.updateListenerMap(); for (final ListenerRecord listenerRecord : this.mRecordMap.values()) { listenerRecord.taskQueue.add(task); this.processListenerQueue(listenerRecord); } } private void handleRetryListenerQueue(final ComponentName componentName) { final ListenerRecord listenerRecord = this.mRecordMap.get(componentName); if (listenerRecord != null) { this.processListenerQueue(listenerRecord); } } private void handleServiceConnected(final ComponentName componentName, final IBinder binder) { final ListenerRecord listenerRecord = this.mRecordMap.get(componentName); if (listenerRecord != null) { listenerRecord.service = INotificationSideChannel.Stub.asInterface(binder); listenerRecord.retryCount = 0; this.processListenerQueue(listenerRecord); } } private void handleServiceDisconnected(final ComponentName componentName) { final ListenerRecord listenerRecord = this.mRecordMap.get(componentName); if (listenerRecord != null) { this.ensureServiceUnbound(listenerRecord); } } private void processListenerQueue(final ListenerRecord listenerRecord) { if (Log.isLoggable("NotifManCompat", 3)) { final StringBuilder sb = new StringBuilder(); sb.append("Processing component "); sb.append(listenerRecord.componentName); sb.append(", "); sb.append(listenerRecord.taskQueue.size()); sb.append(" queued tasks"); Log.d("NotifManCompat", sb.toString()); } if (listenerRecord.taskQueue.isEmpty()) { return; } if (this.ensureServiceBound(listenerRecord) && listenerRecord.service != null) { while (true) { final Task task = listenerRecord.taskQueue.peek(); if (task == null) { break; } try { if (Log.isLoggable("NotifManCompat", 3)) { final StringBuilder sb2 = new StringBuilder(); sb2.append("Sending task "); sb2.append(task); Log.d("NotifManCompat", sb2.toString()); } task.send(listenerRecord.service); listenerRecord.taskQueue.remove(); continue; } catch (RemoteException ex) { final StringBuilder sb3 = new StringBuilder(); sb3.append("RemoteException communicating with "); sb3.append(listenerRecord.componentName); Log.w("NotifManCompat", sb3.toString(), (Throwable)ex); } catch (DeadObjectException ex2) { if (Log.isLoggable("NotifManCompat", 3)) { final StringBuilder sb4 = new StringBuilder(); sb4.append("Remote service has died: "); sb4.append(listenerRecord.componentName); Log.d("NotifManCompat", sb4.toString()); } } break; } if (!listenerRecord.taskQueue.isEmpty()) { this.scheduleListenerRetry(listenerRecord); } return; } this.scheduleListenerRetry(listenerRecord); } private void scheduleListenerRetry(final ListenerRecord listenerRecord) { if (this.mHandler.hasMessages(3, (Object)listenerRecord.componentName)) { return; } ++listenerRecord.retryCount; if (listenerRecord.retryCount > 6) { final StringBuilder sb = new StringBuilder(); sb.append("Giving up on delivering "); sb.append(listenerRecord.taskQueue.size()); sb.append(" tasks to "); sb.append(listenerRecord.componentName); sb.append(" after "); sb.append(listenerRecord.retryCount); sb.append(" retries"); Log.w("NotifManCompat", sb.toString()); listenerRecord.taskQueue.clear(); return; } final int n = (1 << listenerRecord.retryCount - 1) * 1000; if (Log.isLoggable("NotifManCompat", 3)) { final StringBuilder sb2 = new StringBuilder(); sb2.append("Scheduling retry for "); sb2.append(n); sb2.append(" ms"); Log.d("NotifManCompat", sb2.toString()); } this.mHandler.sendMessageDelayed(this.mHandler.obtainMessage(3, (Object)listenerRecord.componentName), (long)n); } private void updateListenerMap() { final Set<String> enabledListenerPackages = NotificationManagerCompat.getEnabledListenerPackages(this.mContext); if (enabledListenerPackages.equals(this.mCachedEnabledPackages)) { return; } this.mCachedEnabledPackages = enabledListenerPackages; final List queryIntentServices = this.mContext.getPackageManager().queryIntentServices(new Intent().setAction("android.support.BIND_NOTIFICATION_SIDE_CHANNEL"), 4); final HashSet<ComponentName> set = new HashSet<ComponentName>(); for (final ResolveInfo resolveInfo : queryIntentServices) { if (enabledListenerPackages.contains(resolveInfo.serviceInfo.packageName)) { final ComponentName componentName = new ComponentName(resolveInfo.serviceInfo.packageName, resolveInfo.serviceInfo.name); if (resolveInfo.serviceInfo.permission != null) { final StringBuilder sb = new StringBuilder(); sb.append("Permission present on component "); sb.append(componentName); sb.append(", not adding listener record."); Log.w("NotifManCompat", sb.toString()); } else { set.add(componentName); } } } for (final ComponentName componentName2 : set) { if (!this.mRecordMap.containsKey(componentName2)) { if (Log.isLoggable("NotifManCompat", 3)) { final StringBuilder sb2 = new StringBuilder(); sb2.append("Adding listener record for "); sb2.append(componentName2); Log.d("NotifManCompat", sb2.toString()); } this.mRecordMap.put(componentName2, new ListenerRecord(componentName2)); } } final Iterator<Map.Entry<ComponentName, ListenerRecord>> iterator3 = this.mRecordMap.entrySet().iterator(); while (iterator3.hasNext()) { final Map.Entry<ComponentName, ListenerRecord> entry = iterator3.next(); if (!set.contains(entry.getKey())) { if (Log.isLoggable("NotifManCompat", 3)) { final StringBuilder sb3 = new StringBuilder(); sb3.append("Removing listener record for "); sb3.append(entry.getKey()); Log.d("NotifManCompat", sb3.toString()); } this.ensureServiceUnbound(entry.getValue()); iterator3.remove(); } } } public boolean handleMessage(final Message message) { switch (message.what) { default: { return false; } case 3: { this.handleRetryListenerQueue((ComponentName)message.obj); return true; } case 2: { this.handleServiceDisconnected((ComponentName)message.obj); return true; } case 1: { final ServiceConnectedEvent serviceConnectedEvent = (ServiceConnectedEvent)message.obj; this.handleServiceConnected(serviceConnectedEvent.componentName, serviceConnectedEvent.iBinder); return true; } case 0: { this.handleQueueTask((Task)message.obj); return true; } } } public void onServiceConnected(final ComponentName componentName, final IBinder binder) { if (Log.isLoggable("NotifManCompat", 3)) { final StringBuilder sb = new StringBuilder(); sb.append("Connected to service "); sb.append(componentName); Log.d("NotifManCompat", sb.toString()); } this.mHandler.obtainMessage(1, (Object)new ServiceConnectedEvent(componentName, binder)).sendToTarget(); } public void onServiceDisconnected(final ComponentName componentName) { if (Log.isLoggable("NotifManCompat", 3)) { final StringBuilder sb = new StringBuilder(); sb.append("Disconnected from service "); sb.append(componentName); Log.d("NotifManCompat", sb.toString()); } this.mHandler.obtainMessage(2, (Object)componentName).sendToTarget(); } public void queueTask(final Task task) { this.mHandler.obtainMessage(0, (Object)task).sendToTarget(); } } private static class ListenerRecord { public boolean bound; public final ComponentName componentName; public int retryCount; public INotificationSideChannel service; public LinkedList<Task> taskQueue; public ListenerRecord(final ComponentName componentName) { this.bound = false; this.taskQueue = new LinkedList<Task>(); this.retryCount = 0; this.componentName = componentName; } } private interface Task { void send(final INotificationSideChannel p0) throws RemoteException; } }
[ "cheat.boss1@gmail.com" ]
cheat.boss1@gmail.com
74bf802c502c333137aafc4db234a2a77d22e05a
3fd527ca09d2e181d7d652c242d58aa033134bf4
/src/main/java/lpf/learn/codeforces/exercise/Q1203D2.java
3330d4cebc2f9e66edbcfda6c77eb9de902bd0dd
[ "Apache-2.0" ]
permissive
liupengfei123/algorithm
fa47ec6f128d7a5ec75a78b14e0301b9361d13b9
f7106c90793d04fccb84cd32776587c2d1d607a6
refs/heads/master
2023-09-02T12:21:30.320443
2023-08-24T03:19:44
2023-08-24T03:19:44
253,813,334
1
0
Apache-2.0
2020-10-16T07:04:09
2020-04-07T14:12:16
Java
UTF-8
Java
false
false
1,307
java
package lpf.learn.codeforces.exercise; import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Scanner; public class Q1203D2 { public static Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in))); public static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); public static void main(String[] args) { while (sc.hasNext()) { String s = sc.next(); String t = sc.next(); out.println(run(s, t)); } out.close(); } private static int run(String s, String t) { int sl = s.length(); int tl = t.length(); int[] dp1 = new int[tl + 1]; int[] dp2 = new int[tl + 1]; for (int i = 0, j = 0; i < tl; i++) { while (s.charAt(j) != t.charAt(i)) j++; dp1[i + 1] = j++; } for (int i = tl - 1, j = sl - 1; i >= 0; i--) { while (s.charAt(j) != t.charAt(i)) j--; dp2[i + 1] = j--; } int result = Math.max(sl - dp1[tl] - 1, dp2[1] - dp1[0]); for (int i = 1; i < tl; i++) { result = Math.max(result, dp2[i + 1] - dp1[i] - 1); } return result; } }
[ "liupf@bonree.com" ]
liupf@bonree.com
f0942f99f02018b246f61db8536a89bf3dca3457
f6d5657c7544fb899d232d611e712c0f79599694
/256PointFFt/src/txtFileGenerator/DmemGenerator.java
325e4fb2c604ae039477ec179b8c6194fbe500ca
[]
no_license
karthikgre273/256PointFFTDesignUsingJava
31b506de8f08100030d5a322557b87a5a9b3d5f3
b78a463a3b0698ef0ea6b9ca96857f1d355d1373
refs/heads/master
2022-09-21T11:14:54.021212
2020-05-26T09:16:34
2020-05-26T09:16:34
266,997,628
0
0
null
null
null
null
UTF-8
Java
false
false
7,949
java
package txtFileGenerator; import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; import java.text.DecimalFormat; import java.text.ParseException; public class DmemGenerator { double pi=3.14; //256 bits // int Npoint=256; // int numberOfStages=8; // int numberOfBitsToRepresetAllStates=10;//(Npoint/2)*numberOfStages; // int noOfBitsUsedForRepresentingEachNumber=20; //16 bits // int Npoint=16; // int numberOfStages=4; // int numberOfBitsToRepresetAllStates=6;//(Npoint/2)*numberOfStages; // int noOfBitsUsedForRepresentingEachNumber=20; //8 bits int Npoint=256; int numberOfStages=8; int numberOfBitsToRepresetAllStates=11;//(Npoint/2)*numberOfStages; int noOfBitsUsedForRepresentingEachNumber=30;int numberOfBitsToaddress=12; // int n=2; public static void main(String[] args) throws ParseException, IOException { DmemGenerator obj=new DmemGenerator(); obj.caseStatementGenerator(); } boolean stage0flag=false; public void caseStatementGenerator() throws IOException{ int caseVariable=1; BufferedWriter writer = new BufferedWriter(new FileWriter("caseOutput.v")); printHardCodeStatements(writer); printDefaultCaseStatements(writer); for (int stage = 0; stage < numberOfStages; stage++) { int currentStage; if(stage==0) {currentStage=numberOfStages-1;stage0flag=true;} else {currentStage=stage;stage0flag=false;} for(int p=0; p<Npoint/Math.pow ( 2, (currentStage+1));p++){ int firstVariable=(int) ((Math.pow ( 2, (currentStage+1)))*p); for(int q=0;q<(int)Math.pow ( 2, (currentStage));q++){ int input1=firstVariable+q; int input2=firstVariable+q+(int)Math.pow ( 2, (currentStage)); printCaseStatements(writer,caseVariable,input1,input2,currentStage,q); caseVariable++; } } } writer.write("\t\tendcase\n"); writer.write("end\n"); writer.write("endmodule\n"); writer.close(); } private void printHardCodeStatements(BufferedWriter writer) throws IOException { writer.write("module dataMem(input["+(numberOfBitsToRepresetAllStates-1)+":0] currentState," + "\ninput["+(numberOfBitsToaddress-1)+":0] stateIp1,stateIp2,stateIp3," + "\ninput ["+(noOfBitsUsedForRepresentingEachNumber-1)+":0] complexInput1,RealInput1,complexInput2,RealInput2,complexInput3,RealInput3," + "\noutput reg ["+(noOfBitsUsedForRepresentingEachNumber-1)+":0] complexOut1,complexOut2,realOut1,realOut2,twiddleFactorReal,twiddleFactorComplx," + "\noutput reg ["+(numberOfBitsToaddress-1)+":0] stateOp1,stateOp2," + "\noutput reg outputFlag," + "\ninput["+(numberOfBitsToaddress-1)+":0] outputAddress," + "\noutput reg ["+(noOfBitsUsedForRepresentingEachNumber-1)+":0] complexOutput,realOutput);\n"); writer.write("\n// ---------------------------\n"); writer.write("//from counter --> |state |-->\n"); writer.write("// --> |ReIp1 ReOp1 |-->\n"); writer.write("// --> |ReIp2 ReOp2 |-->\n"); writer.write("// --> |ReIp3 |-->\n"); writer.write("// --> |CmpIp1 CmpOp1 |-->\n"); writer.write("// --> |CmpIp2 CmpOp2 |-->\n"); writer.write("// --> |CmpIp3 |-->\n"); writer.write("// --> |state1 TwiddleRe |-->\n"); writer.write("// --> |state2 TwiddleCmplxOp|-->\n"); writer.write("// --> |state3 pushout |-->\n"); writer.write("// --> |currentstate |<--\n"); writer.write("// | state1 |-->\n"); writer.write("// | state2 |-->\n"); writer.write("// -----------^-------o-------\n"); writer.write("// | | \n"); writer.write("// clock reset\n\n"); writer.write("reg ["+(noOfBitsUsedForRepresentingEachNumber-1)+":0] complxMem[0:"+((Npoint*(numberOfStages+1))-1)+"],realMem[0:"+((Npoint*(numberOfStages+1))-1)+"];\n"); writer.write("always @(*) begin\n"); writer.write(" // output transfer begin\n"); writer.write("\t\tif((stateIp2+"+(Npoint)+")>12'd2048) begin\n"); writer.write("\t\toutputFlag<=1'b1;\n"); writer.write("\t\tend\n"); writer.write("\t\tcomplexOutput<=complxMem[outputAddress];\n"); writer.write("\t\trealOutput<=realMem[outputAddress];\n"); //write back writer.write("\t\trealMem[stateIp1]<=RealInput1;\n"); writer.write("\t\trealMem[stateIp2]<=RealInput2;\n"); writer.write("\t\trealMem[stateIp3]<=RealInput3;\n"); writer.write("\t\tcomplxMem[stateIp1]<=complexInput1;\n"); writer.write("\t\tcomplxMem[stateIp2]<=complexInput2;\n"); writer.write("\t\tcomplxMem[stateIp3]<=complexInput3;\n"); writer.write("\t\tcase (currentState)\n"); } private void printCaseStatements(BufferedWriter writer, int caseVariable, int input1, int input2, int currentStage, int q) throws IOException { writer.write("\t\t\t "+(numberOfBitsToRepresetAllStates)+"'d"+caseVariable+++" : begin\n"); writer.write("\t\t\t\t //("+input1+","+input2+")\n"); writer.write("\t\t\t\t complexOut1 = complxMem["+AddressGenerator(currentStage,input1)+"];\n"); writer.write("\t\t\t\t realOut1 = realMem["+AddressGenerator(currentStage,input1)+"];\n"); writer.write("\t\t\t\t complexOut2 = complxMem["+AddressGenerator(currentStage,input2)+"];\n"); writer.write("\t\t\t\t realOut2 = realMem["+AddressGenerator(currentStage,input2)+"];\n"); double real=twiddleFactorComputation(false,currentStage,q); double imag=twiddleFactorComputation(true,currentStage,q); writer.write("\t\t\t\t twiddleFactorReal ="+real+";\n"); writer.write("\t\t\t\t twiddleFactorComplx ="+(-imag)+";\n"); writer.write("\t\t\t\t stateOp1<="+(numberOfBitsToaddress)+"'d" +(AddressGenerator(currentStage,input1)+Npoint)+";\n"); writer.write("\t\t\t\t stateOp2<="+(numberOfBitsToaddress)+"'d" +(AddressGenerator(currentStage,input2)+Npoint)+";\n"); writer.write("\t\t\t end\n"); } private void printDefaultCaseStatements(BufferedWriter writer) throws IOException { writer.write("\t\t\t 0: begin\n"); writer.write("\t\t\t\t complexOut1 <= "+(noOfBitsUsedForRepresentingEachNumber)+"'d0;\n"); writer.write("\t\t\t\t realOut1 <= "+(noOfBitsUsedForRepresentingEachNumber)+"'d0;\n"); writer.write("\t\t\t\t complexOut2 <= "+(noOfBitsUsedForRepresentingEachNumber)+"'d0;\n"); writer.write("\t\t\t\t realOut2 <= "+(noOfBitsUsedForRepresentingEachNumber)+"'d0;\n"); writer.write("\t\t\t\t twiddleFactorReal <="+(noOfBitsUsedForRepresentingEachNumber)+"'d0;\n"); writer.write("\t\t\t\t twiddleFactorComplx <="+(noOfBitsUsedForRepresentingEachNumber)+"'d0;\n"); writer.write("\t\t\t\t stateOp1<="+( numberOfBitsToRepresetAllStates)+"'d0;\n"); writer.write("\t\t\t\t stateOp2<="+(numberOfBitsToRepresetAllStates)+"'d0;\n"); writer.write("\t\toutputFlag<=1'b0;\n"); writer.write("\t\t\t end\n"); writer.write("\t\t\t default: begin\n"); writer.write("\t\t\t\t complexOut1 = "+(noOfBitsUsedForRepresentingEachNumber)+"'dx;\n"); writer.write("\t\t\t\t realOut1 = "+(noOfBitsUsedForRepresentingEachNumber)+"'dx;\n"); writer.write("\t\t\t\t complexOut2 = "+(noOfBitsUsedForRepresentingEachNumber)+"'dx;\n"); writer.write("\t\t\t\t realOut2 = "+(noOfBitsUsedForRepresentingEachNumber)+"'dx;\n"); writer.write("\t\t\t\t twiddleFactorReal ="+(noOfBitsUsedForRepresentingEachNumber)+"'dx;\n"); writer.write("\t\t\t\t twiddleFactorComplx ="+(noOfBitsUsedForRepresentingEachNumber)+"'dx;\n"); writer.write("\t\t\t end\n"); } private int AddressGenerator(int currentStage, int level) { int stage=currentStage; if(stage0flag)stage=0; return stage*Npoint+level; } public double twiddleFactorComputation(boolean complexValue,int currentStage, int k){ double real; double imag; if(stage0flag){ real=Math.pow(2, 20); imag=0; } else{ real=Math.cos(pi*k/Math.pow(2, currentStage))*(Math.pow(2, 20)); imag=Math.sin(pi*k/Math.pow(2, currentStage))*(Math.pow(2, 20)); } if(complexValue)return imag; else return real; } }
[ "karthikgre273@gmail.com" ]
karthikgre273@gmail.com
a5102c1001e9a9aee4e06b0337d0fb1bc6c22894
94490f8d8ff3e470c324e75ac3d89d2d81dd56f7
/app/src/main/java/com/example/administrator/mofang/common/base/LazyFragment.java
15805e05cc87b33407d842f39e484e00be694342
[]
no_license
LXD312569496/MoFang
effca887d600810c561261e624659427f38022d6
190c03fb5da562747c611463bac5d749d762b8e2
refs/heads/master
2021-01-21T05:10:25.280653
2017-03-23T17:40:30
2017-03-23T17:40:30
83,143,212
2
2
null
null
null
null
UTF-8
Java
false
false
147
java
package com.example.administrator.mofang.common.base; /** * Created by asus on 2017/3/13. * 实现懒加载 */ public class LazyFragment { }
[ "13825833939qaz" ]
13825833939qaz
1825ab4d7d97693d12372f1edded7bb681473856
e9f769cd2ae57e7e062f6e22ab98dd533a659517
/app/src/main/java/com/zmj/mvc/example/model/IGirlModel.java
26942aa09930ca0673e250deba541a38c61e137a
[]
no_license
ZmjDns/mymvctest
971f00226b3b53aaa6d1b8e4d0f051d8d389d6af
5e4ac50249614d78082fb5344390c448aeaee88e
refs/heads/master
2020-03-31T11:57:37.325078
2018-11-18T14:48:45
2018-11-18T14:48:45
152,197,659
0
0
null
null
null
null
UTF-8
Java
false
false
360
java
package com.zmj.mvc.example.model; import com.zmj.mvc.example.entery.Girl; import java.util.List; /** * @author Zmj * @date 2018/10/30 * 加载数据 */ public interface IGirlModel { void loadGirl(GirlOnLoadListener listener); //设计一个内部回调接口 interface GirlOnLoadListener{ void onComplete(List<Girl> girls); } }
[ "292570927@qq.com" ]
292570927@qq.com
8cd2d014e6604101fa3dc35d3dea697fa23db88b
44d1ba2db43d56fc5ae9e39fb9f7843313aa5362
/librarys/src/main/java/com/singleman/gson/package-info.java
70e842e086c7bb31d3a7f9586474d4898548505f
[]
no_license
luyu344/okhttp_find
7da235c89df16f6043bfe685ee71c9872f490d74
dc69bb2faebb45ba803dc3389bdfdc22bf584e34
refs/heads/main
2023-01-18T22:01:38.732057
2020-11-30T09:21:17
2020-11-30T09:21:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
459
java
/** * This package provides the {@link com.singleman.gson.Gson} class to convert Json to Java and * vice-versa. * * <p>The primary class to use is {@link com.singleman.gson.Gson} which can be constructed with * {@code new Gson()} (using default settings) or by using {@link com.singleman.gson.GsonBuilder} * (to configure various options such as using versioning and so on).</p> * * @author Inderjeet Singh, Joel Leitch */ package com.singleman.gson;
[ "278149506@qq.com" ]
278149506@qq.com
b56d512ec0261efff142679204906469eb059e3d
7a0dd378d3d51a1699453680de6c548c28e15444
/src/override/MethodOverridingExample.java
b5fea22320789f129e28d4272bdb08b62b27896d
[]
no_license
starrynights89/IdeaProjects-OOP
ca1ec8fbbe0bdf7487f69f0b32ad0470e649bb5c
a905ed02882c6731c87602d0b624eddd0a8fef65
refs/heads/master
2020-03-16T05:44:26.044116
2018-05-09T00:33:10
2018-05-09T00:33:10
132,539,269
0
0
null
null
null
null
UTF-8
Java
false
false
646
java
package override; public class MethodOverridingExample { public static void makeItTalk(Animal input) { input.speak(); } public static void main(String[] args) { Animal myAnimal = new Animal(); Dog myDog = new Dog(); System.out.println("Make the Animal object speak:"); makeItTalk(myAnimal); System.out.println("Make the Dog object speak:"); makeItTalk(myDog); } } class Animal { public void speak() { System.out.println("Generic animal noise!"); } } class Dog extends Animal { public void speak() { System.out.println("Woof!"); } }
[ "alexander-hartson@live.com" ]
alexander-hartson@live.com
6a53d793e928ff4ab45427aa013ad15f25be99bc
1e1a56a925d5c0335df889d5975abc69a5ea153f
/mingrui-shop-parent/mingrui-shop-service-api/mingrui-shop-service-api-xxx/src/main/java/com/baidu/shop/config/MrSwagger2Config.java
a2c60ea0e6b506a191b0f28c78662282621d1e88
[]
no_license
WorldNo1Jax/mr-shop
b272ab3d24eaa311d8ed2b344e53948209ac8bb2
b443130bd94563e660b3adcf3adf1457becfb73e
refs/heads/master
2023-01-23T12:31:45.339433
2020-12-02T10:30:49
2020-12-02T10:30:49
290,701,392
0
0
null
null
null
null
UTF-8
Java
false
false
1,595
java
package com.baidu.shop.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.service.ApiInfo; import springfox.documentation.service.Contact; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.swagger2.annotations.EnableSwagger2; @Configuration @EnableSwagger2 public class MrSwagger2Config { @Bean public Docket createRestApi(){ return new Docket(DocumentationType.SWAGGER_2) .apiInfo(this.apiInfo()) .select() .apis(RequestHandlerSelectors.basePackage("com.baidu")) .paths(PathSelectors.any()) .build(); } private ApiInfo apiInfo(){ return new ApiInfoBuilder() //标题 .title("百度SWAGGER2标题") //条款地址 .termsOfServiceUrl("http://www.baidu.com") //联系方式-->有String参数的方法但是已经过时,所以不推荐使用 .contact(new Contact("luojingchen","baidu.com","1284611878@qq.com")) //版本 .version("v1.0") //项目描述 .description("描述") //创建API基本信息 .build(); } }
[ "1284611878@qq.com" ]
1284611878@qq.com
812f8b53d2ae6984b878e087c9f6f8806a97e682
5f847ed1838bced3f6257f44eb8b2fa626615702
/org.spick.hephaistos/src/main/java/org/spick/hephaistos/select/Select.java
844f4d3b030a0218cdc0ea40fee55e9073ad89ec
[ "MIT" ]
permissive
flwidmer/hephaistos
1b214fd99aa3afe565545d34943cd9af458e14c5
480305ae0836dc069a93b5033771306d00301199
refs/heads/master
2020-05-29T13:15:24.874658
2017-03-26T12:43:37
2017-03-26T12:43:37
82,592,712
0
0
null
null
null
null
UTF-8
Java
false
false
1,174
java
package org.spick.hephaistos.select; import java.util.Arrays; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; import java.util.stream.Stream; import org.spick.hephaistos.from.From; import org.spick.hephaistos.from.FromExpression; import org.spick.hephaistos.internal.IPrintable; import org.spick.hephaistos.table.TableExpression; import org.spick.hephaistos.util.ListUtil; /** * select expresison starting a select statement * @author Florian * */ public class Select implements IPrintable { private List<? extends SelectColumn> selectList; public Select(SelectColumn[] selectList) { this(Arrays.asList(selectList)); } public Select(List<? extends SelectColumn> selectList) { Objects.requireNonNull(selectList); this.selectList = selectList; } public From from(FromExpression... fromList) { return new From(this, fromList); } public From from(String... fromList) { return new From(this, Stream.of(fromList).map(TableExpression::new).collect(Collectors.toList())); } @Override public String print() { return "select " + ListUtil.commaList(selectList); } }
[ "florian.widmer@gmail.com" ]
florian.widmer@gmail.com
e6340755ad528b0ff3b5d29e93ca47dc4e7d1ce4
ad3f477864ce8acc53d9398a331d4c1b4d14886d
/entry/src/main/java/com/huawei/codelab/slice/SplashScreenAbilitySlice.java
7c4c0044026389a4e44cbf069b827634fb99e7a8
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
justZL/-
b1f3ca5feffd891967dee41711a653ac6cf7ee68
6ccf68fd85443959d20b1d23adb6c5eb77dfcd47
refs/heads/main
2023-08-23T06:29:21.706007
2021-10-25T10:51:46
2021-10-25T10:51:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
577
java
package com.huawei.codelab.slice; import com.huawei.codelab.ResourceTable; import ohos.aafwk.ability.AbilitySlice; import ohos.aafwk.content.Intent; public class SplashScreenAbilitySlice extends AbilitySlice { @Override public void onStart(Intent intent) { super.onStart(intent); super.setUIContent(ResourceTable.Layout_splash_screen_layout); } @Override public void onActive() { super.onActive(); } @Override public void onForeground(Intent intent) { super.onForeground(intent); } }
[ "noreply@github.com" ]
noreply@github.com
d4d83dfd91e422a34ba5374ba49eb246c8dbc837
64378d555b38cf82131f9a7bdba0462518f8aec7
/src/miat/pathfinding/benchmark/BenchmarkShortestPathScaleFree.java
f80b09c7c0a002226c71884a5941909ce60ea53b
[]
no_license
ptaillandier/PathFindingBenchmark
bde36f23b0ec3595c738659bb3b4b389ec290eda
083e820e909333c5bcaa79f6335d026a01f91cc0
refs/heads/master
2021-05-10T16:55:49.721580
2018-01-25T15:39:41
2018-01-25T15:39:41
118,590,988
2
1
null
2018-01-25T15:39:42
2018-01-23T09:53:31
Java
UTF-8
Java
false
false
688
java
package miat.pathfinding.benchmark; import java.util.List; import java.util.Random; import org.jgraph.graph.DefaultEdge; import miat.pathfinding.graph.BenchmarkGraph; import miat.pathfinding.graphGeneration.RandomGraphs; import miat.pathfinding.shortestpath.ShortestPathAlgorithm; public class BenchmarkShortestPathScaleFree extends AbstractBenchmarkGraph<Integer, DefaultEdge>{ public void run(List<ShortestPathAlgorithm> algos,final int nbTests, final Integer nbNodes, boolean weighted, final Random rand){ BenchmarkGraph<Integer, DefaultEdge> graph = RandomGraphs.generateScaleFreeGraph(nbNodes, weighted, rand); runAlgorithms1Path(algos,graph, nbTests, rand, false); } }
[ "patrick@147.99.96.186" ]
patrick@147.99.96.186
a9d126047f7e96fae7c8fc6037c2be7a45cb16bd
be73270af6be0a811bca4f1710dc6a038e4a8fd2
/crash-reproduction-moho/results/XWIKI-14263-122-25-NSGA_II-LineCoverage:ExceptionType:StackTraceSimilarity/org/xwiki/resource/servlet/RoutingFilter_ESTest_scaffolding.java
ca451b70995bfb341e58bc736cfe1333f30d2b24
[]
no_license
STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application
cf118b23ecb87a8bf59643e42f7556b521d1f754
3bb39683f9c343b8ec94890a00b8f260d158dfe3
refs/heads/master
2022-07-29T14:44:00.774547
2020-08-10T15:14:49
2020-08-10T15:14:49
285,804,495
0
0
null
null
null
null
UTF-8
Java
false
false
444
java
/** * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite * Tue Apr 07 02:55:46 UTC 2020 */ package org.xwiki.resource.servlet; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; import org.junit.Before; import org.junit.After; @EvoSuiteClassExclude public class RoutingFilter_ESTest_scaffolding { // Empty scaffolding for empty test suite }
[ "pouria.derakhshanfar@gmail.com" ]
pouria.derakhshanfar@gmail.com
66f3970f1223bbb45f7bead9cbbe63feee404d81
8e4cb0fca1c9fd6214f2dafccfd114cfe9bd4972
/my02/src/exam/친구.java
de8e821869c8a40b3d007473cb37b85f4433d8c2
[]
no_license
shockim3710/Java_2020
9e55c609e1e5ebf94a95d51a4fb347525a6dcf73
0960537da74e5d7de122ca0b7421fc3a68be91eb
refs/heads/master
2022-03-30T22:38:53.767443
2020-02-06T13:12:06
2020-02-06T13:12:06
238,185,117
0
0
null
null
null
null
UTF-8
Java
false
false
524
java
package exam; public class 친구 { public static void main(String[] args) { // 컨트롤+쉬프트+f - 자동포맷팅 (코딩 정리) int h = 170; double l = 60.5; char s = '남'; String name = "홍길동"; System.out.println("제 친구 이름은 " + name + " 입니다."); System.out.println("제 친구는 " + s + "자 입니다."); System.out.println("제 친구 키는 " + h + "cm 입니다."); System.out.println("제 친구 몸무게는 " + l + "kg 입니다."); } }
[ "noreply@github.com" ]
noreply@github.com
8bedecc67ff0c32714b1656de68448f7f22ba665
cbabffb655ff4e268a9d894ae25eac439d5d2cfb
/src/main/java/com/client/controller/TestFileHandlerClient.java
49674647b4443218a23df5f8a7fd2b0e4b400fa1
[]
no_license
dhananjaysinghar/Spring-Boot-Rest-API-Client-With-Interceptors
4b3269c3f5f5362cfa63fdc716ffe21b32ae362a
a4cbde512b39c35402f8437aac7aba5b65b429ba
refs/heads/master
2022-02-21T14:40:32.185662
2019-09-16T06:53:49
2019-09-16T06:53:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,310
java
package com.client.controller; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import org.springframework.beans.factory.annotation.Lookup; import org.springframework.core.io.FileSystemResource; import org.springframework.http.MediaType; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.multipart.MultipartFile; import com.client.util.RestServiceInvoker; @Controller public class TestFileHandlerClient { @Lookup public RestServiceInvoker getRestServiceInvoker(){ return null; } @GetMapping("/") public String index() { return "upload"; } @PostMapping(value = "/upload") public String sendFile(@RequestParam("file") MultipartFile file,ModelMap model) { try { /* MultiValueMap<String, Object> parts = new LinkedMultiValueMap<String, Object>(); parts.add("file", convertMultiPartToFileSystemResource(file)); HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.MULTIPART_FORM_DATA); HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<MultiValueMap<String, Object>>(parts, headers); restTemplate.exchange("http://localhost:8080/file/uploadFile", HttpMethod.POST, requestEntity, String.class); */ String res = getRestServiceInvoker() .path("http://localhost:8080/file/uploadFile") .post() .contentType(MediaType.MULTIPART_FORM_DATA) .formParam("file",convertMultiPartToFileSystemResource(file)) .invoke(String.class); model.put("message", res); } catch (Exception e) { model.put("message", "File Upload Failed!! :: "+e.getLocalizedMessage()); return "upload-failed"; } return "upload-success"; } private FileSystemResource convertMultiPartToFileSystemResource(MultipartFile file) throws IOException { File convFile = new File(file.getOriginalFilename()); FileOutputStream fos = new FileOutputStream(convFile); fos.write(file.getBytes()); fos.close(); return new FileSystemResource(convFile); } }
[ "noreply@github.com" ]
noreply@github.com
bb49a50a65d1be909eee5362b558bc2e9dc1ddfb
6fa9eda692cf4fe6d48f2d40600db59c20803577
/platform-emf/src/main/java/com/softicar/platform/emf/module/AbstractEmfModule.java
4e0c4601b7e1b326dbd4ba728839078d7221d120
[ "MIT" ]
permissive
softicar/platform
a5cbfcfe0e6097feae7f42d3058e716836c9f592
a6dad805156fc230a47eb7406959f29c59f2d1c2
refs/heads/main
2023-09-01T12:16:01.370646
2023-08-29T08:50:46
2023-08-29T08:50:46
408,834,598
4
2
MIT
2023-08-08T12:40:04
2021-09-21T13:38:04
Java
UTF-8
Java
false
false
2,136
java
package com.softicar.platform.emf.module; import com.softicar.platform.common.core.i18n.IDisplayString; import com.softicar.platform.common.core.java.packages.name.JavaPackageName; import com.softicar.platform.common.core.utils.DevNull; import com.softicar.platform.emf.module.extension.IEmfModuleExtensionRegistry; import com.softicar.platform.emf.module.message.bus.IEmfModuleMessageBus; import com.softicar.platform.emf.page.EmfPagePath; import java.util.Collection; /** * Common base class of all modules. * * @author Alexander Schmidt * @author Oliver Richers * @see IEmfModule */ public abstract class AbstractEmfModule<I extends IEmfModuleInstance<I>> implements IEmfModule<I> { @Override public final String getClassName() { return getClass().getSimpleName(); } @Override public IDisplayString toDisplay() { return IDisplayString.create(getClassName()); } @Override public final JavaPackageName getModulePackage() { return new JavaPackageName(getClass()); } @Override public EmfPagePath getDefaultPagePath(I moduleInstance) { return new EmfPagePath().append(toDisplay()); } @Override public void prefetchPageLinkGenerationData(Collection<I> moduleInstances) { // nothing to prefetch by default } /** * Registers message consumers to the provided {@link IEmfModuleMessageBus}. * <p> * Should be overridden if necessary. Does nothing by default. * * @param messageBus * the {@link IEmfModuleMessageBus} to which message consumers * shall be registered (never null) */ @Override public void registerMessageConsumers(IEmfModuleMessageBus messageBus) { DevNull.swallow(messageBus); } /** * Registers extensions to the provided {@link IEmfModuleExtensionRegistry}. * <p> * Should be overridden if necessary. Does nothing by default. * * @param extensionRegistry * the {@link IEmfModuleExtensionRegistry} to which message * consumers shall be registered (never null) */ @Override public void registerExtensions(IEmfModuleExtensionRegistry extensionRegistry) { DevNull.swallow(extensionRegistry); } }
[ "noreply@github.com" ]
noreply@github.com
2e56d28aba17ba11e3e5a53a9a3ac0b8c894bdc9
b91ff2826f5ae422e84520f2cbf9b83c20e0700b
/Dragonfly/src/org/DragonflyAutomation/WaitForReadyState.java
5c609bf7452bae2a20459e98466ca09e225469e3
[]
no_license
clu63/dragonfly
b85a584b9bd1f71491aee4cb2d0347919bdfc3b6
1a98c973b04bdef15e30a9703f05c47647f42728
refs/heads/master
2022-05-30T19:33:24.239503
2021-10-06T14:30:06
2021-10-06T14:30:06
27,363,395
0
0
null
2022-05-20T22:02:35
2014-12-01T04:59:17
Java
UTF-8
Java
false
false
438
java
package org.DragonflyAutomation; import org.openqa.selenium.JavascriptExecutor; class WaitForReadyState { boolean run() { Logger.getInstance().add(" ==start==>WaitForReadyState " + Util.getDateTimestamp()); Logger.getInstance().add("waitForReadyState: document.readyState Milliseconds Waited = " + ((JavascriptExecutor) BrowserDriver.getInstance().browserDriver).executeScript("return document.readyState")); return false; } }
[ "Joseph.X.Perrotta.-ND@disney.com" ]
Joseph.X.Perrotta.-ND@disney.com